//--------------------------------------------------------------------------- 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(); }
//--------------------------------------------------------------------------- // ALS is detected // Format is unknown void File_Mpeg4_AudioSpecificConfig::ALS () { //Parsing BS_End(); FILLING_BEGIN(); //Filling Accept("AudioSpecificConfig"); 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); //Filling Finish(&MI); Merge(MI, StreamKind_Last, 0, StreamPos_Last); //The RIFF header is for PCM Clear(Stream_Audio, StreamPos_Last, Audio_ID); Clear(Stream_Audio, StreamPos_Last, Audio_Codec_String); Clear(Stream_Audio, StreamPos_Last, Audio_Codec_Family); 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 Finish("AudioSpecificConfig"); }
//--------------------------------------------------------------------------- void File_Dpg::FileHeader_Parse() { //Parsing int32u FrameCount, FrameRate, SamplingRate; Skip_C4( "Signature"); Get_L4 (FrameCount, "Frame count"); Get_L4 (FrameRate, "Frame rate"); Param_Info2(FrameRate/0x100, " fps"); Get_L4 (SamplingRate, "Sampling rate"); Skip_L4( "0x00000000"); Get_L4 (Audio_Offset, "Audio Offset"); Get_L4 (Audio_Size, "Audio Size"); Get_L4 (Video_Offset, "Video Offset"); Get_L4 (Video_Size, "Video Size"); FILLING_BEGIN(); Accept("DPG"); Fill(Stream_General, 0, General_Format, "DPG"); Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_FrameRate, (float)(FrameRate/0x100), 3); Fill(Stream_Video, 0, Video_FrameCount, FrameCount); Fill(Stream_Video, 0, Video_StreamSize, Video_Size); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_SamplingRate, SamplingRate); Fill(Stream_Audio, 0, Audio_StreamSize, Audio_Size); //Positionning #if defined(MEDIAINFO_MPEGA_YES) Parser=new File_Mpega(); Open_Buffer_Init(Parser); GoTo(Audio_Offset, "DPG"); #elif defined(MEDIAINFO_MPEGV_YES) Audio_Size=0; Parser=new File_Mpegv(); Open_Buffer_Init(Parser); GoTo(Video_Offset, "DPG"); #else Finish("DPG"); #endif FILLING_END(); }
//--------------------------------------------------------------------------- void File_Skm::Data_Parse() { #if defined(MEDIAINFO_MPEG4V_YES) Stream.Parser=new File_Mpeg4v(); ((File_Mpeg4v*)Stream.Parser)->FrameIsAlwaysComplete=true; ((File_Mpeg4v*)Stream.Parser)->OnlyVOP(); Open_Buffer_Init(Stream.Parser); Open_Buffer_Continue(Stream.Parser); Finish("SKM"); #endif }
//--------------------------------------------------------------------------- void File_SmpteSt0302::Streams_Accept() { #ifdef MEDIAINFO_SMPTEST0337_YES // SMPTE ST 337 { File_SmpteSt0337* SmpteSt0337=new File_SmpteSt0337(); SmpteSt0337->Container_Bits=(4+bits_per_sample)*4; SmpteSt0337->Endianness='L'; SmpteSt0337->Aligned=true; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_Level=4; //Intermediate SmpteSt0337->Demux_Level=2; //Container SmpteSt0337->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX #if MEDIAINFO_EVENTS SmpteSt0337->IgnoreGuardBandTest=true; #endif //MEDIAINFO_EVENTS Parsers.push_back(SmpteSt0337); } #endif // MEDIAINFO_SMPTEST0337_YES #ifdef MEDIAINFO_PCM_YES // Raw PCM { File_Pcm* Pcm=new File_Pcm(); Pcm->Codec.From_Local("SMPTE ST 302"); Pcm->BitDepth=(4+bits_per_sample)*4; Pcm->Channels=(1+number_channels)*2; Pcm->SamplingRate=48000; Pcm->Endianness='L'; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_Level=4; //Intermediate Pcm->Demux_Level=2; //Container Pcm->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX Parsers.push_back(Pcm); } // Init for (size_t Pos=0; Pos<Parsers.size(); Pos++) Open_Buffer_Init(Parsers[Pos]); #endif // MEDIAINFO_PCM_YES //Time stamps Frequency_b=48000; }
//--------------------------------------------------------------------------- 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); }
//--------------------------------------------------------------------------- void File_Flac::VORBIS_COMMENT() { //Parsing #if defined(MEDIAINFO_VORBISCOM_YES) File_VorbisCom VorbisCom; VorbisCom.StreamKind_Specific=Stream_Audio; Open_Buffer_Init(&VorbisCom); Open_Buffer_Continue(&VorbisCom); File__Analyze::Finish(&VorbisCom); Merge(VorbisCom, Stream_General, 0, 0); Merge(VorbisCom, Stream_Audio, 0, 0); Merge(VorbisCom, Stream_Menu, 0, 0); #else Skip_XX(Element_Offset, "Data"); #endif }
//--------------------------------------------------------------------------- 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 } } }
//--------------------------------------------------------------------------- void File_Dpg::Read_Buffer_Continue() { if (!Parser) return; //Not ready #if defined(MEDIAINFO_MPEGA_YES) || defined(MEDIAINFO_MPEGV_YES) if (Audio_Size) { #if defined(MEDIAINFO_MPEGA_YES) Open_Buffer_Continue(Parser, (size_t)((File_Offset+Buffer_Size<Audio_Offset+Audio_Size)?Buffer_Size:(Audio_Offset+Audio_Size-File_Offset))); if (Parser->Status[IsAccepted]) { Parser->Open_Buffer_Unsynch(); Finish(Parser); Merge(*Parser, Stream_Audio, 0, 0); #if defined(MEDIAINFO_MPEGV_YES) Audio_Size=0; Data_GoTo(Video_Offset, "DPG"); delete Parser; Parser=new File_Mpegv(); Open_Buffer_Init(Parser); #else Finish("DPG"); #endif } #endif } else { #if defined(MEDIAINFO_MPEGV_YES) Open_Buffer_Continue(Parser, (size_t)((File_Offset+Buffer_Size<Video_Offset+Video_Size)?Buffer_Size:(Video_Offset+Video_Size-File_Offset))); if (Parser->Status[IsAccepted]) { //Merging Parser->Open_Buffer_Unsynch(); Finish(Parser); Merge(*Parser, Stream_Video, 0, 0); Finish("DPG"); } #endif } #endif //defined(MEDIAINFO_MPEGA_YES) || defined(MEDIAINFO_MPEGV_YES) //Positioning Buffer_Offset=Buffer_Size; //We have already parsed this data }
//--------------------------------------------------------------------------- void File_Scc::FileHeader_Parse() { Skip_String(18, "Magic"); while (Element_Offset<Buffer_Size) { if (Buffer[(size_t)Element_Offset]!=0x0D && Buffer[(size_t)Element_Offset]!=0x0A) break; Element_Offset++; } Accept(); Fill(Stream_General, 0, General_Format, "SCC"); //Init Parser=new File_Eia608(); Open_Buffer_Init(Parser); }
//--------------------------------------------------------------------------- void File_ChannelGrouping::Read_Buffer_Init() { if (Common==NULL) { Common=new common; Common->Parser=new File_Aes3; ((File_Aes3*)Common->Parser)->SampleRate=SampleRate; ((File_Aes3*)Common->Parser)->ByteSize=ByteDepth*Channel_Total; Common->Channels.resize(Channel_Total); for (size_t Pos=0; Pos<Common->Channels.size(); Pos++) Common->Channels[Pos]=new common::channel; Open_Buffer_Init(Common->Parser); } Accept(); //Forcing acceptance, no possibility to choose something else or detect PCM #if MEDIAINFO_DEMUX Demux_UnpacketizeContainer=Config->Demux_Unpacketize_Get(); #endif //MEDIAINFO_DEMUX }
//--------------------------------------------------------------------------- void File_DtvccTransport::CreateStream(int8u Parser_Pos) { if (Streams[Parser_Pos]) return; //Already done //Parsing #if MEDIAINFO_DEMUX Element_Code=Parser_Pos; #endif //MEDIAINFO_DEMUX //Creation of the parser Streams[Parser_Pos]=new stream; #if defined(MEDIAINFO_EIA608_YES) || defined(MEDIAINFO_EIA708_YES) if (Parser_Pos<2) { #if defined(MEDIAINFO_EIA608_YES) Streams[Parser_Pos]->Parser=new File_Eia608(); ((File_Eia608*)Streams[Parser_Pos]->Parser)->cc_type=Parser_Pos; #else //defined(MEDIAINFO_EIA608_YES) Streams[Parser_Pos]->Parser=new File__Analyze(); #endif //defined(MEDIAINFO_EIA608_YES) } else { #if defined(MEDIAINFO_EIA708_YES) Streams[Parser_Pos]->Parser=new File_Eia708(); #else //defined(MEDIAINFO_EIA708_YES) Streams[Parser_Pos]->Parser=new File__Analyze(); #endif //defined(MEDIAINFO_EIA708_YES) } #else //defined(MEDIAINFO_EIA608_YES) || defined(MEDIAINFO_EIA708_YES) Streams[Parser_Pos]->Parser=new File__Analyze(); #endif //defined(MEDIAINFO_EIA608_YES) || defined(MEDIAINFO_EIA708_YES) //Init Streams[Parser_Pos]->Parser->ServiceDescriptors=ServiceDescriptors; Open_Buffer_Init(Streams[Parser_Pos]->Parser); Streams[Parser_Pos]->Parser->Accept(); }
//--------------------------------------------------------------------------- void File_Tak::WAVEMETADATA() { //Parsing int32u HeaderLength, FooterLength; Get_L3 (HeaderLength, "HeaderLength"); Get_L3 (FooterLength, "FooterLength"); #if defined(MEDIAINFO_RIFF_YES) //Creating the parser File_Riff MI; Open_Buffer_Init(&MI); //Parsing Open_Buffer_Continue(&MI, HeaderLength); Element_Offset+=HeaderLength; //Filling //Finish(&MI); //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, "TAK", Unlimited, true, true); //Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "TAK", 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(HeaderLength, "Wave header"); #endif if (FooterLength) Skip_XX(FooterLength, "Wave footer"); Skip_L3( "crc"); }
//--------------------------------------------------------------------------- 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) delete Parser; Parser=new File_Mpeg4v; ((File_Mpeg4v*)Parser)->FrameIsAlwaysComplete=true; #endif break; case Stream_Audio : #if defined(MEDIAINFO_AAC_YES) delete Parser; Parser=new File_Aac; ((File_Aac*)Parser)->Mode=File_Aac::Mode_AudioSpecificConfig; #endif break; default: ; } Element_Code=(int64u)-1; 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); //Demux #if MEDIAINFO_DEMUX if (ObjectTypeId!=0x21 || !Config->Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10_Get()) //0x21 is AVC switch (Config->Demux_InitData_Get()) { case 0 : //In demux event Demux_Level=2; //Container Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_Header); break; case 1 : //In field { std::string Data_Raw((const char*)(Buffer+Buffer_Offset), (size_t)Element_Size); std::string Data_Base64(Base64::encode(Data_Raw)); Parser->Fill(KindOfStream, PosOfStream, "Demux_InitBytes", Data_Base64); if (PosOfStream<(*Parser->Stream_More)[KindOfStream].size()) (*Parser->Stream_More)[KindOfStream][PosOfStream](Ztring().From_Local("Demux_InitBytes"), Info_Options)=__T("N NT"); } break; default : ; } #endif //MEDIAINFO_DEMUX //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; }
//--------------------------------------------------------------------------- void File_Mpeg4_Descriptors::Descriptor_04() { //Parsing int32u bufferSizeDB, MaxBitrate, AvgBitrate; int8u streamType; Get_B1 (ObjectTypeId, "objectTypeIndication"); Param_Info1(Mpeg4_Descriptors_ObjectTypeIndication(ObjectTypeId)); BS_Begin(); Get_S1 (6, streamType, "streamType"); Param_Info1(Mpeg4_Descriptors_StreamType(streamType)); Skip_SB( "upStream"); Skip_SB( "reserved"); BS_End(); Get_B3 (bufferSizeDB, "bufferSizeDB"); Get_B4 (MaxBitrate, "maxBitrate"); Get_B4 (AvgBitrate, "avgBitrate"); FILLING_BEGIN(); if (KindOfStream==Stream_Max) switch (ObjectTypeId) { case 0x20 : case 0x21 : case 0x60 : case 0x61 : case 0x62 : case 0x63 : case 0x64 : case 0x65 : case 0x6A : case 0x6C : case 0x6D : case 0x6E : case 0xA3 : case 0xA4 : KindOfStream=Stream_Video; break; case 0x40 : case 0x66 : case 0x67 : case 0x68 : case 0x69 : case 0x6B : case 0xA0 : case 0xA1 : case 0xA5 : case 0xA6 : case 0xA9 : case 0xAA : case 0xAB : case 0xAC : case 0xD1 : case 0xD3 : case 0xD4 : case 0xE1 : KindOfStream=Stream_Audio; break; case 0x08 : KindOfStream=Stream_Text; break; default: ; } if (Count_Get(KindOfStream)==0) Stream_Prepare(KindOfStream); switch (ObjectTypeId) { case 0x01 : Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Format), "System", Error, false, true); break; case 0x02 : Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Format), "System Core", Error, false, true); break; //case 0x03 Interaction Stream //case 0x05 AFX //case 0x06 Font Data //case 0x07 Synthesized Texture Stream case 0x08 : Fill(Stream_Text , StreamPos_Last, Text_Format, "Streaming Text", Error, false, true); break; case 0x20 : Fill(Stream_Video , StreamPos_Last, Video_Format, "MPEG-4 Visual", Error, false, true); break; case 0x21 : Fill(Stream_Video , StreamPos_Last, Video_Format, "AVC", Error, false, true); break; //case 0x22 Parameter Sets for AVC case 0x40 : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "AAC", Error, false, true); break; //MPEG-4 AAC case 0x60 : Fill(Stream_Video , StreamPos_Last, Video_Format, "MPEG Video", Error, false, true); Fill(Stream_Video, StreamPos_Last, Video_Format_Profile, "Simple" , Error, false, true); Fill(Stream_Video, StreamPos_Last, Video_Format_Version, "Version 2", Error, false, true); break; //MPEG-2V Simple case 0x61 : Fill(Stream_Video , StreamPos_Last, Video_Format, "MPEG Video", Error, false, true); Fill(Stream_Video, StreamPos_Last, Video_Format_Profile, "Main" , Error, false, true); Fill(Stream_Video, StreamPos_Last, Video_Format_Version, "Version 2", Error, false, true); break; //MPEG-2V Main case 0x62 : Fill(Stream_Video , StreamPos_Last, Video_Format, "MPEG Video", Error, false, true); Fill(Stream_Video, StreamPos_Last, Video_Format_Profile, "SNR" , Error, false, true); Fill(Stream_Video, StreamPos_Last, Video_Format_Version, "Version 2", Error, false, true); break; //MPEG-2V SNR case 0x63 : Fill(Stream_Video , StreamPos_Last, Video_Format, "MPEG Video", Error, false, true); Fill(Stream_Video, StreamPos_Last, Video_Format_Profile, "Spatial", Error, false, true); Fill(Stream_Video, StreamPos_Last, Video_Format_Version, "Version 2", Error, false, true); break; //MPEG-2V Spatial case 0x64 : Fill(Stream_Video , StreamPos_Last, Video_Format, "MPEG Video", Error, false, true); Fill(Stream_Video, StreamPos_Last, Video_Format_Profile, "High" , Error, false, true); Fill(Stream_Video, StreamPos_Last, Video_Format_Version, "Version 2", Error, false, true); break; //MPEG-2V High case 0x65 : Fill(Stream_Video , StreamPos_Last, Video_Format, "MPEG Video", Error, false, true); Fill(Stream_Video, StreamPos_Last, Video_Format_Profile, "4:2:2" , Error, false, true); Fill(Stream_Video, StreamPos_Last, Video_Format_Version, "Version 2", Error, false, true); break; //MPEG-2V 4:2:2 case 0x66 : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "AAC", Error, false, true); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Profile, "Main", Error, false, true); break; //MPEG-2 AAC Main case 0x67 : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "AAC", Error, false, true); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Profile, "LC", Error, false, true); break; //MPEG-2 AAC LC case 0x68 : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "AAC", Error, false, true); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Profile, "SSR", Error, false, true); break; //MPEG-2 AAC SSR case 0x69 : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "MPEG Audio", Error, false, true); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Version, "Version 2", Error, false, true); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Profile, "Layer 3", Error, false, true); break; case 0x6A : Fill(Stream_Video , StreamPos_Last, Video_Format, "MPEG Video", Error, false, true); Fill(Stream_Video, StreamPos_Last, Video_Format_Version, "Version 1", Error, false, true); break; case 0x6B : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "MPEG Audio", Error, false, true); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Version, "Version 1", Error, false, true); break; case 0x6C : Fill(Stream_Video , StreamPos_Last, Video_Format, "JPEG", Error, false, true); break; case 0x6D : Fill(Stream_Video , StreamPos_Last, Video_Format, "PNG", Error, false, true); break; case 0x6E : Fill(Stream_Video , StreamPos_Last, Video_Format, "MPEG Video", Error, false, true); break; case 0xA0 : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "EVRC", Error, false, true); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, 8000, 10, true); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, 1, 10, true); break; case 0xA1 : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "SMV", Error, false, true); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, 8000, 10, true); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, 1, 10, true); break; case 0xA2 : Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Format), "3GPP2", Error, false, true); break; case 0xA3 : Fill(Stream_Video , StreamPos_Last, Video_Format, "VC-1", Error, false, true); break; case 0xA4 : Fill(Stream_Video , StreamPos_Last, Video_Format, "Dirac", Error, false, true); break; case 0xA5 : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "AC-3", Error, false, true); break; case 0xA6 : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "E-AC-3", Error, false, true); break; case 0xA9 : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "DTS", Error, false, true); break; case 0xAA : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "DTS", Error, false, true); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Profile, "HRA", Error, false, true); break; // DTS-HD High Resolution case 0xAB : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "DTS", Error, false, true); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Profile, "MA", Error, false, true); break; // DTS-HD Master Audio case 0xAC : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "DTS", Error, false, true); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Profile, "Express", Error, false, true); break; // DTS Express a.k.a. LBR case 0xD1 : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "EVRC", Error, false, true); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, 8000, 10, true); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, 1, 10, true); break; case 0xD3 : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "AC-3", Error, false, true); break; case 0xD4 : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "DTS", Error, false, true); break; case 0xDD : Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Format), "Ogg", Error, false, true); break; case 0xDE : Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Format), "Ogg", Error, false, true); break; case 0xE1 : Fill(Stream_Audio , StreamPos_Last, Audio_Format, "QCELP", Error, false, true); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, 8000, 10, true); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, 1, 10, true); break; default: ; } switch (ObjectTypeId) { case 0x01 : Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec), "System", Error, false, true); break; case 0x02 : Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec), "System Core", Error, false, true); break; case 0x20 : Fill(Stream_Video , StreamPos_Last, Video_Codec, "MPEG-4V", Error, false, true); break; case 0x21 : Fill(Stream_Video , StreamPos_Last, Video_Codec, "H264", Error, false, true); break; case 0x40 : Fill(Stream_Audio , StreamPos_Last, Audio_Codec, "AAC", Error, false, true); break; //MPEG-4 AAC case 0x60 : Fill(Stream_Video , StreamPos_Last, Video_Codec, "MPEG-2V", Error, false, true); break; //MPEG-2V Simple case 0x61 : Fill(Stream_Video , StreamPos_Last, Video_Codec, "MPEG-2V", Error, false, true); break; //MPEG-2V Main case 0x62 : Fill(Stream_Video , StreamPos_Last, Video_Codec, "MPEG-2V", Error, false, true); break; //MPEG-2V SNR case 0x63 : Fill(Stream_Video , StreamPos_Last, Video_Codec, "MPEG-2V", Error, false, true); break; //MPEG-2V Spatial case 0x64 : Fill(Stream_Video , StreamPos_Last, Video_Codec, "MPEG-2V", Error, false, true); break; //MPEG-2V High case 0x65 : Fill(Stream_Video , StreamPos_Last, Video_Codec, "MPEG-2V", Error, false, true); break; //MPEG-2V 4:2:2 case 0x66 : Fill(Stream_Audio , StreamPos_Last, Audio_Codec, "AAC", Error, false, true); break; //MPEG-2 AAC Main case 0x67 : Fill(Stream_Audio , StreamPos_Last, Audio_Codec, "AAC", Error, false, true); break; //MPEG-2 AAC LC case 0x68 : Fill(Stream_Audio , StreamPos_Last, Audio_Codec, "AAC", Error, false, true); break; //MPEG-2 AAC SSR case 0x69 : Fill(Stream_Audio , StreamPos_Last, Audio_Codec, "MPEG-2A L3", Error, false, true); break; case 0x6A : Fill(Stream_Video , StreamPos_Last, Video_Codec, "MPEG-1V", Error, false, true); break; case 0x6B : Fill(Stream_Audio , StreamPos_Last, Audio_Codec, "MPEG-1A", Error, false, true); break; case 0x6C : Fill(Stream_Video , StreamPos_Last, Video_Codec, "JPEG", Error, false, true); break; case 0x6D : Fill(Stream_Video , StreamPos_Last, Video_Codec, "PNG", Error, false, true); break; case 0x6E : Fill(Stream_Video , StreamPos_Last, Video_Codec, "MPEG-4V", Error, false, true); break; case 0xA0 : Fill(Stream_Video , StreamPos_Last, Video_Codec, "EVRC", Error, false, true); break; case 0xA1 : Fill(Stream_Video , StreamPos_Last, Video_Codec, "SMV", Error, false, true); break; case 0xA2 : Fill(Stream_Video , StreamPos_Last, Video_Codec, "MPEG-4V", Error, false, true); break; case 0xA3 : Fill(Stream_Audio , StreamPos_Last, Audio_Codec, "VC-1", Error, false, true); break; case 0xA4 : Fill(Stream_Audio , StreamPos_Last, Audio_Codec, "Dirac", Error, false, true); break; case 0xA5 : Fill(Stream_Audio , StreamPos_Last, Audio_Codec, "AC3", Error, false, true); break; case 0xA6 : Fill(Stream_Audio , StreamPos_Last, Audio_Codec, "AC3+", Error, false, true); break; case 0xA9 : Fill(Stream_Audio , StreamPos_Last, Audio_Codec, "DTS", Error, false, true); break; case 0xAA : case 0xAB : Fill(Stream_Audio , StreamPos_Last, Audio_Codec, "DTS-HD", Error, false, true); break; case 0xAC : Fill(Stream_Audio , StreamPos_Last, Audio_Codec, "DTS Express", Error, false, true); break; case 0xD1 : Fill(Stream_Audio , StreamPos_Last, Audio_Codec, "EVRC", Error, false, true); break; case 0xD3 : Fill(Stream_Audio , StreamPos_Last, Audio_Codec, "AC3", Error, false, true); break; case 0xD4 : Fill(Stream_Audio , StreamPos_Last, Audio_Codec, "DTS", Error, false, true); break; case 0xDD : Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec), "Ogg", Error, false, true); break; case 0xDE : Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec), "Ogg", Error, false, true); break; case 0xE1 : Fill(Stream_Audio , StreamPos_Last, Audio_Codec, "QCELP", Error, false, true); break; default: ; } Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_CodecID), ObjectTypeId, 16, true); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec_CC), ObjectTypeId, 16, true); //Bitrate mode if (AvgBitrate>0 && !(bufferSizeDB==AvgBitrate && bufferSizeDB==MaxBitrate && bufferSizeDB==0x1000)) //Some buggy data were found { Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_BitRate_Nominal), AvgBitrate); if (MaxBitrate<=AvgBitrate*1.005) Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_BitRate_Mode), "CBR"); else { Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_BitRate_Mode), "VBR"); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_BitRate_Maximum), MaxBitrate); } } //Creating parser delete Parser; Parser=NULL; switch (ObjectTypeId) { case 0x01 : switch (streamType) { case 0x01 : Parser=new File_Mpeg4_Descriptors; break; default : ; } break; case 0x20 : //MPEG-4 Visual #if defined(MEDIAINFO_MPEG4V_YES) Parser=new File_Mpeg4v; ((File_Mpeg4v*)Parser)->Frame_Count_Valid=1; ((File_Mpeg4v*)Parser)->FrameIsAlwaysComplete=true; #endif break; case 0x21 : //AVC #if defined(MEDIAINFO_AVC_YES) Parser=new File_Avc; ((File_Avc*)Parser)->MustParse_SPS_PPS=true; ((File_Avc*)Parser)->MustSynchronize=false; ((File_Avc*)Parser)->SizedBlocks=true; #endif break; case 0x40 : //MPEG-4 AAC case 0x66 : case 0x67 : case 0x68 : //MPEG-2 AAC #if defined(MEDIAINFO_AAC_YES) Parser=new File_Aac; ((File_Aac*)Parser)->Mode=File_Aac::Mode_AudioSpecificConfig; ((File_Aac*)Parser)->FrameIsAlwaysComplete=true; #endif break; case 0x60 : case 0x61 : case 0x62 : case 0x63 : case 0x64 : case 0x65 : case 0x6A : //MPEG Video #if defined(MEDIAINFO_MPEGV_YES) Parser=new File_Mpegv; ((File_Mpegv*)Parser)->FrameIsAlwaysComplete=true; #endif break; case 0x69 : case 0x6B : //MPEG Audio #if defined(MEDIAINFO_MPEGA_YES) Parser=new File_Mpega; #endif break; case 0x6C : //JPEG #if defined(MEDIAINFO_JPEG_YES) Parser=new File_Jpeg; ((File_Jpeg*)Parser)->StreamKind=Stream_Video; #endif break; case 0x6D : //PNG #if defined(MEDIAINFO_PNG_YES) Parser=new File_Png; #endif break; case 0xA3 : //VC-1 #if defined(MEDIAINFO_VC1_YES) Parser=new File_Vc1; #endif break; case 0xA4 : //Dirac #if defined(MEDIAINFO_DIRAC_YES) Parser=new File_Dirac; #endif break; case 0xA5 : //AC-3 case 0xA6 : //E-AC-3 case 0xD3 : //AC-3 #if defined(MEDIAINFO_AC3_YES) Parser=new File_Ac3; #endif break; case 0xA9 : //DTS case 0xAA : //DTS HRA case 0xAB : //DTS MA case 0xAC : //DTS Express case 0xD4 : //DTS #if defined(MEDIAINFO_DTS_YES) Parser=new File_Dts; #endif break; case 0xDD : case 0xDE : //OGG #if defined(MEDIAINFO_OGG_YES) Parser=new File_Ogg; Parser->MustSynchronize=false; ((File_Ogg*)Parser)->SizedBlocks=true; #endif break; default: ; } Element_Code=(int64u)-1; Open_Buffer_Init(Parser); Element_ThisIsAList(); FILLING_END(); }
//--------------------------------------------------------------------------- void File_Ogg::Data_Parse() { //Counting Frame_Count++; //If first chunk of a stream stream& Stream_Item=Stream[Element_Code]; //[+] FlylinkDC++ Team if (Stream_Item.Parser==NULL) { if (Parsing_End) return; //Maybe multitracks concatained, not supported Stream_Item.Parser=new File_Ogg_SubElement; Open_Buffer_Init(Stream_Item.Parser); ((File_Ogg_SubElement*)Stream_Item.Parser)->InAnotherContainer=IsSub; StreamsToDo++; } ((File_Ogg_SubElement*)Stream_Item.Parser)->MultipleStreams=Stream.size()>1; //has no sens for the first init, must check allways //Parsing File_Ogg_SubElement* Parser=(File_Ogg_SubElement*)Stream_Item.Parser; if (Stream_Item.SearchingPayload) //For each chunk for (size_t Chunk_Sizes_Pos=0; Chunk_Sizes_Pos<Chunk_Sizes.size(); Chunk_Sizes_Pos++) { //Info if (!continued) Peek_L1(packet_type); //Only for information Element_Info1(Ztring::ToZtring(packet_type, 16)); Element_Info1C((continued), "Continue"); //Parsing if (continued || Parser->File_Offset!=Parser->File_Size) Open_Buffer_Continue(Parser, Buffer+Buffer_Offset+(size_t)Element_Offset, Chunk_Sizes[Chunk_Sizes_Pos]); if (Chunk_Sizes_Pos<Chunk_Sizes.size()-1 || (Chunk_Sizes_Pos==Chunk_Sizes.size()-1 && Chunk_Sizes_Finished)) { Open_Buffer_Continue(Parser, Buffer+Buffer_Offset, 0); //Purge old datas } Element_Offset+=Chunk_Sizes[Chunk_Sizes_Pos]; continued=false; //If there is another chunk, this can not be a continued chunk if (Parser->File_GoTo!=(int64u)-1) Chunk_Sizes_Pos=Chunk_Sizes.size(); if (!Status[IsAccepted] && Parser->Status[IsAccepted]) Accept("OGG"); if (Parser->Status[IsFinished] || (Element_Offset==Element_Size && eos)) { StreamsToDo--; Stream_Item.SearchingPayload=false; break; } } else Skip_XX(Element_Size, "Data"); //End of stream if (!Parsing_End && (StreamsToDo==0 || File_Offset+Buffer_Offset+Element_Offset>256*1024)) { if (IsSub) Finish("OGG"); else GoToFromEnd(256*1024, "OGG"); std::map<int64u, stream>::iterator Stream_Temp=Stream.begin(); if (File_GoTo!=(int64u)-1) while (Stream_Temp!=Stream.end()) { Stream_Temp->second.absolute_granule_position=0; ++Stream_Temp; } Parsing_End=true; } Element_Show(); }
//--------------------------------------------------------------------------- void File_Cdp::ccdata_section() { //Parsing int8u cc_count; Element_Begin1("ccdata_section"); Skip_B1( "ccdata_id"); BS_Begin(); Mark_1(); Mark_1(); Mark_1(); Get_S1 (5, cc_count, "cc_count"); BS_End(); for (int8u Pos=0; Pos<cc_count; Pos++) { Element_Begin1("cc"); int8u cc_type; bool cc_valid; BS_Begin(); Mark_1(); Mark_1(); Mark_1(); Mark_1(); Mark_1(); Get_SB ( cc_valid, "cc_valid"); Get_S1 (2, cc_type, "cc_type"); Param_Info1(Cdp_cc_type(cc_type)); BS_End(); if (cc_valid) { Element_Begin1("cc_data"); //Calculating the parser position int8u Parser_Pos=cc_type==3?2:cc_type; //cc_type 2 and 3 are for the same text //Parsing #if MEDIAINFO_DEMUX Element_Code=Parser_Pos; #endif //MEDIAINFO_DEMUX if (Streams[Parser_Pos]==NULL) Streams[Parser_Pos]=new stream; if (Streams[Parser_Pos]->Parser==NULL) { #if defined(MEDIAINFO_EIA608_YES) || defined(MEDIAINFO_EIA708_YES) if (cc_type<2) { #if defined(MEDIAINFO_EIA608_YES) Streams[Parser_Pos]->Parser=new File_Eia608(); ((File_Eia608*)Streams[Parser_Pos]->Parser)->cc_type=cc_type; #else //defined(MEDIAINFO_EIA608_YES) Streams[Parser_Pos]->Parser=new File__Analyze(); #endif //defined(MEDIAINFO_EIA608_YES) } else { #if defined(MEDIAINFO_EIA708_YES) Streams[Parser_Pos]->Parser=new File_Eia708(); #else //defined(MEDIAINFO_EIA708_YES) Streams[Parser_Pos]->Parser=new File__Analyze(); #endif //defined(MEDIAINFO_EIA708_YES) } #else //defined(MEDIAINFO_EIA608_YES) || defined(MEDIAINFO_EIA708_YES) Streams[Parser_Pos]->Parser=new File__Analyze(); #endif //defined(MEDIAINFO_EIA608_YES) || defined(MEDIAINFO_EIA708_YES) Open_Buffer_Init(Streams[Parser_Pos]->Parser); } Demux(Buffer+(size_t)(Buffer_Offset+Element_Offset), 2, ContentType_MainStream); if (!Streams[Parser_Pos]->Parser->Status[IsFinished]) { if (Streams[Parser_Pos]->Parser->PTS_DTS_Needed) { Streams[Parser_Pos]->Parser->FrameInfo.PCR=FrameInfo.PCR; Streams[Parser_Pos]->Parser->FrameInfo.PTS=FrameInfo.PTS; Streams[Parser_Pos]->Parser->FrameInfo.DTS=FrameInfo.DTS; } if (Parser_Pos==2) { #if defined(MEDIAINFO_EIA708_YES) ((File_Eia708*)Streams[2]->Parser)->cc_type=cc_type; if (AspectRatio) ((File_Eia708*)Streams[2]->Parser)->AspectRatio=AspectRatio; #endif //defined(MEDIAINFO_EIA708_YES) } Open_Buffer_Continue(Streams[Parser_Pos]->Parser, Buffer+(size_t)(Buffer_Offset+Element_Offset), 2); Element_Offset+=2; //Filled if (!Streams[Parser_Pos]->IsFilled && Streams[Parser_Pos]->Parser->Status[IsFilled]) { if (Count_Get(Stream_General)==0) Accept("CDP"); Streams_Count++; if (Streams_Count==3) Fill("CDP"); Streams[Parser_Pos]->IsFilled=true; } } else Skip_XX(2, "Data"); Element_End0(); } else Skip_XX(2, "Junk"); Element_End0(); } Element_End0(); Frame_Count++; Frame_Count_InThisBlock++; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; }
//--------------------------------------------------------------------------- void File_DtvccTransport::Read_Buffer_Continue() { //Parsing Element_Begin(Format==Format_DVD?"DVD Captions":"DTVCC Transport"); int8u cc_count; bool process_cc_data_flag, additional_data_flag; BS_Begin(); if (Format==Format_DVD) { //Modified DTVCC Transport from DVD Skip_SB( "field 1 then field 2"); Get_S1 (7, cc_count, "cc_count"); process_cc_data_flag=true; additional_data_flag=false; } else { //Normal DTVCC Transport bool process_em_data_flag; Get_SB (process_em_data_flag, "process_em_data_flag"); Get_SB (process_cc_data_flag, "process_cc_data_flag"); Get_SB (additional_data_flag, "additional_data_flag"); Get_S1 (5, cc_count, "cc_count"); Skip_S1(8, process_em_data_flag?"em_data":"reserved"); //Emergency message } BS_End(); if (process_cc_data_flag) { for (int8u Pos=0; Pos<cc_count; Pos++) { Element_Begin("cc"); int8u cc_type; bool cc_valid; BS_Begin(); Mark_1(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); if (Format==Format_DVD) { //Modified DTVCC Transport from DVD Mark_1(); Mark_1(); Get_S1 (1, cc_type, "cc_type"); Param_Info(DtvccTransport_cc_type(cc_type)); cc_valid=true; } else { //Normal DTVCC Transport Get_SB ( cc_valid, "cc_valid"); Get_S1 (2, cc_type, "cc_type"); Param_Info(DtvccTransport_cc_type(cc_type)); } BS_End(); if (cc_valid) { Element_Begin("cc_data"); //Calculating the parser position int8u Parser_Pos=cc_type==3?2:cc_type; //cc_type 2 and 3 are for the same text //Parsing #if MEDIAINFO_DEMUX Element_Code=Parser_Pos; #endif //MEDIAINFO_DEMUX if (Streams[Parser_Pos]==NULL) Streams[Parser_Pos]=new stream; if (Streams[Parser_Pos]->Parser==NULL) { if (cc_type<2) { #if defined(MEDIAINFO_EIA608_YES) Streams[Parser_Pos]->Parser=new File_Eia608(); #else Streams[Parser_Pos]->Parser=new File__Analyze(); #endif } else { #if defined(MEDIAINFO_EIA708_YES) Streams[Parser_Pos]->Parser=new File_Eia708(); #else Streams[Parser_Pos]->Parser=new File__Analyze(); #endif } Open_Buffer_Init(Streams[Parser_Pos]->Parser); } Demux(Buffer+(size_t)(Buffer_Offset+Element_Offset), 2, ContentType_MainStream); if (!Streams[Parser_Pos]->Parser->Status[IsFinished]) { //Parsing if (Streams[Parser_Pos]->Parser->PTS_DTS_Needed) { Streams[Parser_Pos]->Parser->FrameInfo.PCR=FrameInfo.PCR; Streams[Parser_Pos]->Parser->FrameInfo.PTS=FrameInfo.PTS; Streams[Parser_Pos]->Parser->FrameInfo.DTS=FrameInfo.DTS; } if (Parser_Pos==2) { #if defined(MEDIAINFO_EIA708_YES) ((File_Eia708*)Streams[2]->Parser)->cc_type=cc_type; ((File_Eia708*)Streams[2]->Parser)->AspectRatio=AspectRatio; #endif if (cc_type==3) Streams[2]->Parser->Open_Buffer_Unsynch(); } else { } Open_Buffer_Continue(Streams[Parser_Pos]->Parser, Buffer+(size_t)(Buffer_Offset+Element_Offset), 2); Element_Show(); Element_Offset+=2; //Filled if (!Streams[Parser_Pos]->IsFilled && Streams[Parser_Pos]->Parser->Status[IsFilled]) { if (Count_Get(Stream_General)==0) Accept("DTVCC Transport"); Streams_Count++; if (Streams_Count==3) Fill("DTVCC Transport"); Streams[Parser_Pos]->IsFilled=true; } } else Skip_XX(2, "Data"); Element_End(); } else Skip_XX(2, "Junk"); Element_End(); } } else Skip_XX(cc_count*2, "Junk"); if (Format==Format_A53_4_GA94_03) { //Normal DTVCC Transport BS_Begin(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); BS_End(); if (additional_data_flag) { Skip_XX(Element_Size-Element_Offset, "additional_user_data"); } while (Element_Offset<Element_Size) { Skip_B1( "Zero"); //TODO: test Zero } } Element_End(); }
//--------------------------------------------------------------------------- void File_Mpeg4_Descriptors::Descriptor_04() { //Parsing int32u bufferSizeDB, MaxBitrate, AvgBitrate; Get_B1 (ObjectTypeId, "objectTypeIndication"); Param_Info(Mpeg4_Descriptors_ObjectTypeIndication(ObjectTypeId)); BS_Begin(); Info_S1(6, streamType, "streamType"); Param_Info(Mpeg4_Descriptors_StreamType(streamType)); Skip_SB( "upStream"); Skip_SB( "reserved"); BS_End(); Get_B3 (bufferSizeDB, "bufferSizeDB"); Get_B4 (MaxBitrate, "maxBitrate"); Get_B4 (AvgBitrate, "avgBitrate"); FILLING_BEGIN(); switch (ObjectTypeId) { case 0x01 : Fill(StreamKind_Last, StreamPos_Last, "Format", "System", Error, false, true); break; case 0x02 : Fill(StreamKind_Last, StreamPos_Last, "Format", "System Core", Error, false, true); break; //case 0x03 Interaction Stream //case 0x05 AFX //case 0x06 Font Data //case 0x07 Synthesized Texture Stream case 0x08 : Fill(StreamKind_Last, StreamPos_Last, "Format", "Streaming Text", Error, false, true); break; case 0x20 : Fill(StreamKind_Last, StreamPos_Last, "Format", "MPEG-4 Visual", Error, false, true); break; case 0x21 : Fill(StreamKind_Last, StreamPos_Last, "Format", "AVC", Error, false, true); break; //case 0x22 Parameter Sets for AVC case 0x40 : Fill(StreamKind_Last, StreamPos_Last, "Format", "AAC", Error, false, true); break; //MPEG-4 AAC case 0x60 : Fill(StreamKind_Last, StreamPos_Last, "Format", "MPEG Video", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Profile", "Simple" , Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Version", "Version 2", Error, false, true); break; //MPEG-2V Simple case 0x61 : Fill(StreamKind_Last, StreamPos_Last, "Format", "MPEG Video", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Profile", "Main" , Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Version", "Version 2", Error, false, true); break; //MPEG-2V Main case 0x62 : Fill(StreamKind_Last, StreamPos_Last, "Format", "MPEG Video", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Profile", "SNR" , Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Version", "Version 2", Error, false, true); break; //MPEG-2V SNR case 0x63 : Fill(StreamKind_Last, StreamPos_Last, "Format", "MPEG Video", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Profile", "Spatial", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Version", "Version 2", Error, false, true); break; //MPEG-2V Spatial case 0x64 : Fill(StreamKind_Last, StreamPos_Last, "Format", "MPEG Video", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Profile", "High" , Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Version", "Version 2", Error, false, true); break; //MPEG-2V High case 0x65 : Fill(StreamKind_Last, StreamPos_Last, "Format", "MPEG Video", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Profile", "4:2:2" , Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Version", "Version 2", Error, false, true); break; //MPEG-2V 4:2:2 case 0x66 : Fill(StreamKind_Last, StreamPos_Last, "Format", "AAC", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Profile", "Main", Error, false, true); break; //MPEG-2 AAC Main case 0x67 : Fill(StreamKind_Last, StreamPos_Last, "Format", "AAC", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Profile", "LC", Error, false, true); break; //MPEG-2 AAC LC case 0x68 : Fill(StreamKind_Last, StreamPos_Last, "Format", "AAC", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Profile", "SSR", Error, false, true); break; //MPEG-2 AAC SSR case 0x69 : Fill(StreamKind_Last, StreamPos_Last, "Format", "MPEG Audio", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Profile", "Layer 3", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Version", "Version 2", Error, false, true); break; case 0x6A : Fill(StreamKind_Last, StreamPos_Last, "Format", "MPEG Video", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Version", "Version 1", Error, false, true); break; case 0x6B : Fill(StreamKind_Last, StreamPos_Last, "Format", "MPEG Audio", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "Format_Version", "Version 1", Error, false, true); break; case 0x6C : Fill(StreamKind_Last, StreamPos_Last, "Format", "M-JPEG", Error, false, true); break; case 0x6D : Fill(StreamKind_Last, StreamPos_Last, "Format", "PNG", Error, false, true); break; case 0x6E : Fill(StreamKind_Last, StreamPos_Last, "Format", "MPEG Video", Error, false, true); break; case 0xA0 : Fill(StreamKind_Last, StreamPos_Last, "Format", "EVRC", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "SamplingRate", "8000"); Fill(StreamKind_Last, StreamPos_Last, "Channel(s)", "1", 10, true); break; case 0xA1 : Fill(StreamKind_Last, StreamPos_Last, "Format", "SMV", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "SamplingRate", "8000"); Fill(StreamKind_Last, StreamPos_Last, "Channel(s)", "1", 10, true); break; case 0xA2 : Fill(StreamKind_Last, StreamPos_Last, "Format", "3GPP2", Error, false, true); break; case 0xA3 : Fill(StreamKind_Last, StreamPos_Last, "Format", "VC-1", Error, false, true); break; case 0xA4 : Fill(StreamKind_Last, StreamPos_Last, "Format", "Dirac", Error, false, true); break; case 0xA5 : Fill(StreamKind_Last, StreamPos_Last, "Format", "AC-3", Error, false, true); break; case 0xA6 : Fill(StreamKind_Last, StreamPos_Last, "Format", "E-AC-3", Error, false, true); break; case 0xD1 : Fill(StreamKind_Last, StreamPos_Last, "Format", "EVRC", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "SamplingRate", "8000"); Fill(StreamKind_Last, StreamPos_Last, "Channel(s)", "1", 10, true); break; case 0xD3 : Fill(StreamKind_Last, StreamPos_Last, "Format", "AC-3", Error, false, true); break; case 0xD4 : Fill(StreamKind_Last, StreamPos_Last, "Format", "DTS", Error, false, true); break; case 0xDD : Fill(StreamKind_Last, StreamPos_Last, "Format", "Ogg", Error, false, true); break; case 0xDE : Fill(StreamKind_Last, StreamPos_Last, "Format", "Ogg", Error, false, true); break; case 0xE1 : Fill(StreamKind_Last, StreamPos_Last, "Format", "QCELP", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "SamplingRate", "8000"); Fill(StreamKind_Last, StreamPos_Last, "Channel(s)", "1", 10, true); break; default: ; } switch (ObjectTypeId) { case 0x01 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "System", Error, false, true); break; case 0x02 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "System Core", Error, false, true); break; case 0x20 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "MPEG-4V", Error, false, true); break; case 0x21 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "H264", Error, false, true); break; case 0x40 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "AAC", Error, false, true); break; //MPEG-4 AAC case 0x60 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "MPEG-2V", Error, false, true); break; //MPEG-2V Simple case 0x61 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "MPEG-2V", Error, false, true); break; //MPEG-2V Main case 0x62 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "MPEG-2V", Error, false, true); break; //MPEG-2V SNR case 0x63 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "MPEG-2V", Error, false, true); break; //MPEG-2V Spatial case 0x64 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "MPEG-2V", Error, false, true); break; //MPEG-2V High case 0x65 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "MPEG-2V", Error, false, true); break; //MPEG-2V 4:2:2 case 0x66 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "AAC", Error, false, true); break; //MPEG-2 AAC Main case 0x67 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "AAC", Error, false, true); break; //MPEG-2 AAC LC case 0x68 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "AAC", Error, false, true); break; //MPEG-2 AAC SSR case 0x69 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "MPEG-2A L3", Error, false, true); break; case 0x6A : Fill(StreamKind_Last, StreamPos_Last, "Codec", "MPEG-1V", Error, false, true); break; case 0x6B : Fill(StreamKind_Last, StreamPos_Last, "Codec", "MPEG-1A", Error, false, true); break; case 0x6C : Fill(StreamKind_Last, StreamPos_Last, "Codec", "M-JPEG", Error, false, true); break; case 0x6D : Fill(StreamKind_Last, StreamPos_Last, "Codec", "PNG", Error, false, true); break; case 0x6E : Fill(StreamKind_Last, StreamPos_Last, "Codec", "MPEG-4V", Error, false, true); break; case 0xA0 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "EVRC", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "SamplingRate", "8000"); Fill(StreamKind_Last, StreamPos_Last, "Channel(s)", "1", 10, true); break; case 0xA1 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "SMV", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "SamplingRate", "8000"); Fill(StreamKind_Last, StreamPos_Last, "Channel(s)", "1", 10, true); break; case 0xA2 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "MPEG-4V", Error, false, true); break; case 0xA3 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "VC-1", Error, false, true); break; case 0xA4 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "Dirac", Error, false, true); break; case 0xA5 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "AC3", Error, false, true); break; case 0xA6 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "AC3+", Error, false, true); break; case 0xD1 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "EVRC", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "SamplingRate", "8000"); Fill(StreamKind_Last, StreamPos_Last, "Channel(s)", "1", 10, true); break; case 0xD3 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "AC3", Error, false, true); break; case 0xD4 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "DTS", Error, false, true); break; case 0xDD : Fill(StreamKind_Last, StreamPos_Last, "Codec", "Ogg", Error, false, true); break; case 0xDE : Fill(StreamKind_Last, StreamPos_Last, "Codec", "Ogg", Error, false, true); break; case 0xE1 : Fill(StreamKind_Last, StreamPos_Last, "Codec", "QCELP", Error, false, true); Fill(StreamKind_Last, StreamPos_Last, "SamplingRate", "8000"); Fill(StreamKind_Last, StreamPos_Last, "Channel(s)", "1", 10, true); break; default: ; } Fill(StreamKind_Last, StreamPos_Last, "CodecID", ObjectTypeId, 16, true); Fill(StreamKind_Last, StreamPos_Last, "Codec/CC", ObjectTypeId, 16, true); //Bitrate mode if (AvgBitrate>0 && !(bufferSizeDB==AvgBitrate && bufferSizeDB==MaxBitrate && bufferSizeDB==0x1000)) //Some buggy data were found { Fill(StreamKind_Last, StreamPos_Last, "BitRate_Nominal", AvgBitrate); if (MaxBitrate<=AvgBitrate*1.005) Fill(StreamKind_Last, StreamPos_Last, "BitRate_Mode", "CBR"); else { Fill(StreamKind_Last, StreamPos_Last, "BitRate_Mode", "VBR"); Fill(StreamKind_Last, StreamPos_Last, "BitRate_Maximum", MaxBitrate); } } //Creating parser delete Parser; //Parser=NULL; switch (ObjectTypeId) { case 0x20 : //MPEG-4 Visual #if defined(MEDIAINFO_MPEG4V_YES) Parser=new File_Mpeg4v; ((File_Mpeg4v*)Parser)->Frame_Count_Valid=1; ((File_Mpeg4v*)Parser)->FrameIsAlwaysComplete=true; #endif break; case 0x21 : //AVC #if defined(MEDIAINFO_AVC_YES) Parser=new File_Avc; ((File_Avc*)Parser)->MustParse_SPS_PPS=true; ((File_Avc*)Parser)->MustSynchronize=false; ((File_Avc*)Parser)->SizedBlocks=true; #endif break; case 0x40 : #if defined(MEDIAINFO_MPEG4_YES) Parser=new File_Mpeg4_AudioSpecificConfig; #endif break; case 0x60 : case 0x61 : case 0x62 : case 0x63 : case 0x64 : case 0x65 : case 0x6A : //MPEG Video #if defined(MEDIAINFO_MPEGV_YES) Parser=new File_Mpegv; ((File_Mpegv*)Parser)->Frame_Count_Valid=30; //For searching Pulldown ((File_Mpegv*)Parser)->FrameIsAlwaysComplete=true; #endif break; case 0x66 : case 0x67 : case 0x68 : //MPEG-2 AAC #if defined(MEDIAINFO_MPEG4_YES) Parser=new File_Mpeg4_AudioSpecificConfig; //Should be ADIF, but the only sample I have is AudioSpecificConfig #endif break; case 0x69 : case 0x6B : //MPEG Audio #if defined(MEDIAINFO_MPEGA_YES) Parser=new File_Mpega; #endif break; case 0x6C : //M-JPEG #if defined(MEDIAINFO_JPEG_YES) Parser=new File_Jpeg; ((File_Jpeg*)Parser)->StreamKind=Stream_Video; #endif break; case 0x6D : //PNG #if defined(MEDIAINFO_PNG_YES) Parser=new File_Png; #endif break; case 0xA3 : //VC-1 #if defined(MEDIAINFO_VC1_YES) Parser=new File_Vc1; #endif break; case 0xA4 : //Dirac #if defined(MEDIAINFO_DIRAC_YES) Parser=new File_Dirac; #endif break; case 0xA5 : //AC-3 case 0xA6 : //E-AC-3 case 0xD3 : //AC-3 #if defined(MEDIAINFO_AC3_YES) Parser=new File_Ac3; #endif break; case 0xD4 : //DTS #if defined(MEDIAINFO_DTS_YES) Parser=new File_Dts; #endif break; case 0xDD : case 0xDE : //OGG #if defined(MEDIAINFO_OGG_YES) Parser=new File_Ogg; Parser->MustSynchronize=false; ((File_Ogg*)Parser)->SizedBlocks=true; #endif break; default: ; } Open_Buffer_Init(Parser); Element_ThisIsAList(); FILLING_END(); }
//--------------------------------------------------------------------------- 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) delete Parser; 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) delete Parser; 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: ; } //Specific cases if (ObjectTypeId==0x40) //Audio ISO/IEC 14496-3 (AAC) { //IOD backup delete DecSpecificInfoTag; DecSpecificInfoTag=new decspecificinfotag; DecSpecificInfoTag->Buffer=new int8u[(size_t)Element_Size]; DecSpecificInfoTag->Buffer_Size=(size_t)Element_Size; std::memcpy(DecSpecificInfoTag->Buffer, Buffer+Buffer_Offset, (size_t)Element_Size); //There is an IOD, not ADTS #ifdef MEDIAINFO_MPEG4_YES delete Parser; Parser=new File_Mpeg4_AudioSpecificConfig; Open_Buffer_Init(Parser); #endif //MEDIAINFO_MPEG4_YES } //Parsing Open_Buffer_Continue(Parser); if (!Parser_DoNotFreeIt || StreamKind_Last==Stream_Audio && ObjectTypeId==0x40) //Audio ISO/IEC 14496-3 (AAC), File_Mpeg4_AudioSpecificConfig is only for DecConfig { //StreamKind_Last==Stream_Audio because this may be in an IOD, and in this case the descriptor is not merged, so the Parser is kept until stream is detected //Filling Finish(Parser); 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; }
//--------------------------------------------------------------------------- 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(); }
//--------------------------------------------------------------------------- void File_Ancillary::Read_Buffer_Continue() { if (!Cdp_Data.empty() && AspectRatio && FrameRate) { ((File_Cdp*)Cdp_Parser)->AspectRatio=AspectRatio; for (size_t Pos=0; Pos<Cdp_Data.size(); Pos++) { if (Cdp_Parser->PTS_DTS_Needed) Cdp_Parser->FrameInfo.DTS=FrameInfo.DTS-(Cdp_Data.size()-Pos)*FrameInfo.DUR; Open_Buffer_Continue(Cdp_Parser, Cdp_Data[Pos]->Data, Cdp_Data[Pos]->Size); delete Cdp_Data[Pos]; //Cdp_Data[0]=NULL; } Cdp_Data.clear(); } if (Element_Size==0) { //Keeping only one, TODO: parse it without video stream for (size_t Pos=1; Pos<AfdBarData_Data.size(); Pos++) delete AfdBarData_Data[Pos]; //AfdBarData_Data[0]=NULL; if (!AfdBarData_Data.empty()) AfdBarData_Data.resize(1); return; } if (!Status[IsAccepted]) Accept(); //Parsing int8u DataID, SecondaryDataID, DataCount; Get_L1 (DataID, "Data ID"); if (WithTenBit) Skip_L1( "Parity+Unused"); //even:1, odd:2 Get_L1 (SecondaryDataID, "Secondary Data ID"); Param_Info(Ancillary_DataID(DataID, SecondaryDataID)); if (WithTenBit) Skip_L1( "Parity+Unused"); //even:1, odd:2 Get_L1 (DataCount, "Data count"); if (WithTenBit) Skip_L1( "Parity+Unused"); //even:1, odd:2 //Buffer int8u* Payload=new int8u[DataCount]; for(int8u Pos=0; Pos<DataCount; Pos++) { Get_L1 (Payload[Pos], "Data"); if (WithTenBit) Skip_L1( "Parity+Unused"); //even:1, odd:2 } //Parsing if (WithChecksum) Skip_L1( "Checksum"); if (WithTenBit) Skip_L1( "Parity+Unused"); //even:1, odd:2 Element_End(); FILLING_BEGIN(); switch (DataID) { case 0x41 : // (from SMPTE 2016-3) switch (SecondaryDataID) { case 0x05 : //Bar Data (from SMPTE 2016-3), saving data for future use #if defined(MEDIAINFO_AFDBARDATA_YES) { buffered_data* AfdBarData=new buffered_data; AfdBarData->Data=new int8u[(size_t)DataCount]; std::memcpy(AfdBarData->Data, Payload, (size_t)DataCount); AfdBarData->Size=(size_t)DataCount; AfdBarData_Data.push_back(AfdBarData); } #endif //MEDIAINFO_AFDBARDATA_YES break; default : ; ; } break; case 0x45 : // (from SMPTE 2020-1) switch (SecondaryDataID) { case 0x01 : //No association case 0x02 : //Channel pair 1/2 case 0x03 : //Channel pair 3/4 case 0x04 : //Channel pair 5/6 case 0x05 : //Channel pair 7/8 case 0x06 : //Channel pair 9/10 case 0x07 : //Channel pair 11/12 case 0x08 : //Channel pair 13/14 case 0x09 : //Channel pair 15/16 break; default : ; ; } break; case 0x61 : //Defined data services (from SMPTE 331-1) switch (SecondaryDataID) { case 0x01 : //CDP (from SMPTE 331-1) #if defined(MEDIAINFO_CDP_YES) { if (Cdp_Parser==NULL) { Cdp_Parser=new File_Cdp; Open_Buffer_Init(Cdp_Parser); } Demux(Payload, (size_t)DataCount, ContentType_MainStream); if (AspectRatio && FrameRate) { if (!Cdp_Parser->Status[IsFinished]) { if (Cdp_Parser->PTS_DTS_Needed) Cdp_Parser->FrameInfo.DTS=FrameInfo.DTS; ((File_Cdp*)Cdp_Parser)->AspectRatio=AspectRatio; Open_Buffer_Continue(Cdp_Parser, Payload, (size_t)DataCount); } } else { //Saving data for future use buffered_data* Cdp=new buffered_data; Cdp->Data=new int8u[(size_t)DataCount]; std::memcpy(Cdp->Data, Payload, (size_t)DataCount); Cdp->Size=(size_t)DataCount; Cdp_Data.push_back(Cdp); } } #endif //MEDIAINFO_CDP_YES break; case 0x02 : //CEA-608 (from SMPTE 331-1) #if defined(MEDIAINFO_EIA608_YES) if (DataCount==3) //This must be 3-byte data { //CEA-608 in video presentation order } #endif //MEDIAINFO_EIA608_YES break; default : ; ; } break; case 0x62 : //Variable-format data services (from SMPTE 331-1) switch (SecondaryDataID) { case 0x01 : //Program description (from SMPTE 331-1), break; case 0x02 : //Data broadcast (from SMPTE 331-1) break; case 0x03 : //VBI data (from SMPTE 331-1) break; default : ; ; } break; default : ; } FILLING_END(); delete[] Payload; //Payload=NULL }
//--------------------------------------------------------------------------- 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; }
//--------------------------------------------------------------------------- void File_Ogg::Data_Parse() { //If first chunk of a stream if (Stream[Element_Code].Parser==NULL) { Stream[Element_Code].Parser=new File_Ogg_SubElement; StreamsToDo++; } //Parsing File_Ogg_SubElement* Parser=(File_Ogg_SubElement*)Stream[Element_Code].Parser; if (!Parser->SetupFinnished) //For each chunk for (size_t Chunk_Sizes_Pos=0; Chunk_Sizes_Pos<Chunk_Sizes.size(); Chunk_Sizes_Pos++) { //Info if (!continued) Peek_L1(packet_type); //Only for information Element_Info(Ztring::ToZtring(packet_type, 16)); if (continued) Element_Info("Continue"); //Parsing Open_Buffer_Init(Parser, File_Size, File_Offset+Buffer_Offset); if (continued || Parser->File_Offset!=Parser->File_Size) Open_Buffer_Continue(Parser, Buffer+Buffer_Offset+Element_Offset, Chunk_Sizes[Chunk_Sizes_Pos]); if (Chunk_Sizes_Pos<Chunk_Sizes.size()-1 || (Chunk_Sizes_Pos==Chunk_Sizes.size()-1 && Chunk_Sizes_Finnished)) Open_Buffer_Continue(Parser, Buffer+Buffer_Offset, 0); //Purge old datas if (Parser->SetupFinnished) { Merge(*Parser); Merge(*Parser, Stream_General, 0, 0); Stream[Element_Code].StreamKind=((File_Ogg_SubElement*)Parser)->StreamKind; Stream[Element_Code].StreamPos=Count_Get(Stream[Element_Code].StreamKind)-1; Stream[Element_Code].absolute_granule_position_Resolution=((File_Ogg_SubElement*)Stream[Element_Code].Parser)->absolute_granule_position_Resolution; StreamsToDo--; } Element_Offset+=Chunk_Sizes[Chunk_Sizes_Pos]; continued=false; //If there is another chunk, this can not be a continued chunk if (Parser->SetupFinnished) Chunk_Sizes_Pos=Chunk_Sizes.size(); } //End of stream if (!Parsing_End && File_Size>2*256*1024 && (StreamsToDo==0 || File_Offset+Buffer_Offset+Element_Offset>256*1024)) { Info("OGG, Jumping to end of file"); File_GoTo=File_Size-256*1024; std::map<int64u, stream>::iterator Stream_Temp=Stream.begin(); while (Stream_Temp!=Stream.end()) { Stream_Temp->second.absolute_granule_position=0; Stream_Temp++; } Parsing_End=true; } }