[FFmpeg-devel] [PATCH][VAAPI][2/6] Add common data structures and helpers

Reimar Döffinger Reimar.Doeffinger
Fri Feb 27 10:55:17 CET 2009


On Fri, Feb 27, 2009 at 10:40:30AM +0100, Gwenole Beauchesne wrote:
> +/**
> + * Gets a frame buffer
> + */
> +static int get_buffer(MpegEncContext *s, Picture *pic)
> +{
> +    int r;
> +
> +    if (s->avctx->hwaccel) {
> +        assert(!pic->hwaccel_data);
> +        switch (s->avctx->hwaccel->pix_fmt) {
> +        case PIX_FMT_VAAPI_MOCO:
> +        case PIX_FMT_VAAPI_IDCT:
> +        case PIX_FMT_VAAPI_VLD:
> +            pic->hwaccel_data = ff_alloc_vaapi_render_state();
> +            break;
> +        default:
> +            break;
> +        }
> +        if (!pic->hwaccel_data) {
> +            av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (hwaccel data allocation)\n");
> +            return -1;
> +        }
> +    }
> +
> +    r = s->avctx->get_buffer(s->avctx, (AVFrame*)pic);

I consider it an abomination to have half of the AVFrame data allocated
in one place and the other half in another place and somewhen we'd then
add some other allocation in yet another place.
Also about the MPlayer part: IMO this is a giant hack. Since it is a
hack anyway, it should not be spread all over MPlayer, just set
mpi->priv to something that contains all the information and make
vd_ffmpeg analyze the internals and fill in whatever needs to be filled
it in AVFrame.
Btw. why is "surface" in vaapi_render_state, is that pure lazyness/bad
design as in XvMC and VDPAU or does FFmpeg actually use it?




More information about the ffmpeg-devel mailing list