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

The PAT/PMT is now only processed if its version changes

This commit is contained in:
Klaus Schmidinger 2009-01-24 13:47:46 +01:00
parent f311ce508a
commit 85e34776ff
5 changed files with 25 additions and 3 deletions

View File

@ -1195,6 +1195,8 @@ Reinhard Nissl <rnissl@gmx.de>
for reporting a possible problem with removing deleted recordings for reporting a possible problem with removing deleted recordings
for pointing out that a check of mutexCurrentAudioTrack needs to be done in for pointing out that a check of mutexCurrentAudioTrack needs to be done in
to cDevice::PlayTs() to cDevice::PlayTs()
for reporting that the PAT/PMT is processed too often, even if its version
hasn't changed
Richard Robson <richard_robson@beeb.net> Richard Robson <richard_robson@beeb.net>
for reporting freezing replay if a timer starts while in Transfer Mode from the for reporting freezing replay if a timer starts while in Transfer Mode from the

View File

@ -5963,3 +5963,5 @@ Video Disk Recorder Revision History
the edited PES recording is set to 1 for I-frames and 2 for all others (P- and the edited PES recording is set to 1 for I-frames and 2 for all others (P- and
B-frames). The exact frame type doesn't matter for VDR, it only needs to know if B-frames). The exact frame type doesn't matter for VDR, it only needs to know if
it's an I-frame or not. it's an I-frame or not.
- The PAT/PMT is now only processed if its version changes (reported by Reinhard
Nissl).

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: device.c 2.9 2009/01/24 11:16:31 kls Exp $ * $Id: device.c 2.10 2009/01/24 13:40:54 kls Exp $
*/ */
#include "device.h" #include "device.h"
@ -1340,6 +1340,7 @@ int cDevice::PlayTs(const uchar *Data, int Length, bool VideoOnly)
} }
} }
else if (Data == NULL) { else if (Data == NULL) {
patPmtParser.Reset();
tsToPesVideo.Reset(); tsToPesVideo.Reset();
tsToPesAudio.Reset(); tsToPesAudio.Reset();
tsToPesSubtitle.Reset(); tsToPesSubtitle.Reset();

14
remux.c
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 2.12 2009/01/24 12:29:19 kls Exp $ * $Id: remux.c 2.13 2009/01/24 13:44:45 kls Exp $
*/ */
#include "remux.h" #include "remux.h"
@ -351,8 +351,14 @@ uchar *cPatPmtGenerator::GetPmt(int &Index)
// --- cPatPmtParser --------------------------------------------------------- // --- cPatPmtParser ---------------------------------------------------------
cPatPmtParser::cPatPmtParser(void) cPatPmtParser::cPatPmtParser(void)
{
Reset();
}
void cPatPmtParser::Reset(void)
{ {
pmtSize = 0; pmtSize = 0;
patVersion = pmtVersion = -1;
pmtPid = -1; pmtPid = -1;
vpid = vtype = 0; vpid = vtype = 0;
} }
@ -370,6 +376,8 @@ void cPatPmtParser::ParsePat(const uchar *Data, int Length)
SI::PAT Pat(Data, false); SI::PAT Pat(Data, false);
if (Pat.CheckCRCAndParse()) { if (Pat.CheckCRCAndParse()) {
dbgpatpmt("PAT: TSid = %d, c/n = %d, v = %d, s = %d, ls = %d\n", Pat.getTransportStreamId(), Pat.getCurrentNextIndicator(), Pat.getVersionNumber(), Pat.getSectionNumber(), Pat.getLastSectionNumber()); 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;
SI::PAT::Association assoc; SI::PAT::Association assoc;
for (SI::Loop::Iterator it; Pat.associationLoop.getNext(assoc, it); ) { for (SI::Loop::Iterator it; Pat.associationLoop.getNext(assoc, it); ) {
dbgpatpmt(" isNITPid = %d\n", assoc.isNITPid()); dbgpatpmt(" isNITPid = %d\n", assoc.isNITPid());
@ -378,6 +386,7 @@ void cPatPmtParser::ParsePat(const uchar *Data, int Length)
dbgpatpmt(" service id = %d, pid = %d\n", assoc.getServiceId(), assoc.getPid()); dbgpatpmt(" service id = %d, pid = %d\n", assoc.getServiceId(), assoc.getPid());
} }
} }
patVersion = Pat.getVersionNumber();
} }
else else
esyslog("ERROR: can't parse PAT"); esyslog("ERROR: can't parse PAT");
@ -428,6 +437,8 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
if (Pmt.CheckCRCAndParse()) { if (Pmt.CheckCRCAndParse()) {
dbgpatpmt("PMT: sid = %d, c/n = %d, v = %d, s = %d, ls = %d\n", Pmt.getServiceId(), Pmt.getCurrentNextIndicator(), Pmt.getVersionNumber(), Pmt.getSectionNumber(), Pmt.getLastSectionNumber()); dbgpatpmt("PMT: sid = %d, c/n = %d, v = %d, s = %d, ls = %d\n", Pmt.getServiceId(), Pmt.getCurrentNextIndicator(), Pmt.getVersionNumber(), Pmt.getSectionNumber(), Pmt.getLastSectionNumber());
dbgpatpmt(" pcr = %d\n", Pmt.getPCRPid()); dbgpatpmt(" pcr = %d\n", Pmt.getPCRPid());
if (pmtVersion == Pmt.getVersionNumber())
return;
cDevice::PrimaryDevice()->ClrAvailableTracks(false, true); cDevice::PrimaryDevice()->ClrAvailableTracks(false, true);
int NumApids = 0; int NumApids = 0;
int NumDpids = 0; int NumDpids = 0;
@ -533,6 +544,7 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
cDevice::PrimaryDevice()->EnsureAudioTrack(true); cDevice::PrimaryDevice()->EnsureAudioTrack(true);
cDevice::PrimaryDevice()->EnsureSubtitleTrack(); cDevice::PrimaryDevice()->EnsureSubtitleTrack();
} }
pmtVersion = Pmt.getVersionNumber();
} }
else else
esyslog("ERROR: can't parse PMT"); esyslog("ERROR: can't parse PMT");

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 2.6 2009/01/23 16:44:46 kls Exp $ * $Id: remux.h 2.7 2009/01/24 13:38:10 kls Exp $
*/ */
#ifndef __REMUX_H #ifndef __REMUX_H
@ -192,6 +192,8 @@ class cPatPmtParser {
private: private:
uchar pmt[MAX_SECTION_SIZE]; uchar pmt[MAX_SECTION_SIZE];
int pmtSize; int pmtSize;
int patVersion;
int pmtVersion;
int pmtPid; int pmtPid;
int vpid; int vpid;
int vtype; int vtype;
@ -199,6 +201,9 @@ protected:
int SectionLength(const uchar *Data, int Length) { return (Length >= 3) ? ((int(Data[1]) & 0x0F) << 8)| Data[2] : 0; } int SectionLength(const uchar *Data, int Length) { return (Length >= 3) ? ((int(Data[1]) & 0x0F) << 8)| Data[2] : 0; }
public: public:
cPatPmtParser(void); cPatPmtParser(void);
void Reset(void);
///< Resets the parser. This function must be called whenever a new
///< stream is parsed.
void ParsePat(const uchar *Data, int Length); void ParsePat(const uchar *Data, int Length);
///< Parses the PAT data from the single TS packet in Data. ///< Parses the PAT data from the single TS packet in Data.
///< Length is always TS_SIZE. ///< Length is always TS_SIZE.