-diff -u -p -r1.142 tools/gst-inspect.c
---- tools/gst-inspect.c 31 Jul 2008 15:20:31 -0000 1.142
-+++ tools/gst-inspect.c 11 Sep 2008 23:47:16 -0000
-@@ -1188,9 +1188,219 @@ print_element_info (GstElementFactory *
+diff -urp gstreamer-0.11.94.orig/tools/gst-inspect.c gstreamer-0.11.94/tools/gst-inspect.c
+--- gstreamer-0.11.94.orig/tools/gst-inspect.c 2012-09-01 18:02:10.000000000 -0400
++++ gstreamer-0.11.94/tools/gst-inspect.c 2012-09-14 08:04:52.690369047 -0400
+@@ -1350,9 +1350,225 @@ print_element_info (GstElementFactory *
return 0;
}
+static void
-+print_gst_structure_append_field (GList *strings, const char *field)
++print_gst_structure_append_field (GList * strings, const char *field)
+{
-+ GList *s;
++ GList *s;
+
-+ //g_message ("adding '%s' to the string", field);
++ //g_message ("adding '%s' to the string", field);
+
-+ for (s = strings; s != NULL; s = s->next) {
-+ g_string_append (s->data, field);
-+ }
++ for (s = strings; s != NULL; s = s->next) {
++ g_string_append (s->data, field);
++ }
+}
+
+static void
-+print_gst_structure_append_field_index (GList *strings, const char *field, guint num_items, guint offset)
++print_gst_structure_append_field_index (GList * strings, const char *field,
++ guint num_items, guint offset)
+{
-+ GList *s;
-+ guint i;
++ GList *s;
++ guint i;
+
-+ //g_message ("adding '%s' to the string (num: %d offset: %d)", field, num_items, offset);
++ //g_message ("adding '%s' to the string (num: %d offset: %d)", field, num_items, offset);
+
-+ for (s = strings, i = 0; s != NULL; s = s->next, i++) {
-+ if (i == offset) {
-+ //g_message ("adding '%s' at '%d'", field, i);
-+ g_string_append (s->data, field);
-+ }
-+ if (i == num_items)
-+ i = 0;
-+ }
++ for (s = strings, i = 0; s != NULL; s = s->next, i++) {
++ if (i == offset) {
++ //g_message ("adding '%s' at '%d'", field, i);
++ g_string_append (s->data, field);
++ }
++ if (i == num_items)
++ i = 0;
++ }
+
+}
+
+static GList *
-+print_gst_structure_dup_fields (GList *strings, guint num_items)
++print_gst_structure_dup_fields (GList * strings, guint num_items)
+{
-+ guint new_items, i;
++ guint new_items, i;
+
-+ if (num_items == 1)
-+ return strings;
++ if (num_items == 1)
++ return strings;
+
-+ //g_message ("creating %d new items", num_items);
++ //g_message ("creating %d new items", num_items);
+
-+ new_items = g_list_length (strings) * (num_items - 1);
-+ for (i = 0; i < new_items; i++) {
-+ GString *s, *first;
++ new_items = g_list_length (strings) * (num_items - 1);
++ for (i = 0; i < new_items; i++) {
++ GString *s, *first;
+
-+ first = strings->data;
-+ s = g_string_new_len (first->str, first->len);
-+ strings = g_list_prepend (strings, s);
-+ }
++ first = strings->data;
++ s = g_string_new_len (first->str, first->len);
++ strings = g_list_prepend (strings, s);
++ }
+
-+ return strings;
++ return strings;
+}
+
-+enum {
-+ FIELD_VERSION = 0,
-+ FIELD_LAYER,
-+ FIELD_VARIANT,
-+ FIELD_SYSTEMSTREAM
++enum
++{
++ FIELD_VERSION = 0,
++ FIELD_LAYER,
++ FIELD_VARIANT,
++ FIELD_SYSTEMSTREAM
+};
+
+static int
+field_get_type (const char *field_name)
+{
-+ if (strstr (field_name, "version") != NULL)
-+ return FIELD_VERSION;
-+ if (strcmp (field_name, "layer") == 0)
-+ return FIELD_LAYER;
-+ if (strcmp (field_name, "systemstream") == 0)
-+ return FIELD_SYSTEMSTREAM;
-+ if (strcmp (field_name, "variant") == 0)
-+ return FIELD_VARIANT;
-+
-+ return -1;
++ if (strstr (field_name, "version") != NULL)
++ return FIELD_VERSION;
++ if (strcmp (field_name, "layer") == 0)
++ return FIELD_LAYER;
++ if (strcmp (field_name, "systemstream") == 0)
++ return FIELD_SYSTEMSTREAM;
++ if (strcmp (field_name, "variant") == 0)
++ return FIELD_VARIANT;
++
++ return -1;
+}
+
+static gint
+fields_type_compare (const char *a, const char *b)
+{
-+ gint a_type, b_type;
-+
-+ a_type = field_get_type (a);
-+ b_type = field_get_type (b);
-+ if (a_type < b_type)
-+ return -1;
-+ if (b_type < a_type)
-+ return 1;
-+ return 0;
++ gint a_type, b_type;
++
++ a_type = field_get_type (a);
++ b_type = field_get_type (b);
++ if (a_type < b_type)
++ return -1;
++ if (b_type < a_type)
++ return 1;
++ return 0;
+}
+
+static void
-+print_gst_structure_for_rpm (const char *type_name, GstStructure *s)
++print_gst_structure_for_rpm (const char *type_name, GstStructure * s)
+{
+ guint i, num_fields;
+ const char *name;
+
+ field_name = gst_structure_nth_field_name (s, i);
+ if (field_get_type (field_name) < 0) {
-+ //g_message ("ignoring field named %s", field_name);
-+ continue;
++ //g_message ("ignoring field named %s", field_name);
++ continue;
+ }
+
-+ fields = g_list_insert_sorted (fields, g_strdup (field_name), (GCompareFunc) fields_type_compare);
++ fields =
++ g_list_insert_sorted (fields, g_strdup (field_name),
++ (GCompareFunc) fields_type_compare);
+ }
+
+ /* Example:
-+ * gstreamer0.10(decoder-video/mpeg)(mpegversion=1)()(64bit) */
-+ string = g_string_new ("gstreamer0.10");
++ * gstreamer1(decoder-video/mpeg)(mpegversion=1)()(64bit) */
++ string = g_string_new ("gstreamer1");
+ g_string_append_c (string, '(');
+ g_string_append (string, type_name);
+ g_string_append_c (string, '-');
+ char *field;
+
+ field = g_strdup_printf ("(%s=%d)", field_name, i);
-+ print_gst_structure_append_field_index (strings, field, max - min + 1, i - min);
++ print_gst_structure_append_field_index (strings, field, max - min + 1,
++ i - min);
+ g_free (field);
+ }
+ } else if (type == GST_TYPE_LIST) {
+ char *field;
+ const GValue *item_value;
+
-+ item_value = gst_value_list_get_value (value, i);
++ item_value = gst_value_list_get_value (value, i);
+ field = g_strdup_printf ("(%s=%d)", field_name,
-+ g_value_get_int (item_value));
++ g_value_get_int (item_value));
+ print_gst_structure_append_field_index (strings, field, num_items, i);
+ g_free (field);
+ }
static void
-print_plugin_automatic_install_info_codecs (GstElementFactory * factory)
-+print_plugin_automatic_install_info_codecs (GstElementFactory * factory, gboolean rpm_format)
++print_plugin_automatic_install_info_codecs (GstElementFactory * factory,
++ gboolean rpm_format)
{
GstPadDirection direction;
const gchar *type_name;
-@@ -1251,15 +1461,19 @@ print_plugin_automatic_install_info_code
+@@ -1377,6 +1593,12 @@ print_plugin_automatic_install_info_code
+ return;
+ }
+
++ if (rpm_format) {
++ /* Ignore NONE ranked plugins */
++ if ((gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (factory))) == GST_RANK_NONE)
++ return;
++ }
++
+ /* decoder/demuxer sink pads should always be static and there should only
+ * be one, the same applies to encoders/muxers and source pads */
+ static_templates = gst_element_factory_get_static_pad_templates (factory);
+@@ -1413,15 +1635,20 @@ print_plugin_automatic_install_info_code
gst_structure_remove_field (s, "rate");
gst_structure_remove_field (s, "depth");
gst_structure_remove_field (s, "clock-rate");
static void
-print_plugin_automatic_install_info_protocols (GstElementFactory * factory)
-+print_plugin_automatic_install_info_protocols (GstElementFactory * factory, gboolean rpm_format)
++print_plugin_automatic_install_info_protocols (GstElementFactory * factory,
++ gboolean rpm_format)
{
- gchar **protocols, **p;
+ const gchar *const *protocols;
-@@ -1268,11 +1482,17 @@ print_plugin_automatic_install_info_prot
+@@ -1430,13 +1657,19 @@ print_plugin_automatic_install_info_prot
switch (gst_element_factory_get_uri_type (factory)) {
case GST_URI_SINK:
- for (p = protocols; *p != NULL; ++p)
-- g_print ("urisink-%s\n", *p);
+ while (*protocols != NULL) {
+- g_print ("urisink-%s\n", *protocols);
+ if (!rpm_format)
-+ g_print ("urisink-%s\n", *p);
++ g_print ("urisink-%s\n", *protocols);
+ else
-+ g_print ("gstreamer0.10(urisink-%s)\n", *p);
++ g_print ("gstreamer1(urisink-%s)\n", *protocols);
+ ++protocols;
+ }
break;
case GST_URI_SRC:
- for (p = protocols; *p != NULL; ++p)
-- g_print ("urisource-%s\n", *p);
+ while (*protocols != NULL) {
+- g_print ("urisource-%s\n", *protocols);
+ if (!rpm_format)
-+ g_print ("urisource-%s\n", *p);
++ g_print ("urisource-%s\n", *protocols);
+ else
-+ g_print ("gstreamer0.10(urisource-%s)\n", *p);
- break;
- default:
++ g_print ("gstreamer1(urisource-%s)\n", *protocols);
+ ++protocols;
+ }
break;
-@@ -1282,7 +1502,7 @@ print_plugin_automatic_install_info_prot
+@@ -1447,7 +1680,7 @@ print_plugin_automatic_install_info_prot
}
static void
-print_plugin_automatic_install_info (GstPlugin * plugin)
+print_plugin_automatic_install_info (GstPlugin * plugin, gboolean rpm_format)
{
- const gchar *plugin_name;
GList *features, *l;
-@@ -1302,11 +1522,12 @@ print_plugin_automatic_install_info (Gst
- if (g_str_equal (plugin_name, feature->plugin_name)) {
+
+@@ -1466,11 +1699,15 @@ print_plugin_automatic_install_info (Gst
+ if (feature_plugin == plugin) {
GstElementFactory *factory;
- g_print ("element-%s\n", gst_plugin_feature_get_name (feature));
+ if (!rpm_format)
+ g_print ("element-%s\n", gst_plugin_feature_get_name (feature));
++ else
++ g_print ("gstreamer1(element-%s)\n",
++ gst_plugin_feature_get_name (feature));
factory = GST_ELEMENT_FACTORY (feature);
- print_plugin_automatic_install_info_protocols (factory);
+ print_plugin_automatic_install_info_protocols (factory, rpm_format);
+ print_plugin_automatic_install_info_codecs (factory, rpm_format);
}
- }
+ if (feature_plugin)
+ gst_object_unref (feature_plugin);
+@@ -1492,7 +1729,7 @@ print_all_plugin_automatic_install_info
+ plugin = (GstPlugin *) (plugins->data);
+ plugins = g_list_next (plugins);
-@@ -1319,6 +1540,7 @@ main (int argc, char *argv[])
- {
- gboolean print_all = FALSE;
+- print_plugin_automatic_install_info (plugin);
++ print_plugin_automatic_install_info (plugin, FALSE);
+ }
+ gst_plugin_list_free (orig_plugins);
+ }
+@@ -1504,6 +1741,7 @@ main (int argc, char *argv[])
+ gboolean do_print_blacklist = FALSE;
+ gboolean plugin_name = FALSE;
gboolean print_aii = FALSE;
+ gboolean print_aii_rpm = FALSE;
- GOptionEntry options[] = {
- {"print-all", 'a', 0, G_OPTION_ARG_NONE, &print_all,
- N_("Print all elements"), NULL},
-@@ -1327,6 +1549,9 @@ main (int argc, char *argv[])
- "provides.\n "
+ gboolean uri_handlers = FALSE;
+ gboolean check_exists = FALSE;
+ gchar *min_version = NULL;
+@@ -1521,6 +1759,9 @@ main (int argc, char *argv[])
+ "or all plugins provide.\n "
"Useful in connection with external automatic plugin "
"installation mechanisms"), NULL},
+ {"rpm", '\0', 0, G_OPTION_ARG_NONE, &print_aii_rpm,
-+ N_("Print the machine-parsable list of features of a plugin in RPM "
-+ "Provides compatible-format"), NULL},
- GST_TOOLS_GOPTION_VERSION,
- {NULL}
- };
-@@ -1384,7 +1609,7 @@ main (int argc, char *argv[])
++ N_("Print the machine-parsable list of features of a plugin in RPM "
++ "Provides compatible-format"), NULL},
+ {"plugin", '\0', 0, G_OPTION_ARG_NONE, &plugin_name,
+ N_("List the plugin contents"), NULL},
+ {"exists", '\0', 0, G_OPTION_ARG_NONE, &check_exists,
+@@ -1650,7 +1891,7 @@ main (int argc, char *argv[])
/* if there is such a plugin, print out info */
if (plugin) {
if (print_aii) {
} else {
print_plugin_info (plugin);
print_plugin_features (plugin);
-@@ -1397,13 +1622,16 @@ main (int argc, char *argv[])
+@@ -1663,13 +1904,17 @@ main (int argc, char *argv[])
if (plugin) {
if (print_aii) {
print_plugin_features (plugin);
}
} else {
-- g_print (_("Could not load plugin file: %s\n"), error->message);
+- g_printerr (_("Could not load plugin file: %s\n"), error->message);
+ if (!print_aii_rpm)
+ g_print (_("Could not load plugin file: %s\n"), error->message);
-+ else
-+ g_printerr (_("Could not load plugin file: %s\n"), error->message);
- g_error_free (error);
++ else
++ g_printerr (_("Could not load plugin file: %s\n"),
++ error->message);
+ g_clear_error (&error);
return -1;
}