SDP文件节选:
m=video 0 RTP/AVP 96
a=rtpmap:96 MP4V-ES/90000
a=control:trackID=0
a=mpeg4-esid:1
a=fmtp:96 profile-level-id=1; config=000001B0F4000001B50900000100000001200086C400670C5A1120518F;
m=audio 0 RTP/AVP 97
a=rtpmap:97 mpeg4-generic/44100/2
a=control:trackID=1
a=mpeg4-esid:3
a=fmtp:97 streamtype=5; profile-level-id=15; mode=AAC-hbr; config=1210; SizeLength=13; IndexLength=3; IndexDeltaLength=3;Profile=1;
音频:
audioObjectType:5
samplingFrequencyIndex:4
channelConfiguration:4
reserve:3
代码:
UINT8 audioConfig[2] = {0};
UINT8 const audioObjectType = profile + 1;
audioConfig[0] = (audioObjectType<<3) | (samplingFrequencyIndex>>1);
audioConfig[1] = (samplingFrequencyIndex<<7) | (channelConfiguration<<3);
printf("%02x%02x", audioConfig[0], audioConfig[1]);
对本例来说:
audioObjectType = profile(1) + 1 = 0x02;
samplingFrequencyIndex = 0x04(44100)
channelConfiguration = 0x02(立体声)
故:
0 1 2 3|4 5 6 7|8 9 a b|c d e f
0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0
config= 1210,与文件中描述相符。
附:
sampling_frequency_index
Table 35 – Sampling frequency dependent on sampling_frequency_index
sampling_frequency_index sampling frequeny [Hz]
0x0 96000
0x1 88200
0x2 64000
0x3 48000
0x4 44100
0x5 32000
0x6 24000
0x7 22050
0x8 16000
0x9 12000
0xa 11025
0xb 8000
0xc reserved
0xd reserved
0xe reserved
0xf reserved
阅读(5592) | 评论(0) | 转发(0) |