[FFmpeg-devel] [PATCHv2] avcodec/v4l2: set sizeimage param for non-raw buffers [fixes #6716]
Michael Niedermayer
michael at niedermayer.cc
Wed Oct 4 21:56:59 EEST 2017
On Wed, Oct 04, 2017 at 06:50:31PM +0200, Jorge Ramirez-Ortiz wrote:
> Some V4L2 drivers fail to allocate buffers when sizeimage is not set
> to a max value. This is indeed the case for s5p-mfc [1]
>
> Most drivers should be able to calculate this value from the frame
> dimensions and format - or at least have their own default.
>
> However since this work around should not impact those drivers doing
> the "right thing" this commit just provides such a default.
>
> The calculations were extracted from the v4l2 driver used to develop
> the ffmpeg v4l2_m2m support [2]. See venc.c and vdec.c
>
> [1] linux.git/drivers/media/platform/s5p-mfc
> [2] linux.git/drivers/media/platform/qcom/venus/
> ---
> libavcodec/v4l2_context.c | 30 ++++++++++++++++++++++++++++--
> 1 file changed, 28 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
> index 297792f..312cde5 100644
> --- a/libavcodec/v4l2_context.c
> +++ b/libavcodec/v4l2_context.c
> @@ -33,6 +33,8 @@
> #include "v4l2_fmt.h"
> #include "v4l2_m2m.h"
>
> +#define ALIGN(x, a) ((x) + (a - 1)) & (~(a - 1))
the "a" is missing ()
also the whlole expression needs to be protected by a ()
easier yet, you can use FFALIGN()
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20171004/9df78077/attachment.sig>
More information about the ffmpeg-devel
mailing list