summaryrefslogtreecommitdiff
path: root/libavcodec/flacenc.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2011-04-25 11:23:06 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2011-04-25 11:23:06 +0200
commit6c9364168310ddb27059d07fdc04da84778d5f0b (patch)
treea70b080f870082d0dbfe6945016646fe738dce01 /libavcodec/flacenc.c
parentf27ac6d83c3d90cac49230480a8569a1651763bd (diff)
Warn if the source has unsupported (or no) channel layout.
Diffstat (limited to 'libavcodec/flacenc.c')
-rw-r--r--libavcodec/flacenc.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index 051de69c40..637d09dba5 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);