From ca7341269959f106656efa78f17628560105bd3d Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 25 Jul 2005 15:56:27 +0000 Subject: *** empty log message *** --- src/player.cc | 47 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 7 deletions(-) (limited to 'src/player.cc') 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 */ -- cgit v1.2.3