diff mbox

[FFmpeg-devel,1/2] avfilter/af_amerge: properly handle unknown input layouts

Message ID 20161215033919.2870-1-cus@passwd.hu
State Accepted
Commit 0db48ee4257c16f583b7b077fdbd13cfd0b9f037
Headers show

Commit Message

Marton Balint Dec. 15, 2016, 3:39 a.m. UTC
Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavfilter/af_amerge.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Marton Balint Dec. 23, 2016, 3:24 a.m. UTC | #1
On Thu, 15 Dec 2016, Marton Balint wrote:

> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> libavfilter/af_amerge.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c
> index 4a8c6d5..3bc7d89 100644
> --- a/libavfilter/af_amerge.c
> +++ b/libavfilter/af_amerge.c
> @@ -93,10 +93,15 @@ static int query_formats(AVFilterContext *ctx)
>             av_get_channel_layout_string(buf, sizeof(buf), 0, inlayout[i]);
>             av_log(ctx, AV_LOG_INFO, "Using \"%s\" for input %d\n", buf, i + 1);
>         }
> -        s->in[i].nb_ch = av_get_channel_layout_nb_channels(inlayout[i]);
> -        if (outlayout & inlayout[i])
> +        s->in[i].nb_ch = FF_LAYOUT2COUNT(inlayout[i]);
> +        if (s->in[i].nb_ch) {
>             overlap++;
> -        outlayout |= inlayout[i];
> +        } else {
> +            s->in[i].nb_ch = av_get_channel_layout_nb_channels(inlayout[i]);
> +            if (outlayout & inlayout[i])
> +                overlap++;
> +            outlayout |= inlayout[i];
> +        }
>         nb_ch += s->in[i].nb_ch;
>     }
>     if (nb_ch > SWR_CH_MAX) {

Ping for the series.

Thanks,
Marton
Nicolas George Dec. 23, 2016, 1:55 p.m. UTC | #2
Le quintidi 25 frimaire, an CCXXV, Marton Balint a écrit :
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavfilter/af_amerge.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

LGTM (I trust you tested it), sorry for the delay.

Regards,
Marton Balint Dec. 25, 2016, 8:11 p.m. UTC | #3
On Fri, 23 Dec 2016, Nicolas George wrote:

> Le quintidi 25 frimaire, an CCXXV, Marton Balint a écrit :
>> Signed-off-by: Marton Balint <cus@passwd.hu>
>> ---
>>  libavfilter/af_amerge.c | 11 ++++++++---
>>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> LGTM (I trust you tested it), sorry for the delay.

Yes, thanks, pushed.

Marton
diff mbox

Patch

diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c
index 4a8c6d5..3bc7d89 100644
--- a/libavfilter/af_amerge.c
+++ b/libavfilter/af_amerge.c
@@ -93,10 +93,15 @@  static int query_formats(AVFilterContext *ctx)
             av_get_channel_layout_string(buf, sizeof(buf), 0, inlayout[i]);
             av_log(ctx, AV_LOG_INFO, "Using \"%s\" for input %d\n", buf, i + 1);
         }
-        s->in[i].nb_ch = av_get_channel_layout_nb_channels(inlayout[i]);
-        if (outlayout & inlayout[i])
+        s->in[i].nb_ch = FF_LAYOUT2COUNT(inlayout[i]);
+        if (s->in[i].nb_ch) {
             overlap++;
-        outlayout |= inlayout[i];
+        } else {
+            s->in[i].nb_ch = av_get_channel_layout_nb_channels(inlayout[i]);
+            if (outlayout & inlayout[i])
+                overlap++;
+            outlayout |= inlayout[i];
+        }
         nb_ch += s->in[i].nb_ch;
     }
     if (nb_ch > SWR_CH_MAX) {