Esempio n. 1
0
//---------------------------------------------------------------------------
void File_Jpeg::APP0_AVI1()
{
    //Parsing
    int8u  FieldOrder=(int8u)-1;
    Element_Begin1("AVI1");
        if (Element_Size==16-4)
        {
            Get_B1 (FieldOrder,                                     "Field Order");
            Skip_XX(7,                                              "Zeroes");
        }
        if (Element_Size==18-4)
        {
            Get_B1 (FieldOrder,                                     "Field Order");
            Skip_B1(                                                "Zero");
            Skip_B4(                                                "Size of 1st Field");
            Skip_B4(                                                "Size of 2nd Field");
        }
    Element_End0();

    FILLING_BEGIN();
        if (Frame_Count==0 && Field_Count==0)
        {
            switch (FieldOrder)
            {
                case 0x00 : Fill(Stream_Video, 0, Video_Interlacement, "PPF"); Fill(Stream_Video, 0, Video_ScanType, "Progressive"); break;
                case 0x01 : Fill(Stream_Video, 0, Video_Interlacement, "TFF"); Fill(Stream_Video, 0, Video_ScanType, "Interlaced"); Fill(Stream_Video, 0, Video_ScanOrder, "TFF"); Height_Multiplier=2; break;
                case 0x02 : Fill(Stream_Video, 0, Video_Interlacement, "BFF"); Fill(Stream_Video, 0, Video_ScanType, "Interlaced"); Fill(Stream_Video, 0, Video_ScanOrder, "BFF"); Height_Multiplier=2; break;
                default   : ;
            }
        }
    FILLING_END();
}
Esempio n. 2
0
//---------------------------------------------------------------------------
void File_Dpx::GenericSectionHeader_Dpx_ImageElement()
{
    Element_Begin1("image element");
    int8u Descriptor, TransferCharacteristic, ColorimetricSpecification, BitDephs;
    Info_B4(DataSign,                                           "Data sign");Param_Info1((DataSign==0?"unsigned":"signed"));
    Skip_B4(                                                    "Reference low data code value");
    Skip_BF4(                                                   "Reference low quantity represented");
    Skip_B4(                                                    "Reference high data code value");
    Skip_BF4(                                                   "Reference high quantity represented");
    Get_B1 (Descriptor,                                         "Descriptor");Param_Info1(DPX_Descriptors(Descriptor));
    Get_B1 (TransferCharacteristic,                             "Transfer characteristic");Param_Info1(DPX_TransferCharacteristic(TransferCharacteristic));
    Get_B1 (ColorimetricSpecification,                          "Colorimetric specification");Param_Info1(DPX_ColorimetricSpecification(ColorimetricSpecification));
    Get_B1 (BitDephs,                                           "Bit depth");Param_Info1(DPX_ValidBitDephs(BitDephs));
    Info_B2(ComponentDataPackingMethod,                         "Packing");Param_Info1((ComponentDataPackingMethod<8?DPX_ComponentDataPackingMethod[ComponentDataPackingMethod]:"invalid"));
    Info_B2(ComponentDataEncodingMethod,                        "Encoding");Param_Info1((ComponentDataEncodingMethod<8?DPX_ComponentDataEncodingMethod[ComponentDataEncodingMethod]:"invalid"));
    Skip_B4(                                                    "Offset to data");
    Skip_B4(                                                    "End-of-line padding");
    Skip_B4(                                                    "End-of-image padding");
    Skip_UTF8(32,                                               "Description of image element");
    Element_End0();

    FILLING_BEGIN();
        if (Frame_Count==0)
        {
            Fill(StreamKind_Last, StreamPos_Last, "ColorSpace", DPX_Descriptors_ColorSpace(Descriptor));
            Fill(StreamKind_Last, StreamPos_Last, "ChromaSubsampling", DPX_Descriptors_ChromaSubsampling(Descriptor));
            Fill(StreamKind_Last, StreamPos_Last, "BitDepth", BitDephs);
            Fill(StreamKind_Last, StreamPos_Last, "colour_description_present", "Yes");
            Fill(StreamKind_Last, StreamPos_Last, "colour_primaries", DPX_TransferCharacteristic(TransferCharacteristic));
            Fill(StreamKind_Last, StreamPos_Last, "transfer_characteristics", DPX_ColorimetricSpecification(ColorimetricSpecification));
        }
    FILLING_END();
}
Esempio n. 3
0
//---------------------------------------------------------------------------
void File_Flac::PICTURE()
{
    //Parsing
    int32u PictureType, MimeType_Size, Description_Size, Data_Size;
    Ztring MimeType, Description;
    Get_B4 (PictureType,                                        "Picture type"); Element_Info1(Id3v2_PictureType((int8u)PictureType));
    Get_B4 (MimeType_Size,                                      "MIME type size");
    Get_Local(MimeType_Size, MimeType,                          "MIME type");
    Get_B4 (Description_Size,                                   "Description size");
    Get_UTF8(Description_Size, Description,                     "Description");
    Skip_B4(                                                    "Width");
    Skip_B4(                                                    "Height");
    Skip_B4(                                                    "Color depth");
    Skip_B4(                                                    "Number of colors used");
    Get_B4 (Data_Size,                                          "Data size");
    if (Element_Offset+Data_Size>Element_Size)
        return; //There is a problem
    std::string Data_Raw((const char*)(Buffer+(size_t)(Buffer_Offset+Element_Offset)), Data_Size);
    std::string Data_Base64(Base64::encode(Data_Raw));
    Skip_XX(Element_Size-Element_Offset, "Data");

    //Filling
    Fill(Stream_General, 0, General_Cover, "Yes");
    Fill(Stream_General, 0, General_Cover_Description, Description);
    Fill(Stream_General, 0, General_Cover_Type, Id3v2_PictureType((int8u)PictureType));
    Fill(Stream_General, 0, General_Cover_Mime, MimeType);
    Fill(Stream_General, 0, General_Cover_Data, Data_Base64);
}
Esempio n. 4
0
//---------------------------------------------------------------------------
void File_Png::Signature()
{
    //Parsing
    Skip_B4(                                                    "Signature");
    Skip_B4(                                                    "ByteOrder");

    Frame_Count++;
    if (Frame_Count_NotParsedIncluded!=(int64u)-1)
        Frame_Count_NotParsedIncluded++;
    Signature_Parsed=true;
}
Esempio n. 5
0
//---------------------------------------------------------------------------
void File_Cdxa::Header_Parse()
{
    //Parsing
    Skip_B4(                                                    "Sync1");
    Skip_B4(                                                    "Sync2");
    Skip_B4(                                                    "Sync3");
    Skip_B4(                                                    "Header");
    Skip_B8(                                                    "SubHeader");

    //Filling
    Header_Fill_Size(2352);
    Header_Fill_Code(0, "Chunk");
}
Esempio n. 6
0
//---------------------------------------------------------------------------
void File_Dpx::IndustrySpecificHeader_Dpx()
{
    Element_Name("Industry specific header");

    //Parsing
    float32 FrameRate;
    Element_Begin1("Motion-picture film information");
    Skip_String(2,                                              "Film mfg. ID code");
    Skip_String(2,                                              "Film type");
    Skip_String(2,                                              "Offset in perfs");
    Skip_String(6,                                              "Prefix");
    Skip_String(4,                                              "Count");
    Skip_String(32,                                             "Format - e.g. Academy");
    Skip_B4(                                                    "Frame position in sequence");
    Skip_B4(                                                    "Sequence length (frames)");
    Skip_B4(                                                    "Held count (1 = default)");
    Get_BF4 (FrameRate,                                         "Frame rate of original (frames/s)");
    Skip_BF4(                                                   "Shutter angle of camera in degrees");
    Skip_UTF8(32,                                               "Frame identification - e.g. keyframe");
    Skip_UTF8(100,                                              "Slate information");
    Skip_XX(56,                                                 "Reserved for future use");
    Element_End0();

    Element_Begin1("Television information");
    Skip_B4(                                                    "SMPTE time code");
    Skip_B4(                                                    "SMPTE user bits");
    Info_B1(Interlace,                                          "Interlace");Param_Info1((Interlace==0?"noninterlaced":"2:1 interlace"));
    Skip_B1(                                                    "Field number");
    Info_B1(VideoSignalStandard,                                "Video signal standard");Param_Info1(DPX_VideoSignalStandard(VideoSignalStandard));
    Skip_B1(                                                    "Zero");
    Skip_BF4(                                                   "Horizontal sampling rate (Hz)");
    Skip_BF4(                                                   "Vertical sampling rate (Hz)");
    Skip_BF4(                                                   "Temporal sampling rate or frame rate (Hz)");
    Skip_BF4(                                                   "Time offset from sync to first pixel (ms)");
    Skip_BF4(                                                   "Gamma");
    Skip_BF4(                                                   "Black level code value");
    Skip_BF4(                                                   "Black gain");
    Skip_BF4(                                                   "Breakpoint");
    Skip_BF4(                                                   "Reference white level code value");
    Skip_BF4(                                                   "Integration time (s)");
    Skip_XX(76,                                                 "Reserved for future use");
    Element_End0();

    FILLING_BEGIN();
        if (FrameRate)
            Fill(StreamKind_Last, StreamPos_Last, "FrameRate", FrameRate);
    FILLING_END();
}
Esempio n. 7
0
//---------------------------------------------------------------------------
void File_Nut::Data_Parse()
{
    #define ELEMENT_CASE(_NAME) \
        case Elements::_NAME : _NAME(); break;

    //Parsing
    if (Element_Size < 4)
    {
        Skip_XX(Element_Size,                                   "Unknown");
        return;
    }
    Element_Size-=4;
    #ifndef __BORLANDC__
        switch (Element_Code)
    #else //__BORLANDC__
        switch (Element_Code&0xFFFFFFFF) //Borland does not like int64u for const?
    #endif //__BORLANDC__
    {
        ELEMENT_CASE(main);
        ELEMENT_CASE(stream);
        ELEMENT_CASE(syncpoint);
        ELEMENT_CASE(index);
        ELEMENT_CASE(info);
        default : Skip_XX(Element_Size,                         "Data");
    }

    Element_Size+=4;
    if (Element_Offset+4!=Element_Size)
        Skip_XX(Element_Size - 4 - Element_Offset,              "Unknown");
    Skip_B4(                                                    "cheksum");
}
Esempio n. 8
0
//---------------------------------------------------------------------------
void File_Png::Data_Parse()
{
    if (!Signature_Parsed)
    {
        Signature();
        return;
    }

    Element_Size-=4; //For CRC

    #define CASE_INFO(_NAME, _DETAIL) \
        case Elements::_NAME : Element_Info1(_DETAIL); _NAME(); break;

    //Parsing
    switch (Element_Code)
    {
        CASE_INFO(IDAT,                                         "Image data");
        CASE_INFO(IEND,                                         "Image trailer");
        CASE_INFO(IHDR,                                         "Image header");
        CASE_INFO(PLTE,                                         "Palette table");
        default : Skip_XX(Element_Size,                         "Unknown");
    }

    Element_Size+=4; //For CRC
    Skip_B4(                                                    "CRC");
}
Esempio n. 9
0
//---------------------------------------------------------------------------
void File_Nut::Header_Parse()
{
    //Parsing
    int8u  N;
    Peek_B1(N);
    if (N==0x4E) //'N'
    {
        //Header
        int64u startcode, forward_ptr;
        Get_B8(startcode,                                       "startcode");
        Get_VS(forward_ptr,                                     "forward_ptr");
        if (forward_ptr>4096)
            Skip_B4(                                            "header_checksum");

        Header_Fill_Code(startcode, Ztring().From_Number(startcode, 16)); //Quick filling for CC8 with text
        Header_Fill_Size(Element_Offset+forward_ptr); //4 for cheksum

    }
    else
    {
        //Frame
        Header_Fill_Code(0, "Frame");
        Header_Fill_Size(0);
        Finish();
    }
}
Esempio n. 10
0
//---------------------------------------------------------------------------
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();
}
Esempio n. 11
0
//---------------------------------------------------------------------------
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();
}
Esempio n. 12
0
//---------------------------------------------------------------------------
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");
}
Esempio n. 13
0
//---------------------------------------------------------------------------
void File_Dpx::IndustrySpecificHeader_Cineon()
{
    Element_Name("Motion picture industry specific header");

    //Parsing
    Element_Begin1("Motion-picture film information");
    Skip_B1(                                                    "?");
    Skip_B1(                                                    "?");
    Skip_B1(                                                    "?");
    Skip_B1(                                                    "?");
    Skip_B4(                                                    "?");
    Skip_B4(                                                    "?");
    Skip_UTF8(32,                                               "?");
    Skip_B4(                                                    "?");
    Skip_B4(                                                    "?");
    Skip_UTF8(32,                                               "?");
    Skip_UTF8(200,                                              "?");
    Skip_XX(740,                                                "Reserved for future use");
    Element_End0();
}
Esempio n. 14
0
//---------------------------------------------------------------------------
void File_Jpeg::APP1_EXIF()
{
    //Parsing
    Element_Begin1("Exif");
        int32u Alignment;
        Get_C4(Alignment,                                       "Alignment");
        if (Alignment==0x49492A00)
            Skip_B4(                                            "First_IFD");
        if (Alignment==0x4D4D2A00)
            Skip_L4(                                            "First_IFD");
    Element_End0();
}
Esempio n. 15
0
//---------------------------------------------------------------------------
void File_Tiff::FileHeader_Parse()
{
    //The only IFD that is known at forehand is the first one, it's offset is placed byte 4-7 in the file.
    int32u IFDOffset;
    Skip_B4(                                                    "Magic");
    Get_X4 (IFDOffset,                                          "IFDOffset");

    FILLING_BEGIN();
        //Initial IFD
        GoTo(IFDOffset, "TIFF");
    FILLING_END();
}
Esempio n. 16
0
//---------------------------------------------------------------------------
void File_Rar::Read_Buffer_Continue()
{
    Skip_B4(                                                    "Magic");
    Skip_XX(File_Size-4,                                        "Data");

    FILLING_BEGIN();
        Accept("RAR");

        Fill(Stream_General, 0, General_Format, "RAR");

        Finish("RAR");
    FILLING_END();
}
Esempio n. 17
0
//---------------------------------------------------------------------------
void File_Cdxa::Data_Parse()
{
    if (MI==NULL)
    {
        //Where is the header? --> Problem
        Reject("CDXA");
        return;
    }

    //CRC or not?
    int64u CRC_Size=4;
    if (Element_Size!=2328)
        CRC_Size=0;

    //Parsing
    Skip_XX(Element_Size-CRC_Size,                              "Data");
    if (CRC_Size>0)
        Skip_B4(                                                "CRC");

    //Preparing to fill MediaInfo with a buffer
    MI->Open_Buffer_Position_Set(File_Offset+Buffer_Offset);

    //Sending the buffer to MediaInfo
    MI->Open_Buffer_Continue(Buffer+Buffer_Offset, (size_t)(Element_Size-CRC_Size));

    //Testing if filled
    if (MI->Info->Status[IsFilled]) {

    }

    //Testing if MediaInfo always need data
    File_GoTo=MI->Open_Buffer_Continue_GoTo_Get();
    if (File_GoTo==(int64u)-1 && MI->Info->Status[IsFilled] && File_Size!=(int64u)-1 && File_Offset+Buffer_Size<File_Size/2)
        GoToFromEnd(File_Offset+Buffer_Size);
    if (File_GoTo!=(int64u)-1)
        Info("CDXA, Jumping to end of file");

    //Details
    #if MEDIAINFO_TRACE
    if (Config_Trace_Level)
    {
        if (!MI->Inform().empty())
            Element_Show_Add(MI->Inform());
    }
    #endif //MEDIAINFO_TRACE

    //Demux
    Demux(Buffer+Buffer_Offset, (size_t)(Element_Size-CRC_Size), ContentType_MainStream);
}
Esempio n. 18
0
//---------------------------------------------------------------------------
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();
}
Esempio n. 19
0
//---------------------------------------------------------------------------
void File_Tiff::Read_Buffer_Continue()
{
    Skip_B4(                                                    "Magic");
    Skip_XX(File_Size-4,                                        "Data");

    FILLING_BEGIN();
        Accept("TIFF");

        Stream_Prepare(Stream_Image);
        Fill(Stream_Image, 0, Image_Format, "TIFF");
        Fill(Stream_Image, 0, Image_Codec, "TIFF");

        //No more need data
        Finish("TIFF");
    FILLING_END();
}
Esempio n. 20
0
//---------------------------------------------------------------------------
void File_TwinVQ::COMM()
{
    //Parsing
    int32u channel_mode, bitrate, samplerate;
    Get_B4 (channel_mode,                                       "channel_mode");
    Get_B4 (bitrate,                                            "bitrate");
    Get_B4 (samplerate,                                         "samplerate");
    Skip_B4(                                                    "security_level");

    //Filling
    Fill(Stream_Audio, 0, Audio_Channel_s_, channel_mode+1);
    Fill(Stream_Audio, 0, Audio_BitRate, bitrate*1000);
    Fill(Stream_Audio, 0, Audio_SamplingRate, TwinVQ_samplerate(samplerate));
    if (!IsSub && File_Size!=(int64u)-1)
        Fill(Stream_Audio, 0, Audio_StreamSize, File_Size);
}
Esempio n. 21
0
//---------------------------------------------------------------------------
void File_Png::FileHeader_Parse()
{
    //Parsing
    int32u Signature;
    Get_B4 (Signature,                                          "Signature");
    Skip_B4(                                                    "ByteOrder");

    FILLING_BEGIN();
        switch (Signature)
        {
            case 0x89504E47 :
                Accept("PNG");

                Fill(Stream_General, 0, General_Format, "PNG");

                Stream_Prepare(Stream_Image);

                break;

            case 0x8A4E4E47 :
                Accept("PNG");

                Stream_Prepare(Stream_Image);
                Fill(Stream_Image, 0, Image_Codec, "MNG");
                Fill(Stream_Image, 0, Image_Format, "MNG");

                Finish("PNG");
                break;

            case 0x8B4A4E47 :
                Accept("PNG");

                Stream_Prepare(Stream_Image);
                Fill(Stream_Image, 0, Image_Format, "JNG");
                Fill(Stream_Image, 0, Image_Codec, "JNG");

                Finish("PNG");
                break;

            default:
                Reject("PNG");
        }
    FILLING_END();
}
Esempio n. 22
0
//---------------------------------------------------------------------------
void File_Cdxa::Data_Parse()
{
    if (MI==NULL)
    {
        //Where is the header? --> Problem
        Finnished();
        return;
    }

    //CRC or not?
    int64u CRC_Size=4;
    if (Element_Size!=2328)
        CRC_Size=0;

    //Parsing
    Skip_XX(Element_Size-CRC_Size,                              "Data");
    if (CRC_Size>0)
        Skip_B4(                                                "CRC");

    //Preparing to fill MediaInfo with a buffer
    MI->Open_Buffer_Init(File_Size, File_Offset+Buffer_Offset);

    //Sending the buffer to MediaInfo
    if (MI->Open_Buffer_Continue(Buffer+Buffer_Offset, (size_t)(Element_Size-CRC_Size))==0)
        Finnished(); //Get out of the loop, there was an error during the parsing

    //Testing if MediaInfo always need data
    File_GoTo=MI->Open_Buffer_Continue_GoTo_Get();
    if (File_GoTo!=(int64u)-1)
        Info("CDXA, Jumping to end of file");

    //Details
    #ifndef MEDIAINFO_MINIMIZESIZE
    if (Config.Details_Get())
    {
        if (!MI->Inform().empty())
            Element_Show_Add(MI->Inform());
    }
    #endif //MEDIAINFO_MINIMIZESIZE

    //Demux
    Demux(Buffer+Buffer_Offset, (size_t)(Element_Size-CRC_Size), _T("xxx"));
}
Esempio n. 23
0
//---------------------------------------------------------------------------
void File_Gzip::Read_Buffer_Continue()
{
    //Parsing
    int8u CM;
    Skip_B2(                                                    "IDentification");
    Get_B1 (CM,                                                 "Compression Method");
    Skip_B1(                                                    "FLaGs");
    Skip_B4(                                                    "Modified TIME");
    Skip_XX(File_Size-10,                                       "Data");

    FILLING_BEGIN();
        //Filling
        Accept("Gzip");

        Fill(Stream_General, 0, General_Format, "GZip");
        Fill(Stream_General, 0, General_Format_Profile, "deflate");

        Finish("Gzip");
    FILLING_END();
}
Esempio n. 24
0
//---------------------------------------------------------------------------
void File_Jpeg::APP0_AVI1()
{
    //Parsing
    int8u  FieldOrder=(int8u)-1;
    Element_Begin1("AVI1");
        if (Element_Size==16-4)
        {
            Get_B1 (FieldOrder,                                     "Polarity");
            Skip_XX(7,                                              "Zeroes");
        }
        if (Element_Size==18-4)
        {
            int32u FieldSizeLessPadding;
            Get_B1 (FieldOrder,                                     "Field Order");
            Skip_B1(                                                "Zero");
            Skip_B4(                                                "FieldSize");
            Get_B4 (FieldSizeLessPadding,                           "FieldSizeLessPadding");

            //Coherency
            if (FieldOrder==0 && IsSub && FieldSizeLessPadding!=Buffer_Size)
                FieldOrder=(int8u)-1; //Not coherant
        }
    Element_End0();

    FILLING_BEGIN();
        if (Frame_Count==0 && Field_Count==0)
        {
            switch (FieldOrder)
            {
                case 0x00 : Fill(Stream_Video, 0, Video_Interlacement, "PPF"); Fill(Stream_Video, 0, Video_ScanType, "Progressive"); break;
                case 0x01 : Fill(Stream_Video, 0, Video_Interlacement, "TFF"); Fill(Stream_Video, 0, Video_ScanType, "Interlaced"); Fill(Stream_Video, 0, Video_ScanOrder, "TFF"); Interlaced=true; break;
                case 0x02 : Fill(Stream_Video, 0, Video_Interlacement, "BFF"); Fill(Stream_Video, 0, Video_ScanType, "Interlaced"); Fill(Stream_Video, 0, Video_ScanOrder, "BFF"); Interlaced=true; break;
                case 0xFF : Fill(Stream_Video, 0, Video_ScanType, "Interlaced"); Interlaced=true; break;
                default   : ;
            }
        }
    FILLING_END();
}
Esempio n. 25
0
//---------------------------------------------------------------------------
void File_Au::FileHeader_Parse()
{
    //Parsing
    Ztring arbitrary;
    int32u data_start, data_size, sample_format, sample_rate, channels;
    Skip_B4(                                                    "Magic");
    Get_B4 (data_start,                                         "data_start");
    Get_B4 (data_size,                                          "data_size");
    Get_B4 (sample_format,                                      "sample_format");
    Get_B4 (sample_rate,                                        "sample_rate");
    Get_B4 (channels,                                           "channels");
    if (data_start>24)
        Get_Local(data_start-24, arbitrary,                     "arbitrary data");

    FILLING_BEGIN();
        Accept("AU");

        Fill(Stream_General, 0, General_Format, "AU");

        Stream_Prepare(Stream_Audio);
        Fill(Stream_Audio, 0, Audio_Format, Au_Format(sample_format));
        Fill(Stream_Audio, 0, Audio_CodecID, Au_sample_format(sample_format));
        Fill(Stream_Audio, 0, Audio_Codec, Au_sample_format(sample_format));
        Fill(Stream_Audio, 0, Audio_Channel_s_, channels);
        Fill(Stream_Audio, 0, Audio_SamplingRate, sample_rate);
        if (File_Size!=(int64u)-1)
            data_size=(int32u)File_Size-data_start; //Priority for File size
        if (sample_rate && data_size!=0 && data_size!=0xFFFFFFFF)
            Fill(Stream_Audio, 0, Audio_Duration, ((int64u)data_size)*1000/sample_rate);
        Fill(Stream_Audio, 0, Audio_StreamSize, File_Size-Element_Offset);
        Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR");
        Fill(Stream_General, 0, General_Comment, arbitrary);

        //No more need data
        Finish("AU");
    FILLING_END();
}
Esempio n. 26
0
//---------------------------------------------------------------------------
void File_Skm::Header_Parse()
{
    //Parsing
    int32u BodyLength;
    int8u Type;
    Skip_B4(                                                    "PreviousTagSize");
    if (File_Offset+Buffer_Offset+4<File_Size)
    {
        Get_B1 (Type,                                           "Type"); //Param_Info1(Type<19?Flv_Type[Type]:__T("Unknown"));
        Get_B3 (BodyLength,                                     "BodyLength");
        Skip_B3(                                                "Timestamp_Base"); //in ms
        Skip_B1(                                                "Timestamp_Extended"); //TimeStamp = Timestamp_Extended*0x01000000+Timestamp_Base
        Skip_B3(                                                "StreamID");
    }
    else
    {
        Type=0;
        BodyLength=0;
    }

    //Filling
    Header_Fill_Code(Type, Ztring().From_Number(Type, 16));
    Header_Fill_Size(Element_Offset+BodyLength);
}
Esempio n. 27
0
//---------------------------------------------------------------------------
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();
}
Esempio n. 28
0
//---------------------------------------------------------------------------
void File_Mpeg4_Descriptors::Descriptor_0E()
{
    //Parsing
    Skip_B4(                                                    "Track_ID"); //ID of the track to use
}
Esempio n. 29
0
//---------------------------------------------------------------------------
void File_Mpeg4_Descriptors::Descriptor_06()
{
    //Parsing
    int8u predefined, timeStampLength;
    bool durationFlag, useTimeStampsFlag;
    Get_B1 (predefined,                                         "predefined"); Param_Info(Mpeg4_Descriptors_Predefined(predefined));
    switch (predefined)
    {
        case 0x00 :
            {
                    BS_Begin();
                    Skip_SB(                                    "useAccessUnitStartFlag");
                    Skip_SB(                                    "useAccessUnitEndFlag");
                    Skip_SB(                                    "useRandomAccessPointFlag");
                    Skip_SB(                                    "hasRandomAccessUnitsOnlyFlag");
                    Skip_SB(                                    "usePaddingFlag");
                    Get_SB (useTimeStampsFlag,                  "useTimeStampsFlag");
                    Skip_SB(                                    "useIdleFlag");
                    Get_SB (durationFlag,                       "durationFlag");
                    BS_End();
                    Skip_B4(                                    "timeStampResolution");
                    Skip_B4(                                    "OCRResolution");
                    Get_B1 (timeStampLength,                    "timeStampLength");
                    Skip_B1(                                    "OCRLength");
                    Skip_B1(                                    "AU_Length");
                    Skip_B1(                                    "instantBitrateLength");
                    BS_Begin();
                    Skip_S1(4,                                  "degradationPriorityLength");
                    Skip_S1(5,                                  "AU_seqNumLength");
                    Skip_S1(5,                                  "packetSeqNumLength");
                    Skip_S1(2,                                  "reserved");
                    BS_End();
            }
            break;
        case 0x01 :
                    useTimeStampsFlag=false;
                    durationFlag=false;
                    timeStampLength=32;
                    break;
        case 0x02 :
                    useTimeStampsFlag=true;
                    durationFlag=false;
                    timeStampLength=32;
                    break;
        default   :
                    useTimeStampsFlag=false;
                    durationFlag=false;
                    timeStampLength=32;
    }
    if (durationFlag)
    {
        Skip_B4(                                                "timeScale");
        Skip_B2(                                                "accessUnitDuration");
        Skip_B2(                                                "compositionUnitDuration");
    }
    if (!useTimeStampsFlag)
    {
        BS_Begin();
        Skip_S8(timeStampLength,                                "startDecodingTimeStamp");
        Skip_S8(timeStampLength,                                "startCompositionTimeStamp");
        BS_End();
    }
}
Esempio n. 30
0
//---------------------------------------------------------------------------
void File_Aac::ALSSpecificConfig()
{
    //Not in spec, but something weird in the example I have
    int32u Junk;
    while (Data_BS_Remain())
    {
        Peek_S4(32, Junk);
        if (Junk!=0x414C5300)
        {
            Skip_SB(                                            "Unknown");
        }
        else
            break;
    }
    if (Data_BS_Remain()==0)
        return; //There is a problem

    Element_Begin1("ALSSpecificConfig");
    bool chan_config,chan_sort,crc_enabled,aux_data_enabled;
    int32u samp_freq, samples;
    int16u channels,frame_length;
    int8u ra_flag,random_access, file_type;
    Skip_BS(32,"als_id");
    Get_BS (32, samp_freq,                                      "samp_freq");
    Get_BS (32, samples,                                        "samples");
    Get_S2 (16, channels,                                       "channels"); Param_Info2(channels+1, " channel(s)");
    Get_S1 (3, file_type,                                       "file_type");
    Skip_S1(3,"resolution");
    Skip_SB("floating");
    Skip_SB("msb_first");
    Get_S2 (16,frame_length,"frame_length");
    Get_S1 (8,random_access,"random_access");
    Get_S1 (2,ra_flag,"ra_flag");
    Skip_SB("adapt_order");
    Skip_S1(2,"coef_table");
    Skip_SB("long_term_prediction");
    Skip_S2(10,"max_order");
    Skip_S1(2,"block_switching");
    Skip_SB("bgmc_mode");
    Skip_SB("sb_part");
    Skip_SB("joint_stereo");
    Skip_SB("mc_coding");
    Get_SB (chan_config,"chan_config");
    Get_SB (chan_sort,"chan_sort");
    Get_SB (crc_enabled,"crc_enabled");
    Skip_SB("RLSLMS");
    Skip_BS(5,"(reserved)");
    Get_SB (aux_data_enabled,"aux_data_enabled");
    if (chan_config)
        Skip_S2(16,"chan_config_info");
    if (chan_sort)
    {
        int16u ChBits=(int16u)ceil(log((double)(channels+1))/log((double)2));
        for (int8u c=0; c<=channels; c++)
            Skip_BS(ChBits,                                     "chan_pos[c]");
    }
    if(Data_BS_Remain()%8)
        Skip_S1(Data_BS_Remain()%8,                             "byte_align");
    BS_End();
    int32u header_size,trailer_size;
    Get_B4(header_size,                                         "header_size");
    Get_B4(trailer_size,                                        "trailer_size");
    #ifdef MEDIAINFO_RIFF_YES
    if (file_type==1) //WAVE file
    {
        Element_Begin1("orig_header");
        File_Riff MI;
        Open_Buffer_Init(&MI);
        Open_Buffer_Continue(&MI, Buffer+Buffer_Offset+(size_t)Element_Offset, header_size);
        Element_Offset+=header_size;
        File__Analyze::Finish(&MI); //No merge of data, only for trace information, because this is the data about the decoded stream, not the encoded stream
        Element_End0();
    }
    else
    #endif //MEDIAINFO_RIFF_YES
        Skip_XX(header_size,                                    "orig_header[]");

    Skip_XX(trailer_size,                                       "orig_trailer[]");
    if (crc_enabled)
        Skip_B4(                                                "crc");
    if ((ra_flag == 2) && (random_access > 0))
        for (int32u f=0; f<((samples-1)/(frame_length+1))+1; f++)
            Skip_B4(                                            "ra_unit_size[f]");
    if (aux_data_enabled)
    {
        int32u aux_size;
        Get_B4(aux_size,                                        "aux_size");
        Skip_XX(aux_size,                                       "aux_data[]");
    }
    Element_End0();
    BS_Begin(); //To be in sync with other objectTypes

    FILLING_BEGIN();
        //Filling
        File__Analyze::Stream_Prepare(Stream_Audio);
        Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, channels+1);

        //Forcing default confignuration (something weird in the example I have)
        channelConfiguration=0;
        sampling_frequency_index=(int8u)-1;
        sampling_frequency=samp_freq;
    FILLING_END();
}