[FFmpeg-cvslog] lavfi/af_pan: support unknown layouts on output.

Nicolas George git at videolan.org
Thu Nov 28 01:36:16 CET 2013


ffmpeg | branch: release/2.1 | Nicolas George <george at nsup.org> | Fri Oct 25 16:02:04 2013 +0200| [bc04a3a489513eedb1c89eca46de971e2e638dfa] | committer: Carl Eugen Hoyos

lavfi/af_pan: support unknown layouts on output.
(cherry picked from commit 4e9adc9b7363cc336e3d47c98455e1508902fd29)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bc04a3a489513eedb1c89eca46de971e2e638dfa
---

 libavfilter/af_pan.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c
index e742d9e..9f78ff0 100644
--- a/libavfilter/af_pan.c
+++ b/libavfilter/af_pan.c
@@ -116,10 +116,10 @@ static av_cold int init(AVFilterContext *ctx)
     if (!args)
         return AVERROR(ENOMEM);
     arg = av_strtok(args, "|", &tokenizer);
-    ret = ff_parse_channel_layout(&pan->out_channel_layout, NULL, arg, ctx);
+    ret = ff_parse_channel_layout(&pan->out_channel_layout,
+                                  &pan->nb_output_channels, arg, ctx);
     if (ret < 0)
         goto fail;
-    pan->nb_output_channels = av_get_channel_layout_nb_channels(pan->out_channel_layout);
 
     /* parse channel specifications */
     while ((arg = arg0 = av_strtok(NULL, "|", &tokenizer))) {
@@ -244,7 +244,9 @@ static int query_formats(AVFilterContext *ctx)
 
     // outlink supports only requested output channel layout
     layouts = NULL;
-    ff_add_channel_layout(&layouts, pan->out_channel_layout);
+    ff_add_channel_layout(&layouts,
+                          pan->out_channel_layout ? pan->out_channel_layout :
+                          FF_COUNT2LAYOUT(pan->nb_output_channels));
     ff_channel_layouts_ref(layouts, &outlink->in_channel_layouts);
     return 0;
 }
@@ -286,6 +288,8 @@ static int config_props(AVFilterLink *link)
                                   0, ctx);
     if (!pan->swr)
         return AVERROR(ENOMEM);
+    if (!pan->out_channel_layout)
+        av_opt_set_int(pan->swr, "och", pan->nb_output_channels, 0);
 
     // gains are pure, init the channel mapping
     if (pan->pure_gains) {



More information about the ffmpeg-cvslog mailing list