X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fxxan.c;h=7c4aaf281fd0510c9f87b739ed0a0dbadc1f57ae;hb=a247ac640df3da573cd661065bf53f37863e2b46;hp=8bb7087af906b8a3dd4aeaeae117873e4cbd0c1f;hpb=217ad40aef9eeeff4e805dec3e980fb16aec3345;p=ffmpeg diff --git a/libavcodec/xxan.c b/libavcodec/xxan.c index 8bb7087af90..7c4aaf281fd 100644 --- a/libavcodec/xxan.c +++ b/libavcodec/xxan.c @@ -71,16 +71,12 @@ static av_cold int xan_decode_init(AVCodecContext *avctx) if (!s->y_buffer) return AVERROR(ENOMEM); s->scratch_buffer = av_malloc(s->buffer_size + 130); - if (!s->scratch_buffer) { - xan_decode_end(avctx); + if (!s->scratch_buffer) return AVERROR(ENOMEM); - } s->pic = av_frame_alloc(); - if (!s->pic) { - xan_decode_end(avctx); + if (!s->pic) return AVERROR(ENOMEM); - } return 0; } @@ -410,7 +406,7 @@ static int xan_decode_frame(AVCodecContext *avctx, int ftype; int ret; - if ((ret = ff_reget_buffer(avctx, s->pic)) < 0) + if ((ret = ff_reget_buffer(avctx, s->pic, 0)) < 0) return ret; bytestream2_init(&s->gb, avpkt->data, avpkt->size); @@ -437,7 +433,7 @@ static int xan_decode_frame(AVCodecContext *avctx, return avpkt->size; } -AVCodec ff_xan_wc4_decoder = { +const AVCodec ff_xan_wc4_decoder = { .name = "xan_wc4", .long_name = NULL_IF_CONFIG_SMALL("Wing Commander IV / Xxan"), .type = AVMEDIA_TYPE_VIDEO, @@ -447,4 +443,5 @@ AVCodec ff_xan_wc4_decoder = { .close = xan_decode_end, .decode = xan_decode_frame, .capabilities = AV_CODEC_CAP_DR1, + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_INIT_THREADSAFE, };