Fixed error checking when regenerating the index

This commit is contained in:
Klaus Schmidinger 2024-09-21 19:18:18 +02:00
parent 4805af7915
commit c590444b7d
3 changed files with 12 additions and 8 deletions

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 5.34 2024/09/19 20:21:58 kls Exp $ * $Id: recording.c 5.35 2024/09/21 19:18:18 kls Exp $
*/ */
#include "recording.h" #include "recording.h"
@ -2616,7 +2616,7 @@ void cIndexFileGenerator::Action(void)
} }
else if (PatPmtParser.Completed()) { else if (PatPmtParser.Completed()) {
// Step 2 - sync FrameDetector: // Step 2 - sync FrameDetector:
int Processed = FrameDetector.Analyze(Data, Length); int Processed = FrameDetector.Analyze(Data, Length, false);
if (Processed > 0) { if (Processed > 0) {
if (FrameDetector.Synced()) { if (FrameDetector.Synced()) {
// Synced FrameDetector, so rewind for actual processing: // Synced FrameDetector, so rewind for actual processing:

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: remux.c 5.12 2024/09/20 14:21:39 kls Exp $ * $Id: remux.c 5.13 2024/09/21 19:18:18 kls Exp $
*/ */
#include "remux.h" #include "remux.h"
@ -2164,7 +2164,7 @@ bool cFrameDetector::NewFrame(int *PreviousErrors, int * MissingFrames)
return newFrame; return newFrame;
} }
int cFrameDetector::Analyze(const uchar *Data, int Length) int cFrameDetector::Analyze(const uchar *Data, int Length, bool ErrorCheck)
{ {
if (!parser) if (!parser)
return 0; return 0;
@ -2196,7 +2196,8 @@ int cFrameDetector::Analyze(const uchar *Data, int Length)
independentFrame = parser->IndependentFrame(); independentFrame = parser->IndependentFrame();
firstIframeSeen |= independentFrame; firstIframeSeen |= independentFrame;
if (synced) { if (synced) {
frameChecker->CheckFrame(Data, n, independentFrame); if (ErrorCheck)
frameChecker->CheckFrame(Data, n, independentFrame);
if (framesPerPayloadUnit <= 1) if (framesPerPayloadUnit <= 1)
scanning = false; scanning = false;
} }
@ -2281,7 +2282,7 @@ int cFrameDetector::Analyze(const uchar *Data, int Length)
else if (Pid == PATPID && synced && Processed) else if (Pid == PATPID && synced && Processed)
return Processed; // allow the caller to see any PAT packets return Processed; // allow the caller to see any PAT packets
} }
if (firstIframeSeen) if (firstIframeSeen && ErrorCheck)
frameChecker->CheckTs(Data, Handled); frameChecker->CheckTs(Data, Handled);
Data += Handled; Data += Handled;
Length -= Handled; Length -= Handled;

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: remux.h 5.6 2024/09/18 09:23:07 kls Exp $ * $Id: remux.h 5.7 2024/09/21 19:18:18 kls Exp $
*/ */
#ifndef __REMUX_H #ifndef __REMUX_H
@ -559,12 +559,15 @@ public:
///< Sets the Pid and stream Type to detect frames for. ///< Sets the Pid and stream Type to detect frames for.
void SetMissing(void); void SetMissing(void);
///< Call if this is a resumed recording, which has missing frames. ///< Call if this is a resumed recording, which has missing frames.
int Analyze(const uchar *Data, int Length); int Analyze(const uchar *Data, int Length, bool ErrorCheck = true);
///< Analyzes the TS packets pointed to by Data. Length is the number of ///< Analyzes the TS packets pointed to by Data. Length is the number of
///< bytes Data points to, and must be a multiple of TS_SIZE. ///< bytes Data points to, and must be a multiple of TS_SIZE.
///< Returns the number of bytes that have been analyzed. ///< Returns the number of bytes that have been analyzed.
///< If the return value is 0, the data was not sufficient for analyzing and ///< If the return value is 0, the data was not sufficient for analyzing and
///< Analyze() needs to be called again with more actual data. ///< Analyze() needs to be called again with more actual data.
///< Error checks can be turned off by setting ErrorCheck to false. This is
///< used when regenerating the index file, where the first chunk of data
///< is scanned for the PAT/PMT and then a rewind is done on the file.
bool Synced(void) { return synced; } bool Synced(void) { return synced; }
///< Returns true if the frame detector has synced on the data stream. ///< Returns true if the frame detector has synced on the data stream.
bool NewFrame(int *PreviousErrors = NULL, int * MissingFrames = NULL); bool NewFrame(int *PreviousErrors = NULL, int * MissingFrames = NULL);