diff options
author | Justin Ruggles | 2012-02-22 21:45:06 -0500 |
---|---|---|
committer | Justin Ruggles | 2012-02-29 14:36:00 -0500 |
commit | 4e99501f629f6baebac0414d92d841b64ead30fe (patch) | |
tree | 968a7b6458290fd144e072aea67b5f0cb10df2e9 /libavcodec/ac3enc.c | |
parent | 6aeea1dfb2f21de959701ee7dfaab59b4634e570 (diff) |
(e)ac3enc: select a default bit rate based on the channel layout
Diffstat (limited to 'libavcodec/ac3enc.c')
-rw-r--r-- | libavcodec/ac3enc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 669be23a05..967c1bd8d3 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -2141,6 +2141,17 @@ static av_cold int validate_options(AC3EncodeContext *s) s->bit_alloc.sr_code = i % 3; s->bitstream_id = s->eac3 ? 16 : 8 + s->bit_alloc.sr_shift; + /* select a default bit rate if not set by the user */ + if (!avctx->bit_rate) { + switch (s->fbw_channels) { + case 1: avctx->bit_rate = 96000; break; + case 2: avctx->bit_rate = 192000; break; + case 3: avctx->bit_rate = 320000; break; + case 4: avctx->bit_rate = 384000; break; + case 5: avctx->bit_rate = 448000; break; + } + } + /* validate bit rate */ if (s->eac3) { int max_br, min_br, wpf, min_br_dist, min_br_code; |