summaryrefslogtreecommitdiff
path: root/videoout.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-10-05 16:02:16 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-10-05 16:26:02 +0200
commitd5e0f9b31e8a5da5b25a01bb1955314859c62760 (patch)
treecbeafbfd850155c9ce0021f7f1d63efea4c4b1f2 /videoout.c
parentacd2b7a13e607a46a2185125b7b3fbac81324985 (diff)
live: Make the number of video buffers configurable
The -b argument can be used to set the number of video display buffers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'videoout.c')
-rw-r--r--videoout.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/videoout.c b/videoout.c
index f6fbbe7..f8b6be2 100644
--- a/videoout.c
+++ b/videoout.c
@@ -37,7 +37,7 @@
#include "isp/v4l2.h"
#include "isp/v4l2-pool.h"
-#define NUM_BUFFERS 3
+#define MAX_BUFFERS 16
struct videoout
{
@@ -47,12 +47,13 @@ struct videoout
int streaming;
- int queued[NUM_BUFFERS];
+ int queued[MAX_BUFFERS];
int num_queued;
};
struct videoout *vo_init(const char *devname,
const struct video_out_operations *ops,
+ unsigned int buffers,
unsigned int width, unsigned int height)
{
struct v4l2_pix_format pixfmt;
@@ -110,7 +111,10 @@ struct videoout *vo_init(const char *devname,
}
/* Allocate buffers. */
- vo->pool = v4l2_buffers_pool_new(NUM_BUFFERS);
+ if (buffers > MAX_BUFFERS)
+ buffers = MAX_BUFFERS;
+
+ vo->pool = v4l2_buffers_pool_new(buffers);
if (vo->pool == NULL) {
printf("error: unable to allocate buffers pool for display.\n");
goto error;