mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-24 15:06:38 +00:00
Added object properties introspection.
Original commit message from CVS: Added object properties introspection.
This commit is contained in:
parent
7f55c0b532
commit
afcfcf88ca
1 changed files with 23 additions and 12 deletions
|
@ -254,17 +254,27 @@ print_element_info (GstElementFactory *factory)
|
||||||
} else
|
} else
|
||||||
printf(" none\n");
|
printf(" none\n");
|
||||||
|
|
||||||
|
#ifdef USE_GLIB2
|
||||||
// FIXME accessing private data of GObjectClass !!!
|
// FIXME accessing private data of GObjectClass !!!
|
||||||
num_properties = G_OBJECT_GET_CLASS (element)->n_property_specs;
|
num_properties = G_OBJECT_GET_CLASS (element)->n_property_specs;
|
||||||
property_specs = G_OBJECT_GET_CLASS (element)->property_specs;
|
property_specs = G_OBJECT_GET_CLASS (element)->property_specs;
|
||||||
if (num_properties)
|
#else
|
||||||
printf("\nElement Arguments:\n");
|
property_specs = (GParamSpec **)gtk_object_query_args (GTK_OBJECT_TYPE (element), &flags, &num_properties);
|
||||||
else
|
#endif
|
||||||
printf("\nNo Element Arguments.\n");
|
printf("\nElement Arguments:\n");
|
||||||
|
|
||||||
for (i=0;i<num_properties;i++) {
|
for (i=0;i<num_properties;i++) {
|
||||||
GParamSpec *param = property_specs[i];
|
|
||||||
GValue value = { 0, };
|
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_value_init (&value, param->value_type);
|
||||||
g_object_get_property (G_OBJECT (element), param->name, &value);
|
g_object_get_property (G_OBJECT (element), param->name, &value);
|
||||||
|
@ -282,15 +292,17 @@ print_element_info (GstElementFactory *factory)
|
||||||
default:
|
default:
|
||||||
if (param->value_type == GST_TYPE_FILENAME)
|
if (param->value_type == GST_TYPE_FILENAME)
|
||||||
printf("Filename");
|
printf("Filename");
|
||||||
else if (G_TYPE_IS_ENUM (param->value_type)) {
|
else if (G_IS_PARAM_SPEC_ENUM (param)) {
|
||||||
GEnumValue *values;
|
GEnumValue *values;
|
||||||
GEnumClass *ec = G_ENUM_CLASS (g_type_class_ref (param->value_type));
|
|
||||||
guint j = 0;
|
guint j = 0;
|
||||||
|
|
||||||
printf("Enum \"%s\" (default %d)", g_type_name (G_VALUE_TYPE (&value)),
|
printf("Enum \"%s\" (default %d)", g_type_name (G_VALUE_TYPE (&value)),
|
||||||
g_value_get_enum (&value));
|
g_value_get_enum (&value));
|
||||||
|
#ifdef USE_GLIB2
|
||||||
values = ec->values;
|
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) {
|
while (values[j].value_name) {
|
||||||
printf("\n (%d): \t%s", values[j].value, values[j].value_nick);
|
printf("\n (%d): \t%s", values[j].value, values[j].value_nick);
|
||||||
j++;
|
j++;
|
||||||
|
@ -305,10 +317,9 @@ print_element_info (GstElementFactory *factory)
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
g_free (args);
|
g_free (args);
|
||||||
if (num_args == 0) g_print (" none");
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
if (num_properties == 0) g_print (" none");
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
|
||||||
// for compound elements
|
// for compound elements
|
||||||
|
|
Loading…
Reference in a new issue