Example #1
0
bool File_Zip::Zip64_end_of_central_directory_record()
{
    if (Element_Offset+12>Element_Size) //Zip64_end_of_central_directory_record
        return false; //Not enough data

    //Retrieving complete Zip64_end_of_central_directory_record size
    int64u size_of_Zip64_end_of_central_directory_record=LittleEndian2int64u(Buffer+(size_t)Element_Offset+4);
    if (Element_Offset+12+size_of_Zip64_end_of_central_directory_record>Element_Size) //end_of_central_directory all included
        return false; //Not enough data

    //Parsing
    //~ int32u offset;
    int16u version_made_by;
    Element_Begin1("Zip64 End of central directory record");
    Skip_C4(                                                    "Zip64 end of central dir signature");
    Skip_L8(                                                    "size of zip64 end of central directory record");
    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");
    Skip_L4(                                                    "number of this disk");
    Skip_L4(                                                    "number of the disk");// with the start of the central directory
    Skip_L8(                                                    "total number of entries on this disk");// in the central directory
    Skip_L8(                                                    "total number of entries");// in the central directory
    Skip_L8(                                                    "size of the central directory");
    Skip_L8(                                                    "offset of start of central directory"); //  with respect to the starting disk number
    Skip_XX(size_of_Zip64_end_of_central_directory_record-44,   "zip64 extensible data sector");
    Element_End0();
    
    return true;
}
Example #2
0
//---------------------------------------------------------------------------
// 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?
}
Example #3
0
//---------------------------------------------------------------------------
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();
}
Example #4
0
bool File_Zip::Zip64_end_of_central_directory_locator()
{
    if (Element_Offset+20>Element_Size) //Zip64_end_of_central_directory_locator
        return false; //Not enough data
        
    //Parsing
    Element_Begin1("Zip64 end of central directory locator");
    Skip_C4("zip64 end of central dir locator signature");
    Skip_L4("number of the disk");// with the start of the zip64 end of central directory
    Skip_L8("relative offset of the zip64 end of central directory record");
    Skip_L4("total number of disks");
    Element_End0();

    return true;
}
//---------------------------------------------------------------------------
void File_ApeTag::HeaderFooter()
{
    //Parsing
    int32u Flags;
    Skip_C8(                                                    "Preamble");
    Skip_L4(                                                    "Version");
    Skip_L4(                                                    "Size");
    Skip_L4(                                                    "Count");
    Get_L4 (Flags,                                              "Flags");
        Skip_Flags(Flags,  0,                                   "Read Only");
        Skip_Flags(Flags,  1,                                   "Binary");
        Skip_Flags(Flags,  2,                                   "Locator of external stored information");
        Skip_Flags(Flags, 29,                                   "Is the header");
        Skip_Flags(Flags, 30,                                   "Contains a footer");
        Skip_Flags(Flags, 31,                                   "Contains a header");
    Skip_L8(                                                    "Reserved");
}
Example #6
0
//---------------------------------------------------------------------------
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();
    }
}