From d409fea3abf719dc68c9dd6e6f1af8408ba6a6b3 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 30 Jul 2000 16:14:22 +0200 Subject: [PATCH] Modified function of 'Up' key in replay mode --- HISTORY | 4 ++ MANUAL | 6 +-- dvbapi.c | 144 +++++++++++++++++++++++++++++-------------------------- dvbapi.h | 19 ++++---- menu.c | 14 +++--- 5 files changed, 102 insertions(+), 85 deletions(-) diff --git a/HISTORY b/HISTORY index 58e7f1cd..f8e39112 100644 --- a/HISTORY +++ b/HISTORY @@ -112,3 +112,7 @@ Video Disk Recorder Revision History - New command line option '-l' to set the log level. - Times in timers.conf are now always printed with 4 digits (leading '0'). - Slow forward/back mode (thanks to Guido Fiala!). +- The "Up" key in replay mode no longer restarts replay at the very beginning, + but rather resumes normal replay mode after a "pause", "forward" or "backward" + operation. Use the "Skip -60s" function repeatedly to go back to the beginning + of the recording. diff --git a/MANUAL b/MANUAL index 9d94a5ad..b05c3508 100644 --- a/MANUAL +++ b/MANUAL @@ -10,7 +10,7 @@ Video Disk Recorder User's Manual Key Normal Main Channels Timer Edit/New Recordings Replay - Up Ch up Crsr up Crsr up Crsr up Crsr up Crsr up Begin + Up Ch up Crsr up Crsr up Crsr up Crsr up Crsr up Play Down Ch down Crsr down Crsr down Crsr down Crsr down Crsr down Pause Left - - - Disable Decrement - Search back Right - - - Enable Increment - Search forward @@ -93,8 +93,8 @@ Video Disk Recorder User's Manual The following keys have the listed meaning in Replay mode: - - Up Positions to beginning of the recording and starts playback - from there. + - Up Resumes normal replay from any "pause", "forward" or "backward" + mode. - Down Halts playback at the current position. Press again to continue playback. - Blue Stops playback and stores the current position, so that diff --git a/dvbapi.c b/dvbapi.c index c85be90b..763ddfc4 100644 --- a/dvbapi.c +++ b/dvbapi.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbapi.c 1.18 2000/07/30 14:34:07 kls Exp $ + * $Id: dvbapi.c 1.19 2000/07/30 16:14:22 kls Exp $ */ #include "dvbapi.h" @@ -1105,7 +1105,7 @@ cDvbApi::~cDvbApi() { if (videoDev >= 0) { Close(); - StopReplay(); + Stop(); StopRecord(); close(videoDev); } @@ -1403,7 +1403,7 @@ bool cDvbApi::StartRecord(const char *FileName) } if (videoDev >= 0) { - StopReplay(); // TODO: remove this if the driver is able to do record and replay at the same time + Stop(); // TODO: remove this if the driver is able to do record and replay at the same time // Check FileName: @@ -1525,7 +1525,7 @@ bool cDvbApi::StartReplay(const char *FileName, const char *Title) esyslog(LOG_ERR, "ERROR: StartReplay() called while recording - ignored!"); return false; } - StopReplay(); + Stop(); if (videoDev >= 0) { lastProgress = lastTotal = -1; @@ -1596,65 +1596,69 @@ bool cDvbApi::StartReplay(const char *FileName, const char *Title) } if (FD_ISSET(fromMain, &setIn)) { switch (readchar(fromMain)) { - case dvbStop: SetReplayMode(VID_PLAY_CLEAR_BUFFER); - Buffer->Stop(); break; - case dvbPauseReplay: SetReplayMode(Paused ? VID_PLAY_NORMAL : VID_PLAY_PAUSE); - Paused = !Paused; - if (FastForward || FastRewind) { - SetReplayMode(VID_PLAY_CLEAR_BUFFER); - Buffer->Clear(); - } - FastForward = FastRewind = false; + case dvbStop: SetReplayMode(VID_PLAY_CLEAR_BUFFER); + Buffer->Stop(); + break; + case dvbPause: SetReplayMode(Paused ? VID_PLAY_NORMAL : VID_PLAY_PAUSE); + Paused = !Paused; + if (FastForward || FastRewind) { + SetReplayMode(VID_PLAY_CLEAR_BUFFER); + Buffer->Clear(); + } + FastForward = FastRewind = false; + Buffer->SetMode(rmPlay); + break; + case dvbPlay: if (FastForward || FastRewind || Paused) { + SetReplayMode(VID_PLAY_CLEAR_BUFFER); + SetReplayMode(VID_PLAY_NORMAL); + FastForward = FastRewind = Paused = false; Buffer->SetMode(rmPlay); - break; - case dvbFastForward: SetReplayMode(VID_PLAY_CLEAR_BUFFER); - Buffer->Clear(); - FastForward = !FastForward; - FastRewind = false; - if (Paused) { - Buffer->SetMode(rmPlay); - Buffer->Read(); - SetReplayMode(FastForward ? VID_PLAY_SLOW_MOTION : VID_PLAY_PAUSE); - Buffer->Write(); - } - else { - SetReplayMode(VID_PLAY_NORMAL); - Buffer->SetMode(FastForward ? rmFastForward : rmPlay); - } - break; - case dvbFastRewind: SetReplayMode(VID_PLAY_CLEAR_BUFFER); - Buffer->Clear(); - FastRewind = !FastRewind; - FastForward = false; - if (Paused) { - Buffer->SetMode(FastRewind ? rmSlowRewind : rmPlay); - Buffer->Read(); - SetReplayMode(FastRewind ? VID_PLAY_NORMAL : VID_PLAY_PAUSE); - Buffer->Write(); - } - else { - SetReplayMode(VID_PLAY_NORMAL); - Buffer->SetMode(FastRewind ? rmFastRewind : rmPlay); - } - break; - case dvbSkip: { - int Seconds; - if (readint(fromMain, Seconds)) { - SetReplayMode(VID_PLAY_CLEAR_BUFFER); - SetReplayMode(VID_PLAY_NORMAL); - FastForward = FastRewind = Paused = false; - Buffer->SetMode(rmPlay); - Buffer->SkipSeconds(Seconds); - } } - break; - case dvbGetIndex: { - int Current, Total; - Buffer->GetIndex(Current, Total); - writeint(toMain, Current); - writeint(toMain, Total); + break; + case dvbForward: SetReplayMode(VID_PLAY_CLEAR_BUFFER); + Buffer->Clear(); + FastForward = !FastForward; + FastRewind = false; + if (Paused) { + Buffer->SetMode(rmPlay); + SetReplayMode(FastForward ? VID_PLAY_SLOW_MOTION : VID_PLAY_PAUSE); } - break; + else { + SetReplayMode(VID_PLAY_NORMAL); + Buffer->SetMode(FastForward ? rmFastForward : rmPlay); + } + break; + case dvbBackward: SetReplayMode(VID_PLAY_CLEAR_BUFFER); + Buffer->Clear(); + FastRewind = !FastRewind; + FastForward = false; + if (Paused) { + Buffer->SetMode(FastRewind ? rmSlowRewind : rmPlay); + SetReplayMode(FastRewind ? VID_PLAY_NORMAL : VID_PLAY_PAUSE); + } + else { + SetReplayMode(VID_PLAY_NORMAL); + Buffer->SetMode(FastRewind ? rmFastRewind : rmPlay); + } + break; + case dvbSkip: { + int Seconds; + if (readint(fromMain, Seconds)) { + SetReplayMode(VID_PLAY_CLEAR_BUFFER); + SetReplayMode(VID_PLAY_NORMAL); + FastForward = FastRewind = Paused = false; + Buffer->SetMode(rmPlay); + Buffer->SkipSeconds(Seconds); + } + } + break; + case dvbGetIndex: { + int Current, Total; + Buffer->GetIndex(Current, Total); + writeint(toMain, Current); + writeint(toMain, Total); + } + break; } } } @@ -1680,7 +1684,7 @@ bool cDvbApi::StartReplay(const char *FileName, const char *Title) return false; } -void cDvbApi::StopReplay(void) +void cDvbApi::Stop(void) { if (pidReplay) { writechar(toReplay, dvbStop); @@ -1693,22 +1697,28 @@ void cDvbApi::StopReplay(void) } } -void cDvbApi::PauseReplay(void) +void cDvbApi::Pause(void) { if (pidReplay) - writechar(toReplay, dvbPauseReplay); + writechar(toReplay, dvbPause); } -void cDvbApi::FastForward(void) +void cDvbApi::Play(void) { if (pidReplay) - writechar(toReplay, dvbFastForward); + writechar(toReplay, dvbPlay); } -void cDvbApi::FastRewind(void) +void cDvbApi::Forward(void) { if (pidReplay) - writechar(toReplay, dvbFastRewind); + writechar(toReplay, dvbForward); +} + +void cDvbApi::Backward(void) +{ + if (pidReplay) + writechar(toReplay, dvbBackward); } void cDvbApi::Skip(int Seconds) diff --git a/dvbapi.h b/dvbapi.h index a43ba0ee..25452cfa 100644 --- a/dvbapi.h +++ b/dvbapi.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbapi.h 1.11 2000/06/24 14:03:57 kls Exp $ + * $Id: dvbapi.h 1.12 2000/07/30 15:01:01 kls Exp $ */ #ifndef __DVBAPI_H @@ -104,9 +104,10 @@ public: private: enum { dvbStop = 1, // let's not have 0 as a command - dvbPauseReplay, - dvbFastForward, - dvbFastRewind, + dvbPause, + dvbPlay, + dvbForward, + dvbBackward, dvbSkip, dvbGetIndex, }; @@ -136,13 +137,15 @@ public: // If there is already a replay session active, it will be stopped // and the new file will be played back. // If provided Title will be used in the progress display. - void StopReplay(void); + void Stop(void); // Stops the current replay session (if any). - void PauseReplay(void); + void Pause(void); // Pauses the current replay session, or resumes a paused session. - void FastForward(void); + void Play(void); + // Resumes normal replay mode. + void Forward(void); // Runs the current replay session forward at a higher speed. - void FastRewind(void); + void Backward(void); // Runs the current replay session backwards at a higher speed. void Skip(int Seconds); // Skips the given number of seconds in the current replay session. diff --git a/menu.c b/menu.c index 17a9b0b5..6df56193 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.20 2000/07/24 16:25:53 kls Exp $ + * $Id: menu.c 1.21 2000/07/30 15:04:10 kls Exp $ */ #include "menu.h" @@ -1243,7 +1243,7 @@ cReplayControl::cReplayControl(void) cReplayControl::~cReplayControl() { Hide(); - dvbApi->StopReplay(); + dvbApi->Stop(); } void cReplayControl::SetRecording(const char *FileName, const char *Title) @@ -1278,13 +1278,13 @@ eOSState cReplayControl::ProcessKey(eKeys Key) if (visible) shown = dvbApi->ShowProgress(!shown) || shown; switch (Key) { - case kUp: dvbApi->Skip(-INT_MAX); break; - case kDown: dvbApi->PauseReplay(); break; + case kUp: dvbApi->Play(); break; + case kDown: dvbApi->Pause(); break; case kBlue: Hide(); - dvbApi->StopReplay(); + dvbApi->Stop(); return osEnd; - case kLeft: dvbApi->FastRewind(); break; - case kRight: dvbApi->FastForward(); break; + case kLeft: dvbApi->Backward(); break; + case kRight: dvbApi->Forward(); break; case kGreen: dvbApi->Skip(-60); break; case kYellow: dvbApi->Skip(60); break; case kMenu: Hide(); return osMenu; // allow direct switching to menu