1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Slow forward/back mode

This commit is contained in:
Klaus Schmidinger 2000-07-30 14:34:07 +02:00
parent 5591027638
commit f8b7403366
4 changed files with 42 additions and 14 deletions

View File

@ -13,3 +13,6 @@ Plamen Ganev <pganev@com-it.net>
Heino Goldenstein <heino.goldenstein@microplex.de> Heino Goldenstein <heino.goldenstein@microplex.de>
for modifying scrolling through lists to make it page up and down for modifying scrolling through lists to make it page up and down
Guido Fiala <gfiala@s.netic.de>
for implementing slow forward/back

View File

@ -100,7 +100,7 @@ Video Disk Recorder Revision History
the 'timers.conf' file with a text editor, or by defining/modifying the timer the 'timers.conf' file with a text editor, or by defining/modifying the timer
via the SVDRP interface. via the SVDRP interface.
2000-07-29: 2000-07-30:
- When scrolling through a list it now moves a full page up or down when the - When scrolling through a list it now moves a full page up or down when the
cursor reaches the top or bottom of the menu (thanks to Heino Goldenstein!). cursor reaches the top or bottom of the menu (thanks to Heino Goldenstein!).
@ -111,3 +111,4 @@ Video Disk Recorder Revision History
- Fixed learning key codes for PC keyboard. - Fixed learning key codes for PC keyboard.
- New command line option '-l' to set the log level. - New command line option '-l' to set the log level.
- Times in timers.conf are now always printed with 4 digits (leading '0'). - Times in timers.conf are now always printed with 4 digits (leading '0').
- Slow forward/back mode (thanks to Guido Fiala!).

5
MANUAL
View File

@ -100,8 +100,9 @@ Video Disk Recorder User's Manual
- Blue Stops playback and stores the current position, so that - Blue Stops playback and stores the current position, so that
playback can be resumed later at that point. playback can be resumed later at that point.
- Left - Left
Right Runs playback forward or backward at a higher speed. Press Right Runs playback forward or backward at a higher speed; press
again to resume normal speed. again to resume normal speed. If in Pause mode, runs forward or
backward at a slower speed; press again to return to pause mode.
- Green - Green
Yellow Skips about 60 seconds back or forward. Yellow Skips about 60 seconds back or forward.
- Ok Brings up the replay progress display, which shows the date, - Ok Brings up the replay progress display, which shows the date,

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: dvbapi.c 1.17 2000/07/29 19:00:19 kls Exp $ * $Id: dvbapi.c 1.18 2000/07/30 14:34:07 kls Exp $
*/ */
#include "dvbapi.h" #include "dvbapi.h"
@ -345,7 +345,7 @@ protected:
int Free(void) { return ((tail >= head) ? size + head - tail : head - tail) - 1; } int Free(void) { return ((tail >= head) ? size + head - tail : head - tail) - 1; }
int Available(void) { return (tail >= head) ? tail - head : size - head + tail; } int Available(void) { return (tail >= head) ? tail - head : size - head + tail; }
int Readable(void) { return (tail >= head) ? size - tail - (head ? 0 : 1) : head - tail - 1; } // keep a 1 byte gap! int Readable(void) { return (tail >= head) ? size - tail - (head ? 0 : 1) : head - tail - 1; } // keep a 1 byte gap!
int Writeable(void) { return (tail > head) ? tail - head : size - head; } int Writeable(void) { return (tail >= head) ? tail - head : size - head; }
int Byte(int Offset); int Byte(int Offset);
bool WaitForOutFile(int Timeout); bool WaitForOutFile(int Timeout);
public: public:
@ -803,7 +803,7 @@ int cRecordBuffer::WriteWithTimeout(bool EndIfEmpty)
// --- cReplayBuffer --------------------------------------------------------- // --- cReplayBuffer ---------------------------------------------------------
enum eReplayMode { rmPlay, rmFastForward, rmFastRewind }; enum eReplayMode { rmPlay, rmFastForward, rmFastRewind, rmSlowRewind };
class cReplayBuffer : public cFileBuffer { class cReplayBuffer : public cFileBuffer {
private: private:
@ -812,6 +812,7 @@ private:
eReplayMode mode; eReplayMode mode;
bool skipAudio; bool skipAudio;
int lastIndex; int lastIndex;
int brakeCounter;
void SkipAudioBlocks(void); void SkipAudioBlocks(void);
bool NextFile(uchar FileNumber = 0, int FileOffset = -1); bool NextFile(uchar FileNumber = 0, int FileOffset = -1);
void Close(void); void Close(void);
@ -833,6 +834,7 @@ cReplayBuffer::cReplayBuffer(int *OutFile, const char *FileName)
fileOffset = 0; fileOffset = 0;
replayFile = -1; replayFile = -1;
mode = rmPlay; mode = rmPlay;
brakeCounter = 0;
skipAudio = false; skipAudio = false;
lastIndex = -1; lastIndex = -1;
if (!fileName) if (!fileName)
@ -863,6 +865,7 @@ void cReplayBuffer::SetMode(eReplayMode Mode)
{ {
mode = Mode; mode = Mode;
skipAudio = Mode != rmPlay; skipAudio = Mode != rmPlay;
brakeCounter = 0;
if (mode != rmPlay) if (mode != rmPlay)
Clear(); Clear();
} }
@ -996,6 +999,10 @@ int cReplayBuffer::Read(int Max = -1)
if (Index >= 0) { if (Index >= 0) {
uchar FileNumber; uchar FileNumber;
int FileOffset, Length; int FileOffset, Length;
if (mode == rmSlowRewind && (brakeCounter++ % 24) != 0) {
// show every I_FRAME 24 times in rmSlowRewind mode to achieve roughly the same speed as in slow forward mode
Index = index->GetNextIFrame(Index, true, &FileNumber, &FileOffset, &Length); //springe eine Frame vorwärts!
}
Index = index->GetNextIFrame(Index, mode == rmFastForward, &FileNumber, &FileOffset, &Length); Index = index->GetNextIFrame(Index, mode == rmFastForward, &FileNumber, &FileOffset, &Length);
if (Index >= 0) { if (Index >= 0) {
if (!NextFile(FileNumber, FileOffset)) if (!NextFile(FileNumber, FileOffset))
@ -1601,18 +1608,34 @@ bool cDvbApi::StartReplay(const char *FileName, const char *Title)
Buffer->SetMode(rmPlay); Buffer->SetMode(rmPlay);
break; break;
case dvbFastForward: SetReplayMode(VID_PLAY_CLEAR_BUFFER); case dvbFastForward: SetReplayMode(VID_PLAY_CLEAR_BUFFER);
SetReplayMode(VID_PLAY_NORMAL);
FastForward = !FastForward;
FastRewind = Paused = false;
Buffer->Clear(); Buffer->Clear();
Buffer->SetMode(FastForward ? rmFastForward : rmPlay); 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; break;
case dvbFastRewind: SetReplayMode(VID_PLAY_CLEAR_BUFFER); case dvbFastRewind: SetReplayMode(VID_PLAY_CLEAR_BUFFER);
SetReplayMode(VID_PLAY_NORMAL);
FastRewind = !FastRewind;
FastForward = Paused = false;
Buffer->Clear(); Buffer->Clear();
Buffer->SetMode(FastRewind ? rmFastRewind : rmPlay); 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; break;
case dvbSkip: { case dvbSkip: {
int Seconds; int Seconds;