//--------------------------------------------------------------------------- void File_Exr::FileHeader_Parse() { //Parsing int32u Flags; int8u Version; bool Deep, Multipart; Skip_L4( "Magic number"); Get_L1 (Version, "Version field"); Get_L3 (Flags, "Flags"); Skip_Flags(Flags, 0, "Single tile"); Get_Flags (Flags, 1, LongName, "Long name"); Get_Flags (Flags, 2, Deep, "Non-image"); Get_Flags (Flags, 3, Multipart, "Multipart"); //Filling if (Frame_Count==0) { Fill(Stream_General, 0, General_Format_Version, __T("Version ")+Ztring::ToZtring(Version)); Fill(StreamKind_Last, 0, "Format", "EXR"); Fill(StreamKind_Last, 0, "Format_Version", __T("Version ")+Ztring::ToZtring(Version)); Fill(StreamKind_Last, 0, "Format_Profile", (Flags&0x02)?"Tile":"Line"); if (Deep) Fill(Stream_General, 0, "Deep", "Yes"); if (Multipart) Fill(Stream_General, 0, "Multipart", "Yes"); } Frame_Count++; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; ImageData_End=Config->File_Current_Size; }
//--------------------------------------------------------------------------- void File_Tak::Header_Parse() { //Parsing int32u block_length; int8u block_type; Get_L1 (block_type, "Block Type"); Get_L3 (block_length, "Block Length"); //Filling Header_Fill_Code(block_type, Ztring().From_CC1(block_type)); Header_Fill_Size(Element_Offset+block_length); }
//--------------------------------------------------------------------------- void File_Tak::WAVEMETADATA() { //Parsing int32u HeaderLength, FooterLength; Get_L3 (HeaderLength, "HeaderLength"); Get_L3 (FooterLength, "FooterLength"); #if defined(MEDIAINFO_RIFF_YES) //Creating the parser File_Riff MI; Open_Buffer_Init(&MI); //Parsing Open_Buffer_Continue(&MI, HeaderLength); Element_Offset+=HeaderLength; //Filling //Finish(&MI); //Merge(MI, StreamKind_Last, 0, StreamPos_Last); //The RIFF header is for PCM //Clear(Stream_Audio, StreamPos_Last, Audio_ID); //Fill(Stream_Audio, StreamPos_Last, Audio_Format, "TAK", Unlimited, true, true); //Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "TAK", Unlimited, true, true); //Clear(Stream_Audio, StreamPos_Last, Audio_CodecID); //Clear(Stream_Audio, StreamPos_Last, Audio_CodecID_Hint); //Clear(Stream_Audio, StreamPos_Last, Audio_CodecID_Url); //Clear(Stream_Audio, StreamPos_Last, Audio_BitRate); //Clear(Stream_Audio, StreamPos_Last, Audio_BitRate_Mode); //Clear(Stream_Audio, StreamPos_Last, Audio_Codec_CC); #else Skip_XX(HeaderLength, "Wave header"); #endif if (FooterLength) Skip_XX(FooterLength, "Wave footer"); Skip_L3( "crc"); }
//--------------------------------------------------------------------------- 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_Exr::Header() { //Parsing int32u Flags; int8u Version; Skip_L4( "Magic number"); Get_L1 (Version, "Version field"); Get_L3 (Flags, "Flags"); //Filling if (Frame_Count==0) { Fill(Stream_General, 0, General_Format_Version, _T("Version ")+Ztring::ToZtring(Version)); Fill(StreamKind_Last, 0, "Format", "EXR"); Fill(StreamKind_Last, 0, "Format_Version", _T("Version ")+Ztring::ToZtring(Version)); Fill(StreamKind_Last, 0, "Format_Profile", (Flags&0x02)?"Tile":"Line"); } Frame_Count++; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; ImageData_End=File_Offset+Buffer_Offset+Config->File_Sizes[Config->File_Names_Pos-1]; }
//--------------------------------------------------------------------------- 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(); } } }