//--------------------------------------------------------------------------- void File_Lyrics3v2::Footer() { //Parsing Element_Info("Footer"); Skip_Local(6, "Size"); Skip_Local(9, "Signature"); }
//--------------------------------------------------------------------------- void File_Lyrics3::Read_Buffer_Continue() { if (TotalSize==(int64u)-1) TotalSize=Buffer_Size; //Coherency if (TotalSize<20) { Reject("Lyrics3"); return; } //Buffer size if (Buffer_Size<TotalSize) return; //Parsing Element_Offset=0; Element_Size=TotalSize; Skip_Local(11, "Signature"); Skip_Local(TotalSize-20, "Lyrics"); Skip_Local(9, "Signature"); //Filling Accept("Lyric3"); Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, Text_Codec, "Lyrics3"); Finish("Lyrics3"); }
//--------------------------------------------------------------------------- void File_Lyrics3v2::Footer() { //Parsing Skip_Local(6, "Size"); Skip_Local(9, "Signature"); Finish("Lyrics3v2"); }
//--------------------------------------------------------------------------- void File_Lyrics3v2::IND() { //Parsing if (Element_Size>=1) Skip_Local(1, "lyrics present"); if (Element_Size>=2) Skip_Local(1, "timestamp in lyrics"); if (Element_Size>=3) Skip_Local(1, "inhibits tracks for random selection"); while (Element_Offset<Element_Size) Skip_Local(1, "unknown"); }
//--------------------------------------------------------------------------- // file header void File_Rar::Header_Parse_Content_74() { int16u name_size; int8u HOST_OS, METHOD, UNP_VER; Get_L4 (PACK_SIZE, "PACK_SIZE"); //Compressed file size Skip_L4( "UNP_SIZE"); //Uncompressed file size Get_L1 (HOST_OS, "HOST_OS"); Param_Info1((HOST_OS<6?Rar_host_os[HOST_OS]:"Unknown")); Skip_L4( "FILE_CRC"); Skip_L4( "FTIME"); //Date and time in standard MS DOS format Get_L1 (UNP_VER, "UNP_VER"); Param_Info1(Rar_version_number(UNP_VER)); //RAR version needed to extract file Get_L1 (METHOD, "METHOD"); Param_Info1(((METHOD>=0x30)&&(METHOD<0x36)?Rar_packing_method[METHOD-0x30]:"Unknown")); Get_L2 (name_size, "NAME_SIZE"); //File name size Skip_L4( "ATTR"); //File attributes if(high_fields) { Get_L4 (HIGH_PACK_SIZE, "HIGH_PACK_SIZE"); //High 4 bytes of 64 bit value of compressed file size. Skip_L4( "HIGH_UNP_SIZE"); //High 4 bytes of 64 bit value of uncompressed file size. } else HIGH_PACK_SIZE=0; if (usual_or_utf8) { //Must test the content before reading, looking fore zero byte if (Element_Offset+name_size>Element_Size) { Skip_XX(Element_Size-Element_Offset, "Error"); return; } int64u ZeroPos=0; while (ZeroPos<name_size) { if (Buffer[Buffer_Offset+(size_t)(Element_Offset+ZeroPos)]==0) break; //Found ZeroPos++; } if (ZeroPos==name_size) Skip_UTF8(name_size, "FILE_NAME"); else { Skip_Local(ZeroPos, "FILE_NAME"); //Up to ZeroPos Skip_L1( "Zero"); Skip_UTF16L(name_size-(ZeroPos+1), "FILE_NAME"); //Spec is not precise, "Unicode" without encoding format (character size, endianess), because RAR is from Windows, we hope this is the format from Windows (UTF-16 Little Endian) } } else Skip_Local(name_size, "FILE_NAME"); if (salt) Skip_L8( "SALT"); //if(exttime) //Skip_XX("EXT_TIME"); //Which size? }
//--------------------------------------------------------------------------- void File_Tga::Tga_File_Footer() { if (Version==1) return; //No footer Element_Begin1("Image/color Map Data"); Skip_L4( "Extension Area Offset"); Skip_L4( "Developer Directory Offset"); Skip_Local(16, "Signature"); Skip_Local( 1, "Reserved Character"); Skip_L1( "Binary Zero String Terminator"); Element_End0(); }
//--------------------------------------------------------------------------- void File_Lyrics3v2::IND() { Element_Info("Indications field"); //Parsing if (Element_Size>=1) Skip_Local(1, "lyrics present"); if (Element_Size>=2) Skip_Local(1, "timestamp in lyrics"); if (Element_Size>=3) Skip_Local(1, "inhibits tracks for random selection"); //Can be more }
//--------------------------------------------------------------------------- void File_Flac::FileHeader_Parse() { //Parsing int32u Signature; if (VorbisHeader) { Skip_B1( "Signature"); Skip_Local(4, "Signature"); Skip_B1( "Major version"); Skip_B1( "Minor version"); Skip_B2( "Number of header"); } Get_C4 (Signature, "Signature"); FILLING_BEGIN(); //Integrity if (Signature!=CC4("fLaC")) { Finished(); return; } Stream_Prepare(Stream_General); Fill(Stream_General, 0, General_Format, "FLAC"); FILLING_END(); }
//--------------------------------------------------------------------------- void File_Lyrics3v2::IMG() { Element_Info("Image location"); //Parsing Skip_Local(Element_Size, "Value"); }
//--------------------------------------------------------------------------- void File_Lyrics3v2::CRC() { Element_Info("CRC"); //Parsing Skip_Local(Element_Size, "Value"); }
//--------------------------------------------------------------------------- void File_Lyrics3v2::AUT() { Element_Info("Lyrics Author Name"); //Parsing Skip_Local(Element_Size, "Value"); }
//--------------------------------------------------------------------------- void File_Lyrics3::Footer() { //Parsing Element_Offset=0; Element_Size=9; Element_Begin("Footer", 9); Skip_Local(9, "Signature"); Element_End(); //Positionning Buffer_Offset+=9; }
//--------------------------------------------------------------------------- void File_Lyrics3v2::Header() { //Parsing Element_Offset=0; Element_Size=11; Element_Begin("Header", 11); Skip_Local(11, "Signature"); Element_End(); //Positioning Buffer_Offset+=11; }
//--------------------------------------------------------------------------- void File_Flac::FileHeader_Parse() { //Parsing if (VorbisHeader) { Skip_B1( "Signature"); Skip_Local(4, "Signature"); Skip_B1( "Major version"); Skip_B1( "Minor version"); Skip_B2( "Number of header"); } Skip_C4( "Signature"); }
//--------------------------------------------------------------------------- void File_Tar::Read_Buffer_Continue() { if (File_Size<257) { Reject(); return; } if (Buffer_Size<257) return; //Wait for more data //Parsing Ztring ChecksumO; Skip_Local(100, "File name"); Skip_Local( 8, "File mode"); Skip_Local( 8, "Owner's numeric user ID"); Skip_Local( 12, "Group's numeric user ID"); Skip_Local( 12, "File size in bytes"); Skip_Local( 8, "Last modification time in numeric Unix time format"); Get_Local ( 8, ChecksumO, "Checksum for header block"); Skip_B1( "Link indicator (file type)"); Skip_Local(100, "Name of linked file"); Skip_XX(File_Size-257, "Data"); FILLING_BEGIN(); //Handling Checksum int32u Checksum=ChecksumO.To_int32u(8); int32u ChecksumU=0; int32u ChecksumS=0; for (size_t Pos=0; Pos<257; Pos++) { if (Pos==148) { ChecksumU+=32*8; //8 spaces ChecksumS+=32*8; //8 spaces Pos+=7; //Skiping Checksum } ChecksumU+=(int8u)Buffer[Pos]; ChecksumS+=(int8s)Buffer[Pos]; } if (ChecksumU!=Checksum && ChecksumS!=Checksum) { Reject("Tar"); return; } //Filling Accept("Tar"); Fill(Stream_General, 0, General_Format, "Tar"); Reject("Tar"); FILLING_END(); }
//--------------------------------------------------------------------------- void File_La::FileHeader_Parse() { //Parsing Ztring Major, Minor; int32u SampleRate, Samples, BytesPerSecond, UnCompSize, WAVEChunk, FmtSize, FmtChunk, CRC32; int16u RawFormat, Channels, BytesPerSample, BitsPerSample; Skip_Local(2, "signature"); Get_Local (1, Major, "major_version"); Get_Local (1, Minor, "minor_version"); Get_L4 (UnCompSize, "uncompressed_size"); Get_L4 (WAVEChunk, "chunk"); Skip_L4( "fmt_size"); Get_L4 (FmtChunk, "fmt_chunk"); Get_L4 (FmtSize, "fmt_size"); Get_L2 (RawFormat, "raw_format"); Get_L2 (Channels, "channels"); Param_Info2(Channels, " channel(s)"); Get_L4 (SampleRate, "sample_rate"); Get_L4 (BytesPerSecond, "bytes_per_second"); Get_L2 (BytesPerSample, "bytes_per_sample"); Get_L2 (BitsPerSample, "bits_per_sample"); Get_L4 (Samples, "samples"); Skip_L1( "flags"); Get_L4 (CRC32, "crc"); FILLING_BEGIN() if (SampleRate==0) return; Duration=((int64u)Samples/Channels)*1000/SampleRate; // Seems that it's samples per channels otherwise Duration is doubled ??!! if (Duration==0) return; UncompressedSize=(Samples)*Channels*(BitsPerSample/8); if (UncompressedSize==0) return; File__Tags_Helper::Accept("LA"); Fill(Stream_General, 0, General_Format_Version, Major+__T('.')+Minor); File__Tags_Helper::Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "LA"); Fill(Stream_Audio, 0, Audio_Codec, "LA"); Fill(Stream_Audio, 0, Audio_Format_Version, Major+__T('.')+Minor); Fill(Stream_Audio, 0, Audio_BitDepth, BitsPerSample); Fill(Stream_Audio, 0, Audio_Channel_s_, Channels); Fill(Stream_Audio, 0, Audio_SamplingRate, SampleRate); Fill(Stream_Audio, 0, Audio_Duration, Duration); //No more need data File__Tags_Helper::Finish("LA"); FILLING_END(); }
//--------------------------------------------------------------------------- void File_Speex::Identification() { Element_Name("Identification"); //Parsing Ztring speex_version; int32u Speex_version_id, header_size, rate, nb_channels, bitrate, vbr; Skip_Local(8, "speex_string"); Get_Local(20, speex_version, "speex_version"); Get_L4 (Speex_version_id, "Speex_version_id"); if (Speex_version_id==1) { Get_L4 (header_size, "header_size"); Get_L4 (rate, "rate"); Skip_L4( "mode"); Skip_L4( "mode_bitstream_version"); Get_L4 (nb_channels, "nb_channels"); Get_L4 (bitrate, "bitrate"); Skip_L4( "frame_size"); Get_L4 (vbr, "vbr"); Skip_L4( "frames_per_packet"); Skip_L4( "extra_headers"); Skip_L4( "reserved1"); Skip_L4( "reserved2"); if (header_size<Element_Size) Skip_XX(Element_Size-header_size, "Unknown"); //Filling FILLING_BEGIN() Accept("Speex"); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "Speex"); Fill(Stream_Audio, 0, Audio_Codec, "Speex"); if (Speex_version_id==1) { if (!speex_version.empty()) Fill(Stream_Audio, 0, Audio_Encoded_Library, speex_version); Fill(Stream_Audio, 0, Audio_SamplingRate, rate); Fill(Stream_Audio, 0, Audio_Channel_s_, nb_channels); if (bitrate!=(int32u)-1) Fill(Stream_Audio, 0, Audio_BitRate, bitrate); Fill(Stream_Audio, 0, Audio_BitRate_Mode, vbr?"VBR":"CBR"); } FILLING_END(); } //Filling Identification_Done=true; }
//--------------------------------------------------------------------------- void File_Lyrics3v2::FileHeader_Parse() { if (TotalSize==(int64u)-1) TotalSize=Buffer_Size; //Parsing Skip_Local(11, "Signature"); FILLING_BEGIN(); Accept("Lyrics3v2"); TotalSize-=11; FILLING_END(); }
//--------------------------------------------------------------------------- void File_TwinVQ::FileHeader_Parse() { //Parsing Skip_C4( "magic"); Skip_Local(8, "version"); Skip_B4( "subchunks_size"); FILLING_BEGIN(); Accept("TwinVQ"); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "TwinVQ"); Fill(Stream_Audio, 0, Audio_Codec, "TwinVQ"); FILLING_END(); }
//--------------------------------------------------------------------------- void File_Rkau::FileHeader_Parse() { //Parsing Ztring version; int32u SampleRate, source_bytes; int8u Channels, BitsPerSample, Quality, Flags; bool joint_stereo, streaming, vrq_lossy_mode; Skip_Local(3, "Signature"); Get_Local (1, version, "Version"); Get_L4 (source_bytes, "SourceBytes"); Get_L4 (SampleRate, "SampleRate"); Get_L1 (Channels, "Channels"); Get_L1 (BitsPerSample, "BitsPerSample"); Get_L1 (Quality, "Quality"); Get_L1 (Flags, "Flags"); Get_Flags (Flags, 0, joint_stereo, "JointStereo"); Get_Flags (Flags, 1, streaming, "Streaming"); Get_Flags (Flags, 2, vrq_lossy_mode, "VRQLossyMode"); FILLING_BEGIN(); if (SampleRate==0) return; Duration=(((int64u)source_bytes*1000)/4)/SampleRate; if (Duration==0) return; UncompressedSize=Channels*(BitsPerSample/8); if (UncompressedSize==0) return; //Filling data File__Tags_Helper::Accept("RKAU"); File__Tags_Helper::Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "RK Audio"); Fill(Stream_Audio, 0, Audio_Codec, "Rkau"); Fill(Stream_Audio, 0, Audio_Encoded_Library, __T("1.0") + version); Fill(Stream_Audio, 0, Audio_Compression_Mode, (Quality==0)?"Lossless":"Lossy"); Fill(Stream_Audio, 0, Audio_BitDepth, BitsPerSample); Fill(Stream_Audio, 0, Audio_Channel_s_, Channels); Fill(Stream_Audio, 0, Audio_SamplingRate, SampleRate); Fill(Stream_Audio, 0, Audio_Duration, Duration); FILLING_END(); //No more needed data File__Tags_Helper::Finish("RKAU"); }
//--------------------------------------------------------------------------- void File_Kate::Identification() { Element_Name("Identification"); //Parsing Ztring Language, Category; int16u Width, Height; int8u VersionMajor, VersionMinor, NumHeaders, TextEncoding; Skip_B1 ( "Signature"); Skip_Local(7, "Signature"); Skip_L1( "Reserved"); Get_L1 (VersionMajor, "version major"); Get_L1 (VersionMinor, "version minor"); Get_L1 (NumHeaders, "num headers"); Get_L1 (TextEncoding, "text encoding"); Skip_L1( "directionality"); Skip_L1( "Reserved"); Skip_L1( "granule shift"); Skip_L4( "Reserved"); Get_L2 (Width, "cw sh + canvas width"); Get_L2 (Height, "ch sh + canvas height"); /* BS_Begin(); Skip_BS( 4, "cw sh"); Get_BS (12, Width, "canvas width"); Skip_BS( 4, "ch sh"); Get_BS (12, Height, "canvas height"); BS_End(); */ Skip_L4( "granule rate numerator"); Skip_L4( "granule rate denominator"); Get_UTF8(16, Language, "Language"); Get_UTF8(16, Category, "Category"); FILLING_BEGIN(); Accept("Kate"); Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, Text_Format, "Kate"); Fill(Stream_Text, 0, Text_Codec, "Kate"); Fill(Stream_Text, 0, Text_Language, Language); Fill(Stream_Text, 0, Text_Language_More, Kate_Category(Category)); Finish("Kate"); FILLING_END(); }
//--------------------------------------------------------------------------- void File_Cmml::Identification() { Element_Name("Identification"); //Parsing int16u VersionMajor, VersionMinor; Skip_Local(8, "Signature"); Get_L2 (VersionMajor, "version major"); Get_L2 (VersionMinor, "version minor"); Skip_L8( "granule rate numerator"); Skip_L8( "granule rate denominator"); Skip_L1( "granule shift"); FILLING_BEGIN(); Stream_Prepare(Stream_General); Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, Text_Format, "CMML"); Fill(Stream_Text, 0, Text_Codec, "CMML"); Accept("CMML"); FILLING_END(); }
//--------------------------------------------------------------------------- void File_Celt::Identification() { Element_Name("Identification"); //Parsing Ztring celt_version; int32u Celt_version_id, sample_rate, nb_channels; Skip_Local(8, "celt_codec_id"); Get_Local(20, celt_version, "celt_version"); Get_L4 (Celt_version_id, "celt_version_id"); Skip_L4( "header_size"); Get_L4 (sample_rate, "rate"); Get_L4 (nb_channels, "nb_channels"); Skip_L4( "frame_size"); Skip_L4( "overlap"); Skip_L4( "bytes_per_packet"); Skip_L4( "extra_headers"); //Filling FILLING_BEGIN() Accept("CELT"); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "CELT"); Fill(Stream_Audio, 0, Audio_Codec, "CELT"); if (!celt_version.empty()) { //Fill(Stream_Audio, 0, Audio_Encoded_Library, celt_version); //Need more info about hte different possibilities, in the meanwhile trusting more the comment part Fill(Stream_Audio, 0, Audio_SamplingRate, sample_rate); Fill(Stream_Audio, 0, Audio_Channel_s_, nb_channels); } FILLING_END(); //Filling Identification_Done=true; }
//--------------------------------------------------------------------------- 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_Umf::Read_Buffer_Continue() { //Parsing int32u Tracks, Segments; Element_Begin1("Payload description"); Skip_L4( "Total length of the UMF data"); Skip_L4( "Version of this file"); Get_L4 (Tracks, "Number of tracks in the material"); Skip_L4( "Offset to track description section"); Skip_L4( "Size of the track description section"); Get_L4 (Segments, "Number of segments"); Skip_L4( "Offset to media description section"); Skip_L4( "Size of the media description section"); Skip_L4( "Offset to the user data section"); Skip_L4( "Size of the user data section"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); Element_End0(); Element_Begin1("Material description"); Skip_L4( "Attributes"); Skip_L4( "Maximum length of the material in fields"); Skip_L4( "Minimum length of the material in fields"); Skip_L4( "Material mark in value in fields"); Skip_L4( "Material mark out value in fields"); Skip_L4( "Time code at mark in value"); Skip_L4( "Time code at mark out value"); Skip_L4( "last modified time (Most)"); Skip_L4( "last modified time (Least)"); Skip_L4( "creation time (Most)"); Skip_L4( "creation time (Least)"); Skip_L2( "Reserved"); Skip_L2( "Reserved"); Skip_L2( "Number of audio tracks"); Skip_L2( "Number of time code tracks"); Skip_L2( "Reserved"); Skip_L2( "Number of MPEG-1, MPEG-2, and MPEG-2 HD video tracks"); Element_End0(); for (int32u Pos=0; Pos<Tracks; Pos++) { Element_Begin1("Track description"); Skip_C1( "Track information - Track type"); Skip_C1( "Track information - Track logical number"); Skip_L2( "Number of segments on this track"); Element_End0(); if (Element_Offset>=Element_Size) break; } for (int32u Pos=0; Pos<Segments; Pos++) { Element_Begin1("Media description"); int32u Type; int16u Length; Get_L2 (Length, "Length of this media description"); int64u End=Element_Offset+Length-2; Skip_C1( "Track information - Track type"); Skip_C1( "Track information - Track logical number"); Skip_L2( "Media Sequence number"); Skip_L2( "Reserved"); Skip_L4( "Number of fields in segment"); Skip_L4( "Reserved"); Skip_L4( "Mark in value for the media file in fields"); Skip_L4( "Mark out value for the media file in fields"); Skip_Local(88, "Source device media file name"); Get_L4 (Type, "Type of media track"); Skip_L4( "Sampling rates for this track"); Skip_L4( "Size of sample for audio and time codes"); Skip_L4( "Reserved"); switch (Type) { case 0x00000004 : case 0x00000007 : case 0x00000009 : //MPEG-Video { #if MEDIAINFO_SEEK || MEDIAINFO_DEMUX int32u P, B; #endif //MEDIAINFO_SEEK || MEDIAINFO_DEMUX Skip_L4( "Color difference format"); Skip_L4( "GoP structure"); Skip_L4( "Frame/field structure"); Skip_L4( "Target I-pictures per GoP"); #if MEDIAINFO_SEEK || MEDIAINFO_DEMUX Get_L4 (P, "Target P-pictures per I-picture"); Get_L4 (B, "Target B-pictures per P-picture or I-picture"); #else //MEDIAINFO_SEEK || MEDIAINFO_DEMUX Skip_L4( "Target P-pictures per I-picture"); Skip_L4( "Target B-pictures per P-picture or I-picture"); #endif //MEDIAINFO_SEEK || MEDIAINFO_DEMUX Skip_L4( "MPEG video attributes"); Skip_L4( "Reserved"); #if MEDIAINFO_SEEK || MEDIAINFO_DEMUX GopSize=(1+P)*(1+B); #endif //MEDIAINFO_SEEK || MEDIAINFO_DEMUX } break; case 0x00000003 : //TimeCode Skip_L4( "Time code attributes"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); break; case 0x00000002 : //Audio //Skip_LF8( "Level at which to play this segment"); //Skip_LF8( "Level at which to terminate this segment"); Skip_L8( "Level at which to play this segment"); Skip_L8( "Level at which to terminate this segment"); Skip_L4( "Number of fields over which to ramp up"); Skip_L4( "Number of fields over which to ramp down"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); break; case 0x00000005 : //DV25 case 0x00000006 : //DV50 Skip_L4( "Attributes"); //With Aspect ratio Skip_L4( "Reserved"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); #if MEDIAINFO_SEEK || MEDIAINFO_DEMUX GopSize=1; #endif //MEDIAINFO_SEEK || MEDIAINFO_DEMUX break; default : Skip_L4( "Reserved"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); Skip_L4( "Reserved"); } if (Element_Offset<End) Skip_XX(End-Element_Offset, "Unknown"); Element_End0(); if (Element_Offset>=Element_Size) break; } while (Element_Offset<Element_Size) { Element_Begin1("User data"); int32u Length; Get_L4 (Length, "The length of this user data record"); Skip_L4( "Position on the material time line"); Skip_L2( "Track associated with the user data record"); Skip_L2( "Media Sequence Numbe"); Skip_L4( "User-defined key"); if (Length>18) Skip_XX(Length-18, "User data"); else Skip_XX(Element_Size-Element_Offset-2, "User data"); Skip_L1( "NULL byte"); Skip_L1( "Reserved byte"); Element_End0(); } }
//--------------------------------------------------------------------------- void File_Id3::Read_Buffer_Continue() { //Buffer size if (Buffer_Size<128) return; int32u Magic; Peek_B4(Magic); Ztring TitleAddition; Ztring ArtistAddition; Ztring AlbumAddition; Ztring GenreAddition; if (Magic==0x5441472B) { if (Buffer_Size<227+128) return; Skip_C4 ( "ID"); Get_Local (60, TitleAddition, "Title"); Get_Local (60, ArtistAddition, "Artist"); Get_Local (60, AlbumAddition, "Album"); Skip_B1 ( "Speed"); Get_Local (30, GenreAddition, "Genre"); Skip_Local(6, "Start time"); //mmm:ss Skip_Local(6, "End time"); //mmm:ss TitleAddition.TrimRight(); ArtistAddition.TrimRight(); AlbumAddition.TrimRight(); GenreAddition.TrimRight(); } //Parsing Ztring Title, Artist, Album, Year, Comment; int8u Track=0, Genre; Skip_C3 ( "ID"); Get_Local (30, Title, "Title"); Get_Local (30, Artist, "Artist"); Get_Local (30, Album, "Album"); Get_Local ( 4, Year, "Year"); Get_Local (30, Comment, "Comment"); if (Comment.size()<29) //Id3v1.1 specifications : Track number addition { Element_Offset-=2; int8u Zero; Peek_B1(Zero); if (Zero==0) { Skip_B1( "Zero"); Get_B1 (Track, "Track"); } else Element_Offset+=2; } Get_B1 (Genre, "Genre"); FILLING_BEGIN(); if (TitleAddition.empty()) Title.TrimRight(); if (ArtistAddition.empty()) Artist.TrimRight(); if (AlbumAddition.empty()) Album.TrimRight(); Year.TrimRight(); Comment.TrimRight(); Accept("Id3"); Stream_Prepare(Stream_General); Fill(Stream_General, 0, General_Album, Album+AlbumAddition); Fill(Stream_General, 0, General_Track, Title+TitleAddition); Fill(Stream_General, 0, General_Performer, Artist+ArtistAddition); Fill(Stream_General, 0, General_Comment, Comment); Fill(Stream_General, 0, General_Recorded_Date, Year); if (GenreAddition.empty()) Fill(Stream_General, 0, General_Genre, GenreAddition); if (Genre && Genre!=(int8u)-1) Fill(Stream_General, 0, General_Genre, Genre); if (Track) Fill(Stream_General, 0, General_Track_Position, Track); Finish("Id3"); FILLING_END(); }
bool File_Zip::central_directory() { if (Element_Offset+46>Element_Size) //central_directory up to relative offset of local header included return false; //Not enough data //Retrieving complete local_file_header size int16u file_name_length=LittleEndian2int16u(Buffer+(size_t)Element_Offset+28); int16u extra_field_length=LittleEndian2int16u(Buffer+(size_t)Element_Offset+30); int16u file_comment_length=LittleEndian2int16u(Buffer+(size_t)Element_Offset+32); if (Element_Offset+46+file_name_length+extra_field_length+file_comment_length>Element_Size) //central_directory_structure all included return false; //Not enough data int16u general_purpose_bit_flag; bool efs; int16u version_made_by,compression_method; //Parsing Element_Begin1("Central directory"); Skip_C4("central file header signature"); Get_L2 (version_made_by,"version made by");Param_Info1((version_made_by>>8)>20?"unused":Zip_made_by[version_made_by>>8]); Skip_L2("version needed to extract"); Get_L2 (general_purpose_bit_flag,"general purpose bit flag"); Skip_Flags(general_purpose_bit_flag, 0, "encrypted file"); Skip_Flags(general_purpose_bit_flag, 1, "8K sliding dictionary"); Skip_Flags(general_purpose_bit_flag, 2, "3 Shannon-Fano trees"); Skip_Flags(general_purpose_bit_flag, 3, "data descriptor"); Skip_Flags(general_purpose_bit_flag, 4, "Reserved for use with method 8"); Skip_Flags(general_purpose_bit_flag, 4, "file is compressed patched data"); Skip_Flags(general_purpose_bit_flag, 4, "Strong encryption"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Currently unused"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Currently unused"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Currently unused"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Currently unused"); Get_Flags (general_purpose_bit_flag, 11, efs, "Language encoding flag (EFS)"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Reserved by PKWARE for enhanced compression"); //~ Skip_Flags(general_purpose_bit_flag, 4, ""); //~ Skip_Flags(general_purpose_bit_flag, 4, "Reserved by PKWARE"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Reserved by PKWARE"); Get_L2 (compression_method,"compression method"); Param_Info1C((compression_method<20), Zip_compression_method[compression_method]); Param_Info1C((compression_method==97||compression_method==98), Zip_compression_method[compression_method-97+20]); Skip_L2("last mod file time"); Skip_L2("last mod file date"); Skip_L4("crc-32"); Skip_L4("compressed size"); Skip_L4("uncompressed size"); Skip_L2("file name length"); Skip_L2("extra field length"); Skip_L2("file comment length"); Skip_L2("disk number start"); Skip_L2("internal file attributes"); Skip_L4("external file attributes"); Skip_L4("relative offset of local header"); if(efs) { Skip_UTF8(file_name_length,"file name"); Skip_UTF8(extra_field_length,"extra field"); Skip_UTF8(file_comment_length,"file comment"); } else { Skip_Local(file_name_length,"file name"); Skip_Local(extra_field_length,"extra field"); Skip_Local(file_comment_length,"file comment"); } Element_End0(); return true; }
//--------------------------------------------------------------------------- void File_Ptx::Read_Buffer_Continue() { if (File_Offset || Buffer_Offset) { if (Buffer_Size) Reject(); //Problem return; } //Parsing ZtringList Names; Ztring LibraryName, LibraryVersion, Format, Directory; int32u LibraryName_Length, LibraryVersion_Length, LibraryRelease_Length, Format_Length, Platform_Length, Info_Count, Names_Count, Info_Length, Name_Length, FileName_Count, Directory_Length; int32u Unknown_Length; int16u Audio_Count; Element_Begin1("Header"); Skip_B1( "Magic"); Skip_Local(16, "Magic"); Skip_L2( "0x0500"); Skip_L1( "Unknown"); Skip_L1( "0x5A"); Skip_L2( "0x0001"); Skip_L2( "0x0004"); Skip_L2( "0x0000"); Skip_L4( "Unknown"); Skip_L2( "0x035A"); Skip_L2( "0x6400"); Skip_L2( "0x0000"); Skip_L2( "0x0300"); Skip_L2( "0x0000"); Get_L4 (LibraryName_Length, "WritingLibrary name length"); Get_UTF8(LibraryName_Length, LibraryName, "Library name"); Skip_L4( "0x00000003"); Skip_L4( "Library version, major"); Skip_L4( "Library version, minor"); Skip_L4( "Library version, revision"); Get_L4 (LibraryVersion_Length, "Library version length"); Get_UTF8(LibraryVersion_Length, LibraryVersion, "Library version"); Skip_L1( "0x01"); Get_L4 (LibraryRelease_Length, "Library release length"); Skip_UTF8(LibraryRelease_Length, "Library release"); Skip_L1( "0x00"); Get_L4 (Format_Length, "Format length"); Get_UTF8(Format_Length, Format, "Format"); if (Format!=__T("Pro Tools Session File")) { Element_End(); Reject("Ptx"); return; } Skip_L2( "0x0006"); Get_L4 (Platform_Length, "Platform length"); Skip_UTF8(Platform_Length, "Platform"); Skip_L4( "0x00000000"); Skip_L4( "0x00085A05"); Skip_L4( "Unknown"); Skip_L4( "0x00002067"); Skip_L4( "0x002A0000"); Skip_L4( "Unknown"); Skip_L4( "Unknown"); Skip_L4( "Unknown"); Element_End(); Element_Begin1("Info list"); Get_L4 (Info_Count, "Info count"); if (4*Info_Count>Element_Size) { Element_End(); Reject(); return; } for (int32u Pos=0; Pos<Info_Count; Pos++) { Element_Begin1("Info"); Get_L4 (Info_Length, "Info length"); if (Info_Length) { Info_UTF8(Info_Length, Info, "Name"); Element_Info1(Info); } Element_End(); } Element_End(); Element_Begin1("Unknown"); Skip_L4( "0x00000000"); Element_Begin1("Names list 1"); Get_L4 (Names_Count, "Names count minus 1"); if (4*Names_Count>Element_Size) { Element_End(); Reject(); return; } for (int16u Pos=0; Pos<1+Names_Count; Pos++) { Element_Begin1("Name"); Get_L4 (Name_Length, "Name length"); if (Name_Length) { Info_UTF8(Name_Length, Name, "Name"); Element_Name(Name); } Element_End(); } Element_End(); Skip_L4( "0x00000000"); Skip_L4( "0x0000002A"); Skip_L4( "Unknown"); Skip_L4( "Unknown"); Element_Begin1("Names list 2"); Get_L4 (Names_Count, "Names count"); if (4*Names_Count>Element_Size) { Element_End(); Reject(); return; } for (int16u Pos=0; Pos<Names_Count; Pos++) { Element_Begin1("Name"); Get_L4 (Name_Length, "Name length"); if (Name_Length) { Info_UTF8(Name_Length, Name, "Name"); Element_Name(Name); } Element_End(); } Element_End(); Skip_L4( "0x00000000"); Skip_L4( "0x0000002A"); Skip_L4( "Unknown"); Skip_L4( "Unknown"); Skip_L4( "0x00000000"); Skip_L4( "Unknown"); Skip_L4( "0x00000101"); Skip_L4( "0x00055A00"); Skip_L4( "Unknown"); Skip_L4( "0x00012519"); Skip_L4( "0x00000000"); Skip_L4( "0x00000000"); Skip_L4( "0x00000001"); Skip_L2( "0x0003"); Element_End(); Get_L2 (Audio_Count, "Audio count"); if (111*Audio_Count>Element_Size) { Reject(); return; } Element_Begin1("Audio tracks list 1"); for (int16u Pos=0; Pos<Audio_Count; Pos++) { Element_Begin1("Name"); Skip_L4( "0x00000000"); Get_L4 (Unknown_Length, "Name length"); Info_UTF8(Unknown_Length, Name, "Name"); Skip_L2( "0x0000"); Skip_L4( "0x00000000"); Skip_L4( "0x0000002A"); Skip_L4( "Unknown (same 1/2/3)"); Skip_L4( "Unknown (same 1/2/3)"); Info_L1(Number, "Ordered number"); Element_Info1(Number); Element_Info1(Name); Element_End(); Names.push_back(Name); } Element_End(); Skip_L2( "0x0000"); Element_Begin1("Audio tracks list 2"); for (int16u Pos=0; Pos<Audio_Count; Pos++) { Element_Begin1("Name"); int32u Size; Skip_L3( "0x00025A"); Get_L4 (Size, "Size"); Skip_L4( "0x0000251A"); Get_L4 (Unknown_Length, "Name length"); Info_UTF8(Unknown_Length, Name, "Name"); Skip_L2( "0x0000"); Skip_L4( "0x00000000"); Skip_L4( "0x0000002A"); Skip_L4( "Unknown (same 1/2/3)"); Skip_L4( "Unknown (same 1/2/3)"); Info_L1(Number, "Ordered number"); Element_Info1(Number); Skip_L4( "0x00000000"); Element_Info1(Name); if (Unknown_Length+31!=Size) { Reject(); return; } Element_End(); } Element_End(); Get_L2 (Audio_Count, "Audio count"); if (4*Audio_Count>Element_Size) { Reject(); return; } Skip_L2( "0x00"); Element_Begin1("Audio tracks list 3"); for (int16u Pos=0; Pos<Audio_Count; Pos++) { Element_Begin1("Name"); int32u Size; Skip_L3( "0x00025A"); Get_L4 (Size, "Size"); Skip_L4( "0x0000251A"); Get_L4 (Unknown_Length, "Name length"); Info_UTF8(Unknown_Length, Name, "Name"); Skip_L2( "0x0000"); Skip_L4( "0x00000000"); Skip_L4( "0x0000002A"); Skip_L4( "Unknown (same 1/2/3)"); Skip_L4( "Unknown (same 1/2/3)"); Info_L1(Number, "Ordered number"); Element_Info1(Number); Skip_L4( "0x00000000"); Element_Info1(Name); if (Unknown_Length+31!=Size) { Reject(); return; } Element_End(); } Element_End(); Skip_L2( "0x0000"); Skip_L2( "0x0018"); Skip_L4( "0x00000001"); Skip_L2( "0x0018"); Skip_L4( "0x00000001"); Skip_L2( "0x0001"); Skip_L3( "0x00095A"); Get_L4 (Unknown_Length, "Opaque length"); Skip_XX(Unknown_Length, "Opaque"); Skip_L3( "0x00045A"); Skip_L4( "0x00000016"); Skip_L4( "0x06002026"); Skip_L4( "0x00000000"); Skip_L2( "0x0000"); Skip_L4( "Unknown"); Skip_L4( "Unknown"); Skip_L4( "0x00000000"); Skip_L3( "0x00025A"); Skip_L4( "0x00000015"); Skip_L4( "0x075A2032"); Skip_L4( "0x00000C00"); Skip_L4( "0x01204200"); Skip_L4( "0x01000000"); Skip_L4( "Unknown"); Skip_L4( "0x00025A00"); Skip_L4( "Unknown"); Skip_L4( "Unknown"); Skip_L4( "0x015A0000"); Skip_L4( "Unknown"); Skip_L4( "Unknown"); Skip_L4( "0x01000000"); Get_L4 (FileName_Count, "File name count"); if (13*FileName_Count>Element_Size) { Reject(); return; } Get_L4 (Directory_Length, "Directory length"); Get_UTF8(Directory_Length, Directory, "Directory"); Skip_L4( "0x00000000"); Element_Begin1("File names"); size_t Pos_Offset=0; for (int32u Pos=0; Pos<FileName_Count; Pos++) { Ztring Name; int32u Name_Length, Purpose; Element_Begin1("File names"); Skip_L1( "0x0002"); Skip_L4( "Ordered number except WAV files and -1"); Get_L4 (Name_Length, "Name length"); Get_UTF8(Name_Length, Name, "Name"); Element_Name(Name); Get_C4 (Purpose, "Purpose (e.g. EVAW for .wav files)"); Element_End(); switch (Purpose) { case 0x45564157: if (Pos-Pos_Offset<Names.size() && (Name.find(Names[Pos-Pos_Offset])==0 || Name.find(Names[Pos-Pos_Offset]+__T(".wav"))+5==Name.size())) { File__ReferenceFilesHelper::reference ReferenceFile; ReferenceFile.StreamKind=Stream_Audio; ReferenceFile.FileNames.push_back(Directory+PathSeparator+Name); ReferenceFiles->References.push_back(ReferenceFile); } else if (ReferenceFiles->References.empty()) Pos_Offset++; default: ; } } Element_End(); Skip_XX(Element_Size-Element_Offset, "Unknown"); FILLING_BEGIN(); Accept("Ptx"); //Could be Ptf (former formatn but not supported, so we don't care currently Fill("Ptx"); Fill(Stream_General, 0, General_Format, "Pro Tools Session"); Fill(Stream_General, 0, General_Format_Version, "Version 10"); Fill(Stream_General, 0, General_Encoded_Library_Name, LibraryName); Fill(Stream_General, 0, General_Encoded_Library_Version, LibraryVersion); FILLING_END(); }
//--------------------------------------------------------------------------- void File_Iso9660::Primary_Volume_Descriptor() { int32u Volume_Space_Size; Element_Begin1("Volume_Descriptor"); Skip_B1("Volume Descriptor Type"); Skip_Local(5,"Standard Identifier"); Skip_B1("Volume Descriptor Version"); Skip_B1("Unused field"); Skip_Local(32,"System Identifier"); Skip_Local(32,"Volume Identifier"); Skip_XX(8,"Unused field"); Get_D4(Volume_Space_Size, "Volume Space Size"); Param_Info2(Volume_Space_Size*(int64u)2048, " bytes"); Skip_XX(32,"Unused field"); Skip_B4("Volume Set Size"); Skip_B4("Volume Sequence Number"); Skip_B4("Logical Block Size"); Skip_B8("Path Table Size"); Skip_B4("Location of Occurrence of Type L Path Table"); Skip_B4("Location of Optional Occurrence of Type L Path Table"); Skip_B4("Location of Occurrence of Type M Path Table"); Skip_B4("Location of Optional Occurrence of Type M Path Table"); Skip_Local(34,"Directory Record for Root Directory"); Skip_Local(128,"Volume Set Identifier"); Skip_Local(128,"Publisher Identifier"); Skip_Local(128,"Data Preparer Identifier"); Skip_Local(128,"Application Identifier"); Skip_Local(37,"Copyright File Identifier"); Skip_Local(37,"Abstract File Identifier"); Skip_Local(37,"Bibliographic File Identifier"); Skip_XX(17,"Volume Creation Date and Time"); Element_End0(); }
//--------------------------------------------------------------------------- void File_Ptx::Read_Buffer_Continue() { if (File_Offset || Buffer_Offset) { if (Buffer_Size) Reject(); //Problem return; } //Parsing ZtringList Names; Ztring LibraryName, LibraryVersion, Format, Directory; int32u LibraryName_Length, LibraryVersion_Length, LibraryRelease_Length, Format_Length, Platform_Length, Info_Count, Names_Count, Info_Length, Name_Length, FileName_Count, Directory_Length; int32u Opaque2_Length, Audio_Count; int16u Opaque1_Length; Element_Begin1("Header"); Skip_B1( "Magic"); Skip_Local(16, "Magic"); Skip_L2( "0x0500"); Skip_L1( "Unknown [1]"); Skip_L1( "0x5A [1]"); Skip_L2( "0x0001"); Skip_L2( "0x0004"); Skip_L2( "0x0000 [1]"); Skip_L4( "Unknown [2]"); Skip_L2( "0x035A"); Skip_L2( "0x6400"); Skip_L2( "0x0000 [1]"); Skip_L2( "0x0300"); Skip_L2( "0x0000 [1]"); Get_L4 (LibraryName_Length, "WritingLibrary name length"); Get_UTF8(LibraryName_Length, LibraryName, "Library name"); Skip_L4( "0x00000003"); Skip_L4( "Library version, major"); Skip_L4( "Library version, minor"); Skip_L4( "Library version, revision"); Get_L4 (LibraryVersion_Length, "Library version length"); Get_UTF8(LibraryVersion_Length, LibraryVersion, "Library version"); Skip_L1( "0x01"); Get_L4 (LibraryRelease_Length, "Library release length"); Skip_UTF8(LibraryRelease_Length, "Library release"); Skip_L1( "0x00 [1]"); Get_L4 (Format_Length, "Format length"); Get_UTF8(Format_Length, Format, "Format"); if (Format!=__T("Pro Tools Session File")) { Element_End(); Reject(); return; } Skip_L2( "0x0006"); Get_L4 (Platform_Length, "Platform length"); Skip_UTF8(Platform_Length, "Platform"); Skip_L4( "0x00000000"); Skip_L2( "0x5A05"); Get_L2 (Opaque1_Length, "Info list, Opaque length"); //0x0006 (10.2-) or 0x0008 (10.3+) Skip_L4( "Unknown [3]"); Skip_L4( "0x00002067"); Skip_L2( "0x0000 [1]"); Skip_L2( "0x0000 (once) or 0x002A"); Skip_L2( "0x0000 [1]"); Skip_L2( "Unknown [4]"); Skip_L4( "Unknown [5]"); Skip_L4( "Unknown [6]"); Element_End(); Element_Begin1("Info list"); Get_L4 (Info_Count, "Info count"); if (4*Info_Count>Element_Size) { Element_End(); Reject(); return; } for (int32u Pos=0; Pos<Info_Count; Pos++) { Element_Begin1("Info"); Get_L4 (Info_Length, "Info length"); if (Info_Length) { Info_UTF8(Info_Length, Info, "Name"); Element_Info1(Info); } Element_End(); } Element_End(); Element_Begin1("Unknown"); Skip_L4( "0x00000000"); Element_Begin1("Names list 1"); Get_L4 (Names_Count, "Names count minus 1"); if (4*Names_Count>Element_Size) { Element_End(); Reject(); return; } for (int16u Pos=0; Pos<1+Names_Count; Pos++) { Element_Begin1("Name"); Get_L4 (Name_Length, "Name length"); if (Name_Length) { Info_UTF8(Name_Length, Name, "Name"); Element_Name(Name); } Element_End(); } Element_End(); Skip_L4( "0x00000000"); Skip_L4( "0x00000000 or 0x0000002A"); Skip_L4( "Unknown [7]"); Skip_L4( "Unknown [8]"); Element_Begin1("Names list 2"); Get_L4 (Names_Count, "Names count"); if (4*Names_Count>Element_Size) { Element_End(); Reject(); return; } for (int16u Pos=0; Pos<Names_Count; Pos++) { Element_Begin1("Name"); Get_L4 (Name_Length, "Name length"); if (Name_Length) { Info_UTF8(Name_Length, Name, "Name"); Element_Name(Name); } Element_End(); } Element_End(); Skip_L4( "0x00000000"); Skip_L4( "0x0000002A [1]"); Skip_L4( "Unknown [9]"); Skip_L4( "Unknown [10]"); Skip_L4( "0x00000000"); Skip_L1( "0x00 or 0x01 [2]"); Skip_L1( "0x01"); Skip_L1( "0x00 or 0x01 or 0x02"); Skip_L1( "0x00 [2]"); Skip_L1( "0x01"); Skip_L1( "0x00 (once) or 0x01"); Skip_L1( "0x00 or 0x01 (once)"); Skip_L1( "0x00 or 0x01 (once) or 0x5A"); if (Opaque1_Length<6) { if (Opaque1_Length) Skip_XX(Opaque1_Length, "Opaque1"); } else { Skip_L4( "Opaque1 - Unknown [1]"); Skip_L2( "Opaque1 - Unknown [2]"); if (Opaque1_Length<8) { if (Opaque1_Length-6) Skip_XX(Opaque1_Length-6, "Opaque1 - Unknown [3]"); } else { Skip_L2( "Opaque1 - 0x0000"); if (Opaque1_Length>8) Skip_XX(Opaque1_Length-8, "Opaque1 - Unknown [3]"); } } Skip_L2( "0x2519"); Skip_L2( "0x0001"); Skip_L4( "0x00000000 or B5112287"); Skip_L4( "0x00000000 or 4037F9DC"); Skip_L4( "0x00000001 [1]"); Skip_L2( "0x0003"); Element_End(); Get_L4 (Audio_Count, "Audio count"); if (111*Audio_Count>Element_Size) { Reject(); return; } Element_Begin1("Audio tracks list 1"); for (int16u Pos=0; Pos<Audio_Count; Pos++) { Element_Begin1("Name"); Skip_L2( "0x0000 [New]"); Get_L4 (Name_Length, "(Same 1/2/3) Name length"); Info_UTF8(Name_Length, Name, "(Same 1/2/3) Name"); Skip_L2( "(Same 1/2/3) 0x0000 "); Skip_L4( "(Same 1/2/3) 0x00000000"); Skip_L4( "(Same 1/2/3) 0x0000002A"); Skip_L4( "(Same 1/2/3) Unknown"); Skip_L4( "(Same 1/2/3) Unknown"); Info_L3(Number, "(Same 1/2/3) Ordered number"); Element_Info1(Number); Element_Info1(Name); Element_End(); if (Name==__T("Lf")) //Exception? Typo? Name=__T("Lfe"); Name.MakeLowerCase(); Names.push_back(Name); } Element_End(); Element_Begin1("Audio tracks list 2"); for (int16u Pos=0; Pos<Audio_Count; Pos++) { Element_Begin1("Name"); int32u Size; Skip_L3( "(Same 2/3) 0x00025A [1]"); Get_L4 (Size, "(Same 2/3) Size"); Skip_L4( "(Same 2/3) 0x0000251A"); Get_L4 (Name_Length, "(Same 1/2/3) Name length"); Info_UTF8(Name_Length, Name, "(Same 1/2/3) Name"); Skip_L2( "(Same 1/2/3) 0x0000 "); Skip_L4( "(Same 1/2/3) 0x00000000"); Skip_L4( "(Same 1/2/3) 0x0000002A"); Skip_L4( "(Same 1/2/3) Unknown"); Skip_L4( "(Same 1/2/3) Unknown"); Info_L3(Number, "(Same 1/2/3) Ordered number"); Element_Info1(Number); Skip_L2( "(Same 2/3) 0x0000"); Element_Info1(Name); if (Name_Length+31!=Size) { Element_End(); Element_End(); Reject(); return; } Element_End(); } Element_End(); Get_L4 (Audio_Count, "Audio count"); if (4*Audio_Count>Element_Size) { Reject(); return; } Element_Begin1("Audio tracks list 3"); for (int16u Pos=0; Pos<Audio_Count; Pos++) { Element_Begin1("Name"); int32u Size; Skip_L3( "(Same 2/3) 0x00025A [2]"); Get_L4 (Size, "(Same 2/3) Size"); if (Size>0x10000) { Element_End(); Element_End(); Reject(); return; } Skip_L4( "(Same 2/3) 0x0000251A"); Get_L4 (Name_Length, "(Same 1/2/3) Name length"); Info_UTF8(Name_Length, Name, "(Same 1/2/3) Name"); Skip_L2( "(Same 1/2/3) 0x0000 "); Skip_L4( "(Same 1/2/3) 0x00000000"); Skip_L4( "(Same 1/2/3) 0x0000002A"); Skip_L4( "(Same 1/2/3) Unknown"); Skip_L4( "(Same 1/2/3) Unknown"); Info_L3(Number, "(Same 1/2/3) Ordered number"); Element_Info1(Number); Skip_L2( "(Same 2/3) 0x0000"); Element_Info1(Name); if (Name_Length+31!=Size) { Element_End(); Element_End(); Reject(); return; } Element_End(); } Element_End(); Skip_L2( "0x0000 [4]"); Skip_L2( "0x0018"); Skip_L4( "0x00000001 [2]"); Skip_L2( "0x0018"); Skip_L4( "0x00000001 [2]"); Skip_L2( "0x0001 [3]"); Skip_L3( "0x00095A"); Get_L4 (Opaque2_Length, "Opaque2 length"); Skip_XX(Opaque2_Length, "Opaque2"); Skip_L1( "0x5A [2]"); Skip_L2( "0x0003 (10.0) or 0x0004 (10.2+)"); Get_L4 (Opaque2_Length, "Opaque3 length"); //0x0012 (10.0) or 0x0016 (10.2+) if (Opaque2_Length<0x12) Skip_XX(Opaque2_Length, "Opaque3"); else { Skip_L4( "Opaque3 - 0x06002026"); Skip_L4( "Opaque3 - 0x00000000 [1]"); Skip_L2( "Opaque3 - 0x0000"); Skip_L4( "Opaque3 - Unknown [1]"); Skip_L4( "Opaque3 - Unknown [2]"); if (Opaque2_Length<0x16) { if (Opaque2_Length-0x12) Skip_XX(Opaque2_Length-0x12, "Opaque3 - Unknown [3]"); } else { Skip_L4( "Opaque3 - 0x00000000 [2]"); if (Opaque2_Length>0x16) Skip_XX(Opaque2_Length-0x16, "Opaque3 - Unknown [4]"); } } Skip_L3( "0x00025A [3]"); Get_L4 (Opaque2_Length, "0x00000015 (Opaque4 length?) or something else"); if (Opaque2_Length==0x00000015) { Skip_L4( "0x075A2032"); Skip_L4( "0x00000C00"); Skip_L4( "0x01204200"); Skip_L4( "0x00000000 or 0x01000000"); Skip_L4( "Unknown [13]"); Skip_L1( "0x00 [3]"); Skip_L3( "0x00025A [4]"); Skip_L4( "Unknown [14]"); } Skip_L4( "Unknown [15]"); Skip_L4( "0x015A0000"); Skip_L4( "Unknown [16]"); Skip_L4( "Unknown [17]"); Skip_L4( "0x01000000"); Get_L4 (FileName_Count, "File name count"); if (13*FileName_Count>Element_Size) { Reject(); return; } Get_L4 (Directory_Length, "Directory length"); Get_UTF8(Directory_Length, Directory, "Directory"); Skip_L4( "0x00000000 [11]"); Element_Begin1("File names"); vector<int8u> Roles; vector<Ztring> FileNames; vector<Ztring> FileNamesLowerCase; vector<int32u> Purposes; for (int32u Pos=0; Pos<FileName_Count; Pos++) { Ztring FileName; int32u FileName_Length, Purpose; int8u Role; // Element_Begin1("File names"); Get_L1 (Role, "role? (0x02 for WAV files)"); Skip_L4( "Ordered number except WAV files and -1"); Get_L4 (FileName_Length, "File Name length"); Get_UTF8(FileName_Length, FileName, "File Name"); Element_Name(FileName); Get_C4 (Purpose, "Purpose (e.g. EVAW for .wav files)"); //Found 1 .wav file without "EWAV". Element_End(); Roles.push_back(Role); FileNames.push_back(FileName); FileName.MakeLowerCase(); FileNamesLowerCase.push_back(FileName); Purposes.push_back(Purpose); } Element_End(); Skip_XX(Element_Size-Element_Offset, "Unknown"); FILLING_BEGIN(); Accept("Ptx"); //Could be Ptf (former format but not supported, so we don't care currently) Fill("Ptx"); Fill(Stream_General, 0, General_Format, "Pro Tools Session"); Fill(Stream_General, 0, General_Format_Version, "Version 10"); Fill(Stream_General, 0, General_Encoded_Library_Name, LibraryName); Fill(Stream_General, 0, General_Encoded_Library_Version, LibraryVersion); // Role==2 + Purpose==EWAV + listed if (Names.size()>1 || FileNames.size()==1) { size_t Pos_Offset=0; for (int32u Pos=0; Pos<FileName_Count; Pos++) { if (Roles[Pos]==0x02 && Purposes[Pos]==0x45564157 //"EWAV" && Pos-Pos_Offset<Names.size() && FileNames[Pos]!=__T("1 kHz @ -20dB.wav") //Exception? && FileNames[Pos]!=__T("*****@*****.**") //Exception? && FileNames[Pos]!=__T("*****@*****.**") //Exception? && FileNames[Pos]!=__T("1k@0vu -20.wav") //Exception? && FileNames[Pos]!=__T("*****@*****.**") //Exception? && FileNames[Pos].find(__T(".1Khz.wav"))==string::npos //Exception? && FileNames[Pos].find(__T("_1KTONE_"))==string::npos //Exception? && FileNamesLowerCase[Pos].find(Names[Pos-Pos_Offset]+__T(".wav"))!=string::npos && FileNamesLowerCase[Pos].find(Names[Pos-Pos_Offset]+__T(".wav"))+Names[Pos-Pos_Offset].size()+4==FileNames[Pos].size()) { sequence* Sequence=new sequence; Sequence->StreamKind=Stream_Audio; Sequence->AddFileName(Directory+PathSeparator+FileNames[Pos]); ReferenceFiles->AddSequence(Sequence); } else if (!ReferenceFiles->Sequences_Size()) Pos_Offset++; } if (Names.size()!=ReferenceFiles->Sequences_Size()) ReferenceFiles->Clear(); //Failed to detect correctly } // Role==2 + listed if (!ReferenceFiles->Sequences_Size() && (Names.size()>1 || FileNames.size()==1)) { size_t Pos_Offset=0; for (int32u Pos=0; Pos<FileName_Count; Pos++) { if (Roles[Pos]==0x02 && Pos-Pos_Offset<Names.size() && FileNames[Pos]!=__T("1 kHz @ -20dB.wav") //Exception? && FileNames[Pos]!=__T("*****@*****.**") //Exception? && FileNames[Pos]!=__T("*****@*****.**") //Exception? && FileNames[Pos]!=__T("1k@0vu -20.wav") //Exception? && FileNames[Pos]!=__T("*****@*****.**") //Exception? && FileNames[Pos].find(__T(".1Khz.wav"))==string::npos //Exception? && FileNames[Pos].find(__T("_1KTONE_"))==string::npos) //Exception? { Ztring FileName=FileNames[Pos]; Ztring Name=Names[Pos-Pos_Offset]; FileName.MakeLowerCase(); Name.MakeLowerCase(); if (FileName.find(Name)==0 || FileName.find(Name+__T(".wav"))+5==Name.size()) { sequence* Sequence=new sequence; Sequence->StreamKind=Stream_Audio; Sequence->AddFileName(Directory+PathSeparator+FileNames[Pos]); ReferenceFiles->AddSequence(Sequence); } else if (!ReferenceFiles->Sequences_Size()) Pos_Offset++; } else if (!ReferenceFiles->Sequences_Size()) Pos_Offset++; } if (Names.size()!=ReferenceFiles->Sequences_Size()) ReferenceFiles->Clear(); //Failed to detect correctly } // Role==2 + Purpose==EWAV + listed, special case with specific file names if (!ReferenceFiles->Sequences_Size() && (Names.size()>1 || FileNames.size()==1)) { for (int32u Pos=0; Pos<FileName_Count; Pos++) { if (Roles[Pos]==0x02 && Purposes[Pos]==0x45564157 //"EWAV" && FileNames[Pos]!=__T("1 kHz @ -20dB.wav") //Exception? && FileNames[Pos]!=__T("*****@*****.**") //Exception? && FileNames[Pos]!=__T("*****@*****.**") //Exception? && FileNames[Pos]!=__T("1k@0vu -20.wav") //Exception? && FileNames[Pos]!=__T("*****@*****.**") //Exception? && FileNames[Pos].find(__T(".1Khz.wav"))==string::npos //Exception? && FileNames[Pos].find(__T("_1KTONE_"))==string::npos) //Exception? { for (int32u Pos2=0; Pos2<Names.size(); Pos2++) if (FileNamesLowerCase[Pos].find(Names[Pos2])==0) { sequence* Sequence=new sequence; Sequence->StreamKind=Stream_Audio; Sequence->AddFileName(Directory+PathSeparator+FileNames[Pos]); ReferenceFiles->AddSequence(Sequence); break; } } } } // Role==2 + Purpose==EWAV if (!ReferenceFiles->Sequences_Size()) { for (int32u Pos=0; Pos<FileName_Count; Pos++) { if (Roles[Pos]==0x02 && Purposes[Pos]==0x45564157 //"EWAV" && FileNames[Pos]!=__T("1 kHz @ -20dB.wav") //Exception? && FileNames[Pos]!=__T("*****@*****.**") //Exception? && FileNames[Pos]!=__T("*****@*****.**") //Exception? && FileNames[Pos]!=__T("1k@0vu -20.wav") //Exception? && FileNames[Pos]!=__T("*****@*****.**") //Exception? && FileNames[Pos].find(__T(".1Khz.wav"))==string::npos //Exception? && FileNames[Pos].find(__T("_1KTONE_"))==string::npos) //Exception? { sequence* Sequence=new sequence; Sequence->StreamKind=Stream_Audio; Sequence->AddFileName(Directory+PathSeparator+FileNames[Pos]); ReferenceFiles->AddSequence(Sequence); } } } // Role==2 if (!ReferenceFiles->Sequences_Size()) { for (int32u Pos=0; Pos<FileName_Count; Pos++) { if (Roles[Pos]==0x02 && FileNames[Pos]!=__T("1 kHz @ -20dB.wav") //Exception? && FileNames[Pos]!=__T("*****@*****.**") //Exception? && FileNames[Pos]!=__T("*****@*****.**") //Exception? && FileNames[Pos]!=__T("1k@0vu -20.wav") //Exception? && FileNames[Pos]!=__T("*****@*****.**") //Exception? && FileNames[Pos].find(__T(".1Khz.wav"))==string::npos //Exception? && FileNames[Pos].find(__T("_1KTONE_"))==string::npos) //Exception? { sequence* Sequence=new sequence; Sequence->StreamKind=Stream_Audio; Sequence->AddFileName(Directory+PathSeparator+FileNames[Pos]); ReferenceFiles->AddSequence(Sequence); } } } FILLING_END(); }