From 8f9136ecab28d915d3e57f35badf4b74bb2bfce8 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 19 Nov 2012 10:32:31 +0100 Subject: [PATCH] In order to be able to play TS recordings from other sources, in which there is more than one PMT PID in the PAT, 'int cPatPmtParser::PatPmt(void)' has been changed to 'bool cPatPmtParser::IsPatPmt(int Pid)' --- HISTORY | 6 ++++++ config.h | 10 +++++----- cutter.c | 6 +++--- device.c | 6 +++--- recording.c | 6 +++--- remux.c | 11 +++++++---- remux.h | 12 +++++++----- 7 files changed, 34 insertions(+), 23 deletions(-) diff --git a/HISTORY b/HISTORY index ff1681b6..064e8211 100644 --- a/HISTORY +++ b/HISTORY @@ -7338,3 +7338,9 @@ Video Disk Recorder Revision History marks at the same place as if it were one single mark. - Modified editing marks are now written to disk whenever the replay progress display gets hidden (thanks to Christoph Haubrich). + +2012-11-19: Version 1.7.33 + +- In order to be able to play TS recordings from other sources, in which there is + more than one PMT PID in the PAT, 'int cPatPmtParser::PatPmt(void)' has been changed + to 'bool cPatPmtParser::IsPatPmt(int Pid)'. diff --git a/config.h b/config.h index 03b6cf0d..9567ceae 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 2.54 2012/10/03 09:59:34 kls Exp $ + * $Id: config.h 2.55 2012/11/19 10:24:24 kls Exp $ */ #ifndef __CONFIG_H @@ -22,13 +22,13 @@ // VDR's own version number: -#define VDRVERSION "1.7.32" -#define VDRVERSNUM 10732 // Version * 10000 + Major * 100 + Minor +#define VDRVERSION "1.7.33" +#define VDRVERSNUM 10733 // Version * 10000 + Major * 100 + Minor // The plugin API's version number: -#define APIVERSION "1.7.32" -#define APIVERSNUM 10732 // Version * 10000 + Major * 100 + Minor +#define APIVERSION "1.7.33" +#define APIVERSNUM 10733 // Version * 10000 + Major * 100 + Minor // When loading plugins, VDR searches them by their APIVERSION, which // may be smaller than VDRVERSION in case there have been no changes to diff --git a/cutter.c b/cutter.c index ace1893b..42b966aa 100644 --- a/cutter.c +++ b/cutter.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: cutter.c 2.16 2012/11/18 12:09:00 kls Exp $ + * $Id: cutter.c 2.17 2012/11/19 10:21:44 kls Exp $ */ #include "cutter.h" @@ -132,7 +132,7 @@ bool cDanglingPacketStripper::Process(uchar *Data, int Length, int64_t FirstPts) int Pid = TsPid(Data); if (Pid == PATPID) patPmtParser.ParsePat(Data, TS_SIZE); - else if (Pid == patPmtParser.PmtPid()) + else if (patPmtParser.IsPmtPid(Pid)) patPmtParser.ParsePmt(Data, TS_SIZE); else { int64_t Pts = TsGetPts(Data, TS_SIZE); @@ -408,7 +408,7 @@ void cCuttingThread::GetPendingPackets(uchar *Data, int &Length, int Index, int6 int Pid = TsPid(p); if (Pid == PATPID) PatPmtParser.ParsePat(p, TS_SIZE); - else if (Pid == PatPmtParser.PmtPid()) + else if (PatPmtParser.IsPmtPid(Pid)) PatPmtParser.ParsePmt(p, TS_SIZE); else if (!Processed[Pid]) { int64_t Pts = TsGetPts(p, TS_SIZE); diff --git a/device.c b/device.c index 766253a1..2678d688 100644 --- a/device.c +++ b/device.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 2.69 2012/11/13 09:11:43 kls Exp $ + * $Id: device.c 2.70 2012/11/19 09:59:09 kls Exp $ */ #include "device.h" @@ -1149,7 +1149,7 @@ void cDevice::StillPicture(const uchar *Data, int Length) int Pid = TsPid(Data); if (Pid == PATPID) patPmtParser.ParsePat(Data, TS_SIZE); - else if (Pid == patPmtParser.PmtPid()) + else if (patPmtParser.IsPmtPid(Pid)) patPmtParser.ParsePmt(Data, TS_SIZE); else if (Pid == patPmtParser.Vpid()) { if (TsPayloadStart(Data)) { @@ -1486,7 +1486,7 @@ int cDevice::PlayTs(const uchar *Data, int Length, bool VideoOnly) if (PayloadOffset < TS_SIZE) { if (Pid == PATPID) patPmtParser.ParsePat(Data, TS_SIZE); - else if (Pid == patPmtParser.PmtPid()) + else if (patPmtParser.IsPmtPid(Pid)) patPmtParser.ParsePmt(Data, TS_SIZE); else if (Pid == patPmtParser.Vpid()) { isPlayingVideo = true; diff --git a/recording.c b/recording.c index 497bf2dd..8e677c89 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.73 2012/11/13 13:46:49 kls Exp $ + * $Id: recording.c 2.74 2012/11/19 10:01:01 kls Exp $ */ #include "recording.h" @@ -1606,7 +1606,7 @@ void cIndexFileGenerator::Action(void) int Pid = TsPid(p); if (Pid == PATPID) PatPmtParser.ParsePat(p, TS_SIZE); - else if (Pid == PatPmtParser.PmtPid()) + else if (PatPmtParser.IsPmtPid(Pid)) PatPmtParser.ParsePmt(p, TS_SIZE); Length -= TS_SIZE; p += TS_SIZE; @@ -2132,7 +2132,7 @@ bool cFileName::GetLastPatPmtVersions(int &PatVersion, int &PmtVersion) int Pid = TsPid(buf); if (Pid == PATPID) PatPmtParser.ParsePat(buf, sizeof(buf)); - else if (Pid == PatPmtParser.PmtPid()) { + else if (PatPmtParser.IsPmtPid(Pid)) { PatPmtParser.ParsePmt(buf, sizeof(buf)); if (PatPmtParser.GetVersions(PatVersion, PmtVersion)) { close(fd); diff --git a/remux.c b/remux.c index e3b34c66..02fd1c12 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 2.71 2012/11/18 12:18:08 kls Exp $ + * $Id: remux.c 2.72 2012/11/19 10:23:42 kls Exp $ */ #include "remux.h" @@ -574,7 +574,7 @@ void cPatPmtParser::Reset(void) { pmtSize = 0; patVersion = pmtVersion = -1; - pmtPid = -1; + pmtPids[0] = 0; vpid = vtype = 0; ppid = 0; } @@ -594,14 +594,17 @@ void cPatPmtParser::ParsePat(const uchar *Data, int Length) dbgpatpmt("PAT: TSid = %d, c/n = %d, v = %d, s = %d, ls = %d\n", Pat.getTransportStreamId(), Pat.getCurrentNextIndicator(), Pat.getVersionNumber(), Pat.getSectionNumber(), Pat.getLastSectionNumber()); if (patVersion == Pat.getVersionNumber()) return; + int NumPmtPids = 0; SI::PAT::Association assoc; for (SI::Loop::Iterator it; Pat.associationLoop.getNext(assoc, it); ) { dbgpatpmt(" isNITPid = %d\n", assoc.isNITPid()); if (!assoc.isNITPid()) { - pmtPid = assoc.getPid(); + if (NumPmtPids <= MAX_PMT_PIDS) + pmtPids[NumPmtPids++] = assoc.getPid(); dbgpatpmt(" service id = %d, pid = %d\n", assoc.getServiceId(), assoc.getPid()); } } + pmtPids[NumPmtPids] = 0; patVersion = Pat.getVersionNumber(); } else @@ -839,7 +842,7 @@ bool cPatPmtParser::ParsePatPmt(const uchar *Data, int Length) int Pid = TsPid(Data); if (Pid == PATPID) ParsePat(Data, TS_SIZE); - else if (Pid == PmtPid()) { + else if (IsPmtPid(Pid)) { ParsePmt(Data, TS_SIZE); if (patVersion >= 0 && pmtVersion >= 0) return true; diff --git a/remux.h b/remux.h index dd17e0d9..19f94797 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 2.35 2012/11/18 12:17:23 kls Exp $ + * $Id: remux.h 2.36 2012/11/19 10:22:28 kls Exp $ */ #ifndef __REMUX_H @@ -327,13 +327,15 @@ public: // PAT/PMT Parser: +#define MAX_PMT_PIDS 32 + class cPatPmtParser { private: uchar pmt[MAX_SECTION_SIZE]; int pmtSize; int patVersion; int pmtVersion; - int pmtPid; + int pmtPids[MAX_PMT_PIDS + 1]; // list is zero-terminated int vpid; int ppid; int vtype; @@ -373,9 +375,9 @@ public: bool GetVersions(int &PatVersion, int &PmtVersion) const; ///< Returns true if a valid PAT/PMT has been parsed and stores ///< the current version numbers in the given variables. - int PmtPid(void) const { return pmtPid; } - ///< Returns the PMT pid as defined by the current PAT. - ///< If no PAT has been received yet, -1 will be returned. + bool IsPmtPid(int Pid) const { for (int i = 0; pmtPids[i]; i++) if (pmtPids[i] == Pid) return true; return false; } + ///< Returns true if Pid the one of the PMT pids as defined by the current PAT. + ///< If no PAT has been received yet, false will be returned. int Vpid(void) const { return vpid; } ///< Returns the video pid as defined by the current PMT, or 0 if no video ///< pid has been detected, yet.