1 Index: gstreamer-0.11.92/tools/gst-inspect.c
2 ===================================================================
3 --- gstreamer-0.11.92.orig/tools/gst-inspect.c
4 +++ gstreamer-0.11.92/tools/gst-inspect.c
5 @@ -1350,9 +1350,225 @@ print_element_info (GstElementFactory *
10 +print_gst_structure_append_field (GList * strings, const char *field)
14 + //g_message ("adding '%s' to the string", field);
16 + for (s = strings; s != NULL; s = s->next) {
17 + g_string_append (s->data, field);
22 -print_plugin_automatic_install_info_codecs (GstElementFactory * factory)
23 +print_gst_structure_append_field_index (GList * strings, const char *field,
24 + guint num_items, guint offset)
29 + //g_message ("adding '%s' to the string (num: %d offset: %d)", field, num_items, offset);
31 + for (s = strings, i = 0; s != NULL; s = s->next, i++) {
33 + //g_message ("adding '%s' at '%d'", field, i);
34 + g_string_append (s->data, field);
43 +print_gst_structure_dup_fields (GList * strings, guint num_items)
50 + //g_message ("creating %d new items", num_items);
52 + new_items = g_list_length (strings) * (num_items - 1);
53 + for (i = 0; i < new_items; i++) {
56 + first = strings->data;
57 + s = g_string_new_len (first->str, first->len);
58 + strings = g_list_prepend (strings, s);
73 +field_get_type (const char *field_name)
75 + if (strstr (field_name, "version") != NULL)
76 + return FIELD_VERSION;
77 + if (strcmp (field_name, "layer") == 0)
79 + if (strcmp (field_name, "systemstream") == 0)
80 + return FIELD_SYSTEMSTREAM;
81 + if (strcmp (field_name, "variant") == 0)
82 + return FIELD_VARIANT;
88 +fields_type_compare (const char *a, const char *b)
90 + gint a_type, b_type;
92 + a_type = field_get_type (a);
93 + b_type = field_get_type (b);
94 + if (a_type < b_type)
96 + if (b_type < a_type)
102 +print_gst_structure_for_rpm (const char *type_name, GstStructure * s)
104 + guint i, num_fields;
106 + GList *fields, *l, *strings;
109 + name = gst_structure_get_name (s);
111 + num_fields = gst_structure_n_fields (s);
114 + for (i = 0; i < num_fields; i++) {
115 + const char *field_name;
117 + field_name = gst_structure_nth_field_name (s, i);
118 + if (field_get_type (field_name) < 0) {
119 + //g_message ("ignoring field named %s", field_name);
124 + g_list_insert_sorted (fields, g_strdup (field_name),
125 + (GCompareFunc) fields_type_compare);
129 + * gstreamer0.10(decoder-video/mpeg)(mpegversion=1)()(64bit) */
130 + string = g_string_new ("gstreamer0.10");
131 + g_string_append_c (string, '(');
132 + g_string_append (string, type_name);
133 + g_string_append_c (string, '-');
134 + g_string_append (string, name);
135 + g_string_append_c (string, ')');
137 + strings = g_list_append (strings, string);
139 + for (l = fields; l != NULL; l = l->next) {
143 + field_name = l->data;
145 + type = gst_structure_get_field_type (s, field_name);
146 + //g_message ("field is: %s, type: %s", field_name, g_type_name (type));
148 + if (type == G_TYPE_INT) {
152 + gst_structure_get_int (s, field_name, &value);
153 + field = g_strdup_printf ("(%s=%d)", field_name, value);
154 + print_gst_structure_append_field (strings, field);
156 + } else if (type == G_TYPE_BOOLEAN) {
160 + gst_structure_get_boolean (s, field_name, &value);
161 + field = g_strdup_printf ("(%s=%s)", field_name, value ? "true" : "false");
162 + print_gst_structure_append_field (strings, field);
164 + } else if (type == GST_TYPE_INT_RANGE) {
165 + const GValue *value;
168 + value = gst_structure_get_value (s, field_name);
169 + min = gst_value_get_int_range_min (value);
170 + max = gst_value_get_int_range_max (value);
172 + strings = print_gst_structure_dup_fields (strings, max - min + 1);
174 + for (i = min; i <= max; i++) {
177 + field = g_strdup_printf ("(%s=%d)", field_name, i);
178 + print_gst_structure_append_field_index (strings, field, max - min + 1,
182 + } else if (type == GST_TYPE_LIST) {
183 + const GValue *value;
186 + value = gst_structure_get_value (s, field_name);
187 + num_items = gst_value_list_get_size (value);
189 + strings = print_gst_structure_dup_fields (strings, num_items);
191 + for (i = 0; i < num_items; i++) {
193 + const GValue *item_value;
195 + item_value = gst_value_list_get_value (value, i);
196 + field = g_strdup_printf ("(%s=%d)", field_name,
197 + g_value_get_int (item_value));
198 + print_gst_structure_append_field_index (strings, field, num_items, i);
201 + } else if (type == G_TYPE_STRING) {
205 + value = gst_structure_get_string (s, field_name);
206 + field = g_strdup_printf ("(%s=%s)", field_name, value);
207 + print_gst_structure_append_field (strings, field);
210 + g_warning ("unhandled type! %s", g_type_name (type));
213 + g_free (field_name);
216 + g_list_free (fields);
218 + for (l = strings; l != NULL; l = l->next) {
220 + g_print ("%s\n", string->str);
221 + g_string_free (string, TRUE);
223 + g_list_free (strings);
227 +print_plugin_automatic_install_info_codecs (GstElementFactory * factory,
228 + gboolean rpm_format)
230 GstPadDirection direction;
231 const gchar *type_name;
232 @@ -1377,6 +1593,14 @@ print_plugin_automatic_install_info_code
238 + /* Ignore NONE ranked plugins */
239 + if (GST_PLUGIN_FEATURE (factory)->rank == GST_RANK_NONE)
244 /* decoder/demuxer sink pads should always be static and there should only
245 * be one, the same applies to encoders/muxers and source pads */
246 static_templates = gst_element_factory_get_static_pad_templates (factory);
247 @@ -1413,15 +1637,20 @@ print_plugin_automatic_install_info_code
248 gst_structure_remove_field (s, "rate");
249 gst_structure_remove_field (s, "depth");
250 gst_structure_remove_field (s, "clock-rate");
251 - s_str = gst_structure_to_string (s);
252 - g_print ("%s-%s\n", type_name, s_str);
255 + s_str = gst_structure_to_string (s);
256 + g_print ("%s-%s\n", type_name, s_str);
259 + print_gst_structure_for_rpm (type_name, s);
262 gst_caps_unref (caps);
266 -print_plugin_automatic_install_info_protocols (GstElementFactory * factory)
267 +print_plugin_automatic_install_info_protocols (GstElementFactory * factory,
268 + gboolean rpm_format)
270 const gchar *const *protocols;
272 @@ -1430,13 +1659,19 @@ print_plugin_automatic_install_info_prot
273 switch (gst_element_factory_get_uri_type (factory)) {
275 while (*protocols != NULL) {
276 - g_print ("urisink-%s\n", *protocols);
278 + g_print ("urisink-%s\n", *protocols);
280 + g_print ("gstreamer0.10(urisink-%s)\n", *protocols);
285 while (*protocols != NULL) {
286 - g_print ("urisource-%s\n", *protocols);
288 + g_print ("urisource-%s\n", *protocols);
290 + g_print ("gstreamer0.10(urisource-%s)\n", *protocols);
294 @@ -1447,7 +1682,7 @@ print_plugin_automatic_install_info_prot
298 -print_plugin_automatic_install_info (GstPlugin * plugin)
299 +print_plugin_automatic_install_info (GstPlugin * plugin, gboolean rpm_format)
303 @@ -1466,11 +1701,15 @@ print_plugin_automatic_install_info (Gst
304 if (feature_plugin == plugin) {
305 GstElementFactory *factory;
307 - g_print ("element-%s\n", gst_plugin_feature_get_name (feature));
309 + g_print ("element-%s\n", gst_plugin_feature_get_name (feature));
311 + g_print ("gstreamer0.10(element-%s)\n",
312 + gst_plugin_feature_get_name (feature));
314 factory = GST_ELEMENT_FACTORY (feature);
315 - print_plugin_automatic_install_info_protocols (factory);
316 - print_plugin_automatic_install_info_codecs (factory);
317 + print_plugin_automatic_install_info_protocols (factory, rpm_format);
318 + print_plugin_automatic_install_info_codecs (factory, rpm_format);
321 gst_object_unref (feature_plugin);
322 @@ -1492,7 +1731,7 @@ print_all_plugin_automatic_install_info
323 plugin = (GstPlugin *) (plugins->data);
324 plugins = g_list_next (plugins);
326 - print_plugin_automatic_install_info (plugin);
327 + print_plugin_automatic_install_info (plugin, FALSE);
329 gst_plugin_list_free (orig_plugins);
331 @@ -1504,6 +1743,7 @@ main (int argc, char *argv[])
332 gboolean do_print_blacklist = FALSE;
333 gboolean plugin_name = FALSE;
334 gboolean print_aii = FALSE;
335 + gboolean print_aii_rpm = FALSE;
336 gboolean uri_handlers = FALSE;
337 #ifndef GST_DISABLE_OPTION_PARSING
338 GOptionEntry options[] = {
339 @@ -1516,6 +1756,9 @@ main (int argc, char *argv[])
340 "or all plugins provide.\n "
341 "Useful in connection with external automatic plugin "
342 "installation mechanisms"), NULL},
343 + {"rpm", '\0', 0, G_OPTION_ARG_NONE, &print_aii_rpm,
344 + N_("Print the machine-parsable list of features of a plugin in RPM "
345 + "Provides compatible-format"), NULL},
346 {"plugin", '\0', 0, G_OPTION_ARG_NONE, &plugin_name,
347 N_("List the plugin contents"), NULL},
348 {"uri-handlers", 'u', 0, G_OPTION_ARG_NONE, &uri_handlers,
349 @@ -1602,7 +1845,7 @@ main (int argc, char *argv[])
350 /* if there is such a plugin, print out info */
353 - print_plugin_automatic_install_info (plugin);
354 + print_plugin_automatic_install_info (plugin, print_aii_rpm);
356 print_plugin_info (plugin);
357 print_plugin_features (plugin);
358 @@ -1615,13 +1858,17 @@ main (int argc, char *argv[])
362 - print_plugin_automatic_install_info (plugin);
363 + print_plugin_automatic_install_info (plugin, print_aii_rpm);
365 print_plugin_info (plugin);
366 print_plugin_features (plugin);
369 - g_print (_("Could not load plugin file: %s\n"), error->message);
370 + if (!print_aii_rpm)
371 + g_print (_("Could not load plugin file: %s\n"), error->message);
373 + g_printerr (_("Could not load plugin file: %s\n"),
375 g_error_free (error);