From 504360fe36429a8a9a5628a91dbc3c35ba68b495 Mon Sep 17 00:00:00 2001 From: Sreerenj Balachandran Date: Thu, 18 Apr 2013 12:20:08 +0300 Subject: [PATCH] autodetect: use _plugin_feature_rank_compare API instead of duplicating the code. --- gst/autodetect/gstautoaudiosink.c | 15 ++------------- gst/autodetect/gstautoaudiosrc.c | 15 ++------------- gst/autodetect/gstautovideosink.c | 15 ++------------- gst/autodetect/gstautovideosrc.c | 15 ++------------- 4 files changed, 8 insertions(+), 52 deletions(-) diff --git a/gst/autodetect/gstautoaudiosink.c b/gst/autodetect/gstautoaudiosink.c index b07479f..340e9a2 100644 --- a/gst/autodetect/gstautoaudiosink.c +++ b/gst/autodetect/gstautoaudiosink.c @@ -204,18 +204,6 @@ gst_auto_audio_sink_factory_filter (GstPluginFeature * feature, gpointer data) return TRUE; } -static gint -gst_auto_audio_sink_compare_ranks (GstPluginFeature * f1, GstPluginFeature * f2) -{ - gint diff; - - diff = gst_plugin_feature_get_rank (f2) - gst_plugin_feature_get_rank (f1); - if (diff != 0) - return diff; - return strcmp (gst_plugin_feature_get_name (f2), - gst_plugin_feature_get_name (f1)); -} - static GstElement * gst_auto_audio_sink_create_element_with_pretty_name (GstAutoAudioSink * sink, GstElementFactory * factory) @@ -251,7 +239,8 @@ gst_auto_audio_sink_find_best (GstAutoAudioSink * sink) list = gst_registry_feature_filter (gst_registry_get (), (GstPluginFeatureFilter) gst_auto_audio_sink_factory_filter, FALSE, sink); - list = g_list_sort (list, (GCompareFunc) gst_auto_audio_sink_compare_ranks); + list = + g_list_sort (list, (GCompareFunc) gst_plugin_feature_rank_compare_func); /* We don't treat sound server sinks special. Our policy is that sound * server sinks that have a rank must not auto-spawn a daemon under any diff --git a/gst/autodetect/gstautoaudiosrc.c b/gst/autodetect/gstautoaudiosrc.c index 5302537..f20cf57 100644 --- a/gst/autodetect/gstautoaudiosrc.c +++ b/gst/autodetect/gstautoaudiosrc.c @@ -198,18 +198,6 @@ gst_auto_audio_src_factory_filter (GstPluginFeature * feature, gpointer data) return TRUE; } -static gint -gst_auto_audio_src_compare_ranks (GstPluginFeature * f1, GstPluginFeature * f2) -{ - gint diff; - - diff = gst_plugin_feature_get_rank (f2) - gst_plugin_feature_get_rank (f1); - if (diff != 0) - return diff; - return strcmp (gst_plugin_feature_get_name (f2), - gst_plugin_feature_get_name (f1)); -} - static GstElement * gst_auto_audio_src_create_element_with_pretty_name (GstAutoAudioSrc * src, GstElementFactory * factory) @@ -245,7 +233,8 @@ gst_auto_audio_src_find_best (GstAutoAudioSrc * src) list = gst_registry_feature_filter (gst_registry_get (), (GstPluginFeatureFilter) gst_auto_audio_src_factory_filter, FALSE, src); - list = g_list_sort (list, (GCompareFunc) gst_auto_audio_src_compare_ranks); + list = + g_list_sort (list, (GCompareFunc) gst_plugin_feature_rank_compare_func); /* We don't treat sound server sources special. Our policy is that sound * server sources that have a rank must not auto-spawn a daemon under any diff --git a/gst/autodetect/gstautovideosink.c b/gst/autodetect/gstautovideosink.c index 58a9fd5..f598986 100644 --- a/gst/autodetect/gstautovideosink.c +++ b/gst/autodetect/gstautovideosink.c @@ -203,18 +203,6 @@ gst_auto_video_sink_factory_filter (GstPluginFeature * feature, gpointer data) return TRUE; } -static gint -gst_auto_video_sink_compare_ranks (GstPluginFeature * f1, GstPluginFeature * f2) -{ - gint diff; - - diff = gst_plugin_feature_get_rank (f2) - gst_plugin_feature_get_rank (f1); - if (diff != 0) - return diff; - return strcmp (gst_plugin_feature_get_name (f2), - gst_plugin_feature_get_name (f1)); -} - static GstElement * gst_auto_video_sink_create_element_with_pretty_name (GstAutoVideoSink * sink, GstElementFactory * factory) @@ -250,7 +238,8 @@ gst_auto_video_sink_find_best (GstAutoVideoSink * sink) list = gst_registry_feature_filter (gst_registry_get (), (GstPluginFeatureFilter) gst_auto_video_sink_factory_filter, FALSE, sink); - list = g_list_sort (list, (GCompareFunc) gst_auto_video_sink_compare_ranks); + list = + g_list_sort (list, (GCompareFunc) gst_plugin_feature_rank_compare_func); GST_LOG_OBJECT (sink, "Trying to find usable video devices ..."); diff --git a/gst/autodetect/gstautovideosrc.c b/gst/autodetect/gstautovideosrc.c index c541e6d..6c0ba09 100644 --- a/gst/autodetect/gstautovideosrc.c +++ b/gst/autodetect/gstautovideosrc.c @@ -197,18 +197,6 @@ gst_auto_video_src_factory_filter (GstPluginFeature * feature, gpointer data) return TRUE; } -static gint -gst_auto_video_src_compare_ranks (GstPluginFeature * f1, GstPluginFeature * f2) -{ - gint diff; - - diff = gst_plugin_feature_get_rank (f2) - gst_plugin_feature_get_rank (f1); - if (diff != 0) - return diff; - return strcmp (gst_plugin_feature_get_name (f2), - gst_plugin_feature_get_name (f1)); -} - static GstElement * gst_auto_video_src_create_element_with_pretty_name (GstAutoVideoSrc * src, GstElementFactory * factory) @@ -244,7 +232,8 @@ gst_auto_video_src_find_best (GstAutoVideoSrc * src) list = gst_registry_feature_filter (gst_registry_get (), (GstPluginFeatureFilter) gst_auto_video_src_factory_filter, FALSE, src); - list = g_list_sort (list, (GCompareFunc) gst_auto_video_src_compare_ranks); + list = + g_list_sort (list, (GCompareFunc) gst_plugin_feature_rank_compare_func); GST_LOG_OBJECT (src, "Trying to find usable video devices ..."); -- 2.7.4