/**
* gst_v4l2_buffer_pool_get:
- * @pool: the pool
+ * @pool: the "this" object
+ * @blocking: should this call suspend until there is a buffer available
+ * in the buffer pool?
*
* Get an available buffer in the pool
*/
GstV4l2Buffer *
-gst_v4l2_buffer_pool_get (GstV4l2BufferPool * pool)
+gst_v4l2_buffer_pool_get (GstV4l2BufferPool * pool, gboolean blocking)
{
- GstV4l2Buffer *buf = g_async_queue_try_pop (pool->avail_buffers);
+ GstV4l2Buffer *buf;
+
+ if (blocking) {
+ buf = g_async_queue_pop (pool->avail_buffers);
+ } else {
+ buf = g_async_queue_try_pop (pool->avail_buffers);
+ }
if (buf) {
GST_BUFFER_SIZE (buf) = buf->vbuffer.length;
GstV4l2BufferPool *gst_v4l2_buffer_pool_new (GstElement *v4l2elem, gint fd, gint num_buffers, GstCaps * caps, gboolean requeuebuf, enum v4l2_buf_type type);
-GstV4l2Buffer *gst_v4l2_buffer_pool_get (GstV4l2BufferPool *pool);
+GstV4l2Buffer *gst_v4l2_buffer_pool_get (GstV4l2BufferPool *pool, gboolean blocking);
gboolean gst_v4l2_buffer_pool_qbuf (GstV4l2BufferPool *pool, GstV4l2Buffer *buf);
GstV4l2Buffer *gst_v4l2_buffer_pool_dqbuf (GstV4l2BufferPool *pool);
}
}
- v4l2buf = gst_v4l2_buffer_pool_get (v4l2sink->pool);
+ v4l2buf = gst_v4l2_buffer_pool_get (v4l2sink->pool, TRUE);
if (G_LIKELY (v4l2buf)) {
GST_DEBUG_OBJECT (v4l2sink, "allocated buffer: %p", v4l2buf);
{
GstV4l2Buffer *buf;
- while ((buf = gst_v4l2_buffer_pool_get (pool)) != NULL)
+ while ((buf = gst_v4l2_buffer_pool_get (pool, FALSE)) != NULL)
if (!gst_v4l2_buffer_pool_qbuf (pool, buf))
goto queue_failed;