[MPlayer-dev-eng] [FFmpeg-devel] [PATCH 0/20] removal of deprecated features

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Sat Aug 15 17:19:45 CEST 2015

On 14.08.2015 22:06, Roberto Togni wrote:
> This is the big one.
> Replace with get_buffer2(), but this is not a 1:1 substitution.
> reget_buffer() is gone, but we already don't use it anymore (it points
> to get_buffer).
> To free the buffer there is some callback to be set in get_buffer2 (as
> I get from the comments in avcodec.h).
> IIRC we need get buffer (instead of using the default from libavcodec)
> for two things: hw decoding and direct rendering.
> I had a quick look to other projects based on MPlayer: mplayer2 still
> uses get_buffer, so it's no help; mpv uses get_buffer2 at least for hw
> decoders, but I need to check the details.

As far as I understood this API change, one needs to do the following:
Replace get_buffer/avcodec_default_get_buffer with get_buffer2/avcodec_default_get_buffer2,
which has an additional 'int flags' argument.
Don't use AVFrame->type, AVFrame->buffer_hints and AVFrame->reference.
Remove reget_buffer and change release_buffer into a void(void *opaque, uint8_t *data)
free callback function.
The custom get_buffer2 implementation now must set AVFrame->buf[] with av_buffer_create,
which can be passed a function pointer for the free callback.

> To be checked

This API is only removed from Libav, not from FFmpeg, so ...
Last time I checked, compiling mplayer with Libav didn't work anyway.

> Patch in review

Nice. :-)

> Not relevant for MPlayer

Unfortunately I missed this previously, but mplayer does use this API
in libmpdemux/demux_lavf.c.
I guess the part using it can just be removed?

> I don't think this is fixable.

I think so too.

> From what I got at a first look, vf_lavfi creates its own source and
> sink filters, and adds them to the chain. To do this it uses
> AVFilterPad, os the new functions to get name and type are useless.
> I don't know if this filter still works today; apart from minor details
> the file is unchanged since 2011. The commit message also warned about
> the beta interface of libavfilter at the time.
> The filter is not built by default, so compilation and functionality of
> MPlayer are unaffected.

Indeed, that's not used by default. I wasn't aware of that.
But still, this filter should probably be removed.

> If you have any comment or additions please replay.

I also missed that mplayer still uses FF_API_OLD_ENCODE_VIDEO,
namely avcodec_encode_video.
That should be simple to fix:
avcodec_encode_video(avctx, buf, buf_size, frame);
int got_packet;
AVPacket avpkt;
memset(&avpkt, 0, sizeof(AVPacket));
avpkt->data = buf;
avpkt->size = buf_size;
avcodec_encode_video2(avctx, &avpkt, frame, &got_packet);

Best regards,

More information about the MPlayer-dev-eng mailing list