//---------------------------------------------------------------------------
// ALS is detected
// Format is unknown
void File_Mpeg4_AudioSpecificConfig::ALS ()
{
    //Parsing
    BS_End();

    FILLING_BEGIN();
        //Filling
        Stream_Prepare(Stream_General);
        Fill(Stream_General, 0, General_Format, "ALS");
        Stream_Prepare(Stream_Audio);
        Fill(Stream_Audio, StreamPos_Last, Audio_Format, "ALS");
        Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "ALS");
    FILLING_END();

    std::string Riff;
    Riff.append((const char*)Buffer+Buffer_Offset, (size_t)(Element_Size-Element_Offset));
    if (Riff.find("RIFF") && Riff.find("WAVEfmt"))
    {
        #if defined(MEDIAINFO_RIFF_YES)
            //Creating the parser
            File_Riff MI;
            Open_Buffer_Init(&MI);

            //Parsing
            size_t Riff_Pos=Riff.find("RIFF");
            Skip_XX(Riff_Pos,                                   "Unknown");
            Open_Buffer_Continue(&MI, (const int8u*)Riff.c_str()+Riff_Pos, Riff.size()-Riff_Pos);
            Open_Buffer_Finalize(&MI);

            //Filling
            Merge(MI, StreamKind_Last, 0, StreamPos_Last);

            //The RIFF header is for PCM
            Clear(Stream_Audio, StreamPos_Last, Audio_ID);
            Fill(Stream_Audio, StreamPos_Last, Audio_Format, "ALS", Unlimited, true, true);
            Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "ALS", Unlimited, true, true);
            Clear(Stream_Audio, StreamPos_Last, Audio_CodecID);
            Clear(Stream_Audio, StreamPos_Last, Audio_CodecID_Hint);
            Clear(Stream_Audio, StreamPos_Last, Audio_CodecID_Url);
            Clear(Stream_Audio, StreamPos_Last, Audio_BitRate);
            Clear(Stream_Audio, StreamPos_Last, Audio_BitRate_Mode);
            Clear(Stream_Audio, StreamPos_Last, Audio_Codec_CC);

        #else
            Skip_XX(Element_Size-Element_Offset,                "(RIFF chunck)");
        #endif

    }
    else
        Skip_XX(Element_Size-Element_Offset,                    "Unknown");

    //NO need more
    Accept("AudioSpecificConfig");
    Finish("AudioSpecificConfig");
}
Ejemplo n.º 2
0
//---------------------------------------------------------------------------
void File_Flac::VORBIS_COMMENT()
{
    Element_Info("VORBIS_COMMENT");

    //Parsing
    File_VorbisCom VorbisCom;
    VorbisCom.StreamKind_Specific=Stream_Audio;
    Open_Buffer_Init(&VorbisCom, File_Size, File_Offset+Buffer_Offset);
    Open_Buffer_Continue(&VorbisCom, Buffer+Buffer_Offset, (size_t)Element_Size);
    Open_Buffer_Finalize(&VorbisCom);
    Merge(VorbisCom, Stream_General,  0, 0);
    Merge(VorbisCom, Stream_Audio,    0, 0);
    Merge(VorbisCom, Stream_Chapters, 0, 0);
}
Ejemplo n.º 3
0
//---------------------------------------------------------------------------
void File_Pdf::Object_Metadata()
{
    Element_Info1("Metadata");

    //Parsing
    string Key;
    Ztring Value;
    int32u Length=0;
    while (Element_Offset<Element_Size)
    {
        if (Get_Next(Key, Value))
        {
            for (;;)
            {
                Get_Next(Key, Value);
                if (Key.empty())
                    break;
                else if (Key=="Length")
                {
                    Length=Value.To_int32u();
                }
            }

            continue;
        }

        if (Key.empty())
            break;
        else if (Key=="stream")
        {
            //Removig end of lines
            if (Element_Offset<Element_Size && Buffer[Buffer_Offset+(size_t)Element_Offset]=='\r')
                Element_Offset++;
            if (Element_Offset<Element_Size && Buffer[Buffer_Offset+(size_t)Element_Offset]=='\n')
                Element_Offset++;

            #ifndef MEDIAINFO_TINYXML2_NO
            File_Xmp MI;
            Open_Buffer_Init(&MI, Length);
            Open_Buffer_Continue(&MI, Buffer+Buffer_Offset+(size_t)Element_Offset, Length);
            Skip_XX(Length,                                     "Stream, Data");
            Open_Buffer_Finalize(&MI);
            Merge(MI, Stream_General, 0, 0);
            #endif //MEDIAINFO_TINYXML2_NO
        }
    }
}
Ejemplo n.º 4
0
//---------------------------------------------------------------------------
void File_Mpeg4_Descriptors::Descriptor_05()
{
    if (ObjectTypeId==0x00 && Parser==NULL) //If no ObjectTypeId detected
    {
        switch (KindOfStream)
        {
            case Stream_Video :
                                #if defined(MEDIAINFO_MPEG4V_YES)
                                    Parser=new File_Mpeg4v;
                                    ((File_Mpeg4v*)Parser)->Frame_Count_Valid=1;
                                    ((File_Mpeg4v*)Parser)->FrameIsAlwaysComplete=true;
                                #endif
                                break;
            case Stream_Audio :
                                #if defined(MEDIAINFO_MPEG4_YES)
                                    Parser=new File_Mpeg4_AudioSpecificConfig;
                                #endif
                                break;
            default: ;
        }
        Open_Buffer_Init(Parser);
    }

    if (Parser==NULL)
    {
        Skip_XX(Element_Size,                                   "Unknown");
        return;
    }

    //Parser configuration before the parsing
    switch (ObjectTypeId)
    {
            case 0x60 :
            case 0x61 :
            case 0x62 :
            case 0x63 :
            case 0x64 :
            case 0x65 :
            case 0x6A : //MPEG Video
                    #if defined(MEDIAINFO_MPEGV_YES)
                        ((File_Mpegv*)Parser)->TimeCodeIsNotTrustable=true;
                    #endif
                    break;
        default: ;
    }

    //Parsing
    Open_Buffer_Continue(Parser, Buffer+Buffer_Offset, (size_t)Element_Size);
    if (!Parser_DoNotFreeIt
     || StreamKind_Last==Stream_Audio && Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)==_T("AAC")) //File_Mpeg4_AudioSpecificConfig is only for DecConfig
    {
        Open_Buffer_Finalize(Parser);

        //Filling
        Merge(*Parser, StreamKind_Last, 0, StreamPos_Last);

        delete Parser; Parser=NULL;
    }

    //Parser configuration after the parsing
    switch (ObjectTypeId)
    {
            case 0x60 :
            case 0x61 :
            case 0x62 :
            case 0x63 :
            case 0x64 :
            case 0x65 :
            case 0x6A : //MPEG Video
                    #if defined(MEDIAINFO_MPEGV_YES)
                        ((File_Mpegv*)Parser)->TimeCodeIsNotTrustable=false;
                    #endif
                    break;
        default: ;
    }

    //Positionning
    Element_Offset=Element_Size;
}