//--------------------------------------------------------------------------- // Packet "B0" void File_AvsV::video_sequence_start() { Element_Name("video_sequence_start"); //Parsing int32u bit_rate_upper, bit_rate_lower; Get_B1 ( profile_id, "profile_id"); Get_B1 ( level_id, "level_id"); BS_Begin(); Get_SB ( progressive_sequence, "progressive_sequence"); Get_S2 (14, horizontal_size, "horizontal_size"); Get_S2 (14, vertical_size, "vertical_size"); Get_S1 ( 2, chroma_format, "chroma_format"); Skip_S1( 3, "sample_precision"); Get_S1 ( 4, aspect_ratio, "aspect_ratio"); Param_Info(AvsV_aspect_ratio[aspect_ratio]); Get_S1 ( 4, frame_rate_code, "frame_rate_code"); Param_Info(AvsV_frame_rate[frame_rate_code]); Get_S3 (18, bit_rate_lower, "bit_rate_lower"); Mark_1 (); Get_S3 (12, bit_rate_upper, "bit_rate_upper"); bit_rate=(bit_rate_upper<<18)+bit_rate_lower; Param_Info(bit_rate*8, " bps"); Get_SB ( low_delay, "low_delay"); Mark_1 (); Skip_S3(18, "bbv_buffer_size"); Skip_SB( "reserved"); Skip_SB( "reserved"); Skip_SB( "reserved"); BS_End(); //Not sure, but the 3 first official files have this if (Element_Size-Element_Offset) { BS_Begin(); Mark_1(); BS_End(); } FILLING_BEGIN(); //NextCode NextCode_Clear(); NextCode_Add(0xB2); //user_data_start NextCode_Add(0xB3); //picture_start (I) NextCode_Add(0xB5); //extension_start //Autorisation of other streams Streams[0xB1].Searching_Payload=true, //video_sequence_end Streams[0xB2].Searching_Payload=true; //user_data_start Streams[0xB3].Searching_Payload=true, //picture_start (I) Streams[0xB4].Searching_Payload=true, //reserved Streams[0xB5].Searching_Payload=true; //extension_start Streams[0xB6].Searching_Payload=true, //picture_start (P or B) Streams[0xB7].Searching_Payload=true; //video_edit Streams[0xB8].Searching_Payload=true, //reserved video_sequence_start_IsParsed=true; FILLING_END(); }
//--------------------------------------------------------------------------- // AAC in ES, SBR part, 3+ bytes void File_Mpeg4_AudioSpecificConfig::SBR () { //Parsing int16u syncExtensionType; int8u samplingFrequencyIndex; Element_Begin("SBR"); Get_S2 (11, syncExtensionType, "syncExtensionType"); if (syncExtensionType!=0x2B7) { Element_End(); return; } Get_S1 (5, extensionAudioObjectType, "extensionAudioObjectType"); if (extensionAudioObjectType==0x05) { Get_SB ( sbrPresentFlag, "sbrPresentFlag"); if (sbrPresentFlag) { Get_S1 (4, samplingFrequencyIndex, "extensionSamplingFrequencyIndex"); Param_Info(MP4_SamplingRate[samplingFrequencyIndex]); if (samplingFrequencyIndex>=0xF) { Get_S3 (24, samplingFrequency, "extensionSamplingFrequency"); } else samplingFrequency=MP4_SamplingRate[samplingFrequencyIndex]; } } Element_End(); //PS stuff if (Data_Remain()) PS(); }
//--------------------------------------------------------------------------- void File_Flac::STREAMINFO() { Element_Info("STREAMINFO"); //Parsing int64u Samples; int32u FrameSize_Min, FrameSize_Max, SampleRate; int8u Channels, BitPerSample; Skip_B2( "BlockSize_Min"); //The minimum block size (in samples) used in the stream. Skip_B2( "BlockSize_Max"); //The maximum block size (in samples) used in the stream. (Minimum blocksize == maximum blocksize) implies a fixed-blocksize stream. Get_B3 ( FrameSize_Min, "FrameSize_Min"); //The minimum frame size (in bytes) used in the stream. May be 0 to imply the value is not known. Get_B3 ( FrameSize_Max, "FrameSize_Max"); //The maximum frame size (in bytes) used in the stream. May be 0 to imply the value is not known. BS_Begin(); Get_S3 (20, SampleRate, "SampleRate"); //Sample rate in Hz. Though 20 bits are available, the maximum sample rate is limited by the structure of frame headers to 1048570Hz. Also, a value of 0 is invalid. Get_S1 ( 3, Channels, "Channels"); Param_Info(Channels+1, " channels"); //(number of channels)-1. FLAC supports from 1 to 8 channels Get_S1 ( 5, BitPerSample, "BitPerSample"); Param_Info(BitPerSample+1, " bits"); //(bits per sample)-1. FLAC supports from 4 to 32 bits per sample. Currently the reference encoder and decoders only support up to 24 bits per sample. Get_S5 (36, Samples, "Samples"); BS_End(); Skip_B16( "MD5 signature of the unencoded audio data"); //Filling if (SampleRate==0) return; Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "FLAC"); Fill(Stream_Audio, 0, Audio_Codec, "FLAC"); if (FrameSize_Min==FrameSize_Max && FrameSize_Min!=0 ) // 0 means it is unknown Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR"); else Fill(Stream_Audio, 0, Audio_BitRate_Mode, "VBR"); Fill(Stream_Audio, 0, Audio_SamplingRate, SampleRate); Fill(Stream_Audio, 0, Audio_Channel_s_, Channels+1); Fill(Stream_Audio, 0, Audio_Resolution, BitPerSample+1); Fill(Stream_Audio, 0, Audio_Duration, Samples*1000/SampleRate); }
//--------------------------------------------------------------------------- bool File_DolbyE::Descramble_20bit () { int32u ScrambleMask; Get_S3 (20, ScrambleMask, "Scramble mask"); int16u Size=((BigEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Size-Data_BS_Remain()/8)^(ScrambleMask>>4))>>2)&0x3FF; if (Data_BS_Remain()<(size_t)((Size+1)*BitDepth)) //+1 for additional unknown word return false; //There is a problem int8u* Temp=Descrambled_Buffer+(size_t)Element_Size-Data_BS_Remain()/8; int64u ScrambleMasks=(((int64u)ScrambleMask)<<20)|ScrambleMask; bool Half; if (Data_BS_Remain()%8) { Temp--; int24u2BigEndian(Temp, BigEndian2int24u(Temp)^(ScrambleMask)); Half=true; } else Half=false; for (int16u Pos=0; Pos<Size-(Half?1:0); Pos+=2) int40u2BigEndian(Temp+(Half?3:0)+Pos*5/2, BigEndian2int40u(Temp+(Half?3:0)+Pos*5/2)^ScrambleMasks); if ((Size-((Size && Half)?1:0))%2==0) int24u2BigEndian(Temp+(Half?3:0)+(Size-((Size && Half)?1:0))*5/2, BigEndian2int24u(Temp+(Half?3:0)+(Size-((Size && Half)?1:0))*5/2)^(((int32u)ScrambleMasks)<<4)); return true; }
//--------------------------------------------------------------------------- bool File_DolbyE::Descramble_24bit () { int32u ScrambleMask; Get_S3 (24, ScrambleMask, "Scramble mask"); int32u Size=((BigEndian2int24u(Buffer+Buffer_Offset+(size_t)Element_Size-Data_BS_Remain()/8)^ScrambleMask)>>2)&0x3FF; if (Data_BS_Remain()<(size_t)((Size+1)*BitDepth)) //+1 for additional unknown word return false; //There is a problem int8u* Temp=Descrambled_Buffer+(size_t)Element_Size-Data_BS_Remain()/8; for (int16u Pos=0; Pos<Size; Pos++) int24u2BigEndian(Temp+Pos*2, BigEndian2int24u(Temp+Pos*2)^ScrambleMask); return true; }
//--------------------------------------------------------------------------- // AAC in ES, SBR part, 3+ bytes void File_Mpeg4_AudioSpecificConfig::SBR () { //Parsing int16u syncExtensionType; int8u samplingFrequencyIndex; Element_Begin("SBR"); Get_S2 (11, syncExtensionType, "syncExtensionType"); if (syncExtensionType!=0x2B7) { Element_End(); return; } Get_S1 (5, extensionAudioObjectType, "extensionAudioObjectType"); if (extensionAudioObjectType==0x05) { Get_SB ( sbrPresentFlag, "sbrPresentFlag"); if (sbrPresentFlag) { Get_S1 (4, samplingFrequencyIndex, "extensionSamplingFrequencyIndex"); Param_Info(MP4_SamplingRate[samplingFrequencyIndex]); if (samplingFrequencyIndex==0xF) { Get_S3 (24, samplingFrequency, "extensionSamplingFrequency"); } else samplingFrequency=MP4_SamplingRate[samplingFrequencyIndex]; } } Element_End(); FILLING_BEGIN(); //Filling if (sbrPresentFlag) { Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings, "SBR"); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings_SBR, "Yes", Unlimited, true, true); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings_PS, "No"); Ztring Codec=Retrieve(Stream_Audio, StreamPos_Last, Audio_Codec); Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Codec+_T("/SBR"), true); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, samplingFrequency, 10, true); } //PS stuff if (Data_Remain()) PS(); FILLING_END(); }
//--------------------------------------------------------------------------- // AAC in ES, 2+ bytes void File_Mpeg4_AudioSpecificConfig::Read_Buffer_Continue() { //Parsing Element_Offset=0; Element_Size=Buffer_Size; int8u samplingFrequencyIndex; BS_Begin(); Get_S1 (5, audioObjectType, "audioObjectType"); Param_Info(MP4_Profile(audioObjectType)); if (audioObjectType==31) { int8u audioObjectTypeExt; Get_S1 (6, audioObjectTypeExt, "audioObjectTypeExt"); audioObjectType=32+audioObjectTypeExt; Param_Info(audioObjectType); Param_Info(MP4_Profile(audioObjectType)); } if (audioObjectType==36) { ALS(); return; } Get_S1 (4, samplingFrequencyIndex, "samplingFrequencyIndex"); Param_Info(MP4_SamplingRate[samplingFrequencyIndex]); if (samplingFrequencyIndex>=0xF) { Get_S3 (24, samplingFrequency, "samplingFrequency"); } else samplingFrequency=MP4_SamplingRate[samplingFrequencyIndex]; Get_S1 (4, channelConfiguration, "channelConfiguration"); Param_Info(MP4_ChannelConfiguration[channelConfiguration]); sbrPresentFlag=false; psPresentFlag=false; if (audioObjectType==0x05 || audioObjectType==0x29) { extensionAudioObjectType=audioObjectType; sbrPresentFlag=true; if (audioObjectType==0x29) psPresentFlag=false; Get_S1 (4, samplingFrequencyIndex, "extensionSamplingFrequencyIndex"); Param_Info(MP4_SamplingRate[samplingFrequencyIndex]); if (samplingFrequencyIndex==0xF) { Get_S3 (24, samplingFrequency, "extensionSamplingFrequency"); } else samplingFrequency=MP4_SamplingRate[samplingFrequencyIndex]; Get_S1 (5, audioObjectType, "audioObjectType"); Param_Info(MP4_Profile(audioObjectType)); if (audioObjectType==31) { int8u audioObjectTypeExt; Get_S1 (6, audioObjectTypeExt, "audioObjectTypeExt"); audioObjectType=32+audioObjectTypeExt; Param_Info(MP4_Profile(audioObjectType)); } if (audioObjectType==22) //BSAC Skip_S1(4, "extensionChannelConfiguration"); } else extensionAudioObjectType=0x00; switch(audioObjectType) { case 1: case 2: case 3: case 4: case 6: case 7: case 17: case 19: case 20: case 21: case 22: case 23: GASpecificConfig(); break; case 8: //CelpSpecificConfig(); break; case 9: //HvxcSpecificConfig(); break; case 12: //TTSSpecificConfig(); break; case 13: case 14: case 15: case 16: //StructuredAudioSpecificConfig(); break; case 24: //ErrorResilientCelpSpecificConfig(); break; case 25: //ErrorResilientHvxcSpecificConfig(); break; case 26: case 27: //ParametricSpecificConfig(); break; case 28: //SSCSpecificConfig(); break; case 32: case 33: case 34: //MPEG_1_2_SpecificConfig(); break; case 35: //DSTSpecificConfig(); break; default: ; } switch (audioObjectType) { case 17: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: { int8u epConfig; Get_S1 (2, epConfig, "epConfig"); if (epConfig==2 || epConfig==3) { //ErrorProtectionSpecificConfig(); } if (epConfig==3) { bool directMapping; Get_SB (directMapping, "directMapping"); if (directMapping) { //tbd } } } default : ; } if (extensionAudioObjectType!=0x05 && Data_BS_Remain()>=16) SBR(); BS_End(); //Handling implicit SBR and PS bool Is3GP=false; for (size_t Pos=0; Pos<ftyps.size(); Pos++) if ((ftyps[Pos]&0xFFFFFF00)==0x33677000) Is3GP=true; if (!Is3GP) //If this is not a 3GP file { if (!sbrPresentFlag && samplingFrequency<=24000) { samplingFrequency*=2; sbrPresentFlag=true; } if (!psPresentFlag && channelConfiguration<=1) //1 channel psPresentFlag=true; } FILLING_BEGIN() Accept("AudioSpecificConfig"); if (Count_Get(Stream_Audio)==0) //May be done elsewhere Stream_Prepare(Stream_Audio); Fill(Stream_Audio, StreamPos_Last, Audio_Format, MP4_Format(audioObjectType)); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Version, "Version 4"); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Profile, MP4_Format_Profile(audioObjectType)); if (audioObjectType==2) //LC Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings_SBR, "No"); if (!sbrPresentFlag && !psPresentFlag) Fill(Stream_Audio, StreamPos_Last, Audio_Codec, MP4_Profile(audioObjectType)); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, samplingFrequency); if (channelConfiguration && channelConfiguration<8) { Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, MP4_Channels[channelConfiguration]); Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions, MP4_ChannelConfiguration[channelConfiguration]); Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions_String2, MP4_ChannelConfiguration2[channelConfiguration]); } if (sbrPresentFlag) { Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings, "SBR"); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings_SBR, "Yes", Unlimited, true, true); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings_PS, "No"); Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Ztring().From_Local(MP4_Profile(audioObjectType))+_T("/SBR"), true); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, samplingFrequency, 10, true); } if (psPresentFlag) { Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, 2, 10, true); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings, "PS"); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings_PS, "Yes", Unlimited, true, true); Ztring Codec=Retrieve(Stream_Audio, StreamPos_Last, Audio_Codec); Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Ztring().From_Local(MP4_Profile(audioObjectType))+(sbrPresentFlag?_T("/SBR"):_T(""))+_T("/PS"), true); Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions, "Front: L R", Unlimited, true, true); } }
//--------------------------------------------------------------------------- // AAC in ES, 2+ bytes void File_Mpeg4_AudioSpecificConfig::Read_Buffer_Continue() { //Parsing Element_Offset=0; Element_Size=Buffer_Size; int8u samplingFrequencyIndex; BS_Begin(); Get_S1 (5, audioObjectType, "audioObjectType"); Param_Info(MP4_Profile(audioObjectType)); if (audioObjectType==31) { int8u audioObjectTypeExt; Get_S1 (6, audioObjectTypeExt, "audioObjectTypeExt"); audioObjectType=32+audioObjectTypeExt; Param_Info(audioObjectType); Param_Info(MP4_Profile(audioObjectType)); } if (audioObjectType==36) { ALS(); return; } Get_S1 (4, samplingFrequencyIndex, "samplingFrequencyIndex"); Param_Info(MP4_SamplingRate[samplingFrequencyIndex]); if (samplingFrequencyIndex==0xF) { Get_S3 (24, samplingFrequency, "samplingFrequency"); } else samplingFrequency=MP4_SamplingRate[samplingFrequencyIndex]; Get_S1 (4, channelConfiguration, "channelConfiguration"); Param_Info(MP4_ChannelConfiguration[channelConfiguration]); sbrPresentFlag=false; if (audioObjectType==0x05) { extensionAudioObjectType=audioObjectType; sbrPresentFlag=true; Get_S1 (4, samplingFrequencyIndex, "extensionSamplingFrequencyIndex"); Param_Info(MP4_SamplingRate[samplingFrequencyIndex]); if (samplingFrequencyIndex==0xF) { Get_S3 (24, samplingFrequency, "extensionSamplingFrequency"); } else samplingFrequency=MP4_SamplingRate[samplingFrequencyIndex]; Get_S1 (5, audioObjectType, "audioObjectType"); Param_Info(MP4_Profile(audioObjectType)); if (audioObjectType==31) { int8u audioObjectTypeExt; Get_S1 (6, audioObjectTypeExt, "audioObjectTypeExt"); audioObjectType=32+audioObjectTypeExt; Param_Info(MP4_Profile(audioObjectType)); } } else extensionAudioObjectType=0x00; switch(audioObjectType) { case 1: case 2: case 3: case 4: case 6: case 7: case 17: case 19: case 20: case 21: case 22: case 23: GASpecificConfig(); break; case 8: //CelpSpecificConfig(); break; case 9: //HvxcSpecificConfig(); break; case 12: //TTSSpecificConfig(); break; case 13: case 14: case 15: case 16: //StructuredAudioSpecificConfig(); break; case 24: //ErrorResilientCelpSpecificConfig(); break; case 25: //ErrorResilientHvxcSpecificConfig(); break; case 26: case 27: //ParametricSpecificConfig(); break; case 28: //SSCSpecificConfig(); break; case 32: case 33: case 34: //MPEG_1_2_SpecificConfig(); break; case 35: //DSTSpecificConfig(); break; default: ; } switch (audioObjectType) { case 17: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: { int8u epConfig; Get_S1 (2, epConfig, "epConfig"); if (epConfig==2 || epConfig==3) { //ErrorProtectionSpecificConfig(); } if (epConfig==3) { bool directMapping; Get_SB (directMapping, "directMapping"); if (directMapping) { //tbd } } } default : ; } FILLING_BEGIN(); //Filling Stream_Prepare(Stream_General); Fill(Stream_General, 0, General_Format, "AAC"); if (Count_Get(Stream_Audio)==0) //May be done elsewhere Stream_Prepare(Stream_Audio); Fill(Stream_Audio, StreamPos_Last, Audio_Format, MP4_Format(audioObjectType)); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Version, "Version 4"); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Profile, MP4_Format_Profile(audioObjectType)); if (audioObjectType==2) //LC Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings_SBR, "No"); Fill(Stream_Audio, StreamPos_Last, Audio_Codec, MP4_Profile(audioObjectType)); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, samplingFrequency); if (channelConfiguration) { Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, MP4_Channels[channelConfiguration]); Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions, MP4_ChannelConfiguration[channelConfiguration]); Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions_String2, MP4_ChannelConfiguration2[channelConfiguration]); } Fill(Stream_Audio, StreamPos_Last, Audio_Resolution, 16); //SBR stuff if (Data_Remain()>=2 && extensionAudioObjectType!=0x05) SBR(); FILLING_END(); BS_End(); Accept("AudioSpecificConfig"); Finish("AudioSpecificConfig"); }
//--------------------------------------------------------------------------- void File_Adif::FileHeader_Parse() { //Parsing Ztring comment_field_data; int32u bitrate; int8u num_program_config_elements; int8u object_type=(int8u)-1; int8u sampling_frequency_index=(int8u)-1; int8u num_front_channel_elements=(int8u)-1; int8u num_side_channel_elements=(int8u)-1; int8u num_back_channel_elements=(int8u)-1; int8u num_lfe_channel_elements=(int8u)-1; int8u num_assoc_data_elements; int8u num_valid_cc_elements; bool bitstream_type; Skip_C4( "adif_id"); BS_Begin(); TEST_SB_SKIP( "copyright_id_present"); Skip_S4(32, "copyright_id"); Skip_S4(32, "copyright_id"); Skip_S4( 8, "copyright_id"); TEST_SB_END(); Skip_SB( "original_copy"); Skip_SB( "home"); Get_SB ( bitstream_type, "bitstream_type"); Param_Info(bitstream_type?"VBR":"CBR"); Get_S3 (23, bitrate, "bitrate"); Get_S1 ( 4, num_program_config_elements, "num_program_config_elements"); if (!bitstream_type) Skip_S3(20, "adif_buffer_fullness"); for (int8u Pos=0; Pos<num_program_config_elements+1; Pos++) { Element_Begin("program_config_element"); int8u comment_field_bytes; Skip_S1(4, "element_instance_tag"); Get_S1 (2, object_type, "object_type"); Param_Info(ADIF_object_type[object_type]); Get_S1 (4, sampling_frequency_index, "sampling_frequency_index"); Param_Info(ADIF_sampling_frequency[sampling_frequency_index]); Get_S1 (4, num_front_channel_elements, "num_front_channel_elements"); Get_S1 (4, num_side_channel_elements, "num_side_channel_elements"); Get_S1 (4, num_back_channel_elements, "num_back_channel_elements"); Get_S1 (2, num_lfe_channel_elements, "num_lfe_channel_elements"); Get_S1 (3, num_assoc_data_elements, "num_assoc_data_elements"); Get_S1 (4, num_valid_cc_elements, "num_valid_cc_elements"); TEST_SB_SKIP( "mono_mixdown_present"); Skip_S1(4, "mono_mixdown_element_number"); TEST_SB_END(); TEST_SB_SKIP( "stereo_mixdown_present"); Skip_S1(4, "stereo_mixdown_element_number"); TEST_SB_END(); TEST_SB_SKIP( "matrix_mixdown_idx_present"); Skip_S1(2, "matrix_mixdown_idx"); Skip_S1(2, "pseudo_surround_enable"); TEST_SB_END(); for (int8u Pos2=0; Pos2<num_front_channel_elements; Pos2++) { Element_Begin("front_channel_element"); Skip_SB( "front_element_is_cpe"); Skip_S1(4, "front_element_tag_select"); Element_End(); } for (int8u Pos2=0; Pos2<num_side_channel_elements; Pos2++) { Element_Begin("side_channel_element"); Skip_SB( "back_element_is_cpe"); Skip_S1(4, "back_element_tag_select"); Element_End(); } for (int8u Pos2=0; Pos2<num_back_channel_elements; Pos2++) { Element_Begin("back_channel_element"); Skip_SB( "back_element_is_cpe"); Skip_S1(4, "back_element_tag_select"); Element_End(); } for (int8u Pos2=0; Pos2<num_lfe_channel_elements; Pos2++) { Element_Begin("lfe_channel_element"); Skip_S1(4, "lfe_element_tag_select"); Element_End(); } for (int8u Pos2=0; Pos2<num_assoc_data_elements; Pos2++) { Element_Begin("assoc_data_element"); Skip_S1(4, "assoc_data_element_tag_select"); Element_End(); } for (int8u Pos2=0; Pos2<num_valid_cc_elements; Pos2++) { Element_Begin("valid_cc_element"); Skip_SB( "cc_element_is_ind_sw"); Skip_S1(4, "valid_cc_element_tag_select"); Element_End(); } BS_End(); Get_B1 (comment_field_bytes, "comment_field_bytes"); if (comment_field_bytes>0) Get_Local(comment_field_bytes, comment_field_data, "comment_field_data"); BS_Begin(); Element_End(); //We only support 1 element in ADIF Pos=num_program_config_elements; } BS_End(); FILLING_BEGIN(); File__Tags_Helper::Stream_Prepare(Stream_General); Fill(Stream_General, 0, General_Format, "ADIF"); Fill(Stream_General, 0, General_Comment, comment_field_data); File__Tags_Helper::Stream_Prepare(Stream_Audio); Fill (Stream_Audio, 0, Audio_Format, "AAC"); Fill (Stream_Audio, 0, Audio_Format_Version, "Version 2"); if (object_type!=(int8u)-1) Fill (Stream_Audio, 0, Audio_Format_Profile, ADIF_Format_Profile[object_type]); Fill (Stream_Audio, 0, Audio_Codec, ADIF_object_type[object_type]); Fill(Stream_Audio, 0, Audio_BitRate_Mode, bitstream_type?"VBR":"CBR"); if (bitrate>0) Fill(Stream_Audio, 0, bitstream_type?Audio_BitRate_Maximum:Audio_BitRate, bitrate); if (sampling_frequency_index!=(int8u)-1) Fill(Stream_Audio, 0, Audio_SamplingRate, ADIF_sampling_frequency[sampling_frequency_index]); if (num_front_channel_elements!=(int8u)-1) Fill(Stream_Audio, 0, Audio_Channel_s_, num_front_channel_elements+num_side_channel_elements+num_back_channel_elements+num_lfe_channel_elements); Fill(Stream_Audio, 0, Audio_Resolution, 16); Fill(Stream_Audio, 0, Audio_MuxingMode, "ADIF"); //No more need data File__Tags_Helper::Accept("ADIF"); File__Tags_Helper::Finish("ADIF"); FILLING_END(); }