use get_bits1/skip_bits[1] in ac3 and aac parsers
Originally committed as revision 4969 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
b96532e970
commit
100a74222b
@ -738,7 +738,7 @@ typedef struct AC3ParseContext {
|
|||||||
} AC3ParseContext;
|
} AC3ParseContext;
|
||||||
|
|
||||||
#define AC3_HEADER_SIZE 7
|
#define AC3_HEADER_SIZE 7
|
||||||
#define AAC_HEADER_SIZE 8
|
#define AAC_HEADER_SIZE 7
|
||||||
|
|
||||||
static const int ac3_sample_rates[4] = {
|
static const int ac3_sample_rates[4] = {
|
||||||
48000, 44100, 32000, 0
|
48000, 44100, 32000, 0
|
||||||
@ -815,7 +815,7 @@ static int ac3_sync(const uint8_t *buf, int *channels, int *sample_rate,
|
|||||||
if(get_bits(&bits, 16) != 0x0b77)
|
if(get_bits(&bits, 16) != 0x0b77)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
get_bits(&bits, 16); /* crc */
|
skip_bits(&bits, 16); /* crc */
|
||||||
fscod = get_bits(&bits, 2);
|
fscod = get_bits(&bits, 2);
|
||||||
frmsizecod = get_bits(&bits, 6);
|
frmsizecod = get_bits(&bits, 6);
|
||||||
|
|
||||||
@ -825,15 +825,15 @@ static int ac3_sync(const uint8_t *buf, int *channels, int *sample_rate,
|
|||||||
bsid = get_bits(&bits, 5);
|
bsid = get_bits(&bits, 5);
|
||||||
if(bsid > 8)
|
if(bsid > 8)
|
||||||
return 0;
|
return 0;
|
||||||
get_bits(&bits, 3); /* bsmod */
|
skip_bits(&bits, 3); /* bsmod */
|
||||||
acmod = get_bits(&bits, 3);
|
acmod = get_bits(&bits, 3);
|
||||||
if(acmod & 1 && acmod != 1)
|
if(acmod & 1 && acmod != 1)
|
||||||
get_bits(&bits, 2); /* cmixlev */
|
skip_bits(&bits, 2); /* cmixlev */
|
||||||
if(acmod & 4)
|
if(acmod & 4)
|
||||||
get_bits(&bits, 2); /* surmixlev */
|
skip_bits(&bits, 2); /* surmixlev */
|
||||||
if(acmod & 2)
|
if(acmod & 2)
|
||||||
get_bits(&bits, 2); /* dsurmod */
|
skip_bits(&bits, 2); /* dsurmod */
|
||||||
lfeon = get_bits(&bits, 1);
|
lfeon = get_bits1(&bits);
|
||||||
|
|
||||||
*sample_rate = ac3_sample_rates[fscod];
|
*sample_rate = ac3_sample_rates[fscod];
|
||||||
*bit_rate = ac3_bitrates[frmsizecod] * 1000;
|
*bit_rate = ac3_bitrates[frmsizecod] * 1000;
|
||||||
@ -854,26 +854,26 @@ static int aac_sync(const uint8_t *buf, int *channels, int *sample_rate,
|
|||||||
if(get_bits(&bits, 12) != 0xfff)
|
if(get_bits(&bits, 12) != 0xfff)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
get_bits(&bits, 1);
|
skip_bits1(&bits); /* id */
|
||||||
get_bits(&bits, 2);
|
skip_bits(&bits, 2); /* layer */
|
||||||
get_bits(&bits, 1); /* protection_absent */
|
skip_bits1(&bits); /* protection_absent */
|
||||||
get_bits(&bits, 2);
|
skip_bits(&bits, 2); /* profile_objecttype */
|
||||||
sr = get_bits(&bits, 4);
|
sr = get_bits(&bits, 4); /* sample_frequency_index */
|
||||||
if(!aac_sample_rates[sr])
|
if(!aac_sample_rates[sr])
|
||||||
return 0;
|
return 0;
|
||||||
get_bits(&bits, 1); /* private_bit */
|
skip_bits1(&bits); /* private_bit */
|
||||||
ch = get_bits(&bits, 3);
|
ch = get_bits(&bits, 3); /* channel_configuration */
|
||||||
if(!aac_channels[ch])
|
if(!aac_channels[ch])
|
||||||
return 0;
|
return 0;
|
||||||
get_bits(&bits, 1); /* original/copy */
|
skip_bits1(&bits); /* original/copy */
|
||||||
get_bits(&bits, 1); /* home */
|
skip_bits1(&bits); /* home */
|
||||||
|
|
||||||
/* adts_variable_header */
|
/* adts_variable_header */
|
||||||
get_bits(&bits, 1); /* copyright_identification_bit */
|
skip_bits1(&bits); /* copyright_identification_bit */
|
||||||
get_bits(&bits, 1); /* copyright_identification_start */
|
skip_bits1(&bits); /* copyright_identification_start */
|
||||||
size = get_bits(&bits, 13);
|
size = get_bits(&bits, 13); /* aac_frame_length */
|
||||||
get_bits(&bits, 11); /* adts_buffer_fullness */
|
skip_bits(&bits, 11); /* adts_buffer_fullness */
|
||||||
rdb = get_bits(&bits, 2);
|
rdb = get_bits(&bits, 2); /* number_of_raw_data_blocks_in_frame */
|
||||||
|
|
||||||
*channels = aac_channels[ch];
|
*channels = aac_channels[ch];
|
||||||
*sample_rate = aac_sample_rates[sr];
|
*sample_rate = aac_sample_rates[sr];
|
||||||
|
Loading…
Reference in New Issue
Block a user