//--------------------------------------------------------------------------- void File_DvbSubtitle::page_composition_segment() { Element_Name("page composition segment"); //Parsing Skip_B1( "page_time_out"); BS_Begin(); Skip_S1(4, "page_version_number"); Skip_S1(2, "page_state"); Skip_S1(2, "reserved"); BS_End(); while(Element_Offset<Element_Size) { Element_Begin1("Region"); int16u region_horizontal_address, region_vertical_address; int8u region_id; Get_B1 (region_id, "region_id"); Skip_B1( "reserved"); Get_B2 (region_horizontal_address, "region_horizontal_address"); Get_B2 (region_vertical_address, "region_vertical_address"); Element_End0(); FILLING_BEGIN(); subtitle_streams[subtitle_stream_id].pages[page_id].regions[region_id].page_composition_segment=true; subtitle_streams[subtitle_stream_id].pages[page_id].regions[region_id].region_horizontal_address=region_horizontal_address; subtitle_streams[subtitle_stream_id].pages[page_id].regions[region_id].region_vertical_address=region_vertical_address; FILLING_END(); } }
//--------------------------------------------------------------------------- void File_MpcSv8::SH() { //Parsing int64u SampleCount; int8u Version, SampleFrequency, ChannelCount; bool MidSideStereo; Skip_B4( "CRC32"); Get_B1 (Version, "Version"); Get_VS (SampleCount, "Sample count"); Skip_VS( "Beginning silence"); BS_Begin(); Get_S1 (3, SampleFrequency, "Sample frequency"); Param_Info(Mpc_SampleFreq[SampleFrequency]); Skip_S1(5, "Max used bands"); Get_S1 (4, ChannelCount, "Channel count"); Get_SB ( MidSideStereo, "Mid side stereo used"); Skip_S1(3, "Audio block frames"); BS_End(); //Filling FILLING_BEGIN(); Fill(Stream_Audio, 0, Audio_SamplingRate, Mpc_SampleFreq[SampleFrequency]); if (SampleCount) { Fill(Stream_Audio, 0, Audio_SamplingCount, SampleCount); Fill(Stream_Audio, 0, Audio_Duration, SampleCount*1000/Mpc_SampleFreq[SampleFrequency]); Fill(Stream_Audio, 0, Audio_BitRate, File_Size*8*Mpc_SampleFreq[SampleFrequency]/SampleCount); //Should be more precise... } Fill(Stream_Audio, 0, Audio_Resolution, 16); //MPC support only 16 bits FILLING_END(); }
//--------------------------------------------------------------------------- void File_Aac::ErrorResilientCelpSpecificConfig () { Element_Begin1("ErrorResilientCelpSpecificConfig"); bool isBaseLayer; Get_SB(isBaseLayer, "isBaseLayer"); if (isBaseLayer) { ER_SC_CelpHeader (); } else { bool isBWSLayer; Get_SB(isBWSLayer, "isBWSLayer"); if (isBWSLayer) { //~ CelpBWSenhHeader () //~ { Skip_S1(2, "BWS_configuration"); //~ } } else { Skip_S1(2, "CELP-BRS-id"); } } Element_End0(); }
//--------------------------------------------------------------------------- void File_Aac::HILNconfig() { Element_Begin1("HILNconfig"); Skip_SB( "HILNquantMode"); Skip_S1(8, "HILNmaxNumLine"); Skip_S1(4, "HILNsampleRateCode"); Skip_S2(12, "HILNframeLength"); Skip_S1(2, "HILNcontMode"); Element_End0(); }
//--------------------------------------------------------------------------- void File_Aac::SLSSpecificConfig() { Element_Begin1("SLSSpecificConfig"); Skip_S1(3,"pcmWordLength"); Skip_SB("aac_core_present"); Skip_SB("lle_main_stream"); Skip_SB("reserved_bit"); Skip_S1(3,"frameLength"); if (!channelConfiguration) program_config_element(); Element_End0(); }
//--------------------------------------------------------------------------- void File_Cdp::ccsvcinfo_section() { //Parsing int8u svc_count; Element_Begin1("ccsvcinfo_section"); Skip_B1( "ccsvcinfo_id"); BS_Begin(); Skip_SB( "reserved"); Skip_SB( "svc_info_start"); Skip_SB( "svc_info_change"); Skip_SB( "svc_info_complete"); Get_S1 (4, svc_count, "svc_count"); BS_End(); for (int8u Pos=0; Pos<svc_count; Pos++) { Element_Begin1("svc"); bool csn_size; BS_Begin(); Skip_SB( "reserved"); Get_SB ( csn_size, "csn_size"); if (csn_size) { Skip_SB( "reserved"); Skip_S1(5, "caption_service_number"); } else Skip_S1(6, "caption_service_number"); BS_End(); //svc_data_byte - caption_service_descriptor Element_Begin1("service"); Ztring language; bool digital_cc; Get_Local(3, language, "language"); BS_Begin(); Get_SB (digital_cc, "digital_cc"); Skip_SB( "reserved"); if (digital_cc) //line21 { Skip_S1(5, "reserved"); Skip_SB( "line21_field"); } else Skip_S1(6, "caption_service_number"); Skip_SB( "easy_reader"); Skip_SB( "wide_aspect_ratio"); Skip_S2(14, "reserved"); BS_End(); Element_End0(); Element_End0(); } Element_End0(); }
//--------------------------------------------------------------------------- void File_Jpeg::COD() { //Parsing int16u Levels; int8u Style, Style2, MultipleComponentTransform; bool PrecinctUsed; Get_B1 (Style, "Scod - Style"); Get_Flags (Style, 0, PrecinctUsed, "Precinct used"); Skip_Flags(Style, 1, "Use SOP (start of packet)"); Skip_Flags(Style, 2, "Use EPH (end of packet header)"); Skip_B1( "Number of decomposition levels"); Skip_B1( "Progression order"); Get_B2 (Levels, "Number of layers"); Info_B1(DimX, "Code-blocks dimensions X (2^(n+2))"); Param_Info2(1<<(DimX+2), " pixels"); Info_B1(DimY, "Code-blocks dimensions Y (2^(n+2))"); Param_Info2(1<<(DimY+2), " pixels"); Get_B1 (Style2, "Style of the code-block coding passes"); Skip_Flags(Style, 0, "Selective arithmetic coding bypass"); Skip_Flags(Style, 1, "MQ states for all contexts"); Skip_Flags(Style, 2, "Regular termination"); Skip_Flags(Style, 3, "Vertically stripe-causal context formation"); Skip_Flags(Style, 4, "Error resilience info is embedded on MQ termination"); Skip_Flags(Style, 5, "Segmentation marker is to be inserted at the end of each normalization coding pass"); Skip_B1( "Transform"); Get_B1(MultipleComponentTransform, "Multiple component transform"); if (PrecinctUsed) { BS_Begin(); Skip_S1(4, "LL sub-band width"); Skip_S1(4, "LL sub-band height"); BS_End(); for (int16u Pos=0; Pos<Levels; Pos++) { Element_Begin1("Decomposition level"); BS_Begin(); Skip_S1(4, "decomposition level width"); Skip_S1(4, "decomposition level height"); BS_End(); Element_End0(); } } FILLING_BEGIN(); if (Frame_Count==0 && Field_Count==0) { switch (MultipleComponentTransform) { case 0x01 : Fill(StreamKind_Last, 0, "Compression_Mode", "Lossless"); break; case 0x02 : Fill(StreamKind_Last, 0, "Compression_Mode", "Lossy"); break; default : ; } } FILLING_END(); }
//--------------------------------------------------------------------------- // Packet "0E" void File_Vc1::EntryPointHeader() { Element_Name("EntryPointHeader"); //Parsing bool extended_mv; BS_Begin(); Skip_SB( "broken_link"); Skip_SB( "closed_entry"); Get_SB ( panscan_flag, "panscan_flag"); Skip_SB( "refdist_flag"); Skip_SB( "loopfilter"); Skip_SB( "fastuvmc"); Get_SB ( extended_mv, "extended_mv"); Skip_S1( 2, "dquant"); Skip_SB( "vstransform"); Skip_SB( "overlap"); Skip_S1( 2, "quantizer"); if (hrd_param_flag) for (int8u Pos=0; Pos<hrd_num_leaky_buckets; Pos++) { Element_Begin("leaky_bucket"); Skip_S2( 8, "hrd_full"); Element_End(); } TEST_SB_SKIP( "coded_size_flag"); Info_S2(12, coded_width, "coded_width"); Param_Info((coded_width+1)*2, " pixels"); Info_S2(12, coded_height, "coded_height"); Param_Info((coded_height+1)*2, " pixels"); TEST_SB_END(); if (extended_mv) Skip_SB( "extended_dmv"); TEST_SB_SKIP( "luma_sampling"); Skip_S1( 3, "y_range"); TEST_SB_END(); TEST_SB_SKIP( "chroma_sampling"); Skip_S1( 3, "uv_range"); TEST_SB_END(); BS_End(); FILLING_BEGIN(); //NextCode NextCode_Test(); NextCode_Clear(); NextCode_Add(0x0D); //Autorisation of other streams Streams[0x0D].Searching_Payload=true; EntryPoint_Parsed=true; FILLING_END(); }
//--------------------------------------------------------------------------- void File_Mpeg4_Descriptors::Descriptor_02() { //Parsing bool URL_Flag; BS_Begin(); Skip_S2(10, "ObjectDescriptorID"); Get_SB ( URL_Flag, "URL_Flag"); Skip_SB( "includeInlineProfileLevelFlag"); Skip_S1( 4, "reserved"); BS_End(); if (URL_Flag) { int8u URLlength; Get_B1 (URLlength, "URLlength"); Skip_UTF8(URLlength, "URLstring"); } Info_B1(ODProfileLevel, "ODProfileLevelIndication"); Param_Info(Mpeg4_Descriptors_ODProfileLevelIndication(ODProfileLevel)); Info_B1(SceneProfileLevel, "sceneProfileLevelIndication"); Param_Info(Mpeg4_Descriptors_SceneProfileLevelIndication(SceneProfileLevel)); Info_B1(AudioProfileLevel, "audioProfileLevelIndication"); Param_Info(Mpeg4_Descriptors_AudioProfileLevelIndication(AudioProfileLevel)); Info_B1(VisualProfileLevel, "visualProfileLevelIndication"); Param_Info(Mpeg4_Descriptors_VisualProfileLevelIndication(VisualProfileLevel)); Info_B1(GraphicsProfileLevel, "graphicsProfileLevelIndication"); Param_Info(Mpeg4_Descriptors_GraphicsProfileLevelIndication(GraphicsProfileLevel)); FILLING_BEGIN(); Element_ThisIsAList(); FILLING_END(); }
//--------------------------------------------------------------------------- void File_Pcm_M2ts::Read_Buffer_Continue() { if (Buffer_Size==0) return; //Parsing int16u audio_data_payload_size; Get_B2 ( audio_data_payload_size, "audio_data_payload_size"); BS_Begin(); Get_S1 (4, channel_assignment, "channel_assignment"); Param_Info2(Pcm_M2TS_channel_assignment[channel_assignment], " channel(s)"); Get_S1 (4, sampling_frequency, "sampling_frequency"); Param_Info2(Pcm_M2TS_sampling_frequency[sampling_frequency], " Hz"); Get_S1 (2, bits_per_sample, "bits_per_sample"); Param_Info2(Pcm_M2TS_bits_per_sample[bits_per_sample], " bits"); Skip_SB( "start_flag"); Skip_S1(5, "reserved"); BS_End(); Skip_XX(audio_data_payload_size, "audio_data_payload"); FILLING_BEGIN_PRECISE(); if (!Status[IsAccepted]) { Accept(); Finish(); } FILLING_END(); }
//--------------------------------------------------------------------------- void File_Mpeg4_Descriptors::Descriptor_03() { //Parsing bool streamDependenceFlag, URL_Flag, OCRstreamFlag; Get_B2 (ES_ID, "ES_ID"); BS_Begin(); Get_SB ( streamDependenceFlag, "streamDependenceFlag"); Get_SB ( URL_Flag, "URL_Flag"); Get_SB ( OCRstreamFlag, "OCRstreamFlag"); Skip_S1(5, "streamPriority"); BS_End(); if (streamDependenceFlag) Skip_B2( "dependsOn_ES_ID"); if (URL_Flag) { int8u URLlength; Get_B1 (URLlength, "URLlength"); Skip_UTF8(URLlength, "URLstring"); } if (OCRstreamFlag) Skip_B2( "OCR_ES_Id"); FILLING_BEGIN(); Element_ThisIsAList(); FILLING_END(); }
//--------------------------------------------------------------------------- void File_Cdp::cdp_header() { Element_Begin1("cdp_header"); int16u cdp_identifier; int8u cdp_frame_rate; Get_B2 ( cdp_identifier, "cdp_identifier"); Skip_B1( "cdp_length"); BS_Begin(); Get_S1 (4, cdp_frame_rate, "cdp_frame_rate"); Param_Info1(Ztring::ToZtring(Cdp_cdp_frame_rate(cdp_frame_rate))+__T(" fps")); Skip_S1(4, "Reserved"); Skip_SB( "time_code_present"); Skip_SB( "ccdata_present"); Skip_SB( "svcinfo_present"); Skip_SB( "svc_info_start"); Skip_SB( "svc_info_change"); Skip_SB( "svc_info_complete"); Skip_SB( "caption_service_active"); Skip_SB( "Reserved"); BS_End(); Skip_B2( "cdp_hdr_sequence_cntr"); Element_End0(); FILLING_BEGIN(); if (!Status[IsAccepted]) { if (cdp_identifier!=0x9669) { Reject("CDP"); return; } Accept("CDP"); } FILLING_END(); }
//--------------------------------------------------------------------------- void File_Latm::StreamMuxConfig() { Element_Begin("StreamMuxConfig"); bool audioMuxVersion; Get_SB (audioMuxVersion, "audioMuxVersion"); if (audioMuxVersion) Get_SB (audioMuxVersionA, "audioMuxVersionA"); else audioMuxVersionA=false; if (!audioMuxVersionA) { if (audioMuxVersion==1) { //taraBufferFullness=LatmGetValue(); } Skip_SB( "allStreamsSameTimeFraming"); Skip_S1(6, "numSubFrames"); Skip_S1(4, "numProgram"); /* for (int8u prog=0; prog<=numProgram; prog++) { int8u numLayer; Get_S1(3, "numLayer"); for (lay = 0; lay <= numLayer; lay++) { progSIndx[streamCnt] = prog; laySIndx[streamCnt] = lay; streamID [ prog][ lay] = streamCnt++; if (prog == 0 && lay == 0) { useSameConfig = 0; } else { useSameConfig; 1 uimsbf } if (! useSameConfig) { if ( audioMuxVersion == 0 ) { AudioSpecificConfig(); } else { ascLen = LatmGetValue(); ascLen -= AudioSpecificConfig(); Note 1 fillBits; ascLen bslbf } } */ } Element_End(); }
//--------------------------------------------------------------------------- void File_Aac::SSCSpecificConfig () { Element_Begin1("SSCSpecificConfig"); Skip_S1(2,"decoder_level"); Skip_S1(4,"update_rate"); Skip_S1(2,"synthesis_method"); if (channelConfiguration != 1) { int8u mode_ext; Get_S1(2,mode_ext,"mode_ext"); if ((channelConfiguration == 2) && (mode_ext == 1)) { /*reserved*/ } } Element_End0(); }
//--------------------------------------------------------------------------- void File_Tak::STREAMINFO() { //Parsing int32u num_samples_hi, samplerate; int8u num_samples_lo, framesizecode, samplesize; bool channels; Skip_L1 ( "unknown"); BS_Begin(); Get_S1 ( 2, num_samples_lo, "num_samples (lo)"); Get_S1 ( 3, framesizecode, "framesizecode"); Skip_S1( 2, "unknown"); BS_End(); Get_L4 (num_samples_hi, "num_samples (hi)"); Param_Info2((((int64u)num_samples_hi)<<2 | num_samples_lo), " samples"); Get_L3 (samplerate, "samplerate"); Param_Info2((samplerate/16)+6000, " Hz"); BS_Begin(); Skip_S1( 4, "unknown"); Get_SB ( channels, "channels"); Param_Info1(channels?"Stereo":"Mono"); Get_S1 ( 2, samplesize, "samplesize"); Param_Info1(Tak_samplesize[samplesize]); Skip_SB( "unknown"); BS_End(); Skip_L3( "crc"); FILLING_BEGIN() //Coherency if (samplerate==0) return; //Computing int64u Samples=((int64u)num_samples_hi)<<2 | num_samples_lo; int32u SamplingRate=(samplerate/16)+6000; //Filling File__Tags_Helper::Accept("TAK"); File__Tags_Helper::Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "TAK"); Fill(Stream_Audio, 0, Audio_Codec, "TAK"); Fill(Stream_Audio, 0, Audio_SamplingRate, SamplingRate); Fill(Stream_Audio, 0, Audio_Channel_s_, channels?2:1); if (Tak_samplesize[samplesize]) Fill(Stream_Audio, 0, Audio_BitDepth, Tak_samplesize[samplesize]); Fill(Stream_Audio, 0, Audio_Duration, Samples*1000/SamplingRate); FILLING_END(); }
//--------------------------------------------------------------------------- void File_Aac::HILNenexConfig() { Element_Begin1("HILNenexConfig"); bool HILNenhaLayer; Get_SB(HILNenhaLayer, "HILNenhaLayer"); if (HILNenhaLayer) Skip_S1(2, "HILNenhaQuantMode"); Element_End0(); }
//--------------------------------------------------------------------------- // 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(); }
//--------------------------------------------------------------------------- void File_Aac::ER_SC_CelpHeader () { Element_Begin1("ER_SC_CelpHeader"); bool ExcitationMode; Get_SB(ExcitationMode, "ExcitationMode"); Skip_SB( "SampleRateMode"); Skip_SB( "FineRateControl"); Skip_SB( "SilenceCompression"); if (ExcitationMode == 1/*RPE*/) { Skip_S1(3, "RPE_Configuration"); } if (ExcitationMode == 0/*MPE*/) { Skip_S1(5, "MPE_Configuration"); Skip_S1(2, "NumEnhLayers"); Skip_SB( "BandwidthScalabilityMode"); } Element_End0(); }
//--------------------------------------------------------------------------- void File_OpenMG::FileHeader_Parse() { //Parsing int16u Size, FrameSize=0; int8u Flags, CodecID, SamplingRate_Code=0, Channels_Code=0; bool JointStereo=false; Skip_C3( "Code"); Get_B1 (Flags, "Flags"); Get_B2 (Size, "Size"); Skip_XX(26, "Unknown"); Get_B1 (CodecID, "Coded ID"); Param_Info1(OpenMG_CodecID_Format(CodecID)); if (CodecID<=1) //Atrac3 { BS_Begin(); Skip_S1(7, "Unknown"); Get_SB ( JointStereo, "Joint Stereo"); Get_S1 (3, SamplingRate_Code, "Sampling Rate"); Param_Info2(OpenMG_SamplingRate(SamplingRate_Code), " Hz"); Get_S1 (3, Channels_Code, "Channels"); Param_Info2(OpenMG_Channels(Channels_Code), " channel(s)"); Get_S2 (10, FrameSize, "Frame size"); BS_End(); } Skip_XX(Size-Element_Offset, "Unknown"); FILLING_BEGIN(); if (!Status[IsAccepted]) { File__Tags_Helper::Accept(); Fill(Stream_Audio, 0, Audio_Format, OpenMG_CodecID_Format(CodecID)); Fill(Stream_Audio, 0, Audio_Encryption, OpenMG_CodecID_Encryption(CodecID)); int64u StreamSize=(int64u)-1; if (File_Size!=(int64u)-1) { StreamSize=File_Size-(Buffer_Offset+Element_Size); Fill(Stream_Audio, 0, Audio_StreamSize, StreamSize); } if (CodecID<=1) // Atrac3 { Fill(Stream_Audio, 0, Audio_Channel_s_, OpenMG_Channels(Channels_Code)); Fill(Stream_Audio, 0, Audio_ChannelPositions, OpenMG_ChannelPositions(Channels_Code)); if (Channels_Code==1 && JointStereo) Fill(Stream_Audio, 0, Audio_Format_Settings_Mode, "Joint Stereo"); Fill(Stream_Audio, 0, Audio_SamplingRate, OpenMG_SamplingRate(SamplingRate_Code)); if (CodecID==1) //Protected FrameSize++; //Not sure FrameSize<<=3; //8-byte blocks int64u BitRate=OpenMG_SamplingRate(SamplingRate_Code)*FrameSize/256; Fill(Stream_Audio, 0, Audio_BitRate, BitRate); if (StreamSize!=(int64u)-1 && BitRate) Fill(Stream_Audio, 0, Audio_Duration, StreamSize*8*1000/BitRate); } } FILLING_END(); }
//--------------------------------------------------------------------------- void File_Aac::HVXCconfig() { Element_Begin1("HVXCconfig"); Skip_SB( "HVXCvarMode"); Skip_S1(2, "HVXCrateMode"); Skip_SB( "extensionFlag"); //~ if (extensionFlag) { /*< to be defined in MPEG-4 Version 2 >*/ //~ } Element_End0(); }
//--------------------------------------------------------------------------- void File_Dts::Header_Parse() { //Parsing int16u Primary_Frame_Byte_Size_minus_1; int8u EncoderSoftwareRevision; bool crc_present; Skip_B4( "Sync"); BS_Begin(); Info_SB( FrameType, "Frame Type"); Param_Info(DTS_FrameType[FrameType]); Skip_S1( 5, "Deficit Sample Count"); Get_SB ( crc_present, "CRC Present"); Skip_S1( 7, "Number of PCM Sample Blocks"); Get_S2 (14, Primary_Frame_Byte_Size_minus_1, "Primary Frame Byte Size minus 1"); Primary_Frame_Byte_Size_minus_1+=1; if (!Word) Primary_Frame_Byte_Size_minus_1=Primary_Frame_Byte_Size_minus_1*8/14*2; Param_Info(Ztring::ToZtring(Primary_Frame_Byte_Size_minus_1)+_T(" bytes")); //Word is on 14 bits! Get_S1 ( 6, channel_arrangement, "Audio Channel Arrangement"); Param_Info(Ztring::ToZtring(DTS_Channels[channel_arrangement])+_T(" channels")); Get_S1 ( 4, sample_frequency, "Core Audio Sampling Frequency"); Param_Info(Ztring::ToZtring(DTS_SamplingRate[sample_frequency])+_T(" Hz")); Get_S1 ( 5, bit_rate, "Transmission Bit Rate"); Param_Info(Ztring::ToZtring(DTS_BitRate[bit_rate])+_T(" bps")); Skip_SB( "Embedded Down Mix Enabled"); Skip_SB( "Embedded Dynamic Range"); Skip_SB( "Embedded Time Stamp"); Skip_SB( "Auxiliary Data"); Skip_SB( "HDCD"); Get_S1 ( 3, ExtensionAudioDescriptor, "Extension Audio Descriptor"); Param_Info(DTS_ExtensionAudioDescriptor[ExtensionAudioDescriptor]); Get_SB ( ExtendedCoding, "Extended Coding"); Skip_SB( "Audio Sync Word Insertion"); Get_S1 ( 2, lfe_effects, "Low Frequency Effects"); Skip_SB( "Predictor History"); if (crc_present) Skip_S2(16, "Header CRC Check"); Skip_SB( "Multirate Interpolator"); Get_S1 ( 4, EncoderSoftwareRevision, "Encoder Software Revision"); Skip_S1( 2, "Copy History"); Get_S1 ( 2, bits_per_sample, "Source PCM Resolution"); Param_Info(Ztring::ToZtring(DTS_Resolution[bits_per_sample])+_T(" bits")); Skip_SB( "ES"); Skip_SB( "Front Sum/Difference"); Skip_SB( "Surrounds Sum/Difference"); Skip_S1( 4, "Dialog Normalisation Parameter"); switch (EncoderSoftwareRevision) { case 6 : Skip_S1( 4, "Dialog Normalisation Parameter"); break; case 7 : Skip_S1( 4, "Dialog Normalisation Parameter"); break; default : Skip_S1( 4, "Unspecified"); break; } BS_End(); //Filling Header_Fill_Size(Primary_Frame_Byte_Size_minus_1+DTS_HD_Unknown_Size); //TODO: change this, for DTS-HD Header_Fill_Code(0, "Frame"); }
//--------------------------------------------------------------------------- void File_Aac::ErHVXCconfig() { Element_Begin1("ErHVXCconfig"); bool extensionFlag; Skip_SB( "HVXCvarMode"); Skip_S1(2, "HVXCrateMode"); Get_SB (extensionFlag, "extensionFlag"); if (extensionFlag) { Skip_SB( "var_ScalableFlag"); } Element_End0(); }
//--------------------------------------------------------------------------- void File_Aac::TTSSpecificConfig() { Element_Begin1("TTSSpecificConfig"); //~ TTS_Sequence() //~ { Skip_S1(5, "TTS_Sequence_ID"); Skip_BS(18, "Language_Code"); Skip_SB( "Gender_Enable"); Skip_SB( "Age_Enable"); Skip_SB( "Speech_Rate_Enable"); Skip_SB( "Prosody_Enable"); Skip_SB( "Video_Enable"); Skip_SB( "Lip_Shape_Enable"); Skip_SB( "Trick_Mode_Enable"); //~ } Element_End0(); }
//--------------------------------------------------------------------------- void File_Cdp::time_code_section() { Element_Begin1("time_code_section"); Skip_B1( "time_code_section_id"); BS_Begin(); Mark_1(); Mark_1(); Skip_S1(2, "tc_10hrs"); Skip_S1(4, "tc_1hrs"); Mark_1(); Skip_S1(3, "tc_10min"); Skip_S1(4, "tc_1min"); Skip_SB( "tc_field_flag"); Skip_S1(3, "tc_10sec"); Skip_S1(4, "tc_1sec"); Skip_SB( "drop_frame_flag"); Mark_0(); Skip_S1(2, "tc_10fr"); Skip_S1(4, "tc_1fr"); BS_End(); Element_End0(); }
//--------------------------------------------------------------------------- // AAC in ES, SBR part, 2 bytes? // Format is unknown void File_Mpeg4_AudioSpecificConfig::PS () { //Parsing Element_Begin("PS"); bool PS; Skip_S1(11, "Unknown"); Get_SB ( PS, "PS present"); Element_End(); FILLING_BEGIN(); if (PS) { 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, Codec+_T("/PS"), true); Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions, "", Unlimited, true, true); } FILLING_END(); }
//--------------------------------------------------------------------------- // Packet "B3" or "B6" void File_AvsV::picture_start() { //Counting if (File_Offset+Buffer_Offset+Element_Size==File_Size) Frame_Count_Valid=Frame_Count; //Finalize frames in case of there are less than Frame_Count_Valid frames Frame_Count++; //Name Element_Name("picture_start"); Element_Info(Ztring::ToZtring(Frame_Count)); if (Element_Code==0xB3) Element_Info(_T("I")); //Parsing int8u picture_coding_type=(int8u)-1; bool time_code_flag, progressive_frame, picture_structure=true, top_field_first, repeat_first_field, skip_mode_flag=false, loop_filter_disable; Skip_B2( "bbv_delay"); BS_Begin(); if (Element_Code==0xB3) //Only I { Get_SB ( time_code_flag, "time_code_flag"); if (time_code_flag) { Skip_SB( "time_code_dropframe"); Skip_S1(5, "time_code_hours"); Skip_S1(6, "time_code_minutes"); Skip_S1(6, "time_code_seconds"); Skip_S1(6, "time_code_pictures"); } } if (Element_Code==0xB6) //Only P or B { Get_S1 ( 2, picture_coding_type, "picture_coding_type"); Element_Info(AvsV_picture_coding_type[picture_coding_type]); } Skip_S1( 8, "picture_distance"); if (low_delay) Skip_UE( "bbv_check_times"); Get_SB ( progressive_frame, "progressive_frame"); if (!progressive_frame) { Get_SB( picture_structure, "picture_structure"); if (Element_Code==0xB6) //Only P or B { if (picture_structure) Skip_SB( "advanced_pred_mode_disable"); } } Get_SB ( top_field_first, "top_field_first"); Get_SB ( repeat_first_field, "repeat_first_field"); Skip_SB( "fixed_picture_qp"); Skip_S1( 6, "picture_qp"); if (Element_Code==0xB3) //Only I { if (!progressive_frame && !picture_structure) Get_SB( skip_mode_flag, "skip_mode_flag"); } if (Element_Code==0xB6) //Only P or B { if (picture_coding_type!=2 || !picture_structure) Skip_SB( "picture_reference_flag"); } Skip_SB( "reserved"); Skip_SB( "reserved"); Skip_SB( "reserved"); Skip_SB( "reserved"); if (Element_Code==0xB6) //Only P or B { Get_SB( skip_mode_flag, "skip_mode_flag"); } Get_SB ( loop_filter_disable, "loop_filter_disable"); if (!loop_filter_disable) { bool loop_filter_parameter_flag; Get_SB ( loop_filter_parameter_flag, "loop_filter_parameter_flag"); if (loop_filter_parameter_flag) { Skip_SE( "alpha_c_offset"); Skip_SE( "beta_offset"); } } BS_End(); if (Element_Size-Element_Offset) Skip_XX(Element_Size-Element_Offset, "Unknown"); FILLING_BEGIN(); if (progressive_frame==false) { if (picture_structure==true) //Frame { if (top_field_first) Interlaced_Top++; else Interlaced_Bottom++; } } else progressive_frame_Count++; //NextCode NextCode_Test(); NextCode_Clear(); for (int8u Pos=0x00; Pos<=0xAF; Pos++) NextCode_Add(Pos); //slice NextCode_Add(0xB0); //video_sequence_start NextCode_Add(0xB3); //picture_start NextCode_Add(0xB6); //picture_start //Autorisation of other streams for (int8u Pos=0x00; Pos<=0xAF; Pos++) Streams[Pos].Searching_Payload=true; //slice //Filling only if not already done if (Frame_Count>=Frame_Count_Valid && Count_Get(Stream_Video)==0) { //No need of more Accept("AVS Video"); Finish("AVS Video"); } FILLING_END(); }
//--------------------------------------------------------------------------- // Packet "B5" void File_AvsV::extension_start() { Element_Name("Extension"); //Parsing int8u extension_start_code_identifier; BS_Begin(); Get_S1 ( 4, extension_start_code_identifier, "extension_start_code_identifier"); Param_Info(AvsV_extension_start_code_identifier[extension_start_code_identifier]); Element_Info(AvsV_extension_start_code_identifier[extension_start_code_identifier]); switch (extension_start_code_identifier) { case 2 :{ //sequence_display //Parsing Get_S1 ( 3, video_format, "video_format"); Param_Info(AvsV_video_format[video_format]); Skip_SB( "sample_range"); TEST_SB_SKIP( "colour_description"); Skip_S1( 8, "colour_primaries"); Skip_S1( 8, "transfer_characteristics"); Skip_S1( 8, "matrix_coefficients"); TEST_SB_END(); Get_S2 (14, display_horizontal_size, "display_horizontal_size"); Mark_1 (); Get_S2 (14, display_vertical_size, "display_vertical_size"); Skip_SB( "reserved"); Skip_SB( "reserved"); BS_End(); } break; case 4 :{ //copyright //Parsing Skip_SB( "copyright_flag"); Skip_S1( 8, "copyright_id"); Skip_SB( "original_or_copy"); Skip_S1( 7, "reserved"); Mark_1 (); Info_S3(20, copyright_number_1, "copyright_number_1"); Mark_1 (); Info_S3(22, copyright_number_2, "copyright_number_2"); Mark_1 (); Info_S3(22, copyright_number_3, "copyright_number_3"); Param_Info(Ztring::ToZtring(((int64u)copyright_number_1<<44)+((int64u)copyright_number_2<<22)+(int64u)copyright_number_3, 16)); BS_End(); } break; case 11 :{ //camera_parameters //Parsing Skip_SB( "reserved"); Skip_S1( 7, "camera_id"); Mark_1 (); Skip_S3(22, "height_of_image_device"); Mark_1 (); Skip_S3(22, "focal_length"); Mark_1 (); Skip_S3(22, "f_number"); Mark_1 (); Skip_S3(22, "vertical_angle_of_view"); Mark_1 (); Skip_S3(16, "camera_position_x_upper"); Mark_1 (); Skip_S3(16, "camera_position_x_lower"); Mark_1 (); Skip_S3(16, "camera_position_y_upper"); Mark_1 (); Skip_S3(16, "camera_position_y_lower"); Mark_1 (); Skip_S3(16, "camera_position_z_upper"); Mark_1 (); Skip_S3(16, "camera_position_z_lower"); Mark_1 (); Skip_S3(22, "camera_direction_x"); Mark_1 (); Skip_S3(22, "camera_direction_y"); Mark_1 (); Skip_S3(22, "camera_direction_z"); Mark_1 (); Skip_S3(22, "camera_plane_vertical_x"); Mark_1 (); Skip_S3(22, "camera_plane_vertical_y"); Mark_1 (); Skip_S3(22, "camera_plane_vertical_z"); Mark_1 (); Skip_S4(32, "reserved"); BS_End(); } break; default:{ //Parsing Skip_S1(4, "data"); BS_End(); Skip_XX(Element_Size-Element_Offset, "data"); } } //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_Test(); FILLING_END(); }
//--------------------------------------------------------------------------- void File_Mpeg4_Descriptors::Descriptor_06() { //Parsing int8u predefined, timeStampLength; bool durationFlag, useTimeStampsFlag; Get_B1 (predefined, "predefined"); Param_Info(Mpeg4_Descriptors_Predefined(predefined)); switch (predefined) { case 0x00 : { BS_Begin(); Skip_SB( "useAccessUnitStartFlag"); Skip_SB( "useAccessUnitEndFlag"); Skip_SB( "useRandomAccessPointFlag"); Skip_SB( "hasRandomAccessUnitsOnlyFlag"); Skip_SB( "usePaddingFlag"); Get_SB (useTimeStampsFlag, "useTimeStampsFlag"); Skip_SB( "useIdleFlag"); Get_SB (durationFlag, "durationFlag"); BS_End(); Skip_B4( "timeStampResolution"); Skip_B4( "OCRResolution"); Get_B1 (timeStampLength, "timeStampLength"); Skip_B1( "OCRLength"); Skip_B1( "AU_Length"); Skip_B1( "instantBitrateLength"); BS_Begin(); Skip_S1(4, "degradationPriorityLength"); Skip_S1(5, "AU_seqNumLength"); Skip_S1(5, "packetSeqNumLength"); Skip_S1(2, "reserved"); BS_End(); } break; case 0x01 : useTimeStampsFlag=false; durationFlag=false; timeStampLength=32; break; case 0x02 : useTimeStampsFlag=true; durationFlag=false; timeStampLength=32; break; default : useTimeStampsFlag=false; durationFlag=false; timeStampLength=32; } if (durationFlag) { Skip_B4( "timeScale"); Skip_B2( "accessUnitDuration"); Skip_B2( "compositionUnitDuration"); } if (!useTimeStampsFlag) { BS_Begin(); Skip_S8(timeStampLength, "startDecodingTimeStamp"); Skip_S8(timeStampLength, "startCompositionTimeStamp"); BS_End(); } }
//--------------------------------------------------------------------------- void File_DvbSubtitle::region_composition_segment() { Element_Name("region composition segment"); //Parsing int16u region_width, region_height; int8u region_id, region_depth; Get_B1 ( region_id, "region_id"); BS_Begin(); Skip_S1(4, "region_version_number"); Skip_S1(1, "region_fill_flag"); Skip_S1(3, "reserved"); BS_End(); Get_B2 ( region_width, "region_width"); Get_B2 ( region_height, "region_height"); BS_Begin(); Skip_S1(3, "region_level_of_compatibility"); Get_S1 (3, region_depth, "region_depth"); Param_Info2(DvbSubtitle_region_depth[region_depth], " bits"); Skip_S1(2, "reserved"); BS_End(); Skip_B1( "CLUT_id"); Skip_B1( "region_8-bit_pixel_code"); BS_Begin(); Skip_S1(4, "region_4-bit_pixel-code"); Skip_S1(2, "region_2-bit_pixel-code"); Skip_S1(2, "reserved"); BS_End(); while(Element_Offset<Element_Size) { Element_Begin1("Object"); int8u object_type; Skip_B2( "object_id"); BS_Begin(); Get_S1 ( 2, object_type, "object_type"); Skip_S1( 2, "object_provider_flag"); Skip_S1(12, "object_horizontal_position"); Skip_S1( 4, "reserved"); Skip_S1(12, "object_vertical_position"); BS_End(); switch (object_type) { case 0x01 : case 0x02 : Skip_B2( "foreground_pixel_code"); Skip_B2( "background_pixel_code"); break; default : ; } Element_End0(); } FILLING_BEGIN(); subtitle_streams[subtitle_stream_id].pages[page_id].regions[region_id].region_composition_segment=true; subtitle_streams[subtitle_stream_id].pages[page_id].regions[region_id].region_width=region_width; subtitle_streams[subtitle_stream_id].pages[page_id].regions[region_id].region_height=region_height; subtitle_streams[subtitle_stream_id].pages[page_id].regions[region_id].region_depth=region_depth; FILLING_END(); }
//--------------------------------------------------------------------------- void File_Aac::ALSSpecificConfig() { //Not in spec, but something weird in the example I have int32u Junk; while (Data_BS_Remain()) { Peek_S4(32, Junk); if (Junk!=0x414C5300) { Skip_SB( "Unknown"); } else break; } if (Data_BS_Remain()==0) return; //There is a problem Element_Begin1("ALSSpecificConfig"); bool chan_config,chan_sort,crc_enabled,aux_data_enabled; int32u samp_freq, samples; int16u channels,frame_length; int8u ra_flag,random_access, file_type; Skip_BS(32,"als_id"); Get_BS (32, samp_freq, "samp_freq"); Get_BS (32, samples, "samples"); Get_S2 (16, channels, "channels"); Param_Info2(channels+1, " channel(s)"); Get_S1 (3, file_type, "file_type"); Skip_S1(3,"resolution"); Skip_SB("floating"); Skip_SB("msb_first"); Get_S2 (16,frame_length,"frame_length"); Get_S1 (8,random_access,"random_access"); Get_S1 (2,ra_flag,"ra_flag"); Skip_SB("adapt_order"); Skip_S1(2,"coef_table"); Skip_SB("long_term_prediction"); Skip_S2(10,"max_order"); Skip_S1(2,"block_switching"); Skip_SB("bgmc_mode"); Skip_SB("sb_part"); Skip_SB("joint_stereo"); Skip_SB("mc_coding"); Get_SB (chan_config,"chan_config"); Get_SB (chan_sort,"chan_sort"); Get_SB (crc_enabled,"crc_enabled"); Skip_SB("RLSLMS"); Skip_BS(5,"(reserved)"); Get_SB (aux_data_enabled,"aux_data_enabled"); if (chan_config) Skip_S2(16,"chan_config_info"); if (chan_sort) { int16u ChBits=(int16u)ceil(log((double)(channels+1))/log((double)2)); for (int8u c=0; c<=channels; c++) Skip_BS(ChBits, "chan_pos[c]"); } if(Data_BS_Remain()%8) Skip_S1(Data_BS_Remain()%8, "byte_align"); BS_End(); int32u header_size,trailer_size; Get_B4(header_size, "header_size"); Get_B4(trailer_size, "trailer_size"); #ifdef MEDIAINFO_RIFF_YES if (file_type==1) //WAVE file { Element_Begin1("orig_header"); File_Riff MI; Open_Buffer_Init(&MI); Open_Buffer_Continue(&MI, Buffer+Buffer_Offset+(size_t)Element_Offset, header_size); Element_Offset+=header_size; File__Analyze::Finish(&MI); //No merge of data, only for trace information, because this is the data about the decoded stream, not the encoded stream Element_End0(); } else #endif //MEDIAINFO_RIFF_YES Skip_XX(header_size, "orig_header[]"); Skip_XX(trailer_size, "orig_trailer[]"); if (crc_enabled) Skip_B4( "crc"); if ((ra_flag == 2) && (random_access > 0)) for (int32u f=0; f<((samples-1)/(frame_length+1))+1; f++) Skip_B4( "ra_unit_size[f]"); if (aux_data_enabled) { int32u aux_size; Get_B4(aux_size, "aux_size"); Skip_XX(aux_size, "aux_data[]"); } Element_End0(); BS_Begin(); //To be in sync with other objectTypes FILLING_BEGIN(); //Filling File__Analyze::Stream_Prepare(Stream_Audio); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, channels+1); //Forcing default confignuration (something weird in the example I have) channelConfiguration=0; sampling_frequency_index=(int8u)-1; sampling_frequency=samp_freq; FILLING_END(); }