From 778ffac86afb30883946132d13935b64d2a7652b Mon Sep 17 00:00:00 2001 From: Wonchul Lee Date: Mon, 10 Oct 2016 17:08:11 +0900 Subject: [PATCH] parsebin: re-use existing compare_factories utils func https://bugzilla.gnome.org/show_bug.cgi?id=772676 --- gst/playback/gstparsebin.c | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/gst/playback/gstparsebin.c b/gst/playback/gstparsebin.c index 84de64d..cbb8552 100644 --- a/gst/playback/gstparsebin.c +++ b/gst/playback/gstparsebin.c @@ -104,9 +104,7 @@ #include "gstplay-enum.h" #include "gstplayback.h" - -/* Also used by gsturidecodebin.c */ -gint _parse_bin_compare_factories_func (gconstpointer p1, gconstpointer p2); +#include "gstplaybackutils.h" /* generic templates */ static GstStaticPadTemplate decoder_bin_sink_template = @@ -877,34 +875,6 @@ gst_parse_bin_class_init (GstParseBinClass * klass) g_type_class_ref (GST_TYPE_PARSE_PAD); } -gint -_parse_bin_compare_factories_func (gconstpointer p1, gconstpointer p2) -{ - GstPluginFeature *f1, *f2; - gboolean is_parser1, is_parser2; - - f1 = (GstPluginFeature *) p1; - f2 = (GstPluginFeature *) p2; - - is_parser1 = gst_element_factory_list_is_type (GST_ELEMENT_FACTORY_CAST (f1), - GST_ELEMENT_FACTORY_TYPE_PARSER); - is_parser2 = gst_element_factory_list_is_type (GST_ELEMENT_FACTORY_CAST (f2), - GST_ELEMENT_FACTORY_TYPE_PARSER); - - - /* We want all parsers first as we always want to plug parsers - * before decoders */ - if (is_parser1 && !is_parser2) - return -1; - else if (!is_parser1 && is_parser2) - return 1; - - /* And if it's a both a parser we first sort by rank - * and then by factory name */ - return gst_plugin_feature_rank_compare_func (p1, p2); -} - -/* Must be called with factories lock! */ static void gst_parse_bin_update_factories_list (GstParseBin * parsebin) { @@ -918,7 +888,8 @@ gst_parse_bin_update_factories_list (GstParseBin * parsebin) gst_element_factory_list_get_elements (GST_ELEMENT_FACTORY_TYPE_DECODABLE, GST_RANK_MARGINAL); parsebin->factories = - g_list_sort (parsebin->factories, _parse_bin_compare_factories_func); + g_list_sort (parsebin->factories, + gst_playback_utils_compare_factories_func); parsebin->factories_cookie = cookie; } } -- 2.7.4