X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=subprojects%2Fgstreamer%2Ftools%2Fgst-inspect.c;h=328809a6a02d50c7a1d8f2daf39ddf105f0ffa36;hb=65eb52644487ce2cefe7e7f5e1d03a5a1396cb1b;hp=d50bf65c9a6fca921b73a95ce3a9ec82b217f2c3;hpb=62f8d292a1f2dec50ca111cfa4c1f6ebabc39571;p=platform%2Fupstream%2Fgstreamer.git diff --git a/subprojects/gstreamer/tools/gst-inspect.c b/subprojects/gstreamer/tools/gst-inspect.c index d50bf65..328809a 100644 --- a/subprojects/gstreamer/tools/gst-inspect.c +++ b/subprojects/gstreamer/tools/gst-inspect.c @@ -46,6 +46,10 @@ #include #endif +#ifdef __APPLE__ +#include +#endif + /* "R" : support color * "X" : do not clear the screen when leaving the pager * "F" : skip the pager if content fit into the screen @@ -428,6 +432,7 @@ print_object_properties_info (GObject * obj, GObjectClass * obj_class, (GCompareDataFunc) sort_gparamspecs, NULL); n_print ("%s%s%s:\n", HEADING_COLOR, desc, RESET_COLOR); + n_print ("\n"); push_indent (); @@ -744,6 +749,15 @@ print_object_properties_info (GObject * obj, GObjectClass * obj_class, } else if (param->value_type == GST_TYPE_ARRAY) { GstParamSpecArray *parray = GST_PARAM_SPEC_ARRAY_LIST (param); + if (GST_VALUE_HOLDS_ARRAY (&value)) { + gchar *def = gst_value_serialize (&value); + + n_print ("%sDefault%s: \"%s\"\n", PROP_ATTR_VALUE_COLOR, + RESET_COLOR, def); + + g_free (def); + } + if (parray->element_spec) { n_print ("%sGstValueArray of GValues of type%s %s\"%s\"%s", PROP_VALUE_COLOR, RESET_COLOR, DATATYPE_COLOR, @@ -767,6 +781,8 @@ print_object_properties_info (GObject * obj, GObjectClass * obj_class, pop_indent_n (11); g_value_reset (&value); + + n_print ("\n"); } if (num_properties == 0) n_print ("%snone%s\n", PROP_VALUE_COLOR, RESET_COLOR); @@ -799,7 +815,7 @@ gst_static_pad_compare_func (gconstpointer p1, gconstpointer p2) static void print_pad_templates_info (GstElement * element, GstElementFactory * factory) { - GList *pads; + GList *pads, *tmp; GstStaticPadTemplate *padtemplate; GstPadTemplate *tmpl; @@ -815,9 +831,9 @@ print_pad_templates_info (GstElement * element, GstElementFactory * factory) pads = g_list_copy ((GList *) gst_element_factory_get_static_pad_templates (factory)); pads = g_list_sort (pads, gst_static_pad_compare_func); - while (pads) { - padtemplate = (GstStaticPadTemplate *) (pads->data); - pads = g_list_next (pads); + + for (tmp = pads; tmp; tmp = tmp->next) { + padtemplate = (GstStaticPadTemplate *) (tmp->data); if (padtemplate->direction == GST_PAD_SRC) n_print ("%sSRC template%s: %s'%s'%s\n", PROP_NAME_COLOR, RESET_COLOR, @@ -874,7 +890,7 @@ print_pad_templates_info (GstElement * element, GstElementFactory * factory) pop_indent (); - if (pads != NULL) + if (tmp->next) n_print ("\n"); } g_list_free (pads); @@ -1052,6 +1068,21 @@ gtype_needs_ptr_marker (GType type) return FALSE; } +static const gchar * +pretty_type_name (GType type, const gchar ** p_pmark) +{ + if (type == G_TYPE_STRING) { + *p_pmark = " * "; + return "gchar"; + } else if (type == G_TYPE_STRV) { + *p_pmark = " ** "; + return "gchar"; + } else { + *p_pmark = gtype_needs_ptr_marker (type) ? " * " : " "; + return g_type_name (type); + } +} + static void print_signal_info (GstElement * element) { @@ -1109,6 +1140,7 @@ print_signal_info (GstElement * element) n_print ("%sElement Signals%s:\n", HEADING_COLOR, RESET_COLOR); else n_print ("%sElement Actions%s:\n", HEADING_COLOR, RESET_COLOR); + n_print ("\n"); } else { continue; } @@ -1116,37 +1148,39 @@ print_signal_info (GstElement * element) for (l = found_signals; l; l = l->next) { gchar *indent; const gchar *pmark; + const gchar *retval_type_name; int indent_len; query = (GSignalQuery *) l->data; - indent_len = strlen (query->signal_name) + - strlen (g_type_name (query->return_type)) + 24; - - if (gtype_needs_ptr_marker (query->return_type)) { - pmark = "* "; - indent_len += 2; - } else { - pmark = " "; - } + retval_type_name = pretty_type_name (query->return_type, &pmark); + indent_len = + strlen (query->signal_name) + strlen (retval_type_name) + 24 + + strlen (pmark) - 1; indent = g_new0 (gchar, indent_len + 1); memset (indent, ' ', indent_len); - n_print (" %s\"%s\"%s : %s%s%s%suser_function%s (%s%s%s* object%s", + n_print (" %s\"%s\"%s : %s%s%s%suser_function%s (%s%s%s * object%s", PROP_NAME_COLOR, query->signal_name, RESET_COLOR, - DATATYPE_COLOR, g_type_name (query->return_type), PROP_VALUE_COLOR, + DATATYPE_COLOR, retval_type_name, PROP_VALUE_COLOR, pmark, RESET_COLOR, DATATYPE_COLOR, g_type_name (type), PROP_VALUE_COLOR, RESET_COLOR); for (j = 0; j < query->n_params; j++) { - const gchar *type_name, *asterisk; + const gchar *type_name, *asterisk, *const_prefix; + + type_name = pretty_type_name (query->param_types[j], &asterisk); - type_name = g_type_name (query->param_types[j]); - asterisk = gtype_needs_ptr_marker (query->param_types[j]) ? "*" : ""; + /* Add const prefix for string and string array arguments */ + if (g_str_equal (type_name, "gchar") && strchr (asterisk, '*')) { + const_prefix = "const "; + } else { + const_prefix = ""; + } g_print (",\n"); - n_print ("%s%s%s%s%s arg%d%s", indent, DATATYPE_COLOR, type_name, - PROP_VALUE_COLOR, asterisk, j, RESET_COLOR); + n_print ("%s%s%s%s%s%sarg%d%s", indent, DATATYPE_COLOR, const_prefix, + type_name, PROP_VALUE_COLOR, asterisk, j, RESET_COLOR); } if (k == 0) { @@ -1157,6 +1191,7 @@ print_signal_info (GstElement * element) g_print (");\n"); g_free (indent); + g_print ("\n"); } if (found_signals) { @@ -2078,8 +2113,8 @@ _parse_sort_type (const gchar * option_name, const gchar * optarg, return FALSE; } -int -main (int argc, char *argv[]) +static int +real_main (int argc, char *argv[]) { gboolean print_all = FALSE; gboolean do_print_blacklist = FALSE; @@ -2158,7 +2193,12 @@ main (int argc, char *argv[]) ctx = g_option_context_new ("[ELEMENT-NAME | PLUGIN-NAME]"); g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE); g_option_context_add_group (ctx, gst_init_get_option_group ()); - if (!g_option_context_parse (ctx, &argc, &argv, &err)) { +#if defined(G_OS_WIN32) && !defined(GST_CHECK_MAIN) + if (!g_option_context_parse_strv (ctx, &argv, &err)) +#else + if (!g_option_context_parse (ctx, &argc, &argv, &err)) +#endif + { g_printerr ("Error initializing: %s\n", err->message); g_clear_error (&err); g_option_context_free (ctx); @@ -2169,6 +2209,10 @@ main (int argc, char *argv[]) gst_init (&argc, &argv); #endif +#if defined(G_OS_WIN32) && !defined(GST_CHECK_MAIN) + argc = g_strv_length (argv); +#endif + gst_tools_print_version (); if (print_all && argc > 1) { @@ -2321,3 +2365,26 @@ done: return exit_code; } + +int +main (int argc, char *argv[]) +{ + int ret; + + /* gstinspect.c calls this function */ +#if defined(G_OS_WIN32) && !defined(GST_CHECK_MAIN) + argv = g_win32_get_command_line (); +#endif + +#if defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE + ret = gst_macos_main ((GstMainFunc) real_main, argc, argv, NULL); +#else + ret = real_main (argc, argv); +#endif + +#if defined(G_OS_WIN32) && !defined(GST_CHECK_MAIN) + g_strfreev (argv); +#endif + + return ret; +}