1 /* Castus/ISP AAC audio ADTS frame synchronization and detection */
3 #ifndef ___MPEG_AAC_AUDIO_H
4 #define ___MPEG_AAC_AUDIO_H
12 #define MPEG_AAC_AUDIO_ADTS_HEADER_SIZE 7
14 typedef uint64_t mpeg_aac_adts_audio_sync_raw_pattern;
16 typedef struct mpeg_aac_adts_audio_sync_info {
17 /* sync pattern +0+0 12 bits */
18 unsigned char id; /* +1+4 1 bit */
19 unsigned char layer; /* +1+5 2 bit */
20 unsigned char protection; /* +1+7 1 bit */
21 unsigned char object_type; /* +2+0 2 bits */
22 unsigned char sample_rate_index; /* +2+2 4 bits */
23 unsigned char private_bit; /* +2+6 1 bit */
24 unsigned char channel_configuration; /* +2+7 3 bits */
25 unsigned char original_copy; /* +3+2 1 bit */
26 unsigned char home; /* +3+3 1 bit */
27 unsigned char copyright_id; /* +3+4 1 bit */
28 unsigned char copyright_start; /* +3+5 1 bit */
29 unsigned short aac_frame_length; /* +3+6 13 bits */
30 unsigned short buffer_fullness; /* +5+3 11 bits */
31 unsigned char add_raw_data_blocks; /* +6+6 2 bits */
32 /* +7+0 TOTAL 7 bytes */
33 unsigned int sample_rate;
34 unsigned char total_raw_data_blocks;
35 unsigned int samples_per_frame;
36 unsigned int total_samples;
37 unsigned char channels;
39 mpeg_aac_adts_audio_sync_raw_pattern sync;
40 } mpeg_aac_adts_audio_sync_info;
42 uint8_t *mpeg_aac_adts_audio_sync(uint8_t *ptr,uint8_t *fence,mpeg_aac_adts_audio_sync_raw_pattern *p,mpeg_aac_adts_audio_sync_info *i);
43 void mpeg_aac_adts_audio_get_sync_info(mpeg_aac_adts_audio_sync_raw_pattern sp,mpeg_aac_adts_audio_sync_info *i);
44 int mpeg_aac_adts_audio_sync_same_format(mpeg_aac_adts_audio_sync_info *a,mpeg_aac_adts_audio_sync_info *b);
50 #endif /* ___MPEG_AAC_AUDIO_H */