|
|
@ -29,6 +29,7 @@ |
|
|
|
#include "libavutil/pixdesc.h" |
|
|
|
#include "libavutil/pixdesc.h" |
|
|
|
#include "libavutil/pixfmt.h" |
|
|
|
#include "libavutil/pixfmt.h" |
|
|
|
#include "libavutil/opt.h" |
|
|
|
#include "libavutil/opt.h" |
|
|
|
|
|
|
|
#include "profiles.h" |
|
|
|
#include "v4l2_context.h" |
|
|
|
#include "v4l2_context.h" |
|
|
|
#include "v4l2_m2m.h" |
|
|
|
#include "v4l2_m2m.h" |
|
|
|
#include "v4l2_fmt.h" |
|
|
|
#include "v4l2_fmt.h" |
|
|
@ -370,10 +371,19 @@ static av_cold int v4l2_encode_close(AVCodecContext *avctx) |
|
|
|
#define OFFSET(x) offsetof(V4L2m2mPriv, x) |
|
|
|
#define OFFSET(x) offsetof(V4L2m2mPriv, x) |
|
|
|
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM |
|
|
|
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define V4L_M2M_CAPTURE_OPTS \ |
|
|
|
|
|
|
|
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 } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const AVOption mpeg4_options[] = { |
|
|
|
|
|
|
|
V4L_M2M_CAPTURE_OPTS, |
|
|
|
|
|
|
|
FF_MPEG4_PROFILE_OPTS |
|
|
|
|
|
|
|
{ NULL }, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static const AVOption options[] = { |
|
|
|
static const AVOption options[] = { |
|
|
|
V4L_M2M_DEFAULT_OPTS, |
|
|
|
V4L_M2M_CAPTURE_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 }, |
|
|
|
|
|
|
|
{ NULL }, |
|
|
|
{ NULL }, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -383,16 +393,16 @@ static const AVCodecDefault v4l2_m2m_defaults[] = { |
|
|
|
{ NULL }, |
|
|
|
{ NULL }, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
#define M2MENC_CLASS(NAME) \ |
|
|
|
#define M2MENC_CLASS(NAME, OPTIONS_NAME) \ |
|
|
|
static const AVClass v4l2_m2m_ ## NAME ## _enc_class = { \
|
|
|
|
static const AVClass v4l2_m2m_ ## NAME ## _enc_class = { \
|
|
|
|
.class_name = #NAME "_v4l2m2m_encoder", \
|
|
|
|
.class_name = #NAME "_v4l2m2m_encoder", \
|
|
|
|
.item_name = av_default_item_name, \
|
|
|
|
.item_name = av_default_item_name, \
|
|
|
|
.option = options, \
|
|
|
|
.option = OPTIONS_NAME, \
|
|
|
|
.version = LIBAVUTIL_VERSION_INT, \
|
|
|
|
.version = LIBAVUTIL_VERSION_INT, \
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
#define M2MENC(NAME, LONGNAME, CODEC) \ |
|
|
|
#define M2MENC(NAME, LONGNAME, OPTIONS_NAME, CODEC) \ |
|
|
|
M2MENC_CLASS(NAME) \
|
|
|
|
M2MENC_CLASS(NAME, OPTIONS_NAME) \
|
|
|
|
AVCodec ff_ ## NAME ## _v4l2m2m_encoder = { \
|
|
|
|
AVCodec ff_ ## NAME ## _v4l2m2m_encoder = { \
|
|
|
|
.name = #NAME "_v4l2m2m" , \
|
|
|
|
.name = #NAME "_v4l2m2m" , \
|
|
|
|
.long_name = NULL_IF_CONFIG_SMALL("V4L2 mem2mem " LONGNAME " encoder wrapper"), \
|
|
|
|
.long_name = NULL_IF_CONFIG_SMALL("V4L2 mem2mem " LONGNAME " encoder wrapper"), \
|
|
|
@ -409,8 +419,8 @@ static const AVCodecDefault v4l2_m2m_defaults[] = { |
|
|
|
.wrapper_name = "v4l2m2m", \
|
|
|
|
.wrapper_name = "v4l2m2m", \
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
M2MENC(mpeg4,"MPEG4", AV_CODEC_ID_MPEG4); |
|
|
|
M2MENC(mpeg4,"MPEG4", mpeg4_options, AV_CODEC_ID_MPEG4); |
|
|
|
M2MENC(h263, "H.263", AV_CODEC_ID_H263); |
|
|
|
M2MENC(h263, "H.263", options, AV_CODEC_ID_H263); |
|
|
|
M2MENC(h264, "H.264", AV_CODEC_ID_H264); |
|
|
|
M2MENC(h264, "H.264", options, AV_CODEC_ID_H264); |
|
|
|
M2MENC(hevc, "HEVC", AV_CODEC_ID_HEVC); |
|
|
|
M2MENC(hevc, "HEVC", options, AV_CODEC_ID_HEVC); |
|
|
|
M2MENC(vp8, "VP8", AV_CODEC_ID_VP8); |
|
|
|
M2MENC(vp8, "VP8", options, AV_CODEC_ID_VP8); |
|
|
|