From fe9041bd056351d561b6fb20d09480c3db40a4e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 16 Apr 2012 08:27:20 +0200 Subject: [PATCH] decodebin2: Check that properties have the correct type before using them --- gst/playback/gstdecodebin2.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 46ff1f257c..b2cb4eee61 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -1770,6 +1770,7 @@ connect_pad (GstDecodeBin * dbin, GstElement * src, GstDecodePad * dpad, GstDecodeElement *delem; GstElement *element; GstPad *sinkpad; + GParamSpec *pspec; gboolean subtitle; /* Set dpad target to pad again, it might've been unset @@ -1948,8 +1949,9 @@ connect_pad (GstDecodeBin * dbin, GstElement * src, GstDecodePad * dpad, connect_element (dbin, element, chain); /* try to configure the subtitle encoding property when we can */ - if (g_object_class_find_property (G_OBJECT_GET_CLASS (element), - "subtitle-encoding")) { + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (element), + "subtitle-encoding"); + if (pspec && G_PARAM_SPEC_VALUE_TYPE (pspec) == G_TYPE_STRING) { SUBTITLE_LOCK (dbin); GST_DEBUG_OBJECT (dbin, "setting subtitle-encoding=%s to element", dbin->encoding); @@ -1957,8 +1959,9 @@ connect_pad (GstDecodeBin * dbin, GstElement * src, GstDecodePad * dpad, NULL); SUBTITLE_UNLOCK (dbin); subtitle = TRUE; - } else + } else { subtitle = FALSE; + } /* Bring the element to the state of the parent */ if ((gst_element_set_state (element,