mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
libs/gst/base/gsttypefindhelper.c: Try typefinding factories with the highest rank first.
Original commit message from CVS: * libs/gst/base/gsttypefindhelper.c: (type_find_factory_rank_cmp), (gst_type_find_helper): Try typefinding factories with the highest rank first.
This commit is contained in:
parent
cc13a984eb
commit
aad2aa1288
2 changed files with 25 additions and 16 deletions
|
@ -1,3 +1,9 @@
|
|||
2006-02-27 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* libs/gst/base/gsttypefindhelper.c: (type_find_factory_rank_cmp),
|
||||
(gst_type_find_helper):
|
||||
Try typefinding factories with the highest rank first.
|
||||
|
||||
2006-02-27 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* docs/libs/gstreamer-libs-docs.sgml:
|
||||
|
|
|
@ -40,9 +40,20 @@
|
|||
|
||||
#include "gsttypefindhelper.h"
|
||||
|
||||
/**
|
||||
* typefind code here
|
||||
*/
|
||||
static gint
|
||||
type_find_factory_rank_cmp (gconstpointer fac1, gconstpointer fac2)
|
||||
{
|
||||
if (GST_PLUGIN_FEATURE (fac1)->rank != GST_PLUGIN_FEATURE (fac2)->rank)
|
||||
return GST_PLUGIN_FEATURE (fac2)->rank - GST_PLUGIN_FEATURE (fac1)->rank;
|
||||
|
||||
/* to make the order in which things happen more deterministic,
|
||||
* sort by name when the ranks are the same. */
|
||||
return strcmp (GST_PLUGIN_FEATURE_NAME (fac1),
|
||||
GST_PLUGIN_FEATURE_NAME (fac2));
|
||||
}
|
||||
|
||||
/* ********************** typefinding in pull mode ************************ */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GstPad *src;
|
||||
|
@ -159,7 +170,9 @@ gst_type_find_helper (GstPad * src, guint64 size)
|
|||
g_return_val_if_fail (src != NULL, NULL);
|
||||
g_return_val_if_fail (GST_PAD_GETRANGEFUNC (src) != NULL, NULL);
|
||||
|
||||
walk = type_list = gst_type_find_factory_get_list ();
|
||||
type_list = gst_type_find_factory_get_list ();
|
||||
|
||||
type_list = g_list_sort (type_list, type_find_factory_rank_cmp);
|
||||
|
||||
find.src = src;
|
||||
find.best_probability = 0;
|
||||
|
@ -171,6 +184,8 @@ gst_type_find_helper (GstPad * src, guint64 size)
|
|||
gst_find.suggest = helper_find_suggest;
|
||||
gst_find.get_length = NULL;
|
||||
|
||||
walk = type_list;
|
||||
|
||||
while (walk) {
|
||||
GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (walk->data);
|
||||
|
||||
|
@ -248,18 +263,6 @@ buf_helper_find_suggest (gpointer data, guint prob, const GstCaps * caps)
|
|||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
type_find_factory_rank_cmp (gconstpointer fac1, gconstpointer fac2)
|
||||
{
|
||||
if (GST_PLUGIN_FEATURE (fac1)->rank != GST_PLUGIN_FEATURE (fac2)->rank)
|
||||
return GST_PLUGIN_FEATURE (fac2)->rank - GST_PLUGIN_FEATURE (fac1)->rank;
|
||||
|
||||
/* to make the order in which things happen more deterministic,
|
||||
* sort by name when the ranks are the same. */
|
||||
return strcmp (GST_PLUGIN_FEATURE_NAME (fac1),
|
||||
GST_PLUGIN_FEATURE_NAME (fac2));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_type_find_helper_for_buffer:
|
||||
* @obj: object doing the typefinding, or NULL (used for logging)
|
||||
|
|
Loading…
Reference in a new issue