[FFmpeg-devel] [PATCH 4/4] libavcodec/dev: v4l2: add support for v4l2 mem2mem codecs

Jorge Ramirez jorge.ramirez-ortiz at linaro.org
Thu Jul 27 09:44:37 EEST 2017


On 07/26/2017 04:04 PM, Michael Niedermayer wrote:
> On Mon, Jul 24, 2017 at 09:08:49PM +0200, Jorge Ramirez-Ortiz wrote:
>> From: Alexis Ballier <aballier at gentoo.org>
>>
>> This patchset enhances Alexis Ballier's original patch and validates
>> it using Qualcomm's Venus hardware (driver recently landed upstream
>> [1]).
>>
>> This has been tested on Qualcomm's DragonBoard 410c and 820c
>>
>> ffplay tested video decoders:
>> - h264,
>> - vp8
>> - mpeg4
>>
>> Some of the changes introduced:
>> - v4l2: some cleanup of the code.
>> - v4l2: some cleaup before upstreaming.
>> - v4l2: follow the new decode api.
>> - v4l2: fix display size for NV12 output pool.
>> - v4l2: handle EOS.
>> - v4l2: fix vp8 and mpeg4 decoding.
>> - v4l2: generate EOF on dequeue errors.
>> - v4l2: h264_mp4toannexb filtering.
>>
>> [1] https://lwn.net/Articles/697956/
> this with the other patches breaks build

Hi Michael,

Could you provide some details of your build environment and kernel please?
What is the oldest kernel that you have to build on?

The identifiers that the compiler is moaning about were added to the API 
a few years back (2 and 4) to v4l2-controls.h and videodev2.h)

1) For instance the kernel added support for 
V4L2_CID_MPEG_VIDEO_VPX_MIN_QP in 2013 with commit:

commit 4773ab99aa8bda57de22bf54ddbaa1a941b25fb0
Author: Arun Kumar K <arun.kk at samsung.com>
Date:   Fri Nov 15 02:29:22 2013 -0300

     [media] s5p-mfc: Add QP setting support for vp8 encoder

     Adds v4l2 controls to set MIN, MAX QP values and
     I, P frame QP for vp8 encoder.

     Signed-off-by: Kiran AVND <avnd.kiran at samsung.com>
     Signed-off-by: Arun Kumar K <arun.kk at samsung.com>
     Signed-off-by: Kamil Debski <k.debski at samsung.com>
     Signed-off-by: Mauro Carvalho Chehab <m.chehab at samsung.com>


2) Similarly V4L2_BUF_FLAG_LAST was introduced a couple of years ago with

Author: Philipp Zabel <p.zabel at pengutronix.de>
Date:   Mon May 4 07:51:04 2015 -0300

     [media] DocBook media: document codec draining flow

     Document the interaction between VIDIOC_DECODER_CMD 
V4L2_DEC_CMD_STOP and
     VIDIOC_ENCODER_CMD V4L2_ENC_CMD_STOP to start the draining, the 
V4L2_EVENT_EOS
     event signalling all capture buffers are finished and ready to be 
dequeud,
     the new V4L2_BUF_FLAG_LAST buffer flag indicating the last buffer 
being dequeued
     from the capture queue, and the poll and VIDIOC_DQBUF ioctl return 
values once
     the queue is drained.

     Signed-off-by: Philipp Zabel <p.zabel at pengutronix.de>
     Acked-by: Hans Verkuil <hans.verkuil at cisco.com>
     Signed-off-by: Kamil Debski <k.debski at samsung.com>
     Signed-off-by: Mauro Carvalho Chehab <mchehab at osg.samsung.com>


For users, those identifiers are defined in 
/usr/include/linux/videodev2.h and /usr/include/linux/v4l2-controls.h. 
so they should have been there along with the others; however and since 
this is not the case for you, it must be caused by the build environment 
being not too recent (I have been testing on Ubuntu 16.04)

(btw I have fixed the av log warning on v2)

> CC      libavcodec/v4l2-buffers.o
> CC      libavcodec/v4l2_m2m_enc.o
> libavcodec/v4l2_m2m_enc.c: In function ‘v4lm2m_encode_init’:
> libavcodec/v4l2_m2m_enc.c:150:103: error: ‘V4L2_CID_MPEG_VIDEO_VPX_MIN_QP’ undeclared (first use in this function)
>               SET_V4L_EXT_CTRL(value, V4L2_CID_MPEG_VIDEO_VPX_MIN_QP, avctx->qmin, V4L2_CTRL_CLASS_MPEG, "minimum video quantizer scale");
>                                                                                                         ^
> libavcodec/v4l2_m2m_enc.c:150:103: note: each undeclared identifier is reported only once for each function it appears in
> libavcodec/v4l2_m2m_enc.c:151:103: error: ‘V4L2_CID_MPEG_VIDEO_VPX_MAX_QP’ undeclared (first use in this function)
>               SET_V4L_EXT_CTRL(value, V4L2_CID_MPEG_VIDEO_VPX_MAX_QP, avctx->qmax, V4L2_CTRL_CLASS_MPEG, "maximum video quantizer scale");
>                                                                                                         ^
> make: *** [libavcodec/v4l2_m2m_enc.o] Error 1
> libavcodec/v4l2-buffers.c: In function ‘avpriv_init_v4lbufpool’:
> libavcodec/v4l2-buffers.c:276:9: warning: unknown conversion type character ‘y’ in format [-Wformat=]
>           av_log(bufs->log_ctx, AV_LOG_ERROR, "%type %i not supported\n", bufs->type);
>           ^
> libavcodec/v4l2-buffers.c: In function ‘avpkt_to_v4lbuf’:
> libavcodec/v4l2-buffers.c:414:22: error: ‘V4L2_BUF_FLAG_LAST’ undeclared (first use in this function)
>           out->flags = V4L2_BUF_FLAG_LAST;
>                        ^
> libavcodec/v4l2-buffers.c:414:22: note: each undeclared identifier is reported only once for each function it appears in
> libavcodec/v4l2-buffers.c: In function ‘v4lbuf_to_avpkt’:
> libavcodec/v4l2-buffers.c:464:5: warning: ‘av_free_packet’ is deprecated (declared at libavcodec/avcodec.h:4621) [-Wdeprecated-declarations]
>       av_free_packet(pkt);
>       ^
> make: *** [libavcodec/v4l2-buffers.o] Error 1
> make: Target `all' not remade because of errors.
>
> [...]
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



More information about the ffmpeg-devel mailing list