diff options
author | Clément Bœsch <clement.boesch@smartjog.com> | 2012-01-23 14:28:47 +0400 |
---|---|---|
committer | Clément Bœsch <ubitux@gmail.com> | 2012-01-24 13:43:42 +0400 |
commit | 66b1b7e5fade324b66f77dcccedcc8228a20bd12 (patch) | |
tree | 518355d79ae0fec9ce943035a8e4149aee05769e /libavfilter | |
parent | 94dc4a504638098a9e6a34ef895ba9f28534d445 (diff) |
pan: move query_formats() to avoid forward declarations.
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/af_pan.c | 71 |
1 files changed, 34 insertions, 37 deletions
diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c index 2da5079b5b..af3a86165b 100644 --- a/libavfilter/af_pan.c +++ b/libavfilter/af_pan.c @@ -191,9 +191,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args0, void *opaque) return 0; } -static void filter_samples_channel_mapping(PanContext *pan, AVFilterBufferRef *outsamples, AVFilterBufferRef *insamples, int n); -static void filter_samples_panning (PanContext *pan, AVFilterBufferRef *outsamples, AVFilterBufferRef *insamples, int n); - static int are_gains_pure(const PanContext *pan) { int i, j; @@ -216,40 +213,6 @@ static int are_gains_pure(const PanContext *pan) return 1; } -static int query_formats(AVFilterContext *ctx) -{ - PanContext *pan = ctx->priv; - AVFilterLink *inlink = ctx->inputs[0]; - AVFilterLink *outlink = ctx->outputs[0]; - AVFilterFormats *formats; - - if (pan->nb_output_channels <= SWR_CH_MAX) - pan->pure_gains = are_gains_pure(pan); - if (pan->pure_gains) { - /* libswr supports any sample and packing formats */ - avfilter_set_common_sample_formats(ctx, avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO)); - avfilter_set_common_packing_formats(ctx, avfilter_make_all_packing_formats()); - pan->filter_samples = filter_samples_channel_mapping; - } else { - const enum AVSampleFormat sample_fmts[] = {AV_SAMPLE_FMT_S16, -1}; - const int packing_fmts[] = {AVFILTER_PACKED, -1}; - - avfilter_set_common_sample_formats (ctx, avfilter_make_format_list(sample_fmts)); - avfilter_set_common_packing_formats(ctx, avfilter_make_format_list(packing_fmts)); - pan->filter_samples = filter_samples_panning; - } - - // inlink supports any channel layout - formats = avfilter_make_all_channel_layouts(); - avfilter_formats_ref(formats, &inlink->out_chlayouts); - - // outlink supports only requested output channel layout - formats = NULL; - avfilter_add_format(&formats, pan->out_channel_layout); - avfilter_formats_ref(formats, &outlink->in_chlayouts); - return 0; -} - static int config_props(AVFilterLink *link) { AVFilterContext *ctx = link->dst; @@ -403,6 +366,40 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples) avfilter_unref_buffer(insamples); } +static int query_formats(AVFilterContext *ctx) +{ + PanContext *pan = ctx->priv; + AVFilterLink *inlink = ctx->inputs[0]; + AVFilterLink *outlink = ctx->outputs[0]; + AVFilterFormats *formats; + + if (pan->nb_output_channels <= SWR_CH_MAX) + pan->pure_gains = are_gains_pure(pan); + if (pan->pure_gains) { + /* libswr supports any sample and packing formats */ + avfilter_set_common_sample_formats(ctx, avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO)); + avfilter_set_common_packing_formats(ctx, avfilter_make_all_packing_formats()); + pan->filter_samples = filter_samples_channel_mapping; + } else { + const enum AVSampleFormat sample_fmts[] = {AV_SAMPLE_FMT_S16, -1}; + const int packing_fmts[] = {AVFILTER_PACKED, -1}; + + avfilter_set_common_sample_formats (ctx, avfilter_make_format_list(sample_fmts)); + avfilter_set_common_packing_formats(ctx, avfilter_make_format_list(packing_fmts)); + pan->filter_samples = filter_samples_panning; + } + + // inlink supports any channel layout + formats = avfilter_make_all_channel_layouts(); + avfilter_formats_ref(formats, &inlink->out_chlayouts); + + // outlink supports only requested output channel layout + formats = NULL; + avfilter_add_format(&formats, pan->out_channel_layout); + avfilter_formats_ref(formats, &outlink->in_chlayouts); + return 0; +} + static av_cold void uninit(AVFilterContext *ctx) { PanContext *pan = ctx->priv; |