Hi,

On Wed, Mar 7, 2012 at 11:53 AM, Paul B Mahol <one...@gmail.com> wrote:
>
> Signed-off-by: Paul B Mahol <one...@gmail.com>
> ---
>  libavcodec/pngdec.c |   15 +++++++++------
>  1 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
> index 66afb0e..96bd49b 100644
> --- a/libavcodec/pngdec.c
> +++ b/libavcodec/pngdec.c
> @@ -23,6 +23,7 @@
>  #include "bytestream.h"
>  #include "png.h"
>  #include "pngdsp.h"
> +#include "thread.h"
>
>  /* TODO:
>  * - add 2, 4 and 16 bit depth support
> @@ -496,13 +497,15 @@ static int decode_frame(AVCodecContext *avctx,
>                     goto fail;
>                 }
>                 if(p->data[0])
> -                    avctx->release_buffer(avctx, p);
> +                    ff_thread_release_buffer(avctx, p);
>
>                 p->reference= 0;
> -                if(avctx->get_buffer(avctx, p) < 0){
> +                if((ret = ff_thread_get_buffer(avctx, p)) < 0){
>                     av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
> -                    goto fail;
> +                    goto the_end;
>                 }
> +                ff_thread_finish_setup(avctx);
> +
>                 p->pict_type= AV_PICTURE_TYPE_I;
>                 p->key_frame= 1;
>                 p->interlaced_frame = !!s->interlace_type;
> @@ -649,9 +652,9 @@ static av_cold int png_dec_end(AVCodecContext *avctx)
>     PNGDecContext *s = avctx->priv_data;
>
>     if (s->picture1.data[0])
> -        avctx->release_buffer(avctx, &s->picture1);
> +        ff_thread_release_buffer(avctx, &s->picture1);
>     if (s->picture2.data[0])
> -        avctx->release_buffer(avctx, &s->picture2);
> +        ff_thread_release_buffer(avctx, &s->picture2);
>
>     return 0;
>  }
> @@ -664,6 +667,6 @@ AVCodec ff_png_decoder = {
>     .init           = png_dec_init,
>     .close          = png_dec_end,
>     .decode         = decode_frame,
> -    .capabilities   = CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/,
> +    .capabilities   = CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/ | 
> CODEC_CAP_FRAME_THREADS,
>     .long_name = NULL_IF_CONFIG_SMALL("PNG (Portable Network Graphics) 
> image"),

LGTM, except it breaks fate-corepng. We just discussed on IRC how to fix that.

Ronald
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to