diff options
author | Edward Hervey <edward@collabora.com> | 2013-07-29 08:23:30 +0200 |
---|---|---|
committer | Edward Hervey <edward@collabora.com> | 2013-07-29 09:42:11 +0200 |
commit | edd69b2989e9445d00a2a8740f0283747179431f (patch) | |
tree | 715db1509b8ebc1b2dd665a01b87a5dd2d48d511 | |
parent | a76c658e8d5fa1b533b0d54a947db50a29d9b369 (diff) |
tsdemux: Add more AC3 detection cases
ATSC ac3 streams are always guaranteed to be AC3 if EAC3 descriptor
is not present
If stream registration id is 'AC-3' then it's also guaranteed to be AC3.
Finally if AC3 descriptor is present it's guaranteed to be AC3.
Only silences a warning, but still.
-rw-r--r-- | gst/mpegtsdemux/gstmpegdesc.h | 3 | ||||
-rw-r--r-- | gst/mpegtsdemux/tsdemux.c | 22 |
2 files changed, 19 insertions, 6 deletions
diff --git a/gst/mpegtsdemux/gstmpegdesc.h b/gst/mpegtsdemux/gstmpegdesc.h index 6bb9d4ce3..fcb473409 100644 --- a/gst/mpegtsdemux/gstmpegdesc.h +++ b/gst/mpegtsdemux/gstmpegdesc.h @@ -226,5 +226,8 @@ #define DRF_ID_DTS3 0x44545333 #define DRF_ID_S302M 0x42535344 #define DRF_ID_TSHV 0x54534856 +#define DRF_ID_AC3 0x41432d33 +#define DRF_ID_GA94 0x47413934 +#define DRF_ID_CUEI 0x43554549 #endif /* __GST_MPEG_DESC_H__ */ diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c index 54118117b..927577735 100644 --- a/gst/mpegtsdemux/tsdemux.c +++ b/gst/mpegtsdemux/tsdemux.c @@ -946,12 +946,22 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream, break; } - /* DVB_AC3 */ - desc = mpegts_get_descriptor_from_stream (bstream, GST_MTS_DESC_DVB_AC3); - if (!desc) - GST_WARNING ("AC3 stream type found but no corresponding " - "descriptor to differentiate between AC3 and EAC3. " - "Assuming plain AC3."); + /* If stream has ac3 descriptor + * OR program is ATSC (GA94) + * OR stream registration is AC-3 + * then it's regular AC3 */ + if (bstream->registration_id == DRF_ID_AC3 || + program->registration_id == DRF_ID_GA94 || + mpegts_get_descriptor_from_stream (bstream, GST_MTS_DESC_DVB_AC3)) { + template = gst_static_pad_template_get (&audio_template); + name = g_strdup_printf ("audio_%04x", bstream->pid); + caps = gst_caps_new_empty_simple ("audio/x-ac3"); + break; + } + + GST_WARNING ("AC3 stream type found but no guaranteed " + "way found to differentiate between AC3 and EAC3. " + "Assuming plain AC3."); template = gst_static_pad_template_get (&audio_template); name = g_strdup_printf ("audio_%04x", bstream->pid); caps = gst_caps_new_empty_simple ("audio/x-ac3"); |