X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fflashsv.c;h=8870fe63a8a2c6581a92444afa7c7881feb0614a;hb=f95bfab05cb0edbed2830dca7bc79d46b42bbf95;hp=040a5502551a50e854b5c990b60f1007a2658032;hpb=d5202e4fda3d6e3d63e032328b7626f779572e76;p=ffmpeg diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index 040a5502551..8870fe63a8a 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -21,7 +21,7 @@ */ /** - * @file flashsv.c + * @file libavcodec/flashsv.c * Flash Screen Video decoder * @author Alex Beregszaszi * @author Benjamin Larsson @@ -51,7 +51,7 @@ #include #include "avcodec.h" -#include "bitstream.h" +#include "get_bits.h" #include @@ -102,8 +102,10 @@ static av_cold int flashsv_decode_init(AVCodecContext *avctx) static int flashsv_decode_frame(AVCodecContext *avctx, void *data, int *data_size, - const uint8_t *buf, int buf_size) + AVPacket *avpkt) { + const uint8_t *buf = avpkt->data; + int buf_size = avpkt->size; FlashSVContext *s = avctx->priv_data; int h_blocks, v_blocks, h_part, v_part, i, j; GetBitContext gb; @@ -112,9 +114,6 @@ static int flashsv_decode_frame(AVCodecContext *avctx, if (buf_size == 0) return 0; - if(s->frame.data[0]) - avctx->release_buffer(avctx, &s->frame); - init_get_bits(&gb, buf, buf_size * 8); /* start to parse the bitstream */ @@ -160,10 +159,10 @@ static int flashsv_decode_frame(AVCodecContext *avctx, h_blocks, v_blocks, h_part, v_part); s->frame.reference = 1; - s->frame.buffer_hints = FF_BUFFER_HINTS_VALID; - if (avctx->get_buffer(avctx, &s->frame) < 0) { - av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; + s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; + if(avctx->reget_buffer(avctx, &s->frame) < 0){ + av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + return -1; } /* loop over all block columns */ @@ -211,7 +210,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, /* return -1; */ } copy_region(s->tmpblock, s->frame.data[0], s->image_height-(hp+hs+1), wp, hs, ws, s->frame.linesize[0]); - skip_bits(&gb, 8*size); /* skip the consumed bits */ + skip_bits_long(&gb, 8*size); /* skip the consumed bits */ } } } @@ -254,6 +253,6 @@ AVCodec flashsv_decoder = { flashsv_decode_end, flashsv_decode_frame, CODEC_CAP_DR1, - .pix_fmts = (enum PixelFormat[]){PIX_FMT_BGR24, -1}, - .long_name = "Flash Screen Video", + .pix_fmts = (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_NONE}, + .long_name = NULL_IF_CONFIG_SMALL("Flash Screen Video v1"), };