X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fflacdec.c;h=c62661a3539174cfcba0b6799997007338a3004c;hb=6ad61e30a16d338eab23b649365813fb150066ef;hp=c8eb456049db080fc06136130e1721eb2a18f74e;hpb=4069096dd535ee99175c2a29c1a1f59c3fc110c1;p=ffmpeg diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index c8eb456049d..c62661a3539 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -262,7 +262,7 @@ static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order) } else { int real_limit = tmp ? (INT_MAX >> tmp) + 2 : INT_MAX; for (; i < samples; i++) { - int v = get_sr_golomb_flac(&gb, tmp, real_limit, 0); + int v = get_sr_golomb_flac(&gb, tmp, real_limit, 1); if (v == 0x80000000){ av_log(s->avctx, AV_LOG_ERROR, "invalid residual\n"); return AVERROR_INVALIDDATA; @@ -639,19 +639,6 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data, return bytes_read; } -#if HAVE_THREADS -static int init_thread_copy(AVCodecContext *avctx) -{ - FLACContext *s = avctx->priv_data; - s->decoded_buffer = NULL; - s->decoded_buffer_size = 0; - s->avctx = avctx; - if (s->flac_stream_info.max_blocksize) - return allocate_buffers(s); - return 0; -} -#endif - static av_cold int flac_decode_close(AVCodecContext *avctx) { FLACContext *s = avctx->priv_data; @@ -667,13 +654,13 @@ static const AVOption options[] = { }; static const AVClass flac_decoder_class = { - "FLAC decoder", - av_default_item_name, - options, - LIBAVUTIL_VERSION_INT, + .class_name = "FLAC decoder", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, }; -AVCodec ff_flac_decoder = { +const AVCodec ff_flac_decoder = { .name = "flac", .long_name = NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"), .type = AVMEDIA_TYPE_AUDIO, @@ -682,8 +669,9 @@ AVCodec ff_flac_decoder = { .init = flac_decode_init, .close = flac_decode_close, .decode = flac_decode_frame, - .init_thread_copy = ONLY_IF_THREADS_ENABLED(init_thread_copy), - .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS, + .capabilities = AV_CODEC_CAP_CHANNEL_CONF | + AV_CODEC_CAP_DR1 | + AV_CODEC_CAP_FRAME_THREADS, .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32,