[FFmpeg-devel] [PATCH 12/13] buffersink: use sizeof(void *) because AVFilterBufferRef is deprecated

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Sat Aug 8 13:33:14 CEST 2015


Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 libavfilter/buffersink.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
index a303127..5bf31a0 100644
--- a/libavfilter/buffersink.c
+++ b/libavfilter/buffersink.c
@@ -72,7 +72,7 @@ static av_cold void uninit(AVFilterContext *ctx)
         av_audio_fifo_free(sink->audio_fifo);
 
     if (sink->fifo) {
-        while (av_fifo_size(sink->fifo) >= sizeof(AVFilterBufferRef *)) {
+        while (av_fifo_size(sink->fifo) >= sizeof(void *)) {
             av_fifo_generic_read(sink->fifo, &frame, sizeof(frame), NULL);
             av_frame_free(&frame);
         }
@@ -84,7 +84,7 @@ static int add_buffer_ref(AVFilterContext *ctx, AVFrame *ref)
 {
     BufferSinkContext *buf = ctx->priv;
 
-    if (av_fifo_space(buf->fifo) < sizeof(AVFilterBufferRef *)) {
+    if (av_fifo_space(buf->fifo) < sizeof(void *)) {
         /* realloc fifo size */
         if (av_fifo_realloc2(buf->fifo, av_fifo_size(buf->fifo) * 2) < 0) {
             av_log(ctx, AV_LOG_ERROR,
@@ -95,7 +95,7 @@ static int add_buffer_ref(AVFilterContext *ctx, AVFrame *ref)
     }
 
     /* cache frame */
-    av_fifo_generic_write(buf->fifo, &ref, sizeof(AVFilterBufferRef *), NULL);
+    av_fifo_generic_write(buf->fifo, &ref, sizeof(void *), NULL);
     return 0;
 }
 
@@ -108,7 +108,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
     if ((ret = add_buffer_ref(ctx, frame)) < 0)
         return ret;
     if (buf->warning_limit &&
-        av_fifo_size(buf->fifo) / sizeof(AVFilterBufferRef *) >= buf->warning_limit) {
+        av_fifo_size(buf->fifo) / sizeof(void *) >= buf->warning_limit) {
         av_log(ctx, AV_LOG_WARNING,
                "%d buffers queued in %s, something may be wrong.\n",
                buf->warning_limit,
@@ -248,7 +248,7 @@ static av_cold int common_init(AVFilterContext *ctx)
 {
     BufferSinkContext *buf = ctx->priv;
 
-    buf->fifo = av_fifo_alloc_array(FIFO_INIT_SIZE, sizeof(AVFilterBufferRef *));
+    buf->fifo = av_fifo_alloc_array(FIFO_INIT_SIZE, sizeof(void *));
     if (!buf->fifo) {
         av_log(ctx, AV_LOG_ERROR, "Failed to allocate fifo\n");
         return AVERROR(ENOMEM);
@@ -375,7 +375,7 @@ int attribute_align_arg av_buffersink_poll_frame(AVFilterContext *ctx)
                || !strcmp(ctx->filter->name, "ffbuffersink")
                || !strcmp(ctx->filter->name, "ffabuffersink"));
 
-    return av_fifo_size(buf->fifo)/sizeof(AVFilterBufferRef *) + ff_poll_frame(inlink);
+    return av_fifo_size(buf->fifo)/sizeof(void *) + ff_poll_frame(inlink);
 }
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
-- 
2.4.6


More information about the ffmpeg-devel mailing list