Skip to content

Commit

Permalink
extend normalization of AC-3, DTS and E-AC-3 signalling
Browse files Browse the repository at this point in the history
  • Loading branch information
dekarl committed Jan 22, 2013
1 parent c99b296 commit 733d982
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
26 changes: 23 additions & 3 deletions mythtv/libs/libmythtv/mpeg/mpegtables.cpp
Expand Up @@ -49,9 +49,16 @@ uint StreamID::Normalize(uint stream_id, const desc_list_t &desc,
if ((sistandard != "dvb") && (OpenCableVideo == stream_id))
return MPEG2Video;

/* normalize DVB style signalling to ATSC style signalling to make
* IsAudio work with either, see A/52:2010 A4 vs A5 */
if (MPEGDescriptor::Find(desc, DescriptorID::ac3))
return AC3Audio;

/* normalize DVB style signalling to ATSC style signalling to make
* IsAudio work with either */
if (MPEGDescriptor::Find(desc, DescriptorID::eac3))
return EAC3Audio;

QString reg;
const unsigned char *d = MPEGDescriptor::Find(
desc, DescriptorID::registration);
Expand All @@ -62,9 +69,18 @@ uint StreamID::Normalize(uint stream_id, const desc_list_t &desc,
reg = rd.FormatIdentifierString();
}

if (reg == "DTS1")
/* normalize all three DTS frame sizes, via http://www.smpte-ra.org/mpegreg/mpegreg.html */
if ((reg == "DTS1") || (reg == "DTS2") || (reg == "DTS3"))
return DTSAudio;

/* normalize AC-3 signalling according to A/52:2010 A4 */
if (reg == "AC-3")
return AC3Audio;

/* normalize E-AC-3 signalling with guesswork via http://www.smpte-ra.org/mpegreg/mpegreg.html */
if (reg == "EAC3")
return EAC3Audio;

#if 0
// not needed while there is no specific stream id for these
if (MPEGDescriptor::Find(desc, DescriptorID::teletext) ||
Expand Down Expand Up @@ -938,6 +954,8 @@ const char *StreamID::toString(uint streamID)
// audio
case StreamID::AC3Audio:
return "audio-ac3"; // EIT, PMT
case StreamID::EAC3Audio:
return "audio-eac3"; // EIT, PMT
case StreamID::MPEG2Audio:
return "audio-mp2-layer[1,2,3]"; // EIT, PMT
case StreamID::MPEG1Audio:
Expand Down Expand Up @@ -971,8 +989,8 @@ const char *StreamID::toString(uint streamID)

//case TableID::STUFFING: XXX: Duplicate?
// return "stuffing"; // optionally in any
case TableID::CENSOR:
return "censor"; // EIT, optionally in PMT
//case TableID::CENSOR: FIXME collides with StreamID::EAC3Audio
// return "censor"; // EIT, optionally in PMT
case TableID::ECN:
return "extended channel name";
case TableID::SRVLOC:
Expand Down Expand Up @@ -1015,6 +1033,8 @@ QString StreamID::GetDescription(uint stream_id)
return "13818-3 AAC LATM MPEG-2 Audio";
case StreamID::AC3Audio:
return "AC3 Audio";
case StreamID::EAC3Audio:
return "E-AC3 Audio";
case StreamID::DTSAudio:
return "DTS Audio";

Expand Down
4 changes: 3 additions & 1 deletion mythtv/libs/libmythtv/mpeg/mpegtables.h
Expand Up @@ -121,7 +121,8 @@ class MTV_PUBLIC StreamID
MPEG2Audio = 0x04, ///< ISO 13818-3
MPEG2AACAudio = 0x0f, ///< ISO 13818-7 Audio w/ADTS syntax
MPEG2AudioAmd1 = 0x11, ///< ISO 13818-3/AMD-1 Audio using LATM syntax
AC3Audio = 0x81,
AC3Audio = 0x81, ///< A/53 Part 3:2009 6.7.1
EAC3Audio = 0x87, ///< A/53 Part 3:2009 6.7.3
DTSAudio = 0x8a,

// DSM-CC Object Carousel
Expand Down Expand Up @@ -177,6 +178,7 @@ class MTV_PUBLIC StreamID
(StreamID::MPEG2AudioAmd1 == type) ||
(StreamID::MPEG2AACAudio == type) ||
(StreamID::AC3Audio == type) ||
(StreamID::EAC3Audio == type) ||
(StreamID::DTSAudio == type));
}
/// Returns true iff stream contains DSMCC Object Carousel
Expand Down

0 comments on commit 733d982

Please sign in to comment.