From cacc663b359b824bbceccd93599b6aa9364e10dd Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Sun, 25 Jan 2009 22:49:11 +0100 Subject: [PATCH] dvddemux: tweak subtitle stream setup based on dvd language codes event ... to allow for non-continuous subtitle stream numbers. The missing stream numbers tend to come up as subtitle streams anyway (albeit not with an identified language tag). --- gst/mpegstream/gstdvddemux.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/gst/mpegstream/gstdvddemux.c b/gst/mpegstream/gstdvddemux.c index 2c9d91db15..bfed3e7df4 100644 --- a/gst/mpegstream/gstdvddemux.c +++ b/gst/mpegstream/gstdvddemux.c @@ -422,16 +422,22 @@ gst_dvd_demux_handle_dvd_event (GstDVDDemux * dvd_demux, GstEvent * event) } /* subtitle */ - for (;;) { - t = g_strdup_printf ("subtitle-%d-language", num_substreams); + for (n = 0; n < GST_DVD_DEMUX_NUM_SUBPICTURE_STREAMS; n++) { + t = g_strdup_printf ("subtitle-%d-language", n); if (!gst_structure_get_value (structure, t)) { g_free (t); - break; + continue; } g_free (t); - CLASS (dvd_demux)->get_subpicture_stream (mpeg_demux, - num_substreams++, GST_DVD_DEMUX_SUBP_DVD, NULL); + num_substreams = n + 1; } + + /* now we have a maximum, + * and can also fill empty slots in case of cranky DVD */ + for (n = 0; n < num_substreams; n++) + CLASS (dvd_demux)->get_subpicture_stream (mpeg_demux, + n, GST_DVD_DEMUX_SUBP_DVD, NULL); + GST_DEBUG_OBJECT (dvd_demux, "Created 1 video stream, %d audio streams and %d subpicture streams " "based on DVD lang codes event; now signalling no-more-pads",