/* Copyright (c) MediaArea.net SARL. All Rights Reserved. * * Use of this source code is governed by a BSD-style license that can * be found in the License.html file in the root of the source tree. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Information about MPEG files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_MpegPsH #define MediaInfo_MpegPsH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include "MediaInfo/Multiple/File_Mpeg4_Descriptors.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Mpeg //*************************************************************************** class File_MpegPs : public File__Analyze { public : //In bool FromTS; //Indicate if stream comes from TS int8u FromTS_stream_type; //ID from TS int32u FromTS_program_format_identifier; //Registration from TS int32u FromTS_format_identifier; //Registration from TS int8u FromTS_descriptor_tag; //Descriptor from TS int8u MPEG_Version; //MPEG Version (or automaticly detected) bool Searching_TimeStamp_Start; #ifdef MEDIAINFO_MPEG4_YES File__Analyze* ParserFromTs; File_Mpeg4_Descriptors::slconfig* SLConfig; #endif #if MEDIAINFO_DEMUX struct demux { struct buffer { int64u DTS; size_t Buffer_Size; size_t Buffer_Size_Max; int8u* Buffer; buffer() { DTS=(int64u)-1; Buffer_Size=0; Buffer_Size_Max=0; Buffer=NULL; } ~buffer() { delete[] Buffer; } }; std::vector Buffers; demux() { } ~demux() { for (size_t Pos=0; Pos 0xDF void video_stream(); //0xE0 --> 0xEF void SL_packetized_stream();//0xFA void extension_stream(); //0xFD //private_stream_1 specific bool private_stream_1_Choose_DVD_ID(); File__Analyze* private_stream_1_ChooseParser(); const ZenLib::Char* private_stream_1_ChooseExtension(); #if MEDIAINFO_TRACE void private_stream_1_Element_Info1(); #endif //MEDIAINFO_TRACE int8u private_stream_1_ID; size_t private_stream_1_Offset; bool private_stream_1_IsDvdVideo; //private_stream_2 specific void private_stream_2_TSHV_A0(); void private_stream_2_TSHV_A1(); //extension_stream specific const ZenLib::Char* extension_stream_ChooseExtension(); //Count int8u video_stream_Count; int8u audio_stream_Count; int8u private_stream_1_Count; int8u private_stream_2_Count; int8u extension_stream_Count; int8u SL_packetized_stream_Count; //From packets int32u program_mux_rate; //PS struct ps_stream : public stream_time { struct Mpeg_TimeStamp { struct Mpeg_TimeStamp_TS { int64u File_Pos; int64u TimeStamp; void Reset() { File_Pos = (int64u)-1; TimeStamp = (int64u)-1; } Mpeg_TimeStamp_TS() { Reset(); } }; Mpeg_TimeStamp_TS PTS; Mpeg_TimeStamp_TS DTS; }; stream_t StreamKind; size_t StreamPos; size_t Count; //TODO: in case there are different stream kinds int8u stream_type; int32u program_format_identifier; int32u format_identifier; int8u descriptor_tag; int8u DVD_Identifier; std::vector Parsers; //Sometimes, we need to do parallel tests Mpeg_TimeStamp TimeStamp_Start; Mpeg_TimeStamp TimeStamp_End; size_t StreamRegistration_Count; size_t StreamOrder; size_t FirstPacketOrder; bool IsFilled; void Streams_Update() { for (size_t Pos = 0; PosOpen_Buffer_Update(); } void Set_Unsynch_Frame_Count(const int64u Count, const bool IsSub) { TimeStamp_End.PTS.Reset(); TimeStamp_End.DTS.Reset(); Searching_TimeStamp_Start = false; for (size_t Pos = 0; PosUnsynch_Frame_Count = Count; #endif //MEDIAINFO_SEEK Parsers[Pos]->Open_Buffer_Unsynch(); } } ps_stream() { StreamKind=Stream_Max; StreamPos=0; Count=0; stream_type=0; program_format_identifier=0x00000000; //No info format_identifier=0x00000000; //No info descriptor_tag=0x00; //No info DVD_Identifier=0; StreamRegistration_Count=0; StreamOrder=(size_t)-1; FirstPacketOrder=(size_t)-1; Init_Stream(false); IsFilled=false; } ~ps_stream() { for (size_t Pos=0; Pos Streams; std::vector Streams_Private1; //There can have multiple streams in one private stream std::vector Streams_Extension; //There can have multiple streams in one private stream int8u stream_id; //Temp int64u SizeToAnalyze; //Total size of a chunk to analyse, it may be changed by the parser int8u stream_id_extension; bool video_stream_Unlimited; int16u Buffer_DataSizeToParse; std::vector video_stream_PTS; size_t StreamOrder_CountOfPrivateStreams_Minus1; size_t StreamOrder_CountOfPrivateStreams_Temp; size_t FirstPacketOrder_Last; //Helpers bool Header_Parser_QuickSearch(); //Parsers File__Analyze* ChooseParser_Ancillary(); File__Analyze* ChooseParser_Mpegv(); File__Analyze* ChooseParser_Mpeg4v(); File__Analyze* ChooseParser_Avc(); File__Analyze* ChooseParser_Hevc(); File__Analyze* ChooseParser_VC1(); File__Analyze* ChooseParser_Dirac(); File__Analyze* ChooseParser_Mpega(); File__Analyze* ChooseParser_Mpegh3da(); File__Analyze* ChooseParser_Adts(); File__Analyze* ChooseParser_Latm(); File__Analyze* ChooseParser_AC3(); File__Analyze* ChooseParser_AC4(); File__Analyze* ChooseParser_DTS(); File__Analyze* ChooseParser_SDDS(); File__Analyze* ChooseParser_AAC(); File__Analyze* ChooseParser_PCM(); File__Analyze* ChooseParser_SmpteSt0302(); File__Analyze* ChooseParser_RLE(); File__Analyze* ChooseParser_AribStdB24B37(bool HasCcis=false); File__Analyze* ChooseParser_DvbSubtitle(); File__Analyze* ChooseParser_PGS(); File__Analyze* ChooseParser_Teletext(); File__Analyze* ChooseParser_PS2(); File__Analyze* ChooseParser_NULL(); //File__Analyze helpers enum kindofstream { KindOfStream_Main, KindOfStream_Private, KindOfStream_Extension, }; void Streams_Fill_PerStream(size_t StreamID, ps_stream &Temp, kindofstream KindOfStream); void Streams_Fill_PerStream_PerKind(size_t StreamID, ps_stream &Temp, kindofstream KindOfStream, size_t Count); void Streams_Finish_PerStream(size_t StreamID, ps_stream &Temp, kindofstream KindOfStream); void xxx_stream_Parse(ps_stream &Temp, int8u &stream_Count); void MergeGeneral(File__Analyze* Parser, general Parameter); //Output buffer size_t Output_Buffer_Get (const String &Value); size_t Output_Buffer_Get (size_t Pos); #if MEDIAINFO_SEEK std::map Unsynch_Frame_Counts; int64u Seek_Value; int64u Seek_Value_Maximal; int64u Seek_ID; bool Duration_Detected; #endif //MEDIAINFO_SEEK }; } //NameSpace #endif