[gst-cvs] gst-plugins-bad: resindvd: Create all the audio streams of all formats
Jan Schmidt
thaytan at kemper.freedesktop.org
Wed May 27 15:16:29 PDT 2009
Module: gst-plugins-bad
Branch: master
Commit: 4d5a48db9779ac1ff4cfda42a5180f8bc1462882
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=4d5a48db9779ac1ff4cfda42a5180f8bc1462882
Author: Jan Schmidt <thaytan at noraisin.net>
Date: Wed May 27 22:54:51 2009 +0100
resindvd: Create all the audio streams of all formats
Enable creation of the demuxer pads for all audio streams, even types we
don't yet support. This means that unsupported types (LPCM, DTS) are output,
but not linked to anything yet. If only unsupported streams are available,
the user hears silence instead of having the pipeline not pre-roll correctly.
This is a prerequisite for hooking up the automatic decoder switching.
---
ext/resindvd/gstmpegdemux.c | 17 +++++++++++------
ext/resindvd/gstmpegdemux.h | 1 +
ext/resindvd/resindvdsrc.c | 7 ++++---
ext/resindvd/rsnaudiomunge.c | 5 ++++-
4 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/ext/resindvd/gstmpegdemux.c b/ext/resindvd/gstmpegdemux.c
index 5ab2610..d9aefe5 100644
--- a/ext/resindvd/gstmpegdemux.c
+++ b/ext/resindvd/gstmpegdemux.c
@@ -356,7 +356,7 @@ gst_flups_demux_get_stream (GstFluPSDemux * demux, gint id, gint type)
{
GstFluPSStream *stream = demux->streams[id];
- if (stream == NULL) {
+ if (stream == NULL && !demux->disable_stream_creation) {
if (!(stream = gst_flups_demux_create_stream (demux, id, type)))
goto unknown_stream;
@@ -612,6 +612,8 @@ gst_flups_demux_handle_dvd_event (GstFluPSDemux * demux, GstEvent * event)
GST_DEBUG_OBJECT (demux, "Handling language codes event");
+ demux->disable_stream_creation = FALSE;
+
/* Create a video pad to ensure it exists before emitting no more pads */
temp = gst_flups_demux_get_stream (demux, 0xe0, ST_VIDEO_MPEG2);
/* Send a video format event downstream */
@@ -719,6 +721,8 @@ gst_flups_demux_handle_dvd_event (GstFluPSDemux * demux, GstEvent * event)
ST_PS_DVD_SUBPICTURE);
}
+ demux->disable_stream_creation = TRUE;
+
GST_DEBUG_OBJECT (demux, "Created all pads from Language Codes event, "
"signalling no-more-pads");
@@ -767,32 +771,33 @@ gst_flups_demux_handle_dvd_event (GstFluPSDemux * demux, GstEvent * event)
stream_id += 0x80;
temp = demux->streams[stream_id];
break;
-#if 0 /* FIXME: Ignore non AC-3 requests until the decoder bin can handle them */
case 0x2:
case 0x3:
/* MPEG audio without and with extension stream are
* treated the same */
- stream_id = 0xC0 + i;
+ stream_id += 0xC0;
temp = demux->streams[stream_id];
break;
case 0x4:
/* LPCM */
- stream_id = 0xA0 + i;
+ stream_id += 0xA0;
temp = demux->streams[stream_id];
break;
case 0x6:
/* DTS */
- stream_id = 0x88 + i;
+ stream_id += 0x88;
temp = demux->streams[stream_id];
break;
case 0x7:
/* FIXME: What range is SDDS? */
+ temp = NULL;
break;
-#endif
default:
temp = NULL;
break;
}
+ GST_INFO_OBJECT (demux, "Have DVD audio stream select event: "
+ "stream 0x%02x", stream_id);
if (temp != NULL && temp->pad != NULL) {
/* Send event to the selector to activate the desired pad */
GstStructure *s = gst_structure_new ("application/x-gst-dvd",
diff --git a/ext/resindvd/gstmpegdemux.h b/ext/resindvd/gstmpegdemux.h
index 683b7cd..f629150 100644
--- a/ext/resindvd/gstmpegdemux.h
+++ b/ext/resindvd/gstmpegdemux.h
@@ -106,6 +106,7 @@ struct _GstFluPSDemux {
/* Indicates an MPEG-2 stream */
gboolean is_mpeg2_pack;
+ gboolean disable_stream_creation;
/* Language codes event is stored when a dvd-lang-codes
* custom event arrives from upstream */
diff --git a/ext/resindvd/resindvdsrc.c b/ext/resindvd/resindvdsrc.c
index f24e45a..122f2b6 100644
--- a/ext/resindvd/resindvdsrc.c
+++ b/ext/resindvd/resindvdsrc.c
@@ -1882,7 +1882,7 @@ rsn_dvdsrc_prepare_streamsinfo_event (resinDvdSrc * src)
GST_DEBUG_OBJECT (src, "mapped logical audio %d to MPEG substream %d",
i, phys_id);
-#if 1
+#if 0
/* FIXME: Only output A52 streams for now, until the decoder switching
* is ready */
if (a->audio_format != 0) {
@@ -1891,7 +1891,8 @@ rsn_dvdsrc_prepare_streamsinfo_event (resinDvdSrc * src)
continue;
}
#endif
- have_audio = TRUE;
+ if (a->audio_format == 0)
+ have_audio = TRUE;
GST_DEBUG_OBJECT (src, "Audio stream %d is format %d, substream %d", i,
(int) a->audio_format, phys_id);
@@ -1917,7 +1918,7 @@ rsn_dvdsrc_prepare_streamsinfo_event (resinDvdSrc * src)
}
if (have_audio == FALSE) {
- /* Always create at least one audio stream */
+ /* Always create at least one audio stream of the required type */
gst_structure_set (s, "audio-0-format", G_TYPE_INT, (int) 0,
"audio-0-stream", G_TYPE_INT, (int) 0, NULL);
}
diff --git a/ext/resindvd/rsnaudiomunge.c b/ext/resindvd/rsnaudiomunge.c
index 50d33be..fda2a96 100644
--- a/ext/resindvd/rsnaudiomunge.c
+++ b/ext/resindvd/rsnaudiomunge.c
@@ -200,10 +200,13 @@ rsn_audiomunge_make_audio (RsnAudioMunge * munge,
guint buf_size;
/* Just generate a 48khz stereo buffer for now */
+ /* FIXME: Adapt to the allowed formats, according to the currently
+ * plugged decoder, or at least add a source pad that accepts the
+ * caps we're outputting if the upstream decoder does not */
#if 0
caps =
gst_caps_from_string
- ("audio/x-raw-int,rate=48000,channels=2,width=16,depth=16,signed=(boolean)true,endianness=1234");
+ ("audio/x-raw-int,rate=48000,channels=2,width=16,depth=16,signed=(boolean)true,endianness=4321");
buf_size = 4 * (48000 * fill_time / GST_SECOND);
#else
caps = gst_caps_from_string ("audio/x-raw-float, endianness=(int)1234,"
More information about the Gstreamer-commits
mailing list