1 --- gstreamer-1.16.0/tools/gst-inspect.c.orig 2019-04-12 00:58:09.000000000 +0200
2 +++ gstreamer-1.16.0/tools/gst-inspect.c 2019-05-20 09:39:11.295876148 +0200
3 @@ -1726,11 +1726,228 @@ print_tracer_info (GstPluginFeature * fe
8 +print_gst_structure_append_field (GList * strings, const char *field)
12 + //g_message ("adding '%s' to the string", field);
14 + for (s = strings; s != NULL; s = s->next) {
15 + g_string_append (s->data, field);
20 +print_gst_structure_append_field_index (GList * strings, const char *field,
21 + guint num_items, guint offset)
26 + //g_message ("adding '%s' to the string (num: %d offset: %d)", field, num_items, offset);
28 + for (s = strings, i = 0; s != NULL; s = s->next, i++) {
30 + //g_message ("adding '%s' at '%d'", field, i);
31 + g_string_append (s->data, field);
40 +print_gst_structure_dup_fields (GList * strings, guint num_items)
47 + //g_message ("creating %d new items", num_items);
49 + new_items = g_list_length (strings) * (num_items - 1);
50 + for (i = 0; i < new_items; i++) {
53 + first = strings->data;
54 + s = g_string_new_len (first->str, first->len);
55 + strings = g_list_prepend (strings, s);
70 +field_get_type (const char *field_name)
72 + if (strstr (field_name, "version") != NULL)
73 + return FIELD_VERSION;
74 + if (strcmp (field_name, "layer") == 0)
76 + if (strcmp (field_name, "systemstream") == 0)
77 + return FIELD_SYSTEMSTREAM;
78 + if (strcmp (field_name, "variant") == 0)
79 + return FIELD_VARIANT;
85 +fields_type_compare (const char *a, const char *b)
87 + gint a_type, b_type;
89 + a_type = field_get_type (a);
90 + b_type = field_get_type (b);
91 + if (a_type < b_type)
93 + if (b_type < a_type)
99 +print_gst_structure_for_rpm (const char *type_name, GstStructure * s)
101 + guint i, num_fields;
103 + GList *fields, *l, *strings;
106 + name = gst_structure_get_name (s);
108 + num_fields = gst_structure_n_fields (s);
111 + for (i = 0; i < num_fields; i++) {
112 + const char *field_name;
114 + field_name = gst_structure_nth_field_name (s, i);
115 + if (field_get_type (field_name) < 0) {
116 + //g_message ("ignoring field named %s", field_name);
121 + g_list_insert_sorted (fields, g_strdup (field_name),
122 + (GCompareFunc) fields_type_compare);
126 + * gstreamer1(decoder-video/mpeg)(mpegversion=1)()(64bit) */
127 + string = g_string_new ("gstreamer1");
128 + g_string_append_c (string, '(');
129 + g_string_append (string, type_name);
130 + g_string_append_c (string, '-');
131 + g_string_append (string, name);
132 + g_string_append_c (string, ')');
134 + strings = g_list_append (strings, string);
136 + for (l = fields; l != NULL; l = l->next) {
140 + field_name = l->data;
142 + type = gst_structure_get_field_type (s, field_name);
143 + //g_message ("field is: %s, type: %s", field_name, g_type_name (type));
145 + if (type == G_TYPE_INT) {
149 + gst_structure_get_int (s, field_name, &value);
150 + field = g_strdup_printf ("(%s=%d)", field_name, value);
151 + print_gst_structure_append_field (strings, field);
153 + } else if (type == G_TYPE_BOOLEAN) {
157 + gst_structure_get_boolean (s, field_name, &value);
158 + field = g_strdup_printf ("(%s=%s)", field_name, value ? "true" : "false");
159 + print_gst_structure_append_field (strings, field);
161 + } else if (type == GST_TYPE_INT_RANGE) {
162 + const GValue *value;
165 + value = gst_structure_get_value (s, field_name);
166 + min = gst_value_get_int_range_min (value);
167 + max = gst_value_get_int_range_max (value);
169 + strings = print_gst_structure_dup_fields (strings, max - min + 1);
171 + for (i = min; i <= max; i++) {
174 + field = g_strdup_printf ("(%s=%d)", field_name, i);
175 + print_gst_structure_append_field_index (strings, field, max - min + 1,
179 + } else if (type == GST_TYPE_LIST) {
180 + const GValue *value;
183 + value = gst_structure_get_value (s, field_name);
184 + num_items = gst_value_list_get_size (value);
186 + strings = print_gst_structure_dup_fields (strings, num_items);
188 + for (i = 0; i < num_items; i++) {
190 + const GValue *item_value;
192 + item_value = gst_value_list_get_value (value, i);
193 + field = g_strdup_printf ("(%s=%d)", field_name,
194 + g_value_get_int (item_value));
195 + print_gst_structure_append_field_index (strings, field, num_items, i);
198 + } else if (type == G_TYPE_STRING) {
202 + value = gst_structure_get_string (s, field_name);
203 + field = g_strdup_printf ("(%s=%s)", field_name, value);
204 + print_gst_structure_append_field (strings, field);
207 + g_warning ("unhandled type! %s", g_type_name (type));
210 + g_free (field_name);
213 + g_list_free (fields);
215 + for (l = strings; l != NULL; l = l->next) {
217 + g_print ("%s\n", string->str);
218 + g_string_free (string, TRUE);
220 + g_list_free (strings);
223 /* NOTE: Not coloring output from automatic install functions, as their output
224 * is meant for machines, not humans.
227 -print_plugin_automatic_install_info_codecs (GstElementFactory * factory)
228 +print_plugin_automatic_install_info_codecs (GstElementFactory * factory,
229 + gboolean rpm_format)
231 GstPadDirection direction;
232 const gchar *type_name;
233 @@ -1756,6 +1973,12 @@ print_plugin_automatic_install_info_code
238 + /* Ignore NONE ranked plugins */
239 + if ((gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (factory))) == GST_RANK_NONE)
243 /* decoder/demuxer sink pads should always be static and there should only
244 * be one, the same applies to encoders/muxers and source pads */
245 static_templates = gst_element_factory_get_static_pad_templates (factory);
246 @@ -1792,15 +2015,20 @@ print_plugin_automatic_install_info_code
247 gst_structure_remove_field (s, "rate");
248 gst_structure_remove_field (s, "depth");
249 gst_structure_remove_field (s, "clock-rate");
250 - s_str = gst_structure_to_string (s);
251 - g_print ("%s-%s\n", type_name, s_str);
254 + s_str = gst_structure_to_string (s);
255 + g_print ("%s-%s\n", type_name, s_str);
258 + print_gst_structure_for_rpm (type_name, s);
261 gst_caps_unref (caps);
265 -print_plugin_automatic_install_info_protocols (GstElementFactory * factory)
266 +print_plugin_automatic_install_info_protocols (GstElementFactory * factory,
267 + gboolean rpm_format)
269 const gchar *const *protocols;
271 @@ -1809,13 +2037,19 @@ print_plugin_automatic_install_info_prot
272 switch (gst_element_factory_get_uri_type (factory)) {
274 while (*protocols != NULL) {
275 - g_print ("urisink-%s\n", *protocols);
277 + g_print ("urisink-%s\n", *protocols);
279 + g_print ("gstreamer1(urisink-%s)\n", *protocols);
284 while (*protocols != NULL) {
285 - g_print ("urisource-%s\n", *protocols);
287 + g_print ("urisource-%s\n", *protocols);
289 + g_print ("gstreamer1(urisource-%s)\n", *protocols);
293 @@ -1826,7 +2060,7 @@ print_plugin_automatic_install_info_prot
297 -print_plugin_automatic_install_info (GstPlugin * plugin)
298 +print_plugin_automatic_install_info (GstPlugin * plugin, gboolean rpm_format)
302 @@ -1845,11 +2079,15 @@ print_plugin_automatic_install_info (Gst
303 if (feature_plugin == plugin) {
304 GstElementFactory *factory;
306 - g_print ("element-%s\n", gst_plugin_feature_get_name (feature));
308 + g_print ("element-%s\n", gst_plugin_feature_get_name (feature));
310 + g_print ("gstreamer1(element-%s)\n",
311 + gst_plugin_feature_get_name (feature));
313 factory = GST_ELEMENT_FACTORY (feature);
314 - print_plugin_automatic_install_info_protocols (factory);
315 - print_plugin_automatic_install_info_codecs (factory);
316 + print_plugin_automatic_install_info_protocols (factory, rpm_format);
317 + print_plugin_automatic_install_info_codecs (factory, rpm_format);
320 gst_object_unref (feature_plugin);
321 @@ -1871,7 +2109,7 @@ print_all_plugin_automatic_install_info
322 plugin = (GstPlugin *) (plugins->data);
323 plugins = g_list_next (plugins);
325 - print_plugin_automatic_install_info (plugin);
326 + print_plugin_automatic_install_info (plugin, FALSE);
328 gst_plugin_list_free (orig_plugins);
330 @@ -1938,6 +2176,7 @@ main (int argc, char *argv[])
331 gboolean do_print_blacklist = FALSE;
332 gboolean plugin_name = FALSE;
333 gboolean print_aii = FALSE;
334 + gboolean print_aii_rpm = FALSE;
335 gboolean uri_handlers = FALSE;
336 gboolean check_exists = FALSE;
337 gchar *min_version = NULL;
338 @@ -1958,6 +2197,9 @@ main (int argc, char *argv[])
339 "or all plugins provide.\n "
340 "Useful in connection with external automatic plugin "
341 "installation mechanisms"), NULL},
342 + {"rpm", '\0', 0, G_OPTION_ARG_NONE, &print_aii_rpm,
343 + N_("Print the machine-parsable list of features of a plugin in RPM "
344 + "Provides compatible-format"), NULL},
345 {"plugin", '\0', 0, G_OPTION_ARG_NONE, &plugin_name,
346 N_("List the plugin contents"), NULL},
347 {"types", 't', 0, G_OPTION_ARG_STRING, &types,
348 @@ -2113,7 +2355,7 @@ main (int argc, char *argv[])
349 /* if there is such a plugin, print out info */
352 - print_plugin_automatic_install_info (plugin);
353 + print_plugin_automatic_install_info (plugin, print_aii_rpm);
355 print_plugin_info (plugin);
356 print_plugin_features (plugin);
357 @@ -2126,13 +2368,17 @@ main (int argc, char *argv[])
361 - print_plugin_automatic_install_info (plugin);
362 + print_plugin_automatic_install_info (plugin, print_aii_rpm);
364 print_plugin_info (plugin);
365 print_plugin_features (plugin);
368 - g_printerr (_("Could not load plugin file: %s\n"), error->message);
369 + if (!print_aii_rpm)
370 + g_print (_("Could not load plugin file: %s\n"), error->message);
372 + g_printerr (_("Could not load plugin file: %s\n"),
374 g_clear_error (&error);