[FFmpeg-devel] [PATCH] lavfi: deprecate av_vsrc_buffer_* API and drop it at the next major bump

Stefano Sabatini stefasab at gmail.com
Tue Jun 26 00:56:25 CEST 2012


Favor the av_buffersrc_* API instead, which is more powerful.

Avoid to support two distinct API for doing the same thing.
Note that the FF_API_VSRC_BUFFER_ADD_FRAME was previously defined but
never used.
---
 doc/examples/filtering_video.c |    2 +-
 libavfilter/avcodec.h          |    4 ++++
 libavfilter/src_buffer.c       |    2 ++
 libavfilter/version.h          |    4 ++--
 libavfilter/vsrc_buffer.h      |    2 ++
 5 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c
index 29fb77b..231a68e 100644
--- a/doc/examples/filtering_video.c
+++ b/doc/examples/filtering_video.c
@@ -201,7 +201,7 @@ int main(int argc, char **argv)
                 frame.pts = av_frame_get_best_effort_timestamp(&frame);
 
                 /* push the decoded frame into the filtergraph */
-                av_vsrc_buffer_add_frame(buffersrc_ctx, &frame, 0);
+                av_buffersrc_add_frame(buffersrc_ctx, &frame, 0);
 
                 /* pull filtered pictures from the filtergraph */
                 while (avfilter_poll_frame(buffersink_ctx->inputs[0])) {
diff --git a/libavfilter/avcodec.h b/libavfilter/avcodec.h
index b7965da..3324dd9 100644
--- a/libavfilter/avcodec.h
+++ b/libavfilter/avcodec.h
@@ -119,6 +119,7 @@ int avfilter_fill_frame_from_buffer_ref(AVFrame *frame,
 int av_buffersrc_add_frame(AVFilterContext *buffer_src,
                            const AVFrame *frame, int flags);
 
+#ifdef FF_API_VSRC_BUFFER
 /**
  * Add frame data to buffer_src.
  *
@@ -126,8 +127,11 @@ int av_buffersrc_add_frame(AVFilterContext *buffer_src,
  * @param flags a combination of AV_VSRC_BUF_FLAG_* flags
  * @return >= 0 in case of success, a negative AVERROR code in case of
  * failure
+ * @deprecated Use av_buffersrc_add_frame() instead.
  */
+attribute_deprecated
 int av_vsrc_buffer_add_frame(AVFilterContext *buffer_src,
                              const AVFrame *frame, int flags);
+#endif
 
 #endif /* AVFILTER_AVCODEC_H */
diff --git a/libavfilter/src_buffer.c b/libavfilter/src_buffer.c
index 981ae4d..85024a8 100644
--- a/libavfilter/src_buffer.c
+++ b/libavfilter/src_buffer.c
@@ -67,6 +67,7 @@ static void buf_free(AVFilterBuffer *ptr)
     return;
 }
 
+#ifdef FF_API_VSRC_BUFFER
 int av_vsrc_buffer_add_video_buffer_ref(AVFilterContext *buffer_filter,
                                         AVFilterBufferRef *picref, int flags)
 {
@@ -87,6 +88,7 @@ unsigned av_vsrc_buffer_get_nb_failed_requests(AVFilterContext *buffer_src)
 {
     return ((BufferSourceContext *)buffer_src->priv)->nb_failed_requests;
 }
+#endif
 
 int av_asrc_buffer_add_audio_buffer_ref(AVFilterContext *ctx,
                                         AVFilterBufferRef *samplesref,
diff --git a/libavfilter/version.h b/libavfilter/version.h
index d4d952b..1fca98f 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -53,8 +53,8 @@
 #ifndef FF_API_SAMPLERATE64
 #define FF_API_SAMPLERATE64             (LIBAVFILTER_VERSION_MAJOR < 3)
 #endif
-#ifndef FF_API_VSRC_BUFFER_ADD_FRAME
-#define FF_API_VSRC_BUFFER_ADD_FRAME        (LIBAVFILTER_VERSION_MAJOR < 3)
+#ifndef FF_API_VSRC_BUFFER
+#define FF_API_VSRC_BUFFER              (LIBAVFILTER_VERSION_MAJOR < 4)
 #endif
 #ifndef FF_API_PACKING
 #define FF_API_PACKING                  (LIBAVFILTER_VERSION_MAJOR < 3)
diff --git a/libavfilter/vsrc_buffer.h b/libavfilter/vsrc_buffer.h
index e752524..7318799 100644
--- a/libavfilter/vsrc_buffer.h
+++ b/libavfilter/vsrc_buffer.h
@@ -30,6 +30,7 @@
 
 #include "avfilter.h"
 
+#ifdef FF_API_VSRC_BUFFER
 /**
  * Tell av_vsrc_buffer_add_video_buffer_ref() to overwrite the already
  * cached video buffer with the new added one, otherwise the function
@@ -62,5 +63,6 @@ int av_vsrc_buffer_add_video_buffer_ref(AVFilterContext *buffer_src,
  */
 attribute_deprecated
 unsigned av_vsrc_buffer_get_nb_failed_requests(AVFilterContext *buffer_src);
+#endif
 
 #endif /* AVFILTER_VSRC_BUFFER_H */
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list