Browse code

af_pan: move query_format before config_props.

That is the logical order in which the functions are called,
and there is no longer any need of forward declarations.

Nicolas George authored on 2012/02/21 05:45:18
Showing 1 changed files
... ...
@@ -210,6 +210,29 @@ static int are_gains_pure(const PanContext *pan)
210 210
     return 1;
211 211
 }
212 212
 
213
+static int query_formats(AVFilterContext *ctx)
214
+{
215
+    PanContext *pan = ctx->priv;
216
+    AVFilterLink *inlink  = ctx->inputs[0];
217
+    AVFilterLink *outlink = ctx->outputs[0];
218
+    AVFilterFormats *formats;
219
+
220
+    pan->pure_gains = are_gains_pure(pan);
221
+    /* libswr supports any sample and packing formats */
222
+    avfilter_set_common_sample_formats(ctx, avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO));
223
+    avfilter_set_common_packing_formats(ctx, avfilter_make_all_packing_formats());
224
+
225
+    // inlink supports any channel layout
226
+    formats = avfilter_make_all_channel_layouts();
227
+    avfilter_formats_ref(formats, &inlink->out_chlayouts);
228
+
229
+    // outlink supports only requested output channel layout
230
+    formats = NULL;
231
+    avfilter_add_format(&formats, pan->out_channel_layout);
232
+    avfilter_formats_ref(formats, &outlink->in_chlayouts);
233
+    return 0;
234
+}
235
+
213 236
 static int config_props(AVFilterLink *link)
214 237
 {
215 238
     AVFilterContext *ctx = link->dst;
... ...
@@ -343,29 +366,6 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
343 343
     avfilter_unref_buffer(insamples);
344 344
 }
345 345
 
346
-static int query_formats(AVFilterContext *ctx)
347
-{
348
-    PanContext *pan = ctx->priv;
349
-    AVFilterLink *inlink  = ctx->inputs[0];
350
-    AVFilterLink *outlink = ctx->outputs[0];
351
-    AVFilterFormats *formats;
352
-
353
-    pan->pure_gains = are_gains_pure(pan);
354
-    /* libswr supports any sample and packing formats */
355
-    avfilter_set_common_sample_formats(ctx, avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO));
356
-    avfilter_set_common_packing_formats(ctx, avfilter_make_all_packing_formats());
357
-
358
-    // inlink supports any channel layout
359
-    formats = avfilter_make_all_channel_layouts();
360
-    avfilter_formats_ref(formats, &inlink->out_chlayouts);
361
-
362
-    // outlink supports only requested output channel layout
363
-    formats = NULL;
364
-    avfilter_add_format(&formats, pan->out_channel_layout);
365
-    avfilter_formats_ref(formats, &outlink->in_chlayouts);
366
-    return 0;
367
-}
368
-
369 346
 static av_cold void uninit(AVFilterContext *ctx)
370 347
 {
371 348
     PanContext *pan = ctx->priv;