Last active
December 26, 2015 02:19
-
-
Save mntone/7077594 to your computer and use it in GitHub Desktop.
ADTS header structure (for VC++)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum aac_id: unsigned | |
{ | |
ai_mpeg4 = 0, | |
ai_mpeg2 = 1, | |
}; | |
enum aac_protection_absent: unsigned | |
{ | |
apa_protection = 0, | |
apa_unprotection = 1, | |
}; | |
enum aac_profile: unsigned | |
{ | |
ap_main = 0, | |
ap_lc = 1, | |
ap_sbr = 2, | |
}; | |
enum aac_sampling_frequency: unsigned | |
{ | |
asf_96000 = 0, | |
asf_88200 = 1, | |
asf_64000 = 2, | |
asf_48000 = 3, | |
asf_44100 = 4, | |
asf_32000 = 5, | |
asf_24000 = 6, | |
asf_22050 = 7, | |
asf_16000 = 8, | |
asf_12000 = 9, | |
asf_11025 = 10, | |
asf_8000 = 11, | |
}; | |
_declspec( align( 1 ) ) | |
class adts_header | |
{ | |
public: | |
adts_header( void ) : | |
sync1( 0xff ), | |
sync2( 0xf ), | |
layer( 0 ), | |
frame_length1( 0 ), | |
frame_length2( 0 ), | |
frame_length3( 0 ), | |
adts_buffer_fullness1( 0x1f ), | |
adts_buffer_fullness2( 0x3f ), | |
no_raw_data_blocks_in_frame( 0 ) | |
{ } | |
uint8 get_channel_configuration( void ) const { return channel_configuration1 << 2 | channel_configuration2; } | |
void set_channel_configuration( const uint8 value ) | |
{ | |
channel_configuration1 = ( value >> 2 ) & 0x01; | |
channel_configuration2 = value & 0x03; | |
} | |
uint16 get_frame_length( void ) const { return frame_length1 << 11 | frame_length2 << 3 | frame_length3; } | |
void set_frame_length( const uint16 value ) | |
{ | |
frame_length1 = ( value >> 11 ) & 0x03; | |
frame_length2 = ( value >> 3 ) & 0xff; | |
frame_length3 = value & 0x07; | |
} | |
private: unsigned sync1 : 8; | |
public: aac_protection_absent protection_absent : 1; | |
private: unsigned layer : 2; | |
public: aac_id id : 1; | |
private: unsigned sync2 : 4; | |
private: unsigned channel_configuration1 : 1; | |
public: unsigned private_bit : 1; | |
public: aac_sampling_frequency sampling_frequency_index : 4; | |
public: aac_profile profile : 2; | |
private: unsigned frame_length1 : 2; | |
public: unsigned copyright_identification_start : 1; | |
public: unsigned copyright_identification_bit : 1; | |
public: unsigned home : 1; | |
public: unsigned copy : 1; | |
private: unsigned channel_configuration2 : 2; | |
private: | |
unsigned frame_length2 : 8; | |
unsigned adts_buffer_fullness1 : 5; | |
unsigned frame_length3 : 3; | |
unsigned no_raw_data_blocks_in_frame : 2; | |
unsigned adts_buffer_fullness2 : 6; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment