示例#1
0
//---------------------------------------------------------------------------
void File_Sdp::Data_Parse()
{
    Element_Name("Packet");

    for (int8u Pos=0; Pos<5; Pos++)
    {
        if (FieldLines[Pos])
        {
            Element_Code=FieldLines[Pos];
            stream &Stream=Streams[FieldLines[Pos]];
            if (Stream.Parser==NULL)
            {
                Stream.Parser=new File_Teletext();
                Stream.Parser->IsSubtitle=true;
                Open_Buffer_Init(Stream.Parser);
            }
            if (Stream.Parser->PTS_DTS_Needed)
                Stream.Parser->FrameInfo=FrameInfo;
            Demux(Buffer+Buffer_Offset+Element_Offset, 45, ContentType_MainStream);
            Open_Buffer_Continue(Stream.Parser, Buffer+Buffer_Offset+Element_Offset, 45);
            Element_Offset+=45;
        }
    }

    Element_Begin1("SDP Footer");
    Skip_B1(                                                    "Footer ID");
    Skip_B2(                                                    "Footer Sequence number");
    Skip_B2(                                                    "SDP Cheksum");
    Skip_B2(                                                    "SMPTE 291 Cheksum");
    Element_End0();
}
//---------------------------------------------------------------------------
void File_Mpeg4_Descriptors::Descriptor_03()
{
    //Parsing
    bool streamDependenceFlag, URL_Flag, OCRstreamFlag;
    Get_B2 (ES_ID,                                              "ES_ID");
    BS_Begin();
    Get_SB (   streamDependenceFlag,                            "streamDependenceFlag");
    Get_SB (   URL_Flag,                                        "URL_Flag");
    Get_SB (   OCRstreamFlag,                                   "OCRstreamFlag");
    Skip_S1(5,                                                  "streamPriority");
    BS_End();
    if (streamDependenceFlag)
        Skip_B2(                                                "dependsOn_ES_ID");
    if (URL_Flag)
    {
        int8u URLlength;
        Get_B1 (URLlength,                                      "URLlength");
        Skip_UTF8(URLlength,                                    "URLstring");
    }
    if (OCRstreamFlag)
        Skip_B2(                                                "OCR_ES_Id");

    FILLING_BEGIN();
        Element_ThisIsAList();
    FILLING_END();
}
示例#3
0
//---------------------------------------------------------------------------
void File_Flac::STREAMINFO()
{
    Element_Info("STREAMINFO");

    //Parsing
    int64u Samples;
    int32u FrameSize_Min, FrameSize_Max, SampleRate;
    int8u  Channels, BitPerSample;
    Skip_B2(                                                    "BlockSize_Min"); //The minimum block size (in samples) used in the stream.
    Skip_B2(                                                    "BlockSize_Max"); //The maximum block size (in samples) used in the stream. (Minimum blocksize == maximum blocksize) implies a fixed-blocksize stream.
    Get_B3 (    FrameSize_Min,                                  "FrameSize_Min"); //The minimum frame size (in bytes) used in the stream. May be 0 to imply the value is not known.
    Get_B3 (    FrameSize_Max,                                  "FrameSize_Max"); //The maximum frame size (in bytes) used in the stream. May be 0 to imply the value is not known.
    BS_Begin();
    Get_S3 (20, SampleRate,                                     "SampleRate"); //Sample rate in Hz. Though 20 bits are available, the maximum sample rate is limited by the structure of frame headers to 1048570Hz. Also, a value of 0 is invalid.
    Get_S1 ( 3, Channels,                                       "Channels"); Param_Info(Channels+1, " channels"); //(number of channels)-1. FLAC supports from 1 to 8 channels
    Get_S1 ( 5, BitPerSample,                                   "BitPerSample"); Param_Info(BitPerSample+1, " bits"); //(bits per sample)-1. FLAC supports from 4 to 32 bits per sample. Currently the reference encoder and decoders only support up to 24 bits per sample.
    Get_S5 (36, Samples,                                        "Samples");
    BS_End();
    Skip_B16(                                                   "MD5 signature of the unencoded audio data");

    //Filling
    if (SampleRate==0)
        return;
    Stream_Prepare(Stream_Audio);
    Fill(Stream_Audio, 0, Audio_Format, "FLAC");
    Fill(Stream_Audio, 0, Audio_Codec, "FLAC");
    if (FrameSize_Min==FrameSize_Max && FrameSize_Min!=0 ) // 0 means it is unknown
        Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR");
     else
        Fill(Stream_Audio, 0, Audio_BitRate_Mode, "VBR");
    Fill(Stream_Audio, 0, Audio_SamplingRate, SampleRate);
    Fill(Stream_Audio, 0, Audio_Channel_s_, Channels+1);
    Fill(Stream_Audio, 0, Audio_Resolution, BitPerSample+1);
    Fill(Stream_Audio, 0, Audio_Duration, Samples*1000/SampleRate);
}
示例#4
0
//---------------------------------------------------------------------------
void File_Vc3::ImageGeometry()
{
    //Parsing
    Element_Begin("Image Geometry", 11);
    Get_B2 (ALPF,                                               "Active lines-per-frame");
    Get_B2 (SPL,                                                "Samples-per-line");
    Skip_B1(                                                    "Zero");
    Skip_B2(                                                    "Number of active lines");
    Skip_B2(                                                    "Zero");

    BS_Begin();

    Get_S1 (3, SBD,                                             "Sample bit depth");
    Mark_1();
    Mark_1();
    Mark_0();
    Mark_0();
    Mark_0();

    Mark_1();
    Mark_0();
    Mark_0();
    Mark_0();
    Mark_1();
    Get_SB (   SST,                                             "Source scan type");
    Mark_0();
    Mark_0();

    BS_End();
    Element_End();
}
示例#5
0
//---------------------------------------------------------------------------
void File_DvbSubtitle::region_composition_segment()
{
    Element_Name("region composition segment");

    //Parsing
    int16u region_width, region_height;
    int8u  region_id, region_depth;
    Get_B1 (   region_id,                                       "region_id");
    BS_Begin();
    Skip_S1(4,                                                  "region_version_number");
    Skip_S1(1,                                                  "region_fill_flag");
    Skip_S1(3,                                                  "reserved");
    BS_End();
    Get_B2 (   region_width,                                    "region_width");
    Get_B2 (   region_height,                                   "region_height");
    BS_Begin();
    Skip_S1(3,                                                  "region_level_of_compatibility");
    Get_S1 (3, region_depth,                                    "region_depth"); Param_Info2(DvbSubtitle_region_depth[region_depth], " bits");
    Skip_S1(2,                                                  "reserved");
    BS_End();
    Skip_B1(                                                    "CLUT_id");
    Skip_B1(                                                    "region_8-bit_pixel_code");
    BS_Begin();
    Skip_S1(4,                                                  "region_4-bit_pixel-code");
    Skip_S1(2,                                                  "region_2-bit_pixel-code");
    Skip_S1(2,                                                  "reserved");
    BS_End();
    while(Element_Offset<Element_Size)
    {
        Element_Begin1("Object");
        int8u object_type;
        Skip_B2(                                                "object_id");
        BS_Begin();
        Get_S1 ( 2, object_type,                                "object_type");
        Skip_S1( 2,                                             "object_provider_flag");
        Skip_S1(12,                                             "object_horizontal_position");
        Skip_S1( 4,                                             "reserved");
        Skip_S1(12,                                             "object_vertical_position");
        BS_End();
        switch (object_type)
        {
            case 0x01 :
            case 0x02 :
                        Skip_B2(                                 "foreground_pixel_code");
                        Skip_B2(                                 "background_pixel_code");
                        break;
            default   : ;
        }
        Element_End0();
    }

    FILLING_BEGIN();
        region_data& region = subtitle_streams[subtitle_stream_id].pages[page_id].regions[region_id];
        region.region_composition_segment=true;
        region.region_width=region_width;
        region.region_height=region_height;
        region.region_depth=region_depth;
    FILLING_END();
}
示例#6
0
//---------------------------------------------------------------------------
void File_Cdp::cdp_header()
{
    Element_Begin1("cdp_header");
    int16u cdp_identifier;
    int8u cdp_frame_rate;
    Get_B2 (   cdp_identifier,                                  "cdp_identifier");
    Skip_B1(                                                    "cdp_length");
    BS_Begin();
    Get_S1 (4, cdp_frame_rate,                                  "cdp_frame_rate"); Param_Info1(Ztring::ToZtring(Cdp_cdp_frame_rate(cdp_frame_rate))+__T(" fps"));
    Skip_S1(4,                                                  "Reserved");
    Skip_SB(                                                    "time_code_present");
    Skip_SB(                                                    "ccdata_present");
    Skip_SB(                                                    "svcinfo_present");
    Skip_SB(                                                    "svc_info_start");
    Skip_SB(                                                    "svc_info_change");
    Skip_SB(                                                    "svc_info_complete");
    Skip_SB(                                                    "caption_service_active");
    Skip_SB(                                                    "Reserved");
    BS_End();
    Skip_B2(                                                    "cdp_hdr_sequence_cntr");
    Element_End0();

    FILLING_BEGIN();
        if (!Status[IsAccepted])
        {
            if (cdp_identifier!=0x9669)
            {
                Reject("CDP");
                return;
            }

            Accept("CDP");
        }
    FILLING_END();
}
示例#7
0
//---------------------------------------------------------------------------
void File_Sdp::Header_Parse()
{
    //Parsing
    int8u Length, FormatCode;
    Skip_B2(                                                    "Identifier");
    Get_B1 (Length,                                             "Length");
    Get_B1 (FormatCode,                                         "Format Code");
    for (int8u Pos=0; Pos<5; Pos++)
    {
        FieldLines[Pos]=0;
        #if MEDIAINFO_TRACE
            Element_Begin1("Field/Line");
            BS_Begin();
            Info_SB(   Field,                                   "Field Number");
            Info_S1(2, Reserved,                                "Reserved");
            Info_S1(5, Line,                                    "Line Number");
            BS_End();
            FieldLines[Pos]=((Field?1:0)<<7) |(Reserved<<5) | Line; //Removing field information ((Field?1:0)<<7) |
            if (FieldLines[Pos])
            {
                Element_Info1(Field?2:1);
                Element_Info1(Line);
            }
            else
                Element_Info1("None");
            Element_End0();
        #else //MEDIAINFO_TRACE
            Get_B1(FieldLines[Pos],                             "Field/Line");
            FieldLines[Pos]&=0x7F; //Removing field information
        #endif //MEDIAINFO_TRACE
    }

    Header_Fill_Size(3+Length);
}
示例#8
0
//---------------------------------------------------------------------------
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();
}
示例#9
0
//---------------------------------------------------------------------------
void File_Module::FileHeader_Parse()
{
    //Parsing
    Ztring ModuleName, SamplesName;
    int32u Signature;
    Get_Local(20, ModuleName,                                   "Module name");
    for (int8u Pos=0; Pos<31; Pos++)
    {
        Element_Begin();
        Get_Local(22, SamplesName,                              "Sample's name"); Element_Name(SamplesName);
        Skip_B2(                                                "Sample length");
        Skip_B1(                                                "Finetune value for the sample");
        Skip_B1(                                                "Volume of the sample");
        Skip_B2(                                                "Start of sample repeat offset");
        Skip_B2(                                                "Length of sample repeat");
        Element_End();
    }
    Skip_B1(                                                    "Number of song positions");
    Skip_B1(                                                    "0x8F");
    Skip_XX(128,                                                "Pattern table");
    Get_C4 (Signature,                                          "Signature");

    FILLING_BEGIN();
        switch (Signature)
        {
            case 0x4D2E4B2E : //M.K.
            case 0x4D214B21 : //M!K!
            case 0x664C5434 : //FLT4
            case 0x664C5438 : //FLT8
            case 0x3663684E : //6CHN
            case 0x3863684E : //8CHN
                                break;
            default : Finished();
                      return;
        }
    FILLING_END()

    FILLING_BEGIN();
        Stream_Prepare(Stream_General);
        Fill(Stream_General, 0, General_Format, "Module");

        Stream_Prepare(Stream_Audio);

        Finished();
    FILLING_END();
}
示例#10
0
//---------------------------------------------------------------------------
void File_Cdp::cdp_footer()
{
    Element_Begin1("cdp_footer");
    Skip_B1(                                                    "cdp_footer_id");
    Skip_B2(                                                    "cdp_ftr_sequence_cntr");
    Skip_B1(                                                    "packet_checksum");
    Element_End0();
}
示例#11
0
//---------------------------------------------------------------------------
void File_Eia708::Read_Buffer_Continue()
{
    if (!Status[IsAccepted])
    {
        if (cc_type!=3)
        {
            Skip_B2(                                                "Waiting for header");
            return;
        }

        Accept("EIA-708");
    }
}
示例#12
0
//---------------------------------------------------------------------------
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");
}
示例#13
0
//---------------------------------------------------------------------------
void File_Eia708::Read_Buffer_Continue()
{
    if (!IsAccepted)
    {
        if (cc_type!=3)
        {
            Skip_B2(                                                "Waiting for header");
            return;
        }

        Accept("EIA-708");
        Stream_Prepare(Stream_General);
    }
}
示例#14
0
//---------------------------------------------------------------------------
void File_Jpeg::APP0_JFIF()
{
    //Parsing
    Skip_B1(                                                    "Zero");
    Element_Begin1("JFIF");
        int16u Width, Height;
        int8u  Unit, ThumbailX, ThumbailY;
        Skip_B2(                                                "Version");
        Get_B1 (Unit,                                           "Unit"); //0=Pixels, 1=dpi, 2=dpcm
        Get_B2 (Width,                                          "Xdensity");
        Get_B2 (Height,                                         "Ydensity");
        Get_B1 (ThumbailX,                                      "Xthumbail");
        Get_B1 (ThumbailY,                                      "Ythumbail");
        Skip_XX(3*ThumbailX*ThumbailY,                          "RGB Thumbail");
    Element_End0();
}
示例#15
0
//---------------------------------------------------------------------------
void File_Caf::FileHeader_Parse()
{
    //Parsing
	int16u FileVersion;
	Skip_C4(                                                    "FileType");
    Get_B2 (FileVersion,                                        "FileVersion");
    Skip_B2(											        "FileFlags");

    FILLING_BEGIN();
        Accept();
		Fill(Stream_General, 0, General_Format, "CAF");
		Fill(Stream_General, 0, General_Format_Version, __T("Version ")+Ztring::ToZtring(FileVersion));
        Stream_Prepare(Stream_Audio);

		if (FileVersion!=1)
            Finish(); //Version 0 or 2+ are not supported
    FILLING_END();
}
示例#16
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();
}
示例#17
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();
    }
}
示例#18
0
//---------------------------------------------------------------------------
void File_Eia708::Data_Parse()
{
    //Parsing
    int8u block_size, service_number;
    BS_Begin();
    Get_S1(3, service_number,                                   "service_number");
    Get_S1(5, block_size,                                       "block_size");
    if (service_number==7)
    {
        Mark_0_NoTrustError();
        Mark_0_NoTrustError();
        Get_S1(6, service_number,                               "extended_service_number");
    }
    BS_End();

    if (service_number>=Captions.size())
        Captions.resize(service_number+1);

    if (block_size)
    {
        Element_Begin("Service Block Packet", block_size);
        for (int8u Pos=0; Pos<block_size; Pos++)
        {
            int8u cc_data_1;
            Get_B1(cc_data_1,                                   "cc_data");
            switch (cc_data_1)
            {
                case 0x08 : if (!Captions[service_number].empty())
                                Captions[service_number].resize(Captions[service_number].size()-1);
                            break;
                case 0x10 : //EXT1
                            {
                                Get_B1 (cc_data_1,              "EXT1");
                                Pos++;
                                if (cc_data_1>=0x08 && cc_data_1<0x10)
                                {
                                    Skip_B1(                    "EXT1 1 byte");
                                    Pos++;
                                }
                                if (cc_data_1>=0x10 && cc_data_1<0x18)
                                {
                                    Skip_B2(                    "EXT1 2 byte");
                                    Pos+=2;
                                }
                                if (cc_data_1>=0x18 && cc_data_1<0x20)
                                {
                                    Skip_B3(                    "EXT1 3 byte");
                                    Pos+=3;
                                }
                                if (cc_data_1>=0x80 && cc_data_1<0x88)
                                {
                                    Skip_B4(                    "EXT1 4 byte");
                                    Pos+=4;
                                }
                                if (cc_data_1>=0x88 && cc_data_1<0x90)
                                {
                                    Skip_B5(                    "EXT1 5 byte");
                                    Pos+=5;
                                }
                            }
                            break;
                case 0x18 : //P16
                            {
                                Skip_B2(                        "P16");
                                Pos+=2;
                            }
                            break;
                case 0x20 : Captions[service_number]+=L' '     ; break;
                case 0x21 : Captions[service_number]+=L'!'     ; break;
                case 0x22 : Captions[service_number]+=L'"'     ; break;
                case 0x23 : Captions[service_number]+=L'#'     ; break;
                case 0x24 : Captions[service_number]+=L'$'     ; break;
                case 0x25 : Captions[service_number]+=L'%'     ; break;
                case 0x26 : Captions[service_number]+=L'&'     ; break;
                case 0x27 : Captions[service_number]+=L'\''     ; break;
                case 0x28 : Captions[service_number]+=L'('     ; break;
                case 0x29 : Captions[service_number]+=L')'     ; break;
                case 0x2A : Captions[service_number]+=L'*'     ; break;
                case 0x2B : Captions[service_number]+=L'+'     ; break;
                case 0x2C : Captions[service_number]+=L','     ; break;
                case 0x2D : Captions[service_number]+=L'-'     ; break;
                case 0x2E : Captions[service_number]+=L'.'     ; break;
                case 0x2F : Captions[service_number]+=L'/'     ; break;
                case 0x30 : Captions[service_number]+=L'0'     ; break;
                case 0x31 : Captions[service_number]+=L'1'     ; break;
                case 0x32 : Captions[service_number]+=L'2'     ; break;
                case 0x33 : Captions[service_number]+=L'3'     ; break;
                case 0x34 : Captions[service_number]+=L'4'     ; break;
                case 0x35 : Captions[service_number]+=L'5'     ; break;
                case 0x36 : Captions[service_number]+=L'6'     ; break;
                case 0x37 : Captions[service_number]+=L'7'     ; break;
                case 0x38 : Captions[service_number]+=L'8'     ; break;
                case 0x39 : Captions[service_number]+=L'9'     ; break;
                case 0x3A : Captions[service_number]+=L':'     ; break;
                case 0x3B : Captions[service_number]+=L';'     ; break;
                case 0x3C : Captions[service_number]+=L'<'     ; break;
                case 0x3E : Captions[service_number]+=L'>'     ; break;
                case 0x3F : Captions[service_number]+=L'?'     ; break;
                case 0x40 : Captions[service_number]+=L'@'     ; break;
                case 0x41 : Captions[service_number]+=L'A'     ; break;
                case 0x42 : Captions[service_number]+=L'B'     ; break;
                case 0x43 : Captions[service_number]+=L'C'     ; break;
                case 0x44 : Captions[service_number]+=L'D'     ; break;
                case 0x45 : Captions[service_number]+=L'E'     ; break;
                case 0x46 : Captions[service_number]+=L'F'     ; break;
                case 0x47 : Captions[service_number]+=L'G'     ; break;
                case 0x48 : Captions[service_number]+=L'H'     ; break;
                case 0x49 : Captions[service_number]+=L'I'     ; break;
                case 0x4A : Captions[service_number]+=L'J'     ; break;
                case 0x4B : Captions[service_number]+=L'K'     ; break;
                case 0x4C : Captions[service_number]+=L'L'     ; break;
                case 0x4D : Captions[service_number]+=L'M'     ; break;
                case 0x4E : Captions[service_number]+=L'N'     ; break;
                case 0x4F : Captions[service_number]+=L'O'     ; break;
                case 0x50 : Captions[service_number]+=L'P'     ; break;
                case 0x51 : Captions[service_number]+=L'Q'     ; break;
                case 0x52 : Captions[service_number]+=L'R'     ; break;
                case 0x53 : Captions[service_number]+=L'S'     ; break;
                case 0x54 : Captions[service_number]+=L'T'     ; break;
                case 0x55 : Captions[service_number]+=L'U'     ; break;
                case 0x56 : Captions[service_number]+=L'V'     ; break;
                case 0x57 : Captions[service_number]+=L'W'     ; break;
                case 0x58 : Captions[service_number]+=L'X'     ; break;
                case 0x59 : Captions[service_number]+=L'Y'     ; break;
                case 0x5A : Captions[service_number]+=L'Z'     ; break;
                case 0x5B : Captions[service_number]+=L'['     ; break;
                case 0x5C : Captions[service_number]+=L'\\'    ; break;
                case 0x5D : Captions[service_number]+=L']'     ; break;
                case 0x5E : Captions[service_number]+=L'^'     ; break;
                case 0x5F : Captions[service_number]+=L'_'     ; break;
                case 0x60 : Captions[service_number]+=L'`'     ; break;
                case 0x61 : Captions[service_number]+=L'a'     ; break;
                case 0x62 : Captions[service_number]+=L'b'     ; break;
                case 0x63 : Captions[service_number]+=L'c'     ; break;
                case 0x64 : Captions[service_number]+=L'd'     ; break;
                case 0x65 : Captions[service_number]+=L'e'     ; break;
                case 0x66 : Captions[service_number]+=L'f'     ; break;
                case 0x67 : Captions[service_number]+=L'g'     ; break;
                case 0x68 : Captions[service_number]+=L'h'     ; break;
                case 0x69 : Captions[service_number]+=L'i'     ; break;
                case 0x6A : Captions[service_number]+=L'j'     ; break;
                case 0x6B : Captions[service_number]+=L'k'     ; break;
                case 0x6C : Captions[service_number]+=L'l'     ; break;
                case 0x6D : Captions[service_number]+=L'm'     ; break;
                case 0x6E : Captions[service_number]+=L'n'     ; break;
                case 0x6F : Captions[service_number]+=L'o'     ; break;
                case 0x70 : Captions[service_number]+=L'p'     ; break;
                case 0x71 : Captions[service_number]+=L'q'     ; break;
                case 0x72 : Captions[service_number]+=L'r'     ; break;
                case 0x73 : Captions[service_number]+=L's'     ; break;
                case 0x74 : Captions[service_number]+=L't'     ; break;
                case 0x75 : Captions[service_number]+=L'u'     ; break;
                case 0x76 : Captions[service_number]+=L'v'     ; break;
                case 0x77 : Captions[service_number]+=L'w'     ; break;
                case 0x78 : Captions[service_number]+=L'x'     ; break;
                case 0x79 : Captions[service_number]+=L'y'     ; break;
                case 0x7A : Captions[service_number]+=L'z'     ; break;
                case 0x7B : Captions[service_number]+=L'{'     ; break;
                case 0x7C : Captions[service_number]+=L'|'     ; break;
                case 0x7D : Captions[service_number]+=L'}'     ; break;
                case 0x7E : Captions[service_number]+=L'~'     ; break;
                case 0x7F : Captions[service_number]+=L'\x266A'; break;
                case 0x88 : //CLW
                            {
                                Skip_B1(                        "CLW");
                                Pos+=1;
                            }
                            break;
                case 0x89 : //DSW
                            {
                                Skip_B1(                        "DSW");
                                Pos+=1;
                            }
                            break;
                case 0x8A : //HDW
                            {
                                Skip_B1(                        "HDW");
                                Pos+=1;
                            }
                            break;
                case 0x8B : //TGW
                            {
                                Skip_B1(                        "TGW");
                                Pos+=1;
                            }
                            break;
                case 0x8C : //DLW
                            {
                                Skip_B1(                        "DLW");
                                Pos+=1;
                            }
                            break;
                case 0x8D : //DLY
                            {
                                Skip_B1(                        "DLY");
                                Pos+=1;
                            }
                            break;
                case 0x90 : //SPA
                            {
                                Skip_B2(                        "SPA");
                                Pos+=2;
                            }
                            break;
                case 0x91 : //SPC
                            {
                                Skip_B3(                        "SPC");
                                Pos+=3;
                            }
                            break;
                case 0x92 : //SPL
                            {
                                Skip_B2(                        "SPL");
                                Pos+=2;
                            }
                            break;
                case 0x97 : //SWA
                            {
                                Skip_B4(                        "SWA");
                                Pos+=4;
                            }
                            break;
                case 0x98 : //
                            {
                                Skip_B6(                        "DF0");
                                Pos+=6;
                            }
                            break;
                case 0x99 : //
                            {
                                Skip_B6(                        "DF1");
                                Pos+=6;
                            }
                            break;
                case 0x9A : //
                            {
                                Skip_B6(                        "DF2");
                                Pos+=6;
                            }
                            break;
                case 0x9B : //
                            {
                                Skip_B6(                        "DF3");
                                Pos+=6;
                            }
                            break;
                case 0x9C : //
                            {
                                Skip_B6(                        "DF4");
                                Pos+=6;
                            }
                            break;
                case 0x9D : //
                            {
                                Skip_B6(                        "DF5");
                                Pos+=6;
                            }
                            break;
                case 0x9E : //
                            {
                                Skip_B6(                        "DF6");
                                Pos+=6;
                            }
                            break;
                case 0x9F : //
                            {
                                Skip_B6(                        "DF7");
                                Pos+=6;
                            }
                            break;
                default   : ;
            }
        }

        Element_End();
    }
}
//---------------------------------------------------------------------------
void File_Mpeg4_Descriptors::Descriptor_09()
{
    //Parsing
    Skip_B2(                                                    "IPI_ES_Id");
}
示例#20
0
//---------------------------------------------------------------------------
void File_Pcm_Vob::Read_Buffer_Continue()
{
    if (Buffer_Size==0)
        return;

    //Parsing
    Skip_B1(                                                    "Frame number");
    Skip_B2(                                                    "Bytes to skip (+1?)");
    Skip_B1(                                                    "Unknown");
    BS_Begin();
    Get_S1 (2, BitDepth,                                        "Bit depth"); Param_Info1(Pcm_VOB_BitDepth[BitDepth]);
    Get_S1 (2, Frequency,                                       "Frequency"); Param_Info1(Pcm_VOB_Frequency[Frequency]);
    Skip_SB(                                                    "Unknown");
    Get_S1 (3, NumberOfChannelsMinusOne,                        "Number of channels (minus 1)");
    BS_End();
    Skip_B1(                                                    "Start code");

    #if MEDIAINFO_DEMUX
        if (Config->Demux_PCM_20bitTo16bit_Get() && BitDepth==1) //20-bit
        {
            int8u* Info=new int8u[(size_t)((Element_Size-6)*4/5)];
            size_t Info_Offset=0;

            while (Element_Offset+5*(NumberOfChannelsMinusOne+1)<=Element_Size)
            {
                size_t Buffer_Pos=Buffer_Offset+(size_t)Element_Offset;

                std::memcpy(Info+Info_Offset, Buffer+Buffer_Pos, 4*(NumberOfChannelsMinusOne+1));

                Info_Offset+=4*(NumberOfChannelsMinusOne+1);
                Element_Offset+=5*(NumberOfChannelsMinusOne+1);
            }
            Element_Offset=6;

            FrameInfo.PTS=FrameInfo.DTS;
            if (Pcm_VOB_Frequency[Frequency])
                FrameInfo.DUR=(Element_Size-6)/5*1000000000/Pcm_VOB_Frequency[Frequency];
            Demux_random_access=true;
            Element_Code=(int64u)-1;
            Demux(Info, Info_Offset, ContentType_MainStream);

            delete[] Info;
        }
        else
        {
            Demux_Offset=Buffer_Offset+(size_t)Element_Size;
            Buffer_Offset+=6; //Header is dropped
            Demux_UnpacketizeContainer_Demux();
            Buffer_Offset-=6;
        }
    #endif //MEDIAINFO_DEMUX

    Skip_XX(Element_Size-6,                                     "Data");

    FILLING_BEGIN();
        Frame_Count++;
        Frame_Count_InThisBlock++;
        if (Frame_Count_NotParsedIncluded!=(int64u)-1)
            Frame_Count_NotParsedIncluded++;
        if (FrameInfo.DTS!=(int64u)-1 && FrameInfo.DUR!=(int64u)-1)
        {
            FrameInfo.DTS+=FrameInfo.DUR;
            FrameInfo.PTS=FrameInfo.DTS;
        }

        if (!Status[IsAccepted])
        {
            Accept();
            Finish();
        }
    FILLING_END();
}
示例#21
0
//---------------------------------------------------------------------------
void File_Mpeg4_Descriptors::Descriptor_0F()
{
    //Parsing
    Skip_B2(                                                    "ref_index");  //track ref. index of the track to use
}
示例#22
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();
}
示例#23
0
//---------------------------------------------------------------------------
void File_Dpx::GenericSectionHeader_Cineon()
{
    Element_Name("Generic section header");

    //Parsing
    Element_Begin1("File information");
    Ztring CreationDate, CreationTime;
    string Version;
    int32u Size_Header, Size_Total, Size_Generic, Size_Industry, Size_User;
    Skip_B4(                                                    "Magic number");
    Get_X4 (Size_Header,                                        "Offset to image data");
    Get_X4 (Size_Generic,                                       "Generic section header length");
    Get_X4 (Size_Industry,                                      "Industry specific header length");
    Get_X4 (Size_User,                                          "User-defined header length");
    Get_X4 (Size_Total,                                         "Total image file size");
    Get_String(8, Version,                                      "Version number of header format");
    Skip_UTF8  (100,                                            "FileName");
    Get_UTF8   (12,  CreationDate,                              "Creation Date");
    Get_UTF8   (12,  CreationTime,                              "Creation Time");
    Skip_XX(36,                                                 "Reserved for future use");
    Element_End0();

    Element_Begin1("Image information");
    int8u ImageElements;
    Info_B1(ImageOrientation,                                   "Image orientation"); Param_Info1(DPX_Orientation[ImageOrientation>8?8:ImageOrientation]);
    Get_B1 (ImageElements,                                      "Number of image elements");
    Skip_B2(                                                    "Unused");
    if (ImageElements>8)
        ImageElements=8;
    for(int8u ImageElement=0; ImageElement<ImageElements; ImageElement++)
        GenericSectionHeader_Cineon_ImageElement();
    if (ImageElements!=8)
        Skip_XX((8-ImageElements)*28,                           "Padding");
    Skip_BF4(                                                   "White point - x");
    Skip_BF4(                                                   "White point - y");
    Skip_BF4(                                                   "Red primary chromaticity - x");
    Skip_BF4(                                                   "Red primary chromaticity - u");
    Skip_BF4(                                                   "Green primary chromaticity - x");
    Skip_BF4(                                                   "Green primary chromaticity - y");
    Skip_BF4(                                                   "Blue primary chromaticity - x");
    Skip_BF4(                                                   "Blue primary chromaticity - y");
    Skip_UTF8(200,                                              "Label text");
    Skip_XX(28,                                                 "Reserved for future use");
    Element_End0();

    Element_Begin1("Image Data Format Information");
    Skip_B1(                                                    "Data interleave");
    Skip_B1(                                                    "Packing");
    Skip_B1(                                                    "Data signed or unsigned");
    Skip_B1(                                                    "Image sense");
    Skip_B4(                                                    "End of line padding");
    Skip_B4(                                                    "End of channel padding");
    Skip_XX(20,                                                 "Reserved for future use");

    Element_Begin1("Image Origination Information");
    Skip_B4(                                                    "X offset");
    Skip_B4(                                                    "Y offset");
    Skip_UTF8  (100,                                            "FileName");
    Get_UTF8   (12,  CreationDate,                              "Creation Date");
    Get_UTF8   (12,  CreationTime,                              "Creation Time");
    Skip_UTF8(64,                                               "Input device");
    Skip_UTF8(32,                                               "Input device model number");
    Skip_UTF8(32,                                               "Input device serial number");
    Skip_BF4(                                                   "X input device pitch");
    Skip_BF4(                                                   "Y input device pitch");
    Skip_BF4(                                                   "Image gamma of capture device");
    Skip_XX(40,                                                 "Reserved for future use");
    Element_End0();

    FILLING_BEGIN();
        //Coherency tests
        if (File_Offset+Buffer_Offset+Size_Total>=Config->File_Current_Size)
            Size_Total=(int32u)(Config->File_Current_Size-(File_Offset+Buffer_Offset)); //The total size is bigger than the real size
        if (Size_Generic+Size_Industry+Size_User>Size_Header || Size_Header>Size_Total)
        {
            Reject();
            return;
        }

        //Filling sizes
        Sizes.push_back(Size_Header);
        Sizes.push_back(Size_Industry);
        Sizes.push_back(Size_User);
        Sizes.push_back(Size_Header-(Size_Generic+Size_Industry+Size_User)); //Size of padding
        Sizes.push_back(Size_Total-Size_Header); //Size of image

        //Filling meta
        if (Frame_Count==0)
        {
            Fill(Stream_General, 0, General_Encoded_Date, CreationDate+__T(' ')+CreationTime); //ToDo: transform it in UTC
            Fill(StreamKind_Last, StreamPos_Last, "Encoded_Date", CreationDate+__T(' ')+CreationTime); //ToDo: transform it in UTC
            Fill(StreamKind_Last, StreamPos_Last, "Format", "Cineom");
            if (Version.size()>2 && Version[0]=='V' && Version[1]>='0' && Version[2]<='9')
                Version.insert(1, "ersion ");
            Fill(StreamKind_Last, StreamPos_Last, "Format_Version", Version);
            Fill(Stream_General, 0, General_Format_Version, Version);
        }
    FILLING_END();
}
示例#24
0
//---------------------------------------------------------------------------
// Packet "B3" or "B6"
void File_AvsV::picture_start()
{
    //Counting
    if (File_Offset+Buffer_Offset+Element_Size==File_Size)
        Frame_Count_Valid=Frame_Count; //Finalize frames in case of there are less than Frame_Count_Valid frames
    Frame_Count++;

    //Name
    Element_Name("picture_start");
    Element_Info(Ztring::ToZtring(Frame_Count));
    if (Element_Code==0xB3)
        Element_Info(_T("I"));

    //Parsing
    int8u picture_coding_type=(int8u)-1;
    bool time_code_flag, progressive_frame, picture_structure=true, top_field_first, repeat_first_field, skip_mode_flag=false, loop_filter_disable;
    Skip_B2(                                                    "bbv_delay");
    BS_Begin();
    if (Element_Code==0xB3) //Only I
    {
        Get_SB (    time_code_flag,                             "time_code_flag");
        if (time_code_flag)
        {
            Skip_SB(                                            "time_code_dropframe");
            Skip_S1(5,                                          "time_code_hours");
            Skip_S1(6,                                          "time_code_minutes");
            Skip_S1(6,                                          "time_code_seconds");
            Skip_S1(6,                                          "time_code_pictures");
        }
    }
    if (Element_Code==0xB6) //Only P or B
    {
        Get_S1 ( 2, picture_coding_type,                        "picture_coding_type"); Element_Info(AvsV_picture_coding_type[picture_coding_type]);
    }
    Skip_S1( 8,                                                 "picture_distance");
    if (low_delay)
        Skip_UE(                                                "bbv_check_times");
    Get_SB (    progressive_frame,                              "progressive_frame");
    if (!progressive_frame)
    {
        Get_SB(    picture_structure,                           "picture_structure");
        if (Element_Code==0xB6) //Only P or B
        {
            if (picture_structure)
                Skip_SB(                                        "advanced_pred_mode_disable");
        }
    }
    Get_SB (    top_field_first,                                "top_field_first");
    Get_SB (    repeat_first_field,                             "repeat_first_field");
    Skip_SB(                                                    "fixed_picture_qp");
    Skip_S1( 6,                                                 "picture_qp");
    if (Element_Code==0xB3) //Only I
    {
        if (!progressive_frame && !picture_structure)
            Get_SB(    skip_mode_flag,                          "skip_mode_flag");
    }
    if (Element_Code==0xB6) //Only P or B
    {
        if (picture_coding_type!=2 || !picture_structure)
            Skip_SB(                                            "picture_reference_flag");
    }
    Skip_SB(                                                    "reserved");
    Skip_SB(                                                    "reserved");
    Skip_SB(                                                    "reserved");
    Skip_SB(                                                    "reserved");
    if (Element_Code==0xB6) //Only P or B
    {
        Get_SB(    skip_mode_flag,                              "skip_mode_flag");
    }
    Get_SB (    loop_filter_disable,                            "loop_filter_disable");
    if (!loop_filter_disable)
    {
        bool loop_filter_parameter_flag;
        Get_SB (    loop_filter_parameter_flag,                 "loop_filter_parameter_flag");
        if (loop_filter_parameter_flag)
        {
            Skip_SE(                                            "alpha_c_offset");
            Skip_SE(                                            "beta_offset");
        }
    }
    BS_End();

    if (Element_Size-Element_Offset)
        Skip_XX(Element_Size-Element_Offset,                    "Unknown");

    FILLING_BEGIN();
        if (progressive_frame==false)
        {
            if (picture_structure==true)           //Frame
            {
                if (top_field_first)
                    Interlaced_Top++;
                else
                    Interlaced_Bottom++;
            }
        }
        else
            progressive_frame_Count++;

        //NextCode
        NextCode_Test();
        NextCode_Clear();
        for (int8u Pos=0x00; Pos<=0xAF; Pos++)
            NextCode_Add(Pos); //slice
        NextCode_Add(0xB0); //video_sequence_start
        NextCode_Add(0xB3); //picture_start
        NextCode_Add(0xB6); //picture_start

        //Autorisation of other streams
        for (int8u Pos=0x00; Pos<=0xAF; Pos++)
            Streams[Pos].Searching_Payload=true; //slice

        //Filling only if not already done
        if (Frame_Count>=Frame_Count_Valid && Count_Get(Stream_Video)==0)
        {
            //No need of more
            Accept("AVS Video");
            Finish("AVS Video");
        }
    FILLING_END();
}
示例#25
0
//---------------------------------------------------------------------------
void File_Dpx::GenericSectionHeader_Dpx()
{
    Element_Name("Generic section header");

    //Parsing
    Element_Begin1("File information");
    std::string Version, CreationDate, Creator, Project, Copyright;
    int32u Size_Header, Size_Total, Size_Generic, Size_Industry, Size_User;
    Skip_String(4,                                              "Magic number");
    Get_X4 (Size_Header,                                        "Offset to image data");
    Get_String(8, Version,                                      "Version number of header format");
    Get_X4 (Size_Total,                                         "Total image file size");
    Skip_B4(                                                    "Ditto Key");
    Get_X4 (Size_Generic,                                       "Generic section header length");
    Get_X4 (Size_Industry,                                      "Industry specific header length");
    Get_X4 (Size_User,                                          "User-defined header length");
    Skip_UTF8  (100,                                            "FileName");
    Get_String (24,  CreationDate,                              "Creation Date");
    Get_String (100, Creator,                                   "Creator");
    Get_String (200, Project,                                   "Project");
    Get_String (200, Copyright,                                 "Right to use or copyright statement");
    Skip_B4(                                                    "Encryption key");
    Skip_XX(104,                                                "Reserved for future use");
    Element_End0();

    Element_Begin1("Image information");
    int32u Width, Height, PAR_H, PAR_V;
    int16u ImageElements;
    Info_B2(ImageOrientation,                                   "Image orientation");Param_Info1(DPX_Orientation[ImageOrientation]);
    Get_X2 (ImageElements,                                      "Number of image elements");
    if (ImageElements>8)
        ImageElements=8;
    Get_X4 (Width,                                              "Pixels per line");
    Get_X4 (Height,                                             "Lines per image element");
    for(int16u ImageElement=0; ImageElement<ImageElements; ImageElement++)
        GenericSectionHeader_Dpx_ImageElement();
    if (ImageElements!=8)
        Skip_XX((8-ImageElements)*72,                           "Padding");
    Skip_XX(52,                                                 "Reserved for future use");
    Element_End0();

    Element_Begin1("Image source information");
    Skip_B4(                                                    "X Offset");
    Skip_B4(                                                    "Y Offset");
    Skip_BF4(                                                   "X center");
    Skip_BF4(                                                   "Y center");
    Skip_B4(                                                    "X original size");
    Skip_B4(                                                    "Y original size");
    Skip_UTF8(100,                                              "Source image filename");
    Skip_UTF8(24,                                               "Source image date/time");
    Skip_UTF8(32,                                               "Input device name");
    Skip_UTF8(32,                                               "Input device serial number");
    Element_Begin1("Border validity");
    Skip_B2(                                                    "XL border");
    Skip_B2(                                                    "XR border");
    Skip_B2(                                                    "YT border");
    Skip_B2(                                                    "YB border");
    Element_End0();
    Get_X4 (PAR_H,                                              "Pixel ratio : horizontal");
    Get_X4 (PAR_V,                                              "Pixel ratio : vertical");

    Element_Begin1("Additional source image information");
    Skip_BF4(                                                   "X scanned size");
    Skip_BF4(                                                   "Y scanned size");
    Skip_XX(20,                                                 "Reserved for future use");
    Element_End0();

    FILLING_BEGIN();
        //Coherency tests
        if (File_Offset+Buffer_Offset+Size_Total!=Config->File_Current_Size)
            Size_Total=(int32u)(Config->File_Current_Size-(File_Offset+Buffer_Offset)); //The total size is bigger than the real size
        if (Size_Generic==(int32u)-1)
            Size_Generic=(int32u)Element_Size;
        if (Size_Industry==(int32u)-1)
            Size_Industry=0;
        if (Size_User==(int32u)-1)
            Size_User=0;
        if (Size_Generic+Size_Industry+Size_User>Size_Header || Size_Header>Size_Total)
        {
            Reject();
            return;
        }

        //Filling sizes
        Sizes.push_back(Size_Header);
        Sizes.push_back(Size_Industry);
        Sizes.push_back(Size_User);
        Sizes.push_back(Size_Header-(Size_Generic+Size_Industry+Size_User)); //Size of padding
        Sizes.push_back(Size_Total-Size_Header); //Size of image

        //Filling meta
        if (Frame_Count==0)
        {
            Fill(Stream_General, 0, General_Encoded_Date, CreationDate); //ToDo: transform it in UTC
            Fill(StreamKind_Last, StreamPos_Last, "Encoded_Date", CreationDate); //ToDo: transform it in UTC
            Fill(Stream_General, 0, General_Encoded_Library, Creator);
            Fill(StreamKind_Last, StreamPos_Last, "Encoded_Library", Creator);
            Fill(Stream_General, 0, "Project", Project); //ToDo: map to a MediaInfo field (which one?)
            Fill(Stream_General, 0, General_Copyright, Copyright);
            Fill(StreamKind_Last, StreamPos_Last, "Format", "DPX");
            if (Version.size()>2 && Version[0]=='V' && Version[1]>='0' && Version[2]<='9')
                Version.insert(1, "ersion ");
            Fill(StreamKind_Last, StreamPos_Last, "Format_Version", Version);
            Fill(Stream_General, 0, General_Format_Version, Version);

            Fill(StreamKind_Last, StreamPos_Last, "Width", Width);
            Fill(StreamKind_Last, StreamPos_Last, "Height", Height);
            if (PAR_V && PAR_H!=(int32u)-1 && PAR_V!=(int32u)-1)
                Fill(StreamKind_Last, StreamPos_Last, "PixelAspectRatio", ((float)PAR_H)/PAR_V);
            else
                Fill(StreamKind_Last, StreamPos_Last, "PixelAspectRatio", (float)1, 3);
        }
    FILLING_END();
}