X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fbitstream.c;h=a0c23979809d6bfda9ea241fb952b1c4579ca3bb;hb=7038fa6102071ecf7457cdf4730b88d41863f78f;hp=3eb1a6d745925b0cdf8fef0811cb9c165b59bc7d;hpb=8fbc6aae75403a7bbca595df9d3d3a9d835dc576;p=ffmpeg diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c index 3eb1a6d7459..a0c23979809 100644 --- a/libavcodec/bitstream.c +++ b/libavcodec/bitstream.c @@ -3,18 +3,20 @@ * Copyright (c) 2000, 2001 Fabrice Bellard. * Copyright (c) 2002-2004 Michael Niedermayer * - * This library is free software; you can redistribute it and/or + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * alternative bitstream reader & writer by Michael Niedermayer @@ -28,6 +30,15 @@ #include "avcodec.h" #include "bitstream.h" +/** + * Same as av_mallocz_static(), but does a realloc. + * + * @param[in] ptr The block of memory to reallocate. + * @param[in] size The requested size. + * @return Block of memory of requested size. + */ +attribute_deprecated void *ff_realloc_static(void *ptr, unsigned int size); + void align_put_bits(PutBitContext *s) { #ifdef ALT_BITSTREAM_WRITER @@ -76,7 +87,7 @@ static int alloc_table(VLC *vlc, int size, int use_static) if (vlc->table_size > vlc->table_allocated) { vlc->table_allocated += (1 << vlc->bits); if(use_static) - vlc->table = av_realloc_static(vlc->table, + vlc->table = ff_realloc_static(vlc->table, sizeof(VLC_TYPE) * 2 * vlc->table_allocated); else vlc->table = av_realloc(vlc->table, @@ -216,10 +227,10 @@ static int build_table(VLC *vlc, int table_nb_bits, int init_vlc(VLC *vlc, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size, - int use_static) + int flags) { vlc->bits = nb_bits; - if(!use_static) { + if(!(flags & INIT_VLC_USE_STATIC)) { vlc->table = NULL; vlc->table_allocated = 0; vlc->table_size = 0; @@ -237,7 +248,7 @@ int init_vlc(VLC *vlc, int nb_bits, int nb_codes, if (build_table(vlc, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, - 0, 0, use_static) < 0) { + 0, 0, flags) < 0) { av_free(vlc->table); return -1; }