tsdemux: Add conditions to identify ATSC EAC3
authorWonchul Lee <wonchul.lee@collabora.com>
Tue, 13 Sep 2016 13:07:05 +0000 (22:07 +0900)
committerOlivier CrĂȘte <olivier.crete@collabora.com>
Mon, 3 Oct 2016 19:14:54 +0000 (15:14 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=770528

gst-libs/gst/mpegts/gstmpegtsdescriptor.h
gst/mpegtsdemux/gstmpegdesc.h
gst/mpegtsdemux/tsdemux.c

index 33d46f5..87c7343 100644 (file)
@@ -174,6 +174,7 @@ typedef enum {
   GST_MTS_DESC_ATSC_REDISTRIBUTION_CONTROL      = 0xAA,
   GST_MTS_DESC_ATSC_GENRE                       = 0xAB,
   GST_MTS_DESC_ATSC_PRIVATE_INFORMATION         = 0xAD,
+  GST_MTS_DESC_ATSC_EAC3                        = 0xCC,
 
   /* ATSC A/53:3 2009 */
   GST_MTS_DESC_ATSC_ENHANCED_SIGNALING          = 0xB2,
index bd9235f..e4e6743 100644 (file)
 #define DRF_ID_HEVC       0x48455643
 #define DRF_ID_KLVA       0x4b4c5641   /* defined in RP217 */
 #define DRF_ID_OPUS       0x4f707573
+#define DRF_ID_EAC3       0x45414333   /* defined in A/52 Annex G */
 
 #endif /* __GST_MPEG_DESC_H__ */
index 0ac95bd..029a033 100644 (file)
@@ -1507,10 +1507,24 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream,
       caps = gst_caps_new_empty_simple ("audio/x-ac3");
       break;
     case ST_PS_AUDIO_EAC3:
+    {
       /* ATSC_ENHANCED_AC3 */
+      if (bstream->registration_id == DRF_ID_EAC3 ||
+          mpegts_get_descriptor_from_stream (bstream, GST_MTS_DESC_ATSC_EAC3)) {
+        is_audio = TRUE;
+        caps = gst_caps_new_empty_simple ("audio/x-eac3");
+        break;
+      }
+
+      GST_ELEMENT_WARNING (demux, STREAM, DEMUX,
+          ("Assuming ATSC E-AC3 audio stream."),
+          ("ATSC E-AC3 stream type found but no guarantee way found to "
+              "differentiate among other standards (DVB, ISDB and etc..)"));
+
       is_audio = TRUE;
       caps = gst_caps_new_empty_simple ("audio/x-eac3");
       break;
+    }
     case ST_PS_AUDIO_LPCM2:
       is_audio = TRUE;
       caps = gst_caps_new_empty_simple ("audio/x-private2-lpcm");