summaryrefslogtreecommitdiffstats
path: root/ext/resindvd/gstmpegdemux.c
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@noraisin.net>2009-04-24 14:07:30 +0100
committerJan Schmidt <thaytan@noraisin.net>2009-04-29 21:02:15 +0100
commiteedf3131564c59e1c026cba7ab104c31df2fb6db (patch)
tree88686b7542ba9e7a14e836b97618fb4bd40b00c1 /ext/resindvd/gstmpegdemux.c
parent62db462298d2c4332a53e52648c7925ce6843332 (diff)
downloadgst-plugins-bad-eedf3131564c59e1c026cba7ab104c31df2fb6db.tar.gz
gst-plugins-bad-eedf3131564c59e1c026cba7ab104c31df2fb6db.tar.bz2
gst-plugins-bad-eedf3131564c59e1c026cba7ab104c31df2fb6db.zip
resindvd: Map audio and subpicture logical streams to physical.
The logical audio and subpicture stream number doesn't always correspond with the physical substream it is coming from. When configuring the demuxer pads, use the mapping table provided in each PGC to get the layout and ensure the demuxer creates the correct pads.
Diffstat (limited to 'ext/resindvd/gstmpegdemux.c')
-rw-r--r--ext/resindvd/gstmpegdemux.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/ext/resindvd/gstmpegdemux.c b/ext/resindvd/gstmpegdemux.c
index bee7f43f..cc37ec4e 100644
--- a/ext/resindvd/gstmpegdemux.c
+++ b/ext/resindvd/gstmpegdemux.c
@@ -622,11 +622,17 @@ gst_flups_demux_handle_dvd_event (GstFluPSDemux * demux, GstEvent * event)
if (!gst_structure_get_int (structure, cur_stream_name, &stream_format))
continue;
+ g_snprintf (cur_stream_name, 32, "audio-%d-stream", i);
+ if (!gst_structure_get_int (structure, cur_stream_name, &stream_id))
+ continue;
+ if (stream_id < 0 || stream_id >= MAX_DVD_AUDIO_STREAMS)
+ continue;
+
demux->audio_stream_types[i] = stream_format;
switch (stream_format) {
case 0x0:
/* AC3 */
- stream_id = 0x80 + i;
+ stream_id += 0x80;
GST_DEBUG_OBJECT (demux,
"Audio stream %d format %d ID 0x%02x - AC3", i,
stream_format, stream_id);
@@ -636,7 +642,7 @@ gst_flups_demux_handle_dvd_event (GstFluPSDemux * demux, GstEvent * event)
case 0x3:
/* MPEG audio without and with extension stream are
* treated the same */
- stream_id = 0xC0 + i;
+ stream_id += 0xC0;
GST_DEBUG_OBJECT (demux,
"Audio stream %d format %d ID 0x%02x - MPEG audio", i,
stream_format, stream_id);
@@ -644,7 +650,7 @@ gst_flups_demux_handle_dvd_event (GstFluPSDemux * demux, GstEvent * event)
break;
case 0x4:
/* LPCM */
- stream_id = 0xA0 + i;
+ stream_id += 0xA0;
GST_DEBUG_OBJECT (demux,
"Audio stream %d format %d ID 0x%02x - DVD LPCM", i,
stream_format, stream_id);
@@ -653,7 +659,7 @@ gst_flups_demux_handle_dvd_event (GstFluPSDemux * demux, GstEvent * event)
break;
case 0x6:
/* DTS */
- stream_id = 0x88 + i;
+ stream_id += 0x88;
GST_DEBUG_OBJECT (demux,
"Audio stream %d format %d ID 0x%02x - DTS", i,
stream_format, stream_id);
@@ -673,16 +679,23 @@ gst_flups_demux_handle_dvd_event (GstFluPSDemux * demux, GstEvent * event)
/* And subtitle streams */
for (i = 0; i < MAX_DVD_SUBPICTURE_STREAMS; i++) {
gint stream_format;
+ gint stream_id;
g_snprintf (cur_stream_name, 32, "subpicture-%d-format", i);
-
if (!gst_structure_get_int (structure, cur_stream_name, &stream_format))
continue;
+ g_snprintf (cur_stream_name, 32, "subpicture-%d-stream", i);
+ if (!gst_structure_get_int (structure, cur_stream_name, &stream_id))
+ continue;
+ if (stream_id < 0 || stream_id >= MAX_DVD_SUBPICTURE_STREAMS)
+ continue;
+
GST_DEBUG_OBJECT (demux, "Subpicture stream %d ID 0x%02x", i, 0x20 + i);
/* Retrieve the subpicture stream to force pad creation */
- temp = gst_flups_demux_get_stream (demux, 0x20 + i, ST_PS_DVD_SUBPICTURE);
+ temp = gst_flups_demux_get_stream (demux, 0x20 + stream_id,
+ ST_PS_DVD_SUBPICTURE);
}
GST_DEBUG_OBJECT (demux, "Created all pads from Language Codes event, "