[FFmpeg-devel] [PATCH] Add hwaccel_data infrastructure (take 2)

Benoit Fouet benoit.fouet
Fri Mar 6 11:05:11 CET 2009


On 03/06/2009 11:00 AM, Gwenole Beauchesne wrote:
> Hi,
>
> On Thu, 5 Mar 2009, Michael Niedermayer wrote:
>
>>> However, for VDPAU, I am not sure there is another place than a
>>> ::close()
>>> to destroy the bitstreamBuffers, unless they are copied locally in
>>> vdp_decoder_render(). IIRC, this is asynchronous so if we delete them
>>> straight away, some weird things could happen when the function
>>> comes to
>>> actually need them later. ;-)
>>
>> i suggest to rename close to hwaccel_priv_close
>
> Finally, I dropped it altogether. Stephen confirmed for the
> bitstreamBuffers structs are copied locally and ff_draw_horiz_band()
> will always call their draw_slice() with the current_picture, so it's
> also safe to release that in end_frame().
>
> VDPAU is finally the 3rd API not strictly needing that
> hwaccel_priv_close() function so this confirms my intention to drop it.
>
> Besides, I also dropped hwaccel_data, it's not a real gain. I am fine
> with AVFrame.data[3].
>
> New patch attached.

> diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
> index 43f2f1f..7739f64 100644
> --- a/libavcodec/mpegvideo.c
> +++ b/libavcodec/mpegvideo.c
> @@ -170,6 +171,11 @@ void ff_copy_picture(Picture *dst, Picture *src){
>  static void free_frame_buffer(MpegEncContext *s, Picture *pic)
>  {
>      s->avctx->release_buffer(s->avctx, (AVFrame*)pic);
> +
> +    if (pic->hwaccel_data_private) {
> +        av_free(pic->hwaccel_data_private);
> +        pic->hwaccel_data_private = NULL;
> +    }
>  }
> 

av_freep(&pic->hwaccel_data_private);

> @@ -179,10 +185,25 @@ static int alloc_frame_buffer(MpegEncContext *s,
Picture *pic)
[...]
> +        if (pic->hwaccel_data_private) {
> +            av_free(pic->hwaccel_data_private);
> +            pic->hwaccel_data_private = NULL;
> +        }
>

ditto

Ben





More information about the ffmpeg-devel mailing list