hls_sample_encryption: convert to new channel layout API

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2021-10-20 13:54:59 -03:00
parent 8f835935b3
commit dd25ca02ae
1 changed files with 7 additions and 5 deletions

View File

@ -109,13 +109,14 @@ int ff_hls_senc_parse_audio_setup_info(AVStream *st, HLSAudioSetupInfo *info)
} }
st->codecpar->sample_rate = ac3hdr->sample_rate; st->codecpar->sample_rate = ac3hdr->sample_rate;
st->codecpar->channels = ac3hdr->channels; av_channel_layout_uninit(&st->codecpar->ch_layout);
st->codecpar->channel_layout = ac3hdr->channel_layout; av_channel_layout_from_mask(&st->codecpar->ch_layout, ac3hdr->channel_layout);
st->codecpar->bit_rate = ac3hdr->bit_rate; st->codecpar->bit_rate = ac3hdr->bit_rate;
av_free(ac3hdr); av_free(ac3hdr);
} else { /* Parse 'dec3' EC3SpecificBox */ } else { /* Parse 'dec3' EC3SpecificBox */
GetBitContext gb; GetBitContext gb;
uint64_t mask;
int data_rate, fscod, acmod, lfeon; int data_rate, fscod, acmod, lfeon;
ret = init_get_bits8(&gb, info->setup_data, info->setup_data_length); ret = init_get_bits8(&gb, info->setup_data, info->setup_data_length);
@ -131,11 +132,12 @@ int ff_hls_senc_parse_audio_setup_info(AVStream *st, HLSAudioSetupInfo *info)
st->codecpar->sample_rate = eac3_sample_rate_tab[fscod]; st->codecpar->sample_rate = eac3_sample_rate_tab[fscod];
st->codecpar->channel_layout = ff_ac3_channel_layout_tab[acmod]; mask = ff_ac3_channel_layout_tab[acmod];
if (lfeon) if (lfeon)
st->codecpar->channel_layout |= AV_CH_LOW_FREQUENCY; mask |= AV_CH_LOW_FREQUENCY;
st->codecpar->channels = av_get_channel_layout_nb_channels(st->codecpar->channel_layout); av_channel_layout_uninit(&st->codecpar->ch_layout);
av_channel_layout_from_mask(&st->codecpar->ch_layout, mask);
st->codecpar->bit_rate = data_rate*1000; st->codecpar->bit_rate = data_rate*1000;
} }