From: Wim Taymans Date: Mon, 1 Aug 2011 16:12:12 +0000 (+0200) Subject: bufferpool: don't add the same option twice X-Git-Tag: RELEASE-0.11.0~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9324824853b0bb7e5680098e706c61353ece2ced;p=platform%2Fupstream%2Fgstreamer.git bufferpool: don't add the same option twice Make sure that we only add an option to the array once. --- diff --git a/gst/gstbufferpool.c b/gst/gstbufferpool.c index de6c6be..19a0ee4 100644 --- a/gst/gstbufferpool.c +++ b/gst/gstbufferpool.c @@ -599,6 +599,7 @@ gst_buffer_pool_config_add_option (GstStructure * config, const gchar * option) GValueArray *array; const GValue *value; GValue option_value = { 0 }; + gint i; g_return_if_fail (config != NULL); @@ -615,7 +616,11 @@ gst_buffer_pool_config_add_option (GstStructure * config, const gchar * option) gst_structure_id_take_value (config, GST_QUARK (OPTIONS), &new_array_val); } - + for (i = 0; i < array->n_values; i++) { + value = g_value_array_get_nth (array, i); + if (g_str_equal (option, g_value_get_string (value))) + return; + } g_value_init (&option_value, G_TYPE_STRING); g_value_set_string (&option_value, option); g_value_array_append (array, &option_value); @@ -705,7 +710,7 @@ gst_buffer_pool_config_has_option (GstStructure * config, const gchar * option) array = (GValueArray *) g_value_get_boxed (value); for (i = 0; i < array->n_values; i++) { option_value = g_value_array_get_nth (array, i); - if (!strcmp (option, g_value_get_string (option_value))) + if (g_str_equal (option, g_value_get_string (option_value))) return TRUE; } }