summaryrefslogtreecommitdiff
path: root/src/player.cc
diff options
context:
space:
mode:
authordeva <deva>2005-09-25 20:59:02 +0000
committerdeva <deva>2005-09-25 20:59:02 +0000
commit9640339f2e9dc126406f6b6f8a091b924898b4f5 (patch)
treedad14d120f0fc4401552714b5efffe20b5c78a4d /src/player.cc
parent36326a9c1bab28c5eccea6cc2c56c9a8b83dac0d (diff)
*** empty log message ***
Diffstat (limited to 'src/player.cc')
-rw-r--r--src/player.cc46
1 files changed, 44 insertions, 2 deletions
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 */