From 8e7c06006f8667148f6564326be2deafa5a3a3e8 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 11 Aug 2001 14:30:21 +0200 Subject: [PATCH] Implemented 'Jump' function in replay mode --- CONTRIBUTORS | 1 + HISTORY | 3 ++ MANUAL | 6 +++- dvbapi.c | 4 +-- dvbapi.h | 4 ++- i18n.c | 10 +++++- menu.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++- menu.h | 7 +++- 8 files changed, 127 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 9b542530..bcd6c721 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -99,6 +99,7 @@ Stefan Huelswitt for fixing the repeat function with LIRC for making the position of the channel display configurable for making the width and height of the OSD configurable + for implementing the "Jump" function in replay mode Ulrich Röder for pointing out that there are channels that have a symbol rate higher than diff --git a/HISTORY b/HISTORY index 35be5b3d..93b59463 100644 --- a/HISTORY +++ b/HISTORY @@ -642,3 +642,6 @@ Video Disk Recorder Revision History See 'vdr --help' for details. - Making sure the disk is up and running before starting recording (this is important for systems that turn off the video disk when it is not used). +- Added the "Jump" function in replay mode (thanks to Stefan Huelswitt). + See the description of the "Red" key in MANUAL under "Replay Control" for + details. diff --git a/MANUAL b/MANUAL index 59ff57c9..17f02483 100644 --- a/MANUAL +++ b/MANUAL @@ -17,7 +17,7 @@ Video Disk Recorder User's Manual Ok Ch display Select Switch Edit Accept Play Progress disp. Menu Menu on Menu off Menu off Menu off Menu off Menu off Menu on Back - Menu off Main menu Main menu Discard Main menu Recordings menu - Red - Record Edit Edit - Play - + Red - Record Edit Edit - Play Jump Green - Language New New - Rewind Skip -60s Yellow - Eject DVD Delete Delete - Delete Skip +60s Blue - Resume Mark Mark - Summary Stop @@ -172,6 +172,10 @@ Video Disk Recorder User's Manual backward at a slower speed; press again to return to pause mode. Pressing and holding down the button performs the function until the button is released again. + - Red Jump to a specific location. Enter the time you want to jump to + and then press "Left" or "Right" to jump relative to the current + position, "Up" to jump to an absolute position, and "Down" to + jump and pause at an absolute position. - Green Yellow Skips about 60 seconds back or forward. Pressing and holding down the button performs the function until diff --git a/dvbapi.c b/dvbapi.c index 7f728b61..65f7e254 100644 --- a/dvbapi.c +++ b/dvbapi.c @@ -7,7 +7,7 @@ * DVD support initially written by Andreas Schultz * based on dvdplayer-0.5 by Matjaz Thaler * - * $Id: dvbapi.c 1.104 2001/08/11 10:17:26 kls Exp $ + * $Id: dvbapi.c 1.105 2001/08/11 12:21:49 kls Exp $ */ //#define DVDDEBUG 1 @@ -57,8 +57,6 @@ extern "C" { // The maximum size of a single frame: #define MAXFRAMESIZE (192*1024) -#define FRAMESPERSEC 25 - // The maximum file size is limited by the range that can be covered // with 'int'. 4GB might be possible (if the range is considered // 'unsigned'), 2GB should be possible (even if the range is considered diff --git a/dvbapi.h b/dvbapi.h index d51005a4..2cd57bfa 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.45 2001/08/10 14:56:40 kls Exp $ + * $Id: dvbapi.h 1.46 2001/08/11 12:22:01 kls Exp $ */ #ifndef __DVBAPI_H @@ -40,6 +40,8 @@ typedef struct CRect { signed short x, y, width, height; }; +#define FRAMESPERSEC 25 + const char *IndexToHMSF(int Index, bool WithFrame = false); // Converts the given index to a string, optionally containing the frame number. int HMSFToIndex(const char *HMSF); diff --git a/i18n.c b/i18n.c index 2fd9c344..3d75c245 100644 --- a/i18n.c +++ b/i18n.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: i18n.c 1.30 2001/08/11 08:43:51 kls Exp $ + * $Id: i18n.c 1.31 2001/08/11 13:22:24 kls Exp $ * * Slovenian translations provided by Miha Setina * Italian translations provided by Alberto Carraro @@ -1113,6 +1113,14 @@ const tPhrase Phrases[] = { "bas", "", // TODO }, + { "Jump: ", // note the trailing blank + "Springen: ", + "", // TODO + "", // TODO + "", // TODO + "", // TODO + "", // TODO + }, { " Stop replaying", // note the leading blank! " Wiedergabe beenden", " Prekini ponavljanje", diff --git a/menu.c b/menu.c index 5384d65c..c131f195 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.99 2001/08/11 08:43:31 kls Exp $ + * $Id: menu.c 1.100 2001/08/11 14:30:21 kls Exp $ */ #include "menu.h" @@ -2256,6 +2256,7 @@ cReplayControl::cReplayControl(void) visible = shown = displayFrames = false; lastCurrent = lastTotal = -1; timeoutShow = 0; + timeSearchActive = false; if (fileName) { marks.Load(fileName); dvbApi->StartReplay(fileName); @@ -2360,6 +2361,98 @@ bool cReplayControl::ShowProgress(bool Initial) return false; } +void cReplayControl::TimeSearchDisplay(void) +{ + char buf[64]; + int len; + + strcpy(buf, tr("Jump: ")); + len = strlen(buf); + + switch (timeSearchPos) { + case 1: sprintf(buf + len, "%01d-:--", timeSearchHH / 10); break; + case 2: sprintf(buf + len, "%02d:--", timeSearchHH); break; + case 3: sprintf(buf + len, "%02d:%01d-", timeSearchHH, timeSearchMM / 10); break; + case 4: sprintf(buf + len, "%02d:%02d", timeSearchHH, timeSearchMM); break; + default: sprintf(buf + len, "--:--"); break; + } + + Interface->Write(12, 2, buf); +} + +void cReplayControl::TimeSearchProcess(eKeys Key) +{ + int Seconds = timeSearchHH * 3600 + timeSearchMM * 60; + switch (Key) { + case k0 ... k9: + { + int n = Key - k0; + int s = (lastTotal / FRAMESPERSEC); + int m = s / 60 % 60; + int h = s / 3600; + switch (timeSearchPos) { + case 0: if (n * 10 <= h) { + timeSearchHH = n * 10; + timeSearchPos++; + } + break; + case 1: if (timeSearchHH + n <= h) { + timeSearchHH += n; + timeSearchPos++; + } + break; + case 2: if (n <= 5 && timeSearchHH * 60 + n * 10 <= h * 60 + m) { + timeSearchMM += n * 10; + timeSearchPos++; + } + break; + case 3: if (timeSearchHH * 60 + timeSearchMM + n <= h * 60 + m) { + timeSearchMM += n; + timeSearchPos++; + } + break; + } + TimeSearchDisplay(); + } + break; + case kLeft: + case kRight: + dvbApi->SkipSeconds(Seconds * (Key == kRight ? 1 : -1)); + timeSearchActive = false; + break; + case kUp: + case kDown: + dvbApi->Goto(Seconds * FRAMESPERSEC, Key == kDown); + timeSearchActive = false; + break; + default: + timeSearchActive = false; + break; + } + + if (!timeSearchActive) { + if (timeSearchHide) + Hide(); + else + Interface->Fill(12, 2, Width() - 22, 1, clrBackground); + } +} + +void cReplayControl::TimeSearch(void) +{ + timeSearchHH = timeSearchMM = timeSearchPos = 0; + timeSearchHide = false; + if (!visible) { + Show(); + if (visible) + timeSearchHide = true; + else + return; + } + TimeSearchDisplay(); + timeSearchActive = true; +} + void cReplayControl::MarkToggle(void) { int Current, Total; @@ -2456,6 +2549,10 @@ eOSState cReplayControl::ProcessKey(eKeys Key) } bool DisplayedFrames = displayFrames; displayFrames = false; + if (timeSearchActive && Key != kNone) { + TimeSearchProcess(Key); + return osContinue; + } switch (Key) { // Positioning: case kUp: dvbApi->Play(); break; @@ -2464,6 +2561,7 @@ eOSState cReplayControl::ProcessKey(eKeys Key) case kLeft: dvbApi->Backward(); break; case kRight|k_Release: case kRight: dvbApi->Forward(); break; + case kRed: TimeSearch(); break; case kGreen|k_Repeat: case kGreen: dvbApi->SkipSeconds(-60); break; case kYellow|k_Repeat: diff --git a/menu.h b/menu.h index c47e5cbd..f75ca867 100644 --- a/menu.h +++ b/menu.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.h 1.22 2001/08/05 16:04:58 kls Exp $ + * $Id: menu.h 1.23 2001/08/11 14:08:50 kls Exp $ */ #ifndef _MENU_H @@ -102,6 +102,11 @@ private: bool visible, shown, displayFrames; int lastCurrent, lastTotal; time_t timeoutShow; + bool timeSearchActive, timeSearchHide; + int timeSearchHH, timeSearchMM, timeSearchPos; + void TimeSearchDisplay(void); + void TimeSearchProcess(eKeys Key); + void TimeSearch(void); void Show(int Seconds = 0); void Hide(void); static char *fileName;