1 diff -urp gstreamer-0.11.94.orig/tools/gst-inspect.c gstreamer-0.11.94/tools/gst-inspect.c
2 --- gstreamer-0.11.94.orig/tools/gst-inspect.c 2012-09-01 18:02:10.000000000 -0400
3 +++ gstreamer-0.11.94/tools/gst-inspect.c 2012-09-14 08:04:52.690369047 -0400
4 @@ -1350,9 +1350,225 @@ print_element_info (GstElementFactory *
9 +print_gst_structure_append_field (GList * strings, const char *field)
13 + //g_message ("adding '%s' to the string", field);
15 + for (s = strings; s != NULL; s = s->next) {
16 + g_string_append (s->data, field);
21 +print_gst_structure_append_field_index (GList * strings, const char *field,
22 + guint num_items, guint offset)
27 + //g_message ("adding '%s' to the string (num: %d offset: %d)", field, num_items, offset);
29 + for (s = strings, i = 0; s != NULL; s = s->next, i++) {
31 + //g_message ("adding '%s' at '%d'", field, i);
32 + g_string_append (s->data, field);
41 +print_gst_structure_dup_fields (GList * strings, guint num_items)
48 + //g_message ("creating %d new items", num_items);
50 + new_items = g_list_length (strings) * (num_items - 1);
51 + for (i = 0; i < new_items; i++) {
54 + first = strings->data;
55 + s = g_string_new_len (first->str, first->len);
56 + strings = g_list_prepend (strings, s);
71 +field_get_type (const char *field_name)
73 + if (strstr (field_name, "version") != NULL)
74 + return FIELD_VERSION;
75 + if (strcmp (field_name, "layer") == 0)
77 + if (strcmp (field_name, "systemstream") == 0)
78 + return FIELD_SYSTEMSTREAM;
79 + if (strcmp (field_name, "variant") == 0)
80 + return FIELD_VARIANT;
86 +fields_type_compare (const char *a, const char *b)
88 + gint a_type, b_type;
90 + a_type = field_get_type (a);
91 + b_type = field_get_type (b);
92 + if (a_type < b_type)
94 + if (b_type < a_type)
100 +print_gst_structure_for_rpm (const char *type_name, GstStructure * s)
102 + guint i, num_fields;
104 + GList *fields, *l, *strings;
107 + name = gst_structure_get_name (s);
109 + num_fields = gst_structure_n_fields (s);
112 + for (i = 0; i < num_fields; i++) {
113 + const char *field_name;
115 + field_name = gst_structure_nth_field_name (s, i);
116 + if (field_get_type (field_name) < 0) {
117 + //g_message ("ignoring field named %s", field_name);
122 + g_list_insert_sorted (fields, g_strdup (field_name),
123 + (GCompareFunc) fields_type_compare);
127 + * gstreamer1(decoder-video/mpeg)(mpegversion=1)()(64bit) */
128 + string = g_string_new ("gstreamer1");
129 + g_string_append_c (string, '(');
130 + g_string_append (string, type_name);
131 + g_string_append_c (string, '-');
132 + g_string_append (string, name);
133 + g_string_append_c (string, ')');
135 + strings = g_list_append (strings, string);
137 + for (l = fields; l != NULL; l = l->next) {
141 + field_name = l->data;
143 + type = gst_structure_get_field_type (s, field_name);
144 + //g_message ("field is: %s, type: %s", field_name, g_type_name (type));
146 + if (type == G_TYPE_INT) {
150 + gst_structure_get_int (s, field_name, &value);
151 + field = g_strdup_printf ("(%s=%d)", field_name, value);
152 + print_gst_structure_append_field (strings, field);
154 + } else if (type == G_TYPE_BOOLEAN) {
158 + gst_structure_get_boolean (s, field_name, &value);
159 + field = g_strdup_printf ("(%s=%s)", field_name, value ? "true" : "false");
160 + print_gst_structure_append_field (strings, field);
162 + } else if (type == GST_TYPE_INT_RANGE) {
163 + const GValue *value;
166 + value = gst_structure_get_value (s, field_name);
167 + min = gst_value_get_int_range_min (value);
168 + max = gst_value_get_int_range_max (value);
170 + strings = print_gst_structure_dup_fields (strings, max - min + 1);
172 + for (i = min; i <= max; i++) {
175 + field = g_strdup_printf ("(%s=%d)", field_name, i);
176 + print_gst_structure_append_field_index (strings, field, max - min + 1,
180 + } else if (type == GST_TYPE_LIST) {
181 + const GValue *value;
184 + value = gst_structure_get_value (s, field_name);
185 + num_items = gst_value_list_get_size (value);
187 + strings = print_gst_structure_dup_fields (strings, num_items);
189 + for (i = 0; i < num_items; i++) {
191 + const GValue *item_value;
193 + item_value = gst_value_list_get_value (value, i);
194 + field = g_strdup_printf ("(%s=%d)", field_name,
195 + g_value_get_int (item_value));
196 + print_gst_structure_append_field_index (strings, field, num_items, i);
199 + } else if (type == G_TYPE_STRING) {
203 + value = gst_structure_get_string (s, field_name);
204 + field = g_strdup_printf ("(%s=%s)", field_name, value);
205 + print_gst_structure_append_field (strings, field);
208 + g_warning ("unhandled type! %s", g_type_name (type));
211 + g_free (field_name);
214 + g_list_free (fields);
216 + for (l = strings; l != NULL; l = l->next) {
218 + g_print ("%s\n", string->str);
219 + g_string_free (string, TRUE);
221 + g_list_free (strings);
225 -print_plugin_automatic_install_info_codecs (GstElementFactory * factory)
226 +print_plugin_automatic_install_info_codecs (GstElementFactory * factory,
227 + gboolean rpm_format)
229 GstPadDirection direction;
230 const gchar *type_name;
231 @@ -1377,6 +1593,12 @@ print_plugin_automatic_install_info_code
236 + /* Ignore NONE ranked plugins */
237 + if ((gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (factory))) == GST_RANK_NONE)
241 /* decoder/demuxer sink pads should always be static and there should only
242 * be one, the same applies to encoders/muxers and source pads */
243 static_templates = gst_element_factory_get_static_pad_templates (factory);
244 @@ -1413,15 +1635,20 @@ print_plugin_automatic_install_info_code
245 gst_structure_remove_field (s, "rate");
246 gst_structure_remove_field (s, "depth");
247 gst_structure_remove_field (s, "clock-rate");
248 - s_str = gst_structure_to_string (s);
249 - g_print ("%s-%s\n", type_name, s_str);
252 + s_str = gst_structure_to_string (s);
253 + g_print ("%s-%s\n", type_name, s_str);
256 + print_gst_structure_for_rpm (type_name, s);
259 gst_caps_unref (caps);
263 -print_plugin_automatic_install_info_protocols (GstElementFactory * factory)
264 +print_plugin_automatic_install_info_protocols (GstElementFactory * factory,
265 + gboolean rpm_format)
267 const gchar *const *protocols;
269 @@ -1430,13 +1657,19 @@ print_plugin_automatic_install_info_prot
270 switch (gst_element_factory_get_uri_type (factory)) {
272 while (*protocols != NULL) {
273 - g_print ("urisink-%s\n", *protocols);
275 + g_print ("urisink-%s\n", *protocols);
277 + g_print ("gstreamer1(urisink-%s)\n", *protocols);
282 while (*protocols != NULL) {
283 - g_print ("urisource-%s\n", *protocols);
285 + g_print ("urisource-%s\n", *protocols);
287 + g_print ("gstreamer1(urisource-%s)\n", *protocols);
291 @@ -1447,7 +1680,7 @@ print_plugin_automatic_install_info_prot
295 -print_plugin_automatic_install_info (GstPlugin * plugin)
296 +print_plugin_automatic_install_info (GstPlugin * plugin, gboolean rpm_format)
300 @@ -1466,11 +1699,15 @@ print_plugin_automatic_install_info (Gst
301 if (feature_plugin == plugin) {
302 GstElementFactory *factory;
304 - g_print ("element-%s\n", gst_plugin_feature_get_name (feature));
306 + g_print ("element-%s\n", gst_plugin_feature_get_name (feature));
308 + g_print ("gstreamer1(element-%s)\n",
309 + gst_plugin_feature_get_name (feature));
311 factory = GST_ELEMENT_FACTORY (feature);
312 - print_plugin_automatic_install_info_protocols (factory);
313 - print_plugin_automatic_install_info_codecs (factory);
314 + print_plugin_automatic_install_info_protocols (factory, rpm_format);
315 + print_plugin_automatic_install_info_codecs (factory, rpm_format);
318 gst_object_unref (feature_plugin);
319 @@ -1492,7 +1729,7 @@ print_all_plugin_automatic_install_info
320 plugin = (GstPlugin *) (plugins->data);
321 plugins = g_list_next (plugins);
323 - print_plugin_automatic_install_info (plugin);
324 + print_plugin_automatic_install_info (plugin, FALSE);
326 gst_plugin_list_free (orig_plugins);
328 @@ -1504,6 +1741,7 @@ main (int argc, char *argv[])
329 gboolean do_print_blacklist = FALSE;
330 gboolean plugin_name = FALSE;
331 gboolean print_aii = FALSE;
332 + gboolean print_aii_rpm = FALSE;
333 gboolean uri_handlers = FALSE;
334 gboolean check_exists = FALSE;
335 gchar *min_version = NULL;
336 @@ -1521,6 +1759,9 @@ main (int argc, char *argv[])
337 "or all plugins provide.\n "
338 "Useful in connection with external automatic plugin "
339 "installation mechanisms"), NULL},
340 + {"rpm", '\0', 0, G_OPTION_ARG_NONE, &print_aii_rpm,
341 + N_("Print the machine-parsable list of features of a plugin in RPM "
342 + "Provides compatible-format"), NULL},
343 {"plugin", '\0', 0, G_OPTION_ARG_NONE, &plugin_name,
344 N_("List the plugin contents"), NULL},
345 {"exists", '\0', 0, G_OPTION_ARG_NONE, &check_exists,
346 @@ -1650,7 +1891,7 @@ main (int argc, char *argv[])
347 /* if there is such a plugin, print out info */
350 - print_plugin_automatic_install_info (plugin);
351 + print_plugin_automatic_install_info (plugin, print_aii_rpm);
353 print_plugin_info (plugin);
354 print_plugin_features (plugin);
355 @@ -1663,13 +1904,17 @@ main (int argc, char *argv[])
359 - print_plugin_automatic_install_info (plugin);
360 + print_plugin_automatic_install_info (plugin, print_aii_rpm);
362 print_plugin_info (plugin);
363 print_plugin_features (plugin);
366 - g_printerr (_("Could not load plugin file: %s\n"), error->message);
367 + if (!print_aii_rpm)
368 + g_print (_("Could not load plugin file: %s\n"), error->message);
370 + g_printerr (_("Could not load plugin file: %s\n"),
372 g_error_free (error);