summaryrefslogtreecommitdiff
path: root/src/player.cc
diff options
context:
space:
mode:
authordeva <deva>2005-07-25 15:56:27 +0000
committerdeva <deva>2005-07-25 15:56:27 +0000
commitca7341269959f106656efa78f17628560105bd3d (patch)
tree662a9ff242eebdbc7a393c5baaa356adf57a05a1 /src/player.cc
parent8c381fe44a179b4b84ecc50e810980f7af9a0f58 (diff)
*** empty log message ***
Diffstat (limited to 'src/player.cc')
-rw-r--r--src/player.cc47
1 files changed, 40 insertions, 7 deletions
diff --git a/src/player.cc b/src/player.cc
index 567ac2f..e42b332 100644
--- a/src/player.cc
+++ b/src/player.cc
@@ -39,6 +39,9 @@
/*
* $Log$
+ * Revision 1.28 2005/07/25 15:56:27 deva
+ * *** empty log message ***
+ *
* Revision 1.27 2005/07/25 14:27:14 deva
* *** empty log message ***
*
@@ -93,6 +96,30 @@ Player::Player(Info *ginfo,
sem_init(&play_sem, 0, 1);
+ initSDL();
+
+ doresize = false;
+}
+
+Player::~Player()
+{
+ deinitSDL();
+}
+
+void Player::reinitSDL()
+{
+ deinitSDL();
+ initSDL();
+}
+
+void Player::deinitSDL()
+{
+ SDL_FreeYUVOverlay(overlay);
+ SDL_Quit();
+}
+
+void Player::initSDL()
+{
if(SDL_Init(SDL_INIT_VIDEO) < 0) {
info->error("Unable to init SDL: %s.", SDL_GetError());
noErrors = false;
@@ -106,7 +133,7 @@ Player::Player(Info *ginfo,
if(!screen) {
info->error("Unable to set %dx%d video: %s.",
- width, height, SDL_GetError());
+ 720, 576, SDL_GetError());
noErrors = false;
return;
}
@@ -122,12 +149,6 @@ Player::Player(Info *ginfo,
}
}
-Player::~Player()
-{
- SDL_FreeYUVOverlay(overlay);
- SDL_Quit();
-}
-
void Player::player()
{
SDL_Event event;
@@ -155,6 +176,11 @@ void Player::player()
sem_wait(&play_sem);
sem_post(&play_sem);
+ if(doresize) {
+ doresize = false;
+ reinitSDL();
+ }
+
if(!SDL_WaitEvent(&event)) break; // FIXME: Gracefully exit...
switch(event.type) {
@@ -238,4 +264,11 @@ void Player::stop()
sem_wait(&play_sem);
}
+void Player::resize(int w, int h)
+{
+ width = w;
+ height = h;
+ doresize = true;
+}
+
#endif /* USE_GUI */