mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-21 15:56:42 +00:00
bin: use statically allocated GQueue
Because we can.
This commit is contained in:
parent
2a4fca230f
commit
d2c713a9b5
1 changed files with 9 additions and 10 deletions
19
gst/gstbin.c
19
gst/gstbin.c
|
@ -1802,7 +1802,7 @@ gst_bin_get_state_func (GstElement * element, GstState * state,
|
||||||
typedef struct _GstBinSortIterator
|
typedef struct _GstBinSortIterator
|
||||||
{
|
{
|
||||||
GstIterator it;
|
GstIterator it;
|
||||||
GQueue *queue; /* elements queued for state change */
|
GQueue queue; /* elements queued for state change */
|
||||||
GstBin *bin; /* bin we iterate */
|
GstBin *bin; /* bin we iterate */
|
||||||
gint mode; /* adding or removing dependency */
|
gint mode; /* adding or removing dependency */
|
||||||
GstElement *best; /* next element with least dependencies */
|
GstElement *best; /* next element with least dependencies */
|
||||||
|
@ -1826,7 +1826,7 @@ add_to_queue (GstBinSortIterator * bit, GstElement * element)
|
||||||
GST_DEBUG_OBJECT (bit->bin, "adding '%s' to queue",
|
GST_DEBUG_OBJECT (bit->bin, "adding '%s' to queue",
|
||||||
GST_ELEMENT_NAME (element));
|
GST_ELEMENT_NAME (element));
|
||||||
gst_object_ref (element);
|
gst_object_ref (element);
|
||||||
g_queue_push_tail (bit->queue, element);
|
g_queue_push_tail (&bit->queue, element);
|
||||||
HASH_SET_DEGREE (bit, element, -1);
|
HASH_SET_DEGREE (bit, element, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1835,11 +1835,11 @@ remove_from_queue (GstBinSortIterator * bit, GstElement * element)
|
||||||
{
|
{
|
||||||
GList *find;
|
GList *find;
|
||||||
|
|
||||||
if ((find = g_queue_find (bit->queue, element))) {
|
if ((find = g_queue_find (&bit->queue, element))) {
|
||||||
GST_DEBUG_OBJECT (bit->bin, "removing '%s' from queue",
|
GST_DEBUG_OBJECT (bit->bin, "removing '%s' from queue",
|
||||||
GST_ELEMENT_NAME (element));
|
GST_ELEMENT_NAME (element));
|
||||||
|
|
||||||
g_queue_delete_link (bit->queue, find);
|
g_queue_delete_link (&bit->queue, find);
|
||||||
gst_object_unref (element);
|
gst_object_unref (element);
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (bit->bin, "unable to remove '%s' from queue",
|
GST_DEBUG_OBJECT (bit->bin, "unable to remove '%s' from queue",
|
||||||
|
@ -1995,7 +1995,7 @@ gst_bin_sort_iterator_next (GstBinSortIterator * bit, gpointer * result)
|
||||||
GstBin *bin = bit->bin;
|
GstBin *bin = bit->bin;
|
||||||
|
|
||||||
/* empty queue, we have to find a next best element */
|
/* empty queue, we have to find a next best element */
|
||||||
if (g_queue_is_empty (bit->queue)) {
|
if (g_queue_is_empty (&bit->queue)) {
|
||||||
GstElement *best;
|
GstElement *best;
|
||||||
|
|
||||||
bit->best = NULL;
|
bit->best = NULL;
|
||||||
|
@ -2023,7 +2023,7 @@ gst_bin_sort_iterator_next (GstBinSortIterator * bit, gpointer * result)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* everything added to the queue got reffed */
|
/* everything added to the queue got reffed */
|
||||||
*result = g_queue_pop_head (bit->queue);
|
*result = g_queue_pop_head (&bit->queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (bin, "queue head gives %s", GST_ELEMENT_NAME (*result));
|
GST_DEBUG_OBJECT (bin, "queue head gives %s", GST_ELEMENT_NAME (*result));
|
||||||
|
@ -2041,7 +2041,7 @@ gst_bin_sort_iterator_resync (GstBinSortIterator * bit)
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (bin, "resync");
|
GST_DEBUG_OBJECT (bin, "resync");
|
||||||
bit->dirty = FALSE;
|
bit->dirty = FALSE;
|
||||||
clear_queue (bit->queue);
|
clear_queue (&bit->queue);
|
||||||
/* reset degrees */
|
/* reset degrees */
|
||||||
g_list_foreach (bin->children, (GFunc) reset_degree, bit);
|
g_list_foreach (bin->children, (GFunc) reset_degree, bit);
|
||||||
/* calc degrees, incrementing */
|
/* calc degrees, incrementing */
|
||||||
|
@ -2058,8 +2058,7 @@ gst_bin_sort_iterator_free (GstBinSortIterator * bit)
|
||||||
GstBin *bin = bit->bin;
|
GstBin *bin = bit->bin;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (bin, "free");
|
GST_DEBUG_OBJECT (bin, "free");
|
||||||
clear_queue (bit->queue);
|
clear_queue (&bit->queue);
|
||||||
g_queue_free (bit->queue);
|
|
||||||
g_hash_table_destroy (bit->hash);
|
g_hash_table_destroy (bit->hash);
|
||||||
gst_object_unref (bin);
|
gst_object_unref (bin);
|
||||||
g_free (bit);
|
g_free (bit);
|
||||||
|
@ -2082,7 +2081,7 @@ gst_bin_sort_iterator_new (GstBin * bin)
|
||||||
(GstIteratorItemFunction) NULL,
|
(GstIteratorItemFunction) NULL,
|
||||||
(GstIteratorResyncFunction) gst_bin_sort_iterator_resync,
|
(GstIteratorResyncFunction) gst_bin_sort_iterator_resync,
|
||||||
(GstIteratorFreeFunction) gst_bin_sort_iterator_free);
|
(GstIteratorFreeFunction) gst_bin_sort_iterator_free);
|
||||||
result->queue = g_queue_new ();
|
g_queue_init (&result->queue);
|
||||||
result->hash = g_hash_table_new (NULL, NULL);
|
result->hash = g_hash_table_new (NULL, NULL);
|
||||||
gst_object_ref (bin);
|
gst_object_ref (bin);
|
||||||
result->bin = bin;
|
result->bin = bin;
|
||||||
|
|
Loading…
Reference in a new issue