summaryrefslogtreecommitdiff
path: root/ext/resindvd/rsndec.c
diff options
context:
space:
mode:
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2012-01-20 15:34:27 +0000
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2012-01-23 11:04:26 +0000
commit1c0ccc45f458a2a3e9dbe49cc2084fbcb3f10267 (patch)
tree4b645519095689b8cb45b18a49f2c32c953a6c14 /ext/resindvd/rsndec.c
parent27eb76bf45112263452b7b47cecd75022d480835 (diff)
downloadgstreamer-plugins-bad-1c0ccc45f458a2a3e9dbe49cc2084fbcb3f10267.tar.gz
resindvd: fix preroll on titles with no audio track
https://bugzilla.gnome.org/show_bug.cgi?id=599469
Diffstat (limited to 'ext/resindvd/rsndec.c')
-rw-r--r--ext/resindvd/rsndec.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/ext/resindvd/rsndec.c b/ext/resindvd/rsndec.c
index 8d7e3806c..e82664057 100644
--- a/ext/resindvd/rsndec.c
+++ b/ext/resindvd/rsndec.c
@@ -247,14 +247,44 @@ _get_decoder_factories (gpointer arg)
GstPadTemplate *templ = gst_element_class_get_pad_template (klass,
"sink");
RsnDecFactoryFilterCtx ctx = { NULL, };
+ GstCaps *raw;
+ gboolean raw_audio;
ctx.desired_caps = gst_pad_template_get_caps (templ);
+
+ raw = gst_caps_from_string ("audio/x-raw-float");
+ raw_audio = gst_caps_can_intersect (raw, ctx.desired_caps);
+ if (raw_audio) {
+ GstCaps *sub = gst_caps_subtract (ctx.desired_caps, raw);
+ gst_caps_unref (ctx.desired_caps);
+ ctx.desired_caps = sub;
+ }
+ gst_caps_unref (raw);
+
/* Set decoder caps to empty. Will be filled by the factory_filter */
ctx.decoder_caps = gst_caps_new_empty ();
+ GST_DEBUG ("Finding factories for caps: %" GST_PTR_FORMAT, ctx.desired_caps);
factories = gst_default_registry_feature_filter (
(GstPluginFeatureFilter) rsndec_factory_filter, FALSE, &ctx);
+ /* If these are audio caps, we add audioconvert, which is not a decoder,
+ but allows raw audio to go through relatively unmolested - this will
+ come handy when we have to send placeholder silence to allow preroll
+ for those DVDs which have titles with no audio track. */
+ if (raw_audio) {
+ GstPluginFeature *feature;
+ GST_DEBUG ("These are audio caps, adding audioconvert");
+ feature =
+ gst_default_registry_find_feature ("audioconvert",
+ GST_TYPE_ELEMENT_FACTORY);
+ if (feature) {
+ factories = g_list_append (factories, feature);
+ } else {
+ GST_WARNING ("Could not find feature audioconvert");
+ }
+ }
+
factories = g_list_sort (factories, (GCompareFunc) sort_by_ranks);
GST_DEBUG ("Available decoder caps %" GST_PTR_FORMAT, ctx.decoder_caps);
@@ -343,7 +373,7 @@ static GstStaticPadTemplate audio_sink_template =
GST_STATIC_CAPS ("audio/mpeg,mpegversion=(int)1;"
"audio/x-private1-lpcm;"
"audio/x-private1-ac3;" "audio/ac3;" "audio/x-ac3;"
- "audio/x-private1-dts;")
+ "audio/x-private1-dts; audio/x-raw-float")
);
static GstStaticPadTemplate audio_src_template = GST_STATIC_PAD_TEMPLATE ("src",