diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2010-06-05 13:50:56 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2010-06-05 13:50:56 +0200 |
commit | 9377d831b3db032990dd71b1969713b8e361860a (patch) | |
tree | 88e5edba613906c74ddbdd848a2eead12dfcd3c5 | |
parent | 174eaaffbd056de9cfc63d2077b8cc996dbb618e (diff) | |
download | vdr-9377d831b3db032990dd71b1969713b8e361860a.tar.gz vdr-9377d831b3db032990dd71b1969713b8e361860a.tar.bz2 |
Added full handling of the stream types of Dolby Digital pids
-rw-r--r-- | CONTRIBUTORS | 1 | ||||
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | channels.c | 22 | ||||
-rw-r--r-- | channels.h | 6 | ||||
-rw-r--r-- | pat.c | 8 | ||||
-rw-r--r-- | remux.c | 13 | ||||
-rw-r--r-- | remux.h | 4 |
7 files changed, 39 insertions, 17 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 2332b631..41f8e0ec 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2369,6 +2369,7 @@ Alexander Riedel <alexander-riedel@t-online.de> Jose Alberto Reguero <jareguero@telefonica.net> for a patch that fixed part of a crash in i18n character set conversion for fixing cDvbPlayer::NextFile() to handle files larger than 2GB + for implementing full handling of the stream types of Dolby Digital pids Patrice Staudt <staudt@engsystem.net> for adding full weekday names to i18n.c for plugins to use @@ -6463,3 +6463,5 @@ Video Disk Recorder Revision History See man vdr(5) on how the APID section of channels has been extended to store this information. - Added detecting channels that use service type 0x16. +- Added full handling of the stream types of Dolby Digital pids + (thanks to Jose Alberto Reguero). @@ -4,13 +4,14 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.c 2.15 2010/05/16 11:44:31 kls Exp $ + * $Id: channels.c 2.16 2010/06/05 13:33:57 kls Exp $ */ #include "channels.h" #include <ctype.h> #include "device.h" #include "epg.h" +#include "libsi/si.h" #include "timers.h" // IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d' @@ -294,12 +295,12 @@ static int IntArrayToString(char *s, const int *a, int Base = 10, const char n[] return q - s; } -void cChannel::SetPids(int Vpid, int Ppid, int Vtype, int *Apids, int *Atypes, char ALangs[][MAXLANGCODE2], int *Dpids, char DLangs[][MAXLANGCODE2], int *Spids, char SLangs[][MAXLANGCODE2], int Tpid) +void cChannel::SetPids(int Vpid, int Ppid, int Vtype, int *Apids, int *Atypes, char ALangs[][MAXLANGCODE2], int *Dpids, int *Dtypes, char DLangs[][MAXLANGCODE2], int *Spids, char SLangs[][MAXLANGCODE2], int Tpid) { int mod = CHANNELMOD_NONE; if (vpid != Vpid || ppid != Ppid || vtype != Vtype || tpid != Tpid) mod |= CHANNELMOD_PIDS; - int m = IntArraysDiffer(apids, Apids, alangs, ALangs) | IntArraysDiffer(atypes, Atypes) | IntArraysDiffer(dpids, Dpids, dlangs, DLangs) | IntArraysDiffer(spids, Spids, slangs, SLangs); + int m = IntArraysDiffer(apids, Apids, alangs, ALangs) | IntArraysDiffer(atypes, Atypes) | IntArraysDiffer(dpids, Dpids, dlangs, DLangs) | IntArraysDiffer(dtypes, Dtypes) | IntArraysDiffer(spids, Spids, slangs, SLangs); if (m & STRDIFF) mod |= CHANNELMOD_LANGS; if (m & VALDIFF) @@ -312,14 +313,14 @@ void cChannel::SetPids(int Vpid, int Ppid, int Vtype, int *Apids, int *Atypes, c q += IntArrayToString(q, apids, 10, alangs, atypes); if (dpids[0]) { *q++ = ';'; - q += IntArrayToString(q, dpids, 10, dlangs); + q += IntArrayToString(q, dpids, 10, dlangs, dtypes); } *q = 0; q = NewApidsBuf; q += IntArrayToString(q, Apids, 10, ALangs, Atypes); if (Dpids[0]) { *q++ = ';'; - q += IntArrayToString(q, Dpids, 10, DLangs); + q += IntArrayToString(q, Dpids, 10, DLangs, Dtypes); } *q = 0; const int SBufferSize = MAXSPIDS * (5 + 1 + MAXLANGCODE2) + 10; // 5 digits plus delimiting ',' or ';' plus optional '=cod', +10: paranoia @@ -344,6 +345,7 @@ void cChannel::SetPids(int Vpid, int Ppid, int Vtype, int *Apids, int *Atypes, c apids[MAXAPIDS] = 0; for (int i = 0; i < MAXDPIDS; i++) { dpids[i] = Dpids[i]; + dtypes[i] = Dtypes[i]; strn0cpy(dlangs[i], DLangs[i], MAXLANGCODE2); } dpids[MAXDPIDS] = 0; @@ -499,7 +501,7 @@ cString cChannel::ToText(const cChannel *Channel) q += IntArrayToString(q, Channel->apids, 10, Channel->alangs, Channel->atypes); if (Channel->dpids[0]) { *q++ = ';'; - q += IntArrayToString(q, Channel->dpids, 10, Channel->dlangs); + q += IntArrayToString(q, Channel->dpids, 10, Channel->dlangs, Channel->dtypes); } *q = 0; char caidbuf[MAXCAIDS * 5 + 10]; // 5: 4 digits plus delimiting ',', 10: paranoia @@ -557,6 +559,7 @@ bool cChannel::Parse(const char *s) apids[0] = 0; atypes[0] = 0; dpids[0] = 0; + dtypes[0] = 0; ok = false; if (parambuf && sourcebuf && vpidbuf && apidbuf) { parameters = parambuf; @@ -617,9 +620,15 @@ bool cChannel::Parse(const char *s) char *strtok_next; while ((q = strtok_r(p, ",", &strtok_next)) != NULL) { if (NumDpids < MAXDPIDS) { + dtypes[NumDpids] = SI::AC3DescriptorTag; // backwards compatibility char *l = strchr(q, '='); if (l) { *l++ = 0; + char *t = strchr(l, '@'); + if (t) { + *t++ = 0; + dtypes[NumDpids] = strtol(t, NULL, 10); + } strn0cpy(dlangs[NumDpids], l, MAXLANGCODE2); } else @@ -631,6 +640,7 @@ bool cChannel::Parse(const char *s) p = NULL; } dpids[NumDpids] = 0; + dtypes[NumDpids] = 0; } if (caidbuf) { @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.h 2.11 2010/05/16 11:06:52 kls Exp $ + * $Id: channels.h 2.12 2010/06/05 13:12:54 kls Exp $ */ #ifndef __CHANNELS_H @@ -107,6 +107,7 @@ private: int atypes[MAXAPIDS + 1]; // list is zero-terminated char alangs[MAXAPIDS][MAXLANGCODE2]; int dpids[MAXDPIDS + 1]; // list is zero-terminated + int dtypes[MAXAPIDS + 1]; // list is zero-terminated char dlangs[MAXDPIDS][MAXLANGCODE2]; int spids[MAXSPIDS + 1]; // list is zero-terminated char slangs[MAXSPIDS][MAXLANGCODE2]; @@ -158,6 +159,7 @@ public: 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] : ""; } int Atype(int i) const { return (0 <= i && i < MAXAPIDS) ? atypes[i] : 0; } + int Dtype(int i) const { return (0 <= i && i < MAXDPIDS) ? dtypes[i] : 0; } 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); } @@ -187,7 +189,7 @@ public: void SetId(int Nid, int Tid, int Sid, int Rid = 0); void SetName(const char *Name, const char *ShortName, const char *Provider); void SetPortalName(const char *PortalName); - void SetPids(int Vpid, int Ppid, int Vtype, int *Apids, int *Atypes, char ALangs[][MAXLANGCODE2], int *Dpids, char DLangs[][MAXLANGCODE2], int *Spids, char SLangs[][MAXLANGCODE2], int Tpid); + void SetPids(int Vpid, int Ppid, int Vtype, int *Apids, int *Atypes, char ALangs[][MAXLANGCODE2], int *Dpids, int *Dtypes, char DLangs[][MAXLANGCODE2], int *Spids, char SLangs[][MAXLANGCODE2], int Tpid); void SetCaIds(const int *CaIds); // list must be zero-terminated void SetCaDescriptors(int Level); void SetLinkChannels(cLinkChannels *LinkChannels); @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: pat.c 2.10 2010/05/16 11:12:57 kls Exp $ + * $Id: pat.c 2.11 2010/06/05 13:26:47 kls Exp $ */ #include "pat.h" @@ -334,6 +334,7 @@ void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length int Apids[MAXAPIDS + 1] = { 0 }; // these lists are zero-terminated int Atypes[MAXDPIDS + 1] = { 0 }; int Dpids[MAXDPIDS + 1] = { 0 }; + int Dtypes[MAXDPIDS + 1] = { 0 }; int Spids[MAXSPIDS + 1] = { 0 }; uchar SubtitlingTypes[MAXSPIDS + 1] = { 0 }; uint16_t CompositionPageIds[MAXSPIDS + 1] = { 0 }; @@ -399,6 +400,7 @@ void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length //XXX case 8: // STREAMTYPE_13818_DSMCC { int dpid = 0; + int dtype = 0; char lang[MAXLANGCODE1] = { 0 }; SI::Descriptor *d; for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) { @@ -406,6 +408,7 @@ void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length case SI::AC3DescriptorTag: case SI::EnhancedAC3DescriptorTag: dpid = esPid; + dtype = d->getDescriptorTag(); ProcessCaDescriptors = true; break; case SI::SubtitlingDescriptorTag: @@ -446,6 +449,7 @@ void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length if (dpid) { if (NumDpids < MAXDPIDS) { Dpids[NumDpids] = dpid; + Dtypes[NumDpids] = dtype; strn0cpy(DLangs[NumDpids], lang, MAXLANGCODE1); NumDpids++; } @@ -485,7 +489,7 @@ void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length } } if (Setup.UpdateChannels >= 2) { - Channel->SetPids(Vpid, Ppid, Vtype, Apids, Atypes, ALangs, Dpids, DLangs, Spids, SLangs, Tpid); + Channel->SetPids(Vpid, Ppid, Vtype, Apids, Atypes, ALangs, Dpids, Dtypes, DLangs, Spids, SLangs, Tpid); Channel->SetCaIds(CaDescriptors->CaIds()); Channel->SetSubtitlingDescriptors(SubtitlingTypes, CompositionPageIds, AncillaryPageIds); } @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: remux.c 2.46 2010/05/16 12:23:12 kls Exp $ + * $Id: remux.c 2.47 2010/06/05 13:32:15 kls Exp $ */ #include "remux.h" @@ -188,10 +188,10 @@ int cPatPmtGenerator::MakeStream(uchar *Target, uchar Type, int Pid) return i; } -int cPatPmtGenerator::MakeAC3Descriptor(uchar *Target) +int cPatPmtGenerator::MakeAC3Descriptor(uchar *Target, uchar Type) { int i = 0; - Target[i++] = SI::AC3DescriptorTag; + Target[i++] = Type; Target[i++] = 0x01; // length Target[i++] = 0x00; IncEsInfoLength(i); @@ -327,7 +327,7 @@ void cPatPmtGenerator::GeneratePmt(const cChannel *Channel) } for (int n = 0; Channel->Dpid(n); n++) { i += MakeStream(buf + i, 0x06, Channel->Dpid(n)); - i += MakeAC3Descriptor(buf + i); + i += MakeAC3Descriptor(buf + i, Channel->Dtype(n)); i += MakeLanguageDescriptor(buf + i, Channel->Dlang(n)); } for (int n = 0; Channel->Spid(n); n++) { @@ -552,13 +552,16 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length) case 0x06: // STREAMTYPE_13818_PES_PRIVATE { int dpid = 0; + int dtype = 0; char lang[MAXLANGCODE1] = ""; SI::Descriptor *d; for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) { switch (d->getDescriptorTag()) { case SI::AC3DescriptorTag: + case SI::EnhancedAC3DescriptorTag: dbgpatpmt(" AC3"); dpid = stream.getPid(); + dtype = d->getDescriptorTag(); break; case SI::SubtitlingDescriptorTag: dbgpatpmt(" subtitling"); @@ -605,7 +608,7 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length) if (dpid) { if (NumDpids < MAXDPIDS) { dpids[NumDpids] = dpid; - dtypes[NumDpids] = stream.getStreamType(); + dtypes[NumDpids] = dtype; strn0cpy(dlangs[NumDpids], lang, sizeof(dlangs[NumDpids])); if (updatePrimaryDevice && Setup.UseDolbyDigital) cDevice::PrimaryDevice()->SetAvailableTrack(ttDolby, NumDpids, dpid, lang); @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: remux.h 2.25 2010/05/13 14:29:45 kls Exp $ + * $Id: remux.h 2.26 2010/06/05 13:27:55 kls Exp $ */ #ifndef __REMUX_H @@ -169,7 +169,7 @@ private: void IncEsInfoLength(int Length); protected: int MakeStream(uchar *Target, uchar Type, int Pid); - int MakeAC3Descriptor(uchar *Target); + int MakeAC3Descriptor(uchar *Target, uchar Type); int MakeSubtitlingDescriptor(uchar *Target, const char *Language, uchar SubtitlingType, uint16_t CompositionPageId, uint16_t AncillaryPageId); int MakeLanguageDescriptor(uchar *Target, const char *Language); int MakeCRC(uchar *Target, const uchar *Data, int Length); |