mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-27 22:32:49 +00:00
- free type lists after use
Original commit message from CVS: - free type lists after use - sort typefinding functions before use - doc build fixes
This commit is contained in:
parent
08f4ab5d7f
commit
0dd7202b34
7 changed files with 46 additions and 11 deletions
|
@ -448,9 +448,9 @@ static void
|
|||
gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident)
|
||||
{
|
||||
GstData *data;
|
||||
GList *type_list = NULL;
|
||||
GstTypeFind gst_find;
|
||||
SpiderTypeFind find;
|
||||
GList *walk, *type_list = NULL;
|
||||
|
||||
g_return_if_fail (GST_IS_SPIDER_IDENTITY (ident));
|
||||
|
||||
|
@ -468,21 +468,21 @@ gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident)
|
|||
}
|
||||
|
||||
/* now do the actual typefinding with the supplied buffer */
|
||||
type_list = gst_type_find_factory_get_list ();
|
||||
walk = type_list = gst_type_find_factory_get_list ();
|
||||
|
||||
find.best_probability = 0;
|
||||
find.caps = NULL;
|
||||
gst_find.data = &find;
|
||||
gst_find.peek = spider_find_peek;
|
||||
gst_find.suggest = spider_find_suggest;
|
||||
while (type_list) {
|
||||
GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (type_list->data);
|
||||
while (walk) {
|
||||
GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (walk->data);
|
||||
|
||||
GST_DEBUG ("trying typefind function %s", GST_PLUGIN_FEATURE_NAME (factory));
|
||||
gst_type_find_factory_call_function (factory, &gst_find);
|
||||
if (find.best_probability >= GST_TYPE_FIND_MAXIMUM)
|
||||
goto plug;
|
||||
type_list = g_list_next (type_list);
|
||||
walk = g_list_next (walk);
|
||||
}
|
||||
if (find.best_probability > 0)
|
||||
goto plug;
|
||||
|
@ -504,6 +504,8 @@ plug:
|
|||
g_assert (gst_pad_try_set_caps (ident->src, find.caps) > 0);
|
||||
gst_caps_debug (find.caps, "spider starting caps");
|
||||
gst_caps_unref (find.caps);
|
||||
if (type_list)
|
||||
g_list_free (type_list);
|
||||
|
||||
gst_spider_identity_plug (ident);
|
||||
|
||||
|
|
|
@ -472,6 +472,11 @@ compare_type_find_entry (gconstpointer a, gconstpointer b)
|
|||
return two->probability - one->probability;
|
||||
}
|
||||
}
|
||||
static gint
|
||||
compare_type_find_factory (gconstpointer fac1, gconstpointer fac2)
|
||||
{
|
||||
return GST_PLUGIN_FEATURE (fac1)->rank - GST_PLUGIN_FEATURE (fac2)->rank;
|
||||
}
|
||||
static void
|
||||
gst_type_find_element_chain (GstPad *pad, GstData *data)
|
||||
{
|
||||
|
@ -495,10 +500,12 @@ gst_type_find_element_chain (GstPad *pad, GstData *data)
|
|||
gst_data_unref (data);
|
||||
if (typefind->possibilities == NULL) {
|
||||
/* not yet started, get all typefinding functions into our "queue" */
|
||||
const GList *all_factories = gst_type_find_factory_get_list ();
|
||||
GList *all_factories = gst_type_find_factory_get_list ();
|
||||
GST_INFO_OBJECT (typefind, "starting with %u typefinding functions",
|
||||
g_list_length ((GList *) all_factories));
|
||||
|
||||
all_factories = g_list_sort (all_factories, compare_type_find_factory);
|
||||
walk = all_factories;
|
||||
while (all_factories) {
|
||||
entry = g_new0 (TypeFindEntry, 1);
|
||||
|
||||
|
@ -508,6 +515,7 @@ gst_type_find_element_chain (GstPad *pad, GstData *data)
|
|||
typefind->possibilities = g_list_prepend (typefind->possibilities, entry);
|
||||
all_factories = g_list_next (all_factories);
|
||||
}
|
||||
g_list_free (all_factories);
|
||||
}
|
||||
/* call every typefind function once */
|
||||
walk = entries = typefind->possibilities;
|
||||
|
|
|
@ -472,6 +472,11 @@ compare_type_find_entry (gconstpointer a, gconstpointer b)
|
|||
return two->probability - one->probability;
|
||||
}
|
||||
}
|
||||
static gint
|
||||
compare_type_find_factory (gconstpointer fac1, gconstpointer fac2)
|
||||
{
|
||||
return GST_PLUGIN_FEATURE (fac1)->rank - GST_PLUGIN_FEATURE (fac2)->rank;
|
||||
}
|
||||
static void
|
||||
gst_type_find_element_chain (GstPad *pad, GstData *data)
|
||||
{
|
||||
|
@ -495,10 +500,12 @@ gst_type_find_element_chain (GstPad *pad, GstData *data)
|
|||
gst_data_unref (data);
|
||||
if (typefind->possibilities == NULL) {
|
||||
/* not yet started, get all typefinding functions into our "queue" */
|
||||
const GList *all_factories = gst_type_find_factory_get_list ();
|
||||
GList *all_factories = gst_type_find_factory_get_list ();
|
||||
GST_INFO_OBJECT (typefind, "starting with %u typefinding functions",
|
||||
g_list_length ((GList *) all_factories));
|
||||
|
||||
all_factories = g_list_sort (all_factories, compare_type_find_factory);
|
||||
walk = all_factories;
|
||||
while (all_factories) {
|
||||
entry = g_new0 (TypeFindEntry, 1);
|
||||
|
||||
|
@ -508,6 +515,7 @@ gst_type_find_element_chain (GstPad *pad, GstData *data)
|
|||
typefind->possibilities = g_list_prepend (typefind->possibilities, entry);
|
||||
all_factories = g_list_next (all_factories);
|
||||
}
|
||||
g_list_free (all_factories);
|
||||
}
|
||||
/* call every typefind function once */
|
||||
walk = entries = typefind->possibilities;
|
||||
|
|
|
@ -252,7 +252,7 @@ gst_type_find_factory_register (GstPlugin *plugin, const gchar *name, guint rank
|
|||
|
||||
/*** typefind function interface **********************************************/
|
||||
|
||||
/*
|
||||
/**
|
||||
* gst_type_find_peek:
|
||||
* @find: the find object the function was called with
|
||||
* @offset: the offset
|
||||
|
@ -274,7 +274,7 @@ gst_type_find_peek (GstTypeFind *find, gint64 offset, guint size)
|
|||
|
||||
return find->peek (find->data, offset, size);
|
||||
}
|
||||
/*
|
||||
/**
|
||||
* gst_type_find_suggest:
|
||||
* @find: the find object the function was called with
|
||||
* @probability: the probability in percent that the suggestion is right
|
||||
|
|
|
@ -67,6 +67,7 @@ struct _GstTypeFind {
|
|||
/* optional */
|
||||
guint64 (* get_length) (gpointer data);
|
||||
|
||||
/* <private> */
|
||||
GST_STRUCT_PADDING
|
||||
};
|
||||
|
||||
|
|
|
@ -472,6 +472,11 @@ compare_type_find_entry (gconstpointer a, gconstpointer b)
|
|||
return two->probability - one->probability;
|
||||
}
|
||||
}
|
||||
static gint
|
||||
compare_type_find_factory (gconstpointer fac1, gconstpointer fac2)
|
||||
{
|
||||
return GST_PLUGIN_FEATURE (fac1)->rank - GST_PLUGIN_FEATURE (fac2)->rank;
|
||||
}
|
||||
static void
|
||||
gst_type_find_element_chain (GstPad *pad, GstData *data)
|
||||
{
|
||||
|
@ -495,10 +500,12 @@ gst_type_find_element_chain (GstPad *pad, GstData *data)
|
|||
gst_data_unref (data);
|
||||
if (typefind->possibilities == NULL) {
|
||||
/* not yet started, get all typefinding functions into our "queue" */
|
||||
const GList *all_factories = gst_type_find_factory_get_list ();
|
||||
GList *all_factories = gst_type_find_factory_get_list ();
|
||||
GST_INFO_OBJECT (typefind, "starting with %u typefinding functions",
|
||||
g_list_length ((GList *) all_factories));
|
||||
|
||||
all_factories = g_list_sort (all_factories, compare_type_find_factory);
|
||||
walk = all_factories;
|
||||
while (all_factories) {
|
||||
entry = g_new0 (TypeFindEntry, 1);
|
||||
|
||||
|
@ -508,6 +515,7 @@ gst_type_find_element_chain (GstPad *pad, GstData *data)
|
|||
typefind->possibilities = g_list_prepend (typefind->possibilities, entry);
|
||||
all_factories = g_list_next (all_factories);
|
||||
}
|
||||
g_list_free (all_factories);
|
||||
}
|
||||
/* call every typefind function once */
|
||||
walk = entries = typefind->possibilities;
|
||||
|
|
|
@ -472,6 +472,11 @@ compare_type_find_entry (gconstpointer a, gconstpointer b)
|
|||
return two->probability - one->probability;
|
||||
}
|
||||
}
|
||||
static gint
|
||||
compare_type_find_factory (gconstpointer fac1, gconstpointer fac2)
|
||||
{
|
||||
return GST_PLUGIN_FEATURE (fac1)->rank - GST_PLUGIN_FEATURE (fac2)->rank;
|
||||
}
|
||||
static void
|
||||
gst_type_find_element_chain (GstPad *pad, GstData *data)
|
||||
{
|
||||
|
@ -495,10 +500,12 @@ gst_type_find_element_chain (GstPad *pad, GstData *data)
|
|||
gst_data_unref (data);
|
||||
if (typefind->possibilities == NULL) {
|
||||
/* not yet started, get all typefinding functions into our "queue" */
|
||||
const GList *all_factories = gst_type_find_factory_get_list ();
|
||||
GList *all_factories = gst_type_find_factory_get_list ();
|
||||
GST_INFO_OBJECT (typefind, "starting with %u typefinding functions",
|
||||
g_list_length ((GList *) all_factories));
|
||||
|
||||
all_factories = g_list_sort (all_factories, compare_type_find_factory);
|
||||
walk = all_factories;
|
||||
while (all_factories) {
|
||||
entry = g_new0 (TypeFindEntry, 1);
|
||||
|
||||
|
@ -508,6 +515,7 @@ gst_type_find_element_chain (GstPad *pad, GstData *data)
|
|||
typefind->possibilities = g_list_prepend (typefind->possibilities, entry);
|
||||
all_factories = g_list_next (all_factories);
|
||||
}
|
||||
g_list_free (all_factories);
|
||||
}
|
||||
/* call every typefind function once */
|
||||
walk = entries = typefind->possibilities;
|
||||
|
|
Loading…
Reference in a new issue