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

Fixed generating the index file of an existing recording

This commit is contained in:
Klaus Schmidinger 2015-01-17 13:47:33 +01:00
parent b06d9cce37
commit f42cbac237
2 changed files with 29 additions and 5 deletions

View File

@ -8384,3 +8384,11 @@ Video Disk Recorder Revision History
- Now returning from removing deleted recordings after at most 10 seconds, or if the - 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 user presses a remote control key, to keep the system from getting unresponsive
when removing a huge number of files (reported by Dieter Ferdinand). 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.

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: 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" #include "recording.h"
@ -2275,6 +2275,7 @@ void cIndexFileGenerator::Action(void)
off_t FileSize = 0; off_t FileSize = 0;
off_t FrameOffset = -1; off_t FrameOffset = -1;
Skins.QueueMessage(mtInfo, tr("Regenerating index file")); Skins.QueueMessage(mtInfo, tr("Regenerating index file"));
bool Stuffed = false;
while (Running()) { while (Running()) {
// Rewind input file: // Rewind input file:
if (Rewind) { if (Rewind) {
@ -2338,10 +2339,25 @@ void cIndexFileGenerator::Action(void)
else if (ReplayFile) { else if (ReplayFile) {
int Result = Buffer.Read(ReplayFile, BufferChunks); int Result = Buffer.Read(ReplayFile, BufferChunks);
if (Result == 0) { // EOF if (Result == 0) { // EOF
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(); ReplayFile = FileName.NextFile();
FileSize = 0; FileSize = 0;
FrameOffset = -1; FrameOffset = -1;
Buffer.Clear(); Buffer.Clear();
Stuffed = false;
}
} }
} }
// Recording has been processed: // Recording has been processed: