asink_abuffer: extend ABufferSinkContext to make it accept lists of formats in input

This is required for the pending lavfi indev extension, also
consistent with the video buffer sink.
This commit is contained in:
Stefano Sabatini 2011-08-18 14:58:47 +02:00
parent 3e4666f34c
commit df4c7ae9db
3 changed files with 11 additions and 15 deletions

View File

@ -46,22 +46,18 @@ static int init(AVFilterContext *ctx, const char *args, void *opaque)
static int query_formats(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx)
{ {
ABufferSinkContext *abuffersink = ctx->priv; ABufferSinkContext *abuffersink = ctx->priv;
AVFilterFormats *formats; AVFilterFormats *formats = NULL;
int ret;
formats = NULL; if (!(formats = avfilter_make_format_list(abuffersink->sample_fmts)))
if ((ret = avfilter_add_format(&formats, abuffersink->sample_fmt)) < 0) return AVERROR(ENOMEM);
return ret;
avfilter_set_common_sample_formats(ctx, formats); avfilter_set_common_sample_formats(ctx, formats);
formats = NULL; if (!(formats = avfilter_make_format64_list(abuffersink->channel_layouts)))
if ((ret = avfilter_add_format(&formats, abuffersink->channel_layout)) < 0) return AVERROR(ENOMEM);
return ret;
avfilter_set_common_channel_layouts(ctx, formats); avfilter_set_common_channel_layouts(ctx, formats);
formats = NULL; if (!(formats = avfilter_make_format_list(abuffersink->packing_fmts)))
if ((ret = avfilter_add_format(&formats, abuffersink->planar)) < 0) return AVERROR(ENOMEM);
return ret;
avfilter_set_common_packing_formats(ctx, formats); avfilter_set_common_packing_formats(ctx, formats);
return 0; return 0;

View File

@ -27,9 +27,9 @@
#include "avfilter.h" #include "avfilter.h"
typedef struct { typedef struct {
enum AVSampleFormat sample_fmt; const enum AVSampleFormat *sample_fmts; ///< list of allowed sample formats, terminated by -1
int64_t channel_layout; const int64_t *channel_layouts; ///< list of allowed channel layouts, terminated by -1
int planar; const int *packing_fmts; ///< list of allowed packing formats, terminated by -1
} ABufferSinkContext; } ABufferSinkContext;

View File

@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 2 #define LIBAVFILTER_VERSION_MAJOR 2
#define LIBAVFILTER_VERSION_MINOR 34 #define LIBAVFILTER_VERSION_MINOR 34
#define LIBAVFILTER_VERSION_MICRO 1 #define LIBAVFILTER_VERSION_MICRO 2
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \ LIBAVFILTER_VERSION_MINOR, \