From e73747a7e062204b5c8fb30cd37e168885f7d8d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 1 May 2012 22:28:11 +0100 Subject: [PATCH] tools, base: don't poke into GstTypeFindFactory struct, use public API --- libs/gst/base/gsttypefindhelper.c | 16 ++++++++-------- tools/gst-inspect.c | 17 +++++++++++------ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/libs/gst/base/gsttypefindhelper.c b/libs/gst/base/gsttypefindhelper.c index d9bbe72..cdb267a 100644 --- a/libs/gst/base/gsttypefindhelper.c +++ b/libs/gst/base/gsttypefindhelper.c @@ -308,9 +308,8 @@ gst_type_find_helper_get_range (GstObject * obj, GstObject * parent, extension); for (l = type_list; l; l = next) { + const gchar *const *ext; GstTypeFindFactory *factory; - gint i; - gchar **ext; next = l->next; @@ -323,8 +322,8 @@ gst_type_find_helper_get_range (GstObject * obj, GstObject * parent, GST_LOG_OBJECT (obj, "testing factory %s for extension %s", GST_OBJECT_NAME (factory), extension); - for (i = 0; ext[i]; i++) { - if (strcmp (ext[i], extension) == 0) { + while (*ext != NULL) { + if (strcmp (*ext, extension) == 0) { /* found extension, move in front */ GST_LOG_OBJECT (obj, "moving typefind for extension %s to head", extension); @@ -336,6 +335,7 @@ gst_type_find_helper_get_range (GstObject * obj, GstObject * parent, pos++; break; } + ++ext; } } } @@ -617,8 +617,7 @@ gst_type_find_helper_for_extension (GstObject * obj, const gchar * extension) for (l = type_list; l; l = g_list_next (l)) { GstTypeFindFactory *factory; - gchar **ext; - gint i; + const gchar *const *ext; factory = GST_TYPE_FIND_FACTORY (l->data); @@ -633,14 +632,15 @@ gst_type_find_helper_for_extension (GstObject * obj, const gchar * extension) /* there are extension, see if one of them matches the requested * extension */ - for (i = 0; ext[i]; i++) { - if (strcmp (ext[i], extension) == 0) { + while (*ext != NULL) { + if (strcmp (*ext, extension) == 0) { /* we found a matching extension, take the caps */ if ((result = gst_type_find_factory_get_caps (factory))) { gst_caps_ref (result); goto done; } } + ++ext; } } done: diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index b59bcb0..a8000e7 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -1026,17 +1026,20 @@ print_element_list (gboolean print_all) #endif } else if (GST_IS_TYPE_FIND_FACTORY (feature)) { GstTypeFindFactory *factory; + const gchar *const *extensions; factory = GST_TYPE_FIND_FACTORY (feature); if (!print_all) g_print ("%s: %s: ", gst_plugin_get_name (plugin), gst_plugin_feature_get_name (feature)); - if (factory->extensions) { + + extensions = gst_type_find_factory_get_extensions (factory); + if (extensions != NULL) { guint i = 0; - while (factory->extensions[i]) { + while (extensions[i]) { if (!print_all) - g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]); + g_print ("%s%s", i > 0 ? ", " : "", extensions[i]); i++; } if (!print_all) @@ -1224,15 +1227,17 @@ print_plugin_features (GstPlugin * plugin) #endif } else if (GST_IS_TYPE_FIND_FACTORY (feature)) { GstTypeFindFactory *factory; + const gchar *const *extensions; factory = GST_TYPE_FIND_FACTORY (feature); - if (factory->extensions) { + extensions = gst_type_find_factory_get_extensions (factory); + if (extensions) { guint i = 0; g_print ("%s: %s: ", gst_plugin_get_name (plugin), gst_plugin_feature_get_name (feature)); - while (factory->extensions[i]) { - g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]); + while (extensions[i]) { + g_print ("%s%s", i > 0 ? ", " : "", extensions[i]); i++; } g_print ("\n"); -- 2.7.4