avformat/flvenc: use local variable to shorten code

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
pull/389/head
Zhao Zhili 2 years ago
parent f0f596dbc6
commit d5fdfbac4a
  1. 8
      libavformat/flvenc.c

@ -508,18 +508,18 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i
if (!par->extradata_size && (flv->flags & FLV_AAC_SEQ_HEADER_DETECT)) { if (!par->extradata_size && (flv->flags & FLV_AAC_SEQ_HEADER_DETECT)) {
PutBitContext pbc; PutBitContext pbc;
int samplerate_index; int samplerate_index;
int channels = flv->audio_par->ch_layout.nb_channels int channels = par->ch_layout.nb_channels
- (flv->audio_par->ch_layout.nb_channels == 8 ? 1 : 0); - (par->ch_layout.nb_channels == 8 ? 1 : 0);
uint8_t data[2]; uint8_t data[2];
for (samplerate_index = 0; samplerate_index < 16; for (samplerate_index = 0; samplerate_index < 16;
samplerate_index++) samplerate_index++)
if (flv->audio_par->sample_rate if (par->sample_rate
== ff_mpeg4audio_sample_rates[samplerate_index]) == ff_mpeg4audio_sample_rates[samplerate_index])
break; break;
init_put_bits(&pbc, data, sizeof(data)); init_put_bits(&pbc, data, sizeof(data));
put_bits(&pbc, 5, flv->audio_par->profile + 1); //profile put_bits(&pbc, 5, par->profile + 1); //profile
put_bits(&pbc, 4, samplerate_index); //sample rate index put_bits(&pbc, 4, samplerate_index); //sample rate index
put_bits(&pbc, 4, channels); put_bits(&pbc, 4, channels);
put_bits(&pbc, 1, 0); //frame length - 1024 samples put_bits(&pbc, 1, 0); //frame length - 1024 samples

Loading…
Cancel
Save