Fixed unwanted track modifications when parsing PAT/PMT for recording

This commit is contained in:
Klaus Schmidinger 2009-06-06 13:26:23 +02:00
parent 1f798b0f8e
commit 96d25c3be1
3 changed files with 20 additions and 11 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: device.c 2.22 2009/06/06 11:17:05 kls Exp $ * $Id: device.c 2.23 2009/06/06 13:25:58 kls Exp $
*/ */
#include "device.h" #include "device.h"
@ -61,6 +61,7 @@ cDevice *cDevice::primaryDevice = NULL;
cDevice *cDevice::avoidDevice = NULL; cDevice *cDevice::avoidDevice = NULL;
cDevice::cDevice(void) cDevice::cDevice(void)
:patPmtParser(true)
{ {
cardIndex = nextCardIndex++; cardIndex = nextCardIndex++;

23
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.23 2009/05/24 11:44:54 kls Exp $ * $Id: remux.c 2.24 2009/06/06 13:24:57 kls Exp $
*/ */
#include "remux.h" #include "remux.h"
@ -389,8 +389,9 @@ uchar *cPatPmtGenerator::GetPmt(int &Index)
// --- cPatPmtParser --------------------------------------------------------- // --- cPatPmtParser ---------------------------------------------------------
cPatPmtParser::cPatPmtParser(void) cPatPmtParser::cPatPmtParser(bool UpdatePrimaryDevice)
{ {
updatePrimaryDevice = UpdatePrimaryDevice;
Reset(); Reset();
} }
@ -478,7 +479,8 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
dbgpatpmt(" pcr = %d\n", Pmt.getPCRPid()); dbgpatpmt(" pcr = %d\n", Pmt.getPCRPid());
if (pmtVersion == Pmt.getVersionNumber()) if (pmtVersion == Pmt.getVersionNumber())
return; return;
cDevice::PrimaryDevice()->ClrAvailableTracks(false, true); if (updatePrimaryDevice)
cDevice::PrimaryDevice()->ClrAvailableTracks(false, true);
int NumApids = 0; int NumApids = 0;
int NumDpids = 0; int NumDpids = 0;
int NumSpids = 0; int NumSpids = 0;
@ -522,7 +524,8 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
} }
delete d; delete d;
} }
cDevice::PrimaryDevice()->SetAvailableTrack(ttAudio, NumApids, stream.getPid(), ALangs); if (updatePrimaryDevice)
cDevice::PrimaryDevice()->SetAvailableTrack(ttAudio, NumApids, stream.getPid(), ALangs);
NumApids++; NumApids++;
} }
} }
@ -557,7 +560,8 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
break; break;
} }
} }
cDevice::PrimaryDevice()->SetAvailableTrack(ttSubtitle, NumSpids, stream.getPid(), SLangs); if (updatePrimaryDevice)
cDevice::PrimaryDevice()->SetAvailableTrack(ttSubtitle, NumSpids, stream.getPid(), SLangs);
NumSpids++; NumSpids++;
} }
break; break;
@ -573,7 +577,8 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
} }
if (dpid) { if (dpid) {
if (NumDpids < MAXDPIDS) { if (NumDpids < MAXDPIDS) {
cDevice::PrimaryDevice()->SetAvailableTrack(ttDolby, NumDpids, dpid, lang); if (updatePrimaryDevice)
cDevice::PrimaryDevice()->SetAvailableTrack(ttDolby, NumDpids, dpid, lang);
NumDpids++; NumDpids++;
} }
} }
@ -581,8 +586,10 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
break; break;
} }
dbgpatpmt("\n"); dbgpatpmt("\n");
cDevice::PrimaryDevice()->EnsureAudioTrack(true); if (updatePrimaryDevice) {
cDevice::PrimaryDevice()->EnsureSubtitleTrack(); cDevice::PrimaryDevice()->EnsureAudioTrack(true);
cDevice::PrimaryDevice()->EnsureSubtitleTrack();
}
} }
pmtVersion = Pmt.getVersionNumber(); pmtVersion = Pmt.getVersionNumber();
} }

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.16 2009/05/24 15:07:44 kls Exp $ * $Id: remux.h 2.17 2009/06/06 13:26:23 kls Exp $
*/ */
#ifndef __REMUX_H #ifndef __REMUX_H
@ -213,10 +213,11 @@ private:
int pmtPid; int pmtPid;
int vpid; int vpid;
int vtype; int vtype;
bool updatePrimaryDevice;
protected: 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(bool UpdatePrimaryDevice = false);
void Reset(void); void Reset(void);
///< Resets the parser. This function must be called whenever a new ///< Resets the parser. This function must be called whenever a new
///< stream is parsed. ///< stream is parsed.