mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
sdp: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
4a0bd4393c
commit
ca36f0ece8
@ -450,16 +450,16 @@ static int latm_context2profilelevel(const AVCodecParameters *par)
|
||||
* Different Object Types should implement different Profile Levels */
|
||||
|
||||
if (par->sample_rate <= 24000) {
|
||||
if (par->channels <= 2)
|
||||
if (par->ch_layout.nb_channels <= 2)
|
||||
profile_level = 0x28; // AAC Profile, Level 1
|
||||
} else if (par->sample_rate <= 48000) {
|
||||
if (par->channels <= 2) {
|
||||
if (par->ch_layout.nb_channels <= 2) {
|
||||
profile_level = 0x29; // AAC Profile, Level 2
|
||||
} else if (par->channels <= 5) {
|
||||
} else if (par->ch_layout.nb_channels <= 5) {
|
||||
profile_level = 0x2A; // AAC Profile, Level 4
|
||||
}
|
||||
} else if (par->sample_rate <= 96000) {
|
||||
if (par->channels <= 5) {
|
||||
if (par->ch_layout.nb_channels <= 5) {
|
||||
profile_level = 0x2B; // AAC Profile, Level 5
|
||||
}
|
||||
}
|
||||
@ -491,7 +491,7 @@ static int latm_context2config(AVFormatContext *s, const AVCodecParameters *par,
|
||||
config_byte[0] = 0x40;
|
||||
config_byte[1] = 0;
|
||||
config_byte[2] = 0x20 | rate_index;
|
||||
config_byte[3] = par->channels << 4;
|
||||
config_byte[3] = par->ch_layout.nb_channels << 4;
|
||||
config_byte[4] = 0x3f;
|
||||
config_byte[5] = 0xc0;
|
||||
|
||||
@ -591,7 +591,7 @@ static int sdp_write_media_attributes(char *buff, int size, const AVStream *st,
|
||||
return ret;
|
||||
av_strlcatf(buff, size, "a=rtpmap:%d MP4A-LATM/%d/%d\r\n"
|
||||
"a=fmtp:%d profile-level-id=%d;cpresent=0;config=%s\r\n",
|
||||
payload_type, p->sample_rate, p->channels,
|
||||
payload_type, p->sample_rate, p->ch_layout.nb_channels,
|
||||
payload_type, latm_context2profilelevel(p), config);
|
||||
} else {
|
||||
if (p->extradata_size) {
|
||||
@ -609,7 +609,7 @@ static int sdp_write_media_attributes(char *buff, int size, const AVStream *st,
|
||||
"a=fmtp:%d profile-level-id=1;"
|
||||
"mode=AAC-hbr;sizelength=13;indexlength=3;"
|
||||
"indexdeltalength=3%s\r\n",
|
||||
payload_type, p->sample_rate, p->channels,
|
||||
payload_type, p->sample_rate, p->ch_layout.nb_channels,
|
||||
payload_type, config);
|
||||
}
|
||||
break;
|
||||
@ -617,36 +617,36 @@ static int sdp_write_media_attributes(char *buff, int size, const AVStream *st,
|
||||
if (payload_type >= RTP_PT_PRIVATE)
|
||||
av_strlcatf(buff, size, "a=rtpmap:%d L16/%d/%d\r\n",
|
||||
payload_type,
|
||||
p->sample_rate, p->channels);
|
||||
p->sample_rate, p->ch_layout.nb_channels);
|
||||
break;
|
||||
case AV_CODEC_ID_PCM_S24BE:
|
||||
if (payload_type >= RTP_PT_PRIVATE)
|
||||
av_strlcatf(buff, size, "a=rtpmap:%d L24/%d/%d\r\n",
|
||||
payload_type,
|
||||
p->sample_rate, p->channels);
|
||||
p->sample_rate, p->ch_layout.nb_channels);
|
||||
break;
|
||||
case AV_CODEC_ID_PCM_MULAW:
|
||||
if (payload_type >= RTP_PT_PRIVATE)
|
||||
av_strlcatf(buff, size, "a=rtpmap:%d PCMU/%d/%d\r\n",
|
||||
payload_type,
|
||||
p->sample_rate, p->channels);
|
||||
p->sample_rate, p->ch_layout.nb_channels);
|
||||
break;
|
||||
case AV_CODEC_ID_PCM_ALAW:
|
||||
if (payload_type >= RTP_PT_PRIVATE)
|
||||
av_strlcatf(buff, size, "a=rtpmap:%d PCMA/%d/%d\r\n",
|
||||
payload_type,
|
||||
p->sample_rate, p->channels);
|
||||
p->sample_rate, p->ch_layout.nb_channels);
|
||||
break;
|
||||
case AV_CODEC_ID_AMR_NB:
|
||||
av_strlcatf(buff, size, "a=rtpmap:%d AMR/%d/%d\r\n"
|
||||
"a=fmtp:%d octet-align=1\r\n",
|
||||
payload_type, p->sample_rate, p->channels,
|
||||
payload_type, p->sample_rate, p->ch_layout.nb_channels,
|
||||
payload_type);
|
||||
break;
|
||||
case AV_CODEC_ID_AMR_WB:
|
||||
av_strlcatf(buff, size, "a=rtpmap:%d AMR-WB/%d/%d\r\n"
|
||||
"a=fmtp:%d octet-align=1\r\n",
|
||||
payload_type, p->sample_rate, p->channels,
|
||||
payload_type, p->sample_rate, p->ch_layout.nb_channels,
|
||||
payload_type);
|
||||
break;
|
||||
case AV_CODEC_ID_VORBIS:
|
||||
@ -661,7 +661,7 @@ static int sdp_write_media_attributes(char *buff, int size, const AVStream *st,
|
||||
|
||||
av_strlcatf(buff, size, "a=rtpmap:%d vorbis/%d/%d\r\n"
|
||||
"a=fmtp:%d configuration=%s\r\n",
|
||||
payload_type, p->sample_rate, p->channels,
|
||||
payload_type, p->sample_rate, p->ch_layout.nb_channels,
|
||||
payload_type, config);
|
||||
break;
|
||||
case AV_CODEC_ID_THEORA: {
|
||||
@ -754,7 +754,7 @@ static int sdp_write_media_attributes(char *buff, int size, const AVStream *st,
|
||||
if (payload_type >= RTP_PT_PRIVATE)
|
||||
av_strlcatf(buff, size, "a=rtpmap:%d G722/%d/%d\r\n",
|
||||
payload_type,
|
||||
8000, p->channels);
|
||||
8000, p->ch_layout.nb_channels);
|
||||
break;
|
||||
case AV_CODEC_ID_ADPCM_G726: {
|
||||
if (payload_type >= RTP_PT_PRIVATE)
|
||||
@ -791,7 +791,7 @@ static int sdp_write_media_attributes(char *buff, int size, const AVStream *st,
|
||||
receivers MUST be able to receive and process stereo packets. */
|
||||
av_strlcatf(buff, size, "a=rtpmap:%d opus/48000/2\r\n",
|
||||
payload_type);
|
||||
if (p->channels == 2) {
|
||||
if (p->ch_layout.nb_channels == 2) {
|
||||
av_strlcatf(buff, size, "a=fmtp:%d sprop-stereo=1\r\n",
|
||||
payload_type);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user