mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 07:28:53 +00:00
v4l2: pass v4l2object to GST_V4L2_MIN_BUFFERS()
Will be used to double the number of buffers in alternate interlace mode.
This commit is contained in:
parent
00893baef9
commit
8a69e26f16
5 changed files with 14 additions and 12 deletions
|
@ -551,9 +551,9 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config)
|
||||||
| GST_V4L2_ALLOCATOR_FLAG_DMABUF_CREATE_BUFS);
|
| GST_V4L2_ALLOCATOR_FLAG_DMABUF_CREATE_BUFS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (min_buffers < GST_V4L2_MIN_BUFFERS) {
|
if (min_buffers < GST_V4L2_MIN_BUFFERS (obj)) {
|
||||||
updated = TRUE;
|
updated = TRUE;
|
||||||
min_buffers = GST_V4L2_MIN_BUFFERS;
|
min_buffers = GST_V4L2_MIN_BUFFERS (obj);
|
||||||
GST_INFO_OBJECT (pool, "increasing minimum buffers to %u", min_buffers);
|
GST_INFO_OBJECT (pool, "increasing minimum buffers to %u", min_buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -766,7 +766,7 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool)
|
||||||
&max_buffers))
|
&max_buffers))
|
||||||
goto wrong_config;
|
goto wrong_config;
|
||||||
|
|
||||||
min_latency = MAX (GST_V4L2_MIN_BUFFERS, obj->min_buffers);
|
min_latency = MAX (GST_V4L2_MIN_BUFFERS (obj), obj->min_buffers);
|
||||||
|
|
||||||
switch (obj->mode) {
|
switch (obj->mode) {
|
||||||
case GST_V4L2_IO_RW:
|
case GST_V4L2_IO_RW:
|
||||||
|
@ -795,7 +795,7 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool)
|
||||||
V4L2_MEMORY_MMAP);
|
V4L2_MEMORY_MMAP);
|
||||||
pool->num_allocated = count;
|
pool->num_allocated = count;
|
||||||
|
|
||||||
if (count < GST_V4L2_MIN_BUFFERS) {
|
if (count < GST_V4L2_MIN_BUFFERS (obj)) {
|
||||||
min_buffers = count;
|
min_buffers = count;
|
||||||
goto no_buffers;
|
goto no_buffers;
|
||||||
}
|
}
|
||||||
|
@ -908,7 +908,7 @@ no_buffers:
|
||||||
{
|
{
|
||||||
GST_ERROR_OBJECT (pool,
|
GST_ERROR_OBJECT (pool,
|
||||||
"we received %d buffer from device '%s', we want at least %d",
|
"we received %d buffer from device '%s', we want at least %d",
|
||||||
min_buffers, obj->videodev, GST_V4L2_MIN_BUFFERS);
|
min_buffers, obj->videodev, GST_V4L2_MIN_BUFFERS (obj));
|
||||||
gst_structure_free (config);
|
gst_structure_free (config);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4701,12 +4701,12 @@ gst_v4l2_object_decide_allocation (GstV4l2Object * obj, GstQuery * query)
|
||||||
/* In this case we'll have to configure two buffer pool. For our buffer
|
/* In this case we'll have to configure two buffer pool. For our buffer
|
||||||
* pool, we'll need what the driver one, and one more, so we can dequeu */
|
* pool, we'll need what the driver one, and one more, so we can dequeu */
|
||||||
own_min = obj->min_buffers + 1;
|
own_min = obj->min_buffers + 1;
|
||||||
own_min = MAX (own_min, GST_V4L2_MIN_BUFFERS);
|
own_min = MAX (own_min, GST_V4L2_MIN_BUFFERS (obj));
|
||||||
|
|
||||||
/* for the downstream pool, we keep what downstream wants, though ensure
|
/* for the downstream pool, we keep what downstream wants, though ensure
|
||||||
* at least a minimum if downstream didn't suggest anything (we are
|
* at least a minimum if downstream didn't suggest anything (we are
|
||||||
* expecting the base class to create a default one for the context) */
|
* expecting the base class to create a default one for the context) */
|
||||||
min = MAX (min, GST_V4L2_MIN_BUFFERS);
|
min = MAX (min, GST_V4L2_MIN_BUFFERS (obj));
|
||||||
|
|
||||||
/* To import we need the other pool to hold at least own_min */
|
/* To import we need the other pool to hold at least own_min */
|
||||||
if (obj->pool == pool)
|
if (obj->pool == pool)
|
||||||
|
@ -4844,7 +4844,7 @@ gst_v4l2_object_propose_allocation (GstV4l2Object * obj, GstQuery * query)
|
||||||
|
|
||||||
/* Set defaults allocation parameters */
|
/* Set defaults allocation parameters */
|
||||||
size = obj->info.size;
|
size = obj->info.size;
|
||||||
min = GST_V4L2_MIN_BUFFERS;
|
min = GST_V4L2_MIN_BUFFERS (obj);
|
||||||
max = VIDEO_MAX_FRAME;
|
max = VIDEO_MAX_FRAME;
|
||||||
|
|
||||||
gst_query_parse_allocation (query, &caps, &need_pool);
|
gst_query_parse_allocation (query, &caps, &need_pool);
|
||||||
|
@ -4882,7 +4882,7 @@ gst_v4l2_object_propose_allocation (GstV4l2Object * obj, GstQuery * query)
|
||||||
}
|
}
|
||||||
gst_v4l2_get_driver_min_buffers (obj);
|
gst_v4l2_get_driver_min_buffers (obj);
|
||||||
|
|
||||||
min = MAX (obj->min_buffers, GST_V4L2_MIN_BUFFERS);
|
min = MAX (obj->min_buffers, GST_V4L2_MIN_BUFFERS (obj));
|
||||||
|
|
||||||
gst_query_add_allocation_pool (query, pool, size, min, max);
|
gst_query_add_allocation_pool (query, pool, size, min, max);
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ typedef struct _GstV4l2ObjectClassHelper GstV4l2ObjectClassHelper;
|
||||||
#include <gstv4l2bufferpool.h>
|
#include <gstv4l2bufferpool.h>
|
||||||
|
|
||||||
/* size of v4l2 buffer pool in streaming case */
|
/* size of v4l2 buffer pool in streaming case */
|
||||||
#define GST_V4L2_MIN_BUFFERS 2
|
#define GST_V4L2_MIN_BUFFERS(obj) 2
|
||||||
|
|
||||||
/* max frame width/height */
|
/* max frame width/height */
|
||||||
#define GST_V4L2_MAX_SIZE (1<<15) /* 2^15 == 32768 */
|
#define GST_V4L2_MAX_SIZE (1<<15) /* 2^15 == 32768 */
|
||||||
|
|
|
@ -893,7 +893,8 @@ gst_v4l2_transform_prepare_output_buffer (GstBaseTransform * trans,
|
||||||
/* Ensure input internal pool is active */
|
/* Ensure input internal pool is active */
|
||||||
if (!gst_buffer_pool_is_active (pool)) {
|
if (!gst_buffer_pool_is_active (pool)) {
|
||||||
GstStructure *config = gst_buffer_pool_get_config (pool);
|
GstStructure *config = gst_buffer_pool_get_config (pool);
|
||||||
gint min = MAX (GST_V4L2_MIN_BUFFERS, self->v4l2output->min_buffers);
|
gint min = MAX (GST_V4L2_MIN_BUFFERS (self->v4l2output),
|
||||||
|
self->v4l2output->min_buffers);
|
||||||
|
|
||||||
if (self->v4l2output->mode == GST_V4L2_IO_USERPTR ||
|
if (self->v4l2output->mode == GST_V4L2_IO_USERPTR ||
|
||||||
self->v4l2output->mode == GST_V4L2_IO_DMABUF_IMPORT) {
|
self->v4l2output->mode == GST_V4L2_IO_DMABUF_IMPORT) {
|
||||||
|
|
|
@ -739,7 +739,8 @@ gst_v4l2_video_enc_handle_frame (GstVideoEncoder * encoder,
|
||||||
/* Ensure input internal pool is active */
|
/* Ensure input internal pool is active */
|
||||||
if (!gst_buffer_pool_is_active (pool)) {
|
if (!gst_buffer_pool_is_active (pool)) {
|
||||||
GstStructure *config = gst_buffer_pool_get_config (pool);
|
GstStructure *config = gst_buffer_pool_get_config (pool);
|
||||||
guint min = MAX (self->v4l2output->min_buffers, GST_V4L2_MIN_BUFFERS);
|
guint min = MAX (self->v4l2output->min_buffers,
|
||||||
|
GST_V4L2_MIN_BUFFERS (self->v4l2output));
|
||||||
|
|
||||||
gst_buffer_pool_config_set_params (config, self->input_state->caps,
|
gst_buffer_pool_config_set_params (config, self->input_state->caps,
|
||||||
self->v4l2output->info.size, min, min);
|
self->v4l2output->info.size, min, min);
|
||||||
|
|
Loading…
Reference in a new issue