diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2016-09-04 20:39:31 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2016-09-04 20:39:31 +0100 |
commit | ad537a2d51cae916bb2bc54d1da97721461c1925 (patch) | |
tree | ef9aa2c8f5ac808b196c2bc2bb02b611ed1cb72b /tools | |
parent | 1b1459b0a61bfa6a0cc49749d1562fb2fdbb06f9 (diff) |
tools: gst-inspect: add * for pointer signal arguments where needed
Print GObject argument properly with pointer marker:
"client-added" : void user_function (GstElement* object,
GObject* arg0,
gpointer user_data);
instead of
"client-added" : void user_function (GstElement* object,
GObject arg0,
gpointer user_data);
for gst-inspect-1.0 tcpserversink.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gst-inspect.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index 4d020ad8a..3a59ef3c7 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -738,6 +738,19 @@ has_sometimes_template (GstElement * element) return FALSE; } +static gboolean +gtype_needs_ptr_marker (GType type) +{ + if (type == G_TYPE_POINTER) + return FALSE; + + if (G_TYPE_FUNDAMENTAL (type) == G_TYPE_POINTER || G_TYPE_IS_BOXED (type) + || G_TYPE_IS_OBJECT (type)) + return TRUE; + + return FALSE; +} + static void print_signal_info (GstElement * element) { @@ -808,12 +821,7 @@ print_signal_info (GstElement * element) indent_len = strlen (query->signal_name) + strlen (g_type_name (query->return_type)) + 24; - - if (query->return_type == G_TYPE_POINTER) { - pmark = ""; - } else if (G_TYPE_FUNDAMENTAL (query->return_type) == G_TYPE_POINTER - || G_TYPE_IS_BOXED (query->return_type) - || G_TYPE_IS_OBJECT (query->return_type)) { + if (gtype_needs_ptr_marker (query->return_type)) { pmark = "* "; indent_len += 2; } else { @@ -828,17 +836,13 @@ print_signal_info (GstElement * element) g_type_name (type)); for (j = 0; j < query->n_params; j++) { + const gchar *type_name, *asterisk; + + type_name = g_type_name (query->param_types[j]); + asterisk = gtype_needs_ptr_marker (query->param_types[j]) ? "*" : ""; + g_print (",\n"); - if (G_TYPE_IS_FUNDAMENTAL (query->param_types[j])) { - n_print ("%s%s arg%d", indent, - g_type_name (query->param_types[j]), j); - } else if (G_TYPE_IS_ENUM (query->param_types[j])) { - n_print ("%s%s arg%d", indent, - g_type_name (query->param_types[j]), j); - } else { - n_print ("%s%s* arg%d", indent, - g_type_name (query->param_types[j]), j); - } + n_print ("%s%s%s arg%d", indent, type_name, asterisk, j); } if (k == 0) { |