mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
tools: gst-inspect: print pad properties where we know the subclass type
This commit is contained in:
parent
b60d869b22
commit
8cc7c3f6aa
2 changed files with 41 additions and 10 deletions
|
@ -217,6 +217,7 @@ gst_pad_template_init (GstPadTemplate * templ)
|
||||||
{
|
{
|
||||||
/* GstPadTemplate objects are usually leaked */
|
/* GstPadTemplate objects are usually leaked */
|
||||||
GST_OBJECT_FLAG_SET (templ, GST_OBJECT_FLAG_MAY_BE_LEAKED);
|
GST_OBJECT_FLAG_SET (templ, GST_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||||
|
GST_PAD_TEMPLATE_GTYPE (templ) = G_TYPE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -269,24 +269,30 @@ flags_to_string (GFlagsValue * vals, guint flags)
|
||||||
GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING | \
|
GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING | \
|
||||||
GST_PARAM_MUTABLE_PAUSED | GST_PARAM_MUTABLE_READY)
|
GST_PARAM_MUTABLE_PAUSED | GST_PARAM_MUTABLE_READY)
|
||||||
|
|
||||||
|
/* obj will be NULL if we're printing properties of pad template pads */
|
||||||
static void
|
static void
|
||||||
print_element_properties_info (GstElement * element)
|
print_object_properties_info (GObject * obj, GObjectClass * obj_class,
|
||||||
|
const gchar * desc)
|
||||||
{
|
{
|
||||||
GParamSpec **property_specs;
|
GParamSpec **property_specs;
|
||||||
guint num_properties, i;
|
guint num_properties, i;
|
||||||
gboolean readable;
|
gboolean readable;
|
||||||
gboolean first_flag;
|
gboolean first_flag;
|
||||||
|
|
||||||
property_specs = g_object_class_list_properties
|
property_specs = g_object_class_list_properties (obj_class, &num_properties);
|
||||||
(G_OBJECT_GET_CLASS (element), &num_properties);
|
n_print ("%s:\n", desc);
|
||||||
n_print ("\n");
|
|
||||||
n_print ("Element Properties:\n");
|
|
||||||
|
|
||||||
push_indent ();
|
push_indent ();
|
||||||
|
|
||||||
for (i = 0; i < num_properties; i++) {
|
for (i = 0; i < num_properties; i++) {
|
||||||
GValue value = { 0, };
|
GValue value = { 0, };
|
||||||
GParamSpec *param = property_specs[i];
|
GParamSpec *param = property_specs[i];
|
||||||
|
GType owner_type = param->owner_type;
|
||||||
|
|
||||||
|
/* We're printing pad properties */
|
||||||
|
if (obj == NULL && (owner_type == G_TYPE_OBJECT
|
||||||
|
|| owner_type == GST_TYPE_OBJECT || owner_type == GST_TYPE_PAD))
|
||||||
|
continue;
|
||||||
|
|
||||||
readable = FALSE;
|
readable = FALSE;
|
||||||
|
|
||||||
|
@ -299,8 +305,8 @@ print_element_properties_info (GstElement * element)
|
||||||
|
|
||||||
first_flag = TRUE;
|
first_flag = TRUE;
|
||||||
n_print ("flags: ");
|
n_print ("flags: ");
|
||||||
if (param->flags & G_PARAM_READABLE) {
|
if (param->flags & G_PARAM_READABLE && obj != NULL) {
|
||||||
g_object_get_property (G_OBJECT (element), param->name, &value);
|
g_object_get_property (obj, param->name, &value);
|
||||||
readable = TRUE;
|
readable = TRUE;
|
||||||
g_print ("%s%s", (first_flag) ? "" : ", ", _("readable"));
|
g_print ("%s%s", (first_flag) ? "" : ", ", _("readable"));
|
||||||
first_flag = FALSE;
|
first_flag = FALSE;
|
||||||
|
@ -363,7 +369,7 @@ print_element_properties_info (GstElement * element)
|
||||||
pulong->minimum, pulong->maximum, g_value_get_ulong (&value));
|
pulong->minimum, pulong->maximum, g_value_get_ulong (&value));
|
||||||
|
|
||||||
GST_ERROR ("%s: property '%s' of type ulong: consider changing to "
|
GST_ERROR ("%s: property '%s' of type ulong: consider changing to "
|
||||||
"uint/uint64", GST_OBJECT_NAME (element),
|
"uint/uint64", G_OBJECT_CLASS_NAME (obj_class),
|
||||||
g_param_spec_get_name (param));
|
g_param_spec_get_name (param));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -375,7 +381,7 @@ print_element_properties_info (GstElement * element)
|
||||||
plong->minimum, plong->maximum, g_value_get_long (&value));
|
plong->minimum, plong->maximum, g_value_get_long (&value));
|
||||||
|
|
||||||
GST_ERROR ("%s: property '%s' of type long: consider changing to "
|
GST_ERROR ("%s: property '%s' of type long: consider changing to "
|
||||||
"int/int64", GST_OBJECT_NAME (element),
|
"int/int64", G_OBJECT_CLASS_NAME (obj_class),
|
||||||
g_param_spec_get_name (param));
|
g_param_spec_get_name (param));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -432,7 +438,7 @@ print_element_properties_info (GstElement * element)
|
||||||
case G_TYPE_CHAR:
|
case G_TYPE_CHAR:
|
||||||
case G_TYPE_UCHAR:
|
case G_TYPE_UCHAR:
|
||||||
GST_ERROR ("%s: property '%s' of type char: consider changing to "
|
GST_ERROR ("%s: property '%s' of type char: consider changing to "
|
||||||
"int/string", GST_OBJECT_NAME (element),
|
"int/string", G_OBJECT_CLASS_NAME (obj_class),
|
||||||
g_param_spec_get_name (param));
|
g_param_spec_get_name (param));
|
||||||
/* fall through */
|
/* fall through */
|
||||||
default:
|
default:
|
||||||
|
@ -558,11 +564,20 @@ print_element_properties_info (GstElement * element)
|
||||||
g_free (property_specs);
|
g_free (property_specs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_element_properties_info (GstElement * element)
|
||||||
|
{
|
||||||
|
g_print ("\n");
|
||||||
|
print_object_properties_info (G_OBJECT (element),
|
||||||
|
G_OBJECT_GET_CLASS (element), "Element Properties");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_pad_templates_info (GstElement * element, GstElementFactory * factory)
|
print_pad_templates_info (GstElement * element, GstElementFactory * factory)
|
||||||
{
|
{
|
||||||
const GList *pads;
|
const GList *pads;
|
||||||
GstStaticPadTemplate *padtemplate;
|
GstStaticPadTemplate *padtemplate;
|
||||||
|
GstPadTemplate *tmpl;
|
||||||
|
|
||||||
n_print ("Pad Templates:\n");
|
n_print ("Pad Templates:\n");
|
||||||
|
|
||||||
|
@ -608,6 +623,21 @@ print_pad_templates_info (GstElement * element, GstElementFactory * factory)
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tmpl = gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (element),
|
||||||
|
padtemplate->name_template);
|
||||||
|
if (tmpl != NULL) {
|
||||||
|
GType pad_type = GST_PAD_TEMPLATE_GTYPE (tmpl);
|
||||||
|
|
||||||
|
if (pad_type != G_TYPE_NONE && pad_type != GST_TYPE_PAD) {
|
||||||
|
gpointer pad_klass;
|
||||||
|
|
||||||
|
pad_klass = g_type_class_ref (pad_type);
|
||||||
|
n_print ("Type: %s\n", g_type_name (pad_type));
|
||||||
|
print_object_properties_info (NULL, pad_klass, "Pad Properties");
|
||||||
|
g_type_class_unref (pad_klass);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pop_indent ();
|
pop_indent ();
|
||||||
|
|
||||||
if (pads != NULL)
|
if (pads != NULL)
|
||||||
|
|
Loading…
Reference in a new issue