summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2001-06-20 20:49:13 +0000
committerWim Taymans <wim.taymans@gmail.com>2001-06-20 20:49:13 +0000
commitafcfcf88cafdbe3058efd3a1b4c7dd0262cd8789 (patch)
tree9f8664d2c9508205d8249350c4d76b55b1d7efeb
parent7f55c0b5323214e2bed0492e179b6e5482ed4e9c (diff)
Added object properties introspection.
Original commit message from CVS: Added object properties introspection.
-rw-r--r--tools/gstreamer-inspect.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/tools/gstreamer-inspect.c b/tools/gstreamer-inspect.c
index 356c44340..01c388aa8 100644
--- a/tools/gstreamer-inspect.c
+++ b/tools/gstreamer-inspect.c
@@ -254,17 +254,27 @@ print_element_info (GstElementFactory *factory)
} else
printf(" none\n");
+#ifdef USE_GLIB2
// FIXME accessing private data of GObjectClass !!!
num_properties = G_OBJECT_GET_CLASS (element)->n_property_specs;
property_specs = G_OBJECT_GET_CLASS (element)->property_specs;
- if (num_properties)
- printf("\nElement Arguments:\n");
- else
- printf("\nNo Element Arguments.\n");
+#else
+ property_specs = (GParamSpec **)gtk_object_query_args (GTK_OBJECT_TYPE (element), &flags, &num_properties);
+#endif
+ printf("\nElement Arguments:\n");
for (i=0;i<num_properties;i++) {
- GParamSpec *param = property_specs[i];
GValue value = { 0, };
+#ifdef USE_GLIB2
+ GParamSpec *param = property_specs[i];
+#else
+ // gtk doesn't have a paramspec, so we create one here
+ GParamSpec rparm, *param = &rparm;
+ GtkArg *args = (GtkArg *)property_specs; // ugly typecast here
+
+ param->value_type = args[i].type;
+ param->name = args[i].name;
+#endif
g_value_init (&value, param->value_type);
g_object_get_property (G_OBJECT (element), param->name, &value);
@@ -282,15 +292,17 @@ print_element_info (GstElementFactory *factory)
default:
if (param->value_type == GST_TYPE_FILENAME)
printf("Filename");
- else if (G_TYPE_IS_ENUM (param->value_type)) {
+ else if (G_IS_PARAM_SPEC_ENUM (param)) {
GEnumValue *values;
- GEnumClass *ec = G_ENUM_CLASS (g_type_class_ref (param->value_type));
guint j = 0;
printf("Enum \"%s\" (default %d)", g_type_name (G_VALUE_TYPE (&value)),
g_value_get_enum (&value));
-
- values = ec->values;
+#ifdef USE_GLIB2
+ values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values;
+#else
+ values = gtk_type_enum_get_values (param->value_type);
+#endif
while (values[j].value_name) {
printf("\n (%d): \t%s", values[j].value, values[j].value_nick);
j++;
@@ -305,10 +317,9 @@ print_element_info (GstElementFactory *factory)
}
/*
g_free (args);
- if (num_args == 0) g_print (" none");
- printf("\n");
-
*/
+ if (num_properties == 0) g_print (" none");
+ printf("\n");
// for compound elements