[FFmpeg-cvslog] If AVCodecContext.channel_layout and AVCodecContext.channels are both

Justin Ruggles git at videolan.org
Thu Apr 28 04:28:30 CEST 2011


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Tue Apr 19 19:02:32 2011 -0400| [168f9e8c40cf383802c8c8059f283a6ea789ec1e] | committer: Justin Ruggles

If AVCodecContext.channel_layout and AVCodecContext.channels are both
non-zero, check to make sure they do not contradict eachother.

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

 libavcodec/utils.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 8bb4d19..e4ea1e5 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -578,6 +578,13 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
                 }
             }
         }
+        if (avctx->channel_layout && avctx->channels) {
+            if (av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels) {
+                av_log(avctx, AV_LOG_ERROR, "channel layout does not match number of channels\n");
+                ret = AVERROR(EINVAL);
+                goto free_and_end;
+            }
+        }
     }
 
     if(avctx->codec->init && !(avctx->active_thread_type&FF_THREAD_FRAME)){



More information about the ffmpeg-cvslog mailing list