From 81abf90aeae6ab88e820b664df4ea011b345b725 Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Fri, 13 Sep 2019 16:30:13 -0700 Subject: [PATCH] avcodec/v4l2: fix compile with older videodev2.h Some of these symbols are only defined in newer kernel releases. Signed-off-by: Aman Gupta --- libavcodec/v4l2_buffers.c | 8 ++++++++ libavcodec/v4l2_m2m_enc.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c index ca8045f8d1..e301dcd6bd 100644 --- a/libavcodec/v4l2_buffers.c +++ b/libavcodec/v4l2_buffers.c @@ -351,10 +351,18 @@ static int v4l2_buffer_swframe_to_buf(const AVFrame *frame, V4L2Buffer *out) switch (pixel_format) { case V4L2_PIX_FMT_YUV420M: case V4L2_PIX_FMT_YVU420M: +#ifdef V4L2_PIX_FMT_YUV422M case V4L2_PIX_FMT_YUV422M: +#endif +#ifdef V4L2_PIX_FMT_YVU422M case V4L2_PIX_FMT_YVU422M: +#endif +#ifdef V4L2_PIX_FMT_YUV444M case V4L2_PIX_FMT_YUV444M: +#endif +#ifdef V4L2_PIX_FMT_YVU444M case V4L2_PIX_FMT_YVU444M: +#endif case V4L2_PIX_FMT_NV12M: case V4L2_PIX_FMT_NV21M: case V4L2_PIX_FMT_NV12MT_16X16: diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c index 4849bc26c5..474e6bef89 100644 --- a/libavcodec/v4l2_m2m_enc.c +++ b/libavcodec/v4l2_m2m_enc.c @@ -245,8 +245,10 @@ static int v4l2_send_frame(AVCodecContext *avctx, const AVFrame *frame) V4L2m2mContext *s = ((V4L2m2mPriv*)avctx->priv_data)->context; V4L2Context *const output = &s->output; +#ifdef V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME if (frame && frame->pict_type == AV_PICTURE_TYPE_I) v4l2_set_ext_ctrl(s, MPEG_CID(FORCE_KEY_FRAME), 0, "force key frame"); +#endif return ff_v4l2_context_enqueue_frame(output, frame); }