aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/sink_buffer.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2013-02-03 19:33:58 +0100
committerStefano Sabatini <stefasab@gmail.com>2013-02-24 23:21:28 +0100
commitb59cd089ffd6fc976dca28649ad6c5d9f03b4569 (patch)
tree250699964f4c879b09a9bf3c653364467f252d4a /libavfilter/sink_buffer.c
parent5085b46496f0df5f4f7259d03f21d3f814aa28e2 (diff)
downloadffmpeg-b59cd089ffd6fc976dca28649ad6c5d9f03b4569.tar.gz
lavfi/abuffersink: add sample_rates field to AVABufferSinkParams
Allow to select sample rates.
Diffstat (limited to 'libavfilter/sink_buffer.c')
-rw-r--r--libavfilter/sink_buffer.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavfilter/sink_buffer.c b/libavfilter/sink_buffer.c
index 0edf9c5e0b..ea0cf06e93 100644
--- a/libavfilter/sink_buffer.c
+++ b/libavfilter/sink_buffer.c
@@ -62,6 +62,7 @@ typedef struct {
enum AVSampleFormat *sample_fmts; ///< list of accepted sample formats, terminated by AV_SAMPLE_FMT_NONE
int64_t *channel_layouts; ///< list of accepted channel layouts, terminated by -1
int all_channel_counts;
+ int *sample_rates; ///< list of accepted sample rates, terminated by -1
} BufferSinkContext;
#define FIFO_INIT_SIZE 8
@@ -303,6 +304,11 @@ static av_cold int asink_init(AVFilterContext *ctx, const char *args, void *opaq
if (!buf->sample_fmts)
return AVERROR(ENOMEM);
}
+ if (params && params->sample_rates) {
+ buf->sample_rates = ff_copy_int_list(params->sample_rates);
+ if (!buf->sample_rates)
+ return AVERROR(ENOMEM);
+ }
if (params && (params->channel_layouts || params->channel_counts)) {
if (params->all_channel_counts) {
av_log(ctx, AV_LOG_ERROR,
@@ -324,6 +330,7 @@ static av_cold void asink_uninit(AVFilterContext *ctx)
BufferSinkContext *buf = ctx->priv;
av_freep(&buf->sample_fmts);
+ av_freep(&buf->sample_rates);
av_freep(&buf->channel_layouts);
common_uninit(ctx);
}
@@ -348,6 +355,13 @@ static int asink_query_formats(AVFilterContext *ctx)
ff_set_common_channel_layouts(ctx, layouts);
}
+ if (buf->sample_rates) {
+ formats = ff_make_format_list(buf->sample_rates);
+ if (!formats)
+ return AVERROR(ENOMEM);
+ ff_set_common_samplerates(ctx, formats);
+ }
+
return 0;
}