tsdemux: Handle old streams claiming to be HDMV with Opus
authorJan Schmidt <jan@centricular.com>
Sun, 24 May 2020 15:49:00 +0000 (01:49 +1000)
committerJan Schmidt <jan@centricular.com>
Sun, 24 May 2020 15:51:46 +0000 (01:51 +1000)
GStreamer 1.16 and earlier produced streams with HDMV registration id
but with Opus audio streams on the stream ID that AC-4 now uses. Make
sure those still play back by special casing the check for AC-4 in HDMV

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1295

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1296>

gst/mpegtsdemux/tsdemux.c

index 7193367..74846d9 100644 (file)
@@ -1197,8 +1197,12 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream,
         caps = gst_caps_new_empty_simple ("audio/x-eac3");
         break;
       case ST_BD_AUDIO_AC4:
-        is_audio = TRUE;
-        caps = gst_caps_new_empty_simple ("audio/x-ac4");
+        /* Opus also uses 0x06, and there are bad streams that have HDMV registration ID,
+         * but contain an Opus registration id, so check for it */
+        if (bstream->registration_id != DRF_ID_OPUS) {
+          is_audio = TRUE;
+          caps = gst_caps_new_empty_simple ("audio/x-ac4");
+        }
         break;
       case ST_BD_AUDIO_AC3_TRUE_HD:
         is_audio = TRUE;