mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-30 07:42:32 +00:00
plugins: embed GstAueueArray in dataqueue struct as well
This commit is contained in:
parent
92cba34e0b
commit
f72ba83a84
2 changed files with 13 additions and 12 deletions
|
@ -87,7 +87,7 @@ enum
|
||||||
q->cur_level.visible, \
|
q->cur_level.visible, \
|
||||||
q->cur_level.bytes, \
|
q->cur_level.bytes, \
|
||||||
q->cur_level.time, \
|
q->cur_level.time, \
|
||||||
q->queue->length)
|
q->queue.length)
|
||||||
|
|
||||||
static void gst_data_queue_finalize (GObject * object);
|
static void gst_data_queue_finalize (GObject * object);
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ gst_data_queue_init (GstDataQueue * queue)
|
||||||
g_mutex_init (&queue->qlock);
|
g_mutex_init (&queue->qlock);
|
||||||
g_cond_init (&queue->item_add);
|
g_cond_init (&queue->item_add);
|
||||||
g_cond_init (&queue->item_del);
|
g_cond_init (&queue->item_del);
|
||||||
queue->queue = gst_queue_array_new (50);
|
gst_queue_array_init (&queue->queue, 50);
|
||||||
|
|
||||||
GST_DEBUG ("initialized queue's not_empty & not_full conditions");
|
GST_DEBUG ("initialized queue's not_empty & not_full conditions");
|
||||||
}
|
}
|
||||||
|
@ -235,8 +235,8 @@ gst_data_queue_new (GstDataQueueCheckFullFunction checkfull, gpointer checkdata)
|
||||||
static void
|
static void
|
||||||
gst_data_queue_cleanup (GstDataQueue * queue)
|
gst_data_queue_cleanup (GstDataQueue * queue)
|
||||||
{
|
{
|
||||||
while (!gst_queue_array_is_empty (queue->queue)) {
|
while (!gst_queue_array_is_empty (&queue->queue)) {
|
||||||
GstDataQueueItem *item = gst_queue_array_pop_head (queue->queue);
|
GstDataQueueItem *item = gst_queue_array_pop_head (&queue->queue);
|
||||||
|
|
||||||
/* Just call the destroy notify on the item */
|
/* Just call the destroy notify on the item */
|
||||||
item->destroy (item);
|
item->destroy (item);
|
||||||
|
@ -255,7 +255,7 @@ gst_data_queue_finalize (GObject * object)
|
||||||
GST_DEBUG ("finalizing queue");
|
GST_DEBUG ("finalizing queue");
|
||||||
|
|
||||||
gst_data_queue_cleanup (queue);
|
gst_data_queue_cleanup (queue);
|
||||||
gst_queue_array_free (queue->queue);
|
gst_queue_array_clear (&queue->queue);
|
||||||
|
|
||||||
GST_DEBUG ("free mutex");
|
GST_DEBUG ("free mutex");
|
||||||
g_mutex_clear (&queue->qlock);
|
g_mutex_clear (&queue->qlock);
|
||||||
|
@ -281,7 +281,7 @@ gst_data_queue_locked_flush (GstDataQueue * queue)
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
gst_data_queue_locked_is_empty (GstDataQueue * queue)
|
gst_data_queue_locked_is_empty (GstDataQueue * queue)
|
||||||
{
|
{
|
||||||
return (queue->queue->length == 0);
|
return (queue->queue.length == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
|
@ -427,7 +427,7 @@ gst_data_queue_push (GstDataQueue * queue, GstDataQueueItem * item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_queue_array_push_tail (queue->queue, item);
|
gst_queue_array_push_tail (&queue->queue, item);
|
||||||
|
|
||||||
if (item->visible)
|
if (item->visible)
|
||||||
queue->cur_level.visible++;
|
queue->cur_level.visible++;
|
||||||
|
@ -491,7 +491,7 @@ gst_data_queue_pop (GstDataQueue * queue, GstDataQueueItem ** item)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the item from the GQueue */
|
/* Get the item from the GQueue */
|
||||||
*item = gst_queue_array_pop_head (queue->queue);
|
*item = gst_queue_array_pop_head (&queue->queue);
|
||||||
|
|
||||||
/* update current level counter */
|
/* update current level counter */
|
||||||
if ((*item)->visible)
|
if ((*item)->visible)
|
||||||
|
@ -543,13 +543,14 @@ gst_data_queue_drop_head (GstDataQueue * queue, GType type)
|
||||||
GST_DEBUG ("queue:%p", queue);
|
GST_DEBUG ("queue:%p", queue);
|
||||||
|
|
||||||
GST_DATA_QUEUE_MUTEX_LOCK (queue);
|
GST_DATA_QUEUE_MUTEX_LOCK (queue);
|
||||||
idx = gst_queue_array_find (queue->queue, is_of_type, GINT_TO_POINTER (type));
|
idx =
|
||||||
|
gst_queue_array_find (&queue->queue, is_of_type, GINT_TO_POINTER (type));
|
||||||
|
|
||||||
if (idx == -1)
|
if (idx == -1)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
leak = queue->queue->array[idx];
|
leak = queue->queue.array[idx];
|
||||||
gst_queue_array_drop_element (queue->queue, idx);
|
gst_queue_array_drop_element (&queue->queue, idx);
|
||||||
|
|
||||||
if (leak->visible)
|
if (leak->visible)
|
||||||
queue->cur_level.visible--;
|
queue->cur_level.visible--;
|
||||||
|
|
|
@ -114,7 +114,7 @@ struct _GstDataQueue
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
/* the array of data we're keeping our grubby hands on */
|
/* the array of data we're keeping our grubby hands on */
|
||||||
GstQueueArray *queue;
|
GstQueueArray queue;
|
||||||
|
|
||||||
GstDataQueueSize cur_level; /* size of the queue */
|
GstDataQueueSize cur_level; /* size of the queue */
|
||||||
GstDataQueueCheckFullFunction checkfull; /* Callback to check if the queue is full */
|
GstDataQueueCheckFullFunction checkfull; /* Callback to check if the queue is full */
|
||||||
|
|
Loading…
Reference in a new issue