@@ -37,9 +37,11 @@
const __typeof__(((type *)0)->member ) *__mptr = (ptr); \
(type *)((char *)__mptr - offsetof(type,member) );})
-#define V4L_M2M_DEFAULT_OPTS \
+#define V4L_M2M_DEFAULT_OPTS(output_bufs, capture_bufs) \
{ "num_output_buffers", "Number of buffers in the output context",\
- OFFSET(num_output_buffers), AV_OPT_TYPE_INT, { .i64 = 16 }, 6, INT_MAX, FLAGS }
+ OFFSET(num_output_buffers), AV_OPT_TYPE_INT, { .i64 = output_bufs }, 1, INT_MAX, FLAGS }, \
+ { "num_capture_buffers", "Number of buffers in the capture context", \
+ OFFSET(num_capture_buffers), AV_OPT_TYPE_INT, {.i64 = capture_bufs }, 1, INT_MAX, FLAGS }
typedef struct V4L2m2mContext {
char devname[PATH_MAX];
@@ -281,9 +281,7 @@ static void v4l2_flush(AVCodecContext *avctx)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
- V4L_M2M_DEFAULT_OPTS,
- { "num_capture_buffers", "Number of buffers in the capture context",
- OFFSET(num_capture_buffers), AV_OPT_TYPE_INT, {.i64 = 20}, 20, INT_MAX, FLAGS },
+ V4L_M2M_DEFAULT_OPTS(8, 6),
{ NULL},
};
@@ -342,9 +342,7 @@ static av_cold int v4l2_encode_close(AVCodecContext *avctx)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = {
- V4L_M2M_DEFAULT_OPTS,
- { "num_capture_buffers", "Number of buffers in the capture context",
- OFFSET(num_capture_buffers), AV_OPT_TYPE_INT, {.i64 = 4 }, 4, INT_MAX, FLAGS },
+ V4L_M2M_DEFAULT_OPTS(6, 8),
{ NULL },
};
@@ -301,11 +301,7 @@ static const AVOption scale_v4l2m2m_options[] = {
#undef OFFSET
#define OFFSET(x) offsetof(V4L2m2mPriv, x)
-
- V4L_M2M_DEFAULT_OPTS,
- { "num_capture_buffers", "Number of buffers in the capture context",
- OFFSET(num_capture_buffers), AV_OPT_TYPE_INT, {.i64 = 4 }, 4, INT_MAX, FLAGS },
-
+ V4L_M2M_DEFAULT_OPTS(6, 6),
{ NULL },
};