[FFmpeg-devel] [PATCH 3/4] pan: move query_formats() to avoid forward declarations.
Clément Bœsch
ubitux at gmail.com
Wed Jan 18 13:31:31 CET 2012
From: Clément Bœsch <clement.boesch at smartjog.com>
---
libavfilter/af_pan.c | 67 ++++++++++++++++++++++++--------------------------
1 files changed, 32 insertions(+), 35 deletions(-)
diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c
index 37831da..e2aa28f 100644
--- a/libavfilter/af_pan.c
+++ b/libavfilter/af_pan.c
@@ -208,41 +208,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args0, void *opaque)
return 0;
}
-static void filter_samples_channel_mapping(AVFilterLink *inlink, AVFilterBufferRef *insamples);
-static void filter_samples_panning (AVFilterLink *inlink, AVFilterBufferRef *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->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;
@@ -387,6 +352,38 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
pan->filter_samples(inlink, 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->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;
+}
+
AVFilter avfilter_af_pan = {
.name = "pan",
.description = NULL_IF_CONFIG_SMALL("Remix channels with coefficients (panning)"),
--
1.7.8.3
More information about the ffmpeg-devel
mailing list