uridecodebin: Check that properties have the correct type before using them

This commit is contained in:
Sebastian Dröge 2012-04-16 08:24:58 +02:00
parent 91b8f10a92
commit 15d92392b5

View file

@ -1235,10 +1235,13 @@ gen_source_element (GstURIDecodeBin * decoder)
/* make HTTP sources send extra headers so we get icecast
* metadata in case the stream is an icecast stream */
if (!strncmp (decoder->uri, "http://", 7) &&
g_object_class_find_property (source_class, "iradio-mode")) {
GST_LOG_OBJECT (decoder, "configuring iradio-mode");
g_object_set (source, "iradio-mode", TRUE, NULL);
if (!strncmp (decoder->uri, "http://", 7)) {
pspec = g_object_class_find_property (source_class, "iradio-mode");
if (pspec && G_PARAM_SPEC_VALUE_TYPE (pspec) == G_TYPE_STRING) {
GST_LOG_OBJECT (decoder, "configuring iradio-mode");
g_object_set (source, "iradio-mode", TRUE, NULL);
}
}
pspec = g_object_class_find_property (source_class, "connection-speed");
@ -2014,9 +2017,11 @@ is_live_source (GstElement * source)
{
GObjectClass *source_class = NULL;
gboolean is_live = FALSE;
GParamSpec *pspec;
source_class = G_OBJECT_GET_CLASS (source);
if (!g_object_class_find_property (source_class, "is-live"))
pspec = g_object_class_find_property (source_class, "is-live");
if (!pspec || G_PARAM_SPEC_VALUE_TYPE (pspec) != G_TYPE_BOOLEAN)
return FALSE;
g_object_get (G_OBJECT (source), "is-live", &is_live, NULL);