summaryrefslogtreecommitdiff
path: root/recorder.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2011-06-12 14:06:11 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2011-06-12 14:06:11 +0200
commit72d342ce02cbeddfccf1c56fc0e614dfbe569608 (patch)
tree9628c3da04a588c79ba6d299f12622989b59af7b /recorder.c
parent098d21117e9fc8d8703c2f3c11e0cfb9d74d0389 (diff)
downloadvdr-72d342ce02cbeddfccf1c56fc0e614dfbe569608.tar.gz
vdr-72d342ce02cbeddfccf1c56fc0e614dfbe569608.tar.bz2
Fixed detecting frames in case the Picture Start Code or Access Unit Delimiter extends over TS packet boundaries (cont'd)
Diffstat (limited to 'recorder.c')
-rw-r--r--recorder.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/recorder.c b/recorder.c
index f7c3fb03..ee7a1e9b 100644
--- a/recorder.c
+++ b/recorder.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: recorder.c 2.9 2010/12/27 11:35:46 kls Exp $
+ * $Id: recorder.c 2.10 2011/06/12 13:35:20 kls Exp $
*/
#include "recorder.h"
@@ -31,7 +31,7 @@ cRecorder::cRecorder(const char *FileName, const cChannel *Channel, int Priority
SpinUpDisk(FileName);
- ringBuffer = new cRingBufferLinear(RECORDERBUFSIZE, MIN_TS_PACKETS_FOR_FRAME_DETECTOR * TS_SIZE, true, "Recorder");
+ ringBuffer = new cRingBufferLinear(RECORDERBUFSIZE, TS_SIZE, true, "Recorder");
ringBuffer->SetTimeouts(0, 100);
int Pid = Channel->Vpid();
@@ -119,6 +119,8 @@ void cRecorder::Action(void)
time_t t = time(NULL);
bool InfoWritten = false;
bool FirstIframeSeen = false;
+ int FileNumber = 0;
+ off_t FrameOffset = -1;
while (Running()) {
int r;
uchar *b = ringBuffer->Get(r);
@@ -139,12 +141,16 @@ void cRecorder::Action(void)
}
InfoWritten = true;
}
+ if (frameDetector->NewPayload()) {
+ FileNumber = fileName->Number();
+ FrameOffset = fileSize;
+ }
if (FirstIframeSeen || frameDetector->IndependentFrame()) {
FirstIframeSeen = true; // start recording with the first I-frame
if (!NextFile())
break;
if (index && frameDetector->NewFrame())
- index->Write(frameDetector->IndependentFrame(), fileName->Number(), fileSize);
+ index->Write(frameDetector->IndependentFrame(), FileNumber, FrameOffset);
if (frameDetector->IndependentFrame()) {
recordFile->Write(patPmtGenerator.GetPat(), TS_SIZE);
fileSize += TS_SIZE;