[FFmpeg-cvslog] ffmpeg: remove 32 channel limit from audio_channels_map

Michael Niedermayer git at videolan.org
Fri Aug 15 05:51:04 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Aug 15 04:46:24 2014 +0200| [d3a22491c736588ee1e94a240bbe9e35bbb8d88a] | committer: Michael Niedermayer

ffmpeg: remove 32 channel limit from audio_channels_map

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 ffmpeg.c     |    3 +++
 ffmpeg.h     |    3 +--
 ffmpeg_opt.c |   12 +++++++-----
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 60b10cc..7999f72 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -483,6 +483,9 @@ static void ffmpeg_cleanup(int ret)
         av_freep(&ost->avfilter);
         av_freep(&ost->logfile_prefix);
 
+        av_freep(&ost->audio_channels_map);
+        ost->audio_channels_mapped = 0;
+
         avcodec_free_context(&ost->enc_ctx);
 
         av_freep(&output_streams[i]);
diff --git a/ffmpeg.h b/ffmpeg.h
index d124a2c..6545286 100644
--- a/ffmpeg.h
+++ b/ffmpeg.h
@@ -402,8 +402,7 @@ typedef struct OutputStream {
     double forced_keyframes_expr_const_values[FKF_NB];
 
     /* audio only */
-#define FF_CH_MAX 32
-    int audio_channels_map[FF_CH_MAX];   /* list of the channels id to pick from the source stream */
+    int *audio_channels_map;             /* list of the channels id to pick from the source stream */
     int audio_channels_mapped;           /* number of channels in audio_channels_map */
 
     char *logfile_prefix;
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 1962cf4..3cf78f0 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -1478,11 +1478,13 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in
                 }
 
                 if (!ist || (ist->file_index == map->file_idx && ist->st->index == map->stream_idx)) {
-                    if (ost->audio_channels_mapped < FF_ARRAY_ELEMS(ost->audio_channels_map))
-                        ost->audio_channels_map[ost->audio_channels_mapped++] = map->channel_idx;
-                    else
-                        av_log(NULL, AV_LOG_FATAL, "Max channel mapping for output %d.%d reached\n",
-                               ost->file_index, ost->st->index);
+                    if (av_reallocp_array(&ost->audio_channels_map,
+                                          ost->audio_channels_mapped + 1,
+                                          sizeof(*ost->audio_channels_map)
+                                          ) < 0 )
+                        exit_program(1);
+
+                    ost->audio_channels_map[ost->audio_channels_mapped++] = map->channel_idx;
                 }
             }
         }



More information about the ffmpeg-cvslog mailing list