[FFmpeg-devel] [PATCH] avcodec: v4l2_m2m: add MJPEG enc/dec support
Jorge Ramirez-Ortiz
jramirez at baylibre.com
Sun Aug 12 20:07:07 EEST 2018
On 08/12/2018 04:40 PM, Maxime Jourdan wrote:
> Tested on an Odroid-C2 with a V4L2 M2M MJPEG decoder.
cool. did you also test the encoder?
>
> Signed-off-by: Maxime Jourdan <maxi.jourdan at wanadoo.fr>
> ---
> configure | 3 +++
> libavcodec/Makefile | 2 ++
> libavcodec/allcodecs.c | 2 ++
> libavcodec/v4l2_m2m_dec.c | 1 +
> libavcodec/v4l2_m2m_enc.c | 1 +
> 5 files changed, 9 insertions(+)
>
> diff --git a/configure b/configure
> index e718c1531c..5a5ba1ebcf 100755
> --- a/configure
> +++ b/configure
> @@ -2939,6 +2939,8 @@ hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
> hevc_vaapi_encoder_select="cbs_h265 vaapi_encode"
> hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m"
> hevc_v4l2m2m_encoder_deps="v4l2_m2m hevc_v4l2_m2m"
> +mjpeg_v4l2m2m_decoder_deps="v4l2_m2m mjpeg_v4l2_m2m"
> +mjpeg_v4l2m2m_encoder_deps="v4l2_m2m mjpeg_v4l2_m2m"
> mjpeg_cuvid_decoder_deps="cuvid"
> mjpeg_qsv_encoder_deps="libmfx"
> mjpeg_qsv_encoder_select="qsvenc"
> @@ -6252,6 +6254,7 @@ check_header linux/videodev2.h
> test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
> check_cc v4l2_m2m linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;"
> check_cc vc1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;"
> +check_cc mjpeg_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MJPEG;"
> check_cc mpeg1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;"
> check_cc mpeg2_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2;"
> check_cc mpeg4_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG4;"
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 6e40702947..cd975739ef 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -415,7 +415,9 @@ OBJS-$(CONFIG_METASOUND_DECODER) += metasound.o metasound_data.o \
> twinvq.o
> OBJS-$(CONFIG_MICRODVD_DECODER) += microdvddec.o ass.o
> OBJS-$(CONFIG_MIMIC_DECODER) += mimic.o
> +OBJS-$(CONFIG_MJPEG_V4L2M2M_DECODER) += v4l2_m2m_dec.o
> OBJS-$(CONFIG_MJPEG_DECODER) += mjpegdec.o
> +OBJS-$(CONFIG_MJPEG_V4L2M2M_ENCODER) += v4l2_m2m_enc.o
> OBJS-$(CONFIG_MJPEG_ENCODER) += mjpegenc.o mjpegenc_common.o \
> mjpegenc_huffman.o
> OBJS-$(CONFIG_MJPEGB_DECODER) += mjpegbdec.o
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index ab3ec04251..af4870a54d 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -173,7 +173,9 @@ extern AVCodec ff_magicyuv_encoder;
> extern AVCodec ff_magicyuv_decoder;
> extern AVCodec ff_mdec_decoder;
> extern AVCodec ff_mimic_decoder;
> +extern AVCodec ff_mjpeg_v4l2m2m_encoder;
> extern AVCodec ff_mjpeg_encoder;
> +extern AVCodec ff_mjpeg_v4l2m2m_decoder;
> extern AVCodec ff_mjpeg_decoder;
> extern AVCodec ff_mjpegb_decoder;
> extern AVCodec ff_mmvideo_decoder;
> diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
> index a4e2f02596..80a09f7a43 100644
> --- a/libavcodec/v4l2_m2m_dec.c
> +++ b/libavcodec/v4l2_m2m_dec.c
> @@ -231,6 +231,7 @@ AVCodec ff_ ## NAME ## _v4l2m2m_decoder = { \
>
> M2MDEC(h264, "H.264", AV_CODEC_ID_H264, "h264_mp4toannexb");
> M2MDEC(hevc, "HEVC", AV_CODEC_ID_HEVC, "hevc_mp4toannexb");
> +M2MDEC(mjpeg, "MJPEG", AV_CODEC_ID_MJPEG, NULL);
> M2MDEC(mpeg1, "MPEG1", AV_CODEC_ID_MPEG1VIDEO, NULL);
> M2MDEC(mpeg2, "MPEG2", AV_CODEC_ID_MPEG2VIDEO, NULL);
> M2MDEC(mpeg4, "MPEG4", AV_CODEC_ID_MPEG4, NULL);
> diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c
> index 4c9ea1fd92..b025f59275 100644
> --- a/libavcodec/v4l2_m2m_enc.c
> +++ b/libavcodec/v4l2_m2m_enc.c
> @@ -345,6 +345,7 @@ AVCodec ff_ ## NAME ## _v4l2m2m_encoder = { \
> .wrapper_name = "v4l2m2m", \
> };
>
> +M2MENC(mjpeg,"MJPEG", AV_CODEC_ID_MJPEG);
> M2MENC(mpeg4,"MPEG4", AV_CODEC_ID_MPEG4);
> M2MENC(h263, "H.263", AV_CODEC_ID_H263);
> M2MENC(h264, "H.264", AV_CODEC_ID_H264);
More information about the ffmpeg-devel
mailing list