summaryrefslogtreecommitdiff
path: root/recording.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 /recording.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 'recording.c')
-rw-r--r--recording.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/recording.c b/recording.c
index d4cf9c34..a8b40f2d 100644
--- a/recording.c
+++ b/recording.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: recording.c 2.30 2011/04/17 13:53:11 kls Exp $
+ * $Id: recording.c 2.31 2011/06/12 13:04:28 kls Exp $
*/
#include "recording.h"
@@ -1403,11 +1403,12 @@ void cIndexFileGenerator::Action(void)
bool Rewind = false;
cFileName FileName(recordingName, false);
cUnbufferedFile *ReplayFile = FileName.Open();
- cRingBufferLinear Buffer(IFG_BUFFER_SIZE, MIN_TS_PACKETS_FOR_FRAME_DETECTOR * TS_SIZE);
+ cRingBufferLinear Buffer(IFG_BUFFER_SIZE, TS_SIZE);
cPatPmtParser PatPmtParser;
cFrameDetector FrameDetector;
cIndexFile IndexFile(recordingName, true);
int BufferChunks = KILOBYTE(1); // no need to read a lot at the beginning when parsing PAT/PMT
+ int FileNumber = 0;
off_t FileSize = 0;
off_t FrameOffset = -1;
Skins.QueueMessage(mtInfo, tr("Regenerating index file"));
@@ -1424,12 +1425,18 @@ void cIndexFileGenerator::Action(void)
if (Data) {
if (FrameDetector.Synced()) {
// Step 3 - generate the index:
- if (TsPid(Data) == PATPID)
+ if (FrameOffset < 0 && TsPid(Data) == PATPID) {
+ FileNumber = FileName.Number();
FrameOffset = FileSize; // the PAT/PMT is at the beginning of an I-frame
+ }
int Processed = FrameDetector.Analyze(Data, Length);
if (Processed > 0) {
+ if (FrameDetector.NewPayload() && FrameOffset < 0) {
+ FileNumber = FileName.Number();
+ FrameOffset = FileSize;
+ }
if (FrameDetector.NewFrame()) {
- IndexFile.Write(FrameDetector.IndependentFrame(), FileName.Number(), FrameOffset >= 0 ? FrameOffset : FileSize);
+ IndexFile.Write(FrameDetector.IndependentFrame(), FileNumber, FrameOffset);
FrameOffset = -1;
}
FileSize += Processed;