1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

libavcodec/flacenc: Enable sample rates > 655350 Hz

Also, make use of the full sample rate code table

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Martijn van Beurden 2022-10-31 17:09:15 +01:00 committed by Michael Niedermayer
parent 752039a9eb
commit bf6c500cff
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -299,7 +299,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
/* find samplerate in table */ /* find samplerate in table */
if (freq < 1) if (freq < 1)
return AVERROR(EINVAL); return AVERROR(EINVAL);
for (i = 4; i < 12; i++) { for (i = 1; i < 12; i++) {
if (freq == ff_flac_sample_rate_table[i]) { if (freq == ff_flac_sample_rate_table[i]) {
s->samplerate = ff_flac_sample_rate_table[i]; s->samplerate = ff_flac_sample_rate_table[i];
s->sr_code[0] = i; s->sr_code[0] = i;
@ -318,6 +318,9 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
} else if (freq < 65535) { } else if (freq < 65535) {
s->sr_code[0] = 13; s->sr_code[0] = 13;
s->sr_code[1] = freq; s->sr_code[1] = freq;
} else if (freq < 1048576) {
s->sr_code[0] = 0;
s->sr_code[1] = 0;
} else { } else {
av_log(avctx, AV_LOG_ERROR, "%d Hz not supported\n", freq); av_log(avctx, AV_LOG_ERROR, "%d Hz not supported\n", freq);
return AVERROR(EINVAL); return AVERROR(EINVAL);