mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-06-16 04:50:38 +00:00
added shim for g_object_class_list_properties and converted -inspect and -compprep to use it
Original commit message from CVS: added shim for g_object_class_list_properties and converted -inspect and -compprep to use it
This commit is contained in:
parent
01e05ff187
commit
764caf7717
|
@ -108,6 +108,28 @@ g_object_class_find_property(GtkObjectClass *class,gchar *name)
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GParamSpec **
|
||||||
|
g_object_class_list_properties(GtkObjectClass *oclass,guint *n_properties) {
|
||||||
|
GType type = G_OBJECT_CLASS_TYPE (oclass);
|
||||||
|
guint32 *flags;
|
||||||
|
GtkArg *args;
|
||||||
|
gint num_args;
|
||||||
|
GParamSpec **params;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
args = gtk_object_query_args (type, &flags, &num_args);
|
||||||
|
|
||||||
|
params = g_new0(GParamSpec *,num_args);
|
||||||
|
for (i=0;i<num_args;i++) {
|
||||||
|
params[i] = g_new0(GParamSpec,1);
|
||||||
|
params[i]->name = args[i].name;
|
||||||
|
params[i]->value_type = args[i].type;
|
||||||
|
params[i]->flags = flags[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
GParamSpec *
|
GParamSpec *
|
||||||
g_param_spec_boolean(gchar *name,gchar *nick,gchar *blurb,gboolean def,gint flags) {
|
g_param_spec_boolean(gchar *name,gchar *nick,gchar *blurb,gboolean def,gint flags) {
|
||||||
GParamSpec *spec = g_new(GParamSpec,1);
|
GParamSpec *spec = g_new(GParamSpec,1);
|
||||||
|
|
|
@ -189,6 +189,7 @@ struct _GParamSpec {
|
||||||
|
|
||||||
void g_object_class_install_property(GtkObjectClass *oclass,guint property_id,GParamSpec *pspec);
|
void g_object_class_install_property(GtkObjectClass *oclass,guint property_id,GParamSpec *pspec);
|
||||||
GParamSpec *g_object_class_find_property(GtkObjectClass *oclass,gchar *name);
|
GParamSpec *g_object_class_find_property(GtkObjectClass *oclass,gchar *name);
|
||||||
|
GParamSpec **g_object_class_list_properties(GtkObjectClass *oclass,guint *n_properties);
|
||||||
|
|
||||||
#define G_IS_PARAM_SPEC_ENUM(pspec) (GTK_FUNDAMENTAL_TYPE(pspec->value_type) == GTK_TYPE_ENUM)
|
#define G_IS_PARAM_SPEC_ENUM(pspec) (GTK_FUNDAMENTAL_TYPE(pspec->value_type) == GTK_TYPE_ENUM)
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ int main(int argc,char *argv[]) {
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
GstPadTemplate *padtemplate;
|
GstPadTemplate *padtemplate;
|
||||||
GParamSpec **property_specs;
|
GParamSpec **property_specs;
|
||||||
guint32 *flags;
|
|
||||||
gint num_properties,i;
|
gint num_properties,i;
|
||||||
|
|
||||||
gst_debug_set_categories(0);
|
gst_debug_set_categories(0);
|
||||||
|
@ -64,24 +63,9 @@ int main(int argc,char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// write out the args
|
// write out the args
|
||||||
#ifdef USE_GLIB2
|
property_specs = g_object_class_list_properties(G_OBJECT_GET_CLASS (element), &num_properties);
|
||||||
// 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;
|
|
||||||
#else
|
|
||||||
property_specs = (GParamSpec **)gtk_object_query_args (GTK_OBJECT_TYPE (element), &flags, &num_properties);
|
|
||||||
#endif
|
|
||||||
for (i=0;i<num_properties;i++) {
|
for (i=0;i<num_properties;i++) {
|
||||||
#ifdef USE_GLIB2
|
|
||||||
GParamSpec *param = property_specs[i];
|
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
|
|
||||||
argnode = xmlNewChild (factorynode, NULL, "argument", param->name);
|
argnode = xmlNewChild (factorynode, NULL, "argument", param->name);
|
||||||
if (param->value_type == GST_TYPE_FILENAME) {
|
if (param->value_type == GST_TYPE_FILENAME) {
|
||||||
xmlNewChild (argnode, NULL, "filename", NULL);
|
xmlNewChild (argnode, NULL, "filename", NULL);
|
||||||
|
|
|
@ -80,7 +80,6 @@ print_element_info (GstElementFactory *factory)
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
GstRealPad *realpad;
|
GstRealPad *realpad;
|
||||||
GstPadTemplate *padtemplate;
|
GstPadTemplate *padtemplate;
|
||||||
guint32 *flags;
|
|
||||||
gint num_properties,i;
|
gint num_properties,i;
|
||||||
GParamSpec **property_specs;
|
GParamSpec **property_specs;
|
||||||
GList *children;
|
GList *children;
|
||||||
|
@ -254,27 +253,12 @@ print_element_info (GstElementFactory *factory)
|
||||||
} else
|
} else
|
||||||
printf(" none\n");
|
printf(" none\n");
|
||||||
|
|
||||||
#ifdef USE_GLIB2
|
property_specs = g_object_class_list_properties(G_OBJECT_GET_CLASS (element), &num_properties);
|
||||||
// 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;
|
|
||||||
#else
|
|
||||||
property_specs = (GParamSpec **)gtk_object_query_args (GTK_OBJECT_TYPE (element), &flags, &num_properties);
|
|
||||||
#endif
|
|
||||||
printf("\nElement Arguments:\n");
|
printf("\nElement Arguments:\n");
|
||||||
|
|
||||||
for (i=0;i<num_properties;i++) {
|
for (i=0;i<num_properties;i++) {
|
||||||
GValue value = { 0, };
|
GValue value = { 0, };
|
||||||
#ifdef USE_GLIB2
|
|
||||||
GParamSpec *param = property_specs[i];
|
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);
|
||||||
|
|
Loading…
Reference in a new issue