src_buffer: merge av_asrc_buffer_add_audio_buffer_ref.
authorNicolas George <nicolas.george@normalesup.org>
Fri, 27 Apr 2012 22:16:20 +0000 (00:16 +0200)
committerNicolas George <nicolas.george@normalesup.org>
Thu, 3 May 2012 17:55:28 +0000 (19:55 +0200)
Implement it using av_buffersrc_add_ref.

libavfilter/src_buffer.c

index 4c994c8..70af9c3 100644 (file)
@@ -570,27 +570,7 @@ int av_asrc_buffer_add_audio_buffer_ref(AVFilterContext *ctx,
                                         AVFilterBufferRef *samplesref,
                                         int av_unused flags)
 {
-    BufferSourceContext *abuffer = ctx->priv;
-    int ret;
-
-    if (av_fifo_space(abuffer->fifo) < sizeof(samplesref)) {
-        av_log(ctx, AV_LOG_ERROR,
-               "Buffering limit reached. Please consume some available frames "
-               "before adding new ones.\n");
-        return AVERROR(EINVAL);
-    }
-
-    ret = check_format_change(ctx, samplesref);
-    if (ret < 0)
-        return ret;
-
-    if (sizeof(samplesref) != av_fifo_generic_write(abuffer->fifo, &samplesref,
-                                                    sizeof(samplesref), NULL)) {
-        av_log(ctx, AV_LOG_ERROR, "Error while writing to FIFO\n");
-        return AVERROR(EINVAL);
-    }
-
-    return 0;
+    return av_buffersrc_add_ref(ctx, samplesref, AV_BUFFERSRC_FLAG_NO_COPY);
 }
 
 int av_asrc_buffer_add_samples(AVFilterContext *ctx,