[FFmpeg-cvslog] Warn if the source has unsupported (or no) channel layout.

Carl Eugen Hoyos git at videolan.org
Wed Apr 27 00:53:58 CEST 2011


ffmpeg | branch: oldabi | Carl Eugen Hoyos <cehoyos at ag.or.at> | Mon Apr 25 11:23:06 2011 +0200| [6c9364168310ddb27059d07fdc04da84778d5f0b] | committer: Carl Eugen Hoyos

Warn if the source has unsupported (or no) channel layout.

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

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

diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index 051de69..637d09d 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -425,6 +425,28 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
     if (!avctx->coded_frame)
         return AVERROR(ENOMEM);
 
+    if (channels == 3 &&
+            avctx->channel_layout != (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER) ||
+        channels == 4 &&
+            avctx->channel_layout != AV_CH_LAYOUT_2_2 &&
+            avctx->channel_layout != AV_CH_LAYOUT_QUAD ||
+        channels == 5 &&
+            avctx->channel_layout != AV_CH_LAYOUT_5POINT0 &&
+            avctx->channel_layout != AV_CH_LAYOUT_5POINT0_BACK ||
+        channels == 6 &&
+            avctx->channel_layout != AV_CH_LAYOUT_5POINT1 &&
+            avctx->channel_layout != AV_CH_LAYOUT_5POINT1_BACK) {
+        if (avctx->channel_layout) {
+            av_log(avctx, AV_LOG_ERROR, "Channel layout not supported by Flac, "
+                                             "output stream will have incorrect "
+                                             "channel layout.\n");
+        } else {
+            av_log(avctx, AV_LOG_WARNING, "No channel layout specified. The encoder "
+                                               "will use Flac channel layout for "
+                                               "%d channels.\n", channels);
+        }
+    }
+
     ret = ff_lpc_init(&s->lpc_ctx, avctx->frame_size,
                       s->options.max_prediction_order, AV_LPC_TYPE_LEVINSON);
 



More information about the ffmpeg-cvslog mailing list