[FFmpeg-devel] [PATCH 3/6] src_buffer: introduce av_src_buffer_add_ref().

Stefano Sabatini stefasab at gmail.com
Sat Apr 28 00:16:18 CEST 2012


On date Friday 2012-04-27 21:48:07 +0200, Nicolas George encoded:
> This function merges the features of
> av_vsrc_buffer_add_video_buffer_ref() and
> av_buffersrc_buffer().
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavfilter/Makefile     |    2 +-
>  libavfilter/src_buffer.c |   43 ++++++++++++++++---------------------
>  libavfilter/src_buffer.h |   52 ++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 72 insertions(+), 25 deletions(-)
>  create mode 100644 libavfilter/src_buffer.h

src_buffer.h => buffersrc.h (which already exists)

This may seem a bit inconsistent, yet it is the better scheme which I
could devise (being the filter itself called buffersrc/buffersink that
makes sense), also that would be consistent with buffersink.h and with
the other headers scheme.

> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 95bcc5d..b21ea16 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -12,7 +12,7 @@ FFLIBS-$(CONFIG_REMOVELOGO_FILTER)           += swscale avformat avcodec
>  FFLIBS-$(CONFIG_SCALE_FILTER)                += swscale
>  FFLIBS-$(CONFIG_MP_FILTER)                   += avcodec postproc
>  
> -HEADERS = asrc_abuffer.h avcodec.h avfilter.h avfiltergraph.h buffersink.h version.h vsrc_buffer.h
> +HEADERS = asrc_abuffer.h avcodec.h avfilter.h avfiltergraph.h buffersink.h src_buffer.h version.h vsrc_buffer.h
>  
>  OBJS = allfilters.o                                                     \
>         avfilter.o                                                       \
> diff --git a/libavfilter/src_buffer.c b/libavfilter/src_buffer.c
> index e306034..d578a77 100644
> --- a/libavfilter/src_buffer.c
> +++ b/libavfilter/src_buffer.c
> @@ -29,6 +29,7 @@
>  #include "internal.h"
>  #include "avcodec.h"
>  #include "buffersrc.h"
> +#include "src_buffer.h"
>  #include "vsrc_buffer.h"
>  #include "asrc_abuffer.h"
>  #include "libavutil/audioconvert.h"
> @@ -69,8 +70,8 @@ typedef struct {
>          return AVERROR(EINVAL);\
>      }
>  
> -int av_vsrc_buffer_add_video_buffer_ref(AVFilterContext *buffer_filter,
> -                                        AVFilterBufferRef *picref, int flags)
> +int av_src_buffer_add_ref(AVFilterContext *buffer_filter,
> +                          AVFilterBufferRef *picref, int flags)

On the same overall API consistency ground, that would be:

av_buffersink_get_buffer_ref()
av_buffersrc_add_buffer_ref()

_add_ref also is fine, provided that we make it consistent with the
buffersink API.

[...]
-- 
FFmpeg = Fostering and Frightening Mean Pure Erroneous Gangster


More information about the ffmpeg-devel mailing list