diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2015-01-17 13:47:33 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2015-01-17 13:47:33 +0100 |
commit | f42cbac2375bfa320f9acdf87f80bc2fd70fed36 (patch) | |
tree | 4ceb26e69f8ac4cf28074455b27a7d0e7558cb98 | |
parent | b06d9cce375f9edd7a132482f0ddd2f5bd6b3f3a (diff) | |
download | vdr-f42cbac2375bfa320f9acdf87f80bc2fd70fed36.tar.gz vdr-f42cbac2375bfa320f9acdf87f80bc2fd70fed36.tar.bz2 |
Fixed generating the index file of an existing recording
-rw-r--r-- | HISTORY | 8 | ||||
-rw-r--r-- | recording.c | 26 |
2 files changed, 29 insertions, 5 deletions
@@ -8384,3 +8384,11 @@ Video Disk Recorder Revision History - Now returning from removing deleted recordings after at most 10 seconds, or if the user presses a remote control key, to keep the system from getting unresponsive when removing a huge number of files (reported by Dieter Ferdinand). +- Fixed generating the index file of an existing recording in case at the of a TS file + there is less data in the buffer than needed by the frame detector. In such a case + it was possible that frames were missed, and there was most likely a distortion + when replaying that part of a recording. This is mostly a problem for recordings that + consist of more than one *.ts file. Single file recordings could only lose some + frames at their very end, which probably doesn't matter. At any rate, if you have + generated an index file with VDR version 2.0.6, 2.1.5 or 2.1.6, you may want to + do so again with this version to make sure the index is OK. diff --git a/recording.c b/recording.c index 3806165e..669e8ffa 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 3.19 2015/01/17 10:49:03 kls Exp $ + * $Id: recording.c 3.20 2015/01/17 13:47:33 kls Exp $ */ #include "recording.h" @@ -2275,6 +2275,7 @@ void cIndexFileGenerator::Action(void) off_t FileSize = 0; off_t FrameOffset = -1; Skins.QueueMessage(mtInfo, tr("Regenerating index file")); + bool Stuffed = false; while (Running()) { // Rewind input file: if (Rewind) { @@ -2338,10 +2339,25 @@ void cIndexFileGenerator::Action(void) else if (ReplayFile) { int Result = Buffer.Read(ReplayFile, BufferChunks); if (Result == 0) { // EOF - ReplayFile = FileName.NextFile(); - FileSize = 0; - FrameOffset = -1; - Buffer.Clear(); + if (Buffer.Available() > 0 && !Stuffed) { + // So the last call to Buffer.Get() returned NULL, but there is still + // data in the buffer, and we're at the end of the current TS file. + // The remaining data in the buffer is less than what's needed for the + // frame detector to analyze frames, so we need to put some stuffing + // packets into the buffer to flush out the rest of the data (otherwise + // any frames within the remaining data would not be seen here): + uchar StuffingPacket[TS_SIZE] = { TS_SYNC_BYTE, 0xFF }; + for (int i = 0; i <= MIN_TS_PACKETS_FOR_FRAME_DETECTOR; i++) + Buffer.Put(StuffingPacket, sizeof(StuffingPacket)); + Stuffed = true; + } + else { + ReplayFile = FileName.NextFile(); + FileSize = 0; + FrameOffset = -1; + Buffer.Clear(); + Stuffed = false; + } } } // Recording has been processed: |