[FFmpeg-devel] [PATCH] avcodec/mmaldec: use zero-copy forAV_PIX_FMT_MMAL

wbsecg1 wbsecg1 at gmail.com
Thu Nov 2 10:53:41 EET 2017


> On Sun, 3 Sep 2017 15:44:36 +0300
Yevhen Kyriukha <kirgene at gmail.com> wrote:
>
>> Signed-off-by: Yevhen Kyriukha <kirgene at gmail.com>
>> —
>> libavcodec/mmaldec.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>> 
>> diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c
>> index 0b1195dc3e..19ca6ce7e7 100644
>> --- a/libavcodec/mmaldec.c
>> +++ b/libavcodec/mmaldec.c
>> @@ -295,6 +295,8 @@ static int ffmal_update_format(AVCodecContext *avctx)
>> goto fail;
>>  
>> if (avctx->pix_fmt == AV_PIX_FMT_MMAL) {
>> + if ((status = mmal_port_parameter_set_boolean(decoder->output[0], MMAL_PARAMETER_ZERO_COPY, 1)))
>> + goto fail;
>> format_out->encoding = MMAL_ENCODING_OPAQUE;
>> } else {
>> format_out->encoding_variant = format_out->encoding = MMAL_ENCODING_I420;
>> @@ -332,7 +334,8 @@ static int ffmal_update_format(AVCodecContext *avctx)
>> FFMAX(decoder->output[0]->buffer_size_min, decoder->output[0]->buffer_size_recommended);
>> decoder->output[0]->buffer_num =
>> FFMAX(decoder->output[0]->buffer_num_min, decoder->output[0]->buffer_num_recommended) + ctx->extra_buffers;
>> - ctx->pool_out->pool = mmal_pool_create(decoder->output[0]->buffer_num,
>> + ctx->pool_out->pool = mmal_port_pool_create(decoder->output[0],
>> + decoder->output[0]->buffer_num,
>> decoder->output[0]->buffer_size);
>> if (!ctx->pool_out->pool) {
>> ret = AVERROR(ENOMEM);

> Why the change, and what are the implications? (The commit message
> should contain this.)

I have confirmed with this patch EGLImage can be created from decoded mmal buffer. It’s really useful for players.


More information about the ffmpeg-devel mailing list