mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
autodetect: use _plugin_feature_rank_compare API instead of duplicating the code.
This commit is contained in:
parent
3230182a61
commit
504360fe36
4 changed files with 8 additions and 52 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 ...");
|
||||
|
||||
|
|
|
@ -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 ...");
|
||||
|
||||
|
|
Loading…
Reference in a new issue