mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Improved reaction on user input in fast/slow forward/back modes
This commit is contained in:
parent
d409fea3ab
commit
26fa8beca6
1
HISTORY
1
HISTORY
@ -116,3 +116,4 @@ Video Disk Recorder Revision History
|
|||||||
but rather resumes normal replay mode after a "pause", "forward" or "backward"
|
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
|
operation. Use the "Skip -60s" function repeatedly to go back to the beginning
|
||||||
of the recording.
|
of the recording.
|
||||||
|
- Improved reaction on user input in fast/slow forward/back modes.
|
||||||
|
4
config.h
4
config.h
@ -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: config.h 1.12 2000/07/29 18:18:00 kls Exp $
|
* $Id: config.h 1.13 2000/08/02 16:38:40 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CONFIG_H
|
#ifndef __CONFIG_H
|
||||||
@ -17,7 +17,7 @@
|
|||||||
#include "dvbapi.h"
|
#include "dvbapi.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
#define VDRVERSION "0.6"
|
#define VDRVERSION "0.61"
|
||||||
|
|
||||||
#define MaxBuffer 10000
|
#define MaxBuffer 10000
|
||||||
|
|
||||||
|
62
dvbapi.c
62
dvbapi.c
@ -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.19 2000/07/30 16:14:22 kls Exp $
|
* $Id: dvbapi.c 1.20 2000/08/01 18:06:39 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dvbapi.h"
|
#include "dvbapi.h"
|
||||||
@ -347,7 +347,6 @@ protected:
|
|||||||
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);
|
|
||||||
public:
|
public:
|
||||||
cRingBuffer(int *InFile, int *OutFile, int Size, int FreeLimit = 0, int AvailLimit = 0);
|
cRingBuffer(int *InFile, int *OutFile, int Size, int FreeLimit = 0, int AvailLimit = 0);
|
||||||
virtual ~cRingBuffer();
|
virtual ~cRingBuffer();
|
||||||
@ -408,22 +407,6 @@ void cRingBuffer::Skip(int n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cRingBuffer::WaitForOutFile(int Timeout)
|
|
||||||
{
|
|
||||||
fd_set set;
|
|
||||||
FD_ZERO(&set);
|
|
||||||
FD_SET(*outFile, &set);
|
|
||||||
struct timeval timeout;
|
|
||||||
timeout.tv_sec = 0;
|
|
||||||
timeout.tv_usec = Timeout;
|
|
||||||
if (select(FD_SETSIZE, NULL, &set, NULL, &timeout) > 0) {
|
|
||||||
if (FD_ISSET(*outFile, &set))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
esyslog(LOG_ERR, "ERROR: timeout in WaitForOutFile(%d)", Timeout);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cRingBuffer::Read(int Max)
|
int cRingBuffer::Read(int Max)
|
||||||
{
|
{
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
@ -1001,7 +984,7 @@ int cReplayBuffer::Read(int Max = -1)
|
|||||||
int FileOffset, Length;
|
int FileOffset, Length;
|
||||||
if (mode == rmSlowRewind && (brakeCounter++ % 24) != 0) {
|
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
|
// 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, true, &FileNumber, &FileOffset, &Length); // jump ahead one frame
|
||||||
}
|
}
|
||||||
Index = index->GetNextIFrame(Index, mode == rmFastForward, &FileNumber, &FileOffset, &Length);
|
Index = index->GetNextIFrame(Index, mode == rmFastForward, &FileNumber, &FileOffset, &Length);
|
||||||
if (Index >= 0) {
|
if (Index >= 0) {
|
||||||
@ -1043,28 +1026,27 @@ int cReplayBuffer::Read(int Max = -1)
|
|||||||
int cReplayBuffer::Write(int Max)
|
int cReplayBuffer::Write(int Max)
|
||||||
{
|
{
|
||||||
int Written = 0;
|
int Written = 0;
|
||||||
|
int Av = Available();
|
||||||
do {
|
if (skipAudio) {
|
||||||
if (skipAudio) {
|
SkipAudioBlocks();
|
||||||
SkipAudioBlocks();
|
Max = GetAvPesLength();
|
||||||
Max = GetAvPesLength();
|
fileOffset += Av - Available();
|
||||||
}
|
}
|
||||||
while (Max) {
|
if (Max) {
|
||||||
int w = cFileBuffer::Write(Max);
|
int w;
|
||||||
if (w >= 0) {
|
do {
|
||||||
fileOffset += w;
|
w = cFileBuffer::Write(Max);
|
||||||
Written += w;
|
if (w >= 0) {
|
||||||
if (Max < 0)
|
fileOffset += w;
|
||||||
break;
|
Written += w;
|
||||||
Max -= w;
|
if (Max < 0)
|
||||||
}
|
break;
|
||||||
else
|
Max -= w;
|
||||||
return w;
|
|
||||||
//XXX??? Why does the buffer get empty here???
|
|
||||||
if (Empty() || !WaitForOutFile(1000000))
|
|
||||||
return Written;
|
|
||||||
}
|
}
|
||||||
} while (skipAudio && Available());
|
else
|
||||||
|
return w;
|
||||||
|
} while (Max > 0); // we MUST write this entire AV_PES block
|
||||||
|
}
|
||||||
return Written;
|
return Written;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user