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

cParsePatPmt now has functions to retrieve the audio, dolby and subtitle pids

This commit is contained in:
Klaus Schmidinger 2009-12-24 12:28:01 +01:00
parent 25148b7b05
commit 07d50dc8c4
3 changed files with 40 additions and 8 deletions

View File

@ -6226,3 +6226,4 @@ Video Disk Recorder Revision History
If a channel's short name contains a comma, it is replaced with a '.'. If a channel's short name contains a comma, it is replaced with a '.'.
- cDevice now logs the device number when a new device is created. - cDevice now logs the device number when a new device is created.
- Fixed handling STREAMTYPE_11172_AUDIO in cPatPmtParser::ParsePmt(). - Fixed handling STREAMTYPE_11172_AUDIO in cPatPmtParser::ParsePmt().
- cParsePatPmt now has functions to retrieve the audio, dolby and subtitle pids.

24
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.34 2009/12/24 11:36:38 kls Exp $ * $Id: remux.c 2.35 2009/12/24 12:24:02 kls Exp $
*/ */
#include "remux.h" #include "remux.h"
@ -500,14 +500,15 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
case 0x04: // STREAMTYPE_13818_AUDIO case 0x04: // STREAMTYPE_13818_AUDIO
{ {
if (NumApids < MAXAPIDS) { if (NumApids < MAXAPIDS) {
char ALangs[MAXLANGCODE2] = ""; apids[NumApids] = stream.getPid();
*alangs[NumApids] = 0;
SI::Descriptor *d; SI::Descriptor *d;
for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) { for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) {
switch (d->getDescriptorTag()) { switch (d->getDescriptorTag()) {
case SI::ISO639LanguageDescriptorTag: { case SI::ISO639LanguageDescriptorTag: {
SI::ISO639LanguageDescriptor *ld = (SI::ISO639LanguageDescriptor *)d; SI::ISO639LanguageDescriptor *ld = (SI::ISO639LanguageDescriptor *)d;
SI::ISO639LanguageDescriptor::Language l; SI::ISO639LanguageDescriptor::Language l;
char *s = ALangs; char *s = alangs[NumApids];
int n = 0; int n = 0;
for (SI::Loop::Iterator it; ld->languageLoop.getNext(l, it); ) { for (SI::Loop::Iterator it; ld->languageLoop.getNext(l, it); ) {
if (*ld->languageCode != '-') { // some use "---" to indicate "none" if (*ld->languageCode != '-') { // some use "---" to indicate "none"
@ -527,7 +528,7 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
delete d; delete d;
} }
if (updatePrimaryDevice) if (updatePrimaryDevice)
cDevice::PrimaryDevice()->SetAvailableTrack(ttAudio, NumApids, stream.getPid(), ALangs); cDevice::PrimaryDevice()->SetAvailableTrack(ttAudio, NumApids, apids[NumApids], alangs[NumApids]);
NumApids++; NumApids++;
} }
} }
@ -546,14 +547,21 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
case SI::SubtitlingDescriptorTag: case SI::SubtitlingDescriptorTag:
dbgpatpmt(" subtitling"); dbgpatpmt(" subtitling");
if (NumSpids < MAXSPIDS) { if (NumSpids < MAXSPIDS) {
spids[NumSpids] = stream.getPid();
*slangs[NumSpids] = 0;
subtitlingTypes[NumSpids] = 0;
compositionPageIds[NumSpids] = 0;
ancillaryPageIds[NumSpids] = 0;
SI::SubtitlingDescriptor *sd = (SI::SubtitlingDescriptor *)d; SI::SubtitlingDescriptor *sd = (SI::SubtitlingDescriptor *)d;
SI::SubtitlingDescriptor::Subtitling sub; SI::SubtitlingDescriptor::Subtitling sub;
char SLangs[MAXLANGCODE2] = ""; char *s = slangs[NumSpids];
char *s = SLangs;
int n = 0; int n = 0;
for (SI::Loop::Iterator it; sd->subtitlingLoop.getNext(sub, it); ) { for (SI::Loop::Iterator it; sd->subtitlingLoop.getNext(sub, it); ) {
if (sub.languageCode[0]) { if (sub.languageCode[0]) {
dbgpatpmt(" '%s'", sub.languageCode); dbgpatpmt(" '%s'", sub.languageCode);
subtitlingTypes[NumSpids] = sub.getSubtitlingType();
compositionPageIds[NumSpids] = sub.getCompositionPageId();
ancillaryPageIds[NumSpids] = sub.getAncillaryPageId();
if (n > 0) if (n > 0)
*s++ = '+'; *s++ = '+';
strn0cpy(s, I18nNormalizeLanguageCode(sub.languageCode), MAXLANGCODE1); strn0cpy(s, I18nNormalizeLanguageCode(sub.languageCode), MAXLANGCODE1);
@ -563,7 +571,7 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
} }
} }
if (updatePrimaryDevice) if (updatePrimaryDevice)
cDevice::PrimaryDevice()->SetAvailableTrack(ttSubtitle, NumSpids, stream.getPid(), SLangs); cDevice::PrimaryDevice()->SetAvailableTrack(ttSubtitle, NumSpids, spids[NumSpids], slangs[NumSpids]);
NumSpids++; NumSpids++;
} }
break; break;
@ -579,6 +587,8 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
} }
if (dpid) { if (dpid) {
if (NumDpids < MAXDPIDS) { if (NumDpids < MAXDPIDS) {
dpids[NumDpids] = dpid;
strn0cpy(dlangs[NumDpids], lang, sizeof(dlangs[NumDpids]));
if (updatePrimaryDevice) if (updatePrimaryDevice)
cDevice::PrimaryDevice()->SetAvailableTrack(ttDolby, NumDpids, dpid, lang); cDevice::PrimaryDevice()->SetAvailableTrack(ttDolby, NumDpids, dpid, lang);
NumDpids++; NumDpids++;

23
remux.h
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.21 2009/12/04 15:04:43 kls Exp $ * $Id: remux.h 2.22 2009/12/24 12:04:47 kls Exp $
*/ */
#ifndef __REMUX_H #ifndef __REMUX_H
@ -214,6 +214,15 @@ private:
int pmtPid; int pmtPid;
int vpid; int vpid;
int vtype; int vtype;
int apids[MAXAPIDS + 1]; // list is zero-terminated
char alangs[MAXAPIDS][MAXLANGCODE2];
int dpids[MAXDPIDS + 1]; // list is zero-terminated
char dlangs[MAXDPIDS][MAXLANGCODE2];
int spids[MAXSPIDS + 1]; // list is zero-terminated
char slangs[MAXSPIDS][MAXLANGCODE2];
uchar subtitlingTypes[MAXSPIDS];
uint16_t compositionPageIds[MAXSPIDS];
uint16_t ancillaryPageIds[MAXSPIDS];
bool updatePrimaryDevice; 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; }
@ -244,6 +253,18 @@ public:
int Vtype(void) const { return vtype; } int Vtype(void) const { return vtype; }
///< Returns the video stream type as defined by the current PMT, or 0 if no video ///< Returns the video stream type as defined by the current PMT, or 0 if no video
///< stream type has been detected, yet. ///< stream type has been detected, yet.
const int *Apids(void) const { return apids; }
const int *Dpids(void) const { return dpids; }
const int *Spids(void) const { return spids; }
int Apid(int i) const { return (0 <= i && i < MAXAPIDS) ? apids[i] : 0; }
int Dpid(int i) const { return (0 <= i && i < MAXDPIDS) ? dpids[i] : 0; }
int Spid(int i) const { return (0 <= i && i < MAXSPIDS) ? spids[i] : 0; }
const char *Alang(int i) const { return (0 <= i && i < MAXAPIDS) ? alangs[i] : ""; }
const char *Dlang(int i) const { return (0 <= i && i < MAXDPIDS) ? dlangs[i] : ""; }
const char *Slang(int i) const { return (0 <= i && i < MAXSPIDS) ? slangs[i] : ""; }
uchar SubtitlingType(int i) const { return (0 <= i && i < MAXSPIDS) ? subtitlingTypes[i] : uchar(0); }
uint16_t CompositionPageId(int i) const { return (0 <= i && i < MAXSPIDS) ? compositionPageIds[i] : uint16_t(0); }
uint16_t AncillaryPageId(int i) const { return (0 <= i && i < MAXSPIDS) ? ancillaryPageIds[i] : uint16_t(0); }
}; };
// TS to PES converter: // TS to PES converter: