}
static void
+print_all_uri_handlers (void)
+{
+ GList *plugins, *p, *features, *f;
+
+ plugins = gst_default_registry_get_plugin_list ();
+
+ for (p = plugins; p; p = p->next) {
+ GstPlugin *plugin = (GstPlugin *) (p->data);
+
+ features =
+ gst_registry_get_feature_list_by_plugin (gst_registry_get_default (),
+ plugin->desc.name);
+
+ for (f = features; f; f = f->next) {
+ GstPluginFeature *feature = GST_PLUGIN_FEATURE (features->data);
+
+ if (GST_IS_ELEMENT_FACTORY (feature)) {
+ GstElementFactory *factory;
+ GstElement *element;
+
+ factory = GST_ELEMENT_FACTORY (gst_plugin_feature_load (feature));
+ if (!factory) {
+ g_print ("element plugin %s couldn't be loaded\n", plugin->desc.name);
+ continue;
+ }
+
+ element = gst_element_factory_create (factory, NULL);
+ if (!element) {
+ g_print ("couldn't construct element for %s for some reason\n",
+ GST_OBJECT_NAME (factory));
+ gst_object_unref (factory);
+ continue;
+ }
+
+ if (GST_IS_URI_HANDLER (element)) {
+ const gchar *dir;
+ gchar **uri_protocols, *joined;
+
+ switch (gst_uri_handler_get_uri_type (GST_URI_HANDLER (element))) {
+ case GST_URI_SRC:
+ dir = "read";
+ break;
+ case GST_URI_SINK:
+ dir = "write";
+ break;
+ default:
+ dir = "unknown";
+ break;
+ }
+
+ uri_protocols =
+ gst_uri_handler_get_protocols (GST_URI_HANDLER (element));
+ joined = g_strjoinv (", ", uri_protocols);
+
+ g_print ("%s (%s, rank %u): %s\n", GST_OBJECT_NAME (factory), dir,
+ gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (factory)),
+ joined);
+
+ g_free (joined);
+ //g_strfreev (uri_protocols);
+ }
+
+ gst_object_unref (element);
+ gst_object_unref (factory);
+ }
+ }
+
+ gst_plugin_feature_list_free (features);
+ }
+
+ gst_plugin_list_free (plugins);
+}
+
+static void
print_plugin_info (GstPlugin * plugin)
{
n_print ("Plugin Details:\n");
gboolean print_all = FALSE;
gboolean plugin_name = FALSE;
gboolean print_aii = FALSE;
+ gboolean uri_handlers = FALSE;
GOptionEntry options[] = {
{"print-all", 'a', 0, G_OPTION_ARG_NONE, &print_all,
N_("Print all elements"), NULL},
"installation mechanisms"), NULL},
{"plugin", '\0', 0, G_OPTION_ARG_NONE, &plugin_name,
N_("List the plugin contents"), NULL},
+ {"uri-handlers", 'u', 0, G_OPTION_ARG_NONE, &uri_handlers,
+ N_
+ ("Print supported URI schemes, with the elements that implement them"),
+ NULL},
GST_TOOLS_GOPTION_VERSION,
{NULL}
};
gst_tools_print_version ("gst-inspect");
- if (print_all && argc > 2) {
+ if (print_all && argc > 1) {
g_print ("-a requires no extra arguments\n");
return 1;
}
+ if (uri_handlers && argc > 1) {
+ g_print ("-u requires no extra arguments\n");
+ exit (1);
+ }
+
/* if no arguments, print out list of elements */
- if (argc == 1 || print_all) {
+ if (uri_handlers) {
+ print_all_uri_handlers ();
+ } else if (argc == 1 || print_all) {
print_element_list (print_all);
- /* else we try to get a factory */
} else {
+ /* else we try to get a factory */
GstElementFactory *factory;
GstPlugin *plugin;
const char *arg = argv[argc - 1];