From 69d98d08c193c5ee21775b0cc8ef6b0a6c6d0089 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Mon, 17 Oct 2011 17:29:50 +0000 Subject: [PATCH] playsink: only compare against the media type we expect ie, audio/x-raw- for audio, video/x-raw- for video. Add a trailing - to be more specific. I doubt there's anything like audio/x-rawhide or something, but you never know. https://bugzilla.gnome.org/show_bug.cgi?id=661262 --- gst/playback/gstplaysinkconvertbin.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gst/playback/gstplaysinkconvertbin.c b/gst/playback/gstplaysinkconvertbin.c index cfd8dc8b79..6a78ef4118 100644 --- a/gst/playback/gstplaysinkconvertbin.c +++ b/gst/playback/gstplaysinkconvertbin.c @@ -45,18 +45,18 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_CAPS_ANY); static gboolean -is_raw_caps (GstCaps * caps) +is_raw_caps (GstCaps * caps, gboolean audio) { gint i, n; GstStructure *s; const gchar *name; + const gchar *prefix = audio ? "audio/x-raw-" : "video/x-raw-"; n = gst_caps_get_size (caps); for (i = 0; i < n; i++) { s = gst_caps_get_structure (caps, i); name = gst_structure_get_name (s); - if (!g_str_has_prefix (name, "audio/x-raw") - && !g_str_has_prefix (name, "video/x-raw")) + if (!g_str_has_prefix (name, prefix)) return FALSE; } @@ -200,7 +200,7 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkConvertBin * self) caps = gst_pad_get_caps_reffed (peer); gst_object_unref (peer); - raw = is_raw_caps (caps); + raw = is_raw_caps (caps, self->audio); GST_DEBUG_OBJECT (self, "Caps %" GST_PTR_FORMAT " are raw: %d", caps, raw); gst_caps_unref (caps);