//--------------------------------------------------------------------------- void File_Tak::ENCODERINFO() { //Parsing int8u Revision, Minor, Major, Preset_hi, Preset_lo; Get_L1 (Revision, "Revision"); Get_L1 (Minor, "Minor"); Get_L1 (Major, "Major"); BS_Begin(); Get_S1 (4, Preset_hi, "Preset (hi)"); Get_S1 (4, Preset_lo, "Preset (lo)"); BS_End(); FILLING_BEGIN(); Ztring Version=Ztring::ToZtring(Major)+__T('.')+Ztring::ToZtring(Minor)+__T('.')+Ztring::ToZtring(Revision); Ztring Preset=__T("-p")+Ztring::ToZtring(Preset_lo); switch (Preset_hi) { case 0x00 : break; case 0x01 : Preset+=__T('e'); break; case 0x02 : Preset+=__T('m'); break; default : Preset+=__T('-')+Ztring::ToZtring(Preset_hi, 16); //Unknown } Fill(Stream_Audio, 0, Audio_Encoded_Library, "TAK"); Fill(Stream_Audio, 0, Audio_Encoded_Library_String, __T("TAK ")+Version); Fill(Stream_Audio, 0, Audio_Encoded_Library_Name, "TAK"); Fill(Stream_Audio, 0, Audio_Encoded_Library_Version, Version); Fill(Stream_Audio, 0, Audio_Encoded_Library_Settings, Preset); 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_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_Als::FileHeader_Parse() { //Parsing int32u SampleRate, Samples; int16u Channels; int8u BitsPerSample, FileType; Skip_C4( "signature"); Get_B4 (SampleRate, "sample rate"); Get_B4 (Samples, "samples"); Get_B2 (Channels, "channels-1"); Param_Info2(Channels+1, " channel(s)"); BS_Begin(); Get_S1 (3, FileType, "file type"); // WAV, RIFF, AIFF Get_S1 (3, BitsPerSample, "bits per sample"); Param_Info2((BitsPerSample+1)*8, " bits"); Skip_SB( "floating point"); Skip_SB( "samples are big-endian"); BS_End(); FILLING_BEGIN(); if (!CalcDurationUncompressedSize(Samples, SampleRate, (BitsPerSample+1)*8, Channels)) return; File__Tags_Helper::Accept("ALS"); File__Tags_Helper::Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "ALS"); Fill(Stream_Audio, 0, Audio_Codec, "ALS"); Fill(Stream_Audio, 0, Audio_BitDepth, (BitsPerSample+1)*8); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Channels+1); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, SampleRate); Fill(Stream_Audio, 0, Audio_Duration, Duration); //No more need data File__Tags_Helper::Finish("ALS"); 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); }
//--------------------------------------------------------------------------- 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(); region_data& region = subtitle_streams[subtitle_stream_id].pages[page_id].regions[region_id]; region.region_composition_segment=true; region.region_width=region_width; region.region_height=region_height; region.region_depth=region_depth; FILLING_END(); }
//--------------------------------------------------------------------------- // 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_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_Eia708::Header_Parse() { //Parsing int8u packet_size, sequence_number; BS_Begin(); Get_S1(2, sequence_number, "sequence_number"); Get_S1(6, packet_size, "packet_size"); BS_End(); Header_Fill_Code(0, _T("DTVCC packet")); Header_Fill_Size(packet_size*2); }
//--------------------------------------------------------------------------- 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_Vc3::ImageGeometry() { //Parsing Element_Begin("Image Geometry", 11); Get_B2 (ALPF, "Active lines-per-frame"); Get_B2 (SPL, "Samples-per-line"); Skip_B1( "Zero"); Skip_B2( "Number of active lines"); Skip_B2( "Zero"); BS_Begin(); Get_S1 (3, SBD, "Sample bit depth"); Mark_1(); Mark_1(); Mark_0(); Mark_0(); Mark_0(); Mark_1(); Mark_0(); Mark_0(); Mark_0(); Mark_1(); Get_SB ( SST, "Source scan type"); Mark_0(); Mark_0(); BS_End(); Element_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(); 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(); }
//--------------------------------------------------------------------------- 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_Bpg::Read_Buffer_Continue() { //Parsing Ztring Version; int64u Width, Height; int8u pixelformat, BitsDepth, ColorSpace; bool Alpha1_flag, Alpha2_flag, ReservedZeros, limited_range_flag, ExtensionPresentFlag; Element_Begin1("File header"); Skip_C4( "Magic"); // File Magic BS_Begin(); Get_S1 (3, pixelformat, "pixel_format"); Param_Info1(Bpg_Pixel_format(pixelformat)); Get_SB (Alpha1_flag, "Alpha1 Present Flag"); Get_S1 (4, BitsDepth, "bit_depth_minus_8"); Get_S1(4, ColorSpace, "color_space"); Param_Info1(Bpg_ColorSpace(ColorSpace)); Param_Info1(Bpg_colour_primaries(ColorSpace)); Get_SB (ExtensionPresentFlag, "Extension Present Flag"); Get_SB (Alpha2_flag, "Alpha2 Present Flag"); Get_SB (limited_range_flag, "limited_range_flag"); Get_SB (ReservedZeros, "Reserved"); BS_End(); Get_VS(Width, "Picture Width"); Get_VS(Height, "Picture Height"); Element_End0(); FILLING_BEGIN(); Accept("BPG"); Stream_Prepare(Stream_Image); Fill(Stream_Image, 0, Image_Width, Width); Fill(Stream_Image, 0, Image_Height, Height); Fill(Stream_Image, 0, Image_Format, __T("BPG")); Fill(Stream_Image, 0, Image_ChromaSubsampling, Bpg_Pixel_format(pixelformat)); Fill(Stream_Image, 0, Image_ColorSpace, Bpg_ColorSpace(ColorSpace)); Fill(Stream_Image, 0, Image_colour_primaries, Bpg_colour_primaries(ColorSpace)); Fill(Stream_Image, 0, Image_BitDepth, BitsDepth + 8); Fill(Stream_Image, 0, Image_Codec, __T("BPG")); FILLING_END(); Finish("BPG"); }
//--------------------------------------------------------------------------- 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_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_MpcSv8::EI() { //Parsing int8u Quality, Version1, Version2, Version3; bool PNS; BS_Begin(); Get_S1 (7, Quality, "Quality"); Get_SB ( PNS, "PNS"); BS_End(); Get_B1 (Version1, "Major version"); Get_B1 (Version2, "Minor version"); Get_B1 (Version3, "Build"); }
//--------------------------------------------------------------------------- void File_Gif::Read_Buffer_Continue() { //Parsing Ztring Version; int16u Width, Height; int8u BackgroundColorIndex, PixelAspectRatio, Resolution, GCT_Size; bool GCT_Flag, Sort; Skip_Local(3, "Header"); Get_Local (3, Version, "Version"); Get_L2 (Width, "Logical Screen Width"); Get_L2 (Height, "Logical Screen Height"); BS_Begin(); Get_SB ( GCT_Flag, "Global Color Table Flag"); Get_S1 (3, Resolution, "Color Resolution"); Get_SB ( Sort, "Sort Flag to Global Color Table"); Get_S1 (3, GCT_Size, "Size of Global Color Table"); Param_Info(Ztring::ToZtring((int16u)pow(2.0, 1+GCT_Size))); BS_End(); Get_L1 (BackgroundColorIndex, "Background Color Index"); Get_L1 (PixelAspectRatio, "Pixel Aspect Ratio"); if (GCT_Flag) Skip_XX((int16u)pow(2.0, 1+GCT_Size)*3, "Global Color Table"); Element_End(); FILLING_BEGIN(); Accept("GIF"); Stream_Prepare(Stream_Image); Fill(Stream_Image, 0, Image_Width, Width); Fill(Stream_Image, 0, Image_Height, Height); Fill(Stream_Image, 0, Image_Format, _T("GIF")); Fill(Stream_Image, 0, Image_Format_Profile, Version); Fill(Stream_Image, 0, Image_Codec, _T("GIF")+Version); Finish("GIF"); FILLING_END(); }
//--------------------------------------------------------------------------- void File_Flac::Header_Parse() { //Parsing int32u Length; int8u BLOCK_TYPE; BS_Begin(); Get_SB ( Last_metadata_block, "Last-metadata-block"); Get_S1 (7, BLOCK_TYPE, "BLOCK_TYPE"); BS_End(); Get_B3 (Length, "Length"); //Filling Header_Fill_Code(BLOCK_TYPE, Ztring().From_CC1(BLOCK_TYPE)); Header_Fill_Size(Element_Offset+Length); }
//--------------------------------------------------------------------------- void File_AfdBarData::afd_data() { //Parsing Element_Begin1("Active Format Description"); BS_Begin(); if (Format==Format_S2016_3) { Mark_0_NoTrustError(); Get_S1 (4, active_format, "active_format"); Param_Info1(AfdBarData_active_format[active_format]); Get_S1 (1, aspect_ratio, "aspect_ratio"); Param_Info1(AfdBarData_aspect_ratio[aspect_ratio]); Mark_0_NoTrustError(); Mark_0_NoTrustError(); } else { bool active_format_flag; Mark_0(); Get_SB (active_format_flag, "active_format_flag"); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_1_NoTrustError(); if (active_format_flag) { Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Get_S1 (4, active_format, "active_format"); Param_Info1(AfdBarData_active_format[active_format]); } } BS_End(); Element_End0(); }
//--------------------------------------------------------------------------- void File_Aac::PARAconfig() { Element_Begin1("PARAconfig"); int8u PARAmode; Get_S1(2,PARAmode, "PARAmode"); if (PARAmode != 1) ErHVXCconfig(); if (PARAmode != 0) HILNconfig(); bool PARAextensionFlag; Get_SB(PARAextensionFlag, "PARAextensionFlag"); if (PARAextensionFlag) { /* to be defined in MPEG-4 Phase 3 */ } Element_End0(); }
//--------------------------------------------------------------------------- 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_Amr::Header_Parse() { BS_Begin(); Skip_SB( "Frame Following"); Get_S1 ( 4, FrameType, "Frame Type"); Skip_SB( "Frame Quality"); Skip_SB( "Unknown"); Skip_SB( "Unknown"); BS_End(); //Filling if (Amr_BitRate[FrameType]==0) { Finish("AMR"); return; } Header_Fill_Size(Amr_BitRate[FrameType]/400); Header_Fill_Code(0, "frame"); }
//--------------------------------------------------------------------------- void File_Vc3::CodingControlA() { //Parsing Element_Begin1("Coding Control A"); BS_Begin(); int8u FFC; Mark_0(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Get_S1 (2, FFC, "Field/Frame Count"); Param_Info1(Vc3_FFC[FFC]); Mark_1(); Mark_0(); Mark_0(); Get_SB ( CRCF, "CRC flag"); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Mark_1(); Mark_0(); Mark_1(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); BS_End(); Element_End0(); FILLING_BEGIN(); if (FFC_FirstFrame==(int8u)-1) FFC_FirstFrame=FFC; 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_Jpeg::SOF_() { //Parsing vector<Jpeg_samplingfactor> SamplingFactors; int16u Height, Width; int8u Resolution, Count; Get_B1 (Resolution, "P - Sample precision"); Get_B2 (Height, "Y - Number of lines"); Get_B2 (Width, "X - Number of samples per line"); Get_B1 (Count, "Nf - Number of image components in frame"); for (int8u Pos=0; Pos<Count; Pos++) { Jpeg_samplingfactor SamplingFactor; Element_Begin1("Component"); Info_B1(Ci, "Ci - Component identifier"); Element_Info1(Ci); BS_Begin(); Get_S1 (4, SamplingFactor.Hi, "Hi - Horizontal sampling factor"); Element_Info1(SamplingFactor.Hi); Get_S1 (4, SamplingFactor.Vi, "Vi - Vertical sampling factor"); Element_Info1(SamplingFactor.Vi); BS_End(); Skip_B1( "Tqi - Quantization table destination selector"); Element_End0(); //Filling list of HiVi SamplingFactors.push_back(SamplingFactor); } FILLING_BEGIN_PRECISE(); if (Frame_Count==0 && Field_Count==0) { Accept("JPEG"); if (Count_Get(StreamKind_Last)==0) Stream_Prepare(StreamKind_Last); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Format), "JPEG"); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Codec), "JPEG"); if (StreamKind_Last==Stream_Image) Fill(Stream_Image, 0, Image_Codec_String, "JPEG", Unlimited, true, true); //To Avoid automatic filling if (StreamKind_Last==Stream_Video) Fill(Stream_Video, 0, Video_InternetMediaType, "video/JPEG", Unlimited, true, true); Fill(StreamKind_Last, 0, "ColorSpace", "YUV"); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_BitDepth), Resolution); Fill(StreamKind_Last, 0, "Height", Height*(Interlaced?2:1)); Fill(StreamKind_Last, 0, "Width", Width); //Chroma subsampling if (SamplingFactors.size()==3 && SamplingFactors[1].Hi==1 && SamplingFactors[2].Hi==1 && SamplingFactors[1].Vi==1 && SamplingFactors[2].Vi==1) { string ChromaSubsampling; switch (SamplingFactors[0].Hi) { case 1 : switch (SamplingFactors[0].Vi) { case 1 : ChromaSubsampling="4:4:4"; break; default: ; } break; case 2 : switch (SamplingFactors[0].Vi) { case 1 : ChromaSubsampling="4:2:2"; break; case 2 : ChromaSubsampling="4:2:0"; break; default: ; } break; case 4 : switch (SamplingFactors[0].Vi) { case 1 : ChromaSubsampling="4:1:1"; break; default: ; } break; default: ; } if (!ChromaSubsampling.empty()) Fill(StreamKind_Last, 0, "ChromaSubsampling", ChromaSubsampling); } } FILLING_END(); }
//--------------------------------------------------------------------------- void File_Wvpk::Data_Parse() { //Specific if (FromMKV && !FromMKV_CodecPrivateParsed) { //Parsing Get_L2 (version, "version"); FILLING_BEGIN(); FromMKV_CodecPrivateParsed=true; FILLING_END(); return; } //Counting Frame_Count++; //Parsing Element_Begin("Block Header"); if (!FromMKV) Get_L2 (version, "version"); if (version/0x100==0x4) { while (Element_Offset<Element_Size) { int32u total_samples=(int32u)-1, block_index=(int32u)-1, block_samples=0, flags, blocksize=(int32u)-1; bool initial_block=true, final_block=true; if (!FromMKV) { Skip_L1( "track_no"); Skip_L1( "index_no"); Get_L4 (total_samples, "total_samples"); Get_L4 (block_index, "block_index"); } if (!FromMKV || (FromMKV && Element_Offset==0)) Get_L4 (block_samples, "block_samples"); if (block_samples!=0) //empty frames have other values empty { if (!FromMKV) { if (block_index==0) //Only the frame with block_index==0 total_samples_FirstFrame=total_samples; //Note: total_samples is not trustable for a cutted file if (Frame_Count==1) block_index_FirstFrame=block_index; //Save the block_index of the first block block_index_LastFrame=block_index; block_samples_LastFrame=block_samples; } Get_L4 (flags, "flags"); Get_Flags (flags, 0, resolution0, "resolution0"); Get_Flags (flags, 1, resolution1, "resolution1"); Get_Flags (flags, 2, mono, "mono"); Get_Flags (flags, 3, hybrid, "hybrid"); Get_Flags (flags, 4, joint_stereo, "joint stereo"); Get_Flags (flags, 5, cross_channel_decorrelation, "cross-channel decorrelation"); Skip_Flags(flags, 6, "hybrid noise shaping"); Skip_Flags(flags, 7, "floating point data"); Skip_Flags(flags, 8, "extended size integers"); Skip_Flags(flags, 9, "hybrid mode parameters control bitrate"); Skip_Flags(flags, 10, "hybrid noise balanced between channels"); Get_Flags (flags, 11, initial_block, "initial block in sequence"); Get_Flags (flags, 12, final_block, "final block in sequence"); Skip_Flags(flags, 13, "amount of data left-shift after decode"); Skip_Flags(flags, 14, "amount of data left-shift after decode"); Skip_Flags(flags, 15, "amount of data left-shift after decode"); Skip_Flags(flags, 16, "amount of data left-shift after decode"); Skip_Flags(flags, 17, "amount of data left-shift after decode"); Skip_Flags(flags, 18, "maximum magnitude of decoded data"); Skip_Flags(flags, 19, "maximum magnitude of decoded data"); Skip_Flags(flags, 20, "maximum magnitude of decoded data"); Skip_Flags(flags, 21, "maximum magnitude of decoded data"); Skip_Flags(flags, 22, "maximum magnitude of decoded data"); Skip_Flags(flags, 23, "sampling rate"); Skip_Flags(flags, 24, "sampling rate"); Skip_Flags(flags, 25, "sampling rate"); Skip_Flags(flags, 26, "sampling rate"); SamplingRate=(int8u)(((flags>>23)&0xF)); Param_Info(Wvpk_SamplingRate[SamplingRate]); Skip_Flags(flags, 27, "reserved"); Skip_Flags(flags, 28, "reserved"); Skip_Flags(flags, 29, "use IIR for negative hybrid noise shaping"); Skip_Flags(flags, 30, "false stereo"); Skip_Flags(flags, 31, "reserved"); } else { Skip_L4( "flags (empty)"); //Counting Frame_Count--; //This is not a real frame } Skip_L4( "crc"); Element_End(); int64u End=Element_Size; if (FromMKV && !(initial_block && final_block)) { Get_L4 (blocksize, "blocksize"); End=Element_Offset+blocksize; if (End>=Element_Size) End=Element_Size; } //Sub-block int8u id; while (Element_Offset<End) { Element_Begin(); int32u word_size; bool large, odd_size; BS_Begin(); Get_SB (large, "large"); Get_SB (odd_size, "odd_size"); Get_S1 (6, id, "id"); Element_Info(Wvpk_id(id)); BS_End(); if (large) { Get_L3 (word_size, "word_size"); } else { int8u word_size1; Get_L1 (word_size1, "word_size"); word_size=word_size1; } if (word_size==0 && odd_size) Size=0; //Problem! else Size=word_size*2-(odd_size?1:0); Element_Name(Ztring().From_CC1(id)); switch (id) { case 0x07 : id_07(); break; case 0x0D : id_0D(); break; case 0x25 : id_25(); break; default : if (word_size) Skip_XX(Size, "data"); } if (odd_size) Skip_XX(1, "padding"); Element_End(); } } }
//--------------------------------------------------------------------------- void File_Jpeg::SIZ() { //Parsing vector<float> SamplingFactors; vector<int8u> BitDepths; int8u SamplingFactors_Max=0; int32u Xsiz, Ysiz; int16u Count; Skip_B2( "Rsiz - Capability of the codestream"); Get_B4 (Xsiz, "Xsiz - Image size X"); Get_B4 (Ysiz, "Ysiz - Image size Y"); Skip_B4( "XOsiz - Image offset X"); Skip_B4( "YOsiz - Image offset Y"); Skip_B4( "tileW - Size of tile W"); Skip_B4( "tileH - Size of tile H"); Skip_B4( "XTOsiz - Upper-left tile offset X"); Skip_B4( "YTOsiz - Upper-left tile offset Y"); Get_B2 (Count, "Components and initialize related arrays"); for (int16u Pos=0; Pos<Count; Pos++) { Element_Begin1("Initialize related array"); int8u BitDepth = 0, compSubsX = 0, compSubsY = 0; BS_Begin(); Skip_SB( "Signed"); Get_S1 (7, BitDepth, "BitDepth"); Param_Info1(1+BitDepth); Element_Info1(1+BitDepth); BS_End(); Get_B1 ( compSubsX, "compSubsX"); Element_Info1(compSubsX); Get_B1 ( compSubsY, "compSubsY"); Element_Info1(compSubsY); Element_End0(); //Filling list of HiVi if (compSubsX) { SamplingFactors.push_back(((float)compSubsY)/compSubsX); if (((float)compSubsY)/compSubsX>SamplingFactors_Max) SamplingFactors_Max=(int8u)((float)compSubsY)/compSubsX; } if (BitDepths.empty() || BitDepth!=BitDepths[0]) BitDepths.push_back(BitDepth); } FILLING_BEGIN_PRECISE(); if (Frame_Count==0 && Field_Count==0) { Accept("JPEG 2000"); if (Count_Get(StreamKind_Last)==0) Stream_Prepare(StreamKind_Last); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Format), "JPEG 2000"); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Codec), "JPEG 2000"); if (StreamKind_Last==Stream_Image) Fill(Stream_Image, 0, Image_Codec_String, "JPEG 2000", Unlimited, true, true); //To Avoid automatic filling Fill(StreamKind_Last, 0, StreamKind_Last==Stream_Image?(size_t)Image_Width:(size_t)Video_Width, Xsiz); Fill(StreamKind_Last, 0, StreamKind_Last==Stream_Image?(size_t)Image_Height:(size_t)Video_Height, Ysiz*(Interlaced?2:1)); //If image is from interlaced content, must multiply height by 2 if (BitDepths.size()==1) Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_BitDepth), 1+BitDepths[0]); //Chroma subsampling if (SamplingFactors_Max) while (SamplingFactors_Max<4) { for (size_t Pos=0; Pos<SamplingFactors.size(); Pos++) SamplingFactors[Pos]*=2; SamplingFactors_Max*=2; } while (SamplingFactors.size()<3) SamplingFactors.push_back(0); Ztring ChromaSubsampling; for (size_t Pos=0; Pos<SamplingFactors.size(); Pos++) ChromaSubsampling+=Ztring::ToZtring(SamplingFactors[Pos], 0)+__T(':'); if (!ChromaSubsampling.empty()) { ChromaSubsampling.resize(ChromaSubsampling.size()-1); Fill(StreamKind_Last, 0, "ChromaSubsampling", ChromaSubsampling); } } FILLING_END(); }