From 4f7dfe12eaffe2ec2399cc52ce9a8cb9f8fdb741 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Tue, 6 Sep 2011 18:37:44 +0200 Subject: lavfi: rename vsink_buffer.c to sink_buffer.c, and vsink_buffer.h to buffersink.h This is done in order to clarify the non-video-specific nature of the buffersink code, as the result of the video/audio API unification of the previous commit, and for improving overall consistency. --- libavfilter/Makefile | 6 +- libavfilter/avfilter.h | 2 +- libavfilter/buffersink.h | 88 +++++++++++++++ libavfilter/sink_buffer.c | 263 +++++++++++++++++++++++++++++++++++++++++++++ libavfilter/vsink_buffer.c | 263 --------------------------------------------- libavfilter/vsink_buffer.h | 88 --------------- 6 files changed, 355 insertions(+), 355 deletions(-) create mode 100644 libavfilter/buffersink.h create mode 100644 libavfilter/sink_buffer.c delete mode 100644 libavfilter/vsink_buffer.c delete mode 100644 libavfilter/vsink_buffer.h (limited to 'libavfilter') diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 0d791cb962..840d53ce39 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -8,7 +8,7 @@ FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec FFLIBS-$(CONFIG_SCALE_FILTER) += swscale FFLIBS-$(CONFIG_MP_FILTER) += avcodec -HEADERS = avcodec.h avfilter.h avfiltergraph.h vsink_buffer.h vsrc_buffer.h +HEADERS = avcodec.h avfilter.h avfiltergraph.h buffersink.h vsrc_buffer.h OBJS = allfilters.o \ avfilter.o \ @@ -29,7 +29,7 @@ OBJS-$(CONFIG_ABUFFER_FILTER) += asrc_abuffer.o OBJS-$(CONFIG_AMOVIE_FILTER) += src_movie.o OBJS-$(CONFIG_ANULLSRC_FILTER) += asrc_anullsrc.o -OBJS-$(CONFIG_ABUFFERSINK_FILTER) += vsink_buffer.o +OBJS-$(CONFIG_ABUFFERSINK_FILTER) += sink_buffer.o OBJS-$(CONFIG_ANULLSINK_FILTER) += asink_anullsink.o OBJS-$(CONFIG_BLACKFRAME_FILTER) += vf_blackframe.o @@ -82,7 +82,7 @@ OBJS-$(CONFIG_NULLSRC_FILTER) += vsrc_nullsrc.o OBJS-$(CONFIG_RGBTESTSRC_FILTER) += vsrc_testsrc.o OBJS-$(CONFIG_TESTSRC_FILTER) += vsrc_testsrc.o -OBJS-$(CONFIG_BUFFERSINK_FILTER) += vsink_buffer.o +OBJS-$(CONFIG_BUFFERSINK_FILTER) += sink_buffer.o OBJS-$(CONFIG_NULLSINK_FILTER) += vsink_nullsink.o diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 55cc57090e..b0811acaf6 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -29,7 +29,7 @@ #include "libavutil/rational.h" #define LIBAVFILTER_VERSION_MAJOR 2 -#define LIBAVFILTER_VERSION_MINOR 38 +#define LIBAVFILTER_VERSION_MINOR 39 #define LIBAVFILTER_VERSION_MICRO 0 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h new file mode 100644 index 0000000000..c5ae7dcdd0 --- /dev/null +++ b/libavfilter/buffersink.h @@ -0,0 +1,88 @@ +/* + * This file is part of FFmpeg. + * + * 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. + * + * 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_VSINK_BUFFER_H +#define AVFILTER_VSINK_BUFFER_H + +/** + * @file + * memory buffer sink API for audio and video + */ + +#include "avfilter.h" + +/** + * Struct to use for initializing a buffersink context. + */ +typedef struct { + const enum PixelFormat *pixel_fmts; ///< list of allowed pixel formats, terminated by PIX_FMT_NONE +} AVBufferSinkParams; + +/** + * Create an AVBufferSinkParams structure. + * + * Must be freed with av_free(). + */ +AVBufferSinkParams *av_buffersink_params_alloc(void); + +/** + * Struct to use for initializing an abuffersink context. + */ +typedef struct { + const enum AVSampleFormat *sample_fmts; ///< list of allowed sample formats, terminated by AV_SAMPLE_FMT_NONE + const int64_t *channel_layouts; ///< list of allowed channel layouts, terminated by -1 + const int *packing_fmts; ///< list of allowed packing formats +} AVABufferSinkParams; + +/** + * Create an AVABufferSinkParams structure. + * + * Must be freed with av_free(). + */ +AVABufferSinkParams *av_abuffersink_params_alloc(void); + +/** + * Tell av_buffersink_get_buffer_ref() to read video/samples buffer + * reference, but not remove it from the buffer. This is useful if you + * need only to read a video/samples buffer, without to fetch it. + */ +#define AV_BUFFERSINK_FLAG_PEEK 1 + +/** + * Get an audio/video buffer data from buffer_sink and put it in bufref. + * + * This function works with both audio and video buffer sinks. + * + * @param buffer_sink pointer to a buffersink or abuffersink context + * @param flags a combination of AV_BUFFERSINK_FLAG_* flags + * @return >= 0 in case of success, a negative AVERROR code in case of + * failure + */ +int av_buffersink_get_buffer_ref(AVFilterContext *buffer_sink, + AVFilterBufferRef **bufref, int flags); + +#if FF_API_OLD_VSINK_API +/** + * @deprecated Use av_buffersink_get_buffer_ref() instead. + */ +attribute_deprecated +int av_vsink_buffer_get_video_buffer_ref(AVFilterContext *buffer_sink, + AVFilterBufferRef **picref, int flags); +#endif + +#endif /* AVFILTER_VSINK_BUFFER_H */ diff --git a/libavfilter/sink_buffer.c b/libavfilter/sink_buffer.c new file mode 100644 index 0000000000..6f7c542498 --- /dev/null +++ b/libavfilter/sink_buffer.c @@ -0,0 +1,263 @@ +/* + * Copyright (c) 2011 Stefano Sabatini + * + * This file is part of FFmpeg. + * + * 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. + * + * 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * buffer video sink + */ + +#include "libavutil/fifo.h" +#include "avfilter.h" +#include "buffersink.h" + +AVBufferSinkParams *av_buffersink_params_alloc(void) +{ + static const int pixel_fmts[] = { -1 }; + AVBufferSinkParams *params = av_malloc(sizeof(AVBufferSinkParams)); + if (!params) + return NULL; + + params->pixel_fmts = pixel_fmts; + return params; +} + +AVABufferSinkParams *av_abuffersink_params_alloc(void) +{ + static const int sample_fmts[] = { -1 }; + static const int packing_fmts[] = { -1 }; + static const int64_t channel_layouts[] = { -1 }; + AVABufferSinkParams *params = av_malloc(sizeof(AVABufferSinkParams)); + + if (!params) + return NULL; + + params->sample_fmts = sample_fmts; + params->channel_layouts = channel_layouts; + params->packing_fmts = packing_fmts; + return params; +} + +typedef struct { + AVFifoBuffer *fifo; ///< FIFO buffer of video frame references + + /* only used for video */ + const enum PixelFormat *pixel_fmts; ///< list of accepted pixel formats, must be terminated with -1 + + /* only used for audio */ + const enum AVSampleFormat *sample_fmts; ///< list of accepted sample formats, terminated by AV_SAMPLE_FMT_NONE + const int64_t *channel_layouts; ///< list of accepted channel layouts, terminated by -1 + const int *packing_fmts; ///< list of accepted packing formats, terminated by -1 +} BufferSinkContext; + +#define FIFO_INIT_SIZE 8 + +static av_cold int common_init(AVFilterContext *ctx) +{ + BufferSinkContext *buf = ctx->priv; + + buf->fifo = av_fifo_alloc(FIFO_INIT_SIZE*sizeof(AVFilterBufferRef *)); + if (!buf->fifo) { + av_log(ctx, AV_LOG_ERROR, "Failed to allocate fifo\n"); + return AVERROR(ENOMEM); + } + return 0; +} + +static av_cold void common_uninit(AVFilterContext *ctx) +{ + BufferSinkContext *buf = ctx->priv; + AVFilterBufferRef *picref; + + if (buf->fifo) { + while (av_fifo_size(buf->fifo) >= sizeof(AVFilterBufferRef *)) { + av_fifo_generic_read(buf->fifo, &picref, sizeof(picref), NULL); + avfilter_unref_buffer(picref); + } + av_fifo_free(buf->fifo); + buf->fifo = NULL; + } +} + +static void end_frame(AVFilterLink *inlink) +{ + AVFilterContext *ctx = inlink->dst; + BufferSinkContext *buf = inlink->dst->priv; + + if (av_fifo_space(buf->fifo) < sizeof(AVFilterBufferRef *)) { + /* realloc fifo size */ + if (av_fifo_realloc2(buf->fifo, av_fifo_size(buf->fifo) * 2) < 0) { + av_log(ctx, AV_LOG_ERROR, + "Cannot buffer more frames. Consume some available frames " + "before adding new ones.\n"); + return; + } + } + + /* cache frame */ + av_fifo_generic_write(buf->fifo, + &inlink->cur_buf, sizeof(AVFilterBufferRef *), NULL); +} + +int av_buffersink_get_buffer_ref(AVFilterContext *ctx, + AVFilterBufferRef **bufref, int flags) +{ + BufferSinkContext *buf = ctx->priv; + AVFilterLink *inlink = ctx->inputs[0]; + int ret; + *bufref = NULL; + + /* no picref available, fetch it from the filterchain */ + if (!av_fifo_size(buf->fifo)) { + if ((ret = avfilter_request_frame(inlink)) < 0) + return ret; + } + + if (!av_fifo_size(buf->fifo)) + return AVERROR(EINVAL); + + if (flags & AV_BUFFERSINK_FLAG_PEEK) + *bufref = *((AVFilterBufferRef **)av_fifo_peek2(buf->fifo, 0)); + else + av_fifo_generic_read(buf->fifo, bufref, sizeof(*bufref), NULL); + + return 0; +} + +#if FF_API_OLD_VSINK_API +int av_vsink_buffer_get_video_buffer_ref(AVFilterContext *ctx, + AVFilterBufferRef **picref, int flags) +{ + return av_buffersink_get_buffer_ref(ctx, picref, flags); +} +#endif + +#if CONFIG_BUFFERSINK_FILTER + +static av_cold int vsink_init(AVFilterContext *ctx, const char *args, void *opaque) +{ + BufferSinkContext *buf = ctx->priv; + av_unused AVBufferSinkParams *params; + + if (!opaque) { + av_log(ctx, AV_LOG_ERROR, + "No opaque field provided\n"); + return AVERROR(EINVAL); + } else { +#if FF_API_OLD_VSINK_API + buf->pixel_fmts = (const enum PixelFormats *)opaque; +#else + params = (AVBufferSinkParams *)opaque; + buf->pixel_fmts = params->pixel_fmts; +#endif + } + + return common_init(ctx); +} + +static int vsink_query_formats(AVFilterContext *ctx) +{ + BufferSinkContext *buf = ctx->priv; + + avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(buf->pixel_fmts)); + return 0; +} + +AVFilter avfilter_vsink_buffersink = { + .name = "buffersink", + .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."), + .priv_size = sizeof(BufferSinkContext), + .init = vsink_init, + .uninit = common_uninit, + + .query_formats = vsink_query_formats, + + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .end_frame = end_frame, + .min_perms = AV_PERM_READ, }, + { .name = NULL }}, + .outputs = (AVFilterPad[]) {{ .name = NULL }}, +}; + +#endif /* CONFIG_BUFFERSINK_FILTER */ + +#if CONFIG_ABUFFERSINK_FILTER + +static void filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) +{ + end_frame(link); +} + +static av_cold int asink_init(AVFilterContext *ctx, const char *args, void *opaque) +{ + BufferSinkContext *buf = ctx->priv; + AVABufferSinkParams *params; + + if (!opaque) { + av_log(ctx, AV_LOG_ERROR, + "No opaque field provided, an AVABufferSinkParams struct is required\n"); + return AVERROR(EINVAL); + } else + params = (AVABufferSinkParams *)opaque; + + buf->sample_fmts = params->sample_fmts; + buf->channel_layouts = params->channel_layouts; + buf->packing_fmts = params->packing_fmts; + + return common_init(ctx); +} + +static int asink_query_formats(AVFilterContext *ctx) +{ + BufferSinkContext *buf = ctx->priv; + AVFilterFormats *formats = NULL; + + if (!(formats = avfilter_make_format_list(buf->sample_fmts))) + return AVERROR(ENOMEM); + avfilter_set_common_sample_formats(ctx, formats); + + if (!(formats = avfilter_make_format64_list(buf->channel_layouts))) + return AVERROR(ENOMEM); + avfilter_set_common_channel_layouts(ctx, formats); + + if (!(formats = avfilter_make_format_list(buf->packing_fmts))) + return AVERROR(ENOMEM); + avfilter_set_common_packing_formats(ctx, formats); + + return 0; +} + +AVFilter avfilter_asink_abuffersink = { + .name = "abuffersink", + .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."), + .init = asink_init, + .uninit = common_uninit, + .priv_size = sizeof(BufferSinkContext), + .query_formats = asink_query_formats, + + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_AUDIO, + .filter_samples = filter_samples, + .min_perms = AV_PERM_READ, }, + { .name = NULL }}, + .outputs = (AVFilterPad[]) {{ .name = NULL }}, +}; + +#endif /* CONFIG_ABUFFERSINK_FILTER */ diff --git a/libavfilter/vsink_buffer.c b/libavfilter/vsink_buffer.c deleted file mode 100644 index 4ae561c7a7..0000000000 --- a/libavfilter/vsink_buffer.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2011 Stefano Sabatini - * - * This file is part of FFmpeg. - * - * 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. - * - * 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 FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * buffer video sink - */ - -#include "libavutil/fifo.h" -#include "avfilter.h" -#include "vsink_buffer.h" - -AVBufferSinkParams *av_buffersink_params_alloc(void) -{ - static const int pixel_fmts[] = { -1 }; - AVBufferSinkParams *params = av_malloc(sizeof(AVBufferSinkParams)); - if (!params) - return NULL; - - params->pixel_fmts = pixel_fmts; - return params; -} - -AVABufferSinkParams *av_abuffersink_params_alloc(void) -{ - static const int sample_fmts[] = { -1 }; - static const int packing_fmts[] = { -1 }; - static const int64_t channel_layouts[] = { -1 }; - AVABufferSinkParams *params = av_malloc(sizeof(AVABufferSinkParams)); - - if (!params) - return NULL; - - params->sample_fmts = sample_fmts; - params->channel_layouts = channel_layouts; - params->packing_fmts = packing_fmts; - return params; -} - -typedef struct { - AVFifoBuffer *fifo; ///< FIFO buffer of video frame references - - /* only used for video */ - const enum PixelFormat *pixel_fmts; ///< list of accepted pixel formats, must be terminated with -1 - - /* only used for audio */ - const enum AVSampleFormat *sample_fmts; ///< list of accepted sample formats, terminated by AV_SAMPLE_FMT_NONE - const int64_t *channel_layouts; ///< list of accepted channel layouts, terminated by -1 - const int *packing_fmts; ///< list of accepted packing formats, terminated by -1 -} BufferSinkContext; - -#define FIFO_INIT_SIZE 8 - -static av_cold int common_init(AVFilterContext *ctx) -{ - BufferSinkContext *buf = ctx->priv; - - buf->fifo = av_fifo_alloc(FIFO_INIT_SIZE*sizeof(AVFilterBufferRef *)); - if (!buf->fifo) { - av_log(ctx, AV_LOG_ERROR, "Failed to allocate fifo\n"); - return AVERROR(ENOMEM); - } - return 0; -} - -static av_cold void common_uninit(AVFilterContext *ctx) -{ - BufferSinkContext *buf = ctx->priv; - AVFilterBufferRef *picref; - - if (buf->fifo) { - while (av_fifo_size(buf->fifo) >= sizeof(AVFilterBufferRef *)) { - av_fifo_generic_read(buf->fifo, &picref, sizeof(picref), NULL); - avfilter_unref_buffer(picref); - } - av_fifo_free(buf->fifo); - buf->fifo = NULL; - } -} - -static void end_frame(AVFilterLink *inlink) -{ - AVFilterContext *ctx = inlink->dst; - BufferSinkContext *buf = inlink->dst->priv; - - if (av_fifo_space(buf->fifo) < sizeof(AVFilterBufferRef *)) { - /* realloc fifo size */ - if (av_fifo_realloc2(buf->fifo, av_fifo_size(buf->fifo) * 2) < 0) { - av_log(ctx, AV_LOG_ERROR, - "Cannot buffer more frames. Consume some available frames " - "before adding new ones.\n"); - return; - } - } - - /* cache frame */ - av_fifo_generic_write(buf->fifo, - &inlink->cur_buf, sizeof(AVFilterBufferRef *), NULL); -} - -int av_buffersink_get_buffer_ref(AVFilterContext *ctx, - AVFilterBufferRef **bufref, int flags) -{ - BufferSinkContext *buf = ctx->priv; - AVFilterLink *inlink = ctx->inputs[0]; - int ret; - *bufref = NULL; - - /* no picref available, fetch it from the filterchain */ - if (!av_fifo_size(buf->fifo)) { - if ((ret = avfilter_request_frame(inlink)) < 0) - return ret; - } - - if (!av_fifo_size(buf->fifo)) - return AVERROR(EINVAL); - - if (flags & AV_BUFFERSINK_FLAG_PEEK) - *bufref = *((AVFilterBufferRef **)av_fifo_peek2(buf->fifo, 0)); - else - av_fifo_generic_read(buf->fifo, bufref, sizeof(*bufref), NULL); - - return 0; -} - -#if FF_API_OLD_VSINK_API -int av_vsink_buffer_get_video_buffer_ref(AVFilterContext *ctx, - AVFilterBufferRef **picref, int flags) -{ - return av_buffersink_get_buffer_ref(ctx, picref, flags); -} -#endif - -#if CONFIG_BUFFERSINK_FILTER - -static av_cold int vsink_init(AVFilterContext *ctx, const char *args, void *opaque) -{ - BufferSinkContext *buf = ctx->priv; - av_unused AVBufferSinkParams *params; - - if (!opaque) { - av_log(ctx, AV_LOG_ERROR, - "No opaque field provided\n"); - return AVERROR(EINVAL); - } else { -#if FF_API_OLD_VSINK_API - buf->pixel_fmts = (const enum PixelFormats *)opaque; -#else - params = (AVBufferSinkParams *)opaque; - buf->pixel_fmts = params->pixel_fmts; -#endif - } - - return common_init(ctx); -} - -static int vsink_query_formats(AVFilterContext *ctx) -{ - BufferSinkContext *buf = ctx->priv; - - avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(buf->pixel_fmts)); - return 0; -} - -AVFilter avfilter_vsink_buffersink = { - .name = "buffersink", - .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."), - .priv_size = sizeof(BufferSinkContext), - .init = vsink_init, - .uninit = common_uninit, - - .query_formats = vsink_query_formats, - - .inputs = (AVFilterPad[]) {{ .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - .end_frame = end_frame, - .min_perms = AV_PERM_READ, }, - { .name = NULL }}, - .outputs = (AVFilterPad[]) {{ .name = NULL }}, -}; - -#endif /* CONFIG_BUFFERSINK_FILTER */ - -#if CONFIG_ABUFFERSINK_FILTER - -static void filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) -{ - end_frame(link); -} - -static av_cold int asink_init(AVFilterContext *ctx, const char *args, void *opaque) -{ - BufferSinkContext *buf = ctx->priv; - AVABufferSinkParams *params; - - if (!opaque) { - av_log(ctx, AV_LOG_ERROR, - "No opaque field provided, an AVABufferSinkParams struct is required\n"); - return AVERROR(EINVAL); - } else - params = (AVABufferSinkParams *)opaque; - - buf->sample_fmts = params->sample_fmts; - buf->channel_layouts = params->channel_layouts; - buf->packing_fmts = params->packing_fmts; - - return common_init(ctx); -} - -static int asink_query_formats(AVFilterContext *ctx) -{ - BufferSinkContext *buf = ctx->priv; - AVFilterFormats *formats = NULL; - - if (!(formats = avfilter_make_format_list(buf->sample_fmts))) - return AVERROR(ENOMEM); - avfilter_set_common_sample_formats(ctx, formats); - - if (!(formats = avfilter_make_format64_list(buf->channel_layouts))) - return AVERROR(ENOMEM); - avfilter_set_common_channel_layouts(ctx, formats); - - if (!(formats = avfilter_make_format_list(buf->packing_fmts))) - return AVERROR(ENOMEM); - avfilter_set_common_packing_formats(ctx, formats); - - return 0; -} - -AVFilter avfilter_asink_abuffersink = { - .name = "abuffersink", - .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."), - .init = asink_init, - .uninit = common_uninit, - .priv_size = sizeof(BufferSinkContext), - .query_formats = asink_query_formats, - - .inputs = (AVFilterPad[]) {{ .name = "default", - .type = AVMEDIA_TYPE_AUDIO, - .filter_samples = filter_samples, - .min_perms = AV_PERM_READ, }, - { .name = NULL }}, - .outputs = (AVFilterPad[]) {{ .name = NULL }}, -}; - -#endif /* CONFIG_ABUFFERSINK_FILTER */ diff --git a/libavfilter/vsink_buffer.h b/libavfilter/vsink_buffer.h deleted file mode 100644 index c5ae7dcdd0..0000000000 --- a/libavfilter/vsink_buffer.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * 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. - * - * 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 FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFILTER_VSINK_BUFFER_H -#define AVFILTER_VSINK_BUFFER_H - -/** - * @file - * memory buffer sink API for audio and video - */ - -#include "avfilter.h" - -/** - * Struct to use for initializing a buffersink context. - */ -typedef struct { - const enum PixelFormat *pixel_fmts; ///< list of allowed pixel formats, terminated by PIX_FMT_NONE -} AVBufferSinkParams; - -/** - * Create an AVBufferSinkParams structure. - * - * Must be freed with av_free(). - */ -AVBufferSinkParams *av_buffersink_params_alloc(void); - -/** - * Struct to use for initializing an abuffersink context. - */ -typedef struct { - const enum AVSampleFormat *sample_fmts; ///< list of allowed sample formats, terminated by AV_SAMPLE_FMT_NONE - const int64_t *channel_layouts; ///< list of allowed channel layouts, terminated by -1 - const int *packing_fmts; ///< list of allowed packing formats -} AVABufferSinkParams; - -/** - * Create an AVABufferSinkParams structure. - * - * Must be freed with av_free(). - */ -AVABufferSinkParams *av_abuffersink_params_alloc(void); - -/** - * Tell av_buffersink_get_buffer_ref() to read video/samples buffer - * reference, but not remove it from the buffer. This is useful if you - * need only to read a video/samples buffer, without to fetch it. - */ -#define AV_BUFFERSINK_FLAG_PEEK 1 - -/** - * Get an audio/video buffer data from buffer_sink and put it in bufref. - * - * This function works with both audio and video buffer sinks. - * - * @param buffer_sink pointer to a buffersink or abuffersink context - * @param flags a combination of AV_BUFFERSINK_FLAG_* flags - * @return >= 0 in case of success, a negative AVERROR code in case of - * failure - */ -int av_buffersink_get_buffer_ref(AVFilterContext *buffer_sink, - AVFilterBufferRef **bufref, int flags); - -#if FF_API_OLD_VSINK_API -/** - * @deprecated Use av_buffersink_get_buffer_ref() instead. - */ -attribute_deprecated -int av_vsink_buffer_get_video_buffer_ref(AVFilterContext *buffer_sink, - AVFilterBufferRef **picref, int flags); -#endif - -#endif /* AVFILTER_VSINK_BUFFER_H */ -- cgit v1.2.3