tools, base: don't poke into GstTypeFindFactory struct, use public API

This commit is contained in:
Tim-Philipp Müller 2012-05-01 22:28:11 +01:00
parent ecf74cf2db
commit e73747a7e0
2 changed files with 19 additions and 14 deletions

View file

@ -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:

View file

@ -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");