2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 /* #define DEBUG_ENABLED */
24 /* #define STATUS_ENABLED */
26 #define STATUS(A) GST_DEBUG(GST_CAT_DATAFLOW, A, GST_ELEMENT_NAME(queue))
34 #include "gst_private.h"
37 #include "gstscheduler.h"
40 GstElementDetails gst_queue_details = {
45 "Erik Walthinsen <omega@cse.ogi.edu>",
50 /* Queue signals and args */
73 static void gst_queue_class_init (GstQueueClass *klass);
74 static void gst_queue_init (GstQueue *queue);
75 static void gst_queue_dispose (GObject *object);
77 static void gst_queue_set_property (GObject *object, guint prop_id,
78 const GValue *value, GParamSpec *pspec);
79 static void gst_queue_get_property (GObject *object, guint prop_id,
80 GValue *value, GParamSpec *pspec);
82 static void gst_queue_chain (GstPad *pad, GstBuffer *buf);
83 static GstBuffer * gst_queue_get (GstPad *pad);
84 static GstBufferPool* gst_queue_get_bufferpool (GstPad *pad);
86 static gboolean gst_queue_handle_src_event (GstPad *pad, GstEvent *event);
89 static void gst_queue_locked_flush (GstQueue *queue);
91 static GstElementStateReturn gst_queue_change_state (GstElement *element);
92 static gboolean gst_queue_release_locks (GstElement *element);
95 #define GST_TYPE_QUEUE_LEAKY (queue_leaky_get_type())
97 queue_leaky_get_type(void) {
98 static GType queue_leaky_type = 0;
99 static GEnumValue queue_leaky[] = {
100 { GST_QUEUE_NO_LEAK, "0", "Not Leaky" },
101 { GST_QUEUE_LEAK_UPSTREAM, "1", "Leaky on Upstream" },
102 { GST_QUEUE_LEAK_DOWNSTREAM, "2", "Leaky on Downstream" },
105 if (!queue_leaky_type) {
106 queue_leaky_type = g_enum_register_static("GstQueueLeaky", queue_leaky);
108 return queue_leaky_type;
111 static GstElementClass *parent_class = NULL;
112 /* static guint gst_queue_signals[LAST_SIGNAL] = { 0 }; */
115 gst_queue_get_type(void)
117 static GType queue_type = 0;
120 static const GTypeInfo queue_info = {
121 sizeof(GstQueueClass),
124 (GClassInitFunc)gst_queue_class_init,
129 (GInstanceInitFunc)gst_queue_init,
132 queue_type = g_type_register_static (GST_TYPE_ELEMENT, "GstQueue", &queue_info, 0);
138 gst_queue_class_init (GstQueueClass *klass)
140 GObjectClass *gobject_class;
141 GstElementClass *gstelement_class;
143 gobject_class = (GObjectClass*)klass;
144 gstelement_class = (GstElementClass*)klass;
146 parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
148 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEAKY,
149 g_param_spec_enum ("leaky", "Leaky", "Where the queue leaks, if at all.",
150 GST_TYPE_QUEUE_LEAKY, GST_QUEUE_NO_LEAK, G_PARAM_READWRITE));
151 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEVEL,
152 g_param_spec_int ("level", "Level", "How many buffers are in the queue.",
153 0, G_MAXINT, 0, G_PARAM_READABLE));
154 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_LEVEL,
155 g_param_spec_int ("max_level", "Maximum Level", "How many buffers the queue holds.",
156 0, G_MAXINT, 100, G_PARAM_READWRITE));
157 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAY_DEADLOCK,
158 g_param_spec_boolean ("may_deadlock", "May Deadlock", "The queue may deadlock if it's full and not PLAYING",
159 TRUE, G_PARAM_READWRITE));
160 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLOCK_TIMEOUT,
161 g_param_spec_int ("block_timeout", "Timeout for Block",
162 "Microseconds until blocked queue times out and returns filler event. "
163 "Value of -1 disables timeout",
164 -1, G_MAXINT, -1, G_PARAM_READWRITE));
166 gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_queue_dispose);
167 gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_queue_set_property);
168 gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_queue_get_property);
170 gstelement_class->change_state = GST_DEBUG_FUNCPTR(gst_queue_change_state);
171 gstelement_class->release_locks = GST_DEBUG_FUNCPTR(gst_queue_release_locks);
174 static GstPadConnectReturn
175 gst_queue_connect (GstPad *pad, GstCaps *caps)
177 GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad));
180 if (pad == queue->srcpad)
181 otherpad = queue->sinkpad;
183 otherpad = queue->srcpad;
185 return gst_pad_proxy_connect (otherpad, caps);
189 gst_queue_getcaps (GstPad *pad, GstCaps *caps)
191 GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad));
194 if (pad == queue->srcpad)
195 otherpad = queue->sinkpad;
197 otherpad = queue->srcpad;
199 return gst_pad_get_allowed_caps (otherpad);
203 gst_queue_init (GstQueue *queue)
205 /* scheduling on this kind of element is, well, interesting */
206 GST_FLAG_SET (queue, GST_ELEMENT_DECOUPLED);
207 GST_FLAG_SET (queue, GST_ELEMENT_EVENT_AWARE);
209 queue->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
210 gst_pad_set_chain_function (queue->sinkpad, GST_DEBUG_FUNCPTR (gst_queue_chain));
211 gst_element_add_pad (GST_ELEMENT (queue), queue->sinkpad);
212 gst_pad_set_bufferpool_function (queue->sinkpad, GST_DEBUG_FUNCPTR (gst_queue_get_bufferpool));
213 gst_pad_set_connect_function (queue->sinkpad, GST_DEBUG_FUNCPTR (gst_queue_connect));
214 gst_pad_set_getcaps_function (queue->sinkpad, GST_DEBUG_FUNCPTR (gst_queue_getcaps));
216 queue->srcpad = gst_pad_new ("src", GST_PAD_SRC);
217 gst_pad_set_get_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_queue_get));
218 gst_element_add_pad (GST_ELEMENT (queue), queue->srcpad);
219 gst_pad_set_connect_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_queue_connect));
220 gst_pad_set_getcaps_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_queue_getcaps));
221 gst_pad_set_event_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_queue_handle_src_event));
223 queue->leaky = GST_QUEUE_NO_LEAK;
225 queue->level_buffers = 0;
226 queue->level_bytes = 0;
227 queue->level_time = 0LL;
228 queue->size_buffers = 100; /* 100 buffers */
229 queue->size_bytes = 100 * 1024; /* 100KB */
230 queue->size_time = 1000000000LL; /* 1sec */
231 queue->may_deadlock = TRUE;
232 queue->block_timeout = -1;
233 queue->interrupt = FALSE;
234 queue->flush = FALSE;
236 queue->qlock = g_mutex_new ();
237 queue->reader = FALSE;
238 queue->writer = FALSE;
239 queue->not_empty = g_cond_new ();
240 queue->not_full = g_cond_new ();
241 queue->events = g_async_queue_new();
242 GST_DEBUG_ELEMENT (GST_CAT_THREAD, queue, "initialized queue's not_empty & not_full conditions");
246 gst_queue_dispose (GObject *object)
248 GstQueue *queue = GST_QUEUE (object);
250 g_mutex_free (queue->qlock);
251 g_cond_free (queue->not_empty);
252 g_cond_free (queue->not_full);
254 g_async_queue_unref(queue->events);
256 G_OBJECT_CLASS (parent_class)->dispose (object);
259 static GstBufferPool*
260 gst_queue_get_bufferpool (GstPad *pad)
264 queue = GST_QUEUE (GST_OBJECT_PARENT (pad));
266 return gst_pad_get_bufferpool (queue->srcpad);
270 gst_queue_cleanup_buffers (gpointer data, const gpointer user_data)
272 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, user_data, "cleaning buffer %p", data);
274 if (GST_IS_BUFFER (data)) {
275 gst_buffer_unref (GST_BUFFER (data));
278 gst_event_free (GST_EVENT (data));
283 gst_queue_locked_flush (GstQueue *queue)
285 g_list_foreach (queue->queue, gst_queue_cleanup_buffers,
287 g_list_free (queue->queue);
290 queue->level_buffers = 0;
291 queue->timeval = NULL;
292 /* make sure any pending buffers to be added are flushed too */
297 gst_queue_chain (GstPad *pad, GstBuffer *buf)
302 g_return_if_fail (pad != NULL);
303 g_return_if_fail (GST_IS_PAD (pad));
304 g_return_if_fail (buf != NULL);
306 queue = GST_QUEUE (GST_OBJECT_PARENT (pad));
308 /* check for events to send upstream */
309 g_async_queue_lock(queue->events);
310 while (g_async_queue_length_unlocked(queue->events) > 0){
311 GstEvent *event = (GstEvent*)g_async_queue_pop_unlocked(queue->events);
312 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "sending event upstream\n");
313 gst_pad_event_default (pad, event);
314 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "event sent\n");
316 g_async_queue_unlock(queue->events);
319 /* we have to lock the queue since we span threads */
320 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%ld", pthread_self ());
321 g_mutex_lock (queue->qlock);
322 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%ld", pthread_self ());
324 /* assume don't need to flush this buffer when the queue is filled */
325 queue->flush = FALSE;
327 if (GST_IS_EVENT (buf)) {
328 switch (GST_EVENT_TYPE (buf)) {
329 case GST_EVENT_FLUSH:
330 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "FLUSH event, flushing queue\n");
331 gst_queue_locked_flush (queue);
334 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "eos in on %s %d\n",
335 GST_ELEMENT_NAME (queue), queue->level_buffers);
337 case GST_EVENT_DISCONTINUOUS:
338 gst_queue_locked_flush (queue);
341 /*gst_pad_event_default (pad, GST_EVENT (buf)); */
346 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "adding buffer %p of size %d",buf,GST_BUFFER_SIZE(buf));
348 if (queue->level_buffers == queue->size_buffers) {
349 /* if this is a leaky queue... */
351 /* FIXME don't want to leak events! */
352 /* if we leak on the upstream side, drop the current buffer */
353 if (queue->leaky == GST_QUEUE_LEAK_UPSTREAM) {
354 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on upstream end");
355 if (GST_IS_EVENT (buf))
356 fprintf(stderr, "Error: queue [%s] leaked an event, type:%d\n",
357 GST_ELEMENT_NAME(GST_ELEMENT(queue)),
358 GST_EVENT_TYPE(GST_EVENT(buf)));
359 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on upstream end");
360 gst_buffer_unref(buf);
361 /* now we have to clean up and exit right away */
362 g_mutex_unlock (queue->qlock);
365 /* otherwise we have to push a buffer off the other end */
369 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue is full, leaking buffer on downstream end");
370 front = queue->queue;
371 leakbuf = (GstBuffer *)(front->data);
372 if (GST_IS_EVENT (leakbuf))
373 fprintf(stderr, "Error: queue [%s] leaked an event, type:%d\n",
374 GST_ELEMENT_NAME(GST_ELEMENT(queue)),
375 GST_EVENT_TYPE(GST_EVENT(leakbuf)));
376 queue->level_buffers--;
377 queue->level_bytes -= GST_BUFFER_SIZE(leakbuf);
378 gst_buffer_unref(leakbuf);
379 queue->queue = g_list_remove_link (queue->queue, front);
384 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre full wait, level:%d/%d",
385 queue->level_buffers, queue->size_buffers);
386 while (queue->level_buffers == queue->size_buffers) {
387 /* if there's a pending state change for this queue or its manager, switch */
388 /* back to iterator so bottom half of state change executes */
389 if (queue->interrupt) {
390 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!");
391 g_mutex_unlock (queue->qlock);
392 if (gst_scheduler_interrupt (GST_RPAD_SCHED (queue->sinkpad), GST_ELEMENT (queue)))
394 /* if we got here bacause we were unlocked after a flush, we don't need
395 * to add the buffer to the queue again */
397 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "not adding pending buffer after flush");
400 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "adding pending buffer after interrupt");
403 if (GST_STATE (queue) != GST_STATE_PLAYING) {
404 /* this means the other end is shut down */
405 /* try to signal to resolve the error */
406 if (!queue->may_deadlock) {
407 if (GST_IS_BUFFER (buf)) gst_buffer_unref (buf);
408 else gst_event_free (GST_EVENT (buf));
409 g_mutex_unlock (queue->qlock);
410 gst_element_error (GST_ELEMENT (queue), "deadlock found, source pad elements are shut down");
414 g_print ("%s: waiting for the app to restart source pad elements\n", GST_ELEMENT_NAME (queue));
418 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "waiting for not_full, level:%d/%d",
419 queue->level_buffers, queue->size_buffers);
421 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "WARNING: multiple writers on queue!");
422 queue->writer = TRUE;
423 g_cond_wait (queue->not_full, queue->qlock);
424 queue->writer = FALSE;
425 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "got not_full signal");
427 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "post full wait, level:%d/%d",
428 queue->level_buffers, queue->size_buffers);
431 /* put the buffer on the tail of the list */
432 queue->queue = g_list_append (queue->queue, buf);
433 queue->level_buffers++;
434 queue->level_bytes += GST_BUFFER_SIZE(buf);
436 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "(%s:%s)+ level:%d/%d",
437 GST_DEBUG_PAD_NAME(pad),
438 queue->level_buffers, queue->size_buffers);
440 /* this assertion _has_ to hold */
441 /* g_assert (g_list_length (queue->queue) == queue->level_buffers); */
443 /* reader waiting on an empty queue */
444 reader = queue->reader;
446 g_mutex_unlock (queue->qlock);
450 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "signalling not_empty");
451 g_cond_signal (queue->not_empty);
456 gst_queue_get (GstPad *pad)
459 GstBuffer *buf = NULL;
463 g_assert(pad != NULL);
464 g_assert(GST_IS_PAD(pad));
465 g_return_val_if_fail (pad != NULL, NULL);
466 g_return_val_if_fail (GST_IS_PAD (pad), NULL);
468 queue = GST_QUEUE (GST_OBJECT_PARENT (pad));
473 /* have to lock for thread-safety */
474 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locking t:%ld", pthread_self ());
475 g_mutex_lock (queue->qlock);
476 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "locked t:%ld %p", pthread_self (), queue->not_empty);
478 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "pre empty wait, level:%d/%d", queue->level_buffers, queue->size_buffers);
479 while (queue->level_buffers == 0) {
480 /* if there's a pending state change for this queue or its manager, switch
481 * back to iterator so bottom half of state change executes
483 //while (GST_STATE_PENDING (queue) != GST_STATE_VOID_PENDING) {
484 if (queue->interrupt) {
485 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "interrupted!!");
486 g_mutex_unlock (queue->qlock);
487 if (gst_scheduler_interrupt (GST_RPAD_SCHED (queue->srcpad), GST_ELEMENT (queue)))
491 if (GST_STATE (queue) != GST_STATE_PLAYING) {
492 /* this means the other end is shut down */
493 if (!queue->may_deadlock) {
494 g_mutex_unlock (queue->qlock);
495 gst_element_error (GST_ELEMENT (queue), "deadlock found, sink pad elements are shut down");
499 g_print ("%s: waiting for the app to restart source pad elements\n", GST_ELEMENT_NAME (queue));
503 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "waiting for not_empty, level:%d/%d", queue->level_buffers, queue->size_buffers);
505 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "WARNING: multiple readers on queue!");
506 queue->reader = TRUE;
508 if (queue->block_timeout > -1){
510 g_get_current_time(&timeout);
511 g_time_val_add(&timeout, queue->block_timeout);
512 if (!g_cond_timed_wait (queue->not_empty, queue->qlock, &timeout)){
513 g_mutex_unlock (queue->qlock);
514 return GST_BUFFER(gst_event_new_filler());
518 g_cond_wait (queue->not_empty, queue->qlock);
520 queue->reader = FALSE;
521 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "got not_empty signal");
523 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "post empty wait, level:%d/%d", queue->level_buffers, queue->size_buffers);
525 front = queue->queue;
526 buf = (GstBuffer *)(front->data);
527 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "retrieved buffer %p from queue", buf);
528 queue->queue = g_list_remove_link (queue->queue, front);
531 queue->level_buffers--;
532 queue->level_bytes -= GST_BUFFER_SIZE(buf);
534 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "(%s:%s)- level:%d/%d",
535 GST_DEBUG_PAD_NAME(pad),
536 queue->level_buffers, queue->size_buffers);
538 /* this assertion _has_ to hold */
539 /* g_assert (g_list_length (queue->queue) == queue->level_buffers); */
541 /* writer waiting on a full queue */
542 writer = queue->writer;
544 g_mutex_unlock (queue->qlock);
548 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "signalling not_full");
549 g_cond_signal (queue->not_full);
552 /* FIXME where should this be? locked? */
553 if (GST_IS_EVENT(buf)) {
554 GstEvent *event = GST_EVENT(buf);
555 switch (GST_EVENT_TYPE(event)) {
557 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue \"%s\" eos", GST_ELEMENT_NAME (queue));
558 gst_element_set_eos (GST_ELEMENT (queue));
570 gst_queue_handle_src_event (GstPad *pad, GstEvent *event)
575 queue = GST_QUEUE (GST_OBJECT_PARENT (pad));
577 g_mutex_lock (queue->qlock);
579 if (gst_element_get_state (GST_ELEMENT (queue)) == GST_STATE_PLAYING) {
580 /* push the event to the queue for upstream consumption */
581 g_async_queue_push(queue->events, event);
582 g_mutex_unlock (queue->qlock);
583 g_warning ("FIXME: sending event in a running queue");
584 /* FIXME wait for delivery of the event here, then return the result
585 * instead of FALSE */
589 res = gst_pad_event_default (pad, event);
590 switch (GST_EVENT_TYPE (event)) {
591 case GST_EVENT_FLUSH:
592 GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "FLUSH event, flushing queue\n");
593 gst_queue_locked_flush (queue);
596 if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH) {
597 gst_queue_locked_flush (queue);
602 g_mutex_unlock (queue->qlock);
604 /* we have to claim success, but we don't really know */
609 gst_queue_release_locks (GstElement *element)
613 queue = GST_QUEUE (element);
615 g_mutex_lock (queue->qlock);
616 queue->interrupt = TRUE;
617 g_cond_signal (queue->not_full);
618 g_cond_signal (queue->not_empty);
619 g_mutex_unlock (queue->qlock);
624 static GstElementStateReturn
625 gst_queue_change_state (GstElement *element)
628 GstElementStateReturn ret;
629 GstElementState new_state;
630 g_return_val_if_fail (GST_IS_QUEUE (element), GST_STATE_FAILURE);
632 queue = GST_QUEUE (element);
634 GST_DEBUG_ENTER("('%s')", GST_ELEMENT_NAME (element));
636 /* lock the queue so another thread (not in sync with this thread's state)
637 * can't call this queue's _get (or whatever)
639 g_mutex_lock (queue->qlock);
641 new_state = GST_STATE_PENDING (element);
643 if (new_state == GST_STATE_PAUSED) {
644 /*g_cond_signal (queue->not_full); */
645 /*g_cond_signal (queue->not_empty); */
647 else if (new_state == GST_STATE_READY) {
648 gst_queue_locked_flush (queue);
650 else if (new_state == GST_STATE_PLAYING) {
651 if (!GST_PAD_IS_CONNECTED (queue->sinkpad)) {
652 GST_DEBUG_ELEMENT (GST_CAT_STATES, queue, "queue %s is not connected", GST_ELEMENT_NAME (queue));
653 /* FIXME can this be? */
655 g_cond_signal (queue->not_empty);
656 g_mutex_unlock (queue->qlock);
658 return GST_STATE_FAILURE;
660 queue->interrupt = FALSE;
663 ret = GST_ELEMENT_CLASS (parent_class)->change_state (element);
664 g_mutex_unlock (queue->qlock);
666 GST_DEBUG_LEAVE("('%s')", GST_ELEMENT_NAME (element));
672 gst_queue_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
676 /* it's not null if we got it, but it might not be ours */
677 g_return_if_fail (GST_IS_QUEUE (object));
679 queue = GST_QUEUE (object);
683 queue->leaky = g_value_get_enum (value);
686 queue->size_buffers = g_value_get_int (value);
688 case ARG_MAY_DEADLOCK:
689 queue->may_deadlock = g_value_get_boolean (value);
691 case ARG_BLOCK_TIMEOUT:
692 queue->block_timeout = g_value_get_int (value);
695 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
701 gst_queue_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
705 /* it's not null if we got it, but it might not be ours */
706 g_return_if_fail (GST_IS_QUEUE (object));
708 queue = GST_QUEUE (object);
712 g_value_set_enum (value, queue->leaky);
715 g_value_set_int (value, queue->level_buffers);
718 g_value_set_int (value, queue->size_buffers);
720 case ARG_MAY_DEADLOCK:
721 g_value_set_boolean (value, queue->may_deadlock);
723 case ARG_BLOCK_TIMEOUT:
724 g_value_set_int (value, queue->block_timeout);
727 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);