diff mbox series

[FFmpeg-devel,1/6] avfilter/af_channelmap: fix error message if FL source channel was missing

Message ID 20240319211504.8342-1-cus@passwd.hu
State Accepted
Commit 9a5627ea9a213c4929020ee8c90bae74788f645c
Headers show
Series [FFmpeg-devel,1/6] avfilter/af_channelmap: fix error message if FL source channel was missing | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marton Balint March 19, 2024, 9:14 p.m. UTC
FL channel ID is 0, so for an unset value we must check for ID < 0.

Regression since 1f96db959c1235bb7079d354e09914a0a2608f62.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavfilter/af_channelmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Marton Balint March 23, 2024, 11:18 a.m. UTC | #1
On Tue, 19 Mar 2024, Marton Balint wrote:

> FL channel ID is 0, so for an unset value we must check for ID < 0.
>
> Regression since 1f96db959c1235bb7079d354e09914a0a2608f62.

Will apply the series soon.

Regards,
Marton

>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> libavfilter/af_channelmap.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c
> index 5e1cf57680..d13dcc317d 100644
> --- a/libavfilter/af_channelmap.c
> +++ b/libavfilter/af_channelmap.c
> @@ -165,7 +165,7 @@ static av_cold int channelmap_init(AVFilterContext *ctx)
>
>     for (i = 0; i < map_entries; i++) {
>         int in_ch_idx = -1, out_ch_idx = -1;
> -        int in_ch = 0, out_ch = 0;
> +        int in_ch = -1, out_ch = -1;
>         static const char err[] = "Failed to parse channel map\n";
>         switch (mode) {
>         case MAP_ONE_INT:
> @@ -349,7 +349,7 @@ static int channelmap_config_input(AVFilterLink *inlink)
>
>         if (m->in_channel_idx < 0 || m->in_channel_idx >= nb_channels) {
>             av_channel_layout_describe(&inlink->ch_layout, layout_name, sizeof(layout_name));
> -            if (m->in_channel) {
> +            if (m->in_channel >= 0) {
>                 av_channel_name(channel_name, sizeof(channel_name), m->in_channel);
>                 av_log(ctx, AV_LOG_ERROR,
>                        "input channel '%s' not available from input layout '%s'\n",
> -- 
> 2.35.3
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
diff mbox series

Patch

diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c
index 5e1cf57680..d13dcc317d 100644
--- a/libavfilter/af_channelmap.c
+++ b/libavfilter/af_channelmap.c
@@ -165,7 +165,7 @@  static av_cold int channelmap_init(AVFilterContext *ctx)
 
     for (i = 0; i < map_entries; i++) {
         int in_ch_idx = -1, out_ch_idx = -1;
-        int in_ch = 0, out_ch = 0;
+        int in_ch = -1, out_ch = -1;
         static const char err[] = "Failed to parse channel map\n";
         switch (mode) {
         case MAP_ONE_INT:
@@ -349,7 +349,7 @@  static int channelmap_config_input(AVFilterLink *inlink)
 
         if (m->in_channel_idx < 0 || m->in_channel_idx >= nb_channels) {
             av_channel_layout_describe(&inlink->ch_layout, layout_name, sizeof(layout_name));
-            if (m->in_channel) {
+            if (m->in_channel >= 0) {
                 av_channel_name(channel_name, sizeof(channel_name), m->in_channel);
                 av_log(ctx, AV_LOG_ERROR,
                        "input channel '%s' not available from input layout '%s'\n",