From 6629ca8f2ba632c44225c0195554a2307f01016f Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Mon, 3 Mar 2014 13:07:47 +0100 Subject: [PATCH] tsdemux: Support Bluray DTS/DTS-HD and AC3+/TrueHD streams Apart from just adding detection of the proper stream type, we also need to only output the first substream (0x71) which contains the core substream. While this does not provide *full* DTS-HD support (since it will miss the complementary substreams), it will still work in the way legacy (non-DTS-HD) bluray players would work. https://bugzilla.gnome.org/show_bug.cgi?id=725563 --- gst/mpegtsdemux/tsdemux.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c index 0c1542fb3b..ed78fd1e4a 100644 --- a/gst/mpegtsdemux/tsdemux.c +++ b/gst/mpegtsdemux/tsdemux.c @@ -157,6 +157,9 @@ struct _TSDemuxStream /* List of pending buffers */ GList *pending; + + /* if != 0, output only PES from that substream */ + guint8 target_pes_substream; }; #define VIDEO_CAPS \ @@ -814,6 +817,7 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream, break; } case ST_BD_AUDIO_EAC3: + case ST_BD_AUDIO_AC3_PLUS: template = gst_static_pad_template_get (&audio_template); name = g_strdup_printf ("audio_%04x", bstream->pid); caps = gst_caps_new_empty_simple ("audio/x-eac3"); @@ -822,6 +826,7 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream, template = gst_static_pad_template_get (&audio_template); name = g_strdup_printf ("audio_%04x", bstream->pid); caps = gst_caps_new_empty_simple ("audio/x-true-hd"); + stream->target_pes_substream = 0x72; break; case ST_BD_AUDIO_LPCM: template = gst_static_pad_template_get (&audio_template); @@ -833,6 +838,13 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream, name = g_strdup_printf ("subpicture_%04x", bstream->pid); caps = gst_caps_new_empty_simple ("subpicture/x-pgs"); break; + case ST_BD_AUDIO_DTS_HD: + case ST_BD_AUDIO_DTS_HD_MASTER_AUDIO: + template = gst_static_pad_template_get (&audio_template); + name = g_strdup_printf ("audio_%04x", bstream->pid); + caps = gst_caps_new_empty_simple ("audio/x-dts"); + stream->target_pes_substream = 0x71; + break; } } if (template && name && caps) @@ -1488,6 +1500,12 @@ gst_ts_demux_parse_pes_header (GstTSDemux * demux, TSDemuxStream * stream, goto discont; } + if (stream->target_pes_substream != 0 + && header.stream_id_extension != stream->target_pes_substream) { + GST_DEBUG ("Skipping unwanted substream"); + goto discont; + } + gst_ts_demux_record_dts (demux, stream, header.DTS, bufferoffset); gst_ts_demux_record_pts (demux, stream, header.PTS, bufferoffset); if (G_UNLIKELY (stream->pending_ts &&