From 26252c37cdff5f0fd5d5659823aaa59f2ab26bd9 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Thu, 22 Dec 2016 13:14:10 +0100 Subject: [PATCH] Fixed regenerating the index of audio recordings --- CONTRIBUTORS | 1 + HISTORY | 1 + recording.c | 10 +++++----- remux.c | 6 ++++-- remux.h | 5 ++++- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 833eecf0..0e6574b5 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3334,6 +3334,7 @@ Thomas Reufer for implementing a frame parser for H.265 (HEVC) recordings for adding cFont::Width(void) to get the default character width and allow stretched font drawing in high level OSDs + for fixing regenerating the index of audio recordings Eike Sauer for reporting a problem with channels that need more than 5 TS packets for detecting diff --git a/HISTORY b/HISTORY index db1b2170..5bf0d315 100644 --- a/HISTORY +++ b/HISTORY @@ -8864,3 +8864,4 @@ Video Disk Recorder Revision History - Implemented a frame parser for H.265 (HEVC) recordings (thanks to Thomas Reufer). - Added cFont::Width(void) to get the default character width and allow stretched font drawing in high level OSDs (thanks to Thomas Reufer). +- Fixed regenerating the index of audio recordings (thanks to Thomas Reufer). diff --git a/recording.c b/recording.c index 9ec3ea9d..5293459e 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 4.5 2016/12/13 13:39:09 kls Exp $ + * $Id: recording.c 4.6 2016/12/22 12:58:20 kls Exp $ */ #include "recording.h" @@ -2329,7 +2329,7 @@ void cIndexFileGenerator::Action(void) Buffer.Del(Processed); } } - else if (PatPmtParser.Vpid()) { + else if (PatPmtParser.Completed()) { // Step 2 - sync FrameDetector: int Processed = FrameDetector.Analyze(Data, Length); if (Processed > 0) { @@ -2351,9 +2351,9 @@ void cIndexFileGenerator::Action(void) PatPmtParser.ParsePmt(p, TS_SIZE); Length -= TS_SIZE; p += TS_SIZE; - if (PatPmtParser.Vpid()) { - // Found Vpid, so rewind to sync FrameDetector: - FrameDetector.SetPid(PatPmtParser.Vpid(), PatPmtParser.Vtype()); + if (PatPmtParser.Completed()) { + // Found pid, so rewind to sync FrameDetector: + FrameDetector.SetPid(PatPmtParser.Vpid() ? PatPmtParser.Vpid() : PatPmtParser.Apid(0), PatPmtParser.Vpid() ? PatPmtParser.Vtype() : PatPmtParser.Atype(0)); BufferChunks = IFG_BUFFER_SIZE; Rewind = true; break; diff --git a/remux.c b/remux.c index 139540ef..2e1bc31f 100644 --- a/remux.c +++ b/remux.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: remux.c 4.2 2016/12/22 11:45:52 kls Exp $ + * $Id: remux.c 4.3 2016/12/22 12:58:20 kls Exp $ */ #include "remux.h" @@ -603,6 +603,7 @@ cPatPmtParser::cPatPmtParser(bool UpdatePrimaryDevice) void cPatPmtParser::Reset(void) { + completed = false; pmtSize = 0; patVersion = pmtVersion = -1; pmtPids[0] = 0; @@ -893,6 +894,7 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length) } } pmtVersion = Pmt.getVersionNumber(); + completed = true; } else esyslog("ERROR: can't parse PMT"); @@ -1541,7 +1543,7 @@ void cFrameDetector::SetPid(int Pid, int Type) parser = new cH264Parser; else if (type == 0x24) parser = new cH265Parser; - else if (type == 0x04 || type == 0x06) // MPEG audio or AC3 audio + else if (type == 0x03 || type == 0x04 || type == 0x06) // MPEG audio or AC3 audio parser = new cAudioParser; else if (type != 0) esyslog("ERROR: unknown stream type %d (PID %d) in frame detector", type, pid); diff --git a/remux.h b/remux.h index 23ce681e..5eab076f 100644 --- a/remux.h +++ b/remux.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: remux.h 3.4 2014/03/26 11:42:17 kls Exp $ + * $Id: remux.h 4.1 2016/12/22 13:09:54 kls Exp $ */ #ifndef __REMUX_H @@ -361,6 +361,7 @@ private: uint16_t compositionPageIds[MAXSPIDS]; uint16_t ancillaryPageIds[MAXSPIDS]; bool updatePrimaryDevice; + bool completed; protected: int SectionLength(const uchar *Data, int Length) { return (Length >= 3) ? ((int(Data[1]) & 0x0F) << 8)| Data[2] : 0; } public: @@ -397,6 +398,8 @@ public: int Vtype(void) const { return vtype; } ///< Returns the video stream type as defined by the current PMT, or 0 if no video ///< stream type has been detected, yet. + bool Completed(void) { return completed; } + ///< Returns true if the PMT has been completely parsed. const int *Apids(void) const { return apids; } const int *Dpids(void) const { return dpids; } const int *Spids(void) const { return spids; }