diff options
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r-- | libavfilter/avfilter.c | 54 |
1 files changed, 44 insertions, 10 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 02915036ab..72e0a87f8e 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -2,20 +2,20 @@ * filter layer * Copyright (c) 2007 Bobby Bingham * - * 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 */ @@ -25,6 +25,7 @@ #include "libavutil/rational.h" #include "libavutil/audioconvert.h" #include "libavutil/imgutils.h" +#include "libavutil/avassert.h" #include "avfilter.h" #include "internal.h" @@ -34,13 +35,13 @@ unsigned avfilter_version(void) { const char *avfilter_configuration(void) { - return LIBAV_CONFIGURATION; + return FFMPEG_CONFIGURATION; } const char *avfilter_license(void) { #define LICENSE_PREFIX "libavfilter license: " - return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1; + return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1; } AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) @@ -69,14 +70,47 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) return ret; } +static void store_in_pool(AVFilterBufferRef *ref) +{ + int i; + AVFilterPool *pool= ref->buf->priv; + + av_assert0(ref->buf->data[0]); + + if(pool->count == POOL_SIZE){ + AVFilterBufferRef *ref1= pool->pic[0]; + av_freep(&ref1->video); + av_freep(&ref1->audio); + av_freep(&ref1->buf->data[0]); + av_freep(&ref1->buf); + av_free(ref1); + memmove(&pool->pic[0], &pool->pic[1], sizeof(void*)*(POOL_SIZE-1)); + pool->count--; + pool->pic[POOL_SIZE-1] = NULL; + } + + for(i=0; i<POOL_SIZE; i++){ + if(!pool->pic[i]){ + pool->pic[i]= ref; + pool->count++; + break; + } + } +} + void avfilter_unref_buffer(AVFilterBufferRef *ref) { if (!ref) return; - if (!(--ref->buf->refcount)) + if (!(--ref->buf->refcount)){ + if(!ref->buf->free){ + store_in_pool(ref); + return; + } ref->buf->free(ref->buf); - av_free(ref->video); - av_free(ref->audio); + } + av_freep(&ref->video); + av_freep(&ref->audio); av_free(ref); } @@ -238,7 +272,7 @@ static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end) if (ref->video) { av_dlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c", - ref->video->pixel_aspect.num, ref->video->pixel_aspect.den, + ref->video->sample_aspect_ratio.num, ref->video->sample_aspect_ratio.den, ref->video->w, ref->video->h, !ref->video->interlaced ? 'P' : /* Progressive */ ref->video->top_field_first ? 'T' : 'B', /* Top / Bottom */ |