Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-05-07 09:20:32 +0400
committerJames Almer <jamrial@gmail.com>2022-03-15 15:42:41 +0300
commit5e257c1f7bf8bf277144b21200f3c6ed9a077af0 (patch)
tree300cf87cb7ee49ccd531725daf9cba479cf14343 /libavcodec/flacenc.c
parent06431f1997935b322e15e48a67cdd8714a035701 (diff)
flac: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/flacenc.c')
-rw-r--r--libavcodec/flacenc.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index 9f6f449323..0912ca2f47 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -241,7 +241,7 @@ static av_cold void dprint_compression_options(FlacEncodeContext *s)
static av_cold int flac_encode_init(AVCodecContext *avctx)
{
int freq = avctx->sample_rate;
- int channels = avctx->channels;
+ int channels = avctx->ch_layout.nb_channels;
FlacEncodeContext *s = avctx->priv_data;
int i, level, ret;
uint8_t *streaminfo;
@@ -398,18 +398,18 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
s->frame_count = 0;
s->min_framesize = s->max_framesize;
- 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) {
+ if ((channels == 3 &&
+ av_channel_layout_compare(&avctx->ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_SURROUND)) ||
+ (channels == 4 &&
+ av_channel_layout_compare(&avctx->ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_2_2) &&
+ av_channel_layout_compare(&avctx->ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_QUAD)) ||
+ (channels == 5 &&
+ av_channel_layout_compare(&avctx->ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0) &&
+ av_channel_layout_compare(&avctx->ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0_BACK)) ||
+ (channels == 6 &&
+ av_channel_layout_compare(&avctx->ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1) &&
+ av_channel_layout_compare(&avctx->ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1_BACK))) {
+ if (avctx->ch_layout.order != AV_CHANNEL_ORDER_UNSPEC) {
av_log(avctx, AV_LOG_ERROR, "Channel layout not supported by Flac, "
"output stream will have incorrect "
"channel layout.\n");