diff options
Diffstat (limited to 'libavcodec/bitstream_filter.c')
-rw-r--r-- | libavcodec/bitstream_filter.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/libavcodec/bitstream_filter.c b/libavcodec/bitstream_filter.c index f524d3e..751b90d 100644 --- a/libavcodec/bitstream_filter.c +++ b/libavcodec/bitstream_filter.c @@ -1,26 +1,27 @@ /* * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * 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.1 of the License, or (at your option) any later version. * - * Libav 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 Libav; 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 */ #include <string.h> #include "avcodec.h" +#include "libavutil/atomic.h" #include "libavutil/mem.h" static AVBitStreamFilter *first_bitstream_filter = NULL; @@ -35,8 +36,9 @@ AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f) void av_register_bitstream_filter(AVBitStreamFilter *bsf) { - bsf->next = first_bitstream_filter; - first_bitstream_filter = bsf; + do { + bsf->next = first_bitstream_filter; + } while(bsf->next != avpriv_atomic_ptr_cas((void * volatile *)&first_bitstream_filter, bsf->next, bsf)); } AVBitStreamFilterContext *av_bitstream_filter_init(const char *name) @@ -59,6 +61,8 @@ AVBitStreamFilterContext *av_bitstream_filter_init(const char *name) void av_bitstream_filter_close(AVBitStreamFilterContext *bsfc) { + if (!bsfc) + return; if (bsfc->filter->close) bsfc->filter->close(bsfc); av_freep(&bsfc->priv_data); |