summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Crête <olivier.crete@collabora.co.uk>2008-10-23 03:59:27 (GMT)
committerOlivier Crête <olivier.crete@collabora.co.uk>2008-10-23 03:59:27 (GMT)
commit8ebb8f22069e121dbb771226fb816c0acf6e09c3 (patch)
treea95e351cc420ab8658c603c004f8f092cc386eb3
parentf4d60c2c8b34c51b094ab314b0811bdc45455255 (diff)
downloadgst-plugins-farsight-tester-selector-text-choices.tar.gz
gst-plugins-farsight-tester-selector-text-choices.tar.xz
Make it possible to set the factories from a text fieldselector-text-choices
-rw-r--r--gst/selector/fsselector.c65
1 files changed, 64 insertions, 1 deletions
diff --git a/gst/selector/fsselector.c b/gst/selector/fsselector.c
index 5b8a532..92c16b5 100644
--- a/gst/selector/fsselector.c
+++ b/gst/selector/fsselector.c
@@ -70,6 +70,7 @@ enum
{
PROP_0,
PROP_FACTORIES,
+ PROP_FACTORIES_TEXT
};
@@ -168,6 +169,14 @@ fs_selector_class_init (FsSelectorClass *klass)
" elements), can only be set once",
G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, PROP_FACTORIES_TEXT,
+ g_param_spec_string ("factories-text",
+ "comma separated list of elements",
+ "Comma separated list of elements to pick from, can only be set once."
+ " This is the same as the \"factories\" property",
+ "",
+ G_PARAM_READWRITE));
+
parent_class = g_type_class_peek_parent (klass);
internal_srcpad_quark = g_quark_from_static_string ("internal_srcpad");
@@ -245,6 +254,34 @@ fs_selector_set_property (GObject *object,
" have been set or auto-discovered");
GST_OBJECT_UNLOCK (fsselector);
break;
+ case PROP_FACTORIES_TEXT:
+ GST_OBJECT_LOCK (fsselector);
+ if (fsselector->factories == NULL) {
+ gchar **strings = g_strsplit (g_value_get_string (value), ",", 0);
+ gint i;
+
+ for (i=0; strings[i]; i++) {
+ GstElementFactory *factory = NULL;
+
+ g_strstrip(strings[i]);
+
+ if (!strlen (strings[i]))
+ continue;
+
+ factory = gst_element_factory_find (strings[i]);
+
+ if (factory)
+ fsselector->factories = g_list_append (fsselector->factories,
+ factory);
+ }
+
+ g_strfreev (strings);
+ }
+ else
+ GST_WARNING_OBJECT (object, "Can not reset factories after they"
+ " have been set or auto-discovered");
+ GST_OBJECT_UNLOCK (fsselector);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -263,10 +300,36 @@ fs_selector_get_property (GObject *object,
g_value_set_pointer (value, &fsselector->factories);
GST_OBJECT_UNLOCK (fsselector);
break;
+ case PROP_FACTORIES_TEXT:
+ GST_OBJECT_LOCK (fsselector);
+ {
+ GString *string = NULL;
+ GList *item;
+
+ for (item = fsselector->factories; item; item = item->next)
+ {
+ if (!string)
+ string = g_string_new ("");
+ else
+ g_string_append (string,",");
+
+ g_string_append (string,
+ gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (item->data)));
+ }
+
+ if (string) {
+ g_value_take_string (value, string->str);
+ g_string_free (string, FALSE);
+ }
+ else {
+ g_value_set_static_string (value, "");
+ }
+ }
+ GST_OBJECT_UNLOCK (fsselector);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
-
}
}