History

avcodec/sbcenc: Don't use deprecated AVCodec.supported_samplerates

Andreas Rheinhardt committed 1 year ago

Commit d7820a21 parent 1b6f37a1 file · +5 −3Browse files

Unified · Split

libavcodec/sbcenc.c+5−3
@@ -49,6 +49,8 @@ typedef struct SBCEncContext { · 48 unmodified lines
4949 DECLARE_ALIGNED(SBC_ALIGN, SBCDSPContext, dsp);
5050 } SBCEncContext;
5151
52+static const int sbc_samplerates[] = { 16000, 32000, 44100, 48000, 0 };
53+
5254 static int sbc_analyze_audio(SBCDSPContext *s, struct sbc_frame *frame)
5355 {
5456 int ch, blk;
@@ -260,8 +262,8 @@ static av_cold int sbc_encode_init(AVCodecContext *avctx) · 205 unmodified lines
260262 avctx->frame_size = 4*((frame->subbands >> 3) + 1) * 4*(frame->blocks >> 2);
261263 }
262264
263− for (int i = 0; avctx->codec->supported_samplerates[i]; i++)
264− if (avctx->sample_rate == avctx->codec->supported_samplerates[i])
265+ for (int i = 0; sbc_samplerates[i]; i++)
266+ if (avctx->sample_rate == sbc_samplerates[i])
265267 frame->frequency = i;
266268
267269 frame->channels = avctx->ch_layout.nb_channels;
@@ -359,7 +361,7 @@ const FFCodec ff_sbc_encoder = { · 91 unmodified lines
359361 { 0 } },
360362 .p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16,
361363 AV_SAMPLE_FMT_NONE },
362− .p.supported_samplerates = (const int[]) { 16000, 32000, 44100, 48000, 0 },
364+ .p.supported_samplerates = sbc_samplerates,
363365 .p.priv_class = &sbc_class,
364366 .p.profiles = NULL_IF_CONFIG_SMALL(ff_sbc_profiles),
365367 };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t