From 9640339f2e9dc126406f6b6f8a091b924898b4f5 Mon Sep 17 00:00:00 2001 From: deva Date: Sun, 25 Sep 2005 20:59:02 +0000 Subject: *** empty log message *** --- src/player.cc | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) (limited to 'src/player.cc') diff --git a/src/player.cc b/src/player.cc index de4e335..2f0638f 100644 --- a/src/player.cc +++ b/src/player.cc @@ -55,6 +55,8 @@ Player::Player(Info *ginfo, { // No errors has ocurred... yet! noErrors = true; + + yuv_draw = new YUVDraw(); width = w; height = h; @@ -71,11 +73,18 @@ Player::Player(Info *ginfo, initSDL(); bypass = false; + + // Do not show the text + showtext = false; + recording = false; + recording_prev = !recording; + cprchanged = false; } Player::~Player() { deinitSDL(); + if(yuv_draw) delete yuv_draw; } void Player::reinitSDL() @@ -130,6 +139,8 @@ void Player::initSDL() rect.y = 0; rect.w = width; rect.h = height; + + yuv_draw->setOverlay(overlay); } void Player::player() @@ -184,7 +195,7 @@ void Player::player() first = false; } - SDL_LockYUVOverlay(overlay); + if(SDL_LockYUVOverlay(overlay) == -1) info->error("SDL_LockYUVOverlay failed."); // libdv img decode to yuv dv_decode_full_frame(decoder, @@ -193,6 +204,19 @@ void Player::player() overlay->pixels, pitches); + if(showtext) { + if(cprchanged) { + yuv_draw->setBottomText(cpr); + cprchanged = false; + } + if(recording != recording_prev) { + if(recording) yuv_draw->setTopText("Recording"); + else yuv_draw->setTopText("Stopped"); + recording_prev = recording; + } + yuv_draw->draw(); + } + SDL_UnlockYUVOverlay(overlay); SDL_DisplayYUVOverlay(overlay, &rect); delete frame; @@ -240,7 +264,7 @@ void Player::stop() // FIXME: Worst case genario: the loop takes more than 1 second // to stop displaying => crash, due to deinitialization // of SDL, while calling it.! -void Player::resize(int w, int h) +void Player::resize(int w, int h, bool s) { // Tell loop to stop bypass = true; @@ -260,6 +284,24 @@ void Player::resize(int w, int h) // Tell loop to go on. bypass = false; + + showtext = s; +} + +void Player::setCpr(char *newcpr, char* name) +{ + sprintf(cpr, "ID: %s - %s", newcpr, name); + cprchanged = true; +} + +void Player::startrecord() +{ + recording = true; +} + +void Player::stoprecord() +{ + recording = false; } #endif /* USE_GUI */ -- cgit v1.2.3