MediaInfoLib/.cvsignore100777 0 0 444 12165355572 10454 0*.~* *.7z *.aps *.dcu *.ddp *.ddp *.dll *.exe *.exp *.lib *.local *.ncb *.obj *.opensdf *.opt *.pdb *.pdp *.plg *.sdf *.suo *.tds *.user *.zip __history bin Debug Debug_Ansi Debug_Build My Project obj Release Release_Ansi Release_Build Thumbs.db Win32 x64 MediaInfoLib/Changes.txt100777 0 0 14403 12210056077 10612 0I changed some elements in the interface. No break in binary compatibily (no crash), but some details. 0.7.64 --> 0.7.65 ----------------- - DCP AssetMap: format name changed fro "DCP" to "DCP AM", in order to differentiate AM from PKL and CPL 0.7.63 --> 0.7.64 ----------------- - QuickTime: time code name is moved from General "OriginalSourceMedium" field to time code "Title" 0.7.62 --> 0.7.63 ----------------- - XML: dt:dt is replaced by dt (for binary data) 0.7.61 --> 0.7.62 ----------------- - MOV "menu" moved to "other", for better separation of time code tracks - "Intermediate Codec" is renamed to "AIC" (Apple Intermediate Codec) 0.7.60 --> 0.7.61 ----------------- - MPEG-TS: Menu stream, KLVA_PID and SCTE35_PID removed and formats are in "Format" field - DTS: moved DTS endianess and word size 0.7.58 --> 0.7.59 ----------------- - colour_primaries, transfer_characteristics, matrix_coefficients: canonicalization of results 0.7.53 --> 0.7.54 ----------------- - CEA-608: ID naming scheme has changed 0.7.52 --> 0.7.53 ----------------- - MPEG-4: Material_* fields (in case of source duration different than track duration) --> Source_* 0.7.44 --> 0.7.45 ----------------- - FLV and RIFF: Changing Sorenson H.263 to Sorenson Spark because this stream format is too much incompatible with H.263 0.7.36 --> 0.7.37 ----------------- - JPEG 2000: Format_Profile=Reversible --> Compression_Mode=Lossless and Format_Profile=Irreversible --> Compression_Mode=Lossy 0.7.35 --> 0.7.36 ----------------- - M-JPEG format is renamed JPEG, M-JPEG 2000 format is renamed JPEG 2000 (difference between video and image is made by the stream kind) 0.7.32 --> 0.7.33 ----------------- - Colorimetry is deprecated, replaced by ColorSpace - Resolution is deprecated, replaced by BitDepth 0.7.30 --> 0.7.31 ----------------- - Format: "Digital Video" renamed to "DV" 0.7.28 --> 0.7.29 ----------------- - Channel position: more coherency between the different formats (Front, Surround, back) 0.7.18 --> 0.7.19 ----------------- - XML output: track names are changed, for a better usability by XML parsers () 0.7.12 --> 0.7.13 ----------------- - Chapters has now language type per item, another string format, and moved to the menu part Old string format was "Chapter number : Time - chapter string" New string format is "Time : chapter string / Optional info / Optional info" (optional info is separated by " / ") Note: if the language of the string is available, the string has the form "en:chapter string" (ISO-639 2-letter if available, else 3-letter) Note: if there is multiple languages, they are separated by " - " example of complex string: "Time : en:English - fr:Francais / en:More info - fr:plus d'infos" Note: for MPEG-TS EPG (Electronic program), string has this optional info (and Date/Time instead of time only): "UTC YYYY-MM-DD HH:MM:SS : Name / Description / Content type / Classification / Duration / Running status" For third-party software, Chapters_Pos_Begin and Chapters_Pos_End fields are include for informing about the field positions of chapters 0.7.8 --> 0.7.9 --------------- - Windows DLL C++ namespace has changed from MediaInfoLib to MediaInfoDLL 0.7.6.4 --> 0.7.7.0 ------------------- - (General) BitRate is replaced by OveralBitRate (Overal bitrate for ALL streams) (General BitRate field is DEPRECATED) - PlayTime is replaced by Duration (PlayTime field is DEPRECATED) - Codec is replaced by 2 fields: - Format is the real format string (ie "MPEG-4 Visual") - CodecID is the codec string filled in the container (ie "DX50") - CodecID/Hint is a hint for it (ie "DivX 5") (Codec fields are DEPRECATED) - Interlacement field is replaced by 2 fields: - ScanType for "Progressive" or "Interlaced" - ScanOrder for "TFF" or "BFF" (Interlacement field is DEPRECATED) - Chroma is replaced by Colorimetry (Chroma field is DEPRECATED) - Video0_Delay is replaced by Video_Delay (I will try to calculate it from the corresponding video when multiple streams) (Video0_Delay0 field is DEPRECATED) - Format_Settings_PacketBitStream is replaced by Format_Settings_MuxingMode set to "Packet Bitstream" (Format_Settings_PacketBitStream field is DEPRECATED) 0.7.5.3 --> 0.7.5.4 ------------------- - (Video) AspectRatio --> DisplayAspectRatio (AspectRatio tag is DEPRECATED) - (Video) PixelAspectRatio added - AAC #defines has been splitted in ADTS and ADIF 0.7.2.1 --> 0.7.2.2 ------------------- - (General) OveralBitRate --> BitRate - Visual --> Video (yes, I come back to the old style, Image streams are back, merging video and image was not a good idea) - Bits/(Pixel*Frame) --> Bits-(Pixel*Frame) (I need the special character "/" elsewhere...) 0.7.0.x --> 0.7.2.1 ------------------- - MediaInfo_Stream_Video --> MediaInfo_Stream_Visual (conformance with MPEG consortium names, Visual = Video or Image) Note: this is only if you use named options, the number is always "1", old programs will not have problems with this. - To detect if this is a video or an image, you can test "Animated". Is 1 if this is a video, 0 if this is an Image - MediaInfo_FileOption_Close --> MediaInfo_FileOption_CloseAll Note: better name only, the number is always 2 old programs will not have problems with this. - Values of MediaInfo_FileOption_* are precised (because these are binary flags) Note: precision only, numbers are always same old programs will not have problems with this. 0.6.x.x --> 0.7.0.x ------------------- - Inform() : Option_Custom is deprecated - if "Inform" option is set, it is used. Unset it to have a "normal" view. - To have a HTML output, use Option("Inform", "HTML") before. I will change the documentation as soon as possible - Tags : Somes tags have changed : - "Channels" is now "Channel(s)" - "Track" is now "Track/Position". Be warned : "Track" is used, but for other things - "Title" is now a generic name for 2 different names : - "Movie" for a movie (video and audio) name - "Track" for a track (audio only) name "Title" will always exist, you can continue to use it for a generic access - "XXX_String" are now "XXX/String" MediaInfoLib/Contrib/ 40777 0 0 0 12264020633 7755 5MediaInfoLib/Contrib/ActiveX/ 40777 0 0 0 12264020633 11320 5MediaInfoLib/Contrib/ActiveX/Example/ 40777 0 0 0 12264020633 12713 5MediaInfoLib/Contrib/ActiveX/Example/HowToUse_ActiveX.htm100777 0 0 6625 12165355572 16713 0 MediaInfo ActiveX Example MediaInfoLib/Contrib/ActiveX/Example/HowToUse_ActiveX.vbs100777 0 0 5323 12165355572 16707 0' In order to run this example, put MediaInfo.dll and MediaInfoActiveX.dll ' into your system directory and Example.ogg into the root directory of drive ' C: (i.e. C:\). Use regsvr32.exe which is provided with Windows to register ' MediaInfoActiveX.dll. ' ' Use at own risk, under the same license as MediaInfo itself. ' ' Ingo Brckl, May 2006 Const MediaInfo_Stream_General = 0 Const MediaInfo_Stream_Video = 1 Const MediaInfo_Stream_Audio = 2 Const MediaInfo_Stream_Text = 3 Const MediaInfo_Stream_Chapters = 4 Const MediaInfo_Stream_Image = 5 Const MediaInfo_Stream_Menu = 6 Const MediaInfo_Info_Name = 0 Const MediaInfo_Info_Text = 1 Const MediaInfo_Info_Measure = 2 Const MediaInfo_Info_Options = 3 Const MediaInfo_Info_Name_Text = 4 Const MediaInfo_Info_Measure_Text = 5 Const MediaInfo_Info_Info = 6 Const MediaInfo_Info_HowTo = 7 Const MediaInfo_Info_Domain = 8 set obj = createObject("MediaInfo.ActiveX") ' information about MediaInfo msgbox obj.MediaInfo_Option(0, "Info_Version", ""), ,"MediaInfo ActiveX Example" msgbox obj.MediaInfo_Option(0, "Info_Parameters", ""), ,"Info_Parameters" msgbox obj.MediaInfo_Option(0, "Info_Capacities", ""), ,"Info_Capacities" msgbox obj.MediaInfo_Option(0, "Info_Codecs", ""), ,"Info_Codecs" ' an example of how to use the library msgbox "Open", , "MediaInfo ActiveX Example" handle = obj.MediaInfo_New() obj.MediaInfo_Open handle, "C:\Example.ogg" obj.MediaInfo_Option handle, "Complete", "" msgbox obj.MediaInfo_Inform(handle, 0), , "Inform with Complete=false" obj.MediaInfo_Option handle, "Complete", "1" msgbox obj.MediaInfo_Inform(handle, 0), , "Inform with Complete=true" obj.MediaInfo_Option handle, "Inform", "General;File size is %FileSize% bytes" msgbox obj.MediaInfo_Inform(handle, 0), , "Custom Inform" msgbox obj.MediaInfo_Get(handle, MediaInfo_Stream_General, 0, "FileSize", MediaInfo_Info_Text, MediaInfo_Info_Name), , "Get with StreamKind=General and Parameter=""FileSize""" msgbox obj.MediaInfo_GetI(handle, MediaInfo_Stream_General, 0, 13, MediaInfo_Info_Text), , "GetI with StreamKind=General and Parameter=13" msgbox obj.MediaInfo_Count_Get(handle, MediaInfo_Stream_Audio, -1), , "Count_Get with StreamKind=Audio" msgbox obj.MediaInfo_Get(handle, MediaInfo_Stream_General, 0, "AudioCount", MediaInfo_Info_Text, MediaInfo_Info_Name), , "Get with StreamKind=General and Parameter=""AudioCount""" msgbox obj.MediaInfo_Get(handle, MediaInfo_Stream_Audio, 0, "StreamCount", MediaInfo_Info_Text, MediaInfo_Info_Name), , "Get with StreamKind=Audio and Parameter=""StreamCount""" msgbox "Close", , "MediaInfo ActiveX Example" obj.MediaInfo_Close handle obj.MediaInfo_Delete handle MediaInfoLib/Contrib/ActiveX/Project/ 40777 0 0 0 12264020633 12726 5MediaInfoLib/Contrib/ActiveX/Project/ActiveX.cls100777 0 0 14166 12165355572 15141 0VERSION 1.0 CLASS BEGIN MultiUse = -1 'True END Attribute VB_Name = "ActiveX" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = True Attribute VB_Description = "MediaInfo ActiveX Wrapper" Option Explicit ' A simple ActiveX wrapper for the MediaInfo DLL. ' ' Use at own risk, under the same license as MediaInfo itself. ' ' Ingo Brckl, May 2006 ' The enums are only declared here in order to appear in the type library information. Public Enum MediaInfo_stream_C MediaInfo_Stream_General MediaInfo_Stream_Video MediaInfo_Stream_Audio MediaInfo_Stream_Text MediaInfo_Stream_Chapters MediaInfo_Stream_Image MediaInfo_Stream_Menu MediaInfo_Stream_Max End Enum Public Enum MediaInfo_info_C MediaInfo_Info_Name MediaInfo_Info_Text MediaInfo_Info_Measure MediaInfo_Info_Options MediaInfo_Info_Name_Text MediaInfo_Info_Measure_Text MediaInfo_Info_Info MediaInfo_Info_HowTo MediaInfo_Info_Max End Enum Public Enum MediaInfo_infooptions_C MediaInfo_InfoOption_ShowInInform MediaInfo_InfoOption_Support MediaInfo_InfoOption_ShowInSupported MediaInfo_InfoOption_TypeOfValue MediaInfo_InfoOption_Max End Enum Public Sub MediaInfo_Close(ByVal Handle As Long) Attribute MediaInfo_Close.VB_Description = "Close a file opened before with Open() (without saving)" Call MediaInfoDLL.MediaInfo_Close(Handle) End Sub Public Sub MediaInfo_Delete(ByVal Handle As Long) Attribute MediaInfo_Delete.VB_Description = "Delete a MediaInfo interface" Call MediaInfoDLL.MediaInfo_Delete(Handle) End Sub Public Function MediaInfo_Count_Get(ByVal Handle As Long, ByVal StreamKind As MediaInfo_stream_C, ByVal StreamNumber As Long) As Long Attribute MediaInfo_Count_Get.VB_Description = "Count of streams of a stream kind (StreamNumber not filled), or count of piece of information in this stream" MediaInfo_Count_Get = MediaInfoDLL.MediaInfo_Count_Get(Handle, StreamKind, StreamNumber) End Function Public Function MediaInfo_Get(ByVal Handle As Long, ByVal StreamKind As MediaInfo_stream_C, ByVal StreamNumber As Long, Parameter As String, ByVal InfoKind As MediaInfo_info_C, ByVal SearchKind As MediaInfo_info_C) As String Attribute MediaInfo_Get.VB_Description = "Get a piece of information about a file (parameter is a string)" MediaInfo_Get = bstr(MediaInfoDLL.MediaInfo_Get(Handle, StreamKind, StreamNumber, StrPtr(Parameter), InfoKind, SearchKind)) End Function Public Function MediaInfo_GetI(ByVal Handle As Long, ByVal StreamKind As MediaInfo_stream_C, ByVal StreamNumber As Long, ByVal Parameter As Long, ByVal InfoKind As MediaInfo_info_C) As String Attribute MediaInfo_GetI.VB_Description = "Get a piece of information about a file (parameter is an integer)" MediaInfo_GetI = bstr(MediaInfoDLL.MediaInfo_GetI(Handle, StreamKind, StreamNumber, Parameter, InfoKind)) End Function Public Function MediaInfo_Inform(ByVal Handle As Long, ByVal Reserved As Long) As String Attribute MediaInfo_Inform.VB_Description = "Get all details about a file in one string" MediaInfo_Inform = bstr(MediaInfoDLL.MediaInfo_Inform(Handle, Reserved)) End Function Public Function MediaInfo_New() As Long Attribute MediaInfo_New.VB_Description = "Create a new MediaInfo interface and return a handle to it" MediaInfo_New = MediaInfoDLL.MediaInfo_New() End Function Public Function MediaInfo_New_Quick(File As String, Options As String) As Long Attribute MediaInfo_New_Quick.VB_Description = "Create a new MediaInfo interface (with a quick init of useful options) and return a handle to it" MediaInfo_New_Quick = MediaInfoDLL.MediaInfo_New_Quick(StrPtr(File), StrPtr(Options)) End Function Public Function MediaInfo_Open(ByVal Handle As Long, File As String) As Long Attribute MediaInfo_Open.VB_Description = "Open a file and collect information about it (technical information and tags)" MediaInfo_Open = MediaInfoDLL.MediaInfo_Open(Handle, StrPtr(File)) End Function Public Function MediaInfo_Open_Buffer(ByVal Handle As Long, Begin As Long, ByVal Begin_Size As Long, End_ As Long, ByVal End_Size As Long) As Long Attribute MediaInfo_Open_Buffer.VB_Description = "Open a stream (begin and end of the stream) and collect information about it (technical information and tags)" MediaInfo_Open_Buffer = MediaInfoDLL.MediaInfo_Open_Buffer(Handle, ByVal Begin, Begin_Size, ByVal End_, End_Size) End Function Public Function MediaInfo_Option(ByVal Handle As Long, Option_ As String, Value As String) As String Attribute MediaInfo_Option.VB_Description = "Configure or get information about MediaInfoLib" MediaInfo_Option = bstr(MediaInfoDLL.MediaInfo_Option(Handle, StrPtr(Option_), StrPtr(Value))) End Function Public Function MediaInfo_Save(ByVal Handle As Long) As Long Attribute MediaInfo_Save.VB_Description = "Save the file opened before with Open() (modifications of tags)" MediaInfo_Save = MediaInfoDLL.MediaInfo_Save(Handle) End Function Public Function MediaInfo_Set(ByVal Handle As Long, ToSet As String, ByVal StreamKind As MediaInfo_stream_C, ByVal StreamNumber As Long, Parameter As String, OldParameter As String) As Long Attribute MediaInfo_Set.VB_Description = "Set a piece of information about a file (parameter is a string)" MediaInfo_Set = MediaInfoDLL.MediaInfo_Set(Handle, StrPtr(ToSet), StreamKind, StreamNumber, StrPtr(Parameter), StrPtr(OldParameter)) End Function Public Function MediaInfo_SetI(ByVal Handle As Long, ToSet As String, ByVal StreamKind As MediaInfo_stream_C, ByVal StreamNumber As Long, ByVal Parameter As Long, OldParameter As String) As Long Attribute MediaInfo_SetI.VB_Description = "Set a piece of information about a file (parameter is an integer)" MediaInfo_SetI = MediaInfoDLL.MediaInfo_SetI(Handle, StrPtr(ToSet), StreamKind, StreamNumber, Parameter, StrPtr(OldParameter)) End Function Public Function MediaInfo_State_Get(ByVal Handle As Long) As Long Attribute MediaInfo_State_Get.VB_Description = "Get the state of the library" MediaInfo_State_Get = MediaInfoDLL.MediaInfo_State_Get(Handle) End Function MediaInfoLib/Contrib/ActiveX/Project/MediaInfo.vbp100777 0 0 1555 12165362310 15401 0Type=OleDll Module=MediaInfoDLL; ..\..\MSVB5\Include\MediaInfoDLL.bas Class=ActiveX; ActiveX.cls Startup="(None)" HelpFile="" NoControlUpgrade=1 Title="MediaInfoActiveX" ExeName32="MediaInfoActiveX.dll" Command32="" Name="MediaInfo" HelpContextID="0" Description="ActiveX Wrapper for MediaInfo" CompatibleMode="0" MajorVer=0 MinorVer=7 RevisionVer=2 AutoIncrementVer=0 ServerSupportFiles=0 VersionCompanyName="http://MediaArea.net/MediaInfo" VersionFileDescription="ActiveX Wrapper for MediaInfo by Ingo Brckl" VersionLegalCopyright="BSD" CondComp="MEDIAINFO_NO_ENUMS = 1" CompilationType=0 OptimizationType=0 FavorPentiumPro(tm)=0 CodeViewDebugInfo=0 NoAliasing=0 BoundsCheck=0 OverflowCheck=0 FlPointCheck=0 FDIVCheck=0 UnroundedFP=0 StartMode=1 Unattended=0 ThreadPerObject=0 MaxNumberOfThreads=1 ThreadingModel=1 Path32="..\Release\" MediaInfoLib/Contrib/ActiveX/Release/ 40777 0 0 0 12264020633 12700 5MediaInfoLib/Contrib/ActiveX/Release/MediaInfoActiveX.dll100777 0 0 53000 12165355572 16647 0MZ@ !L!This program cannot be run in DOS mode. $PELQ?xD! $2@v2P(`!@ P.text-#$ `.datat@(@.idataP*@@.rsrc!`".@@.reloc8P@B%I'7MSVBVM50.DLL d))X** ++ :,A, ,,z-..2/ //n011>2%P%Q%$Q%P%P%4Q%P%@Q%P%l$l$Tl$l$Zl$l$l$l$l$9(p2l@@*\AC:\Daten\VB\DLL\MediaInfoActiveX\MediaInfo.vbp<@#,@e's`H @$4HXpMediaInfoMediaInfoDLLActiveXMediaInfo.dllMediaInfo_Close$4CSefghiLSZSdStS~SSSyyyUxy~yy xyxyyyy y)yyyyByJcyY+y3y$|yUyyyJyBy yxyyy yyDsy]yCy#y}y}yh yByyey[yyxyMSVBVM50.DLL_CIcos_adj_fptan__vbaFreeVar_adj_fdiv_m64_adj_fprem1__vbaSetSystemError_adj_fdiv_m32_adj_fdiv_m16i_adj_fdivr_m16i_CIsin__vbaChkstkEVENT_SINK_AddRefDllFunctionCall_adj_fpatanEVENT_SINK_Release_CIsqrtEVENT_SINK_QueryInterface__vbaExceptHandler_adj_fprem_adj_fdivr_m64__vbaFPException_CIlog__vbaErrorOverflow_adj_fdiv_m32i_adj_fdivr_m32i_adj_fdivr_m32_adj_fdiv_r__vbaVarDup_CIatan__vbaStrMove_allmul_CItan_CIexp__vbaFreeStrQ?xDX@(Q?xDpQ?xDQ?xDQ?xDQ?xDQ?xD ahddTYPELIB _IID_ACTIVEXh4VS_VERSION_INFODVarFileInfo$TranslationStringFileInfo040704B0dBCompanyNamehttp://mediainfo.sourceforge.netZFileDescriptionActiveX Wrapper for MediaInfo by Ingo Brckl0 LegalCopyrightLGPLD"ProductNameMediaInfoActiveX4FileVersion0.07.00028ProductVersion0.07.0002D"InternalNameMediaInfoActiveXT*OriginalFilenameMediaInfoActiveX.dll,OLESelfRegistere's`MSFT A< d,X L < 4!\ ` X%!,  !`x@  ! `  !P| x`0e's`e's`d0FFe's`e's`e's`,e's`HH0-stdole2.tlbWWWd $L@@h<$4p8H(dhtX TMediaInfoWWW8 _ActiveXd8'3ActiveXW8PMediaInfo_stream_CWW,8OMediaInfo_info_C8הMediaInfo_infooptions_CWMediaInfo_CloseWHandleWW'MediaInfo_Delete7MediaInfo_Count_GetW StreamKindWW StreamNumber 7MediaInfo_GetWWW hParameterWWWInfoKind {SearchKindWWuMediaInfo_GetIWWMMediaInfo_Inform\Reserved ]MediaInfo_NewWWW MediaInfo_New_QuickW%File,OptionsWQ!MediaInfo_OpenWW|W\MediaInfo_Open_BufferWWWBeginWWW Begin_SizeWWCEnd_End_SizeŨMediaInfo_OptionOption_WKValueWWW|MediaInfo_SaveWW wMediaInfo_SetWWWToSetWWW YOldParameterMediaInfo_SetIWW,MediaInfo_State_GetW@0SMediaInfo_Stream_General0aMediaInfo_Stream_VideoWW0MediaInfo_Stream_AudioWW0TBMediaInfo_Stream_TextWWW02MediaInfo_Stream_ChaptersWWW0]6MediaInfo_Stream_ImageWW0RMediaInfo_Stream_MenuWWW`0 MediaInfo_Stream_Max,0uMediaInfo_Info_NameW,0-MediaInfo_Info_TextW,0 MediaInfo_Info_MeasureWW,0MediaInfo_Info_OptionsWW,0BMediaInfo_Info_Name_Text,0@hMediaInfo_Info_Measure_TextW,09MediaInfo_Info_InfoW,0=MediaInfo_Info_HowTo,T0eMediaInfo_Info_MaxWW!0MediaInfo_InfoOption_ShowInInformWWW0MediaInfo_InfoOption_Support$04MediaInfo_InfoOption_ShowInSupported 0dMediaInfo_InfoOption_TypeOfValue0V3MediaInfo_InfoOption_MaxActiveX Wrapper for MediaInfoWMediaInfo ActiveX WrapperW7Close a file opened before with Open() (without saving)WWWDelete a MediaInfo interfaceWWlCount of streams of a stream kind (StreamNumber not filled), or count of piece of information in this streamWW?Get a piece of information about a file (parameter is a string)WWWAGet a piece of information about a file (parameter is an integer)W*Get all details about a file in one string:Create a new MediaInfo interface and return a handle to it`Create a new MediaInfo interface (with a quick init of useful options) and return a handle to itWWMOpen a file and collect information about it (technical information and tags)WmOpen a stream (begin and end of the stream) and collect information about it (technical information and tags)W/Configure or get information about MediaInfoLibWWW?Save the file opened before with Open() (modifications of tags)WWW?Set a piece of information about a file (parameter is a string)WWWASet a piece of information about a file (parameter is an integer)WGet the state of the libraryWWMediaInfo_Stream_GeneralWWMediaInfo_Stream_VideoMediaInfo_Stream_AudioMediaInfo_Stream_TextWMediaInfo_Stream_ChaptersWMediaInfo_Stream_ImageMediaInfo_Stream_MenuWMediaInfo_Stream_MaxWWMediaInfo_Info_NameWWWMediaInfo_Info_TextWWWMediaInfo_Info_MeasureMediaInfo_Info_OptionsMediaInfo_Info_Name_TextWWMediaInfo_Info_Measure_TextWWWMediaInfo_Info_InfoWWWMediaInfo_Info_HowToWWMediaInfo_Info_Max!MediaInfo_InfoOption_ShowInInformWMediaInfo_InfoOption_SupportWW$MediaInfo_InfoOption_ShowInSupportedWW MediaInfo_InfoOption_TypeOfValueWWMediaInfo_InfoOption_MaxWW@@,,D <,!D xP%| D $ t) D $Xp h- DL $Xp D1l D ,5L D D9| D$4 D=t D\$ h A D  P E D  8 I\ D P t M D T $Xh t Q D T $Xh 8U\ D ````````` ` ` ` ` ``<Hd8,X8|4lT4<4X4p44444@@@@@@@@(Lt8Tp44444L4d4444@@@@@@@@@@d8Tp444(4P4t@@@@@@h8Tp, 000$0,040<0D0L0T0\0d0l0t0|000000000000000000011 1111$1*10161<1B1H1N1T1Z1`1f1l1r1x1~11111111122222222223 333$3,343<3D3L3T33333334 4$4,444<4D4L4X4\4h4l4x444444444444444444444445555557778$848H8P8X8`8x88888888888888888884989@9E9P9U9x9|999999999999:: :::P:T:\:a:l:q:::::::::::::;;$;);4;9;X;\;d;i;t;y;;;;;;;;;;;<<<<>>????????? P00000 0$0(0004080<0@0H0L0P0T0X0`0d0h0l0p0t0|0000000000000000 110141T1X1x1|1111111 224282\2`222222222222333 33333 3$3,3@3H3L3P3j3o3t3333333333344488999*959>9H9^9o9x99999:::T::::;,;J;l;;;;;;<6<;G>l>>>>>+?g???????0$'0L0g00001W1|1111272MediaInfoLib/Contrib/ActiveX/Release/MediaInfoActiveX_Install.bat100777 0 0 437 12165355572 20276 0@echo off set _WINSYS_=%windir%\SYSTEM if exist %windir%\SYSTEM32\REGSVR32.EXE set _WINSYS_=%windir%\SYSTEM32 copy /y ..\..\MediaInfo.dll %_WINSYS_% >nul copy /y MediaInfoActiveX.dll %_WINSYS_% >nul %_WINSYS_%\regsvr32 /s %_WINSYS_%\MediaInfoActiveX.dll set _WINSYS_= echo Done. MediaInfoLib/Contrib/ActiveX/Release/MediaInfoActiveX_UnInstall.bat100777 0 0 507 12165355572 20577 0@echo off set _WINSYS_=%windir%\SYSTEM if exist %windir%\SYSTEM32\REGSVR32.EXE set _WINSYS_=%windir%\SYSTEM32 %_WINSYS_%\regsvr32 /u /s %_WINSYS_%\MediaInfoActiveX.dll del %_WINSYS_%\MediaInfoActiveX.dll rem do not delete MediaInfo.dll, it might be used elsewhere; del %_WINSYS_%\MediaInfo.dll set _WINSYS_= echo Done. MediaInfoLib/Contrib/ActiveX/Release/ReadMe.txt100777 0 0 1057 12165355572 14716 0The MediaInfoActiveX.dll is only a wrapper for the MediaInfo.dll which must already be installed on your computer. The MediaInfoActiveX.dll must be registered before it can be used. If you copied it, for example, to C:\WINDOWS\SYSTEM, you must call regsvr32 C:\WINDOWS\SYSTEM\MediaInfoActiveX.dll from Start / Run to be able to use it. Call regsvr32 /u C:\WINDOWS\SYSTEM\MediaInfoActiveX.dll to unregister. There are two batch files named MediaInfoActiveX_Install.bat and MediaInfoActiveX_UnInstall.bat carrying out all required steps for you. MediaInfoLib/Contrib/MSVB5/ 40777 0 0 0 12264020633 10611 5MediaInfoLib/Contrib/MSVB5/Example/ 40777 0 0 0 12264020633 12204 5MediaInfoLib/Contrib/MSVB5/Example/HowToUse_Dll.frm100777 0 0 10455 12165355572 15364 0VERSION 5.00 Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.1#0"; "RICHTX32.OCX" Begin VB.Form Form1 Caption = "Form1" ClientHeight = 9600 ClientLeft = 60 ClientTop = 345 ClientWidth = 8670 LinkTopic = "Form1" ScaleHeight = 9600 ScaleWidth = 8670 StartUpPosition = 3 'Windows-Standard Begin RichTextLib.RichTextBox RichTextBox1 Height = 9375 Left = 0 TabIndex = 0 Top = 120 Width = 8655 _ExtentX = 15266 _ExtentY = 16536 _Version = 327681 ScrollBars = 3 RightMargin = 10000 TextRTF = $"HowToUse_Dll.frx":0000 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Courier New" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit ' In order to run this example, put MediaInfo.dll into your system directory ' and Example.ogg into the root directory of drive C: (i.e. C:\). ' ' Use at own risk, under the same license as MediaInfo itself. ' ' Ingo Brckl, May 2006 Private Sub Form_Load() Dim display As String Dim Handle As Long ' information about MediaInfo display = bstr(MediaInfo_Option(0, StrPtr("Info_Version"), StrPtr(""))) display = display + vbCrLf + vbCrLf + "Info_Parameters" + vbCrLf display = display + bstr(MediaInfo_Option(0, StrPtr("Info_Parameters"), StrPtr(""))) display = display + vbCrLf + vbCrLf + "Info_Capacities" + vbCrLf display = display + bstr(MediaInfo_Option(0, StrPtr("Info_Capacities"), StrPtr(""))) display = display + vbCrLf + vbCrLf + "Info_Codecs" + vbCrLf display = display + bstr(MediaInfo_Option(0, StrPtr("Info_Codecs"), StrPtr(""))) ' an example of how to use the library display = display + vbCrLf + vbCrLf + "Open" + vbCrLf Handle = MediaInfo_New() Call MediaInfo_Open(Handle, StrPtr("C:\Example.ogg")) display = display + vbCrLf + vbCrLf + "Inform with Complete=false" + vbCrLf Call MediaInfo_Option(Handle, StrPtr("Complete"), StrPtr("")) display = display + bstr(MediaInfo_Inform(Handle, 0)) display = display + vbCrLf + vbCrLf + "Inform with Complete=true" + vbCrLf Call MediaInfo_Option(Handle, StrPtr("Complete"), StrPtr("1")) display = display + bstr(MediaInfo_Inform(Handle, 0)) display = display + vbCrLf + vbCrLf + "Custom Inform" + vbCrLf Call MediaInfo_Option(Handle, StrPtr("Inform"), StrPtr("General;File size is %FileSize% bytes")) display = display + bstr(MediaInfo_Inform(Handle, 0)) display = display + vbCrLf + vbCrLf + "Get with StreamKind=General and Parameter=""FileSize""" + vbCrLf display = display + bstr(MediaInfo_Get(Handle, MediaInfo_Stream_General, 0, StrPtr("FileSize"), MediaInfo_Info_Text, MediaInfo_Info_Name)) display = display + vbCrLf + vbCrLf + "GetI with StreamKind=General and Parameter=13" + vbCrLf display = display + bstr(MediaInfo_GetI(Handle, MediaInfo_Stream_General, 0, 13, MediaInfo_Info_Text)) display = display + vbCrLf + vbCrLf + "Count_Get with StreamKind=Audio" + vbCrLf display = display & MediaInfo_Count_Get(Handle, MediaInfo_Stream_Audio, -1) display = display + vbCrLf + vbCrLf + "Get with StreamKind=General and Parameter=""AudioCount""" + vbCrLf display = display + bstr(MediaInfo_Get(Handle, MediaInfo_Stream_General, 0, StrPtr("AudioCount"), MediaInfo_Info_Text, MediaInfo_Info_Name)) display = display + vbCrLf + vbCrLf + "Get with StreamKind=Audio and Parameter=""StreamCount""" + vbCrLf display = display + bstr(MediaInfo_Get(Handle, MediaInfo_Stream_Audio, 0, StrPtr("StreamCount"), MediaInfo_Info_Text, MediaInfo_Info_Name)) display = display + vbCrLf + vbCrLf + "Close" + vbCrLf Call MediaInfo_Close(Handle) Call MediaInfo_Delete(Handle) ' displaying the text RichTextBox1.TextRTF = display End Sub MediaInfoLib/Contrib/MSVB5/Example/HowToUse_Dll.vbp100777 0 0 1101 12165355572 15333 0Type=Exe Form=HowToUse_Dll.frm Module=MediaInfoDLL; ..\Include\MediaInfoDLL.bas Object={3B7C8863-D78F-101B-B9B5-04021C009402}#1.1#0; RICHTX32.OCX IconForm="Form1" Startup="Form1" Command32="" Name="Projekt1" HelpContextID="0" CompatibleMode="0" MajorVer=1 MinorVer=0 RevisionVer=0 AutoIncrementVer=0 ServerSupportFiles=0 CompilationType=0 OptimizationType=0 FavorPentiumPro(tm)=0 CodeViewDebugInfo=0 NoAliasing=0 BoundsCheck=0 OverflowCheck=0 FlPointCheck=0 FDIVCheck=0 UnroundedFP=0 StartMode=0 Unattended=0 ThreadPerObject=0 MaxNumberOfThreads=1 MediaInfoLib/Contrib/MSVB5/Include/ 40777 0 0 0 12264020633 12174 5MediaInfoLib/Contrib/MSVB5/Include/MediaInfoDLL.bas100777 0 0 7632 12165355572 15177 0Attribute VB_Name = "MediaInfoDLL" Option Explicit ' Include this module in your Visual Basic project for access to MediaInfo.dll and ' keep two things in mind concerning strings for Unicode ability: ' ' 1. All strings (constants and variables) passed to MediaInfo must be passed with StrPtr(). ' 2. All strings returned by MediaInfo must be converted with bstr() to a Visual Basic String. ' ' This module is tested and will work with Visual Basic 5 and 6 on Windows 98SE and 2000 ' (at least). ' ' Use at own risk, under the same license as MediaInfo itself. ' ' Ingo Brckl, May 2006 #If MEDIAINFO_NO_ENUMS Then #Else Public Enum MediaInfo_stream_C MediaInfo_Stream_General MediaInfo_Stream_Video MediaInfo_Stream_Audio MediaInfo_Stream_Text MediaInfo_Stream_Chapters MediaInfo_Stream_Image MediaInfo_Stream_Menu MediaInfo_Stream_Max End Enum Public Enum MediaInfo_info_C MediaInfo_Info_Name MediaInfo_Info_Text MediaInfo_Info_Measure MediaInfo_Info_Options MediaInfo_Info_Name_Text MediaInfo_Info_Measure_Text MediaInfo_Info_Info MediaInfo_Info_HowTo MediaInfo_Info_Max End Enum Public Enum MediaInfo_infooptions_C MediaInfo_InfoOption_ShowInInform MediaInfo_InfoOption_Support MediaInfo_InfoOption_ShowInSupported MediaInfo_InfoOption_TypeOfValue MediaInfo_InfoOption_Max End Enum #End If Public Declare Sub MediaInfo_Close Lib "MediaInfo.dll" (ByVal Handle As Long) Public Declare Sub MediaInfo_Delete Lib "MediaInfo.dll" (ByVal Handle As Long) Public Declare Function MediaInfo_Count_Get Lib "MediaInfo.dll" (ByVal Handle As Long, ByVal StreamKind As MediaInfo_stream_C, ByVal StreamNumber As Long) As Long Public Declare Function MediaInfo_Get Lib "MediaInfo.dll" (ByVal Handle As Long, ByVal StreamKind As MediaInfo_stream_C, ByVal StreamNumber As Long, ByVal Parameter As Long, ByVal InfoKind As MediaInfo_info_C, ByVal SearchKind As MediaInfo_info_C) As Long Public Declare Function MediaInfo_GetI Lib "MediaInfo.dll" (ByVal Handle As Long, ByVal StreamKind As MediaInfo_stream_C, ByVal StreamNumber As Long, ByVal Parameter As Long, ByVal InfoKind As MediaInfo_info_C) As Long Public Declare Function MediaInfo_Inform Lib "MediaInfo.dll" (ByVal Handle As Long, ByVal Reserved As Long) As Long Public Declare Function MediaInfo_New Lib "MediaInfo.dll" () As Long Public Declare Function MediaInfo_New_Quick Lib "MediaInfo.dll" (ByVal File As Long, ByVal Options As Long) As Long Public Declare Function MediaInfo_Open Lib "MediaInfo.dll" (ByVal Handle As Long, ByVal File As Long) As Long Public Declare Function MediaInfo_Open_Buffer Lib "MediaInfo.dll" (ByVal Handle As Long, Begin As Any, ByVal Begin_Size As Long, End_ As Any, ByVal End_Size As Long) As Long Public Declare Function MediaInfo_Option Lib "MediaInfo.dll" (ByVal Handle As Long, ByVal Option_ As Long, ByVal Value As Long) As Long Public Declare Function MediaInfo_Save Lib "MediaInfo.dll" (ByVal Handle As Long) As Long Public Declare Function MediaInfo_Set Lib "MediaInfo.dll" (ByVal Handle As Long, ByVal ToSet As Long, ByVal StreamKind As MediaInfo_stream_C, ByVal StreamNumber As Long, ByVal Parameter As Long, ByVal OldParameter As Long) As Long Public Declare Function MediaInfo_SetI Lib "MediaInfo.dll" (ByVal Handle As Long, ByVal ToSet As Long, ByVal StreamKind As MediaInfo_stream_C, ByVal StreamNumber As Long, ByVal Parameter As Long, ByVal OldParameter As Long) As Long Public Declare Function MediaInfo_State_Get Lib "MediaInfo.dll" (ByVal Handle As Long) As Long Private Declare Function lstrlenW Lib "kernel32" (ByVal pStr As Long) As Long Private Declare Sub RtlMoveMemory Lib "kernel32" (pDst As Any, pSrc As Any, ByVal bLen As Long) Public Function bstr(ptr As Long) As String ' convert a C wchar* to a Visual Basic string Dim l As Long l = lstrlenW(ptr) bstr = String$(l, vbNullChar) RtlMoveMemory ByVal StrPtr(bstr), ByVal ptr, l * 2 End Function MediaInfoLib/debian/ 40777 0 0 0 12264020622 7575 5MediaInfoLib/debian/changelog100777 0 0 257 12264020323 11531 0libmediainfo (0.7.67-1) unstable; urgency=low * See History.txt for more info and real dates -- MediaArea.net SARL Sat, 01 Jan 2011 00:07:17 +0000 MediaInfoLib/debian/compat100777 0 0 2 12165355574 11034 05 MediaInfoLib/debian/control100777 0 0 6362 12264020304 11304 0Source: libmediainfo Priority: optional Maintainer: MediaArea.net SARL Build-Depends: debhelper (>= 5), doxygen, tofrodos, libzen-dev (>= 0.4.29), zlib1g-dev, pkg-config, automake, autoconf, libtool Standards-Version: 3.7.3 Section: libs Homepage: http://MediaArea.net/MediaInfo Vcs-Svn: https://mediainfo.svn.sourceforge.net/svnroot/mediainfo/MediaInfoLib/ Vcs-Browser: http://mediainfo.svn.sourceforge.net/viewvc/mediainfo/MediaInfoLib/ Package: libmediainfo0 Section: libs Architecture: any Depends: libzen0 (>= 0.4.29), zlib1g Description: MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files. . The MediaInfo data display includes: - Container: format, profile, commercial name of the format, duration, overall bit rate, writing application and library, title, author, director, album, track number, date, duration... - Video: format, codec id, aspect, frame rate, bit rate, color space, chroma subsampling, bit depth, scan type, scan order... - Audio: format, codec id, sample rate, channels, bit depth, language, bit rate... - Text: format, codec id, language of subtitle... - Chapters: count of chapters, list of chapters... . MediaInfo analyticals include: - Container: MPEG-4, QuickTime, Matroska, AVI, MPEG-PS (including DVD), MPEG-TS (including Blu-ray), MXF, GXF, LXF, WMV, FLV, Real... - Tags: Id3v1, Id3v2, Vorbis comments, APE tags... - Video: MPEG-1/2 Video, H.263, MPEG-4 Visual (including DivX, XviD), H.264/AVC, Dirac... - Audio: MPEG Audio (including MP3), AC3, DTS, AAC, Dolby E, AES3, FLAC... - Subtitles: CEA-608, CEA-708, DTVCC, SCTE-20, SCTE-128, ATSC/53, CDP, DVB Subtitle, Teletext, SRT, SSA, ASS, SAMI... . This package contains the shared library for MediaInfo. Package: libmediainfo-dev Section: libdevel Architecture: any Depends: libmediainfo0 (>= 0.7.67), libzen-dev (>= 0.4.29) Replaces: libmediainfo0-dev Description: MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files. . The MediaInfo data display includes: - Container: format, profile, commercial name of the format, duration, overall bit rate, writing application and library, title, author, director, album, track number, date, duration... - Video: format, codec id, aspect, frame rate, bit rate, color space, chroma subsampling, bit depth, scan type, scan order... - Audio: format, codec id, sample rate, channels, bit depth, language, bit rate... - Text: format, codec id, language of subtitle... - Chapters: count of chapters, list of chapters... . MediaInfo analyticals include: - Container: MPEG-4, QuickTime, Matroska, AVI, MPEG-PS (including DVD), MPEG-TS (including Blu-ray), MXF, GXF, LXF, WMV, FLV, Real... - Tags: Id3v1, Id3v2, Vorbis comments, APE tags... - Video: MPEG-1/2 Video, H.263, MPEG-4 Visual (including DivX, XviD), H.264/AVC, Dirac... - Audio: MPEG Audio (including MP3), AC3, DTS, AAC, Dolby E, AES3, FLAC... - Subtitles: CEA-608, CEA-708, DTVCC, SCTE-20, SCTE-128, ATSC/53, CDP, DVB Subtitle, Teletext, SRT, SSA, ASS, SAMI... . This package contains the development support files needed for compiling and linking applications and libraries which use MediaInfo shared library. MediaInfoLib/debian/copyright100777 0 0 1074 12165362310 11635 0This package was debianized by MediaArea.net SARL on Wed, 26 Nov 2008 20:19:43 +0100. It was downloaded from Upstream Author(s): MediaArea.net SARL Copyright: License: BSD-2-Clause The Debian packaging is Copyright (c) MediaArea.net SARL and is licensed under the BSD-2-Clause, see `/usr/share/common-licenses/BSD'. # Please also look if there are files or directories which have a # different copyright/license attached and list them here. MediaInfoLib/debian/libmediainfo-dev.dirs100777 0 0 213 12165355574 13753 0usr/lib usr/lib/pkgconfig usr/include/MediaInfo usr/include/MediaInfoDLL usr/share/doc/libmediainfo-dev usr/share/doc/libmediainfo-dev/Doc MediaInfoLib/debian/libmediainfo-dev.install100777 0 0 345 12165355574 14466 0usr/lib/lib*.so usr/lib/*.la usr/lib/pkgconfig/* usr/include/MediaInfo/* usr/include/MediaInfoDLL/* usr/share/doc/libmediainfo-dev/Documentation.html usr/share/doc/libmediainfo-dev/Doc/* usr/share/doc/libmediainfo-dev/Examples/* MediaInfoLib/debian/libmediainfo0.dirs100777 0 0 44 12165355574 13241 0usr/lib usr/share/doc/libmediainfo0 MediaInfoLib/debian/libmediainfo0.install100777 0 0 212 12165355574 13763 0usr/lib/lib*.so.* usr/share/doc/libmediainfo0/History.txt usr/share/doc/libmediainfo0/License.html usr/share/doc/libmediainfo0/ReadMe.txt MediaInfoLib/debian/rules100777 0 0 11221 12165355574 11010 0#!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # shared library versions version=`ls src/.libs/lib*.so.* | \ awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'` major=`ls src/.libs/lib*.so.* | \ awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'` configure: configure-stamp configure-stamp: dh_testdir # Add here commands to configure the package. fromdos *.txt *.html Source/Doc/*.html chmod 644 *.txt *.html Source/Doc/*.html cd Source/Doc && doxygen Doxyfile cp Source/Doc/*.html ./ cd Project/GNU/Library && chmod u+x autogen cd Project/GNU/Library && ./autogen cd Project/GNU/Library && ./configure --disable-static --enable-shared --prefix=/usr --enable-visibility --disable-libcurl --disable-libmms touch $@ build: build-stamp build-stamp: configure-stamp dh_testdir # Add here commands to compile the package. cd Project/GNU/Library && $(MAKE) touch $@ clean: dh_testdir dh_testroot # Add here commands to clean up after the build process. # $(MAKE) clean dh_clean install: build dh_testdir dh_testroot dh_clean -k dh_installdirs # Add here commands to install the package into debian/tmp cd Project/GNU/Library && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install install -dm 755 $(CURDIR)/debian/tmp/usr/include/MediaInfo install -m 644 Source/MediaInfo/MediaInfo.h $(CURDIR)/debian/tmp/usr/include/MediaInfo install -m 644 Source/MediaInfo/MediaInfoList.h $(CURDIR)/debian/tmp/usr/include/MediaInfo install -m 644 Source/MediaInfo/MediaInfo_Const.h $(CURDIR)/debian/tmp/usr/include/MediaInfo install -m 644 Source/MediaInfo/MediaInfo_Events.h $(CURDIR)/debian/tmp/usr/include/MediaInfo install -dm 755 $(CURDIR)/debian/tmp/usr/include/MediaInfoDLL install -m 644 Source/MediaInfoDLL/MediaInfoDLL.cs $(CURDIR)/debian/tmp/usr/include/MediaInfoDLL install -m 644 Source/MediaInfoDLL/MediaInfoDLL.def $(CURDIR)/debian/tmp/usr/include/MediaInfoDLL install -m 644 Source/MediaInfoDLL/MediaInfoDLL.h $(CURDIR)/debian/tmp/usr/include/MediaInfoDLL install -m 644 Source/MediaInfoDLL/MediaInfoDLL_Static.h $(CURDIR)/debian/tmp/usr/include/MediaInfoDLL install -m 644 Source/MediaInfoDLL/MediaInfoDLL.JNA.java $(CURDIR)/debian/tmp/usr/include/MediaInfoDLL install -m 644 Source/MediaInfoDLL/MediaInfoDLL.JNative.java $(CURDIR)/debian/tmp/usr/include/MediaInfoDLL install -m 644 Source/MediaInfoDLL/MediaInfoDLL.py $(CURDIR)/debian/tmp/usr/include/MediaInfoDLL install -m 644 Source/MediaInfoDLL/MediaInfoDLL3.py $(CURDIR)/debian/tmp/usr/include/MediaInfoDLL sed -i -e 's|Version: |Version: %{version}|g' Project/GNU/Library/libmediainfo.pc install -dm 755 $(CURDIR)/debian/tmp/usr/lib/pkgconfig install -m 644 Project/GNU/Library/libmediainfo.pc $(CURDIR)/debian/tmp/usr/lib/pkgconfig install -dm 755 $(CURDIR)/debian/tmp/usr/share/doc/libmediainfo0 install -m 644 Release/ReadMe_DLL_Linux.txt $(CURDIR)/debian/tmp/usr/share/doc/libmediainfo0/ReadMe.txt install -m 644 History_DLL.txt $(CURDIR)/debian/tmp/usr/share/doc/libmediainfo0/History.txt install -m 644 License.html $(CURDIR)/debian/tmp/usr/share/doc/libmediainfo0 install -dm 755 $(CURDIR)/debian/tmp/usr/share/doc/libmediainfo-dev install -m 644 Changes.txt $(CURDIR)/debian/tmp/usr/share/doc/libmediainfo-dev install -m 644 Documentation.html $(CURDIR)/debian/tmp/usr/share/doc/libmediainfo-dev install -dm 755 $(CURDIR)/debian/tmp/usr/share/doc/libmediainfo-dev/Doc install -m 644 Doc/*.* $(CURDIR)/debian/tmp/usr/share/doc/libmediainfo-dev/Doc if test -d Doc/search/ ; then install -dm 755 $(CURDIR)/debian/tmp/usr/share/doc/libmediainfo-dev/Doc/search ; fi if test -d Doc/search/ ; then install -m 644 Doc/search/*.* $(CURDIR)/debian/tmp/usr/share/doc/libmediainfo-dev/Doc/search ; fi install -dm 755 $(CURDIR)/debian/tmp/usr/share/doc/libmediainfo-dev/Examples install -m 644 Source/Example/HowToUse* $(CURDIR)/debian/tmp/usr/share/doc/libmediainfo-dev/Examples # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot dh_install --sourcedir=debian/tmp dh_installchangelogs dh_installdocs dh_installexamples # dh_install # dh_installmenu # dh_installdebconf # dh_installlogrotate # dh_installemacsen # dh_installpam # dh_installmime # dh_installinit # dh_installcron # dh_installinfo dh_installman dh_link dh_strip dh_compress dh_fixperms # dh_perl # dh_python dh_makeshlibs dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install configure MediaInfoLib/History_DLL.a.txt100777 0 0 264500 12247653223 11650 0Notes: ------ + Added - Deleted x Correction #number is the identifier of bug report (B), requested feature (F) or patch (P) bug reports and feature request are here: https://sourceforge.net/p/mediainfo/_list/tickets Version 0.7.66, -------------- + EBUCore 1.4 output support + IMF AssetMap (AM), PackageList (PKL) and CompositionPlaylist (CPL): improved support x ProRes: trying to have a better detection of scan order Version 0.7.65, 2013-11-20 -------------- + MXF: forcing detection of MPEG Video in case EssenceCompression is not present but MPEG2VideoDescriptor is present + GXF: detection of some captions and time codes event if they are not present at the beginning of the file (testing middle of the file) + DASH MPD: basic support + HDS F4M (Flash Media Manifest): basic support + DCP AssetMap (AM), PackageList (PKL) and CompositionPlaylist (CPL): basic support + IMF AssetMap (AM), PackageList (PKL) and CompositionPlaylist (CPL): basic support + Mac dylib: looking for the dylib in @executable_path and CFBundleCopyExecutableURL dir + AAC: option for instantaneous bitrate in fast detect mode (MediaInfoLib only) + FTP (custom builds only): support of UTF-8 file names + Colour description: colour_description_present added, better separation between bitstream values and container values + MPEG-4: RLE, color space and bit depth + Law rating: support of CEA-608 XDS Content Advisory in MPEG-PS, MPEG-Ts, LXF, GXF + MPEG-4/MOV: Bug found in one file, sample size is 16 with a 32-bit CodecID ("fl32"), correcting the output of MediaInfo x #B775, AVI: AVI can use negative height for raw to signal that it's coded top-down, not bottom-up x #B780, MPEG-TS: crash with some files having PAT/PMT change between begin and end of the file x #B782, PBCore 1.2: some fields were not in the right order x #B784, some humain readable strings were not removed when the corresponding field is removed x #B787, MPEG-4/QuickTime: Erratic appereance of Bitrate Mode x #B798: setlocale() remove from DLL x #B785, DVCPRO HD: streams can be 8 or 10 bit, removing hard coded value from DV parser (MXF header value is used instead when applicable) x MPEG-4: wrong demux of some E-AC-3 streams x AAC: detection of HE-AACv2 was missing if the library is configured with fast detection x MPEG Video: wrong computing of duration of raw stream in case of drop frame time code x Automation, StreamKind type was set to integer, it is text x MPEG-4: was reading lot of useless bytes from disk when the raw stream format is not known x AVI: crash with some malformed text streams x Reference/playlist files were not supported from FTP (custom builds only) x MPEG-4/MOV: ScanOrder was using "stored" value instead of "displayed" value x MXF: Detection of Dolby E was not working in some cases (regression in 0.7.62) x MPEG-4/MOV: freeze with some files having mono 32-bit PCM Version 0.7.64, 2013-07-05 -------------- + New canonical URL of the website: http://MediaArea.net/MediaInfo + E-AC-3: support of streams having substreams (e.g. more than 6 channels) + JPEG: detection of YUVA, RGB, RGBA and YCCK color spaces + MPEG Audio: detection of Id3v1 inside an MPEG Audio frame + Matroska: support of HEVC/H.265 (based on specifications draft from DivX inc) + Canopus: detection of scan mode, scan order, pixel aspect ratio + MD5 generation option (work in progress) + Id3v2: reading of all Id3v2 blocks (no more only the first one) at the beginning of the file + MPEG-4: support of few additional iTunes tags, thanks to Kurtnoise + AVI: detection of Ut Video, thanks to Kurtnoise + MXF: detection of Dolby E even if EssenceCompression is not SMPTE 337 + AIFF: detection of Dolby E + AIFF: detection of not aligned Dolby E + ARIB B24/B37: Caption_conversion_type display (HD, SD, Mobile) + MPEG-TS: displaying CEA-708 service and CEA-608 presence if the corresponding ATSC descriptor is present + MPEG-TS: quicker analysis in the case of quick parsing option + #F412, Matroska: Handling of files having no DocType x #B761, MPEG-TS/ARIB: crash with some streams, thanks to maki x #B765, Matroska: was parsing the complete file if a stream indicated in the header is not present x #B763, MXF: detection of incoherency of channel count between bitstream and wrapper x #B762, Matroska: detecting 23.976 frame rate (instead of 23.962 fps due to imprecise timestamp) x #B759, QuickTime: detection of time codes having tcmi not embedded in tmcd box x #B766, RMVB: a/v delay is incorrect, currently disabling it x #B768, MPEG-4, crash with some MPEG-4 files x #B769, MPEG-4, crash with some MPEG-4 files x #B764, AVC: wrong parsing of some streams having pic_scaling_matrix x AVC, crash with some AVC streams x AAC, infinite loop with some AAC streams x FLV, infinite loop with some FLV files x Matroska: crash with some malformed files x MOV: crash/long parsing with some malformed files x AC-3: crashes and freezes fix x Java 64-bit: Count_Get(StreamKind) was always returning 0 x Python 64-bit: Count_Get(StreamKind) was always returning 0 x DTS: some streams were not detected x DTS: some memory leaks with 14-bit streams x SMPTE ST 302: memory leaks x SMPTE ST 337: memory leaks x Total failure if MEDIAINFO_REFERENCES_NO #define was used x QuickTime: Time code name is in "Title" field x MPEG-4/QuickTime: handling of weird "negative" frame duration is stts Version 0.7.63, 2013-05-13 -------------- + Switched to a BSD-2-Clause license + LXF: AFD (from ancillary stream) support + Detection of some side car files and showing them as a single package (optional) + MOV: more channel positions information + TTML: detection + SAMI: detection + ID3: updated list of genres, thanks to Mats + .so: search a local copy of the library before trying default path + AVI: Support of Adobe PARf (Aspect Ratio) chunk + VC-3: Scan order + #P65, Flac/Ogg DISCTOTAL metadata support, thanks to Kurtnoise + #P67, MOV, add Hap Video to the database, thanks to Kurtnoise + #P67, Matroska, add VP9 to the database, thanks to Kurtnoise + #P68, FLV, add HEVC detection in the FLV parser + #P66, MOV, tref/chap handling, with chapters information, thanks to Kurtnoise + #P72, MOV, HEVC/H265 detection and basic support, thanks to Kurtnoise + #F382/P75, PMP format detection + MPEG-TS, HEVC/H265 support + 16:10 DAR known value x #B742, MPEG-4/MOV, crash with some truncated/invalid files x #B746, MPEG-4/MOV: crash with files having moof atom and no moov atom x #B747, Inconsistent hang with buffer API x #B757, MediaInfoDLL.py MediaInfoList was not working, thanks to Elbenfreund x #B740, XML: dt:dt is replaced by dt (for binary data) x MXF: Dolby E streams starting only at the second or third frame were not well detected x MPEG-4/MOV: reducing analysis time for I-frame only video streams x CEA-708: weird behavior phantom streams are displayed) in case of buggy CEA-708 x AVI: crash with audio delay and AvgBytesPerSec of 0 x Wrong demuxing of the caption stream in the case of AVC streams without frame_mbs_only_flag but having 2 fields in one slice. x DPX: parsing was very slow with a sequence of files. x MXF: Pre-charge duration was not read, time code of the first frame was wrong if "Origin" is not 0 x FLV: file was sometimes (e.g. most of the file padded with zeroes) fully parsed x VC-3: Using values from specifications (based on compression ID) instead of SBD/SST/SPL/APLF from bitstream Version 0.7.62, 2013-02-22 -------------- + ARIB STD B24/B37 caption detection (both Japanese and Brazilian versions) + LXF: support of AVC, VC-3, MPEG audio, AC-3, Dolby E, and AAC detection and analysis + AC-3: support of 22.05 kHz streams (out of specs but they exist) + MOV: AIC (Apple Intermediate Codec) scan type detection + MOV: support of AVID metadata (interlacement information) + Time code dedicated tracks (MOV, MXF, GXF) + Time code track (MPEG-4/MOV, GXF, MXF) + Time code in SDTI (MXF) + Time code in System scheme 1 (MXF) + Time code in SMPTE RP 188 (aka SMPTE ST 12-2 aka ATC aka VANC) (GXF, LXF, MXF) + Time code in SMPTE RP 196 (aka HANC) + MPEG Video Time code + MPEG-TS: format_identifier, pointer_field, section_length (hidden by default) + CEA-608/708: caption detection duration is increased to 15 seconds (or 64 MB) in order to miss less caption content + Image files as a video stream: file name of the last file x #727, MOV: crash with some malformed files (Time scale set to 0) x #728, AAC: crash with some malformed streams x #681, AVI: was not analyzing VBR streams without bit rate info in header x #736: Division by 0 with 0-byte files x Id3v2: crash with some malformed tags x Bit rate display was "0 bps" if the real bit rate is more than 4 Gbps x Division by 0 in case of 0 byte long file x MPEG-4: wrong muxing mode information in case of A/53 captions in MPEG Video in MOV x P2 Clip: wrong uppercase/lowercase in the file name of source files. x MOV: PCM endianness was sometimes wrong x MPEG-4: JPEG interlacement was sometimes wrong x MPEG Video: wrong DAR information in case of DAR change between begin and end of the file Version 0.7.61, 2012-10-22 -------------- + MPEG-TS: SCTE 35 and KLV streams are better displayed (in Menu part) + MPEG-TS: Menu part contains the list of PID with unknown format + MPEG-TS: Menu part lists PID in the PMT order instead of increasing order + Display of both container and stream scan type and scan order + DV100: scan order + MXF: scan order + MPEG-TS: Maximum and minimum overal bit rate (only if parse speed is set to 1) + MPEG-TS, MPEG-S, MXF, AVI, WM: StreamOrder field added + MXF: better support of malformed VANC streams + MPEG Video: improved detection of the GOP (more frames are used), "Variable" value + MPEG-PS: FirstPacketOrder info added + SkipBinaryData option x #3564456, Matroska: some (other) streams were wrongly detected sa VFR x #3570092, Id3v2: support of old COM and ULT fields x CEA-708: crash with some malformed streams x MPEG-TS: crash when PCR is corrupted (same value at different offsets) x QuickTIme: wrong channel count report in case of buggy chan atom. Now the stream description has priority over chan atom x E-AC-3: duration was wrong in some cases x Matroska: random wrong analysis in case of SimpleBlock mode x #3574436, MOV: hang on files having buggy "alis" atom x MPEG-TS: bit rate mode detection was sometimes too much strict about CBR x DV: wrong detection in case of buggy audio header (if present and set to 0xFF) x MPEG-4: crash in case of buggy aperture size atom x MediaInfo_Const.h was missing in the DLL package for Mac x MPEG-PS: detection of phantom streams x WAV: detection of malformed >4GB WAV files was no more working x DTS: computing bit rate from frame size instead of targeted transmission rate x DTS: setting the bit rate to "unknown" for Master Audio instead of instantaneous bit rate x DTS: Display of endianess and word size was not coherent Version 0.7.60, 2012-09-02 -------------- + MPEG-TS/PS: improved detection of buggy time stamps + DPX: color primaries and transfer characteristics + MPEG-TS: Added support of scrambled streams without transport_scrambling_control bit set (e.g. PlayReady) + MPEG-TS: Name of some scrambling algorithms + MPEG-TS: detection of CBR/VBR at container level + MPEG Video: better detection of variable GOP + MPEG-TS: average, minimum, maximum PCR distance (hidden by default and you must parse the whole file with --ParseSpeed=1 option) x Matroska: some streams were wrongly detected sa VFR x #3538378, XML output: invalid characters, now if there is an invalid character, data is transported in base64 x LXF: wrong video bit rate with some files x AC-3/E-AC-3: hang up with some Little Endian streams x AAC: wrong min and max bit rate in case of partial (default) parsing, disabling it x AVC: crash or hang up with some malformed/scrambled streams x Opus: wrong duration in case of non-48kHz stream x MOV: 25 fps + drop frame time codes were not handled correctly Version 0.7.59, 2012-08-08 -------------- + License: Switched back to LGPLv2+Exceptions + #3555183, PCX support, thanks to Lionel Duchateau + #3555182, PSD support, thanks to Lionel Duchateau + #3555181, Matroska: ALAC detection, thanks to Lionel Duchateau + #3540425, OGG/MKV: Opus speech format support, thanks to Lionel Duchateau + #3531808, AVI: detecting more inconsistencies in stream durations + GXF: crash with Time code tracks without frame rate info + MPEG-4: stream order (hidden by default), in order to provide the same numbers as mkvtoolnix 5.2+ Track ID + QuickTime: default channel map is "L R" for stereo streams (as it seems to be in QuickTime player) + MPEG-4: support of WMA (version 1, version 2, Pro, Lossless) in MPEG-4 + FLV: handling of metadata with an underscore before the real metadata name + MXF: support of files with header missing TrackNumber in the descriptor (if it is present only in footer) + MXF: Language from DMS-1 + ProRes: analysis of the ProRes raw stream (including scan order for interlaced content) + colour_primaries, transfer_characteristics, matrix_coefficients: canonicalization of results + MPEG-4 Visual: colour_primaries, transfer_characteristics, matrix_coefficients + ProRes: colour_primaries, transfer_characteristics, matrix_coefficients + GIF: Display Aspect Ratio x #3533984, different behavior depending of compilation options (so Linux version was missing some info) x MPEG-4: audio/video delay was wrong in case of negative delay x CEA-608: Memory leaks removed x AVC: crash in case of analyzing some invalid SEI x MPEG Audio: crash with some files having Lyrics 2 tags x MPEG Audio: crash with some files having APE tags x AVI: secondary genre comes after primary genres in the "Genre" field x FLV: better handling of files containing more than 1 meta chunk x MPEG-TS/MPEG-PS: was aborting during full parsing in the case of very damaged streams x Vorbis: infinite loop if codebook_entries>=256 x Id3v2: crash with some unsynchronized frames, especially with UTF-16 comments x Id3v2: Wrong mime type of covers x MPEG-PS: crash in case of language info in descriptors x Java binding: crash with MediaInfo::Inform() (Windows 32-bit only) x MPEG-TS: false-positive in case of some MPEG-4 files with wrong extension x FLV: crash in some specific cases (malformed files) x 3548314, MVC: Scan type was wrong with MVC-only (without the underlying AVC stream) stream x 3553588, MPLS: stream duration was wrong with standalone (without the referenced M2TS) files x 3553588, MPLS: incoherent behavior with MPLS having more than one PlayListItem x 3554154, MPEG-TS: crash with some corrupted streams x MOV: all EIA/CEA-608 captions were not well detected x Matroska: Trying to better detect VFR streams, frame rate was wrong in case of interlaced content Version 0.7.58, 2012-05-28 -------------- + AC-3: Little Endian streams support + LXF: AVC streams support + ISM: better support + File referencing other files (HLS, ISM...): menu in case there is more than 1 stream per referenced file + MPEG-TS: option for keeping streams detected at the beginning then disabled in a an update of the PMT (activated by default) + MPEG-PS: program_map_section support for uncommon streams embedded in MPEG-PS x Referenced files (MXF, HLS, MOV, P2, XDCAM...): issues with source name, track order, files size x MPEG-TS/MPEG-PS: regression, some files with AC-3/DTS/DVD subtitles were not well analyzed anymore x MPEG-4 channel mapping: Lt and Rt (matrix-encoded) channel mapping were missing x GXF: handling of buggy files having non-PCM AES3 codec identifier but actually having PCM x MPEG-4: better support of MPEG-4 files having corrupted metadata atom x 3529510, EIA/CEA-708: was not detected if the stream was not present at the beginning, thanks to Pete Chapman Version 0.7.57, 2012-05-02 -------------- + #3513490, Vorbis comment (Flac, Ogg): more tags are supported + XML-based formats (P2, XDCAM, DCP, ISM, HLS...): support of UTF-16 encoding + MPEG-4: for buggy PCM, prioritizing the codec ID "in24" = 24-bit against the bit depth field x #3516900, Vorbis comment (Flac, Ogg): trying to do better mapping of PERFORMER and ARTIST tags x MXF: wrong video frame count in some cases x #3517374, GCC 4.7: compilation issues removal, thanks to SpepS x MPEG-PS: some files were not well demuxed so analysis was sometimes wrong (especially macroblock parsing) Version 0.7.56, 2012-04-08 -------------- + Better support of machines lacking of std::stringstream + Better support of machines requesting explicit stdc++ library link option (e.g. some ARM embedded devices) x #3515515, MPEG-4: crash with MPEG-4 container + H264/AVC video stream x #3515393, MPEG Audio: infinite loop (freeze) with some files x #3514677, Video: Well known 1.85:1 display aspect ratio was incorrectly displayed as 16:9 x #3513908, File interface: No output if filename contain a colon x #3515893, MPEG-4: some specific files were not detected x AVI: infinite loop (freeze) with some files (having index containing 0-sized chunk) x AVC: memory leaks x libcurl support: libcurl config from MediaInfo is compatible with libcurl+gnutls Version 0.7.55, 2012-04-05 -------------- + AC-3: support of little endian streams + LXF: support of format version 0 + HLS: support of .m3u8 index and sequence referencing a bunch of MPEG-TS files + MPEG-4: Added support of glbl atom and corresponding 4CC (ai12, ai15, ai1q, ai5q) + MPEG-4: Added detection of files with mx5p files wrongly filled with raw MPEG Video instead of MXF + MPEG-TS: Detection of 20-bit Dolby E even if the SMPTE 302 M header is set to 24-bit x #3513490, Id3v2: mapping of "Encoded by" and "Encoding library" is conform to the specs now x MXF: hang up with some clip-wrapped files x MPEG-4: AVC-100 bit rate was not coherent depending of the container (MPEG-4 or MXF) x reVTMD output is disabled due to its non-free (point of view of FSF and DFSG) licensing. Version 0.7.54, 2012-03-13 -------------- + #3480111, Matroska: parsing of WebM-style frame rate info + #3499859, ALAC: parsing of the alac atom, for real bit depth / sample rate + #3487601, DV: fields order (TFF/BFF) + MPEG-4: more video 4CCs binded to MPEG Video + H.263: raw stream parsing (width, height, aspect ratio), comparison with container data + Speed improvements + MPEG-PS: supporting parsing of some non-conform files + Full support of CEA-608 (separation of CC1-CC4, T1-T4) + #3494722, MPEG-4: trying to detect wrong duration in track header + MPEG-4 with embedded MXF track (XDCAM...): separation of video bitrate and padding bitrate + Compound streams (e.g. DV): separation of video bitrate and audio bitrate + Blu-ray: LPCM mono real bit rate is separated from the encoded (stereo) bit rate + Support of https, sftp scp protocols (custom builds only) + AVI: vprp (OpenDML) display aspect ratio support x #3480111, Matroska: some frame rates are incorrect in the file, trying to detect this kind of malformed file x #3479494, AVC: segmentation fault x #3440638, AAC: wrong detection for some malformed AAC streams x #3440638, MPEG-4: wrong analysis of some files having track header after media information x #3480111, MXF: Height was wrong for MXF with FrameLayout = Mixed fields x #3468235, Blu-ray: displaying PGS in all cases (even if PES is not detected, they are too much rare) x #3498846, MPEG-4: delay between audio and video was no more detected x #3495573, MPEG-4: crash with some files having fragments x MPEG-4: channel position in case of channel atom is configured with ChannelBitmap x MPEG-TS: crash with some buggy files (a PID indicated as PSI and PES at the same time) x AES3: not detecting Dolby E stream if there is guard band before the Dolby E frame, in MPEG-TS x DPX: some files with some invalid fields were not detected x DTVCC Captions: crash with some buggy streams Version 0.7.53, 2012-01-24 -------------- + DV: option for ignoring transmitting flags (TF1/TF2/TF3) (DLL and CLI only) + Matroska: ProRes detection + MPEG-4: official DTS CodecIDs (dtsc/dtsh/dtsl/dtse) support, thanks to Lionel Duchateau + Matroska: stream order (hidden by default), in order to provide the same numbers as mkvtoolnix 5.2+ Track ID + #3471516, BLu-ray: wrong channel count for mono/3-channel/5-channel/7-channel PCM streams + AVI: ISMP (SMPTE Time code), Tdat tc_o/tc_a (Adobe Premier time code) support + reVTMD output x QuickTime: crash and sometimes wrong info with some files having compressed header x MPEG-4: commercial format typo error (EX422 instead of HD422) x MXF: handling wrong MXF header having frame height instead of field height x #3471053, Tags: Id3v1 tag was used instead of Id3v2 if the file is short x #3463117, MPEG-TS: crash if Conditioal Access PID is same as the PES x Custom output: better handling of cases with special character strings (\n...) in the file content x #3440664: Audio only AVI file is missing duration x #3453476: detection so incorrect duration information in tkhd atom x Detailled XML output was producing duplicate xml-tags Version 0.7.52, 2011-12-19 -------------- + MXF with referenced files: if the referenced file is not available, trying to open local files + MPEG Video: GOP size for I-Frame only streams + MXF: support of CEA-608 in ancillary data for some other formats than MPEG Video, if there is no B-frame + LXF: support of SMPTE ST291/CDP/CEA-608/CEA-708 in ancillary data + WAV: better handling of files not having word alignment x DV: crash (division by zero) in some cases x DV: DVCPRO HD was sometimes not detected (low bitrate) x MXF: Crash if AFD field has an invalid value x MXF: Wrong endianess for some big endian PCM streams x MXF: some MXF referencing files have wrong duration x MXF: duration was wrong with some specific files x DVD-Video: detection of 20-bit and 24-bit PCM x XML output: it was sometimes containing some invalid characters x MPEG-4: considering default char set as ISO-8859-1 x MXF: better handling of referencing files having the same ID for all tracks x MXF: Handling of MXF files with wrong FooterPartition field x MXF: Some captions (not starting at the beginning of the file) were not detected x WAV: duration was missing is some cases x RMP3 support was broken Version 0.7.51, 2011-11-11 -------------- + #2872918, MKV: add support for default and forced track flags + #3418881, RK Audio format support, thanks to Lionel Duchateau + #3418883, LA: version field, thanks to Lionel Duchateau + MPEG-4: basic support of Aigo .3dv files + MPEG-2 Video: color display info (colour_primaries, transfer_characteristics, matrix_coefficients) + QuickTime: color display info (colour_primaries, transfer_characteristics, matrix_coefficients) + QuickTime: ProRes LT, Proxy, 4:4:4 profiles detection + QuickTime: mpeg CodecID support + Template inputs are now insensitive to carriage return kind (Windows \r\n, Mac \r, Linux \n) + MPEG-TS: Support of ISO 8859-2 in EPG + MPEG-4: more CodedIDs supported + GXF: more info about DV streams + GXF: Handling of files with more than 1 Time code x #3414326, GXF: using only the first map chunk for duration calculation x #3414513, Id3v2: was not able to extract covers with UTF-16 description x #3417908, video from several files: crash if there is not enough place for the frame number x #3433602, DVD-Video (IFO): Crash when scanning some malformed IFO files x Matroska: parser hanging in case of huge zero-padded files x MPEG-4: was not providing some info about tracks with sample table before media header x MXF: better support of corrupted indexes x #3429831, MediaInfo library: unload wrong DLL, thanks to McSpecky x MPEG-TS: Better handling of EPG running_status flag x MXF: Handling of "file:///" in Network loacators x FLV: audio delay was sometimes wrong x H264: Buffer size was in bytes instead of bits like with other formats x #3429196: no output if absolute file name, on Linux x #3187050, FLV: wrong detection when FLV header is corrupt x BLu-ray: crash if MPLS files are on the root of a disk x Blu-ray: parsing was very slow if MPLS was pointing thousands of times on the same file x #3292830, Matroska: crash if AAC sample rate is not provided by the container Version 0.7.50, 2011-09-23 -------------- + DVB Subtitle: region_width / region_height / region_depth (hidden by default) + MPEG-4: hdv6 and mx4p CodecID support (MPEG Video) + AVI: v210 CodecID (YUV) detect + #3411596, CDDA support, thanks to Lionel Duchateau + MXF: support of AC-3 + #3411999, AVi: detection of GeoVision MPEG-4, thanks to Lionel Duchateau + #3411999, MPEG-4: detection of VC-1 (WMV3), Nellymoser and WMA2, thanks to Lionel Duchateau x AVI: Better support of 2 video streams (e.g. "3D AVI") in a file x MPEG-TS: Duration was not provided in some cases x FLV: Delay and duration for AAC was wrong if delay was not 0, thanks to Justin Greer http://zencoder.com x #3408005, IFO: crash with some files x MPEG-4: some bitrates where wrong if smooth streaming is used Version 0.7.49, 2011-09-09 -------------- + AES3: analyzing AAC, AC-3, MPEG Audio embedded in AES3 stream + GXF: detection of DolbyE in AES3 in GXF + WAV: detecting AES3 non-PCM audio inside WAV + MPEG Video: more precise duration for 29.97 fps material having time code without drop frame flag set + MPEG-4/MOV: delay from time code track conforming to Final cut (using integral frame rate value if frame drop flag is not set) + Overall bit rate mode (CBR or VBR) + DVB Subtitle: region_horizontal_address / region_vertical_address (hidden by default) + MPEG-TS: option (--ParseSpeed=0.8) for testing the stream until all advertised streams are detected x MXF: some files with SDTI were not well demuxed (frame number) or were crashing x Some files where wrongly detected as MPEG-PS without streams x AC-3: non-48 KHz streams were not analyzed x 3164893, JPEG: issue with some JPEG files with no/incorrect extention x 3403338, crash with four character filenames Version 0.7.48, 2011-08-16 -------------- + ISM (ISM/ISMV/ISMA/PIFF...): more attributes (frame rate, frame count, duration) + MP3: support of VBRI header in a corrupted frame + Active Format Description: muxing mode (A/35 or SMPTE ST 2016-3) + MP4/MOV: Displaying info about first description atom of a track (instead of all of them) x MP4/MOV: scan order (Top/Bottom) from container, thanks to Peter Chapman x MP4: Channel layout was not filled in some cases x libmms: default behavior is using official libmms API only x Vorbis comment: album performer data was in performer field x Captions in AVC: some captions were not detected and decoded x AVC: GOP structure info was often wrong x MXF: IndexTable search was buggy (parsing the whole file) for some rare files (index present twice) Version 0.7.47, 2011-07-14 -------------- + ISM (ISM/ISMV/ISMA/PIFF...) support + SCC (Scenarist Closed Captioning) support + #3201768, BMP: BitmapV4Header support, thanks to Lionel Duchateau + MP4: enda atom support (Endianess) + MXF: expliciting PCM endianess x #3354384, Vorbis in AVI, version 3+ was displayed as 2+ x MPEG-4/MOV: files with big "free" atom were not parsed Version 0.7.46, 2011-07-04 -------------- + MXF: TrackName + DCP: Basic support (video and audio streams), both Interop and SMPTE versions + P2 Clip: Supporting directories with wrong letter case + MXF: detection of AES3/Dolby E in mono PCM streams without compression scheme + MP4: first frame duration difference if first frame has not the same duration than all other frames + MP4: frame rate set as CFR if only the first frame has a different duration + MP4: Handling of track duration smaller than media duration (track duration and stream size have priority) + #3348936, MXF: OP-Atom profile + Matroska, Stereo Layout support, thanks to Lionel Duchateau x libcurl (FTP/HTTP): seek request was buggy, invalid data was read x MPEG Video in MPEG-TS or MP4: streams were wrongly detected as VBR or CBR, any bit rate mode is removed until a working solution is found x AES (S302M): was no more detected if the packet was split in several PES x #3325235, Vorbis: streams were wrongly reported as CBR x EXR: Width/Height were 1 less than real value x #3344635, MP4/MOV: Delay missing if timecode track found before audio/video, thanks to Peter Chapman Version 0.7.45, 2011-06-15 -------------- + QuickTime: Support of EIA-608 streams created by Final Cut + Matroska: Support of Matroska tags + Matroska: parsing of tags at the end of the file (previously: only tags at the beginning) + MP4/MOV with uncompressed streams: scan type (interlaced/progressive) + YUV4MPEG2 (Y4M) support + GXF: more information about AES3 audio streams + EXR: Basic support + E-AC-3: dialnorm/dynrng (first frame / first block) information + LXF: support of DV PAL + DPX: Support of Cineon old format + DPX: Support of file with Little Endian configuration + MPEG-4: better support of file with more than one mdat or moov atom + WAV: more details from bext chunk + MXF: AFD (in both descriptor or ANC) support + MXF: Support of AES3 / Dolby E in 2 mono channels + MPEG-4: support of some malformed (without mdat atom) files + MXF: Better detection of streams without Essence Compression descriptor x MPEG Video: Custom matrix detection was broken x DPX: Industry specific header was not well decoded x JPEG-2000: Chroma subsampling 4:2:0 was recognized as 4:4:4. x Matroska: Handling default values for TrackVideoDisplayWidth and TrackVideoDisplayHeight x MPEG-TS: private audio streams with 0xCO stream_id were not correctly detected x FLV and RIFF: Changing Sorenson H.263 to Sorenson Spark because this stream format is too much incompatible with H.263 x MXF: Some specific files (including AFD in descriptor) were not well parsed Version 0.7.44, 2011-04-19 -------------- + AVI: support of some corrupted files (RIFF size set to 0) + AC-3: support of streams with 16-byte time stamp between frames + MPEG-TS: creation of index files, seek feature + GXF: seek feature + MXF: seek feature + MPEG-TS: detecting wrong stream registration information and skipping it + NTSC: accepting 483-line streams as NTSC + MXF: Parsing speed improvement, especially for high bitrate (>300 Mbps) streams + TGA file basic support + libmms: MMSH support (Linux/Mac only), thanks to RGB Networks + libcurl: HTTP header option and Time to live, thanks to RGB Networks + Id3v2 and MPEG-4: possibility to customize tag mapping + TIFF: more details x MXF: some specific files were not analyzed, fix sponsored by http://maxnine.com x LXF: random crashes Version 0.7.43, 2011-03-19 -------------- + MPEG-TS: detection and display of real time PAT/PMT change improved x EIA-708: crash with some specific files x MP4: crash with wiles including mix of PCM and other audio formats x AAC: crash with some malformed streams x FLV: crash with some specific files (longer audio than video at the end of the file) x MP4: wrong framerate information with some specific files (track header after media information) Version 0.7.42, 2011-03-03 -------------- + AES3: bit depth of AES3, bit depth of compressed audio stream, endianess + Id3v2 and MP4 tags: better mapping with iTunes fields + Tags: removal of technical only fields + MPEG Video: intra_dc_precision information (in advanced mode) + MXF: detection of raw pictures + MXF: support of URL encoded locators + MXF: color subsampling + DXW format support x #3171468, ADIF: crash in some cases x #3169916, IFO: crash in some cases x #3173391, Id3v2: was using local encoding instead of ISO-8859-1 x MPEG Video, discarding bad (always 0) group_start x AVC: crash with file having big log2_max_pic_order_cnt_lsb_minus4 value x AVC: wrong GOP information in some cases x Ut Video: Color space information was wrong x MPEG-4 Visual: Advanced Simple@L0 was detected as Advanced Simple@L1 x AVI: Crash with some AVC streams (not sized blocks) x MPEG Audio: crash with some files x AAC: crash, infinite loop or wrong result with some files x Trying to quicker reject a junk file x AVI: OpenDML indexes were no more parsed x Windows installer: OpenCandy library is updated and Microsoft agrees it is not dangerous for user privacy, it does not alert anymore. We do not transmit or collect personally identifiable information. Version 0.7.41, 2011-01-24 -------------- + MPEG-TS: random cases with full parsing of the file Version 0.7.40, 2011-01-24 -------------- + QuickTime: detection of AES3 and Dolby E + QuickTime: Apple CEA-608 and CEA-708 (in CDP) support + JPEG 2000: Chroma subsampling + JPEG 2000 in MXF: Color space + JPEG 2000 in MPEG-4 and MJ2: Color space + MPEG-4: mx5p CodecID support + ISO 9660 (CD/DVD/Blu-ray dump) detection x MPEG-TS: wrong detection (as encrypted) of some streams with a lot of transmission errors x MPEG-TS: wrong management of some PAT/PMT updates (real time parsing) x MPEG Video: wrong duration with some raw streams x FLV: wrong duration with some files x libcurl: crash if requesting a libcurl URL but libcurl library not present x MPEG Audio: crash with some malformed files x MPEG-4: error between recorded date and encoded date Version 0.7.39, 2011-01-03 -------------- + OGG: more CELT attributes, thanks to Lionel Duchateau + DV: better detection of display aspect ratio for specific (non standard?) streams + MPEG-7: support of ISO-IEC 13818-2 / H.262 (MPEG Video) version 2000 (multi-view / 4:2:2) + MXF: Clean aperture size support + D-10 (AES3) in MXF: real channel count + MPEG-TS: detection and analysis of ADTS in stream_id_extension + #2943900, MPEG-4 Visual: count of maximum consecutive B-frames + MP4: Handling of Nero library information atom + Id3: TAG+ support x #3140453, MKV with AAC: support of HE-AAC v1/v2 detection even if AudioSpecificConfig is missing x #3138883, ID3v2: crash in some cases if Data length indicator is used x #3139417, MPEG-PS: duration for caption detection was shorter than expected x #3139276, H.263: more precision about the different flavors of H.263 x AVI and MPEG-2 Audio Layer 3: error if audio stream duration estimation x FLV: better handling of weird bitrate metadata x D-10 (AES3) in MXF: Bit rate was wrong x AC-3: crash if false-positive detection of AC-3 and CRC is valid and bsid is wrongly set x #3141059, FLV: trying to detect partial files (so metadata are wrong) and using timestamps instead x #3141052, AVI: wrong duration, no detection of rec chunks, with some files x #3145968, RealMedia: not integer frame rate handling + HE-AAC filling x Id3v2: bad handling of some tags x MPEG-TS/PS: Frame count / duration accuracy of some very specific files x MPEG-TS/PS: Not counting non-decodable frames (without the corresponding I-Frame) Version 0.7.38, 2010-12-16 -------------- + uClibc compatibility, thanks to Metin KAYA + MPEG-TS: ID in all streams if a TS streams contains several substreams + JPEG in MOV: Scan type + AAC: implicit SBR and implicit PS detection (complete HE-AAC and HE-AACv2 detection) + AAC/LATM: more details (channels, profile...) + AAC/SL: more details (channels, profile...) + MPEG-TS and MPEG-PS with trace feature activated (Linux/Mac by default): speed improvement + DTS: indication of HD and Core configurations if there is an HD part + #3118446, MXF: VC-3 (DNxHD) detection + VC-3 (DNxHD) raw stream support + VC-3 (DNxHD): Bit depth + TrueHD/MLP: Duration (only in full parsing mode) + MPEG-TS: option for ignoring ATSC transport_stream_id indication x MPEG-TS: some teletext and DVB subtitles were not detected x #3111584, MXF: phantom track with weird result if an unknown track is found x #3116952, DTS and AC-3: was set as lossy in all cases (DTS Master Audio and AC-3 TrueHD are lossless) x #3137160, ADTS: some files with wrong extension were not correctly detected Version 0.7.37, 2010-11-22 -------------- + DPX format support + Compression mode (Lossy / Lossless) information (note: JPEG 2000 "profile" is moved to this new field) + #3095129, AVI: MLC Lossless codec support + #3095136, AVI: AMV Video Codec support + IFO: chapter information (thanks to Bastian Wegener) + MPEG-4: header size / data size / footer size information (in advanced mode) + MPEG-4: AVmp CodecID (.mov referencing .mxf) support + MPEG-TS: option for setting maximum scan duration + MPEG-TS: option for forcing stream info display even if not found in the stream (data from PMT) x MXF: avoiding infinite loop due to circular reference Version 0.7.36, 2010-10-24 -------------- + HDV 720p/1080i/1080p commercial names support, sponsored by http://www.chyro.fr/ + Raw TrueHD support + MP4: "lpcm" (PCM from DVD) Support (with channel positions) + MKV: compression mode (zlib...) display + WAV: support of AAC (ADTS) with CodecID 0x8180 + WMV: Handling of weird Aspect Ratio information in Extended Content Description + File interface: possibility to indicate begin and end offset of the analysis (partial analysis) + #3082158, .m4b file extension support + #3087674, Ut Video Lossless support + #3087677, WebP: basic support (detection only) + #3072929, MP4: DTS Express support + MPEG-4: Handling of external files referenced by "code" atom + M-JPEG and M-JPEG 2000 are renamed JPEG and JPEG 2000 + MP4 and HDV 1080i: detecting containers lying about width (saying 1920 but it is 1440) + DTVCC Transport and SCTE20: Option for displaying empty streams + DPX format detection x #3034092, MPEG-TS: hang up if program is modified (zapping) in the file x AAC: removal of empirical detection of SBR and PS (too many problems) x AVI: trusting in priority frame count from index of indexes with broken files x MKV: AVC "unknown profile" removal x AVC: some frame rates were reported as twice the real frame rate x #3029308, Id3v2: support of frames with Unsynchronisation bit set x #3065114, MPEG-Video: duration calculation issues with raw streams and open GOPs x AFD: crash with malformed streams x MPEG-7 output: missing references for MPEG-4 Visual and RF64 x #3086701, ID3: freeze/crash with ID3 tag at the end of the the file x LXF: some files were not completely analyzed (missing video) x JPEG: Chroma subsampling value was always set to 4:2:0, wrong x MP4 with MPEG Video: do not trust anymore raw stream timecode Version 0.7.35, 2010-09-05 -------------- + Teletext subtitle support + DVB subtitle support + CEA-608/708: language + Library: "Per frame" interface, like ffmpeg + AFD: AFD (Active Format Description) value and detail + MPEG-TS: SCTE35 detection and parsing + MXF: Ancillary data (S436M) support + MPEG-TS: Codec ID (stream_type) + MXF parser improvements x #3036119, MKV: default language value is eng x DV: weird display with some DV with synch problems. x AVC: wrong detection of bitrate mode for AVC in MP4 x MPEG-TS: crash and wrong detection of some non MPEG-TS files Version 0.7.34, 2010-07-09 -------------- + WebM support, sponsored by http://digi-metrics.com/ + LXF (Harris/Leitch) support + #3008704, IVF (Indeo Video Format) support + #3002376, Blu-ray: Source (.m2ts) for the .mpls parser + DV: handling of unsynched streams + Basic view, Bit Depth is added to the audio part + FLV: Framerate info for some not yet supported weird files + Demux (library only): demuxed packets can be forced to contain 1 complete frame + XML output: MediaInfo version + Parsing speed (Library only): option for a quicker analyzing, but with some missing features + AVI and Huffman (HFYU): Colorspace + AVI and Fraps: Colorspace + AVI and Lagarith: Colorspace + MPEG-4: Channel map basic support x CEA-708: Skipping some malformed streams x JPEG/M-JPEG: Resolution was in some random other field x #3001707, AAC in MP4: mono aac file detected as stereo x AVI: crash with some malformed files x AVI: Stream identifier was not filled in some cases x MPEG-PS: some files were not well detected x WAV: Bit Depth is back x WAV/PCM: Byte sign was wrong if Bit depth >8 x Decimal point issues with some specific compilers/OS x MPEG-4: removing support of btrt atom for average bitrate, too many wrong values x AVI: crash with some specific files (avc1 CodecID) x MPEG-4+AAC: Trying to better detect the (non)presence of PS if there is no PS header x MPEG-TS/PS: more precision on duration Version 0.7.33, 2010-05-14 -------------- + Colorimetry field is replaced by Color space and Chroma subsampling x Some words were not translatable x Solaris port was broken Version 0.7.32, 2010-05-02 -------------- + MPEG-7 output improvements + DV: Better detection of DVCPRO 50 and 100 (again), especially in MXF + P2: support of P2 XML files and P2 directory structure + XDCAM: support of XDCAM XML files and XDCAM directory structure + N19: More attributes + ISO-639-2 3-letter standard for language field (for third-party software) + Additional commercial name of a stream or container (XDCAM IMX, DVCPRO, AVC-Intra 50...) + MXF: support of detection of files without Track number in the headers + MXF: Operational Pattern + MPEG-4: Aperture size support x AVC: some files were wrongly analyzed (frame rate...) x AVI: better support of files with only one big data chunk (professional cameras) x MPEG-4: Huge memory usage with some files (files with DV and PCM) x DVR-MS: width/height was wrong in previous version Version 0.7.31, 2010-04-16 -------------- + SCTE 20 closed caption support + Difference between width/height in the container and in the raw stream + AVC: GOP structure + MXF: more raw stream formats are detected (MPEG-4 Visual, A-law...) + DV: Better detection of DVCPRO 50 and 100 x DV: less files without the right extension wrongly detected as DV Version 0.7.30, 2010-03-26 -------------- + AVC: Multiview Video Coding (MVC) basic support + AVI: better handling of some RGB or RLE codecIDs + Solaris package creation files update (with relocation) + MSVB: better handling of C pointers + WAV: Skipping wrong sample count values + GXF: Caption in ancillary data detection x #2970227, WAV: a file was wrongly detected as DTS x CEA-608: some captions were wrongly detected as active x MPEG-7: some corrections in order to be valid x FLV: Duration for video not starting at Time 0 x WMV and MPEG-TS/PS: some crashes are fixed x MSVC2010 and MSVC2008 project files were missing some files Version 0.7.29, 2010-03-08 -------------- + GXF (SMPTE 360M / RDD 14) support + GXF: support of CDP (SMPTE 334-2) in Ancillary data (SMPTE 334-1) (not complete) + AAC in MPEG-TS: Profile/Level + PCM in MKV: format name, channel positions + MPEG-7 and PBCore 1.2 output (pre-release) + MPEG-7: more metadata + Solaris package creation files + MPEG-TS overall bit rate is more precise x Channel positions: more coherency in the naming x DVD-Video (IFO): ID name was in hexadecimal only, now in Decimal+Hexa Version 0.7.28, 2010-02-19 -------------- + AIFF: ID3v2 tags support + AutoIt3: MediaInfoList interface + RIFF: Handling of INFO chunk in hdlr chunk + VorbisCom-based comments (FLAC, OGG...): support of new fields + MPEG-4 Visual: Duration for raw streams + Display Aspect Ratio 3:2 instead of 1.500 + Detection of N19 (EBU Tech 3264) + MPEG-2 Video: new profiles (4:2:2, Multi-view) + MPEG-2 Video: GOP structure + MPEG-4: handling of video streams with a different last frame duration + RIFF: Skipping OpenDML frame count (not always valid), when index is available + AMR: more attributes (Sampling rate, duration...) x MPEG-PS and MPEG-TS: crash with some files x MPEG-4: some bitrates to zero with a null bitr or btrt atoms x MPEG-4: managing different kinds of compressor name format x AMR in MPEG-4: crash with some specific files x #2952623, Id3v2: USLT with ISO-8859-1 charset was not well read x #2952637, Id3v2.2: PIC tag was not well read x #2952638, XML output: sometimes empty tags x #2920138, XML output: invalid char in XML tags Version 0.7.27, 2010-01-03 -------------- + MPEG Audio: Emphasis + MPEG-TS: PCR timestamp can be extracted in real time + Linux library: visibility is now limited to the official API x MPEG Audio, AAC, Vorbis: removal of irrelevant Resolution field even from containers x MPEG Video: error in calculation of frame rate if sequence extension is used x MPEG Audio: some VBR files without VBR header were wrongly detected as CBR x #2921999, unexpected quotes in the text output Version 0.7.26, 2009-12-18 -------------- + MXF: support of external files parsing + MLP support + TrueHD: more details (channels, sampling rate...) + TrueHD: display of both core and TrueHD details + #2905950, MPEG-4: Cover extraction + ADTS: better bitrate estimation + #2910579, MPEG-4 Visual: data_partitioned and reversible_vlc display + #2910572, MPEG Video: BVOP presence display + Internet Media Type (aka MIME-Type) display (but hidden by default) + ADTS: Id3v2 support x #2897584, ID3v2: Crash with some malformed UTF-16 strings x MXF: Better handling of interlaced content (height and frame rate) x Homogenization of Video resolution (ie no more 24-bit resolution, but 8-bit) x MPEG-TS: less false-positive detection of encrypted streams x MXF: better management of complex files (with references) x MOV: better management of complex files (with references) x Digital Video: better management of DV50, more bitrate accuracy x Digital Video: better management of DV100 (Width, Height, BitRate) x Digital Video: Some Colorimetry (4:x:x) were wrong x FLV: some files were not detected x MPEG Audio, AAC, Vorbis: removal of irrelevant Resolution field x MPEG formats: some Profile renaming, for more coherency Version 0.7.25, 2009-11-13 -------------- + MediaInfo (customized) with HTTP input: User Agent setting + #2896693, MPEG-TS: skipping some malformed PMT (with elementary_PID=0) x #2844911, AAC in 3GP: false detection of SBR and PS (again) x #2894411, MPEG Audio: UserDefined Covers replace other covers types x MPEG Audio: Some profiles were not displayed x RealMedia: Some Titles were not displayed x Matroska: Wrong detection of 6-channel Wavpack (detected as 2-channel) Version 0.7.24, 2009-10-30 -------------- + MPEG-4: DVCPRO HD detection + WAV: better handling of Wave Extension codec IDs + MPEG Audio: profile and extension display + MPEG-TS: More information for ADTS in non-audio PES ID. + FLV: test of video bitrate info integrity + MPEG-4: "sbtl" subtitles support + MPEG-4: old-style Apple language codes support + MPEG-4: XDCAM support + MPEG Video: vbv_buffer_size info + AVC: cpb_size_value info + VC-1: hrd_buffer info x #2882376, AVCHD: reports some incorrect AVCHD framerate x MPEG-4: some Pixel Aspect Ratio settings were not handled x Customized output: respect of carriage return from the platform x MPEG-TS demuxer: more tolerance of bad blocks Version 0.7.23, 2009-10-16 -------------- + OGG: more details for MPEG-4 Visual, MPEG Audio and AC-3 + MPEG-4: more information for MPEG Audio streams + MPEG-4: more information for ADTS streams + MPEG-TS: more information for ADTS streams + QCP (RFC 3625) format support + Refactoring of parsers, for more speed and less false-positives + WAV: INFO chunk parsing x Blu-ray directory analyzing was broken x VC-1: some streams were not detected x AMR in MP4: Resolution set to 13 or 14 bits instead of default 16 bits x Help, Known parameters was hanging up x AVC: frame rate was wrong for progressive streams with frame doubling x MPEG-TS: crash while parsing some streams with specific ATSC event_id Version 0.7.22, 2009-09-25 -------------- + MPEG-TS: KLV data detection x #2859504, 3GPP: some files were not detected x Some corrections about AVI Display Aspect Ratio x QuickTime: external files were completely parsed, too long x DV: Support of 4 mono channel configuration Version 0.7.21, 2009-09-04 -------------- + More permissive license for redistribution only Redistribution license is intended for companies with legal issues (if they can not deal with LGPL) + AVC: Support of frame doubling/tripling + AVC: Colour description + QuickTime: support of external files parsing x #2828430, Quicktime: 180 degrees rotation display was not displayed x MPEG-TS: whole file was parsed (long) x MPEG Video / MPEG-4 Visual: new algorithm for library name detection x #2844911, AAC in 3GP: false detection of SBR and PS x MKV: some chapters had timecode issues Version 0.7.20, 2009-07-31 -------------- + TAK format support, thanks to Lionel Duchateau + #2822681, Quicktime: Rotation display (from iPhone...) + ASP.net web application example + Java/JNA, Linux: dynamic load of libzen if not in LD_PATH x MPEG-PS: Some durations were a bit too long x MPEG-PS: Better handling of PTS/DTS for private and extension streams x ADTS: Handling of SBR and/or PS streams Version 0.7.19, 2009-07-17 -------------- + ALS raw files support, thanks to Lionel Duchateau + LA (Lossless Audio, old) support, thanks to Lionel Duchateau + SLS detection, thanks to Lionel Duchateau + AAC: forcing SBR/PS when it is implicit (if <=24KHz, if 1 channel) + AVC: Closed captions detection + #2813919, APE: CompressionLevel + XML output: track names are changed, for a better usability by XML parsers x MKV: Original display aspect ratio was not displayed x #2817479, Blu-ray/M2Ts: crash with some specific file names x MXF: the whole file was parsed, parsing now only the useful part Version 0.7.18, 2009-07-03 -------------- + MXF support + Blu-ray: BDMV directory parsing + Blu-ray: clpi/mpls files support + M2TS: Language if the .clpi blu-ray file is found + OpenSolaris support + MPEG-4 Visual: support of Sony SMC (security video) tags + MPEG-4 Visual: ASP profile was wrongly displayed + Mac OS X: Creation of universal and 10.4 compatible binaries option x Mac OS X: no more double-carriage return in Text view Version 0.7.17, 2009-06-19 -------------- + Python : adaptation for version 3 + XML output (thanks to Steen Jost Jensen) + MPEG-PS/TS: ATSC Closed captions (both EIA-608 and EIA-708) detection + MPEG-PS/TS: Language of closed caption (ATSC) + DV: camera settings + DV: Closed captions detection (raw DV, or in .mp4 and AVI container) + JPEG 2000 support + MPEG-4: support of JPEG 2000 embedded in a MPEG-4 container + MPEG-4: support of ProRes 422 / ProRes 422 HQ codecs + MPEG-4, AMR: Vendor and version + Blu-ray: support of PCM (Frequency, resolution, bitrate) + MPEG-TS: speed improvements x #2803396, sometimes crash with tiny (40-79 bytes) files x #2801211, MPEG-4/3GP: support of 3GP tags x #2795345, MPEG-4 Visual: crash with some specific user_data x #2793960, MKV: some MKV renamed as .ac3 were detected as AC-3 x #2796417, MPEG-4: Some files with Camera user data were not detected x so interface was not working since some releases on Linux x MPEG Video: better detection of 2:3 Pulldown x MPEG-4: Forcing AMR to 8KHz/Mono whatever the container says Version 0.7.16, 2009-05-20 ------------- + MPEG-4: More information for Avid DV streams + MPEG-4: more complete parsing (raw stream) of files with compressed headers + VC-1 and MPEG-Video: displaying the original framerate for streams with 2:3 pulldown + WMA: Handling of Mutual Excluded streams x MPEG-4: some files with compressed headers were not parsed x MPEG-4: Kodak files with EXIF data were not parsed x MPEG-4 (Quicktime): some files with compressed header were not well parsed x MPEG-4: Some files with a TimeCode track had wrong duration x MPEG-PS: some files with wrong timestamp were not well parsed x MPEG Audio with APE tags: crash with big tags Version 0.7.15, 2009-04-30 ------------- + Wave64 (.w64) support + MPEG-4: Better handling of 4GiB+ files + MPEG-4: audio parts from a DV stream are displayed + MPEG-4: better DV analyzing + DV: parser improvement (speed, accuracy) x DTS: 768/1536 Kbps streams are corrected to the real bitrate (755/1510 Kbps) x MPEG-TS: some stream durations were not well computed (few seconds only) x AVC: freeze with some malformed encoder settings Version 0.7.14, 2009-04-17 ------------- + #2738780, local time display for modified/created date + DLL installers (both 32 and 64 bits) + WAV: RF64 (Wav files >4 GiB) support + AVI: Audio delay from the container x #2734021, E-AC-3: some files were not detected x FLAC: some files with big attachments were not well detected x MKV: some huge video (3840*2160) were not well parsed (no encoding settings) Version 0.7.13, 2009-04-03 ------------- + #2635230, MPEG audio: Lame encoder settings + #2706146, WMV: detection of container wanted aspect ratio + #2611726, MKV: Audio delay detection + #2721811, MKV: TrueHD detection + Java: JNA (Java Native Access) binding + Exported "stream" interface for analyzing streams in memory (beta) + SHN (Shorten) detection + TAK (Tom's lossless audio compressor) detection + MPEG-TS parser optimizations + SWF: better handling of videos + WAV: better handling of 4GiB+ files + WAV: Extensible Wave support + MKV: Handling of chapters in multiple languages + Stream size for all streams when 1 video and all audio streams are CBR + Chapters are moved to menu part for better coherency with MPEG-TS, developers see Changes.txt for more info x #2712761, AVI: unsupported SalmonSoft text codec makes MediaInfo silently fail x #2719534, MKV: handling "modified" headers (zero padding) x #2720822, MPEG Audio: was freezing with 1 malformed file x #2721949, IFO: some stream IDs were false x #2725808, MPEG-PS: some "OTA" files were detected with TrueHD instead of normal AC-3 audio Version 0.7.12, 2009-03-20 ------------- + Complete refactoring of the code for speed improvements and future features + #2686943, MPEG-4: ISMV (IIS Smooth Streaming Media Video) basic support + MPEG-4 Visual: distinction between MPEG and H.263 default matrices + MPEG-TS: ATSC and DVB EPG support x MPEG-PS: duplicate stream infos with some AC-3 streams (with program map) Version 0.7.11, 2009-02-13 ------------- + OGG: Better Kate and CMML codecs support + AVI: Detecting wrong aspect ratio from a broken AVI header + DTS: Handling of Little Endian and 14-bit streams + WAV: ID3v2 tags parsing + MPEG Video: frame order even for progressive sequence x #2559346, MKV: Detection of framerate in MKV without framerate header x #2474280, OGG: some streams had bad stream size x MPEG-TS: some buggy file may corrupt memory x MP3/Id3v2: crash with one malformed file Version 0.7.10, 2009-01-30 ------------- + Mono (C#/Linux) binding + MPEG-4: Encoding library name + #2474280, OGG: Old version of Dirac identifier support + MPEG-TS: Encoded date for HDV + DVR-MS: Delay between two tracks + WAV: EBU Broadcast Wave format v1 support + CMP4: Basic support x #2529963: Infinite loop on one file x #2473140, DTS: error preventing 96/24 DTS detection x MPEG-4: Better support of Aspect ratio x Output was unstranslated and weird when $LANG is not set x C++ binding error in 0.7.9 x Python binding improved and corrected (no more crash with Linux) Version 0.7.9, 2009-01-19 ------------- + OGG: Dirac support + OGG: Speex support + OGG: other formats (JNG, Kate, MIDI, PCM...) detection + SWF: detection of more audio streams + MPEG-PS: Handling of PlayStation2 audio + #2474119, Minimal MZ (PE) and ELF detection + SMV (WAV/ADPCM+JPG files) file format support + DPG (Nintendo DS) file format support + QuickTime: TimeCode track analysis + MPEG-4 subtitles: difference between 'text' and 'tx3g' codecIDs x Python binding update for more compatibilty x #2474280, OGG: handling of files with Skeleton Metadata x #2445654, OGG: better false-positives detection x #2493685, AVI: Wrong video duration for some malformed 4GB+ AVI/DV files x #2516007, "Language" raw tag was sometimes 3 letter long instead of 2-letter long x Floating point overflow correction Version 0.7.8, 2008-12-09 ------------- + Changing version schema, only 3 numbers (next versions will 0.7.9, 0.7.10...) + Better Linux integration + rpm stuff (thanks to oc2pus http://packman.links2linux.org) + deb stuff + #2259421, FLAC and OGG: Encoding library name and version + FLV: version 10 support + FLV: duration of files without metatags + MPEG-4: Delay (useful when multiple videos are present) + Dirac: profiles updated from the latest specification + MPEG-4: more precise detection of OGG based codecs + MKV: better newest codecs handling + MKV: RealVideo/Audio support improvements + mipsel CPU support x MPEG-PS: Trying to have a better precision for duration x WMV: crash with some malformed files x MPEG-TS: some channel names where not shown x MPEG Video (version 2): some streams were misdetected as CBR Version 0.7.7.8, 2008-11-10 --------------- + #2216498, LPCM in VOB: more attributes (channels count, sampling rate, bitrate) + #2182135, Wavpack: support of multichannel files + AVC: detection of the newest profiles + DTS: detection of DTS-HRA, DTS-MA, DTS-Express, thanks to http://madshi.net + AES3 PCM in MPEG-TS detection + Wavpack: Encoder settings + WMV with "WVC1" codec identifier: video interlacement + MPEG-4: E-AC-3 support x #2186682, MPEG-2 Video: Wrong PAR and DAR for Panasonic MPEG2 Files x MPEG-4: some AC-3 and AAC specific files reported wrong channels value Version 0.7.7.7, 2008-10-17 --------------- + Support of VP5 file format + MPEG-4 Visual and MPEG Video: can now display the custom matrices data + WM: interlacement detection for VC-1 based codecs (WMV3...) + #2148321, PNG: more info + AVI: Better association of abcAVI tags to MediaInfo tags + PureBasic binding + Delphi binding: dynamic load (by default) of the library, thanks to Icebob x #2142995, MPEG-4: handling the Display Aspect Ratio from the track Header (tkhd) x #2141277, MPEG-PS/TS: Audio ID was hex for MPEG-PS but decimal for MPEG-TS streams x #2109107, Tags in Flac or Ogg: modification of the tag types priorities x #2120224, MPEG-4: some specific files were not parsed completely (missing info) x MPEG-TS with Dirac: some specific files were not parsed completely (missing info) x MPEG-4: Crash on MPEG-4 Visual format without DecDecoder stuff x Command line: was not reading custom template in UTF-8 codepage x DV: some files were not well detected x MPEG Video: some files were badly detected with 3:2 pulldown x AVS (Chinese): some corrections, thanks to Tom's translation of documents Version 0.7.7.6, 2008-09-12 --------------- + [2088009] Flac: Picture tag support + Flac: Support of Id3v1&2 in a Flac file + WM (ASF/WMV/WMA): detection of wrong framerate in header, trusting now the timestamp instead of the header + WM (ASF/WMV/WMA): detection of framerate from the timestamp when the framerate info is not available in the header + MPEG-4 with AVC: Added information about buggy files readable by all players except iPods + OGG: OGG with FLAC (pre- and post-FLAC 1.1.1) support x FLI/FLC: were not correctly detected x MPEG-TS without PAT/PMT: the complete stream was parsed, may be very long x Wavpack: duration and bitrate were false x #2071681, MPEG Audio: handling of truncated MPEG audio frames at the end of a file x #2032760, MPEG Audio: handling of MPEG Audio files with junk at the end x #2085149, Id3v2: was crashing with some malformed tags Version 0.7.7.5, 2008-08-22 --------------- + #2044174, AVS (Chinese Audio Video Standard) support + #2030684, AVI: Support of malformed chunks + Matroska: delay between audio and video calculation (for AC-3, DTS, MPEG Audio) + Full Replay gain support (gain/peak, track/album) for Flac/Ogg/MP3 + MPEG-TS without PAT/PMT (example: stream captured by some satellite TV receivers) support + MPEG-TS: Service info (name, provider, channel number) for both DVB and ATSC tags + Dot and thousand separator localized + Matroska: Handling of audio Delay x #2023872, DV: Crash with floating point exception on some files x #2024706, BDAV: Some QuickTime files misidentified as BDAV x #2033307, MPEG Video: Some raw files with high bitrate were not detected x #2040411, Id3v2: Crash with some malformed Id3v2 fields x #2036580, Id3v2: Problem when parsing big (>1M) Id3v2 tags, file was no more detected x #1893830, WMA/WMV: there was textual info (Linux/Mac only) x Video, Resolution/bits per pixel was sometimes per color entity, sometimes per pixel, now always per pixel x MPEG Video, the "Component" video standard was not detected x DLL only, the "by buffer" interface was broken Version 0.7.7.4, 2008-07-11 --------------- + #1995653, AVI: Delay of interleaves (example: "64 ms (1.53 video frames)") + #1995574, AVI: Report if the audio frames are split across or aligned on + MPEG-Video (raw): handling of "not started at the beginning" time_code + MPEG-PS: Trying to prevent errors with time code reset in the stream + AVC: Trying to detect raw AVC streams without SPS/PPS + [2013746] AAC in MPEG-TS: complete parsing of ADTS stream for more info about AAC + AAC in MPEG-TS: complete parsing of IOD based stream for more info about AAC + MPEG-TS: better detection of PCR time code + AAC: specifying the muxing mode (ADIF, ADTS or LATM) + MediaInfo DLL: NetBeans java binding example Version 0.7.7.3, 2008-06-27 --------------- + MPEG-TS: Detection of scrambled streams + #1995566: AVi, Identify ODML files + AC-3/DTS/AAC: Added another Channel configuration string (example: "3/2.1") in advanced mode + #1995569: Added proportion of each stream in the file (example: "500 MiB (90%)") x MPEG-TS: Handling of multiple programs in one PMT PID x MPEG-TS: Handling of streams in multiple programs Version 0.7.7.2, 2008-06-13 --------------- + FLV: detection of AVC and AAC x #1981032, Visual C++ 2008 binary is not compatible with Win9X, coming back to Visual C++ 2005 x #1964299, Never-ending 100% CPU if input file doesn't exist Version 0.7.7.1, 2008-05-30 --------------- + MPEG Video: Detection of 2:3 and 2:2:2:2:2:2:2:2:2:2:2:3 Pulldown + VC-1: Detection of 2:3 and 2:2:2:2:2:2:2:2:2:2:2:3 Pulldown + AVC: Detection of MBAFF + Translations: more words can be translated + MPEG-4 files: More info (profile, format settings, encoder name, x264 settings) for some well-known stream formats + MPEG-4 files: Better handling of not common formats (ALS, PNG, AC-3, DTS... in .mp4) + Bluray: detection of subtitles + Additional formats detected: Module, Extended module, Impulse Tracker, Scream Tracker 3 x #1967663, mp4: some specific iTunes atoms were not correctly parsed Version 0.7.7.0, 2008-05-16 --------------- + Third-party developpers: some MediaInfo fields have changed, please look at Changes.txt for more info + Python (Windows) binding + AC-3 TrueHD in bluray detection (even if the stream is splitted in 2 sub-streams) + Original framerate is shown if the framerate from the video stream and the one in the container are different + #1955061, Bluray: Duration + #1953908, FLV with audio delay detection x Linux with UTF-8 locale was not accepting non-English characters in filenames x #1954663, Some mono HE-AAC audio track detected as 2 channels with PS x VC-1 in TS detection even if the stream_type is not declared x xxxBSD compatibility Version 0.7.6.4, 2008-04-27 --------------- + About the library : Java/Linux binding is available + DV (raw) files support + Better support of DV in AVI container (type 1 and 2) + AVC: Handling of SEI which is before a SPS + AVC in AVI: reading more info (Profile, Cabac...) from streams created by FFMpeg + Vorbis in AVI: reading more info (Max bitrate, tags...) from streams created by FFMpeg + Detection of VC-1 in MPEG-TS from MainConcept encoder + MediaInfoLib is now thread-safe x #1943743, AVI with MPEG-Audio VBR and delay: delay was incorrect x Pixel Aspect Ratio was sometimes inverted (1/x) x XviD CodecID was redirected on Koepi website, no more available, changed to official XviD webpage x #1946098, DV in AVI: DV aspect ratio errors Version 0.7.6.3, 2008-04-12 --------------- + AVC: Count of reference frames + AU: Comments + Some global speed improvement x #1931844, Id3v2: Unsynchronized frames support (v2.3 & v2.4) Version 0.7.6.2, 2008-03-28 --------------- + MKV: handling of files created for streaming + MPEG-4: Handling of corrupted stream size info with some PCM streams + DVD video: Hebrew patch ("iw" code is mapped to Hebrew) x MPEG-4: better handling of bitrate mode (VBR or CBR) x AVI: MediaInfo reads now the framerate value from the container rather than the stream value Version 0.7.6.1, 2008-03-14 --------------- + AC3: TrueHD detection + MPEG-TS (or Bluray): VC-1, AC3+ and AC3 TrueHD detection + AVC in MKV: all SEI userdata infos from x264/eavc in Writing library settings + EVO: Better detection of duration + Dirac: raw files parsing + MPEG-TS: Dirac management + MPEG-TS: DVB subtitles/Teletext management x MPEG-4 Visual (DivX/XviD): writing library name was missing x MPEG-Video: some DTS files with wrong extension were detected as MPEG-Video x SWF: Compressed SWF files support is back x "Inform" option with file as parameter was not well parsed Version 0.7.6.0, 2008-02-29 --------------- + ID3v2 cover reading + Id3v2.2 (yes, it is old...) support + Id3v2: TXXX tags support + RMP3 (japanese MP3 based format?) support + SAMR in .mp4: some files have wrong sampling rate, forcing it to 8000 Hz + File_Created_Date and File_Modified_Date tags added (in advanced mode only) + MP3 encoded by Lame: Minimal (VBR) or Nominal (ABR) bitrate x Better detection of Lame encoder x AVC Display Aspect Ratio was not well detected if AVC is in a .mp4 container x Matroska Display Aspect Ratio was deleted if AVC aspect ratio was set, now Matroska has priority x "Subwoofer" term has been replaced by "LFE", more relevant Version 0.7.5.9, 2008-02-08 --------------- + AVC: CABAC detection + #1886241: AVC: all SEI userdata infos from x264/eavc in Writing library settings + ADPCM: compagny which created the stream is now shown in the codec section + PCM: precision about Little/Big endianess, Integer/Floating point method + #1882691: AC3+: raw files are now detected x AVC: FPS were sometimes 2x the reality x RealMedia parser was brocken x FLV parser was crashing x FLV: Better detection of Nellymoser audio x FLV: Disabling Framerate estimation if a VFR file is detected (estimation was false in this case) x Better false-positive MP3 detection (NSV files are no more detected as MP3) x IFO: there was a mistake betwwen NTSC and PAL framerates x Win9X support was (again) brocken in 0.7.5.8 Version 0.7.5.8, 2008-02-01 --------------- + Matroska: Full parsing of DivX/XviD/H264/AVC settings (profile...) + AVI: Full parsing of AVC settings (profile...) + AVI: Added a tag "OpenDML" (for example, the PlayStation 3 doesn't support OpenDML files) + AVC: Framerate, Interlacement, writing library (only for eavc, x264 and MainConcept encoders) + TwinVQ : channels, bitrate and sampling rate + Musepack SV8 support + Musepack and Musepack SV8: tags support + AIFF and AIFC format support + MIDI format detection + FLV: FrameRate even if the tag is not in the header + AU/SND audio formats support + Vodei encrypted AVI files detection + Linux/MacOS: support of 2GiB+ files + FLV: Video parsing even if the container says there is no video x APE Tags v1 are detected again x MPEG-PS: some malformed files were not well parsed, fixed x AVC: Cropping was not well handled (example: height was 1088 instead of 1080) Version 0.7.5.7, 2008-01-09 --------------- + SWF: Tags version 9 support + MPEG-TS: DegiCipher 2 (DCII) support + DVR-MS format support (with MPEG Audio or AC3) + WMV: language tag + MPEG-2 Video: Nominal bitrate x AVI: some speed improvments Version 0.7.5.6, 2007-12-10 --------------- + AVI, Interlacement for M-JPEG codec + AVI, Interleaved tag + Better showing of well know values ("44.1 KHz", "22.05 KHz"...) x AVI, was parsing the whole file in case of non-interleaved files x MP3, was freezing on specific files x #1838202: Flac, Resolution was 1 less the the real value (15 bits instead of 16...) Version 0.7.5.5, 2007-11-09 --------------- + #1799859: Flac, tags are case insensitive + Matroska format parsing improvements + .mp4 speed improvement x BDAV (Bluray) parser compilation was forgotten in the previous version x AVI, Bitrate and stream size were false x #1825218: IFO parser was brocken x #1825521: .mp4 chapters times were wrong x #1801549: DLL was crashing during Delphi/C# debugging sessions Version 0.7.5.4, 2007-11-02 --------------- + Aspect Ratio is renamed Display Aspect Ratio + Pixel Aspect Ratio added (in advanced mode) + More attributes for AC3+ + More attributes for VC-1 + Profile and level for MPEG-4 Visual based formats (DivX...), AVC and VC1 + Speed improvement for MPEG-TS, MPEG-PS, DVD-Video (.vob), HD-DVD, BluRay + MPEG-4 AAC, Channels position + AAC (ADIF), More info + AAC (ADTS), More info x FLV, there was bad dates on some specific metatags. x #1818404: WAV with "float" PCM, bad detection x CDXA (.dat) files parsing is back Version 0.7.5.3, 2007-10-08 --------------- + Better OGG/OGM parsing + Better .ifo (DVD-Video) parsing + .rmvb files are now detected in Windows Explorer + Win9X/98/Me support does not request Microsoft unicows.lib anymore x Win95/98/Me support was brocken since 0.7.4.6. It works again. x #1798997: MPEG-4, some Apple codecs were wrongly reported x Lot of memory leak correction, you can now parse 1000+ files without problems Version 0.7.5.2, 2007-08-16 --------------- + Now accept AVI files with junk at the end x #1770477: Video info for some low-bitrate MPEG files were not shown x #1770509: MPEG 2 Audio Layer 2 was not well detected x #1763282: FLV, wrong playtime on PPC based machine x #1734113: IFO, crash with some specific files x Tooltip extension was requesting development tools since 0.7.4.6. No more requested. Version 0.7.5.1, 2007-07-23 --------------- + AVI: 24/30 fps (aka 120 fps hack or dual frame rate video) detection + TruAudio (.tta) support + Wavpack (.wv) support + MPEG-4 based containers: Codec/CC tag support + #1754143: AC3 & DTS detection in a .mp4 container made with the Haali's gdsmux tool + #1754140: AC3 detection in a .mp4 container from Nero Digital + #1754905: iPhone files support x #1750275: HD-DTS was no more detected in a .m2ts (bluray) file x AVI: AAC profile name was no more detected Version 0.7.5.0, 2007-07-09 --------------- + Licence changed from LGPLv2 to LGPLv3 + More information about mpeg-4 based (Nero...) files + MediaInfo analyses longer a .vob file to be able to find hidden tracks (subtitles...) + #1747633: Encrypted WMV detection + FLV: more attributes x Memory leaks correction x #1720404: MPEG, rare crashes with some files x #1721846: AAC ADTS were no more detected x MPEG Audio: No detection if there is some specific junk before the real audio data x #1728059: Delphi DLL overflow with big files x Crash with Youtube FLV files x AVI: Delay for AC3, DTS and MP3 is back Version 0.7.4.7, 2007-05-14 --------------- + OGG Vorbis, "Floor" value (useful for some players which don't support Floor 0) + MPEG-Audio, Lyrics3v1/v2, ApeTagv1/v2 parsing + MPEG-TS, handling of complex files (multiple programs, 8+ channels...) + #1704008: handling of AVC or MPEG-4 Video in a MPEG-TS file without program map + VC-1 basic parsing + DTS True HD detection + AC3+ detection + HD-DVD (decyphered) support + BluRay (decyphered) support x MPEG-TS, Duration calculation problem on very rare files x MPEG-4/iTunes, Tags where not well parsed in 0.7.4.6 x FLV, freezes or crashes with some files x #1718269: MPEG-4 Video, Framerate of 65535/2733 is transformed to 23.976 x Windows Media (ASF/WMA/WMV) with file size more than 4GB were not well handled x MP4 with file size more than 4GB were not well handled Version 0.7.4.6, 2007-04-28 --------------- + Windows 64-bit version of the command line tool and DLL + Linux 64-bit version of the command line tool + More Musepack properties + Detection of Musepack v8 files + Complete parsing of Real Media files (all tags) + Improved Windows Media (ASF/WMA/WMV) parsing + MonkeyAudio tags (APETagv1/v2, Id3v1) parsing + Ogg/Theora : Video bitrate + MPEG audio : More encoder detection (bitstream parsing) + SWF (Flash) parsing x #1665981: Mov - PCM audio (digital camera) was detected as RGB x #1672896: Wave file with .mp3 extension was detected as MP3 x #1689570 and #1633237: Better JPEG parsing Version 0.7.4.5, 2007-02-23 --------------- + Program file size reduction + WAV : Support of some special tags at the end of the file + AVC : Display Aspect Ratio x #1653325: Wrong Resolution with AVC High Profile x #1662890: Problem with tag adaptation parser (mainly for ID3v1 genre) x Better support of corrupted MOV files Version 0.7.4.4, 2007-02-05 --------------- + FLV format support + Basic support of multiple programs in a MPEG Transport Stream (Satellite broadcast) + Basic detection of TwinVQ (.vqf) files (+tag parsing) + Better handling of corrupted .mp4 files + Better handling of corrupted .avi files x Crash with corrupted "COMM" Id3v2 tags x Crash with some audio files x #1633524: MOV, Crash on files with corrupted Descriptors x #1630907: MP3, Crash on files with corrupted (empty) Id3v2 tag x #1637838, 1634549, 1635131: Crash with some audio-only files x AVI, Better detection of writing application found in a "JUNK" chunk x AVI, sometimes wrong playtime x #1637191: AC3 delay in AVIs is back x #1635134: some freezes with MPEG-7 files (but this format is not yet supported) x #1635087: some files were wrongly detected as AC3 x Russian (or other non-latin language) AVI tag parsing is back. Version 0.7.4.3 2006-12-22 --------------- x #1622477 : Wrong Time Values for Chapters in mp4 files + Linux shared object available + MPEG-TS : Detect encrypted stream, and show the codec + id3v2 with UTF-16 frames + AVC in MPEG-TS AVC parsing + AVC : Width and Height + MacIntel version x Matroska, some crashing files (with chapters) Version 0.7.4.2 2006-12-09 --------------- + Encoders database updated with 20 new encoder versions + Codecs database updated with 100 new codecs (video or audio) x Matroska, sometimes wrong Playtime x MPEG-4 : some Titles were not well parsed x MPEG PS : some video stream were missing x Crash with some malformed files x Some debug files were created Version 0.7.4.1 2006-12-08 --------------- + MPEG Transport Stream : Video info (Standard, Chroma, Interlacement...) and PlayTime + CDXA : PlayTime + MPEG-4 Video embedded in MPEG Program Stream support + MPEG-1 stream embedded in a Quictime file + MPEG-4 AAC Parametric Stereo (SBR-PS) detection + Detection of encrypted MPEG-4 (like iTunes) + Support of MPEG TS with lot of synchro errors + AVI : Exact Stream size calculation (but currently OpenDML files are not supported) + MPEG-4 : Exact Stream size calculation + Basic support of Korean mobilephone provider Sky (.skm) x MPEG Program Stream : PlayTime, Delay are corrected x #1601787 : MOV tracks issues (and crash) x MOV : was stopping on too big "free" atoms x MOV : Aspect Ration of DV is corrected x MPEG : Handling of negative Delays between Audio and Video x Musepack parser was doing too much "false positives" with some MPEG files Version 0.7.4.0 2006-11-24 --------------- + Linux i386 version + AutoIt example + AVI with AAC-SBR : detection of real SamplingRate (not the sampling rate in header) + AVI with DV : basic information about audio + AVI with DV : detection of duplicated audio stream + Google Video : metadatas + AVI : now able to read metadatas at the end of the file + AVI : Bitrate computed is based on filesize in header instead of real filesize (for broked files) + AVI (DivX) : Menu detection (yes or no) + AVI : detection of VBR MP3 (useful for DVD players, sometimes they don't accept it) + AVI : detection of Delay between Audio and Video (for MPEG Audio, AC3 and DTS) + PlayStationPortable MPEG-4 files support + 3GPP5 files support + MPEG-4 : Detection of MP3, Vorbis streams embeded in a 'mp4a' atom + MPEG-4 : Detection of AVC streams embeded in a 'mp4v' atom + MPEG-2TS with MPEG-4 and AC3 detection + Speed improvements + MPEG-4 with Variable FrameRate detection, min and max x #1551482 "\n" in filename get replaced by newline in "Text" output x AVI : infinite loop on one example file x AVI : some bad detections corrected x MPEG-PS : infinite loop in intra Matrix on one example file x MPEG TS : better detection of streams Version 0.7.3.1 2006-07-30 --------------- + MPEG-1/2 PS : more files have a duration + AVI with MPEG-4 Video based codecs (DivX, XviD...), more encoder string detections + Microsoft Visual Basic binding : wrapper class added around methods + Microsoft J# binding : wrapper class added around methods + Microsoft C# binding : default values for methods, to cleanup code example x Matroska, crash with big (>4GB) files Version 0.7.3.0 2006-07-19 --------------- + MPEG-1 and 2 Transport Stream support + MPEG-1 and 2 Video : Custom Matrix detection + MPEG-4 Video : Custom Matrix detection + Google Video (GVI) support + AMV/MTV (Chinese) detection (if you have specifications of theses formats, email me) + AVI/DivX/GoogleVideo and MPEG-4 Video : packed bistream detection. Now you can know if your DVD player can read the file before burning. Next step: a database of DVD player capacities ;-) + Java binding + C/C++ dynamic loading (instead of static linkage) binding + MPEG-4 : Language + MPEG-4 : Text streams (subtitles) + C# binding : wrapper class added around methods x #1523005 : C# crashes because I did not use PtrToStringUni() to handle char pointers x #1485003 : MP3, "Title" tag was sometimes forgotten x #1485804 : Wrong bitrate and time in PCM files x #1485810 : wrong playtime on CBR MP3 files with big id3v2 tags x #1485803 : some WMA tags were forgotten x #1488449 : crash on very rare buggy MP3 files x #1482686 : ShellExtension, crash when moving a directory x #1488770 : PlayTime, some "minutes" formating were forgotten x #1485044 : some .ico files were detected as MPEG Audio x AVI, handle some malformed timestamps in tags (carriage return at the end...) x MPEG-1 and 2 : incoherancy of PlayTime Version 0.7.2.1 2005-05-08 --------------- + MPEG-4 : Chroma ("4:2:0"...) + MPEG-4 : Interlacement mode ("Top field first", "bottom field first", or "Progressive") + MPEG-2 : Chroma ("4:2:0"...) + MPEG-2 : Interlacement mode ("Top field first", "bottom field first", or "Progressive") + MPEG-2 : Profile and Level ("Main@Main"...) + MPEG-2 : Standard (NTSC, PAL, SECAM, or MAC) x #1482346 : Incorrect playback time in OGG files (was not enough precise). x #1482602 : MPEG-4 video false positive files x #1479344 : Problems with DLL interface, ToolTip shell extension DLL extension are in another DLL to keep compatibility x #1479317 : stop if debuging in Borland IDEs when opening an AVI file Version 0.7.2.0 2005-04-30 --------------- + ToolTip shell extension (if you have the mouse on a multimedia (AVI/MKV/OGG...) file, a ToolTip will be showed + AVI with DivX or XviD : Encoder name, GMC/QPel/B-frames indicator if present (beta) + AVI and WAV with MP3 : encoder name, precise version and layer number, VBR indication + Matroska: support of anamorphic videos (right Aspect Ration even if pixel aspect ratio is not 1:1) + AVI/WAV : support of extended wave files (20 bit per sample and more than 2 channels) and channel position + AVI : support of Exif tag format + AVI : more tags are supported + Genres can be translated by translators + Real : detect RealAudio Lossless Format x #1454009 : AC3, sometimes wrong AC3 playtime x #1469423 : MP3 with cyrilic filenames, Id3 tags can be read x #1464066 : Hang ups with raw h264 streams x #1462647 : Quicktime files with preview image, crash x #1445150 : crash with some malformed MusePack files (workaround, this is a the Musepack bug, not yet corrected) Version 0.7.1.2 2005-03-10 --------------- + #1438441: show TV format (PAL/NTSC) for DVD and DV + #1343147: Matroska, Show Chapter names + MPEG-1 and 2, more precise playtime + MPEG-1 and 2, Added Encoded_Application if it is in video user data + Quicktime: Support of Quicktime "wide" (header at the end of the file) + MPEG Audio: Detect small (examples, less than 200K) MPEG Audio files with Id3v1 tag + #1441661: AVI, Handling of DV Type 1 x #1440480: No Audio Found in MPEG-2 after 0.7.0.4 x #1438987: Infinite loop with some Matroska files x Matroska, Recorded date is now in UTC format, rather than the number of seconds since 1970 x AC3 noted 5 channels (because of 5.1) are now noted 6 channels (more realistic) x Quicktime: "ima4" or "twos" codecs were detected as Video stream instead of Audio stream x Crash of third-party softwares with some specific files Version 0.7.1.1 2005-02-24 --------------- + Now ~900 codec names (Audio/video/Text) are known (instead of 500) + Matroska : Framerate is now for all kinds of codec (and not only FourCC based ones) + MPEG-4 (m4V, Quicktime...) with unicode filename are now handled (before : crash on htis kind of file) + #1326802: MOV with 3GPP datas. + Meta-tags of Quickime HD files + #1244215: bit-rate details for MPEG-1 Video (VBR) (calculated with other CBR streams) + Detection of MXF files + #785338: Huge work on RealMedia parser (bitrate, channels, sampling rate, fps...) x #1435086: Translation problems if the program is launched directly with a filename x #1361647: Complete rewrite of MPEG-4 (newest Quicktime, 3GPP, iTunes...) parser to be more robust. x Some minor (but crashing :( ) bug fixes x AVI with DV was not well parsed x ActiveX DLL was forgotten Version 0.7.1.0 2005-02-12 --------------- + Speed improvements + #1383832: support of last version of Quicktime files + Support of Musepack files + Support of Flic (FLI/FLV) video files + Support of files with more than 8 audio streams or 32 text streams + Support of DTS-HD (DTS at 96 KHz / 24 bits) + Support of ID3 tags (v1 and v2) in .AAC files + Support of all Tags in AVI files + Detection of QuickTime image files and QuickTime compressed archives + Detection of AVC files (3GPP, 3GPP Mobile or JVT) + Detection of iTunes protected files + Detection of H264 files (Raw, 3GPP or JVT) + Detection of Dirac raw video files + Detection of TrueAudio files + Detection of WavePack files x #1420672: No WMV bitrate x Crash with some corrupted MPEG files x Crash with some MP3 files with corrupted ID3v2 tags x Crash with some Quicktime files with corrupted tags x #1257550 (again:) ): with AVI, rounding of FPS had an impact of FrameCount, based on FPS. Now based on AVI file (better ;-) ) x #1381652: Reported some GIF files as Mpeg audio x #1381619: UPX compressor is no more used, to prevent Virus checker to use 100% CPU x 2nd Video framerate forgotten x Video languages were not parsed (example: "en" should be "English") x FrameRate/String was forgeting measure (example: "at 25" should be "at 25 fps") x Some case sensitive problems (example: "KBps" instead of "Kbps", 8 times more) x DTS and AC3 channels position names were changed to be more human readable + Added .lib files needed for Borland and MS C++ compilers (no need to use "implib" anymore) + Added Contrib directory: ActiveX component (warning: no support from me) Version 0.7.0.3 2005-10-25 --------------- x Matroska: "ID" and "UniqueID" tags were not assigne to the right stream. + Text: URL for Text codecs Version 0.7.0.2 2005-10-17 --------------- + Support of ISO-639 language names (more than 200 language names can be translated) + Support of "multilanguage" language name (ISO-639 "mul") x #1260619 Delphi Example was incorrect Version 0.7.0.2 2005-10-17 --------------- x #1323208: Video Bitrate for OGM files with VBR audio was incorrect + Better detection and handling of DivX container + #1327902: More meta data properties for RIFF files x #1327468: RIFF (AVI) files with not-padded (INFO) sub chunks can't be parsed + More "generic" tags added x Some other minor bugs Version 0.7.0.1 2005-07-24 --------------- x #1257550: rounding of FPS was 2 digit precise, not enougth, upgraded to 3 digits, and exact number is given (23.97 before, 23.970 or 23.976 now) x Better false positive detection (mainly in MPEG1, MPEG2, MP3) x some memory leaks if you use MediaInfo a long time x MPEG Audio: VBR bitrate corrected for MPEG **1** streams x MPEG Audio: VBR bitrate corrected for monochannel streams x #1274999: mp3Pro timing was wrong (2x the real timing) + "BitRate_Mode" with MP3 (VBR or CBR) + "PlayTime" with AC3 + "PlayTime" with WAV Version 0.7.0.0 2005-07-23 --------------- + DLL: New(), Delete() added. Open() modified. WARNING: this break the interface x Some changes in the name of Get() varaibles. WARNING: this break the interface + Better documentation (still in beta version), with a quick "How To" + DLL: MediaInfoList interface (multiple files with one Handle) + DLL: C++ wrapper Version 0.6.1.1 2005-06-25 --------------- x Open Folder option is comming back x File with an unknown format were detected as MP3 x Corrected hang up on Matroska files x Corrected crash on AVI with subtitles only x Corrected crash on some corrupted or unknown files + Added 3GPP files support Version 0.6.1.0 2005-06-23 --------------- + #1210433: in WMVA, Genre + #785349: Added Video->FrameCount (in advanced mode only, and developers) + #785349: Added BitRate mode when the codec is know to be only one (AC3 is CBR, Vorbis is VBR...) x in WMA/WMV, Tags>255 x #1210425: bugs in MP3 (Genre, Track) (thanks to Ingo Brueckl) x #1210412: MS Windows DLL didn't work under Win9X (no crash, but "Not a good file" reply) because of UnicoWS.dll linking problem. x #1209291: IFO, Incorrect BitRate_Mode and Resolution (bit shifting), example 704*480 x #1209293: Incorrect Month in General/Date (UTC stamp was 1 month earlier) (thanks to Ingo Brueckl) x #1215142: SamplingRate for MPEG audio streams in MPEG container was false x #1222414: Video BitRate for AVI is back x #1215939: Added a Format "MPEG x" if MPEG version can't be detected x #1215840: Better version detection of MPEG Video. But still a workaround, if you know how to detect MPEG1 or 2 in a video only file, please contact me! x #1210546: For developers, you can know which type is the value returned (Text, Integer, Float, Date, Binary) Version 0.6.0.0 2005-05-18 --------------- + PCM support in VOB files + Complete rewrite of MPEG1/MPEg2 (and DVD) parser + Complete rewrite of AVI parser: internal parser in place of Win32 API + #1123025: Escape codes at custom text (for comma, [, ], parenthesis...) + Begin of adaptation with GCC: tested with MinGW and Knoppix (Core library, and OGG) x (I hope) all CSV bugs (quotes...) are corrected x Unicode decoding in WMV/WMA/ASF formats x #1195325: Memory leaks of 500 KiB/opened file x #1192446: Incorect duration in some AVI files x #1172817: Options in Inform method was "forgotten":(. Warning: this modification breaks compatibility with older DLL (this is why this version is named 0.6 in place of 0.5.x) x #1201430: Should work with files having broken video stream header x #1183702: Should work with files having broken video stream header Version 0.5.1.0 2005-02-09 --------------- New - Better management of Inform() options - Added more language names decoding for audio and text streams - Language names for audio and text streams are translated Bug fixes: - Inform: hangups in Inform() with customized Option("Inform") settings - Options: inversion between Infos_Parameters and Infos_Parameters_CSV - Some problems with CreateFile: if CreateFile doesn't work, I use WxFile instead - MPEG Video and MPEG Audio: bug between version 0.4 and version 0.5 corrected - PlayTime Calculation for OGM was false Version 0.5.0.1 2005-01-10 --------------- Bug fixes: - Win95/Win98/WinMe support again! (problem with Unicode) - AVI files were not well released (file locked) - Better MPEG4 support - Better coherency tests: no more file with 10 MP3 streams ;-) Version 0.5.0.0 2005-01-10 --------------- New - Developpers, you can exactly choose the format you want support (wit #defines) - UNICODE support (you should use it) (thanks to Jasper van de Gronde) - UNICODE filenames support (problem with wxWidgets:( ) - APE support (thanks to Jasper van de Gronde) - FLAC support (thanks to Jasper van de Gronde) - AAC support (but no tags, too rare) - DTS support - AC3 support - MPEG4 support - CDXA (XCD) support (with partial subformats, no Matroska for example, too rare) - A lot of rare and old audio formats: aiff, aifc, au, iff, paf, sd2, irca, w64, matlab, pvf, Fasttracker, sds, avr... - Visual C++ 7.1 support - Visual C# 7.1 example - Visual J# 7.1 example - Visual Basic 7.1 example Bug fixes - All C++ classes are in the namespace MediaInfoLib - OGG format: UTF8 was not well decoded outside of US-ASCII codepage - Better handling of language files (but really not perfect) - Better handling of Real media files (encoder, codec) - #936964: Error handling no video or no audio files - #899692: WM, File Properties Object: Preroll was not used (usualy, playtime was 2-4 seconds too long) - #868365: PlayTime - 2h12s is 2:12.00, not 2:00:12.00. PlayTime is better handled - #840508: OGM crash if file is corrupted - #1026978: Bitrate --> BitRate, OveralBitrate --> OveralBitRate Version 0.4.0.1 2003-08-25 --------------- Bug fixes - .Lib for Visual C++ compilers was forgotten - History and Licence was forgotten - Compiler changed from Borland to Microsoft for size efficiency (help for reducing code in Borland compiler would be appreciated) Version 0.4.0 2003-08-01 ------------- New - Open-Source (GPL) - Matroska partial Support - Better interraction with a FrontEnd Interface Bug fixes - MPEG1 and 2: huge bugfixes: now you can believe what it say:) - Files > 4 GigaBytes (OK for file size, but duration calculation is sometimes NOK) - Quicktime: bad codec in Audio if based of Microsoft 2cc - Quicktime: sometimes don't handle compressed headers - multiple video streams: second streams was not displayed - A lot of other minor bugs... Version 0.3.0 2003-03-03 ------------- New - New engine for having a lot more format available and be able to write in files - MPEG2 support (.MPG and .VOB) - AC3 support - DTS support - DVD Video (IFO files) support Bug fixes - Too much... Version 0.2.1 2003-01-12 ------------- New - MPEG support - WAV support - OGG/OGM duration Bug fixes - Too much... Version 0.2.0 2003-01-05 ------------- New - List of 400+ codecs (audio or video) - Multiple files opening - Multi-language (English / French) - OGG/OGM: Video bitrate, Play time - More tags (OGG/MP3) Version 0.1.1.c, 2002-12-31 --------------- Bug fixes - OGG/OGM, comments: bug if comments were not in the same order than streams - Summary: problems with roundness of audio bitrate (was floor method, now it is a round method) Version 0.1.1.a, 2002-12-30 --------------- Bug fixes - OGG, audio stream except vorbis: the bitrate was in byte in place of bits Version 0.1.1, 2002-12-29 ------------- Bug fixes - MP3: Url tag not well implemented Version 0.1.0, 2002-12-28 ------------- Initial public releaseMediaInfoLib/History_DLL.txt100777 0 0 267625 12264020506 11433 0Notes: ------ + Added - Deleted x Correction #number is the identifier of bug report (B), requested feature (F) or patch (P) bug reports and feature request are here: https://sourceforge.net/p/mediainfo/_list/tickets Version 0.7.67, 2013-01-10 -------------- x MXF: duplicate display of some time code streams in ancillary data x B814, AAC: Wrong detection of audioObjectType==29 Version 0.7.66, 2014-01-09 -------------- + EBUCore 1.4 output support + IMF AssetMap (AM), PackageList (PKL) and CompositionPlaylist (CPL): improved support + Channel layout information for AAC, AC-3, E-AC-3, DTS, Dolby E + MXF: CodecID field (EssenceContainer-EssenceCompression) + Pro Tools 10+ Session file (.ptx) support, by reverse engineering (=it may not work) + Playlist files: trying to detect language and channel layout from file names + QuickTime: new field ScanOrder_StoredDisplayedInverted, set to "Yes" when display and Stored orders are inverted + Wave: Detection of wrong byte rate in header in order to provide right duration of some PCM streams + ARIB captions: detection of captions in ancillary data (tested with MXF) + AAF: basic support of playlist files x QuickTime: false-positive detection of incoherency between container and raw stream scan order due to inverted display and tored orders x MXF: Dolby E stream not detected in some cases x #P78, HEVC: general_level_idc shall be set equal to a value of 30 times the level number, not 10 times, thanks to Kurtnoise x C# binding example: was not working with 2GB+ files, was parsing sometimes the whole file x #B802, AAC: Infinite loop, thanks to Sbastien Michel x #B805, AC-3: Segfault on files falsely recognized as AC3 files, thanks to Gildas Desnos x #B808, PCM: Infinite loop, thanks to Gildas Desnos x #B809, APE tags: Infinite loop, thanks to Gildas Desnos x #B810, AVC: Infinite loop, thanks to Gildas Desnos x #B813, CLI_Compile.sh bug ("eats all resources" while compiling) x LATM: false-positive detection of some files x MXF: Crash with some files Version 0.7.65, 2013-11-20 -------------- + MXF: forcing detection of MPEG Video in case EssenceCompression is not present but MPEG2VideoDescriptor is present + GXF: detection of some captions and time codes event if they are not present at the beginning of the file (testing middle of the file) + DASH MPD: basic support + HDS F4M (Flash Media Manifest): basic support + DCP AssetMap (AM), PackageList (PKL) and CompositionPlaylist (CPL): basic support + IMF AssetMap (AM), PackageList (PKL) and CompositionPlaylist (CPL): basic support + Mac dylib: looking for the dylib in @executable_path and CFBundleCopyExecutableURL dir + AAC: option for instantaneous bitrate in fast detect mode (MediaInfoLib only) + FTP (custom builds only): support of UTF-8 file names + Colour description: colour_description_present added, better separation between bitstream values and container values + MPEG-4: RLE, color space and bit depth + Law rating: support of CEA-608 XDS Content Advisory in MPEG-PS, MPEG-Ts, LXF, GXF + MPEG-4/MOV: Bug found in one file, sample size is 16 with a 32-bit CodecID ("fl32"), correcting the output of MediaInfo x #B775, AVI: AVI can use negative height for raw to signal that it's coded top-down, not bottom-up x #B780, MPEG-TS: crash with some files having PAT/PMT change between begin and end of the file x #B782, PBCore 1.2: some fields were not in the right order x #B784, some humain readable strings were not removed when the corresponding field is removed x #B787, MPEG-4/QuickTime: Erratic appereance of Bitrate Mode x #B798: setlocale() remove from DLL x #B785, DVCPRO HD: streams can be 8 or 10 bit, removing hard coded value from DV parser (MXF header value is used instead when applicable) x MPEG-4: wrong demux of some E-AC-3 streams x AAC: detection of HE-AACv2 was missing if the library is configured with fast detection x MPEG Video: wrong computing of duration of raw stream in case of drop frame time code x Automation, StreamKind type was set to integer, it is text x MPEG-4: was reading lot of useless bytes from disk when the raw stream format is not known x AVI: crash with some malformed text streams x Reference/playlist files were not supported from FTP (custom builds only) x MPEG-4/MOV: ScanOrder was using "stored" value instead of "displayed" value x MXF: Detection of Dolby E was not working in some cases (regression in 0.7.62) x MPEG-4/MOV: freeze with some files having mono 32-bit PCM Version 0.7.64, 2013-07-05 -------------- + New canonical URL of the website: http://MediaArea.net/MediaInfo + E-AC-3: support of streams having substreams (e.g. more than 6 channels) + JPEG: detection of YUVA, RGB, RGBA and YCCK color spaces + MPEG Audio: detection of Id3v1 inside an MPEG Audio frame + Matroska: support of HEVC/H.265 (based on specifications draft from DivX inc) + Canopus: detection of scan mode, scan order, pixel aspect ratio + MD5 generation option (work in progress) + Id3v2: reading of all Id3v2 blocks (no more only the first one) at the beginning of the file + MPEG-4: support of few additional iTunes tags, thanks to Kurtnoise + AVI: detection of Ut Video, thanks to Kurtnoise + MXF: detection of Dolby E even if EssenceCompression is not SMPTE 337 + AIFF: detection of Dolby E + AIFF: detection of not aligned Dolby E + ARIB B24/B37: Caption_conversion_type display (HD, SD, Mobile) + MPEG-TS: displaying CEA-708 service and CEA-608 presence if the corresponding ATSC descriptor is present + MPEG-TS: quicker analysis in the case of quick parsing option + #F412, Matroska: Handling of files having no DocType x #B761, MPEG-TS/ARIB: crash with some streams, thanks to maki x #B765, Matroska: was parsing the complete file if a stream indicated in the header is not present x #B763, MXF: detection of incoherency of channel count between bitstream and wrapper x #B762, Matroska: detecting 23.976 frame rate (instead of 23.962 fps due to imprecise timestamp) x #B759, QuickTime: detection of time codes having tcmi not embedded in tmcd box x #B766, RMVB: a/v delay is incorrect, currently disabling it x #B768, MPEG-4, crash with some MPEG-4 files x #B769, MPEG-4, crash with some MPEG-4 files x #B764, AVC: wrong parsing of some streams having pic_scaling_matrix x AVC, crash with some AVC streams x AAC, infinite loop with some AAC streams x FLV, infinite loop with some FLV files x Matroska: crash with some malformed files x MOV: crash/long parsing with some malformed files x AC-3: crashes and freezes fix x Java 64-bit: Count_Get(StreamKind) was always returning 0 x Python 64-bit: Count_Get(StreamKind) was always returning 0 x DTS: some streams were not detected x DTS: some memory leaks with 14-bit streams x SMPTE ST 302: memory leaks x SMPTE ST 337: memory leaks x Total failure if MEDIAINFO_REFERENCES_NO #define was used x QuickTime: Time code name is in "Title" field x MPEG-4/QuickTime: handling of weird "negative" frame duration is stts Version 0.7.63, 2013-05-13 -------------- + Switched to a BSD-2-Clause license + LXF: AFD (from ancillary stream) support + Detection of some side car files and showing them as a single package (optional) + MOV: more channel positions information + TTML: detection + SAMI: detection + ID3: updated list of genres, thanks to Mats + .so: search a local copy of the library before trying default path + AVI: Support of Adobe PARf (Aspect Ratio) chunk + VC-3: Scan order + #P65, Flac/Ogg DISCTOTAL metadata support, thanks to Kurtnoise + #P67, MOV, add Hap Video to the database, thanks to Kurtnoise + #P67, Matroska, add VP9 to the database, thanks to Kurtnoise + #P68, FLV, add HEVC detection in the FLV parser + #P66, MOV, tref/chap handling, with chapters information, thanks to Kurtnoise + #P72, MOV, HEVC/H265 detection and basic support, thanks to Kurtnoise + #F382/P75, PMP format detection + MPEG-TS, HEVC/H265 support + 16:10 DAR known value x #B742, MPEG-4/MOV, crash with some truncated/invalid files x #B746, MPEG-4/MOV: crash with files having moof atom and no moov atom x #B747, Inconsistent hang with buffer API x #B757, MediaInfoDLL.py MediaInfoList was not working, thanks to Elbenfreund x #B740, XML: dt:dt is replaced by dt (for binary data) x MXF: Dolby E streams starting only at the second or third frame were not well detected x MPEG-4/MOV: reducing analysis time for I-frame only video streams x CEA-708: weird behavior phantom streams are displayed) in case of buggy CEA-708 x AVI: crash with audio delay and AvgBytesPerSec of 0 x Wrong demuxing of the caption stream in the case of AVC streams without frame_mbs_only_flag but having 2 fields in one slice. x DPX: parsing was very slow with a sequence of files. x MXF: Pre-charge duration was not read, time code of the first frame was wrong if "Origin" is not 0 x FLV: file was sometimes (e.g. most of the file padded with zeroes) fully parsed x VC-3: Using values from specifications (based on compression ID) instead of SBD/SST/SPL/APLF from bitstream Version 0.7.62, 2013-02-22 -------------- + ARIB STD B24/B37 caption detection (both Japanese and Brazilian versions) + LXF: support of AVC, VC-3, MPEG audio, AC-3, Dolby E, and AAC detection and analysis + AC-3: support of 22.05 kHz streams (out of specs but they exist) + MOV: AIC (Apple Intermediate Codec) scan type detection + MOV: support of AVID metadata (interlacement information) + Time code dedicated tracks (MOV, MXF, GXF) + Time code track (MPEG-4/MOV, GXF, MXF) + Time code in SDTI (MXF) + Time code in System scheme 1 (MXF) + Time code in SMPTE RP 188 (aka SMPTE ST 12-2 aka ATC aka VANC) (GXF, LXF, MXF) + Time code in SMPTE RP 196 (aka HANC) + MPEG Video Time code + MPEG-TS: format_identifier, pointer_field, section_length (hidden by default) + CEA-608/708: caption detection duration is increased to 15 seconds (or 64 MB) in order to miss less caption content + Image files as a video stream: file name of the last file x #727, MOV: crash with some malformed files (Time scale set to 0) x #728, AAC: crash with some malformed streams x #681, AVI: was not analyzing VBR streams without bit rate info in header x #736: Division by 0 with 0-byte files x Id3v2: crash with some malformed tags x Bit rate display was "0 bps" if the real bit rate is more than 4 Gbps x Division by 0 in case of 0 byte long file x MPEG-4: wrong muxing mode information in case of A/53 captions in MPEG Video in MOV x P2 Clip: wrong uppercase/lowercase in the file name of source files. x MOV: PCM endianness was sometimes wrong x MPEG-4: JPEG interlacement was sometimes wrong x MPEG Video: wrong DAR information in case of DAR change between begin and end of the file Version 0.7.61, 2012-10-22 -------------- + MPEG-TS: SCTE 35 and KLV streams are better displayed (in Menu part) + MPEG-TS: Menu part contains the list of PID with unknown format + MPEG-TS: Menu part lists PID in the PMT order instead of increasing order + Display of both container and stream scan type and scan order + DV100: scan order + MXF: scan order + MPEG-TS: Maximum and minimum overal bit rate (only if parse speed is set to 1) + MPEG-TS, MPEG-S, MXF, AVI, WM: StreamOrder field added + MXF: better support of malformed VANC streams + MPEG Video: improved detection of the GOP (more frames are used), "Variable" value + MPEG-PS: FirstPacketOrder info added + SkipBinaryData option x #3564456, Matroska: some (other) streams were wrongly detected sa VFR x #3570092, Id3v2: support of old COM and ULT fields x CEA-708: crash with some malformed streams x MPEG-TS: crash when PCR is corrupted (same value at different offsets) x QuickTIme: wrong channel count report in case of buggy chan atom. Now the stream description has priority over chan atom x E-AC-3: duration was wrong in some cases x Matroska: random wrong analysis in case of SimpleBlock mode x #3574436, MOV: hang on files having buggy "alis" atom x MPEG-TS: bit rate mode detection was sometimes too much strict about CBR x DV: wrong detection in case of buggy audio header (if present and set to 0xFF) x MPEG-4: crash in case of buggy aperture size atom x MediaInfo_Const.h was missing in the DLL package for Mac x MPEG-PS: detection of phantom streams x WAV: detection of malformed >4GB WAV files was no more working x DTS: computing bit rate from frame size instead of targeted transmission rate x DTS: setting the bit rate to "unknown" for Master Audio instead of instantaneous bit rate x DTS: Display of endianess and word size was not coherent Version 0.7.60, 2012-09-02 -------------- + MPEG-TS/PS: improved detection of buggy time stamps + DPX: color primaries and transfer characteristics + MPEG-TS: Added support of scrambled streams without transport_scrambling_control bit set (e.g. PlayReady) + MPEG-TS: Name of some scrambling algorithms + MPEG-TS: detection of CBR/VBR at container level + MPEG Video: better detection of variable GOP + MPEG-TS: average, minimum, maximum PCR distance (hidden by default and you must parse the whole file with --ParseSpeed=1 option) x Matroska: some streams were wrongly detected sa VFR x #3538378, XML output: invalid characters, now if there is an invalid character, data is transported in base64 x LXF: wrong video bit rate with some files x AC-3/E-AC-3: hang up with some Little Endian streams x AAC: wrong min and max bit rate in case of partial (default) parsing, disabling it x AVC: crash or hang up with some malformed/scrambled streams x Opus: wrong duration in case of non-48kHz stream x MOV: 25 fps + drop frame time codes were not handled correctly Version 0.7.59, 2012-08-08 -------------- + License: Switched back to LGPLv2+Exceptions + #3555183, PCX support, thanks to Lionel Duchateau + #3555182, PSD support, thanks to Lionel Duchateau + #3555181, Matroska: ALAC detection, thanks to Lionel Duchateau + #3540425, OGG/MKV: Opus speech format support, thanks to Lionel Duchateau + #3531808, AVI: detecting more inconsistencies in stream durations + GXF: crash with Time code tracks without frame rate info + MPEG-4: stream order (hidden by default), in order to provide the same numbers as mkvtoolnix 5.2+ Track ID + QuickTime: default channel map is "L R" for stereo streams (as it seems to be in QuickTime player) + MPEG-4: support of WMA (version 1, version 2, Pro, Lossless) in MPEG-4 + FLV: handling of metadata with an underscore before the real metadata name + MXF: support of files with header missing TrackNumber in the descriptor (if it is present only in footer) + MXF: Language from DMS-1 + ProRes: analysis of the ProRes raw stream (including scan order for interlaced content) + colour_primaries, transfer_characteristics, matrix_coefficients: canonicalization of results + MPEG-4 Visual: colour_primaries, transfer_characteristics, matrix_coefficients + ProRes: colour_primaries, transfer_characteristics, matrix_coefficients + GIF: Display Aspect Ratio x #3533984, different behavior depending of compilation options (so Linux version was missing some info) x MPEG-4: audio/video delay was wrong in case of negative delay x CEA-608: Memory leaks removed x AVC: crash in case of analyzing some invalid SEI x MPEG Audio: crash with some files having Lyrics 2 tags x MPEG Audio: crash with some files having APE tags x AVI: secondary genre comes after primary genres in the "Genre" field x FLV: better handling of files containing more than 1 meta chunk x MPEG-TS/MPEG-PS: was aborting during full parsing in the case of very damaged streams x Vorbis: infinite loop if codebook_entries>=256 x Id3v2: crash with some unsynchronized frames, especially with UTF-16 comments x Id3v2: Wrong mime type of covers x MPEG-PS: crash in case of language info in descriptors x Java binding: crash with MediaInfo::Inform() (Windows 32-bit only) x MPEG-TS: false-positive in case of some MPEG-4 files with wrong extension x FLV: crash in some specific cases (malformed files) x 3548314, MVC: Scan type was wrong with MVC-only (without the underlying AVC stream) stream x 3553588, MPLS: stream duration was wrong with standalone (without the referenced M2TS) files x 3553588, MPLS: incoherent behavior with MPLS having more than one PlayListItem x 3554154, MPEG-TS: crash with some corrupted streams x MOV: all EIA/CEA-608 captions were not well detected x Matroska: Trying to better detect VFR streams, frame rate was wrong in case of interlaced content Version 0.7.58, 2012-05-28 -------------- + AC-3: Little Endian streams support + LXF: AVC streams support + ISM: better support + File referencing other files (HLS, ISM...): menu in case there is more than 1 stream per referenced file + MPEG-TS: option for keeping streams detected at the beginning then disabled in a an update of the PMT (activated by default) + MPEG-PS: program_map_section support for uncommon streams embedded in MPEG-PS x Referenced files (MXF, HLS, MOV, P2, XDCAM...): issues with source name, track order, files size x MPEG-TS/MPEG-PS: regression, some files with AC-3/DTS/DVD subtitles were not well analyzed anymore x MPEG-4 channel mapping: Lt and Rt (matrix-encoded) channel mapping were missing x GXF: handling of buggy files having non-PCM AES3 codec identifier but actually having PCM x MPEG-4: better support of MPEG-4 files having corrupted metadata atom x 3529510, EIA/CEA-708: was not detected if the stream was not present at the beginning, thanks to Pete Chapman Version 0.7.57, 2012-05-02 -------------- + #3513490, Vorbis comment (Flac, Ogg): more tags are supported + XML-based formats (P2, XDCAM, DCP, ISM, HLS...): support of UTF-16 encoding + MPEG-4: for buggy PCM, prioritizing the codec ID "in24" = 24-bit against the bit depth field x #3516900, Vorbis comment (Flac, Ogg): trying to do better mapping of PERFORMER and ARTIST tags x MXF: wrong video frame count in some cases x #3517374, GCC 4.7: compilation issues removal, thanks to SpepS x MPEG-PS: some files were not well demuxed so analysis was sometimes wrong (especially macroblock parsing) Version 0.7.56, 2012-04-08 -------------- + Better support of machines lacking of std::stringstream + Better support of machines requesting explicit stdc++ library link option (e.g. some ARM embedded devices) x #3515515, MPEG-4: crash with MPEG-4 container + H264/AVC video stream x #3515393, MPEG Audio: infinite loop (freeze) with some files x #3514677, Video: Well known 1.85:1 display aspect ratio was incorrectly displayed as 16:9 x #3513908, File interface: No output if filename contain a colon x #3515893, MPEG-4: some specific files were not detected x AVI: infinite loop (freeze) with some files (having index containing 0-sized chunk) x AVC: memory leaks x libcurl support: libcurl config from MediaInfo is compatible with libcurl+gnutls Version 0.7.55, 2012-04-05 -------------- + AC-3: support of little endian streams + LXF: support of format version 0 + HLS: support of .m3u8 index and sequence referencing a bunch of MPEG-TS files + MPEG-4: Added support of glbl atom and corresponding 4CC (ai12, ai15, ai1q, ai5q) + MPEG-4: Added detection of files with mx5p files wrongly filled with raw MPEG Video instead of MXF + MPEG-TS: Detection of 20-bit Dolby E even if the SMPTE 302 M header is set to 24-bit x #3513490, Id3v2: mapping of "Encoded by" and "Encoding library" is conform to the specs now x MXF: hang up with some clip-wrapped files x MPEG-4: AVC-100 bit rate was not coherent depending of the container (MPEG-4 or MXF) x reVTMD output is disabled due to its non-free (point of view of FSF and DFSG) licensing. Version 0.7.54, 2012-03-13 -------------- + #3480111, Matroska: parsing of WebM-style frame rate info + #3499859, ALAC: parsing of the alac atom, for real bit depth / sample rate + #3487601, DV: fields order (TFF/BFF) + MPEG-4: more video 4CCs binded to MPEG Video + H.263: raw stream parsing (width, height, aspect ratio), comparison with container data + Speed improvements + MPEG-PS: supporting parsing of some non-conform files + Full support of CEA-608 (separation of CC1-CC4, T1-T4) + #3494722, MPEG-4: trying to detect wrong duration in track header + MPEG-4 with embedded MXF track (XDCAM...): separation of video bitrate and padding bitrate + Compound streams (e.g. DV): separation of video bitrate and audio bitrate + Blu-ray: LPCM mono real bit rate is separated from the encoded (stereo) bit rate + Support of https, sftp scp protocols (custom builds only) + AVI: vprp (OpenDML) display aspect ratio support x #3480111, Matroska: some frame rates are incorrect in the file, trying to detect this kind of malformed file x #3479494, AVC: segmentation fault x #3440638, AAC: wrong detection for some malformed AAC streams x #3440638, MPEG-4: wrong analysis of some files having track header after media information x #3480111, MXF: Height was wrong for MXF with FrameLayout = Mixed fields x #3468235, Blu-ray: displaying PGS in all cases (even if PES is not detected, they are too much rare) x #3498846, MPEG-4: delay between audio and video was no more detected x #3495573, MPEG-4: crash with some files having fragments x MPEG-4: channel position in case of channel atom is configured with ChannelBitmap x MPEG-TS: crash with some buggy files (a PID indicated as PSI and PES at the same time) x AES3: not detecting Dolby E stream if there is guard band before the Dolby E frame, in MPEG-TS x DPX: some files with some invalid fields were not detected x DTVCC Captions: crash with some buggy streams Version 0.7.53, 2012-01-24 -------------- + DV: option for ignoring transmitting flags (TF1/TF2/TF3) (DLL and CLI only) + Matroska: ProRes detection + MPEG-4: official DTS CodecIDs (dtsc/dtsh/dtsl/dtse) support, thanks to Lionel Duchateau + Matroska: stream order (hidden by default), in order to provide the same numbers as mkvtoolnix 5.2+ Track ID + #3471516, BLu-ray: wrong channel count for mono/3-channel/5-channel/7-channel PCM streams + AVI: ISMP (SMPTE Time code), Tdat tc_o/tc_a (Adobe Premier time code) support + reVTMD output x QuickTime: crash and sometimes wrong info with some files having compressed header x MPEG-4: commercial format typo error (EX422 instead of HD422) x MXF: handling wrong MXF header having frame height instead of field height x #3471053, Tags: Id3v1 tag was used instead of Id3v2 if the file is short x #3463117, MPEG-TS: crash if Conditioal Access PID is same as the PES x Custom output: better handling of cases with special character strings (\n...) in the file content x #3440664: Audio only AVI file is missing duration x #3453476: detection so incorrect duration information in tkhd atom x Detailled XML output was producing duplicate xml-tags Version 0.7.52, 2011-12-19 -------------- + MXF with referenced files: if the referenced file is not available, trying to open local files + MPEG Video: GOP size for I-Frame only streams + MXF: support of CEA-608 in ancillary data for some other formats than MPEG Video, if there is no B-frame + LXF: support of SMPTE ST291/CDP/CEA-608/CEA-708 in ancillary data + WAV: better handling of files not having word alignment x DV: crash (division by zero) in some cases x DV: DVCPRO HD was sometimes not detected (low bitrate) x MXF: Crash if AFD field has an invalid value x MXF: Wrong endianess for some big endian PCM streams x MXF: some MXF referencing files have wrong duration x MXF: duration was wrong with some specific files x DVD-Video: detection of 20-bit and 24-bit PCM x XML output: it was sometimes containing some invalid characters x MPEG-4: considering default char set as ISO-8859-1 x MXF: better handling of referencing files having the same ID for all tracks x MXF: Handling of MXF files with wrong FooterPartition field x MXF: Some captions (not starting at the beginning of the file) were not detected x WAV: duration was missing is some cases x RMP3 support was broken Version 0.7.51, 2011-11-11 -------------- + #2872918, MKV: add support for default and forced track flags + #3418881, RK Audio format support, thanks to Lionel Duchateau + #3418883, LA: version field, thanks to Lionel Duchateau + MPEG-4: basic support of Aigo .3dv files + MPEG-2 Video: color display info (colour_primaries, transfer_characteristics, matrix_coefficients) + QuickTime: color display info (colour_primaries, transfer_characteristics, matrix_coefficients) + QuickTime: ProRes LT, Proxy, 4:4:4 profiles detection + QuickTime: mpeg CodecID support + Template inputs are now insensitive to carriage return kind (Windows \r\n, Mac \r, Linux \n) + MPEG-TS: Support of ISO 8859-2 in EPG + MPEG-4: more CodedIDs supported + GXF: more info about DV streams + GXF: Handling of files with more than 1 Time code x #3414326, GXF: using only the first map chunk for duration calculation x #3414513, Id3v2: was not able to extract covers with UTF-16 description x #3417908, video from several files: crash if there is not enough place for the frame number x #3433602, DVD-Video (IFO): Crash when scanning some malformed IFO files x Matroska: parser hanging in case of huge zero-padded files x MPEG-4: was not providing some info about tracks with sample table before media header x MXF: better support of corrupted indexes x #3429831, MediaInfo library: unload wrong DLL, thanks to McSpecky x MPEG-TS: Better handling of EPG running_status flag x MXF: Handling of "file:///" in Network loacators x FLV: audio delay was sometimes wrong x H264: Buffer size was in bytes instead of bits like with other formats x #3429196: no output if absolute file name, on Linux x #3187050, FLV: wrong detection when FLV header is corrupt x BLu-ray: crash if MPLS files are on the root of a disk x Blu-ray: parsing was very slow if MPLS was pointing thousands of times on the same file x #3292830, Matroska: crash if AAC sample rate is not provided by the container Version 0.7.50, 2011-09-23 -------------- + DVB Subtitle: region_width / region_height / region_depth (hidden by default) + MPEG-4: hdv6 and mx4p CodecID support (MPEG Video) + AVI: v210 CodecID (YUV) detect + #3411596, CDDA support, thanks to Lionel Duchateau + MXF: support of AC-3 + #3411999, AVi: detection of GeoVision MPEG-4, thanks to Lionel Duchateau + #3411999, MPEG-4: detection of VC-1 (WMV3), Nellymoser and WMA2, thanks to Lionel Duchateau x AVI: Better support of 2 video streams (e.g. "3D AVI") in a file x MPEG-TS: Duration was not provided in some cases x FLV: Delay and duration for AAC was wrong if delay was not 0, thanks to Justin Greer http://zencoder.com x #3408005, IFO: crash with some files x MPEG-4: some bitrates where wrong if smooth streaming is used Version 0.7.49, 2011-09-09 -------------- + AES3: analyzing AAC, AC-3, MPEG Audio embedded in AES3 stream + GXF: detection of DolbyE in AES3 in GXF + WAV: detecting AES3 non-PCM audio inside WAV + MPEG Video: more precise duration for 29.97 fps material having time code without drop frame flag set + MPEG-4/MOV: delay from time code track conforming to Final cut (using integral frame rate value if frame drop flag is not set) + Overall bit rate mode (CBR or VBR) + DVB Subtitle: region_horizontal_address / region_vertical_address (hidden by default) + MPEG-TS: option (--ParseSpeed=0.8) for testing the stream until all advertised streams are detected x MXF: some files with SDTI were not well demuxed (frame number) or were crashing x Some files where wrongly detected as MPEG-PS without streams x AC-3: non-48 KHz streams were not analyzed x 3164893, JPEG: issue with some JPEG files with no/incorrect extention x 3403338, crash with four character filenames Version 0.7.48, 2011-08-16 -------------- + ISM (ISM/ISMV/ISMA/PIFF...): more attributes (frame rate, frame count, duration) + MP3: support of VBRI header in a corrupted frame + Active Format Description: muxing mode (A/35 or SMPTE ST 2016-3) + MP4/MOV: Displaying info about first description atom of a track (instead of all of them) x MP4/MOV: scan order (Top/Bottom) from container, thanks to Peter Chapman x MP4: Channel layout was not filled in some cases x libmms: default behavior is using official libmms API only x Vorbis comment: album performer data was in performer field x Captions in AVC: some captions were not detected and decoded x AVC: GOP structure info was often wrong x MXF: IndexTable search was buggy (parsing the whole file) for some rare files (index present twice) Version 0.7.47, 2011-07-14 -------------- + ISM (ISM/ISMV/ISMA/PIFF...) support + SCC (Scenarist Closed Captioning) support + #3201768, BMP: BitmapV4Header support, thanks to Lionel Duchateau + MP4: enda atom support (Endianess) + MXF: expliciting PCM endianess x #3354384, Vorbis in AVI, version 3+ was displayed as 2+ x MPEG-4/MOV: files with big "free" atom were not parsed Version 0.7.46, 2011-07-04 -------------- + MXF: TrackName + DCP: Basic support (video and audio streams), both Interop and SMPTE versions + P2 Clip: Supporting directories with wrong letter case + MXF: detection of AES3/Dolby E in mono PCM streams without compression scheme + MP4: first frame duration difference if first frame has not the same duration than all other frames + MP4: frame rate set as CFR if only the first frame has a different duration + MP4: Handling of track duration smaller than media duration (track duration and stream size have priority) + #3348936, MXF: OP-Atom profile + Matroska, Stereo Layout support, thanks to Lionel Duchateau x libcurl (FTP/HTTP): seek request was buggy, invalid data was read x MPEG Video in MPEG-TS or MP4: streams were wrongly detected as VBR or CBR, any bit rate mode is removed until a working solution is found x AES (S302M): was no more detected if the packet was split in several PES x #3325235, Vorbis: streams were wrongly reported as CBR x EXR: Width/Height were 1 less than real value x #3344635, MP4/MOV: Delay missing if timecode track found before audio/video, thanks to Peter Chapman Version 0.7.45, 2011-06-15 -------------- + QuickTime: Support of EIA-608 streams created by Final Cut + Matroska: Support of Matroska tags + Matroska: parsing of tags at the end of the file (previously: only tags at the beginning) + MP4/MOV with uncompressed streams: scan type (interlaced/progressive) + YUV4MPEG2 (Y4M) support + GXF: more information about AES3 audio streams + EXR: Basic support + E-AC-3: dialnorm/dynrng (first frame / first block) information + LXF: support of DV PAL + DPX: Support of Cineon old format + DPX: Support of file with Little Endian configuration + MPEG-4: better support of file with more than one mdat or moov atom + WAV: more details from bext chunk + MXF: AFD (in both descriptor or ANC) support + MXF: Support of AES3 / Dolby E in 2 mono channels + MPEG-4: support of some malformed (without mdat atom) files + MXF: Better detection of streams without Essence Compression descriptor x MPEG Video: Custom matrix detection was broken x DPX: Industry specific header was not well decoded x JPEG-2000: Chroma subsampling 4:2:0 was recognized as 4:4:4. x Matroska: Handling default values for TrackVideoDisplayWidth and TrackVideoDisplayHeight x MPEG-TS: private audio streams with 0xCO stream_id were not correctly detected x FLV and RIFF: Changing Sorenson H.263 to Sorenson Spark because this stream format is too much incompatible with H.263 x MXF: Some specific files (including AFD in descriptor) were not well parsed Version 0.7.44, 2011-04-19 -------------- + AVI: support of some corrupted files (RIFF size set to 0) + AC-3: support of streams with 16-byte time stamp between frames + MPEG-TS: creation of index files, seek feature + GXF: seek feature + MXF: seek feature + MPEG-TS: detecting wrong stream registration information and skipping it + NTSC: accepting 483-line streams as NTSC + MXF: Parsing speed improvement, especially for high bitrate (>300 Mbps) streams + TGA file basic support + libmms: MMSH support (Linux/Mac only), thanks to RGB Networks + libcurl: HTTP header option and Time to live, thanks to RGB Networks + Id3v2 and MPEG-4: possibility to customize tag mapping + TIFF: more details x MXF: some specific files were not analyzed, fix sponsored by http://maxnine.com x LXF: random crashes Version 0.7.43, 2011-03-19 -------------- + MPEG-TS: detection and display of real time PAT/PMT change improved x EIA-708: crash with some specific files x MP4: crash with wiles including mix of PCM and other audio formats x AAC: crash with some malformed streams x FLV: crash with some specific files (longer audio than video at the end of the file) x MP4: wrong framerate information with some specific files (track header after media information) Version 0.7.42, 2011-03-03 -------------- + AES3: bit depth of AES3, bit depth of compressed audio stream, endianess + Id3v2 and MP4 tags: better mapping with iTunes fields + Tags: removal of technical only fields + MPEG Video: intra_dc_precision information (in advanced mode) + MXF: detection of raw pictures + MXF: support of URL encoded locators + MXF: color subsampling + DXW format support x #3171468, ADIF: crash in some cases x #3169916, IFO: crash in some cases x #3173391, Id3v2: was using local encoding instead of ISO-8859-1 x MPEG Video, discarding bad (always 0) group_start x AVC: crash with file having big log2_max_pic_order_cnt_lsb_minus4 value x AVC: wrong GOP information in some cases x Ut Video: Color space information was wrong x MPEG-4 Visual: Advanced Simple@L0 was detected as Advanced Simple@L1 x AVI: Crash with some AVC streams (not sized blocks) x MPEG Audio: crash with some files x AAC: crash, infinite loop or wrong result with some files x Trying to quicker reject a junk file x AVI: OpenDML indexes were no more parsed x Windows installer: OpenCandy library is updated and Microsoft agrees it is not dangerous for user privacy, it does not alert anymore. We do not transmit or collect personally identifiable information. Version 0.7.41, 2011-01-24 -------------- + MPEG-TS: random cases with full parsing of the file Version 0.7.40, 2011-01-24 -------------- + QuickTime: detection of AES3 and Dolby E + QuickTime: Apple CEA-608 and CEA-708 (in CDP) support + JPEG 2000: Chroma subsampling + JPEG 2000 in MXF: Color space + JPEG 2000 in MPEG-4 and MJ2: Color space + MPEG-4: mx5p CodecID support + ISO 9660 (CD/DVD/Blu-ray dump) detection x MPEG-TS: wrong detection (as encrypted) of some streams with a lot of transmission errors x MPEG-TS: wrong management of some PAT/PMT updates (real time parsing) x MPEG Video: wrong duration with some raw streams x FLV: wrong duration with some files x libcurl: crash if requesting a libcurl URL but libcurl library not present x MPEG Audio: crash with some malformed files x MPEG-4: error between recorded date and encoded date Version 0.7.39, 2011-01-03 -------------- + OGG: more CELT attributes, thanks to Lionel Duchateau + DV: better detection of display aspect ratio for specific (non standard?) streams + MPEG-7: support of ISO-IEC 13818-2 / H.262 (MPEG Video) version 2000 (multi-view / 4:2:2) + MXF: Clean aperture size support + D-10 (AES3) in MXF: real channel count + MPEG-TS: detection and analysis of ADTS in stream_id_extension + #2943900, MPEG-4 Visual: count of maximum consecutive B-frames + MP4: Handling of Nero library information atom + Id3: TAG+ support x #3140453, MKV with AAC: support of HE-AAC v1/v2 detection even if AudioSpecificConfig is missing x #3138883, ID3v2: crash in some cases if Data length indicator is used x #3139417, MPEG-PS: duration for caption detection was shorter than expected x #3139276, H.263: more precision about the different flavors of H.263 x AVI and MPEG-2 Audio Layer 3: error if audio stream duration estimation x FLV: better handling of weird bitrate metadata x D-10 (AES3) in MXF: Bit rate was wrong x AC-3: crash if false-positive detection of AC-3 and CRC is valid and bsid is wrongly set x #3141059, FLV: trying to detect partial files (so metadata are wrong) and using timestamps instead x #3141052, AVI: wrong duration, no detection of rec chunks, with some files x #3145968, RealMedia: not integer frame rate handling + HE-AAC filling x Id3v2: bad handling of some tags x MPEG-TS/PS: Frame count / duration accuracy of some very specific files x MPEG-TS/PS: Not counting non-decodable frames (without the corresponding I-Frame) Version 0.7.38, 2010-12-16 -------------- + uClibc compatibility, thanks to Metin KAYA + MPEG-TS: ID in all streams if a TS streams contains several substreams + JPEG in MOV: Scan type + AAC: implicit SBR and implicit PS detection (complete HE-AAC and HE-AACv2 detection) + AAC/LATM: more details (channels, profile...) + AAC/SL: more details (channels, profile...) + MPEG-TS and MPEG-PS with trace feature activated (Linux/Mac by default): speed improvement + DTS: indication of HD and Core configurations if there is an HD part + #3118446, MXF: VC-3 (DNxHD) detection + VC-3 (DNxHD) raw stream support + VC-3 (DNxHD): Bit depth + TrueHD/MLP: Duration (only in full parsing mode) + MPEG-TS: option for ignoring ATSC transport_stream_id indication x MPEG-TS: some teletext and DVB subtitles were not detected x #3111584, MXF: phantom track with weird result if an unknown track is found x #3116952, DTS and AC-3: was set as lossy in all cases (DTS Master Audio and AC-3 TrueHD are lossless) x #3137160, ADTS: some files with wrong extension were not correctly detected Version 0.7.37, 2010-11-22 -------------- + DPX format support + Compression mode (Lossy / Lossless) information (note: JPEG 2000 "profile" is moved to this new field) + #3095129, AVI: MLC Lossless codec support + #3095136, AVI: AMV Video Codec support + IFO: chapter information (thanks to Bastian Wegener) + MPEG-4: header size / data size / footer size information (in advanced mode) + MPEG-4: AVmp CodecID (.mov referencing .mxf) support + MPEG-TS: option for setting maximum scan duration + MPEG-TS: option for forcing stream info display even if not found in the stream (data from PMT) x MXF: avoiding infinite loop due to circular reference Version 0.7.36, 2010-10-24 -------------- + HDV 720p/1080i/1080p commercial names support, sponsored by http://www.chyro.fr/ + Raw TrueHD support + MP4: "lpcm" (PCM from DVD) Support (with channel positions) + MKV: compression mode (zlib...) display + WAV: support of AAC (ADTS) with CodecID 0x8180 + WMV: Handling of weird Aspect Ratio information in Extended Content Description + File interface: possibility to indicate begin and end offset of the analysis (partial analysis) + #3082158, .m4b file extension support + #3087674, Ut Video Lossless support + #3087677, WebP: basic support (detection only) + #3072929, MP4: DTS Express support + MPEG-4: Handling of external files referenced by "code" atom + M-JPEG and M-JPEG 2000 are renamed JPEG and JPEG 2000 + MP4 and HDV 1080i: detecting containers lying about width (saying 1920 but it is 1440) + DTVCC Transport and SCTE20: Option for displaying empty streams + DPX format detection x #3034092, MPEG-TS: hang up if program is modified (zapping) in the file x AAC: removal of empirical detection of SBR and PS (too many problems) x AVI: trusting in priority frame count from index of indexes with broken files x MKV: AVC "unknown profile" removal x AVC: some frame rates were reported as twice the real frame rate x #3029308, Id3v2: support of frames with Unsynchronisation bit set x #3065114, MPEG-Video: duration calculation issues with raw streams and open GOPs x AFD: crash with malformed streams x MPEG-7 output: missing references for MPEG-4 Visual and RF64 x #3086701, ID3: freeze/crash with ID3 tag at the end of the the file x LXF: some files were not completely analyzed (missing video) x JPEG: Chroma subsampling value was always set to 4:2:0, wrong x MP4 with MPEG Video: do not trust anymore raw stream timecode Version 0.7.35, 2010-09-05 -------------- + Teletext subtitle support + DVB subtitle support + CEA-608/708: language + Library: "Per frame" interface, like ffmpeg + AFD: AFD (Active Format Description) value and detail + MPEG-TS: SCTE35 detection and parsing + MXF: Ancillary data (S436M) support + MPEG-TS: Codec ID (stream_type) + MXF parser improvements x #3036119, MKV: default language value is eng x DV: weird display with some DV with synch problems. x AVC: wrong detection of bitrate mode for AVC in MP4 x MPEG-TS: crash and wrong detection of some non MPEG-TS files Version 0.7.34, 2010-07-09 -------------- + WebM support, sponsored by http://digi-metrics.com/ + LXF (Harris/Leitch) support + #3008704, IVF (Indeo Video Format) support + #3002376, Blu-ray: Source (.m2ts) for the .mpls parser + DV: handling of unsynched streams + Basic view, Bit Depth is added to the audio part + FLV: Framerate info for some not yet supported weird files + Demux (library only): demuxed packets can be forced to contain 1 complete frame + XML output: MediaInfo version + Parsing speed (Library only): option for a quicker analyzing, but with some missing features + AVI and Huffman (HFYU): Colorspace + AVI and Fraps: Colorspace + AVI and Lagarith: Colorspace + MPEG-4: Channel map basic support x CEA-708: Skipping some malformed streams x JPEG/M-JPEG: Resolution was in some random other field x #3001707, AAC in MP4: mono aac file detected as stereo x AVI: crash with some malformed files x AVI: Stream identifier was not filled in some cases x MPEG-PS: some files were not well detected x WAV: Bit Depth is back x WAV/PCM: Byte sign was wrong if Bit depth >8 x Decimal point issues with some specific compilers/OS x MPEG-4: removing support of btrt atom for average bitrate, too many wrong values x AVI: crash with some specific files (avc1 CodecID) x MPEG-4+AAC: Trying to better detect the (non)presence of PS if there is no PS header x MPEG-TS/PS: more precision on duration Version 0.7.33, 2010-05-14 -------------- + Colorimetry field is replaced by Color space and Chroma subsampling x Some words were not translatable x Solaris port was broken Version 0.7.32, 2010-05-02 -------------- + MPEG-7 output improvements + DV: Better detection of DVCPRO 50 and 100 (again), especially in MXF + P2: support of P2 XML files and P2 directory structure + XDCAM: support of XDCAM XML files and XDCAM directory structure + N19: More attributes + ISO-639-2 3-letter standard for language field (for third-party software) + Additional commercial name of a stream or container (XDCAM IMX, DVCPRO, AVC-Intra 50...) + MXF: support of detection of files without Track number in the headers + MXF: Operational Pattern + MPEG-4: Aperture size support x AVC: some files were wrongly analyzed (frame rate...) x AVI: better support of files with only one big data chunk (professional cameras) x MPEG-4: Huge memory usage with some files (files with DV and PCM) x DVR-MS: width/height was wrong in previous version Version 0.7.31, 2010-04-16 -------------- + SCTE 20 closed caption support + Difference between width/height in the container and in the raw stream + AVC: GOP structure + MXF: more raw stream formats are detected (MPEG-4 Visual, A-law...) + DV: Better detection of DVCPRO 50 and 100 x DV: less files without the right extension wrongly detected as DV Version 0.7.30, 2010-03-26 -------------- + AVC: Multiview Video Coding (MVC) basic support + AVI: better handling of some RGB or RLE codecIDs + Solaris package creation files update (with relocation) + MSVB: better handling of C pointers + WAV: Skipping wrong sample count values + GXF: Caption in ancillary data detection x #2970227, WAV: a file was wrongly detected as DTS x CEA-608: some captions were wrongly detected as active x MPEG-7: some corrections in order to be valid x FLV: Duration for video not starting at Time 0 x WMV and MPEG-TS/PS: some crashes are fixed x MSVC2010 and MSVC2008 project files were missing some files Version 0.7.29, 2010-03-08 -------------- + GXF (SMPTE 360M / RDD 14) support + GXF: support of CDP (SMPTE 334-2) in Ancillary data (SMPTE 334-1) (not complete) + AAC in MPEG-TS: Profile/Level + PCM in MKV: format name, channel positions + MPEG-7 and PBCore 1.2 output (pre-release) + MPEG-7: more metadata + Solaris package creation files + MPEG-TS overall bit rate is more precise x Channel positions: more coherency in the naming x DVD-Video (IFO): ID name was in hexadecimal only, now in Decimal+Hexa Version 0.7.28, 2010-02-19 -------------- + AIFF: ID3v2 tags support + AutoIt3: MediaInfoList interface + RIFF: Handling of INFO chunk in hdlr chunk + VorbisCom-based comments (FLAC, OGG...): support of new fields + MPEG-4 Visual: Duration for raw streams + Display Aspect Ratio 3:2 instead of 1.500 + Detection of N19 (EBU Tech 3264) + MPEG-2 Video: new profiles (4:2:2, Multi-view) + MPEG-2 Video: GOP structure + MPEG-4: handling of video streams with a different last frame duration + RIFF: Skipping OpenDML frame count (not always valid), when index is available + AMR: more attributes (Sampling rate, duration...) x MPEG-PS and MPEG-TS: crash with some files x MPEG-4: some bitrates to zero with a null bitr or btrt atoms x MPEG-4: managing different kinds of compressor name format x AMR in MPEG-4: crash with some specific files x #2952623, Id3v2: USLT with ISO-8859-1 charset was not well read x #2952637, Id3v2.2: PIC tag was not well read x #2952638, XML output: sometimes empty tags x #2920138, XML output: invalid char in XML tags Version 0.7.27, 2010-01-03 -------------- + MPEG Audio: Emphasis + MPEG-TS: PCR timestamp can be extracted in real time + Linux library: visibility is now limited to the official API x MPEG Audio, AAC, Vorbis: removal of irrelevant Resolution field even from containers x MPEG Video: error in calculation of frame rate if sequence extension is used x MPEG Audio: some VBR files without VBR header were wrongly detected as CBR x #2921999, unexpected quotes in the text output Version 0.7.26, 2009-12-18 -------------- + MXF: support of external files parsing + MLP support + TrueHD: more details (channels, sampling rate...) + TrueHD: display of both core and TrueHD details + #2905950, MPEG-4: Cover extraction + ADTS: better bitrate estimation + #2910579, MPEG-4 Visual: data_partitioned and reversible_vlc display + #2910572, MPEG Video: BVOP presence display + Internet Media Type (aka MIME-Type) display (but hidden by default) + ADTS: Id3v2 support x #2897584, ID3v2: Crash with some malformed UTF-16 strings x MXF: Better handling of interlaced content (height and frame rate) x Homogenization of Video resolution (ie no more 24-bit resolution, but 8-bit) x MPEG-TS: less false-positive detection of encrypted streams x MXF: better management of complex files (with references) x MOV: better management of complex files (with references) x Digital Video: better management of DV50, more bitrate accuracy x Digital Video: better management of DV100 (Width, Height, BitRate) x Digital Video: Some Colorimetry (4:x:x) were wrong x FLV: some files were not detected x MPEG Audio, AAC, Vorbis: removal of irrelevant Resolution field x MPEG formats: some Profile renaming, for more coherency Version 0.7.25, 2009-11-13 -------------- + MediaInfo (customized) with HTTP input: User Agent setting + #2896693, MPEG-TS: skipping some malformed PMT (with elementary_PID=0) x #2844911, AAC in 3GP: false detection of SBR and PS (again) x #2894411, MPEG Audio: UserDefined Covers replace other covers types x MPEG Audio: Some profiles were not displayed x RealMedia: Some Titles were not displayed x Matroska: Wrong detection of 6-channel Wavpack (detected as 2-channel) Version 0.7.24, 2009-10-30 -------------- + MPEG-4: DVCPRO HD detection + WAV: better handling of Wave Extension codec IDs + MPEG Audio: profile and extension display + MPEG-TS: More information for ADTS in non-audio PES ID. + FLV: test of video bitrate info integrity + MPEG-4: "sbtl" subtitles support + MPEG-4: old-style Apple language codes support + MPEG-4: XDCAM support + MPEG Video: vbv_buffer_size info + AVC: cpb_size_value info + VC-1: hrd_buffer info x #2882376, AVCHD: reports some incorrect AVCHD framerate x MPEG-4: some Pixel Aspect Ratio settings were not handled x Customized output: respect of carriage return from the platform x MPEG-TS demuxer: more tolerance of bad blocks Version 0.7.23, 2009-10-16 -------------- + OGG: more details for MPEG-4 Visual, MPEG Audio and AC-3 + MPEG-4: more information for MPEG Audio streams + MPEG-4: more information for ADTS streams + MPEG-TS: more information for ADTS streams + QCP (RFC 3625) format support + Refactoring of parsers, for more speed and less false-positives + WAV: INFO chunk parsing x Blu-ray directory analyzing was broken x VC-1: some streams were not detected x AMR in MP4: Resolution set to 13 or 14 bits instead of default 16 bits x Help, Known parameters was hanging up x AVC: frame rate was wrong for progressive streams with frame doubling x MPEG-TS: crash while parsing some streams with specific ATSC event_id Version 0.7.22, 2009-09-25 -------------- + MPEG-TS: KLV data detection x #2859504, 3GPP: some files were not detected x Some corrections about AVI Display Aspect Ratio x QuickTime: external files were completely parsed, too long x DV: Support of 4 mono channel configuration Version 0.7.21, 2009-09-04 -------------- + More permissive license for redistribution only Redistribution license is intended for companies with legal issues (if they can not deal with LGPL) + AVC: Support of frame doubling/tripling + AVC: Colour description + QuickTime: support of external files parsing x #2828430, Quicktime: 180 degrees rotation display was not displayed x MPEG-TS: whole file was parsed (long) x MPEG Video / MPEG-4 Visual: new algorithm for library name detection x #2844911, AAC in 3GP: false detection of SBR and PS x MKV: some chapters had timecode issues Version 0.7.20, 2009-07-31 -------------- + TAK format support, thanks to Lionel Duchateau + #2822681, Quicktime: Rotation display (from iPhone...) + ASP.net web application example + Java/JNA, Linux: dynamic load of libzen if not in LD_PATH x MPEG-PS: Some durations were a bit too long x MPEG-PS: Better handling of PTS/DTS for private and extension streams x ADTS: Handling of SBR and/or PS streams Version 0.7.19, 2009-07-17 -------------- + ALS raw files support, thanks to Lionel Duchateau + LA (Lossless Audio, old) support, thanks to Lionel Duchateau + SLS detection, thanks to Lionel Duchateau + AAC: forcing SBR/PS when it is implicit (if <=24KHz, if 1 channel) + AVC: Closed captions detection + #2813919, APE: CompressionLevel + XML output: track names are changed, for a better usability by XML parsers x MKV: Original display aspect ratio was not displayed x #2817479, Blu-ray/M2Ts: crash with some specific file names x MXF: the whole file was parsed, parsing now only the useful part Version 0.7.18, 2009-07-03 -------------- + MXF support + Blu-ray: BDMV directory parsing + Blu-ray: clpi/mpls files support + M2TS: Language if the .clpi blu-ray file is found + OpenSolaris support + MPEG-4 Visual: support of Sony SMC (security video) tags + MPEG-4 Visual: ASP profile was wrongly displayed + Mac OS X: Creation of universal and 10.4 compatible binaries option x Mac OS X: no more double-carriage return in Text view Version 0.7.17, 2009-06-19 -------------- + Python : adaptation for version 3 + XML output (thanks to Steen Jost Jensen) + MPEG-PS/TS: ATSC Closed captions (both EIA-608 and EIA-708) detection + MPEG-PS/TS: Language of closed caption (ATSC) + DV: camera settings + DV: Closed captions detection (raw DV, or in .mp4 and AVI container) + JPEG 2000 support + MPEG-4: support of JPEG 2000 embedded in a MPEG-4 container + MPEG-4: support of ProRes 422 / ProRes 422 HQ codecs + MPEG-4, AMR: Vendor and version + Blu-ray: support of PCM (Frequency, resolution, bitrate) + MPEG-TS: speed improvements x #2803396, sometimes crash with tiny (40-79 bytes) files x #2801211, MPEG-4/3GP: support of 3GP tags x #2795345, MPEG-4 Visual: crash with some specific user_data x #2793960, MKV: some MKV renamed as .ac3 were detected as AC-3 x #2796417, MPEG-4: Some files with Camera user data were not detected x so interface was not working since some releases on Linux x MPEG Video: better detection of 2:3 Pulldown x MPEG-4: Forcing AMR to 8KHz/Mono whatever the container says Version 0.7.16, 2009-05-20 ------------- + MPEG-4: More information for Avid DV streams + MPEG-4: more complete parsing (raw stream) of files with compressed headers + VC-1 and MPEG-Video: displaying the original framerate for streams with 2:3 pulldown + WMA: Handling of Mutual Excluded streams x MPEG-4: some files with compressed headers were not parsed x MPEG-4: Kodak files with EXIF data were not parsed x MPEG-4 (Quicktime): some files with compressed header were not well parsed x MPEG-4: Some files with a TimeCode track had wrong duration x MPEG-PS: some files with wrong timestamp were not well parsed x MPEG Audio with APE tags: crash with big tags Version 0.7.15, 2009-04-30 ------------- + Wave64 (.w64) support + MPEG-4: Better handling of 4GiB+ files + MPEG-4: audio parts from a DV stream are displayed + MPEG-4: better DV analyzing + DV: parser improvement (speed, accuracy) x DTS: 768/1536 Kbps streams are corrected to the real bitrate (755/1510 Kbps) x MPEG-TS: some stream durations were not well computed (few seconds only) x AVC: freeze with some malformed encoder settings Version 0.7.14, 2009-04-17 ------------- + #2738780, local time display for modified/created date + DLL installers (both 32 and 64 bits) + WAV: RF64 (Wav files >4 GiB) support + AVI: Audio delay from the container x #2734021, E-AC-3: some files were not detected x FLAC: some files with big attachments were not well detected x MKV: some huge video (3840*2160) were not well parsed (no encoding settings) Version 0.7.13, 2009-04-03 ------------- + #2635230, MPEG audio: Lame encoder settings + #2706146, WMV: detection of container wanted aspect ratio + #2611726, MKV: Audio delay detection + #2721811, MKV: TrueHD detection + Java: JNA (Java Native Access) binding + Exported "stream" interface for analyzing streams in memory (beta) + SHN (Shorten) detection + TAK (Tom's lossless audio compressor) detection + MPEG-TS parser optimizations + SWF: better handling of videos + WAV: better handling of 4GiB+ files + WAV: Extensible Wave support + MKV: Handling of chapters in multiple languages + Stream size for all streams when 1 video and all audio streams are CBR + Chapters are moved to menu part for better coherency with MPEG-TS, developers see Changes.txt for more info x #2712761, AVI: unsupported SalmonSoft text codec makes MediaInfo silently fail x #2719534, MKV: handling "modified" headers (zero padding) x #2720822, MPEG Audio: was freezing with 1 malformed file x #2721949, IFO: some stream IDs were false x #2725808, MPEG-PS: some "OTA" files were detected with TrueHD instead of normal AC-3 audio Version 0.7.12, 2009-03-20 ------------- + Complete refactoring of the code for speed improvements and future features + #2686943, MPEG-4: ISMV (IIS Smooth Streaming Media Video) basic support + MPEG-4 Visual: distinction between MPEG and H.263 default matrices + MPEG-TS: ATSC and DVB EPG support x MPEG-PS: duplicate stream infos with some AC-3 streams (with program map) Version 0.7.11, 2009-02-13 ------------- + OGG: Better Kate and CMML codecs support + AVI: Detecting wrong aspect ratio from a broken AVI header + DTS: Handling of Little Endian and 14-bit streams + WAV: ID3v2 tags parsing + MPEG Video: frame order even for progressive sequence x #2559346, MKV: Detection of framerate in MKV without framerate header x #2474280, OGG: some streams had bad stream size x MPEG-TS: some buggy file may corrupt memory x MP3/Id3v2: crash with one malformed file Version 0.7.10, 2009-01-30 ------------- + Mono (C#/Linux) binding + MPEG-4: Encoding library name + #2474280, OGG: Old version of Dirac identifier support + MPEG-TS: Encoded date for HDV + DVR-MS: Delay between two tracks + WAV: EBU Broadcast Wave format v1 support + CMP4: Basic support x #2529963: Infinite loop on one file x #2473140, DTS: error preventing 96/24 DTS detection x MPEG-4: Better support of Aspect ratio x Output was unstranslated and weird when $LANG is not set x C++ binding error in 0.7.9 x Python binding improved and corrected (no more crash with Linux) Version 0.7.9, 2009-01-19 ------------- + OGG: Dirac support + OGG: Speex support + OGG: other formats (JNG, Kate, MIDI, PCM...) detection + SWF: detection of more audio streams + MPEG-PS: Handling of PlayStation2 audio + #2474119, Minimal MZ (PE) and ELF detection + SMV (WAV/ADPCM+JPG files) file format support + DPG (Nintendo DS) file format support + QuickTime: TimeCode track analysis + MPEG-4 subtitles: difference between 'text' and 'tx3g' codecIDs x Python binding update for more compatibilty x #2474280, OGG: handling of files with Skeleton Metadata x #2445654, OGG: better false-positives detection x #2493685, AVI: Wrong video duration for some malformed 4GB+ AVI/DV files x #2516007, "Language" raw tag was sometimes 3 letter long instead of 2-letter long x Floating point overflow correction Version 0.7.8, 2008-12-09 ------------- + Changing version schema, only 3 numbers (next versions will 0.7.9, 0.7.10...) + Better Linux integration + rpm stuff (thanks to oc2pus http://packman.links2linux.org) + deb stuff + #2259421, FLAC and OGG: Encoding library name and version + FLV: version 10 support + FLV: duration of files without metatags + MPEG-4: Delay (useful when multiple videos are present) + Dirac: profiles updated from the latest specification + MPEG-4: more precise detection of OGG based codecs + MKV: better newest codecs handling + MKV: RealVideo/Audio support improvements + mipsel CPU support x MPEG-PS: Trying to have a better precision for duration x WMV: crash with some malformed files x MPEG-TS: some channel names where not shown x MPEG Video (version 2): some streams were misdetected as CBR Version 0.7.7.8, 2008-11-10 --------------- + #2216498, LPCM in VOB: more attributes (channels count, sampling rate, bitrate) + #2182135, Wavpack: support of multichannel files + AVC: detection of the newest profiles + DTS: detection of DTS-HRA, DTS-MA, DTS-Express, thanks to http://madshi.net + AES3 PCM in MPEG-TS detection + Wavpack: Encoder settings + WMV with "WVC1" codec identifier: video interlacement + MPEG-4: E-AC-3 support x #2186682, MPEG-2 Video: Wrong PAR and DAR for Panasonic MPEG2 Files x MPEG-4: some AC-3 and AAC specific files reported wrong channels value Version 0.7.7.7, 2008-10-17 --------------- + Support of VP5 file format + MPEG-4 Visual and MPEG Video: can now display the custom matrices data + WM: interlacement detection for VC-1 based codecs (WMV3...) + #2148321, PNG: more info + AVI: Better association of abcAVI tags to MediaInfo tags + PureBasic binding + Delphi binding: dynamic load (by default) of the library, thanks to Icebob x #2142995, MPEG-4: handling the Display Aspect Ratio from the track Header (tkhd) x #2141277, MPEG-PS/TS: Audio ID was hex for MPEG-PS but decimal for MPEG-TS streams x #2109107, Tags in Flac or Ogg: modification of the tag types priorities x #2120224, MPEG-4: some specific files were not parsed completely (missing info) x MPEG-TS with Dirac: some specific files were not parsed completely (missing info) x MPEG-4: Crash on MPEG-4 Visual format without DecDecoder stuff x Command line: was not reading custom template in UTF-8 codepage x DV: some files were not well detected x MPEG Video: some files were badly detected with 3:2 pulldown x AVS (Chinese): some corrections, thanks to Tom's translation of documents Version 0.7.7.6, 2008-09-12 --------------- + [2088009] Flac: Picture tag support + Flac: Support of Id3v1&2 in a Flac file + WM (ASF/WMV/WMA): detection of wrong framerate in header, trusting now the timestamp instead of the header + WM (ASF/WMV/WMA): detection of framerate from the timestamp when the framerate info is not available in the header + MPEG-4 with AVC: Added information about buggy files readable by all players except iPods + OGG: OGG with FLAC (pre- and post-FLAC 1.1.1) support x FLI/FLC: were not correctly detected x MPEG-TS without PAT/PMT: the complete stream was parsed, may be very long x Wavpack: duration and bitrate were false x #2071681, MPEG Audio: handling of truncated MPEG audio frames at the end of a file x #2032760, MPEG Audio: handling of MPEG Audio files with junk at the end x #2085149, Id3v2: was crashing with some malformed tags Version 0.7.7.5, 2008-08-22 --------------- + #2044174, AVS (Chinese Audio Video Standard) support + #2030684, AVI: Support of malformed chunks + Matroska: delay between audio and video calculation (for AC-3, DTS, MPEG Audio) + Full Replay gain support (gain/peak, track/album) for Flac/Ogg/MP3 + MPEG-TS without PAT/PMT (example: stream captured by some satellite TV receivers) support + MPEG-TS: Service info (name, provider, channel number) for both DVB and ATSC tags + Dot and thousand separator localized + Matroska: Handling of audio Delay x #2023872, DV: Crash with floating point exception on some files x #2024706, BDAV: Some QuickTime files misidentified as BDAV x #2033307, MPEG Video: Some raw files with high bitrate were not detected x #2040411, Id3v2: Crash with some malformed Id3v2 fields x #2036580, Id3v2: Problem when parsing big (>1M) Id3v2 tags, file was no more detected x #1893830, WMA/WMV: there was textual info (Linux/Mac only) x Video, Resolution/bits per pixel was sometimes per color entity, sometimes per pixel, now always per pixel x MPEG Video, the "Component" video standard was not detected x DLL only, the "by buffer" interface was broken Version 0.7.7.4, 2008-07-11 --------------- + #1995653, AVI: Delay of interleaves (example: "64 ms (1.53 video frames)") + #1995574, AVI: Report if the audio frames are split across or aligned on + MPEG-Video (raw): handling of "not started at the beginning" time_code + MPEG-PS: Trying to prevent errors with time code reset in the stream + AVC: Trying to detect raw AVC streams without SPS/PPS + [2013746] AAC in MPEG-TS: complete parsing of ADTS stream for more info about AAC + AAC in MPEG-TS: complete parsing of IOD based stream for more info about AAC + MPEG-TS: better detection of PCR time code + AAC: specifying the muxing mode (ADIF, ADTS or LATM) + MediaInfo DLL: NetBeans java binding example Version 0.7.7.3, 2008-06-27 --------------- + MPEG-TS: Detection of scrambled streams + #1995566: AVi, Identify ODML files + AC-3/DTS/AAC: Added another Channel configuration string (example: "3/2.1") in advanced mode + #1995569: Added proportion of each stream in the file (example: "500 MiB (90%)") x MPEG-TS: Handling of multiple programs in one PMT PID x MPEG-TS: Handling of streams in multiple programs Version 0.7.7.2, 2008-06-13 --------------- + FLV: detection of AVC and AAC x #1981032, Visual C++ 2008 binary is not compatible with Win9X, coming back to Visual C++ 2005 x #1964299, Never-ending 100% CPU if input file doesn't exist Version 0.7.7.1, 2008-05-30 --------------- + MPEG Video: Detection of 2:3 and 2:2:2:2:2:2:2:2:2:2:2:3 Pulldown + VC-1: Detection of 2:3 and 2:2:2:2:2:2:2:2:2:2:2:3 Pulldown + AVC: Detection of MBAFF + Translations: more words can be translated + MPEG-4 files: More info (profile, format settings, encoder name, x264 settings) for some well-known stream formats + MPEG-4 files: Better handling of not common formats (ALS, PNG, AC-3, DTS... in .mp4) + Bluray: detection of subtitles + Additional formats detected: Module, Extended module, Impulse Tracker, Scream Tracker 3 x #1967663, mp4: some specific iTunes atoms were not correctly parsed Version 0.7.7.0, 2008-05-16 --------------- + Third-party developpers: some MediaInfo fields have changed, please look at Changes.txt for more info + Python (Windows) binding + AC-3 TrueHD in bluray detection (even if the stream is splitted in 2 sub-streams) + Original framerate is shown if the framerate from the video stream and the one in the container are different + #1955061, Bluray: Duration + #1953908, FLV with audio delay detection x Linux with UTF-8 locale was not accepting non-English characters in filenames x #1954663, Some mono HE-AAC audio track detected as 2 channels with PS x VC-1 in TS detection even if the stream_type is not declared x xxxBSD compatibility Version 0.7.6.4, 2008-04-27 --------------- + About the library : Java/Linux binding is available + DV (raw) files support + Better support of DV in AVI container (type 1 and 2) + AVC: Handling of SEI which is before a SPS + AVC in AVI: reading more info (Profile, Cabac...) from streams created by FFMpeg + Vorbis in AVI: reading more info (Max bitrate, tags...) from streams created by FFMpeg + Detection of VC-1 in MPEG-TS from MainConcept encoder + MediaInfoLib is now thread-safe x #1943743, AVI with MPEG-Audio VBR and delay: delay was incorrect x Pixel Aspect Ratio was sometimes inverted (1/x) x XviD CodecID was redirected on Koepi website, no more available, changed to official XviD webpage x #1946098, DV in AVI: DV aspect ratio errors Version 0.7.6.3, 2008-04-12 --------------- + AVC: Count of reference frames + AU: Comments + Some global speed improvement x #1931844, Id3v2: Unsynchronized frames support (v2.3 & v2.4) Version 0.7.6.2, 2008-03-28 --------------- + MKV: handling of files created for streaming + MPEG-4: Handling of corrupted stream size info with some PCM streams + DVD video: Hebrew patch ("iw" code is mapped to Hebrew) x MPEG-4: better handling of bitrate mode (VBR or CBR) x AVI: MediaInfo reads now the framerate value from the container rather than the stream value Version 0.7.6.1, 2008-03-14 --------------- + AC3: TrueHD detection + MPEG-TS (or Bluray): VC-1, AC3+ and AC3 TrueHD detection + AVC in MKV: all SEI userdata infos from x264/eavc in Writing library settings + EVO: Better detection of duration + Dirac: raw files parsing + MPEG-TS: Dirac management + MPEG-TS: DVB subtitles/Teletext management x MPEG-4 Visual (DivX/XviD): writing library name was missing x MPEG-Video: some DTS files with wrong extension were detected as MPEG-Video x SWF: Compressed SWF files support is back x "Inform" option with file as parameter was not well parsed Version 0.7.6.0, 2008-02-29 --------------- + ID3v2 cover reading + Id3v2.2 (yes, it is old...) support + Id3v2: TXXX tags support + RMP3 (japanese MP3 based format?) support + SAMR in .mp4: some files have wrong sampling rate, forcing it to 8000 Hz + File_Created_Date and File_Modified_Date tags added (in advanced mode only) + MP3 encoded by Lame: Minimal (VBR) or Nominal (ABR) bitrate x Better detection of Lame encoder x AVC Display Aspect Ratio was not well detected if AVC is in a .mp4 container x Matroska Display Aspect Ratio was deleted if AVC aspect ratio was set, now Matroska has priority x "Subwoofer" term has been replaced by "LFE", more relevant Version 0.7.5.9, 2008-02-08 --------------- + AVC: CABAC detection + #1886241: AVC: all SEI userdata infos from x264/eavc in Writing library settings + ADPCM: compagny which created the stream is now shown in the codec section + PCM: precision about Little/Big endianess, Integer/Floating point method + #1882691: AC3+: raw files are now detected x AVC: FPS were sometimes 2x the reality x RealMedia parser was brocken x FLV parser was crashing x FLV: Better detection of Nellymoser audio x FLV: Disabling Framerate estimation if a VFR file is detected (estimation was false in this case) x Better false-positive MP3 detection (NSV files are no more detected as MP3) x IFO: there was a mistake betwwen NTSC and PAL framerates x Win9X support was (again) brocken in 0.7.5.8 Version 0.7.5.8, 2008-02-01 --------------- + Matroska: Full parsing of DivX/XviD/H264/AVC settings (profile...) + AVI: Full parsing of AVC settings (profile...) + AVI: Added a tag "OpenDML" (for example, the PlayStation 3 doesn't support OpenDML files) + AVC: Framerate, Interlacement, writing library (only for eavc, x264 and MainConcept encoders) + TwinVQ : channels, bitrate and sampling rate + Musepack SV8 support + Musepack and Musepack SV8: tags support + AIFF and AIFC format support + MIDI format detection + FLV: FrameRate even if the tag is not in the header + AU/SND audio formats support + Vodei encrypted AVI files detection + Linux/MacOS: support of 2GiB+ files + FLV: Video parsing even if the container says there is no video x APE Tags v1 are detected again x MPEG-PS: some malformed files were not well parsed, fixed x AVC: Cropping was not well handled (example: height was 1088 instead of 1080) Version 0.7.5.7, 2008-01-09 --------------- + SWF: Tags version 9 support + MPEG-TS: DegiCipher 2 (DCII) support + DVR-MS format support (with MPEG Audio or AC3) + WMV: language tag + MPEG-2 Video: Nominal bitrate x AVI: some speed improvments Version 0.7.5.6, 2007-12-10 --------------- + AVI, Interlacement for M-JPEG codec + AVI, Interleaved tag + Better showing of well know values ("44.1 KHz", "22.05 KHz"...) x AVI, was parsing the whole file in case of non-interleaved files x MP3, was freezing on specific files x #1838202: Flac, Resolution was 1 less the the real value (15 bits instead of 16...) Version 0.7.5.5, 2007-11-09 --------------- + #1799859: Flac, tags are case insensitive + Matroska format parsing improvements + .mp4 speed improvement x BDAV (Bluray) parser compilation was forgotten in the previous version x AVI, Bitrate and stream size were false x #1825218: IFO parser was brocken x #1825521: .mp4 chapters times were wrong x #1801549: DLL was crashing during Delphi/C# debugging sessions Version 0.7.5.4, 2007-11-02 --------------- + Aspect Ratio is renamed Display Aspect Ratio + Pixel Aspect Ratio added (in advanced mode) + More attributes for AC3+ + More attributes for VC-1 + Profile and level for MPEG-4 Visual based formats (DivX...), AVC and VC1 + Speed improvement for MPEG-TS, MPEG-PS, DVD-Video (.vob), HD-DVD, BluRay + MPEG-4 AAC, Channels position + AAC (ADIF), More info + AAC (ADTS), More info x FLV, there was bad dates on some specific metatags. x #1818404: WAV with "float" PCM, bad detection x CDXA (.dat) files parsing is back Version 0.7.5.3, 2007-10-08 --------------- + Better OGG/OGM parsing + Better .ifo (DVD-Video) parsing + .rmvb files are now detected in Windows Explorer + Win9X/98/Me support does not request Microsoft unicows.lib anymore x Win95/98/Me support was brocken since 0.7.4.6. It works again. x #1798997: MPEG-4, some Apple codecs were wrongly reported x Lot of memory leak correction, you can now parse 1000+ files without problems Version 0.7.5.2, 2007-08-16 --------------- + Now accept AVI files with junk at the end x #1770477: Video info for some low-bitrate MPEG files were not shown x #1770509: MPEG 2 Audio Layer 2 was not well detected x #1763282: FLV, wrong playtime on PPC based machine x #1734113: IFO, crash with some specific files x Tooltip extension was requesting development tools since 0.7.4.6. No more requested. Version 0.7.5.1, 2007-07-23 --------------- + AVI: 24/30 fps (aka 120 fps hack or dual frame rate video) detection + TruAudio (.tta) support + Wavpack (.wv) support + MPEG-4 based containers: Codec/CC tag support + #1754143: AC3 & DTS detection in a .mp4 container made with the Haali's gdsmux tool + #1754140: AC3 detection in a .mp4 container from Nero Digital + #1754905: iPhone files support x #1750275: HD-DTS was no more detected in a .m2ts (bluray) file x AVI: AAC profile name was no more detected Version 0.7.5.0, 2007-07-09 --------------- + Licence changed from LGPLv2 to LGPLv3 + More information about mpeg-4 based (Nero...) files + MediaInfo analyses longer a .vob file to be able to find hidden tracks (subtitles...) + #1747633: Encrypted WMV detection + FLV: more attributes x Memory leaks correction x #1720404: MPEG, rare crashes with some files x #1721846: AAC ADTS were no more detected x MPEG Audio: No detection if there is some specific junk before the real audio data x #1728059: Delphi DLL overflow with big files x Crash with Youtube FLV files x AVI: Delay for AC3, DTS and MP3 is back Version 0.7.4.7, 2007-05-14 --------------- + OGG Vorbis, "Floor" value (useful for some players which don't support Floor 0) + MPEG-Audio, Lyrics3v1/v2, ApeTagv1/v2 parsing + MPEG-TS, handling of complex files (multiple programs, 8+ channels...) + #1704008: handling of AVC or MPEG-4 Video in a MPEG-TS file without program map + VC-1 basic parsing + DTS True HD detection + AC3+ detection + HD-DVD (decyphered) support + BluRay (decyphered) support x MPEG-TS, Duration calculation problem on very rare files x MPEG-4/iTunes, Tags where not well parsed in 0.7.4.6 x FLV, freezes or crashes with some files x #1718269: MPEG-4 Video, Framerate of 65535/2733 is transformed to 23.976 x Windows Media (ASF/WMA/WMV) with file size more than 4GB were not well handled x MP4 with file size more than 4GB were not well handled Version 0.7.4.6, 2007-04-28 --------------- + Windows 64-bit version of the command line tool and DLL + Linux 64-bit version of the command line tool + More Musepack properties + Detection of Musepack v8 files + Complete parsing of Real Media files (all tags) + Improved Windows Media (ASF/WMA/WMV) parsing + MonkeyAudio tags (APETagv1/v2, Id3v1) parsing + Ogg/Theora : Video bitrate + MPEG audio : More encoder detection (bitstream parsing) + SWF (Flash) parsing x #1665981: Mov - PCM audio (digital camera) was detected as RGB x #1672896: Wave file with .mp3 extension was detected as MP3 x #1689570 and #1633237: Better JPEG parsing Version 0.7.4.5, 2007-02-23 --------------- + Program file size reduction + WAV : Support of some special tags at the end of the file + AVC : Display Aspect Ratio x #1653325: Wrong Resolution with AVC High Profile x #1662890: Problem with tag adaptation parser (mainly for ID3v1 genre) x Better support of corrupted MOV files Version 0.7.4.4, 2007-02-05 --------------- + FLV format support + Basic support of multiple programs in a MPEG Transport Stream (Satellite broadcast) + Basic detection of TwinVQ (.vqf) files (+tag parsing) + Better handling of corrupted .mp4 files + Better handling of corrupted .avi files x Crash with corrupted "COMM" Id3v2 tags x Crash with some audio files x #1633524: MOV, Crash on files with corrupted Descriptors x #1630907: MP3, Crash on files with corrupted (empty) Id3v2 tag x #1637838, 1634549, 1635131: Crash with some audio-only files x AVI, Better detection of writing application found in a "JUNK" chunk x AVI, sometimes wrong playtime x #1637191: AC3 delay in AVIs is back x #1635134: some freezes with MPEG-7 files (but this format is not yet supported) x #1635087: some files were wrongly detected as AC3 x Russian (or other non-latin language) AVI tag parsing is back. Version 0.7.4.3 2006-12-22 --------------- x #1622477 : Wrong Time Values for Chapters in mp4 files + Linux shared object available + MPEG-TS : Detect encrypted stream, and show the codec + id3v2 with UTF-16 frames + AVC in MPEG-TS AVC parsing + AVC : Width and Height + MacIntel version x Matroska, some crashing files (with chapters) Version 0.7.4.2 2006-12-09 --------------- + Encoders database updated with 20 new encoder versions + Codecs database updated with 100 new codecs (video or audio) x Matroska, sometimes wrong Playtime x MPEG-4 : some Titles were not well parsed x MPEG PS : some video stream were missing x Crash with some malformed files x Some debug files were created Version 0.7.4.1 2006-12-08 --------------- + MPEG Transport Stream : Video info (Standard, Chroma, Interlacement...) and PlayTime + CDXA : PlayTime + MPEG-4 Video embedded in MPEG Program Stream support + MPEG-1 stream embedded in a Quictime file + MPEG-4 AAC Parametric Stereo (SBR-PS) detection + Detection of encrypted MPEG-4 (like iTunes) + Support of MPEG TS with lot of synchro errors + AVI : Exact Stream size calculation (but currently OpenDML files are not supported) + MPEG-4 : Exact Stream size calculation + Basic support of Korean mobilephone provider Sky (.skm) x MPEG Program Stream : PlayTime, Delay are corrected x #1601787 : MOV tracks issues (and crash) x MOV : was stopping on too big "free" atoms x MOV : Aspect Ration of DV is corrected x MPEG : Handling of negative Delays between Audio and Video x Musepack parser was doing too much "false positives" with some MPEG files Version 0.7.4.0 2006-11-24 --------------- + Linux i386 version + AutoIt example + AVI with AAC-SBR : detection of real SamplingRate (not the sampling rate in header) + AVI with DV : basic information about audio + AVI with DV : detection of duplicated audio stream + Google Video : metadatas + AVI : now able to read metadatas at the end of the file + AVI : Bitrate computed is based on filesize in header instead of real filesize (for broked files) + AVI (DivX) : Menu detection (yes or no) + AVI : detection of VBR MP3 (useful for DVD players, sometimes they don't accept it) + AVI : detection of Delay between Audio and Video (for MPEG Audio, AC3 and DTS) + PlayStationPortable MPEG-4 files support + 3GPP5 files support + MPEG-4 : Detection of MP3, Vorbis streams embeded in a 'mp4a' atom + MPEG-4 : Detection of AVC streams embeded in a 'mp4v' atom + MPEG-2TS with MPEG-4 and AC3 detection + Speed improvements + MPEG-4 with Variable FrameRate detection, min and max x #1551482 "\n" in filename get replaced by newline in "Text" output x AVI : infinite loop on one example file x AVI : some bad detections corrected x MPEG-PS : infinite loop in intra Matrix on one example file x MPEG TS : better detection of streams Version 0.7.3.1 2006-07-30 --------------- + MPEG-1/2 PS : more files have a duration + AVI with MPEG-4 Video based codecs (DivX, XviD...), more encoder string detections + Microsoft Visual Basic binding : wrapper class added around methods + Microsoft J# binding : wrapper class added around methods + Microsoft C# binding : default values for methods, to cleanup code example x Matroska, crash with big (>4GB) files Version 0.7.3.0 2006-07-19 --------------- + MPEG-1 and 2 Transport Stream support + MPEG-1 and 2 Video : Custom Matrix detection + MPEG-4 Video : Custom Matrix detection + Google Video (GVI) support + AMV/MTV (Chinese) detection (if you have specifications of theses formats, email me) + AVI/DivX/GoogleVideo and MPEG-4 Video : packed bistream detection. Now you can know if your DVD player can read the file before burning. Next step: a database of DVD player capacities ;-) + Java binding + C/C++ dynamic loading (instead of static linkage) binding + MPEG-4 : Language + MPEG-4 : Text streams (subtitles) + C# binding : wrapper class added around methods x #1523005 : C# crashes because I did not use PtrToStringUni() to handle char pointers x #1485003 : MP3, "Title" tag was sometimes forgotten x #1485804 : Wrong bitrate and time in PCM files x #1485810 : wrong playtime on CBR MP3 files with big id3v2 tags x #1485803 : some WMA tags were forgotten x #1488449 : crash on very rare buggy MP3 files x #1482686 : ShellExtension, crash when moving a directory x #1488770 : PlayTime, some "minutes" formating were forgotten x #1485044 : some .ico files were detected as MPEG Audio x AVI, handle some malformed timestamps in tags (carriage return at the end...) x MPEG-1 and 2 : incoherancy of PlayTime Version 0.7.2.1 2005-05-08 --------------- + MPEG-4 : Chroma ("4:2:0"...) + MPEG-4 : Interlacement mode ("Top field first", "bottom field first", or "Progressive") + MPEG-2 : Chroma ("4:2:0"...) + MPEG-2 : Interlacement mode ("Top field first", "bottom field first", or "Progressive") + MPEG-2 : Profile and Level ("Main@Main"...) + MPEG-2 : Standard (NTSC, PAL, SECAM, or MAC) x #1482346 : Incorrect playback time in OGG files (was not enough precise). x #1482602 : MPEG-4 video false positive files x #1479344 : Problems with DLL interface, ToolTip shell extension DLL extension are in another DLL to keep compatibility x #1479317 : stop if debuging in Borland IDEs when opening an AVI file Version 0.7.2.0 2005-04-30 --------------- + ToolTip shell extension (if you have the mouse on a multimedia (AVI/MKV/OGG...) file, a ToolTip will be showed + AVI with DivX or XviD : Encoder name, GMC/QPel/B-frames indicator if present (beta) + AVI and WAV with MP3 : encoder name, precise version and layer number, VBR indication + Matroska: support of anamorphic videos (right Aspect Ration even if pixel aspect ratio is not 1:1) + AVI/WAV : support of extended wave files (20 bit per sample and more than 2 channels) and channel position + AVI : support of Exif tag format + AVI : more tags are supported + Genres can be translated by translators + Real : detect RealAudio Lossless Format x #1454009 : AC3, sometimes wrong AC3 playtime x #1469423 : MP3 with cyrilic filenames, Id3 tags can be read x #1464066 : Hang ups with raw h264 streams x #1462647 : Quicktime files with preview image, crash x #1445150 : crash with some malformed MusePack files (workaround, this is a the Musepack bug, not yet corrected) Version 0.7.1.2 2005-03-10 --------------- + #1438441: show TV format (PAL/NTSC) for DVD and DV + #1343147: Matroska, Show Chapter names + MPEG-1 and 2, more precise playtime + MPEG-1 and 2, Added Encoded_Application if it is in video user data + Quicktime: Support of Quicktime "wide" (header at the end of the file) + MPEG Audio: Detect small (examples, less than 200K) MPEG Audio files with Id3v1 tag + #1441661: AVI, Handling of DV Type 1 x #1440480: No Audio Found in MPEG-2 after 0.7.0.4 x #1438987: Infinite loop with some Matroska files x Matroska, Recorded date is now in UTC format, rather than the number of seconds since 1970 x AC3 noted 5 channels (because of 5.1) are now noted 6 channels (more realistic) x Quicktime: "ima4" or "twos" codecs were detected as Video stream instead of Audio stream x Crash of third-party softwares with some specific files Version 0.7.1.1 2005-02-24 --------------- + Now ~900 codec names (Audio/video/Text) are known (instead of 500) + Matroska : Framerate is now for all kinds of codec (and not only FourCC based ones) + MPEG-4 (m4V, Quicktime...) with unicode filename are now handled (before : crash on htis kind of file) + #1326802: MOV with 3GPP datas. + Meta-tags of Quickime HD files + #1244215: bit-rate details for MPEG-1 Video (VBR) (calculated with other CBR streams) + Detection of MXF files + #785338: Huge work on RealMedia parser (bitrate, channels, sampling rate, fps...) x #1435086: Translation problems if the program is launched directly with a filename x #1361647: Complete rewrite of MPEG-4 (newest Quicktime, 3GPP, iTunes...) parser to be more robust. x Some minor (but crashing :( ) bug fixes x AVI with DV was not well parsed x ActiveX DLL was forgotten Version 0.7.1.0 2005-02-12 --------------- + Speed improvements + #1383832: support of last version of Quicktime files + Support of Musepack files + Support of Flic (FLI/FLV) video files + Support of files with more than 8 audio streams or 32 text streams + Support of DTS-HD (DTS at 96 KHz / 24 bits) + Support of ID3 tags (v1 and v2) in .AAC files + Support of all Tags in AVI files + Detection of QuickTime image files and QuickTime compressed archives + Detection of AVC files (3GPP, 3GPP Mobile or JVT) + Detection of iTunes protected files + Detection of H264 files (Raw, 3GPP or JVT) + Detection of Dirac raw video files + Detection of TrueAudio files + Detection of WavePack files x #1420672: No WMV bitrate x Crash with some corrupted MPEG files x Crash with some MP3 files with corrupted ID3v2 tags x Crash with some Quicktime files with corrupted tags x #1257550 (again:) ): with AVI, rounding of FPS had an impact of FrameCount, based on FPS. Now based on AVI file (better ;-) ) x #1381652: Reported some GIF files as Mpeg audio x #1381619: UPX compressor is no more used, to prevent Virus checker to use 100% CPU x 2nd Video framerate forgotten x Video languages were not parsed (example: "en" should be "English") x FrameRate/String was forgeting measure (example: "at 25" should be "at 25 fps") x Some case sensitive problems (example: "KBps" instead of "Kbps", 8 times more) x DTS and AC3 channels position names were changed to be more human readable + Added .lib files needed for Borland and MS C++ compilers (no need to use "implib" anymore) + Added Contrib directory: ActiveX component (warning: no support from me) Version 0.7.0.3 2005-10-25 --------------- x Matroska: "ID" and "UniqueID" tags were not assigne to the right stream. + Text: URL for Text codecs Version 0.7.0.2 2005-10-17 --------------- + Support of ISO-639 language names (more than 200 language names can be translated) + Support of "multilanguage" language name (ISO-639 "mul") x #1260619 Delphi Example was incorrect Version 0.7.0.2 2005-10-17 --------------- x #1323208: Video Bitrate for OGM files with VBR audio was incorrect + Better detection and handling of DivX container + #1327902: More meta data properties for RIFF files x #1327468: RIFF (AVI) files with not-padded (INFO) sub chunks can't be parsed + More "generic" tags added x Some other minor bugs Version 0.7.0.1 2005-07-24 --------------- x #1257550: rounding of FPS was 2 digit precise, not enougth, upgraded to 3 digits, and exact number is given (23.97 before, 23.970 or 23.976 now) x Better false positive detection (mainly in MPEG1, MPEG2, MP3) x some memory leaks if you use MediaInfo a long time x MPEG Audio: VBR bitrate corrected for MPEG **1** streams x MPEG Audio: VBR bitrate corrected for monochannel streams x #1274999: mp3Pro timing was wrong (2x the real timing) + "BitRate_Mode" with MP3 (VBR or CBR) + "PlayTime" with AC3 + "PlayTime" with WAV Version 0.7.0.0 2005-07-23 --------------- + DLL: New(), Delete() added. Open() modified. WARNING: this break the interface x Some changes in the name of Get() varaibles. WARNING: this break the interface + Better documentation (still in beta version), with a quick "How To" + DLL: MediaInfoList interface (multiple files with one Handle) + DLL: C++ wrapper Version 0.6.1.1 2005-06-25 --------------- x Open Folder option is comming back x File with an unknown format were detected as MP3 x Corrected hang up on Matroska files x Corrected crash on AVI with subtitles only x Corrected crash on some corrupted or unknown files + Added 3GPP files support Version 0.6.1.0 2005-06-23 --------------- + #1210433: in WMVA, Genre + #785349: Added Video->FrameCount (in advanced mode only, and developers) + #785349: Added BitRate mode when the codec is know to be only one (AC3 is CBR, Vorbis is VBR...) x in WMA/WMV, Tags>255 x #1210425: bugs in MP3 (Genre, Track) (thanks to Ingo Brueckl) x #1210412: MS Windows DLL didn't work under Win9X (no crash, but "Not a good file" reply) because of UnicoWS.dll linking problem. x #1209291: IFO, Incorrect BitRate_Mode and Resolution (bit shifting), example 704*480 x #1209293: Incorrect Month in General/Date (UTC stamp was 1 month earlier) (thanks to Ingo Brueckl) x #1215142: SamplingRate for MPEG audio streams in MPEG container was false x #1222414: Video BitRate for AVI is back x #1215939: Added a Format "MPEG x" if MPEG version can't be detected x #1215840: Better version detection of MPEG Video. But still a workaround, if you know how to detect MPEG1 or 2 in a video only file, please contact me! x #1210546: For developers, you can know which type is the value returned (Text, Integer, Float, Date, Binary) Version 0.6.0.0 2005-05-18 --------------- + PCM support in VOB files + Complete rewrite of MPEG1/MPEg2 (and DVD) parser + Complete rewrite of AVI parser: internal parser in place of Win32 API + #1123025: Escape codes at custom text (for comma, [, ], parenthesis...) + Begin of adaptation with GCC: tested with MinGW and Knoppix (Core library, and OGG) x (I hope) all CSV bugs (quotes...) are corrected x Unicode decoding in WMV/WMA/ASF formats x #1195325: Memory leaks of 500 KiB/opened file x #1192446: Incorect duration in some AVI files x #1172817: Options in Inform method was "forgotten":(. Warning: this modification breaks compatibility with older DLL (this is why this version is named 0.6 in place of 0.5.x) x #1201430: Should work with files having broken video stream header x #1183702: Should work with files having broken video stream header Version 0.5.1.0 2005-02-09 --------------- New - Better management of Inform() options - Added more language names decoding for audio and text streams - Language names for audio and text streams are translated Bug fixes: - Inform: hangups in Inform() with customized Option("Inform") settings - Options: inversion between Infos_Parameters and Infos_Parameters_CSV - Some problems with CreateFile: if CreateFile doesn't work, I use WxFile instead - MPEG Video and MPEG Audio: bug between version 0.4 and version 0.5 corrected - PlayTime Calculation for OGM was false Version 0.5.0.1 2005-01-10 --------------- Bug fixes: - Win95/Win98/WinMe support again! (problem with Unicode) - AVI files were not well released (file locked) - Better MPEG4 support - Better coherency tests: no more file with 10 MP3 streams ;-) Version 0.5.0.0 2005-01-10 --------------- New - Developpers, you can exactly choose the format you want support (wit #defines) - UNICODE support (you should use it) (thanks to Jasper van de Gronde) - UNICODE filenames support (problem with wxWidgets:( ) - APE support (thanks to Jasper van de Gronde) - FLAC support (thanks to Jasper van de Gronde) - AAC support (but no tags, too rare) - DTS support - AC3 support - MPEG4 support - CDXA (XCD) support (with partial subformats, no Matroska for example, too rare) - A lot of rare and old audio formats: aiff, aifc, au, iff, paf, sd2, irca, w64, matlab, pvf, Fasttracker, sds, avr... - Visual C++ 7.1 support - Visual C# 7.1 example - Visual J# 7.1 example - Visual Basic 7.1 example Bug fixes - All C++ classes are in the namespace MediaInfoLib - OGG format: UTF8 was not well decoded outside of US-ASCII codepage - Better handling of language files (but really not perfect) - Better handling of Real media files (encoder, codec) - #936964: Error handling no video or no audio files - #899692: WM, File Properties Object: Preroll was not used (usualy, playtime was 2-4 seconds too long) - #868365: PlayTime - 2h12s is 2:12.00, not 2:00:12.00. PlayTime is better handled - #840508: OGM crash if file is corrupted - #1026978: Bitrate --> BitRate, OveralBitrate --> OveralBitRate Version 0.4.0.1 2003-08-25 --------------- Bug fixes - .Lib for Visual C++ compilers was forgotten - History and Licence was forgotten - Compiler changed from Borland to Microsoft for size efficiency (help for reducing code in Borland compiler would be appreciated) Version 0.4.0 2003-08-01 ------------- New - Open-Source (GPL) - Matroska partial Support - Better interraction with a FrontEnd Interface Bug fixes - MPEG1 and 2: huge bugfixes: now you can believe what it say:) - Files > 4 GigaBytes (OK for file size, but duration calculation is sometimes NOK) - Quicktime: bad codec in Audio if based of Microsoft 2cc - Quicktime: sometimes don't handle compressed headers - multiple video streams: second streams was not displayed - A lot of other minor bugs... Version 0.3.0 2003-03-03 ------------- New - New engine for having a lot more format available and be able to write in files - MPEG2 support (.MPG and .VOB) - AC3 support - DTS support - DVD Video (IFO files) support Bug fixes - Too much... Version 0.2.1 2003-01-12 ------------- New - MPEG support - WAV support - OGG/OGM duration Bug fixes - Too much... Version 0.2.0 2003-01-05 ------------- New - List of 400+ codecs (audio or video) - Multiple files opening - Multi-language (English / French) - OGG/OGM: Video bitrate, Play time - More tags (OGG/MP3) Version 0.1.1.c, 2002-12-31 --------------- Bug fixes - OGG/OGM, comments: bug if comments were not in the same order than streams - Summary: problems with roundness of audio bitrate (was floor method, now it is a round method) Version 0.1.1.a, 2002-12-30 --------------- Bug fixes - OGG, audio stream except vorbis: the bitrate was in byte in place of bits Version 0.1.1, 2002-12-29 ------------- Bug fixes - MP3: Url tag not well implemented Version 0.1.0, 2002-12-28 ------------- Initial public releaseMediaInfoLib/License.html100777 0 0 7315 12165355571 10747 0 MediaInfo(Lib) License

MediaInfo(Lib) License

Copyright (c) 2002-2013 MediaArea.net SARL. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Third party libraries

The software relies on third party libraries. Such libraries have their own license:

  • C++ standard library: libstdc++, libc++, Visual C++ library or any other C++ standard library.
  • Base classes library: ZenLib, (c) MediaArea.net SARL, zlib license.
  • GUI (optional): Qt.
  • GUI (optional): WxWidgets.
  • XML parser (optional): TinyXML-2.
  • gzip decompression routine (optional): zlib.
  • FTP, FTPS, SFTP, HTTP, HTTPS (optional): libcurl.
  • MMS (optional): libmms.

Contributors

  • Jérôme Martinez (main developper)
  • Lionel Duchateau (odd formats support)
  • XhmikosR from MPC-HC Team (tests)
  • FlylinkDC++ team (tests, crash corrections)
  • Max Pozdeev (former native Mac GUI developper)
MediaInfoLib/Project/ 40777 0 0 0 12264020633 7763 5MediaInfoLib/Project/BCB/ 40777 0 0 0 12264020632 10350 5MediaInfoLib/Project/BCB/Dll/ 40777 0 0 0 12264020632 11063 5MediaInfoLib/Project/BCB/Dll/MediaInfo.cbproj100777 0 0 40121 12226004263 14235 0 {BF6589BF-503E-4D9A-8A54-74FEBFBF46A0} CppDynamicLibrary Release 12.0 true true Base true true Base true ..\..\..\Source\MediaInfo\Multiple\;..\..\..\Source\MediaInfoDLL\;..\..\..\Source\MediaInfoDLL;$(IncludePath) _UNICODE _WIN32;$(TASM_Defines) _UNICODE;_WIN32;$(BRCC_Defines) true vcl.bpi;rtl.bpi;dbrtl.bpi;adortl.bpi;vcldb.bpi;vclx.bpi;bdertl.bpi;vcldbx.bpi;ibxpress.bpi;dsnap.bpi;dsnap.bpi;dsnapcon.bpi;dsnapcon.bpi;bcbsmp.bpi;vclie.bpi;xmlrtl.bpi;inet.bpi;inetdbbde.bpi;inetdbxpress.bpi;inetdb.bpi;webdsnap.bpi;bcbie.bpi;websnap.bpi;soaprtl.bpi;dbexpress.bpi;dbxcds.bpi;indycore.bpi;indysystem.bpi;bcboffice2k.bpi;teeui.bpi;teedb.bpi;tee.bpi;TntLibR.bpi;dss.bpi ..\..\..\Source\MediaInfoDLL;.\;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_UnitSearchPath) ..\..\..\Source\MediaInfoDLL;$(DCC_ResourcePath) Windows -I..\..\..\Source\MediaInfoDLL;..\..\..\Source\Files;..\..\..\Source;..\..\..\..\Shared\Include;$(BDS)\include;$(BDS)\include\vcl;$(BDS)\include\dinkumware $(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\..\..\Source\MediaInfoDLL;..\..\..\Source;..\..\..\..\ZenLib\Source;$(BRCC_IncludePath) true $(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\..\..\Source\MediaInfoDLL;..\..\..\Source;..\..\..\..\ZenLib\Source;$(BCC_IncludePath) ..\..\..\Source\MediaInfoDLL;..\..\..\Source\Files;..\..\..\Source;..\..\..\..\Shared\Include;$(BDS)\include;$(BDS)\include\vcl;$(BDS)\include\dinkumware;$(TASM_IncludePath) ..\..\..\Source\MediaInfoDLL;.\;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_IncludePath) true . dll -M DLL None /w2 ..\..\..\Source\MediaInfoDLL;$(ILINK_ObjectSearchPath) NO_STRICT;UNICODE;_UNICODE;WIN32;_WIN32;$(BCC_Defines) JPHNE true -a4 -Vx -d -Ve true ..\..\..\Source\MediaInfo\Multiple\;..\..\..\..\ZenLib\Project\BCB\Library\Release_Build\;..\Library\Release_Build\;..\..\..\..\zlib\projects\BCB\Release_Build\;..\..\..\Source\MediaInfoDLL\;..\..\..\..\ZenLib\Project\BCB\Library\Release_Build;..\Library\Release_Build;..\..\..\..\zlib\projects\BCB\Release_Build;..\..\..\Source\MediaInfoDLL;$(BDS)\lib\obj;$(BDS)\lib;$(ILINK_LibraryPath) ..\..\..\Source\MediaInfoDLL;$(DCC_ObjPath) _DEBUG;$(BCC_Defines);$(BCC_Defines) -a4 -Vx -d -Ve -k true DEBUG;$(DCC_Define);$(DCC_Define) true Debug_Build true true true Full -M -V true true false NDEBUG;$(BCC_Defines);$(BCC_Defines) Release_Build -M -$O+ -a4 -Vx -d -Ve -r -1 0 4 ..\..\..\Source\MediaInfoDLL\MediaInfoDLL.h 2 5 3 4 0 5 1 6 2 Base Cfg_2 Base Cfg_1 Base CPlusPlusBuilder.Personality.12 CppDynamicLibrary True False 0 7 3 9 False False False False True 1033 1252 http://MediaArea.net/MediaInfo Library for read info about media files 0.7.3.9 MediaInfoLib - BCB6 BSD-2-Clause MediaInfo.dll MediaInfoLib 0.7 21 ..\..\..\Source\MediaInfoDLL;..\..\..\Source\Files;..\..\..\Source;..\..\..\..\Shared\Include;$(BCB)\include;$(BCB)\include\vcl ..\..\..\Source\Files;..\..\..\Source;..\..\..\..\Shared\Include;$(BCB)\include;$(BCB)\include\vcl ..\..\..\Source\Files;$(BCB)\include;$(BCB)\include\vcl;..\..\..\Source;..\..\..\..\Shared\Include ..\..\..\Source\Files;$(BCB)\include;$(BCB)\include\vcl;..\..\..\Source $(BCB)\include;$(BCB)\include\vcl;..\..\..\Source ..\Source\MediaInfo;..\Source;..\..\..\Common\Include;..\..\..\Common\Include\id3;$(BCB)\include;$(BCB)\include\vcl ..\Source;..\..\..\Common\Include;..\..\..\Common\Include\id3;$(BCB)\include;$(BCB)\include\vcl ..\Source\MediaInfo;$(BCB)\include;$(BCB)\include\vcl;..\..\..\Common\Include;..\..\..\Common\Include\id3;..\Source $(BCB)\include;$(BCB)\include\vcl;..\..\..\Common\Include;..\..\..\Common\Include\id3;..\Source ..\Source\MediaInfo;$(BCB)\include;$(BCB)\include\vcl;..\..\..\Common\Include;..\..\..\Common\Include\id3 $(BCB)\include;$(BCB)\include\vcl;..\..\..\Common\Include;..\..\..\Common\Include\id3 ..\Source\MediaInfo;..\Source;D:\Programmation\Common\Include;$(BCB)\include;$(BCB)\include\vcl;D:\Programmation\Common\Include\id3 ..\Source\MediaInfo;..\Source;D:\Programmation\Common\Include;$(BCB)\include;$(BCB)\include\vcl ..\Source;D:\Programmation\Common\Include;$(BCB)\include;$(BCB)\include\vcl ..\Source\MediaInfo;..\Source;$(BCB)\include;$(BCB)\include\vcl;D:\Programmation\Common\Include ..\Source;$(BCB)\include;$(BCB)\include\vcl;D:\Programmation\Common\Include ..\Source\MediaInfo;..\Source\Files;$(BCB)\include;$(BCB)\include\vcl;D:\Programmation\Common\Include ..\Source\Files;$(BCB)\include;$(BCB)\include\vcl;D:\Programmation\Common\Include ..\Source\Files;D:\Programmation\MediaInfo\Source\Files;$(BCB)\include;$(BCB)\include\vcl;D:\Programmation\Common\Include D:\Programmation\MediaInfo\Source\Files;$(BCB)\include;$(BCB)\include\vcl;D:\Programmation\Common\Include D:\Programmation\MediaInfo\Source\Files;$(BCB)\include;$(BCB)\include\vcl 16 ..\..\..\Source\MediaInfoDLL;..\..\..\Source\Files;..\..\..\Release\BCB\Lib;$(BCB)\lib\obj;$(BCB)\lib ..\..\..\Source\Files;..\..\..\Release\BCB\Lib;$(BCB)\lib\obj;$(BCB)\lib ..\..\..\Source\Files;..\..\..\Release\BCD\Lib;$(BCB)\lib\obj;$(BCB)\lib ..\..\..\Release\BCD\Lib;$(BCB)\lib\obj;$(BCB)\lib ..\..\..\Source\Files;$(BCB)\lib\obj;$(BCB)\lib $(BCB)\lib\obj;$(BCB)\lib ..\Source\MediaInfo;$(BCB)\lib\obj;$(BCB)\lib ..\Source\MediaInfo;$(BCB)\lib\obj;$(BCB)\lib;..\..\..\Common\Compiler\Win32_Borland 4 _UNICODE;_WIN32 _WIN32;_UNICODE WIN32;_UNICODE WIN32;_UNICODE;MEDIAINFO_DLL_EXPORT 2 . ..\_Temp 1 ..\..\..\Release\BCB\Dll\ Example.ogg False F:\Programmation\MediaInfoLib\Release\BCB\Dll\MediaInfo.exe False False True False False True True 12 MediaInfoLib/Project/BCB/Dll/MediaInfo.res100777 0 0 3340 12226004263 13531 0   ( @|̻|@|̻|@̻|@w|@{|@|{|@{|@w|33@ǻw̻DD@̻wwwDf@{wDf@www33Df@w̻C@wwwGv@{wwwDf@ww33Df@̻C@̈G|@{wD@www@wDG@{ww@w@<<<<??0MAINICON  T  T4VS_VERSION_INFO  ?StringFileInfo040904E4b!CompanyNamehttp://mediainfo.sourceforge.netx(FileDescriptionLibrary for read info about media files0FileVersion0.7.3.9HInternalNameMediaInfoLib - BCB6.LegalCopyrightLGPL*LegalTrademarksDOriginalFilenameMediaInfo.dll: ProductNameMediaInfoLib,ProductVersion0.7CommentsDVarFileInfo$Translation MediaInfoLib/Project/BCB/Dll/MediaInfo_i386.cbproj100777 0 0 40376 12226004263 15022 0 {BF6589BF-503E-4D9A-8A54-74FEBFBF46A0} CppDynamicLibrary Release 12.0 true true Base true true Base true ..\..\..\Source\MediaInfoDLL\;..\..\..\Source\MediaInfoDLL;$(IncludePath) _UNICODE _WIN32;$(TASM_Defines) _UNICODE;_WIN32;$(BRCC_Defines) true vcl.bpi;rtl.bpi;dbrtl.bpi;adortl.bpi;vcldb.bpi;vclx.bpi;bdertl.bpi;vcldbx.bpi;ibxpress.bpi;dsnap.bpi;dsnap.bpi;dsnapcon.bpi;dsnapcon.bpi;bcbsmp.bpi;vclie.bpi;xmlrtl.bpi;inet.bpi;inetdbbde.bpi;inetdbxpress.bpi;inetdb.bpi;webdsnap.bpi;bcbie.bpi;websnap.bpi;soaprtl.bpi;dbexpress.bpi;dbxcds.bpi;indycore.bpi;indysystem.bpi;bcboffice2k.bpi;teeui.bpi;teedb.bpi;tee.bpi;TntLibR.bpi;dss.bpi ..\..\..\Source\MediaInfoDLL;.\;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_UnitSearchPath) ..\..\..\Source\MediaInfoDLL;$(DCC_ResourcePath) Windows -I..\..\..\Source\MediaInfoDLL;..\..\..\Source\Files;..\..\..\Source;..\..\..\..\Shared\Include;$(BDS)\include;$(BDS)\include\vcl;$(BDS)\include\dinkumware $(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\..\..\Source\MediaInfoDLL;..\..\..\Source;..\..\..\..\ZenLib\Source;..\..\..\..\zlib;$(BRCC_IncludePath) true $(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;..\..\..\Source\MediaInfoDLL;..\..\..\Source;..\..\..\..\ZenLib\Source;..\..\..\..\zlib;$(BCC_IncludePath) ..\..\..\Source\MediaInfoDLL;..\..\..\Source\Files;..\..\..\Source;..\..\..\..\Shared\Include;$(BDS)\include;$(BDS)\include\vcl;$(BDS)\include\dinkumware;$(TASM_IncludePath) ..\..\..\Source\MediaInfoDLL;.\;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_IncludePath) true . dll -M DLL None /w2 ..\..\..\Source\MediaInfoDLL;$(ILINK_ObjectSearchPath) NO_STRICT;UNICODE;_UNICODE;WIN32;_WIN32;$(BCC_Defines) JPHNE true -a4 -Vx -d -Ve true ..\..\..\..\ZenLib\Project\BCB\Library\Release_Build\;..\Library\Release_Build\;..\..\..\..\zlib\projects\BCB\Release_Build\;..\..\..\Source\MediaInfoDLL\;..\..\..\..\ZenLib\Project\BCB\Library\Release_Build;..\Library\Release_Build;..\..\..\..\zlib\projects\BCB\Release_Build;..\..\..\Source\MediaInfoDLL;$(BDS)\lib\obj;$(BDS)\lib;$(ILINK_LibraryPath) ..\..\..\Source\MediaInfoDLL;$(DCC_ObjPath) _DEBUG;$(BCC_Defines);$(BCC_Defines) -a4 -Vx -d -Ve -k $(BDS)\lib\debug;$(ILINK_LibraryPath);$(ILINK_LibraryPath) DEBUG;$(DCC_Define);$(DCC_Define) true Debug_Build true true true true Full -M -V true true false NDEBUG;$(BCC_Defines);$(BCC_Defines) Release_Build -a4 -Vx -d -Ve -r -M -$O+ $(BDS)\lib\release;$(ILINK_LibraryPath);$(ILINK_LibraryPath) 4 0 5 1 6 2 -1 0 4 ..\..\..\Source\MediaInfoDLL\MediaInfoDLL.h 2 5 3 Base Cfg_2 Base Cfg_1 Base CPlusPlusBuilder.Personality.12 CppDynamicLibrary True False 0 7 3 9 False False False False True 1033 1252 http://MediaArea.net/MediaInfo Library for read info about media files 0.7.3.9 MediaInfoLib - BCB6 BSD-2-Clause MediaInfo.dll MediaInfoLib 0.7 21 ..\..\..\Source\MediaInfoDLL;..\..\..\Source\Files;..\..\..\Source;..\..\..\..\Shared\Include;$(BCB)\include;$(BCB)\include\vcl ..\..\..\Source\Files;..\..\..\Source;..\..\..\..\Shared\Include;$(BCB)\include;$(BCB)\include\vcl ..\..\..\Source\Files;$(BCB)\include;$(BCB)\include\vcl;..\..\..\Source;..\..\..\..\Shared\Include ..\..\..\Source\Files;$(BCB)\include;$(BCB)\include\vcl;..\..\..\Source $(BCB)\include;$(BCB)\include\vcl;..\..\..\Source ..\Source\MediaInfo;..\Source;..\..\..\Common\Include;..\..\..\Common\Include\id3;$(BCB)\include;$(BCB)\include\vcl ..\Source;..\..\..\Common\Include;..\..\..\Common\Include\id3;$(BCB)\include;$(BCB)\include\vcl ..\Source\MediaInfo;$(BCB)\include;$(BCB)\include\vcl;..\..\..\Common\Include;..\..\..\Common\Include\id3;..\Source $(BCB)\include;$(BCB)\include\vcl;..\..\..\Common\Include;..\..\..\Common\Include\id3;..\Source ..\Source\MediaInfo;$(BCB)\include;$(BCB)\include\vcl;..\..\..\Common\Include;..\..\..\Common\Include\id3 $(BCB)\include;$(BCB)\include\vcl;..\..\..\Common\Include;..\..\..\Common\Include\id3 ..\Source\MediaInfo;..\Source;D:\Programmation\Common\Include;$(BCB)\include;$(BCB)\include\vcl;D:\Programmation\Common\Include\id3 ..\Source\MediaInfo;..\Source;D:\Programmation\Common\Include;$(BCB)\include;$(BCB)\include\vcl ..\Source;D:\Programmation\Common\Include;$(BCB)\include;$(BCB)\include\vcl ..\Source\MediaInfo;..\Source;$(BCB)\include;$(BCB)\include\vcl;D:\Programmation\Common\Include ..\Source;$(BCB)\include;$(BCB)\include\vcl;D:\Programmation\Common\Include ..\Source\MediaInfo;..\Source\Files;$(BCB)\include;$(BCB)\include\vcl;D:\Programmation\Common\Include ..\Source\Files;$(BCB)\include;$(BCB)\include\vcl;D:\Programmation\Common\Include ..\Source\Files;D:\Programmation\MediaInfo\Source\Files;$(BCB)\include;$(BCB)\include\vcl;D:\Programmation\Common\Include D:\Programmation\MediaInfo\Source\Files;$(BCB)\include;$(BCB)\include\vcl;D:\Programmation\Common\Include D:\Programmation\MediaInfo\Source\Files;$(BCB)\include;$(BCB)\include\vcl 16 ..\..\..\Source\MediaInfoDLL;..\..\..\Source\Files;..\..\..\Release\BCB\Lib;$(BCB)\lib\obj;$(BCB)\lib ..\..\..\Source\Files;..\..\..\Release\BCB\Lib;$(BCB)\lib\obj;$(BCB)\lib ..\..\..\Source\Files;..\..\..\Release\BCD\Lib;$(BCB)\lib\obj;$(BCB)\lib ..\..\..\Release\BCD\Lib;$(BCB)\lib\obj;$(BCB)\lib ..\..\..\Source\Files;$(BCB)\lib\obj;$(BCB)\lib $(BCB)\lib\obj;$(BCB)\lib ..\Source\MediaInfo;$(BCB)\lib\obj;$(BCB)\lib ..\Source\MediaInfo;$(BCB)\lib\obj;$(BCB)\lib;..\..\..\Common\Compiler\Win32_Borland 4 _UNICODE;_WIN32 _WIN32;_UNICODE WIN32;_UNICODE WIN32;_UNICODE;MEDIAINFO_DLL_EXPORT 2 . ..\_Temp 1 ..\..\..\Release\BCB\Dll\ Example.ogg False F:\Programmation\MediaInfoLib\Release\BCB\Dll\MediaInfo.exe False False True False False True True 12 MediaInfoLib/Project/BCB/Dll/MediaInfo_i386.res100777 0 0 3340 12226004263 14302 0   ( @|̻|@|̻|@̻|@w|@{|@|{|@{|@w|33@ǻw̻DD@̻wwwDf@{wDf@www33Df@w̻C@wwwGv@{wwwDf@ww33Df@̻C@̈G|@{wD@www@wDG@{ww@w@<<<<??0MAINICON  T  T4VS_VERSION_INFO  ?StringFileInfo040904E4b!CompanyNamehttp://mediainfo.sourceforge.netx(FileDescriptionLibrary for read info about media files0FileVersion0.7.3.9HInternalNameMediaInfoLib - BCB6.LegalCopyrightLGPL*LegalTrademarksDOriginalFilenameMediaInfo.dll: ProductNameMediaInfoLib,ProductVersion0.7CommentsDVarFileInfo$Translation MediaInfoLib/Project/BCB/Example/ 40777 0 0 0 12264020632 11743 5MediaInfoLib/Project/BCB/Example/HowToUse_CLI.res100777 0 0 10454 12226004263 15006 0   ( @ <<<<??0MAINICON   MediaInfoLib/Project/BCB/Library/ 40777 0 0 0 12264020632 11754 5MediaInfoLib/Project/BCB/Library/MediaInfoLib.cbproj100777 0 0 113667 12253650016 15620 0 {0F080AA7-24F8-4F98-B3C8-A3D80DBA6E96} CppStaticLibrary Release 12.0 true true Base true true Base true D:\PROGRA~1\ME926E~1\Source\MEDIAI~2\Multiple\;..\..\..\Source\ThirdParty\md5\;..\..\..\Source\ThirdParty\tinyxml2\;..\..\..\Source\ThirdParty\base64\;..\..\..\Source\;..\..\..\Source\MediaInfo\Video\;..\..\..\Source\MediaInfo\Image\;..\..\..\Source\MediaInfo\Audio\;..\..\..\Source\MediaInfo\Text\;..\..\..\Source\MediaInfo\Tag\;..\..\..\Source\MediaInfo\Duplicate\;..\..\..\Source\MediaInfo\;..\..\..\Source\MediaInfo\Multiple\;..\..\..\Source\MediaInfo\Archive\;..\..\..\Source\MediaInfo\Reader\;..\..\..\Source\MediaInfo\Export\;..\..\..\Source\MediaInfo\Export;..\..\..\Source\MediaInfo\Reader;..\..\..\Source\MediaInfo\Audio;..\..\..\Source\MediaInfo\Video;..\..\..\Source\MediaInfo\Image;..\..\..\Source\MediaInfo\Text;..\..\..\Source\MediaInfo\Tag;..\..\..\Source\MediaInfo\Duplicate;..\..\..\Source\MediaInfo;..\..\..\Source\MediaInfo\Multiple;..\..\..\Source\MediaInfo\Archive;$(IncludePath) _RTLDLL;NO_STRICT;WIN32;_WIN32;UNICODE;_UNICODE;$(BRCC_Defines) vcl.bpi;rtl.bpi;vclx.bpi;xmlrtl.bpi;vclie.bpi;inet.bpi;inetdbbde.bpi;inetdbxpress.bpi;soaprtl.bpi;dbrtl.bpi;dsnap.bpi;bcbie.bpi;vcldb.bpi;websnap.bpi;webdsnap.bpi;vclactnband.bpi _RTLDLL;NO_STRICT;WIN32;_WIN32;UNICODE;_UNICODE;$(TASM_Defines) ..\..\..\Source\MediaInfo\Duplicate;..\..\..\Source\MediaInfo\Tag;..\..\..\..\ZenLib\Source\ZenLib;..\..\..\Source\MediaInfo\Video;..\..\..\Source\MediaInfo\Text;..\..\..\Source\MediaInfo\Multiple;..\..\..\Source\MediaInfo\Image;..\..\..\Source\MediaInfo\Audio;..\..\..\Source\MediaInfo\Archive;..\..\..\Source\MediaInfo;E:\Programmation\MediaInfoLib\Project\BCB\Library;C:\Documents and Settings\Jerome\Mes documents\Borland Studio Projects;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_UnitSearchPath) ..\..\..\Source\MediaInfo\Duplicate;..\..\..\Source\MediaInfo\Tag;..\..\..\..\ZenLib\Source\ZenLib;..\..\..\Source\MediaInfo\Video;..\..\..\Source\MediaInfo\Text;..\..\..\Source\MediaInfo\Multiple;..\..\..\Source\MediaInfo\Image;..\..\..\Source\MediaInfo\Audio;..\..\..\Source\MediaInfo\Archive;..\..\..\Source\MediaInfo;E:\Programmation\MediaInfoLib\Project\BCB\Library;$(DCC_ResourcePath) ..\..\..\Source\MediaInfo\Duplicate;..\..\..\Source\MediaInfo\Tag;..\..\..\..\ZenLib\Source\ZenLib;..\..\..\Source\MediaInfo\Video;..\..\..\Source\MediaInfo\Text;..\..\..\Source\MediaInfo\Multiple;..\..\..\Source\MediaInfo\Image;..\..\..\Source\MediaInfo\Audio;..\..\..\Source\MediaInfo\Archive;..\..\..\Source\MediaInfo;..\..\..\Source;..\..\..\..\ZenLib\Source;..\..\..\..\zlib;$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;$(BCC_IncludePath) ..\..\..\Source\MediaInfo\Duplicate;..\..\..\Source\MediaInfo\Tag;..\..\..\..\ZenLib\Source\ZenLib;..\..\..\Source\MediaInfo\Video;..\..\..\Source\MediaInfo\Text;..\..\..\Source\MediaInfo\Multiple;..\..\..\Source\MediaInfo\Image;..\..\..\Source\MediaInfo\Audio;..\..\..\Source\MediaInfo\Archive;..\..\..\Source\MediaInfo;..\..\..\Source;..\..\..\..\ZenLib\Source;..\..\..\..\zlib;$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;$(BRCC_IncludePath) ..\..\..\Source\MediaInfo\Duplicate;..\..\..\Source\MediaInfo\Tag;..\..\..\..\ZenLib\Source\ZenLib;..\..\..\Source\MediaInfo\Video;..\..\..\Source\MediaInfo\Text;..\..\..\Source\MediaInfo\Multiple;..\..\..\Source\MediaInfo\Image;..\..\..\Source\MediaInfo\Audio;..\..\..\Source\MediaInfo\Archive;..\..\..\Source\MediaInfo;E:\Programmation\MediaInfoLib\Project\BCB\Library;C:\Documents and Settings\Jerome\Mes documents\Borland Studio Projects;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_IncludePath) true ..\..\..\Source\MediaInfo\Duplicate;..\..\..\Source\MediaInfo\Tag;..\..\..\..\ZenLib\Source\ZenLib;..\..\..\Source\MediaInfo\Video;..\..\..\Source\MediaInfo\Text;..\..\..\Source\MediaInfo\Multiple;..\..\..\Source\MediaInfo\Image;..\..\..\Source\MediaInfo\Audio;..\..\..\Source\MediaInfo\Archive;..\..\..\Source\MediaInfo;..\..\..\Source;..\..\..\..\ZenLib\Source;..\..\..\..\zlib;$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;$(TASM_IncludePath) JPHNE lib true true rtl.lib;vcl.lib true 64 _RTLDLL;NO_STRICT;WIN32;_WIN32;UNICODE;_UNICODE;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;$(BCC_Defines) -tWM $(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;$(ILINK_LibraryPath) ..\..\..\Source\MediaInfo\Duplicate;..\..\..\Source\MediaInfo\Tag;..\..\..\..\ZenLib\Source\ZenLib;..\..\..\Source\MediaInfo\Video;..\..\..\Source\MediaInfo\Text;..\..\..\Source\MediaInfo\Multiple;..\..\..\Source\MediaInfo\Image;..\..\..\Source\MediaInfo\Audio;..\..\..\Source\MediaInfo\Archive;..\..\..\Source\MediaInfo;E:\Programmation\MediaInfoLib\Project\BCB\Library;$(DCC_ObjPath) 1024 _DEBUG;$(BCC_Defines);$(BCC_Defines) $(BDS)\lib\debug;$(ILINK_LibraryPath);$(ILINK_LibraryPath) -tWM -k Debug_Build true DEBUG;$(DCC_Define);$(DCC_Define) true true -V Full true true true false true NDEBUG;__MT__;_MT;__MFC_COMPAT__;$(BCC_Defines);$(BCC_Defines) 1024 true Release_Build -$O+ None -tWM -r $(BDS)\lib\release;$(ILINK_LibraryPath);$(ILINK_LibraryPath) 178 178 178 178 178 178 177 176 176 178 178 178 178 178 178 180 178 178 178 178 178 178 178 178 173 117 111 173 133 169 ..\..\..\Source\MediaInfo\Multiple\File__ReferenceFilesHelper.h 160 158 158 109 61 21 146 153 173 173 176 176 175 168 173 178 174 173 173 183 182 182 183 183 183 182 182 182 182 182 182 189 188 186 192 191 190 183 183 183 185 184 184 181 181 179 135 181 181 178 178 178 178 180 178 181 178 181 182 182 181 181 181 181 181 181 181 160 ..\..\..\Source\MediaInfo\Reader\Reader_Directory.h 122 ..\..\..\Source\MediaInfo\Reader\Reader_libmms.h 125 76 6 172 162 154 80 2 79 1 114 83 13 84 10 42 112 44 ..\..\..\Source\MediaInfo\MediaInfo_Internal.h 103 43 113 ..\..\..\Source\MediaInfo\Reader\Reader_File.h 123 144 110 146 155 158 174 39 ..\..\..\Source\MediaInfo\MediaInfo_Config.h 117 167 ..\..\..\Source\MediaInfo\Export\Export_reVTMD.h 168 ..\..\..\Source\MediaInfo\Reader\Reader_libcurl.h 124 37 115 32 110 82 12 38 ..\..\..\Source\MediaInfo\MediaInfo.h 116 76 6 9 87 41 ..\..\..\Source\MediaInfo\MediaInfo_Config_MediaInfo.h 111 40 114 115 113 77 3 85 7 80 2 93 ..\..\..\Source\MediaInfo\MediaInfoList.h 45 147 -1 1 35 105 81 11 117 116 77 3 64 16 78 0 65 17 114 121 134 159 129 124 136 116 119 74 4 113 33 ..\..\..\Source\MediaInfo\File__Duplicate.h 107 69 ..\..\..\Source\MediaInfo\Duplicate\File__Duplicate__Writer.h 25 ..\..\..\Source\MediaInfo\Export\Export_Mpeg7.h 126 157 72 ..\..\..\Source\MediaInfo\Duplicate\File__Duplicate__Base.h 24 137 131 132 107 -1 0 130 63 15 138 75 5 59 19 125 126 36 106 112 34 104 60 20 140 94 ..\..\..\Source\MediaInfo\MediaInfoList_Internal.h 46 66 ..\..\..\Source\MediaInfo\Duplicate\File__Duplicate_MpegTs.h 26 127 128 106 120 62 18 123 187 108 122 ..\..\..\Source\MediaInfo\Export\Export_PBCore.h 127 118 115 193 Base Cfg_2 Base Cfg_1 Base CPlusPlusBuilder.Personality.12 CppStaticLibrary False False 1 0 0 0 False False False False False 1036 1252 1.0.0.0 1.0.0.0 False False False True False False True True 12 MediaInfoLib/Project/BCB/Library/MediaInfoLib.cpp100777 0 0 321 12226004263 15016 0//--------------------------------------------------------------------------- #include #pragma hdrstop #define Library // To add a file to the library use the Project menu 'Add to Project'. MediaInfoLib/Project/BCB/MediaInfoLib.groupproj100777 0 0 5073 12226004263 14710 0 {BFAD3C55-12F9-4ED4-85C0-E9EE1021140C} Default.Personality.12 MediaInfoLib/Project/BCB/PreRelease/ 40777 0 0 0 12264020632 12377 5MediaInfoLib/Project/BCB/PreRelease/PreRelease.cbproj100777 0 0 27137 12226004263 15761 0 {B8042DDC-228C-4584-8D01-4148C1B0BEFB} CppVCLApplication PreRelease.cpp Debug 12.0 true true Base true true Base true rtl.lib;vcl.lib ..\..\..\Source\PreRelease\VCL\;..\..\..\Source\PreRelease\;..\..\..\..\ZenLib\Source\ZenLib\;..\..\..\Source\PreRelease\VCL;..\..\..\Source\PreRelease;..\..\..\..\ZenLib\Source\ZenLib;..\..\..\..\wx\include;..\..\..\..\wx\lib\bcc_lib\;..\..\..\..\wx\lib\bcc_lib\msu;..\..\..\..\wx\lib\bcc_lib\mswu;$(IncludePath) _RTLDLL;USEPACKAGES;NO_STRICT;UNICODE;$(TASM_Defines) _RTLDLL;USEPACKAGES;NO_STRICT;UNICODE;$(BRCC_Defines) vcl.bpi;rtl.bpi;vclx.bpi;xmlrtl.bpi;vclie.bpi;inet.bpi;inetdbbde.bpi;inetdbxpress.bpi;soaprtl.bpi;dbrtl.bpi;dsnap.bpi;bcbie.bpi;vcldb.bpi;websnap.bpi;webdsnap.bpi;vclactnband.bpi ..\..\..\..\ZenLib\Source\ZenLib;..\..\..\Source\PreRelease\VCL;..\..\..\Source\PreRelease\WxWidgets;..\..\..\Source\PreRelease;E:\Programmation\MediaInfoLib\Project\BCB\PreRelease;C:\Documents and Settings\Jerome\Mes documents\Borland Studio Projects;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_UnitSearchPath) ..\..\..\..\ZenLib\Source\ZenLib;..\..\..\Source\PreRelease\VCL;..\..\..\Source\PreRelease\WxWidgets;..\..\..\Source\PreRelease;E:\Programmation\MediaInfoLib\Project\BCB\PreRelease;$(DCC_ResourcePath) Windows ..\..\..\..\ZenLib\Source\ZenLib;..\..\..\Source\PreRelease\VCL;..\..\..\Source\PreRelease\WxWidgets;..\..\..\Source\PreRelease;E:\Programmation\MediaInfoLib\Project\BCB\PreRelease;C:\Documents and Settings\Jerome\Mes documents\Borland Studio Projects;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_IncludePath) ..\..\..\..\ZenLib\Source\ZenLib;..\..\..\Source\PreRelease\VCL;..\..\..\Source\PreRelease;..\..\..\Source\PreRelease\WxWidgets;..\..\..\Source;..\..\..\..\ZenLib\Source;..\..\..\..\wxMSW\lib\bcc_lib\mswud;..\..\..\..\wxMSW\include;$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;$(BCC_IncludePath) ..\..\..\..\ZenLib\Source\ZenLib;..\..\..\Source\PreRelease\VCL;..\..\..\Source\PreRelease;..\..\..\Source\PreRelease\WxWidgets;..\..\..\Source;..\..\..\..\ZenLib\Source;..\..\..\..\wxMSW\lib\bcc_lib\mswud;..\..\..\..\wxMSW\include;$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;$(BRCC_IncludePath) true ..\..\..\..\ZenLib\Source\ZenLib;..\..\..\Source\PreRelease\VCL;..\..\..\Source\PreRelease;..\..\..\Source\PreRelease\WxWidgets;..\..\..\Source;..\..\..\..\ZenLib\Source;..\..\..\..\wxMSW\lib\bcc_lib\mswud;..\..\..\..\wxMSW\include;$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;$(TASM_IncludePath) ..\..\..\release true exe ..\..\..\..\ZenLib\Source\ZenLib;..\..\..\Source\PreRelease\VCL;..\..\..\Source\PreRelease\WxWidgets;..\..\..\Source\PreRelease;E:\Programmation\MediaInfoLib\Project\BCB\PreRelease;$(ILINK_ObjectSearchPath) rtl.lib;vcl.lib true ..\..\..\..\ZenLib\Source\ZenLib;..\..\..\Source\PreRelease\VCL;..\..\..\Source\PreRelease\WxWidgets;..\..\..\Source\PreRelease;E:\Programmation\MediaInfoLib\Project\BCB\PreRelease;$(DCC_ObjPath) NO_STRICT;UNICODE;$(BCC_Defines) JPHNE true ..\..\..\..\ZenLib\Project\BCB\Library\Release_Build\;..\..\..\Source\PreRelease\VCL\;..\..\..\Source\PreRelease\;..\..\..\..\zlib\projects\BCB\Release_Build\;..\..\..\..\ZenLib\Source\ZenLib\;..\..\..\..\wx\lib\bcc_lib\;..\..\..\..\ZenLib\Project\BCB\Library\Release_Build;..\..\..\..\zlib\projects\BCB\Release_Build;..\..\..\..\ZenLib\Source\ZenLib;..\..\..\Source\PreRelease\VCL;..\..\..\Source\PreRelease\WxWidgets;..\..\..\Source\PreRelease;E:\Programmation\MediaInfoLib\Project\BCB\PreRelease;$(BDS)\lib\obj;..\..\..\..\zlib\projects\BCB\Debug_Build\;$(ILINK_LibraryPath) _DEBUG;$(BCC_Defines);$(BCC_Defines) -k $(BDS)\lib\debug;$(ILINK_LibraryPath);$(ILINK_LibraryPath) DEBUG;$(DCC_Define);$(DCC_Define) true Debug_Build true true true true Full -V true true false NDEBUG;$(BCC_Defines);$(BCC_Defines) Release_Build true -r None -$O+ $(BDS)\lib\release;$(ILINK_LibraryPath);$(ILINK_LibraryPath) -1 0 -1 1 8
Form1
..\..\..\Source\PreRelease\VCL\PreRelease_.h 2
9 4 5 6 1 7 0 8 2 9 4 3 10 10 Base Cfg_2 Base Cfg_1 Base
CPlusPlusBuilder.Personality.12 CppVCLApplication False False 1 0 0 0 False False False False False 1036 1252 1.0.0.0 1.0.0.0 False False False True False PreRelease.cpp False True True 12
MediaInfoLib/Project/BCB/PreRelease/PreRelease.cpp100777 0 0 1702 12226004263 15232 0//--------------------------------------------------------------------------- #include #pragma hdrstop //--------------------------------------------------------------------------- USEFORM("..\..\..\Source\PreRelease\VCL\PreRelease_.cpp", Form1); //--------------------------------------------------------------------------- WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { try { Application->Initialize(); Application->CreateForm(__classid(TForm1), &Form1); Application->Run(); } catch (Exception &exception) { Application->ShowException(&exception); } catch (...) { try { throw Exception(""); } catch (Exception &exception) { Application->ShowException(&exception); } } return 0; } //--------------------------------------------------------------------------- MediaInfoLib/Project/BCB/PreRelease/PreRelease.res100777 0 0 10454 12226004263 15265 0   ( @ <<<<??0MAINICON   MediaInfoLib/Project/CMake/ 40777 0 0 0 12264020632 10742 5MediaInfoLib/Project/CMake/CMakeLists.txt100777 0 0 16521 12262536052 13635 0project(mediainfo) set(MEDIAINFO_MAJOR_VERSION 0) set(MEDIAINFO_MINOR_VERSION 7) set(MEDIAINFO_PATCH_VERSION 53) set(MEDIAINFO_VERSION ${MEDIAINFO_MAJOR_VERSION}.${MEDIAINFO_MINOR_VERSION}.${MEDIAINFO_PATCH_VERSION}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../) include_directories(${ZLIB_INCLUDE_DIR}) add_definitions(-DUNICODE) set(mediainfo_SRCS ThirdParty/tinyxml2/tinyxml2.cpp ThirdParty/md5/md5.c MediaInfo/File__Analyze.cpp MediaInfo/File__Analyze_Buffer.cpp MediaInfo/File__Analyze_Buffer_MinimizeSize.cpp MediaInfo/File__Analyze_Streams.cpp MediaInfo/File__Analyze_Streams_Finish.cpp MediaInfo/File__Base.cpp MediaInfo/File__MultipleParsing.cpp MediaInfo/File__Duplicate.cpp MediaInfo/File_Dummy.cpp MediaInfo/File_Other.cpp MediaInfo/File_Unknown.cpp MediaInfo/MediaInfo.cpp MediaInfo/MediaInfo_Config.cpp MediaInfo/MediaInfo_Config_Automatic.cpp MediaInfo/MediaInfo_Config_MediaInfo.cpp MediaInfo/MediaInfo_File.cpp MediaInfo/MediaInfo_Inform.cpp MediaInfo/MediaInfo_Internal.cpp MediaInfo/MediaInfoList.cpp MediaInfo/MediaInfoList_Internal.cpp MediaInfo/TimeCode.cpp MediaInfo/Archive/File_7z.cpp MediaInfo/Archive/File_Ace.cpp MediaInfo/Archive/File_Bzip2.cpp MediaInfo/Archive/File_Elf.cpp MediaInfo/Archive/File_Gzip.cpp MediaInfo/Archive/File_Iso9660.cpp MediaInfo/Archive/File_Mz.cpp MediaInfo/Archive/File_Rar.cpp MediaInfo/Archive/File_Tar.cpp MediaInfo/Archive/File_Zip.cpp MediaInfo/Audio/File_Aac.cpp MediaInfo/Audio/File_Aac_GeneralAudio.cpp MediaInfo/Audio/File_Aac_GeneralAudio_Sbr.cpp MediaInfo/Audio/File_Aac_GeneralAudio_Sbr_Ps.cpp MediaInfo/Audio/File_Aac_Main.cpp MediaInfo/Audio/File_Aac_Others.cpp MediaInfo/Audio/File_Ac3.cpp MediaInfo/Audio/File_Adpcm.cpp MediaInfo/Audio/File_Aes3.cpp MediaInfo/Audio/File_Als.cpp MediaInfo/Audio/File_Amr.cpp MediaInfo/Audio/File_Amv.cpp MediaInfo/Audio/File_Ape.cpp MediaInfo/Audio/File_Au.cpp MediaInfo/Audio/File_Celt.cpp MediaInfo/Audio/File_ChannelGrouping.cpp MediaInfo/Audio/File_Dts.cpp MediaInfo/Audio/File_DolbyE.cpp MediaInfo/Audio/File_ExtendedModule.cpp MediaInfo/Audio/File_Flac.cpp MediaInfo/Audio/File_ImpulseTracker.cpp MediaInfo/Audio/File_La.cpp MediaInfo/Audio/File_Midi.cpp MediaInfo/Audio/File_Module.cpp MediaInfo/Audio/File_Mpc.cpp MediaInfo/Audio/File_MpcSv8.cpp MediaInfo/Audio/File_Mpega.cpp MediaInfo/Audio/File_Opus.cpp MediaInfo/Audio/File_Pcm.cpp MediaInfo/Audio/File_Ps2Audio.cpp MediaInfo/Audio/File_Rkau.cpp MediaInfo/Audio/File_ScreamTracker3.cpp MediaInfo/Audio/File_Speex.cpp MediaInfo/Audio/File_Tak.cpp MediaInfo/Audio/File_Tta.cpp MediaInfo/Audio/File_TwinVQ.cpp MediaInfo/Audio/File_Vorbis.cpp MediaInfo/Audio/File_Wvpk.cpp MediaInfo/Duplicate/File__Duplicate__Base.cpp MediaInfo/Duplicate/File__Duplicate__Writer.cpp MediaInfo/Duplicate/File__Duplicate_MpegTs.cpp MediaInfo/Export/Export_EbuCore.cpp MediaInfo/Export/Export_Mpeg7.cpp MediaInfo/Export/Export_PBCore.cpp MediaInfo/Export/Export_reVTMD.cpp MediaInfo/Image/File_Bmp.cpp MediaInfo/Image/File_Dpx.cpp MediaInfo/Image/File_Exr.cpp MediaInfo/Image/File_Gif.cpp MediaInfo/Image/File_Ico.cpp MediaInfo/Image/File_Jpeg.cpp MediaInfo/Image/File_Pcx.cpp MediaInfo/Image/File_Png.cpp MediaInfo/Image/File_Psd.cpp MediaInfo/Image/File_Rle.cpp MediaInfo/Image/File_Tiff.cpp MediaInfo/Image/File_Tga.cpp MediaInfo/Multiple/File__ReferenceFilesHelper.cpp MediaInfo/Multiple/File_Aaf.cpp MediaInfo/Multiple/File_Ancillary.cpp MediaInfo/Multiple/File_Bdav.cpp MediaInfo/Multiple/File_Cdxa.cpp MediaInfo/Multiple/File_DashMpd.cpp MediaInfo/Multiple/File_DcpAm.cpp MediaInfo/Multiple/File_DcpCpl.cpp MediaInfo/Multiple/File_DcpPkl.cpp MediaInfo/Multiple/File_Dpg.cpp MediaInfo/Multiple/File_DvDif.cpp MediaInfo/Multiple/File_DvDif_Analysis.cpp MediaInfo/Multiple/File_Dvdv.cpp MediaInfo/Multiple/File_Dxw.cpp MediaInfo/Multiple/File_Flv.cpp MediaInfo/Multiple/File_Gxf.cpp MediaInfo/Multiple/File_HdsF4m.cpp MediaInfo/Multiple/File_Hls.cpp MediaInfo/Multiple/File_Gxf.cpp MediaInfo/Multiple/File_Gxf_TimeCode.cpp MediaInfo/Multiple/File_Ibi.cpp MediaInfo/Multiple/File_Ibi_Create.cpp MediaInfo/Multiple/File_Ism.cpp MediaInfo/Multiple/File_Ivf.cpp MediaInfo/Multiple/File_Lxf.cpp MediaInfo/Multiple/File_Mk.cpp MediaInfo/Multiple/File_Mpeg4.cpp MediaInfo/Multiple/File_Mpeg4_Descriptors.cpp MediaInfo/Multiple/File_Mpeg4_Elements.cpp MediaInfo/Multiple/File_Mpeg4_TimeCode.cpp MediaInfo/Multiple/File_Mpeg_Descriptors.cpp MediaInfo/Multiple/File_Mpeg_Psi.cpp MediaInfo/Multiple/File_MpegPs.cpp MediaInfo/Multiple/File_MpegTs.cpp MediaInfo/Multiple/File_MpegTs_Duplicate.cpp MediaInfo/Multiple/File_Mxf.cpp MediaInfo/Multiple/File_Nut.cpp MediaInfo/Multiple/File_Ogg.cpp MediaInfo/Multiple/File_Ogg_SubElement.cpp MediaInfo/Multiple/File_P2_Clip.cpp MediaInfo/Multiple/File_Pmp.cpp MediaInfo/Multiple/File_Ptx.cpp MediaInfo/Multiple/File_Riff.cpp MediaInfo/Multiple/File_Riff_Elements.cpp MediaInfo/Multiple/File_Rm.cpp MediaInfo/Multiple/File_SequenceInfo.cpp MediaInfo/Multiple/File_Skm.cpp MediaInfo/Multiple/File_Swf.cpp MediaInfo/Multiple/File_Umf.cpp MediaInfo/Multiple/File_Wm.cpp MediaInfo/Multiple/File_Wm_Elements.cpp MediaInfo/Multiple/File_Xdcam_Clip.cpp MediaInfo/Reader/Reader_Directory.cpp \ MediaInfo/Reader/Reader_File.cpp \ MediaInfo/Reader/Reader_libcurl.cpp \ MediaInfo/Reader/Reader_libmms.cpp \ MediaInfo/Tag/File__Tags.cpp MediaInfo/Tag/File_ApeTag.cpp MediaInfo/Tag/File_Id3.cpp MediaInfo/Tag/File_Id3v2.cpp MediaInfo/Tag/File_Lyrics3.cpp MediaInfo/Tag/File_Lyrics3v2.cpp MediaInfo/Tag/File_VorbisCom.cpp MediaInfo/Text/File_Cdp.cpp MediaInfo/Text/File_Cmml.cpp MediaInfo/Text/File_DvbSubtitle.cpp MediaInfo/Text/File_DtvccTransport.cpp MediaInfo/Text/File_Eia608.cpp MediaInfo/Text/File_Eia708.cpp MediaInfo/Text/File_Kate.cpp MediaInfo/Text/File_N19.cpp MediaInfo/Text/File_OtherText.cpp MediaInfo/Text/File_Pgs.cpp MediaInfo/Text/File_Scc.cpp MediaInfo/Text/File_Scte20.cpp MediaInfo/Text/File_SubRip.cpp MediaInfo/Text/File_Teletext.cpp MediaInfo/Text/File_TimedText.cpp MediaInfo/Text/File_Ttml.cpp MediaInfo/Video/File_Aic.cpp MediaInfo/Video/File_AfdBarData.cpp MediaInfo/Video/File_Avc.cpp MediaInfo/Video/File_Avc_Duplicate.cpp MediaInfo/Video/File_AvsV.cpp MediaInfo/Video/File_Canopus.cpp MediaInfo/Video/File_Dirac.cpp MediaInfo/Video/File_Flic.cpp MediaInfo/Video/File_Fraps.cpp MediaInfo/Video/File_H263.cpp MediaInfo/Video/File_Lagarith.cpp MediaInfo/Video/File_Mpeg4v.cpp MediaInfo/Video/File_Mpegv.cpp MediaInfo/Video/File_ProRes.cpp MediaInfo/Video/File_Theora.cpp MediaInfo/Video/File_Vc1.cpp MediaInfo/Video/File_Vc3.cpp MediaInfo/Video/File_Vp8.cpp MediaInfo/Video/File_Y4m.cpp MediaInfoDLL/MediaInfoDLL.cpp MediaInfoDLL/MediaInfoDLL.def ) if (WIN32) #FIXME MediaInfo.rc should use ${MEDIAINFO_MAJOR_VERSION} and friends list(APPEND mediainfo_SRCS MediaInfo.rc ) endif (WIN32) add_library(mediainfo SHARED ${mediainfo_SRCS}) target_link_libraries(mediainfo zenlib ${ZLIB_LIBRARY} ) set_target_properties(mediainfo PROPERTIES VERSION ${MEDIAINFO_VERSION} SOVERSION ${MEDIAINFO_MAJOR_VERSION} ) install(TARGETS mediainfo DESTINATION ${INSTALL_TARGETS_DEFAULT_ARGS})MediaInfoLib/Project/CodeBlocks/ 40777 0 0 0 12226004263 11772 5MediaInfoLib/Project/CodeBlocks/Dll/ 40777 0 0 0 12226004263 12505 5MediaInfoLib/Project/CodeBlocks/Dll/MediaInfo.cbp100777 0 0 4121 12226004263 15124 0 MediaInfoLib/Project/CodeBlocks/Example/ 40777 0 0 0 12226004263 13365 5MediaInfoLib/Project/CodeBlocks/Example/HowToUse_CLI.cbp100777 0 0 1565 12226004263 16366 0 MediaInfoLib/Project/CodeBlocks/Library/ 40777 0 0 0 12226004263 13376 5MediaInfoLib/Project/CodeBlocks/Library/MediaInfoLib.cbp100777 0 0 25475 12226004263 16503 0 MediaInfoLib/Project/CodeBlocks/MediaInfoLib.workspace100777 0 0 557 12226004263 16263 0 MediaInfoLib/Project/CodeBlocks/PreRelease/ 40777 0 0 0 12226004263 14021 5MediaInfoLib/Project/CodeBlocks/PreRelease/PreRelease.cbp100777 0 0 6005 12226004263 16637 0 MediaInfoLib/Project/Delphi/ 40777 0 0 0 12226004263 11167 5MediaInfoLib/Project/Delphi/Example/ 40777 0 0 0 12264020632 12562 5MediaInfoLib/Project/Delphi/Example/HowToUse_Dll.bdsproj100777 0 0 16652 12226004263 16611 0 HowToUse_Dll.dpr 7.0 8 0 1 1 0 0 1 1 1 0 0 1 0 1 1 1 0 0 0 0 0 1 0 1 1 1 True True WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; False True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True False False False True True True 0 0 1 False False False 16384 1048576 4194304 False False False False False 1 0 0 0 False False False False False 1036 1252 1.0.0.0 1.0.0.0 MediaInfoLib/Project/Delphi/Example/HowToUse_Dll.dpr100777 0 0 437 12226004263 15665 0program HowToUse_Dll; uses Forms, MediaInfoDLL in '..\..\..\Source\MediaInfoDLL\MediaInfoDLL.pas', HowToUse_Dll_ in 'HowToUse_Dll_.pas' {Form1}; {$R HowToUse_Dll.res} begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. MediaInfoLib/Project/Delphi/Example/HowToUse_Dll.res100777 0 0 1554 12226004263 15712 0   ( @ 1 3333133333333333331DDFvvD1Gggfv@1&vvggd 1wwgbvt 1wwwr"gf@1wwwr"vv@3wr""gf@3wr""&f@ww"w""@1wr'""@1w""$1rwr"3'w"/3"ww$"" 11 3 p 31 3333;313333333333  ?????~>??????0MAINICON  MediaInfoLib/Project/Delphi/Example/HowToUse_Dll_.dfm100777 0 0 1325 12226004263 16022 0object Form1: TForm1 Left = 282 Top = 214 BorderIcons = [biSystemMenu, biMinimize] Caption = 'MediaInfo.Dll Example' ClientHeight = 526 ClientWidth = 762 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 object Memo1: TMemo Left = 0 Top = 0 Width = 761 Height = 513 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'System' Font.Style = [] ParentFont = False ScrollBars = ssVertical TabOrder = 0 end end MediaInfoLib/Project/Delphi/Example/HowToUse_Dll_.pas100777 0 0 6157 12226004263 16047 0//Two versions : //MediaInfo_* : Unicode //MediaInfoA_* : Ansi //If you prefer Ansi version (PChar instead of PWideChar), replace MediaInfo_ by MediaInfoA_ unit HowToUse_Dll_; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, MediaInfoDll; type TForm1 = class(TForm) Memo1: TMemo; procedure FormCreate(Sender: TObject); private { Dclarations prives } public { Dclarations publiques } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); var Handle: Cardinal; To_Display: WideString; CR: WideString; begin CR:=Chr(13) + Chr(10); if (MediaInfoDLL_Load('MediaInfo.dll')=false) then begin Memo1.Text := 'Error while loading MediaInfo.dll'; exit; end; To_Display := MediaInfo_Option (0, 'Info_Version', ''); To_Display := To_Display + CR + CR + 'Info_Parameters' + CR; To_Display := To_Display + MediaInfo_Option (0, 'Info_Parameters', ''); To_Display := To_Display + CR + CR + 'Info_Capacities' + CR; To_Display := To_Display + MediaInfo_Option (0, 'Info_Capacities', ''); To_Display := To_Display + CR + CR + 'Info_Codecs' + CR; To_Display := To_Display + MediaInfo_Option (0, 'Info_Codecs', ''); Handle := MediaInfo_New(); To_Display := To_Display + CR + CR + 'Open' + CR; To_Display := To_Display + format('%d', [MediaInfo_Open(Handle, 'Example.ogg')]); To_Display := To_Display + CR + CR + 'Inform with Complete=false' + CR; MediaInfo_Option (0, 'Complete', ''); To_Display := To_Display + MediaInfo_Inform(Handle, 0); To_Display := To_Display + CR + CR + 'Inform with Complete=true' + CR; MediaInfo_Option (0, 'Complete', '1'); To_Display := To_Display + MediaInfo_Inform(Handle, 0); To_Display := To_Display + CR + CR + 'Custom Inform' + CR; MediaInfo_Option (0, 'Inform', 'General;Example : FileSize=%FileSize%'); To_Display := To_Display + MediaInfo_Inform(Handle, 0); To_Display := To_Display + CR + CR + 'GetI with Stream=General and Parameter:=17' + CR; To_Display := To_Display + MediaInfo_GetI(Handle, Stream_General, 0, 17, Info_Text); To_Display := To_Display + CR + CR + 'Count_Get with StreamKind=Stream_Audio' + CR; To_Display := To_Display + format('%d', [MediaInfo_Count_Get(Handle, Stream_Audio, -1)]); To_Display := To_Display + CR + CR + 'Get with Stream:=General and Parameter=^AudioCount^' + CR; To_Display := To_Display + MediaInfo_Get(Handle, Stream_General, 0, 'AudioCount', Info_Text, Info_Name); To_Display := To_Display + CR + CR + 'Get with Stream:=Audio and Parameter=^StreamCount^' + CR; To_Display := To_Display + MediaInfo_Get(Handle, Stream_Audio, 0, 'StreamCount', Info_Text, Info_Name); To_Display := To_Display + CR + CR + 'Get with Stream:=General and Parameter=^FileSize^' + CR; To_Display := To_Display + MediaInfo_Get(Handle, Stream_General, 0, 'FileSize', Info_Text, Info_Name); To_Display := To_Display + CR + CR + 'Close' + CR; MediaInfo_Close(Handle); Memo1.Text := To_Display; end; end. MediaInfoLib/Project/Delphi/MediaInfoLib_Delphi.bdsgroup100777 0 0 1165 12226004263 16610 0 Example\HowToUse_Dll.bdsproj HowToUse_Dll.exe MediaInfoLib/Project/GNU/ 40777 0 0 0 12264020632 10413 5MediaInfoLib/Project/GNU/libmediainfo.dsc100777 0 0 661 12264020304 13607 0Format: 1.0 Source: libmediainfo Binary: libmediainfo-dev, libmediainfo0 Architecture: any Version: 0.7.67-1 Maintainer: MediaArea.net SARL Homepage: http://MediaArea.net/MediaInfo Standards-Version: 3.7.3 Build-Depends: debhelper (>= 5), doxygen, tofrodos, libzen-dev (>= 0.4.29), zlib1g-dev, pkg-config, automake, autoconf, libtool Files: 00000000000000000000000000000000 000000 libmediainfo_0.7.67-1.tar.gz MediaInfoLib/Project/GNU/libmediainfo.spec100777 0 0 17542 12264020304 14036 0%define libmediainfo_version 0.7.67 %define libzen_version 0.4.29 Name: libmediainfo Version: %{libmediainfo_version} Release: 1 Summary: Most relevant technical and tag data for video and audio files Group: System/Libraries License: BSD-2-Clause URL: http://MediaArea.net/MediaInfo Packager: MediaArea.net SARL Source0: %{name}_%{version}-1.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: gcc-c++ BuildRequires: libzen-devel >= %{libzen_version} BuildRequires: pkgconfig BuildRequires: zlib-devel BuildRequires: doxygen BuildRequires: libtool BuildRequires: automake BuildRequires: autoconf %description MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files. What information can I get from MediaInfo? * General: title, author, director, album, track number, date, duration... * Video: codec, aspect, fps, bitrate... * Audio: codec, sample rate, channels, language, bitrate... * Text: language of subtitle * Chapters: number of chapters, list of chapters DivX, XviD, H263, H.263, H264, x264, ASP, AVC, iTunes, MPEG-1, MPEG1, MPEG-2, MPEG2, MPEG-4, MPEG4, MP4, M4A, M4V, QuickTime, RealVideo, RealAudio, RA, RM, MSMPEG4v1, MSMPEG4v2, MSMPEG4v3, VOB, DVD, WMA, VMW, ASF, 3GP, 3GPP, 3GP2 What format (container) does MediaInfo support? * Video: MKV, OGM, AVI, DivX, WMV, QuickTime, Real, MPEG-1, MPEG-2, MPEG-4, DVD (VOB) (Codecs: DivX, XviD, MSMPEG4, ASP, H.264, AVC...) * Audio: OGG, MP3, WAV, RA, AC3, DTS, AAC, M4A, AU, AIFF * Subtitles: SRT, SSA, ASS, SAMI %package -n %{name}0 Summary: Most relevant technical and tag data for video and audio files -- runtime Group: System/Libraries %description -n %{name}0 MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files. What information can I get from MediaInfo? * General: title, author, director, album, track number, date, duration... * Video: codec, aspect, fps, bitrate... * Audio: codec, sample rate, channels, language, bitrate... * Text: language of subtitle * Chapters: number of chapters, list of chapters DivX, XviD, H263, H.263, H264, x264, ASP, AVC, iTunes, MPEG-1, MPEG1, MPEG-2, MPEG2, MPEG-4, MPEG4, MP4, M4A, M4V, QuickTime, RealVideo, RealAudio, RA, RM, MSMPEG4v1, MSMPEG4v2, MSMPEG4v3, VOB, DVD, WMA, VMW, ASF, 3GP, 3GPP, 3GP2 What format (container) does MediaInfo support? * Video: MKV, OGM, AVI, DivX, WMV, QuickTime, Real, MPEG-1, MPEG-2, MPEG-4, DVD (VOB) (Codecs: DivX, XviD, MSMPEG4, ASP, H.264, AVC...) * Audio: OGG, MP3, WAV, RA, AC3, DTS, AAC, M4A, AU, AIFF * Subtitles: SRT, SSA, ASS, SAMI This package contains the shared library for MediaInfo. %package doc Summary: Most relevant technical and tag data for video and audio files -- documentation Group: Development/Libraries Requires: %{name}0 = %{version} %description doc MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files. What information can I get from MediaInfo? * General: title, author, director, album, track number, date, duration... * Video: codec, aspect, fps, bitrate... * Audio: codec, sample rate, channels, language, bitrate... * Text: language of subtitle * Chapters: number of chapters, list of chapters DivX, XviD, H263, H.263, H264, x264, ASP, AVC, iTunes, MPEG-1, MPEG1, MPEG-2, MPEG2, MPEG-4, MPEG4, MP4, M4A, M4V, QuickTime, RealVideo, RealAudio, RA, RM, MSMPEG4v1, MSMPEG4v2, MSMPEG4v3, VOB, DVD, WMA, VMW, ASF, 3GP, 3GPP, 3GP2 What format (container) does MediaInfo support? * Video: MKV, OGM, AVI, DivX, WMV, QuickTime, Real, MPEG-1, MPEG-2, MPEG-4, DVD (VOB) (Codecs: DivX, XviD, MSMPEG4, ASP, H.264, AVC...) * Audio: OGG, MP3, WAV, RA, AC3, DTS, AAC, M4A, AU, AIFF * Subtitles: SRT, SSA, ASS, SAMI This package contains the documentation %package devel Summary: Most relevant technical and tag data for video and audio files -- development Group: Development/Libraries Requires: %{name}0%{?_isa} = %{version} Requires: libzen-devel%{?_isa} >= %{libzen_version} %description devel MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files. What information can I get from MediaInfo? * General: title, author, director, album, track number, date, duration... * Video: codec, aspect, fps, bitrate... * Audio: codec, sample rate, channels, language, bitrate... * Text: language of subtitle * Chapters: number of chapters, list of chapters DivX, XviD, H263, H.263, H264, x264, ASP, AVC, iTunes, MPEG-1, MPEG1, MPEG-2, MPEG2, MPEG-4, MPEG4, MP4, M4A, M4V, QuickTime, RealVideo, RealAudio, RA, RM, MSMPEG4v1, MSMPEG4v2, MSMPEG4v3, VOB, DVD, WMA, VMW, ASF, 3GP, 3GPP, 3GP2 What format (container) does MediaInfo support? * Video: MKV, OGM, AVI, DivX, WMV, QuickTime, Real, MPEG-1, MPEG-2, MPEG-4, DVD (VOB) (Codecs: DivX, XviD, MSMPEG4, ASP, H.264, AVC...) * Audio: OGG, MP3, WAV, RA, AC3, DTS, AAC, M4A, AU, AIFF * Subtitles: SRT, SSA, ASS, SAMI This package contains the include files and mandatory libraries for development. %prep %setup -q -n MediaInfoLib cp Release/ReadMe_DLL_Linux.txt ReadMe.txt mv History_DLL.txt History.txt sed -i 's/.$//' *.txt Source/Example/* find Source -type f -exec chmod 644 {} ';' chmod 644 *.txt License.html pushd Project/GNU/Library autoreconf -i popd %build export CFLAGS="%{optflags}" export CPPFLAGS="%{optflags}" export CXXFLAGS="%{optflags}" pushd Source/Doc/ doxygen Doxyfile popd cp Source/Doc/*.html ./ pushd Project/GNU/Library %configure --enable-shared --disable-static --enable-visibility make %{?_smp_mflags} popd %install pushd Project/GNU/Library/ make install DESTDIR=%{buildroot} popd # MediaInfoDLL headers and MediaInfo-config install -dm 755 %{buildroot}%{_includedir}/MediaInfo install -m 644 Source/MediaInfo/MediaInfo.h %{buildroot}%{_includedir}/MediaInfo install -m 644 Source/MediaInfo/MediaInfoList.h %{buildroot}%{_includedir}/MediaInfo install -m 644 Source/MediaInfo/MediaInfo_Const.h %{buildroot}%{_includedir}/MediaInfo install -m 644 Source/MediaInfo/MediaInfo_Events.h %{buildroot}%{_includedir}/MediaInfo install -dm 755 %{buildroot}%{_includedir}/MediaInfoDLL install -m 644 Source/MediaInfoDLL/MediaInfoDLL.cs %{buildroot}%{_includedir}/MediaInfoDLL install -m 644 Source/MediaInfoDLL/MediaInfoDLL.h %{buildroot}%{_includedir}/MediaInfoDLL install -m 644 Source/MediaInfoDLL/MediaInfoDLL_Static.h %{buildroot}%{_includedir}/MediaInfoDLL install -m 644 Source/MediaInfoDLL/MediaInfoDLL.JNA.java %{buildroot}%{_includedir}/MediaInfoDLL install -m 644 Source/MediaInfoDLL/MediaInfoDLL.JNative.java %{buildroot}%{_includedir}/MediaInfoDLL install -m 644 Source/MediaInfoDLL/MediaInfoDLL.py %{buildroot}%{_includedir}/MediaInfoDLL install -m 644 Source/MediaInfoDLL/MediaInfoDLL3.py %{buildroot}%{_includedir}/MediaInfoDLL sed -i -e 's|Version: |Version: %{version}|g' Project/GNU/Library/libmediainfo.pc install -dm 755 %{buildroot}%{_libdir}/pkgconfig install -m 644 Project/GNU/Library/libmediainfo.pc %{buildroot}%{_libdir}/pkgconfig rm -f %{buildroot}%{_libdir}/%{name}.la %post -n %{name}0 -p /sbin/ldconfig %postun -n %{name}0 -p /sbin/ldconfig %files -n %{name}0 %defattr(-,root,root,-) %doc History.txt License.html ReadMe.txt %{_libdir}/%{name}.so.* %files doc %defattr(-,root,root,-) %doc Changes.txt Documentation.html Doc Source/Example %files devel %defattr(-,root,root,-) %{_includedir}/MediaInfo %{_includedir}/MediaInfoDLL %{_libdir}/%{name}.so %{_libdir}/pkgconfig/*.pc %changelog * Tue Jan 01 2012 MediaArea.net SARL - 0.7.67-0 - See History.txt for more info and real dates - Previous packages made by Toni Graffy - Fedora style made by Vasiliy N. Glazov MediaInfoLib/Project/GNU/Library/ 40777 0 0 0 12264020632 12017 5MediaInfoLib/Project/GNU/Library/AddThisToRoot_DLL_compile.sh100777 0 0 4075 12263202606 17355 0#! /bin/sh ############################################################################# # Configure Home=`pwd` ZenLib_Options="" ############################################################################# # Setup for parallel builds Zen_Make() { numprocs=1 if test -e /proc/stat; then numprocs=`egrep -c ^cpu[0-9]+ /proc/stat || :` if [ "$numprocs" = "" ] || [ "$numprocs" = "0" ]; then numprocs=1 fi fi if type sysctl &> /dev/null; then numprocs=`sysctl -n hw.ncpu` if [ "$numprocs" = "" ] || [ "$numprocs" = "0" ]; then numprocs=1 fi fi make -s -j$numprocs } ############################################################################# # ZenLib if test -e ZenLib/Project/GNU/Library/configure; then cd ZenLib/Project/GNU/Library/ test -e Makefile && rm Makefile chmod u+x configure ./configure $ZenLib_Options --libdir=/usr/lib $* if test -e Makefile; then make clean Zen_Make if test -e libzen.la; then echo ZenLib compiled else echo Problem while compiling ZenLib exit fi else echo Problem while configuring ZenLib exit fi else echo ZenLib directory is not found exit fi cd $Home ############################################################################# # MediaInfoLib if test -e MediaInfoLib/Project/GNU/Library/configure; then cd MediaInfoLib/Project/GNU/Library/ test -e Makefile && rm Makefile chmod u+x configure ./configure --enable-shared --disable-static --libdir=/usr/lib $* if test -e Makefile; then make clean Zen_Make if test -e libmediainfo.la; then echo MediaInfoLib compiled else echo Problem while compiling MediaInfoLib exit fi else echo Problem while configuring MediaInfoLib exit fi else echo MediaInfoLib directory is not found exit fi cd $Home ############################################################################# # Going home cd $Home echo "MediaInfo shared object is in MediaInfoLib/Project/GNU/Library/.libs" echo "For installing ZenLib, cd ZenLib/Project/GNU/Library && make install" echo "For installing MediaInfoLib, cd MediaInfoLib/Project/GNU/Library && make install"MediaInfoLib/Project/GNU/Library/autogen100777 0 0 1034 12226004263 13502 0#libtoolize if test "$(uname)" = "Darwin" ; then #Darwin based Systems like Mac OS X: libtoolize is called glibtoolize. glibtoolize --automake else libtoolize --automake fi #aclocal if test -e /usr/bin/aclocal-1.11 ; then #OpenSolaris: no aclocal aclocal-1.11 elif test -e /usr/bin/aclocal-1.10 ; then aclocal-1.10 else aclocal fi #automake if test -e /usr/bin/automake-1.11 ; then #OpenSolaris: no automake automake-1.11 -a elif test -e /usr/bin/automake-1.10 ; then automake-1.10 -a else automake -a fi autoconf MediaInfoLib/Project/GNU/Library/configure.ac100777 0 0 203330 12262536267 14464 0dnl ######################################################################### dnl ### Init dnl ######################################################################### dnl ------------------------------------------------------------------------- dnl Test if we are at the good place dnl AC_INIT(../../../Source/MediaInfo/MediaInfo.cpp) dnl ------------------------------------------------------------------------- dnl sets build, host, target variables and the same with _alias dnl AC_CANONICAL_BUILD dnl ------------------------------------------------------------------------- dnl Name and version dnl AM_INIT_AUTOMAKE(libmediainfo,0) dnl ------------------------------------------------------------------------- dnl Autotools init dnl CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" AC_PROG_CC AC_PROG_CXX AC_DISABLE_SHARED AC_LIBTOOL_WIN32_DLL AC_PROG_LIBTOOL AC_PROG_INSTALL dnl ######################################################################### dnl Configure dnl ######################################################################### Home=`pwd` dnl ######################################################################### dnl ### Options dnl ######################################################################### dnl ------------------------------------------------------------------------- dnl Enable dnl AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable full debug]), , enable_debug=no) AC_ARG_ENABLE(gprof, AC_HELP_STRING([--enable-gprof], [Enable gprof log]), , enable_gprof=no) AC_ARG_ENABLE(visibility, AC_HELP_STRING([--enable-visibility], [Enable hidden visibility]), , enable_visibility=no) AC_ARG_ENABLE(universal_binary, AC_HELP_STRING([--enable-universal_binary], [Create Mac PPC/i386 Universal binary]), , enable_universal_binary=no) AC_ARG_ENABLE(arch-ppc, AC_HELP_STRING([--enable-arch-ppc], [Create Mac PPC architecture]), , enable_arch_ppc=no) AC_ARG_ENABLE(arch-ppc64, AC_HELP_STRING([--enable-arch-ppc64], [Create Mac PPC64 architecture]), , enable_arch_ppc64=no) AC_ARG_ENABLE(arch-i386, AC_HELP_STRING([--enable-arch-i386], [Create Mac i386 architecture]), , enable_arch_i386=no) AC_ARG_ENABLE(arch-x86_64, AC_HELP_STRING([--enable-arch-x86_64], [Create Mac x86_64 architecture]), , enable_arch_x86_64=no) AC_ARG_ENABLE(staticlibs, AC_HELP_STRING([--enable-staticlibs], [Use static libmediainfo and libzen]), , enable_staticlibs=no) AC_ARG_ENABLE(minimize-size, AC_HELP_STRING([--enable-minimize-size], [Enable size optimisations]), MediaInfoMinimizeSize=$enableval, MediaInfoMinimizeSize=depend) AC_ARG_ENABLE(minimal, AC_HELP_STRING([--enable-minimal], [Enable minimal management (except parsers)]),MediaInfoMinimal=$enableval, MediaInfoMinimal=depend) AC_ARG_ENABLE(trace, AC_HELP_STRING([--enable-trace], [Enable trace management]), MediaInfoTrace=$enableval, MediaInfoTrace=depend) AC_ARG_ENABLE(events, AC_HELP_STRING([--enable-events], [Enable events management]), MediaInfoEvents=$enableval, MediaInfoEvents=depend) AC_ARG_ENABLE(demux, AC_HELP_STRING([--enable-demux], [Enable demux management]), MediaInfoDemux=$enableval, MediaInfoDemux=depend) AC_ARG_ENABLE(libmms-describe-support, AC_HELP_STRING([--enable-libmms-describe-support], [Enable customized libmms describe support]), MediaInfoLibmmsDescribeSupport=$enableval, MediaInfoLibmmsDescribeSupport=depend) AC_ARG_ENABLE(all, AC_HELP_STRING([--disable-all], [Disable all parsers]), MediaInfoAll=$enableval, MediaInfoAll=depend) AC_ARG_ENABLE(archive, AC_HELP_STRING([--disable-archive], [Disable all archive parsers]), MediaInfoArchive=$enableval, MediaInfoArchive=depend) AC_ARG_ENABLE(audio, AC_HELP_STRING([--disable-audio], [Disable all audio parsers]), MediaInfoAudio=$enableval, MediaInfoAudio=depend) AC_ARG_ENABLE(image, AC_HELP_STRING([--disable-image], [Disable all image parsers]), MediaInfoImage=$enableval, MediaInfoImage=depend) AC_ARG_ENABLE(multi, AC_HELP_STRING([--disable-multi], [Disable all multiple parsers]), MediaInfoMulti=$enableval, MediaInfoMulti=depend) AC_ARG_ENABLE(tag, AC_HELP_STRING([--disable-tag], [Disable all tag parsers]), MediaInfoTag=$enableval, MediaInfoTag=depend) AC_ARG_ENABLE(text, AC_HELP_STRING([--disable-text], [Disable all text parsers]), MediaInfoText=$enableval, MediaInfoText=depend) AC_ARG_ENABLE(video, AC_HELP_STRING([--disable-video], [Disable all video parsers]), MediaInfoVideo=$enableval, MediaInfoVideo=depend) AC_ARG_ENABLE(7z, AC_HELP_STRING([--disable-7z], [Disable Archive - 7z]), MediaInfo7z=$enableval, MediaInfo7z=depend) AC_ARG_ENABLE(ace, AC_HELP_STRING([--disable-ace], [Disable Archive - Ace]), MediaInfoAce=$enableval, MediaInfoAce=depend) AC_ARG_ENABLE(bzip2, AC_HELP_STRING([--disable-bzip2], [Disable Archive - Bzip2]), MediaInfoBzip2=$enableval, MediaInfoBzip2=depend) AC_ARG_ENABLE(elf, AC_HELP_STRING([--disable-elf], [Disable Archive - ELF]), MediaInfoElf=$enableval, MediaInfoElf=depend) AC_ARG_ENABLE(gzip, AC_HELP_STRING([--disable-gzip], [Disable Archive - GZip]), MediaInfoGzip=$enableval, MediaInfoGzip=depend) AC_ARG_ENABLE(iso9660, AC_HELP_STRING([--disable-iso9660], [Disable Archive - ISO 9660]), MediaInfoIso9660=$enableval, MediaInfoIso9660=depend) AC_ARG_ENABLE(mz, AC_HELP_STRING([--disable-mz], [Disable Archive - MZ (DOS) and PE (Windows)]), MediaInfoMz=$enableval, MediaInfoMz=depend) AC_ARG_ENABLE(rar, AC_HELP_STRING([--disable-rar], [Disable Archive - Rar]), MediaInfoRar=$enableval, MediaInfoRar=depend) AC_ARG_ENABLE(tar, AC_HELP_STRING([--disable-tar], [Disable Archive - Tar]), MediaInfoTar=$enableval, MediaInfoTar=depend) AC_ARG_ENABLE(zip, AC_HELP_STRING([--disable-zip], [Disable Archive - Zip]), MediaInfoZip=$enableval, MediaInfoZip=depend) AC_ARG_ENABLE(aac, AC_HELP_STRING([--disable-aac], [Disable Audio - AAC (raw)]), MediaInfoAac=$enableval, MediaInfoAac=depend) AC_ARG_ENABLE(ac3, AC_HELP_STRING([--disable-ac3], [Disable Audio - AC-3]), MediaInfoAc3=$enableval, MediaInfoAc3=depend) AC_ARG_ENABLE(adif, AC_HELP_STRING([--disable-adif], [Disable Audio - ADIF]), MediaInfoAdif=$enableval, MediaInfoAdif=depend) AC_ARG_ENABLE(adpcm, AC_HELP_STRING([--disable-adpcm], [Disable Audio - ADPCM]), MediaInfoAdpcm=$enableval, MediaInfoAdpcm=depend) AC_ARG_ENABLE(adts, AC_HELP_STRING([--disable-adts], [Disable Audio - ADTS]), MediaInfoAdts=$enableval, MediaInfoAdts=depend) AC_ARG_ENABLE(aes3, AC_HELP_STRING([--disable-aes3], [Disable Audio - AES3]), MediaInfoAdts=$enableval, MediaInfoAes3=depend) AC_ARG_ENABLE(als, AC_HELP_STRING([--disable-als], [Disable Audio - ALS]), MediaInfoAls=$enableval, MediaInfoAls=depend) AC_ARG_ENABLE(amr, AC_HELP_STRING([--disable-amr], [Disable Audio - AMR]), MediaInfoAmr=$enableval, MediaInfoAmr=depend) AC_ARG_ENABLE(amv, AC_HELP_STRING([--disable-amv], [Disable Audio - AMV]), MediaInfoAmv=$enableval, MediaInfoAmv=depend) AC_ARG_ENABLE(ape, AC_HELP_STRING([--disable-ape], [Disable Audio - Monkey Audio (.ape, .mac)]), MediaInfoApe=$enableval, MediaInfoApe=depend) AC_ARG_ENABLE(au, AC_HELP_STRING([--disable-au], [Disable Audio - Au]), MediaInfoAu=$enableval, MediaInfoAu=depend) AC_ARG_ENABLE(celt, AC_HELP_STRING([--disable-celt], [Disable Audio - CELT]), MediaInfoCelt=$enableval, MediaInfoCelt=depend) AC_ARG_ENABLE(dts, AC_HELP_STRING([--disable-dts], [Disable Audio - DTS]), MediaInfoDts=$enableval, MediaInfoDts=depend) AC_ARG_ENABLE(flac, AC_HELP_STRING([--disable-flac], [Disable Audio - FLAC format]), MediaInfoFlac=$enableval, MediaInfoFlac=depend) AC_ARG_ENABLE(la, AC_HELP_STRING([--disable-la], [Disable Audio - LA (Lossless Audio)]), MediaInfoLa=$enableval, MediaInfoLa=depend) AC_ARG_ENABLE(latm, AC_HELP_STRING([--disable-latm], [Disable Audio - LATM]), MediaInfoLatm=$enableval, MediaInfoLatm=depend) AC_ARG_ENABLE(midi, AC_HELP_STRING([--disable-midi], [Disable Audio - MIDI]), MediaInfoMidi=$enableval, MediaInfoMidi=depend) AC_ARG_ENABLE(mpc, AC_HELP_STRING([--disable-mpc], [Disable Audio - Musepack format (.mpc)]), MediaInfoMpc=$enableval, MediaInfoMpc=depend) AC_ARG_ENABLE(mpcsv8, AC_HELP_STRING([--disable-mpc], [Disable Audio - Musepack format SV8 (.mpc)]), MediaInfoMpcSv8=$enableval, MediaInfoMpcSv8=depend) AC_ARG_ENABLE(mpega, AC_HELP_STRING([--disable-mpega], [Disable Audio - MPEG-Audio]), MediaInfoMpega=$enableval, MediaInfoMpega=depend) AC_ARG_ENABLE(pcm, AC_HELP_STRING([--disable-pcm], [Disable Audio - PCM]), MediaInfoPcm=$enableval, MediaInfoPcm=depend) AC_ARG_ENABLE(ps2a, AC_HELP_STRING([--disable-ps2a], [Disable Audio - PS2 Audio]), MediaInfoPs2a=$enableval, MediaInfoPs2a=depend) AC_ARG_ENABLE(rkau, AC_HELP_STRING([--disable-rkau], [Disable Audio - RK Audio]), MediaInfoRkau=$enableval, MediaInfoRkau=depend) AC_ARG_ENABLE(speex, AC_HELP_STRING([--disable-speex], [Disable Audio - Speex]), MediaInfoSpeex=$enableval, MediaInfoSpeex=depend) AC_ARG_ENABLE(tak, AC_HELP_STRING([--disable-tak], [Disable Audio - TAK]), MediaInfoTak=$enableval, MediaInfoTak=depend) AC_ARG_ENABLE(tta, AC_HELP_STRING([--disable-tta], [Disable Audio - True Audio]), MediaInfoTta=$enableval, MediaInfoTta=depend) AC_ARG_ENABLE(twinvq, AC_HELP_STRING([--disable-twinvq], [Disable Audio - TwinVQ]), MediaInfoTwinVQ=$enableval, MediaInfoTwinVQ=depend) AC_ARG_ENABLE(vorbis, AC_HELP_STRING([--disable-vorbis], [Disable Audio - Vorbis]), MediaInfovorbis=$enableval, MediaInfovorbis=depend) AC_ARG_ENABLE(wvpk, AC_HELP_STRING([--disable-wvpk], [Disable Audio - Wavepack]), MediaInfoWvpk=$enableval, MediaInfoWvpk=depend) AC_ARG_ENABLE(bmp, AC_HELP_STRING([--disable-bmp], [Disable Image - Bitmap]), MediaInfoBmp=$enableval, MediaInfoBmp=depend) AC_ARG_ENABLE(dpx, AC_HELP_STRING([--disable-dpx], [Disable Image - DPX]), MediaInfoDpx=$enableval, MediaInfoDpx=depend) AC_ARG_ENABLE(exr, AC_HELP_STRING([--disable-exr], [Disable Image - EXR]), MediaInfoExr=$enableval, MediaInfoExr=depend) AC_ARG_ENABLE(gif, AC_HELP_STRING([--disable-gif], [Disable Image - GIF]), MediaInfoGif=$enableval, MediaInfoGif=depend) AC_ARG_ENABLE(ico, AC_HELP_STRING([--disable-ico], [Disable Image - ICO]), MediaInfoIco=$enableval, MediaInfoIco=depend) AC_ARG_ENABLE(jpeg, AC_HELP_STRING([--disable-jpeg], [Disable Image - JPEG]), MediaInfoJpeg=$enableval, MediaInfoJpeg=depend) AC_ARG_ENABLE(pcx, AC_HELP_STRING([--disable-pcx], [Disable Image - PCX]), MediaInfoPcx=$enableval, MediaInfoPcx=depend) AC_ARG_ENABLE(png, AC_HELP_STRING([--disable-png], [Disable Image - PNG]), MediaInfoPng=$enableval, MediaInfoPng=depend) AC_ARG_ENABLE(psd, AC_HELP_STRING([--disable-psd], [Disable Image - PSD]), MediaInfoPsd=$enableval, MediaInfoPsd=depend) AC_ARG_ENABLE(rle, AC_HELP_STRING([--disable-rle], [Disable Image - Run-length encoding]), MediaInfoRle=$enableval, MediaInfoRle=depend) AC_ARG_ENABLE(tiff, AC_HELP_STRING([--disable-tiff], [Disable Image - TIFF]), MediaInfoTiff=$enableval, MediaInfoTiff=depend) AC_ARG_ENABLE(aaf, AC_HELP_STRING([--disable-aaf], [Disable Multiple - AAF]), MediaInfoAaf=$enableval, MediaInfoAaf=depend) AC_ARG_ENABLE(bdav, AC_HELP_STRING([--disable-bdav], [Disable Multiple - Blu-ray audio-video (BDAV)]), MediaInfoBdav=$enableval, MediaInfoBdav=depend) AC_ARG_ENABLE(bdmv, AC_HELP_STRING([--disable-bdmv], [Disable Multiple - Blu-ray Movie]), MediaInfoBdmv=$enableval, MediaInfoBdmv=depend) AC_ARG_ENABLE(cdxa, AC_HELP_STRING([--disable-cdxa], [Disable Multiple - CDXA (CD mode 2)]), MediaInfoCdxa=$enableval, MediaInfoCdxa=depend) AC_ARG_ENABLE(dashmpd AC_HELP_STRING([--disable-dashmpd], [Disable Multiple - DASH MPD]), MediaInfoDashMpd=$enableval, MediaInfoDashMpd=depend) AC_ARG_ENABLE(dcp, AC_HELP_STRING([--disable-dcp], [Disable Multiple - DCP]), MediaInfoDcp=$enableval, MediaInfoDcp=depend) AC_ARG_ENABLE(dpg, AC_HELP_STRING([--disable-dpg], [Disable Multiple - DPG (Nintendo DS)]), MediaInfoDpg=$enableval, MediaInfoDpg=depend) AC_ARG_ENABLE(references, AC_HELP_STRING([--disable-references], [Disable Multiple - Reference files support]), MediaInfoReferences=$enableval, MediaInfoReferences=depend) AC_ARG_ENABLE(dvdif, AC_HELP_STRING([--disable-dvdif], [Disable Multiple - DV DIF (Digital Video)]), MediaInfoDvDif=$enableval, MediaInfoDvDif=depend) AC_ARG_ENABLE(dvdif-analyze, AC_HELP_STRING([--enable-dvdif-analyze], [Enable Multiple - DV DIF (Digital Video) Analyze part]), MediaInfoDvDifAnalyze=$enableval, MediaInfoDvDifAnalyze=depend) AC_ARG_ENABLE(dvdv, AC_HELP_STRING([--disable-dvdv], [Disable Multiple - DVD-Video]), MediaInfoDvdv=$enableval, MediaInfoDvdv=depend) AC_ARG_ENABLE(dxw, AC_HELP_STRING([--disable-dxw], [Disable Multiple - DXW]), MediaInfoDxw=$enableval, MediaInfoDxw=depend) AC_ARG_ENABLE(flv, AC_HELP_STRING([--disable-flv], [Disable Multiple - FLV (Flash video)]), MediaInfoFlv=$enableval, MediaInfoFlv=depend) AC_ARG_ENABLE(gxf, AC_HELP_STRING([--disable-gxf], [Disable Multiple - GXF]), MediaInfoGxf=$enableval, MediaInfoGxf=depend) AC_ARG_ENABLE(hdsf4m, AC_HELP_STRING([--disable-hdsf4m], [Disable Multiple - HDS F4M (Flash Media Manifest)]), MediaInfoHdsF4m=$enableval, MediaInfoHdsf4m=depend) AC_ARG_ENABLE(hls, AC_HELP_STRING([--disable-hls], [Disable Multiple - HLS]), MediaInfoHls=$enableval, MediaInfoHls=depend) AC_ARG_ENABLE(mk, AC_HELP_STRING([--disable-mk], [Disable Multiple - Matroska]), MediaInfoMk=$enableval, MediaInfoMk=depend) AC_ARG_ENABLE(mpeg4, AC_HELP_STRING([--disable-mpeg4], [Disable Multiple - MPEG-4 based formats (MOV, AAC...)]), MediaInfoMpeg4=$enableval, MediaInfoMpeg4=depend) AC_ARG_ENABLE(mpegps, AC_HELP_STRING([--disable-mpegps], [Disable Multiple - MPEG-PS]), MediaInfoMpegPs=$enableval, MediaInfoMpegPs=depend) AC_ARG_ENABLE(mpegts, AC_HELP_STRING([--disable-mpegts], [Disable Multiple - MPEG-TS]), MediaInfoMpegTs=$enableval, MediaInfoMpegTs=depend) AC_ARG_ENABLE(mpegts-pcr, AC_HELP_STRING([--disable-mpegts-pcr], [Disable Multiple - MPEG-TS (PCR)]), MediaInfoMpegTsPcr=$enableval, MediaInfoMpegTsPcr=depend) AC_ARG_ENABLE(mpegts-pestimestamp, AC_HELP_STRING([--disable-mpegts-pestimestamp], [Disable Multiple - MPEG-TS (parser time stamp)]), MediaInfoMpegTsPesTimeStamp=$enableval, MediaInfoMpegTsPesTimeStamp=depend) AC_ARG_ENABLE(mxf, AC_HELP_STRING([--disable-mxf], [Disable Multiple - MXF]), MediaInfoMxf=$enableval, MediaInfoMxf=depend) AC_ARG_ENABLE(nut, AC_HELP_STRING([--disable-nut], [Disable Multiple - Nut]), MediaInfoNut=$enableval, MediaInfoNut=depend) AC_ARG_ENABLE(ogg, AC_HELP_STRING([--disable-ogg], [Disable Multiple - OGG (ogg, ogm)]), MediaInfoOgg=$enableval, MediaInfoOgg=depend) AC_ARG_ENABLE(pmp, AC_HELP_STRING([--disable-pmp], [Disable Multiple - Playstation Portable (PMP)]), MediaInfoPmp=$enableval, MediaInfoPmp=depend) AC_ARG_ENABLE(riff, AC_HELP_STRING([--disable-riff], [Disable Multiple - RIFF based formats (AVI...)]), MediaInfoRiff=$enableval, MediaInfoRiff=depend) AC_ARG_ENABLE(rm, AC_HELP_STRING([--disable-rm], [Disable Multiple - Real Media]), MediaInfoRm=$enableval, MediaInfoRm=depend) AC_ARG_ENABLE(skm, AC_HELP_STRING([--disable-skm], [Disable Multiple - SKM]), MediaInfoSkm=$enableval, MediaInfoSkm=depend) AC_ARG_ENABLE(swf, AC_HELP_STRING([--disable-swf], [Disable Multiple - Shockwave]), MediaInfoSwf=$enableval, MediaInfoSwf=depend) AC_ARG_ENABLE(tsp, AC_HELP_STRING([--disable-tsp], [Disable Multiple - TSP]), MediaInfoTsp=$enableval, MediaInfoTsp=depend) AC_ARG_ENABLE(wm, AC_HELP_STRING([--disable-wm], [Disable Multiple - Windows Media (ASF, WMV, WMA)]), MediaInfoWm=$enableval, MediaInfoWm=depend) AC_ARG_ENABLE(apetag, AC_HELP_STRING([--disable-apetag], [Disable Tag - ApeTag]), MediaInfoApeTag=$enableval, MediaInfoApeTag=depend) AC_ARG_ENABLE(Id3, AC_HELP_STRING([--disable-Id3], [Disable Tag - Id3]), MediaInfoId3=$enableval, MediaInfoId3=depend) AC_ARG_ENABLE(Id3v2, AC_HELP_STRING([--disable-Id3v2], [Disable Tag - Id3v2]), MediaInfoId3v2=$enableval, MediaInfoId3v2=depend) AC_ARG_ENABLE(Lyrics3, AC_HELP_STRING([--disable-Lyrics3], [Disable Tag - Lyrics3]), MediaInfoLyrics3=$enableval, MediaInfoLyrics3=depend) AC_ARG_ENABLE(Lyrics3v2, AC_HELP_STRING([--disable-Lyrics3v2], [Disable Tag - Lyrics3v2]), MediaInfoLyrics3v2=$enableval, MediaInfoLyrics3v2=depend) AC_ARG_ENABLE(VorbisCom, AC_HELP_STRING([--disable-VorbisCom], [Disable Tag - VorbisCom]), MediaInfoVorbisCom=$enableval, MediaInfoVorbisCom=depend) AC_ARG_ENABLE(cmml, AC_HELP_STRING([--disable-cmml], [Disable Text - CMML]), MediaInfoCmml=$enableval, MediaInfoCmml=depend) AC_ARG_ENABLE(dvbsubtitle, AC_HELP_STRING([--disable-dvbSsubtitle], [Disable Text - DVB Subtitle]), MediaInfoDvbSubtitle=$enableval, MediaInfoDvbSubtitle=depend) AC_ARG_ENABLE(aribstdb24b37, AC_HELP_STRING([--disable-aribstdb24], [Disable Text - Closed captions (ARIB STD B24/B37)]), MediaInfoaribstdb24b37=$enableval, MediaInfoaribstdb24b37=depend) AC_ARG_ENABLE(eia608, AC_HELP_STRING([--disable-eia608], [Disable Text - Closed captions (EIA-608)]), MediaInfoEia608=$enableval, MediaInfoEia608=depend) AC_ARG_ENABLE(eia708, AC_HELP_STRING([--disable-eia708], [Disable Text - Closed captions (EIA-708)]), MediaInfoEia708=$enableval, MediaInfoEia708=depend) AC_ARG_ENABLE(subrip, AC_HELP_STRING([--disable-subrip], [Disable Text - SubRip]), MediaInfoSubRip=$enableval, MediaInfoSubRip=depend) AC_ARG_ENABLE(teletext, AC_HELP_STRING([--disable-teletext], [Disable Text - Teletext]), MediaInfoTeletext=$enableval, MediaInfoTeletext=depend) AC_ARG_ENABLE(timedtext, AC_HELP_STRING([--disable-timedtext], [Disable Text - Timed Text (MPEG-4 Part 17)]), MediaInfoTimedText=$enableval, MediaInfoTimedText=depend) AC_ARG_ENABLE(ttml, AC_HELP_STRING([--disable-ttml], [Disable Text - TTML]), MediaInfoTtml=$enableval, MediaInfoTtml=depend) AC_ARG_ENABLE(kate, AC_HELP_STRING([--disable-kate], [Disable Text - Kate]), MediaInfoKate=$enableval, MediaInfoKate=depend) AC_ARG_ENABLE(pgs, AC_HELP_STRING([--disable-pgs] , [Disable Text - PGS]), MediaInfoPgs=$enableval, MediaInfoPgs=depend) AC_ARG_ENABLE(scc, AC_HELP_STRING([--disable-scc] , [Disable Text - SCC]), MediaInfoScc=$enableval, MediaInfoScc=depend) AC_ARG_ENABLE(aic, AC_HELP_STRING([--disable-aic], [Disable Video - AIC (Apple Intermediate Codec)]), MediaInfoAic=$enableval, MediaInfoAic=depend) AC_ARG_ENABLE(avc, AC_HELP_STRING([--disable-avc], [Disable Video - AVC/H264]), MediaInfoAvc=$enableval, MediaInfoAvc=depend) AC_ARG_ENABLE(avsV, AC_HELP_STRING([--disable-avsv], [Disable Video - AVS (Chinese)]), MediaInfoAvsV=$enableval, MediaInfoAvsV=depend) AC_ARG_ENABLE(canopus, AC_HELP_STRING([--disable-canopus], [Disable Video - Canopus]), MediaInfoCanopus=$enableval, MediaInfoCanopus=depend) AC_ARG_ENABLE(flic, AC_HELP_STRING([--disable-flic], [Disable Video - FLIC (fli, flc)]), MediaInfoFlic=$enableval, MediaInfoFlic=depend) AC_ARG_ENABLE(h263, AC_HELP_STRING([--disable-h263], [Disable Video - H.263]), MediaInfoH263=$enableval, MediaInfoH263=depend) AC_ARG_ENABLE(hevc, AC_HELP_STRING([--disable-hevc], [Disable Video - HEVC/H265]), MediaInfoHevc=$enableval, MediaInfoHevc=depend) AC_ARG_ENABLE(mpeg4v, AC_HELP_STRING([--disable-mpeg4v], [Disable Video - MPEG-4 Video based formats (DivX, XviD...)]), MediaInfoMpeg4v=$enableval, MediaInfoMpeg4v=depend) AC_ARG_ENABLE(mpegv, AC_HELP_STRING([--disable-mpegv], [Disable Video - MPEG-Video]), MediaInfoMpegv=$enableval, MediaInfoMpegv=depend) AC_ARG_ENABLE(prores, AC_HELP_STRING([--disable-prores], [Disable Video - ProRes]), MediaInfoProRes=$enableval, MediaInfoProRes=depend) AC_ARG_ENABLE(theora, AC_HELP_STRING([--disable-theora], [Disable Video - Theora]), MediaInfoTheora=$enableval, MediaInfoTheora=depend) AC_ARG_ENABLE(vc1, AC_HELP_STRING([--disable-vc1], [Disable Video - VC-1]), MediaInfoVc1=$enableval, MediaInfoVc1=depend) AC_ARG_ENABLE(vc3, AC_HELP_STRING([--disable-vc3], [Disable Video - VC-3 (DNxHD)]), MediaInfoVc3=$enableval, MediaInfoVc3=depend) AC_ARG_ENABLE(vp8, AC_HELP_STRING([--disable-vp8], [Disable Video - VP8]), MediaInfovp8=$enableval, MediaInfovp8=depend) AC_ARG_ENABLE(y4m, AC_HELP_STRING([--disable-y4m], [Disable Video - YUV4MPEG2]), MediaInfoy4m=$enableval, MediaInfoy4m=depend) dnl ------------------------------------------------------------------------- dnl With dnl AC_ARG_WITH(macosx-sdk, AC_HELP_STRING([--with-macosx-sdk], [Force the Mac SDK]), , with_macosx_sdk=no) AC_ARG_WITH(macosx-version-min, AC_HELP_STRING([--with-macosx-version-min], [Force the Mac Version]), , with_macosx_version_min=no) AC_ARG_WITH(libz_static, AC_HELP_STRING([--with-libz-static], [Use static version of Zlib]), , with_libz_static=no) AC_ARG_WITH(libcurl, AC_HELP_STRING([--with-libcurl], [Use libcurl (specific directory)]), , with_libcurl=no) AC_ARG_WITH(libmms, AC_HELP_STRING([--with-libmms], [Use libmms (specific directory)]), , with_libmms=no) AC_ARG_WITH(libmd5, AC_HELP_STRING([--with-libmd5], [Use libmd5 (system)]), , with_libmd5=depend) AC_ARG_WITH(libtinyxml2, AC_HELP_STRING([--with-libtinyxml2], [Use libtinyxml2 (system)]), , with_libtinyxml2=depend) AC_ARG_WITH(libmediainfo-name, AC_HELP_STRING([--with-libmediainfo-name], [Force libmediainfo filename]), , with_libmediainfo_name=mediainfo) dnl ------------------------------------------------------------------------- dnl MediaInfo * dnl if test "$MediaInfoMinimizeSize" = "yes"; then AC_DEFINE(MEDIAINFO_MINIMIZESIZE) fi if test "$MediaInfoMinimal" = "no"; then AC_DEFINE(MEDIAINFO_MINIMAL_NO) fi; if test "$MediaInfoMinimal" = "yes"; then AC_DEFINE(MEDIAINFO_MINIMAL_YES) fi if test "$MediaInfoTrace" = "no"; then AC_DEFINE(MEDIAINFO_TRACE_NO) fi; if test "$MediaInfoTrace" = "yes"; then AC_DEFINE(MEDIAINFO_TRACE_YES) fi if test "$MediaInfoEvents" = "no"; then AC_DEFINE(MEDIAINFO_EVENTS_NO) fi; if test "$MediaInfoEvents" = "yes"; then AC_DEFINE(MEDIAINFO_EVENTS_YES) fi if test "$MediaInfoDemux" = "no"; then AC_DEFINE(MEDIAINFO_DEMUX_NO) fi; if test "$MediaInfoDemux" = "yes"; then AC_DEFINE(MEDIAINFO_DEMUX_YES) fi if test "$MediaInfoLibmmsDescribeSupport" = "yes"; then AC_DEFINE(MEDIAINFO_LIBMMS_DESCRIBE_SUPPORT) fi if test "$MediaInfoAll" = "no"; then AC_DEFINE(MEDIAINFO_ALL_NO) fi if test "$MediaInfoArchive" = "no"; then AC_DEFINE(MEDIAINFO_ARCHIVE_NO) fi if test "$MediaInfoAudio" = "no"; then AC_DEFINE(MEDIAINFO_AUDIO_NO) fi if test "$MediaInfoImage" = "no"; then AC_DEFINE(MEDIAINFO_IMAGE_NO) fi if test "$MediaInfoMulti" = "no"; then AC_DEFINE(MEDIAINFO_MULTI_NO) fi if test "$MediaInfoText" = "no"; then AC_DEFINE(MEDIAINFO_TAG_NO) fi if test "$MediaInfoText" = "no"; then AC_DEFINE(MEDIAINFO_TEXT_NO) fi if test "$MediaInfoVideo" = "no"; then AC_DEFINE(MEDIAINFO_VIDEO_NO) fi if test "$MediaInfo7z" = "no"; then AC_DEFINE(MEDIAINFO_7Z_NO) fi; if test "$MediaInfo7z" = "yes"; then AC_DEFINE(MEDIAINFO_7Z_YES) fi if test "$MediaInfoAce" = "no"; then AC_DEFINE(MEDIAINFO_ACE_NO) fi; if test "$MediaInfoAce" = "yes"; then AC_DEFINE(MEDIAINFO_ACE_YES) fi if test "$MediaInfoBzip2" = "no"; then AC_DEFINE(MEDIAINFO_BZIP2_NO) fi; if test "$MediaInfoBzip2" = "yes"; then AC_DEFINE(MEDIAINFO_BZIP2_YES) fi if test "$MediaInfoElf" = "no"; then AC_DEFINE(MEDIAINFO_ELF_NO) fi; if test "$MediaInfoElf" = "yes"; then AC_DEFINE(MEDIAINFO_ELF_YES) fi if test "$MediaInfoGzip" = "no"; then AC_DEFINE(MEDIAINFO_GZIP_NO) fi; if test "$MediaInfoGzip" = "yes"; then AC_DEFINE(MEDIAINFO_GZIP_YES) fi if test "$MediaInfoIso9660" = "no"; then AC_DEFINE(MEDIAINFO_ISO9660_NO) fi; if test "$MediaInfoIso9660" = "yes"; then AC_DEFINE(MEDIAINFO_ISO9660_YES) fi if test "$MediaInfoMz" = "no"; then AC_DEFINE(MEDIAINFO_MZ_NO) fi; if test "$MediaInfoMz" = "yes"; then AC_DEFINE(MEDIAINFO_MZ_YES) fi if test "$MediaInfoRar" = "no"; then AC_DEFINE(MEDIAINFO_RAR_NO) fi; if test "$MediaInfoRar" = "yes"; then AC_DEFINE(MEDIAINFO_RAR_YES) fi if test "$MediaInfoTar" = "no"; then AC_DEFINE(MEDIAINFO_TAR_NO) fi; if test "$MediaInfoTar" = "yes"; then AC_DEFINE(MEDIAINFO_TAR_YES) fi if test "$MediaInfoZip" = "no"; then AC_DEFINE(MEDIAINFO_ZIP_NO) fi; if test "$MediaInfoZip" = "yes"; then AC_DEFINE(MEDIAINFO_ZIP_YES) fi if test "$MediaInfoAac" = "no"; then AC_DEFINE(MEDIAINFO_AAC_NO) fi; if test "$MediaInfoAac" = "yes"; then AC_DEFINE(MEDIAINFO_AAC_YES) fi if test "$MediaInfoAc3" = "no"; then AC_DEFINE(MEDIAINFO_AC3_NO) fi; if test "$MediaInfoAc3" = "yes"; then AC_DEFINE(MEDIAINFO_AC3_YES) fi if test "$MediaInfoAdif" = "no"; then AC_DEFINE(MEDIAINFO_ADIF_NO) fi; if test "$MediaInfoAdif" = "yes"; then AC_DEFINE(MEDIAINFO_ADIF_YES) fi if test "$MediaInfoAdpcm" = "no"; then AC_DEFINE(MEDIAINFO_ADPCM_NO) fi; if test "$MediaInfoAdpcm" = "yes"; then AC_DEFINE(MEDIAINFO_ADPCM_YES) fi if test "$MediaInfoAdts" = "no"; then AC_DEFINE(MEDIAINFO_ADTS_NO) fi; if test "$MediaInfoAdts" = "yes"; then AC_DEFINE(MEDIAINFO_ADTS_YES) fi if test "$MediaInfoAes3" = "no"; then AC_DEFINE(MEDIAINFO_AES3_NO) fi; if test "$MediaInfoAes3" = "yes"; then AC_DEFINE(MEDIAINFO_AES3_YES) fi if test "$MediaInfoAls" = "no"; then AC_DEFINE(MEDIAINFO_ALS_NO) fi; if test "$MediaInfoAls" = "yes"; then AC_DEFINE(MEDIAINFO_ALS_YES) fi if test "$MediaInfoAmr" = "no"; then AC_DEFINE(MEDIAINFO_AMR_NO) fi; if test "$MediaInfoAmr" = "yes"; then AC_DEFINE(MEDIAINFO_AMR_YES) fi if test "$MediaInfoAmv" = "no"; then AC_DEFINE(MEDIAINFO_AMV_NO) fi; if test "$MediaInfoAmv" = "yes"; then AC_DEFINE(MEDIAINFO_AMV_YES) fi if test "$MediaInfoApe" = "no"; then AC_DEFINE(MEDIAINFO_APE_NO) fi; if test "$MediaInfoApe" = "yes"; then AC_DEFINE(MEDIAINFO_APE_YES) fi if test "$MediaInfoAu" = "no"; then AC_DEFINE(MEDIAINFO_AU_NO) fi; if test "$MediaInfoAu" = "yes"; then AC_DEFINE(MEDIAINFO_AU_YES) fi if test "$MediaInfoCelt" = "no"; then AC_DEFINE(MEDIAINFO_CELT_NO) fi; if test "$MediaInfoCelt" = "yes"; then AC_DEFINE(MEDIAINFO_CELT_YES) fi if test "$MediaInfoDts" = "no"; then AC_DEFINE(MEDIAINFO_DTS_NO) fi; if test "$MediaInfoDts" = "yes"; then AC_DEFINE(MEDIAINFO_DTS_YES) fi if test "$MediaInfoFlac" = "no"; then AC_DEFINE(MEDIAINFO_FLAC_NO) fi; if test "$MediaInfoFlac" = "yes"; then AC_DEFINE(MEDIAINFO_FLAC_YES) fi if test "$MediaInfoLa" = "no"; then AC_DEFINE(MEDIAINFO_LA_NO) fi; if test "$MediaInfoLa" = "yes"; then AC_DEFINE(MEDIAINFO_LA_YES) fi if test "$MediaInfoLatm" = "no"; then AC_DEFINE(MEDIAINFO_LATM_NO) fi; if test "$MediaInfoLatm" = "yes"; then AC_DEFINE(MEDIAINFO_LATM_YES) fi if test "$MediaInfoMidi" = "no"; then AC_DEFINE(MEDIAINFO_MIDO_NO) fi; if test "$MediaInfoMidi" = "yes"; then AC_DEFINE(MEDIAINFO_MIDI_YES) fi if test "$MediaInfoMpc" = "no"; then AC_DEFINE(MEDIAINFO_MPC_NO) fi; if test "$MediaInfoMpc" = "yes"; then AC_DEFINE(MEDIAINFO_MPC_YES) fi if test "$MediaInfoMpcSv8" = "no"; then AC_DEFINE(MEDIAINFO_MPCSV8_NO) fi; if test "$MediaInfoMpcSv8" = "yes"; then AC_DEFINE(MEDIAINFO_MPCSV8_YES) fi if test "$MediaInfoMpega" = "no"; then AC_DEFINE(MEDIAINFO_MPEGA_NO) fi; if test "$MediaInfoMpega" = "yes"; then AC_DEFINE(MEDIAINFO_MPEGA_YES) fi if test "$MediaInfoPcm" = "no"; then AC_DEFINE(MEDIAINFO_PCM_NO) fi; if test "$MediaInfoPcm" = "yes"; then AC_DEFINE(MEDIAINFO_PCM_YES) fi if test "$MediaInfoPs2a" = "no"; then AC_DEFINE(MEDIAINFO_PS2A_NO) fi; if test "$MediaInfoPs2a" = "yes"; then AC_DEFINE(MEDIAINFO_PS2A_YES) fi if test "$MediaInfoRkau" = "no"; then AC_DEFINE(MEDIAINFO_RKAU_NO) fi; if test "$MediaInfoRkau" = "yes"; then AC_DEFINE(MEDIAINFO_RKAU_YES) fi if test "$MediaInfoSpeex" = "no"; then AC_DEFINE(MEDIAINFO_SPEEX_NO) fi; if test "$MediaInfoSpeex" = "yes"; then AC_DEFINE(MEDIAINFO_SPEEX_YES) fi if test "$MediaInfoTak" = "no"; then AC_DEFINE(MEDIAINFO_TAK_NO) fi; if test "$MediaInfoTak" = "yes"; then AC_DEFINE(MEDIAINFO_TAK_YES) fi if test "$MediaInfoTta" = "no"; then AC_DEFINE(MEDIAINFO_TTA_NO) fi; if test "$MediaInfoTta" = "yes"; then AC_DEFINE(MEDIAINFO_TTA_YES) fi if test "$MediaInfoTwinVQ" = "no"; then AC_DEFINE(MEDIAINFO_TWINVQ_NO) fi; if test "$MediaInfoTwinVQ" = "yes"; then AC_DEFINE(MEDIAINFO_TWINVQ_YES) fi if test "$MediaInfoVorbis" = "no"; then AC_DEFINE(MEDIAINFO_VORBIS_NO) fi; if test "$MediaInfoVorbis" = "yes"; then AC_DEFINE(MEDIAINFO_VORBIS_YES) fi if test "$MediaInfoWvpk" = "no"; then AC_DEFINE(MEDIAINFO_WVPK_NO) fi; if test "$MediaInfoWvpk" = "yes"; then AC_DEFINE(MEDIAINFO_WVPK_YES) fi if test "$MediaInfoBmp" = "no"; then AC_DEFINE(MEDIAINFO_BMP_NO) fi; if test "$MediaInfoBmp" = "yes"; then AC_DEFINE(MEDIAINFO_BMP_YES) fi if test "$MediaInfoDpx" = "no"; then AC_DEFINE(MEDIAINFO_DPX_NO) fi; if test "$MediaInfoDpx" = "yes"; then AC_DEFINE(MEDIAINFO_DPX_YES) fi if test "$MediaInfoExr" = "no"; then AC_DEFINE(MEDIAINFO_EXR_NO) fi; if test "$MediaInfoExr" = "yes"; then AC_DEFINE(MEDIAINFO_EXR_YES) fi if test "$MediaInfoGif" = "no"; then AC_DEFINE(MEDIAINFO_GIF_NO) fi; if test "$MediaInfoGif" = "yes"; then AC_DEFINE(MEDIAINFO_GIF_YES) fi if test "$MediaInfoIco" = "no"; then AC_DEFINE(MEDIAINFO_ICO_NO) fi; if test "$MediaInfoIco" = "yes"; then AC_DEFINE(MEDIAINFO_ICO_YES) fi if test "$MediaInfoJpeg" = "no"; then AC_DEFINE(MEDIAINFO_JPEG_NO) fi; if test "$MediaInfoJpeg" = "yes"; then AC_DEFINE(MEDIAINFO_JPEG_YES) fi if test "$MediaInfoPcx" = "no"; then AC_DEFINE(MEDIAINFO_PCX_NO) fi; if test "$MediaInfoPcx" = "yes"; then AC_DEFINE(MEDIAINFO_PCX_YES) fi if test "$MediaInfoPng" = "no"; then AC_DEFINE(MEDIAINFO_PNG_NO) fi; if test "$MediaInfoPng" = "yes"; then AC_DEFINE(MEDIAINFO_PNG_YES) fi if test "$MediaInfoPsd" = "no"; then AC_DEFINE(MEDIAINFO_PSD_NO) fi; if test "$MediaInfoPsd" = "yes"; then AC_DEFINE(MEDIAINFO_PSD_YES) fi if test "$MediaInfoTiff" = "no"; then AC_DEFINE(MEDIAINFO_TIFF_NO) fi; if test "$MediaInfoTiff" = "yes"; then AC_DEFINE(MEDIAINFO_TIFF_YES) fi if test "$MediaInfoAaf" = "no"; then AC_DEFINE(MEDIAINFO_AAF_NO) fi; if test "$MediaInfoAaf" = "yes"; then AC_DEFINE(MEDIAINFO_AAF_YES) fi if test "$MediaInfoBdav" = "no"; then AC_DEFINE(MEDIAINFO_BDAV_NO) fi; if test "$MediaInfoBdav" = "yes"; then AC_DEFINE(MEDIAINFO_BDAV_YES) fi if test "$MediaInfoBdmv" = "no"; then AC_DEFINE(MEDIAINFO_BDMV_NO) fi; if test "$MediaInfoBdmv" = "yes"; then AC_DEFINE(MEDIAINFO_BDMV_YES) fi if test "$MediaInfoCdxa" = "no"; then AC_DEFINE(MEDIAINFO_CDXA_NO) fi; if test "$MediaInfoCdxa" = "yes"; then AC_DEFINE(MEDIAINFO_CDXA_YES) fi if test "$MediaInfoDashMpd" = "no"; then AC_DEFINE(MEDIAINFO_DASHMPD_NO) fi; if test "$MediaInfoDashMpd" = "yes"; then AC_DEFINE(MEDIAINFO_DASHMPD_YES) fi if test "$MediaInfoDcp" = "no"; then AC_DEFINE(MEDIAINFO_DCP_NO) fi; if test "$MediaInfoDcp" = "yes"; then AC_DEFINE(MEDIAINFO_DCP_YES) fi if test "$MediaInfoDpg" = "no"; then AC_DEFINE(MEDIAINFO_DPG_NO) fi; if test "$MediaInfoDpg" = "yes"; then AC_DEFINE(MEDIAINFO_DPG_YES) fi if test "$MediaInfoReferences" = "no"; then AC_DEFINE(MEDIAINFO_REFERENCES_NO) fi; if test "$MediaInfoReferences" = "yes"; then AC_DEFINE(MEDIAINFO_REFERENCES_YES) fi if test "$MediaInfoDvDif" = "no"; then AC_DEFINE(MEDIAINFO_DVDIF_NO) fi; if test "$MediaInfoDvDif" = "yes"; then AC_DEFINE(MEDIAINFO_DVDIF_YES) fi if test "$MediaInfoDvDifAnalyze" = "no"; then AC_DEFINE(MEDIAINFO_DVDIF_ANALYZE_NO) fi; if test "$MediaInfoDvDifAnalyze" = "yes"; then AC_DEFINE(MEDIAINFO_DVDIF_ANALYZE_YES) fi if test "$MediaInfoDvdv" = "no"; then AC_DEFINE(MEDIAINFO_DVDV_NO) fi; if test "$MediaInfoDvdv" = "yes"; then AC_DEFINE(MEDIAINFO_DVDV_YES) fi if test "$MediaInfoDxw" = "no"; then AC_DEFINE(MEDIAINFO_DXW_NO) fi; if test "$MediaInfoDxw" = "yes"; then AC_DEFINE(MEDIAINFO_DXW_YES) fi if test "$MediaInfoFlv" = "no"; then AC_DEFINE(MEDIAINFO_FLV_NO) fi; if test "$MediaInfoFlv" = "yes"; then AC_DEFINE(MEDIAINFO_FLV_YES) fi if test "$MediaInfoGxf" = "no"; then AC_DEFINE(MEDIAINFO_GXF_NO) fi; if test "$MediaInfoGxf" = "yes"; then AC_DEFINE(MEDIAINFO_GXF_YES) fi if test "$MediaInfohdsF4m" = "no"; then AC_DEFINE(MEDIAINFO_HDSF4M_NO) fi; if test "$MediaInfoHdsF4m" = "yes"; then AC_DEFINE(MEDIAINFO_HDSF4M_YES) fi if test "$MediaInfoHls" = "no"; then AC_DEFINE(MEDIAINFO_HLS_NO) fi; if test "$MediaInfoHls" = "yes"; then AC_DEFINE(MEDIAINFO_HLS_YES) fi if test "$MediaInfoMk" = "no"; then AC_DEFINE(MEDIAINFO_MK_NO) fi; if test "$MediaInfoMk" = "yes"; then AC_DEFINE(MEDIAINFO_MK_YES) fi if test "$MediaInfoMpeg4" = "no"; then AC_DEFINE(MEDIAINFO_MPEG4_NO) fi; if test "$MediaInfoMpeg4" = "yes"; then AC_DEFINE(MEDIAINFO_MPEG4_YES) fi if test "$MediaInfoMpegPs" = "no"; then AC_DEFINE(MEDIAINFO_MPEGPS_NO) fi; if test "$MediaInfoMpegPs" = "yes"; then AC_DEFINE(MEDIAINFO_MPEGPS_YES) fi if test "$MediaInfoMpegTs" = "no"; then AC_DEFINE(MEDIAINFO_MPEGTS_NO) fi; if test "$MediaInfoMpegTs" = "yes"; then AC_DEFINE(MEDIAINFO_MPEGTS_YES) fi if test "$MediaInfoMpegTsPcr" = "no"; then AC_DEFINE(MEDIAINFO_MPEGTS_PCR_NO) fi; if test "$MediaInfoMpegTs" = "yes"; then AC_DEFINE(MEDIAINFO_MPEGTS_PCR_YES) fi if test "$MediaInfoMpegTsPesTimeStamp" = "no"; then AC_DEFINE(MEDIAINFO_MPEGTS_PESTIMESTAMP_NO) fi; if test "$MediaInfoMpegTs" = "yes"; then AC_DEFINE(MEDIAINFO_MPEGTS_PESTIMESTAMP_YES) fi if test "$MediaInfoMxf" = "no"; then AC_DEFINE(MEDIAINFO_MXF_NO) fi; if test "$MediaInfoMxf" = "yes"; then AC_DEFINE(MEDIAINFO_MXF_YES) fi if test "$MediaInfoNut" = "no"; then AC_DEFINE(MEDIAINFO_NUT_NO) fi; if test "$MediaInfoNut" = "yes"; then AC_DEFINE(MEDIAINFO_NUT_YES) fi if test "$MediaInfoOgg" = "no"; then AC_DEFINE(MEDIAINFO_OGG_NO) fi; if test "$MediaInfoOgg" = "yes"; then AC_DEFINE(MEDIAINFO_OGG_YES) fi if test "$MediaInfoPmp" = "no"; then AC_DEFINE(MEDIAINFO_PMP_NO) fi; if test "$MediaInfoPmp" = "yes"; then AC_DEFINE(MEDIAINFO_PMP_YES) fi if test "$MediaInfoRiff" = "no"; then AC_DEFINE(MEDIAINFO_RIFF_NO) fi; if test "$MediaInfoRiff" = "yes"; then AC_DEFINE(MEDIAINFO_RIFF_YES) fi if test "$MediaInfoRm" = "no"; then AC_DEFINE(MEDIAINFO_RM_NO) fi; if test "$MediaInfoRm" = "yes"; then AC_DEFINE(MEDIAINFO_RM_YES) fi if test "$MediaInfoSkm" = "no"; then AC_DEFINE(MEDIAINFO_SKM_NO) fi; if test "$MediaInfoSkm" = "yes"; then AC_DEFINE(MEDIAINFO_SKM_YES) fi if test "$MediaInfoSwf" = "no"; then AC_DEFINE(MEDIAINFO_SWF_NO) fi; if test "$MediaInfoSwf" = "yes"; then AC_DEFINE(MEDIAINFO_SWF_YES) fi if test "$MediaInfoTsp" = "no"; then AC_DEFINE(MEDIAINFO_TSP_NO) fi; if test "$MediaInfoTsp" = "yes"; then AC_DEFINE(MEDIAINFO_TSP_YES) fi if test "$MediaInfoWm" = "no"; then AC_DEFINE(MEDIAINFO_WM_NO) fi; if test "$MediaInfoWm" = "yes"; then AC_DEFINE(MEDIAINFO_WM_YES) fi if test "$MediaInfoApeTag" = "no"; then AC_DEFINE(MEDIAINFO_APETAG_NO) fi; if test "$MediaInfoApeTag" = "yes"; then AC_DEFINE(MEDIAINFO_APETAG_YES) fi if test "$MediaInfoId3" = "no"; then AC_DEFINE(MEDIAINFO_ID3_NO) fi; if test "$MediaInfoId3" = "yes"; then AC_DEFINE(MEDIAINFO_ID3_YES) fi if test "$MediaInfoId3v2" = "no"; then AC_DEFINE(MEDIAINFO_ID3V2_NO) fi; if test "$MediaInfoId3v2" = "yes"; then AC_DEFINE(MEDIAINFO_ID3V2_YES) fi if test "$MediaInfoLyrics3" = "no"; then AC_DEFINE(MEDIAINFO_LYRICS3_NO) fi; if test "$MediaInfoLyrics3" = "yes"; then AC_DEFINE(MEDIAINFO_LYRICS3_YES) fi if test "$MediaInfoLyrics3v2" = "no"; then AC_DEFINE(MEDIAINFO_LYRICS3V2_NO) fi; if test "$MediaInfoLyrics3v2" = "yes"; then AC_DEFINE(MEDIAINFO_LYRICS3V2_YES) fi if test "$MediaInfoVorbisCom" = "no"; then AC_DEFINE(MEDIAINFO_VORBISCOM_NO) fi; if test "$MediaInfoVorbisCom" = "yes"; then AC_DEFINE(MEDIAINFO_VORBISCOM_YES) fi if test "$MediaInfoCmml" = "no"; then AC_DEFINE(MEDIAINFO_CMML_NO) fi; if test "$MediaInfoCmml" = "yes"; then AC_DEFINE(MEDIAINFO_CMML_YES) fi if test "$MediaInfoDvbSubtitle" = "no"; then AC_DEFINE(MEDIAINFO_DVBSUBTITLE_NO) fi; if test "$MediaInfoDvbSubtitle" = "yes"; then AC_DEFINE(MEDIAINFO_DVBSUBTITLE_YES) fi if test "$MediaInfoaribstdb24b37" = "no"; then AC_DEFINE(MEDIAINFO_ARIBSTDB24B37_NO) fi; if test "$MediaInfoaribstdb24b37" = "yes"; then AC_DEFINE(MEDIAINFO_ARIBSTDB24B37_YES) fi if test "$MediaInfoEia608" = "no"; then AC_DEFINE(MEDIAINFO_EIA608_NO) fi; if test "$MediaInfoEia608" = "yes"; then AC_DEFINE(MEDIAINFO_EIA608_YES) fi if test "$MediaInfoEia708" = "no"; then AC_DEFINE(MEDIAINFO_EIA708_NO) fi; if test "$MediaInfoEia708" = "yes"; then AC_DEFINE(MEDIAINFO_EIA708_YES) fi if test "$MediaInfoSubRip" = "no"; then AC_DEFINE(MEDIAINFO_SUBRIP_NO) fi; if test "$MediaInfoSubRip" = "yes"; then AC_DEFINE(MEDIAINFO_SUBRIP_YES) fi if test "$MediaInfoTeletext" = "no"; then AC_DEFINE(MEDIAINFO_TELETEXT_NO) fi; if test "$MediaInfoTeletext" = "yes"; then AC_DEFINE(MEDIAINFO_TELETEXT_YES) fi if test "$MediaInfoTimedText" = "no"; then AC_DEFINE(MEDIAINFO_TIMEDTEXT_NO) fi; if test "$MediaInfoTimedText" = "yes"; then AC_DEFINE(MEDIAINFO_TIMEDTEXT_YES) fi if test "$MediaInfoTtml" = "no"; then AC_DEFINE(MEDIAINFO_TTML_NO) fi; if test "$MediaInfoTtml" = "yes"; then AC_DEFINE(MEDIAINFO_TTML_YES) fi if test "$MediaInfoKate" = "no"; then AC_DEFINE(MEDIAINFO_KATE_NO) fi; if test "$MediaInfoKate" = "yes"; then AC_DEFINE(MEDIAINFO_KATE_YES) fi if test "$MediaInfoPgs" = "no"; then AC_DEFINE(MEDIAINFO_PGS_NO) fi; if test "$MediaInfoPgs" = "yes"; then AC_DEFINE(MEDIAINFO_PGS_YES) fi if test "$MediaInfoScc" = "no"; then AC_DEFINE(MEDIAINFO_PGS_NO) fi; if test "$MediaInfoScc" = "yes"; then AC_DEFINE(MEDIAINFO_PGS_YES) fi if test "$MediaInfoAic" = "no"; then AC_DEFINE(MEDIAINFO_AIC_NO) fi; if test "$MediaInfoAic" = "yes"; then AC_DEFINE(MEDIAINFO_AIC_YES) fi if test "$MediaInfoAvc" = "no"; then AC_DEFINE(MEDIAINFO_AVC_NO) fi; if test "$MediaInfoAvc" = "yes"; then AC_DEFINE(MEDIAINFO_AVC_YES) fi if test "$MediaInfoAvsV" = "no"; then AC_DEFINE(MEDIAINFO_AVSV_NO) fi; if test "$MediaInfoAvsV" = "yes"; then AC_DEFINE(MEDIAINFO_AVSV_YES) fi if test "$MediaInfoCanopus" = "no"; then AC_DEFINE(MEDIAINFO_CANOPUS_NO) fi; if test "$MediaInfoCanopus" = "yes"; then AC_DEFINE(MEDIAINFO_CANOPUS_YES) fi if test "$MediaInfoFlic" = "no"; then AC_DEFINE(MEDIAINFO_FLIC_NO) fi; if test "$MediaInfoFlic" = "yes"; then AC_DEFINE(MEDIAINFO_FLIC_YES) fi if test "$MediaInfoH263" = "no"; then AC_DEFINE(MEDIAINFO_H263_NO) fi; if test "$MediaInfoH263" = "yes"; then AC_DEFINE(MEDIAINFO_H263_YES) fi if test "$MediaInfoHevc" = "no"; then AC_DEFINE(MEDIAINFO_HEVC_NO) fi; if test "$MediaInfoHevc" = "yes"; then AC_DEFINE(MEDIAINFO_Hevc_YES) fi if test "$MediaInfoMpeg4v" = "no"; then AC_DEFINE(MEDIAINFO_MPEG4V_NO) fi; if test "$MediaInfoMpeg4v" = "yes"; then AC_DEFINE(MEDIAINFO_MPEG4V_YES) fi if test "$MediaInfoMpegv" = "no"; then AC_DEFINE(MEDIAINFO_MPEGV_NO) fi; if test "$MediaInfoMpegv" = "yes"; then AC_DEFINE(MEDIAINFO_MPEGV_YES) fi if test "$MediaInfoProRes" = "no"; then AC_DEFINE(MEDIAINFO_PRORES_NO) fi; if test "$MediaInfoProRes" = "yes"; then AC_DEFINE(MEDIAINFO_PRORES_YES) fi if test "$MediaInfoTheora" = "no"; then AC_DEFINE(MEDIAINFO_THEORA_NO) fi; if test "$MediaInfoTheora" = "yes"; then AC_DEFINE(MEDIAINFO_THEORA_YES) fi if test "$MediaInfoVc1" = "no"; then AC_DEFINE(MEDIAINFO_VC1_NO) fi; if test "$MediaInfoVc1" = "yes"; then AC_DEFINE(MEDIAINFO_VC1_YES) fi if test "$MediaInfoVc3" = "no"; then AC_DEFINE(MEDIAINFO_VC3_NO) fi; if test "$MediaInfoVc3" = "yes"; then AC_DEFINE(MEDIAINFO_VC3_YES) fi if test "$MediaInfoVp8" = "no"; then AC_DEFINE(MEDIAINFO_VP8_NO) fi; if test "$MediaInfoVp8" = "yes"; then AC_DEFINE(MEDIAINFO_VP8_YES) fi if test "$MediaInfoY4m" = "no"; then AC_DEFINE(MEDIAINFO_Y4M_NO) fi; if test "$MediaInfoY4m" = "yes"; then AC_DEFINE(MEDIAINFO_Y4M_YES) fi dnl ######################################################################### dnl ### Options from elsewhere dnl ######################################################################### dnl ------------------------------------------------------------------------- dnl Unicode dnl if test -e ../../../../ZenLib/Project/GNU/Library/libzen-config; then enable_unicode="$(../../../../ZenLib/Project/GNU/Library/libzen-config Unicode)" elif test "$(command -v libzen-config)" ; then enable_unicode="$(libzen-config Unicode)" else if pkg-config --exists libzen; then enable_unicode="$(pkg-config --variable=Unicode libzen)" else AC_MSG_ERROR([libzen configuration is not found]) fi fi dnl ######################################################################### dnl ### Needed libs dnl ######################################################################### dnl ------------------------------------------------------------------------- dnl zlib dnl if test "$with_libz_static" != "yes"; then AC_CHECK_LIB(z, uncompress, [have_libz="yes"], [have_libz="no"]) AC_CHECK_HEADERS(zlib.h, [], [have_libz="no"]) else have_libz="no" fi if test "$have_libz" != "yes"; then if test -e ../../../../Shared/Source/zlib/libz.a || test -e ../../../../Shared/Source/zlib/libz.la; then with_zlib="builtin" else AC_MSG_NOTICE([zlib is not found, trying to download and compile it]) if test -e ../../../../Shared/Project/zlib/Compile.sh; then cd ../../../../Shared/Project/zlib chmod u+x Compile.sh ./Compile.sh --build=$build_alias cd $Home if test -e ../../../../Shared/Source/zlib/libz.a || test -e ../../../../Shared/Source/zlib/libz.la; then with_zlib="builtin" else with_zlib="no" AC_MSG_ERROR([Problem while compiling builtin zlib]) fi else with_zlib="no" AC_MSG_ERROR([zlib is not found, please install development package of zlib]) fi fi CXXFLAGS="$CXXFLAGS -I../../../../Shared/Source/zlib" LIBS="$LIBS -L../../../../Shared/Source/zlib" MediaInfoLib_LIBS="$MediaInfoLib_LIBS -L../../../../Shared/Source/zlib -lz" MediaInfoLib_LIBS_Static="$MediaInfoLib_LIBS_Static -L../../../../Shared/Source/zlib -lz" else with_zlib="system" LIBS="$LIBS -lz" MediaInfoLib_LIBS="$MediaInfoLib_LIBS -lz" MediaInfoLib_LIBS_Static="$MediaInfoLib_LIBS_Static -lz" fi dnl ------------------------------------------------------------------------- dnl ZenLib dnl if test -e ../../../../ZenLib/Project/GNU/Library/libzen.la; then CXXFLAGS="$CXXFLAGS $(../../../../ZenLib/Project/GNU/Library/libzen-config CXXFLAGS)" if test "$enable_staticlibs" = "yes"; then with_zenlib="builtin (static)" LIBS="$LIBS $(../../../../ZenLib/Project/GNU/Library/libzen-config LIBS_Static)" else with_zenlib="builtin" LIBS="$LIBS $(../../../../ZenLib/Project/GNU/Library/libzen-config LIBS)" MediaInfoLib_LIBS="$MediaInfoLib_LIBS $(../../../../ZenLib/Project/GNU/Library/libzen-config LIBS)" MediaInfoLib_LIBS_Static="$MediaInfoLib_LIBS_Static $(../../../../ZenLib/Project/GNU/Library/libzen-config LIBS)" fi elif test "$(command -v libzen-config)" ; then CXXFLAGS="$CXXFLAGS $(libzen-config CXXFLAGS)" if test "$enable_staticlibs" = "yes"; then with_zenlib="system (static)" LIBS="$LIBS $(libzen-config LIBS_Static)" else with_zenlib="system" LIBS="$LIBS $(libzen-config LIBS)" MediaInfoLib_LIBS="$MediaInfoLib_LIBS $(libzen-config LIBS)" MediaInfoLib_LIBS_Static="$MediaInfoLib_LIBS_Static $(libzen-config LIBS)" fi else if pkg-config --exists libzen; then CXXFLAGS="$CXXFLAGS $(pkg-config --cflags libzen)" if test "$enable_staticlibs" = "yes"; then with_zenlib="system (static)" LIBS="$LIBS $(pkg-config --variable=LIBS_Static libzen)" else with_zenlib="system" LIBS="$LIBS $(pkg-config --libs libzen)" MediaInfoLib_LIBS="$MediaInfoLib_LIBS $(pkg-config --libs libzen)" MediaInfoLib_LIBS_Static="$MediaInfoLib_LIBS_Static $(pkg-config --variable=LIBS libzen)" fi else AC_MSG_ERROR([libzen configuration is not found]) fi fi dnl ------------------------------------------------------------------------- dnl libcurl dnl if test -d $with_libcurl; then if test -f $with_libcurl/libcurl.pc; then libcurlpcfile="$with_libcurl/libcurl.pc" else if test -f "$with_libcurl/lib/pkgconfig/libcurl.pc"; then libcurlpcfile="$with_libcurl/lib/pkgconfig/libcurl.pc" else AC_MSG_ERROR([Problem while configuring builtin curl (libcurl.pc not found)]) fi fi CXXFLAGS="$CXXFLAGS $(pkg-config --cflags $libcurlpcfile)" if test "$enable_staticlibs" = "yes"; then using_libcurl="custom (static)" LIBS="$LIBS $(pkg-config --libs --static $libcurlpcfile)" MediaInfoLib_LIBS_Static="$MediaInfoLib_LIBS_Static $(pkg-config --libs --static $libcurlpcfile)" else using_libcurl="custom" LIBS="$LIBS $with_libcurl/lib $(pkg-config --libs $libcurlpcfile)" MediaInfoLib_LIBS="$MediaInfoLib_LIBS $(pkg-config --libs $libcurlpcfile)" fi elif test "$with_libcurl" = "no"; then CXXFLAGS="$CXXFLAGS -DMEDIAINFO_LIBCURL_NO" using_libcurl="no" elif test -e ../../../../curl/libcurl.pc; then CXXFLAGS="$CXXFLAGS -I../../../../curl/include" if test "$enable_staticlibs" = "yes"; then using_libcurl="builtin (static)" LIBS="$LIBS $(pkg-config --libs --static ../../../../curl/libcurl.pc)" else using_libcurl="builtin" LIBS="$LIBS $(pkg-config --libs ../../../../curl/libcurl.pc)" MediaInfoLib_LIBS="$MediaInfoLib_LIBS $(pkg-config --libs ../../../../curl/libcurl.pc)" MediaInfoLib_LIBS_Static="$MediaInfoLib_LIBS_Static $(pkg-config --libs ../../../../curl/libcurl.pc)" fi elif pkg-config --exists libcurl; then CXXFLAGS="$CXXFLAGS $(pkg-config --cflags libcurl)" if test "$enable_staticlibs" = "yes"; then using_libcurl="system (static)" LIBS="$LIBS $(pkg-config --libs --static libcurl)" else using_libcurl="system" LIBS="$LIBS $(pkg-config --libs libcurl)" MediaInfoLib_LIBS="$MediaInfoLib_LIBS $(pkg-config --libs libcurl)" MediaInfoLib_LIBS_Static="$MediaInfoLib_LIBS_Static $(pkg-config --libs libcurl)" fi elif test -e /usr/bin/curl-config; then CXXFLAGS="$CXXFLAGS $(/usr/bin/curl-config --cflags)" if test "$enable_staticlibs" = "yes"; then using_libcurl="system (static)" LIBS="$LIBS $(/usr/bin/curl-config --libs)" else using_libcurl="system" LIBS="$LIBS $(pkg-config --libs libcurl)" MediaInfoLib_LIBS="$MediaInfoLib_LIBS $(/usr/bin/curl-config --libs)" MediaInfoLib_LIBS_Static="$MediaInfoLib_LIBS_Static $(/usr/bin/curl-config --libs)" fi elif test -e ../../../../Shared/Project/curl/Compile.sh; then cd ../../../../Shared/Project/curl chmod u+x Compile.sh ./Compile.sh --build=$build_alias cd $Home if test -e ../../../../Shared/Source/curl/lib/libcurl.a || test -e ../../../../Shared/Source/curl/lib/libcurl.la; then CXXFLAGS="$CXXFLAGS -I../../../../Shared/Source/curl/include" if test "$enable_staticlibs" = "yes"; then using_libcurl="builtin (static)" LIBS="$LIBS -L../../../../Shared/Source/curl/lib $(pkg-config --libs --static ../../../../Shared/Source/curl/libcurl.pc)" MediaInfoLib_LIBS="$MediaInfoLib_LIBS -L../../../../Shared/Source/curl/lib $(pkg-config --libs --static ../../../../Shared/Source/curl/libcurl.pc)" MediaInfoLib_LIBS_Static="$MediaInfoLib_LIBS_Static -L../../../../Shared/Source/curl/lib $(pkg-config --libs --static ../../../../Shared/Source/curl/libcurl.pc)" else using_libcurl="builtin" LIBS="$LIBS -L../../../../Shared/Source/curl/lib $(pkg-config --libs ../../../../Shared/Source/curl/libcurl.pc)" MediaInfoLib_LIBS="$MediaInfoLib_LIBS -L../../../../Shared/Source/curl/lib $(pkg-config --libs ../../../../Shared/Source/curl/libcurl.pc)" MediaInfoLib_LIBS_Static="$MediaInfoLib_LIBS_Static -L../../../../Shared/Source/curl/lib $(pkg-config --libs ../../../../Shared/Source/curl/libcurl.pc)" fi else AC_MSG_ERROR([Problem while compiling builtin curl]) fi else AC_MSG_ERROR([libcurl development files are not found. Install the corresponding libcurl development package (e.g. "apt-get install libcurl-dev" or "yum install libcurl-devel"]) fi dnl ------------------------------------------------------------------------- dnl libmms dnl if test -d $with_libmms; then CXXFLAGS="$CXXFLAGS -DMEDIAINFO_LIBMMS_FROMSOURCE -I$with_libmms/src $(pkg-config --cflags $with_libmms/pkgconfig/libmms.pc)" MediaInfoLib_CXXFLAGS="$MediaInfoLib_CXXFLAGS -I$with_libmms $(pkg-config --cflags $with_libmms/pkgconfig/libmms.pc)" if test "$enable_staticlibs" = "yes"; then using_libmms="custom (static)" LIBS="$LIBS -L$with_libmms/src/.libs $(pkg-config --libs --static $with_libmms/pkgconfig/libmms.pc)" MediaInfoLib_LIBS_Static="$MediaInfoLib_LIBS_Static -L$with_libmms/src/.libs $(pkg-config --libs --static $with_libmms/pkgconfig/libmms.pc)" else using_libmms="custom" LIBS="$LIBS -L$with_libmms/src/.libs $(pkg-config --libs $with_libmms/pkgconfig/libmms.pc)" MediaInfoLib_LIBS="$MediaInfoLib_LIBS -L$with_libmms/src/.libs $(pkg-config --libs $with_libmms/pkgconfig/libmms.pc)" fi elif test "$with_libmms" = "no"; then CXXFLAGS="$CXXFLAGS -DMEDIAINFO_LIBMMS_NO" using_libmms="no" elif test -e ../../../../libmms/libmms.pc; then CXXFLAGS="$CXXFLAGS $(pkg-config --cflags ../../../../libmms/libmms.pc)" MediaInfoLib_CXXFLAGS="$MediaInfoLib_CXXFLAGS $(pkg-config --cflags ../../../../libmms/libmms.pc)" if test "$enable_staticlibs" = "yes"; then using_libmms="builtin (static)" LIBS="$LIBS $(pkg-config --libs --static ../../../../libmms/libmms.pc)" else using_libmms="builtin" LIBS="$LIBS $(pkg-config --libs ../../../../libmms/libmms.pc)" MediaInfoLib_LIBS="$MediaInfoLib_LIBS $(pkg-config --libs ../../../../libmms/libmms.pc)" MediaInfoLib_LIBS_Static="$MediaInfoLib_LIBS_Static $(pkg-config --libs ../../../../libmms/libmms.pc)" fi elif pkg-config --exists libmms; then CXXFLAGS="$CXXFLAGS $(pkg-config --cflags libmms)" MediaInfoLib_CXXFLAGS="$MediaInfoLib_CXXFLAGS $(pkg-config --cflags libmms)" if test "$enable_staticlibs" = "yes"; then using_libmms="system (static)" LIBS="$LIBS $(pkg-config --libs --static libmms)" else using_libmms="system" LIBS="$LIBS $(pkg-config --libs libmms)" MediaInfoLib_LIBS="$MediaInfoLib_LIBS $(pkg-config --libs libmms)" MediaInfoLib_LIBS_Static="$MediaInfoLib_LIBS_Static $(pkg-config --libs libmms)" fi else CXXFLAGS="$CXXFLAGS -DMEDIAINFO_LIBMMS_NO" using_libmms="not found" fi dnl ------------------------------------------------------------------------- dnl libmd5 dnl if test "$with_libmd5" = "yes"; then PKG_CHECK_MODULES([MD5], [md5]) CXXFLAGS="$CXXFLAGS $MD5_CXXFLAGS" CFLAGS="$CFLAGS $MD5_CFLAGS" MediaInfoLib_CFLAGS="$MediaInfoLib_CFLAGS $MD5_CFLAGS" LIBS="$LIBS $MD5_LIBS" MediaInfoLib_LIBS="$MediaInfoLib_LIBS $MD5_LIBS" AM_CONDITIONAL(COMPILE_MD5, false) using_libmd5="system" else CXXFLAGS="$CXXFLAGS -I../../../Source/ThirdParty/md5" CFLAGS="$CFLAGS -I../../../Source/ThirdParty/md5" using_libmd5="internal" AM_CONDITIONAL(COMPILE_MD5, true) fi dnl ------------------------------------------------------------------------- dnl libtinyxml2 dnl if test "$with_libtinyxml2" = "yes"; then PKG_CHECK_MODULES([TINYXML2], [tinyxml2]) CXXFLAGS="$CXXFLAGS $TINYXML2_CXXFLAGS" MediaInfoLib_CXXFLAGS="$MediaInfoLib_CXXFLAGS $TINYXML2_CXXFLAGS" LIBS="$LIBS $TINYXML2_LIBS" MediaInfoLib_LIBS="$MediaInfoLib_LIBS $TINYXML2_LIBS" AM_CONDITIONAL(COMPILE_TINYXML2, false) using_libtinyxml2="system" else CXXFLAGS="$CXXFLAGS -I../../../Source/ThirdParty/tinyxml2" using_libtinyxml2="internal" AM_CONDITIONAL(COMPILE_TINYXML2, true) fi dnl ------------------------------------------------------------------------- dnl libmediainfo-name dnl MediaInfoLib_LibName="$with_libmediainfo_name" dnl ------------------------------------------------------------------------- dnl base64 dnl CXXFLAGS="$CXXFLAGS -I../../../Source/ThirdParty/base64" dnl ######################################################################### dnl ### Compiler specific dnl ######################################################################### dnl ------------------------------------------------------------------------- case "${build}" in powerpc-montavista* ) CFLAGS="$CFLAGS -D__MONTAVISTA__" CXXFLAGS="$CXXFLAGS -D__MONTAVISTA__" ;; powerpc64-* ) enable_visibility="no" ;; esac dnl ------------------------------------------------------------------------- dnl Mac Architecture and SDK dnl if test "$enable_universal_binary" = "yes"; then enable_arch_ppc=yes enable_arch_i386=yes if test "$with_macosx_sdk" = no ; then with_macosx_sdk="/Developer/SDKs/MacOSX10.4u.sdk" fi if test "$with_macosx_version_min" = no ; then with_macosx_version_min="10.4" fi fi if test "$enable_arch_ppc" = "yes"; then CXXFLAGS="$CXXFLAGS -arch ppc" CFLAGS="$CFLAGS -arch ppc" LDFLAGS="$LDFLAGS -arch ppc" fi if test "$enable_arch_ppc64" = "yes"; then CXXFLAGS="$CXXFLAGS -arch ppc64" CFLAGS="$CFLAGS -arch ppc64" LDFLAGS="$LDFLAGS -arch ppc64" fi if test "$enable_arch_i386" = "yes"; then CXXFLAGS="$CXXFLAGS -arch i386" CFLAGS="$CFLAGS -arch i386" LDFLAGS="$LDFLAGS -arch i386" fi if test "$enable_arch_x86_64" = "yes"; then CXXFLAGS="$CXXFLAGS -arch x86_64" CFLAGS="$CFLAGS -arch x86_64" LDFLAGS="$LDFLAGS -arch x86_64" fi if test "$with_macosx_sdk" = "yes" ; then CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS" CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS" LDFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $LDFLAGS" elif test "x$with_macosx_sdk" != xno ; then CXXFLAGS="-isysroot $with_macosx_sdk $CXXFLAGS" CFLAGS="-isysroot $with_macosx_sdk $CFLAGS" LDFLAGS="-isysroot $with_macosx_sdk $LDFLAGS" fi if test "x$with_macosx_version_min" != xno ; then CXXFLAGS="-mmacosx-version-min=$with_macosx_version_min $CXXFLAGS" CFLAGS="-mmacosx-version-min=$with_macosx_version_min $CFLAGS" LDFLAGS="-mmacosx-version-min=$with_macosx_version_min $LDFLAGS" fi dnl ######################################################################### dnl ### C/C++ compiler options used to compile dnl ######################################################################### dnl ------------------------------------------------------------------------- dnl Unicode dnl if test "$enable_unicode" = "yes"; then CXXFLAGS="$CXXFLAGS -DUNICODE" MediaInfoLib_CXXFLAGS="$MediaInfoLib_CXXFLAGS -DUNICODE" MediaInfoLib_Unicode="yes" else MediaInfoLib_Unicode="no" fi dnl ------------------------------------------------------------------------- dnl GNU compiler dnl if test "$GXX" = yes ; then CFLAGS="$CFLAGS -fPIC" CXXFLAGS="$CXXFLAGS -fPIC" LDFLAGS="$LDFLAGS -fPIC" if test "$enable_debug" = "yes"; then CFLAGS="$CFLAGS -O0 -g -Wall -Wundef" CXXFLAGS="$CXXFLAGS -O0 -g -Wall -W -Wundef -Wcast-qual -Wno-ctor-dtor-privacy" else CFLAGS="$CFLAGS -O2" CXXFLAGS="$CXXFLAGS -O2" fi if test "$enable_gprof" = "yes"; then CFLAGS="$CFLAGS -pg -g" CXXFLAGS="$CXXFLAGS -pg -g" fi fi if test "$enable_visibility" = yes ; then if test -e "/etc/debian_version" ; then Debian_Version="$(more /etc/debian_version)" case $Debian_Version in *4.*) enable_visibility="no" ;; esac fi fi if test "$enable_visibility" = yes ; then CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden" CXXFLAGS="$CXXFLAGS -fvisibility=hidden -fvisibility-inlines-hidden" LDFLAGS="$LDFLAGS -fvisibility=hidden -fvisibility-inlines-hidden" fi dnl ######################################################################### dnl ### MediaInfoLib flags dnl ######################################################################### MediaInfoLib_LIBS=" -L$(pwd) -l$with_libmediainfo_name $MediaInfoLib_LIBS" MediaInfoLib_LIBS_Static=" $(pwd)/.libs/lib$with_libmediainfo_name.a $MediaInfoLib_LIBS_Static" dnl ######################################################################### dnl ### Output dnl ######################################################################### AC_SUBST(MediaInfoLib_CXXFLAGS) AC_SUBST(MediaInfoLib_LIBS) AC_SUBST(MediaInfoLib_LIBS_Static) AC_SUBST(MediaInfoLib_Unicode) AC_SUBST(MediaInfoLib_LibName) AC_CONFIG_FILES(libmediainfo-config, [chmod u+x libmediainfo-config]) AC_CONFIG_FILES(libmediainfo.pc) AC_OUTPUT(Makefile) dnl ######################################################################### dnl ### Report how we have been configured dnl ######################################################################### Mcho () { if test "$2" = "no" || test "$2" = "yes"; then echo " $1 forced to $2" fi } echo "" echo "Configured MediaInfoLib for '$build'" echo "" echo " Unicode? $enable_unicode" echo " Using ZenLib? $with_zenlib" echo " Using libcurl? $using_libcurl" echo " Using libmms? $using_libmms" echo " Using zlib? $with_zlib" echo " Using md5? $using_libmd5" echo " Using tinyxml2? $using_libtinyxml2" echo "" echo " Create static lib? $enable_static" echo " Create shared lib? $enable_shared" echo "" Mcho "Minimize size" "$MediaInfoMinimizeSize" Mcho "libmms describe support" "$MediaInfoLibmmsDescribeSupport" Mcho "All " "$MediaInfoAll" Mcho "Archive" "$MediaInfoArchive" Mcho "Audio " "$MediaInfoAudio" Mcho "Image " "$MediaInfoImage" Mcho "Multi " "$MediaInfoMulti" Mcho "Multi " "$MediaInfoTag" Mcho "Text " "$MediaInfoText" Mcho "Video " "$MediaInfoVideo" Mcho "7z " "$MediaInfo7z" Mcho "Ace " "$MediaInfoAce" Mcho "Bzip2 " "$MediaInfoBzip2" Mcho "Elf " "$MediaInfoElf" Mcho "Gzip " "$MediaInfoGzip" Mcho "ISO9660" "$MediaInfoIso9660" Mcho "Mz " "$MediaInfoMz" Mcho "Rar " "$MediaInfoRar" Mcho "Tar " "$MediaInfoTar" Mcho "Zip " "$MediaInfoZip" Mcho "Aac " "$MediaInfoAac" Mcho "Ac3 " "$MediaInfoAc3" Mcho "Adif " "$MediaInfoAdif" Mcho "Adpcm " "$MediaInfoAdpcm" Mcho "Adts " "$MediaInfoAdts" Mcho "Aes3 " "$MediaInfoAes3" Mcho "Als " "$MediaInfoAls" Mcho "Amr " "$MediaInfoAmr" Mcho "Amv " "$MediaInfoAmv" Mcho "Ape " "$MediaInfoApe" Mcho "Au " "$MediaInfoAu" Mcho "Celt " "$MediaInfoCelt" Mcho "Dts " "$MediaInfoDts" Mcho "Flac " "$MediaInfoFlac" Mcho "La " "$MediaInfoLa" Mcho "Latm " "$MediaInfoLatm" Mcho "Midi " "$MediaInfoMidi" Mcho "Mpc " "$MediaInfoMpc" Mcho "MpcSv8 " "$MediaInfoMpcSv8" Mcho "Mpega " "$MediaInfoMpega" Mcho "Pcm " "$MediaInfoPcm" Mcho "Ps2a " "$MediaInfoPs2a" Mcho "Rkau " "$MediaInfoRkau" Mcho "Speex " "$MediaInfoSpeex" Mcho "Tak " "$MediaInfoTak" Mcho "Tta " "$MediaInfoTta" Mcho "TwinVQ " "$MediaInfoTwinVQ" Mcho "Vorbis " "$MediaInfoVorbis" Mcho "Wvpk " "$MediaInfoWvpk" Mcho "Bmp " "$MediaInfoBmp" Mcho "Dpx " "$MediaInfoDpx" Mcho "Exr " "$MediaInfoDpx" Mcho "Gif " "$MediaInfoGif" Mcho "Ico " "$MediaInfoIco" Mcho "Jpeg " "$MediaInfoJpeg" Mcho "Pcx " "$MediaInfoPcx" Mcho "Png " "$MediaInfoPng" Mcho "Psd " "$MediaInfoPsd" Mcho "Tiff " "$MediaInfoTiff" Mcho "Aaf " "$MediaInfoAaf" Mcho "Bdav " "$MediaInfoBdav" Mcho "Bdmv " "$MediaInfoBdmv" Mcho "Cdxa " "$MediaInfoCdxa" Mcho "DASH " "$MediaInfoDashMpd" Mcho "Dcp " "$MediaInfoDcp" Mcho "Dpg " "$MediaInfoDpg" Mcho "References" "$References" Mcho "DvDif " "$MediaInfoDvDif" Mcho "DvDifAnalyze" "$MediaInfoDvDifAnalyze" Mcho "Dvdv " "$MediaInfoDvdv" Mcho "Dxw " "$MediaInfoFlv" Mcho "Gxf " "$MediaInfoHdsGxf" Mcho "HdsF4m " "$MediaInfoHdsF4m" Mcho "Hls " "$MediaInfoHls" Mcho "Flv " "$MediaInfoFlv" Mcho "Mk " "$MediaInfoMk" Mcho "Mpeg4 " "$MediaInfoMpeg4" Mcho "MpegPs " "$MediaInfoMpegPs" Mcho "MpegTs " "$MediaInfoMpegTs" Mcho "MpegTs (PCR)" "$MediaInfoMpegTsPcr" Mcho "MpegTs (Parser time stamp)" "$MediaInfoMpegTsPesTimeStamp" Mcho "Mxf " "$MediaInfoMxf" Mcho "Nut " "$MediaInfoNut" Mcho "Ogg " "$MediaInfoOgg" Mcho "Pmp " "$MediaInfoPmp" Mcho "Riff " "$MediaInfoRiff" Mcho "Rm " "$MediaInfoRm" Mcho "Skm " "$MediaInfoSkm" Mcho "Swf " "$MediaInfoSwf" Mcho "Tsp " "$MediaInfoTsp" Mcho "Wm " "$MediaInfoWm" Mcho "ApeTag " "$MediaInfoApeTag" Mcho "Id3 " "$MediaInfoId3" Mcho "Id3v2 " "$MediaInfoId3v2" Mcho "Lyrics3" "$MediaInfoLyrics3" Mcho "Lyrics3v2" "$MediaInfoLyrics3v2" Mcho "VorbisCom" "$MediaInfoVorbisCom" Mcho "Cmml " "$MediaInfoCmml" Mcho "DvbSubtitle " "$MediaInfoDvbSubtitle" Mcho "Eia608 " "$MediaInfoEia608" Mcho "Eia708 " "$MediaInfoEia708" Mcho "SubRip " "$MediaInfoSubRip" Mcho "Teletext " "$MediaInfoTeletext" Mcho "TimedText " "$MediaInfoTimedText" Mcho "Ttml " "$MediaInfoTtml" Mcho "Kate " "$MediaInfoKate" Mcho "Pgs " "$MediaInfoPgs" Mcho "Scc " "$MediaInfoScc" Mcho "Aic " "$MediaInfoAic" Mcho "Avc " "$MediaInfoAvc" Mcho "AvsV " "$MediaInfoAvsV" Mcho "Canopus" "$MediaInfoCanopus" Mcho "Flic " "$MediaInfoFlic" Mcho "H263 " "$MediaInfoH263" Mcho "Hevc " "$MediaInfoHevc" Mcho "Mpeg4v " "$MediaInfoMpeg4v" Mcho "Mpegv " "$MediaInfoMpegv" Mcho "ProRes " "$MediaInfoProRes" Mcho "Theora " "$MediaInfoTheora" Mcho "Vc1 " "$MediaInfoVc1" Mcho "Vc3 " "$MediaInfoVc3" Mcho "VP8 " "$MediaInfoVp8" Mcho "Y4m " "$MediaInfoY4m" echo "" echo " CXXFLAGS: $CXXFLAGS" echo " LDFLAGS: $LDFLAGS" echo " LIBS: $LIBS" MediaInfoLib/Project/GNU/Library/libmediainfo-config.in100777 0 0 567 12226004263 16324 0#!/bin/bash if test "$1" = "CXXFLAGS"; then echo @MediaInfoLib_CXXFLAGS@ fi if test "$1" = "LIBS"; then echo @MediaInfoLib_LIBS@ fi if test "$1" = "LIBS_Static"; then echo @MediaInfoLib_LIBS_Static@ fi if test "$1" = "Unicode"; then echo @MediaInfoLib_Unicode@ fi if test "$1" = "Exists"; then echo yes fi if test "$1" = "la_name"; then echo lib@MediaInfoLib_LibName@.la fi MediaInfoLib/Project/GNU/Library/libmediainfo.pc.in100777 0 0 653 12226004263 15456 0prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Unicode=@MediaInfoLib_Unicode@ Libs_Static=@libdir@/lib@MediaInfoLib_LibName@.a ${libdir}/libzen.a -lpthread -lz la_name=lib@MediaInfoLib_LibName@.la Name: libmediainfo Version: @PACKAGE_VERSION@ Description: MediaInfoLib Libs: -L@libdir@ -l@MediaInfoLib_LibName@ -lzen -lz -lpthread Cflags: -I@includedir@ @MediaInfoLib_CXXFLAGS@ MediaInfoLib/Project/GNU/Library/Makefile.am100777 0 0 34662 12262536270 14216 0AUTOMAKE_OPTIONS = foreign lib_LTLIBRARIES = lib@MediaInfoLib_LibName@.la lib@MediaInfoLib_LibName@_la_SOURCES = \ ../../../Source/MediaInfo/File__Analyze.cpp \ ../../../Source/MediaInfo/File__Analyze_Buffer.cpp \ ../../../Source/MediaInfo/File__Analyze_Buffer_MinimizeSize.cpp \ ../../../Source/MediaInfo/File__Analyze_Streams.cpp \ ../../../Source/MediaInfo/File__Analyze_Streams_Finish.cpp \ ../../../Source/MediaInfo/File__Base.cpp \ ../../../Source/MediaInfo/File__MultipleParsing.cpp \ ../../../Source/MediaInfo/File__Duplicate.cpp \ ../../../Source/MediaInfo/File_Dummy.cpp \ ../../../Source/MediaInfo/File_Other.cpp \ ../../../Source/MediaInfo/File_Unknown.cpp \ ../../../Source/MediaInfo/MediaInfo.cpp \ ../../../Source/MediaInfo/MediaInfo_Config.cpp \ ../../../Source/MediaInfo/MediaInfo_Config_Automatic.cpp \ ../../../Source/MediaInfo/MediaInfo_Config_MediaInfo.cpp \ ../../../Source/MediaInfo/MediaInfo_File.cpp \ ../../../Source/MediaInfo/MediaInfo_Inform.cpp \ ../../../Source/MediaInfo/MediaInfo_Internal.cpp \ ../../../Source/MediaInfo/MediaInfoList.cpp \ ../../../Source/MediaInfo/MediaInfoList_Internal.cpp \ ../../../Source/MediaInfo/TimeCode.cpp \ ../../../Source/MediaInfo/Archive/File_7z.cpp \ ../../../Source/MediaInfo/Archive/File_Ace.cpp \ ../../../Source/MediaInfo/Archive/File_Bzip2.cpp \ ../../../Source/MediaInfo/Archive/File_Elf.cpp \ ../../../Source/MediaInfo/Archive/File_Gzip.cpp \ ../../../Source/MediaInfo/Archive/File_Iso9660.cpp \ ../../../Source/MediaInfo/Archive/File_Mz.cpp \ ../../../Source/MediaInfo/Archive/File_Rar.cpp \ ../../../Source/MediaInfo/Archive/File_Tar.cpp \ ../../../Source/MediaInfo/Archive/File_Zip.cpp \ ../../../Source/MediaInfo/Audio/File_Aac.cpp \ ../../../Source/MediaInfo/Audio/File_Aac_GeneralAudio.cpp \ ../../../Source/MediaInfo/Audio/File_Aac_GeneralAudio_Sbr.cpp \ ../../../Source/MediaInfo/Audio/File_Aac_GeneralAudio_Sbr_Ps.cpp \ ../../../Source/MediaInfo/Audio/File_Aac_Main.cpp \ ../../../Source/MediaInfo/Audio/File_Aac_Others.cpp \ ../../../Source/MediaInfo/Audio/File_Ac3.cpp \ ../../../Source/MediaInfo/Audio/File_Adpcm.cpp \ ../../../Source/MediaInfo/Audio/File_Als.cpp \ ../../../Source/MediaInfo/Audio/File_Amr.cpp \ ../../../Source/MediaInfo/Audio/File_Amv.cpp \ ../../../Source/MediaInfo/Audio/File_Ape.cpp \ ../../../Source/MediaInfo/Audio/File_Au.cpp \ ../../../Source/MediaInfo/Audio/File_Celt.cpp \ ../../../Source/MediaInfo/Audio/File_ChannelGrouping.cpp \ ../../../Source/MediaInfo/Audio/File_Dts.cpp \ ../../../Source/MediaInfo/Audio/File_DolbyE.cpp \ ../../../Source/MediaInfo/Audio/File_ExtendedModule.cpp \ ../../../Source/MediaInfo/Audio/File_Flac.cpp \ ../../../Source/MediaInfo/Audio/File_ImpulseTracker.cpp \ ../../../Source/MediaInfo/Audio/File_La.cpp \ ../../../Source/MediaInfo/Audio/File_Midi.cpp \ ../../../Source/MediaInfo/Audio/File_Module.cpp \ ../../../Source/MediaInfo/Audio/File_Mpc.cpp \ ../../../Source/MediaInfo/Audio/File_MpcSv8.cpp \ ../../../Source/MediaInfo/Audio/File_Mpega.cpp \ ../../../Source/MediaInfo/Audio/File_Opus.cpp \ ../../../Source/MediaInfo/Audio/File_Pcm.cpp \ ../../../Source/MediaInfo/Audio/File_Pcm_M2ts.cpp \ ../../../Source/MediaInfo/Audio/File_Pcm_Vob.cpp \ ../../../Source/MediaInfo/Audio/File_Ps2Audio.cpp \ ../../../Source/MediaInfo/Audio/File_Rkau.cpp \ ../../../Source/MediaInfo/Audio/File_ScreamTracker3.cpp \ ../../../Source/MediaInfo/Audio/File_SmpteSt0302.cpp \ ../../../Source/MediaInfo/Audio/File_SmpteSt0331.cpp \ ../../../Source/MediaInfo/Audio/File_SmpteSt0337.cpp \ ../../../Source/MediaInfo/Audio/File_Speex.cpp \ ../../../Source/MediaInfo/Audio/File_Tak.cpp \ ../../../Source/MediaInfo/Audio/File_Tta.cpp \ ../../../Source/MediaInfo/Audio/File_TwinVQ.cpp \ ../../../Source/MediaInfo/Audio/File_Vorbis.cpp \ ../../../Source/MediaInfo/Audio/File_Wvpk.cpp \ ../../../Source/MediaInfo/Duplicate/File__Duplicate__Base.cpp \ ../../../Source/MediaInfo/Duplicate/File__Duplicate__Writer.cpp \ ../../../Source/MediaInfo/Duplicate/File__Duplicate_MpegTs.cpp \ ../../../Source/MediaInfo/Export/Export_EbuCore.cpp \ ../../../Source/MediaInfo/Export/Export_Mpeg7.cpp \ ../../../Source/MediaInfo/Export/Export_PBCore.cpp \ ../../../Source/MediaInfo/Export/Export_reVTMD.cpp \ ../../../Source/MediaInfo/Image/File_Bmp.cpp \ ../../../Source/MediaInfo/Image/File_Dpx.cpp \ ../../../Source/MediaInfo/Image/File_Exr.cpp \ ../../../Source/MediaInfo/Image/File_Gif.cpp \ ../../../Source/MediaInfo/Image/File_Ico.cpp \ ../../../Source/MediaInfo/Image/File_Jpeg.cpp \ ../../../Source/MediaInfo/Image/File_Pcx.cpp \ ../../../Source/MediaInfo/Image/File_Png.cpp \ ../../../Source/MediaInfo/Image/File_Psd.cpp \ ../../../Source/MediaInfo/Image/File_Rle.cpp \ ../../../Source/MediaInfo/Image/File_Tiff.cpp \ ../../../Source/MediaInfo/Image/File_Tga.cpp \ ../../../Source/MediaInfo/Multiple/File__ReferenceFilesHelper.cpp \ ../../../Source/MediaInfo/Multiple/File_Aaf.cpp \ ../../../Source/MediaInfo/Multiple/File_Ancillary.cpp \ ../../../Source/MediaInfo/Multiple/File_Bdmv.cpp \ ../../../Source/MediaInfo/Multiple/File_Cdxa.cpp \ ../../../Source/MediaInfo/Multiple/File_DashMpd.cpp \ ../../../Source/MediaInfo/Multiple/File_DcpAm.cpp \ ../../../Source/MediaInfo/Multiple/File_DcpCpl.cpp \ ../../../Source/MediaInfo/Multiple/File_DcpPkl.cpp \ ../../../Source/MediaInfo/Multiple/File_Dpg.cpp \ ../../../Source/MediaInfo/Multiple/File_DvDif.cpp \ ../../../Source/MediaInfo/Multiple/File_DvDif_Analysis.cpp \ ../../../Source/MediaInfo/Multiple/File_Dvdv.cpp \ ../../../Source/MediaInfo/Multiple/File_Dxw.cpp \ ../../../Source/MediaInfo/Multiple/File_Flv.cpp \ ../../../Source/MediaInfo/Multiple/File_Gxf.cpp \ ../../../Source/MediaInfo/Multiple/File_Gxf_TimeCode.cpp \ ../../../Source/MediaInfo/Multiple/File_HdsF4m.cpp \ ../../../Source/MediaInfo/Multiple/File_Hls.cpp \ ../../../Source/MediaInfo/Multiple/File_Ibi.cpp \ ../../../Source/MediaInfo/Multiple/File_Ibi_Creation.cpp \ ../../../Source/MediaInfo/Multiple/File_Ism.cpp \ ../../../Source/MediaInfo/Multiple/File_Ivf.cpp \ ../../../Source/MediaInfo/Multiple/File_Lxf.cpp \ ../../../Source/MediaInfo/Multiple/File_Mk.cpp \ ../../../Source/MediaInfo/Multiple/File_Mpeg4.cpp \ ../../../Source/MediaInfo/Multiple/File_Mpeg4_Descriptors.cpp \ ../../../Source/MediaInfo/Multiple/File_Mpeg4_Elements.cpp \ ../../../Source/MediaInfo/Multiple/File_Mpeg4_TimeCode.cpp \ ../../../Source/MediaInfo/Multiple/File_Mpeg_Descriptors.cpp \ ../../../Source/MediaInfo/Multiple/File_Mpeg_Psi.cpp \ ../../../Source/MediaInfo/Multiple/File_MpegPs.cpp \ ../../../Source/MediaInfo/Multiple/File_MpegTs.cpp \ ../../../Source/MediaInfo/Multiple/File_MpegTs_Duplicate.cpp \ ../../../Source/MediaInfo/Multiple/File_Mxf.cpp \ ../../../Source/MediaInfo/Multiple/File_Nut.cpp \ ../../../Source/MediaInfo/Multiple/File_Ogg.cpp \ ../../../Source/MediaInfo/Multiple/File_Ogg_SubElement.cpp \ ../../../Source/MediaInfo/Multiple/File_P2_Clip.cpp \ ../../../Source/MediaInfo/Multiple/File_Pmp.cpp \ ../../../Source/MediaInfo/Multiple/File_Ptx.cpp \ ../../../Source/MediaInfo/Multiple/File_Riff.cpp \ ../../../Source/MediaInfo/Multiple/File_Riff_Elements.cpp \ ../../../Source/MediaInfo/Multiple/File_Rm.cpp \ ../../../Source/MediaInfo/Multiple/File_SequenceInfo.cpp \ ../../../Source/MediaInfo/Multiple/File_Skm.cpp \ ../../../Source/MediaInfo/Multiple/File_Swf.cpp \ ../../../Source/MediaInfo/Multiple/File_Umf.cpp \ ../../../Source/MediaInfo/Multiple/File_Wm.cpp \ ../../../Source/MediaInfo/Multiple/File_Wm_Elements.cpp \ ../../../Source/MediaInfo/Multiple/File_Xdcam_Clip.cpp \ ../../../Source/MediaInfo/Reader/Reader_Directory.cpp \ ../../../Source/MediaInfo/Reader/Reader_File.cpp \ ../../../Source/MediaInfo/Reader/Reader_libcurl.cpp \ ../../../Source/MediaInfo/Reader/Reader_libmms.cpp \ ../../../Source/MediaInfo/Tag/File__Tags.cpp \ ../../../Source/MediaInfo/Tag/File_ApeTag.cpp \ ../../../Source/MediaInfo/Tag/File_Id3.cpp \ ../../../Source/MediaInfo/Tag/File_Id3v2.cpp \ ../../../Source/MediaInfo/Tag/File_Lyrics3.cpp \ ../../../Source/MediaInfo/Tag/File_Lyrics3v2.cpp \ ../../../Source/MediaInfo/Tag/File_VorbisCom.cpp \ ../../../Source/MediaInfo/Text/File_Cdp.cpp \ ../../../Source/MediaInfo/Text/File_Cmml.cpp \ ../../../Source/MediaInfo/Text/File_DvbSubtitle.cpp \ ../../../Source/MediaInfo/Text/File_DtvccTransport.cpp \ ../../../Source/MediaInfo/Text/File_Kate.cpp \ ../../../Source/MediaInfo/Text/File_AribStdB24B37.cpp \ ../../../Source/MediaInfo/Text/File_Eia608.cpp \ ../../../Source/MediaInfo/Text/File_Eia708.cpp \ ../../../Source/MediaInfo/Text/File_N19.cpp \ ../../../Source/MediaInfo/Text/File_OtherText.cpp \ ../../../Source/MediaInfo/Text/File_Pgs.cpp \ ../../../Source/MediaInfo/Text/File_Scc.cpp \ ../../../Source/MediaInfo/Text/File_Scte20.cpp \ ../../../Source/MediaInfo/Text/File_SubRip.cpp \ ../../../Source/MediaInfo/Text/File_Teletext.cpp \ ../../../Source/MediaInfo/Text/File_TimedText.cpp \ ../../../Source/MediaInfo/Text/File_Ttml.cpp \ ../../../Source/MediaInfo/Video/File_Aic.cpp \ ../../../Source/MediaInfo/Video/File_AfdBarData.cpp \ ../../../Source/MediaInfo/Video/File_Avc.cpp \ ../../../Source/MediaInfo/Video/File_Avc_Duplicate.cpp \ ../../../Source/MediaInfo/Video/File_AvsV.cpp \ ../../../Source/MediaInfo/Video/File_Canopus.cpp \ ../../../Source/MediaInfo/Video/File_Dirac.cpp \ ../../../Source/MediaInfo/Video/File_Flic.cpp \ ../../../Source/MediaInfo/Video/File_Fraps.cpp \ ../../../Source/MediaInfo/Video/File_Lagarith.cpp \ ../../../Source/MediaInfo/Video/File_H263.cpp \ ../../../Source/MediaInfo/Video/File_Hevc.cpp \ ../../../Source/MediaInfo/Video/File_Mpeg4v.cpp \ ../../../Source/MediaInfo/Video/File_Mpegv.cpp \ ../../../Source/MediaInfo/Video/File_ProRes.cpp \ ../../../Source/MediaInfo/Video/File_Theora.cpp \ ../../../Source/MediaInfo/Video/File_Vc1.cpp \ ../../../Source/MediaInfo/Video/File_Vc3.cpp \ ../../../Source/MediaInfo/Video/File_Vp8.cpp \ ../../../Source/MediaInfo/Video/File_Y4m.cpp \ ../../../Source/MediaInfoDLL/MediaInfoDLL.cpp if COMPILE_MD5 lib@MediaInfoLib_LibName@_la_SOURCES += \ ../../../Source/ThirdParty/md5/md5.c endif if COMPILE_TINYXML2 lib@MediaInfoLib_LibName@_la_SOURCES += \ ../../../Source/ThirdParty/tinyxml2/tinyxml2.cpp endif lib@MediaInfoLib_LibName@_la_LDFLAGS = -no-undefined -version-info 0:0:0 INCLUDES = -I../../../Source -I../../../../ZenLib/Source MediaInfoLib/Project/Java/ 40777 0 0 0 12264020632 10643 5MediaInfoLib/Project/Java/Example.JNA/ 40777 0 0 0 12264020632 12645 5MediaInfoLib/Project/Java/Example.JNative/ 40777 0 0 0 12264020633 13576 5MediaInfoLib/Project/Java/Example.JNative/Compile.bat100777 0 0 214 12226004263 15732 0javac -d . -classpath .;JNative.jar ..\..\..\Source\MediaInfoDLL\MediaInfoDLL.JNative.java ..\..\..\Source\Example\HowToUse_Dll.JNative.javaMediaInfoLib/Project/Java/Example.JNative/Compile.sh100777 0 0 166 12226004263 15604 0javac -d . -cp .:JNative.jar ../../../Source/MediaInfoDLL/MediaInfoDLL.java ../../../Source/Example/HowToUse_Dll.java MediaInfoLib/Project/Java/Example.JNative/MakeJavaDoc.bat100777 0 0 157 12226004263 16455 0md javadoc javadoc -d .\javadoc -private -classpath JNative.jar ..\..\..\Source\MediaInfoDLL\MediaInfoDLL.javaMediaInfoLib/Project/Java/Example.JNative/MakeJavaDoc.sh100777 0 0 151 12226004263 16313 0mkdir javadoc javadoc -d ./javadoc -classpath JNative.jar ../../../Source/MediaInfoDLL/MediaInfoDLL.javaMediaInfoLib/Project/Java/Example.JNative/ReadMe.txt100777 0 0 407 12226004263 15554 0To run MediaInfo, you need JNative JNative jar may be downloaded from http://jnative.sourceforge.net . Java 1.4.2 users: Retroweaver makes it possible to run JNative on Java RE 1.4.2. Retroweaver can be found at: http://sourceforge.net/projects/retroweaver/MediaInfoLib/Project/Java/Example.JNative/Run.bat100777 0 0 46 12226004263 15071 0java -cp .;JNative.jar HowToUse_Dll %1MediaInfoLib/Project/Java/Example.JNative/Run.sh100777 0 0 47 12226004263 14736 0java -cp .:JNative.jar HowToUse_Dll $1 MediaInfoLib/Project/Java/Example.JNA/Compile.bat100777 0 0 200 12226004263 14775 0javac -d . -classpath .;jna.jar ..\..\..\Source\MediaInfoDLL\MediaInfoDLL.JNA.java ..\..\..\Source\Example\HowToUse_Dll.JNA.javaMediaInfoLib/Project/Java/Example.JNA/Compile.sh100777 0 0 172 12226004263 14651 0javac -d . -cp .:jna.jar ../../../Source/MediaInfoDLL/MediaInfoDLL.JNA.java ../../../Source/Example/HowToUse_Dll.JNA.java MediaInfoLib/Project/Java/Example.JNA/MakeJavaDoc.bat100777 0 0 157 12226004263 15525 0md javadoc javadoc -d .\javadoc -private -classpath JNative.jar ..\..\..\Source\MediaInfoDLL\MediaInfoDLL.javaMediaInfoLib/Project/Java/Example.JNA/MakeJavaDoc.sh100777 0 0 151 12226004263 15363 0mkdir javadoc javadoc -d ./javadoc -classpath JNative.jar ../../../Source/MediaInfoDLL/MediaInfoDLL.javaMediaInfoLib/Project/Java/Example.JNA/ReadMe.txt100777 0 0 516 12226004263 14625 0MediaInfo DLL binding for Java 1. Download JNA (http://jna.dev.java.net) 2. Make sure the MediaInfo native library is in your library path Windows: copy MediaInfo.dll into you working directory Linux: install libmediainfo using the package for your distro 3. You can test the "HowToUse_Dll" example (compile, run) MediaInfoLib/Project/Java/Example.JNA/Run.bat100777 0 0 42 12226004263 14135 0java -cp .;jna.jar HowToUse_Dll %1MediaInfoLib/Project/Java/Example.JNA/Run.sh100777 0 0 43 12226004263 14002 0java -cp .:jna.jar HowToUse_Dll $1 MediaInfoLib/Project/MSCS2008/ 40777 0 0 0 12226004263 11041 5MediaInfoLib/Project/MSCS2008/asp_net_web_application/ 40777 0 0 0 12226004263 15712 5MediaInfoLib/Project/MSCS2008/asp_net_web_application/asp_net_web_application.csproj100777 0 0 10113 12226004263 24121 0 Debug AnyCPU 9.0.21022 2.0 {7B5EECA2-2BDA-472C-AB04-0C2E3D428908} {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties asp_net_web_application asp_net_web_application v3.5 true full false bin\ DEBUG;TRACE prompt 4 pdbonly true bin\ TRACE prompt 4 3.5 3.5 3.5 3.5 ASPXCodeBehind Default.aspx Default.aspx False True 2866 / False False MediaInfoLib/Project/MSCS2008/asp_net_web_application/Default.aspx.cs100777 0 0 1006 12226004263 20674 0using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; namespace asp_net_web_application { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } } } MediaInfoLib/Project/MSCS2008/asp_net_web_application/Default.aspx.designer.cs100777 0 0 1454 12226004263 22502 0//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:2.0.50727.1433 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace asp_net_web_application { public partial class _Default { /// /// form1 control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; } } MediaInfoLib/Project/MSCS2008/asp_net_web_application/MediaInfoDLL.cs100777 0 0 33144 12226004263 20555 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Microsoft Visual C# wrapper for MediaInfo Library // See MediaInfo.h for help // // To make it working, you must put MediaInfo.Dll // in the executable folder // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ using System; using System.Runtime.InteropServices; namespace MediaInfoLib { public enum StreamKind { General, Video, Audio, Text, Chapters, Image } public enum InfoKind { Name, Text, Measure, Options, NameText, MeasureText, Info, HowTo } public enum InfoOptions { ShowInInform, Support, ShowInSupported, TypeOfValue } public enum InfoFileOptions { FileOption_Nothing = 0x00, FileOption_NoRecursive = 0x01, FileOption_CloseAll = 0x02, FileOption_Max = 0x04 }; public class MediaInfo { //Import of DLL functions. DO NOT USE until you know what you do (MediaInfo DLL do NOT use CoTaskMemAlloc to allocate memory) [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_New(); [DllImport("MediaInfo.dll")] private static extern void MediaInfo_Delete(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string FileName); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open(IntPtr Handle, IntPtr FileName); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open_Buffer_Init(IntPtr Handle, Int64 File_Size, Int64 File_Offset); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open(IntPtr Handle, Int64 File_Size, Int64 File_Offset); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open_Buffer_Continue(IntPtr Handle, IntPtr Buffer, IntPtr Buffer_Size); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open_Buffer_Continue(IntPtr Handle, Int64 File_Size, byte[] Buffer, IntPtr Buffer_Size); [DllImport("MediaInfo.dll")] private static extern Int64 MediaInfo_Open_Buffer_Continue_GoTo_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern Int64 MediaInfoA_Open_Buffer_Continue_GoTo_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open_Buffer_Finalize(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open_Buffer_Finalize(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern void MediaInfo_Close(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Inform(IntPtr Handle, IntPtr Reserved); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Inform(IntPtr Handle, IntPtr Reserved); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_GetI(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_GetI(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, [MarshalAs(UnmanagedType.LPWStr)] string Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Option(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string Option, [MarshalAs(UnmanagedType.LPWStr)] string Value); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Option(IntPtr Handle, IntPtr Option, IntPtr Value); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_State_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Count_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber); //MediaInfo class public MediaInfo() { Handle = MediaInfo_New(); if (Environment.OSVersion.ToString().IndexOf("Windows")==-1) MustUseAnsi=true; else MustUseAnsi=false; } ~MediaInfo() { MediaInfo_Delete(Handle); } public int Open(String FileName) { if (MustUseAnsi) { IntPtr FileName_Ptr = Marshal.StringToHGlobalAnsi(FileName); int ToReturn = (int)MediaInfoA_Open(Handle, FileName_Ptr); Marshal.FreeHGlobal(FileName_Ptr); return ToReturn; } else return (int)MediaInfo_Open(Handle, FileName); } public int Open_Buffer_Init(Int64 File_Size, Int64 File_Offset) { return (int)MediaInfo_Open_Buffer_Init(Handle, File_Size, File_Offset); } public int Open_Buffer_Continue(IntPtr Buffer, IntPtr Buffer_Size) { return (int)MediaInfo_Open_Buffer_Continue(Handle, Buffer, Buffer_Size); } public Int64 Open_Buffer_Continue_GoTo_Get() { return (int)MediaInfo_Open_Buffer_Continue_GoTo_Get(Handle); } public int Open_Buffer_Finalize() { return (int)MediaInfo_Open_Buffer_Finalize(Handle); } public void Close() { MediaInfo_Close(Handle); } public String Inform() { if (MustUseAnsi) return Marshal.PtrToStringAnsi(MediaInfoA_Inform(Handle, (IntPtr)0)); else return Marshal.PtrToStringUni(MediaInfo_Inform(Handle, (IntPtr)0)); } public String Get(StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo, InfoKind KindOfSearch) { if (MustUseAnsi) { IntPtr Parameter_Ptr=Marshal.StringToHGlobalAnsi(Parameter); String ToReturn=Marshal.PtrToStringAnsi(MediaInfoA_Get(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, Parameter_Ptr, (IntPtr)KindOfInfo, (IntPtr)KindOfSearch)); Marshal.FreeHGlobal(Parameter_Ptr); return ToReturn; } else return Marshal.PtrToStringUni(MediaInfo_Get(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, Parameter, (IntPtr)KindOfInfo, (IntPtr)KindOfSearch)); } public String Get(StreamKind StreamKind, int StreamNumber, int Parameter, InfoKind KindOfInfo) { if (MustUseAnsi) return Marshal.PtrToStringAnsi(MediaInfoA_GetI(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, (IntPtr)Parameter, (IntPtr)KindOfInfo)); else return Marshal.PtrToStringUni(MediaInfo_GetI(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, (IntPtr)Parameter, (IntPtr)KindOfInfo)); } public String Option(String Option, String Value) { if (MustUseAnsi) { IntPtr Option_Ptr=Marshal.StringToHGlobalAnsi(Option); IntPtr Value_Ptr=Marshal.StringToHGlobalAnsi(Value); String ToReturn=Marshal.PtrToStringAnsi(MediaInfoA_Option(Handle, Option_Ptr, Value_Ptr)); Marshal.FreeHGlobal(Option_Ptr); Marshal.FreeHGlobal(Value_Ptr); return ToReturn; } else return Marshal.PtrToStringUni(MediaInfo_Option(Handle, Option, Value)); } public int State_Get() { return (int)MediaInfo_State_Get(Handle); } public int Count_Get(StreamKind StreamKind, int StreamNumber) { return (int)MediaInfo_Count_Get(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber); } private IntPtr Handle; private bool MustUseAnsi; //Default values, if you know how to set default values in C#, say me public String Get(StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo) { return Get(StreamKind, StreamNumber, Parameter, KindOfInfo, InfoKind.Name); } public String Get(StreamKind StreamKind, int StreamNumber, String Parameter) { return Get(StreamKind, StreamNumber, Parameter, InfoKind.Text, InfoKind.Name); } public String Get(StreamKind StreamKind, int StreamNumber, int Parameter) { return Get(StreamKind, StreamNumber, Parameter, InfoKind.Text); } public String Option(String Option_) { return Option(Option_, ""); } public int Count_Get(StreamKind StreamKind) { return Count_Get(StreamKind, -1); } } public class MediaInfoList { //Import of DLL functions. DO NOT USE until you know what you do (MediaInfo DLL do NOT use CoTaskMemAlloc to allocate memory) [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_New(); [DllImport("MediaInfo.dll")] private static extern void MediaInfoList_Delete(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Open(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string FileName, IntPtr Options); [DllImport("MediaInfo.dll")] private static extern void MediaInfoList_Close(IntPtr Handle, IntPtr FilePos); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Inform(IntPtr Handle, IntPtr FilePos, IntPtr Reserved); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_GetI(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Get(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber, [MarshalAs(UnmanagedType.LPWStr)] string Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Option(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string Option, [MarshalAs(UnmanagedType.LPWStr)] string Value); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_State_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Count_Get(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber); //MediaInfo class public MediaInfoList() { Handle = MediaInfoList_New(); } ~MediaInfoList() { MediaInfoList_Delete(Handle); } public int Open(String FileName, InfoFileOptions Options) { return (int)MediaInfoList_Open(Handle, FileName, (IntPtr)Options); } public void Close(int FilePos) { MediaInfoList_Close(Handle, (IntPtr)FilePos); } public String Inform(int FilePos) { return Marshal.PtrToStringUni(MediaInfoList_Inform(Handle, (IntPtr)FilePos, (IntPtr)0)); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo, InfoKind KindOfSearch) { return Marshal.PtrToStringUni(MediaInfoList_Get(Handle, (IntPtr)FilePos, (IntPtr)StreamKind, (IntPtr)StreamNumber, Parameter, (IntPtr)KindOfInfo, (IntPtr)KindOfSearch)); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, int Parameter, InfoKind KindOfInfo) { return Marshal.PtrToStringUni(MediaInfoList_GetI(Handle, (IntPtr)FilePos, (IntPtr)StreamKind, (IntPtr)StreamNumber, (IntPtr)Parameter, (IntPtr)KindOfInfo)); } public String Option(String Option, String Value) { return Marshal.PtrToStringUni(MediaInfoList_Option(Handle, Option, Value)); } public int State_Get() { return (int)MediaInfoList_State_Get(Handle); } public int Count_Get(int FilePos, StreamKind StreamKind, int StreamNumber) { return (int)MediaInfoList_Count_Get(Handle, (IntPtr)FilePos, (IntPtr)StreamKind, (IntPtr)StreamNumber); } private IntPtr Handle; //Default values, if you know how to set default values in C#, say me public void Open(String FileName) { Open(FileName, 0); } public void Close() { Close(-1); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo) { return Get(FilePos, StreamKind, StreamNumber, Parameter, KindOfInfo, InfoKind.Name); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, String Parameter) { return Get(FilePos, StreamKind, StreamNumber, Parameter, InfoKind.Text, InfoKind.Name); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, int Parameter) { return Get(FilePos, StreamKind, StreamNumber, Parameter, InfoKind.Text); } public String Option(String Option_) { return Option(Option_, ""); } public int Count_Get(int FilePos, StreamKind StreamKind) { return Count_Get(FilePos, StreamKind, -1); } } } //NameSpace MediaInfoLib/Project/MSCS2008/asp_net_web_application/Properties/ 40777 0 0 0 12226004263 20046 5MediaInfoLib/Project/MSCS2008/asp_net_web_application/Properties/AssemblyInfo.cs100777 0 0 2624 12226004263 23074 0using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("asp_net_web_application")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Zenitram")] [assembly: AssemblyProduct("asp_net_web_application")] [assembly: AssemblyCopyright("Copyright © Zenitram 2009")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] MediaInfoLib/Project/MSCS2008/Example/ 40777 0 0 0 12226004263 12434 5MediaInfoLib/Project/MSCS2008/Example/App.ico100777 0 0 2066 12226004263 13754 0 &(( @wwwwwwwwwwwwwwpDDDDDDDDDDDDDDppppppppppppppppppppDDDDDDDDDDDDDDpLLLLLLLLLNItpDDDDDDDDDDDDD@( wwwwwwwDDDDDDDGOGOGOGOGOGOGOGOGHGLGDDDDDDMediaInfoLib/Project/MSCS2008/Example/AssemblyInfo.cs100777 0 0 5033 12226004263 15457 0using System.Reflection; using System.Runtime.CompilerServices; // // Les informations gnrales relatives un assembly dpendent de // l'ensemble d'attributs suivant. Pour modifier les informations // associes un assembly, changez les valeurs de ces attributs. // [assembly: AssemblyTitle("")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // // Les informations de version pour un assembly se composent des quatre valeurs suivantes: // // Version principale // Version secondaire // Numro de build // Rvision // // Vous pouvez spcifier toutes les valeurs ou indiquer des numros de rvision et de build par dfaut // en utilisant '*', comme ci-dessous : [assembly: AssemblyVersion("1.0.*")] // // Pour signer votre assembly, vous devez spcifier la cl utiliser. Consultez // la documentation Microsoft .NET Framework pour plus d'informations sur la signature d'un assembly. // // Utilisez les attributs ci-dessous pour contrler la cl utilise lors de la signature. // // Remarques: // (*) Si aucune cl n'est spcifie, l'assembly n'est pas sign. // (*) KeyName fait rfrence une cl installe dans le fournisseur de // services cryptographiques (CSP) de votre ordinateur. KeyFile fait rfrence un fichier qui contient // une cl. // (*) Si les valeurs de KeyFile et de KeyName sont spcifies, le // traitement suivant se produit: // (1) Si KeyName se trouve dans le CSP, la cl est utilise. // (2) Si KeyName n'existe pas mais que KeyFile existe, la cl // de KeyFile est installe dans le CSP et utilise. // (*) Pour crer KeyFile, vous pouvez utiliser l'utilitaire sn.exe (Strong Name, Nom fort). // Lors de la spcification de KeyFile, son emplacement doit tre // relatif au rpertoire de sortie du projet qui est // %Project Directory%\obj\. Par exemple, si votre KeyFile se trouve // dans le rpertoire du projet, vous devez spcifier l'attribut // AssemblyKeyFile sous la forme [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] // (*) DelaySign (signature diffre) est une option avance. Pour plus d'informations, consultez la // documentation Microsoft .NET Framework. // [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] [assembly: AssemblyKeyName("")] MediaInfoLib/Project/MSCS2008/Example/HowToUse_Dll.cs100777 0 0 17536 12226004263 15427 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Microsoft Visual C# example // // To make this example working, you must put MediaInfo.Dll and Example.ogg // in the "./Bin/__ConfigurationName__" folder // and add MediaInfoDll.cs to your project // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Text; using System.IO; using MediaInfoLib; namespace MediaInfoLib_MSCS { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.RichTextBox richTextBox1; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Mthode requise pour la prise en charge du concepteur - ne modifiez pas /// le contenu de cette mthode avec l'diteur de code. /// private void InitializeComponent() { this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.SuspendLayout(); // // richTextBox1 // this.richTextBox1.Location = new System.Drawing.Point(0, 0); this.richTextBox1.Name = "richTextBox1"; this.richTextBox1.Size = new System.Drawing.Size(768, 512); this.richTextBox1.TabIndex = 0; this.richTextBox1.Text = ""; // // Form1 // this.ClientSize = new System.Drawing.Size(770, 514); this.Controls.Add(this.richTextBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "How to use MediaInfo.Dll"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); } #endregion /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.Run(new Form1()); } private void Form1_Load(object sender, System.EventArgs e) { //Test if version of DLL is compatible : 3rd argument is "version of DLL tested;Your application name;Your application version" String ToDisplay; MediaInfo MI = new MediaInfo(); ToDisplay = MI.Option("Info_Version", "0.7.0.0;MediaInfoDLL_Example_CS;0.7.0.0"); if (ToDisplay.Length == 0) { richTextBox1.Text = "MediaInfo.Dll: this version of the DLL is not compatible"; return; } //Information about MediaInfo ToDisplay += "\r\n\r\nInfo_Parameters\r\n"; ToDisplay += MI.Option("Info_Parameters"); ToDisplay += "\r\n\r\nInfo_Capacities\r\n"; ToDisplay += MI.Option("Info_Capacities"); ToDisplay += "\r\n\r\nInfo_Codecs\r\n"; ToDisplay += MI.Option("Info_Codecs"); //An example of how to use the library ToDisplay += "\r\n\r\nOpen\r\n"; MI.Open("Example.ogg"); ToDisplay += "\r\n\r\nInform with Complete=false\r\n"; MI.Option("Complete"); ToDisplay += MI.Inform(); ToDisplay += "\r\n\r\nInform with Complete=true\r\n"; MI.Option("Complete", "1"); ToDisplay += MI.Inform(); ToDisplay += "\r\n\r\nCustom Inform\r\n"; MI.Option("Inform", "General;File size is %FileSize% bytes"); ToDisplay += MI.Inform(); ToDisplay += "\r\n\r\nGet with Stream=General and Parameter='FileSize'\r\n"; ToDisplay += MI.Get(0, 0, "FileSize"); ToDisplay += "\r\n\r\nGet with Stream=General and Parameter=46\r\n"; ToDisplay += MI.Get(0, 0, 46); ToDisplay += "\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n"; ToDisplay += MI.Count_Get(StreamKind.Audio); ToDisplay += "\r\n\r\nGet with Stream=General and Parameter='AudioCount'\r\n"; ToDisplay += MI.Get(StreamKind.General, 0, "AudioCount"); ToDisplay += "\r\n\r\nGet with Stream=Audio and Parameter='StreamCount'\r\n"; ToDisplay += MI.Get(StreamKind.Audio, 0, "StreamCount"); ToDisplay += "\r\n\r\nClose\r\n"; MI.Close(); //Example with a stream //ToDisplay+="\r\n"+ExampleWithStream()+"\r\n"; //Displaying the text richTextBox1.Text = ToDisplay; } String ExampleWithStream() { //Initilaizing MediaInfo MediaInfo MI = new MediaInfo(); //From: preparing an example file for reading FileStream From = new FileStream("Example.ogg", FileMode.Open, FileAccess.Read); //From: preparing a memory buffer for reading byte[] From_Buffer = new byte[64*1024]; int From_Buffer_Size; //The size of the read file buffer //Preparing to fill MediaInfo with a buffer MI.Open_Buffer_Init(From.Length, 0); //The parsing loop do { //Reading data somewhere, do what you want for this. From_Buffer_Size=From.Read(From_Buffer, 0, 64*1024); //Sending the buffer to MediaInfo System.Runtime.InteropServices.GCHandle GC = System.Runtime.InteropServices.GCHandle.Alloc(From_Buffer, System.Runtime.InteropServices.GCHandleType.Pinned); IntPtr From_Buffer_IntPtr = GC.AddrOfPinnedObject(); if (MI.Open_Buffer_Continue(From_Buffer_IntPtr, (IntPtr)From_Buffer_Size) == 0) //Note: How to provide a buffer[]? { GC.Free(); break; } GC.Free(); //Testing if MediaInfo request to go elsewhere if (MI.Open_Buffer_Continue_GoTo_Get()!=-1) { Int64 Position=From.Seek(MI.Open_Buffer_Continue_GoTo_Get(), SeekOrigin.Begin); //Position the file MI.Open_Buffer_Init(From.Length, Position); //Informing MediaInfo we have seek } } while (From_Buffer_Size>0); //Finalizing MI.Open_Buffer_Finalize(); //This is the end of the stream, MediaInfo must finnish some work //Get() example return MI.Get(StreamKind.General, 0, "Format"); } } } MediaInfoLib/Project/MSCS2008/Example/HowToUse_Dll.csproj100777 0 0 7546 12226004263 16302 0 Local 9.0.21022 2.0 {574FB186-52E8-4EAA-9BC9-815F2B2CA632} Debug AnyCPU App.ico HowToUse_Dll JScript Grid IE50 false WinExe HowToUse_Dll OnBuildSuccess 2.0 bin\Debug\ false 285212672 false DEBUG;TRACE true 4096 false false false false false 4 bin\Release\ false 285212672 false TRACE false 4096 false true false false false 4 System System.Data System.Drawing System.Windows.Forms System.XML Code Form MediaInfoLib/Project/MSCS2008/Example/MediaInfoDLL.cs100777 0 0 33144 12226004263 15277 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Microsoft Visual C# wrapper for MediaInfo Library // See MediaInfo.h for help // // To make it working, you must put MediaInfo.Dll // in the executable folder // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ using System; using System.Runtime.InteropServices; namespace MediaInfoLib { public enum StreamKind { General, Video, Audio, Text, Chapters, Image } public enum InfoKind { Name, Text, Measure, Options, NameText, MeasureText, Info, HowTo } public enum InfoOptions { ShowInInform, Support, ShowInSupported, TypeOfValue } public enum InfoFileOptions { FileOption_Nothing = 0x00, FileOption_NoRecursive = 0x01, FileOption_CloseAll = 0x02, FileOption_Max = 0x04 }; public class MediaInfo { //Import of DLL functions. DO NOT USE until you know what you do (MediaInfo DLL do NOT use CoTaskMemAlloc to allocate memory) [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_New(); [DllImport("MediaInfo.dll")] private static extern void MediaInfo_Delete(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string FileName); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open(IntPtr Handle, IntPtr FileName); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open_Buffer_Init(IntPtr Handle, Int64 File_Size, Int64 File_Offset); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open(IntPtr Handle, Int64 File_Size, Int64 File_Offset); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open_Buffer_Continue(IntPtr Handle, IntPtr Buffer, IntPtr Buffer_Size); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open_Buffer_Continue(IntPtr Handle, Int64 File_Size, byte[] Buffer, IntPtr Buffer_Size); [DllImport("MediaInfo.dll")] private static extern Int64 MediaInfo_Open_Buffer_Continue_GoTo_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern Int64 MediaInfoA_Open_Buffer_Continue_GoTo_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open_Buffer_Finalize(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open_Buffer_Finalize(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern void MediaInfo_Close(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Inform(IntPtr Handle, IntPtr Reserved); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Inform(IntPtr Handle, IntPtr Reserved); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_GetI(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_GetI(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, [MarshalAs(UnmanagedType.LPWStr)] string Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Option(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string Option, [MarshalAs(UnmanagedType.LPWStr)] string Value); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Option(IntPtr Handle, IntPtr Option, IntPtr Value); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_State_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Count_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber); //MediaInfo class public MediaInfo() { Handle = MediaInfo_New(); if (Environment.OSVersion.ToString().IndexOf("Windows")==-1) MustUseAnsi=true; else MustUseAnsi=false; } ~MediaInfo() { MediaInfo_Delete(Handle); } public int Open(String FileName) { if (MustUseAnsi) { IntPtr FileName_Ptr = Marshal.StringToHGlobalAnsi(FileName); int ToReturn = (int)MediaInfoA_Open(Handle, FileName_Ptr); Marshal.FreeHGlobal(FileName_Ptr); return ToReturn; } else return (int)MediaInfo_Open(Handle, FileName); } public int Open_Buffer_Init(Int64 File_Size, Int64 File_Offset) { return (int)MediaInfo_Open_Buffer_Init(Handle, File_Size, File_Offset); } public int Open_Buffer_Continue(IntPtr Buffer, IntPtr Buffer_Size) { return (int)MediaInfo_Open_Buffer_Continue(Handle, Buffer, Buffer_Size); } public Int64 Open_Buffer_Continue_GoTo_Get() { return (int)MediaInfo_Open_Buffer_Continue_GoTo_Get(Handle); } public int Open_Buffer_Finalize() { return (int)MediaInfo_Open_Buffer_Finalize(Handle); } public void Close() { MediaInfo_Close(Handle); } public String Inform() { if (MustUseAnsi) return Marshal.PtrToStringAnsi(MediaInfoA_Inform(Handle, (IntPtr)0)); else return Marshal.PtrToStringUni(MediaInfo_Inform(Handle, (IntPtr)0)); } public String Get(StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo, InfoKind KindOfSearch) { if (MustUseAnsi) { IntPtr Parameter_Ptr=Marshal.StringToHGlobalAnsi(Parameter); String ToReturn=Marshal.PtrToStringAnsi(MediaInfoA_Get(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, Parameter_Ptr, (IntPtr)KindOfInfo, (IntPtr)KindOfSearch)); Marshal.FreeHGlobal(Parameter_Ptr); return ToReturn; } else return Marshal.PtrToStringUni(MediaInfo_Get(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, Parameter, (IntPtr)KindOfInfo, (IntPtr)KindOfSearch)); } public String Get(StreamKind StreamKind, int StreamNumber, int Parameter, InfoKind KindOfInfo) { if (MustUseAnsi) return Marshal.PtrToStringAnsi(MediaInfoA_GetI(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, (IntPtr)Parameter, (IntPtr)KindOfInfo)); else return Marshal.PtrToStringUni(MediaInfo_GetI(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, (IntPtr)Parameter, (IntPtr)KindOfInfo)); } public String Option(String Option, String Value) { if (MustUseAnsi) { IntPtr Option_Ptr=Marshal.StringToHGlobalAnsi(Option); IntPtr Value_Ptr=Marshal.StringToHGlobalAnsi(Value); String ToReturn=Marshal.PtrToStringAnsi(MediaInfoA_Option(Handle, Option_Ptr, Value_Ptr)); Marshal.FreeHGlobal(Option_Ptr); Marshal.FreeHGlobal(Value_Ptr); return ToReturn; } else return Marshal.PtrToStringUni(MediaInfo_Option(Handle, Option, Value)); } public int State_Get() { return (int)MediaInfo_State_Get(Handle); } public int Count_Get(StreamKind StreamKind, int StreamNumber) { return (int)MediaInfo_Count_Get(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber); } private IntPtr Handle; private bool MustUseAnsi; //Default values, if you know how to set default values in C#, say me public String Get(StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo) { return Get(StreamKind, StreamNumber, Parameter, KindOfInfo, InfoKind.Name); } public String Get(StreamKind StreamKind, int StreamNumber, String Parameter) { return Get(StreamKind, StreamNumber, Parameter, InfoKind.Text, InfoKind.Name); } public String Get(StreamKind StreamKind, int StreamNumber, int Parameter) { return Get(StreamKind, StreamNumber, Parameter, InfoKind.Text); } public String Option(String Option_) { return Option(Option_, ""); } public int Count_Get(StreamKind StreamKind) { return Count_Get(StreamKind, -1); } } public class MediaInfoList { //Import of DLL functions. DO NOT USE until you know what you do (MediaInfo DLL do NOT use CoTaskMemAlloc to allocate memory) [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_New(); [DllImport("MediaInfo.dll")] private static extern void MediaInfoList_Delete(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Open(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string FileName, IntPtr Options); [DllImport("MediaInfo.dll")] private static extern void MediaInfoList_Close(IntPtr Handle, IntPtr FilePos); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Inform(IntPtr Handle, IntPtr FilePos, IntPtr Reserved); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_GetI(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Get(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber, [MarshalAs(UnmanagedType.LPWStr)] string Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Option(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string Option, [MarshalAs(UnmanagedType.LPWStr)] string Value); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_State_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Count_Get(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber); //MediaInfo class public MediaInfoList() { Handle = MediaInfoList_New(); } ~MediaInfoList() { MediaInfoList_Delete(Handle); } public int Open(String FileName, InfoFileOptions Options) { return (int)MediaInfoList_Open(Handle, FileName, (IntPtr)Options); } public void Close(int FilePos) { MediaInfoList_Close(Handle, (IntPtr)FilePos); } public String Inform(int FilePos) { return Marshal.PtrToStringUni(MediaInfoList_Inform(Handle, (IntPtr)FilePos, (IntPtr)0)); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo, InfoKind KindOfSearch) { return Marshal.PtrToStringUni(MediaInfoList_Get(Handle, (IntPtr)FilePos, (IntPtr)StreamKind, (IntPtr)StreamNumber, Parameter, (IntPtr)KindOfInfo, (IntPtr)KindOfSearch)); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, int Parameter, InfoKind KindOfInfo) { return Marshal.PtrToStringUni(MediaInfoList_GetI(Handle, (IntPtr)FilePos, (IntPtr)StreamKind, (IntPtr)StreamNumber, (IntPtr)Parameter, (IntPtr)KindOfInfo)); } public String Option(String Option, String Value) { return Marshal.PtrToStringUni(MediaInfoList_Option(Handle, Option, Value)); } public int State_Get() { return (int)MediaInfoList_State_Get(Handle); } public int Count_Get(int FilePos, StreamKind StreamKind, int StreamNumber) { return (int)MediaInfoList_Count_Get(Handle, (IntPtr)FilePos, (IntPtr)StreamKind, (IntPtr)StreamNumber); } private IntPtr Handle; //Default values, if you know how to set default values in C#, say me public void Open(String FileName) { Open(FileName, 0); } public void Close() { Close(-1); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo) { return Get(FilePos, StreamKind, StreamNumber, Parameter, KindOfInfo, InfoKind.Name); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, String Parameter) { return Get(FilePos, StreamKind, StreamNumber, Parameter, InfoKind.Text, InfoKind.Name); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, int Parameter) { return Get(FilePos, StreamKind, StreamNumber, Parameter, InfoKind.Text); } public String Option(String Option_) { return Option(Option_, ""); } public int Count_Get(int FilePos, StreamKind StreamKind) { return Count_Get(FilePos, StreamKind, -1); } } } //NameSpace MediaInfoLib/Project/MSCS2008/MediaInfoLib_MSCS.sln100777 0 0 2637 12226004263 14776 0Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HowToUse_Dll", "Example\HowToUse_Dll.csproj", "{574FB186-52E8-4EAA-9BC9-815F2B2CA632}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "asp_net_web_application", "asp_net_web_application\asp_net_web_application.csproj", "{7B5EECA2-2BDA-472C-AB04-0C2E3D428908}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {574FB186-52E8-4EAA-9BC9-815F2B2CA632}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {574FB186-52E8-4EAA-9BC9-815F2B2CA632}.Debug|Any CPU.Build.0 = Debug|Any CPU {574FB186-52E8-4EAA-9BC9-815F2B2CA632}.Release|Any CPU.ActiveCfg = Release|Any CPU {574FB186-52E8-4EAA-9BC9-815F2B2CA632}.Release|Any CPU.Build.0 = Release|Any CPU {7B5EECA2-2BDA-472C-AB04-0C2E3D428908}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7B5EECA2-2BDA-472C-AB04-0C2E3D428908}.Debug|Any CPU.Build.0 = Debug|Any CPU {7B5EECA2-2BDA-472C-AB04-0C2E3D428908}.Release|Any CPU.ActiveCfg = Release|Any CPU {7B5EECA2-2BDA-472C-AB04-0C2E3D428908}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal MediaInfoLib/Project/MSCS2010/ 40777 0 0 0 12252315444 11037 5MediaInfoLib/Project/MSCS2010/asp_net_web_application/ 40777 0 0 0 12226004263 15703 5MediaInfoLib/Project/MSCS2010/asp_net_web_application/asp_net_web_application.csproj100777 0 0 10625 12226004263 24122 0 Debug AnyCPU 9.0.21022 2.0 {7B5EECA2-2BDA-472C-AB04-0C2E3D428908} {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties asp_net_web_application asp_net_web_application v4.0 3.5 false true full false bin\ DEBUG;TRACE prompt 4 AllRules.ruleset x86 pdbonly true bin\ TRACE prompt 4 AllRules.ruleset ASPXCodeBehind Default.aspx Default.aspx False True 2866 / False False False MediaInfoLib/Project/MSCS2010/asp_net_web_application/Default.aspx.cs100777 0 0 1006 12226004263 20665 0using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; namespace asp_net_web_application { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } } } MediaInfoLib/Project/MSCS2010/asp_net_web_application/Default.aspx.designer.cs100777 0 0 1454 12226004263 22473 0//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:2.0.50727.1433 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace asp_net_web_application { public partial class _Default { /// /// form1 control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; } } MediaInfoLib/Project/MSCS2010/asp_net_web_application/MediaInfoDLL.cs100777 0 0 33144 12226004263 20546 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Microsoft Visual C# wrapper for MediaInfo Library // See MediaInfo.h for help // // To make it working, you must put MediaInfo.Dll // in the executable folder // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ using System; using System.Runtime.InteropServices; namespace MediaInfoLib { public enum StreamKind { General, Video, Audio, Text, Chapters, Image } public enum InfoKind { Name, Text, Measure, Options, NameText, MeasureText, Info, HowTo } public enum InfoOptions { ShowInInform, Support, ShowInSupported, TypeOfValue } public enum InfoFileOptions { FileOption_Nothing = 0x00, FileOption_NoRecursive = 0x01, FileOption_CloseAll = 0x02, FileOption_Max = 0x04 }; public class MediaInfo { //Import of DLL functions. DO NOT USE until you know what you do (MediaInfo DLL do NOT use CoTaskMemAlloc to allocate memory) [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_New(); [DllImport("MediaInfo.dll")] private static extern void MediaInfo_Delete(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string FileName); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open(IntPtr Handle, IntPtr FileName); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open_Buffer_Init(IntPtr Handle, Int64 File_Size, Int64 File_Offset); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open(IntPtr Handle, Int64 File_Size, Int64 File_Offset); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open_Buffer_Continue(IntPtr Handle, IntPtr Buffer, IntPtr Buffer_Size); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open_Buffer_Continue(IntPtr Handle, Int64 File_Size, byte[] Buffer, IntPtr Buffer_Size); [DllImport("MediaInfo.dll")] private static extern Int64 MediaInfo_Open_Buffer_Continue_GoTo_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern Int64 MediaInfoA_Open_Buffer_Continue_GoTo_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open_Buffer_Finalize(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open_Buffer_Finalize(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern void MediaInfo_Close(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Inform(IntPtr Handle, IntPtr Reserved); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Inform(IntPtr Handle, IntPtr Reserved); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_GetI(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_GetI(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, [MarshalAs(UnmanagedType.LPWStr)] string Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Option(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string Option, [MarshalAs(UnmanagedType.LPWStr)] string Value); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Option(IntPtr Handle, IntPtr Option, IntPtr Value); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_State_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Count_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber); //MediaInfo class public MediaInfo() { Handle = MediaInfo_New(); if (Environment.OSVersion.ToString().IndexOf("Windows")==-1) MustUseAnsi=true; else MustUseAnsi=false; } ~MediaInfo() { MediaInfo_Delete(Handle); } public int Open(String FileName) { if (MustUseAnsi) { IntPtr FileName_Ptr = Marshal.StringToHGlobalAnsi(FileName); int ToReturn = (int)MediaInfoA_Open(Handle, FileName_Ptr); Marshal.FreeHGlobal(FileName_Ptr); return ToReturn; } else return (int)MediaInfo_Open(Handle, FileName); } public int Open_Buffer_Init(Int64 File_Size, Int64 File_Offset) { return (int)MediaInfo_Open_Buffer_Init(Handle, File_Size, File_Offset); } public int Open_Buffer_Continue(IntPtr Buffer, IntPtr Buffer_Size) { return (int)MediaInfo_Open_Buffer_Continue(Handle, Buffer, Buffer_Size); } public Int64 Open_Buffer_Continue_GoTo_Get() { return (int)MediaInfo_Open_Buffer_Continue_GoTo_Get(Handle); } public int Open_Buffer_Finalize() { return (int)MediaInfo_Open_Buffer_Finalize(Handle); } public void Close() { MediaInfo_Close(Handle); } public String Inform() { if (MustUseAnsi) return Marshal.PtrToStringAnsi(MediaInfoA_Inform(Handle, (IntPtr)0)); else return Marshal.PtrToStringUni(MediaInfo_Inform(Handle, (IntPtr)0)); } public String Get(StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo, InfoKind KindOfSearch) { if (MustUseAnsi) { IntPtr Parameter_Ptr=Marshal.StringToHGlobalAnsi(Parameter); String ToReturn=Marshal.PtrToStringAnsi(MediaInfoA_Get(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, Parameter_Ptr, (IntPtr)KindOfInfo, (IntPtr)KindOfSearch)); Marshal.FreeHGlobal(Parameter_Ptr); return ToReturn; } else return Marshal.PtrToStringUni(MediaInfo_Get(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, Parameter, (IntPtr)KindOfInfo, (IntPtr)KindOfSearch)); } public String Get(StreamKind StreamKind, int StreamNumber, int Parameter, InfoKind KindOfInfo) { if (MustUseAnsi) return Marshal.PtrToStringAnsi(MediaInfoA_GetI(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, (IntPtr)Parameter, (IntPtr)KindOfInfo)); else return Marshal.PtrToStringUni(MediaInfo_GetI(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, (IntPtr)Parameter, (IntPtr)KindOfInfo)); } public String Option(String Option, String Value) { if (MustUseAnsi) { IntPtr Option_Ptr=Marshal.StringToHGlobalAnsi(Option); IntPtr Value_Ptr=Marshal.StringToHGlobalAnsi(Value); String ToReturn=Marshal.PtrToStringAnsi(MediaInfoA_Option(Handle, Option_Ptr, Value_Ptr)); Marshal.FreeHGlobal(Option_Ptr); Marshal.FreeHGlobal(Value_Ptr); return ToReturn; } else return Marshal.PtrToStringUni(MediaInfo_Option(Handle, Option, Value)); } public int State_Get() { return (int)MediaInfo_State_Get(Handle); } public int Count_Get(StreamKind StreamKind, int StreamNumber) { return (int)MediaInfo_Count_Get(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber); } private IntPtr Handle; private bool MustUseAnsi; //Default values, if you know how to set default values in C#, say me public String Get(StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo) { return Get(StreamKind, StreamNumber, Parameter, KindOfInfo, InfoKind.Name); } public String Get(StreamKind StreamKind, int StreamNumber, String Parameter) { return Get(StreamKind, StreamNumber, Parameter, InfoKind.Text, InfoKind.Name); } public String Get(StreamKind StreamKind, int StreamNumber, int Parameter) { return Get(StreamKind, StreamNumber, Parameter, InfoKind.Text); } public String Option(String Option_) { return Option(Option_, ""); } public int Count_Get(StreamKind StreamKind) { return Count_Get(StreamKind, -1); } } public class MediaInfoList { //Import of DLL functions. DO NOT USE until you know what you do (MediaInfo DLL do NOT use CoTaskMemAlloc to allocate memory) [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_New(); [DllImport("MediaInfo.dll")] private static extern void MediaInfoList_Delete(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Open(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string FileName, IntPtr Options); [DllImport("MediaInfo.dll")] private static extern void MediaInfoList_Close(IntPtr Handle, IntPtr FilePos); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Inform(IntPtr Handle, IntPtr FilePos, IntPtr Reserved); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_GetI(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Get(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber, [MarshalAs(UnmanagedType.LPWStr)] string Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Option(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string Option, [MarshalAs(UnmanagedType.LPWStr)] string Value); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_State_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Count_Get(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber); //MediaInfo class public MediaInfoList() { Handle = MediaInfoList_New(); } ~MediaInfoList() { MediaInfoList_Delete(Handle); } public int Open(String FileName, InfoFileOptions Options) { return (int)MediaInfoList_Open(Handle, FileName, (IntPtr)Options); } public void Close(int FilePos) { MediaInfoList_Close(Handle, (IntPtr)FilePos); } public String Inform(int FilePos) { return Marshal.PtrToStringUni(MediaInfoList_Inform(Handle, (IntPtr)FilePos, (IntPtr)0)); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo, InfoKind KindOfSearch) { return Marshal.PtrToStringUni(MediaInfoList_Get(Handle, (IntPtr)FilePos, (IntPtr)StreamKind, (IntPtr)StreamNumber, Parameter, (IntPtr)KindOfInfo, (IntPtr)KindOfSearch)); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, int Parameter, InfoKind KindOfInfo) { return Marshal.PtrToStringUni(MediaInfoList_GetI(Handle, (IntPtr)FilePos, (IntPtr)StreamKind, (IntPtr)StreamNumber, (IntPtr)Parameter, (IntPtr)KindOfInfo)); } public String Option(String Option, String Value) { return Marshal.PtrToStringUni(MediaInfoList_Option(Handle, Option, Value)); } public int State_Get() { return (int)MediaInfoList_State_Get(Handle); } public int Count_Get(int FilePos, StreamKind StreamKind, int StreamNumber) { return (int)MediaInfoList_Count_Get(Handle, (IntPtr)FilePos, (IntPtr)StreamKind, (IntPtr)StreamNumber); } private IntPtr Handle; //Default values, if you know how to set default values in C#, say me public void Open(String FileName) { Open(FileName, 0); } public void Close() { Close(-1); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo) { return Get(FilePos, StreamKind, StreamNumber, Parameter, KindOfInfo, InfoKind.Name); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, String Parameter) { return Get(FilePos, StreamKind, StreamNumber, Parameter, InfoKind.Text, InfoKind.Name); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, int Parameter) { return Get(FilePos, StreamKind, StreamNumber, Parameter, InfoKind.Text); } public String Option(String Option_) { return Option(Option_, ""); } public int Count_Get(int FilePos, StreamKind StreamKind) { return Count_Get(FilePos, StreamKind, -1); } } } //NameSpace MediaInfoLib/Project/MSCS2010/asp_net_web_application/Properties/ 40777 0 0 0 12226004263 20037 5MediaInfoLib/Project/MSCS2010/asp_net_web_application/Properties/AssemblyInfo.cs100777 0 0 2624 12226004263 23065 0using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("asp_net_web_application")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Zenitram")] [assembly: AssemblyProduct("asp_net_web_application")] [assembly: AssemblyCopyright("Copyright © Zenitram 2009")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] MediaInfoLib/Project/MSCS2010/Example/ 40777 0 0 0 12264020632 12425 5MediaInfoLib/Project/MSCS2010/Example/App.ico100777 0 0 2066 12226004263 13745 0 &(( @wwwwwwwwwwwwwwpDDDDDDDDDDDDDDppppppppppppppppppppDDDDDDDDDDDDDDpLLLLLLLLLNItpDDDDDDDDDDDDD@( wwwwwwwDDDDDDDGOGOGOGOGOGOGOGOGHGLGDDDDDDMediaInfoLib/Project/MSCS2010/Example/AssemblyInfo.cs100777 0 0 5033 12226004263 15450 0using System.Reflection; using System.Runtime.CompilerServices; // // Les informations gnrales relatives un assembly dpendent de // l'ensemble d'attributs suivant. Pour modifier les informations // associes un assembly, changez les valeurs de ces attributs. // [assembly: AssemblyTitle("")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // // Les informations de version pour un assembly se composent des quatre valeurs suivantes: // // Version principale // Version secondaire // Numro de build // Rvision // // Vous pouvez spcifier toutes les valeurs ou indiquer des numros de rvision et de build par dfaut // en utilisant '*', comme ci-dessous : [assembly: AssemblyVersion("1.0.*")] // // Pour signer votre assembly, vous devez spcifier la cl utiliser. Consultez // la documentation Microsoft .NET Framework pour plus d'informations sur la signature d'un assembly. // // Utilisez les attributs ci-dessous pour contrler la cl utilise lors de la signature. // // Remarques: // (*) Si aucune cl n'est spcifie, l'assembly n'est pas sign. // (*) KeyName fait rfrence une cl installe dans le fournisseur de // services cryptographiques (CSP) de votre ordinateur. KeyFile fait rfrence un fichier qui contient // une cl. // (*) Si les valeurs de KeyFile et de KeyName sont spcifies, le // traitement suivant se produit: // (1) Si KeyName se trouve dans le CSP, la cl est utilise. // (2) Si KeyName n'existe pas mais que KeyFile existe, la cl // de KeyFile est installe dans le CSP et utilise. // (*) Pour crer KeyFile, vous pouvez utiliser l'utilitaire sn.exe (Strong Name, Nom fort). // Lors de la spcification de KeyFile, son emplacement doit tre // relatif au rpertoire de sortie du projet qui est // %Project Directory%\obj\. Par exemple, si votre KeyFile se trouve // dans le rpertoire du projet, vous devez spcifier l'attribut // AssemblyKeyFile sous la forme [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] // (*) DelaySign (signature diffre) est une option avance. Pour plus d'informations, consultez la // documentation Microsoft .NET Framework. // [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] [assembly: AssemblyKeyName("")] MediaInfoLib/Project/MSCS2010/Example/HowToUse_Dll.cs100777 0 0 17555 12252325366 15432 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Microsoft Visual C# example // // To make this example working, you must put MediaInfo.Dll and Example.ogg // in the "./Bin/__ConfigurationName__" folder // and add MediaInfoDll.cs to your project // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Text; using System.IO; using MediaInfoLib; namespace MediaInfoLib_MSCS { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.RichTextBox richTextBox1; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Mthode requise pour la prise en charge du concepteur - ne modifiez pas /// le contenu de cette mthode avec l'diteur de code. /// private void InitializeComponent() { this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.SuspendLayout(); // // richTextBox1 // this.richTextBox1.Location = new System.Drawing.Point(0, 0); this.richTextBox1.Name = "richTextBox1"; this.richTextBox1.Size = new System.Drawing.Size(768, 512); this.richTextBox1.TabIndex = 0; this.richTextBox1.Text = ""; // // Form1 // this.ClientSize = new System.Drawing.Size(770, 514); this.Controls.Add(this.richTextBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "How to use MediaInfo.Dll"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); } #endregion /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.Run(new Form1()); } private void Form1_Load(object sender, System.EventArgs e) { //Test if version of DLL is compatible : 3rd argument is "version of DLL tested;Your application name;Your application version" String ToDisplay; MediaInfo MI = new MediaInfo(); ToDisplay = MI.Option("Info_Version", "0.7.0.0;MediaInfoDLL_Example_CS;0.7.0.0"); if (ToDisplay.Length == 0) { richTextBox1.Text = "MediaInfo.Dll: this version of the DLL is not compatible"; return; } //Information about MediaInfo ToDisplay += "\r\n\r\nInfo_Parameters\r\n"; ToDisplay += MI.Option("Info_Parameters"); ToDisplay += "\r\n\r\nInfo_Capacities\r\n"; ToDisplay += MI.Option("Info_Capacities"); ToDisplay += "\r\n\r\nInfo_Codecs\r\n"; ToDisplay += MI.Option("Info_Codecs"); //An example of how to use the library ToDisplay += "\r\n\r\nOpen\r\n"; MI.Open("Example.ogg"); ToDisplay += "\r\n\r\nInform with Complete=false\r\n"; MI.Option("Complete"); ToDisplay += MI.Inform(); ToDisplay += "\r\n\r\nInform with Complete=true\r\n"; MI.Option("Complete", "1"); ToDisplay += MI.Inform(); ToDisplay += "\r\n\r\nCustom Inform\r\n"; MI.Option("Inform", "General;File size is %FileSize% bytes"); ToDisplay += MI.Inform(); ToDisplay += "\r\n\r\nGet with Stream=General and Parameter='FileSize'\r\n"; ToDisplay += MI.Get(0, 0, "FileSize"); ToDisplay += "\r\n\r\nGet with Stream=General and Parameter=46\r\n"; ToDisplay += MI.Get(0, 0, 46); ToDisplay += "\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n"; ToDisplay += MI.Count_Get(StreamKind.Audio); ToDisplay += "\r\n\r\nGet with Stream=General and Parameter='AudioCount'\r\n"; ToDisplay += MI.Get(StreamKind.General, 0, "AudioCount"); ToDisplay += "\r\n\r\nGet with Stream=Audio and Parameter='StreamCount'\r\n"; ToDisplay += MI.Get(StreamKind.Audio, 0, "StreamCount"); ToDisplay += "\r\n\r\nClose\r\n"; MI.Close(); //Example with a stream //ToDisplay+="\r\n"+ExampleWithStream()+"\r\n"; //Displaying the text richTextBox1.Text = ToDisplay; } String ExampleWithStream() { //Initilaizing MediaInfo MediaInfo MI = new MediaInfo(); //From: preparing an example file for reading FileStream From = new FileStream("Example.ogg", FileMode.Open, FileAccess.Read); //From: preparing a memory buffer for reading byte[] From_Buffer = new byte[64*1024]; int From_Buffer_Size; //The size of the read file buffer //Preparing to fill MediaInfo with a buffer MI.Open_Buffer_Init(From.Length, 0); //The parsing loop do { //Reading data somewhere, do what you want for this. From_Buffer_Size = From.Read(From_Buffer, 0, 64 * 1024); //Sending the buffer to MediaInfo System.Runtime.InteropServices.GCHandle GC = System.Runtime.InteropServices.GCHandle.Alloc(From_Buffer, System.Runtime.InteropServices.GCHandleType.Pinned); IntPtr From_Buffer_IntPtr = GC.AddrOfPinnedObject(); Status Result = (Status)MI.Open_Buffer_Continue(From_Buffer_IntPtr, (IntPtr)From_Buffer_Size); GC.Free(); if ((Result & Status.Finalized) == Status.Finalized) break; //Testing if MediaInfo request to go elsewhere if (MI.Open_Buffer_Continue_GoTo_Get() != -1) { Int64 Position = From.Seek(MI.Open_Buffer_Continue_GoTo_Get(), SeekOrigin.Begin); //Position the file MI.Open_Buffer_Init(From.Length, Position); //Informing MediaInfo we have seek } } while (From_Buffer_Size > 0); //Finalizing MI.Open_Buffer_Finalize(); //This is the end of the stream, MediaInfo must finnish some work //Get() example return "Container format is " + MI.Get(StreamKind.General, 0, "Format"); } } } MediaInfoLib/Project/MSCS2010/Example/HowToUse_Dll.csproj100777 0 0 12733 12226004263 16305 0 Local 9.0.21022 2.0 {574FB186-52E8-4EAA-9BC9-815F2B2CA632} Debug AnyCPU App.ico HowToUse_Dll JScript Grid IE50 false WinExe HowToUse_Dll OnBuildSuccess 3.5 v2.0 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true bin\Debug\ false 285212672 false DEBUG;TRACE true 4096 false false false false false 4 AllRules.ruleset AnyCPU bin\Release\ false 285212672 false TRACE false 4096 false true false false false 4 AllRules.ruleset System System.Data System.Drawing System.Windows.Forms System.XML Code Form False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true MediaInfoLib/Project/MSCS2010/Example/MediaInfoDLL.cs100777 0 0 35366 12252326237 15307 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Microsoft Visual C# wrapper for MediaInfo Library // See MediaInfo.h for help // // To make it working, you must put MediaInfo.Dll // in the executable folder // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ using System; using System.Runtime.InteropServices; #pragma warning disable 1591 // Disable XML documentation warnings namespace MediaInfoLib { public enum StreamKind { General, Video, Audio, Text, Other, Image, Menu, } public enum InfoKind { Name, Text, Measure, Options, NameText, MeasureText, Info, HowTo } public enum InfoOptions { ShowInInform, Support, ShowInSupported, TypeOfValue } public enum InfoFileOptions { FileOption_Nothing = 0x00, FileOption_NoRecursive = 0x01, FileOption_CloseAll = 0x02, FileOption_Max = 0x04 }; public enum Status { None = 0x00, Accepted = 0x01, Filled = 0x02, Updated = 0x04, Finalized = 0x08, } public class MediaInfo { //Import of DLL functions. DO NOT USE until you know what you do (MediaInfo DLL do NOT use CoTaskMemAlloc to allocate memory) [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_New(); [DllImport("MediaInfo.dll")] private static extern void MediaInfo_Delete(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string FileName); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open(IntPtr Handle, IntPtr FileName); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open_Buffer_Init(IntPtr Handle, Int64 File_Size, Int64 File_Offset); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open(IntPtr Handle, Int64 File_Size, Int64 File_Offset); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open_Buffer_Continue(IntPtr Handle, IntPtr Buffer, IntPtr Buffer_Size); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open_Buffer_Continue(IntPtr Handle, Int64 File_Size, byte[] Buffer, IntPtr Buffer_Size); [DllImport("MediaInfo.dll")] private static extern Int64 MediaInfo_Open_Buffer_Continue_GoTo_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern Int64 MediaInfoA_Open_Buffer_Continue_GoTo_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open_Buffer_Finalize(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open_Buffer_Finalize(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern void MediaInfo_Close(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Inform(IntPtr Handle, IntPtr Reserved); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Inform(IntPtr Handle, IntPtr Reserved); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_GetI(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_GetI(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, [MarshalAs(UnmanagedType.LPWStr)] string Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Option(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string Option, [MarshalAs(UnmanagedType.LPWStr)] string Value); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Option(IntPtr Handle, IntPtr Option, IntPtr Value); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_State_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Count_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber); //MediaInfo class public MediaInfo() { try { Handle = MediaInfo_New(); } catch { Handle = (IntPtr)0; } if (Environment.OSVersion.ToString().IndexOf("Windows") == -1) MustUseAnsi=true; else MustUseAnsi=false; } ~MediaInfo() { if (Handle == (IntPtr)0) return; MediaInfo_Delete(Handle); } public int Open(String FileName) { if (Handle == (IntPtr)0) return 0; if (MustUseAnsi) { IntPtr FileName_Ptr = Marshal.StringToHGlobalAnsi(FileName); int ToReturn = (int)MediaInfoA_Open(Handle, FileName_Ptr); Marshal.FreeHGlobal(FileName_Ptr); return ToReturn; } else return (int)MediaInfo_Open(Handle, FileName); } public int Open_Buffer_Init(Int64 File_Size, Int64 File_Offset) { if (Handle == (IntPtr)0) return 0; return (int)MediaInfo_Open_Buffer_Init(Handle, File_Size, File_Offset); } public int Open_Buffer_Continue(IntPtr Buffer, IntPtr Buffer_Size) { if (Handle == (IntPtr)0) return 0; return (int)MediaInfo_Open_Buffer_Continue(Handle, Buffer, Buffer_Size); } public Int64 Open_Buffer_Continue_GoTo_Get() { if (Handle == (IntPtr)0) return 0; return (Int64)MediaInfo_Open_Buffer_Continue_GoTo_Get(Handle); } public int Open_Buffer_Finalize() { if (Handle == (IntPtr)0) return 0; return (int)MediaInfo_Open_Buffer_Finalize(Handle); } public void Close() { if (Handle == (IntPtr)0) return; MediaInfo_Close(Handle); } public String Inform() { if (Handle == (IntPtr)0) return "Unable to load MediaInfo library"; if (MustUseAnsi) return Marshal.PtrToStringAnsi(MediaInfoA_Inform(Handle, (IntPtr)0)); else return Marshal.PtrToStringUni(MediaInfo_Inform(Handle, (IntPtr)0)); } public String Get(StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo, InfoKind KindOfSearch) { if (Handle == (IntPtr)0) return "Unable to load MediaInfo library"; if (MustUseAnsi) { IntPtr Parameter_Ptr=Marshal.StringToHGlobalAnsi(Parameter); String ToReturn=Marshal.PtrToStringAnsi(MediaInfoA_Get(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, Parameter_Ptr, (IntPtr)KindOfInfo, (IntPtr)KindOfSearch)); Marshal.FreeHGlobal(Parameter_Ptr); return ToReturn; } else return Marshal.PtrToStringUni(MediaInfo_Get(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, Parameter, (IntPtr)KindOfInfo, (IntPtr)KindOfSearch)); } public String Get(StreamKind StreamKind, int StreamNumber, int Parameter, InfoKind KindOfInfo) { if (Handle == (IntPtr)0) return "Unable to load MediaInfo library"; if (MustUseAnsi) return Marshal.PtrToStringAnsi(MediaInfoA_GetI(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, (IntPtr)Parameter, (IntPtr)KindOfInfo)); else return Marshal.PtrToStringUni(MediaInfo_GetI(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, (IntPtr)Parameter, (IntPtr)KindOfInfo)); } public String Option(String Option, String Value) { if (Handle == (IntPtr)0) return "Unable to load MediaInfo library"; if (MustUseAnsi) { IntPtr Option_Ptr=Marshal.StringToHGlobalAnsi(Option); IntPtr Value_Ptr=Marshal.StringToHGlobalAnsi(Value); String ToReturn=Marshal.PtrToStringAnsi(MediaInfoA_Option(Handle, Option_Ptr, Value_Ptr)); Marshal.FreeHGlobal(Option_Ptr); Marshal.FreeHGlobal(Value_Ptr); return ToReturn; } else return Marshal.PtrToStringUni(MediaInfo_Option(Handle, Option, Value)); } public int State_Get() { if (Handle == (IntPtr)0) return 0; return (int)MediaInfo_State_Get(Handle); } public int Count_Get(StreamKind StreamKind, int StreamNumber) { if (Handle == (IntPtr)0) return 0; return (int)MediaInfo_Count_Get(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber); } private IntPtr Handle; private bool MustUseAnsi; //Default values, if you know how to set default values in C#, say me public String Get(StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo) { return Get(StreamKind, StreamNumber, Parameter, KindOfInfo, InfoKind.Name); } public String Get(StreamKind StreamKind, int StreamNumber, String Parameter) { return Get(StreamKind, StreamNumber, Parameter, InfoKind.Text, InfoKind.Name); } public String Get(StreamKind StreamKind, int StreamNumber, int Parameter) { return Get(StreamKind, StreamNumber, Parameter, InfoKind.Text); } public String Option(String Option_) { return Option(Option_, ""); } public int Count_Get(StreamKind StreamKind) { return Count_Get(StreamKind, -1); } } public class MediaInfoList { //Import of DLL functions. DO NOT USE until you know what you do (MediaInfo DLL do NOT use CoTaskMemAlloc to allocate memory) [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_New(); [DllImport("MediaInfo.dll")] private static extern void MediaInfoList_Delete(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Open(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string FileName, IntPtr Options); [DllImport("MediaInfo.dll")] private static extern void MediaInfoList_Close(IntPtr Handle, IntPtr FilePos); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Inform(IntPtr Handle, IntPtr FilePos, IntPtr Reserved); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_GetI(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Get(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber, [MarshalAs(UnmanagedType.LPWStr)] string Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Option(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string Option, [MarshalAs(UnmanagedType.LPWStr)] string Value); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_State_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Count_Get(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber); //MediaInfo class public MediaInfoList() { Handle = MediaInfoList_New(); } ~MediaInfoList() { MediaInfoList_Delete(Handle); } public int Open(String FileName, InfoFileOptions Options) { return (int)MediaInfoList_Open(Handle, FileName, (IntPtr)Options); } public void Close(int FilePos) { MediaInfoList_Close(Handle, (IntPtr)FilePos); } public String Inform(int FilePos) { return Marshal.PtrToStringUni(MediaInfoList_Inform(Handle, (IntPtr)FilePos, (IntPtr)0)); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo, InfoKind KindOfSearch) { return Marshal.PtrToStringUni(MediaInfoList_Get(Handle, (IntPtr)FilePos, (IntPtr)StreamKind, (IntPtr)StreamNumber, Parameter, (IntPtr)KindOfInfo, (IntPtr)KindOfSearch)); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, int Parameter, InfoKind KindOfInfo) { return Marshal.PtrToStringUni(MediaInfoList_GetI(Handle, (IntPtr)FilePos, (IntPtr)StreamKind, (IntPtr)StreamNumber, (IntPtr)Parameter, (IntPtr)KindOfInfo)); } public String Option(String Option, String Value) { return Marshal.PtrToStringUni(MediaInfoList_Option(Handle, Option, Value)); } public int State_Get() { return (int)MediaInfoList_State_Get(Handle); } public int Count_Get(int FilePos, StreamKind StreamKind, int StreamNumber) { return (int)MediaInfoList_Count_Get(Handle, (IntPtr)FilePos, (IntPtr)StreamKind, (IntPtr)StreamNumber); } private IntPtr Handle; //Default values, if you know how to set default values in C#, say me public void Open(String FileName) { Open(FileName, 0); } public void Close() { Close(-1); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo) { return Get(FilePos, StreamKind, StreamNumber, Parameter, KindOfInfo, InfoKind.Name); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, String Parameter) { return Get(FilePos, StreamKind, StreamNumber, Parameter, InfoKind.Text, InfoKind.Name); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, int Parameter) { return Get(FilePos, StreamKind, StreamNumber, Parameter, InfoKind.Text); } public String Option(String Option_) { return Option(Option_, ""); } public int Count_Get(int FilePos, StreamKind StreamKind) { return Count_Get(FilePos, StreamKind, -1); } } } //NameSpace MediaInfoLib/Project/MSCS2010/MediaInfoLib_MSCS.sln100777 0 0 2637 12226004263 14767 0Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HowToUse_Dll", "Example\HowToUse_Dll.csproj", "{574FB186-52E8-4EAA-9BC9-815F2B2CA632}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "asp_net_web_application", "asp_net_web_application\asp_net_web_application.csproj", "{7B5EECA2-2BDA-472C-AB04-0C2E3D428908}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {574FB186-52E8-4EAA-9BC9-815F2B2CA632}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {574FB186-52E8-4EAA-9BC9-815F2B2CA632}.Debug|Any CPU.Build.0 = Debug|Any CPU {574FB186-52E8-4EAA-9BC9-815F2B2CA632}.Release|Any CPU.ActiveCfg = Release|Any CPU {574FB186-52E8-4EAA-9BC9-815F2B2CA632}.Release|Any CPU.Build.0 = Release|Any CPU {7B5EECA2-2BDA-472C-AB04-0C2E3D428908}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7B5EECA2-2BDA-472C-AB04-0C2E3D428908}.Debug|Any CPU.Build.0 = Debug|Any CPU {7B5EECA2-2BDA-472C-AB04-0C2E3D428908}.Release|Any CPU.ActiveCfg = Release|Any CPU {7B5EECA2-2BDA-472C-AB04-0C2E3D428908}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal MediaInfoLib/Project/MSJS/ 40777 0 0 0 12226004263 10536 5MediaInfoLib/Project/MSJS/Example/ 40777 0 0 0 12226004263 12131 5MediaInfoLib/Project/MSJS/Example/AssemblyInfo.jsl100777 0 0 4565 12226004263 15350 0import System.Reflection.*; import System.Runtime.CompilerServices.*; // // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. // /** @assembly AssemblyTitle("") */ /** @assembly AssemblyDescription("") */ /** @assembly AssemblyConfiguration("") */ /** @assembly AssemblyCompany("") */ /** @assembly AssemblyProduct("") */ /** @assembly AssemblyCopyright("") */ /** @assembly AssemblyTrademark("") */ /** @assembly AssemblyCulture("") */ // // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build // Numbers by using the '*' as shown below: /** @assembly AssemblyVersion("1.0.*") */ // // In order to sign your assembly you must specify a key to use. Refer to the // Microsoft .NET Framework documentation for more information on assembly signing. // // Use the attributes below to control which key is used for signing. // // Notes: // (*) If no key is specified, the assembly is not signed. // (*) KeyName refers to a key that has been installed in the Crypto Service // Provider (CSP) on your machine. KeyFile refers to a file which contains // a key. // (*) If the KeyFile and the KeyName values are both specified, the // following processing occurs: // (1) If the KeyName can be found in the CSP, that key is used. // (2) If the KeyName does not exist and the KeyFile does exist, the key // in the KeyFile is installed into the CSP and used. // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. // When specifying the KeyFile, the location of the KeyFile should be // relative to the project directory. For example, if your KeyFile is // located in the project directory itself, you would specify the // AssemblyKeyFile attribute as @assembly AssemblyKeyFile("mykey.snk") // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework // documentation for more information on this. // /** @assembly AssemblyDelaySign(false) */ /** @assembly AssemblyKeyFile("") */ /** @assembly AssemblyKeyName("") */ MediaInfoLib/Project/MSJS/Example/HowToUse_Dll.jsl100777 0 0 14225 12226004263 15277 0// MediaInfoDLL - All info about media files // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Microsoft Visual J# example // // To make this example working, you must put MediaInfo.Dll and Example.ogg // in the "./Bin/__ConfigurationName__" folder // and add MediaInfoDll.jsl to your project // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ package Example; import System.Drawing.*; import System.Collections.*; import System.ComponentModel.*; import System.Windows.Forms.*; import System.Data.*; import System.Text.*; /** * Summary description for Form1. */ public class Form1 extends System.Windows.Forms.Form { private System.Windows.Forms.RichTextBox richTextBox1; /** * Required designer variable. */ private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /** * Clean up any resources being used. */ protected void Dispose(boolean disposing) { if (disposing) { if (components != null) { components.Dispose(); } } super.Dispose(disposing); } #region Windows Form Designer generated code /** * Required method for Designer support - do not modify * the contents of this method with the code editor. */ private void InitializeComponent() { this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.SuspendLayout(); // // richTextBox1 // this.richTextBox1.set_Font(new System.Drawing.Font("Microsoft Sans Serif", 8.25F)); this.richTextBox1.set_Location(new System.Drawing.Point(0, 0)); this.richTextBox1.set_Name("richTextBox1"); this.richTextBox1.set_Size(new System.Drawing.Size(768, 512)); this.richTextBox1.set_TabIndex(0); this.richTextBox1.set_Text(""); // // Form1 // this.set_AutoScaleBaseSize(new System.Drawing.Size(5, 13)); this.set_ClientSize(new System.Drawing.Size(774, 514)); this.get_Controls().Add(this.richTextBox1); this.set_FormBorderStyle(System.Windows.Forms.FormBorderStyle.Fixed3D); this.set_Name("Form1"); this.set_StartPosition(System.Windows.Forms.FormStartPosition.CenterScreen); this.set_Text("MediaInfo.Dll Example"); this.add_Load( new System.EventHandler(this.Form1_Load) ); this.ResumeLayout(false); } #endregion /** * The main entry point for the application. */ public static void main(String[] args) { Application.Run(new Form1()); } private void Form1_Load (Object sender, System.EventArgs e) { //Test if version of DLL is compatible : 3rd argument is "version of DLL tested;Your application name;Your application version" String ToDisplay; MediaInfo MI = new MediaInfo(); ToDisplay = MI.Option("Info_Version", "0.7.0.0;MediaInfoDLL_Example_MSJS;0.7.0.0"); if (ToDisplay.length() == 0) { richTextBox1.set_Text("MediaInfo.Dll: this version of the DLL is not compatible"); return; } //Information about MediaInfo ToDisplay += "\r\n\r\nInfo_Parameters\r\n"; ToDisplay += MI.Option("Info_Parameters"); ToDisplay += "\r\n\r\nInfo_Capacities\r\n"; ToDisplay += MI.Option("Info_Capacities"); ToDisplay += "\r\n\r\nInfo_Codecs\r\n"; ToDisplay += MI.Option("Info_Codecs"); //An example of how to use the library ToDisplay += "\r\n\r\nOpen\r\n"; MI.Open("Example.ogg"); ToDisplay += "\r\n\r\nInform with Complete=false\r\n"; MI.Option("Complete"); ToDisplay += MI.Inform(); ToDisplay += "\r\n\r\nInform with Complete=true\r\n"; MI.Option("Complete", "1"); ToDisplay += MI.Inform(); ToDisplay += "\r\n\r\nCustom Inform\r\n"; MI.Option("Inform", "General;Example : FileSize=%FileSize%"); ToDisplay += MI.Inform(); ToDisplay += "\r\n\r\nGet with Stream=General and Parameter=//FileSize//\r\n"; ToDisplay += MI.Get(StreamKind.General, 0, "FileSize"); ToDisplay += "\r\n\r\nGetI with Stream=General and Parameter=46\r\n"; ToDisplay += MI.Get(StreamKind.General, 0, 46); ToDisplay += "\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n"; ToDisplay += MI.Count_Get(StreamKind.Audio); ToDisplay += "\r\n\r\nGet with Stream=General and Parameter=//AudioCount//\r\n"; ToDisplay += MI.Get(StreamKind.General, 0, "AudioCount"); ToDisplay += "\r\n\r\nGet with Stream=Audio and Parameter=//StreamCount//\r\n"; ToDisplay += MI.Get(StreamKind.Audio, 0, "StreamCount"); ToDisplay += "\r\n\r\nClose\r\n"; MI.Close(); //Displaying the text richTextBox1.set_Text(ToDisplay); } } MediaInfoLib/Project/MSJS/Example/HowToUse_Dll.resx100777 0 0 15537 12226004263 15477 0 text/microsoft-resx 1.3 System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 False Private Private False (Default) False False 8, 8 True 80 Form1 True Private MediaInfoLib/Project/MSJS/Example/HowToUse_Dll.vjsproj100777 0 0 6522 12226004263 16165 0 Local 8.0.50727 2.0 {867C920A-B79B-4AED-BEBD-91EFEB79AC31} Debug x86 Example JScript Grid IE50 WinExe Example OnBuildSuccess bin\Debug\ 285212672 DEBUG;TRACE true false false false 4 bin\Release\ 285212672 TRACE false true false false 4 System System.Data System.Drawing System.Windows.Forms System.XML vjslib Code Form HowToUse_Dll.jsl Designer MediaInfoLib/Project/MSJS/Example/MediaInfoDLL.jsl100777 0 0 11521 12226004263 15152 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Microsoft Visual J# wrapper for MediaInfo Library // See MediaInfo.h for help // // To make it working, you must put MediaInfo.Dll // in the executable folder // // Warning : not tested with J# 64-bit, will not work! // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ import System.Runtime.InteropServices.*; import System.IntPtr; public enum StreamKind { General, Visual, Audio, Text, Chapters, Image, Menu, Max } public enum InfoKind { Name, Text, Measure, Options, NameText, MeasureText, Info, HowTo, Max } public enum InfoOptions { ShowInInform, Reserved, ShowInSupported, TypeOfValue, Max } public class MediaInfo { /**@attribute DllImport("MediaInfo.dll")*/ public static native IntPtr MediaInfo_New(); /**@attribute DllImport("MediaInfo.dll")*/ public static native void MediaInfo_Delete(IntPtr Handle); /**@attribute DllImport("MediaInfo.dll")*/ public static native int MediaInfo_Open(IntPtr Handle, /** @attribute MarshalAs(UnmanagedType.LPWStr)*/ String File); /**@attribute DllImport("MediaInfo.dll")*/ public static native void MediaInfo_Close(IntPtr Handle); /**@attribute DllImport("MediaInfo.dll")*/ public static native IntPtr MediaInfo_Inform(IntPtr Handle, int Options); //WARNING : This is a wchar* value /**@attribute DllImport("MediaInfo.dll")*/ public static native IntPtr MediaInfo_GetI(IntPtr Handle, StreamKind StreamKind, int StreamNumber, int Parameter, InfoKind KindOfInfo); //WARNING : This is a wchar* value, see MediaInfoDLL.h for enumeration values /**@attribute DllImport("MediaInfo.dll")*/ public static native IntPtr MediaInfo_Get(IntPtr Handle, StreamKind StreamKind, int StreamNumber, /** @attribute MarshalAs(UnmanagedType.LPWStr)*/ String Parameter, InfoKind KindOfInfo, InfoKind KindOfSearch); //WARNING : This is a wchar* value, see MediaInfoDLL.h for enumeration values /**@attribute DllImport("MediaInfo.dll")*/ public static native IntPtr MediaInfo_Option(IntPtr Handle, /** @attribute MarshalAs(UnmanagedType.LPWStr)*/ String Option, /** @attribute MarshalAs(UnmanagedType.LPWStr)*/ String Value); //WARNING : This is a wchar* value, see MediaInfoDLL.h for enumeration values /**@attribute DllImport("MediaInfo.dll")*/ public static native int MediaInfo_State_Get(IntPtr Handle); //see MediaInfoDLL.h for details /**@attribute DllImport("MediaInfo.dll")*/ public static native int MediaInfo_Count_Get(IntPtr Handle, StreamKind StreamKind, int StreamNumber); //see MediaInfoDLL.h for enumeration values //MediaInfo class public MediaInfo() { Handle = MediaInfo_New(); } void Dispose(boolean disposing) { MediaInfo_Delete(Handle); } public int Open(String FileName) { return MediaInfo_Open(Handle, FileName); } public void Close() { MediaInfo_Close(Handle); } public String Inform() { return Marshal.PtrToStringUni(MediaInfo_Inform(Handle, 0)); } public String Get(StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo, InfoKind KindOfSearch) { return Marshal.PtrToStringUni(MediaInfo_Get(Handle, StreamKind, StreamNumber, Parameter, KindOfInfo, KindOfSearch)); } public String Get(StreamKind StreamKind, int StreamNumber, int Parameter, InfoKind KindOfInfo) { return Marshal.PtrToStringUni(MediaInfo_GetI(Handle, StreamKind, StreamNumber, Parameter, KindOfInfo)); } public String Option(String Option, String Value) { return Marshal.PtrToStringUni(MediaInfo_Option(Handle, Option, Value)); } public int State_Get() { return MediaInfo_State_Get(Handle); } public int Count_Get(StreamKind StreamKind, int StreamNumber) { return MediaInfo_Count_Get(Handle, StreamKind, StreamNumber); } private IntPtr Handle; //Default values, if you know how to set default values in J#, say me public String Get(StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo) { return Get(StreamKind, StreamNumber, Parameter, KindOfInfo, InfoKind.Name); } public String Get(StreamKind StreamKind, int StreamNumber, String Parameter) { return Get(StreamKind, StreamNumber, Parameter, InfoKind.Text, InfoKind.Name); } public String Get(StreamKind StreamKind, int StreamNumber, int Parameter) { return Get(StreamKind, StreamNumber, Parameter, InfoKind.Text); } public String Option(String Option) { return Option(Option, ""); } public int Count_Get(StreamKind StreamKind) { return Count_Get(StreamKind, -1); } } MediaInfoLib/Project/MSJS/MediaInfoLib_MSJS.sln100777 0 0 1544 12226004263 14476 0Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{E6FDF86B-F3D1-11D4-8576-0002A516ECE8}") = "HowToUse_Dll", "Example\HowToUse_Dll.vjsproj", "{867C920A-B79B-4AED-BEBD-91EFEB79AC31}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x86 = Debug|x86 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {867C920A-B79B-4AED-BEBD-91EFEB79AC31}.Debug|x86.ActiveCfg = Debug|x86 {867C920A-B79B-4AED-BEBD-91EFEB79AC31}.Debug|x86.Build.0 = Debug|x86 {867C920A-B79B-4AED-BEBD-91EFEB79AC31}.Release|x86.ActiveCfg = Release|x86 {867C920A-B79B-4AED-BEBD-91EFEB79AC31}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal MediaInfoLib/Project/MSVB/ 40777 0 0 0 12264020632 10531 5MediaInfoLib/Project/MSVB2010/ 40777 0 0 0 12226004263 11034 5MediaInfoLib/Project/MSVB2010/Example/ 40777 0 0 0 12226004263 12427 5MediaInfoLib/Project/MSVB2010/Example/HowToUse_Dll.Designer.vb100777 0 0 3267 12226004263 17137 0 _ Partial Class Form1 Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) If disposing AndAlso components IsNot Nothing Then components.Dispose() End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. _ Private Sub InitializeComponent() Me.RichTextBox1 = New System.Windows.Forms.RichTextBox Me.SuspendLayout() ' 'RichTextBox1 ' Me.RichTextBox1.Location = New System.Drawing.Point(0, 0) Me.RichTextBox1.Name = "RichTextBox1" Me.RichTextBox1.Size = New System.Drawing.Size(740, 515) Me.RichTextBox1.TabIndex = 0 Me.RichTextBox1.Text = "" ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(742, 516) Me.Controls.Add(Me.RichTextBox1) Me.Name = "Form1" Me.Text = "MediaInfo.Dll example" Me.ResumeLayout(False) End Sub Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox End Class MediaInfoLib/Project/MSVB2010/Example/HowToUse_Dll.resx100777 0 0 13266 12226004263 15772 0 text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 MediaInfoLib/Project/MSVB2010/Example/HowToUse_Dll.vb100777 0 0 7552 12226004263 15401 0'' MediaInfoDLL - All info about media files '' This software is provided 'as-is', without any express or implied '' warranty. In no event will the authors be held liable for any damages '' arising from the use of this software. '' '' Permission is granted to anyone to use this software for any purpose, '' including commercial applications, and to alter it and redistribute it '' freely, subject to the following restrictions: '' '' 1. The origin of this software must not be misrepresented; you must not '' claim that you wrote the original software. If you use this software '' in a product, an acknowledgment in the product documentation would be '' appreciated but is not required. '' 2. Altered source versions must be plainly marked as such, and must not be '' misrepresented as being the original software. '' 3. This notice may not be removed or altered from any source distribution. '' ''+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ''+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ '' '' Microsoft Visual Basic example '' '' To make this example working, you must put MediaInfo.Dll and Example.ogg '' in the "./Bin/__ConfigurationName__" folder '' and add MediaInfo_Dll.vb to your project '' ''+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim To_Display As String Dim Temp As String Dim MI As MediaInfo MI = New MediaInfo To_Display = MI.Option_("Info_Version", "0.7.0.0;MediaInfoDLL_Example_MSVB;0.7.0.0") If (To_Display.Length() = 0) Then RichTextBox1.Text = "MediaInfo.Dll: this version of the DLL is not compatible" Return End If 'Information about MediaInfo To_Display += vbCrLf + vbCrLf + "Info_Parameters" + vbCrLf To_Display += MI.Option_("Info_Parameters") To_Display += vbCrLf + vbCrLf + "Info_Capacities" + vbCrLf To_Display += MI.Option_("Info_Capacities") To_Display += vbCrLf + vbCrLf + "Info_Codecs" + vbCrLf To_Display += MI.Option_("Info_Codecs") 'An example of how to use the library To_Display += vbCrLf + vbCrLf + "Open" + vbCrLf MI.Open("Example.ogg") To_Display += vbCrLf + vbCrLf + "Inform with Complete=false" + vbCrLf MI.Option_("Complete") To_Display += MI.Inform() To_Display += vbCrLf + vbCrLf + "Inform with Complete=true" + vbCrLf MI.Option_("Complete", "1") To_Display += MI.Inform() To_Display += vbCrLf + vbCrLf + "Custom Inform" + vbCrLf MI.Option_("Inform", "General;Example : FileSize=%FileSize%") To_Display += MI.Inform() To_Display += vbCrLf + vbCrLf + "Get with Stream=General and Parameter='FileSize'" + vbCrLf To_Display += MI.Get_(StreamKind.General, 0, "FileSize") To_Display += vbCrLf + vbCrLf + "GetI with Stream=General and Parameter=46" + vbCrLf To_Display += MI.Get_(StreamKind.General, 0, 46) To_Display += vbCrLf + vbCrLf + "Count_Get with StreamKind=Stream_Audio" + vbCrLf Temp = MI.Count_Get(StreamKind.Audio) To_Display += Temp To_Display += vbCrLf + vbCrLf + "Get with Stream=General and Parameter='AudioCount'" + vbCrLf To_Display += MI.Get_(StreamKind.General, 0, "AudioCount") To_Display += vbCrLf + vbCrLf + "Get with Stream=Audio and Parameter='StreamCount'" + vbCrLf To_Display += MI.Get_(StreamKind.Audio, 0, "StreamCount") To_Display += RichTextBox1.Text + vbCrLf + vbCrLf + "Close" + vbCrLf MI.Close() 'Displaying the text RichTextBox1.Text = To_Display End Sub End Class MediaInfoLib/Project/MSVB2010/Example/HowToUse_Dll.vbproj100777 0 0 15067 12226004263 16314 0 Debug AnyCPU 9.0.21022 2.0 {FE4B9E8D-D358-44F3-8E6C-37BD585A8321} WinExe HowToUse_Dll.My.MyApplication HowToUse_Dll HowToUse_Dll 512 WindowsForms v3.5 On Binary Off On 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full true true bin\Debug\ HowToUse_Dll.xml 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355 AllRules.ruleset pdbonly false true true bin\Release\ HowToUse_Dll.xml 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355 AllRules.ruleset 3.5 3.5 3.5 HowToUse_Dll.vb Form True Application.myapp True True Resources.resx True Settings.settings True VbMyResourcesResXFileCodeGenerator Resources.Designer.vb My.Resources Designer MyApplicationCodeGenerator Application.Designer.vb SettingsSingleFileGenerator My Settings.Designer.vb False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true MediaInfoLib/Project/MSVB2010/Example/MediaInfoDLL.vb100777 0 0 11122 12226004263 15264 0''' 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. ''' ''+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ '' '' Microsoft Visual Basic wrapper for MediaInfo Library '' See MediaInfo.h for help '' '' To make it working, you must put MediaInfo.Dll '' in the executable folder '' ''+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Imports System.Runtime.InteropServices Public Enum StreamKind As UInteger General Visual Audio Text Chapters Image Menu Max End Enum Public Enum InfoKind As UInteger Name Text Measure Options NameText MeasureText Info HowTo Max End Enum Public Enum InfoOptions As UInteger ShowInInform Reserved ShowInSupported TypeOfValue Max End Enum Public Class MediaInfo Private Declare Unicode Function MediaInfo_New Lib "MediaInfo.DLL" () As IntPtr Private Declare Unicode Sub MediaInfo_Delete Lib "MediaInfo.DLL" (ByVal Handle As IntPtr) Private Declare Unicode Function MediaInfo_Open Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal FileName As String) As UIntPtr Private Declare Unicode Sub MediaInfo_Close Lib "MediaInfo.DLL" (ByVal Handle As IntPtr) Private Declare Unicode Function MediaInfo_Inform Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal Reserved As UIntPtr) As IntPtr Private Declare Unicode Function MediaInfo_GetI Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal StreamKind As UIntPtr, ByVal StreamNumber As UIntPtr, ByVal Parameter As UIntPtr, ByVal KindOfInfo As UIntPtr) As IntPtr 'See MediaInfoDLL.h for enumeration values Private Declare Unicode Function MediaInfo_Get Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal StreamKind As UIntPtr, ByVal StreamNumber As UIntPtr, ByVal Parameter As String, ByVal KindOfInfo As UIntPtr, ByVal KindOfSearch As UIntPtr) As IntPtr Private Declare Unicode Function MediaInfo_Option Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal Option_ As String, ByVal Value As String) As IntPtr Private Declare Unicode Function MediaInfo_State_Get Lib "MediaInfo.DLL" (ByVal Handle As IntPtr) As UIntPtr 'see MediaInfo.h for details Private Declare Unicode Function MediaInfo_Count_Get Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal StreamKind As UIntPtr, ByVal StreamNumber As IntPtr) As UIntPtr 'see MediaInfoDLL.h for enumeration values Dim Handle As IntPtr Sub New() Handle = MediaInfo_New() End Sub Protected Overrides Sub Finalize() MediaInfo_Delete(Handle) End Sub Function Open(ByVal FileName As String) As System.UIntPtr Return MediaInfo_Open(Handle, FileName) End Function Sub Close() MediaInfo_Close(Handle) End Sub Function Inform() As String Return Marshal.PtrToStringUni(MediaInfo_Inform(Handle, CType(0, UIntPtr))) End Function Function Get_(ByVal StreamKind As StreamKind, ByVal StreamNumber As Integer, ByVal Parameter As Integer, Optional ByVal KindOfInfo As InfoKind = InfoKind.Text) As String Return Marshal.PtrToStringUni(MediaInfo_GetI(Handle, CType(StreamKind, UIntPtr), CType(StreamNumber, UIntPtr), CType(Parameter, UIntPtr), CType(KindOfInfo, UIntPtr))) End Function Function Get_(ByVal StreamKind As StreamKind, ByVal StreamNumber As Integer, ByVal Parameter As String, Optional ByVal KindOfInfo As InfoKind = InfoKind.Text, Optional ByVal KindOfSearch As InfoKind = InfoKind.Name) As String Return Marshal.PtrToStringUni(MediaInfo_Get(Handle, CType(StreamKind, UIntPtr), CType(StreamNumber, UIntPtr), Parameter, CType(KindOfInfo, UIntPtr), CType(KindOfSearch, UIntPtr))) End Function Function Option_(ByVal Option__ As String, Optional ByVal Value As String = "") As String Return Marshal.PtrToStringUni(MediaInfo_Option(Handle, Option__, Value)) End Function Function State_Get() As Integer Return CInt(MediaInfo_State_Get(Handle)) End Function Function Count_Get(ByVal StreamKind As StreamKind, Optional ByVal StreamNumber As UInteger = UInteger.MaxValue) As Integer If StreamNumber = UInteger.MaxValue Then Return CInt(MediaInfo_Count_Get(Handle, CType(StreamKind, UIntPtr), CType(-1, IntPtr))) Else Return CInt(MediaInfo_Count_Get(Handle, CType(StreamKind, UIntPtr), CType(StreamNumber, IntPtr))) End If End Function End Class MediaInfoLib/Project/MSVB2010/Example/My Project/ 40777 0 0 0 12226004263 14403 5MediaInfoLib/Project/MSVB2010/Example/My Project/Application.Designer.vb100777 0 0 2750 12226004263 21042 0'------------------------------------------------------------------------------ ' ' This code was generated by a tool. ' Runtime Version:4.0.30319.1 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' '------------------------------------------------------------------------------ Option Strict On Option Explicit On Namespace My 'NOTE: This file is auto-generated; do not modify it directly. To make changes, ' or if you encounter build errors in this file, go to the Project Designer ' (go to Project Properties or double-click the My Project node in ' Solution Explorer), and make changes on the Application tab. ' Partial Friend Class MyApplication _ Public Sub New() MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) Me.IsSingleInstance = false Me.EnableVisualStyles = true Me.SaveMySettingsOnExit = true Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses End Sub _ Protected Overrides Sub OnCreateMainForm() Me.MainForm = Global.HowToUse_Dll.Form1 End Sub End Class End Namespace MediaInfoLib/Project/MSVB2010/Example/My Project/AssemblyInfo.vb100777 0 0 2251 12226004263 17427 0Imports System Imports System.Reflection Imports System.Runtime.InteropServices ' General Information about an assembly is controlled through the following ' set of attributes. Change these attribute values to modify the information ' associated with an assembly. ' Review the values of the assembly attributes 'The following GUID is for the ID of the typelib if this project is exposed to COM ' Version information for an assembly consists of the following four values: ' ' Major Version ' Minor Version ' Build Number ' Revision ' ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: ' MediaInfoLib/Project/MSVB2010/Example/My Project/Resources.Designer.vb100777 0 0 5331 12226004263 20547 0'------------------------------------------------------------------------------ ' ' This code was generated by a tool. ' Runtime Version:4.0.30319.1 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' '------------------------------------------------------------------------------ Option Strict On Option Explicit On Imports System Namespace My.Resources 'This class was auto-generated by the StronglyTypedResourceBuilder 'class via a tool like ResGen or Visual Studio. 'To add or remove a member, edit your .ResX file then rerun ResGen 'with the /str option, or rebuild your VS project. ''' ''' A strongly-typed resource class, for looking up localized strings, etc. ''' _ Friend Module Resources Private resourceMan As Global.System.Resources.ResourceManager Private resourceCulture As Global.System.Globalization.CultureInfo ''' ''' Returns the cached ResourceManager instance used by this class. ''' _ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager Get If Object.ReferenceEquals(resourceMan, Nothing) Then Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("HowToUse_Dll.Resources", GetType(Resources).Assembly) resourceMan = temp End If Return resourceMan End Get End Property ''' ''' Overrides the current thread's CurrentUICulture property for all ''' resource lookups using this strongly typed resource class. ''' _ Friend Property Culture() As Global.System.Globalization.CultureInfo Get Return resourceCulture End Get Set resourceCulture = value End Set End Property End Module End Namespace MediaInfoLib/Project/MSVB2010/Example/My Project/Resources.resx100777 0 0 12754 12226004263 17411 0 text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 MediaInfoLib/Project/MSVB2010/Example/My Project/Settings.Designer.vb100777 0 0 5647 12226004263 20407 0'------------------------------------------------------------------------------ ' ' This code was generated by a tool. ' Runtime Version:4.0.30319.1 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' '------------------------------------------------------------------------------ Option Strict On Option Explicit On Namespace My _ Partial Friend NotInheritable Class MySettings Inherits Global.System.Configuration.ApplicationSettingsBase Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) #Region "My.Settings Auto-Save Functionality" #If _MyType = "WindowsForms" Then Private Shared addedHandler As Boolean Private Shared addedHandlerLockObject As New Object _ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) If My.Application.SaveMySettingsOnExit Then My.Settings.Save() End If End Sub #End If #End Region Public Shared ReadOnly Property [Default]() As MySettings Get #If _MyType = "WindowsForms" Then If Not addedHandler Then SyncLock addedHandlerLockObject If Not addedHandler Then AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings addedHandler = True End If End SyncLock End If #End If Return defaultInstance End Get End Property End Class End Namespace Namespace My _ Friend Module MySettingsProperty _ Friend ReadOnly Property Settings() As Global.HowToUse_Dll.My.MySettings Get Return Global.HowToUse_Dll.My.MySettings.Default End Get End Property End Module End Namespace MediaInfoLib/Project/MSVB2010/MediaInfoLib_MSVB.sln100777 0 0 1624 12226004263 14766 0Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "HowToUse_Dll", "Example\HowToUse_Dll.vbproj", "{FE4B9E8D-D358-44F3-8E6C-37BD585A8321}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {FE4B9E8D-D358-44F3-8E6C-37BD585A8321}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FE4B9E8D-D358-44F3-8E6C-37BD585A8321}.Debug|Any CPU.Build.0 = Debug|Any CPU {FE4B9E8D-D358-44F3-8E6C-37BD585A8321}.Release|Any CPU.ActiveCfg = Release|Any CPU {FE4B9E8D-D358-44F3-8E6C-37BD585A8321}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal MediaInfoLib/Project/MSVB/Example/ 40777 0 0 0 12226004263 12124 5MediaInfoLib/Project/MSVB/Example VB6/ 40777 0 0 0 12264020632 12502 5MediaInfoLib/Project/MSVB/Example VB6/HowToUse_Dll.frm100777 0 0 12530 12226004263 15641 0VERSION 5.00 Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX" Begin VB.Form Form1 Caption = "Form1" ClientHeight = 6240 ClientLeft = 60 ClientTop = 450 ClientWidth = 10500 LinkTopic = "Form1" ScaleHeight = 6240 ScaleWidth = 10500 StartUpPosition = 3 'Windows Default Begin RichTextLib.RichTextBox RichTextBox1 Height = 6015 Left = 240 TabIndex = 0 Top = 120 Width = 10095 _ExtentX = 17806 _ExtentY = 10610 _Version = 393217 Enabled = -1 'True ScrollBars = 2 TextRTF = $"HowToUse_Dll.frx":0000 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False 'YOU MUST DO : Replace _.OGM by a valid filename 'WARNING : Use GetString Method for converting char* to String 'TODO : how to say to the richEditBox a carriage return??? Private Declare Function lstrlenA Lib "kernel32" (ByVal Ptr As Any) As Long Private Declare Function lstrcpyA Lib "kernel32" (ByVal RetVal As String, ByVal Ptr As Long) As Long Private Declare Function MediaInfoA_New Lib "MediaInfo.DLL" () As Long Private Declare Function MediaInfoA_Delete Lib "MediaInfo.DLL" (ByVal Handle As Long) As Long 'Should be void Private Declare Function MediaInfoA_Open Lib "MediaInfo.DLL" (ByVal Handle As Long, ByVal File As String) As Long Private Declare Function MediaInfoA_Close Lib "MediaInfo.DLL" (ByVal Handle As Long) As Long Private Declare Function MediaInfoA_Inform Lib "MediaInfo.DLL" (ByVal Handle As Long) As Long 'WARNING : This is a char* value Private Declare Function MediaInfoA_GetI Lib "MediaInfo.DLL" (ByVal Handle As Long, ByVal StreamKind As Long, ByVal StreamNumber As Long, ByVal Parameter As Long, ByVal KindOfInfo As Long) As Long 'WARNING : This is a char* value, see MediaInfoDLL.h for enumeration values Private Declare Function MediaInfoA_Get Lib "MediaInfo.DLL" (ByVal Handle As Long, ByVal StreamKind As Long, ByVal StreamNumber As Long, ByVal Parameter As String, ByVal KindOfInfo As Long, ByVal KindOfSearch As String) As Long 'WARNING : This is a char* value, see MediaInfoDLL.h for enumeration values Private Declare Function MediaInfoA_Count_Get Lib "MediaInfo.DLL" (ByVal Handle As Long, ByVal StreamKind As Long, ByVal StreamNumber As Long) As Long 'see MediaInfoDLL.h for enumeration values Private Declare Function MediaInfoA_Complete_Get Lib "MediaInfo.DLL" () As Long Private Declare Function MediaInfoA_Complete_Set Lib "MediaInfo.DLL" (ByVal Complete As Long) As Long Private Declare Function MediaInfoA_Inform_Set Lib "MediaInfo.DLL" (ByVal Handle As Long, ByVal Text As String) As Long Public Function GetString(ByVal lpszA As Long) As String GetString = String$(lstrlenA(ByVal lpszA), 0) Call lstrcpyA(ByVal GetString, ByVal lpszA) End Function Private Sub Form_Load() RichTextBox1.Text = RichTextBox1.Text + "\r\n\r\nNew\r\n" Handle = MediaInfoA_New() RichTextBox1.Text = RichTextBox1.Text + "\r\n\r\nOpen\r\n" MediaInfoA_Open(Handle, "D:\\_.ogm") RichTextBox1.Text = RichTextBox1.Text + "\r\n\r\nInform with Complete=false\r\n" MediaInfoA_Complete_Set (False) AAfficher = GetString(MediaInfoA_Inform(Handle)) RichTextBox1.Text = RichTextBox1.Text + AAfficher RichTextBox1.Text = RichTextBox1.Text + "\r\n\r\nInform with Complete=true\r\n" MediaInfoA_Complete_Set (True) AAfficher = GetString(MediaInfoA_Inform(Handle)) RichTextBox1.Text = RichTextBox1.Text + AAfficher RichTextBox1.Text = RichTextBox1.Text + "\r\n\r\nCustom Inform\r\n" MediaInfoA_Inform_Set Handle, "General;%FileSize%" AAfficher = GetString(MediaInfoA_Inform(Handle)) RichTextBox1.Text = RichTextBox1.Text + AAfficher RichTextBox1.Text = RichTextBox1.Text + "\r\n\r\nGetI with Stream=General and Parameter=13\r\n" AAfficher = Format(MediaInfoA_GetI(Handle, 0, 0, 13, Info_Text), "##########") RichTextBox1.Text = RichTextBox1.Text + AAfficher RichTextBox1.Text = RichTextBox1.Text + "\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n" AAfficher = Format(MediaInfoA_Count_Get(Handle, 2, -1), "##########") RichTextBox1.Text = RichTextBox1.Text + AAfficher RichTextBox1.Text = RichTextBox1.Text + "\r\n\r\nGet with Stream=General and Parameter='AudioCount'\r\n" AAfficher = GetString(MediaInfoA_Get(Handle, 0, 0, "AudioCount", 1, 0)) RichTextBox1.Text = RichTextBox1.Text + AAfficher RichTextBox1.Text = RichTextBox1.Text + "\r\n\r\nGet with Stream=Audio and Parameter='StreamCount'\r\n" AAfficher = GetString(MediaInfoA_Get(Handle, 2, 0, "StreamCount", 1, 0)) RichTextBox1.Text = RichTextBox1.Text + AAfficher RichTextBox1.Text = RichTextBox1.Text + "\r\n\r\nGet with Stream=General and Parameter='FileSize'\r\n" AAfficher = GetString(MediaInfoA_Get(Handle, 0, 0, "FileSize", 1, 0)) RichTextBox1.Text = RichTextBox1.Text + AAfficher RichTextBox1.Text = RichTextBox1.Text + "\r\n\r\nClose\r\n" MediaInfoA_Close Handle RichTextBox1.Text = RichTextBox1.Text + "\r\n\r\nDelete\r\n" Handle = MediaInfoA_Delte() End Sub MediaInfoLib/Project/MSVB/Example VB6/HowToUse_Dll.frx100777 0 0 213 12226004263 15607 0{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}} \viewkind4\uc1\pard\lang1036\f0\fs17 RichTextBox1 \par } MediaInfoLib/Project/MSVB/Example VB6/HowToUse_Dll.vbp100777 0 0 1353 12226004263 15625 0Type=Exe Form=HowToUse_Dll.frm Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\System32\stdole2.tlb#OLE Automation Object={3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0; RICHTX32.OCX IconForm="Form1" Startup="Form1" Command32="" Name="Project1" HelpContextID="0" CompatibleMode="0" MajorVer=1 MinorVer=0 RevisionVer=0 AutoIncrementVer=0 ServerSupportFiles=0 VersionCompanyName="The Corporation" CompilationType=0 OptimizationType=0 FavorPentiumPro(tm)=0 CodeViewDebugInfo=0 NoAliasing=0 BoundsCheck=0 OverflowCheck=0 FlPointCheck=0 FDIVCheck=0 UnroundedFP=0 StartMode=0 Unattended=0 Retained=0 ThreadPerObject=0 MaxNumberOfThreads=1 DebugStartupOption=0 [MS Transaction Server] AutoRefresh=1 MediaInfoLib/Project/MSVB/Example VB6/ReadMe.txt100777 0 0 273 12226004263 14462 0These files are Visual Basic 6 example. But because I work on Visual Basic 7 now, I will not maintain them. So don't be surprise if it does'nt work without any little modifications...MediaInfoLib/Project/MSVB/Example/HowToUse_Dll.Designer.vb100777 0 0 3267 12226004262 16633 0 _ Partial Class Form1 Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) If disposing AndAlso components IsNot Nothing Then components.Dispose() End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. _ Private Sub InitializeComponent() Me.RichTextBox1 = New System.Windows.Forms.RichTextBox Me.SuspendLayout() ' 'RichTextBox1 ' Me.RichTextBox1.Location = New System.Drawing.Point(0, 0) Me.RichTextBox1.Name = "RichTextBox1" Me.RichTextBox1.Size = New System.Drawing.Size(740, 515) Me.RichTextBox1.TabIndex = 0 Me.RichTextBox1.Text = "" ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(742, 516) Me.Controls.Add(Me.RichTextBox1) Me.Name = "Form1" Me.Text = "MediaInfo.Dll example" Me.ResumeLayout(False) End Sub Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox End Class MediaInfoLib/Project/MSVB/Example/HowToUse_Dll.resx100777 0 0 13266 12226004262 15466 0 text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 MediaInfoLib/Project/MSVB/Example/HowToUse_Dll.vb100777 0 0 7552 12226004262 15075 0'' MediaInfoDLL - All info about media files '' This software is provided 'as-is', without any express or implied '' warranty. In no event will the authors be held liable for any damages '' arising from the use of this software. '' '' Permission is granted to anyone to use this software for any purpose, '' including commercial applications, and to alter it and redistribute it '' freely, subject to the following restrictions: '' '' 1. The origin of this software must not be misrepresented; you must not '' claim that you wrote the original software. If you use this software '' in a product, an acknowledgment in the product documentation would be '' appreciated but is not required. '' 2. Altered source versions must be plainly marked as such, and must not be '' misrepresented as being the original software. '' 3. This notice may not be removed or altered from any source distribution. '' ''+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ''+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ '' '' Microsoft Visual Basic example '' '' To make this example working, you must put MediaInfo.Dll and Example.ogg '' in the "./Bin/__ConfigurationName__" folder '' and add MediaInfo_Dll.vb to your project '' ''+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim To_Display As String Dim Temp As String Dim MI As MediaInfo MI = New MediaInfo To_Display = MI.Option_("Info_Version", "0.7.0.0;MediaInfoDLL_Example_MSVB;0.7.0.0") If (To_Display.Length() = 0) Then RichTextBox1.Text = "MediaInfo.Dll: this version of the DLL is not compatible" Return End If 'Information about MediaInfo To_Display += vbCrLf + vbCrLf + "Info_Parameters" + vbCrLf To_Display += MI.Option_("Info_Parameters") To_Display += vbCrLf + vbCrLf + "Info_Capacities" + vbCrLf To_Display += MI.Option_("Info_Capacities") To_Display += vbCrLf + vbCrLf + "Info_Codecs" + vbCrLf To_Display += MI.Option_("Info_Codecs") 'An example of how to use the library To_Display += vbCrLf + vbCrLf + "Open" + vbCrLf MI.Open("Example.ogg") To_Display += vbCrLf + vbCrLf + "Inform with Complete=false" + vbCrLf MI.Option_("Complete") To_Display += MI.Inform() To_Display += vbCrLf + vbCrLf + "Inform with Complete=true" + vbCrLf MI.Option_("Complete", "1") To_Display += MI.Inform() To_Display += vbCrLf + vbCrLf + "Custom Inform" + vbCrLf MI.Option_("Inform", "General;Example : FileSize=%FileSize%") To_Display += MI.Inform() To_Display += vbCrLf + vbCrLf + "Get with Stream=General and Parameter='FileSize'" + vbCrLf To_Display += MI.Get_(StreamKind.General, 0, "FileSize") To_Display += vbCrLf + vbCrLf + "GetI with Stream=General and Parameter=46" + vbCrLf To_Display += MI.Get_(StreamKind.General, 0, 46) To_Display += vbCrLf + vbCrLf + "Count_Get with StreamKind=Stream_Audio" + vbCrLf Temp = MI.Count_Get(StreamKind.Audio) To_Display += Temp To_Display += vbCrLf + vbCrLf + "Get with Stream=General and Parameter='AudioCount'" + vbCrLf To_Display += MI.Get_(StreamKind.General, 0, "AudioCount") To_Display += vbCrLf + vbCrLf + "Get with Stream=Audio and Parameter='StreamCount'" + vbCrLf To_Display += MI.Get_(StreamKind.Audio, 0, "StreamCount") To_Display += RichTextBox1.Text + vbCrLf + vbCrLf + "Close" + vbCrLf MI.Close() 'Displaying the text RichTextBox1.Text = To_Display End Sub End Class MediaInfoLib/Project/MSVB/Example/HowToUse_Dll.vbproj100777 0 0 11662 12226004262 16005 0 Debug AnyCPU 9.0.21022 2.0 {FE4B9E8D-D358-44F3-8E6C-37BD585A8321} WinExe HowToUse_Dll.My.MyApplication HowToUse_Dll HowToUse_Dll 512 WindowsForms v3.5 On Binary Off On true full true true bin\Debug\ HowToUse_Dll.xml 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 pdbonly false true true bin\Release\ HowToUse_Dll.xml 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 3.5 3.5 3.5 HowToUse_Dll.vb Form True Application.myapp True True Resources.resx True Settings.settings True VbMyResourcesResXFileCodeGenerator Resources.Designer.vb My.Resources Designer MyApplicationCodeGenerator Application.Designer.vb SettingsSingleFileGenerator My Settings.Designer.vb MediaInfoLib/Project/MSVB/Example/MediaInfoDLL.vb100777 0 0 10400 12226004263 14757 0''' 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. ''' Imports System.Runtime.InteropServices Public Enum StreamKind As UInteger General Visual Audio Text Chapters Image Menu Max End Enum Public Enum InfoKind As UInteger Name Text Measure Options NameText MeasureText Info HowTo Max End Enum Public Enum InfoOptions As UInteger ShowInInform Reserved ShowInSupported TypeOfValue Max End Enum Public Class MediaInfo Private Declare Unicode Function MediaInfo_New Lib "MediaInfo.DLL" () As IntPtr Private Declare Unicode Sub MediaInfo_Delete Lib "MediaInfo.DLL" (ByVal Handle As IntPtr) Private Declare Unicode Function MediaInfo_Open Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal FileName As String) As UIntPtr Private Declare Unicode Sub MediaInfo_Close Lib "MediaInfo.DLL" (ByVal Handle As IntPtr) Private Declare Unicode Function MediaInfo_Inform Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal Reserved As UIntPtr) As IntPtr Private Declare Unicode Function MediaInfo_GetI Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal StreamKind As UIntPtr, ByVal StreamNumber As UIntPtr, ByVal Parameter As UIntPtr, ByVal KindOfInfo As UIntPtr) As IntPtr 'See MediaInfoDLL.h for enumeration values Private Declare Unicode Function MediaInfo_Get Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal StreamKind As UIntPtr, ByVal StreamNumber As UIntPtr, ByVal Parameter As String, ByVal KindOfInfo As UIntPtr, ByVal KindOfSearch As UIntPtr) As IntPtr Private Declare Unicode Function MediaInfo_Option Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal Option_ As String, ByVal Value As String) As IntPtr Private Declare Unicode Function MediaInfo_State_Get Lib "MediaInfo.DLL" (ByVal Handle As IntPtr) As UIntPtr 'see MediaInfo.h for details Private Declare Unicode Function MediaInfo_Count_Get Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal StreamKind As UIntPtr, ByVal StreamNumber As IntPtr) As UIntPtr 'see MediaInfoDLL.h for enumeration values Dim Handle As IntPtr Sub New() Handle = MediaInfo_New() End Sub Protected Overrides Sub Finalize() MediaInfo_Delete(Handle) End Sub Function Open(ByVal FileName As String) As System.UIntPtr Return MediaInfo_Open(Handle, FileName) End Function Sub Close() MediaInfo_Close(Handle) End Sub Function Inform() As String Return Marshal.PtrToStringUni(MediaInfo_Inform(Handle, CType(0, UIntPtr))) End Function Function Get_(ByVal StreamKind As StreamKind, ByVal StreamNumber As Integer, ByVal Parameter As Integer, Optional ByVal KindOfInfo As InfoKind = InfoKind.Text) As String Return Marshal.PtrToStringUni(MediaInfo_GetI(Handle, CType(StreamKind, UIntPtr), CType(StreamNumber, UIntPtr), CType(Parameter, UIntPtr), CType(KindOfInfo, UIntPtr))) End Function Function Get_(ByVal StreamKind As StreamKind, ByVal StreamNumber As Integer, ByVal Parameter As String, Optional ByVal KindOfInfo As InfoKind = InfoKind.Text, Optional ByVal KindOfSearch As InfoKind = InfoKind.Name) As String Return Marshal.PtrToStringUni(MediaInfo_Get(Handle, CType(StreamKind, UIntPtr), CType(StreamNumber, UIntPtr), Parameter, CType(KindOfInfo, UIntPtr), CType(KindOfSearch, UIntPtr))) End Function Function Option_(ByVal Option__ As String, Optional ByVal Value As String = "") As String Return Marshal.PtrToStringUni(MediaInfo_Option(Handle, Option__, Value)) End Function Function State_Get() As Integer Return CInt(MediaInfo_State_Get(Handle)) End Function Function Count_Get(ByVal StreamKind As StreamKind, Optional ByVal StreamNumber As UInteger = UInteger.MaxValue) As Integer If StreamNumber = UInteger.MaxValue Then Return CInt(MediaInfo_Count_Get(Handle, CType(StreamKind, UIntPtr), CType(-1, IntPtr))) Else Return CInt(MediaInfo_Count_Get(Handle, CType(StreamKind, UIntPtr), CType(StreamNumber, IntPtr))) End If End Function End Class MediaInfoLib/Project/MSVB/Example/My Project/ 40777 0 0 0 12264020632 14100 5MediaInfoLib/Project/MSVB/Example/My Project/Application.Designer.vb100777 0 0 2750 12226004262 20536 0'------------------------------------------------------------------------------ ' ' This code was generated by a tool. ' Runtime Version:4.0.30319.1 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' '------------------------------------------------------------------------------ Option Strict On Option Explicit On Namespace My 'NOTE: This file is auto-generated; do not modify it directly. To make changes, ' or if you encounter build errors in this file, go to the Project Designer ' (go to Project Properties or double-click the My Project node in ' Solution Explorer), and make changes on the Application tab. ' Partial Friend Class MyApplication _ Public Sub New() MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) Me.IsSingleInstance = false Me.EnableVisualStyles = true Me.SaveMySettingsOnExit = true Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses End Sub _ Protected Overrides Sub OnCreateMainForm() Me.MainForm = Global.HowToUse_Dll.Form1 End Sub End Class End Namespace MediaInfoLib/Project/MSVB/Example/My Project/Application.myapp100777 0 0 776 12226004262 17504 0 true Form1 false 0 true 0 0 true MediaInfoLib/Project/MSVB/Example/My Project/AssemblyInfo.vb100777 0 0 2251 12226004262 17123 0Imports System Imports System.Reflection Imports System.Runtime.InteropServices ' General Information about an assembly is controlled through the following ' set of attributes. Change these attribute values to modify the information ' associated with an assembly. ' Review the values of the assembly attributes 'The following GUID is for the ID of the typelib if this project is exposed to COM ' Version information for an assembly consists of the following four values: ' ' Major Version ' Minor Version ' Build Number ' Revision ' ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: ' MediaInfoLib/Project/MSVB/Example/My Project/Resources.Designer.vb100777 0 0 5360 12226004262 20245 0'------------------------------------------------------------------------------ ' ' This code was generated by a tool. ' Runtime Version:2.0.50727.1433 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' '------------------------------------------------------------------------------ Option Strict On Option Explicit On Namespace My.Resources 'This class was auto-generated by the StronglyTypedResourceBuilder 'class via a tool like ResGen or Visual Studio. 'To add or remove a member, edit your .ResX file then rerun ResGen 'with the /str option, or rebuild your VS project. ' ' A strongly-typed resource class, for looking up localized strings, etc. ' _ Friend Module Resources Private resourceMan As Global.System.Resources.ResourceManager Private resourceCulture As Global.System.Globalization.CultureInfo ' ' Returns the cached ResourceManager instance used by this class. ' _ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager Get If Object.ReferenceEquals(resourceMan, Nothing) Then Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("HowToUse_Dll.Resources", GetType(Resources).Assembly) resourceMan = temp End If Return resourceMan End Get End Property ' ' Overrides the current thread's CurrentUICulture property for all ' resource lookups using this strongly typed resource class. ' _ Friend Property Culture() As Global.System.Globalization.CultureInfo Get Return resourceCulture End Get Set(ByVal value As Global.System.Globalization.CultureInfo) resourceCulture = value End Set End Property End Module End Namespace MediaInfoLib/Project/MSVB/Example/My Project/Resources.resx100777 0 0 12754 12226004262 17105 0 text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 MediaInfoLib/Project/MSVB/Example/My Project/Settings.Designer.vb100777 0 0 5744 12226004262 20101 0'------------------------------------------------------------------------------ ' ' This code was generated by a tool. ' Runtime Version:2.0.50727.1433 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' '------------------------------------------------------------------------------ Option Strict On Option Explicit On Namespace My _ Partial Friend NotInheritable Class MySettings Inherits Global.System.Configuration.ApplicationSettingsBase Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) #Region "My.Settings Auto-Save Functionality" #If _MyType = "WindowsForms" Then Private Shared addedHandler As Boolean Private Shared addedHandlerLockObject As New Object _ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) If My.Application.SaveMySettingsOnExit Then My.Settings.Save() End If End Sub #End If #End Region Public Shared ReadOnly Property [Default]() As MySettings Get #If _MyType = "WindowsForms" Then If Not addedHandler Then SyncLock addedHandlerLockObject If Not addedHandler Then AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings addedHandler = True End If End SyncLock End If #End If Return defaultInstance End Get End Property End Class End Namespace Namespace My _ Friend Module MySettingsProperty _ Friend ReadOnly Property Settings() As Global.HowToUse_Dll.My.MySettings Get Return Global.HowToUse_Dll.My.MySettings.Default End Get End Property End Module End Namespace MediaInfoLib/Project/MSVB/Example/My Project/Settings.settings100777 0 0 427 12226004262 17544 0 MediaInfoLib/Project/MSVB/MediaInfoLib_MSVB.sln100777 0 0 1624 12226004263 14463 0Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "HowToUse_Dll", "Example\HowToUse_Dll.vbproj", "{FE4B9E8D-D358-44F3-8E6C-37BD585A8321}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {FE4B9E8D-D358-44F3-8E6C-37BD585A8321}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FE4B9E8D-D358-44F3-8E6C-37BD585A8321}.Debug|Any CPU.Build.0 = Debug|Any CPU {FE4B9E8D-D358-44F3-8E6C-37BD585A8321}.Release|Any CPU.ActiveCfg = Release|Any CPU {FE4B9E8D-D358-44F3-8E6C-37BD585A8321}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal MediaInfoLib/Project/MSVC2005/ 40777 0 0 0 12243221700 11035 5MediaInfoLib/Project/MSVC2005/DLL/ 40777 0 0 0 12264020632 11454 5MediaInfoLib/Project/MSVC2005/DLL/MediaInfo.rc100777 0 0 1661 12264020304 13735 0#include VS_VERSION_INFO VERSIONINFO FILEVERSION 0,7,67,0 PRODUCTVERSION 0,7,67,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x40004L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "MediaArea.net" VALUE "FileDescription", "Convenient unified display of the most relevant technical and tag data for video and audio files" VALUE "FileVersion", "0.7.67.0" VALUE "InternalName", "MediaInfoLib - DLL - MSVC 2005" VALUE "LegalCopyright", "MediaArea.net" VALUE "OriginalFilename", "MediaInfo.dll" VALUE "ProductName", "MediaInfo" VALUE "ProductVersion", "0.7.67.0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END MediaInfoLib/Project/MSVC2005/DLL/MediaInfoDll.vcproj100777 0 0 6406 12226004263 15276 0 MediaInfoLib/Project/MSVC2005/Library/ 40777 0 0 0 12264020632 12445 5MediaInfoLib/Project/MSVC2005/Library/MediaInfoLib.vcproj100777 0 0 122715 12262572026 16333 0 MediaInfoLib/Project/MSVC2005/MediaInfoLib_MSVC.sln100777 0 0 5341 12226004263 14774 0Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MediaInfoLib", "Library\MediaInfoLib.vcproj", "{20E0F8D6-213C-460B-B361-9C725CB375C7}" ProjectSection(ProjectDependencies) = postProject {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94} = {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94} {FD328AE2-5136-460F-A622-12CFD4D4C131} = {FD328AE2-5136-460F-A622-12CFD4D4C131} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MediaInfoDll", "DLL\MediaInfoDll.vcproj", "{157952BD-7FA9-4859-8F9C-81B847FE0D4A}" ProjectSection(ProjectDependencies) = postProject {20E0F8D6-213C-460B-B361-9C725CB375C7} = {20E0F8D6-213C-460B-B361-9C725CB375C7} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZenLib", "..\..\..\ZenLib\Project\MSVC2005\Library\ZenLib.vcproj", "{0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\..\..\zlib\projects\MSVC2005\zlib.vcproj", "{FD328AE2-5136-460F-A622-12CFD4D4C131}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ThirdParty", "ThirdParty", "{75381E73-F258-43C5-8D1D-13C800B379A5}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|Win32.ActiveCfg = Release|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|Win32.Build.0 = Release|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|x64.ActiveCfg = Release|Win32 {157952BD-7FA9-4859-8F9C-81B847FE0D4A}.Release|Win32.ActiveCfg = Release|Win32 {157952BD-7FA9-4859-8F9C-81B847FE0D4A}.Release|Win32.Build.0 = Release|Win32 {157952BD-7FA9-4859-8F9C-81B847FE0D4A}.Release|x64.ActiveCfg = Release|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|Win32.ActiveCfg = Release|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|Win32.Build.0 = Release|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|x64.ActiveCfg = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|Win32.ActiveCfg = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|Win32.Build.0 = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {FD328AE2-5136-460F-A622-12CFD4D4C131} = {75381E73-F258-43C5-8D1D-13C800B379A5} {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94} = {75381E73-F258-43C5-8D1D-13C800B379A5} EndGlobalSection EndGlobal MediaInfoLib/Project/MSVC2008/ 40777 0 0 0 12263066111 11045 5MediaInfoLib/Project/MSVC2008/Dll/ 40777 0 0 0 12264020632 11557 5MediaInfoLib/Project/MSVC2008/Dll/MediaInfo.rc100777 0 0 1661 12264020304 14040 0#include VS_VERSION_INFO VERSIONINFO FILEVERSION 0,7,67,0 PRODUCTVERSION 0,7,67,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x40004L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "MediaArea.net" VALUE "FileDescription", "Convenient unified display of the most relevant technical and tag data for video and audio files" VALUE "FileVersion", "0.7.67.0" VALUE "InternalName", "MediaInfoLib - DLL - MSVC 2008" VALUE "LegalCopyright", "MediaArea.net" VALUE "OriginalFilename", "MediaInfo.dll" VALUE "ProductName", "MediaInfo" VALUE "ProductVersion", "0.7.67.0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END MediaInfoLib/Project/MSVC2008/Dll/MediaInfoDll.vcproj100777 0 0 42114 12226004263 15415 0 MediaInfoLib/Project/MSVC2008/Example/ 40777 0 0 0 12264020632 12437 5MediaInfoLib/Project/MSVC2008/Example/HowToUse.rc100777 0 0 5122 12226004263 14602 0//Microsoft Developer Studio generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // French (France) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) #ifdef _WIN32 LANGUAGE LANG_FRENCH, SUBLANG_FRENCH #pragma code_page(1252) #endif //_WIN32 #ifndef _MAC ///////////////////////////////////////////////////////////////////////////// // // Version // VS_VERSION_INFO VERSIONINFO FILEVERSION 0,4,0,0 PRODUCTVERSION 0,4,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x40004L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040c04b0" BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "http://MediaArea.net/MediaInfo\0" VALUE "FileDescription", "Read info about media files (command line)\0" VALUE "FileVersion", "0.4.0.0\0" VALUE "InternalName", "MediaInfo - Cmd - Win32 - Microsoft\0" VALUE "LegalCopyright", "BSD-2-Clause\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "MediaInfo.exe\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "MediaInfo (Cmd)\0" VALUE "ProductVersion", "0.4.0.0\0" VALUE "SpecialBuild", "\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x40c, 1200 END END #endif // !_MAC #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE DISCARDABLE BEGIN "resource.h\0" END 2 TEXTINCLUDE DISCARDABLE BEGIN "#include ""afxres.h""\r\n" "\0" END 3 TEXTINCLUDE DISCARDABLE BEGIN "\r\n" "\0" END #endif // APSTUDIO_INVOKED #endif // French (France) resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED MediaInfoLib/Project/MSVC2008/Example/HowToUse.vcproj100777 0 0 33242 12226004263 15525 0 MediaInfoLib/Project/MSVC2008/Example/HowToUse_Dll.vcproj100777 0 0 32300 12226004263 16312 0 MediaInfoLib/Project/MSVC2008/Example/resource.h100777 0 0 634 12226004263 14522 0//{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. // Used by MediaInfo.rc // // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 101 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1000 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif MediaInfoLib/Project/MSVC2008/Library/ 40777 0 0 0 12264020632 12450 5MediaInfoLib/Project/MSVC2008/Library/MediaInfoLib.vcproj100777 0 0 161731 12262557403 16341 0 MediaInfoLib/Project/MSVC2008/MediaInfoLib.sln100777 0 0 23337 12226004263 14174 0 Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MediaInfoDll", "Dll\MediaInfoDll.vcproj", "{BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}" ProjectSection(ProjectDependencies) = postProject {20E0F8D6-213C-460B-B361-9C725CB375C7} = {20E0F8D6-213C-460B-B361-9C725CB375C7} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MediaInfoLib", "Library\MediaInfoLib.vcproj", "{20E0F8D6-213C-460B-B361-9C725CB375C7}" ProjectSection(ProjectDependencies) = postProject {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94} = {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94} {FD328AE2-5136-460F-A622-12CFD4D4C131} = {FD328AE2-5136-460F-A622-12CFD4D4C131} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MediaInfoShellExt", "ShellExtension\MediaInfoShellExt.vcproj", "{E987FD96-6BE1-45AF-9293-46B8A6695E6A}" ProjectSection(ProjectDependencies) = postProject {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5} = {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HowToUse_Dll", "Example\HowToUse_Dll.vcproj", "{51E7EE1D-D4DD-4374-976C-66519B3B94DF}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZenLib", "..\..\..\ZenLib\Project\MSVC2008\Library\ZenLib.vcproj", "{0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\..\..\zlib\projects\MSVC2008\zlib.vcproj", "{FD328AE2-5136-460F-A622-12CFD4D4C131}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ThirdParty", "ThirdParty", "{F696A30D-66C6-46A8-B1BC-04B13BF14290}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 DebugA|Win32 = DebugA|Win32 DebugA|x64 = DebugA|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 ReleaseA|Win32 = ReleaseA|Win32 ReleaseA|x64 = ReleaseA|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Debug|Win32.ActiveCfg = Debug|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Debug|Win32.Build.0 = Debug|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Debug|x64.ActiveCfg = Debug|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Debug|x64.Build.0 = Debug|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.DebugA|Win32.ActiveCfg = DebugA|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.DebugA|Win32.Build.0 = DebugA|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.DebugA|x64.ActiveCfg = DebugA|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.DebugA|x64.Build.0 = DebugA|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Release|Win32.ActiveCfg = Release|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Release|Win32.Build.0 = Release|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Release|x64.ActiveCfg = Release|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Release|x64.Build.0 = Release|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.ReleaseA|Win32.ActiveCfg = ReleaseA|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.ReleaseA|Win32.Build.0 = ReleaseA|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.ReleaseA|x64.ActiveCfg = ReleaseA|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.ReleaseA|x64.Build.0 = ReleaseA|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Debug|Win32.ActiveCfg = Debug|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Debug|Win32.Build.0 = Debug|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Debug|x64.ActiveCfg = Debug|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Debug|x64.Build.0 = Debug|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.DebugA|Win32.ActiveCfg = DebugA|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.DebugA|Win32.Build.0 = DebugA|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.DebugA|x64.ActiveCfg = DebugA|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.DebugA|x64.Build.0 = DebugA|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|Win32.ActiveCfg = Release|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|Win32.Build.0 = Release|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|x64.ActiveCfg = Release|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|x64.Build.0 = Release|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.ReleaseA|Win32.ActiveCfg = ReleaseA|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.ReleaseA|Win32.Build.0 = ReleaseA|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.ReleaseA|x64.ActiveCfg = ReleaseA|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.ReleaseA|x64.Build.0 = ReleaseA|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Debug|Win32.ActiveCfg = Debug|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Debug|Win32.Build.0 = Debug|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Debug|x64.ActiveCfg = Debug|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Debug|x64.Build.0 = Debug|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.DebugA|Win32.ActiveCfg = Debug|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.DebugA|Win32.Build.0 = Debug|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.DebugA|x64.ActiveCfg = Debug|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.DebugA|x64.Build.0 = Debug|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Release|Win32.ActiveCfg = Release|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Release|Win32.Build.0 = Release|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Release|x64.ActiveCfg = Release|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Release|x64.Build.0 = Release|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.ReleaseA|Win32.ActiveCfg = Release|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.ReleaseA|Win32.Build.0 = Release|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.ReleaseA|x64.ActiveCfg = Release|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.ReleaseA|x64.Build.0 = Release|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Debug|Win32.ActiveCfg = Debug|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Debug|Win32.Build.0 = Debug|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Debug|x64.ActiveCfg = Debug|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Debug|x64.Build.0 = Debug|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.DebugA|Win32.ActiveCfg = DebugA|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.DebugA|Win32.Build.0 = DebugA|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.DebugA|x64.ActiveCfg = DebugA|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.DebugA|x64.Build.0 = DebugA|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Release|Win32.ActiveCfg = Release|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Release|Win32.Build.0 = Release|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Release|x64.ActiveCfg = Release|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Release|x64.Build.0 = Release|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.ReleaseA|Win32.ActiveCfg = ReleaseA|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.ReleaseA|Win32.Build.0 = ReleaseA|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.ReleaseA|x64.ActiveCfg = ReleaseA|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.ReleaseA|x64.Build.0 = ReleaseA|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Debug|Win32.ActiveCfg = Debug|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Debug|Win32.Build.0 = Debug|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Debug|x64.ActiveCfg = Debug|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Debug|x64.Build.0 = Debug|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.DebugA|Win32.ActiveCfg = DebugA|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.DebugA|Win32.Build.0 = DebugA|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.DebugA|x64.ActiveCfg = DebugA|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.DebugA|x64.Build.0 = DebugA|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|Win32.ActiveCfg = Release|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|Win32.Build.0 = Release|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|x64.ActiveCfg = Release|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|x64.Build.0 = Release|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.ReleaseA|Win32.ActiveCfg = ReleaseA|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.ReleaseA|Win32.Build.0 = ReleaseA|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.ReleaseA|x64.ActiveCfg = ReleaseA|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.ReleaseA|x64.Build.0 = ReleaseA|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Debug|Win32.ActiveCfg = Debug|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Debug|Win32.Build.0 = Debug|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Debug|x64.ActiveCfg = Debug|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Debug|x64.Build.0 = Debug|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.DebugA|Win32.ActiveCfg = Debug|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.DebugA|Win32.Build.0 = Debug|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.DebugA|x64.ActiveCfg = Debug|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.DebugA|x64.Build.0 = Debug|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|Win32.ActiveCfg = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|Win32.Build.0 = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|x64.ActiveCfg = Release|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|x64.Build.0 = Release|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.ReleaseA|Win32.ActiveCfg = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.ReleaseA|Win32.Build.0 = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.ReleaseA|x64.ActiveCfg = Release|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.ReleaseA|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {FD328AE2-5136-460F-A622-12CFD4D4C131} = {F696A30D-66C6-46A8-B1BC-04B13BF14290} {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94} = {F696A30D-66C6-46A8-B1BC-04B13BF14290} EndGlobalSection EndGlobal MediaInfoLib/Project/MSVC2008/ShellExtension/ 40777 0 0 0 12264020632 14010 5MediaInfoLib/Project/MSVC2008/ShellExtension/MediaInfoShellExt.cpp100777 0 0 2731 12226004263 20123 0// MediaInfoShellExt.cpp : Implementation of DLL Exports. #include "stdafx.h" #include "resource.h" #include "MediaInfoShellExt.h" class CMediaInfoShellExtModule : public CAtlDllModuleT< CMediaInfoShellExtModule > { public : DECLARE_LIBID(LIBID_MediaInfoShellExtLib) DECLARE_REGISTRY_APPID_RESOURCEID(IDR_MEDIAINFOSHELLEXT, "{23D95783-1AF5-4C0F-84C1-EC49047EA2DC}") }; CMediaInfoShellExtModule _AtlModule; #ifdef _MANAGED #pragma managed(push, off) #endif // DLL Entry Point extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { hInstance; return _AtlModule.DllMain(dwReason, lpReserved); } #ifdef _MANAGED #pragma managed(pop) #endif // Used to determine whether the DLL can be unloaded by OLE STDAPI DllCanUnloadNow(void) { return _AtlModule.DllCanUnloadNow(); } // Returns a class factory to create an object of the requested type STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { return _AtlModule.DllGetClassObject(rclsid, riid, ppv); } // DllRegisterServer - Adds entries to the system registry STDAPI DllRegisterServer(void) { // registers object, typelib and all interfaces in typelib HRESULT hr = _AtlModule.DllRegisterServer(); return hr; } // DllUnregisterServer - Removes entries from the system registry STDAPI DllUnregisterServer(void) { HRESULT hr = _AtlModule.DllUnregisterServer(); return hr; } MediaInfoLib/Project/MSVC2008/ShellExtension/MediaInfoShellExt.def100777 0 0 362 12226004263 20055 0; MediaInfoShellExt.def : Declares the module parameters. LIBRARY "MediaInfo_InfoTip.dll" EXPORTS DllCanUnloadNow PRIVATE DllGetClassObject PRIVATE DllRegisterServer PRIVATE DllUnregisterServer PRIVATE MediaInfoLib/Project/MSVC2008/ShellExtension/MediaInfoShellExt.idl100777 0 0 1421 12226004263 20104 0// MediaInfoShellExt.idl : IDL source for MediaInfoShellExt // // This file will be processed by the MIDL tool to // produce the type library (MediaInfoShellExt.tlb) and marshalling code. import "oaidl.idl"; import "ocidl.idl"; [ object, uuid(6482FE39-D67B-49E5-BAA1-EBDDB318055D), helpstring("IMediaInfoShellExt_ Interface"), pointer_default(unique) ] interface IMediaInfoShellExt_ : IUnknown{ }; [ uuid(BC1AAA9F-D8C5-4EB2-A10A-61B86B7EA77C), version(1.0), helpstring("MediaInfoShellExt 1.0 Type Library") ] library MediaInfoShellExtLib { importlib("stdole2.tlb"); [ uuid(869C14C8-1830-491F-B575-5F9AB40D2B42), helpstring("MediaInfoShellExt_ Class") ] coclass MediaInfoShellExt_ { [default] interface IMediaInfoShellExt_; }; }; MediaInfoLib/Project/MSVC2008/ShellExtension/MediaInfoShellExt.rc100777 0 0 1576 12264020304 17747 0#include VS_VERSION_INFO VERSIONINFO FILEVERSION 0,7,67,0 PRODUCTVERSION 0,7,67,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x4L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904e4" BEGIN VALUE "CompanyName", "MediaArea.net" VALUE "FileDescription", "All about your audio and video files" VALUE "FileVersion", "0.7.67.0" VALUE "InternalName", "MediaInfo_InfoTip - DLL - MSVC 2008" VALUE "LegalCopyright", "MediaArea.net" VALUE "OriginalFilename", "MediaInfo_InfoTip.dll" VALUE "ProductName", "MediaInfo" VALUE "ProductVersion", "0.7.67.0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1252 END END MediaInfoLib/Project/MSVC2008/ShellExtension/MediaInfoShellExt.vcproj100777 0 0 27741 12226004263 20674 0 MediaInfoLib/Project/MSVC2008/ShellExtension/MediaInfoShellExt_.cpp100777 0 0 3731 12226004263 20263 0// MediaInfoShellExt_.cpp : Implementation of CMediaInfoShellExt_ #include "stdafx.h" #include "MediaInfoShellExt_.h" #include // CMediaInfoShellExt_ HRESULT CMediaInfoShellExt_::Load (LPCOLESTR wszFilename, DWORD) { //Save FileName FileName = wszFilename; //OK return S_OK; } HRESULT CMediaInfoShellExt_::GetInfoTip (DWORD, LPWSTR* ppwszTip) { LPMALLOC Malloc; std::wstring ToolTip; //Get an IMalloc interface from the shell. if (FAILED(SHGetMalloc(&Malloc))) return E_FAIL; //Creating tooltip ToolTip=_T("MediaInfo:\n"); MediaInfoDLL::MediaInfo I; I.Option(_T("Inform"), _T("Summary")); I.Open(FileName); for (size_t StreamKind=0; StreamKind<(size_t)MediaInfoDLL::Stream_Max; StreamKind++) for (size_t StreamPos=0; StreamPos0) { ToolTip+=I.Get((MediaInfoDLL::stream_t)StreamKind, StreamPos, _T("StreamKind")); ToolTip+=_T(": "); } ToolTip+=I.Get((MediaInfoDLL::stream_t)StreamKind, StreamPos, _T("Inform")); ToolTip+=_T("\r\n"); } if (ToolTip.size()>2) ToolTip.resize(ToolTip.size()-2); //Removing the ending \r\n //Allocate a buffer for Explorer. Note that the must pass the string //back as a Unicode string, so the string length is multiplied by the //size of a Unicode character. *ppwszTip=(LPWSTR)Malloc->Alloc((ToolTip.size()+1)*sizeof(wchar_t)); //Release the IMalloc interface now that we're done using it. Malloc->Release(); //Enough memory? if (*ppwszTip==NULL) return E_OUTOFMEMORY; //Use the Unicode string copy function to put the tooltip text in the buffer. wcscpy_s(*ppwszTip, ToolTip.size()+1, T2COLE(ToolTip.c_str())); //OK return S_OK; }MediaInfoLib/Project/MSVC2008/ShellExtension/MediaInfoShellExt_.h100777 0 0 4237 12226004263 17732 0// MediaInfoShellExt_.h : Declaration of the CMediaInfoShellExt_ #pragma once #include "resource.h" // main symbols #include "MediaInfoShellExt.h" #include struct __declspec(uuid("00021500-0000-0000-c000-000000000046")) IQueryInfo; #include #include #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA) #error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms." #endif // CMediaInfoShellExt_ class ATL_NO_VTABLE CMediaInfoShellExt_ : public CComObjectRootEx, public CComCoClass, public IPersistFile, public IQueryInfo { public: CMediaInfoShellExt_() { } DECLARE_REGISTRY_RESOURCEID(IDR_MEDIAINFOSHELLEXT_) DECLARE_NOT_AGGREGATABLE(CMediaInfoShellExt_) BEGIN_COM_MAP(CMediaInfoShellExt_) COM_INTERFACE_ENTRY(IPersistFile) COM_INTERFACE_ENTRY(IQueryInfo) END_COM_MAP() DECLARE_PROTECT_FINAL_CONSTRUCT() HRESULT FinalConstruct() { return S_OK; } void FinalRelease() { } protected: std::wstring FileName; public: // IPersistFile STDMETHOD(GetClassID)(LPCLSID) { return E_NOTIMPL; } STDMETHOD(IsDirty)() { return E_NOTIMPL; } STDMETHOD(Load)(LPCOLESTR, DWORD); STDMETHOD(Save)(LPCOLESTR, BOOL) { return E_NOTIMPL; } STDMETHOD(SaveCompleted)(LPCOLESTR) { return E_NOTIMPL; } STDMETHOD(GetCurFile)(LPOLESTR*) { return E_NOTIMPL; } // IQueryInfo STDMETHOD(GetInfoFlags)(DWORD*) { return E_NOTIMPL; } STDMETHOD(GetInfoTip)(DWORD, LPWSTR*); }; OBJECT_ENTRY_AUTO(__uuidof(MediaInfoShellExt_), CMediaInfoShellExt_) MediaInfoLib/Project/MSVC2008/ShellExtension/resource.h100777 0 0 1044 12226004263 16107 0//{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by MediaInfoShellExt.rc // #define IDS_PROJNAME 100 #define IDR_MEDIAINFOSHELLEXT 101 #define IDR_MEDIAINFOSHELLEXT_ 102 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 201 #define _APS_NEXT_COMMAND_VALUE 32768 #define _APS_NEXT_CONTROL_VALUE 201 #define _APS_NEXT_SYMED_VALUE 103 #endif #endif MediaInfoLib/Project/MSVC2008/ShellExtension/stdafx.cpp100777 0 0 325 12226004263 16065 0// stdafx.cpp : source file that includes just the standard includes // MediaInfoShellExt.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" MediaInfoLib/Project/MSVC2008/ShellExtension/stdafx.h100777 0 0 2666 12226004263 15564 0// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, // but are changed infrequently #pragma once #ifndef STRICT #define STRICT #endif // Modify the following defines if you have to target a platform prior to the ones specified below. // Refer to MSDN for the latest info on corresponding values for different platforms. #ifndef WINVER // Allow use of features specific to Windows XP or later. #define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. #endif #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. #endif #ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. #endif #ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. #define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. #endif #define _ATL_APARTMENT_THREADED #define _ATL_NO_AUTOMATIC_NAMESPACE #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit #include "resource.h" #include #include using namespace ATL;MediaInfoLib/Project/MSVC2010/ 40777 0 0 0 12264020632 11035 5MediaInfoLib/Project/MSVC2010/Dll/ 40777 0 0 0 12264020632 11550 5MediaInfoLib/Project/MSVC2010/Dll/MediaInfo.rc100777 0 0 1661 12264020304 14031 0#include VS_VERSION_INFO VERSIONINFO FILEVERSION 0,7,67,0 PRODUCTVERSION 0,7,67,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x40004L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "MediaArea.net" VALUE "FileDescription", "Convenient unified display of the most relevant technical and tag data for video and audio files" VALUE "FileVersion", "0.7.67.0" VALUE "InternalName", "MediaInfoLib - DLL - MSVC 2010" VALUE "LegalCopyright", "MediaArea.net" VALUE "OriginalFilename", "MediaInfo.dll" VALUE "ProductName", "MediaInfo" VALUE "ProductVersion", "0.7.67.0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END MediaInfoLib/Project/MSVC2010/Dll/MediaInfoDll.vcxproj100777 0 0 44430 12226004263 15601 0 DebugA Win32 DebugA x64 Debug Win32 Debug x64 ReleaseA Win32 ReleaseA x64 Release Win32 Release x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5} MediaInfoDll Win32Proj DynamicLibrary MultiByte true DynamicLibrary MultiByte false DynamicLibrary Unicode true DynamicLibrary Unicode false DynamicLibrary MultiByte true DynamicLibrary MultiByte false DynamicLibrary true Unicode DynamicLibrary Unicode false <_ProjectFileVersion>10.0.30128.1 $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo Disabled ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 EditAndContinue true 4100;%(DisableSpecificWarnings) true Windows MachineX86 ../../../Source/MediaInfoDLL/MediaInfoDLL.def Disabled ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 ProgramDatabase 4100;%(DisableSpecificWarnings) true true Windows MachineX64 ../../../Source/MediaInfoDLL/MediaInfoDLL.def MaxSpeed ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) MultiThreaded Level4 4100;%(DisableSpecificWarnings) true true true Windows MachineX86 true true true ../../../Source/MediaInfoDLL/MediaInfoDLL.def MaxSpeed ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) MultiThreaded Level4 4100;%(DisableSpecificWarnings) true true Windows MachineX64 true true true ../../../Source/MediaInfoDLL/MediaInfoDLL.def Disabled ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 EditAndContinue 4100;%(DisableSpecificWarnings) true true Windows MachineX86 ../../../Source/MediaInfoDLL/MediaInfoDLL.def Level4 4100;%(DisableSpecificWarnings) true ../../../Source/MediaInfoDLL/MediaInfoDLL.def MaxSpeed ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) MultiThreaded Level4 4100;%(DisableSpecificWarnings) true true true Windows MachineX86 true true true ../../../Source/MediaInfoDLL/MediaInfoDLL.def Level4 4100;%(DisableSpecificWarnings) true true true true true ../../../Source/MediaInfoDLL/MediaInfoDLL.def {0da1da7d-f393-4e7c-a7ce-cb5c6a67bc94} {fd328ae2-5136-460f-a622-12cfd4d4c131} {20e0f8d6-213c-460b-b361-9c725cb375c7} MediaInfoLib/Project/MSVC2010/Dll/MediaInfoDll.vcxproj.filters100777 0 0 2526 12226004263 17230 0 {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav {02b7388c-a098-44f9-af25-c04697af4468} Source Files Resource Files Source Files Header Files MediaInfoLib/Project/MSVC2010/Example/ 40777 0 0 0 12226443766 12447 5MediaInfoLib/Project/MSVC2010/Example/HowToUse.rc100777 0 0 5122 12226004263 14573 0//Microsoft Developer Studio generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // French (France) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) #ifdef _WIN32 LANGUAGE LANG_FRENCH, SUBLANG_FRENCH #pragma code_page(1252) #endif //_WIN32 #ifndef _MAC ///////////////////////////////////////////////////////////////////////////// // // Version // VS_VERSION_INFO VERSIONINFO FILEVERSION 0,4,0,0 PRODUCTVERSION 0,4,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x40004L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040c04b0" BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "http://MediaArea.net/MediaInfo\0" VALUE "FileDescription", "Read info about media files (command line)\0" VALUE "FileVersion", "0.4.0.0\0" VALUE "InternalName", "MediaInfo - Cmd - Win32 - Microsoft\0" VALUE "LegalCopyright", "BSD-2-Clause\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "MediaInfo.exe\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "MediaInfo (Cmd)\0" VALUE "ProductVersion", "0.4.0.0\0" VALUE "SpecialBuild", "\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x40c, 1200 END END #endif // !_MAC #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE DISCARDABLE BEGIN "resource.h\0" END 2 TEXTINCLUDE DISCARDABLE BEGIN "#include ""afxres.h""\r\n" "\0" END 3 TEXTINCLUDE DISCARDABLE BEGIN "\r\n" "\0" END #endif // APSTUDIO_INVOKED #endif // French (France) resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED MediaInfoLib/Project/MSVC2010/Example/HowToUse_Dll.vcxproj100777 0 0 42103 12226004263 16475 0 DebugA Win32 DebugA x64 Debug Win32 Debug x64 ReleaseA Win32 ReleaseA x64 Release Win32 Release x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF} HowToUse_Dll Win32Proj Application MultiByte true Application MultiByte Application Unicode true Application Unicode Application MultiByte Application MultiByte Application Unicode true Application Unicode <_ProjectFileVersion>10.0.30128.1 $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ Disabled ../../../Source;../../../../ZenLib/Source;../../../../ZLib;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level4 EditAndContinue MediaInfo.lib;ZenLib.lib;zlib.lib;%(AdditionalDependencies) ..\..\..\..\MediaInfoLib\Project\MSVC2010\Library\$(Platform)\$(Configuration);..\..\..\..\ZenLib\Project\MSVC2010\Library\$(Platform)\$(Configuration);..\..\..\..\zlib\projects\MSVC2010\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) true Console false MachineX86 X64 Disabled ..\..\..\Source;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level4 ProgramDatabase %(AdditionalLibraryDirectories) true Console false MachineX64 ../../../Source;../../../../ZenLib/Source;../../../../ZLib;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level4 MediaInfo.lib;ZenLib.lib;zlib.lib;%(AdditionalDependencies) ..\..\..\..\MediaInfoLib\Project\MSVC2010\Library\$(Platform)\$(Configuration);..\..\..\..\ZenLib\Project\MSVC2010\Library\$(Platform)\$(Configuration);..\..\..\..\zlib\projects\MSVC2010\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) true Console true true false MachineX86 X64 ..\..\..\Source;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level4 %(AdditionalLibraryDirectories) true Console true true false MachineX64 Disabled ..\..\..\Source;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level4 EditAndContinue %(AdditionalLibraryDirectories) true Console false MachineX86 ..\..\..\Source;%(AdditionalIncludeDirectories) Level4 ..\..\..\Source;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level4 %(AdditionalLibraryDirectories) true Console true true false MachineX86 ..\..\..\Source;%(AdditionalIncludeDirectories) Level4 {be6d3ef8-2f82-4f1e-956a-890c3614a2d5} MediaInfoLib/Project/MSVC2010/Example/HowToUse_Dll.vcxproj.filters100777 0 0 2400 12226004263 20120 0 {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hpp;hxx;hm;inl;inc;xsd {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav Source Files Header Files Resource Files MediaInfoLib/Project/MSVC2010/Library/ 40777 0 0 0 12264020632 12441 5MediaInfoLib/Project/MSVC2010/Library/MediaInfoLib.vcxproj100777 0 0 142134 12263060433 16507 0 DebugA Win32 DebugA x64 Debug Win32 Debug x64 ReleaseA Win32 ReleaseA x64 Release Win32 Release x64 {20E0F8D6-213C-460B-B361-9C725CB375C7} MediaInfoLib Win32Proj StaticLibrary MultiByte true StaticLibrary MultiByte StaticLibrary Unicode true StaticLibrary Unicode StaticLibrary MultiByte StaticLibrary MultiByte StaticLibrary Unicode true StaticLibrary Unicode <_ProjectFileVersion>10.0.30128.1 $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo Disabled ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;../../../Source/ThirdParty/MD5;%(AdditionalIncludeDirectories) WIN32;_DEBUG;MEDIAINFO_DVDIF_ANALYZE_NO;MEDIAINFO_MPEGTS_DUPLICATE_NO;MEDIAINFO_TRACE_NOx;MEDIAINFO_LIBMMS_NO;MEDIAINFO_LIBCURL_DLL_RUNTIME;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 EditAndContinue true NotUsing MediaInfo/PreComp.h 4100;4127;%(DisableSpecificWarnings) MachineX86 Disabled ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;../../../Source/ThirdParty/MD5;%(AdditionalIncludeDirectories) WIN32;_DEBUG;MEDIAINFO_DVDIF_ANALYZE_NO;MEDIAINFO_MPEGTS_DUPLICATE_NO;MEDIAINFO_TRACE_NOx;MEDIAINFO_LIBMMS_NO;MEDIAINFO_LIBCURL_DLL_RUNTIME;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 ProgramDatabase 4100;4127;%(DisableSpecificWarnings) true NotUsing MediaInfo/PreComp.h MachineX64 MaxSpeed ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;../../../Source/ThirdParty/MD5;%(AdditionalIncludeDirectories) MultiThreaded Level4 4100;4127;%(DisableSpecificWarnings) WIN32;NDEBUG;MEDIAINFO_DVDIF_ANALYZE_NO;MEDIAINFO_MPEGTS_DUPLICATE_NO;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBMMS_NO;MEDIAINFO_LIBCURL_DLL_RUNTIME;%(PreprocessorDefinitions) true Use MediaInfo/PreComp.h true true MachineX86 MaxSpeed ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;../../../Source/ThirdParty/MD5;%(AdditionalIncludeDirectories) WIN32;NDEBUG;MEDIAINFO_TRACE_NO;MEDIAINFO_EVENTS_NO;MEDIAINFO_DEMUX_NO;MEDIAINFO_DVDIF_ANALYZE_NO;MEDIAINFO_MPEGTS_DUPLICATE_NO;MEDIAINFO_SEEK_NO;MEDIAINFO_NEXTPACKET_NO;MEDIAINFO_IBI_NO;MEDIAINFO_LIBCURL_NO;%(PreprocessorDefinitions) MultiThreaded Level4 4100;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h true MachineX64 Disabled ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 EditAndContinue 4100;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h MachineX86 ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) EnableFastChecks MultiThreadedDebug Level4 4100;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h MachineX64 MaxSpeed ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;%(PreprocessorDefinitions) MultiThreaded Level4 4100;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h MachineX86 ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) Level4 4100;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h MachineX64 Create Create Create Create Create Create Create Create NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing {0da1da7d-f393-4e7c-a7ce-cb5c6a67bc94} {fd328ae2-5136-460f-a622-12cfd4d4c131} MediaInfoLib/Project/MSVC2010/Library/MediaInfoLib.vcxproj.filters100777 0 0 155476 12262525402 20174 0 {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {7a80fb2f-b1ab-4770-9008-7a2d4354bf17} {5b13d788-3ee4-45c9-bac6-52e4fcb49f06} {abddeafa-33d8-436c-b544-750dc7f7f932} {fe2f49e2-0bed-483e-9bbb-c4bc1e976e48} {588d0697-71cc-46a5-9bee-f0bb0708248a} {1a0a67f3-eff5-417d-94ef-5e10caee3c65} {47ccee67-c3e8-4ffd-acab-5d24ebe10546} {92f6ca9c-48e5-4681-aa2f-5bd7f9cc10b9} {9098012c-2ad7-4ebf-92ca-a78d407b7de1} {1c2205df-56a3-4a07-a68b-b922dcba6084} {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hpp;hxx;hm;inl;inc;xsd {469cd7fc-f6f2-4efd-b08d-9eee8157dd20} {b7140023-7da5-4439-a1a9-ac94a9fc9304} {30ee90d4-f895-4ef7-9ae2-6d532cec3a15} {bd3c2998-c17d-4257-95c6-adbadd72d9d7} {e530ab7e-a487-4e27-ad47-cc5d6f158b10} {aa0465f8-0c4a-4ae3-a92f-cd80297f2425} {76067c52-36bc-4cdf-bfa8-90fa8c73c647} {32f57e20-4c64-4c0b-9462-0078eb7c73d9} {5a642ccf-f167-403a-bd61-461f392f0244} {fb691036-49d1-42d5-a991-92e4e43a27ec} {5dc08159-7486-493c-b920-e170f1b36077} {d307708b-372c-475a-98e6-a76965d555ac} {5b70a9dd-eddc-44ba-bce4-35d86e77acdb} {5b14e18b-04eb-4989-8bf1-122caf5fae73} Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Image Source Files\Image Source Files\Image Source Files\Image Source Files\Image Source Files\Image Source Files\Image Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Tag Source Files\Tag Source Files\Tag Source Files\Tag Source Files\Tag Source Files\Tag Source Files\Tag Source Files\Duplicate Source Files\Duplicate Source Files\Duplicate Source Files\Reader Source Files\Reader Source Files\Reader Source Files\Reader Source Files\Export Source Files\Export Source Files\Video Source Files\Text Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Video Source Files\Video Source Files\Multiple Source Files\Multiple Source Files\Audio Source Files\Image Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Video Source Files\Audio Source Files\Audio Source Files\Archive Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Image Source Files\Video Source Files\Image Source Files\Multiple Source Files\Text Source Files\Text Source Files\Text Source Files\Multiple Source Files Source Files Source Files\Audio Source Files\Multiple Source Files\Export Source Files\Video Source Files\Video Source Files\Multiple ThirdParty\tinyxml2 Source Files\Audio Source Files\Video Source Files\Image Source Files\Image Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Text Source Files\Video ThirdParty\md5 Source Files\Text Source Files\Text Source Files\Text Source Files\Video Source Files\Multiple Source Files\Video Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Export Source Files\Multiple Source Files\Multiple Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Image Header Files\Image Header Files\Image Header Files\Image Header Files\Image Header Files\Image Header Files\Image Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Video Header Files\Video Header Files\Video Header Files\Video Header Files\Video Header Files\Video Header Files\Video Header Files\Video Header Files\Text Header Files\Text Header Files\Text Header Files\Text Header Files\Text Header Files\Text Header Files\Text Header Files\Text Header Files\Tag Header Files\Tag Header Files\Tag Header Files\Tag Header Files\Tag Header Files\Tag Header Files\Tag Header Files\Duplicate Header Files\Duplicate Header Files\Duplicate Header Files\Reader Header Files\Reader Header Files\Reader Header Files\Reader Header Files\Export Header Files\Export Header Files Header Files\Video Header Files\Text Header Files Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Video Header Files\Video Header Files\Multiple Header Files\Multiple Header Files\Audio Header Files\Image Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Video Header Files\Audio Header Files\Text Header Files\Reader Header Files\Video Header Files\Archive Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Image Header Files\Video Header Files\Image Header Files\Multiple Header Files\Text Header Files\Text Header Files\Text Header Files\Multiple Header Files Header Files\Reader Header Files\Audio Header Files\Multiple Header Files\Export ThirdParty\base64 Header Files\Video Header Files\Video Header Files\Multiple Header Files\Multiple ThirdParty\tinyxml2 Header Files\Audio Header Files\Video Header Files\Image Header Files\Image Header Files Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Text Header Files\Video ThirdParty\md5 Header Files\Text Header Files\Text Header Files\Text Header Files\Video Header Files\Multiple Header Files Header Files\Video Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Export Header Files\Multiple Header Files\Multiple MediaInfoLib/Project/MSVC2010/MediaInfoLib.sln100777 0 0 25124 12226004263 14161 0 Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ThirdParty", "ThirdParty", "{F696A30D-66C6-46A8-B1BC-04B13BF14290}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MediaInfoDll", "Dll\MediaInfoDll.vcxproj", "{BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MediaInfoLib", "Library\MediaInfoLib.vcxproj", "{20E0F8D6-213C-460B-B361-9C725CB375C7}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MediaInfoShellExt", "ShellExtension\MediaInfoShellExt.vcxproj", "{E987FD96-6BE1-45AF-9293-46B8A6695E6A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HowToUse_Dll", "Example\HowToUse_Dll.vcxproj", "{51E7EE1D-D4DD-4374-976C-66519B3B94DF}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZenLib", "..\..\..\ZenLib\Project\MSVC2010\Library\ZenLib.vcxproj", "{0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\..\..\zlib\projects\MSVC2010\zlib.vcxproj", "{FD328AE2-5136-460F-A622-12CFD4D4C131}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RegressionTest", "RegressionTest\RegressionTest.vcxproj", "{91C094CA-1170-4CE4-9B79-17324C8DACA8}" ProjectSection(ProjectDependencies) = postProject {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94} = {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94} {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5} = {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5} EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 DebugA|Win32 = DebugA|Win32 DebugA|x64 = DebugA|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 ReleaseA|Win32 = ReleaseA|Win32 ReleaseA|x64 = ReleaseA|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Debug|Win32.ActiveCfg = Debug|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Debug|Win32.Build.0 = Debug|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Debug|x64.ActiveCfg = Debug|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Debug|x64.Build.0 = Debug|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.DebugA|Win32.ActiveCfg = DebugA|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.DebugA|Win32.Build.0 = DebugA|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.DebugA|x64.ActiveCfg = DebugA|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.DebugA|x64.Build.0 = DebugA|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Release|Win32.ActiveCfg = Release|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Release|Win32.Build.0 = Release|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Release|x64.ActiveCfg = Release|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Release|x64.Build.0 = Release|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.ReleaseA|Win32.ActiveCfg = ReleaseA|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.ReleaseA|Win32.Build.0 = ReleaseA|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.ReleaseA|x64.ActiveCfg = ReleaseA|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.ReleaseA|x64.Build.0 = ReleaseA|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Debug|Win32.ActiveCfg = Debug|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Debug|Win32.Build.0 = Debug|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Debug|x64.ActiveCfg = Debug|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Debug|x64.Build.0 = Debug|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.DebugA|Win32.ActiveCfg = DebugA|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.DebugA|Win32.Build.0 = DebugA|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.DebugA|x64.ActiveCfg = DebugA|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.DebugA|x64.Build.0 = DebugA|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|Win32.ActiveCfg = Release|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|Win32.Build.0 = Release|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|x64.ActiveCfg = Release|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|x64.Build.0 = Release|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.ReleaseA|Win32.ActiveCfg = ReleaseA|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.ReleaseA|Win32.Build.0 = ReleaseA|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.ReleaseA|x64.ActiveCfg = ReleaseA|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.ReleaseA|x64.Build.0 = ReleaseA|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Debug|Win32.ActiveCfg = Debug|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Debug|Win32.Build.0 = Debug|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Debug|x64.ActiveCfg = Debug|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Debug|x64.Build.0 = Debug|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.DebugA|Win32.ActiveCfg = Debug|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.DebugA|Win32.Build.0 = Debug|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.DebugA|x64.ActiveCfg = Debug|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.DebugA|x64.Build.0 = Debug|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Release|Win32.ActiveCfg = Release|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Release|Win32.Build.0 = Release|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Release|x64.ActiveCfg = Release|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Release|x64.Build.0 = Release|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.ReleaseA|Win32.ActiveCfg = Release|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.ReleaseA|Win32.Build.0 = Release|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.ReleaseA|x64.ActiveCfg = Release|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.ReleaseA|x64.Build.0 = Release|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Debug|Win32.ActiveCfg = Debug|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Debug|Win32.Build.0 = Debug|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Debug|x64.ActiveCfg = Debug|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Debug|x64.Build.0 = Debug|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.DebugA|Win32.ActiveCfg = DebugA|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.DebugA|Win32.Build.0 = DebugA|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.DebugA|x64.ActiveCfg = DebugA|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.DebugA|x64.Build.0 = DebugA|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Release|Win32.ActiveCfg = Release|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Release|Win32.Build.0 = Release|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Release|x64.ActiveCfg = Release|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Release|x64.Build.0 = Release|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.ReleaseA|Win32.ActiveCfg = ReleaseA|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.ReleaseA|Win32.Build.0 = ReleaseA|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.ReleaseA|x64.ActiveCfg = ReleaseA|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.ReleaseA|x64.Build.0 = ReleaseA|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Debug|Win32.ActiveCfg = Debug|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Debug|Win32.Build.0 = Debug|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Debug|x64.ActiveCfg = Debug|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Debug|x64.Build.0 = Debug|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.DebugA|Win32.ActiveCfg = DebugA|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.DebugA|Win32.Build.0 = DebugA|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.DebugA|x64.ActiveCfg = DebugA|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.DebugA|x64.Build.0 = DebugA|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|Win32.ActiveCfg = Release|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|Win32.Build.0 = Release|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|x64.ActiveCfg = Release|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|x64.Build.0 = Release|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.ReleaseA|Win32.ActiveCfg = ReleaseA|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.ReleaseA|Win32.Build.0 = ReleaseA|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.ReleaseA|x64.ActiveCfg = ReleaseA|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.ReleaseA|x64.Build.0 = ReleaseA|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Debug|Win32.ActiveCfg = Debug|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Debug|Win32.Build.0 = Debug|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Debug|x64.ActiveCfg = Debug|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Debug|x64.Build.0 = Debug|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.DebugA|Win32.ActiveCfg = Debug|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.DebugA|Win32.Build.0 = Debug|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.DebugA|x64.ActiveCfg = Debug|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.DebugA|x64.Build.0 = Debug|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|Win32.ActiveCfg = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|Win32.Build.0 = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|x64.ActiveCfg = Release|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|x64.Build.0 = Release|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.ReleaseA|Win32.ActiveCfg = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.ReleaseA|Win32.Build.0 = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.ReleaseA|x64.ActiveCfg = Release|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.ReleaseA|x64.Build.0 = Release|x64 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Debug|Win32.ActiveCfg = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Debug|Win32.Build.0 = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Debug|x64.ActiveCfg = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.DebugA|Win32.ActiveCfg = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.DebugA|Win32.Build.0 = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.DebugA|x64.ActiveCfg = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Release|Win32.ActiveCfg = Release|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Release|Win32.Build.0 = Release|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Release|x64.ActiveCfg = Release|x64 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Release|x64.Build.0 = Release|x64 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.ReleaseA|Win32.ActiveCfg = Release|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.ReleaseA|Win32.Build.0 = Release|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.ReleaseA|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94} = {F696A30D-66C6-46A8-B1BC-04B13BF14290} {FD328AE2-5136-460F-A622-12CFD4D4C131} = {F696A30D-66C6-46A8-B1BC-04B13BF14290} EndGlobalSection EndGlobal MediaInfoLib/Project/MSVC2010/RegressionTest/ 40777 0 0 0 12264020632 14015 5MediaInfoLib/Project/MSVC2010/RegressionTest/RegressionTest.vcxproj100777 0 0 24220 12226004263 20532 0 Debug Win32 Debug x64 Release Win32 Release x64 {91C094CA-1170-4CE4-9B79-17324C8DACA8} Win32Proj RegressionTest Application true Unicode Application true Unicode Application false true Unicode Application false true Unicode true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\..\Source;..\..\..\Source\ThirdParty\md5;..\..\..\..\ZenLib\Source MultiThreadedDebug Console true ..\..\..\..\ZenLib\Project\MSVC2010\Library\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) ZenLib.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\..\Source;..\..\..\Source\ThirdParty\md5;..\..\..\..\ZenLib\Source MultiThreadedDebug Console true ..\..\..\..\ZenLib\Project\MSVC2010\Library\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) ZenLib.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\..\Source;..\..\..\Source\ThirdParty\md5;..\..\..\..\ZenLib\Source MultiThreaded Console true true true ZenLib.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) ..\..\..\..\ZenLib\Project\MSVC2010\Library\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\..\Source;..\..\..\Source\ThirdParty\md5;..\..\..\..\ZenLib\Source MultiThreaded Console true true true ZenLib.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) ..\..\..\..\ZenLib\Project\MSVC2010\Library\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoLib/Project/MSVC2010/RegressionTest/RegressionTest.vcxproj.filters100777 0 0 4040 12226004263 22157 0 {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hpp;hxx;hm;inl;inc;xsd {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms {dc36cb9c-62eb-4aad-b088-72349fd45229} {ad413cb6-a54e-44a0-9e83-7ad87d8ca276} Source Files Source Files Source Files Source Files ThirdParty\md5 Header Files ThirdParty\md5 MediaInfoLib/Project/MSVC2010/ShellExtension/ 40777 0 0 0 12264020632 14001 5MediaInfoLib/Project/MSVC2010/ShellExtension/MediaInfoShellExt.cpp100777 0 0 2731 12226004263 20114 0// MediaInfoShellExt.cpp : Implementation of DLL Exports. #include "stdafx.h" #include "resource.h" #include "MediaInfoShellExt.h" class CMediaInfoShellExtModule : public CAtlDllModuleT< CMediaInfoShellExtModule > { public : DECLARE_LIBID(LIBID_MediaInfoShellExtLib) DECLARE_REGISTRY_APPID_RESOURCEID(IDR_MEDIAINFOSHELLEXT, "{23D95783-1AF5-4C0F-84C1-EC49047EA2DC}") }; CMediaInfoShellExtModule _AtlModule; #ifdef _MANAGED #pragma managed(push, off) #endif // DLL Entry Point extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { hInstance; return _AtlModule.DllMain(dwReason, lpReserved); } #ifdef _MANAGED #pragma managed(pop) #endif // Used to determine whether the DLL can be unloaded by OLE STDAPI DllCanUnloadNow(void) { return _AtlModule.DllCanUnloadNow(); } // Returns a class factory to create an object of the requested type STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { return _AtlModule.DllGetClassObject(rclsid, riid, ppv); } // DllRegisterServer - Adds entries to the system registry STDAPI DllRegisterServer(void) { // registers object, typelib and all interfaces in typelib HRESULT hr = _AtlModule.DllRegisterServer(); return hr; } // DllUnregisterServer - Removes entries from the system registry STDAPI DllUnregisterServer(void) { HRESULT hr = _AtlModule.DllUnregisterServer(); return hr; } MediaInfoLib/Project/MSVC2010/ShellExtension/MediaInfoShellExt.def100777 0 0 362 12226004263 20046 0; MediaInfoShellExt.def : Declares the module parameters. LIBRARY "MediaInfo_InfoTip.dll" EXPORTS DllCanUnloadNow PRIVATE DllGetClassObject PRIVATE DllRegisterServer PRIVATE DllUnregisterServer PRIVATE MediaInfoLib/Project/MSVC2010/ShellExtension/MediaInfoShellExt.h100777 0 0 10034 12263225175 17604 0 /* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* File created by MIDL compiler version 7.00.0555 */ /* at Wed Jan 08 11:37:48 2014 */ /* Compiler settings for MediaInfoShellExt.idl: Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 7.00.0555 protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) DECLSPEC_UUID(), MIDL_INTERFACE() */ /* @@MIDL_FILE_HEADING( ) */ #pragma warning( disable: 4049 ) /* more than 64k source lines */ /* verify that the version is high enough to compile this file*/ #ifndef __REQUIRED_RPCNDR_H_VERSION__ #define __REQUIRED_RPCNDR_H_VERSION__ 475 #endif #include "rpc.h" #include "rpcndr.h" #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of #endif // __RPCNDR_H_VERSION__ #ifndef COM_NO_WINDOWS_H #include "windows.h" #include "ole2.h" #endif /*COM_NO_WINDOWS_H*/ #ifndef __MediaInfoShellExt_h__ #define __MediaInfoShellExt_h__ #if defined(_MSC_VER) && (_MSC_VER >= 1020) #pragma once #endif /* Forward Declarations */ #ifndef __IMediaInfoShellExt__FWD_DEFINED__ #define __IMediaInfoShellExt__FWD_DEFINED__ typedef interface IMediaInfoShellExt_ IMediaInfoShellExt_; #endif /* __IMediaInfoShellExt__FWD_DEFINED__ */ #ifndef __MediaInfoShellExt__FWD_DEFINED__ #define __MediaInfoShellExt__FWD_DEFINED__ #ifdef __cplusplus typedef class MediaInfoShellExt_ MediaInfoShellExt_; #else typedef struct MediaInfoShellExt_ MediaInfoShellExt_; #endif /* __cplusplus */ #endif /* __MediaInfoShellExt__FWD_DEFINED__ */ /* header files for imported files */ #include "oaidl.h" #include "ocidl.h" #ifdef __cplusplus extern "C"{ #endif #ifndef __IMediaInfoShellExt__INTERFACE_DEFINED__ #define __IMediaInfoShellExt__INTERFACE_DEFINED__ /* interface IMediaInfoShellExt_ */ /* [unique][helpstring][uuid][object] */ EXTERN_C const IID IID_IMediaInfoShellExt_; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("6482FE39-D67B-49E5-BAA1-EBDDB318055D") IMediaInfoShellExt_ : public IUnknown { public: }; #else /* C style interface */ typedef struct IMediaInfoShellExt_Vtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( IMediaInfoShellExt_ * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ __RPC__deref_out void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( IMediaInfoShellExt_ * This); ULONG ( STDMETHODCALLTYPE *Release )( IMediaInfoShellExt_ * This); END_INTERFACE } IMediaInfoShellExt_Vtbl; interface IMediaInfoShellExt_ { CONST_VTBL struct IMediaInfoShellExt_Vtbl *lpVtbl; }; #ifdef COBJMACROS #define IMediaInfoShellExt__QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMediaInfoShellExt__AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMediaInfoShellExt__Release(This) \ ( (This)->lpVtbl -> Release(This) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMediaInfoShellExt__INTERFACE_DEFINED__ */ #ifndef __MediaInfoShellExtLib_LIBRARY_DEFINED__ #define __MediaInfoShellExtLib_LIBRARY_DEFINED__ /* library MediaInfoShellExtLib */ /* [helpstring][version][uuid] */ EXTERN_C const IID LIBID_MediaInfoShellExtLib; EXTERN_C const CLSID CLSID_MediaInfoShellExt_; #ifdef __cplusplus class DECLSPEC_UUID("869C14C8-1830-491F-B575-5F9AB40D2B42") MediaInfoShellExt_; #endif #endif /* __MediaInfoShellExtLib_LIBRARY_DEFINED__ */ /* Additional Prototypes for ALL interfaces */ /* end of Additional Prototypes */ #ifdef __cplusplus } #endif #endif MediaInfoLib/Project/MSVC2010/ShellExtension/MediaInfoShellExt.idl100777 0 0 1421 12226004263 20075 0// MediaInfoShellExt.idl : IDL source for MediaInfoShellExt // // This file will be processed by the MIDL tool to // produce the type library (MediaInfoShellExt.tlb) and marshalling code. import "oaidl.idl"; import "ocidl.idl"; [ object, uuid(6482FE39-D67B-49E5-BAA1-EBDDB318055D), helpstring("IMediaInfoShellExt_ Interface"), pointer_default(unique) ] interface IMediaInfoShellExt_ : IUnknown{ }; [ uuid(BC1AAA9F-D8C5-4EB2-A10A-61B86B7EA77C), version(1.0), helpstring("MediaInfoShellExt 1.0 Type Library") ] library MediaInfoShellExtLib { importlib("stdole2.tlb"); [ uuid(869C14C8-1830-491F-B575-5F9AB40D2B42), helpstring("MediaInfoShellExt_ Class") ] coclass MediaInfoShellExt_ { [default] interface IMediaInfoShellExt_; }; }; MediaInfoLib/Project/MSVC2010/ShellExtension/MediaInfoShellExt.rc100777 0 0 1563 12264020304 17734 0#include VS_VERSION_INFO VERSIONINFO FILEVERSION 0,7,67,0 PRODUCTVERSION 0,7,67,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x4L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904e4" BEGIN VALUE "CompanyName", "http://MediaArea.net/MediaInfo" VALUE "FileDescription", "MediaInfo Shell ToolTip" VALUE "FileVersion", "0,7,67,0" VALUE "InternalName", "MediaInfo_ToolTip.dll" VALUE "LegalCopyright", "BSD-2-Clause" VALUE "OriginalFilename", "MediaInfo_ToolTip.dll" VALUE "ProductName", "MediaInfo" VALUE "ProductVersion", "0,7,67,0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1252 END END MediaInfoLib/Project/MSVC2010/ShellExtension/MediaInfoShellExt.vcxproj100777 0 0 40327 12226004263 21050 0 Debug Win32 Debug x64 Release Win32 Release x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A} MediaInfoShellExt AtlProj DynamicLibrary Static Unicode true DynamicLibrary Static Unicode DynamicLibrary Static Unicode true DynamicLibrary Static Unicode <_ProjectFileVersion>10.0.30128.1 $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ false MediaInfo_InfoTip MediaInfo_InfoTip MediaInfo_InfoTip MediaInfo_InfoTip _DEBUG;%(PreprocessorDefinitions) false Win32 true $(IntDir)MediaInfoShellExt.tlb MediaInfoShellExt.h MediaInfoShellExt_i.c MediaInfoShellExt_p.c false Disabled ..\..\..\..\MediaInfoLib\Source;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Use Level3 EditAndContinue true _DEBUG;%(PreprocessorDefinitions) 0x0409 $(IntDir);%(AdditionalIncludeDirectories) MediaInfo.lib;%(AdditionalDependencies) $(OutDir)MediaInfo_InfoTip.dll ../../../../MediaInfoLib/Project/MSVC2010/DLL\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoShellExt.def true Windows MachineX86 _DEBUG;%(PreprocessorDefinitions) false X64 true $(IntDir)MediaInfoShellExt.tlb MediaInfoShellExt.h MediaInfoShellExt_i.c MediaInfoShellExt_p.c Disabled ..\..\..\..\MediaInfoLib\Source;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Use Level3 ProgramDatabase true _DEBUG;%(PreprocessorDefinitions) 0x0409 $(IntDir);%(AdditionalIncludeDirectories) MediaInfo.lib;%(AdditionalDependencies) $(OutDir)MediaInfo_InfoTip.dll ../../../../MediaInfoLib/Project/MSVC2010/DLL\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoShellExt.def true Windows MachineX64 NDEBUG;%(PreprocessorDefinitions) false Win32 true $(IntDir)MediaInfoShellExt.tlb MediaInfoShellExt.h MediaInfoShellExt_i.c MediaInfoShellExt_p.c false MaxSpeed ..\..\..\..\MediaInfoLib\Source;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) MultiThreaded Use Level3 true NDEBUG;%(PreprocessorDefinitions) 0x0409 $(IntDir);%(AdditionalIncludeDirectories) MediaInfo.lib;%(AdditionalDependencies) $(OutDir)MediaInfo_InfoTip.dll ../../../../MediaInfoLib/Project/MSVC2010/DLL\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoShellExt.def Windows MachineX86 true true true NDEBUG;%(PreprocessorDefinitions) false X64 true $(IntDir)MediaInfoShellExt.tlb MediaInfoShellExt.h MediaInfoShellExt_i.c MediaInfoShellExt_p.c MaxSpeed ..\..\..\..\MediaInfoLib\Source;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) MultiThreaded Use Level3 true NDEBUG;%(PreprocessorDefinitions) 0x0409 $(IntDir);%(AdditionalIncludeDirectories) MediaInfo.lib;%(AdditionalDependencies) $(OutDir)MediaInfo_InfoTip.dll ../../../../MediaInfoLib/Project/MSVC2010/DLL\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoShellExt.def Windows MachineX64 true true true Create Create Create Create {be6d3ef8-2f82-4f1e-956a-890c3614a2d5} MediaInfoLib/Project/MSVC2010/ShellExtension/MediaInfoShellExt.vcxproj.filters100777 0 0 4640 12226004263 22475 0 {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hpp;hxx;hm;inl;inc;xsd {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav {5019c97c-ba9f-4a00-8e93-f0b5b31aa6d8} False Source Files Source Files Source Files Generated Files Source Files Resource Files Resource Files Source Files Header Files Header Files Header Files Generated Files Resource Files MediaInfoLib/Project/MSVC2010/ShellExtension/MediaInfoShellExt_.cpp100777 0 0 3731 12226004263 20254 0// MediaInfoShellExt_.cpp : Implementation of CMediaInfoShellExt_ #include "stdafx.h" #include "MediaInfoShellExt_.h" #include // CMediaInfoShellExt_ HRESULT CMediaInfoShellExt_::Load (LPCOLESTR wszFilename, DWORD) { //Save FileName FileName = wszFilename; //OK return S_OK; } HRESULT CMediaInfoShellExt_::GetInfoTip (DWORD, LPWSTR* ppwszTip) { LPMALLOC Malloc; std::wstring ToolTip; //Get an IMalloc interface from the shell. if (FAILED(SHGetMalloc(&Malloc))) return E_FAIL; //Creating tooltip ToolTip=_T("MediaInfo:\n"); MediaInfoDLL::MediaInfo I; I.Option(_T("Inform"), _T("Summary")); I.Open(FileName); for (size_t StreamKind=0; StreamKind<(size_t)MediaInfoDLL::Stream_Max; StreamKind++) for (size_t StreamPos=0; StreamPos0) { ToolTip+=I.Get((MediaInfoDLL::stream_t)StreamKind, StreamPos, _T("StreamKind")); ToolTip+=_T(": "); } ToolTip+=I.Get((MediaInfoDLL::stream_t)StreamKind, StreamPos, _T("Inform")); ToolTip+=_T("\r\n"); } if (ToolTip.size()>2) ToolTip.resize(ToolTip.size()-2); //Removing the ending \r\n //Allocate a buffer for Explorer. Note that the must pass the string //back as a Unicode string, so the string length is multiplied by the //size of a Unicode character. *ppwszTip=(LPWSTR)Malloc->Alloc((ToolTip.size()+1)*sizeof(wchar_t)); //Release the IMalloc interface now that we're done using it. Malloc->Release(); //Enough memory? if (*ppwszTip==NULL) return E_OUTOFMEMORY; //Use the Unicode string copy function to put the tooltip text in the buffer. wcscpy_s(*ppwszTip, ToolTip.size()+1, T2COLE(ToolTip.c_str())); //OK return S_OK; }MediaInfoLib/Project/MSVC2010/ShellExtension/MediaInfoShellExt_.h100777 0 0 4237 12226004263 17723 0// MediaInfoShellExt_.h : Declaration of the CMediaInfoShellExt_ #pragma once #include "resource.h" // main symbols #include "MediaInfoShellExt.h" #include struct __declspec(uuid("00021500-0000-0000-c000-000000000046")) IQueryInfo; #include #include #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA) #error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms." #endif // CMediaInfoShellExt_ class ATL_NO_VTABLE CMediaInfoShellExt_ : public CComObjectRootEx, public CComCoClass, public IPersistFile, public IQueryInfo { public: CMediaInfoShellExt_() { } DECLARE_REGISTRY_RESOURCEID(IDR_MEDIAINFOSHELLEXT_) DECLARE_NOT_AGGREGATABLE(CMediaInfoShellExt_) BEGIN_COM_MAP(CMediaInfoShellExt_) COM_INTERFACE_ENTRY(IPersistFile) COM_INTERFACE_ENTRY(IQueryInfo) END_COM_MAP() DECLARE_PROTECT_FINAL_CONSTRUCT() HRESULT FinalConstruct() { return S_OK; } void FinalRelease() { } protected: std::wstring FileName; public: // IPersistFile STDMETHOD(GetClassID)(LPCLSID) { return E_NOTIMPL; } STDMETHOD(IsDirty)() { return E_NOTIMPL; } STDMETHOD(Load)(LPCOLESTR, DWORD); STDMETHOD(Save)(LPCOLESTR, BOOL) { return E_NOTIMPL; } STDMETHOD(SaveCompleted)(LPCOLESTR) { return E_NOTIMPL; } STDMETHOD(GetCurFile)(LPOLESTR*) { return E_NOTIMPL; } // IQueryInfo STDMETHOD(GetInfoFlags)(DWORD*) { return E_NOTIMPL; } STDMETHOD(GetInfoTip)(DWORD, LPWSTR*); }; OBJECT_ENTRY_AUTO(__uuidof(MediaInfoShellExt_), CMediaInfoShellExt_) MediaInfoLib/Project/MSVC2010/ShellExtension/resource.h100777 0 0 1044 12226004263 16100 0//{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by MediaInfoShellExt.rc // #define IDS_PROJNAME 100 #define IDR_MEDIAINFOSHELLEXT 101 #define IDR_MEDIAINFOSHELLEXT_ 102 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 201 #define _APS_NEXT_COMMAND_VALUE 32768 #define _APS_NEXT_CONTROL_VALUE 201 #define _APS_NEXT_SYMED_VALUE 103 #endif #endif MediaInfoLib/Project/MSVC2010/ShellExtension/stdafx.cpp100777 0 0 325 12226004263 16056 0// stdafx.cpp : source file that includes just the standard includes // MediaInfoShellExt.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" MediaInfoLib/Project/MSVC2010/ShellExtension/stdafx.h100777 0 0 2666 12226004263 15555 0// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, // but are changed infrequently #pragma once #ifndef STRICT #define STRICT #endif // Modify the following defines if you have to target a platform prior to the ones specified below. // Refer to MSDN for the latest info on corresponding values for different platforms. #ifndef WINVER // Allow use of features specific to Windows XP or later. #define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. #endif #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. #endif #ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. #endif #ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. #define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. #endif #define _ATL_APARTMENT_THREADED #define _ATL_NO_AUTOMATIC_NAMESPACE #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit #include "resource.h" #include #include using namespace ATL;MediaInfoLib/Project/MSVC2010/ShellExtension/x64/ 40777 0 0 0 12264020632 14422 5MediaInfoLib/Project/MSVC2010/ShellExtension/x64/Debug/ 40777 0 0 0 12263225177 15462 5MediaInfoLib/Project/MSVC2010/ShellExtension/x64/Debug/Intermediate/ 40777 0 0 0 12263225200 20057 5MediaInfoLib/Project/MSVC2010/ShellExtension/x64/Debug/Intermediate/MediaInfo_InfoTip_manifest.rc100777 0 0 410 12263225177 25646 02 /* ISOLATIONAWARE_MANIFEST_RESOURCE_ID */ 24 /* RT_MANIFEST */ "x64\\Debug\\Intermediate\\MediaInfo_InfoTip.dll.embed.manifest" MediaInfoLib/Project/MSVC2012/ 40777 0 0 0 12226004263 11037 5MediaInfoLib/Project/MSVC2012/Dll/ 40777 0 0 0 12264020632 11552 5MediaInfoLib/Project/MSVC2012/Dll/MediaInfo.rc100777 0 0 1661 12264020304 14033 0#include VS_VERSION_INFO VERSIONINFO FILEVERSION 0,7,67,0 PRODUCTVERSION 0,7,67,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x40004L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "MediaArea.net" VALUE "FileDescription", "Convenient unified display of the most relevant technical and tag data for video and audio files" VALUE "FileVersion", "0.7.67.0" VALUE "InternalName", "MediaInfoLib - DLL - MSVC 2010" VALUE "LegalCopyright", "MediaArea.net" VALUE "OriginalFilename", "MediaInfo.dll" VALUE "ProductName", "MediaInfo" VALUE "ProductVersion", "0.7.67.0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END MediaInfoLib/Project/MSVC2012/Dll/MediaInfoDll.vcxproj100777 0 0 66353 12226004263 15613 0 DebugA ARM DebugA Win32 DebugA x64 Debug ARM Debug Win32 Debug x64 ReleaseA ARM ReleaseA Win32 ReleaseA x64 Release ARM Release Win32 Release x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5} MediaInfoDll Win32Proj DynamicLibrary MultiByte true v110_xp DynamicLibrary MultiByte true v110 true DynamicLibrary MultiByte false v110_xp DynamicLibrary MultiByte false v110 true DynamicLibrary Unicode true v110_xp DynamicLibrary Unicode true v110 true DynamicLibrary Unicode v110_xp true DynamicLibrary Unicode v110 true true DynamicLibrary MultiByte true v110_xp DynamicLibrary MultiByte false v110_xp DynamicLibrary true Unicode v110_xp DynamicLibrary Unicode v110_xp true <_ProjectFileVersion>10.0.30128.1 $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 true 4100;%(DisableSpecificWarnings) Disabled true Windows MachineX86 ../../../Source/MediaInfoDLL/MediaInfoDLL.def ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 true 4100;%(DisableSpecificWarnings) Disabled true Windows ../../../Source/MediaInfoDLL/MediaInfoDLL.def Disabled ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 4100;%(DisableSpecificWarnings) true true Windows MachineX64 ../../../Source/MediaInfoDLL/MediaInfoDLL.def MaxSpeed ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) MultiThreaded Level4 4100;%(DisableSpecificWarnings) true true true Windows MachineX86 true true true ../../../Source/MediaInfoDLL/MediaInfoDLL.def MaxSpeed ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) MultiThreaded Level4 4100;%(DisableSpecificWarnings) true true true Windows true true true ../../../Source/MediaInfoDLL/MediaInfoDLL.def MaxSpeed ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) MultiThreaded Level4 4100;%(DisableSpecificWarnings) true true Windows MachineX64 true true true ../../../Source/MediaInfoDLL/MediaInfoDLL.def Disabled ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 4100;%(DisableSpecificWarnings) true true Windows MachineX86 ../../../Source/MediaInfoDLL/MediaInfoDLL.def Disabled ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 4100;%(DisableSpecificWarnings) true true Windows ../../../Source/MediaInfoDLL/MediaInfoDLL.def Level4 4100;%(DisableSpecificWarnings) true ../../../Source/MediaInfoDLL/MediaInfoDLL.def MaxSpeed ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) MultiThreaded Level4 4100;%(DisableSpecificWarnings) true true true Windows MachineX86 true true true ../../../Source/MediaInfoDLL/MediaInfoDLL.def MaxSpeed ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) MultiThreaded Level4 4100;%(DisableSpecificWarnings) true true true Windows true true true ../../../Source/MediaInfoDLL/MediaInfoDLL.def Level4 4100;%(DisableSpecificWarnings) true true true true true ../../../Source/MediaInfoDLL/MediaInfoDLL.def {0da1da7d-f393-4e7c-a7ce-cb5c6a67bc94} {fd328ae2-5136-460f-a622-12cfd4d4c131} {20e0f8d6-213c-460b-b361-9c725cb375c7} MediaInfoLib/Project/MSVC2012/Dll/MediaInfoDll.vcxproj.filters100777 0 0 2062 12226004263 17225 0 {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav Source Files Resource Files Source Files MediaInfoLib/Project/MSVC2012/Example/ 40777 0 0 0 12226004263 12432 5MediaInfoLib/Project/MSVC2012/Example/HowToUse.rc100777 0 0 5124 12264020304 14573 0//Microsoft Developer Studio generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // French (France) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) #ifdef _WIN32 LANGUAGE LANG_FRENCH, SUBLANG_FRENCH #pragma code_page(1252) #endif //_WIN32 #ifndef _MAC ///////////////////////////////////////////////////////////////////////////// // // Version // VS_VERSION_INFO VERSIONINFO FILEVERSION 0,4,0,0 PRODUCTVERSION 0,4,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x40004L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040c04b0" BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "http://MediaArea.net/MediaInfo\0" VALUE "FileDescription", "Read info about media files (command line)\0" VALUE "FileVersion", "0,7,67,0\0" VALUE "InternalName", "MediaInfo - Cmd - Win32 - Microsoft\0" VALUE "LegalCopyright", "BSD-2-Clause\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "MediaInfo.exe\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "MediaInfo (Cmd)\0" VALUE "ProductVersion", "0,7,67,0\0" VALUE "SpecialBuild", "\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x40c, 1200 END END #endif // !_MAC #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE DISCARDABLE BEGIN "resource.h\0" END 2 TEXTINCLUDE DISCARDABLE BEGIN "#include ""afxres.h""\r\n" "\0" END 3 TEXTINCLUDE DISCARDABLE BEGIN "\r\n" "\0" END #endif // APSTUDIO_INVOKED #endif // French (France) resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED MediaInfoLib/Project/MSVC2012/Example/HowToUse_Dll.vcxproj100777 0 0 64323 12226004263 16507 0 DebugA ARM DebugA Win32 DebugA x64 Debug ARM Debug Win32 Debug x64 ReleaseA ARM ReleaseA Win32 ReleaseA x64 Release ARM Release Win32 Release x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF} HowToUse_Dll Win32Proj Application MultiByte true v110_xp Application MultiByte true v110_xp Application MultiByte v110_xp Application MultiByte v110_xp Application Unicode true v110_xp Application Unicode true v110_xp Application Unicode v110_xp Application Unicode v110_xp Application MultiByte v110_xp Application MultiByte v110_xp Application Unicode true v110_xp Application Unicode v110_xp <_ProjectFileVersion>10.0.30128.1 $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ Disabled ../../../Source;../../../../ZenLib/Source;../../../../ZLib;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level4 MediaInfo.lib;ZenLib.lib;zlib.lib;%(AdditionalDependencies) ..\..\..\..\MediaInfoLib\Project\MSVC2012\Library\$(Platform)\$(Configuration);..\..\..\..\ZenLib\Project\MSVC2012\Library\$(Platform)\$(Configuration);..\..\..\..\zlib\projects\MSVC2012\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) true Console false MachineX86 Disabled ../../../Source;../../../../ZenLib/Source;../../../../ZLib;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level4 MediaInfo.lib;ZenLib.lib;zlib.lib;%(AdditionalDependencies) ..\..\..\..\MediaInfoLib\Project\MSVC2012\Library\$(Platform)\$(Configuration);..\..\..\..\ZenLib\Project\MSVC2012\Library\$(Platform)\$(Configuration);..\..\..\..\zlib\projects\MSVC2012\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) true Console false X64 Disabled ..\..\..\Source;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level4 ProgramDatabase %(AdditionalLibraryDirectories) true Console false MachineX64 ../../../Source;../../../../ZenLib/Source;../../../../ZLib;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level4 MediaInfo.lib;ZenLib.lib;zlib.lib;%(AdditionalDependencies) ..\..\..\..\MediaInfoLib\Project\MSVC2012\Library\$(Platform)\$(Configuration);..\..\..\..\ZenLib\Project\MSVC2012\Library\$(Platform)\$(Configuration);..\..\..\..\zlib\projects\MSVC2012\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) true Console true true false MachineX86 ../../../Source;../../../../ZenLib/Source;../../../../ZLib;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level4 MediaInfo.lib;ZenLib.lib;zlib.lib;%(AdditionalDependencies) ..\..\..\..\MediaInfoLib\Project\MSVC2012\Library\$(Platform)\$(Configuration);..\..\..\..\ZenLib\Project\MSVC2012\Library\$(Platform)\$(Configuration);..\..\..\..\zlib\projects\MSVC2012\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) true Console true true false X64 ..\..\..\Source;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level4 %(AdditionalLibraryDirectories) true Console true true false MachineX64 Disabled ..\..\..\Source;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level4 %(AdditionalLibraryDirectories) true Console false MachineX86 Disabled ..\..\..\Source;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level4 %(AdditionalLibraryDirectories) true Console false ..\..\..\Source;%(AdditionalIncludeDirectories) Level4 ..\..\..\Source;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level4 %(AdditionalLibraryDirectories) true Console true true false MachineX86 ..\..\..\Source;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level4 %(AdditionalLibraryDirectories) true Console true true false ..\..\..\Source;%(AdditionalIncludeDirectories) Level4 {be6d3ef8-2f82-4f1e-956a-890c3614a2d5} MediaInfoLib/Project/MSVC2012/Example/HowToUse_Dll.vcxproj.filters100777 0 0 2400 12226004263 20122 0 {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hpp;hxx;hm;inl;inc;xsd {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav Source Files Header Files Resource Files MediaInfoLib/Project/MSVC2012/Library/ 40777 0 0 0 12264020632 12443 5MediaInfoLib/Project/MSVC2012/Library/MediaInfoLib.vcxproj100777 0 0 165502 12262557362 16530 0 DebugA ARM DebugA Win32 DebugA x64 Debug ARM Debug Win32 Debug x64 ReleaseA ARM ReleaseA Win32 ReleaseA x64 Release ARM Release Win32 Release x64 {20E0F8D6-213C-460B-B361-9C725CB375C7} MediaInfoLib Win32Proj StaticLibrary MultiByte true v110_xp StaticLibrary MultiByte true v110 StaticLibrary MultiByte v110_xp StaticLibrary MultiByte v110 StaticLibrary Unicode true v110_xp StaticLibrary Unicode true v110 StaticLibrary Unicode v110_xp StaticLibrary Unicode v110 true StaticLibrary MultiByte v110_xp StaticLibrary MultiByte v110_xp StaticLibrary Unicode true v110_xp StaticLibrary Unicode v110_xp <_ProjectFileVersion>10.0.30128.1 $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/md5;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;MEDIAINFO_LIBCURL_DLL_RUNTIME;%(PreprocessorDefinitions) MultiThreadedDebug Use MediaInfo/PreComp.h 4100;4996;4127;%(DisableSpecificWarnings) true Level4 Disabled EnableFastChecks MachineX86 ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/md5;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;MEDIAINFO_LIBCURL_NO;%(PreprocessorDefinitions) MultiThreadedDebugDLL Use MediaInfo/PreComp.h 4100;4996;4127;%(DisableSpecificWarnings) true Level4 Disabled EnableFastChecks MachineX86 Disabled ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/md5;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;MEDIAINFO_LIBMMS_NO;MEDIAINFO_LIBCURL_DLL_RUNTIME;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 4100;4996;4127;%(DisableSpecificWarnings) true NotUsing MediaInfo/PreComp.h MachineX64 MaxSpeed ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/md5;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) MultiThreaded Level4 4100;4996;4127;%(DisableSpecificWarnings) WIN32;NDEBUG;MEDIAINFO_DVDIF_ANALYZE_NO;MEDIAINFO_MPEGTS_DUPLICATE_NO;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBMMS_NO;MEDIAINFO_LIBCURL_DLL_RUNTIME;%(PreprocessorDefinitions) true Use MediaInfo/PreComp.h true true MachineX86 MaxSpeed ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/md5;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) MultiThreaded Level4 4100;4996;4127;%(DisableSpecificWarnings) WIN32;NDEBUG;MEDIAINFO_DVDIF_ANALYZE_NO;MEDIAINFO_MPEGTS_DUPLICATE_NO;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBMMS_NO;MEDIAINFO_LIBCURL_DLL_RUNTIME;%(PreprocessorDefinitions) true Use MediaInfo/PreComp.h true true MachineX86 MaxSpeed ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/md5;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;MEDIAINFO_TRACE_NO;MEDIAINFO_EVENTS_NO;MEDIAINFO_DEMUX_NO;MEDIAINFO_DVDIF_ANALYZE_NO;MEDIAINFO_MPEGTS_DUPLICATE_NO;MEDIAINFO_SEEK_NO;MEDIAINFO_NEXTPACKET_NO;MEDIAINFO_IBI_NO;MEDIAINFO_LIBCURL_NO;%(PreprocessorDefinitions) MultiThreaded Level4 4100;4996;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h true MachineX64 Disabled ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 4100;4996;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h MachineX86 Disabled ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 4100;4996;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h MachineX86 ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) EnableFastChecks MultiThreadedDebug Level4 4100;4996;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h MachineX64 MaxSpeed ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;%(PreprocessorDefinitions) MultiThreaded Level4 4100;4996;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h MachineX86 MaxSpeed ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;%(PreprocessorDefinitions) MultiThreaded Level4 4100;4996;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h MachineX86 ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) Level4 4100;4996;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h MachineX64 Create Create Create Create Create Create Create Create Create Create Create Create NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing {0da1da7d-f393-4e7c-a7ce-cb5c6a67bc94} {fd328ae2-5136-460f-a622-12cfd4d4c131} MediaInfoLib/Project/MSVC2012/Library/MediaInfoLib.vcxproj.filters100777 0 0 155476 12262557362 20210 0 {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {7a80fb2f-b1ab-4770-9008-7a2d4354bf17} {5b13d788-3ee4-45c9-bac6-52e4fcb49f06} {abddeafa-33d8-436c-b544-750dc7f7f932} {fe2f49e2-0bed-483e-9bbb-c4bc1e976e48} {588d0697-71cc-46a5-9bee-f0bb0708248a} {1a0a67f3-eff5-417d-94ef-5e10caee3c65} {47ccee67-c3e8-4ffd-acab-5d24ebe10546} {92f6ca9c-48e5-4681-aa2f-5bd7f9cc10b9} {9098012c-2ad7-4ebf-92ca-a78d407b7de1} {1c2205df-56a3-4a07-a68b-b922dcba6084} {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hpp;hxx;hm;inl;inc;xsd {469cd7fc-f6f2-4efd-b08d-9eee8157dd20} {b7140023-7da5-4439-a1a9-ac94a9fc9304} {30ee90d4-f895-4ef7-9ae2-6d532cec3a15} {bd3c2998-c17d-4257-95c6-adbadd72d9d7} {e530ab7e-a487-4e27-ad47-cc5d6f158b10} {aa0465f8-0c4a-4ae3-a92f-cd80297f2425} {76067c52-36bc-4cdf-bfa8-90fa8c73c647} {32f57e20-4c64-4c0b-9462-0078eb7c73d9} {5a642ccf-f167-403a-bd61-461f392f0244} {fb691036-49d1-42d5-a991-92e4e43a27ec} {5dc08159-7486-493c-b920-e170f1b36077} {d307708b-372c-475a-98e6-a76965d555ac} {5b70a9dd-eddc-44ba-bce4-35d86e77acdb} {c54702a2-93da-4abd-8766-43f9f80731c2} Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Image Source Files\Image Source Files\Image Source Files\Image Source Files\Image Source Files\Image Source Files\Image Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Tag Source Files\Tag Source Files\Tag Source Files\Tag Source Files\Tag Source Files\Tag Source Files\Tag Source Files\Duplicate Source Files\Duplicate Source Files\Duplicate Source Files\Reader Source Files\Reader Source Files\Reader Source Files\Reader Source Files\Export Source Files\Export Source Files\Video Source Files\Text Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Video Source Files\Video Source Files\Multiple Source Files\Multiple Source Files\Audio Source Files\Image Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Video Source Files\Audio Source Files\Audio Source Files\Archive Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Image Source Files\Video Source Files\Image Source Files\Multiple Source Files\Text Source Files\Text Source Files\Text Source Files\Multiple Source Files Source Files Source Files\Audio Source Files\Multiple Source Files\Export Source Files\Video Source Files\Video Source Files\Multiple ThirdParty\tinyxml2 Source Files\Audio Source Files\Video Source Files\Image Source Files\Image Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Text Source Files\Video ThirdParty\md5 Source Files\Text Source Files\Text Source Files\Text Source Files\Video Source Files\Multiple Source Files\Video Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Export Source Files\Multiple Source Files\Multiple Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Image Header Files\Image Header Files\Image Header Files\Image Header Files\Image Header Files\Image Header Files\Image Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Video Header Files\Video Header Files\Video Header Files\Video Header Files\Video Header Files\Video Header Files\Video Header Files\Video Header Files\Text Header Files\Text Header Files\Text Header Files\Text Header Files\Text Header Files\Text Header Files\Text Header Files\Text Header Files\Tag Header Files\Tag Header Files\Tag Header Files\Tag Header Files\Tag Header Files\Tag Header Files\Tag Header Files\Duplicate Header Files\Duplicate Header Files\Duplicate Header Files\Reader Header Files\Reader Header Files\Reader Header Files\Reader Header Files\Export Header Files\Export Header Files Header Files\Video Header Files\Text Header Files Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Video Header Files\Video Header Files\Multiple Header Files\Multiple Header Files\Audio Header Files\Image Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Video Header Files\Audio Header Files\Text Header Files\Reader Header Files\Video Header Files\Archive Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Image Header Files\Video Header Files\Image Header Files\Multiple Header Files\Text Header Files\Text Header Files\Text Header Files\Multiple Header Files Header Files\Reader Header Files\Audio Header Files\Multiple Header Files\Export ThirdParty\base64 Header Files\Video Header Files\Video Header Files\Multiple Header Files\Multiple ThirdParty\tinyxml2 Header Files\Audio Header Files\Video Header Files\Image Header Files\Image Header Files Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Text Header Files\Video ThirdParty\md5 Header Files\Text Header Files\Text Header Files\Text Header Files\Video Header Files\Multiple Header Files\Video Header Files Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Export Header Files\Multiple Header Files\Multiple MediaInfoLib/Project/MSVC2012/MediaInfoLib.sln100777 0 0 25012 12226004263 14157 0 Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ThirdParty", "ThirdParty", "{F696A30D-66C6-46A8-B1BC-04B13BF14290}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MediaInfoDll", "Dll\MediaInfoDll.vcxproj", "{BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MediaInfoLib", "Library\MediaInfoLib.vcxproj", "{20E0F8D6-213C-460B-B361-9C725CB375C7}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MediaInfoShellExt", "ShellExtension\MediaInfoShellExt.vcxproj", "{E987FD96-6BE1-45AF-9293-46B8A6695E6A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HowToUse_Dll", "Example\HowToUse_Dll.vcxproj", "{51E7EE1D-D4DD-4374-976C-66519B3B94DF}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZenLib", "..\..\..\ZenLib\Project\MSVC2012\Library\ZenLib.vcxproj", "{0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\..\..\zlib\projects\MSVC2012\zlib.vcxproj", "{FD328AE2-5136-460F-A622-12CFD4D4C131}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RegressionTest", "RegressionTest\RegressionTest.vcxproj", "{91C094CA-1170-4CE4-9B79-17324C8DACA8}" ProjectSection(ProjectDependencies) = postProject {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94} = {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94} {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5} = {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5} EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 DebugA|Win32 = DebugA|Win32 DebugA|x64 = DebugA|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 ReleaseA|Win32 = ReleaseA|Win32 ReleaseA|x64 = ReleaseA|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Debug|Win32.ActiveCfg = Debug|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Debug|Win32.Build.0 = Debug|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Debug|x64.ActiveCfg = Debug|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Debug|x64.Build.0 = Debug|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.DebugA|Win32.ActiveCfg = DebugA|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.DebugA|Win32.Build.0 = DebugA|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.DebugA|x64.ActiveCfg = DebugA|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.DebugA|x64.Build.0 = DebugA|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Release|Win32.ActiveCfg = Release|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Release|Win32.Build.0 = Release|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Release|x64.ActiveCfg = Release|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Release|x64.Build.0 = Release|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.ReleaseA|Win32.ActiveCfg = ReleaseA|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.ReleaseA|Win32.Build.0 = ReleaseA|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.ReleaseA|x64.ActiveCfg = ReleaseA|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.ReleaseA|x64.Build.0 = ReleaseA|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Debug|Win32.ActiveCfg = Debug|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Debug|Win32.Build.0 = Debug|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Debug|x64.ActiveCfg = Debug|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Debug|x64.Build.0 = Debug|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.DebugA|Win32.ActiveCfg = DebugA|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.DebugA|Win32.Build.0 = DebugA|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.DebugA|x64.ActiveCfg = DebugA|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.DebugA|x64.Build.0 = DebugA|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|Win32.ActiveCfg = Release|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|Win32.Build.0 = Release|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|x64.ActiveCfg = Release|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|x64.Build.0 = Release|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.ReleaseA|Win32.ActiveCfg = ReleaseA|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.ReleaseA|Win32.Build.0 = ReleaseA|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.ReleaseA|x64.ActiveCfg = ReleaseA|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.ReleaseA|x64.Build.0 = ReleaseA|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Debug|Win32.ActiveCfg = Debug|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Debug|Win32.Build.0 = Debug|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Debug|x64.ActiveCfg = Debug|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Debug|x64.Build.0 = Debug|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.DebugA|Win32.ActiveCfg = Debug|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.DebugA|Win32.Build.0 = Debug|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.DebugA|x64.ActiveCfg = Debug|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.DebugA|x64.Build.0 = Debug|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Release|Win32.ActiveCfg = Release|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Release|Win32.Build.0 = Release|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Release|x64.ActiveCfg = Release|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Release|x64.Build.0 = Release|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.ReleaseA|Win32.ActiveCfg = Release|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.ReleaseA|Win32.Build.0 = Release|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.ReleaseA|x64.ActiveCfg = Release|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.ReleaseA|x64.Build.0 = Release|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Debug|Win32.ActiveCfg = Debug|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Debug|Win32.Build.0 = Debug|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Debug|x64.ActiveCfg = Debug|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Debug|x64.Build.0 = Debug|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.DebugA|Win32.ActiveCfg = DebugA|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.DebugA|Win32.Build.0 = DebugA|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.DebugA|x64.ActiveCfg = DebugA|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.DebugA|x64.Build.0 = DebugA|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Release|Win32.ActiveCfg = Release|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Release|Win32.Build.0 = Release|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Release|x64.ActiveCfg = Release|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Release|x64.Build.0 = Release|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.ReleaseA|Win32.ActiveCfg = ReleaseA|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.ReleaseA|Win32.Build.0 = ReleaseA|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.ReleaseA|x64.ActiveCfg = ReleaseA|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.ReleaseA|x64.Build.0 = ReleaseA|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Debug|Win32.ActiveCfg = Debug|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Debug|Win32.Build.0 = Debug|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Debug|x64.ActiveCfg = Debug|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Debug|x64.Build.0 = Debug|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.DebugA|Win32.ActiveCfg = DebugA|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.DebugA|Win32.Build.0 = DebugA|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.DebugA|x64.ActiveCfg = DebugA|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.DebugA|x64.Build.0 = DebugA|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|Win32.ActiveCfg = Release|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|Win32.Build.0 = Release|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|x64.ActiveCfg = Release|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|x64.Build.0 = Release|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.ReleaseA|Win32.ActiveCfg = ReleaseA|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.ReleaseA|Win32.Build.0 = ReleaseA|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.ReleaseA|x64.ActiveCfg = ReleaseA|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.ReleaseA|x64.Build.0 = ReleaseA|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Debug|Win32.ActiveCfg = Debug|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Debug|Win32.Build.0 = Debug|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Debug|x64.ActiveCfg = Debug|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Debug|x64.Build.0 = Debug|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.DebugA|Win32.ActiveCfg = Debug|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.DebugA|Win32.Build.0 = Debug|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.DebugA|x64.ActiveCfg = Debug|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.DebugA|x64.Build.0 = Debug|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|Win32.ActiveCfg = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|Win32.Build.0 = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|x64.ActiveCfg = Release|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|x64.Build.0 = Release|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.ReleaseA|Win32.ActiveCfg = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.ReleaseA|Win32.Build.0 = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.ReleaseA|x64.ActiveCfg = Release|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.ReleaseA|x64.Build.0 = Release|x64 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Debug|Win32.ActiveCfg = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Debug|Win32.Build.0 = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Debug|x64.ActiveCfg = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.DebugA|Win32.ActiveCfg = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.DebugA|Win32.Build.0 = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.DebugA|x64.ActiveCfg = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Release|Win32.ActiveCfg = Release|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Release|Win32.Build.0 = Release|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Release|x64.ActiveCfg = Release|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.ReleaseA|Win32.ActiveCfg = Release|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.ReleaseA|Win32.Build.0 = Release|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.ReleaseA|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94} = {F696A30D-66C6-46A8-B1BC-04B13BF14290} {FD328AE2-5136-460F-A622-12CFD4D4C131} = {F696A30D-66C6-46A8-B1BC-04B13BF14290} EndGlobalSection EndGlobal MediaInfoLib/Project/MSVC2012/RegressionTest/ 40777 0 0 0 12226004263 14017 5MediaInfoLib/Project/MSVC2012/RegressionTest/RegressionTest.vcxproj100777 0 0 24512 12226004263 20540 0 Debug ARM Debug Win32 Release ARM Release Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8} Win32Proj RegressionTest Application true Unicode v110_xp Application true Unicode v110 Application false true Unicode v110_xp Application false true Unicode v110 true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\..\Source;..\..\..\Source\ThirdParty\md5;..\..\..\..\ZenLib\Source MultiThreadedDebug Console true ..\..\..\..\ZenLib\Project\MSVC2012\Library\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) ZenLib.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\..\Source;..\..\..\Source\ThirdParty\md5;..\..\..\..\ZenLib\Source MultiThreadedDebug Console true ..\..\..\..\ZenLib\Project\MSVC2012\Library\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) ZenLib.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\..\Source;..\..\..\Source\ThirdParty\md5;..\..\..\..\ZenLib\Source MultiThreaded Console true true true ZenLib.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) ..\..\..\..\ZenLib\Project\MSVC2012\Library\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\..\Source;..\..\..\Source\ThirdParty\md5;..\..\..\..\ZenLib\Source MultiThreaded Console true true true ZenLib.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) ..\..\..\..\ZenLib\Project\MSVC2012\Library\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoLib/Project/MSVC2012/RegressionTest/RegressionTest.vcxproj.filters100777 0 0 4040 12226004263 22161 0 {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hpp;hxx;hm;inl;inc;xsd {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms {b9ec53c8-5440-44cd-8022-d26c4e912dfc} {00b1bc76-20f0-442d-8b27-2e2c02534226} Source Files Source Files Source Files Source Files ThirdParty\md5 Header Files ThirdParty\md5 MediaInfoLib/Project/MSVC2012/ShellExtension/ 40777 0 0 0 12264020632 14003 5MediaInfoLib/Project/MSVC2012/ShellExtension/MediaInfoShellExt.cpp100777 0 0 2731 12226004263 20116 0// MediaInfoShellExt.cpp : Implementation of DLL Exports. #include "stdafx.h" #include "resource.h" #include "MediaInfoShellExt.h" class CMediaInfoShellExtModule : public CAtlDllModuleT< CMediaInfoShellExtModule > { public : DECLARE_LIBID(LIBID_MediaInfoShellExtLib) DECLARE_REGISTRY_APPID_RESOURCEID(IDR_MEDIAINFOSHELLEXT, "{23D95783-1AF5-4C0F-84C1-EC49047EA2DC}") }; CMediaInfoShellExtModule _AtlModule; #ifdef _MANAGED #pragma managed(push, off) #endif // DLL Entry Point extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { hInstance; return _AtlModule.DllMain(dwReason, lpReserved); } #ifdef _MANAGED #pragma managed(pop) #endif // Used to determine whether the DLL can be unloaded by OLE STDAPI DllCanUnloadNow(void) { return _AtlModule.DllCanUnloadNow(); } // Returns a class factory to create an object of the requested type STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { return _AtlModule.DllGetClassObject(rclsid, riid, ppv); } // DllRegisterServer - Adds entries to the system registry STDAPI DllRegisterServer(void) { // registers object, typelib and all interfaces in typelib HRESULT hr = _AtlModule.DllRegisterServer(); return hr; } // DllUnregisterServer - Removes entries from the system registry STDAPI DllUnregisterServer(void) { HRESULT hr = _AtlModule.DllUnregisterServer(); return hr; } MediaInfoLib/Project/MSVC2012/ShellExtension/MediaInfoShellExt.def100777 0 0 362 12226004263 20050 0; MediaInfoShellExt.def : Declares the module parameters. LIBRARY "MediaInfo_InfoTip.dll" EXPORTS DllCanUnloadNow PRIVATE DllGetClassObject PRIVATE DllRegisterServer PRIVATE DllUnregisterServer PRIVATE MediaInfoLib/Project/MSVC2012/ShellExtension/MediaInfoShellExt.idl100777 0 0 1421 12226004263 20077 0// MediaInfoShellExt.idl : IDL source for MediaInfoShellExt // // This file will be processed by the MIDL tool to // produce the type library (MediaInfoShellExt.tlb) and marshalling code. import "oaidl.idl"; import "ocidl.idl"; [ object, uuid(6482FE39-D67B-49E5-BAA1-EBDDB318055D), helpstring("IMediaInfoShellExt_ Interface"), pointer_default(unique) ] interface IMediaInfoShellExt_ : IUnknown{ }; [ uuid(BC1AAA9F-D8C5-4EB2-A10A-61B86B7EA77C), version(1.0), helpstring("MediaInfoShellExt 1.0 Type Library") ] library MediaInfoShellExtLib { importlib("stdole2.tlb"); [ uuid(869C14C8-1830-491F-B575-5F9AB40D2B42), helpstring("MediaInfoShellExt_ Class") ] coclass MediaInfoShellExt_ { [default] interface IMediaInfoShellExt_; }; }; MediaInfoLib/Project/MSVC2012/ShellExtension/MediaInfoShellExt.rc100777 0 0 1563 12264020304 17736 0#include VS_VERSION_INFO VERSIONINFO FILEVERSION 0,7,67,0 PRODUCTVERSION 0,7,67,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x4L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904e4" BEGIN VALUE "CompanyName", "http://MediaArea.net/MediaInfo" VALUE "FileDescription", "MediaInfo Shell ToolTip" VALUE "FileVersion", "0,7,67,0" VALUE "InternalName", "MediaInfo_ToolTip.dll" VALUE "LegalCopyright", "BSD-2-Clause" VALUE "OriginalFilename", "MediaInfo_ToolTip.dll" VALUE "ProductName", "MediaInfo" VALUE "ProductVersion", "0,7,67,0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1252 END END MediaInfoLib/Project/MSVC2012/ShellExtension/MediaInfoShellExt.vcxproj100777 0 0 56607 12226004263 21062 0 Debug ARM Debug Win32 Debug x64 Release ARM Release Win32 Release x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A} MediaInfoShellExt AtlProj DynamicLibrary Static Unicode true v110_xp DynamicLibrary Static Unicode true v110_xp DynamicLibrary Static Unicode v110_xp DynamicLibrary Static Unicode v110_xp DynamicLibrary Static Unicode true v110_xp DynamicLibrary Static Unicode v110_xp <_ProjectFileVersion>10.0.30128.1 $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ true true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ false false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ false MediaInfo_InfoTip MediaInfo_InfoTip MediaInfo_InfoTip MediaInfo_InfoTip MediaInfo_InfoTip MediaInfo_InfoTip _DEBUG;%(PreprocessorDefinitions) false Win32 true $(IntDir)MediaInfoShellExt.tlb MediaInfoShellExt.h MediaInfoShellExt_i.c MediaInfoShellExt_p.c false Disabled ..\..\..\..\MediaInfoLib\Source;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Use Level3 true _DEBUG;%(PreprocessorDefinitions) 0x0409 $(IntDir);%(AdditionalIncludeDirectories) MediaInfo.lib;%(AdditionalDependencies) $(OutDir)MediaInfo_InfoTip.dll ../../../../MediaInfoLib/Project/MSVC2012/DLL\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoShellExt.def true Windows MachineX86 _DEBUG;%(PreprocessorDefinitions) false true $(IntDir)MediaInfoShellExt.tlb MediaInfoShellExt.h MediaInfoShellExt_i.c MediaInfoShellExt_p.c false Disabled ..\..\..\..\MediaInfoLib\Source;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Use Level3 true _DEBUG;%(PreprocessorDefinitions) 0x0409 $(IntDir);%(AdditionalIncludeDirectories) MediaInfo.lib;%(AdditionalDependencies) $(OutDir)MediaInfo_InfoTip.dll ../../../../MediaInfoLib/Project/MSVC2012/DLL\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoShellExt.def true Windows _DEBUG;%(PreprocessorDefinitions) false X64 true $(IntDir)MediaInfoShellExt.tlb MediaInfoShellExt.h MediaInfoShellExt_i.c MediaInfoShellExt_p.c Disabled ..\..\..\..\MediaInfoLib\Source;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Use Level3 ProgramDatabase true _DEBUG;%(PreprocessorDefinitions) 0x0409 $(IntDir);%(AdditionalIncludeDirectories) MediaInfo.lib;%(AdditionalDependencies) $(OutDir)MediaInfo_InfoTip.dll ../../../../MediaInfoLib/Project/MSVC2012/DLL\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoShellExt.def true Windows MachineX64 NDEBUG;%(PreprocessorDefinitions) false Win32 true $(IntDir)MediaInfoShellExt.tlb MediaInfoShellExt.h MediaInfoShellExt_i.c MediaInfoShellExt_p.c false MaxSpeed ..\..\..\..\MediaInfoLib\Source;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) MultiThreaded Use Level3 true NDEBUG;%(PreprocessorDefinitions) 0x0409 $(IntDir);%(AdditionalIncludeDirectories) MediaInfo.lib;%(AdditionalDependencies) $(OutDir)MediaInfo_InfoTip.dll ../../../../MediaInfoLib/Project/MSVC2012/DLL\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoShellExt.def Windows MachineX86 true true true NDEBUG;%(PreprocessorDefinitions) false true $(IntDir)MediaInfoShellExt.tlb MediaInfoShellExt.h MediaInfoShellExt_i.c MediaInfoShellExt_p.c false MaxSpeed ..\..\..\..\MediaInfoLib\Source;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) MultiThreaded Use Level3 true NDEBUG;%(PreprocessorDefinitions) 0x0409 $(IntDir);%(AdditionalIncludeDirectories) MediaInfo.lib;%(AdditionalDependencies) $(OutDir)MediaInfo_InfoTip.dll ../../../../MediaInfoLib/Project/MSVC2012/DLL\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoShellExt.def Windows true true true NDEBUG;%(PreprocessorDefinitions) false X64 true $(IntDir)MediaInfoShellExt.tlb MediaInfoShellExt.h MediaInfoShellExt_i.c MediaInfoShellExt_p.c MaxSpeed ..\..\..\..\MediaInfoLib\Source;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) MultiThreaded Use Level3 true NDEBUG;%(PreprocessorDefinitions) 0x0409 $(IntDir);%(AdditionalIncludeDirectories) MediaInfo.lib;%(AdditionalDependencies) $(OutDir)MediaInfo_InfoTip.dll ../../../../MediaInfoLib/Project/MSVC2012/DLL\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoShellExt.def Windows MachineX64 true true true Create Create Create Create Create Create {be6d3ef8-2f82-4f1e-956a-890c3614a2d5} MediaInfoLib/Project/MSVC2012/ShellExtension/MediaInfoShellExt.vcxproj.filters100777 0 0 4640 12226004263 22477 0 {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hpp;hxx;hm;inl;inc;xsd {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav {5019c97c-ba9f-4a00-8e93-f0b5b31aa6d8} False Source Files Source Files Source Files Generated Files Source Files Resource Files Resource Files Source Files Header Files Header Files Header Files Generated Files Resource Files MediaInfoLib/Project/MSVC2012/ShellExtension/MediaInfoShellExt_.cpp100777 0 0 3731 12226004263 20256 0// MediaInfoShellExt_.cpp : Implementation of CMediaInfoShellExt_ #include "stdafx.h" #include "MediaInfoShellExt_.h" #include // CMediaInfoShellExt_ HRESULT CMediaInfoShellExt_::Load (LPCOLESTR wszFilename, DWORD) { //Save FileName FileName = wszFilename; //OK return S_OK; } HRESULT CMediaInfoShellExt_::GetInfoTip (DWORD, LPWSTR* ppwszTip) { LPMALLOC Malloc; std::wstring ToolTip; //Get an IMalloc interface from the shell. if (FAILED(SHGetMalloc(&Malloc))) return E_FAIL; //Creating tooltip ToolTip=_T("MediaInfo:\n"); MediaInfoDLL::MediaInfo I; I.Option(_T("Inform"), _T("Summary")); I.Open(FileName); for (size_t StreamKind=0; StreamKind<(size_t)MediaInfoDLL::Stream_Max; StreamKind++) for (size_t StreamPos=0; StreamPos0) { ToolTip+=I.Get((MediaInfoDLL::stream_t)StreamKind, StreamPos, _T("StreamKind")); ToolTip+=_T(": "); } ToolTip+=I.Get((MediaInfoDLL::stream_t)StreamKind, StreamPos, _T("Inform")); ToolTip+=_T("\r\n"); } if (ToolTip.size()>2) ToolTip.resize(ToolTip.size()-2); //Removing the ending \r\n //Allocate a buffer for Explorer. Note that the must pass the string //back as a Unicode string, so the string length is multiplied by the //size of a Unicode character. *ppwszTip=(LPWSTR)Malloc->Alloc((ToolTip.size()+1)*sizeof(wchar_t)); //Release the IMalloc interface now that we're done using it. Malloc->Release(); //Enough memory? if (*ppwszTip==NULL) return E_OUTOFMEMORY; //Use the Unicode string copy function to put the tooltip text in the buffer. wcscpy_s(*ppwszTip, ToolTip.size()+1, T2COLE(ToolTip.c_str())); //OK return S_OK; }MediaInfoLib/Project/MSVC2012/ShellExtension/stdafx.cpp100777 0 0 325 12226004263 16060 0// stdafx.cpp : source file that includes just the standard includes // MediaInfoShellExt.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" MediaInfoLib/Project/MSVC2013/ 40777 0 0 0 12247354727 11060 5MediaInfoLib/Project/MSVC2013/Dll/ 40777 0 0 0 12264020632 11553 5MediaInfoLib/Project/MSVC2013/Dll/MediaInfo.rc100777 0 0 1661 12264020304 14034 0#include VS_VERSION_INFO VERSIONINFO FILEVERSION 0,7,67,0 PRODUCTVERSION 0,7,67,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x40004L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "MediaArea.net" VALUE "FileDescription", "Convenient unified display of the most relevant technical and tag data for video and audio files" VALUE "FileVersion", "0.7.67.0" VALUE "InternalName", "MediaInfoLib - DLL - MSVC 2010" VALUE "LegalCopyright", "MediaArea.net" VALUE "OriginalFilename", "MediaInfo.dll" VALUE "ProductName", "MediaInfo" VALUE "ProductVersion", "0.7.67.0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END MediaInfoLib/Project/MSVC2013/Dll/MediaInfoDll.vcxproj100777 0 0 67103 12226004263 15606 0 DebugA ARM DebugA Win32 DebugA x64 Debug ARM Debug Win32 Debug x64 ReleaseA ARM ReleaseA Win32 ReleaseA x64 Release ARM Release Win32 Release x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5} MediaInfoDll Win32Proj DynamicLibrary MultiByte true v120_xp DynamicLibrary MultiByte true v120 true DynamicLibrary MultiByte true v120_xp DynamicLibrary MultiByte true v120 true DynamicLibrary Unicode true v120_xp DynamicLibrary Unicode true v120 true DynamicLibrary Unicode true v120_xp DynamicLibrary Unicode true v120 true DynamicLibrary MultiByte true v120_xp DynamicLibrary MultiByte true v120_xp DynamicLibrary true Unicode v120_xp DynamicLibrary Unicode true v120_xp <_ProjectFileVersion>10.0.30128.1 $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 true 4100;4996;4127;%(DisableSpecificWarnings) Disabled true Windows MachineX86 ../../../Source/MediaInfoDLL/MediaInfoDLL.def Disabled ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL Level4 true 4100;4996;4127;%(DisableSpecificWarnings) NotUsing true Windows ../../../Source/MediaInfoDLL/MediaInfoDLL.def Disabled ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 4100;4996;4127;%(DisableSpecificWarnings) true true Windows MachineX64 ../../../Source/MediaInfoDLL/MediaInfoDLL.def MaxSpeed ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) MultiThreaded Level4 4100;4996;4127;%(DisableSpecificWarnings) true true true Windows MachineX86 true true true ../../../Source/MediaInfoDLL/MediaInfoDLL.def MaxSpeed ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) MultiThreadedDLL Level4 4100;4996;4127;%(DisableSpecificWarnings) true true true NotUsing Windows true true true ../../../Source/MediaInfoDLL/MediaInfoDLL.def MaxSpeed ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) MultiThreaded Level4 4100;4996;4127;%(DisableSpecificWarnings) true true Windows MachineX64 true true true ../../../Source/MediaInfoDLL/MediaInfoDLL.def Disabled ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 4100;4996;4127;%(DisableSpecificWarnings) true true Windows MachineX86 ../../../Source/MediaInfoDLL/MediaInfoDLL.def Disabled ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 4100;4996;4127;%(DisableSpecificWarnings) true NotUsing true Windows ../../../Source/MediaInfoDLL/MediaInfoDLL.def Level4 4100;4996;4127;%(DisableSpecificWarnings) true ../../../Source/MediaInfoDLL/MediaInfoDLL.def MaxSpeed ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) MultiThreaded Level4 4100;4996;4127;%(DisableSpecificWarnings) true true true Windows MachineX86 true true true ../../../Source/MediaInfoDLL/MediaInfoDLL.def MaxSpeed ../../../Source;../../../../ZenLib/Source;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;MEDIAINFODLL_EXPORTS_NODLLEXPORT;%(PreprocessorDefinitions) MultiThreaded Level4 4100;4996;4127;%(DisableSpecificWarnings) true true true NotUsing Windows true true true ../../../Source/MediaInfoDLL/MediaInfoDLL.def Level4 4100;4996;4127;%(DisableSpecificWarnings) true true true true true ../../../Source/MediaInfoDLL/MediaInfoDLL.def {0da1da7d-f393-4e7c-a7ce-cb5c6a67bc94} {fd328ae2-5136-460f-a622-12cfd4d4c131} {20e0f8d6-213c-460b-b361-9c725cb375c7} MediaInfoLib/Project/MSVC2013/Dll/MediaInfoDll.vcxproj.filters100777 0 0 2062 12226004263 17226 0 {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav Source Files Resource Files Source Files MediaInfoLib/Project/MSVC2013/Example/ 40777 0 0 0 12226004263 12433 5MediaInfoLib/Project/MSVC2013/Example/HowToUse.rc100777 0 0 5124 12264020304 14574 0//Microsoft Developer Studio generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // French (France) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) #ifdef _WIN32 LANGUAGE LANG_FRENCH, SUBLANG_FRENCH #pragma code_page(1252) #endif //_WIN32 #ifndef _MAC ///////////////////////////////////////////////////////////////////////////// // // Version // VS_VERSION_INFO VERSIONINFO FILEVERSION 0,4,0,0 PRODUCTVERSION 0,4,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x40004L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040c04b0" BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "http://MediaArea.net/MediaInfo\0" VALUE "FileDescription", "Read info about media files (command line)\0" VALUE "FileVersion", "0,7,67,0\0" VALUE "InternalName", "MediaInfo - Cmd - Win32 - Microsoft\0" VALUE "LegalCopyright", "BSD-2-Clause\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "MediaInfo.exe\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "MediaInfo (Cmd)\0" VALUE "ProductVersion", "0,7,67,0\0" VALUE "SpecialBuild", "\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x40c, 1200 END END #endif // !_MAC #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE DISCARDABLE BEGIN "resource.h\0" END 2 TEXTINCLUDE DISCARDABLE BEGIN "#include ""afxres.h""\r\n" "\0" END 3 TEXTINCLUDE DISCARDABLE BEGIN "\r\n" "\0" END #endif // APSTUDIO_INVOKED #endif // French (France) resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED MediaInfoLib/Project/MSVC2013/Example/HowToUse_Dll.vcxproj100777 0 0 64260 12226004263 16510 0 DebugA ARM DebugA Win32 DebugA x64 Debug ARM Debug Win32 Debug x64 ReleaseA ARM ReleaseA Win32 ReleaseA x64 Release ARM Release Win32 Release x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF} HowToUse_Dll Win32Proj Application MultiByte true v120 Application MultiByte true v120 Application MultiByte v120 Application MultiByte v120 Application Unicode true v120 Application Unicode true v120 Application Unicode v120 Application Unicode v120 Application MultiByte v120 Application MultiByte v120 Application Unicode true v120 Application Unicode v120 <_ProjectFileVersion>10.0.30128.1 $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ true true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ false false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ Disabled ../../../Source;../../../../ZenLib/Source;../../../../ZLib;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level4 MediaInfo.lib;ZenLib.lib;zlib.lib;%(AdditionalDependencies) ..\..\..\..\MediaInfoLib\Project\MSVC2013\Library\$(Platform)\$(Configuration);..\..\..\..\ZenLib\Project\MSVC2013\Library\$(Platform)\$(Configuration);..\..\..\..\zlib\projects\MSVC2013\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) true Console false MachineX86 Disabled ../../../Source;../../../../ZenLib/Source;../../../../ZLib;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level4 MediaInfo.lib;ZenLib.lib;zlib.lib;%(AdditionalDependencies) ..\..\..\..\MediaInfoLib\Project\MSVC2013\Library\$(Platform)\$(Configuration);..\..\..\..\ZenLib\Project\MSVC2013\Library\$(Platform)\$(Configuration);..\..\..\..\zlib\projects\MSVC2013\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) true Console false X64 Disabled ..\..\..\Source;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level4 ProgramDatabase %(AdditionalLibraryDirectories) true Console false MachineX64 ../../../Source;../../../../ZenLib/Source;../../../../ZLib;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level4 MediaInfo.lib;ZenLib.lib;zlib.lib;%(AdditionalDependencies) ..\..\..\..\MediaInfoLib\Project\MSVC2013\Library\$(Platform)\$(Configuration);..\..\..\..\ZenLib\Project\MSVC2013\Library\$(Platform)\$(Configuration);..\..\..\..\zlib\projects\MSVC2013\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) true Console true true false MachineX86 ../../../Source;../../../../ZenLib/Source;../../../../ZLib;../../../../Shared/Include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level4 MediaInfo.lib;ZenLib.lib;zlib.lib;%(AdditionalDependencies) ..\..\..\..\MediaInfoLib\Project\MSVC2013\Library\$(Platform)\$(Configuration);..\..\..\..\ZenLib\Project\MSVC2013\Library\$(Platform)\$(Configuration);..\..\..\..\zlib\projects\MSVC2013\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) true Console true true false X64 ..\..\..\Source;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level4 %(AdditionalLibraryDirectories) true Console true true false MachineX64 Disabled ..\..\..\Source;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level4 %(AdditionalLibraryDirectories) true Console false MachineX86 Disabled ..\..\..\Source;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug Level4 %(AdditionalLibraryDirectories) true Console false ..\..\..\Source;%(AdditionalIncludeDirectories) Level4 ..\..\..\Source;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level4 %(AdditionalLibraryDirectories) true Console true true false MachineX86 ..\..\..\Source;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded Level4 %(AdditionalLibraryDirectories) true Console true true false ..\..\..\Source;%(AdditionalIncludeDirectories) Level4 {be6d3ef8-2f82-4f1e-956a-890c3614a2d5} MediaInfoLib/Project/MSVC2013/Example/HowToUse_Dll.vcxproj.filters100777 0 0 2400 12226004263 20123 0 {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hpp;hxx;hm;inl;inc;xsd {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav Source Files Header Files Resource Files MediaInfoLib/Project/MSVC2013/Library/ 40777 0 0 0 12264020632 12444 5MediaInfoLib/Project/MSVC2013/Library/MediaInfoLib.vcxproj100777 0 0 167070 12262557452 16533 0 DebugA ARM DebugA Win32 DebugA x64 Debug ARM Debug Win32 Debug x64 ReleaseA ARM ReleaseA Win32 ReleaseA x64 Release ARM Release Win32 Release x64 {20E0F8D6-213C-460B-B361-9C725CB375C7} MediaInfoLib Win32Proj StaticLibrary MultiByte true v120_xp StaticLibrary MultiByte true v120 true StaticLibrary MultiByte v120_xp true StaticLibrary MultiByte v120 true true StaticLibrary Unicode true v120_xp StaticLibrary Unicode true v120 true StaticLibrary Unicode v120_xp true StaticLibrary Unicode v120 true true StaticLibrary MultiByte v120_xp true StaticLibrary MultiByte v120_xp true StaticLibrary Unicode true v120_xp StaticLibrary Unicode v120_xp true <_ProjectFileVersion>10.0.30128.1 $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo MediaInfo ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/md5;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;MEDIAINFO_LIBCURL_DLL_RUNTIME;%(PreprocessorDefinitions) MultiThreadedDebug Use MediaInfo/PreComp.h 4100;4996;4127;%(DisableSpecificWarnings) true Level4 Disabled EnableFastChecks MachineX86 Disabled ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/md5;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;MEDIAINFO_TRACE_NO;MEDIAINFO_EVENTS_NO;MEDIAINFO_DEMUX_NO;MEDIAINFO_DVDIF_ANALYZE_NO;MEDIAINFO_MPEGTS_DUPLICATE_NO;MEDIAINFO_NEXTPACKET_NO;MEDIAINFO_SEEK_NO;MEDIAINFO_IBI_NO;MEDIAINFO_LIBCURL_NO;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL Level4 true Use MediaInfo/PreComp.h 4100;4996;4127;%(DisableSpecificWarnings) MachineX86 Disabled ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/md5;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;MEDIAINFO_LIBCURL_DLL_RUNTIME;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 4100;4996;4127;%(DisableSpecificWarnings) true NotUsing MediaInfo/PreComp.h MachineX64 MaxSpeed ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/md5;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) MultiThreaded Level4 4100;4996;4127;%(DisableSpecificWarnings) WIN32;NDEBUG;MEDIAINFO_DVDIF_ANALYZE_NO;MEDIAINFO_MPEGTS_DUPLICATE_NO;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBMMS_NO;MEDIAINFO_LIBCURL_DLL_RUNTIME;%(PreprocessorDefinitions) true Use MediaInfo/PreComp.h true true MachineX86 MaxSpeed ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/md5;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) MultiThreadedDLL Level4 4100;4996;4127;%(DisableSpecificWarnings) WIN32;NDEBUG;MEDIAINFO_DVDIF_ANALYZE_NO;MEDIAINFO_MPEGTS_DUPLICATE_NO;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBMMS_NO;MEDIAINFO_LIBCURL_DLL_RUNTIME;%(PreprocessorDefinitions) true Use MediaInfo/PreComp.h true true MachineX86 MaxSpeed ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/md5;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;MEDIAINFO_TRACE_NO;MEDIAINFO_EVENTS_NO;MEDIAINFO_DEMUX_NO;MEDIAINFO_DVDIF_ANALYZE_NO;MEDIAINFO_MPEGTS_DUPLICATE_NO;MEDIAINFO_SEEK_NO;MEDIAINFO_NEXTPACKET_NO;MEDIAINFO_IBI_NO;MEDIAINFO_LIBCURL_NO;%(PreprocessorDefinitions) MultiThreaded Level4 4100;4996;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h true MachineX64 Disabled ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 4100;4996;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h MachineX86 Disabled ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Level4 4100;4996;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h MachineX86 ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) EnableFastChecks MultiThreadedDebug Level4 4100;4996;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h MachineX64 MaxSpeed ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;%(PreprocessorDefinitions) MultiThreaded Level4 4100;4996;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h MachineX86 MaxSpeed ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;%(PreprocessorDefinitions) MultiThreaded Level4 4100;4996;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h MachineX86 ../../../Source;../../../Source/ThirdParty/tinyxml2;../../../Source/ThirdParty/base64;../../../../ZenLib/Source;../../../../ZLib;../../../../curl/include;%(AdditionalIncludeDirectories) Level4 4100;4996;4127;%(DisableSpecificWarnings) true Use MediaInfo/PreComp.h MachineX64 Create Create Create Create Create Create Create Create Create Create Create Create NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing {0da1da7d-f393-4e7c-a7ce-cb5c6a67bc94} {fd328ae2-5136-460f-a622-12cfd4d4c131} MediaInfoLib/Project/MSVC2013/Library/MediaInfoLib.vcxproj.filters100777 0 0 155476 12262557452 20211 0 {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {7a80fb2f-b1ab-4770-9008-7a2d4354bf17} {5b13d788-3ee4-45c9-bac6-52e4fcb49f06} {abddeafa-33d8-436c-b544-750dc7f7f932} {fe2f49e2-0bed-483e-9bbb-c4bc1e976e48} {588d0697-71cc-46a5-9bee-f0bb0708248a} {1a0a67f3-eff5-417d-94ef-5e10caee3c65} {47ccee67-c3e8-4ffd-acab-5d24ebe10546} {92f6ca9c-48e5-4681-aa2f-5bd7f9cc10b9} {9098012c-2ad7-4ebf-92ca-a78d407b7de1} {1c2205df-56a3-4a07-a68b-b922dcba6084} {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hpp;hxx;hm;inl;inc;xsd {469cd7fc-f6f2-4efd-b08d-9eee8157dd20} {b7140023-7da5-4439-a1a9-ac94a9fc9304} {30ee90d4-f895-4ef7-9ae2-6d532cec3a15} {bd3c2998-c17d-4257-95c6-adbadd72d9d7} {e530ab7e-a487-4e27-ad47-cc5d6f158b10} {aa0465f8-0c4a-4ae3-a92f-cd80297f2425} {76067c52-36bc-4cdf-bfa8-90fa8c73c647} {32f57e20-4c64-4c0b-9462-0078eb7c73d9} {5a642ccf-f167-403a-bd61-461f392f0244} {fb691036-49d1-42d5-a991-92e4e43a27ec} {5dc08159-7486-493c-b920-e170f1b36077} {d307708b-372c-475a-98e6-a76965d555ac} {5b70a9dd-eddc-44ba-bce4-35d86e77acdb} {c54702a2-93da-4abd-8766-43f9f80731c2} Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Archive Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Video Source Files\Image Source Files\Image Source Files\Image Source Files\Image Source Files\Image Source Files\Image Source Files\Image Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Text Source Files\Tag Source Files\Tag Source Files\Tag Source Files\Tag Source Files\Tag Source Files\Tag Source Files\Tag Source Files\Duplicate Source Files\Duplicate Source Files\Duplicate Source Files\Reader Source Files\Reader Source Files\Reader Source Files\Reader Source Files\Export Source Files\Export Source Files\Video Source Files\Text Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Video Source Files\Video Source Files\Multiple Source Files\Multiple Source Files\Audio Source Files\Image Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Video Source Files\Audio Source Files\Audio Source Files\Archive Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Image Source Files\Video Source Files\Image Source Files\Multiple Source Files\Text Source Files\Text Source Files\Text Source Files\Multiple Source Files Source Files Source Files\Audio Source Files\Multiple Source Files\Export Source Files\Video Source Files\Video Source Files\Multiple ThirdParty\tinyxml2 Source Files\Audio Source Files\Video Source Files\Image Source Files\Image Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Audio Source Files\Text Source Files\Video ThirdParty\md5 Source Files\Text Source Files\Text Source Files\Text Source Files\Video Source Files\Multiple Source Files\Video Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Multiple Source Files\Export Source Files\Multiple Source Files\Multiple Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Archive Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Image Header Files\Image Header Files\Image Header Files\Image Header Files\Image Header Files\Image Header Files\Image Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Video Header Files\Video Header Files\Video Header Files\Video Header Files\Video Header Files\Video Header Files\Video Header Files\Video Header Files\Text Header Files\Text Header Files\Text Header Files\Text Header Files\Text Header Files\Text Header Files\Text Header Files\Text Header Files\Tag Header Files\Tag Header Files\Tag Header Files\Tag Header Files\Tag Header Files\Tag Header Files\Tag Header Files\Duplicate Header Files\Duplicate Header Files\Duplicate Header Files\Reader Header Files\Reader Header Files\Reader Header Files\Reader Header Files\Export Header Files\Export Header Files Header Files\Video Header Files\Text Header Files Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Video Header Files\Video Header Files\Multiple Header Files\Multiple Header Files\Audio Header Files\Image Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Video Header Files\Audio Header Files\Text Header Files\Reader Header Files\Video Header Files\Archive Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Image Header Files\Video Header Files\Image Header Files\Multiple Header Files\Text Header Files\Text Header Files\Text Header Files\Multiple Header Files Header Files\Reader Header Files\Audio Header Files\Multiple Header Files\Export ThirdParty\base64 Header Files\Video Header Files\Video Header Files\Multiple Header Files\Multiple ThirdParty\tinyxml2 Header Files\Audio Header Files\Video Header Files\Image Header Files\Image Header Files Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Audio Header Files\Text Header Files\Video ThirdParty\md5 Header Files\Text Header Files\Text Header Files\Text Header Files\Video Header Files\Multiple Header Files\Video Header Files Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Multiple Header Files\Export Header Files\Multiple Header Files\Multiple MediaInfoLib/Project/MSVC2013/MediaInfoLib.sln100777 0 0 25127 12226004263 14167 0Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 VisualStudioVersion = 12.0.20827.3 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ThirdParty", "ThirdParty", "{F696A30D-66C6-46A8-B1BC-04B13BF14290}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MediaInfoDll", "Dll\MediaInfoDll.vcxproj", "{BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MediaInfoLib", "Library\MediaInfoLib.vcxproj", "{20E0F8D6-213C-460B-B361-9C725CB375C7}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MediaInfoShellExt", "ShellExtension\MediaInfoShellExt.vcxproj", "{E987FD96-6BE1-45AF-9293-46B8A6695E6A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HowToUse_Dll", "Example\HowToUse_Dll.vcxproj", "{51E7EE1D-D4DD-4374-976C-66519B3B94DF}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZenLib", "..\..\..\ZenLib\Project\MSVC2013\Library\ZenLib.vcxproj", "{0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\..\..\zlib\projects\MSVC2013\zlib.vcxproj", "{FD328AE2-5136-460F-A622-12CFD4D4C131}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RegressionTest", "RegressionTest\RegressionTest.vcxproj", "{91C094CA-1170-4CE4-9B79-17324C8DACA8}" ProjectSection(ProjectDependencies) = postProject {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94} = {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94} {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5} = {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5} EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 DebugA|Win32 = DebugA|Win32 DebugA|x64 = DebugA|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 ReleaseA|Win32 = ReleaseA|Win32 ReleaseA|x64 = ReleaseA|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Debug|Win32.ActiveCfg = Debug|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Debug|Win32.Build.0 = Debug|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Debug|x64.ActiveCfg = Debug|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Debug|x64.Build.0 = Debug|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.DebugA|Win32.ActiveCfg = DebugA|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.DebugA|Win32.Build.0 = DebugA|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.DebugA|x64.ActiveCfg = DebugA|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.DebugA|x64.Build.0 = DebugA|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Release|Win32.ActiveCfg = Release|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Release|Win32.Build.0 = Release|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Release|x64.ActiveCfg = Release|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.Release|x64.Build.0 = Release|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.ReleaseA|Win32.ActiveCfg = ReleaseA|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.ReleaseA|Win32.Build.0 = ReleaseA|Win32 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.ReleaseA|x64.ActiveCfg = ReleaseA|x64 {BE6D3EF8-2F82-4F1E-956A-890C3614A2D5}.ReleaseA|x64.Build.0 = ReleaseA|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Debug|Win32.ActiveCfg = Debug|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Debug|Win32.Build.0 = Debug|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Debug|x64.ActiveCfg = Debug|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Debug|x64.Build.0 = Debug|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.DebugA|Win32.ActiveCfg = DebugA|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.DebugA|Win32.Build.0 = DebugA|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.DebugA|x64.ActiveCfg = DebugA|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.DebugA|x64.Build.0 = DebugA|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|Win32.ActiveCfg = Release|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|Win32.Build.0 = Release|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|x64.ActiveCfg = Release|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.Release|x64.Build.0 = Release|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.ReleaseA|Win32.ActiveCfg = ReleaseA|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.ReleaseA|Win32.Build.0 = ReleaseA|Win32 {20E0F8D6-213C-460B-B361-9C725CB375C7}.ReleaseA|x64.ActiveCfg = ReleaseA|x64 {20E0F8D6-213C-460B-B361-9C725CB375C7}.ReleaseA|x64.Build.0 = ReleaseA|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Debug|Win32.ActiveCfg = Debug|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Debug|Win32.Build.0 = Debug|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Debug|x64.ActiveCfg = Debug|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Debug|x64.Build.0 = Debug|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.DebugA|Win32.ActiveCfg = Debug|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.DebugA|Win32.Build.0 = Debug|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.DebugA|x64.ActiveCfg = Debug|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.DebugA|x64.Build.0 = Debug|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Release|Win32.ActiveCfg = Release|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Release|Win32.Build.0 = Release|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Release|x64.ActiveCfg = Release|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.Release|x64.Build.0 = Release|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.ReleaseA|Win32.ActiveCfg = Release|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.ReleaseA|Win32.Build.0 = Release|Win32 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.ReleaseA|x64.ActiveCfg = Release|x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A}.ReleaseA|x64.Build.0 = Release|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Debug|Win32.ActiveCfg = Debug|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Debug|Win32.Build.0 = Debug|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Debug|x64.ActiveCfg = Debug|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Debug|x64.Build.0 = Debug|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.DebugA|Win32.ActiveCfg = DebugA|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.DebugA|Win32.Build.0 = DebugA|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.DebugA|x64.ActiveCfg = DebugA|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.DebugA|x64.Build.0 = DebugA|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Release|Win32.ActiveCfg = Release|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Release|Win32.Build.0 = Release|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Release|x64.ActiveCfg = Release|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.Release|x64.Build.0 = Release|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.ReleaseA|Win32.ActiveCfg = ReleaseA|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.ReleaseA|Win32.Build.0 = ReleaseA|Win32 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.ReleaseA|x64.ActiveCfg = ReleaseA|x64 {51E7EE1D-D4DD-4374-976C-66519B3B94DF}.ReleaseA|x64.Build.0 = ReleaseA|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Debug|Win32.ActiveCfg = Debug|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Debug|Win32.Build.0 = Debug|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Debug|x64.ActiveCfg = Debug|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Debug|x64.Build.0 = Debug|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.DebugA|Win32.ActiveCfg = DebugA|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.DebugA|Win32.Build.0 = DebugA|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.DebugA|x64.ActiveCfg = DebugA|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.DebugA|x64.Build.0 = DebugA|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|Win32.ActiveCfg = Release|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|Win32.Build.0 = Release|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|x64.ActiveCfg = Release|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.Release|x64.Build.0 = Release|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.ReleaseA|Win32.ActiveCfg = ReleaseA|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.ReleaseA|Win32.Build.0 = ReleaseA|Win32 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.ReleaseA|x64.ActiveCfg = ReleaseA|x64 {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94}.ReleaseA|x64.Build.0 = ReleaseA|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Debug|Win32.ActiveCfg = Debug|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Debug|Win32.Build.0 = Debug|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Debug|x64.ActiveCfg = Debug|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Debug|x64.Build.0 = Debug|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.DebugA|Win32.ActiveCfg = Debug|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.DebugA|Win32.Build.0 = Debug|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.DebugA|x64.ActiveCfg = Debug|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.DebugA|x64.Build.0 = Debug|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|Win32.ActiveCfg = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|Win32.Build.0 = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|x64.ActiveCfg = Release|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.Release|x64.Build.0 = Release|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.ReleaseA|Win32.ActiveCfg = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.ReleaseA|Win32.Build.0 = Release|Win32 {FD328AE2-5136-460F-A622-12CFD4D4C131}.ReleaseA|x64.ActiveCfg = Release|x64 {FD328AE2-5136-460F-A622-12CFD4D4C131}.ReleaseA|x64.Build.0 = Release|x64 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Debug|Win32.ActiveCfg = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Debug|Win32.Build.0 = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Debug|x64.ActiveCfg = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.DebugA|Win32.ActiveCfg = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.DebugA|Win32.Build.0 = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.DebugA|x64.ActiveCfg = Debug|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Release|Win32.ActiveCfg = Release|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Release|Win32.Build.0 = Release|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.Release|x64.ActiveCfg = Release|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.ReleaseA|Win32.ActiveCfg = Release|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.ReleaseA|Win32.Build.0 = Release|Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8}.ReleaseA|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {0DA1DA7D-F393-4E7C-A7CE-CB5C6A67BC94} = {F696A30D-66C6-46A8-B1BC-04B13BF14290} {FD328AE2-5136-460F-A622-12CFD4D4C131} = {F696A30D-66C6-46A8-B1BC-04B13BF14290} EndGlobalSection EndGlobal MediaInfoLib/Project/MSVC2013/RegressionTest/ 40777 0 0 0 12226004263 14020 5MediaInfoLib/Project/MSVC2013/RegressionTest/RegressionTest.vcxproj100777 0 0 24505 12226004263 20543 0 Debug ARM Debug Win32 Release ARM Release Win32 {91C094CA-1170-4CE4-9B79-17324C8DACA8} Win32Proj RegressionTest Application true Unicode v120 Application true Unicode v120 Application false true Unicode v120 Application false true Unicode v120 true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\..\Source;..\..\..\Source\ThirdParty\md5;..\..\..\..\ZenLib\Source MultiThreadedDebug Console true ..\..\..\..\ZenLib\Project\MSVC2013\Library\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) ZenLib.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) Level3 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\..\Source;..\..\..\Source\ThirdParty\md5;..\..\..\..\ZenLib\Source MultiThreadedDebug Console true ..\..\..\..\ZenLib\Project\MSVC2013\Library\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) ZenLib.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\..\Source;..\..\..\Source\ThirdParty\md5;..\..\..\..\ZenLib\Source MultiThreaded Console true true true ZenLib.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) ..\..\..\..\ZenLib\Project\MSVC2013\Library\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ..\..\..\Source;..\..\..\Source\ThirdParty\md5;..\..\..\..\ZenLib\Source MultiThreaded Console true true true ZenLib.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) ..\..\..\..\ZenLib\Project\MSVC2013\Library\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoLib/Project/MSVC2013/RegressionTest/RegressionTest.vcxproj.filters100777 0 0 4040 12226004263 22162 0 {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hpp;hxx;hm;inl;inc;xsd {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms {f960185e-67a5-48ee-8ffd-60b32d869992} {481e17a6-32d0-4752-b32d-a0ef1fec5978} Source Files Source Files Source Files Source Files ThirdParty\md5 Header Files ThirdParty\md5 MediaInfoLib/Project/MSVC2013/ShellExtension/ 40777 0 0 0 12264020632 14004 5MediaInfoLib/Project/MSVC2013/ShellExtension/MediaInfoShellExt.cpp100777 0 0 2731 12226004263 20117 0// MediaInfoShellExt.cpp : Implementation of DLL Exports. #include "stdafx.h" #include "resource.h" #include "MediaInfoShellExt.h" class CMediaInfoShellExtModule : public CAtlDllModuleT< CMediaInfoShellExtModule > { public : DECLARE_LIBID(LIBID_MediaInfoShellExtLib) DECLARE_REGISTRY_APPID_RESOURCEID(IDR_MEDIAINFOSHELLEXT, "{23D95783-1AF5-4C0F-84C1-EC49047EA2DC}") }; CMediaInfoShellExtModule _AtlModule; #ifdef _MANAGED #pragma managed(push, off) #endif // DLL Entry Point extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { hInstance; return _AtlModule.DllMain(dwReason, lpReserved); } #ifdef _MANAGED #pragma managed(pop) #endif // Used to determine whether the DLL can be unloaded by OLE STDAPI DllCanUnloadNow(void) { return _AtlModule.DllCanUnloadNow(); } // Returns a class factory to create an object of the requested type STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { return _AtlModule.DllGetClassObject(rclsid, riid, ppv); } // DllRegisterServer - Adds entries to the system registry STDAPI DllRegisterServer(void) { // registers object, typelib and all interfaces in typelib HRESULT hr = _AtlModule.DllRegisterServer(); return hr; } // DllUnregisterServer - Removes entries from the system registry STDAPI DllUnregisterServer(void) { HRESULT hr = _AtlModule.DllUnregisterServer(); return hr; } MediaInfoLib/Project/MSVC2013/ShellExtension/MediaInfoShellExt.def100777 0 0 362 12226004263 20051 0; MediaInfoShellExt.def : Declares the module parameters. LIBRARY "MediaInfo_InfoTip.dll" EXPORTS DllCanUnloadNow PRIVATE DllGetClassObject PRIVATE DllRegisterServer PRIVATE DllUnregisterServer PRIVATE MediaInfoLib/Project/MSVC2013/ShellExtension/MediaInfoShellExt.idl100777 0 0 1421 12226004263 20100 0// MediaInfoShellExt.idl : IDL source for MediaInfoShellExt // // This file will be processed by the MIDL tool to // produce the type library (MediaInfoShellExt.tlb) and marshalling code. import "oaidl.idl"; import "ocidl.idl"; [ object, uuid(6482FE39-D67B-49E5-BAA1-EBDDB318055D), helpstring("IMediaInfoShellExt_ Interface"), pointer_default(unique) ] interface IMediaInfoShellExt_ : IUnknown{ }; [ uuid(BC1AAA9F-D8C5-4EB2-A10A-61B86B7EA77C), version(1.0), helpstring("MediaInfoShellExt 1.0 Type Library") ] library MediaInfoShellExtLib { importlib("stdole2.tlb"); [ uuid(869C14C8-1830-491F-B575-5F9AB40D2B42), helpstring("MediaInfoShellExt_ Class") ] coclass MediaInfoShellExt_ { [default] interface IMediaInfoShellExt_; }; }; MediaInfoLib/Project/MSVC2013/ShellExtension/MediaInfoShellExt.rc100777 0 0 1563 12264020304 17737 0#include VS_VERSION_INFO VERSIONINFO FILEVERSION 0,7,67,0 PRODUCTVERSION 0,7,67,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x4L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904e4" BEGIN VALUE "CompanyName", "http://MediaArea.net/MediaInfo" VALUE "FileDescription", "MediaInfo Shell ToolTip" VALUE "FileVersion", "0,7,67,0" VALUE "InternalName", "MediaInfo_ToolTip.dll" VALUE "LegalCopyright", "BSD-2-Clause" VALUE "OriginalFilename", "MediaInfo_ToolTip.dll" VALUE "ProductName", "MediaInfo" VALUE "ProductVersion", "0,7,67,0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1252 END END MediaInfoLib/Project/MSVC2013/ShellExtension/MediaInfoShellExt.vcxproj100777 0 0 56566 12226004263 21067 0 Debug ARM Debug Win32 Debug x64 Release ARM Release Win32 Release x64 {E987FD96-6BE1-45AF-9293-46B8A6695E6A} MediaInfoShellExt AtlProj DynamicLibrary Static Unicode true v120 DynamicLibrary Static Unicode true v120 DynamicLibrary Static Unicode v120 DynamicLibrary Static Unicode v120 DynamicLibrary Static Unicode true v120 DynamicLibrary Static Unicode v120 <_ProjectFileVersion>10.0.30128.1 $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ true true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ true $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ $(Platform)\$(Configuration)\Intermediate\ false false $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\Intermediate\ false MediaInfo_InfoTip MediaInfo_InfoTip MediaInfo_InfoTip MediaInfo_InfoTip MediaInfo_InfoTip MediaInfo_InfoTip _DEBUG;%(PreprocessorDefinitions) false Win32 true $(IntDir)MediaInfoShellExt.tlb MediaInfoShellExt.h MediaInfoShellExt_i.c MediaInfoShellExt_p.c false Disabled ..\..\..\..\MediaInfoLib\Source;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Use Level3 true _DEBUG;%(PreprocessorDefinitions) 0x0409 $(IntDir);%(AdditionalIncludeDirectories) MediaInfo.lib;%(AdditionalDependencies) $(OutDir)MediaInfo_InfoTip.dll ../../../../MediaInfoLib/Project/MSVC2013/DLL\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoShellExt.def true Windows MachineX86 _DEBUG;%(PreprocessorDefinitions) false true $(IntDir)MediaInfoShellExt.tlb MediaInfoShellExt.h MediaInfoShellExt_i.c MediaInfoShellExt_p.c false Disabled ..\..\..\..\MediaInfoLib\Source;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Use Level3 true _DEBUG;%(PreprocessorDefinitions) 0x0409 $(IntDir);%(AdditionalIncludeDirectories) MediaInfo.lib;%(AdditionalDependencies) $(OutDir)MediaInfo_InfoTip.dll ../../../../MediaInfoLib/Project/MSVC2013/DLL\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoShellExt.def true Windows _DEBUG;%(PreprocessorDefinitions) false X64 true $(IntDir)MediaInfoShellExt.tlb MediaInfoShellExt.h MediaInfoShellExt_i.c MediaInfoShellExt_p.c Disabled ..\..\..\..\MediaInfoLib\Source;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Use Level3 ProgramDatabase true _DEBUG;%(PreprocessorDefinitions) 0x0409 $(IntDir);%(AdditionalIncludeDirectories) MediaInfo.lib;%(AdditionalDependencies) $(OutDir)MediaInfo_InfoTip.dll ../../../../MediaInfoLib/Project/MSVC2013/DLL\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoShellExt.def true Windows MachineX64 NDEBUG;%(PreprocessorDefinitions) false Win32 true $(IntDir)MediaInfoShellExt.tlb MediaInfoShellExt.h MediaInfoShellExt_i.c MediaInfoShellExt_p.c false MaxSpeed ..\..\..\..\MediaInfoLib\Source;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) MultiThreaded Use Level3 true NDEBUG;%(PreprocessorDefinitions) 0x0409 $(IntDir);%(AdditionalIncludeDirectories) MediaInfo.lib;%(AdditionalDependencies) $(OutDir)MediaInfo_InfoTip.dll ../../../../MediaInfoLib/Project/MSVC2013/DLL\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoShellExt.def Windows MachineX86 true true true NDEBUG;%(PreprocessorDefinitions) false true $(IntDir)MediaInfoShellExt.tlb MediaInfoShellExt.h MediaInfoShellExt_i.c MediaInfoShellExt_p.c false MaxSpeed ..\..\..\..\MediaInfoLib\Source;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) MultiThreaded Use Level3 true NDEBUG;%(PreprocessorDefinitions) 0x0409 $(IntDir);%(AdditionalIncludeDirectories) MediaInfo.lib;%(AdditionalDependencies) $(OutDir)MediaInfo_InfoTip.dll ../../../../MediaInfoLib/Project/MSVC2013/DLL\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoShellExt.def Windows true true true NDEBUG;%(PreprocessorDefinitions) false X64 true $(IntDir)MediaInfoShellExt.tlb MediaInfoShellExt.h MediaInfoShellExt_i.c MediaInfoShellExt_p.c MaxSpeed ..\..\..\..\MediaInfoLib\Source;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) MultiThreaded Use Level3 true NDEBUG;%(PreprocessorDefinitions) 0x0409 $(IntDir);%(AdditionalIncludeDirectories) MediaInfo.lib;%(AdditionalDependencies) $(OutDir)MediaInfo_InfoTip.dll ../../../../MediaInfoLib/Project/MSVC2013/DLL\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) MediaInfoShellExt.def Windows MachineX64 true true true Create Create Create Create Create Create {be6d3ef8-2f82-4f1e-956a-890c3614a2d5} MediaInfoLib/Project/MSVC2013/ShellExtension/MediaInfoShellExt.vcxproj.filters100777 0 0 4640 12226004263 22500 0 {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hpp;hxx;hm;inl;inc;xsd {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav {5019c97c-ba9f-4a00-8e93-f0b5b31aa6d8} False Source Files Source Files Source Files Generated Files Source Files Resource Files Resource Files Source Files Header Files Header Files Header Files Generated Files Resource Files MediaInfoLib/Project/MSVC2013/ShellExtension/MediaInfoShellExt_.cpp100777 0 0 3731 12226004263 20257 0// MediaInfoShellExt_.cpp : Implementation of CMediaInfoShellExt_ #include "stdafx.h" #include "MediaInfoShellExt_.h" #include // CMediaInfoShellExt_ HRESULT CMediaInfoShellExt_::Load (LPCOLESTR wszFilename, DWORD) { //Save FileName FileName = wszFilename; //OK return S_OK; } HRESULT CMediaInfoShellExt_::GetInfoTip (DWORD, LPWSTR* ppwszTip) { LPMALLOC Malloc; std::wstring ToolTip; //Get an IMalloc interface from the shell. if (FAILED(SHGetMalloc(&Malloc))) return E_FAIL; //Creating tooltip ToolTip=_T("MediaInfo:\n"); MediaInfoDLL::MediaInfo I; I.Option(_T("Inform"), _T("Summary")); I.Open(FileName); for (size_t StreamKind=0; StreamKind<(size_t)MediaInfoDLL::Stream_Max; StreamKind++) for (size_t StreamPos=0; StreamPos0) { ToolTip+=I.Get((MediaInfoDLL::stream_t)StreamKind, StreamPos, _T("StreamKind")); ToolTip+=_T(": "); } ToolTip+=I.Get((MediaInfoDLL::stream_t)StreamKind, StreamPos, _T("Inform")); ToolTip+=_T("\r\n"); } if (ToolTip.size()>2) ToolTip.resize(ToolTip.size()-2); //Removing the ending \r\n //Allocate a buffer for Explorer. Note that the must pass the string //back as a Unicode string, so the string length is multiplied by the //size of a Unicode character. *ppwszTip=(LPWSTR)Malloc->Alloc((ToolTip.size()+1)*sizeof(wchar_t)); //Release the IMalloc interface now that we're done using it. Malloc->Release(); //Enough memory? if (*ppwszTip==NULL) return E_OUTOFMEMORY; //Use the Unicode string copy function to put the tooltip text in the buffer. wcscpy_s(*ppwszTip, ToolTip.size()+1, T2COLE(ToolTip.c_str())); //OK return S_OK; }MediaInfoLib/Project/MSVC2013/ShellExtension/stdafx.cpp100777 0 0 325 12226004263 16061 0// stdafx.cpp : source file that includes just the standard includes // MediaInfoShellExt.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" MediaInfoLib/Project/NetBeans/ 40777 0 0 0 12264020633 11462 5MediaInfoLib/Project/NetBeans/Example.JNA/ 40777 0 0 0 12264020633 13464 5MediaInfoLib/Project/NetBeans/Example.JNative/ 40777 0 0 0 12264020633 14414 5MediaInfoLib/Project/NetBeans/Example.JNative/build.xml100777 0 0 6510 12226004263 16336 0 Builds, tests, and runs the project HowToUseDll - JNative. MediaInfoLib/Project/NetBeans/Example.JNative/manifest.mf100777 0 0 125 12226004263 16623 0Manifest-Version: 1.0 X-COMMENT: Main-Class will be added automatically by build MediaInfoLib/Project/NetBeans/Example.JNative/nbproject/ 40777 0 0 0 12264020633 16402 5MediaInfoLib/Project/NetBeans/Example.JNative/nbproject/build-impl.xml100777 0 0 100672 12226004263 21327 0 Must set src.dir Must set test.src.dir Must set build.dir Must set dist.dir Must set build.classes.dir Must set dist.javadoc.dir Must set build.test.classes.dir Must set build.test.results.dir Must set build.classes.excludes Must set dist.jar Must set javac.includes Must select some files in the IDE or set javac.includes To run this application from the command line without Ant, try: java -cp "${run.classpath.with.dist.jar}" ${main.class} To run this application from the command line without Ant, try: java -jar "${dist.jar.resolved}" Must select one file in the IDE or set run.class Must select one file in the IDE or set debug.class Must set fix.includes Must select some files in the IDE or set javac.includes Some tests failed; see details above. Must select some files in the IDE or set test.includes Some tests failed; see details above. Must select one file in the IDE or set test.class Must select one file in the IDE or set applet.url Must select one file in the IDE or set applet.url MediaInfoLib/Project/NetBeans/Example.JNative/nbproject/genfiles.properties100777 0 0 707 12226004263 22377 0build.xml.data.CRC32=8a43d17b build.xml.script.CRC32=451c646b build.xml.stylesheet.CRC32=be360661 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=8a43d17b nbproject/build-impl.xml.script.CRC32=ff162815 nbproject/build-impl.xml.stylesheet.CRC32=487672f9 MediaInfoLib/Project/NetBeans/Example.JNative/nbproject/private/ 40777 0 0 0 12264020633 20054 5MediaInfoLib/Project/NetBeans/Example.JNative/nbproject/private/private.properties100777 0 0 437 12226004263 23727 0file.reference.JNative.jar=F:\\Programmation\\MediaInfoLib\\Project\\NetBeans\\Example.JNative\\JNative.jar jaxws.endorsed.dir=C:\\Program Files\\NetBeans 6.1\\java2\\modules\\ext\\jaxws21\\api user.properties.file=C:\\Documents and Settings\\Jerome\\.netbeans\\6.1\\build.properties MediaInfoLib/Project/NetBeans/Example.JNative/nbproject/private/private.xml100777 0 0 323 12226004263 22325 0 MediaInfoLib/Project/NetBeans/Example.JNative/nbproject/project.properties100777 0 0 3452 12226004263 22271 0build.classes.dir=${build.dir}/classes build.classes.excludes=**/*.java,**/*.form # This directory is removed when the project is cleaned: build.dir=build build.generated.dir=${build.dir}/generated # Only compile against the classpath explicitly listed here: build.sysclasspath=ignore build.test.classes.dir=${build.dir}/test/classes build.test.results.dir=${build.dir}/test/results debug.classpath=\ ${run.classpath} debug.test.classpath=\ ${run.test.classpath} # This directory is removed when the project is cleaned: dist.dir=dist dist.jar=${dist.dir}/HowToUseDll_-_JNative.jar dist.javadoc.dir=${dist.dir}/javadoc excludes= file.reference.JNative.jar=JNative.jar includes=** jar.compress=false javac.classpath=\ ${file.reference.JNative.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false javac.source=1.5 javac.target=1.5 javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir} javadoc.additionalparam= javadoc.author=false javadoc.encoding=${source.encoding} javadoc.noindex=false javadoc.nonavbar=false javadoc.notree=false javadoc.private=false javadoc.splitindex=true javadoc.use=true javadoc.version=false javadoc.windowtitle= main.class=HowToUse_Dll manifest.file=manifest.mf meta.inf.dir=${src.dir}/META-INF platform.active=default_platform run.classpath=\ ${javac.classpath}:\ ${build.classes.dir} # Space-separated list of JVM arguments used when running the project # (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value # or test-sys-prop.name=value to set system properties for unit tests): run.jvmargs= run.test.classpath=\ ${javac.test.classpath}:\ ${build.test.classes.dir} source.encoding=UTF-8 src.dir=src test.src.dir=test MediaInfoLib/Project/NetBeans/Example.JNative/nbproject/project.xml100777 0 0 1117 12226004263 20671 0 org.netbeans.modules.java.j2seproject HowToUseDll - JNative 1.6.5 MediaInfoLib/Project/NetBeans/Example.JNative/ReadMe.txt100777 0 0 430 12226004263 16366 0NetBeans example may be sometimes outdated, because I didn't find how to set NetBeans for linking to an existant files instead of copying it in the NetBeans/src directory. If there is a problem, try first to copy HowToUse_Dll.java and MediaInfoDLL.java from the /Source directoryMediaInfoLib/Project/NetBeans/Example.JNative/src/ 40777 0 0 0 12264020633 15203 5MediaInfoLib/Project/NetBeans/Example.JNative/src/HowToUse_Dll.JNative.java100777 0 0 4720 12226004263 22017 0/* 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. */ class HowToUse_Dll { public static void main(String... args) throws Exception { String File_Name = "Example.ogg"; if (args.length > 0) File_Name = args[0]; String To_Display = ""; //Info about the library To_Display += MediaInfo.Option_Static("Info_Version"); To_Display += "\r\n\r\nInfo_Parameters\r\n"; To_Display += MediaInfo.Option_Static("Info_Parameters"); To_Display += "\r\n\r\nInfo_Capacities\r\n"; To_Display += MediaInfo.Option_Static("Info_Capacities"); To_Display += "\r\n\r\nInfo_Codecs\r\n"; To_Display += MediaInfo.Option_Static("Info_Codecs"); //An example of how to use the library MediaInfo MI = new MediaInfo(); To_Display += "\r\n\r\nOpen\r\n"; if (MI.Open(File_Name)>0) To_Display+="is OK\r\n"; else To_Display+="has a problem\r\n"; To_Display += "\r\n\r\nInform with Complete=false\r\n"; MI.Option("Complete", ""); To_Display += MI.Inform(); To_Display += "\r\n\r\nInform with Complete=true\r\n"; MI.Option("Complete", "1"); To_Display += MI.Inform(); To_Display += "\r\n\r\nCustom Inform\r\n"; MI.Option("Inform", "General;Example : FileSize=%FileSize%"); To_Display += MI.Inform(); To_Display += "\r\n\r\nGetI with Stream=General and Parameter=2\r\n"; To_Display += MI.Get(MediaInfo.Stream_General, 0, 2, MediaInfo.Info_Text); To_Display += "\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n"; To_Display += MI.Count_Get(MediaInfo.Stream_Audio, -1); To_Display += "\r\n\r\nGet with Stream=General and Parameter=\"AudioCount\"\r\n"; To_Display += MI.Get(MediaInfo.Stream_General, 0, "AudioCount", MediaInfo.Info_Text, MediaInfo.Info_Name); To_Display += "\r\n\r\nGet with Stream=Audio and Parameter=\"StreamCount\"\r\n"; To_Display += MI.Get(MediaInfo.Stream_Audio, 0, "StreamCount", MediaInfo.Info_Text, MediaInfo.Info_Name); To_Display += "\r\n\r\nGet with Stream=General and Parameter=\"FileSize\"\r\n"; To_Display += MI.Get(MediaInfo.Stream_General, 0, "FileSize", MediaInfo.Info_Text, MediaInfo.Info_Name); To_Display += "\r\n\r\nClose\r\n"; MI.Close(); System.out.println(To_Display); } } MediaInfoLib/Project/NetBeans/Example.JNative/src/MediaInfoDLL.JNative.java100777 0 0 57725 12226004263 21733 0/* 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. */ import org.xvolks.jnative.JNative; import org.xvolks.jnative.Type; import org.xvolks.jnative.pointers.Pointer; import org.xvolks.jnative.pointers.memory.MemoryBlockFactory; import org.xvolks.jnative.exceptions.NativeException; import org.xvolks.jnative.pointers.memory.NativeMemoryBlock; /** * Class to retrieve info about media files. * MediaInfo library (http://MediaArea.net/MediaInfo) is used * by the help of JNative (http://jnative.sourceforge.net) * to obtain technical the info about the files. * * @author bro3@users.sourceforge.net * @author Info@MediaArea.net */ class MediaInfo { /* static_fields */ final public static int Stream_General = 0; final public static int Stream_Video = 1; final public static int Stream_Audio = 2; final public static int Stream_Text = 3; final public static int Stream_Other = 4; final public static int Stream_Image = 5; final public static int Stream_Menu = 6; final public static int Stream_Max = 7; final public static int Info_Name = 0; final public static int Info_Text = 1; final public static int Info_Measure = 2; final public static int Info_Options = 3; final public static int Info_Name_Text = 4; final public static int Info_Measure_Text = 5; final public static int Info_Info = 6; final public static int Info_HowTo = 7; final public static int Info_Max = 8; /* The MediaInfo handle */ private String handle = null; private JNative new_jnative; /* The library to be used */ private static String libraryName = ""; /** * Constructor that initializes the new MediaInfo object. * @throws NativeException JNative Exception. */ public MediaInfo() throws NativeException, Exception { setLibraryName(); New(); } /** * Constructor that initializes the new MediaInfo object. * @param libraryName name of libarary to be used * @throws NativeException JNative Exception */ public MediaInfo(String libraryName) throws NativeException, Exception { setLibraryName(libraryName); New(); } /** * Method New initializes the MediaInfo handle * @throws NativeException JNative Exception */ private void New() throws NativeException, Exception { /* Getting the handle */ new_jnative = new JNative(libraryName, "MediaInfoA_New"); new_jnative.setRetVal(Type.INT); new_jnative.invoke(); handle = new_jnative.getRetVal(); Option("CharSet", "UTF-8"); } /** * Opens a media file. * Overloads method {@link #Open(int, int, int, int)} * @param begin buffer with the beginning of datas * @param beginSize size of begin * @return 1 for success and 0 for failure * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception * @see #Open(int, int, int, int) */ public int Open(int begin, int beginSize) throws HandleNotInitializedException, NativeException, Exception { return Open(begin, beginSize, 0, 0); } /** * Opens a media file. * @param begin buffer with the beginning of datas * @param beginSize size of begin * @param end buffer with the end of datas * @param endSize size of end * @return 1 for success and 0 for failure * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public int Open(int begin, int beginSize, int end, int endSize) throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Open_Buffer"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, handle); jnative.setParameter(1, Type.INT, String.valueOf(begin)); jnative.setParameter(2, Type.INT, String.valueOf(beginSize)); jnative.setParameter(3, Type.INT, String.valueOf(end)); jnative.setParameter(4, Type.INT, String.valueOf(endSize)); jnative.invoke(); /* Retrieving data */ int ret = Integer.parseInt(jnative.getRetVal()); return ret; } /** * Opens a media file. * @param filename the filename * @return 1 for success and 0 for failure * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public int Open(String filename) throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /* Setting the memory with the byte array returned in UTF-8 format */ Pointer fileNamePointer = createPointer(filename); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Open"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, handle); jnative.setParameter(1, fileNamePointer); jnative.invoke(); /* Retrieving data */ int ret = Integer.parseInt(jnative.getRetVal()); return ret; } /** * Gets the file info, (if available) according to the previous options set by {@link #Option(String, String)} * @return the file info * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public String Inform() throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Inform"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, handle); jnative.setParameter(1, Type.INT, "0"); //Necessary for backward compatibility jnative.invoke(); /* Retrieving data */ String ret = retrieveString(jnative); return ret; } /** * Gets the specific info according to the parameters. * Overloads method {@link #Get(int, int, String, int, int)}. * @param streamKind type of stream. Can be any of the Stream_XX values {@link Field details} * @param streamNumber stream number to process * @param parameter parameter string (list of strings is available with Option("Info_Parameters"); * @return information * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception * @see #Get(int, int, String, int, int) */ public String Get(int streamKind, int streamNumber, String parameter) throws HandleNotInitializedException, NativeException, Exception { return Get(streamKind, streamNumber, parameter, MediaInfo.Info_Name, MediaInfo.Info_Text); } /** * Gets the specific info according to the parameters. * Overloads method {@link #Get(int, int, String, int, int)} * @param streamKind type of stream. Can be any of the Stream_XX values {@link Field details} * @param streamNumber stream to process * @param parameter parameter string (list of strings is available with Option("Info_Parameters"); * @param infoKind type of info. Can be any of the Info_XX values {@link Field details} * @return desired information * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception * @see #Get(int, int, String, int, int) */ public String Get(int streamKind, int streamNumber, String parameter, int infoKind) throws HandleNotInitializedException, NativeException, Exception { return Get(streamKind, streamNumber, parameter, infoKind, MediaInfo.Info_Name); } /** * Gets the specific file info according to the parameters. * @param streamKind type of stream. Can be any of the Stream_XX values {@link Field details} * @param streamNumber stream to process * @param parameter parameter string (list of strings is available with Option("Info_Parameters"); * @param infoKind type of info. Can be any of the Info_XX values {@link Field details} * @param searchKind type of search. Can be any of the Info_XX values {@link Field details} * @return desired information * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public String Get(int streamKind, int streamNumber, String parameter, int infoKind, int searchKind) throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /* Setting the memory with the byte array returned in UTF-8 format */ Pointer parameterPointer = createPointer(parameter); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Get"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, handle); jnative.setParameter(1, Type.INT, String.valueOf(streamKind)); jnative.setParameter(2, Type.INT, String.valueOf(streamNumber)); jnative.setParameter(3, parameterPointer); jnative.setParameter(4, Type.INT, String.valueOf(infoKind)); jnative.setParameter(5, Type.INT, String.valueOf(searchKind)); jnative.invoke(); /* Retrieving data */ String ret = retrieveString(jnative); return ret; } /** * Gets the specific file info according to the parameters. * Overloads method {@link #Get(int, int, int, int)}. * @param streamKind type of stream. Can be any of the Stream_XX values {@link Field details} * @param streamNumber stream to process * @param parameter parameter position (count of parameters is available with Count_Get(streamKind, streamNumber) ) * @return desired information * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception * @see #Get(int, int, int, int) */ public String Get(int streamKind, int streamNumber, int parameter) throws HandleNotInitializedException, NativeException, Exception { return Get(streamKind, streamNumber, parameter, MediaInfo.Info_Text); } /** * Gets the specific file info according to the parameters. * @param streamKind type of stream. Can be any of the Stream_XX values {@link Field details} * @param streamNumber stream to process * @param parameter parameter position (count of parameters is available with Count_Get(streamKind, streamNumber) ) * @param infoKind type of info. Can be any of the Info_XX values {@link Field details} * @return desired information * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public String Get(int streamKind, int streamNumber, int parameter, int infoKind) throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_GetI"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, handle); jnative.setParameter(1, Type.INT, String.valueOf(streamKind)); jnative.setParameter(2, Type.INT, String.valueOf(streamNumber)); jnative.setParameter(3, Type.INT, String.valueOf(parameter)); jnative.setParameter(4, Type.INT, String.valueOf(infoKind)); jnative.invoke(); /* Retrieving data */ String ret = retrieveString(jnative); return ret; } /** * Sets the option * Overloads method {@link #Option(String, String)} * @param option name of option * @return desired information or status of the option * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception * @see #Option(String, String) */ public String Option(String option) throws HandleNotInitializedException, NativeException, Exception { return Option(option, ""); } /** * Sets the option with value * @param option name of option * @param value option value * @return desired information or status of the option * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public String Option(String option, String value) throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /* Setting the memory with the byte array returned in UTF-8 format */ Pointer optionPointer = createPointer(option); Pointer valuePointer = createPointer(value); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Option"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, handle); jnative.setParameter(1, optionPointer); jnative.setParameter(2, valuePointer); jnative.invoke(); /* Retrieving data */ String ret = retrieveString(jnative); return ret; } /** * Sets the option (you do not need to create a MediaInfo handle) * Overloads method {@link #Option_Static(String, String)} * @param option name of option * @return desired information or status of the option * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception * @see #Option_Static(String, String) */ static public String Option_Static(String option) throws HandleNotInitializedException, NativeException, Exception { return Option_Static(option, ""); } /** * Sets the option (you do not need to create a MediaInfo handle) * @param option name of option * @param value option value * @return desired information or status of the option * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ static public String Option_Static(String option, String value) throws HandleNotInitializedException, NativeException, Exception { if (libraryName.equals("")) setLibraryName(); /* Setting the memory with the byte array returned in UTF-8 format */ Pointer optionPointer = createPointer(option); Pointer valuePointer = createPointer(value); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Option"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, "0"); jnative.setParameter(1, optionPointer); jnative.setParameter(2, valuePointer); jnative.invoke(); /* Retrieving data */ String ret = retrieveString(jnative); return ret; } /** * Gets the state of the libaray * @return state of the library (between 0 and 10000) * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public int State_Get() throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_State_Get"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, handle); jnative.invoke(); /* Retrieving data */ int ret = Integer.parseInt(jnative.getRetVal()); return ret; } /** * Gets the count of streams * Overloads method {@link #Count_Get(int, int)}. * @param streamKind type of stream. Can be any of the Stream_XX values {@link Field details} * @return count of streams * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception * @see #Count_Get(int, int) */ public int Count_Get(int streamKind) throws HandleNotInitializedException, NativeException, Exception { return Count_Get(streamKind, -1); } /** * Gets the count of streams * @param streamKind type of stream. Can be any of the Stream_XX values {@link Field details} * @param streamNumber stream to process * @return count of parameters for a specific stream * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public int Count_Get(int streamKind, int streamNumber) throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Count_Get"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, handle); jnative.setParameter(1, Type.INT, String.valueOf(streamKind)); jnative.setParameter(2, Type.INT, String.valueOf(streamNumber)); jnative.invoke(); /* Retrieving data */ int retval = Integer.parseInt(jnative.getRetVal()); return retval; } /** * Deletes the handle * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ protected void finalize() throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Delete"); jnative.setParameter(0, Type.INT, handle); jnative.invoke(); } /** * Closes the handle * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public void Close() throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Close"); jnative.setParameter(0, Type.INT, handle); jnative.invoke(); } /** * Create a memory pointer for giving it to an external library * @param value The string to give * @return A pointer to the memory */ static Pointer createPointer(String value) throws Exception { value+="\0"; byte[] array=value.getBytes("UTF-8"); Pointer valuePointer = new Pointer(MemoryBlockFactory.createMemoryBlock(array.length)); valuePointer.setMemory(array); return valuePointer; } /** * Create a string from a memory pointer * @param jnative The jnative handler * @return A string */ static String retrieveString(JNative jnative) throws Exception { int address = Integer.parseInt(jnative.getRetVal()); byte[] strEnd ={0}; int howFarToSearch =10000; int length =0; while (true) { int pos=JNative.searchNativePattern(address+length, strEnd, howFarToSearch); if (pos == -1) howFarToSearch+=10000; //The strEnd wasn't found else { length+=pos; break; } } if (length > 0) { Pointer retPointer = new Pointer(new NativeMemoryBlock(address, length)); String fileInfo = new String(retPointer.getMemory(), "UTF-8"); retPointer.dispose(); return fileInfo; } else return new String(); } /** * Sets the default name of the library to be used. * If windows -> "MediaInfo.dll" else -> "libmediainfo.so.0" */ public static void setLibraryName() { if (libraryName.equals("")) { String os=System.getProperty("os.name"); if (os!=null && os.toLowerCase().startsWith("windows")) setLibraryName("MediaInfo.dll"); else if (os!=null && os.toLowerCase().startsWith("mac")) setLibraryName("libmediainfo.dynlib.0"); else setLibraryName("libmediainfo.so.0"); } } /** * Sets the name of the library to be used. * @param libName name of the library */ public static void setLibraryName(String libName) { libraryName = libName; } } /** * Exception thrown if the handle isn't initialized. */ class HandleNotInitializedException extends Exception { private static final long serialVersionUID = 1L; HandleNotInitializedException(String msg) { super(msg); } } MediaInfoLib/Project/NetBeans/Example.JNA/build.xml100777 0 0 7242 12226004263 15411 0 Builds, tests, and runs the project HowToUseDll - JNA. MediaInfoLib/Project/NetBeans/Example.JNA/manifest.mf100777 0 0 125 12226004263 15673 0Manifest-Version: 1.0 X-COMMENT: Main-Class will be added automatically by build MediaInfoLib/Project/NetBeans/Example.JNA/nbproject/ 40777 0 0 0 12264020633 15452 5MediaInfoLib/Project/NetBeans/Example.JNA/nbproject/build-impl.xml100777 0 0 124402 12226004263 20374 0 Must set src.dir Must set test.src.dir Must set build.dir Must set dist.dir Must set build.classes.dir Must set dist.javadoc.dir Must set build.test.classes.dir Must set build.test.results.dir Must set build.classes.excludes Must set dist.jar Must set javac.includes Must select some files in the IDE or set javac.includes To run this application from the command line without Ant, try: java -cp "${run.classpath.with.dist.jar}" ${main.class} To run this application from the command line without Ant, try: java -jar "${dist.jar.resolved}" Must select one file in the IDE or set run.class Must select one file in the IDE or set run.class Must select one file in the IDE or set debug.class Must select one file in the IDE or set debug.class Must set fix.includes Must select some files in the IDE or set javac.includes Some tests failed; see details above. Must select some files in the IDE or set test.includes Some tests failed; see details above. Must select one file in the IDE or set test.class Must select one file in the IDE or set applet.url Must select one file in the IDE or set applet.url MediaInfoLib/Project/NetBeans/Example.JNA/nbproject/genfiles.properties100777 0 0 733 12226004263 21446 0build.xml.data.CRC32=17939cbf build.xml.script.CRC32=ca77c876 build.xml.stylesheet.CRC32=958a1d3e@1.32.1.45 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=17939cbf nbproject/build-impl.xml.script.CRC32=bbb36a50 nbproject/build-impl.xml.stylesheet.CRC32=576378a2@1.32.1.45 MediaInfoLib/Project/NetBeans/Example.JNA/nbproject/private/ 40777 0 0 0 12264020633 17124 5MediaInfoLib/Project/NetBeans/Example.JNA/nbproject/private/private.properties100777 0 0 412 12226004263 22770 0file.reference.JNative.jar=F:\\Programmation\\MediaInfoLib\\Project\\NetBeans\\Example.JNA\\JNative.jar jaxbwiz.endorsed.dirs=C:\\Program Files\\NetBeans 6.8\\ide12\\modules\\ext\\jaxb\\api user.properties.file=C:\\Users\\Jerome\\.netbeans\\6.8\\build.properties MediaInfoLib/Project/NetBeans/Example.JNA/nbproject/private/private.xml100777 0 0 323 12226004263 21375 0 MediaInfoLib/Project/NetBeans/Example.JNA/nbproject/project.properties100777 0 0 3706 12226004263 21343 0build.classes.dir=${build.dir}/classes build.classes.excludes=**/*.java,**/*.form # This directory is removed when the project is cleaned: build.dir=build build.generated.dir=${build.dir}/generated build.generated.sources.dir=${build.dir}/generated-sources # Only compile against the classpath explicitly listed here: build.sysclasspath=ignore build.test.classes.dir=${build.dir}/test/classes build.test.results.dir=${build.dir}/test/results debug.classpath=\ ${run.classpath} debug.test.classpath=\ ${run.test.classpath} # This directory is removed when the project is cleaned: dist.dir=dist dist.jar=${dist.dir}/HowToUseDll_-_JNA.jar dist.javadoc.dir=${dist.dir}/javadoc excludes= file.reference.jna.jar=jna.jar file.reference.JNative.jar=JNative.jar includes=** jar.compress=false javac.classpath=\ ${file.reference.jna.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false javac.source=1.5 javac.target=1.5 javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir} javadoc.additionalparam= javadoc.author=false javadoc.encoding=${source.encoding} javadoc.noindex=false javadoc.nonavbar=false javadoc.notree=false javadoc.private=false javadoc.splitindex=true javadoc.use=true javadoc.version=false javadoc.windowtitle= jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api" main.class=HowToUse_Dll manifest.file=manifest.mf meta.inf.dir=${src.dir}/META-INF platform.active=default_platform run.classpath=\ ${javac.classpath}:\ ${build.classes.dir} # Space-separated list of JVM arguments used when running the project # (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value # or test-sys-prop.name=value to set system properties for unit tests): run.jvmargs= run.test.classpath=\ ${javac.test.classpath}:\ ${build.test.classes.dir} source.encoding=UTF-8 src.dir=src test.src.dir=test MediaInfoLib/Project/NetBeans/Example.JNA/nbproject/project.xml100777 0 0 1113 12226004263 17735 0 org.netbeans.modules.java.j2seproject HowToUseDll - JNA 1.6.5 MediaInfoLib/Project/NetBeans/Example.JNA/src/ 40777 0 0 0 12264020633 14253 5MediaInfoLib/Project/NetBeans/Example.JNA/src/HowToUse_Dll.JNA.java100777 0 0 4761 12226004263 20144 0/* 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. */ class HowToUse_Dll { public static void main(String... args) throws Exception { String FileName = "Example.ogg"; if (args.length > 0) FileName = args[0]; String To_Display = ""; //Info about the library To_Display += MediaInfo.Option_Static("Info_Version"); To_Display += "\r\n\r\nInfo_Parameters\r\n"; To_Display += MediaInfo.Option_Static("Info_Parameters"); To_Display += "\r\n\r\nInfo_Capacities\r\n"; To_Display += MediaInfo.Option_Static("Info_Capacities"); To_Display += "\r\n\r\nInfo_Codecs\r\n"; To_Display += MediaInfo.Option_Static("Info_Codecs"); //An example of how to use the library MediaInfo MI = new MediaInfo(); To_Display += "\r\n\r\nOpen\r\n"; if (MI.Open(FileName)>0) To_Display+="is OK\r\n"; else To_Display+="has a problem\r\n"; To_Display += "\r\n\r\nInform with Complete=false\r\n"; MI.Option("Complete", ""); To_Display += MI.Inform(); To_Display += "\r\n\r\nInform with Complete=true\r\n"; MI.Option("Complete", "1"); To_Display += MI.Inform(); To_Display += "\r\n\r\nCustom Inform\r\n"; MI.Option("Inform", "General;Example : FileSize=%FileSize%"); To_Display += MI.Inform(); To_Display += "\r\n\r\nGetI with Stream=General and Parameter=2\r\n"; To_Display += MI.Get(MediaInfo.StreamKind.General, 0, 2, MediaInfo.InfoKind.Text); To_Display += "\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n"; To_Display += MI.Count_Get(MediaInfo.StreamKind.Audio, -1); To_Display += "\r\n\r\nGet with Stream=General and Parameter=\"AudioCount\"\r\n"; To_Display += MI.Get(MediaInfo.StreamKind.General, 0, "AudioCount", MediaInfo.InfoKind.Text, MediaInfo.InfoKind.Name); To_Display += "\r\n\r\nGet with Stream=Audio and Parameter=\"StreamCount\"\r\n"; To_Display += MI.Get(MediaInfo.StreamKind.Audio, 0, "StreamCount", MediaInfo.InfoKind.Text, MediaInfo.InfoKind.Name); To_Display += "\r\n\r\nGet with Stream=General and Parameter=\"FileSize\"\r\n"; To_Display += MI.Get(MediaInfo.StreamKind.General, 0, "FileSize", MediaInfo.InfoKind.Text, MediaInfo.InfoKind.Name); To_Display += "\r\n\r\nClose\r\n"; MI.Close(); System.out.println(To_Display); } } MediaInfoLib/Project/NetBeans/Example.JNA/src/MediaInfoDLL.JNA.java100777 0 0 32533 12226004263 20041 0/* 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. */ // Note: the original stuff was well packaged with Java style, // but I (the main developer) prefer to keep an easiest for me // way to have all sources and example in the same place // Removed stuff: // "package net.sourceforge.mediainfo;" // directory was /net/sourceforge/mediainfo import static java.util.Collections.singletonMap; import java.lang.reflect.Method; import java.net.URL; import com.sun.jna.FunctionMapper; import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.NativeLibrary; import com.sun.jna.Pointer; import com.sun.jna.WString; class MediaInfo { static String LibraryPath="mediainfo"; static { // libmediainfo for linux depends on libzen try { // We need to load dependencies first, because we know where our native libs are (e.g. Java Web Start Cache). // If we do not, the system will look for dependencies, but only in the library path. String os=System.getProperty("os.name"); if (os!=null && !os.toLowerCase().startsWith("windows") && !os.toLowerCase().startsWith("mac")) { final ClassLoader loader=MediaInfo.class.getClassLoader(); final String LocalPath; if (loader!=null) { LocalPath=loader.getResource(MediaInfo.class.getName().replace('.', '/')+ ".class").getPath().replace("MediaInfo.class", ""); try { NativeLibrary.getInstance(LocalPath+"libzen.so.0"); // Local path } catch (LinkageError e) { NativeLibrary.getInstance("zen"); // Default path } } else { LocalPath=""; NativeLibrary.getInstance("zen"); // Default path } if (LocalPath.length()>0) { try { NativeLibrary.getInstance(LocalPath+"libmediainfo.so.0"); // Local path LibraryPath=LocalPath+"libmediainfo.so.0"; } catch (LinkageError e) { } } } } catch (LinkageError e) { //Logger.getLogger(MediaInfo.class.getName()).warning("Failed to preload libzen"); } } //Internal stuff interface MediaInfoDLL_Internal extends Library { MediaInfoDLL_Internal INSTANCE = (MediaInfoDLL_Internal) Native.loadLibrary(LibraryPath, MediaInfoDLL_Internal.class, singletonMap(OPTION_FUNCTION_MAPPER, new FunctionMapper() { @Override public String getFunctionName(NativeLibrary lib, Method method) { /* 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. */ return "MediaInfo_" + method.getName(); } } )); //Constructor/Destructor Pointer New(); void Delete(Pointer Handle); //File int Open(Pointer Handle, WString file); void Close(Pointer Handle); //Infos WString Inform(Pointer Handle, int Reserved); WString Get(Pointer Handle, int StreamKind, int StreamNumber, WString parameter, int infoKind, int searchKind); WString GetI(Pointer Handle, int StreamKind, int StreamNumber, int parameterIndex, int infoKind); int Count_Get(Pointer Handle, int StreamKind, int StreamNumber); //Options WString Option(Pointer Handle, WString option, WString value); } private Pointer Handle; public enum StreamKind { General, Video, Audio, Text, Other, Image, Menu; } //Enums public enum InfoKind { /** * Unique name of parameter. */ Name, /** * Value of parameter. */ Text, /** * Unique name of measure unit of parameter. */ Measure, Options, /** * Translated name of parameter. */ Name_Text, /** * Translated name of measure unit. */ Measure_Text, /** * More information about the parameter. */ Info, /** * How this parameter is supported, could be N (No), B (Beta), R (Read only), W * (Read/Write). */ HowTo, /** * Domain of this piece of information. */ Domain; } //Constructor/Destructor public MediaInfo() { Handle = MediaInfoDLL_Internal.INSTANCE.New(); } public void dispose() { if (Handle == null) throw new IllegalStateException(); MediaInfoDLL_Internal.INSTANCE.Delete(Handle); Handle = null; } @Override protected void finalize() throws Throwable { if (Handle != null) dispose(); } //File /** * Open a file and collect information about it (technical information and tags). * * @param file full name of the file to open * @return 1 if file was opened, 0 if file was not not opened */ public int Open(String File_Name) { return MediaInfoDLL_Internal.INSTANCE.Open(Handle, new WString(File_Name)); } /** * Close a file opened before with Open(). * */ public void Close() { MediaInfoDLL_Internal.INSTANCE.Close(Handle); } //Information /** * Get all details about a file. * * @return All details about a file in one string */ public String Inform() { return MediaInfoDLL_Internal.INSTANCE.Inform(Handle, 0).toString(); } /** * Get a piece of information about a file (parameter is a string). * * @param StreamKind Kind of Stream (general, video, audio...) * @param StreamNumber Stream number in Kind of Stream (first, second...) * @param parameter Parameter you are looking for in the Stream (Codec, width, bitrate...), * in string format ("Codec", "Width"...) * @return a string about information you search, an empty string if there is a problem */ public String Get(StreamKind StreamKind, int StreamNumber, String parameter) { return Get(StreamKind, StreamNumber, parameter, InfoKind.Text, InfoKind.Name); } /** * Get a piece of information about a file (parameter is a string). * * @param StreamKind Kind of Stream (general, video, audio...) * @param StreamNumber Stream number in Kind of Stream (first, second...) * @param parameter Parameter you are looking for in the Stream (Codec, width, bitrate...), * in string format ("Codec", "Width"...) * @param infoKind Kind of information you want about the parameter (the text, the measure, * the help...) * @param searchKind Where to look for the parameter */ public String Get(StreamKind StreamKind, int StreamNumber, String parameter, InfoKind infoKind) { return Get(StreamKind, StreamNumber, parameter, infoKind, InfoKind.Name); } /** * Get a piece of information about a file (parameter is a string). * * @param StreamKind Kind of Stream (general, video, audio...) * @param StreamNumber Stream number in Kind of Stream (first, second...) * @param parameter Parameter you are looking for in the Stream (Codec, width, bitrate...), * in string format ("Codec", "Width"...) * @param infoKind Kind of information you want about the parameter (the text, the measure, * the help...) * @param searchKind Where to look for the parameter * @return a string about information you search, an empty string if there is a problem */ public String Get(StreamKind StreamKind, int StreamNumber, String parameter, InfoKind infoKind, InfoKind searchKind) { return MediaInfoDLL_Internal.INSTANCE.Get(Handle, StreamKind.ordinal(), StreamNumber, new WString(parameter), infoKind.ordinal(), searchKind.ordinal()).toString(); } /** * Get a piece of information about a file (parameter is an integer). * * @param StreamKind Kind of Stream (general, video, audio...) * @param StreamNumber Stream number in Kind of Stream (first, second...) * @param parameter Parameter you are looking for in the Stream (Codec, width, bitrate...), * in integer format (first parameter, second parameter...) * @return a string about information you search, an empty string if there is a problem */ public String get(StreamKind StreamKind, int StreamNumber, int parameterIndex) { return Get(StreamKind, StreamNumber, parameterIndex, InfoKind.Text); } /** * Get a piece of information about a file (parameter is an integer). * * @param StreamKind Kind of Stream (general, video, audio...) * @param StreamNumber Stream number in Kind of Stream (first, second...) * @param parameter Parameter you are looking for in the Stream (Codec, width, bitrate...), * in integer format (first parameter, second parameter...) * @param infoKind Kind of information you want about the parameter (the text, the measure, * the help...) * @return a string about information you search, an empty string if there is a problem */ public String Get(StreamKind StreamKind, int StreamNumber, int parameterIndex, InfoKind infoKind) { return MediaInfoDLL_Internal.INSTANCE.GetI(Handle, StreamKind.ordinal(), StreamNumber, parameterIndex, infoKind.ordinal()).toString(); } /** * Count of Streams of a Stream kind (StreamNumber not filled), or count of piece of * information in this Stream. * * @param StreamKind Kind of Stream (general, video, audio...) * @return number of Streams of the given Stream kind */ public int Count_Get(StreamKind StreamKind) { //We should use NativeLong for -1, but it fails on 64-bit //int Count_Get(Pointer Handle, int StreamKind, NativeLong StreamNumber); //return MediaInfoDLL_Internal.INSTANCE.Count_Get(Handle, StreamKind.ordinal(), -1); //so we use slower Get() with a character string return Integer.parseInt(Get(StreamKind, 0, "StreamCount").toString()); } /** * Count of Streams of a Stream kind (StreamNumber not filled), or count of piece of * information in this Stream. * * @param StreamKind Kind of Stream (general, video, audio...) * @param StreamNumber Stream number in this kind of Stream (first, second...) * @return number of Streams of the given Stream kind */ public int Count_Get(StreamKind StreamKind, int StreamNumber) { return MediaInfoDLL_Internal.INSTANCE.Count_Get(Handle, StreamKind.ordinal(), StreamNumber); } //Options /** * Configure or get information about MediaInfo. * * @param Option The name of option * @return Depends on the option: by default "" (nothing) means No, other means Yes */ public String Option(String Option) { return MediaInfoDLL_Internal.INSTANCE.Option(Handle, new WString(Option), new WString("")).toString(); } /** * Configure or get information about MediaInfo. * * @param Option The name of option * @param Value The value of option * @return Depends on the option: by default "" (nothing) means No, other means Yes */ public String Option(String Option, String Value) { return MediaInfoDLL_Internal.INSTANCE.Option(Handle, new WString(Option), new WString(Value)).toString(); } /** * Configure or get information about MediaInfo (Static version). * * @param Option The name of option * @return Depends on the option: by default "" (nothing) means No, other means Yes */ public static String Option_Static(String Option) { return MediaInfoDLL_Internal.INSTANCE.Option(MediaInfoDLL_Internal.INSTANCE.New(), new WString(Option), new WString("")).toString(); } /** * Configure or get information about MediaInfo(Static version). * * @param Option The name of option * @param Value The value of option * @return Depends on the option: by default "" (nothing) means No, other means Yes */ public static String Option_Static(String Option, String Value) { return MediaInfoDLL_Internal.INSTANCE.Option(MediaInfoDLL_Internal.INSTANCE.New(), new WString(Option), new WString(Value)).toString(); } } MediaInfoLib/Project/Solaris/ 40777 0 0 0 12264020633 11377 5MediaInfoLib/Project/Solaris/mkpkg100777 0 0 6465 12264020304 12541 0#!/bin/bash #Config user=`id -un` group=`id -gn` processor=`uname -p` kernel=`uname -s` release=`uname -r` #Creation of known directories and filenames name="libmediainfo0" version="0.7.67" Home=`pwd` install_prefix=${Home}/mk_package packagecreation_prefix=${Home}/create_package if test -z ${basedir}; then basedir="/" fi #Common code . ./mkpkg.sub #Compile and install cd ../GNU/Library ./autogen ./configure --prefix=${install_prefix} --enable-shared --disable-static $* make if test -e .libs/libmediainfo.so; then echo "Compilation OK" else echo "Compilation problem" exit 1 fi #**************************************************************************** # Release #**************************************************************************** cd ${Home} mkdir -p ${install_prefix} #Copying useful files #bin install -d -m 755 ${install_prefix}/lib cp -rP ../GNU/Library/.libs/*.so* ${install_prefix}/lib #doc install -d -m 755 ${install_prefix}/share/doc/${name} cp ../../*.txt ${install_prefix}/share/doc/${name} chmod 644 ${install_prefix}/share/doc/${name}/*.txt mv ${install_prefix}/share/doc/${name}/History_DLL.txt ${install_prefix}/share/doc/${name}/History.txt cp ../../License.html ${install_prefix}/share/doc/libmediainfo0 chmod 644 ${install_prefix}/share/doc/${name}/*.html #depend file mkdir -p ${packagecreation_prefix} echo "P libzen0" > ${packagecreation_prefix}/depend #Creation of package pkgname="${name}" PackageCreate #**************************************************************************** # Devel #**************************************************************************** cd ${Home} mkdir -p ${install_prefix} #include #include install -d -m 755 ${install_prefix}/include/MediaInfo cp ../../Source/MediaInfo/MediaInfo.h ${install_prefix}/include/MediaInfo/ cp ../../Source/MediaInfo/MediaInfoList.h ${install_prefix}/include/MediaInfo/ cp ../../Source/MediaInfo/MediaInfo_Const.h ${install_prefix}/include/MediaInfo/ chmod 644 ${install_prefix}/include/MediaInfo/* install -d -m 755 ${install_prefix}/include/MediaInfoDLL cp ../../Source/MediaInfoDLL/MediaInfoDLL.cs ${install_prefix}/include/MediaInfoDLL/ cp ../../Source/MediaInfoDLL/MediaInfoDLL.h ${install_prefix}/include/MediaInfoDLL/ cp ../../Source/MediaInfoDLL/MediaInfoDLL_Static.h ${install_prefix}/include/MediaInfoDLL/ cp ../../Source/MediaInfoDLL/MediaInfoDLL.JNA.java ${install_prefix}/include/MediaInfoDLL/ cp ../../Source/MediaInfoDLL/MediaInfoDLL.JNative.java ${install_prefix}/include/MediaInfoDLL/ cp ../../Source/MediaInfoDLL/MediaInfoDLL.py ${install_prefix}/include/MediaInfoDLL/ cp ../../Source/MediaInfoDLL/MediaInfoDLL3.py ${install_prefix}/include/MediaInfoDLL/ chmod 644 ${install_prefix}/include/MediaInfoDLL/* #bin install -d -m 755 ${install_prefix}/bin cp ../GNU/Library/libmediainfo-config ${install_prefix}/bin chmod 755 ${install_prefix}/bin/* #doc install -d -m 755 ${install_prefix}/share/doc/libmediainfo-devel/Example cp ../../Source/Example/HowToUse_Dll* ${install_prefix}/share/doc/libmediainfo-devel/Example chmod 644 ${install_prefix}/share/doc/libmediainfo-devel/Example/* #depend file mkdir -p ${packagecreation_prefix} echo "P ${name}" > ${packagecreation_prefix}/depend pkgname="${name}-devel" PackageCreate exit 0 #hints #install: pkgadd -d./ libmediainfo0 #remove: pkgrm libmediainfo0, remove /var/spool/pkg/libzen0 MediaInfoLib/Project/Solaris/mkpkg.sub100777 0 0 6302 12226004263 13323 0#!/bin/bash PackageCreate() { mkdir -p ${packagecreation_prefix} #checkinstall echo -e "#!/bin/sh" > ${packagecreation_prefix}/checkinstall echo -e "" >> ${packagecreation_prefix}/checkinstall echo -e "expected_platform=\042${processor}\042" >> ${packagecreation_prefix}/checkinstall echo -e "" >> ${packagecreation_prefix}/checkinstall echo -e "platform=\0140uname -p\0140" >> ${packagecreation_prefix}/checkinstall echo -e "" >> ${packagecreation_prefix}/checkinstall echo -e "if [ \044{platform} != \044{expected_platform} ]; then" >> ${packagecreation_prefix}/checkinstall echo -e " echo \042\0134n\0134n\0134n\0134tThis package must be installer on a \044{expected_platform} architecture\0134n\042" >> ${packagecreation_prefix}/checkinstall echo -e " echo \042\0134tAbording intallation.\0134n\0134n\0134n\042" >> ${packagecreation_prefix}/checkinstall echo -e " exit 1" >> ${packagecreation_prefix}/checkinstall echo -e "fi" >> ${packagecreation_prefix}/checkinstall echo -e "" >> ${packagecreation_prefix}/checkinstall echo -e "exit 0" >> ${packagecreation_prefix}/checkinstall #prototype file echo "i pkginfo" > ${packagecreation_prefix}/prototype echo "!default 0755 root bin" >> ${packagecreation_prefix}/prototype echo "i checkinstall" >> ${packagecreation_prefix}/prototype if test -e ${packagecreation_prefix}/depend; then echo "i depend" >> ${packagecreation_prefix}/prototype fi cd ${install_prefix} find . -print > ${packagecreation_prefix}/files cat ${packagecreation_prefix}/files | pkgproto | sed "s/ bin bin/ ? /g" | sed "s/ ${user} / ? /g" | sed "s/ ${group}/ ?/g" >> ${packagecreation_prefix}/prototype #pkginfo file echo "PKG=${pkgname}" > ${packagecreation_prefix}/pkginfo echo "VERSION=${version}" >> ${packagecreation_prefix}/pkginfo echo "ARCH=${processor}" >> ${packagecreation_prefix}/pkginfo echo "NAME=${pkgname} ${version} ${kernel} ${release} ${processor}" >> ${packagecreation_prefix}/pkginfo echo "DESC=Base library for some other projects" >> ${packagecreation_prefix}/pkginfo echo "CLASSES=none" >> ${packagecreation_prefix}/pkginfo echo "CATEGORY=utility" >> ${packagecreation_prefix}/pkginfo echo "VENDOR=MediaArea.net" >> ${packagecreation_prefix}/pkginfo echo "EMAIL=Info@MediaArea.net" >> ${packagecreation_prefix}/pkginfo echo "BASEDIR=${basedir}" >> ${packagecreation_prefix}/pkginfo cd ${packagecreation_prefix} pkgmk -o -b ${install_prefix} -d . -f prototype echo tar -cf - $pkgname | gzip -9 -c >${Home}/${pkgname}-${version}-${processor}.${kernel}_${release}.tar.gz tar -cf - $pkgname | gzip -9 -c >${Home}/${pkgname}-${version}-${processor}.${kernel}_${release}.tar.gz echo pkgtrans ${packagecreation_prefix} ${Home}/${pkgname}-${version}-${processor}.${kernel}_${release}.pkg ${pkgname} pkgtrans ${packagecreation_prefix} ${Home}/${pkgname}-${version}-${processor}.${kernel}_${release}.pkg ${pkgname} echo gzip -9 -cf ${Home}/${pkgname}-${version}-${processor}.${kernel}_${release}.pkg >${Home}/${pkgname}-${version}-${processor}.${kernel}_${release}.pkg.gz gzip -9 -cf ${Home}/${pkgname}-${version}-${processor}.${kernel}_${release}.pkg >${Home}/${pkgname}-${version}-${processor}.${kernel}_${release}.pkg.gz #Removing files cd ${home} rm -rf ${install_prefix} rm -rf ${packagecreation_prefix} } MediaInfoLib/ReadMe.txt100777 0 0 4370 12165355572 10374 0MediaInfo.lib : static library MediaInfo.Dll : dynamic library HowToUse.exe : static-linked example HowToUse_Dll : dynamic-linked example For DLL, there are two versions of functions : - MediaInfoLib_XXX : Unicode version (international, UTF16, 2-byte characters), this is the main version, there is not only English language in the world ;-). So, now, Chinese / French / German languages can be showed at the same time. - MediaInfoLibA_XXX : Deprecated, Ansi version (localized, UTF8, 1-byte characters), as the old DLL : you should link your old code to these functions. MediaInfo library (static and/or shared) can be compiled within these different tools : - Project/BCB : Borland C++ Builder 6 - Project/CMake : cmake, C++ - Project/CodeBlocks : C++ - Project/GNU : g++, C++ - Project/MSVC2005 : Visual Studio 9 (aka 2005), C++ - Project/MSVC2008 : Visual Studio 10 (aka 2008), C++ - Project/MSVC2010 : Visual Studio 11 (aka 2010), C++ - Project/MSVC2012 : Visual Studio 12 (aka 2012), C++ - Project/Solaris : g++, C++ Examples for using the MediaInfo library are given under those folders : - Project/Delphi : Borland Delphi 7 - Project/Java : Java - Project/MSCS2008 : Visual Studio 10 (aka 2008), C# - Project/MSCS2010 : Visual Studio 11 (aka 2010), C# - Project/MSJS : Visual Studio 7.1 (aka 2003), J# - Project/MSVB : Visual Studio 7.1 (aka 2003), Basic (and no more VB6 code) - Project/MSVB2010 : Visual Studio 11 (aka 2010), Basic - Project/NetBeans : Java binding - Project/PureBasic : Basic MediaInfo library needs only 2 extra libraries to compile properly : - zenlib.lib - zlib.lib You can enable or disable format support with Compilation macro defines : MEDIAINFO_XXX_NO or MEDIAINFO_XXX_YES (if both are defined, NO is choosen) XXX may be : - VIDEO (all videos) - AUDIO (all audios) - RIFF : Microsoft Avi, Wav... - OGG : Ogg, Ogm... - MPEG : Mpg, Mpeg, Vob... - MPEG4 : Mp4, M4a, M4v... - MPEGA : mpa, mp2, mp3... - MPEGV : mpv, m2v... - WM : Wma, Wmv... - QT : Qt, Mov... - RM : Rm, Rmvb... - DVDV : Ifo of DVD - AAC : Aac - DTS : Dts - AC3 : Ac3 - MK : Matroska - APE : Monkey Audio, Ape, Mac... - FLAC : Flac - SNDFILE : SndFile related - etc... MediaInfoLib/Release/ 40777 0 0 0 12264020633 7735 5MediaInfoLib/Release/CleanUp.bat100777 0 0 6052 12213360364 12061 0@rem Copyright (c) MediaArea.net SARL. All Rights Reserved. @rem @rem Use of this source code is governed by a BSD-style license that can @rem be found in the License.html file in the root of the source tree. @rem @rem echo off @rem --- General --- cd .. del *.~* *.obj *.o *.tds *.dcu *.ddp *.opt *.ncb *.suo *.ilk *.idb *.pdb *.pch *.plg *.aps *.user *.win *.layout *.local *.depend *.identcache *.tgs *.tgw *.sdf /Q /S del *.~* *.obj *.o *.tds *.dcu *.ddp *.opt *.ncb *.suo *.ilk *.idb *.pdb *.pch *.plg *.aps *.user *.win *.layout *.local *.depend *.identcache *.tgs *.tgw *.sdf /AH /Q /S del *.ogg *.ogm *.avi *.mkv /Q /S del *.ogg *.ogm *.avi *.mkv /AH /Q /S cd Release @rem --- In Project files --- cd ..\Project del *.exe *.dll *.a *.lib *.exp *.class *.zip *.7z /Q /S del *.exe *.dll *.a *.lib *.exp *.class *.zip *.7z /AH /Q /S cd ..\Release @rem MS Visual Studio specific --- cd ..\Project rmdir MSCS\Example\bin /Q /S rmdir MSCS\Example\obj /Q /S rmdir MSJS\Example\bin /Q /S rmdir MSJS\Example\obj /Q /S rmdir MSVB\Example\bin /Q /S rmdir MSVB\Example\obj /Q /S rmdir MSVC\Dll\Release /Q /S rmdir MSVC\Dll\Release_Ansi /Q /S rmdir MSVC\Example\Release /Q /S rmdir MSVC\Example\Release_Ansi /Q /S rmdir MSVC\Library\Release /Q /S rmdir MSVC\Library\Release_Ansi /Q /S cd ..\Release @rem Borland Developper Studio specific --- cd ..\Source rmdir Example\__history /Q /S rmdir MediaInfo\__history /Q /S rmdir MediaInfo\Archive\__history /Q /S rmdir MediaInfo\Audio\__history /Q /S rmdir MediaInfo\Image\__history /Q /S rmdir MediaInfo\Multiple\__history /Q /S rmdir MediaInfo\Text\__history /Q /S rmdir MediaInfo\Video\__history /Q /S rmdir MediaInfoDLL\__history /Q /S rmdir PreRelease\__history /Q /S rmdir PreRelease\VCL\__history /Q /S rmdir PreRelease\WxWidgets\__history /Q /S cd ..\Release cd ..\Project rmdir BCB\__history /Q /S rmdir BCB\Dll\__history /Q /S rmdir BCB\Dll\Debug_Build /Q /S rmdir BCB\Dll\Release_Build /Q /S rmdir BCB\Example\__history /Q /S rmdir BCB\Example\Debug_Build /Q /S rmdir BCB\Example\Release_Build /Q /S rmdir BCB\Library\__history /Q /S rmdir BCB\Library\Debug_Build /Q /S rmdir BCB\Library\Release_Build /Q /S rmdir BCB\PreRelease\__history /Q /S rmdir BCB\PreRelease\Debug_Build /Q /S rmdir BCB\PreRelease\Release_Build /Q /S rmdir Delphi\__history /Q /S rmdir Delphi\Example\__history /Q /S rmdir Delphi\Example\ModelSupport /Q /S rmdir MSVC\DLL\Win32 /Q /S rmdir MSVC\DLL\x64 /Q /S rmdir MSVC\Example\Win32 /Q /S rmdir MSVC\Example\x64 /Q /S rmdir MSVC\Library\Win32 /Q /S rmdir MSVC\Library\x64 /Q /S cd ..\Release @rem Code::Blocks specific --- cd ..\Project rmdir CodeBlocks\Dll\.objs /Q /S rmdir CodeBlocks\Library\.objs /Q /S rmdir CodeBlocks\PreRelease\.objs /Q /S cd ..\Release @rem GCC specific --- cd ..\Project rmdir GCC\Example\.deps /Q /S rmdir GCC\Example\.objs /Q /S rmdir GCC\Library\.deps /Q /S rmdir GCC\Library\.objs /Q /S cd ..\Release @rem Release specific --- del *.zip *.gz *.bz2 *.lib *.dll *.exp *.a *.so *.7z /Q /S del MediaInfo*.exe MediaInfoLib/Release/Example.ogg100777 0 0 11367 12165355572 12173 0OggSF7vorbisDOggSFj "IvorbisXiph.Org libVorbis I 20030308 TITLE=Test for Unicode (UTF-8)5ARABIC=ئابةتثجحخدذرزسشصضطظعغـف9HEBREW=אבגדהוזחטיךכלםמןנסעףפץצְֱ$COMBINERS=ˆˇˉ˘˙˚˛˜̣̀́̃̉%CYRILLIC=ЁЂЃЄЅІЇЈЉЊЋЌЎЏ#ENGLISH=abcdefghaijklmnopqrstuvwxyz2FRENCH=aàäâåáãæÅÆ cçÇ eéèëê uùüû8GREEK=αβγδεζηθικλμνξοπρςστυφχψωLATIN=ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņvorbis)BCV"L ÀАU6kc(Fbj1c,Fb1c1c1c 4d@1B9Q)9ʼn0X!R̡J9 Y@H!RH!RH!RJ)b)b)r1 2褓N:$B RJk{{{{9BCV B!B!RH!b)АU KMS%S2%Sr-2-S3=3EUtUSUeueS6eS6eU6eS6eS6eՕeYeYeYeYeYe 4d #9#)8Hd`(H$YeYg陞ii iiiiiiifYeYeYeYeYeYeYeYeYeYeYeYeY@h*@@qqqGr$ Y@R$r4Gs4s
(redirecting)
MediaInfoLib/Source/Doc/Doxyfile100777 0 0 7453 12143713362 12145 0# Doxyfile 1.5.4 #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = MediaInfoLib PROJECT_NUMBER = 0.7 PROJECT_LOGO = OUTPUT_DIRECTORY = ./ OUTPUT_LANGUAGE = English REPEAT_BRIEF = YES ABBREVIATE_BRIEF = FULL_PATH_NAMES = NO BUILTIN_STL_SUPPORT = YES OPTIMIZE_OUTPUT_FOR_C = NO #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- EXTRACT_ALL = NO #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- QUIET = YES WARNINGS = YES WARN_IF_UNDOCUMENTED = YES WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = YES #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = ../MediaInfo/MediaInfo_Const.h \ ../MediaInfo/MediaInfoList.h \ ../MediaInfo/MediaInfo.h \ ../MediaInfoDLL/MediaInfoDLL.h #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = NO COLS_IN_ALPHA_INDEX = 5 #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = ../../Doc HTML_FILE_EXTENSION = .html HTML_HEADER = HTML_FOOTER = HTML_STYLESHEET = #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- GENERATE_LATEX = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- GENERATE_RTF = NO #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- GENERATE_MAN = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- GENERATE_XML = NO #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO MediaInfoLib/Source/Doc/setlocale.txt100777 0 0 1470 12063042306 13136 0However, setlocale(LC_ALL, "") does the trick... only in a standalone app. When running as daemon LC_ALL is set by Suse to POSIX (Fedora and others do it as well) and any call to setlocale() from within the daemon code results either in NULL or complete garbage and changes nothing. The only way I could fix the locale problem is having extended the startup script for the mediatomb service by this part: . /etc/sysconfig/language locale_vars=" \ LANG \ LC_CTYPE \ LC_NUMERIC \ LC_TIME \ LC_COLLATE \ LC_MONETARY \ LC_MESSAGES \ LC_PAPER \ LC_NAME \ LC_ADDRESS \ LC_TELEPHONE \ LC_MEASUREMENT \ LC_IDENTIFICATION \ LC_ALL" unset LC_ALL for tmplc in $locale_vars do eval tmpval="\$RC_$tmplc" if test -n "$tmpval"; then eval $tmplc="\$RC_$tmplc" export $tmplc fi done unset tmplc tmpvalMediaInfoLib/Source/Example/ 40777 0 0 0 12264020623 11207 5MediaInfoLib/Source/Example/HowToUse.cpp100777 0 0 5632 12226004261 13534 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Example for MediaInfoLib // Command line version // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #include #include #include "ZenLib/Ztring.h" //Note : I need it for universal atoi, but you have not to use it for be able to use MediaInfoLib #include "MediaInfo/MediaInfo.h" using namespace MediaInfoLib; using namespace ZenLib; int main (int argc, char *argv[]) { //Information about MediaInfo MediaInfo MI; ZenLib::Ztring To_Display=MI.Option(__T("Info_Version"), __T("0.7.0.0;MediaInfoDLL_Example_MSVC;0.7.0.0")).c_str(); To_Display += __T("\r\n\r\nInfo_Parameters\r\n"); To_Display += MI.Option(__T("Info_Parameters")).c_str(); To_Display += __T("\r\n\r\nInfo_Capacities\r\n"); To_Display += MI.Option(__T("Info_Capacities")).c_str(); To_Display += __T("\r\n\r\nInfo_Codecs\r\n"); To_Display += MI.Option(__T("Info_Codecs")).c_str(); //An example of how to use the library To_Display += __T("\r\n\r\nOpen\r\n"); MI.Open(__T("Example.ogg")); To_Display += __T("\r\n\r\nInform with Complete=false\r\n"); MI.Option(__T("Complete")); To_Display += MI.Inform().c_str(); To_Display += __T("\r\n\r\nInform with Complete=true\r\n"); MI.Option(__T("Complete"), __T("1")); To_Display += MI.Inform().c_str(); To_Display += __T("\r\n\r\nCustom Inform\r\n"); MI.Option(__T("Inform"), __T("General;Example : FileSize=%FileSize%")); To_Display += MI.Inform().c_str(); To_Display += __T("\r\n\r\nGet with Stream=General and Parameter=\"FileSize\"\r\n"); To_Display += MI.Get(Stream_General, 0, __T("FileSize"), Info_Text, Info_Name).c_str(); To_Display += __T("\r\n\r\nGetI with Stream=General and Parameter=46\r\n"); To_Display += MI.Get(Stream_General, 0, 46, Info_Text).c_str(); To_Display += __T("\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n"); To_Display += ZenLib::Ztring::ToZtring(MI.Count_Get(Stream_Audio, -1)); //Warning : this is an integer To_Display += __T("\r\n\r\nGet with Stream=General and Parameter=\"AudioCount\"\r\n"); To_Display += MI.Get(Stream_General, 0, __T("AudioCount"), Info_Text, Info_Name).c_str(); To_Display += __T("\r\n\r\nGet with Stream=Audio and Parameter=\"StreamCount\"\r\n"); To_Display += MI.Get(Stream_Audio, 0, __T("StreamCount"), Info_Text, Info_Name).c_str(); To_Display += __T("\r\n\r\nClose\r\n"); MI.Close(); std::cout< #include using namespace MediaInfoNameSpace; #ifdef __MINGW32__ #ifdef _UNICODE #define _itot _itow #else //_UNICODE #define _itot itoa #endif //_UNICODE #endif //__MINGW32 int main (int /*argc*/, Char * /*argv[]*/) { //Information about MediaInfo MediaInfo MI; String To_Display=MI.Option(__T("Info_Version"), __T("0.7.13;MediaInfoDLL_Example_MSVC;0.7.13")).c_str(); To_Display += __T("\r\n\r\nInfo_Parameters\r\n"); To_Display += MI.Option(__T("Info_Parameters")).c_str(); To_Display += __T("\r\n\r\nInfo_Codecs\r\n"); To_Display += MI.Option(__T("Info_Codecs")).c_str(); //An example of how to use the library To_Display += __T("\r\n\r\nOpen\r\n"); MI.Open(__T("Example.ogg")); To_Display += __T("\r\n\r\nInform with Complete=false\r\n"); MI.Option(__T("Complete")); To_Display += MI.Inform().c_str(); To_Display += __T("\r\n\r\nInform with Complete=true\r\n"); MI.Option(__T("Complete"), __T("1")); To_Display += MI.Inform().c_str(); To_Display += __T("\r\n\r\nCustom Inform\r\n"); MI.Option(__T("Inform"), __T("General;Example : FileSize=%FileSize%")); To_Display += MI.Inform().c_str(); To_Display += __T("\r\n\r\nGet with Stream=General and Parameter=\"FileSize\"\r\n"); To_Display += MI.Get(Stream_General, 0, __T("FileSize"), Info_Text, Info_Name).c_str(); To_Display += __T("\r\n\r\nGetI with Stream=General and Parameter=46\r\n"); To_Display += MI.Get(Stream_General, 0, 46, Info_Text).c_str(); To_Display += __T("\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n"); #ifdef __MINGW32__ Char* C1=new Char[33]; _itot (MI.Count_Get(Stream_Audio), C1, 10); To_Display +=C1; delete[] C1; #else toStringStream SS; SS << std::setbase(10) << MI.Count_Get(Stream_Audio); To_Display += SS.str(); #endif To_Display += __T("\r\n\r\nGet with Stream=General and Parameter=\"AudioCount\"\r\n"); To_Display += MI.Get(Stream_General, 0, __T("AudioCount"), Info_Text, Info_Name).c_str(); To_Display += __T("\r\n\r\nGet with Stream=Audio and Parameter=\"StreamCount\"\r\n"); To_Display += MI.Get(Stream_Audio, 0, __T("StreamCount"), Info_Text, Info_Name).c_str(); To_Display += __T("\r\n\r\nClose\r\n"); MI.Close(); #ifdef _UNICODE std::wcout << To_Display; #else std::cout << To_Display; #endif return 0; } //*************************************************************************** // By buffer example //*************************************************************************** /* //--------------------------------------------------------------------------- //Note: you can replace file operations by your own buffer management class #include int main (int argc, Char *argv[]) { //From: preparing an example file for reading FILE* F=fopen("Example.ogg", "rb"); //You can use something else than a file if (F==0) return 1; //From: preparing a memory buffer for reading unsigned char* From_Buffer=new unsigned char[7*188]; //Note: you can do your own buffer size_t From_Buffer_Size; //The size of the read file buffer //From: retrieving file size fseek(F, 0, SEEK_END); long F_Size=ftell(F); fseek(F, 0, SEEK_SET); //Initializing MediaInfo MediaInfo MI; //Preparing to fill MediaInfo with a buffer MI.Open_Buffer_Init(F_Size, 0); //The parsing loop do { //Reading data somewhere, do what you want for this. From_Buffer_Size=fread(From_Buffer, 1, 7*188, F); //Sending the buffer to MediaInfo size_t Status=MI.Open_Buffer_Continue(From_Buffer, From_Buffer_Size); if (Status&0x08) //Bit3=Finished break; //Testing if there is a MediaInfo request to go elsewhere if (MI.Open_Buffer_Continue_GoTo_Get()!=(MediaInfo_int64u)-1) { fseek(F, (long)MI.Open_Buffer_Continue_GoTo_Get(), SEEK_SET); //Position the file MI.Open_Buffer_Init(F_Size, ftell(F)); //Informing MediaInfo we have seek } } while (From_Buffer_Size>0); //Finalizing MI.Open_Buffer_Finalize(); //This is the end of the stream, MediaInfo must finnish some work //Get() example String To_Display=MI.Get(Stream_General, 0, __T("Format")); #ifdef _UNICODE std::wcout << To_Display; #else std::cout << To_Display; #endif } */ MediaInfoLib/Source/Example/HowToUse_Dll.cs100777 0 0 17555 12252325366 14214 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Microsoft Visual C# example // // To make this example working, you must put MediaInfo.Dll and Example.ogg // in the "./Bin/__ConfigurationName__" folder // and add MediaInfoDll.cs to your project // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Text; using System.IO; using MediaInfoLib; namespace MediaInfoLib_MSCS { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.RichTextBox richTextBox1; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Mthode requise pour la prise en charge du concepteur - ne modifiez pas /// le contenu de cette mthode avec l'diteur de code. /// private void InitializeComponent() { this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.SuspendLayout(); // // richTextBox1 // this.richTextBox1.Location = new System.Drawing.Point(0, 0); this.richTextBox1.Name = "richTextBox1"; this.richTextBox1.Size = new System.Drawing.Size(768, 512); this.richTextBox1.TabIndex = 0; this.richTextBox1.Text = ""; // // Form1 // this.ClientSize = new System.Drawing.Size(770, 514); this.Controls.Add(this.richTextBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "How to use MediaInfo.Dll"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); } #endregion /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.Run(new Form1()); } private void Form1_Load(object sender, System.EventArgs e) { //Test if version of DLL is compatible : 3rd argument is "version of DLL tested;Your application name;Your application version" String ToDisplay; MediaInfo MI = new MediaInfo(); ToDisplay = MI.Option("Info_Version", "0.7.0.0;MediaInfoDLL_Example_CS;0.7.0.0"); if (ToDisplay.Length == 0) { richTextBox1.Text = "MediaInfo.Dll: this version of the DLL is not compatible"; return; } //Information about MediaInfo ToDisplay += "\r\n\r\nInfo_Parameters\r\n"; ToDisplay += MI.Option("Info_Parameters"); ToDisplay += "\r\n\r\nInfo_Capacities\r\n"; ToDisplay += MI.Option("Info_Capacities"); ToDisplay += "\r\n\r\nInfo_Codecs\r\n"; ToDisplay += MI.Option("Info_Codecs"); //An example of how to use the library ToDisplay += "\r\n\r\nOpen\r\n"; MI.Open("Example.ogg"); ToDisplay += "\r\n\r\nInform with Complete=false\r\n"; MI.Option("Complete"); ToDisplay += MI.Inform(); ToDisplay += "\r\n\r\nInform with Complete=true\r\n"; MI.Option("Complete", "1"); ToDisplay += MI.Inform(); ToDisplay += "\r\n\r\nCustom Inform\r\n"; MI.Option("Inform", "General;File size is %FileSize% bytes"); ToDisplay += MI.Inform(); ToDisplay += "\r\n\r\nGet with Stream=General and Parameter='FileSize'\r\n"; ToDisplay += MI.Get(0, 0, "FileSize"); ToDisplay += "\r\n\r\nGet with Stream=General and Parameter=46\r\n"; ToDisplay += MI.Get(0, 0, 46); ToDisplay += "\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n"; ToDisplay += MI.Count_Get(StreamKind.Audio); ToDisplay += "\r\n\r\nGet with Stream=General and Parameter='AudioCount'\r\n"; ToDisplay += MI.Get(StreamKind.General, 0, "AudioCount"); ToDisplay += "\r\n\r\nGet with Stream=Audio and Parameter='StreamCount'\r\n"; ToDisplay += MI.Get(StreamKind.Audio, 0, "StreamCount"); ToDisplay += "\r\n\r\nClose\r\n"; MI.Close(); //Example with a stream //ToDisplay+="\r\n"+ExampleWithStream()+"\r\n"; //Displaying the text richTextBox1.Text = ToDisplay; } String ExampleWithStream() { //Initilaizing MediaInfo MediaInfo MI = new MediaInfo(); //From: preparing an example file for reading FileStream From = new FileStream("Example.ogg", FileMode.Open, FileAccess.Read); //From: preparing a memory buffer for reading byte[] From_Buffer = new byte[64*1024]; int From_Buffer_Size; //The size of the read file buffer //Preparing to fill MediaInfo with a buffer MI.Open_Buffer_Init(From.Length, 0); //The parsing loop do { //Reading data somewhere, do what you want for this. From_Buffer_Size = From.Read(From_Buffer, 0, 64 * 1024); //Sending the buffer to MediaInfo System.Runtime.InteropServices.GCHandle GC = System.Runtime.InteropServices.GCHandle.Alloc(From_Buffer, System.Runtime.InteropServices.GCHandleType.Pinned); IntPtr From_Buffer_IntPtr = GC.AddrOfPinnedObject(); Status Result = (Status)MI.Open_Buffer_Continue(From_Buffer_IntPtr, (IntPtr)From_Buffer_Size); GC.Free(); if ((Result & Status.Finalized) == Status.Finalized) break; //Testing if MediaInfo request to go elsewhere if (MI.Open_Buffer_Continue_GoTo_Get() != -1) { Int64 Position = From.Seek(MI.Open_Buffer_Continue_GoTo_Get(), SeekOrigin.Begin); //Position the file MI.Open_Buffer_Init(From.Length, Position); //Informing MediaInfo we have seek } } while (From_Buffer_Size > 0); //Finalizing MI.Open_Buffer_Finalize(); //This is the end of the stream, MediaInfo must finnish some work //Get() example return "Container format is " + MI.Get(StreamKind.General, 0, "Format"); } } } MediaInfoLib/Source/Example/HowToUse_Dll.JNA.java100777 0 0 4761 12226004261 15077 0/* 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. */ class HowToUse_Dll { public static void main(String... args) throws Exception { String FileName = "Example.ogg"; if (args.length > 0) FileName = args[0]; String To_Display = ""; //Info about the library To_Display += MediaInfo.Option_Static("Info_Version"); To_Display += "\r\n\r\nInfo_Parameters\r\n"; To_Display += MediaInfo.Option_Static("Info_Parameters"); To_Display += "\r\n\r\nInfo_Capacities\r\n"; To_Display += MediaInfo.Option_Static("Info_Capacities"); To_Display += "\r\n\r\nInfo_Codecs\r\n"; To_Display += MediaInfo.Option_Static("Info_Codecs"); //An example of how to use the library MediaInfo MI = new MediaInfo(); To_Display += "\r\n\r\nOpen\r\n"; if (MI.Open(FileName)>0) To_Display+="is OK\r\n"; else To_Display+="has a problem\r\n"; To_Display += "\r\n\r\nInform with Complete=false\r\n"; MI.Option("Complete", ""); To_Display += MI.Inform(); To_Display += "\r\n\r\nInform with Complete=true\r\n"; MI.Option("Complete", "1"); To_Display += MI.Inform(); To_Display += "\r\n\r\nCustom Inform\r\n"; MI.Option("Inform", "General;Example : FileSize=%FileSize%"); To_Display += MI.Inform(); To_Display += "\r\n\r\nGetI with Stream=General and Parameter=2\r\n"; To_Display += MI.Get(MediaInfo.StreamKind.General, 0, 2, MediaInfo.InfoKind.Text); To_Display += "\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n"; To_Display += MI.Count_Get(MediaInfo.StreamKind.Audio, -1); To_Display += "\r\n\r\nGet with Stream=General and Parameter=\"AudioCount\"\r\n"; To_Display += MI.Get(MediaInfo.StreamKind.General, 0, "AudioCount", MediaInfo.InfoKind.Text, MediaInfo.InfoKind.Name); To_Display += "\r\n\r\nGet with Stream=Audio and Parameter=\"StreamCount\"\r\n"; To_Display += MI.Get(MediaInfo.StreamKind.Audio, 0, "StreamCount", MediaInfo.InfoKind.Text, MediaInfo.InfoKind.Name); To_Display += "\r\n\r\nGet with Stream=General and Parameter=\"FileSize\"\r\n"; To_Display += MI.Get(MediaInfo.StreamKind.General, 0, "FileSize", MediaInfo.InfoKind.Text, MediaInfo.InfoKind.Name); To_Display += "\r\n\r\nClose\r\n"; MI.Close(); System.out.println(To_Display); } } MediaInfoLib/Source/Example/HowToUse_Dll.JNative.java100777 0 0 4720 12226004261 16022 0/* 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. */ class HowToUse_Dll { public static void main(String... args) throws Exception { String File_Name = "Example.ogg"; if (args.length > 0) File_Name = args[0]; String To_Display = ""; //Info about the library To_Display += MediaInfo.Option_Static("Info_Version"); To_Display += "\r\n\r\nInfo_Parameters\r\n"; To_Display += MediaInfo.Option_Static("Info_Parameters"); To_Display += "\r\n\r\nInfo_Capacities\r\n"; To_Display += MediaInfo.Option_Static("Info_Capacities"); To_Display += "\r\n\r\nInfo_Codecs\r\n"; To_Display += MediaInfo.Option_Static("Info_Codecs"); //An example of how to use the library MediaInfo MI = new MediaInfo(); To_Display += "\r\n\r\nOpen\r\n"; if (MI.Open(File_Name)>0) To_Display+="is OK\r\n"; else To_Display+="has a problem\r\n"; To_Display += "\r\n\r\nInform with Complete=false\r\n"; MI.Option("Complete", ""); To_Display += MI.Inform(); To_Display += "\r\n\r\nInform with Complete=true\r\n"; MI.Option("Complete", "1"); To_Display += MI.Inform(); To_Display += "\r\n\r\nCustom Inform\r\n"; MI.Option("Inform", "General;Example : FileSize=%FileSize%"); To_Display += MI.Inform(); To_Display += "\r\n\r\nGetI with Stream=General and Parameter=2\r\n"; To_Display += MI.Get(MediaInfo.Stream_General, 0, 2, MediaInfo.Info_Text); To_Display += "\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n"; To_Display += MI.Count_Get(MediaInfo.Stream_Audio, -1); To_Display += "\r\n\r\nGet with Stream=General and Parameter=\"AudioCount\"\r\n"; To_Display += MI.Get(MediaInfo.Stream_General, 0, "AudioCount", MediaInfo.Info_Text, MediaInfo.Info_Name); To_Display += "\r\n\r\nGet with Stream=Audio and Parameter=\"StreamCount\"\r\n"; To_Display += MI.Get(MediaInfo.Stream_Audio, 0, "StreamCount", MediaInfo.Info_Text, MediaInfo.Info_Name); To_Display += "\r\n\r\nGet with Stream=General and Parameter=\"FileSize\"\r\n"; To_Display += MI.Get(MediaInfo.Stream_General, 0, "FileSize", MediaInfo.Info_Text, MediaInfo.Info_Name); To_Display += "\r\n\r\nClose\r\n"; MI.Close(); System.out.println(To_Display); } } MediaInfoLib/Source/Example/HowToUse_Dll.py100777 0 0 4554 12226004261 14177 0## 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. ## #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # # Python (Windows) example # # To make this example working, you must put MediaInfo.Dll and test.avi # in the same folder # #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # # Should be "import MediaInfoDLL" but does not work, why? # How to import MediaInfoDLL.py correctly? # Example following # #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ from MediaInfoDLL import * MI = MediaInfo() Version=MI.Option_Static("Info_Version", "0.7.7.0;MediaInfoDLL_Example_Python;0.7.7.0") if Version=="": print "MediaInfo.Dll: this version of the DLL is not compatible" exit #Information about MediaInfo print "Info_Parameters" print MI.Option_Static(u"Info_Parameters") print print "Info_Capacities" print MI.Option_Static(u"Info_Capacities") print print "Info_Codecs" print MI.Option_Static(u"Info_Codecs") #An example of how to use the library print print "Open" MI.Open(u"Example.ogg") print print "Inform with Complete=false" MI.Option_Static("Complete") print MI.Inform() print print "Inform with Complete=true" MI.Option_Static(u"Complete", u"1") print MI.Inform() print print "Custom Inform" MI.Option_Static(u"Inform", u"General;Example : FileSize=%FileSize%") print MI.Inform() print print "Get with Stream=General and Parameter='FileSize'" print MI.Get(Stream.General, 0, u"FileSize") print print "GetI with Stream=General and Parameter=46" print MI.GetI(Stream.General, 0, 46) print print "Count_Get with StreamKind=Stream_Audio" print MI.Count_Get(Stream.Audio) print print "Get with Stream=General and Parameter='AudioCount'" print MI.Get(Stream.General, 0, u"AudioCount") print print "Get with Stream=Audio and Parameter='StreamCount'" print MI.Get(Stream.Audio, 0, u"StreamCount") print print "Close" MI.Close() MediaInfoLib/Source/Example/HowToUse_Dll3.py100777 0 0 4644 12226004261 14262 0## 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. ## #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # # Python (Windows) example # # To make this example working, you must put MediaInfo.Dll and test.avi # in the same folder # #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # # Should be "import MediaInfoDLL" but does not work, why? # How to import MediaInfoDLL.py correctly? # Example following # #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ from MediaInfoDLL3 import * MI = MediaInfo() Version=MI.Option_Static("Info_Version", "0.7.7.0;MediaInfoDLL_Example_Python;0.7.7.0") if Version=="": print("MediaInfo.Dll: this version of the DLL is not compatible") exit #Information about MediaInfo print("Info_Parameters") MI.Option_Static("Info_Parameters") print("") print("Info_Capacities") print(MI.Option_Static("Info_Capacities")) print("") print("Info_Codecs") print(MI.Option_Static("Info_Codecs")) #An example of how to use the library print("") print("Open") MI.Open("Example.ogg") print("") print("Inform with Complete=false") MI.Option_Static("Complete") print(MI.Inform()) print("") print("Inform with Complete=true") MI.Option_Static("Complete", "1") print(MI.Inform()) print("") print("Custom Inform") MI.Option_Static("Inform", "General;Example : FileSize=%FileSize%") print(MI.Inform()) print("") print("Get with Stream=General and Parameter='FileSize'") print(MI.Get(Stream.General, 0, "FileSize")) print("") print("GetI with Stream=General and Parameter=46") print(MI.GetI(Stream.General, 0, 46)) print("") print("Count_Get with StreamKind=Stream_Audio") print(MI.Count_Get(Stream.Audio)) print("") print("Get with Stream=General and Parameter='AudioCount'") print(MI.Get(Stream.General, 0, "AudioCount")) print("") print("Get with Stream=Audio and Parameter='StreamCount'") print(MI.Get(Stream.Audio, 0, "StreamCount")) print("") print("Close") MI.Close() MediaInfoLib/Source/Example/HowToUse_Dll_CLI.cs100777 0 0 6167 12226004261 14645 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Microsoft Visual C# example // // To make this example working, you must put MediaInfo.Dll and Example.ogg // in the "./Bin/__ConfigurationName__" folder // and add MediaInfoDll.cs to your project // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ using System; using MediaInfoLib; namespace MediaInfoLib_MSCS { public class CLI { [STAThread] static void Main(string[] Args) { String ToDisplay; MediaInfo MI = new MediaInfo(); ToDisplay = MI.Option("Info_Version", "0.7.0.0;MediaInfoDLL_Example_CS;0.7.0.0"); if (ToDisplay.Length == 0) { Console.Out.WriteLine("MediaInfo.Dll: this version of the DLL is not compatible"); return; } //Information about MediaInfo ToDisplay += "\r\n\r\nInfo_Parameters\r\n"; ToDisplay += MI.Option("Info_Parameters"); ToDisplay += "\r\n\r\nInfo_Capacities\r\n"; ToDisplay += MI.Option("Info_Capacities"); ToDisplay += "\r\n\r\nInfo_Codecs\r\n"; ToDisplay += MI.Option("Info_Codecs"); //An example of how to use the library ToDisplay += "\r\n\r\nOpen\r\n"; String File_Name; if (Args.Length == 0) File_Name = "Example.ogg"; else File_Name = Args[0]; MI.Open(File_Name); ToDisplay += "\r\n\r\nInform with Complete=false\r\n"; MI.Option("Complete"); ToDisplay += MI.Inform(); ToDisplay += "\r\n\r\nInform with Complete=true\r\n"; MI.Option("Complete", "1"); ToDisplay += MI.Inform(); ToDisplay += "\r\n\r\nCustom Inform\r\n"; MI.Option("Inform", "General;File size is %FileSize% bytes"); ToDisplay += MI.Inform(); ToDisplay += "\r\n\r\nGet with Stream=General and Parameter='FileSize'\r\n"; ToDisplay += MI.Get(0, 0, "FileSize"); ToDisplay += "\r\n\r\nGet with Stream=General and Parameter=46\r\n"; ToDisplay += MI.Get(0, 0, 46); ToDisplay += "\r\n\r\nCount_Get with StreamKind=Stream_Audio\r\n"; ToDisplay += MI.Count_Get(StreamKind.Audio); ToDisplay += "\r\n\r\nGet with Stream=General and Parameter='AudioCount'\r\n"; ToDisplay += MI.Get(StreamKind.General, 0, "AudioCount"); ToDisplay += "\r\n\r\nGet with Stream=Audio and Parameter='StreamCount'\r\n"; ToDisplay += MI.Get(StreamKind.Audio, 0, "StreamCount"); ToDisplay += "\r\n\r\nClose\r\n"; MI.Close(); //Displaying the text Console.Out.WriteLine(ToDisplay); } } } MediaInfoLib/Source/Install/ 40777 0 0 0 12264020623 11222 5MediaInfoLib/Source/Install/MediaInfo_DLL_Windows_i386.nsi100777 0 0 13734 12263444455 16712 0; Request application privileges for Windows Vista RequestExecutionLevel admin ; Some defines !define PRODUCT_NAME "MediaInfo" !define PRODUCT_PUBLISHER "MediaArea.net" !define PRODUCT_VERSION "0.7.66" !define PRODUCT_VERSION4 "${PRODUCT_VERSION}.0" !define PRODUCT_WEB_SITE "http://MediaArea.net/MediaInfo" !define COMPANY_REGISTRY "Software\MediaArea.net" !define PRODUCT_REGISTRY "Software\MediaArea.net\MediaInfo.dll" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\MediaInfo.dll" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}.dll" !define PRODUCT_UNINST_ROOT_KEY "HKLM" ; Compression SetCompressor /FINAL /SOLID lzma ; x64 stuff !include "x64.nsh" ; File size !include FileFunc.nsh !include WinVer.nsh ; Modern UI !include "MUI2.nsh" !define MUI_ABORTWARNING !define MUI_ICON "..\..\..\MediaInfo\Source\Resource\Image\MediaInfo.ico" ; Language Selection Dialog Settings !define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}" !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}" !define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language" ; Installer pages !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH ; Uninstaller pages !insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH ; Language files !insertmacro MUI_LANGUAGE "Arabic" !insertmacro MUI_LANGUAGE "Albanian" !insertmacro MUI_LANGUAGE "Belarusian" !insertmacro MUI_LANGUAGE "Catalan" !insertmacro MUI_LANGUAGE "Croatian" !insertmacro MUI_LANGUAGE "Czech" !insertmacro MUI_LANGUAGE "Dutch" !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "Farsi" !insertmacro MUI_LANGUAGE "French" !insertmacro MUI_LANGUAGE "German" !insertmacro MUI_LANGUAGE "Greek" !insertmacro MUI_LANGUAGE "Korean" !insertmacro MUI_LANGUAGE "Hungarian" !insertmacro MUI_LANGUAGE "Italian" !insertmacro MUI_LANGUAGE "Japanese" !insertmacro MUI_LANGUAGE "Lithuanian" !insertmacro MUI_LANGUAGE "Polish" !insertmacro MUI_LANGUAGE "Portuguese" !insertmacro MUI_LANGUAGE "PortugueseBR" !insertmacro MUI_LANGUAGE "Romanian" !insertmacro MUI_LANGUAGE "Russian" !insertmacro MUI_LANGUAGE "SimpChinese" !insertmacro MUI_LANGUAGE "Spanish" !insertmacro MUI_LANGUAGE "Swedish" !insertmacro MUI_LANGUAGE "Thai" !insertmacro MUI_LANGUAGE "TradChinese" !insertmacro MUI_LANGUAGE "Turkish" !insertmacro MUI_RESERVEFILE_LANGDLL ; Info VIProductVersion "${PRODUCT_VERSION4}" VIAddVersionKey "CompanyName" "${PRODUCT_PUBLISHER}" VIAddVersionKey "ProductName" "${PRODUCT_NAME}" VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION4}" VIAddVersionKey "FileDescription" "All about your audio and video files" VIAddVersionKey "FileVersion" "${PRODUCT_VERSION4}" VIAddVersionKey "LegalCopyright" "${PRODUCT_PUBLISHER}" VIAddVersionKey "OriginalFilename" "${PRODUCT_NAME}_DLL_${PRODUCT_VERSION}_Windows_i386.exe" BrandingText " " ; Modern UI end Name "${PRODUCT_NAME}.dll ${PRODUCT_VERSION}" OutFile "..\..\Release\MediaInfo_DLL_${PRODUCT_VERSION}_Windows_i386.exe" InstallDir "$PROGRAMFILES\MediaInfo.dll" InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" ShowInstDetails nevershow ShowUnInstDetails nevershow Function .onInit ${If} ${RunningX64} MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2 'You are trying to install the 32-bit version of ${PRODUCT_NAME} on 64-bit Windows.$\r$\nPlease download and use the 64-bit version instead.$\r$\nContinue with the installation of the 32-bit version?' IDYES noprob Quit noprob: ${Else} ${EndIf} !insertmacro MUI_LANGDLL_DISPLAY FunctionEnd !include Library.nsh Section "SectionPrincipale" SEC01 SetOutPath "$INSTDIR" !insertmacro InstallLib REGDLL NOTSHARED NOREBOOT_NOTPROTECTED "..\..\Project\MSVC2005\DLL\Win32\Release\MediaInfo.dll" $SYSDIR\MediaInfo.dll $SYSDIR !insertmacro InstallLib REGDLL NOTSHARED NOREBOOT_NOTPROTECTED "..\..\Project\MSVC2010\ShellExtension\Win32\Release\MediaInfo_InfoTip.dll" $INSTDIR\MediaInfo_InfoTip.dll $INSTDIR SectionEnd Section -Post WriteUninstaller "$INSTDIR\MediaInfo_uninst.exe" WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\MediaInfo.dll" ${If} ${RunningX64} DeleteRegValue HKLM "Software\MediaArea.net\MediaInfo" "DisplayName" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name) (32-bit)" ${Else} WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" ${EndIf} WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\MediaInfo_uninst.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\MediaInfo_InfoTip.dll" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" ; File size, taken from SumatraPDF installer ${If} ${AtLeastWin7} ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 IntFmt $0 "0x%08X" $0 ; Convert the decimal KB value in $0 to DWORD, put it right back into $0 WriteRegDWORD ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "EstimatedSize" "$0" ; Create/Write the reg key with the dword value ${EndIf} SectionEnd Section Uninstall UnRegDLL "$INSTDIR\MediaInfo_InfoTip.dll" Delete "$INSTDIR\MediaInfo_uninst.exe" !insertmacro UnInstallLib REGDLL NOTSHARED NOREBOOT_NOTPROTECTED $SYSDIR\MediaInfo.dll !insertmacro UnInstallLib REGDLL NOTSHARED NOREBOOT_NOTPROTECTED $INSTDIR\MediaInfo_InfoTip.dll RMDir "$INSTDIR" DeleteRegKey HKLM "${PRODUCT_REGISTRY}" DeleteRegKey /ifempty HKLM "${COMPANY_REGISTRY}" DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" SetAutoClose true SectionEndMediaInfoLib/Source/Install/MediaInfo_DLL_Windows_x64.nsi100777 0 0 13323 12263444455 16634 0; Request application privileges for Windows Vista RequestExecutionLevel admin ; Some defines !define PRODUCT_NAME "MediaInfo" !define PRODUCT_PUBLISHER "MediaArea.net" !define PRODUCT_VERSION "0.7.66" !define PRODUCT_VERSION4 "${PRODUCT_VERSION}.0" !define PRODUCT_WEB_SITE "http://MediaArea.net/MediaInfo" !define COMPANY_REGISTRY "Software\MediaArea.net" !define PRODUCT_REGISTRY "Software\MediaArea.net\MediaInfo.dll" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\MediaInfo.dll" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}.dll" !define PRODUCT_UNINST_ROOT_KEY "HKLM" ; Compression SetCompressor /FINAL /SOLID lzma ; x64 stuff !include "x64.nsh" ; File size !include FileFunc.nsh !include WinVer.nsh ; Modern UI !include "MUI2.nsh" !define MUI_ABORTWARNING !define MUI_ICON "..\..\..\MediaInfo\Source\Resource\Image\MediaInfo.ico" ; Language Selection Dialog Settings !define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}" !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}" !define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language" ; Installer pages !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH ; Uninstaller pages !insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH ; Language files !insertmacro MUI_LANGUAGE "Arabic" !insertmacro MUI_LANGUAGE "Albanian" !insertmacro MUI_LANGUAGE "Belarusian" !insertmacro MUI_LANGUAGE "Catalan" !insertmacro MUI_LANGUAGE "Croatian" !insertmacro MUI_LANGUAGE "Czech" !insertmacro MUI_LANGUAGE "Dutch" !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "Farsi" !insertmacro MUI_LANGUAGE "French" !insertmacro MUI_LANGUAGE "German" !insertmacro MUI_LANGUAGE "Greek" !insertmacro MUI_LANGUAGE "Korean" !insertmacro MUI_LANGUAGE "Hungarian" !insertmacro MUI_LANGUAGE "Italian" !insertmacro MUI_LANGUAGE "Japanese" !insertmacro MUI_LANGUAGE "Lithuanian" !insertmacro MUI_LANGUAGE "Polish" !insertmacro MUI_LANGUAGE "Portuguese" !insertmacro MUI_LANGUAGE "PortugueseBR" !insertmacro MUI_LANGUAGE "Romanian" !insertmacro MUI_LANGUAGE "Russian" !insertmacro MUI_LANGUAGE "SimpChinese" !insertmacro MUI_LANGUAGE "Spanish" !insertmacro MUI_LANGUAGE "Swedish" !insertmacro MUI_LANGUAGE "Thai" !insertmacro MUI_LANGUAGE "TradChinese" !insertmacro MUI_LANGUAGE "Turkish" !insertmacro MUI_RESERVEFILE_LANGDLL ; Info VIProductVersion "${PRODUCT_VERSION4}" VIAddVersionKey "CompanyName" "${PRODUCT_PUBLISHER}" VIAddVersionKey "ProductName" "${PRODUCT_NAME}" VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION4}" VIAddVersionKey "FileDescription" "All about your audio and video files" VIAddVersionKey "FileVersion" "${PRODUCT_VERSION4}" VIAddVersionKey "LegalCopyright" "${PRODUCT_PUBLISHER}" VIAddVersionKey "OriginalFilename" "${PRODUCT_NAME}_DLL_${PRODUCT_VERSION}_Windows_x64.exe" BrandingText " " ; Modern UI end Name "${PRODUCT_NAME}.dll ${PRODUCT_VERSION}" OutFile "..\..\Release\MediaInfo_DLL_${PRODUCT_VERSION}_Windows_x64.exe" InstallDir "$PROGRAMFILES64\MediaInfo.dll" InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" ShowInstDetails nevershow ShowUnInstDetails nevershow Function .onInit ${If} ${RunningX64} SetRegView 64 ${Else} MessageBox MB_OK|MB_ICONSTOP 'You are trying to install the 64-bit version of ${PRODUCT_NAME} on 32-bit Windows.$\r$\nPlease download and use the 32-bit version instead.$\r$\nClick OK to quit Setup.' Quit ${EndIf} !insertmacro MUI_LANGDLL_DISPLAY FunctionEnd !include Library.nsh Section "SectionPrincipale" SEC01 SetOutPath "$INSTDIR" !insertmacro InstallLib REGDLL NOTSHARED NOREBOOT_NOTPROTECTED "..\..\Project\MSVC2010\DLL\x64\Release\MediaInfo.dll" $SYSDIR\MediaInfo.dll $SYSDIR !insertmacro InstallLib REGDLL NOTSHARED NOREBOOT_NOTPROTECTED "..\..\Project\MSVC2010\ShellExtension\x64\Release\MediaInfo_InfoTip.dll" $INSTDIR\MediaInfo_InfoTip.dll $INSTDIR SectionEnd Section -Post WriteUninstaller "$INSTDIR\MediaInfo_uninst.exe" WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\MediaInfo.dll" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\MediaInfo_uninst.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\MediaInfo_InfoTip.dll" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" ; File size, taken from SumatraPDF installer ${If} ${AtLeastWin7} ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 IntFmt $0 "0x%08X" $0 ; Convert the decimal KB value in $0 to DWORD, put it right back into $0 WriteRegDWORD ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "EstimatedSize" "$0" ; Create/Write the reg key with the dword value ${EndIf} SectionEnd Section Uninstall UnRegDLL "$INSTDIR\MediaInfo_InfoTip.dll" Delete "$INSTDIR\MediaInfo_uninst.exe" !insertmacro UnInstallLib REGDLL NOTSHARED NOREBOOT_NOTPROTECTED $SYSDIR\MediaInfo.dll !insertmacro UnInstallLib REGDLL NOTSHARED NOREBOOT_NOTPROTECTED $INSTDIR\MediaInfo_InfoTip.dll RMDir "$INSTDIR" SetRegView 64 DeleteRegKey HKLM "${PRODUCT_REGISTRY}" DeleteRegKey /ifempty HKLM "${COMPANY_REGISTRY}" DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" SetAutoClose true SectionEndMediaInfoLib/Source/MediaInfo/ 40777 0 0 0 12263256717 11465 5MediaInfoLib/Source/MediaInfoDLL/ 40777 0 0 0 12264020623 12003 5MediaInfoLib/Source/MediaInfoDLL/MediaInfoDLL.cpp100777 0 0 117306 12264016276 15057 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Public DLL interface implementation // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // For user: you can disable or enable it //#define MEDIAINFO_DEBUG //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "ZenLib/Conf.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifdef UNICODE //DLL C Interface is currently done only in UNICODE mode //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //#if defined(MUST_INCLUDE_STDAFX) //Windows ATL for Shell Extension request stdafx.h // #include "stdafx.h" //#endif //MUST_INCLUDE_STDAFX #include "MediaInfo/MediaInfoList.h" #include "MediaInfo/MediaInfo.h" #define MEDIAINFO_DLL_EXPORT #include "MediaInfoDLL_Static.h" #include "ZenLib/Ztring.h" #include "ZenLib/CriticalSection.h" #include #include #include using namespace MediaInfoLib; using namespace ZenLib; using namespace std; //--------------------------------------------------------------------------- //*************************************************************************** // //*************************************************************************** //--------------------------------------------------------------------------- struct MI_List { std::string Ansi; //One-Byte-sized characters std::wstring Unicode; //Unicode characters }; struct MI_List_FromAnsi { int8u Pos; //Where are we? std::vector Unicode; //Unicode characters multiple times }; std::map MI_Handle; std::map MI_FromAnsi; std::string MediaInfo_Info_Ansi; //For general information std::wstring MediaInfo_Info_Unicode; //For general information static bool v07Mode=false; //Legacy : Test if the user try to use <0.7 Open method static CriticalSection Critical; static bool utf8=false; //--------------------------------------------------------------------------- const char* WC2MB(void* Handle, const wchar_t* Text) { CriticalSectionLocker Locker(Critical); //Coherancy if (MI_Handle.find(Handle)==MI_Handle.end()) { if (Handle==NULL && v07Mode) MediaInfo_Info_Ansi="Note to developer : you must create an object before using this method"; else MediaInfo_Info_Ansi="Your software uses an outdated interface, you must use MediaInfo.DLL 0.6 instead"; //Compatibility <0.7 : return a message return MediaInfo_Info_Ansi.c_str(); } //Adaptation if (utf8) MI_Handle[Handle]->Ansi=Ztring(Text).To_UTF8(); else MI_Handle[Handle]->Ansi=Ztring(Text).To_Local(); return MI_Handle[Handle]->Ansi.c_str(); } //--------------------------------------------------------------------------- const wchar_t* MB2WC(void* Handle, const char* Text) { //2 strings at same time if (MI_FromAnsi[Handle].Unicode.size()<2) { MI_FromAnsi[Handle].Pos=1; MI_FromAnsi[Handle].Unicode.resize(2); } MI_FromAnsi[Handle].Pos=(MI_FromAnsi[Handle].Pos==0?1:0); //Changing the position //Adaptation if (utf8) return MI_FromAnsi[Handle].Unicode[MI_FromAnsi[Handle].Pos].From_UTF8(Text).c_str(); else return MI_FromAnsi[Handle].Unicode[MI_FromAnsi[Handle].Pos].From_Local(Text).c_str(); } //*************************************************************************** // //*************************************************************************** //--------------------------------------------------------------------------- // For Widgets with DEBUG in BCB // Here only because this is useful in all MediaInfo #ifdef _DEBUG void wxOnAssert(const wchar_t*, int, const char*, const wchar_t*, const wchar_t*) {} #endif //_DEBUG //--------------------------------------------------------------------------- //To clarify the code #ifdef MEDIAINFO_DEBUG #include FILE* F; std::string Debug; #undef MEDIAINFO_DEBUG #define MEDIAINFO_DEBUG(_TOAPPEND) \ F=fopen("MediaInfo_Debug.txt", "a+t"); \ Debug.clear(); \ _TOAPPEND; \ fwrite(Debug.c_str(), Debug.size(), 1, F); \ fclose(F); #else // MEDIAINFO_DEBUG #define MEDIAINFO_DEBUG(_TOAPPEND) #endif // MEDIAINFO_DEBUG //--------------------------------------------------------------------------- #define INTEGRITY_VOID(_DEBUGA) \ MEDIAINFO_DEBUG(_DEBUGA) \ CriticalSectionLocker Locker(Critical); \ if (Handle==NULL || MI_Handle.find(Handle)==MI_Handle.end()) \ return; \ #define INTEGRITY_SIZE_T(_DEBUGA) \ MEDIAINFO_DEBUG(_DEBUGA) \ CriticalSectionLocker Locker(Critical); \ if (Handle==NULL || MI_Handle.find(Handle)==MI_Handle.end()) \ return 0; \ #define INTEGRITY_INT64U(_DEBUGA) \ MEDIAINFO_DEBUG(_DEBUGA) \ CriticalSectionLocker Locker(Critical); \ if (Handle==NULL || MI_Handle.find(Handle)==MI_Handle.end()) \ return 0; \ #define INTEGRITY_STRING(_DEBUGA) \ MEDIAINFO_DEBUG(_DEBUGA) \ CriticalSectionLocker Locker(Critical); \ if (Handle==NULL || MI_Handle.find(Handle)==MI_Handle.end()) \ { \ if (v07Mode==false) \ { \ MediaInfo_Info_Unicode=L"Your software uses an outdated interface, You must use MediaInfoList.DLL 0.6 instead"; \ return MediaInfo_Info_Unicode.c_str(); \ } \ MI_Handle[NULL]->Unicode==L"Note to developer : you must create an object before"; \ return MI_Handle[NULL]->Unicode.c_str(); \ } \ #ifndef MEDIAINFO_DEBUG #define EXECUTE_VOID(_CLASS,_METHOD,_DEBUGB) \ try \ { \ ((_CLASS*)Handle)->_METHOD; \ } catch (...) {return;} #else //MEDIAINFO_DEBUG #define EXECUTE_VOID(_CLASS,_METHOD,_DEBUGB) \ try \ { \ ((_CLASS*)Handle)->_METHOD; \ MEDIAINFO_DEBUG(_DEBUGB) \ } catch (...) {return;} #endif //MEDIAINFO_DEBUG #ifndef MEDIAINFO_DEBUG #define EXECUTE_SIZE_T(_CLASS,_METHOD,_DEBUGB) \ try \ { \ return ((_CLASS*)Handle)->_METHOD; \ } catch (...) {return -1;} #else //MEDIAINFO_DEBUG #define EXECUTE_SIZE_T(_CLASS,_METHOD, _DEBUGB) \ try \ { \ size_t ToReturn=((_CLASS*)Handle)->_METHOD; \ MEDIAINFO_DEBUG(_DEBUGB) \ return ToReturn; \ } catch (...) {MEDIAINFO_DEBUG(Debug+="!!!Exception thrown!!!\r\n";) return (size_t)-1;} #define EXECUTE_INT64U(_CLASS,_METHOD, _DEBUGB) \ try \ { \ int64u ToReturn=((_CLASS*)Handle)->_METHOD; \ MEDIAINFO_DEBUG(_DEBUGB) \ return ToReturn; \ } catch (...) {MEDIAINFO_DEBUG(Debug+="!!!Exception thrown!!!\r\n";) return (size_t)-1;} #endif //MEDIAINFO_DEBUG #ifndef MEDIAINFO_DEBUG #define EXECUTE_STRING(_CLASS,_METHOD,_DEBUGB) \ try \ { \ MI_Handle[Handle]->Unicode=((_CLASS*)Handle)->_METHOD; \ } catch (...) {MI_Handle[Handle]->Unicode.clear();} \ return MI_Handle[Handle]->Unicode.c_str(); #else //MEDIAINFO_DEBUG #define EXECUTE_STRING(_CLASS,_METHOD,_DEBUGB) \ try \ { \ MI_Handle[Handle]->Unicode=((_CLASS*)Handle)->_METHOD; \ } catch (...) {MEDIAINFO_DEBUG(Debug+="!!!Exception thrown!!!\r\n";) MI_Handle[Handle]->Unicode.clear();} \ ZenLib::Ztring ToReturn=MI_Handle[Handle]->Unicode; \ MEDIAINFO_DEBUG(_DEBUGB) \ return MI_Handle[Handle]->Unicode.c_str(); #endif //MEDIAINFO_DEBUG #define MANAGE_VOID(_CLASS,_METHOD,_DEBUGA,_DEBUGB) \ INTEGRITY_VOID(_DEBUGA) EXECUTE_VOID(_CLASS,_METHOD,_DEBUGB) #define MANAGE_INT(_CLASS,_METHOD,_DEBUGA,_DEBUGB) \ INTEGRITY_SIZE_T(_DEBUGA) EXECUTE_SIZE_T(_CLASS,_METHOD,_DEBUGB) #define MANAGE_STRING(_CLASS,_METHOD,_DEBUGA,_DEBUGB) \ INTEGRITY_STRING(_DEBUGA) EXECUTE_STRING(_CLASS,_METHOD,_DEBUGB) //*************************************************************************** // //*************************************************************************** //--------------------------------------------------------------------------- void* __stdcall MediaInfoA_New () { MEDIAINFO_DEBUG(Debug+="MediaInfoA_New(), no arguments\r\n";) return MediaInfo_New(); } void* __stdcall MediaInfoA_New_Quick (const char* File, const char* Options) { return MediaInfo_New_Quick(MB2WC(NULL, File), MB2WC(NULL, Options)); } void __stdcall MediaInfoA_Delete (void* Handle) { MediaInfo_Delete(Handle); } size_t __stdcall MediaInfoA_Open (void* Handle, const char* File) { MEDIAINFO_DEBUG(Debug+="OpenA, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+=", File=";Debug+=File;Debug+="\r\n";) return MediaInfo_Open(Handle, MB2WC(Handle, File)); } size_t __stdcall MediaInfoA_Open_Buffer (void* Handle, const unsigned char* Begin, size_t Begin_Size, const unsigned char* End, size_t End_Size) { return MediaInfo_Open_Buffer(Handle, Begin, Begin_Size, End, End_Size); } size_t __stdcall MediaInfoA_Open_Buffer_Init (void* Handle, MediaInfo_int64u File_Size, MediaInfo_int64u File_Offset) { return MediaInfo_Open_Buffer_Init(Handle, File_Size, File_Offset); } size_t __stdcall MediaInfoA_Open_Buffer_Continue (void* Handle, MediaInfo_int8u* Buffer, size_t Buffer_Size) { return MediaInfo_Open_Buffer_Continue(Handle, Buffer, Buffer_Size); } MediaInfo_int64u __stdcall MediaInfoA_Open_Buffer_Continue_GoTo_Get (void* Handle) { return MediaInfo_Open_Buffer_Continue_GoTo_Get(Handle); } size_t __stdcall MediaInfoA_Open_Buffer_Finalize (void* Handle) { return MediaInfo_Open_Buffer_Finalize(Handle); } size_t __stdcall MediaInfoA_Open_NextPacket (void* Handle) { return MediaInfo_Open_NextPacket(Handle); } size_t __stdcall MediaInfoA_Save (void* Handle) { return MediaInfo_Save(Handle); } void __stdcall MediaInfoA_Close (void* Handle) { MediaInfo_Close(Handle); } const char* __stdcall MediaInfoA_Inform (void* Handle, size_t Reserved) { return WC2MB(Handle, MediaInfo_Inform(Handle, 0)); } const char* __stdcall MediaInfoA_GetI (void* Handle, MediaInfo_stream_t StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C KindOfInfo) { return WC2MB(Handle, MediaInfo_GetI(Handle, StreamKind, StreamNumber, Parameter, KindOfInfo)); } const char* __stdcall MediaInfoA_Get (void* Handle, MediaInfo_stream_t StreamKind, size_t StreamNumber, const char* Parameter, MediaInfo_info_C KindOfInfo, MediaInfo_info_C KindOfSearch) { MEDIAINFO_DEBUG(Debug+="Get, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+=", Parameter=";Parameter;Debug+="\r\n";) return WC2MB(Handle, MediaInfo_Get(Handle, StreamKind, StreamNumber, MB2WC(Handle, Parameter), KindOfInfo, KindOfSearch)); } size_t __stdcall MediaInfoA_SetI (void* Handle, const char* ToSet, MediaInfo_stream_t StreamKind, size_t StreamNumber, size_t Parameter, const char* OldParameter) { return MediaInfo_SetI(Handle, MB2WC(Handle, ToSet), StreamKind, StreamNumber, Parameter, MB2WC(Handle, OldParameter)); } size_t __stdcall MediaInfoA_Set (void* Handle, const char* ToSet, MediaInfo_stream_t StreamKind, size_t StreamNumber, const char* Parameter, const char* OldParameter) { return MediaInfo_Set(Handle, MB2WC(Handle, ToSet), StreamKind, StreamNumber, MB2WC(Handle, Parameter), MB2WC(Handle, OldParameter)); } size_t __stdcall MediaInfoA_Output_Buffer_Get (void* Handle, const char* Value) { return MediaInfo_Output_Buffer_Get(Handle, MB2WC(Handle, Value)); } size_t __stdcall MediaInfoA_Output_Buffer_GetI (void* Handle, size_t Pos) { return MediaInfo_Output_Buffer_GetI(Handle, Pos); } const char* __stdcall MediaInfoA_Option (void* Handle, const char* Option, const char* Value) { return WC2MB(Handle, MediaInfo_Option(Handle, MB2WC(Handle, Option), MB2WC(Handle, Value))); } size_t __stdcall MediaInfoA_State_Get(void* Handle) { return MediaInfo_State_Get(Handle); } size_t __stdcall MediaInfoA_Count_Get(void* Handle, MediaInfo_stream_t StreamKind, size_t StreamNumber) { return MediaInfo_Count_Get(Handle, StreamKind, StreamNumber); } //--------------------------------------------------------------------------- void* __stdcall MediaInfoListA_New () { return MediaInfoList_New(); } void* __stdcall MediaInfoListA_New_Quick (const char* File, const char* Options) { return MediaInfoList_New_Quick(MB2WC(NULL, File), MB2WC(NULL, Options)); } void __stdcall MediaInfoListA_Delete (void* Handle) { MediaInfoList_Delete(Handle); } size_t __stdcall MediaInfoListA_Open (void* Handle, const char* File, const MediaInfo_fileoptions_C Options) { return MediaInfoList_Open(Handle, MB2WC(Handle, File), Options); } size_t __stdcall MediaInfoListA_Open_Buffer (void* Handle, const unsigned char* Begin, size_t Begin_Size, const unsigned char* End, size_t End_Size) { return MediaInfoList_Open_Buffer(Handle, Begin, Begin_Size, End, End_Size); } size_t __stdcall MediaInfoListA_Save (void* Handle, size_t FilePos) { return MediaInfoList_Save(Handle, FilePos); } void __stdcall MediaInfoListA_Close (void* Handle, size_t FilePos) { MediaInfoList_Close(Handle, FilePos); } const char* __stdcall MediaInfoListA_Inform (void* Handle, size_t FilePos, size_t Reserved) { return WC2MB(Handle, MediaInfoList_Inform(Handle, FilePos, 0)); } const char* __stdcall MediaInfoListA_GetI (void* Handle, size_t FilePos, MediaInfo_stream_t StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C KindOfInfo) { return WC2MB(Handle, MediaInfoList_GetI(Handle, FilePos, StreamKind, StreamNumber, Parameter, KindOfInfo)); } const char* __stdcall MediaInfoListA_Get (void* Handle, size_t FilePos, MediaInfo_stream_t StreamKind, size_t StreamNumber, const char* Parameter, MediaInfo_info_C KindOfInfo, MediaInfo_info_C KindOfSearch) { return WC2MB(Handle, MediaInfoList_Get(Handle, FilePos, StreamKind, StreamNumber, MB2WC(Handle, Parameter), KindOfInfo, KindOfSearch)); } size_t __stdcall MediaInfoListA_SetI (void* Handle, const char* ToSet, size_t FilePos, MediaInfo_stream_t StreamKind, size_t StreamNumber, size_t Parameter, const char* OldParameter) { return MediaInfoList_SetI(Handle, MB2WC(Handle, ToSet), FilePos, StreamKind, StreamNumber, Parameter, MB2WC(Handle, OldParameter)); } size_t __stdcall MediaInfoListA_Set (void* Handle, const char* ToSet, size_t FilePos, MediaInfo_stream_t StreamKind, size_t StreamNumber, const char* Parameter, const char* OldParameter) { return MediaInfoList_Set(Handle, MB2WC(Handle, ToSet), FilePos, StreamKind, StreamNumber, MB2WC(Handle, Parameter), MB2WC(Handle, OldParameter)); } const char* __stdcall MediaInfoListA_Option (void* Handle, const char* Option, const char* Value) { return WC2MB(Handle, MediaInfoList_Option(Handle, MB2WC(Handle, Option), MB2WC(Handle, Value))); } size_t __stdcall MediaInfoListA_State_Get(void* Handle) { return MediaInfoList_State_Get(Handle); } size_t __stdcall MediaInfoListA_Count_Get(void* Handle, size_t FilePos, MediaInfo_stream_t StreamKind, size_t StreamNumber) { return MediaInfoList_Count_Get(Handle, FilePos, StreamKind, StreamNumber); } size_t __stdcall MediaInfoListA_Count_Get_Files(void* Handle) { return MediaInfoList_Count_Get_Files(Handle); } //--------------------------------------------------------------------------- void* __stdcall MediaInfo_New () { MEDIAINFO_DEBUG(Debug+="New, no arguments\r\n";) CriticalSectionLocker Locker(Critical); //First init if (MI_Handle.find(NULL)==MI_Handle.end()) { MI_Handle[NULL]=new MI_List; //Generic Handle MI_Handle[NULL]->Ansi.clear(); } v07Mode=true; //Application is compatible with v0.7+ interface //New MediaInfo* M=NULL; try { M=new MediaInfo; MI_Handle[M]=new MI_List; MI_Handle[M]->Ansi.clear(); MEDIAINFO_DEBUG(Debug+="New, will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)M).To_Local().c_str();Debug+="\r\n";) return M; } catch(...) { delete M; return NULL; } } void* __stdcall MediaInfo_New_Quick (const wchar_t* File, const wchar_t* Options) { MediaInfo_Option(NULL, L"QuickInit", Options); void* Handle=MediaInfo_New(); if (MediaInfo_Open(Handle, File)==0) { //No valid files, return NULL MediaInfo* M=(MediaInfo*)Handle; delete M; return NULL; } return Handle; } void __stdcall MediaInfo_Delete (void* Handle) { CriticalSectionLocker Locker(Critical); //Integrity test if (MI_Handle.find(Handle)==MI_Handle.end()) return; //Handle is not a MediaInfo Handle //Delete the object MediaInfo* M=(MediaInfo*)Handle; delete MI_Handle[M]; MI_Handle.erase(M); delete M; //In case of the last object : delete the NULL object, no more need if (MI_Handle.size()==1 && MI_Handle.find(NULL)!=MI_Handle.end()) { delete MI_Handle[NULL]; MI_Handle.erase(NULL); } } size_t __stdcall MediaInfo_Open (void* Handle, const wchar_t* File) { INTEGRITY_SIZE_T(Debug+="Open, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+=", File=";Debug+=ZenLib::Ztring(File).To_Local();Debug+="\r\n";) if (MI_Handle.find(Handle)==MI_Handle.end()) { //Compatibility <0.7 : return a MediaInfo handle, but empty MediaInfo* M=new MediaInfo; return (size_t)M; } EXECUTE_SIZE_T(MediaInfo, Open(File), Debug+="Open, will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } size_t __stdcall MediaInfo_Open_Buffer (void* Handle, const unsigned char* Begin, size_t Begin_Size, const unsigned char* End, size_t End_Size) { INTEGRITY_SIZE_T(Debug+="Open_Buffer, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+=", ";Debug+="\r\n";) if (MI_Handle.find(Handle)==MI_Handle.end()) { //Compatibility <0.7 : return a MediaInfo handle, but empty MediaInfo* M=new MediaInfo; return (size_t)M; } EXECUTE_SIZE_T(MediaInfo, Open(Begin, Begin_Size, End, End_Size), Debug+="Open_Buffer, will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } size_t __stdcall MediaInfo_Open_Buffer_Init (void* Handle, MediaInfo_int64u File_Size, MediaInfo_int64u File_Offset) { INTEGRITY_SIZE_T(Debug+="Open_Buffer_Init, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+=", ";Debug+="\r\n";) EXECUTE_SIZE_T(MediaInfo, Open_Buffer_Init(File_Size, File_Offset), Debug+="Open_Buffer_Init, will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } size_t __stdcall MediaInfo_Open_Buffer_Continue (void* Handle, MediaInfo_int8u* Buffer, size_t Buffer_Size) { INTEGRITY_SIZE_T(Debug+="MediaInfo_Open_Buffer_Continue, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+=", ";Debug+="\r\n";) EXECUTE_SIZE_T(MediaInfo, Open_Buffer_Continue(Buffer, Buffer_Size), Debug+="MediaInfo_Open_Buffer_Continue, will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } MediaInfo_int64u __stdcall MediaInfo_Open_Buffer_Continue_GoTo_Get (void* Handle) { INTEGRITY_INT64U(Debug+="MediaInfo_Open_Buffer_Continue_GoTo_Get, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+=", ";Debug+="\r\n";) EXECUTE_INT64U(MediaInfo, Open_Buffer_Continue_GoTo_Get(), Debug+="MediaInfo_Open_Buffer_Continue_GoTo_Get, will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } size_t __stdcall MediaInfo_Open_Buffer_Finalize (void* Handle) { INTEGRITY_SIZE_T(Debug+="MediaInfo_Open_Buffer_Finalize, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+=", ";Debug+="\r\n";) EXECUTE_SIZE_T(MediaInfo, Open_Buffer_Finalize(), Debug+="MediaInfo_Open_Buffer_Finalize, will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } size_t __stdcall MediaInfo_Open_NextPacket (void* Handle) { INTEGRITY_SIZE_T(Debug+="MediaInfo_Open_NextPacket, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+=", ";Debug+="\r\n";) EXECUTE_SIZE_T(MediaInfo, Open_NextPacket(), Debug+="MediaInfo_Open_NextPacket, will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } size_t __stdcall MediaInfo_Save (void* Handle) { MANAGE_INT(MediaInfo, Save(), Debug+="Save, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+="\r\n";, Debug+="Save, will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } void __stdcall MediaInfo_Close (void* Handle) { MANAGE_VOID(MediaInfo, Close(), Debug+="Close, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+="\r\n";, Debug+="Close, will return nothing\r\n";) } const wchar_t* __stdcall MediaInfo_Inform (void* Handle, size_t Reserved) { MANAGE_STRING(MediaInfo, Inform(), Debug+="Inform, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+="\r\n";, Debug+="Inform, will return ";Debug+=ToReturn.To_Local().c_str();Debug+="\r\n";) } const wchar_t* __stdcall MediaInfo_GetI (void* Handle, MediaInfo_stream_t StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C KindOfInfo) { StreamKind=(MediaInfo_stream_t)(((size_t)StreamKind)&0xFF); KindOfInfo=(MediaInfo_info_C) (((size_t)KindOfInfo)&0xFF); MANAGE_STRING(MediaInfo, Get((stream_t)StreamKind, StreamNumber, Parameter, (info_t)KindOfInfo), Debug+="GetI, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+="\r\n";, Debug+="GetI, will return ";Debug+=ToReturn.To_Local().c_str();Debug+="\r\n";) } const wchar_t* __stdcall MediaInfo_Get (void* Handle, MediaInfo_stream_t StreamKind, size_t StreamNumber, const wchar_t* Parameter, MediaInfo_info_C KindOfInfo, MediaInfo_info_C KindOfSearch) { StreamKind=(MediaInfo_stream_t)(((size_t)StreamKind)&0xFF); KindOfInfo=(MediaInfo_info_C) (((size_t)KindOfInfo)&0xFF); KindOfSearch=(MediaInfo_info_C)(((size_t)KindOfSearch)&0xFF); MANAGE_STRING(MediaInfo, Get((stream_t)StreamKind, StreamNumber, Parameter, (info_t)KindOfInfo, (info_t)KindOfSearch), Debug+="Get, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+=", Parameter=";Debug+=ZenLib::Ztring(Parameter).To_Local().c_str();Debug+=", KindOfInfo=";Debug+=ZenLib::Ztring::ToZtring(KindOfInfo).To_Local().c_str();Debug+=", KindOfSearch=";Debug+=ZenLib::Ztring::ToZtring(KindOfSearch).To_Local().c_str();Debug+="\r\n";, Debug+="Get, will return ";Debug+=ToReturn.To_Local().c_str();Debug+="\r\n";) } size_t __stdcall MediaInfo_SetI (void* Handle, const wchar_t* ToSet, MediaInfo_stream_t StreamKind, size_t StreamNumber, size_t Parameter, const wchar_t* OldParameter) { StreamKind=(MediaInfo_stream_t)(((size_t)StreamKind)&0xFF); MANAGE_INT(MediaInfo, Set(ToSet, (stream_t)StreamKind, StreamNumber, Parameter, OldParameter), Debug+="SetI, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+="\r\n";, Debug+="SetI, will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } size_t __stdcall MediaInfo_Set (void* Handle, const wchar_t* ToSet, MediaInfo_stream_t StreamKind, size_t StreamNumber, const wchar_t* Parameter, const wchar_t* OldParameter) { StreamKind=(MediaInfo_stream_t)(((size_t)StreamKind)&0xFF); MANAGE_INT(MediaInfo, Set(ToSet, (stream_t)StreamKind, StreamNumber, Parameter, OldParameter), Debug+="Set, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+="\r\n";, Debug+="Set, will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } size_t __stdcall MediaInfo_Output_Buffer_Get (void* Handle, const wchar_t* Value) { MANAGE_INT(MediaInfo, Output_Buffer_Get(Value), ;, ;) } size_t __stdcall MediaInfo_Output_Buffer_GetI (void* Handle, size_t Pos) { MANAGE_INT(MediaInfo, Output_Buffer_Get(Pos), ;, ;) } const wchar_t* __stdcall MediaInfo_Option (void* Handle, const wchar_t* Option, const wchar_t* Value) { MEDIAINFO_DEBUG(Debug+="Option, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+=", Option=";Debug+=ZenLib::Ztring(Option).To_Local().c_str();Debug+="\r\n";) CriticalSectionLocker Locker(Critical); //First init - Option could be called without using MediaInfo_New() if (MI_Handle.find(NULL)==MI_Handle.end()) { MI_Handle[NULL]=new MI_List; //Generic Handle MI_Handle[NULL]->Ansi.clear(); } //DLL only option if (ZenLib::Ztring(Option).Compare(L"CharSet", L"==")) { if (ZenLib::Ztring(Value).Compare(L"UTF-8", L"==")) utf8=true; else utf8=false; MI_Handle[NULL]->Unicode=L"OK"; return MI_Handle[NULL]->Unicode.c_str(); } if (ZenLib::Ztring(Option).Compare(L"setlocale_LC_CTYPE", L"==")) { setlocale(LC_CTYPE, utf8?ZenLib::Ztring(Value).To_UTF8().c_str():ZenLib::Ztring(Value).To_Local().c_str()); return MI_Handle[NULL]->Unicode.c_str(); } if (Handle) { if (MI_Handle.find(Handle)==MI_Handle.end()) { if (v07Mode==false) { MediaInfo_Info_Unicode=L"Your software uses an outdated interface, You must use MediaInfoList.DLL 0.6 instead"; return MediaInfo_Info_Unicode.c_str(); } MI_Handle[NULL]->Unicode==L"Note to developer : you must create an object before"; return MI_Handle[NULL]->Unicode.c_str(); } EXECUTE_STRING(MediaInfo, Option(Option, Value), Debug+="Option, will return ";Debug+=ToReturn.To_Local().c_str();Debug+="\r\n";) } else { MI_Handle[Handle]->Unicode=MediaInfo::Option_Static(Option, Value); return MI_Handle[Handle]->Unicode.c_str(); } } size_t __stdcall MediaInfo_State_Get(void* Handle) { MANAGE_INT(MediaInfo, State_Get(), Debug+="State_Get, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+="\r\n";, Debug+="State_Get, will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } size_t __stdcall MediaInfo_Count_Get(void* Handle, MediaInfo_stream_t StreamKind, size_t StreamNumber) { StreamKind=(MediaInfo_stream_t)(((size_t)StreamKind)&0xFF); MANAGE_INT(MediaInfo, Count_Get((stream_t)StreamKind, StreamNumber), Debug+="Count_Get, Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+=", StreamKind=";Debug+=ZenLib::Ztring::ToZtring((size_t)StreamKind).To_Local().c_str();Debug+=", StreamNumber=";Debug+=ZenLib::Ztring::ToZtring((size_t)StreamNumber).To_Local().c_str();Debug+="\r\n", Debug+="Count_Get, will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } //--------------------------------------------------------------------------- void* __stdcall MediaInfoList_New () { MEDIAINFO_DEBUG(Debug+="New(L)";Debug+="\r\n";) CriticalSectionLocker Locker(Critical); //First init if (MI_Handle.find(NULL)==MI_Handle.end()) { MI_Handle[NULL]=new MI_List; //Generic Handle MI_Handle[NULL]->Ansi.clear(); } v07Mode=true; //Application is compatible with v0.7+ interface //New MediaInfoList* M=NULL; try { M=new MediaInfoList; MI_Handle[M]=new MI_List; MI_Handle[M]->Ansi.clear(); MEDIAINFO_DEBUG(Debug+="New(L), will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)M).To_Local().c_str();Debug+="\r\n";) return M; } catch(...) { delete M; return NULL; } } void* __stdcall MediaInfoList_New_Quick (const wchar_t* File, const wchar_t* Options) { MediaInfoList_Option(NULL, L"QuickInit", Options); void* Handle=MediaInfoList_New(); if (MediaInfoList_Open(Handle, File, MediaInfo_FileOption_Nothing)==0) { //No valid files, return NULL MediaInfoList* M=(MediaInfoList*)Handle; delete M; return NULL; } return Handle; } void __stdcall MediaInfoList_Delete (void* Handle) { CriticalSectionLocker Locker(Critical); //Integrity test if (MI_Handle.find(Handle)==MI_Handle.end()) return; //Handle is not a MediaInfoList Handle //Delete the object MediaInfoList* M=(MediaInfoList*)Handle; delete MI_Handle[M]; MI_Handle.erase(M); delete M; //In case of the last object : delete the NULL object, no more need if (MI_Handle.size()==1 && MI_Handle.find(NULL)!=MI_Handle.end()) { delete MI_Handle[NULL]; MI_Handle.erase(NULL); } } size_t __stdcall MediaInfoList_Open (void* Handle, const wchar_t* File, const MediaInfo_fileoptions_C Options) { INTEGRITY_SIZE_T(Debug+="Open(L), Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+=", ";Debug+="\r\n";) if (MI_Handle.find(Handle)==MI_Handle.end()) { //Compatibility <0.7 : return a MediaInfo handle, but empty MediaInfo* M=new MediaInfo; return (size_t)M; } EXECUTE_SIZE_T(MediaInfoList, Open(File, (fileoptions_t)Options), Debug+="Open(L), will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } size_t __stdcall MediaInfoList_Open_Buffer (void* Handle, const unsigned char* Begin, size_t Begin_Size, const unsigned char* End, size_t End_Size) { INTEGRITY_SIZE_T(Debug+="Open_Buffer(L), Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+="\r\n";) if (MI_Handle.find(Handle)==MI_Handle.end()) { //Compatibility <0.7 : return a MediaInfo handle, but empty MediaInfo* M=new MediaInfo; return (size_t)M; } return 0; //No more implemented } size_t __stdcall MediaInfoList_Save (void* Handle, size_t FilePos) { MANAGE_INT(MediaInfoList, Save(FilePos), Debug+="Save(L), Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+="\r\n";, Debug+="Save(L), will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } void __stdcall MediaInfoList_Close (void* Handle, size_t FilePos) { MANAGE_VOID(MediaInfoList, Close(FilePos), Debug+="MediaInfoList_Close\r\n";, Debug+="MediaInfoList_Close 2\r\n";) } const wchar_t* __stdcall MediaInfoList_Inform (void* Handle, size_t FilePos, size_t Reserved) { MANAGE_STRING(MediaInfoList, Inform(FilePos, 0), Debug+="Inform(L), Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+="\r\n";, Debug+="Inform(L), will return ";Debug+=ToReturn.To_Local();Debug+="\r\n";) } const wchar_t* __stdcall MediaInfoList_GetI (void* Handle, size_t FilePos, MediaInfo_stream_t StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C KindOfInfo) { StreamKind=(MediaInfo_stream_t)(((size_t)StreamKind)&0xFF); KindOfInfo=(MediaInfo_info_C) (((size_t)KindOfInfo)&0xFF); MANAGE_STRING(MediaInfoList, Get(FilePos, (stream_t)StreamKind, StreamNumber, Parameter, (info_t)KindOfInfo), Debug+="Get(L), Handle=";Debug+=ZenLib::Ztring::ToZtring((int64u)Handle).To_Local().c_str();Debug+=", FilePos=";Debug+=ZenLib::Ztring::ToZtring((size_t)FilePos).To_Local().c_str();Debug+=", StreamKind=";Debug+=ZenLib::Ztring::ToZtring((int8u)StreamKind).To_Local().c_str();Debug+=", StreamNumber=";Debug+=ZenLib::Ztring::ToZtring((int8u)StreamNumber).To_Local().c_str();Debug+=", Parameter=";Debug+=ZenLib::Ztring::ToZtring(Parameter).To_Local().c_str();Debug+=", KindOfInfo=";Debug+=ZenLib::Ztring::ToZtring((int8u)KindOfInfo).To_Local().c_str();Debug+="\r\n";, Debug+="Get(L), will return ";Debug+=ToReturn.To_Local();Debug+="\r\n";) } const wchar_t* __stdcall MediaInfoList_Get (void* Handle, size_t FilePos, MediaInfo_stream_t StreamKind, size_t StreamNumber, const wchar_t* Parameter, MediaInfo_info_C KindOfInfo, MediaInfo_info_C KindOfSearch) { StreamKind=(MediaInfo_stream_t)(((size_t)StreamKind)&0xFF); KindOfInfo=(MediaInfo_info_C) (((size_t)KindOfInfo)&0xFF); MANAGE_STRING(MediaInfoList, Get(FilePos, (stream_t)((int8u)StreamKind), StreamNumber, Parameter, (info_t)((int8u)KindOfInfo), (info_t)((int8u)KindOfSearch)), Debug+="Get(L), Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+=", FilePos=";Debug+=ZenLib::Ztring::ToZtring((size_t)FilePos).To_Local().c_str();Debug+=", StreamKind=";Debug+=ZenLib::Ztring::ToZtring((int8u)StreamKind).To_Local().c_str();Debug+=", StreamNumber=";Debug+=ZenLib::Ztring::ToZtring((int8u)StreamNumber).To_Local().c_str();Debug+=", Parameter=";Debug+=ZenLib::Ztring(Parameter).To_Local().c_str();Debug+=", KindOfInfo=";Debug+=ZenLib::Ztring::ToZtring((int8u)KindOfInfo).To_Local().c_str();Debug+=", KindOfSearch=";Debug+=ZenLib::Ztring::ToZtring((int8u)KindOfSearch).To_Local().c_str();Debug+="\r\n";, Debug+="Get(L), will return ";Debug+=ToReturn.To_Local();Debug+="\r\n";) } size_t __stdcall MediaInfoList_SetI (void* Handle, const wchar_t* ToSet, size_t FilePos, MediaInfo_stream_t StreamKind, size_t StreamNumber, size_t Parameter, const wchar_t* OldParameter) { StreamKind=(MediaInfo_stream_t)(((size_t)StreamKind)&0xFF); MANAGE_INT(MediaInfoList, Set(ToSet, FilePos, (stream_t)StreamKind, StreamNumber, Parameter, OldParameter), Debug+="SetI(L), Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+="\r\n";, Debug+="SetI(L), will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } size_t __stdcall MediaInfoList_Set (void* Handle, const wchar_t* ToSet, size_t FilePos, MediaInfo_stream_t StreamKind, size_t StreamNumber, const wchar_t* Parameter, const wchar_t* OldParameter) { StreamKind=(MediaInfo_stream_t)(((size_t)StreamKind)&0xFF); MANAGE_INT(MediaInfoList, Set(ToSet, FilePos, (stream_t)StreamKind, StreamNumber, Parameter, OldParameter), Debug+="Set(L), Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+="\r\n";, Debug+="Set(L), will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } const wchar_t* __stdcall MediaInfoList_Option (void* Handle, const wchar_t* Option, const wchar_t* Value) { MEDIAINFO_DEBUG(Debug+="Option(L), Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+=", Option=";Debug+=ZenLib::Ztring(Option).To_Local().c_str();Debug+=", Value=";Debug+=ZenLib::Ztring(Value).To_Local().c_str();Debug+="\r\n";) CriticalSectionLocker Locker(Critical); //First init - Option could be called without using MediaInfo_New() if (MI_Handle.find(NULL)==MI_Handle.end()) { MI_Handle[NULL]=new MI_List; //Generic Handle MI_Handle[NULL]->Ansi.clear(); } //DLL only option if (std::wstring(Option).compare(L"CharSet")==0) { if (std::wstring(Value).compare(L"UTF-8")==0) utf8=true; else utf8=false; MI_Handle[NULL]->Unicode=L"OK"; return MI_Handle[NULL]->Unicode.c_str(); } if (ZenLib::Ztring(Option).Compare(L"setlocale_LC_CTYPE", L"==")) { setlocale(LC_CTYPE, utf8?ZenLib::Ztring(Value).To_UTF8().c_str():ZenLib::Ztring(Value).To_Local().c_str()); return MI_Handle[NULL]->Unicode.c_str(); } if (Handle) { if (MI_Handle.find(Handle)==MI_Handle.end()) { if (v07Mode==false) { MediaInfo_Info_Unicode=L"Your software uses an outdated interface, You must use MediaInfoList.DLL 0.6 instead"; return MediaInfo_Info_Unicode.c_str(); } MI_Handle[NULL]->Unicode==L"Note to developer : you must create an object before"; return MI_Handle[NULL]->Unicode.c_str(); } EXECUTE_STRING(MediaInfoList, Option(Option, Value), Debug+="Option(L), will return ";Debug+=ToReturn.To_Local().c_str();Debug+="\r\n";) } else { MI_Handle[Handle]->Unicode=MediaInfoList::Option_Static(Option, Value); return MI_Handle[Handle]->Unicode.c_str(); } } size_t __stdcall MediaInfoList_State_Get(void* Handle) { MANAGE_INT(MediaInfoList, State_Get(), Debug+="State_Get(L), Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+="\r\n";, Debug+="State_Get(L), will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } size_t __stdcall MediaInfoList_Count_Get(void* Handle, size_t FilePos, MediaInfo_stream_t StreamKind, size_t StreamNumber) { StreamKind=(MediaInfo_stream_t)(((size_t)StreamKind)&0xFF); MANAGE_INT(MediaInfoList, Count_Get(FilePos, (stream_t)StreamKind, StreamNumber), Debug+="Count_Get(L), Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+=", FilePos=";Debug+=ZenLib::Ztring::ToZtring((size_t)FilePos).To_Local().c_str();Debug+=", StreamKind=";Debug+=ZenLib::Ztring::ToZtring((size_t)StreamKind).To_Local().c_str();Debug+=", StreamNumber=";Debug+=ZenLib::Ztring::ToZtring((size_t)StreamNumber).To_Local().c_str();Debug+="\r\n";, Debug+="Count_Get(L), will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } size_t __stdcall MediaInfoList_Count_Get_Files(void* Handle) { MANAGE_INT(MediaInfoList, Count_Get(), Debug+="Count_Get_Files(L), Handle=";Debug+=ZenLib::Ztring::ToZtring((size_t)Handle).To_Local().c_str();Debug+="\r\n";, Debug+="Count_Get_Files(L), will return ";Debug+=ZenLib::Ztring::ToZtring((size_t)ToReturn).To_Local().c_str();Debug+="\r\n";) } //--------------------------------------------------------------------------- const char* __stdcall MediaInfo_Info_Version() { MEDIAINFO_DEBUG("Info_Version") \ //Compatibility <0.7 : return a message MediaInfo_Info_Ansi="Your software uses an outdated interface, You must use MediaInfo.DLL 0.4.1.1 instead"; return MediaInfo_Info_Ansi.c_str(); //wchar_t* MediaInfo_wChar=new wchar_t[1000]; //GetModuleFileNameW (NULL, MediaInfo_wChar, 1000); //return WC2MB(MediaInfo_wChar); } //*************************************************************************** // //*************************************************************************** #endif //UNICODE MediaInfoLib/Source/MediaInfoDLL/MediaInfoDLL.cs100777 0 0 35366 12252326237 14665 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Microsoft Visual C# wrapper for MediaInfo Library // See MediaInfo.h for help // // To make it working, you must put MediaInfo.Dll // in the executable folder // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ using System; using System.Runtime.InteropServices; #pragma warning disable 1591 // Disable XML documentation warnings namespace MediaInfoLib { public enum StreamKind { General, Video, Audio, Text, Other, Image, Menu, } public enum InfoKind { Name, Text, Measure, Options, NameText, MeasureText, Info, HowTo } public enum InfoOptions { ShowInInform, Support, ShowInSupported, TypeOfValue } public enum InfoFileOptions { FileOption_Nothing = 0x00, FileOption_NoRecursive = 0x01, FileOption_CloseAll = 0x02, FileOption_Max = 0x04 }; public enum Status { None = 0x00, Accepted = 0x01, Filled = 0x02, Updated = 0x04, Finalized = 0x08, } public class MediaInfo { //Import of DLL functions. DO NOT USE until you know what you do (MediaInfo DLL do NOT use CoTaskMemAlloc to allocate memory) [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_New(); [DllImport("MediaInfo.dll")] private static extern void MediaInfo_Delete(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string FileName); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open(IntPtr Handle, IntPtr FileName); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open_Buffer_Init(IntPtr Handle, Int64 File_Size, Int64 File_Offset); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open(IntPtr Handle, Int64 File_Size, Int64 File_Offset); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open_Buffer_Continue(IntPtr Handle, IntPtr Buffer, IntPtr Buffer_Size); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open_Buffer_Continue(IntPtr Handle, Int64 File_Size, byte[] Buffer, IntPtr Buffer_Size); [DllImport("MediaInfo.dll")] private static extern Int64 MediaInfo_Open_Buffer_Continue_GoTo_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern Int64 MediaInfoA_Open_Buffer_Continue_GoTo_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Open_Buffer_Finalize(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Open_Buffer_Finalize(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern void MediaInfo_Close(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Inform(IntPtr Handle, IntPtr Reserved); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Inform(IntPtr Handle, IntPtr Reserved); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_GetI(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_GetI(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, [MarshalAs(UnmanagedType.LPWStr)] string Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Option(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string Option, [MarshalAs(UnmanagedType.LPWStr)] string Value); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoA_Option(IntPtr Handle, IntPtr Option, IntPtr Value); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_State_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfo_Count_Get(IntPtr Handle, IntPtr StreamKind, IntPtr StreamNumber); //MediaInfo class public MediaInfo() { try { Handle = MediaInfo_New(); } catch { Handle = (IntPtr)0; } if (Environment.OSVersion.ToString().IndexOf("Windows") == -1) MustUseAnsi=true; else MustUseAnsi=false; } ~MediaInfo() { if (Handle == (IntPtr)0) return; MediaInfo_Delete(Handle); } public int Open(String FileName) { if (Handle == (IntPtr)0) return 0; if (MustUseAnsi) { IntPtr FileName_Ptr = Marshal.StringToHGlobalAnsi(FileName); int ToReturn = (int)MediaInfoA_Open(Handle, FileName_Ptr); Marshal.FreeHGlobal(FileName_Ptr); return ToReturn; } else return (int)MediaInfo_Open(Handle, FileName); } public int Open_Buffer_Init(Int64 File_Size, Int64 File_Offset) { if (Handle == (IntPtr)0) return 0; return (int)MediaInfo_Open_Buffer_Init(Handle, File_Size, File_Offset); } public int Open_Buffer_Continue(IntPtr Buffer, IntPtr Buffer_Size) { if (Handle == (IntPtr)0) return 0; return (int)MediaInfo_Open_Buffer_Continue(Handle, Buffer, Buffer_Size); } public Int64 Open_Buffer_Continue_GoTo_Get() { if (Handle == (IntPtr)0) return 0; return (Int64)MediaInfo_Open_Buffer_Continue_GoTo_Get(Handle); } public int Open_Buffer_Finalize() { if (Handle == (IntPtr)0) return 0; return (int)MediaInfo_Open_Buffer_Finalize(Handle); } public void Close() { if (Handle == (IntPtr)0) return; MediaInfo_Close(Handle); } public String Inform() { if (Handle == (IntPtr)0) return "Unable to load MediaInfo library"; if (MustUseAnsi) return Marshal.PtrToStringAnsi(MediaInfoA_Inform(Handle, (IntPtr)0)); else return Marshal.PtrToStringUni(MediaInfo_Inform(Handle, (IntPtr)0)); } public String Get(StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo, InfoKind KindOfSearch) { if (Handle == (IntPtr)0) return "Unable to load MediaInfo library"; if (MustUseAnsi) { IntPtr Parameter_Ptr=Marshal.StringToHGlobalAnsi(Parameter); String ToReturn=Marshal.PtrToStringAnsi(MediaInfoA_Get(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, Parameter_Ptr, (IntPtr)KindOfInfo, (IntPtr)KindOfSearch)); Marshal.FreeHGlobal(Parameter_Ptr); return ToReturn; } else return Marshal.PtrToStringUni(MediaInfo_Get(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, Parameter, (IntPtr)KindOfInfo, (IntPtr)KindOfSearch)); } public String Get(StreamKind StreamKind, int StreamNumber, int Parameter, InfoKind KindOfInfo) { if (Handle == (IntPtr)0) return "Unable to load MediaInfo library"; if (MustUseAnsi) return Marshal.PtrToStringAnsi(MediaInfoA_GetI(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, (IntPtr)Parameter, (IntPtr)KindOfInfo)); else return Marshal.PtrToStringUni(MediaInfo_GetI(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber, (IntPtr)Parameter, (IntPtr)KindOfInfo)); } public String Option(String Option, String Value) { if (Handle == (IntPtr)0) return "Unable to load MediaInfo library"; if (MustUseAnsi) { IntPtr Option_Ptr=Marshal.StringToHGlobalAnsi(Option); IntPtr Value_Ptr=Marshal.StringToHGlobalAnsi(Value); String ToReturn=Marshal.PtrToStringAnsi(MediaInfoA_Option(Handle, Option_Ptr, Value_Ptr)); Marshal.FreeHGlobal(Option_Ptr); Marshal.FreeHGlobal(Value_Ptr); return ToReturn; } else return Marshal.PtrToStringUni(MediaInfo_Option(Handle, Option, Value)); } public int State_Get() { if (Handle == (IntPtr)0) return 0; return (int)MediaInfo_State_Get(Handle); } public int Count_Get(StreamKind StreamKind, int StreamNumber) { if (Handle == (IntPtr)0) return 0; return (int)MediaInfo_Count_Get(Handle, (IntPtr)StreamKind, (IntPtr)StreamNumber); } private IntPtr Handle; private bool MustUseAnsi; //Default values, if you know how to set default values in C#, say me public String Get(StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo) { return Get(StreamKind, StreamNumber, Parameter, KindOfInfo, InfoKind.Name); } public String Get(StreamKind StreamKind, int StreamNumber, String Parameter) { return Get(StreamKind, StreamNumber, Parameter, InfoKind.Text, InfoKind.Name); } public String Get(StreamKind StreamKind, int StreamNumber, int Parameter) { return Get(StreamKind, StreamNumber, Parameter, InfoKind.Text); } public String Option(String Option_) { return Option(Option_, ""); } public int Count_Get(StreamKind StreamKind) { return Count_Get(StreamKind, -1); } } public class MediaInfoList { //Import of DLL functions. DO NOT USE until you know what you do (MediaInfo DLL do NOT use CoTaskMemAlloc to allocate memory) [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_New(); [DllImport("MediaInfo.dll")] private static extern void MediaInfoList_Delete(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Open(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string FileName, IntPtr Options); [DllImport("MediaInfo.dll")] private static extern void MediaInfoList_Close(IntPtr Handle, IntPtr FilePos); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Inform(IntPtr Handle, IntPtr FilePos, IntPtr Reserved); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_GetI(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber, IntPtr Parameter, IntPtr KindOfInfo); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Get(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber, [MarshalAs(UnmanagedType.LPWStr)] string Parameter, IntPtr KindOfInfo, IntPtr KindOfSearch); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Option(IntPtr Handle, [MarshalAs(UnmanagedType.LPWStr)] string Option, [MarshalAs(UnmanagedType.LPWStr)] string Value); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_State_Get(IntPtr Handle); [DllImport("MediaInfo.dll")] private static extern IntPtr MediaInfoList_Count_Get(IntPtr Handle, IntPtr FilePos, IntPtr StreamKind, IntPtr StreamNumber); //MediaInfo class public MediaInfoList() { Handle = MediaInfoList_New(); } ~MediaInfoList() { MediaInfoList_Delete(Handle); } public int Open(String FileName, InfoFileOptions Options) { return (int)MediaInfoList_Open(Handle, FileName, (IntPtr)Options); } public void Close(int FilePos) { MediaInfoList_Close(Handle, (IntPtr)FilePos); } public String Inform(int FilePos) { return Marshal.PtrToStringUni(MediaInfoList_Inform(Handle, (IntPtr)FilePos, (IntPtr)0)); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo, InfoKind KindOfSearch) { return Marshal.PtrToStringUni(MediaInfoList_Get(Handle, (IntPtr)FilePos, (IntPtr)StreamKind, (IntPtr)StreamNumber, Parameter, (IntPtr)KindOfInfo, (IntPtr)KindOfSearch)); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, int Parameter, InfoKind KindOfInfo) { return Marshal.PtrToStringUni(MediaInfoList_GetI(Handle, (IntPtr)FilePos, (IntPtr)StreamKind, (IntPtr)StreamNumber, (IntPtr)Parameter, (IntPtr)KindOfInfo)); } public String Option(String Option, String Value) { return Marshal.PtrToStringUni(MediaInfoList_Option(Handle, Option, Value)); } public int State_Get() { return (int)MediaInfoList_State_Get(Handle); } public int Count_Get(int FilePos, StreamKind StreamKind, int StreamNumber) { return (int)MediaInfoList_Count_Get(Handle, (IntPtr)FilePos, (IntPtr)StreamKind, (IntPtr)StreamNumber); } private IntPtr Handle; //Default values, if you know how to set default values in C#, say me public void Open(String FileName) { Open(FileName, 0); } public void Close() { Close(-1); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo) { return Get(FilePos, StreamKind, StreamNumber, Parameter, KindOfInfo, InfoKind.Name); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, String Parameter) { return Get(FilePos, StreamKind, StreamNumber, Parameter, InfoKind.Text, InfoKind.Name); } public String Get(int FilePos, StreamKind StreamKind, int StreamNumber, int Parameter) { return Get(FilePos, StreamKind, StreamNumber, Parameter, InfoKind.Text); } public String Option(String Option_) { return Option(Option_, ""); } public int Count_Get(int FilePos, StreamKind StreamKind) { return Count_Get(FilePos, StreamKind, -1); } } } //NameSpace MediaInfoLib/Source/MediaInfoDLL/MediaInfoDLL.def100777 0 0 6067 12226004261 14761 0EXPORTS MediaInfo_New @26 MediaInfo_New_Quick @30 MediaInfo_Delete @27 MediaInfo_Open @14 MediaInfo_Open_Buffer @15 MediaInfo_Open_Buffer_Init @64 MediaInfo_Open_Buffer_Continue @65 MediaInfo_Open_Buffer_Continue_GoTo_Get @66 MediaInfo_Open_Buffer_Finalize @67 MediaInfo_Open_NextPacket @76 MediaInfo_Save @16 MediaInfo_Close @17 MediaInfo_Inform @18 MediaInfo_GetI @19 MediaInfo_Get @20 MediaInfo_SetI @21 MediaInfo_Set @22 MediaInfo_Output_Buffer_Get @72 MediaInfo_Output_Buffer_GetI @74 MediaInfo_Option @23 MediaInfo_State_Get @24 MediaInfo_Count_Get @25 MediaInfoA_New @28 MediaInfoA_New_Quick @31 MediaInfoA_Delete @29 MediaInfoA_Open @01 MediaInfoA_Open_Buffer @06 MediaInfoA_Open_Buffer_Init @68 MediaInfoA_Open_Buffer_Continue @69 MediaInfoA_Open_Buffer_Continue_GoTo_Get @70 MediaInfoA_Open_Buffer_Finalize @71 MediaInfoA_Open_NextPacket @77 MediaInfoA_Save @10 MediaInfoA_Close @02 MediaInfoA_Inform @03 MediaInfoA_GetI @04 MediaInfoA_Get @05 MediaInfoA_SetI @08 MediaInfoA_Set @09 MediaInfoA_Output_Buffer_Get @73 MediaInfoA_Output_Buffer_GetI @75 MediaInfoA_Option @11 MediaInfoA_State_Get @12 MediaInfoA_Count_Get @07 MediaInfo_Info_Version @13 MediaInfoList_New @32 MediaInfoList_New_Quick @33 MediaInfoList_Delete @34 MediaInfoList_Open @35 MediaInfoList_Open_Buffer @36 MediaInfoList_Save @37 MediaInfoList_Close @38 MediaInfoList_Inform @39 MediaInfoList_GetI @40 MediaInfoList_Get @41 MediaInfoList_SetI @42 MediaInfoList_Set @43 MediaInfoList_Option @44 MediaInfoList_State_Get @45 MediaInfoList_Count_Get @46 MediaInfoList_Count_Get_Files @62 MediaInfoListA_New @47 MediaInfoListA_New_Quick @48 MediaInfoListA_Delete @49 MediaInfoListA_Open @50 MediaInfoListA_Open_Buffer @51 MediaInfoListA_Save @52 MediaInfoListA_Close @53 MediaInfoListA_Inform @54 MediaInfoListA_GetI @55 MediaInfoListA_Get @56 MediaInfoListA_SetI @57 MediaInfoListA_Set @58 MediaInfoListA_Option @59 MediaInfoListA_State_Get @60 MediaInfoListA_Count_Get @61 MediaInfoListA_Count_Get_Files @63 ;Last item = 77 MediaInfoLib/Source/MediaInfoDLL/MediaInfoDLL.h100777 0 0 71060 12226004261 14465 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Public DLL interface implementation // Wrapper for MediaInfo Library // See MediaInfo.h for help // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ #ifndef MediaInfoDLLH #define MediaInfoDLLH //*************************************************************************** // Platforms (from libzen) //*************************************************************************** /*---------------------------------------------------------------------------*/ /*Win32*/ #if defined(__NT__) || defined(_WIN32) || defined(WIN32) #ifndef WIN32 #define WIN32 #endif #ifndef _WIN32 #define _WIN32 #endif #ifndef __WIN32__ #define __WIN32__ 1 #endif #endif /*---------------------------------------------------------------------------*/ /*Win64*/ #if defined(_WIN64) || defined(WIN64) #ifndef WIN64 #define WIN64 #endif #ifndef _WIN64 #define _WIN64 #endif #ifndef __WIN64__ #define __WIN64__ 1 #endif #endif /*---------------------------------------------------------------------------*/ /*Windows*/ #if defined(WIN32) || defined(WIN64) #ifndef WINDOWS #define WINDOWS #endif #ifndef _WINDOWS #define _WINDOWS #endif #ifndef __WINDOWS__ #define __WINDOWS__ 1 #endif #endif /*---------------------------------------------------------------------------*/ /*Unix (Linux, HP, Sun, BeOS...)*/ #if defined(UNIX) || defined(_UNIX) || defined(__UNIX__) \ || defined(__unix) || defined(__unix__) \ || defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) \ || defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) \ || defined(__EMX__) || defined(__VMS) || defined(__BEOS__) #ifndef UNIX #define UNIX #endif #ifndef _UNIX #define _UNIX #endif #ifndef __UNIX__ #define __UNIX__ 1 #endif #endif /*---------------------------------------------------------------------------*/ /*MacOS Classic*/ #if defined(macintosh) #ifndef MACOS #define MACOS #endif #ifndef _MACOS #define _MACOS #endif #ifndef __MACOS__ #define __MACOS__ 1 #endif #endif /*---------------------------------------------------------------------------*/ /*MacOS X*/ #if defined(__APPLE__) && defined(__MACH__) #ifndef MACOSX #define MACOSX #endif #ifndef _MACOSX #define _MACOSX #endif #ifndef __MACOSX__ #define __MACOSX__ 1 #endif #endif /*Test of targets*/ #if defined(WINDOWS) && defined(UNIX) && defined(MACOS) && defined(MACOSX) #pragma message Multiple platforms??? #endif #if !defined(WIN32) && !defined(UNIX) && !defined(MACOS) && !defined(MACOSX) #pragma message No known platforms, assume default #endif /*-------------------------------------------------------------------------*/ #if defined(_WIN32) || defined(WIN32) #ifdef _UNICODE #define MEDIAINFODLL_NAME L"MediaInfo.dll" #else //_UNICODE #define MEDIAINFODLL_NAME "MediaInfo.dll" #endif //_UNICODE #elif defined(__APPLE__) && defined(__MACH__) #define MEDIAINFODLL_NAME "libmediainfo.0.dylib" #define __stdcall #include //for size_t #else #define MEDIAINFODLL_NAME "libmediainfo.so.0" #define __stdcall #endif //!defined(_WIN32) || defined(WIN32) /*-------------------------------------------------------------------------*/ /*Char types */ #undef __T #define __T(__x) __T(__x) #if defined(UNICODE) || defined(_UNICODE) typedef wchar_t MediaInfo_Char; #undef __T #define __T(__x) L ## __x #define MEDIAINFO_Ansi "" #else typedef char MediaInfo_Char; #undef __T #define __T(__x) __x #define MEDIAINFO_Ansi "A" #endif /*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/ /*8-bit int */ typedef unsigned char MediaInfo_int8u; /*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/ /*64-bit int */ #if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__UNIX__) || defined(__MACOSX__) #undef MAXTYPE_INT #define MAXTYPE_INT 64 typedef unsigned long long MediaInfo_int64u; #elif defined(__WIN32__) || defined(_WIN32) #undef MAXTYPE_INT #define MAXTYPE_INT 64 typedef unsigned __int64 MediaInfo_int64u; #else #pragma message This machine has no 64-bit integer type? #endif /*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/ /*NULL */ #ifndef NULL #define NULL 0 #endif /*-------------------------------------------------------------------------*/ /** @brief Kinds of Stream */ typedef enum MediaInfo_stream_t { MediaInfo_Stream_General, MediaInfo_Stream_Video, MediaInfo_Stream_Audio, MediaInfo_Stream_Text, MediaInfo_Stream_Other, MediaInfo_Stream_Image, MediaInfo_Stream_Menu, MediaInfo_Stream_Max } MediaInfo_stream_C; /** @brief Kinds of Info */ typedef enum MediaInfo_info_t { MediaInfo_Info_Name, MediaInfo_Info_Text, MediaInfo_Info_Measure, MediaInfo_Info_Options, MediaInfo_Info_Name_Text, MediaInfo_Info_Measure_Text, MediaInfo_Info_Info, MediaInfo_Info_HowTo, MediaInfo_Info_Max } MediaInfo_info_C; /** @brief Option if InfoKind = Info_Options */ typedef enum MediaInfo_infooptions_t { MediaInfo_InfoOption_ShowInInform, MediaInfo_InfoOption_Reserved, MediaInfo_InfoOption_ShowInSupported, MediaInfo_InfoOption_TypeOfValue, MediaInfo_InfoOption_Max } MediaInfo_infooptions_C; /** @brief File opening options */ typedef enum MediaInfo_fileoptions_t { MediaInfo_FileOption_Nothing = 0x00, MediaInfo_FileOption_NoRecursive = 0x01, MediaInfo_FileOption_CloseAll = 0x02, MediaInfo_FileOption_Max = 0x04 } MediaInfo_fileoptions_C; #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifdef MEDIAINFO_GLIBC #include static GModule* MediaInfo_Module = NULL; #elif defined(_WIN32) || defined(WIN32) #include static HMODULE MediaInfo_Module = NULL; #else #ifdef MACOSX #include #endif #include static void* MediaInfo_Module = NULL; #endif static size_t Module_Count = 0; #ifdef MEDIAINFO_GLIBC #define MEDIAINFO_ASSIGN(_Name,_Name2) \ if (!g_module_symbol (MediaInfo_Module, "MediaInfo" MEDIAINFO_Ansi "_" _Name2, (gpointer*)&MediaInfo_##_Name)) \ Errors++; #define MEDIAINFOLIST_ASSIGN(_Name,_Name2) \ if (!g_module_symbol (MediaInfo_Module, "MediaInfoList" MEDIAINFO_Ansi "_" _Name2, (gpointer*)&MediaInfoList_##_Name)) \ Errors++; #elif defined(_WIN32) || defined(WIN32) #define MEDIAINFO_ASSIGN(_Name,_Name2) \ MediaInfo_##_Name=(MEDIAINFO_##_Name)GetProcAddress(MediaInfo_Module, "MediaInfo" MEDIAINFO_Ansi "_" _Name2); \ if (MediaInfo_##_Name==NULL) Errors++; #define MEDIAINFOLIST_ASSIGN(_Name,_Name2) \ MediaInfoList_##_Name=(MEDIAINFOLIST_##_Name)GetProcAddress(MediaInfo_Module, "MediaInfoList" MEDIAINFO_Ansi "_" _Name2); \ if (MediaInfoList_##_Name==NULL) Errors++; #else #define MEDIAINFO_ASSIGN(_Name,_Name2) \ MediaInfo_##_Name=(MEDIAINFO_##_Name)dlsym(MediaInfo_Module, "MediaInfo" MEDIAINFO_Ansi "_" _Name2); \ if (MediaInfo_##_Name==NULL) Errors++; #define MEDIAINFOLIST_ASSIGN(_Name,_Name2) \ MediaInfoList_##_Name=(MEDIAINFOLIST_##_Name)dlsym(MediaInfo_Module, "MediaInfoList" MEDIAINFO_Ansi "_" _Name2); \ if (MediaInfoList_##_Name==NULL) Errors++; #endif typedef void* (__stdcall *MEDIAINFO_New)(); static MEDIAINFO_New MediaInfo_New; typedef void* (__stdcall *MEDIAINFOLIST_New)(); static MEDIAINFOLIST_New MediaInfoList_New; typedef void (__stdcall *MEDIAINFO_Delete)(void*); static MEDIAINFO_Delete MediaInfo_Delete; typedef void (__stdcall *MEDIAINFOLIST_Delete)(void*); static MEDIAINFOLIST_Delete MediaInfoList_Delete; typedef size_t (__stdcall *MEDIAINFO_Open)(void*, const MediaInfo_Char*); static MEDIAINFO_Open MediaInfo_Open; typedef size_t (__stdcall *MEDIAINFOLIST_Open)(void*, const MediaInfo_Char*, const MediaInfo_fileoptions_C); static MEDIAINFOLIST_Open MediaInfoList_Open; typedef size_t (__stdcall *MEDIAINFO_Open_Buffer_Init)(void*, MediaInfo_int64u File_Size, MediaInfo_int64u File_Offset); static MEDIAINFO_Open_Buffer_Init MediaInfo_Open_Buffer_Init; typedef size_t (__stdcall *MEDIAINFO_Open_Buffer_Continue)(void*, MediaInfo_int8u* Buffer, size_t Buffer_Size); static MEDIAINFO_Open_Buffer_Continue MediaInfo_Open_Buffer_Continue; typedef MediaInfo_int64u(__stdcall *MEDIAINFO_Open_Buffer_Continue_GoTo_Get)(void*); static MEDIAINFO_Open_Buffer_Continue_GoTo_Get MediaInfo_Open_Buffer_Continue_GoTo_Get; typedef size_t (__stdcall *MEDIAINFO_Open_Buffer_Finalize)(void*); static MEDIAINFO_Open_Buffer_Finalize MediaInfo_Open_Buffer_Finalize; typedef size_t (__stdcall *MEDIAINFO_Open_NextPacket)(void*); static MEDIAINFO_Open_NextPacket MediaInfo_Open_NextPacket; typedef void (__stdcall *MEDIAINFO_Close)(void*); static MEDIAINFO_Close MediaInfo_Close; typedef void (__stdcall *MEDIAINFOLIST_Close)(void*, size_t); static MEDIAINFOLIST_Close MediaInfoList_Close; typedef const MediaInfo_Char* (__stdcall *MEDIAINFO_Inform)(void*, size_t Reserved); static MEDIAINFO_Inform MediaInfo_Inform; typedef const MediaInfo_Char* (__stdcall *MEDIAINFOLIST_Inform)(void*, size_t, size_t Reserved); static MEDIAINFOLIST_Inform MediaInfoList_Inform; typedef const MediaInfo_Char* (__stdcall *MEDIAINFO_GetI)(void*, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C KindOfInfo); static MEDIAINFO_GetI MediaInfo_GetI; typedef const MediaInfo_Char* (__stdcall *MEDIAINFOLIST_GetI)(void*, size_t, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C KindOfInfo); static MEDIAINFOLIST_GetI MediaInfoList_GetI; typedef const MediaInfo_Char* (__stdcall *MEDIAINFO_Get)(void*, MediaInfo_stream_C StreamKind, size_t StreamNumber, const MediaInfo_Char* Parameter, MediaInfo_info_C KindOfInfo, MediaInfo_info_C KindOfSearch); static MEDIAINFO_Get MediaInfo_Get; typedef const MediaInfo_Char* (__stdcall *MEDIAINFOLIST_Get)(void*, size_t, MediaInfo_stream_C StreamKind, size_t StreamNumber, const MediaInfo_Char* Parameter, MediaInfo_info_C KindOfInfo, MediaInfo_info_C KindOfSearch); static MEDIAINFOLIST_Get MediaInfoList_Get; typedef size_t (__stdcall *MEDIAINFO_Output_Buffer_Get)(void*, const MediaInfo_Char* Parameter); static MEDIAINFO_Output_Buffer_Get MediaInfo_Output_Buffer_Get; typedef size_t (__stdcall *MEDIAINFO_Output_Buffer_GetI)(void*, size_t Pos); static MEDIAINFO_Output_Buffer_GetI MediaInfo_Output_Buffer_GetI; typedef const MediaInfo_Char* (__stdcall *MEDIAINFO_Option)(void*, const MediaInfo_Char* Parameter, const MediaInfo_Char* Value); static MEDIAINFO_Option MediaInfo_Option; typedef const MediaInfo_Char* (__stdcall *MEDIAINFOLIST_Option)(void*, const MediaInfo_Char* Parameter, const MediaInfo_Char* Value); static MEDIAINFOLIST_Option MediaInfoList_Option; typedef size_t (__stdcall *MEDIAINFO_State_Get)(void*); static MEDIAINFO_State_Get MediaInfo_State_Get; typedef size_t (__stdcall *MEDIAINFOLIST_State_Get)(void*); static MEDIAINFOLIST_State_Get MediaInfoList_State_Get; typedef size_t (__stdcall *MEDIAINFO_Count_Get)(void*, MediaInfo_stream_C StreamKind, size_t StreamNumber); static MEDIAINFO_Count_Get MediaInfo_Count_Get; typedef size_t (__stdcall *MEDIAINFOLIST_Count_Get)(void*, size_t, MediaInfo_stream_C StreamKind, size_t StreamNumber); static MEDIAINFOLIST_Count_Get MediaInfoList_Count_Get; typedef size_t (__stdcall *MEDIAINFO_Count_Get_Files)(void*); static MEDIAINFO_Count_Get_Files MediaInfo_Count_Get_Files; typedef size_t (__stdcall *MEDIAINFOLIST_Count_Get_Files)(void*); static MEDIAINFOLIST_Count_Get_Files MediaInfoList_Count_Get_Files; static size_t MediaInfoDLL_Load() { size_t Errors = 0; if (Module_Count > 0) { Module_Count++; return 1; } /* Load library */ #ifdef MEDIAINFO_GLIBC MediaInfo_Module = g_module_open(MEDIAINFODLL_NAME, G_MODULE_BIND_LAZY); #elif defined(_WIN32) || defined(WIN32) MediaInfo_Module = LoadLibrary(MEDIAINFODLL_NAME); #else #ifdef MACOSX MediaInfo_Module = dlopen("@executable_path/" MEDIAINFODLL_NAME, RTLD_LAZY); if (!MediaInfo_Module) { CFBundleRef mainBundle = CFBundleGetMainBundle(); // get full app path and delete app name CFURLRef app_url = CFBundleCopyExecutableURL(mainBundle); CFURLRef app_path_url = CFURLCreateCopyDeletingLastPathComponent(NULL, app_url); CFStringRef app_path = CFURLCopyFileSystemPath(app_path_url, kCFURLPOSIXPathStyle); CFMutableStringRef mut_app_path = CFStringCreateMutableCopy(NULL, NULL, app_path); CFStringAppend(mut_app_path, CFSTR("/")); CFStringAppend(mut_app_path, CFSTR(MEDIAINFODLL_NAME)); CFStringEncoding encodingMethod = CFStringGetSystemEncoding(); const char *fullPath = CFStringGetCStringPtr(mut_app_path, encodingMethod); MediaInfo_Module = dlopen(fullPath, RTLD_LAZY); CFRelease(app_url); CFRelease(app_path_url); CFRelease(app_path); CFRelease(mut_app_path); } #endif /* MACOSX*/ if (!MediaInfo_Module) MediaInfo_Module = dlopen(MEDIAINFODLL_NAME, RTLD_LAZY); if (!MediaInfo_Module) MediaInfo_Module = dlopen("./" MEDIAINFODLL_NAME, RTLD_LAZY); if (!MediaInfo_Module) MediaInfo_Module = dlopen("/usr/local/lib/" MEDIAINFODLL_NAME, RTLD_LAZY); if (!MediaInfo_Module) MediaInfo_Module = dlopen("/usr/local/lib64/" MEDIAINFODLL_NAME, RTLD_LAZY); if (!MediaInfo_Module) MediaInfo_Module = dlopen("/usr/lib/" MEDIAINFODLL_NAME, RTLD_LAZY); if (!MediaInfo_Module) MediaInfo_Module = dlopen("/usr/lib64/" MEDIAINFODLL_NAME, RTLD_LAZY); #endif if (!MediaInfo_Module) return (size_t) - 1; /* Load methods */ MEDIAINFO_ASSIGN(New, "New") MEDIAINFOLIST_ASSIGN(New, "New") MEDIAINFO_ASSIGN(Delete, "Delete") MEDIAINFOLIST_ASSIGN(Delete, "Delete") MEDIAINFO_ASSIGN(Open, "Open") MEDIAINFOLIST_ASSIGN(Open, "Open") MEDIAINFO_ASSIGN(Open_Buffer_Init, "Open_Buffer_Init") MEDIAINFO_ASSIGN(Open_Buffer_Continue, "Open_Buffer_Continue") MEDIAINFO_ASSIGN(Open_Buffer_Continue_GoTo_Get, "Open_Buffer_Continue_GoTo_Get") MEDIAINFO_ASSIGN(Open_Buffer_Finalize, "Open_Buffer_Finalize") MEDIAINFO_ASSIGN(Open_NextPacket, "Open_NextPacket") MEDIAINFO_ASSIGN(Close, "Close") MEDIAINFOLIST_ASSIGN(Close, "Close") MEDIAINFO_ASSIGN(Inform, "Inform") MEDIAINFOLIST_ASSIGN(Inform, "Inform") MEDIAINFO_ASSIGN(GetI, "GetI") MEDIAINFOLIST_ASSIGN(GetI, "GetI") MEDIAINFO_ASSIGN(Get, "Get") MEDIAINFOLIST_ASSIGN(Get, "Get") MEDIAINFO_ASSIGN(Output_Buffer_Get, "Output_Buffer_Get") MEDIAINFO_ASSIGN(Output_Buffer_GetI, "Output_Buffer_GetI") MEDIAINFO_ASSIGN(Option, "Option") MEDIAINFOLIST_ASSIGN(Option, "Option") MEDIAINFO_ASSIGN(State_Get, "State_Get") MEDIAINFOLIST_ASSIGN(State_Get, "State_Get") MEDIAINFO_ASSIGN(Count_Get, "Count_Get") MEDIAINFOLIST_ASSIGN(Count_Get, "Count_Get") MEDIAINFOLIST_ASSIGN(Count_Get_Files, "Count_Get_Files") if (Errors > 0) { // Unload DLL with errors #ifdef MEDIAINFO_GLIBC g_module_close(MediaInfo_Module); #elif defined(_WIN32) || defined(WIN32) FreeLibrary(MediaInfo_Module); #else dlclose(MediaInfo_Module); #endif MediaInfo_Module = NULL; return (size_t) - 1; } Module_Count++; return (size_t)1; } static size_t MediaInfoDLL_IsLoaded() { if (MediaInfo_Module) return 1; else return 0; } static void MediaInfoDLL_UnLoad() { Module_Count--; if (Module_Count > 0) return; #ifdef MEDIAINFO_GLIBC g_module_close(MediaInfo_Module); #elif defined(_WIN32) || defined(WIN32) FreeLibrary(MediaInfo_Module); #else dlclose(MediaInfo_Module); #endif MediaInfo_Module = NULL; } #ifdef __cplusplus } #endif /*__cplusplus*/ /***************************************************************************/ /***************************************************************************/ /***************************************************************************/ #ifdef __cplusplus //DLL C++ wrapper for C functions //--------------------------------------------------------------------------- #include #include //--------------------------------------------------------------------------- namespace MediaInfoDLL { //--------------------------------------------------------------------------- //MediaInfo_Char types #undef __T #define __T(__x) __T(__x) #if defined(UNICODE) || defined(_UNICODE) typedef wchar_t Char; #undef __T #define __T(__x) L ## __x #else typedef char Char; #undef __T #define __T(__x) __x #endif typedef std::basic_string String; typedef std::basic_stringstream StringStream; typedef std::basic_istringstream iStringStream; typedef std::basic_ostringstream oStringStream; typedef std::basic_istringstream tiStringStream; // Legacy typedef std::basic_ostringstream toStringStream; //Legacy const size_t Error = (size_t)(-1); //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- /// @brief Kinds of Stream enum stream_t { Stream_General, ///< StreamKind = General Stream_Video, ///< StreamKind = Video Stream_Audio, ///< StreamKind = Audio Stream_Text, ///< StreamKind = Text Stream_Other, ///< StreamKind = Other Stream_Image, ///< StreamKind = Image Stream_Menu, ///< StreamKind = Menu Stream_Max }; /// @brief Kind of information enum info_t { Info_Name, ///< InfoKind = Unique name of parameter Info_Text, ///< InfoKind = Value of parameter Info_Measure, ///< InfoKind = Unique name of measure unit of parameter Info_Options, ///< InfoKind = See infooptions_t Info_Name_Text, ///< InfoKind = Translated name of parameter Info_Measure_Text, ///< InfoKind = Translated name of measure unit Info_Info, ///< InfoKind = More information about the parameter Info_HowTo, ///< InfoKind = Information : how data is found Info_Max }; /// Get(...)[infooptions_t] return a string like "YNYN..." \n /// Use this enum to know at what correspond the Y (Yes) or N (No) /// If Get(...)[0]==Y, then : /// @brief Option if InfoKind = Info_Options enum infooptions_t { InfoOption_ShowInInform, ///< Show this parameter in Inform() InfoOption_Reserved, ///< InfoOption_ShowInSupported, ///< Internal use only (info : Must be showed in Info_Capacities() ) InfoOption_TypeOfValue, ///< Value return by a standard Get() can be : T (Text), I (Integer, warning up to 64 bits), F (Float), D (Date), B (Binary datas coded Base64) (Numbers are in Base 10) InfoOption_Max }; /// @brief File opening options enum fileoptions_t { FileOption_Nothing = 0x00, FileOption_NoRecursive = 0x01, ///< Do not browse folders recursively FileOption_CloseAll = 0x02, ///< Close all files before open FileOption_Max = 0x04 }; const String Unable_Load_DLL = __T("Unable to load ")MEDIAINFODLL_NAME; #define MEDIAINFO_TEST_VOID \ if (!IsReady()) return #define MEDIAINFO_TEST_INT \ if (!IsReady()) return 0 #define MEDIAINFO_TEST_STRING \ if (!IsReady()) return Unable_Load_DLL #define MEDIAINFO_TEST_STRING_STATIC \ if (!MediaInfo_Module) return Unable_Load_DLL //--------------------------------------------------------------------------- class MediaInfo { public : MediaInfo() {if (!MediaInfo_Module) MediaInfoDLL_Load(); if (!MediaInfo_Module) {Handle = NULL; return;}; Handle = MediaInfo_New();}; ~MediaInfo() {MEDIAINFO_TEST_VOID; MediaInfo_Delete(Handle);}; //File size_t Open(const String &File) {MEDIAINFO_TEST_INT; return MediaInfo_Open(Handle, File.c_str());}; size_t Open_Buffer_Init(MediaInfo_int64u File_Size = (MediaInfo_int64u) - 1, MediaInfo_int64u File_Offset = 0) {MEDIAINFO_TEST_INT; return MediaInfo_Open_Buffer_Init(Handle, File_Size, File_Offset);}; size_t Open_Buffer_Continue(MediaInfo_int8u* Buffer, size_t Buffer_Size) {MEDIAINFO_TEST_INT; return MediaInfo_Open_Buffer_Continue(Handle, Buffer, Buffer_Size);}; MediaInfo_int64u Open_Buffer_Continue_GoTo_Get() {MEDIAINFO_TEST_INT; return MediaInfo_Open_Buffer_Continue_GoTo_Get(Handle);}; size_t Open_Buffer_Finalize() {MEDIAINFO_TEST_INT; return MediaInfo_Open_Buffer_Finalize(Handle);}; size_t Open_NextPacket() {MEDIAINFO_TEST_INT; return MediaInfo_Open_NextPacket(Handle);}; //size_t Save () {MEDIAINFO_TEST_INT; return MediaInfo_Save(Handle);}; void Close() {MEDIAINFO_TEST_VOID; return MediaInfo_Close(Handle);}; //General information String Inform() {MEDIAINFO_TEST_STRING; return MediaInfo_Inform(Handle, 0);}; String Get(stream_t StreamKind, size_t StreamNumber, size_t Parameter, info_t InfoKind = Info_Text) {MEDIAINFO_TEST_STRING; return MediaInfo_GetI(Handle, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter, (MediaInfo_info_C)InfoKind);}; String Get(stream_t StreamKind, size_t StreamNumber, const String &Parameter, info_t InfoKind = Info_Text, info_t SearchKind = Info_Name) {MEDIAINFO_TEST_STRING; return MediaInfo_Get(Handle, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter.c_str(), (MediaInfo_info_C)InfoKind, (MediaInfo_info_C)SearchKind);}; //size_t Set (const String &ToSet, stream_t StreamKind, size_t StreamNumber, size_t Parameter, const String &OldValue=__T("")) {MEDIAINFO_TEST_INT; return MediaInfo_SetI (Handle, ToSet.c_str(), (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter, OldValue.c_str());}; //size_t Set (const String &ToSet, stream_t StreamKind, size_t StreamNumber, const String &Parameter, const String &OldValue=__T("")) {MEDIAINFO_TEST_INT; return MediaInfo_Set (Handle, ToSet.c_str(), (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter.c_str(), OldValue.c_str());}; size_t Output_Buffer_Get(const String &Value) {return MediaInfo_Output_Buffer_Get(Handle, Value.c_str());} size_t Output_Buffer_Get(size_t Pos) {return MediaInfo_Output_Buffer_GetI(Handle, Pos);} String Option(const String &Option, const String &Value = __T("")) {MEDIAINFO_TEST_STRING; return MediaInfo_Option(Handle, Option.c_str(), Value.c_str());}; static String Option_Static(const String &Option, const String &Value = __T("")) {if (!MediaInfo_Module) MediaInfoDLL_Load(); MEDIAINFO_TEST_STRING_STATIC; return MediaInfo_Option(NULL, Option.c_str(), Value.c_str());}; size_t State_Get() {MEDIAINFO_TEST_INT; return MediaInfo_State_Get(Handle);}; size_t Count_Get(stream_t StreamKind, size_t StreamNumber = (size_t) - 1) {MEDIAINFO_TEST_INT; return MediaInfo_Count_Get(Handle, (MediaInfo_stream_C)StreamKind, StreamNumber);}; bool IsReady() {return (Handle && MediaInfo_Module) ? true : false;} private : void* Handle; }; class MediaInfoList { public : MediaInfoList() {MediaInfoDLL_Load(); if (!MediaInfoDLL_IsLoaded()) {Handle = NULL; return;}; Handle = MediaInfoList_New();}; ~MediaInfoList() {MEDIAINFO_TEST_VOID; MediaInfoList_Delete(Handle); MediaInfoDLL_UnLoad();}; //File size_t Open(const String &File, const fileoptions_t Options = FileOption_Nothing) {MEDIAINFO_TEST_INT; return MediaInfoList_Open(Handle, File.c_str(), (MediaInfo_fileoptions_C)Options);}; //size_t Save (size_t FilePos) {MEDIAINFO_TEST_INT; return MediaInfoList_Save(Handle, FilePos);}; void Close(size_t FilePos = (size_t) - 1) {MEDIAINFO_TEST_VOID; return MediaInfoList_Close(Handle, FilePos);}; //General information String Inform(size_t FilePos = (size_t) - 1) {MEDIAINFO_TEST_STRING; return MediaInfoList_Inform(Handle, FilePos, 0);}; String Get(size_t FilePos, stream_t StreamKind, size_t StreamNumber, size_t Parameter, info_t InfoKind = Info_Text) {MEDIAINFO_TEST_STRING; return MediaInfoList_GetI(Handle, FilePos, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter, (MediaInfo_info_C)InfoKind);}; String Get(size_t FilePos, stream_t StreamKind, size_t StreamNumber, const String &Parameter, info_t InfoKind = Info_Text, info_t SearchKind = Info_Name) {MEDIAINFO_TEST_STRING; return MediaInfoList_Get(Handle, FilePos, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter.c_str(), (MediaInfo_info_C)InfoKind, (MediaInfo_info_C)SearchKind);}; //size_t Set (const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, size_t Parameter, const String &OldValue=__T("")) {MEDIAINFO_TEST_INT; return MediaInfoList_SetI (Handle, ToSet.c_str(), FilePos, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter, OldValue.c_str());}; //size_t Set (const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, const String &Parameter, const String &OldValue=__T("")) {MEDIAINFO_TEST_INT; return MediaInfoList_Set (Handle, ToSet.c_str(), FilePos, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter.c_str(), OldValue.c_str());}; String Option(const String &Option, const String &Value = __T("")) {MEDIAINFO_TEST_STRING; return MediaInfoList_Option(Handle, Option.c_str(), Value.c_str());}; static String Option_Static(const String &Option, const String &Value = __T("")) {MEDIAINFO_TEST_STRING_STATIC; return MediaInfoList_Option(NULL, Option.c_str(), Value.c_str());}; size_t State_Get() {MEDIAINFO_TEST_INT; return MediaInfoList_State_Get(Handle);}; size_t Count_Get(size_t FilePos, stream_t StreamKind, size_t StreamNumber = (size_t) - 1) {MEDIAINFO_TEST_INT; return MediaInfoList_Count_Get(Handle, FilePos, (MediaInfo_stream_C)StreamKind, StreamNumber);}; size_t Count_Get() {MEDIAINFO_TEST_INT; return MediaInfoList_Count_Get_Files(Handle);}; bool IsReady() {return (Handle && MediaInfo_Module) ? true : false;} private : void* Handle; }; } //NameSpace #endif /*__cplusplus*/ #endif MediaInfoLib/Source/MediaInfoDLL/MediaInfoDLL.JNA.java100777 0 0 32721 12226004261 15567 0/* 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. */ // Note: the original stuff was well packaged with Java style, // but I (the main developer) prefer to keep an easiest for me // way to have all sources and example in the same place // Removed stuff: // "package net.sourceforge.mediainfo;" // directory was /net/sourceforge/mediainfo import static java.util.Collections.singletonMap; import java.lang.reflect.Method; import java.net.URL; import com.sun.jna.FunctionMapper; import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.NativeLibrary; import com.sun.jna.Pointer; import com.sun.jna.WString; class MediaInfo { static String LibraryPath="mediainfo"; static { // libmediainfo for linux depends on libzen try { // We need to load dependencies first, because we know where our native libs are (e.g. Java Web Start Cache). // If we do not, the system will look for dependencies, but only in the library path. String os=System.getProperty("os.name"); if (os!=null && !os.toLowerCase().startsWith("windows") && !os.toLowerCase().startsWith("mac")) { final ClassLoader loader=MediaInfo.class.getClassLoader(); final String LocalPath; if (loader!=null) { LocalPath=loader.getResource(MediaInfo.class.getName().replace('.', '/')+ ".class").getPath().replace("MediaInfo.class", ""); try { NativeLibrary.getInstance(LocalPath+"libzen.so.0"); // Local path } catch (LinkageError e) { NativeLibrary.getInstance("zen"); // Default path } } else { LocalPath=""; NativeLibrary.getInstance("zen"); // Default path } if (LocalPath.length()>0) { try { NativeLibrary.getInstance(LocalPath+"libmediainfo.so.0"); // Local path LibraryPath=LocalPath+"libmediainfo.so.0"; } catch (LinkageError e) { } } } } catch (LinkageError e) { //Logger.getLogger(MediaInfo.class.getName()).warning("Failed to preload libzen"); } } //Internal stuff interface MediaInfoDLL_Internal extends Library { MediaInfoDLL_Internal INSTANCE = (MediaInfoDLL_Internal) Native.loadLibrary(LibraryPath, MediaInfoDLL_Internal.class, singletonMap(OPTION_FUNCTION_MAPPER, new FunctionMapper() { @Override public String getFunctionName(NativeLibrary lib, Method method) { /* 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. */ return "MediaInfo_" + method.getName(); } } )); //Constructor/Destructor Pointer New(); void Delete(Pointer Handle); //File int Open(Pointer Handle, WString file); void Close(Pointer Handle); //Infos WString Inform(Pointer Handle, int Reserved); WString Get(Pointer Handle, int StreamKind, int StreamNumber, WString parameter, int infoKind, int searchKind); WString GetI(Pointer Handle, int StreamKind, int StreamNumber, int parameterIndex, int infoKind); int Count_Get(Pointer Handle, int StreamKind, int StreamNumber); //Options WString Option(Pointer Handle, WString option, WString value); } private Pointer Handle; public enum StreamKind { General, Video, Audio, Text, Other, Image, Menu; } //Enums public enum InfoKind { /** * Unique name of parameter. */ Name, /** * Value of parameter. */ Text, /** * Unique name of measure unit of parameter. */ Measure, Options, /** * Translated name of parameter. */ Name_Text, /** * Translated name of measure unit. */ Measure_Text, /** * More information about the parameter. */ Info, /** * How this parameter is supported, could be N (No), B (Beta), R (Read only), W * (Read/Write). */ HowTo, /** * Domain of this piece of information. */ Domain; } //Constructor/Destructor public MediaInfo() { Handle = MediaInfoDLL_Internal.INSTANCE.New(); } public void dispose() { if (Handle == null) throw new IllegalStateException(); MediaInfoDLL_Internal.INSTANCE.Delete(Handle); Handle = null; } @Override protected void finalize() throws Throwable { if (Handle != null) dispose(); } //File /** * Open a file and collect information about it (technical information and tags). * * @param file full name of the file to open * @return 1 if file was opened, 0 if file was not not opened */ public int Open(String File_Name) { return MediaInfoDLL_Internal.INSTANCE.Open(Handle, new WString(File_Name)); } /** * Close a file opened before with Open(). * */ public void Close() { MediaInfoDLL_Internal.INSTANCE.Close(Handle); } //Information /** * Get all details about a file. * * @return All details about a file in one string */ public String Inform() { return MediaInfoDLL_Internal.INSTANCE.Inform(Handle, 0).toString(); } /** * Get a piece of information about a file (parameter is a string). * * @param StreamKind Kind of Stream (general, video, audio...) * @param StreamNumber Stream number in Kind of Stream (first, second...) * @param parameter Parameter you are looking for in the Stream (Codec, width, bitrate...), * in string format ("Codec", "Width"...) * @return a string about information you search, an empty string if there is a problem */ public String Get(StreamKind StreamKind, int StreamNumber, String parameter) { return Get(StreamKind, StreamNumber, parameter, InfoKind.Text, InfoKind.Name); } /** * Get a piece of information about a file (parameter is a string). * * @param StreamKind Kind of Stream (general, video, audio...) * @param StreamNumber Stream number in Kind of Stream (first, second...) * @param parameter Parameter you are looking for in the Stream (Codec, width, bitrate...), * in string format ("Codec", "Width"...) * @param infoKind Kind of information you want about the parameter (the text, the measure, * the help...) * @param searchKind Where to look for the parameter */ public String Get(StreamKind StreamKind, int StreamNumber, String parameter, InfoKind infoKind) { return Get(StreamKind, StreamNumber, parameter, infoKind, InfoKind.Name); } /** * Get a piece of information about a file (parameter is a string). * * @param StreamKind Kind of Stream (general, video, audio...) * @param StreamNumber Stream number in Kind of Stream (first, second...) * @param parameter Parameter you are looking for in the Stream (Codec, width, bitrate...), * in string format ("Codec", "Width"...) * @param infoKind Kind of information you want about the parameter (the text, the measure, * the help...) * @param searchKind Where to look for the parameter * @return a string about information you search, an empty string if there is a problem */ public String Get(StreamKind StreamKind, int StreamNumber, String parameter, InfoKind infoKind, InfoKind searchKind) { return MediaInfoDLL_Internal.INSTANCE.Get(Handle, StreamKind.ordinal(), StreamNumber, new WString(parameter), infoKind.ordinal(), searchKind.ordinal()).toString(); } /** * Get a piece of information about a file (parameter is an integer). * * @param StreamKind Kind of Stream (general, video, audio...) * @param StreamNumber Stream number in Kind of Stream (first, second...) * @param parameter Parameter you are looking for in the Stream (Codec, width, bitrate...), * in integer format (first parameter, second parameter...) * @return a string about information you search, an empty string if there is a problem */ public String get(StreamKind StreamKind, int StreamNumber, int parameterIndex) { return Get(StreamKind, StreamNumber, parameterIndex, InfoKind.Text); } /** * Get a piece of information about a file (parameter is an integer). * * @param StreamKind Kind of Stream (general, video, audio...) * @param StreamNumber Stream number in Kind of Stream (first, second...) * @param parameter Parameter you are looking for in the Stream (Codec, width, bitrate...), * in integer format (first parameter, second parameter...) * @param infoKind Kind of information you want about the parameter (the text, the measure, * the help...) * @return a string about information you search, an empty string if there is a problem */ public String Get(StreamKind StreamKind, int StreamNumber, int parameterIndex, InfoKind infoKind) { return MediaInfoDLL_Internal.INSTANCE.GetI(Handle, StreamKind.ordinal(), StreamNumber, parameterIndex, infoKind.ordinal()).toString(); } /** * Count of Streams of a Stream kind (StreamNumber not filled), or count of piece of * information in this Stream. * * @param StreamKind Kind of Stream (general, video, audio...) * @return number of Streams of the given Stream kind */ public int Count_Get(StreamKind StreamKind) { //We should use NativeLong for -1, but it fails on 64-bit //int Count_Get(Pointer Handle, int StreamKind, NativeLong StreamNumber); //return MediaInfoDLL_Internal.INSTANCE.Count_Get(Handle, StreamKind.ordinal(), -1); //so we use slower Get() with a character string String StreamCount = Get(StreamKind, 0, "StreamCount"); if (StreamCount == null || StreamCount.length() == 0) return 0; return Integer.parseInt(StreamCount); } /** * Count of Streams of a Stream kind (StreamNumber not filled), or count of piece of * information in this Stream. * * @param StreamKind Kind of Stream (general, video, audio...) * @param StreamNumber Stream number in this kind of Stream (first, second...) * @return number of Streams of the given Stream kind */ public int Count_Get(StreamKind StreamKind, int StreamNumber) { return MediaInfoDLL_Internal.INSTANCE.Count_Get(Handle, StreamKind.ordinal(), StreamNumber); } //Options /** * Configure or get information about MediaInfo. * * @param Option The name of option * @return Depends on the option: by default "" (nothing) means No, other means Yes */ public String Option(String Option) { return MediaInfoDLL_Internal.INSTANCE.Option(Handle, new WString(Option), new WString("")).toString(); } /** * Configure or get information about MediaInfo. * * @param Option The name of option * @param Value The value of option * @return Depends on the option: by default "" (nothing) means No, other means Yes */ public String Option(String Option, String Value) { return MediaInfoDLL_Internal.INSTANCE.Option(Handle, new WString(Option), new WString(Value)).toString(); } /** * Configure or get information about MediaInfo (Static version). * * @param Option The name of option * @return Depends on the option: by default "" (nothing) means No, other means Yes */ public static String Option_Static(String Option) { return MediaInfoDLL_Internal.INSTANCE.Option(MediaInfoDLL_Internal.INSTANCE.New(), new WString(Option), new WString("")).toString(); } /** * Configure or get information about MediaInfo(Static version). * * @param Option The name of option * @param Value The value of option * @return Depends on the option: by default "" (nothing) means No, other means Yes */ public static String Option_Static(String Option, String Value) { return MediaInfoDLL_Internal.INSTANCE.Option(MediaInfoDLL_Internal.INSTANCE.New(), new WString(Option), new WString(Value)).toString(); } } MediaInfoLib/Source/MediaInfoDLL/MediaInfoDLL.JNative.java100777 0 0 57725 12226004261 16532 0/* 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. */ import org.xvolks.jnative.JNative; import org.xvolks.jnative.Type; import org.xvolks.jnative.pointers.Pointer; import org.xvolks.jnative.pointers.memory.MemoryBlockFactory; import org.xvolks.jnative.exceptions.NativeException; import org.xvolks.jnative.pointers.memory.NativeMemoryBlock; /** * Class to retrieve info about media files. * MediaInfo library (http://MediaArea.net/MediaInfo) is used * by the help of JNative (http://jnative.sourceforge.net) * to obtain technical the info about the files. * * @author bro3@users.sourceforge.net * @author Info@MediaArea.net */ class MediaInfo { /* static_fields */ final public static int Stream_General = 0; final public static int Stream_Video = 1; final public static int Stream_Audio = 2; final public static int Stream_Text = 3; final public static int Stream_Other = 4; final public static int Stream_Image = 5; final public static int Stream_Menu = 6; final public static int Stream_Max = 7; final public static int Info_Name = 0; final public static int Info_Text = 1; final public static int Info_Measure = 2; final public static int Info_Options = 3; final public static int Info_Name_Text = 4; final public static int Info_Measure_Text = 5; final public static int Info_Info = 6; final public static int Info_HowTo = 7; final public static int Info_Max = 8; /* The MediaInfo handle */ private String handle = null; private JNative new_jnative; /* The library to be used */ private static String libraryName = ""; /** * Constructor that initializes the new MediaInfo object. * @throws NativeException JNative Exception. */ public MediaInfo() throws NativeException, Exception { setLibraryName(); New(); } /** * Constructor that initializes the new MediaInfo object. * @param libraryName name of libarary to be used * @throws NativeException JNative Exception */ public MediaInfo(String libraryName) throws NativeException, Exception { setLibraryName(libraryName); New(); } /** * Method New initializes the MediaInfo handle * @throws NativeException JNative Exception */ private void New() throws NativeException, Exception { /* Getting the handle */ new_jnative = new JNative(libraryName, "MediaInfoA_New"); new_jnative.setRetVal(Type.INT); new_jnative.invoke(); handle = new_jnative.getRetVal(); Option("CharSet", "UTF-8"); } /** * Opens a media file. * Overloads method {@link #Open(int, int, int, int)} * @param begin buffer with the beginning of datas * @param beginSize size of begin * @return 1 for success and 0 for failure * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception * @see #Open(int, int, int, int) */ public int Open(int begin, int beginSize) throws HandleNotInitializedException, NativeException, Exception { return Open(begin, beginSize, 0, 0); } /** * Opens a media file. * @param begin buffer with the beginning of datas * @param beginSize size of begin * @param end buffer with the end of datas * @param endSize size of end * @return 1 for success and 0 for failure * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public int Open(int begin, int beginSize, int end, int endSize) throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Open_Buffer"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, handle); jnative.setParameter(1, Type.INT, String.valueOf(begin)); jnative.setParameter(2, Type.INT, String.valueOf(beginSize)); jnative.setParameter(3, Type.INT, String.valueOf(end)); jnative.setParameter(4, Type.INT, String.valueOf(endSize)); jnative.invoke(); /* Retrieving data */ int ret = Integer.parseInt(jnative.getRetVal()); return ret; } /** * Opens a media file. * @param filename the filename * @return 1 for success and 0 for failure * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public int Open(String filename) throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /* Setting the memory with the byte array returned in UTF-8 format */ Pointer fileNamePointer = createPointer(filename); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Open"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, handle); jnative.setParameter(1, fileNamePointer); jnative.invoke(); /* Retrieving data */ int ret = Integer.parseInt(jnative.getRetVal()); return ret; } /** * Gets the file info, (if available) according to the previous options set by {@link #Option(String, String)} * @return the file info * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public String Inform() throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Inform"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, handle); jnative.setParameter(1, Type.INT, "0"); //Necessary for backward compatibility jnative.invoke(); /* Retrieving data */ String ret = retrieveString(jnative); return ret; } /** * Gets the specific info according to the parameters. * Overloads method {@link #Get(int, int, String, int, int)}. * @param streamKind type of stream. Can be any of the Stream_XX values {@link Field details} * @param streamNumber stream number to process * @param parameter parameter string (list of strings is available with Option("Info_Parameters"); * @return information * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception * @see #Get(int, int, String, int, int) */ public String Get(int streamKind, int streamNumber, String parameter) throws HandleNotInitializedException, NativeException, Exception { return Get(streamKind, streamNumber, parameter, MediaInfo.Info_Name, MediaInfo.Info_Text); } /** * Gets the specific info according to the parameters. * Overloads method {@link #Get(int, int, String, int, int)} * @param streamKind type of stream. Can be any of the Stream_XX values {@link Field details} * @param streamNumber stream to process * @param parameter parameter string (list of strings is available with Option("Info_Parameters"); * @param infoKind type of info. Can be any of the Info_XX values {@link Field details} * @return desired information * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception * @see #Get(int, int, String, int, int) */ public String Get(int streamKind, int streamNumber, String parameter, int infoKind) throws HandleNotInitializedException, NativeException, Exception { return Get(streamKind, streamNumber, parameter, infoKind, MediaInfo.Info_Name); } /** * Gets the specific file info according to the parameters. * @param streamKind type of stream. Can be any of the Stream_XX values {@link Field details} * @param streamNumber stream to process * @param parameter parameter string (list of strings is available with Option("Info_Parameters"); * @param infoKind type of info. Can be any of the Info_XX values {@link Field details} * @param searchKind type of search. Can be any of the Info_XX values {@link Field details} * @return desired information * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public String Get(int streamKind, int streamNumber, String parameter, int infoKind, int searchKind) throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /* Setting the memory with the byte array returned in UTF-8 format */ Pointer parameterPointer = createPointer(parameter); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Get"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, handle); jnative.setParameter(1, Type.INT, String.valueOf(streamKind)); jnative.setParameter(2, Type.INT, String.valueOf(streamNumber)); jnative.setParameter(3, parameterPointer); jnative.setParameter(4, Type.INT, String.valueOf(infoKind)); jnative.setParameter(5, Type.INT, String.valueOf(searchKind)); jnative.invoke(); /* Retrieving data */ String ret = retrieveString(jnative); return ret; } /** * Gets the specific file info according to the parameters. * Overloads method {@link #Get(int, int, int, int)}. * @param streamKind type of stream. Can be any of the Stream_XX values {@link Field details} * @param streamNumber stream to process * @param parameter parameter position (count of parameters is available with Count_Get(streamKind, streamNumber) ) * @return desired information * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception * @see #Get(int, int, int, int) */ public String Get(int streamKind, int streamNumber, int parameter) throws HandleNotInitializedException, NativeException, Exception { return Get(streamKind, streamNumber, parameter, MediaInfo.Info_Text); } /** * Gets the specific file info according to the parameters. * @param streamKind type of stream. Can be any of the Stream_XX values {@link Field details} * @param streamNumber stream to process * @param parameter parameter position (count of parameters is available with Count_Get(streamKind, streamNumber) ) * @param infoKind type of info. Can be any of the Info_XX values {@link Field details} * @return desired information * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public String Get(int streamKind, int streamNumber, int parameter, int infoKind) throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_GetI"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, handle); jnative.setParameter(1, Type.INT, String.valueOf(streamKind)); jnative.setParameter(2, Type.INT, String.valueOf(streamNumber)); jnative.setParameter(3, Type.INT, String.valueOf(parameter)); jnative.setParameter(4, Type.INT, String.valueOf(infoKind)); jnative.invoke(); /* Retrieving data */ String ret = retrieveString(jnative); return ret; } /** * Sets the option * Overloads method {@link #Option(String, String)} * @param option name of option * @return desired information or status of the option * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception * @see #Option(String, String) */ public String Option(String option) throws HandleNotInitializedException, NativeException, Exception { return Option(option, ""); } /** * Sets the option with value * @param option name of option * @param value option value * @return desired information or status of the option * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public String Option(String option, String value) throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /* Setting the memory with the byte array returned in UTF-8 format */ Pointer optionPointer = createPointer(option); Pointer valuePointer = createPointer(value); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Option"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, handle); jnative.setParameter(1, optionPointer); jnative.setParameter(2, valuePointer); jnative.invoke(); /* Retrieving data */ String ret = retrieveString(jnative); return ret; } /** * Sets the option (you do not need to create a MediaInfo handle) * Overloads method {@link #Option_Static(String, String)} * @param option name of option * @return desired information or status of the option * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception * @see #Option_Static(String, String) */ static public String Option_Static(String option) throws HandleNotInitializedException, NativeException, Exception { return Option_Static(option, ""); } /** * Sets the option (you do not need to create a MediaInfo handle) * @param option name of option * @param value option value * @return desired information or status of the option * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ static public String Option_Static(String option, String value) throws HandleNotInitializedException, NativeException, Exception { if (libraryName.equals("")) setLibraryName(); /* Setting the memory with the byte array returned in UTF-8 format */ Pointer optionPointer = createPointer(option); Pointer valuePointer = createPointer(value); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Option"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, "0"); jnative.setParameter(1, optionPointer); jnative.setParameter(2, valuePointer); jnative.invoke(); /* Retrieving data */ String ret = retrieveString(jnative); return ret; } /** * Gets the state of the libaray * @return state of the library (between 0 and 10000) * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public int State_Get() throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_State_Get"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, handle); jnative.invoke(); /* Retrieving data */ int ret = Integer.parseInt(jnative.getRetVal()); return ret; } /** * Gets the count of streams * Overloads method {@link #Count_Get(int, int)}. * @param streamKind type of stream. Can be any of the Stream_XX values {@link Field details} * @return count of streams * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception * @see #Count_Get(int, int) */ public int Count_Get(int streamKind) throws HandleNotInitializedException, NativeException, Exception { return Count_Get(streamKind, -1); } /** * Gets the count of streams * @param streamKind type of stream. Can be any of the Stream_XX values {@link Field details} * @param streamNumber stream to process * @return count of parameters for a specific stream * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public int Count_Get(int streamKind, int streamNumber) throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Count_Get"); jnative.setRetVal(Type.INT); jnative.setParameter(0, Type.INT, handle); jnative.setParameter(1, Type.INT, String.valueOf(streamKind)); jnative.setParameter(2, Type.INT, String.valueOf(streamNumber)); jnative.invoke(); /* Retrieving data */ int retval = Integer.parseInt(jnative.getRetVal()); return retval; } /** * Deletes the handle * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ protected void finalize() throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Delete"); jnative.setParameter(0, Type.INT, handle); jnative.invoke(); } /** * Closes the handle * @throws HandleNotInitializedException if the handle is null * @throws NativeException JNative Exception */ public void Close() throws HandleNotInitializedException, NativeException, Exception { if (handle == null) throw new HandleNotInitializedException("Handle is not initialized."); /*JNative call */ JNative jnative = new JNative(libraryName, "MediaInfoA_Close"); jnative.setParameter(0, Type.INT, handle); jnative.invoke(); } /** * Create a memory pointer for giving it to an external library * @param value The string to give * @return A pointer to the memory */ static Pointer createPointer(String value) throws Exception { value+="\0"; byte[] array=value.getBytes("UTF-8"); Pointer valuePointer = new Pointer(MemoryBlockFactory.createMemoryBlock(array.length)); valuePointer.setMemory(array); return valuePointer; } /** * Create a string from a memory pointer * @param jnative The jnative handler * @return A string */ static String retrieveString(JNative jnative) throws Exception { int address = Integer.parseInt(jnative.getRetVal()); byte[] strEnd ={0}; int howFarToSearch =10000; int length =0; while (true) { int pos=JNative.searchNativePattern(address+length, strEnd, howFarToSearch); if (pos == -1) howFarToSearch+=10000; //The strEnd wasn't found else { length+=pos; break; } } if (length > 0) { Pointer retPointer = new Pointer(new NativeMemoryBlock(address, length)); String fileInfo = new String(retPointer.getMemory(), "UTF-8"); retPointer.dispose(); return fileInfo; } else return new String(); } /** * Sets the default name of the library to be used. * If windows -> "MediaInfo.dll" else -> "libmediainfo.so.0" */ public static void setLibraryName() { if (libraryName.equals("")) { String os=System.getProperty("os.name"); if (os!=null && os.toLowerCase().startsWith("windows")) setLibraryName("MediaInfo.dll"); else if (os!=null && os.toLowerCase().startsWith("mac")) setLibraryName("libmediainfo.dynlib.0"); else setLibraryName("libmediainfo.so.0"); } } /** * Sets the name of the library to be used. * @param libName name of the library */ public static void setLibraryName(String libName) { libraryName = libName; } } /** * Exception thrown if the handle isn't initialized. */ class HandleNotInitializedException extends Exception { private static final long serialVersionUID = 1L; HandleNotInitializedException(String msg) { super(msg); } } MediaInfoLib/Source/MediaInfoDLL/MediaInfoDLL.jsl100777 0 0 11516 12226004261 15026 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Microsoft Visual J# wrapper for MediaInfo Library // See MediaInfo.h for help // // To make it working, you must put MediaInfo.Dll // in the executable folder // // Warning : not tested with J# 64-bit, will not work! // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ import System.Runtime.InteropServices.*; import System.IntPtr; public enum StreamKind { General, Visual, Audio, Text, Other, Image, Menu, Max } public enum InfoKind { Name, Text, Measure, Options, NameText, MeasureText, Info, HowTo, Max } public enum InfoOptions { ShowInInform, Reserved, ShowInSupported, TypeOfValue, Max } public class MediaInfo { /**@attribute DllImport("MediaInfo.dll")*/ public static native IntPtr MediaInfo_New(); /**@attribute DllImport("MediaInfo.dll")*/ public static native void MediaInfo_Delete(IntPtr Handle); /**@attribute DllImport("MediaInfo.dll")*/ public static native int MediaInfo_Open(IntPtr Handle, /** @attribute MarshalAs(UnmanagedType.LPWStr)*/ String File); /**@attribute DllImport("MediaInfo.dll")*/ public static native void MediaInfo_Close(IntPtr Handle); /**@attribute DllImport("MediaInfo.dll")*/ public static native IntPtr MediaInfo_Inform(IntPtr Handle, int Options); //WARNING : This is a wchar* value /**@attribute DllImport("MediaInfo.dll")*/ public static native IntPtr MediaInfo_GetI(IntPtr Handle, StreamKind StreamKind, int StreamNumber, int Parameter, InfoKind KindOfInfo); //WARNING : This is a wchar* value, see MediaInfoDLL.h for enumeration values /**@attribute DllImport("MediaInfo.dll")*/ public static native IntPtr MediaInfo_Get(IntPtr Handle, StreamKind StreamKind, int StreamNumber, /** @attribute MarshalAs(UnmanagedType.LPWStr)*/ String Parameter, InfoKind KindOfInfo, InfoKind KindOfSearch); //WARNING : This is a wchar* value, see MediaInfoDLL.h for enumeration values /**@attribute DllImport("MediaInfo.dll")*/ public static native IntPtr MediaInfo_Option(IntPtr Handle, /** @attribute MarshalAs(UnmanagedType.LPWStr)*/ String Option, /** @attribute MarshalAs(UnmanagedType.LPWStr)*/ String Value); //WARNING : This is a wchar* value, see MediaInfoDLL.h for enumeration values /**@attribute DllImport("MediaInfo.dll")*/ public static native int MediaInfo_State_Get(IntPtr Handle); //see MediaInfoDLL.h for details /**@attribute DllImport("MediaInfo.dll")*/ public static native int MediaInfo_Count_Get(IntPtr Handle, StreamKind StreamKind, int StreamNumber); //see MediaInfoDLL.h for enumeration values //MediaInfo class public MediaInfo() { Handle = MediaInfo_New(); } void Dispose(boolean disposing) { MediaInfo_Delete(Handle); } public int Open(String FileName) { return MediaInfo_Open(Handle, FileName); } public void Close() { MediaInfo_Close(Handle); } public String Inform() { return Marshal.PtrToStringUni(MediaInfo_Inform(Handle, 0)); } public String Get(StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo, InfoKind KindOfSearch) { return Marshal.PtrToStringUni(MediaInfo_Get(Handle, StreamKind, StreamNumber, Parameter, KindOfInfo, KindOfSearch)); } public String Get(StreamKind StreamKind, int StreamNumber, int Parameter, InfoKind KindOfInfo) { return Marshal.PtrToStringUni(MediaInfo_GetI(Handle, StreamKind, StreamNumber, Parameter, KindOfInfo)); } public String Option(String Option, String Value) { return Marshal.PtrToStringUni(MediaInfo_Option(Handle, Option, Value)); } public int State_Get() { return MediaInfo_State_Get(Handle); } public int Count_Get(StreamKind StreamKind, int StreamNumber) { return MediaInfo_Count_Get(Handle, StreamKind, StreamNumber); } private IntPtr Handle; //Default values, if you know how to set default values in J#, say me public String Get(StreamKind StreamKind, int StreamNumber, String Parameter, InfoKind KindOfInfo) { return Get(StreamKind, StreamNumber, Parameter, KindOfInfo, InfoKind.Name); } public String Get(StreamKind StreamKind, int StreamNumber, String Parameter) { return Get(StreamKind, StreamNumber, Parameter, InfoKind.Text, InfoKind.Name); } public String Get(StreamKind StreamKind, int StreamNumber, int Parameter) { return Get(StreamKind, StreamNumber, Parameter, InfoKind.Text); } public String Option(String Option) { return Option(Option, ""); } public int Count_Get(StreamKind StreamKind) { return Count_Get(StreamKind, -1); } } MediaInfoLib/Source/MediaInfoDLL/MediaInfoDLL.pas100777 0 0 20206 12226004261 15015 0unit MediaInfoDll; { MediaInfoLib (MediaInfo.dll v0.7.7.6) Interface for Delphi (c)2008 by Norbert Mereg (Icebob) http://MediaArea.net/MediaInfo } interface uses {$IFDEF WIN32} Windows; {$ELSE} Wintypes, WinProcs; {$ENDIF} type TMIStreamKind = ( Stream_General, Stream_Video, Stream_Audio, Stream_Text, Stream_Other, Stream_Image, Stream_Menu, Stream_Max ); type TMIInfo = ( Info_Name, Info_Text, Info_Measure, Info_Options, Info_Name_Text, Info_Measure_Text, Info_Info, Info_HowTo, Info_Max ); type TMIInfoOption = ( InfoOption_ShowInInform, InfoOption_Reserved, InfoOption_ShowInSupported, InfoOption_TypeOfValue, InfoOption_Max ); {$IFDEF STATIC} // Unicode methods function MediaInfo_New(): Cardinal cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; procedure MediaInfo_Delete(Handle: Cardinal) cdecl {$IFDEF WIN32} stdcall {$ENDIF}; external 'MediaInfo.Dll'; function MediaInfo_Open(Handle: Cardinal; File__: PWideChar): Cardinal cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; procedure MediaInfo_Close(Handle: Cardinal) cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; function MediaInfo_Inform(Handle: Cardinal; Reserved: Integer): PWideChar cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; function MediaInfo_GetI(Handle: Cardinal; StreamKind: TMIStreamKind; StreamNumber: Integer; Parameter: Integer; KindOfInfo: TMIInfo): PWideChar cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; //Default: KindOfInfo=Info_Text function MediaInfo_Get(Handle: Cardinal; StreamKind: TMIStreamKind; StreamNumber: Integer; Parameter: PWideChar; KindOfInfo: TMIInfo; KindOfSearch: TMIInfo): PWideChar cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; //Default: KindOfInfo=Info_Text, KindOfSearch=Info_Name function MediaInfo_Option(Handle: Cardinal; Option: PWideChar; Value: PWideChar): PWideChar cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; function MediaInfo_State_Get(Handle: Cardinal): Integer cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; function MediaInfo_Count_Get(Handle: Cardinal; StreamKind: TMIStreamKind; StreamNumber: Integer): Integer cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; // Ansi methods function MediaInfoA_New(): Cardinal cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; procedure MediaInfoA_Delete(Handle: Cardinal) cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; function MediaInfoA_Open(Handle: Cardinal; File__: PChar): Cardinal cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; procedure MediaInfoA_Close(Handle: Cardinal) cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; function MediaInfoA_Inform(Handle: Cardinal; Reserved: Integer): PChar cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; function MediaInfoA_GetI(Handle: Cardinal; StreamKind: TMIStreamKind; StreamNumber: Integer; Parameter: Integer; KindOfInfo: TMIInfo): PChar cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; //Default: KindOfInfo=Info_Text function MediaInfoA_Get(Handle: Cardinal; StreamKind: TMIStreamKind; StreamNumber: Integer; Parameter: PChar; KindOfInfo: TMIInfo; KindOfSearch: TMIInfo): PChar cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; //Default: KindOfInfo=Info_Text, KindOfSearch=Info_Name function MediaInfoA_Option(Handle: Cardinal; Option: PChar; Value: PChar): PChar cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; function MediaInfoA_State_Get(Handle: Cardinal): Integer cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; function MediaInfoA_Count_Get(Handle: Cardinal; StreamKind: TMIStreamKind; StreamNumber: Integer): Integer cdecl {$IFDEF WIN32} stdcall {$ENDIF};external 'MediaInfo.Dll'; {$ELSE} var LibHandle: THandle = 0; // Unicode methods MediaInfo_New: function (): Cardinal cdecl stdcall; MediaInfo_Delete: procedure (Handle: Cardinal) cdecl stdcall; MediaInfo_Open: function (Handle: Cardinal; File__: PWideChar): Cardinal cdecl stdcall; MediaInfo_Close: procedure (Handle: Cardinal) cdecl stdcall; MediaInfo_Inform: function (Handle: Cardinal; Reserved: Integer): PWideChar cdecl stdcall; MediaInfo_GetI: function (Handle: Cardinal; StreamKind: TMIStreamKind; StreamNumber: Integer; Parameter: Integer; KindOfInfo: TMIInfo): PWideChar cdecl stdcall; //Default: KindOfInfo=Info_Text, MediaInfo_Get: function (Handle: Cardinal; StreamKind: TMIStreamKind; StreamNumber: Integer; Parameter: PWideChar; KindOfInfo: TMIInfo; KindOfSearch: TMIInfo): PWideChar cdecl stdcall; //Default: KindOfInfo=Info_Text, KindOfSearch=Info_Name MediaInfo_Option: function (Handle: Cardinal; Option: PWideChar; Value: PWideChar): PWideChar cdecl stdcall; MediaInfo_State_Get: function (Handle: Cardinal): Integer cdecl stdcall; MediaInfo_Count_Get: function (Handle: Cardinal; StreamKind: TMIStreamKind; StreamNumber: Integer): Integer cdecl stdcall; // Ansi methods MediaInfoA_New: function (): Cardinal cdecl stdcall; MediaInfoA_Delete: procedure (Handle: Cardinal) cdecl stdcall; MediaInfoA_Open: function (Handle: Cardinal; File__: PChar): Cardinal cdecl stdcall; MediaInfoA_Close: procedure (Handle: Cardinal) cdecl stdcall; MediaInfoA_Inform: function (Handle: Cardinal; Reserved: Integer): PChar cdecl stdcall; MediaInfoA_GetI: function (Handle: Cardinal; StreamKind: TMIStreamKind; StreamNumber: Integer; Parameter: Integer; KindOfInfo: TMIInfo): PChar cdecl stdcall; //Default: KindOfInfo=Info_Text MediaInfoA_Get: function (Handle: Cardinal; StreamKind: TMIStreamKind; StreamNumber: Integer; Parameter: PChar; KindOfInfo: TMIInfo; KindOfSearch: TMIInfo): PChar cdecl stdcall; //Default: KindOfInfo=Info_Text, KindOfSearch=Info_Name MediaInfoA_Option: function (Handle: Cardinal; Option: PChar; Value: PChar): PChar cdecl stdcall; MediaInfoA_State_Get: function (Handle: Cardinal): Integer cdecl stdcall; MediaInfoA_Count_Get: function (Handle: Cardinal; StreamKind: TMIStreamKind; StreamNumber: Integer): Integer cdecl stdcall; function MediaInfoDLL_Load(LibPath: string): boolean; {$ENDIF} implementation {$IFNDEF STATIC} function MI_GetProcAddress(Name: PChar; var Addr: Pointer): boolean; begin Addr := GetProcAddress(LibHandle, Name); Result := Addr <> nil; end; function MediaInfoDLL_Load(LibPath: string): boolean; begin Result := False; if LibHandle = 0 then LibHandle := LoadLibrary(PChar(LibPath)); if LibHandle <> 0 then begin MI_GetProcAddress('MediaInfo_New', @MediaInfo_New); MI_GetProcAddress('MediaInfo_Delete', @MediaInfo_Delete); MI_GetProcAddress('MediaInfo_Open', @MediaInfo_Open); MI_GetProcAddress('MediaInfo_Close', @MediaInfo_Close); MI_GetProcAddress('MediaInfo_Inform', @MediaInfo_Inform); MI_GetProcAddress('MediaInfo_GetI', @MediaInfo_GetI); MI_GetProcAddress('MediaInfo_Get', @MediaInfo_Get); MI_GetProcAddress('MediaInfo_Option', @MediaInfo_Option); MI_GetProcAddress('MediaInfo_State_Get', @MediaInfo_State_Get); MI_GetProcAddress('MediaInfo_Count_Get', @MediaInfo_Count_Get); MI_GetProcAddress('MediaInfoA_New', @MediaInfoA_New); MI_GetProcAddress('MediaInfoA_Delete', @MediaInfoA_Delete); MI_GetProcAddress('MediaInfoA_Open', @MediaInfoA_Open); MI_GetProcAddress('MediaInfoA_Close', @MediaInfoA_Close); MI_GetProcAddress('MediaInfoA_Inform', @MediaInfoA_Inform); MI_GetProcAddress('MediaInfoA_GetI', @MediaInfoA_GetI); MI_GetProcAddress('MediaInfoA_Get', @MediaInfoA_Get); MI_GetProcAddress('MediaInfoA_Option', @MediaInfoA_Option); MI_GetProcAddress('MediaInfoA_State_Get', @MediaInfoA_State_Get); MI_GetProcAddress('MediaInfoA_Count_Get', @MediaInfoA_Count_Get); Result := True; end; end; {$ENDIF} end. MediaInfoLib/Source/MediaInfoDLL/MediaInfoDLL.pb100777 0 0 5472 12226004261 14623 0;; 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. ;; ;*************************************************************************** ; Constants ;*************************************************************************** Enumeration #Stream_General #Stream_Video #Stream_Audio #Stream_Text #Stream_Other #Stream_Image #Stream_Menu #Stream_Max EndEnumeration Enumeration #Info_Name #Info_Text #Info_Measure #Info_Options #Info_NameText #Info_MeasureText #Info_Info #Info_HowTo #Info_Max EndEnumeration Enumeration #Option_ShowInInform #Option_Reserved #Option_ShowInSupported #Option_TypeOfValue #Option_Max EndEnumeration ;*************************************************************************** ; Prototyping MediaInfo calls ;*************************************************************************** Prototype protoMediaInfo_New() Prototype protoMediaInfo_Delete(Handle) Prototype protoMediaInfoA_Open(Handle, File.s) Prototype protoMediaInfoA_Count_Get(Handle, Streamkind.l, StreamNumber.l) Prototype protoMediaInfoA_Get(Handle, StreamKind.l, StreamNumber.l, Parameter.s, InfoKind.l, SearchKind.l) Prototype protoMediaInfoA_GetI(Handle, StreamKind.l, StreamNumber.l, Parameter.l, InfoKind.l) Prototype protoMediaInfoA_Inform(Handle, Reserved.l) Prototype protoMediaInfoA_Option(handle, Option.s, Value.s) Prototype protoMediaInfoA_close() MI_ptr = OpenLibrary(#PB_Any, "MediaInfo.dll") If MI_ptr = #False MessageRequester ("Warning", "MediaInfo.dll not open :("+ #CRLF$ + "Is it in the same folder as this app?") End EndIf Define MediaInfo_New.protoMediaInfo_New = GetFunction(MI_ptr, "MediaInfo_New") Define MediaInfo_Delete.protoMediaInfo_Delete = GetFunction(MI_ptr, "MediaInfo_Delete") Define MediainfoA_Open.protoMediaInfoA_Open = GetFunction(MI_ptr, "MediaInfoA_Open") Define MediainfoA_Count_Get.protoMediaInfoA_Count_Get = GetFunction(MI_ptr, "MediaInfoA_Count_Get") Define MediaInfoA_Get.protoMediaInfoA_Get = GetFunction(MI_ptr, "MediaInfoA_Get") Define MediaInfoA_GetI.protoMediaInfoA_GetI = GetFunction(MI_ptr, "MediaInfoA_GetI") Define MediaInfoA_Inform.protoMediaInfoA_Inform = GetFunction(MI_ptr, "MediaInfoA_Inform") Define MediaInfoA_Option.protoMediaInfoA_Option = GetFunction(MI_ptr, "MediaInfoA_Option") Define MediainfoA_close.protoMediaInfoA_Close = GetFunction(MI_ptr, "MediaInfoA_Close") ; IDE Options = PureBasic 4.20 (Windows - x86) ; CursorPosition = 85 ; FirstLine = 44 ; Folding = -MediaInfoLib/Source/MediaInfoDLL/MediaInfoDLL.py100777 0 0 54247 12226004261 14676 0## 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. ## # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # # Public DLL interface implementation # Wrapper for MediaInfo Library # Please see MediaInfo.h for help # # Converted to python module by Petr Kaderabek # Modifications by Jerome Martinez # Python 3 update by Jerome Martinez # # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ import os from ctypes import * if os.name == "nt" or os.name == "dos" or os.name == "os2" or os.name == "ce": MediaInfoDLL_Handler = windll.MediaInfo MustUseAnsi = 0 else: MediaInfoDLL_Handler = CDLL("libmediainfo.so.0") MustUseAnsi = 1 # types --> C Python: # size_t c_size_t # unsigned char* c_char_p # enum c_size_t # const wchar_t* c_wchar_p, # NULL None, # these functions need strings in unicode format class Stream: General, Video, Audio, Text, Other, Image, Menu, Max = range(8) class Info: Name, Text, Measure, Options, Name_Text, Measure_Text, Info, HowTo, Max = range(9) class InfoOption: ShowInInform, Reserved, ShowInSupported, TypeOfValue, Max = range(5) class FileOptions: Nothing, Recursive, CloseAll, xxNonexx_3, Max = range(5) class MediaInfo: #MEDIAINFO_EXP void* __stdcall MediaInfo_New (); /*you must ALWAYS call MediaInfo_Delete(Handle) in order to free memory*/ #/** @brief A 'new' MediaInfo interface (with a quick init of useful options : "**VERSION**;**APP_NAME**;**APP_VERSION**", but without debug information, use it only if you know what you do), return a Handle, don't forget to delete it after using it*/ MediaInfo_New = MediaInfoDLL_Handler.MediaInfo_New MediaInfo_New.argtypes = [] MediaInfo_New.restype = c_void_p #MEDIAINFO_EXP void* __stdcall MediaInfo_New_Quick (const wchar_t* File, const wchar_t* Options); /*you must ALWAYS call MediaInfo_Delete(Handle) in order to free memory*/ MediaInfo_New_Quick = MediaInfoDLL_Handler.MediaInfo_New_Quick MediaInfo_New_Quick.argtypes = [c_wchar_p, c_wchar_p] MediaInfo_New_Quick.restype = c_void_p MediaInfoA_New_Quick = MediaInfoDLL_Handler.MediaInfoA_New_Quick MediaInfoA_New_Quick.argtypes = [c_char_p, c_char_p] MediaInfoA_New_Quick.restype = c_void_p #/** @brief Delete a MediaInfo interface*/ #MEDIAINFO_EXP void __stdcall MediaInfo_Delete (void* Handle); MediaInfo_Delete = MediaInfoDLL_Handler.MediaInfo_Delete MediaInfo_Delete.argtypes = [c_void_p] MediaInfo_Delete.restype = None #/** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a filename)*/ #MEDIAINFO_EXP size_t __stdcall MediaInfo_Open (void* Handle, const wchar_t* File); MediaInfo_Open = MediaInfoDLL_Handler.MediaInfo_Open MediaInfo_Open.argtype = [c_void_p, c_wchar_p] MediaInfo_Open.restype = c_size_t MediaInfoA_Open = MediaInfoDLL_Handler.MediaInfoA_Open MediaInfoA_Open.argtype = [c_void_p, c_char_p] MediaInfoA_Open.restype = c_size_t #/** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a buffer) */ #MEDIAINFO_EXP size_t __stdcall MediaInfo_Open_Buffer (void* Handle, const unsigned char* Begin, size_t Begin_Size, const unsigned char* End, size_t End_Size); /*return Handle*/ MediaInfo_Open_Buffer = MediaInfoDLL_Handler.MediaInfo_Open_Buffer MediaInfo_Open_Buffer.argtype = [c_void_p, c_void_p, c_size_t, c_void_p, c_size_t] MediaInfo_Open_Buffer.restype = c_size_t #/** @brief Wrapper for MediaInfoLib::MediaInfo::Save */ #MEDIAINFO_EXP size_t __stdcall MediaInfo_Save (void* Handle); MediaInfo_Save = MediaInfoDLL_Handler.MediaInfo_Save MediaInfo_Save.argtype = [c_void_p] MediaInfo_Save.restype = c_size_t #/** @brief Wrapper for MediaInfoLib::MediaInfo::Close */ #MEDIAINFO_EXP void __stdcall MediaInfo_Close (void* Handle); MediaInfo_Close = MediaInfoDLL_Handler.MediaInfo_Close MediaInfo_Close.argtype = [c_void_p] MediaInfo_Close.restype = None #/** @brief Wrapper for MediaInfoLib::MediaInfo::Inform */ #MEDIAINFO_EXP const wchar_t* __stdcall MediaInfo_Inform (void* Handle, size_t Reserved); /*Default : Reserved=0*/ MediaInfo_Inform = MediaInfoDLL_Handler.MediaInfo_Inform MediaInfo_Inform.argtype = [c_void_p, c_size_t] MediaInfo_Inform.restype = c_wchar_p MediaInfoA_Inform = MediaInfoDLL_Handler.MediaInfoA_Inform MediaInfoA_Inform.argtype = [c_void_p, c_size_t] MediaInfoA_Inform.restype = c_char_p #/** @brief Wrapper for MediaInfoLib::MediaInfo::Get */ #MEDIAINFO_EXP const wchar_t* __stdcall MediaInfo_GetI (void* Handle, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C InfoKind); /*Default : InfoKind=Info_Text*/ MediaInfo_GetI = MediaInfoDLL_Handler.MediaInfo_GetI MediaInfo_GetI.argtype = [c_void_p, c_size_t, c_size_t, c_size_t, c_size_t] MediaInfo_GetI.restype = c_wchar_p MediaInfoA_GetI = MediaInfoDLL_Handler.MediaInfoA_GetI MediaInfoA_GetI.argtype = [c_void_p, c_size_t, c_size_t, c_size_t, c_size_t] MediaInfoA_GetI.restype = c_char_p #/** @brief Wrapper for MediaInfoLib::MediaInfo::Get */ #MEDIAINFO_EXP const wchar_t* __stdcall MediaInfo_Get (void* Handle, MediaInfo_stream_C StreamKind, size_t StreamNumber, const wchar_t* Parameter, MediaInfo_info_C InfoKind, MediaInfo_info_C SearchKind); /*Default : InfoKind=Info_Text, SearchKind=Info_Name*/ MediaInfo_Get = MediaInfoDLL_Handler.MediaInfo_Get MediaInfo_Get.argtype = [c_void_p, c_size_t, c_size_t, c_wchar_p, c_size_t, c_size_t] MediaInfo_Get.restype = c_wchar_p MediaInfoA_Get = MediaInfoDLL_Handler.MediaInfoA_Get MediaInfoA_Get.argtype = [c_void_p, c_size_t, c_size_t, c_wchar_p, c_size_t, c_size_t] MediaInfoA_Get.restype = c_char_p #/** @brief Wrapper for MediaInfoLib::MediaInfo::Set */ #MEDIAINFO_EXP size_t __stdcall MediaInfo_SetI (void* Handle, const wchar_t* ToSet, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, const wchar_t* OldParameter); MediaInfo_SetI = MediaInfoDLL_Handler.MediaInfo_SetI MediaInfo_SetI.argtype = [c_void_p, c_wchar_p, c_size_t, c_size_t, c_size_t, c_wchar_p] MediaInfo_SetI.restype = c_void_p MediaInfoA_SetI = MediaInfoDLL_Handler.MediaInfoA_SetI MediaInfoA_SetI.argtype = [c_void_p, c_char_p, c_size_t, c_size_t, c_size_t, c_wchar_p] MediaInfoA_SetI.restype = c_void_p #/** @brief Wrapper for MediaInfoLib::MediaInfo::Set */ #MEDIAINFO_EXP size_t __stdcall MediaInfo_Set (void* Handle, const wchar_t* ToSet, MediaInfo_stream_C StreamKind, size_t StreamNumber, const wchar_t* Parameter, const wchar_t* OldParameter); MediaInfo_Set = MediaInfoDLL_Handler.MediaInfo_Set MediaInfo_Set.argtype = [c_void_p, c_wchar_p, c_size_t, c_size_t, c_wchar_p, c_wchar_p] MediaInfo_Set.restype = c_size_t MediaInfoA_Set = MediaInfoDLL_Handler.MediaInfoA_Set MediaInfoA_Set.argtype = [c_void_p, c_char_p, c_size_t, c_size_t, c_wchar_p, c_wchar_p] MediaInfoA_Set.restype = c_size_t #/** @brief Wrapper for MediaInfoLib::MediaInfo::Option */ #MEDIAINFO_EXP const wchar_t* __stdcall MediaInfo_Option (void* Handle, const wchar_t* Option, const wchar_t* Value); MediaInfo_Option = MediaInfoDLL_Handler.MediaInfo_Option MediaInfo_Option.argtype = [c_void_p, c_wchar_p, c_wchar_p] MediaInfo_Option.restype = c_wchar_p MediaInfoA_Option = MediaInfoDLL_Handler.MediaInfoA_Option MediaInfoA_Option.argtype = [c_void_p, c_char_p, c_char_p] MediaInfoA_Option.restype = c_char_p #/** @brief Wrapper for MediaInfoLib::MediaInfo::State_Get */ #MEDIAINFO_EXP size_t __stdcall MediaInfo_State_Get (void* Handle); MediaInfo_State_Get = MediaInfoDLL_Handler.MediaInfo_State_Get MediaInfo_State_Get.argtype = [c_void_p] MediaInfo_State_Get.restype = c_size_t #/** @brief Wrapper for MediaInfoLib::MediaInfo::Count_Get */ #MEDIAINFO_EXP size_t __stdcall MediaInfo_Count_Get (void* Handle, MediaInfo_stream_C StreamKind, size_t StreamNumber); /*Default : StreamNumber=-1*/ MediaInfo_Count_Get = MediaInfoDLL_Handler.MediaInfo_Count_Get MediaInfo_Count_Get.argtype = [c_void_p, c_size_t, c_size_t] MediaInfo_Count_Get.restype = c_size_t Handle = c_void_p(0) MustUseAnsi = 0 #Handling def __init__(self): self.Handle=self.MediaInfo_New() self.MediaInfoA_Option(self.Handle, "CharSet", "UTF-8") def __del__(self): self.MediaInfo_Delete(self.Handle) def Open(self, File): if type(File)==str: return self.MediaInfoA_Open (self.Handle, File); elif MustUseAnsi: return self.MediaInfoA_Open (self.Handle, File.encode("utf-8")); else: return self.MediaInfo_Open (self.Handle, File); def Open_Buffer(self, Begin, Begin_Size, End=None, End_Size=0): return self.MediaInfo_Open_Buffer(self.Handle, Begin, Begin_Size, End, End_Size) def Save(self): return self.MediaInfo_Save(self.Handle) def Close(self): return self.MediaInfo_Close(self.Handle) #General information def Inform(self): if MustUseAnsi: return unicode(self.MediaInfoA_Inform(self.Handle, 0), "utf_8") else: return self.MediaInfo_Inform(self.Handle, 0) def Get(self, StreamKind, StreamNumber, Parameter, InfoKind=Info.Text, SearchKind=Info.Name): if type(Parameter)==str: return unicode(self.MediaInfoA_Get(self.Handle, StreamKind, StreamNumber, Parameter, InfoKind, SearchKind), "utf_8") elif MustUseAnsi: return unicode(self.MediaInfoA_Get(self.Handle, StreamKind, StreamNumber, Parameter.encode("utf-8"), InfoKind, SearchKind), "utf_8") else: return self.MediaInfo_Get(self.Handle, StreamKind, StreamNumber, Parameter, InfoKind, SearchKind) def GetI(self, StreamKind, StreamNumber, Parameter, InfoKind=Info.Text): if MustUseAnsi: return unicode(self.MediaInfoA_GetI(self.Handle, StreamKind, StreamNumber, Parameter, InfoKind), "utf_8") else: return self.MediaInfo_GetI(self.Handle, StreamKind, StreamNumber, Parameter, InfoKind) def Set(self, ToSet, StreamKind, StreamNumber, Parameter, OldParameter=u""): if type(Parameter)==str and type(OldParameter)==unicode: Parameter=Parameter.decode("utf-8") if type(Parameter)==unicode and type(OldParameter)==str: OldParameter=OldParameter.decode("utf-8") if type(Parameter)==str: return self.MediaInfoA_Set(self.Handle, ToSet, StreamKind, StreamNumber, Parameter, OldParameter) elif MustUseAnsi: return self.MediaInfoA_Set(self.Handle, ToSet, StreamKind, StreamNumber, Parameter.encode("utf-8"), OldParameter.encode("utf-8")) else: return self.MediaInfo_Set(self.Handle, ToSet, StreamKind, StreamNumber, Parameter, OldParameter) def SetI(self, ToSet, StreamKind, StreamNumber, Parameter, OldValue): if MustUseAnsi: return self.MediaInfoA_SetI(self.Handle, ToSet, StreamKind, StreamNumber, Parameter, OldValue.encode("utf-8")) else: return self.MediaInfo_SetI(self.Handle, ToSet, StreamKind, StreamNumber, Parameter, OldValue) #Options def Option(self, Option, Value=u""): if type(Option)==str and type(Value)==unicode: Option=Option.decode("utf-8") if type(Option)==unicode and type(Value)==str: Value=Value.decode("utf-8") if type(Option)==str: return unicode(self.MediaInfoA_Option(self.Handle, Option.encode("utf-8"), Value.encode("utf-8")), "utf_8") elif MustUseAnsi: return unicode(self.MediaInfoA_Option(self.Handle, Option.encode("utf-8"), Value.encode("utf-8")), "utf_8") else: return self.MediaInfo_Option(self.Handle, Option, Value) def Option_Static(self, Option, Value=u""): if type(Option)==str and type(Value)==unicode: Option=Option.decode("utf-8") if type(Option)==unicode and type(Value)==str: Value=Value.decode("utf-8") if type(Option)==str: return unicode(self.MediaInfoA_Option(None, Option, Value), "utf_8") elif MustUseAnsi: return unicode(self.MediaInfoA_Option(None, Option.encode("utf-8"), Value.encode("utf-8")), "utf_8") else: return self.MediaInfo_Option(None, Option, Value) def State_Get(self): return self.MediaInfo_State_Get(self.Handle) def Count_Get(self, StreamKind, StreamNumber=-1): if StreamNumber == -1: #We should use -1 the same way, but it fails on 64-bit #so we use slower Get() with a character string return int(self.Get(StreamKind, 0, "StreamCount")) else: return self.MediaInfo_Count_Get(self.Handle, StreamKind, StreamNumber) class MediaInfoList: #/** @brief A 'new' MediaInfoList interface, return a Handle, don't forget to delete it after using it*/ #MEDIAINFO_EXP void* __stdcall MediaInfoList_New (); /*you must ALWAYS call MediaInfoList_Delete(Handle) in order to free memory*/ MediaInfoList_New = MediaInfoDLL_Handler.MediaInfoList_New MediaInfoList_New.argtype = [] MediaInfoList_New.restype = c_void_p #/** @brief A 'new' MediaInfoList interface (with a quick init of useful options : "**VERSION**;**APP_NAME**;**APP_VERSION**", but without debug information, use it only if you know what you do), return a Handle, don't forget to delete it after using it*/ #MEDIAINFO_EXP void* __stdcall MediaInfoList_New_Quick (const wchar_t* Files, const wchar_t* Config); /*you must ALWAYS call MediaInfoList_Delete(Handle) in order to free memory*/ MediaInfoList_New_Quick = MediaInfoDLL_Handler.MediaInfoList_New_Quick MediaInfoList_New_Quick.argtype = [c_wchar_p, c_wchar_p] MediaInfoList_New_Quick.restype = c_void_p #/** @brief Delete a MediaInfoList interface*/ #MEDIAINFO_EXP void __stdcall MediaInfoList_Delete (void* Handle); MediaInfoList_Delete = MediaInfoDLL_Handler.MediaInfoList_Delete MediaInfoList_Delete.argtype = [c_void_p] #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Open (with a filename)*/ #MEDIAINFO_EXP size_t __stdcall MediaInfoList_Open (void* Handle, const wchar_t* Files, const MediaInfo_fileoptions_C Options); /*Default : Options=MediaInfo_FileOption_Nothing*/ MediaInfoList_Open = MediaInfoDLL_Handler.MediaInfoList_Open MediaInfoList_Open.argtype = [c_void_p, c_wchar_p, c_void_p] MediaInfoList_Open.restype = c_void_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Open (with a buffer) */ #MEDIAINFO_EXP size_t __stdcall MediaInfoList_Open_Buffer (void* Handle, const unsigned char* Begin, size_t Begin_Size, const unsigned char* End, size_t End_Size); /*return Handle*/ MediaInfoList_Open_Buffer = MediaInfoDLL_Handler.MediaInfoList_Open_Buffer MediaInfoList_Open_Buffer.argtype = [c_void_p, c_void_p, c_void_p, c_void_p, c_void_p] MediaInfoList_Open_Buffer.restype = c_void_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Save */ #MEDIAINFO_EXP size_t __stdcall MediaInfoList_Save (void* Handle, size_t FilePos); MediaInfoList_Save = MediaInfoDLL_Handler.MediaInfoList_Save MediaInfoList_Save.argtype = [c_void_p, c_void_p] MediaInfoList_Save.restype = c_void_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Close */ #MEDIAINFO_EXP void __stdcall MediaInfoList_Close (void* Handle, size_t FilePos); MediaInfoList_Close = MediaInfoDLL_Handler.MediaInfoList_Close MediaInfoList_Close.argtype = [c_void_p, c_void_p] #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Inform */ #MEDIAINFO_EXP const wchar_t* __stdcall MediaInfoList_Inform (void* Handle, size_t FilePos, size_t Reserved); /*Default : Reserved=0*/ MediaInfoList_Inform = MediaInfoDLL_Handler.MediaInfoList_Inform MediaInfoList_Inform.argtype = [c_void_p, c_void_p, c_void_p] MediaInfoList_Inform.restype = c_wchar_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Get */ #MEDIAINFO_EXP const wchar_t* __stdcall MediaInfoList_GetI (void* Handle, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C InfoKind); /*Default : InfoKind=Info_Text*/ MediaInfoList_GetI = MediaInfoDLL_Handler.MediaInfoList_GetI MediaInfoList_GetI.argtype = [c_void_p, c_void_p, c_void_p, c_void_p, c_void_p, c_void_p] MediaInfoList_GetI.restype = c_wchar_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Get */ #MEDIAINFO_EXP const wchar_t* __stdcall MediaInfoList_Get (void* Handle, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, const wchar_t* Parameter, MediaInfo_info_C InfoKind, MediaInfo_info_C SearchKind); /*Default : InfoKind=Info_Text, SearchKind=Info_Name*/ MediaInfoList_Get = MediaInfoDLL_Handler.MediaInfoList_Get MediaInfoList_Get.argtype = [c_void_p, c_void_p, c_void_p, c_void_p, c_wchar_p, c_void_p, c_void_p] MediaInfoList_Get.restype = c_wchar_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Set */ #MEDIAINFO_EXP size_t __stdcall MediaInfoList_SetI (void* Handle, const wchar_t* ToSet, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, const wchar_t* OldParameter); MediaInfoList_SetI = MediaInfoDLL_Handler.MediaInfoList_SetI MediaInfoList_SetI.argtype = [c_void_p, c_wchar_p, c_void_p, c_void_p, c_void_p, c_void_p, c_wchar_p] MediaInfoList_SetI.restype = c_void_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Set */ #MEDIAINFO_EXP size_t __stdcall MediaInfoList_Set (void* Handle, const wchar_t* ToSet, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, const wchar_t* Parameter, const wchar_t* OldParameter); MediaInfoList_Set = MediaInfoDLL_Handler.MediaInfoList_Set MediaInfoList_Set.argtype = [c_void_p, c_wchar_p, c_void_p, c_void_p, c_void_p, c_wchar_p, c_wchar_p] MediaInfoList_Set.restype = c_void_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Option */ #MEDIAINFO_EXP const wchar_t* __stdcall MediaInfoList_Option (void* Handle, const wchar_t* Option, const wchar_t* Value); MediaInfoList_Option = MediaInfoDLL_Handler.MediaInfoList_Option MediaInfoList_Option.argtype = [c_void_p, c_wchar_p, c_wchar_p] MediaInfoList_Option.restype = c_wchar_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::State_Get */ #MEDIAINFO_EXP size_t __stdcall MediaInfoList_State_Get (void* Handle); MediaInfoList_State_Get = MediaInfoDLL_Handler.MediaInfoList_State_Get MediaInfoList_State_Get.argtype = [c_void_p] MediaInfoList_State_Get.restype = c_void_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Count_Get */ #MEDIAINFO_EXP size_t __stdcall MediaInfoList_Count_Get (void* Handle, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber); /*Default : StreamNumber=-1*/ MediaInfoList_Count_Get = MediaInfoDLL_Handler.MediaInfoList_Count_Get MediaInfoList_Count_Get.argtype = [c_void_p, c_void_p, c_void_p, c_void_p] MediaInfoList_Count_Get.restype = c_void_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Count_Get */ #MEDIAINFO_EXP size_t __stdcall MediaInfoList_Count_Get_Files (void* Handle); MediaInfoList_Count_Get_Files = MediaInfoDLL_Handler.MediaInfoList_Count_Get_Files MediaInfoList_Count_Get_Files.argtype = [c_void_p] MediaInfoList_Count_Get_Files.restype = c_void_p Handle = c_void_p(0) #Handling def __init__(self): self.Handle = self.MediaInfoList_New() def __del__(self): self.MediaInfoList_Delete(self.Handle) def Open(self, Files, Options=FileOptions.Nothing): return self.MediaInfoList_Open(self.Handle, Files, Options) def Open_Buffer(self, Begin, Begin_Size, End=None, End_Size=0): return self.MediaInfoList_Open_Buffer (self.Handle, Begin, Begin_Size, End, End_Size) def Save(self, FilePos): return self.MediaInfoList_Save(self.Handle, FilePos) def Close(self, FilePos): self.MediaInfoList_Close (self.Handle, FilePos) #General information def Inform(self, FilePos, Reserved=0): return self.MediaInfoList_Inform (self.Handle, FilePos, Reserved) def GetI(self, FilePos, StreamKind, StreamNumber, Parameter, InfoKind=Info.Text): return self.MediaInfoList_GetI (self.Handle, FilePos, StreamKind, StreamNumber, Parameter, InfoKind) def Get(self, FilePos, StreamKind, StreamNumber, Parameter, InfoKind=Info.Text, SearchKind=Info.Name): return self.MediaInfoList_Get (self.Handle, FilePos, StreamKind, StreamNumber, (Parameter), InfoKind, SearchKind) def SetI(self, ToSet, FilePos, StreamKind, StreamNumber, Parameter, OldParameter=u""): return self.MediaInfoList_SetI (self, Handle, ToSet, FilePos, StreamKind, StreamNumber, Parameter, OldParameter) def Set(self, ToSet, FilePos, StreamKind, StreamNumber, Parameter, OldParameter=u""): return self.MediaInfoList_Set (self.Handle, ToSet, FilePos, StreamKind, StreamNumber, Parameter, OldParameter) #Options def Option(self, Option, Value=u""): return self.MediaInfoList_Option (self.Handle, Option, Value) def Option_Static(self, Option, Value=u""): return self.MediaInfoList_Option(None, Option, Value) def State_Get(self): return self.MediaInfoList_State_Get (self.Handle) def Count_Get(self, FilePos, StreamKind, StreamNumber): return self.MediaInfoList_Count_Get (self.Handle, FilePos, StreamKind, StreamNumber=-1) def Count_Get_Files(self): return self.MediaInfoList_Count_Get_Files (self.Handle) MediaInfoLib/Source/MediaInfoDLL/MediaInfoDLL.vb100777 0 0 11114 12226004261 14637 0'' 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. '' ''+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ '' '' Microsoft Visual Basic wrapper for MediaInfo Library '' See MediaInfo.h for help '' '' To make it working, you must put MediaInfo.Dll '' in the executable folder '' ''+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Imports System.Runtime.InteropServices Public Enum StreamKind As UInteger General Visual Audio Text Other Image Menu Max End Enum Public Enum InfoKind As UInteger Name Text Measure Options NameText MeasureText Info HowTo Max End Enum Public Enum InfoOptions As UInteger ShowInInform Reserved ShowInSupported TypeOfValue Max End Enum Public Class MediaInfo Private Declare Unicode Function MediaInfo_New Lib "MediaInfo.DLL" () As IntPtr Private Declare Unicode Sub MediaInfo_Delete Lib "MediaInfo.DLL" (ByVal Handle As IntPtr) Private Declare Unicode Function MediaInfo_Open Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal FileName As String) As UIntPtr Private Declare Unicode Sub MediaInfo_Close Lib "MediaInfo.DLL" (ByVal Handle As IntPtr) Private Declare Unicode Function MediaInfo_Inform Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal Reserved As UIntPtr) As IntPtr Private Declare Unicode Function MediaInfo_GetI Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal StreamKind As UIntPtr, ByVal StreamNumber As UIntPtr, ByVal Parameter As UIntPtr, ByVal KindOfInfo As UIntPtr) As IntPtr 'See MediaInfoDLL.h for enumeration values Private Declare Unicode Function MediaInfo_Get Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal StreamKind As UIntPtr, ByVal StreamNumber As UIntPtr, ByVal Parameter As String, ByVal KindOfInfo As UIntPtr, ByVal KindOfSearch As UIntPtr) As IntPtr Private Declare Unicode Function MediaInfo_Option Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal Option_ As String, ByVal Value As String) As IntPtr Private Declare Unicode Function MediaInfo_State_Get Lib "MediaInfo.DLL" (ByVal Handle As IntPtr) As UIntPtr 'see MediaInfo.h for details Private Declare Unicode Function MediaInfo_Count_Get Lib "MediaInfo.DLL" (ByVal Handle As IntPtr, ByVal StreamKind As UIntPtr, ByVal StreamNumber As IntPtr) As UIntPtr 'see MediaInfoDLL.h for enumeration values Dim Handle As IntPtr Sub New() Handle = MediaInfo_New() End Sub Protected Overrides Sub Finalize() MediaInfo_Delete(Handle) End Sub Function Open(ByVal FileName As String) As System.UIntPtr Return MediaInfo_Open(Handle, FileName) End Function Sub Close() MediaInfo_Close(Handle) End Sub Function Inform() As String Return Marshal.PtrToStringUni(MediaInfo_Inform(Handle, CType(0, UIntPtr))) End Function Function Get_(ByVal StreamKind As StreamKind, ByVal StreamNumber As Integer, ByVal Parameter As Integer, Optional ByVal KindOfInfo As InfoKind = InfoKind.Text) As String Return Marshal.PtrToStringUni(MediaInfo_GetI(Handle, CType(StreamKind, UIntPtr), CType(StreamNumber, UIntPtr), CType(Parameter, UIntPtr), CType(KindOfInfo, UIntPtr))) End Function Function Get_(ByVal StreamKind As StreamKind, ByVal StreamNumber As Integer, ByVal Parameter As String, Optional ByVal KindOfInfo As InfoKind = InfoKind.Text, Optional ByVal KindOfSearch As InfoKind = InfoKind.Name) As String Return Marshal.PtrToStringUni(MediaInfo_Get(Handle, CType(StreamKind, UIntPtr), CType(StreamNumber, UIntPtr), Parameter, CType(KindOfInfo, UIntPtr), CType(KindOfSearch, UIntPtr))) End Function Function Option_(ByVal Option__ As String, Optional ByVal Value As String = "") As String Return Marshal.PtrToStringUni(MediaInfo_Option(Handle, Option__, Value)) End Function Function State_Get() As Integer Return CInt(MediaInfo_State_Get(Handle)) End Function Function Count_Get(ByVal StreamKind As StreamKind, Optional ByVal StreamNumber As UInteger = UInteger.MaxValue) As Integer If StreamNumber = UInteger.MaxValue Then Return CInt(MediaInfo_Count_Get(Handle, CType(StreamKind, UIntPtr), CType(-1, IntPtr))) Else Return CInt(MediaInfo_Count_Get(Handle, CType(StreamKind, UIntPtr), CType(StreamNumber, IntPtr))) End If End Function End Class MediaInfoLib/Source/MediaInfoDLL/MediaInfoDLL3.py100777 0 0 51150 12226004261 14747 0## 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. ## # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # # Public DLL interface implementation # Wrapper for MediaInfo Library # Please see MediaInfo.h for help # # Converted to python module by Petr Kaderabek # Modifications by Jerome Martinez # Python 3 update by Jerome Martinez # # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ import os from ctypes import * if os.name == "nt" or os.name == "dos" or os.name == "os2" or os.name == "ce": MediaInfoDLL_Handler = windll.MediaInfo MustUseAnsi = 0 else: MediaInfoDLL_Handler = CDLL("libmediainfo.so.0") MustUseAnsi = 1 # types --> C Python: # size_t c_size_t # unsigned char* c_char_p # enum c_size_t # const wchar_t* c_wchar_p, # NULL None, # these functions need strings in unicode format class Stream: General, Video, Audio, Text, Other, Image, Menu, Max = list(range(8)) class Info: Name, Text, Measure, Options, Name_Text, Measure_Text, Info, HowTo, Max = list(range(9)) class InfoOption: ShowInInform, Reserved, ShowInSupported, TypeOfValue, Max = list(range(5)) class FileOptions: Nothing, Recursive, CloseAll, xxNonexx_3, Max = list(range(5)) class MediaInfo: #MEDIAINFO_EXP void* __stdcall MediaInfo_New (); /*you must ALWAYS call MediaInfo_Delete(Handle) in order to free memory*/ #/** @brief A 'new' MediaInfo interface (with a quick init of useful options : "**VERSION**;**APP_NAME**;**APP_VERSION**", but without debug information, use it only if you know what you do), return a Handle, don't forget to delete it after using it*/ MediaInfo_New = MediaInfoDLL_Handler.MediaInfo_New MediaInfo_New.argtypes = [] MediaInfo_New.restype = c_void_p #MEDIAINFO_EXP void* __stdcall MediaInfo_New_Quick (const wchar_t* File, const wchar_t* Options); /*you must ALWAYS call MediaInfo_Delete(Handle) in order to free memory*/ MediaInfo_New_Quick = MediaInfoDLL_Handler.MediaInfo_New_Quick MediaInfo_New_Quick.argtypes = [c_wchar_p, c_wchar_p] MediaInfo_New_Quick.restype = c_void_p MediaInfoA_New_Quick = MediaInfoDLL_Handler.MediaInfoA_New_Quick MediaInfoA_New_Quick.argtypes = [c_char_p, c_char_p] MediaInfoA_New_Quick.restype = c_void_p #/** @brief Delete a MediaInfo interface*/ #MEDIAINFO_EXP void __stdcall MediaInfo_Delete (void* Handle); MediaInfo_Delete = MediaInfoDLL_Handler.MediaInfo_Delete MediaInfo_Delete.argtypes = [c_void_p] MediaInfo_Delete.restype = None #/** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a filename)*/ #MEDIAINFO_EXP size_t __stdcall MediaInfo_Open (void* Handle, const wchar_t* File); MediaInfo_Open = MediaInfoDLL_Handler.MediaInfo_Open MediaInfo_Open.argtype = [c_void_p, c_wchar_p] MediaInfo_Open.restype = c_size_t MediaInfoA_Open = MediaInfoDLL_Handler.MediaInfoA_Open MediaInfoA_Open.argtype = [c_void_p, c_char_p] MediaInfoA_Open.restype = c_size_t #/** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a buffer) */ #MEDIAINFO_EXP size_t __stdcall MediaInfo_Open_Buffer (void* Handle, const unsigned char* Begin, size_t Begin_Size, const unsigned char* End, size_t End_Size); /*return Handle*/ MediaInfo_Open_Buffer = MediaInfoDLL_Handler.MediaInfo_Open_Buffer MediaInfo_Open_Buffer.argtype = [c_void_p, c_void_p, c_size_t, c_void_p, c_size_t] MediaInfo_Open_Buffer.restype = c_size_t #/** @brief Wrapper for MediaInfoLib::MediaInfo::Save */ #MEDIAINFO_EXP size_t __stdcall MediaInfo_Save (void* Handle); MediaInfo_Save = MediaInfoDLL_Handler.MediaInfo_Save MediaInfo_Save.argtype = [c_void_p] MediaInfo_Save.restype = c_size_t #/** @brief Wrapper for MediaInfoLib::MediaInfo::Close */ #MEDIAINFO_EXP void __stdcall MediaInfo_Close (void* Handle); MediaInfo_Close = MediaInfoDLL_Handler.MediaInfo_Close MediaInfo_Close.argtype = [c_void_p] MediaInfo_Close.restype = None #/** @brief Wrapper for MediaInfoLib::MediaInfo::Inform */ #MEDIAINFO_EXP const wchar_t* __stdcall MediaInfo_Inform (void* Handle, size_t Reserved); /*Default : Reserved=0*/ MediaInfo_Inform = MediaInfoDLL_Handler.MediaInfo_Inform MediaInfo_Inform.argtype = [c_void_p, c_size_t] MediaInfo_Inform.restype = c_wchar_p MediaInfoA_Inform = MediaInfoDLL_Handler.MediaInfoA_Inform MediaInfoA_Inform.argtype = [c_void_p, c_size_t] MediaInfoA_Inform.restype = c_char_p #/** @brief Wrapper for MediaInfoLib::MediaInfo::Get */ #MEDIAINFO_EXP const wchar_t* __stdcall MediaInfo_GetI (void* Handle, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C InfoKind); /*Default : InfoKind=Info_Text*/ MediaInfo_GetI = MediaInfoDLL_Handler.MediaInfo_GetI MediaInfo_GetI.argtype = [c_void_p, c_size_t, c_size_t, c_size_t, c_size_t] MediaInfo_GetI.restype = c_wchar_p MediaInfoA_GetI = MediaInfoDLL_Handler.MediaInfoA_GetI MediaInfoA_GetI.argtype = [c_void_p, c_size_t, c_size_t, c_size_t, c_size_t] MediaInfoA_GetI.restype = c_char_p #/** @brief Wrapper for MediaInfoLib::MediaInfo::Get */ #MEDIAINFO_EXP const wchar_t* __stdcall MediaInfo_Get (void* Handle, MediaInfo_stream_C StreamKind, size_t StreamNumber, const wchar_t* Parameter, MediaInfo_info_C InfoKind, MediaInfo_info_C SearchKind); /*Default : InfoKind=Info_Text, SearchKind=Info_Name*/ MediaInfo_Get = MediaInfoDLL_Handler.MediaInfo_Get MediaInfo_Get.argtype = [c_void_p, c_size_t, c_size_t, c_wchar_p, c_size_t, c_size_t] MediaInfo_Get.restype = c_wchar_p MediaInfoA_Get = MediaInfoDLL_Handler.MediaInfoA_Get MediaInfoA_Get.argtype = [c_void_p, c_size_t, c_size_t, c_wchar_p, c_size_t, c_size_t] MediaInfoA_Get.restype = c_char_p #/** @brief Wrapper for MediaInfoLib::MediaInfo::Set */ #MEDIAINFO_EXP size_t __stdcall MediaInfo_SetI (void* Handle, const wchar_t* ToSet, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, const wchar_t* OldParameter); MediaInfo_SetI = MediaInfoDLL_Handler.MediaInfo_SetI MediaInfo_SetI.argtype = [c_void_p, c_wchar_p, c_size_t, c_size_t, c_size_t, c_wchar_p] MediaInfo_SetI.restype = c_void_p MediaInfoA_SetI = MediaInfoDLL_Handler.MediaInfoA_SetI MediaInfoA_SetI.argtype = [c_void_p, c_char_p, c_size_t, c_size_t, c_size_t, c_wchar_p] MediaInfoA_SetI.restype = c_void_p #/** @brief Wrapper for MediaInfoLib::MediaInfo::Set */ #MEDIAINFO_EXP size_t __stdcall MediaInfo_Set (void* Handle, const wchar_t* ToSet, MediaInfo_stream_C StreamKind, size_t StreamNumber, const wchar_t* Parameter, const wchar_t* OldParameter); MediaInfo_Set = MediaInfoDLL_Handler.MediaInfo_Set MediaInfo_Set.argtype = [c_void_p, c_wchar_p, c_size_t, c_size_t, c_wchar_p, c_wchar_p] MediaInfo_Set.restype = c_size_t MediaInfoA_Set = MediaInfoDLL_Handler.MediaInfoA_Set MediaInfoA_Set.argtype = [c_void_p, c_char_p, c_size_t, c_size_t, c_wchar_p, c_wchar_p] MediaInfoA_Set.restype = c_size_t #/** @brief Wrapper for MediaInfoLib::MediaInfo::Option */ #MEDIAINFO_EXP const wchar_t* __stdcall MediaInfo_Option (void* Handle, const wchar_t* Option, const wchar_t* Value); MediaInfo_Option = MediaInfoDLL_Handler.MediaInfo_Option MediaInfo_Option.argtype = [c_void_p, c_wchar_p, c_wchar_p] MediaInfo_Option.restype = c_wchar_p MediaInfoA_Option = MediaInfoDLL_Handler.MediaInfoA_Option MediaInfoA_Option.argtype = [c_void_p, c_char_p, c_char_p] MediaInfoA_Option.restype = c_char_p #/** @brief Wrapper for MediaInfoLib::MediaInfo::State_Get */ #MEDIAINFO_EXP size_t __stdcall MediaInfo_State_Get (void* Handle); MediaInfo_State_Get = MediaInfoDLL_Handler.MediaInfo_State_Get MediaInfo_State_Get.argtype = [c_void_p] MediaInfo_State_Get.restype = c_size_t #/** @brief Wrapper for MediaInfoLib::MediaInfo::Count_Get */ #MEDIAINFO_EXP size_t __stdcall MediaInfo_Count_Get (void* Handle, MediaInfo_stream_C StreamKind, size_t StreamNumber); /*Default : StreamNumber=-1*/ MediaInfo_Count_Get = MediaInfoDLL_Handler.MediaInfo_Count_Get MediaInfo_Count_Get.argtype = [c_void_p, c_size_t, c_size_t] MediaInfo_Count_Get.restype = c_size_t Handle = c_void_p(0) MustUseAnsi = 0 #Handling def __init__(self): self.Handle=self.MediaInfo_New() self.MediaInfo_Option(self.Handle, "CharSet", "UTF-8") def __del__(self): self.MediaInfo_Delete(self.Handle) def Open(self, File): if MustUseAnsi: return self.MediaInfoA_Open (self.Handle, File.encode("utf-8")); else: return self.MediaInfo_Open (self.Handle, File); def Open_Buffer(self, Begin, Begin_Size, End=None, End_Size=0): return self.MediaInfo_Open_Buffer(self.Handle, Begin, Begin_Size, End, End_Size) def Save(self): return self.MediaInfo_Save(self.Handle) def Close(self): return self.MediaInfo_Close(self.Handle) #General information def Inform(self): if MustUseAnsi: return str(self.MediaInfoA_Inform(self.Handle, 0), "utf_8", 'ignore') else: return self.MediaInfo_Inform(self.Handle, 0) def Get(self, StreamKind, StreamNumber, Parameter, InfoKind=Info.Text, SearchKind=Info.Name): if MustUseAnsi: return str(self.MediaInfoA_Get(self.Handle, StreamKind, StreamNumber, Parameter.encode("utf-8"), InfoKind, SearchKind), "utf_8", 'ignore') else: return self.MediaInfo_Get(self.Handle, StreamKind, StreamNumber, Parameter, InfoKind, SearchKind) def GetI(self, StreamKind, StreamNumber, Parameter, InfoKind=Info.Text): if MustUseAnsi: return str(self.MediaInfoA_GetI(self.Handle, StreamKind, StreamNumber, Parameter, InfoKind), "utf_8", 'ignore') else: return self.MediaInfo_GetI(self.Handle, StreamKind, StreamNumber, Parameter, InfoKind) def Set(self, ToSet, StreamKind, StreamNumber, Parameter, OldParameter=""): if MustUseAnsi: return self.MediaInfoA_Set(self.Handle, ToSet, StreamKind, StreamNumber, Parameter.encode("utf-8"), OldParameter.encode("utf-8")) else: return self.MediaInfo_Set(self.Handle, ToSet, StreamKind, StreamNumber, Parameter, OldParameter) def SetI(self, ToSet, StreamKind, StreamNumber, Parameter, OldValue): if MustUseAnsi: return self.MediaInfoA_SetI(self.Handle, ToSet, StreamKind, StreamNumber, Parameter, OldValue.encode("utf-8")) else: return self.MediaInfo_SetI(self.Handle, ToSet, StreamKind, StreamNumber, Parameter, OldValue) #Options def Option(self, Option, Value=""): if MustUseAnsi: return str(self.MediaInfoA_Option(self.Handle, Option.encode("utf-8"), Value.encode("utf-8")), "utf_8", 'ignore') else: return self.MediaInfo_Option(self.Handle, Option, Value) def Option_Static(self, Option, Value=""): if MustUseAnsi: return str(self.MediaInfoA_Option(None, Option.encode("utf-8"), Value.encode("utf-8")), "utf_8", 'ignore') else: return self.MediaInfo_Option(None, Option, Value) def State_Get(self): return self.MediaInfo_State_Get(self.Handle) def Count_Get(self, StreamKind, StreamNumber=-1): return self.MediaInfo_Count_Get(self.Handle, StreamKind, StreamNumber) class MediaInfoList: #/** @brief A 'new' MediaInfoList interface, return a Handle, don't forget to delete it after using it*/ #MEDIAINFO_EXP void* __stdcall MediaInfoList_New (); /*you must ALWAYS call MediaInfoList_Delete(Handle) in order to free memory*/ MediaInfoList_New = MediaInfoDLL_Handler.MediaInfoList_New MediaInfoList_New.argtype = [] MediaInfoList_New.restype = c_void_p #/** @brief A 'new' MediaInfoList interface (with a quick init of useful options : "**VERSION**;**APP_NAME**;**APP_VERSION**", but without debug information, use it only if you know what you do), return a Handle, don't forget to delete it after using it*/ #MEDIAINFO_EXP void* __stdcall MediaInfoList_New_Quick (const wchar_t* Files, const wchar_t* Config); /*you must ALWAYS call MediaInfoList_Delete(Handle) in order to free memory*/ MediaInfoList_New_Quick = MediaInfoDLL_Handler.MediaInfoList_New_Quick MediaInfoList_New_Quick.argtype = [c_wchar_p, c_wchar_p] MediaInfoList_New_Quick.restype = c_void_p #/** @brief Delete a MediaInfoList interface*/ #MEDIAINFO_EXP void __stdcall MediaInfoList_Delete (void* Handle); MediaInfoList_Delete = MediaInfoDLL_Handler.MediaInfoList_Delete MediaInfoList_Delete.argtype = [c_void_p] #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Open (with a filename)*/ #MEDIAINFO_EXP size_t __stdcall MediaInfoList_Open (void* Handle, const wchar_t* Files, const MediaInfo_fileoptions_C Options); /*Default : Options=MediaInfo_FileOption_Nothing*/ MediaInfoList_Open = MediaInfoDLL_Handler.MediaInfoList_Open MediaInfoList_Open.argtype = [c_void_p, c_wchar_p, c_void_p] MediaInfoList_Open.restype = c_void_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Open (with a buffer) */ #MEDIAINFO_EXP size_t __stdcall MediaInfoList_Open_Buffer (void* Handle, const unsigned char* Begin, size_t Begin_Size, const unsigned char* End, size_t End_Size); /*return Handle*/ MediaInfoList_Open_Buffer = MediaInfoDLL_Handler.MediaInfoList_Open_Buffer MediaInfoList_Open_Buffer.argtype = [c_void_p, c_void_p, c_void_p, c_void_p, c_void_p] MediaInfoList_Open_Buffer.restype = c_void_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Save */ #MEDIAINFO_EXP size_t __stdcall MediaInfoList_Save (void* Handle, size_t FilePos); MediaInfoList_Save = MediaInfoDLL_Handler.MediaInfoList_Save MediaInfoList_Save.argtype = [c_void_p, c_void_p] MediaInfoList_Save.restype = c_void_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Close */ #MEDIAINFO_EXP void __stdcall MediaInfoList_Close (void* Handle, size_t FilePos); MediaInfoList_Close = MediaInfoDLL_Handler.MediaInfoList_Close MediaInfoList_Close.argtype = [c_void_p, c_void_p] #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Inform */ #MEDIAINFO_EXP const wchar_t* __stdcall MediaInfoList_Inform (void* Handle, size_t FilePos, size_t Reserved); /*Default : Reserved=0*/ MediaInfoList_Inform = MediaInfoDLL_Handler.MediaInfoList_Inform MediaInfoList_Inform.argtype = [c_void_p, c_void_p, c_void_p] MediaInfoList_Inform.restype = c_wchar_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Get */ #MEDIAINFO_EXP const wchar_t* __stdcall MediaInfoList_GetI (void* Handle, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C InfoKind); /*Default : InfoKind=Info_Text*/ MediaInfoList_GetI = MediaInfoDLL_Handler.MediaInfoList_GetI MediaInfoList_GetI.argtype = [c_void_p, c_void_p, c_void_p, c_void_p, c_void_p, c_void_p] MediaInfoList_GetI.restype = c_wchar_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Get */ #MEDIAINFO_EXP const wchar_t* __stdcall MediaInfoList_Get (void* Handle, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, const wchar_t* Parameter, MediaInfo_info_C InfoKind, MediaInfo_info_C SearchKind); /*Default : InfoKind=Info_Text, SearchKind=Info_Name*/ MediaInfoList_Get = MediaInfoDLL_Handler.MediaInfoList_Get MediaInfoList_Get.argtype = [c_void_p, c_void_p, c_void_p, c_void_p, c_wchar_p, c_void_p, c_void_p] MediaInfoList_Get.restype = c_wchar_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Set */ #MEDIAINFO_EXP size_t __stdcall MediaInfoList_SetI (void* Handle, const wchar_t* ToSet, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, const wchar_t* OldParameter); MediaInfoList_SetI = MediaInfoDLL_Handler.MediaInfoList_SetI MediaInfoList_SetI.argtype = [c_void_p, c_wchar_p, c_void_p, c_void_p, c_void_p, c_void_p, c_wchar_p] MediaInfoList_SetI.restype = c_void_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Set */ #MEDIAINFO_EXP size_t __stdcall MediaInfoList_Set (void* Handle, const wchar_t* ToSet, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, const wchar_t* Parameter, const wchar_t* OldParameter); MediaInfoList_Set = MediaInfoDLL_Handler.MediaInfoList_Set MediaInfoList_Set.argtype = [c_void_p, c_wchar_p, c_void_p, c_void_p, c_void_p, c_wchar_p, c_wchar_p] MediaInfoList_Set.restype = c_void_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Option */ #MEDIAINFO_EXP const wchar_t* __stdcall MediaInfoList_Option (void* Handle, const wchar_t* Option, const wchar_t* Value); MediaInfoList_Option = MediaInfoDLL_Handler.MediaInfoList_Option MediaInfoList_Option.argtype = [c_void_p, c_wchar_p, c_wchar_p] MediaInfoList_Option.restype = c_wchar_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::State_Get */ #MEDIAINFO_EXP size_t __stdcall MediaInfoList_State_Get (void* Handle); MediaInfoList_State_Get = MediaInfoDLL_Handler.MediaInfoList_State_Get MediaInfoList_State_Get.argtype = [c_void_p] MediaInfoList_State_Get.restype = c_void_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Count_Get */ #MEDIAINFO_EXP size_t __stdcall MediaInfoList_Count_Get (void* Handle, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber); /*Default : StreamNumber=-1*/ MediaInfoList_Count_Get = MediaInfoDLL_Handler.MediaInfoList_Count_Get MediaInfoList_Count_Get.argtype = [c_void_p, c_void_p, c_void_p, c_void_p] MediaInfoList_Count_Get.restype = c_void_p #/** @brief Wrapper for MediaInfoListLib::MediaInfoList::Count_Get */ #MEDIAINFO_EXP size_t __stdcall MediaInfoList_Count_Get_Files (void* Handle); MediaInfoList_Count_Get_Files = MediaInfoDLL_Handler.MediaInfoList_Count_Get_Files MediaInfoList_Count_Get_Files.argtype = [c_void_p] MediaInfoList_Count_Get_Files.restype = c_void_p Handle = c_void_p(0) #Handling def __init__(self): self.Handle=MediaInfoList_New() def __del__(self): MediaInfoList_Delete(self.Handle) def Open(self, Files, Options=FileOptions.Nothing): return MediaInfoList_Open(self.Handle, Files, Options) def Open_Buffer(self, Begin, Begin_Size, End=None, End_Size=0): return MediaInfoList_Open_Buffer (self.Handle, Begin, Begin_Size, End, End_Size) def Save(self, FilePos): return MediaInfoList_Save(self.Handle, FilePos) def Close(self, FilePos): MediaInfoList_Close (self.Handle, FilePos) #General information def Inform(self, FilePos, Reserved=0): return MediaInfoList_Inform (self.Handle, FilePos, Reserved) def GetI(self, FilePos, StreamKind, StreamNumber, Parameter, InfoKind=Info.Text): return MediaInfoList_GetI (self.Handle, FilePos, StreamKind, StreamNumber, Parameter, InfoKind) def Get(self, FilePos, StreamKind, StreamNumber, Parameter, InfoKind=Info.Text, SearchKind=Info.Name): return MediaInfoList_Get (self.Handle, FilePos, StreamKind, StreamNumber, (Parameter), InfoKind, SearchKind) def SetI(self, ToSet, FilePos, StreamKind, StreamNumber, Parameter, OldParameter=""): return MediaInfoList_SetI (self, Handle, ToSet, FilePos, StreamKind, StreamNumber, Parameter, OldParameter) def Set(self, ToSet, FilePos, StreamKind, StreamNumber, Parameter, OldParameter=""): return MediaInfoList_Set (self.Handle, ToSet, FilePos, StreamKind, StreamNumber, Parameter, OldParameter) #Options def Option(self, Option, Value=""): return MediaInfoList_Option (self.Handle, Option, Value) def Option_Static(self, Option, Value=""): return MediaInfoList_Option(None, Option, Value) def State_Get(self): return MediaInfoList_State_Get (self.Handle) def Count_Get(self, FilePos, StreamKind, StreamNumber): return MediaInfoList_Count_Get (self.Handle, FilePos, StreamKind, StreamNumber=-1) def Count_Get_Files(self): return MediaInfoList_Count_Get_Files (self.Handle) MediaInfoLib/Source/MediaInfoDLL/MediaInfoDLL_Static.h100777 0 0 105457 12226004261 16024 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Public DLL interface implementation // Wrapper for MediaInfo Library // Please see MediaInfo.h for help // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ #ifndef MediaInfoDLL_StaticH #define MediaInfoDLL_StaticH //*************************************************************************** // Platforms (from libzen) //*************************************************************************** /*---------------------------------------------------------------------------*/ /*Win32*/ #if defined(__NT__) || defined(_WIN32) || defined(WIN32) #ifndef WIN32 #define WIN32 #endif #ifndef _WIN32 #define _WIN32 #endif #ifndef __WIN32__ #define __WIN32__ 1 #endif #endif /*---------------------------------------------------------------------------*/ /*Win64*/ #if defined(_WIN64) || defined(WIN64) #ifndef WIN64 #define WIN64 #endif #ifndef _WIN64 #define _WIN64 #endif #ifndef __WIN64__ #define __WIN64__ 1 #endif #endif /*---------------------------------------------------------------------------*/ /*Windows*/ #if defined(WIN32) || defined(WIN64) #ifndef WINDOWS #define WINDOWS #endif #ifndef _WINDOWS #define _WINDOWS #endif #ifndef __WINDOWS__ #define __WINDOWS__ 1 #endif #endif /*---------------------------------------------------------------------------*/ /*Unix (Linux, HP, Sun, BeOS...)*/ #if defined(UNIX) || defined(_UNIX) || defined(__UNIX__) \ || defined(__unix) || defined(__unix__) \ || defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) \ || defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) \ || defined(__EMX__) || defined(__VMS) || defined(__BEOS__) #ifndef UNIX #define UNIX #endif #ifndef _UNIX #define _UNIX #endif #ifndef __UNIX__ #define __UNIX__ 1 #endif #endif /*---------------------------------------------------------------------------*/ /*MacOS Classic*/ #if defined(macintosh) #ifndef MACOS #define MACOS #endif #ifndef _MACOS #define _MACOS #endif #ifndef __MACOS__ #define __MACOS__ 1 #endif #endif /*---------------------------------------------------------------------------*/ /*MacOS X*/ #if defined(__APPLE__) && defined(__MACH__) #ifndef MACOSX #define MACOSX #endif #ifndef _MACOSX #define _MACOSX #endif #ifndef __MACOSX__ #define __MACOSX__ 1 #endif #endif /*Test of targets*/ #if defined(WINDOWS) && defined(UNIX) && defined(MACOS) && defined(MACOSX) #pragma message Multiple platforms??? #endif #if !defined(WIN32) && !defined(UNIX) && !defined(MACOS) && !defined(MACOSX) #pragma message No known platforms, assume default #endif /*-------------------------------------------------------------------------*/ #undef MEDIAINFO_EXP #if defined(__WINDOWS__) && !defined(__MINGW32__) //MinGW32 does not support _declspec #ifdef MEDIAINFO_DLL_EXPORT #if defined(MEDIAINFODLL_EXPORTS_NODLLEXPORT) #define MEDIAINFO_EXP extern #else //!defined(MEDIAINFODLL_EXPORTS_NODLLEXPORT) #define MEDIAINFO_EXP extern _declspec(dllexport) #endif //!defined(MEDIAINFODLL_EXPORTS_NODLLEXPORT) #else #define MEDIAINFO_EXP extern _declspec(dllimport) #endif #else //defined(__WINDOWS__) && !defined(__MINGW32__) #if __GNUC__ >= 4 #define MEDIAINFO_EXP __attribute__ ((visibility("default"))) #else #define MEDIAINFO_EXP #endif #endif //defined(__WINDOWS__) && !defined(__MINGW32__) #if !defined(__WINDOWS__) #define __stdcall //Supported only on windows #endif //!defined(__WINDOWS__) /*-------------------------------------------------------------------------*/ #include /*-------------------------------------------------------------------------*/ /*8-bit int */ #if UCHAR_MAX==0xff #undef MAXTYPE_INT #define MAXTYPE_INT 8 typedef unsigned char MediaInfo_int8u; #else #pragma message This machine has no 8-bit integertype? #endif /*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/ /*64-bit int */ #if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__UNIX__) || defined(__MACOSX__) #undef MAXTYPE_INT #define MAXTYPE_INT 64 typedef unsigned long long MediaInfo_int64u; #elif defined(__WIN32__) || defined(_WIN32) #undef MAXTYPE_INT #define MAXTYPE_INT 64 typedef unsigned __int64 MediaInfo_int64u; #else #pragma message This machine has no 64-bit integer type? #endif /*-------------------------------------------------------------------------*/ /** @brief Kinds of Stream */ typedef enum MediaInfo_stream_t { MediaInfo_Stream_General, MediaInfo_Stream_Video, MediaInfo_Stream_Audio, MediaInfo_Stream_Text, MediaInfo_Stream_Other, MediaInfo_Stream_Image, MediaInfo_Stream_Menu, MediaInfo_Stream_Max } MediaInfo_stream_C; /** @brief Kinds of Info */ typedef enum MediaInfo_info_t { MediaInfo_Info_Name, MediaInfo_Info_Text, MediaInfo_Info_Measure, MediaInfo_Info_Options, MediaInfo_Info_Name_Text, MediaInfo_Info_Measure_Text, MediaInfo_Info_Info, MediaInfo_Info_HowTo, MediaInfo_Info_Max } MediaInfo_info_C; /** @brief Option if InfoKind = Info_Options */ typedef enum MediaInfo_infooptions_t { MediaInfo_InfoOption_ShowInInform, MediaInfo_InfoOption_Reserved, MediaInfo_InfoOption_ShowInSupported, MediaInfo_InfoOption_TypeOfValue, MediaInfo_InfoOption_Max } MediaInfo_infooptions_C; /** @brief File opening options */ typedef enum MediaInfo_fileoptions_t { MediaInfo_FileOption_Nothing = 0x00, MediaInfo_FileOption_NoRecursive = 0x01, MediaInfo_FileOption_CloseAll = 0x02, MediaInfo_FileOption_Max = 0x04 } MediaInfo_fileoptions_C; #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /***************************************************************************/ /*! \file MediaInfoDll.h \brief DLL wrapper for MediaInfo.h. DLL wrapper for MediaInfo.h \n Can be used for C and C++\n "Handle" replaces class definition */ /***************************************************************************/ #if defined(MEDIAINFO_DLL_EXPORT) || (defined(UNICODE) || defined(_UNICODE)) //DLL construction or Unicode /** @brief A 'new' MediaInfo interface, return a Handle, don't forget to delete it after using it*/ MEDIAINFO_EXP void* __stdcall MediaInfo_New (); /*you must ALWAYS call MediaInfo_Delete(Handle) in order to free memory*/ /** @brief A 'new' MediaInfo interface (with a quick init of useful options : "**VERSION**;**APP_NAME**;**APP_VERSION**", but without debug information, use it only if you know what you do), return a Handle, don't forget to delete it after using it*/ MEDIAINFO_EXP void* __stdcall MediaInfo_New_Quick (const wchar_t* File, const wchar_t* Options); /*you must ALWAYS call MediaInfo_Delete(Handle) in order to free memory*/ /** @brief Delete a MediaInfo interface*/ MEDIAINFO_EXP void __stdcall MediaInfo_Delete (void* Handle); /** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a filename)*/ MEDIAINFO_EXP size_t __stdcall MediaInfo_Open (void* Handle, const wchar_t* File); /** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a buffer) */ MEDIAINFO_EXP size_t __stdcall MediaInfo_Open_Buffer (void* Handle, const unsigned char* Begin, size_t Begin_Size, const unsigned char* End, size_t End_Size); /*return Handle*/ /** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a buffer, Init) */ MEDIAINFO_EXP size_t __stdcall MediaInfo_Open_Buffer_Init (void* Handle, MediaInfo_int64u File_Size, MediaInfo_int64u File_Offset); /** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a buffer, Continue) */ MEDIAINFO_EXP size_t __stdcall MediaInfo_Open_Buffer_Continue (void* Handle, MediaInfo_int8u* Buffer, size_t Buffer_Size); /** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a buffer, Continue_GoTo_Get) */ MEDIAINFO_EXP MediaInfo_int64u __stdcall MediaInfo_Open_Buffer_Continue_GoTo_Get (void* Handle); /** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a buffer, Finalize) */ MEDIAINFO_EXP size_t __stdcall MediaInfo_Open_Buffer_Finalize (void* Handle); /** @brief Wrapper for MediaInfoLib::MediaInfo::Open (NextPacket) */ MEDIAINFO_EXP size_t __stdcall MediaInfo_Open_NextPacket (void* Handle); /** @brief Wrapper for MediaInfoLib::MediaInfo::Save */ MEDIAINFO_EXP size_t __stdcall MediaInfo_Save (void* Handle); /** @brief Wrapper for MediaInfoLib::MediaInfo::Close */ MEDIAINFO_EXP void __stdcall MediaInfo_Close (void* Handle); /** @brief Wrapper for MediaInfoLib::MediaInfo::Inform */ MEDIAINFO_EXP const wchar_t* __stdcall MediaInfo_Inform (void* Handle, size_t Reserved); /*Default : Reserved=0*/ /** @brief Wrapper for MediaInfoLib::MediaInfo::Get */ MEDIAINFO_EXP const wchar_t* __stdcall MediaInfo_GetI (void* Handle, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C InfoKind); /*Default : InfoKind=Info_Text*/ /** @brief Wrapper for MediaInfoLib::MediaInfo::Get */ MEDIAINFO_EXP const wchar_t* __stdcall MediaInfo_Get (void* Handle, MediaInfo_stream_C StreamKind, size_t StreamNumber, const wchar_t* Parameter, MediaInfo_info_C InfoKind, MediaInfo_info_C SearchKind); /*Default : InfoKind=Info_Text, SearchKind=Info_Name*/ /** @brief Wrapper for MediaInfoLib::MediaInfo::Set */ MEDIAINFO_EXP size_t __stdcall MediaInfo_SetI (void* Handle, const wchar_t* ToSet, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, const wchar_t* OldParameter); /** @brief Wrapper for MediaInfoLib::MediaInfo::Set */ MEDIAINFO_EXP size_t __stdcall MediaInfo_Set (void* Handle, const wchar_t* ToSet, MediaInfo_stream_C StreamKind, size_t StreamNumber, const wchar_t* Parameter, const wchar_t* OldParameter); /** @brief Wrapper for MediaInfoLib::MediaInfo::Output_Buffer_Get */ MEDIAINFO_EXP size_t __stdcall MediaInfo_Output_Buffer_Get (void* Handle, const wchar_t* Value); /** @brief Wrapper for MediaInfoLib::MediaInfo::Output_Buffer_Get */ MEDIAINFO_EXP size_t __stdcall MediaInfo_Output_Buffer_GetI (void* Handle, size_t Pos); /** @brief Wrapper for MediaInfoLib::MediaInfo::Option */ MEDIAINFO_EXP const wchar_t* __stdcall MediaInfo_Option (void* Handle, const wchar_t* Option, const wchar_t* Value); /** @brief Wrapper for MediaInfoLib::MediaInfo::State_Get */ MEDIAINFO_EXP size_t __stdcall MediaInfo_State_Get (void* Handle); /** @brief Wrapper for MediaInfoLib::MediaInfo::Count_Get */ MEDIAINFO_EXP size_t __stdcall MediaInfo_Count_Get (void* Handle, MediaInfo_stream_C StreamKind, size_t StreamNumber); /*Default : StreamNumber=-1*/ #else //defined(MEDIAINFO_DLL_EXPORT) || (defined(UNICODE) || defined(_UNICODE)) #define MediaInfo_New MediaInfoA_New #define MediaInfo_New_Quick MediaInfoA_New_Quick #define MediaInfo_Delete MediaInfoA_Delete #define MediaInfo_Open MediaInfoA_Open #define MediaInfo_Open_Buffer MediaInfoA_Open_Buffer #define MediaInfo_Save MediaInfoA_Save #define MediaInfo_Close MediaInfoA_Close #define MediaInfo_Inform MediaInfoA_Inform #define MediaInfo_GetI MediaInfoA_GetI #define MediaInfo_Get MediaInfoA_Get #define MediaInfo_SetI MediaInfoA_SetI #define MediaInfo_Set MediaInfoA_Set #define MediaInfo_Output_Buffer_Get MediaInfoA_Output_Buffer_Get #define MediaInfo_Output_Buffer_GetI MediaInfoA_Output_Buffer_GetI #define MediaInfo_Option MediaInfoA_Option #define MediaInfo_State_Get MediaInfoA_State_Get #define MediaInfo_Count_Get MediaInfoA_Count_Get #endif //defined(MEDIAINFO_DLL_EXPORT) || (defined(UNICODE) || defined(_UNICODE)) /** @brief A 'new' MediaInfo interface, return a Handle, don't forget to delete it after using it*/ MEDIAINFO_EXP void* __stdcall MediaInfoA_New (); /*you must ALWAYS call MediaInfo_Delete(Handle) in order to free memory*/ /** @brief A 'new' MediaInfo interface (with a quick init of useful options : "**VERSION**;**APP_NAME**;**APP_VERSION**", but without debug information, use it only if you know what you do), return a Handle, don't forget to delete it after using it*/ MEDIAINFO_EXP void* __stdcall MediaInfoA_New_Quick (const char* File, const char* Options); /*you must ALWAYS call MediaInfo_Delete(Handle) in order to free memory*/ /** @brief Delete a MediaInfo interface*/ MEDIAINFO_EXP void __stdcall MediaInfoA_Delete (void* Handle); /** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a filename)*/ MEDIAINFO_EXP size_t __stdcall MediaInfoA_Open (void* Handle, const char* File); /*you must ALWAYS call MediaInfo_Close(Handle) in order to free memory*/ /** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a buffer) */ MEDIAINFO_EXP size_t __stdcall MediaInfoA_Open_Buffer (void* Handle, const unsigned char* Begin, size_t Begin_Size, const unsigned char* End, size_t End_Size); /*return Handle*/ /** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a buffer, Init) */ MEDIAINFO_EXP size_t __stdcall MediaInfoA_Open_Buffer_Init (void* Handle, MediaInfo_int64u File_Size, MediaInfo_int64u File_Offset); /** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a buffer, Continue) */ MEDIAINFO_EXP size_t __stdcall MediaInfoA_Open_Buffer_Continue (void* Handle, MediaInfo_int8u* Buffer, size_t Buffer_Size); /** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a buffer, Continue_GoTo_Get) */ MEDIAINFO_EXP MediaInfo_int64u __stdcall MediaInfoA_Open_Buffer_Continue_GoTo_Get (void* Handle); /** @brief Wrapper for MediaInfoLib::MediaInfo::Open (with a buffer, Finalize) */ MEDIAINFO_EXP size_t __stdcall MediaInfoA_Open_Buffer_Finalize (void* Handle); /** @brief Wrapper for MediaInfoLib::MediaInfo::Open (NextPacket) */ MEDIAINFO_EXP size_t __stdcall MediaInfoA_Open_NextPacket (void* Handle); /** @brief Wrapper for MediaInfoLib::MediaInfo::Save */ MEDIAINFO_EXP size_t __stdcall MediaInfoA_Save (void* Handle); /** @brief Wrapper for MediaInfoLib::MediaInfo::Close */ MEDIAINFO_EXP void __stdcall MediaInfoA_Close (void* Handle); /** @brief Wrapper for MediaInfoLib::MediaInfo::Inform */ MEDIAINFO_EXP const char* __stdcall MediaInfoA_Inform (void* Handle, size_t Reserved); /*Default : Reserved=MediaInfo_*/ /** @brief Wrapper for MediaInfoLib::MediaInfo::Get */ MEDIAINFO_EXP const char* __stdcall MediaInfoA_GetI (void* Handle, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C InfoKind); /*Default : InfoKind=Info_Text*/ /** @brief Wrapper for MediaInfoLib::MediaInfo::Get */ MEDIAINFO_EXP const char* __stdcall MediaInfoA_Get (void* Handle, MediaInfo_stream_C StreamKind, size_t StreamNumber, const char* Parameter, MediaInfo_info_C InfoKind, MediaInfo_info_C SearchKind); /*Default : InfoKind=Info_Text, SearchKind=Info_Name*/ /** @brief Wrapper for MediaInfoLib::MediaInfo::Set */ MEDIAINFO_EXP size_t __stdcall MediaInfoA_SetI (void* Handle, const char* ToSet, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, const char* OldParameter); /** @brief Wrapper for MediaInfoLib::MediaInfo::Set */ MEDIAINFO_EXP size_t __stdcall MediaInfoA_Set (void* Handle, const char* ToSet, MediaInfo_stream_C StreamKind, size_t StreamNumber, const char* Parameter, const char* OldParameter); /** @brief Wrapper for MediaInfoLib::MediaInfo::Output_Buffer_Get */ MEDIAINFO_EXP size_t __stdcall MediaInfoA_Output_Buffer_Get (void* Handle, const char* Value); /** @brief Wrapper for MediaInfoLib::MediaInfo::Output_Buffer_Get */ MEDIAINFO_EXP size_t __stdcall MediaInfoA_Output_Buffer_GetI (void* Handle, size_t Pos); /** @brief Wrapper for MediaInfoLib::MediaInfo::Option */ MEDIAINFO_EXP const char* __stdcall MediaInfoA_Option (void* Handle, const char* Option, const char* Value); /** @brief Wrapper for MediaInfoLib::MediaInfo::State_Get */ MEDIAINFO_EXP size_t __stdcall MediaInfoA_State_Get (void* Handle); /** @brief Wrapper for MediaInfoLib::MediaInfo::Count_Get */ MEDIAINFO_EXP size_t __stdcall MediaInfoA_Count_Get (void* Handle, MediaInfo_stream_C StreamKind, size_t StreamNumber); /*Default : StreamNumber=-1*/ #if defined(MEDIAINFO_DLL_EXPORT) || (defined(UNICODE) || defined(_UNICODE)) //DLL construction or Unicode /** @brief A 'new' MediaInfoList interface, return a Handle, don't forget to delete it after using it*/ MEDIAINFO_EXP void* __stdcall MediaInfoList_New (); /*you must ALWAYS call MediaInfoList_Delete(Handle) in order to free memory*/ /** @brief A 'new' MediaInfoList interface (with a quick init of useful options : "**VERSION**;**APP_NAME**;**APP_VERSION**", but without debug information, use it only if you know what you do), return a Handle, don't forget to delete it after using it*/ MEDIAINFO_EXP void* __stdcall MediaInfoList_New_Quick (const wchar_t* Files, const wchar_t* Config); /*you must ALWAYS call MediaInfoList_Delete(Handle) in order to free memory*/ /** @brief Delete a MediaInfoList interface*/ MEDIAINFO_EXP void __stdcall MediaInfoList_Delete (void* Handle); /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Open (with a filename)*/ MEDIAINFO_EXP size_t __stdcall MediaInfoList_Open (void* Handle, const wchar_t* Files, const MediaInfo_fileoptions_C Options); /*Default : Options=MediaInfo_FileOption_Nothing*/ /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Open (with a buffer) */ MEDIAINFO_EXP size_t __stdcall MediaInfoList_Open_Buffer (void* Handle, const unsigned char* Begin, size_t Begin_Size, const unsigned char* End, size_t End_Size); /*return Handle*/ /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Save */ MEDIAINFO_EXP size_t __stdcall MediaInfoList_Save (void* Handle, size_t FilePos); /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Close */ MEDIAINFO_EXP void __stdcall MediaInfoList_Close (void* Handle, size_t FilePos); /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Inform */ MEDIAINFO_EXP const wchar_t* __stdcall MediaInfoList_Inform (void* Handle, size_t FilePos, size_t Reserved); /*Default : Reserved=0*/ /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Get */ MEDIAINFO_EXP const wchar_t* __stdcall MediaInfoList_GetI (void* Handle, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C InfoKind); /*Default : InfoKind=Info_Text*/ /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Get */ MEDIAINFO_EXP const wchar_t* __stdcall MediaInfoList_Get (void* Handle, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, const wchar_t* Parameter, MediaInfo_info_C InfoKind, MediaInfo_info_C SearchKind); /*Default : InfoKind=Info_Text, SearchKind=Info_Name*/ /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Set */ MEDIAINFO_EXP size_t __stdcall MediaInfoList_SetI (void* Handle, const wchar_t* ToSet, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, const wchar_t* OldParameter); /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Set */ MEDIAINFO_EXP size_t __stdcall MediaInfoList_Set (void* Handle, const wchar_t* ToSet, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, const wchar_t* Parameter, const wchar_t* OldParameter); /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Option */ MEDIAINFO_EXP const wchar_t* __stdcall MediaInfoList_Option (void* Handle, const wchar_t* Option, const wchar_t* Value); /** @brief Wrapper for MediaInfoListLib::MediaInfoList::State_Get */ MEDIAINFO_EXP size_t __stdcall MediaInfoList_State_Get (void* Handle); /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Count_Get */ MEDIAINFO_EXP size_t __stdcall MediaInfoList_Count_Get (void* Handle, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber); /*Default : StreamNumber=-1*/ /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Count_Get */ MEDIAINFO_EXP size_t __stdcall MediaInfoList_Count_Get_Files (void* Handle); #else //defined(MEDIAINFO_DLL_EXPORT) || (defined(UNICODE) || defined(_UNICODE)) #define MediaInfoList_New MediaInfoListA_New #define MediaInfoList_New_Quick MediaInfoListA_New_Quick #define MediaInfoList_Delete MediaInfoListA_Delete #define MediaInfoList_Open MediaInfoListA_Open #define MediaInfoList_Open_Buffer MediaInfoListA_Open_Buffer #define MediaInfoList_Save MediaInfoListA_Save #define MediaInfoList_Save_All MediaInfoListA_Save_All #define MediaInfoList_Close MediaInfoListA_Close #define MediaInfoList_Close_All MediaInfoListA_Close_All #define MediaInfoList_Inform MediaInfoListA_Inform #define MediaInfoList_Inform_All MediaInfoListA_Inform_All #define MediaInfoList_GetI MediaInfoListA_GetI #define MediaInfoList_Get MediaInfoListA_Get #define MediaInfoList_SetI MediaInfoListA_SetI #define MediaInfoList_Set MediaInfoListA_Set #define MediaInfoList_Option MediaInfoListA_Option #define MediaInfoList_State_Get MediaInfoListA_State_Get #define MediaInfoList_Count_Get MediaInfoListA_Count_Get #define MediaInfoList_Count_Get_Files MediaInfoListA_Count_Get_Files #endif //defined(MEDIAINFO_DLL_EXPORT) || (defined(UNICODE) || defined(_UNICODE)) /* Warning : Deprecated, use MediaInfo_Option("Info_Version", "**YOUR VERSION COMPATIBLE**") instead */ MEDIAINFO_EXP const char* __stdcall MediaInfo_Info_Version (); /** @brief A 'new' MediaInfoList interface, return a Handle, don't forget to delete it after using it*/ MEDIAINFO_EXP void* __stdcall MediaInfoListA_New (); /*you must ALWAYS call MediaInfoList_Delete(Handle) in order to free memory*/ /** @brief A 'new' MediaInfoList interface (with a quick init of useful options : "**VERSION**;**APP_NAME**;**APP_VERSION**", but without debug information, use it only if you know what you do), return a Handle, don't forget to delete it after using it*/ MEDIAINFO_EXP void* __stdcall MediaInfoListA_New_Quick (const char* Files, const char* Config); /*you must ALWAYS call MediaInfoList_Delete(Handle) in order to free memory*/ /** @brief Delete a MediaInfoList interface*/ MEDIAINFO_EXP void __stdcall MediaInfoListA_Delete (void* Handle); /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Open (with a filename)*/ MEDIAINFO_EXP size_t __stdcall MediaInfoListA_Open (void* Handle, const char* Files, const MediaInfo_fileoptions_C Options); /*Default : Options=0*/ /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Open (with a buffer) */ MEDIAINFO_EXP size_t __stdcall MediaInfoListA_Open_Buffer (void* Handle, const unsigned char* Begin, size_t Begin_Size, const unsigned char* End, size_t End_Size); /*return Handle*/ /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Save */ MEDIAINFO_EXP size_t __stdcall MediaInfoListA_Save (void* Handle, size_t FilePos); /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Close */ MEDIAINFO_EXP void __stdcall MediaInfoListA_Close (void* Handle, size_t FilePos); /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Inform */ MEDIAINFO_EXP const char* __stdcall MediaInfoListA_Inform (void* Handle, size_t FilePos, size_t Reserved); /*Default : Reserved=0*/ /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Get */ MEDIAINFO_EXP const char* __stdcall MediaInfoListA_GetI (void* Handle, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C InfoKind); /*Default : InfoKind=Info_Text*/ /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Get */ MEDIAINFO_EXP const char* __stdcall MediaInfoListA_Get (void* Handle, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, const char* Parameter, MediaInfo_info_C InfoKind, MediaInfo_info_C SearchKind); /*Default : InfoKind=Info_Text, SearchKind=Info_Name*/ /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Set */ MEDIAINFO_EXP size_t __stdcall MediaInfoListA_SetI (void* Handle, const char* ToSet, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, const char* OldParameter); /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Set */ MEDIAINFO_EXP size_t __stdcall MediaInfoListA_Set (void* Handles, const char* ToSet, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber, const char* Parameter, const char* OldParameter); /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Option */ MEDIAINFO_EXP const char* __stdcall MediaInfoListA_Option (void* Handle, const char* Option, const char* Value); /** @brief Wrapper for MediaInfoListLib::MediaInfoList::State_Get */ MEDIAINFO_EXP size_t __stdcall MediaInfoListA_State_Get (void* Handle); /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Count_Get */ MEDIAINFO_EXP size_t __stdcall MediaInfoListA_Count_Get (void* Handle, size_t FilePos, MediaInfo_stream_C StreamKind, size_t StreamNumber); /*Default : StreamNumber=-1*/ /** @brief Wrapper for MediaInfoListLib::MediaInfoList::Count_Get */ MEDIAINFO_EXP size_t __stdcall MediaInfoListA_Count_Get_Files (void* Handle); #ifdef __cplusplus } #endif /*__cplusplus*/ #ifdef __cplusplus //DLL C++ wrapper for C functions #if !defined(MediaInfoH) && !defined(MEDIAINFO_DLL_EXPORT) //No Lib include and No DLL construction //--------------------------------------------------------------------------- #include //--------------------------------------------------------------------------- namespace MediaInfoDLL { //--------------------------------------------------------------------------- //Char types #undef __T #define __T(__x) __T(__x) #if defined(UNICODE) || defined(_UNICODE) typedef wchar_t Char; #undef __T #define __T(__x) L ## __x #else typedef char Char; #undef __T #define __T(__x) __x #endif typedef std::basic_string String; typedef std::basic_stringstream StringStream; typedef std::basic_istringstream tiStringStream; typedef std::basic_ostringstream toStringStream; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- /// @brief Kinds of Stream enum stream_t { Stream_General, ///< StreamKind = General Stream_Video, ///< StreamKind = Video Stream_Audio, ///< StreamKind = Audio Stream_Text, ///< StreamKind = Text Stream_Other, ///< StreamKind = Other Stream_Image, ///< StreamKind = Image Stream_Menu, ///< StreamKind = Menu Stream_Max, }; /// @brief Kind of information enum info_t { Info_Name, ///< InfoKind = Unique name of parameter Info_Text, ///< InfoKind = Value of parameter Info_Measure, ///< InfoKind = Unique name of measure unit of parameter Info_Options, ///< InfoKind = See infooptions_t Info_Name_Text, ///< InfoKind = Translated name of parameter Info_Measure_Text, ///< InfoKind = Translated name of measure unit Info_Info, ///< InfoKind = More information about the parameter Info_HowTo, ///< InfoKind = Information : how data is found Info_Max }; /// Get(...)[infooptions_t] return a string like "YNYN..." \n /// Use this enum to know at what correspond the Y (Yes) or N (No) /// If Get(...)[0]==Y, then : /// @brief Option if InfoKind = Info_Options enum infooptions_t { InfoOption_ShowInInform, ///< Show this parameter in Inform() InfoOption_Reserved, ///< InfoOption_ShowInSupported, ///< Internal use only (info : Must be showed in Info_Capacities()) InfoOption_TypeOfValue, ///< Value return by a standard Get() can be : T (Text), I (Integer, warning up to 64 bits), F (Float), D (Date), B (Binary datas coded Base64) (Numbers are in Base 10) InfoOption_Max }; /// @brief File opening options enum fileoptions_t { FileOption_Nothing = 0x00, FileOption_NoRecursive = 0x01, ///< Do not browse folders recursively FileOption_CloseAll = 0x02, ///< Close all files before open FileOption_Max = 0x04 }; //--------------------------------------------------------------------------- class MediaInfo { public : MediaInfo () {Handle=MediaInfo_New();}; ~MediaInfo () {MediaInfo_Delete(Handle);}; //File size_t Open (const String &File) {return MediaInfo_Open(Handle, File.c_str());}; size_t Open (const unsigned char* Begin, size_t Begin_Size, const unsigned char* End=NULL, size_t End_Size=NULL) {return MediaInfo_Open_Buffer(Handle, Begin, Begin_Size, End, End_Size);}; size_t Save () {return MediaInfo_Save(Handle);}; void Close () {return MediaInfo_Close(Handle);}; //General information String Inform () {return MediaInfo_Inform(Handle, 0);}; String Get (stream_t StreamKind, size_t StreamNumber, size_t Parameter, info_t InfoKind=Info_Text) {return MediaInfo_GetI (Handle, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter, (MediaInfo_info_C)InfoKind);}; String Get (stream_t StreamKind, size_t StreamNumber, const String &Parameter, info_t InfoKind=Info_Text, info_t SearchKind=Info_Name) {return MediaInfo_Get (Handle, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter.c_str(), (MediaInfo_info_C)InfoKind, (MediaInfo_info_C)SearchKind);}; size_t Set (const String &ToSet, stream_t StreamKind, size_t StreamNumber, size_t Parameter, const String &OldValue=__T("")) {return MediaInfo_SetI (Handle, ToSet.c_str(), (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter, OldValue.c_str());}; size_t Set (const String &ToSet, stream_t StreamKind, size_t StreamNumber, const String &Parameter, const String &OldValue=__T("")) {return MediaInfo_Set (Handle, ToSet.c_str(), (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter.c_str(), OldValue.c_str());}; String Option (const String &Option, const String &Value=__T("")) {return MediaInfo_Option (Handle, Option.c_str(), Value.c_str());}; static String Option_Static (const String &Option, const String &Value=__T("")) {return MediaInfo_Option (NULL, Option.c_str(), Value.c_str());}; size_t State_Get () {return MediaInfo_State_Get(Handle);}; size_t Count_Get (stream_t StreamKind, size_t StreamNumber=-1) {return MediaInfo_Count_Get(Handle, (MediaInfo_stream_C)StreamKind, StreamNumber);}; private : void* Handle; }; class MediaInfoList { public : MediaInfoList () {Handle=MediaInfoList_New();}; ~MediaInfoList () {MediaInfoList_Delete(Handle);}; //File size_t Open (const String &File, const fileoptions_t Options=FileOption_Nothing) {return MediaInfoList_Open(Handle, File.c_str(), (MediaInfo_fileoptions_C)Options);}; size_t Open (const unsigned char* Begin, size_t Begin_Size, const unsigned char* End=NULL, size_t End_Size=NULL) {return MediaInfoList_Open_Buffer(Handle, Begin, Begin_Size, End, End_Size);}; size_t Save (size_t FilePos) {return MediaInfoList_Save(Handle, FilePos);}; void Close (size_t FilePos=-1) {return MediaInfoList_Close(Handle, FilePos);}; //General information String Inform (size_t FilePos=-1) {return MediaInfoList_Inform(Handle, FilePos, 0);}; String Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber, size_t Parameter, info_t InfoKind=Info_Text) {return MediaInfoList_GetI (Handle, FilePos, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter, (MediaInfo_info_C)InfoKind);}; String Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber, const String &Parameter, info_t InfoKind=Info_Text, info_t SearchKind=Info_Name) {return MediaInfoList_Get (Handle, FilePos, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter.c_str(), (MediaInfo_info_C)InfoKind, (MediaInfo_info_C)SearchKind);}; size_t Set (const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, size_t Parameter, const String &OldValue=__T("")) {return MediaInfoList_SetI (Handle, ToSet.c_str(), FilePos, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter, OldValue.c_str());}; size_t Set (const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, const String &Parameter, const String &OldValue=__T("")) {return MediaInfoList_Set (Handle, ToSet.c_str(), FilePos, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter.c_str(), OldValue.c_str());}; String Option (const String &Option, const String &Value=__T("")) {return MediaInfoList_Option (Handle, Option.c_str(), Value.c_str());}; static String Option_Static (const String &Option, const String &Value=__T("")) {return MediaInfoList_Option (NULL, Option.c_str(), Value.c_str());}; size_t State_Get () {return MediaInfoList_State_Get(Handle);}; size_t Count_Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber=-1) {return MediaInfoList_Count_Get(Handle, FilePos, (MediaInfo_stream_C)StreamKind, StreamNumber);}; size_t Count_Get () {return MediaInfoList_Count_Get_Files(Handle);}; private : void* Handle; }; } //NameSpace #endif//#if !defined(MediaInfoH) && !defined(MEDIAINFO_DLL_EXPORT) && !(defined(UNICODE) || defined(_UNICODE)) #endif /*__cplusplus*/ #endif MediaInfoLib/Source/MediaInfo/Archive/ 40777 0 0 0 12262557530 13042 5MediaInfoLib/Source/MediaInfo/Archive/File_7z.cpp100777 0 0 4372 12226004262 15140 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_7Z_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Archive/File_7z.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_7z::FileHeader_Begin() { //Element_Size if (Buffer_Size<6) return false; //Must wait for more data if (CC6(Buffer)!=0x377ABCAF271CLL) //"7z...." { Reject("7-Zip"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_7z::Read_Buffer_Continue() { Skip_B6( "Magic"); Skip_XX(File_Size-6, "Data"); FILLING_BEGIN(); Accept("7-Zip"); Fill(Stream_General, 0, General_Format, "7-Zip"); Finish("7-Zip"); FILLING_END(); } } //NameSpace #endif //MEDIAINFO_7Z_YES MediaInfoLib/Source/MediaInfo/Archive/File_7z.h100777 0 0 2326 12226004262 14602 0/* 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 7z files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_7zH #define MediaInfo_File_7zH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_7z //*************************************************************************** class File_7z : public File__Analyze { protected : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Archive/File_Ace.cpp100777 0 0 4411 12226004262 15262 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_ACE_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Archive/File_Ace.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_Ace::FileHeader_Begin() { //Element_Size if (Buffer_Size<7) return false; //Must wait for more data if (CC7(Buffer)!=0x2A2A4143452A2ALL) //"**ACE**" { Reject("Ace"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Ace::Read_Buffer_Continue() { //Parsing Skip_B7( "Magic"); Skip_XX(File_Size-7, "Data"); FILLING_BEGIN(); Accept("Ace"); Fill(Stream_General, 0, General_Format, "ACE"); Finish("Ace"); FILLING_END(); } } //NameSpace #endif //MEDIAINFO_ACE_YES MediaInfoLib/Source/MediaInfo/Archive/File_Ace.h100777 0 0 2333 12226004262 14730 0/* 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 ACE files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_AceH #define MediaInfo_File_AceH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Ace //*************************************************************************** class File_Ace : public File__Analyze { protected : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Archive/File_Bzip2.cpp100777 0 0 4662 12226004262 15570 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_BZIP2_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Archive/File_Bzip2.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_Bzip2::FileHeader_Begin() { //Element_Size if (Buffer_Size<2) return false; //Must wait for more data if (CC2(Buffer)!=0x425A) //"BZ" { Reject("Bzip2"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Bzip2::Read_Buffer_Continue() { //Parsing Skip_B7( "Magic"); Skip_XX(File_Size-2, "Data"); FILLING_BEGIN(); Accept("Bzip2"); Fill(Stream_General, 0, General_Format, "BZip2"); Finish("Bzip2"); FILLING_END(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_BZIP2_YES MediaInfoLib/Source/MediaInfo/Archive/File_Bzip2.h100777 0 0 2345 12226004262 15231 0/* 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 Bzip2 files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_Bzip2H #define MediaInfo_File_Bzip2H //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Bzip2 //*************************************************************************** class File_Bzip2 : public File__Analyze { protected : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Archive/File_Elf.cpp100777 0 0 21073 12226004262 15323 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_ELF_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Archive/File_Elf.h" #include "ZenLib/Utils.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* Elf_osabi(int8u osabi) { switch (osabi) { case 0 : return "UNIX System V ABI"; case 1 : return "HP-UX"; case 2 : return "NetBSD"; case 3 : return "Linux"; case 6 : return "Sun Solaris"; case 7 : return "IBM AIX"; case 8 : return "SGI Irix"; case 9 : return "FreeBSD"; case 10 : return "Compaq TRU64 UNIX"; case 11 : return "Novell Modesto"; case 12 : return "OpenBSD"; case 97 : return "ARM"; case 255 : return "Standalone"; default : return ""; } } //--------------------------------------------------------------------------- const char* Elf_type(int16u type) { switch (type) { case 1 : return "Relocatable"; case 2 : return "Executable"; case 3 : return "Shared object"; case 4 : return "Core"; default : return ""; } } //--------------------------------------------------------------------------- const char* Elf_machine(int16u machine) { switch (machine) { case 1 : return "AT&T WE 32100"; case 2 : return "SUN SPARC"; case 3 : return "Intel i386"; case 4 : return "Motorola m68k"; case 5 : return "Motorola m88k"; case 7 : return "Intel i860"; case 8 : return "MIPS R3000"; case 9 : return "IBM System/370"; case 10 : return "MIPS R3000"; case 15 : return "HPPA"; case 17 : return "Fujitsu VPP500"; case 18 : return "Sun v8plus"; case 19 : return "Intel i960"; case 20 : return "PowerPC"; case 21 : return "PowerPC 64-bit"; case 22 : return "IBM S390"; case 36 : return "NEC V800"; case 37 : return "Fujitsu FR20"; case 38 : return "TRW RH-32"; case 39 : return "Motorola RCE"; case 40 : return "ARM"; case 41 : return "DEC Alpha"; case 42 : return "Hitachi SH"; case 43 : return "SPARC v9 64-bit"; case 44 : return "Siemens Tricore"; case 45 : return "Argonaut RISC Core"; case 46 : return "Hitachi H8/300"; case 47 : return "Hitachi H8/300H"; case 48 : return "Hitachi H8S"; case 49 : return "Hitachi H8/500"; case 50 : return "Intel IA64"; case 51 : return "Stanford MIPS-X"; case 52 : return "Motorola Coldfire"; case 53 : return "Motorola M68HC12"; case 54 : return "Fujitsu MMA"; case 55 : return "Siemens PCP"; case 56 : return "Sony nCPU"; case 57 : return "Denso NDR1"; case 58 : return "Motorola Start*Core"; case 59 : return "Toyota ME16"; case 60 : return "STMicroelectronic ST100"; case 61 : return "Advanced Logic Corp. Tinyj"; case 62 : return "AMD x86-64"; case 63 : return "Sony DSP"; case 66 : return "Siemens FX66"; case 67 : return "STMicroelectronics ST9+"; case 68 : return "STmicroelectronics ST7"; case 69 : return "Motorola MC68HC16"; case 70 : return "Motorola MC68HC11"; case 71 : return "Motorola MC68HC08"; case 72 : return "Motorola MC68HC05"; case 73 : return "Silicon Graphics SVx"; case 74 : return "STMicroelectronics ST19"; case 75 : return "DEC VAX"; case 76 : return "Axis Communications 32-bit"; case 77 : return "Infineon Technologies 32-bit"; case 78 : return "Element 14 64-bit"; case 79 : return "LSI Logic 16-bit"; case 80 : return "Donald Knuth's educational 64-bit"; case 81 : return "Harvard University machine-independent"; case 82 : return "SiTera Prism"; case 83 : return "Atmel AVR 8-bit"; case 84 : return "Fujitsu FR30"; case 85 : return "Mitsubishi D10V"; case 86 : return "Mitsubishi D30V"; case 87 : return "NEC v850"; case 88 : return "Mitsubishi M32R"; case 89 : return "Matsushita MN10300"; case 90 : return "Matsushita MN10200"; case 91 : return "picoJava"; case 92 : return "OpenRISC 32-bit"; case 93 : return "ARC Cores Tangent-A5"; case 94 : return "Tensilica Xtensa"; default : return ""; } } //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_Elf::FileHeader_Begin() { //Element_Size if (Buffer_Size<4) return false; //Must wait for more data if (CC4(Buffer)!=0x7F454C46) //".ELF" { Reject("ELF"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Elf::Read_Buffer_Continue() { //Parsing int32u version4=(int32u)-1; int16u type=(int16u)-1, machine=(int16u)-1; int8u classs, data, version1, osabi, abiversion; Skip_C4( "magic"); Get_L1 (classs, "class"); Get_L1 (data, "data"); Get_L1 (version1, "version"); Get_L1 (osabi, "osabi"); Param_Info1(Elf_osabi(osabi)); Get_L1 (abiversion, "abiversion"); Skip_XX(7, "reserved"); if (data==1) //LE { Get_L2 (type, "type"); Param_Info1(Elf_type(type)); Get_L2 (machine, "machine"); Param_Info1(Elf_machine(machine)); Get_L4 (version4, "version"); } if (data==2) //BE { Get_B2 (type, "type"); Param_Info1(Elf_type(type)); Get_B2 (machine, "machine"); Param_Info1(Elf_machine(machine)); Get_B4 (version4, "version"); } Skip_XX(Element_Size-Element_Offset, "Data"); FILLING_BEGIN(); if (version4!=(int32u)-1 && version1!=version4) { Reject("ELF"); return; } Accept("ELF"); Fill(Stream_General, 0, General_Format, "ELF"); if (type!=(int16u)-1) Fill(Stream_General, 0, General_Format_Profile, Elf_type(type)); if (machine!=(int16u)-1) Fill(Stream_General, 0, General_Format_Profile, Elf_machine(machine)); //No need of more Finish("ELF"); FILLING_END(); } } //NameSpace #endif //MEDIAINFO_ELF_YES MediaInfoLib/Source/MediaInfo/Archive/File_Elf.h100777 0 0 2333 12226004262 14746 0/* 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 ELF files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_ElfH #define MediaInfo_File_ElfH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Elf //*************************************************************************** class File_Elf : public File__Analyze { protected : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Archive/File_Gzip.cpp100777 0 0 5410 12226004262 15503 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_GZIP_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Archive/File_Gzip.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_Gzip::FileHeader_Begin() { //Element_Size if (Buffer_Size<2) return false; //Must wait for more data if (CC2(Buffer)!=0x1F8B) { Reject("Gzip"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- 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(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_GZIP_YES MediaInfoLib/Source/MediaInfo/Archive/File_Gzip.h100777 0 0 2340 12226004262 15147 0/* 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 Gzip files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_GzipH #define MediaInfo_File_GzipH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Gzip //*************************************************************************** class File_Gzip : public File__Analyze { protected : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Archive/File_Iso9660.cpp100777 0 0 7633 12262557530 15675 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_7Z_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Archive/File_Iso9660.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Iso9660::FileHeader_Begin() { //Element_Size if (Buffer_Size<65536) return false; //Must wait for more data if (CC6(Buffer+32768)!=0x014344303031LL) //"Iso9660...." { Reject("ISO 9660"); return false; } //All should be OK... Accept("ISO 9660"); return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Iso9660::Read_Buffer_Continue() { Skip_XX(32768, "System Area"); Primary_Volume_Descriptor(); FILLING_BEGIN(); Fill(Stream_General, 0, General_Format, "ISO 9660"); Finish("ISO 9660"); FILLING_END(); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Iso9660::Primary_Volume_Descriptor() { int32u Volume_Space_Size; Element_Begin1("Volume_Descriptor"); Skip_B1("Volume Descriptor Type"); Skip_Local(5,"Standard Identifier"); Skip_B1("Volume Descriptor Version"); Skip_B1("Unused field"); Skip_Local(32,"System Identifier"); Skip_Local(32,"Volume Identifier"); Skip_XX(8,"Unused field"); Get_D4(Volume_Space_Size, "Volume Space Size"); Param_Info2(Volume_Space_Size*(int64u)2048, " bytes"); Skip_XX(32,"Unused field"); Skip_B4("Volume Set Size"); Skip_B4("Volume Sequence Number"); Skip_B4("Logical Block Size"); Skip_B8("Path Table Size"); Skip_B4("Location of Occurrence of Type L Path Table"); Skip_B4("Location of Optional Occurrence of Type L Path Table"); Skip_B4("Location of Occurrence of Type M Path Table"); Skip_B4("Location of Optional Occurrence of Type M Path Table"); Skip_Local(34,"Directory Record for Root Directory"); Skip_Local(128,"Volume Set Identifier"); Skip_Local(128,"Publisher Identifier"); Skip_Local(128,"Data Preparer Identifier"); Skip_Local(128,"Application Identifier"); Skip_Local(37,"Copyright File Identifier"); Skip_Local(37,"Abstract File Identifier"); Skip_Local(37,"Bibliographic File Identifier"); Skip_XX(17,"Volume Creation Date and Time"); Element_End0(); } } //NameSpace #endif //MEDIAINFO_7Z_YES MediaInfoLib/Source/MediaInfo/Archive/File_Iso9660.h100777 0 0 2450 12262557530 15332 0/* 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 Iso9660 files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_Iso9660H #define MediaInfo_File_Iso9660H //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Iso9660 //*************************************************************************** class File_Iso9660 : public File__Analyze { protected : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Continue (); //Elements void Primary_Volume_Descriptor(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Archive/File_Mz.cpp100777 0 0 15504 12226004262 15205 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MZ_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Archive/File_Mz.h" #include "ZenLib/Utils.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* Mz_Machine(int16u Machine) { switch (Machine) { case 0x014D : return "Intel i860"; case 0x014C : return "Intel i386"; case 0x0162 : return "MIPS R3000"; case 0x0166 : return "MIPS R4000"; case 0x0183 : return "DEC Alpha"; case 0x0200 : return "Intel IA64"; case 0x8664 : return "AMD x86-64"; default : return ""; } } //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_Mz::FileHeader_Begin() { //Element_Size if (Buffer_Size<2) return false; //Must wait for more data if (CC2(Buffer)!=0x4D5A) //"MZ" { Reject("MZ"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Mz::Read_Buffer_Continue() { //Parsing int32u lfanew; Element_Begin1("MZ"); Skip_C2( "magic"); Skip_L2( "cblp"); Skip_L2( "cp"); Skip_L2( "crlc"); Skip_L2( "cparhdr"); Skip_L2( "minalloc"); Skip_L2( "maxalloc"); Skip_L2( "ss"); Skip_L2( "sp"); Skip_L2( "csum"); Skip_L2( "ip"); Skip_L2( "cs"); Skip_L2( "lsarlc"); Skip_L2( "ovno"); Skip_L2( "res"); Skip_L2( "res"); Skip_L2( "res"); Skip_L2( "res"); Skip_L2( "oemid"); Skip_L2( "oeminfo"); Skip_L2( "res2"); Skip_L2( "res2"); Skip_L2( "res2"); Skip_L2( "res2"); Skip_L2( "res2"); Skip_L2( "res2"); Skip_L2( "res2"); Skip_L2( "res2"); Skip_L2( "res2"); Skip_L2( "res2"); Get_L4 (lfanew, "lfanew"); //Computing if (lfanew>Element_Offset) { Skip_XX(lfanew-Element_Offset, "MZ data"); Element_End0(); } if (Element_Offset>lfanew) { Element_End0(); Element_Offset=lfanew; //Multi usage off the first bytes } //Parsing int32u Signature, TimeDateStamp=0; int16u Machine=0, Characteristics=0; Peek_B4(Signature); if (Signature==0x50450000) //"PE" { Element_Begin1("PE"); Skip_C4( "Header"); Get_L2 (Machine, "Machine"); Param_Info1(Mz_Machine(Machine)); Skip_L2( "NumberOfSections"); Get_L4 (TimeDateStamp, "TimeDateStamp"); Param_Info1(Ztring().Date_From_Seconds_1970(TimeDateStamp)); Skip_L4( "PointerToSymbolTable"); Skip_L4( "NumberOfSymbols"); Skip_L2( "SizeOfOptionalHeader"); Get_L2 (Characteristics, "Characteristics"); Element_End0(); } FILLING_BEGIN(); Accept("MZ"); Fill(Stream_General, 0, General_Format, "MZ"); if (Characteristics&0x2000) Fill(Stream_General, 0, General_Format_Profile, "DLL"); else if (Characteristics&0x0002) Fill(Stream_General, 0, General_Format_Profile, "Executable"); Fill(Stream_General, 0, General_Format_Profile, Mz_Machine(Machine)); if (TimeDateStamp) Fill(Stream_General, 0, General_Encoded_Date, Ztring().Date_From_Seconds_1970(TimeDateStamp)); //No more need data Finish("MZ"); FILLING_END(); } } //NameSpace #endif //MEDIAINFO_MZ_YES MediaInfoLib/Source/MediaInfo/Archive/File_Mz.h100777 0 0 2326 12226004262 14630 0/* 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 MZ files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_MzH #define MediaInfo_File_MzH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Mz //*************************************************************************** class File_Mz : public File__Analyze { protected : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Archive/File_Rar.cpp100777 0 0 31050 12226004262 15335 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_RAR_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Archive/File_Rar.h" #include "ZenLib/Utils.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* Rar_host_os[6]= { "MS DOS", "OS/2", "Win32", "Unix", "Mac OS", "BeOS" }; //--------------------------------------------------------------------------- const char* Rar_packing_method[6]= { "storing", "fastest compression", "fast compression", "normal compression", "good compression", "best compression" }; //--------------------------------------------------------------------------- const char* Rar_HEADER_TYPE(int8u HEADER_TYPE) { switch(HEADER_TYPE) { case 0x72 : return "marker block"; case 0x73 : return "archive header"; case 0x74 : return "file header"; case 0x75 : return "old style comment header"; case 0x76 : return "old style authenticity information"; case 0x77 : return "old style subblock"; case 0x78 : return "old style recovery record"; case 0x79 : return "old style authenticity informatio"; case 0x7A : return "subblock"; case 0x7B : return "end of file"; default : return ""; } }; //--------------------------------------------------------------------------- Ztring Rar_version_number(int8u byte) { //Version number is encoded as 10 * Major version + minor version. return Ztring::ToZtring(byte/10)+Ztring(".")+Ztring::ToZtring(byte%10); } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Rar::File_Rar() :File__Analyze() { //Configuration DataMustAlwaysBeComplete=false; } //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_Rar::FileHeader_Begin() { //Element_Size if (Buffer_Size<7) return false; //Must wait for more data state=0; if (CC7(Buffer)!=0x526172211A0700LL) //"Rar!" { Reject("RAR"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- bool File_Rar::Header_Begin() { if (Element_Offset+7>Element_Size) return false; //Not enough data for header size int16u HEAD_SIZE=LittleEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset+5); if (Element_Offset+HEAD_SIZE>Element_Size) return false; //Not enough data for header return true; } //--------------------------------------------------------------------------- void File_Rar::Header_Parse() { //Config HIGH_PACK_SIZE=0; PACK_SIZE=0; //Parsing int16u HEAD_SIZE; Skip_L2( "HEAD_CRC"); //CRC of total block or block part Get_L1 (HEAD_TYPE, "HEAD_TYPE"); //Block type Get_L2 (HEAD_FLAGS, "HEAD_FLAGS"); Header_Parse_Flags(); Get_L2 (HEAD_SIZE, "HEAD_SIZE"); Header_Parse_Content(); Skip_XX(HEAD_SIZE-(size_t)Element_Offset, "REST OF HEADER"); //Filling Header_Fill_Size(HEAD_SIZE+HIGH_PACK_SIZE*0x100000000LL+PACK_SIZE); Header_Fill_Code(HEAD_TYPE, Rar_HEADER_TYPE(HEAD_TYPE)); } //--------------------------------------------------------------------------- void File_Rar::Header_Parse_Flags() { switch (HEAD_TYPE) { case 0x73 : Header_Parse_Flags_73(); break; case 0x74 : Header_Parse_Flags_74(); break; default : Header_Parse_Flags_XX(); } } //--------------------------------------------------------------------------- // archive header void File_Rar::Header_Parse_Flags_73() { Skip_Flags(HEAD_FLAGS, 1, "Volume attribute (archive volume)"); Skip_Flags(HEAD_FLAGS, 2, "Archive comment present"); Skip_Flags(HEAD_FLAGS, 3, "Archive lock attribute"); Skip_Flags(HEAD_FLAGS, 4, "Solid attribute (solid archive)"); Skip_Flags(HEAD_FLAGS, 5, "New volume naming scheme"); // (\'volname.partN.rar\') Skip_Flags(HEAD_FLAGS, 6, "Authenticity information present"); Skip_Flags(HEAD_FLAGS, 7, "Recovery record present"); Skip_Flags(HEAD_FLAGS, 8, "Block headers are encrypted"); Skip_Flags(HEAD_FLAGS, 9, "First volume (set only by RAR 3.0 and later)"); Get_Flags (HEAD_FLAGS, 15, add_size, "ADD_SIZE present"); } //--------------------------------------------------------------------------- // file header void File_Rar::Header_Parse_Flags_74() { Skip_Flags(HEAD_FLAGS,0, "file continued from previous volume"); Skip_Flags(HEAD_FLAGS,1, "file continued in next volume"); Skip_Flags(HEAD_FLAGS,2, "file encrypted with password"); Skip_Flags(HEAD_FLAGS,3, "file comment present"); Skip_Flags(HEAD_FLAGS,4, "information from previous files is used"); // (solid flag) // bits 7 6 5 (for RAR 2.0 and later) // 0 0 0 - dictionary size 64 KB // 0 0 1 - dictionary size 128 KB // 0 1 0 - dictionary size 256 KB // 0 1 1 - dictionary size 512 KB // 1 0 0 - dictionary size 1024 KB // 1 0 1 - dictionary size 2048 KB // 1 1 0 - dictionary size 4096 KB // 1 1 1 - file is directory Get_Flags (HEAD_FLAGS, 8, high_fields, "HIGH_PACK_SIZE and HIGH_UNP_SIZE fields"); Get_Flags (HEAD_FLAGS, 9, usual_or_utf8, "FILE_NAME contains usual and encoded unicode"); Get_Flags (HEAD_FLAGS, 10, salt, "SALT present"); Skip_Flags(HEAD_FLAGS, 11, "Version flag."); Get_Flags (HEAD_FLAGS, 12, exttime, "Extended time field present"); Get_Flags (HEAD_FLAGS, 15, add_size, "ADD_SIZE present"); } //--------------------------------------------------------------------------- // Generic void File_Rar::Header_Parse_Flags_XX() { Get_Flags (HEAD_FLAGS, 15, add_size, "ADD_SIZE present"); } //--------------------------------------------------------------------------- void File_Rar::Header_Parse_Content() { switch (HEAD_TYPE) { case 0x73 : Header_Parse_Content_73(); break; case 0x74 : Header_Parse_Content_74(); break; default : Header_Parse_Content_XX(); break; } } //--------------------------------------------------------------------------- // archive header void File_Rar::Header_Parse_Content_73() { Skip_L2( "RESERVED_1"); Skip_L4( "RESERVED_2"); } //--------------------------------------------------------------------------- // file header void File_Rar::Header_Parse_Content_74() { int16u name_size; int8u HOST_OS, METHOD, UNP_VER; Get_L4 (PACK_SIZE, "PACK_SIZE"); //Compressed file size Skip_L4( "UNP_SIZE"); //Uncompressed file size Get_L1 (HOST_OS, "HOST_OS"); Param_Info1((HOST_OS<6?Rar_host_os[HOST_OS]:"Unknown")); Skip_L4( "FILE_CRC"); Skip_L4( "FTIME"); //Date and time in standard MS DOS format Get_L1 (UNP_VER, "UNP_VER"); Param_Info1(Rar_version_number(UNP_VER)); //RAR version needed to extract file Get_L1 (METHOD, "METHOD"); Param_Info1(((METHOD>=0x30)&&(METHOD<0x36)?Rar_packing_method[METHOD-0x30]:"Unknown")); Get_L2 (name_size, "NAME_SIZE"); //File name size Skip_L4( "ATTR"); //File attributes if(high_fields) { Get_L4 (HIGH_PACK_SIZE, "HIGH_PACK_SIZE"); //High 4 bytes of 64 bit value of compressed file size. Skip_L4( "HIGH_UNP_SIZE"); //High 4 bytes of 64 bit value of uncompressed file size. } else HIGH_PACK_SIZE=0; if (usual_or_utf8) { //Must test the content before reading, looking fore zero byte if (Element_Offset+name_size>Element_Size) { Skip_XX(Element_Size-Element_Offset, "Error"); return; } int64u ZeroPos=0; while (ZeroPosElement_Size) //signature size return; //Not enough data signature=LittleEndian2int32u(Buffer+(size_t)Element_Offset); } //Parsing switch (signature) { case 0x04034b50 : if (!local_file()) return; //Not enough data break; case 0x02014b50 : if (!central_directory()) return; //Not enough data break; case 0x05054b50 : if (!digital_signature()) return; //Not enough data break; case 0x06054b50 : if (!end_of_central_directory()) return; //Not enough data break; case 0x08064b50 : if(!archive_extra_data_record()) return; break; case 0x06064b50 : if(!Zip64_end_of_central_directory_record()) return; break; case 0x07064b50 : if(!Zip64_end_of_central_directory_locator()) return; break; default: Finish(); return; //Reject(); return; //Unknown value //Décommenter quand toutes les signatures sont implémentées } //Cleanup signature=0x00000000; //Reset, must probe again the signature (next element) } } //*************************************************************************** // Files //*************************************************************************** bool File_Zip::local_file() { switch(local_file_Step) { case 0 : if (!local_file_header()) return false; local_file_Step=1; //local_file_header parsed case 1 : local_file_Step=2; //file_data is always parsed if (!file_data()) return false; case 2 : if (!data_descriptor()) return false; local_file_Step=0; //data_descriptor is parsed, back to begin default : ; //Should never happen } return true; } bool File_Zip::archive_extra_data_record() { if (Element_Offset+8>Element_Size) //archive_extra_data_record return false; //Not enough data //Retrieving complete archive_extra_data_record size int32u extra_field_length=LittleEndian2int32u(Buffer+(size_t)Element_Offset+4); //Parsing Element_Begin1("archive_extra_data_record"); Skip_C4("Archive extra data signature"); Skip_L4("extra field length"); Skip_XX(extra_field_length,"extra_field_data"); Element_End0(); return true; } bool File_Zip::digital_signature() { if (Element_Offset+6>Element_Size) //digital_signature return false; //Not enough data //Retrieving complete archive_extra_data_record size int16u size_of_data=LittleEndian2int16u(Buffer+(size_t)Element_Offset+4); //Parsing Element_Begin1("digital_signature"); Skip_C4("Header signature"); Skip_L2("size of data"); Skip_XX(size_of_data,"signature data"); Element_End0(); return true; } bool File_Zip::local_file_header() { if (Element_Offset+30>Element_Size) //local_file_header up to extra_field_length included return false; //Not enough data //Retrieving complete local_file_header size int16u file_name_length=LittleEndian2int16u(Buffer+(size_t)Element_Offset+26); int16u extra_field_length=LittleEndian2int16u(Buffer+(size_t)Element_Offset+28); if (Element_Offset+30+file_name_length+extra_field_length>Element_Size) //local_file_header all included return false; //Not enough data //Parsing Element_Begin1("local_file_header"); int16u general_purpose_bit_flag,compression_method; bool efs; Skip_C4("Local file header signature"); Skip_L2("Version needed to extract"); Get_L2 (general_purpose_bit_flag,"general purpose bit flag"); Skip_Flags(general_purpose_bit_flag, 0, "encrypted file"); Skip_Flags(general_purpose_bit_flag, 1, "8K sliding dictionary"); Skip_Flags(general_purpose_bit_flag, 2, "3 Shannon-Fano trees"); Get_Flags (general_purpose_bit_flag, 3, data_descriptor_set, "data descriptor"); Skip_Flags(general_purpose_bit_flag, 4, "Reserved for use with method 8"); Skip_Flags(general_purpose_bit_flag, 4, "file is compressed patched data"); Skip_Flags(general_purpose_bit_flag, 4, "Strong encryption"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Currently unused"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Currently unused"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Currently unused"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Currently unused"); Get_Flags (general_purpose_bit_flag, 11, efs, "Language encoding flag (EFS)"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Reserved by PKWARE for enhanced compression"); //~ Skip_Flags(general_purpose_bit_flag, 4, ""); //~ Skip_Flags(general_purpose_bit_flag, 4, "Reserved by PKWARE"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Reserved by PKWARE"); Get_L2 (compression_method,"compression method"); Param_Info1C((compression_method<20), Zip_compression_method[compression_method]); Param_Info1C((compression_method==97||compression_method==98), Zip_compression_method[compression_method-97+20]); Skip_L2("last mod file time"); Skip_L2("last mod file date"); Skip_L4("crc-32"); Get_L4(compressed_size,"compressed size"); Skip_L4("uncompressed size"); Get_L2(file_name_length,"file name lenth"); Get_L2(extra_field_length,"extra field length"); if(efs) { Skip_UTF8(file_name_length,"file name"); Skip_UTF8(extra_field_length,"extra field"); } else { Skip_Local(file_name_length,"file name"); Skip_Local(extra_field_length,"extra field"); } Element_End0(); FILLING_BEGIN(); Accept("Zip"); Fill(Stream_General, 0, General_Format, "ZIP"); FILLING_END(); return true; } bool File_Zip::file_data() { Element_Begin1("file_data"); Skip_XX(compressed_size,"File_data"); Element_End0(); if (Element_Offset>Element_Size) { GoTo(File_Offset+Element_Offset); return false; } return true; } bool File_Zip::data_descriptor() { if(data_descriptor_set) { if (Element_Offset+12>Element_Size) return false; //Not enough data Element_Begin1("data_descriptor"); Skip_L4("crc-32"); Skip_L4("compressed size"); Skip_L4("uncompressed size"); Element_End0(); } return true; } bool File_Zip::central_directory() { if (Element_Offset+46>Element_Size) //central_directory up to relative offset of local header included return false; //Not enough data //Retrieving complete local_file_header size int16u file_name_length=LittleEndian2int16u(Buffer+(size_t)Element_Offset+28); int16u extra_field_length=LittleEndian2int16u(Buffer+(size_t)Element_Offset+30); int16u file_comment_length=LittleEndian2int16u(Buffer+(size_t)Element_Offset+32); if (Element_Offset+46+file_name_length+extra_field_length+file_comment_length>Element_Size) //central_directory_structure all included return false; //Not enough data int16u general_purpose_bit_flag; bool efs; int16u version_made_by,compression_method; //Parsing Element_Begin1("Central directory"); Skip_C4("central file header signature"); Get_L2 (version_made_by,"version made by");Param_Info1((version_made_by>>8)>20?"unused":Zip_made_by[version_made_by>>8]); Skip_L2("version needed to extract"); Get_L2 (general_purpose_bit_flag,"general purpose bit flag"); Skip_Flags(general_purpose_bit_flag, 0, "encrypted file"); Skip_Flags(general_purpose_bit_flag, 1, "8K sliding dictionary"); Skip_Flags(general_purpose_bit_flag, 2, "3 Shannon-Fano trees"); Skip_Flags(general_purpose_bit_flag, 3, "data descriptor"); Skip_Flags(general_purpose_bit_flag, 4, "Reserved for use with method 8"); Skip_Flags(general_purpose_bit_flag, 4, "file is compressed patched data"); Skip_Flags(general_purpose_bit_flag, 4, "Strong encryption"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Currently unused"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Currently unused"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Currently unused"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Currently unused"); Get_Flags (general_purpose_bit_flag, 11, efs, "Language encoding flag (EFS)"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Reserved by PKWARE for enhanced compression"); //~ Skip_Flags(general_purpose_bit_flag, 4, ""); //~ Skip_Flags(general_purpose_bit_flag, 4, "Reserved by PKWARE"); //~ Skip_Flags(general_purpose_bit_flag, 4, "Reserved by PKWARE"); Get_L2 (compression_method,"compression method"); Param_Info1C((compression_method<20), Zip_compression_method[compression_method]); Param_Info1C((compression_method==97||compression_method==98), Zip_compression_method[compression_method-97+20]); Skip_L2("last mod file time"); Skip_L2("last mod file date"); Skip_L4("crc-32"); Skip_L4("compressed size"); Skip_L4("uncompressed size"); Skip_L2("file name length"); Skip_L2("extra field length"); Skip_L2("file comment length"); Skip_L2("disk number start"); Skip_L2("internal file attributes"); Skip_L4("external file attributes"); Skip_L4("relative offset of local header"); if(efs) { Skip_UTF8(file_name_length,"file name"); Skip_UTF8(extra_field_length,"extra field"); Skip_UTF8(file_comment_length,"file comment"); } else { Skip_Local(file_name_length,"file name"); Skip_Local(extra_field_length,"extra field"); Skip_Local(file_comment_length,"file comment"); } Element_End0(); return true; } bool File_Zip::end_of_central_directory() { if (Element_Offset+22>Element_Size) //end_of_central_directory up to relative offset of .ZIP file comment length included return false; //Not enough data //Retrieving complete local_file_header size int16u zip_comment_length=LittleEndian2int16u(Buffer+(size_t)Element_Offset+20); if (Element_Offset+22+zip_comment_length>Element_Size) //end_of_central_directory all included return false; //Not enough data //Parsing int32u offset; Element_Begin1("End of central directory"); Skip_C4( "end of central dir signature"); Skip_L2( "number of this disk"); Skip_L2( "number of the disk");// with the start of the central directory Skip_L2( "total number of entries on this disk");// in the central directory Skip_L2( "total number of entries");// in the central directory Skip_L4( "size of the central directory"); Get_L4 (offset, "offset of start of central directory");// with respect to the starting disk number Skip_L2( "zip file comment length"); Skip_XX(zip_comment_length, "zip file comment"); Element_End0(); //Going to first central directory (once) if (!end_of_central_directory_IsParsed) { end_of_central_directory_IsParsed=true; GoTo(offset); } return true; } bool File_Zip::Zip64_end_of_central_directory_record() { if (Element_Offset+12>Element_Size) //Zip64_end_of_central_directory_record return false; //Not enough data //Retrieving complete Zip64_end_of_central_directory_record size int64u size_of_Zip64_end_of_central_directory_record=LittleEndian2int64u(Buffer+(size_t)Element_Offset+4); if (Element_Offset+12+size_of_Zip64_end_of_central_directory_record>Element_Size) //end_of_central_directory all included return false; //Not enough data //Parsing //~ int32u offset; int16u version_made_by; Element_Begin1("Zip64 End of central directory record"); Skip_C4( "Zip64 end of central dir signature"); Skip_L8( "size of zip64 end of central directory record"); Get_L2 (version_made_by, "version made by"); Param_Info1((version_made_by>>8)>20?"unused":Zip_made_by[version_made_by>>8]); Skip_L2( "version needed to extract"); Skip_L4( "number of this disk"); Skip_L4( "number of the disk");// with the start of the central directory Skip_L8( "total number of entries on this disk");// in the central directory Skip_L8( "total number of entries");// in the central directory Skip_L8( "size of the central directory"); Skip_L8( "offset of start of central directory"); // with respect to the starting disk number Skip_XX(size_of_Zip64_end_of_central_directory_record-44, "zip64 extensible data sector"); Element_End0(); return true; } bool File_Zip::Zip64_end_of_central_directory_locator() { if (Element_Offset+20>Element_Size) //Zip64_end_of_central_directory_locator return false; //Not enough data //Parsing Element_Begin1("Zip64 end of central directory locator"); Skip_C4("zip64 end of central dir locator signature"); Skip_L4("number of the disk");// with the start of the zip64 end of central directory Skip_L8("relative offset of the zip64 end of central directory record"); Skip_L4("total number of disks"); Element_End0(); return true; } } //NameSpace #endif //MEDIAINFO_ZIP_YES MediaInfoLib/Source/MediaInfo/Archive/File_Zip.h100777 0 0 3336 12226004262 15006 0/* 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 ZIP files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_ZipH #define MediaInfo_File_ZipH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Zip //*************************************************************************** class File_Zip : public File__Analyze { protected : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Continue (); int32u compressed_size; bool data_descriptor_set; int32u signature; int8u local_file_Step; bool end_of_central_directory_IsParsed; bool local_file(); bool local_file_header(); bool file_data(); bool data_descriptor(); bool archive_extra_data_record(); bool central_directory(); bool digital_signature(); bool end_of_central_directory(); bool Zip64_end_of_central_directory_record(); bool Zip64_end_of_central_directory_locator(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/ 40777 0 0 0 12263504465 12522 5MediaInfoLib/Source/MediaInfo/Audio/File_Aac.cpp100777 0 0 61455 12262743712 15003 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AAC_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Aac.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Aac::File_Aac() :File__Analyze(), File__Tags_Helper() { //File__Tags_Helper Base=this; //Configuration MustSynchronize=true; Buffer_TotalBytes_FirstSynched_Max=64*1024; PTS_DTS_Needed=true; IsRawStream=true; //In Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.5?128:(MediaInfoLib::Config.ParseSpeed_Get()>=0.3?32:8); FrameIsAlwaysComplete=false; Mode=Mode_Unknown; audioObjectType=(int8u)-1; extensionAudioObjectType=(int8u)-1; channelConfiguration=(int8u)-1; frame_length=1024; sampling_frequency_index=(int8u)-1; sampling_frequency=(int32u)-1; extension_sampling_frequency_index=(int8u)-1; extension_sampling_frequency=(int32u)-1; aacSpectralDataResilienceFlag=false; aacSectionDataResilienceFlag=false; aacScalefactorDataResilienceFlag=false; FrameSize_Min=(int64u)-1; FrameSize_Max=0; //Temp - Main muxConfigPresent=true; audioMuxVersionA=false; //Temp - General Audio sbr=NULL; ps=NULL; //Temp CanFill=true; } //--------------------------------------------------------------------------- File_Aac::~File_Aac() { delete sbr; delete ps; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Aac::Streams_Fill() { switch(Mode) { case Mode_LATM : Fill(Stream_General, 0, General_Format, "LATM"); if (IsSub) Fill(Stream_Audio, 0, Audio_MuxingMode, "LATM"); break; default : ; } for (std::map::iterator Info=Infos_General.begin(); Info!=Infos_General.end(); ++Info) Fill(Stream_General, 0, Info->first.c_str(), Info->second); File__Tags_Helper::Stream_Prepare(Stream_Audio); for (std::map::iterator Info=Infos.begin(); Info!=Infos.end(); ++Info) Fill(Stream_Audio, StreamPos_Last, Info->first.c_str(), Info->second); switch(Mode) { case Mode_ADTS : File__Tags_Helper::Streams_Fill(); break; default : ; } } //--------------------------------------------------------------------------- void File_Aac::Streams_Update() { bool ComputeBitRate=false; switch(Mode) { #if MEDIAINFO_ADVANCED case Mode_LATM : if (Config->File_RiskyBitRateEstimation_Get()) ComputeBitRate=true; break; #endif //MEDIAINFO_ADVANCED default : ; } if (ComputeBitRate) { int64u aac_frame_length_Total=0; for (size_t Pos=0; PosFrameSize_Min*1.02) { Fill(Stream_Audio, 0, Audio_BitRate_Mode, "VBR", Unlimited, true, true); if (Config->ParseSpeed>=1.0) { Fill(Stream_Audio, 0, Audio_BitRate_Minimum, ((float64)FrameSize_Min)/1024*48000*8, 0); Fill(Stream_Audio, 0, Audio_BitRate_Maximum, ((float64)FrameSize_Max)/1024*48000*8, 0); } } else if (Config->ParseSpeed>=1.0) { Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR"); } } } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Aac::FileHeader_Begin() { switch(Mode) { case Mode_AudioSpecificConfig : case Mode_ADIF : MustSynchronize=false; break; default : ; //Synchronization is requested, and this is the default } switch(Mode) { case Mode_Unknown : case Mode_ADIF : case Mode_ADTS : break; default : return true; //no file header test with other modes } //Tags if (!File__Tags_Helper::FileHeader_Begin()) return false; //Testing if (Buffer_Offset+4>Buffer_Size) return false; if (CC4(Buffer+Buffer_Offset)==0x41444946) //"ADIF" { Mode=Mode_ADIF; File__Tags_Helper::Accept("ADIF"); MustSynchronize=false; } return true; } //--------------------------------------------------------------------------- void File_Aac::FileHeader_Parse() { switch (Mode) { case Mode_ADIF : FileHeader_Parse_ADIF(); break; default : ; //no file header test with other modes } } //--------------------------------------------------------------------------- void File_Aac::FileHeader_Parse_ADIF() { adif_header(); BS_Begin(); raw_data_block(); BS_End(); FILLING_BEGIN(); File__Tags_Helper::Finish(); FILLING_END(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Aac::Read_Buffer_Continue() { if (Element_Size==0) return; if (Frame_Count==0) PTS_Begin=FrameInfo.PTS; switch(Mode) { case Mode_AudioSpecificConfig : Read_Buffer_Continue_AudioSpecificConfig(); break; case Mode_raw_data_block : Read_Buffer_Continue_raw_data_block(); break; case Mode_ADIF : case Mode_ADTS : File__Tags_Helper::Read_Buffer_Continue(); break; default : ; } } //--------------------------------------------------------------------------- void File_Aac::Read_Buffer_Continue_AudioSpecificConfig() { File__Analyze::Accept(); //We automaticly trust it BS_Begin(); AudioSpecificConfig(0); //Up to the end of the block BS_End(); Mode=Mode_raw_data_block; //Mode_AudioSpecificConfig only once } //--------------------------------------------------------------------------- void File_Aac::Read_Buffer_Continue_raw_data_block() { if (Frame_Count>Frame_Count_Valid) { Skip_XX(Element_Size, "Data"); return; //Parsing completely only the 1st frame } BS_Begin(); raw_data_block(); BS_End(); if (FrameIsAlwaysComplete && Element_Offset=Frame_Count_Valid) { //No more need data if (Mode==Mode_LATM) File__Analyze::Accept(); File__Analyze::Finish(); } FILLING_END(); } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Aac::Synchronize() { switch (Mode) { case Mode_Unknown : if (Synchronize_LATM()) return true; Buffer_Offset=0; return Synchronize_ADTS(); case Mode_ADTS : return Synchronize_ADTS(); case Mode_LATM : return Synchronize_LATM(); default : return true; //No synchro } } //--------------------------------------------------------------------------- bool File_Aac::Synchronize_ADTS() { //Tags bool Tag_Found; if (!File__Tags_Helper::Synchronize(Tag_Found)) return false; if (Tag_Found) return true; //Synchronizing while (Buffer_Offset+6<=Buffer_Size) { while (Buffer_Offset+6<=Buffer_Size && (Buffer[Buffer_Offset ]!=0xFF || (Buffer[Buffer_Offset+1]&0xF6)!=0xF0)) Buffer_Offset++; if (Buffer_Offset+6<=Buffer_Size)//Testing if size is coherant { //Testing next start, to be sure int16u aac_frame_length=(CC3(Buffer+Buffer_Offset+3)>>5)&0x1FFF; if (IsSub && Buffer_Offset+aac_frame_length==Buffer_Size) break; if (File_Offset+Buffer_Offset+aac_frame_length!=File_Size-File_EndTagSize) { //Padding while (Buffer_Offset+aac_frame_length+2<=Buffer_Size && Buffer[Buffer_Offset+aac_frame_length]==0x00) aac_frame_length++; if (Buffer_Offset+aac_frame_length+2>Buffer_Size) return false; //Need more data //Testing if (aac_frame_length<=7 || (CC2(Buffer+Buffer_Offset+aac_frame_length)&0xFFF6)!=0xFFF0) Buffer_Offset++; else { //Testing next start, to be sure int16u aac_frame_length2=(CC3(Buffer+Buffer_Offset+aac_frame_length+3)>>5)&0x1FFF; if (File_Offset+Buffer_Offset+aac_frame_length+aac_frame_length2!=File_Size-File_EndTagSize) { //Padding while (Buffer_Offset+aac_frame_length+aac_frame_length2+2<=Buffer_Size && Buffer[Buffer_Offset+aac_frame_length+aac_frame_length2]==0x00) aac_frame_length2++; if (Buffer_Offset+aac_frame_length+aac_frame_length2+2>Buffer_Size) return false; //Need more data //Testing if (aac_frame_length2<=7 || (CC2(Buffer+Buffer_Offset+aac_frame_length+aac_frame_length2)&0xFFF6)!=0xFFF0) Buffer_Offset++; else { //Testing next start, to be sure int16u aac_frame_length3=(CC3(Buffer+Buffer_Offset+aac_frame_length+aac_frame_length2+3)>>5)&0x1FFF; if (File_Offset+Buffer_Offset+aac_frame_length+aac_frame_length2+aac_frame_length3!=File_Size-File_EndTagSize) { //Padding while (Buffer_Offset+aac_frame_length+aac_frame_length2+aac_frame_length3+2<=Buffer_Size && Buffer[Buffer_Offset+aac_frame_length+aac_frame_length2+aac_frame_length3]==0x00) aac_frame_length3++; if (Buffer_Offset+aac_frame_length+aac_frame_length2+aac_frame_length3+2>Buffer_Size) return false; //Need more data //Testing if (aac_frame_length3<=7 || (CC2(Buffer+Buffer_Offset+aac_frame_length+aac_frame_length2+aac_frame_length3)&0xFFF6)!=0xFFF0) Buffer_Offset++; else break; //while() } else break; //while() } } else break; //while() } } else break; //while() } } //Parsing last bytes if needed if (Buffer_Offset+6>Buffer_Size) { if (Buffer_Offset+5==Buffer_Size && (CC2(Buffer+Buffer_Offset)&0xFFF6)!=0xFFF0) Buffer_Offset++; if (Buffer_Offset+4==Buffer_Size && (CC2(Buffer+Buffer_Offset)&0xFFF6)!=0xFFF0) Buffer_Offset++; if (Buffer_Offset+3==Buffer_Size && (CC2(Buffer+Buffer_Offset)&0xFFF6)!=0xFFF0) Buffer_Offset++; if (Buffer_Offset+2==Buffer_Size && (CC2(Buffer+Buffer_Offset)&0xFFF6)!=0xFFF0) Buffer_Offset++; if (Buffer_Offset+1==Buffer_Size && CC1(Buffer+Buffer_Offset)!=0xFF) Buffer_Offset++; return false; } //Synched is OK Mode=Mode_ADTS; return true; } //--------------------------------------------------------------------------- bool File_Aac::Synchronize_LATM() { //Synchronizing while (Buffer_Offset+3<=Buffer_Size) { while (Buffer_Offset+3<=Buffer_Size && (Buffer[Buffer_Offset ]!=0x56 || (Buffer[Buffer_Offset+1]&0xE0)!=0xE0)) Buffer_Offset++; if (Buffer_Offset+3<=Buffer_Size)//Testing if size is coherant { //Testing next start, to be sure int16u audioMuxLengthBytes=CC2(Buffer+Buffer_Offset+1)&0x1FFF; if (IsSub && Buffer_Offset+3+audioMuxLengthBytes==Buffer_Size) break; if (File_Offset+Buffer_Offset+3+audioMuxLengthBytes!=File_Size) { if (Buffer_Offset+3+audioMuxLengthBytes+3>Buffer_Size) return false; //Need more data //Testing if ((CC2(Buffer+Buffer_Offset+3+audioMuxLengthBytes)&0xFFE0)!=0x56E0) Buffer_Offset++; else { //Testing next start, to be sure int16u audioMuxLengthBytes2=CC2(Buffer+Buffer_Offset+3+audioMuxLengthBytes+1)&0x1FFF; if (File_Offset+Buffer_Offset+3+audioMuxLengthBytes+3+audioMuxLengthBytes2!=File_Size) { if (Buffer_Offset+3+audioMuxLengthBytes+3+audioMuxLengthBytes2+3>Buffer_Size) return false; //Need more data //Testing if ((CC2(Buffer+Buffer_Offset+3+audioMuxLengthBytes+3+audioMuxLengthBytes2)&0xFFE0)!=0x56E0) Buffer_Offset++; else break; //while() } else break; //while() } } else break; //while() } } //Synchronizing while (Buffer_Offset+2<=Buffer_Size && (Buffer[Buffer_Offset ]!=0x56 || (Buffer[Buffer_Offset+1]&0xE0)!=0xE0)) Buffer_Offset++; if (Buffer_Offset+2>=Buffer_Size) return false; //Synched is OK Mode=Mode_LATM; return true; } //--------------------------------------------------------------------------- bool File_Aac::Synched_Test() { switch (Mode) { case Mode_ADTS : return Synched_Test_ADTS(); case Mode_LATM : return Synched_Test_LATM(); default : return true; //No synchro } } //--------------------------------------------------------------------------- bool File_Aac::Synched_Test_ADTS() { //Tags if (!File__Tags_Helper::Synched_Test()) return false; //Null padding while (Buffer_Offset+2<=Buffer_Size && Buffer[Buffer_Offset]==0x00) Buffer_Offset++; //Must have enough buffer for having header if (Buffer_Offset+2>Buffer_Size) return false; //Quick test of synchro if ((CC2(Buffer+Buffer_Offset)&0xFFF6)!=0xFFF0) Synched=false; //We continue return true; } //--------------------------------------------------------------------------- bool File_Aac::Synched_Test_LATM() { //Must have enough buffer for having header if (Buffer_Offset+2>Buffer_Size) return false; //Quick test of synchro if ((CC2(Buffer+Buffer_Offset)&0xFFE0)!=0x56E0) Synched=false; //We continue return true; } //*************************************************************************** // Buffer - Demux //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX bool File_Aac::Demux_UnpacketizeContainer_Test() { switch (Mode) { case Mode_ADTS : return Demux_UnpacketizeContainer_Test_ADTS(); case Mode_LATM : return Demux_UnpacketizeContainer_Test_LATM(); default : return true; //No header } } bool File_Aac::Demux_UnpacketizeContainer_Test_ADTS() { int16u aac_frame_length=(BigEndian2int24u(Buffer+Buffer_Offset+3)>>5)&0x1FFF; //13 bits Demux_Offset=Buffer_Offset+aac_frame_length; if (Demux_Offset>Buffer_Size && File_Offset+Buffer_Size!=File_Size) return false; //No complete frame Demux_UnpacketizeContainer_Demux(); return true; } bool File_Aac::Demux_UnpacketizeContainer_Test_LATM() { int16u audioMuxLengthBytes=BigEndian2int16u(Buffer+Buffer_Offset+1)&0x1FFF; //13 bits Demux_Offset=Buffer_Offset+3+audioMuxLengthBytes; if (Demux_Offset>Buffer_Size && File_Offset+Buffer_Size!=File_Size) return false; //No complete frame Demux_UnpacketizeContainer_Demux(); return true; } #endif //MEDIAINFO_DEMUX //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- bool File_Aac::Header_Begin() { switch (Mode) { case Mode_ADTS : return Header_Begin_ADTS(); case Mode_LATM : return Header_Begin_LATM(); default : return true; //No header } } //--------------------------------------------------------------------------- bool File_Aac::Header_Begin_ADTS() { //There is no real header in ADTS, retrieving only the frame length if (Buffer_Offset+8>Buffer_Size) //size of adts_fixed_header + adts_variable_header return false; return true; } //--------------------------------------------------------------------------- bool File_Aac::Header_Begin_LATM() { if (Buffer_Offset+3>Buffer_Size) //fixed 24-bit header return false; return true; } //--------------------------------------------------------------------------- void File_Aac::Header_Parse() { switch (Mode) { case Mode_ADTS : Header_Parse_ADTS(); break; case Mode_LATM : Header_Parse_LATM(); break; default : ; //No header } } //--------------------------------------------------------------------------- void File_Aac::Header_Parse_ADTS() { //There is no "header" in ADTS, retrieving only the frame length int16u aac_frame_length=(BigEndian2int24u(Buffer+Buffer_Offset+3)>>5)&0x1FFF; //13 bits //Filling Header_Fill_Size(aac_frame_length); Header_Fill_Code(0, "adts_frame"); } //--------------------------------------------------------------------------- void File_Aac::Header_Parse_LATM() { int16u audioMuxLengthBytes; BS_Begin(); Skip_S2(11, "syncword"); Get_S2 (13, audioMuxLengthBytes, "audioMuxLengthBytes"); BS_End(); //Filling Header_Fill_Size(3+audioMuxLengthBytes); Header_Fill_Code(0, "LATM"); } //--------------------------------------------------------------------------- void File_Aac::Data_Parse() { if (FrameSize_Min>Header_Size+Element_Size) FrameSize_Min=Header_Size+Element_Size; if (FrameSize_MaxFrame_Count_Valid) { Skip_XX(Element_Size, "Data"); FrameInfo.DTS+=float64_int64s(((float64)frame_length)*1000000000/sampling_frequency); FrameInfo.PTS=FrameInfo.DTS; return; //Parsing completely only the 1st frame } switch (Mode) { case Mode_ADTS : Data_Parse_ADTS(); break; case Mode_LATM : Data_Parse_LATM(); break; default : ; //No header } FILLING_BEGIN(); //Counting if (File_Offset+Buffer_Offset+Element_Size==File_Size) Frame_Count_Valid=Frame_Count; //Finish frames in case of there are less than Frame_Count_Valid frames if (CanFill) { Frame_Count++; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; Element_Info1(Ztring::ToZtring(Frame_Count)); } if (!Status[IsAccepted]) File__Analyze::Accept(); //Filling if (Frame_Count>=Frame_Count_Valid && Config->ParseSpeed<1.0) { //No more need data switch (Mode) { case Mode_ADTS : case Mode_LATM : if (!Status[IsFilled]) { Fill(); if (!IsSub) File__Tags_Helper::Finish(); } break; default : ; //No header } } FILLING_END(); } //--------------------------------------------------------------------------- void File_Aac::Data_Parse_ADTS() { //Parsing BS_Begin(); adts_frame(); BS_End(); } //--------------------------------------------------------------------------- void File_Aac::Data_Parse_LATM() { BS_Begin(); AudioMuxElement(); BS_End(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_AAC_YES MediaInfoLib/Source/MediaInfo/Audio/File_Aac.h100777 0 0 31373 12226004262 14432 0/* 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 AAC files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_AacH #define MediaInfo_File_AacH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #ifdef MEDIAINFO_MPEG4_YES #include "MediaInfo/Multiple/File_Mpeg4_Descriptors.h" #endif #include "MediaInfo/Tag/File__Tags.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Aac //*************************************************************************** struct sbr_handler { //sbr_header int8u bs_amp_res[2]; int8u bs_amp_res_FromHeader; int8u bs_start_freq; int8u bs_stop_freq; int8u bs_xover_band; int8u bs_freq_scale; int8u bs_alter_scale; int8u bs_noise_bands; //sbr_grid int8u bs_num_env[2]; bool bs_freq_res[2][8]; int8u bs_num_noise[2]; //sbr_dtdf int8u bs_df_env[2][4]; int8u bs_df_noise[2][2]; //Computed values int8u num_noise_bands; int8u num_env_bands[2]; }; struct ps_handler { bool enable_iid; bool enable_icc; bool enable_ext; int8u iid_mode; int8u icc_mode; }; typedef const int8s (*sbr_huffman)[2]; class File_Aac : public File__Analyze, public File__Tags_Helper { public : //In int64u Frame_Count_Valid; bool FrameIsAlwaysComplete; enum mode { Mode_Unknown, Mode_AudioSpecificConfig, Mode_raw_data_block, Mode_ADIF, Mode_ADTS, Mode_LATM, }; mode Mode; void AudioSpecificConfig_OutOfBand(int32u sampling_frequency, int8u audioObjectType=(int8u)-1, bool sbrData=false, bool psData=false, bool sbrPresentFlag=false, bool psPresentFlag=false); //Constructor/Destructor File_Aac(); ~File_Aac(); protected : //Streams management void Streams_Fill(); void Streams_Update(); void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse(); void FileHeader_Parse_ADIF(); //Buffer - Global void Read_Buffer_Continue (); void Read_Buffer_Continue_AudioSpecificConfig(); void Read_Buffer_Continue_raw_data_block(); //Buffer - Synchro bool Synchronize(); bool Synchronize_ADTS(); bool Synchronize_LATM(); bool Synched_Test(); bool Synched_Test_ADTS(); bool Synched_Test_LATM(); //Buffer - Demux #if MEDIAINFO_DEMUX bool Demux_UnpacketizeContainer_Test(); bool Demux_UnpacketizeContainer_Test_ADTS(); bool Demux_UnpacketizeContainer_Test_LATM(); #endif //MEDIAINFO_DEMUX //Buffer - Per element bool Header_Begin(); bool Header_Begin_ADTS(); bool Header_Begin_LATM(); void Header_Parse(); void Header_Parse_ADTS(); void Header_Parse_LATM(); void Data_Parse(); void Data_Parse_ADTS(); void Data_Parse_LATM(); //*********************************************************************** // Elements - Main //*********************************************************************** //Elements - Interface to MPEG-4 container void AudioSpecificConfig (size_t End=(size_t)-1); void GetAudioObjectType (int8u &ObjectType, const char* Name); //Elements - Multiplex layer void EPMuxElement (); void AudioMuxElement (); void StreamMuxConfig (); int32u LatmGetValue (); void PayloadLengthInfo (); void PayloadMux (); bool muxConfigPresent; //Elements - Error protection void ErrorProtectionSpecificConfig (); //Elements - MPEG-2 AAC Audio_Data_Interchange_Format, ADIF void adif_header (); //Elements - Audio_Data_Transport_Stream frame, ADTS void adts_frame (); void adts_fixed_header (); void adts_variable_header (); //Temp int8u numSubFrames; int8u numProgram; int8u numLayer; int8u numChunk; bool audioMuxVersionA; int8u streamID[16][8]; int8u progSIndx[128]; int8u laySIndx[128]; int8u progCIndx[128]; int8u layCIndx[128]; int8u frameLengthType[128]; int16u frameLength[128]; int32u MuxSlotLengthBytes[128]; int32u otherDataLenBits; bool otherDataPresent; bool allStreamsSameTimeFraming; int8u audioObjectType; int8u extensionAudioObjectType; int8u channelConfiguration; int16u frame_length; int8u sampling_frequency_index; int32u sampling_frequency; int8u extension_sampling_frequency_index; int32u extension_sampling_frequency; bool aacScalefactorDataResilienceFlag; bool aacSectionDataResilienceFlag; bool aacSpectralDataResilienceFlag; std::vector aac_frame_lengths; int8u num_raw_data_blocks; bool protection_absent; int64u FrameSize_Min; int64u FrameSize_Max; //*********************************************************************** // Elements - Speech coding (HVXC) //*********************************************************************** void HvxcSpecificConfig (); void HVXCconfig (); void ErrorResilientHvxcSpecificConfig (); void ErHVXCconfig (); //*********************************************************************** // Elements - Speech Coding (CELP) //*********************************************************************** void CelpSpecificConfig (); void CelpHeader (); void ErrorResilientCelpSpecificConfig (); void ER_SC_CelpHeader (); //*********************************************************************** // Elements - General Audio (GA) //*********************************************************************** //Elements - Decoder configuration void GASpecificConfig (); void program_config_element (); //Elements - GA bitstream void raw_data_block (); void single_channel_element (); void channel_pair_element (); void ics_info (); void pulse_data (); void coupling_channel_element (); void lfe_channel_element (); void data_stream_element (); void fill_element (int8u old_id); void gain_control_data (); //Elements - Subsidiary void individual_channel_stream (bool common_window, bool scale_flag); void section_data (); void scale_factor_data (); void tns_data (); void ltp_data (); void spectral_data (); void extension_payload (size_t End, int8u id_aac); void dynamic_range_info (); void sac_extension_data (size_t End); //Elements - SBR void sbr_extension_data (size_t End, int8u id_aac, bool crc_flag); void sbr_header (); void sbr_data (int8u id_aac); void sbr_single_channel_element (); void sbr_channel_pair_element (); void sbr_grid (bool ch); void sbr_dtdf (bool ch); void sbr_invf (bool ch); void sbr_envelope (bool ch, bool bs_coupling); void sbr_noise (bool ch, bool bs_coupling); void sbr_sinusoidal_coding (bool ch); int16u sbr_huff_dec (sbr_huffman Table, const char* Name); //Elements - SBR - PS void ps_data (size_t End); //Elements - Perceptual noise substitution (PNS) bool is_noise (size_t group, size_t sfb); int is_intensity (size_t group, size_t sfb); //Elements - Enhanced Low Delay Codec void ELDSpecificConfig (); void ld_sbr_header (); //Helpers void hcod (int8u sect_cb, const char* Name); void hcod_sf (const char* Name); void hcod_binary (int8u CodeBook, int8s* Values, int8u Values_Count); void hcod_2step (int8u CodeBook, int8s* Values, int8u Values_Count); //Temp - channel_pair_element bool common_window; //Temp - ics_info int8u window_sequence; int8u max_sfb; int8u scale_factor_grouping; int8u num_windows; int8u num_window_groups; int8u window_group_length [8]; int16u sect_sfb_offset [8][1024]; int16u swb_offset [64]; int8u sfb_cb [8][64]; int8u num_swb; //Temp - section_data int8u num_sec [8]; int8u sect_cb [8][64]; int16u sect_start [8][64]; int16u sect_end [8][64]; //Temp - ltp_data int16u ltp_lag; //Temp - SBR sbr_handler* sbr; //Temp - PS ps_handler* ps; //*********************************************************************** // Elements - Structured Audio (SA) //*********************************************************************** void StructuredAudioSpecificConfig (); //*********************************************************************** // Elements - Text to Speech Interface (TTSI) //*********************************************************************** void TTSSpecificConfig (); //*********************************************************************** // Elements - Parametric Audio (HILN) //*********************************************************************** void HILNconfig (); void HILNenexConfig (); void ParametricSpecificConfig (); void PARAconfig (); //*********************************************************************** // Elements - Technical description of parametric coding for high quality audio //*********************************************************************** void SSCSpecificConfig (); //*********************************************************************** // Elements - MPEG-1/2 Audio //*********************************************************************** void MPEG_1_2_SpecificConfig (); //*********************************************************************** // Elements - Technical description of lossless coding of oversampled audio //*********************************************************************** void DSTSpecificConfig (); //*********************************************************************** // Elements - Audio Lossless //*********************************************************************** void ALSSpecificConfig (); //*********************************************************************** // Elements - Scalable lossless //*********************************************************************** void SLSSpecificConfig (); //*********************************************************************** // Temp //*********************************************************************** std::map Infos_General; std::map Infos; bool CanFill; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Aac_GeneralAudio.cpp100777 0 0 155535 12262743712 17445 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AAC_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Aac.h" #include "MediaInfo/Audio/File_Aac_GeneralAudio.h" using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- extern const int32u Aac_sampling_frequency[]; extern const char* Aac_audioObjectType(int8u audioObjectType); extern const char* Aac_Format_Profile(int8u ID); //--------------------------------------------------------------------------- const char* Aac_id_syn_ele[8]= { "SCE - single_channel_element", "CPE - channel_pair_element", "CCE - coupling_channel_element", "LFE - lfe_channel_element", "DSE - data_stream_element", "PCE - program_config_element", "FIL - fill_element", "END - End" }; //--------------------------------------------------------------------------- const char* Aac_window_sequence[4]= { "ONLY_LONG_SEQUENCE", "LONG_START_SEQUENCE", "EIGHT_SHORT_SEQUENCE", "LONG_STOP_SEQUENCE" }; //*************************************************************************** // Elements - Decoder configuration //*************************************************************************** //--------------------------------------------------------------------------- void File_Aac::GASpecificConfig () { //Parsing Element_Begin1("GASpecificConfig"); bool frameLengthFlag, dependsOnCoreCoder, extensionFlag; Get_SB ( frameLengthFlag, "frameLengthFlag"); frame_length=frameLengthFlag==0?1024:960; Param_Info2(frame_length, " bytes"); Get_SB ( dependsOnCoreCoder, "dependsOnCoreCoder"); if (dependsOnCoreCoder) Skip_S2(14, "coreCoderDelay"); Get_SB ( extensionFlag, "extensionFlag"); if (channelConfiguration==0) program_config_element(); if (audioObjectType==06 || audioObjectType==20) Skip_S1(3, "layerNr"); if (extensionFlag) { bool extensionFlag3; if (audioObjectType==22) { Skip_S1( 5, "numOfSubFrame"); Skip_S2(11, "layer_length"); } if (audioObjectType==17 || audioObjectType==19 || audioObjectType==20 || audioObjectType==23) { Skip_SB( "aacSectionDataResilienceFlag"); Skip_SB( "aacScalefactorDataResilienceFlag"); Skip_SB( "aacSpectralDataResilienceFlag"); } Get_SB ( extensionFlag3, "extensionFlag3"); if (extensionFlag3) { Skip_BS(Data_BS_Remain(), "Not implemented"); } } Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::program_config_element() { Element_Begin1("program_config_element"); Ztring comment_field_data; int8u Channels=0, Channels_Front=0, Channels_Side=0, Channels_Back=0, Channels_LFE=0; int8u num_front_channel_elements, num_side_channel_elements, num_back_channel_elements, num_lfe_channel_elements, num_assoc_data_elements, num_valid_cc_elements, comment_field_bytes; int8u audioObjectType_Temp, sampling_frequency_index_Temp; Skip_S1(4, "element_instance_tag"); Get_S1 (2, audioObjectType_Temp, "object_type"); audioObjectType_Temp++; Param_Info1(Aac_audioObjectType(audioObjectType_Temp)); Get_S1 (4, sampling_frequency_index_Temp, "sampling_frequency_index"); Param_Info1(Aac_sampling_frequency[sampling_frequency_index_Temp]); Get_S1 (4, num_front_channel_elements, "num_front_channel_elements"); Get_S1 (4, num_side_channel_elements, "num_side_channel_elements"); Get_S1 (4, num_back_channel_elements, "num_back_channel_elements"); Get_S1 (2, num_lfe_channel_elements, "num_lfe_channel_elements"); Get_S1 (3, num_assoc_data_elements, "num_assoc_data_elements"); Get_S1 (4, num_valid_cc_elements, "num_valid_cc_elements"); TEST_SB_SKIP( "mono_mixdown_present"); Skip_S1(4, "mono_mixdown_element_number"); TEST_SB_END(); TEST_SB_SKIP( "stereo_mixdown_present"); Skip_S1(4, "stereo_mixdown_element_number"); TEST_SB_END(); TEST_SB_SKIP( "matrix_mixdown_idx_present"); Skip_S1(2, "matrix_mixdown_idx"); Skip_SB( "pseudo_surround_enable"); TEST_SB_END(); bool front1_element_is_cpe=false; if (!num_side_channel_elements && num_back_channel_elements && num_back_channel_elements<3) // Hack: e.g. in case of 5.1, { num_side_channel_elements=num_back_channel_elements; num_back_channel_elements=0; } for (int8u Pos=0; Pos24) // TODO: full_2023548870.mp4 is buggy { Trusted_IsNot("sampling frequency / channels"); Skip_BS(Data_BS_Remain(), "(Unknown frequency)"); return; } if (audioObjectType==(int8u)-1) audioObjectType=audioObjectType_Temp; if (sampling_frequency_index==(int8u)-1) sampling_frequency_index=sampling_frequency_index_Temp; Infos_General["Comment"]=comment_field_data; Infos["Format"].From_Local("AAC"); Infos["Format_Profile"].From_Local(Aac_Format_Profile(audioObjectType)); Infos["Codec"].From_Local(Aac_audioObjectType(audioObjectType)); Infos["SamplingRate"].From_Number(Aac_sampling_frequency[sampling_frequency_index]); Infos["Channel(s)"].From_Number(Channels); Infos["ChannelPositions"]=Channels_Positions; Infos["ChannelPositions/String2"]=Channels_Positions2; Infos["ChannelLayout"]=ChannelLayout; if (!Infos["Format_Settings_SBR"].empty()) { Infos["Format_Profile"]=__T("HE-AAC"); Ztring SamplingRate=Infos["SamplingRate"]; Infos["SamplingRate"].From_Number((extension_sampling_frequency_index==(int8u)-1)?(sampling_frequency*2):extension_sampling_frequency, 10); if (MediaInfoLib::Config.LegacyStreamDisplay_Get()) { Infos["Format_Profile"]+=__T(" / LC"); Infos["SamplingRate"]+=__T(" / ")+SamplingRate; } Infos["Format_Settings_SBR"]=__T("Yes (Implicit)"); Infos["Codec"]=Ztring().From_Local(Aac_audioObjectType(audioObjectType))+__T("-SBR"); } if (!Infos["Format_Settings_PS"].empty()) { Infos["Format_Profile"]=__T("HE-AACv2"); Ztring Channels=Infos["Channel(s)"]; Ztring ChannelPositions=Infos["ChannelPositions"]; Ztring SamplingRate=Infos["SamplingRate"]; Infos["Channel(s)"]=__T("2"); Infos["ChannelPositions"]=__T("Front: L R"); if (MediaInfoLib::Config.LegacyStreamDisplay_Get()) { Infos["Format_Profile"]+=__T(" / HE-AAC / LC"); Infos["Channel(s)"]+=__T(" / ")+Channels+__T(" / ")+Channels; Infos["ChannelPositions"]+=__T(" / ")+ChannelPositions+__T(" / ")+ChannelPositions; Infos["SamplingRate"]=Ztring().From_Number((extension_sampling_frequency_index==(int8u)-1)?(sampling_frequency*2):extension_sampling_frequency, 10)+__T(" / ")+SamplingRate; } Infos["Format_Settings_PS"]=__T("Yes (Implicit)"); Ztring Codec=Retrieve(Stream_Audio, StreamPos_Last, Audio_Codec); Infos["Codec"]=Ztring().From_Local(Aac_audioObjectType(audioObjectType))+__T("-SBR-PS"); } FILLING_END(); } //*************************************************************************** // Elements - GA bitstream //*************************************************************************** //--------------------------------------------------------------------------- void File_Aac::raw_data_block() { if (sampling_frequency_index>=16 || Aac_sampling_frequency[sampling_frequency_index]==0) { Trusted_IsNot("(Problem)"); Skip_BS(Data_BS_Remain(), "(Problem)"); return; } if (audioObjectType!=2) { Skip_BS(Data_BS_Remain(), "Data"); return; //We test only AAC LC } //Parsing Element_Begin1("raw_data_block"); int8u id_syn_ele=0, id_syn_ele_Previous; do { Element_Begin0(); id_syn_ele_Previous=id_syn_ele; Get_S1 (3, id_syn_ele, "id_syn_ele"); Param_Info1(Aac_id_syn_ele[id_syn_ele]); Element_Name(Aac_id_syn_ele[id_syn_ele]); switch (id_syn_ele) { case 0x00 : single_channel_element(); break; //ID_SCE case 0x01 : channel_pair_element(); break; //ID_CPE case 0x02 : coupling_channel_element(); break; //ID_CCE case 0x03 : lfe_channel_element(); break; //ID_LFE case 0x04 : data_stream_element(); break; //ID_DSE case 0x05 : program_config_element(); break; //ID_PCE case 0x06 : fill_element(id_syn_ele_Previous); break; //ID_FIL case 0x07 : break; //ID_END default : ; //Can not happen } Element_End0(); } while(Element_IsOK() && Data_BS_Remain() && id_syn_ele!=0x07); //ID_END if (Element_IsOK() && Data_BS_Remain()%8) Skip_S1(Data_BS_Remain()%8, "byte_alignment"); Element_End0(); if (sampling_frequency) { #if MEDIAINFO_TRACE if (FrameInfo.PTS!=(int64u)-1) Element_Info1(__T("PTS ")+Ztring().Duration_From_Milliseconds(float64_int64s(((float64)FrameInfo.PTS)/1000000))); if (FrameInfo.DTS!=(int64u)-1) Element_Info1(__T("DTS ")+Ztring().Duration_From_Milliseconds(float64_int64s(((float64)FrameInfo.DTS)/1000000))); #endif //MEDIAINFO_TRACE FrameInfo.DUR=float64_int64s(((float64)frame_length)*1000000000/sampling_frequency); FrameInfo.DTS+=FrameInfo.DUR; FrameInfo.PTS=FrameInfo.DTS; } } //--------------------------------------------------------------------------- void File_Aac::single_channel_element() { //Parsing Skip_S1 (4, "element_instance_tag"); individual_channel_stream(false, false); } //--------------------------------------------------------------------------- void File_Aac::channel_pair_element() { //Parsing Skip_S1(4, "element_instance_tag"); Get_SB (common_window, "common_window"); if (common_window) { int8u ms_mask_present; ics_info(); Get_S1(2, ms_mask_present, "ms_mask_present"); if (ms_mask_present==1) { Element_Begin1("ms_mask"); for (int8u g=0; gAac_PRED_SFB_MAX[sampling_frequency_index]) PRED_SFB_MAX=Aac_PRED_SFB_MAX[sampling_frequency_index]; for (int8u sfb=0; sfbnum_swb; for (int8u i=0; iswb_offset[i]swb_offset[i]; else swb_offset[i]=frame_length; sect_sfb_offset[0][i]=swb_offset[i]; } break; case 2 : //EIGHT_SHORT_SEQUENCE num_windows=8; num_window_groups=1; window_group_length[0]=1; num_swb=Aac_swb_offset_short_window[sampling_frequency_index]->num_swb; for (int8u i=0; iswb_offset[i]; swb_offset[num_swb] = frame_length/8; for (int8u i=0; iswb_offset[i+1] - Aac_swb_offset_short_window[sampling_frequency_index]->swb_offset[i]; width *= window_group_length[g]; sect_sfb_offset[g][sect_sfb++] = offset; offset += width; } sect_sfb_offset[g][sect_sfb] = offset; } break; default: ; } } //--------------------------------------------------------------------------- void File_Aac::pulse_data() { //Parsing int8u number_pulse; Get_S1(2,number_pulse, "number_pulse"); Skip_S1(6, "pulse_start_sfb"); for (int i = 0; i < number_pulse+1; i++) { Skip_S1(5, "pulse_offset[i]"); Skip_S1(4, "pulse_amp[i]"); } } //--------------------------------------------------------------------------- void File_Aac::coupling_channel_element() { //Parsing int8u num_coupled_elements; bool ind_sw_cce_flag; Skip_S1(4, "element_instance_tag"); Get_SB ( ind_sw_cce_flag, "ind_sw_cce_flag"); Get_S1 (3, num_coupled_elements, "num_coupled_elements"); size_t num_gain_element_lists=0; for (int8u c=0; c=8*cnt) { size_t End=Data_BS_Remain()-8*cnt; extension_payload(End, id_syn_ele); } else Skip_BS(Data_BS_Remain(), "(Error)"); } } //--------------------------------------------------------------------------- void File_Aac::gain_control_data() { int8u max_band, adjust_num, aloc_bits, aloc_bits0; int8u wd_max=0; switch(window_sequence) { case 0 : //ONLY_LONG_SEQUENCE wd_max = 1; aloc_bits0 = 5; aloc_bits = 5; break; case 1 : //LONG_START_SEQUENCE wd_max = 2; aloc_bits0 = 4; aloc_bits = 2; break; case 2 : //EIGHT_SHORT_SEQUENCE wd_max = 8; aloc_bits0 = 2; aloc_bits = 2; break; case 3 : //LONG_STOP_SEQUENCE wd_max = 2; aloc_bits0 = 4; aloc_bits = 5; break; default: return; //Never happens but makes compiler happy } Get_S1 (2, max_band, "max_band"); for (int8u bd=1; bd<=max_band; bd++) { for (int8u wd=0; wd1) Element_Begin1("windows"); int8u k=0; int8u i=0; while (k11 && sect_cb[g][i]<16)) { for (;;) { if (Data_BS_Remain()==0) { Trusted_IsNot("Size is wrong"); if (num_window_groups>1) Element_End0(); Element_End0(); return; //Error } Get_S1 ((window_sequence==2?3:5), sect_len_incr, "sect_len_incr"); // (window_sequence == EIGHT_SHORT_SEQUENCE) => 3 if (sect_len_incr!=sect_esc_val) break; sect_len+=sect_esc_val; } } else sect_len_incr=1; sect_len+=sect_len_incr; sect_start[g][i]=k; sect_end[g][i]=k+sect_len; for (int16u sfb=k; sfb64) { Trusted_IsNot("Increment is wrong"); if (num_window_groups>1) Element_End0(); Element_End0(); return; //Error } } num_sec[g]=i; if (num_window_groups>1) Element_End0(); } Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::scale_factor_data() { Element_Begin1("scale_factor_data"); if (!aacScalefactorDataResilienceFlag) { bool noise_pcm_flag=true; for (int g=0; g1) Element_Begin1("windows"); for (int8u i=0; i=num_swb+1) { Trusted_IsNot("(Problem)"); Skip_BS(Data_BS_Remain(), "(Problem)"); if (num_window_groups>1) Element_End0(); Element_End0(); return; } for (int16u k=sect_sfb_offset[g][sect_start[g][i]]; k1) Element_End0(); Element_End0(); return; } } } } if (num_window_groups>1) Element_End0(); } Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::extension_payload(size_t End, int8u id_aac) { Element_Begin1("extension_payload"); int8u extension_type; Get_S1 (4, extension_type, "extension_type"); switch(extension_type) { case 11 : dynamic_range_info(); break; //EXT_DYNAMIC_RANGE case 12 : sac_extension_data(End); break; //EXT_SAC_DATA case 13 : sbr_extension_data(End, id_aac, 0); break; //EXT_SBR_DATA case 14 : sbr_extension_data(End, id_aac, 1); break; //EXT_SBR_DATA_CRC case 1 : //EXT_FILL_DATA Skip_S1(4, "fill_nibble"); Param_Info1("must be 0000"); if (Data_BS_Remain()>End) { Element_Begin1("fill_byte"); while (Data_BS_Remain()>End) Skip_S1(8, "fill_byte[i]"); Param_Info1("must be 10100101"); Element_End0(); } break; case 2 : //EXT_DATA_ELEMENT int8u data_element_version; Get_S1 (4,data_element_version, "data_element_version"); switch(data_element_version) { case 0 : //ANC_DATA { int16u dataElementLength=0; int8u dataElementLengthPart; do { Get_S1 (8, dataElementLengthPart, "dataElementLengthPart"); dataElementLength+=dataElementLengthPart; } while (dataElementLengthPart==255); Skip_BS(8*dataElementLength, "data_element_byte[i]"); } break; default: ; } case 0 : //EXT_FILL default: Skip_BS(Data_BS_Remain()-End, "other_bits"); } Element_End0(); if (EndEnd) Skip_S1(8, "ancDataSegmentByte[i]"); Element_End0(); Element_End0(); } //*************************************************************************** // Elements - Perceptual noise substitution (PNS) //*************************************************************************** //--------------------------------------------------------------------------- int File_Aac::is_intensity(size_t group, size_t sfb) { switch (sfb_cb[group][sfb]) { case 14 : return 1; case 15 : return -1; default : return 0; } } //--------------------------------------------------------------------------- bool File_Aac::is_noise(size_t group, size_t sfb) { return (sfb_cb[group][sfb]==13); } //--------------------------------------------------------------------------- void File_Aac::hcod_sf(const char* Name) { Element_Begin1(Name); int16u Pos=0; while (huffman_sf[Pos][1]) { bool h; Get_SB (h, "huffman"); Pos+=huffman_sf[Pos][h]; if (Pos>240) { Skip_BS(Data_BS_Remain(), "Error"); Element_End0(); return; } } Element_Info1(huffman_sf[Pos][0]-60); Element_End0(); return; } //--------------------------------------------------------------------------- void File_Aac::hcod_2step(int8u CodeBook, int8s* Values, int8u Values_Count) { int8u CodeWord; int8u ToRead=hcb_2step_Bytes[CodeBook]; if ((size_t)ToRead>Data_BS_Remain()) ToRead=(int8u)Data_BS_Remain(); //Read a maximum of remaining bytes Peek_S1(ToRead, CodeWord); int16u Offset=hcb_2step[CodeBook][CodeWord].Offset; int8u Extra=hcb_2step[CodeBook][CodeWord].Extra; if (Extra) { Skip_BS(hcb_2step_Bytes[CodeBook], "extra"); int8u Offset_inc; Peek_S1(Extra, Offset_inc); Offset+=Offset_inc; if(hcb_table[CodeBook][Offset][0]-hcb_2step_Bytes[CodeBook]) Skip_BS(hcb_table[CodeBook][Offset][0]-hcb_2step_Bytes[CodeBook],"extra"); } else { Skip_BS(hcb_table[CodeBook][Offset][0], "bits"); } if (Offset>=hcb_table_size[CodeBook]) { Skip_BS(Data_BS_Remain(), "Error"); return; } for (int8u Pos=0; Pos=hcb_table_size[CodeBook]) { Skip_BS(Data_BS_Remain(), "Error"); return; } for (int8u Pos=0; Pos #include #include using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- extern const char* Aac_audioObjectType(int8u audioObjectType); //--------------------------------------------------------------------------- int8u Aac_AudioSpecificConfig_sampling_frequency_index(const int32u sampling_frequency); //--------------------------------------------------------------------------- // Master frequency band table // k0 = lower frequency boundary int8u Aac_k0_Compute(int8u bs_start_freq, int8u extension_sampling_frequency_index) { return Aac_k0_startMin[extension_sampling_frequency_index]+Aac_k0_offset[extension_sampling_frequency_index][bs_start_freq]; } //--------------------------------------------------------------------------- // Master frequency band table // k2 = upper frequency boundary int8u Aac_k2_Compute(int8u bs_stop_freq, int8u extension_sampling_frequency_index, int8u k0) { switch (bs_stop_freq) { case 14 : return (int8u)min(64, 2*k0); case 15 : return (int8u)min(64, 3*k0); default : ; } return (int8u)min(64, Aac_k2_stopMin[extension_sampling_frequency_index]+Aac_k2_offset[extension_sampling_frequency_index][bs_stop_freq]); } //--------------------------------------------------------------------------- //Helper int8u Aac_bands_Compute(bool warp, int8u bands, int8u a0, int8u a1) { float div=(float)log(2.0); if (warp) div*=(float)1.3; return (int8u)(bands*log((float)a1/(float)a0)/div+0.5); } //--------------------------------------------------------------------------- // Master frequency band table // Computing for bs_freq_scale = 0 bool Aac_f_master_Compute_0(int8u &num_env_bands_Master, int8u* f_Master, sbr_handler *sbr, int8u k0, int8u k2) { int8u dk, numBands; if (sbr->bs_alter_scale) { dk=1; numBands=(((k2-k0+2)>>2)<<1); } else { dk=2; numBands=(((k2-k0)>>1)<<1); } int8u k2Achieved=k0+numBands*dk; int8s k2Diff=k2-k2Achieved; int8s vDk[64]; for (int8u k=0; k0) { incr=-1; k=numBands-1; } else { incr=1; k=0; } while (k2Diff) { vDk[k]-=incr; k+=incr; k2Diff+=incr; } } f_Master[0]=k0; for (int8u k=1; k<=numBands; k++) f_Master[k]=f_Master[k-1]+vDk[k-1]; num_env_bands_Master=numBands; return true; } //--------------------------------------------------------------------------- // Master frequency band table // Computing for bs_freq_scale != 0 int int8u_cmp(const void *a, const void *b) { return ((int8u)(*(int8u*)a - *(int8u*)b)); } bool Aac_f_master_Compute(int8u &num_env_bands_Master, int8u* f_Master, sbr_handler *sbr, int8u k0, int8u k2) { int8u temp1[]={6, 5, 4 }; int8u bands=temp1[sbr->bs_freq_scale-1]; int8u twoRegions, k1; if ((float)k2/(float)k0>2.2449) { twoRegions=1; k1=2*k0; } else { twoRegions=0; k1=k2; } int8u numBands0=2*Aac_bands_Compute(false, bands, k0, k1); if (numBands0>=64) return false; int8u vDk0[64]; int8u vk0[64]; float Power=pow((float)k1/(float)k0, (float)1/(float)numBands0); float Power2=(float)k0; int8s Temp1=(int8s)(Power2+0.5); for (int8u k=0; k<=numBands0-1; k++) { int8s Temp0=Temp1; Power2*=Power; Temp1=(int8s)(Power2+0.5); vDk0[k]=Temp1-Temp0; } qsort(vDk0, numBands0, sizeof(int8u), int8u_cmp); vk0[0]=k0; for (int8u k=1; k<=numBands0; k++) { if (vDk0[k-1]==0) return false; vk0[k]=vk0[k-1]+vDk0[k-1]; } if (!twoRegions) { for (int8u k=0; k<=numBands0; k++) f_Master[k]=vk0[k]; num_env_bands_Master=numBands0; return true; } //With twoRegions int8u numBands1; int8u vDk1[64]; int8u vk1[64]; numBands1=2*Aac_bands_Compute(true, bands, k1, k2); if (numBands0+numBands1>=64) return false; Power=(float)pow((float)k2/(float)k1, (float)1/(float)numBands1); Power2=(float)k1; Temp1=(int8s)(Power2+0.5); for (int8u k=0; k<=numBands1-1; k++) { int8s Temp0=Temp1; Power2*=Power; Temp1=(int8s)(Power2+0.5); vDk1[k]=Temp1-Temp0; } if (vDk1[0]num_env_bands[1]=num_env_bands_Master-sbr->bs_xover_band; sbr->num_env_bands[0]=(sbr->num_env_bands[1]>>1)+(sbr->num_env_bands[1]-((sbr->num_env_bands[1]>>1)<<1)); if (f_Master[sbr->bs_xover_band]>32) return false; if (sbr->bs_noise_bands==0) sbr->num_noise_bands=1; else { sbr->num_noise_bands=Aac_bands_Compute(false, sbr->bs_noise_bands, f_Master[sbr->bs_xover_band], k2); if (sbr->num_noise_bands<1 || sbr->num_noise_bands>5) return false; } return true; } //--------------------------------------------------------------------------- bool Aac_Sbr_Compute(sbr_handler *sbr, int8u extension_sampling_frequency_index) { if (extension_sampling_frequency_index>=9) return 0; //Not supported int8u k0=Aac_k0_Compute(sbr->bs_start_freq, extension_sampling_frequency_index); int8u k2=Aac_k2_Compute(sbr->bs_stop_freq, extension_sampling_frequency_index, k0); if (k2<=k0) return false; switch (extension_sampling_frequency_index) { case 0 : case 1 : case 2 : case 3 : if ((k2-k0)>32) return false; break; case 4 : if ((k2-k0)>35) return false; break; case 5 : case 6 : case 7 : case 8 : if ((k2-k0)>48) return false; break; default : ; } int8u num_env_bands_Master; int8u f_Master[64]; if (sbr->bs_freq_scale==0) { if (!Aac_f_master_Compute_0(num_env_bands_Master, f_Master, sbr, k0, k2)) return false; } else { if (!Aac_f_master_Compute(num_env_bands_Master, f_Master, sbr, k0, k2)) return false; } if (num_env_bands_Master<=sbr->bs_xover_band) return false; if (!Aac_bands_Compute(num_env_bands_Master, f_Master, sbr, k2)) return false; return true; } //--------------------------------------------------------------------------- int16u File_Aac::sbr_huff_dec(sbr_huffman Table, const char* Name) { int8u bit; int16s index = 0; Element_Begin1(Name); while (index>=0) { Get_S1(1, bit, "bit"); index=Table[index][bit]; } Element_End0(); return index+64; } //--------------------------------------------------------------------------- void File_Aac::sbr_extension_data(size_t End, int8u id_aac, bool crc_flag) { FILLING_BEGIN(); if (Infos["Format_Settings_SBR"].empty()) { Infos["Format_Profile"]=__T("HE-AAC"); Ztring SamplingRate=Infos["SamplingRate"]; if (SamplingRate.empty()) SamplingRate.From_Number(sampling_frequency); Infos["SamplingRate"].From_Number((extension_sampling_frequency_index==(int8u)-1)?(sampling_frequency*2):extension_sampling_frequency, 10); if (MediaInfoLib::Config.LegacyStreamDisplay_Get()) { Infos["Format_Profile"]+=__T(" / LC"); Infos["SamplingRate"]+=__T(" / ")+SamplingRate; } Infos["Format_Settings_SBR"]=__T("Yes (Implicit)"); Infos["Codec"]=Ztring().From_Local(Aac_audioObjectType(audioObjectType))+__T("-SBR"); if (Frame_Count_Valid<32) Frame_Count_Valid=32; //We need to find the SBR header } FILLING_END(); Element_Begin1("sbr_extension_data"); bool bs_header_flag; if (crc_flag) Skip_S2(10, "bs_sbr_crc_bits"); //~ if (sbr_layer != SBR_STEREO_ENHANCE) //~ { Get_SB(bs_header_flag, "bs_header_flag"); if (bs_header_flag) { if (extension_sampling_frequency_index==(int8u)-1) { extension_sampling_frequency=sampling_frequency*2; extension_sampling_frequency_index=Aac_AudioSpecificConfig_sampling_frequency_index(extension_sampling_frequency); } delete sbr; sbr=new sbr_handler; sbr_header(); if (!Aac_Sbr_Compute(sbr, extension_sampling_frequency_index)) { delete sbr; sbr=NULL; } } //~ } //Parsing if (sbr) //only if a header is found { sbr->bs_amp_res[0]=sbr->bs_amp_res_FromHeader; //Set up with header data sbr->bs_amp_res[1]=sbr->bs_amp_res_FromHeader; //Set up with header data sbr_data(id_aac); FILLING_BEGIN(); if (MediaInfoLib::Config.ParseSpeed_Get()<0.3) { Frame_Count_Valid=Frame_Count+1; #if MEDIAINFO_ADVANCED if (aac_frame_lengths.size()<8) Frame_Count_Valid+=8-aac_frame_lengths.size(); #endif //MEDIAINFO_ADVANCED } FILLING_END(); } if (Data_BS_Remain()>End) Skip_BS(Data_BS_Remain()-End, "bs_fill_bits"); Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::sbr_header() { Element_Begin1("sbr_header"); Get_S1 (1, sbr->bs_amp_res_FromHeader, "bs_amp_res"); Get_S1 (4, sbr->bs_start_freq, "bs_start_freq"); Get_S1 (4, sbr->bs_stop_freq, "bs_stop_freq"); Get_S1 (3, sbr->bs_xover_band, "bs_xover_band"); Skip_S1(2, "bs_reserved"); bool bs_header_extra_1, bs_header_extra_2; Get_SB (bs_header_extra_1, "bs_header_extra_1"); Get_SB (bs_header_extra_2, "bs_header_extra_2"); if(bs_header_extra_1) { Get_S1 (2, sbr->bs_freq_scale, "bs_freq_scale"); Get_S1 (1, sbr->bs_alter_scale, "bs_alter_scale"); Get_S1 (2, sbr->bs_noise_bands, "bs_noise_bands"); } else { sbr->bs_freq_scale=2; sbr->bs_alter_scale=1; sbr->bs_noise_bands=2; } if(bs_header_extra_2) { Skip_S1(2, "bs_limiter_bands"); Skip_S1(2, "bs_limiter_gains"); Skip_SB( "bs_interpol_freq"); Skip_SB( "bs_smoothing_mode"); } Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::sbr_data(int8u id_aac) { Element_Begin1("sbr_data"); switch (id_aac) { case 0 : sbr_single_channel_element(); break; //ID_SCE case 1 : sbr_channel_pair_element(); break; //ID_CPE default : ; } Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::sbr_single_channel_element() { Element_Begin1("sbr_single_channel_element"); bool bs_data_extra, bs_add_harmonic_flag, bs_extended_data; int8u bs_extension_size, bs_esc_count, bs_extension_id; Get_SB (bs_data_extra, "bs_data_extra"); if (bs_data_extra) { Skip_S1(4, "bs_reserved"); } sbr_grid(0); sbr_dtdf(0); sbr_invf(0); sbr_envelope(0, 0); sbr_noise(0, 0); Get_SB (bs_add_harmonic_flag, "bs_add_harmonic_flag[0]"); if (bs_add_harmonic_flag) sbr_sinusoidal_coding(0); Get_SB (bs_extended_data, "bs_extended_data[0]"); if (bs_extended_data) { Get_S1 (4,bs_extension_size, "bs_extension_size"); size_t cnt=bs_extension_size; if (cnt==15) { Get_S1 (8, bs_esc_count, "bs_esc_count"); cnt+=bs_esc_count; } if (Data_BS_Remain()>=8*cnt) { size_t End=Data_BS_Remain()-8*cnt; while (Data_BS_Remain()>End+7) { Get_S1 (2,bs_extension_id, "bs_extension_id"); switch (bs_extension_id) { case 2 : ps_data(End); break; //EXTENSION_ID_PS default: ; } } if (Endbs_num_env[ch]=(int8u)pow(2.0, tmp); if (sbr->bs_num_env[ch]==1) sbr->bs_amp_res[ch]=0; Get_SB ( sbr->bs_freq_res[ch][0], "bs_freq_res[ch][0]"); for (int8u env=1; envbs_num_env[ch]; env++) sbr->bs_freq_res[ch][env]=sbr->bs_freq_res[ch][0]; break; case 1 : //FIXVAR Skip_S1(2, "bs_var_bord_1[ch]"); Get_S1 (2, bs_num_rel_1, "bs_num_rel_1[ch]"); sbr->bs_num_env[ch]=bs_num_rel_1+1; for (int8u rel=0; relbs_num_env[ch]-1; rel++) { Skip_S1(2, "tmp"); } ptr_bits=(int8u)ceil(log((double)sbr->bs_num_env[ch]+1)/log((double)2)); Skip_BS(ptr_bits, "bs_pointer[ch]"); Element_Begin1("bs_freq_res[ch]"); for (int8u env=0; envbs_num_env[ch]; env++) Get_SB (sbr->bs_freq_res[ch][sbr->bs_num_env[ch]-1-env], "bs_freq_res[ch][bs_num_env[ch]-1-env]"); Element_End0(); break; case 2 : //VARFIX Skip_S1(2, "bs_var_bord_0[ch]"); Get_S1 (2,bs_num_rel_0, "bs_num_rel_0[ch]"); sbr->bs_num_env[ch] = bs_num_rel_0 + 1; for (int8u rel=0; relbs_num_env[ch]-1; rel++) Skip_S1(2, "tmp"); ptr_bits=(int8u)ceil(log((double)sbr->bs_num_env[ch]+1)/log((double)2)); Skip_BS(ptr_bits, "bs_pointer[ch]"); Element_Begin1("bs_freq_res[ch]"); for (int8u env = 0; env < sbr->bs_num_env[ch]; env++) Get_SB (sbr->bs_freq_res[ch][env], "bs_freq_res[ch][env]"); Element_End0(); break; case 3 : //VARVAR Skip_S1(2, "bs_var_bord_0[ch]"); Skip_S1(2, "bs_var_bord_1[ch]"); Get_S1 (2,bs_num_rel_0, "bs_num_rel_0[ch]"); Get_S1 (2,bs_num_rel_1, "bs_num_rel_1[ch]"); sbr->bs_num_env[ch] = bs_num_rel_0 + bs_num_rel_1 + 1; for (int8u rel=0; relbs_num_env[ch]+1))/log((double)2)); Skip_BS(ptr_bits, "bs_pointer[ch]"); Element_Begin1("bs_freq_res[ch]"); for (int8u env=0; envbs_num_env[ch]; env++) Get_SB (sbr->bs_freq_res[ch][env], "bs_freq_res[ch][env]"); Element_End0(); break; } if (sbr->bs_num_env[ch]>1) sbr->bs_num_noise[ch]=2; else sbr->bs_num_noise[ch]=1; Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::sbr_channel_pair_element() { Element_Begin1("sbr_channel_pair_element"); bool bs_data_extra,bs_coupling,bs_add_harmonic_flag,bs_extended_data; int8u bs_extension_size,bs_esc_count,bs_extension_id; Get_SB (bs_data_extra, "bs_data_extra"); if (bs_data_extra) { Skip_S1(4, "bs_reserved"); Skip_S1(4, "bs_reserved"); } Get_SB (bs_coupling, "bs_coupling"); sbr_grid(0); if (bs_coupling) { //Coupling sbr->bs_num_env [1]=sbr->bs_num_env [0]; sbr->bs_num_noise [1]=sbr->bs_num_noise [0]; for (int8u env=0; envbs_num_env[0]; env++) sbr->bs_freq_res[1][env]=sbr->bs_freq_res[0][env]; } else sbr_grid(1); sbr_dtdf(0); sbr_dtdf(1); sbr_invf(0); if (!bs_coupling) sbr_invf(1); sbr_envelope(0, bs_coupling); if (bs_coupling) { sbr_noise(0, bs_coupling); sbr_envelope(1, bs_coupling); } else { sbr_envelope(1, bs_coupling); sbr_noise(0, bs_coupling); } sbr_noise(1, bs_coupling); Get_SB (bs_add_harmonic_flag, "bs_add_harmonic_flag[0]"); if (bs_add_harmonic_flag) sbr_sinusoidal_coding(0); Get_SB (bs_add_harmonic_flag, "bs_add_harmonic_flag[1]"); if (bs_add_harmonic_flag) sbr_sinusoidal_coding(1); Get_SB (bs_extended_data, "bs_extended_data"); if (bs_extended_data) { Get_S1(4,bs_extension_size, "bs_extension_size"); size_t cnt = bs_extension_size; if (cnt == 15) { Get_S1(8,bs_esc_count, "bs_esc_count"); cnt += bs_esc_count; } if (Data_BS_Remain()>=8*cnt) { size_t End=Data_BS_Remain()-8*cnt; while (Data_BS_Remain()>End+7) { Get_S1 (2,bs_extension_id, "bs_extension_id"); switch (bs_extension_id) { case 2 : ps_data(End); break; //EXTENSION_ID_PS default: ; } } if (Endbs_num_env[ch]; env++) Get_S1 (1, sbr->bs_df_env[ch][env], "bs_df_env[ch][env]"); for (int noise=0; noisebs_num_noise[ch]; noise++) Get_S1 (1, sbr->bs_df_noise[ch][noise], "bs_df_noise[ch][noise]"); Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::sbr_invf(bool) { Element_Begin1("sbr_invf"); for (int n = 0; nnum_noise_bands; n++ ) Skip_S1(2, "bs_invf_mode[ch][n]"); Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::sbr_envelope(bool ch, bool bs_coupling) { sbr_huffman t_huff, f_huff; Element_Begin1("sbr_envelope"); if (bs_coupling && ch) { if (sbr->bs_amp_res[ch]) { t_huff = t_huffman_env_bal_3_0dB; f_huff = f_huffman_env_bal_3_0dB; } else { t_huff = t_huffman_env_bal_1_5dB; f_huff = f_huffman_env_bal_1_5dB; } } else { if (sbr->bs_amp_res[ch]) { t_huff = t_huffman_env_3_0dB; f_huff = f_huffman_env_3_0dB; } else { t_huff = t_huffman_env_1_5dB; f_huff = f_huffman_env_1_5dB; } } for (int8u env=0; envbs_num_env[ch]; env++) { if (sbr->bs_df_env[ch][env] == 0) { if (bs_coupling && ch) Skip_S1(sbr->bs_amp_res[ch]?5:6, "bs_env_start_value_balance"); else Skip_S1(sbr->bs_amp_res[ch]?6:7, "bs_env_start_value_level"); for (int8u band = 1; band < sbr->num_env_bands[sbr->bs_freq_res[ch][env]]; band++) sbr_huff_dec(f_huff, "bs_data_env[ch][env][band]"); } else { for (int8u band = 0; band < sbr->num_env_bands[sbr->bs_freq_res[ch][env]]; band++) sbr_huff_dec(t_huff, "bs_data_env[ch][env][band]"); } } Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::sbr_noise(bool ch, bool bs_coupling) { sbr_huffman t_huff, f_huff; Element_Begin1("sbr_noise"); if (bs_coupling && ch) { t_huff = t_huffman_noise_bal_3_0dB; f_huff = f_huffman_env_bal_3_0dB; } else { t_huff = t_huffman_noise_3_0dB; f_huff = f_huffman_env_3_0dB; } for (int noise=0; noisebs_num_noise[ch]; noise++) { if (sbr->bs_df_noise[ch][noise] == 0) { Skip_S1(5, (bs_coupling && ch)?"bs_noise_start_value_balance":"bs_noise_start_value_level"); for (int8u band=1; bandnum_noise_bands; band++) sbr_huff_dec(f_huff, "bs_data_noise[ch][noise][band]"); } else { for (int8u band = 0; band < sbr->num_noise_bands; band++) sbr_huff_dec(t_huff, "bs_data_noise[ch][noise][band]"); } } Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::sbr_sinusoidal_coding(bool) { Element_Begin1("sbr_sinusoidal_coding"); for (int8u n=0; nnum_env_bands[1]; n++) Skip_SB( "bs_add_harmonic[ch][n]"); Element_End0(); } } //NameSpace #endif //MEDIAINFO_AAC_YES MediaInfoLib/Source/MediaInfo/Audio/File_Aac_GeneralAudio_Sbr.h100777 0 0 35366 12226004262 17665 0/* 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. */ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_Aac_GeneralAudio_SbrH #define MediaInfo_File_Aac_GeneralAudio_SbrH //--------------------------------------------------------------------------- namespace MediaInfoLib { const int8s t_huffman_env_1_5dB[120][2]= { { 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 }, { 5, 6 }, { -62, -67 }, { 7, 8 }, { -61, -68 }, { 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 }, { 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 }, { 17, 18 }, { -73, -56 }, { 19, 21 }, { -74, 20 }, { -55, -75 }, { 22, 26 }, { 23, 24 }, { -54, -76 }, { -77, 25 }, { -53, -78 }, { 27, 34 }, { 28, 29 }, { -52, -79 }, { 30, 31 }, { -80, -51 }, { 32, 33 }, { -83, -82 }, { -81, -50 }, { 35, 57 }, { 36, 40 }, { 37, 38 }, { -88, -84 }, { -48, 39 }, { -90, -85 }, { 41, 46 }, { 42, 43 }, { -49, -87 }, { 44, 45 }, { -89, -86 }, {-124, -123 }, { 47, 50 }, { 48, 49 }, {-122, -121 }, {-120, -119 }, { 51, 54 }, { 52, 53 }, {-118, -117 }, {-116, -115 }, { 55, 56 }, {-114, -113 }, {-112, -111 }, { 58, 89 }, { 59, 74 }, { 60, 67 }, { 61, 64 }, { 62, 63 }, {-110, -109 }, {-108, -107 }, { 65, 66 }, {-106, -105 }, {-104, -103 }, { 68, 71 }, { 69, 70 }, {-102, -101 }, {-100, -99 }, { 72, 73 }, { -98, -97 }, { -96, -95 }, { 75, 82 }, { 76, 79 }, { 77, 78 }, { -94, -93 }, { -92, -91 }, { 80, 81 }, { -47, -46 }, { -45, -44 }, { 83, 86 }, { 84, 85 }, { -43, -42 }, { -41, -40 }, { 87, 88 }, { -39, -38 }, { -37, -36 }, { 90, 105 }, { 91, 98 }, { 92, 95 }, { 93, 94 }, { -35, -34 }, { -33, -32 }, { 96, 97 }, { -31, -30 }, { -29, -28 }, { 99, 102 }, { 100, 101 }, { -27, -26 }, { -25, -24 }, { 103, 104 }, { -23, -22 }, { -21, -20 }, { 106, 113 }, { 107, 110 }, { 108, 109 }, { -19, -18 }, { -17, -16 }, { 111, 112 }, { -15, -14 }, { -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 }, { -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 } }; const int8s f_huffman_env_1_5dB[120][2]= { { 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 }, { 5, 6 }, { -67, -62 }, { 7, 8 }, { -68, -61 }, { 9, 10 }, { -69, -60 }, { 11, 13 }, { -70, 12 }, { -59, -71 }, { 14, 16 }, { -58, 15 }, { -72, -57 }, { 17, 19 }, { -73, 18 }, { -56, -74 }, { 20, 23 }, { 21, 22 }, { -55, -75 }, { -54, -53 }, { 24, 27 }, { 25, 26 }, { -76, -52 }, { -77, -51 }, { 28, 31 }, { 29, 30 }, { -50, -78 }, { -79, -49 }, { 32, 36 }, { 33, 34 }, { -48, -47 }, { -80, 35 }, { -81, -82 }, { 37, 47 }, { 38, 41 }, { 39, 40 }, { -83, -46 }, { -45, -84 }, { 42, 44 }, { -85, 43 }, { -44, -43 }, { 45, 46 }, { -88, -87 }, { -86, -90 }, { 48, 66 }, { 49, 56 }, { 50, 53 }, { 51, 52 }, { -92, -42 }, { -41, -39 }, { 54, 55 }, {-105, -89 }, { -38, -37 }, { 57, 60 }, { 58, 59 }, { -94, -91 }, { -40, -36 }, { 61, 63 }, { -20, 62 }, {-115, -110 }, { 64, 65 }, {-108, -107 }, {-101, -97 }, { 67, 89 }, { 68, 75 }, { 69, 72 }, { 70, 71 }, { -95, -93 }, { -34, -27 }, { 73, 74 }, { -22, -17 }, { -16, -124 }, { 76, 82 }, { 77, 79 }, {-123, 78 }, {-122, -121 }, { 80, 81 }, {-120, -119 }, {-118, -117 }, { 83, 86 }, { 84, 85 }, {-116, -114 }, {-113, -112 }, { 87, 88 }, {-111, -109 }, {-106, -104 }, { 90, 105 }, { 91, 98 }, { 92, 95 }, { 93, 94 }, {-103, -102 }, {-100, -99 }, { 96, 97 }, { -98, -96 }, { -35, -33 }, { 99, 102 }, { 100, 101 }, { -32, -31 }, { -30, -29 }, { 103, 104 }, { -28, -26 }, { -25, -24 }, { 106, 113 }, { 107, 110 }, { 108, 109 }, { -23, -21 }, { -19, -18 }, { 111, 112 }, { -15, -14 }, { -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 }, { -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 } }; const int8s t_huffman_env_bal_1_5dB[48][2]= { { -64, 1 }, { -63, 2 }, { -65, 3 }, { -62, 4 }, { -66, 5 }, { -61, 6 }, { -67, 7 }, { -60, 8 }, { -68, 9 }, { 10, 11 }, { -69, -59 }, { 12, 13 }, { -70, -58 }, { 14, 28 }, { 15, 21 }, { 16, 18 }, { -57, 17 }, { -71, -56 }, { 19, 20 }, { -88, -87 }, { -86, -85 }, { 22, 25 }, { 23, 24 }, { -84, -83 }, { -82, -81 }, { 26, 27 }, { -80, -79 }, { -78, -77 }, { 29, 36 }, { 30, 33 }, { 31, 32 }, { -76, -75 }, { -74, -73 }, { 34, 35 }, { -72, -55 }, { -54, -53 }, { 37, 41 }, { 38, 39 }, { -52, -51 }, { -50, 40 }, { -49, -48 }, { 42, 45 }, { 43, 44 }, { -47, -46 }, { -45, -44 }, { 46, 47 }, { -43, -42 }, { -41, -40 } }; const int8s f_huffman_env_bal_1_5dB[48][2]= { { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, { -60, 9 }, { 10, 11 }, { -69, -59 }, { -70, 12 }, { -58, 13 }, { 14, 17 }, { -71, 15 }, { -57, 16 }, { -56, -73 }, { 18, 32 }, { 19, 25 }, { 20, 22 }, { -72, 21 }, { -88, -87 }, { 23, 24 }, { -86, -85 }, { -84, -83 }, { 26, 29 }, { 27, 28 }, { -82, -81 }, { -80, -79 }, { 30, 31 }, { -78, -77 }, { -76, -75 }, { 33, 40 }, { 34, 37 }, { 35, 36 }, { -74, -55 }, { -54, -53 }, { 38, 39 }, { -52, -51 }, { -50, -49 }, { 41, 44 }, { 42, 43 }, { -48, -47 }, { -46, -45 }, { 45, 46 }, { -44, -43 }, { -42, 47 }, { -41, -40 } }; const int8s t_huffman_env_3_0dB[62][2]= { { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, { -62, 5 }, { -67, 6 }, { -61, 7 }, { -68, 8 }, { -60, 9 }, { 10, 11 }, { -69, -59 }, { 12, 14 }, { -70, 13 }, { -71, -58 }, { 15, 18 }, { 16, 17 }, { -72, -57 }, { -73, -74 }, { 19, 22 }, { -56, 20 }, { -55, 21 }, { -54, -77 }, { 23, 31 }, { 24, 25 }, { -75, -76 }, { 26, 27 }, { -78, -53 }, { 28, 29 }, { -52, -95 }, { -94, 30 }, { -93, -92 }, { 32, 47 }, { 33, 40 }, { 34, 37 }, { 35, 36 }, { -91, -90 }, { -89, -88 }, { 38, 39 }, { -87, -86 }, { -85, -84 }, { 41, 44 }, { 42, 43 }, { -83, -82 }, { -81, -80 }, { 45, 46 }, { -79, -51 }, { -50, -49 }, { 48, 55 }, { 49, 52 }, { 50, 51 }, { -48, -47 }, { -46, -45 }, { 53, 54 }, { -44, -43 }, { -42, -41 }, { 56, 59 }, { 57, 58 }, { -40, -39 }, { -38, -37 }, { 60, 61 }, { -36, -35 }, { -34, -33 } }; const int8s f_huffman_env_3_0dB[62][2]= { { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, { -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 }, { 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 }, { 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 }, { 17, 19 }, { -56, 18 }, { -55, -73 }, { 20, 24 }, { 21, 22 }, { -74, -54 }, { -53, 23 }, { -75, -76 }, { 25, 30 }, { 26, 27 }, { -52, -51 }, { 28, 29 }, { -77, -79 }, { -50, -49 }, { 31, 39 }, { 32, 35 }, { 33, 34 }, { -78, -46 }, { -82, -88 }, { 36, 37 }, { -83, -48 }, { -47, 38 }, { -86, -85 }, { 40, 47 }, { 41, 44 }, { 42, 43 }, { -80, -44 }, { -43, -42 }, { 45, 46 }, { -39, -87 }, { -84, -40 }, { 48, 55 }, { 49, 52 }, { 50, 51 }, { -95, -94 }, { -93, -92 }, { 53, 54 }, { -91, -90 }, { -89, -81 }, { 56, 59 }, { 57, 58 }, { -45, -41 }, { -38, -37 }, { 60, 61 }, { -36, -35 }, { -34, -33 } }; const int8s t_huffman_env_bal_3_0dB[24][2]= { { -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 }, { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, { -60, 9 }, { 10, 16 }, { 11, 13 }, { -69, 12 }, { -76, -75 }, { 14, 15 }, { -74, -73 }, { -72, -71 }, { 17, 20 }, { 18, 19 }, { -70, -59 }, { -58, -57 }, { 21, 22 }, { -56, -55 }, { -54, 23 }, { -53, -52 } }; const int8s f_huffman_env_bal_3_0dB[24][2]= { { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, { -60, 9 }, { 10, 13 }, { -69, 11 }, { -59, 12 }, { -58, -76 }, { 14, 17 }, { 15, 16 }, { -75, -74 }, { -73, -72 }, { 18, 21 }, { 19, 20 }, { -71, -70 }, { -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 } }; const int8s t_huffman_noise_3_0dB[62][2]= { { -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 }, { -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 }, { 9, 30 }, { 10, 15 }, { -60, 11 }, { -69, 12 }, { 13, 14 }, { -59, -53 }, { -95, -94 }, { 16, 23 }, { 17, 20 }, { 18, 19 }, { -93, -92 }, { -91, -90 }, { 21, 22 }, { -89, -88 }, { -87, -86 }, { 24, 27 }, { 25, 26 }, { -85, -84 }, { -83, -82 }, { 28, 29 }, { -81, -80 }, { -79, -78 }, { 31, 46 }, { 32, 39 }, { 33, 36 }, { 34, 35 }, { -77, -76 }, { -75, -74 }, { 37, 38 }, { -73, -72 }, { -71, -70 }, { 40, 43 }, { 41, 42 }, { -58, -57 }, { -56, -55 }, { 44, 45 }, { -54, -52 }, { -51, -50 }, { 47, 54 }, { 48, 51 }, { 49, 50 }, { -49, -48 }, { -47, -46 }, { 52, 53 }, { -45, -44 }, { -43, -42 }, { 55, 58 }, { 56, 57 }, { -41, -40 }, { -39, -38 }, { 59, 60 }, { -37, -36 }, { -35, 61 }, { -34, -33 } }; const int8s t_huffman_noise_bal_3_0dB[24][2]= { { -64, 1 }, { -65, 2 }, { -63, 3 }, { 4, 9 }, { -66, 5 }, { -62, 6 }, { 7, 8 }, { -76, -75 }, { -74, -73 }, { 10, 17 }, { 11, 14 }, { 12, 13 }, { -72, -71 }, { -70, -69 }, { 15, 16 }, { -68, -67 }, { -61, -60 }, { 18, 21 }, { 19, 20 }, { -59, -58 }, { -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 } }; //--------------------------------------------------------------------------- // Master frequency band table // k0 = lower frequency boundary const int8s Aac_k0_offset_16[16]= { -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, }; const int8s Aac_k0_offset_22[16]= { -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, }; const int8s Aac_k0_offset_24[16]= { -5, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, }; const int8s Aac_k0_offset_32[16]= { -6, -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, }; const int8s Aac_k0_offset_64[16]= { -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, }; const int8s Aac_k0_offset_96[16]= { -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24, }; const int8s* Aac_k0_offset[9]= { Aac_k0_offset_96, //96000 Aac_k0_offset_96, //88200 Aac_k0_offset_64, //64000 Aac_k0_offset_64, //48000 Aac_k0_offset_64, //44100 Aac_k0_offset_32, //32000 Aac_k0_offset_24, //24000 Aac_k0_offset_22, //22050 Aac_k0_offset_16, //16000 }; const int8u Aac_k0_startMin[9]= { 7, 7, 10, 11, 12, 16, 16, 17, 24, //32, 35, 48, 0, 0, 0, 0, }; //--------------------------------------------------------------------------- // Master frequency band table // k2 = upper frequency boundary const int8u Aac_k2_stopMin[9]= { 13, 15, 20, 21, 23, 32, 32, 35, 48, //64, 70, 96, 0, 0, 0, 0, }; const int8s Aac_k2_offset[9][14]= { { 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 37, 44, 51 }, { 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 36, 42, 49 }, { 0, 2, 4, 6, 8, 11, 14, 17, 21, 25, 29, 34, 39, 44 }, { 0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 33, 38, 43 }, { 0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 32, 36, 41 }, { 0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32 }, { 0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32 }, { 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 20, 23, 26, 29 }, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16 }, }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Aac_GeneralAudio_Sbr_Ps.cpp100777 0 0 7224 12226004262 20632 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AAC_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Aac.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- extern const char* Aac_audioObjectType(int8u audioObjectType); //--------------------------------------------------------------------------- void File_Aac::ps_data(size_t End) { FILLING_BEGIN(); if (Infos["Format_Settings_PS"].empty()) { Infos["Format_Profile"]=__T("HE-AACv2"); Ztring Channels=Infos["Channel(s)"]; Ztring ChannelPositions=Infos["ChannelPositions"]; Ztring SamplingRate=Infos["SamplingRate"]; Infos["Channel(s)"]=__T("2"); Infos["ChannelPositions"]=__T("Front: L R"); if (MediaInfoLib::Config.LegacyStreamDisplay_Get()) { Infos["Format_Profile"]+=__T(" / HE-AAC / LC"); Infos["Channel(s)"]+=__T(" / ")+Channels+__T(" / ")+Channels; Infos["ChannelPositions"]+=__T(" / ")+ChannelPositions+__T(" / ")+ChannelPositions; Infos["SamplingRate"]=Ztring().From_Number((extension_sampling_frequency_index==(int8u)-1)?(sampling_frequency*2):extension_sampling_frequency, 10)+__T(" / ")+SamplingRate; } Infos["Format_Settings_PS"]=__T("Yes (Implicit)"); Ztring Codec=Retrieve(Stream_Audio, StreamPos_Last, Audio_Codec); Infos["Codec"]=Ztring().From_Local(Aac_audioObjectType(audioObjectType))+__T("-SBR-PS"); } FILLING_END(); //Parsing Element_Begin1("ps_data"); bool enable_ps_header; Get_SB(enable_ps_header, "enable_ps_header"); if (enable_ps_header) { //Init delete ps; ps=new ps_handler(); Get_SB(ps->enable_iid, "enable_iid"); if (ps->enable_iid) { Get_S1 (3, ps->iid_mode, "iid_mode"); } Get_SB(ps->enable_icc, "enable_icc"); if (ps->enable_icc) { Get_S1 (3, ps->icc_mode, "icc_mode"); } Get_SB(ps->enable_ext, "enable_ext"); } if (ps==NULL) { if (Data_BS_Remain()>End) Skip_BS(Data_BS_Remain()-End, "(Waiting for header)"); Element_End0(); return; } //PS not yet parsed if (Data_BS_Remain()>End) Skip_BS(Data_BS_Remain()-End, "Data"); Element_End0(); } } //NameSpace #endif //MEDIAINFO_AAC_YES MediaInfoLib/Source/MediaInfo/Audio/File_Aac_GeneralAudio_Sbr_Ps.h100777 0 0 7062 12226004262 20277 0/* 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. */ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_Aac_GeneralAudio_Sbr_PsH #define MediaInfo_File_Aac_GeneralAudio_Sbr_PsH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Aac.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { typedef float complex_t[2]; typedef complex_t qmf_t; #define MAX_PS_ENVELOPES 5 #define NO_ALLPASS_LINKS 3 struct hyb_info { int8u frame_len; int8u resolution20[3]; int8u resolution34[5]; qmf_t *work; qmf_t **buffer; qmf_t **temp; hyb_info(int8u numTimeSlotsRate); ~hyb_info(); }; struct ps_info { //ps_data bool enable_ps_header; bool enable_iid; bool enable_icc; bool enable_ext; int8u iid_mode; int8u nr_iid_par; int8u nr_ipdopd_par; int8u icc_mode; int8u nr_icc_par; bool frame_class; int8u num_env; int8u border_position[MAX_PS_ENVELOPES+1]; int8u iid_dt[MAX_PS_ENVELOPES]; int8u icc_dt[MAX_PS_ENVELOPES]; int8u enable_ipdopd; int8u ipd_mode; int8u ipd_dt[MAX_PS_ENVELOPES]; int8u opd_dt[MAX_PS_ENVELOPES]; /* indices */ int8s iid_index_prev[34]; int8s icc_index_prev[34]; int8s ipd_index_prev[17]; int8s opd_index_prev[17]; int8s iid_index[MAX_PS_ENVELOPES][34]; int8s icc_index[MAX_PS_ENVELOPES][34]; int8s ipd_index[MAX_PS_ENVELOPES][17]; int8s opd_index[MAX_PS_ENVELOPES][17]; int8s ipd_index_1[17]; int8s opd_index_1[17]; int8s ipd_index_2[17]; int8s opd_index_2[17]; /* ps data was correctly read */ int8u ps_data_available; /* a header has been read */ int8u header_read; /* hybrid filterbank parameters */ hyb_info *hyb; int8u use34hybrid_bands; int8u numTimeSlotsRate; /**/ int8u num_groups; int8u num_hybrid_groups; int8u nr_par_bands; int8u nr_allpass_bands; int8u decay_cutoff; int8u *group_border; int16u *map_group2bk; /* filter delay handling */ int8u saved_delay; int8u delay_buf_index_ser[NO_ALLPASS_LINKS]; int8u num_sample_delay_ser[NO_ALLPASS_LINKS]; int8u delay_D[64]; int8u delay_buf_index_delay[64]; complex_t delay_Qmf[14][64]; /* 14 samples delay max, 64 QMF channels */ complex_t delay_SubQmf[2][32]; /* 2 samples delay max (SubQmf is always allpass filtered) */ complex_t delay_Qmf_ser[NO_ALLPASS_LINKS][5][64]; /* 5 samples delay max (table 8.34), 64 QMF channels */ complex_t delay_SubQmf_ser[NO_ALLPASS_LINKS][5][32]; /* 5 samples delay max (table 8.34) */ /* transients */ float alpha_decay; float alpha_smooth; float P_PeakDecayNrg[34]; float P_prev[34]; float P_SmoothPeakDecayDiffNrg_prev[34]; /* mixing and phase */ complex_t h11_prev[50]; complex_t h12_prev[50]; complex_t h21_prev[50]; complex_t h22_prev[50]; int8u phase_hist; complex_t ipd_prev[20][2]; complex_t opd_prev[20][2]; ps_info(int8u sr_index, int8u numTimeSlotsRate); ~ps_info(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Aac_Main.cpp100777 0 0 127652 12264011604 15757 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AAC_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Aac.h" #if MEDIAINFO_ADVANCED #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #endif //MEDIAINFO_ADVANCED #include using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- extern const int32u Aac_sampling_frequency[]= {96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350, 0, 0, 0,}; //--------------------------------------------------------------------------- const char* Aac_Adts_ID[]= { "MPEG-4", "MPEG-2", }; //--------------------------------------------------------------------------- const char* Aac_Format(int8u ID) { switch (ID) { case 1 : case 2 : case 3 : case 4 : return "AAC"; case 5 : return "SBR"; case 6 : return "AAC Scalable"; case 7 : return "TwinVQ"; case 8 : return "CELP"; case 9 : return "HVXC"; case 12 : return "TTSI"; case 13 : return "Main synthetic"; case 14 : return "Wavetable synthesis"; case 15 : return "General MIDI"; case 16 : return "Algorithmic Synthesis and Audio FX"; case 17 : case 19 : case 20 : return "ER AAC"; case 21 : return "ER TwinVQ"; case 22 : return "ER BSAC"; case 23 : return "ER AAC LD"; case 24 : return "ER CELP"; case 25 : return "ER HVXC"; case 26 : return "ER HILN"; case 27 : return "ER Parametric"; case 28 : return "SSC"; case 29 : return "ParametricStereo"; case 32 : return "Layer-1"; case 33 : return "Layer-2"; case 34 : return "Layer-3"; case 35 : return "DST"; case 36 : return "ALS"; case 37 : case 38 : return "SLS"; case 39 : return "ER AAC ELD"; case 40 : return "SMR Simple"; case 41 : return "SMR Main"; default : return ""; } } //--------------------------------------------------------------------------- const char* Aac_Format_Profile(int8u ID) { switch (ID) { case 1 : return "Main"; case 2 : return "LC"; case 3 : return "SSR"; case 4 : return "LTP"; case 17 : return "LC"; case 19 : return "LTP"; case 37 : return "non-core"; default : return ""; } } //--------------------------------------------------------------------------- const char* Aac_audioObjectType(int8u audioObjectType) { switch (audioObjectType) { case 1 : return "AAC Main"; case 2 : return "AAC LC"; case 3 : return "AAC SSR"; case 4 : return "AAC LTP"; case 5 : return "SBR"; case 6 : return "AAC Scalable"; case 7 : return "TwinVQ"; case 8 : return "CELP"; case 9 : return "HVXC"; case 12 : return "TTSI"; case 13 : return "Main synthetic"; case 14 : return "Wavetable synthesis"; case 15 : return "General MIDI"; case 16 : return "Algorithmic Synthesis and Audio FX"; case 17 : return "ER AAC LC"; case 19 : return "ER AAC LTP"; case 20 : return "ER AAC Scalable"; case 21 : return "ER TwinVQ"; case 22 : return "ER BSAC"; case 23 : return "ER AAC LD"; case 24 : return "ER CELP"; case 25 : return "ER HVXC"; case 26 : return "ER HILN"; case 27 : return "ER Parametric"; case 28 : return "SSC"; case 29 : return "PS"; case 31 : return "(escape)"; case 32 : return "Layer-1"; case 33 : return "Layer-2"; case 34 : return "Layer-3"; case 35 : return "DST"; case 36 : return "ALS"; case 37 : return "SLS"; case 38 : return "SLS non-core"; case 39 : return "ER AAC ELD"; case 40 : return "SMR Simple"; case 41 : return "SMR Main"; default : return ""; } } //--------------------------------------------------------------------------- const int8u Aac_Channels[]= { 0, 1, 2, 3, 4, 5, 6, 8, 0, 0, 0, 0, 0, 0, 0, 0, }; //--------------------------------------------------------------------------- const char* Aac_ChannelConfiguration[]= { "", "Front: C", "Front: L R", "Front: L C R", "Front: L C R, Side: C", "Front: L C R, Side: L R", "Front: L C R, Side: L R, LFE", "Front: L C R, Side: L R, Back: L R, LFE", "", "", "", "", "", "", "", "", }; //--------------------------------------------------------------------------- const char* Aac_ChannelConfiguration2[]= { "", "1/0/0", "2/0/0", "3/0/0", "3/1/0", "3/2/0", "3/2/0.1", "3/2/2.1", "", "", "", "", "", "", "", "", }; //--------------------------------------------------------------------------- const char* Aac_ChannelLayout[]= { "", "C", "L R", "C L R", "C L R Cs", "C L R Ls Rs", "C L R Ls Rs LFE", "C L R Ls Rs Lrs Rrs LFE", }; int8u Aac_AudioSpecificConfig_sampling_frequency_index(const int32u sampling_frequency) { if (sampling_frequency>=92017) return 0; if (sampling_frequency>=75132) return 1; if (sampling_frequency>=55426) return 2; if (sampling_frequency>=46009) return 3; if (sampling_frequency>=37566) return 4; if (sampling_frequency>=27713) return 5; if (sampling_frequency>=23004) return 6; if (sampling_frequency>=18783) return 7; if (sampling_frequency>=13856) return 8; if (sampling_frequency>=11502) return 9; if (sampling_frequency>=9391) return 10; return 11; } //--------------------------------------------------------------------------- void File_Aac::AudioSpecificConfig (size_t End) { //Parsing bool sbrData=false, sbrPresentFlag=false, psData=false, psPresentFlag=false; Element_Begin1("AudioSpecificConfig"); GetAudioObjectType(audioObjectType, "audioObjectType"); Get_S1 (4, sampling_frequency_index, "samplingFrequencyIndex"); Param_Info1(Aac_sampling_frequency[sampling_frequency_index]); if (sampling_frequency_index==0xF) { Get_S3 (24, sampling_frequency, "samplingFrequency"); sampling_frequency_index=Aac_AudioSpecificConfig_sampling_frequency_index(sampling_frequency); } else sampling_frequency=Aac_sampling_frequency[sampling_frequency_index]; Get_S1 (4, channelConfiguration, "channelConfiguration"); Param_Info1(Aac_ChannelConfiguration[channelConfiguration]); if (audioObjectType==5 || audioObjectType==29) { extensionAudioObjectType=5; sbrPresentFlag=true; if (audioObjectType==29) psPresentFlag=true; Get_S1 (4, extension_sampling_frequency_index, "extensionSamplingFrequencyIndex"); Param_Info1(Aac_sampling_frequency[extension_sampling_frequency_index]); if (extension_sampling_frequency_index==0xF) { Get_S3 (24, extension_sampling_frequency, "extensionSamplingFrequency"); sampling_frequency_index=Aac_AudioSpecificConfig_sampling_frequency_index(extension_sampling_frequency); } else extension_sampling_frequency=Aac_sampling_frequency[extension_sampling_frequency_index]; GetAudioObjectType(audioObjectType, "audioObjectType"); if (audioObjectType==22) //BSAC Skip_S1(4, "extensionChannelConfiguration"); } else extensionAudioObjectType=0x00; switch (audioObjectType) { case 1: case 2: case 3: case 4: case 6: case 7: case 17: case 19: case 20: case 21: case 22: case 23: GASpecificConfig(); break; case 8: CelpSpecificConfig(); break; case 9: HvxcSpecificConfig(); break; case 12: TTSSpecificConfig(); break; //~ case 13: //~ case 14: //~ case 15: //~ case 16: //~ StructuredAudioSpecificConfig(); //~ break; case 24: ErrorResilientCelpSpecificConfig(); break; case 25: ErrorResilientHvxcSpecificConfig(); break; case 26: case 27: ParametricSpecificConfig(); break; case 28: SSCSpecificConfig(); break; //~ case 30: //~ Skip_S1(1, "sacPayloadEmbedding"); //~ SpatialSpecificConfig(); //ISO/IEC 23003-1 //~ break; case 32: case 33: case 34: MPEG_1_2_SpecificConfig(); break; case 35: DSTSpecificConfig(); break; case 36: Skip_S1(5, "fillBits"); ALSSpecificConfig(); break; case 37: case 38: SLSSpecificConfig(); break; case 39: ELDSpecificConfig(); break; //~ case 40: //~ case 41: //~ SymbolicMusicSpecificConfig(); //ISO/IEC 14496-23 //~ break; default: Element_Begin1("not implemented part"); Skip_BS(Data_BS_Remain()-(End==(size_t)-1)?0:End, "(Not implemented)"); Element_End0(); FILLING_BEGIN() if (Mode==File_Aac::Mode_ADIF || Mode==File_Aac::Mode_ADTS) File__Tags_Helper::Finish(); else if (Mode==Mode_AudioSpecificConfig) File__Analyze::Finish(); Frame_Count=(size_t)-1; //Forcing not to parse following data anymore (if ParseSpeed==1) FILLING_END() return; } switch (audioObjectType) { case 17: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 39: int8u epConfig; Get_S1(2,epConfig, "epConfig"); if ( epConfig == 2 || epConfig == 3 ) ErrorProtectionSpecificConfig(); if ( epConfig == 3 ) { bool directMapping; Get_SB(directMapping, "directMapping"); if ( ! directMapping ) { Element_Begin1("not implemented part"); Skip_BS(Data_BS_Remain()-(End==(size_t)-1)?0:End, "(Not implemented)"); Element_End0(); if (Mode==File_Aac::Mode_ADIF || Mode==File_Aac::Mode_ADTS) File__Tags_Helper::Finish(); else { if (Mode==Mode_LATM) File__Analyze::Accept(); File__Analyze::Finish(); } Frame_Count=(size_t)-1; //Forcing not to parse following data anymore (if ParseSpeed==1) return; } } default : ; } if (extensionAudioObjectType!=5 && End!=(size_t)-1 && Data_BS_Remain()>=End+16) { int16u syncExtensionType; Get_S2(11,syncExtensionType, "syncExtensionType"); if (syncExtensionType == 0x2b7) { sbrData=true; GetAudioObjectType(extensionAudioObjectType, "extensionAudioObjectType"); if (extensionAudioObjectType==5 ) { Get_SB(sbrPresentFlag, "sbrPresentFlag"); if (sbrPresentFlag) { Get_S1 (4, extension_sampling_frequency_index, "extensionSamplingFrequencyIndex"); Param_Info1(Aac_sampling_frequency[extension_sampling_frequency_index]); if (extension_sampling_frequency_index==0xF) { Get_S3 (24, extension_sampling_frequency, "extensionSamplingFrequency"); extension_sampling_frequency_index=Aac_AudioSpecificConfig_sampling_frequency_index(extension_sampling_frequency); } else extension_sampling_frequency=Aac_sampling_frequency[extension_sampling_frequency_index]; if (End!=(size_t)-1 && Data_BS_Remain()>=End+12) { int16u syncExtensionType; Get_S2(11,syncExtensionType, "syncExtensionType"); if (syncExtensionType == 0x548) { psData=true; Get_SB (psPresentFlag, "psPresentFlag"); } } } } if ( extensionAudioObjectType == 22 ) { Get_SB(sbrPresentFlag, "sbrPresentFlag"); if (sbrPresentFlag) { Get_S1 (4, extension_sampling_frequency_index, "extensionSamplingFrequencyIndex"); Param_Info1(Aac_sampling_frequency[extension_sampling_frequency_index]); if (extension_sampling_frequency_index==0xF) { Get_S3 (24, extension_sampling_frequency, "extensionSamplingFrequency"); extension_sampling_frequency_index=Aac_AudioSpecificConfig_sampling_frequency_index(extension_sampling_frequency); } else extension_sampling_frequency=Aac_sampling_frequency[extension_sampling_frequency_index]; } Skip_S1(4, "extensionChannelConfiguration"); } } } Element_End0(); if (Data_BS_Remain()>End) { int8u LastByte=0xFF; if (Data_BS_Remain()-End<8) Peek_S1((int8u)(Data_BS_Remain()-End), LastByte); Skip_BS(Data_BS_Remain()-End, LastByte?"Unknown":"Padding"); } FILLING_BEGIN(); AudioSpecificConfig_OutOfBand (sampling_frequency, audioObjectType, sbrData, psData, sbrPresentFlag, psPresentFlag); FILLING_END(); } //--------------------------------------------------------------------------- void File_Aac::AudioSpecificConfig_OutOfBand (int32u sampling_frequency_, int8u audioObjectType_, bool sbrData, bool psData, bool sbrPresentFlag, bool psPresentFlag) { if (sampling_frequency==(int32u)-1 && sampling_frequency_) //Only if not yet set { sampling_frequency=sampling_frequency_; sampling_frequency_index=Aac_AudioSpecificConfig_sampling_frequency_index(sampling_frequency); } if (audioObjectType_==(int8u)-1) { if (audioObjectType==(int8u)-1) return; //All data is not yet available if (Infos.find("Format_Settings_SBR")!=Infos.end()) { sbrData=true; sbrPresentFlag=Infos["Format_Settings_SBR"].find(__T("Yes"))!=string::npos; } else { sbrData=false; sbrPresentFlag=false; } if (Infos.find("Format_Settings_PS")!=Infos.end()) { psData=true; psPresentFlag=Infos["Format_Settings_PS"].find(__T("Yes"))!=string::npos; } else { psData=false; psPresentFlag=false; } } else audioObjectType=audioObjectType_; if (sampling_frequency) Infos["SamplingRate"].From_Number(sampling_frequency); Infos["Format"].From_Local(Aac_Format(audioObjectType)); Infos["Format_Profile"].From_Local(Aac_Format_Profile(audioObjectType)); Infos["Codec"].From_Local(Aac_audioObjectType(audioObjectType)); if (channelConfiguration && channelConfiguration<8) { Infos["Channel(s)"].From_Number(Aac_Channels[channelConfiguration]); Infos["ChannelPositions"].From_Local(Aac_ChannelConfiguration[channelConfiguration]); Infos["ChannelPositions/String2"].From_Local(Aac_ChannelConfiguration2[channelConfiguration]); Infos["ChannelLayout"].From_Local(Aac_ChannelLayout[channelConfiguration]); } if (sbrPresentFlag || !Infos["Format_Settings_SBR"].empty()) { Infos["Format_Profile"]=__T("HE-AAC"); Ztring SamplingRate_Previous=Infos["SamplingRate"]; int32u SamplingRate=(extension_sampling_frequency_index==(int8u)-1)?(sampling_frequency*2):extension_sampling_frequency; if (SamplingRate) { Infos["SamplingRate"].From_Number(SamplingRate, 10); if (MediaInfoLib::Config.LegacyStreamDisplay_Get()) { Infos["Format_Profile"]+=__T(" / LC"); Infos["SamplingRate"]+=__T(" / ")+SamplingRate_Previous; } } Infos["Format_Settings_SBR"]=__T("Yes (Implicit)"); Infos["Codec"]=Ztring().From_Local(Aac_audioObjectType(audioObjectType))+__T("-SBR"); } else if (sbrData) Infos["Format_Settings_SBR"]=__T("No (Explicit)"); if (psPresentFlag || !Infos["Format_Settings_PS"].empty()) { Infos["Format_Profile"]=__T("HE-AACv2"); Ztring Channels=Infos["Channel(s)"]; Ztring ChannelPositions=Infos["ChannelPositions"]; Ztring SamplingRate_Previous=Infos["SamplingRate"]; Infos["Channel(s)"]=__T("2"); Infos["ChannelPositions"]=__T("Front: L R"); if (MediaInfoLib::Config.LegacyStreamDisplay_Get()) { Infos["Format_Profile"]+=__T(" / HE-AAC / LC"); Infos["Channel(s)"]+=__T(" / ")+Channels+__T(" / ")+Channels; Infos["ChannelPositions"]+=__T(" / ")+ChannelPositions+__T(" / ")+ChannelPositions; int32u SamplingRate=(extension_sampling_frequency_index==(int8u)-1)?(sampling_frequency*2):extension_sampling_frequency; if (SamplingRate) Infos["SamplingRate"]=Ztring().From_Number(SamplingRate, 10)+__T(" / ")+SamplingRate_Previous; } Infos["Format_Settings_PS"]=__T("Yes (Implicit)"); if (StreamPos_Last!=(size_t)-1) { Ztring Codec=Retrieve(Stream_Audio, StreamPos_Last, Audio_Codec); Infos["Codec"]=Ztring().From_Local(Aac_audioObjectType(audioObjectType))+__T("-SBR-PS"); } } else if (psData) Infos["Format_Settings_PS"]=__T("No (Explicit)"); } //--------------------------------------------------------------------------- void File_Aac::GetAudioObjectType(int8u &ObjectType, const char* Name) { Element_Begin1(Name); Get_S1(5, ObjectType, "audioObjectType"); if (ObjectType==31) { Get_S1(6, ObjectType, "audioObjectTypeExt"); ObjectType+=32; } Element_Info1(ObjectType); Element_Info1(Aac_Format_Profile(ObjectType)); Element_End0(); } //*************************************************************************** // Elements - Multiplex layer //*************************************************************************** //--------------------------------------------------------------------------- void File_Aac::AudioMuxElement() { Element_Begin1("AudioMuxElement"); if (muxConfigPresent) { bool useSameStreamMux; Get_SB (useSameStreamMux, "useSameStreamMux"); if (!useSameStreamMux) StreamMuxConfig(); } if (sampling_frequency_index==(int8u)-1) //No previous config { CanFill=false; Skip_BS(Data_BS_Remain(), "(Waiting for configuration)"); return; } if (audioMuxVersionA==0) { for (int8u i=0; i<=numSubFrames; i++) { PayloadLengthInfo(); PayloadMux(); } if (otherDataPresent) { for(int32u i=0; i0) Infos[bitstream_type?"BitRate_Maximum":"BitRate"].From_Number(bitrate); } //No more need data File__Tags_Helper::Finish("ADIF"); FILLING_END(); } //*************************************************************************** // Elements - Audio_Data_Transport_Stream frame, ADTS //*************************************************************************** //--------------------------------------------------------------------------- void File_Aac::adts_frame() { //Parsing adts_fixed_header(); adts_variable_header(); //Encryption management if (CA_system_ID_MustSkipSlices) { //Is not decodable BS_End(); Skip_XX(Element_Size-Element_Offset, "Encrypted data"); Frame_Count_Valid=0; return; } if (num_raw_data_blocks==0) { if (!protection_absent) { Element_Begin1("adts_error_check"); Skip_S2(16, "crc_check"); Element_End0(); } raw_data_block(); } else { Element_Begin1("adts_header_error_check"); if (!protection_absent) for (int i=1; i<=num_raw_data_blocks; i++) Skip_S2(16, "raw_data_block_position(i)"); Skip_S2(16, "crc_check"); Element_End0(); for(int i=0; i<=num_raw_data_blocks; i++) { raw_data_block(); if (!protection_absent) { Element_Begin1("adts_raw_data_block_error_check"); Skip_BS(16, "crc_check"); Element_End0(); } } } } //--------------------------------------------------------------------------- void File_Aac::adts_fixed_header() { //Parsing bool id; Element_Begin1("adts_fixed_header"); Skip_BS(12, "syncword"); Get_SB ( id, "id"); Param_Info1(Aac_Adts_ID[id]); Skip_BS( 2, "layer"); Get_SB ( protection_absent, "protection_absent"); Get_S1 ( 2, audioObjectType, "profile_ObjectType"); audioObjectType++; Param_Info1(Aac_audioObjectType(audioObjectType)); Get_S1 ( 4, sampling_frequency_index, "sampling_frequency_index"); Param_Info2(Aac_sampling_frequency[sampling_frequency_index], " Hz"); sampling_frequency=Aac_sampling_frequency[sampling_frequency_index]; Skip_SB( "private"); Get_S1 ( 3, channelConfiguration, "channel_configuration"); Skip_SB( "original"); Skip_SB( "home"); Element_End0(); FILLING_BEGIN(); if (Infos["Format"].empty()) { Infos_General["Format"].From_Local("ADTS"); Infos["Format"].From_Local("AAC"); Infos["Format_Version"].From_Local(id?"Version 2":"Version 4"); Infos["Format_Profile"].From_Local(Aac_Format_Profile(audioObjectType)); Infos["Codec"].From_Local(Aac_audioObjectType(audioObjectType)); if (Aac_sampling_frequency[sampling_frequency_index]) Infos["SamplingRate"].From_Number(Aac_sampling_frequency[sampling_frequency_index]); Infos["Channel(s)"].From_Number(channelConfiguration); Infos["ChannelPositions"].From_Local(Aac_ChannelConfiguration[channelConfiguration]); Infos["ChannelPositions/String2"].From_Local(Aac_ChannelConfiguration2[channelConfiguration]); Infos["ChannelLayout"].From_Local(Aac_ChannelLayout[channelConfiguration]); if (IsSub) Infos["MuxingMode"].From_Local("ADTS"); } FILLING_END(); } //--------------------------------------------------------------------------- void File_Aac::adts_variable_header() { //Parsing int16u aac_frame_length, adts_buffer_fullness; Element_Begin1("adts_variable_header"); Skip_SB( "copyright_id"); Skip_SB( "copyright_id_start"); Get_S2 (13, aac_frame_length, "aac_frame_length"); Get_S2 (11, adts_buffer_fullness, "adts_buffer_fullness"); Param_Info1(adts_buffer_fullness==0x7FF?"VBR":"CBR"); Get_S1 ( 2, num_raw_data_blocks, "num_raw_data_blocks"); Element_End0(); FILLING_BEGIN(); aac_frame_lengths.push_back(aac_frame_length); Infos["BitRate_Mode"].From_Local(adts_buffer_fullness==0x7FF?"VBR":"CBR"); if (adts_buffer_fullness!=0x7FF #if MEDIAINFO_ADVANCED || Config->File_RiskyBitRateEstimation_Get() #endif //MEDIAINFO_ADVANCED ) { //Calculating int64u aac_frame_length_Total=0; for (size_t Pos=0; Pos using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Speech coding (HVXC) //*************************************************************************** //--------------------------------------------------------------------------- void File_Aac::HvxcSpecificConfig() { Element_Begin1("HvxcSpecificConfig"); bool isBaseLayer; Get_SB(isBaseLayer, "isBaseLayer"); if (isBaseLayer) HVXCconfig(); Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::HVXCconfig() { Element_Begin1("HVXCconfig"); Skip_SB( "HVXCvarMode"); Skip_S1(2, "HVXCrateMode"); Skip_SB( "extensionFlag"); //~ if (extensionFlag) { /*< to be defined in MPEG-4 Version 2 >*/ //~ } Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::ErrorResilientHvxcSpecificConfig() { Element_Begin1("ErrorResilientHvxcSpecificConfig"); bool isBaseLayer; Get_SB(isBaseLayer,"isBaseLayer"); if (isBaseLayer) { ErHVXCconfig(); } Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::ErHVXCconfig() { Element_Begin1("ErHVXCconfig"); bool extensionFlag; Skip_SB( "HVXCvarMode"); Skip_S1(2, "HVXCrateMode"); Get_SB (extensionFlag, "extensionFlag"); if (extensionFlag) { Skip_SB( "var_ScalableFlag"); } Element_End0(); } //*************************************************************************** // Speech Coding (CELP) //*************************************************************************** //--------------------------------------------------------------------------- void File_Aac::CelpSpecificConfig () { Element_Begin1("CelpSpecificConfig"); bool isBaseLayer; Get_SB(isBaseLayer, "isBaseLayer"); if (isBaseLayer) { CelpHeader (); } else { bool isBWSLayer; Get_SB(isBWSLayer, "isBWSLayer"); if (isBWSLayer) { //~ CelpBWSenhHeader () //~ { Skip_S1(2, "BWS_configuration"); //~ } } else { Skip_S1(2, "CELP-BRS-id"); } } Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::CelpHeader () { Element_Begin1("CelpHeader"); bool ExcitationMode; Get_SB(ExcitationMode, "ExcitationMode"); Skip_SB( "SampleRateMode"); Skip_SB( "FineRateControl"); if (ExcitationMode == 1/*RPE*/) { Skip_S1(3, "RPE_Configuration"); } if (ExcitationMode == 0/*MPE*/) { Skip_S1(5, "MPE_Configuration"); Skip_S1(2, "NumEnhLayers"); Skip_SB( "BandwidthScalabilityMode"); } Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::ErrorResilientCelpSpecificConfig () { Element_Begin1("ErrorResilientCelpSpecificConfig"); bool isBaseLayer; Get_SB(isBaseLayer, "isBaseLayer"); if (isBaseLayer) { ER_SC_CelpHeader (); } else { bool isBWSLayer; Get_SB(isBWSLayer, "isBWSLayer"); if (isBWSLayer) { //~ CelpBWSenhHeader () //~ { Skip_S1(2, "BWS_configuration"); //~ } } else { Skip_S1(2, "CELP-BRS-id"); } } Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::ER_SC_CelpHeader () { Element_Begin1("ER_SC_CelpHeader"); bool ExcitationMode; Get_SB(ExcitationMode, "ExcitationMode"); Skip_SB( "SampleRateMode"); Skip_SB( "FineRateControl"); Skip_SB( "SilenceCompression"); if (ExcitationMode == 1/*RPE*/) { Skip_S1(3, "RPE_Configuration"); } if (ExcitationMode == 0/*MPE*/) { Skip_S1(5, "MPE_Configuration"); Skip_S1(2, "NumEnhLayers"); Skip_SB( "BandwidthScalabilityMode"); } Element_End0(); } //*************************************************************************** // Structured Audio (SA) //*************************************************************************** //*************************************************************************** // Text to Speech Interface (TTSI) //*************************************************************************** //--------------------------------------------------------------------------- void File_Aac::TTSSpecificConfig() { Element_Begin1("TTSSpecificConfig"); //~ TTS_Sequence() //~ { Skip_S1(5, "TTS_Sequence_ID"); Skip_BS(18, "Language_Code"); Skip_SB( "Gender_Enable"); Skip_SB( "Age_Enable"); Skip_SB( "Speech_Rate_Enable"); Skip_SB( "Prosody_Enable"); Skip_SB( "Video_Enable"); Skip_SB( "Lip_Shape_Enable"); Skip_SB( "Trick_Mode_Enable"); //~ } Element_End0(); } //*************************************************************************** // Parametric Audio (HILN) //*************************************************************************** //--------------------------------------------------------------------------- void File_Aac::HILNconfig() { Element_Begin1("HILNconfig"); Skip_SB( "HILNquantMode"); Skip_S1(8, "HILNmaxNumLine"); Skip_S1(4, "HILNsampleRateCode"); Skip_S2(12, "HILNframeLength"); Skip_S1(2, "HILNcontMode"); Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::HILNenexConfig() { Element_Begin1("HILNenexConfig"); bool HILNenhaLayer; Get_SB(HILNenhaLayer, "HILNenhaLayer"); if (HILNenhaLayer) Skip_S1(2, "HILNenhaQuantMode"); Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::ParametricSpecificConfig() { Element_Begin1("ParametricSpecificConfig"); bool isBaseLayer; Get_SB(isBaseLayer, "isBaseLayer"); if (isBaseLayer) PARAconfig(); else HILNenexConfig(); Element_End0(); } //--------------------------------------------------------------------------- void File_Aac::PARAconfig() { Element_Begin1("PARAconfig"); int8u PARAmode; Get_S1(2,PARAmode, "PARAmode"); if (PARAmode != 1) ErHVXCconfig(); if (PARAmode != 0) HILNconfig(); bool PARAextensionFlag; Get_SB(PARAextensionFlag, "PARAextensionFlag"); if (PARAextensionFlag) { /* to be defined in MPEG-4 Phase 3 */ } Element_End0(); } //*************************************************************************** // Technical description of parametric coding for high quality audio //*************************************************************************** //--------------------------------------------------------------------------- void File_Aac::SSCSpecificConfig () { Element_Begin1("SSCSpecificConfig"); Skip_S1(2,"decoder_level"); Skip_S1(4,"update_rate"); Skip_S1(2,"synthesis_method"); if (channelConfiguration != 1) { int8u mode_ext; Get_S1(2,mode_ext,"mode_ext"); if ((channelConfiguration == 2) && (mode_ext == 1)) { /*reserved*/ } } Element_End0(); } //*************************************************************************** // MPEG-1/2 Audio //*************************************************************************** //--------------------------------------------------------------------------- void File_Aac::MPEG_1_2_SpecificConfig() { Element_Begin1("MPEG_1_2_SpecificConfig"); Skip_SB( "extension"); Element_End0(); } //*************************************************************************** // Technical description of lossless coding of oversampled audio //*************************************************************************** //--------------------------------------------------------------------------- void File_Aac::DSTSpecificConfig() { Element_Begin1("DSTSpecificConfig"); Skip_SB("DSDDST_Coded"); Skip_S2(14,"N_Channels"); Skip_SB("reserved"); Element_End0(); } //*************************************************************************** // Audio Lossless //*************************************************************************** //--------------------------------------------------------------------------- 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(); } //*************************************************************************** // Scalable lossless //*************************************************************************** //--------------------------------------------------------------------------- void File_Aac::SLSSpecificConfig() { Element_Begin1("SLSSpecificConfig"); Skip_S1(3,"pcmWordLength"); Skip_SB("aac_core_present"); Skip_SB("lle_main_stream"); Skip_SB("reserved_bit"); Skip_S1(3,"frameLength"); if (!channelConfiguration) program_config_element(); Element_End0(); } } //NameSpace #endif //MEDIAINFO_AAC_YES MediaInfoLib/Source/MediaInfo/Audio/File_Ac3.cpp100777 0 0 272711 12253642627 14747 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //*************************************************************************** // Infos (Common) //*************************************************************************** //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AC3_YES) || defined(MEDIAINFO_DVDV_YES) || defined(MEDIAINFO_MPEGPS_YES) || defined(MEDIAINFO_MPEGTS_YES) //--------------------------------------------------------------------------- #include "ZenLib/Conf.h" using namespace ZenLib; namespace MediaInfoLib { //--------------------------------------------------------------------------- extern const int32u AC3_SamplingRate[]= { 48000, 44100, 32000, 0,}; //--------------------------------------------------------------------------- const char* AC3_Mode[]= { "CM (complete main)", "ME (music and effects)", "VI (visually impaired)", "HI (hearing impaired)", "D (dialogue)", "C (commentary)", "E (emergency)", "VO (voice over)", }; //--------------------------------------------------------------------------- const char* AC3_Surround[]= { "", "Not Dolby Surround encoded", "Dolby Surround encoded", "", }; //--------------------------------------------------------------------------- extern const int16u AC3_BitRate[]= { 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 576, 640, }; //--------------------------------------------------------------------------- extern const int8u AC3_Channels[]= {2, 1, 2, 3, 3, 4, 4, 5}; //--------------------------------------------------------------------------- } //NameSpace //--------------------------------------------------------------------------- #endif //... //--------------------------------------------------------------------------- //*************************************************************************** // //*************************************************************************** //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AC3_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Ac3.h" #include #include #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "MediaInfo/MediaInfo_Events_Internal.h" #endif //MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Internal.h" using namespace ZenLib; using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const int32u AC3_SamplingRate2[]= { 24000, 22050, 16000, 0,}; //--------------------------------------------------------------------------- const char* AC3_ChannelPositions[]= { "Dual mono", "Front: C", "Front: L R", "Front: L C R", "Front: L R, Back: C", "Front: L C R, Back: C", "Front: L R, Side: L R", "Front: L C R, Side: L R", }; //--------------------------------------------------------------------------- const char* AC3_ChannelPositions2[]= { "1+1", "1/0/0", "2/0/0", "3/0/0", "2/1/0", "3/1/0", "2/2/0", "3/2/0", }; //--------------------------------------------------------------------------- const char* AC3_ChannelLayout_lfeoff[]= { "1+1", "C", "L R", "L C R", "L R S", "L C R Cs", "L R Ls Rs", "L C R Ls Rs", }; //--------------------------------------------------------------------------- const char* AC3_ChannelLayout_lfeon[]= { "1+1 LFE", "C LFE", "L R LFE", "L C R LFE", "L R S LFE", "L C R LFE Cs", "L R LFE Ls Rs", "L C R LFE Ls Rs", }; //--------------------------------------------------------------------------- int16u AC3_acmod2chanmap[]= { 0xA000, 0x4000, 0xA000, 0xE000, 0xA100, 0xE100, 0xB900, 0xF800, }; //--------------------------------------------------------------------------- Ztring AC3_chanmap_ChannelPositions (int16u chanmap) { Ztring Front; Ztring Side; Ztring Back; Ztring More; for (int8u Pos=0; Pos<16; Pos++) { if (chanmap&(1<<(15-Pos))) { switch (Pos) { case 0 : Front+=__T(" L"); break; case 1 : Front+=__T(" C"); break; case 2 : Front+=__T(" R"); break; case 3 : Side+=__T(" L"); break; case 4 : Side+=__T(" R"); break; case 5 : { bool HasR=false; if (Front.find(__T(" R"))!=string::npos) { Front.resize(Front.size()-2); HasR=true; } Front+=__T(" C C"); if (HasR) Front+=__T(" R"); } break; case 6 : Back+=__T(" L R"); break; case 7 : if (Back.empty()) Back=__T(" C"); else Back=__T(" L C R"); break; case 15 : More+=__T(", LFE"); break; default: ; } } } Ztring ToReturn; if (!Front.empty()) { ToReturn+=__T("Front:")+Front; } if (!Side.empty()) { if (!ToReturn.empty()) ToReturn+=__T(", "); ToReturn+=__T("Side:")+Side; } if (!Back.empty()) { if (!ToReturn.empty()) ToReturn+=__T(", "); ToReturn+=__T("Back:")+Back; } ToReturn+=More; return ToReturn; } //--------------------------------------------------------------------------- int8u AC3_chanmap_Channels (int16u chanmap) { int8u Channels=0; for (int8u Pos=0; Pos<16; Pos++) { if (chanmap&(1<<(15-Pos))) { switch (Pos) { case 5 : case 6 : case 9 : case 10 : case 11 : Channels+=2; break; default: Channels++; break; } } } return Channels; } //--------------------------------------------------------------------------- Ztring AC3_chanmap_ChannelLayout (int16u chanmap, const Ztring &ChannelLayout0) { Ztring ToReturn=ChannelLayout0; for (int8u Pos=0; Pos<16; Pos++) { if (chanmap&(1<<(15-Pos))) { switch (Pos) { case 5 : ToReturn+=__T(" Lc Rc"); break; case 6 : ToReturn+=__T(" Lrs Rrs"); break; case 7 : ToReturn+=__T(" Cs"); default: ; } } } return ToReturn; } //--------------------------------------------------------------------------- const int16u AC3_FrameSize[27][4]= { { 128, 138, 192, 0}, { 160, 174, 240, 0}, { 192, 208, 288, 0}, { 224, 242, 336, 0}, { 256, 278, 384, 0}, { 320, 348, 480, 0}, { 384, 416, 576, 0}, { 448, 486, 672, 0}, { 512, 556, 768, 0}, { 640, 696, 960, 0}, { 768, 834, 1152, 0}, { 896, 974, 1344, 0}, {1024, 1114, 1536, 0}, {1280, 1392, 1920, 0}, {1536, 1670, 2304, 0}, {1792, 1950, 2688, 0}, {2048, 2228, 3072, 0}, {2304, 2506, 3456, 0}, {2560, 2786, 3840, 0}, { 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 0, 0}, { 768, 0, 0, 0}, }; //--------------------------------------------------------------------------- int16u AC3_FrameSize_Get(int8u frmsizecod, int8u fscod) { bool Padding=(frmsizecod%2)?true:false; int16u frame_size_id=frmsizecod/2; if (frame_size_id>26 || fscod>3) return 0; int16u FrameSize=AC3_FrameSize[frame_size_id][fscod]; if (fscod==1 && Padding) FrameSize+=2; // frame lengths are padded by 1 word (16 bits) at 44100 Hz return FrameSize; } //--------------------------------------------------------------------------- // CRC_16_Table // A CRC is computed like this: // Init: int32u CRC_16 = 0x0000; // for each data byte do // CRC_16=(CRC_16<<8) ^ CRC_16_Table[(CRC_16>>8)^(data_byte)]; int16u CRC_16_Table[256] = { 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011, 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022, 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072, 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041, 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2, 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1, 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1, 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082, 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192, 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1, 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1, 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2, 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151, 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162, 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132, 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101, 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312, 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321, 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371, 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342, 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1, 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2, 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2, 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381, 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291, 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2, 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2, 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1, 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252, 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261, 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231, 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202 }; int CRC16_Init(int16u *Table, int16u Polynomial) { for (size_t Pos=0; Pos<256; Pos++) { Table[Pos]=(int16u)Pos<<8; for(int8u bit=0; bit<8; bit++) { if (Table[Pos]&0x8000) Table[Pos]=(Table[Pos]<<1)^Polynomial; else Table[Pos]=Table[Pos]<<1; } } return 0; } //--------------------------------------------------------------------------- const float64 AC3_dynrng[]= { 6.02, 12.04, 18.06, 24.08, -18.06, -12.04, - 6.02, 0.00, }; //--------------------------------------------------------------------------- const float64 AC3_compr[]= { 6.02, 12.04, 18.06, 24.08, 30.10, 36.12, 42.14, 48.16, -42.14, -36.12, -30.10, -24.08, -18.06, -12.04, - 6.02, 0.00, }; //--------------------------------------------------------------------------- const char* AC3_HD_StreamType(int8u StreamType) { switch (StreamType) { case 0xBA : return "TrueHD"; case 0xBB : return "MLP"; default : return ""; } } //--------------------------------------------------------------------------- int32u AC3_HD_SamplingRate(int8u SamplingRate) { if (SamplingRate==0xF) return 0; return ((SamplingRate&8)?44100:48000)<<(SamplingRate&7) ; } //--------------------------------------------------------------------------- static const int8u AC3_TrueHD_ChannelCountPerBit[13]= { 2, //LR 1, //C 1, //LFE 2, //LRs 2, //LRvh 2, //LRc 2, //LRrs 1, //Cs 1, //Ts 2, //LRsd 2, //LRw 1, //Cvh 1, //LFE2 }; //--------------------------------------------------------------------------- int8u AC3_TrueHD_Channels(int16u ChannelsMap) { int8u Channels=0; for (int8u Pos=0; Pos<13; Pos++) Channels+=AC3_TrueHD_ChannelCountPerBit[Pos]*((ChannelsMap>>Pos)&0x1); return Channels; } //--------------------------------------------------------------------------- std::string AC3_TrueHD_Channels_Positions(int16u ChannelsMap) { std::string Text; if ((ChannelsMap&0x0003)==0x0003) Text+="Front: L C R"; else { if (ChannelsMap&0x0001) Text+="Front: C"; if (ChannelsMap&0x0002) Text+="Front: L, R"; } if (ChannelsMap&0x08) Text+=", Side: L R"; if (ChannelsMap&0x80) Text+=", Back: C"; if ((ChannelsMap&0x0810)==0x0810) Text+=", vh: L C R"; else { if (ChannelsMap&0x0010) Text+=", vh: L R"; if (ChannelsMap&0x0800) Text+=", vh: C"; } if (ChannelsMap&0x0020) Text+=", c: L R"; if (ChannelsMap&0x0040) Text+=", Back: L R"; if (ChannelsMap&0x0100) Text+=", s: T"; if (ChannelsMap&0x0200) Text+=", sd: L R"; if (ChannelsMap&0x0400) Text+=", w: L R"; if (ChannelsMap&0x0004) Text+=", LFE"; if (ChannelsMap&0x1000) Text+=", LFE2"; return Text; } //--------------------------------------------------------------------------- Ztring AC3_TrueHD_Channels_Positions2(int16u ChannelsMap) { int8u Front=0, Surround=0, Rear=0, LFE=0; if (ChannelsMap&0x0001) Front++; if (ChannelsMap&0x0002) Front+=2; if (ChannelsMap&0x08) Surround+=2; if (ChannelsMap&0x80) Surround++; if (ChannelsMap&0x0010) Rear+=2; //vh if (ChannelsMap&0x0800) Rear++; //vh if (ChannelsMap&0x0020) Rear+=2; //c if (ChannelsMap&0x0040) Rear+=2; //rs if (ChannelsMap&0x0100) Rear+=2; //s if (ChannelsMap&0x0200) Rear+=2; //sd if (ChannelsMap&0x0400) Rear+=2; //w if (ChannelsMap&0x0004) LFE++; if (ChannelsMap&0x1000) LFE++; Ztring Text; Text+=Ztring::ToZtring(Front); Text+=__T('/')+Ztring::ToZtring(Surround); Text+=__T('/')+Ztring::ToZtring(Rear); Text+=__T('.')+Ztring::ToZtring(LFE); return Text; } //--------------------------------------------------------------------------- static const int32u AC3_MLP_Channels[32]= { 1, 2, 3, 4, 3, 4, 5, 3, 4, 5, 4, 5, 6, 4, 5, 4, 5, 6, 5, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; //--------------------------------------------------------------------------- static const int32u AC3_MLP_Resolution[16]= { 16, 20, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Ac3::File_Ac3() :File__Analyze() { //Configuration #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Ac3; StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_TRACE Trace_Layers_Update(8); //Stream #endif //MEDIAINFO_TRACE MustSynchronize=true; Buffer_TotalBytes_FirstSynched_Max=32*1024; Buffer_TotalBytes_Fill_Max=1024*1024; PTS_DTS_Needed=true; IsRawStream=true; Frame_Count_NotParsedIncluded=0; //In Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.3?32:2; MustParse_dac3=false; MustParse_dec3=false; CalculateDelay=false; //Buffer Save_Buffer=NULL; //Temp Frame_Count_HD=0; fscod=0; fscod2=0; frmsizecod=0; bsid_Max=(int8u)-1; for (int8u Pos=0; Pos<8; Pos++) for (int8u Pos2=0; Pos2<9; Pos2++) { frmsizplus1_Max[Pos][Pos2]=0; acmod_Max[Pos][Pos2]=(int8u)-1; lfeon_Max[Pos][Pos2]=false; bsmod_Max[Pos][Pos2]=0; dsurmod_Max[Pos][Pos2]=0; chanmape_Max[Pos][Pos2]=false; chanmap_Max[Pos][Pos2]=0; } numblkscod=0; substreamid_Independant_Current=0; substreams_Count=0; dxc3_Parsed=false; HD_MajorSync_Parsed=false; Core_IsPresent=false; HD_IsPresent=false; dynrnge_Exists=false; TimeStamp_IsPresent=false; TimeStamp_IsParsing=false; TimeStamp_Parsed=false; TimeStamp_DropFrame_IsValid=false; BigEndian=true; IgnoreCrc_Done=false; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Ac3::Streams_Fill() { if (HD_MajorSync_Parsed) { Stream_Prepare(Stream_Audio); if (HD_BitRate_Max) Fill(Stream_Audio, 0, Audio_BitRate_Maximum, (HD_BitRate_Max*AC3_HD_SamplingRate(HD_SamplingRate2)+8)>>4); if (HD_StreamType==0xBA) //TrueHD { Fill(Stream_General, 0, General_Format, "TrueHD"); Fill(Stream_Audio, 0, Audio_Format, "TrueHD"); Fill(Stream_Audio, 0, Audio_Codec, "TrueHD"); Fill(Stream_Audio, 0, Audio_BitRate_Mode, "VBR"); Fill(Stream_Audio, 0, Audio_SamplingRate, AC3_HD_SamplingRate(HD_SamplingRate1)); Fill(Stream_Audio, 0, Audio_Channel_s_, AC3_TrueHD_Channels(HD_Channels2)); Fill(Stream_Audio, 0, Audio_ChannelPositions, AC3_TrueHD_Channels_Positions(HD_Channels2)); Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, AC3_TrueHD_Channels_Positions2(HD_Channels2)); if (Core_IsPresent && !IsSub) Fill(Stream_Audio, 0, Audio_MuxingMode, "After core data"); } if (HD_StreamType==0xBB) //TrueHD { Fill(Stream_General, 0, General_Format, "MLP"); if (!Core_IsPresent) { Fill(Stream_Audio, 0, Audio_Format, "MLP"); Fill(Stream_Audio, 0, Audio_Codec, "MLP"); } Fill(Stream_Audio, 0, Audio_BitRate_Mode, "VBR"); Fill(Stream_Audio, 0, Audio_SamplingRate, AC3_HD_SamplingRate(HD_SamplingRate2)); if (HD_SamplingRate1!=HD_SamplingRate2) Fill(Stream_Audio, 0, Audio_SamplingRate, AC3_HD_SamplingRate(HD_SamplingRate2)); Fill(Stream_Audio, 0, Audio_Channel_s_, AC3_MLP_Channels[HD_Channels1]); if (HD_Channels1!=HD_Channels2) Fill(Stream_Audio, 0, Audio_Channel_s_, AC3_MLP_Channels[HD_Channels1]); Fill(Stream_Audio, 0, Audio_BitDepth, AC3_MLP_Resolution[HD_Resolution2]); if (HD_Resolution1!=HD_Resolution2) Fill(Stream_Audio, 0, Audio_BitDepth, AC3_MLP_Resolution[HD_Resolution1]); } } //AC-3 if (bsid_Max<=0x09) { if (Count_Get(Stream_Audio)==0) Stream_Prepare(Stream_Audio); Fill(Stream_General, 0, General_Format, "AC-3"); Fill(Stream_Audio, 0, Audio_Format, "AC-3"); Fill(Stream_Audio, 0, Audio_Codec, "AC3"); Fill(Stream_Audio, 0, Audio_BitDepth, 16); int32u Divider=bsid_Max==9?2:1; // Unofficial hack for low sample rate (e.g. 22.05 kHz) if (Ztring::ToZtring(AC3_SamplingRate[fscod]/Divider)!=Retrieve(Stream_Audio, 0, Audio_SamplingRate)) Fill(Stream_Audio, 0, Audio_SamplingRate, AC3_SamplingRate[fscod]/Divider); if (frmsizecod/2<19) { if (Frame_Count_HD) Fill(Stream_Audio, 0, Audio_BitRate, "Unknown"); int32u BitRate=AC3_BitRate[frmsizecod/2]*1000; int32u Divider=bsid_Max==9?2:1; // Unofficial hack for low sample rate (e.g. 22.05 kHz) Fill(Stream_Audio, 0, Audio_BitRate, BitRate/Divider); if (CalculateDelay && Buffer_TotalBytes_FirstSynched>100 && BitRate>0) { Fill(Stream_Audio, 0, Audio_Delay, (float)Buffer_TotalBytes_FirstSynched*8*1000/BitRate, 0); Fill(Stream_Audio, 0, Audio_Delay_Source, "Stream"); } } Fill(Stream_Audio, 0, Audio_Format_Settings_ModeExtension, AC3_Mode[bsmod_Max[0][0]]); if (acmod_Max[0][0]==0) Fill(Stream_Audio, 0, Audio_Format_Settings_Mode, "Dual Mono"); if (acmod_Max[0][0]!=(int8u)-1) { int8u Channels=AC3_Channels[acmod_Max[0][0]]; Ztring ChannelPositions; ChannelPositions.From_Local(AC3_ChannelPositions[acmod_Max[0][0]]); Ztring ChannelPositions2; ChannelPositions2.From_Local(AC3_ChannelPositions2[acmod_Max[0][0]]); Ztring ChannelLayout; ChannelLayout.From_Local(lfeon_Max[0][0]?AC3_ChannelLayout_lfeon[acmod_Max[0][0]]:AC3_ChannelLayout_lfeoff[acmod_Max[0][0]]); if (lfeon_Max[0][0]) { Channels+=1; ChannelPositions+=__T(", LFE"); ChannelPositions2+=__T(".1"); } if (Ztring::ToZtring(Channels)!=Retrieve(Stream_Audio, 0, Audio_Channel_s_)) Fill(Stream_Audio, 0, Audio_Channel_s_, Channels); if (ChannelPositions!=Retrieve(Stream_Audio, 0, Audio_ChannelPositions)) Fill(Stream_Audio, 0, Audio_ChannelPositions, ChannelPositions); if (ChannelPositions2!=Retrieve(Stream_Audio, 0, Audio_ChannelPositions_String2)) Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, ChannelPositions2); if (ChannelLayout!=Retrieve(Stream_Audio, 0, Audio_ChannelLayout)) Fill(Stream_Audio, 0, Audio_ChannelLayout, ChannelLayout); } if (dsurmod_Max[0][0]==2) { Fill(Stream_Audio, 0, Audio_Format_Profile, "Dolby Digital"); Fill(Stream_Audio, 0, Audio_Codec_Profile, "Dolby Digital"); } if (__T("CBR")!=Retrieve(Stream_Audio, 0, Audio_BitRate_Mode)) Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR"); } //E-AC-3 else if (bsid_Max<=0x10) { for (size_t Pos=0; Pos<8; Pos++) if (acmod_Max[Pos][0]!=(int8u)-1) { Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "E-AC-3"); Fill(Stream_Audio, 0, Audio_Codec, "AC3+"); if (acmod_Max[1][0]!=(int8u)-1) Fill(Stream_Audio, 0, Audio_ID, 1+Pos); Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR"); int8u numblks=numblkscod==3?6:numblkscod+1; int32u frmsiz_Total=0; for (size_t Pos2=0; Pos2<8; Pos2++) frmsiz_Total+=frmsizplus1_Max[Pos][Pos2]; if (numblks>0) { Fill(Stream_Audio, 0, Audio_BitRate, ((frmsiz_Total*2)*8*(750/numblks))/4); if (frmsizplus1_Max[Pos][1]) //If dependand substreams Fill(Stream_Audio, 0, Audio_BitRate, ((frmsizplus1_Max[Pos][0]*2)*8*(750/numblks))/4); } if (fscod!=2) Fill(Stream_Audio, 0, Audio_SamplingRate, AC3_SamplingRate[fscod]); else Fill(Stream_Audio, 0, Audio_SamplingRate, AC3_SamplingRate2[fscod2]); if (acmod_Max[Pos][1]!=(int8u)-1) { int16u chanmap_Final=0; for (int8u Pos2=0; Pos2<9; Pos2++) if (acmod_Max[Pos][Pos2]!=(int8u)-1) { if (chanmape_Max[Pos][Pos2]) chanmap_Final|=chanmap_Max[Pos][Pos2]; else { chanmap_Final|=AC3_acmod2chanmap[acmod_Max[Pos][Pos2]]; if (lfeon_Max[Pos][Pos2]) chanmap_Final|=1; // LFE position in chanmap is bit 0 } } Fill(Stream_Audio, 0, Audio_Channel_s_, AC3_chanmap_Channels(chanmap_Final)); Fill(Stream_Audio, 0, Audio_ChannelPositions, AC3_chanmap_ChannelPositions(chanmap_Final)); Ztring ChannelLayout; ChannelLayout.From_Local(lfeon_Max[0][0]?AC3_ChannelLayout_lfeon[acmod_Max[0][0]]:AC3_ChannelLayout_lfeoff[acmod_Max[0][0]]); Fill(Stream_Audio, 0, Audio_ChannelLayout, AC3_chanmap_ChannelLayout(chanmap_Final, ChannelLayout)); } if (acmod_Max[Pos][0]==0) { Fill(Stream_Audio, 0, Audio_Format_Profile, "Dual Mono"); Fill(Stream_Audio, 0, Audio_Codec_Profile, "Dual Mono"); } else if (acmod_Max[Pos][0]!=(int8u)-1) { int8u Channels=AC3_Channels[acmod_Max[Pos][0]]; Ztring ChannelPositions; ChannelPositions.From_Local(AC3_ChannelPositions[acmod_Max[Pos][0]]); if (lfeon_Max[Pos][0]) { Channels+=1; ChannelPositions+=__T(", LFE"); } Fill(Stream_Audio, 0, Audio_Channel_s_, Channels); Fill(Stream_Audio, 0, Audio_ChannelPositions, ChannelPositions); Fill(Stream_Audio, 0, Audio_ChannelLayout, lfeon_Max[0][0]?AC3_ChannelLayout_lfeon[acmod_Max[0][0]]:AC3_ChannelLayout_lfeoff[acmod_Max[0][0]]); } } } if (HD_MajorSync_Parsed) { //Filling Maximum bitrate with the constant core bitrate for better coherancy ZtringList List; List.Separator_Set(0, __T(" / ")); List.Write(Retrieve(Stream_Audio, 0, Audio_BitRate)); if (List.size()>=2) Fill(Stream_Audio, 0, Audio_BitRate_Maximum, List[1]); } //Dolby Metadata if (Core_IsPresent) { //Endianess Fill(Stream_Audio, 0, Audio_Format_Settings_Endianness, BigEndian?"Big":"Little"); Fill(Stream_Audio, 0, "bsid", bsid_Max); Fill(Stream_Audio, 0, "dialnorm", FirstFrame_Dolby.dialnorm==0?-31:-FirstFrame_Dolby.dialnorm); (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dialnorm"), Info_Options)=__T("N NT"); Fill(Stream_Audio, 0, "dialnorm/String", Ztring::ToZtring(FirstFrame_Dolby.dialnorm==0?-31:-FirstFrame_Dolby.dialnorm)+__T(" dB")); (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dialnorm/String"), Info_Options)=__T("N NT"); if (FirstFrame_Dolby.compre) { float64 Value=AC3_compr[FirstFrame_Dolby.compr>>4]+20*std::log10(((float)(0x10+(FirstFrame_Dolby.compr&0x0F)))/32); Fill(Stream_Audio, 0, "compr", Value, 2); (*Stream_More)[Stream_Audio][0](Ztring().From_Local("compr"), Info_Options)=__T("N NT"); Fill(Stream_Audio, 0, "compr/String", Ztring::ToZtring(Value, 2)+__T(" dB")); (*Stream_More)[Stream_Audio][0](Ztring().From_Local("compr/String"), Info_Options)=__T("N NT"); } if (FirstFrame_Dolby.dynrnge) { float64 Value; if (FirstFrame_Dolby.dynrng==0) Value=0; //Special case in the formula else Value=AC3_dynrng[FirstFrame_Dolby.dynrng>>5]+20*std::log10(((float)(0x20+(FirstFrame_Dolby.dynrng&0x1F)))/64); Fill(Stream_Audio, 0, "dynrng", Value, 2); (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dynrng"), Info_Options)=__T("N NT"); Fill(Stream_Audio, 0, "dynrng/String", Ztring::ToZtring(Value, 2)+__T(" dB")); (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dynrng/String"), Info_Options)=__T("N NT"); } for (int8u Pos=0; Pos<8; Pos++) for (int8u Pos2=0; Pos2<9; Pos2++) { if (acmod_Max[Pos][Pos2]==(int8u)-1) break; if (acmod_Max[Pos][Pos2]!=(int8u)-1) { if (acmod_Max[Pos][Pos2]==2) { Fill(Stream_Audio, 0, "dsurmod", dsurmod_Max[Pos][Pos2]); (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dsurmod"), Info_Options)=__T("N NT"); Fill(Stream_Audio, 0, "dsurmod/String", AC3_Surround[dsurmod_Max[Pos][Pos2]]); (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dsurmod/String"), Info_Options)=__T("N NT"); } (*Stream_More)[Stream_Audio][0](Ztring().From_Local("bsid"), Info_Options)=__T("N NT"); Fill(Stream_Audio, 0, "acmod", acmod_Max[Pos][Pos2]); (*Stream_More)[Stream_Audio][0](Ztring().From_Local("acmod"), Info_Options)=__T("N NT"); Fill(Stream_Audio, 0, "lfeon", (lfeon_Max[Pos][Pos2])?1:0); (*Stream_More)[Stream_Audio][0](Ztring().From_Local("lfeon"), Info_Options)=__T("N NT"); } } } //TimeStamp if (TimeStamp_IsPresent) { Fill(Stream_Audio, 0, Audio_Delay, TimeStamp_Content*1000, 0); Fill(Stream_Audio, 0, Audio_Delay_Source, "Stream"); if (TimeStamp_DropFrame_IsValid) Fill(Stream_Audio, 0, Audio_Delay_Settings, TimeStamp_DropFrame_Content?"drop_frame_flag=1":"drop_frame_flag=0"); } } //--------------------------------------------------------------------------- void File_Ac3::Streams_Finish() { //Stats if (!dialnorms.empty()) { int8u Minimum_Raw=1; int8u Maximum_Raw=31; float64 Sum_Intensity=0; int64u Count=0; for (int8u Pos=0; (size_t)Pos(Pos==0?31:Pos)) Maximum_Raw=(Pos==0?31:Pos); Sum_Intensity+=dialnorms[Pos]*pow(10, -((float64)Pos)/10); Count+=dialnorms[Pos]; } float64 Average_dB=log10(Sum_Intensity/Count)*10; Fill(Stream_Audio, 0, "dialnorm_Average", Average_dB, 0); (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dialnorm_Average"), Info_Options)=__T("N NT"); Fill(Stream_Audio, 0, "dialnorm_Average/String", Ztring::ToZtring(Average_dB, 0)+__T(" dB")); (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dialnorm_Average/String"), Info_Options)=__T("N NT"); Fill(Stream_Audio, 0, "dialnorm_Minimum", -Minimum_Raw); (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dialnorm_Minimum"), Info_Options)=__T("N NT"); Fill(Stream_Audio, 0, "dialnorm_Minimum/String", Ztring::ToZtring(-Minimum_Raw)+__T(" dB")); (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dialnorm_Minimum/String"), Info_Options)=__T("N NT"); Fill(Stream_Audio, 0, "dialnorm_Maximum", -Maximum_Raw); (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dialnorm_Maximum"), Info_Options)=__T("N NT"); Fill(Stream_Audio, 0, "dialnorm_Maximum/String", Ztring::ToZtring(-Maximum_Raw)+__T(" dB")); (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dialnorm_Maximum/String"), Info_Options)=__T("N NT"); Fill(Stream_Audio, 0, "dialnorm_Count", Count); (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dialnorm_Count"), Info_Options)=__T("N NT"); } if (!comprs.empty()) { float64 Minimum_dB=47.89; float64 Maximum_dB=-48.16; float64 Sum_Intensity=0; int64u Count=0; for (size_t Pos=0; Pos>4]+20*std::log10(((float)(0x10+(Pos&0x0F)))/32); if (Minimum_dB>Value) Minimum_dB=Value; if (Maximum_dB>5]+20*std::log10(((float)(0x20+(Pos&0x1F)))/64); if (Minimum_dB>Value) Minimum_dB=Value; if (Maximum_dBfirst, fscods.begin()->first); if (Size) { if (TimeStamp_IsPresent) Size+=16; Frame_Count_ForDuration=(File_Size-File_Offset_FirstSynched)/Size; //Only complete frames Fill(Stream_Audio, 0, Audio_StreamSize, Frame_Count_ForDuration*Size); } } if (Frame_Count_ForDuration) { Clear(Stream_Audio, 0, Audio_BitRate); //HD part if (Frame_Count_HD) { int32u HD_SamplingRate=AC3_HD_SamplingRate(HD_SamplingRate1); if (HD_SamplingRate) { int8u FrameDuration; //In samples if (HD_SamplingRate<44100) FrameDuration=0; //Unknown else if (HD_SamplingRate<=48000) FrameDuration=40; else if (HD_SamplingRate<=96000) FrameDuration=80; else if (HD_SamplingRate<=192000) FrameDuration=160; else FrameDuration=0; //Unknown if (FrameDuration) { int64u SamplingCount=Frame_Count_HD*FrameDuration; Fill(Stream_Audio, 0, Audio_Duration, SamplingCount/(((float64)HD_SamplingRate)/1000), 0); Fill(Stream_Audio, 0, Audio_SamplingCount, SamplingCount); Fill(Stream_Audio, 0, Audio_BitRate, (File_Size-File_Offset_FirstSynched)/(SamplingCount/(((float64)HD_SamplingRate)/1000))*8, 0); } Fill(Stream_Audio, 0, Audio_FrameCount, Frame_Count_HD); } } if (Core_IsPresent) { Fill(Stream_Audio, 0, Audio_FrameCount, Frame_Count_ForDuration); if (AC3_SamplingRate[fscod]) { float64 FrameDuration; if (bsid_Max<=0x08) FrameDuration=32; else if (bsid_Max<=0x09) FrameDuration=16; // Unofficial hack for low sample rate (e.g. 22.05 kHz) else FrameDuration=0; if (FrameDuration) { FrameDuration*=((float64)48000)/AC3_SamplingRate[fscod]; //32 ms for 48 KHz, else proportional (34.83 for 44.1 KHz, 48 ms for 32 KHz) Fill(Stream_Audio, 0, Audio_SamplingCount, Frame_Count_ForDuration*1536); Fill(Stream_Audio, 0, Audio_Duration, Frame_Count_ForDuration*FrameDuration, 0); int32u BitRate=AC3_BitRate[frmsizecod/2]*1000; int32u Divider=bsid_Max==9?2:1; // Unofficial hack for low sample rate (e.g. 22.05 kHz) Fill(Stream_Audio, 0, Audio_BitRate, BitRate/Divider); } } } } } else if (FrameInfo.PTS!=(int64u)-1 && FrameInfo.PTS>PTS_Begin) { Fill(Stream_Audio, 0, Audio_Duration, float64_int64s(((float64)(FrameInfo.PTS-PTS_Begin))/1000000)); float64 FrameDuration; if (bsid_Max<=0x08) FrameDuration=32; else if (bsid_Max<=0x09) FrameDuration=16; // Unofficial hack for low sample rate (e.g. 22.05 kHz) else if (bsid_Max>0x0A && bsid_Max<=0x10) FrameDuration=((float64)32)/6; else FrameDuration=0; if (FrameDuration) Fill(Stream_Audio, 0, Audio_FrameCount, float64_int64s(((float64)(FrameInfo.PTS-PTS_Begin))/1000000/FrameDuration)); } } //--------------------------------------------------------------------------- void File_Ac3::Read_Buffer_Unsynched() { delete[] Save_Buffer; Save_Buffer=NULL; if (File_GoTo==0) Synched_Init(); } //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_Ac3::Read_Buffer_Seek (size_t Method, int64u Value, int64u /*ID*/) { GoTo(0); Open_Buffer_Unsynch(); return 1; } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Ac3::FileHeader_Begin() { //Specific cases if (MustParse_dac3 || MustParse_dec3) return true; //Must have enough buffer for having header if (Buffer_Size<4) return false; //Must wait for more data //False positives detection: detect Matroska files, AC-3 parser is not smart enough if (!FileHeader_Begin_0x000001()) { Finish("AC-3"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Ac3::Synchronize() { //Specific cases if (MustParse_dac3 || MustParse_dec3) return true; //Synchronizing while (Buffer_Offset+8<=Buffer_Size) { if (!FrameSynchPoint_Test()) return false; //Need more data if (Synched) break; Buffer_Offset++; } //Parsing last bytes if needed if (Buffer_Offset+8>Buffer_Size) { //We must keep more bytes in order to detect TimeStamp if (Frame_Count==0) { if (Buffer_Offset>=16) Buffer_Offset-=16; else Buffer_Offset=0; return false; } if (Buffer_Offset+7==Buffer_Size && CC3(Buffer+Buffer_Offset+4)!=0xF8726F && CC2(Buffer+Buffer_Offset)!=0x0B77 && CC2(Buffer+Buffer_Offset)!=0x770B) Buffer_Offset++; if (Buffer_Offset+6==Buffer_Size && CC2(Buffer+Buffer_Offset+4)!=0xF872 && CC2(Buffer+Buffer_Offset)!=0x0B77 && CC2(Buffer+Buffer_Offset)!=0x770B) Buffer_Offset++; if (Buffer_Offset+5==Buffer_Size && CC1(Buffer+Buffer_Offset+4)!=0xF8 && CC2(Buffer+Buffer_Offset)!=0x0B77 && CC2(Buffer+Buffer_Offset)!=0x770B) Buffer_Offset++; if (Buffer_Offset+4==Buffer_Size && CC2(Buffer+Buffer_Offset)!=0x0B77 && CC2(Buffer+Buffer_Offset)!=0x770B) Buffer_Offset++; if (Buffer_Offset+3==Buffer_Size && CC2(Buffer+Buffer_Offset)!=0x0B77 && CC2(Buffer+Buffer_Offset)!=0x770B) Buffer_Offset++; if (Buffer_Offset+2==Buffer_Size && CC2(Buffer+Buffer_Offset)!=0x0B77 && CC2(Buffer+Buffer_Offset)!=0x770B) Buffer_Offset++; if (Buffer_Offset+1==Buffer_Size && CC1(Buffer+Buffer_Offset)!=0x0B && CC1(Buffer+Buffer_Offset)!=0x77) Buffer_Offset++; return false; } //Testing if we have TimeStamp if (Buffer_Offset>=16) { if ( Buffer[Buffer_Offset-0x10+0x00]==0x01 //Magic value? Always 0x01 && Buffer[Buffer_Offset-0x10+0x01]==0x10 //Size? Always 0x10 && Buffer[Buffer_Offset-0x10+0x02]==0x00 //First byte of HH? Always 0x00 && (Buffer[Buffer_Offset-0x10+0x03]>>4 )<0x6 //Second byte of HH? First 4 bits must be <0x6 && (Buffer[Buffer_Offset-0x10+0x03]&0xF)<0xA //Second byte of HH? Second 4 bits must be <0xA && Buffer[Buffer_Offset-0x10+0x04]==0x00 //First byte of MM? Always 0x00 && (Buffer[Buffer_Offset-0x10+0x05]>>4 )<0x6 //Second byte of MM? First 4 bits must be <0x6 && (Buffer[Buffer_Offset-0x10+0x05]&0xF)<0xA //Second byte of MM? Second 4 bits must be <0xA && Buffer[Buffer_Offset-0x10+0x06]==0x00 //First byte of SS? Always 0x00 && (Buffer[Buffer_Offset-0x10+0x07]>>4 )<0x6 //Second byte of SS? First 4 bits must be <0x6 && (Buffer[Buffer_Offset-0x10+0x07]&0xF)<0xA //Second byte of SS? Second 4 bits must be <0xA && Buffer[Buffer_Offset-0x10+0x08]==0x00 //First byte of FF? Always 0x00 && (Buffer[Buffer_Offset-0x10+0x09]>>4 )<0x4 //Second byte of FF? First 4 bits must be <0x4 && (Buffer[Buffer_Offset-0x10+0x09]&0xF)<0xA //Second byte of FF? Second 4 bits must be <0xA && !(Buffer[Buffer_Offset-0x10+0x00]==0x00 //We want at least a byte not zero, in order to differentiate TimeStamp from padding && Buffer[Buffer_Offset-0x10+0x01]==0x00 && Buffer[Buffer_Offset-0x10+0x0C]==0x00 && Buffer[Buffer_Offset-0x10+0x0D]==0x00 && Buffer[Buffer_Offset-0x10+0x0E]==0x00 && Buffer[Buffer_Offset-0x10+0x0F]==0x00)) { TimeStamp_IsPresent=true; Buffer_Offset-=16; if (Frame_Count_Valid<10000) Frame_Count_Valid=10000; //Setting it to 10000 in order to be able to have the drop frame for extreme stream (60 fps...) } } //Synched return true; } //--------------------------------------------------------------------------- void File_Ac3::Synched_Init() { //FrameInfo PTS_End=0; if (FrameInfo.DTS==(int64u)-1) FrameInfo.DTS=0; //No DTS in container if (FrameInfo.PTS==(int64u)-1) FrameInfo.PTS=0; //No PTS in container DTS_Begin=FrameInfo.DTS; DTS_End=FrameInfo.DTS; if (Frame_Count_NotParsedIncluded==(int64u)-1) Frame_Count_NotParsedIncluded=0; //No Frame_Count_NotParsedIncluded in the container } //--------------------------------------------------------------------------- bool File_Ac3::Synched_Test() { //Specific cases if (MustParse_dac3 || MustParse_dec3) return true; //Must have enough buffer for having header if (Buffer_Offset+(TimeStamp_IsPresent?16:0)+6>Buffer_Size) return false; //TimeStamp if (TimeStamp_IsPresent && !TimeStamp_Parsed) { if (!( Buffer[Buffer_Offset+0x00]==0x01 //Magic value? Always 0x01 && Buffer[Buffer_Offset+0x01]==0x10 //Size? Always 0x10 && Buffer[Buffer_Offset+0x02]==0x00 //First byte of HH? Always 0x00 && (Buffer[Buffer_Offset+0x03]>>4 )<0x6 //Second byte of HH? First 4 bits must be <0x6 && (Buffer[Buffer_Offset+0x03]&0xF)<0xA //Second byte of HH? Second 4 bits must be <0xA && Buffer[Buffer_Offset+0x04]==0x00 //First byte of MM? Always 0x00 && (Buffer[Buffer_Offset+0x05]>>4 )<0x6 //Second byte of MM? First 4 bits must be <0x6 && (Buffer[Buffer_Offset+0x05]&0xF)<0xA //Second byte of MM? Second 4 bits must be <0xA && Buffer[Buffer_Offset+0x06]==0x00 //First byte of SS? Always 0x00 && (Buffer[Buffer_Offset+0x07]>>4 )<0x6 //Second byte of SS? First 4 bits must be <0x6 && (Buffer[Buffer_Offset+0x07]&0xF)<0xA //Second byte of SS? Second 4 bits must be <0xA && Buffer[Buffer_Offset+0x08]==0x00 //First byte of FF? Always 0x00 && (Buffer[Buffer_Offset+0x09]>>4 )<0x4 //Second byte of FF? First 4 bits must be <0x4 && (Buffer[Buffer_Offset+0x09]&0xF)<0xA)) //Second byte of FF? Second 4 bits must be <0xA TimeStamp_IsPresent=false; } if (TimeStamp_IsPresent && !TimeStamp_Parsed) Buffer_Offset+=16; //Quick test of synchro if (!FrameSynchPoint_Test()) return false; //Need more data if (!Synched) return true; //TimeStamp if (TimeStamp_IsPresent && !TimeStamp_Parsed) { Buffer_Offset-=16; if (Synched) { TimeStamp_IsParsing=true; TimeStamp_Parsed=false; } else { TimeStamp_IsParsing=false; TimeStamp_Parsed=false; } } //We continue return true; } //*************************************************************************** // Buffer - Demux //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX bool File_Ac3::Demux_UnpacketizeContainer_Test() { if (TimeStamp_IsPresent) Buffer_Offset+=16; if (!HD_IsPresent && Frame_Count==0 && Save_Buffer==NULL) { //Searching HD part size_t Buffer_Offset_Save=Buffer_Offset; Buffer_Offset++; Synched=false; while (Buffer_Offset+8<=Buffer_Size) { if (!FrameSynchPoint_Test()) { Buffer_Offset=Buffer_Offset_Save; return false; //Need more data } if (Synched) break; Buffer_Offset++; } Buffer_Offset=Buffer_Offset_Save; if (!Synched) { Synched=true; if (TimeStamp_IsPresent) Buffer_Offset-=16; return false; //Need more data } } if (Save_Buffer) { Demux_TotalBytes-=Buffer_Offset; Demux_Offset-=Buffer_Offset; File_Offset+=Buffer_Offset; swap(Buffer, Save_Buffer); swap(Buffer_Offset, Save_Buffer_Offset); swap(Buffer_Size, Save_Buffer_Size); } if (Buffer[Buffer_Offset]==0x0B && Buffer[Buffer_Offset+1]==0x77) { int8u bsid=Buffer[Buffer_Offset+5]>>3; if (bsid<=0x08) FrameInfo.DUR=32000000; else if (bsid<=0x09) FrameInfo.DUR=16000000; // Unofficial hack for low sample rate (e.g. 22.05 kHz) else if (bsid>0x0A && bsid<=0x10) { numblkscod=(Buffer[Buffer_Offset+4]>>4)&0x3; int8u numblks=numblkscod==3?6:numblkscod+1; FrameInfo.DUR=32000000*numblks/6; } Demux_Offset=Buffer_Offset+Core_Size_Get(); //Core part if (HD_IsPresent) { if (TimeStamp_IsPresent) Buffer_Offset-=16; if (Save_Buffer) { swap(Buffer, Save_Buffer); swap(Buffer_Offset, Save_Buffer_Offset); swap(Buffer_Size, Save_Buffer_Size); Demux_TotalBytes+=Buffer_Offset; Demux_Offset+=Buffer_Offset; File_Offset-=Buffer_Offset; } return true; //No AC-3 demux } } else { Demux_Offset=Buffer_Offset+HD_Size_Get(); } if (Demux_Offset>Buffer_Size && File_Offset+Buffer_Size!=File_Size) { if (TimeStamp_IsPresent) Buffer_Offset-=16; if (Save_Buffer) { swap(Buffer, Save_Buffer); swap(Buffer_Offset, Save_Buffer_Offset); swap(Buffer_Size, Save_Buffer_Size); Demux_TotalBytes+=Buffer_Offset; Demux_Offset+=Buffer_Offset; File_Offset-=Buffer_Offset; } return false; //No complete frame } Demux_UnpacketizeContainer_Demux(); if (Save_Buffer) { swap(Buffer, Save_Buffer); swap(Buffer_Offset, Save_Buffer_Offset); swap(Buffer_Size, Save_Buffer_Size); Demux_TotalBytes+=Buffer_Offset; Demux_Offset+=Buffer_Offset; File_Offset-=Buffer_Offset; } if (TimeStamp_IsPresent) Buffer_Offset-=16; return true; } #endif //MEDIAINFO_DEMUX //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Ac3::Read_Buffer_Continue() { if (MustParse_dac3) { dac3(); return; } if (MustParse_dec3) { dec3(); return; } } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Ac3::Header_Parse() { //TimeStamp if (TimeStamp_IsParsing) { Header_Fill_Size(16); Header_Fill_Code(2, "TimeStamp"); return; } else TimeStamp_Parsed=false; //Currently, only one kind of intermediate element is detected (no TimeStamp and HD part together), and we don't know the precise specification of MLP nor TimeStamp, so we consider next eleemnt is TimeStamp if (Save_Buffer) { File_Offset+=Buffer_Offset; swap(Buffer, Save_Buffer); swap(Buffer_Offset, Save_Buffer_Offset); swap(Buffer_Size, Save_Buffer_Size); } //Filling if ((Buffer[Buffer_Offset]==0x0B && Buffer[Buffer_Offset+1]==0x77) || (Buffer[Buffer_Offset]==0x77 && Buffer[Buffer_Offset+1]==0x0B)) { Header_Fill_Size(Core_Size_Get()); Header_Fill_Code(0, "syncframe"); //Little Endian management if (Save_Buffer) { swap(Buffer, Save_Buffer); swap(Buffer_Offset, Save_Buffer_Offset); swap(Buffer_Size, Save_Buffer_Size); File_Offset-=Buffer_Offset; } return; } //MLP or TrueHD specific int16u Size; BS_Begin(); Skip_S1( 4, "CRC?"); Get_S2 (12, Size, "Size"); BS_End(); Skip_B2( "Timestamp?"); //Little Endian management if (Save_Buffer) { swap(Buffer, Save_Buffer); swap(Buffer_Offset, Save_Buffer_Offset); swap(Buffer_Size, Save_Buffer_Size); } //Filling if (Size<2) { Synched=false; Size=2; } Size*=2; Header_Fill_Size(Size); Header_Fill_Code(1, "HD"); } //--------------------------------------------------------------------------- void File_Ac3::Data_Parse() { if (Save_Buffer) { File_Offset+=Buffer_Offset; swap(Buffer, Save_Buffer); swap(Buffer_Offset, Save_Buffer_Offset); swap(Buffer_Size, Save_Buffer_Size); } //Parsing switch (Element_Code) { case 0 : Element_Info1C((FrameInfo.PTS!=(int64u)-1), __T("PTS ")+Ztring().Duration_From_Milliseconds(float64_int64s(((float64)FrameInfo.PTS)/1000000))); Element_Info1(Frame_Count); Core(); break; case 1 : Element_Info1C((FrameInfo.PTS!=(int64u)-1), __T("PTS ")+Ztring().Duration_From_Milliseconds(float64_int64s(((float64)FrameInfo.PTS)/1000000))); Element_Info1(Frame_Count); HD(); break; case 2 : TimeStamp(); break; default: ; } //Little Endian management if (Save_Buffer) { delete[] Buffer; Buffer=Save_Buffer; Save_Buffer=NULL; Buffer_Offset=Save_Buffer_Offset; Buffer_Size=Save_Buffer_Size; File_Offset-=Buffer_Offset; } } //--------------------------------------------------------------------------- void File_Ac3::Core() { while (Element_Offset0x0A && bsid<=0x10) { int8u numblks=numblkscod==3?6:numblkscod+1; FrameInfo.DUR=32000000*numblks/6; } if (fscod && AC3_SamplingRate[fscod]) { FrameInfo.DUR*=48000; FrameInfo.DUR/=AC3_SamplingRate[fscod]; } if (fscod==3 && AC3_SamplingRate2[fscod2]) { FrameInfo.DUR*=48000; FrameInfo.DUR/=AC3_SamplingRate2[fscod2]; } if (FrameInfo.DTS!=(int64u)-1) FrameInfo.DTS+=FrameInfo.DUR; if (FrameInfo.PTS!=(int64u)-1) FrameInfo.PTS=FrameInfo.DTS; if (File_Offset+Buffer_Offset+Element_Size==File_Size) Frame_Count_Valid=Frame_Count; //Finish frames in case of there are less than Frame_Count_Valid frames //Filling if (!Status[IsAccepted]) Accept("AC-3"); if (!Status[IsFilled] && Frame_Count>=Frame_Count_Valid) { Fill("AC-3"); //No more need data if (!IsSub && MediaInfoLib::Config.ParseSpeed_Get()<1) Finish("AC-3"); } FILLING_END(); } //--------------------------------------------------------------------------- void File_Ac3::Core_Frame() { //Parsing int16u frmsiz=0, chanmap=0; int8u dialnorm=(int8u)-1, dialnorm2=(int8u)-1, compr=(int8u)-1, compr2=(int8u)-1, dynrng=(int8u)-1, dynrng2=(int8u)-1; int8u strmtyp=0, substreamid=0, acmod=0, bsmod=0, dsurmod=0; bool compre=false, compr2e=false, dynrnge=false, dynrng2e=false; bool lfeon=false, chanmape=false; if (bsid<=0x09) { Element_Begin1("synchinfo"); Skip_B2( "syncword"); Skip_B2( "crc1"); BS_Begin(); Get_S1 (2, fscod, "fscod - Sample Rate Code"); Param_Info2(AC3_SamplingRate[fscod], " Hz"); Get_S1 (6, frmsizecod, "frmsizecod - Frame Size Code"); if (frmsizecod/2<19) {Param_Info2(AC3_BitRate[frmsizecod/2]*1000, " bps");} Element_End0(); Element_Begin1("bsi"); Get_S1 (5, bsid, "bsid - Bit Stream Identification"); Get_S1 (3, bsmod, "bsmod - Bit Stream Mode"); Param_Info1(AC3_Mode[bsmod]); Get_S1 (3, acmod, "acmod - Audio Coding Mode"); Param_Info1(AC3_ChannelPositions[acmod]); if ((acmod&1) && acmod!=1) //central present Skip_S1(2, "cmixlev - Center Mix Level"); if (acmod&4) //back present Skip_S1(2, "surmixlev - Surround Mix Level"); if (acmod==2) Get_S1 (2, dsurmod, "dsurmod - Dolby Surround Mode"); Param_Info1(AC3_Surround[dsurmod]); Get_SB ( lfeon, "lfeon - Low Frequency Effects"); Get_S1 (5, dialnorm, "dialnorm - Dialogue Normalization"); Get_SB ( compre, "compre - Compression Gain Word Exists"); if (compre) Get_S1 (8, compr, "compr - Compression Gain Word"); TEST_SB_SKIP( "langcode - Language Code Exists"); Skip_S1(8, "langcod - Language Code"); TEST_SB_END(); TEST_SB_SKIP( "audprodie - Audio Production Information Exists"); Skip_S1(8, "mixlevel - Mixing Level"); Skip_S1(2, "roomtyp - Room Type"); TEST_SB_END(); if (acmod==0) //1+1 mode { Get_S1 (5, dialnorm2, "dialnorm2 - Dialogue Normalization"); Get_SB ( compr2e, "compr2e - Compression Gain Word Exists"); if (compr2e) Get_S1 (8, compr2, "compr2 - Compression Gain Word"); TEST_SB_SKIP( "langcod2e - Language Code Exists"); Skip_S1(8, "langcod2 - Language Code"); TEST_SB_END(); TEST_SB_SKIP( "audprodi2e - Audio Production Information Exists"); Skip_S1(8, "mixlevel2 - Mixing Level"); Skip_S1(2, "roomtyp2 - Room Type"); TEST_SB_END(); } Skip_SB( "copyrightb - Copyright Bit"); Skip_SB( "origbs - Original Bit Stream"); TEST_SB_SKIP( "timecod1e"); Skip_S1(14, "timecod1"); //Note: if timecod is used, change the bitstream parsing for bsid==0x06 TEST_SB_END(); TEST_SB_SKIP( "timecod2e"); Skip_S1(14, "timecod2"); //Note: if timecod is used, change the bitstream parsing for bsid==0x06 TEST_SB_END(); TEST_SB_SKIP( "addbsie"); int8u addbsil; Get_S1 (6, addbsil, "addbsil"); for (int8u Pos=0; Pos<=addbsil; Pos++) //addbsil+1 bytes Skip_S1(8, "addbsi"); TEST_SB_END(); Element_End0(); Element_Begin1("audblk"); for (int8u Pos=0; Pos0x0A && bsid<=0x10) { Element_Begin1("synchinfo"); Skip_B2( "syncword"); Element_End0(); Element_Begin1("bsi"); BS_Begin(); size_t Bits_Begin=Data_BS_Remain(); Get_S1 ( 2, strmtyp, "strmtyp"); Get_S1 ( 3, substreamid, "substreamid"); Get_S2 (11, frmsiz, "frmsiz"); Get_S1 ( 2, fscod, "fscod"); Param_Info2(AC3_SamplingRate[fscod], " Hz"); if (fscod==3) { Get_S1 ( 2, fscod2, "fscod2"); Param_Info2(AC3_SamplingRate2[fscod2], " Hz"); numblkscod=3; } else Get_S1 ( 2, numblkscod, "numblkscod"); Get_S1 (3, acmod, "acmod - Audio Coding Mode"); Param_Info1(AC3_ChannelPositions[acmod]); Get_SB ( lfeon, "lfeon - Low Frequency Effects"); Get_S1 (5, bsid, "bsid - Bit Stream Identification"); Get_S1 (5, dialnorm, "dialnorm"); TEST_SB_GET(compre, "compre"); Get_S1 (8, compr, "compr"); TEST_SB_END(); if (acmod==0) //1+1 mode { Get_S1 (5, dialnorm2, "dialnorm2"); TEST_SB_GET(compr2e, "compr2e"); Get_S1 (8, compr2, "compr2"); TEST_SB_END(); } if (strmtyp==1) //dependent stream { TEST_SB_GET (chanmape, "chanmape"); Get_S2(16, chanmap, "chanmap"); Param_Info1(AC3_chanmap_ChannelPositions(chanmap)); TEST_SB_END(); } Element_End0(); if (Data_BS_Remain()<17) { BS_End(); Trusted_IsNot("Not enough data"); } else { Element_Begin1("errorcheck"); size_t BitsUpToEndOfFrame=(frmsiz*2)*8-(Bits_Begin-Data_BS_Remain()); Skip_BS(BitsUpToEndOfFrame-17, "bsi(continue)+audfrm+x*audblk+auxdata+errorcheck"); Skip_SB( "encinfo"); BS_End(); Skip_B2( "crc2"); Element_End0(); } } FILLING_BEGIN(); if (bsid>0x10) return; //Not supported //Information if (strmtyp>1) strmtyp=0; //TODO: check a file with strmtyp==2 if (strmtyp==0) substreamid_Independant_Current=substreamid; if (bsid_Max==(int8u)-1 || bsid>bsid_Max) bsid_Max=bsid; //Specific to first frame if (Frame_Count==0) { frmsizplus1_Max[substreamid_Independant_Current][strmtyp+substreamid]=frmsiz+1; acmod_Max[substreamid_Independant_Current][strmtyp+substreamid]=acmod; lfeon_Max[substreamid_Independant_Current][strmtyp+substreamid]=lfeon; bsmod_Max[substreamid_Independant_Current][strmtyp+substreamid]=bsmod; dsurmod_Max[substreamid_Independant_Current][strmtyp+substreamid]=dsurmod; chanmape_Max[substreamid_Independant_Current][strmtyp+substreamid]=chanmape; chanmap_Max[substreamid_Independant_Current][strmtyp+substreamid]=chanmap; FirstFrame_Dolby.dialnorm=dialnorm; if (compre) FirstFrame_Dolby.compr=compr; if (dynrnge) FirstFrame_Dolby.dynrng=dynrng; FirstFrame_Dolby.compre=compre; FirstFrame_Dolby.dynrnge=dynrnge; if (acmod==0) //1+1 mode { FirstFrame_Dolby2.dialnorm=dialnorm2; if (compr2e) FirstFrame_Dolby2.compr=compr2; if (dynrng2e) FirstFrame_Dolby2.dynrng=dynrng2; FirstFrame_Dolby2.compre=compr2e; FirstFrame_Dolby2.dynrnge=dynrng2e; } } //Stats if (dialnorms.empty()) dialnorms.resize(32); dialnorms[dialnorm]++; if (compre) { if (comprs.empty()) comprs.resize(256); comprs[compr]++; } if (dynrnge) { //Saving new value dynrnge_Exists=true; dynrng_Old=dynrng; } if (!dynrnge) dynrng=0; if (dynrngs.empty()) dynrngs.resize(256); dynrngs[dynrng]++; if (acmod==0) //1+1 mode { if (dialnorm2s.empty()) dialnorm2s.resize(32); dialnorm2s[dialnorm2]++; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Ac3::HD() { //Parsing int32u Synch; Peek_B3(Synch); if (Synch==0xF8726F) { if (Buffer_Offset+28>Buffer_Size) { Trusted_IsNot("Not enough data"); return; //Need more data } //Testing /* Not working int16u CRC_16_Table_HD[256]; CRC16_Init(CRC_16_Table_HD, 0x002D); int16u CRC_16=0x0000; const int8u* CRC_16_Buffer=Buffer+Buffer_Offset; while(CRC_16_Buffer>8)^(*CRC_16_Buffer)]; CRC_16_Buffer++; } CRC_16^=LittleEndian2int16u(Buffer+Buffer_Offset+24); */ Element_Begin1("MajorSync"); Skip_B3( "Synch"); Get_B1 (HD_StreamType, "Stream type"); Param_Info1(AC3_HD_StreamType(HD_StreamType)); if (HD_StreamType==0xBA) { BS_Begin(); Get_S1 ( 4, HD_SamplingRate1, "Sampling rate"); Param_Info2(AC3_HD_SamplingRate(HD_SamplingRate1), " Hz"); Skip_S1( 8, "Unknown"); Get_S1 ( 5, HD_Channels1, "Channels (1st substream)"); Param_Info1(AC3_TrueHD_Channels(HD_Channels1)); Param_Info1(Ztring().From_Local(AC3_TrueHD_Channels_Positions(HD_Channels1))); Skip_S1( 2, "Unknown"); Get_S2 (13, HD_Channels2, "Channels (2nd substream)"); Param_Info1(AC3_TrueHD_Channels(HD_Channels2)); Param_Info1(Ztring().From_Local(AC3_TrueHD_Channels_Positions(HD_Channels2))); BS_End(); HD_Resolution2=HD_Resolution1=24; //Not sure HD_SamplingRate2=HD_SamplingRate1; } else if (HD_StreamType==0xBB) { BS_Begin(); Get_S1 ( 4, HD_Resolution1, "Resolution1"); Param_Info2(AC3_MLP_Resolution[HD_Resolution1], " bits"); Get_S1 ( 4, HD_Resolution2, "Resolution2"); Param_Info2(AC3_MLP_Resolution[HD_Resolution2], " bits"); Get_S1 ( 4, HD_SamplingRate1, "Sampling rate"); Param_Info2(AC3_HD_SamplingRate(HD_SamplingRate1), " Hz"); Get_S1 ( 4, HD_SamplingRate2, "Sampling rate"); Param_Info2(AC3_HD_SamplingRate(HD_SamplingRate2), " Hz"); Skip_S1(11, "Unknown"); Get_S1 ( 5, HD_Channels1, "Channels"); Param_Info1(AC3_MLP_Channels[HD_Channels1]); BS_End(); HD_Channels2=HD_Channels1; } else { Skip_XX(Element_Size-Element_Offset, "Data"); return; } Skip_B6( "Unknown"); BS_Begin(); Get_SB ( HD_IsVBR, "Is VBR"); Get_S2 (15, HD_BitRate_Max, "Maximum bitrate"); Param_Info2((HD_BitRate_Max*(AC3_HD_SamplingRate(HD_SamplingRate2)?AC3_HD_SamplingRate(HD_SamplingRate2):AC3_HD_SamplingRate(HD_SamplingRate1))+8)>>4, " bps"); Get_S1 ( 4, HD_SubStreams_Count, "SubStreams_Count"); Skip_S1( 4, "Unknown"); BS_End(); Skip_B1( "Unknown"); Skip_B1( "Unknown"); Skip_B1( "Unknown"); Skip_B1( "Unknown"); Skip_B1( "Unknown"); Skip_B1( "Unknown"); Skip_B1( "Unknown"); Skip_B1( "Unknown"); Skip_B1( "Unknown"); Skip_B1( "Unknown"); Skip_B1( "Unknown"); Element_End0(); FILLING_BEGIN(); HD_MajorSync_Parsed=true; if (HD_SubStreams_Count==1 && HD_StreamType==0xBB) //MLP with only 1 stream { HD_Resolution2=HD_Resolution1; HD_SamplingRate2=HD_SamplingRate1; } FILLING_END(); } /* if (HD_MajorSync_Parsed) { Element_Begin1("Sizes"); std::vector Sizes; for (int8u Pos=0; Pos=Frame_Count_Valid) { Fill("AC-3"); //No more need data if (!IsSub && MediaInfoLib::Config.ParseSpeed_Get()<1) Finish("AC-3"); } FILLING_END(); } //--------------------------------------------------------------------------- void File_Ac3::TimeStamp() { //Parsing int8u H1, H2, M1, M2, S1, S2, F1, F2; Skip_B1( "Magic value"); Skip_B1( "Size?"); BS_Begin(); Skip_S1(8, "H"); Get_S1 (4, H1, "H"); Get_S1( 4, H2, "H"); Skip_S1(8, "M"); Get_S1 (4, M1, "M"); Get_S1( 4, M2, "M"); Skip_S1(8, "S"); Get_S1 (4, S1, "S"); Get_S1( 4, S2, "S"); Skip_S1(8, "F"); Get_S1 (4, F1, "F"); Get_S1( 4, F2, "F"); BS_End(); Skip_B2( "Unknown"); Skip_B2( "Unknown"); Skip_B2( "Unknown (fixed)"); FILLING_BEGIN(); float64 Temp=H1*10*60*60 + H2 *60*60 + M1 *10*60 + M2 *60 + S1 *10 + S2 + (F1*10+F2)/29.97; //No idea about where is the frame rate #ifdef MEDIAINFO_TRACE Element_Info1(Ztring::ToZtring(H1)+Ztring::ToZtring(H2)+__T(':') + Ztring::ToZtring(M1)+Ztring::ToZtring(M2)+__T(':') + Ztring::ToZtring(S1)+Ztring::ToZtring(S2)+__T(':') + Ztring::ToZtring(F1)+Ztring::ToZtring(F2)); #endif //MEDIAINFO_TRACE if (Frame_Count==0) TimeStamp_Content=Temp; TimeStamp_IsParsing=false; TimeStamp_Parsed=true; if (!TimeStamp_DropFrame_IsValid && M2 && !S2 && !S1 && !F1) { //If drop frame configuration, frames 0 and 1 are dropped for every minutes except 00 10 20 30 40 50 switch (F2) { case 0 : case 1 : TimeStamp_DropFrame_IsValid=true; TimeStamp_DropFrame_Content=false; break; case 2 : if (Frame_Count>=2) { TimeStamp_DropFrame_IsValid=true; TimeStamp_DropFrame_Content=true; } default: ; } if (TimeStamp_DropFrame_IsValid) Frame_Count_Valid=32; //Reset } FILLING_END(); } //--------------------------------------------------------------------------- void File_Ac3::dac3() { BS_Begin(); Get_S1 (2, fscod, "fscod"); Get_S1 (5, bsid, "bsid"); Get_S1 (3, bsmod_Max[0][0], "bsmod"); Get_S1 (3, acmod_Max[0][0], "acmod"); Get_SB ( lfeon_Max[0][0], "lfeon"); Get_S1 (5, frmsizecod, "bit_rate_code"); frmsizecod*=2; Skip_S1(5, "reserved"); BS_End(); MustParse_dac3=false; dxc3_Parsed=true; } //--------------------------------------------------------------------------- void File_Ac3::dec3() { //Parsing BS_Begin(); int8u num_ind_sub; Skip_S2(13, "data_rate"); Get_S1 ( 3, num_ind_sub, "num_ind_sub"); for (int8u Pos=0; Pos<=num_ind_sub; Pos++) { Element_Begin1("independent substream"); int8u num_dep_sub; Get_S1 (2, fscod, "fscod"); Get_S1 (5, bsid, "bsid"); Get_S1 (3, bsmod_Max[Pos][0], "bsmod"); Get_S1 (3, acmod_Max[Pos][0], "acmod"); Get_SB ( lfeon_Max[Pos][0], "lfeon"); Skip_S1(3, "reserved"); Get_S1 (4, num_dep_sub, "num_dep_sub"); if (num_dep_sub>0) Skip_S2(9, "chan_loc"); else Skip_SB( "reserved"); Element_End0(); } BS_End(); MustParse_dec3=false; dxc3_Parsed=true; } //--------------------------------------------------------------------------- bool File_Ac3::FrameSynchPoint_Test() { if (Save_Buffer) return true; //Test already made by Synchronize() if (Buffer[Buffer_Offset ]==0x0B && Buffer[Buffer_Offset+1]==0x77) //AC-3 { bsid=CC1(Buffer+Buffer_Offset+5)>>3; int16u Size=0; if (bsid<=0x09) { int8u fscod =(CC1(Buffer+Buffer_Offset+4)>>6)&0x03; int8u frmsizecod=(CC1(Buffer+Buffer_Offset+4) )&0x3F; Size=AC3_FrameSize_Get(frmsizecod, fscod); } else if (bsid>0x0A && bsid<=0x10) { int16u frmsiz=CC2(Buffer+Buffer_Offset+2)&0x07FF; int8u strmtyp=Buffer[Buffer_Offset+Size+2]>>6; if (strmtyp!=1) //Not dependent stream Size=2+frmsiz*2; } if (Size>=6) { if (Buffer_Offset+Size>Buffer_Size) return false; //Need more data if (CRC_Compute(Size)) { Synched=true; return true; } } } if (Buffer[Buffer_Offset+0]==0x77 && Buffer[Buffer_Offset+1]==0x0B) //AC-3 LE { bsid=CC1(Buffer+Buffer_Offset+4)>>3; int16u Size=0; if (bsid<=0x09) { int8u fscod =(CC1(Buffer+Buffer_Offset+5)>>6)&0x03; int8u frmsizecod=(CC1(Buffer+Buffer_Offset+5) )&0x3F; Size=AC3_FrameSize_Get(frmsizecod, fscod); } else if (bsid>0x0A && bsid<=0x10) { int16u frmsiz=LittleEndian2int16u(Buffer+Buffer_Offset+2)&0x07FF; Size=2+frmsiz*2; } if (Size>=6) { if (Buffer_Offset+Size>Buffer_Size) return false; //Need more data Save_Buffer=Buffer; Save_Buffer_Offset=Buffer_Offset; Save_Buffer_Size=Buffer_Size; //Exception handling try { int8u* Buffer_Little=new int8u[Size]; for (size_t Pos=0; Pos+1File_Ac3_IgnoreCrc_Get(); IgnoreCrc_Done=true; } if (IgnoreCrc && !Status[IsAccepted]) //Else there are some wrong synchronizations { MediaInfo_Internal MI; Ztring ParseSpeed_Save=MI.Option(__T("ParseSpeed_Get"), __T("")); Ztring Demux_Save=MI.Option(__T("Demux_Get"), __T("")); MI.Option(__T("ParseSpeed"), __T("0")); MI.Option(__T("Demux"), Ztring()); size_t MiOpenResult=MI.Open(File_Name); MI.Option(__T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value MI.Option(__T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value if (MiOpenResult) { Ztring Format=MI.Get(Stream_General, 0, General_Format); if (Format!=__T("AC-3") && Format!=__T("E-AC-3")) IgnoreCrc=false; } else IgnoreCrc=false; // Problem } if (IgnoreCrc) return true; int16u CRC_16=0x0000; const int8u* CRC_16_Buffer=Buffer+Buffer_Offset+2; //After syncword const int8u* CRC_16_Buffer_5_8=Buffer+Buffer_Offset+(((Size>>2)+(Size>>4))<<1); //Magic formula to meet 5/8 frame size from Dolby const int8u* CRC_16_Buffer_EndMinus3=Buffer+Buffer_Offset+Size-3; //End of frame minus 3 const int8u* CRC_16_Buffer_End=Buffer+Buffer_Offset+Size; //End of frame while(CRC_16_Buffer>8)^(*CRC_16_Buffer)]; //CRC bytes inversion if (CRC_16_Buffer==CRC_16_Buffer_EndMinus3 && bsid<=0x09 && ((*CRC_16_Buffer)&0x01)) //CRC inversion bit { CRC_16_Buffer++; CRC_16=(CRC_16<<8) ^ CRC_16_Table[(CRC_16>>8)^((int8u)(~(*CRC_16_Buffer)))]; CRC_16_Buffer++; CRC_16=(CRC_16<<8) ^ CRC_16_Table[(CRC_16>>8)^((int8u)(~(*CRC_16_Buffer)))]; } CRC_16_Buffer++; //5/8 intermediate test if (CRC_16_Buffer==CRC_16_Buffer_5_8 && bsid<=0x09 && CRC_16!=0x0000) break; } return (CRC_16==0x0000); } //--------------------------------------------------------------------------- size_t File_Ac3::Core_Size_Get() { int16u Size=1; bsid=(Buffer[(size_t)(Buffer_Offset+5)]&0xF8)>>3; if (bsid<=0x09) { fscod =(Buffer[(size_t)(Buffer_Offset+4)]&0xC0)>>6; frmsizecod= Buffer[(size_t)(Buffer_Offset+4)]&0x3F; //Filling fscods[fscod]++; frmsizecods[frmsizecod]++; Size=AC3_FrameSize_Get(frmsizecod, fscod); } else if (bsid>0x0A && bsid<=0x10) { int16u frmsiz =((int16u)(Buffer[(size_t)(Buffer_Offset+2)]&0x07)<<8) | ( Buffer[(size_t)(Buffer_Offset+3)] ); //Filling Size=2+frmsiz*2; substreams_Count=0; int8u substreams_Count_Independant=0; int8u substreams_Count_Dependant=0; for (;;) { if (Buffer_Offset+Size+6>Buffer_Size) { if (!IsSub && !Save_Buffer) Element_WaitForMoreData(); break; } int8u bsid=Buffer[Buffer_Offset+Size+5]>>3; if (bsid<=0x09 || bsid>0x10) break; //Not E-AC-3 int8u strmtyp=Buffer[Buffer_Offset+Size+2]>>6; if (strmtyp!=1) break; //Not dependent stream if (strmtyp==0) { substreams_Count_Independant++; substreams_Count_Dependant=0; } int8u substreamid=(Buffer[Buffer_Offset+Size+2]>>3)&0x07; if (substreams_Count_Independant && substreamid!=substreams_Count_Independant) break; //Problem if (substreams_Count_Dependant && substreamid!=substreams_Count_Dependant) break; //Problem frmsiz =((int16u)(Buffer[(size_t)(Buffer_Offset+Size+2)]&0x07)<<8) | ( Buffer[(size_t)(Buffer_Offset+Size+3)] ); //Filling Size+=2+frmsiz*2; substreams_Count++; substreams_Count_Dependant++; } } return Size; } //--------------------------------------------------------------------------- size_t File_Ac3::HD_Size_Get() { size_t Size=BigEndian2int16u(Buffer+Buffer_Offset)&0x0FFF; Size*=2; return Size; } } //NameSpace #endif //MEDIAINFO_AC3_YES MediaInfoLib/Source/MediaInfo/Audio/File_Ac3.h100777 0 0 7774 12226004262 14344 0/* 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. */ //--------------------------------------------------------------------------- #ifndef MediaInfo_Ac3H #define MediaInfo_Ac3H //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Ac3 //*************************************************************************** class File_Ac3 : public File__Analyze { public : //In int64u Frame_Count_Valid; bool MustParse_dac3; bool MustParse_dec3; bool CalculateDelay; //Constructor/Destructor File_Ac3(); private : //Streams management void Streams_Fill(); void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); //Buffer - Synchro bool Synchronize(); void Synched_Init(); bool Synched_Test(); //Buffer - Demux #if MEDIAINFO_DEMUX bool Demux_UnpacketizeContainer_Test(); #endif //MEDIAINFO_DEMUX //Buffer - Global void Read_Buffer_Continue (); void Read_Buffer_Unsynched(); #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK //Buffer - Per element void Header_Parse(); void Data_Parse(); //Elements void Core(); void Core_Frame(); void HD(); void TimeStamp(); void dac3(); void dec3(); bool FrameSynchPoint_Test(); bool CRC_Compute(size_t Size); size_t Core_Size_Get(); size_t HD_Size_Get(); //Buffer const int8u* Save_Buffer; size_t Save_Buffer_Offset; size_t Save_Buffer_Size; //Temp struct dolby { int8u dialnorm; int8u compr; int8u dynrng; //This is only the first occurence of aufblk bool compre; bool dynrnge; //This is only the first occurence of aufblk dolby() { dialnorm=0; compre=false; dynrnge=false; } }; dolby FirstFrame_Dolby; dolby FirstFrame_Dolby2; std::vector dialnorms; std::vector dialnorm2s; std::vector comprs; std::vector compr2s; std::vector dynrngs; std::vector dynrng2s; std::map fscods; std::map frmsizecods; int64u Frame_Count_HD; int16u chanmap_Max[8][9]; int16u frmsizplus1_Max[8][9]; int16u HD_BitRate_Max; int16u HD_Channels2; int8u fscod; int8u fscod2; int8u frmsizecod; int8u bsid; int8u bsid_Max; int8u bsmod_Max[8][9]; int8u acmod_Max[8][9]; int8u dsurmod_Max[8][9]; int8u numblkscod; int8u HD_StreamType; int8u HD_SubStreams_Count; int8u HD_SamplingRate1; int8u HD_SamplingRate2; int8u HD_Channels1; int8u HD_Resolution1; int8u HD_Resolution2; int8u dynrng_Old; int8u substreamid_Independant_Current; int8u substreams_Count; bool lfeon_Max[8][9]; bool dxc3_Parsed; bool HD_MajorSync_Parsed; bool HD_NoRestart; bool HD_ExtraParity; bool HD_IsVBR; bool Core_IsPresent; bool HD_IsPresent; bool dynrnge_Exists; bool chanmape_Max[8][9]; bool TimeStamp_IsPresent; bool TimeStamp_IsParsing; bool TimeStamp_Parsed; bool TimeStamp_DropFrame_IsValid; bool TimeStamp_DropFrame_Content; bool BigEndian; bool IgnoreCrc_Done; bool IgnoreCrc; float64 TimeStamp_Content; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Adpcm.cpp100777 0 0 5656 12226004262 15312 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_ADPCM_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Adpcm.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Format //*************************************************************************** //--------------------------------------------------------------------------- void File_Adpcm::Read_Buffer_Continue() { //It is impossible to detect... Default is no detection, only filling //Filling Accept("ADPCM"); Stream_Prepare(Stream_Audio); Fill(Stream_General, 0, Audio_Format, "ADPCM"); Fill(Stream_General, 0, Audio_Codec, "ADPCM"); Ztring Profile, Firm; if (Codec==__T("alaw")) {Profile=__T("A-Law");} else if (Codec==__T("ulaw")) {Profile=__T("U-Law");} else if (Codec==__T("ima4")) { Firm=__T("IMA");} else if (Codec==__T("6")) {Profile=__T("A-Law");} else if (Codec==__T("7")) {Profile=__T("U-Law");} else if (Codec==__T("102")) {Profile=__T("A-Law");} else if (Codec==__T("171")) {Profile=__T("U-Law"); Firm=__T("Unisys");} else if (Codec==__T("172")) {Profile=__T("A-Law"); Firm=__T("Unisys");} if (!Profile.empty()) Fill(Stream_Audio, 0, Audio_Format_Profile, Profile); if (!Firm.empty()) { Fill(Stream_Audio, 0, Audio_Format_Settings, Firm); Fill(Stream_Audio, 0, Audio_Format_Settings_Firm, Firm); Fill(Stream_Audio, 0, Audio_Codec_Settings, Firm); Fill(Stream_Audio, 0, Audio_Codec_Settings_Firm, Firm); } Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR"); //No more need data Finish("ADPCM"); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_ADPCM_YES MediaInfoLib/Source/MediaInfo/Audio/File_Adpcm.h100777 0 0 2332 12226004262 14743 0/* 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 ADPCM files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_AdpcmH #define MediaInfo_File_AdpcmH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Adpcm //*************************************************************************** class File_Adpcm : public File__Analyze { public : //In ZenLib::Ztring Codec; protected : //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Als.cpp100777 0 0 12152 12226004262 15012 0/* 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-4 ALS files // http://www.nue.tu-berlin.de/forschung/projekte/lossless/mp4als.html // http://wiki.multimedia.cx/index.php?title=MPEG-4_Audio_Lossless_Coding_%28ALS%29 // // Contributor: Lionel Duchateau, kurtnoise@free.fr // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_ALS_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Als.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Als::File_Als() :File__Analyze(), File__Tags_Helper() { //File__Tags_Helper Base=this; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Als::Streams_Finish() { //Filling int64u CompressedSize=File_Size-TagsSize; float32 CompressionRatio=((float32)UncompressedSize)/CompressedSize; Fill(Stream_Audio, 0, Audio_StreamSize, CompressedSize); Fill(Stream_Audio, 0, Audio_Compression_Ratio, CompressionRatio); File__Tags_Helper::Streams_Finish(); } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Als::FileHeader_Begin() { if (!File__Tags_Helper::FileHeader_Begin()) return false; //Synchro if (Buffer_Offset+4>Buffer_Size) return false; if (CC4(Buffer+Buffer_Offset)!=0x414C5300) //"ALS\0" { File__Tags_Helper::Reject("ALS"); return false; } return true; } //--------------------------------------------------------------------------- void File_Als::FileHeader_Parse() { //Parsing int32u SampleRate, Samples; int16u Channels; int8u BitsPerSample, FileType; Skip_C4( "signature"); Get_B4 (SampleRate, "sample rate"); Get_B4 (Samples, "samples"); Get_B2 (Channels, "channels-1"); Param_Info2(Channels+1, " channel(s)"); BS_Begin(); Get_S1 (3, FileType, "file type"); // WAV, RIFF, AIFF Get_S1 (3, BitsPerSample, "bits per sample"); Param_Info2((BitsPerSample+1)*8, " bits"); Skip_SB( "floating point"); Skip_SB( "samples are big-endian"); BS_End(); FILLING_BEGIN(); if (SampleRate==0) return; Duration=((int64u)Samples)*1000/SampleRate; if (Duration==0) return; UncompressedSize=Samples*Channels*(BitsPerSample+1/8); if (UncompressedSize==0) return; File__Tags_Helper::Accept("ALS"); File__Tags_Helper::Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "ALS"); Fill(Stream_Audio, 0, Audio_Codec, "ALS"); Fill(Stream_Audio, 0, Audio_BitDepth, (BitsPerSample+1)*8); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Channels+1); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, SampleRate); Fill(Stream_Audio, 0, Audio_Duration, Duration); //No more need data File__Tags_Helper::Finish("ALS"); FILLING_END(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_ALS_YES MediaInfoLib/Source/MediaInfo/Audio/File_Als.h100777 0 0 3071 12226004262 14437 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Contributor: Lionel Duchateau, kurtnoise@free.fr // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_AlsH #define MediaInfo_File_AlsH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Tag/File__Tags.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Als //*************************************************************************** class File_Als : public File__Analyze, public File__Tags_Helper { public : //Constructor/Destructor File_Als(); private : //Streams management void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse(); //Buffer - Global void Read_Buffer_Continue() {File__Tags_Helper::Read_Buffer_Continue();} //Temp int64u Duration; int64u UncompressedSize; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Amr.cpp100777 0 0 20277 12226004262 15021 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AMR_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Amr.h" #include "ZenLib/Utils.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constants //*************************************************************************** int16u Amr_BitRate[]= { 5200, 5600, 6400, 7200, 8000, 8400, 10800, 12800, 3600, 3600, 3600, 3600, 0, 0, 0, 400, }; //*************************************************************************** // Format //*************************************************************************** //--------------------------------------------------------------------------- File_Amr::File_Amr() :File__Analyze() { //Temp Header_Size=(int64u)-1; Frame_Number=0; FrameType=(int8u)-1; } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Amr::FileHeader_Begin() { if (!Codec.empty()) //Test of header only if it is a file --> The codec field is empty return true; //Testing if (Buffer_Size<5) return false; //Must wait for more data if (CC5(Buffer)!=0x2321414D52LL) //"#!AMR" { Reject("AMR"); return false; } //All should be OK... return true; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Amr::Streams_Fill() { Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "AMR"); Fill(Stream_Audio, 0, Audio_Codec, "AMR"); if (!Codec.empty()) { if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Mpeg4, Codec, InfoCodecID_Profile)==__T("Narrow band")) IsWB=false; if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Mpeg4, Codec, InfoCodecID_Profile)==__T("Wide band")) IsWB=true; Channels=1; } if (Channels==0) return; //No more info if (Header_Size!=(int64u)-1) Fill(Stream_General, 0, General_StreamSize, Header_Size); Fill(Stream_Audio, 0, Audio_Channel_s_, Channels); if (IsWB) { Fill(Stream_Audio, 0, Audio_Format_Profile, "Wide band"); Fill(Stream_Audio, 0, Audio_Codec, "sawb", Unlimited, true, true); if (Codec.empty()) //If there is a container, trusting the container sampling rate Fill(Stream_Audio, 0, Audio_SamplingRate, 16000); Fill(Stream_Audio, 0, Audio_BitDepth, 14); //Fill(Stream_Audio, 0, Audio_InternetMediaType, "audio/AMR-WB", Unlimited, true, true); } else { Fill(Stream_Audio, 0, Audio_Format_Profile, "Narrow band"); Fill(Stream_Audio, 0, Audio_Codec, "samr", Unlimited, true, true); if (Codec.empty()) //If there is a container, trusting the container sampling rate Fill(Stream_Audio, 0, Audio_SamplingRate, 8000); Fill(Stream_Audio, 0, Audio_BitDepth, 13); if (FrameType!=(int8u)-1 && Amr_BitRate[FrameType] && FrameTypes.size()==1) { Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR"); Fill(Stream_Audio, 0, Audio_BitRate, Amr_BitRate[FrameType]); Fill(Stream_General, 0, General_OverallBitRate, Amr_BitRate[FrameType]); if (File_Size!=(int64u)-1) { Fill(Stream_Audio, 0, Audio_Duration, ((float32)(File_Size-Header_Size))*8*1000/Amr_BitRate[FrameType]); } } } } //--------------------------------------------------------------------------- void File_Amr::Streams_Finish() { } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Amr::FileHeader_Parse() { //From a container if (!Codec.empty()) { Accept("AMR"); Finish("AMR"); return; } //Parsing int64u Signature; Skip_C5( "Signature (Common)"); Peek_B8(Signature); if ((Signature&0xFF00000000000000LL)==0x0A00000000000000LL) //\n { IsWB=false; Channels=1; } else if ((Signature&0xFFFFFFFFFFFFFF00LL)==0x5F4D43312E300A00LL) //_MC1.0\n { IsWB=false; Channels=2; //Or more, see later } else if ((Signature&0xFFFFFF0000000000LL)==0x2D57420000000000LL) //-WB { Skip_C3( "Signature (WB)"); IsWB=true; Peek_B8(Signature); if ((Signature&0xFF00000000000000LL)==0x0A00000000000000LL) //\n { Channels=1; } else if ((Signature&0xFFFFFFFFFFFFFF00LL)==0x5F4D43312E300A00LL) //_MC1.0\n { Channels=2; //Or more, see later } } else Channels=0; Skip_B1( "Signature (Carriage return)"); /* if (Channels==2) //Mutli-channels { BS_Begin(); Skip_S4(28, "Reserved"); Get_S1 ( 4, Channels, "Channels"); } */ Header_Size=(int8u)Element_Offset; FILLING_BEGIN(); Accept("AMR"); if (Channels!=1 || IsWB) Finish("AMR"); FILLING_END(); } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Amr::Header_Parse() { BS_Begin(); Skip_SB( "Frame Following"); Get_S1 ( 4, FrameType, "Frame Type"); Skip_SB( "Frame Quality"); Skip_SB( "Unknown"); Skip_SB( "Unknown"); BS_End(); //Filling if (Amr_BitRate[FrameType]==0) { Finish("AMR"); return; } Header_Fill_Size(Amr_BitRate[FrameType]/400); Header_Fill_Code(0, "frame"); } //--------------------------------------------------------------------------- void File_Amr::Data_Parse() { Element_Info1(Frame_Number); //Parsing Skip_XX(Element_Size, "Data"); FILLING_BEGIN(); Frame_Number++; FrameTypes[FrameType]++; if (Frame_Number>=32) Finish("AMR"); FILLING_END(); } } //NameSpace #endif //MEDIAINFO_AMR_YES MediaInfoLib/Source/MediaInfo/Audio/File_Amr.h100777 0 0 3156 12226004262 14443 0/* 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 Musepack files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_AmrH #define MediaInfo_File_AmrH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Amr //*************************************************************************** class File_Amr : public File__Analyze { public : //In ZenLib::Ztring Codec; public : File_Amr(); protected : //Streams management void Streams_Fill(); void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse (); //Buffer - Per element void Header_Parse(); void Data_Parse(); //Temp size_t Frame_Number; std::map FrameTypes; int64u Header_Size; int8u FrameType; int8u Channels; bool IsWB; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Amv.cpp100777 0 0 3132 12226004262 14774 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AMV_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Amv.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Amv::Read_Buffer_Continue() { Reject("AMV"); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_AMV_YES MediaInfoLib/Source/MediaInfo/Audio/File_Amv.h100777 0 0 2245 12226004262 14445 0/* 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 asian AMV files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_AmvH #define MediaInfo_File_AmvH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Amv //*************************************************************************** class File_Amv : public File__Analyze { protected : //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Ape.cpp100777 0 0 21035 12226004262 15000 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_APE_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Ape.h" using namespace std; using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- int32u Ape_SamplesPerFrame(int16u Version, int16u CompressionLevel) { if (Version>=3950) return 73728*4; else if (Version>=3900) return 73728; else if (Version>=3800 && CompressionLevel==4000) return 73728; else return 9216; } //--------------------------------------------------------------------------- const char* Ape_Codec_Settings(int16u Setting) { switch (Setting) { case 1000 : return "Fast"; case 2000 : return "Normal"; case 3000 : return "High"; case 4000 : return "Extra-high"; case 5000 : return "Insane"; default : return ""; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Ape::File_Ape() :File__Analyze(), File__Tags_Helper() { //File__Tags_Helper Base=this; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Ape::Streams_Finish() { //Filling int64u CompressedSize=File_Size-TagsSize; float32 CompressionRatio=((float32)UncompressedSize)/CompressedSize; int64u BitRate=Duration?(CompressedSize*8*1000/Duration):0; Fill(Stream_Audio, 0, Audio_Compression_Ratio, CompressionRatio); Fill(Stream_Audio, 0, Audio_BitRate, BitRate); File__Tags_Helper::Streams_Finish(); } //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- bool File_Ape::FileHeader_Begin() { if (!File__Tags_Helper::FileHeader_Begin()) return false; //Testing if (Buffer_Offset+4>Buffer_Size) return false; if (CC4(Buffer+Buffer_Offset)!=0x4D414320) //"MAC " { File__Tags_Helper::Reject("APE"); return false; } return true; } //--------------------------------------------------------------------------- void File_Ape::FileHeader_Parse() { //Parsing int32u SampleRate=0, TotalFrames=0, FinalFrameSamples=0, SamplesPerFrame=0, SeekElements; int16u Version, CompressionLevel=0, Flags=0, Channels=0, Resolution=0; Skip_C4( "Identifier"); Get_L2 (Version, "Version"); if (Version<3980) //<3.98 { bool Resolution8=false, Resolution24=false, no_wav_header; Get_L2 (CompressionLevel, "CompressionLevel"); Param_Info1(Ape_Codec_Settings(CompressionLevel)); Get_L2 (Flags, "FormatFlags"); Get_Flags (Flags, 0, Resolution8, "8-bit"); Skip_Flags(Flags, 1, "crc-32"); Skip_Flags(Flags, 2, "peak_level"); Get_Flags (Flags, 3, Resolution24, "24-bit"); Skip_Flags(Flags, 4, "seek_elements"); Get_Flags (Flags, 5, no_wav_header, "no_wav_header"); if (Resolution8) Resolution=8; else if (Resolution24) Resolution=24; else Resolution=16; Get_L2 (Channels, "Channels"); Get_L4 (SampleRate, "SampleRate"); Skip_L4( "WavHeaderDataBytes"); Skip_L4( "WavTerminatingBytes"); Get_L4 (TotalFrames, "TotalFrames"); Get_L4 (FinalFrameSamples, "FinalFrameSamples"); SamplesPerFrame=Ape_SamplesPerFrame(Version, CompressionLevel); Skip_L4( "PeakLevel"); Get_L4 (SeekElements, "SeekElements"); if (!no_wav_header) Skip_XX(44, "RIFF header"); Skip_XX(SeekElements*4, "Seek table"); } else { Skip_L2( "Version_High"); Skip_L4( "DescriptorBytes"); Skip_L4( "HeaderBytes"); Skip_L4( "SeekTableBytes"); Skip_L4( "WavHeaderDataBytes"); Skip_L4( "APEFrameDataBytes"); Skip_L4( "APEFrameDataBytesHigh"); Skip_L4( "WavTerminatingDataBytes"); Skip_L16( "FileMD5"); Get_L2 (CompressionLevel, "CompressionLevel"); Param_Info1(Ape_Codec_Settings(CompressionLevel)); Get_L2 (Flags, "FormatFlags"); Get_L4 (SamplesPerFrame, "BlocksPerFrame"); Get_L4 (FinalFrameSamples, "FinalFrameBlocks"); Get_L4 (TotalFrames, "TotalFrames"); Get_L2 (Resolution, "BitsPerSample"); Get_L2 (Channels, "Channels"); Get_L4 (SampleRate, "SampleRate"); } FILLING_BEGIN(); //Coherancy int32u Samples=(TotalFrames-1)*SamplesPerFrame+FinalFrameSamples; if (Samples==0 || SampleRate==0 || Channels==0 || Resolution==0) { File__Tags_Helper::Reject("APE"); return; } //Filling File__Tags_Helper::Accept("APE"); File__Tags_Helper::Streams_Fill(); Duration=((int64u)Samples)*1000/SampleRate; UncompressedSize=Samples*Channels*(Resolution/8); File__Tags_Helper::Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "Monkey's Audio"); Fill(Stream_Audio, 0, Audio_Encoded_Library_Settings, Ape_Codec_Settings(CompressionLevel)); Fill(Stream_Audio, 0, Audio_Codec, "APE"); Fill(Stream_Audio, 0, Audio_BitDepth, Resolution); Fill(Stream_Audio, 0, Audio_Channel_s_, Channels); Fill(Stream_Audio, 0, Audio_SamplingRate, SampleRate); Fill(Stream_Audio, 0, Audio_Duration, Duration); //No more need data File__Tags_Helper::Finish("APE"); FILLING_END(); } } //NameSpace #endif //MEDIAINFO_APE_YES MediaInfoLib/Source/MediaInfo/Audio/File_Ape.h100777 0 0 3044 12226004262 14425 0/* 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 Ape files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_ApeH #define MediaInfo_File_ApeH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Tag/File__Tags.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Ape //*************************************************************************** class File_Ape : public File__Analyze, public File__Tags_Helper { public : //Constructor/Destructor File_Ape(); private : //Streams management void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse(); //Buffer - Global void Read_Buffer_Continue() {File__Tags_Helper::Read_Buffer_Continue();} //Temp int64u Duration; int64u UncompressedSize; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Au.cpp100777 0 0 15116 12226004262 14643 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Source: http://wiki.multimedia.cx/index.php?title=Au/snd // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AU_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Au.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* Au_Format(int32u sample_format) { switch (sample_format) { case 1 : return "ADPCM"; case 2 : return "PCM"; case 3 : return "PCM"; case 4 : return "PCM"; case 5 : return "PCM"; case 6 : return "PCM"; case 7 : return "PCM"; case 8 : return "fragmented sampled data"; case 10 : return "DSP program"; case 11 : return "PCM"; case 12 : return "PCM"; case 13 : return "PCM"; case 14 : return "PCM"; case 17 : return "ADPCM"; case 18 : return "PCM"; case 19 : return "PCM"; case 20 : return "PCM"; case 21 : return "Music Kit DSP commands"; case 22 : return "Music Kit DSP samples"; case 23 : return "ADPCM"; case 24 : return "ADPCM"; case 25 : return "ADPCM"; case 26 : return "ADPCM"; case 27 : return "ADPCM"; default : return ""; } } //--------------------------------------------------------------------------- const char* Au_sample_format(int32u sample_format) { switch (sample_format) { case 1 : return "8-bit mu-law"; case 2 : return "8-bit signed linear"; case 3 : return "16-bit signed linear"; case 4 : return "24-bit signed linear"; case 5 : return "32-bit signed linear"; case 6 : return "floating-point"; case 7 : return "double precision float"; case 8 : return "fragmented sampled data"; case 10 : return "DSP program"; case 11 : return "8-bit fixed-point"; case 12 : return "16-bit fixed-point"; case 13 : return "24-bit fixed-point"; case 14 : return "32-bit fixed-point"; case 17 : return "mu-law squelch"; case 18 : return "16-bit linear with emphasis"; case 19 : return "16-bit linear with compression"; case 20 : return "16-bit linear with emphasis and compression"; case 21 : return "Music Kit DSP commands"; case 22 : return "Music Kit DSP samples"; case 23 : return "G.721 ADPCM"; case 24 : return "G.722 ADPCM"; case 25 : return "G.723 ADPCM"; case 26 : return "5-bit G.723 ADPCM"; case 27 : return "8-bit a-law"; default : return ""; } } //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_Au::FileHeader_Begin() { //Element_Size if (Buffer_Size<4) return false; //Must wait for more data if (CC4(Buffer)!=0x2E736E64) //".snd" { Reject("AU"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Au::FileHeader_Parse() { //Parsing Ztring arbitrary; int32u data_start, data_size, sample_format, sample_rate, channels; Skip_B4( "Magic"); Get_B4 (data_start, "data_start"); Get_B4 (data_size, "data_size"); Get_B4 (sample_format, "sample_format"); Get_B4 (sample_rate, "sample_rate"); Get_B4 (channels, "channels"); if (data_start>24) Get_Local(data_start-24, arbitrary, "arbitrary data"); FILLING_BEGIN(); Accept("AU"); Fill(Stream_General, 0, General_Format, "AU"); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, Au_Format(sample_format)); Fill(Stream_Audio, 0, Audio_CodecID, Au_sample_format(sample_format)); Fill(Stream_Audio, 0, Audio_Codec, Au_sample_format(sample_format)); Fill(Stream_Audio, 0, Audio_Channel_s_, channels); Fill(Stream_Audio, 0, Audio_SamplingRate, sample_rate); if (File_Size!=(int64u)-1) data_size=(int32u)File_Size-data_start; //Priority for File size if (sample_rate && data_size!=0 && data_size!=0xFFFFFFFF) Fill(Stream_Audio, 0, Audio_Duration, ((int64u)data_size)*1000/sample_rate); Fill(Stream_Audio, 0, Audio_StreamSize, File_Size-Element_Offset); Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR"); Fill(Stream_General, 0, General_Comment, arbitrary); //No more need data Finish("AU"); FILLING_END(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_AU_YES MediaInfoLib/Source/MediaInfo/Audio/File_Au.h100777 0 0 2271 12226004262 14266 0/* 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 AU files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_AuH #define MediaInfo_File_AuH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Au //*************************************************************************** class File_Au : public File__Analyze { protected : //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Celt.cpp100777 0 0 12424 12226004262 15164 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Contributor: Lionel Duchateau, kurtnoise@free.fr // // Note : the buffer must be given in ONE call // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_CELT_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Celt.h" using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Celt::File_Celt() :File__Analyze() { //Internal Identification_Done=false; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Celt::Header_Parse() { //Filling Header_Fill_Code(0, "CELT"); Header_Fill_Size(Element_Size); } //--------------------------------------------------------------------------- void File_Celt::Data_Parse() { //Parsing if (Identification_Done) Comment(); else Identification(); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Celt::Identification() { Element_Name("Identification"); //Parsing Ztring celt_version; int32u Celt_version_id, sample_rate, nb_channels; Skip_Local(8, "celt_codec_id"); Get_Local(20, celt_version, "celt_version"); Get_L4 (Celt_version_id, "celt_version_id"); Skip_L4( "header_size"); Get_L4 (sample_rate, "rate"); Get_L4 (nb_channels, "nb_channels"); Skip_L4( "frame_size"); Skip_L4( "overlap"); Skip_L4( "bytes_per_packet"); Skip_L4( "extra_headers"); //Filling FILLING_BEGIN(); Accept("CELT"); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "CELT"); Fill(Stream_Audio, 0, Audio_Codec, "CELT"); if (!celt_version.empty()) { //Fill(Stream_Audio, 0, Audio_Encoded_Library, celt_version); //Need more info about hte different possibilities, in the meanwhile trusting more the comment part Fill(Stream_Audio, 0, Audio_SamplingRate, sample_rate); Fill(Stream_Audio, 0, Audio_Channel_s_, nb_channels); } FILLING_END(); //Filling Identification_Done=true; } //--------------------------------------------------------------------------- void File_Celt::Comment() { Element_Name("Comment?"); while (Element_OffsetInstances--; if (Common->Instances==0) { for (size_t Pos=0; PosChannels.size(); Pos++) delete Common->Channels[Pos]; //Common->Channels[Pos]=NULL; delete Common; //Common=NULL; } } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_ChannelGrouping::Streams_Fill() { Fill(Stream_General, 0, General_Format, "ChannelGrouping"); if (Channel_Pos!=Common->Channels.size()-1) return; if (Common->Parsers.size()!=1 && CanBePcm) // Last parser is PCM, impossible to detect with another method if htere is only one block { for (size_t Pos=0; PosParsers.size()-1; Pos++) delete Common->Parsers[Pos]; Common->Parsers.erase(Common->Parsers.begin(), Common->Parsers.begin()+Common->Parsers.size()-1); Common->Parsers[0]->Accept(); Common->Parsers[0]->Fill(); } if (Common->Parsers.size()!=1) return; Fill(Common->Parsers[0]); Merge(*Common->Parsers[0]); } //--------------------------------------------------------------------------- void File_ChannelGrouping::Streams_Finish() { if (Channel_Pos!=Common->Channels.size()-1 || Common->Parsers.size()!=1) return; Finish(Common->Parsers[0]); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_ChannelGrouping::Read_Buffer_Init() { if (Common==NULL) { //Common Common=new common; Common->Channels.resize(Channel_Total); for (size_t Pos=0; PosChannels.size(); Pos++) Common->Channels[Pos]=new common::channel; Element_Code=(int64u)-1; //SMPTE ST 337 { File_SmpteSt0337* Parser=new File_SmpteSt0337; Parser->Container_Bits=BitDepth; Parser->Endianness=Endianness; Parser->Aligned=Aligned; Common->Parsers.push_back(Parser); } //PCM if (CanBePcm) { File_Pcm* Parser=new File_Pcm; Parser->BitDepth=BitDepth; Parser->Channels=Channel_Total; Parser->SamplingRate=SamplingRate; Parser->Endianness=Endianness; Common->Parsers.push_back(Parser); } //for all parsers for (size_t Pos=0; PosParsers.size(); Pos++) { #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Common->Parsers[Pos]->Demux_UnpacketizeContainer=true; Common->Parsers[Pos]->Demux_Level=2; //Container Demux_Level=4; //Intermediate } #endif //MEDIAINFO_DEMUX Open_Buffer_Init(Common->Parsers[Pos]); } } Common->Instances++; Common->Instances_Max++; } //--------------------------------------------------------------------------- void File_ChannelGrouping::Read_Buffer_Continue() { //Verifying that all instances are still present if (Common->Instances!=Common->Instances_Max) { Reject(); return; } //Handling of multiple frames in one block if (Buffer_Size==0) { Offsets_Stream.clear(); Offsets_Buffer.clear(); for (size_t Pos=0; PosParsers.size(); Pos++) Open_Buffer_Continue(Common->Parsers[Pos], Common->MergedChannel.Buffer+Common->MergedChannel.Buffer_Offset, 0, false); return; } //Demux #if MEDIAINFO_DEMUX Demux(Common->MergedChannel.Buffer+Common->MergedChannel.Buffer_Offset, Common->MergedChannel.Buffer_Size-Common->MergedChannel.Buffer_Offset, ContentType_MainStream); #endif //MEDIAINFO_EVENTS //Copying to Channel buffer if (Common->Channels[Channel_Pos]->Buffer_Size+Buffer_Size>Common->Channels[Channel_Pos]->Buffer_Size_Max) Common->Channels[Channel_Pos]->resize(Common->Channels[Channel_Pos]->Buffer_Size+Buffer_Size); memcpy(Common->Channels[Channel_Pos]->Buffer+Common->Channels[Channel_Pos]->Buffer_Size, Buffer, Buffer_Size); Common->Channels[Channel_Pos]->Buffer_Size+=Buffer_Size; Common->Channels[Channel_Pos]->Offsets_Stream.insert(Common->Channels[Channel_Pos]->Offsets_Stream.begin(), Offsets_Stream.begin(), Offsets_Stream.end()); Offsets_Stream.clear(); Common->Channels[Channel_Pos]->Offsets_Buffer.insert(Common->Channels[Channel_Pos]->Offsets_Buffer.begin(), Offsets_Buffer.begin(), Offsets_Buffer.end()); Offsets_Buffer.clear(); Skip_XX(Buffer_Size, "Channel grouping data"); Common->Channel_Current++; if (Common->Channel_Current>=Channel_Total) Common->Channel_Current=0; //Copying to merged channel size_t Minimum=(size_t)-1; for (size_t Pos=0; PosChannels.size(); Pos++) if (Minimum>Common->Channels[Pos]->Buffer_Size-Common->Channels[Pos]->Buffer_Offset) Minimum=Common->Channels[Pos]->Buffer_Size-Common->Channels[Pos]->Buffer_Offset; if (Minimum*8>=BitDepth) { for (size_t Pos=0; PosChannels.size(); Pos++) { Common->MergedChannel.Offsets_Stream.insert(Common->MergedChannel.Offsets_Stream.end(), Common->Channels[Pos]->Offsets_Stream.begin(), Common->Channels[Pos]->Offsets_Stream.end()); Common->Channels[Pos]->Offsets_Stream.clear(); Common->MergedChannel.Offsets_Buffer.insert(Common->MergedChannel.Offsets_Buffer.end(), Common->Channels[Pos]->Offsets_Buffer.begin(), Common->Channels[Pos]->Offsets_Buffer.end()); Common->Channels[Pos]->Offsets_Buffer.clear(); } while (Minimum*8>=BitDepth) { switch (BitDepth) { case 16: // Source: 16XE / L3L2 L1L0 + R3R2 R1R0 // Dest : 16XE / L3L2 L1L0 R3R2 R1R0 for (size_t Pos=0; PosChannels.size(); Pos++) { if (Common->MergedChannel.Buffer_Size+Minimum>Common->MergedChannel.Buffer_Size_Max) Common->MergedChannel.resize(Common->MergedChannel.Buffer_Size+Minimum); Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]= Common->Channels[Pos]->Buffer[Common->Channels[Pos]->Buffer_Offset++]; Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]= Common->Channels[Pos]->Buffer[Common->Channels[Pos]->Buffer_Offset++]; } Minimum-=2; break; case 20: // Source: 20BE / L4L3 L2L1 L0L4 L3L2 L1L0 + R4R3 R2R1 R0R4 R3R2 R1R0 // Dest : 20BE / L4L3 L2L1 L0R4 R3R2 R1R0 L4L3 L2L1 L0R4 R2R1 R1R0 if (Endianness=='B') for (size_t Pos=0; Pos+1Channels.size(); Pos+=2) { if (Common->MergedChannel.Buffer_Size+Minimum*2>Common->MergedChannel.Buffer_Size_Max) Common->MergedChannel.resize(Common->MergedChannel.Buffer_Size+Minimum*2); int8u* Channel1=Common->Channels[Pos]->Buffer+Common->Channels[Pos]->Buffer_Offset; int8u* Channel2=Common->Channels[Pos]->Buffer+Common->Channels[Pos]->Buffer_Offset; Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]= Channel1[0]; Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]= Channel1[1]; Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]=(Channel1[0]&0xF0) | (Channel2[0]>>4 ); Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]=(Channel2[0]<<4 ) | (Channel2[1]>>4 ); Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]=(Channel2[1]<<4 ) | (Channel2[2]>>4 ); Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]=(Channel1[2]<<4 ) | (Channel1[3]>>4 ); Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]=(Channel1[3]<<4 ) | (Channel1[4]>>4 ); Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]=(Channel1[4]<<4 ) | (Channel2[2]&0x0F); Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]= Channel2[3]; Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]= Channel2[4]; Common->Channels[Pos]->Buffer_Offset+=5; Common->Channels[Pos+1]->Buffer_Offset+=5; } // Source: 20LE / L1L0 L3L2 L0L4 L2L1 L4L3 + R1R0 R3R2 R0R4 R2R1 R4R3 // Dest : 20LE / L1L0 L3L2 R0L4 R2R1 R4R3 L1L0 L3L2 R0L4 R2R1 R4R3 else for (size_t Pos=0; Pos+1Channels.size(); Pos+=2) { if (Common->MergedChannel.Buffer_Size+Minimum*2>Common->MergedChannel.Buffer_Size_Max) Common->MergedChannel.resize(Common->MergedChannel.Buffer_Size+Minimum*2); int8u* Channel1=Common->Channels[Pos]->Buffer+Common->Channels[Pos]->Buffer_Offset; int8u* Channel2=Common->Channels[Pos]->Buffer+Common->Channels[Pos]->Buffer_Offset; Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]= Channel1[0]; Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]= Channel1[1]; Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]=(Channel2[0]<<4 ) | (Channel1[2]&0x0F); Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]=(Channel2[1]<<4 ) | (Channel2[0]>>4 ); Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]=(Channel2[2]<<4 ) | (Channel2[1]>>4 ); Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]=(Channel1[3]<<4 ) | (Channel1[2]>>4 ); Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]=(Channel1[4]<<4 ) | (Channel1[3]>>4 ); Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]=(Channel2[2]&0xF0) | (Channel1[4]>>4 ); Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]= Channel2[3]; Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]= Channel2[4]; Common->Channels[Pos]->Buffer_Offset+=5; Common->Channels[Pos+1]->Buffer_Offset+=5; } Minimum-=5; //2.5 twice break; case 24: // Source: 24XE / L5L4 L3L2 L1L0 + R5R4 R3R2 R1R0 // Dest : 24XE / L5L4 L3L2 L1L0 R5R4 R3R2 R1R0 for (size_t Pos=0; PosChannels.size(); Pos++) { if (Common->MergedChannel.Buffer_Size+Minimum>Common->MergedChannel.Buffer_Size_Max) Common->MergedChannel.resize(Common->MergedChannel.Buffer_Size+Minimum); Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]= Common->Channels[Pos]->Buffer[Common->Channels[Pos]->Buffer_Offset++]; Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]= Common->Channels[Pos]->Buffer[Common->Channels[Pos]->Buffer_Offset++]; Common->MergedChannel.Buffer[Common->MergedChannel.Buffer_Size++]= Common->Channels[Pos]->Buffer[Common->Channels[Pos]->Buffer_Offset++]; } Minimum-=3; break; default: ; // Not supported Reject(); return; } } } if (Common->MergedChannel.Buffer_Size>Common->MergedChannel.Buffer_Offset) { for (size_t Pos=0; PosParsers.size(); Pos++) { if (FrameInfo_Next.DTS!=(int64u)-1) Common->Parsers[Pos]->FrameInfo=FrameInfo_Next; //AES3 parse has its own buffer management else if (FrameInfo.DTS!=(int64u)-1) { Common->Parsers[Pos]->FrameInfo=FrameInfo; FrameInfo=frame_info(); } Common->Parsers[Pos]->Offsets_Stream.insert(Common->Parsers[Pos]->Offsets_Stream.end(), Common->MergedChannel.Offsets_Stream.begin(), Common->MergedChannel.Offsets_Stream.end()); Common->Parsers[Pos]->Offsets_Buffer.insert(Common->Parsers[Pos]->Offsets_Buffer.end(), Common->MergedChannel.Offsets_Buffer.begin(), Common->MergedChannel.Offsets_Buffer.end()); for (size_t Offsets_Pos_Temp=Common->Parsers[Pos]->Offsets_Buffer.size()-Common->MergedChannel.Offsets_Buffer.size(); Offsets_Pos_TempParsers[Pos]->Offsets_Buffer.size(); Offsets_Pos_Temp++) Common->Parsers[Pos]->Offsets_Buffer[Offsets_Pos_Temp]+=Common->Parsers[Pos]->Buffer_Size/Common->Channels.size(); Open_Buffer_Continue(Common->Parsers[Pos], Common->MergedChannel.Buffer+Common->MergedChannel.Buffer_Offset, Common->MergedChannel.Buffer_Size-Common->MergedChannel.Buffer_Offset, false); //Multiple parsers if (Common->Parsers.size()>1) { if (!Common->Parsers[Pos]->Status[IsAccepted] && Common->Parsers[Pos]->Status[IsFinished]) { delete *(Common->Parsers.begin()+Pos); Common->Parsers.erase(Common->Parsers.begin()+Pos); Pos--; } else if (Common->Parsers.size()>1 && Common->Parsers[Pos]->Status[IsAccepted]) { File__Analyze* Parser=Common->Parsers[Pos]; for (size_t Pos2=0; Pos2Parsers.size(); Pos2++) { if (Pos2!=Pos) delete *(Common->Parsers.begin()+Pos2); } Common->Parsers.clear(); Common->Parsers.push_back(Parser); } } } Common->MergedChannel.Buffer_Offset=Common->MergedChannel.Buffer_Size; Common->MergedChannel.Offsets_Stream.clear(); Common->MergedChannel.Offsets_Buffer.clear(); } if (!Status[IsAccepted] && Common->Parsers.size()==1 && Common->Parsers[0]->Status[IsAccepted]) Accept(); if (!Status[IsFilled] && Common->Parsers.size()==1 && Common->Parsers[0]->Status[IsFilled]) Fill(); if (!Status[IsFinished] && Common->Parsers.size()==1 && Common->Parsers[0]->Status[IsFinished]) Finish(); //Optimize buffer for (size_t Pos=0; PosChannels.size(); Pos++) Common->Channels[Pos]->optimize(); Common->MergedChannel.optimize(); } //--------------------------------------------------------------------------- void File_ChannelGrouping::Read_Buffer_Unsynched() { for (size_t Pos=0; PosParsers.size(); Pos++) if (Common->Parsers[Pos]) Common->Parsers[Pos]->Open_Buffer_Unsynch(); Common->MergedChannel.Buffer_Offset=0; Common->MergedChannel.Buffer_Size=0; for (size_t Pos=0; PosChannels.size(); Pos++) { Common->Channels[Pos]->Buffer_Offset=0; Common->Channels[Pos]->Buffer_Size=0; } } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_SMPTEST0337_YES MediaInfoLib/Source/MediaInfo/Audio/File_ChannelGrouping.h100777 0 0 7376 12226004262 17017 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Some containers use mono stream for AES3 (Stereo) grouping // We need to group the 2-mono streams in one before sending // data to AES parser // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_ChannelGroupingH #define MediaInfo_File_ChannelGroupingH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_ChannelGrouping //*************************************************************************** class File_ChannelGrouping : public File__Analyze { public : //In int8u BitDepth; int16u SamplingRate; int8u Endianness; bool Aligned; bool CanBePcm; struct common { struct channel { int8u* Buffer; size_t Buffer_Offset; size_t Buffer_Size; size_t Buffer_Size_Max; std::vector Offsets_Stream; std::vector Offsets_Buffer; channel() { Buffer=new int8u[32768]; Buffer_Offset=0; Buffer_Size=0; Buffer_Size_Max=32768; } ~channel() { delete[] Buffer; //Buffer=NULL; } void resize(size_t NewSize) { if (NewSize Channels; channel MergedChannel; size_t Channel_Current; std::vector Parsers; size_t Instances; size_t Instances_Max; common() { Channel_Current=0; Instances=0; Instances_Max=0; } ~common() { for (size_t Pos=0; Pos1) Fill(Stream_Audio, StreamPos_Last, Audio_ID, Count_Get(Stream_Audio)); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, DolbyE_Channels_PerProgram(ProgramConfiguration, program)); Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions, DolbyE_ChannelPositions_PerProgram(ProgramConfiguration, program)); Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions_String2, DolbyE_ChannelPositions2_PerProgram(ProgramConfiguration, program)); Fill(Stream_Audio, StreamPos_Last, Audio_ChannelLayout, DolbyE_ChannelLayout_PerProgram(ProgramConfiguration, program)); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, 48000); Fill(Stream_Audio, StreamPos_Last, Audio_BitDepth, BitDepth); if (SMPTE_time_code_StartTimecode!=(int64u)-1) { Fill(StreamKind_Last, StreamPos_Last, Audio_Delay, SMPTE_time_code_StartTimecode); Fill(StreamKind_Last, StreamPos_Last, Audio_Delay_Source, "Stream"); } Fill(Stream_Audio, StreamPos_Last, Audio_FrameRate, Mpegv_frame_rate[FrameRate]); if (FrameInfo.PTS!=(int64u)-1 && BitDepth) { float BitRate=(float)(96000*BitDepth); if (GuardBand_Before_Initial) { float GuardBand_Before_Initial_Duration=GuardBand_Before_Initial*8/BitRate; Fill(Stream_Audio, StreamPos_Last, "GuardBand_Before", GuardBand_Before_Initial_Duration, 9); Fill(Stream_Audio, StreamPos_Last, "GuardBand_Before/String", Ztring::ToZtring(GuardBand_Before_Initial_Duration*1000000, 0)+Ztring().From_UTF8(" \xC2xB5s")); //0xC2 0xB5 = micro sign (*Stream_More)[Stream_Audio][StreamPos_Last](Ztring().From_Local("GuardBand_Before"), Info_Options)=__T("N NT"); (*Stream_More)[Stream_Audio][StreamPos_Last](Ztring().From_Local("GuardBand_Before/String"), Info_Options)=__T("N NT"); } if (GuardBand_Before_Initial) { float GuardBand_After_Initial_Duration=GuardBand_After_Initial*8/BitRate; Fill(Stream_Audio, StreamPos_Last, "GuardBand_After", GuardBand_After_Initial_Duration, 9); Fill(Stream_Audio, StreamPos_Last, "GuardBand_After/String", Ztring::ToZtring(GuardBand_After_Initial_Duration*1000000, 0)+Ztring().From_UTF8(" \xC2xB5s")); //0xC2 0xB5 = micro sign (*Stream_More)[Stream_Audio][StreamPos_Last](Ztring().From_Local("GuardBand_After"), Info_Options)=__T("N NT"); (*Stream_More)[Stream_Audio][StreamPos_Last](Ztring().From_Local("GuardBand_After/String"), Info_Options)=__T("N NT"); } } } Fill(Stream_General, 0, General_OverallBitRate, Element_Size*8*Mpegv_frame_rate[FrameRate], 0); } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_DolbyE::Synchronize() { //Synchronizing while (Buffer_Offset+32<=Buffer_Size) { if ((CC2(Buffer+Buffer_Offset_Temp)&0xFFFE)==0x078E) //16-bit { BitDepth=16; ScrambledBitStream=(CC2(Buffer+Buffer_Offset)&0x0001)?true:false; break; //while() } if ((CC3(Buffer+Buffer_Offset)&0xFFFFE0)==0x0788E0) //20-bit { BitDepth=20; ScrambledBitStream=(CC3(Buffer+Buffer_Offset)&0x000010)?true:false; break; //while() } if ((CC3(Buffer+Buffer_Offset)&0xFFFFFE)==0x07888E) //24-bit { BitDepth=24; ScrambledBitStream=(CC3(Buffer+Buffer_Offset)&0x000001)?true:false; break; //while() } Buffer_Offset++; } //Parsing last bytes if needed if (Buffer_Offset+8>Buffer_Size) return false; //Synched return true; } //--------------------------------------------------------------------------- bool File_DolbyE::Synched_Test() { //Must have enough buffer for having header if (Buffer_Offset+32>Buffer_Size) return false; //Quick test of synchro switch (BitDepth) { case 16 : if ((CC2(Buffer+Buffer_Offset)&0xFFFE )!=0x078E ) {Synched=false; return true;} break; case 20 : if ((CC3(Buffer+Buffer_Offset)&0xFFFFE0)!=0x0788E0) {Synched=false; return true;} break; case 24 : if ((CC3(Buffer+Buffer_Offset)&0xFFFFFE)!=0x07888E) {Synched=false; return true;} break; default : ; } //We continue return true; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_DolbyE::Header_Parse() { //Filling if (IsSub) Header_Fill_Size(Buffer_Size-Buffer_Offset); else { //Looking for synchro //Synchronizing Buffer_Offset_Temp=Buffer_Offset+3; if (BitDepth==16) while (Buffer_Offset_Temp+2<=Buffer_Size) { if ((CC2(Buffer+Buffer_Offset_Temp)&0xFFFE)==0x078E) //16-bit break; //while() Buffer_Offset_Temp++; } if (BitDepth==20) while (Buffer_Offset_Temp+3<=Buffer_Size) { if ((CC3(Buffer+Buffer_Offset_Temp)&0xFFFFE0)==0x0788E0) //20-bit break; //while() Buffer_Offset_Temp++; } if (BitDepth==24) while (Buffer_Offset_Temp+3<=Buffer_Size) { if ((CC3(Buffer+Buffer_Offset_Temp)&0xFFFFFE)==0x07888E) //24-bit break; //while() Buffer_Offset_Temp++; } if (Buffer_Offset_Temp+(BitDepth>16?3:2)>Buffer_Size) { if (File_Offset+Buffer_Size==File_Size) Buffer_Offset_Temp=Buffer_Size; else { Element_WaitForMoreData(); return; } } Header_Fill_Size(Buffer_Offset_Temp-Buffer_Offset); } Header_Fill_Code(0, "Frame"); } //--------------------------------------------------------------------------- void File_DolbyE::Data_Parse() { //In case of scrambling const int8u* Save_Buffer=NULL; size_t Save_Buffer_Offset=0; int64u Save_File_Offset=0; if (ScrambledBitStream) { //We must change the buffer, Save_Buffer=Buffer; Save_Buffer_Offset=Buffer_Offset; Save_File_Offset=File_Offset; File_Offset+=Buffer_Offset; Buffer_Offset=0; Descrambled_Buffer=new int8u[(size_t)Element_Size]; std::memcpy(Descrambled_Buffer, Save_Buffer+Save_Buffer_Offset, (size_t)Element_Size); Buffer=Descrambled_Buffer; } //Parsing BS_Begin(); Block(); BS_End(); //In case of scrambling if (ScrambledBitStream) { delete[] Buffer; Buffer=Save_Buffer; Buffer_Offset=Save_Buffer_Offset; File_Offset=Save_File_Offset; } FILLING_BEGIN(); if (!Status[IsAccepted]) { Accept("Dolby E"); //Guard band GuardBand_Before_Initial=GuardBand_Before; GuardBand_After_Initial=GuardBand_After; } Frame_Count++; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; if (Mpegv_frame_rate[FrameRate]) FrameInfo.DUR=float64_int64s(1000000000/Mpegv_frame_rate[FrameRate]); else FrameInfo.DUR=(int64u)-1; if (FrameInfo.DTS!=(int64u)-1) FrameInfo.PTS=FrameInfo.DTS+=FrameInfo.DUR; if (Frame_Count==1) { Finish("Dolby E"); } FILLING_END(); if (Frame_Count==0 && Buffer_TotalBytes>Buffer_TotalBytes_FirstSynched_Max) Reject("Dolby E"); } //--------------------------------------------------------------------------- void File_DolbyE::Block() { //Parsing Skip_S3(BitDepth, "Synchro"); if (ScrambledBitStream) { //We must change the buffer switch (BitDepth) { case 16 : if (!Descramble_16bit()) return; break; case 20 : if (!Descramble_20bit()) return; break; case 24 : if (!Descramble_24bit()) return; break; default : ; } } Skip_S2(14, "Unknown"); Get_S1 ( 6, ProgramConfiguration, "Program configuration"); Param_Info1(DolbyE_ChannelPositions[ProgramConfiguration]); Get_S1 ( 4, FrameRate, "Frame rate 1"); Param_Info3(Mpegv_frame_rate[FrameRate], 3, " fps"); Skip_S1( 4, "Frame rate 2? Always same as Frame rate 1"); Skip_S2(16, "Frame number?"); Element_Begin1("SMPTE time code?"); int8u Frames_Units, Frames_Tens, Seconds_Units, Seconds_Tens, Minutes_Units, Minutes_Tens, Hours_Units, Hours_Tens; bool DropFrame; Skip_S1(4, "BG8"); Skip_S1(4, "BG7"); Skip_SB( "BGF2 / Field Phase"); Skip_SB( "BGF1"); Get_S1 (2, Hours_Tens, "Hours (Tens)"); Get_S1 (4, Hours_Units, "Hours (Units)"); Skip_S1(4, "BG6"); Skip_S1(4, "BG5"); Skip_SB( "BGF0 / BGF2"); Get_S1 (3, Minutes_Tens, "Minutes (Tens)"); Get_S1 (4, Minutes_Units, "Minutes (Units)"); Skip_S1(4, "BG4"); Skip_S1(4, "BG3"); Skip_SB( "FP - Field Phase / BGF0"); Get_S1 (3, Seconds_Tens, "Seconds (Tens)"); Get_S1 (4, Seconds_Units, "Seconds (Units)"); Skip_S1(4, "BG2"); Skip_S1(4, "BG1"); Skip_SB( "CF - Color fame"); Get_SB ( DropFrame, "DP - Drop frame"); Get_S1 (2, Frames_Tens, "Frames (Tens)"); Get_S1 (4, Frames_Units, "Frames (Units)"); Skip_BS(Data_BS_Remain(), "Unknown"); if (Hours_Tens<3) { int64u TimeCode=(int64u)(Hours_Tens *10*60*60*1000 + Hours_Units *60*60*1000 + Minutes_Tens *10*60*1000 + Minutes_Units *60*1000 + Seconds_Tens *10*1000 + Seconds_Units *1000 + (Mpegv_frame_rate[FrameRate]?float64_int32s((Frames_Tens*10+Frames_Units)*1000/Mpegv_frame_rate[FrameRate]):0)); Element_Info1(Ztring().Duration_From_Milliseconds(TimeCode)); //TimeCode if (SMPTE_time_code_StartTimecode==(int64u)-1) SMPTE_time_code_StartTimecode=TimeCode; } } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- bool File_DolbyE::Descramble_16bit () { int16u ScrambleMask; Get_S2 (16, ScrambleMask, "Scramble mask"); int16u Size=((BigEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Size-Data_BS_Remain()/8)^ScrambleMask)>>2)&0x3FF; if (Data_BS_Remain()<(size_t)((Size+1)*BitDepth)) //+1 for additional unknown word return false; //There is a problem int8u* Temp=Descrambled_Buffer+(size_t)Element_Size-Data_BS_Remain()/8; for (int16u Pos=0; Pos>4))>>2)&0x3FF; if (Data_BS_Remain()<(size_t)((Size+1)*BitDepth)) //+1 for additional unknown word return false; //There is a problem int8u* Temp=Descrambled_Buffer+(size_t)Element_Size-Data_BS_Remain()/8; int64u ScrambleMasks=(((int64u)ScrambleMask)<<20)|ScrambleMask; bool Half; if (Data_BS_Remain()%8) { Temp--; int24u2BigEndian(Temp, BigEndian2int24u(Temp)^(ScrambleMask)); Half=true; } else Half=false; for (int16u Pos=0; Pos>2)&0x3FF; if (Data_BS_Remain()<(size_t)((Size+1)*BitDepth)) //+1 for additional unknown word return false; //There is a problem int8u* Temp=Descrambled_Buffer+(size_t)Element_Size-Data_BS_Remain()/8; for (int16u Pos=0; Pos using namespace ZenLib; using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* DTS_FrameType[]= { "Termination", "Normal", }; //--------------------------------------------------------------------------- const int32u DTS_SamplingRate[]= { 0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0, 12000, 24000, 48000, 96000, 192000, }; //--------------------------------------------------------------------------- const int32u DTS_BitRate[]= { 32000, 56000, 64000, 96000, 112000, 128000, 192000, 224000, 256000, 320000, 384000, 448000, 512000, 576000, 640000, 754500, 960000, 1024000, 1152000, 1280000, 1344000, 1408000, 1411200, 1472000, 1509750, 1920000, 2048000, 3072000, 3840000, 0, 0, 0, }; //--------------------------------------------------------------------------- const int8u DTS_Channels[]= { 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8, }; //--------------------------------------------------------------------------- const int8u DTS_Resolution[]= {16, 20, 24, 24}; //--------------------------------------------------------------------------- const char* DTS_ChannelPositions[16]= { "Front: C", "Front: C C", "Front: L R", "Front: L R", "Front: L R", "Front: L C R", "Front: L R, Back: C", "Front: L C R, Back: C", "Front: L R, Side: L R", "Front: L C R, Side: L R", "Front: L C C R, Side: L R", "Front: L C R, Side: L R", "Front: L R, Side: L R, Back: L R", "Front: L C R, Side: L R, Back: L R", "Front: L R, Side: L R, Back: L C C R", "Front: L C R, Side: L R, Back: L C R", }; //--------------------------------------------------------------------------- const char* DTS_ChannelPositions2[16]= { "1/0/0", "2/0/0", "2/0/0", "2/0/0", "2/0/0", "3/0/0", "2/1/0", "3/1/0", "2/2/0", "3/2/0", "4/2/0", "3/2/0", "2/2/2", "3/2/2", "2/2/4", "3/2/3", }; //--------------------------------------------------------------------------- const char* DTS_ChannelLayout[16]= { "C", "1+1", "L R", "L R", "Lt Rt", "C L R", "L R Cs", "C L R Cs", "L R Ls Rs", "C L R Ls Rs", "Cl Cr L R Ls Rs", "C L R Ls Rs", "C L R Ls Rs Rls Rrs", "C L R Ls Rs Rls Rrs", "L R Ls Rs Rls Cs Cs Rrs", "C L R Ls Rs Rls Cs Rrs", }; //--------------------------------------------------------------------------- const char* DTS_ExtensionAudioDescriptor[]= { "Channel Extension", "Reserved", "Frequency Extension", "Channel Extension + Frequency Extension", "", "", "", "", }; //--------------------------------------------------------------------------- const char* DTS_HD_RefClockCode[]= { "1/32000", "1/44100", "1/48000", "", }; //--------------------------------------------------------------------------- std::string DTS_HD_SpeakerActivityMask (int16u SpeakerActivityMask) { std::string Text; if ((SpeakerActivityMask&0x0003)==0x0003) Text+="Front: L C R"; else { if (SpeakerActivityMask&0x0001) Text+="Front: C"; if (SpeakerActivityMask&0x0002) Text+="Front: L R"; } if (SpeakerActivityMask&0x0004) Text+=", Side: L R"; if (SpeakerActivityMask&0x0010) Text+=", Back: C"; if ((SpeakerActivityMask&0x00A0)==0x00A0) Text+=", High: L C R"; else { if (SpeakerActivityMask&0x0020) Text+=", High: L R"; if (SpeakerActivityMask&0x0080) Text+=", High: C"; } if (SpeakerActivityMask&0x0800) Text+=", Side: L R"; if (SpeakerActivityMask&0x0040) Text+=", Back: L R"; if (SpeakerActivityMask&0x0100) Text+=", TopCtrSrrd"; if (SpeakerActivityMask&0x0200) Text+=", Ctr: L R"; if (SpeakerActivityMask&0x0400) Text+=", Wide: L R"; if (SpeakerActivityMask&0x2000) Text+=", HiSide: L R"; if ((SpeakerActivityMask&0xC000)==0x0C000) Text+=", HiRear: L C R"; else { if (SpeakerActivityMask&0x4000) Text+=", HiRear: C"; if (SpeakerActivityMask&0x8000) Text+=", HiRear: L R"; } if (SpeakerActivityMask&0x0008) Text+=", LFE"; if (SpeakerActivityMask&0x1000) Text+=", LFE2"; return Text; } //--------------------------------------------------------------------------- std::string DTS_HD_SpeakerActivityMask2 (int16u SpeakerActivityMask) { std::string Text; if ((SpeakerActivityMask&0x0003)==0x0003) Text+="3"; else { if (SpeakerActivityMask&0x0001) Text+="1"; else if (SpeakerActivityMask&0x0002) Text+="2"; else Text+="0"; } if (SpeakerActivityMask&0x0004) Text+="/2"; else if ((SpeakerActivityMask&0x0840)==0x0000) Text+="/0"; if (SpeakerActivityMask&0x0010) Text+="/1"; else if ((SpeakerActivityMask&0x0840)==0x0000) Text+="/0"; if ((SpeakerActivityMask&0x00A0)==0x00A0) Text+=".3"; else { if (SpeakerActivityMask&0x0020) Text+=".2"; if (SpeakerActivityMask&0x0080) Text+=".2"; } if (SpeakerActivityMask&0x0800) Text+="/2"; if (SpeakerActivityMask&0x0040) Text+="/2"; if (SpeakerActivityMask&0x0100) Text+=".1"; if (SpeakerActivityMask&0x0200) Text+=".2"; if (SpeakerActivityMask&0x0400) Text+=".2"; if (SpeakerActivityMask&0x2000) Text+=".2"; if ((SpeakerActivityMask&0xC000)==0x0C000) Text+=".3"; else { if (SpeakerActivityMask&0x4000) Text+=".1"; if (SpeakerActivityMask&0x8000) Text+=".2"; } if (SpeakerActivityMask&0x0008) Text+=".1"; if (SpeakerActivityMask&0x1000) Text+=".1"; return Text; } //--------------------------------------------------------------------------- const char* DTS_HD_TypeDescriptor[]= { "Music", "Effects", "Dialog", "Commentary", "Visually Impaired", "Hearing Impaired", "Isolated Music Object", "Music and Effects", "Dialog and Commentary", "Effects and Commentary", "Isolated Music Object and Commentary", "Isolated Music Object and Effects", "Karaoke", "Music, Effects, Dialog", "Complete Audio Presentation", "", }; //--------------------------------------------------------------------------- int32u DTS_HD_MaximumSampleRate[]= { 8000, 16000, 32000, 64000, 128000, 22050, 44100, 88200, 176400, 352800, 12000, 24000, 48000, 96000, 192000, 384000, }; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Dts::File_Dts() :File__Analyze() { //Configuration ParserName=__T("Dts"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Dts; StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_TRACE Trace_Layers_Update(8); //Stream #endif //MEDIAINFO_TRACE MustSynchronize=true; Buffer_TotalBytes_FirstSynched_Max=32*1024; PTS_DTS_Needed=true; IsRawStream=true; //In Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.3?32:2; //Buffer Save_Buffer=NULL; //Temp HD_size=0; Primary_Frame_Byte_Size=0; HD_SpeakerActivityMask=(int16u)-1; channel_arrangement=(int8u)-1; channel_arrangement_XCh=(int8u)-1; sample_frequency=(int8u)-1; sample_frequency_X96k=(int8u)-1; bit_rate=(int8u)-1; lfe_effects=(int8u)-1; bits_per_sample=(int8u)-1; ExtensionAudioDescriptor=(int8u)-1; HD_BitResolution=(int8u)-1; HD_MaximumSampleRate=(int8u)-1; HD_TotalNumberChannels=(int8u)-1; HD_ExSSFrameDurationCode=(int8u)-1; ExtendedCoding=false; ES=false; Core_Exists=false; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Dts::Streams_Fill() { Fill(Stream_General, 0, General_Format, "DTS"); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "DTS"); if (!Profile.empty()) Fill(Stream_Audio, 0, Audio_Format_Profile, Profile+(Core_Exists?__T(" / Core"):__T(""))); else if (ES) Fill(Stream_Audio, 0, Audio_Format_Profile, "ES"); Fill(Stream_General, 0, General_Format_Profile, Retrieve(Stream_Audio, 0, Audio_Format_Profile)); Fill(Stream_Audio, 0, Audio_Codec, (Profile.find(__T("MA"))==0 || Profile.find(__T("HRA"))==0)?"DTS-HD":"DTS"); //HD data if ((ExtendedCoding && (ExtensionAudioDescriptor==0 || ExtensionAudioDescriptor==3 || ExtensionAudioDescriptor==6))) { switch(channel_arrangement_XCh) { case 1 : Fill(Stream_Audio, 0, Audio_Channel_s_, 7); Fill(Stream_Audio, 0, Audio_ChannelPositions, Ztring("Front: L C R, Side: L R, Back: C")+(lfe_effects?__T(", LFE"):__T(""))); Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, Ztring("3/2/1")+(lfe_effects?__T(".1"):__T(".0"))); break; case 2 : Fill(Stream_Audio, 0, Audio_Channel_s_, 8); Fill(Stream_Audio, 0, Audio_ChannelPositions, Ztring("Front: L C R, Side: L R, Back: L R")+(lfe_effects?__T(", LFE"):__T(""))); Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, Ztring("3/2/2")+(lfe_effects?__T(".1"):__T(".0"))); break; default:; } } else { if (HD_SpeakerActivityMask!=(int16u)-1) { Fill(Stream_Audio, 0, Audio_ChannelPositions, DTS_HD_SpeakerActivityMask(HD_SpeakerActivityMask).c_str()); Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, DTS_HD_SpeakerActivityMask2(HD_SpeakerActivityMask).c_str()); } if(HD_BitResolution!=(int8u)-1) Fill(Stream_Audio, 0, Audio_BitDepth, HD_BitResolution); if(HD_MaximumSampleRate!=(int8u)-1) Fill(Stream_Audio, 0, Audio_SamplingRate, DTS_HD_MaximumSampleRate[HD_MaximumSampleRate]); else if (sample_frequency_X96k!=(int8u)-1) Fill(Stream_Audio, 0, Audio_SamplingRate, DTS_SamplingRate[sample_frequency_X96k]); if(HD_TotalNumberChannels!=(int8u)-1) Fill(Stream_Audio, 0, Audio_Channel_s_, HD_TotalNumberChannels); if (Profile==__T("Express")) { Fill(Stream_Audio, 0, Audio_BitRate, BitRate_Get(true), 0); Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR"); } } //Core data if (Core_Exists) { if ((Profile.find(__T("MA"))==0?__T("VBR"):__T("CBR"))!=Retrieve(Stream_Audio, 0, Audio_BitRate_Mode)) Fill(Stream_Audio, 0, Audio_BitRate_Mode, Profile.find(__T("MA"))==0?"VBR":"CBR"); if (DTS_SamplingRate[sample_frequency]!=Retrieve(Stream_Audio, 0, Audio_SamplingRate).To_int32u()) Fill(Stream_Audio, 0, Audio_SamplingRate, DTS_SamplingRate[sample_frequency]); Ztring BitRate; if (bit_rate<29 || Profile==__T("Express")) BitRate=Ztring::ToZtring(BitRate_Get(), 0); else if (bit_rate==29) BitRate=__T("Open"); else if (bit_rate==30) BitRate=__T("Variable"); else if (bit_rate==31) BitRate=__T("LossLess"); if (Profile==__T("HRA")) Fill(Stream_Audio, 0, Audio_BitRate, BitRate_Get(true), 0); if ( Profile==__T("MA")) Fill(Stream_Audio, 0, Audio_BitRate, "Unknown"); if (BitRate!=Retrieve(Stream_Audio, 0, Audio_BitRate)) Fill(Stream_Audio, 0, Audio_BitRate, BitRate); if (Profile.find(__T("MA"))==0 || bit_rate==31) Fill(Stream_Audio, 0, Audio_Compression_Mode, "Lossless / Lossy", Unlimited, true, true); int8u Channels; Ztring ChannelPositions, ChannelPositions2, ChannelLayout; if (channel_arrangement<16) { Channels=DTS_Channels[channel_arrangement]+(lfe_effects?1:0); ChannelPositions.From_Local(DTS_ChannelPositions[channel_arrangement]); ChannelPositions2.From_Local(DTS_ChannelPositions2[channel_arrangement]); ChannelLayout.From_Local(DTS_ChannelLayout[channel_arrangement]); } else { Channels=8; ChannelPositions.From_Local("User defined"); } if (lfe_effects) { ChannelPositions+=__T(", LFE"); ChannelPositions2+=__T(".1"); ChannelLayout+=__T(" LFE"); } if (Channels!=Retrieve(Stream_Audio, 0, Audio_Channel_s_).To_int8u()) Fill(Stream_Audio, 0, Audio_Channel_s_, Channels); if (ChannelPositions!=Retrieve(Stream_Audio, 0, Audio_ChannelPositions)) Fill(Stream_Audio, 0, Audio_ChannelPositions, ChannelPositions); if (ChannelPositions2!=Retrieve(Stream_Audio, 0, Audio_ChannelPositions_String2)) Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, ChannelPositions2); if (ChannelLayout!=Retrieve(Stream_Audio, 0, Audio_ChannelLayout)) Fill(Stream_Audio, 0, Audio_ChannelLayout, ChannelLayout); if (DTS_Resolution[bits_per_sample]!=Retrieve(Stream_Audio, 0, Audio_BitDepth).To_int8u()) Fill(Stream_Audio, 0, Audio_BitDepth, DTS_Resolution[bits_per_sample]); } } //--------------------------------------------------------------------------- void File_Dts::Streams_Finish() { Fill(Stream_Audio, 0, Audio_Format_Settings_Endianness, BigEndian?"Big":"Little", Unlimited, true, true); Fill(Stream_Audio, 0, Audio_Format_Settings_Mode, Word?"16":"14", Unlimited, true, true); if (FrameInfo.PTS!=(int64u)-1 && FrameInfo.PTS>PTS_Begin) { Fill(Stream_Audio, 0, Audio_Duration, ((float64)(FrameInfo.PTS-PTS_Begin))/1000000, 0, true); Fill(Stream_Audio, 0, Audio_FrameCount, ((float64)(FrameInfo.PTS-PTS_Begin))/1000000/32, 0, true); } } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Dts::FileHeader_Begin() { //Must have enough buffer for having header if (Buffer_Size<4) return false; //Must wait for more data //False positives detection: Detect WAV files, the parser can't detect it easily, there is only 70 bytes of beginning for saying WAV switch (CC4(Buffer)) { case 0x52494646 : //"RIFF" case 0x000001FD : //MPEG-PS private Finish("DTS"); return false; default : ; } //All should be OK... return true; } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Dts::Synchronize() { //Synchronizing while (Buffer_Offset+6<=Buffer_Size) { if (!FrameSynchPoint_Test()) return false; //Need more data if (Synched) break; Buffer_Offset++; } //Parsing last bytes if needed if (Buffer_Offset+6>Buffer_Size) { if (Buffer_Offset+5==Buffer_Size) { int64u Value=CC5(Buffer+Buffer_Offset); if ((Value&0xFFFFFFFFFCLL)!=0x7FFE8001FCLL //16 bits and big endian Core && (Value&0xFFFFFFFF00LL)!=0xFE7F018000LL //16 bits and little endian Core && (Value&0xFFFFFFFFF7LL)!=0x1FFFE80007LL //14 bits and big endian Core && (Value&0xFFFFFFFFF0LL)!=0xFF1F00E8F0LL //14 bits and little endian Core && (Value&0xFFFFFFFF00LL)!=0x6458202500LL) //16 bits and big endian HD Buffer_Offset++; } if (Buffer_Offset+4==Buffer_Size) { int32u Value=CC4(Buffer+Buffer_Offset); if (Value!=0x7FFE8001 //16 bits and big endian Core && Value!=0xFE7F0180 //16 bits and little endian Core && Value!=0x1FFFE800 //14 bits and big endian Core && Value!=0xFF1F00E8 //14 bits and little endian Core && Value!=0x64582025) //16 bits and big endian HD Buffer_Offset++; } if (Buffer_Offset+3==Buffer_Size) { int32u Value=CC3(Buffer+Buffer_Offset); if (Value!=0x7FFE80 //16 bits and big endian Core && Value!=0xFE7F01 //16 bits and little endian Core && Value!=0x1FFFE8 //14 bits and big endian Core && Value!=0xFF1F00 //14 bits and little endian Core && Value!=0x645820) //16 bits and big endian HD Buffer_Offset++; } if (Buffer_Offset+2==Buffer_Size) { int16u Value=CC2(Buffer+Buffer_Offset); if (Value!=0x7FFE //16 bits and big endian Core && Value!=0xFE7F //16 bits and little endian Core && Value!=0x1FFF //14 bits and big endian Core && Value!=0xFF1F //14 bits and little endian Core && Value!=0x6458) //16 bits and big endian HD Buffer_Offset++; } if (Buffer_Offset+1==Buffer_Size) { int8u Value=CC1(Buffer+Buffer_Offset); if (Value!=0x7F //16 bits and big endian Core && Value!=0xFE //16 bits and little endian Core && Value!=0x1F //14 bits and big endian Core && Value!=0xFF //14 bits and little endian Core && Value!=0x64) //16 bits and big endian HD Buffer_Offset++; } return false; } //Synched return true; } //--------------------------------------------------------------------------- bool File_Dts::Synched_Test() { //Padding while (Buffer_OffsetBuffer_Size) return false; //Quick test of synchro if (!FrameSynchPoint_Test()) return false; //Need more data if (!Synched) return true; //We continue return true; } //--------------------------------------------------------------------------- void File_Dts::Read_Buffer_Unsynched() { FrameInfo=frame_info(); } //*************************************************************************** // Buffer - Demux //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX bool File_Dts::Demux_UnpacketizeContainer_Test() { int32u Value=CC4(Buffer+Buffer_Offset); if (Value==0x7FFE8001) { int16u Size=((BigEndian2int24u(Buffer+Buffer_Offset+5)>>4)&0x3FFF)+1; Demux_Offset=Buffer_Offset+Size; if (Buffer_Offset+Size>Buffer_Size && File_Offset+Buffer_Size!=File_Size) return false; //No complete frame Demux_UnpacketizeContainer_Demux(); } return true; } #endif //MEDIAINFO_DEMUX //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Dts::Header_Parse() { Header_Fill_Size(Original_Size); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Dts::Data_Parse() { if (Save_Buffer) { File_Offset+=Buffer_Offset; swap(Buffer, Save_Buffer); swap(Buffer_Offset, Save_Buffer_Offset); swap(Buffer_Size, Save_Buffer_Size); if (!Word) Element_Size=Element_Size*14/16; } //Parsing int32u Sync; Get_B4 (Sync, "Sync"); if (Sync==0x64582025) { //HD Element_Name("HD"); Element_Code=1; int16u header_size; int8u SubStreamIndex, NumAssets, NumAudioPresent; bool isBlownUpHeader, StaticFieldsPresent; Skip_B1( "Unknown"); BS_Begin(); Get_S1 (2, SubStreamIndex, "Substream index"); Get_SB (isBlownUpHeader, "Is blown up header"); if (isBlownUpHeader) { Get_S2 (12, header_size, "Header size"); header_size++; Param_Info2(header_size, " bytes"); Get_S3 (20, HD_size, "HD block size"); HD_size++; Param_Info2(HD_size, " bytes"); } else { Get_S2 ( 8, header_size, "Header size"); header_size++; Param_Info2(header_size, " bytes"); Get_S3 (16, HD_size, "HD block size"); HD_size++; Param_Info2(HD_size, " bytes"); } TESTELSE_SB_GET(StaticFieldsPresent, "Static fields present"); std::vector ActiveExSSMasks; Info_S1(2, RefClockCode, "Reference clock code"); Param_Info1(DTS_HD_RefClockCode[RefClockCode]); Get_S1 (3, HD_ExSSFrameDurationCode, "ExSS frame duration code"); HD_ExSSFrameDurationCode++; Param_Info1(HD_ExSSFrameDurationCode); TEST_SB_SKIP( "Timestamp flag"); Skip_S5(36, "Timestamp"); TEST_SB_END(); Get_S1 (3, NumAudioPresent, "Num audio present"); NumAudioPresent++; Param_Info2(NumAudioPresent, " channels"); Get_S1 (3, NumAssets, "Num assets"); NumAssets++; Param_Info2(NumAssets, " assets"); Element_Begin1("Active masks"); for (int8u Pos=0; Pos2) Skip_SB( "Embedded stereo flag"); //else is 0 if (HD_TotalNumberChannels>6) Skip_SB( "Embedded 6 Channels flag"); //else is 0 TESTELSE_SB_SKIP( "Speaker mask enabled"); Get_S1 (2, SpeakerActivityMaskBits, "Speaker activity mask bits"); Param_Info2(4+SpeakerActivityMaskBits*4, " bits"); SpeakerActivityMaskBits=4+SpeakerActivityMaskBits*4; Get_S2 (SpeakerActivityMaskBits, HD_SpeakerActivityMask, "Speaker activity mask"); Param_Info1(DTS_HD_SpeakerActivityMask(HD_SpeakerActivityMask).c_str()); TESTELSE_SB_ELSE( "Speaker mask enabled"); SpeakerActivityMaskBits=0; TESTELSE_SB_END(); Get_S1 (3, SpeakerRemapSetsCount, "Speaker remap sets count"); for (int8u Pos=0; Pos=Frame_Count_Valid) { Accept("DTS"); Fill("DTS"); //No more need data if (!IsSub && MediaInfoLib::Config.ParseSpeed_Get()<1) Finish("DTS"); } FILLING_END(); } //--------------------------------------------------------------------------- void File_Dts::Core_XCh(int64u Size) { //Parsing Element_Name("XCh (6.1 channels)"); int16u XChFSIZE; int8u AMODE; BS_Begin(); Get_S2 (10, XChFSIZE, "Primary Frame Byte Size"); Get_S1 ( 4, AMODE, "Extension Channel Arrangement"); BS_End(); if (XChFSIZE==Element_Size-(Element_Offset-6)) XChFSIZE--; //Compatibility reason (from specs) if ((int64u)XChFSIZE+1-6<=Size-2) Skip_XX(XChFSIZE+1-6, "XCh data"); else Skip_XX(Size-2, "XCh data (with problem)"); FILLING_BEGIN(); channel_arrangement_XCh=AMODE; FILLING_END(); } //--------------------------------------------------------------------------- void File_Dts::Core_XXCh(int64u Size) { Element_Name("XXCh (6.1 or 7.1 channels)"); int8u ChannelsAdded; BS_Begin(); Skip_S1 (8, "?"); Get_S1 (2, ChannelsAdded, "Channels added?"); Skip_S1 (6, "?"); BS_End(); Skip_XX(Size-2, "Data"); FILLING_BEGIN(); channel_arrangement_XCh=ChannelsAdded; FILLING_END(); } //--------------------------------------------------------------------------- void File_Dts::Core_X96k(int64u Size) { //Parsing Element_Name("X96k (96 KHz)"); int16u FSIZE96; int8u REVNO; BS_Begin(); Get_S2 (12, FSIZE96, "96 kHz Extension Frame Byte Data Size"); Get_S1 ( 4, REVNO, "Revision Number"); BS_End(); Skip_XX(Size-2, "X96k data"); //FSIZE96 is until end, not X96k size FILLING_BEGIN(); sample_frequency_X96k=14; //96KHz Profile="96/24"; FILLING_END(); } //--------------------------------------------------------------------------- void File_Dts::HD() { //Parsing while (Element_OffsetElement_Size) Next=Element_Size; Element_Begin0(); int32u Magic; Get_B4 (Magic, "Magic"); switch (Magic) { case 0x0A801921 : HD_XSA(Next-Element_Offset); break; case 0x1D95F262 : HD_X96k(Next-Element_Offset); break; case 0x41A29547 : HD_XLL(Next-Element_Offset); break; case 0x47004A03 : HD_XXCh(Next-Element_Offset); break; case 0x5A5A5A5A : HD_XCh(Next-Element_Offset); break; case 0x655E315E : HD_XBR(Next-Element_Offset); break; default : //Magic value is unknown if (Profile.empty()) Profile="HD"; Skip_XX(Next-Element_Offset, "Data"); } Element_End0(); } //Filling FILLING_BEGIN(); if (Count_Get(Stream_Audio)==0 && Frame_Count>=Frame_Count_Valid) { Accept("DTS"); Fill("DTS"); //No more need data if (!IsSub && MediaInfoLib::Config.ParseSpeed_Get()<1) Finish("DTS"); } FILLING_END(); } //--------------------------------------------------------------------------- void File_Dts::HD_XCh(int64u Size) { //Parsing Element_Name("XCh (6.1 channels)"); Skip_XX(Size, "Data"); FILLING_BEGIN(); channel_arrangement_XCh=1; if (Profile.empty()) Profile="HRA"; FILLING_END(); } //--------------------------------------------------------------------------- void File_Dts::HD_XXCh(int64u Size) { Element_Name("XXCh (6.1 or 7.1 channels)"); int8u ChannelsAdded; BS_Begin(); Skip_S1 (8, "?"); Get_S1 (2, ChannelsAdded, "Channels added?"); Skip_S1 (6, "?"); BS_End(); Skip_XX(Size-2, "Data"); FILLING_BEGIN(); channel_arrangement_XCh=ChannelsAdded; if (Profile.empty()) Profile="HRA"; FILLING_END(); } //--------------------------------------------------------------------------- void File_Dts::HD_X96k(int64u Size) { //Parsing Element_Name("X96k (96 KHz)"); Skip_XX(Size, "Data"); FILLING_BEGIN(); sample_frequency=14; //96KHz Profile="HRA"; FILLING_END(); } //--------------------------------------------------------------------------- void File_Dts::HD_XLL(int64u Size) { Element_Name("XLL (LossLess)"); Skip_XX(Size, "Data"); FILLING_BEGIN(); Profile="MA"; FILLING_END(); } //--------------------------------------------------------------------------- void File_Dts::HD_XBR(int64u Size) { Element_Name("XBR (BitRate extension)"); Skip_XX(Size, "Data"); FILLING_BEGIN(); Profile="HRA"; FILLING_END(); } //--------------------------------------------------------------------------- void File_Dts::HD_XSA(int64u Size) { Element_Name("XSA (low bitrate)"); Skip_XX(Size, "Data"); FILLING_BEGIN(); Profile="Express"; FILLING_END(); } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- float64 File_Dts::BitRate_Get(bool WithHD) { if (bit_rate<29 || Profile==__T("Express")) { float64 BitRate; if (Profile==__T("Express")) BitRate=0; //No core bitrate else if (DTS_SamplingRate[sample_frequency]) BitRate=((float64)Primary_Frame_Byte_Size)*8/(Number_Of_PCM_Sample_Blocks*32)*DTS_SamplingRate[sample_frequency]; //(float64)DTS_BitRate[bit_rate]; else BitRate=0; //Problem if (WithHD && HD_ExSSFrameDurationCode!=(int8u)-1) { int32u SamplePerFrames=HD_ExSSFrameDurationCode; switch (HD_MaximumSampleRate) { case 0 : // 8000 case 10 : // 12000 SamplePerFrames*= 128; break; case 1 : // 16000 case 5 : // 22050 case 11 : // 24000 SamplePerFrames*= 256; break; case 2 : // 32000 case 6 : // 44100 case 12 : // 48000 SamplePerFrames*= 512; break; case 3 : // 64000 case 7 : // 88200 case 13 : // 96000 SamplePerFrames*=1024; break; case 4 : //128000 case 8 : //176400 case 14 : //192000 SamplePerFrames*=2048; break; case 9 : //352800 case 15 : //384000 SamplePerFrames*=4096; break; default : SamplePerFrames= 0; break; //Can never happen (4 bits) } if (SamplePerFrames) BitRate+=((float64)HD_size)*8*DTS_HD_MaximumSampleRate[HD_MaximumSampleRate]/SamplePerFrames; } //if (Primary_Frame_Byte_Size && Profile==__T("HRA")) // BitRate*=1+((float64)HD_size)/Primary_Frame_Byte_Size; //HD block are not in the nominal bitrate return BitRate; } else return 0; } //--------------------------------------------------------------------------- bool File_Dts::FrameSynchPoint_Test() { if (Save_Buffer) return true; //Test already made by Synchronize() int64u Value=CC6(Buffer+Buffer_Offset); if ((Value&0xFFFFFFFFFC00LL)==0x7FFE8001FC00LL //16 bits and big endian Core || (Value&0xFFFFFFFF00FCLL)==0xFE7F018000FCLL //16 bits and little endian Core || (Value&0xFFFFFFFFF7F0LL)==0x1FFFE80007F0LL //14 bits and big endian Core || (Value&0xFFFFFFFFF0F7LL)==0xFF1F00E8F007LL //14 bits and little endian Core || (Value&0xFFFFFFFF0000LL)==0x645820250000LL) //16 bits and big endian HD { //Configuration - 14 bits or Little Endian switch (Buffer[Buffer_Offset]) { default : Word=true; BigEndian=true; break; //16 bits and big endian bitstream case 0xFE : Word=true; BigEndian=false; break; //16 bits and little endian bitstream case 0x1F : Word=false; BigEndian=true; break; //14 bits and big endian bitstream case 0xFF : Word=false; BigEndian=false; break; //14 bits and little endian bitstream } int32u Size; if (Buffer[Buffer_Offset]==0x64) //HD { if (Buffer_Offset+10>Buffer_Size) return false; //Need more data bool isBlownUpHeader=(Buffer[Buffer_Offset+5]&0x20)?true:false; if (isBlownUpHeader) Size=((Buffer[Buffer_Offset+6]&0x01)<<19) | ( Buffer[Buffer_Offset+7] <<11) | ( Buffer[Buffer_Offset+8] << 3) | ( Buffer[Buffer_Offset+9] >> 5); else Size=((Buffer[Buffer_Offset+6]&0x1F)<<13) | ( Buffer[Buffer_Offset+7] << 3) | ( Buffer[Buffer_Offset+8] >> 5); Size++; Original_Size=Size; } else { if (Word) { if (BigEndian) Size=((Buffer[Buffer_Offset+5]&0x03)<<12) | ( Buffer[Buffer_Offset+6] << 4) | ( Buffer[Buffer_Offset+7] >> 4); else Size=((Buffer[Buffer_Offset+4]&0x03)<<12) | ( Buffer[Buffer_Offset+7] << 4) | ( Buffer[Buffer_Offset+6] >> 4); Size++; Original_Size=Size; } else { if (BigEndian) Size=((Buffer[Buffer_Offset+6]&0x03)<<12) | ( Buffer[Buffer_Offset+7] << 4) | ((Buffer[Buffer_Offset+8]&0x3C)>> 2); else Size=((Buffer[Buffer_Offset+7]&0x03)<<12) | ( Buffer[Buffer_Offset+6] << 4) | ((Buffer[Buffer_Offset+9]&0x3C)>> 2); Size++; Original_Size=Size*16/14; } } if (Buffer_Offset+Size>Buffer_Size) return false; //Need more data if (!Word || !BigEndian) { Save_Buffer=Buffer; Save_Buffer_Offset=Buffer_Offset; Save_Buffer_Size=Buffer_Size; //Preparing new buffer if (Word) { int8u* Buffer_Little=new int8u[Size]; for (size_t Pos=0; Pos+1 Asset_Sizes; Ztring Profile; int32u Original_Size; int32u HD_size; int16u Primary_Frame_Byte_Size; int16u Number_Of_PCM_Sample_Blocks; int16u HD_SpeakerActivityMask; int8u channel_arrangement; int8u channel_arrangement_XCh; int8u sample_frequency; int8u sample_frequency_X96k; int8u bit_rate; int8u lfe_effects; int8u bits_per_sample; int8u ExtensionAudioDescriptor; int8u HD_BitResolution; int8u HD_MaximumSampleRate; int8u HD_TotalNumberChannels; int8u HD_ExSSFrameDurationCode; bool ExtendedCoding; bool Word; bool BigEndian; bool ES; bool Core_Exists; //Helpers float64 BitRate_Get(bool WithHD=false); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_ExtendedModule.cpp100777 0 0 11131 12226004262 17175 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_XM_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_ExtendedModule.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_ExtendedModule::FileHeader_Begin() { //Element_Size if (Buffer_Size<38) return false; //Must wait for more data if (CC8(Buffer)!=0x457874656E646564LL || CC8(Buffer+8)!=0x204D6F64756C653ALL //"Extended Module: " || CC1(Buffer+16)!=0x20 || CC1(Buffer+37)!=0x1A) { Reject("Extended Module"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_ExtendedModule::Read_Buffer_Continue() { //Parsing Ztring ModuleName, TrackerName; int32u HeaderSize; int16u Length, Channels, Patterns, Instruments, Flags, Tempo, BPM; int8u VersionMinor, VersionMajor; Skip_String(17, "Signature"); Get_Local(20, ModuleName, "Module name"); Skip_L1( "0x1A"); Get_Local(20, TrackerName, "Tracker name"); Get_L1 (VersionMinor, "Version (minor)"); Get_L1 (VersionMajor, "Version (major)"); Get_L4 (HeaderSize, "Header size"); Get_L2 (Length, "Song Length"); Skip_L2( "Restart position"); Get_L2 (Channels, "Number of channels"); Get_L2 (Patterns, "Number of patterns"); Get_L2 (Instruments, "Number of instruments"); Get_L2 (Flags, "Flags"); Get_L2 (Tempo, "Tempo"); Get_L2 (BPM, "BPM"); Skip_XX(256, "Pattern order table"); FILLING_BEGIN(); Accept("Extended Module"); Fill(Stream_General, 0, General_Format, "Extended Module"); Fill(Stream_General, 0, General_Format_Version, Ztring::ToZtring(VersionMajor)+__T(".")+Ztring::ToZtring(VersionMinor/10)+Ztring::ToZtring(VersionMinor%10)); Fill(Stream_General, 0, General_Track, ModuleName.Trim(__T(' '))); Fill(Stream_General, 0, General_Encoded_Application, TrackerName.Trim(__T(' '))); Fill(Stream_General, 0, "Tempo", Tempo); Fill(Stream_General, 0, "BPM", BPM); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, "Sampler, Channels", Channels); Fill(Stream_Audio, 0, "Sampler, Patterns", Patterns); Fill(Stream_Audio, 0, "Sampler, Instruments", Instruments); //No more need data Finish("Extended Module"); FILLING_END(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_XM_YES MediaInfoLib/Source/MediaInfo/Audio/File_ExtendedModule.h100777 0 0 2423 12226004262 16626 0/* 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 Extended Module files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_ExtendedModuleH #define MediaInfo_File_ExtendedModuleH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_ExtendedModule //*************************************************************************** class File_ExtendedModule : public File__Analyze { protected : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Flac.cpp100777 0 0 24537 12226004262 15152 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_FLAC_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Flac.h" #include "MediaInfo/Tag/File_VorbisCom.h" #include "base64.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- extern const char* Id3v2_PictureType(int8u Type); //In Tag/File_Id3v2.cpp //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Flac::File_Flac() :File__Analyze(), File__Tags_Helper() { //File__Tags_Helper Base=this; //In VorbisHeader=false; //Temp Last_metadata_block=false; } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Flac::FileHeader_Begin() { if (!File__Tags_Helper::FileHeader_Begin()) return false; //Element_Size if (Buffer_Size4) Skip_XX(Element_Size-4, "(Application specific)"); } //--------------------------------------------------------------------------- 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_Flac::PICTURE() { //Parsing int32u PictureType, MimeType_Size, Description_Size, Data_Size; Ztring MimeType, Description; Get_B4 (PictureType, "Picture type"); Element_Info1(Id3v2_PictureType((int8u)PictureType)); Get_B4 (MimeType_Size, "MIME type size"); Get_Local(MimeType_Size, MimeType, "MIME type"); Get_B4 (Description_Size, "Description size"); Get_UTF8(Description_Size, Description, "Description"); Skip_B4( "Width"); Skip_B4( "Height"); Skip_B4( "Color depth"); Skip_B4( "Number of colors used"); Get_B4 (Data_Size, "Data size"); if (Element_Offset+Data_Size>Element_Size) return; //There is a problem std::string Data_Raw((const char*)(Buffer+(size_t)(Buffer_Offset+Element_Offset)), Data_Size); std::string Data_Base64(Base64::encode(Data_Raw)); Skip_XX(Element_Size-Element_Offset, "Data"); //Filling Fill(Stream_General, 0, General_Cover, "Yes"); Fill(Stream_General, 0, General_Cover_Description, Description); Fill(Stream_General, 0, General_Cover_Type, Id3v2_PictureType((int8u)PictureType)); Fill(Stream_General, 0, General_Cover_Mime, MimeType); Fill(Stream_General, 0, General_Cover_Data, Data_Base64); } } //NameSpace #endif //MEDIAINFO_FLAC_YES MediaInfoLib/Source/MediaInfo/Audio/File_Flac.h100777 0 0 5007 12226004262 14566 0/* 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 Flac files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_FlacH #define MediaInfo_File_FlacH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Tag/File__Tags.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Flac //*************************************************************************** class File_Flac : public File__Analyze, public File__Tags_Helper { public : //In bool VorbisHeader; //Constructor/Destructor File_Flac(); private : //Streams management void Streams_Finish() {File__Tags_Helper::Streams_Finish();} //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse(); //Buffer - Global void Read_Buffer_Continue() {File__Tags_Helper::Read_Buffer_Continue();} //Buffer - Per element void Header_Parse(); void Data_Parse(); //Elements void STREAMINFO(); void PADDING() {Skip_XX(Element_Size, "Data");} void APPLICATION(); void SEEKTABLE() {Skip_XX(Element_Size, "Data");} void VORBIS_COMMENT(); void CUESHEET() {Skip_XX(Element_Size, "Data");} void PICTURE(); //Temp bool Last_metadata_block; }; //*************************************************************************** // Const //*************************************************************************** namespace Flac { const int16u STREAMINFO =0x00; const int16u PADDING =0x01; const int16u APPLICATION =0x02; const int16u SEEKTABLE =0x03; const int16u VORBIS_COMMENT =0x04; const int16u CUESHEET =0x05; const int16u PICTURE =0x06; } } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_ImpulseTracker.cpp100777 0 0 14443 12226004262 17232 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_IT_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_ImpulseTracker.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_ImpulseTracker::FileHeader_Begin() { //Element_Size if (Buffer_Size<4) return false; //Must wait for more data if (CC4(Buffer)!=0x494D504D) //"IMPM" { Reject("Impulse Tracker"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_ImpulseTracker::Read_Buffer_Continue() { //Parsing Ztring SongName; int16u OrdNum, InsNum, SmpNum, PatNum, Flags, Special; int8u VersionMajor, VersionMinor, SoftwareVersionMajor, SoftwareVersionMinor, IS, TS; bool Stereo; Skip_B4( "Signature"); Get_Local(26, SongName, "Song name"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Get_L2 (OrdNum, "Orders count"); Get_L2 (InsNum, "Instruments count"); Get_L2 (SmpNum, "Samples count"); Get_L2 (PatNum, "Paterns count"); Get_L1 (SoftwareVersionMinor, "Cwt/v (Minor)"); Get_L1 (SoftwareVersionMajor, "Cwt/v (Major)"); Get_L1 (VersionMinor, "Cwt (Minor)"); Get_L1 (VersionMajor, "Cwt (Major)"); Get_L2 (Flags, "Flags"); Get_Flags (Flags, 0, Stereo, "Stereo"); Skip_Flags(Flags, 1, "Vol0MixOptimizations"); Skip_Flags(Flags, 2, "Use instruments/Samples"); Skip_Flags(Flags, 3, "Linear/Amiga slides"); Skip_Flags(Flags, 4, "Old/IT Effects"); Get_L2 (Special, "Special"); Skip_Flags(Special, 0, "Song Message attached"); Skip_L1( "Global volume"); Skip_L1( "Mix volume"); Get_L1 (IS, "Initial Speed"); Get_L1 (TS, "Initial Temp"); Skip_L1( "Panning separation between channels"); Skip_L1( "0"); Skip_L2( "Message Length"); Skip_L4( "Message Offset"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Skip_XX(64, "Chnl Pan"); Skip_XX(64, "Chnl Vol"); Skip_XX(OrdNum, "Orders"); Skip_XX(InsNum*4, "Instruments"); Skip_XX(SmpNum*4, "Samples"); Skip_XX(PatNum*4, "Patterns"); FILLING_BEGIN(); Accept("Impulse Tracker"); Fill(Stream_General, 0, General_Format, "Impulse Tracker"); Fill(Stream_General, 0, General_Format_Version, Ztring(__T("Version "))+Ztring::ToZtring(VersionMajor)+__T(".")+Ztring::ToZtring(VersionMinor/16)+Ztring::ToZtring(VersionMinor%16)); Fill(Stream_General, 0, General_Track, SongName); Fill(Stream_General, 0, General_Encoded_Application, Ztring(__T("Impulse Tracker ")+Ztring::ToZtring(SoftwareVersionMajor)+__T(".")+Ztring::ToZtring(SoftwareVersionMinor/16)+Ztring::ToZtring(SoftwareVersionMinor%16))); Fill(Stream_General, 0, "BPM", TS); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Stereo?2:1); //No more need data Finish("Impulse Tracker"); FILLING_END(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_IT_YES MediaInfoLib/Source/MediaInfo/Audio/File_ImpulseTracker.h100777 0 0 2423 12226004262 16652 0/* 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 Impulse Tracker files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_ImpulseTrackerH #define MediaInfo_File_ImpulseTrackerH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_ImpulseTracker //*************************************************************************** class File_ImpulseTracker : public File__Analyze { protected : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_La.cpp100777 0 0 13444 12226004262 14634 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Contributor: Lionel Duchateau, kurtnoise@free.fr // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_LA_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_La.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_La::File_La() :File__Analyze(), File__Tags_Helper() { //File__Tags_Helper Base=this; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_La::Streams_Finish() { //Filling int64u CompressedSize=File_Size-TagsSize; float32 CompressionRatio=((float32)UncompressedSize)/CompressedSize; Fill(Stream_Audio, 0, Audio_StreamSize, CompressedSize); Fill(Stream_Audio, 0, Audio_Compression_Ratio, CompressionRatio); File__Tags_Helper::Streams_Finish(); } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_La::FileHeader_Begin() { if (!File__Tags_Helper::FileHeader_Begin()) return false; //Synchro if (Buffer_Offset+2>Buffer_Size) return false; if (CC3(Buffer+Buffer_Offset)!=0x4C4130) //"LA0" { File__Tags_Helper::Reject("LA"); return false; } return true; } //--------------------------------------------------------------------------- void File_La::FileHeader_Parse() { //Parsing Ztring Major, Minor; int32u SampleRate, Samples, BytesPerSecond, UnCompSize, WAVEChunk, FmtSize, FmtChunk, CRC32; int16u RawFormat, Channels, BytesPerSample, BitsPerSample; Skip_Local(2, "signature"); Get_Local (1, Major, "major_version"); Get_Local (1, Minor, "minor_version"); Get_L4 (UnCompSize, "uncompressed_size"); Get_L4 (WAVEChunk, "chunk"); Skip_L4( "fmt_size"); Get_L4 (FmtChunk, "fmt_chunk"); Get_L4 (FmtSize, "fmt_size"); Get_L2 (RawFormat, "raw_format"); Get_L2 (Channels, "channels"); Param_Info2(Channels, " channel(s)"); Get_L4 (SampleRate, "sample_rate"); Get_L4 (BytesPerSecond, "bytes_per_second"); Get_L2 (BytesPerSample, "bytes_per_sample"); Get_L2 (BitsPerSample, "bits_per_sample"); Get_L4 (Samples, "samples"); Skip_L1( "flags"); Get_L4 (CRC32, "crc"); FILLING_BEGIN(); if (SampleRate==0) return; Duration=((int64u)Samples/Channels)*1000/SampleRate; // Seems that it's samples per channels otherwise Duration is doubled ??!! if (Duration==0) return; UncompressedSize=(Samples)*Channels*(BitsPerSample/8); if (UncompressedSize==0) return; File__Tags_Helper::Accept("LA"); Fill(Stream_General, 0, General_Format_Version, Major+__T('.')+Minor); File__Tags_Helper::Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "LA"); Fill(Stream_Audio, 0, Audio_Codec, "LA"); Fill(Stream_Audio, 0, Audio_Format_Version, Major+__T('.')+Minor); Fill(Stream_Audio, 0, Audio_BitDepth, BitsPerSample); Fill(Stream_Audio, 0, Audio_Channel_s_, Channels); Fill(Stream_Audio, 0, Audio_SamplingRate, SampleRate); Fill(Stream_Audio, 0, Audio_Duration, Duration); //No more need data File__Tags_Helper::Finish("LA"); FILLING_END(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_LA_YES MediaInfoLib/Source/MediaInfo/Audio/File_La.h100777 0 0 3126 12226004262 14255 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Contributor: Lionel Duchateau, kurtnoise@free.fr // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_LaH #define MediaInfo_File_LaH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Tag/File__Tags.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_La //*************************************************************************** class File_La : public File__Analyze, public File__Tags_Helper { public : //Constructor/Destructor File_La(); private : //Streams management void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse(); //Buffer - Global void Read_Buffer_Continue() {File__Tags_Helper::Read_Buffer_Continue();} //Temp int64u Duration; int64u UncompressedSize; bool seekable; bool high; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Midi.cpp100777 0 0 3126 12226004262 15136 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MIDI_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Midi.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Format //*************************************************************************** //--------------------------------------------------------------------------- void File_Midi::Read_Buffer_Continue() { Reject("MIDI"); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_MIDI_YES MediaInfoLib/Source/MediaInfo/Audio/File_Midi.h100777 0 0 2244 12226004262 14603 0/* 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 MIDI files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_MidiH #define MediaInfo_File_MidiH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Midi //*************************************************************************** class File_Midi : public File__Analyze { protected : //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Module.cpp100777 0 0 7400 12226004262 15500 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MOD_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Module.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_Module::FileHeader_Begin() { //Element_Size if (Buffer_Size<1084) return false; //Must wait for more data int32u Signature=CC4(Buffer+1080); switch (Signature) { case 0x4D2E4B2E : //M.K. case 0x4D214B21 : //M!K! case 0x664C5434 : //FLT4 case 0x664C5438 : //FLT8 case 0x3663684E : //6CHN case 0x3863684E : //8CHN break; default : Reject("Module"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Module::Read_Buffer_Continue() { //Parsing Ztring ModuleName, SamplesName; Get_Local (20, ModuleName, "Module name"); for (int8u Pos=0; Pos<31; Pos++) { Element_Begin0(); 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_End0(); } Skip_B1( "Number of song positions"); Skip_B1( "0x8F"); Skip_XX(128, "Pattern table"); Skip_C4( "Signature"); FILLING_BEGIN(); Accept("Module"); Fill(Stream_General, 0, General_Format, "Module"); Stream_Prepare(Stream_Audio); //No more need data Finish("Module"); FILLING_END(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_MOD_YES MediaInfoLib/Source/MediaInfo/Audio/File_Module.h100777 0 0 2364 12226004262 15151 0/* 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 Module files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_ModuleH #define MediaInfo_File_ModuleH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Module //*************************************************************************** class File_Module : public File__Analyze { public : protected : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Mpc.cpp100777 0 0 17574 12226004262 15027 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Source: http://trac.musepack.net/trac/wiki/SV7Specification // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //*************************************************************************** // Infos (Common) //*************************************************************************** //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPC_YES) || defined(MEDIAINFO_MPCSV8_YES) //--------------------------------------------------------------------------- #include "ZenLib/Conf.h" using namespace ZenLib; namespace MediaInfoLib { //--------------------------------------------------------------------------- extern const int16u Mpc_SampleFreq[]= { 44100, //CD 48000, //DAT, DVC, ADR 37800, //CD-ROM-XA 32000, //DSR, DAT-LP, DVC-LP }; //--------------------------------------------------------------------------- } //NameSpace //--------------------------------------------------------------------------- #endif //... //--------------------------------------------------------------------------- //*************************************************************************** // //*************************************************************************** //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPC_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Mpc.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* Mpc_Profile[]= { "no profile", "Unstable/Experimental", "", "", "", "Below Telephone (q=0)", "Below Telephone (q=1)", "Telephone (q=2)", "Thumb (q=3)", "Radio (q=4)", "Standard (q=5)", "Xtreme (q=6)", "Insane (q=7)", "BrainDead (q=8)", "Above BrainDead (q=9)", "Above BrainDead (q=10)", }; //--------------------------------------------------------------------------- const char* Mpc_Link[]= { "Starts or ends with a very low level", "Ends loudly", "Starts loudly", "Starts loudly and ends loudly", }; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Mpc::File_Mpc() :File__Analyze(), File__Tags_Helper() { //File__Tags_Helper Base=this; } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Mpc::FileHeader_Begin() { //Tags if (!File__Tags_Helper::FileHeader_Begin()) return false; if (Buffer_Offset+4>Buffer_Size) return false; //Test if (CC3(Buffer)!=0x4D502B || (CC1(Buffer+3)&0x0F)!=7) //"MP+" version 7 { File__Tags_Helper::Reject("Musepack SV7"); return false; } return true; } //--------------------------------------------------------------------------- void File_Mpc::FileHeader_Parse() { //Parsing Element_Begin1("SV7 header"); Ztring Encoder; int32u FrameCount; int16u TitleGain, AlbumGain; int8u Profile, Link, SampleFreq, EncoderVersion; Skip_C3( "Signature"); BS_Begin(); Skip_S1(4, "PNS"); Skip_S1(4, "Version"); BS_End(); Get_L4 (FrameCount, "FrameCount"); Skip_L2( "MaxLevel"); BS_Begin(); Get_S1 (4, Profile, "Profile"); Param_Info1(Mpc_Profile[Profile]); Get_S1 (2, Link, "Link"); Param_Info1(Mpc_Link[Link]); Get_S1 (2, SampleFreq, "SampleFreq"); Param_Info1(Mpc_SampleFreq[SampleFreq]); Skip_SB( "IntensityStereo"); Skip_SB( "MidSideStereo"); Skip_S1(6, "MaxBand"); BS_End(); Skip_L2( "TitlePeak"); Get_L2 (TitleGain, "TitleGain"); Param_Info3(((float32)((int16s)TitleGain))/1000, 2, " dB"); Skip_L2( "AlbumPeak"); Get_L2 (AlbumGain, "AlbumGain"); Param_Info3(((float32)((int16s)TitleGain))/1000, 2, " dB"); BS_Begin(); Skip_S2(16, "unused"); Skip_S1( 4, "LastFrameLength (part 1)"); Skip_SB( "FastSeekingSafe"); Skip_S1( 3, "unused"); Skip_SB( "TrueGapless"); Skip_S1( 7, "LastFrameLength (part 2)"); BS_End(); Get_L1 (EncoderVersion, "EncoderVersion"); Encoder.From_Number(((float)EncoderVersion)/100, 2); if (EncoderVersion%10==0); else if (EncoderVersion%2==0) Encoder+=__T(" Beta"); else if (EncoderVersion%2==1) Encoder+=__T(" Alpha"); Param_Info1(Encoder); Element_End0(); FILLING_BEGIN(); File__Tags_Helper::Accept("Musepack SV7"); File__Tags_Helper::Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_SamplingRate, Mpc_SampleFreq[SampleFreq]); Fill(Stream_Audio, 0, Audio_SamplingCount, FrameCount*1152); Fill(Stream_Audio, 0, Audio_Format, "Musepack SV7"); Fill(Stream_Audio, 0, Audio_Codec, "SV7"); Fill(Stream_Audio, 0, Audio_Codec_Settings, Mpc_Profile[Profile]); Fill(Stream_Audio, 0, Audio_Encoded_Library, Encoder); Fill(Stream_Audio, 0, Audio_BitDepth, 16); //MPC support only 16 bits Fill(Stream_Audio, 0, Audio_Duration, ((int64u)FrameCount)*1152*1000/Mpc_SampleFreq[SampleFreq]); if (FrameCount) Fill(Stream_Audio, 0, Audio_BitRate, (File_Size-25)*8*Mpc_SampleFreq[SampleFreq]/FrameCount/1152); //No more need data File__Tags_Helper::Finish("Musepack SV7"); FILLING_END(); } } //Namespace #endif //MEDIAINFO_MPC_YES MediaInfoLib/Source/MediaInfo/Audio/File_Mpc.h100777 0 0 3103 12226004262 14433 0/* 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 Musepack files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_MpcH #define MediaInfo_File_MpcH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Tag/File__Tags.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Mpc //*************************************************************************** class File_Mpc : public File__Analyze, public File__Tags_Helper { public : //Constructor/Destructor File_Mpc(); private : //Streams management void Streams_Finish() {File__Tags_Helper::Streams_Finish();} //Buffer - Global void Read_Buffer_Continue() {File__Tags_Helper::Read_Buffer_Continue();} //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_MpcSv8.cpp100777 0 0 22350 12226004262 15414 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Source: http://trac.musepack.net/trac/wiki/SV8Specification // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPCSV8_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_MpcSv8.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- extern const int16u Mpc_SampleFreq[]; //*************************************************************************** // Constants //*************************************************************************** //--------------------------------------------------------------------------- namespace Elements { const int32u AP=0x4150; const int32u CT=0x4354; const int32u EI=0x4549; const int32u RG=0x5247; const int32u SE=0x5345; const int32u SH=0x5348; const int32u SO=0x534F; const int32u ST=0x5354; } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_MpcSv8::File_MpcSv8() :File__Analyze(), File__Tags_Helper() { //File__Tags_Helper Base=this; } //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_MpcSv8::FileHeader_Begin() { //Element_Size if (Buffer_Size<4) return false; //Must wait for more data if (CC4(Buffer)!=0x4D50434B) //"MPCK" { File__Tags_Helper::Reject("Musepack SV8"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- void File_MpcSv8::FileHeader_Parse() { //Parsing Skip_C4( "Magic Number"); FILLING_BEGIN(); File__Tags_Helper::Accept("MpcSv8"); File__Tags_Helper::Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "Musepack SV8"); Fill(Stream_Audio, 0, Audio_Codec, "SV8"); FILLING_END(); } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- bool File_MpcSv8::Header_Begin() { //Tags if (!File__Tags_Helper::Header_Begin()) return false; return true; } //--------------------------------------------------------------------------- void File_MpcSv8::Header_Parse() { //Parsing int64u Size; int16u Key; Get_C2 (Key, "Key"); Get_VS (Size, "Size"); //Filling Header_Fill_Code(Key, Ztring().From_CC4(Key<<16)); //Quick filling for CC2 with text Header_Fill_Size(Key==Elements::AP?Element_Offset:Size); //We don't need the data of audio packet, and we will stop here... } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_MpcSv8::Data_Parse() { #define CASE_INFO(_NAME, _DETAIL) \ case Elements::_NAME : Element_Info1(_DETAIL); _NAME(); break; //Parsing switch (Element_Code) { CASE_INFO(AP, "Audio Packet"); CASE_INFO(CT, "Chapter-Tag"); CASE_INFO(EI, "Encoder Info"); CASE_INFO(RG, "Replay Gain"); CASE_INFO(SE, "Stream End"); CASE_INFO(SH, "Stream Header"); CASE_INFO(SO, "Seek Table Offset"); CASE_INFO(ST, "Seek Table"); default : Skip_XX(Element_Size, "Data"); } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_MpcSv8::AP() { //No more need data File__Tags_Helper::Finish("MpcSv8"); } //--------------------------------------------------------------------------- void File_MpcSv8::EI() { //Parsing int8u Quality, Version1, Version2, Version3; bool PNS; BS_Begin(); Get_S1 (7, Quality, "Quality"); Get_SB ( PNS, "PNS"); BS_End(); Get_B1 (Version1, "Major version"); Get_B1 (Version2, "Minor version"); Get_B1 (Version3, "Build"); } //--------------------------------------------------------------------------- void File_MpcSv8::RG() { //Parsing int16u TitleGain, AlbumGain; Skip_B1( "Version"); Get_L2 (TitleGain, "Title gain"); Param_Info3(((float32)((int16s)TitleGain))/1000, 2, " dB"); Skip_L2( "Title peak"); Get_L2 (AlbumGain, "Album gain"); Param_Info3(((float32)((int16s)TitleGain))/1000, 2, " dB"); Skip_L2( "Album peak"); } //--------------------------------------------------------------------------- void File_MpcSv8::SH() { //Parsing int64u SampleCount; int8u Version, SampleFrequency, ChannelCount; bool MidSideStereo; Skip_B4( "CRC32"); Get_B1 (Version, "Version"); Get_VS (SampleCount, "Sample count"); Skip_VS( "Beginning silence"); BS_Begin(); Get_S1 (3, SampleFrequency, "Sample frequency"); Param_Info1(Mpc_SampleFreq[SampleFrequency]); Skip_S1(5, "Max used bands"); Get_S1 (4, ChannelCount, "Channel count"); Get_SB ( MidSideStereo, "Mid side stereo used"); Skip_S1(3, "Audio block frames"); BS_End(); //Filling FILLING_BEGIN(); Fill(Stream_Audio, 0, Audio_SamplingRate, Mpc_SampleFreq[SampleFrequency]); if (SampleCount) { Fill(Stream_Audio, 0, Audio_SamplingCount, SampleCount); Fill(Stream_Audio, 0, Audio_Duration, SampleCount*1000/Mpc_SampleFreq[SampleFrequency]); Fill(Stream_Audio, 0, Audio_BitRate, File_Size*8*Mpc_SampleFreq[SampleFrequency]/SampleCount); //Should be more precise... } Fill(Stream_Audio, 0, Audio_BitDepth, 16); //MPC support only 16 bits FILLING_END(); } //--------------------------------------------------------------------------- void File_MpcSv8::SO() { //Parsing Skip_VS( "Offset"); } } //NameSpace #endif //MEDIAINFO_MPCSV8_YES MediaInfoLib/Source/MediaInfo/Audio/File_MpcSv8.h100777 0 0 3656 12226004262 15051 0/* 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 Musepack files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_MpcSv8H #define MediaInfo_File_MpcSv8H //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Tag/File__Tags.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_MpcSv8 //*************************************************************************** class File_MpcSv8 : public File__Analyze, public File__Tags_Helper { public : //Constructor/Destructor File_MpcSv8(); private : //Streams management void Streams_Finish() {File__Tags_Helper::Streams_Finish();} //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse(); //Buffer - Global void Read_Buffer_Continue() {File__Tags_Helper::Read_Buffer_Continue();} //Buffer - Per element bool Header_Begin(); void Header_Parse(); void Data_Parse(); //Elements void AP(); void CT() {Skip_XX(Element_Size, "Data");} void EI(); void RG(); void SE() {Skip_XX(Element_Size, "Data");} void SH(); void SO(); void ST() {Skip_XX(Element_Size, "Data");} }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Mpega.cpp100777 0 0 205473 12254140413 15356 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // A good start : http://www.codeproject.com/audio/MPEGAudioInfo.asp // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //*************************************************************************** // Constants (Common) //*************************************************************************** //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPEGA_YES) || defined(MEDIAINFO_MPEGTS_YES) || defined(MEDIAINFO_MPEGPS_YES) //--------------------------------------------------------------------------- #include "ZenLib/Conf.h" using namespace ZenLib; namespace MediaInfoLib { //--------------------------------------------------------------------------- const char* Mpega_Version[4]= { "MPA2.5", "", "MPA2", "MPA1" }; //--------------------------------------------------------------------------- const char* Mpega_Layer[4]= { "", "L3", "L2", "L1", }; //--------------------------------------------------------------------------- const char* Mpega_Format_Profile_Version[4]= { "Version 2.5", "", "Version 2", "Version 1" }; //--------------------------------------------------------------------------- const char* Mpega_Format_Profile_Layer[4]= { "", "Layer 3", "Layer 2", "Layer 1", }; //--------------------------------------------------------------------------- } //NameSpace //--------------------------------------------------------------------------- #endif //... //--------------------------------------------------------------------------- //*************************************************************************** // //*************************************************************************** //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPEGA_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Mpega.h" #include "ZenLib/BitStream.h" #include "ZenLib/Utils.h" #if MEDIAINFO_ADVANCED #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #endif //MEDIAINFO_ADVANCED using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constants //*************************************************************************** //--------------------------------------------------------------------------- const char* Mpega_Version_String[4]= { "MPEG-2.5 Audio", "", "MPEG-2 Audio", "MPEG-1 Audio", }; //--------------------------------------------------------------------------- const char* Mpega_Layer_String[4]= { "", " layer 3", " layer 2", " layer 1", }; //--------------------------------------------------------------------------- const int16u Mpega_BitRate[4][4][16]= { {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //MPEG Audio 2.5 layer X {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0}, //MPEG Audio 2.5 layer 3 {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0}, //MPEG Audio 2.5 layer 2 {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0}}, //MPEG Audio 2.5 layer 1 {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //MPEG Audio X layer X {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //MPEG Audio X layer 3 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //MPEG Audio X layer 2 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, //MPEG Audio X layer 1 {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //MPEG Audio 2 layer X {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0}, //MPEG Audio 2 layer 3 {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0}, //MPEG Audio 2 layer 2 {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0}}, //MPEG Audio 2 layer 1 {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //MPEG Audio 1 layer X {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0}, //MPEG Audio 1 layer 3 {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 0}, //MPEG Audio 1 layer 2 {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0}}, //MPEG Audio 1 layer 1 }; //--------------------------------------------------------------------------- const int16u Mpega_SamplingRate[4][4]= { {11025, 12000, 8000, 0}, //MPEG Audio 2.5 { 0, 0, 0, 0}, //MPEG Audio X {22050, 24000, 16000, 0}, //MPEG Audio 2 {44100, 48000, 32000, 0}, //MPEG Audio 1 }; //--------------------------------------------------------------------------- const int16u Mpega_Channels[4]= { 2, 2, 2, 1, }; //--------------------------------------------------------------------------- const char* Mpega_Codec_Profile[4]= { "", "Joint stereo", "Dual mono", "", }; //--------------------------------------------------------------------------- const char* Mpega_Codec_Profile_Extension[]= { "", "Intensity Stereo", "MS Stereo", "Intensity Stereo + MS Stereo", }; //--------------------------------------------------------------------------- const char* Mpega_Emphasis[]= { "", "50/15ms", "Reserved", "CCITT", }; //--------------------------------------------------------------------------- const char* Lame_BitRate_Mode[]= { "", "CBR", "VBR", "VBR", "VBR", "VBR", "VBR", "", "CBR", "VBR", "", "", "", "", "", "", }; //--------------------------------------------------------------------------- const char* Lame_Method[]= { "", "CBR", "ABR", "VBR (rh)", "VBR (mtrh)", "VBR (rh)", "VBR", "", "CBR (2-pass)", "ABR (2-pass)", "", "", "", "", "", "", }; //--------------------------------------------------------------------------- const int8u Mpega_Coefficient[4][4] = //Samples per Frame / 8 { { 0, 72, 144, 12}, //MPEG Audio 2.5 { 0, 0, 0, 0}, //MPEG Audio X { 0, 72, 144, 12}, //MPEG Audio 2 { 0, 144, 144, 12}, //MPEG Audio 1 }; //--------------------------------------------------------------------------- const int8u Mpega_SlotSize[4]= //A frame is coposed of slots { 0, // Layer X 1, // Layer3 1, // Layer2 4, // Layer1 }; //--------------------------------------------------------------------------- const int16u Mpega_CRC12_Table[]= { 0x000, 0x80f, 0x811, 0x01e, 0x82d, 0x022, 0x03c, 0x833, 0x855, 0x05a, 0x044, 0x84b, 0x078, 0x877, 0x869, 0x066, 0x8a5, 0x0aa, 0x0b4, 0x8bb, 0x088, 0x887, 0x899, 0x096, 0x0f0, 0x8ff, 0x8e1, 0x0ee, 0x8dd, 0x0d2, 0x0cc, 0x8c3, 0x945, 0x14a, 0x154, 0x95b, 0x168, 0x967, 0x979, 0x176, 0x110, 0x91f, 0x901, 0x10e, 0x93d, 0x132, 0x12c, 0x923, 0x1e0, 0x9ef, 0x9f1, 0x1fe, 0x9cd, 0x1c2, 0x1dc, 0x9d3, 0x9b5, 0x1ba, 0x1a4, 0x9ab, 0x198, 0x997, 0x989, 0x186, 0xa85, 0x28a, 0x294, 0xa9b, 0x2a8, 0xaa7, 0xab9, 0x2b6, 0x2d0, 0xadf, 0xac1, 0x2ce, 0xafd, 0x2f2, 0x2ec, 0xae3, 0x220, 0xa2f, 0xa31, 0x23e, 0xa0d, 0x202, 0x21c, 0xa13, 0xa75, 0x27a, 0x264, 0xa6b, 0x258, 0xa57, 0xa49, 0x246, 0x3c0, 0xbcf, 0xbd1, 0x3de, 0xbed, 0x3e2, 0x3fc, 0xbf3, 0xb95, 0x39a, 0x384, 0xb8b, 0x3b8, 0xbb7, 0xba9, 0x3a6, 0xb65, 0x36a, 0x374, 0xb7b, 0x348, 0xb47, 0xb59, 0x356, 0x330, 0xb3f, 0xb21, 0x32e, 0xb1d, 0x312, 0x30c, 0xb03, 0xd05, 0x50a, 0x514, 0xd1b, 0x528, 0xd27, 0xd39, 0x536, 0x550, 0xd5f, 0xd41, 0x54e, 0xd7d, 0x572, 0x56c, 0xd63, 0x5a0, 0xdaf, 0xdb1, 0x5be, 0xd8d, 0x582, 0x59c, 0xd93, 0xdf5, 0x5fa, 0x5e4, 0xdeb, 0x5d8, 0xdd7, 0xdc9, 0x5c6, 0x440, 0xc4f, 0xc51, 0x45e, 0xc6d, 0x462, 0x47c, 0xc73, 0xc15, 0x41a, 0x404, 0xc0b, 0x438, 0xc37, 0xc29, 0x426, 0xce5, 0x4ea, 0x4f4, 0xcfb, 0x4c8, 0xcc7, 0xcd9, 0x4d6, 0x4b0, 0xcbf, 0xca1, 0x4ae, 0xc9d, 0x492, 0x48c, 0xc83, 0x780, 0xf8f, 0xf91, 0x79e, 0xfad, 0x7a2, 0x7bc, 0xfb3, 0xfd5, 0x7da, 0x7c4, 0xfcb, 0x7f8, 0xff7, 0xfe9, 0x7e6, 0xf25, 0x72a, 0x734, 0xf3b, 0x708, 0xf07, 0xf19, 0x716, 0x770, 0xf7f, 0xf61, 0x76e, 0xf5d, 0x752, 0x74c, 0xf43, 0xec5, 0x6ca, 0x6d4, 0xedb, 0x6e8, 0xee7, 0xef9, 0x6f6, 0x690, 0xe9f, 0xe81, 0x68e, 0xebd, 0x6b2, 0x6ac, 0xea3, 0x660, 0xe6f, 0xe71, 0x67e, 0xe4d, 0x642, 0x65c, 0xe53, 0xe35, 0x63a, 0x624, 0xe2b, 0x618, 0xe17, 0xe09, 0x606 }; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Mpega::File_Mpega() :File__Analyze(), File__Tags_Helper() { //File__Tags_Helper Base=this; //Configuration MustSynchronize=true; Buffer_TotalBytes_FirstSynched_Max=64*1024; PTS_DTS_Needed=true; IsRawStream=true; Frame_Count_NotParsedIncluded=0; //In Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.5?128:(MediaInfoLib::Config.ParseSpeed_Get()>=0.3?32:4); FrameIsAlwaysComplete=false; CalculateDelay=false; //Temp - BitStream info Surround_Frames=0; Block_Count[0]=0; Block_Count[1]=0; Block_Count[2]=0; Channels_Count[0]=0; Channels_Count[1]=0; Channels_Count[2]=0; Channels_Count[3]=0; Extension_Count[0]=0; Extension_Count[1]=0; Extension_Count[2]=0; Extension_Count[3]=0; Emphasis_Count[0]=0; Emphasis_Count[1]=0; Emphasis_Count[2]=0; Emphasis_Count[3]=0; Scfsi=0; Scalefac=0; Reservoir=0; LastSync_Offset=(int64u)-1; VBR_FileSize=0; VBR_Frames=0; Reservoir_Max=0; Xing_Scale=0; BitRate=0; MpegPsPattern_Count=0; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpega::Streams_Fill() { //VBR detection without header if (VBR_Frames==0) { //How much kinds of bitrates? if (BitRate_Count.size()>1) BitRate_Mode=__T("VBR"); } File__Tags_Helper::Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "MPEG Audio"); Fill(Stream_Audio, 0, Audio_Format_Version, Mpega_Format_Profile_Version[ID]); Fill(Stream_Audio, 0, Audio_Format_Profile, Mpega_Format_Profile_Layer[layer]); if (mode && mode<4) { Fill(Stream_Audio, 0, Audio_Format_Settings, Mpega_Codec_Profile[mode]); Fill(Stream_Audio, 0, Audio_Format_Settings_Mode, Mpega_Codec_Profile[mode]); } if (mode_extension && mode_extension<4) { Fill(Stream_Audio, 0, Audio_Format_Settings, Mpega_Codec_Profile_Extension[mode_extension]); Fill(Stream_Audio, 0, Audio_Format_Settings_ModeExtension, Mpega_Codec_Profile_Extension[mode_extension]); } if (emphasis && emphasis<4) { Fill(Stream_Audio, 0, Audio_Format_Settings, Mpega_Emphasis[emphasis]); Fill(Stream_Audio, 0, Audio_Format_Settings_Emphasis, Mpega_Emphasis[emphasis]); } Fill(Stream_Audio, 0, Audio_Codec, Ztring(Mpega_Version[ID])+Ztring(Mpega_Layer[layer])); Fill(Stream_Audio, 0, Audio_Codec_String, Ztring(Mpega_Version_String[ID])+Ztring(Mpega_Layer_String[layer]), true); Fill(Stream_Audio, 0, Audio_SamplingRate, Mpega_SamplingRate[ID][sampling_frequency]); if (mode<4) { Fill(Stream_Audio, 0, Audio_Channel_s_, Mpega_Channels[mode]); Fill(Stream_Audio, 0, Audio_Codec_Profile, Mpega_Codec_Profile[mode]); } //Bitrate, if CBR if (VBR_Frames==0 && BitRate_Mode!=__T("VBR")) { BitRate_Mode=__T("CBR"); BitRate=Mpega_BitRate[ID][layer][bitrate_index]*1000; Fill(Stream_General, 0, General_OverallBitRate, BitRate); Fill(Stream_Audio, 0, Audio_BitRate, BitRate); if (CalculateDelay && Buffer_TotalBytes_FirstSynched>10 && BitRate>0) { Fill(Stream_Audio, 0, Audio_Delay, Buffer_TotalBytes_FirstSynched*8*1000/BitRate, 0); Fill(Stream_Audio, 0, Audio_Delay_Source, "Stream"); } } //Bitrate mode Fill(Stream_Audio, 0, Audio_BitRate_Mode, BitRate_Mode); Fill(Stream_Audio, 0, Audio_BitRate_Minimum, BitRate_Minimum); Fill(Stream_Audio, 0, Audio_BitRate_Nominal, BitRate_Nominal); //Tags File__Tags_Helper::Streams_Fill(); } //--------------------------------------------------------------------------- void File_Mpega::Streams_Finish() { //Reservoir //Fill("Reservoir_Avg", Reservoir/Frame_Count); //Fill("Reservoir_Max", Reservoir_Max); //size_t Granules=(Mpeg==3?2:1); //size_t Ch=Mpega_Channels[Channels]; //Fill("Scalefactors", Ztring::ToZtring(Scalefac*100/(Granules*Ch*Frame_Count))+__T('%')); //VBR_FileSize calculation if (!IsSub && (File_Size!=(int64u)-1 || LastSync_Offset!=(int64u)-1) && VBR_FileSize==0) { //We calculate VBR_FileSize from the last synch or File_Size if (LastSync_Offset!=(int64u)-1) { VBR_FileSize=LastSync_Offset; VBR_FileSize-=File_BeginTagSize; } else { VBR_FileSize=File_Size; VBR_FileSize-=File_BeginTagSize; VBR_FileSize-=File_EndTagSize; } } //Bitrate calculation if VBR int64u FrameCount=0; if (VBR_Frames>0) { FrameCount=VBR_Frames; float32 FrameLength=((float32)(VBR_FileSize?VBR_FileSize:File_Size-File_EndTagSize-File_BeginTagSize))/VBR_Frames; size_t Divider; if (ID==3 && layer==3) //MPEG 1 layer 1 Divider=384/8; else if ((ID==2 || ID==0) && layer==3) ///MPEG 2 or 2.5 layer 1 Divider=192/8; else if ((ID==2 || ID==0) && layer==1) //MPEG 2 or 2.5 layer 3 Divider=576/8; else Divider=1152/8; if (ID<4 && sampling_frequency<4) BitRate=(int32u)(FrameLength*Mpega_SamplingRate[ID][sampling_frequency]/Divider); BitRate_Mode=__T("VBR"); } //if (BitRate_Count.size()>1) //{ // Ztring BitRate_VBR; // if (!BitRate_VBR.empty()) // BitRate_VBR+=__T(' '); // BitRate_VBR+=Ztring::ToZtring(8); // BitRate_VBR+=__T(':'); // BitRate_VBR+=Ztring::ToZtring(BitRate_Count[8]); // Fill("BitRate_VBR", Ztring::ToZtring(BitRate_Count[8])); //} if (VBR_FileSize) { if (BitRate) { Fill(Stream_General, 0, General_Duration, VBR_FileSize*8*1000/BitRate, 10, true); Fill(Stream_General, 0, General_OverallBitRate, BitRate, 10, true); Fill(Stream_Audio, 0, Audio_BitRate, BitRate, 10, true); if (CalculateDelay && Buffer_TotalBytes_FirstSynched>10 && BitRate>0) { Fill(Stream_Audio, 0, Audio_Delay, Buffer_TotalBytes_FirstSynched*8*1000/BitRate, 0, true); Fill(Stream_Audio, 0, Audio_Delay_Source, "Stream", Unlimited, true, true); } } Fill(Stream_Audio, 0, Audio_StreamSize, VBR_FileSize); } Fill(Stream_Audio, 0, Audio_BitRate_Mode, BitRate_Mode, true); //Encoding library if (!Encoded_Library.empty()) Fill(Stream_General, 0, General_Encoded_Library, Encoded_Library, true); if (Encoded_Library.empty()) Encoded_Library_Guess(); Fill(Stream_Audio, 0, Audio_Encoded_Library, Encoded_Library, true); Fill(Stream_Audio, 0, Audio_Encoded_Library_Settings, Encoded_Library_Settings, true); //Surround if (Surround_Frames>=Frame_Count*0.9) { //Fill(Stream_Audio, 0, Audio_Channel_s_, 6); } if (FrameInfo.PTS!=(int64u)-1 && FrameInfo.PTS>PTS_Begin) { Fill(Stream_Audio, 0, Audio_Duration, float64_int64s(((float64)(FrameInfo.PTS-PTS_Begin))/1000000)); if (Retrieve(Stream_Audio, 0, Audio_BitRate_Mode)==__T("CBR")) { int16u Samples; if (ID==3 && layer==3) //MPEG 1 layer 1 Samples=384; else if ((ID==2 || ID==0) && layer==1) //MPEG 2 or 2.5 layer 3 Samples=576; else Samples=1152; float64 Frame_Duration=((float64)1)/Mpega_SamplingRate[ID][sampling_frequency]*Samples; FrameCount=float64_int64s(((float64)(FrameInfo.PTS-PTS_Begin))/1000000000/Frame_Duration); } } if (FrameCount==0 && VBR_FileSize && Retrieve(Stream_Audio, 0, Audio_BitRate_Mode)==__T("CBR") && Mpega_SamplingRate[ID][sampling_frequency]) { size_t Size=(Mpega_Coefficient[ID][layer]*Mpega_BitRate[ID][layer][bitrate_index]*1000/Mpega_SamplingRate[ID][sampling_frequency])*Mpega_SlotSize[layer]; if (Size) FrameCount=float64_int64s(((float64)VBR_FileSize)/Size); } if (FrameCount) { int16u Samples; if (ID==3 && layer==3) //MPEG 1 layer 1 Samples=384; else if ((ID==2 || ID==0) && layer==1) //MPEG 2 or 2.5 layer 3 Samples=576; else Samples=1152; Fill(Stream_Audio, 0, Audio_FrameCount, FrameCount, 10, true); Fill(Stream_Audio, 0, Audio_SamplingCount, FrameCount*Samples, 10, true); } File__Tags_Helper::Streams_Finish(); } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Mpega::FileHeader_Begin() { //Buffer size if (Buffer_Size<8) return File_Size<8; //Must wait for more data //Detecting WAV/SWF/FLV/ELF/DPG/WM/MZ/DLG files int32u Magic4=CC4(Buffer); int32u Magic3=Magic4>>8; int16u Magic2=Magic4>>16; if (Magic4==0x52494646 || Magic3==0x465753 || Magic3==0x464C56 || Magic4==0x7F454C46 || Magic4==0x44504730 || Magic4==0x3026B275 || Magic2==0x4D5A || Magic4==0x000001BA || Magic4==0x000001B3 || Magic4==0x00000100 || CC8(Buffer+Buffer_Offset)==0x444C472056312E30LL) { File__Tags_Helper::Reject("MPEG Audio"); return false; } //Seems OK return true; } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Mpega::Synchronize() { //Tags bool Tag_Found_Begin; if (!File__Tags_Helper::Synchronize(Tag_Found_Begin)) return false; if (Tag_Found_Begin) return true; //Synchronizing while (Buffer_Offset+4<=Buffer_Size) { while (Buffer_Offset+4<=Buffer_Size) { if (Buffer[Buffer_Offset ]==0xFF && (Buffer[Buffer_Offset+1]&0xE0)==0xE0 && (Buffer[Buffer_Offset+2]&0xF0)!=0xF0 && (Buffer[Buffer_Offset+2]&0x0C)!=0x0C) break; //while() //Tags bool Tag_Found_Synchro; if (!File__Tags_Helper::Synchronize(Tag_Found_Synchro)) return false; if (Tag_Found_Synchro) return true; //Better detect MPEG-PS if (Frame_Count==0 && Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x00 && Buffer[Buffer_Offset+2]==0x01 && Buffer[Buffer_Offset+3]==0xBA) { MpegPsPattern_Count++; if (MpegPsPattern_Count>=2) { File__Tags_Helper::Reject("MPEG Audio"); return false; } } Buffer_Offset++; } if (Buffer_Offset+4<=Buffer_Size)//Testing if size is coherant { //Retrieving some info int8u ID0 =(CC1(Buffer+Buffer_Offset+1)>>3)&0x03; int8u layer0 =(CC1(Buffer+Buffer_Offset+1)>>1)&0x03; int8u bitrate_index0 =(CC1(Buffer+Buffer_Offset+2)>>4)&0x0F; int8u sampling_frequency0=(CC1(Buffer+Buffer_Offset+2)>>2)&0x03; int8u padding_bit0 =(CC1(Buffer+Buffer_Offset+2)>>1)&0x01; //Coherancy if (Mpega_SamplingRate[ID0][sampling_frequency0]==0 || Mpega_Coefficient[ID0][layer0]==0 || Mpega_BitRate[ID0][layer0][bitrate_index0]==0 || Mpega_SlotSize[layer0]==0) Buffer_Offset++; //False start else { //Testing next start, to be sure size_t Size0=(Mpega_Coefficient[ID0][layer0]*Mpega_BitRate[ID0][layer0][bitrate_index0]*1000/Mpega_SamplingRate[ID0][sampling_frequency0]+(padding_bit0?1:0))*Mpega_SlotSize[layer0]; if (IsSub && Buffer_Offset+Size0==Buffer_Size) break; if (File_Offset+Buffer_Offset+Size0!=File_Size-File_EndTagSize) { //Padding while (Buffer_Offset+Size0+4<=Buffer_Size && Buffer[Buffer_Offset+Size0]==0x00) Size0++; if (Buffer_Offset+Size0+4>Buffer_Size) return false; //Need more data //Tags bool Tag_Found0; if (!File__Tags_Helper::Synchronize(Tag_Found0, Size0)) return false; if (Tag_Found0) return true; if (File_Offset+Buffer_Offset+Size0==File_Size-File_EndTagSize) break; //Testing if ((CC2(Buffer+Buffer_Offset+Size0)&0xFFE0)!=0xFFE0 || (CC1(Buffer+Buffer_Offset+Size0+2)&0xF0)==0xF0 || (CC1(Buffer+Buffer_Offset+Size0+2)&0x0C)==0x0C) { //Testing VBRI in a malformed frame bool VbriFound=false; for (size_t Pos=Buffer_Offset+3; Pos+4>3)&0x03; int8u layer1 =(CC1(Buffer+Buffer_Offset+Size0+1)>>1)&0x03; int8u bitrate_index1 =(CC1(Buffer+Buffer_Offset+Size0+2)>>4)&0x0F; int8u sampling_frequency1=(CC1(Buffer+Buffer_Offset+Size0+2)>>2)&0x03; int8u padding_bit1 =(CC1(Buffer+Buffer_Offset+Size0+2)>>1)&0x01; //Coherancy if (Mpega_SamplingRate[ID1][sampling_frequency1]==0 || Mpega_Coefficient[ID1][layer1]==0 || Mpega_BitRate[ID1][layer1][bitrate_index1]==0 || Mpega_SlotSize[layer1]==0) Buffer_Offset++; //False start else { //Testing next start, to be sure size_t Size1=(Mpega_Coefficient[ID1][layer1]*Mpega_BitRate[ID1][layer1][bitrate_index1]*1000/Mpega_SamplingRate[ID1][sampling_frequency1]+(padding_bit1?1:0))*Mpega_SlotSize[layer1]; if (IsSub && Buffer_Offset+Size0+Size1==Buffer_Size) break; if (File_Offset+Buffer_Offset+Size0+Size1!=File_Size-File_EndTagSize) { //Padding while (Buffer_Offset+Size0+Size1+4<=Buffer_Size && Buffer[Buffer_Offset+Size0+Size1]==0x00) Size0++; if (Buffer_Offset+Size0+Size1+4>Buffer_Size) return false; //Need more data //Tags bool Tag_Found1; if (!File__Tags_Helper::Synchronize(Tag_Found1, Size0+Size1)) return false; if (Tag_Found1) return true; if (File_Offset+Buffer_Offset+Size0+Size1==File_Size-File_EndTagSize) break; //Testing if ((CC2(Buffer+Buffer_Offset+Size0+Size1)&0xFFE0)!=0xFFE0 || (CC1(Buffer+Buffer_Offset+Size0+Size1+2)&0xF0)==0xF0 || (CC1(Buffer+Buffer_Offset+Size0+Size1+2)&0x0C)==0x0C) Buffer_Offset++; else { //Retrieving some info int8u ID2 =(CC1(Buffer+Buffer_Offset+Size0+Size1+1)>>3)&0x03; int8u layer2 =(CC1(Buffer+Buffer_Offset+Size0+Size1+1)>>1)&0x03; int8u bitrate_index2 =(CC1(Buffer+Buffer_Offset+Size0+Size1+2)>>4)&0x0F; int8u sampling_frequency2=(CC1(Buffer+Buffer_Offset+Size0+Size1+2)>>2)&0x03; int8u padding_bit2 =(CC1(Buffer+Buffer_Offset+Size0+Size1+2)>>1)&0x01; //Coherancy if (Mpega_SamplingRate[ID2][sampling_frequency2]==0 || Mpega_Coefficient[ID2][layer2]==0 || Mpega_BitRate[ID2][layer2][bitrate_index2]==0 || Mpega_SlotSize[layer2]==0) Buffer_Offset++; //False start else { //Testing next start, to be sure size_t Size2=(Mpega_Coefficient[ID2][layer2]*Mpega_BitRate[ID2][layer2][bitrate_index2]*1000/Mpega_SamplingRate[ID2][sampling_frequency2]+(padding_bit2?1:0))*Mpega_SlotSize[layer2]; if (IsSub && Buffer_Offset+Size0+Size1+Size2==Buffer_Size) break; if (File_Offset+Buffer_Offset+Size0+Size1+Size2!=File_Size-File_EndTagSize) { //Padding while (Buffer_Offset+Size0+Size1+Size2+4<=Buffer_Size && Buffer[Buffer_Offset+Size0+Size1+Size2]==0x00) Size0++; if (Buffer_Offset+Size0+Size1+Size2+4>Buffer_Size) { if (IsSub || File_Offset+Buffer_Offset+Size0+Size1+Size2Buffer_Size) { if (Buffer_Offset+3==Buffer_Size && (CC2(Buffer+Buffer_Offset)&0xFFE0)!=0xFFE0) Buffer_Offset++; if (Buffer_Offset+2==Buffer_Size && (CC2(Buffer+Buffer_Offset)&0xFFE0)!=0xFFE0) Buffer_Offset++; if (Buffer_Offset+1==Buffer_Size && CC1(Buffer+Buffer_Offset)!=0x00) Buffer_Offset++; return false; } //Synched is OK return true; } //--------------------------------------------------------------------------- bool File_Mpega::Synched_Test() { //Tags if (!File__Tags_Helper::Synched_Test()) return false; //Padding while (Buffer_OffsetBuffer_Size) return false; //Quick test of synchro if (Buffer[Buffer_Offset ]!=0xFF || (Buffer[Buffer_Offset+1]&0xE0)!=0xE0 || (Buffer[Buffer_Offset+2]&0xF0)==0xF0 || (Buffer[Buffer_Offset+2]&0x0C)==0x0C) { Synched=false; return true; } //Retrieving some info int8u ID0 =(CC1(Buffer+Buffer_Offset+1)>>3)&0x03; int8u layer0 =(CC1(Buffer+Buffer_Offset+1)>>1)&0x03; int8u bitrate_index0 =(CC1(Buffer+Buffer_Offset+2)>>4)&0x0F; int8u sampling_frequency0=(CC1(Buffer+Buffer_Offset+2)>>2)&0x03; if (Mpega_SamplingRate[ID0][sampling_frequency0]==0 || Mpega_Coefficient[ID0][layer0]==0 || Mpega_BitRate[ID0][layer0][bitrate_index0]==0 || Mpega_SlotSize[layer0]==0) { Synched=false; return true; } //We continue return true; } //*************************************************************************** // Buffer - Demux //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX bool File_Mpega::Demux_UnpacketizeContainer_Test() { //Retrieving some info int8u ID0 =(CC1(Buffer+Buffer_Offset+1)>>3)&0x03; int8u layer0 =(CC1(Buffer+Buffer_Offset+1)>>1)&0x03; int8u bitrate_index0 =(CC1(Buffer+Buffer_Offset+2)>>4)&0x0F; int8u sampling_frequency0=(CC1(Buffer+Buffer_Offset+2)>>2)&0x03; int8u padding_bit0 =(CC1(Buffer+Buffer_Offset+2)>>1)&0x01; if (Mpega_SamplingRate[ID][sampling_frequency]==0 || Mpega_Coefficient[ID][layer]==0 || Mpega_BitRate[ID][layer][bitrate_index]==0 || Mpega_SlotSize[layer]==0) return true; //Synhro issue #if MEDIAINFO_ADVANCED if (Frame_Count && File_Demux_Unpacketize_StreamLayoutChange_Skip) { int8u mode0 =CC1(Buffer+Buffer_Offset+3)>>6; if (sampling_frequency0!=sampling_frequency_Frame0 || mode0!=mode_Frame0) { return true; } } #endif //MEDIAINFO_ADVANCED Demux_Offset=Buffer_Offset+(Mpega_Coefficient[ID0][layer0]*Mpega_BitRate[ID0][layer0][bitrate_index0]*1000/Mpega_SamplingRate[ID0][sampling_frequency0]+(padding_bit0?1:0))*Mpega_SlotSize[layer0]; if (Demux_Offset>Buffer_Size) return false; Demux_UnpacketizeContainer_Demux(); return true; } #endif //MEDIAINFO_DEMUX //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpega::Header_Parse() { //Parsing BS_Begin(); Skip_S2(11, "syncword"); Get_S1 (2, ID, "ID"); Param_Info1(Mpega_Version[ID]); Get_S1 (2, layer, "layer"); Param_Info1(Mpega_Layer[layer]); Get_SB ( protection_bit, "protection_bit"); Get_S1 (4, bitrate_index, "bitrate_index"); Param_Info2(Mpega_BitRate[ID][layer][bitrate_index], " Kbps"); Get_S1 (2, sampling_frequency, "sampling_frequency"); Param_Info2(Mpega_SamplingRate[ID][sampling_frequency], " Hz"); Get_SB ( padding_bit, "padding_bit"); Skip_SB( "private_bit"); Get_S1 (2, mode, "mode"); Param_Info2(Mpega_Channels[mode], " channels"); Param_Info1(Mpega_Codec_Profile[mode]); Get_S1 (2, mode_extension, "mode_extension"); Param_Info1(Mpega_Codec_Profile_Extension[mode_extension]); Get_SB ( copyright, "copyright"); Get_SB ( original_home, "original_home"); Get_S1 (2, emphasis, "emphasis"); Param_Info1(Mpega_Emphasis[emphasis]); BS_End(); //Coherancy if (Mpega_SamplingRate[ID][sampling_frequency]==0 || Mpega_Coefficient[ID][layer]==0 || Mpega_BitRate[ID][layer][bitrate_index]==0 || Mpega_SlotSize[layer]==0) { Element_Offset=1; Header_Fill_Size(1); Header_Fill_Code(0, "False start"); Synched=false; return; } //Filling int64u Size=(Mpega_Coefficient[ID][layer]*Mpega_BitRate[ID][layer][bitrate_index]*1000/Mpega_SamplingRate[ID][sampling_frequency]+(padding_bit?1:0))*Mpega_SlotSize[layer]; //Special case: tags is inside the last frame if (File_Offset+Buffer_Offset+Size>=File_Size-File_EndTagSize) Size=File_Size-File_EndTagSize-(File_Offset+Buffer_Offset); Header_Fill_Size(Size); Header_Fill_Code(0, "frame"); //Filling error detection sampling_frequency_Count[sampling_frequency]++; mode_Count[mode]++; FILLING_BEGIN(); #if MEDIAINFO_DEMUX #if MEDIAINFO_ADVANCED if (!Frame_Count) { File_Demux_Unpacketize_StreamLayoutChange_Skip=Config->File_Demux_Unpacketize_StreamLayoutChange_Skip_Get(); if (File_Demux_Unpacketize_StreamLayoutChange_Skip) { sampling_frequency_Frame0=sampling_frequency; mode_Frame0=mode; } } #endif //MEDIAINFO_ADVANCED #endif //MEDIAINFO_DEMUX FILLING_END(); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpega::Data_Parse() { //If false start if (Element_Size==0) { Element_DoNotShow(); return; } //Partial frame if (Header_Size+Element_Size<(int64u)((Mpega_Coefficient[ID][layer]*Mpega_BitRate[ID][layer][bitrate_index]*1000/Mpega_SamplingRate[ID][sampling_frequency]+(padding_bit?1:0))*Mpega_SlotSize[layer])) { Element_Name("Partial frame"); Skip_XX(Element_Size, "Data"); return; } //PTS Element_Info1C((FrameInfo.PTS!=(int64u)-1), __T("PTS ")+Ztring().Duration_From_Milliseconds(float64_int64s(((float64)FrameInfo.PTS)/1000000))); //Name Element_Info1(__T("Frame ")+Ztring::ToZtring(Frame_Count)); //VBR and library headers if (Frame_Count<3) //No need to do it too much { if (!Header_Xing()) Header_VBRI(); } //Counting if (File_Offset+Buffer_Offset+Element_Size==File_Size-File_EndTagSize) Frame_Count_Valid=Frame_Count; //Finish MPEG Audio frames in case of there are less than Frame_Count_Valid frames if (Frame_Count==0 && Frame_Count_NotParsedIncluded==0) PTS_Begin=FrameInfo.PTS; Frame_Count++; Frame_Count_InThisBlock++; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; LastSync_Offset=File_Offset+Buffer_Offset+Element_Size; { int16u Samples; if (ID==3 && layer==3) //MPEG 1 layer 1 Samples=384; else if ((ID==2 || ID==0) && layer==1) //MPEG 2 or 2.5 layer 3 Samples=576; else Samples=1152; FrameInfo.DUR=float64_int64s(((float64)1)/Mpega_SamplingRate[ID][sampling_frequency]*Samples*1000000000); if (FrameInfo.DTS!=(int64u)-1) FrameInfo.DTS+=FrameInfo.DUR; if (FrameInfo.PTS!=(int64u)-1) FrameInfo.PTS=FrameInfo.DTS; } //LAME if (Encoded_Library.empty() && (Frame_Count>4); int16u CRC12 =((Buffer[(size_t)(Buffer_Offset+Element_Offset_S+2)]&0x0F)<<8) | Buffer[(size_t)(Buffer_Offset+Element_Offset_S+3)]; if (Element_Offset_S+Surround_Size-4>Element_Size) break; //CRC int16u CRC12_Calculated=0x0FFF; int8u* Data=(int8u*)Buffer+(size_t)(Buffer_Offset+Element_Offset_S+4); if (Element_Offset_S+Surround_Size+4>=Element_Size) break; for (int8u Surround_Pos=0; Surround_Pos>4) ^ *Data++) & 0xff]); if (CRC12_Calculated!=CRC12) break; //Parsing Skip_XX(Element_Offset_S-Element_Offset, "data"); BS_Begin(); Element_Begin1("Surround"); Skip_S2(12, "Sync"); Skip_S1( 8, "Size"); Skip_S2(12, "CRC12"); BS_End(); Skip_XX(Surround_Size-4, "data"); Element_End0(); //Filling Surround_Frames++; break; } } if (Element_Offset1 && !Encoded_Library.empty()) Frame_Count_Valid=Frame_Count; if (!Status[IsAccepted]) File__Analyze::Accept("MPEG Audio"); if (!Status[IsFilled] && Frame_Count>=Frame_Count_Valid) { Fill("MPEG Audio"); //Jumping if (!IsSub && MediaInfoLib::Config.ParseSpeed_Get()<1.0 && File_Offset+Buffer_OffsetFile_Size-File_EndTagSize) { Open_Buffer_Unsynch(); File__Analyze::Data_GoTo(File_Size-File_EndTagSize, "Tags inside a frame, parsing the tags"); } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpega::audio_data_Layer3() { int16u main_data_end; BS_Begin(); if (ID==3) //MPEG-1 Get_S2 (9, main_data_end, "main_data_end"); else Get_S2 (8, main_data_end, "main_data_end"); if ((int32u)main_data_end>Reservoir_Max) Reservoir_Max=main_data_end; Reservoir+=main_data_end; if (ID==3) //MPEG-1 { if (mode==3) //Mono Skip_S1(5, "private_bits"); else Skip_S1(3, "private_bits"); } else { if (mode==3) //Mono Skip_S1(1, "private_bits"); else Skip_S1(2, "private_bits"); } if (ID==3) //MPEG-1 { Element_Begin1("scfsi"); for(int8u ch=0; ch=4) return; for(int8u ch=0; chElement_Size-Xing_Header_Offset) return false; //Error tag size //Parsing if (FrameCount) Get_B4 (VBR_Frames, "FrameCount"); //FrameCount exclude this frame if (FileSize) { int32u VBR_FileSize_Temp; Get_B4 (VBR_FileSize_Temp, "FileSize"); if (VBR_FileSize_Temp>4+Element_Size) VBR_FileSize=VBR_FileSize_Temp-4-Element_Size; //FileSize include the Xing element } if (TOC) Skip_XX(100, "TOC"); if (Scale) Get_B4 (Xing_Scale, "Scale"); Ztring Lib; Element_End0(); Peek_Local(4, Lib); if (Lame || Lib==__T("LAME") || Lib==__T("GOGO") || Lib==__T("L3.9")) Header_Encoders_Lame(); if (CC4(Xing_Header)==CC4("Info")) VBR_Frames=0; //This is not a VBR file //Clearing Error detection sampling_frequency_Count.clear(); mode_Count.clear(); return true; } } return false; } //--------------------------------------------------------------------------- bool File_Mpega::Header_VBRI() { const size_t Fraunhofer_Header_Offset=36-4; if (Buffer_Offset+Fraunhofer_Header_Offset+32=32KHz, else 576) --> Duration in samples Get_B2 (TableSize, "TableSize"); Get_B2 (TableScale, "TableScale"); Get_B2 (EntryBytes, "EntryBytes"); Skip_B2( "EntryFrames"); //Count of frames per entry Element_Begin1("Table"); for (int16u Pos=0; Pos=__T("LAME3.90")) && Element_IsNotFinished()) { int8u Flags, lowpass, EncodingFlags, BitRate, StereoMode; Param_Info1(Ztring(__T("V "))+Ztring::ToZtring((100-Xing_Scale)/10)); Param_Info1(Ztring(__T("q "))+Ztring::ToZtring((100-Xing_Scale)%10)); Get_Local(9, Encoded_Library, "Encoded_Library"); Get_B1 (Flags, "Flags"); if ((Flags&0xF0)<=0x20) //Rev. 0 or 1, http://gabriel.mp3-tech.org/mp3infotag.html and Rev. 2 was seen. { Param_Info1(Lame_Method[Flags&0x0F]); BitRate_Mode=Lame_BitRate_Mode[Flags&0x0F]; if ((Flags&0x0F)==1 || (Flags&0x0F)==8) //2 possible values for CBR VBR_Frames=0; } Get_B1 (lowpass, "Lowpass filter value"); Param_Info2(lowpass*100, " Hz"); Skip_B4( "Peak signal amplitude"); Skip_B2( "Radio Replay Gain"); Skip_B2( "Audiophile Replay Gain"); Get_B1 (EncodingFlags, "Encoding Flags"); Param_Info1(Ztring(__T("ATH Type="))+Ztring::ToZtring(Flags&0x0F)); Skip_Flags(EncodingFlags, 4, "nspsytune"); Skip_Flags(EncodingFlags, 5, "nssafejoint"); Skip_Flags(EncodingFlags, 6, "nogap (after)"); Skip_Flags(EncodingFlags, 7, "nogap (before)"); Get_B1 (BitRate, "BitRate"); Skip_B3( "Encoder delays"); BS_Begin(); Skip_S1(2, "Source sample frequency"); Skip_SB( "unwise settings used"); Get_S1 (3, StereoMode, "Stereo mode"); Skip_S1(2, "noise shapings"); BS_End(); Skip_B1( "MP3 Gain"); Skip_B2( "Preset and surround info"); Skip_B4( "MusicLength"); Skip_B2( "MusicCRC"); Skip_B2( "CRC-16 of Info Tag"); FILLING_BEGIN(); Encoded_Library_Settings+=__T("-m "); switch(StereoMode) { case 0 : Encoded_Library_Settings+=__T("m"); break; case 1 : Encoded_Library_Settings+=__T("s"); break; case 2 : Encoded_Library_Settings+=__T("d"); break; case 3 : Encoded_Library_Settings+=__T("j"); break; case 4 : Encoded_Library_Settings+=__T("f"); break; case 5 : Encoded_Library_Settings+=__T("a"); break; case 6 : Encoded_Library_Settings+=__T("i"); break; default: ; } if (Xing_Scale<=100) //Xing_Scale is used for LAME quality { Encoded_Library_Settings+=__T( " -V ")+Ztring::ToZtring((100-Xing_Scale)/10); Encoded_Library_Settings+=__T( " -q ")+Ztring::ToZtring((100-Xing_Scale)%10); } if (lowpass) Encoded_Library_Settings+=(Encoded_Library_Settings.empty()?__T("-lowpass "):__T(" -lowpass "))+((lowpass%10)?Ztring::ToZtring(((float)lowpass)/10, 1):Ztring::ToZtring(lowpass/10)); switch (Flags&0x0F) { case 2 : case 9 : //ABR Encoded_Library_Settings+=__T(" --abr"); break; case 3 : //VBR (old/rh) Encoded_Library_Settings+=__T(" --vbr-old"); break; case 4 : //VBR (new/mtrh) Encoded_Library_Settings+=__T(" --vbr-new"); break; case 5 : //VBR (?/mt) Encoded_Library_Settings+=__T(" --vbr-mt"); break; default : ; } if (BitRate!=0x00 && BitRate!=0xFF) { switch (Flags&0x0F) { case 1 : case 8 : //CBR Encoded_Library_Settings+=__T(" -b ")+Ztring::ToZtring(BitRate); break; case 2 : case 9 : //ABR BitRate_Nominal.From_Number(BitRate*1000); Encoded_Library_Settings+=__T(" ")+Ztring::ToZtring(BitRate); break; case 3 : //VBR (old/rh) case 4 : //VBR (new/mtrh) case 5 : //VBR (?/mt) BitRate_Minimum.From_Number(BitRate*1000); Encoded_Library_Settings+=__T(" -b ")+Ztring::ToZtring(BitRate); break; default : ; } } FILLING_END(); } else Get_Local(20, Encoded_Library, "Encoded_Library"); } void File_Mpega::Encoded_Library_Guess() { //TODO: Not yet enough precise /* if (Block_Count[1]==0) //No short blocks { if (mode==2) //Dual Mono { if (Scfsi>0) //scfsi used {} else //no scfsi { if (Scalefac>0) //scalefacors used {} else //scalefacors not used Encoded_Library="Shine"; } } else //Other than dual mono { if (Extension_Count[1]>0 || Extension_Count[3]>0) //Intensity Stereo Encoded_Library="Xing (very old)"; else //No Intensity Stereo { if (Scfsi>0) //Scfsi used Encoded_Library="Xing (new)"; else //Scsfi not used { if (Channels_Count[2]>0) //Joint Stereo { if (Channels_Count[0]>0) //also includes no Joint Stereo frames { if (padding_bit) //Padding { if (original_home) Encoded_Library="FhG (l3enc)"; else Encoded_Library="FhG (fastenc or mp3enc)"; } else //No padding Encoded_Library="FhG (ACM or producer pro)"; } else //No stereo frames: joint stereo was forced { if (padding_bit && !original_home && !copyright) Encoded_Library="QDesign (fast mode)"; } } else { if (Channels_Count[0]>0 && Scalefac==0 && !original_home) //Stereo Encoded_Library="Plugger"; else Encoded_Library="Xing (old)"; } } } } } else //Short blocks { if (Scfsi) //scfsi used { if (Scalefac>0) //Scalefactor used Encoded_Library="Gogo (after 3.0)"; //Could be lame, but with a label, detected elsewhere before else Encoded_Library="Lame (old) or m3e"; } else //Scfsi not used { if (Scalefac>0) //Scalefactor used { if (padding_bit) { if (original_home) { //10 last bytes //int sum = get_final_sum(data); //if (sum==0) // return guess = __T("FhG (fastenc, low quality mode)"); //else if (sum==10 * 0xFF) // return guess = __T("FhG (l3enc)"); //else if (sum==5 * 0x20) // return guess = __T("FhG (fastenc, medium or high quality mode)"); //else // return guess = __T("FhG (l3enc or fastenc)"); } else { if (Channels_Count[1]>0 && Extension_Count[1]>0) //Joint Stereo and some Intensity Stereo Encoded_Library="Thomson mp3PRO Encoder"; else Encoded_Library="FhG (fastenc or mp3enc)"; } } else //No padding { if (BitRate_Mode.find(__T("VBR"))==0) //VBR Encoded_Library="FhG (fastenc)"; else Encoded_Library="FhG (ACM or producer pro)"; } } else //scalefactors not used { if (Channels_Count[1]>0) //Joint Stereo { if (padding_bit && !original_home && !copyright) Encoded_Library="QDesign"; } else //Joint Stereo not used { if (BitRate_Mode.find(__T("VBR"))==0) //VBR Encoded_Library="Lame (old)"; else //CBR { if (mode==2) //Dual Mono { if (padding_bit) Encoded_Library="Blade"; else Encoded_Library="dist10 encoder or other encoder"; } else //Stereo or Mono { //if (data.av_reservoir < 40 && !data.vbr) //ISO based encoders are unable to properly use bit reservoir... average reservoir usage is about 10 //{ // if (data.padding) // return guess = __T("Blade"); // else // return guess = __T("dist10 encoder or other encoder"); //} //else // return guess = __T("Gogo (before 3.0)"); } } } } } } */ } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_MPEGA_YES MediaInfoLib/Source/MediaInfo/Audio/File_Mpega.h100777 0 0 6136 12254134766 14774 0/* 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. */ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_MpegaH #define MediaInfo_File_MpegaH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Tag/File__Tags.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Mpega //*************************************************************************** class File_Mpega : public File__Analyze, public File__Tags_Helper { public : //In int64u Frame_Count_Valid; bool FrameIsAlwaysComplete; bool CalculateDelay; //Constructor/Destructor File_Mpega(); private : //Streams management void Streams_Fill(); void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); //Buffer - Synchro bool Synchronize(); bool Synched_Test(); //Buffer - Demux bool Demux_UnpacketizeContainer_Test(); //Buffer - Per element void Header_Parse(); void Data_Parse(); void Data_Parse_Fill(); void audio_data_Layer3(); //Element bool Header_Xing(); bool Header_VBRI(); bool Header_Encoders(); void Header_Encoders_Lame(); void Encoded_Library_Guess(); //Temp Ztring BitRate_Mode; Ztring BitRate_Nominal; Ztring BitRate_Minimum; Ztring Encoded_Library; Ztring Encoded_Library_Settings; std::map BitRate_Count; std::map sampling_frequency_Count; std::map mode_Count; size_t Surround_Frames; size_t Block_Count[3]; //long, short, mixed size_t Channels_Count[4]; //Stereo, Join Stereo, Dual mono, mono size_t Extension_Count[4]; //No, IS, MS, IS+MS size_t Emphasis_Count[4]; //No, 50/15ms, Reserved, CCITT size_t Scfsi; //Total size_t Scalefac; //Total size_t Reservoir; //Total int64u LastSync_Offset; int64u VBR_FileSize; int32u VBR_Frames; int32u Reservoir_Max; int32u Xing_Scale; int32u BitRate; //Average int8u ID; int8u layer; int8u bitrate_index; int8u sampling_frequency; int8u mode; int8u mode_extension; int8u emphasis; bool protection_bit; bool padding_bit; bool copyright; bool original_home; size_t MpegPsPattern_Count; //Helpers bool Element_Name_IsOK(); #if MEDIAINFO_DEMUX #if MEDIAINFO_ADVANCED int8u sampling_frequency_Frame0; int8u mode_Frame0; bool File_Demux_Unpacketize_StreamLayoutChange_Skip; #endif //MEDIAINFO_ADVANCED #endif //MEDIAINFO_DEMUX }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Opus.cpp100777 0 0 14411 12226004262 15221 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Contributor: Lionel Duchateau, kurtnoise@free.fr // // Note : the buffer must be given in ONE call // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_OPUS_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Opus.h" using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- const char* Opus_ChannelPositions[]= { "", "Front: C", "Front: L R", "Front: L C R", "Front: L R, Rear: L R", "Front: L C R, Rear: L R", "Front: L C R, Rear: L R, LFE", "Front: L C R, Side: L R, Rear: C, LFE", "Front: L C R, Side: L R, Rear: L R, LFE", }; //--------------------------------------------------------------------------- const char* Opus_ChannelPositions2[]= { "", "1/0/0", "2/0/0", "2/1/0", "2/2/0", "3/2/0", "3/2/1", "3/2/2", "3/2/3", }; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Opus::File_Opus() :File__Analyze() { //Internal Identification_Done=false; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Opus::Header_Parse() { //Filling Header_Fill_Code(0, "Opus"); Header_Fill_Size(Element_Size); } //--------------------------------------------------------------------------- void File_Opus::Data_Parse() { //Parsing if (Identification_Done) Stream(); else Identification(); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Opus::Identification() { Element_Name("Identification"); //Parsing Ztring opus_version, Channels_Positions; int8u Opus_version_id, ch_count, ch_map; int16u preskip; int32u sample_rate; Get_Local(8,opus_version, "opus_codec_id"); Get_L1 (Opus_version_id, "opus_version_id"); Get_L1 (ch_count, "channel_count"); Get_L2 (preskip, "preskip"); Get_L4 (sample_rate, "rate"); Skip_L2( "ouput_gain"); Get_L1 (ch_map, "channel_map"); if (ch_map) { Skip_L1( "Stream count (N)"); Skip_L1( "Two-channel stream count (M)"); for (int8u Pos=0; Pos2) break; // Not in spec // else it is as Vorbis specs, no break case 1 : // Vorbis order { Ztring ChannelPositions; ChannelPositions.From_Local(Opus_ChannelPositions[ch_count]); Ztring ChannelPositions2; ChannelPositions2.From_Local(Opus_ChannelPositions2[ch_count]); if (ChannelPositions!=Retrieve(Stream_Audio, 0, Audio_ChannelPositions)) Fill(Stream_Audio, 0, Audio_ChannelPositions, ChannelPositions); if (ChannelPositions2!=Retrieve(Stream_Audio, 0, Audio_ChannelPositions_String2)) Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, ChannelPositions2); } default: ; //Unknown } FILLING_END(); //Filling Identification_Done=true; } //--------------------------------------------------------------------------- void File_Opus::Stream() { Element_Name("Stream"); Skip_XX(Element_Size, "Data"); Finish("Opus"); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_OPUS_YES MediaInfoLib/Source/MediaInfo/Audio/File_Opus.h100777 0 0 2574 12226004262 14655 0/* 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 OPUS files // // Contributor: Lionel Duchateau, kurtnoise@free.fr // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_OpusH #define MediaInfo_File_OpusH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Opus //*************************************************************************** class File_Opus : public File__Analyze { public : File_Opus(); private : //Buffer - Per element void Header_Parse(); void Data_Parse(); //Elements void Identification(); void Stream(); //Temp bool Identification_Done; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Pcm.cpp100777 0 0 42701 12226004262 15015 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_PCM_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Pcm.h" #if MEDIAINFO_DEMUX #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #endif //MEDIAINFO_DEMUX //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* Smpte_St0302_ChannelsPositions(int8u Channels) { switch (Channels) { case 2 : return "Front: L R"; //2 channels case 4 : return "Front: L C R, LFE"; //4 channels case 6 : return "Front: L C R, Side: L R, LFE"; //6 channels case 8 : return "Front: L C R, Side: L R, Back: L R, LFE"; //8 channels default : return ""; } } //--------------------------------------------------------------------------- const char* Smpte_St0302_ChannelsPositions2(int8u Channels) { switch (Channels) { case 2 : return "2/0/0.0"; //2 channels case 4 : return "3/0/0.1"; //4 channels case 6 : return "3/2/0.1"; //6 channels case 8 : return "3/2/2.1"; //8 channels default : return ""; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Pcm::File_Pcm() { //Configuration ParserName=__T("PCM"); #if MEDIAINFO_TRACE Trace_Layers_Update(8); //Stream #endif //MEDIAINFO_TRACE IsRawStream=true; PTS_DTS_Needed=true; //In Frame_Count_Valid=4; BitDepth=0; Channels=0; SamplingRate=0; Endianness='\0'; Sign='\0'; #if MEDIAINFO_DEMUX Frame_Count_Valid_Demux=0; #endif //MEDIAINFO_DEMUX } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Pcm::Streams_Fill() { if (Count_Get(Stream_Audio)==0) { Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "PCM"); Fill(Stream_Audio, 0, Audio_Codec, "PCM"); } //Filling Ztring Firm, ITU; if (Codec==__T("EVOB")) {Firm=__T(""); Endianness='B'; Sign='S';} //PCM Signed 16 bits Big Endian, Interleavement is for 2 samples*2 channels L0-1/L0-0/R0-1/R0-0/L1-1/L1-0/R1-1/R1-0/L0-2/R0-2/L1-2/R1-2, http://wiki.multimedia.cx/index.php?title=PCM else if (Codec==__T("VOB")) {Firm=__T(""); Endianness='B'; Sign='S';} //PCM Signed 16 bits Big Endian, Interleavement is for 2 samples*2 channels L0-1/L0-0/R0-1/R0-0/L1-1/L1-0/R1-1/R1-0/L0-2/R0-2/L1-2/R1-2, http://wiki.multimedia.cx/index.php?title=PCM else if (Codec==__T("M2TS")) {Firm=__T(""); Endianness='B'; Sign='S';} //PCM Signed Big Endian else if (Codec==__T("A_PCM/INT/BIG")) {Firm=__T(""); Endianness='B';} else if (Codec==__T("A_PCM/INT/LITTLE")) {Firm=__T(""); Endianness='L';} else if (Codec==__T("A_PCM/INT/FLOAT")) {Firm=__T(""); Endianness='B'; Sign='F';} else if (Codec==__T("fl32")) { if (!Endianness) Endianness='B'; if (!Sign) Sign='F'; BitDepth=32;} else if (Codec==__T("fl64")) { if (!Endianness) Endianness='B'; if (!Sign) Sign='F'; BitDepth=64;} else if (Codec==__T("in24")) { if (!Endianness) Endianness='B'; if (!Sign) Sign='U'; BitDepth=24;} else if (Codec==__T("in32")) { if (!Endianness) Endianness='B'; if (!Sign) Sign='U'; BitDepth=32;} else if (Codec==__T("raw ")) { if (!Endianness) Endianness='L'; Sign='U';} else if (Codec==__T("twos")) { Endianness='B'; Sign='S';} else if (Codec==__T("sowt")) { Endianness='L'; Sign='S';} else if (Codec==__T("lpcm")) { if (!Endianness) Endianness='B'; if (!Sign) Sign='S';} else if (Codec==__T("SWF ADPCM")) {Firm=__T("SWF");} else if (Codec==__T("1")) { if (BitDepth) { if (BitDepth>8) { Endianness='L'; Sign='S';} else { Sign='U';} } } else if (Codec==__T("2")) {Firm=__T("Microsoft");} else if (Codec==__T("3")) { Endianness='F';} else if (Codec==__T("10")) {Firm=__T("OKI");} else if (Codec==__T("11")) {Firm=__T("Intel");} else if (Codec==__T("12")) {Firm=__T("Mediaspace");} else if (Codec==__T("13")) {Firm=__T("Sierra");} else if (Codec==__T("14")) {Firm=__T("Antex");} else if (Codec==__T("17")) {Firm=__T("Dialogic");} else if (Codec==__T("18")) {Firm=__T("Mediavision");} else if (Codec==__T("20")) {Firm=__T("Yamaha");} else if (Codec==__T("33")) {Firm=__T("Antex");} else if (Codec==__T("36")) {Firm=__T("DSP Solution");} else if (Codec==__T("38")) {Firm=__T("Natural MicroSystems");} else if (Codec==__T("39")) {Firm=__T("Crystal Semiconductor");} else if (Codec==__T("3B")) {Firm=__T("Rockwell");} else if (Codec==__T("40")) {Firm=__T("Antex Electronics");} else if (Codec==__T("42")) {Firm=__T("IBM");} else if (Codec==__T("45")) {Firm=__T("Microsoft"); ITU=__T("G.726");} else if (Codec==__T("64")) {Firm=__T("Apicom"); ITU=__T("G.726");} else if (Codec==__T("65")) {Firm=__T("Apicom"); ITU=__T("G.722");} else if (Codec==__T("85")) {Firm=__T("DataFusion Systems"); ITU=__T("G.726");} else if (Codec==__T("8B")) {Firm=__T("Infocom"); ITU=__T("G.721");} else if (Codec==__T("97")) {Firm=__T("ZyXEL");} else if (Codec==__T("100")) {Firm=__T("Rhetorex");} else if (Codec==__T("125")) {Firm=__T("Sanyo");} else if (Codec==__T("140")) {Firm=__T("Dictaphone"); ITU=__T("G.726");} else if (Codec==__T("170")) {Firm=__T("Unisys");} else if (Codec==__T("175")) {Firm=__T("SyCom"); ITU=__T("G.726");} else if (Codec==__T("178")) {Firm=__T("Knownledge");} else if (Codec==__T("200")) {Firm=__T("Creative");} else if (Codec==__T("210")) {Firm=__T("Uher");} else if (Codec==__T("285")) {Firm=__T("Norcom Voice Systems");} else if (Codec==__T("1001")) {Firm=__T("Olivetti");} else if (Codec==__T("1C03")) {Firm=__T("Lucent"); ITU=__T("G.723");} else if (Codec==__T("1C0C")) {Firm=__T("Lucent"); ITU=__T("G.723");} else if (Codec==__T("4243")) {ITU=__T("G.726");} else if (Codec==__T("A105")) {ITU=__T("G.726");} else if (Codec==__T("A107")) {ITU=__T("G.726");} //Format Fill(Stream_Audio, 0, Audio_Codec_String, "PCM"); Fill(Stream_Audio, 0, Audio_Codec_Family, "PCM"); Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR"); //SamplingRate if (SamplingRate) Fill(Stream_Audio, 0, Audio_SamplingRate, SamplingRate); //Firm Fill(Stream_Audio, 0, Audio_Format_Settings, Firm); Fill(Stream_Audio, 0, Audio_Format_Settings_Firm, Firm); Fill(Stream_Audio, 0, Audio_Codec_Settings, Firm); Fill(Stream_Audio, 0, Audio_Codec_Settings_Firm, Firm); //Endianess const char* Value; switch (Endianness) { case 'B': Value="Big"; break; case 'L': Value="Little"; break; default : Value=""; } Fill(Stream_Audio, 0, Audio_Format_Settings, Value); Fill(Stream_Audio, 0, Audio_Format_Settings_Endianness, Value); Fill(Stream_Audio, 0, Audio_Codec_Settings, Value); Fill(Stream_Audio, 0, Audio_Codec_Settings_Endianness, Value); //Sign switch (Sign) { case 'S': Value="Signed"; break; case 'U': Value="Unsigned"; break; default : Value=""; } Fill(Stream_Audio, 0, Audio_Format_Settings, Value); Fill(Stream_Audio, 0, Audio_Format_Settings_Sign, Value); Fill(Stream_Audio, 0, Audio_Codec_Settings, Value); Fill(Stream_Audio, 0, Audio_Codec_Settings_Sign, Value); //ITU Fill(Stream_Audio, 0, Audio_Format_Settings, ITU); Fill(Stream_Audio, 0, Audio_Format_Settings_ITU, ITU); Fill(Stream_Audio, 0, Audio_Codec_Settings, ITU); Fill(Stream_Audio, 0, Audio_Codec_Settings_ITU, ITU); //BitDepth if (BitDepth) Fill(Stream_Audio, 0, Audio_BitDepth, BitDepth); //Channels if (Channels) Fill(Stream_Audio, 0, Audio_Channel_s_, Channels); //Bit rate if (SamplingRate && BitDepth && Channels) Fill(Stream_Audio, 0, Audio_BitRate, SamplingRate*BitDepth*Channels); //ChannelsPositions if (Codec==__T("SMPTE ST 337")) { Fill(Stream_Audio, 0, Audio_ChannelPositions, Smpte_St0302_ChannelsPositions(Channels)); Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, Smpte_St0302_ChannelsPositions2(Channels)); } } //--------------------------------------------------------------------------- void File_Pcm::Streams_Finish() { //No frames in PCM! Frame_Count=(int64u)-1; Frame_Count_NotParsedIncluded=(int64u)-1; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX void File_Pcm::Read_Buffer_Continue() { if (Demux_UnpacketizeContainer && !Status[IsAccepted]) { Frame_Count_Valid_Demux++; if (Frame_Count_Valid_DemuxDemux_PCM_20bitTo16bit_Get()) { size_t Info_Offset=(size_t)Element_Size; const int8u* Info=Buffer+Buffer_Offset; size_t Info2_Size=Info_Offset*4/5; int8u* Info2=new int8u[Info2_Size]; size_t Info2_Pos=0; size_t Info_Pos=0; //Removing bits 3-0 (Little endian) // Dest : 20LE / L1L0 L3L2 R0L4 R2R1 R4R3 // Source: L2L1 L4L3 R2R1 R4R2 while (Info_Pos+5<=Info_Offset) { Info2[Info2_Pos ] =(Info[Info_Pos+1]<<4 ) | (Info[Info_Pos+0]>>4 ); Info2[Info2_Pos+1] =(Info[Info_Pos+2]<<4 ) | (Info[Info_Pos+1]>>4 ); Info2[Info2_Pos+2] = Info[Info_Pos+3] ; Info2[Info2_Pos+3] = Info[Info_Pos+4] ; Info2_Pos+=4; Info_Pos+=5; } Demux(Info2, Info2_Pos, ContentType_MainStream); delete[] Info2; } else if (BitDepth==20 && Endianness=='L' && Config->Demux_PCM_20bitTo24bit_Get()) { size_t Info_Offset=(size_t)Element_Size; const int8u* Info=Buffer+Buffer_Offset; size_t Info2_Size=Info_Offset*6/5; int8u* Info2=new int8u[Info2_Size]; size_t Info2_Pos=0; size_t Info_Pos=0; //Padding bits 3-0 (Little endian) // Dest : 20LE / L1L0 L3L2 R0L4 R2R1 R4R3 // Source: L0XX L2L1 L4L3 R0XX R2R1 R4R2 while (Info_Pos+5<=Info_Offset) { Info2[Info2_Pos ] = Info[Info_Pos+0]<<4 ; Info2[Info2_Pos+1] =(Info[Info_Pos+1]<<4 ) | (Info[Info_Pos+0]>>4 ); Info2[Info2_Pos+2] =(Info[Info_Pos+2]<<4 ) | (Info[Info_Pos+1]>>4 ); Info2[Info2_Pos+3] = Info[Info_Pos+2]&0xF0 ; Info2[Info2_Pos+4] = Info[Info_Pos+3] ; Info2[Info2_Pos+5] = Info[Info_Pos+4] ; Info2_Pos+=6; Info_Pos+=5; } Demux(Info2, Info2_Pos, ContentType_MainStream); delete[] Info2; } else { Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream); } #endif //MEDIAINFO_DEMUX //Parsing Skip_XX(Element_Size, "Data"); //It is impossible to detect... Default is no detection, only filling #if MEDIAINFO_DEMUX if (Frame_Count_Valid_Demux) { Frame_Count+=Frame_Count_Valid_Demux-1; if (Frame_Count_NotParsedIncluded!=(int64u)-1 && Frame_Count_NotParsedIncluded_ToAdd) Frame_Count_NotParsedIncluded+=Frame_Count_NotParsedIncluded_ToAdd; FrameInfo.DUR/=Frame_Count_Valid_Demux; Frame_Count_Valid_Demux=0; } #endif //MEDIAINFO_DEMUX Frame_Count++; 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] && Frame_Count>=Frame_Count_Valid) || File_Offset+Buffer_Size>=File_Size) { Accept(); Fill(); } } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_PCM_YES MediaInfoLib/Source/MediaInfo/Audio/File_Pcm.h100777 0 0 3400 12226004262 14433 0/* 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 PCM files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_PcmH #define MediaInfo_File_PcmH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Pcm //*************************************************************************** class File_Pcm : public File__Analyze { public : //In int64u Frame_Count_Valid; ZenLib::Ztring Codec; int32u SamplingRate; int8u BitDepth; int8u Channels; int8u Endianness; int8u Sign; //Buffer - Global #if MEDIAINFO_DEMUX void Read_Buffer_Continue (); int64u Frame_Count_Valid_Demux; #endif //MEDIAINFO_DEMUX //Constructor/Destructor File_Pcm(); private : //Streams management void Streams_Fill(); void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); //Buffer - Per element void Header_Parse(); void Data_Parse(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Pcm_M2ts.cpp100777 0 0 15125 12226004262 15722 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_PCMM2TS_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Pcm_M2ts.h" #if MEDIAINFO_DEMUX #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #endif //MEDIAINFO_DEMUX //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- int8u Pcm_M2TS_channel_assignment[16]= { 0, 1, 0, 2, 3, 3, 4, 4, 5, 6, 7, 8, 0, 0, 0, 0, }; //--------------------------------------------------------------------------- int32u Pcm_M2TS_sampling_frequency[16]= { 0, 48000, 0, 0, 96000, 192000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; //--------------------------------------------------------------------------- int8u Pcm_M2TS_bits_per_sample[4]= { 0, 16, 20, 24, }; //--------------------------------------------------------------------------- extern const char* Pcm_VOB_ChannelsPositions(int8u channel_assignment); extern const char* Pcm_VOB_ChannelsPositions2(int8u channel_assignment); //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Pcm_M2ts::File_Pcm_M2ts() { //Configuration ParserName=__T("PCM M2TS"); IsRawStream=true; PTS_DTS_Needed=true; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Pcm_M2ts::Streams_Fill() { Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "PCM"); Fill(Stream_Audio, 0, Audio_Codec, "PCM"); Fill(Stream_Audio, 0, Audio_Codec_Family, "PCM"); Fill(Stream_Audio, 0, Audio_MuxingMode, "Blu-ray"); Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR"); int8u Channels=Pcm_M2TS_channel_assignment[channel_assignment]; if (Channels) { if (Pcm_M2TS_sampling_frequency[sampling_frequency]) Fill(Stream_Audio, 0, Audio_SamplingRate, Pcm_M2TS_sampling_frequency[sampling_frequency]); if (Pcm_M2TS_bits_per_sample[bits_per_sample]) Fill(Stream_Audio, 0, Audio_BitDepth, Pcm_M2TS_bits_per_sample[bits_per_sample]); Fill(Stream_Audio, 0, Audio_Channel_s_, Channels); Fill(Stream_Audio, 0, Audio_ChannelPositions, Pcm_VOB_ChannelsPositions(channel_assignment)); Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, Pcm_VOB_ChannelsPositions2(channel_assignment)); if (Pcm_M2TS_sampling_frequency[sampling_frequency] && Pcm_M2TS_bits_per_sample[bits_per_sample]) { if (Channels%2) Fill(Stream_Audio, 0, Audio_BitRate_Encoded, Pcm_M2TS_sampling_frequency[sampling_frequency]*(Channels+1)*Pcm_M2TS_bits_per_sample[bits_per_sample]); //Always by pair Fill(Stream_Audio, 0, Audio_BitRate, Pcm_M2TS_sampling_frequency[sampling_frequency]*Channels*Pcm_M2TS_bits_per_sample[bits_per_sample]); } } Fill(Stream_Audio, 0, Audio_Format_Settings, "Big"); Fill(Stream_Audio, 0, Audio_Format_Settings_Endianness, "Big"); Fill(Stream_Audio, 0, Audio_Codec_Settings, "Big"); Fill(Stream_Audio, 0, Audio_Codec_Settings_Endianness, "Big"); Fill(Stream_Audio, 0, Audio_Format_Settings, "Signed"); Fill(Stream_Audio, 0, Audio_Format_Settings_Sign, "Signed"); Fill(Stream_Audio, 0, Audio_Codec_Settings, "Signed"); Fill(Stream_Audio, 0, Audio_Codec_Settings_Sign, "Signed"); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Pcm_M2ts::Read_Buffer_Continue() { if (Buffer_Size==0) return; //Parsing int16u audio_data_payload_size; Get_B2 ( audio_data_payload_size, "audio_data_payload_size"); BS_Begin(); Get_S1 (4, channel_assignment, "channel_assignment"); Param_Info2(Pcm_M2TS_channel_assignment[channel_assignment], " channel(s)"); Get_S1 (4, sampling_frequency, "sampling_frequency"); Param_Info2(Pcm_M2TS_sampling_frequency[sampling_frequency], " Hz"); Get_S1 (2, bits_per_sample, "bits_per_sample"); Param_Info2(Pcm_M2TS_bits_per_sample[bits_per_sample], " bits"); Skip_SB( "start_flag"); Skip_S1(5, "reserved"); BS_End(); Skip_XX(audio_data_payload_size, "audio_data_payload"); FILLING_BEGIN_PRECISE(); if (!Status[IsAccepted]) { Accept(); Finish(); } FILLING_END(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_PCMM2TS_YES MediaInfoLib/Source/MediaInfo/Audio/File_Pcm_M2ts.h100777 0 0 2646 12226004262 15353 0/* 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 PCM (from Blu-ray) streams // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_Pcm_M2tsH #define MediaInfo_File_Pcm_M2tsH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Pcm_M2ts //*************************************************************************** class File_Pcm_M2ts : public File__Analyze { public : //Constructor/Destructor File_Pcm_M2ts(); private : //Streams management void Streams_Fill(); //Buffer - Global void Read_Buffer_Continue (); //Temp int8u channel_assignment; int8u sampling_frequency; int8u bits_per_sample; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Pcm_Vob.cpp100777 0 0 22066 12226004262 15625 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_PCMVOB_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Pcm_Vob.h" #if MEDIAINFO_DEMUX #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #endif //MEDIAINFO_DEMUX //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- int32u Pcm_VOB_BitDepth[]= { 16, 20, 24, 0, }; //--------------------------------------------------------------------------- int32u Pcm_VOB_Frequency[]= { 48000, 32000, 0, 0, }; //--------------------------------------------------------------------------- const char* Pcm_VOB_ChannelsPositions(int8u channel_assignment) { switch (channel_assignment) { case 1 : return "Front: C"; //1 channel case 3 : return "Front: L R"; //2 channels case 4 : return "Front: L C R"; //3 channels case 5 : return "Front: L R, LFE"; //3 channels case 6 : return "Front: L C R, LFE"; //4 channels case 7 : return "Front: L R, Side: L R"; //4 channels case 8 : return "Front: L C R, Side: L R"; //5 channels case 9 : return "Front: L C R, Side: L R, LFE"; //6 channels case 10 : return "Front: L C R, Side: L R, Back: L R"; //7 channels case 11 : return "Front: L C R, Side: L R, Back: L R, LFE"; //8 channels default : return ""; } } //--------------------------------------------------------------------------- const char* Pcm_VOB_ChannelsPositions2(int8u channel_assignment) { switch (channel_assignment) { case 1 : return "1/0/0.0"; //1 channel case 3 : return "2/0/0.0"; //2 channels case 4 : return "3/0/0.0"; //3 channels case 5 : return "2/0/0.1"; //3 channels case 6 : return "3/0/0.1"; //4 channels case 7 : return "2/2/0.0"; //4 channels case 8 : return "3/2/0.0"; //5 channels case 9 : return "3/2/0.1"; //6 channels case 10 : return "3/2/2.0"; //7 channels case 11 : return "3/2/2.1"; //8 channels default : return ""; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Pcm_Vob::File_Pcm_Vob() { //Configuration ParserName=__T("PCM VOB"); IsRawStream=true; PTS_DTS_Needed=true; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Pcm_Vob::Streams_Fill() { Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "PCM"); Fill(Stream_Audio, 0, Audio_Codec, "PCM"); Fill(Stream_Audio, 0, Audio_Codec_Family, "PCM"); Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR"); Fill(Stream_Audio, 0, Audio_BitDepth, Pcm_VOB_BitDepth[BitDepth]); Fill(Stream_Audio, 0, Audio_SamplingRate, Pcm_VOB_Frequency[Frequency]); Fill(Stream_Audio, 0, Audio_Channel_s_, NumberOfChannelsMinusOne+1); Fill(Stream_Audio, 0, Audio_ChannelPositions, Pcm_VOB_ChannelsPositions(NumberOfChannelsMinusOne+1)); Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, Pcm_VOB_ChannelsPositions2(NumberOfChannelsMinusOne+1)); Fill(Stream_Audio, 0, Audio_BitRate, Pcm_VOB_Frequency[Frequency]*(NumberOfChannelsMinusOne+1)*16); //PCM Signed 16 bits Big Endian, Interleavement is for 2 samples*2 channels L0-1/L0-0/R0-1/R0-0/L1-1/L1-0/R1-1/R1-0/L0-2/R0-2/L1-2/R1-2, http://wiki.multimedia.cx/index.php?title=PCM Fill(Stream_Audio, 0, Audio_Format_Settings, "Big"); Fill(Stream_Audio, 0, Audio_Format_Settings_Endianness, "Big"); Fill(Stream_Audio, 0, Audio_Codec_Settings, "Big"); Fill(Stream_Audio, 0, Audio_Codec_Settings_Endianness, "Big"); Fill(Stream_Audio, 0, Audio_Format_Settings, "Signed"); Fill(Stream_Audio, 0, Audio_Format_Settings_Sign, "Signed"); Fill(Stream_Audio, 0, Audio_Codec_Settings, "Signed"); Fill(Stream_Audio, 0, Audio_Codec_Settings_Sign, "Signed"); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- 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(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_PCMVOB_YES MediaInfoLib/Source/MediaInfo/Audio/File_Pcm_Vob.h100777 0 0 2621 12226004262 15245 0/* 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 PCM (from DVD) files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_Pcm_VobH #define MediaInfo_File_Pcm_VobH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Pcm_Vob //*************************************************************************** class File_Pcm_Vob : public File__Analyze { public : //Constructor/Destructor File_Pcm_Vob(); private : //Streams management void Streams_Fill(); //Buffer - Global void Read_Buffer_Continue (); //Temp int8u BitDepth; int8u Frequency; int8u NumberOfChannelsMinusOne; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Ps2Audio.cpp100777 0 0 10314 12226004262 15717 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_PS2A_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Ps2Audio.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Ps2Audio::Read_Buffer_Continue() { //Parsing while (Element_OffsetBuffer_Size) return false; if (CC3(Buffer+Buffer_Offset)!=0x524B41) //"RKA" { File__Tags_Helper::Reject("RKAU"); return false; } return true; } //--------------------------------------------------------------------------- void File_Rkau::FileHeader_Parse() { //Parsing Ztring version; int32u SampleRate, source_bytes; int8u Channels, BitsPerSample, Quality, Flags; bool joint_stereo, streaming, vrq_lossy_mode; Skip_Local(3, "Signature"); Get_Local (1, version, "Version"); Get_L4 (source_bytes, "SourceBytes"); Get_L4 (SampleRate, "SampleRate"); Get_L1 (Channels, "Channels"); Get_L1 (BitsPerSample, "BitsPerSample"); Get_L1 (Quality, "Quality"); Get_L1 (Flags, "Flags"); Get_Flags (Flags, 0, joint_stereo, "JointStereo"); Get_Flags (Flags, 1, streaming, "Streaming"); Get_Flags (Flags, 2, vrq_lossy_mode, "VRQLossyMode"); FILLING_BEGIN(); if (SampleRate==0) return; Duration=(((int64u)source_bytes*1000)/4)/SampleRate; if (Duration==0) return; UncompressedSize=Channels*(BitsPerSample/8); if (UncompressedSize==0) return; //Filling data File__Tags_Helper::Accept("RKAU"); File__Tags_Helper::Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "RK Audio"); Fill(Stream_Audio, 0, Audio_Codec, "Rkau"); Fill(Stream_Audio, 0, Audio_Encoded_Library, __T("1.0") + version); Fill(Stream_Audio, 0, Audio_Compression_Mode, (Quality==0)?"Lossless":"Lossy"); Fill(Stream_Audio, 0, Audio_BitDepth, BitsPerSample); Fill(Stream_Audio, 0, Audio_Channel_s_, Channels); Fill(Stream_Audio, 0, Audio_SamplingRate, SampleRate); Fill(Stream_Audio, 0, Audio_Duration, Duration); FILLING_END(); //No more needed data File__Tags_Helper::Finish("RKAU"); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_RKAU_YES MediaInfoLib/Source/MediaInfo/Audio/File_Rkau.h100777 0 0 3141 12226004262 14620 0/* 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 RKAU files // // Contributor: Lionel Duchateau, kurtnoise@free.fr // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_RkauH #define MediaInfo_File_RkauH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Tag/File__Tags.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Rkau //*************************************************************************** class File_Rkau : public File__Analyze, public File__Tags_Helper { public : //Constructor/Destructor File_Rkau(); private : //Streams management void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse(); //Buffer - Global void Read_Buffer_Continue() {File__Tags_Helper::Read_Buffer_Continue();} //Temp int64u Duration; int64u UncompressedSize; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_ScreamTracker3.cpp100777 0 0 14204 12226004262 17104 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_S3M_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_ScreamTracker3.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_ScreamTracker3::FileHeader_Begin() { //Element_Size if (Buffer_Size<44) return false; //Must wait for more data if (CC1(Buffer+28)!=0x1A || CC4(Buffer+44)!=0x5343524D) //"SCRM" { Reject("Scream Tracker 3"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_ScreamTracker3::Read_Buffer_Continue() { //Parsing Ztring SongName; int16u OrdNum, InsNum, PatNum, Flags, Special; int8u SoftwareVersionMajor, SoftwareVersionMinor, IS, TS; Get_Local(28, SongName, "Song name"); Skip_L1( "0x1A"); Skip_L1( "Type"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Get_L2 (OrdNum, "Orders count"); Get_L2 (InsNum, "Instruments count"); Get_L2 (PatNum, "Paterns count"); Get_L2 (Flags, "Flags"); Skip_Flags(Flags, 0, "st2vibrato"); Skip_Flags(Flags, 1, "st2tempo"); Skip_Flags(Flags, 2, "amigaslides"); Skip_Flags(Flags, 3, "0vol optimizations"); Skip_Flags(Flags, 4, "amiga limits"); Skip_Flags(Flags, 5, "enable filter/sfx with sb"); Skip_Flags(Flags, 6, "st3.00 volumeslides"); Skip_Flags(Flags, 7, "pecial custom data in file"); Get_L1 (SoftwareVersionMajor, "Cwt/v (Major)"); Get_L1 (SoftwareVersionMinor, "Cwt/v (Minor)"); Skip_L2( "File format information"); Skip_B4( "Signature"); Skip_L1( "global volume"); Get_L1 (IS, "Initial Speed"); Get_L1 (TS, "Initial Temp"); Skip_L1( "master volume"); Skip_L1( "ultra click removal"); Skip_L1( "Default channel pan positions are present"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Get_L2 (Special, "Special"); Skip_XX(32, "Channel settings"); Skip_XX(OrdNum, "Orders"); Skip_XX(InsNum*2, "Instruments"); Skip_XX(PatNum*2, "Patterns"); FILLING_BEGIN(); Accept("Scream Tracker 3"); Fill(Stream_General, 0, General_Format, "Scream Tracker 3"); Fill(Stream_General, 0, General_Track, SongName); if ((SoftwareVersionMajor&0xF0)==0x10) Fill(Stream_General, 0, General_Encoded_Application, Ztring(__T("Scream Tracker ")+Ztring::ToZtring(SoftwareVersionMajor)+__T(".")+Ztring::ToZtring(SoftwareVersionMinor/16)+Ztring::ToZtring(SoftwareVersionMinor%16))); Fill(Stream_General, 0, "BPM", TS); Stream_Prepare(Stream_Audio); Finish("Scream Tracker 3"); FILLING_END(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_S3M_YES MediaInfoLib/Source/MediaInfo/Audio/File_ScreamTracker3.h100777 0 0 2422 12226004262 16530 0/* 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 ScreamTracker3 files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_ScreamTracker3H #define MediaInfo_File_ScreamTracker3H //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_ScreamTracker3 //*************************************************************************** class File_ScreamTracker3 : public File__Analyze { protected : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_SmpteSt0302.cpp100777 0 0 27300 12226004262 16200 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_SMPTEST0302_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_SmpteSt0302.h" #if defined(MEDIAINFO_PCM_YES) #include "MediaInfo/Audio/File_Pcm.h" #endif #if defined(MEDIAINFO_SMPTEST0337_YES) #include "MediaInfo/Audio/File_SmpteSt0337.h" #endif #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events.h" #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #endif //MEDIAINFO_EVENTS //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_SmpteSt0302::File_SmpteSt0302() :File__Analyze() { //Configuration #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Aes3; #endif //MEDIAINFO_EVENTS PTS_DTS_Needed=true; IsRawStream=true; } //--------------------------------------------------------------------------- File_SmpteSt0302::~File_SmpteSt0302() { for (size_t Pos=0; PosContainer_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 Parsers.push_back(SmpteSt0337); } // 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; PosStatus[IsAccepted]) { Fill(Parsers[0]); Merge(*Parsers[0]); } for (size_t Pos=0; Pos>1)&0x55) | ((n<<1) & 0xaa); n=((n>>2)&0x33) | ((n<<2) & 0xcc); n=((n>>4)&0x0f) | ((n<<4) & 0xf0); return (int8u)n; } //--------------------------------------------------------------------------- void File_SmpteSt0302::Read_Buffer_Continue() { //Parsing Get_B2 (audio_packet_size, "audio_packet_size"); BS_Begin(); Get_S1 (2, number_channels, "number_channels"); Param_Info2((1+number_channels)*2, " channels"); Info_S1(8, channel_identification, "channel_identification"); Get_S1 (2, bits_per_sample, "bits_per_sample"); Param_Info2((4+bits_per_sample)*4, " bits"); Info_S1(4, alignment_bits, "alignment_bits"); BS_End(); //Enough data if (Element_Size<4+(int64u)audio_packet_size) { Element_Offset=0; Element_WaitForMoreData(); return; } //Cohenrancy test if (Element_Size!=4+(int64u)audio_packet_size || bits_per_sample==3 || audio_packet_size%((1+number_channels)*(5+bits_per_sample))) { Trusted_IsNot("Wrong size"); Skip_XX(Element_Size-4, "Problem?"); return; } if (!Status[IsAccepted]) Accept("SMPTE ST 302"); //Decyphering size_t PcmSize=0; float64 Ratio=0; switch (bits_per_sample) { case 0 : PcmSize=audio_packet_size*4/5; Ratio=4.0/5.0; break; case 1 : PcmSize=audio_packet_size*5/6; Ratio=5.0/6.0; break; case 2 : PcmSize=audio_packet_size*6/7; Ratio=6.0/7.0; break; case 3 : Reject(); return; default: ; } int8u* Info=new int8u[PcmSize]; size_t Info_Offset=0; while (Element_Offset>4 ); Info[Info_Offset+3]=(Reverse8(Buffer[Buffer_Pos+4])<<4 ) | (Reverse8(Buffer[Buffer_Pos+3])>>4 ); Info_Offset+=4; Element_Offset+=5; break; case 1 : //20 bits // Source: L1L0 L3L2 XXL4 R1R0 R3R2 XXR4 // Dest : 20LE / L1L0 L3L2 R0L4 R2R1 R4R3 Info[Info_Offset+0]= Reverse8(Buffer[Buffer_Pos+0]) ; Info[Info_Offset+1]= Reverse8(Buffer[Buffer_Pos+1]) ; Info[Info_Offset+2]=(Reverse8(Buffer[Buffer_Pos+3])<<4 ) | (Reverse8(Buffer[Buffer_Pos+2])&0x0F); Info[Info_Offset+3]=(Reverse8(Buffer[Buffer_Pos+4])<<4 ) | (Reverse8(Buffer[Buffer_Pos+3])>>4 ); Info[Info_Offset+4]=(Reverse8(Buffer[Buffer_Pos+5])<<4 ) | (Reverse8(Buffer[Buffer_Pos+4])>>4 ); Info_Offset+=5; Element_Offset+=6; break; case 2 : //24 bits // Source: L1L0 L3L2 L5L4 R0XX R2R1 R4R3 XXR5 // Dest : 16LE / L1L0 L3L2 L5L4 R1R0 R3R2 R5R4 Info[Info_Offset+0] = Reverse8(Buffer[Buffer_Pos+0]) ; Info[Info_Offset+1] = Reverse8(Buffer[Buffer_Pos+1]) ; Info[Info_Offset+2] = Reverse8(Buffer[Buffer_Pos+2]) ; Info[Info_Offset+3] =(Reverse8(Buffer[Buffer_Pos+4])<<4 ) | (Reverse8(Buffer[Buffer_Pos+3])>>4 ); Info[Info_Offset+4] =(Reverse8(Buffer[Buffer_Pos+5])<<4 ) | (Reverse8(Buffer[Buffer_Pos+4])>>4 ); Info[Info_Offset+5] =(Reverse8(Buffer[Buffer_Pos+6])<<4 ) | (Reverse8(Buffer[Buffer_Pos+5])>>4 ); Info_Offset+=6; Element_Offset+=7; break; default : ; } } Element_Offset=4; FrameInfo.PTS=FrameInfo.DTS; FrameInfo.DUR=((int64u)audio_packet_size)*1000000000/((1+number_channels)*(5+bits_per_sample)*48000); #if MEDIAINFO_DEMUX Demux_random_access=true; Demux(Info, Info_Offset, ContentType_MainStream); #endif //MEDIAINFO_DEMUX //Parsers for (size_t Pos=0; PosFrameInfo=FrameInfo; Open_Buffer_Continue(Parsers[Pos], Info, Info_Offset, true, Ratio); if (Parsers.size()>1 && Parsers[Pos]->Status[IsAccepted]) { for (size_t Pos2=0; Pos21 && Frame_Count>=2) { for (size_t Pos=0; PosStatus[IsFinished]) { //Filling Finish("SMPTE ST 302"); } } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_SMPTEST0302_YES MediaInfoLib/Source/MediaInfo/Audio/File_SmpteSt0302.h100777 0 0 3226 12226004262 15626 0/* 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 SMPTE ST0302 // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_SmpteSt0302H #define MediaInfo_File_SmpteSt0302H //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_SmpteSt0302 //*************************************************************************** class File_SmpteSt0302 : public File__Analyze { public : //Constructor/Destructor File_SmpteSt0302(); ~File_SmpteSt0302(); private : //Streams management void Streams_Accept(); void Streams_Fill(); //Buffer - Global void Read_Buffer_Continue (); //Temp int16u audio_packet_size; int8u number_channels; int8u bits_per_sample; //Parsers std::vector Parsers; void Parsers_Init(); void Parsers_Parse(const int8u* Parser_Buffer, size_t Parser_Buffer_Size); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_SmpteSt0331.cpp100777 0 0 20323 12226004262 16200 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // AES3 PCM and non-PCM (SMPTE 337M) // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_SMPTEST0331_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_SmpteSt0331.h" #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events.h" #endif //MEDIAINFO_EVENTS #if MEDIAINFO_SEEK #include "MediaInfo/MediaInfo_Internal.h" #endif //MEDIAINFO_SEEK //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* Smpte_St0331_ChannelsPositions(int8u number_channels) { switch (number_channels) { case 0 : return "Front: L R"; //2 channels case 1 : return "Front: L C R, LFE"; //4 channels case 2 : return "Front: L C R, Side: L R, LFE"; //6 channels case 3 : return "Front: L C R, Side: L R, Back: L R, LFE"; //8 channels default : return ""; } } //--------------------------------------------------------------------------- const char* Smpte_St0331_ChannelsPositions2(int8u number_channels) { switch (number_channels) { case 0 : return "2/0/0.0"; //2 channels case 1 : return "3/0/0.1"; //4 channels case 2 : return "3/2/0.1"; //6 channels case 3 : return "3/2/2.1"; //8 channels default : return ""; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_SmpteSt0331::File_SmpteSt0331() :File__Analyze() { //Configuration #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Aes3; #endif //MEDIAINFO_EVENTS PTS_DTS_Needed=true; IsRawStream=true; //In QuantizationBits=0; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_SmpteSt0331::Streams_Fill() { int8u Channels_Count=0; for (int8u Pos=0; Pos<8; Pos++) if (Channels_valid&(1<>4) | ((Buffer[Buffer_Pos+2]<<4)&0xF0 ); Info[Info_Offset+1] = (Buffer[Buffer_Pos+2]>>4) | ((Buffer[Buffer_Pos+3]<<4)&0xF0 ); } else { Info[Info_Offset+0] = (Buffer[Buffer_Pos+0]>>4) | ((Buffer[Buffer_Pos+1]<<4)&0xF0 ); Info[Info_Offset+1] = (Buffer[Buffer_Pos+1]>>4) | ((Buffer[Buffer_Pos+2]<<4)&0xF0 ); Info[Info_Offset+2] = (Buffer[Buffer_Pos+2]>>4) | ((Buffer[Buffer_Pos+3]<<4)&0xF0 ); } Info_Offset+=QuantizationBits==16?2:3; } Element_Offset+=4; } } Element_Offset=4; #if MEDIAINFO_DEMUX OriginalBuffer_Size=(size_t)Element_Size; OriginalBuffer=(int8u*)(Buffer+Buffer_Offset); FrameInfo.PTS=FrameInfo.DTS; FrameInfo.DUR=(Element_Size-4)*1000000000/48000/32; // 48 kHz, 4 bytes per sample Demux_random_access=true; Element_Code=(int64u)-1; Element_Offset=0; Demux(Info, Info_Offset, ContentType_MainStream); Element_Offset=4; OriginalBuffer_Size=0; OriginalBuffer=NULL; #endif //MEDIAINFO_DEMUX delete[] Info; } Skip_XX(Element_Size-4, "Data"); Frame_Count_InThisBlock++; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; #if MEDIAINFO_DEMUX if (FrameInfo.DTS!=(int64u)-1 && FrameInfo.DUR!=(int64u)-1) { FrameInfo.DTS+=FrameInfo.DUR; FrameInfo.PTS=FrameInfo.DTS; } #endif //MEDIAINFO_DEMUX FILLING_BEGIN(); if (!Status[IsAccepted]) { Accept("AES3"); int8u Channels=0; for (int8u Pos=0; Pos<8; Pos++) { if (Channels_valid&(1<Status[IsAccepted]) { Fill(Parser); Merge(*Parser); int64u OverallBitRate=Parser->Retrieve(Stream_General, 0, General_OverallBitRate).To_int64u(); if (OverallBitRate) { OverallBitRate*=Element_Size; OverallBitRate/=Element_Size-Stream_Bits*4/8; Fill(Stream_General, 0, General_OverallBitRate, Ztring::ToZtring(OverallBitRate)+__T(" / ")+Parser->Retrieve(Stream_General, 0, General_OverallBitRate)); } if (Parser->Count_Get(Stream_Audio)) FrameRate=Retrieve(Stream_Audio, 0, Audio_FrameRate).To_float64(); } else if (data_type!=(int8u)-1) { if (Retrieve(Stream_Audio, 0, Audio_Format).empty() && Smpte_St0337_data_type_StreamKind[data_type]!=Stream_Max) { Stream_Prepare(Smpte_St0337_data_type_StreamKind[data_type]); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Format), Smpte_St0337_data_type[data_type]); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Codec), Smpte_St0337_data_type[data_type]); } } // Guard band if (GuardBand_Before) // With guard band, there is big chances that AES3 bit rate is respected { Fill(Stream_General, 0, General_OverallBitRate, Container_Bits*2*48000); if (!IsSub && File_Size!=(int64u)-1) Fill(Stream_General, 0, General_Duration, ((float64)File_Size)*8/(Container_Bits*2*48000)*1000); } if (FrameRate && FrameSizes.size()==1) { Fill(Stream_General, 0, General_OverallBitRate, FrameSizes.begin()->first*Container_Bits*FrameRate, 0); } for (size_t Pos=0; Posfirst); if (Retrieve(StreamKind_Last, Pos, Fill_Parameter(StreamKind_Last, Generic_Duration)).empty()) Fill(StreamKind_Last, Pos, Fill_Parameter(StreamKind_Last, Generic_Duration), Retrieve(Stream_General, 0, General_Duration)); } } //*************************************************************************** // Buffer - Global //*************************************************************************** #if MEDIAINFO_SEEK //--------------------------------------------------------------------------- void File_SmpteSt0337::Read_Buffer_Unsynched() { if (Frame_Count_NotParsedIncluded!=(int64u)-1 && FrameRate) { Frame_Count_NotParsedIncluded=float64_int64s(File_GoTo/FrameRate); FrameInfo.DTS=Frame_Count_NotParsedIncluded*1000000000/48000; } } #endif // MEDIAINFO_SEEK //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_SmpteSt0337::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { // Init if (!Duration_Detected) { MediaInfo_Internal MI; MI.Option(__T("File_KeepInfo"), __T("1")); Ztring ParseSpeed_Save=MI.Option(__T("ParseSpeed_Get"), __T("")); Ztring Demux_Save=MI.Option(__T("Demux_Get"), __T("")); MI.Option(__T("ParseSpeed"), __T("0")); MI.Option(__T("Demux"), Ztring()); size_t MiOpenResult=MI.Open(File_Name); MI.Option(__T("ParseSpeed"), ParseSpeed_Save); // This is a global value, need to reset it. TODO: local value MI.Option(__T("Demux"), Demux_Save); // This is a global value, need to reset it. TODO: local value if (!MiOpenResult) return 0; FrameRate=MI.Get(Stream_Audio, 0, __T("FrameRate")).To_float64(); Duration_Detected=true; } // Parsing switch (Method) { case 0 : if (FrameRate) { float64 FrameSize=3072000/FrameRate; int64u FrameCount=float64_int64s(Value/FrameSize); Value=float64_int64s(FrameCount*FrameSize); } GoTo(Value); Open_Buffer_Unsynch(); return 1; case 1 : return Read_Buffer_Seek(0, File_Size*Value/10000, ID); case 2 : // Timestamp { if (FrameRate) return (size_t)-1; // Not supported { float64 FrameSize=3072000/FrameRate; Unsynch_Frame_Count=float64_int64s(((float64)Value)/1000000000*FrameRate); GoTo(float64_int64s(Unsynch_Frame_Count*FrameSize)); Open_Buffer_Unsynch(); return 1; } } case 3 : // FrameNumber { if (FrameRate) return (size_t)-1; // Not supported { float64 FrameSize=3072000/FrameRate; Unsynch_Frame_Count=Value; GoTo(float64_int64s(Unsynch_Frame_Count*FrameSize)); Open_Buffer_Unsynch(); return 1; } } default : return (size_t)-1; // Not supported } } #endif // MEDIAINFO_SEEK //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_SmpteSt0337::Synchronize() { // Guard band size_t Buffer_Offset_Base=Buffer_Offset; // Synchronizing while (Buffer_Offset+16<=Buffer_Size) { if (!Status[IsAccepted] && !IsSub && File_Offset_FirstSynched==(int64u)-1 && Buffer_TotalBytes+Buffer_Offset>=Buffer_TotalBytes_FirstSynched_Max) { Reject(); return false; } if ((Container_Bits==0 || Container_Bits==16) && (!Aligned || ((Buffer_TotalBytes+Buffer_Offset)%4)==0)) { if (Buffer[Buffer_Offset ]==0xF8 && Buffer[Buffer_Offset+1]==0x72 && Buffer[Buffer_Offset+2]==0x4E && Buffer[Buffer_Offset+3]==0x1F) // 16-bit, BE { Container_Bits=16; Stream_Bits=16; Endianness='B'; // BE break; // while() } if (Buffer[Buffer_Offset ]==0x72 && Buffer[Buffer_Offset+1]==0xF8 && Buffer[Buffer_Offset+2]==0x1F && Buffer[Buffer_Offset+3]==0x4E) // 16-bit, LE { Container_Bits=16; Stream_Bits=16; Endianness='L'; // LE break; // while() } } if ((Container_Bits==0 || Container_Bits==20) && (!Aligned || ((Buffer_TotalBytes+Buffer_Offset)%5)==0)) { if (Buffer[Buffer_Offset ]==0x6F && Buffer[Buffer_Offset+1]==0x87 && Buffer[Buffer_Offset+2]==0x25 && Buffer[Buffer_Offset+3]==0x4E && Buffer[Buffer_Offset+4]==0x1F) // 20-bit, BE { Container_Bits=20; Stream_Bits=20; Endianness='B'; // BE break; // while() } } if ((Container_Bits==0 || Container_Bits==20) && (!Aligned || ((Buffer_TotalBytes+Buffer_Offset)%5)==0)) { if (Buffer[Buffer_Offset ]==0x72 && Buffer[Buffer_Offset+1]==0xF8 && Buffer[Buffer_Offset+2]==0xF6 && Buffer[Buffer_Offset+3]==0xE1 && Buffer[Buffer_Offset+4]==0x54) // 20-bit, LE { Container_Bits=20; Stream_Bits=20; Endianness='L'; // BE break; // while() } } if ((Container_Bits==0 || Container_Bits==24) && (!Aligned || ((Buffer_TotalBytes+Buffer_Offset)%6)==0)) { if (Buffer[Buffer_Offset ]==0x96 && Buffer[Buffer_Offset+1]==0xF8 && Buffer[Buffer_Offset+2]==0x72 && Buffer[Buffer_Offset+3]==0xA5 && Buffer[Buffer_Offset+4]==0x4E && Buffer[Buffer_Offset+5]==0x1F) // 24-bit, BE { Container_Bits=24; Stream_Bits=24; Endianness='B'; // BE break; // while() } if (Buffer[Buffer_Offset ]==0x72 && Buffer[Buffer_Offset+1]==0xF8 && Buffer[Buffer_Offset+2]==0x96 && Buffer[Buffer_Offset+3]==0x1F && Buffer[Buffer_Offset+4]==0x4E && Buffer[Buffer_Offset+5]==0xA5) // 24-bit, LE { Container_Bits=24; Stream_Bits=24; Endianness='L'; // LE break; // while() } if (Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0xF8 && Buffer[Buffer_Offset+2]==0x72 && Buffer[Buffer_Offset+3]==0x00 && Buffer[Buffer_Offset+4]==0x4E && Buffer[Buffer_Offset+5]==0x1F) // 16-bit in 24-bit, BE { Container_Bits=24; Stream_Bits=16; Endianness='B'; // BE NullPadding_Size=1; break; // while() } if (Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x72 && Buffer[Buffer_Offset+2]==0xF8 && Buffer[Buffer_Offset+3]==0x00 && Buffer[Buffer_Offset+4]==0x1F && Buffer[Buffer_Offset+5]==0x4E) // 16-bit in 24-bit, LE { Container_Bits=24; Stream_Bits=16; Endianness='L'; // LE NullPadding_Size=1; break; // while() } if (Buffer[Buffer_Offset ]==0x6F && Buffer[Buffer_Offset+1]==0x87 && Buffer[Buffer_Offset+2]==0x20 && Buffer[Buffer_Offset+3]==0x54 && Buffer[Buffer_Offset+4]==0xE1 && Buffer[Buffer_Offset+5]==0xF0) // 20-bit in 24-bit, BE { Container_Bits=24; Stream_Bits=20; Endianness='B'; // BE break; // while() } if (Buffer[Buffer_Offset ]==0x20 && Buffer[Buffer_Offset+1]==0x87 && Buffer[Buffer_Offset+2]==0x6F && Buffer[Buffer_Offset+3]==0xF0 && Buffer[Buffer_Offset+4]==0xE1 && Buffer[Buffer_Offset+5]==0x54) // 20-bit in 24-bit, LE { Container_Bits=24; Stream_Bits=20; Endianness='L'; // LE break; // while() } } if ((Container_Bits==0 || Container_Bits==32) && (!Aligned || ((Buffer_TotalBytes+Buffer_Offset)%8)==0)) { if (Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x00 && Buffer[Buffer_Offset+2]==0xF8 && Buffer[Buffer_Offset+3]==0x72 && Buffer[Buffer_Offset+4]==0x00 && Buffer[Buffer_Offset+5]==0x00 && Buffer[Buffer_Offset+6]==0x4E && Buffer[Buffer_Offset+7]==0x1F) // 16-bit in 32-bit, BE { Container_Bits=32; Stream_Bits=16; Endianness='B'; // BE NullPadding_Size=2; break; // while() } if (Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x00 && Buffer[Buffer_Offset+2]==0x72 && Buffer[Buffer_Offset+3]==0xF8 && Buffer[Buffer_Offset+4]==0x00 && Buffer[Buffer_Offset+5]==0x00 && Buffer[Buffer_Offset+6]==0x1F && Buffer[Buffer_Offset+7]==0x4E) // 16-bit in 32-bit, LE { Container_Bits=32; Stream_Bits=16; Endianness='L'; // LE NullPadding_Size=2; break; // while() } if (Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x6F && Buffer[Buffer_Offset+2]==0x87 && Buffer[Buffer_Offset+3]==0x20 && Buffer[Buffer_Offset+4]==0x00 && Buffer[Buffer_Offset+5]==0x54 && Buffer[Buffer_Offset+6]==0xE1 && Buffer[Buffer_Offset+7]==0xF0) // 20-bit in 32-bit, BE { Container_Bits=32; Stream_Bits=20; Endianness='B'; // BE NullPadding_Size=1; break; // while() } if (Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x20 && Buffer[Buffer_Offset+2]==0x87 && Buffer[Buffer_Offset+3]==0x6F && Buffer[Buffer_Offset+4]==0x00 && Buffer[Buffer_Offset+5]==0xF0 && Buffer[Buffer_Offset+6]==0xE1 && Buffer[Buffer_Offset+7]==0x54) // 20-bit in 32-bit, LE { Container_Bits=32; Stream_Bits=20; Endianness='L'; // LE NullPadding_Size=1; break; // while() } if (Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x96 && Buffer[Buffer_Offset+2]==0xF8 && Buffer[Buffer_Offset+3]==0x72 && Buffer[Buffer_Offset+4]==0x00 && Buffer[Buffer_Offset+5]==0xA5 && Buffer[Buffer_Offset+6]==0x4E && Buffer[Buffer_Offset+7]==0x1F) // 24-bit in 32-bit, BE { Container_Bits=32; Stream_Bits=24; Endianness='B'; // BE NullPadding_Size=1; break; // while() } if (Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x72 && Buffer[Buffer_Offset+2]==0xF8 && Buffer[Buffer_Offset+3]==0x96 && Buffer[Buffer_Offset+4]==0x00 && Buffer[Buffer_Offset+5]==0x1F && Buffer[Buffer_Offset+6]==0x4E && Buffer[Buffer_Offset+7]==0xA5) // 24-bit in 32-bit, LE { Container_Bits=32; Stream_Bits=24; Endianness='L'; // LE NullPadding_Size=1; break; // while() } } if (Container_Bits>=4 && Aligned) Buffer_Offset+=Container_Bits/4; else Buffer_Offset++; } // Guard band GuardBand_Before+=Buffer_Offset-Buffer_Offset_Base; // Parsing last bytes if needed if (Buffer_Offset+16>Buffer_Size) { return false; } if (!Status[IsAccepted]) Accept("AES3"); // Synched return true; } //--------------------------------------------------------------------------- bool File_SmpteSt0337::Synched_Test() { // Skip NULL padding size_t Buffer_Offset_Temp=Buffer_Offset; if (Aligned) { if (Container_Bits==16) { while ((Buffer_TotalBytes+Buffer_Offset_Temp)%4) // Padding in part of the AES3 block { if (Buffer_Offset_Temp+1>Buffer_Size) { Element_WaitForMoreData(); return false; } if (Buffer[Buffer_Offset_Temp]) { Trusted_IsNot("Bad sync"); return true; } Buffer_Offset_Temp++; } while(Buffer_Offset_Temp+4<=Buffer_Size && CC4(Buffer+Buffer_Offset_Temp)==0x00000000) Buffer_Offset_Temp+=4; if (Buffer_Offset_Temp+4>Buffer_Size) { Element_WaitForMoreData(); return false; } } if (Container_Bits==20) { while ((Buffer_TotalBytes+Buffer_Offset_Temp)%5) // Padding in part of the AES3 block { if (Buffer_Offset_Temp+1>Buffer_Size) { Element_WaitForMoreData(); return false; } if (Buffer[Buffer_Offset_Temp]) { Trusted_IsNot("Bad sync"); return true; } Buffer_Offset_Temp++; } while(Buffer_Offset_Temp+5<=Buffer_Size && CC5(Buffer+Buffer_Offset_Temp)==0x0000000000LL) Buffer_Offset_Temp+=5; if (Buffer_Offset_Temp+5>Buffer_Size) { Element_WaitForMoreData(); return false; } } if (Container_Bits==24) { while ((Buffer_TotalBytes+Buffer_Offset_Temp)%6) // Padding in part of the AES3 block { if (Buffer_Offset_Temp+1>Buffer_Size) { Element_WaitForMoreData(); return false; } if (Buffer[Buffer_Offset_Temp]) { Trusted_IsNot("Bad sync"); return true; } Buffer_Offset_Temp++; } while(Buffer_Offset_Temp+6<=Buffer_Size && CC6(Buffer+Buffer_Offset_Temp)==0x000000000000LL) Buffer_Offset_Temp+=6; if (Buffer_Offset_Temp+6>Buffer_Size) { Element_WaitForMoreData(); return false; } } else if (Container_Bits==32) { while ((Buffer_TotalBytes+Buffer_Offset_Temp)%8) // Padding in part of the AES3 block { if (Buffer_Offset_Temp+1>Buffer_Size) { Element_WaitForMoreData(); return false; } if (Buffer[Buffer_Offset_Temp]) { Trusted_IsNot("Bad sync"); return true; } Buffer_Offset_Temp++; } while(Buffer_Offset_Temp+8<=Buffer_Size && CC8(Buffer+Buffer_Offset_Temp)==0x0000000000000000LL) Buffer_Offset_Temp+=8; if (Buffer_Offset_Temp+8>Buffer_Size) { Element_WaitForMoreData(); return false; } } } else { while(Buffer_Offset_Temp+NullPadding_Size=Buffer_Size) { Element_WaitForMoreData(); return false; } } #if MEDIAINFO_TRACE if (Buffer_Offset_Temp-Buffer_Offset) { Element_Size=Buffer_Offset_Temp-Buffer_Offset; Skip_XX(Buffer_Offset_Temp-Buffer_Offset, "Guard band"); GuardBand_Before+=Buffer_Offset_Temp-Buffer_Offset; } #endif // MEDIAINFO_TRACE Buffer_Offset=Buffer_Offset_Temp; // Must have enough buffer for having header if (Buffer_Offset+16>Buffer_Size) return false; // Quick test of synchro switch (Endianness) { case 'B' : switch (Container_Bits) { case 16 : if (CC4(Buffer+Buffer_Offset)!=0xF8724E1F) {Synched=false; return true;} break; case 20 : if (CC5(Buffer+Buffer_Offset)!=0x6F87254E1FLL) {Synched=false; return true;} break; case 24 : switch (Stream_Bits) { case 16 : if (CC6(Buffer+Buffer_Offset)!=0xF872004E1F00LL) {Synched=false; return true;} break; case 20 : if (CC6(Buffer+Buffer_Offset)!=0x6F872054E1F0LL) {Synched=false; return true;} break; case 24 : if (CC6(Buffer+Buffer_Offset)!=0x96F872A54E1FLL) {Synched=false; return true;} break; default : ; } break; case 32 : switch (Stream_Bits) { case 16 : if (CC8(Buffer+Buffer_Offset)!=0x0000F87200004E1FLL) {Synched=false; return true;} break; case 20 : if (CC8(Buffer+Buffer_Offset)!=0x006F87200054E1F0LL) {Synched=false; return true;} break; case 24 : if (CC8(Buffer+Buffer_Offset)!=0x0096F87200A5F41FLL) {Synched=false; return true;} break; default : ; } break; default : ; } break; case 'L' : switch (Container_Bits) { case 16 : if (CC4(Buffer+Buffer_Offset)!=0x72F81F4E) {Synched=false; return true;} break; case 20 : if (CC5(Buffer+Buffer_Offset)!=0x72F8F6E154LL) {Synched=false; return true;} break; case 24 : switch (Stream_Bits) { case 16 : if (CC6(Buffer+Buffer_Offset)!=0x0072F8001F4ELL) {Synched=false; return true;} break; case 20 : if (CC6(Buffer+Buffer_Offset)!=0x20876FF0E154LL) {Synched=false; return true;} break; case 24 : if (CC6(Buffer+Buffer_Offset)!=0x72F8961F4EA5LL) {Synched=false; return true;} break; default : ; } break; case 32 : switch (Stream_Bits) { case 16 : if (CC8(Buffer+Buffer_Offset)!=0x000072F800001F4ELL) {Synched=false; return true;} break; case 20 : if (CC8(Buffer+Buffer_Offset)!=0x0020876F00F0E154LL) {Synched=false; return true;} break; case 24 : if (CC8(Buffer+Buffer_Offset)!=0x0072F896001F4EA5LL) {Synched=false; return true;} break; default : ; } break; default : ; } break; default : ; // Should never happen } // We continue return true; } //--------------------------------------------------------------------------- void File_SmpteSt0337::Synched_Init() { if (Frame_Count_NotParsedIncluded==(int64u)-1) Frame_Count_NotParsedIncluded=0; if (FrameInfo.DTS==(int64u)-1) FrameInfo.DTS=0; } //*************************************************************************** // Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_SmpteSt0337::Header_Parse() { // Parsing int32u Size=0; switch (Endianness) { case 'B' : switch (Container_Bits) { case 16 : Size=BigEndian2int16u(Buffer+Buffer_Offset+6) ; break; case 20 : Size=BigEndian2int24u(Buffer+Buffer_Offset+7)&0x0FFFFF; break; case 24 : switch (Stream_Bits) { case 16 : Size=BigEndian2int16u(Buffer+Buffer_Offset+9) ; break; case 20 : Size=BigEndian2int24u(Buffer+Buffer_Offset+9)>>4; break; case 24 : Size=BigEndian2int24u(Buffer+Buffer_Offset+9) ; break; default : ; } break; case 32 : switch (Stream_Bits) { case 16 : Size=BigEndian2int16u(Buffer+Buffer_Offset+0xE) ; break; case 20 : Size=BigEndian2int24u(Buffer+Buffer_Offset+0xD)>>4; break; case 24 : Size=BigEndian2int24u(Buffer+Buffer_Offset+0xD) ; break; default : ; } break; default : ; } break; case 'L' : switch (Container_Bits) { case 16 : Size=LittleEndian2int16u(Buffer+Buffer_Offset+6) ; break; case 20 : Size=LittleEndian2int24u(Buffer+Buffer_Offset+7)>>4; break; case 24 : switch (Stream_Bits) { case 16 : Size=LittleEndian2int16u(Buffer+Buffer_Offset+0xA) ; break; case 20 : Size=LittleEndian2int24u(Buffer+Buffer_Offset+0x9)>>4; break; case 24 : Size=LittleEndian2int24u(Buffer+Buffer_Offset+0x9) ; break; default : ; } break; case 32 : switch (Stream_Bits) { case 16 : Size=LittleEndian2int16u(Buffer+Buffer_Offset+0xE) ; break; case 20 : Size=LittleEndian2int24u(Buffer+Buffer_Offset+0xD)>>4; break; case 24 : Size=LittleEndian2int24u(Buffer+Buffer_Offset+0xD) ; break; default : ; } break; default : ; } break; default : ; // Should never happen } // Adaptation if (Container_Bits!=Stream_Bits) { Size*=Container_Bits; Size/=Stream_Bits; GuardBand_Before*=Container_Bits; GuardBand_Before/=Stream_Bits; } // Coherency test if (!IsSub && !Status[IsAccepted]) { size_t Offset=Buffer_Offset+(size_t)(Container_Bits*4/8+Size/8); while (OffsetBuffer_Size) { Element_WaitForMoreData(); return; } Offset/=Container_Bits/4; Offset*=Container_Bits/4; bool IsOK=true; for (int8u Pos=0; Pos>4 ); *(Info_Temp++)=(Buffer[Buffer_Pos+1]<<4 ) | (Buffer[Buffer_Pos+0]>>4 ); *(Info_Temp++)=(Buffer[Buffer_Pos+0]<<4 ) | (Buffer[Buffer_Pos+4]>>4 ); *(Info_Temp++)=(Buffer[Buffer_Pos+4]<<4 ) | (Buffer[Buffer_Pos+3]>>4 ); *(Info_Temp++)=(Buffer[Buffer_Pos+3]<<4 ) | (Buffer[Buffer_Pos+2]>>4 ); Element_Offset+=5; } } if (Endianness=='L' && Container_Bits==24 && Stream_Bits==16) { // Source: XXXX L1L0 L3L2 XXXX R1R0 R3R2 // Dest : 16BE / L3L2 L1L0 R3R2 R1R0 while (Element_Offset+6<=Element_Size) { size_t Buffer_Pos=Buffer_Offset+(size_t)Element_Offset; *(Info_Temp++)= Buffer[Buffer_Pos+2] ; *(Info_Temp++)= Buffer[Buffer_Pos+1] ; *(Info_Temp++)= Buffer[Buffer_Pos+5] ; *(Info_Temp++)= Buffer[Buffer_Pos+4] ; Element_Offset+=6; } } if (Endianness=='L' && Container_Bits==24 && Stream_Bits==20) { // Source: L0XX L2L1 L4L3 R0XX R2R1 R4R3 // Dest : 20BE / L4L3 L2L1 L0R4 R3R2 R1R0 while (Element_Offset+6<=Element_Size) { size_t Buffer_Pos=Buffer_Offset+(size_t)Element_Offset; *(Info_Temp++)= Buffer[Buffer_Pos+2] ; *(Info_Temp++)= Buffer[Buffer_Pos+1] ; *(Info_Temp++)=(Buffer[Buffer_Pos ]&0xF0) | (Buffer[Buffer_Pos+5]>>4 ); *(Info_Temp++)=(Buffer[Buffer_Pos+5]<<4 ) | (Buffer[Buffer_Pos+4]>>4 ); *(Info_Temp++)=(Buffer[Buffer_Pos+4]<<4 ) | (Buffer[Buffer_Pos+3]>>4 ); Element_Offset+=6; } } if (Endianness=='L' && Container_Bits==24 && Stream_Bits==24) { // Source: 24LE / L1L0 L3L2 L5L3 R1R0 R3R2 R5R4 // Dest : 24BE / L5L3 L3L2 L1L0 R5R4 R3R2 R1R0 while (Element_Offset+6<=Element_Size) { size_t Buffer_Pos=Buffer_Offset+(size_t)Element_Offset; *(Info_Temp++)= Buffer[Buffer_Pos+2] ; *(Info_Temp++)= Buffer[Buffer_Pos+1] ; *(Info_Temp++)= Buffer[Buffer_Pos ] ; *(Info_Temp++)= Buffer[Buffer_Pos+5] ; *(Info_Temp++)= Buffer[Buffer_Pos+4] ; *(Info_Temp++)= Buffer[Buffer_Pos+3] ; Element_Offset+=6; } } if (Endianness=='L' && Container_Bits==32 && Stream_Bits==16) { // Source: XXXX XXXX L1L0 L3L2 XXXX XXXX R1R0 R3R2 // Dest : 16BE / L3L2 L1L0 R3R2 R1R0 while (Element_Offset+8<=Element_Size) { size_t Buffer_Pos=Buffer_Offset+(size_t)Element_Offset; *(Info_Temp++)= Buffer[Buffer_Pos+3] ; *(Info_Temp++)= Buffer[Buffer_Pos+2] ; *(Info_Temp++)= Buffer[Buffer_Pos+7] ; *(Info_Temp++)= Buffer[Buffer_Pos+6] ; Element_Offset+=8; } } if (Endianness=='L' && Container_Bits==32 && Stream_Bits==20) { // Source: XXXX L0XX L2L1 L4L3 XXXX R0XX R2R1 R4R3 // Dest : 20BE / L4L3 L2L1 L0R4 R3R2 R1R0 while (Element_Offset+8<=Element_Size) { size_t Buffer_Pos=Buffer_Offset+(size_t)Element_Offset; *(Info_Temp++)= Buffer[Buffer_Pos+3] ; *(Info_Temp++)= Buffer[Buffer_Pos+2] ; *(Info_Temp++)=(Buffer[Buffer_Pos+1]&0xF0) | (Buffer[Buffer_Pos+7]>>4 ); *(Info_Temp++)=(Buffer[Buffer_Pos+7]<<4 ) | (Buffer[Buffer_Pos+6]>>4 ); *(Info_Temp++)=(Buffer[Buffer_Pos+6]<<4 ) | (Buffer[Buffer_Pos+5]>>4 ); Element_Offset+=8; } } if (Endianness=='L' && Container_Bits==32 && Stream_Bits==24) { // Source: XXXX L1L0 L3L2 L5L3 XXXX R1R0 R3R2 R5R4 // Dest : 24BE / L5L3 L3L2 L1L0 R5R4 R3R2 R1R0 while (Element_Offset+8<=Element_Size) { size_t Buffer_Pos=Buffer_Offset+(size_t)Element_Offset; *(Info_Temp++)= Buffer[Buffer_Pos+3] ; *(Info_Temp++)= Buffer[Buffer_Pos+2] ; *(Info_Temp++)= Buffer[Buffer_Pos+1] ; *(Info_Temp++)= Buffer[Buffer_Pos+7] ; *(Info_Temp++)= Buffer[Buffer_Pos+6] ; *(Info_Temp++)= Buffer[Buffer_Pos+5] ; Element_Offset+=8; } } if (Endianness=='B' && Container_Bits==24 && Stream_Bits==20) { // Source: L4L3 L2L1 L0XX R4R3 R2R1 R0XX // Dest : 20BE / L4L3 L2L1 L0R4 R3R2 R1R0 while (Element_Offset+6<=Element_Size) { size_t Buffer_Pos=Buffer_Offset+(size_t)Element_Offset; *(Info_Temp++)= Buffer[Buffer_Pos ] ; *(Info_Temp++)= Buffer[Buffer_Pos+1] ; *(Info_Temp++)=(Buffer[Buffer_Pos+2]&0xF0) | (Buffer[Buffer_Pos+3]>>4 ); *(Info_Temp++)=(Buffer[Buffer_Pos+3]<<4 ) | (Buffer[Buffer_Pos+4]>>4 ); *(Info_Temp++)=(Buffer[Buffer_Pos+4]<<4 ) | (Buffer[Buffer_Pos+5]>>4 ); Element_Offset+=6; } } Save_Buffer=Buffer; Save_Buffer_Offset=Buffer_Offset; Save_Buffer_Size=Buffer_Size; Save_Element_Size=Element_Size; File_Offset+=Buffer_Offset; Buffer=Info; Buffer_Offset=0; Buffer_Size=Info_Temp-Info; Element_Offset=0; Element_Size=Buffer_Size; } // Parsing int32u length_code; Element_Begin1("Header"); BS_Begin(); Skip_S3(Stream_Bits, "Pa"); Skip_S3(Stream_Bits, "Pb"); Element_Begin1("Pc"); Skip_S1( 3, "data_stream_number"); Skip_S1( 5, "data_type_dependent"); Skip_SB( "error_flag"); Info_S1( 2, data_mode, "data_mode"); Param_Info2(16+4*data_mode, " bits"); Get_S1 ( 5, data_type, "data_type"); Param_Info1(Smpte_St0337_data_type[data_type]); if (Stream_Bits>16) Skip_S1( 4, "reserved"); if (Stream_Bits>20) Skip_S1( 4, "reserved"); Element_End0(); Get_S3 (Stream_Bits, length_code, "length_code"); Param_Info2(length_code/8, " bytes"); BS_End(); Element_End0(); if (Parser==NULL) { switch(data_type) { // SMPTE ST338 case 1 : // AC-3 case 16 : // E-AC-3 (professional) case 21 : // E-AC-3 (consumer) Parser=new File_Ac3(); ((File_Ac3*)Parser)->Frame_Count_Valid=2; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_UnpacketizeContainer=false; //No demux from this parser Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX break; case 4 : // MPEG-1 Layer 1 case 5 : // MPEG-1 Layer 2/3, MPEG-2 Layer 1/2/3 without extension case 6 : // MPEG-2 Layer 1/2/3 with extension case 8 : // MPEG-2 Layer 1 low frequency case 9 : // MPEG-2 Layer 2/3 low frequency Parser=new File_Mpega(); break; case 7 : // MPEG-2 AAC in ADTS case 19 : // MPEG-2 AAC in ADTS low frequency Parser=new File_Aac(); ((File_Aac*)Parser)->Mode=File_Aac::Mode_ADTS; break; case 10 : // MPEG-4 AAC in ADTS or LATM case 11 : // MPEG-4 AAC in ADTS or LATM Parser=new File_Aac(); break; case 28 : // Dolby E Parser=new File_DolbyE(); break; default : ; } if (Parser) { Open_Buffer_Init(Parser); } } #if MEDIAINFO_DEMUX if (Save_Buffer) { std::swap(Buffer, Save_Buffer); std::swap(Buffer_Offset, Save_Buffer_Offset); std::swap(Buffer_Size, Save_Buffer_Size); std::swap(Element_Size, Save_Element_Size); File_Offset-=Buffer_Offset; } if (data_type==28) //If Dolby E, we must demux the SMPTE ST 337 header too (TODO: add an option for forcing SMPTE ST 337 header) { int64u Demux_Element_Offset=Element_Offset; Element_Offset=0; if (Container_Bits==20) { //We must pad to 24 bits int8u* Info2=new int8u[(size_t)Element_Size*6/5]; size_t Info2_Offset=0; const int8u* Demux_Buffer=Buffer+Buffer_Offset; size_t Demux_Buffer_Size=(size_t)Element_Size; size_t Demux_Buffer_Pos=0; // Source: 20LE L1L0 L3L2 R0L4 R2R1 R4R3 // Dest : L0XX L2L1 L4L3 R0XX R2R1 R4R3 while (Demux_Buffer_Pos+5<=Demux_Buffer_Size) { Info2[Info2_Offset+0]= Demux_Buffer[Demux_Buffer_Pos+0]<<4 ; Info2[Info2_Offset+1]=(Demux_Buffer[Demux_Buffer_Pos+1]<<4 ) | (Demux_Buffer[Demux_Buffer_Pos+0]>>4 ); Info2[Info2_Offset+2]=(Demux_Buffer[Demux_Buffer_Pos+2]<<4 ) | (Demux_Buffer[Demux_Buffer_Pos+1]>>4 ); Info2[Info2_Offset+3]= Demux_Buffer[Demux_Buffer_Pos+2]&0xF0 ; Info2[Info2_Offset+4]= Demux_Buffer[Demux_Buffer_Pos+3] ; Info2[Info2_Offset+5]= Demux_Buffer[Demux_Buffer_Pos+4] ; Info2_Offset+=6; Demux_Buffer_Pos+=5; } Demux(Info2, Info2_Offset, ContentType_MainStream); delete[] Info2; } else Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream); Element_Offset=Demux_Element_Offset; } else Demux(Buffer+Buffer_Offset+Container_Bits/2, (size_t)(Element_Size-Container_Bits/2), ContentType_MainStream); if (Save_Buffer) { File_Offset+=Buffer_Offset; std::swap(Buffer, Save_Buffer); std::swap(Buffer_Offset, Save_Buffer_Offset); std::swap(Buffer_Size, Save_Buffer_Size); std::swap(Element_Size, Save_Element_Size); } #endif //MEDIAINFO_DEMUX if (Parser && !Parser->Status[IsFinished]) { switch(data_type) { case 28 : ((File_DolbyE*)Parser)->GuardBand_Before+=GuardBand_Before; ((File_DolbyE*)Parser)->GuardBand_After+=GuardBand_After; break; default : ; } Parser->FrameInfo=FrameInfo; Open_Buffer_Continue(Parser, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); Element_Offset=Element_Size; #if MEDIAINFO_DEMUX FrameInfo.DUR=Parser->FrameInfo.DUR; if (FrameInfo.DUR!=(int64u)-1) FrameInfo.DTS+=FrameInfo.DUR; else FrameInfo.DTS=(int64u)-1; FrameInfo.PTS=FrameInfo.DTS; #endif // MEDIAINFO_DEMUX } else { Skip_XX(Element_Size-Element_Offset, "Data"); } FILLING_BEGIN(); FrameSizes[IsSub?Buffer_Size:((GuardBand_Before+Element_Size)*Container_Bits/Stream_Bits)]++; Frame_Count++; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; if (Parser==NULL || (Frame_Count>=2 && Parser->Status[IsFinished])) Finish("AES3"); FILLING_END(); if (Save_Buffer) { delete[] Buffer; Buffer=Save_Buffer; Buffer_Offset=Save_Buffer_Offset; Buffer_Size=Save_Buffer_Size; File_Offset-=Buffer_Offset; } // Guard band GuardBand_Before=0; GuardBand_After=0; } //*************************************************************************** // C++ //*************************************************************************** } // NameSpace #endif // MEDIAINFO_SMPTEST0337_YES MediaInfoLib/Source/MediaInfo/Audio/File_SmpteSt0337.h100777 0 0 4530 12226004262 15635 0/* 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 Non-PCM Audio and Data in an AES3 // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_SmpteSt0337H #define MediaInfo_File_SmpteSt0337H //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_SmpteSt0337 //*************************************************************************** class File_SmpteSt0337 : public File__Analyze { public : // In int8u Container_Bits; int8u Endianness; bool Aligned; // Constructor/Destructor File_SmpteSt0337(); ~File_SmpteSt0337(); private : // Streams management void Streams_Accept(); void Streams_Fill(); // Buffer - Global #if MEDIAINFO_SEEK void Read_Buffer_Unsynched(); size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif // MEDIAINFO_SEEK // Buffer - Synchro bool Synchronize(); bool Synched_Test(); void Synched_Init(); // Buffer - Per element void Header_Parse(); void Data_Parse(); // Elements void Raw(); void Frame(); void Frame_WithPadding(); void Frame_FromMpegPs(); // Temp float64 FrameRate; int8u Stream_Bits; int8u data_type; std::map FrameSizes; int64u GuardBand_Before; int64u GuardBand_After; size_t NullPadding_Size; // Parser File__Analyze* Parser; void Parser_Parse(const int8u* Parser_Buffer, size_t Parser_Buffer_Size); #if MEDIAINFO_SEEK bool Duration_Detected; #endif // MEDIAINFO_SEEK }; } // NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Speex.cpp100777 0 0 13127 12226004262 15362 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Note : the buffer must be given in ONE call // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_SPEEX_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Speex.h" using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Speex::File_Speex() :File__Analyze() { //Internal Identification_Done=false; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Speex::Header_Parse() { //Filling Header_Fill_Code(0, "Speex"); Header_Fill_Size(Element_Size); } //--------------------------------------------------------------------------- void File_Speex::Data_Parse() { //Parsing if (Identification_Done) Comment(); else Identification(); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Speex::Identification() { Element_Name("Identification"); //Parsing Ztring speex_version; int32u Speex_version_id, header_size, rate, nb_channels, bitrate, vbr; Skip_Local(8, "speex_string"); Get_Local(20, speex_version, "speex_version"); Get_L4 (Speex_version_id, "Speex_version_id"); if (Speex_version_id==1) { Get_L4 (header_size, "header_size"); Get_L4 (rate, "rate"); Skip_L4( "mode"); Skip_L4( "mode_bitstream_version"); Get_L4 (nb_channels, "nb_channels"); Get_L4 (bitrate, "bitrate"); Skip_L4( "frame_size"); Get_L4 (vbr, "vbr"); Skip_L4( "frames_per_packet"); Skip_L4( "extra_headers"); Skip_L4( "reserved1"); Skip_L4( "reserved2"); if (header_sizeBuffer_Size) return false; if (CC4(Buffer+Buffer_Offset)!=0x7442614B) //"tBaK" { File__Tags_Helper::Reject("TAK"); return false; } return true; } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- void File_Tak::FileHeader_Parse() { Skip_C4( "Signature"); } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Tak::Header_Parse() { //Parsing int32u block_length; int8u block_type; Get_L1 (block_type, "Block Type"); Get_L3 (block_length, "Block Length"); //Filling Header_Fill_Code(block_type, Ztring().From_CC1(block_type)); Header_Fill_Size(Element_Offset+block_length); } //--------------------------------------------------------------------------- void File_Tak::Data_Parse() { #define CASE_INFO(_NAME) \ case Elements::_NAME : Element_Info1(#_NAME); _NAME(); break; //Parsing switch (Element_Code) { CASE_INFO(ENDOFMETADATA); CASE_INFO(STREAMINFO); CASE_INFO(SEEKTABLE); CASE_INFO(WAVEMETADATA); CASE_INFO(ENCODERINFO); CASE_INFO(PADDING); default : Skip_XX(Element_Size, "Data"); } Element_Offset=Element_Size; } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Tak::ENDOFMETADATA() { //Filling Fill(Stream_General, 0, General_StreamSize, 0); //File_Offset+Buffer_Offset+Element_Size); Fill(Stream_Audio, 0, Audio_StreamSize, File_Size-(File_Offset+Buffer_Offset+Element_Size)); File__Tags_Helper::Finish("TAK"); } //--------------------------------------------------------------------------- void File_Tak::STREAMINFO() { //Parsing int32u num_samples_hi, samplerate; int8u num_samples_lo, framesizecode, samplesize; bool channels; Skip_L1 ( "unknown"); BS_Begin(); Get_S1 ( 2, num_samples_lo, "num_samples (lo)"); Get_S1 ( 3, framesizecode, "framesizecode"); Skip_S1( 2, "unknown"); BS_End(); Get_L4 (num_samples_hi, "num_samples (hi)"); Param_Info2((((int64u)num_samples_hi)<<2 | num_samples_lo), " samples"); Get_L3 (samplerate, "samplerate"); Param_Info2((samplerate/16)+6000, " Hz"); BS_Begin(); Skip_S1( 4, "unknown"); Get_SB ( channels, "channels"); Param_Info1(channels?"Stereo":"Mono"); Get_S1 ( 2, samplesize, "samplesize"); Param_Info1(Tak_samplesize[samplesize]); Skip_SB( "unknown"); BS_End(); Skip_L3( "crc"); FILLING_BEGIN(); //Coherency if (samplerate==0) return; //Computing int64u Samples=((int64u)num_samples_hi)<<2 | num_samples_lo; int32u SamplingRate=(samplerate/16)+6000; //Filling File__Tags_Helper::Accept("TAK"); File__Tags_Helper::Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "TAK"); Fill(Stream_Audio, 0, Audio_Codec, "TAK"); Fill(Stream_Audio, 0, Audio_SamplingRate, SamplingRate); Fill(Stream_Audio, 0, Audio_Channel_s_, channels?2:1); if (Tak_samplesize[samplesize]) Fill(Stream_Audio, 0, Audio_BitDepth, Tak_samplesize[samplesize]); Fill(Stream_Audio, 0, Audio_Duration, Samples*1000/SamplingRate); FILLING_END(); } //--------------------------------------------------------------------------- void File_Tak::SEEKTABLE() { //Parsing int16u num_seekpoints; Get_L2 (num_seekpoints, "num_seekpoints"); Skip_L1 ( "unknown"); Skip_L1 ( "seek interval"); Element_Begin1("seekpoints"); for (int16u Pos=0; PosBuffer_Size) return false; if (CC4(Buffer+Buffer_Offset)!=0x54544131) //"TTA1" { File__Tags_Helper::Reject("TTA"); return false; } return true; } //--------------------------------------------------------------------------- void File_Tta::FileHeader_Parse() { //Parsing int32u SampleRate, Samples, CRC32; int16u AudioFormat, Channels, BitsPerSample; Skip_C4( "Signature"); Get_L2 (AudioFormat, "AudioFormat"); Get_L2 (Channels, "NumChannels"); Get_L2 (BitsPerSample, "BitsPerSample"); Get_L4 (SampleRate, "SampleRate"); Get_L4 (Samples, "DataLength"); Get_L4 (CRC32, "CRC32"); FILLING_BEGIN(); if (SampleRate==0) return; Duration=((int64u)Samples)*1000/SampleRate; if (Duration==0) return; UncompressedSize=Samples*Channels*(BitsPerSample/8); if (UncompressedSize==0) return; //Filling data File__Tags_Helper::Accept("TTA"); File__Tags_Helper::Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "TTA"); Fill(Stream_Audio, 0, Audio_Codec, "TTA "); Fill(Stream_Audio, 0, Audio_BitDepth, BitsPerSample); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Channels); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, SampleRate); Fill(Stream_Audio, 0, Audio_Duration, Duration); FILLING_END(); //No more need data File__Tags_Helper::Finish("TTA"); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_TTA_YES MediaInfoLib/Source/MediaInfo/Audio/File_Tta.h100777 0 0 3042 12226004262 14446 0/* 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 TTA files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_TtaH #define MediaInfo_File_TtaH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Tag/File__Tags.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Tta //*************************************************************************** class File_Tta : public File__Analyze, public File__Tags_Helper { public : //Constructor/Destructor File_Tta(); private : //Streams management void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse(); //Buffer - Global void Read_Buffer_Continue() {File__Tags_Helper::Read_Buffer_Continue();} //Temp int64u Duration; int64u UncompressedSize; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_TwinVQ.cpp100777 0 0 15407 12226004262 15471 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Source: http://wiki.multimedia.cx/index.php?title=VQF // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_TWINVQ_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_TwinVQ.h" #include "ZenLib/Utils.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constants //*************************************************************************** //--------------------------------------------------------------------------- const char* TwinVQ_samplerate(int32u samplerate) { switch (samplerate) { case 11 : return "11025"; case 22 : return "22050"; case 44 : return "44100"; default : return ""; } } //--------------------------------------------------------------------------- namespace Elements { const int32u _c__=0x28632920; const int32u AUTH=0x41555448; const int32u COMM=0x434F4D4D; const int32u COMT=0x434F4D54; const int32u DATA=0x44415441; const int32u DSIZ=0x4453495A; const int32u FILE=0x46494C45; const int32u NAME=0x4E414D45; } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_TwinVQ::FileHeader_Begin() { //Testing if (Buffer_Offset+4>Buffer_Size) return false; if (CC4(Buffer+Buffer_Offset)!=0x5457494E) //"TWIN" { Reject("TwinVQ"); return false; } //All should be OK... return true; } //--------------------------------------------------------------------------- void File_TwinVQ::FileHeader_Parse() { //Parsing Skip_C4( "magic"); Skip_Local(8, "version"); Skip_B4( "subchunks_size"); FILLING_BEGIN(); Accept("TwinVQ"); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "TwinVQ"); Fill(Stream_Audio, 0, Audio_Codec, "TwinVQ"); FILLING_END(); } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_TwinVQ::Header_Parse() { //Parsing int32u id, size; Get_C4 (id, "id"); Get_B4 (size, "size"); //Filling Header_Fill_Code(id, Ztring().From_CC4(id)); Header_Fill_Size(8+(id==Elements::DATA?0:size)); //DATA chunk indicates the end of the header, with no chunk size } //--------------------------------------------------------------------------- void File_TwinVQ::Data_Parse() { #define ELEMENT_CASE(_NAME, _DETAIL) \ case Elements::_NAME : Element_Info1(_DETAIL); _NAME(); break; //Parsing switch (Element_Code) { ELEMENT_CASE(_c__, "Copyright"); ELEMENT_CASE(AUTH, "Author"); ELEMENT_CASE(COMM, "Mandatory information"); ELEMENT_CASE(COMT, "Comment"); ELEMENT_CASE(DATA, "Data"); ELEMENT_CASE(DSIZ, "Data size"); ELEMENT_CASE(FILE, "Filename"); ELEMENT_CASE(NAME, "Song title"); default : Skip_XX(Element_Size, "Unknown"); } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_TwinVQ::COMM() { //Parsing int32u channel_mode, bitrate, samplerate; Get_B4 (channel_mode, "channel_mode"); Get_B4 (bitrate, "bitrate"); Get_B4 (samplerate, "samplerate"); Skip_B4( "security_level"); //Filling Fill(Stream_Audio, 0, Audio_Channel_s_, channel_mode+1); Fill(Stream_Audio, 0, Audio_BitRate, bitrate*1000); Fill(Stream_Audio, 0, Audio_SamplingRate, TwinVQ_samplerate(samplerate)); if (!IsSub && File_Size!=(int64u)-1) Fill(Stream_Audio, 0, Audio_StreamSize, File_Size); } //--------------------------------------------------------------------------- void File_TwinVQ::DATA() { //This is the end of the parsing (DATA chunk format is unknown) Finish("TwinVQ"); } //--------------------------------------------------------------------------- void File_TwinVQ::DSIZ() { //Parsing Skip_B4( "Value"); } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- void File_TwinVQ::_____char() { //Parsing Skip_Local(Element_Size, "Value"); } //--------------------------------------------------------------------------- void File_TwinVQ::_____char(const char* Parameter) { //Parsing Ztring Value; Get_Local(Element_Size, Value, "Value"); //Filling Fill(Stream_General, 0, Parameter, Value); } } //Namespace #endif //MEDIAINFO_TWINVQ_YES MediaInfoLib/Source/MediaInfo/Audio/File_TwinVQ.h100777 0 0 3247 12226004262 15115 0/* 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 Musepack files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_TwinVQH #define MediaInfo_File_TwinVQH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_TwinVQ //*************************************************************************** class File_TwinVQ : public File__Analyze { private : //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse(); //Buffer - Per element void Header_Parse(); void Data_Parse(); //Elements void _c__() {_____char("Copyright");} void ALBM() {_____char("Album");} void AUTH() {_____char("Performer");} void COMM(); void COMT() {_____char("Comment");} void DATA(); void DSIZ(); void FILE() {_____char();} void NAME() {_____char("Title");} //Helpers void _____char(); void _____char(const char* Parameter); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Audio/File_Vorbis.cpp100777 0 0 23545 12226004262 15547 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Note : the buffer must be given in ONE call // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_VORBIS_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Vorbis.h" #include using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- int8u ilog(int32u Value) { int8u ToReturn=0; while(Value) { ToReturn++; Value>>=1; } return ToReturn; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Vorbis::Header_Parse() { //Filling Header_Fill_Code(0, "Vorbis"); Header_Fill_Size(Buffer_Size); } //--------------------------------------------------------------------------- void File_Vorbis::Data_Parse() { //Parsing if (Status[IsAccepted]) Setup(); else Identification(); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Vorbis::Identification() { Element_Name("Identification"); //Parsing int32u Version, SamplingRate, BitRate_Maximum, BitRate_Nominal, BitRate_Minimum; int8u Channels; Skip_B1 ( "Signature"); Skip_Local(6, "Signature"); Get_L4 (Version, "Version"); if (Version>0) return; //Not supported Get_L1 (Channels, "Channels"); Get_L4 (SamplingRate, "SamplingRate"); Get_L4 (BitRate_Maximum, "BitRate_Maximum"); Get_L4 (BitRate_Nominal, "BitRate_Nominal"); Get_L4 (BitRate_Minimum, "BitRate_Minimum"); BS_Begin(); Skip_BS(4, "BlockSize_0"); //2^Value Skip_BS(4, "BlockSize_1"); //2^Value BS_End(); Skip_L1( "Framing"); //Filling FILLING_BEGIN(); Accept("Vorbis"); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, StreamPos_Last, Audio_Format, "Vorbis"); Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "Vorbis"); if (BitRate_Maximum!=0 && BitRate_Maximum<0x80000000) //This is a signed value, and negative values are not OK Fill(Stream_Audio, StreamPos_Last, Audio_BitRate_Maximum, BitRate_Maximum); if (BitRate_Nominal!=0 && BitRate_Nominal<0x80000000) //This is a signed value, and negative values are not OK Fill(Stream_Audio, StreamPos_Last, Audio_BitRate, BitRate_Nominal); if (BitRate_Minimum!=0 && BitRate_Minimum<0x80000000) //This is a signed value, and negative values are not OK Fill(Stream_Audio, StreamPos_Last, Audio_BitRate_Minimum, BitRate_Minimum); if (BitRate_Nominal && BitRate_Maximum==BitRate_Nominal && BitRate_Nominal==BitRate_Minimum) Fill(Stream_Audio, StreamPos_Last, Audio_BitRate_Mode, "CBR"); else Fill(Stream_Audio, StreamPos_Last, Audio_BitRate_Mode, "VBR"); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Channels); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, SamplingRate); FILLING_END(); } //--------------------------------------------------------------------------- void File_Vorbis::Setup() { Element_Name("Setup"); //Parsing Skip_Local(6, "Signature"); int32u codebook, codebook_dimensions, codebook_entries, ordered, codebook_lookup_type; int8u vorbis_codebook_count; Get_L1 (vorbis_codebook_count, "vorbis_codebook_count"); BS_Begin_LE(); //Vorbis bitstream is Little Endian vorbis_codebook_count+=1; for (int Pos=0; Pos2) return; //Not decodable if (codebook_lookup_type>0) { int8u codebook_value_bits; Info_BT(32, codebook_minimum_value, "codebook_minimum_value"); Info_BT(32, codebook_delta_value, "codebook_delta_value"); Get_T1 ( 4, codebook_value_bits, "codebook_value_bits"); codebook_value_bits++; Info_BT( 1, codebook_sequence_p, "codebook_sequence_p"); int32s vals; if (codebook_lookup_type==1) { vals=(int32u)floor(pow((float)codebook_entries,1.f/codebook_dimensions)); for (;;) { int32u acc=1, acc1=1; for(int32u i=0; icodebook_entries) break; else if(acc>codebook_entries) vals--; else vals++; } } else //codebook_lookup_type==2 vals=codebook_entries*codebook_dimensions; int32u codebook_multiplicands; for(int i=0; i 24 bits"; case 0x0A : return "normal compressed audio bitstream (wv file)"; case 0x0B : return "correction file bitstream (wvc file)"; case 0x0C : return "special extended bitstream for floating point data or integers > 24 bit"; case 0x0D : return "contains channel count and channel_mask"; case 0x21 : return "RIFF header for .wav files (before audio)"; case 0x22 : return "RIFF trailer for .wav files (after audio)"; case 0x25 : return "some encoding details for info purposes"; case 0x26 : return "16-byte MD5 sum of raw audio data"; case 0x27 : return "non-standard sampling rate info"; default: return ""; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Wvpk::File_Wvpk() :File__Analyze(), File__Tags_Helper() { //File__Tags_Helper Base=this; //Configuration MustSynchronize=true; Buffer_TotalBytes_FirstSynched_Max=32*1024; //In Frame_Count_Valid=2; FromMKV=false; FromMKV_CodecPrivateParsed=false; //Temp - Technical info total_samples_FirstFrame=(int32u)-1; block_index_FirstFrame=0; block_index_LastFrame=0; SamplingRate=(int8u)-1; num_channels=0; channel_mask=0; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Wvpk::Streams_Finish() { Fill(Stream_Audio, 0, Audio_BitRate_Mode, "VBR"); //Specific case if (FromMKV) return; //Duration if (SamplingRate<15) { int64u Duration=(((int64u)(block_index_LastFrame+block_samples_LastFrame-block_index_FirstFrame))*1000/Wvpk_SamplingRate[SamplingRate]); //Don't forget the last frame with block_samples... int64u CompressedSize=File_Size-TagsSize; int64u UncompressedSize=Duration*(mono?1:2)*Wvpk_Resolution[(resolution1?1:0)*2+(resolution0?1:0)]*Wvpk_SamplingRate[SamplingRate]/8/1000; float32 CompressionRatio=((float32)UncompressedSize)/CompressedSize; Fill(Stream_Audio, 0, Audio_StreamSize, CompressedSize, 3, true); Fill(Stream_Audio, 0, Audio_Duration, Duration, 10, true); Fill(Stream_Audio, 0, Audio_Compression_Ratio, CompressionRatio, 3, true); } File__Tags_Helper::Streams_Finish(); } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Wvpk::FileHeader_Begin() { //Element_Size if (Buffer_Size<2) return false; //Must wait for more data if (CC2(Buffer)==0x4D5A) //"MZ" { File__Tags_Helper::Reject("WavPack"); return false; //Executable with WavPack data are currently not well supported --> It is preferable to set them as executable } //All should be OK... return true; } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Wvpk::Synchronize() { //Specific case if (FromMKV) return true; //Tags bool Tag_Found; if (!File__Tags_Helper::Synchronize(Tag_Found)) return false; if (Tag_Found) return true; //Synchronizing while (Buffer_Offset+4<=Buffer_Size) { while (Buffer_Offset+4<=Buffer_Size && (Buffer[Buffer_Offset ]!=0x77 || Buffer[Buffer_Offset+1]!=0x76 || Buffer[Buffer_Offset+2]!=0x70 || Buffer[Buffer_Offset+3]!=0x6B)) //"wvpk" Buffer_Offset++; if (Buffer_Offset+4<=Buffer_Size)//Testing if size is coherant { //Testing next start, to be sure size_t Size=LittleEndian2int32u(Buffer+Buffer_Offset+4)+8; if (Buffer_Offset+Size+4>Buffer_Size) return false; //Need more data //Testing if (Buffer[Buffer_Offset+Size ]!=0x77 || Buffer[Buffer_Offset+Size+1]!=0x76 || Buffer[Buffer_Offset+Size+2]!=0x70 || Buffer[Buffer_Offset+Size+3]!=0x6B) //"wvpk" Buffer_Offset++; else break; //while() } } //Parsing last bytes if needed if (Buffer_Offset+4>Buffer_Size) { if (Buffer_Offset+3==Buffer_Size && CC3(Buffer+Buffer_Offset)!=0x777670) //"wvp" Buffer_Offset++; if (Buffer_Offset+2==Buffer_Size && CC2(Buffer+Buffer_Offset)!=0x7776) //"wv" Buffer_Offset++; if (Buffer_Offset+1==Buffer_Size && CC1(Buffer+Buffer_Offset)!=0x77) //"w" Buffer_Offset++; return false; } //Synched is OK return true; } //--------------------------------------------------------------------------- bool File_Wvpk::Synched_Test() { //Specific case if (FromMKV) return true; //Tags if (!File__Tags_Helper::Synched_Test()) return false; //Must have enough buffer for having header if (Buffer_Offset+3>Buffer_Size) return false; //Quick test of synchro if (Buffer[Buffer_Offset ]!=0x77 || Buffer[Buffer_Offset+1]!=0x76 || Buffer[Buffer_Offset+2]!=0x70 || Buffer[Buffer_Offset+3]!=0x6B) //"wvpk" Synched=false; //We continue return true; } //*************************************************************************** // Format //*************************************************************************** //--------------------------------------------------------------------------- void File_Wvpk::Read_Buffer_Continue() { //Tags if (!FromMKV) File__Tags_Helper::Read_Buffer_Continue(); } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Wvpk::Header_Parse() { //Specific cases if (FromMKV) { Header_Fill_Size(Element_Size); Header_Fill_Code(0, "Block"); return; } //Parsing int32u ckSize; Skip_C4( "ckID"); Get_L4 (ckSize, "ckSize"); //Filling Header_Fill_Size(8+ckSize); Header_Fill_Code(0, "Block"); } //--------------------------------------------------------------------------- void File_Wvpk::Data_Parse() { //Specific if (FromMKV && !FromMKV_CodecPrivateParsed) { //Parsing Get_L2 (version, "version"); FILLING_BEGIN(); FromMKV_CodecPrivateParsed=true; FILLING_END(); return; } //Counting Frame_Count++; //Parsing Element_Begin1("Block Header"); if (!FromMKV) Get_L2 (version, "version"); if (version/0x100==0x4) { while (Element_Offset>23)&0xF)); Param_Info1(Wvpk_SamplingRate[SamplingRate]); Skip_Flags(flags, 27, "reserved"); Skip_Flags(flags, 28, "reserved"); Skip_Flags(flags, 29, "use IIR for negative hybrid noise shaping"); Skip_Flags(flags, 30, "false stereo"); Skip_Flags(flags, 31, "reserved"); } else { Skip_L4( "flags (empty)"); //Counting Frame_Count--; //This is not a real frame } Skip_L4( "crc"); Element_End0(); int64u End=Element_Size; if (FromMKV && !(initial_block && final_block)) { Get_L4 (blocksize, "blocksize"); End=Element_Offset+blocksize; if (End>=Element_Size) End=Element_Size; } //Sub-block int8u id; while (Element_Offset=Frame_Count_Valid) { File__Tags_Helper::Accept("WavPack"); Data_Parse_Fill(); } } //--------------------------------------------------------------------------- void File_Wvpk::Data_Parse_Fill() { //Filling File__Tags_Helper::Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "WavPack"); Ztring Version_Minor=Ztring::ToZtring(version%0x100); if (Version_Minor.size()==1) Version_Minor.insert(0, 1, __T('0')); Fill(Stream_Audio, 0, Audio_Format_Profile, Ztring::ToZtring(version/0x100)+__T('.')+Version_Minor); Fill(Stream_Audio, 0, Audio_Codec, "Wavpack"); Fill(Stream_Audio, 0, Audio_BitDepth, Wvpk_Resolution[(resolution1?1:0)*2+(resolution0?1:0)]); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, num_channels?num_channels:(mono?1:2)); if (channel_mask) { Ztring Channels_Positions, Channels_Positions2; if (channel_mask&0x00C7) { int8u Count=0; Channels_Positions+=__T("Front:"); if (channel_mask&0x0001) { Channels_Positions+=__T(" L"); Count++; } if (channel_mask&0x0004) { Channels_Positions+=__T(" C"); Count++; } if (channel_mask&0x0040) { Channels_Positions+=__T(" C"); Count++; } if (channel_mask&0x0080) { Channels_Positions+=__T(" C"); Count++; } if (channel_mask&0x0002) { Channels_Positions+=__T(" R"); Count++; } Channels_Positions2+=Ztring::ToZtring(Count); } if (channel_mask&0x0600) { int8u Count=0; if (!Channels_Positions.empty()) Channels_Positions+=__T(", "); Channels_Positions+=__T("Side:"); if (channel_mask&0x0200) { Channels_Positions+=__T(" L"); Count++; } if (channel_mask&0x0400) { Channels_Positions+=__T(" R"); Count++; } Channels_Positions2+=__T('.')+Ztring::ToZtring(Count); } else Channels_Positions2+=__T("/0"); if (channel_mask&0x0130) { int8u Count=0; if (!Channels_Positions.empty()) Channels_Positions+=__T(", "); Channels_Positions+=__T("Back:"); if (channel_mask&0x0010) { Channels_Positions+=__T(" L"); Count++; } if (channel_mask&0x0100) { Channels_Positions+=__T(" C"); Count++; } if (channel_mask&0x0020) { Channels_Positions+=__T(" R"); Count++; } Channels_Positions2+=__T('/')+Ztring::ToZtring(Count); } else Channels_Positions2+=__T("/0"); if (channel_mask&0x0008) { if (!Channels_Positions.empty()) Channels_Positions+=__T(", "); Channels_Positions+=__T("LFE"); Channels_Positions2+=__T(".1"); } Fill(Stream_Audio, 0, Audio_ChannelPositions, Channels_Positions); Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, Channels_Positions2); } if (!FromMKV && SamplingRate<15) { Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, Wvpk_SamplingRate[SamplingRate]); if (total_samples_FirstFrame!=(int32u)-1) //--> this is a valid value Fill(Stream_Audio, 0, Audio_Duration, ((int64u)total_samples_FirstFrame)*1000/Wvpk_SamplingRate[SamplingRate]); } Fill(Stream_Audio, 0, Audio_Format_Settings, hybrid?"Hybrid lossy":"Lossless"); Fill(Stream_Audio, 0, Audio_Codec_Settings, hybrid?"hybrid lossy":"lossless"); Fill(Stream_Audio, 0, Audio_Encoded_Library_Settings, Encoded_Library_Settings); //No more need data File__Tags_Helper::GoToFromEnd(512*1024, "WavPack"); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Wvpk::id_07() { //Parsing Skip_XX(Size, "Data (Not decoded yet)"); FILLING_BEGIN(); if (Retrieve(Stream_Audio, 0, Audio_Compression_Mode).empty()) Fill(Stream_Audio, 0, Audio_Compression_Mode, "Lossless"); FILLING_END(); } //--------------------------------------------------------------------------- void File_Wvpk::id_0D() { //Parsing Get_L1 (num_channels, "num_channels"); switch (Size) { case 1 : break; case 2 : { int8u channel_mask_1; Get_L1 (channel_mask_1, "channel_mask"); channel_mask=channel_mask_1; } break; case 3 : { int16u channel_mask_2; Get_L2 (channel_mask_2, "channel_mask"); channel_mask=channel_mask_2; } break; case 4 : Get_L3 (channel_mask, "channel_mask"); break; case 5 : Get_L4 (channel_mask, "channel_mask"); break; default : Skip_XX(Size, "unknown"); } } //--------------------------------------------------------------------------- void File_Wvpk::id_25() { //Parsing int32u flags; int8u extra=1; Get_L3 (flags, "flags"); Skip_Flags(flags, 0, ""); Skip_Flags(flags, 1, "fast mode"); Skip_Flags(flags, 2, ""); Skip_Flags(flags, 3, "high quality mode"); Skip_Flags(flags, 4, "very high quality mode"); Skip_Flags(flags, 5, "bitrate is kbps, not bits/sample"); Skip_Flags(flags, 6, "automatic noise shaping"); Skip_Flags(flags, 7, "shaping mode specified"); Skip_Flags(flags, 8, "joint-stereo mode specified"); Skip_Flags(flags, 9, "dynamic noise shaping"); Skip_Flags(flags, 10, "create executable"); Skip_Flags(flags, 11, "create correction file"); Skip_Flags(flags, 12, "maximize bybrid compression"); Skip_Flags(flags, 13, ""); Skip_Flags(flags, 14, ""); Skip_Flags(flags, 15, "calc noise in hybrid mode"); Skip_Flags(flags, 16, "lossy mode"); Skip_Flags(flags, 17, "extra processing mode"); Skip_Flags(flags, 18, "no wvx stream w/ floats & big ints"); Skip_Flags(flags, 19, "store MD5 signature"); Skip_Flags(flags, 20, "merge blocks of equal redundancy (for lossyWAV)"); Skip_Flags(flags, 21, ""); Skip_Flags(flags, 22, ""); Skip_Flags(flags, 23, "optimize for mono streams posing as stereo"); if (flags&0x20000 && Size>=4) { Get_L1(extra, "extra"); } if ((flags&0x20000 && Size>4) || (!(flags&0x20000) && Size>3)) Skip_XX(Size-3-(flags&0x20000?1:0), "unknown"); //Filling if (flags&0x000001) Encoded_Library_Settings+=__T(" -?"); if (flags&0x000002) Encoded_Library_Settings+=__T(" -f"); if (flags&0x000004) Encoded_Library_Settings+=__T(" -?"); if (flags&0x000008) Encoded_Library_Settings+=__T(" -h"); if (flags&0x000010) Encoded_Library_Settings+=__T(" -hh"); if (flags&0x000020) Encoded_Library_Settings+=__T(" -?(bitrate is kbps, not bits/sample)"); if (flags&0x000040) Encoded_Library_Settings+=__T(" -?(automatic noise shaping)"); if (flags&0x000080) Encoded_Library_Settings+=__T(" -sn"); if (flags&0x000100) Encoded_Library_Settings+=__T(" -jn"); if (flags&0x000200) Encoded_Library_Settings+=__T(" -use-dns"); if (flags&0x000400) Encoded_Library_Settings+=__T(" -e"); if (flags&0x000800) Encoded_Library_Settings+=__T(" -c"); if (flags&0x001000) Encoded_Library_Settings+=__T(" -cc"); if (flags&0x002000) Encoded_Library_Settings+=__T(" -?"); if (flags&0x004000) Encoded_Library_Settings+=__T(" -?"); if (flags&0x008000) Encoded_Library_Settings+=__T(" -n"); if (flags&0x010000) Encoded_Library_Settings+=__T(" -?(lossy mode)"); if (flags&0x020000) { Encoded_Library_Settings+=__T(" -x"); if (extra) Encoded_Library_Settings+=Ztring::ToZtring(extra); } if (flags&0x04000) Encoded_Library_Settings+=__T(" -?"); if (flags&0x080000) Encoded_Library_Settings+=__T(" -m"); if (flags&0x100000) Encoded_Library_Settings+=__T(" --merge-blocks"); if (flags&0x200000) Encoded_Library_Settings+=__T(" -?"); if (flags&0x400000) Encoded_Library_Settings+=__T(" -?"); if (flags&0x800000) Encoded_Library_Settings+=__T(" --optimize-mono"); if (!Encoded_Library_Settings.empty()) Encoded_Library_Settings.erase(Encoded_Library_Settings.begin()); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_WVPK_YES MediaInfoLib/Source/MediaInfo/Audio/File_Wvpk.h100777 0 0 4307 12226004262 14652 0/* 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 WavePack files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_WvpkH #define MediaInfo_File_WvpkH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Tag/File__Tags.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Wvpk //*************************************************************************** class File_Wvpk : public File__Analyze, public File__Tags_Helper { public : //In int64u Frame_Count_Valid; bool FromMKV; bool FromMKV_CodecPrivateParsed; //Constructor - Destructor File_Wvpk(); private : //Streams management void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); //Buffer - Synchro bool Synchronize(); bool Synched_Test(); //Buffer - Global void Read_Buffer_Continue (); //Buffer - Per element void Header_Parse(); void Data_Parse(); void Data_Parse_Fill(); //Elements void id_07(); void id_0D(); void id_25(); //Temp - Technical info int32u total_samples_FirstFrame; int32u block_index_FirstFrame; int32u block_index_LastFrame; int32u block_samples_LastFrame; bool resolution0; bool resolution1; bool mono; bool hybrid; bool joint_stereo; bool cross_channel_decorrelation; int8u SamplingRate; int8u num_channels; int32u channel_mask; int32u Size; int16u version; Ztring Encoded_Library_Settings; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Duplicate/ 40777 0 0 0 12226004261 13357 5MediaInfoLib/Source/MediaInfo/Duplicate/File__Duplicate_MpegTs.cpp100777 0 0 44544 12226004261 20505 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Duplication helper for some specific formats // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPEGPS_YES) || defined(MEDIAINFO_MPEGTS_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Duplicate/File__Duplicate_MpegTs.h" #include "MediaInfo/MediaInfo_Config.h" #include "ZenLib/ZtringList.h" #include "ZenLib/File.h" #include using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- // CRC_32_Table // A CRC is computed like this: // Init: int32u CRC_32 = 0xFFFFFFFF; // for each data byte do // CRC_32=(CRC_32<<8) ^ CRC_32_Table[(CRC_32>>24)^(data_byte)]; extern int32u Psi_CRC_32_Table[256]; //*************************************************************************** // Constructor/Destructor //*************************************************************************** File__Duplicate_MpegTs::File__Duplicate_MpegTs (const Ztring &Target) : File__Duplicate__Base() { Writer.Configure(Target); //Current program_map_PIDs.resize(0x2000, 0); elementary_PIDs.resize(0x2000, 0); elementary_PIDs_program_map_PIDs.resize(0x2000, 0); } //*************************************************************************** // Set //*************************************************************************** //--------------------------------------------------------------------------- bool File__Duplicate_MpegTs::Configure (const Ztring &Value, bool ToRemove) { //Form: "program_number" if (Value.find(__T("program_number="))==0) { int16u program_number=Ztring(Value.substr(15, std::string::npos)).To_int16u(); if (ToRemove) { if (Wanted_program_numbers.find(program_number)!=Wanted_program_numbers.end()) Wanted_program_numbers.erase(program_number); else if (Remove_program_numbers.find(program_number)==Remove_program_numbers.end()) Remove_program_numbers.insert(program_number); } else { if (Remove_program_numbers.find(program_number)!=Remove_program_numbers.end()) Remove_program_numbers.erase(program_number); if (Wanted_program_numbers.find(program_number)==Wanted_program_numbers.end()) Wanted_program_numbers.insert(program_number); } if (!PAT.empty()) PAT.begin()->second.ConfigurationHasChanged=true; } //Form: "program_map_PID" else if (Value.find(__T("program_map_PID="))==0) { int16u program_map_PID=Ztring(Value.substr(16, std::string::npos)).To_int16u(); if (ToRemove) { if (Wanted_program_map_PIDs.find(program_map_PID)!=Wanted_program_map_PIDs.end()) Wanted_program_map_PIDs.erase(program_map_PID); else if (Remove_program_map_PIDs.find(program_map_PID)==Remove_program_map_PIDs.end()) Remove_program_map_PIDs.insert(program_map_PID); } else { if (Remove_program_map_PIDs.find(program_map_PID)!=Remove_program_map_PIDs.end()) Remove_program_map_PIDs.erase(program_map_PID); if (Wanted_program_map_PIDs.find(program_map_PID)==Wanted_program_map_PIDs.end()) Wanted_program_map_PIDs.insert(program_map_PID); } if (PMT.find(program_map_PID)!=PMT.end()) PMT[program_map_PID].ConfigurationHasChanged=true; } //Form: "elementary_PID" else if (Value.find(__T("elementary_PID="))==0) { int16u elementary_PID=Ztring(Value.substr(15, std::string::npos)).To_int16u(); if (ToRemove) { if (Wanted_elementary_PIDs.find(elementary_PID)!=Wanted_elementary_PIDs.end()) Wanted_elementary_PIDs.erase(elementary_PID); else if (Remove_elementary_PIDs.find(elementary_PID)==Remove_elementary_PIDs.end()) Remove_elementary_PIDs.insert(elementary_PID); } else { if (Remove_elementary_PIDs.find(elementary_PID)!=Remove_elementary_PIDs.end()) Remove_elementary_PIDs.erase(elementary_PID); if (Wanted_elementary_PIDs.find(elementary_PID)==Wanted_elementary_PIDs.end()) Wanted_elementary_PIDs.insert(elementary_PID); } if (PMT.find(elementary_PIDs_program_map_PIDs[elementary_PID])!=PMT.end()) PMT[elementary_PIDs_program_map_PIDs[elementary_PID]].ConfigurationHasChanged=true; } //Old else { int16u program_number=Ztring(Value).To_int16u(); if (ToRemove) { if (Wanted_program_numbers.find(program_number)!=Wanted_program_numbers.end()) Wanted_program_numbers.erase(program_number); else if (Remove_program_numbers.find(program_number)==Remove_program_numbers.end()) Remove_program_numbers.insert(program_number); } else { if (Remove_program_numbers.find(program_number)!=Remove_program_numbers.end()) Remove_program_numbers.erase(program_number); if (Wanted_program_numbers.find(program_number)==Wanted_program_numbers.end()) Wanted_program_numbers.insert(program_number); } if (!PAT.empty()) PAT.begin()->second.ConfigurationHasChanged=true; } //Can be disabled? if (Wanted_program_numbers.empty() && Wanted_program_map_PIDs.empty() && Wanted_elementary_PIDs.empty() && Remove_program_numbers.empty() && Remove_program_map_PIDs.empty() && Remove_elementary_PIDs.empty()) return true; //It can be erased else return false; //We always need it } //*************************************************************************** // Write //*************************************************************************** bool File__Duplicate_MpegTs::Write (int16u PID, const int8u* ToAdd, size_t ToAdd_Size) { if (elementary_PIDs[PID]) { Writer.Write(ToAdd, ToAdd_Size); return false; } else if (program_map_PIDs[PID]) return Manage_PMT(ToAdd, ToAdd_Size); else if (PID==0x0000) return Manage_PAT(ToAdd, ToAdd_Size); else return false; } bool File__Duplicate_MpegTs::Manage_PAT (const int8u* ToAdd, size_t ToAdd_Size) { if (!Parsing_Begin(ToAdd, ToAdd_Size, PAT)) return false; //Programs program_map_PIDs.clear(); program_map_PIDs.resize(0x2000, 0); elementary_PIDs.clear(); elementary_PIDs.resize(0x2000, 0); while (FromTS.Offset+4<=FromTS.End) { //For each program int16u program_number =CC2(FromTS.Buffer+FromTS.Offset+0); int16u program_map_PID=CC2(FromTS.Buffer+FromTS.Offset+2)&0x1FFF; if (Wanted_program_numbers.find(program_number) !=Wanted_program_numbers.end() || Wanted_program_map_PIDs.find(program_map_PID)!=Wanted_program_map_PIDs.end()) { //Integrating it program_map_PIDs[program_map_PID]=1; std::memcpy(PAT[StreamID].Buffer+PAT[StreamID].Offset, FromTS.Buffer+FromTS.Offset, 4); PAT[StreamID].Offset+=4; PMT[program_number].ConfigurationHasChanged=true; } FromTS.Offset+=4; } Parsing_End(PAT); //Reseting std::vector StreamID_List; for (std::map::iterator PAT_=PAT.begin(); PAT_!=PAT.end(); ++PAT_) if (PAT_->first!=StreamID) StreamID_List.push_back(PAT_->first); for (size_t Pos=0; Pos &ToModify_) { //Managing big chunks int16u PID=((ToAdd[1]&0x1F)<<8)|ToAdd[2]; //BigEndian2int16u(ToAdd+1)&0x1FFF; if (ToAdd[1]&0x40) //payload_unit_start_indicator { FromTS.Buffer=ToAdd; FromTS.Size=ToAdd_Size; FromTS.Offset=0; } else { if (BigBuffers.find(PID)==BigBuffers.end()) return false; //Start is missing if (ToAdd_Size<4 || BigBuffers[PID].Buffer_Size+ToAdd_Size-4>BigBuffers[PID].Buffer_Size_Max) return false; //Problem std::memcpy(BigBuffers[PID].Buffer+BigBuffers[PID].Buffer_Size, ToAdd+4, ToAdd_Size-4); BigBuffers[PID].Buffer_Size+=ToAdd_Size-4; FromTS.Buffer=BigBuffers[PID].Buffer; FromTS.Size=BigBuffers[PID].Buffer_Size; FromTS.Offset=0; } //adaptation_field_length int8u adaptation_field_length=0; if (CC1(FromTS.Buffer+3)&0x20) //adaptation_field_control (adaptation) == true adaptation_field_length=1+CC1(FromTS.Buffer+4); //pointer_field FromTS.Offset+=4+adaptation_field_length; int8u pointer_field=CC1(FromTS.Buffer+FromTS.Offset); //table_id FromTS.Offset+=1+pointer_field; int8u table_id=FromTS.Buffer[FromTS.Offset]; if (table_id!=0x00 && table_id!=0x02) //Currently only PAT and PMT are handled return false; //section_length FromTS.Offset++; if (FromTS.Offset+2>FromTS.Size) return false; FromTS.Begin=FromTS.Offset-1; int16u section_length=CC2(FromTS.Buffer+FromTS.Offset)&0x0FFF; FromTS.End=4+adaptation_field_length+section_length; //Positionning just after section_length FromTS.Offset+=2; //Retrieving StreamID StreamID=CC2(FromTS.Buffer+FromTS.Offset); buffer &ToModify=ToModify_[StreamID]; //version_number int8u FromTS_version_number=(CC1(FromTS.Buffer+FromTS.Offset+2)>>1)&0x1F; if (ToModify.version_number==0xFF && FromTS.End<=FromTS.Size-4) //Only if we have enough data ToModify.version_number=FromTS_version_number; if (ToModify.continuity_counter==0xFF && FromTS.End<=FromTS.Size-4) //Only if we have enough data ToModify.continuity_counter=FromTS.Buffer[3]&0xF; if (FromTS_version_number!=ToModify.FromTS_version_number_Last || ToModify.ConfigurationHasChanged) { if (FromTS.End<=FromTS.Size-4) //Only if we have enough data { ToModify.version_number++; if (ToModify.version_number>0x1F) ToModify.version_number=0; ToModify.FromTS_version_number_Last=FromTS_version_number; ToModify.ConfigurationHasChanged=false; } } else { if (ToModify.Buffer==NULL) return false; //This is the same as before --> Copying the last version, except continuity_counter (incremented) for (size_t Pos=0; Pos0x0F) ToModify.continuity_counter=0x00; ToModify.Buffer[Pos+3]&=0xF0; ToModify.Buffer[Pos+3]|=ToModify.continuity_counter; } //Managing big chunks if (BigBuffers.find(PID)!=BigBuffers.end()) BigBuffers.erase(BigBuffers.find(PID)); Writer.Write(ToModify.Buffer, ToModify.Size); return false; } //Test if we have enough data if (FromTS.End>FromTS.Size-4) { //Waiting for more data if (BigBuffers[PID].Buffer==NULL) { //Saving the data (not done at the beginning) BigBuffers[PID].Buffer_Size=FromTS.Size; BigBuffers[PID].Buffer_Size_Max=FromTS.End+188; BigBuffers[PID].Buffer=new int8u[BigBuffers[PID].Buffer_Size_Max]; std::memcpy(BigBuffers[PID].Buffer, ToAdd, ToAdd_Size); } return false; } //Verifying CRC int32u CRC_32=0xFFFFFFFF; for (int32u CRC_32_Offset=(int32u)FromTS.Begin; CRC_32_Offset>24)^(FromTS.Buffer[CRC_32_Offset])]; if (CRC_32) return false; //Problem //Copying if (ToModify.Buffer!=NULL && ToModify.Size &ToModify_) { buffer &ToModify=ToModify_[StreamID]; ToModify.End=ToModify.Offset; if (ToModify.End+4>ToModify.Size) return; //There was an error somewhere! //section_length int8u ToReplace=CC1(ToModify.Buffer+ToModify.Begin+1)&0xF0; //before section_length int16u section_length=(int16u)(ToModify.End-ToModify.Begin+1); //+4 for CRC, -3 for header size ToReplace|=section_length>>8; ToModify.Buffer[ToModify.Begin+1+0]=ToReplace; ToModify.Buffer[ToModify.Begin+1+1]=(int8u)(section_length&0xFF); //CRC32 int32u CRC_32=0xFFFFFFFF; for (size_t Buffer_CRC_Pos=ToModify.Begin; Buffer_CRC_Pos>24)^(ToModify.Buffer[Buffer_CRC_Pos])]; ToModify.Buffer[ToModify.Offset+0]=(CRC_32>>24)&0xFF; ToModify.Buffer[ToModify.Offset+1]=(CRC_32>>16)&0xFF; ToModify.Buffer[ToModify.Offset+2]=(CRC_32>> 8)&0xFF; ToModify.Buffer[ToModify.Offset+3]= CRC_32 &0xFF; //Managing big chunks for (size_t Pos=188; Pos0x0F) ToModify.continuity_counter=0x00; ToModify.Buffer[Pos+3]&=0xF0; ToModify.Buffer[Pos+3]|=ToModify.continuity_counter; } while (ToModify.Size-(ToModify.Offset+4)>188) ToModify.Size-=188; //Padding for (size_t Buffer_CRC_Pos=ToModify.End+4; Buffer_CRC_Pos //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File__Duplicate_MpegTs //*************************************************************************** class File__Duplicate_MpegTs : public File__Duplicate__Base { public : //Constructor/Destructor File__Duplicate_MpegTs(const Ztring &Target); //Set bool Configure (const Ztring &Value, bool ToRemove); //Write bool Write (int16u PID, const int8u* ToAdd=NULL, size_t ToAdd_Size=0); //Output buffer size_t Output_Buffer_Get (unsigned char** Output_Buffer=NULL); //private : File__Duplicate__Writer Writer; //Configuration std::set Wanted_program_numbers; std::set Wanted_program_map_PIDs; std::set Wanted_elementary_PIDs; std::set Remove_program_numbers; std::set Remove_program_map_PIDs; std::set Remove_elementary_PIDs; //Current std::vector program_map_PIDs; std::vector elementary_PIDs; std::vector elementary_PIDs_program_map_PIDs; struct buffer { int8u* Buffer; size_t Offset; size_t Begin; //After pointer_field size_t End; //Before CRC size_t Size; int8u continuity_counter; int8u version_number; int8u FromTS_version_number_Last; bool ConfigurationHasChanged; buffer() { Buffer=NULL; Offset=0; Begin=0; End=0; Size=0; continuity_counter=0xFF; version_number=0xFF; FromTS_version_number_Last=0xFF; ConfigurationHasChanged=true; } ~buffer() { delete[] Buffer; //Buffer=NULL; } }; struct buffer_const { const int8u* Buffer; size_t Offset; size_t Begin; //After pointer_field size_t End; //Before CRC size_t Size; buffer_const() { Buffer=NULL; Offset=0; Begin=0; End=0; Size=0; } }; struct buffer_big { int8u* Buffer; size_t Buffer_Size; size_t Buffer_Size_Max; buffer_big() { Buffer=NULL; Buffer_Size=0; Buffer_Size_Max=0; } ~buffer_big() { delete[] Buffer; //Buffer=NULL; } }; //Data bool Manage_PAT(const int8u* ToAdd, size_t ToAdd_Size); bool Manage_PMT(const int8u* ToAdd, size_t ToAdd_Size); //Buffers buffer_const FromTS; std::map PAT; std::map PMT; std::map BigBuffers; //key is pid //Helpers bool Parsing_Begin(const int8u* ToAdd, size_t ToAdd_Size, std::map &ToModify); void Parsing_End(std::map &ToModify); //Temp int16u StreamID; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Duplicate/File__Duplicate__Base.cpp100777 0 0 2554 12226004261 20272 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Duplication helper for some specific formats // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Duplicate/File__Duplicate__Base.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** File__Duplicate__Base::File__Duplicate__Base () { } } //NameSpace MediaInfoLib/Source/MediaInfo/Duplicate/File__Duplicate__Base.h100777 0 0 2024 12226004261 17727 0/* 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. */ //--------------------------------------------------------------------------- #ifndef File__Duplicate__BaseH #define File__Duplicate__BaseH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File__Duplicate__Base //*************************************************************************** class File__Duplicate__Base { public : //Constructor/Destructor File__Duplicate__Base(); //~File__Duplicate__Base(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Duplicate/File__Duplicate__Writer.cpp100777 0 0 12302 12226004261 20704 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Duplication helper for some specific formats // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Duplicate/File__Duplicate__Writer.h" #include "MediaInfo/MediaInfo_Config.h" #include "ZenLib/ZtringList.h" #include "ZenLib/File.h" #include using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File__Duplicate__Writer::File__Duplicate__Writer () { //Out Output_Buffer_Configured=false; //Buffer Method=method_none; Buffer=NULL; Buffer_Size=0; Buffer_Size_Max=0; File_Pointer=NULL; Registered_Count=0; //Count of registerd streams } //--------------------------------------------------------------------------- File__Duplicate__Writer::~File__Duplicate__Writer () { //Buffer delete (File*)File_Pointer; //File_Pointer=NULL } //*************************************************************************** // Configure //*************************************************************************** //--------------------------------------------------------------------------- void File__Duplicate__Writer::Configure (const Ztring &Target) { //Form: "memory://pointer:size" <--Memory block is specified by user //WARNING: pointer must be in ***DECIMAL*** format. //Example: "memory://123456789:1316" if (Target.find(__T("memory://"))==0 && Target.find(__T(":"), 9)!=std::string::npos) { size_t SemiColumn_Pos=Target.find(__T(":"), 9); Ztring Address=Target.substr(9, SemiColumn_Pos-9); Ztring Size=Target.substr(SemiColumn_Pos+1); Method=method_buffer; Buffer=(int8u*)Address.To_int64u(); Buffer_Size_Max=(size_t)Size.To_int64u(); } //Form: "file://filename" or <--the exported filename is specified by user else if (Target.find(__T("file://"))==0) { Method=method_filename; File_Name=Target.substr(7, std::string::npos); } } //*************************************************************************** // Write //*************************************************************************** void File__Duplicate__Writer::Write (const int8u* ToAdd, size_t ToAdd_Size) { //Integrity if (ToAdd==NULL || ToAdd_Size==0) return; //Writing switch (Method) { //File based case method_filename : //Open the file if not yet done if (File_Pointer==NULL) { File_Pointer=new File; ((File*)File_Pointer)->Open(File_Name, File::Access_Write_Append); } //Write to the file ((File*)File_Pointer)->Write(ToAdd, ToAdd_Size); break; //Memory based case method_buffer : //Testing if enough place if (Buffer_Size+ToAdd_Size>Buffer_Size_Max) { Buffer_Size=0; //Buffer underrun, cleaning the buffer if (ToAdd_Size>Buffer_Size_Max) ToAdd_Size=0; //Buffer is too small, writing nothing } //Copying buffer std::memcpy(Buffer+Buffer_Size, ToAdd, ToAdd_Size); Buffer_Size+=ToAdd_Size; break; default : ; } } //*************************************************************************** // Output_Buffer //*************************************************************************** //--------------------------------------------------------------------------- size_t File__Duplicate__Writer::Output_Buffer_Get () { size_t Output_Buffer_Size=Buffer_Size; Buffer_Size=0; //Can be erased later... return Output_Buffer_Size; } //--------------------------------------------------------------------------- size_t File__Duplicate__Writer::Output_Buffer_Get (unsigned char** Output_Buffer) { if (Output_Buffer) *Output_Buffer=Buffer; size_t Output_Buffer_Size=Buffer_Size; Buffer_Size=0; //Can be erased later... return Output_Buffer_Size; } } //NameSpace MediaInfoLib/Source/MediaInfo/Duplicate/File__Duplicate__Writer.h100777 0 0 3256 12226004261 20341 0/* 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. */ //--------------------------------------------------------------------------- #ifndef File__Duplicate__WriterH #define File__Duplicate__WriterH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File__Duplicate__Writer //*************************************************************************** class File__Duplicate__Writer { public : //Constructor/Destructor File__Duplicate__Writer(); ~File__Duplicate__Writer(); //Out bool Output_Buffer_Configured; //Configure void Configure (const Ztring &Target); void UnRegister(); // //Write void Write (const int8u* ToAdd, size_t ToAdd_Size); //Output buffer size_t Output_Buffer_Get (); size_t Output_Buffer_Get (unsigned char** Output_Buffer); private : //Buffer enum method { method_none, method_buffer, method_filename, }; method Method; int8u* Buffer; size_t Buffer_Size; size_t Buffer_Size_Max; Ztring File_Name; void* File_Pointer; //ZenLib::File* public : size_t Registered_Count; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Export/ 40777 0 0 0 12262743712 12741 5MediaInfoLib/Source/MediaInfo/Export/Export_EbuCore.cpp100777 0 0 143461 12262743712 16503 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Export/Export_EbuCore.h" #include "MediaInfo/File__Analyse_Automatic.h" #include using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- extern MediaInfo_Config Config; //--------------------------------------------------------------------------- //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- int32u EbuCore_VideoCompressionCodeCS_termID(MediaInfo_Internal &MI, size_t StreamPos) { const Ztring &Format=MI.Get(Stream_Video, StreamPos, Video_Format); const Ztring &Version=MI.Get(Stream_Video, StreamPos, Video_Format_Version); const Ztring &Profile=MI.Get(Stream_Video, StreamPos, Video_Format_Profile); if (Format==__T("MPEG Video")) { if (Version.find(__T("1"))!=string::npos) return 10000; if (Version.find(__T("2"))!=string::npos) { if (Profile.find(__T("Simple@"))!=string::npos) { if (Profile.find(__T("Main"))!=string::npos) return 20101; return 20100; } if (Profile.find(__T("Main@"))!=string::npos) { if (Profile.find(__T("Low"))!=string::npos) return 20201; if (Profile.find(__T("@Main"))!=string::npos) return 20202; if (Profile.find(__T("High 1440"))!=string::npos) return 20203; if (Profile.find(__T("High"))!=string::npos) return 20204; return 20200; } if (Profile.find(__T("SNR Scalable@"))!=string::npos) { if (Profile.find(__T("Low"))!=string::npos) return 20301; if (Profile.find(__T("Main"))!=string::npos) return 20302; return 20300; } if (Profile.find(__T("Spatial Sclable@"))!=string::npos) { if (Profile.find(__T("Main"))!=string::npos) return 20401; if (Profile.find(__T("High 1440"))!=string::npos) return 20402; if (Profile.find(__T("High"))!=string::npos) return 20403; return 20400; } if (Profile.find(__T("High@"))!=string::npos) { if (Profile.find(__T("Main"))!=string::npos) return 20501; if (Profile.find(__T("High 1440"))!=string::npos) return 20502; if (Profile.find(__T("High"))!=string::npos) return 20503; return 20500; } if (Profile.find(__T("Multi-view@"))!=string::npos) { if (Profile.find(__T("Main"))!=string::npos) return 20601; return 20600; } if (Profile.find(__T("4:2:2@"))!=string::npos) { if (Profile.find(__T("Main"))!=string::npos) return 20701; return 20700; } return 20000; } } if (Format==__T("MPEG-4 Visual")) { if (Profile.find(__T("Simple@"))==0) { if (Profile.find(__T("L0"))!=string::npos) return 30101; if (Profile.find(__T("L1"))!=string::npos) return 30102; if (Profile.find(__T("L2"))!=string::npos) return 30103; if (Profile.find(__T("L3"))!=string::npos) return 30104; if (Profile.find(__T("L4"))!=string::npos) return 30105; if (Profile.find(__T("L5"))!=string::npos) return 30106; return 30100; } if (Profile.find(__T("Simple Scalable@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 30201; if (Profile.find(__T("L2"))!=string::npos) return 30202; if (Profile.find(__T("L3"))!=string::npos) return 30203; return 30200; } if (Profile.find(__T("Advanced Simple@"))==0) { if (Profile.find(__T("L0"))!=string::npos) return 30301; if (Profile.find(__T("L1"))!=string::npos) return 30302; if (Profile.find(__T("L2"))!=string::npos) return 30303; if (Profile.find(__T("L3"))!=string::npos) return 30304; if (Profile.find(__T("L4"))!=string::npos) return 30305; if (Profile.find(__T("L5"))!=string::npos) return 30306; return 30100; } if (Profile.find(__T("Core@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 30401; if (Profile.find(__T("L2"))!=string::npos) return 30402; return 30400; } if (Profile.find(__T("Core Scalable@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 30501; if (Profile.find(__T("L2"))!=string::npos) return 30502; if (Profile.find(__T("L3"))!=string::npos) return 30503; return 30500; } if (Profile.find(__T("Advanced Core@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 30601; if (Profile.find(__T("L2"))!=string::npos) return 30602; return 30600; } if (Profile.find(__T("Main@"))==0) { if (Profile.find(__T("L2"))!=string::npos) return 30701; if (Profile.find(__T("L3"))!=string::npos) return 30702; if (Profile.find(__T("L4"))!=string::npos) return 30703; return 30700; } if (Profile.find(__T("N-bit@"))==0) { if (Profile.find(__T("L2"))!=string::npos) return 30801; return 30800; } if (Profile.find(__T("Advanced Real Time Simple@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 30901; if (Profile.find(__T("L2"))!=string::npos) return 30902; if (Profile.find(__T("L3"))!=string::npos) return 30903; if (Profile.find(__T("L4"))!=string::npos) return 30904; return 30900; } if (Profile.find(__T("Advanced Coding Efficiency@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31001; if (Profile.find(__T("L2"))!=string::npos) return 31002; if (Profile.find(__T("L3"))!=string::npos) return 31003; if (Profile.find(__T("L4"))!=string::npos) return 31004; return 31000; } if (Profile.find(__T("Simple Studio@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31101; if (Profile.find(__T("L2"))!=string::npos) return 31102; if (Profile.find(__T("L3"))!=string::npos) return 31103; if (Profile.find(__T("L4"))!=string::npos) return 31104; return 31100; } if (Profile.find(__T("Core Studio@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31201; if (Profile.find(__T("L2"))!=string::npos) return 31202; if (Profile.find(__T("L3"))!=string::npos) return 31203; if (Profile.find(__T("L4"))!=string::npos) return 31204; return 31200; } if (Profile.find(__T("Fine Granularity Scalable@"))==0) { if (Profile.find(__T("L0"))!=string::npos) return 31301; if (Profile.find(__T("L1"))!=string::npos) return 31302; if (Profile.find(__T("L2"))!=string::npos) return 31303; if (Profile.find(__T("L3"))!=string::npos) return 31304; if (Profile.find(__T("L4"))!=string::npos) return 31305; if (Profile.find(__T("L5"))!=string::npos) return 31306; return 31300; } if (Profile.find(__T("Simple Face Animation@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31401; if (Profile.find(__T("L2"))!=string::npos) return 31402; return 31400; } if (Profile.find(__T("Simple FBA@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31501; if (Profile.find(__T("L2"))!=string::npos) return 31502; return 31500; } if (Profile.find(__T("Basic Animated Texture@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31601; if (Profile.find(__T("L2"))!=string::npos) return 31602; return 31600; } if (Profile.find(__T("Scalable Texture@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31701; return 31700; } if (Profile.find(__T("Advanced Scalable Texture@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31801; if (Profile.find(__T("L2"))!=string::npos) return 31802; if (Profile.find(__T("L3"))!=string::npos) return 31803; return 31800; } if (Profile.find(__T("Hybrid@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31901; if (Profile.find(__T("L2"))!=string::npos) return 31902; return 31900; } return 30000; } if (Format==__T("JPEG")) return 50000; if (Format==__T("JPEG 2000")) { const Ztring &CodecID=MI.Get(Stream_Video, StreamPos, Video_CodecID); if (CodecID==__T("mjp2")) return 60100; if (CodecID==__T("mjs2")) return 60200; return 60000; } if (Format==__T("H.261")) return 70000; if (Format==__T("H.263")) return 80000; return 0; } Ztring EbuCore_VideoCompressionCodeCS_Name(int32u termID, MediaInfo_Internal &MI, size_t StreamPos) //xxyyzz: xx=main number, yy=sub-number, zz=sub-sub-number { switch (termID/10000) { case 1 : return __T("MPEG-1 Video"); case 2 : switch ((termID%10000)/100) { case 1 : switch (termID%100) { case 1 : return __T("MPEG-2 Video Simple Profile @ Main Level"); default: return __T("MPEG-2 Video Simple Profile"); } case 2 : switch (termID%100) { case 1 : return __T("MPEG-2 Video Main Profile @ Low Level"); case 2 : return __T("MPEG-2 Video Main Profile @ Main Level"); case 3 : return __T("MPEG-2 Video Main Profile @ High 1440 Level"); case 4 : return __T("MPEG-2 Video Main Profile @ High Level"); default: return __T("MPEG-2 Video Main Profile"); } case 3 : switch (termID%100) { case 1 : return __T("MPEG-2 Video SNR Scalable Profile @ Low Level"); case 2 : return __T("MPEG-2 Video SNR Scalable Profile @ Main Level"); default: return __T("MPEG-2 Video SNR Scalable Profile"); } case 4 : switch (termID%100) { case 1 : return __T("MPEG-2 Video Spatial Scalable Profile @ Main Level"); case 2 : return __T("MPEG-2 Video Spatial Scalable Profile @ High 1440 Level"); case 3 : return __T("MPEG-2 Video Spatial Scalable Profile @ High Level"); default: return __T("MPEG-2 Video Spatial Scalable Profile"); } case 5 : switch (termID%100) { case 1 : return __T("MPEG-2 Video High Profile @ Main Level"); case 2 : return __T("MPEG-2 Video High Profile @ High 1440 Level"); case 3 : return __T("MPEG-2 Video High Profile @ High Level"); default: return __T("MPEG-2 Video High Profile"); } case 6 : switch (termID%100) { case 1 : return __T("MPEG-2 Video Multiview Profile @ Main Level"); default: return __T("MPEG-2 Video Multiview Profile"); } case 7 : switch (termID%100) { case 1 : return __T("MPEG-2 Video 4:2:2 Profile @ Main Level"); default: return __T("MPEG-2 Video 4:2:2 Profile"); } default: return __T("MPEG-2 Video"); } case 3 : switch ((termID%10000)/100) { case 1 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Simple Profile @ Level 0"); case 2 : return __T("MPEG-4 Visual Simple Profile @ Level 1"); case 3 : return __T("MPEG-4 Visual Simple Profile @ Level 2"); case 4 : return __T("MPEG-4 Visual Simple Profile @ Level 3"); default: return __T("MPEG-4 Visual Simple Profile"); } case 2 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Simple Scalable Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Simple Scalable Profile @ Level 2"); default: return __T("MPEG-4 Visual Simple Scalable Profile"); } case 3 : switch (termID%100) { case 1 : return __T("MPEG-4 Advanced Visual Simple Profile @ Level 0"); case 2 : return __T("MPEG-4 Advanced Visual Simple Profile @ Level 1"); case 3 : return __T("MPEG-4 Advanced Visual Simple Profile @ Level 2"); case 4 : return __T("MPEG-4 Advanced Visual Simple Profile @ Level 3"); case 5 : return __T("MPEG-4 Advanced Visual Simple Profile @ Level 4"); case 6 : return __T("MPEG-4 Advanced Visual Simple Profile @ Level 5"); default: return __T("MPEG-4 Advanced Visual Simple Profile"); } case 4 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Core Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Core Profile @ Level 2"); default: return __T("MPEG-4 Visual Core Profile"); } case 5 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Core-Scalable Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Core-Scalable Profile @ Level 2"); case 3 : return __T("MPEG-4 Visual Core-Scalable Profile @ Level 3"); default: return __T("MPEG-4 Visual Core-Scalable Profile"); } case 6 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual AdvancedCore Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual AdvancedCore Profile @ Level 2"); default: return __T("MPEG-4 Visual AdvancedCore Profile"); } case 7 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Main Profile @ Level 2"); case 2 : return __T("MPEG-4 Visual Main Profile @ Level 3"); case 3 : return __T("MPEG-4 Visual Main Profile @ Level 4"); default: return __T("MPEG-4 Visual Main Profile"); } case 8 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual N-bit Profile @ Level 2"); default: return __T("MPEG-4 Visual Main Profile"); } case 9 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Advanced Real Time Simple Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Advanced Real Time Simple Profile @ Level 2"); case 3 : return __T("MPEG-4 Visual Advanced Real Time Simple Profile @ Level 3"); case 4 : return __T("MPEG-4 Visual Advanced Real Time Simple Profile @ Level 4"); default: return __T("MPEG-4 Visual Advanced Real Time Simple Profile"); } case 10 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Advanced Coding Efficiency Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Advanced Coding Efficiency Profile @ Level 2"); case 3 : return __T("MPEG-4 Visual Advanced Coding Efficiency Profile @ Level 3"); case 4 : return __T("MPEG-4 Visual Advanced Coding Efficiency Profile @ Level 4"); default: return __T("MPEG-4 Visual Advanced Coding Efficiency Profile"); } case 11 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Simple Studio Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Simple Studio Profile @ Level 2"); case 3 : return __T("MPEG-4 Visual Simple Studio Profile @ Level 3"); case 4 : return __T("MPEG-4 Visual Simple Studio Profile @ Level 4"); default: return __T("MPEG-4 Visual Simple Studio Profile"); } case 12 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Core Studio Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Core Studio Profile @ Level 2"); case 3 : return __T("MPEG-4 Visual Core Studio Profile @ Level 3"); case 4 : return __T("MPEG-4 Visual Core Studio Profile @ Level 4"); default: return __T("MPEG-4 Visual Core Studio Profile"); } case 13 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Fine Granularity Scalable Profile @ Level 0"); case 2 : return __T("MPEG-4 Visual Fine Granularity Scalable Profile @ Level 1"); case 3 : return __T("MPEG-4 Visual Fine Granularity Scalable Profile @ Level 2"); case 4 : return __T("MPEG-4 Visual Fine Granularity Scalable Profile @ Level 3"); case 5 : return __T("MPEG-4 Visual Fine Granularity Scalable Profile @ Level 4"); case 6 : return __T("MPEG-4 Visual Fine Granularity Scalable Profile @ Level 5"); default: return __T("MPEG-4 Visual Fine Granularity Scalable Profile"); } case 14 : switch (termID%100) { case 1 : return __T("MPEG-4 Simple Face Animation Profile @ Level 1"); case 2 : return __T("MPEG-4 Simple Face Animation Profile @ Level 2"); default: return __T("MPEG-4 Simple Face Animation Profile"); } case 15 : switch (termID%100) { case 1 : return __T("MPEG-4 Simple FBA Profile @ Level 1"); case 2 : return __T("MPEG-4 Simple FBA Profile @ Level 2"); default: return __T("MPEG-4 Simple FBA Profile"); } case 16 : switch (termID%100) { case 1 : return __T("MPEG-4 Basic Animated Texture Profile @ Level 1"); case 2 : return __T("MPEG-4 Basic Animated Texture Profile @ Level 2"); default: return __T("MPEG-4 Basic Animated Texture Profile"); } case 17 : switch (termID%100) { case 1 : return __T("MPEG-4 Advanced Scalable Texture Profile @ Level 1"); default: return __T("MPEG-4 Advanced Scalable Texture Profile"); } case 18 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Advanced Scalable Texture Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Advanced Scalable Texture Profile @ Level 2"); case 3 : return __T("MPEG-4 Visual Advanced Scalable Texture Profile @ Level 3"); default: return __T("MPEG-4 Visual Advanced Scalable Texture Profile"); } case 19 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Hybrid Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Hybrid Profile @ Level 2"); default: return __T("MPEG-4 Visual Hybrid Profile"); } default: return __T("MPEG-4 Visual"); } case 4 : return __T("JPEG"); case 5 : return __T("MJPEG"); case 6 : return __T("JPEG2000"); case 7 : return __T("H261"); case 8 : return __T("H263"); default: return MI.Get(Stream_Video, StreamPos, Video_Format); } } //--------------------------------------------------------------------------- int32u EbuCore_AudioCompressionCodeCS_termID(MediaInfo_Internal &MI, size_t StreamPos) { const Ztring &Format=MI.Get(Stream_Audio, StreamPos, Audio_Format); const Ztring &Version=MI.Get(Stream_Audio, StreamPos, Audio_Format_Version); const Ztring &Profile=MI.Get(Stream_Audio, StreamPos, Audio_Format_Profile); if (Format==__T("AC-3")) return 40200; if (Format==__T("E-AC-3")) return 40300; if (Format==__T("Dolby E")) return 40600; if (Format==__T("DTS")) return 50000; if (Format==__T("MPEG Audio")) { if (Version.find(__T("1"))!=string::npos) { if (Profile.find(__T("1"))!=string::npos) return 70100; if (Profile.find(__T("2"))!=string::npos) return 70200; if (Profile.find(__T("3"))!=string::npos) return 70300; return 70000; } if (Version.find(__T("2"))!=string::npos) { if (Profile.find(__T("1"))!=string::npos) return 90100; if (Profile.find(__T("2"))!=string::npos) return 90200; if (Profile.find(__T("3"))!=string::npos) return 90300; return 90000; } return 0; } if (Format==__T("PCM")) return 80000; return 0; } Ztring EbuCore_AudioCompressionCodeCS_Name(int32u termID, MediaInfo_Internal &MI, size_t StreamPos) //xxyyzz: xx=main number, yy=sub-number, zz=sub-sub-number { switch (termID/10000) { case 4 : switch ((termID%10000)/100) { case 2 : return __T("AC3"); case 3 : return __T("E-AC3"); case 6 : return __T("Dolby E"); default: return __T("Dolby"); } case 5 : return __T("DTS"); case 7 : switch ((termID%10000)/100) { case 1 : return __T("MPEG-1 Audio Layer I"); case 2 : return __T("MPEG-1 Audio Layer II"); case 3 : return __T("MPEG-1 Audio Layer III"); default: return __T("MPEG-1 Audio"); } case 9 : switch ((termID%10000)/100) { case 1 : return __T("MPEG-2 Audio Layer I"); case 2 : return __T("MPEG-2 Audio Layer II"); case 3 : return __T("MPEG-2 Audio Layer III"); default: return __T("MPEG-2 Audio"); } default: return MI.Get(Stream_Audio, StreamPos, Video_Format); } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- Export_EbuCore::Export_EbuCore () { } //--------------------------------------------------------------------------- Export_EbuCore::~Export_EbuCore () { } //*************************************************************************** // Input //*************************************************************************** //--------------------------------------------------------------------------- Ztring EbuCore_Transform_Video(Ztring &ToReturn, MediaInfo_Internal &MI, size_t StreamPos) { ToReturn+=__T("\t\t\t\n"); //width if (!MI.Get(Stream_Video, StreamPos, Video_Width).empty()) { Ztring Width; if (!MI.Get(Stream_Video, StreamPos, Video_Width_Original).empty()) Width=MI.Get(Stream_Video, StreamPos, Video_Width_Original); else Width=MI.Get(Stream_Video, StreamPos, Video_Width); ToReturn+=__T("\t\t\t\t")+MI.Get(Stream_Video, StreamPos, Video_Width)+__T("\n"); } //height if (!MI.Get(Stream_Video, StreamPos, Video_Height).empty()) { Ztring Height; if (!MI.Get(Stream_Video, StreamPos, Video_Height_Original).empty()) Height=MI.Get(Stream_Video, StreamPos, Video_Height_Original); else Height=MI.Get(Stream_Video, StreamPos, Video_Height); ToReturn+=__T("\t\t\t\t")+Height+__T("\n"); } //lines if (!MI.Get(Stream_Video, StreamPos, Video_Height_Original).empty()) ToReturn+=__T("\t\t\t\t")+MI.Get(Stream_Video, StreamPos, Video_Height_Original)+__T("\n"); //frameRate if (!MI.Get(Stream_Video, StreamPos, Video_FrameRate).empty()) { Ztring FrameRateString=MI.Get(Stream_Video, StreamPos, Video_FrameRate); Ztring factorNumerator, factorDenominator; if (FrameRateString==__T("23.976")) { factorNumerator=__T("24000"); factorDenominator=__T("1001"); } if (FrameRateString==__T("29.970")) { factorNumerator=__T("30000"); factorDenominator=__T("1001"); } if (FrameRateString==__T("59.940")) { factorNumerator=__T("60000"); factorDenominator=__T("1001"); } if (factorNumerator.empty()) { factorNumerator=Ztring::ToZtring(FrameRateString.To_float64()*1000, 0); factorDenominator=__T("1000"); } ToReturn+=__T("\t\t\t\t")+Ztring::ToZtring(FrameRateString.To_float64(), 0); ToReturn+=__T("\n"); } //aspectRatio if (!MI.Get(Stream_Video, StreamPos, Video_DisplayAspectRatio).empty()) { Ztring AspectRatioString=MI.Get(Stream_Video, StreamPos, Video_DisplayAspectRatio_String); size_t AspectRatioString_Pos=AspectRatioString.find(__T(':')); Ztring factorNumerator, factorDenominator; if (AspectRatioString_Pos!=(size_t)-1) { factorNumerator=AspectRatioString.substr(0, AspectRatioString_Pos); factorDenominator=AspectRatioString.substr(AspectRatioString_Pos+1); } if (factorNumerator.empty()) ToReturn+=__T("\t\t\t\t")+MI.Get(Stream_Video, StreamPos, Video_DisplayAspectRatio)+__T("\n"); else { ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t")+factorNumerator+__T("\n"); ToReturn+=__T("\t\t\t\t\t")+factorDenominator+__T("\n"); ToReturn+=__T("\t\t\t\t\n"); } } //videoEncoding //if (!MI.Get(Stream_Video, StreamPos, Video_Format_Profile).empty()) { int32u TermID=EbuCore_VideoCompressionCodeCS_termID(MI, StreamPos); Ztring typeLabel; Ztring TermID_String; if (TermID) { typeLabel=EbuCore_VideoCompressionCodeCS_Name(TermID, MI, StreamPos); TermID_String=Ztring::ToZtring(TermID/10000); if (TermID%10000) { TermID_String+=__T('.'); TermID_String+=Ztring::ToZtring((TermID%10000)/100); if (TermID%100) { TermID_String+=__T('.'); TermID_String+=Ztring::ToZtring(TermID%100); } } } else typeLabel=MI.Get(Stream_Video, StreamPos, Video_Format_Profile); ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\n"); } //codec if (!MI.Get(Stream_Video, StreamPos, Video_CodecID).empty()) { ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t")+MI.Get(Stream_Video, StreamPos, Video_CodecID)+__T("\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\n"); } //bitRate if (!MI.Get(Stream_Video, StreamPos, Video_BitRate).empty()) ToReturn+=__T("\t\t\t\t")+MI.Get(Stream_Video, StreamPos, Video_BitRate)+__T("\n"); //bitRateMax if (!MI.Get(Stream_Video, StreamPos, Video_BitRate_Maximum).empty()) ToReturn+=__T("\t\t\t\t")+MI.Get(Stream_Video, StreamPos, Video_BitRate_Maximum)+__T("\n"); //bitRateMode if (!MI.Get(Stream_Video, StreamPos, Video_BitRate_Mode).empty()) { Ztring bitRateMode=MI.Get(Stream_Video, StreamPos, Video_BitRate_Mode); if (bitRateMode==__T("CBR")) bitRateMode=__T("constant"); if (bitRateMode==__T("VBR")) bitRateMode=__T("variable"); ToReturn+=__T("\t\t\t\t")+bitRateMode+__T("\n"); } //scanningFormat if (!MI.Get(Stream_Video, StreamPos, Video_ScanType).empty()) { Ztring ScanType=MI.Get(Stream_Video, 0, Video_ScanType); ScanType.MakeLowerCase(); ToReturn+=__T("\t\t\t\t")+ScanType+__T("\n"); } //scanningOrder if (!MI.Get(Stream_Video, StreamPos, Video_ScanOrder).empty()) { Ztring ScanOrder=MI.Get(Stream_Video, 0, Video_ScanOrder); if (ScanOrder==__T("TFF")) ScanOrder=__T("top"); if (ScanOrder==__T("BFF")) ScanOrder=__T("bottom"); if (ScanOrder.find(__T("Pulldown"))!=string::npos) ScanOrder=__T("pulldown"); ToReturn+=__T("\t\t\t\t")+ScanOrder+__T("\n"); } //videoTrack if (!MI.Get(Stream_Video, StreamPos, Video_ID).empty() || !MI.Get(Stream_Video, StreamPos, Video_Title).empty()) { ToReturn+=__T("\t\t\t\t\n"); } //flag_3D if (!MI.Get(Stream_Video, StreamPos, Video_MultiView_Count).empty()) ToReturn+=__T("\t\t\t\ttrue\n"); ToReturn+=__T("\t\t\t\n"); return ToReturn; } //--------------------------------------------------------------------------- Ztring EbuCore_Transform_Audio(Ztring &ToReturn, MediaInfo_Internal &MI, size_t StreamPos) { ToReturn+=__T("\t\t\t\n"); //audioEncoding //if (!MI.Get(Stream_Audio, StreamPos, Audio_Format_Profile).empty()) { int32u TermID=EbuCore_AudioCompressionCodeCS_termID(MI, StreamPos); Ztring typeLabel; Ztring TermID_String; if (TermID) { typeLabel=EbuCore_AudioCompressionCodeCS_Name(TermID, MI, StreamPos); TermID_String=Ztring::ToZtring(TermID/10000); if (TermID%10000) { TermID_String+=__T('.'); TermID_String+=Ztring::ToZtring((TermID%10000)/100); if (TermID%100) { TermID_String+=__T('.'); TermID_String+=Ztring::ToZtring(TermID%100); } } } else typeLabel=MI.Get(Stream_Audio, StreamPos, Audio_Format_Profile); ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\n"); } //codec if (!MI.Get(Stream_Audio, StreamPos, Audio_CodecID).empty()) { ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t")+MI.Get(Stream_Audio, StreamPos, Audio_CodecID)+__T("\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\n"); } //audioTrackConfiguration //TODO if (!MI.Get(Stream_Audio, StreamPos, Audio_ChannelPositions).empty()) { Ztring ChannelPositions=MI.Get(Stream_Audio, StreamPos, Audio_ChannelPositions); ToReturn+=__T("\t\t\t\t")+ChannelPositions+__T(" (TODO: use the names from specs)\"/>\n"); } //samplingRate if (!MI.Get(Stream_Audio, StreamPos, Audio_SamplingRate).empty()) ToReturn+=__T("\t\t\t\t")+MI.Get(Stream_Audio, StreamPos, Audio_SamplingRate)+__T("\n"); //sampleSize if (!MI.Get(Stream_Audio, StreamPos, Audio_BitDepth).empty()) ToReturn+=__T("\t\t\t\t")+MI.Get(Stream_Audio, StreamPos, Audio_BitDepth)+__T("\n"); //bitRate if (!MI.Get(Stream_Audio, StreamPos, Audio_BitRate).empty()) ToReturn+=__T("\t\t\t\t")+MI.Get(Stream_Audio, StreamPos, Audio_BitRate)+__T("\n"); //bitRateMax if (!MI.Get(Stream_Audio, StreamPos, Audio_BitRate_Maximum).empty()) ToReturn+=__T("\t\t\t\t")+MI.Get(Stream_Audio, StreamPos, Audio_BitRate_Maximum)+__T("\n"); //bitRateMode if (!MI.Get(Stream_Audio, StreamPos, Audio_BitRate_Mode).empty()) { Ztring bitRateMode=MI.Get(Stream_Audio, StreamPos, Audio_BitRate_Mode); if (bitRateMode==__T("CBR")) bitRateMode=__T("constant"); if (bitRateMode==__T("VBR")) bitRateMode=__T("variable"); ToReturn+=__T("\t\t\t\t")+bitRateMode+__T("\n"); } //audioTrack if (!MI.Get(Stream_Audio, StreamPos, Audio_ID).empty() || !MI.Get(Stream_Audio, StreamPos, Audio_Title).empty() || !MI.Get(Stream_Audio, StreamPos, Audio_Language).empty()) { ToReturn+=__T("\t\t\t\t\n"); } //channels if (!MI.Get(Stream_Audio, StreamPos, Audio_Channel_s_).empty()) ToReturn+=__T("\t\t\t\t")+MI.Get(Stream_Audio, StreamPos, Audio_Channel_s_)+__T("\n"); ToReturn+=__T("\t\t\t\n"); return ToReturn; } //--------------------------------------------------------------------------- Ztring EbuCore_Transform_Text(Ztring &ToReturn, MediaInfo_Internal &MI, size_t StreamPos) { ToReturn+=__T("\t\t\t\n"); //subtitlingTrack { ToReturn+=__T("\t\t\t\t\n"); } ToReturn+=__T("\t\t\t\n"); return ToReturn; } //--------------------------------------------------------------------------- Ztring Export_EbuCore::Transform(MediaInfo_Internal &MI) { //Current date/time is ISO format time_t Seconds=time(NULL); Ztring DateTime; DateTime.Date_From_Seconds_1970((int32u)Seconds); DateTime.FindAndReplace(__T("UTC "), __T("")); DateTime.FindAndReplace(__T(" "), __T("T")); Ztring Date=DateTime.substr(0, 10); Ztring Time=DateTime.substr(11, 8); DateTime+=__T("+00:00"); Ztring ToReturn; //ebuCoreMain ToReturn+=__T("\n"); ToReturn+=__T("\n"); ToReturn+=__T(""); ToReturn+=__T(""); ToReturn+=__T("\n"); //coreMetadata ToReturn+=__T("\t\n"); //format ToReturn+=__T("\t\t\n"); //format - videoFormat for (size_t Pos=0; Pos"); if (!MI.Get(Stream_General, 0, General_ID).empty()) ToReturn+=__T(""); ToReturn+=__T("\n"); //format - dataFormat for (size_t Pos=0; Pos\n"); ToReturn+=__T("\t\t\t\tPT")+Duration+__T("\n"); ToReturn+=__T("\t\t\t\n"); } //format - fileSize if (!MI.Get(Stream_General, 0, General_FileSize).empty()) ToReturn+=__T("\t\t\t")+MI.Get(Stream_General, 0, General_FileSize)+__T("\n"); //format - fileName if (!MI.Get(Stream_General, 0, General_CompleteName).empty()) { Ztring Name=MI.Get(Stream_General, 0, General_CompleteName); Name.FindAndReplace(__T("&"), __T("&"), 0, Ztring_Recursive); Name.FindAndReplace(__T("<"), __T("<"), 0, Ztring_Recursive); Name.FindAndReplace(__T(">"), __T(">"), 0, Ztring_Recursive); Name.FindAndReplace(__T("\""), __T("""), 0, Ztring_Recursive); Name.FindAndReplace(__T("'"), __T("'"), 0, Ztring_Recursive); ToReturn+=__T("\t\t\t")+Name+__T("\n"); } //format ToReturn+=__T("\t\t\n"); //coreMetadata ToReturn+=__T("\t\n"); //ebuCoreMain ToReturn+=__T("\n"); //Carriage return ToReturn.FindAndReplace(__T("\n"), EOL, 0, Ztring_Recursive); return ToReturn; } //*************************************************************************** // //*************************************************************************** } //NameSpace MediaInfoLib/Source/MediaInfo/Export/Export_EbuCore.h100777 0 0 2033 12244640575 16100 0/* 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. */ //--------------------------------------------------------------------------- #ifndef Export_EbuCoreH #define Export_EbuCoreH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/MediaInfo_Internal.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** /// @brief Export_EbuCore //*************************************************************************** class Export_EbuCore { public : //Constructeur/Destructeur Export_EbuCore (); ~Export_EbuCore (); //Input Ztring Transform(MediaInfo_Internal &MI); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Export/Export_Mpeg7.cpp100777 0 0 222402 12226004261 16114 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Export/Export_Mpeg7.h" #include "MediaInfo/File__Analyse_Automatic.h" #include using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- extern MediaInfo_Config Config; //--------------------------------------------------------------------------- //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const Char* Mpeg7_Type(MediaInfo_Internal &MI) //TO ADAPT { if (MI.Count_Get(Stream_Image)) { if (MI.Count_Get(Stream_Video) || MI.Count_Get(Stream_Audio)) return __T("Multimedia"); else return __T("Image"); } else if (MI.Count_Get(Stream_Video)) { if (MI.Count_Get(Stream_Audio)) return __T("AudioVisual"); else return __T("Video"); } else if (MI.Count_Get(Stream_Audio)) return __T("Audio"); //Not known const Ztring &Format=MI.Get(Stream_General, 0, General_Format); if (Format==__T("AVI") || Format==__T("DV") || Format==__T("MPEG-4") || Format==__T("MPEG-PS") || Format==__T("MPEG-TS") || Format==__T("QuickTime") || Format==__T("Windows Media")) return __T("Video"); if (Format==__T("MPEG Audio") || Format==__T("Wave")) return __T("Audio"); if (Format==__T("BMP") || Format==__T("GIF") || Format==__T("JPEG") || Format==__T("JPEG 2000") || Format==__T("JPEG 2000") || Format==__T("PNG") || Format==__T("TIFF")) return __T("Image"); return __T("Multimedia"); } //--------------------------------------------------------------------------- int32u Mpeg7_ContentCS_termID(MediaInfo_Internal &MI) { if (MI.Count_Get(Stream_Image)) { if (MI.Count_Get(Stream_Video) || MI.Count_Get(Stream_Audio)) return 20000; else return 40100; } else if (MI.Count_Get(Stream_Video)) { if (MI.Count_Get(Stream_Audio)) return 20000; else return 40200; } else if (MI.Count_Get(Stream_Audio)) return 10000; //Not known const Ztring &Format=MI.Get(Stream_General, 0, General_Format); if (Format==__T("AVI") || Format==__T("DV") || Format==__T("MPEG-4") || Format==__T("MPEG-PS") || Format==__T("MPEG-TS") || Format==__T("QuickTime") || Format==__T("Windows Media")) return 40200; if (Format==__T("MPEG Audio") || Format==__T("Wave")) return 10000; if (Format==__T("BMP") || Format==__T("GIF") || Format==__T("JPEG") || Format==__T("JPEG 2000") || Format==__T("JPEG 2000") || Format==__T("PNG") || Format==__T("TIFF")) return 40100; return 500000; } Ztring Mpeg7_ContentCS_Name(int32u termID, MediaInfo_Internal &) //xxyyzz: xx=main number, yy=sub-number, zz=sub-sub-number { switch (termID/10000) { case 1 : return __T("Audio"); case 2 : return __T("Audiovisual"); case 3 : return __T("Scene"); case 4 : switch ((termID%10000)/100) { case 1 : return __T("Image"); case 2 : return __T("Video"); case 3 : return __T("Graphics"); } case 50 : return Ztring(); //Unknown default : return Ztring(); } } //--------------------------------------------------------------------------- int32u Mpeg7_FileFormatCS_termID_MediaInfo(MediaInfo_Internal &MI) { const Ztring &Format=MI.Get(Stream_General, 0, General_Format); if (Format==__T("MPEG Audio")) { if (MI.Get(Stream_Audio, 0, Audio_Format_Profile).find(__T("2"))!=string::npos) return 500000; //mp2 if (MI.Get(Stream_Audio, 0, Audio_Format_Profile).find(__T("1"))!=string::npos) return 510000; //mp1 return 0; } if (Format==__T("Wave") && MI.Get(Stream_General, 0, General_Format_Profile)==__T("RF64")) return 520000; //Wav (RF64) if (Format==__T("Wave64")) return 530000; return 0; } //--------------------------------------------------------------------------- int32u Mpeg7_FileFormatCS_termID(MediaInfo_Internal &MI) { const Ztring &Format=MI.Get(Stream_General, 0, General_Format); if (Format==__T("AVI")) return 70000; if (Format==__T("BMP")) return 110000; if (Format==__T("GIF")) return 120000; if (Format==__T("DV")) return 60000; if (Format==__T("JPEG")) return 10000; if (Format==__T("JPEG 2000") || Format==__T("JPEG 2000")) return 20000; if (Format==__T("MPEG Audio")) return (MI.Get(Stream_Audio, 0, Audio_Format_Profile).find(__T("3"))!=string::npos)?40000:0; if (Format==__T("MPEG-4")) return 50000; if (Format==__T("MPEG-PS")) return 30100; if (Format==__T("MPEG-TS")) return 30200; if (Format==__T("PNG")) return 150000; if (Format==__T("QuickTime")) return 160000; if (Format==__T("TIFF")) return 180000; if (Format==__T("Wave")) { if (!MI.Get(Stream_General, 0, General_Format_Profile).empty()) return Mpeg7_FileFormatCS_termID_MediaInfo(MI); //Out of specs else return 90000; } if (Format==__T("Windows Media")) return 190000; if (Format==__T("ZIP")) return 100000; //Out of specs return Mpeg7_FileFormatCS_termID_MediaInfo(MI); } Ztring Mpeg7_FileFormatCS_Name(int32u termID, MediaInfo_Internal &MI) //xxyyzz: xx=main number, yy=sub-number, zz=sub-sub-number { switch (termID/10000) { case 1 : return __T("jpeg"); case 2 : return __T("JPEG 2000"); case 3 : switch ((termID%10000)/100) { case 1 : return __T("mpeg-ps"); case 2 : return __T("mpeg-ts"); default: return __T("mpeg"); } case 4 : return __T("mp3"); case 5 : return __T("mp4"); case 6 : return __T("dv"); case 7 : return __T("avi"); case 8 : return __T("bdf"); case 9 : return __T("wav"); case 10 : return __T("zip"); case 11 : return __T("bmp"); case 12 : return __T("gif"); case 13 : return __T("photocd"); case 14 : return __T("ppm"); case 15 : return __T("png"); case 16 : return __T("quicktime"); case 17 : return __T("spiff"); case 18 : return __T("tiff"); case 19 : return __T("asf"); case 20 : return __T("iff"); case 21 : return __T("miff"); case 22 : return __T("pcx"); //Out of specs --> MediaInfo CS case 50 : return __T("mp1"); case 51 : return __T("mp2"); case 52 : return __T("wav-rf64"); case 53 : return __T("wave64"); default : return MI.Get(Stream_General, 0, General_Format); } } //--------------------------------------------------------------------------- int32u Mpeg7_VisualCodingFormatCS_termID(MediaInfo_Internal &MI, size_t StreamPos) { const Ztring &Format=MI.Get(Stream_Video, StreamPos, Video_Format); const Ztring &Version=MI.Get(Stream_Video, StreamPos, Video_Format_Version); const Ztring &Profile=MI.Get(Stream_Video, StreamPos, Video_Format_Profile); if (Format==__T("MPEG Video")) { if (Version.find(__T("1"))!=string::npos) return 10000; if (Version.find(__T("2"))!=string::npos) { if (Profile.find(__T("Simple@"))!=string::npos) { if (Profile.find(__T("Main"))!=string::npos) return 20101; return 20100; } if (Profile.find(__T("Main@"))!=string::npos) { if (Profile.find(__T("Low"))!=string::npos) return 20201; if (Profile.find(__T("@Main"))!=string::npos) return 20202; if (Profile.find(__T("High 1440"))!=string::npos) return 20203; if (Profile.find(__T("High"))!=string::npos) return 20204; return 20200; } if (Profile.find(__T("SNR Scalable@"))!=string::npos) { if (Profile.find(__T("Low"))!=string::npos) return 20301; if (Profile.find(__T("Main"))!=string::npos) return 20302; return 20300; } if (Profile.find(__T("Spatial Sclable@"))!=string::npos) { if (Profile.find(__T("Main"))!=string::npos) return 20401; if (Profile.find(__T("High 1440"))!=string::npos) return 20402; if (Profile.find(__T("High"))!=string::npos) return 20403; return 20400; } if (Profile.find(__T("High@"))!=string::npos) { if (Profile.find(__T("Main"))!=string::npos) return 20501; if (Profile.find(__T("High 1440"))!=string::npos) return 20502; if (Profile.find(__T("High"))!=string::npos) return 20503; return 20500; } if (Profile.find(__T("Multi-view@"))!=string::npos) { if (Profile.find(__T("Main"))!=string::npos) return 20601; return 20600; } if (Profile.find(__T("4:2:2@"))!=string::npos) { if (Profile.find(__T("Main"))!=string::npos) return 20701; return 20700; } return 20000; } } if (Format==__T("MPEG-4 Visual")) { if (Profile.find(__T("Simple@"))==0) { if (Profile.find(__T("L0"))!=string::npos) return 30101; if (Profile.find(__T("L1"))!=string::npos) return 30102; if (Profile.find(__T("L2"))!=string::npos) return 30103; if (Profile.find(__T("L3"))!=string::npos) return 30104; if (Profile.find(__T("L4"))!=string::npos) return 30105; if (Profile.find(__T("L5"))!=string::npos) return 30106; return 30100; } if (Profile.find(__T("Simple Scalable@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 30201; if (Profile.find(__T("L2"))!=string::npos) return 30202; if (Profile.find(__T("L3"))!=string::npos) return 30203; return 30200; } if (Profile.find(__T("Advanced Simple@"))==0) { if (Profile.find(__T("L0"))!=string::npos) return 30301; if (Profile.find(__T("L1"))!=string::npos) return 30302; if (Profile.find(__T("L2"))!=string::npos) return 30303; if (Profile.find(__T("L3"))!=string::npos) return 30304; if (Profile.find(__T("L4"))!=string::npos) return 30305; if (Profile.find(__T("L5"))!=string::npos) return 30306; return 30100; } if (Profile.find(__T("Core@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 30401; if (Profile.find(__T("L2"))!=string::npos) return 30402; return 30400; } if (Profile.find(__T("Core Scalable@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 30501; if (Profile.find(__T("L2"))!=string::npos) return 30502; if (Profile.find(__T("L3"))!=string::npos) return 30503; return 30500; } if (Profile.find(__T("Advanced Core@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 30601; if (Profile.find(__T("L2"))!=string::npos) return 30602; return 30600; } if (Profile.find(__T("Main@"))==0) { if (Profile.find(__T("L2"))!=string::npos) return 30701; if (Profile.find(__T("L3"))!=string::npos) return 30702; if (Profile.find(__T("L4"))!=string::npos) return 30703; return 30700; } if (Profile.find(__T("N-bit@"))==0) { if (Profile.find(__T("L2"))!=string::npos) return 30801; return 30800; } if (Profile.find(__T("Advanced Real Time Simple@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 30901; if (Profile.find(__T("L2"))!=string::npos) return 30902; if (Profile.find(__T("L3"))!=string::npos) return 30903; if (Profile.find(__T("L4"))!=string::npos) return 30904; return 30900; } if (Profile.find(__T("Advanced Coding Efficiency@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31001; if (Profile.find(__T("L2"))!=string::npos) return 31002; if (Profile.find(__T("L3"))!=string::npos) return 31003; if (Profile.find(__T("L4"))!=string::npos) return 31004; return 31000; } if (Profile.find(__T("Simple Studio@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31101; if (Profile.find(__T("L2"))!=string::npos) return 31102; if (Profile.find(__T("L3"))!=string::npos) return 31103; if (Profile.find(__T("L4"))!=string::npos) return 31104; return 31100; } if (Profile.find(__T("Core Studio@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31201; if (Profile.find(__T("L2"))!=string::npos) return 31202; if (Profile.find(__T("L3"))!=string::npos) return 31203; if (Profile.find(__T("L4"))!=string::npos) return 31204; return 31200; } if (Profile.find(__T("Fine Granularity Scalable@"))==0) { if (Profile.find(__T("L0"))!=string::npos) return 31301; if (Profile.find(__T("L1"))!=string::npos) return 31302; if (Profile.find(__T("L2"))!=string::npos) return 31303; if (Profile.find(__T("L3"))!=string::npos) return 31304; if (Profile.find(__T("L4"))!=string::npos) return 31305; if (Profile.find(__T("L5"))!=string::npos) return 31306; return 31300; } if (Profile.find(__T("Simple Face Animation@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31401; if (Profile.find(__T("L2"))!=string::npos) return 31402; return 31400; } if (Profile.find(__T("Simple FBA@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31501; if (Profile.find(__T("L2"))!=string::npos) return 31502; return 31500; } if (Profile.find(__T("Basic Animated Texture@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31601; if (Profile.find(__T("L2"))!=string::npos) return 31602; return 31600; } if (Profile.find(__T("Scalable Texture@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31701; return 31700; } if (Profile.find(__T("Advanced Scalable Texture@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31801; if (Profile.find(__T("L2"))!=string::npos) return 31802; if (Profile.find(__T("L3"))!=string::npos) return 31803; return 31800; } if (Profile.find(__T("Hybrid@"))==0) { if (Profile.find(__T("L1"))!=string::npos) return 31901; if (Profile.find(__T("L2"))!=string::npos) return 31902; return 31900; } return 30000; } if (Format==__T("JPEG")) return 50000; if (Format==__T("JPEG 2000")) { const Ztring &CodecID=MI.Get(Stream_Video, StreamPos, Video_CodecID); if (CodecID==__T("mjp2")) return 60100; if (CodecID==__T("mjs2")) return 60200; return 60000; } if (Format==__T("H.261")) return 70000; if (Format==__T("H.263")) return 80000; return 0; } Ztring Mpeg7_VisualCodingFormatCS_Name(int32u termID, MediaInfo_Internal &MI, size_t StreamPos) //xxyyzz: xx=main number, yy=sub-number, zz=sub-sub-number { switch (termID/10000) { case 1 : return __T("MPEG-1 Video"); case 2 : switch ((termID%10000)/100) { case 1 : switch (termID%100) { case 1 : return __T("MPEG-2 Video Simple Profile @ Main Level"); default: return __T("MPEG-2 Video Simple Profile"); } case 2 : switch (termID%100) { case 1 : return __T("MPEG-2 Video Main Profile @ Low Level"); case 2 : return __T("MPEG-2 Video Main Profile @ Main Level"); case 3 : return __T("MPEG-2 Video Main Profile @ High 1440 Level"); case 4 : return __T("MPEG-2 Video Main Profile @ High Level"); default: return __T("MPEG-2 Video Main Profile"); } case 3 : switch (termID%100) { case 1 : return __T("MPEG-2 Video SNR Scalable Profile @ Low Level"); case 2 : return __T("MPEG-2 Video SNR Scalable Profile @ Main Level"); default: return __T("MPEG-2 Video SNR Scalable Profile"); } case 4 : switch (termID%100) { case 1 : return __T("MPEG-2 Video Spatial Scalable Profile @ Main Level"); case 2 : return __T("MPEG-2 Video Spatial Scalable Profile @ High 1440 Level"); case 3 : return __T("MPEG-2 Video Spatial Scalable Profile @ High Level"); default: return __T("MPEG-2 Video Spatial Scalable Profile"); } case 5 : switch (termID%100) { case 1 : return __T("MPEG-2 Video High Profile @ Main Level"); case 2 : return __T("MPEG-2 Video High Profile @ High 1440 Level"); case 3 : return __T("MPEG-2 Video High Profile @ High Level"); default: return __T("MPEG-2 Video High Profile"); } case 6 : switch (termID%100) { case 1 : return __T("MPEG-2 Video Multiview Profile @ Main Level"); default: return __T("MPEG-2 Video Multiview Profile"); } case 7 : switch (termID%100) { case 1 : return __T("MPEG-2 Video 4:2:2 Profile @ Main Level"); default: return __T("MPEG-2 Video 4:2:2 Profile"); } default: return __T("MPEG-2 Video"); } case 3 : switch ((termID%10000)/100) { case 1 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Simple Profile @ Level 0"); case 2 : return __T("MPEG-4 Visual Simple Profile @ Level 1"); case 3 : return __T("MPEG-4 Visual Simple Profile @ Level 2"); case 4 : return __T("MPEG-4 Visual Simple Profile @ Level 3"); default: return __T("MPEG-4 Visual Simple Profile"); } case 2 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Simple Scalable Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Simple Scalable Profile @ Level 2"); default: return __T("MPEG-4 Visual Simple Scalable Profile"); } case 3 : switch (termID%100) { case 1 : return __T("MPEG-4 Advanced Visual Simple Profile @ Level 0"); case 2 : return __T("MPEG-4 Advanced Visual Simple Profile @ Level 1"); case 3 : return __T("MPEG-4 Advanced Visual Simple Profile @ Level 2"); case 4 : return __T("MPEG-4 Advanced Visual Simple Profile @ Level 3"); case 5 : return __T("MPEG-4 Advanced Visual Simple Profile @ Level 4"); case 6 : return __T("MPEG-4 Advanced Visual Simple Profile @ Level 5"); default: return __T("MPEG-4 Advanced Visual Simple Profile"); } case 4 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Core Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Core Profile @ Level 2"); default: return __T("MPEG-4 Visual Core Profile"); } case 5 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Core-Scalable Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Core-Scalable Profile @ Level 2"); case 3 : return __T("MPEG-4 Visual Core-Scalable Profile @ Level 3"); default: return __T("MPEG-4 Visual Core-Scalable Profile"); } case 6 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual AdvancedCore Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual AdvancedCore Profile @ Level 2"); default: return __T("MPEG-4 Visual AdvancedCore Profile"); } case 7 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Main Profile @ Level 2"); case 2 : return __T("MPEG-4 Visual Main Profile @ Level 3"); case 3 : return __T("MPEG-4 Visual Main Profile @ Level 4"); default: return __T("MPEG-4 Visual Main Profile"); } case 8 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual N-bit Profile @ Level 2"); default: return __T("MPEG-4 Visual Main Profile"); } case 9 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Advanced Real Time Simple Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Advanced Real Time Simple Profile @ Level 2"); case 3 : return __T("MPEG-4 Visual Advanced Real Time Simple Profile @ Level 3"); case 4 : return __T("MPEG-4 Visual Advanced Real Time Simple Profile @ Level 4"); default: return __T("MPEG-4 Visual Advanced Real Time Simple Profile"); } case 10 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Advanced Coding Efficiency Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Advanced Coding Efficiency Profile @ Level 2"); case 3 : return __T("MPEG-4 Visual Advanced Coding Efficiency Profile @ Level 3"); case 4 : return __T("MPEG-4 Visual Advanced Coding Efficiency Profile @ Level 4"); default: return __T("MPEG-4 Visual Advanced Coding Efficiency Profile"); } case 11 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Simple Studio Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Simple Studio Profile @ Level 2"); case 3 : return __T("MPEG-4 Visual Simple Studio Profile @ Level 3"); case 4 : return __T("MPEG-4 Visual Simple Studio Profile @ Level 4"); default: return __T("MPEG-4 Visual Simple Studio Profile"); } case 12 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Core Studio Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Core Studio Profile @ Level 2"); case 3 : return __T("MPEG-4 Visual Core Studio Profile @ Level 3"); case 4 : return __T("MPEG-4 Visual Core Studio Profile @ Level 4"); default: return __T("MPEG-4 Visual Core Studio Profile"); } case 13 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Fine Granularity Scalable Profile @ Level 0"); case 2 : return __T("MPEG-4 Visual Fine Granularity Scalable Profile @ Level 1"); case 3 : return __T("MPEG-4 Visual Fine Granularity Scalable Profile @ Level 2"); case 4 : return __T("MPEG-4 Visual Fine Granularity Scalable Profile @ Level 3"); case 5 : return __T("MPEG-4 Visual Fine Granularity Scalable Profile @ Level 4"); case 6 : return __T("MPEG-4 Visual Fine Granularity Scalable Profile @ Level 5"); default: return __T("MPEG-4 Visual Fine Granularity Scalable Profile"); } case 14 : switch (termID%100) { case 1 : return __T("MPEG-4 Simple Face Animation Profile @ Level 1"); case 2 : return __T("MPEG-4 Simple Face Animation Profile @ Level 2"); default: return __T("MPEG-4 Simple Face Animation Profile"); } case 15 : switch (termID%100) { case 1 : return __T("MPEG-4 Simple FBA Profile @ Level 1"); case 2 : return __T("MPEG-4 Simple FBA Profile @ Level 2"); default: return __T("MPEG-4 Simple FBA Profile"); } case 16 : switch (termID%100) { case 1 : return __T("MPEG-4 Basic Animated Texture Profile @ Level 1"); case 2 : return __T("MPEG-4 Basic Animated Texture Profile @ Level 2"); default: return __T("MPEG-4 Basic Animated Texture Profile"); } case 17 : switch (termID%100) { case 1 : return __T("MPEG-4 Advanced Scalable Texture Profile @ Level 1"); default: return __T("MPEG-4 Advanced Scalable Texture Profile"); } case 18 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Advanced Scalable Texture Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Advanced Scalable Texture Profile @ Level 2"); case 3 : return __T("MPEG-4 Visual Advanced Scalable Texture Profile @ Level 3"); default: return __T("MPEG-4 Visual Advanced Scalable Texture Profile"); } case 19 : switch (termID%100) { case 1 : return __T("MPEG-4 Visual Hybrid Profile @ Level 1"); case 2 : return __T("MPEG-4 Visual Hybrid Profile @ Level 2"); default: return __T("MPEG-4 Visual Hybrid Profile"); } default: return __T("MPEG-4 Visual"); } case 4 : return __T("JPEG"); case 5 : return __T("MJPEG"); case 6 : return __T("JPEG2000"); case 7 : return __T("H261"); case 8 : return __T("H263"); default: return MI.Get(Stream_Video, StreamPos, Video_Format); } } //--------------------------------------------------------------------------- Ztring Mpeg7_Visual_colorDomain(MediaInfo_Internal &MI, size_t StreamPos) { const Ztring &Colorimetry=MI.Get(Stream_Video, StreamPos, Video_Colorimetry); if (Colorimetry.find(__T("4:"))!=string::npos) return __T(" colorDomain=\"color\""); if (Colorimetry==__T("Gray")) return __T(" colorDomain=\"graylevel\""); return __T(""); } //--------------------------------------------------------------------------- int32u Mpeg7_SystemCS_termID(MediaInfo_Internal &MI, size_t StreamPos) { if (MI.Get(Stream_Video, StreamPos, Video_Standard)==__T("PAL")) return 10000; if (MI.Get(Stream_Video, StreamPos, Video_Standard)==__T("SECAM")) return 20000; if (MI.Get(Stream_Video, StreamPos, Video_Standard)==__T("NTSC")) return 30000; return 0; } Ztring Mpeg7_SystemCS_Name(int32u termID) //xxyyzz: xx=main number, yy=sub-number, zz=sub-sub-number { switch (termID/10000) { case 1 : return __T("PAL"); case 2 : return __T("SECAM"); case 3 : return __T("NTSC"); default : return Ztring(); } } //--------------------------------------------------------------------------- int32u Mpeg7_AudioCodingFormatCS_termID(MediaInfo_Internal &MI, size_t StreamPos) { const Ztring &Format=MI.Get(Stream_Audio, StreamPos, Audio_Format); const Ztring &Version=MI.Get(Stream_Audio, StreamPos, Audio_Format_Version); const Ztring &Profile=MI.Get(Stream_Audio, StreamPos, Audio_Format_Profile); if (Format==__T("AC-3")) return 10000; if (Format==__T("DTS")) return 20000; if (Format==__T("MPEG Audio")) { if (Version.find(__T("1"))!=string::npos) { if (Profile.find(__T("1"))!=string::npos) return 30100; if (Profile.find(__T("2"))!=string::npos) return 30200; if (Profile.find(__T("3"))!=string::npos) return 30300; return 30000; } if (Version.find(__T("2"))!=string::npos) { if (Profile.find(__T("1"))!=string::npos) return 40100; if (Profile.find(__T("2"))!=string::npos) return 40200; if (Profile.find(__T("3"))!=string::npos) return 40300; return 40000; } return 0; } if (Format==__T("PCM")) return 80000; return 0; } Ztring Mpeg7_AudioCodingFormatCS_Name(int32u termID, MediaInfo_Internal &MI, size_t StreamPos) //xxyyzz: xx=main number, yy=sub-number, zz=sub-sub-number { switch (termID/10000) { case 1 : return __T("AC3"); case 2 : return __T("DTS"); case 3 : switch ((termID%10000)/100) { case 1 : return __T("MPEG-1 Audio Layer I"); case 2 : return __T("MPEG-1 Audio Layer II"); case 3 : return __T("MPEG-1 Audio Layer III"); default: return __T("MPEG-1 Audio"); } case 4 : switch ((termID%10000)/100) { case 1 : switch (termID%100) { case 1 : return __T("MPEG-2 Audio Low Sampling Rate Layer I"); case 2 : return __T("MPEG-2 Audio Low Sampling Rate Layer II"); case 3 : return __T("MPEG-2 Audio Low Sampling Rate Layer III"); default: return __T("MPEG-2 Audio Low Sampling Rate"); } case 2 : switch (termID%100) { case 1 : return __T("MPEG-2 Backward Compatible Multi-Channel Layer I"); case 2 : return __T("MPEG-2 Backward Compatible Multi-Channel Layer II"); case 3 : return __T("MPEG-2 Backward Compatible Multi-Channel Layer III"); default: return __T("MPEG-2 Backward Compatible Multi-Channel"); } default: return __T("MPEG-2 Audio"); } case 8 : return __T("Linear PCM"); default: return MI.Get(Stream_Audio, StreamPos, Video_Format); } } //--------------------------------------------------------------------------- int32u Mpeg7_AudioPresentationCS_termID(MediaInfo_Internal &MI, size_t StreamPos) { const Ztring &Channels=MI.Get(Stream_Audio, StreamPos, Audio_Channel_s_); const Ztring &ChannelPositions2=MI.Get(Stream_Audio, StreamPos, Audio_ChannelPositions_String2); if (Channels==__T("6") && ChannelPositions2==__T("3/2.1")) return 50000; if (Channels==__T("8") && ChannelPositions2==__T("3/2/2.1")) return 60000; if (Channels==__T("2")) return 30000; if (Channels==__T("1")) return 20000; return 0; } Ztring Mpeg7_AudioPresentationCS_Name(int32u termID, MediaInfo_Internal &, size_t) { switch (termID/10000) { case 2 : return __T("mono"); case 3 : return __T("stereo"); case 5 : return __T("Home theater 5.1"); case 6 : return __T("Movie theater"); default: return Ztring(); } } //--------------------------------------------------------------------------- Ztring Mpeg7_AudioEmphasis(MediaInfo_Internal &MI, size_t StreamPos) { const Ztring &Emphasis=MI.Get(Stream_Audio, StreamPos, Audio_Format_Settings_Emphasis); if (Emphasis==__T("50/15ms")) return __T("50over15Microseconds"); if (Emphasis==__T("CCITT")) return __T("ccittJ17"); if (Emphasis==__T("Reserved")) return __T("reserved"); return __T("none"); } //--------------------------------------------------------------------------- Ztring Mpeg7_MediaTimePoint(MediaInfo_Internal &MI) { if (MI.Count_Get(Stream_Video)==1 && MI.Get(Stream_General, 0, General_Format)==__T("MPEG-PS")) { int64u Delay=(int64u)(MI.Get(Stream_Video, 0, Video_Delay).To_float64()*90); int64u Rate=90000; int64u DD=Delay/(24*60*60*Rate); Delay=Delay%(24*60*60*Rate); int64u HH=Delay/(60*60*Rate); Delay=Delay%(60*60*Rate); int64u MM=Delay/(60*Rate); Delay=Delay%(60*Rate); int64u Sec=Delay/Rate; Delay=Delay%Rate; Ztring ToReturn; if (DD) ToReturn+=Ztring::ToZtring(DD); ToReturn+=__T('T'); ToReturn+=(HH<10?__T("0"):__T(""))+Ztring::ToZtring(HH)+__T(':'); ToReturn+=(MM<10?__T("0"):__T(""))+Ztring::ToZtring(MM)+__T(':'); ToReturn+=(Sec<10?__T("0"):__T(""))+Ztring::ToZtring(Sec)+__T(':'); ToReturn+=Ztring::ToZtring(Delay)+__T('F'); ToReturn+=Ztring::ToZtring(Rate); return ToReturn; } //Default: In milliseconds int64u Milliseconds=MI.Get(Stream_Video, 0, Video_Delay).To_int64u(); int64u DD=Milliseconds/(24*60*60*1000); Milliseconds=Milliseconds%(24*60*60*1000); int64u HH=Milliseconds/(60*60*1000); Milliseconds=Milliseconds%(60*60*1000); int64u MM=Milliseconds/(60*1000); Milliseconds=Milliseconds%(60*1000); int64u Sec=Milliseconds/1000; int64u NN=Milliseconds%1000; int64u FF=1000; Ztring ToReturn; if (DD) ToReturn+=Ztring::ToZtring(DD); ToReturn+=__T('T'); ToReturn+=(HH<10?__T("0"):__T(""))+Ztring::ToZtring(HH)+__T(':'); ToReturn+=(MM<10?__T("0"):__T(""))+Ztring::ToZtring(MM)+__T(':'); ToReturn+=(Sec<10?__T("0"):__T(""))+Ztring::ToZtring(Sec)+__T(':'); ToReturn+=Ztring::ToZtring(NN)+__T('F'); ToReturn+=Ztring::ToZtring(FF); return ToReturn; } //--------------------------------------------------------------------------- Ztring Mpeg7_MediaDuration(MediaInfo_Internal &MI) { if (MI.Count_Get(Stream_Video)==1) { int64u FrameCount=MI.Get(Stream_Video, 0, Video_FrameCount).To_int64u(); int64u FrameRate=MI.Get(Stream_Video, 0, Video_FrameRate).To_int64u(); if (FrameRate==0) return Ztring(); int64u DD=FrameCount/(24*60*60*FrameRate); FrameCount=FrameCount%(24*60*60*FrameRate); int64u HH=FrameCount/(60*60*FrameRate); FrameCount=FrameCount%(60*60*FrameRate); int64u MM=FrameCount/(60*FrameRate); FrameCount=FrameCount%(60*FrameRate); int64u Sec=FrameCount/FrameRate; FrameCount=FrameCount%FrameRate; Ztring ToReturn; ToReturn+=__T('P'); if (DD) ToReturn+=Ztring::ToZtring(DD)+__T('D'); ToReturn+=__T('T'); ToReturn+=Ztring::ToZtring(HH)+__T('H'); ToReturn+=Ztring::ToZtring(MM)+__T('M'); ToReturn+=Ztring::ToZtring(Sec)+__T('S'); ToReturn+=Ztring::ToZtring(FrameCount)+__T('N'); ToReturn+=Ztring::ToZtring(FrameRate)+__T('F'); return ToReturn; } if (MI.Count_Get(Stream_Audio)==1) { int64u SamplingCount=MI.Get(Stream_Audio, 0, Audio_SamplingCount).To_int64u(); int64u SamplingRate=MI.Get(Stream_Audio, 0, Audio_SamplingRate).To_int64u(); if (SamplingRate==0) return Ztring(); int64u DD=SamplingCount/(24*60*60*SamplingRate); SamplingCount=SamplingCount%(24*60*60*SamplingRate); int64u HH=SamplingCount/(60*60*SamplingRate); SamplingCount=SamplingCount%(60*60*SamplingRate); int64u MM=SamplingCount/(60*SamplingRate); SamplingCount=SamplingCount%(60*SamplingRate); int64u Sec=SamplingCount/SamplingRate; SamplingCount=SamplingCount%SamplingRate; Ztring ToReturn; ToReturn+=__T('P'); if (DD) ToReturn+=Ztring::ToZtring(DD)+__T('D'); ToReturn+=__T('T'); ToReturn+=Ztring::ToZtring(HH)+__T('H'); ToReturn+=Ztring::ToZtring(MM)+__T('M'); ToReturn+=Ztring::ToZtring(Sec)+__T('S'); ToReturn+=Ztring::ToZtring(SamplingCount)+__T('N'); ToReturn+=Ztring::ToZtring(SamplingRate)+__T('F'); return ToReturn; } //Default: In milliseconds int64u Milliseconds=MI.Get(Stream_General, 0, General_Duration).To_int64u(); int64u DD=Milliseconds/(24*60*60*1000); Milliseconds=Milliseconds%(24*60*60*1000); int64u HH=Milliseconds/(60*60*1000); Milliseconds=Milliseconds%(60*60*1000); int64u MM=Milliseconds/(60*1000); Milliseconds=Milliseconds%(60*1000); int64u Sec=Milliseconds/1000; int64u NN=Milliseconds%1000; int64u FF=1000; Ztring ToReturn; ToReturn+=__T('P'); if (DD) ToReturn+=Ztring::ToZtring(DD)+__T('D'); ToReturn+=__T('T'); ToReturn+=Ztring::ToZtring(HH)+__T('H'); ToReturn+=Ztring::ToZtring(MM)+__T('M'); ToReturn+=Ztring::ToZtring(Sec)+__T('S'); ToReturn+=Ztring::ToZtring(NN)+__T('N'); ToReturn+=Ztring::ToZtring(FF)+__T('F'); return ToReturn; } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- Export_Mpeg7::Export_Mpeg7 () { } //--------------------------------------------------------------------------- Export_Mpeg7::~Export_Mpeg7 () { } //*************************************************************************** // Input //*************************************************************************** //--------------------------------------------------------------------------- Ztring Mpeg7_Transform_Visual(Ztring &ToReturn, MediaInfo_Internal &MI, size_t StreamPos) { ToReturn+=__T("\t\t\t\t\t\t\t\n"); //Format ToReturn+=__T("\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t"); ToReturn+=Mpeg7_VisualCodingFormatCS_Name((VisualCodingFormatCS_termID/10000)*10000, MI, StreamPos); ToReturn+=__T("\n"); if (VisualCodingFormatCS_termID%10000) { ToReturn+=__T("\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t"); ToReturn+=Mpeg7_VisualCodingFormatCS_Name((VisualCodingFormatCS_termID/100)*100, MI, StreamPos); ToReturn+=__T("\n"); if (VisualCodingFormatCS_termID%100) { ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\t"); ToReturn+=Mpeg7_VisualCodingFormatCS_Name(VisualCodingFormatCS_termID, MI, StreamPos); ToReturn+=__T("\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); } ToReturn+=__T("\t\t\t\t\t\t\t\t\t\n"); } ToReturn+=__T("\t\t\t\t\t\t\t\t\n"); //Pixel if (!MI.Get(Stream_Video, 0, Video_PixelAspectRatio).empty() || !MI.Get(Stream_Video, 0, Video_Resolution).empty()) { ToReturn+=__T("\t\t\t\t\t\t\t\t\n"); } //Frame ToReturn+=__T("\t\t\t\t\t\t\t\t\n"); //Colorimetry if (MI.Get(Stream_Video, StreamPos, Video_Colorimetry).find(__T("4:2:0"))!=string::npos) { ToReturn+=__T("\t\t\t\t\t\t\t\t \n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\tLuminance\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\tChrominanceBlueDifference\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\tChrominanceRedDifference\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\tLuminance\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\tChrominanceBlueDifference\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\tChrominanceRedDifference\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\n"); } ToReturn+=__T("\t\t\t\t\t\t\t\n"); return ToReturn; } //--------------------------------------------------------------------------- Ztring Mpeg7_Transform_Audio(Ztring &ToReturn, MediaInfo_Internal &MI, size_t StreamPos) { ToReturn+=__T("\t\t\t\t\t\t\t\n"); //Format ToReturn+=__T("\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t"); ToReturn+=Mpeg7_AudioCodingFormatCS_Name((AudioCodingFormatCS_termID/10000)*10000, MI, StreamPos); ToReturn+=__T("\n"); if (AudioCodingFormatCS_termID%10000) { ToReturn+=__T("\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t"); ToReturn+=Mpeg7_AudioCodingFormatCS_Name((AudioCodingFormatCS_termID/100)*100, MI, StreamPos); ToReturn+=__T("\n"); if (AudioCodingFormatCS_termID%100) { ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\t"); ToReturn+=Mpeg7_AudioCodingFormatCS_Name(AudioCodingFormatCS_termID, MI, StreamPos); ToReturn+=__T("\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); } ToReturn+=__T("\t\t\t\t\t\t\t\t\t\n"); } ToReturn+=__T("\t\t\t\t\t\t\t\t\n"); //AudioChannels ToReturn+=__T("\t\t\t\t\t\t\t\t"); ToReturn+=MI.Get(Stream_Audio, StreamPos, Audio_Channel_s_); ToReturn+=__T("\n"); //Sample ToReturn+=__T("\t\t\t\t\t\t\t\t\n"); //Emphasis if (MI.Get(Stream_Audio, StreamPos, Audio_Format)==__T("MPEG Audio")) ToReturn+=__T("\t\t\t\t\t\t\t\t")+Mpeg7_AudioEmphasis(MI, StreamPos)+__T("\n"); //Presentation int32u AudioPresentationCS_termID=Mpeg7_AudioPresentationCS_termID(MI, StreamPos); if (AudioPresentationCS_termID) { ToReturn+=__T("\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t")+Mpeg7_AudioPresentationCS_Name(AudioPresentationCS_termID, MI, StreamPos)+__T("\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\n"); } ToReturn+=__T("\t\t\t\t\t\t\t\n"); return ToReturn; } //--------------------------------------------------------------------------- Ztring Export_Mpeg7::Transform(MediaInfo_Internal &MI) { //Current date/time is ISO format time_t Time=time(NULL); Ztring TimeS; TimeS.Date_From_Seconds_1970((int32u)Time); TimeS.FindAndReplace(__T("UTC "), __T("")); TimeS.FindAndReplace(__T(" "), __T("T")); TimeS+=__T("+00:00"); Ztring ToReturn; //Mpeg7 ToReturn+=__T("\n"); ToReturn+=__T("\n"); ToReturn+=__T("\n"); //Description - DescriptionMetadata { ToReturn+=__T("\t\n"); Ztring FileName=MI.Get(Stream_General, 0, General_FileName); Ztring Extension=MI.Get(Stream_General, 0, General_FileExtension); if (!Extension.empty()) FileName+=__T('.')+Extension; if (!FileName.empty()) ToReturn+=__T("\t\t")+FileName+__T("\n"); ToReturn+=__T("\t\t")+TimeS+__T("\n"); ToReturn+=__T("\t\t\n"); ToReturn+=__T("\t\t\t\n"); ToReturn+=__T("\t\t\t\t")+MediaInfoLib::Config.Info_Version_Get()+__T("\n"); ToReturn+=__T("\t\t\t\n"); ToReturn+=__T("\t\t\n"); ToReturn+=__T("\t\n"); } //Description - CreationDescription if (!MI.Get(Stream_General, 0, General_Movie).empty() || !MI.Get(Stream_General, 0, General_Track).empty() || !MI.Get(Stream_General, 0, General_Album).empty() || !MI.Get(Stream_General, 0, General_Encoded_Library).empty() || !MI.Get(Stream_General, 0, General_Performer).empty()) { ToReturn+=__T("\t\n"); ToReturn+=__T("\t\t\n"); ToReturn+=__T("\t\t\t\n"); if (!MI.Get(Stream_General, 0, General_Movie).empty()) ToReturn+=__T("\t\t\t\t")+MI.Get(Stream_General, 0, General_Movie)+__T("\n"); if (!MI.Get(Stream_General, 0, General_Track).empty()) ToReturn+=__T("\t\t\t\t")+MI.Get(Stream_General, 0, General_Title)+__T("\n"); if (!MI.Get(Stream_General, 0, General_Album).empty()) ToReturn+=__T("\t\t\t\t")+MI.Get(Stream_General, 0, General_Album)+__T("\n"); if (!MI.Get(Stream_General, 0, General_WrittenBy).empty()) { ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t")+MI.Get(Stream_General, 0, General_WrittenBy)+__T("\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\n"); } if (!MI.Get(Stream_General, 0, General_Performer).empty()) { ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t")+MI.Get(Stream_General, 0, General_Performer)+__T("\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\n"); } if (!MI.Get(Stream_General, 0, General_ExecutiveProducer).empty()) { ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t")+MI.Get(Stream_General, 0, General_ExecutiveProducer)+__T("\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\n"); } if (!MI.Get(Stream_General, 0, General_Producer).empty()) { ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t")+MI.Get(Stream_General, 0, General_Producer)+__T("\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\n"); } if (!MI.Get(Stream_General, 0, General_Director).empty()) { ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t")+MI.Get(Stream_General, 0, General_Director)+__T("\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\n"); } if (!MI.Get(Stream_General, 0, General_Composer).empty()) { ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t")+MI.Get(Stream_General, 0, General_Composer)+__T("\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\n"); } if (!MI.Get(Stream_General, 0, General_CostumeDesigner).empty()) { ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t")+MI.Get(Stream_General, 0, General_CostumeDesigner)+__T("\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\n"); } if (!MI.Get(Stream_General, 0, General_ProductionDesigner).empty()) { ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t")+MI.Get(Stream_General, 0, General_ProductionDesigner)+__T("\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\n"); } if (!MI.Get(Stream_General, 0, General_Publisher).empty()) { ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t")+MI.Get(Stream_General, 0, General_Publisher)+__T("\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\n"); } if (!MI.Get(Stream_General, 0, General_DistributedBy).empty()) { ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t")+MI.Get(Stream_General, 0, General_DistributedBy)+__T("\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\n"); } if (!MI.Get(Stream_General, 0, General_Encoded_Library).empty()) { ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t")+MI.Get(Stream_General, 0, General_Encoded_Library)+__T("\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\n"); } ToReturn+=__T("\t\t\t\n"); ToReturn+=__T("\t\t\n"); ToReturn+=__T("\t\n"); } //Description - ContentEntity ToReturn+=__T("\t\n"); //MultimediaContent ToReturn+=__T("\t\t\n"); //(Type) ToReturn+=__T("\t\t\t\n"); //MediaFormat header ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\n"); //Content ToReturn+=__T("\t\t\t\t\t\t\t=500000) //Out of spec ToReturn+=__T(" href=\"urn:x-mpeg7-mediainfo:cs:ContentCS:2009:"); else ToReturn+=__T(" href=\"urn:mpeg:mpeg7:cs:ContentCS:2001:"); ToReturn+=Ztring::ToZtring(ContentCS_termID/10000); if (ContentCS_termID%10000) { ToReturn+=__T("."); ToReturn+=Ztring::ToZtring((ContentCS_termID%10000)/100); if (ContentCS_termID%100) { ToReturn+=__T("."); ToReturn+=Ztring::ToZtring(ContentCS_termID%100); } } ToReturn+=__T("\""); ToReturn+=__T(">\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t"); ToReturn+=Mpeg7_ContentCS_Name(ContentCS_termID, MI); ToReturn+=__T("\n"); ToReturn+=__T("\t\t\t\t\t\t\t\n"); //FileFormat if (!MI.Get(Stream_General, 0, General_Format).empty()) { ToReturn+=__T("\t\t\t\t\t\t\t=500000) //Out of spec ToReturn+=__T(" href=\"urn:x-mpeg7-mediainfo:cs:FileFormatCS:2009:"); else ToReturn+=__T(" href=\"urn:mpeg:mpeg7:cs:FileFormatCS:2001:"); ToReturn+=Ztring::ToZtring(FileFormatCS_termID/10000); ToReturn+=__T("\""); } ToReturn+=__T(">\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t"); ToReturn+=Mpeg7_FileFormatCS_Name((FileFormatCS_termID/10000)*10000, MI); ToReturn+=__T("\n"); if (FileFormatCS_termID%10000) { ToReturn+=__T("\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t"); ToReturn+=Mpeg7_FileFormatCS_Name((FileFormatCS_termID/100)*100, MI); ToReturn+=__T("\n"); if (FileFormatCS_termID%100) { ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\t"); ToReturn+=Mpeg7_FileFormatCS_Name(FileFormatCS_termID, MI); ToReturn+=__T("\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t\t\t\n"); } ToReturn+=__T("\t\t\t\t\t\t\t\t\t\n"); } ToReturn+=__T("\t\t\t\t\t\t\t\n"); } //FileSize ToReturn+=__T("\t\t\t\t\t\t\t"); ToReturn+=MI.Get(Stream_General, 0, General_FileSize); ToReturn+=__T("\n"); //System if (!MI.Get(Stream_Video, 0, Video_Standard).empty()) { ToReturn+=__T("\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\t"); ToReturn+=Mpeg7_SystemCS_Name(SystemCS_termID); ToReturn+=__T("\n"); ToReturn+=__T("\t\t\t\t\t\t\t\n"); } //BitRate if (!MI.Get(Stream_General, 0, General_OverallBitRate).empty()) { ToReturn+=__T("\t\t\t\t\t\t\t"); ToReturn+=MI.Get(Stream_General, 0, General_OverallBitRate); ToReturn+=__T("\n"); } //xxxCoding for (size_t Pos=0; Pos\n"); //MediaTranscodingHints, intraFrameDistance and anchorFrameDistance if (!MI.Get(Stream_Video, 0, Video_Format_Settings_GOP).empty()) { Ztring M=MI.Get(Stream_Video, 0, Video_Format_Settings_GOP).SubString(__T("M="), __T(",")); Ztring N=MI.Get(Stream_Video, 0, Video_Format_Settings_GOP).SubString(__T("N="), __T("")); ToReturn+=__T("\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t\t\n"); } ToReturn+=__T("\t\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\n"); if (MI.Count_Get(Stream_Video)==1 || MI.Count_Get(Stream_Audio)==1) { //MediaTimePoint ToReturn+=__T("\t\t\t\t\n"); ToReturn+=__T("\t\t\t\t\t")+Mpeg7_MediaTimePoint(MI)+__T("\n"); //MediaDuration ToReturn+=__T("\t\t\t\t\t"); ToReturn+=Mpeg7_MediaDuration(MI); ToReturn+=__T("\n"); ToReturn+=__T("\t\t\t\t\n"); } //Mpeg7 footer ToReturn+=__T("\t\t\t\n"); ToReturn+=__T("\t\t\n"); ToReturn+=__T("\t\n"); ToReturn+=__T("\n"); //Carriage return ToReturn.FindAndReplace(__T("\n"), EOL, 0, Ztring_Recursive); //Find and replace ZtringListList ToReplace=MediaInfoLib::Config.Inform_Replace_Get_All(); for (size_t Pos=0; Pos using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- extern MediaInfo_Config Config; //--------------------------------------------------------------------------- //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- Ztring PBCore_MediaType(MediaInfo_Internal &MI) { if (MI.Count_Get(Stream_Video)) return __T("Video"); else if (MI.Count_Get(Stream_Audio)) return __T("Sound"); else if (MI.Count_Get(Stream_Image)) return __T("Static Image"); else if (MI.Count_Get(Stream_Text)) return __T("Text"); else return Ztring(); } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- Export_PBCore::Export_PBCore () { } //--------------------------------------------------------------------------- Export_PBCore::~Export_PBCore () { } //*************************************************************************** // Input //*************************************************************************** //--------------------------------------------------------------------------- void PBCore_Transform(Ztring &ToReturn, MediaInfo_Internal &MI, stream_t StreamKind, size_t StreamPos) { //Menu: only if TimeCode if (StreamKind==Stream_Menu && MI.Get(Stream_Menu, StreamPos, Menu_Format)!=__T("TimeCode")) return; ToReturn+=__T("\t\t\n"); //essenceTrackType Ztring essenceTrackType; switch (StreamKind) { case Stream_Video: essenceTrackType=__T("Video"); break; case Stream_Audio: essenceTrackType=__T("Audio"); break; case Stream_Text: { Ztring Format=MI.Get(Stream_Text, StreamPos, Text_Format); if (Format==__T("EIA-608") || Format==__T("EIA-708")) essenceTrackType=__T("CC"); else essenceTrackType=__T("Text"); } break; case Stream_Menu: if (MI.Get(Stream_Menu, StreamPos, Menu_Format)==__T("TimeCode")) { essenceTrackType=__T("TimeCode"); break; } else return; //Not supported default: return; //Not supported } ToReturn+=__T("\t\t\t")+essenceTrackType+__T("\n"); //essenceTrackIdentifier if (!MI.Get(StreamKind, StreamPos, __T("ID")).empty()) { ToReturn+=__T("\t\t\t")+MI.Get(StreamKind, StreamPos, __T("ID"))+__T("\n"); ToReturn+=__T("\t\t\tID (Mediainfo)\n"); } else if (!MI.Get(StreamKind, StreamPos, __T("UniqueID")).empty()) { ToReturn+=__T("\t\t\t")+MI.Get(StreamKind, StreamPos, __T("UniqueID"))+__T("\n"); ToReturn+=__T("\t\t\tUniqueID (Mediainfo)\n"); } else if (!MI.Get(StreamKind, StreamPos, __T("StreamKindID")).empty()) { ToReturn+=__T("\t\t\t")+MI.Get(StreamKind, StreamPos, __T("StreamKindID"))+__T("\n"); ToReturn+=__T("\t\t\tStreamKindID (Mediainfo)\n"); } //essenceTrackStandard if (StreamKind==Stream_Video && !MI.Get(Stream_Video, StreamPos, Video_Standard).empty()) ToReturn+=__T("\t\t\t")+MI.Get(Stream_Video, StreamPos, Video_Standard)+__T("\n"); //essenceTrackEncoding if (!MI.Get(StreamKind, StreamPos, __T("Format")).empty()) { ToReturn+=__T("\t\t\t"); ToReturn+=MI.Get(StreamKind, StreamPos, __T("Format")); if (!MI.Get(StreamKind, StreamPos, __T("Format_Profile")).empty()) ToReturn+=__T(' ')+MI.Get(StreamKind, StreamPos, __T("Format_Profile")); if (!MI.Get(StreamKind, StreamPos, __T("CodecID")).empty()) ToReturn+=__T(" (")+MI.Get(StreamKind, StreamPos, __T("CodecID"))+__T(')'); ToReturn+=__T("\n"); } //essenceTrackDataRate if (!MI.Get(StreamKind, StreamPos, __T("BitRate")).empty()) { ToReturn+=__T("\t\t\t"); ToReturn+=MI.Get(StreamKind, StreamPos, __T("BitRate")); if (!MI.Get(StreamKind, StreamPos, __T("BitRate_Mode")).empty()) ToReturn+=__T(' ')+MI.Get(StreamKind, StreamPos, __T("BitRate_Mode")); ToReturn+=__T("\n"); } //essenceTrackFrameRate if (StreamKind==Stream_Video && !MI.Get(Stream_Video, StreamPos, Video_FrameRate).empty()) { ToReturn+=__T("\t\t\t"); ToReturn+=MI.Get(Stream_Video, StreamPos, Video_FrameRate); if (!MI.Get(Stream_Video, StreamPos, Video_FrameRate_Mode).empty()) ToReturn+=__T(' ')+MI.Get(Stream_Video, StreamPos, Video_FrameRate_Mode); ToReturn+=__T("\n"); } //essenceTrackSamplingRate if (StreamKind==Stream_Audio && !MI.Get(Stream_Audio, StreamPos, Audio_SamplingRate).empty()) ToReturn+=__T("\t\t\t")+MI.Get(Stream_Audio, StreamPos, Audio_SamplingRate)+__T("\n"); //essenceTrackBitDepth if (!MI.Get(StreamKind, StreamPos, __T("BitDepth")).empty()) ToReturn+=__T("\t\t\t")+MI.Get(StreamKind, StreamPos, __T("BitDepth"))+__T("\n"); //essenceTrackFrameSize if (StreamKind==Stream_Video && !MI.Get(Stream_Video, StreamPos, Video_Width).empty()) ToReturn+=__T("\t\t\t")+MI.Get(Stream_Video, StreamPos, Video_Width)+__T('x')+MI.Get(Stream_Video, StreamPos, Video_Height)+__T("\n"); //essenceTrackAspectRatio if (StreamKind==Stream_Video && !MI.Get(Stream_Video, StreamPos, Video_DisplayAspectRatio).empty()) ToReturn+=__T("\t\t\t")+MI.Get(Stream_Video, StreamPos, Video_DisplayAspectRatio)+__T("\n"); //essenceTrackDuration if (!MI.Get(StreamKind, StreamPos, __T("Duration")).empty()) ToReturn+=__T("\t\t\t")+MI.Get(StreamKind, StreamPos, __T("Duration"))+__T("\n"); //essenceTrackLanguage if (!MI.Get(StreamKind, StreamPos, __T("Language")).empty()) ToReturn+=__T("\t\t\t")+MediaInfoLib::Config.Iso639_2_Get(MI.Get(StreamKind, StreamPos, __T("Language")))+__T("\n"); //essenceTrackAnnotation - all fields (except *_String*) separated by | Ztring Temp; for (size_t Pos=0; Pos"); ToReturn+=Temp; ToReturn+=__T("\n"); } ToReturn+=__T("\t\t\n"); } //--------------------------------------------------------------------------- Ztring Export_PBCore::Transform(MediaInfo_Internal &MI) { //Current date/time is ISO format time_t Time=time(NULL); Ztring TimeS; TimeS.Date_From_Seconds_1970((int32u)Time); TimeS.FindAndReplace(__T("UTC "), __T("")); TimeS.FindAndReplace(__T(" "), __T("T")); TimeS+=__T('Z'); Ztring ToReturn; ToReturn+=__T("\n"); ToReturn+=__T("\n"); ToReturn+=__T("\t\n"); ToReturn+=__T("\t\n"); ToReturn+=__T("\t\n"); ToReturn+=__T("\t\t***\n"); ToReturn+=__T("\t\t***\n"); ToReturn+=__T("\t\n"); ToReturn+=__T("\t\n"); ToReturn+=__T("\t\t***\n"); ToReturn+=__T("\t\n"); ToReturn+=__T("\t\n"); ToReturn+=__T("\t\t***\n"); ToReturn+=__T("\t\t***\n"); ToReturn+=__T("\t\n"); ToReturn+=__T("\t\n"); //pbcoreFormatID ToReturn+=__T("\t\t\n"); //formatIdentifier ToReturn+=__T("\t\t\t")+MI.Get(Stream_General, 0, General_FileName)+__T("\n"); //formatIdentifierSource ToReturn+=__T("\t\t\tFile Name\n"); ToReturn+=__T("\t\t\n"); //formatDigital if (!MI.Get(Stream_General, 0, General_InternetMediaType).empty()) { ToReturn+=__T("\t\t"); ToReturn+=MI.Get(Stream_General, 0, General_InternetMediaType); ToReturn+=__T("\n"); } else { //TODO: how to implement formats without Media Type? ToReturn+=__T("\t\t"); if (MI.Count_Get(Stream_Video)) ToReturn+=__T("video/x-"); else if (MI.Count_Get(Stream_Image)) ToReturn+=__T("image/x-"); else if (MI.Count_Get(Stream_Audio)) ToReturn+=__T("audio/x-"); else ToReturn+=__T("application/x-"); ToReturn+=Ztring(MI.Get(Stream_General, 0, __T("Format"))).MakeLowerCase(); ToReturn+=__T("\n"); } //formatLocation ToReturn+=__T("\t\t")+MI.Get(Stream_General, 0, General_CompleteName)+__T("\n"); //dateCreated if (!MI.Get(Stream_General, 0, General_Encoded_Date).empty()) { Ztring dateCreated=MI.Get(Stream_General, 0, General_Recorded_Date); dateCreated.FindAndReplace(__T("UTC"), __T("-")); dateCreated.FindAndReplace(__T(" "), __T("T")); dateCreated+=__T('Z'); ToReturn+=__T("\t\t")+dateCreated+__T("\n"); } //dateIssued if (!MI.Get(Stream_General, 0, General_Recorded_Date).empty()) { Ztring dateIssued=MI.Get(Stream_General, 0, General_Recorded_Date); dateIssued.FindAndReplace(__T("UTC"), __T("-")); dateIssued.FindAndReplace(__T(" "), __T("T")); dateIssued+=__T('Z'); ToReturn+=__T("\t\t")+dateIssued+__T("\n"); } //formatMediaType if (!PBCore_MediaType(MI).empty()) ToReturn+=__T("\t\t")+PBCore_MediaType(MI)+__T("\n"); else ToReturn+=__T("\t\tapplication/octet-stream\n"); //formatGenerations ToReturn+=__T("\t\t\n"); //formatFileSize if (!MI.Get(Stream_General, 0, General_FileSize).empty()) ToReturn+=__T("\t\t")+MI.Get(Stream_General, 0, General_FileSize)+__T("\n"); //formatTimeStart if (!MI.Get(Stream_Video, 0, Video_Delay_Original_String3).empty()) ToReturn+=__T("\t\t")+MI.Get(Stream_Video, 0, Video_Delay_Original_String3)+__T("\n"); else if (!MI.Get(Stream_Video, 0, Video_Delay_String3).empty()) ToReturn+=__T("\t\t")+MI.Get(Stream_Video, 0, Video_Delay_String3)+__T("\n"); //formatDuration if (!MI.Get(Stream_General, 0, General_Duration_String3).empty()) ToReturn+=__T("\t\t")+MI.Get(Stream_General, 0, General_Duration_String3)+__T("\n"); //formatDataRate if (!MI.Get(Stream_General, 0, General_OverallBitRate).empty()) { ToReturn+=__T("\t\t"); ToReturn+=MI.Get(Stream_General, 0, General_OverallBitRate); if (!MI.Get(Stream_General, 0, General_OverallBitRate_Mode).empty()) ToReturn+=__T(' ')+MI.Get(Stream_General, 0, General_OverallBitRate_Mode); ToReturn+=__T("\n"); } //formatTracks ToReturn+=__T("\t\t")+Ztring::ToZtring(MI.Count_Get(Stream_Video)+MI.Count_Get(Stream_Audio)+MI.Count_Get(Stream_Image)+MI.Count_Get(Stream_Text))+__T("\n"); //Streams for (size_t StreamKind=Stream_General+1; StreamKind\n"); ToReturn+=__T("\n"); //Carriage return ToReturn.FindAndReplace(__T("\n"), EOL, 0, Ztring_Recursive); return ToReturn; } //*************************************************************************** // //*************************************************************************** } //NameSpace MediaInfoLib/Source/MediaInfo/Export/Export_PBCore.h100777 0 0 2025 12226004262 15652 0/* 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. */ //--------------------------------------------------------------------------- #ifndef Export_PBCoreH #define Export_PBCoreH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/MediaInfo_Internal.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** /// @brief Export_PBCore //*************************************************************************** class Export_PBCore { public : //Constructeur/Destructeur Export_PBCore (); ~Export_PBCore (); //Input Ztring Transform(MediaInfo_Internal &MI); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Export/Export_reVTMD.cpp100777 0 0 474 12226004262 16162 0// reVTMD is disabled due to its non-free licensing. //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- MediaInfoLib/Source/MediaInfo/Export/Export_reVTMD.h100777 0 0 74 12226004262 15603 0// reVTMD is disabled due to its non-compatible licensing. MediaInfoLib/Source/MediaInfo/File_Dummy.cpp100777 0 0 36117 12226004262 14334 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DUMMY_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File_Dummy.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Format //*************************************************************************** //--------------------------------------------------------------------------- void File_Dummy::FileHeader_Parse() { File_Name=__T("D:\\Example\\"); File_Name+=KindOfDummy; if (KindOfDummy==__T("Album")) { Fill_Dummy_General(); Fill_Dummy_Audio(); } else if (KindOfDummy==__T("Comic")) { Fill_Dummy_General(); Fill_Dummy_Video(); } else if (KindOfDummy==__T("Movie")) { Fill_Dummy_General(); Fill_Dummy_Video(); Fill_Dummy_Video(); Fill_Dummy_Audio(); Fill_Dummy_Audio(); Fill_Dummy_Audio(); Fill_Dummy_Audio(); Fill_Dummy_Text(); Fill_Dummy_Text(); Fill_Dummy_Text(); Fill_Dummy_Text(); Fill_Dummy_Chapters(); Fill_Dummy_Chapters(); } else { File_Name=__T("D:\\WhatIsIt.mkv"); Fill(Stream_General, 0, General_Domain, "Starwars saga"); Fill(Stream_General, 0, General_Movie, "Starwars 4"); Fill(Stream_General, 0, General_Movie_More, "A new hope"); Fill(Stream_General, 0, General_Director, "Georges Lucas"); Fill(Stream_General, 0, General_Released_Date, "1977"); Fill(Stream_General, 0, General_FileSize, "734000000"); Fill(Stream_General, 0, General_Format, "Matroska"); Fill(Stream_General, 0, General_Format_Url, "http://MediaArea.net/MediaInfo"); Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Codec, "XVID"); Fill(Stream_Video, 0, Video_Codec_Url, "http://MediaArea.net/MediaInfo"); Fill(Stream_Video, 0, Video_BitRate, "800000"); Fill(Stream_Video, 0, Video_Width, "720"); Fill(Stream_Video, 0, Video_Height, "320"); Fill(Stream_Video, 0, Video_FrameRate, "24.976"); Fill(Stream_Video, 0, Video_BitDepth, "8"); Fill(Stream_Video, 0, Video_Language, "en"); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "AC-3"); Fill(Stream_Audio, 0, Audio_Codec, "AC3"); Fill(Stream_Audio, 0, Audio_Codec_Url, "http://MediaArea.net/MediaInfo"); Fill(Stream_Audio, 0, Audio_BitRate, "384000"); Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR"); Fill(Stream_Audio, 0, Audio_Channel_s_, "6"); Fill(Stream_Audio, 0, Audio_SamplingRate, "48000"); Fill(Stream_Audio, 0, Audio_Language, "en"); Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, Text_Codec, "SSA"); Fill(Stream_Text, 0, Text_Codec_Url, "http://MediaArea.net/MediaInfo"); Fill(Stream_Text, 0, Text_Language, "en"); Fill(Stream_Text, 0, Text_Language_More, "Forced"); Stream_Prepare(Stream_Other); Fill(Stream_Other, 0, Chapters_Total, "16"); Fill(Stream_Other, 0, Chapters_Language, "en"); } Accept(); } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- void File_Dummy::Fill_Dummy_General() { Fill(Stream_General, 0, General_Format, "Format"); Fill(Stream_General, 0, General_Format_Url, "http://MediaArea.net/MediaInfo"); Fill(Stream_General, 0, General_Format_Extensions, "fmt fmt fmt"); Fill(Stream_General, 0, General_FileSize, "1000000"); Fill(Stream_General, 0, General_Duration, "10000"); Fill(Stream_General, 0, General_Domain, "Domain"); Fill(Stream_General, 0, General_Collection, "Collection"); Fill(Stream_General, 0, General_Season, "Season"); Fill(Stream_General, 0, General_Season_Position_Total, "Season/Position_Total"); if (KindOfDummy==__T("Album")) { Fill(Stream_General, 0, General_Album, "Album name"); Fill(Stream_General, 0, General_Album_More, "More information about the album"); Fill(Stream_General, 0, General_Part, "Part"); Fill(Stream_General, 0, General_Part_Position_Total, "Part/Position_Total"); Fill(Stream_General, 0, General_Part_Position, "Part/Position"); Fill(Stream_General, 0, General_Track, "Track"); Fill(Stream_General, 0, General_Track_Position, "Track/Position"); Fill(Stream_General, 0, General_Track_More, "More information about the track"); } else if (KindOfDummy==__T("Comic")) { Fill(Stream_General, 0, General_Comic, "Comic name"); Fill(Stream_General, 0, General_Comic_More, "More information about the comic"); } else //if (KindOfDummy==__T("Movie")) { Fill(Stream_General, 0, General_Movie, "Movie name"); Fill(Stream_General, 0, General_Movie_More, "More information about the movie"); } Fill(Stream_General, 0, General_Performer, "Performer"); Fill(Stream_General, 0, General_Performer_Sort, "Performer/Sort"); Fill(Stream_General, 0, General_Performer_Url, "Performer/Url"); Fill(Stream_General, 0, General_Original_Performer, "Original/Performer"); Fill(Stream_General, 0, General_Accompaniment, "Accompaniment"); Fill(Stream_General, 0, General_Composer, "Composer"); Fill(Stream_General, 0, General_Composer_Nationality, "Composer/Nationality"); Fill(Stream_General, 0, General_Arranger, "Arranger"); Fill(Stream_General, 0, General_Lyricist, "Lyricist"); Fill(Stream_General, 0, General_Original_Lyricist, "Original/Lyricist"); Fill(Stream_General, 0, General_Conductor, "Conductor"); Fill(Stream_General, 0, General_Actor, "Actor"); Fill(Stream_General, 0, General_Actor_Character, "Actor_Character"); Fill(Stream_General, 0, General_WrittenBy, "WrittenBy"); Fill(Stream_General, 0, General_ScreenplayBy, "ScreenplayBy"); Fill(Stream_General, 0, General_Director, "Director"); Fill(Stream_General, 0, General_AssistantDirector, "AssistantDirector"); Fill(Stream_General, 0, General_DirectorOfPhotography, "DirectorOfPhotography"); Fill(Stream_General, 0, General_ArtDirector, "ArtDirector"); Fill(Stream_General, 0, General_EditedBy, "EditedBy"); Fill(Stream_General, 0, General_Producer, "Producer"); Fill(Stream_General, 0, General_CoProducer, "CoProducer"); Fill(Stream_General, 0, General_ExecutiveProducer, "ExecutiveProducer"); Fill(Stream_General, 0, General_ProductionDesigner, "ProductionDesigner"); Fill(Stream_General, 0, General_CostumeDesigner, "CostumeDesigner"); Fill(Stream_General, 0, General_Choregrapher, "Choregrapher"); Fill(Stream_General, 0, General_SoundEngineer, "SoundEngineer"); Fill(Stream_General, 0, General_MasteredBy, "MasteredBy"); Fill(Stream_General, 0, General_RemixedBy, "RemixedBy"); Fill(Stream_General, 0, General_ProductionStudio, "ProductionStudio"); Fill(Stream_General, 0, General_Label, "Label"); Fill(Stream_General, 0, General_Publisher, "Publisher"); Fill(Stream_General, 0, General_Publisher_URL, "Publisher/URL"); Fill(Stream_General, 0, General_DistributedBy, "DistributedBy"); Fill(Stream_General, 0, General_EncodedBy, "EncodedBy"); Fill(Stream_General, 0, General_ThanksTo, "ThanksTo"); Fill(Stream_General, 0, General_ServiceName, "ServiceNeme"); Fill(Stream_General, 0, General_ServiceProvider, "ServiceProvider"); Fill(Stream_General, 0, General_Service_Url, "Service/URL"); Fill(Stream_General, 0, General_ContentType, "ContentType"); Fill(Stream_General, 0, General_Subject, "Subject"); Fill(Stream_General, 0, General_Synopsis, "Synopsis"); Fill(Stream_General, 0, General_Summary, "Summary"); Fill(Stream_General, 0, General_Description, "Description"); Fill(Stream_General, 0, General_Keywords, "Keywords"); Fill(Stream_General, 0, General_Period, "Period"); Fill(Stream_General, 0, General_LawRating, "LawRating"); Fill(Stream_General, 0, General_Written_Date, "Written_Date"); Fill(Stream_General, 0, General_Recorded_Date, "Recorded_Date"); Fill(Stream_General, 0, General_Released_Date, "Released_Date"); Fill(Stream_General, 0, General_Mastered_Date, "Mastered_Date"); Fill(Stream_General, 0, General_Encoded_Date, "Encoded_Date"); Fill(Stream_General, 0, General_Tagged_Date, "Tagged_Date"); Fill(Stream_General, 0, General_Original_Released_Date, "Original/Released_Date"); Fill(Stream_General, 0, General_Written_Location, "Written_Location"); Fill(Stream_General, 0, General_Recorded_Location, "Recorded_Location"); Fill(Stream_General, 0, General_Archival_Location, "Archival_Location"); Fill(Stream_General, 0, General_Genre, "Genre"); Fill(Stream_General, 0, General_Mood, "Mood"); Fill(Stream_General, 0, General_Comment, "Comment"); Fill(Stream_General, 0, General_Rating , "Rating "); Fill(Stream_General, 0, General_Encoded_Application, "Encoded_Application"); Fill(Stream_General, 0, General_Encoded_Library, "Encoded_Library"); Fill(Stream_General, 0, General_Encoded_Library_Settings, "Encoded_Library_Settings"); Fill(Stream_General, 0, General_Copyright, "Copyright"); Fill(Stream_General, 0, General_Producer_Copyright, "Producer_Copyright"); Fill(Stream_General, 0, General_TermsOfUse, "TermsOfUse"); Fill(Stream_General, 0, General_Copyright_Url, "Copyright/Url"); Fill(Stream_General, 0, General_ISRC, "ISRC"); Fill(Stream_General, 0, General_ISBN, "ISBN"); Fill(Stream_General, 0, General_BarCode, "BarCode"); Fill(Stream_General, 0, General_LCCN, "LCCN"); Fill(Stream_General, 0, General_CatalogNumber, "CatalogNumber"); Fill(Stream_General, 0, General_LabelCode, "LabelCode"); Fill(Stream_General, 0, General_Cover, "Y"); Fill(Stream_General, 0, General_Cover_Data, "Cover_Datas"); Fill(Stream_General, 0, General_Summary, "Summary"); Fill(Stream_General, 0, General_BPM, "100"); } //--------------------------------------------------------------------------- void File_Dummy::Fill_Dummy_Video() { Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_ID, "ID"); Fill(Stream_Video, 0, Video_UniqueID, "UniqueID"); Fill(Stream_Video, 0, Video_Title, "Title"); Fill(Stream_Video, 0, Video_Codec, "Codec"); Fill(Stream_Video, 0, Video_Codec_Info, "Codec/Info"); Fill(Stream_Video, 0, Video_Codec_Url, "http://--Codec/Url--"); Fill(Stream_Video, 0, Video_BitRate, "10000"); Fill(Stream_Video, 0, Video_BitRate_Mode, "BitRate_Mode"); Fill(Stream_Video, 0, Video_Encoded_Library, "Encoded_Library"); Fill(Stream_Video, 0, Video_Encoded_Library_Settings, "Encoded_Library_Settings"); if (KindOfDummy==__T("Album")) { Fill(Stream_Video, 0, Video_Width, "2000"); Fill(Stream_Video, 0, Video_Height, "3000"); } else //if (KindOfDummy==__T("Movie")) { Fill(Stream_Video, 0, Video_DisplayAspectRatio, "2"); Fill(Stream_Video, 0, Video_FrameRate, "24.976"); Fill(Stream_Video, 0, Video_FrameCount, "FrameCount"); Fill(Stream_Video, 0, Video_BitDepth, "8"); Fill(Stream_Video, 0, Video_Bits__Pixel_Frame_, "Bits/(Pixel*Frame)"); Fill(Stream_Video, 0, Video_Delay, "100"); Fill(Stream_Video, 0, Video_Duration, "990000"); } Fill(Stream_Video, 0, Video_Language, "eng"); Fill(Stream_Video, 0, Video_Language_More, "Language_More"); } //--------------------------------------------------------------------------- void File_Dummy::Fill_Dummy_Audio() { Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_ID, "ID"); Fill(Stream_Audio, 0, Audio_UniqueID, "UniqueID"); Fill(Stream_Audio, 0, Audio_Title, "Title"); Fill(Stream_Audio, 0, Audio_Format, "Format"); Fill(Stream_Audio, 0, Audio_Format_Info, "Format/Info"); Fill(Stream_Audio, 0, Audio_Format_Url, "http://--Format/Url--"); Fill(Stream_Audio, 0, Audio_Codec, "Codec"); Fill(Stream_Audio, 0, Audio_Codec_Info, "Codec/Info"); Fill(Stream_Audio, 0, Audio_Codec_Url, "http://--Codec/Url--"); Fill(Stream_Audio, 0, Audio_BitRate, "1000"); Fill(Stream_Audio, 0, Audio_BitRate_Mode, "BitRate_Mode"); Fill(Stream_Audio, 0, Audio_Encoded_Library, "Encoded_Library"); Fill(Stream_Audio, 0, Audio_Encoded_Library_Settings, "Encoded_Library_Settings"); Fill(Stream_Audio, 0, Audio_Channel_s_, 2); Fill(Stream_Audio, 0, Audio_ChannelPositions, "ChannelPositions"); Fill(Stream_Audio, 0, Audio_SamplingRate, "48000"); Fill(Stream_Audio, 0, Audio_SamplingCount, "SamplingCount"); Fill(Stream_Audio, 0, Audio_BitDepth, "BitDepth"); Fill(Stream_Audio, 0, Audio_Delay, "10"); Fill(Stream_Audio, 0, Audio_Duration, "100000"); Fill(Stream_Audio, 0, Audio_Language, "fre"); Fill(Stream_Audio, 0, Audio_Language_More, "Language_More"); } //--------------------------------------------------------------------------- void File_Dummy::Fill_Dummy_Text() { Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, Text_ID, "ID"); Fill(Stream_Text, 0, Text_UniqueID, "UniqueID"); Fill(Stream_Text, 0, Text_Title, "Title"); Fill(Stream_Text, 0, Text_Codec, "Codec"); Fill(Stream_Text, 0, Text_Codec_Url, "http://--Codec/Url--"); Fill(Stream_Text, 0, Text_Delay, "100"); Fill(Stream_Text, 0, Text_Duration, "100"); Fill(Stream_Text, 0, Text_Language, "de"); Fill(Stream_Text, 0, Text_Language_More, "Language_More"); Fill(Stream_Text, 0, Text_Summary, "Summary"); } //--------------------------------------------------------------------------- void File_Dummy::Fill_Dummy_Chapters() { Stream_Prepare(Stream_Other); Fill(Stream_Other, 0, Chapters_ID, "ID"); Fill(Stream_Other, 0, Chapters_UniqueID, "UniqueID"); Fill(Stream_Other, 0, Chapters_Title, "Title"); Fill(Stream_Other, 0, Chapters_Total, "Total"); Fill(Stream_Other, 0, Chapters_Language, "de"); } } //NameSpace #endif MediaInfoLib/Source/MediaInfo/File_Dummy.h100777 0 0 2657 12226004261 13762 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Fill with Name of tags // Used to give an example to the GUI of what MediaInfo can do // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_DummyH #define MediaInfo_File_DummyH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Dummy //*************************************************************************** class File_Dummy : public File__Analyze { public : Ztring KindOfDummy; protected : //Buffer - File header void FileHeader_Parse (); private : void Fill_Dummy_General(); void Fill_Dummy_Video(); void Fill_Dummy_Audio(); void Fill_Dummy_Text(); void Fill_Dummy_Chapters(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/File_Other.cpp100777 0 0 16316 12226004262 14321 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_OTHER_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File_Other.h" #include "ZenLib/Utils.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Format //*************************************************************************** //--------------------------------------------------------------------------- void File_Other::Read_Buffer_Continue() { //Integrity if (Buffer_Size<16) { Element_WaitForMoreData(); return; } Ztring Format; if (CC4(Buffer)==0xC5C6CBC3) {Format=__T("RISC OS Chunk data");} else if (CC4(Buffer)==0x110000EF) {Format=__T("RISC OS AIF executable");} else if (CC4(Buffer)==CC4("Draw")) {Format=__T("RISC OS Draw");} else if (CC4(Buffer)==CC4("FONT")) {Format=__T("RISC OS Font");} else if (CC8(Buffer)==CC8("Maestro\r")) {Format=__T("RISC OS music file");} else if (CC4(Buffer)==CC4("FC14")) {Format=__T("Amiga Future Composer");} else if (CC4(Buffer)==CC4("SMOD")) {Format=__T("Amiga Future Composer");} else if (CC4(Buffer)==CC4("AON4")) {Format=__T("Amiga Art Of Noise");} else if (CC8(Buffer+1)==CC8("MUGICIAN")) {Format=__T("Amiga Mugician");} else if (Buffer_Size>=66 && CC8(Buffer+58)==CC8("SIDMON I")) {Format=__T("Amiga Sidmon");} else if (CC8(Buffer)==CC8("Synth4.0")) {Format=__T("Amiga Synthesis");} else if (CC4(Buffer)==CC4("ARP.")) {Format=__T("Amiga Holy Noise");} else if (CC4(Buffer)==CC4("BeEp")) {Format=__T("Amiga JamCracker");} else if (CC4(Buffer)==CC4("COSO")) {Format=__T("Amiga Hippel-COSO");} else if (CC3(Buffer)==CC3("LSX")) {Format=__T("Amiga LZX");} else if (CC4(Buffer)==CC4("MOVI")) {Format=__T("Silicon Graphics movie");} else if (CC4(Buffer+10)==CC4("Vivo")) {Format=__T("Vivo");} else if (CC4(Buffer+1)==CC4("VRML")) {Format=__T("VRML");} else if (CC5(Buffer)==CC5("HVQM4")) {Format=__T("GameCube Movie");} else if (CC8(Buffer)==CC8("KW-DIRAC")) { Accept("Dirac"); Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "Dirac"); Finish("Dirac"); return; } else if (CC5(Buffer)==CC5("ustar")) {Format=__T("Tar archive");} //TODO: all archive magic numbers else if (CC4(Buffer+1)==CC4("MSCB")) {Format=__T("MS Cabinet");} else if (CC4(Buffer)==CC4(".snd")) {Format=__T("SUN Audio");} else if (CC4(Buffer)==0x2E736400) {Format=__T("DEC Audio");} else if (CC4(Buffer)==CC4("MThd")) {Format=__T("MIDI");} else if (CC4(Buffer)==CC4("CTMF")) {Format=__T("CMF");} else if (CC3(Buffer)==CC3("SBI")) {Format=__T("SoundBlaster");} else if (CC4(Buffer)==CC4("EMOD")) {Format=__T("Ext. MOD");} //TODO: Other Sound magic numbers else if (CC7(Buffer)==CC7("BLENDER")) {Format=__T("Blender");} else if (CC4(Buffer)==CC4("AC10")) {Format=__T("AutoCAD"); ;} else if (CC2(Buffer)==0x1F9D) {Format=__T("Compress");} else if (CC2(Buffer)==0x1F8B) {Format=__T("GZip");} else if (CC2(Buffer)==0x1F1E) {Format=__T("Huffman");} else if (CC3(Buffer)==CC3("BZh")) {Format=__T("BZip2");} else if (CC2(Buffer)==CC2("BZ")) {Format=__T("BZip1");} else if (CC3(Buffer)==CC3("NES")) {Format=__T("NES ROM");} else if (Buffer_Size>=0x108 && CC4(Buffer+0x104)==0xCEED6666) {Format=__T("GameBoy");} else if (Buffer_Size>=0x104 && CC4(Buffer+0x100)==CC4("SEGA")) {Format=__T("MegaDrive");} else if (Buffer_Size>=0x284 && CC4(Buffer+0x280)==CC4("EAGN")) {Format=__T("SupeMegaDrive");} else if (Buffer_Size>=0x284 && CC4(Buffer+0x280)==CC4("EAMG")) {Format=__T("SupeMegaDrive");} else if (CC4(Buffer)==0x21068028) {Format=__T("Dreamcast");} else if (CC4(Buffer)==CC4("LCDi")) {Format=__T("Dreamcast");} else if (CC4(Buffer)==0x37804012) {Format=__T("Nintendo64");} else if (CC8(Buffer)==CC8("PS-X EXE")) {Format=__T("Playstation");} else if (CC4(Buffer)==CC4("LCDi")) {Format=__T("Dreamcast");} else if (CC4(Buffer)==CC4("XBEH")) {Format=__T("X-Box");} else if (CC4(Buffer)==CC4("XIP0")) {Format=__T("X-Box");} else if (CC4(Buffer)==CC4("XTF0")) {Format=__T("X-Box");} else if (CC2(Buffer)==0x8008) {Format=__T("Lynx");} else if (CC7(Buffer)==CC7("\x01ZZZZZ\x01")) {Format=__T("");} else if (CC6(Buffer)==CC6("1\x0A\x0D""00:")) { Accept("SRT"); Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, Text_Format, "SRT"); Finish("SRT"); return; } else if ((CC1(Buffer+0)==CC1("[") && CC1(Buffer+2)==CC1("S") && CC1(Buffer+22)==CC1("o") && CC1(Buffer+24)==CC1("]")) //Unicode Text is : "[Script Info] || (CC1(Buffer+2)==CC1("[") && CC1(Buffer+4)==CC1("S") && CC1(Buffer+24)==CC1("o") && CC1(Buffer+26)==CC1("]"))) { Accept("SSA"); Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, Text_Format, "SSA"); Finish("SSA"); return; } else if (CC4(Buffer)==CC4("RIFF") && CC4(Buffer+8)==CC4("AMV ")) {Format=__T("AMV");} else if (CC4(Buffer)==CC4("RIFF") && CC4(Buffer+8)==CC4("WEBP")) { Accept("WEBP"); Stream_Prepare(Stream_Image); Fill(Stream_Image, 0, Image_Format, "WebP"); Finish("WEBP"); return; } else if (CC4(Buffer)==0x414D5697) {Format=__T("MTV");} else if (CC6(Buffer)==CC6("Z\0W\0F\0")) { Accept("ZWF"); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "ZWF"); Finish("ZWF"); return; } else if (CC4(Buffer)==0x616A6B67) //"ajkg" { Accept("Shorten"); Fill(Stream_General, 0, General_Format_Version, CC1(Buffer+4)); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "Shorten"); Finish("Shorten"); return; } else if (CC4(Buffer)==0x504C5646) {Format=__T("PlayLater Video");} else if (CC4(Buffer)==CC4("")) {Format=__T("");} if (Format.empty()) { Reject(); return; } Accept(); Element_Offset=File_Size-(File_Offset+Buffer_Offset); Fill(Stream_General, 0, General_Format, Format); Finish(); } } //NameSpace #endif //MEDIAINFO_OTHER_YES MediaInfoLib/Source/MediaInfo/File_Other.h100777 0 0 2423 12226004262 13740 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Use magic number to detect only the format // Theses formats are not planned to be expanded, this is only to detect // well all files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_OtherH #define MediaInfo_File_OtherH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Other //*************************************************************************** class File_Other : public File__Analyze { protected : //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/File_Unknown.cpp100777 0 0 3431 12226004262 14651 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_UNKNOWN_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File_Unknown.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Unknown::Read_Buffer_Init() { Accept("Unknown"); } //--------------------------------------------------------------------------- void File_Unknown::Read_Buffer_Continue() { Element_Offset=File_Size; Finish("Unknown"); } //*************************************************************************** // //*************************************************************************** } //NameSpace #endif //MEDIAINFO_UNKNOWN_YES MediaInfoLib/Source/MediaInfo/File_Unknown.h100777 0 0 2425 12226004262 14320 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Empty container // This is only to have a void parser // It fill basic fields (filename...) only // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_UnknownH #define MediaInfo_File_UnknownH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Unknown //*************************************************************************** class File_Unknown : public File__Analyze { protected : //Buffer - Global void Read_Buffer_Init (); void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/File__Analyse_Automatic.h100777 0 0 120614 12253120574 16470 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Automaticly generated methods for MediaInfo // Don't modify, this will be deleted at the next automatic update // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File__Analyze_AutomaticH #define MediaInfo_File__Analyze_AutomaticH //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- enum generic { Generic_Format, Generic_Format_Info, Generic_Format_Url, Generic_Format_Commercial, Generic_Format_Commercial_IfAny, Generic_Format_Version, Generic_Format_Profile, Generic_Format_Compression, Generic_Format_Settings, Generic_InternetMediaType, Generic_CodecID, Generic_CodecID_Info, Generic_CodecID_Hint, Generic_CodecID_Url, Generic_CodecID_Description, Generic_Codec, Generic_Codec_String, Generic_Codec_Info, Generic_Codec_Url, Generic_Codec_CC, Generic_Duration, Generic_Duration_String, Generic_Duration_String1, Generic_Duration_String2, Generic_Duration_String3, Generic_Source_Duration, Generic_Source_Duration_String, Generic_Source_Duration_String1, Generic_Source_Duration_String2, Generic_Source_Duration_String3, Generic_BitRate_Mode, Generic_BitRate_Mode_String, Generic_BitRate, Generic_BitRate_String, Generic_BitRate_Minimum, Generic_BitRate_Minimum_String, Generic_BitRate_Nominal, Generic_BitRate_Nominal_String, Generic_BitRate_Maximum, Generic_BitRate_Maximum_String, Generic_BitRate_Encoded, Generic_BitRate_Encoded_String, Generic_FrameCount, Generic_Source_FrameCount, Generic_ColorSpace, Generic_ChromaSubsampling, Generic_Resolution, Generic_Resolution_String, Generic_BitDepth, Generic_BitDepth_String, Generic_Compression_Mode, Generic_Compression_Mode_String, Generic_Compression_Ratio, Generic_Delay, Generic_Delay_String, Generic_Delay_String1, Generic_Delay_String2, Generic_Delay_String3, Generic_Delay_String4, Generic_Delay_Settings, Generic_Delay_DropFrame, Generic_Delay_Source, Generic_Delay_Source_String, Generic_Delay_Original, Generic_Delay_Original_String, Generic_Delay_Original_String1, Generic_Delay_Original_String2, Generic_Delay_Original_String3, Generic_Delay_Original_String4, Generic_Delay_Original_Settings, Generic_Delay_Original_DropFrame, Generic_Delay_Original_Source, Generic_Video_Delay, Generic_Video_Delay_String, Generic_Video_Delay_String1, Generic_Video_Delay_String2, Generic_Video_Delay_String3, Generic_Video_Delay_String4, Generic_StreamSize, Generic_StreamSize_String, Generic_StreamSize_String1, Generic_StreamSize_String2, Generic_StreamSize_String3, Generic_StreamSize_String4, Generic_StreamSize_String5, Generic_StreamSize_Proportion, Generic_Source_StreamSize, Generic_Source_StreamSize_String, Generic_Source_StreamSize_String1, Generic_Source_StreamSize_String2, Generic_Source_StreamSize_String3, Generic_Source_StreamSize_String4, Generic_Source_StreamSize_String5, Generic_Source_StreamSize_Proportion, Generic_StreamSize_Encoded, Generic_StreamSize_Encoded_String, Generic_StreamSize_Encoded_String1, Generic_StreamSize_Encoded_String2, Generic_StreamSize_Encoded_String3, Generic_StreamSize_Encoded_String4, Generic_StreamSize_Encoded_String5, Generic_StreamSize_Encoded_Proportion, Generic_Source_StreamSize_Encoded, Generic_Source_StreamSize_Encoded_String, Generic_Source_StreamSize_Encoded_String1, Generic_Source_StreamSize_Encoded_String2, Generic_Source_StreamSize_Encoded_String3, Generic_Source_StreamSize_Encoded_String4, Generic_Source_StreamSize_Encoded_String5, Generic_Source_StreamSize_Encoded_Proportion, Generic_Language, Generic_ServiceName, Generic_ServiceProvider, }; //--------------------------------------------------------------------------- enum general { General_Count, General_Status, General_StreamCount, General_StreamKind, General_StreamKind_String, General_StreamKindID, General_StreamKindPos, General_StreamOrder, General_FirstPacketOrder, General_Inform, General_ID, General_ID_String, General_UniqueID, General_UniqueID_String, General_MenuID, General_MenuID_String, General_GeneralCount, General_VideoCount, General_AudioCount, General_TextCount, General_OtherCount, General_ImageCount, General_MenuCount, General_Video_Format_List, General_Video_Format_WithHint_List, General_Video_Codec_List, General_Video_Language_List, General_Audio_Format_List, General_Audio_Format_WithHint_List, General_Audio_Codec_List, General_Audio_Language_List, General_Text_Format_List, General_Text_Format_WithHint_List, General_Text_Codec_List, General_Text_Language_List, General_Other_Format_List, General_Other_Format_WithHint_List, General_Other_Codec_List, General_Other_Language_List, General_Image_Format_List, General_Image_Format_WithHint_List, General_Image_Codec_List, General_Image_Language_List, General_Menu_Format_List, General_Menu_Format_WithHint_List, General_Menu_Codec_List, General_Menu_Language_List, General_CompleteName, General_FolderName, General_FileName, General_FileExtension, General_CompleteName_Last, General_FolderName_Last, General_FileName_Last, General_FileExtension_Last, General_Format, General_Format_String, General_Format_Info, General_Format_Url, General_Format_Extensions, General_Format_Commercial, General_Format_Commercial_IfAny, General_Format_Version, General_Format_Profile, General_Format_Compression, General_Format_Settings, General_InternetMediaType, General_CodecID, General_CodecID_String, General_CodecID_Info, General_CodecID_Hint, General_CodecID_Url, General_CodecID_Description, General_Interleaved, General_Codec, General_Codec_String, General_Codec_Info, General_Codec_Url, General_Codec_Extensions, General_Codec_Settings, General_Codec_Settings_Automatic, General_FileSize, General_FileSize_String, General_FileSize_String1, General_FileSize_String2, General_FileSize_String3, General_FileSize_String4, General_Duration, General_Duration_String, General_Duration_String1, General_Duration_String2, General_Duration_String3, General_Duration_Start, General_Duration_End, General_OverallBitRate_Mode, General_OverallBitRate_Mode_String, General_OverallBitRate, General_OverallBitRate_String, General_OverallBitRate_Minimum, General_OverallBitRate_Minimum_String, General_OverallBitRate_Nominal, General_OverallBitRate_Nominal_String, General_OverallBitRate_Maximum, General_OverallBitRate_Maximum_String, General_Delay, General_Delay_String, General_Delay_String1, General_Delay_String2, General_Delay_String3, General_StreamSize, General_StreamSize_String, General_StreamSize_String1, General_StreamSize_String2, General_StreamSize_String3, General_StreamSize_String4, General_StreamSize_String5, General_StreamSize_Proportion, General_HeaderSize, General_DataSize, General_FooterSize, General_IsStreamable, General_Album_ReplayGain_Gain, General_Album_ReplayGain_Gain_String, General_Album_ReplayGain_Peak, General_Encryption, General_Title, General_Title_More, General_Title_Url, General_Domain, General_Collection, General_Season, General_Season_Position, General_Season_Position_Total, General_Movie, General_Movie_More, General_Movie_Country, General_Movie_Url, General_Album, General_Album_More, General_Album_Sort, General_Album_Performer, General_Album_Performer_Sort, General_Album_Performer_Url, General_Comic, General_Comic_More, General_Comic_Position_Total, General_Part, General_Part_Position, General_Part_Position_Total, General_Track, General_Track_More, General_Track_Url, General_Track_Sort, General_Track_Position, General_Track_Position_Total, General_Grouping, General_Chapter, General_SubTrack, General_Original_Album, General_Original_Movie, General_Original_Part, General_Original_Track, General_Compilation, General_Compilation_String, General_Performer, General_Performer_Sort, General_Performer_Url, General_Original_Performer, General_Accompaniment, General_Composer, General_Composer_Nationality, General_Arranger, General_Lyricist, General_Original_Lyricist, General_Conductor, General_Director, General_AssistantDirector, General_DirectorOfPhotography, General_SoundEngineer, General_ArtDirector, General_ProductionDesigner, General_Choregrapher, General_CostumeDesigner, General_Actor, General_Actor_Character, General_WrittenBy, General_ScreenplayBy, General_EditedBy, General_CommissionedBy, General_Producer, General_CoProducer, General_ExecutiveProducer, General_MusicBy, General_DistributedBy, General_OriginalSourceForm_DistributedBy, General_MasteredBy, General_EncodedBy, General_RemixedBy, General_ProductionStudio, General_ThanksTo, General_Publisher, General_Publisher_URL, General_Label, General_Genre, General_Mood, General_ContentType, General_Subject, General_Description, General_Keywords, General_Summary, General_Synopsis, General_Period, General_LawRating, General_LawRating_Reason, General_ICRA, General_Released_Date, General_Original_Released_Date, General_Recorded_Date, General_Encoded_Date, General_Tagged_Date, General_Written_Date, General_Mastered_Date, General_File_Created_Date, General_File_Created_Date_Local, General_File_Modified_Date, General_File_Modified_Date_Local, General_Recorded_Location, General_Written_Location, General_Archival_Location, General_Encoded_Application, General_Encoded_Application_Url, General_Encoded_Library, General_Encoded_Library_String, General_Encoded_Library_Name, General_Encoded_Library_Version, General_Encoded_Library_Date, General_Encoded_Library_Settings, General_Cropped, General_Dimensions, General_DotsPerInch, General_Lightness, General_OriginalSourceMedium, General_OriginalSourceForm, General_OriginalSourceForm_NumColors, General_OriginalSourceForm_Name, General_OriginalSourceForm_Cropped, General_OriginalSourceForm_Sharpness, General_Tagged_Application, General_BPM, General_ISRC, General_ISBN, General_BarCode, General_LCCN, General_CatalogNumber, General_LabelCode, General_Owner, General_Copyright, General_Copyright_Url, General_Producer_Copyright, General_TermsOfUse, General_ServiceName, General_ServiceChannel, General_Service_Url, General_ServiceProvider, General_ServiceProviderr_Url, General_ServiceType, General_NetworkName, General_OriginalNetworkName, General_Country, General_TimeZone, General_Cover, General_Cover_Description, General_Cover_Type, General_Cover_Mime, General_Cover_Data, General_Lyrics, General_Comment, General_Rating, General_Added_Date, General_Played_First_Date, General_Played_Last_Date, General_Played_Count, General_EPG_Positions_Begin, General_EPG_Positions_End, }; //--------------------------------------------------------------------------- enum video { Video_Count, Video_Status, Video_StreamCount, Video_StreamKind, Video_StreamKind_String, Video_StreamKindID, Video_StreamKindPos, Video_StreamOrder, Video_FirstPacketOrder, Video_Inform, Video_ID, Video_ID_String, Video_UniqueID, Video_UniqueID_String, Video_MenuID, Video_MenuID_String, Video_Format, Video_Format_Info, Video_Format_Url, Video_Format_Commercial, Video_Format_Commercial_IfAny, Video_Format_Version, Video_Format_Profile, Video_Format_Compression, Video_MultiView_BaseProfile, Video_MultiView_Count, Video_MultiView_Layout, Video_Format_Settings, Video_Format_Settings_BVOP, Video_Format_Settings_BVOP_String, Video_Format_Settings_QPel, Video_Format_Settings_QPel_String, Video_Format_Settings_GMC, Video_Format_Settings_GMC_String, Video_Format_Settings_Matrix, Video_Format_Settings_Matrix_String, Video_Format_Settings_Matrix_Data, Video_Format_Settings_CABAC, Video_Format_Settings_CABAC_String, Video_Format_Settings_RefFrames, Video_Format_Settings_RefFrames_String, Video_Format_Settings_Pulldown, Video_Format_Settings_FrameMode, Video_Format_Settings_GOP, Video_Format_Settings_FrameStructures, Video_Format_Settings_Wrapping, Video_InternetMediaType, Video_MuxingMode, Video_CodecID, Video_CodecID_String, Video_CodecID_Info, Video_CodecID_Hint, Video_CodecID_Url, Video_CodecID_Description, Video_Codec, Video_Codec_String, Video_Codec_Family, Video_Codec_Info, Video_Codec_Url, Video_Codec_CC, Video_Codec_Profile, Video_Codec_Description, Video_Codec_Settings, Video_Codec_Settings_PacketBitStream, Video_Codec_Settings_BVOP, Video_Codec_Settings_QPel, Video_Codec_Settings_GMC, Video_Codec_Settings_GMC_String, Video_Codec_Settings_Matrix, Video_Codec_Settings_Matrix_Data, Video_Codec_Settings_CABAC, Video_Codec_Settings_RefFrames, Video_Duration, Video_Duration_String, Video_Duration_String1, Video_Duration_String2, Video_Duration_String3, Video_Duration_String4, Video_Duration_FirstFrame, Video_Duration_FirstFrame_String, Video_Duration_FirstFrame_String1, Video_Duration_FirstFrame_String2, Video_Duration_FirstFrame_String3, Video_Duration_LastFrame, Video_Duration_LastFrame_String, Video_Duration_LastFrame_String1, Video_Duration_LastFrame_String2, Video_Duration_LastFrame_String3, Video_Source_Duration, Video_Source_Duration_String, Video_Source_Duration_String1, Video_Source_Duration_String2, Video_Source_Duration_String3, Video_Source_Duration_FirstFrame, Video_Source_Duration_FirstFrame_String, Video_Source_Duration_FirstFrame_String1, Video_Source_Duration_FirstFrame_String2, Video_Source_Duration_FirstFrame_String3, Video_Source_Duration_LastFrame, Video_Source_Duration_LastFrame_String, Video_Source_Duration_LastFrame_String1, Video_Source_Duration_LastFrame_String2, Video_Source_Duration_LastFrame_String3, Video_BitRate_Mode, Video_BitRate_Mode_String, Video_BitRate, Video_BitRate_String, Video_BitRate_Minimum, Video_BitRate_Minimum_String, Video_BitRate_Nominal, Video_BitRate_Nominal_String, Video_BitRate_Maximum, Video_BitRate_Maximum_String, Video_BitRate_Encoded, Video_BitRate_Encoded_String, Video_Width, Video_Width_String, Video_Width_Offset, Video_Width_Offset_String, Video_Width_Original, Video_Width_Original_String, Video_Height, Video_Height_String, Video_Height_Offset, Video_Height_Offset_String, Video_Height_Original, Video_Height_Original_String, Video_PixelAspectRatio, Video_PixelAspectRatio_String, Video_PixelAspectRatio_Original, Video_PixelAspectRatio_Original_String, Video_DisplayAspectRatio, Video_DisplayAspectRatio_String, Video_DisplayAspectRatio_Original, Video_DisplayAspectRatio_Original_String, Video_ActiveFormatDescription, Video_ActiveFormatDescription_String, Video_ActiveFormatDescription_MuxingMode, Video_Rotation, Video_Rotation_String, Video_FrameRate_Mode, Video_FrameRate_Mode_String, Video_FrameRate_Mode_Original, Video_FrameRate_Mode_Original_String, Video_FrameRate, Video_FrameRate_String, Video_FrameRate_Original, Video_FrameRate_Original_String, Video_FrameRate_Minimum, Video_FrameRate_Minimum_String, Video_FrameRate_Nominal, Video_FrameRate_Nominal_String, Video_FrameRate_Maximum, Video_FrameRate_Maximum_String, Video_FrameCount, Video_Source_FrameCount, Video_Standard, Video_Resolution, Video_Resolution_String, Video_Colorimetry, Video_ColorSpace, Video_ChromaSubsampling, Video_BitDepth, Video_BitDepth_String, Video_ScanType, Video_ScanType_String, Video_ScanType_Original, Video_ScanType_Original_String, Video_ScanOrder, Video_ScanOrder_String, Video_ScanOrder_StoredDisplayedInverted, Video_ScanOrder_Original, Video_ScanOrder_Original_String, Video_Interlacement, Video_Interlacement_String, Video_Compression_Mode, Video_Compression_Mode_String, Video_Compression_Ratio, Video_Bits__Pixel_Frame_, Video_Delay, Video_Delay_String, Video_Delay_String1, Video_Delay_String2, Video_Delay_String3, Video_Delay_String4, Video_Delay_Settings, Video_Delay_DropFrame, Video_Delay_Source, Video_Delay_Source_String, Video_Delay_Original, Video_Delay_Original_String, Video_Delay_Original_String1, Video_Delay_Original_String2, Video_Delay_Original_String3, Video_Delay_Original_String4, Video_Delay_Original_Settings, Video_Delay_Original_DropFrame, Video_Delay_Original_Source, Video_TimeStamp_FirstFrame, Video_TimeStamp_FirstFrame_String, Video_TimeStamp_FirstFrame_String1, Video_TimeStamp_FirstFrame_String2, Video_TimeStamp_FirstFrame_String3, Video_TimeCode_FirstFrame, Video_TimeCode_Settings, Video_TimeCode_Source, Video_StreamSize, Video_StreamSize_String, Video_StreamSize_String1, Video_StreamSize_String2, Video_StreamSize_String3, Video_StreamSize_String4, Video_StreamSize_String5, Video_StreamSize_Proportion, Video_Source_StreamSize, Video_Source_StreamSize_String, Video_Source_StreamSize_String1, Video_Source_StreamSize_String2, Video_Source_StreamSize_String3, Video_Source_StreamSize_String4, Video_Source_StreamSize_String5, Video_Source_StreamSize_Proportion, Video_StreamSize_Encoded, Video_StreamSize_Encoded_String, Video_StreamSize_Encoded_String1, Video_StreamSize_Encoded_String2, Video_StreamSize_Encoded_String3, Video_StreamSize_Encoded_String4, Video_StreamSize_Encoded_String5, Video_StreamSize_Encoded_Proportion, Video_Source_StreamSize_Encoded, Video_Source_StreamSize_Encoded_String, Video_Source_StreamSize_Encoded_String1, Video_Source_StreamSize_Encoded_String2, Video_Source_StreamSize_Encoded_String3, Video_Source_StreamSize_Encoded_String4, Video_Source_StreamSize_Encoded_String5, Video_Source_StreamSize_Encoded_Proportion, Video_Alignment, Video_Alignment_String, Video_Title, Video_Encoded_Application, Video_Encoded_Application_Url, Video_Encoded_Library, Video_Encoded_Library_String, Video_Encoded_Library_Name, Video_Encoded_Library_Version, Video_Encoded_Library_Date, Video_Encoded_Library_Settings, Video_Language, Video_Language_String, Video_Language_String1, Video_Language_String2, Video_Language_String3, Video_Language_String4, Video_Language_More, Video_Default, Video_Default_String, Video_Forced, Video_Forced_String, Video_Encoded_Date, Video_Tagged_Date, Video_Encryption, Video_BufferSize, Video_colour_description_present, Video_colour_primaries, Video_transfer_characteristics, Video_matrix_coefficients, Video_colour_description_present_Original, Video_colour_primaries_Original, Video_transfer_characteristics_Original, Video_matrix_coefficients_Original, }; //--------------------------------------------------------------------------- enum audio { Audio_Count, Audio_Status, Audio_StreamCount, Audio_StreamKind, Audio_StreamKind_String, Audio_StreamKindID, Audio_StreamKindPos, Audio_StreamOrder, Audio_FirstPacketOrder, Audio_Inform, Audio_ID, Audio_ID_String, Audio_UniqueID, Audio_UniqueID_String, Audio_MenuID, Audio_MenuID_String, Audio_Format, Audio_Format_Info, Audio_Format_Url, Audio_Format_Commercial, Audio_Format_Commercial_IfAny, Audio_Format_Version, Audio_Format_Profile, Audio_Format_Compression, Audio_Format_Settings, Audio_Format_Settings_SBR, Audio_Format_Settings_SBR_String, Audio_Format_Settings_PS, Audio_Format_Settings_PS_String, Audio_Format_Settings_Mode, Audio_Format_Settings_ModeExtension, Audio_Format_Settings_Emphasis, Audio_Format_Settings_Floor, Audio_Format_Settings_Firm, Audio_Format_Settings_Endianness, Audio_Format_Settings_Sign, Audio_Format_Settings_Law, Audio_Format_Settings_ITU, Audio_Format_Settings_Wrapping, Audio_InternetMediaType, Audio_MuxingMode, Audio_MuxingMode_MoreInfo, Audio_CodecID, Audio_CodecID_String, Audio_CodecID_Info, Audio_CodecID_Hint, Audio_CodecID_Url, Audio_CodecID_Description, Audio_Codec, Audio_Codec_String, Audio_Codec_Family, Audio_Codec_Info, Audio_Codec_Url, Audio_Codec_CC, Audio_Codec_Description, Audio_Codec_Profile, Audio_Codec_Settings, Audio_Codec_Settings_Automatic, Audio_Codec_Settings_Floor, Audio_Codec_Settings_Firm, Audio_Codec_Settings_Endianness, Audio_Codec_Settings_Sign, Audio_Codec_Settings_Law, Audio_Codec_Settings_ITU, Audio_Duration, Audio_Duration_String, Audio_Duration_String1, Audio_Duration_String2, Audio_Duration_String3, Audio_Duration_FirstFrame, Audio_Duration_FirstFrame_String, Audio_Duration_FirstFrame_String1, Audio_Duration_FirstFrame_String2, Audio_Duration_FirstFrame_String3, Audio_Duration_LastFrame, Audio_Duration_LastFrame_String, Audio_Duration_LastFrame_String1, Audio_Duration_LastFrame_String2, Audio_Duration_LastFrame_String3, Audio_Source_Duration, Audio_Source_Duration_String, Audio_Source_Duration_String1, Audio_Source_Duration_String2, Audio_Source_Duration_String3, Audio_Source_Duration_FirstFrame, Audio_Source_Duration_FirstFrame_String, Audio_Source_Duration_FirstFrame_String1, Audio_Source_Duration_FirstFrame_String2, Audio_Source_Duration_FirstFrame_String3, Audio_Source_Duration_LastFrame, Audio_Source_Duration_LastFrame_String, Audio_Source_Duration_LastFrame_String1, Audio_Source_Duration_LastFrame_String2, Audio_Source_Duration_LastFrame_String3, Audio_BitRate_Mode, Audio_BitRate_Mode_String, Audio_BitRate, Audio_BitRate_String, Audio_BitRate_Minimum, Audio_BitRate_Minimum_String, Audio_BitRate_Nominal, Audio_BitRate_Nominal_String, Audio_BitRate_Maximum, Audio_BitRate_Maximum_String, Audio_BitRate_Encoded, Audio_BitRate_Encoded_String, Audio_Channel_s_, Audio_Channel_s__String, Audio_Channel_s__Original, Audio_Channel_s__Original_String, Audio_ChannelPositions, Audio_ChannelPositions_String2, Audio_ChannelLayout, Audio_SamplingRate, Audio_SamplingRate_String, Audio_SamplingCount, Audio_Source_SamplingCount, Audio_FrameRate, Audio_FrameRate_String, Audio_FrameCount, Audio_Source_FrameCount, Audio_Resolution, Audio_Resolution_String, Audio_BitDepth, Audio_BitDepth_String, Audio_Compression_Mode, Audio_Compression_Mode_String, Audio_Compression_Ratio, Audio_Delay, Audio_Delay_String, Audio_Delay_String1, Audio_Delay_String2, Audio_Delay_String3, Audio_Delay_String4, Audio_Delay_Settings, Audio_Delay_DropFrame, Audio_Delay_Source, Audio_Delay_Source_String, Audio_Delay_Original, Audio_Delay_Original_String, Audio_Delay_Original_String1, Audio_Delay_Original_String2, Audio_Delay_Original_String3, Audio_Delay_Original_String4, Audio_Delay_Original_Settings, Audio_Delay_Original_DropFrame, Audio_Delay_Original_Source, Audio_Video_Delay, Audio_Video_Delay_String, Audio_Video_Delay_String1, Audio_Video_Delay_String2, Audio_Video_Delay_String3, Audio_Video_Delay_String4, Audio_Video0_Delay, Audio_Video0_Delay_String, Audio_Video0_Delay_String1, Audio_Video0_Delay_String2, Audio_Video0_Delay_String3, Audio_Video0_Delay_String4, Audio_ReplayGain_Gain, Audio_ReplayGain_Gain_String, Audio_ReplayGain_Peak, Audio_StreamSize, Audio_StreamSize_String, Audio_StreamSize_String1, Audio_StreamSize_String2, Audio_StreamSize_String3, Audio_StreamSize_String4, Audio_StreamSize_String5, Audio_StreamSize_Proportion, Audio_Source_StreamSize, Audio_Source_StreamSize_String, Audio_Source_StreamSize_String1, Audio_Source_StreamSize_String2, Audio_Source_StreamSize_String3, Audio_Source_StreamSize_String4, Audio_Source_StreamSize_String5, Audio_Source_StreamSize_Proportion, Audio_StreamSize_Encoded, Audio_StreamSize_Encoded_String, Audio_StreamSize_Encoded_String1, Audio_StreamSize_Encoded_String2, Audio_StreamSize_Encoded_String3, Audio_StreamSize_Encoded_String4, Audio_StreamSize_Encoded_String5, Audio_StreamSize_Encoded_Proportion, Audio_Source_StreamSize_Encoded, Audio_Source_StreamSize_Encoded_String, Audio_Source_StreamSize_Encoded_String1, Audio_Source_StreamSize_Encoded_String2, Audio_Source_StreamSize_Encoded_String3, Audio_Source_StreamSize_Encoded_String4, Audio_Source_StreamSize_Encoded_String5, Audio_Source_StreamSize_Encoded_Proportion, Audio_Alignment, Audio_Alignment_String, Audio_Interleave_VideoFrames, Audio_Interleave_Duration, Audio_Interleave_Duration_String, Audio_Interleave_Preload, Audio_Interleave_Preload_String, Audio_Title, Audio_Encoded_Library, Audio_Encoded_Library_String, Audio_Encoded_Library_Name, Audio_Encoded_Library_Version, Audio_Encoded_Library_Date, Audio_Encoded_Library_Settings, Audio_Language, Audio_Language_String, Audio_Language_String1, Audio_Language_String2, Audio_Language_String3, Audio_Language_String4, Audio_Language_More, Audio_Default, Audio_Default_String, Audio_Forced, Audio_Forced_String, Audio_Encoded_Date, Audio_Tagged_Date, Audio_Encryption, }; //--------------------------------------------------------------------------- enum text { Text_Count, Text_Status, Text_StreamCount, Text_StreamKind, Text_StreamKind_String, Text_StreamKindID, Text_StreamKindPos, Text_StreamOrder, Text_FirstPacketOrder, Text_Inform, Text_ID, Text_ID_String, Text_UniqueID, Text_UniqueID_String, Text_MenuID, Text_MenuID_String, Text_Format, Text_Format_Info, Text_Format_Url, Text_Format_Commercial, Text_Format_Commercial_IfAny, Text_Format_Version, Text_Format_Profile, Text_Format_Compression, Text_Format_Settings, Text_Format_Settings_Wrapping, Text_InternetMediaType, Text_MuxingMode, Text_MuxingMode_MoreInfo, Text_CodecID, Text_CodecID_String, Text_CodecID_Info, Text_CodecID_Hint, Text_CodecID_Url, Text_CodecID_Description, Text_Codec, Text_Codec_String, Text_Codec_Info, Text_Codec_Url, Text_Codec_CC, Text_Duration, Text_Duration_String, Text_Duration_String1, Text_Duration_String2, Text_Duration_String3, Text_Duration_String4, Text_Duration_FirstFrame, Text_Duration_FirstFrame_String, Text_Duration_FirstFrame_String1, Text_Duration_FirstFrame_String2, Text_Duration_FirstFrame_String3, Text_Duration_LastFrame, Text_Duration_LastFrame_String, Text_Duration_LastFrame_String1, Text_Duration_LastFrame_String2, Text_Duration_LastFrame_String3, Text_Source_Duration, Text_Source_Duration_String, Text_Source_Duration_String1, Text_Source_Duration_String2, Text_Source_Duration_String3, Text_Source_Duration_FirstFrame, Text_Source_Duration_FirstFrame_String, Text_Source_Duration_FirstFrame_String1, Text_Source_Duration_FirstFrame_String2, Text_Source_Duration_FirstFrame_String3, Text_Source_Duration_LastFrame, Text_Source_Duration_LastFrame_String, Text_Source_Duration_LastFrame_String1, Text_Source_Duration_LastFrame_String2, Text_Source_Duration_LastFrame_String3, Text_BitRate_Mode, Text_BitRate_Mode_String, Text_BitRate, Text_BitRate_String, Text_BitRate_Minimum, Text_BitRate_Minimum_String, Text_BitRate_Nominal, Text_BitRate_Nominal_String, Text_BitRate_Maximum, Text_BitRate_Maximum_String, Text_BitRate_Encoded, Text_BitRate_Encoded_String, Text_Width, Text_Width_String, Text_Height, Text_Height_String, Text_FrameRate_Mode, Text_FrameRate_Mode_String, Text_FrameRate, Text_FrameRate_String, Text_FrameRate_Minimum, Text_FrameRate_Minimum_String, Text_FrameRate_Nominal, Text_FrameRate_Nominal_String, Text_FrameRate_Maximum, Text_FrameRate_Maximum_String, Text_FrameRate_Original, Text_FrameRate_Original_String, Text_FrameCount, Text_Source_FrameCount, Text_ColorSpace, Text_ChromaSubsampling, Text_Resolution, Text_Resolution_String, Text_BitDepth, Text_BitDepth_String, Text_Compression_Mode, Text_Compression_Mode_String, Text_Compression_Ratio, Text_Delay, Text_Delay_String, Text_Delay_String1, Text_Delay_String2, Text_Delay_String3, Text_Delay_String4, Text_Delay_Settings, Text_Delay_DropFrame, Text_Delay_Source, Text_Delay_Source_String, Text_Delay_Original, Text_Delay_Original_String, Text_Delay_Original_String1, Text_Delay_Original_String2, Text_Delay_Original_String3, Text_Delay_Original_String4, Text_Delay_Original_Settings, Text_Delay_Original_DropFrame, Text_Delay_Original_Source, Text_Video_Delay, Text_Video_Delay_String, Text_Video_Delay_String1, Text_Video_Delay_String2, Text_Video_Delay_String3, Text_Video_Delay_String4, Text_Video0_Delay, Text_Video0_Delay_String, Text_Video0_Delay_String1, Text_Video0_Delay_String2, Text_Video0_Delay_String3, Text_Video0_Delay_String4, Text_StreamSize, Text_StreamSize_String, Text_StreamSize_String1, Text_StreamSize_String2, Text_StreamSize_String3, Text_StreamSize_String4, Text_StreamSize_String5, Text_StreamSize_Proportion, Text_Source_StreamSize, Text_Source_StreamSize_String, Text_Source_StreamSize_String1, Text_Source_StreamSize_String2, Text_Source_StreamSize_String3, Text_Source_StreamSize_String4, Text_Source_StreamSize_String5, Text_Source_StreamSize_Proportion, Text_StreamSize_Encoded, Text_StreamSize_Encoded_String, Text_StreamSize_Encoded_String1, Text_StreamSize_Encoded_String2, Text_StreamSize_Encoded_String3, Text_StreamSize_Encoded_String4, Text_StreamSize_Encoded_String5, Text_StreamSize_Encoded_Proportion, Text_Source_StreamSize_Encoded, Text_Source_StreamSize_Encoded_String, Text_Source_StreamSize_Encoded_String1, Text_Source_StreamSize_Encoded_String2, Text_Source_StreamSize_Encoded_String3, Text_Source_StreamSize_Encoded_String4, Text_Source_StreamSize_Encoded_String5, Text_Source_StreamSize_Encoded_Proportion, Text_Title, Text_Encoded_Library, Text_Encoded_Library_String, Text_Encoded_Library_Name, Text_Encoded_Library_Version, Text_Encoded_Library_Date, Text_Encoded_Library_Settings, Text_Language, Text_Language_String, Text_Language_String1, Text_Language_String2, Text_Language_String3, Text_Language_String4, Text_Language_More, Text_Default, Text_Default_String, Text_Forced, Text_Forced_String, Text_Summary, Text_Encoded_Date, Text_Tagged_Date, Text_Encryption, }; //--------------------------------------------------------------------------- enum other { Other_Count, Other_Status, Other_StreamCount, Other_StreamKind, Other_StreamKind_String, Other_StreamKindID, Other_StreamKindPos, Other_StreamOrder, Other_FirstPacketOrder, Other_Inform, Other_ID, Other_ID_String, Other_UniqueID, Other_UniqueID_String, Other_MenuID, Other_MenuID_String, Other_Type, Other_Format, Other_Format_Info, Other_Format_Url, Other_Format_Commercial, Other_Format_Commercial_IfAny, Other_Format_Version, Other_Format_Profile, Other_Format_Compression, Other_Format_Settings, Other_MuxingMode, Other_CodecID, Other_CodecID_String, Other_CodecID_Info, Other_CodecID_Hint, Other_CodecID_Url, Other_CodecID_Description, Other_Duration, Other_Duration_String, Other_Duration_String1, Other_Duration_String2, Other_Duration_String3, Other_Duration_Start, Other_Duration_End, Other_FrameRate, Other_FrameRate_String, Other_FrameCount, Other_TimeStamp_FirstFrame, Other_TimeStamp_FirstFrame_String, Other_TimeStamp_FirstFrame_String1, Other_TimeStamp_FirstFrame_String2, Other_TimeStamp_FirstFrame_String3, Other_TimeCode_FirstFrame, Other_TimeCode_Settings, Other_Title, Other_Language, Other_Language_String, Other_Language_String1, Other_Language_String2, Other_Language_String3, Other_Language_String4, Other_Language_More, }; //--------------------------------------------------------------------------- enum image { Image_Count, Image_Status, Image_StreamCount, Image_StreamKind, Image_StreamKind_String, Image_StreamKindID, Image_StreamKindPos, Image_StreamOrder, Image_FirstPacketOrder, Image_Inform, Image_ID, Image_ID_String, Image_UniqueID, Image_UniqueID_String, Image_MenuID, Image_MenuID_String, Image_Title, Image_Format, Image_Format_Info, Image_Format_Url, Image_Format_Commercial, Image_Format_Commercial_IfAny, Image_Format_Version, Image_Format_Profile, Image_Format_Compression, Image_Format_Settings, Image_Format_Settings_Wrapping, Image_InternetMediaType, Image_CodecID, Image_CodecID_String, Image_CodecID_Info, Image_CodecID_Hint, Image_CodecID_Url, Image_CodecID_Description, Image_Codec, Image_Codec_String, Image_Codec_Family, Image_Codec_Info, Image_Codec_Url, Image_Width, Image_Width_String, Image_Width_Offset, Image_Width_Offset_String, Image_Width_Original, Image_Width_Original_String, Image_Height, Image_Height_String, Image_Height_Offset, Image_Height_Offset_String, Image_Height_Original, Image_Height_Original_String, Image_PixelAspectRatio, Image_PixelAspectRatio_String, Image_PixelAspectRatio_Original, Image_PixelAspectRatio_Original_String, Image_DisplayAspectRatio, Image_DisplayAspectRatio_String, Image_DisplayAspectRatio_Original, Image_DisplayAspectRatio_Original_String, Image_ColorSpace, Image_ChromaSubsampling, Image_Resolution, Image_Resolution_String, Image_BitDepth, Image_BitDepth_String, Image_Compression_Mode, Image_Compression_Mode_String, Image_Compression_Ratio, Image_StreamSize, Image_StreamSize_String, Image_StreamSize_String1, Image_StreamSize_String2, Image_StreamSize_String3, Image_StreamSize_String4, Image_StreamSize_String5, Image_StreamSize_Proportion, Image_Encoded_Library, Image_Encoded_Library_String, Image_Encoded_Library_Name, Image_Encoded_Library_Version, Image_Encoded_Library_Date, Image_Encoded_Library_Settings, Image_Language, Image_Language_String, Image_Language_String1, Image_Language_String2, Image_Language_String3, Image_Language_String4, Image_Language_More, Image_Default, Image_Default_String, Image_Forced, Image_Forced_String, Image_Summary, Image_Encoded_Date, Image_Tagged_Date, Image_Encryption, Image_colour_description_present, Image_colour_primaries, Image_transfer_characteristics, Image_matrix_coefficients, Image_colour_description_present_Original, Image_colour_primaries_Original, Image_transfer_characteristics_Original, Image_matrix_coefficients_Original, }; //--------------------------------------------------------------------------- enum menu { Menu_Count, Menu_Status, Menu_StreamCount, Menu_StreamKind, Menu_StreamKind_String, Menu_StreamKindID, Menu_StreamKindPos, Menu_StreamOrder, Menu_FirstPacketOrder, Menu_Inform, Menu_ID, Menu_ID_String, Menu_UniqueID, Menu_UniqueID_String, Menu_MenuID, Menu_MenuID_String, Menu_Format, Menu_Format_Info, Menu_Format_Url, Menu_Format_Commercial, Menu_Format_Commercial_IfAny, Menu_Format_Version, Menu_Format_Profile, Menu_Format_Compression, Menu_Format_Settings, Menu_CodecID, Menu_CodecID_String, Menu_CodecID_Info, Menu_CodecID_Hint, Menu_CodecID_Url, Menu_CodecID_Description, Menu_Codec, Menu_Codec_String, Menu_Codec_Info, Menu_Codec_Url, Menu_Duration, Menu_Duration_String, Menu_Duration_String1, Menu_Duration_String2, Menu_Duration_String3, Menu_Duration_Start, Menu_Duration_End, Menu_Delay, Menu_Delay_String, Menu_Delay_String1, Menu_Delay_String2, Menu_Delay_String3, Menu_Delay_String4, Menu_Delay_Settings, Menu_Delay_DropFrame, Menu_Delay_Source, Menu_List_StreamKind, Menu_List_StreamPos, Menu_List, Menu_List_String, Menu_Title, Menu_Language, Menu_Language_String, Menu_Language_String1, Menu_Language_String2, Menu_Language_String3, Menu_Language_String4, Menu_Language_More, Menu_ServiceName, Menu_ServiceChannel, Menu_Service_Url, Menu_ServiceProvider, Menu_ServiceProviderr_Url, Menu_ServiceType, Menu_NetworkName, Menu_Original_NetworkName, Menu_Countries, Menu_TimeZones, Menu_LawRating, Menu_LawRating_Reason, Menu_Chapters_Pos_Begin, Menu_Chapters_Pos_End, }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/File__Analyze.cpp100777 0 0 366405 12254107630 15035 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "MediaInfo/MediaInfo_Config.h" #if MEDIAINFO_IBI #if MEDIAINFO_SEEK #include "MediaInfo/Multiple/File_Ibi.h" #endif //MEDIAINFO_SEEK #include "MediaInfo/Multiple/File_Ibi_Creation.h" #endif //MEDIAINFO_IBI #include using namespace std; using namespace tinyxml2; #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events_Internal.h" #endif //MEDIAINFO_EVENTS //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- extern MediaInfo_Config Config; //--------------------------------------------------------------------------- //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File__Analyze::File__Analyze () :File__Base() { //Info for speed optimization #if MEDIAINFO_TRACE Config_Trace_Level=MediaInfoLib::Config.Trace_Level_Get(); Config_Trace_Layers=MediaInfoLib::Config.Trace_Layers_Get(); Config_Trace_Format=MediaInfoLib::Config.Trace_Format_Get(); Trace_DoNotSave=false; Trace_Layers.set(); Trace_Layers_Update(); #endif //MEDIAINFO_TRACE Config_Demux=MediaInfoLib::Config.Demux_Get(); Config_LineSeparator=MediaInfoLib::Config.LineSeparator_Get(); IsSub=false; IsRawStream=false; //In #if MEDIAINFO_EVENTS StreamIDs_Size=1; ParserIDs[0]=0x0; StreamIDs[0]=0; StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_Level=1; //Frame Demux_random_access=false; Demux_UnpacketizeContainer=false; Demux_IntermediateItemFound=true; Demux_Offset=0; Demux_TotalBytes=0; Demux_EventWasSent_Accept_Specific=false; #endif //MEDIAINFO_DEMUX PTS_DTS_Needed=false; PTS_Begin=(int64u)-1; PTS_End=0; DTS_Begin=(int64u)-1; DTS_End=0; Offsets_Pos=(size_t)-1; OriginalBuffer=NULL; OriginalBuffer_Size=0; OriginalBuffer_Capacity=0; //Out Frame_Count=0; Frame_Count_Previous=0; Frame_Count_InThisBlock=0; Field_Count=0; Field_Count_Previous=0; Field_Count_InThisBlock=0; Frame_Count_NotParsedIncluded=(int64u)-1; FrameNumber_PresentationOrder=(int64u)-1; //Configuration DataMustAlwaysBeComplete=true; MustUseAlternativeParser=false; MustSynchronize=false; CA_system_ID_MustSkipSlices=false; //Buffer #if MEDIAINFO_SEEK Seek_Duration_Detected=false; #endif //MEDIAINFO_SEEK Buffer=NULL; Buffer_Temp=NULL; Buffer_Size=0; Buffer_Temp_Size=0; Buffer_Temp_Size_Max=0; Buffer_Offset=0; Buffer_Offset_Temp=0; Buffer_MinimumSize=0; Buffer_MaximumSize=16*1024*1024; Buffer_TotalBytes_FirstSynched=0; Buffer_TotalBytes_LastSynched=0; Buffer_TotalBytes=0; if (MediaInfoLib::Config.FormatDetection_MaximumOffset_Get()) Buffer_TotalBytes_FirstSynched_Max=MediaInfoLib::Config.FormatDetection_MaximumOffset_Get(); else Buffer_TotalBytes_FirstSynched_Max=1024*1024; if (Buffer_TotalBytes_FirstSynched_Max<(int64u)-1-64*1024*1024) Buffer_TotalBytes_Fill_Max=Buffer_TotalBytes_FirstSynched_Max+64*1024*1024; else Buffer_TotalBytes_Fill_Max=(int64u)-1; Buffer_PaddingBytes=0; Buffer_JunkBytes=0; Stream_BitRateFromContainer=0; //EOF EOF_AlreadyDetected=(MediaInfoLib::Config.ParseSpeed_Get()==1.0)?true:false; //Synchro MustParseTheHeaderFile=true; Synched=false; UnSynched_IsNotJunk=false; MustExtendParsingDuration=false; Trusted=Error; Trusted_Multiplier=1; //Header Header_Size=0; //Element Element_Offset=0; Element_Size=0; //Elements Element.resize(64); Element[0].Code=0; Element[0].Next=File_Size; Element[0].WaitForMoreData=false; Element[0].UnTrusted=false; Element[0].IsComplete=false; #if MEDIAINFO_TRACE if (Config_Trace_Level!=0) { //ToShow part Element[0].ToShow.Name.clear(); Element[0].ToShow.Info.clear(); Element[0].ToShow.Details.clear(); Element[0].ToShow.NoShow=false; } #endif //MEDIAINFO_TRACE Element_Level_Base=0; Element_Level=0; //BitStream BS=new BitStream_Fast; BT=new BitStream_LE; //Temp Status[IsAccepted]=false; Status[IsFilled]=false; Status[IsUpdated]=false; Status[IsFinished]=false; ShouldContinueParsing=false; //Events data PES_FirstByte_IsAvailable=false; //MD5 #if MEDIAINFO_MD5 MD5=NULL; Md5_ParseUpTo=0; #endif //MEDIAINFO_MD5 Unsynch_Frame_Count=(int64u)-1; #if MEDIAINFO_IBI Config_Ibi_Create=false; Ibi_SynchronizationOffset_Current=0; Ibi_SynchronizationOffset_BeginOfFrame=0; IbiStream=NULL; #endif //MEDIAINFO_IBI } //--------------------------------------------------------------------------- File__Analyze::~File__Analyze () { //Buffer delete[] Buffer_Temp; //Buffer_Temp=NULL; delete[] OriginalBuffer; //BitStream delete BS; //BS=NULL; delete BT; //BS=NULL; #if MEDIAINFO_IBI if (!IsSub) delete IbiStream; //IbiStream=NULL; #endif //MEDIAINFO_IBI } //*************************************************************************** // Open //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Open_Buffer_Init (int64u File_Size_) { //Preparing File_Size=File_Size_; Element[0].Next=File_Size; //Buffer - Global Read_Buffer_Init(); //Integrity if (File_Offset>File_Size) { Reject(); return; //There is a problem } //Jump handling if (File_GoTo!=(int64u)-1) { Open_Buffer_Unsynch(); File_GoTo=(int64u)-1; } //Configuring if (MediaInfoLib::Config.FormatDetection_MaximumOffset_Get()) Buffer_TotalBytes_FirstSynched_Max=MediaInfoLib::Config.FormatDetection_MaximumOffset_Get(); Config->ParseSpeed=MediaInfoLib::Config.ParseSpeed_Get(); if (Config->File_IsSub_Get()) IsSub=true; #if MEDIAINFO_DEMUX if (Demux_Level==1 && !IsSub && Config->Demux_Unpacketize_Get()) //If Demux_Level is Frame { Demux_Level=2; //Container Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX #if MEDIAINFO_EVENTS if (StreamIDs_Size && IsRawStream) StreamIDs[StreamIDs_Size-1]=(int64u)-1; if (!IsSub) { ZtringListList SubFile_IDs; SubFile_IDs.Separator_Set(0, EOL); SubFile_IDs.Separator_Set(1, __T(",")); SubFile_IDs.Write(Config->SubFile_IDs_Get()); if (!SubFile_IDs.empty()) { StreamIDs_Size=1+SubFile_IDs.size(); StreamIDs[SubFile_IDs.size()]=IsRawStream?(int64u)-1:StreamIDs[0]; StreamIDs_Width[SubFile_IDs.size()]=StreamIDs_Width[0]; ParserIDs[SubFile_IDs.size()]=ParserIDs[0]; for (size_t Pos=0; PosIbi_Create_Get() && Config->ParseSpeed==1.0; if (Config_Ibi_Create && !IsSub && IbiStream==NULL) IbiStream=new ibi::stream; #endif //MEDIAINFO_IBI } void File__Analyze::Open_Buffer_Init (File__Analyze* Sub) { Open_Buffer_Init(Sub, File_Size); } void File__Analyze::Open_Buffer_Init (File__Analyze* Sub, int64u File_Size_) { //Integrity if (Sub==NULL) return; //Parsing #if MEDIAINFO_TRACE Sub->Init(Config, Details); #else //MEDIAINFO_TRACE Sub->Init(Config); #endif //MEDIAINFO_TRACE #if MEDIAINFO_EVENTS Sub->ParserIDs[StreamIDs_Size]=Sub->ParserIDs[0]; Sub->StreamIDs_Width[StreamIDs_Size]=Sub->StreamIDs_Width[0]; for (size_t Pos=0; PosParserIDs[Pos]=ParserIDs[Pos]; Sub->StreamIDs[Pos]=StreamIDs[Pos]; Sub->StreamIDs_Width[Pos]=StreamIDs_Width[Pos]; } Sub->StreamIDs[StreamIDs_Size-1]=Element_Code; Sub->StreamIDs_Size=StreamIDs_Size+1; #endif //MEDIAINFO_EVENTS Sub->IsSub=true; Sub->File_Name_WithoutDemux=IsSub?File_Name_WithoutDemux:File_Name; Sub->Open_Buffer_Init(File_Size_); } //--------------------------------------------------------------------------- void File__Analyze::Open_Buffer_Continue (const int8u* ToAdd, size_t ToAdd_Size) { //Deleyed events #if MEDIAINFO_DEMUX if (Config->Events_Delayed_CurrentSource) { File__Analyze* Temp=Config->Events_Delayed_CurrentSource; Config->Events_Delayed_CurrentSource=NULL; Config->Event_Accepted(Temp); if (Config->Events_Delayed_CurrentSource) return; } #endif //MEDIAINFO_DEMUX Frame_Count_InThisBlock=0; //MD5 #if MEDIAINFO_MD5 if (ToAdd_Size) { if (!IsSub && !Buffer_Temp_Size && File_Offset==Config->File_Current_Offset && Config->File_Md5_Get()) { delete MD5; MD5=new struct MD5Context; MD5Init(MD5); } if (MD5) MD5Update(MD5, ToAdd, (unsigned int)ToAdd_Size); } #endif //MEDIAINFO_MD5 //Integrity if (Status[IsFinished]) return; //{File F; F.Open(Ztring(__T("d:\\direct"))+Ztring::ToZtring((size_t)this, 16), File::Access_Write_Append); F.Write(ToAdd, ToAdd_Size);} //Demand to go elsewhere if (File_GoTo!=(int64u)-1) { if (File_GoTo=File_Offset+ToAdd_Size) { File_Offset+=ToAdd_Size; return; //No need of this piece of data } } #if MEDIAINFO_MD5 //MD5 parsing only if (Md5_ParseUpTo>File_Offset+Buffer_Size+ToAdd_Size) { File_Offset+=ToAdd_Size; return; //No need of this piece of data } if (Md5_ParseUpTo>File_Offset && Md5_ParseUpTo<=File_Offset+ToAdd_Size) { Buffer_Offset+=(size_t)(Md5_ParseUpTo-File_Offset); Md5_ParseUpTo=0; } #endif //MEDIAINFO_MD5 if (Buffer_Temp_Size) //There is buffered data from before { //Allocating new buffer if needed if (Buffer_Temp_Size+ToAdd_Size>Buffer_Temp_Size_Max) { int8u* Old=Buffer_Temp; size_t Buffer_Temp_Size_Max_ToAdd=ToAdd_Size>32768?ToAdd_Size:32768; if (Buffer_Temp_Size_Max_ToAdd0) { std::memcpy(Buffer_Temp+Buffer_Size, ToAdd, ToAdd_Size); Buffer_Temp_Size+=ToAdd_Size; } //Buffer Buffer=Buffer_Temp; Buffer_Size=Buffer_Temp_Size; } else { Buffer=ToAdd; Buffer_Size=ToAdd_Size; } //Preparing Trusted=(Buffer_Size>2*8*1024?Buffer_Size/8/1024:2)*Trusted_Multiplier; //Never less than 2 acceptable errors //Demand to go elsewhere if (File_GoTo!=(int64u)-1) { //The needed offset is in the new buffer Buffer_Offset+=(size_t)(File_GoTo-File_Offset); File_GoTo=(int64u)-1; } //Parsing if (!IsSub) Config->State_Set(Config->File_Size?(((float)Buffer_TotalBytes)/Config->File_Size):1); if (Buffer_Size>=Buffer_MinimumSize || File_Offset+Buffer_Size==File_Size) //Parsing only if we have enough buffer while (Open_Buffer_Continue_Loop()); //MD5 #if MEDIAINFO_MD5 if (Md5_ParseUpTo>File_Size) Md5_ParseUpTo=File_Size; if (MD5 && File_Offset+Buffer_Size>=Config->File_Current_Size && Status[IsAccepted]) { unsigned char Digest[16]; MD5Final(Digest, MD5); Ztring Temp; Temp+=Ztring().From_CC2(BigEndian2int16u(Digest+ 0)); Temp+=Ztring().From_CC2(BigEndian2int16u(Digest+ 2)); Temp+=Ztring().From_CC2(BigEndian2int16u(Digest+ 4)); Temp+=Ztring().From_CC2(BigEndian2int16u(Digest+ 6)); Temp+=Ztring().From_CC2(BigEndian2int16u(Digest+ 8)); Temp+=Ztring().From_CC2(BigEndian2int16u(Digest+10)); Temp+=Ztring().From_CC2(BigEndian2int16u(Digest+12)); Temp+=Ztring().From_CC2(BigEndian2int16u(Digest+14)); Temp.MakeLowerCase(); const char* MD5Pos=Config->File_Names.size()>1?"Source_List_MD5_Generated":"MD5_Generated"; if (Config->File_Names_Pos<=1 && !Retrieve(Stream_General, 0, MD5Pos).empty() && Retrieve(Stream_General, 0, MD5Pos)==Temp) Clear(Stream_General, 0, MD5Pos); Fill(Stream_General, 0, MD5Pos, Temp); if (Config->File_Names_Pos<=1) (*Stream_More)[Stream_General][0](Ztring().From_Local(MD5Pos), Info_Options)=__T("N NT"); delete MD5; MD5=NULL; } if (MD5 && File_GoTo!=(int64u)-1) { delete MD5; MD5=NULL; //MD5 not possible with a seek } if (MD5 && Buffer_Offset>Buffer_Size) { //We need the next data Md5_ParseUpTo=File_Offset+Buffer_Offset; Buffer_Offset=Buffer_Size; } #endif //MEDIAINFO_MD5 //Should parse again? if (((File_GoTo==File_Size && File_Size!=(int64u)-1) || File_Offset+Buffer_Offset>=File_Size) #if MEDIAINFO_DEMUX && !Config->Demux_EventWasSent #endif //MEDIAINFO_DEMUX ) { if (!BookMark_Code.empty()) BookMark_Get(); if (File_GoTo>=File_Size) { Element_Show(); //If Element_Level is >0, we must show what is in the details buffer while (Element_Level>0) Element_End0(); //This is Finish, must flush Buffer_Clear(); File_Offset=File_Size; if (!IsSub && !Config->File_Names.empty()) { if (Config->File_Sizes.size()>=Config->File_Names.size()) Config->File_Current_Size=Config->File_Sizes[Config->File_Names.size()-1]; Config->File_Current_Offset=Config->File_Current_Size; Config->File_Names_Pos=Config->File_Names.size()-1; } ForceFinish(); return; } } //Demand to go elsewhere if (File_GoTo!=(int64u)-1) { if (Config->File_IsSeekable_Get()) { if (File_GoTo>=File_Size) File_GoTo=File_Size; Buffer_Clear(); } else File_Offset+=Buffer_Offset; return; } #if MEDIAINFO_MD5 if (Md5_ParseUpTo) { Buffer_Clear(); return; } #endif //MEDIAINFO_MD5 if (Buffer_Offset>=Buffer_Size #if MEDIAINFO_MD5 && MD5==NULL #endif //MEDIAINFO_MD5 ) { if (Buffer_Offset>Buffer_Size) File_GoTo=File_Offset+Buffer_Offset; Buffer_Clear(); return; } //Buffer handling if (Buffer_Size && Buffer_Offset<=Buffer_Size) //all is not used { if (File_Offset+Buffer_Size>=File_Size //No more data will come #if MEDIAINFO_DEMUX && !Config->Demux_EventWasSent #endif //MEDIAINFO_DEMUX ) { ForceFinish(); #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) return; #endif //MEDIAINFO_DEMUX } if (Buffer_Temp_Size==0) //If there was no copy { #if MEDIAINFO_DEMUX if (!IsSub && Config->Demux_EventWasSent && Config->File_Buffer_Repeat_IsSupported && Buffer_Offset==0) //If there was no byte consumed { Config->File_Buffer_Repeat=true; } else #endif //MEDIAINFO_DEMUX { if (Buffer_Temp!=NULL && Buffer_Temp_Size_Max32768?ToAdd_Size-Buffer_Offset:32768; if (Buffer_Temp_Size_Max_ToAdd=FrameInfo.Buffer_Offset_End && FrameInfo_Next.DTS!=(int64u)-1) { FrameInfo=FrameInfo_Next; FrameInfo_Next=frame_info(); } float64 Ratio=1; if (OriginalBuffer) { Ratio=((float64)OriginalBuffer_Size)/Buffer_Size; size_t Temp_Size=(size_t)float64_int64s(((float64)Buffer_Offset)*Ratio); OriginalBuffer_Size-=Temp_Size; memmove(OriginalBuffer, OriginalBuffer+Buffer_Offset, OriginalBuffer_Size); } Buffer_Size-=Buffer_Offset; File_Offset+=Buffer_Offset; if (Buffer_Offset_Temp>=Buffer_Offset) Buffer_Offset_Temp-=Buffer_Offset; if (FrameInfo.Buffer_Offset_End!=(int64u)-1 && FrameInfo.Buffer_Offset_End>=Buffer_Offset) FrameInfo.Buffer_Offset_End-=Buffer_Offset; if (FrameInfo_Next.Buffer_Offset_End!=(int64u)-1 && FrameInfo_Next.Buffer_Offset_End>=Buffer_Offset) FrameInfo_Next.Buffer_Offset_End-=Buffer_Offset; if (!Offsets_Buffer.empty()) { if (Offsets_Buffer.size()>=2 && Offsets_Buffer.size()%2==0 && Offsets_Buffer[0]==Offsets_Buffer[1]) { size_t Pos=Offsets_Buffer.size()-2; do { if (Offsets_Buffer[Pos]>Buffer_Offset) { Offsets_Buffer[Pos]-=Buffer_Offset; Offsets_Buffer[Pos+1]-=Buffer_Offset; } else { Offsets_Stream[Pos]+=float64_int64s(Buffer_Offset*Ratio/2)-Offsets_Buffer[Pos]; Offsets_Stream[Pos+1]+=float64_int64s(Buffer_Offset*Ratio/2)-Offsets_Buffer[Pos+1]; Offsets_Buffer[Pos]=0; Offsets_Buffer[Pos+1]=0; Offsets_Buffer.erase(Offsets_Buffer.begin(), Offsets_Buffer.begin()+Pos); Offsets_Stream.erase(Offsets_Stream.begin(), Offsets_Stream.begin()+Pos); if (Offsets_Pos!=(size_t)-1 && Pos) { if (PosBuffer_Offset*Ratio) Offsets_Buffer[Pos]-=float64_int64s(Buffer_Offset*Ratio); else { Offsets_Stream[Pos]+=float64_int64s(Buffer_Offset*Ratio)-Offsets_Buffer[Pos]; Offsets_Buffer[Pos]=0; Offsets_Buffer.erase(Offsets_Buffer.begin(), Offsets_Buffer.begin()+Pos); Offsets_Stream.erase(Offsets_Stream.begin(), Offsets_Stream.begin()+Pos); if (Offsets_Pos!=(size_t)-1 && Pos) { if (PosBuffer_MaximumSize) { #if MEDIAINFO_MD5 if (Config->File_Md5_Get() && MD5 && Status[IsAccepted]) { Buffer_Clear(); Md5_ParseUpTo=File_Size; } else #endif //MEDIAINFO_MD5 ForceFinish(); return; } } void File__Analyze::Open_Buffer_Continue (File__Analyze* Sub, const int8u* ToAdd, size_t ToAdd_Size, bool IsNewPacket, float64 Ratio) { if (Sub==NULL) return; //Sub if (Sub->File_GoTo!=(int64u)-1) Sub->File_GoTo=(int64u)-1; Sub->File_Offset=File_Offset+Buffer_Offset+Element_Offset; if (Sub->File_Size!=File_Size) { for (size_t Pos=0; Pos<=Sub->Element_Level; Pos++) if (Sub->Element[Pos].Next==Sub->File_Size) Sub->Element[Pos].Next=File_Size; Sub->File_Size=File_Size; } #if MEDIAINFO_TRACE Sub->Element_Level_Base=Element_Level_Base+Element_Level; #endif //{File F; F.Open(Ztring(__T("d:\\direct"))+Ztring::ToZtring((size_t)this, 16), File::Access_Write_Append); F.Write(ToAdd, ToAdd_Size);} //Adaptating File_Offset if (Sub!=this && Sub->Buffer_Size<=Sub->File_Offset) Sub->File_Offset-=Sub->Buffer_Size; //Parsing Sub->PES_FirstByte_IsAvailable=PES_FirstByte_IsAvailable; Sub->PES_FirstByte_Value=PES_FirstByte_Value; if (IsNewPacket && ToAdd_Size) { if (Offsets_Stream.empty()) { Sub->Offsets_Stream.push_back(File_Offset+float64_int64s((Buffer_Offset+Element_Offset)*Ratio)); Sub->Offsets_Buffer.push_back(Sub->Buffer_Size); } else { if (Offsets_Buffer[0]>=Buffer_Offset-Header_Size && (Sub->Offsets_Stream.empty() || Sub->Offsets_Stream[Sub->Offsets_Stream.size()-1]+Sub->Buffer_Size-Sub->Offsets_Buffer[Sub->Offsets_Stream.size()-1]!=Offsets_Stream[0])) { if ((Buffer_Offset-Header_Size)*RatioOffsets_Stream.push_back(Offsets_Stream[0]); Sub->Offsets_Buffer.push_back((Sub->OriginalBuffer_Size?Sub->OriginalBuffer_Size:Sub->Buffer_Size)+Offsets_Buffer[0]-(Buffer_Offset+Element_Offset)); } else { Sub->Offsets_Stream.push_back(Offsets_Stream[0]+Buffer_Offset+Element_Offset-Offsets_Buffer[0]); Sub->Offsets_Buffer.push_back(Sub->OriginalBuffer_Size?Sub->OriginalBuffer_Size:Sub->Buffer_Size); } } for (size_t Pos=1; Pos=Buffer_Offset+Element_Offset && Offsets_Buffer[Pos]Offsets_Stream.push_back(Offsets_Stream[Pos]); Sub->Offsets_Buffer.push_back((Sub->OriginalBuffer_Size?Sub->OriginalBuffer_Size:Sub->Buffer_Size)+Offsets_Buffer[Pos]-(Buffer_Offset+Element_Offset)); } else { Sub->Offsets_Stream.push_back(Offsets_Stream[Pos]+Buffer_Offset+Element_Offset-Offsets_Buffer[Pos]); Sub->Offsets_Buffer.push_back(Sub->OriginalBuffer_Size?Sub->OriginalBuffer_Size:Sub->Buffer_Size); } } } } if (Ratio!=1) { if (Sub->OriginalBuffer_Size+Element_Size-Element_Offset>Sub->OriginalBuffer_Capacity) { int8u* Temp=Sub->OriginalBuffer; Sub->OriginalBuffer_Capacity=(size_t)(Sub->OriginalBuffer_Size+Element_Size-Element_Offset); Sub->OriginalBuffer=new int8u[Sub->OriginalBuffer_Capacity]; std::memcpy(Sub->OriginalBuffer, Temp, Sub->OriginalBuffer_Size); delete[] Temp; } std::memcpy(Sub->OriginalBuffer+Sub->OriginalBuffer_Size, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); Sub->OriginalBuffer_Size+=(size_t)(Element_Size-Element_Offset); } if (Sub->FrameInfo.DTS!=(int64u)-1) Sub->FrameInfo.Buffer_Offset_End=Sub->Buffer_Offset+Sub->Buffer_Size+ToAdd_Size; else if (Sub->FrameInfo_Previous.DTS!=(int64u)-1) Sub->FrameInfo_Previous.Buffer_Offset_End=Sub->Buffer_Offset+Sub->Buffer_Size+ToAdd_Size; if (Sub->FrameInfo_Previous.DTS!=(int64u)-1) { Sub->FrameInfo_Next=Sub->FrameInfo; Sub->FrameInfo=Sub->FrameInfo_Previous; Sub->FrameInfo_Previous=frame_info(); Sub->Frame_Count_Previous=Sub->Frame_Count; Sub->Field_Count_Previous=Sub->Field_Count; } if (Frame_Count_NotParsedIncluded!=(int64u)-1) Sub->Frame_Count_NotParsedIncluded=Frame_Count_NotParsedIncluded; #if MEDIAINFO_DEMUX bool Demux_EventWasSent_Save=Config->Demux_EventWasSent; Config->Demux_EventWasSent=false; #endif //MEDIAINFO_DEMUX Sub->Open_Buffer_Continue(ToAdd, ToAdd_Size); #if MEDIAINFO_DEMUX if (Demux_EventWasSent_Save) Config->Demux_EventWasSent=true; #endif //MEDIAINFO_DEMUX if (Sub->Buffer_Size) { Sub->FrameInfo_Previous=Sub->FrameInfo; Sub->FrameInfo=Sub->FrameInfo_Next; Sub->FrameInfo_Next=frame_info(); } #if MEDIAINFO_TRACE if (Trace_Activated) { //Details handling if (!Sub->Element[0].ToShow.Details.empty() && !Trace_DoNotSave) { //Line separator if (!Element[Element_Level].ToShow.Details.empty()) Element[Element_Level].ToShow.Details+=Config_LineSeparator; //From Sub while(Sub->Element_Level) Sub->Element_End0(); Element[Element_Level].ToShow.Details+=Sub->Element[0].ToShow.Details; Sub->Element[0].ToShow.Details.clear(); } else Element[Element_Level].ToShow.NoShow=true; //We don't want to show this item because there is no info in it } #endif } //--------------------------------------------------------------------------- bool File__Analyze::Open_Buffer_Continue_Loop () { //Header if (MustParseTheHeaderFile) { if (!FileHeader_Manage()) return false; //Wait for more data if (Status[IsFinished] || File_GoTo!=(int64u)-1) return false; //Finish } //Parsing specific Element_Offset=0; Element_Size=Buffer_Size; Element[Element_Level].WaitForMoreData=false; Read_Buffer_Continue(); if (Element_IsWaitingForMoreData()) return false; //Wait for more data if (sizeof(size_t)=(int64u)(size_t)-1) GoTo(File_Offset+Buffer_Offset+Element_Offset); else Buffer_Offset+=(size_t)Element_Offset; if ((Status[IsFinished] && !ShouldContinueParsing) || Buffer_Offset>Buffer_Size || File_GoTo!=(int64u)-1) return false; //Finish #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) return false; #endif //MEDIAINFO_DEMUX //Parsing; while (Buffer_OffsetDemux_EventWasSent) return false; #endif //MEDIAINFO_DEMUX //Parsing specific Read_Buffer_AfterParsing(); //Handling of File_GoTo with already buffered data #if MEDIAINFO_MD5 if (File_GoTo==(int64u)-1 && Md5_ParseUpTo && Md5_ParseUpTo>=File_Offset && Md5_ParseUpTo=File_Offset && File_GoTo32768?Buffer_Temp_Size:32768; if (Buffer_Temp_Size_Max_ToAddParseSpeed<1 && Count_Get(Stream_General)) { Element[Element_Level].WaitForMoreData=false; Detect_EOF(); if ((File_GoTo!=(int64u)-1 && File_GoTo>File_Offset+Buffer_Offset) || (Status[IsFinished] && !ShouldContinueParsing)) { EOF_AlreadyDetected=true; return false; } } return false; } //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File__Analyze::Open_Buffer_Seek (size_t Method, int64u Value, int64u ID) { #if MEDIAINFO_DEMUX Config->Demux_EventWasSent=false; #endif //MEDIAINFO_DEMUX size_t ToReturn=Read_Buffer_Seek(Method, Value, ID); if (File_GoTo!=(int64u)-1) Buffer_Clear(); return ToReturn; } #endif //MEDIAINFO_SEEK //--------------------------------------------------------------------------- void File__Analyze::Open_Buffer_Position_Set (int64u File_Offset_) { if (File_Offset_==(int64u)-1) return; File_Offset=File_Offset_-Buffer_Temp_Size; File_GoTo=(int64u)-1; } //--------------------------------------------------------------------------- void File__Analyze::Open_Buffer_Unsynch () { Status[IsFinished]=false; FrameInfo=frame_info(); FrameInfo_Previous=frame_info(); FrameInfo_Next=frame_info(); Frame_Count_NotParsedIncluded=Unsynch_Frame_Count; Unsynch_Frame_Count=(int64u)-1; PTS_End=0; DTS_End=0; #if MEDIAINFO_DEMUX Demux_IntermediateItemFound=true; Demux_Offset=0; Demux_TotalBytes=Buffer_TotalBytes; Config->Demux_EventWasSent=false; #endif //MEDIAINFO_DEMUX //Clearing duration if (Synched) { for (size_t StreamKind=(size_t)Stream_General; StreamKind<(size_t)Stream_Menu; StreamKind++) { size_t StreamPos_Count=Count_Get((stream_t)StreamKind); for (size_t StreamPos=0; StreamPos0) Element_End0(); //Buffer - Global Fill(); if (!NoBufferModification) { ForceFinish(); #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) return; #endif //MEDIAINFO_DEMUX Buffer_Clear(); } #if MEDIAINFO_TRACE if (Details && Details->empty()) Details->assign(Element[0].ToShow.Details); #endif //MEDIAINFO_TRACE #if MEDIAINFO_EVENTS if (Status[IsAccepted]) { EVENT_BEGIN (General, End, 0) if (Event.StreamIDs_Size>=1) Event.StreamIDs[Event.StreamIDs_Size-1]=(int64u)-1; Event.PCR=(int64u)-1; Event.DTS=(int64u)-1; Event.PTS=(int64u)-1; Event.DUR=(int64u)-1; Event.Stream_Bytes_Analyzed=Buffer_TotalBytes; Event.Stream_Size=File_Size; Event.Stream_Bytes_Padding=Buffer_PaddingBytes; Event.Stream_Bytes_Junk=Buffer_JunkBytes; if (!IsSub && MustSynchronize && !Synched && !UnSynched_IsNotJunk) Event.Stream_Bytes_Junk+=Buffer_TotalBytes+Buffer_Offset-Buffer_TotalBytes_LastSynched; EVENT_END () } #endif //MEDIAINFO_EVENTS } void File__Analyze::Open_Buffer_Finalize (File__Analyze* Sub) { if (Sub==NULL) return; //Finalize Open_Buffer_Init(Sub); Sub->Open_Buffer_Finalize(); } //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File__Analyze::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { #if MEDIAINFO_IBI if (!IsSub) { size_t ReturnValue=Ibi_Read_Buffer_Seek(Method, Value, ID); if (ReturnValue!=(size_t)-1) // If IBI file is supported return ReturnValue; } #endif //MEDIAINFO_IBI //Parsing switch (Method) { case 0 : //Default stream seek (byte offset) GoTo(Value); Open_Buffer_Unsynch(); return 1; case 1 : //Default stream seek (percentage) GoTo(File_Size*Value/10000); Open_Buffer_Unsynch(); return 1; default : return (size_t)-1; //Not supported } } #endif //MEDIAINFO_SEEK //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File__Analyze::Read_Buffer_Seek_OneFramePerFile (size_t Method, int64u Value, int64u ID) { //Parsing switch (Method) { case 0 : { if (Value>=Config->File_Size) return 2; //Invalid value int64u Offset=0; for (size_t Pos=0; PosFile_Sizes.size(); Pos++) { Offset+=Config->File_Sizes[Pos]; if (Offset>=Value) { Offset-=Config->File_Sizes[Pos]; break; } } GoTo(Offset); Open_Buffer_Unsynch(); return 1; } case 1 : { if (Value>=10000) return 2; //Invalid value size_t FilePos=(size_t)((((float32)Value)/10000)*Config->File_Sizes.size()); int64u Offset=0; for (size_t Pos=0; PosFile_Sizes[Pos]; GoTo(Offset); Open_Buffer_Unsynch(); return 1; } case 2 : //Timestamp #if MEDIAINFO_DEMUX if (Config->Demux_Rate_Get()==0) return (size_t)-1; //Not supported Value=float64_int64s(((float64)Value)/1000000000*Config->Demux_Rate_Get()); #else //MEDIAINFO_DEMUX return (size_t)-1; //Not supported #endif //MEDIAINFO_DEMUX case 3 : //FrameNumber { if (Value>=Config->File_Names.size()) return 2; //Invalid value int64u Offset=0; for (size_t Pos=0; PosFile_Sizes[Pos]; GoTo(Offset); Open_Buffer_Unsynch(); return 1; } default : return (size_t)-1; //Not supported } } #endif //MEDIAINFO_SEEK //--------------------------------------------------------------------------- void File__Analyze::Read_Buffer_Unsynched_OneFramePerFile() { int64u GoTo=File_GoTo; for (Frame_Count_NotParsedIncluded=0; Frame_Count_NotParsedIncludedFile_Sizes.size(); Frame_Count_NotParsedIncluded++) { if (GoTo>=Config->File_Sizes[(size_t)Frame_Count_NotParsedIncluded]) GoTo-=Config->File_Sizes[(size_t)Frame_Count_NotParsedIncluded]; else break; } #if MEDIAINFO_DEMUX if (Config->Demux_Rate_Get()) { FrameInfo.DTS=float64_int64s(Frame_Count_NotParsedIncluded*((float64)1000000000)/Config->Demux_Rate_Get()); FrameInfo.PTS=FrameInfo.DTS; } #endif //MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- bool File__Analyze::Buffer_Parse() { //End of this level? if (File_Offset+Buffer_Offset>=Element[Element_Level].Next) { //There is no loop handler, so we make the level down here while (Element_Level>0 && File_Offset+Buffer_Offset>=Element[Element_Level].Next) Element_End0(); //This is a buffer restart, must sync to Element level if (File_Offset+Buffer_Offset==File_Size) return false; //End of file MustUseAlternativeParser=false; //Reset it if we go out of an element } //Synchro if (MustSynchronize) do { if (!Synchro_Manage()) return false; //Wait for more data } while (!Synched); #if MEDIAINFO_DEMUX else if (Demux_TotalBytes<=Buffer_TotalBytes+Buffer_Offset) { if (Demux_UnpacketizeContainer && !Demux_UnpacketizeContainer_Test()) { Demux_Offset-=Buffer_Offset; return false; //Wait for more data } if (Config->Demux_EventWasSent) return false; } #endif //MEDIAINFO_DEMUX //Offsets if (Offsets_Pos==(size_t)-1 && !Offsets_Buffer.empty()) Offsets_Pos=0; if (Offsets_Pos!=(size_t)-1) { while (Offsets_PosOffsets_Buffer[Offsets_Pos]) Offsets_Pos++; if (Offsets_Pos>=Offsets_Buffer.size() || Buffer_Offset!=Offsets_Buffer[Offsets_Pos]) Offsets_Pos--; } //Header if (!Header_Manage()) return false; //Wait for more data //Data if (!Data_Manage()) return false; //Wait for more data Buffer_TotalBytes_LastSynched=Buffer_TotalBytes+Buffer_Offset; return true; } //--------------------------------------------------------------------------- void File__Analyze::Buffer_Clear() { //Buffer BS->Attach(NULL, 0); delete[] Buffer_Temp; Buffer_Temp=NULL; if (!Status[IsFinished]) File_Offset+=Buffer_Size; else { File_Offset=File_Size; if (!IsSub && !Config->File_Names.empty()) { if (Config->File_Sizes.size()>=Config->File_Names.size()) Config->File_Current_Size=Config->File_Sizes[Config->File_Names.size()-1]; Config->File_Current_Offset=Config->File_Current_Size; Config->File_Names_Pos=Config->File_Names.size()-1; } } Buffer_Size=0; Buffer_Temp_Size=0; Buffer_Offset=0; Buffer_Offset_Temp=0; Buffer_MinimumSize=0; OriginalBuffer_Size=0; Offsets_Stream.clear(); Offsets_Buffer.clear(); Offsets_Pos=(size_t)-1; //Details #if MEDIAINFO_TRACE Element[Element_Level].WaitForMoreData=false; //We must finalize the details Element[Element_Level].IsComplete=true; //We must finalize the details #endif //MEDIAINFO_TRACE } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- bool File__Analyze::Synchronize_0x000001() { //Synchronizing while(Buffer_Offset+3<=Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x01)) { Buffer_Offset+=2; while(Buffer_Offset=Buffer_Size) Buffer_Offset--; } //Parsing last bytes if needed if (Buffer_Offset+3==Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x01)) Buffer_Offset++; if (Buffer_Offset+2==Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00)) Buffer_Offset++; if (Buffer_Offset+1==Buffer_Size && Buffer[Buffer_Offset ]!=0x00) Buffer_Offset++; if (Buffer_Offset+3>Buffer_Size) return false; //Synched is OK Synched=true; return true; } //--------------------------------------------------------------------------- bool File__Analyze::FileHeader_Begin_0x000001() { //Element_Size if (Buffer_Size<192*4) return true; //Not enough buffer for a test //Detecting OldDirac/WAV/SWF/FLV/ELF/DPG/WM files int64u Magic8=CC8(Buffer); int32u Magic4=Magic8>>32; int32u Magic3=Magic4>> 8; int16u Magic2=Magic4>>16; if (Magic8==0x4B572D4449524143LL || Magic4==0x52494646 || Magic3==0x465753 || Magic3==0x464C56 || Magic4==0x7F454C46 || Magic4==0x44504730 || Magic4==0x3026B275 || Magic2==0x4D5A || Magic4==0x1A45DFA3) { Reject(); return false; } //GXF if (CC5(Buffer)==0x0000000001 && CC2(Buffer+14)==0xE1E2) { Reject(); return false; } //Detecting MPEG-4 files (ftyp/mdat/skip/free) Magic4=CC4(Buffer+4); switch (Magic4) { case 0x66747970 : //ftyp case 0x6D646174 : //mdat case 0x736B6970 : //skip case 0x66726565 : //free Reject(); return false; default : break; } //Detect TS files, and the parser is not enough precise to detect them later size_t Buffer_Offset=0; while (Buffer_Offset<188 && Buffer[Buffer_Offset]!=0x47) //Look for first Sync word Buffer_Offset++; if (Buffer_Offset<188 && Buffer[Buffer_Offset+188]==0x47 && Buffer[Buffer_Offset+188*2]==0x47 && Buffer[Buffer_Offset+188*3]==0x47) { Status[IsFinished]=true; return false; } Buffer_Offset=0; //Detect BDAV files, and the parser is not enough precise to detect them later while (Buffer_Offset<192 && CC1(Buffer+Buffer_Offset+4)!=0x47) //Look for first Sync word Buffer_Offset++; if (Buffer_Offset<192 && CC1(Buffer+Buffer_Offset+192+4)==0x47 && CC1(Buffer+Buffer_Offset+192*2+4)==0x47 && CC1(Buffer+Buffer_Offset+192*3+4)==0x47) { Status[IsFinished]=true; return false; } Buffer_Offset=0; //All should be OK... return true; } //--------------------------------------------------------------------------- bool File__Analyze::FileHeader_Begin_XML(XMLDocument &Document) { //Element_Size if (File_Size<32 || File_Size>16*1024*1024) { Reject(); return false; //XML files are not expected to be so big } //Element_Size if (Buffer_Size=Buffer_TotalBytes_Fill_Max) { Open_Buffer_Unsynch(); GoToFromEnd(0); return false; } if (!Synchronize()) { if (Status[IsFinished]) Finish(); //Finish if (!IsSub && File_Offset_FirstSynched==(int64u)-1 && Buffer_TotalBytes+Buffer_Offset>=Buffer_TotalBytes_FirstSynched_Max) { Open_Buffer_Unsynch(); GoToFromEnd(0); } return false; //Wait for more data } Synched=true; if (!IsSub) { if (!UnSynched_IsNotJunk) Buffer_JunkBytes+=Buffer_TotalBytes+Buffer_Offset-Buffer_TotalBytes_LastSynched; Buffer_TotalBytes_LastSynched=Buffer_TotalBytes+Buffer_Offset; UnSynched_IsNotJunk=false; } if (File_Offset_FirstSynched==(int64u)-1) { Synched_Init(); Buffer_TotalBytes_FirstSynched+=Buffer_TotalBytes+Buffer_Offset; File_Offset_FirstSynched=File_Offset+Buffer_Offset; } #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) return false; #endif //MEDIAINFO_DEMUX if (!Synchro_Manage_Test()) return false; } return true; } //--------------------------------------------------------------------------- bool File__Analyze::Synchro_Manage_Test() { //Testing if synchro is OK if (Synched) { if (!Synched_Test()) return false; #if MEDIAINFO_DEMUX if (Synched && Demux_TotalBytes<=Buffer_TotalBytes+Buffer_Offset) { if (Demux_UnpacketizeContainer && !Demux_UnpacketizeContainer_Test()) { Demux_Offset-=Buffer_Offset; return false; //Wait for more data } if (Config->Demux_EventWasSent) return false; } #endif //MEDIAINFO_DEMUX if (Buffer_Offset>=FrameInfo.Buffer_Offset_End && FrameInfo_Next.DTS!=(int64u)-1) { FrameInfo=FrameInfo_Next; FrameInfo_Next=frame_info(); } if (Synched) { if (!IsSub) Buffer_TotalBytes_LastSynched=Buffer_TotalBytes+Buffer_Offset; } else { Element[Element_Level].IsComplete=true; //Else the trusting algo will think it Trusted_IsNot("Synchronisation lost"); while (Element_Level) Element_End(); } } //Trying to synchronize if (!Synched) { if (!Synchronize()) { if (Status[IsFinished]) Finish(); //Finish if (!IsSub && File_Offset_FirstSynched==(int64u)-1 && Buffer_TotalBytes+Buffer_Offset>=Buffer_TotalBytes_FirstSynched_Max) Reject(); return false; //Wait for more data } Synched=true; if (!IsSub) { if (!UnSynched_IsNotJunk) Buffer_JunkBytes+=Buffer_TotalBytes+Buffer_Offset-Buffer_TotalBytes_LastSynched; Buffer_TotalBytes_LastSynched=Buffer_TotalBytes+Buffer_Offset; UnSynched_IsNotJunk=false; } if (File_Offset_FirstSynched==(int64u)-1) { Synched_Init(); Buffer_TotalBytes_FirstSynched+=Buffer_TotalBytes+Buffer_Offset; File_Offset_FirstSynched=File_Offset+Buffer_Offset; } if (!Synched_Test()) return false; #if MEDIAINFO_DEMUX if (Synched && Demux_TotalBytes<=Buffer_TotalBytes+Buffer_Offset) { if (Demux_UnpacketizeContainer && !Demux_UnpacketizeContainer_Test()) { Demux_Offset-=Buffer_Offset; return false; //Wait for more data } if (Config->Demux_EventWasSent) return false; } #endif //MEDIAINFO_DEMUX } return true; } //*************************************************************************** // File Header //*************************************************************************** //--------------------------------------------------------------------------- bool File__Analyze::FileHeader_Manage() { //From the parser if (!Status[IsAccepted] && !FileHeader_Begin()) { if (Status[IsFinished]) //Newest parsers set this bool if there is an error Reject(); if (File_Offset+Buffer_Size>=File_Size) Reject(); return false; //Wait for more data } //Positionning if ((Buffer_Size && Buffer_Offset+Element_Offset>Buffer_Size) || (sizeof(size_t)=(int64u)(size_t)-1)) { GoTo(File_Offset+Buffer_Offset+Element_Offset); return false; } else { Buffer_Offset+=(size_t)Element_Offset; Element_Offset=0; } #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) return false; #endif //MEDIAINFO_DEMUX //From the parser Element_Size=Buffer_Size-Buffer_Offset; Element_Begin1("File Header"); FileHeader_Parse(); if (Element_Offset==0) Element_DoNotShow(); Element_End0(); if (Status[IsFinished]) //Newest parsers set this bool if there is an error { Finish(); return false; } //Testing the parser result if (Element_IsWaitingForMoreData() || Element[Element_Level].UnTrusted) //Wait or problem { //The header is not complete, need more data #if MEDIAINFO_TRACE Element[Element_Level].ToShow.Details.clear(); #endif //MEDIAINFO_TRACE return false; } //Positionning if ((Buffer_Size && Buffer_Offset+Element_Offset>Buffer_Size) || (sizeof(size_t)=(int64u)(size_t)-1)) { GoTo(File_Offset+Buffer_Offset+Element_Offset); return false; } else { Buffer_Offset+=(size_t)Element_Offset; Element_Offset=0; } MustParseTheHeaderFile=false; return true; } //*************************************************************************** // Header //*************************************************************************** //--------------------------------------------------------------------------- bool File__Analyze::Header_Manage() { //Test if (Buffer_Offset>=Buffer_Size) return false; //Header begin Element_Size=Element[Element_Level].Next-(File_Offset+Buffer_Offset); Element_Offset=0; if (!Header_Begin()) { //Jumping to the end of the file if needed if (!EOF_AlreadyDetected && Config->ParseSpeed<1 && File_GoTo==(int64u)-1) { Element[Element_Level].WaitForMoreData=false; Detect_EOF(); if ((File_GoTo!=(int64u)-1 && File_GoTo>File_Offset+Buffer_Offset) || (Status[IsFinished] && !ShouldContinueParsing)) EOF_AlreadyDetected=true; } return false; //Wait for more data } //Going in a lower level Element_Size=Element[Element_Level].Next-(File_Offset+Buffer_Offset+Element_Offset); Element[Element_Level].UnTrusted=false; if (Buffer_Offset+Element_Size>Buffer_Size) { Element_Size=Buffer_Size-Buffer_Offset; Element[Element_Level].IsComplete=false; } else Element[Element_Level].IsComplete=true; if (Element_Size==0) return false; Element_Offset=0; Element_Begin0(); //Element #if MEDIAINFO_TRACE Data_Level=Element_Level; #endif //MEDIAINFO_TRACE Element_Begin1("Header"); //Header //Header parsing Header_Parse(); //Testing the parser result if (Element[Element_Level].UnTrusted) //Problem { Element[Element_Level].UnTrusted=false; Header_Fill_Code(0, "Problem"); if (MustSynchronize) { //Unsynchronizing to the next byte Element_Offset=1; Header_Fill_Size(1); Synched=false; } else { //Can not synchronize anymore in this block Element_Offset=Element[Element_Level-2].Next-(File_Offset+Buffer_Offset); Header_Fill_Size(Element_Offset); } } if (Element_IsWaitingForMoreData() || ((DataMustAlwaysBeComplete && Element[Element_Level-1].Next>File_Offset+Buffer_Size) || File_GoTo!=(int64u)-1) //Wait or want to have a comple data chunk #if MEDIAINFO_DEMUX || (Config->Demux_EventWasSent) #endif //MEDIAINFO_DEMUX ) { //The header is not complete, need more data Element[Element_Level].WaitForMoreData=true; Element_End0(); //Header Element_End0(); //Element return false; } //Filling Element[Element_Level].WaitForMoreData=false; Element[Element_Level].IsComplete=true; //ToShow #if MEDIAINFO_TRACE if (Trace_Activated) { if (Element[Element_Level-1].ToShow.Name.empty()) Element[Element_Level-1].ToShow.Name=__T("Unknown"); Element[Element_Level].ToShow.Size=Element_Offset; Element[Element_Level].ToShow.Header_Size=0; Element[Element_Level-1].ToShow.Header_Size=Header_Size; if (Element_Offset==0) Element_DoNotShow(); } #endif //MEDIAINFO_TRACE //Integrity if (Element[Element_Level-1].Next<(File_Offset+Buffer_Offset+Element_Offset)) Element[Element_Level-1].Next=File_Offset+Buffer_Offset+Element_Offset; //Size is not good //Positionning Element_Size=Element[Element_Level-1].Next-(File_Offset+Buffer_Offset+Element_Offset); Header_Size=Element_Offset; Buffer_Offset+=(size_t)Header_Size; Element_Offset=0; if (Buffer_Offset+Element_Size>Buffer_Size) { if (Buffer_Size>Buffer_Offset) Element_Size=Buffer_Size-Buffer_Offset; else Element_Size=0; //There is an error in the parsing Element[Element_Level-1].IsComplete=false; } Element_End0(); //Header return true; } //--------------------------------------------------------------------------- void File__Analyze::Header_Parse() { //Filling Header_Fill_Code(0); Header_Fill_Size(Element_Size); } //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Header_Fill_Code(int64u Code, const Ztring &Name) { //Filling Element[Element_Level-1].Code=Code; //ToShow if (Config_Trace_Level!=0) { Element_Level--; Element_Name(Name); Element_Level++; } } #endif //MEDIAINFO_TRACE void File__Analyze::Header_Fill_Code(int64u Code) { //Filling Element[Element_Level-1].Code=Code; } //--------------------------------------------------------------------------- void File__Analyze::Header_Fill_Size(int64u Size) { if (Size==0) Trusted_IsNot("Block can't have a size of 0"); if (DataMustAlwaysBeComplete && Size>Buffer_MaximumSize) { Element[Element_Level].IsComplete=true; Element[Element_Level-1].IsComplete=true; Trusted_IsNot("Block is too big"); } if (Element[Element_Level].UnTrusted) return; //Integrity if (SizeElement[Element_Level-2].Next) Element[Element_Level-1].Next=Element[Element_Level-2].Next; else Element[Element_Level-1].Next=File_Offset+Buffer_Offset+Size; Element[Element_Level-1].IsComplete=true; //ToShow #if MEDIAINFO_TRACE if (Trace_Activated) { Element[Element_Level-1].ToShow.Pos=File_Offset+Buffer_Offset; Element[Element_Level-1].ToShow.Size=Element[Element_Level-1].Next-(File_Offset+Buffer_Offset); } #endif //MEDIAINFO_TRACE } //*************************************************************************** // Data //*************************************************************************** //--------------------------------------------------------------------------- bool File__Analyze::Data_Manage() { Element_WantNextLevel=false; if (!Element[Element_Level].UnTrusted) { Element_Code=Element[Element_Level].Code; //size_t Element_Level_Save=Element_Level; Data_Parse(); BS->Attach(NULL, 0); //Clear it //Element_Level=Element_Level_Save; if (Buffer_Offset+(Element_WantNextLevel?Element_Offset:Element_Size)>=FrameInfo.Buffer_Offset_End) { if (Frame_Count_Previous=FrameInfo.Buffer_Offset_End && FrameInfo_Next.DTS!=(int64u)-1) { FrameInfo=FrameInfo_Next; FrameInfo_Next=frame_info(); } //Testing the parser result if (Element_IsWaitingForMoreData()) { //The data is not complete, need more data Element_End0(); //Element Buffer_Offset-=(size_t)Header_Size; return false; } Element[Element_Level].IsComplete=true; if (!Element_WantNextLevel && DataMustAlwaysBeComplete && Element_Offset=(int64u)(size_t)-1) GoTo(File_Offset+Buffer_Offset+Element_Offset); else Buffer_Offset+=(size_t)Element_Offset; } Header_Size=0; Element_Size=0; Element_Offset=0; return false; } //Next element if (!Element_WantNextLevel #if MEDIAINFO_MD5 && MD5==NULL #endif //MEDIAINFO_MD5 ) { if (Element[Element_Level].Next<=File_Offset+Buffer_Size) { if (Element_Offset<(size_t)(Element[Element_Level].Next-File_Offset-Buffer_Offset)) Element_Offset=(size_t)(Element[Element_Level].Next-File_Offset-Buffer_Offset); } else if (!Status[IsFinished]) { GoTo(Element[Element_Level].Next); if (!Element_WantNextLevel) Element_End0(); //Element return false; } } if (!Element_WantNextLevel && Element_Offset=(int64u)(size_t)-1) GoTo(File_Offset+Buffer_Offset+Element_Offset); else Buffer_Offset+=(size_t)Element_Offset; } Header_Size=0; Element_Size=0; Element_Offset=0; #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) { if (!Element_WantNextLevel) Element_End0(); return false; } #endif //MEDIAINFO_DEMUX #if MEDIAINFO_TRACE if (Element_Level>0) Element[Element_Level-1].ToShow.NoShow=Element[Element_Level].ToShow.NoShow; //If data must not be shown, we hide the header too else Element[0].ToShow.NoShow=false; //This should never happen, but in case of #endif //MEDIAINFO_TRACE Element_End0(); //Element if (Element_WantNextLevel) Element_Level++; Element[Element_Level].UnTrusted=false; //Jumping to the end of the file if needed if (!EOF_AlreadyDetected && Config->ParseSpeed<1 && File_GoTo==(int64u)-1) { Element[Element_Level].WaitForMoreData=false; Detect_EOF(); if ((File_GoTo!=(int64u)-1 && File_GoTo>File_Offset+Buffer_Offset) || (Status[IsFinished] && !ShouldContinueParsing)) { EOF_AlreadyDetected=true; return false; } } return true; } //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Data_Info (const Ztring &Parameter) { size_t Element_Level_Temp=Element_Level; Element_Level=Data_Level; Element_Info(Parameter); Element_Level=Element_Level_Temp; } #endif //MEDIAINFO_TRACE //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Data_Accept (const char* ParserName) { if (Status[IsAccepted] || Status[IsFinished]) return; if (ParserName) Info(Ztring(ParserName)+__T(", accepted")); Accept(ParserName); } #endif //MEDIAINFO_TRACE //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Data_Finish (const char* ParserName) { if (ShouldContinueParsing) { //if (ParserName) // Info(Ztring(ParserName)+__T(", wants to finish, but should continue parsing")); return; } if (ParserName) Info(Ztring(ParserName)+__T(", finished")); Finish(); } #endif //MEDIAINFO_TRACE //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Data_Reject (const char* ParserName) { Status[IsAccepted]=false; Status[IsFinished]=true; Clear(); if (ParserName)// && File_Offset+Buffer_Offset+Element_SizeParseSpeed==1) return; if (GoToFromEnd>File_Size) { if (ParserName) Info(Ztring(ParserName)+__T(", wants to go to somewhere, but not valid")); return; } Data_GoTo(File_Size-GoToFromEnd, ParserName); } #endif //MEDIAINFO_TRACE //*************************************************************************** // Element //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE Ztring Log_Offset (int64u OffsetToShow, MediaInfo_Config::trace_Format Config_Trace_Format) { if (OffsetToShow==(int64u)-1) return __T(" "); int64u Offset=OffsetToShow%0x100000000ULL; //Only 32 bits Ztring Pos1; Pos1.From_Number(Offset, 16); Ztring Pos2; Pos2.resize(8-Pos1.size(), __T('0')); Pos2+=Pos1; Pos2.MakeUpperCase(); switch (Config_Trace_Format) { case MediaInfo_Config::Trace_Format_Tree : Pos2+=__T(' '); break; case MediaInfo_Config::Trace_Format_CSV : Pos2+=__T(','); break; default : ; } return Pos2; } #endif //MEDIAINFO_TRACE //--------------------------------------------------------------------------- void File__Analyze::Element_Begin() { //Level Element_Level++; //Element Element[Element_Level].Code=0; Element[Element_Level].Next=Element[Element_Level-1].Next; Element[Element_Level].WaitForMoreData=Element[Element_Level-1].WaitForMoreData; Element[Element_Level].UnTrusted=Element[Element_Level-1].UnTrusted; Element[Element_Level].IsComplete=Element[Element_Level-1].IsComplete; //ToShow #if MEDIAINFO_TRACE Element[Element_Level].ToShow.Pos=File_Offset+Buffer_Offset+Element_Offset+BS->OffsetBeforeLastCall_Get(); //TODO: change this, used in Element_End0() if (Trace_Activated) { Element[Element_Level].ToShow.Size=Element[Element_Level].Next-(File_Offset+Buffer_Offset+Element_Offset+BS->OffsetBeforeLastCall_Get()); Element[Element_Level].ToShow.Header_Size=0; Element[Element_Level].ToShow.Name.clear(); Element[Element_Level].ToShow.Info.clear(); Element[Element_Level].ToShow.Details.clear(); Element[Element_Level].ToShow.NoShow=false; } #endif //MEDIAINFO_TRACE } //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Element_Begin(const Ztring &Name) { //Level Element_Level++; //Element Element[Element_Level].Code=0; Element[Element_Level].Next=Element[Element_Level-1].Next; Element[Element_Level].WaitForMoreData=false; Element[Element_Level].UnTrusted=Element[Element_Level-1].UnTrusted; Element[Element_Level].IsComplete=Element[Element_Level-1].IsComplete; //ToShow Element[Element_Level].ToShow.Pos=File_Offset+Buffer_Offset+Element_Offset+BS->OffsetBeforeLastCall_Get(); //TODO: change this, used in Element_End0() if (Trace_Activated) { Element[Element_Level].ToShow.Size=Element[Element_Level].Next-(File_Offset+Buffer_Offset+Element_Offset+BS->OffsetBeforeLastCall_Get()); Element[Element_Level].ToShow.Header_Size=0; Element_Name(Name); Element[Element_Level].ToShow.Info.clear(); Element[Element_Level].ToShow.Details.clear(); Element[Element_Level].ToShow.NoShow=false; } } #endif //MEDIAINFO_TRACE //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Element_Name(const Ztring &Name) { //ToShow if (Trace_Activated) { if (!Name.empty()) { Ztring Name2=Name; Name2.FindAndReplace(__T("\r\n"), __T("__"), 0, Ztring_Recursive); Name2.FindAndReplace(__T("\r"), __T("_"), 0, Ztring_Recursive); Name2.FindAndReplace(__T("\n"), __T("_"), 0, Ztring_Recursive); if (Name2[0]==__T(' ')) Name2[0]=__T('_'); Element[Element_Level].ToShow.Name=Name2; } else Element[Element_Level].ToShow.Name=__T("(Empty)"); } } #endif //MEDIAINFO_TRACE //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Element_Info(const Ztring &Parameter) { //Coherancy if (Config_Trace_Level==0 || !(Trace_Layers.to_ulong()&Config_Trace_Layers.to_ulong()) || Element[Element_Level].ToShow.Details.size()>64*1024*1024) return; //Needed? if (Config_Trace_Level<=0.7) return; //ToShow Ztring Parameter2(Parameter); Parameter2.FindAndReplace(__T("\r\n"), __T(" / ")); Parameter2.FindAndReplace(__T("\r"), __T(" / ")); Parameter2.FindAndReplace(__T("\n"), __T(" / ")); switch (Config_Trace_Format) { case MediaInfo_Config::Trace_Format_Tree : case MediaInfo_Config::Trace_Format_CSV : Element[Element_Level].ToShow.Info+=__T(" - "); break; default : ; } Element[Element_Level].ToShow.Info+=Parameter2; } #endif //MEDIAINFO_TRACE //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Element_End(const Ztring &Name) { //ToShow if (Trace_Activated) { Element[Element_Level].ToShow.Size=Element[Element_Level].Next-Element[Element_Level].ToShow.Pos; if (!Name.empty()) Element[Element_Level].ToShow.Name=Name; } Element_End_Common_Flush(); } #endif //MEDIAINFO_TRACE //*************************************************************************** // Element - Common //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Element_End_Common_Flush() { #if MEDIAINFO_TRACE //Size if not filled if (File_Offset+Buffer_Offset+Element_Offset+BS->Offset_Get()Offset_Get()-Element[Element_Level].ToShow.Pos; #endif //MEDIAINFO_TRACE //Level if (Element_Level==0) return; //Element level Element_Level--; //Element Element[Element_Level].UnTrusted=Element[Element_Level+1].UnTrusted; Element[Element_Level].WaitForMoreData=Element[Element_Level+1].WaitForMoreData; #if MEDIAINFO_TRACE Element_End_Common_Flush_Details(); #endif //MEDIAINFO_TRACE } #if MEDIAINFO_TRACE //--------------------------------------------------------------------------- void File__Analyze::Element_End_Common_Flush_Details() { if (Trace_Activated) { if (!Element[Element_Level+1].WaitForMoreData && (Element[Element_Level+1].IsComplete || !Element[Element_Level+1].UnTrusted) && !Element[Element_Level+1].ToShow.NoShow)// && Config_Trace_Level!=0 && Element[Element_Level].ToShow.Details.size()<=64*1024*1024) { //Element if (!Element[Element_Level+1].ToShow.Name.empty()) { if (!Element[Element_Level].ToShow.Details.empty()) Element[Element_Level].ToShow.Details+=Config_LineSeparator; Element[Element_Level].ToShow.Details+=Element_End_Common_Flush_Build(); Element[Element_Level+1].ToShow.Name.clear(); } //Info if (!Element[Element_Level+1].ToShow.Details.empty()) { if (!Element[Element_Level].ToShow.Details.empty()) Element[Element_Level].ToShow.Details+=Config_LineSeparator; Element[Element_Level].ToShow.Details+=Element[Element_Level+1].ToShow.Details; Element[Element_Level+1].ToShow.Details.clear(); } } } } #endif //MEDIAINFO_TRACE #if MEDIAINFO_TRACE //--------------------------------------------------------------------------- Ztring File__Analyze::Element_End_Common_Flush_Build() { Ztring ToReturn; //Show Offset if (Config_Trace_Level>0.7) { ToReturn+=Log_Offset(Element[Element_Level+1].ToShow.Pos, Config_Trace_Format); } //Name switch (Config_Trace_Format) { case MediaInfo_Config::Trace_Format_Tree : ToReturn.resize(ToReturn.size()+Element_Level_Base+Element_Level, __T(' ')); break; case MediaInfo_Config::Trace_Format_CSV : ToReturn+=__T("G,"); ToReturn+=Ztring::ToZtring(Element_Level_Base+Element_Level); ToReturn+=__T(','); break; default : ; } ToReturn+=Element[Element_Level+1].ToShow.Name; //Info ToReturn+=Element[Element_Level+1].ToShow.Info; Element[Element_Level+1].ToShow.Info.clear(); //Size if (Config_Trace_Level>0.3) { switch (Config_Trace_Format) { case MediaInfo_Config::Trace_Format_Tree : ToReturn+=__T(" ("); break; case MediaInfo_Config::Trace_Format_CSV : ToReturn+=__T(",("); break; default : ; } ToReturn+=Ztring::ToZtring(Element[Element_Level+1].ToShow.Size); if (Element[Element_Level+1].ToShow.Header_Size>0) { ToReturn+=__T("/"); ToReturn+=Ztring::ToZtring(Element[Element_Level+1].ToShow.Size-Element[Element_Level+1].ToShow.Header_Size); } ToReturn+=__T(" bytes)"); } return ToReturn; } #endif //MEDIAINFO_TRACE //--------------------------------------------------------------------------- void File__Analyze::Element_Prepare (int64u Size) { Element_Offset=0; Element_Size=Size; #if MEDIAINFO_TRACE Element[Element_Level].ToShow.Size=Size; #endif //MEDIAINFO_TRACE } //*************************************************************************** // Param //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Param(const Ztring& Parameter, const Ztring& Value) { if (Config_Trace_Level==0 || !(Trace_Layers.to_ulong()&Config_Trace_Layers.to_ulong())) return; //Position int64u Pos=Element_Offset+BS->OffsetBeforeLastCall_Get(); //Coherancy if (Element[Element_Level].UnTrusted) return; //Line separator if (!Element[Element_Level].ToShow.Details.empty()) Element[Element_Level].ToShow.Details+=Config_LineSeparator; //Show Offset if (Config_Trace_Level>0.7) { Element[Element_Level].ToShow.Details+=Log_Offset(Pos==(int64u)-1?Pos:(File_Offset+Buffer_Offset+Pos), Config_Trace_Format); } //Show Parameter+Value switch (Config_Trace_Format) { case MediaInfo_Config::Trace_Format_Tree : { const size_t Padding_Value=40; //Show Parameter Ztring Param; Param=Parameter; if (Param.size()>Padding_Value) Param.resize(Padding_Value); Element[Element_Level].ToShow.Details.resize(Element[Element_Level].ToShow.Details.size()+Element_Level_Base+Element_Level, __T(' ')); Element[Element_Level].ToShow.Details+=Param; //Show Value if (!Value.empty()) { Element[Element_Level].ToShow.Details+=__T(": "); Element[Element_Level].ToShow.Details.resize(Element[Element_Level].ToShow.Details.size()+Padding_Value-Param.size()-Element_Level+1, __T(' ')); Ztring Value2(Value); Value2.FindAndReplace(__T("\r\n"), __T(" / "), 0, Ztring_Recursive); Value2.FindAndReplace(__T("\r"), __T(" / "), 0, Ztring_Recursive); Value2.FindAndReplace(__T("\n"), __T(" / "), 0, Ztring_Recursive); Element[Element_Level].ToShow.Details+=Value2; } } break; case MediaInfo_Config::Trace_Format_CSV : Element[Element_Level].ToShow.Details+=__T("T,"); Element[Element_Level].ToShow.Details+=Ztring::ToZtring(Element_Level_Base+Element_Level); Element[Element_Level].ToShow.Details+=__T(','); Element[Element_Level].ToShow.Details+=Parameter; Element[Element_Level].ToShow.Details+=__T(','); Element[Element_Level].ToShow.Details+=Value; break; default : ; } } #endif //MEDIAINFO_TRACE //*************************************************************************** // Information //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Info(const Ztring& Value, size_t Element_Level_Minus) { if (Config_Trace_Format==MediaInfo_Config::Trace_Format_CSV) return; //Do not display info //Handling a different level (only Element_Level_Minus to 1 is currently well supported) size_t Element_Level_Final=Element_Level; if (Element_Level_Minus<=Element_Level) { if (Element_Level_Minus==1) { Element_Level--; Element_End_Common_Flush_Details(); Element_Level++; } Element_Level_Final-=Element_Level_Minus; } if (Config_Trace_Level==0 || !(Trace_Layers.to_ulong()&Config_Trace_Layers.to_ulong())) return; //Coherancy if (Element[Element_Level_Final].UnTrusted) return; //Line separator if (!Element[Element_Level_Final].ToShow.Details.empty()) Element[Element_Level_Final].ToShow.Details+=Config_LineSeparator; //Preparing Ztring ToShow; ToShow.resize(Element_Level_Final, __T(' ')); ToShow+=__T("--- "); ToShow+=Value; ToShow+=__T(" ---"); Ztring Separator; Separator.resize(Element_Level_Final, __T(' ')); Separator.resize(ToShow.size(), __T('-')); //Show Offset Ztring Offset; if (Config_Trace_Level>0.7) Offset=Log_Offset(File_Offset+Buffer_Offset+Element_Offset+BS->Offset_Get(), Config_Trace_Format); Offset.resize(Offset.size()+Element_Level_Base, __T(' ')); //Show Value Element[Element_Level_Final].ToShow.Details+=Offset; Element[Element_Level_Final].ToShow.Details+=Separator; Element[Element_Level_Final].ToShow.Details+=Config_LineSeparator; Element[Element_Level_Final].ToShow.Details+=Offset; Element[Element_Level_Final].ToShow.Details+=ToShow; Element[Element_Level_Final].ToShow.Details+=Config_LineSeparator; Element[Element_Level_Final].ToShow.Details+=Offset; Element[Element_Level_Final].ToShow.Details+=Separator; } #endif //MEDIAINFO_TRACE //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Param_Info (const Ztring &Text) { //Coherancy if (Element[Element_Level].UnTrusted) return; if (Config_Trace_Level==0 || !(Trace_Layers.to_ulong()&Config_Trace_Layers.to_ulong()) || Element[Element_Level].ToShow.Details.size()>64*1024*1024) return; //Needed? if (Config_Trace_Level<=0.7) return; //Filling Element[Element_Level].ToShow.Details+=__T(" - ")+Text; } #endif //MEDIAINFO_TRACE //*************************************************************************** // Next code planning //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::NextCode_Add (int64u Code) { NextCode[Code]=true; } //--------------------------------------------------------------------------- void File__Analyze::NextCode_Clear () { NextCode.clear(); } //--------------------------------------------------------------------------- bool File__Analyze::NextCode_Test () { if (NextCode.find(Element_Code)==NextCode.end()) { Trusted_IsNot("Frames are not in the right order"); return false; } return true; } //*************************************************************************** // Element trusting //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Trusted_IsNot (const char* Reason) #else //MEDIAINFO_TRACE void File__Analyze::Trusted_IsNot () #endif //MEDIAINFO_TRACE { Element_Offset=Element_Size; BS->Attach(NULL, 0); if (!Element[Element_Level].UnTrusted) { #if MEDIAINFO_TRACE Param(Reason, 0); #endif //MEDIAINFO_TRACE //Enough data? if (!Element[Element_Level].IsComplete) { Element_WaitForMoreData(); return; } Element[Element_Level].UnTrusted=true; Synched=false; if (!Status[IsFilled] && Trusted>0) Trusted--; } if (Trusted==0 && !Status[IsAccepted]) Reject(); } //*************************************************************************** // Actions //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Accept (const char* ParserName_Char) #else //MEDIAINFO_TRACE void File__Analyze::Accept () #endif //MEDIAINFO_TRACE { if (Status[IsAccepted] || Status[IsFinished]) return; #if MEDIAINFO_TRACE if (ParserName.empty()) ParserName.From_Local(ParserName_Char); if (!ParserName.empty()) { bool MustElementBegin=Element_Level?true:false; if (Element_Level>0) Element_End0(); //Element Info(ParserName+__T(", accepted")); if (MustElementBegin) Element_Level++; } #endif //MEDIAINFO_TRACE Status[IsAccepted]=true; if (Count_Get(Stream_General)==0) { Stream_Prepare(Stream_General); Streams_Accept(); } #if MEDIAINFO_EVENTS if (!IsSub) { EVENT_BEGIN (General, Parser_Selected, 0) std::memset(Event.Name, 0, 16); if (!ParserName.empty()) strncpy(Event.Name, ParserName.To_Local().c_str(), 15); EVENT_END () #if MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET if (!Demux_EventWasSent_Accept_Specific && Config->NextPacket_Get() && Config->Event_CallBackFunction_IsSet()) Config->Demux_EventWasSent=true; #endif //MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET } Config->Event_Accepted(this); #endif //MEDIAINFO_EVENTS } void File__Analyze::Accept (File__Analyze* Parser) { if (Parser==NULL) return; Parser->Accept(); } //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Update (const char* ParserName_Char) #else //MEDIAINFO_TRACE void File__Analyze::Update () #endif //MEDIAINFO_TRACE { if (!Status[IsAccepted]) return; Open_Buffer_Update(); } void File__Analyze::Update (File__Analyze* Parser) { if (Parser==NULL) return; Parser->Update(); } //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Fill (const char* ParserName_Char) #else //MEDIAINFO_TRACE void File__Analyze::Fill () #endif //MEDIAINFO_TRACE { if (!Status[IsAccepted] || Status[IsFilled] || Status[IsFinished]) return; #if MEDIAINFO_TRACE if (ParserName.empty()) ParserName.From_Local(ParserName_Char); if (!ParserName.empty()) { bool MustElementBegin=Element_Level?true:false; if (Element_Level>0) Element_End0(); //Element Info(ParserName+__T(", filling")); if (MustElementBegin) Element_Level++; } #endif //MEDIAINFO_TRACE Streams_Fill(); Status[IsFilled]=true; Status[IsUpdated]=true; //Instantaneous bitrate at the "fill" level if (File_Size==(int64u)-1 && FrameInfo.PTS!=(int64u)-1 && PTS_Begin!=(int64u)-1 && FrameInfo.PTS-PTS_Begin && StreamKind_Last!=Stream_General && StreamKind_Last!=Stream_Max) { Fill(StreamKind_Last, 0, "BitRate_Instantaneous", Buffer_TotalBytes*8*1000000000/(FrameInfo.PTS-PTS_Begin)); (*Stream_More)[StreamKind_Last][0](Ztring().From_Local("BitRate_Instantaneous"), Info_Options)=__T("N NI"); } } void File__Analyze::Fill (File__Analyze* Parser) { if (Parser==NULL) return; Parser->Fill(); } //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Finish (const char* ParserName_Char) #else //MEDIAINFO_TRACE void File__Analyze::Finish () #endif //MEDIAINFO_TRACE { if (Status[IsFinished]) return; if (!ShouldContinueParsing && !Status[IsFilled]) Fill(); if (ShouldContinueParsing || Config->ParseSpeed==1) { #if MEDIAINFO_TRACE if (!ParserName.empty()) { bool MustElementBegin=Element_Level?true:false; if (Element_Level>0) Element_End0(); //Element //Info(Ztring(ParserName)+__T(", wants to finish, but should continue parsing")); if (MustElementBegin) Element_Level++; } #endif //MEDIAINFO_TRACE return; } ForceFinish(); } void File__Analyze::Finish (File__Analyze* Parser) { ForceFinish(Parser); //The base parser wants, and is prepared to it, so nothing can be cancelled --> ForceFinish() instead of Finish() } //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::ForceFinish (const char* ParserName_Char) #else //MEDIAINFO_TRACE void File__Analyze::ForceFinish () #endif //MEDIAINFO_TRACE { if (Status[IsFinished]) return; #if MEDIAINFO_TRACE if (ParserName.empty()) ParserName.From_Local(ParserName_Char); if (!ParserName.empty()) { bool MustElementBegin=Element_Level?true:false; if (Element_Level>0) Element_End0(); //Element Info(ParserName+__T(", finished")); if (MustElementBegin) Element_Level++; } #endif //MEDIAINFO_TRACE if (Status[IsAccepted]) { Fill(); #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) return; #endif //MEDIAINFO_DEMUX Streams_Finish(); #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) return; #endif //MEDIAINFO_DEMUX if (Status[IsUpdated]) { Open_Buffer_Update(); if (IsSub) Status[IsUpdated]=true; //We want that container merges the result #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) return; #endif //MEDIAINFO_DEMUX } Streams_Finish_Global(); #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) return; #endif //MEDIAINFO_DEMUX Ibi_Stream_Finish(); } Status[IsFinished]=true; //Real stream size if (Config->ParseSpeed==1 && IsRawStream && Buffer_TotalBytes) { //Exception with text streams embedded in video if (StreamKind_Last==Stream_Text) StreamKind_Last=Stream_Video; Fill(StreamKind_Last, 0, "StreamSize", Buffer_TotalBytes, 10, true); } //Frame count if (Config->ParseSpeed==1 && IsRawStream && Frame_Count && Frame_Count!=(int64u)-1 && Retrieve(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_FrameCount)).empty()) Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_FrameCount), Frame_Count); } void File__Analyze::ForceFinish (File__Analyze* Parser) { if (Parser==NULL) return; if (File_Offset+Buffer_Offset+Element_Size>=File_Size) { Element_Size=0; Parser->Buffer_Offset=(size_t)(Parser->File_Size-Parser->File_Offset); } Parser->ForceFinish(); } //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::Reject (const char* ParserName) #else //MEDIAINFO_TRACE void File__Analyze::Reject () #endif //MEDIAINFO_TRACE { Status[IsAccepted]=false; Status[IsFinished]=true; Clear(); #if MEDIAINFO_TRACE if (ParserName)// && File_Offset+Buffer_Offset+Element_Size0) Element_End0(); //Element Info(Ztring(ParserName)+__T(", rejected")); if (MustElementBegin) Element_Level++; } #endif //MEDIAINFO_TRACE } void File__Analyze::Reject (File__Analyze* Parser) { if (Parser==NULL) return; Parser->Reject(); } //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::GoTo (int64u GoTo, const char* ParserName) { if (!Status[IsAccepted]) { Reject(); return; } Element_Show(); if (IsSub && Config->ParseSpeed==1) return; if (GoTo==File_Size) { if (!BookMark_Code.empty()) BookMark_Get(); if (File_GoTo==(int64u)-1) ForceFinish(); return; } if (ShouldContinueParsing) { if (ParserName) { bool MustElementBegin=Element_Level?true:false; if (Element_Level>0) Element_End0(); //Element Info(Ztring(ParserName)+__T(", wants to go to somewhere, but should continue parsing")); if (MustElementBegin) Element_Level++; } return; } if (IsSub) { if (ParserName) { bool MustElementBegin=Element_Level?true:false; if (Element_Level>0) Element_End0(); //Element Info(Ztring(ParserName)+__T(", wants to go to somewhere, but is sub, waiting data")); if (MustElementBegin) Element_Level++; } return; } if (ParserName) { bool MustElementBegin=Element_Level?true:false; if (Element_Level>0) Element_End0(); //Element Info(Ztring(ParserName)+__T(", jumping to offset ")+Ztring::ToZtring(GoTo, 16)); if (MustElementBegin) Element_Level++; //Element } File_GoTo=GoTo; #if MEDIAINFO_EVENTS EVENT_BEGIN (General, Move_Request, 0) Event.StreamOffset=File_GoTo; EVENT_END () #endif //MEDIAINFO_EVENTS } #else //MEDIAINFO_TRACE void File__Analyze::GoTo (int64u GoTo) { if (!Status[IsAccepted]) { Reject(); return; } if (IsSub && Config->ParseSpeed==1) return; if (GoTo==File_Size) { if (!BookMark_Code.empty()) BookMark_Get(); if (File_GoTo==(int64u)-1) ForceFinish(); return; } if (ShouldContinueParsing) { return; } if (IsSub) { return; } File_GoTo=GoTo; } #endif //MEDIAINFO_TRACE //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File__Analyze::GoToFromEnd (int64u GoToFromEnd, const char* ParserName) { if (GoToFromEnd>File_Size) { if (ParserName) { bool MustElementBegin=Element_Level?true:false; if (Element_Level>0) Element_End0(); //Element Info(Ztring(ParserName)+__T(", wants to go to somewhere, but not valid")); if (MustElementBegin) Element_Level++; } return; } GoTo(File_Size-GoToFromEnd, ParserName); } #else //MEDIAINFO_TRACE void File__Analyze::GoToFromEnd (int64u GoToFromEnd) { if (GoToFromEnd>File_Size) return; GoTo(File_Size-GoToFromEnd); } #endif //MEDIAINFO_TRACE //--------------------------------------------------------------------------- int64u File__Analyze::Element_Code_Get (size_t Level) { return Element[Level].Code; } //--------------------------------------------------------------------------- int64u File__Analyze::Element_TotalSize_Get (size_t LevelLess) { return Element[Element_Level-LevelLess].Next-(File_Offset+Buffer_Offset); } //--------------------------------------------------------------------------- bool File__Analyze::Element_IsComplete_Get () { return Element[Element_Level].IsComplete; } //--------------------------------------------------------------------------- void File__Analyze::Element_ThisIsAList () { Element_WantNextLevel=true; } //--------------------------------------------------------------------------- void File__Analyze::Element_WaitForMoreData () { //if (File_Offset+Buffer_SizeBufferUnderRun) Trusted_IsNot(); #endif //MEDIAINFO_TRACE return !Element[Element_Level].WaitForMoreData && !Element[Element_Level].UnTrusted; } //--------------------------------------------------------------------------- bool File__Analyze::Element_IsNotFinished () { if (BS->Remain()>0 || Element_Offset+BS->Offset_Get()0) Element_End0(); while (Element_Levelclear(); Element[0].ToShow.Details.clear(); } #endif //MEDIAINFO_TRACE #if MEDIAINFO_EVENTS void File__Analyze::Event_Prepare(struct MediaInfo_Event_Generic* Event) { memset(Event, 0xFF, sizeof(struct MediaInfo_Event_Generic)); Event->StreamIDs_Size=StreamIDs_Size; memcpy(Event->StreamIDs, StreamIDs, sizeof(StreamIDs)); memcpy(Event->StreamIDs_Width, StreamIDs_Width, sizeof(StreamIDs_Width)); memcpy(Event->ParserIDs, ParserIDs, sizeof(ParserIDs)); Event->StreamOffset=File_Offset+Buffer_Offset+Element_Offset; Event->FrameNumber=Frame_Count_NotParsedIncluded; Event->PCR=FrameInfo.PCR; Event->DTS=(FrameInfo.DTS==(int64u)-1?FrameInfo.PTS:FrameInfo.DTS); Event->PTS=FrameInfo.PTS; Event->DUR=FrameInfo.DUR; //Event->FrameNumber_PresentationOrder=FrameNumber_PresentationOrder; } #endif //MEDIAINFO_EVENTS //*************************************************************************** // Demux //*************************************************************************** #if MEDIAINFO_DEMUX void File__Analyze::Demux (const int8u* Buffer, size_t Buffer_Size, contenttype Content_Type, const int8u* xx, size_t xxx) { if (!(Config_Demux&Demux_Level)) return; if (!Buffer_Size) return; #if MEDIAINFO_DEMUX && MEDIAINFO_SEEK if (Config->Demux_IsSeeking) return; #endif //MEDIAINFO_SEEK #if MEDIAINFO_EVENTS //Demux if (StreamIDs_Size) StreamIDs[StreamIDs_Size-1]=Element_Code; EVENT_BEGIN(Global, Demux, 4) if (StreamIDs_Size) Event.EventCode|=((int32u)ParserIDs[StreamIDs_Size-1]<<24); Event.Content_Type=(int8u)Content_Type; Event.Content_Size=Buffer_Size; Event.Content=Buffer; Event.Flags=0; if (Demux_random_access) Event.Flags|=0x1; //Bit 0 Event.Offsets_Size=Offsets_Buffer.size(); std::vector Offsets_Stream_Temp; std::vector Offsets_Buffer_Temp; float64 Ratio=1; if (OriginalBuffer_Size) Ratio=((float64)File__Analyze::OriginalBuffer_Size)/File__Analyze::Buffer_Size; if (Offsets_Buffer.empty()) { Event.Offsets_Stream=NULL; Event.Offsets_Content=NULL; } else if (Buffer_Offset+Element_Offset) { Offsets_Stream_Temp=Offsets_Stream; Offsets_Buffer_Temp=Offsets_Buffer; size_t Pos=0; if (Offsets_Buffer.size()>=2 && Offsets_Buffer.size()%2==0 && Offsets_Buffer[0]==Offsets_Buffer[1]) { while (Pos+2NextPacket_Get()) Config->Demux_EventWasSent=true; #endif //MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET if (StreamIDs_Size) StreamIDs[StreamIDs_Size-1]=(int64u)-1; #endif //MEDIAINFO_EVENTS } #endif //MEDIAINFO_DEMUX #if MEDIAINFO_DEMUX void File__Analyze::Demux_UnpacketizeContainer_Demux (bool random_access) { Demux_random_access=random_access; if (StreamIDs_Size>=2) Element_Code=StreamIDs[StreamIDs_Size-2]; StreamIDs_Size--; Demux(Buffer+Buffer_Offset, Demux_Offset-Buffer_Offset, ContentType_MainStream); StreamIDs_Size++; if (StreamIDs_Size>=2) StreamIDs[StreamIDs_Size-2]=Element_Code; Demux_UnpacketizeContainer_Demux_Clear(); } bool File__Analyze::Demux_UnpacketizeContainer_Test_OneFramePerFile () { if (Buffer_SizeFile_Sizes[Config->File_Names_Pos-1]) { size_t* File_Buffer_Size_Hint_Pointer=Config->File_Buffer_Size_Hint_Pointer_Get(); if (File_Buffer_Size_Hint_Pointer) (*File_Buffer_Size_Hint_Pointer)=(size_t)Config->File_Sizes[Config->File_Names_Pos-1]; return false; } float64 Demux_Rate=Config->Demux_Rate_Get(); if (!Demux_Rate) Demux_Rate=24; if (Frame_Count_NotParsedIncluded!=(int64u)-1) FrameInfo.DTS=float64_int64s(Frame_Count_NotParsedIncluded*1000000000/Demux_Rate); else FrameInfo.DTS=(int64u)-1; FrameInfo.PTS=FrameInfo.DTS; FrameInfo.DUR=float64_int64s(1000000000/Demux_Rate); Demux_Offset=Buffer_Size; Demux_UnpacketizeContainer_Demux(); return true; } void File__Analyze::Demux_UnpacketizeContainer_Demux_Clear () { Demux_TotalBytes=Buffer_TotalBytes+Demux_Offset; Demux_Offset=0; //if (Frame_Count || Field_Count) // Element_End0(); //Element_Begin1("Frame or Field"); } #endif //MEDIAINFO_DEMUX //*************************************************************************** // IBI //*************************************************************************** #if MEDIAINFO_IBI void File__Analyze::Ibi_Read_Buffer_Unsynched () { Ibi_SynchronizationOffset_Current=(int64u)-1; if (IbiStream==NULL) return; IbiStream->Unsynch(); for (size_t Pos=0; PosInfos.size(); Pos++) { if (File_GoTo==IbiStream->Infos[Pos].StreamOffset) { FrameInfo.DTS=(IbiStream->Infos[Pos].Dts!=(int64u)-1)?float64_int64s((((float64)IbiStream->Infos[Pos].Dts)*1000000000*IbiStream->DtsFrequencyDenominator/IbiStream->DtsFrequencyNumerator)):(int64u)-1; Frame_Count_NotParsedIncluded=IbiStream->Infos[Pos].FrameNumber; break; } } } size_t File__Analyze::Ibi_Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { if (IbiStream==NULL) return (size_t)-1; //Init if (!Seek_Duration_Detected) { if (!IsSub) { //External IBI std::string IbiFile=Config->Ibi_Get(); if (!IbiFile.empty()) { IbiStream->Infos.clear(); //TODO: support IBI data from different inputs File_Ibi MI; Open_Buffer_Init(&MI, IbiFile.size()); MI.Ibi=new ibi; MI.Open_Buffer_Continue((const int8u*)IbiFile.c_str(), IbiFile.size()); (*IbiStream)=(*MI.Ibi->Streams.begin()->second); } } Seek_Duration_Detected=true; } //Parsing switch (Method) { case 0 : #if MEDIAINFO_IBI { for (size_t Pos=0; PosInfos.size(); Pos++) { if (Value<=IbiStream->Infos[Pos].StreamOffset) { if (ValueInfos[Pos].StreamOffset && Pos) Pos--; //Checking continuity of Ibi if (!IbiStream->Infos[Pos].IsContinuous && Pos+1Infos.size()) { Config->Demux_IsSeeking=true; GoTo((IbiStream->Infos[Pos].StreamOffset+IbiStream->Infos[Pos+1].StreamOffset)/2); Open_Buffer_Unsynch(); return 1; } Config->Demux_IsSeeking=false; GoTo(IbiStream->Infos[Pos].StreamOffset); Open_Buffer_Unsynch(); return 1; } } if (IbiStream->Infos.empty()) { GoTo(0); Open_Buffer_Unsynch(); } else if (!IbiStream->Infos[IbiStream->Infos.size()-1].IsContinuous) { GoTo(IbiStream->Infos[IbiStream->Infos.size()-1].StreamOffset); Open_Buffer_Unsynch(); } else return 2; //Invalid value return 1; } #else //MEDIAINFO_IBI return (size_t)-2; //Not supported / IBI disabled #endif //MEDIAINFO_IBI case 1 : return Ibi_Read_Buffer_Seek(0, File_Size*Value/10000, ID); case 2 : //Timestamp #if MEDIAINFO_IBI { if (!(IbiStream->DtsFrequencyNumerator==1000000000 && IbiStream->DtsFrequencyDenominator==1)) { float64 ValueF=(float64)Value; ValueF/=1000000000; //Value is in ns ValueF/=IbiStream->DtsFrequencyDenominator; ValueF*=IbiStream->DtsFrequencyNumerator; Value=float64_int64s(ValueF); } for (size_t Pos=0; PosInfos.size(); Pos++) { if (Value<=IbiStream->Infos[Pos].Dts) { if (ValueInfos[Pos].Dts && Pos) Pos--; //Checking continuity of Ibi if (!IbiStream->Infos[Pos].IsContinuous && Pos+1Infos.size()) { Config->Demux_IsSeeking=true; GoTo((IbiStream->Infos[Pos].StreamOffset+IbiStream->Infos[Pos+1].StreamOffset)/2); Open_Buffer_Unsynch(); return 1; } Config->Demux_IsSeeking=false; GoTo(IbiStream->Infos[Pos].StreamOffset); Open_Buffer_Unsynch(); return 1; } } if (IbiStream->Infos.empty()) { GoTo(0); Open_Buffer_Unsynch(); } else if (!IbiStream->Infos[IbiStream->Infos.size()-1].IsContinuous) { GoTo(IbiStream->Infos[IbiStream->Infos.size()-1].StreamOffset); Open_Buffer_Unsynch(); } else return 2; //Invalid value return 1; } #else //MEDIAINFO_IBI return (size_t)-2; //Not supported / IBI disabled #endif //MEDIAINFO_IBI case 3 : //FrameNumber #if MEDIAINFO_IBI { for (size_t Pos=0; PosInfos.size(); Pos++) { if (Value<=IbiStream->Infos[Pos].FrameNumber) { if (ValueInfos[Pos].FrameNumber && Pos) Pos--; //Checking continuity of Ibi if (!IbiStream->Infos[Pos].IsContinuous && Pos+1Infos.size()) { Config->Demux_IsSeeking=true; GoTo((IbiStream->Infos[Pos].StreamOffset+IbiStream->Infos[Pos+1].StreamOffset)/2); Open_Buffer_Unsynch(); return 1; } Config->Demux_IsSeeking=false; GoTo(IbiStream->Infos[Pos].StreamOffset); Open_Buffer_Unsynch(); return 1; } } if (IbiStream->Infos.empty()) { GoTo(0); Open_Buffer_Unsynch(); } else if (!IbiStream->Infos[IbiStream->Infos.size()-1].IsContinuous) { GoTo(IbiStream->Infos[IbiStream->Infos.size()-1].StreamOffset); Open_Buffer_Unsynch(); } else return 2; //Invalid value return 1; } #else //MEDIAINFO_IBI return (size_t)-2; //Not supported / IBI disabled #endif //MEDIAINFO_IBI default : return (size_t)-1; //Not supported } } void File__Analyze::Ibi_Stream_Finish () { if (IsSub) return; if (!(IbiStream==NULL || IbiStream->Infos.empty()) && File_Offset+Buffer_Size==File_Size) { ibi::stream::info IbiInfo; IbiInfo.StreamOffset=File_Offset+Buffer_Size; IbiInfo.FrameNumber=Frame_Count_NotParsedIncluded; IbiInfo.Dts=(FrameInfo.DTS!=(int64u)-1)?float64_int64s(((float64)FrameInfo.DTS)/1000000000*IbiStream->DtsFrequencyNumerator/IbiStream->DtsFrequencyDenominator):(int64u)-1; IbiInfo.IsContinuous=true; IbiStream->Add(IbiInfo); } if (Config_Ibi_Create) { if (!(IbiStream==NULL || IbiStream->Infos.empty())) Ibi.Streams[(int64u)-1]=new ibi::stream(*IbiStream); //Inform_Data ZtringListList Content; for (size_t StreamKind=Stream_General; StreamKindDtsFrequencyNumerator==1000000000 && IbiStream->DtsFrequencyDenominator==1 && !IbiStream->Infos.empty()) { IbiStream->DtsFrequencyNumerator=Numerator; IbiStream->DtsFrequencyDenominator=Denominator; for (size_t Pos=0; PosInfos.size(); Pos++) if (IbiStream->Infos[Pos].Dts!=(int64u)-1) IbiStream->Infos[Pos].Dts=float64_int64s(((float64)IbiStream->Infos[Pos].Dts)/1000000000/Denominator*Numerator); } } void File__Analyze::Ibi_Add () { if (IbiStream==NULL) return; ibi::stream::info IbiInfo; IbiInfo.StreamOffset=IsSub?Ibi_SynchronizationOffset_Current:(File_Offset+Buffer_Offset); IbiInfo.FrameNumber=Frame_Count_NotParsedIncluded; IbiInfo.Dts=FrameInfo.DTS; IbiStream->Add(IbiInfo); if (Frame_Count_NotParsedIncluded==(int64u)-1) Frame_Count_NotParsedIncluded=IbiStream->Infos[IbiStream->Infos_Pos-1].FrameNumber; } #endif //MEDIAINFO_IBI } //NameSpace MediaInfoLib/Source/MediaInfo/File__Analyze.h100777 0 0 217641 12226004262 14473 0/* 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. */ //--------------------------------------------------------------------------- #ifndef MediaInfo_File__AnalyzeH #define MediaInfo_File__AnalyzeH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Base.h" #include "MediaInfo/File__Analyse_Automatic.h" #include "ZenLib/BitStream_Fast.h" #include "ZenLib/BitStream_LE.h" #if MEDIAINFO_IBI #include "MediaInfo/Multiple/File_Ibi_Creation.h" #endif //MEDIAINFO_IBI #include "tinyxml2.h" #if MEDIAINFO_MD5 extern "C" { #include } #endif //MEDIAINFO_MD5 //--------------------------------------------------------------------------- namespace MediaInfoLib { class MediaInfo_Internal; #if !MEDIAINFO_TRACE #include "MediaInfo/File__Analyze_MinimizeSize.h" #else //*************************************************************************** // Class File__Base //*************************************************************************** class File__Analyze : public File__Base { public : //*************************************************************************** // Constructor/Destructor //*************************************************************************** File__Analyze(); virtual ~File__Analyze(); //*************************************************************************** // Open //*************************************************************************** void Open_Buffer_Init ( int64u File_Size); void Open_Buffer_Init (File__Analyze* Sub); void Open_Buffer_Init (File__Analyze* Sub, int64u File_Size); void Open_Buffer_Continue ( const int8u* Buffer, size_t Buffer_Size); void Open_Buffer_Continue (File__Analyze* Sub, const int8u* Buffer, size_t Buffer_Size, bool IsNewPacket=true, float64 Ratio=1.0); void Open_Buffer_Continue (File__Analyze* Sub, size_t Buffer_Size) {if (Element_Offset+Buffer_Size<=Element_Size) Open_Buffer_Continue(Sub, Buffer+Buffer_Offset+(size_t)Element_Offset, Buffer_Size); Element_Offset+=Buffer_Size;} void Open_Buffer_Continue (File__Analyze* Sub) {if (Element_Offset<=Element_Size) Open_Buffer_Continue(Sub, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); Element_Offset=Element_Size;} void Open_Buffer_Position_Set(int64u File_Offset); #if MEDIAINFO_SEEK size_t Open_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK void Open_Buffer_Update (); void Open_Buffer_Update (File__Analyze* Sub); void Open_Buffer_Unsynch (); void Open_Buffer_Finalize (bool NoBufferModification=false); void Open_Buffer_Finalize (File__Analyze* Sub); //*************************************************************************** // In/Out (for parsers) //*************************************************************************** //In Ztring ParserName; #if MEDIAINFO_EVENTS size_t StreamIDs_Size; int64u StreamIDs[16]; int8u StreamIDs_Width[16]; int8u ParserIDs[16]; void Event_Prepare (struct MediaInfo_Event_Generic* Event); #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX int8u Demux_Level; //bit 0=frame, bit 1=container, bit 2=elementary (eg MPEG-TS), bit 3=ancillary (e.g. DTVCC), default with frame set bool Demux_random_access; bool Demux_UnpacketizeContainer; bool Demux_IntermediateItemFound; size_t Demux_Offset; int64u Demux_TotalBytes; #endif //MEDIAINFO_DEMUX Ztring File_Name_WithoutDemux; bool PTS_DTS_Needed; struct frame_info { int64u Buffer_Offset_End; int64u PCR; //In nanoseconds int64u PTS; //In nanoseconds int64u DTS; //In nanoseconds int64u DUR; //In nanoseconds frame_info() { Buffer_Offset_End=(int64u)-1; PCR=(int64u)-1; PTS=(int64u)-1; DTS=(int64u)-1; DUR=(int64u)-1; } }; frame_info FrameInfo; frame_info FrameInfo_Previous; frame_info FrameInfo_Next; std::vector Offsets_Stream; std::vector Offsets_Buffer; size_t Offsets_Pos; int8u* OriginalBuffer; size_t OriginalBuffer_Size; size_t OriginalBuffer_Capacity; //Out int64u PTS_Begin; //In nanoseconds int64u PTS_End; //In nanoseconds int64u DTS_Begin; //In nanoseconds int64u DTS_End; //In nanoseconds int64u Frame_Count; int64u Frame_Count_Previous; int64u Frame_Count_InThisBlock; int64u Field_Count; int64u Field_Count_Previous; int64u Field_Count_InThisBlock; int64u Frame_Count_NotParsedIncluded; int64u FrameNumber_PresentationOrder; bool Synched; //Data is synched bool UnSynched_IsNotJunk; //Data is actually synched bool MustExtendParsingDuration; //Data has some substreams difficult to detect (e.g. captions), must wait a bit before final filling protected : //*************************************************************************** // Streams management //*************************************************************************** virtual void Streams_Accept() {}; virtual void Streams_Fill() {}; virtual void Streams_Update() {}; virtual void Streams_Finish() {}; //*************************************************************************** // Synchro //*************************************************************************** virtual bool Synchronize() {Synched=true; return true;}; //Look for the synchro virtual bool Synched_Test() {return true;}; //Test is synchro is OK virtual void Synched_Init() {}; //When synched, we can Init data bool Synchro_Manage(); bool Synchro_Manage_Test(); //*************************************************************************** // Buffer //*************************************************************************** //Buffer virtual void Read_Buffer_Init () {}; //Temp, should be in File__Base caller virtual void Read_Buffer_Continue () {}; //Temp, should be in File__Base caller virtual void Read_Buffer_AfterParsing () {}; //Temp, should be in File__Base caller #if MEDIAINFO_SEEK virtual size_t Read_Buffer_Seek (size_t, int64u, int64u); //Temp, should be in File__Base caller size_t Read_Buffer_Seek_OneFramePerFile (size_t, int64u, int64u); #endif //MEDIAINFO_SEEK virtual void Read_Buffer_Unsynched () {}; //Temp, should be in File__Base caller void Read_Buffer_Unsynched_OneFramePerFile (); virtual void Read_Buffer_Finalize () {}; //Temp, should be in File__Base caller bool Buffer_Parse(); //*************************************************************************** // BitStream init //*************************************************************************** void BS_Begin(); void BS_Begin_LE(); //Little Endian version void BS_End(); void BS_End_LE(); //Little Endian version //*************************************************************************** // File Header //*************************************************************************** //File Header - Management bool FileHeader_Manage (); //File Header - Begin virtual bool FileHeader_Begin () {return true;}; //File Header - Parse virtual void FileHeader_Parse () {Element_DoNotShow();}; //*************************************************************************** // Header //*************************************************************************** //Header - Management bool Header_Manage (); //Header - Begin virtual bool Header_Begin () {return true;}; //Header - Parse virtual void Header_Parse (); //Header - Info void Header_Fill_Code (int64u Code); void Header_Fill_Code (int64u Code, const Ztring &Name); void Header_Fill_Size (int64u Size); //*************************************************************************** // Data //*************************************************************************** //Header - Management bool Data_Manage (); //Data - Parse virtual void Data_Parse () {}; //Data - Info void Data_Info (const Ztring &Parameter); inline void Data_Info_From_Milliseconds (int64u Parameter) {Data_Info(Ztring().Duration_From_Milliseconds(Parameter));} //Data - Get info size_t Data_Remain () {return (size_t)(Element_Size-(Element_Offset+BS->Offset_Get()));}; size_t Data_BS_Remain () {return (size_t)BS->Remain();}; //Data - Detect EOF virtual void Detect_EOF () {}; bool EOF_AlreadyDetected; //Data - Helpers void Data_Accept (const char* ParserName); void Data_Reject (const char* ParserName); void Data_Finish (const char* ParserName); void Data_GoTo (int64u GoTo, const char* ParserName); void Data_GoToFromEnd (int64u GoToFromEnd, const char* ParserName); //*************************************************************************** // Elements //*************************************************************************** //Elements - Begin void Element_Begin (); void Element_Begin (const Ztring &Name); inline void Element_Begin (const char *Name) {Element_Begin(Ztring().From_UTF8(Name));} #define Element_Begin0() Element_Begin() #define Element_Begin1(_NAME) Element_Begin(_NAME) #define Element_Trace_Begin0() Element_Begin() #define Element_Trace_Begin1(_NAME) Element_Begin(_NAME) //Elements - Name void Element_Name (const Ztring &Name); inline void Element_Name (const char* Name) {Element_Name(Ztring().From_UTF8(Name));} //Elements - Info void Element_Info (const Ztring &Parameter); inline void Element_Info (const char* Parameter) {Element_Info(Ztring().From_UTF8(Parameter));} inline void Element_Info (const char* Parameter, const char* Measure) {Element_Info(Ztring().From_UTF8(Parameter)+Ztring().From_UTF8(Measure));} inline void Element_Info (int8s Parameter, const char* Measure=NULL) {Element_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} inline void Element_Info (int8u Parameter, const char* Measure=NULL) {Element_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} inline void Element_Info (int16s Parameter, const char* Measure=NULL) {Element_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} inline void Element_Info (int16u Parameter, const char* Measure=NULL) {Element_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} inline void Element_Info (int32s Parameter, const char* Measure=NULL) {Element_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} inline void Element_Info (int32u Parameter, const char* Measure=NULL) {Element_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} inline void Element_Info (int64s Parameter, const char* Measure=NULL) {Element_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} inline void Element_Info (int64u Parameter, const char* Measure=NULL) {Element_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} inline void Element_Info (int128u Parameter, const char* Measure=NULL) {Element_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} #ifdef SIZE_T_IS_LONG inline void Element_Info (size_t Parameter, const char* Measure=NULL) {Element_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} #endif //SIZE_T_IS_LONG inline void Element_Info (float32 Parameter, int8u AfterComma=3, const char* Measure=NULL) {Element_Info(Ztring::ToZtring(Parameter, AfterComma)+Ztring().From_UTF8(Measure));} inline void Element_Info (float64 Parameter, int8u AfterComma=3, const char* Measure=NULL) {Element_Info(Ztring::ToZtring(Parameter, AfterComma)+Ztring().From_UTF8(Measure));} #define Element_Info1(_A) Element_Info(_A) #define Element_Info2(_A,_B) Element_Info(_A, _B) #define Element_Info3(_A,_B,_C) Element_Info(_A, _B, _C) #define Element_Info1C(_CONDITION,_A) if (_CONDITION) Element_Info(_A) inline void Element_Info_From_Milliseconds (int64u Parameter) {Element_Info(Ztring().Duration_From_Milliseconds(Parameter));} //Elements - End inline void Element_End () {Element_End_Common_Flush();} void Element_End (const Ztring &Name); inline void Element_End (const char *Name) {Element_End(Ztring().From_UTF8(Name));} #define Element_End0() Element_End() #define Element_End1(_NAME) Element_End(_NAME) #define Element_Trace_End0() Element_End() #define Element_Trace_End1(_NAME) Element_End(_NAME) //Elements - Preparation of element from external app void Element_Prepare (int64u Size); protected : //Element - Common void Element_End_Common_Flush(); void Element_End_Common_Flush_Details(); Ztring Element_End_Common_Flush_Build(); public : //*************************************************************************** // Param //*************************************************************************** //TODO: put this in Ztring() Ztring ToZtring(const char* Value, size_t Value_Size=Unlimited, bool Utf8=true) { if (Utf8) return Ztring().From_UTF8(Value, Value_Size); else return Ztring().From_Local(Value, Value_Size); } #define VALUE(Value) \ Ztring::ToZtring(Value).MakeUpperCase()+__T(" (0x")+Ztring::ToZtring(Value, 16).MakeUpperCase()+__T(")") //Param - Main void Param (const Ztring &Parameter, const Ztring& Value); inline void Param (const char* Parameter, const Ztring& Value) {Param(Ztring().From_Local(Parameter), Value);}; inline void Param (const char* Parameter, const std::string& Value) {Param(Parameter, Ztring().From_Local(Value.c_str()));} inline void Param (const char* Parameter, const char* Value, size_t Value_Size=Unlimited, bool Utf8=true) {Param(Parameter, ToZtring(Value, Value_Size, Utf8));} inline void Param (const char* Parameter, const int8u* Value, size_t Value_Size=Unlimited, bool Utf8=true) {Param(Parameter, (const char*)Value, Value_Size, Utf8);} inline void Param (const char* Parameter, bool Value) {if (Value) Param(Parameter, "Yes"); else Param(Parameter, "No");} inline void Param (const char* Parameter, int8u Value) {Param(Parameter, Ztring::ToZtring(Value)+__T(" (0x")+Ztring().From_CC1(Value)+__T(")"));} inline void Param (const char* Parameter, int8s Value) {Param(Parameter, Ztring::ToZtring(Value)+__T(" (0x")+Ztring().From_CC1(Value)+__T(")"));} inline void Param (const char* Parameter, int16u Value) {Param(Parameter, Ztring::ToZtring(Value)+__T(" (0x")+Ztring().From_CC2(Value)+__T(")"));} inline void Param (const char* Parameter, int16s Value) {Param(Parameter, Ztring::ToZtring(Value)+__T(" (0x")+Ztring().From_CC2(Value)+__T(")"));} inline void Param (const char* Parameter, int32u Value) {Param(Parameter, Ztring::ToZtring(Value)+__T(" (0x")+Ztring::ToZtring(Value, 16)+__T(")"));} inline void Param (const char* Parameter, int32s Value) {Param(Parameter, Ztring::ToZtring(Value)+__T(" (0x")+Ztring::ToZtring(Value, 16)+__T(")"));} inline void Param (const char* Parameter, int64u Value) {Param(Parameter, Ztring::ToZtring(Value)+__T(" (0x")+Ztring::ToZtring(Value, 16)+__T(")"));} inline void Param (const char* Parameter, int64s Value) {Param(Parameter, Ztring::ToZtring(Value)+__T(" (0x")+Ztring::ToZtring(Value, 16)+__T(")"));} inline void Param (const char* Parameter, int128u Value){Param(Parameter, Ztring::ToZtring(Value)+__T(" (0x")+Ztring::ToZtring(Value, 16)+__T(")"));} inline void Param_GUID (const char* Parameter, int128u Value){Param(Parameter, Ztring().From_GUID(Value));} inline void Param_UUID (const char* Parameter, int128u Value){Param(Parameter, Ztring().From_UUID(Value));} #ifdef SIZE_T_IS_LONG inline void Param (const char* Parameter, size_t Value, intu Radix=16) {Param(Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase()+__T(" (")+Ztring::ToZtring(Value, 10).MakeUpperCase()+__T(")"));} #endif //SIZE_T_IS_LONG inline void Param (const char* Parameter, float32 Value, int8u AfterComma=3) {Param(Parameter, Ztring::ToZtring(Value, AfterComma));} inline void Param (const char* Parameter, float64 Value, int8u AfterComma=3) {Param(Parameter, Ztring::ToZtring(Value, AfterComma));} inline void Param (const char* Parameter, float80 Value, int8u AfterComma=3) {Param(Parameter, Ztring::ToZtring(Value, AfterComma));} inline void Param (const int32u Parameter, const Ztring& Value) {Param(Ztring().From_CC4(Parameter), Value);}; inline void Param (const int16u Parameter, const Ztring& Value) {Param(Ztring().From_CC2(Parameter), Value);}; #define Param1(_A) Param_(_A) #define Param2(_A,_B) Param(_A, _B) #define Param3(_A,_B,_C) Param(_A, _B, _C) //Param - Info void Param_Info (const Ztring &Parameter); inline void Param_Info (const char* Parameter) {Param_Info(Ztring().From_UTF8(Parameter));} inline void Param_Info (const char* Parameter, const char* Measure) {Param_Info(Ztring().From_UTF8(Parameter)+Ztring().From_UTF8(Measure));} inline void Param_Info (int64u Parameter, const char* Measure=NULL) {Param_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} inline void Param_Info (int64s Parameter, const char* Measure=NULL) {Param_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} inline void Param_Info (int32u Parameter, const char* Measure=NULL) {Param_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} inline void Param_Info (int32s Parameter, const char* Measure=NULL) {Param_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} inline void Param_Info (int16u Parameter, const char* Measure=NULL) {Param_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} inline void Param_Info (int16s Parameter, const char* Measure=NULL) {Param_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} inline void Param_Info (int8u Parameter, const char* Measure=NULL) {Param_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} inline void Param_Info (int8s Parameter, const char* Measure=NULL) {Param_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} inline void Param_Info (float32 Parameter, int8u AfterComma=3, const char* Measure=NULL) {Param_Info(Ztring::ToZtring(Parameter, AfterComma)+Ztring().From_UTF8(Measure));} inline void Param_Info (float64 Parameter, int8u AfterComma=3, const char* Measure=NULL) {Param_Info(Ztring::ToZtring(Parameter, AfterComma)+Ztring().From_UTF8(Measure));} inline void Param_Info (float80 Parameter, int8u AfterComma=3, const char* Measure=NULL) {Param_Info(Ztring::ToZtring(Parameter, AfterComma)+Ztring().From_UTF8(Measure));} #ifdef SIZE_T_IS_LONG inline void Param_Info (size_t Parameter, const char* Measure=NULL) {Param_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));} #endif //SIZE_T_IS_LONG #define Param_Info1(_A) Param_Info(_A) #define Param_Info2(_A,_B) Param_Info(_A, _B) #define Param_Info3(_A,_B,_C) Param_Info(_A, _B, _C) #define Param_Info1C(_CONDITION,_A) if (_CONDITION) Param_Info(_A) #define Param_Info2C(_CONDITION,_A,_B) if (_CONDITION) Param_Info(_A, _B) #define Param_Info3C(_CONDITION,_A,_B,_C) if (_CONDITION) Param_Info(_A, _B, _C) inline void Param_Info_From_Milliseconds (int64u Parameter) {Param_Info(Ztring().Duration_From_Milliseconds(Parameter));} //*************************************************************************** // Information //*************************************************************************** void Info (const Ztring& Value, size_t Element_Level_Minus=0); //*************************************************************************** // Big Endian (Integer, Float, Fixed-Point) //*************************************************************************** void Get_B1 (int8u &Info, const char* Name); void Get_B2 (int16u &Info, const char* Name); void Get_B3 (int32u &Info, const char* Name); void Get_B4 (int32u &Info, const char* Name); void Get_B5 (int64u &Info, const char* Name); void Get_B6 (int64u &Info, const char* Name); void Get_B7 (int64u &Info, const char* Name); void Get_B8 (int64u &Info, const char* Name); void Get_B16 (int128u &Info, const char* Name); void Get_BF4 (float32 &Info, const char* Name); void Get_BF8 (float64 &Info, const char* Name); void Get_BF10 (float80 &Info, const char* Name); void Get_BFP4 (int8u Bits, float32 &Info, const char* Name); void Peek_B1 (int8u &Info); void Peek_B2 (int16u &Info); void Peek_B3 (int32u &Info); void Peek_B4 (int32u &Info); void Peek_B5 (int64u &Info); void Peek_B6 (int64u &Info); void Peek_B7 (int64u &Info); void Peek_B8 (int64u &Info); void Peek_B16 (int128u &Info); void Peek_BF4 (float32 &Info); void Peek_BF8 (float64 &Info); void Peek_BF10(float64 &Info); void Peek_BFP4(size_t Bits, float64 &Info); void Skip_B1 ( const char* Name); void Skip_B2 ( const char* Name); void Skip_B3 ( const char* Name); void Skip_B4 ( const char* Name); void Skip_B5 ( const char* Name); void Skip_B6 ( const char* Name); void Skip_B7 ( const char* Name); void Skip_B8 ( const char* Name); void Skip_B16 ( const char* Name); void Skip_BF4 ( const char* Name); void Skip_BF8 ( const char* Name); void Skip_BF10( const char* Name); void Skip_BFP4(int8u Bits, const char* Name); #define Info_B1(_INFO, _NAME) int8u _INFO; Get_B1 (_INFO, _NAME) #define Info_B2(_INFO, _NAME) int16u _INFO; Get_B2 (_INFO, _NAME) #define Info_B3(_INFO, _NAME) int32u _INFO; Get_B3 (_INFO, _NAME) #define Info_B4(_INFO, _NAME) int32u _INFO; Get_B4 (_INFO, _NAME) #define Info_B5(_INFO, _NAME) int64u _INFO; Get_B5 (_INFO, _NAME) #define Info_B6(_INFO, _NAME) int64u _INFO; Get_B6 (_INFO, _NAME) #define Info_B7(_INFO, _NAME) int64u _INFO; Get_B7 (_INFO, _NAME) #define Info_B8(_INFO, _NAME) int64u _INFO; Get_B8 (_INFO, _NAME) #define Info_B16(_INFO, _NAME) int128u _INFO; Get_B16 (_INFO, _NAME) #define Info_BF4(_INFO, _NAME) float32 _INFO; Get_BF4 (_INFO, _NAME) #define Info_BF8(_INFO, _NAME) float64 _INFO; Get_BF8 (_INFO, _NAME) #define Info_BF10(_INFO, _NAME) float80 _INFO; Get_BF10(_INFO, _NAME) #define Info_BFP4(_BITS, _INFO, _NAME) float32 _INFO; Get_BFP4(_BITS, _INFO, _NAME) //*************************************************************************** // Little Endian //*************************************************************************** void Get_L1 (int8u &Info, const char* Name); void Get_L2 (int16u &Info, const char* Name); void Get_L3 (int32u &Info, const char* Name); void Get_L4 (int32u &Info, const char* Name); void Get_L5 (int64u &Info, const char* Name); void Get_L6 (int64u &Info, const char* Name); void Get_L7 (int64u &Info, const char* Name); void Get_L8 (int64u &Info, const char* Name); void Get_L16 (int128u &Info, const char* Name); void Get_LF4 (float32 &Info, const char* Name); void Get_LF8 (float64 &Info, const char* Name); void Peek_L1 (int8u &Info); void Peek_L2 (int16u &Info); void Peek_L3 (int32u &Info); void Peek_L4 (int32u &Info); void Peek_L5 (int64u &Info); void Peek_L6 (int64u &Info); void Peek_L7 (int64u &Info); void Peek_L8 (int64u &Info); void Peek_L16(int128u &Info); void Peek_LF4(float32 &Info); void Peek_LF8(float64 &Info); void Skip_L1 ( const char* Name); void Skip_L2 ( const char* Name); void Skip_L3 ( const char* Name); void Skip_L4 ( const char* Name); void Skip_L5 ( const char* Name); void Skip_L6 ( const char* Name); void Skip_L7 ( const char* Name); void Skip_L8 ( const char* Name); void Skip_LF4( const char* Name); void Skip_LF8( const char* Name); void Skip_L16( const char* Name); #define Info_L1(_INFO, _NAME) int8u _INFO; Get_L1 (_INFO, _NAME) #define Info_L2(_INFO, _NAME) int16u _INFO; Get_L2 (_INFO, _NAME) #define Info_L3(_INFO, _NAME) int32u _INFO; Get_L3 (_INFO, _NAME) #define Info_L4(_INFO, _NAME) int32u _INFO; Get_L4 (_INFO, _NAME) #define Info_L5(_INFO, _NAME) int64u _INFO; Get_L5 (_INFO, _NAME) #define Info_L6(_INFO, _NAME) int64u _INFO; Get_L6 (_INFO, _NAME) #define Info_L7(_INFO, _NAME) int64u _INFO; Get_L7 (_INFO, _NAME) #define Info_L8(_INFO, _NAME) int64u _INFO; Get_L8 (_INFO, _NAME) #define Info_L16(_INFO, _NAME) int128u _INFO; Get_L16(_INFO, _NAME) #define Info_LF4(_INFO, _NAME) float32 _INFO; Get_LF4(_INFO, _NAME) #define Info_LF8(_INFO, _NAME) float64 _INFO; Get_LF8(_INFO, _NAME) //*************************************************************************** // Little and Big Endian together //*************************************************************************** void Get_D1 (int8u &Info, const char* Name); void Get_D2 (int16u &Info, const char* Name); void Get_D3 (int32u &Info, const char* Name); void Get_D4 (int32u &Info, const char* Name); void Get_D5 (int64u &Info, const char* Name); void Get_D6 (int64u &Info, const char* Name); void Get_D7 (int64u &Info, const char* Name); void Get_D8 (int64u &Info, const char* Name); void Get_D16 (int128u &Info, const char* Name); void Get_DF4 (float32 &Info, const char* Name); void Get_DF8 (float64 &Info, const char* Name); void Peek_D1 (int8u &Info); void Peek_D2 (int16u &Info); void Peek_D3 (int32u &Info); void Peek_D4 (int32u &Info); void Peek_D5 (int64u &Info); void Peek_D6 (int64u &Info); void Peek_D7 (int64u &Info); void Peek_D8 (int64u &Info); void Peek_D16(int128u &Info); void Peek_DF4(float32 &Info); void Peek_DF8(float64 &Info); void Skip_D1 ( const char* Name); void Skip_D2 ( const char* Name); void Skip_D3 ( const char* Name); void Skip_D4 ( const char* Name); void Skip_D5 ( const char* Name); void Skip_D6 ( const char* Name); void Skip_D7 ( const char* Name); void Skip_D8 ( const char* Name); void Skip_DF4( const char* Name); void Skip_DF8( const char* Name); void Skip_D16( const char* Name); #define Info_D1(_INFO, _NAME) int8u _INFO; Get_D1 (_INFO, _NAME) #define Info_D2(_INFO, _NAME) int16u _INFO; Get_D2 (_INFO, _NAME) #define Info_D3(_INFO, _NAME) int32u _INFO; Get_D3 (_INFO, _NAME) #define Info_D4(_INFO, _NAME) int32u _INFO; Get_D4 (_INFO, _NAME) #define Info_D5(_INFO, _NAME) int64u _INFO; Get_D5 (_INFO, _NAME) #define Info_D6(_INFO, _NAME) int64u _INFO; Get_D6 (_INFO, _NAME) #define Info_D7(_INFO, _NAME) int64u _INFO; Get_D7 (_INFO, _NAME) #define Info_D8(_INFO, _NAME) int64u _INFO; Get_D8 (_INFO, _NAME) #define Info_D16(_INFO, _NAME) int128u _INFO; Get_D16(_INFO, _NAME) #define Info_DF4(_INFO, _NAME) float32 _INFO; Get_DF4(_INFO, _NAME) #define Info_DF8(_INFO, _NAME) float64 _INFO; Get_DF8(_INFO, _NAME) //*************************************************************************** // GUID //*************************************************************************** void Get_GUID (int128u &Info, const char* Name); void Peek_GUID(int128u &Info); void Skip_GUID( const char* Name); #define Info_GUID(_INFO, _NAME) int128u _INFO; Get_GUID(_INFO, _NAME) //*************************************************************************** // UUID //*************************************************************************** void Get_UUID (int128u &Info, const char* Name); void Peek_UUID(int128u &Info); void Skip_UUID( const char* Name); #define Info_UUID(_INFO, _NAME) int128u _INFO; Get_UUID(_INFO, _NAME) //*************************************************************************** // EBML //*************************************************************************** void Get_EB (int64u &Info, const char* Name); void Get_ES (int64s &Info, const char* Name); void Skip_EB( const char* Name); void Skip_ES( const char* Name); #define Info_EB(_INFO, _NAME) int64u _INFO; Get_EB(_INFO, _NAME) #define Info_ES(_INFO, _NAME) int64s _INFO; Get_ES(_INFO, _NAME) //*************************************************************************** // Variable Size Value //*************************************************************************** void Get_VS (int64u &Info, const char* Name); void Skip_VS( const char* Name); #define Info_VS(_INFO, _NAME) int64u _INFO; Get_VS(_INFO, _NAME) //*************************************************************************** // Exp-Golomb //*************************************************************************** void Get_UE (int32u &Info, const char* Name); void Get_SE (int32s &Info, const char* Name); void Skip_UE( const char* Name); void Skip_SE( const char* Name); #define Info_UE(_INFO, _NAME) int32u _INFO; Get_UE(_INFO, _NAME) #define Info_SE(_INFO, _NAME) int32s _INFO; Get_SE(_INFO, _NAME) //*************************************************************************** // Interleaved Exp-Golomb //*************************************************************************** void Get_UI (int32u &Info, const char* Name); void Get_SI (int32s &Info, const char* Name); void Skip_UI( const char* Name); void Skip_SI( const char* Name); #define Info_UI(_INFO, _NAME) int32u _INFO; Get_UI(_INFO, _NAME) #define Info_SI(_INFO, _NAME) int32s _INFO; Get_SI(_INFO, _NAME) //*************************************************************************** // Variable Length Code //*************************************************************************** struct vlc { int32u value; int8u bit_increment; int8s mapped_to1; int8s mapped_to2; int8s mapped_to3; }; struct vlc_fast { int8u* Array; int8u* BitsToSkip; const vlc* Vlc; int8u Size; }; #define VLC_END \ {(int32u)-1, (int8u)-1, 0, 0, 0} void Get_VL_Prepare(vlc_fast &Vlc); void Get_VL (const vlc Vlc[], size_t &Info, const char* Name); void Get_VL (vlc_fast &Vlc, size_t &Info, const char* Name); void Skip_VL(const vlc Vlc[], const char* Name); void Skip_VL(vlc_fast &Vlc, const char* Name); #define Info_VL(Vlc, Info, Name) size_t Info; Get_VL(Vlc, Info, Name) //*************************************************************************** // Characters //*************************************************************************** void Get_C1 (int8u &Info, const char* Name); void Get_C2 (int16u &Info, const char* Name); void Get_C3 (int32u &Info, const char* Name); void Get_C4 (int32u &Info, const char* Name); void Get_C5 (int64u &Info, const char* Name); void Get_C6 (int64u &Info, const char* Name); void Get_C7 (int64u &Info, const char* Name); void Get_C8 (int64u &Info, const char* Name); void Skip_C1( const char* Name); void Skip_C2( const char* Name); void Skip_C3( const char* Name); void Skip_C4( const char* Name); void Skip_C5( const char* Name); void Skip_C6( const char* Name); void Skip_C7( const char* Name); void Skip_C8( const char* Name); #define Info_C1(_INFO, _NAME) int8u _INFO; Get_C1(_INFO, _NAME) #define Info_C2(_INFO, _NAME) int16u _INFO; Get_C2(_INFO, _NAME) #define Info_C3(_INFO, _NAME) int32u _INFO; Get_C3(_INFO, _NAME) #define Info_C4(_INFO, _NAME) int32u _INFO; Get_C4(_INFO, _NAME) #define Info_C5(_INFO, _NAME) int64u _INFO; Get_C5(_INFO, _NAME) #define Info_C6(_INFO, _NAME) int64u _INFO; Get_C6(_INFO, _NAME) #define Info_C7(_INFO, _NAME) int64u _INFO; Get_C7(_INFO, _NAME) #define Info_C8(_INFO, _NAME) int64u _INFO; Get_C8(_INFO, _NAME) //*************************************************************************** // Text //*************************************************************************** void Get_Local (int64u Bytes, Ztring &Info, const char* Name); void Get_ISO_8859_1(int64u Bytes, Ztring &Info, const char* Name); void Get_ISO_8859_2(int64u Bytes, Ztring &Info, const char* Name); void Get_String (int64u Bytes, std::string &Info, const char* Name); void Get_UTF8 (int64u Bytes, Ztring &Info, const char* Name); void Get_UTF16 (int64u Bytes, Ztring &Info, const char* Name); void Get_UTF16B (int64u Bytes, Ztring &Info, const char* Name); void Get_UTF16L (int64u Bytes, Ztring &Info, const char* Name); void Peek_Local (int64u Bytes, Ztring &Info); void Peek_String(int64u Bytes, std::string &Info); void Skip_Local (int64u Bytes, const char* Name); void Skip_String(int64u Bytes, const char* Name); void Skip_UTF8 (int64u Bytes, const char* Name); void Skip_UTF16B(int64u Bytes, const char* Name); void Skip_UTF16L(int64u Bytes, const char* Name); #define Info_Local(_BYTES, _INFO, _NAME) Ztring _INFO; Get_Local (_BYTES, _INFO, _NAME) #define Info_UTF8(_BYTES, _INFO, _NAME) Ztring _INFO; Get_UTF8 (_BYTES, _INFO, _NAME) #define Info_UTF16B(_BYTES, _INFO, _NAME) Ztring _INFO; Get_UTF16B(_BYTES, _INFO, _NAME) #define Info_UTF16L(_BYTES, _INFO, _NAME) Ztring _INFO; Get_UTF16L(_BYTES, _INFO, _NAME) //*************************************************************************** // PAscal strings //*************************************************************************** void Get_PA (std::string &Info, const char* Name); void Peek_PA(std::string &Info); void Skip_PA( const char* Name); #define Info_PA(_INFO, _NAME) Ztring _INFO; Get_PA (_INFO, _NAME) //*************************************************************************** // Unknown //*************************************************************************** void Skip_XX(int64u Bytes, const char* Name); //*************************************************************************** // Flags //*************************************************************************** void Get_Flags (int64u Flags, size_t Order, bool &Info, const char* Name); void Get_Flags (int64u ValueToPut, int8u &Info, const char* Name); void Skip_Flags(int64u Flags, size_t Order, const char* Name); void Skip_Flags(int64u ValueToPut, const char* Name); #define Get_FlagsM(_VALUE, _INFO, _NAME) Get_Flags(_VALUE, _INFO, _NAME) #define Skip_FlagsM(_VALUE, _NAME) Skip_Flags(_VALUE, _NAME) #define Info_Flags(_FLAGS, _ORDER, _INFO, _NAME) bool _INFO; Get_Flags (_FLAGS, _ORDER, _INFO, _NAME) //*************************************************************************** // BitStream //*************************************************************************** void Get_BS (int8u Bits, int32u &Info, const char* Name); void Get_SB ( bool &Info, const char* Name); bool Get_SB( const char* Name) {bool Temp; Get_SB(Temp, Name); return Temp;} void Get_S1 (int8u Bits, int8u &Info, const char* Name); void Get_S2 (int8u Bits, int16u &Info, const char* Name); void Get_S3 (int8u Bits, int32u &Info, const char* Name); void Get_S4 (int8u Bits, int32u &Info, const char* Name); void Get_S5 (int8u Bits, int64u &Info, const char* Name); void Get_S6 (int8u Bits, int64u &Info, const char* Name); void Get_S7 (int8u Bits, int64u &Info, const char* Name); void Get_S8 (int8u Bits, int64u &Info, const char* Name); void Peek_BS(int8u Bits, int32u &Info); void Peek_SB( bool &Info); bool Peek_SB() {bool Temp; Peek_SB(Temp); return Temp;} void Peek_S1(int8u Bits, int8u &Info); void Peek_S2(int8u Bits, int16u &Info); void Peek_S3(int8u Bits, int32u &Info); void Peek_S4(int8u Bits, int32u &Info); void Peek_S5(int8u Bits, int64u &Info); void Peek_S6(int8u Bits, int64u &Info); void Peek_S7(int8u Bits, int64u &Info); void Peek_S8(int8u Bits, int64u &Info); void Skip_BS(size_t Bits, const char* Name); void Skip_SB( const char* Name); void Skip_S1(int8u Bits, const char* Name); void Skip_S2(int8u Bits, const char* Name); void Skip_S3(int8u Bits, const char* Name); void Skip_S4(int8u Bits, const char* Name); void Skip_S5(int8u Bits, const char* Name); void Skip_S6(int8u Bits, const char* Name); void Skip_S7(int8u Bits, const char* Name); void Skip_S8(int8u Bits, const char* Name); void Mark_0 (); void Mark_0_NoTrustError (); //Use it for providing a warning instead of a non-trusting error void Mark_1 (); void Mark_1_NoTrustError (); //Use it for providing a warning instead of a non-trusting error #define Info_BS(_BITS, _INFO, _NAME) int32u _INFO; Get_BS(_BITS, _INFO, _NAME) #define Info_SB(_INFO, _NAME) bool _INFO; Get_SB( _INFO, _NAME) #define Info_S1(_BITS, _INFO, _NAME) int8u _INFO; Get_S1(_BITS, _INFO, _NAME) #define Info_S2(_BITS, _INFO, _NAME) int16u _INFO; Get_S2(_BITS, _INFO, _NAME) #define Info_S3(_BITS, _INFO, _NAME) int32u _INFO; Get_S4(_BITS, _INFO, _NAME) #define Info_S4(_BITS, _INFO, _NAME) int32u _INFO; Get_S4(_BITS, _INFO, _NAME) #define Info_S5(_BITS, _INFO, _NAME) int64u _INFO; Get_S5(_BITS, _INFO, _NAME) #define Info_S6(_BITS, _INFO, _NAME) int64u _INFO; Get_S6(_BITS, _INFO, _NAME) #define Info_S7(_BITS, _INFO, _NAME) int64u _INFO; Get_S7(_BITS, _INFO, _NAME) #define Info_S8(_BITS, _INFO, _NAME) int64u _INFO; Get_S8(_BITS, _INFO, _NAME) #define TEST_SB_GET(_CODE, _NAME) \ { \ Peek_SB(_CODE); \ if (!_CODE) \ Skip_SB( _NAME); \ else \ { \ Element_Begin1(_NAME); \ Skip_SB( _NAME); \ #define TEST_SB_SKIP(_NAME) \ { \ if (!Peek_SB()) \ Skip_SB( _NAME); \ else \ { \ Element_Begin1(_NAME); \ Skip_SB( _NAME); \ #define TESTELSE_SB_GET(_CODE, _NAME) \ { \ Peek_SB(_CODE); \ if (_CODE) \ { \ Element_Begin1(_NAME); \ Skip_SB( _NAME); \ #define TESTELSE_SB_SKIP(_NAME) \ { \ if (Peek_SB()) \ { \ Element_Begin1(_NAME); \ Skip_SB( _NAME); \ #define TESTELSE_SB_ELSE(_NAME) \ Element_End0(); \ } \ else \ { \ Skip_SB( _NAME); \ #define TESTELSE_SB_END() \ } \ } \ #define TEST_SB_END() \ Element_End0(); \ } \ } \ //*************************************************************************** // BitStream (Little Endian) //*************************************************************************** void Get_BT (size_t Bits, int32u &Info, const char* Name); void Get_TB ( bool &Info, const char* Name); bool Get_TB( const char* Name) {bool Temp; Get_TB(Temp, Name); return Temp;} void Get_T1 (size_t Bits, int8u &Info, const char* Name); void Get_T2 (size_t Bits, int16u &Info, const char* Name); void Get_T4 (size_t Bits, int32u &Info, const char* Name); void Get_T8 (size_t Bits, int64u &Info, const char* Name); void Peek_BT(size_t Bits, int32u &Info); void Peek_TB( bool &Info); bool Peek_TB() {bool Temp; Peek_TB(Temp); return Temp;} void Peek_T1(size_t Bits, int8u &Info); void Peek_T2(size_t Bits, int16u &Info); void Peek_T4(size_t Bits, int32u &Info); void Peek_T8(size_t Bits, int64u &Info); void Skip_BT(size_t Bits, const char* Name); void Skip_TB( const char* Name); void Skip_T1(size_t Bits, const char* Name); void Skip_T2(size_t Bits, const char* Name); void Skip_T4(size_t Bits, const char* Name); void Skip_T8(size_t Bits, const char* Name); #define Info_BT(_BITS, _INFO, _NAME) int32u _INFO; Get_BT(_BITS, _INFO, _NAME) #define Info_TB(_INFO, _NAME) bool _INFO; Get_TB( _INFO, _NAME) #define Info_T1(_BITS, _INFO, _NAME) int8u _INFO; Get_T1(_BITS, _INFO, _NAME) #define Info_T2(_BITS, _INFO, _NAME) int16u _INFO; Get_T2(_BITS, _INFO, _NAME) #define Info_T4(_BITS, _INFO, _NAME) int32u _INFO; Get_T4(_BITS, _INFO, _NAME) #define Info_T8(_BITS, _INFO, _NAME) int64u _INFO; Get_T8(_BITS, _INFO, _NAME) #define TEST_TB_GET(_CODE, _NAME) \ { \ Peek_TB(_CODE); \ if (!_CODE) \ Skip_TB( _NAME); \ else \ { \ Element_Begin1(_NAME); \ Skip_TB( _NAME); \ #define TEST_TB_SKIP(_NAME) \ { \ if (!Peek_TB()) \ Skip_TB( _NAME); \ else \ { \ Element_Begin1(_NAME); \ Skip_TB( _NAME); \ #define TESTELSE_TB_GET(_CODE, _NAME) \ { \ Peek_TB(_CODE); \ if (_CODE) \ { \ Element_Begin1(_NAME); \ Skip_TB( _NAME); \ #define TESTELSE_TB_SKIP(_NAME) \ { \ if (Peek_TB()) \ { \ Element_Begin1(_NAME); \ Skip_TB( _NAME); \ #define TESTELSE_TB_ELSE(_NAME) \ Element_End0(); \ } \ else \ { \ Skip_TB( _NAME); \ #define TESTELSE_TB_END() \ } \ } \ #define TEST_TB_END() \ Element_End0(); \ } \ } \ //*************************************************************************** // Next code planning //*************************************************************************** void NextCode_Add(int64u Code); void NextCode_Clear(); bool NextCode_Test(); //*************************************************************************** // Element trusting //*************************************************************************** void Trusted_IsNot (const char* Reason); //*************************************************************************** // Stream filling //*************************************************************************** //Elements - Preparation of element from external app size_t Stream_Prepare (stream_t KindOfStream, size_t StreamPos=(size_t)-1); size_t Stream_Erase (stream_t KindOfStream, size_t StreamPos); //Fill with datas (with parameter as a size_t) void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, const Ztring &Value, bool Replace=false); inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, const std::string &Value, bool Utf8=true, bool Replace=false) {if (Utf8) Fill(StreamKind, StreamPos, Parameter, Ztring().From_UTF8(Value.c_str(), Value.size()), Replace); else Fill(StreamKind, StreamPos, Parameter, Ztring().From_Local(Value.c_str(), Value.size()), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, const char* Value, size_t Value_Size=Unlimited, bool Utf8=true, bool Replace=false) {if (Utf8) Fill(StreamKind, StreamPos, Parameter, Ztring().From_UTF8(Value, Value_Size), Replace); else Fill(StreamKind, StreamPos, Parameter, Ztring().From_Local(Value, Value_Size), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, const wchar_t* Value, size_t Value_Size=Unlimited, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring().From_Unicode(Value, Value_Size), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, int8u Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, int8s Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, int16u Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, int16s Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, int32u Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, int32s Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, int64u Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, int64s Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, float32 Value, int8u AfterComma=3, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, AfterComma), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, float64 Value, int8u AfterComma=3, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, AfterComma), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, float80 Value, int8u AfterComma=3, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, AfterComma), Replace);} #ifdef SIZE_T_IS_LONG inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, size_t Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} #endif //SIZE_T_IS_LONG //Fill with datas void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, const Ztring &Value, bool Replace=false); inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, const std::string &Value, bool Utf8=true, bool Replace=false) {if (Utf8) Fill(StreamKind, StreamPos, Parameter, Ztring().From_UTF8(Value.c_str(), Value.size())); else Fill(StreamKind, StreamPos, Parameter, Ztring().From_Local(Value.c_str(), Value.size()), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, const char* Value, size_t Value_Size=Unlimited, bool Utf8=true, bool Replace=false) {if (Utf8) Fill(StreamKind, StreamPos, Parameter, Ztring().From_UTF8(Value, Value_Size), Replace); else Fill(StreamKind, StreamPos, Parameter, Ztring().From_Local(Value, Value_Size), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, const wchar_t* Value, size_t Value_Size=Unlimited, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring().From_Unicode(Value, Value_Size), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, int8u Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, int8s Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, int16u Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, int16s Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, int32u Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, int32s Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, int64u Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, int64s Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, float32 Value, int8u AfterComma=3, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, AfterComma), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, float64 Value, int8u AfterComma=3, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, AfterComma), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, float80 Value, int8u AfterComma=3, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, AfterComma), Replace);} #ifdef SIZE_T_IS_LONG inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, size_t Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} #endif //SIZE_T_IS_LONG ZtringListList Fill_Temp; void Fill_Flush (); size_t Fill_Parameter(stream_t StreamKind, generic StreamPos); const Ztring &Retrieve_Const (stream_t StreamKind, size_t StreamPos, size_t Parameter, info_t KindOfInfo=Info_Text); Ztring Retrieve (stream_t StreamKind, size_t StreamPos, size_t Parameter, info_t KindOfInfo=Info_Text); const Ztring &Retrieve_Const (stream_t StreamKind, size_t StreamPos, const char* Parameter, info_t KindOfInfo=Info_Text); Ztring Retrieve (stream_t StreamKind, size_t StreamPos, const char* Parameter, info_t KindOfInfo=Info_Text); void Clear (stream_t StreamKind, size_t StreamPos, size_t Parameter); void Clear (stream_t StreamKind, size_t StreamPos, const char* Parameter); void Clear (stream_t StreamKind, size_t StreamPos); void Clear (stream_t StreamKind); inline void Clear () {File__Base::Clear();} //*************************************************************************** // Filling //*************************************************************************** //Actions void Accept (const char* ParserName=NULL); void Accept (File__Analyze* Parser); void Reject (const char* ParserName=NULL); void Reject (File__Analyze* Parser); void Update (const char* ParserName=NULL); void Update (File__Analyze* Parser); void Fill (const char* ParserName=NULL); void Fill (File__Analyze* Parser); void Finish (const char* ParserName=NULL); void Finish (File__Analyze* Parser); void ForceFinish (const char* ParserName=NULL); void ForceFinish (File__Analyze* Parser); void GoTo (int64u GoTo, const char* ParserName=NULL); void GoToFromEnd (int64u GoToFromEnd, const char* ParserName=NULL); int64u Element_Code_Get (size_t Level); int64u Element_TotalSize_Get (size_t LevelLess=0); bool Element_IsComplete_Get (); void Element_ThisIsAList (); void Element_WaitForMoreData (); void Element_DoNotTrust (const char* Reason); void Element_DoNotShow (); void Element_Show (); bool Element_Show_Get (); void Element_Show_Add (const Ztring &ToShow); //Status bool Element_IsOK (); bool Element_IsNotFinished (); bool Element_IsWaitingForMoreData (); //*************************************************************************** // Merging //*************************************************************************** //Utils public : size_t Merge(MediaInfo_Internal &ToAdd, bool Erase=true); //Merge 2 File_Base size_t Merge(MediaInfo_Internal &ToAdd, stream_t StreamKind, size_t StreamPos_From, size_t StreamPos_To, bool Erase=true); //Merge 2 streams size_t Merge(File__Analyze &ToAdd, bool Erase=true); //Merge 2 File_Base size_t Merge(File__Analyze &ToAdd, stream_t StreamKind, size_t StreamPos_From, size_t StreamPos_To, bool Erase=true); //Merge 2 streams void CodecID_Fill (const Ztring &Value, stream_t StreamKind, size_t StreamPos, infocodecid_format_t Format); //*************************************************************************** // Finalize //*************************************************************************** //End void Streams_Finish_Global(); protected : void Streams_Finish_StreamOnly(); void Streams_Finish_StreamOnly(stream_t StreamKid, size_t StreamPos); void Streams_Finish_StreamOnly_General(size_t StreamPos); void Streams_Finish_StreamOnly_Video(size_t StreamPos); void Streams_Finish_StreamOnly_Audio(size_t StreamPos); void Streams_Finish_StreamOnly_Text(size_t StreamPos); void Streams_Finish_StreamOnly_Other(size_t StreamPos); void Streams_Finish_StreamOnly_Image(size_t StreamPos); void Streams_Finish_StreamOnly_Menu(size_t StreamPos); void Streams_Finish_InterStreams(); void Streams_Finish_Cosmetic(); void Streams_Finish_Cosmetic(stream_t StreamKid, size_t StreamPos); void Streams_Finish_Cosmetic_General(size_t StreamPos); void Streams_Finish_Cosmetic_Video(size_t StreamPos); void Streams_Finish_Cosmetic_Audio(size_t StreamPos); void Streams_Finish_Cosmetic_Text(size_t StreamPos); void Streams_Finish_Cosmetic_Chapters(size_t StreamPos); void Streams_Finish_Cosmetic_Image(size_t StreamPos); void Streams_Finish_Cosmetic_Menu(size_t StreamPos); void Tags (); void Video_FrameRate_Rounding (size_t Pos, video Parameter); void Video_BitRate_Rounding (size_t Pos, video Parameter); void Audio_BitRate_Rounding (size_t Pos, audio Parameter); //Utils - Finalize void Duration_Duration123 (stream_t StreamKind, size_t StreamPos, size_t Parameter); void FileSize_FileSize123 (stream_t StreamKind, size_t StreamPos, size_t Parameter); void Kilo_Kilo123 (stream_t StreamKind, size_t StreamPos, size_t Parameter); void Value_Value123 (stream_t StreamKind, size_t StreamPos, size_t Parameter); void YesNo_YesNo (stream_t StreamKind, size_t StreamPos, size_t Parameter); //*************************************************************************** // //*************************************************************************** protected : //Save for speed improvement float Config_Trace_Level; std::bitset<32> Config_Trace_Layers; MediaInfo_Config::trace_Format Config_Trace_Format; int8u Config_Demux; Ztring Config_LineSeparator; bool IsSub; bool IsRawStream; //Configuration bool DataMustAlwaysBeComplete; //Data must always be complete, else wait for more data bool MustUseAlternativeParser; //Must use the second parser (example: for Data part) //Synchro bool MustParseTheHeaderFile; //There is an header part, must parse it size_t Trusted; size_t Trusted_Multiplier; //Elements size_t Element_Level; //Current level bool Element_WantNextLevel; //Want to go to the next leavel instead of the same level //Element int64u Element_Code; //Code filled in the file, copy of Element[Element_Level].Code int64u Element_Offset; //Position in the Element (without header) int64u Element_Size; //Size of the Element (without header) private : //*************************************************************************** // Buffer //*************************************************************************** void Buffer_Clear(); //Clear the buffer protected : //Buffer bool Open_Buffer_Continue_Loop(); const int8u* Buffer; public : //TO CHANGE size_t Buffer_Size; int64u Buffer_TotalBytes; int64u Buffer_TotalBytes_FirstSynched; int64u Buffer_TotalBytes_LastSynched; int64u Buffer_PaddingBytes; int64u Buffer_JunkBytes; float64 Stream_BitRateFromContainer; protected : int8u* Buffer_Temp; size_t Buffer_Temp_Size; size_t Buffer_Temp_Size_Max; size_t Buffer_Offset; //Temporary usage in this parser size_t Buffer_Offset_Temp; //Temporary usage in this parser size_t Buffer_MinimumSize; size_t Buffer_MaximumSize; int64u Buffer_TotalBytes_FirstSynched_Max; int64u Buffer_TotalBytes_Fill_Max; friend class File__Tags_Helper; //*************************************************************************** // Helpers //*************************************************************************** bool FileHeader_Begin_0x000001(); bool FileHeader_Begin_XML(tinyxml2::XMLDocument &Document); bool Synchronize_0x000001(); public: void TestContinuousFileNames(size_t CountOfFiles=24, Ztring FileExtension=Ztring()); private : //*************************************************************************** // Elements //*************************************************************************** //Data size_t Data_Level; //Current level for Data ("Top level") //Element BitStream_Fast* BS; //For conversion from bytes to bitstream BitStream* BT; //For conversion from bytes to bitstream public : //TO CHANGE int64u Header_Size; //Size of the header of the current element const Ztring &Details_Get() {return Element[0].ToShow.Details;} //Direct access to details void Details_Clear(); protected : bool Trace_DoNotSave; bool Trace_Activated; std::bitset<32> Trace_Layers; void Trace_Layers_Update (size_t Layer=(size_t)-1); private : //Elements size_t Element_Level_Base; //From other parsers struct element_details { struct to_show { int64u Pos; //Position of the element in the file int64u Size; //Size of the element (including header and sub-elements) int64u Header_Size; //Size of the header of the element Ztring Name; //Name planned for this element Ztring Info; //More info about the element Ztring Details; //The main text bool NoShow; //Don't show this element }; int64u Code; //Code filled in the file int64u Next; // bool WaitForMoreData; //This element is not complete, we need more data bool UnTrusted; //This element has a problem bool IsComplete; //This element is fully buffered, no need of more to_show ToShow; }; std::vector Element; //NextCode std::map NextCode; //BookMarks size_t BookMark_Element_Level; int64u BookMark_GoTo; std::vector BookMark_Code; std::vector BookMark_Next; public : void BookMark_Set(size_t Element_Level_ToGet=(size_t)-1); void BookMark_Get(); virtual bool BookMark_Needed() {return false;}; //Temp std::bitset<32> Status; enum status { IsAccepted, IsFilled, IsUpdated, IsFinished, Reserved_04, Reserved_05, Reserved_06, Reserved_07, Reserved_08, Reserved_09, Reserved_10, Reserved_11, Reserved_12, Reserved_13, Reserved_14, Reserved_15, User_16, User_17, User_18, User_19, User_20, User_21, User_22, User_23, User_24, User_25, User_26, User_27, User_28, User_29, User_30, User_31, }; bool ShouldContinueParsing; //Configuration bool MustSynchronize; bool CA_system_ID_MustSkipSlices; //Demux enum contenttype { ContentType_MainStream, ContentType_SubStream, ContentType_Header, ContentType_Synchro }; #if MEDIAINFO_DEMUX void Demux (const int8u* Buffer, size_t Buffer_Size, contenttype ContentType, const int8u* OriginalBuffer=NULL, size_t OriginalBuffer_Size=0); virtual bool Demux_UnpacketizeContainer_Test() {return true;} bool Demux_UnpacketizeContainer_Test_OneFramePerFile(); void Demux_UnpacketizeContainer_Demux(bool random_access=true); void Demux_UnpacketizeContainer_Demux_Clear(); bool Demux_EventWasSent_Accept_Specific; #else //MEDIAINFO_DEMUX #define Demux(_A, _B, _C) #endif //MEDIAINFO_DEMUX //Events data bool PES_FirstByte_IsAvailable; bool PES_FirstByte_Value; int64u Unsynch_Frame_Count; //MD5 #if MEDIAINFO_MD5 struct MD5Context* MD5; int64u Md5_ParseUpTo; #endif //MEDIAINFO_MD5 #if MEDIAINFO_SEEK private: bool Seek_Duration_Detected; #endif //MEDIAINFO_SEEK #if MEDIAINFO_IBI public: bool Config_Ibi_Create; int64u Ibi_SynchronizationOffset_Current; int64u Ibi_SynchronizationOffset_BeginOfFrame; ibi Ibi; //If Main only ibi::stream* IbiStream; //If sub only size_t Ibi_Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); void Ibi_Read_Buffer_Unsynched (); void Ibi_Stream_Finish (); void Ibi_Stream_Finish (int64u Numerator, int64u Denominator); //Partial void Ibi_Add (); #else //MEDIAINFO_IBI size_t Ibi_Read_Buffer_Seek (size_t, int64u, int64u) {return (size_t)-1;} void Ibi_Read_Buffer_Unsynched () {} void Ibi_Stream_Finish () {} void Ibi_Stream_Finish (int64u, int64u) {} void Ibi_Add () {} #endif //MEDIAINFO_IBI }; //Helpers #define DETAILS_INFO(_DATA) _DATA #endif //MEDIAINFO_TRACE } //NameSpace /* #define BS_END() \ { \ BS.Byte_Align(); \ int32u BS_Value=0x00; \ while(BS.Remain()>0 && BS_Value==0x00) \ BS_Value=BS.Get(8); \ if (BS_Value!=0x00) \ INTEGRITY_SIZE(BS.Offset_Get()-1, BS.Offset_Get()) \ else \ INTEGRITY_SIZE(BS.Offset_Get(), BS.Offset_Get()) \ } \ #define BS_END_FF() \ { \ BS.Byte_Align(); \ int32u BS_Value=0xFF; \ while(BS.Remain()>0 && BS_Value==0x00) \ BS_Value=BS.Get(8); \ if (BS_Value!=0xFF) \ INTEGRITY_SIZE(BS.Offset_Get()-1, BS.Offset_Get()) \ else \ INTEGRITY_SIZE(BS.Offset_Get(), BS.Offset_Get()) \ } \ #define BS_END_CANBEMORE() \ { \ } \ */ //Begin #define FILLING_BEGIN() \ if (Element_IsOK()) \ { #define FILLING_BEGIN_PRECISE() \ if (Element_Offset!=Element_Size) \ Trusted_IsNot("Size error"); \ else if (Element_IsOK()) \ { //Else #define FILLING_ELSE() \ } \ else \ { \ //End #define FILLING_END() \ } #define ATOM_BEGIN \ if (Level!=Element_Level) \ { \ Level++; \ switch (Element_Code_Get(Level)) \ { \ #define ATOM(_ATOM) \ case Elements::_ATOM : \ if (Level==Element_Level) \ { \ if (Element_IsComplete_Get()) \ _ATOM(); \ else \ { \ Element_WaitForMoreData(); \ return; \ } \ } \ break; \ #define ATOM_PARTIAL(_ATOM) \ case Elements::_ATOM : \ if (Level==Element_Level) \ _ATOM(); \ break; \ #define ATOM_DEFAULT(_ATOM) \ default : \ if (Level==Element_Level) \ { \ if (Element_IsComplete_Get()) \ _ATOM(); \ else \ { \ Element_WaitForMoreData(); \ return; \ } \ } \ break; \ #define ATOM_END \ default : \ Skip_XX(Element_TotalSize_Get(), "Unknown"); \ } \ } \ break; \ #define LIST(_ATOM) \ case Elements::_ATOM : \ if (Level==Element_Level) \ { \ Element_ThisIsAList(); \ _ATOM(); \ } \ #define LIST_DEFAULT(_ATOM) \ default : \ if (Level==Element_Level) \ { \ Element_ThisIsAList(); \ _ATOM(); \ } \ #define ATOM_END_DEFAULT \ } \ } \ break; \ #define ATOM_DEFAULT_ALONE(_ATOM) \ if (Level!=Element_Level) \ { \ Level++; \ if (Level==Element_Level) \ { \ if (Element_IsComplete_Get()) \ _ATOM(); \ else \ { \ Element_WaitForMoreData(); \ return; \ } \ } \ } \ break; \ #define LIST_DEFAULT_ALONE_BEGIN(_ATOM) \ if (Level!=Element_Level) \ { \ Level++; \ if (Level==Element_Level) \ { \ Element_ThisIsAList(); \ _ATOM(); \ } \ #define LIST_DEFAULT_ALONE_END \ } \ break; \ #define LIST_SKIP(_ATOM) \ case Elements::_ATOM : \ if (Level==Element_Level) \ { \ Element_ThisIsAList(); \ _ATOM(); \ } \ break; \ #define DATA_BEGIN \ size_t Level=0; \ ATOM_BEGIN \ #define DATA_END \ default : ; \ Skip_XX(Element_TotalSize_Get(), "Unknown"); \ } \ } \ #define DATA_DEFAULT \ default : \ #define DATA_END_DEFAULT \ } \ } \ #endif MediaInfoLib/Source/MediaInfo/File__Analyze_Buffer.cpp100777 0 0 236432 12226004262 16316 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include "MediaInfo/MediaInfo_Config.h" #include "ZenLib/BitStream_LE.h" #include using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- extern MediaInfo_Config Config; //--------------------------------------------------------------------------- //Integrity test #define INTEGRITY(TOVALIDATE, ERRORTEXT, OFFSET) \ if (!(TOVALIDATE)) \ { \ Trusted_IsNot(ERRORTEXT); \ return; \ } \ #define INTEGRITY_INT(TOVALIDATE, ERRORTEXT, OFFSET) \ if (!(TOVALIDATE)) \ { \ Trusted_IsNot(ERRORTEXT); \ Info=0; \ return; \ } \ #define INTEGRITY_SIZE_ATLEAST(_BYTES) \ if (Element_Offset+_BYTES>Element_Size) \ { \ Trusted_IsNot("Size is wrong"); \ return; \ } \ #define INTEGRITY_SIZE_ATLEAST_STRING(_BYTES) \ if (Element_Offset+_BYTES>Element_Size) \ { \ Trusted_IsNot("Size is wrong"); \ Info.clear(); \ return; \ } \ #define INTEGRITY_SIZE_ATLEAST_INT(_BYTES) \ if (Element_Offset+_BYTES>Element_Size) \ { \ Trusted_IsNot("Size is wrong"); \ Info=0; \ return; \ } \ #define INTEGRITY_SIZE_ATLEAST_BUFFER() \ if (BS->Remain()==0) \ { \ Trusted_IsNot("Size is wrong"); \ Info=0; \ return; \ } \ //*************************************************************************** // Init //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::BS_Begin() { size_t BS_Size; if (Element_Offset>=Element_Size) BS_Size=0; else if (Buffer_Offset+Element_Size<=Buffer_Size) BS_Size=(size_t)(Element_Size-Element_Offset); else if (Buffer_Offset+Element_Offset<=Buffer_Size) BS_Size=Buffer_Size-(size_t)(Buffer_Offset+Element_Offset); else BS_Size=0; BS->Attach(Buffer+Buffer_Offset+(size_t)Element_Offset, BS_Size); } //--------------------------------------------------------------------------- void File__Analyze::BS_Begin_LE() { size_t BS_Size; if (Buffer_Offset+Element_Size<=Buffer_Size) BS_Size=(size_t)(Element_Size-Element_Offset); else if (Buffer_Offset+Element_Offset<=Buffer_Size) BS_Size=Buffer_Size-(size_t)(Buffer_Offset+Element_Offset); else BS_Size=0; BT->Attach(Buffer+Buffer_Offset+(size_t)Element_Offset, BS_Size); } //--------------------------------------------------------------------------- void File__Analyze::BS_End() { BS->Byte_Align(); Element_Offset+=BS->Offset_Get(); BS->Attach(NULL, 0); } //--------------------------------------------------------------------------- void File__Analyze::BS_End_LE() { BT->Byte_Align(); Element_Offset+=BT->Offset_Get(); BT->Attach(NULL, 0); } //*************************************************************************** // Big Endian //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_B1(int8u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(1); Info=BigEndian2int8u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=1; } //--------------------------------------------------------------------------- void File__Analyze::Get_B2(int16u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(2); Info=BigEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=2; } //--------------------------------------------------------------------------- void File__Analyze::Get_B3(int32u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(3); Info=BigEndian2int24u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) { Ztring Pos1; Pos1.From_Number(Info, 16); Ztring Temp; Temp.resize(6-Pos1.size(), __T('0')); Temp.append(Pos1); Temp.MakeUpperCase(); Param(Name, Ztring::ToZtring(Info)+__T(" (0x")+Temp+__T(")")); } Element_Offset+=3; } //--------------------------------------------------------------------------- void File__Analyze::Get_B4(int32u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(4); Info=BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) { Ztring Pos1; Pos1.From_Number(Info, 16); Ztring Temp; Temp.resize(8-Pos1.size(), __T('0')); Temp.append(Pos1); Temp.MakeUpperCase(); Param(Name, Ztring::ToZtring(Info)+__T(" (0x")+Temp+__T(")")); } Element_Offset+=4; } //--------------------------------------------------------------------------- void File__Analyze::Get_B5(int64u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(5); Info=BigEndian2int40u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=5; } //--------------------------------------------------------------------------- void File__Analyze::Get_B6(int64u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(6); Info=BigEndian2int48u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=6; } //--------------------------------------------------------------------------- void File__Analyze::Get_B7(int64u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(7); Info=BigEndian2int56u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=7; } //--------------------------------------------------------------------------- void File__Analyze::Get_B8(int64u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(8); Info=BigEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=8; } //--------------------------------------------------------------------------- void File__Analyze::Get_B16(int128u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(16); //Info=BigEndian2int128u(Buffer+Buffer_Offset+(size_t)Element_Offset); Info.hi=BigEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset); Info.lo=BigEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset+8); if (Trace_Activated) Param(Name, Info); Element_Offset+=16; } //--------------------------------------------------------------------------- void File__Analyze::Get_BF4(float32 &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(4); Info=BigEndian2float32(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=4; } //--------------------------------------------------------------------------- void File__Analyze::Get_BF8(float64 &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(8); Info=BigEndian2float64(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=8; } //--------------------------------------------------------------------------- void File__Analyze::Get_BF10(float80 &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(10); Info=BigEndian2float80(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=10; } //--------------------------------------------------------------------------- void File__Analyze::Get_BFP4(int8u Bits, float32 &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(4); BS_Begin(); int32s Integer=(int32s)BS->Get4(Bits); int32u Fraction=BS->Get4(32-Bits); BS_End(); Element_Offset-=4; //Because of BS_End() if (Integer>=(1<Get4(Bits); int32u Fraction=BS->Get4(32-Bits); BS_End(); Element_Offset-=4; //Because of BS_End() if (Trace_Activated) Param(Name, Integer+((float32)Fraction)/(1<<(32-Bits))); Element_Offset+=4; } //*************************************************************************** // Little Endian //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_L1(int8u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(1); Info=LittleEndian2int8u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=1; } //--------------------------------------------------------------------------- void File__Analyze::Get_L2(int16u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(2); Info=LittleEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=2; } //--------------------------------------------------------------------------- void File__Analyze::Get_L3(int32u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(3); Info=LittleEndian2int24u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=3; } //--------------------------------------------------------------------------- void File__Analyze::Get_L4(int32u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(4); Info=LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=4; } //--------------------------------------------------------------------------- void File__Analyze::Get_L5(int64u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(5); Info=LittleEndian2int40u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=5; } //--------------------------------------------------------------------------- void File__Analyze::Get_L6(int64u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(6); Info=LittleEndian2int48u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=6; } //--------------------------------------------------------------------------- void File__Analyze::Get_L7(int64u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(7); Info=LittleEndian2int56u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=7; } //--------------------------------------------------------------------------- void File__Analyze::Get_L8(int64u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(8); Info=LittleEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=8; } //--------------------------------------------------------------------------- void File__Analyze::Get_L16(int128u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(16); //Info=LittleEndian2int128u(Buffer+Buffer_Offset+(size_t)Element_Offset); Info.hi=LittleEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset); Info.lo=LittleEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset+8); if (Trace_Activated) Param(Name, Info); Element_Offset+=16; } //--------------------------------------------------------------------------- void File__Analyze::Get_LF4(float32 &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(4); Info=LittleEndian2float32(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=4; } //--------------------------------------------------------------------------- void File__Analyze::Get_LF8(float64 &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(8); Info=LittleEndian2float64(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=8; } //--------------------------------------------------------------------------- void File__Analyze::Peek_L1(int8u &Info) { INTEGRITY_SIZE_ATLEAST_INT(1); Info=LittleEndian2int8u(Buffer+Buffer_Offset+(size_t)Element_Offset); } //--------------------------------------------------------------------------- void File__Analyze::Peek_L2(int16u &Info) { INTEGRITY_SIZE_ATLEAST_INT(2); Info=LittleEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset); } //--------------------------------------------------------------------------- void File__Analyze::Peek_L3(int32u &Info) { INTEGRITY_SIZE_ATLEAST_INT(3); Info=LittleEndian2int24u(Buffer+Buffer_Offset+(size_t)Element_Offset); } //--------------------------------------------------------------------------- void File__Analyze::Peek_L4(int32u &Info) { INTEGRITY_SIZE_ATLEAST_INT(4); Info=LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset); } //--------------------------------------------------------------------------- void File__Analyze::Peek_L5(int64u &Info) { INTEGRITY_SIZE_ATLEAST_INT(5); Info=LittleEndian2int40u(Buffer+Buffer_Offset+(size_t)Element_Offset); } //--------------------------------------------------------------------------- void File__Analyze::Peek_L6(int64u &Info) { INTEGRITY_SIZE_ATLEAST_INT(6); Info=LittleEndian2int48u(Buffer+Buffer_Offset+(size_t)Element_Offset); } //--------------------------------------------------------------------------- void File__Analyze::Peek_L7(int64u &Info) { INTEGRITY_SIZE_ATLEAST_INT(7); Info=LittleEndian2int56u(Buffer+Buffer_Offset+(size_t)Element_Offset); } //--------------------------------------------------------------------------- void File__Analyze::Peek_L8(int64u &Info) { INTEGRITY_SIZE_ATLEAST_INT(8); Info=LittleEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset); } //--------------------------------------------------------------------------- void File__Analyze::Skip_L1(const char* Name) { INTEGRITY_SIZE_ATLEAST(1); if (Trace_Activated) Param(Name, LittleEndian2int8u(Buffer+Buffer_Offset+(size_t)Element_Offset)); Element_Offset+=1; } //--------------------------------------------------------------------------- void File__Analyze::Skip_L2(const char* Name) { INTEGRITY_SIZE_ATLEAST(2); if (Trace_Activated) Param(Name, LittleEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset)); Element_Offset+=2; } //--------------------------------------------------------------------------- void File__Analyze::Skip_L3(const char* Name) { INTEGRITY_SIZE_ATLEAST(3); if (Trace_Activated) { int32u Info=LittleEndian2int24u(Buffer+Buffer_Offset+(size_t)Element_Offset); Ztring Pos1; Pos1.From_Number(Info, 16); Ztring Temp; Temp.resize(6-Pos1.size(), __T('0')); Temp.append(Pos1); Temp.MakeUpperCase(); Param(Name, Ztring::ToZtring(Info)+__T(" (0x")+Temp+__T(")")); } Element_Offset+=3; } //--------------------------------------------------------------------------- void File__Analyze::Skip_L4(const char* Name) { INTEGRITY_SIZE_ATLEAST(4); if (Trace_Activated) { int32u Info=LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset); Ztring Pos1; Pos1.From_Number(Info, 16); Ztring Temp; Temp.resize(8-Pos1.size(), __T('0')); Temp.append(Pos1); Temp.MakeUpperCase(); Param(Name, Ztring::ToZtring(Info)+__T(" (0x")+Temp+__T(")")); } Element_Offset+=4; } //--------------------------------------------------------------------------- void File__Analyze::Skip_L5(const char* Name) { INTEGRITY_SIZE_ATLEAST(5); if (Trace_Activated) Param(Name, LittleEndian2int40u(Buffer+Buffer_Offset+(size_t)Element_Offset)); Element_Offset+=5; } //--------------------------------------------------------------------------- void File__Analyze::Skip_L6(const char* Name) { INTEGRITY_SIZE_ATLEAST(6); if (Trace_Activated) Param(Name, LittleEndian2int48u(Buffer+Buffer_Offset+(size_t)Element_Offset)); Element_Offset+=6; } //--------------------------------------------------------------------------- void File__Analyze::Skip_L7(const char* Name) { INTEGRITY_SIZE_ATLEAST(7); if (Trace_Activated) Param(Name, LittleEndian2int56u(Buffer+Buffer_Offset+(size_t)Element_Offset)); Element_Offset+=7; } //--------------------------------------------------------------------------- void File__Analyze::Skip_L8(const char* Name) { INTEGRITY_SIZE_ATLEAST(8); if (Trace_Activated) Param(Name, LittleEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset)); Element_Offset+=8; } //--------------------------------------------------------------------------- void File__Analyze::Skip_L16(const char* Name) { INTEGRITY_SIZE_ATLEAST(16); if (Trace_Activated) Param(Name, LittleEndian2int128u(Buffer+Buffer_Offset+(size_t)Element_Offset)); Element_Offset+=16; } //*************************************************************************** // Little and Big Endian together //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_D1(int8u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(2); Info=LittleEndian2int8u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=2; } //--------------------------------------------------------------------------- void File__Analyze::Get_D2(int16u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(4); Info=LittleEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=4; } //--------------------------------------------------------------------------- void File__Analyze::Get_D3(int32u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(6); Info=LittleEndian2int24u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=6; } //--------------------------------------------------------------------------- void File__Analyze::Get_D4(int32u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(8); Info=LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=8; } //--------------------------------------------------------------------------- void File__Analyze::Get_D5(int64u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(10); Info=LittleEndian2int40u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=10; } //--------------------------------------------------------------------------- void File__Analyze::Get_D6(int64u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(12); Info=LittleEndian2int48u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=12; } //--------------------------------------------------------------------------- void File__Analyze::Get_D7(int64u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(14); Info=LittleEndian2int56u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=14; } //--------------------------------------------------------------------------- void File__Analyze::Get_D8(int64u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(16); Info=LittleEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=16; } //--------------------------------------------------------------------------- void File__Analyze::Get_D16(int128u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(32); //Info=LittleEndian2int128u(Buffer+Buffer_Offset+(size_t)Element_Offset); Info.hi=LittleEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset); Info.lo=LittleEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset+8); if (Trace_Activated) Param(Name, Info); Element_Offset+=32; } //--------------------------------------------------------------------------- void File__Analyze::Get_DF4(float32 &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(8); Info=LittleEndian2float32(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=8; } //--------------------------------------------------------------------------- void File__Analyze::Get_DF8(float64 &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(16); Info=LittleEndian2float64(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Info); Element_Offset+=16; } //--------------------------------------------------------------------------- void File__Analyze::Peek_D1(int8u &Info) { INTEGRITY_SIZE_ATLEAST_INT(8); Info=LittleEndian2int8u(Buffer+Buffer_Offset+(size_t)Element_Offset); } //--------------------------------------------------------------------------- void File__Analyze::Peek_D2(int16u &Info) { INTEGRITY_SIZE_ATLEAST_INT(4); Info=LittleEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset); } //--------------------------------------------------------------------------- void File__Analyze::Peek_D3(int32u &Info) { INTEGRITY_SIZE_ATLEAST_INT(6); Info=LittleEndian2int24u(Buffer+Buffer_Offset+(size_t)Element_Offset); } //--------------------------------------------------------------------------- void File__Analyze::Peek_D4(int32u &Info) { INTEGRITY_SIZE_ATLEAST_INT(8); Info=LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset); } //--------------------------------------------------------------------------- void File__Analyze::Peek_D5(int64u &Info) { INTEGRITY_SIZE_ATLEAST_INT(10); Info=LittleEndian2int40u(Buffer+Buffer_Offset+(size_t)Element_Offset); } //--------------------------------------------------------------------------- void File__Analyze::Peek_D6(int64u &Info) { INTEGRITY_SIZE_ATLEAST_INT(12); Info=LittleEndian2int48u(Buffer+Buffer_Offset+(size_t)Element_Offset); } //--------------------------------------------------------------------------- void File__Analyze::Peek_D7(int64u &Info) { INTEGRITY_SIZE_ATLEAST_INT(14); Info=LittleEndian2int56u(Buffer+Buffer_Offset+(size_t)Element_Offset); } //--------------------------------------------------------------------------- void File__Analyze::Peek_D8(int64u &Info) { INTEGRITY_SIZE_ATLEAST_INT(16); Info=LittleEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset); } //--------------------------------------------------------------------------- void File__Analyze::Skip_D1(const char* Name) { INTEGRITY_SIZE_ATLEAST(2); if (Trace_Activated) Param(Name, LittleEndian2int8u(Buffer+Buffer_Offset+(size_t)Element_Offset)); Element_Offset+=2; } //--------------------------------------------------------------------------- void File__Analyze::Skip_D2(const char* Name) { INTEGRITY_SIZE_ATLEAST(4); if (Trace_Activated) Param(Name, LittleEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset)); Element_Offset+=4; } //--------------------------------------------------------------------------- void File__Analyze::Skip_D3(const char* Name) { INTEGRITY_SIZE_ATLEAST(6); if (Trace_Activated) { int32u Info=LittleEndian2int24u(Buffer+Buffer_Offset+(size_t)Element_Offset); Ztring Pos1; Pos1.From_Number(Info, 16); Ztring Temp; Temp.resize(6-Pos1.size(), __T('0')); Temp.append(Pos1); Temp.MakeUpperCase(); Param(Name, Ztring::ToZtring(Info)+__T(" (0x")+Temp+__T(")")); } Element_Offset+=6; } //--------------------------------------------------------------------------- void File__Analyze::Skip_D4(const char* Name) { INTEGRITY_SIZE_ATLEAST(8); if (Trace_Activated) { int32u Info=LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset); Ztring Pos1; Pos1.From_Number(Info, 16); Ztring Temp; Temp.resize(8-Pos1.size(), __T('0')); Temp.append(Pos1); Temp.MakeUpperCase(); Param(Name, Ztring::ToZtring(Info)+__T(" (0x")+Temp+__T(")")); } Element_Offset+=8; } //--------------------------------------------------------------------------- void File__Analyze::Skip_D5(const char* Name) { INTEGRITY_SIZE_ATLEAST(10); if (Trace_Activated) Param(Name, LittleEndian2int40u(Buffer+Buffer_Offset+(size_t)Element_Offset)); Element_Offset+=5; } //--------------------------------------------------------------------------- void File__Analyze::Skip_D6(const char* Name) { INTEGRITY_SIZE_ATLEAST(12); if (Trace_Activated) Param(Name, LittleEndian2int48u(Buffer+Buffer_Offset+(size_t)Element_Offset)); Element_Offset+=12; } //--------------------------------------------------------------------------- void File__Analyze::Skip_D7(const char* Name) { INTEGRITY_SIZE_ATLEAST(14); if (Trace_Activated) Param(Name, LittleEndian2int56u(Buffer+Buffer_Offset+(size_t)Element_Offset)); Element_Offset+=14; } //--------------------------------------------------------------------------- void File__Analyze::Skip_D8(const char* Name) { INTEGRITY_SIZE_ATLEAST(16); if (Trace_Activated) Param(Name, LittleEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset)); Element_Offset+=16; } //--------------------------------------------------------------------------- void File__Analyze::Skip_D16(const char* Name) { INTEGRITY_SIZE_ATLEAST(32); if (Trace_Activated) Param(Name, LittleEndian2int128u(Buffer+Buffer_Offset+(size_t)Element_Offset)); Element_Offset+=32; } //*************************************************************************** // GUID //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_GUID(int128u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(16); Info.hi=LittleEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset); Info.lo=BigEndian2int64u (Buffer+Buffer_Offset+(size_t)Element_Offset+8); if (Trace_Activated) Param_GUID(Name, Info); Element_Offset+=16; } //--------------------------------------------------------------------------- void File__Analyze::Skip_GUID(const char* Name) { INTEGRITY_SIZE_ATLEAST(16); if (Trace_Activated) Param_GUID(Name, BigEndian2int128u(Buffer+Buffer_Offset+(size_t)Element_Offset)); Element_Offset+=16; } //*************************************************************************** // UUID //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_UUID(int128u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(16); Info.hi=BigEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset); Info.lo=BigEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset+8); if (Trace_Activated) Param_UUID(Name, Info); Element_Offset+=16; } //--------------------------------------------------------------------------- void File__Analyze::Skip_UUID(const char* Name) { INTEGRITY_SIZE_ATLEAST(16); if (Trace_Activated) Param_UUID(Name, BigEndian2int128u(Buffer+Buffer_Offset+(size_t)Element_Offset)); Element_Offset+=16; } //*************************************************************************** // EBML //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_EB(int64u &Info, const char* Name) { //Element size INTEGRITY_SIZE_ATLEAST_INT(1); if (Buffer[Buffer_Offset+(size_t)Element_Offset]==0xFF) { Info=File_Size-(File_Offset+Buffer_Offset+Element_Offset); if (Trace_Activated) Param(Name, "Unlimited"); Element_Offset++; return; } int8u Size=0; int32u Size_Mark=0; BS_Begin(); while (Size_Mark==0 && BS->Remain() && Size<=8) { Size++; Peek_BS(Size, Size_Mark); } //Integrity if (!BS->Remain() || Size>8) { if (Size>8) { //Element[Element_Level].IsComplete=true; //If it is in a header Trusted_IsNot("EBML integer parsing error"); } Info=0; return; } BS_End(); if (File_Offset+Buffer_Offset+Element_Offset>=Element[Element_Level].Next) { //Element[Element_Level].IsComplete=true; //If it is in a header Trusted_IsNot("Not enough place to have an EBML"); Info=0; return; //Not enough space } INTEGRITY_SIZE_ATLEAST_INT(Size); //Element Name switch (Size) { case 1 : { int8u Element_Name; Peek_B1 (Element_Name); Info=Element_Name&0x7F; //Keep out first bit } break; case 2 : { int16u Element_Name; Peek_B2(Element_Name); Info=Element_Name&0x3FFF; //Keep out first bits } break; case 3 : { int32u Element_Name; Peek_B3(Element_Name); Info=Element_Name&0x1FFFFF; //Keep out first bits } break; case 4 : { int32u Element_Name; Peek_B4(Element_Name); Info=Element_Name&0x0FFFFFFF; //Keep out first bits } break; case 5 : { int64u Element_Name; Peek_B5(Element_Name); Info=Element_Name&0x07FFFFFFFFLL; //Keep out first bits } break; case 6 : { int64u Element_Name; Peek_B6(Element_Name); Info=Element_Name&0x03FFFFFFFFFFLL; //Keep out first bits } break; case 7 : { int64u Element_Name; Peek_B7(Element_Name); Info=Element_Name&0x01FFFFFFFFFFFFLL; //Keep out first bits } break; case 8 : { int64u Element_Name; Peek_B8(Element_Name); Info=Element_Name&0x00FFFFFFFFFFFFFFLL; //Keep out first bits } break; } if (Trace_Activated) Param(Name, Info); Element_Offset+=Size; } //--------------------------------------------------------------------------- void File__Analyze::Get_ES(int64s &Info, const char* Name) { //Element size INTEGRITY_SIZE_ATLEAST_INT(1); int8u Size=0; int32u Size_Mark=0; BS_Begin(); while (Size_Mark==0 && BS->Remain() && Size<=8) { Size++; Peek_BS(Size, Size_Mark); } //Integrity if (!BS->Remain() || Size>8) { if (Size>8) { //Element[Element_Level].IsComplete=true; //If it is in a header Trusted_IsNot("EBML integer parsing error"); } Info=0; return; } BS_End(); if (File_Offset+Buffer_Offset+Element_Offset>=Element[Element_Level].Next) { //Element[Element_Level].IsComplete=true; //If it is in a header Trusted_IsNot("Not enough place to have an EBML"); Info=0; return; //Not enough space } INTEGRITY_SIZE_ATLEAST_INT(Size); //Element Name switch (Size) { case 1 : { int8u Element_Name; Peek_B1 (Element_Name); Info=(Element_Name&0x7F)-0x3F; //Keep out first bit and sign } break; case 2 : { int16u Element_Name; Peek_B2(Element_Name); Info=(Element_Name&0x3FFF)-0x1FFF; //Keep out first bits and sign } break; case 3 : { int32u Element_Name; Peek_B3(Element_Name); Info=(Element_Name&0x1FFFFF)-0x0FFFFF; //Keep out first bits and sign } break; case 4 : { int32u Element_Name; Peek_B4(Element_Name); Info=(Element_Name&0x0FFFFFFF)-0x07FFFFFF; //Keep out first bits and sign } break; case 5 : { int64u Element_Name; Peek_B5(Element_Name); Info=(Element_Name&0x07FFFFFFFFLL)-0x03FFFFFFFFLL; //Keep out first bits and sign } break; case 6 : { int64u Element_Name; Peek_B6(Element_Name); Info=(Element_Name&0x03FFFFFFFFFFLL)-0x01FFFFFFFFFFLL; //Keep out first bits and sign } break; case 7 : { int64u Element_Name; Peek_B7(Element_Name); Info=(Element_Name&0x01FFFFFFFFFFFFLL)-0x00FFFFFFFFFFFFLL; //Keep out first bits and sign } break; case 8 : { int64u Element_Name; Peek_B8(Element_Name); Info=(Element_Name&0x00FFFFFFFFFFFFFFLL)-0x007FFFFFFFFFFFFFLL; //Keep out first bits and sign } break; } if (Trace_Activated) Param(Name, Info); Element_Offset+=Size; } //*************************************************************************** // Variable Size Value //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_VS(int64u &Info, const char* Name) { //Element size Info=0; int8u Size=0; bool more_data; BS_Begin(); do { Size++; INTEGRITY_INT(8<=BS->Remain(), "Size is wrong", BS->Offset_Get()) more_data=BS->GetB(); Info=128*Info+BS->Get1(7); } while (more_data && Size<=8 && BS->Remain()); BS_End(); //Integrity if (Size>8) { Trusted_IsNot("Variable Size Value parsing error"); Info=0; return; } if (File_Offset+Buffer_Offset+Element_Offset>=Element[Element_Level].Next) { Trusted_IsNot("Not enough place to have a Variable Size Value"); Info=0; return; //Not enough space } if (Trace_Activated) { Element_Offset-=Size; Param(Name, Info); Element_Offset+=Size; } } //--------------------------------------------------------------------------- void File__Analyze::Skip_VS(const char* Name) { //Element size int64u Info=0; int8u Size=0; bool more_data; BS_Begin(); do { Size++; INTEGRITY_INT(8<=BS->Remain(), "Size is wrong", BS->Offset_Get()) more_data=BS->GetB(); Info=128*Info+BS->Get1(7); } while (more_data && Size<=8 && BS->Remain()); BS_End(); //Integrity if (Size>8) { Trusted_IsNot("Variable Size Value parsing error"); Info=0; return; } if (File_Offset+Buffer_Offset+Element_Offset>=Element[Element_Level].Next) { Trusted_IsNot("Not enough place to have a Variable Size Value"); Info=0; return; //Not enough space } if (Trace_Activated) { Element_Offset-=Size; Param(Name, Info); Element_Offset+=Size; } } //*************************************************************************** // Exp-Golomb //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_SE(int32s &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_BUFFER(); int8u LeadingZeroBits=0; while(BS->Remain()>0 && !BS->GetB()) LeadingZeroBits++; INTEGRITY(LeadingZeroBits<=32, "(Problem)", 0) double InfoD=pow((float)2, (float)LeadingZeroBits)-1+BS->Get4(LeadingZeroBits); INTEGRITY(InfoDRemain(), "Size is wrong", 0) int8u LeadingZeroBits=0; while(BS->Remain()>0 && !BS->GetB()) LeadingZeroBits++; if (Trace_Activated) { INTEGRITY(LeadingZeroBits<=32, "(Problem)", 0) double InfoD=pow((float)2, (float)LeadingZeroBits)-1+BS->Get4(LeadingZeroBits); INTEGRITY(InfoDSkip(LeadingZeroBits); } //--------------------------------------------------------------------------- void File__Analyze::Get_UE(int32u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_BUFFER(); int8u LeadingZeroBits=0; while(BS->Remain()>0 && !BS->GetB()) LeadingZeroBits++; INTEGRITY(LeadingZeroBits<=32, "(Problem)", 0) double InfoD=pow(2, (float)LeadingZeroBits); Info=(int32u)InfoD-1+BS->Get4(LeadingZeroBits); if (Trace_Activated) Param(Name, Info); } //--------------------------------------------------------------------------- void File__Analyze::Skip_UE(const char* Name) { INTEGRITY(BS->Remain(), "Size is wrong", 0) int8u LeadingZeroBits=0; while(BS->Remain()>0 && !BS->GetB()) LeadingZeroBits++; if (Trace_Activated) { INTEGRITY(LeadingZeroBits<=32, "(Problem)", 0) double InfoD=pow(2, (float)LeadingZeroBits); Param(Name, (int32u)InfoD-1+BS->Get4(LeadingZeroBits)); } else BS->Skip(LeadingZeroBits); } //*************************************************************************** // Inverted Exp-Golomb //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_SI(int32s &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_BUFFER(); Info=1; while(BS->Remain()>0 && BS->GetB()==0) { Info<<=1; if (BS->Remain()==0) { Trusted_IsNot("(Problem)"); Info=0; return; } if(BS->GetB()==1) Info++; } Info--; if (Info!=0 && BS->Remain()>0 && BS->GetB()==1) Info=-Info; if (Trace_Activated) Param(Name, Info); } //--------------------------------------------------------------------------- void File__Analyze::Skip_SI(const char* Name) { int32s Info; Get_SI(Info, Name); } //--------------------------------------------------------------------------- void File__Analyze::Get_UI(int32u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_BUFFER(); Info=1; while(BS->Remain()>0 && BS->GetB()==0) { Info<<=1; if (BS->Remain()==0) { Trusted_IsNot("(Problem)"); Info=0; return; } if(BS->GetB()==1) Info++; } Info--; if (Trace_Activated) Param(Name, Info); } //--------------------------------------------------------------------------- void File__Analyze::Skip_UI(const char* Name) { int32u Info; Get_UI(Info, Name); } //*************************************************************************** // Variable Length Code //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_VL(const vlc Vlc[], size_t &Info, const char* Name) { Info=0; int32u Value=0; int8u CountOfBits=0; for(;;) { switch (Vlc[Info].bit_increment) { case 255 : Trusted_IsNot("Variable Length Code error"); return; default : ; Value<<=Vlc[Info].bit_increment; Value|=BS->Get1(Vlc[Info].bit_increment); CountOfBits+=Vlc[Info].bit_increment; break; case 1 : Value<<=1; if (BS->GetB()) Value++; CountOfBits++; case 0 : ; } if (Value==Vlc[Info].value) { if (Trace_Activated) { Ztring ToDisplay=Ztring::ToZtring(Value, 2); ToDisplay.insert(0, CountOfBits-ToDisplay.size(), __T('0')); ToDisplay+=__T(" (")+Ztring::ToZtring(CountOfBits)+__T(" bits)"); Param(Name, ToDisplay); } return; } Info++; } } //--------------------------------------------------------------------------- void File__Analyze::Get_VL_Prepare(vlc_fast &Vlc) { Vlc.Array=new int8u[((size_t)1)<Remain()Peek4(Vlc.Size); Info=Vlc.Array[Value]; if (Vlc.BitsToSkip[Value]==(int8u)-1) { Trusted_IsNot("Variable Length Code error"); return; } if (Trace_Activated) { Ztring ToDisplay=Ztring::ToZtring(Value, 2); ToDisplay.insert(0, Vlc.Size-ToDisplay.size(), __T('0')); ToDisplay.resize(Vlc.BitsToSkip[Value]); ToDisplay+=__T(" (")+Ztring::ToZtring(Vlc.BitsToSkip[Value])+__T(" bits)"); Param(Name, ToDisplay); } BS->Skip(Vlc.BitsToSkip[Value]); } //--------------------------------------------------------------------------- void File__Analyze::Skip_VL(const vlc Vlc[], const char* Name) { size_t Info; Get_VL(Vlc, Info, Name); } //*************************************************************************** // Characters //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_C1(int8u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(1); Info=CC1(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Buffer+Buffer_Offset+(size_t)Element_Offset, 1); Element_Offset+=1; } //--------------------------------------------------------------------------- void File__Analyze::Get_C2(int16u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(2); Info=CC2(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Buffer+Buffer_Offset+(size_t)Element_Offset, 2); Element_Offset+=2; } //--------------------------------------------------------------------------- void File__Analyze::Get_C3(int32u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(3); Info=CC3(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Buffer+Buffer_Offset+(size_t)Element_Offset, 3); Element_Offset+=3; } //--------------------------------------------------------------------------- void File__Analyze::Get_C4(int32u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(4); Info=CC4(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Buffer+Buffer_Offset+(size_t)Element_Offset, 4, false); Element_Offset+=4; } //--------------------------------------------------------------------------- void File__Analyze::Get_C5(int64u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(5); Info=CC5(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Buffer+Buffer_Offset+(size_t)Element_Offset, 5); Element_Offset+=5; } //--------------------------------------------------------------------------- void File__Analyze::Get_C6(int64u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(6); Info=CC6(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Buffer+Buffer_Offset+(size_t)Element_Offset, 6); Element_Offset+=6; } //--------------------------------------------------------------------------- void File__Analyze::Get_C7(int64u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(7); Info=CC7(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Buffer+Buffer_Offset+(size_t)Element_Offset, 7); Element_Offset+=7; } //--------------------------------------------------------------------------- void File__Analyze::Get_C8(int64u &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_INT(8); Info=CC8(Buffer+Buffer_Offset+(size_t)Element_Offset); if (Trace_Activated) Param(Name, Buffer+Buffer_Offset+(size_t)Element_Offset, 8); Element_Offset+=8; } //--------------------------------------------------------------------------- void File__Analyze::Skip_C1(const char* Name) { INTEGRITY_SIZE_ATLEAST(1); if (Trace_Activated) Param(Name, Buffer+Buffer_Offset+(size_t)Element_Offset, 1); Element_Offset+=1; } //--------------------------------------------------------------------------- void File__Analyze::Skip_C2(const char* Name) { INTEGRITY_SIZE_ATLEAST(2); if (Trace_Activated) Param(Name, Buffer+Buffer_Offset+(size_t)Element_Offset, 2); Element_Offset+=2; } //--------------------------------------------------------------------------- void File__Analyze::Skip_C3(const char* Name) { INTEGRITY_SIZE_ATLEAST(3); if (Trace_Activated) Param(Name, Buffer+Buffer_Offset+(size_t)Element_Offset, 3); Element_Offset+=3; } //--------------------------------------------------------------------------- void File__Analyze::Skip_C4(const char* Name) { INTEGRITY_SIZE_ATLEAST(4); if (Trace_Activated) Param(Name, Buffer+Buffer_Offset+(size_t)Element_Offset, 4); Element_Offset+=4; } //--------------------------------------------------------------------------- void File__Analyze::Skip_C5(const char* Name) { INTEGRITY_SIZE_ATLEAST(5); if (Trace_Activated) Param(Name, Buffer+Buffer_Offset+(size_t)Element_Offset, 5); Element_Offset+=5; } //--------------------------------------------------------------------------- void File__Analyze::Skip_C6(const char* Name) { INTEGRITY_SIZE_ATLEAST(6); if (Trace_Activated) Param(Name, Buffer+Buffer_Offset+(size_t)Element_Offset, 6); Element_Offset+=6; } //--------------------------------------------------------------------------- void File__Analyze::Skip_C7(const char* Name) { INTEGRITY_SIZE_ATLEAST(7); if (Trace_Activated) Param(Name, Buffer+Buffer_Offset+(size_t)Element_Offset, 7); Element_Offset+=7; } //--------------------------------------------------------------------------- void File__Analyze::Skip_C8(const char* Name) { INTEGRITY_SIZE_ATLEAST(8); if (Trace_Activated) Param(Name, Buffer+Buffer_Offset+(size_t)Element_Offset, 8); Element_Offset+=8; } //*************************************************************************** // Text //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_Local(int64u Bytes, Ztring &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.From_Local((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); if (Trace_Activated && Bytes) Param(Name, Info); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Get_ISO_8859_1(int64u Bytes, Ztring &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.From_ISO_8859_1((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); if (Trace_Activated && Bytes) Param(Name, Info); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Get_ISO_8859_2(int64u Bytes, Ztring &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.From_ISO_8859_2((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); if (Trace_Activated && Bytes) Param(Name, Info); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Get_String(int64u Bytes, std::string &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.assign((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); if (Trace_Activated && Bytes) Param(Name, Info); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Peek_Local(int64u Bytes, Ztring &Info) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.From_Local((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); } //--------------------------------------------------------------------------- void File__Analyze::Peek_String(int64u Bytes, std::string &Info) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.assign((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); } //--------------------------------------------------------------------------- void File__Analyze::Get_UTF8(int64u Bytes, Ztring &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.From_UTF8((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); if (Trace_Activated && Bytes) Param(Name, Info); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Get_UTF16(int64u Bytes, Ztring &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.From_UTF16((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); if (Trace_Activated && Bytes) Param(Name, Info); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Get_UTF16B(int64u Bytes, Ztring &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.From_UTF16BE((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); if (Trace_Activated && Bytes) Param(Name, Info); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Get_UTF16L(int64u Bytes, Ztring &Info, const char* Name) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.From_UTF16LE((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); if (Trace_Activated && Bytes) Param(Name, Info); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Skip_Local(int64u Bytes, const char* Name) { INTEGRITY_SIZE_ATLEAST(Bytes); if (Trace_Activated && Bytes) Param(Name, Ztring().From_Local((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes)); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Skip_String(int64u Bytes, const char* Name) { INTEGRITY_SIZE_ATLEAST(Bytes); if (Trace_Activated && Bytes) Param(Name, Ztring().From_Local((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes)); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Skip_UTF8(int64u Bytes, const char* Name) { INTEGRITY_SIZE_ATLEAST(Bytes); if (Trace_Activated && Bytes) Param(Name, Ztring().From_UTF8((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes)); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Skip_UTF16B(int64u Bytes, const char* Name) { INTEGRITY_SIZE_ATLEAST(Bytes); if (Trace_Activated && Bytes) Param(Name, Ztring().From_UTF16BE((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes)); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Skip_UTF16L(int64u Bytes, const char* Name) { INTEGRITY_SIZE_ATLEAST(Bytes); if (Trace_Activated && Bytes) Param(Name, Ztring().From_UTF16LE((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes)); Element_Offset+=Bytes; } //*************************************************************************** // Text //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Skip_PA(const char* Name) { INTEGRITY_SIZE_ATLEAST(1); int8u Size=Buffer[Buffer_Offset+(size_t)Element_Offset]; INTEGRITY_SIZE_ATLEAST(1+Size); if (Trace_Activated && Size) Param(Name, Ztring().From_Local((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset+1), (size_t)Size)); Element_Offset+=1+Size; } //*************************************************************************** // Unknown //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Skip_XX(int64u Bytes, const char* Name) { if (Element_Offset+Bytes!=Element_TotalSize_Get()) //Exception for seek to end of the element { INTEGRITY_SIZE_ATLEAST(Bytes); } if (Trace_Activated && Bytes) Param(Name, Ztring("(")+Ztring::ToZtring(Bytes)+Ztring(" bytes)")); Element_Offset+=Bytes; } //*************************************************************************** // Flags //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_Flags (int64u Flags, size_t Order, bool &Info, const char* Name) { if (Flags&((int64u)1<Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Get4(Bits); if (Trace_Activated) Param(Name, Info); } //--------------------------------------------------------------------------- void File__Analyze::Get_SB( bool &Info, const char* Name) { INTEGRITY_INT(1<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->GetB(); if (Trace_Activated) Param(Name, Info); } //--------------------------------------------------------------------------- void File__Analyze::Get_S1(int8u Bits, int8u &Info, const char* Name) { INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Get1(Bits); if (Trace_Activated) { Param(Name, Info); Param_Info(__T("(")+Ztring::ToZtring(Bits)+__T(" bits)")); } } //--------------------------------------------------------------------------- void File__Analyze::Get_S2(int8u Bits, int16u &Info, const char* Name) { INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Get2(Bits); if (Trace_Activated) Param(Name, Info); } //--------------------------------------------------------------------------- void File__Analyze::Get_S3(int8u Bits, int32u &Info, const char* Name) { INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Get4(Bits); if (Trace_Activated) Param(Name, Info); } //--------------------------------------------------------------------------- void File__Analyze::Get_S4(int8u Bits, int32u &Info, const char* Name) { INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Get4(Bits); if (Trace_Activated) Param(Name, Info); } //--------------------------------------------------------------------------- void File__Analyze::Get_S5(int8u Bits, int64u &Info, const char* Name) { INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Get8(Bits); if (Trace_Activated) Param(Name, Info); } //--------------------------------------------------------------------------- void File__Analyze::Get_S6(int8u Bits, int64u &Info, const char* Name) { INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Get8(Bits); if (Trace_Activated) Param(Name, Info); } //--------------------------------------------------------------------------- void File__Analyze::Get_S7(int8u Bits, int64u &Info, const char* Name) { INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Get8(Bits); if (Trace_Activated) Param(Name, Info); } //--------------------------------------------------------------------------- void File__Analyze::Get_S8(int8u Bits, int64u &Info, const char* Name) { INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Get8(Bits); if (Trace_Activated) Param(Name, Info); } //--------------------------------------------------------------------------- void File__Analyze::Peek_BS(int8u Bits, int32u &Info) { INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Peek4(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_SB( bool &Info) { INTEGRITY_INT(1<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->PeekB(); } //--------------------------------------------------------------------------- void File__Analyze::Peek_S1(int8u Bits, int8u &Info) { INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Peek1(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_S2(int8u Bits, int16u &Info) { INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Peek2(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_S3(int8u Bits, int32u &Info) { INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Peek4(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_S4(int8u Bits, int32u &Info) { INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Peek4(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_S5(int8u Bits, int64u &Info) { INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Peek8(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_S6(int8u Bits, int64u &Info) { INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Peek8(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_S7(int8u Bits, int64u &Info) { INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Peek8(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_S8(int8u Bits, int64u &Info) { INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) Info=BS->Peek8(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Skip_BS(size_t Bits, const char* Name) { INTEGRITY(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) if (Trace_Activated) { if (Bits<=32) //TODO: in BitStream.h, handle >32 bit gets Param(Name, BS->Get4((int8u)Bits)); else { Param(Name, "(Data)"); BS->Skip(Bits); } } else BS->Skip(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Skip_SB( const char* Name) { INTEGRITY(1<=BS->Remain(), "Size is wrong", BS->Offset_Get()) if (Trace_Activated) Param(Name, BS->GetB()); else BS->Skip(1); } //--------------------------------------------------------------------------- void File__Analyze::Skip_S1(int8u Bits, const char* Name) { INTEGRITY(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) if (Trace_Activated) { Param(Name, BS->Get1(Bits)); Param_Info(__T("(")+Ztring::ToZtring(Bits)+__T(" bits)")); } else BS->Skip(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Skip_S2(int8u Bits, const char* Name) { INTEGRITY(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) if (Trace_Activated) Param(Name, BS->Get2(Bits)); else BS->Skip(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Skip_S3(int8u Bits, const char* Name) { INTEGRITY(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) if (Trace_Activated) Param(Name, BS->Get4(Bits)); else BS->Skip(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Skip_S4(int8u Bits, const char* Name) { INTEGRITY(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) if (Trace_Activated) Param(Name, BS->Get4(Bits)); else BS->Skip(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Skip_S5(int8u Bits, const char* Name) { INTEGRITY(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) if (Trace_Activated) Param(Name, BS->Get8(Bits)); else BS->Skip(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Skip_S6(int8u Bits, const char* Name) { INTEGRITY(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) if (Trace_Activated) Param(Name, BS->Get8(Bits)); else BS->Skip(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Skip_S7(int8u Bits, const char* Name) { INTEGRITY(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) if (Trace_Activated) Param(Name, BS->Get8(Bits)); else BS->Skip(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Skip_S8(int8u Bits, const char* Name) { INTEGRITY(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get()) if (Trace_Activated) Param(Name, BS->Get8(Bits)); else BS->Skip(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Mark_0() { INTEGRITY(1<=BS->Remain(), "Size is wrong", BS->Offset_Get()) bool Info=BS->GetB(); if (Info) { Param("0", Info); Element_DoNotTrust("Mark bit is wrong"); } } //--------------------------------------------------------------------------- void File__Analyze::Mark_0_NoTrustError() { INTEGRITY(1<=BS->Remain(), "Size is wrong", BS->Offset_Get()) bool Info=BS->GetB(); if (Info) { Param("0", Info); Param_Info("Warning: should be 0"); } } //--------------------------------------------------------------------------- void File__Analyze::Mark_1() { INTEGRITY(1<=BS->Remain(), "Size is wrong", BS->Offset_Get()) bool Info=BS->GetB(); if (!Info) { Param("1", Info); Element_DoNotTrust("Mark bit is wrong"); } } //--------------------------------------------------------------------------- void File__Analyze::Mark_1_NoTrustError() { INTEGRITY(1<=BS->Remain(), "Size is wrong", BS->Offset_Get()) bool Info=BS->GetB(); if (!Info) { Param("1", Info); Param_Info("Warning: should be 1"); } } //*************************************************************************** // BitStream (Little Endian) //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_BT(size_t Bits, int32u &Info, const char* Name) { INTEGRITY_INT(Bits<=BT->Remain(), "Size is wrong", BT->Offset_Get()) Info=BT->Get(Bits); if (Trace_Activated) Param(Name, Info); } //--------------------------------------------------------------------------- void File__Analyze::Get_TB( bool &Info, const char* Name) { INTEGRITY_INT(1<=BT->Remain(), "Size is wrong", BT->Offset_Get()) Info=BT->GetB(); if (Trace_Activated) Param(Name, Info); } //--------------------------------------------------------------------------- void File__Analyze::Get_T1(size_t Bits, int8u &Info, const char* Name) { INTEGRITY_INT(Bits<=BT->Remain(), "Size is wrong", BT->Offset_Get()) Info=BT->Get1(Bits); if (Trace_Activated) { Param(Name, Info); Param_Info(__T("(")+Ztring::ToZtring(Bits)+__T(" bits)")); } } //--------------------------------------------------------------------------- void File__Analyze::Get_T2(size_t Bits, int16u &Info, const char* Name) { INTEGRITY_INT(Bits<=BT->Remain(), "Size is wrong", BT->Offset_Get()) Info=BT->Get2(Bits); if (Trace_Activated) Param(Name, Info); } //--------------------------------------------------------------------------- void File__Analyze::Get_T4(size_t Bits, int32u &Info, const char* Name) { INTEGRITY_INT(Bits<=BT->Remain(), "Size is wrong", BT->Offset_Get()) Info=BT->Get4(Bits); if (Trace_Activated) Param(Name, Info); } //--------------------------------------------------------------------------- void File__Analyze::Get_T8(size_t Bits, int64u &Info, const char* Name) { INTEGRITY_INT(Bits<=BT->Remain(), "Size is wrong", BT->Offset_Get()) Info=BT->Get8(Bits); if (Trace_Activated) Param(Name, Info); } //--------------------------------------------------------------------------- void File__Analyze::Peek_BT(size_t Bits, int32u &Info) { INTEGRITY_INT(Bits<=BT->Remain(), "Size is wrong", BT->Offset_Get()) Info=BT->Peek(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_TB( bool &Info) { INTEGRITY_INT(1<=BT->Remain(), "Size is wrong", BT->Offset_Get()) Info=BT->PeekB(); } //--------------------------------------------------------------------------- void File__Analyze::Peek_T1(size_t Bits, int8u &Info) { INTEGRITY_INT(Bits<=BT->Remain(), "Size is wrong", BT->Offset_Get()) Info=BT->Peek1(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_T2(size_t Bits, int16u &Info) { INTEGRITY_INT(Bits<=BT->Remain(), "Size is wrong", BT->Offset_Get()) Info=BT->Peek2(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_T4(size_t Bits, int32u &Info) { INTEGRITY_INT(Bits<=BT->Remain(), "Size is wrong", BT->Offset_Get()) Info=BT->Peek4(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_T8(size_t Bits, int64u &Info) { INTEGRITY_INT(Bits<=BT->Remain(), "Size is wrong", BT->Offset_Get()) Info=BT->Peek8(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Skip_BT(size_t Bits, const char* Name) { INTEGRITY(Bits<=BT->Remain(), "Size is wrong", BT->Offset_Get()) if (Trace_Activated) { if (Bits<=32) //TODO: in BitStream.h, handle >32 bit gets Param(Name, BT->Get(Bits)); else { Param(Name, "(Data)"); BT->Skip(Bits); } } else BT->Skip(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Skip_TB( const char* Name) { INTEGRITY(1<=BT->Remain(), "Size is wrong", BT->Offset_Get()) if (Trace_Activated) Param(Name, BT->GetB()); else BT->SkipB(); } //--------------------------------------------------------------------------- void File__Analyze::Skip_T1(size_t Bits, const char* Name) { INTEGRITY(Bits<=BT->Remain(), "Size is wrong", BT->Offset_Get()) if (Trace_Activated) { Param(Name, BT->Get1(Bits)); Param_Info(__T("(")+Ztring::ToZtring(Bits)+__T(" bits)")); } else BT->Skip1(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Skip_T2(size_t Bits, const char* Name) { INTEGRITY(Bits<=BT->Remain(), "Size is wrong", BT->Offset_Get()) if (Trace_Activated) Param(Name, BT->Get2(Bits)); else BT->Skip2(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Skip_T4(size_t Bits, const char* Name) { INTEGRITY(Bits<=BT->Remain(), "Size is wrong", BT->Offset_Get()) if (Trace_Activated) Param(Name, BT->Get4(Bits)); else BT->Skip4(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Skip_T8(size_t Bits, const char* Name) { INTEGRITY(Bits<=BT->Remain(), "Size is wrong", BT->Offset_Get()) if (Trace_Activated) Param(Name, BT->Get8(Bits)); else BT->Skip8(Bits); } } //NameSpace #endif //MEDIAINFO_TRACE MediaInfoLib/Source/MediaInfo/File__Analyze_Buffer_MinimizeSize.cpp100777 0 0 141573 12226004262 21013 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- #if !MEDIAINFO_TRACE //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include "MediaInfo/MediaInfo_Config.h" #include "ZenLib/BitStream_LE.h" #include using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- extern MediaInfo_Config Config; //--------------------------------------------------------------------------- //Integrity test #define INTEGRITY(TOVALIDATE) \ if (!(TOVALIDATE)) \ { \ Trusted_IsNot(); \ return; \ } \ #define INTEGRITY_BOOL(TOVALIDATE) \ if (!(TOVALIDATE)) \ { \ Trusted_IsNot(); \ Info=false; \ return; \ } \ #define INTEGRITY_INT(TOVALIDATE) \ if (!(TOVALIDATE)) \ { \ Trusted_IsNot(); \ Info=0; \ return; \ } \ #define INTEGRITY_SIZE_ATLEAST(_BYTES) \ if (Element_Offset+_BYTES>Element_Size) \ { \ Trusted_IsNot(); \ return; \ } \ #define INTEGRITY_SIZE_ATLEAST_STRING(_BYTES) \ if (Element_Offset+_BYTES>Element_Size) \ { \ Trusted_IsNot(); \ Info.clear(); \ return; \ } \ #define INTEGRITY_SIZE_ATLEAST_INT(_BYTES) \ if (Element_Offset+_BYTES>Element_Size) \ { \ Trusted_IsNot(); \ Info=0; \ return; \ } \ #define INTEGRITY_SIZE_ATLEAST_BUFFER() \ if (BS->Remain()==0) \ { \ Trusted_IsNot(); \ Info=0; \ return; \ } \ //*************************************************************************** // Init //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::BS_Begin() { size_t BS_Size; if (Element_Offset>=Element_Size) BS_Size=0; else if (Buffer_Offset+Element_Size<=Buffer_Size) BS_Size=(size_t)(Element_Size-Element_Offset); else if (Buffer_Offset+Element_Offset<=Buffer_Size) BS_Size=Buffer_Size-(size_t)(Buffer_Offset+Element_Offset); else BS_Size=0; BS->Attach(Buffer+Buffer_Offset+(size_t)Element_Offset, BS_Size); } //--------------------------------------------------------------------------- void File__Analyze::BS_Begin_LE() { size_t BS_Size; if (Buffer_Offset+Element_Size<=Buffer_Size) BS_Size=(size_t)(Element_Size-Element_Offset); else if (Buffer_Offset+Element_Offset<=Buffer_Size) BS_Size=Buffer_Size-(size_t)(Buffer_Offset+Element_Offset); else BS_Size=0; BT->Attach(Buffer+Buffer_Offset+(size_t)Element_Offset, BS_Size); } //--------------------------------------------------------------------------- void File__Analyze::BS_End() { BS->Byte_Align(); Element_Offset+=BS->Offset_Get(); BS->Attach(NULL, 0); } //--------------------------------------------------------------------------- void File__Analyze::BS_End_LE() { BT->Byte_Align(); Element_Offset+=BT->Offset_Get(); BT->Attach(NULL, 0); } //*************************************************************************** // Big Endian //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_B1_(int8u &Info) { INTEGRITY_SIZE_ATLEAST_INT(1); Info=BigEndian2int8u(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=1; } //--------------------------------------------------------------------------- void File__Analyze::Get_B2_(int16u &Info) { INTEGRITY_SIZE_ATLEAST_INT(2); Info=BigEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=2; } //--------------------------------------------------------------------------- void File__Analyze::Get_B3_(int32u &Info) { INTEGRITY_SIZE_ATLEAST_INT(3); Info=BigEndian2int24u(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=3; } //--------------------------------------------------------------------------- void File__Analyze::Get_B4_(int32u &Info) { INTEGRITY_SIZE_ATLEAST_INT(4); Info=BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=4; } //--------------------------------------------------------------------------- void File__Analyze::Get_B5_(int64u &Info) { INTEGRITY_SIZE_ATLEAST_INT(5); Info=BigEndian2int40u(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=5; } //--------------------------------------------------------------------------- void File__Analyze::Get_B6_(int64u &Info) { INTEGRITY_SIZE_ATLEAST_INT(6); Info=BigEndian2int48u(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=6; } //--------------------------------------------------------------------------- void File__Analyze::Get_B7_(int64u &Info) { INTEGRITY_SIZE_ATLEAST_INT(7); Info=BigEndian2int56u(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=7; } //--------------------------------------------------------------------------- void File__Analyze::Get_B8_(int64u &Info) { INTEGRITY_SIZE_ATLEAST_INT(8); Info=BigEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=8; } //--------------------------------------------------------------------------- void File__Analyze::Get_B16_(int128u &Info) { INTEGRITY_SIZE_ATLEAST_INT(16); //Info=BigEndian2int128u(Buffer+Buffer_Offset+(size_t)Element_Offset); Info.hi=BigEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset); Info.lo=BigEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset+8); Element_Offset+=16; } //--------------------------------------------------------------------------- void File__Analyze::Get_BF4_(float32 &Info) { INTEGRITY_SIZE_ATLEAST_INT(4); Info=BigEndian2float32(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=4; } //--------------------------------------------------------------------------- void File__Analyze::Get_BF8_(float64 &Info) { INTEGRITY_SIZE_ATLEAST_INT(8); Info=BigEndian2float64(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=8; } //--------------------------------------------------------------------------- void File__Analyze::Get_BF10_(float80 &Info) { INTEGRITY_SIZE_ATLEAST_INT(10); Info=BigEndian2float80(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=10; } //--------------------------------------------------------------------------- void File__Analyze::Get_BFP4_(int8u Bits, float32 &Info) { INTEGRITY_SIZE_ATLEAST_INT(4); BS_Begin(); int32s Integer=(int32s)BS->Get4(Bits); int32u Fraction=BS->Get4(32-Bits); BS_End(); if (Integer>=(1<Remain() && Size<=8) { Size++; Peek_S1(Size, Size_Mark); } //Integrity if (!BS->Remain() || Size>8) { if (Size>8) { //Element[Element_Level].IsComplete=true; //If it is in a header Trusted_IsNot("EBML integer parsing error"); } Info=0; return; } BS_End(); if (File_Offset+Buffer_Offset+Element_Offset>=Element[Element_Level].Next) { //Element[Element_Level].IsComplete=true; //If it is in a header Trusted_IsNot("Not enough place to have an EBML"); Info=0; return; //Not enough space } INTEGRITY_SIZE_ATLEAST_INT(Size); //Element Name switch (Size) { case 1 : { int8u Element_Name; Peek_B1 (Element_Name); Info=Element_Name&0x7F; //Keep out first bit } break; case 2 : { int16u Element_Name; Peek_B2(Element_Name); Info=Element_Name&0x3FFF; //Keep out first bits } break; case 3 : { int32u Element_Name; Peek_B3(Element_Name); Info=Element_Name&0x1FFFFF; //Keep out first bits } break; case 4 : { int32u Element_Name; Peek_B4(Element_Name); Info=Element_Name&0x0FFFFFFF; //Keep out first bits } break; case 5 : { int64u Element_Name; Peek_B5(Element_Name); Info=Element_Name&0x07FFFFFFFFLL; //Keep out first bits } break; case 6 : { int64u Element_Name; Peek_B6(Element_Name); Info=Element_Name&0x03FFFFFFFFFFLL; //Keep out first bits } break; case 7 : { int64u Element_Name; Peek_B7(Element_Name); Info=Element_Name&0x01FFFFFFFFFFFFLL; //Keep out first bits } break; case 8 : { int64u Element_Name; Peek_B8(Element_Name); Info=Element_Name&0x00FFFFFFFFFFFFFFLL; //Keep out first bits } break; } Element_Offset+=Size; } //--------------------------------------------------------------------------- void File__Analyze::Get_ES(int64s &Info) { //Element size INTEGRITY_SIZE_ATLEAST_INT(1); int8u Size=0; int8u Size_Mark=0; BS_Begin(); while (Size_Mark==0 && BS->Remain() && Size<=8) { Size++; Peek_S1(Size, Size_Mark); } //Integrity if (!BS->Remain() || Size>8) { if (Size>8) { //Element[Element_Level].IsComplete=true; //If it is in a header Trusted_IsNot("EBML integer parsing error"); } Info=0; return; } BS_End(); if (File_Offset+Buffer_Offset+Element_Offset>=Element[Element_Level].Next) { //Element[Element_Level].IsComplete=true; //If it is in a header Trusted_IsNot("Not enough place to have an EBML"); Info=0; return; //Not enough space } INTEGRITY_SIZE_ATLEAST_INT(Size); //Element Name switch (Size) { case 1 : { int8u Element_Name; Peek_B1 (Element_Name); Info=(Element_Name&0x7F)-0x3F; //Keep out first bit and sign } break; case 2 : { int16u Element_Name; Peek_B2(Element_Name); Info=(Element_Name&0x3FFF)-0x1FFF; //Keep out first bits and sign } break; case 3 : { int32u Element_Name; Peek_B3(Element_Name); Info=(Element_Name&0x1FFFFF)-0x0FFFFF; //Keep out first bits and sign } break; case 4 : { int32u Element_Name; Peek_B4(Element_Name); Info=(Element_Name&0x0FFFFFFF)-0x07FFFFFF; //Keep out first bits and sign } break; case 5 : { int64u Element_Name; Peek_B5(Element_Name); Info=(Element_Name&0x07FFFFFFFFLL)-0x03FFFFFFFFLL; //Keep out first bits and sign } break; case 6 : { int64u Element_Name; Peek_B6(Element_Name); Info=(Element_Name&0x03FFFFFFFFFFLL)-0x01FFFFFFFFFFLL; //Keep out first bits and sign } break; case 7 : { int64u Element_Name; Peek_B7(Element_Name); Info=(Element_Name&0x01FFFFFFFFFFFFLL)-0x00FFFFFFFFFFFFLL; //Keep out first bits and sign } break; case 8 : { int64u Element_Name; Peek_B8(Element_Name); Info=(Element_Name&0x00FFFFFFFFFFFFFFLL)-0x007FFFFFFFFFFFFFLL; //Keep out first bits and sign } break; } Element_Offset+=Size; } //*************************************************************************** // Variable Length Value //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_VS(int64u &Info) { //Element size Info=0; int8u Size=0; bool more_data; BS_Begin(); do { Size++; INTEGRITY_INT(8<=BS->Remain()) more_data=BS->GetB(); Info=128*Info+BS->Get1(7); } while (more_data && Size<=8 && BS->Remain()); BS_End(); //Integrity if (Size>8) { Trusted_IsNot("Variable Length Value parsing error"); Info=0; return; } if (File_Offset+Buffer_Offset+Element_Offset>=Element[Element_Level].Next) { Trusted_IsNot("Not enough place to have a Variable Length Value"); Info=0; return; //Not enough space } } //--------------------------------------------------------------------------- void File__Analyze::Skip_VS() { //Element size int64u Info=0; int8u Size=0; bool more_data; BS_Begin(); do { Size++; INTEGRITY_INT(8<=BS->Remain()) more_data=BS->GetB(); Info=128*Info+BS->Get1(7); } while (more_data && Size<=8 && BS->Remain()); BS_End(); //Integrity if (Size>8) { Trusted_IsNot("Variable Size Value parsing error"); Info=0; return; } if (File_Offset+Buffer_Offset+Element_Offset>=Element[Element_Level].Next) { Trusted_IsNot("Not enough place to have a Variable Size Value"); Info=0; return; //Not enough space } } //*************************************************************************** // Exp-Golomb //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_SE(int32s &Info) { INTEGRITY_SIZE_ATLEAST_BUFFER(); int8u LeadingZeroBits=0; while(BS->Remain()>0 && !BS->GetB()) LeadingZeroBits++; INTEGRITY(LeadingZeroBits<=32) double InfoD=pow((float)2, (float)LeadingZeroBits)-1+BS->Get4(LeadingZeroBits); INTEGRITY(InfoDRemain()>0 && !BS->GetB()) LeadingZeroBits++; INTEGRITY(LeadingZeroBits<=32) double InfoD=pow((float)2, (float)LeadingZeroBits); Info=(int32u)InfoD-1+BS->Get4(LeadingZeroBits); } //--------------------------------------------------------------------------- void File__Analyze::Skip_UE() { INTEGRITY(BS->Remain()) int8u LeadingZeroBits=0; while(BS->Remain()>0 && !BS->GetB()) LeadingZeroBits++; BS->Skip(LeadingZeroBits); } //*************************************************************************** // Inverted Exp-Golomb //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_SI(int32s &Info) { INTEGRITY_SIZE_ATLEAST_BUFFER(); Info=1; while(BS->Remain()>0 && BS->GetB()==0) { Info<<=1; if (BS->Remain()==0) { Trusted_IsNot("(Problem)"); Info=0; return; } if(BS->GetB()==1) Info++; } Info--; if (Info!=0 && BS->Remain()>0 && BS->GetB()==1) Info=-Info; } //--------------------------------------------------------------------------- void File__Analyze::Skip_SI() { int32s Info; Get_SI(Info); } //--------------------------------------------------------------------------- void File__Analyze::Get_UI(int32u &Info) { INTEGRITY_SIZE_ATLEAST_BUFFER(); Info=1; while(BS->Remain()>0 && BS->GetB()==0) { Info<<=1; if (BS->Remain()==0) { Trusted_IsNot("(Problem)"); Info=0; return; } if(BS->GetB()==1) Info++; } Info--; } //--------------------------------------------------------------------------- void File__Analyze::Skip_UI() { int32u Info; Get_UI(Info); } //*************************************************************************** // Variable Length Code //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_VL_(const vlc Vlc[], size_t &Info) { Info=0; int32u Value=0; for(;;) { switch (Vlc[Info].bit_increment) { case 255 : Trusted_IsNot(); return; default : ; Value<<=Vlc[Info].bit_increment; Value|=BS->Get1(Vlc[Info].bit_increment); break; case 1 : Value<<=1; if (BS->GetB()) Value++; case 0 : ; } if (Value==Vlc[Info].value) return; Info++; } } //--------------------------------------------------------------------------- void File__Analyze::Skip_VL_(const vlc Vlc[]) { size_t Info=0; int32u Value=0; for(;;) { switch (Vlc[Info].bit_increment) { case 255 : Trusted_IsNot(); return; default : ; Value<<=Vlc[Info].bit_increment; Value|=BS->Get1(Vlc[Info].bit_increment); break; case 1 : Value<<=1; if (BS->GetB()) Value++; case 0 : ; } if (Value==Vlc[Info].value) return; Info++; } } //--------------------------------------------------------------------------- void File__Analyze::Get_VL_Prepare(vlc_fast &Vlc) { Vlc.Array=new int8u[((size_t)1)<Remain()Peek4(Vlc.Size); Info=Vlc.Array[Value]; if (Vlc.BitsToSkip[Value]==(int8u)-1) { Trusted_IsNot(); return; } BS->Skip(Vlc.BitsToSkip[Value]); } //--------------------------------------------------------------------------- void File__Analyze::Skip_VL_(const vlc_fast &Vlc) { if (BS->Remain()Peek4(Vlc.Size); if (Vlc.BitsToSkip[Value]==(int8u)-1) { Trusted_IsNot(); return; } BS->Skip(Vlc.BitsToSkip[Value]); } //*************************************************************************** // Characters //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_C1(int8u &Info) { INTEGRITY_SIZE_ATLEAST_INT(1); Info=CC1(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=1; } //--------------------------------------------------------------------------- void File__Analyze::Get_C2(int16u &Info) { INTEGRITY_SIZE_ATLEAST_INT(2); Info=CC2(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=2; } //--------------------------------------------------------------------------- void File__Analyze::Get_C3(int32u &Info) { INTEGRITY_SIZE_ATLEAST_INT(3); Info=CC3(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=3; } //--------------------------------------------------------------------------- void File__Analyze::Get_C4(int32u &Info) { INTEGRITY_SIZE_ATLEAST_INT(4); Info=CC4(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=4; } //--------------------------------------------------------------------------- void File__Analyze::Get_C5(int64u &Info) { INTEGRITY_SIZE_ATLEAST_INT(5); Info=CC5(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=5; } //--------------------------------------------------------------------------- void File__Analyze::Get_C6(int64u &Info) { INTEGRITY_SIZE_ATLEAST_INT(6); Info=CC6(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=6; } //--------------------------------------------------------------------------- void File__Analyze::Get_C7(int64u &Info) { INTEGRITY_SIZE_ATLEAST_INT(7); Info=CC7(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=7; } //--------------------------------------------------------------------------- void File__Analyze::Get_C8(int64u &Info) { INTEGRITY_SIZE_ATLEAST_INT(8); Info=CC8(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=8; } //*************************************************************************** // Text //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_Local(int64u Bytes, Ztring &Info) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.From_Local((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Get_ISO_8859_1(int64u Bytes, Ztring &Info) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.From_ISO_8859_1((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Get_ISO_8859_2(int64u Bytes, Ztring &Info) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.From_ISO_8859_2((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Get_String(int64u Bytes, std::string &Info) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.assign((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Peek_Local(int64u Bytes, Ztring &Info) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.From_Local((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); } //--------------------------------------------------------------------------- void File__Analyze::Peek_String(int64u Bytes, std::string &Info) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.assign((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); } //--------------------------------------------------------------------------- void File__Analyze::Get_UTF8(int64u Bytes, Ztring &Info) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.From_UTF8((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Get_UTF16(int64u Bytes, Ztring &Info) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.From_UTF16((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Get_UTF16B(int64u Bytes, Ztring &Info) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.From_UTF16BE((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); Element_Offset+=Bytes; } //--------------------------------------------------------------------------- void File__Analyze::Get_UTF16L(int64u Bytes, Ztring &Info) { INTEGRITY_SIZE_ATLEAST_STRING(Bytes); Info.From_UTF16LE((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset), (size_t)Bytes); Element_Offset+=Bytes; } //*************************************************************************** // Text //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Skip_PA() { INTEGRITY_SIZE_ATLEAST(1); int8u Size=Buffer[Buffer_Offset+Element_Offset]; int8u Pad=(Size%2)?0:1; INTEGRITY_SIZE_ATLEAST(1+Size+Pad); Element_Offset+=(size_t)(1+Size+Pad); } //*************************************************************************** // Unknown //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Skip_XX(int64u Bytes) { if (Element_Offset+Bytes!=Element_TotalSize_Get()) //Exception for seek to end of the element { INTEGRITY_SIZE_ATLEAST(Bytes); } Element_Offset+=Bytes; } //*************************************************************************** // Flags //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_Flags_ (int64u Flags, size_t Order, bool &Info) { if (Flags&((int64u)1<Remain()) Info=BS->Get4(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Get_SB_( bool &Info) { INTEGRITY_INT(1<=BS->Remain()) Info=BS->GetB(); } //--------------------------------------------------------------------------- void File__Analyze::Get_S1_(int8u Bits, int8u &Info) { INTEGRITY_INT(Bits<=BS->Remain()) Info=BS->Get1(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Get_S2_(int8u Bits, int16u &Info) { INTEGRITY_INT(Bits<=BS->Remain()) Info=BS->Get2(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Get_S3_(int8u Bits, int32u &Info) { INTEGRITY_INT(Bits<=BS->Remain()) Info=BS->Get4(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Get_S4_(int8u Bits, int32u &Info) { INTEGRITY_INT(Bits<=BS->Remain()) Info=BS->Get4(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Get_S5_(int8u Bits, int64u &Info) { INTEGRITY_INT(Bits<=BS->Remain()) Info=BS->Get8(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Get_S6_(int8u Bits, int64u &Info) { INTEGRITY_INT(Bits<=BS->Remain()) Info=BS->Get8(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Get_S7_(int8u Bits, int64u &Info) { INTEGRITY_INT(Bits<=BS->Remain()) Info=BS->Get8(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Get_S8_(int8u Bits, int64u &Info) { INTEGRITY_INT(Bits<=BS->Remain()) Info=BS->Get8(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_BS(int8u Bits, int32u &Info) { INTEGRITY_INT(Bits<=BS->Remain()) Info=BS->Peek4(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_SB( bool &Info) { INTEGRITY_INT(1<=BS->Remain()) Info=BS->PeekB(); } //--------------------------------------------------------------------------- void File__Analyze::Peek_S1(int8u Bits, int8u &Info) { INTEGRITY_INT(Bits<=BS->Remain()) Info=BS->Peek1(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_S2(int8u Bits, int16u &Info) { INTEGRITY_INT(Bits<=BS->Remain()) Info=BS->Peek2(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_S3(int8u Bits, int32u &Info) { INTEGRITY_INT(Bits<=BS->Remain()) Info=BS->Peek4(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_S4(int8u Bits, int32u &Info) { INTEGRITY_INT(Bits<=BS->Remain()) Info=BS->Peek4(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_S5(int8u Bits, int64u &Info) { INTEGRITY_INT(Bits<=BS->Remain()) Info=BS->Peek8(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_S6(int8u Bits, int64u &Info) { INTEGRITY_INT(Bits<=BS->Remain()) Info=BS->Peek8(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_S7(int8u Bits, int64u &Info) { INTEGRITY_INT(Bits<=BS->Remain()) Info=BS->Peek8(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_S8(int8u Bits, int64u &Info) { INTEGRITY_INT(Bits<=BS->Remain()) Info=BS->Peek8(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Mark_0() { INTEGRITY(1<=BS->Remain()) if (BS->GetB()) Element_DoNotTrust("Mark bit is wrong"); } //--------------------------------------------------------------------------- void File__Analyze::Mark_1() { INTEGRITY(1<=BS->Remain()) if (!BS->GetB()) Element_DoNotTrust("Mark bit is wrong"); } //*************************************************************************** // BitStream (Little Endian) //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Get_BT_(int8u Bits, int32u &Info) { INTEGRITY_INT(Bits<=BT->Remain()) Info=BT->Get(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Get_TB_( bool &Info) { INTEGRITY_INT(1<=BT->Remain()) Info=BT->GetB(); } //--------------------------------------------------------------------------- void File__Analyze::Get_T1_(int8u Bits, int8u &Info) { INTEGRITY_INT(Bits<=BT->Remain()) Info=BT->Get1(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Get_T2_(int8u Bits, int16u &Info) { INTEGRITY_INT(Bits<=BT->Remain()) Info=BT->Get2(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Get_T4_(int8u Bits, int32u &Info) { INTEGRITY_INT(Bits<=BT->Remain()) Info=BT->Get4(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Get_T8_(int8u Bits, int64u &Info) { INTEGRITY_INT(Bits<=BT->Remain()) Info=BT->Get8(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_BT(int8u Bits, int32u &Info) { INTEGRITY_INT(Bits<=BT->Remain()) Info=BT->Peek(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_TB( bool &Info) { INTEGRITY_INT(1<=BT->Remain()) Info=BT->PeekB(); } //--------------------------------------------------------------------------- void File__Analyze::Peek_T1(int8u Bits, int8u &Info) { INTEGRITY_INT(Bits<=BT->Remain()) Info=BT->Peek1(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_T2(int8u Bits, int16u &Info) { INTEGRITY_INT(Bits<=BT->Remain()) Info=BT->Peek2(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_T4(int8u Bits, int32u &Info) { INTEGRITY_INT(Bits<=BT->Remain()) Info=BT->Peek4(Bits); } //--------------------------------------------------------------------------- void File__Analyze::Peek_T8(int8u Bits, int64u &Info) { INTEGRITY_INT(Bits<=BT->Remain()) Info=BT->Peek8(Bits); } } //NameSpace #endif //MEDIAINFO_TRACE MediaInfoLib/Source/MediaInfo/File__Analyze_MinimizeSize.h100777 0 0 174577 12226004262 17201 0/* 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. */ //--------------------------------------------------------------------------- #ifndef MediaInfo_File__AnalyzeMinimizeSizeH #define MediaInfo_File__AnalyzeMinimizeSizeH //--------------------------------------------------------------------------- //*************************************************************************** // Class File__Analyze //*************************************************************************** class File__Analyze : public File__Base { public : //*************************************************************************** // Constructor/Destructor //*************************************************************************** File__Analyze(); virtual ~File__Analyze(); //*************************************************************************** // Open //*************************************************************************** void Open_Buffer_Init ( int64u File_Size); void Open_Buffer_Init (File__Analyze* Sub); void Open_Buffer_Init (File__Analyze* Sub, int64u File_Size); void Open_Buffer_Continue ( const int8u* Buffer, size_t Buffer_Size); void Open_Buffer_Continue (File__Analyze* Sub, const int8u* Buffer, size_t Buffer_Size, bool IsNewPacket=true, float64 Ratio=1.0); void Open_Buffer_Continue (File__Analyze* Sub, size_t Buffer_Size) {if (Element_Offset+Buffer_Size<=Element_Size) Open_Buffer_Continue(Sub, Buffer+Buffer_Offset+(size_t)Element_Offset, Buffer_Size); Element_Offset+=Buffer_Size;} void Open_Buffer_Continue (File__Analyze* Sub) {if (Element_Offset<=Element_Size) Open_Buffer_Continue(Sub, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); Element_Offset=Element_Size;} void Open_Buffer_Position_Set(int64u File_Offset); #if MEDIAINFO_SEEK size_t Open_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK void Open_Buffer_Unsynch (); void Open_Buffer_Update (); void Open_Buffer_Update (File__Analyze* Sub); void Open_Buffer_Finalize (bool NoBufferModification=false); void Open_Buffer_Finalize (File__Analyze* Sub); //*************************************************************************** // In/Out (for parsers) //*************************************************************************** //In Ztring ParserName; #if MEDIAINFO_EVENTS size_t StreamIDs_Size; int64u StreamIDs[16]; int8u StreamIDs_Width[16]; int8u ParserIDs[16]; void Event_Prepare (struct MediaInfo_Event_Generic* Event); #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX int8u Demux_Level; //bit 0=frame, bit 1=container, bit 2=elementary (eg MPEG-TS), bit 3=ancillary (e.g. DTVCC), default with frame set bool Demux_random_access; bool Demux_UnpacketizeContainer; bool Demux_IntermediateItemFound; size_t Demux_Offset; int64u Demux_TotalBytes; #endif //MEDIAINFO_DEMUX Ztring File_Name_WithoutDemux; bool PTS_DTS_Needed; struct frame_info { int64u Buffer_Offset_End; int64u PCR; //In nanoseconds int64u PTS; //In nanoseconds int64u DTS; //In nanoseconds int64u DUR; //In nanoseconds frame_info() { Buffer_Offset_End=(int64u)-1; PCR=(int64u)-1; PTS=(int64u)-1; DTS=(int64u)-1; DUR=(int64u)-1; } }; frame_info FrameInfo; frame_info FrameInfo_Previous; frame_info FrameInfo_Next; std::vector Offsets_Stream; std::vector Offsets_Buffer; size_t Offsets_Pos; int8u* OriginalBuffer; size_t OriginalBuffer_Size; size_t OriginalBuffer_Capacity; //Out int64u PTS_Begin; //In nanoseconds int64u PTS_End; //In nanoseconds int64u DTS_Begin; //In nanoseconds int64u DTS_End; //In nanoseconds int64u Frame_Count; int64u Frame_Count_Previous; int64u Frame_Count_InThisBlock; int64u Field_Count; int64u Field_Count_Previous; int64u Field_Count_InThisBlock; int64u Frame_Count_NotParsedIncluded; int64u FrameNumber_PresentationOrder; bool Synched; //Data is synched bool UnSynched_IsNotJunk; //Data is actually synched bool MustExtendParsingDuration; //Data has some substreams difficult to detect (e.g. captions), must wait a bit before final filling protected : //*************************************************************************** // Streams management //*************************************************************************** virtual void Streams_Accept() {}; virtual void Streams_Fill() {}; virtual void Streams_Update() {}; virtual void Streams_Finish() {}; //*************************************************************************** // Synchro //*************************************************************************** virtual bool Synchronize() {Synched=true; return true;}; //Look for the synchro virtual bool Synched_Test() {return true;}; //Test is synchro is OK virtual void Synched_Init() {}; //When synched, we can Init data bool Synchro_Manage(); bool Synchro_Manage_Test(); //*************************************************************************** // Buffer //*************************************************************************** //Buffer virtual void Read_Buffer_Init () {}; //Temp, should be in File__Base caller virtual void Read_Buffer_Continue () {}; //Temp, should be in File__Base caller virtual void Read_Buffer_AfterParsing () {}; //Temp, should be in File__Base caller #if MEDIAINFO_SEEK virtual size_t Read_Buffer_Seek (size_t, int64u, int64u); //Temp, should be in File__Base caller size_t Read_Buffer_Seek_OneFramePerFile (size_t, int64u, int64u); #endif //MEDIAINFO_SEEK virtual void Read_Buffer_Unsynched () {}; //Temp, should be in File__Base caller void Read_Buffer_Unsynched_OneFramePerFile (); virtual void Read_Buffer_Finalize () {}; //Temp, should be in File__Base caller bool Buffer_Parse(); //*************************************************************************** // BitStream init //*************************************************************************** void BS_Begin(); void BS_Begin_LE(); //Little Endian version void BS_End(); void BS_End_LE(); //Little Endian version //*************************************************************************** // File Header //*************************************************************************** //File Header - Management bool FileHeader_Manage (); //File Header - Begin virtual bool FileHeader_Begin () {return true;}; //File Header - Parse virtual void FileHeader_Parse () {Element_DoNotShow();}; //*************************************************************************** // Header //*************************************************************************** //Header - Management bool Header_Manage (); //Header - Begin virtual bool Header_Begin () {return true;}; //Header - Parse virtual void Header_Parse (); //Header - Info void Header_Fill_Code (int64u Code); inline void Header_Fill_Code (int64u Code, const Ztring &) {Header_Fill_Code(Code);}; void Header_Fill_Size (int64u Size); //*************************************************************************** // Data //*************************************************************************** //Header - Management bool Data_Manage (); //Data - Parse virtual void Data_Parse () {}; //Data - Info inline void Data_Info (const Ztring &) {}; inline void Data_Info_From_Milliseconds (int64u) {} //Data - Get info size_t Data_Remain () {return (size_t)(Element_Size-(Element_Offset+BS->Offset_Get()));}; size_t Data_BS_Remain () {return (size_t)BS->Remain();}; //Data - Detect EOF virtual void Detect_EOF () {}; bool EOF_AlreadyDetected; //Data - Helpers void Data_Accept (const char*) {Accept();} void Data_Accept () {Accept();} void Data_Reject (const char*) {Reject();} void Data_Reject () {Reject();} void Data_Finish (const char*) {ForceFinish();} void Data_Finish () {ForceFinish();} void Data_GoTo (int64u GoTo_, const char*) {GoTo(GoTo_);} void Data_GoTo (int64u GoTo_) {GoTo(GoTo_);} void Data_GoToFromEnd (int64u GoToFromEnd_, const char*) {GoToFromEnd(GoToFromEnd_);} void Data_GoToFromEnd (int64u GoToFromEnd_) {GoToFromEnd(GoToFromEnd_);} //*************************************************************************** // Elements //*************************************************************************** //Elements - Begin void Element_Begin (); #define Element_Begin0() Element_Begin() #define Element_Begin1(_NAME) Element_Begin() #define Element_Trace_Begin0() #define Element_Trace_Begin1(_NAME) //Elements - Name #define Element_Name(_A) //Elements - Info #define Element_Info1(_A) #define Element_Info2(_A,_B) #define Element_Info3(_A,_B,_C) #define Element_Info1C(_CONDITION,_A) #define Element_Info_From_Milliseconds(_A) //Elements - End inline void Element_End () {Element_End_Common_Flush();} #define Element_End0() Element_End() #define Element_End1(_NAME) Element_End() #define Element_Trace_End0() #define Element_Trace_End1(_NAME) //Elements - Preparation of element from external app void Element_Prepare (int64u Size); protected : //Element - Common void Element_End_Common_Flush(); Ztring Element_End_Common_Flush_Build(); public : //*************************************************************************** // Param //*************************************************************************** //Param - Main #define Param1(_A) #define Param2(_A,_B) #define Param3(_A,_B,_C) //Param - Info #define Param_Info1(_A) #define Param_Info2(_A,_B) #define Param_Info3(_A,_B,_C) #define Param_Info1C(_CONDITION,_A) #define Param_Info2C(_CONDITION,_A,_B) #define Param_Info3C(_CONDITION,_A,_B,_C) #define Param_Info_From_Milliseconds(A) //*************************************************************************** // Information //*************************************************************************** inline void Info (const Ztring&, size_t =0) {} //*************************************************************************** // Big Endian (Integer, Float, Fixed-Point) //*************************************************************************** void Get_B1_ (int8u &Info); void Get_B2_ (int16u &Info); void Get_B3_ (int32u &Info); void Get_B4_ (int32u &Info); void Get_B5_ (int64u &Info); void Get_B6_ (int64u &Info); void Get_B7_ (int64u &Info); void Get_B8_ (int64u &Info); void Get_B16_ (int128u &Info); void Get_BF4_ (float32 &Info); void Get_BF8_ (float64 &Info); void Get_BF10_ (float80 &Info); void Get_BFP4_ (int8u Bits, float32 &Info); #define Get_B1(Info, Name) Get_B1_(Info) #define Get_B2(Info, Name) Get_B2_(Info) #define Get_B3(Info, Name) Get_B3_(Info) #define Get_B4(Info, Name) Get_B4_(Info) #define Get_B5(Info, Name) Get_B5_(Info) #define Get_B6(Info, Name) Get_B6_(Info) #define Get_B7(Info, Name) Get_B7_(Info) #define Get_B8(Info, Name) Get_B8_(Info) #define Get_B16(Info, Name) Get_B16_(Info) #define Get_BF4(Info, Name) Get_BF4_(Info) #define Get_BF8(Info, Name) Get_BF8_(Info) #define Get_BF10(Info, Name) Get_BF10_(Info) #define Get_BFP4(Bits, Info, Name) Get_BFP4_(Bits, Info) void Peek_B1 (int8u &Info); void Peek_B2 (int16u &Info); void Peek_B3 (int32u &Info); void Peek_B4 (int32u &Info); void Peek_B5 (int64u &Info); void Peek_B6 (int64u &Info); void Peek_B7 (int64u &Info); void Peek_B8 (int64u &Info); void Peek_B16 (int128u &Info); void Peek_BF4 (float32 &Info); void Peek_BF8 (float64 &Info); void Peek_BF10(float64 &Info); void Peek_BFP4(int8u Bits, float64 &Info); #define Skip_B1(Name) Element_Offset++ #define Skip_B2(Name) Element_Offset+=2 #define Skip_B3(Name) Element_Offset+=3 #define Skip_B4(Name) Element_Offset+=4 #define Skip_B5(Name) Element_Offset+=5 #define Skip_B6(Name) Element_Offset+=6 #define Skip_B7(Name) Element_Offset+=7 #define Skip_B8(Name) Element_Offset+=8 #define Skip_BF4(Name) Element_Offset+=4 #define Skip_BF8(Name) Element_Offset+=8 #define Skip_B16(Name) Element_Offset+=16 #define Skip_BFP4(Size, Name) Element_Offset+=4 #define Info_B1(_INFO, _NAME) Element_Offset++ #define Info_B2(_INFO, _NAME) Element_Offset+=2 #define Info_B3(_INFO, _NAME) Element_Offset+=3 #define Info_B4(_INFO, _NAME) Element_Offset+=4 #define Info_B5(_INFO, _NAME) Element_Offset+=5 #define Info_B6(_INFO, _NAME) Element_Offset+=6 #define Info_B7(_INFO, _NAME) Element_Offset+=7 #define Info_B8(_INFO, _NAME) Element_Offset+=8 #define Info_B16(_INFO, _NAME) Element_Offset+=16 #define Info_BF4(_INFO, _NAME) Element_Offset+=4 #define Info_BF8(_INFO, _NAME) Element_Offset+=8 #define Info_BF10(_INFO, _NAME) Element_Offset+=10 #define Info_BFP4(_BITS, _INFO, _NAME) Element_Offset+=4 //*************************************************************************** // Little Endian //*************************************************************************** void Get_L1_ (int8u &Info); void Get_L2_ (int16u &Info); void Get_L3_ (int32u &Info); void Get_L4_ (int32u &Info); void Get_L5_ (int64u &Info); void Get_L6_ (int64u &Info); void Get_L7_ (int64u &Info); void Get_L8_ (int64u &Info); void Get_L16_ (int128u &Info); void Get_LF4_ (float32 &Info); void Get_LF8_ (float64 &Info); void Get_LF10_ (float80 &Info); void Get_LFP4_ (int8u Bits, float32 &Info); #define Get_L1(Info, Name) Get_L1_(Info) #define Get_L2(Info, Name) Get_L2_(Info) #define Get_L3(Info, Name) Get_L3_(Info) #define Get_L4(Info, Name) Get_L4_(Info) #define Get_L5(Info, Name) Get_L5_(Info) #define Get_L6(Info, Name) Get_L6_(Info) #define Get_L7(Info, Name) Get_L7_(Info) #define Get_L8(Info, Name) Get_L8_(Info) #define Get_L16(Info, Name) Get_L16_(Info) #define Get_LF4(Info, Name) Get_LF4_(Info) #define Get_LF8(Info, Name) Get_LF8_(Info) #define Get_LF10(Info, Name) Get_LF10_(Info) #define Get_LFP4(Bits, Info, Name) Get_LFP4_(Bits, Info) void Peek_L1 (int8u &Info); void Peek_L2 (int16u &Info); void Peek_L3 (int32u &Info); void Peek_L4 (int32u &Info); void Peek_L5 (int64u &Info); void Peek_L6 (int64u &Info); void Peek_L7 (int64u &Info); void Peek_L8 (int64u &Info); void Peek_L16 (int128u &Info); void Peek_LF4 (float32 &Info); void Peek_LF8 (float64 &Info); void Peek_LF10(float64 &Info); void Peek_LFP4(int8u Bits, float64 &Info); #define Skip_L1(Name) Element_Offset++ #define Skip_L2(Name) Element_Offset+=2 #define Skip_L3(Name) Element_Offset+=3 #define Skip_L4(Name) Element_Offset+=4 #define Skip_L5(Name) Element_Offset+=5 #define Skip_L6(Name) Element_Offset+=6 #define Skip_L7(Name) Element_Offset+=7 #define Skip_L8(Name) Element_Offset+=8 #define Skip_LF4(Name) Element_Offset+=4 #define Skip_LF8(Name) Element_Offset+=8 #define Skip_L16(Name) Element_Offset+=16 #define Skip_LFP4(Size, Name) Element_Offset+=4 #define Info_L1(_INFO, _NAME) Element_Offset++ #define Info_L2(_INFO, _NAME) Element_Offset+=2 #define Info_L3(_INFO, _NAME) Element_Offset+=3 #define Info_L4(_INFO, _NAME) Element_Offset+=4 #define Info_L5(_INFO, _NAME) Element_Offset+=5 #define Info_L6(_INFO, _NAME) Element_Offset+=6 #define Info_L7(_INFO, _NAME) Element_Offset+=7 #define Info_L8(_INFO, _NAME) Element_Offset+=8 #define Info_L16(_INFO, _NAME) Element_Offset+=16 #define Info_LF4(_INFO, _NAME) Element_Offset+=4 #define Info_LF8(_INFO, _NAME) Element_Offset+=8 #define Info_LF10(_INFO, _NAME) Element_Offset+=10 #define Info_LFP4(_LITS, _INFO, _NAME) Element_Offset+=4 //*************************************************************************** // Little and Big Endian together //*************************************************************************** void Get_D1_ (int8u &Info); void Get_D2_ (int16u &Info); void Get_D3_ (int32u &Info); void Get_D4_ (int32u &Info); void Get_D5_ (int64u &Info); void Get_D6_ (int64u &Info); void Get_D7_ (int64u &Info); void Get_D8_ (int64u &Info); void Get_D16_ (int128u &Info); void Get_DF4_ (float32 &Info); void Get_DF8_ (float64 &Info); void Get_DF10_ (float80 &Info); void Get_DFP4_ (int8u Bits, float32 &Info); #define Get_D1(Info, Name) Get_D1_(Info) #define Get_D2(Info, Name) Get_D2_(Info) #define Get_D3(Info, Name) Get_D3_(Info) #define Get_D4(Info, Name) Get_D4_(Info) #define Get_D5(Info, Name) Get_D5_(Info) #define Get_D6(Info, Name) Get_D6_(Info) #define Get_D7(Info, Name) Get_D7_(Info) #define Get_D8(Info, Name) Get_D8_(Info) #define Get_D16(Info, Name) Get_D16_(Info) #define Get_DF4(Info, Name) Get_DF4_(Info) #define Get_DF8(Info, Name) Get_DF8_(Info) #define Get_DF10(Info, Name) Get_DF10_(Info) #define Get_DFP4(Bits, Info, Name) Get_DFP4_(Bits, Info) void Peek_D1 (int8u &Info); void Peek_D2 (int16u &Info); void Peek_D3 (int32u &Info); void Peek_D4 (int32u &Info); void Peek_D5 (int64u &Info); void Peek_D6 (int64u &Info); void Peek_D7 (int64u &Info); void Peek_D8 (int64u &Info); void Peek_D16 (int128u &Info); void Peek_DF4 (float32 &Info); void Peek_DF8 (float64 &Info); void Peek_DF10(float64 &Info); void Peek_DFP4(int8u Bits, float64 &Info); #define Skip_D1(Name) Element_Offset++ #define Skip_D2(Name) Element_Offset+=2 #define Skip_D3(Name) Element_Offset+=3 #define Skip_D4(Name) Element_Offset+=4 #define Skip_D5(Name) Element_Offset+=5 #define Skip_D6(Name) Element_Offset+=6 #define Skip_D7(Name) Element_Offset+=7 #define Skip_D8(Name) Element_Offset+=8 #define Skip_DF4(Name) Element_Offset+=4 #define Skip_DF8(Name) Element_Offset+=8 #define Skip_D16(Name) Element_Offset+=16 #define Skip_DFP4(Size, Name) Element_Offset+=4 #define Info_D1(_INFO, _NAME) Element_Offset++ #define Info_D2(_INFO, _NAME) Element_Offset+=2 #define Info_D3(_INFO, _NAME) Element_Offset+=3 #define Info_D4(_INFO, _NAME) Element_Offset+=4 #define Info_D5(_INFO, _NAME) Element_Offset+=5 #define Info_D6(_INFO, _NAME) Element_Offset+=6 #define Info_D7(_INFO, _NAME) Element_Offset+=7 #define Info_D8(_INFO, _NAME) Element_Offset+=8 #define Info_D16(_INFO, _NAME) Element_Offset+=16 #define Info_DF4(_INFO, _NAME) Element_Offset+=4 #define Info_DF8(_INFO, _NAME) Element_Offset+=8 #define Info_DF10(_INFO, _NAME) Element_Offset+=10 #define Info_DFP4(_DITS, _INFO, _NAME) Element_Offset+=4 //*************************************************************************** // GUID //*************************************************************************** void Get_GUID (int128u &Info); inline void Get_GUID (int128u &Info, const char*) {Get_GUID(Info);} void Peek_GUID(int128u &Info); inline void Skip_GUID( const char*) {if (Element_Offset+16>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=16;} #define Info_GUID(_INFO, _NAME) int128u _INFO; Get_GUID(_INFO, _NAME) //*************************************************************************** // UUID //*************************************************************************** inline void Get_UUID (int128u &Info) {Get_B16_(Info);} inline void Get_UUID (int128u &Info, const char*) {Get_B16_(Info);} inline void Peek_UUID(int128u &Info) {Peek_B16(Info);} inline void Skip_UUID( const char*) {if (Element_Offset+16>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=16;} #define Info_UUID(_INFO, _NAME) int128u _INFO; Get_UUID(_INFO, _NAME) //*************************************************************************** // EBML //*************************************************************************** void Get_EB (int64u &Info); void Get_ES (int64s &Info); inline void Get_EB (int64u &Info, const char*) {Get_EB(Info);} inline void Get_ES (int64s &Info, const char*) {Get_ES(Info);} void Skip_EB(); void Skip_ES(); inline void Skip_EB( const char*) {Skip_EB();} inline void Skip_ES( const char*) {Skip_ES();} #define Info_EB(_INFO, _NAME) int64u _INFO; Get_EB(_INFO, _NAME) #define Info_ES(_INFO, _NAME) int64s _INFO; Get_ES(_INFO, _NAME) //*************************************************************************** // Variable Size Value //*************************************************************************** void Get_VS (int64u &Info); inline void Get_VS (int64u &Info, const char*) {Get_VS(Info);} void Skip_VS(); inline void Skip_VS( const char*) {Skip_VS();} #define Info_VS(_INFO, _NAME) int64u _INFO; Get_VS(_INFO, _NAME) //*************************************************************************** // Exp-Golomb //*************************************************************************** void Get_UE (int32u &Info); void Get_SE (int32s &Info); inline void Get_UE (int32u &Info, const char*) {Get_UE(Info);} inline void Get_SE (int32s &Info, const char*) {Get_SE(Info);} void Skip_UE(); inline void Skip_SE() {Skip_UE();} inline void Skip_UE( const char*) {Skip_UE();} inline void Skip_SE( const char*) {Skip_SE();} #define Info_UE(_INFO, _NAME) int32u _INFO; Get_UE(_INFO, _NAME) #define Info_SE(_INFO, _NAME) int32s _INFO; Get_SE(_INFO, _NAME) //*************************************************************************** // Interleaved Exp-Golomb //*************************************************************************** void Get_UI (int32u &Info); void Get_SI (int32s &Info); inline void Get_UI (int32u &Info, const char*) {Get_UI(Info);} inline void Get_SI (int32s &Info, const char*) {Get_SI(Info);} void Skip_UI(); void Skip_SI(); inline void Skip_UI( const char*) {Skip_UI();} inline void Skip_SI( const char*) {Skip_SI();} #define Info_UI(_INFO, _NAME) int32u _INFO; Get_UI(_INFO, _NAME) #define Info_SI(_INFO, _NAME) int32s _INFO; Get_SI(_INFO, _NAME) //*************************************************************************** // Variable Length Code //*************************************************************************** struct vlc { int32u value; int8u bit_increment; int8s mapped_to1; int8s mapped_to2; int8s mapped_to3; }; struct vlc_fast { int8u* Array; int8u* BitsToSkip; const vlc* Vlc; int8u Size; }; #define VLC_END \ {(int32u)-1, (int8u)-1, 0, 0, 0} void Get_VL_Prepare(vlc_fast &Vlc); void Get_VL_ (const vlc Vlc[], size_t &Info); void Get_VL_ (const vlc_fast &Vlc, size_t &Info); #define Get_VL(Vlc, Info, Name) Get_VL_(Vlc, Info); void Skip_VL_(const vlc Vlc[]); void Skip_VL_(const vlc_fast &Vlc); #define Skip_VL(Vlc, Name) Skip_VL_(Vlc); #define Info_VL(Vlc, Info, Name) Skip_VL_(Vlc) //*************************************************************************** // Characters //*************************************************************************** void Get_C1 (int8u &Info); void Get_C2 (int16u &Info); void Get_C3 (int32u &Info); void Get_C4 (int32u &Info); void Get_C5 (int64u &Info); void Get_C6 (int64u &Info); void Get_C7 (int64u &Info); void Get_C8 (int64u &Info); inline void Get_C1 (int8u &Info, const char*) {Get_C1(Info);} inline void Get_C2 (int16u &Info, const char*) {Get_C2(Info);} inline void Get_C3 (int32u &Info, const char*) {Get_C3(Info);} inline void Get_C4 (int32u &Info, const char*) {Get_C4(Info);} inline void Get_C5 (int64u &Info, const char*) {Get_C5(Info);} inline void Get_C6 (int64u &Info, const char*) {Get_C6(Info);} inline void Get_C7 (int64u &Info, const char*) {Get_C7(Info);} inline void Get_C8 (int64u &Info, const char*) {Get_C8(Info);} inline void Skip_C1( const char*) {if (Element_Offset+1>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=1;} inline void Skip_C2( const char*) {if (Element_Offset+2>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=2;} inline void Skip_C3( const char*) {if (Element_Offset+3>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=3;} inline void Skip_C4( const char*) {if (Element_Offset+4>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=4;} inline void Skip_C5( const char*) {if (Element_Offset+5>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=5;} inline void Skip_C6( const char*) {if (Element_Offset+6>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=6;} inline void Skip_C7( const char*) {if (Element_Offset+7>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=7;} inline void Skip_C8( const char*) {if (Element_Offset+8>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=8;} #define Info_C1(_INFO, _NAME) int8u _INFO; Get_C1(_INFO, _NAME) #define Info_C2(_INFO, _NAME) int16u _INFO; Get_C2(_INFO, _NAME) #define Info_C3(_INFO, _NAME) int32u _INFO; Get_C3(_INFO, _NAME) #define Info_C4(_INFO, _NAME) int32u _INFO; Get_C4(_INFO, _NAME) #define Info_C5(_INFO, _NAME) int64u _INFO; Get_C5(_INFO, _NAME) #define Info_C6(_INFO, _NAME) int64u _INFO; Get_C6(_INFO, _NAME) #define Info_C7(_INFO, _NAME) int64u _INFO; Get_C7(_INFO, _NAME) #define Info_C8(_INFO, _NAME) int64u _INFO; Get_C8(_INFO, _NAME) //*************************************************************************** // Text //*************************************************************************** void Get_Local (int64u Bytes, Ztring &Info); void Get_ISO_8859_1 (int64u Bytes, Ztring &Info); void Get_ISO_8859_2 (int64u Bytes, Ztring &Info); void Get_String (int64u Bytes, std::string &Info); void Get_UTF8 (int64u Bytes, Ztring &Info); void Get_UTF16 (int64u Bytes, Ztring &Info); void Get_UTF16B (int64u Bytes, Ztring &Info); void Get_UTF16L (int64u Bytes, Ztring &Info); inline void Get_Local (int64u Bytes, Ztring &Info, const char*) {Get_Local(Bytes, Info);} inline void Get_ISO_8859_1 (int64u Bytes, Ztring &Info, const char*) {Get_ISO_8859_1(Bytes, Info);} inline void Get_ISO_8859_2 (int64u Bytes, Ztring &Info, const char*) {Get_ISO_8859_2(Bytes, Info);} inline void Get_String (int64u Bytes, std::string &Info, const char*) {Get_String(Bytes, Info);} inline void Get_UTF8 (int64u Bytes, Ztring &Info, const char*) {Get_UTF8(Bytes, Info);} inline void Get_UTF16 (int64u Bytes, Ztring &Info, const char*) {Get_UTF16(Bytes, Info);} inline void Get_UTF16B (int64u Bytes, Ztring &Info, const char*) {Get_UTF16B(Bytes, Info);} inline void Get_UTF16L (int64u Bytes, Ztring &Info, const char*) {Get_UTF16L(Bytes, Info);} void Peek_Local (int64u Bytes, Ztring &Info); void Peek_String(int64u Bytes, std::string &Info); void Skip_Local (int64u Bytes, const char*) {if (Element_Offset+Bytes>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=(size_t)Bytes;} void Skip_String(int64u Bytes, const char*) {if (Element_Offset+Bytes>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=(size_t)Bytes;} void Skip_UTF8 (int64u Bytes, const char*) {if (Element_Offset+Bytes>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=(size_t)Bytes;} void Skip_UTF16B(int64u Bytes, const char*) {if (Element_Offset+Bytes>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=(size_t)Bytes;} void Skip_UTF16L(int64u Bytes, const char*) {if (Element_Offset+Bytes>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=(size_t)Bytes;} #define Info_Local(_BYTES, _INFO, _NAME) Ztring _INFO; Get_Local (_BYTES, _INFO, _NAME) #define Info_UTF8(_BYTES, _INFO, _NAME) Ztring _INFO; Get_UTF8 (_BYTES, _INFO, _NAME) #define Info_UTF16B(_BYTES, _INFO, _NAME) Ztring _INFO; Get_UTF16B(_BYTES, _INFO, _NAME) #define Info_UTF16L(_BYTES, _INFO, _NAME) Ztring _INFO; Get_UTF16L(_BYTES, _INFO, _NAME) //*************************************************************************** // Pascal strings //*************************************************************************** void Get_PA (std::string &Info); inline void Get_PA (std::string &Info, const char*) {Get_PA(Info);} void Peek_PA(std::string &Info); void Skip_PA(); inline void Skip_PA( const char*) {Skip_PA();} #define Info_PA(_INFO, _NAME) Ztring _INFO; Get_PA (_INFO, _NAME) //*************************************************************************** // Unknown //*************************************************************************** void Skip_XX(int64u Bytes); inline void Skip_XX(int64u Bytes, const char*) {Skip_XX(Bytes);} //*************************************************************************** // Flags //*************************************************************************** void Get_Flags_ (int64u Flags, size_t Order, bool &Info); void Get_FlagsM_ (int64u ValueToPut, int8u &Info); //Multiple #define Get_Flags(_FLAGS, _ORDER, _INFO, _NAME) Get_Flags_(_FLAGS, _ORDER, _INFO) #define Get_FlagsM(_VALUE, _INFO, _NAME) Get_FlagsM_(_VALUE, _INFO) #define Skip_Flags(_FLAGS, _ORDER, _NAME) #define Skip_FlagsM(_VALUE, _NAME) #define Info_Flags(_FLAGS, _ORDER, _INFO, _NAME) //*************************************************************************** // BitStream //*************************************************************************** void Get_BS_ (int8u Bits, int32u &Info); void Get_SB_ ( bool &Info); bool Get_SB_ () {return BS->GetB();} void Get_S1_ (int8u Bits, int8u &Info); void Get_S2_ (int8u Bits, int16u &Info); void Get_S3_ (int8u Bits, int32u &Info); void Get_S4_ (int8u Bits, int32u &Info); void Get_S5_ (int8u Bits, int64u &Info); void Get_S6_ (int8u Bits, int64u &Info); void Get_S7_ (int8u Bits, int64u &Info); void Get_S8_ (int8u Bits, int64u &Info); #define Get_BS(Bits, Info, Name) Get_BS_(Bits, Info) #define Get_SB( Info, Name) Get_SB_( Info) #define Get_S1(Bits, Info, Name) Get_S1_(Bits, Info) #define Get_S2(Bits, Info, Name) Get_S2_(Bits, Info) #define Get_S3(Bits, Info, Name) Get_S3_(Bits, Info) #define Get_S4(Bits, Info, Name) Get_S4_(Bits, Info) #define Get_S5(Bits, Info, Name) Get_S5_(Bits, Info) #define Get_S6(Bits, Info, Name) Get_S6_(Bits, Info) #define Get_S7(Bits, Info, Name) Get_S7_(Bits, Info) #define Get_S8(Bits, Info, Name) Get_S8_(Bits, Info) void Peek_BS(int8u Bits, int32u &Info); void Peek_SB( bool &Info); bool Peek_SB() {return BS->PeekB();} void Peek_S1(int8u Bits, int8u &Info); void Peek_S2(int8u Bits, int16u &Info); void Peek_S3(int8u Bits, int32u &Info); void Peek_S4(int8u Bits, int32u &Info); void Peek_S5(int8u Bits, int64u &Info); void Peek_S6(int8u Bits, int64u &Info); void Peek_S7(int8u Bits, int64u &Info); void Peek_S8(int8u Bits, int64u &Info); inline void Skip_BS_(size_t Bits) {BS->Skip(Bits);} inline void Skip_SB_( ) {BS->Skip(1);} inline void Skip_S1_(int8u Bits) {BS->Skip(Bits);} inline void Skip_S2_(int8u Bits) {BS->Skip(Bits);} inline void Skip_S3_(int8u Bits) {BS->Skip(Bits);} inline void Skip_S4_(int8u Bits) {BS->Skip(Bits);} inline void Skip_S5_(int8u Bits) {BS->Skip(Bits);} inline void Skip_S6_(int8u Bits) {BS->Skip(Bits);} inline void Skip_S7_(int8u Bits) {BS->Skip(Bits);} inline void Skip_S8_(int8u Bits) {BS->Skip(Bits);} #define Skip_BS(Bits, Name) Skip_BS_(Bits) #define Skip_SB( Name) Skip_SB_() #define Skip_S1(Bits, Name) Skip_S1_(Bits) #define Skip_S2(Bits, Name) Skip_S2_(Bits) #define Skip_S3(Bits, Name) Skip_S3_(Bits) #define Skip_S4(Bits, Name) Skip_S4_(Bits) #define Skip_S5(Bits, Name) Skip_S5_(Bits) #define Skip_S6(Bits, Name) Skip_S6_(Bits) #define Skip_S7(Bits, Name) Skip_S7_(Bits) #define Skip_S8(Bits, Name) Skip_S8_(Bits) void Mark_0 (); #define Mark_0_NoTrustError() Skip_SB_() //Use it for providing a warning instead of a non-trusting error void Mark_1 (); #define Mark_1_NoTrustError() Skip_SB_() //Use it for providing a warning instead of a non-trusting error #define Info_BS(_BITS, _INFO, _NAME) Skip_BS_(_BITS) #define Info_SB(_INFO, _NAME) Skip_SB_( ) #define Info_S1(_BITS, _INFO, _NAME) Skip_S1_(_BITS) #define Info_S2(_BITS, _INFO, _NAME) Skip_S2_(_BITS) #define Info_S3(_BITS, _INFO, _NAME) Skip_S3_(_BITS) #define Info_S4(_BITS, _INFO, _NAME) Skip_S4_(_BITS) #define Info_S5(_BITS, _INFO, _NAME) Skip_S5_(_BITS) #define Info_S6(_BITS, _INFO, _NAME) Skip_S6_(_BITS) #define Info_S7(_BITS, _INFO, _NAME) Skip_S7_(_BITS) #define Info_S8(_BITS, _INFO, _NAME) Skip_S8_(_BITS) #define TEST_SB_GET(_CODE, _NAME) \ { \ Peek_SB(_CODE); \ if (!_CODE) \ Skip_SB_(); \ else \ { \ Element_Begin0(); \ Skip_SB_(); \ #define TEST_SB_SKIP(_NAME) \ { \ if (!Peek_SB()) \ Skip_SB_(); \ else \ { \ Element_Begin0(); \ Skip_SB_(); \ #define TESTELSE_SB_GET(_CODE, _NAME) \ { \ Peek_SB(_CODE); \ if (_CODE) \ { \ Element_Begin0(); \ Skip_SB_(); \ #define TESTELSE_SB_SKIP(_NAME) \ { \ if (Peek_SB()) \ { \ Element_Begin0(); \ Skip_SB_(); \ #define TESTELSE_SB_ELSE(_NAME) \ Element_End0(); \ } \ else \ { \ Skip_SB_(); \ #define TESTELSE_SB_END() \ } \ } \ #define TEST_SB_END() \ Element_End0(); \ } \ } \ //*************************************************************************** // BitStream (Little Endian) //*************************************************************************** void Get_BT_ (int8u Bits, int32u &Info); void Get_TB_ ( bool &Info); bool Get_TB_ () {bool Temp; Get_TB_(Temp); return Temp;} void Get_T1_ (int8u Bits, int8u &Info); void Get_T2_ (int8u Bits, int16u &Info); void Get_T4_ (int8u Bits, int32u &Info); void Get_T8_ (int8u Bits, int64u &Info); #define Get_BT(Bits, Info, Name) Get_BT_(Bits, Info) #define Get_TB( Info, Name) Get_TB_( Info) #define Get_T1(Bits, Info, Name) Get_T1_(Bits, Info) #define Get_T2(Bits, Info, Name) Get_T2_(Bits, Info) #define Get_T4(Bits, Info, Name) Get_T4_(Bits, Info) #define Get_T8(Bits, Info, Name) Get_T8_(Bits, Info) void Peek_BT(int8u Bits, int32u &Info); void Peek_TB( bool &Info); bool Peek_TB() {bool Temp; Peek_TB(Temp); return Temp;} void Peek_T1(int8u Bits, int8u &Info); void Peek_T2(int8u Bits, int16u &Info); void Peek_T4(int8u Bits, int32u &Info); void Peek_T8(int8u Bits, int64u &Info); inline void Skip_BT_(size_t Bits) {BT->Skip(Bits);} inline void Skip_TB_( ) {BT->SkipB();} inline void Skip_T1_(int8u Bits) {BT->Skip1(Bits);} inline void Skip_T2_(int8u Bits) {BT->Skip2(Bits);} inline void Skip_T4_(int8u Bits) {BT->Skip4(Bits);} inline void Skip_T8_(int8u Bits) {BT->Skip8(Bits);} #define Skip_BT(Bits, Name) Skip_BT_(Bits) #define Skip_TB( Name) Skip_TB_() #define Skip_T1(Bits, Name) Skip_T1_(Bits) #define Skip_T2(Bits, Name) Skip_T2_(Bits) #define Skip_T4(Bits, Name) Skip_T4_(Bits) #define Skip_T8(Bits, Name) Skip_T8_(Bits) #define Info_BT(_BITS, _INFO, _NAME) Skip_BT_(_BITS) #define Info_TB(_INFO, _NAME) Skip_TB_( ) #define Info_T1(_BITS, _INFO, _NAME) Skip_T1_(_BITS) #define Info_T2(_BITS, _INFO, _NAME) Skip_T2_(_BITS) #define Info_T4(_BITS, _INFO, _NAME) Skip_T4_(_BITS) #define Info_T8(_BITS, _INFO, _NAME) Skip_T8_(_BITS) #define TEST_TB_GET(_CODE, _NAME) \ { \ Peek_TB(_CODE); \ if (!_CODE) \ Skip_TB_(); \ else \ { \ Element_Begin0(); \ Skip_TB_(); \ #define TEST_TB_TKIP(_NAME) \ { \ if (!Peek_TB()) \ Skip_TB_(); \ else \ { \ Element_Begin0(); \ Skip_TB_(); \ #define TESTELSE_TB_GET(_CODE, _NAME) \ { \ Peek_TB(_CODE); \ if (_CODE) \ { \ Element_Begin0(); \ Skip_TB_(); \ #define TESTELSE_TB_TKIP(_NAME) \ { \ if (Peek_TB()) \ { \ Element_Begin0(); \ Skip_TB_(); \ #define TESTELSE_TB_ELSE(_NAME) \ Element_End0(); \ } \ else \ { \ Skip_TB_(); \ #define TESTELSE_TB_END() \ } \ } \ #define TEST_TB_END() \ Element_End0(); \ } \ } \ //*************************************************************************** // Next code planning //*************************************************************************** void NextCode_Add(int64u Code); void NextCode_Clear(); bool NextCode_Test(); //*************************************************************************** // Element trusting //*************************************************************************** void Trusted_IsNot (const char*) {Trusted_IsNot();} void Trusted_IsNot (); //*************************************************************************** // Stream filling //*************************************************************************** //Elements - Preparation of element from external app size_t Stream_Prepare (stream_t KindOfStream, size_t StreamPos=(size_t)-1); size_t Stream_Erase (stream_t KindOfStream, size_t StreamPos); //Fill with datas (with parameter as a size_t) void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, const Ztring &Value, bool Replace=false); inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, const std::string &Value, bool Utf8=true, bool Replace=false) {if (Utf8) Fill(StreamKind, StreamPos, Parameter, Ztring().From_UTF8(Value.c_str(), Value.size()), Replace); else Fill(StreamKind, StreamPos, Parameter, Ztring().From_Local(Value.c_str(), Value.size()), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, const char* Value, size_t Value_Size=Unlimited, bool Utf8=true, bool Replace=false) {if (Utf8) Fill(StreamKind, StreamPos, Parameter, Ztring().From_UTF8(Value, Value_Size), Replace); else Fill(StreamKind, StreamPos, Parameter, Ztring().From_Local(Value, Value_Size), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, const wchar_t* Value, size_t Value_Size=Unlimited, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring().From_Unicode(Value, Value_Size), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, int8u Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, int8s Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, int16u Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, int16s Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, int32u Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, int32s Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, int64u Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, int64s Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, float32 Value, int8u AfterComma=3, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, AfterComma), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, float64 Value, int8u AfterComma=3, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, AfterComma), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, float80 Value, int8u AfterComma=3, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, AfterComma), Replace);} #ifdef SIZE_T_IS_LONG inline void Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, size_t Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} #endif //SIZE_T_IS_LONG //Fill with datas void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, const Ztring &Value, bool Replace=false); inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, const std::string &Value, bool Utf8=true, bool Replace=false) {if (Utf8) Fill(StreamKind, StreamPos, Parameter, Ztring().From_UTF8(Value.c_str(), Value.size())); else Fill(StreamKind, StreamPos, Parameter, Ztring().From_Local(Value.c_str(), Value.size()), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, const char* Value, size_t Value_Size=Unlimited, bool Utf8=true, bool Replace=false) {if (Utf8) Fill(StreamKind, StreamPos, Parameter, Ztring().From_UTF8(Value, Value_Size), Replace); else Fill(StreamKind, StreamPos, Parameter, Ztring().From_Local(Value, Value_Size), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, const wchar_t* Value, size_t Value_Size=Unlimited, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring().From_Unicode(Value, Value_Size), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, int8u Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, int8s Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, int16u Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, int16s Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, int32u Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, int32s Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, int64u Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, int64s Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, float32 Value, int8u AfterComma=3, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, AfterComma), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, float64 Value, int8u AfterComma=3, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, AfterComma), Replace);} inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, float80 Value, int8u AfterComma=3, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, AfterComma), Replace);} #ifdef SIZE_T_IS_LONG inline void Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, size_t Value, int8u Radix=10, bool Replace=false) {Fill(StreamKind, StreamPos, Parameter, Ztring::ToZtring(Value, Radix).MakeUpperCase(), Replace);} #endif //SIZE_T_IS_LONG ZtringListList Fill_Temp; void Fill_Flush (); size_t Fill_Parameter(stream_t StreamKind, generic StreamPos); const Ztring &Retrieve_Const (stream_t StreamKind, size_t StreamPos, size_t Parameter, info_t KindOfInfo=Info_Text); Ztring Retrieve (stream_t StreamKind, size_t StreamPos, size_t Parameter, info_t KindOfInfo=Info_Text); const Ztring &Retrieve_Const (stream_t StreamKind, size_t StreamPos, const char* Parameter, info_t KindOfInfo=Info_Text); Ztring Retrieve (stream_t StreamKind, size_t StreamPos, const char* Parameter, info_t KindOfInfo=Info_Text); void Clear (stream_t StreamKind, size_t StreamPos, size_t Parameter); void Clear (stream_t StreamKind, size_t StreamPos, const char* Parameter); void Clear (stream_t StreamKind, size_t StreamPos); void Clear (stream_t StreamKind); inline void Clear () {File__Base::Clear();} //*************************************************************************** // Filling //*************************************************************************** //Actions void Accept (const char*) {Accept();} void Accept (); void Accept (File__Analyze* Parser); void Reject (const char*) {Reject();} void Reject (); void Reject (File__Analyze* Parser); void Fill (const char*) {Fill();} void Fill (); void Fill (File__Analyze* Parser); void Update (const char*) {Fill();} void Update (); void Update (File__Analyze* Parser); void Finish (const char*) {Finish();} void Finish (); void Finish (File__Analyze* Parser); void ForceFinish (const char*) {ForceFinish();} void ForceFinish (); void ForceFinish (File__Analyze* Parser); void GoTo (int64u GoTo_, const char*) {GoTo(GoTo_);} void GoTo (int64u GoTo); void GoToFromEnd (int64u GoToFromEnd_, const char*) {GoToFromEnd(GoToFromEnd_);} void GoToFromEnd (int64u GoToFromEnd); int64u Element_Code_Get (size_t Level); int64u Element_TotalSize_Get (size_t LevelLess=0); bool Element_IsComplete_Get (); void Element_ThisIsAList (); void Element_WaitForMoreData (); void Element_DoNotTrust (const char*) {Element_DoNotTrust();} void Element_DoNotTrust (); inline void Element_DoNotShow () {} inline void Element_Show () {} inline bool Element_Show_Get () {return false;} inline void Element_Show_Add (const Ztring &) {} //Status bool Element_IsOK (); bool Element_IsNotFinished (); bool Element_IsWaitingForMoreData (); //*************************************************************************** // Merging //*************************************************************************** //Utils public : size_t Merge(MediaInfo_Internal &ToAdd, bool Erase=true); //Merge 2 File_Base size_t Merge(MediaInfo_Internal &ToAdd, stream_t StreamKind, size_t StreamPos_From, size_t StreamPos_To, bool Erase=true); //Merge 2 streams size_t Merge(File__Analyze &ToAdd, bool Erase=true); //Merge 2 File_Base size_t Merge(File__Analyze &ToAdd, stream_t StreamKind, size_t StreamPos_From, size_t StreamPos_To, bool Erase=true); //Merge 2 streams void CodecID_Fill (const Ztring &Value, stream_t StreamKind, size_t StreamPos, infocodecid_format_t Format); //*************************************************************************** // Finalize //*************************************************************************** //End void Streams_Finish_Global(); protected : void Streams_Finish_StreamOnly(); void Streams_Finish_StreamOnly(stream_t StreamKid, size_t StreamPos); void Streams_Finish_StreamOnly_General(size_t StreamPos); void Streams_Finish_StreamOnly_Video(size_t StreamPos); void Streams_Finish_StreamOnly_Audio(size_t StreamPos); void Streams_Finish_StreamOnly_Text(size_t StreamPos); void Streams_Finish_StreamOnly_Other(size_t StreamPos); void Streams_Finish_StreamOnly_Image(size_t StreamPos); void Streams_Finish_StreamOnly_Menu(size_t StreamPos); void Streams_Finish_InterStreams(); void Streams_Finish_Cosmetic(); void Streams_Finish_Cosmetic(stream_t StreamKid, size_t StreamPos); void Streams_Finish_Cosmetic_General(size_t StreamPos); void Streams_Finish_Cosmetic_Video(size_t StreamPos); void Streams_Finish_Cosmetic_Audio(size_t StreamPos); void Streams_Finish_Cosmetic_Text(size_t StreamPos); void Streams_Finish_Cosmetic_Chapters(size_t StreamPos); void Streams_Finish_Cosmetic_Image(size_t StreamPos); void Streams_Finish_Cosmetic_Menu(size_t StreamPos); void Tags (); void Video_FrameRate_Rounding (size_t Pos, video Parameter); void Video_BitRate_Rounding (size_t Pos, video Parameter); void Audio_BitRate_Rounding (size_t Pos, audio Parameter); //Utils - Finalize void Duration_Duration123 (stream_t StreamKind, size_t StreamPos, size_t Parameter); void FileSize_FileSize123 (stream_t StreamKind, size_t StreamPos, size_t Parameter); void Kilo_Kilo123 (stream_t StreamKind, size_t StreamPos, size_t Parameter); void Value_Value123 (stream_t StreamKind, size_t StreamPos, size_t Parameter); void YesNo_YesNo (stream_t StreamKind, size_t StreamPos, size_t Parameter); //*************************************************************************** // //*************************************************************************** protected : //Save for speed improvement int8u Config_Demux; Ztring Config_LineSeparator; bool IsSub; bool IsRawStream; //Configuration bool DataMustAlwaysBeComplete; //Data must always be complete, else wait for more data bool MustUseAlternativeParser; //Must use the second parser (example: for Data part) //Synchro bool MustParseTheHeaderFile; //There is an header part, must parse it size_t Trusted; size_t Trusted_Multiplier; //Elements size_t Element_Level; //Current level bool Element_WantNextLevel; //Want to go to the next leavel instead of the same level //Element int64u Element_Code; //Code filled in the file, copy of Element[Element_Level].Code int64u Element_Offset; //Position in the Element (without header) int64u Element_Size; //Size of the Element (without header) private : //*************************************************************************** // Buffer //*************************************************************************** void Buffer_Clear(); //Clear the buffer protected : //Buffer bool Open_Buffer_Continue_Loop(); const int8u* Buffer; public : //TO CHANGE size_t Buffer_Size; int64u Buffer_TotalBytes; int64u Buffer_TotalBytes_FirstSynched; int64u Buffer_TotalBytes_LastSynched; int64u Buffer_PaddingBytes; int64u Buffer_JunkBytes; float64 Stream_BitRateFromContainer; protected : int8u* Buffer_Temp; size_t Buffer_Temp_Size; size_t Buffer_Temp_Size_Max; size_t Buffer_Offset; //Temporary usage in this parser size_t Buffer_Offset_Temp; //Temporary usage in this parser size_t Buffer_MinimumSize; size_t Buffer_MaximumSize; int64u Buffer_TotalBytes_FirstSynched_Max; int64u Buffer_TotalBytes_Fill_Max; friend class File__Tags_Helper; //*************************************************************************** // Helpers //*************************************************************************** bool FileHeader_Begin_0x000001(); bool FileHeader_Begin_XML(tinyxml2::XMLDocument &Document); bool Synchronize_0x000001(); public: void TestContinuousFileNames(size_t CountOfFiles=24, Ztring FileExtension=Ztring()); private : //*************************************************************************** // Elements //*************************************************************************** //Element BitStream_Fast* BS; //For conversion from bytes to bitstream BitStream* BT; //For conversion from bytes to bitstream (Little Endian) public : //TO CHANGE int64u Header_Size; //Size of the header of the current element private : //Elements size_t Element_Level_Base; //From other parsers public : //For very quick access, to not use except if you know what you do struct element_details { int64u Code; //Code filled in the file int64u Next; // bool WaitForMoreData; //This element is not complete, we need more data bool UnTrusted; //This element has a problem bool IsComplete; //This element is fully buffered, no need of more }; std::vector Element; private : //NextCode std::map NextCode; //BookMarks size_t BookMark_Element_Level; int64u BookMark_GoTo; std::vector BookMark_Code; std::vector BookMark_Next; public : void BookMark_Set(size_t Element_Level_ToGet=(size_t)-1); void BookMark_Get(); virtual bool BookMark_Needed() {return false;}; //Temp std::bitset<32> Status; enum status { IsAccepted, IsFilled, IsUpdated, IsFinished, Reserved_04, Reserved_05, Reserved_06, Reserved_07, Reserved_08, Reserved_09, Reserved_10, Reserved_11, Reserved_12, Reserved_13, Reserved_14, Reserved_15, User_16, User_17, User_18, User_19, User_20, User_21, User_22, User_23, User_24, User_25, User_26, User_27, User_28, User_29, User_30, User_31, }; bool ShouldContinueParsing; //Configuration bool MustSynchronize; bool CA_system_ID_MustSkipSlices; //Demux enum contenttype { ContentType_MainStream, ContentType_SubStream, ContentType_Header, ContentType_Synchro }; #if MEDIAINFO_DEMUX void Demux (const int8u* Buffer, size_t Buffer_Size, contenttype ContentType, const int8u* OriginalBuffer=NULL, size_t OriginalBuffer_Size=0); virtual bool Demux_UnpacketizeContainer_Test() {return true;} bool Demux_UnpacketizeContainer_Test_OneFramePerFile(); void Demux_UnpacketizeContainer_Demux(bool random_access=true); void Demux_UnpacketizeContainer_Demux_Clear(); bool Demux_EventWasSent_Accept_Specific; #else //MEDIAINFO_DEMUX #define Demux(_A, _B, _C) #endif //MEDIAINFO_DEMUX //Events data bool PES_FirstByte_IsAvailable; bool PES_FirstByte_Value; int64u Unsynch_Frame_Count; //MD5 #if MEDIAINFO_MD5 struct MD5Context* MD5; int64u Md5_ParseUpTo; #endif //MEDIAINFO_MD5 #if MEDIAINFO_SEEK private: bool Seek_Duration_Detected; #endif //MEDIAINFO_SEEK #if MEDIAINFO_IBI public: bool Config_Ibi_Create; int64u Ibi_SynchronizationOffset_Current; int64u Ibi_SynchronizationOffset_BeginOfFrame; ibi Ibi; //If Main only ibi::stream* IbiStream; //If sub only size_t Ibi_Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); void Ibi_Read_Buffer_Unsynched (); void Ibi_Stream_Finish (); void Ibi_Stream_Finish (int64u Numerator, int64u Denominator); //Partial void Ibi_Add (); #else //MEDIAINFO_IBI size_t Ibi_Read_Buffer_Seek (size_t, int64u, int64u) {return (size_t)-1;} void Ibi_Read_Buffer_Unsynched () {} void Ibi_Stream_Finish () {} void Ibi_Stream_Finish (int64u, int64u) {} void Ibi_Add () {} #endif //MEDIAINFO_IBI }; //Helpers #define DETAILS_INFO(_DATA) #endif MediaInfoLib/Source/MediaInfo/File__Analyze_Streams.cpp100777 0 0 514741 12254604474 16541 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include "MediaInfo/MediaInfo_Internal.h" #include "MediaInfo/MediaInfo_Config.h" #include "ZenLib/File.h" #include "ZenLib/FileName.h" #include "ZenLib/BitStream_LE.h" #include using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- extern MediaInfo_Config Config; //--------------------------------------------------------------------------- //*************************************************************************** // Preparation des streams //*************************************************************************** //--------------------------------------------------------------------------- size_t File__Analyze::Stream_Prepare (stream_t KindOfStream, size_t StreamPos) { //Integrity if (!Status[IsAccepted] || KindOfStream>Stream_Max) return Error; //Clear if (KindOfStream==Stream_Max) { StreamKind_Last=Stream_Max; StreamPos_Last=(size_t)-1; return 0; } if (StreamPos>=Count_Get(KindOfStream)) { //Add a stream (*Stream)[KindOfStream].resize((*Stream)[KindOfStream].size()+1); (*Stream_More)[KindOfStream].resize((*Stream_More)[KindOfStream].size()+1); StreamKind_Last=KindOfStream; StreamPos_Last=(*Stream)[KindOfStream].size()-1; } else { //Insert a stream (*Stream)[KindOfStream].insert((*Stream)[KindOfStream].begin()+StreamPos, ZtringList()); (*Stream_More)[KindOfStream].insert((*Stream_More)[KindOfStream].begin()+StreamPos, ZtringListList()); StreamKind_Last=KindOfStream; StreamPos_Last=StreamPos; } //Filling basic info Fill(StreamKind_Last, StreamPos_Last, (size_t)General_Count, Count_Get(StreamKind_Last, StreamPos_Last)); Fill(StreamKind_Last, StreamPos_Last, General_StreamKind, MediaInfoLib::Config.Info_Get(StreamKind_Last).Read(General_StreamKind, Info_Text)); Fill(StreamKind_Last, StreamPos_Last, General_StreamKind_String, MediaInfoLib::Config.Language_Get(MediaInfoLib::Config.Info_Get(StreamKind_Last).Read(General_StreamKind, Info_Text)), true); for (size_t Pos=0; Pos1) Fill(StreamKind_Last, Pos, General_StreamKindPos, Pos+1, 10, true); else Clear(StreamKind_Last, Pos, General_StreamKindPos); } //Filling Lists & Counts if (!IsSub && KindOfStream!=Stream_General) { const Ztring& StreamKind_Text=Get(KindOfStream, 0, General_StreamKind, Info_Text); if (Count_Get(KindOfStream)>1) { ZtringList Temp; Temp.Separator_Set(0, __T(" / ")); Temp.Write(Retrieve(Stream_General, 0, Ztring(StreamKind_Text+__T("_Codec_List")).To_Local().c_str())); if (StreamPos0) { //File name if (File_Name.find(__T("://"))==string::npos) { Fill (Stream_General, 0, General_CompleteName, File_Name); Fill (Stream_General, 0, General_FolderName, FileName::Path_Get(File_Name)); Fill (Stream_General, 0, General_FileName, FileName::Name_Get(File_Name)); Fill (Stream_General, 0, General_FileExtension, FileName::Extension_Get(File_Name)); } else { Ztring FileName_Modified=File_Name; size_t Begin=FileName_Modified.find(__T(':'), 6); size_t End=FileName_Modified.find(__T('@')); if (Begin!=string::npos && End!=string::npos && BeginFileName_Modified_PathSeparatorOffset) { Fill (Stream_General, 0, General_FileName, FileName_Modified.substr(FileName_Modified_PathSeparatorOffset+1, FileName_Modified_ExtensionSeparatorOffset-(FileName_Modified_PathSeparatorOffset+1))); Fill (Stream_General, 0, General_FileExtension, FileName_Modified.substr(FileName_Modified_ExtensionSeparatorOffset+1)); } else Fill (Stream_General, 0, General_FileName, FileName_Modified.substr(FileName_Modified_PathSeparatorOffset+1)); } } //File dates File F(File_Name); Fill (Stream_General, 0, General_File_Created_Date, F.Created_Get()); Fill (Stream_General, 0, General_File_Created_Date_Local, F.Created_Local_Get()); Fill (Stream_General, 0, General_File_Modified_Date, F.Modified_Get()); Fill (Stream_General, 0, General_File_Modified_Date_Local, F.Modified_Local_Get()); } //File size if (((!IsSub || !File_Name.empty()) && KindOfStream==Stream_General && File_Size!=(int64u)-1) #if MEDIAINFO_ADVANCED && !Config->File_IgnoreSequenceFileSize_Get() #endif //MEDIAINFO_ADVANCED ) Fill (Stream_General, 0, General_FileSize, File_Size); //Fill with already ready data for (size_t Pos=0; PosStream_Max || StreamPos>=Count_Get(KindOfStream)) return Error; //Filling Lists & Counts if (!IsSub && KindOfStream!=Stream_General) { const Ztring& StreamKind_Text=Get(KindOfStream, 0, General_StreamKind, Info_Text); ZtringList Temp; Temp.Separator_Set(0, __T(" / ")); Temp.Write(Retrieve(Stream_General, 0, Ztring(StreamKind_Text+__T("_Codec_List")).To_Local().c_str())); if (StreamPos1) Fill(KindOfStream, Pos, General_StreamKindPos, Pos+1, 10, true); else Clear(KindOfStream, Pos, General_StreamKindPos); } StreamKind_Last=Stream_Max; StreamPos_Last=(size_t)-1; return (*Stream)[KindOfStream].size()-1; //The position in the stream count } //*************************************************************************** // Filling //*************************************************************************** //--------------------------------------------------------------------------- void File__Analyze::Fill (stream_t StreamKind, size_t StreamPos, size_t Parameter, const Ztring &Value, bool Replace) { //Integrity if (!Status[IsAccepted] || StreamKind>Stream_Max || Parameter==(size_t)-1) return; //Handling values with \r\n inside if (Value.find(__T('\r'))!=string::npos || Value.find(__T('\n'))!=string::npos) { Ztring NewValue=Value; NewValue.FindAndReplace(__T("\r\n"), __T(" / "), 0, Ztring_Recursive); NewValue.FindAndReplace(__T("\r"), __T(" / "), 0, Ztring_Recursive); NewValue.FindAndReplace(__T("\n"), __T(" / "), 0, Ztring_Recursive); if (NewValue.size()>=3 && NewValue.rfind(__T(" / "))==NewValue.size()-3) NewValue.resize(NewValue.size()-3); Fill(StreamKind, StreamPos, Parameter, NewValue, Replace); return; } //Handle Value before StreamKind if (StreamKind==Stream_Max || StreamPos>=(*Stream)[StreamKind].size()) { ZtringList NewList; NewList.push_back(Ztring().From_Number(Parameter)); NewList.push_back(Value); Fill_Temp.push_back(NewList); return; //No streams } //Some defaults if (Parameter==Fill_Parameter(StreamKind, Generic_Format_Commercial)) Replace=true; if (Parameter==Fill_Parameter(StreamKind, Generic_Format_Commercial_IfAny)) Replace=true; if (!Replace && Value.empty()) return; if (Replace && Value.empty()) { Clear(StreamKind, StreamPos, Parameter); return; } Ztring &Target=(*Stream)[StreamKind][StreamPos](Parameter); if (Target.empty() || Replace) Target=Value; //First value else { Target+=MediaInfoLib::Config.TagSeparator_Get(); Target+=Value; } Status[IsUpdated]=true; //Deprecated if (Parameter==Fill_Parameter(StreamKind, Generic_BitDepth)) Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Resolution), Retrieve(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_BitDepth)), true); if (StreamKind==Stream_Video && Parameter==Video_Colorimetry) Fill(Stream_Video, StreamPos, Video_ChromaSubsampling, Value, Replace); if (StreamKind==Stream_Video && Parameter==Video_DisplayAspectRatio && !Value.empty() && Retrieve(Stream_Video, StreamPos, Video_PixelAspectRatio).empty()) { float DAR =Retrieve(Stream_Video, StreamPos, Video_DisplayAspectRatio).To_float32(); float Width =Retrieve(Stream_Video, StreamPos, Video_Width ).To_float32(); float Height=Retrieve(Stream_Video, StreamPos, Video_Height ).To_float32(); if (DAR && Height && Width) { if (Retrieve(Stream_Video, StreamPos, Video_DisplayAspectRatio)==__T("1.778")) DAR=((float)16)/9; //More exact value if (Retrieve(Stream_Video, StreamPos, Video_DisplayAspectRatio)==__T("1.333")) DAR=((float)4)/3; //More exact value Fill(Stream_Video, StreamPos, Video_PixelAspectRatio, DAR/(((float32)Width)/Height)); } } if (StreamKind==Stream_Video && Parameter==Video_PixelAspectRatio && !Value.empty() && Retrieve(Stream_Video, StreamPos, Video_DisplayAspectRatio).empty()) { float32 PAR =Retrieve(Stream_Video, StreamPos, Video_PixelAspectRatio ).To_float32(); if (PAR>(float32)12/(float32)11*0.999 && PAR<(float32)12/(float32)11*1.001) PAR=(float32)12/(float32)11; if (PAR>(float32)10/(float32)11*0.999 && PAR<(float32)10/(float32)11*1.001) PAR=(float32)10/(float32)11; if (PAR>(float32)16/(float32)11*0.999 && PAR<(float32)16/(float32)11*1.001) PAR=(float32)16/(float32)11; if (PAR>(float32)40/(float32)33*0.999 && PAR<(float32)40/(float32)33*1.001) PAR=(float32)40/(float32)33; if (PAR>(float32)24/(float32)11*0.999 && PAR<(float32)24/(float32)11*1.001) PAR=(float32)24/(float32)11; if (PAR>(float32)20/(float32)11*0.999 && PAR<(float32)20/(float32)11*1.001) PAR=(float32)20/(float32)11; if (PAR>(float32)32/(float32)11*0.999 && PAR<(float32)32/(float32)11*1.001) PAR=(float32)32/(float32)11; if (PAR>(float32)80/(float32)33*0.999 && PAR<(float32)80/(float32)33*1.001) PAR=(float32)80/(float32)33; if (PAR>(float32)18/(float32)11*0.999 && PAR<(float32)18/(float32)11*1.001) PAR=(float32)18/(float32)11; if (PAR>(float32)15/(float32)11*0.999 && PAR<(float32)15/(float32)11*1.001) PAR=(float32)15/(float32)11; if (PAR>(float32)64/(float32)33*0.999 && PAR<(float32)64/(float32)33*1.001) PAR=(float32)64/(float32)33; if (PAR>(float32)160/(float32)99*0.999 && PAR<(float32)160/(float32)99*1.001) PAR=(float32)160/(float32)99; if (PAR>(float32)4/(float32)3*0.999 && PAR<(float32)4/(float32)3*1.01) PAR=(float32)4/(float32)3; if (PAR>(float32)3/(float32)2*0.999 && PAR<(float32)3/(float32)2*1.001) PAR=(float32)3/(float32)2; if (PAR>(float32)2/(float32)1*0.999 && PAR<(float32)2/(float32)1*1.001) PAR=(float32)2; if (PAR>(float32)59/(float32)54*0.999 && PAR<(float32)59/(float32)54*1.001) PAR=(float32)59/(float32)54; float32 Width =Retrieve(Stream_Video, StreamPos, Video_Width ).To_float32(); float32 Height=Retrieve(Stream_Video, StreamPos, Video_Height ).To_float32(); if (PAR && Height && Width) Fill(Stream_Video, StreamPos, Video_DisplayAspectRatio, ((float32)Width)/Height*PAR); } if (StreamKind==Stream_Image && Parameter==Image_DisplayAspectRatio && !Value.empty() && Retrieve(Stream_Image, StreamPos, Image_PixelAspectRatio).empty()) { float DAR =Retrieve(Stream_Image, StreamPos, Image_DisplayAspectRatio).To_float32(); float Width =Retrieve(Stream_Image, StreamPos, Image_Width ).To_float32(); float Height=Retrieve(Stream_Image, StreamPos, Image_Height ).To_float32(); if (DAR && Height && Width) { if (Retrieve(Stream_Image, StreamPos, Image_DisplayAspectRatio)==__T("1.778")) DAR=((float)16)/9; //More exact value if (Retrieve(Stream_Image, StreamPos, Image_DisplayAspectRatio)==__T("1.333")) DAR=((float)4)/3; //More exact value Fill(Stream_Image, StreamPos, Image_PixelAspectRatio, DAR/(((float32)Width)/Height)); } } if (StreamKind==Stream_Image && Parameter==Image_PixelAspectRatio && !Value.empty() && Retrieve(Stream_Image, StreamPos, Image_DisplayAspectRatio).empty()) { float32 PAR =Retrieve(Stream_Image, StreamPos, Image_PixelAspectRatio ).To_float32(); if (PAR>(float32)12/(float32)11*0.999 && PAR<(float32)12/(float32)11*1.001) PAR=(float32)12/(float32)11; if (PAR>(float32)10/(float32)11*0.999 && PAR<(float32)10/(float32)11*1.001) PAR=(float32)10/(float32)11; if (PAR>(float32)16/(float32)11*0.999 && PAR<(float32)16/(float32)11*1.001) PAR=(float32)16/(float32)11; if (PAR>(float32)40/(float32)33*0.999 && PAR<(float32)40/(float32)33*1.001) PAR=(float32)40/(float32)33; if (PAR>(float32)24/(float32)11*0.999 && PAR<(float32)24/(float32)11*1.001) PAR=(float32)24/(float32)11; if (PAR>(float32)20/(float32)11*0.999 && PAR<(float32)20/(float32)11*1.001) PAR=(float32)20/(float32)11; if (PAR>(float32)32/(float32)11*0.999 && PAR<(float32)32/(float32)11*1.001) PAR=(float32)32/(float32)11; if (PAR>(float32)80/(float32)33*0.999 && PAR<(float32)80/(float32)33*1.001) PAR=(float32)80/(float32)33; if (PAR>(float32)18/(float32)11*0.999 && PAR<(float32)18/(float32)11*1.001) PAR=(float32)18/(float32)11; if (PAR>(float32)15/(float32)11*0.999 && PAR<(float32)15/(float32)11*1.001) PAR=(float32)15/(float32)11; if (PAR>(float32)64/(float32)33*0.999 && PAR<(float32)64/(float32)33*1.001) PAR=(float32)64/(float32)33; if (PAR>(float32)160/(float32)99*0.999 && PAR<(float32)160/(float32)99*1.001) PAR=(float32)160/(float32)99; if (PAR>(float32)4/(float32)3*0.999 && PAR<(float32)4/(float32)3*1.01) PAR=(float32)4/(float32)3; if (PAR>(float32)3/(float32)2*0.999 && PAR<(float32)3/(float32)2*1.001) PAR=(float32)3/(float32)2; if (PAR>(float32)2/(float32)1*0.999 && PAR<(float32)2/(float32)1*1.001) PAR=(float32)2; if (PAR>(float32)59/(float32)54*0.999 && PAR<(float32)59/(float32)54*1.001) PAR=(float32)59/(float32)54; float32 Width =Retrieve(Stream_Image, StreamPos, Image_Width ).To_float32(); float32 Height=Retrieve(Stream_Image, StreamPos, Image_Height ).To_float32(); if (PAR && Height && Width) Fill(Stream_Image, StreamPos, Image_DisplayAspectRatio, ((float32)Width)/Height*PAR); } //Commercial name if (Parameter==Fill_Parameter(StreamKind, Generic_Format)) Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Format_Commercial), Value); if (Parameter==Fill_Parameter(StreamKind, Generic_Format_Commercial_IfAny)) Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Format_Commercial), Value, true); if (!IsSub) { Ztring ParameterName=Retrieve(StreamKind, StreamPos, Parameter, Info_Name); //Lists if (StreamKind!=Stream_General && (ParameterName==__T("Codec/String") || ParameterName==__T("Language/String") || ParameterName==__T("Format") || ParameterName==__T("CodecID/Hint"))) { Ztring Temp1, Temp2; for (size_t StreamPos_Local=0; StreamPos_Local<(*Stream)[StreamKind].size(); StreamPos_Local++) { if (ParameterName==__T("CodecID/Hint")) Temp1+=Retrieve(StreamKind, StreamPos_Local, Fill_Parameter(StreamKind, Generic_Format))+__T(" / "); else Temp1+=Retrieve(StreamKind, StreamPos_Local, Parameter)+__T(" / "); if (ParameterName==__T("Format") || ParameterName==__T("CodecID/Hint")) { Temp2+=Retrieve(StreamKind, StreamPos_Local, Fill_Parameter(StreamKind, Generic_Format)); if (!Retrieve(StreamKind, StreamPos_Local, Fill_Parameter(StreamKind, Generic_CodecID_Hint)).empty()) { Temp2+=__T(" ("); Temp2+=Retrieve(StreamKind, StreamPos_Local, Fill_Parameter(StreamKind, Generic_CodecID_Hint)); Temp2+=__T(")"); } Temp2+=__T(" / "); } } if (!Temp1.empty()) Temp1.resize(Temp1.size()-3); //Delete extra " / " if (!Temp2.empty()) Temp2.resize(Temp2.size()-3); //Delete extra " / " Ztring StreamKind_Text=Get(StreamKind, 0, General_StreamKind, Info_Text); if (ParameterName==__T("Codec/String")) Fill(Stream_General, 0, Ztring(StreamKind_Text+__T("_Codec_List")).To_Local().c_str(), Temp1, true); if (ParameterName==__T("Language/String")) Fill(Stream_General, 0, Ztring(StreamKind_Text+__T("_Language_List")).To_Local().c_str(), Temp1, true); if (ParameterName==__T("Format") || ParameterName==__T("CodecID/Hint")) { Fill(Stream_General, 0, Ztring(StreamKind_Text+__T("_Format_List")).To_Local().c_str(), Temp1, true); Fill(Stream_General, 0, Ztring(StreamKind_Text+__T("_Format_WithHint_List")).To_Local().c_str(), Temp2, true); } } //Human readable if (MediaInfoLib::Config.ReadByHuman_Get()) { //Strings const Ztring &List_Measure_Value=MediaInfoLib::Config.Info_Get(StreamKind).Read(Parameter, Info_Measure); if (List_Measure_Value==__T(" byte")) FileSize_FileSize123(StreamKind, StreamPos, Parameter); else if (List_Measure_Value==__T(" bps") || List_Measure_Value==__T(" Hz")) Kilo_Kilo123(StreamKind, StreamPos, Parameter); else if (List_Measure_Value==__T(" ms")) Duration_Duration123(StreamKind, StreamPos, Parameter); else if (List_Measure_Value==__T("Yes")) YesNo_YesNo(StreamKind, StreamPos, Parameter); else Value_Value123(StreamKind, StreamPos, Parameter); //BitRate_Mode / OverallBitRate_Mode if (ParameterName==(StreamKind==Stream_General?__T("OverallBitRate_Mode"):__T("BitRate_Mode")) && MediaInfoLib::Config.ReadByHuman_Get()) { Clear(StreamKind, StreamPos, StreamKind==Stream_General?"OverallBitRate_Mode/String":"BitRate_Mode/String"); ZtringList List; List.Separator_Set(0, __T(" / ")); List.Write(Retrieve(StreamKind, StreamPos, Parameter)); //Per value for (size_t Pos=0; PosBitRate*0.95 && BitRate_NominalBitRate_Maximum*0.99 && BitRate=1) { Language_Orig=Languages[Pos][0]; Languages[Pos][0].MakeLowerCase(); if ((Languages[Pos][0].size()==3 && (Languages[Pos][0]==__T("mis") || Languages[Pos][0]==__T("und") || Languages[Pos][0]==__T("???") || Languages[Pos][0]==__T(" "))) || (Languages[Pos][0].size()==2 && Languages[Pos][0]==__T(" "))) Languages[Pos].clear(); } //Finding ISO-639-1 from ISO-639-2 or translated name if (Languages[Pos].size()>=1) { if (Languages[Pos][0].size()==3 && !MediaInfoLib::Config.Iso639_1_Get(Languages[Pos][0]).empty()) Languages[Pos][0]=MediaInfoLib::Config.Iso639_1_Get(Languages[Pos][0]); if (Languages[Pos][0].size()>3 && !MediaInfoLib::Config.Iso639_Find(Languages[Pos][0]).empty()) Languages[Pos][0]=MediaInfoLib::Config.Iso639_Find(Languages[Pos][0]); if (Languages[Pos][0].size()>3) Languages[Pos][0]=Language_Orig; //We failed to detect language, using the original version } } if (Languages.Read()!=Retrieve(StreamKind, StreamPos, Parameter)) Fill(StreamKind, StreamPos, Parameter, Languages.Read(), true); else { ZtringList Language1; Language1.Separator_Set(0, __T(" / ")); ZtringList Language2; Language2.Separator_Set(0, __T(" / ")); ZtringList Language3; Language3.Separator_Set(0, __T(" / ")); ZtringList Language4; Language4.Separator_Set(0, __T(" / ")); for (size_t Pos=0; Pos=1) { Ztring Language_Translated=MediaInfoLib::Config.Language_Get(__T("Language_")+Languages[Pos][0]); if (Language_Translated.find(__T("Language_"))==0) Language_Translated=Languages[Pos][0]; //No translation found if (Languages[Pos].size()>=2) { if (Languages[Pos].size()==2 && Languages[Pos][0].size()>=2 && Languages[Pos][0].size()<=3 && (Languages[Pos][1][0]&0xDF)>=__T('A') && (Languages[Pos][1][0]&0xDF)<=__T('Z') && (Languages[Pos][1][1]&0xDF)>=__T('A') && (Languages[Pos][1][1]&0xDF)<=__T('Z')) { Language_Translated+=__T(" ("); Language_Translated+=Ztring(Languages[Pos][1]).MakeUpperCase(); Language_Translated+=__T(")"); } else for (size_t Pos2=1; Pos2FrameRate*0.995 && FrameRate_Nominal=(float)1.23 && F1<(float)1.27) C1=__T("5:4"); else if (F1>=(float)1.30 && F1<(float)1.37) C1=__T("4:3"); else if (F1>=(float)1.45 && F1<(float)1.55) C1=__T("3:2"); else if (F1>=(float)1.55 && F1<(float)1.65) C1=__T("16:10"); else if (F1>=(float)1.74 && F1<(float)1.82) C1=__T("16:9"); else if (F1>=(float)1.82 && F1<(float)1.88) C1=__T("1.85:1"); else if (F1>=(float)2.15 && F1<(float)2.22) C1=__T("2.2:1"); else if (F1>=(float)2.23 && F1<(float)2.30) C1=__T("2.25:1"); else if (F1>=(float)2.30 && F1<(float)2.37) C1=__T("2.35:1"); else if (F1>=(float)2.37 && F1<(float)2.45) C1=__T("2.40:1"); else C1.From_Number(F1); C1.FindAndReplace(__T("."), MediaInfoLib::Config.Language_Get(__T(" Config_Text_FloatSeparator"))); if (MediaInfoLib::Config.Language_Get(__T(" Language_ISO639"))==__T("fr") && C1.find(__T(":1"))==string::npos) C1.FindAndReplace(__T(":"), __T("/")); Fill(Stream_Video, StreamPos, Video_DisplayAspectRatio_String, C1, true); } //Original Display Aspect Ratio and Original Pixel Aspect Ratio if (StreamKind==Stream_Video && Parameter==Video_DisplayAspectRatio_Original) { float F1=Retrieve(Stream_Video, StreamPos, Video_DisplayAspectRatio_Original).To_float32(); Ztring C1; if (F1>=(float)1.23 && F1<(float)1.27) C1=__T("5:4"); else if (F1>=(float)1.30 && F1<(float)1.37) C1=__T("4:3"); else if (F1>=(float)1.45 && F1<(float)1.55) C1=__T("3:2"); else if (F1>=(float)1.55 && F1<(float)1.65) C1=__T("16:10"); else if (F1>=(float)1.74 && F1<(float)1.82) C1=__T("16:9"); else if (F1>=(float)1.82 && F1<(float)1.88) C1=__T("1.85:1"); else if (F1>=(float)2.15 && F1<(float)2.22) C1=__T("2.2:1"); else if (F1>=(float)2.23 && F1<(float)2.30) C1=__T("2.25:1"); else if (F1>=(float)2.30 && F1<(float)2.37) C1=__T("2.35:1"); else if (F1>=(float)2.37 && F1<(float)2.45) C1=__T("2.40:1"); else C1.From_Number(F1); C1.FindAndReplace(__T("."), MediaInfoLib::Config.Language_Get(__T(" Config_Text_FloatSeparator"))); if (MediaInfoLib::Config.Language_Get(__T(" Language_ISO639"))==__T("fr") && C1.find(__T(":1"))==string::npos) C1.FindAndReplace(__T(":"), __T("/")); Fill(Stream_Video, StreamPos, Video_DisplayAspectRatio_Original_String, C1, true); } //Display Aspect Ratio and Pixel Aspect Ratio if (StreamKind==Stream_Image && Parameter==Image_DisplayAspectRatio && !Value.empty()) { float F1=Retrieve(Stream_Image, StreamPos, Image_DisplayAspectRatio).To_float32(); Ztring C1; if (F1>=(float)1.23 && F1<(float)1.27) C1=__T("5:4"); else if (F1>=(float)1.30 && F1<(float)1.37) C1=__T("4:3"); else if (F1>=(float)1.45 && F1<(float)1.55) C1=__T("3:2"); else if (F1>=(float)1.55 && F1<(float)1.65) C1=__T("16:10"); else if (F1>=(float)1.74 && F1<(float)1.82) C1=__T("16:9"); else if (F1>=(float)1.82 && F1<(float)1.88) C1=__T("1.85:1"); else if (F1>=(float)2.15 && F1<(float)2.22) C1=__T("2.2:1"); else if (F1>=(float)2.23 && F1<(float)2.30) C1=__T("2.25:1"); else if (F1>=(float)2.30 && F1<(float)2.37) C1=__T("2.35:1"); else if (F1>=(float)2.37 && F1<(float)2.45) C1=__T("2.40:1"); else C1.From_Number(F1); C1.FindAndReplace(__T("."), MediaInfoLib::Config.Language_Get(__T(" Config_Text_FloatSeparator"))); if (MediaInfoLib::Config.Language_Get(__T(" Language_ISO639"))==__T("fr") && C1.find(__T(":1"))==string::npos) C1.FindAndReplace(__T(":"), __T("/")); Fill(Stream_Image, StreamPos, Image_DisplayAspectRatio_String, C1, true); } //Original Display Aspect Ratio and Original Pixel Aspect Ratio if (StreamKind==Stream_Image && Parameter==Image_DisplayAspectRatio_Original) { float F1=Retrieve(Stream_Image, StreamPos, Image_DisplayAspectRatio_Original).To_float32(); Ztring C1; if (F1>=(float)1.23 && F1<(float)1.27) C1=__T("5:4"); else if (F1>=(float)1.30 && F1<(float)1.37) C1=__T("4:3"); else if (F1>=(float)1.45 && F1<(float)1.55) C1=__T("3:2"); else if (F1>=(float)1.55 && F1<(float)1.65) C1=__T("16:10"); else if (F1>=(float)1.74 && F1<(float)1.82) C1=__T("16:9"); else if (F1>=(float)1.82 && F1<(float)1.88) C1=__T("1.85:1"); else if (F1>=(float)2.15 && F1<(float)2.22) C1=__T("2.2:1"); else if (F1>=(float)2.23 && F1<(float)2.30) C1=__T("2.25:1"); else if (F1>=(float)2.30 && F1<(float)2.37) C1=__T("2.35:1"); else if (F1>=(float)2.37 && F1<(float)2.45) C1=__T("2.40:1"); else C1.From_Number(F1); C1.FindAndReplace(__T("."), MediaInfoLib::Config.Language_Get(__T(" Config_Text_FloatSeparator"))); if (MediaInfoLib::Config.Language_Get(__T(" Language_ISO639"))==__T("fr") && C1.find(__T(":1"))==string::npos) C1.FindAndReplace(__T(":"), __T("/")); Fill(Stream_Image, StreamPos, Image_DisplayAspectRatio_Original_String, C1, true); } //Bits/(Pixel*Frame) if (StreamKind==Stream_Video && (Parameter==Video_BitRate || Parameter==Video_BitRate_Nominal || Parameter==Video_Width || Parameter==Video_Height || Parameter==Video_FrameRate)) { float32 BitRate=Retrieve(Stream_Video, StreamPos, Video_BitRate).To_float32(); if (BitRate==0) BitRate=Retrieve(Stream_Video, StreamPos, Video_BitRate_Nominal).To_float32(); float F1=(float)Retrieve(Stream_Video, StreamPos, Video_Width).To_int32s()*(float)Retrieve(Stream_Video, StreamPos, Video_Height).To_int32s()*Retrieve(Stream_Video, StreamPos, Video_FrameRate).To_float32(); if (BitRate && F1) Fill(Stream_Video, StreamPos, Video_Bits__Pixel_Frame_, BitRate/F1, 3, true); } //Special audio cases if (StreamKind==Stream_Audio && Parameter==Audio_CodecID && Retrieve(Stream_Audio, StreamPos, Audio_Channel_s_).empty() &&(Value==__T("samr") || Value==__T("sawb") || Value==__T("7A21") || Value==__T("7A22")) ) Fill(Stream_Audio, StreamPos, Audio_Channel_s_, 1, 10, true); //AMR is always with 1 channel //Well known bitrate values if (StreamKind==Stream_Video && (Parameter==Video_BitRate || Parameter==Video_BitRate_Nominal)) Video_BitRate_Rounding(StreamPos, (video)Parameter); if (StreamKind==Stream_Audio && (Parameter==Audio_BitRate || Parameter==Audio_BitRate_Nominal)) Audio_BitRate_Rounding(StreamPos, (audio)Parameter); } } //--------------------------------------------------------------------------- void File__Analyze::Fill (stream_t StreamKind, size_t StreamPos, const char* Parameter, const Ztring &Value, bool Replace) { //Integrity if (!Status[IsAccepted] || StreamKind>Stream_Max || Parameter==NULL || Parameter[0]=='\0') return; //Handling values with \r\n inside if (Value.find(__T('\r'))!=string::npos || Value.find(__T('\n'))!=string::npos) { Ztring NewValue=Value; NewValue.FindAndReplace(__T("\r\n"), __T(" / "), 0, Ztring_Recursive); NewValue.FindAndReplace(__T("\r"), __T(" / "), 0, Ztring_Recursive); NewValue.FindAndReplace(__T("\n"), __T(" / "), 0, Ztring_Recursive); if (NewValue.size()>=3 && NewValue.rfind(__T(" / "))==NewValue.size()-3) NewValue.resize(NewValue.size()-3); Fill(StreamKind, StreamPos, Parameter, NewValue, Replace); return; } //Handle Value before StreamKind if (StreamKind==Stream_Max || StreamPos>=(*Stream)[StreamKind].size()) { Ztring ParameterZ=Ztring().From_UTF8(Parameter); if (Replace) for (size_t Pos=0; Pos remove the line } } else { Ztring &Target=(*Stream_More)[StreamKind][StreamPos](Ztring().From_ISO_8859_1(Parameter), Info_Text); if (Target.empty() || Replace) { Target=Value; //First value (*Stream_More)[StreamKind][StreamPos](Ztring().From_ISO_8859_1(Parameter), Info_Name_Text)=MediaInfoLib::Config.Language_Get(Ztring().From_Local(Parameter)); (*Stream_More)[StreamKind][StreamPos](Ztring().From_ISO_8859_1(Parameter), Info_Options)=__T("Y NT"); } else { Target+=MediaInfoLib::Config.TagSeparator_Get(); Target+=Value; } } Fill(StreamKind, StreamPos, (size_t)General_Count, Count_Get(StreamKind, StreamPos), 10, true); } //--------------------------------------------------------------------------- const Ztring &File__Analyze::Retrieve_Const (stream_t StreamKind, size_t StreamPos, size_t Parameter, info_t KindOfInfo) { //Integrity if (StreamKind>=Stream_Max || StreamPos>=(*Stream)[StreamKind].size() || Parameter>=(*Stream)[StreamKind][StreamPos].size()) return MediaInfoLib::Config.EmptyString_Get(); if (KindOfInfo!=Info_Text) return MediaInfoLib::Config.Info_Get(StreamKind, Parameter, KindOfInfo); return (*Stream)[StreamKind][StreamPos](Parameter); } //--------------------------------------------------------------------------- Ztring File__Analyze::Retrieve (stream_t StreamKind, size_t StreamPos, size_t Parameter, info_t KindOfInfo) { //Integrity if (StreamKind>=Stream_Max || StreamPos>=(*Stream)[StreamKind].size() || Parameter>=(*Stream)[StreamKind][StreamPos].size()) return MediaInfoLib::Config.EmptyString_Get(); if (KindOfInfo!=Info_Text) return MediaInfoLib::Config.Info_Get(StreamKind, Parameter, KindOfInfo); return (*Stream)[StreamKind][StreamPos](Parameter); } //--------------------------------------------------------------------------- const Ztring &File__Analyze::Retrieve_Const (stream_t StreamKind, size_t StreamPos, const char* Parameter, info_t KindOfInfo) { //Integrity if (StreamKind>=Stream_Max || StreamPos>=(*Stream)[StreamKind].size() || Parameter==NULL || Parameter[0]=='\0') return MediaInfoLib::Config.EmptyString_Get(); if (KindOfInfo!=Info_Text) return MediaInfoLib::Config.Info_Get(StreamKind, Parameter, KindOfInfo); size_t Parameter_Pos=MediaInfoLib::Config.Info_Get(StreamKind).Find(Ztring().From_Local(Parameter)); if (Parameter_Pos==Error) { Parameter_Pos=(*Stream_More)[StreamKind][StreamPos].Find(Ztring().From_Local(Parameter)); if (Parameter_Pos==Error) return MediaInfoLib::Config.EmptyString_Get(); return (*Stream_More)[StreamKind][StreamPos](Parameter_Pos, 1); } return (*Stream)[StreamKind][StreamPos](Parameter_Pos); } //--------------------------------------------------------------------------- Ztring File__Analyze::Retrieve (stream_t StreamKind, size_t StreamPos, const char* Parameter, info_t KindOfInfo) { //Integrity if (StreamKind>=Stream_Max || StreamPos>=(*Stream)[StreamKind].size() || Parameter==NULL || Parameter[0]=='\0') return MediaInfoLib::Config.EmptyString_Get(); if (KindOfInfo!=Info_Text) return MediaInfoLib::Config.Info_Get(StreamKind, Parameter, KindOfInfo); size_t Parameter_Pos=MediaInfoLib::Config.Info_Get(StreamKind).Find(Ztring().From_Local(Parameter)); if (Parameter_Pos==Error) { Parameter_Pos=(*Stream_More)[StreamKind][StreamPos].Find(Ztring().From_Local(Parameter)); if (Parameter_Pos==Error) return MediaInfoLib::Config.EmptyString_Get(); return (*Stream_More)[StreamKind][StreamPos](Parameter_Pos, 1); } return (*Stream)[StreamKind][StreamPos](Parameter_Pos); } //--------------------------------------------------------------------------- void File__Analyze::Clear (stream_t StreamKind, size_t StreamPos, const char* Parameter) { //Integrity if (StreamKind>=Stream_Max || Parameter==NULL || Parameter[0]=='\0') return; if (StreamPos>=(*Stream)[StreamKind].size()) { size_t Pos=Fill_Temp.Find(Ztring().From_UTF8(Parameter)); if (Pos!=string::npos) Fill_Temp.erase(Fill_Temp.begin()+Pos); return; } size_t Parameter_Pos=MediaInfoLib::Config.Info_Get(StreamKind).Find(Ztring().From_Local(Parameter)); if (Parameter_Pos==Error) { Parameter_Pos=(*Stream_More)[StreamKind][StreamPos].Find(Ztring().From_Local(Parameter)); if (Parameter_Pos==Error) return; (*Stream_More)[StreamKind][StreamPos](Parameter_Pos, 1).clear(); return; } Clear(StreamKind, StreamPos, Parameter_Pos); } //--------------------------------------------------------------------------- void File__Analyze::Clear (stream_t StreamKind, size_t StreamPos, size_t Parameter) { //Integrity if (StreamKind>=Stream_Max || StreamPos>=(*Stream)[StreamKind].size()) return; //Normal if (Parameter=(*Stream)[StreamKind][StreamPos].size()) return; //Was never filled, no nead to clear it //Clearing (*Stream)[StreamKind][StreamPos][Parameter].clear(); //Human readable if (MediaInfoLib::Config.ReadByHuman_Get()) { //Strings const Ztring &List_Measure_Value=MediaInfoLib::Config.Info_Get(StreamKind).Read(Parameter, Info_Measure); if (List_Measure_Value==__T(" byte")) { const Ztring &Temp=MediaInfoLib::Config.Info_Get(StreamKind).Read(Parameter, Info_Name); size_t List_Size=Temp.find(__T("StreamSize"))==string::npos?5:7; //for /String5, with percentage, and proportion for (size_t Pos=Parameter+1; Pos<=Parameter+List_Size; Pos++) if (Pos<(*Stream)[StreamKind][StreamPos].size()) (*Stream)[StreamKind][StreamPos][Pos].clear(); } else if (List_Measure_Value==__T(" bps") || List_Measure_Value==__T(" Hz")) { if (Parameter+1<(*Stream)[StreamKind][StreamPos].size()) (*Stream)[StreamKind][StreamPos][Parameter+1].clear(); } else if (List_Measure_Value==__T(" ms")) { for (size_t Pos=Parameter+1; Pos<=Parameter+4; Pos++) if (Pos<(*Stream)[StreamKind][StreamPos].size()) (*Stream)[StreamKind][StreamPos][Pos].clear(); } else if (List_Measure_Value==__T("Yes")) { if (Parameter+1<(*Stream)[StreamKind][StreamPos].size()) (*Stream)[StreamKind][StreamPos][Parameter+1].clear(); } else if (!List_Measure_Value.empty()) { if (Parameter+1<(*Stream)[StreamKind][StreamPos].size()) (*Stream)[StreamKind][StreamPos][Parameter+1].clear(); } else if (Parameter+1<(*Stream)[StreamKind][StreamPos].size() && MediaInfoLib::Config.Info_Get(StreamKind).Read(Parameter+1, Info_Name).find(__T("/String"))!=string::npos) { (*Stream)[StreamKind][StreamPos][Parameter+1].clear(); } } return; } //More Parameter-=(*Stream)[StreamKind][StreamPos].size(); //For having Stream_More position if (Parameter<(*Stream_More)[StreamKind][StreamPos].size()) { (*Stream_More)[StreamKind][StreamPos].erase((*Stream_More)[StreamKind][StreamPos].begin()+Parameter); return; } } //--------------------------------------------------------------------------- void File__Analyze::Clear (stream_t StreamKind, size_t StreamPos) { //Integrity if (StreamKind>=Stream_Max || StreamPos>=(*Stream)[StreamKind].size()) return; (*Stream)[StreamKind].erase((*Stream)[StreamKind].begin()+StreamPos); } //--------------------------------------------------------------------------- void File__Analyze::Clear (stream_t StreamKind) { //Integrity if (StreamKind>=Stream_Max) return; (*Stream)[StreamKind].clear(); } //--------------------------------------------------------------------------- void File__Analyze::Fill_Flush() { Stream_Prepare(Stream_Max); //clear filling Fill_Temp.clear(); } //--------------------------------------------------------------------------- size_t File__Analyze::Merge(MediaInfo_Internal &ToAdd, bool) { size_t Count=0; for (size_t StreamKind=(size_t)Stream_General; StreamKind<(size_t)Stream_Max; StreamKind++) { size_t StreamPos_Count=ToAdd.Count_Get((stream_t)StreamKind); for (size_t StreamPos=0; StreamPos=Count_Get((stream_t)StreamKind)) Stream_Prepare((stream_t)StreamKind); //Merge size_t Pos_Count=ToAdd.Count_Get((stream_t)StreamKind, StreamPos); for (size_t Pos=0; Pos=Stream_Max || !ToAdd.Stream || StreamPos_From>=(*ToAdd.Stream)[StreamKind].size()) return 0; //Destination while (StreamPos_To>=(*Stream)[StreamKind].size()) Stream_Prepare(StreamKind); //Specific stuff Ztring Width_Temp, Height_Temp, PixelAspectRatio_Temp, DisplayAspectRatio_Temp, FrameRate_Temp, FrameRate_Mode_Temp, ScanType_Temp, ScanOrder_Temp, Channels_Temp, Delay_Temp, Delay_DropFrame_Temp, Delay_Source_Temp, Delay_Settings_Temp, Source_Temp, Source_Kind_Temp, Source_Info_Temp; Ztring colour_description_present_Temp, colour_primaries_Temp, transfer_characteristics_Temp, matrix_coefficients_Temp; if (StreamKind==Stream_Video) { Width_Temp=Retrieve(Stream_Video, StreamPos_To, Video_Width); Height_Temp=Retrieve(Stream_Video, StreamPos_To, Video_Height); PixelAspectRatio_Temp=Retrieve(Stream_Video, StreamPos_To, Video_PixelAspectRatio); //We want to keep the PixelAspectRatio_Temp of the video stream DisplayAspectRatio_Temp=Retrieve(Stream_Video, StreamPos_To, Video_DisplayAspectRatio); //We want to keep the DisplayAspectRatio_Temp of the video stream FrameRate_Temp=Retrieve(Stream_Video, StreamPos_To, Video_FrameRate); //We want to keep the FrameRate of AVI 120 fps FrameRate_Mode_Temp=Retrieve(Stream_Video, StreamPos_To, Video_FrameRate_Mode); //We want to keep the FrameRate_Mode of AVI 120 fps ScanType_Temp=Retrieve(Stream_Video, StreamPos_To, Video_ScanType); ScanOrder_Temp=Retrieve(Stream_Video, StreamPos_To, Video_ScanOrder); colour_description_present_Temp=Retrieve(Stream_Video, StreamPos_To, Video_colour_description_present); if (!colour_description_present_Temp.empty()) { colour_primaries_Temp=Retrieve(Stream_Video, StreamPos_To, Video_colour_primaries); transfer_characteristics_Temp=Retrieve(Stream_Video, StreamPos_To, Video_transfer_characteristics); matrix_coefficients_Temp=Retrieve(Stream_Video, StreamPos_To, Video_matrix_coefficients); } Clear(Stream_Video, StreamPos_To, Video_colour_description_present); Clear(Stream_Video, StreamPos_To, Video_colour_primaries); Clear(Stream_Video, StreamPos_To, Video_transfer_characteristics); Clear(Stream_Video, StreamPos_To, Video_matrix_coefficients); } if (StreamKind==Stream_Audio) { Channels_Temp=Retrieve(Stream_Audio, StreamPos_To, Audio_Channel_s_); } if (ToAdd.Retrieve(StreamKind, StreamPos_From, Fill_Parameter(StreamKind, Generic_Delay_Source))==__T("Container")) { Fill(StreamKind, StreamPos_To, "Delay_Original", Retrieve(StreamKind, StreamPos_To, "Delay"), true); Clear(StreamKind, StreamPos_To, "Delay"); Fill(StreamKind, StreamPos_To, "Delay_Original_DropFrame", Retrieve(StreamKind, StreamPos_To, "Delay_DropFrame"), true); Clear(StreamKind, StreamPos_To, "Delay_DropFrame"); Fill(StreamKind, StreamPos_To, "Delay_Original_Source", Retrieve(StreamKind, StreamPos_To, "Delay_Source"), true); Clear(StreamKind, StreamPos_To, "Delay_Source"); if (!ToAdd.Retrieve(StreamKind, StreamPos_To, "Format").empty()) //Exception: MPEG-4 TimeCode, settings are in the MPEG-4 header { Fill(StreamKind, StreamPos_To, "Delay_Original_Settings", Retrieve(StreamKind, StreamPos_To, "Delay_Settings"), true); Clear(StreamKind, StreamPos_To, "Delay_Settings"); } } else { Delay_Temp=Retrieve(StreamKind, StreamPos_To, "Delay"); //We want to keep the Delay from the stream Delay_Settings_Temp=Retrieve(StreamKind, StreamPos_To, "Delay_Settings"); //We want to keep the Delay_Settings from the stream Delay_DropFrame_Temp=Retrieve(StreamKind, StreamPos_To, "Delay_DropFrame"); //We want to keep the Delay_Source from the stream Delay_Source_Temp=Retrieve(StreamKind, StreamPos_To, "Delay_Source"); //We want to keep the Delay_Source from the stream } Source_Temp=Retrieve(StreamKind, StreamPos_To, "Source"); Source_Kind_Temp=Retrieve(StreamKind, StreamPos_To, "Source_Kind"); Source_Info_Temp=Retrieve(StreamKind, StreamPos_To, "Source_Info"); //Merging size_t Count=0; size_t Size=ToAdd.Count_Get(StreamKind, StreamPos_From); for (size_t Pos=General_Inform; Pos 9.990 && FrameRate<=10.010) FrameRate=10.000; else if (FrameRate>14.990 && FrameRate<=15.010) FrameRate=15.000; else if (FrameRate>23.952 && FrameRate<=23.988) FrameRate=23.976; else if (FrameRate>23.988 && FrameRate<=24.024) FrameRate=24.000; else if (FrameRate>24.975 && FrameRate<=25.025) FrameRate=25.000; else if (FrameRate>29.940 && FrameRate<=29.985) FrameRate=29.970; else if (FrameRate>29.970 && FrameRate<=30.030) FrameRate=30.000; else if (FrameRate>23.952*2 && FrameRate<=23.988*2) FrameRate=23.976*2; else if (FrameRate>23.988*2 && FrameRate<=24.024*2) FrameRate=24.000*2; else if (FrameRate>24.975*2 && FrameRate<=25.025*2) FrameRate=25.000*2; else if (FrameRate>29.940*2 && FrameRate<=29.985*2) FrameRate=29.970*2; else if (FrameRate>29.970*2 && FrameRate<=30.030*2) FrameRate=30.000*2; if (FrameRate!=FrameRate_Sav) Fill(Stream_Video, Pos, Parameter, FrameRate, 3, true); } //--------------------------------------------------------------------------- void File__Analyze::Video_BitRate_Rounding(size_t Pos, video Parameter) { const Ztring& Format=Retrieve(Stream_Video, Pos, Video_Format); int32u BitRate=Retrieve(Stream_Video, Pos, Parameter).To_int32u(); int32u BitRate_Sav=BitRate; if (Format==__T("AVC")) { if (BitRate>= 54942720 && BitRate<= 57185280) BitRate= 56064000; //AVC-INTRA50 if (BitRate>=111390720 && BitRate<=115937280) BitRate=113664000; //AVC-INTRA100 } if (BitRate!=BitRate_Sav) Fill(Stream_Video, Pos, Parameter, BitRate, 0, true); } //--------------------------------------------------------------------------- void File__Analyze::Audio_BitRate_Rounding(size_t Pos, audio Parameter) { const Ztring& Format=Retrieve(Stream_Audio, Pos, Audio_Format); const Ztring& Codec=Retrieve(Stream_Audio, Pos, Audio_Codec); int32u BitRate=Retrieve(Stream_Audio, Pos, Parameter).To_int32u(); int32u BitRate_Sav=BitRate; if (MediaInfoLib::Config.Codec_Get(Codec, InfoCodec_KindofCodec, Stream_Audio).find(__T("MPEG-"))==0 || Retrieve(Stream_Audio, Pos, Audio_Codec_String).find(__T("MPEG-"))==0) { if (BitRate>= 7500 && BitRate<= 8500) BitRate= 8000; if (BitRate>= 15000 && BitRate<= 17000) BitRate= 16000; if (BitRate>= 23000 && BitRate<= 25000) BitRate= 24000; if (BitRate>= 31000 && BitRate<= 33000) BitRate= 32000; if (BitRate>= 38000 && BitRate<= 42000) BitRate= 40000; if (BitRate>= 46000 && BitRate<= 50000) BitRate= 48000; if (BitRate>= 54000 && BitRate<= 58000) BitRate= 56000; if (BitRate>= 62720 && BitRate<= 65280) BitRate= 64000; if (BitRate>= 78400 && BitRate<= 81600) BitRate= 80000; if (BitRate>= 94080 && BitRate<= 97920) BitRate= 96000; if (BitRate>= 109760 && BitRate<= 114240) BitRate= 112000; if (BitRate>= 125440 && BitRate<= 130560) BitRate= 128000; if (BitRate>= 156800 && BitRate<= 163200) BitRate= 160000; if (BitRate>= 156800 && BitRate<= 163200) BitRate= 160000; if (BitRate>= 188160 && BitRate<= 195840) BitRate= 192000; if (BitRate>= 219520 && BitRate<= 228480) BitRate= 224000; if (BitRate>= 219520 && BitRate<= 228480) BitRate= 224000; if (BitRate>= 250880 && BitRate<= 261120) BitRate= 256000; if (BitRate>= 282240 && BitRate<= 293760) BitRate= 288000; if (BitRate>= 313600 && BitRate<= 326400) BitRate= 320000; if (BitRate>= 344960 && BitRate<= 359040) BitRate= 352000; if (BitRate>= 376320 && BitRate<= 391680) BitRate= 384000; if (BitRate>= 407680 && BitRate<= 424320) BitRate= 416000; if (BitRate>= 439040 && BitRate<= 456960) BitRate= 448000; if (Retrieve(Stream_Audio, Pos, "BitRate_Mode")==__T("VBR")) BitRate=BitRate_Sav; //If VBR, we want the exact value } else if (MediaInfoLib::Config.Codec_Get(Codec, InfoCodec_Name, Stream_Audio).find(__T("AC3"))==0) { if (BitRate>= 31000 && BitRate<= 33000) BitRate= 32000; if (BitRate>= 39000 && BitRate<= 41000) BitRate= 40000; if (BitRate>= 46000 && BitRate<= 50000) BitRate= 48000; if (BitRate>= 54000 && BitRate<= 58000) BitRate= 56000; if (BitRate>= 62720 && BitRate<= 65280) BitRate= 64000; if (BitRate>= 78400 && BitRate<= 81600) BitRate= 80000; if (BitRate>= 94080 && BitRate<= 97920) BitRate= 96000; if (BitRate>= 109760 && BitRate<= 114240) BitRate= 112000; if (BitRate>= 125440 && BitRate<= 130560) BitRate= 128000; if (BitRate>= 156800 && BitRate<= 163200) BitRate= 160000; if (BitRate>= 188160 && BitRate<= 195840) BitRate= 192000; if (BitRate>= 219520 && BitRate<= 228480) BitRate= 224000; if (BitRate>= 250880 && BitRate<= 261120) BitRate= 256000; if (BitRate>= 313600 && BitRate<= 326400) BitRate= 320000; if (BitRate>= 376320 && BitRate<= 391680) BitRate= 384000; if (BitRate>= 439040 && BitRate<= 456960) BitRate= 448000; if (BitRate>= 501760 && BitRate<= 522240) BitRate= 512000; if (BitRate>= 564480 && BitRate<= 587520) BitRate= 576000; if (BitRate>= 627200 && BitRate<= 652800) BitRate= 640000; } else if (MediaInfoLib::Config.Codec_Get(Codec, InfoCodec_Name, Stream_Audio).find(__T("DTS"))==0) { if (BitRate>= 31000 && BitRate<= 33000) BitRate= 32000; if (BitRate>= 54000 && BitRate<= 58000) BitRate= 56000; if (BitRate>= 62720 && BitRate<= 65280) BitRate= 64000; if (BitRate>= 94080 && BitRate<= 97920) BitRate= 96000; if (BitRate>= 109760 && BitRate<= 114240) BitRate= 112000; if (BitRate>= 125440 && BitRate<= 130560) BitRate= 128000; if (BitRate>= 188160 && BitRate<= 195840) BitRate= 192000; if (BitRate>= 219520 && BitRate<= 228480) BitRate= 224000; if (BitRate>= 250880 && BitRate<= 261120) BitRate= 256000; if (BitRate>= 313600 && BitRate<= 326400) BitRate= 320000; if (BitRate>= 376320 && BitRate<= 391680) BitRate= 384000; if (BitRate>= 439040 && BitRate<= 456960) BitRate= 448000; if (BitRate>= 501760 && BitRate<= 522240) BitRate= 512000; if (BitRate>= 564480 && BitRate<= 587520) BitRate= 576000; if (BitRate>= 627200 && BitRate<= 652800) BitRate= 640000; if (BitRate>= 752640 && BitRate<= 783360) BitRate= 768000; if (BitRate>= 940800 && BitRate<= 979200) BitRate= 960000; if (BitRate>=1003520 && BitRate<=1044480) BitRate=1024000; if (BitRate>=1128960 && BitRate<=1175040) BitRate=1152000; if (BitRate>=1254400 && BitRate<=1305600) BitRate=1280000; if (BitRate>=1317120 && BitRate<=1370880) BitRate=1344000; if (BitRate>=1379840 && BitRate<=1436160) BitRate=1408000; if (BitRate>=1382976 && BitRate<=1439424) BitRate=1411200; if (BitRate>=1442560 && BitRate<=1501440) BitRate=1472000; if (BitRate>=1505280 && BitRate<=1566720) BitRate=1536000; if (BitRate>=1881600 && BitRate<=1958400) BitRate=1920000; if (BitRate>=2007040 && BitRate<=2088960) BitRate=2048000; if (BitRate>=3010560 && BitRate<=3133440) BitRate=3072000; if (BitRate>=3763200 && BitRate<=3916800) BitRate=3840000; } else if (Codec.find(__T("AAC"))==0 || MediaInfoLib::Config.Codec_Get(Codec, InfoCodec_Name, Stream_Audio).find(__T("AAC"))==0) { if (BitRate>= 46000 && BitRate<= 50000) BitRate= 48000; if (BitRate>= 64827 && BitRate<= 67473) BitRate= 66150; if (BitRate>= 70560 && BitRate<= 73440) BitRate= 72000; if (BitRate>= 94080 && BitRate<= 97920) BitRate= 96000; if (BitRate>= 94080 && BitRate<= 97920) BitRate= 96000; if (BitRate>= 129654 && BitRate<= 134946) BitRate= 132300; if (BitRate>= 141120 && BitRate<= 146880) BitRate= 144000; if (BitRate>= 188160 && BitRate<= 195840) BitRate= 192000; if (BitRate>= 259308 && BitRate<= 269892) BitRate= 264600; if (BitRate>= 282240 && BitRate<= 293760) BitRate= 288000; if (BitRate>= 345744 && BitRate<= 359856) BitRate= 352800; if (BitRate>= 376320 && BitRate<= 391680) BitRate= 384000; if (BitRate>= 518616 && BitRate<= 539784) BitRate= 529200; if (BitRate>= 564480 && BitRate<= 587520) BitRate= 576000; if (BitRate>= 648270 && BitRate<= 674730) BitRate= 661500; } else if (Codec==__T("PCM") || Codec==__T("QDM2") || MediaInfoLib::Config.Codec_Get(Codec, InfoCodec_Name, Stream_Audio).find(__T("PCM"))==0) { if (BitRate>= 62720 && BitRate<= 65280) BitRate= 64000; if (BitRate>= 86436 && BitRate<= 89964) BitRate= 88200; if (BitRate>= 125440 && BitRate<= 130560) BitRate= 128000; if (BitRate>= 172872 && BitRate<= 179928) BitRate= 176400; if (BitRate>= 188160 && BitRate<= 195840) BitRate= 192000; if (BitRate>= 250880 && BitRate<= 261120) BitRate= 256000; if (BitRate>= 345744 && BitRate<= 359856) BitRate= 352800; if (BitRate>= 376320 && BitRate<= 391680) BitRate= 384000; if (BitRate>= 501760 && BitRate<= 522240) BitRate= 512000; if (BitRate>= 691488 && BitRate<= 719712) BitRate= 705600; if (BitRate>= 752640 && BitRate<= 783360) BitRate= 768000; if (BitRate>=1003520 && BitRate<=1044480) BitRate=1024000; if (BitRate>=1128960 && BitRate<=1175040) BitRate=1152000; if (BitRate>=1382976 && BitRate<=1439424) BitRate=1411200; if (BitRate>=1505280 && BitRate<=1566720) BitRate=1536000; if (BitRate>=4515840 && BitRate<=4700160) BitRate=4608000; if (BitRate>=6021120 && BitRate<=6266880) BitRate=6144000; } else if (MediaInfoLib::Config.Codec_Get(Codec, InfoCodec_Name, Stream_Audio).find(__T("ADPCM"))==0 || MediaInfoLib::Config.Codec_Get(Codec, InfoCodec_Name, Stream_Audio).find(__T("U-Law"))==0 || MediaInfoLib::Config.Codec_Get(Codec, InfoCodec_KindofCodec, Stream_Audio)==__T("ADPCM") || MediaInfoLib::Config.Codec_Get(Codec, InfoCodec_KindofCodec, Stream_Audio)==__T("U-Law") || Format==__T("ADPCM")) { if (BitRate>= 42000 && BitRate<= 46000) BitRate= 44100; if (BitRate>= 62720 && BitRate<= 65280) BitRate= 64000; if (BitRate>= 86436 && BitRate<= 89964) BitRate= 88200; if (BitRate>= 125440 && BitRate<= 130560) BitRate= 128000; if (BitRate>= 172872 && BitRate<= 179928) BitRate= 176400; if (BitRate>= 188160 && BitRate<= 195840) BitRate= 192000; if (BitRate>= 250880 && BitRate<= 261120) BitRate= 256000; if (BitRate>= 345744 && BitRate<= 359856) BitRate= 352800; if (BitRate>= 376320 && BitRate<= 391680) BitRate= 384000; } if (BitRate!=BitRate_Sav) Fill(Stream_Audio, Pos, Parameter, BitRate, 0, true); } //--------------------------------------------------------------------------- void File__Analyze::Tags() { //Integrity if (!Count_Get(Stream_General)) return; //-Movie/Album if (!Retrieve(Stream_General, 0, General_Title).empty() && Retrieve(Stream_General, 0, General_Movie).empty() && Retrieve(Stream_General, 0, General_Track).empty()) { if (Count_Get(Stream_Video)) Fill(Stream_General, 0, "Movie", Retrieve(Stream_General, 0, General_Title)); else Fill(Stream_General, 0, "Track", Retrieve(Stream_General, 0, General_Title)); } if (!Retrieve(Stream_General, 0, General_Title_More).empty() && Retrieve(Stream_General, 0, General_Movie_More).empty() && Retrieve(Stream_General, 0, General_Track_More).empty()) { if (Count_Get(Stream_Video)) Fill(Stream_General, 0, "Movie/More", Retrieve(Stream_General, 0, General_Title_More)); else Fill(Stream_General, 0, "Track/More", Retrieve(Stream_General, 0, General_Title_More)); } if (!Retrieve(Stream_General, 0, General_Title_Url).empty() && Retrieve(Stream_General, 0, General_Movie_Url).empty() && Retrieve(Stream_General, 0, General_Track_Url).empty()) { if (Count_Get(Stream_Video)) Fill(Stream_General, 0, "Movie/Url", Retrieve(Stream_General, 0, General_Title_Url)); else Fill(Stream_General, 0, "Track/Url", Retrieve(Stream_General, 0, General_Title_Url)); } //-Title if (Retrieve(Stream_General, 0, General_Title).empty() && !Retrieve(Stream_General, 0, General_Movie).empty()) Fill(Stream_General, 0, "Title", Retrieve(Stream_General, 0, General_Movie)); if (Retrieve(Stream_General, 0, General_Title).empty() && !Retrieve(Stream_General, 0, General_Track).empty()) Fill(Stream_General, 0, "Title", Retrieve(Stream_General, 0, General_Track)); if (Retrieve(Stream_General, 0, General_Title_More).empty() && !Retrieve(Stream_General, 0, General_Movie_More).empty()) Fill(Stream_General, 0, "Title/More", Retrieve(Stream_General, 0, General_Movie_More)); if (Retrieve(Stream_General, 0, General_Title_More).empty() && !Retrieve(Stream_General, 0, General_Track_More).empty()) Fill(Stream_General, 0, "Title/More", Retrieve(Stream_General, 0, General_Track_More)); if (Retrieve(Stream_General, 0, General_Title_Url).empty() && !Retrieve(Stream_General, 0, General_Movie_Url).empty()) Fill(Stream_General, 0, "Title/Url", Retrieve(Stream_General, 0, General_Movie_Url)); if (Retrieve(Stream_General, 0, General_Title_Url).empty() && !Retrieve(Stream_General, 0, General_Track_Url).empty()) Fill(Stream_General, 0, "Title/Url", Retrieve(Stream_General, 0, General_Track_Url)); //-Genre if (!Retrieve(Stream_General, 0, General_Genre).empty() && Retrieve(Stream_General, 0, General_Genre).size()<4 && Retrieve(Stream_General, 0, General_Genre)[0]>=__T('0') && Retrieve(Stream_General, 0, General_Genre)[0]<=__T('9')) { Ztring Genre; if (Retrieve(Stream_General, 0, General_Genre).size()==1) Genre=Ztring(__T("Genre_00"))+Retrieve(Stream_General, 0, General_Genre); if (Retrieve(Stream_General, 0, General_Genre).size()==2) Genre=Ztring(__T("Genre_0" ))+Retrieve(Stream_General, 0, General_Genre); if (Retrieve(Stream_General, 0, General_Genre).size()==3) Genre=Ztring(__T("Genre_" ))+Retrieve(Stream_General, 0, General_Genre); Fill(Stream_General, 0, "Genre", MediaInfoLib::Config.Language_Get(Genre), true); } } //*************************************************************************** // Internal Functions //*************************************************************************** //--------------------------------------------------------------------------- //Duration void File__Analyze::Duration_Duration123(stream_t StreamKind, size_t StreamPos, size_t Parameter) { if (Retrieve(StreamKind, StreamPos, Parameter).empty()) return; //Clearing old data Clear(StreamKind, StreamPos, Parameter+1); Clear(StreamKind, StreamPos, Parameter+2); Clear(StreamKind, StreamPos, Parameter+3); Clear(StreamKind, StreamPos, Parameter+4); //Retrieving multiple values ZtringList List; List.Separator_Set(0, __T(" / ")); List.Write(Retrieve(StreamKind, StreamPos, Parameter)); //Per value for (size_t Pos=0; Pos0) { DurationString1+=Ztring::ToZtring(HH)+MediaInfoLib::Config.Language_Get(__T("h")); DurationString2+=Ztring::ToZtring(HH)+MediaInfoLib::Config.Language_Get(__T("h")); if (HH<10) DurationString3+=Ztring(__T("0"))+Ztring::ToZtring(HH)+__T(":"); else DurationString3+=Ztring::ToZtring(HH)+__T(":"); MS-=HH*60*60*1000; } else { DurationString3+=__T("00:"); } //Minutes MM=MS/1000/60; //mn if (MM>0 || HH>0) { if (DurationString1.size()>0) DurationString1+=__T(" "); DurationString1+=Ztring::ToZtring(MM)+MediaInfoLib::Config.Language_Get(__T("mn")); if (DurationString2.size()<5) { if (DurationString2.size()>0) DurationString2+=__T(" "); DurationString2+=Ztring::ToZtring(MM)+MediaInfoLib::Config.Language_Get(__T("mn")); } if (MM<10) DurationString3+=Ztring(__T("0"))+Ztring::ToZtring(MM)+__T(":"); else DurationString3+=Ztring::ToZtring(MM)+__T(":"); MS-=MM*60*1000; } else { DurationString3+=__T("00:"); } //Seconds Sec=MS/1000; //s if (Sec>0 || MM>0 || HH>0) { if (DurationString1.size()>0) DurationString1+=__T(" "); DurationString1+=Ztring::ToZtring(Sec)+MediaInfoLib::Config.Language_Get(__T("s")); if (DurationString2.size()<5) { if (DurationString2.size()>0) DurationString2+=__T(" "); DurationString2+=Ztring::ToZtring(Sec)+MediaInfoLib::Config.Language_Get(__T("s")); } else if (DurationString2.size()==0) DurationString2+=Ztring::ToZtring(Sec)+MediaInfoLib::Config.Language_Get(__T("s")); if (Sec<10) DurationString3+=Ztring(__T("0"))+Ztring::ToZtring(Sec)+__T("."); else DurationString3+=Ztring::ToZtring(Sec)+__T("."); MS-=Sec*1000; } else { DurationString3+=__T("00."); } //Milliseconds if (MS>0 || Sec>0 || MM>0 || HH>0) { if (DurationString1.size()>0) DurationString1+=__T(" "); DurationString1+=Ztring::ToZtring(MS)+MediaInfoLib::Config.Language_Get(__T("ms")); if (DurationString2.size()<5) { if (DurationString2.size()>0) DurationString2+=__T(" "); DurationString2+=Ztring::ToZtring(MS)+MediaInfoLib::Config.Language_Get(__T("ms")); } if (MS<10) DurationString3+=Ztring(__T("00"))+Ztring::ToZtring(MS); else if (MS<100) DurationString3+=Ztring(__T("0"))+Ztring::ToZtring(MS); else DurationString3+=Ztring::ToZtring(MS); } else { DurationString3+=__T("000"); } if (Negative) { DurationString1=Ztring(__T("-"))+DurationString1; DurationString2=Ztring(__T("-"))+DurationString2; DurationString3=Ztring(__T("-"))+DurationString3; } Fill(StreamKind, StreamPos, Parameter+1, DurationString2); // /String Fill(StreamKind, StreamPos, Parameter+2, DurationString1); // /String1 Fill(StreamKind, StreamPos, Parameter+3, DurationString2); // /String2 Fill(StreamKind, StreamPos, Parameter+4, DurationString3); // /String3 } } //--------------------------------------------------------------------------- //FileSize void File__Analyze::FileSize_FileSize123(stream_t StreamKind, size_t StreamPos, size_t Parameter) { if (Retrieve(StreamKind, StreamPos, Parameter).empty()) return; float F1=(float)Retrieve(StreamKind, StreamPos, Parameter).To_int64s(); //Video C++ 6 patch, should be int64u //--Bytes, KiB, MiB or GiB... int32u Pow3=0; while(F1>=1024) { F1/=1024; Pow3++; } //--Count of digits int8u I2, I3, I4; if (F1>=100) { I2=0; I3=0; I4=1; } else if (F1>=10) { I2=0; I3=1; I4=2; } else //if (F1>=1) { I2=1; I3=2; I4=3; } Ztring Measure; bool MeasureIsAlwaysSame; switch (Pow3) { case 0 : Measure=__T(" Byte"); MeasureIsAlwaysSame=false; break; case 1 : Measure=__T(" KiB"); MeasureIsAlwaysSame=true; break; case 2 : Measure=__T(" MiB"); MeasureIsAlwaysSame=true; break; case 3 : Measure=__T(" GiB"); MeasureIsAlwaysSame=true; break; default : Measure=__T(" ?iB"); MeasureIsAlwaysSame=true; } Fill(StreamKind, StreamPos, Parameter+2, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(F1, 0), Measure, MeasureIsAlwaysSame), true); // /String1 Fill(StreamKind, StreamPos, Parameter+3, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(F1, I2), Measure, MeasureIsAlwaysSame), true); // /String2 Fill(StreamKind, StreamPos, Parameter+4, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(F1, I3), Measure, MeasureIsAlwaysSame), true); // /String3 Fill(StreamKind, StreamPos, Parameter+5, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(F1, I4), Measure, MeasureIsAlwaysSame), true); // /String4 float64 F2=(float)Retrieve(StreamKind, StreamPos, Parameter).To_float64(); float64 File_Size_WithReferencedFiles=(float)Retrieve(Stream_General, 0, General_FileSize).To_float64(); if (File_Size_WithReferencedFiles>0 && Parameter==Fill_Parameter(StreamKind, Generic_StreamSize) && F2*100/File_Size_WithReferencedFiles<=100) { Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_StreamSize_Proportion), F2/File_Size_WithReferencedFiles, 5, true); Fill(StreamKind, StreamPos, Parameter+6, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(F1, I3), Measure, MeasureIsAlwaysSame)+__T(" (")+Ztring::ToZtring(F2*100/File_Size_WithReferencedFiles, 0)+__T("%)"), true); // /String5 Fill(StreamKind, StreamPos, Parameter+1, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(F1, I3), Measure, MeasureIsAlwaysSame)+__T(" (")+Ztring::ToZtring(F2*100/File_Size_WithReferencedFiles, 0)+__T("%)"), true); } else if (File_Size_WithReferencedFiles>0 && Parameter==Fill_Parameter(StreamKind, Generic_StreamSize_Encoded) && F2*100/File_Size_WithReferencedFiles<=100) { Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_StreamSize_Encoded_Proportion), F2/File_Size_WithReferencedFiles, 5, true); Fill(StreamKind, StreamPos, Parameter+6, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(F1, I3), Measure, MeasureIsAlwaysSame)+__T(" (")+Ztring::ToZtring(F2*100/File_Size_WithReferencedFiles, 0)+__T("%)"), true); // /String5 Fill(StreamKind, StreamPos, Parameter+1, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(F1, I3), Measure, MeasureIsAlwaysSame)+__T(" (")+Ztring::ToZtring(F2*100/File_Size_WithReferencedFiles, 0)+__T("%)"), true); } else if (File_Size_WithReferencedFiles>0 && Parameter==Fill_Parameter(StreamKind, Generic_Source_StreamSize) && F2*100/File_Size_WithReferencedFiles<=100) { Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Source_StreamSize_Proportion), F2/File_Size_WithReferencedFiles, 5, true); Fill(StreamKind, StreamPos, Parameter+6, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(F1, I3), Measure, MeasureIsAlwaysSame)+__T(" (")+Ztring::ToZtring(F2*100/File_Size_WithReferencedFiles, 0)+__T("%)"), true); // /String5 Fill(StreamKind, StreamPos, Parameter+1, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(F1, I3), Measure, MeasureIsAlwaysSame)+__T(" (")+Ztring::ToZtring(F2*100/File_Size_WithReferencedFiles, 0)+__T("%)"), true); } else if (File_Size_WithReferencedFiles>0 && Parameter==Fill_Parameter(StreamKind, Generic_Source_StreamSize_Encoded) && F2*100/File_Size_WithReferencedFiles<=100) { Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Source_StreamSize_Encoded_Proportion), F2/File_Size_WithReferencedFiles, 5, true); Fill(StreamKind, StreamPos, Parameter+6, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(F1, I3), Measure, MeasureIsAlwaysSame)+__T(" (")+Ztring::ToZtring(F2*100/File_Size_WithReferencedFiles, 0)+__T("%)"), true); // /String5 Fill(StreamKind, StreamPos, Parameter+1, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(F1, I3), Measure, MeasureIsAlwaysSame)+__T(" (")+Ztring::ToZtring(F2*100/File_Size_WithReferencedFiles, 0)+__T("%)"), true); } else Fill(StreamKind, StreamPos, Parameter+1, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(F1, I3), Measure, MeasureIsAlwaysSame), true); } //--------------------------------------------------------------------------- //FileSize void File__Analyze::Kilo_Kilo123(stream_t StreamKind, size_t StreamPos, size_t Parameter) { if (Retrieve(StreamKind, StreamPos, Parameter).empty()) return; //Clearing old data Clear(StreamKind, StreamPos, Parameter+1); //Retrieving multiple values ZtringList List; List.Separator_Set(0, __T(" / ")); List.Write(Retrieve(StreamKind, StreamPos, Parameter)); //Per value for (size_t Pos=0; Pos__T('9'))) { Fill(StreamKind, StreamPos, Parameter+1, MediaInfoLib::Config.Language_Get(List[Pos])); } else { //Well known values Ztring BitRateS; if (StreamKind==Stream_Audio) { if (Parameter==Audio_BitRate && (Retrieve(Stream_Audio, StreamPos, Audio_Format)==__T("PCM") || Retrieve(Stream_Audio, StreamPos, Audio_Format)==__T("ADPCM") || Retrieve(Stream_Audio, StreamPos, Audio_Format)==__T("U-Law") || Retrieve(Stream_Audio, StreamPos, Audio_Format)==__T("Qdesign 1") || Retrieve(Stream_Audio, StreamPos, Audio_Format)==__T("Qdesign 2") || Retrieve(Stream_Audio, StreamPos, Audio_Format)==__T("DTS"))) { if (BitRate== 66150) BitRateS= "66.15"; if (BitRate== 132300) BitRateS= "132.3"; if (BitRate== 176400) BitRateS= "176.4"; if (BitRate== 264600) BitRateS= "264.6"; if (BitRate== 352800) BitRateS= "352.8"; if (BitRate== 529200) BitRateS= "529.2"; if (BitRate== 705600) BitRateS= "705.6"; if (BitRate==1411200) BitRateS="1411.2"; } if (Parameter==Audio_SamplingRate) { if (BitRate== 11024) BitRateS= "11.024"; if (BitRate== 11025) BitRateS= "11.025"; if (BitRate== 22050) BitRateS= "22.05"; if (BitRate== 44100) BitRateS= "44.1"; if (BitRate== 88200) BitRateS= "88.2"; if (BitRate== 176400) BitRateS= "176.4"; if (BitRate== 352800) BitRateS= "352.8"; } } if (!BitRateS.empty()) { Ztring Measure=MediaInfoLib::Config.Info_Get(StreamKind).Read(Parameter, Info_Measure); Measure.insert(1, __T("K")); Fill(StreamKind, StreamPos, Parameter+1, MediaInfoLib::Config.Language_Get(BitRateS, Measure, true)); } else { //Standard if (BitRate>10000000000LL) { Ztring Measure=MediaInfoLib::Config.Info_Get(StreamKind).Read(Parameter, Info_Measure); Measure.insert(1, __T("G")); Fill(StreamKind, StreamPos, Parameter+1, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(((float)BitRate)/1000000000, BitRate>100000000000LL?0:1), Measure, true)); } else if (BitRate>10000000) { Ztring Measure=MediaInfoLib::Config.Info_Get(StreamKind).Read(Parameter, Info_Measure); Measure.insert(1, __T("M")); Fill(StreamKind, StreamPos, Parameter+1, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(((float)BitRate)/1000000, BitRate>100000000?0:1), Measure, true)); } else if (BitRate>10000) { Ztring Measure=MediaInfoLib::Config.Info_Get(StreamKind).Read(Parameter, Info_Measure); Measure.insert(1, __T("K")); Fill(StreamKind, StreamPos, Parameter+1, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(((float)BitRate)/1000, BitRate>100000?0:1), Measure, true)); } else Fill(StreamKind, StreamPos, Parameter+1, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(BitRate), MediaInfoLib::Config.Info_Get(StreamKind).Read(Parameter, Info_Measure), true)); } } } } //--------------------------------------------------------------------------- //Value --> Value with measure void File__Analyze::Value_Value123(stream_t StreamKind, size_t StreamPos, size_t Parameter) { if (Retrieve(StreamKind, StreamPos, Parameter, Info_Measure).empty()) return; //Clearing old data Clear(StreamKind, StreamPos, Parameter+1); //Retrieving multiple values ZtringList List; List.Separator_Set(0, __T(" / ")); List.Write(Retrieve(StreamKind, StreamPos, Parameter)); //Per value for (size_t Pos=0; Pos Yes or No void File__Analyze::YesNo_YesNo(stream_t StreamKind, size_t StreamPos, size_t Parameter) { //Filling Fill(StreamKind, StreamPos, Parameter+1, MediaInfoLib::Config.Language_Get(Retrieve(StreamKind, StreamPos, Parameter)), true); } //--------------------------------------------------------------------------- void File__Analyze::CodecID_Fill(const Ztring &Value, stream_t StreamKind, size_t StreamPos, infocodecid_format_t Format) { Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_CodecID), Value); const Ztring &C1=MediaInfoLib::Config.CodecID_Get(StreamKind, Format, Value, InfoCodecID_Format); Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Format), C1.empty()?Value:C1, true); Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_CodecID_Info), MediaInfoLib::Config.CodecID_Get(StreamKind, Format, Value, InfoCodecID_Description), true); Fill(StreamKind, StreamPos, "CodecID/Hint", MediaInfoLib::Config.CodecID_Get(StreamKind, Format, Value, InfoCodecID_Hint), true); Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_CodecID_Url), MediaInfoLib::Config.CodecID_Get(StreamKind, Format, Value, InfoCodecID_Url), true); Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Format_Version), MediaInfoLib::Config.CodecID_Get(StreamKind, Format, Value, InfoCodecID_Version), true); Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Format_Profile), MediaInfoLib::Config.CodecID_Get(StreamKind, Format, Value, InfoCodecID_Profile), true); Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_ColorSpace), MediaInfoLib::Config.CodecID_Get(StreamKind, Format, Value, InfoCodecID_ColorSpace), true); Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_ChromaSubsampling), MediaInfoLib::Config.CodecID_Get(StreamKind, Format, Value, InfoCodecID_ChromaSubsampling), true); if (Retrieve(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_BitDepth)).empty()) Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_BitDepth), MediaInfoLib::Config.CodecID_Get(StreamKind, Format, Value, InfoCodecID_BitDepth), true); if (Retrieve(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Compression_Mode)).empty()) Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Compression_Mode), MediaInfoLib::Config.CodecID_Get(StreamKind, Format, Value, InfoCodecID_Compression_Mode), true); //Specific cases if (Value==__T("v210") || Value==__T("V210")) Fill(Stream_Video, StreamPos, Video_BitDepth, 10); } //--------------------------------------------------------------------------- size_t File__Analyze::Fill_Parameter(stream_t StreamKind, generic StreamPos) { switch (StreamKind) { case Stream_General : switch (StreamPos) { case Generic_Format : return General_Format; case Generic_Format_Info : return General_Format_Info; case Generic_Format_Url : return General_Format_Url; case Generic_Format_Version : return General_Format_Version; case Generic_Format_Commercial : return General_Format_Commercial; case Generic_Format_Commercial_IfAny : return General_Format_Commercial_IfAny; case Generic_Format_Profile : return General_Format_Profile; case Generic_Format_Settings : return General_Format_Settings; case Generic_InternetMediaType : return General_InternetMediaType; case Generic_CodecID : return General_CodecID; case Generic_CodecID_Info : return General_CodecID_Info; case Generic_CodecID_Hint : return General_CodecID_Hint; case Generic_CodecID_Url : return General_CodecID_Url; case Generic_CodecID_Description : return General_CodecID_Description; case Generic_Codec : return General_Codec; case Generic_Codec_String : return General_Codec_String; case Generic_Codec_Info : return General_Codec_Info; case Generic_Codec_Url : return General_Codec_Url; case Generic_Duration : return General_Duration; case Generic_Duration_String : return General_Duration_String; case Generic_Duration_String1 : return General_Duration_String1; case Generic_Duration_String2 : return General_Duration_String2; case Generic_Duration_String3 : return General_Duration_String3; case Generic_StreamSize : return General_StreamSize; case Generic_StreamSize_String : return General_StreamSize_String; case Generic_StreamSize_String1 : return General_StreamSize_String1; case Generic_StreamSize_String2 : return General_StreamSize_String2; case Generic_StreamSize_String3 : return General_StreamSize_String3; case Generic_StreamSize_String4 : return General_StreamSize_String4; case Generic_StreamSize_String5 : return General_StreamSize_String5; case Generic_StreamSize_Proportion : return General_StreamSize_Proportion; case Generic_ServiceName : return General_ServiceName; case Generic_ServiceProvider : return General_ServiceProvider; default: return (size_t)-1; } case Stream_Video : switch (StreamPos) { case Generic_Format : return Video_Format; case Generic_Format_Info : return Video_Format_Info; case Generic_Format_Url : return Video_Format_Url; case Generic_Format_Commercial : return Video_Format_Commercial; case Generic_Format_Commercial_IfAny : return Video_Format_Commercial_IfAny; case Generic_Format_Version : return Video_Format_Version; case Generic_Format_Profile : return Video_Format_Profile; case Generic_Format_Settings : return Video_Format_Settings; case Generic_InternetMediaType : return Video_InternetMediaType; case Generic_CodecID : return Video_CodecID; case Generic_CodecID_Info : return Video_CodecID_Info; case Generic_CodecID_Hint : return Video_CodecID_Hint; case Generic_CodecID_Url : return Video_CodecID_Url; case Generic_CodecID_Description : return Video_CodecID_Description; case Generic_Codec : return Video_Codec; case Generic_Codec_String : return Video_Codec_String; case Generic_Codec_Info : return Video_Codec_Info; case Generic_Codec_Url : return Video_Codec_Url; case Generic_Codec_CC : return Video_Codec_CC; case Generic_Duration : return Video_Duration; case Generic_Duration_String : return Video_Duration_String; case Generic_Duration_String1 : return Video_Duration_String1; case Generic_Duration_String2 : return Video_Duration_String2; case Generic_Duration_String3 : return Video_Duration_String3; case Generic_Source_Duration : return Video_Source_Duration; case Generic_Source_Duration_String : return Video_Source_Duration_String; case Generic_Source_Duration_String1 : return Video_Source_Duration_String1; case Generic_Source_Duration_String2 : return Video_Source_Duration_String2; case Generic_Source_Duration_String3 : return Video_Source_Duration_String3; case Generic_BitRate_Mode : return Video_BitRate_Mode; case Generic_BitRate_Mode_String : return Video_BitRate_Mode_String; case Generic_BitRate : return Video_BitRate; case Generic_BitRate_String : return Video_BitRate_String; case Generic_BitRate_Minimum : return Video_BitRate_Minimum; case Generic_BitRate_Minimum_String : return Video_BitRate_Minimum_String; case Generic_BitRate_Nominal : return Video_BitRate_Nominal; case Generic_BitRate_Nominal_String : return Video_BitRate_Nominal_String; case Generic_BitRate_Maximum : return Video_BitRate_Maximum; case Generic_BitRate_Maximum_String : return Video_BitRate_Maximum_String; case Generic_BitRate_Encoded : return Video_BitRate_Encoded; case Generic_BitRate_Encoded_String : return Video_BitRate_Encoded_String; case Generic_FrameCount : return Video_FrameCount; case Generic_Source_FrameCount : return Video_Source_FrameCount; case Generic_ColorSpace : return Video_ColorSpace; case Generic_ChromaSubsampling : return Video_ChromaSubsampling; case Generic_Resolution : return Video_Resolution; case Generic_Resolution_String : return Video_Resolution_String; case Generic_BitDepth : return Video_BitDepth; case Generic_BitDepth_String : return Video_BitDepth_String; case Generic_Compression_Mode : return Video_Compression_Mode; case Generic_Compression_Mode_String : return Video_Compression_Mode_String; case Generic_Compression_Ratio : return Video_Compression_Ratio; case Generic_Delay : return Video_Delay; case Generic_Delay_String : return Video_Delay_String; case Generic_Delay_String1 : return Video_Delay_String1; case Generic_Delay_String2 : return Video_Delay_String2; case Generic_Delay_String3 : return Video_Delay_String3; case Generic_Delay_String4 : return Video_Delay_String4; case Generic_Delay_Settings : return Video_Delay_Settings; case Generic_Delay_DropFrame : return Video_Delay_DropFrame; case Generic_Delay_Source : return Video_Delay_Source; case Generic_Delay_Source_String : return Video_Delay_Source_String; case Generic_Delay_Original : return Video_Delay_Original; case Generic_Delay_Original_String : return Video_Delay_Original_String; case Generic_Delay_Original_String1 : return Video_Delay_Original_String1; case Generic_Delay_Original_String2 : return Video_Delay_Original_String2; case Generic_Delay_Original_String3 : return Video_Delay_Original_String3; case Generic_Delay_Original_String4 : return Video_Delay_Original_String4; case Generic_Delay_Original_Settings : return Video_Delay_Original_Settings; case Generic_Delay_Original_DropFrame : return Video_Delay_Original_DropFrame; case Generic_Delay_Original_Source : return Video_Delay_Original_Source; case Generic_StreamSize : return Video_StreamSize; case Generic_StreamSize_String : return Video_StreamSize_String; case Generic_StreamSize_String1 : return Video_StreamSize_String1; case Generic_StreamSize_String2 : return Video_StreamSize_String2; case Generic_StreamSize_String3 : return Video_StreamSize_String3; case Generic_StreamSize_String4 : return Video_StreamSize_String4; case Generic_StreamSize_String5 : return Video_StreamSize_String5; case Generic_StreamSize_Proportion : return Video_StreamSize_Proportion; case Generic_StreamSize_Encoded : return Video_StreamSize_Encoded; case Generic_StreamSize_Encoded_String : return Video_StreamSize_Encoded_String; case Generic_StreamSize_Encoded_String1 : return Video_StreamSize_Encoded_String1; case Generic_StreamSize_Encoded_String2 : return Video_StreamSize_Encoded_String2; case Generic_StreamSize_Encoded_String3 : return Video_StreamSize_Encoded_String3; case Generic_StreamSize_Encoded_String4 : return Video_StreamSize_Encoded_String4; case Generic_StreamSize_Encoded_String5 : return Video_StreamSize_Encoded_String5; case Generic_StreamSize_Encoded_Proportion : return Video_StreamSize_Encoded_Proportion; case Generic_Source_StreamSize : return Video_Source_StreamSize; case Generic_Source_StreamSize_String : return Video_Source_StreamSize_String; case Generic_Source_StreamSize_String1 : return Video_Source_StreamSize_String1; case Generic_Source_StreamSize_String2 : return Video_Source_StreamSize_String2; case Generic_Source_StreamSize_String3 : return Video_Source_StreamSize_String3; case Generic_Source_StreamSize_String4 : return Video_Source_StreamSize_String4; case Generic_Source_StreamSize_String5 : return Video_Source_StreamSize_String5; case Generic_Source_StreamSize_Proportion : return Video_Source_StreamSize_Proportion; case Generic_Source_StreamSize_Encoded : return Video_Source_StreamSize_Encoded; case Generic_Source_StreamSize_Encoded_String : return Video_Source_StreamSize_Encoded_String; case Generic_Source_StreamSize_Encoded_String1 : return Video_Source_StreamSize_Encoded_String1; case Generic_Source_StreamSize_Encoded_String2 : return Video_Source_StreamSize_Encoded_String2; case Generic_Source_StreamSize_Encoded_String3 : return Video_Source_StreamSize_Encoded_String3; case Generic_Source_StreamSize_Encoded_String4 : return Video_Source_StreamSize_Encoded_String4; case Generic_Source_StreamSize_Encoded_String5 : return Video_Source_StreamSize_Encoded_String5; case Generic_Source_StreamSize_Encoded_Proportion : return Video_Source_StreamSize_Encoded_Proportion; case Generic_Language : return Video_Language; default: return (size_t)-1; } case Stream_Audio : switch (StreamPos) { case Generic_Format : return Audio_Format; case Generic_Format_Info : return Audio_Format_Info; case Generic_Format_Url : return Audio_Format_Url; case Generic_Format_Commercial : return Audio_Format_Commercial; case Generic_Format_Commercial_IfAny : return Audio_Format_Commercial_IfAny; case Generic_Format_Version : return Audio_Format_Version; case Generic_Format_Profile : return Audio_Format_Profile; case Generic_Format_Settings : return Audio_Format_Settings; case Generic_InternetMediaType : return Audio_InternetMediaType; case Generic_CodecID : return Audio_CodecID; case Generic_CodecID_Info : return Audio_CodecID_Info; case Generic_CodecID_Hint : return Audio_CodecID_Hint; case Generic_CodecID_Url : return Audio_CodecID_Url; case Generic_CodecID_Description : return Audio_CodecID_Description; case Generic_Codec : return Audio_Codec; case Generic_Codec_String : return Audio_Codec_String; case Generic_Codec_Info : return Audio_Codec_Info; case Generic_Codec_Url : return Audio_Codec_Url; case Generic_Codec_CC : return Audio_Codec_CC; case Generic_Duration : return Audio_Duration; case Generic_Duration_String : return Audio_Duration_String; case Generic_Duration_String1 : return Audio_Duration_String1; case Generic_Duration_String2 : return Audio_Duration_String2; case Generic_Duration_String3 : return Audio_Duration_String3; case Generic_Source_Duration : return Audio_Source_Duration; case Generic_Source_Duration_String : return Audio_Source_Duration_String; case Generic_Source_Duration_String1 : return Audio_Source_Duration_String1; case Generic_Source_Duration_String2 : return Audio_Source_Duration_String2; case Generic_Source_Duration_String3 : return Audio_Source_Duration_String3; case Generic_BitRate_Mode : return Audio_BitRate_Mode; case Generic_BitRate_Mode_String : return Audio_BitRate_Mode_String; case Generic_BitRate : return Audio_BitRate; case Generic_BitRate_String : return Audio_BitRate_String; case Generic_BitRate_Minimum : return Audio_BitRate_Minimum; case Generic_BitRate_Minimum_String : return Audio_BitRate_Minimum_String; case Generic_BitRate_Nominal : return Audio_BitRate_Nominal; case Generic_BitRate_Nominal_String : return Audio_BitRate_Nominal_String; case Generic_BitRate_Maximum : return Audio_BitRate_Maximum; case Generic_BitRate_Maximum_String : return Audio_BitRate_Maximum_String; case Generic_BitRate_Encoded : return Audio_BitRate_Encoded; case Generic_BitRate_Encoded_String : return Audio_BitRate_Encoded_String; case Generic_FrameCount : return Audio_FrameCount; case Generic_Source_FrameCount : return Audio_Source_FrameCount; case Generic_Resolution : return Audio_Resolution; case Generic_Resolution_String : return Audio_Resolution_String; case Generic_BitDepth : return Audio_BitDepth; case Generic_BitDepth_String : return Audio_BitDepth_String; case Generic_Compression_Mode : return Audio_Compression_Mode; case Generic_Compression_Mode_String : return Audio_Compression_Mode_String; case Generic_Compression_Ratio : return Audio_Compression_Ratio; case Generic_Delay : return Audio_Delay; case Generic_Delay_String : return Audio_Delay_String; case Generic_Delay_String1 : return Audio_Delay_String1; case Generic_Delay_String2 : return Audio_Delay_String2; case Generic_Delay_String3 : return Audio_Delay_String3; case Generic_Delay_String4 : return Audio_Delay_String4; case Generic_Delay_Settings : return Audio_Delay_Settings; case Generic_Delay_DropFrame : return Audio_Delay_DropFrame; case Generic_Delay_Source : return Audio_Delay_Source; case Generic_Delay_Source_String : return Audio_Delay_Source_String; case Generic_Delay_Original : return Audio_Delay_Original; case Generic_Delay_Original_String : return Audio_Delay_Original_String; case Generic_Delay_Original_String1 : return Audio_Delay_Original_String1; case Generic_Delay_Original_String2 : return Audio_Delay_Original_String2; case Generic_Delay_Original_String3 : return Audio_Delay_Original_String3; case Generic_Delay_Original_String4 : return Audio_Delay_Original_String4; case Generic_Delay_Original_Settings : return Audio_Delay_Original_Settings; case Generic_Delay_Original_DropFrame : return Audio_Delay_Original_DropFrame; case Generic_Delay_Original_Source : return Audio_Delay_Original_Source; case Generic_Video_Delay : return Audio_Video_Delay; case Generic_Video_Delay_String : return Audio_Video_Delay_String; case Generic_Video_Delay_String1 : return Audio_Video_Delay_String1; case Generic_Video_Delay_String2 : return Audio_Video_Delay_String2; case Generic_Video_Delay_String3 : return Audio_Video_Delay_String3; case Generic_Video_Delay_String4 : return Audio_Video_Delay_String4; case Generic_StreamSize : return Audio_StreamSize; case Generic_StreamSize_String : return Audio_StreamSize_String; case Generic_StreamSize_String1 : return Audio_StreamSize_String1; case Generic_StreamSize_String2 : return Audio_StreamSize_String2; case Generic_StreamSize_String3 : return Audio_StreamSize_String3; case Generic_StreamSize_String4 : return Audio_StreamSize_String4; case Generic_StreamSize_String5 : return Audio_StreamSize_String5; case Generic_StreamSize_Proportion : return Audio_StreamSize_Proportion; case Generic_StreamSize_Encoded : return Audio_StreamSize_Encoded; case Generic_StreamSize_Encoded_String : return Audio_StreamSize_Encoded_String; case Generic_StreamSize_Encoded_String1 : return Audio_StreamSize_Encoded_String1; case Generic_StreamSize_Encoded_String2 : return Audio_StreamSize_Encoded_String2; case Generic_StreamSize_Encoded_String3 : return Audio_StreamSize_Encoded_String3; case Generic_StreamSize_Encoded_String4 : return Audio_StreamSize_Encoded_String4; case Generic_StreamSize_Encoded_String5 : return Audio_StreamSize_Encoded_String5; case Generic_StreamSize_Encoded_Proportion : return Audio_StreamSize_Encoded_Proportion; case Generic_Source_StreamSize : return Audio_Source_StreamSize; case Generic_Source_StreamSize_String : return Audio_Source_StreamSize_String; case Generic_Source_StreamSize_String1 : return Audio_Source_StreamSize_String1; case Generic_Source_StreamSize_String2 : return Audio_Source_StreamSize_String2; case Generic_Source_StreamSize_String3 : return Audio_Source_StreamSize_String3; case Generic_Source_StreamSize_String4 : return Audio_Source_StreamSize_String4; case Generic_Source_StreamSize_String5 : return Audio_Source_StreamSize_String5; case Generic_Source_StreamSize_Proportion : return Audio_Source_StreamSize_Proportion; case Generic_Source_StreamSize_Encoded : return Audio_Source_StreamSize_Encoded; case Generic_Source_StreamSize_Encoded_String : return Audio_Source_StreamSize_Encoded_String; case Generic_Source_StreamSize_Encoded_String1 : return Audio_Source_StreamSize_Encoded_String1; case Generic_Source_StreamSize_Encoded_String2 : return Audio_Source_StreamSize_Encoded_String2; case Generic_Source_StreamSize_Encoded_String3 : return Audio_Source_StreamSize_Encoded_String3; case Generic_Source_StreamSize_Encoded_String4 : return Audio_Source_StreamSize_Encoded_String4; case Generic_Source_StreamSize_Encoded_String5 : return Audio_Source_StreamSize_Encoded_String5; case Generic_Source_StreamSize_Encoded_Proportion : return Audio_Source_StreamSize_Encoded_Proportion; case Generic_Language : return Audio_Language; default: return (size_t)-1; } case Stream_Text : switch (StreamPos) { case Generic_Format : return Text_Format; case Generic_Format_Info : return Text_Format_Info; case Generic_Format_Url : return Text_Format_Url; case Generic_Format_Commercial : return Text_Format_Commercial; case Generic_Format_Commercial_IfAny : return Text_Format_Commercial_IfAny; case Generic_Format_Version : return Text_Format_Version; case Generic_Format_Profile : return Text_Format_Profile; case Generic_Format_Settings : return Text_Format_Settings; case Generic_InternetMediaType : return Text_InternetMediaType; case Generic_CodecID : return Text_CodecID; case Generic_CodecID_Info : return Text_CodecID_Info; case Generic_CodecID_Hint : return Text_CodecID_Hint; case Generic_CodecID_Url : return Text_CodecID_Url; case Generic_CodecID_Description : return Text_CodecID_Description; case Generic_Codec : return Text_Codec; case Generic_Codec_String : return Text_Codec_String; case Generic_Codec_Info : return Text_Codec_Info; case Generic_Codec_Url : return Text_Codec_Url; case Generic_Codec_CC : return Text_Codec_CC; case Generic_Duration : return Text_Duration; case Generic_Duration_String : return Text_Duration_String; case Generic_Duration_String1 : return Text_Duration_String1; case Generic_Duration_String2 : return Text_Duration_String2; case Generic_Duration_String3 : return Text_Duration_String3; case Generic_Source_Duration : return Text_Source_Duration; case Generic_Source_Duration_String : return Text_Source_Duration_String; case Generic_Source_Duration_String1 : return Text_Source_Duration_String1; case Generic_Source_Duration_String2 : return Text_Source_Duration_String2; case Generic_Source_Duration_String3 : return Text_Source_Duration_String3; case Generic_BitRate_Mode : return Text_BitRate_Mode; case Generic_BitRate_Mode_String : return Text_BitRate_Mode_String; case Generic_BitRate : return Text_BitRate; case Generic_BitRate_String : return Text_BitRate_String; case Generic_BitRate_Minimum : return Text_BitRate_Minimum; case Generic_BitRate_Minimum_String : return Text_BitRate_Minimum_String; case Generic_BitRate_Nominal : return Text_BitRate_Nominal; case Generic_BitRate_Nominal_String : return Text_BitRate_Nominal_String; case Generic_BitRate_Maximum : return Text_BitRate_Maximum; case Generic_BitRate_Maximum_String : return Text_BitRate_Maximum_String; case Generic_BitRate_Encoded : return Text_BitRate_Encoded; case Generic_BitRate_Encoded_String : return Text_BitRate_Encoded_String; case Generic_FrameCount : return Text_FrameCount; case Generic_Source_FrameCount : return Text_Source_FrameCount; case Generic_ColorSpace : return Text_ColorSpace; case Generic_ChromaSubsampling : return Text_ChromaSubsampling; case Generic_Resolution : return Text_Resolution; case Generic_Resolution_String : return Text_Resolution_String; case Generic_BitDepth : return Text_BitDepth; case Generic_BitDepth_String : return Text_BitDepth_String; case Generic_Compression_Mode : return Text_Compression_Mode; case Generic_Compression_Mode_String : return Text_Compression_Mode_String; case Generic_Compression_Ratio : return Text_Compression_Ratio; case Generic_Delay : return Text_Delay; case Generic_Delay_String : return Text_Delay_String; case Generic_Delay_String1 : return Text_Delay_String1; case Generic_Delay_String2 : return Text_Delay_String2; case Generic_Delay_String3 : return Text_Delay_String3; case Generic_Delay_String4 : return Text_Delay_String4; case Generic_Delay_Settings : return Text_Delay_Settings; case Generic_Delay_DropFrame : return Text_Delay_DropFrame; case Generic_Delay_Source : return Text_Delay_Source; case Generic_Delay_Source_String : return Text_Delay_Source_String; case Generic_Delay_Original : return Text_Delay_Original; case Generic_Delay_Original_String : return Text_Delay_Original_String; case Generic_Delay_Original_String1 : return Text_Delay_Original_String1; case Generic_Delay_Original_String2 : return Text_Delay_Original_String2; case Generic_Delay_Original_String3 : return Text_Delay_Original_String3; case Generic_Delay_Original_String4 : return Text_Delay_Original_String4; case Generic_Delay_Original_Settings : return Text_Delay_Original_Settings; case Generic_Delay_Original_DropFrame : return Text_Delay_Original_DropFrame; case Generic_Delay_Original_Source : return Text_Delay_Original_Source; case Generic_Video_Delay : return Text_Video_Delay; case Generic_Video_Delay_String : return Text_Video_Delay_String; case Generic_Video_Delay_String1 : return Text_Video_Delay_String1; case Generic_Video_Delay_String2 : return Text_Video_Delay_String2; case Generic_Video_Delay_String3 : return Text_Video_Delay_String3; case Generic_Video_Delay_String4 : return Text_Video_Delay_String4; case Generic_StreamSize : return Text_StreamSize; case Generic_StreamSize_String : return Text_StreamSize_String; case Generic_StreamSize_String1 : return Text_StreamSize_String1; case Generic_StreamSize_String2 : return Text_StreamSize_String2; case Generic_StreamSize_String3 : return Text_StreamSize_String3; case Generic_StreamSize_String4 : return Text_StreamSize_String4; case Generic_StreamSize_String5 : return Text_StreamSize_String5; case Generic_StreamSize_Proportion : return Text_StreamSize_Proportion; case Generic_StreamSize_Encoded : return Text_StreamSize_Encoded; case Generic_StreamSize_Encoded_String : return Text_StreamSize_Encoded_String; case Generic_StreamSize_Encoded_String1 : return Text_StreamSize_Encoded_String1; case Generic_StreamSize_Encoded_String2 : return Text_StreamSize_Encoded_String2; case Generic_StreamSize_Encoded_String3 : return Text_StreamSize_Encoded_String3; case Generic_StreamSize_Encoded_String4 : return Text_StreamSize_Encoded_String4; case Generic_StreamSize_Encoded_String5 : return Text_StreamSize_Encoded_String5; case Generic_StreamSize_Encoded_Proportion : return Text_StreamSize_Encoded_Proportion; case Generic_Source_StreamSize : return Text_Source_StreamSize; case Generic_Source_StreamSize_String : return Text_Source_StreamSize_String; case Generic_Source_StreamSize_String1 : return Text_Source_StreamSize_String1; case Generic_Source_StreamSize_String2 : return Text_Source_StreamSize_String2; case Generic_Source_StreamSize_String3 : return Text_Source_StreamSize_String3; case Generic_Source_StreamSize_String4 : return Text_Source_StreamSize_String4; case Generic_Source_StreamSize_String5 : return Text_Source_StreamSize_String5; case Generic_Source_StreamSize_Proportion : return Text_Source_StreamSize_Proportion; case Generic_Source_StreamSize_Encoded : return Text_Source_StreamSize_Encoded; case Generic_Source_StreamSize_Encoded_String : return Text_Source_StreamSize_Encoded_String; case Generic_Source_StreamSize_Encoded_String1 : return Text_Source_StreamSize_Encoded_String1; case Generic_Source_StreamSize_Encoded_String2 : return Text_Source_StreamSize_Encoded_String2; case Generic_Source_StreamSize_Encoded_String3 : return Text_Source_StreamSize_Encoded_String3; case Generic_Source_StreamSize_Encoded_String4 : return Text_Source_StreamSize_Encoded_String4; case Generic_Source_StreamSize_Encoded_String5 : return Text_Source_StreamSize_Encoded_String5; case Generic_Source_StreamSize_Encoded_Proportion : return Text_Source_StreamSize_Encoded_Proportion; case Generic_Language : return Text_Language; default: return (size_t)-1; } case Stream_Other : switch (StreamPos) { case Generic_Format : return Other_Format; case Generic_Format_Info : return Other_Format_Info; case Generic_Format_Url : return Other_Format_Url; case Generic_Format_Commercial : return Other_Format_Commercial; case Generic_Format_Commercial_IfAny : return Other_Format_Commercial_IfAny; case Generic_Format_Version : return Other_Format_Version; case Generic_Format_Profile : return Other_Format_Profile; case Generic_Format_Settings : return Other_Format_Settings; case Generic_CodecID : return Other_CodecID; case Generic_CodecID_Info : return Other_CodecID_Info; case Generic_CodecID_Hint : return Other_CodecID_Hint; case Generic_CodecID_Url : return Other_CodecID_Url; case Generic_CodecID_Description : return Other_CodecID_Description; case Generic_Duration : return Other_Duration; case Generic_Duration_String : return Other_Duration_String; case Generic_Duration_String1 : return Other_Duration_String1; case Generic_Duration_String2 : return Other_Duration_String2; case Generic_Duration_String3 : return Other_Duration_String3; case Generic_FrameCount : return Other_FrameCount; case Generic_Language : return Other_Language; default: return (size_t)-1; } case Stream_Image : switch (StreamPos) { case Generic_Format : return Image_Format; case Generic_Format_Info : return Image_Format_Info; case Generic_Format_Url : return Image_Format_Url; case Generic_Format_Commercial : return Image_Format_Commercial; case Generic_Format_Commercial_IfAny : return Image_Format_Commercial_IfAny; case Generic_Format_Version : return Image_Format_Version; case Generic_Format_Profile : return Image_Format_Profile; case Generic_InternetMediaType : return Image_InternetMediaType; case Generic_CodecID : return Image_CodecID; case Generic_CodecID_Info : return Image_CodecID_Info; case Generic_CodecID_Hint : return Image_CodecID_Hint; case Generic_CodecID_Url : return Image_CodecID_Url; case Generic_CodecID_Description : return Image_CodecID_Description; case Generic_Codec : return Image_Codec; case Generic_Codec_String : return Image_Codec_String; case Generic_Codec_Info : return Image_Codec_Info; case Generic_Codec_Url : return Image_Codec_Url; case Generic_ColorSpace : return Image_ColorSpace; case Generic_ChromaSubsampling : return Image_ChromaSubsampling; case Generic_Resolution : return Image_Resolution; case Generic_Resolution_String : return Image_Resolution_String; case Generic_BitDepth : return Image_BitDepth; case Generic_BitDepth_String : return Image_BitDepth_String; case Generic_Compression_Mode : return Image_Compression_Mode; case Generic_Compression_Mode_String : return Image_Compression_Mode_String; case Generic_Compression_Ratio : return Image_Compression_Ratio; case Generic_StreamSize : return Image_StreamSize; case Generic_StreamSize_String : return Image_StreamSize_String; case Generic_StreamSize_String1 : return Image_StreamSize_String1; case Generic_StreamSize_String2 : return Image_StreamSize_String2; case Generic_StreamSize_String3 : return Image_StreamSize_String3; case Generic_StreamSize_String4 : return Image_StreamSize_String4; case Generic_StreamSize_String5 : return Image_StreamSize_String5; case Generic_StreamSize_Proportion : return Image_StreamSize_Proportion; case Generic_Language : return Image_Language; default: return (size_t)-1; } case Stream_Menu : switch (StreamPos) { case Generic_Format : return Menu_Format; case Generic_Format_Info : return Menu_Format_Info; case Generic_Format_Url : return Menu_Format_Url; case Generic_Format_Commercial : return Menu_Format_Commercial; case Generic_Format_Commercial_IfAny : return Menu_Format_Commercial_IfAny; case Generic_Format_Version : return Menu_Format_Version; case Generic_Format_Profile : return Menu_Format_Profile; case Generic_Format_Settings : return Menu_Format_Settings; case Generic_CodecID : return Menu_CodecID; case Generic_CodecID_Info : return Menu_CodecID_Info; case Generic_CodecID_Hint : return Menu_CodecID_Hint; case Generic_CodecID_Url : return Menu_CodecID_Url; case Generic_CodecID_Description : return Menu_CodecID_Description; case Generic_Codec : return Menu_Codec; case Generic_Codec_String : return Menu_Codec_String; case Generic_Codec_Info : return Menu_Codec_Info; case Generic_Codec_Url : return Menu_Codec_Url; case Generic_Duration : return Menu_Duration; case Generic_Duration_String : return Menu_Duration_String; case Generic_Duration_String1 : return Menu_Duration_String1; case Generic_Duration_String2 : return Menu_Duration_String2; case Generic_Duration_String3 : return Menu_Duration_String3; case Generic_Language : return Menu_Language; case Generic_ServiceName : return Menu_ServiceName; case Generic_ServiceProvider : return Menu_ServiceProvider; default: return (size_t)-1; } default: return (size_t)-1; } } } //NameSpace MediaInfoLib/Source/MediaInfo/File__Analyze_Streams_Finish.cpp100777 0 0 102477 12243745532 20037 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Init and Finalize part // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "ZenLib/Utils.h" #include "ZenLib/File.h" #include "ZenLib/FileName.h" #include "MediaInfo/File__Analyze.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #if MEDIAINFO_IBI #include "MediaInfo/Multiple/File_Ibi.h" #endif //MEDIAINFO_IBI using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- extern MediaInfo_Config Config; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- void File__Analyze::Streams_Finish_Global() { if (IsSub) return; #if MEDIAINFO_ADVANCED //Default frame rate if (Count_Get(Stream_Video)==1 && Retrieve(Stream_Video, 0, Video_FrameRate).empty() && Config->File_DefaultFrameRate_Get()) Fill(Stream_Video, 0, Video_FrameRate, Config->File_DefaultFrameRate_Get()); #endif //MEDIAINFO_ADVANCED //Video Frame count if (Count_Get(Stream_Video)==1 && Count_Get(Stream_Audio)==0 && Retrieve(Stream_Video, 0, Video_FrameCount).empty()) { if (Frame_Count_NotParsedIncluded!=(int64u)-1 && File_Offset+Buffer_Size==File_Size) Fill(Stream_Video, 0, Video_FrameCount, Frame_Count_NotParsedIncluded); else if (Config->File_Names.size()>1) Fill(Stream_Video, 0, Video_FrameCount, Config->File_Names.size()); #if MEDIAINFO_IBI else { //External IBI std::string IbiFile=Config->Ibi_Get(); if (!IbiFile.empty()) { if (IbiStream) IbiStream->Infos.clear(); //TODO: support IBI data from different inputs else IbiStream=new ibi::stream; File_Ibi MI; Open_Buffer_Init(&MI, IbiFile.size()); MI.Ibi=new ibi; MI.Open_Buffer_Continue((const int8u*)IbiFile.c_str(), IbiFile.size()); if (!MI.Ibi->Streams.empty()) (*IbiStream)=(*MI.Ibi->Streams.begin()->second); } if (IbiStream && !IbiStream->Infos.empty() && IbiStream->Infos[IbiStream->Infos.size()-1].IsContinuous && IbiStream->Infos[IbiStream->Infos.size()-1].FrameNumber!=(int64u)-1) Fill(Stream_Video, 0, Video_FrameCount, IbiStream->Infos[IbiStream->Infos.size()-1].FrameNumber); } #endif //MEDIAINFO_IBI } Streams_Finish_StreamOnly(); Streams_Finish_StreamOnly(); Streams_Finish_InterStreams(); Streams_Finish_StreamOnly(); Streams_Finish_InterStreams(); Streams_Finish_StreamOnly(); Streams_Finish_InterStreams(); Streams_Finish_StreamOnly(); } //--------------------------------------------------------------------------- void File__Analyze::TestContinuousFileNames(size_t CountOfFiles, Ztring FileExtension) { if (IsSub || !Config->File_TestContinuousFileNames_Get()) return; size_t Pos=Config->File_Names.size(); if (!Pos) return; //Trying to detect continuous file names (e.g. video stream as an image or HLS) bool AlreadyPresent=Config->File_Names.size()==1?true:false; FileName FileToTest(Config->File_Names.Read(Config->File_Names.size()-1)); Ztring FileToTest_Name=FileToTest.Name_Get(); size_t FileNameToTest_Pos=FileToTest_Name.size(); while (FileNameToTest_Pos && FileToTest_Name[FileNameToTest_Pos-1]>=__T('0') && FileToTest_Name[FileNameToTest_Pos-1]<=__T('9')) FileNameToTest_Pos--; if (FileNameToTest_Pos!=FileToTest_Name.size()) { size_t Numbers_Size=FileToTest_Name.size()-FileNameToTest_Pos; int64u Pos=Ztring(FileToTest_Name.substr(FileNameToTest_Pos)).To_int64u(); FileToTest_Name.resize(FileNameToTest_Pos); for (;;) { Pos++; Ztring Pos_Ztring; Pos_Ztring.From_Number(Pos); if (Numbers_Size>Pos_Ztring.size()) Pos_Ztring.insert(0, Numbers_Size-Pos_Ztring.size(), __T('0')); Ztring Next=FileToTest.Path_Get()+PathSeparator+FileToTest_Name+Pos_Ztring+__T('.')+(FileExtension.empty()?FileToTest.Extension_Get():FileExtension); if (!File::Exists(Next)) break; Config->File_Names.push_back(Next); } if (!Config->File_IsReferenced_Get() && Config->File_Names.size()File_Names.resize(1); //Removing files, wrong detection } if (Config->File_Names.size()==Pos) return; #if MEDIAINFO_ADVANCED if (!Config->File_IgnoreSequenceFileSize_Get()) #endif //MEDIAINFO_ADVANCED { for (; PosFile_Names.size(); Pos++) { int64u Size=File::Size_Get(Config->File_Names[Pos]); Config->File_Sizes.push_back(Size); Config->File_Size+=Size; } } File_Size=Config->File_Size; Element[0].Next=File_Size; #if MEDIAINFO_ADVANCED if (!Config->File_IgnoreSequenceFileSize_Get()) #endif //MEDIAINFO_ADVANCED Fill (Stream_General, 0, General_FileSize, File_Size, 10, true); Fill (Stream_General, 0, General_CompleteName_Last, Config->File_Names[Config->File_Names.size()-1], true); Fill (Stream_General, 0, General_FolderName_Last, FileName::Path_Get(Config->File_Names[Config->File_Names.size()-1]), true); Fill (Stream_General, 0, General_FileName_Last, FileName::Name_Get(Config->File_Names[Config->File_Names.size()-1]), true); Fill (Stream_General, 0, General_FileExtension_Last, FileName::Extension_Get(Config->File_Names[Config->File_Names.size()-1]), true); #if MEDIAINFO_ADVANCED if (Config->File_Source_List_Get()) { Ztring SourcePath=FileName::Path_Get(Retrieve(Stream_General, 0, General_CompleteName)); size_t SourcePath_Size=SourcePath.size()+1; //Path size + path separator size for (size_t Pos=0; PosFile_Names.size(); Pos++) { Ztring Temp=Config->File_Names[Pos]; Temp.erase(0, SourcePath_Size); Fill(Stream_General, 0, "Source_List", Temp); } (*Stream_More)[Stream_General][0](Ztring().From_Local("Source_List"), Info_Options)=__T("N NT"); } #endif //MEDIAINFO_ADVANCED } //--------------------------------------------------------------------------- void File__Analyze::Streams_Finish_StreamOnly() { //Generic for (size_t StreamKind=Stream_General; StreamKind0 && StreamSize>0) Fill(StreamKind, Pos, "BitRate", StreamSize*8*1000/Duration, 0); } //BitRate_Encoded from Duration and StreamSize_Encoded if (StreamKind!=Stream_General && StreamKind!=Stream_Other && StreamKind!=Stream_Menu && Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_BitRate_Encoded)).empty() && !Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_StreamSize_Encoded)).empty() && !Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_Duration)).empty()) { float64 Duration=0; if (StreamKind==Stream_Video && !Retrieve(Stream_Video, Pos, Video_FrameCount).empty() && !Retrieve(Stream_Video, Pos, Video_FrameRate).empty()) { int64u FrameCount=Retrieve(Stream_Video, Pos, Video_FrameCount).To_int64u(); float64 FrameRate=Retrieve(Stream_Video, Pos, Video_FrameRate).To_float64(); if (FrameCount && FrameRate) Duration=FrameCount*1000/FrameRate; //More precise (example: 1 frame at 29.97 fps) } if (Duration==0) Duration=Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_Duration)).To_float64(); int64u StreamSize_Encoded=Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_StreamSize_Encoded)).To_int64u(); if (Duration>0 && StreamSize_Encoded>0) Fill(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_BitRate_Encoded), StreamSize_Encoded*8*1000/Duration, 0); } //Duration from Bitrate and StreamSize if (StreamKind!=Stream_Other && Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_Duration)).empty() && !Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_StreamSize)).empty() && !Retrieve(StreamKind, Pos, "BitRate").empty() && Count_Get(Stream_Video)+Count_Get(Stream_Audio)>1) //If only one stream, duration will be copied later, useful for exact bitrate calculation { int64u BitRate=Retrieve(StreamKind, Pos, "BitRate").To_int64u(); int64u StreamSize=Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_StreamSize)).To_int64u(); if (BitRate>0 && StreamSize>0) Fill(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_Duration), StreamSize*8*1000/BitRate); } //StreamSize from BitRate and Duration if (StreamKind!=Stream_Other && Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_StreamSize)).empty() && !Retrieve(StreamKind, Pos, "BitRate").empty() && !Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_Duration)).empty() && Retrieve(StreamKind, Pos, "BitRate").find(__T(" / "))==std::string::npos) //If not done the first time or by other routine { int64u BitRate=Retrieve(StreamKind, Pos, "BitRate").To_int64u(); int64u Duration=Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_Duration)).To_int64u(); if (BitRate>0 && Duration>0) Fill(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_StreamSize), BitRate*Duration/8/1000); } //Bit rate and maximum bit rate if (!Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_BitRate)).empty() && Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_BitRate))==Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_BitRate_Maximum))) { Clear(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_BitRate_Maximum)); if (Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_BitRate_Mode)).empty()) Fill(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_BitRate_Mode), "CBR"); } } //--------------------------------------------------------------------------- void File__Analyze::Streams_Finish_StreamOnly_General(size_t UNUSED(StreamPos)) { } //--------------------------------------------------------------------------- void File__Analyze::Streams_Finish_StreamOnly_Video(size_t Pos) { //Frame count if (Retrieve(Stream_Video, Pos, Video_FrameCount).empty() && Frame_Count_NotParsedIncluded!=(int64u)-1 && File_Offset+Buffer_Size==File_Size) { if (Count_Get(Stream_Video)==1 && Count_Get(Stream_Audio)==0) Fill(Stream_Video, 0, Video_FrameCount, Frame_Count_NotParsedIncluded); } //FrameCount from Duration and FrameRate if (Retrieve(Stream_Video, Pos, Video_FrameCount).empty()) { int64s Duration=Retrieve(Stream_Video, Pos, Video_Duration).To_int64s(); if (Duration==0) Duration=Retrieve(Stream_General, 0, General_Duration).To_int64s(); float64 FrameRate=Retrieve(Stream_Video, Pos, Video_FrameRate).To_float64(); if (Duration && FrameRate) Fill(Stream_Video, Pos, Video_FrameCount, Duration*FrameRate/1000, 0); } //Duration from FrameCount and FrameRate if (Retrieve(Stream_Video, Pos, Video_Duration).empty()) { int64u FrameCount=Retrieve(Stream_Video, Pos, Video_FrameCount).To_int64u(); float64 FrameRate=Retrieve(Stream_Video, Pos, "FrameRate").To_float64(); if (FrameCount && FrameRate) Fill(Stream_Video, Pos, Video_Duration, FrameCount/FrameRate*1000, 0); } //FrameRate from FrameCount and Duration if (Retrieve(Stream_Video, Pos, Video_FrameRate).empty()) { int64u FrameCount=Retrieve(Stream_Video, Pos, Video_FrameCount).To_int64u(); float64 Duration=Retrieve(Stream_Video, Pos, Video_Duration).To_float64()/1000; if (FrameCount && Duration) Fill(Stream_Video, Pos, Video_FrameRate, FrameCount/Duration, 3); } //Pixel Aspect Ratio forced to 1.000 if none if (Retrieve(Stream_Video, Pos, Video_PixelAspectRatio).empty()) Fill(Stream_Video, Pos, Video_PixelAspectRatio, 1.000); //Standard if (Retrieve(Stream_Video, Pos, Video_Standard).empty() && (Retrieve(Stream_Video, Pos, Video_Width)==__T("720") || Retrieve(Stream_Video, Pos, Video_Width)==__T("704"))) { if (Retrieve(Stream_Video, Pos, Video_Height)==__T("576")) Fill(Stream_Video, Pos, Video_Standard, "PAL"); else if (Retrieve(Stream_Video, Pos, Video_Height)==__T("486") || Retrieve(Stream_Video, Pos, Video_Height)==__T("480")) Fill(Stream_Video, Pos, Video_Standard, "NTSC"); } if (Retrieve(Stream_Video, Pos, Video_Standard).empty() && Retrieve(Stream_Video, Pos, Video_Width)==__T("352")) { if (Retrieve(Stream_Video, Pos, Video_Height)==__T("576") || Retrieve(Stream_Video, Pos, Video_Height)==__T("288")) Fill(Stream_Video, Pos, Video_Standard, "PAL"); else if (Retrieve(Stream_Video, Pos, Video_Height)==__T("486") || Retrieve(Stream_Video, Pos, Video_Height)==__T("480") || Retrieve(Stream_Video, Pos, Video_Height)==__T("243") || Retrieve(Stream_Video, Pos, Video_Height)==__T("240")) Fill(Stream_Video, Pos, Video_Standard, "NTSC"); } //Known ScanTypes if (Retrieve(Stream_Video, Pos, Video_ScanType).empty() && (Retrieve(Stream_Video, Pos, Video_Format)==__T("RED") || Retrieve(Stream_Video, Pos, Video_Format)==__T("CineForm") || Retrieve(Stream_Video, Pos, Video_Format)==__T("DPX") || Retrieve(Stream_Video, Pos, Video_Format)==__T("EXR"))) Fill(Stream_Video, Pos, Video_ScanType, "Progressive"); } //--------------------------------------------------------------------------- void File__Analyze::Streams_Finish_StreamOnly_Audio(size_t Pos) { //SamplingCount if (Retrieve(Stream_Audio, Pos, Audio_SamplingCount).empty()) { int64s Duration=Retrieve(Stream_Audio, Pos, Audio_Duration).To_int64s(); if (Duration==0) Duration=Retrieve(Stream_General, 0, General_Duration).To_int64s(); float SamplingRate=Retrieve(Stream_Audio, Pos, Audio_SamplingRate).To_float32(); if (Duration && SamplingRate) Fill(Stream_Audio, Pos, Audio_SamplingCount, ((float64)Duration)/1000*SamplingRate, 0); } //Frame count if (Retrieve(Stream_Audio, Pos, Audio_FrameCount).empty() && Frame_Count_NotParsedIncluded!=(int64u)-1 && File_Offset+Buffer_Size==File_Size) { if (Count_Get(Stream_Video)==0 && Count_Get(Stream_Audio)==1) Fill(Stream_Audio, 0, Audio_FrameCount, Frame_Count_NotParsedIncluded); } //Duration if (Retrieve(Stream_Audio, Pos, Audio_Duration).empty() && Retrieve(Stream_Audio, Pos, Audio_SamplingRate).To_int64u()!=0) { int64u Duration=Retrieve(Stream_Audio, Pos, Audio_SamplingCount).To_int64u()*1000/Retrieve(Stream_Audio, Pos, Audio_SamplingRate).To_int64u(); if (Duration) Fill(Stream_Audio, Pos, Audio_Duration, Duration); } //Stream size if (Retrieve(Stream_Audio, Pos, Audio_StreamSize).empty() && !Retrieve(Stream_Audio, Pos, Audio_BitRate).empty() && !Retrieve(Stream_Audio, Pos, Audio_Duration).empty() && Retrieve(Stream_Audio, Pos, Audio_BitRate_Mode)==__T("CBR")) { int64u Duration=Retrieve(Stream_Audio, Pos, Audio_Duration).To_int64u(); int64u BitRate=Retrieve(Stream_Audio, Pos, Audio_BitRate).To_int64u(); if (Duration && BitRate) Fill(Stream_Audio, Pos, Audio_StreamSize, Duration*BitRate/8/1000); } //CBR/VBR if (Retrieve(Stream_Audio, Pos, Audio_BitRate_Mode).empty() && !Retrieve(Stream_Audio, Pos, Audio_Codec).empty()) { Ztring Z1=MediaInfoLib::Config.Codec_Get(Retrieve(Stream_Audio, Pos, Audio_Codec), InfoCodec_BitRate_Mode, Stream_Audio); if (!Z1.empty()) Fill(Stream_Audio, Pos, Audio_BitRate_Mode, Z1); } } //--------------------------------------------------------------------------- void File__Analyze::Streams_Finish_StreamOnly_Text(size_t UNUSED(Pos)) { } //--------------------------------------------------------------------------- void File__Analyze::Streams_Finish_StreamOnly_Other(size_t UNUSED(StreamPos)) { } //--------------------------------------------------------------------------- void File__Analyze::Streams_Finish_StreamOnly_Image(size_t UNUSED(StreamPos)) { } //--------------------------------------------------------------------------- void File__Analyze::Streams_Finish_StreamOnly_Menu(size_t UNUSED(StreamPos)) { } //--------------------------------------------------------------------------- void File__Analyze::Streams_Finish_InterStreams() { //Duration if General not filled if (Retrieve(Stream_General, 0, General_Duration).empty()) { int64u Duration=0; //For all streams (Generic) for (size_t StreamKind=Stream_Video; StreamKindDuration) Duration=Duration_Stream; } } //Filling if (Duration>0) Fill(Stream_General, 0, General_Duration, Duration); } //(*Stream) size if all stream sizes are OK if (Retrieve(Stream_General, 0, General_StreamSize).empty()) { int64u StreamSize_Total=0; bool IsOK=true; //For all streams (Generic) for (size_t StreamKind=Stream_Video; StreamKind0 && StreamSize_Total4 && Retrieve(Stream_Video, 0, Video_BitRate).empty() && Retrieve(Stream_Video, 0, Video_BitRate_Encoded).empty() && Retrieve(Stream_General, 0, General_Duration).To_int64u()>=1000) //BitRate is > 10 000 and Duration>10s, to avoid strange behavior { double GeneralBitRate_Ratio=0.98; //Default container overhead=2% int32u GeneralBitRate_Minus=5000; //5000 bps because of a "classic" stream overhead double VideoBitRate_Ratio =0.98; //Default container overhead=2% int32u VideoBitRate_Minus =2000; //2000 bps because of a "classic" stream overhead double AudioBitRate_Ratio =0.98; //Default container overhead=2% int32u AudioBitRate_Minus =2000; //2000 bps because of a "classic" stream overhead double TextBitRate_Ratio =0.98; //Default container overhead=2% int32u TextBitRate_Minus =2000; //2000 bps because of a "classic" stream overhead //Specific value depends of Container if (IsRawStream) { GeneralBitRate_Ratio=1; GeneralBitRate_Minus=0; VideoBitRate_Ratio =1; VideoBitRate_Minus =0; AudioBitRate_Ratio =1; AudioBitRate_Minus =0; TextBitRate_Ratio =1; TextBitRate_Minus =0; } if (Get(Stream_General, 0, __T("Format"))==__T("MPEG-TS")) { GeneralBitRate_Ratio=0.98; GeneralBitRate_Minus=0; VideoBitRate_Ratio =0.97; VideoBitRate_Minus =0; AudioBitRate_Ratio =0.96; AudioBitRate_Minus =0; TextBitRate_Ratio =0.96; TextBitRate_Minus =0; } if (Get(Stream_General, 0, __T("Format"))==__T("MPEG-PS")) { GeneralBitRate_Ratio=0.99; GeneralBitRate_Minus=0; VideoBitRate_Ratio =0.99; VideoBitRate_Minus =0; AudioBitRate_Ratio =0.99; AudioBitRate_Minus =0; TextBitRate_Ratio =0.99; TextBitRate_Minus =0; } if (MediaInfoLib::Config.Format_Get(Retrieve(Stream_General, 0, General_Format), InfoFormat_KindofFormat)==__T("MPEG-4")) { GeneralBitRate_Ratio=1; GeneralBitRate_Minus=0; VideoBitRate_Ratio =1; VideoBitRate_Minus =0; AudioBitRate_Ratio =1; AudioBitRate_Minus =0; TextBitRate_Ratio =1; TextBitRate_Minus =0; } if (Get(Stream_General, 0, __T("Format"))==__T("Matroska")) { GeneralBitRate_Ratio=0.99; GeneralBitRate_Minus=0; VideoBitRate_Ratio =0.99; VideoBitRate_Minus =0; AudioBitRate_Ratio =0.99; AudioBitRate_Minus =0; TextBitRate_Ratio =0.99; TextBitRate_Minus =0; } if (Get(Stream_General, 0, __T("Format"))==__T("MXF")) { GeneralBitRate_Ratio=1; GeneralBitRate_Minus=1000; VideoBitRate_Ratio =1.00; VideoBitRate_Minus =1000; AudioBitRate_Ratio =1.00; AudioBitRate_Minus =1000; TextBitRate_Ratio =1.00; TextBitRate_Minus =1000; } //Testing float64 VideoBitRate=Retrieve(Stream_General, 0, General_OverallBitRate).To_float64()*GeneralBitRate_Ratio-GeneralBitRate_Minus; bool VideobitRateIsValid=true; for (size_t Pos=0; Pos=10000) //to avoid strange behavior { VideoBitRate=VideoBitRate*VideoBitRate_Ratio-VideoBitRate_Minus; Fill(Stream_Video, 0, Video_BitRate, VideoBitRate, 0); //Default container overhead=2% if (Retrieve(Stream_Video, 0, Video_StreamSize).empty() && !Retrieve(Stream_Video, 0, Video_Duration).empty()) { float64 Duration=0; if (!Retrieve(Stream_Video, 0, Video_FrameCount).empty() && !Retrieve(Stream_Video, 0, Video_FrameRate).empty()) { int64u FrameCount=Retrieve(Stream_Video, 0, Video_FrameCount).To_int64u(); float64 FrameRate=Retrieve(Stream_Video, 0, Video_FrameRate).To_float64(); if (FrameCount && FrameRate) Duration=FrameCount*1000/FrameRate; //More precise (example: 1 frame at 29.97 fps) } if (Duration==0) Duration=Retrieve(Stream_Video, 0, Video_Duration).To_float64(); if (Duration) { int64u StreamSize=float64_int64s(VideoBitRate/8*Duration/1000); if (IsRawStream && File_Size!=(int64u)-1 && StreamSize>=File_Size*0.99) StreamSize=File_Size; Fill(Stream_Video, 0, Video_StreamSize, StreamSize); } } } } //General stream size if we have all streamsize if (File_Size!=(int64u)-1 && Retrieve(Stream_General, 0, General_StreamSize).empty()) { //Testing int64s StreamSize=File_Size; bool StreamSizeIsValid=true; for (size_t StreamKind_Pos=Stream_General+1; StreamKind_Pos0 || StreamKind_Pos==Stream_Text) StreamSize-=StreamXX_StreamSize; else StreamSizeIsValid=false; } if (StreamSizeIsValid && StreamSize>=0) //to avoid strange behavior Fill(Stream_General, 0, General_StreamSize, StreamSize); } //General_OverallBitRate_Mode if (Retrieve(Stream_General, 0, General_OverallBitRate_Mode).empty()) { bool IsValid=false; bool IsCBR=true; bool IsVBR=false; for (size_t StreamKind=Stream_General+1; StreamKind //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- extern MediaInfo_Config Config; //--------------------------------------------------------------------------- //*************************************************************************** // Gestion de la classe //*************************************************************************** //--------------------------------------------------------------------------- //Constructeurs File__Base::File__Base () { //Init pointers #if MEDIAINFO_TRACE Details=NULL; #endif //MEDIAINFO_TRACE Stream=NULL; Stream_More=NULL; Stream_MustBeDeleted=false; //File File_Size=(int64u)-1; File_Offset=0; File_Offset_FirstSynched=(int64u)-1; File_GoTo=(int64u)-1; //Optimization init StreamKind_Last=Stream_Max; StreamPos_Last=Error; //Config Config=NULL; } //--------------------------------------------------------------------------- //Constructeurs File__Base::~File__Base () { if (Stream_MustBeDeleted) { delete Stream; //Stream=NULL; delete Stream_More; //Stream_More=NULL; } } //--------------------------------------------------------------------------- //Base #if MEDIAINFO_TRACE void File__Base::Init (MediaInfo_Config_MediaInfo * Config_, Ztring* Details_, std::vector > * Stream_, std::vector > * Stream_More_) #else //MEDIAINFO_TRACE void File__Base::Init (MediaInfo_Config_MediaInfo * Config_, std::vector > * Stream_, std::vector > * Stream_More_) #endif //MEDIAINFO_TRACE { if (Config) return; //Already done if (Stream_) { Stream=Stream_; Stream_More=Stream_More_; Stream_MustBeDeleted=false; } else { Stream=new std::vector >; Stream->resize(Stream_Max); Stream_More=new std::vector >; Stream_More->resize(Stream_Max); Stream_MustBeDeleted=true; } Config=Config_; #if MEDIAINFO_TRACE Details=Details_; #endif //MEDIAINFO_TRACE } //*************************************************************************** // Fonctions //*************************************************************************** //--------------------------------------------------------------------------- size_t File__Base::Count_Get (stream_t StreamKind, size_t Pos) const { //Integrity if (StreamKind>=Stream_Max) return 0; //Count of streams if (!Stream) return 0; if (Pos==Error) return (*Stream)[StreamKind].size(); //Integrity if (Pos>=(*Stream)[StreamKind].size()) return 0; //Count of piece of information in a stream return MediaInfoLib::Config.Info_Get(StreamKind).size()+(*Stream_More)[StreamKind][Pos].size(); } //--------------------------------------------------------------------------- const Ztring &File__Base::Get (stream_t StreamKind, size_t StreamNumber, size_t Parameter, info_t KindOfInfo) { //Check integrity if (StreamKind>=Stream_Max || StreamNumber>=(*Stream)[StreamKind].size() || Parameter>=MediaInfoLib::Config.Info_Get(StreamKind).size()+(*Stream_More)[StreamKind][StreamNumber].size() || KindOfInfo>=Info_Max) return MediaInfoLib::Config.EmptyString_Get(); //Parameter is unknown else if (ParameterInfo_Text is in static lists if (KindOfInfo!=Info_Text) return MediaInfoLib::Config.Info_Get(StreamKind)[Parameter][KindOfInfo]; //look for static information only else if (Parameter<(*Stream)[StreamKind][StreamNumber].size()) return (*Stream)[StreamKind][StreamNumber][Parameter]; else return MediaInfoLib::Config.EmptyString_Get(); //This parameter is known, but not filled } else { if (((size_t)(Parameter-MediaInfoLib::Config.Info_Get(StreamKind).size()))<(*Stream_More)[StreamKind][StreamNumber].size() && ((size_t)KindOfInfo)<(*Stream_More)[StreamKind][StreamNumber][Parameter-MediaInfoLib::Config.Info_Get(StreamKind).size()].size()) return (*Stream_More)[StreamKind][StreamNumber][Parameter-MediaInfoLib::Config.Info_Get(StreamKind).size()][KindOfInfo]; else return MediaInfoLib::Config.EmptyString_Get(); //Not filled } } //--------------------------------------------------------------------------- const Ztring &File__Base::Get (stream_t StreamKind, size_t StreamPos, const Ztring &Parameter, info_t KindOfInfo, info_t KindOfSearch) { size_t ParameterI=0; //Check integrity if (StreamKind>=Stream_Max || StreamPos>=(*Stream)[StreamKind].size() || KindOfInfo>=Info_Max) return MediaInfoLib::Config.EmptyString_Get(); if ((ParameterI=MediaInfoLib::Config.Info_Get(StreamKind).Find(Parameter, KindOfSearch))==Error) { ParameterI=(*Stream_More)[StreamKind][StreamPos].Find(Parameter, KindOfSearch); if (ParameterI==Error) return MediaInfoLib::Config.EmptyString_Get(); //Parameter is unknown return (*Stream_More)[StreamKind][StreamPos][ParameterI](KindOfInfo); } return Get(StreamKind, StreamPos, ParameterI, KindOfInfo); } //--------------------------------------------------------------------------- int File__Base::Set (stream_t StreamKind, size_t StreamNumber, size_t Parameter, const Ztring &ToSet, const Ztring &OldValue) { //Integrity if (Count_Get(StreamKind)<=StreamNumber) return 0; return Set(StreamKind, StreamNumber, Get(StreamKind, StreamNumber, Parameter, Info_Name), ToSet, OldValue); } //--------------------------------------------------------------------------- int File__Base::Set (stream_t StreamKind, size_t StreamNumber, const Ztring &Parameter, const Ztring &ToSet, const Ztring &OldValue) { //Integrity if (Count_Get(StreamKind)<=StreamNumber) return 0; return Write(StreamKind, StreamNumber, Parameter, ToSet, OldValue); } //--------------------------------------------------------------------------- void File__Base::Language_Set() { } //*************************************************************************** // Divers //*************************************************************************** void File__Base::Clear() { for (size_t StreamKind=0; StreamKind > * Stream_=NULL, std::vector > * Stream_More=NULL); #else //MEDIAINFO_TRACE void Init(MediaInfo_Config_MediaInfo * Config, std::vector > * Stream_=NULL, std::vector > * Stream_More=NULL); #endif //MEDIAINFO_TRACE //Save int Save (); //Get information const Ztring &Get (stream_t StreamKind, size_t StreamNumber, size_t Parameter, info_t KindOfInfo=Info_Text); virtual const Ztring &Get (stream_t StreamKind, size_t StreamNumber, const Ztring &Parameter, info_t KindOfInfo=Info_Text, info_t KindOfSearch=Info_Name); //Set information int Set (stream_t StreamKind, size_t StreamNumber, size_t Parameter, const Ztring &ToSet, const Ztring &OldValue=__T("")); int Set (stream_t StreamKind, size_t StreamNumber, const Ztring &Parameter, const Ztring &ToSet, const Ztring &OldValue=__T("")); //Output buffer virtual size_t Output_Buffer_Get (const String &) {return 0;}; virtual size_t Output_Buffer_Get (size_t) {return 0;}; //Options size_t Count_Get (stream_t StreamKind, size_t Pos=Error) const; void Language_Set (); //Update language for an existing File__Base protected : //Read virtual void Read_Buffer_Init () {} //To overload virtual void Read_Buffer_Unsynched() {} //To overload virtual void Read_Buffer_Continue () {} //To overload virtual void Read_Buffer_Finalize () {} //To overload //Write virtual int Write (stream_t /*StreamKind*/, size_t /*StreamNumber*/, const Ztring &/*Parameter*/, const Ztring &/*ToSet*/, const Ztring &/*OldValue*/) {return -1;} //Write the value in memory virtual int WriteToDisk () {return -1;} //Write modified tags on disk //Arrays public : //TODO:put it as private std::vector > * Stream; //pointer to others listed streams std::vector > * Stream_More; //pointer to others listed streams bool Stream_MustBeDeleted; protected : stream_t StreamKind_Last; size_t StreamPos_Last; //Config MediaInfo_Config_MediaInfo* Config; //Details #if MEDIAINFO_TRACE Ztring* Details; #endif //MEDIAINFO_TRACE public : #if MEDIAINFO_TRACE void Details_Add(const char* Parameter); #endif //MEDIAINFO_TRACE virtual void Option_Manage() {}; //File Ztring File_Name; int64u File_Size; int64u File_Offset; int64u File_Offset_FirstSynched; int64u File_GoTo; //How many byte to skip? //Divers void Clear(); private : //Constructor File__Base (const File__Base&); // Prevent copy-construction File__Base& operator=(const File__Base&); // Prevent assignment public : //A virer friend class File__Analyze; friend class File__MultipleParsing; friend class File__ReferenceFilesHelper; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/File__Duplicate.cpp100777 0 0 5654 12226004262 15274 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Duplication helper for some specific formats // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if MEDIAINFO_DUPLICATE //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Duplicate.h" #include "MediaInfo/MediaInfo_Config.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "ZenLib/ZtringList.h" #include "ZenLib/File.h" using namespace ZenLib; using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** File__Duplicate::File__Duplicate () :File__Analyze() { //Temp File__Duplicate_HasChanged_=false; File__Duplicate_Needed=false; Config_File_Duplicate_Get_AlwaysNeeded_Count=0; } File__Duplicate::~File__Duplicate () { } //*************************************************************************** // Get //*************************************************************************** bool File__Duplicate::File__Duplicate_Get () { return File__Duplicate_Needed; } bool File__Duplicate::File__Duplicate_HasChanged () { //Retrieving general configuration while (Config->File_Duplicate_Get_AlwaysNeeded(Config_File_Duplicate_Get_AlwaysNeeded_Count)) { if (File__Duplicate_Set(Config->File_Duplicate_Get(Config_File_Duplicate_Get_AlwaysNeeded_Count))) File__Duplicate_HasChanged_=true; Config_File_Duplicate_Get_AlwaysNeeded_Count++; } bool File__Duplicate_HasChanged_Temp=File__Duplicate_HasChanged_; File__Duplicate_HasChanged_=false; return File__Duplicate_HasChanged_Temp; } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_DUPLICATE MediaInfoLib/Source/MediaInfo/File__Duplicate.h100777 0 0 2610 12226004262 14726 0/* 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. */ //--------------------------------------------------------------------------- #ifndef File__DuplicateH #define File__DuplicateH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Duplicate/File__Duplicate__Writer.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File__Duplicate //*************************************************************************** class File__Duplicate : public File__Analyze { public : //Constructor/Destructor File__Duplicate(); virtual ~File__Duplicate(); protected : virtual bool File__Duplicate_Set (const Ztring &Value)=0; //Fill a new File__Duplicate value //Get bool File__Duplicate_Get (); //Modifications bool File__Duplicate_HasChanged(); private : bool File__Duplicate_HasChanged_; bool File__Duplicate_Needed; size_t Config_File_Duplicate_Get_AlwaysNeeded_Count; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/File__MultipleParsing.cpp100777 0 0 56174 12262525402 16530 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__MultipleParsing.h" //--------------------------------------------------------------------------- // Multiple #if defined(MEDIAINFO_AAF_YES) #include "MediaInfo/Multiple/File_Aaf.h" #endif #if defined(MEDIAINFO_CDXA_YES) #include "MediaInfo/Multiple/File_Cdxa.h" #endif #if defined(MEDIAINFO_DASHMPD_YES) #include "MediaInfo/Multiple/File_DashMpd.h" #endif #if defined(MEDIAINFO_DCP_YES) #include "MediaInfo/Multiple/File_DcpAm.h" #endif #if defined(MEDIAINFO_DCP_YES) #include "MediaInfo/Multiple/File_DcpCpl.h" #endif #if defined(MEDIAINFO_DCP_YES) #include "MediaInfo/Multiple/File_DcpPkl.h" #endif #if defined(MEDIAINFO_DPG_YES) #include "MediaInfo/Multiple/File_Dpg.h" #endif #if defined(MEDIAINFO_DVDIF_YES) #include "MediaInfo/Multiple/File_DvDif.h" #endif #if defined(MEDIAINFO_DVDV_YES) #include "MediaInfo/Multiple/File_Dvdv.h" #endif #if defined(MEDIAINFO_DXW_YES) #include "MediaInfo/Multiple/File_Dxw.h" #endif #if defined(MEDIAINFO_FLV_YES) #include "MediaInfo/Multiple/File_Flv.h" #endif #if defined(MEDIAINFO_GXF_YES) #include "MediaInfo/Multiple/File_Gxf.h" #endif #if defined(MEDIAINFO_HDSF4M_YES) #include "MediaInfo/Multiple/File_HdsF4m.h" #endif #if defined(MEDIAINFO_HLS_YES) #include "MediaInfo/Multiple/File_Hls.h" #endif #if defined(MEDIAINFO_ISM_YES) #include "MediaInfo/Multiple/File_Ism.h" #endif #if defined(MEDIAINFO_IVF_YES) #include "MediaInfo/Multiple/File_Ivf.h" #endif #if defined(MEDIAINFO_LXF_YES) #include "MediaInfo/Multiple/File_Lxf.h" #endif #if defined(MEDIAINFO_MK_YES) #include "MediaInfo/Multiple/File_Mk.h" #endif #if defined(MEDIAINFO_MPEG4_YES) #include "MediaInfo/Multiple/File_Mpeg4.h" #endif #if defined(MEDIAINFO_MPEGPS_YES) #include "MediaInfo/Multiple/File_MpegPs.h" #endif #if defined(MEDIAINFO_MPEGTS_YES) || defined(MEDIAINFO_BDAV_YES) || defined(MEDIAINFO_TSP_YES) #include "MediaInfo/Multiple/File_MpegTs.h" #endif #if defined(MEDIAINFO_MXF_YES) #include "MediaInfo/Multiple/File_Mxf.h" #endif #if defined(MEDIAINFO_NUT_YES) #include "MediaInfo/Multiple/File_Nut.h" #endif #if defined(MEDIAINFO_OGG_YES) #include "MediaInfo/Multiple/File_Ogg.h" #endif #if defined(MEDIAINFO_P2_YES) #include "MediaInfo/Multiple/File_P2_Clip.h" #endif #if defined(MEDIAINFO_PMP_YES) #include "MediaInfo/Multiple/File_Pmp.h" #endif #if defined(MEDIAINFO_PTX_YES) #include "MediaInfo/Multiple/File_Ptx.h" #endif #if defined(MEDIAINFO_RIFF_YES) #include "MediaInfo/Multiple/File_Riff.h" #endif #if defined(MEDIAINFO_RM_YES) #include "MediaInfo/Multiple/File_Rm.h" #endif #if defined(MEDIAINFO_SEQUENCEINFO_YES) #include "MediaInfo/Multiple/File_SequenceInfo.h" #endif #if defined(MEDIAINFO_SKM_YES) #include "MediaInfo/Multiple/File_Skm.h" #endif #if defined(MEDIAINFO_SWF_YES) #include "MediaInfo/Multiple/File_Swf.h" #endif #if defined(MEDIAINFO_WM_YES) #include "MediaInfo/Multiple/File_Wm.h" #endif #if defined(MEDIAINFO_XDCAM_YES) #include "MediaInfo/Multiple/File_Xdcam_Clip.h" #endif //--------------------------------------------------------------------------- // Video #if defined(MEDIAINFO_AVC_YES) #include "MediaInfo/Video/File_Avc.h" #endif #if defined(MEDIAINFO_AVSV_YES) #include "MediaInfo/Video/File_AvsV.h" #endif #if defined(MEDIAINFO_DIRAC_YES) #include "MediaInfo/Video/File_Dirac.h" #endif #if defined(MEDIAINFO_FLIC_YES) #include "MediaInfo/Video/File_Flic.h" #endif #if defined(MEDIAINFO_H263_YES) #include "MediaInfo/Video/File_H263.h" #endif #if defined(MEDIAINFO_MPEG4V_YES) #include "MediaInfo/Video/File_Mpeg4v.h" #endif #if defined(MEDIAINFO_MPEGV_YES) #include "MediaInfo/Video/File_Mpegv.h" #endif #if defined(MEDIAINFO_VC1_YES) #include "MediaInfo/Video/File_Vc1.h" #endif #if defined(MEDIAINFO_VC3_YES) #include "MediaInfo/Video/File_Vc3.h" #endif #if defined(MEDIAINFO_Y4M_YES) #include "MediaInfo/Video/File_Y4m.h" #endif //--------------------------------------------------------------------------- // Audio #if defined(MEDIAINFO_AAC_YES) #include "MediaInfo/Audio/File_Aac.h" #endif #if defined(MEDIAINFO_AC3_YES) #include "MediaInfo/Audio/File_Ac3.h" #endif #if defined(MEDIAINFO_SMPTEST0337_YES) #include "MediaInfo/Audio/File_SmpteSt0337.h" #endif #if defined(MEDIAINFO_ALS_YES) #include "MediaInfo/Audio/File_Als.h" #endif #if defined(MEDIAINFO_AMR_YES) #include "MediaInfo/Audio/File_Amr.h" #endif #if defined(MEDIAINFO_AMV_YES) #include "MediaInfo/Audio/File_Amv.h" #endif #if defined(MEDIAINFO_APE_YES) #include "MediaInfo/Audio/File_Ape.h" #endif #if defined(MEDIAINFO_AU_YES) #include "MediaInfo/Audio/File_Au.h" #endif #if defined(MEDIAINFO_DTS_YES) #include "MediaInfo/Audio/File_Dts.h" #endif #if defined(MEDIAINFO_XM_YES) #include "MediaInfo/Audio/File_ExtendedModule.h" #endif #if defined(MEDIAINFO_FLAC_YES) #include "MediaInfo/Audio/File_Flac.h" #endif #if defined(MEDIAINFO_IT_YES) #include "MediaInfo/Audio/File_ImpulseTracker.h" #endif #if defined(MEDIAINFO_LA_YES) #include "MediaInfo/Audio/File_La.h" #endif #if defined(MEDIAINFO_MIDI_YES) #include "MediaInfo/Audio/File_Midi.h" #endif #if defined(MEDIAINFO_MOD_YES) #include "MediaInfo/Audio/File_Module.h" #endif #if defined(MEDIAINFO_MPC_YES) #include "MediaInfo/Audio/File_Mpc.h" #endif #if defined(MEDIAINFO_MPCSV8_YES) #include "MediaInfo/Audio/File_MpcSv8.h" #endif #if defined(MEDIAINFO_MPEGA_YES) #include "MediaInfo/Audio/File_Mpega.h" #endif #if defined(MEDIAINFO_PCM_YES) #include "MediaInfo/Audio/File_Pcm.h" #endif #if defined(MEDIAINFO_RKAU_YES) #include "MediaInfo/Audio/File_Rkau.h" #endif #if defined(MEDIAINFO_S3M_YES) #include "MediaInfo/Audio/File_ScreamTracker3.h" #endif #if defined(MEDIAINFO_TAK_YES) #include "MediaInfo/Audio/File_Tak.h" #endif #if defined(MEDIAINFO_TTA_YES) #include "MediaInfo/Audio/File_Tta.h" #endif #if defined(MEDIAINFO_TWINVQ_YES) #include "MediaInfo/Audio/File_TwinVQ.h" #endif #if defined(MEDIAINFO_WVPK_YES) #include "MediaInfo/Audio/File_Wvpk.h" #endif //--------------------------------------------------------------------------- // Text #if defined(MEDIAINFO_N19_YES) #include "MediaInfo/Text/File_N19.h" #endif #if defined(MEDIAINFO_SCC_YES) #include "MediaInfo/Text/File_Scc.h" #endif #if defined(MEDIAINFO_SUBRIP_YES) #include "MediaInfo/Text/File_SubRip.h" #endif #if defined(MEDIAINFO_TTML_YES) #include "MediaInfo/Text/File_Ttml.h" #endif #if defined(MEDIAINFO_OTHERTEXT_YES) #include "MediaInfo/Text/File_OtherText.h" #endif //--------------------------------------------------------------------------- // Image #if defined(MEDIAINFO_BMP_YES) #include "MediaInfo/Image/File_Bmp.h" #endif #if defined(MEDIAINFO_GIF_YES) #include "MediaInfo/Image/File_Gif.h" #endif #if defined(MEDIAINFO_ICO_YES) #include "MediaInfo/Image/File_Ico.h" #endif #if defined(MEDIAINFO_JPEG_YES) #include "MediaInfo/Image/File_Jpeg.h" #endif #if defined(MEDIAINFO_PCX_YES) #include "MediaInfo/Image/File_Pcx.h" #endif #if defined(MEDIAINFO_PNG_YES) #include "MediaInfo/Image/File_Png.h" #endif #if defined(MEDIAINFO_PSD_YES) #include "MediaInfo/Image/File_Psd.h" #endif #if defined(MEDIAINFO_TIFF_YES) #include "MediaInfo/Image/File_Tiff.h" #endif #if defined(MEDIAINFO_TIFF_YES) #include "MediaInfo/Image/File_Tga.h" #endif //--------------------------------------------------------------------------- // Archive #if defined(MEDIAINFO_7Z_YES) #include "MediaInfo/Archive/File_7z.h" #endif #if defined(MEDIAINFO_ACE_YES) #include "MediaInfo/Archive/File_Ace.h" #endif #if defined(MEDIAINFO_BZIP2_YES) #include "MediaInfo/Archive/File_Bzip2.h" #endif #if defined(MEDIAINFO_ELF_YES) #include "MediaInfo/Archive/File_Elf.h" #endif #if defined(MEDIAINFO_GZIP_YES) #include "MediaInfo/Archive/File_Gzip.h" #endif #if defined(MEDIAINFO_ISO9660_YES) #include "MediaInfo/Archive/File_Iso9660.h" #endif #if defined(MEDIAINFO_MZ_YES) #include "MediaInfo/Archive/File_Mz.h" #endif #if defined(MEDIAINFO_RAR_YES) #include "MediaInfo/Archive/File_Rar.h" #endif #if defined(MEDIAINFO_TAR_YES) #include "MediaInfo/Archive/File_Tar.h" #endif #if defined(MEDIAINFO_ZIP_YES) #include "MediaInfo/Archive/File_Zip.h" #endif //--------------------------------------------------------------------------- // Other #if !defined(MEDIAINFO_OTHER_NO) #include "MediaInfo/File_Other.h" #endif #include "MediaInfo/File_Unknown.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Out //*************************************************************************** //--------------------------------------------------------------------------- File__Analyze* File__MultipleParsing::Parser_Get() { if (Parser.size()!=1) return NULL; File__Analyze* ToReturn=Parser[0]; //The first parser Parser.clear(); return ToReturn; } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File__MultipleParsing::File__MultipleParsing() :File__Analyze() { #if MEDIAINFO_TRACE Trace_DoNotSave=true; #endif //MEDIAINFO_TRACE // Multiple #if defined(MEDIAINFO_AAF_YES) Parser.push_back(new File_Aaf()); #endif #if defined(MEDIAINFO_BDAV_YES) {File_MpegTs* Temp=new File_MpegTs(); Temp->BDAV_Size=4; Parser.push_back(Temp);} #endif #if defined(MEDIAINFO_CDXA_YES) Parser.push_back(new File_Cdxa()); #endif #if defined(MEDIAINFO_DASHMPD_YES) Parser.push_back(new File_DashMpd()); #endif #if defined(MEDIAINFO_DCP_YES) Parser.push_back(new File_DcpAm()); #endif #if defined(MEDIAINFO_DCP_YES) Parser.push_back(new File_DcpCpl()); #endif #if defined(MEDIAINFO_DCP_YES) Parser.push_back(new File_DcpPkl()); #endif #if defined(MEDIAINFO_DPG_YES) Parser.push_back(new File_Dpg()); #endif #if defined(MEDIAINFO_DVDIF_YES) Parser.push_back(new File_DvDif()); #endif #if defined(MEDIAINFO_DVDV_YES) Parser.push_back(new File_Dvdv()); #endif #if defined(MEDIAINFO_DXW_YES) Parser.push_back(new File_Dxw()); #endif #if defined(MEDIAINFO_FLV_YES) Parser.push_back(new File_Flv()); #endif #if defined(MEDIAINFO_GXF_YES) Parser.push_back(new File_Gxf()); #endif #if defined(MEDIAINFO_HDSF4M_YES) Parser.push_back(new File_HdsF4m()); #endif #if defined(MEDIAINFO_HLS_YES) Parser.push_back(new File_Hls()); #endif #if defined(MEDIAINFO_ISM_YES) Parser.push_back(new File_Ism()); #endif #if defined(MEDIAINFO_IVF_YES) Parser.push_back(new File_Ivf()); #endif #if defined(MEDIAINFO_LXF_YES) Parser.push_back(new File_Lxf()); #endif #if defined(MEDIAINFO_MK_YES) Parser.push_back(new File_Mk()); #endif #if defined(MEDIAINFO_MPEG4_YES) Parser.push_back(new File_Mpeg4()); #endif #if defined(MEDIAINFO_MPEGPS_YES) Parser.push_back(new File_MpegPs()); #endif #if defined(MEDIAINFO_MPEGTS_YES) Parser.push_back(new File_MpegTs()); #endif #if defined(MEDIAINFO_TSP_YES) {File_MpegTs* Temp=new File_MpegTs(); Temp->TSP_Size=16; Parser.push_back(Temp);} #endif #if defined(MEDIAINFO_MXF_YES) Parser.push_back(new File_Mxf()); #endif #if defined(MEDIAINFO_NUT_YES) Parser.push_back(new File_Nut()); #endif #if defined(MEDIAINFO_OGG_YES) Parser.push_back(new File_Ogg()); #endif #if defined(MEDIAINFO_P2_YES) Parser.push_back(new File_P2_Clip()); #endif #if defined(MEDIAINFO_PMP_YES) Parser.push_back(new File_Pmp()); #endif #if defined(MEDIAINFO_RIFF_YES) Parser.push_back(new File_Riff()); #endif #if defined(MEDIAINFO_RM_YES) Parser.push_back(new File_Rm()); #endif #if defined(MEDIAINFO_SEQUENCEINFO_YES) Parser.push_back(new File_SequenceInfo()); #endif #if defined(MEDIAINFO_SKM_YES) Parser.push_back(new File_Skm()); #endif #if defined(MEDIAINFO_SWF_YES) Parser.push_back(new File_Swf()); #endif #if defined(MEDIAINFO_WM_YES) Parser.push_back(new File_Wm()); #endif #if defined(MEDIAINFO_XDCAM_YES) Parser.push_back(new File_Xdcam_Clip()); #endif // Video #if defined(MEDIAINFO_AVC_YES) Parser.push_back(new File_Avc()); #endif #if defined(MEDIAINFO_AVSV_YES) Parser.push_back(new File_AvsV()); #endif #if defined(MEDIAINFO_DIRAC_YES) Parser.push_back(new File_Dirac()); #endif #if defined(MEDIAINFO_FLIC_YES) Parser.push_back(new File_Flic()); #endif #if defined(MEDIAINFO_H263_YES) Parser.push_back(new File_H263()); #endif #if defined(MEDIAINFO_MPEG4V_YES) Parser.push_back(new File_Mpeg4v()); #endif #if defined(MEDIAINFO_MPEGV_YES) Parser.push_back(new File_Mpegv()); #endif #if defined(MEDIAINFO_VC1_YES) Parser.push_back(new File_Vc1()); #endif #if defined(MEDIAINFO_Y4M_YES) Parser.push_back(new File_Y4m()); #endif // Audio #if defined(MEDIAINFO_AAC_YES) {File_Aac* Temp=new File_Aac(); Temp->Mode=File_Aac::Mode_ADIF; Parser.push_back(Temp);} #endif #if defined(MEDIAINFO_AAC_YES) {File_Aac* Temp=new File_Aac(); Temp->Mode=File_Aac::Mode_ADTS; Parser.push_back(Temp);} #endif #if defined(MEDIAINFO_AC3_YES) Parser.push_back(new File_Ac3()); #endif #if defined(MEDIAINFO_SMPTEST0337_YES) Parser.push_back(new File_SmpteSt0337()); #endif #if defined(MEDIAINFO_ALS_YES) Parser.push_back(new File_Als()); #endif #if defined(MEDIAINFO_AMR_YES) Parser.push_back(new File_Amr()); #endif #if defined(MEDIAINFO_AMV_YES) Parser.push_back(new File_Amv()); #endif #if defined(MEDIAINFO_APE_YES) Parser.push_back(new File_Ape()); #endif #if defined(MEDIAINFO_AU_YES) Parser.push_back(new File_Au()); #endif #if defined(MEDIAINFO_DTS_YES) Parser.push_back(new File_Dts()); #endif #if defined(MEDIAINFO_FLAC_YES) Parser.push_back(new File_Flac()); #endif #if defined(MEDIAINFO_IT_YES) Parser.push_back(new File_ImpulseTracker()); #endif #if defined(MEDIAINFO_LA_YES) Parser.push_back(new File_La()); #endif #if defined(MEDIAINFO_MIDI_YES) Parser.push_back(new File_Midi()); #endif #if defined(MEDIAINFO_MOD_YES) Parser.push_back(new File_Module()); #endif #if defined(MEDIAINFO_MPC_YES) Parser.push_back(new File_Mpc()); #endif #if defined(MEDIAINFO_MPCSV8_YES) Parser.push_back(new File_MpcSv8()); #endif #if defined(MEDIAINFO_MPEGA_YES) Parser.push_back(new File_Mpega()); #endif #if defined(MEDIAINFO_RKAU_YES) Parser.push_back(new File_Rkau()); #endif #if defined(MEDIAINFO_S3M_YES) Parser.push_back(new File_ScreamTracker3()); #endif #if defined(MEDIAINFO_TAK_YES) Parser.push_back(new File_Tak()); #endif #if defined(MEDIAINFO_TTA_YES) Parser.push_back(new File_Tta()); #endif #if defined(MEDIAINFO_TWINVQ_YES) Parser.push_back(new File_TwinVQ()); #endif #if defined(MEDIAINFO_WVPK_YES) Parser.push_back(new File_Wvpk()); #endif #if defined(MEDIAINFO_XM_YES) Parser.push_back(new File_ExtendedModule()); #endif // Text #if defined(MEDIAINFO_N19_YES) Parser.push_back(new File_N19()); #endif #if defined(MEDIAINFO_SCC_YES) Parser.push_back(new File_Scc()); #endif #if defined(MEDIAINFO_SUBRIP_YES) Parser.push_back(new File_SubRip()); #endif #if defined(MEDIAINFO_TTML_YES) Parser.push_back(new File_Ttml()); #endif #if defined(MEDIAINFO_OTHERTEXT_YES) Parser.push_back(new File_OtherText()); #endif // Image #if defined(MEDIAINFO_BMP_YES) Parser.push_back(new File_Bmp()); #endif #if defined(MEDIAINFO_GIF_YES) Parser.push_back(new File_Gif()); #endif #if defined(MEDIAINFO_ICO_YES) Parser.push_back(new File_Ico()); #endif #if defined(MEDIAINFO_JPEG_YES) Parser.push_back(new File_Jpeg()); #endif #if defined(MEDIAINFO_PCX_YES) Parser.push_back(new File_Pcx()); #endif #if defined(MEDIAINFO_PNG_YES) Parser.push_back(new File_Png()); #endif #if defined(MEDIAINFO_PSD_YES) Parser.push_back(new File_Psd()); #endif #if defined(MEDIAINFO_TIFF_YES) Parser.push_back(new File_Tiff()); #endif #if defined(MEDIAINFO_TGA_YES) Parser.push_back(new File_Tga()); #endif // Archive #if defined(MEDIAINFO_7Z_YES) Parser.push_back(new File_7z()); #endif #if defined(MEDIAINFO_ACE_YES) Parser.push_back(new File_Ace()); #endif #if defined(MEDIAINFO_BZIP2_YES) Parser.push_back(new File_Bzip2()); #endif #if defined(MEDIAINFO_ELF_YES) Parser.push_back(new File_Elf()); #endif #if defined(MEDIAINFO_GZIP_YES) Parser.push_back(new File_Gzip()); #endif #if defined(MEDIAINFO_ISO9660_YES) Parser.push_back(new File_Iso9660()); #endif #if defined(MEDIAINFO_MZ_YES) Parser.push_back(new File_Mz()); #endif #if defined(MEDIAINFO_RAR_YES) Parser.push_back(new File_Rar()); #endif #if defined(MEDIAINFO_TAR_YES) Parser.push_back(new File_Tar()); #endif #if defined(MEDIAINFO_ZIP_YES) Parser.push_back(new File_Zip()); #endif #if defined(MEDIAINFO_OTHER_YES) Parser.push_back(new File_Other()); #endif } //--------------------------------------------------------------------------- File__MultipleParsing::~File__MultipleParsing() { for (size_t Pos=0; PosOpen_Buffer_Finalize(); #if MEDIAINFO_TRACE Details=Parser[0]->Details; #endif //MEDIAINFO_TRACE } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File__MultipleParsing::Read_Buffer_Init() { //Parsing for (size_t Pos=0; PosInit(Config, Details, Stream, Stream_More); #else //MEDIAINFO_TRACE Parser[Pos]->Init(Config, Stream, Stream_More); #endif //MEDIAINFO_TRACE Parser[Pos]->File_Name=File_Name; Parser[Pos]->Open_Buffer_Init(File_Size); } } //--------------------------------------------------------------------------- void File__MultipleParsing::Read_Buffer_Unsynched() { //Parsing for (size_t Pos=0; PosOpen_Buffer_Unsynch(); } //--------------------------------------------------------------------------- void File__MultipleParsing::Read_Buffer_Continue() { //Parsing for (size_t Pos=0; PosOpen_Buffer_Continue(Buffer+Buffer_Offset, (size_t)Element_Size); if (File_Offset+Buffer_Size==File_Size) Parser[Pos]->Open_Buffer_Finalize(); //Testing if the parser failed if (Parser[Pos]->Status[IsFinished] && !Parser[Pos]->Status[IsAccepted]) { delete Parser[Pos]; Parser.erase(Parser.begin()+Pos); Pos--; //for the next position if (Parser.empty()) { File__Analyze* Temp=new File_Unknown(); Parser.push_back(Temp); Read_Buffer_Init(); } } else { //If Parser is found, erasing all the other parsers if (Parser.size()>1 && Parser[Pos]->Status[IsAccepted]) { File__Analyze* Temp=Parser[Pos]; for (size_t To_Delete_Pos=0; To_Delete_PosStatus[IsAccepted]) Status[IsAccepted]=true; if (!Status[IsFilled] && Parser[Pos]->Status[IsFilled]) Status[IsFilled]=true; if (!Status[IsUpdated] && Parser[Pos]->Status[IsUpdated]) Status[IsUpdated]=true; if (!Status[IsFinished] && Parser[Pos]->Status[IsFinished]) Status[IsFinished]=true; //Positionning if requested if (Parser[0]->File_GoTo!=(int64u)-1) File_GoTo=Parser[0]->File_GoTo; } } } } } //NameSpace MediaInfoLib/Source/MediaInfo/File__MultipleParsing.h100777 0 0 2752 12226004261 16141 0/* 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_MpegH #define MediaInfo_MpegH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File__MultipleParsing //*************************************************************************** class File__MultipleParsing : public File__Analyze { public : //Out File__Analyze* Parser_Get(); //Constructor File__MultipleParsing(); ~File__MultipleParsing(); private : //Streams management void Streams_Finish(); //Buffer - Global void Read_Buffer_Init(); void Read_Buffer_Unsynched(); void Read_Buffer_Continue(); //Temp std::vector Parser; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Image/ 40777 0 0 0 12255606366 12507 5MediaInfoLib/Source/MediaInfo/Image/File_Bmp.cpp100777 0 0 22136 12226004262 14775 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // BMP - Format //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // From http://www.onicos.com/staff/iz/formats/bmp.html // // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_BMP_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Image/File_Bmp.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* Bmp_CompressionMethod(int32u CompressionMethod) { switch(CompressionMethod) { case 0 : return "RGB"; case 1 : return "RLE"; case 2 : return "RLE"; case 3 : return "Bit field"; case 4 : return "JPEG"; case 5 : return "PNG"; default: return ""; } } //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_Bmp::FileHeader_Begin() { //Element_Size if (Buffer_Size<2) return false; //Must wait for more data if (CC2(Buffer)!=0x424D) //"BM" { Reject("BMP"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Bmp::Read_Buffer_Continue() { //Parsing int32u Size, DIB_Size, Offset; Element_Begin1("File header"); Skip_C2( "Magic"); Get_L4 (Size, "Size"); Skip_L2( "Reserved"); Skip_L2( "Reserved"); Get_L4 (Offset, "Offset of data"); Element_End0(); FILLING_BEGIN(); if (Size!=File_Size) { Reject("BMP"); return; } Accept("BMP"); Fill(Stream_General, 0, General_Format, "Bitmap"); Stream_Prepare(Stream_Image); FILLING_END(); Element_Begin1("DIB header"); Peek_L4 (DIB_Size); switch (DIB_Size) { case 12 : Skip_XX(DIB_Size-4, "OS/2 v1 header"); break; case 40 : BitmapInfoHeader(); break; case 52 : Skip_XX(DIB_Size-4, "BitmapV2Header"); break; case 56 : Skip_XX(DIB_Size-4, "BitmapV3Header"); break; case 64 : Skip_XX(DIB_Size-4, "OS/2 v2 header"); break; case 108 : BitmapV4Header(); break; case 124 : Skip_XX(DIB_Size-4, "BitmapV5Header"); break; default : Skip_XX(DIB_Size-4, "Unknown header"); ; } Element_End0(); Skip_XX(Offset-Element_Offset, "Color palette"); Skip_XX(Element_Size-Offset, "Bitmap data"); //No need of more Finish("BMP"); } //*************************************************************************** // Buffer - Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Bmp::BitmapInfoHeader() { //Parsing Element_Begin1("Bitmap Info header"); int32u Width, Height, CompressionMethod; int16u BitsPerPixel; Skip_L4( "Size"); Get_L4 (Width, "Width"); Get_L4 (Height, "Height"); Skip_L2( "Color planes"); Get_L2 (BitsPerPixel, "Bits per pixel"); Get_L4 (CompressionMethod, "Compression method"); Param_Info1(Bmp_CompressionMethod(CompressionMethod)); Skip_L4( "Image size"); Skip_L4( "Horizontal resolution"); Skip_L4( "Vertical resolution"); Skip_L4( "Number of colors in the color palette"); Skip_L4( "Number of important colors used"); Element_End0(); FILLING_BEGIN(); Fill(Stream_Image, 0, Image_Width, Width); Fill(Stream_Image, 0, Image_Height, Height); Fill(Stream_Image, 0, Image_BitDepth, BitsPerPixel); Fill(Stream_Image, 0, Image_Format, Bmp_CompressionMethod(CompressionMethod)); Fill(Stream_Image, 0, Image_Codec, Bmp_CompressionMethod(CompressionMethod)); FILLING_END(); } void File_Bmp::BitmapV4Header() { //Parsing Element_Begin1("Bitmap V4 header"); int32u Width, Height, CompressionMethod; int16u BitsPerPixel; Skip_L4( "Size"); Get_L4 (Width, "Width"); Get_L4 (Height, "Height"); Skip_L2( "Color planes"); Get_L2 (BitsPerPixel, "Bits per pixel"); Get_L4 (CompressionMethod, "Compression method"); Param_Info1(Bmp_CompressionMethod(CompressionMethod)); Skip_L4( "Image size"); Skip_L4( "Horizontal resolution"); Skip_L4( "Vertical resolution"); Skip_L4( "Number of colors in the color palette"); Skip_L4( "Number of important colors used"); Skip_L4( "Red Channel bit mask"); Skip_L4( "Green Channel bit mask"); Skip_L4( "Blue Channel bit mask"); Skip_L4( "Alpha Channel bit mask"); Skip_L4( "Color Space endpoints"); Skip_L4( "Color Space endpoints"); Skip_L4( "Color Space endpoints"); Skip_L4( "Color Space endpoints"); Skip_L4( "Color Space endpoints"); Skip_L4( "Color Space endpoints"); Skip_L4( "Color Space endpoints"); Skip_L4( "Red Gamma"); Skip_L4( "Green Gamma"); Skip_L4( "Blue Gamma"); Element_End0(); FILLING_BEGIN(); Fill(Stream_Image, 0, Image_Width, Width); Fill(Stream_Image, 0, Image_Height, Height); Fill(Stream_Image, 0, Image_BitDepth, BitsPerPixel); Fill(Stream_Image, 0, Image_Format, Bmp_CompressionMethod(CompressionMethod)); Fill(Stream_Image, 0, Image_Codec, Bmp_CompressionMethod(CompressionMethod)); FILLING_END(); } } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Image/File_Bmp.h100777 0 0 2454 12226004262 14423 0/* 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 Bitmap files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_BmpH #define MediaInfo_File_BmpH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Bmp //*************************************************************************** class File_Bmp : public File__Analyze { protected : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Continue (); //Elements void BitmapInfoHeader(); void BitmapV4Header(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Image/File_Dpx.cpp100777 0 0 112533 12226004262 15033 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DPX_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Image/File_Dpx.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* DPX_Orientation[]= { "Left to right, Top to bottom", "Right to left, Top to bottom", "Left to right, Bottom to top", "Right to left, Bottom to top", "Top to bottom, Left to right", "Top to bottom, Right to left", "Bottom to top, Left to right", "Bottom to top, Right to left", "Reserved for future use" }; //--------------------------------------------------------------------------- const char* DPX_Descriptors0[]= { "User defined (or unspecified single component)", "Red (R)", "Green (G)", "Blue (B)", "Alpha (matte)", "", //No info "Luma (Y)", "Color Difference (CB, CR, subsampled by two)", "Depth (Z)", "Composite video" }; const char* DPX_Descriptors50[]= { "R,G,B", "R,G,B, Alpha (A)", "A, B, G, R" }; const char* DPX_Descriptors100[]= { "CB, Y, CR, Y (4:2:2) ---- based on SMPTE 125M", "CB, Y, A, CR, Y, A (4:2:2:4)", "CB, Y, CR (4:4:4)", "CB, Y, CR, A (4:4:4:4)" }; const char* DPX_Descriptors150[]= { "User-defined 2-component element", "User-defined 3-component element", "User-defined 4-component element", "User-defined 5-component element", "User-defined 6-component element", "User-defined 7-component element", "User-defined 8-component element" }; const char* DPX_Descriptors(int8u i) { if(i<10) return DPX_Descriptors0[i]; if(i<50) return "Reserved for future single components"; if(i<53) return DPX_Descriptors50[i-50]; if(i<100) return "Reserved for future RGB ++ formats"; if(i<104) return DPX_Descriptors100[i-100]; if(i<150) return "Reserved for future CBYCR ++ formats"; if(i<157) return "Reserved for future single components"; return "Reserved for future formats"; } //--------------------------------------------------------------------------- const char* Mpegv_transfer_characteristics(int8u transfer_characteristics); const char* DPX_TransferCharacteristic(int8u TransferCharacteristic) { switch (TransferCharacteristic) { case 1 : return "Printing density"; case 2 : return Mpegv_transfer_characteristics(8); //Linear case 3 : return "Logarithmic"; //Value not specified in specs case 5 : //SMPTE 274M, for HDTV, mapped to BT.709 case 6 : return Mpegv_transfer_characteristics(1); //BT.709 case 7 : return Mpegv_transfer_characteristics(5); //BT.470 System B, BT.470 System G (typo in specs?) case 8 : return Mpegv_transfer_characteristics(4); //BT.470 System M (typo in specs?) case 9 : //BT.601 (NTSC) case 10 : return Mpegv_transfer_characteristics(6); //BT.601 (PAL) case 11 : return "Z (depth) - linear"; case 12 : return "Z (depth) - homogeneous"; default : return ""; } }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- const char* Mpegv_colour_primaries(int8u colour_primaries); const char* DPX_ColorimetricSpecification(int8u ColorimetricSpecification) { switch (ColorimetricSpecification) { case 1 : return "Printing density"; case 5 : //SMPTE 274M, for HDTV, mapped to BT.709 case 6 : return Mpegv_colour_primaries(1); //BT.709 case 7 : return Mpegv_colour_primaries(5); //BT.470 System B, BT.470 System G (typo in specs?), mapped to BT.601 PAL case 8 : return Mpegv_colour_primaries(6); //BT.470 System M (typo in specs?), mapped to BT.601 NTSC case 9 : return Mpegv_colour_primaries(6); //BT.601 NTSC case 10 : return Mpegv_colour_primaries(5); //BT.601 PAL default : return ""; } } //--------------------------------------------------------------------------- const char* DPX_ValidBitDephs(int8u i) { switch(i) { case 1 : case 8 : case 10 : case 12 : case 16 : return "integer"; case 32 : return "IEEE floating point (R32)"; case 64 : return "IEEE floating point (R64)"; default : return "invalid"; } } //--------------------------------------------------------------------------- const char* DPX_ComponentDataPackingMethod[]= { "Packed into 32-bit words", "Filled to 32-bit words, method A", "Filled to 32-bit words, method B", "Reserved for future use", "Reserved for future use", "Reserved for future use", "Reserved for future use", "Reserved for future use" }; //--------------------------------------------------------------------------- const char* DPX_ComponentDataEncodingMethod[]= { "No encoding applied", "Run-length encoded", "Reserved for future use", "Reserved for future use", "Reserved for future use", "Reserved for future use", "Reserved for future use", "Reserved for future use" }; //--------------------------------------------------------------------------- const char* DPX_VideoSignalStandard0[]= { "Undefined", "NTSC", "PAL", "PAL-M", "SECAM" }; const char* DPX_VideoSignalStandard50[]= { "YCBCR ITU-R 601-5 525-line, 2:1 interlace, 4:3 aspect ratio", "YCBCR ITU-R 601-5 625-line, 2:1 interlace, 4:3 aspect ratio" }; const char* DPX_VideoSignalStandard100[]= { "YCBCR ITU-R 601-5 525-line, 2:1 interlace, 16:9 aspect ratio", "YCBCR ITU-R 601-5 625-line, 2:1 interlace, 16:9 aspect ratio" }; const char* DPX_VideoSignalStandard150[]= { "YCBCR 1050-line, 2:1 interlace, 16:9 aspect ratio", "YCBCR 1125-line, 2:1 interlace, 16:9 aspect ratio (SMPTE 274M)", "YCBCR 1250-line, 2:1 interlace, 16:9 aspect ratio", "YCBCR 1125-line, 2:1 interlace, 16:9 aspect ratio (SMPTE 240M)" }; const char* DPX_VideoSignalStandard200[]= { "YCBCR 525-line, 1:1 progressive, 16:9 aspect ratio", "YCBCR 625-line, 1:1 progressive, 16:9 aspect ratio", "YCBCR 750-line, 1:1 progressive, 16:9 aspect ratio (SMPTE 296M)", "YCBCR 1125-line, 1:1 progressive, 16:9 aspect ratio (SMPTE 274M)" }; const char* DPX_VideoSignalStandard(int8u i) { if(i<5) return DPX_VideoSignalStandard0[i]; if(i<50) return "Reserved for other composite video"; if(i<52) return DPX_VideoSignalStandard50[i-50]; if(i<100) return "Reserved for future component video"; if(i<102) return DPX_VideoSignalStandard100[i-100]; if(i<150) return "Reserved for future widescreen"; if(i<154) return DPX_VideoSignalStandard150[i-150]; if(i<200) return "Reserved for future high-definition interlace"; if(i<204) return DPX_VideoSignalStandard200[i-200]; return "Reserved for future high-definition progressive"; } //*************************************************************************** // Const //*************************************************************************** enum Elements { Pos_GenericSection, Pos_IndustrySpecific, Pos_UserDefined, Pos_Padding, Pos_ImageData, }; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Dpx::File_Dpx() :File__Analyze() { //Configuration ParserName=__T("DPX"); } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Dpx::Streams_Accept() { Fill(Stream_General, 0, General_Format, "DPX"); Fill(Stream_General, 0, General_Format_Version, Version==1?"Version 1":"Version 2"); if (!IsSub) { TestContinuousFileNames(); Stream_Prepare((Config->File_Names.size()>1 || Config->File_IsReferenced_Get())?Stream_Video:Stream_Image); Fill(StreamKind_Last, StreamPos_Last, "StreamSize", File_Size); if (StreamKind_Last==Stream_Video) Fill(Stream_Video, StreamPos_Last, Video_FrameCount, Config->File_Names.size()); } else Stream_Prepare(Stream_Image); //Configuration Buffer_MaximumSize=64*1024*1024; //Some big frames are possible (e.g YUV 4:2:2 10 bits 1080p) Frame_Count_NotParsedIncluded=0; } //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- bool File_Dpx::FileHeader_Begin() { //Element_Size if (Buffer_Size<4) return false; //Must wait for more data int32u Magic=CC4(Buffer); switch (Magic) { case 0x802A5FD7 : // (v1 Big) case 0xD75F2A80 : // (v1 Little) case 0x53445058 : //"SPDX" (v2 Big) case 0x58504453 : //"XDPS" (v2 Little) break; default : Reject(); return false; } //Generic Section size if (Buffer_Size<28) return false; //Must wait for more data Sizes_Pos=Pos_GenericSection; switch (Magic) { case 0x802A5FD7 : // (v1 Big) case 0xD75F2A80 : // (v1 Little) Version=1; break; case 0x58504453 : //"XDPS" (v2 Little) case 0x53445058 : //"SPDX" (v2 Big) Version=2; break; default : ; } switch (Magic) { case 0xD75F2A80 : // (v1 Little) case 0x58504453 : //"XDPS" (v2 Little) LittleEndian=true; break; case 0x802A5FD7 : // (v1 Big) case 0x53445058 : //"SPDX" (v2 Big) LittleEndian=false; break; default : ; } //All should be OK... Accept(); return true; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Dpx::Header_Parse() { //Filling Header_Fill_Code(Sizes_Pos); //We use Sizes_Pos as the unique key if (Sizes.empty()) { if (Element_Size<28) { Element_WaitForMoreData(); return; } int32u Size=LittleEndian?LittleEndian2int32u(Buffer+Buffer_Offset+24):BigEndian2int32u(Buffer+Buffer_Offset+24); if (Size==(int32u)-1) Size=LittleEndian?LittleEndian2int32u(Buffer+Buffer_Offset+4):BigEndian2int32u(Buffer+Buffer_Offset+4); Header_Fill_Size(Size); } else Header_Fill_Size(Sizes[Sizes_Pos]); } //--------------------------------------------------------------------------- void File_Dpx::Data_Parse() { if (Version==1) { switch (Element_Code) { case Pos_GenericSection : GenericSectionHeader_v1(); break; case Pos_IndustrySpecific : IndustrySpecificHeader_v1(); break; case Pos_UserDefined : UserDefinedHeader_v1(); break; case Pos_Padding : Padding(); break; case Pos_ImageData : ImageData(); break; default : ; } } else { switch (Element_Code) { case Pos_GenericSection : GenericSectionHeader_v2(); break; case Pos_IndustrySpecific : IndustrySpecificHeader_v2(); break; case Pos_UserDefined : UserDefinedHeader_v2(); break; case Pos_Padding : Padding(); break; case Pos_ImageData : ImageData(); break; default : ; } } do Sizes_Pos++; //We go automaticly to the next block while (Sizes_Pos=Sizes.size()) { Sizes.clear(); Sizes_Pos=0; if (!Status[IsFilled]) Fill(); if (File_Offset+Buffer_Offset+Element_SizeFile_Current_Size) GoTo(Config->File_Current_Size); } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Dpx::GenericSectionHeader_v1() { Element_Name("Generic section header"); //Parsing Element_Begin1("File information"); Ztring CreationDate, CreationTime; 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"); Skip_String(8, "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=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 } FILLING_END(); } //--------------------------------------------------------------------------- void File_Dpx::GenericSectionHeader_v1_ImageElement() { Element_Begin1("image element"); int32u Width, Height; Skip_B1( "Designator - Byte 0"); Skip_B1( "Designator - Byte 1"); Skip_B1( "Bits per pixel"); Skip_B1( "Unused"); Get_X4 (Width, "Pixels per line"); Get_X4 (Height, "Lines per image element"); Skip_BFP4(9, "Minimum data value"); Skip_BFP4(9, "Minimum quantity represented"); Skip_BFP4(9, "Maximum data value"); Skip_BFP4(9, "Maximum quantity represented"); Element_End0(); FILLING_BEGIN(); if (Frame_Count==0) { Fill(StreamKind_Last, StreamPos_Last, "Format", "DPX"); Fill(StreamKind_Last, StreamPos_Last, "Format_Version", "Version 1"); Fill(StreamKind_Last, StreamPos_Last, "Width", Width); Fill(StreamKind_Last, StreamPos_Last, "Height", Height); } FILLING_END(); } //--------------------------------------------------------------------------- void File_Dpx::GenericSectionHeader_v2() { Element_Name("Generic section header"); //Parsing Element_Begin1("File information"); std::string 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"); Skip_String(8, "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; ImageElementFile_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, "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(); } //--------------------------------------------------------------------------- void File_Dpx::GenericSectionHeader_v2_ImageElement() { Element_Begin1("image element"); int8u TransferCharacteristic, ColorimetricSpecification, BitDephs; Info_B4(DataSign, "Data sign");Param_Info1((DataSign==0?"unsigned":"signed")); Skip_B4( "Reference low data code value"); Skip_BFP4(9, "Reference low quantity represented"); Skip_B4( "Reference high data code value"); Skip_BFP4(9, "Reference high quantity represented"); Info_B1(Descriptor, "Descriptor");Param_Info1(DPX_Descriptors(Descriptor)); Get_B1 (TransferCharacteristic, "Transfer characteristic");Param_Info1(DPX_TransferCharacteristic(TransferCharacteristic)); Get_B1 (ColorimetricSpecification, "Colorimetric specification");Param_Info1(DPX_ColorimetricSpecification(ColorimetricSpecification)); Get_B1 (BitDephs, "Bit depth");Param_Info1(DPX_ValidBitDephs(BitDephs)); Info_B2(ComponentDataPackingMethod, "Packing");Param_Info1((ComponentDataPackingMethod<8?DPX_ComponentDataPackingMethod[ComponentDataPackingMethod]:"invalid")); Info_B2(ComponentDataEncodingMethod, "Encoding");Param_Info1((ComponentDataEncodingMethod<8?DPX_ComponentDataEncodingMethod[ComponentDataEncodingMethod]:"invalid")); Skip_B4( "Offset to data"); Skip_B4( "End-of-line padding"); Skip_B4( "End-of-image padding"); Skip_UTF8(32, "Description of image element"); Element_End0(); FILLING_BEGIN(); if (Frame_Count==0) { Fill(StreamKind_Last, StreamPos_Last, "Format", "DPX"); Fill(StreamKind_Last, StreamPos_Last, "Format_Version", "Version 2"); Fill(StreamKind_Last, StreamPos_Last, "BitDepth", BitDephs); Fill(StreamKind_Last, StreamPos_Last, "colour_description_present", "Yes"); Fill(StreamKind_Last, StreamPos_Last, "colour_primaries", DPX_TransferCharacteristic(TransferCharacteristic)); Fill(StreamKind_Last, StreamPos_Last, "transfer_characteristics", DPX_ColorimetricSpecification(ColorimetricSpecification)); } FILLING_END(); } //--------------------------------------------------------------------------- void File_Dpx::IndustrySpecificHeader_v1() { Element_Name("Motion picture industry specific header"); //Parsing Element_Begin1("Motion-picture film information"); Skip_B1( "?"); Skip_B1( "?"); Skip_B1( "?"); Skip_B1( "?"); Skip_B4( "?"); Skip_B4( "?"); Skip_UTF8(32, "?"); Skip_B4( "?"); Skip_B4( "?"); Skip_UTF8(32, "?"); Skip_UTF8(200, "?"); Skip_XX(740, "Reserved for future use"); Element_End0(); } //--------------------------------------------------------------------------- void File_Dpx::IndustrySpecificHeader_v2() { Element_Name("Industry specific header"); //Parsing Element_Begin1("Motion-picture film information"); Skip_String(2, "Film mfg. ID code"); Skip_String(2, "Film type"); Skip_String(2, "Offset in perfs"); Skip_String(6, "Prefix"); Skip_String(4, "Count"); Skip_String(32, "Format - e.g. Academy"); Skip_B4( "Frame position in sequence"); Skip_B4( "Sequence length (frames)"); Skip_B4( "Held count (1 = default)"); Skip_BFP4(9, "Frame rate of original (frames/s)"); Skip_BFP4(9, "Shutter angle of camera in degrees"); Skip_UTF8(32, "Frame identification - e.g. keyframe"); Skip_UTF8(100, "Slate information"); Skip_XX(56, "Reserved for future use"); Element_End0(); Element_Begin1("Television information"); Skip_B4( "SMPTE time code"); Skip_B4( "SMPTE user bits"); Info_B1(Interlace, "Interlace");Param_Info1((Interlace==0?"noninterlaced":"2:1 interlace")); Skip_B1( "Field number"); Info_B1(VideoSignalStandard, "Video signal standard");Param_Info1(DPX_VideoSignalStandard(VideoSignalStandard)); Skip_B1( "Zero"); Skip_BFP4(9, "Horizontal sampling rate (Hz)"); Skip_BFP4(9, "Vertical sampling rate (Hz)"); Skip_BFP4(9, "Temporal sampling rate or frame rate (Hz)"); Skip_BFP4(9, "Time offset from sync to first pixel (ms)"); Skip_BFP4(9, "Gamma"); Skip_BFP4(9, "Black level code value"); Skip_BFP4(9, "Black gain"); Skip_BFP4(9, "Breakpoint"); Skip_BFP4(9, "Reference white level code value"); Skip_BFP4(9, "Integration time (s)"); Skip_XX(76, "Reserved for future use"); Element_End0(); } //--------------------------------------------------------------------------- void File_Dpx::UserDefinedHeader_v1() { Element_Name("User defined header"); //Parsing Skip_XX(Sizes[Pos_UserDefined], "Unknown"); } //--------------------------------------------------------------------------- void File_Dpx::UserDefinedHeader_v2() { Element_Name("User defined header"); //Parsing if (Sizes[Pos_UserDefined]<32) { //Not in spec Skip_XX(Sizes[Pos_UserDefined], "Unknown"); return; } Skip_UTF8(32, "User identification"); Skip_XX(Sizes[Pos_UserDefined]-32, "User defined"); } //--------------------------------------------------------------------------- void File_Dpx::Padding() { Element_Name("Padding"); //Parsing Skip_XX(Sizes[Pos_Padding], "Padding"); } //--------------------------------------------------------------------------- void File_Dpx::ImageData() { Element_Name("Image Data"); //Parsing Skip_XX(Sizes[Pos_ImageData], "Data"); Frame_Count++; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; if (Config->ParseSpeed<1.0) Finish("DPX"); //No need of more } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- void File_Dpx::Get_X2(int16u &Info, const char* Name) { if (LittleEndian) Get_L2 (Info, Name); else Get_B2 (Info, Name); } //--------------------------------------------------------------------------- void File_Dpx::Get_X4(int32u &Info, const char* Name) { if (LittleEndian) Get_L4 (Info, Name); else Get_B4 (Info, Name); } } //NameSpace #endif //MEDIAINFO_DPX_YES MediaInfoLib/Source/MediaInfo/Image/File_Dpx.h100777 0 0 4706 12226004262 14442 0/* 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 DPX files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_DpxH #define MediaInfo_File_DpxH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Dpx //*************************************************************************** class File_Dpx : public File__Analyze { public : //Constructor/Destructor File_Dpx(); private : //Streams management void Streams_Accept(); //Buffer - Demux #if MEDIAINFO_DEMUX bool Demux_UnpacketizeContainer_Test() {return Demux_UnpacketizeContainer_Test_OneFramePerFile();} #endif //MEDIAINFO_DEMUX //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Unsynched() {Read_Buffer_Unsynched_OneFramePerFile();} #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) {return Read_Buffer_Seek_OneFramePerFile(Method, Value, ID);} #endif //MEDIAINFO_SEEK //Buffer - Per element void Header_Parse(); void Data_Parse(); //Elements void GenericSectionHeader_v1(); void GenericSectionHeader_v2(); void GenericSectionHeader_v1_ImageElement(); void GenericSectionHeader_v2_ImageElement(); void IndustrySpecificHeader_v1(); void IndustrySpecificHeader_v2(); void UserDefinedHeader_v1(); void UserDefinedHeader_v2(); void Padding(); void ImageData(); //Temp std::vector Sizes; size_t Sizes_Pos; int8u Version; bool LittleEndian; //Helpers void Get_X2 (int16u &Info, const char* Name); void Get_X4 (int32u &Info, const char* Name); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Image/File_Exr.cpp100777 0 0 24536 12226004262 15023 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_EXR_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Image/File_Exr.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //*************************************************************************** // Const //*************************************************************************** enum Elements { Pos_FileInformation, Pos_GenericSection, Pos_IndustrySpecific, Pos_UserDefined, Pos_Padding, Pos_ImageData, }; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Exr::File_Exr() :File__Analyze() { //Configuration ParserName=__T("EXR"); } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Exr::Streams_Accept() { Fill(Stream_General, 0, General_Format, "EXR"); if (!IsSub) { TestContinuousFileNames(); Stream_Prepare((Config->File_Names.size()>1 || Config->File_IsReferenced_Get())?Stream_Video:Stream_Image); Fill(StreamKind_Last, StreamPos_Last, "StreamSize", File_Size); if (StreamKind_Last==Stream_Video) Fill(Stream_Video, StreamPos_Last, Video_FrameCount, Config->File_Names.size()); } else Stream_Prepare(Stream_Image); //Configuration Buffer_MaximumSize=64*1024*1024; //Some big frames are possible (e.g YUV 4:2:2 10 bits 1080p) Frame_Count_NotParsedIncluded=0; } //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- bool File_Exr::FileHeader_Begin() { //Element_Size if (Buffer_Size<4) return false; //Must wait for more data if (CC4(Buffer)!=0x762F3101) //"v/1"+1 { Reject(); return false; } //All should be OK... Accept(); return true; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- bool File_Exr::Header_Begin() { //Header if (Buffer_Offset+4>Buffer_Size) return false; if (CC4(Buffer+Buffer_Offset)==0x762F3101) //"v/1"+1 return Buffer_Offset+12<=Buffer_Size; //Name name_End=0; while (Buffer_Offset+name_End=Buffer_Size) return false; if (name_End>=31) { Reject(); return false; } if (name_End==0) return true; //Type type_End=0; while (Buffer_Offset+name_End+1+type_End=Buffer_Size) return false; if (type_End>=31) { Reject(); return false; } if (Buffer_Offset+name_End+1+type_End+1+4>=Buffer_Size) return false; return true; } //--------------------------------------------------------------------------- void File_Exr::Header_Parse() { //Header if (CC4(Buffer+Buffer_Offset)==0x762F3101) //"v/1"+1 { //Filling Header_Fill_Code(0, "File header"); Header_Fill_Size(12); return; } //Image data if (name_End==0) { //Filling Header_Fill_Code(0, "Image data"); Header_Fill_Size(ImageData_End-(File_Offset+Buffer_Offset)); return; } int32u size; Get_String(name_End, name, "name"); Element_Offset++; //Null byte Get_String(type_End, type, "type"); Element_Offset++; //Null byte Get_L4 (size, "size"); //Filling Header_Fill_Code(0, Ztring().From_Local(name.c_str())); Header_Fill_Size(name_End+1+type_End+1+4+size); } //--------------------------------------------------------------------------- void File_Exr::Data_Parse() { if (CC4(Buffer+Buffer_Offset)==0x762F3101) //"v/1"+1 //Header Header(); else if (name=="comments" && type=="string") comments(); else if (name=="compression" && type=="compression" && Element_Size==1) compression(); else if (name=="dataWindow" && type=="box2i" && Element_Size==16) dataWindow(); else if (name=="displayWindow" && type=="box2i" && Element_Size==16) displayWindow(); else if (name=="pixelAspectRatio" && type=="float" && Element_Size==4) pixelAspectRatio(); else Skip_XX(Element_Size, "value"); } //--------------------------------------------------------------------------- void File_Exr::Header() { //Parsing int32u Flags; int8u Version; Skip_L4( "Magic number"); Get_L1 (Version, "Version field"); Get_L3 (Flags, "Flags"); //Filling if (Frame_Count==0) { Fill(Stream_General, 0, General_Format_Version, __T("Version ")+Ztring::ToZtring(Version)); Fill(StreamKind_Last, 0, "Format", "EXR"); Fill(StreamKind_Last, 0, "Format_Version", __T("Version ")+Ztring::ToZtring(Version)); Fill(StreamKind_Last, 0, "Format_Profile", (Flags&0x02)?"Tile":"Line"); } Frame_Count++; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; ImageData_End=File_Offset+Buffer_Offset+Config->File_Sizes[Config->File_Names_Pos-1]; } //--------------------------------------------------------------------------- void File_Exr::ImageData() { Skip_XX(Element_Size, "data"); if (!Status[IsFilled]) Fill(); if (Config->ParseSpeed<1.0) Finish(); } //--------------------------------------------------------------------------- void File_Exr::comments () { //Parsing Ztring value; Get_Local(Element_Size, value, "value"); //Filling if (Frame_Count==1) Fill(StreamKind_Last, 0, General_Comment, value); } //--------------------------------------------------------------------------- void File_Exr::compression () { //Parsing int8u value; Get_L1 (value, "value"); //Filling std::string Compression; switch (value) { case 0x00 : Compression="raw"; break; case 0x01 : Compression="RLZ"; break; case 0x02 : Compression="ZIPS"; break; case 0x03 : Compression="ZIP"; break; case 0x04 : Compression="PIZ"; break; case 0x05 : Compression="PXR24"; break; case 0x06 : Compression="B44"; break; case 0x07 : Compression="B44A"; break; default : ; } if (Frame_Count==1) Fill(StreamKind_Last, 0, "Format_Compression", Compression.c_str()); } //--------------------------------------------------------------------------- void File_Exr::dataWindow () { //Parsing int32u xMin, yMin, xMax, yMax; Get_L4 (xMin, "xMin"); Get_L4 (yMin, "yMin"); Get_L4 (xMax, "xMax"); Get_L4 (yMax, "yMax"); } //--------------------------------------------------------------------------- void File_Exr::displayWindow () { //Parsing int32u xMin, yMin, xMax, yMax; Get_L4 (xMin, "xMin"); Get_L4 (yMin, "yMin"); Get_L4 (xMax, "xMax"); Get_L4 (yMax, "yMax"); //Filling if (Frame_Count==1) { Fill(StreamKind_Last, 0, "Width", xMax-xMin+1); Fill(StreamKind_Last, 0, "Height", yMax-yMin+1); } } //--------------------------------------------------------------------------- void File_Exr::pixelAspectRatio () { //Parsing float value; Get_LF4(value, "value"); //Filling if (Frame_Count==1) Fill(StreamKind_Last, 0, "PixelAspectRatio", value?value:1, 3); } } //NameSpace #endif //MEDIAINFO_EXR_YES MediaInfoLib/Source/MediaInfo/Image/File_Exr.h100777 0 0 4307 12226004262 14442 0/* 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 EXR files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_ExrH #define MediaInfo_File_ExrH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Exr //*************************************************************************** class File_Exr : public File__Analyze { public : //Constructor/Destructor File_Exr(); private : //Streams management void Streams_Accept(); //Buffer - Demux #if MEDIAINFO_DEMUX bool Demux_UnpacketizeContainer_Test() {return Demux_UnpacketizeContainer_Test_OneFramePerFile();} #endif //MEDIAINFO_DEMUX //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Unsynched() {Read_Buffer_Unsynched_OneFramePerFile();} #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) {return Read_Buffer_Seek_OneFramePerFile(Method, Value, ID);} #endif //MEDIAINFO_SEEK //Buffer - Per element bool Header_Begin(); void Header_Parse(); void Data_Parse(); //Elements void Header(); void ImageData(); void comments(); void compression(); void dataWindow(); void displayWindow(); void pixelAspectRatio(); //Temp std::string name; std::string type; size_t name_End; size_t type_End; int64u ImageData_End; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Image/File_Gif.cpp100777 0 0 7724 12226004262 14752 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // From http://www.onicos.com/staff/iz/formats/gif.html // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_GIF_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Image/File_Gif.h" #include using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_Gif::FileHeader_Begin() { //Element_Size if (Buffer_Size<3) return false; //Must wait for more data if (CC3(Buffer)!=0x474946) //"GIF" { Reject("GIF"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Gif::Read_Buffer_Continue() { //Parsing Ztring Version; int16u Width, Height; int8u BackgroundColorIndex, PixelAspectRatio, Resolution, GCT_Size; bool GCT_Flag, Sort; Skip_Local(3, "Header"); Get_Local (3, Version, "Version"); Get_L2 (Width, "Logical Screen Width"); Get_L2 (Height, "Logical Screen Height"); BS_Begin(); Get_SB ( GCT_Flag, "Global Color Table Flag"); Get_S1 (3, Resolution, "Color Resolution"); Get_SB ( Sort, "Sort Flag to Global Color Table"); Get_S1 (3, GCT_Size, "Size of Global Color Table"); Param_Info1(Ztring::ToZtring((int16u)pow(2.0, 1+GCT_Size))); BS_End(); Get_L1 (BackgroundColorIndex, "Background Color Index"); Get_L1 (PixelAspectRatio, "Pixel Aspect Ratio"); if (GCT_Flag) Skip_XX((int16u)pow(2.0, 1+GCT_Size)*3, "Global Color Table"); Element_End0(); FILLING_BEGIN(); Accept("GIF"); Stream_Prepare(Stream_Image); Fill(Stream_Image, 0, Image_Width, Width); Fill(Stream_Image, 0, Image_Height, Height); Fill(Stream_Image, 0, Image_Format, __T("GIF")); Fill(Stream_Image, 0, Image_Format_Profile, Version); Fill(Stream_Image, 0, Image_Codec, __T("GIF")+Version); if (PixelAspectRatio) Fill(Stream_Image, 0, Image_PixelAspectRatio, (((float)PixelAspectRatio)+15)/64); Finish("GIF"); FILLING_END(); } } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Image/File_Gif.h100777 0 0 2333 12226004262 14406 0/* 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 GIF files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_GifH #define MediaInfo_File_GifH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Gif //*************************************************************************** class File_Gif : public File__Analyze { protected : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Image/File_Ico.cpp100777 0 0 12372 12226004262 14772 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_ICO_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Image/File_Ico.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Ico::File_Ico() { IcoDataSize=0; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Ico::Streams_Fill() { Fill(Stream_General, 0, General_Format, Type==1?"ICO":"CUR"); for (size_t Pos=0; PosFile_Size || File_Offset+Buffer_Offset+Element_Size+IcoDataSize>File_Size) Reject("ICO"); Count--; if (Count==0) { if (File_Offset+Buffer_Offset+Element_Size+IcoDataSize!=File_Size) Reject("ICO"); else { Accept("ICO"); Finish("ICO"); } } FILLING_END(); } //*************************************************************************** // //*************************************************************************** } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Image/File_Ico.h100777 0 0 3221 12226004262 14410 0/* 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 Icon files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_IcoH #define MediaInfo_File_IcoH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Ico //*************************************************************************** class File_Ico : public File__Analyze { public: //Constructor/Destructor File_Ico(); private : //Streams management void Streams_Fill(); //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse (); //Buffer - Per element void Header_Parse (); void Data_Parse (); //Temp int64u IcoDataSize; int16u Type; int16u Count; struct stream { int32u Size; int32u Offset; int16u BitsPerPixel; int8u Width; int8u Height; }; std::vector Streams; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Image/File_Jpeg.cpp100777 0 0 127413 12245161364 15200 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Links: // // http://www.fileformat.info/format/jpeg/ // http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html // http://www.w3.org/Graphics/JPEG/jfif3.pdf // http://www.sentex.net/~mwandel/jhead/ // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_JPEG_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Image/File_Jpeg.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "ZenLib/Utils.h" #include using namespace ZenLib; using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constants //*************************************************************************** //--------------------------------------------------------------------------- namespace Elements { const int16u TEM =0xFF01; const int16u SOC =0xFF4F; //JPEG 2000 const int16u SIZ =0xFF51; //JPEG 2000 const int16u COD =0xFF52; //JPEG 2000 const int16u COC =0xFF53; //JPEG 2000 const int16u TLM =0xFF55; //JPEG 2000 const int16u PLM =0xFF57; //JPEG 2000 const int16u PLT =0xFF58; //JPEG 2000 const int16u QCD =0xFF5C; //JPEG 2000 const int16u QCC =0xFF5D; //JPEG 2000 const int16u RGN =0xFF5E; //JPEG 2000 const int16u PPM =0xFF60; //JPEG 2000 const int16u PPT =0xFF61; //JPEG 2000 const int16u CME =0xFF64; //JPEG 2000 const int16u SOT =0xFF90; //JPEG 2000 const int16u SOP =0xFF91; //JPEG 2000 const int16u EPH =0xFF92; //JPEG 2000 const int16u SOD =0xFF93; //JPEG 2000 const int16u S0F0=0xFFC0; const int16u S0F1=0xFFC1; const int16u S0F2=0xFFC2; const int16u S0F3=0xFFC3; const int16u DHT =0xFFC4; const int16u S0F5=0xFFC5; const int16u S0F6=0xFFC6; const int16u S0F7=0xFFC7; const int16u JPG =0xFFC8; const int16u S0F9=0xFFC9; const int16u S0FA=0xFFCA; const int16u S0FB=0xFFCB; const int16u DAC =0xFFCC; const int16u S0FD=0xFFCD; const int16u S0FE=0xFFCE; const int16u S0FF=0xFFCF; const int16u RST0=0xFFD0; const int16u RST1=0xFFD1; const int16u RST2=0xFFD2; const int16u RST3=0xFFD3; const int16u RST4=0xFFD4; const int16u RST5=0xFFD5; const int16u RST6=0xFFD6; const int16u RST7=0xFFD7; const int16u SOI =0xFFD8; const int16u EOI =0xFFD9; //EOC in JPEG 2000 const int16u SOS =0xFFDA; const int16u DQT =0xFFDB; const int16u DNL =0xFFDC; const int16u DRI =0xFFDD; const int16u DHP =0xFFDE; const int16u EXP =0xFFDF; const int16u APP0=0xFFE0; const int16u APP1=0xFFE1; const int16u APP2=0xFFE2; const int16u APP3=0xFFE3; const int16u APP4=0xFFE4; const int16u APP5=0xFFE5; const int16u APP6=0xFFE6; const int16u APP7=0xFFE7; const int16u APP8=0xFFE8; const int16u APP9=0xFFE9; const int16u APPA=0xFFEA; const int16u APPB=0xFFEB; const int16u APPC=0xFFEC; const int16u APPD=0xFFED; const int16u APPE=0xFFEE; const int16u APPF=0xFFEF; const int16u JPG0=0xFFF0; const int16u JPG1=0xFFF1; const int16u JPG2=0xFFF2; const int16u JPG3=0xFFF3; const int16u JPG4=0xFFF4; const int16u JPG5=0xFFF5; const int16u JPG6=0xFFF6; const int16u JPG7=0xFFF7; const int16u JPG8=0xFFF8; const int16u JPG9=0xFFF9; const int16u JPGA=0xFFFA; const int16u JPGB=0xFFFB; const int16u JPGC=0xFFFC; const int16u JPGD=0xFFFD; const int16u COM =0xFFFE; } //--------------------------------------------------------------------------- // Borland C++ does not accept local template struct Jpeg_samplingfactor { int8u Ci; int8u Hi; int8u Vi; }; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Jpeg::File_Jpeg() { //Config #if MEDIAINFO_TRACE Trace_Layers_Update(8); //Stream #endif //MEDIAINFO_TRACE MustSynchronize=true; IsRawStream=true; //In StreamKind=Stream_Image; Interlaced=false; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Jpeg::Streams_Accept() { if (!IsSub) { TestContinuousFileNames(); Stream_Prepare(Config->File_Names.size()>1?Stream_Video:StreamKind); Fill(StreamKind_Last, StreamPos_Last, "StreamSize", File_Size); if (StreamKind_Last==Stream_Video) Fill(Stream_Video, StreamPos_Last, Video_FrameCount, Config->File_Names.size()); } else Stream_Prepare(StreamKind); //Configuration Buffer_MaximumSize=64*1024*1024; //Some big frames are possible (e.g YUV 4:2:2 10 bits 1080p) Frame_Count_NotParsedIncluded=0; } //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_Jpeg::FileHeader_Begin() { //Element_Size if (Buffer_Size<3) return false; //Must wait for more data if (Buffer[2]!=0xFF || (CC2(Buffer)!=Elements::SOI && CC2(Buffer)!=Elements::SOC)) { Reject("JPEG"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Jpeg::Synchronize() { //Synchronizing while(Buffer_Offset+2<=Buffer_Size && (Buffer[Buffer_Offset ]!=0xFF || Buffer[Buffer_Offset+1]==0x00)) Buffer_Offset++; if (Buffer_Offset+1==Buffer_Size && Buffer[Buffer_Offset ]!=0xFF) Buffer_Offset++; if (Buffer_Offset+2>Buffer_Size) return false; //Synched is OK Synched=true; return true; } //--------------------------------------------------------------------------- bool File_Jpeg::Synched_Test() { if (SOS_SOD_Parsed) return true; ///No sync after SOD //Must have enough buffer for having header if (Buffer_Offset+2>Buffer_Size) return false; //Quick test of synchro if (Buffer[Buffer_Offset]!=0xFF) { Synched=false; return true; } //We continue return true; } //--------------------------------------------------------------------------- void File_Jpeg::Synched_Init() { APP0_JFIF_Parsed=false; SOS_SOD_Parsed=false; APPE_Adobe0_transform=(int8u)-1; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Jpeg::Read_Buffer_Unsynched() { SOS_SOD_Parsed=false; Read_Buffer_Unsynched_OneFramePerFile(); } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Jpeg::Header_Parse() { if (SOS_SOD_Parsed) { Header_Fill_Code(0, "Data"); if (!Header_Parser_Fill_Size()) { Element_WaitForMoreData(); return; } return; } //Parsing int16u code, size; Get_B2 (code, "Marker"); switch (code) { case Elements::TEM : case Elements::RST0 : case Elements::RST1 : case Elements::RST2 : case Elements::RST3 : case Elements::RST4 : case Elements::RST5 : case Elements::RST6 : case Elements::RST7 : case Elements::SOC : case Elements::SOD : case Elements::SOI : case Elements::EOI : size=0; break; default : Get_B2 (size, "Fl - Frame header length"); } //Filling Header_Fill_Code(code, Ztring().From_CC2(code)); Header_Fill_Size(2+size); } //--------------------------------------------------------------------------- bool File_Jpeg::Header_Parser_Fill_Size() { //Look for next Sync word if (Buffer_Offset_Temp==0) //Buffer_Offset_Temp is not 0 if Header_Parse_Fill_Size() has already parsed first frames Buffer_Offset_Temp=Buffer_Offset; while (Buffer_Offset_Temp+2<=Buffer_Size && CC2(Buffer+Buffer_Offset_Temp)!=Elements::EOI) Buffer_Offset_Temp++; //Must wait more data? if (Buffer_Offset_Temp+2>Buffer_Size) { if (/*FrameIsAlwaysComplete ||*/ File_Offset+Buffer_Size>=File_Size) Buffer_Offset_Temp=Buffer_Size; //We are sure that the next bytes are a start else return false; } //OK, we continue Header_Fill_Size(Buffer_Offset_Temp-Buffer_Offset); Buffer_Offset_Temp=0; return true; } //--------------------------------------------------------------------------- void File_Jpeg::Data_Parse() { #define CASE_INFO(_NAME, _DETAIL) \ case Elements::_NAME : Element_Info1(#_NAME); Element_Info1(_DETAIL); _NAME(); break; //Parsing if (SOS_SOD_Parsed) { Skip_XX(Element_Size, "Data"); SOS_SOD_Parsed=false; return; } switch (Element_Code) { CASE_INFO(TEM , "TEM"); CASE_INFO(SOC , "Start of codestream"); //JPEG 2000 CASE_INFO(SIZ , "Image and tile size"); //JPEG 2000 CASE_INFO(COD , "Coding style default"); //JPEG 2000 CASE_INFO(COC , "Coding style component"); //JPEG 2000 CASE_INFO(TLM , "Tile-part lengths, main header"); //JPEG 2000 CASE_INFO(PLM , "Packet length, main header"); //JPEG 2000 CASE_INFO(PLT , "Packet length, tile-part header"); //JPEG 2000 CASE_INFO(QCD , "Quantization default"); //JPEG 2000 CASE_INFO(QCC , "Quantization component "); //JPEG 2000 CASE_INFO(RGN , "Region-of-interest"); //JPEG 2000 CASE_INFO(PPM , "Packed packet headers, main header"); //JPEG 2000 CASE_INFO(PPT , "Packed packet headers, tile-part header"); //JPEG 2000 CASE_INFO(CME , "Comment and extension"); //JPEG 2000 CASE_INFO(SOT , "Start of tile-part"); //JPEG 2000 CASE_INFO(SOP , "Start of packet"); //JPEG 2000 CASE_INFO(EPH , "End of packet header"); //JPEG 2000 CASE_INFO(SOD , "Start of data"); //JPEG 2000 CASE_INFO(S0F0, "Baseline DCT (Huffman)"); CASE_INFO(S0F1, "Extended sequential DCT (Huffman)"); CASE_INFO(S0F2, "Progressive DCT (Huffman)"); CASE_INFO(S0F3, "Lossless (sequential) (Huffman)"); CASE_INFO(DHT , "Define Huffman Tables"); CASE_INFO(S0F5, "Differential sequential DCT (Huffman)"); CASE_INFO(S0F6, "Differential progressive DCT (Huffman)"); CASE_INFO(S0F7, "Differential lossless (sequential) (Huffman)"); CASE_INFO(JPG , "Reserved for JPEG extensions"); CASE_INFO(S0F9, "Extended sequential DCT (Arithmetic)"); CASE_INFO(S0FA, "Progressive DCT (Arithmetic)"); CASE_INFO(S0FB, "Lossless (sequential) (Arithmetic)"); CASE_INFO(DAC , "Define Arithmetic Coding"); CASE_INFO(S0FD, "Differential sequential DCT (Arithmetic)"); CASE_INFO(S0FE, "Differential progressive DCT (Arithmetic)"); CASE_INFO(S0FF, "Differential lossless (sequential) (Arithmetic)"); CASE_INFO(RST0, "Restart Interval Termination 0"); CASE_INFO(RST1, "Restart Interval Termination 1"); CASE_INFO(RST2, "Restart Interval Termination 2"); CASE_INFO(RST3, "Restart Interval Termination 3"); CASE_INFO(RST4, "Restart Interval Termination 4"); CASE_INFO(RST5, "Restart Interval Termination 5"); CASE_INFO(RST6, "Restart Interval Termination 6"); CASE_INFO(RST7, "Restart Interval Termination 7"); CASE_INFO(SOI , "Start Of Image"); CASE_INFO(EOI , "End Of Image"); //Is EOC (End of codestream) in JPEG 2000 CASE_INFO(SOS , "Start Of Scan"); CASE_INFO(DQT , "Define Quantization Tables"); CASE_INFO(DNL , "Define Number of Lines"); CASE_INFO(DRI , "Define Restart Interval"); CASE_INFO(DHP , "Define Hierarchical Progression"); CASE_INFO(EXP , "Expand Reference Components"); CASE_INFO(APP0, "Application-specific marker 0"); CASE_INFO(APP1, "Application-specific marker 1"); CASE_INFO(APP2, "Application-specific marker 2"); CASE_INFO(APP3, "Application-specific marker 3"); CASE_INFO(APP4, "Application-specific marker 4"); CASE_INFO(APP5, "Application-specific marker 5"); CASE_INFO(APP6, "Application-specific marker 6"); CASE_INFO(APP7, "Application-specific marker 7"); CASE_INFO(APP8, "Application-specific marker 8"); CASE_INFO(APP9, "Application-specific marker 9"); CASE_INFO(APPA, "Application-specific marker 10"); CASE_INFO(APPB, "Application-specific marker 11"); CASE_INFO(APPC, "Application-specific marker 12"); CASE_INFO(APPD, "Application-specific marker 13"); CASE_INFO(APPE, "Application-specific marker 14"); CASE_INFO(APPF, "Application-specific marker 15"); CASE_INFO(JPG0, "JPG"); CASE_INFO(JPG1, "JPG"); CASE_INFO(JPG2, "JPG"); CASE_INFO(JPG3, "JPG"); CASE_INFO(JPG4, "JPG"); CASE_INFO(JPG5, "JPG"); CASE_INFO(JPG6, "JPG"); CASE_INFO(JPG7, "JPG"); CASE_INFO(JPG8, "JPG"); CASE_INFO(JPG9, "JPG"); CASE_INFO(JPGA, "JPG"); CASE_INFO(JPGB, "JPG"); CASE_INFO(JPGC, "JPG"); CASE_INFO(JPGD, "JPG"); CASE_INFO(COM , "Comment"); default : Element_Info1("Reserved"); Skip_XX(Element_Size, "Data"); } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Jpeg::SIZ() { //Parsing vector SamplingFactors; vector 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; PosSamplingFactors_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"); Fill("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; PosParseSpeed<1.0) Finish("JPEG 2000"); //No need of more } //--------------------------------------------------------------------------- void File_Jpeg::SOF_() { //Parsing vector SamplingFactors; int16u Height, Width; int8u Resolution, Count; Get_B1 (Resolution, "P - Sample precision"); Get_B2 (Height, "Y - Number of lines"); Get_B2 (Width, "X - Number of samples per line"); Get_B1 (Count, "Nf - Number of image components in frame"); for (int8u Pos=0; PosCount) Element_Info1(Ztring().append(1, (Char)SamplingFactor.Ci)); else Element_Info1(SamplingFactor.Ci); BS_Begin(); Get_S1 (4, SamplingFactor.Hi, "Hi - Horizontal sampling factor"); Element_Info1(SamplingFactor.Hi); Get_S1 (4, SamplingFactor.Vi, "Vi - Vertical sampling factor"); Element_Info1(SamplingFactor.Vi); BS_End(); Skip_B1( "Tqi - Quantization table destination selector"); Element_End0(); //Filling list of HiVi SamplingFactors.push_back(SamplingFactor); } FILLING_BEGIN_PRECISE(); if (Frame_Count==0 && Field_Count==0) { Accept("JPEG"); Fill("JPEG"); if (Count_Get(StreamKind_Last)==0) Stream_Prepare(StreamKind_Last); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Format), "JPEG"); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Codec), "JPEG"); if (StreamKind_Last==Stream_Image) Fill(Stream_Image, 0, Image_Codec_String, "JPEG", Unlimited, true, true); //To Avoid automatic filling if (StreamKind_Last==Stream_Video) Fill(Stream_Video, 0, Video_InternetMediaType, "video/JPEG", Unlimited, true, true); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_BitDepth), Resolution); Fill(StreamKind_Last, 0, "Height", Height*(Interlaced?2:1)); Fill(StreamKind_Last, 0, "Width", Width); //ColorSpace from http://docs.oracle.com/javase/1.4.2/docs/api/javax/imageio/metadata/doc-files/jpeg_metadata.html switch (APPE_Adobe0_transform) { case 0x01 : if (Count==3) Fill(StreamKind_Last, 0, "ColorSpace", "YUV"); case 0x02 : if (Count==4) Fill(StreamKind_Last, 0, "ColorSpace", "YCCB"); break; default : { int8u Ci[256]; memset(Ci, 0, 256); for (int8u Pos=0; PosParseSpeed<1.0) Finish("JPEG"); //No need of more FILLING_END(); } //--------------------------------------------------------------------------- void File_Jpeg::APP0() { //Parsing int32u Name; Get_C4(Name, "Name"); switch (Name) { case 0x41564931 : APP0_AVI1(); break; //"AVI1" case 0x4A464946 : APP0_JFIF(); break; //"JFIF" case 0x4A464646 : APP0_JFFF(); break; //"JFFF" default : Skip_XX(Element_Size-Element_Offset, "Unknown"); } } //--------------------------------------------------------------------------- void File_Jpeg::APP0_AVI1() { Element_Info1("AVI1"); //Parsing int8u FieldOrder=(int8u)-1; if (Element_Size==16-4) { Get_B1 (FieldOrder, "Polarity"); Skip_XX(7, "Zeroes"); } if (Element_Size==18-4) { int32u FieldSizeLessPadding; Get_B1 (FieldOrder, "Field Order"); Skip_B1( "Zero"); Skip_B4( "FieldSize"); Get_B4 (FieldSizeLessPadding, "FieldSizeLessPadding"); //Coherency if (FieldOrder==0 && IsSub && FieldSizeLessPadding!=Buffer_Size) FieldOrder=(int8u)-1; //Not coherant } FILLING_BEGIN(); if (Frame_Count==0 && Field_Count==0) { Accept(); switch (FieldOrder) { case 0x00 : Fill(Stream_Video, 0, Video_Interlacement, "PPF"); Fill(Stream_Video, 0, Video_ScanType, "Progressive"); break; case 0x01 : Fill(Stream_Video, 0, Video_Interlacement, "TFF"); Fill(Stream_Video, 0, Video_ScanType, "Interlaced"); Fill(Stream_Video, 0, Video_ScanOrder, "TFF"); Interlaced=true; break; case 0x02 : Fill(Stream_Video, 0, Video_Interlacement, "BFF"); Fill(Stream_Video, 0, Video_ScanType, "Interlaced"); Fill(Stream_Video, 0, Video_ScanOrder, "BFF"); Interlaced=true; break; case 0xFF : Fill(Stream_Video, 0, Video_ScanType, "Interlaced"); Interlaced=true; break; default : ; } } FILLING_END(); } //--------------------------------------------------------------------------- void File_Jpeg::APP0_JFIF() { Element_Info1("JFIF"); //Parsing Skip_B1( "Zero"); 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"); APP0_JFIF_Parsed=true; } //--------------------------------------------------------------------------- void File_Jpeg::APP0_JFFF() { Element_Info1("JFFF"); Skip_B1( "Zero"); Skip_B1( "extension_code"); //0x10 Thumbnail coded using JPEG, 0x11 Thumbnail stored using 1 byte/pixel, 0x13 Thumbnail stored using 3 bytes/pixel if (Element_Size>Element_Offset) Skip_XX(Element_Size-Element_Offset, "extension_data"); } //--------------------------------------------------------------------------- void File_Jpeg::APP0_JFFF_JPEG() { //Parsing Element_Begin1("Thumbail JPEG"); if (Element_Size>Element_Offset) Skip_XX(Element_Size-Element_Offset, "Data"); Element_End0(); } //--------------------------------------------------------------------------- void File_Jpeg::APP0_JFFF_1B() { //Parsing Element_Begin1("Thumbail 1 byte per pixel"); int8u ThumbailX, ThumbailY; Get_B1 (ThumbailX, "Xthumbail"); Get_B1 (ThumbailY, "Ythumbail"); Skip_XX(768, "Palette"); Skip_XX(ThumbailX*ThumbailY, "Thumbail"); Element_End0(); } //--------------------------------------------------------------------------- void File_Jpeg::APP0_JFFF_3B() { //Parsing Element_Begin1("Thumbail 3 bytes per pixel"); int8u ThumbailX, ThumbailY; Get_B1 (ThumbailX, "Xthumbail"); Get_B1 (ThumbailY, "Ythumbail"); Skip_XX(3*ThumbailX*ThumbailY, "RGB Thumbail"); Element_End0(); } //--------------------------------------------------------------------------- void File_Jpeg::APP1() { //Parsing int64u Name; Get_C6(Name, "Name"); switch (Name) { case 0x457869660000LL : APP1_EXIF(); break; //"Exif\0\0" default : Skip_XX(Element_Size-Element_Offset, "Data"); } } //--------------------------------------------------------------------------- void File_Jpeg::APP1_EXIF() { Element_Info1("Exif"); //Parsing int32u Alignment; Get_C4(Alignment, "Alignment"); if (Alignment==0x49492A00) Skip_B4( "First_IFD"); if (Alignment==0x4D4D2A00) Skip_L4( "First_IFD"); } //--------------------------------------------------------------------------- void File_Jpeg::APPE() { //Parsing int64u Name; Get_C6(Name, "Name"); switch (Name) { case 0x41646F626500LL : APPE_Adobe0(); break; //"AVI1" default : Skip_XX(Element_Size-Element_Offset, "Unknown"); } } //--------------------------------------------------------------------------- void File_Jpeg::APPE_Adobe0() { Element_Info1("Adobe"); //Parsing int8u Version; Get_B1(Version, "Version"); if (Version==100) { int8u transform; Skip_B2( "flags0"); Skip_B2( "flags1"); Get_B1 (transform, "transform"); FILLING_BEGIN(); APPE_Adobe0_transform=transform; FILLING_END(); } else Skip_XX(Element_Size-Element_Offset, "unknown"); } } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Image/File_Jpeg.h100777 0 0 12574 12245161364 14626 0/* 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 JPEG files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_JpegH #define MediaInfo_File_JpegH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Jpeg //*************************************************************************** class File_Jpeg : public File__Analyze { public : //In stream_t StreamKind; bool Interlaced; //Constructor/Destructor File_Jpeg(); private : //Streams management void Streams_Accept(); //Buffer - File header bool FileHeader_Begin(); //Buffer - Synchro bool Synchronize(); bool Synched_Test(); void Synched_Init(); //Buffer - Demux #if MEDIAINFO_DEMUX bool Demux_UnpacketizeContainer_Test() {return Demux_UnpacketizeContainer_Test_OneFramePerFile();} #endif //MEDIAINFO_DEMUX //Buffer - Global void Read_Buffer_Unsynched(); #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) {return Read_Buffer_Seek_OneFramePerFile(Method, Value, ID);} #endif //MEDIAINFO_SEEK //Buffer - Per element void Header_Parse(); bool Header_Parser_Fill_Size(); void Data_Parse(); //Elements void TEM () {}; void SOC () {} void SIZ (); void COD (); void COC () {Skip_XX(Element_Size, "Data");} void TLM () {Skip_XX(Element_Size, "Data");} void PLM () {Skip_XX(Element_Size, "Data");} void PLT () {Skip_XX(Element_Size, "Data");} void QCD (); void QCC () {Skip_XX(Element_Size, "Data");} void RGN () {Skip_XX(Element_Size, "Data");} void PPM () {Skip_XX(Element_Size, "Data");} void PPT () {Skip_XX(Element_Size, "Data");} void CME () {Skip_XX(Element_Size, "Data");} void SOT () {Skip_XX(Element_Size, "Data");} void SOP () {Skip_XX(Element_Size, "Data");} void EPH () {Skip_XX(Element_Size, "Data");} void SOD (); void SOF_(); void S0F0() {SOF_();}; void S0F1() {SOF_();}; void S0F2() {SOF_();}; void S0F3() {SOF_();} void DHT () {Skip_XX(Element_Size, "Data");} void S0F5() {SOF_();} void S0F6() {SOF_();} void S0F7() {SOF_();} void JPG () {Skip_XX(Element_Size, "Data");} void S0F9() {SOF_();} void S0FA() {SOF_();} void S0FB() {SOF_();} void DAC () {Skip_XX(Element_Size, "Data");} void S0FD() {SOF_();} void S0FE() {SOF_();} void S0FF() {SOF_();} void RST0() {}; void RST1() {}; void RST2() {}; void RST3() {}; void RST4() {}; void RST5() {}; void RST6() {}; void RST7() {}; void SOI () {}; void EOI () {}; void SOS (); void DQT () {Skip_XX(Element_Size, "Data");} void DNL () {Skip_XX(Element_Size, "Data");} void DRI () {Skip_XX(Element_Size, "Data");} void DHP () {Skip_XX(Element_Size, "Data");} void EXP () {Skip_XX(Element_Size, "Data");} void APP0(); void APP0_AVI1(); void APP0_JFIF(); void APP0_JFFF(); void APP0_JFFF_JPEG(); void APP0_JFFF_1B(); void APP0_JFFF_3B(); void APP1(); void APP1_EXIF(); void APP2() {Skip_XX(Element_Size, "Data");} void APP3() {Skip_XX(Element_Size, "Data");} void APP4() {Skip_XX(Element_Size, "Data");} void APP5() {Skip_XX(Element_Size, "Data");} void APP6() {Skip_XX(Element_Size, "Data");} void APP7() {Skip_XX(Element_Size, "Data");} void APP8() {Skip_XX(Element_Size, "Data");} void APP9() {Skip_XX(Element_Size, "Data");} void APPA() {Skip_XX(Element_Size, "Data");} void APPB() {Skip_XX(Element_Size, "Data");} void APPC() {Skip_XX(Element_Size, "Data");} void APPD() {Skip_XX(Element_Size, "Data");} void APPE(); void APPE_Adobe0(); void APPF() {Skip_XX(Element_Size, "Data");} void JPG0() {Skip_XX(Element_Size, "Data");} void JPG1() {Skip_XX(Element_Size, "Data");} void JPG2() {Skip_XX(Element_Size, "Data");} void JPG3() {Skip_XX(Element_Size, "Data");} void JPG4() {Skip_XX(Element_Size, "Data");} void JPG5() {Skip_XX(Element_Size, "Data");} void JPG6() {Skip_XX(Element_Size, "Data");} void JPG7() {Skip_XX(Element_Size, "Data");} void JPG8() {Skip_XX(Element_Size, "Data");} void JPG9() {Skip_XX(Element_Size, "Data");} void JPGA() {Skip_XX(Element_Size, "Data");} void JPGB() {Skip_XX(Element_Size, "Data");} void JPGC() {Skip_XX(Element_Size, "Data");} void JPGD() {Skip_XX(Element_Size, "Data");} void COM () {Skip_XX(Element_Size, "Data");} //Temp int8u APPE_Adobe0_transform; bool APP0_JFIF_Parsed; bool SOS_SOD_Parsed; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Image/File_Pcx.cpp100777 0 0 12644 12226004262 15014 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Contributor: Lionel Duchateau, kurtnoise@free.fr // // From http://courses.engr.illinois.edu/ece390/books/labmanual/graphics-pcx.html // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_PCX_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Image/File_Pcx.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* Pcx_VersionInfo(int16u Version) { switch(Version) { case 0 : return "Paintbrush v2.5"; case 2 : return "Paintbrush v2.8 with palette information"; case 3 : return "Paintbrush v2.8 without palette information"; case 4 : return "Paintbrush/Windows"; case 5 : return "Paintbrush v3.0+"; default: return ""; } } //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_Pcx::FileHeader_Begin() { //Element_Size if (Buffer_Size<130) //Size of the header return false; //Must wait for more data if (Buffer[0]!=0x0A || Buffer[1]>0x05 || Buffer[2]!=0x01 || !(Buffer[3]==1 || Buffer[3]==4 || Buffer[3]==8 || Buffer[3]==24)) { Reject("PCX"); return false; } //All should be OK... return true; } //*************************************************************************** // File Header Information //*************************************************************************** //--------------------------------------------------------------------------- void File_Pcx::Read_Buffer_Continue() { //Parsing int16u XMin, YMin, XMax, YMax, HorDPI, VertDPI, BytesPerLine, PaletteType, HScrSize, VScrSize; int8u Manufacturer, Version, EncodingScheme, BitsPerPixel, ColorPlanes; Get_L1 (Manufacturer, "Manufacturer"); Get_L1 (Version, "Version"); // 0,2,3,4,5 Get_L1 (EncodingScheme, "EncodingScheme"); // RLE=1 Get_L1 (BitsPerPixel, "Bits Per Pixel"); // 1,4,8,24 Get_L2 (XMin, "Left margin of image"); Get_L2 (YMin, "Upper margin of image"); Get_L2 (XMax, "Right margin of image"); Get_L2 (YMax, "Lower margin of image"); Get_L2 (HorDPI, "Horizontal Resolution"); Get_L2 (VertDPI, "Vertical Resolution"); Skip_XX(48, "Palette"); Skip_L1( "Reserved"); Get_L1 (ColorPlanes, "ColorPlanes"); Get_L2 (BytesPerLine, "BytesPerLine"); Get_L2 (PaletteType, "PaletteType"); Get_L2 (HScrSize, "Horizontal Screen Size"); Get_L2 (VScrSize, "Vertical Screen Size"); Skip_XX(56, "Filler"); FILLING_BEGIN(); //Integrity tests if (XMax<=XMin || YMax<=YMin || BytesPerLineFile_Names.size()>1 || Config->File_IsReferenced_Get())?Stream_Video:Stream_Image); Fill(StreamKind_Last, StreamPos_Last, "StreamSize", File_Size); if (StreamKind_Last==Stream_Video) Fill(Stream_Video, StreamPos_Last, Video_FrameCount, Config->File_Names.size()); } else Stream_Prepare(StreamKind_Last); //Configuration Frame_Count_NotParsedIncluded=0; } //*************************************************************************** // Header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Png::FileHeader_Begin() { //Element_Size if (Buffer_Size<8) return false; //Must wait for more data if (CC4(Buffer+4)!=0x0D0A1A0A) //Byte order { Reject("PNG"); return false; } switch (CC4(Buffer)) //Signature { case 0x89504E47 : Accept("PNG"); Fill(Stream_General, 0, General_Format, "PNG"); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Format), "PNG"); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Codec), "PNG"); break; case 0x8A4E4E47 : Accept("PNG"); Fill(Stream_General, 0, General_Format, "MNG"); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Format), "MNG"); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Codec), "MNG"); Finish("PNG"); break; case 0x8B4A4E47 : Accept("PNG"); Fill(Stream_General, 0, General_Format, "JNG"); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Format), "JNG"); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Codec), "JNG"); Finish("PNG"); break; default: Reject("PNG"); } //All should be OK... return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Png::Read_Buffer_Unsynched() { Signature_Parsed=false; Read_Buffer_Unsynched_OneFramePerFile(); } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Png::Header_Parse() { if (!Signature_Parsed) { //Filling Header_Fill_Size(8); Header_Fill_Code(0, "File header"); return; } //Parsing int32u Length, Chunk_Type; Get_B4 (Length, "Length"); Get_C4 (Chunk_Type, "Chunk Type"); //Filling Header_Fill_Size(12+Length); //+4 for CRC Header_Fill_Code(Chunk_Type, Ztring().From_CC4(Chunk_Type)); } //--------------------------------------------------------------------------- void File_Png::Data_Parse() { if (!Signature_Parsed) { Signature(); return; } Element_Size-=4; //For CRC #define CASE_INFO(_NAME, _DETAIL) \ case Elements::_NAME : Element_Info1(_DETAIL); _NAME(); break; //Parsing switch (Element_Code) { CASE_INFO(IDAT, "Image data"); CASE_INFO(IEND, "Image trailer"); CASE_INFO(IHDR, "Image header"); CASE_INFO(PLTE, "Palette table"); default : Skip_XX(Element_Size, "Unknown"); } Element_Size+=4; //For CRC Skip_B4( "CRC"); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Png::Signature() { //Parsing Skip_B4( "Signature"); Skip_B4( "ByteOrder"); Frame_Count++; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; Signature_Parsed=true; } //--------------------------------------------------------------------------- void File_Png::IEND() { Signature_Parsed=false; } //--------------------------------------------------------------------------- void File_Png::IHDR() { //Parsing int32u Width, Height; int8u Bit_depth, Colour_type, Compression_method, Interlace_method; Get_B4 (Width, "Width"); Get_B4 (Height, "Height"); Get_B1 (Bit_depth, "Bit depth"); Get_B1 (Colour_type, "Colour type"); Param_Info1(Png_Colour_type(Colour_type)); Get_B1 (Compression_method, "Compression method"); Skip_B1( "Filter method"); Get_B1 (Interlace_method, "Interlace method"); FILLING_BEGIN_PRECISE(); if (!Status[IsFilled]) { Fill(StreamKind_Last, 0, "Width", Width); Fill(StreamKind_Last, 0, "Height", Height); int8u Resolution; switch (Colour_type) { case 0 : Resolution=Bit_depth; break; case 2 : Resolution=Bit_depth*3; break; case 3 : Resolution=Bit_depth; break; case 4 : Resolution=Bit_depth*2; break; case 6 : Resolution=Bit_depth*4; break; default: Resolution=0; } if (Resolution) Fill(StreamKind_Last, 0, "BitDepth", Resolution); switch (Compression_method) { case 0 : Fill(StreamKind_Last, 0, "Format_Compression", "LZ77"); break; default: ; } switch (Interlace_method) { case 0 : break; case 1 : break; default: ; } Fill(); } if (Config->ParseSpeed<1.0) Finish("PNG"); //No need of more FILLING_END(); } } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Image/File_Png.h100777 0 0 3752 12226004262 14433 0/* 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 PNG files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_PngH #define MediaInfo_File_PngH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Png //*************************************************************************** class File_Png : public File__Analyze { public : //Constructor/Destructor File_Png(); private : //Streams management void Streams_Accept(); //Buffer - File header bool FileHeader_Begin(); //Buffer - Demux #if MEDIAINFO_DEMUX bool Demux_UnpacketizeContainer_Test() {return Demux_UnpacketizeContainer_Test_OneFramePerFile();} #endif //MEDIAINFO_DEMUX //Buffer - Global void Read_Buffer_Unsynched(); #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) {return Read_Buffer_Seek_OneFramePerFile(Method, Value, ID);} #endif //MEDIAINFO_SEEK //Buffer - Per element void Header_Parse(); void Data_Parse(); //Elements void Signature(); void IDAT() {Skip_XX(Element_Size, "Data");} void IEND(); void IHDR(); void PLTE() {Skip_XX(Element_Size, "Data");} //Temp bool Signature_Parsed; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Image/File_Psd.cpp100777 0 0 10325 12226004262 15002 0/* 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 PSD files // // Contributor: Lionel Duchateau, kurtnoise@free.fr // // From http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/PhotoshopFileFormats.htm // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_PSD_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Image/File_Psd.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* Psd_ColorMode(int16u ColorMode) { switch(ColorMode) { case 0 : return "Bitmap"; case 1 : return "Grayscale"; case 2 : return "Indexed"; case 3 : return "RGB"; case 4 : return "CMYK"; case 7 : return "Multichannel"; case 8 : return "Duotone"; case 9 : return "Lab"; default: return ""; } } //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_Psd::FileHeader_Begin() { //Element_Size if (Buffer_Size<4) return false; //Must wait for more data if (CC4(Buffer)!=0x38425053) //"8BPS" { Reject("PSD"); return false; } //All should be OK... return true; } //*************************************************************************** // File Header Information //*************************************************************************** //--------------------------------------------------------------------------- void File_Psd::Read_Buffer_Continue() { //Parsing int32u Width, Height; int16u BitsDepth, Version, channels, ColorMode; Skip_C4( "Signature"); Get_B2 (Version, "Version"); // 1 = PSD, 2 = PSB Skip_B6( "Reserved"); Get_B2 (channels, "channels"); // 1 to 56, including alpha channel Get_B4 (Height, "Height"); Get_B4 (Width, "Width"); Get_B2 (BitsDepth, "Depth"); // 1,8,16 or 32 Get_B2 (ColorMode, "Color Mode"); Param_Info1(Psd_ColorMode(ColorMode)); FILLING_BEGIN(); Accept("PSD"); Stream_Prepare(Stream_Image); Fill(Stream_Image, 0, Image_Format, Version==1?"PSD":"PSB"); Fill(Stream_Image, 0, Image_Format_Version, Version); Fill(Stream_Image, 0, Image_ColorSpace, Psd_ColorMode(ColorMode)); Fill(Stream_Image, 0, Image_Width, Width); Fill(Stream_Image, 0, Image_Height, Height); Fill(Stream_Image, 0, Image_BitDepth, BitsDepth); Finish("PSD"); FILLING_END(); } } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Image/File_Psd.h100777 0 0 2416 12226004262 14431 0/* 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 PSD files // // Contributor: Lionel Duchateau, kurtnoise@free.fr // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_PsdH #define MediaInfo_File_PsdH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Psd //*************************************************************************** class File_Psd : public File__Analyze { protected : //Buffer - File header bool FileHeader_Begin(); //Elements void Read_Buffer_Continue(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Image/File_Rle.cpp100777 0 0 5017 12226004262 14760 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_RLE_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Image/File_Rle.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Rle::File_Rle() :File__Analyze() { //Configuration ParserName=__T("RLE"); } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Rle::Streams_Fill() { Stream_Prepare(Stream_General); Fill(Stream_General, 0, General_Format, "RLE"); Stream_Prepare(Stream_Text); //TODO: This is currenlty only text Fill(Stream_Text, 0, Text_Format, "RLE"); Fill(Stream_Text, 0, Text_Codec, "RLE"); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Rle::Read_Buffer_Continue() { //Filling Accept(); Finish("RLE"); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_RLE_YES MediaInfoLib/Source/MediaInfo/Image/File_Rle.h100777 0 0 2360 12226004262 14423 0/* 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 RLE files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_RleH #define MediaInfo_File_RleH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Rle //*************************************************************************** class File_Rle : public File__Analyze { public : File_Rle(); private : //Streams management void Streams_Fill(); //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Image/File_Tga.cpp100777 0 0 25356 12226004262 15001 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // TGA format // // From http://www.dca.fee.unicamp.br/~martino/disciplinas/ea978/tgaffs.pdf // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_TGA_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Image/File_Tga.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Info //*************************************************************************** //--------------------------------------------------------------------------- const char* Tga_Image_Type_Compression(int8u Image_Type) { switch (Image_Type) { case 1 : return "Color-mapped"; case 2 : case 3 : return "Raw"; case 9 : return "Color-mapped + RLE"; case 10 : case 11 : return "RLE"; case 32 : case 33 : return "Huffman"; default : return ""; } } //--------------------------------------------------------------------------- const char* Tga_Image_Type_ColorSpace(int8u Image_Type) { switch (Image_Type) { case 1 : case 2 : case 9 : case 10 : case 32 : case 33 : return "RGB"; case 3 : case 11 : return "Y"; default : return ""; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Tga::File_Tga() { //Configuration ParserName=__T("TGA"); Buffer_MaximumSize=64*1024*1024; //Some big frames are possible (e.g YUV 4:2:2 10 bits 1080p) } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Tga::Streams_Fill() { Fill(Stream_General, 0, General_Format, "TGA"); Fill(Stream_General, 0, General_Format_Version, __T("Version ")+Ztring::ToZtring(Version)); Fill(Stream_General, 0, General_Title, Image_ID); Stream_Prepare(Stream_Image); Fill(Stream_Image, 0, Image_Format, Tga_Image_Type_Compression(Image_Type)); Fill(Stream_Image, 0, Image_ColorSpace, Tga_Image_Type_ColorSpace(Image_Type)); Fill(Stream_Image, 0, Image_CodecID, Image_Type); Fill(Stream_Image, 0, Image_Width, Image_Width_); Fill(Stream_Image, 0, Image_Height, Image_Height_); Fill(Stream_Image, 0, Image_BitDepth, Pixel_Depth); } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Tga::FileHeader_Begin() { //Element_Size if (Buffer_Sizefirst) IfdItems.clear(); //There was a problem during the seek, trashing remaining positions from last IFD else { Header_Fill_Code(IfdItems.begin()->second.Tag, Tiff_Tag_Name(IfdItems.begin()->second.Tag)); Header_Fill_Size(Tiff_Type_Size(IfdItems.begin()->second.Type)*IfdItems.begin()->second.Count); return; } } /* A tiff images consist in principle of two types of blocks, IFD's and data blocks */ /* Each datablock, which could be a image, tiles, transperancy filter is described by one IFD. */ /* These IFD's can be placed at any offset in the file and are linked in a chain fashion way. */ /* where one IFD points out where the next IFD is placed */ /* */ /* A creator of a tiff file must describe the "main image" in the first IFD, this means that a */ /* reader, such this one, only need to read the first IFD in order to get the bitdepth, resolution etc. */ /* of the main image. */ /* Read one IFD and print out the result */ /* Scan the tiff file for the IFD's (Image File Directory) */ /* As long as the IFD offset to the next IFD in the file is not 0 */ /* Get number of directories for this IFD */ int16u NrOfDirectories; Get_X2 (NrOfDirectories, "NrOfDirectories"); //Filling Header_Fill_Code(0xFFFFFFFF, "IFD"); //OxFFFFFFFF can not be a Tag, so using it as a magic value Header_Fill_Size(2+12*((int64u)NrOfDirectories)+4); //2 for header + 12 per directory + 4 for next IFD offset } //--------------------------------------------------------------------------- void File_Tiff::Data_Parse() { int32u IFDOffset=0; if (IfdItems.empty()) { //Default values Infos.clear(); Infos[Tiff_Tag::BitsPerSample]=__T("1"); //Parsing new IFD while (Element_Offset+8+4second); //Parsing the IFD item IfdItems.erase(IfdItems.begin()->first); //Removing IFD item from the list of IFD items to parse } //Some items are not inside the directory, jumping to the offset if (!IfdItems.empty()) GoTo(IfdItems.begin()->first, "TIFF"); else { //This IFD is finished, filling data then going to next IFD Data_Parse_Fill(); if (IFDOffset) GoTo(IFDOffset, "TIFF"); else { Finish(); //No more IFDs GoToFromEnd(0); } } } //--------------------------------------------------------------------------- void File_Tiff::Data_Parse_Fill() { Stream_Prepare(Stream_Image); infos::iterator Info; //Width Info=Infos.find(Tiff_Tag::ImageWidth); if (Info!=Infos.end()) Fill(Stream_Image, StreamPos_Last, Image_Width, Info->second.Read()); //Height Info=Infos.find(Tiff_Tag::ImageLength); if (Info!=Infos.end()) Fill(Stream_Image, StreamPos_Last, Image_Height, Info->second.Read()); //BitsPerSample Info=Infos.find(Tiff_Tag::BitsPerSample); if (Info!=Infos.end()) Fill(Stream_Image, StreamPos_Last, Image_BitDepth, Info->second.Read()); //Compression Info=Infos.find(Tiff_Tag::Compression); if (Info!=Infos.end()) { int32u Value=Info->second.Read().To_int32u(); Fill(Stream_Image, StreamPos_Last, Image_Format, Tiff_Compression(Value)); Fill(Stream_Image, StreamPos_Last, Image_Codec, Tiff_Compression(Value)); Fill(Stream_Image, StreamPos_Last, Image_Compression_Mode, Tiff_Compression_Mode(Value)); } //PhotometricInterpretation Info=Infos.find(Tiff_Tag::PhotometricInterpretation); if (Info!=Infos.end()) { int32u Value=Info->second.Read().To_int32u(); Fill(Stream_Image, StreamPos_Last, Image_ColorSpace, Tiff_PhotometricInterpretation_ColorSpace(Value)); //Note: should we differeniate between raw RGB and palette (also RGB actually...) } //ImageDescription Info=Infos.find(Tiff_Tag::ImageDescription); if (Info!=Infos.end()) Fill(Stream_Image, StreamPos_Last, Image_Title, Info->second.Read()); //ExtraSamples Info=Infos.find(Tiff_Tag::ExtraSamples); if (Info!=Infos.end()) { Ztring ColorSpace=Retrieve(Stream_Image, StreamPos_Last, Image_ColorSpace); ColorSpace+=Ztring().From_Local(Tiff_ExtraSamples_ColorSpace(Info->second.Read().To_int32u())); Fill(Stream_Image, StreamPos_Last, Image_ColorSpace, ColorSpace, true); } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Tiff::Read_Directory() { /* Each directory consist of 4 fields */ /* Get information for this directory */ Element_Begin0(); ifditem IfdItem; Get_X2 (IfdItem.Tag, "Tag"); Param_Info1(Tiff_Tag_Name(IfdItem.Tag)); Get_X2 (IfdItem.Type, "Type"); Param_Info1(Tiff_Type_Name(IfdItem.Type)); Get_X4 (IfdItem.Count, "Count"); Element_Name(Tiff_Tag_Name(IfdItem.Tag)); if (Tiff_Type_Size(IfdItem.Type)*IfdItem.Count<=4) { GetValueOffsetu(IfdItem); /* Padding up, skip dummy bytes */ if (Tiff_Type_Size(IfdItem.Type)==0) { if (Element_Offset+4=10) { //Too many data, we don't currently need it and we skip it Skip_XX(Element_Size-(Element_Offset+4), Name); Info.clear(); return; } switch (IfdItem.Type) { case 1: /* 8-bit unsigned integer. */ for (int16u Pos=0; PosElement_Size) { Trusted_IsNot(); break; } if (LittleEndian) Ret8=LittleEndian2int8u(Buffer+Buffer_Offset+(size_t)Element_Offset); else Ret8=BigEndian2int8u(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset++; #endif //MEDIAINFO_TRACE Info.push_back(Ztring::ToZtring(Ret8)); } break; case 3: /* 16-bit (2-byte) unsigned integer. */ for (int16u Pos=0; PosElement_Size) { Trusted_IsNot(); break; } if (LittleEndian) Ret16=LittleEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset); else Ret16=BigEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=2; #endif //MEDIAINFO_TRACE Info.push_back(Ztring::ToZtring(Ret16)); } break; case 4: /* 32-bit (4-byte) unsigned integer */ for (int16u Pos=0; PosElement_Size) { Trusted_IsNot(); break; } if (LittleEndian) Ret32=LittleEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset); else Ret32=BigEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=4; #endif //MEDIAINFO_TRACE Info.push_back(Ztring::ToZtring(Ret32)); } break; default: //Unknown { if (LittleEndian) Skip_L4( Name); else Skip_B4( Name); Info.clear(); //We actually do not know the type } } } } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Image/File_Tiff.h100777 0 0 3627 12226004262 14600 0/* 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 TIFF files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_TiffH #define MediaInfo_File_TiffH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Tiff //*************************************************************************** class File_Tiff : public File__Analyze { public: //Constructor/Destructor File_Tiff(); private : //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse(); //Buffer - Per element void Header_Parse(); void Data_Parse(); void Data_Parse_Fill(); //Elements void Read_Directories(); void Read_Directory(); //Temp struct ifditem { int16u Tag; int16u Type; int32u Count; }; typedef std::map ifditems; //Key is byte offset ifditems IfdItems; typedef std::map infos; //Key is Tag value infos Infos; bool LittleEndian; //Helpers void Get_X2 (int16u &Info, const char* Name); void Get_X4 (int32u &Info, const char* Name); void GetValueOffsetu(ifditem &IfdItem); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/MediaInfo.cpp100777 0 0 17354 12226004262 14137 0// MediaInfo - All info about media files //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/MediaInfo.h" #include "MediaInfo/MediaInfo_Internal.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- //To clarify the code namespace MediaInfo_Debug_MediaInfo { #if defined (MEDIAINFO_DEBUG_CONFIG) || defined (MEDIAINFO_DEBUG_BUFFER) || defined (MEDIAINFO_DEBUG_OUTPUT) #ifdef WINDOWS const Char* MediaInfo_Debug_Name=__T("MediaInfo_Debug"); #else const Char* MediaInfo_Debug_Name=__T("/tmp/MediaInfo_Debug"); #endif #endif #ifdef MEDIAINFO_DEBUG_CONFIG #define MEDIAINFO_DEBUG_STATIC(_TOAPPEND) \ { \ File F(Ztring(MediaInfo_Debug_Name)+__T(".Config.static.txt"), File::Access_Write_Append); \ Ztring Debug; \ _TOAPPEND; \ Debug+=__T("\r\n"); \ F.Write(Debug); \ F.Close(); \ } #else // MEDIAINFO_DEBUG_CONFIG #define MEDIAINFO_DEBUG_STATIC(_TOAPPEND) #endif // MEDIAINFO_DEBUG_CONFIG } using namespace MediaInfo_Debug_MediaInfo; //*************************************************************************** // Constructor/destructor //*************************************************************************** //--------------------------------------------------------------------------- MediaInfo::MediaInfo() { Internal=new MediaInfo_Internal(); } //--------------------------------------------------------------------------- MediaInfo::~MediaInfo() { delete Internal; //Internal=NULL; } //*************************************************************************** // Files //*************************************************************************** //--------------------------------------------------------------------------- size_t MediaInfo::Open(const String &File_Name_) { return Internal->Open(File_Name_); } //--------------------------------------------------------------------------- size_t MediaInfo::Open (const int8u* Begin, size_t Begin_Size, const int8u* End, size_t End_Size, int64u File_Size) { return Internal->Open(Begin, Begin_Size, End, End_Size, (File_SizeOpen_Buffer_Init(File_Size, File_Offset); } //--------------------------------------------------------------------------- size_t MediaInfo::Open_Buffer_Continue (const int8u* ToAdd, size_t ToAdd_Size) { return Internal->Open_Buffer_Continue(ToAdd, ToAdd_Size).to_ulong(); } //--------------------------------------------------------------------------- int64u MediaInfo::Open_Buffer_Continue_GoTo_Get () { return Internal->Open_Buffer_Continue_GoTo_Get(); } //--------------------------------------------------------------------------- size_t MediaInfo::Open_Buffer_Finalize () { return Internal->Open_Buffer_Finalize(); } //--------------------------------------------------------------------------- size_t MediaInfo::Open_NextPacket () { return Internal->Open_NextPacket().to_ulong(); } //--------------------------------------------------------------------------- size_t MediaInfo::Save() { return 0; //Not yet implemented } //--------------------------------------------------------------------------- void MediaInfo::Close() { return Internal->Close(); } //*************************************************************************** // Get File info //*************************************************************************** //--------------------------------------------------------------------------- String MediaInfo::Inform(size_t) { return Internal->Inform(); } //--------------------------------------------------------------------------- String MediaInfo::Get(stream_t StreamKind, size_t StreamPos, size_t Parameter, info_t KindOfInfo) { return Internal->Get(StreamKind, StreamPos, Parameter, KindOfInfo); } //--------------------------------------------------------------------------- String MediaInfo::Get(stream_t StreamKind, size_t StreamPos, const String &Parameter, info_t KindOfInfo, info_t KindOfSearch) { return Internal->Get(StreamKind, StreamPos, Parameter, KindOfInfo, KindOfSearch); } //*************************************************************************** // Set File info //*************************************************************************** //--------------------------------------------------------------------------- size_t MediaInfo::Set(const String &, stream_t, size_t, size_t, const String &) { return 0; //Not yet implemented } //--------------------------------------------------------------------------- size_t MediaInfo::Set(const String &, stream_t, size_t, const String &, const String &) { return 0; //Not yet implemented } //*************************************************************************** // Output buffer //*************************************************************************** //--------------------------------------------------------------------------- size_t MediaInfo::Output_Buffer_Get (const String &Value) { return Internal->Output_Buffer_Get(Value); } //--------------------------------------------------------------------------- size_t MediaInfo::Output_Buffer_Get (size_t Pos) { return Internal->Output_Buffer_Get(Pos); } //*************************************************************************** // Information //*************************************************************************** //--------------------------------------------------------------------------- String MediaInfo::Option (const String &Option, const String &Value) { return Internal->Option(Option, Value); } //--------------------------------------------------------------------------- String MediaInfo::Option_Static (const String &Option, const String &Value) { MEDIAINFO_DEBUG_STATIC(Debug+=__T("Option_Static, Option=");Debug+=Ztring(Option);Debug+=__T(", Value=");Debug+=Ztring(Value);) MediaInfoLib::Config.Init(); //Initialize Configuration if (Option==__T("Info_Capacities")) { return __T("Option disactivated for this version, will come back soon!"); //MediaInfo_Internal MI; //return MI.Option(Option); } else if (Option==__T("Info_Version")) { Ztring ToReturn=MediaInfoLib::Config.Info_Version_Get(); if (MediaInfo_Internal::LibraryIsModified()) ToReturn+=__T(" modified"); return ToReturn; } else return MediaInfoLib::Config.Option(Option, Value); } //--------------------------------------------------------------------------- size_t MediaInfo::Count_Get (stream_t StreamKind, size_t StreamPos) { return Internal->Count_Get(StreamKind, StreamPos); } //--------------------------------------------------------------------------- size_t MediaInfo::State_Get () { return Internal->State_Get(); } } //NameSpace MediaInfoLib/Source/MediaInfo/MediaInfo.h100777 0 0 37551 12226004261 13604 0// MediaInfo - All information about media files //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Give information about a lot of media files // Dispatch the file to be tested by all containers // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfoH #define MediaInfoH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/MediaInfo_Const.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #undef MEDIAINFO_EXP #if defined(_WIN32) && !defined(__MINGW32__) //MinGW32 does not support _declspec #ifdef MEDIAINFO_DLL_EXPORT #define MEDIAINFO_EXP #else #define MEDIAINFO_EXP #endif #else //defined(_WIN32) && !defined(__MINGW32__) #if __GNUC__ >= 4 #define MEDIAINFO_EXP __attribute__ ((visibility("default"))) #else #define MEDIAINFO_EXP #endif #endif //defined(_WIN32) && !defined(__MINGW32__) #if !defined(__WINDOWS__) #define __stdcall //Supported only on windows #endif //!defined(_WIN32) //--------------------------------------------------------------------------- namespace MediaInfoLib { class MediaInfo_Internal; //*************************************************************************** /// @brief MediaInfo /// @version 0.7 //*************************************************************************** class MEDIAINFO_EXP MediaInfo { public : //Constructor/Destructor MediaInfo (); ~MediaInfo (); //File /// Open a file and collect information about it (technical information and tags) /// @brief Open a file /// @param File_Name Full name of file to open /// @retval 0 File not opened /// @retval 1 File opened size_t Open (const String &File_Name); /// Open a Buffer (Begin and end of the stream) and collect information about it (technical information and tags) /// @brief Open a buffer /// @param Begin First bytes of the buffer /// @param Begin_Size Size of Begin /// @param End Last bytes of the buffer /// @param End_Size Size of End /// @param File_Size Total size of the file /// @retval 0 File not opened /// @retval 1 File opened size_t Open (const ZenLib::int8u* Begin, size_t Begin_Size, const ZenLib::int8u* End=NULL, size_t End_Size=0, ZenLib::int64u File_Size=0); /// Open a stream and collect information about it (technical information and tags) /// @brief Open a stream (Init) /// @param File_Size Estimated file size /// @param File_Offset Offset of the file (if we don't have the beginning of the file) /// @retval 0 File not opened /// @retval 1 File opened size_t Open_Buffer_Init (ZenLib::int64u File_Size=(ZenLib::int64u)-1, ZenLib::int64u File_Offset=0); /// Open a stream and collect information about it (technical information and tags) /// @brief Open a stream (Continue) /// @param Buffer pointer to the stream /// @param Buffer_Size Count of bytes to read /// @return a bitfield \n /// bit 0: Is Accepted (format is known) /// bit 1: Is Filled (main data is collected) /// bit 2: Is Updated (some data have beed updated, example: duration for a real time MPEG-TS stream) /// bit 3: Is Finalized (No more data is needed, will not use further data) /// bit 4-15: Reserved /// bit 16-31: User defined size_t Open_Buffer_Continue (const ZenLib::int8u* Buffer, size_t Buffer_Size); /// Open a stream and collect information about it (technical information and tags) /// @brief Open a stream (Get the needed file Offset) /// @return the needed offset of the file \n /// File size if no more bytes are needed ZenLib::int64u Open_Buffer_Continue_GoTo_Get (); /// Open a stream and collect information about it (technical information and tags) /// @brief Open a stream (Finalize) /// @retval 0 failed /// @retval 1 succeed size_t Open_Buffer_Finalize (); /// If Open() is used in "PerPacket" mode, parse only one packet and return /// @brief Read one packet (if "PerPacket" mode is set) /// @return a bitfield \n /// bit 0: A packet was read size_t Open_NextPacket (); /// (NOT IMPLEMENTED YET) Save the file opened before with Open() (modifications of tags) /// @brief (NOT IMPLEMENTED YET) Save the file /// @retval 0 failed /// @retval 1 suceed size_t Save (); /// Close a file opened before with Open() (without saving) /// @brief Close a file /// @warning without have saved before, modifications are lost void Close (); //General information /// Get all details about a file in one string /// @brief Get all details about a file /// @param Reserved Reserved, do not use /// @pre You can change default presentation with Inform_Set() /// @return Text with information about the file String Inform (size_t Reserved=0); //Get /// Get a piece of information about a file (parameter is an integer) /// @brief Get a piece of information about a file (parameter is an integer) /// @param StreamKind Kind of stream (general, video, audio...) /// @param StreamNumber Stream number in Kind of stream (first, second...) /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in integer format (first parameter, second parameter...) /// @param InfoKind Kind of information you want about the parameter (the text, the measure, the help...) /// @return a string about information you search \n /// an empty string if there is a problem String Get (stream_t StreamKind, size_t StreamNumber, size_t Parameter, info_t InfoKind=Info_Text); /// Get a piece of information about a file (parameter is a string) /// @brief Get a piece of information about a file (parameter is a string) /// @param StreamKind Kind of stream (general, video, audio...) /// @param StreamNumber Stream number in Kind of stream (first, second...) /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in string format ("Codec", "Width"...) \n /// See MediaInfo::Option("Info_Parameters") to have the full list /// @param InfoKind Kind of information you want about the parameter (the text, the measure, the help...) /// @param SearchKind Where to look for the parameter /// @return a string about information you search \n /// an empty string if there is a problem String Get (stream_t StreamKind, size_t StreamNumber, const String &Parameter, info_t InfoKind=Info_Text, info_t SearchKind=Info_Name); //Set /// (NOT IMPLEMENTED YET) Set a piece of information about a file (parameter is an integer) /// @brief (NOT IMPLEMENTED YET) Set a piece of information about a file (parameter is an int) /// @warning Not yet implemented, do not use it /// @param ToSet Piece of information /// @param StreamKind Kind of stream (general, video, audio...) /// @param StreamNumber Stream number in Kind of stream (first, second...) /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in integer format (first parameter, second parameter...) /// @param OldValue The old value of the parameter \n if OldValue is empty and ToSet is filled: tag is added \n if OldValue is filled and ToSet is filled: tag is replaced \n if OldValue is filled and ToSet is empty: tag is deleted /// @retval >0 succeed /// @retval 0 failed size_t Set (const String &ToSet, stream_t StreamKind, size_t StreamNumber, size_t Parameter, const String &OldValue=String()); /// (NOT IMPLEMENTED YET) Set a piece of information about a file (parameter is a string) /// @warning Not yet implemented, do not use it /// @brief (NOT IMPLEMENTED YET) Set information about a file (parameter is a string) /// @param ToSet Piece of information /// @param StreamKind Kind of stream (general, video, audio...) /// @param StreamNumber Stream number in Kind of stream (first, second...) /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in string format /// @param OldValue The old value of the parameter \n if OldValue is empty and ToSet is filled: tag is added \n if OldValue is filled and ToSet is filled: tag is replaced \n if OldValue is filled and ToSet is empty: tag is deleted /// @retval >0 succeed /// @retval 0 failed size_t Set (const String &ToSet, stream_t StreamKind, size_t StreamNumber, const String &Parameter, const String &OldValue=String()); //Output_Buffered /// Output the written size when "File_Duplicate" option is used. /// @brief Output the written size when "File_Duplicate" option is used. /// @param Value The unique name of the duplicated stream (begin with "memory://") /// @return The size of the used buffer size_t Output_Buffer_Get (const String &Value); /// Output the written size when "File_Duplicate" option is used. /// @brief Output the written size when "File_Duplicate" option is used. /// @param Pos The order of calling /// @return The size of the used buffer size_t Output_Buffer_Get (size_t Pos); //Info /// Configure or get information about MediaInfoLib /// @param Option The name of option /// @param Value The value of option /// @return Depend of the option: by default "" (nothing) means No, other means Yes /// @post Known options are: \n /// * (NOT IMPLEMENTED YET) "BlockMethod": Configure when Open Method must return (default or not command not understood: "1") \n /// "0": Immediatly \n /// "1": After geting local information \n /// "2": When user interaction is needed, or whan Internet information is get /// * "Complete": For debug, configure if MediaInfoLib::Inform() show all information (doesn't care of InfoOption_NoShow tag): shows all information if true, shows only useful for user information if false (No by default)\n /// * "Complete_Get": return the state of "Complete" \n /// * "Language": Configure language (default language, and this object); Value is Description of language (format: "Column1;Colum2\n...) \n /// Column 1: Unique name ("Bytes", "Title") \n /// Column 2: translation ("Octets", "Titre") \n /// * "Language_Get": Get the language file in memory /// * "Language_Update": Configure language of this object only (for optimisation); Value is Description of language (format: "Column1;Colum2\n...) \n /// Column 1: Unique name ("Bytes", "Title") \n /// Column 2: translation ("Octets", "Titre") \n /// * "Inform": Configure custom text, See MediaInfoLib::Inform() function; Description of views (format: "Column1;Colum2...) \n /// Column 1: code (11 lines: "General", "Video", "Audio", "Text", "Other", "Begin", "End", "Page_Begin", "Page_Middle", "Page_End") \n /// Column 2: The text to show (exemple: "Audio: %FileName% is at %BitRate/String%") \n /// * "ParseUnknownExtensions": Configure if MediaInfo parse files with unknown extension\n /// * "ParseUnknownExtensions_Get": Get if MediaInfo parse files with unknown extension\n /// * "ShowFiles": Configure if MediaInfo keep in memory files with specific kind of streams (or no streams); Value is Description of components (format: "Column1;Colum2\n...) \n\n /// Column 1: code (available: "Nothing" for unknown format, "VideoAudio" for at least 1 video and 1 audio, "VideoOnly" for video streams only, "AudioOnly", "TextOnly") \n /// Column 2: "" (nothing) not keeping, other for keeping /// * (NOT IMPLEMENTED YET) "TagSeparator": Configure the separator if there are multiple same tags (" | " by default)\n /// * (NOT IMPLEMENTED YET) "TagSeparator_Get": return the state of "TagSeparator" \n /// * (NOT IMPLEMENTED YET) "Internet": Authorize Internet connection (Yes by default) /// * (NOT IMPLEMENTED YET) "Internet_Title_Get": When State=5000, give all possible titles for this file (one per line) \n /// Form: Author TagSeparator Title TagSeparator Year\n... /// * (NOT IMPLEMENTED YET) "Internet_Title_Set": Set the Good title (same as given by Internet_Title_Get) \n /// Form: Author TagSeparator Title TagSeparator Year /// * "Info_Parameters": Information about what are known unique names for parameters \n /// * "Info_Parameters_CSV": Information about what are known unique names for parameters, in CSV format \n /// * "Info_Codecs": Information about which codec is known \n /// * "Info_Version": Information about the version of MediaInfoLib /// * "Info_Url": Information about where to find the last version String Option (const String &Option, const String &Value=String()); /// Configure or get information about MediaInfoLib /// @param Option The name of option /// @param Value The value of option /// @return Depend of the option: by default "" (nothing) means No, other means Yes /// @post Known options are: See MediaInfo::Option() static String Option_Static (const String &Option, const String &Value=String()); /// @brief (NOT IMPLEMENTED YET) Get the state of the library /// @retval <1000 No information is available for the file yet /// @retval >=1000_<5000 Only local (into the file) information is available, getting Internet information (titles only) is no finished yet /// @retval 5000 (only if Internet connection is accepted) User interaction is needed (use Option() with "Internet_Title_Get") \n /// Warning: even there is only one possible, user interaction (or the software) is needed /// @retval >5000<=10000 Only local (into the file) information is available, getting Internet information (all) is no finished yet /// @retval <10000 Done size_t State_Get (); /// @brief Count of streams of a stream kind (StreamNumber not filled), or count of piece of information in this stream /// @param StreamKind Kind of stream (general, video, audio...) /// @param StreamNumber Stream number in this kind of stream (first, second...) /// @return The count of fields for this stream kind / stream number if stream number is provided, else the count of streams for this stream kind size_t Count_Get (stream_t StreamKind, size_t StreamNumber=(size_t)-1); private : MediaInfo_Internal* Internal; //Constructor MediaInfo (const MediaInfo&); // Prevent copy-construction MediaInfo& operator=(const MediaInfo&); // Prevent assignment }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/MediaInfoList.cpp100777 0 0 22537 12226004262 14772 0/* 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. */ //--------------------------------------------------------------------------- // For user: you can disable or enable it //#define MEDIAINFO_DEBUG //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(__BORLANDC__) && defined (_DEBUG) //Why? in Debug mode with release Wx Libs, wxAssert is not defined? void wxAssert (int, const wchar_t*, int, const wchar_t*, const wchar_t*){return;} void wxAssert (int, const char*, int, const char*, const char*){return;} #endif #include "MediaInfoList.h" #include "MediaInfoList_Internal.h" using namespace ZenLib; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //To clarify the code namespace MediaInfoList_Debug { #ifdef MEDIAINFO_DEBUG #include FILE* F; std::string Debug; #undef MEDIAINFO_DEBUG #define MEDIAINFO_DEBUG(_TOAPPEND) \ F=fopen("MediaInfoList_Debug.txt", "a+t"); \ Debug.clear(); \ _TOAPPEND; \ Debug+="\r\n"; \ fwrite(Debug.c_str(), Debug.size(), 1, F); \ fclose(F); #else // MEDIAINFO_DEBUG #define MEDIAINFO_DEBUG(_TOAPPEND) #endif // MEDIAINFO_DEBUG #ifdef MEDIAINFO_DEBUG #define EXECUTE_VOID(_METHOD,_DEBUGB) \ ((MediaInfo_Internal*)Internal)->_METHOD; #else //MEDIAINFO_DEBUG #define EXECUTE_VOID(_METHOD,_DEBUGB) \ ((MediaInfo_Internal*)Internal)->_METHOD; \ MEDIAINFO_DEBUG(_DEBUGB) #endif //MEDIAINFO_DEBUG #ifdef MEDIAINFO_DEBUG #define EXECUTE_INT(_METHOD,_DEBUGB) \ return ((MediaInfo_Internal*)Internal)->_METHOD; #else //MEDIAINFO_DEBUG #define EXECUTE_INT(_METHOD, _DEBUGB) \ int64u ToReturn=((MediaInfo_Internal*)Internal)->_METHOD; \ MEDIAINFO_DEBUG(_DEBUGB) \ return ToReturn; #endif //MEDIAINFO_DEBUG #ifdef MEDIAINFO_DEBUG #define EXECUTE_STRING(_METHOD,_DEBUGB) \ return ((MediaInfo_Internal*)Internal)->_METHOD; #else //MEDIAINFO_DEBUG #define EXECUTE_STRING(_METHOD,_DEBUGB) \ Ztring ToReturn=((MediaInfo_Internal*)Internal)->_METHOD; \ MEDIAINFO_DEBUG(_DEBUGB) \ return ToReturn; #endif //MEDIAINFO_DEBUG } using namespace MediaInfoList_Debug; namespace MediaInfoLib { //*************************************************************************** // Gestion de la classe //*************************************************************************** //--------------------------------------------------------------------------- //Constructeurs MediaInfoList::MediaInfoList(size_t Count_Init) { MEDIAINFO_DEBUG(Debug+="Construction";) Internal=new MediaInfoList_Internal(Count_Init); } //--------------------------------------------------------------------------- //Destructeur MediaInfoList::~MediaInfoList() { MEDIAINFO_DEBUG(Debug+="Destruction";) delete Internal; //Internal=NULL; } //*************************************************************************** // Files //*************************************************************************** //--------------------------------------------------------------------------- size_t MediaInfoList::Open(const String &File, const fileoptions_t Options) { MEDIAINFO_DEBUG(Debug+="Open, File=";Debug+=Ztring(File).To_Local().c_str();) return Internal->Open(File, Options); } //--------------------------------------------------------------------------- size_t MediaInfoList::Open_Buffer_Init (int64u File_Size_, int64u File_Offset_) { return Internal->Open_Buffer_Init(File_Size_, File_Offset_); } //--------------------------------------------------------------------------- size_t MediaInfoList::Open_Buffer_Continue (size_t FilePos, const int8u* ToAdd, size_t ToAdd_Size) { return Internal->Open_Buffer_Continue(FilePos, ToAdd, ToAdd_Size); } //--------------------------------------------------------------------------- int64u MediaInfoList::Open_Buffer_Continue_GoTo_Get (size_t FilePos) { return Internal->Open_Buffer_Continue_GoTo_Get(FilePos); } //--------------------------------------------------------------------------- size_t MediaInfoList::Open_Buffer_Finalize (size_t FilePos) { return Internal->Open_Buffer_Finalize(FilePos); } //--------------------------------------------------------------------------- size_t MediaInfoList::Save(size_t) { return 0; //Not yet implemented } //--------------------------------------------------------------------------- void MediaInfoList::Close(size_t FilePos) { Internal->Close(FilePos); } //*************************************************************************** // Get File info //*************************************************************************** //--------------------------------------------------------------------------- String MediaInfoList::Inform(size_t FilePos, size_t) { return Internal->Inform(FilePos); } //--------------------------------------------------------------------------- String MediaInfoList::Get(size_t FilePos, stream_t KindOfStream, size_t StreamNumber, size_t Parameter, info_t KindOfInfo) { return Internal->Get(FilePos, KindOfStream, StreamNumber, Parameter, KindOfInfo); } //--------------------------------------------------------------------------- String MediaInfoList::Get(size_t FilePos, stream_t KindOfStream, size_t StreamNumber, const String &Parameter, info_t KindOfInfo, info_t KindOfSearch) { //TRACE(Trace+=__T("Get(L), CompleteName=");Trace+=Info[FilePos].Get(Stream_General, 0, __T("CompleteName")).c_str();) //TRACE(Trace+=__T("Get(L), StreamKind=");Trace+=ZenLib::Ztring::ToZtring((int8u)KindOfStream);Trace+=__T(", StreamNumber=");Trace+=ZenLib::Ztring::ToZtring((int8u)StreamNumber);Trace+=__T(", Parameter=");Trace+=ZenLib::Ztring(Parameter);Trace+=__T(", KindOfInfo=");Trace+=ZenLib::Ztring::ToZtring((int8u)KindOfInfo);Trace+=__T(", KindOfSearch=");Trace+=ZenLib::Ztring::ToZtring((int8u)KindOfSearch);) //TRACE(Trace+=__T("Get(L), will return ");Trace+=Info[FilePos].Get(KindOfStream, StreamNumber, Parameter, KindOfInfo, KindOfSearch).c_str();) return Internal->Get(FilePos, KindOfStream, StreamNumber, Parameter, KindOfInfo, KindOfSearch); } //*************************************************************************** // Set File info //*************************************************************************** //--------------------------------------------------------------------------- size_t MediaInfoList::Set(const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, size_t Parameter, const String &OldValue) { return Internal->Set(ToSet, FilePos, StreamKind, StreamNumber, Parameter, OldValue); } //--------------------------------------------------------------------------- size_t MediaInfoList::Set(const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, const String &Parameter, const String &OldValue) { return Internal->Set(ToSet, FilePos, StreamKind, StreamNumber, Parameter, OldValue); } //*************************************************************************** // Output buffer //*************************************************************************** /* //--------------------------------------------------------------------------- char* MediaInfoList::Output_Buffer_Get (size_t FilePos, size_t &Output_Buffer_Size) { return Internal->Output_Buffer_Get(FilePos, Output_Buffer_Size); } */ //*************************************************************************** // Information //*************************************************************************** //--------------------------------------------------------------------------- String MediaInfoList::Option (const String &Option, const String &Value) { return Internal->Option(Option, Value); } //--------------------------------------------------------------------------- String MediaInfoList::Option_Static (const String &Option, const String &Value) { return MediaInfo::Option_Static(Option, Value); } //--------------------------------------------------------------------------- size_t MediaInfoList::State_Get() { return Internal->State_Get(); } //--------------------------------------------------------------------------- size_t MediaInfoList::Count_Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber) { return Internal->Count_Get(FilePos, StreamKind, StreamNumber); } //--------------------------------------------------------------------------- size_t MediaInfoList::Count_Get() { return Internal->Count_Get(); } } //NameSpace MediaInfoLib/Source/MediaInfo/MediaInfoList.h100777 0 0 34442 12226004261 14434 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Give information about a lot of media files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfoListH #define MediaInfoListH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/MediaInfo.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #undef MEDIAINFO_EXP #if defined(_WIN32) && !defined(__MINGW32__) //MinGW32 does not support _declspec #ifdef MEDIAINFO_DLL_EXPORT #define MEDIAINFO_EXP #else #define MEDIAINFO_EXP #endif #else //defined(_WIN32) && !defined(__MINGW32__) #if __GNUC__ >= 4 #define MEDIAINFO_EXP __attribute__ ((visibility("default"))) #else #define MEDIAINFO_EXP #endif #endif //defined(_WIN32) && !defined(__MINGW32__) #if !defined(__WINDOWS__) #define __stdcall //Supported only on windows #endif //!defined(_WIN32) //--------------------------------------------------------------------------- namespace MediaInfoLib { class MediaInfoList_Internal; //*************************************************************************** /// @brief MediaInfoList /// @version 0.7 //*************************************************************************** class MEDIAINFO_EXP MediaInfoList { public : //Class /// @brief Constructor /// @param Count_Init optimization information: How many files do you plan to handle? MediaInfoList (size_t Count_Init=64); ~MediaInfoList (); //Files /// Open one or more files and collect information about them (technical information and tags) /// @brief Open files /// @param File Full name of file(s) to open \n /// or Full name of folder(s) to open \n /// (if multiple names, names must be separated by "|") /// @param Options: FileOption_Recursive = Recursive mode for folders \n /// FileOption_Close = Close all already opened files before /// @return Number of files successfuly added size_t Open (const String &File, const fileoptions_t Options=FileOption_Nothing); /// Open a stream and collect information about it (technical information and tags) /// @brief Open a stream (Init) /// @param File_Size Estimated file size /// @param File_Offset Offset of the file (if we don't have the beginning of the file) /// @retval 0 failed /// @retval 1 succeed size_t Open_Buffer_Init (ZenLib::int64u File_Size=(ZenLib::int64u)-1, ZenLib::int64u File_Offset=0); /// Open a stream and collect information about it (technical information and tags) /// @brief Open a stream (Continue) /// @param FilePos File position /// @param Buffer pointer to the stream /// @param Buffer_Size Count of bytes to read /// @retval 0 failed /// @retval 1 succeed size_t Open_Buffer_Continue (size_t FilePos, const ZenLib::int8u* Buffer, size_t Buffer_Size); /// Open a stream and collect information about it (technical information and tags) /// @brief Open a stream (Get the needed file Offset) /// @param FilePos File position /// @return the needed offset of the file \n /// File size if no more bytes are needed ZenLib::int64u Open_Buffer_Continue_GoTo_Get (size_t FilePos); /// Open a stream and collect information about it (technical information and tags) /// @brief Open a stream (Finalize) /// @param FilePos File position /// @retval 0 failed /// @retval 1 succeed size_t Open_Buffer_Finalize (size_t FilePos); /// Save the file opened before with Open() (modifications of tags) /// @brief Save the file /// @param FilePos File position \n /// (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") ) /// @retval 0 failed /// @retval 1 succeed size_t Save (size_t FilePos); /// (NOT IMPLEMENTED YET) Save all files opened before with Open() (modifications of tags) /// @brief (NOT IMPLEMENTED YET) Save all files /// @param FilePos File position \n /// (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") ) /// @retval Count of files saved void Close (size_t FilePos=(size_t)-1); /// Get all details about a file in one string /// @brief Get all details about a file /// @param FilePos File position \n /// (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") ) /// @param Reserved Deprecated, do not use it anymore /// @pre You can change default presentation with Inform_Set() /// @return Text with information about the file String Inform (size_t FilePos=(size_t)-1, size_t Reserved=0); //Get /// Get a piece of information about a file (parameter is an integer) /// @brief Get a piece of information about a file (parameter is an integer) /// @param FilePos File position \n /// (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") ) /// @param StreamKind Kind of stream (general, video, audio...) /// @param StreamNumber Stream number in Kind of stream (first, second...) /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in integer format (first parameter, second parameter...) /// @param KindOfInfo Kind of information you want about the parameter (the text, the measure, the help...) /// @return a string about information you search \n /// an empty string if there is a problem String Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber, size_t Parameter, info_t KindOfInfo=Info_Text); //Get info, FilePos=File position, StreamKind=General video audio text chapter, StreamNumber=stream number, PosInStream=parameter you want, KindOfInfo=name, text, measure, options, name (language), measure (language), info, how to /// Get a piece of information about a file (parameter is a string) /// @brief Get a piece of information about a file (parameter is a string) /// @param FilePos File position \n /// (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") ) /// @param StreamKind Kind of stream (general, video, audio...) /// @param StreamNumber Stream number in Kind of stream (first, second...) /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in string format ("Codec", "Width"...) \n /// See MediaInfo::Option("Info_Parameters") to have the full list /// @param KindOfInfo Kind of information you want about the parameter (the text, the measure, the help...) /// @param KindOfSearch Where to look for the parameter /// @return a string about information you search \n /// an empty string if there is a problem String Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber, const String &Parameter, info_t KindOfInfo=Info_Text, info_t KindOfSearch=Info_Name); //Get info, FilePos=File position, StreamKind=General video audio text chapter, StreamNumber=stream number, PosInStream=parameter you want, KindOfInfo=name text measure options name(language) measure(language) information how to, KindOfSearch=which Kind Of information Parameter must be searched? //Set /// (NOT IMPLEMENTED YET) Set a piece of information about a file (parameter is an int) /// @brief (NOT IMPLEMENTED YET) Set a piece of information about a file (parameter is an int) /// @warning Not yet implemented, do not use it /// @param ToSet Piece of information /// @param FilePos File position \n /// (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") ) /// @param StreamKind Kind of stream (general, video, audio...) /// @param StreamNumber Stream number in Kind of stream (first, second...) /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in integer format (first parameter, second parameter...) /// @param OldValue The old value of the parameter \n if OldValue is empty and ToSet is filled: tag is added \n if OldValue is filled and ToSet is filled: tag is replaced \n if OldValue is filled and ToSet is empty: tag is deleted /// @retval >0 succeed /// @retval 0 failed size_t Set (const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, size_t Parameter, const String &OldValue=String()); //Get info, FilePos=File position, StreamKind=General video audio text chapter, StreamNumber=stream number, PosInStream=parameter you want, KindOfInfo=name, text, measure, options name(language) measure(language) information how to /// @brief (NOT IMPLEMENTED YET) Get information about a file (parameter is a string) /// @warning Not yet implemented, do not use it /// @param ToSet Piece of information /// @param FilePos File position \n /// (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") ) /// @param StreamKind Kind of stream (general, video, audio...) /// @param StreamNumber Stream number in Kind of stream (first, second...) /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in string format ("Codec", "Width"...) \n /// See Option("Info_Parameters") to have the full list /// @param OldValue The old value of the parameter \n if OldValue is empty and ToSet is filled: tag is added \n if OldValue is filled and ToSet is filled: tag is replaced \n if OldValue is filled and ToSet is empty: tag is deleted /// @retval >0 succeed /// @retval 0 failed size_t Set (const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, const String &Parameter, const String &OldValue=String()); //Get info, FilePos=File position, StreamKind=General video audio text chapter, StreamNumber=stream number, PosInStream=parameter you want, KindOfInfo=name text measure options name (language) measure (language) information how to, KindOfSearch=which Kind Of information Parameter must be searched? //Output_Buffered /// Output buffer retrieving, used for File_Duplicate option. /// @brief Output buffer retrieving /// @param FilePos File position /// @param Output_Buffer_Size A pointer to the variable that receives the size of the buffer \n /// Note: you must use all the size of the buffer before the next call to this procedure /// @return A pointer on the output buffer, NULL if there is nothing in the buffer char* Output_Buffer_Get (size_t FilePos, size_t &Output_Buffer_Size); //Info /// Configure or get information about MediaInfoLib /// @param Option The name of option /// @param Value The value of option /// @return Depend of the option: by default "" (nothing) means No, other means Yes /// @post Known options are: See MediaInfo::Option() String Option (const String &Option, const String &Value=String()); /// Configure or get information about MediaInfoLib (static version) /// @param Option The name of option /// @param Value The value of option /// @return Depend of the option: by default "" (nothing) means No, other means Yes /// @post Known options are: See MediaInfo::Option() static String Option_Static (const String &Option, const String &Value=String()); /// @brief (NOT IMPLEMENTED YET) Get the state of the library /// @retval <1000 No information is available for the file yet /// @retval >=1000_<5000 Only local (into the file) information is available, getting Internet information (titles only) is no finished yet /// @retval 5000 (only if Internet connection is accepted) User interaction is needed (use Option() with "Internet_Title_Get") \n /// Warning: even there is only one possible, user interaction (or the software) is needed /// @retval >5000<=10000 Only local (into the file) information is available, getting Internet information (all) is no finished yet /// @retval <10000 Done size_t State_Get (); /// @brief Count of streams, or count of piece of information in this stream /// @param FilePos File position \n /// (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") ) /// @param StreamKind Kind of stream (general, video, audio...) /// @param StreamNumber Stream number in this kind of stream (first, second...) /// @return The count of fields for this stream kind / stream number if stream number is provided, else the count of streams for this stream kind size_t Count_Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber=(size_t)-1); /// @brief Get the count of opened files /// @return Count of files opened size_t Count_Get (); private : MediaInfoList_Internal* Internal; //Constructor MediaInfoList (const MediaInfoList&); // Prevent copy-construction MediaInfoList& operator=(const MediaInfoList&); // Prevent assignment }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/MediaInfoList_Internal.cpp100777 0 0 34736 12226004261 16631 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfoList_Internal.h" #include "MediaInfo/MediaInfo_Config.h" #include "ZenLib/File.h" #include "ZenLib/Dir.h" #include "MediaInfo/Reader/Reader_Directory.h" using namespace ZenLib; using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- extern MediaInfo_Config Config; //--------------------------------------------------------------------------- //*************************************************************************** // Gestion de la classe //*************************************************************************** //--------------------------------------------------------------------------- //Constructeurs MediaInfoList_Internal::MediaInfoList_Internal(size_t Count_Init) : Thread() { CriticalSectionLocker CSL(CS); //Initialisation Info.reserve(Count_Init); for (size_t Pos=0; Pos::iterator Config_MediaInfo_Item=Config_MediaInfo_Items.begin(); Config_MediaInfo_Item!=Config_MediaInfo_Items.end(); ++Config_MediaInfo_Item) MI->Option(Config_MediaInfo_Item->first, Config_MediaInfo_Item->second); if (BlockMethod==1) MI->Option(__T("Thread"), __T("1")); MI->Open(ToParse.front()); if (BlockMethod==1) { CS.Leave(); while (MI->State_Get()<10000) { size_t A=MI->State_Get(); CS.Enter(); State=(ToParse_AlreadyDone*10000+A)/ToParse_Total; CS.Leave(); if (IsTerminating()) { break; } Yield(); } CS.Enter(); } Info.push_back(MI); ToParse.pop(); ToParse_AlreadyDone++; State=ToParse_AlreadyDone*10000/ToParse_Total; } if (IsTerminating() || State==10000) { CS.Leave(); break; } CS.Leave(); Yield(); } } //--------------------------------------------------------------------------- size_t MediaInfoList_Internal::Open_Buffer_Init (int64u File_Size_, int64u File_Offset_) { MediaInfo_Internal* MI=new MediaInfo_Internal(); MI->Open_Buffer_Init(File_Size_, File_Offset_); CriticalSectionLocker CSL(CS); size_t Pos=Info.size(); Info.push_back(MI); return Pos; } //--------------------------------------------------------------------------- size_t MediaInfoList_Internal::Open_Buffer_Continue (size_t FilePos, const int8u* ToAdd, size_t ToAdd_Size) { CriticalSectionLocker CSL(CS); if (FilePos>=Info.size() || Info[FilePos]==NULL) return 0; return Info[FilePos]->Open_Buffer_Continue(ToAdd, ToAdd_Size).to_ulong(); } //--------------------------------------------------------------------------- int64u MediaInfoList_Internal::Open_Buffer_Continue_GoTo_Get (size_t FilePos) { CriticalSectionLocker CSL(CS); if (FilePos>=Info.size() || Info[FilePos]==NULL) return (int64u)-1; return Info[FilePos]->Open_Buffer_Continue_GoTo_Get(); } //--------------------------------------------------------------------------- size_t MediaInfoList_Internal::Open_Buffer_Finalize (size_t FilePos) { CriticalSectionLocker CSL(CS); if (FilePos>=Info.size() || Info[FilePos]==NULL) return 0; return Info[FilePos]->Open_Buffer_Finalize(); } //--------------------------------------------------------------------------- size_t MediaInfoList_Internal::Save(size_t) { CriticalSectionLocker CSL(CS); return 0; //Not yet implemented } //--------------------------------------------------------------------------- void MediaInfoList_Internal::Close(size_t FilePos) { if (IsRunning()) { RequestTerminate(); while(IsExited()) Yield(); } CriticalSectionLocker CSL(CS); if (FilePos==Unlimited) { for (size_t Pos=0; Pos")+MediaInfoLib::Config.LineSeparator_Get()+__T("")+MediaInfoLib::Config.LineSeparator_Get(); else Retour+=MediaInfo_Custom_View("Page_Begin"); while (FilePos")+MediaInfoLib::Config.LineSeparator_Get(); else Retour+=MediaInfo_Custom_View("Page_End");// return Retour.c_str(); } CriticalSectionLocker CSL(CS); if (FilePos>=Info.size() || Info[FilePos]==NULL || Info[FilePos]->Count_Get(Stream_General)==0) return MediaInfoLib::Config.EmptyString_Get(); Info[FilePos]->IsFirst=FilePos==0; Info[FilePos]->IsLast=(FilePos+1)==Info.size(); return Info[FilePos]->Inform(); } //--------------------------------------------------------------------------- String MediaInfoList_Internal::Get(size_t FilePos, stream_t KindOfStream, size_t StreamNumber, size_t Parameter, info_t KindOfInfo) { CriticalSectionLocker CSL(CS); if (FilePos==Error || FilePos>=Info.size() || Info[FilePos]==NULL || Info[FilePos]->Count_Get(Stream_General)==0) return MediaInfoLib::Config.EmptyString_Get(); return Info[FilePos]->Get(KindOfStream, StreamNumber, Parameter, KindOfInfo); } //--------------------------------------------------------------------------- String MediaInfoList_Internal::Get(size_t FilePos, stream_t KindOfStream, size_t StreamNumber, const String &Parameter, info_t KindOfInfo, info_t KindOfSearch) { CriticalSectionLocker CSL(CS); if (FilePos==Error || FilePos>=Info.size() || Info[FilePos]==NULL || Info[FilePos]->Count_Get(Stream_General)==0) return MediaInfoLib::Config.EmptyString_Get(); return Info[FilePos]->Get(KindOfStream, StreamNumber, Parameter, KindOfInfo, KindOfSearch); } //*************************************************************************** // Set File info //*************************************************************************** //--------------------------------------------------------------------------- size_t MediaInfoList_Internal::Set(const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, size_t Parameter, const String &OldValue) { CriticalSectionLocker CSL(CS); if (FilePos==(size_t)-1) FilePos=0; //TODO : average if (FilePos>=Info.size() || Info[FilePos]==NULL || Info[FilePos]->Count_Get(Stream_General)==0) return 0; return Info[FilePos]->Set(ToSet, StreamKind, StreamNumber, Parameter, OldValue); } //--------------------------------------------------------------------------- size_t MediaInfoList_Internal::Set(const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, const String &Parameter, const String &OldValue) { CriticalSectionLocker CSL(CS); if (FilePos==(size_t)-1) FilePos=0; //TODO : average if (FilePos>=Info.size() || Info[FilePos]==NULL || Info[FilePos]->Count_Get(Stream_General)==0) return 0; return Info[FilePos]->Set(ToSet, StreamKind, StreamNumber, Parameter, OldValue); } //*************************************************************************** // Output buffer //*************************************************************************** /* //--------------------------------------------------------------------------- char* MediaInfoList_Internal::Output_Buffer_Get (size_t FilePos, size_t &Output_Buffer_Size) { if (FilePos==(size_t)-1) FilePos=0; //TODO : average if (FilePos>=Info.size() || Info[FilePos]==NULL || Info[FilePos]->Count_Get(Stream_General)==0) return 0; return Info[FilePos]->Output_Buffer_Get(Output_Buffer_Size); } */ //*************************************************************************** // Information //*************************************************************************** //--------------------------------------------------------------------------- String MediaInfoList_Internal::Option (const String &Option, const String &Value) { CriticalSectionLocker CSL(CS); Ztring OptionLower=Option; OptionLower.MakeLowerCase(); if (Option==__T("")) return __T(""); else if (OptionLower==__T("manguage_update")) { //Special case : Language_Update must update all MediaInfo classes for (unsigned int Pos=0; PosOption(__T("language_update"), Value); return __T(""); } else if (OptionLower==__T("create_dummy")) { Info.resize(Info.size()+1); Info[Info.size()-1]=new MediaInfo_Internal(); Info[Info.size()-1]->Option(Option, Value); return __T(""); } else if (OptionLower==__T("thread")) { BlockMethod=1; return __T(""); } else if (OptionLower.find(__T("file_"))==0) { Config_MediaInfo_Items[Option]=Value; return __T(""); } else return MediaInfo::Option_Static(Option, Value); } //--------------------------------------------------------------------------- String MediaInfoList_Internal::Option_Static (const String &Option, const String &Value) { return MediaInfo::Option_Static(Option, Value); } //--------------------------------------------------------------------------- size_t MediaInfoList_Internal::State_Get() { CriticalSectionLocker CSL(CS); if (State==10000) { //Pause(); IsInThread=false; } return State; } //--------------------------------------------------------------------------- size_t MediaInfoList_Internal::Count_Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber) { CriticalSectionLocker CSL(CS); if (FilePos>=Info.size() || Info[FilePos]==NULL) return 0; return Info[FilePos]->Count_Get(StreamKind, StreamNumber); } //--------------------------------------------------------------------------- size_t MediaInfoList_Internal::Count_Get() { CriticalSectionLocker CSL(CS); return Info.size(); } } //NameSpace MediaInfoLib/Source/MediaInfo/MediaInfoList_Internal.h100777 0 0 10411 12226004262 16257 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Give information about a lot of media files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfoList_InternalH #define MediaInfoList_InternalH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/MediaInfo.h" #include "MediaInfo/MediaInfo_Internal.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { class MediaInfoList_Internal : public ZenLib::Thread { public : //Class MediaInfoList_Internal (size_t Count_Init=64); virtual ~MediaInfoList_Internal (); //Files size_t Open (const String &File, const fileoptions_t Options=FileOption_Nothing); size_t Open_Buffer_Init (ZenLib::int64u File_Size=(ZenLib::int64u)-1, ZenLib::int64u File_Offset=0); size_t Open_Buffer_Continue (size_t FilePos, const ZenLib::int8u* Buffer, size_t Buffer_Size); ZenLib::int64u Open_Buffer_Continue_GoTo_Get (size_t FilePos); size_t Open_Buffer_Finalize (size_t FilePos); size_t Save (size_t FilePos); void Close (size_t FilePos=(size_t)-1); String Inform (size_t FilePos=(size_t)-1, size_t Reserved=0); //Get String Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber, size_t Parameter, info_t KindOfInfo=Info_Text); //Get info, FilePos=File position, StreamKind=General video audio text chapter, StreamNumber=stream number, PosInStream=parameter you want, KindOfInfo=name, text, measure, options, name (language), measure (language), info, how to String Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber, const String &Parameter, info_t KindOfInfo=Info_Text, info_t KindOfSearch=Info_Name); //Get info, FilePos=File position, StreamKind=General video audio text chapter, StreamNumber=stream number, PosInStream=parameter you want, KindOfInfo=name text measure options name(language) measure(language) information how to, KindOfSearch=which Kind Of information Parameter must be searched? //Set size_t Set (const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, size_t Parameter, const String &OldValue=__T("")); //Get info, FilePos=File position, StreamKind=General video audio text chapter, StreamNumber=stream number, PosInStream=parameter you want, KindOfInfo=name, text, measure, options name(language) measure(language) information how to size_t Set (const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, const String &Parameter, const String &OldValue=__T("")); //Get info, FilePos=File position, StreamKind=General video audio text chapter, StreamNumber=stream number, PosInStream=parameter you want, KindOfInfo=name text measure options name (language) measure (language) information how to, KindOfSearch=which Kind Of information Parameter must be searched? //Output_Buffered char* Output_Buffer_Get (size_t File_Pos, size_t &Output_Buffer_Size); //Info String Option (const String &Option, const String &Value=String(__T(""))); static String Option_Static (const String &Option, const String &Value=String(__T(""))); size_t State_Get (); size_t Count_Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber=(size_t)-1); size_t Count_Get (); private : std::vector Info; std::queue ToParse; std::map Config_MediaInfo_Items; //Config per file size_t ToParse_AlreadyDone; size_t ToParse_Total; size_t CountValid; MediaInfo_Config_MediaInfo Config; //Threading size_t BlockMethod; //Open() return: 0=immedialtly, 1=after local info, 2=when user interaction is needed size_t State; bool IsInThread; void Entry(); ZenLib::CriticalSection CS; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/MediaInfo_Config.cpp100777 0 0 230276 12264012104 15440 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Global configuration of MediaInfo // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/MediaInfo_Config.h" #include "ZenLib/ZtringListListF.h" #include "ZenLib/File.h" #include using namespace ZenLib; using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- const Char* MediaInfo_Version=__T("MediaInfoLib - v0.7.67"); const Char* MediaInfo_Url=__T("http://MediaArea.net/MediaInfo"); Ztring EmptyZtring; //Use it when we can't return a reference to a true Ztring const Ztring EmptyZtring_Const; //Use it when we can't return a reference to a true Ztring, const version const ZtringListList EmptyZtringListList_Const; //Use it when we can't return a reference to a true ZtringListList, const version //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- void MediaInfo_Config_CodecID_General_Mpeg4 (InfoMap &Info); void MediaInfo_Config_CodecID_Video_Matroska (InfoMap &Info); void MediaInfo_Config_CodecID_Video_Mpeg4 (InfoMap &Info); void MediaInfo_Config_CodecID_Video_Ogg (InfoMap &Info); void MediaInfo_Config_CodecID_Video_Real (InfoMap &Info); void MediaInfo_Config_CodecID_Video_Riff (InfoMap &Info); void MediaInfo_Config_CodecID_Audio_Matroska (InfoMap &Info); void MediaInfo_Config_CodecID_Audio_Mpeg4 (InfoMap &Info); void MediaInfo_Config_CodecID_Audio_Ogg (InfoMap &Info); void MediaInfo_Config_CodecID_Audio_Real (InfoMap &Info); void MediaInfo_Config_CodecID_Audio_Riff (InfoMap &Info); void MediaInfo_Config_CodecID_Text_Matroska (InfoMap &Info); void MediaInfo_Config_CodecID_Text_Mpeg4 (InfoMap &Info); void MediaInfo_Config_CodecID_Text_Riff (InfoMap &Info); void MediaInfo_Config_Codec (InfoMap &Info); void MediaInfo_Config_DefaultLanguage (Translation &Info); void MediaInfo_Config_Iso639_1 (InfoMap &Info); void MediaInfo_Config_Iso639_2 (InfoMap &Info); void MediaInfo_Config_General (ZtringListList &Info); void MediaInfo_Config_Video (ZtringListList &Info); void MediaInfo_Config_Audio (ZtringListList &Info); void MediaInfo_Config_Text (ZtringListList &Info); void MediaInfo_Config_Other (ZtringListList &Info); void MediaInfo_Config_Image (ZtringListList &Info); void MediaInfo_Config_Menu (ZtringListList &Info); void MediaInfo_Config_Summary (ZtringListList &Info); void MediaInfo_Config_Format (InfoMap &Info); void MediaInfo_Config_Library_DivX (InfoMap &Info); void MediaInfo_Config_Library_XviD (InfoMap &Info); void MediaInfo_Config_Library_MainConcept_Avc (InfoMap &Info); void MediaInfo_Config_Library_VorbisCom (InfoMap &Info); //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- MediaInfo_Config Config; //--------------------------------------------------------------------------- //*************************************************************************** // Constructor/Destructor //*************************************************************************** void MediaInfo_Config::Init() { CS.Enter(); //We use Init() instead of COnstructor because for some backends (like WxWidgets...) does NOT like constructor of static object with Unicode conversion //Test if (!LineSeparator.empty()) { CS.Leave(); return; //Already done } //Filling FormatDetection_MaximumOffset=0; #if MEDIAINFO_ADVANCED VariableGopDetection_Occurences=4; VariableGopDetection_GiveUp=false; InitDataNotRepeated_Occurences=(int64u)-1; //Disabled by default InitDataNotRepeated_GiveUp=false; #endif //MEDIAINFO_ADVANCED MpegTs_MaximumOffset=64*1024*1024; MpegTs_MaximumScanDuration=30000000000LL; MpegTs_ForceStreamDisplay=false; #if MEDIAINFO_ADVANCED MpegTs_VbrDetection_Delta=0; MpegTs_VbrDetection_Occurences=4; MpegTs_VbrDetection_GiveUp=false; #endif //MEDIAINFO_ADVANCED Complete=0; BlockMethod=0; Internet=0; MultipleValues=0; ParseUnknownExtensions=1; ShowFiles_Nothing=1; ShowFiles_VideoAudio=1; ShowFiles_VideoOnly=1; ShowFiles_AudioOnly=1; ShowFiles_TextOnly=1; ParseSpeed=(float32)0.5; Verbosity=(float32)0.5; Trace_Level=(float32)0.0; Trace_TimeSection_OnlyFirstOccurrence=false; Trace_Format=Trace_Format_Tree; Language_Raw=false; ReadByHuman=true; LegacyStreamDisplay=true; SkipBinaryData=false; Demux=0; LineSeparator=EOL; ColumnSeparator=__T(";"); TagSeparator=__T(" / "); Quote=__T("\""); DecimalPoint=__T("."); ThousandsPoint=Ztring(); #if MEDIAINFO_EVENTS Event_CallBackFunction=NULL; Event_UserHandler=NULL; #endif //MEDIAINFO_EVENTS #if defined(MEDIAINFO_LIBCURL_YES) Ssh_IgnoreSecurity=false; Ssl_IgnoreSecurity=false; #endif //defined(MEDIAINFO_LIBCURL_YES) CS.Leave(); ZtringListList ZLL1; Language_Set(ZLL1); } //*************************************************************************** // Info //*************************************************************************** Ztring MediaInfo_Config::Option (const String &Option, const String &Value_Raw) { SubFile_Config(Option)=Value_Raw; String Option_Lower(Option); size_t Egal_Pos=Option_Lower.find(__T('=')); if (Egal_Pos==string::npos) Egal_Pos=Option_Lower.size(); transform(Option_Lower.begin(), Option_Lower.begin()+Egal_Pos, Option_Lower.begin(), (int(*)(int))tolower); //(int(*)(int)) is a patch for unix //Parsing pointer to a file Ztring Value; if (Value_Raw.find(__T("file://"))==0) { //Open Ztring FileName(Value_Raw, 7, Ztring::npos); File F(FileName.c_str()); //Read int64u Size=F.Size_Get(); if (Size>=0xFFFFFFFF) Size=1024*1024; int8u* Buffer=new int8u[(size_t)Size+1]; size_t Pos=F.Read(Buffer, (size_t)Size); F.Close(); Buffer[Pos]='\0'; Ztring FromFile; FromFile.From_UTF8((char*)Buffer); if (FromFile.empty()) FromFile.From_Local((char*)Buffer); delete[] Buffer; //Buffer=NULL; //Merge Value=FromFile; } else Value=Value_Raw; if (Option_Lower.empty()) { return Ztring(); } else if (Option_Lower==__T("charset_config")) { return Ztring(); //Only used in DLL, no Library action } else if (Option_Lower==__T("charset_output")) { return Ztring(); //Only used in DLL, no Library action } else if (Option_Lower==__T("complete")) { Complete_Set(Value.To_int8u()?true:false); return Ztring(); } else if (Option_Lower==__T("complete_get")) { if (Complete_Get()) return __T("1"); else return Ztring(); } else if (Option_Lower==__T("blockmethod")) { if (Value.empty()) BlockMethod_Set(0); else BlockMethod_Set(1); return Ztring(); } else if (Option_Lower==__T("blockmethod_get")) { if (BlockMethod_Get()) return __T("1"); else return Ztring(); } else if (Option_Lower==__T("internet")) { if (Value.empty()) Internet_Set(0); else Internet_Set(1); return Ztring(); } else if (Option_Lower==__T("internet_get")) { if (Internet_Get()) return __T("1"); else return Ztring(); } else if (Option_Lower==__T("demux")) { String Value_Lower(Value); transform(Value_Lower.begin(), Value_Lower.end(), Value_Lower.begin(), (int(*)(int))tolower); //(int(*)(int)) is a patch for unix if (Value_Lower==__T("all")) Demux_Set(7); else if (Value_Lower==__T("frame")) Demux_Set(1); else if (Value_Lower==__T("container")) Demux_Set(2); else if (Value_Lower==__T("elementary")) Demux_Set(4); else Demux_Set(0); return Ztring(); } else if (Option_Lower==__T("demux_get")) { switch (Demux_Get()) { case 7 : return __T("All"); case 1 : return __T("Frame"); case 2 : return __T("Container"); case 4 : return __T("Elementary"); default: return Ztring(); } } else if (Option_Lower==__T("multiplevalues")) { if (Value.empty()) MultipleValues_Set(0); else MultipleValues_Set(1); return Ztring(); } else if (Option_Lower==__T("multiplevalues_get")) { if (MultipleValues_Get()) return __T("1"); else return Ztring(); } else if (Option_Lower==__T("parseunknownextensions")) { if (Value.empty()) ParseUnknownExtensions_Set(0); else ParseUnknownExtensions_Set(1); return Ztring(); } else if (Option_Lower==__T("parseunknownextensions_get")) { if (ParseUnknownExtensions_Get()) return __T("1"); else return Ztring(); } else if (Option_Lower==__T("showfiles_set")) { ShowFiles_Set(Value.c_str()); return Ztring(); } else if (Option_Lower==__T("readbyhuman")) { ReadByHuman_Set(Value.To_int8u()?true:false); return Ztring(); } else if (Option_Lower==__T("readbyhuman_get")) { return ReadByHuman_Get()?__T("1"):__T("0"); } else if (Option_Lower==__T("legacystreamdisplay")) { LegacyStreamDisplay_Set(Value.To_int8u()?true:false); return Ztring(); } else if (Option_Lower==__T("legacystreamdisplay_get")) { return LegacyStreamDisplay_Get()?__T("1"):__T("0"); } else if (Option_Lower==__T("skipbinarydata")) { SkipBinaryData_Set(Value.To_int8u()?true:false); return Ztring(); } else if (Option_Lower==__T("skipbinarydata_get")) { return SkipBinaryData_Get()?__T("1"):__T("0"); } else if (Option_Lower==__T("parsespeed")) { ParseSpeed_Set(Value.To_float32()); return Ztring(); } else if (Option_Lower==__T("parsespeed_get")) { return Ztring::ToZtring(ParseSpeed_Get(), 3); } else if (Option_Lower==__T("verbosity")) { Verbosity_Set(Value.To_float32()); return Ztring(); } else if (Option_Lower==__T("verbosity_get")) { return Ztring::ToZtring(Verbosity_Get(), 3); } else if (Option_Lower==__T("lineseparator")) { LineSeparator_Set(Value); return Ztring(); } else if (Option_Lower==__T("lineseparator_get")) { return LineSeparator_Get(); } else if (Option_Lower==__T("version")) { Version_Set(Value); return Ztring(); } else if (Option_Lower==__T("version_get")) { return Version_Get(); } else if (Option_Lower==__T("columnseparator")) { ColumnSeparator_Set(Value); return Ztring(); } else if (Option_Lower==__T("columnseparator_get")) { return ColumnSeparator_Get(); } else if (Option_Lower==__T("tagseparator")) { TagSeparator_Set(Value); return Ztring(); } else if (Option_Lower==__T("tagseparator_get")) { return TagSeparator_Get(); } else if (Option_Lower==__T("quote")) { Quote_Set(Value); return Ztring(); } else if (Option_Lower==__T("quote_get")) { return Quote_Get(); } else if (Option_Lower==__T("decimalpoint")) { DecimalPoint_Set(Value); return Ztring(); } else if (Option_Lower==__T("decimalpoint_get")) { return DecimalPoint_Get(); } else if (Option_Lower==__T("thousandspoint")) { ThousandsPoint_Set(Value); return Ztring(); } else if (Option_Lower==__T("thousandspoint_get")) { return ThousandsPoint_Get(); } else if (Option_Lower==__T("streammax")) { ZtringListList StreamMax=Value.c_str(); StreamMax_Set(StreamMax); return Ztring(); } else if (Option_Lower==__T("streammax_get")) { return StreamMax_Get(); } else if (Option_Lower==__T("language")) { ZtringListList Language=Value.c_str(); Language_Set(Language); return Ztring(); } else if (Option_Lower==__T("language_get")) { return Language_Get(); } else if (Option_Lower==__T("inform")) { Inform_Set(Value.c_str()); return Ztring(); } else if (Option_Lower==__T("output")) { Inform_Set(Value.c_str()); return Ztring(); } else if (Option_Lower==__T("inform_get")) { return Inform_Get(); } else if (Option_Lower==__T("output_get")) { return Inform_Get(); } else if (Option_Lower==__T("inform_replace")) { Inform_Replace_Set(Value.c_str()); return Ztring(); } else if (Option_Lower==__T("inform_replace_get")) { return Inform_Get(); } else if (Option_Lower==__T("details")) //Legacy for trace_level { return MediaInfo_Config::Option(__T("Trace_Level"), Value); } else if (Option_Lower==__T("details_get")) //Legacy for trace_level { return MediaInfo_Config::Option(__T("Trace_Level_Get"), Value); } else if (Option_Lower==__T("detailslevel")) //Legacy for trace_level { return MediaInfo_Config::Option(__T("Trace_Level"), Value); } else if (Option_Lower==__T("detailslevel_get")) //Legacy for trace_level { return MediaInfo_Config::Option(__T("Trace_Level_Get"), Value); } else if (Option_Lower==__T("trace_level")) { Trace_Level_Set(Value); return Ztring(); } else if (Option_Lower==__T("trace_level_get")) { return Ztring::ToZtring(Trace_Level_Get()); } else if (Option_Lower==__T("trace_timesection_onlyfirstoccurrence")) { Trace_TimeSection_OnlyFirstOccurrence_Set(Value.To_int64u()?true:false); return Ztring(); } else if (Option_Lower==__T("trace_timesection_onlyfirstoccurrence_get")) { return Trace_TimeSection_OnlyFirstOccurrence_Get()?__T("1"):__T("0"); } else if (Option_Lower==__T("detailsformat")) //Legacy for trace_format { return MediaInfo_Config::Option(__T("Trace_Format"), Value); } else if (Option_Lower==__T("detailsformat_get")) //Legacy for trace_format { return MediaInfo_Config::Option(__T("Trace_Format_Get"), Value); } else if (Option_Lower==__T("trace_format")) { String NewValue_Lower(Value); transform(NewValue_Lower.begin(), NewValue_Lower.end(), NewValue_Lower.begin(), (int(*)(int))tolower); //(int(*)(int)) is a patch for unix CriticalSectionLocker CSL(CS); if (NewValue_Lower==__T("csv")) Trace_Format_Set(Trace_Format_CSV); else Trace_Format_Set(Trace_Format_Tree); return Ztring(); } else if (Option_Lower==__T("trace_format_get")) { switch (Trace_Format_Get()) { case Trace_Format_CSV : return __T("CSV"); default : return __T("Tree"); } } else if (Option_Lower==__T("detailsmodificator")) { Trace_Modificator_Set(Value); return Ztring(); } else if (Option_Lower==__T("detailsmodificator_get")) { return Trace_Modificator_Get(Value); } else if (Option_Lower==__T("info_parameters")) { ZtringListList ToReturn=Info_Parameters_Get(); //Adapt first column for (size_t Pos=0; PosTo_int64u()); return Ztring(); } else if (Option_Lower==__T("formatdetection_maximumoffset_get")) { return FormatDetection_MaximumOffset_Get()==(int64u)-1?Ztring(__T("-1")):Ztring::ToZtring(FormatDetection_MaximumOffset_Get()); } else if (Option_Lower==__T("variablegopdetection_occurences")) { #if MEDIAINFO_ADVANCED VariableGopDetection_Occurences_Set(Value.To_int64u()); return Ztring(); #else // MEDIAINFO_ADVANCED return __T("advanced features are disabled due to compilation options"); #endif // MEDIAINFO_ADVANCED } else if (Option_Lower==__T("variablegopdetection_occurences_get")) { #if MEDIAINFO_ADVANCED return Ztring::ToZtring(VariableGopDetection_Occurences_Get()); #else // MEDIAINFO_ADVANCED return __T("advanced features are disabled due to compilation options"); #endif // MEDIAINFO_ADVANCED } else if (Option_Lower==__T("variablegopdetection_giveup")) { #if MEDIAINFO_ADVANCED VariableGopDetection_GiveUp_Set(Value.To_int8u()?true:false); return Ztring(); #else // MEDIAINFO_ADVANCED return __T("advanced features are disabled due to compilation options"); #endif // MEDIAINFO_ADVANCED } else if (Option_Lower==__T("variablegopdetection_giveup_get")) { #if MEDIAINFO_ADVANCED return VariableGopDetection_GiveUp_Get()?__T("1"):__T("0"); #else // MEDIAINFO_ADVANCED return __T("advanced features are disabled due to compilation options"); #endif // MEDIAINFO_ADVANCED } else if (Option_Lower==__T("initdatanotrepeated_occurences")) { #if MEDIAINFO_ADVANCED InitDataNotRepeated_Occurences_Set(Value.To_int64u()); return Ztring(); #else // MEDIAINFO_ADVANCED return __T("advanced features are disabled due to compilation options"); #endif // MEDIAINFO_ADVANCED } else if (Option_Lower==__T("initdatanotrepeated_occurences_get")) { #if MEDIAINFO_ADVANCED return Ztring::ToZtring(InitDataNotRepeated_Occurences_Get()); #else // MEDIAINFO_ADVANCED return __T("advanced features are disabled due to compilation options"); #endif // MEDIAINFO_ADVANCED } else if (Option_Lower==__T("initdatanotrepeated_giveup")) { #if MEDIAINFO_ADVANCED InitDataNotRepeated_GiveUp_Set(Value.To_int8u()?true:false); return Ztring(); #else // MEDIAINFO_ADVANCED return __T("advanced features are disabled due to compilation options"); #endif // MEDIAINFO_ADVANCED } else if (Option_Lower==__T("initdatanotrepeated_giveup_get")) { #if MEDIAINFO_ADVANCED return InitDataNotRepeated_GiveUp_Get()?__T("1"):__T("0"); #else // MEDIAINFO_ADVANCED return __T("advanced features are disabled due to compilation options"); #endif // MEDIAINFO_ADVANCED } else if (Option_Lower==__T("mpegts_maximumoffset")) { MpegTs_MaximumOffset_Set(Value==__T("-1")?(int64u)-1:((Ztring*)&Value)->To_int64u()); return Ztring(); } else if (Option_Lower==__T("mpegts_maximumoffset_get")) { return MpegTs_MaximumOffset_Get()==(int64u)-1?Ztring(__T("-1")):Ztring::ToZtring(MpegTs_MaximumOffset_Get()); } else if (Option_Lower==__T("mpegts_vbrdetection_delta")) { #if MEDIAINFO_ADVANCED MpegTs_VbrDetection_Delta_Set(Value.To_float64()); return Ztring(); #else // MEDIAINFO_ADVANCED return __T("advanced features are disabled due to compilation options"); #endif // MEDIAINFO_ADVANCED } else if (Option_Lower==__T("mpegts_vbrdetection_delta_get")) { #if MEDIAINFO_ADVANCED return Ztring::ToZtring(MpegTs_VbrDetection_Delta_Get(), 9); #else // MEDIAINFO_ADVANCED return __T("advanced features are disabled due to compilation options"); #endif // MEDIAINFO_ADVANCED } else if (Option_Lower==__T("mpegts_vbrdetection_occurences")) { #if MEDIAINFO_ADVANCED MpegTs_VbrDetection_Occurences_Set(Value.To_int64u()); return Ztring(); #else // MEDIAINFO_ADVANCED return __T("advanced features are disabled due to compilation options"); #endif // MEDIAINFO_ADVANCED } else if (Option_Lower==__T("mpegts_vbrdetection_occurences_get")) { #if MEDIAINFO_ADVANCED return Ztring::ToZtring(MpegTs_VbrDetection_Occurences_Get()); #else // MEDIAINFO_ADVANCED return __T("advanced features are disabled due to compilation options"); #endif // MEDIAINFO_ADVANCED } else if (Option_Lower==__T("mpegts_vbrdetection_giveup")) { #if MEDIAINFO_ADVANCED MpegTs_VbrDetection_GiveUp_Set(Value.To_int8u()?true:false); return Ztring(); #else // MEDIAINFO_ADVANCED return __T("advanced features are disabled due to compilation options"); #endif // MEDIAINFO_ADVANCED } else if (Option_Lower==__T("mpegts_vbrdetection_giveup_get")) { #if MEDIAINFO_ADVANCED return MpegTs_VbrDetection_GiveUp_Get()?__T("1"):__T("0"); #else // MEDIAINFO_ADVANCED return __T("advanced features are disabled due to compilation options"); #endif // MEDIAINFO_ADVANCED } else if (Option_Lower==__T("mpegts_maximumscanduration")) { MpegTs_MaximumScanDuration_Set(float64_int64s((((Ztring*)&Value)->To_float64())*1000000000)); return Ztring(); } else if (Option_Lower==__T("mpegts_maximumscanduration_get")) { return MpegTs_MaximumScanDuration_Get()==(int64u)-1?Ztring(__T("-1")):Ztring::ToZtring(MpegTs_MaximumOffset_Get()); } else if (Option_Lower==__T("mpegts_forcestreamdisplay")) { MpegTs_ForceStreamDisplay_Set(Value.To_int8u()?true:false); return Ztring(); } else if (Option_Lower==__T("mpegts_forcestreamdisplay_get")) { return MpegTs_ForceStreamDisplay_Get()?__T("1"):__T("0"); } else if (Option_Lower==__T("custommapping")) { CustomMapping_Set(Value); return Ztring(); } else if (Option_Lower==__T("event_callbackfunction")) { #if MEDIAINFO_EVENTS return Event_CallBackFunction_Set(Value); #else //MEDIAINFO_EVENTS return __T("Event manager is disabled due to compilation options"); #endif //MEDIAINFO_EVENTS } else if (Option_Lower==__T("ssh_knownhostsfilename")) { #if defined(MEDIAINFO_LIBCURL_YES) Ssh_KnownHostsFileName_Set(Value); return Ztring(); #else // defined(MEDIAINFO_LIBCURL_YES) return __T("Libcurl support is disabled due to compilation options"); #endif // defined(MEDIAINFO_LIBCURL_YES) } else if (Option_Lower==__T("ssh_publickeyfilename")) { #if defined(MEDIAINFO_LIBCURL_YES) Ssh_PublicKeyFileName_Set(Value); return Ztring(); #else // defined(MEDIAINFO_LIBCURL_YES) return __T("Libcurl support is disabled due to compilation options"); #endif // defined(MEDIAINFO_LIBCURL_YES) } else if (Option_Lower==__T("ssh_privatekeyfilename")) { #if defined(MEDIAINFO_LIBCURL_YES) Ssh_PrivateKeyFileName_Set(Value); return Ztring(); #else // defined(MEDIAINFO_LIBCURL_YES) return __T("Libcurl support is disabled due to compilation options"); #endif // defined(MEDIAINFO_LIBCURL_YES) } else if (Option_Lower==__T("ssh_ignoresecurity")) { #if defined(MEDIAINFO_LIBCURL_YES) Ssh_IgnoreSecurity_Set(Value.empty() || Value.To_float32()); return Ztring(); #else // defined(MEDIAINFO_LIBCURL_YES) return __T("Libcurl support is disabled due to compilation options"); #endif // defined(MEDIAINFO_LIBCURL_YES) } else if (Option_Lower==__T("ssl_certificatefilename")) { #if defined(MEDIAINFO_LIBCURL_YES) Ssl_CertificateFileName_Set(Value); return Ztring(); #else // defined(MEDIAINFO_LIBCURL_YES) return __T("Libcurl support is disabled due to compilation options"); #endif // defined(MEDIAINFO_LIBCURL_YES) } else if (Option_Lower==__T("ssl_certificateFormat")) { #if defined(MEDIAINFO_LIBCURL_YES) Ssl_CertificateFormat_Set(Value); return Ztring(); #else // defined(MEDIAINFO_LIBCURL_YES) return __T("Libcurl support is disabled due to compilation options"); #endif // defined(MEDIAINFO_LIBCURL_YES) } else if (Option_Lower==__T("ssl_privatekeyfilename")) { #if defined(MEDIAINFO_LIBCURL_YES) Ssl_PrivateKeyFileName_Set(Value); return Ztring(); #else // defined(MEDIAINFO_LIBCURL_YES) return __T("Libcurl support is disabled due to compilation options"); #endif // defined(MEDIAINFO_LIBCURL_YES) } else if (Option_Lower==__T("ssl_privatekeyformat")) { #if defined(MEDIAINFO_LIBCURL_YES) Ssl_PrivateKeyFormat_Set(Value); return Ztring(); #else // defined(MEDIAINFO_LIBCURL_YES) return __T("Libcurl support is disabled due to compilation options"); #endif // defined(MEDIAINFO_LIBCURL_YES) } else if (Option_Lower==__T("ssl_certificateauthorityfilename")) { #if defined(MEDIAINFO_LIBCURL_YES) Ssl_CertificateAuthorityFileName_Set(Value); return Ztring(); #else // defined(MEDIAINFO_LIBCURL_YES) return __T("Libcurl support is disabled due to compilation options"); #endif // defined(MEDIAINFO_LIBCURL_YES) } else if (Option_Lower==__T("ssl_certificateauthoritypath")) { #if defined(MEDIAINFO_LIBCURL_YES) Ssl_CertificateAuthorityPath_Set(Value); return Ztring(); #else // defined(MEDIAINFO_LIBCURL_YES) return __T("Libcurl support is disabled due to compilation options"); #endif // defined(MEDIAINFO_LIBCURL_YES) } else if (Option_Lower==__T("ssl_certificaterevocationlistfilename")) { #if defined(MEDIAINFO_LIBCURL_YES) Ssl_CertificateRevocationListFileName_Set(Value); return Ztring(); #else // defined(MEDIAINFO_LIBCURL_YES) return __T("Libcurl support is disabled due to compilation options"); #endif // defined(MEDIAINFO_LIBCURL_YES) } else if (Option_Lower==__T("ssl_ignoresecurity")) { #if defined(MEDIAINFO_LIBCURL_YES) Ssl_IgnoreSecurity_Set(Value.empty() || Value.To_float32()); return Ztring(); #else // defined(MEDIAINFO_LIBCURL_YES) return __T("Libcurl support is disabled due to compilation options"); #endif // defined(MEDIAINFO_LIBCURL_YES) } else return __T("Option not known"); } //*************************************************************************** // Info //*************************************************************************** //--------------------------------------------------------------------------- void MediaInfo_Config::Complete_Set (size_t NewValue) { CriticalSectionLocker CSL(CS); Complete=NewValue; } size_t MediaInfo_Config::Complete_Get () { CriticalSectionLocker CSL(CS); return Complete; } //--------------------------------------------------------------------------- void MediaInfo_Config::BlockMethod_Set (size_t NewValue) { CriticalSectionLocker CSL(CS); BlockMethod=NewValue; } size_t MediaInfo_Config::BlockMethod_Get () { CriticalSectionLocker CSL(CS); return BlockMethod; } //--------------------------------------------------------------------------- void MediaInfo_Config::Internet_Set (size_t NewValue) { CriticalSectionLocker CSL(CS); Internet=NewValue; } size_t MediaInfo_Config::Internet_Get () { CriticalSectionLocker CSL(CS); return Internet; } //--------------------------------------------------------------------------- void MediaInfo_Config::MultipleValues_Set (size_t NewValue) { CriticalSectionLocker CSL(CS); MultipleValues=NewValue; } size_t MediaInfo_Config::MultipleValues_Get () { CriticalSectionLocker CSL(CS); return MultipleValues; } //--------------------------------------------------------------------------- void MediaInfo_Config::ParseUnknownExtensions_Set (size_t NewValue) { CriticalSectionLocker CSL(CS); ParseUnknownExtensions=NewValue; } size_t MediaInfo_Config::ParseUnknownExtensions_Get () { CriticalSectionLocker CSL(CS); return ParseUnknownExtensions; } //--------------------------------------------------------------------------- void MediaInfo_Config::ShowFiles_Set (const ZtringListList &NewShowFiles) { CriticalSectionLocker CSL(CS); for (size_t Pos=0; Pos MediaInfo_Config::Trace_Layers_Get () { CriticalSectionLocker CSL(CS); return Trace_Layers; } //--------------------------------------------------------------------------- void MediaInfo_Config::Trace_TimeSection_OnlyFirstOccurrence_Set (bool Value) { CriticalSectionLocker CSL(CS); Trace_TimeSection_OnlyFirstOccurrence=Value; } bool MediaInfo_Config::Trace_TimeSection_OnlyFirstOccurrence_Get () { CriticalSectionLocker CSL(CS); return Trace_TimeSection_OnlyFirstOccurrence; } //--------------------------------------------------------------------------- void MediaInfo_Config::Trace_Format_Set (trace_Format NewValue) { CriticalSectionLocker CSL(CS); Trace_Format=NewValue; } MediaInfo_Config::trace_Format MediaInfo_Config::Trace_Format_Get () { CriticalSectionLocker CSL(CS); return Trace_Format; } //--------------------------------------------------------------------------- void MediaInfo_Config::Trace_Modificator_Set (const ZtringList &NewValue) { ZtringList List(NewValue); if (List.size()!=2) return; transform(List[0].begin(), List[0].end(), List[0].begin(), (int(*)(int))tolower); //(int(*)(int)) is a patch for unix CriticalSectionLocker CSL(CS); Trace_Modificators[List[0]]=List[1]==__T("1"); } Ztring MediaInfo_Config::Trace_Modificator_Get (const Ztring &Value) { CriticalSectionLocker CSL(CS); std::map::iterator ToReturn=Trace_Modificators.find(Value); if (ToReturn!=Trace_Modificators.end()) return ToReturn->second?__T("1"):__T("0"); else return Ztring(); } //--------------------------------------------------------------------------- void MediaInfo_Config::Demux_Set (int8u NewValue) { CriticalSectionLocker CSL(CS); Demux=NewValue; } int8u MediaInfo_Config::Demux_Get () { CriticalSectionLocker CSL(CS); return Demux; } //--------------------------------------------------------------------------- void MediaInfo_Config::LineSeparator_Set (const Ztring &NewValue) { CriticalSectionLocker CSL(CS); LineSeparator=NewValue; } Ztring MediaInfo_Config::LineSeparator_Get () { CriticalSectionLocker CSL(CS); return LineSeparator; } //--------------------------------------------------------------------------- void MediaInfo_Config::Version_Set (const Ztring &NewValue) { CriticalSectionLocker CSL(CS); Version=ZtringListList(NewValue).Read(0); //Only the 1st value } Ztring MediaInfo_Config::Version_Get () { CriticalSectionLocker CSL(CS); return Version; } //--------------------------------------------------------------------------- void MediaInfo_Config::ColumnSeparator_Set (const Ztring &NewValue) { CriticalSectionLocker CSL(CS); ColumnSeparator=NewValue; } Ztring MediaInfo_Config::ColumnSeparator_Get () { CriticalSectionLocker CSL(CS); return ColumnSeparator; } //--------------------------------------------------------------------------- void MediaInfo_Config::TagSeparator_Set (const Ztring &NewValue) { CriticalSectionLocker CSL(CS); TagSeparator=NewValue; } Ztring MediaInfo_Config::TagSeparator_Get () { CriticalSectionLocker CSL(CS); return TagSeparator; } //--------------------------------------------------------------------------- void MediaInfo_Config::Quote_Set (const Ztring &NewValue) { CriticalSectionLocker CSL(CS); Quote=NewValue; } Ztring MediaInfo_Config::Quote_Get () { CriticalSectionLocker CSL(CS); return Quote; } //--------------------------------------------------------------------------- void MediaInfo_Config::DecimalPoint_Set (const Ztring &NewValue) { CriticalSectionLocker CSL(CS); DecimalPoint=NewValue; } Ztring MediaInfo_Config::DecimalPoint_Get () { CriticalSectionLocker CSL(CS); return DecimalPoint; } //--------------------------------------------------------------------------- void MediaInfo_Config::ThousandsPoint_Set (const Ztring &NewValue) { CriticalSectionLocker CSL(CS); ThousandsPoint=NewValue; } Ztring MediaInfo_Config::ThousandsPoint_Get () { CriticalSectionLocker CSL(CS); return ThousandsPoint; } //--------------------------------------------------------------------------- void MediaInfo_Config::StreamMax_Set (const ZtringListList &) { CriticalSectionLocker CSL(CS); //TODO : implementation } Ztring MediaInfo_Config::StreamMax_Get () { CriticalSectionLocker CSL(CS); ZtringListList StreamMax; //TODO : implementation return StreamMax.Read(); } //--------------------------------------------------------------------------- void MediaInfo_Config::Language_Set (const ZtringListList &NewValue) { CriticalSectionLocker CSL(CS); //Which language to choose? //-Raw if (NewValue.size()==1 && NewValue[0].size()==1 && NewValue[0][0]==__T("raw")) { Language_Raw=true; Language.clear(); //Exceptions Language.Write(__T(" Config_Text_ColumnSize"), __T("32")); Language.Write(__T(" Config_Text_Separator"), __T(" : ")); Language.Write(__T(" Config_Text_NumberTag"), __T(" #")); Language.Write(__T(" Config_Text_FloatSeparator"), __T(".")); Language.Write(__T(" Config_Text_ThousandsSeparator"), Ztring()); } //-Add custom language to English language else { Language_Raw=false; //Fill base words (with English translation) MediaInfo_Config_DefaultLanguage(Language); //Add custom language to English language for (size_t Pos=0; Pos=2) Language.Write(NewValue[Pos][0], NewValue[Pos][1]); else if (NewValue[Pos].size()==1) Language.Write(NewValue[Pos][0], Ztring()); } //Fill Info for (size_t StreamKind=0; StreamKind We translate both XXX and YYY { Ztring ToReplace1=ToReplace.SubString(Ztring(), __T("/")); Ztring ToReplace2=ToReplace.SubString(__T("/"), Ztring()); Info[StreamKind](Pos, Info_Name_Text)=Language.Get(ToReplace1); Info[StreamKind](Pos, Info_Name_Text)+=__T("/"); Info[StreamKind](Pos, Info_Name_Text)+=Language.Get(ToReplace2); } else Info[StreamKind](Pos, Info_Name_Text)=Language.Get(ToReplace); //Strings - Info_Measure_Text Info[StreamKind](Pos, Info_Measure_Text).clear(); //I don(t know why, but if I don't do this Delphi/C# debugger make crashing the calling program Info[StreamKind](Pos, Info_Measure_Text)=Language.Get(Info[StreamKind](Pos, Info_Measure)); //Slashes } } Ztring MediaInfo_Config::Language_Get () { CriticalSectionLocker CSL(CS); Ztring ToReturn;//TODO =Language.Read(); return ToReturn; } Ztring MediaInfo_Config::Language_Get (const Ztring &Value) { CriticalSectionLocker CSL(CS); if (Value.find(__T(" / "))==string::npos) return Language.Get(Value); ZtringList List; List.Separator_Set(0, __T(" / ")); List.Write(Value); //Per value for (size_t Pos=0; Pos=5) Form=3; //005 to 009 kanalow } else if (Pos2==1) Form=3; //010 to 019 kanalow else //if (Pos2>=2) { if (Pos1<=1) Form=3; //020 to 021, 090 to 091 kanalow else if (Pos1<=4) Form=2; //022 to 024, 092 to 094 kanali else //if (Pos1>=5) Form=3; //025 to 029, 095 to 099 kanalow } } else //if (Pos3>=1) { if (Pos2==0) { if (Pos1<=1) Form=3; //100 to 101 kanalow else if (Pos1<=4) Form=2; //102 to 104 kanaly else //if (Pos1>=5) Form=3; //105 to 109 kanalow } else if (Pos2==1) Form=3; //110 to 119 kanalow else //if (Pos2>=2) { if (Pos1<=1) Form=3; //120 to 121, 990 to 991 kanalow else if (Pos1<=4) Form=2; //122 to 124, 992 to 994 kanali else //if (Pos1>=5) Form=3; //125 to 129, 995 to 999 kanalow } } } //Replace dot and thousand separator Ztring ToReturn=Count; Ztring DecimalPoint=Ztring().From_Number(0.0, 1).substr(1, 1); //Getting Decimal point size_t DotPos=ToReturn.find(DecimalPoint); if (DotPos!=string::npos) ToReturn.FindAndReplace(DecimalPoint, Language_Get(__T(" Config_Text_FloatSeparator")), DotPos); else DotPos=ToReturn.size(); if (DotPos>3) ToReturn.insert(DotPos-3, Language_Get(__T(" Config_Text_ThousandsSeparator"))); //Selecting the form if (Form==0) ToReturn =Language_Get(Value+__T("0")); //Only the translation else if (Form==1) ToReturn+=Language_Get(Value+__T("1")); else if (Form==2) ToReturn+=Language_Get(Value+__T("2")); else if (Form==3) ToReturn+=Language_Get(Value+__T("3")); else ToReturn+=Language_Get(Value); return ToReturn; } //--------------------------------------------------------------------------- void MediaInfo_Config::Inform_Set (const ZtringListList &NewValue) { if (NewValue.Read(0, 0)==__T("Details")) Trace_Level_Set(NewValue.Read(0, 1)); else { Trace_Level_Set(__T("0")); CriticalSectionLocker CSL(CS); //Inform if (NewValue==__T("Summary")) MediaInfo_Config_Summary(Custom_View); else Custom_View=NewValue; } CriticalSectionLocker CSL(CS); //Parsing pointers to files in streams for (size_t Pos=0; Pos1 && Custom_View(Pos, 1).find(__T("file://"))==0) { //Open Ztring FileName(Custom_View(Pos, 1), 7, Ztring::npos); File F(FileName.c_str()); //Read int64u Size=F.Size_Get(); if (Size>=0xFFFFFFFF) Size=1024*1024; int8u* Buffer=new int8u[(size_t)Size+1]; size_t F_Offset=F.Read(Buffer, (size_t)Size); F.Close(); Buffer[F_Offset]='\0'; Ztring FromFile; FromFile.From_Local((char*)Buffer); delete[] Buffer; //Buffer=NULL; //Merge FromFile.FindAndReplace(__T("\r\n"), __T("\\r\\n"), 0, Ztring_Recursive); FromFile.FindAndReplace(__T("\n"), __T("\\r\\n"), 0, Ztring_Recursive); Custom_View(Pos, 1)=FromFile; } } } Ztring MediaInfo_Config::Inform_Get () { CriticalSectionLocker CSL(CS); return Custom_View.Read(); } Ztring MediaInfo_Config::Inform_Get (const Ztring &Value) { CriticalSectionLocker CSL(CS); size_t Pos=Custom_View.Find(Value); if (Pos==Error || 1>=Custom_View[Pos].size()) return EmptyString_Get(); return Custom_View[Pos][1]; } //--------------------------------------------------------------------------- void MediaInfo_Config::Inform_Replace_Set (const ZtringListList &NewValue_Replace) { CriticalSectionLocker CSL(CS); //Parsing for (size_t Pos=0; Pos=InfoCodecID_Format_Max || KindOfStream>=Stream_Max) return EmptyString_Get(); CS.Enter(); if (CodecID[Format][KindOfStream].empty()) { switch (KindOfStream) { case Stream_General : switch (Format) { case InfoCodecID_Format_Mpeg4 : MediaInfo_Config_CodecID_General_Mpeg4(CodecID[Format][KindOfStream]); break; default: ; } break; case Stream_Video : switch (Format) { case InfoCodecID_Format_Matroska : MediaInfo_Config_CodecID_Video_Matroska(CodecID[Format][KindOfStream]); break; case InfoCodecID_Format_Mpeg4 : MediaInfo_Config_CodecID_Video_Mpeg4(CodecID[Format][KindOfStream]); break; case InfoCodecID_Format_Real : MediaInfo_Config_CodecID_Video_Real(CodecID[Format][KindOfStream]); break; case InfoCodecID_Format_Riff : MediaInfo_Config_CodecID_Video_Riff(CodecID[Format][KindOfStream]); break; default: ; } break; case Stream_Audio : switch (Format) { case InfoCodecID_Format_Matroska : MediaInfo_Config_CodecID_Audio_Matroska(CodecID[Format][KindOfStream]); break; case InfoCodecID_Format_Mpeg4 : MediaInfo_Config_CodecID_Audio_Mpeg4(CodecID[Format][KindOfStream]); break; case InfoCodecID_Format_Real : MediaInfo_Config_CodecID_Audio_Real(CodecID[Format][KindOfStream]); break; case InfoCodecID_Format_Riff : MediaInfo_Config_CodecID_Audio_Riff(CodecID[Format][KindOfStream]); break; default: ; } break; case Stream_Text : switch (Format) { case InfoCodecID_Format_Matroska : MediaInfo_Config_CodecID_Text_Matroska(CodecID[Format][KindOfStream]); break; case InfoCodecID_Format_Mpeg4 : MediaInfo_Config_CodecID_Text_Mpeg4(CodecID[Format][KindOfStream]); break; case InfoCodecID_Format_Riff : MediaInfo_Config_CodecID_Text_Riff(CodecID[Format][KindOfStream]); break; default: ; } break; default: ; } } CS.Leave(); return CodecID[Format][KindOfStream].Get(Value, KindOfCodecIDInfo); } //--------------------------------------------------------------------------- const Ztring &MediaInfo_Config::Library_Get (infolibrary_format_t Format, const Ztring &Value, infolibrary_t KindOfLibraryInfo) { if (Format>=InfoLibrary_Format_Max) return EmptyString_Get(); CS.Enter(); if (Library[Format].empty()) { switch (Format) { case InfoLibrary_Format_DivX : MediaInfo_Config_Library_DivX(Library[Format]); break; case InfoLibrary_Format_XviD : MediaInfo_Config_Library_XviD(Library[Format]); break; case InfoLibrary_Format_MainConcept_Avc : MediaInfo_Config_Library_MainConcept_Avc(Library[Format]); break; case InfoLibrary_Format_VorbisCom : MediaInfo_Config_Library_VorbisCom(Library[Format]); break; default: ; } } CS.Leave(); return Library[Format].Get(Value, KindOfLibraryInfo); } //--------------------------------------------------------------------------- const Ztring &MediaInfo_Config::Iso639_1_Get (const Ztring &Value) { //Loading codec table if not yet done CS.Enter(); if (Iso639_1.empty()) MediaInfo_Config_Iso639_1(Iso639_1); CS.Leave(); return Iso639_1.Get(Ztring(Value).MakeLowerCase(), 1); } //--------------------------------------------------------------------------- const Ztring &MediaInfo_Config::Iso639_2_Get (const Ztring &Value) { //Loading codec table if not yet done CS.Enter(); if (Iso639_2.empty()) MediaInfo_Config_Iso639_2(Iso639_2); CS.Leave(); return Iso639_2.Get(Ztring(Value).MakeLowerCase(), 1); } //--------------------------------------------------------------------------- const Ztring MediaInfo_Config::Iso639_Find (const Ztring &Value) { Translation Info; MediaInfo_Config_DefaultLanguage (Info); Ztring Value_Lower(Value); Value_Lower.MakeLowerCase(); for (Translation::iterator Trans=Info.begin(); Trans!=Info.end(); ++Trans) { Trans->second.MakeLowerCase(); if (Trans->second==Value_Lower && Trans->first.find(__T("Language_"))==0) return Trans->first.substr(9, string::npos); } return Ztring(); } //--------------------------------------------------------------------------- const Ztring &MediaInfo_Config::Info_Get (stream_t KindOfStream, const Ztring &Value, info_t KindOfInfo) { //Loading codec table if not yet done CS.Enter(); if (Info[KindOfStream].empty()) switch (KindOfStream) { case Stream_General : MediaInfo_Config_General(Info[Stream_General]); Language_Set(Stream_General); break; case Stream_Video : MediaInfo_Config_Video(Info[Stream_Video]); Language_Set(Stream_Video); break; case Stream_Audio : MediaInfo_Config_Audio(Info[Stream_Audio]); Language_Set(Stream_Audio); break; case Stream_Text : MediaInfo_Config_Text(Info[Stream_Text]); Language_Set(Stream_Text); break; case Stream_Other : MediaInfo_Config_Other(Info[Stream_Other]); Language_Set(Stream_Other); break; case Stream_Image : MediaInfo_Config_Image(Info[Stream_Image]); Language_Set(Stream_Image); break; case Stream_Menu : MediaInfo_Config_Menu(Info[Stream_Menu]); Language_Set(Stream_Menu); break; default:; } CS.Leave(); if (KindOfStream>=Stream_Max) return EmptyString_Get(); size_t Pos=Info[KindOfStream].Find(Value); if (Pos==Error || (size_t)KindOfInfo>=Info[KindOfStream][Pos].size()) return EmptyString_Get(); return Info[KindOfStream][Pos][KindOfInfo]; } const Ztring &MediaInfo_Config::Info_Get (stream_t KindOfStream, size_t Pos, info_t KindOfInfo) { //Loading codec table if not yet done CS.Enter(); if (Info[KindOfStream].empty()) switch (KindOfStream) { case Stream_General : MediaInfo_Config_General(Info[Stream_General]); Language_Set(Stream_General); break; case Stream_Video : MediaInfo_Config_Video(Info[Stream_Video]); Language_Set(Stream_Video); break; case Stream_Audio : MediaInfo_Config_Audio(Info[Stream_Audio]); Language_Set(Stream_Audio); break; case Stream_Text : MediaInfo_Config_Text(Info[Stream_Text]); Language_Set(Stream_Text); break; case Stream_Other : MediaInfo_Config_Other(Info[Stream_Other]); Language_Set(Stream_Other); break; case Stream_Image : MediaInfo_Config_Image(Info[Stream_Image]); Language_Set(Stream_Image); break; case Stream_Menu : MediaInfo_Config_Menu(Info[Stream_Menu]); Language_Set(Stream_Menu); break; default:; } CS.Leave(); if (KindOfStream>=Stream_Max) return EmptyString_Get(); if (Pos>=Info[KindOfStream].size() || (size_t)KindOfInfo>=Info[KindOfStream][Pos].size()) return EmptyString_Get(); return Info[KindOfStream][Pos][KindOfInfo]; } const ZtringListList &MediaInfo_Config::Info_Get(stream_t KindOfStream) { if (KindOfStream>=Stream_Max) return EmptyStringListList_Get(); //Loading codec table if not yet done CS.Enter(); if (Info[KindOfStream].empty()) switch (KindOfStream) { case Stream_General : MediaInfo_Config_General(Info[Stream_General]); Language_Set(Stream_General); break; case Stream_Video : MediaInfo_Config_Video(Info[Stream_Video]); Language_Set(Stream_Video); break; case Stream_Audio : MediaInfo_Config_Audio(Info[Stream_Audio]); Language_Set(Stream_Audio); break; case Stream_Text : MediaInfo_Config_Text(Info[Stream_Text]); Language_Set(Stream_Text); break; case Stream_Other : MediaInfo_Config_Other(Info[Stream_Other]); Language_Set(Stream_Other); break; case Stream_Image : MediaInfo_Config_Image(Info[Stream_Image]); Language_Set(Stream_Image); break; case Stream_Menu : MediaInfo_Config_Menu(Info[Stream_Menu]); Language_Set(Stream_Menu); break; default:; } CS.Leave(); return Info[KindOfStream]; } //--------------------------------------------------------------------------- Ztring MediaInfo_Config::Info_Parameters_Get (bool Complete) { CriticalSectionLocker CSL(CS); //Loading all MediaInfo_Config_General(Info[Stream_General]); MediaInfo_Config_Video(Info[Stream_Video]); MediaInfo_Config_Audio(Info[Stream_Audio]); MediaInfo_Config_Text(Info[Stream_Text]); MediaInfo_Config_Other(Info[Stream_Other]); MediaInfo_Config_Image(Info[Stream_Image]); MediaInfo_Config_Menu(Info[Stream_Menu]); //Building ZtringListList ToReturn; size_t ToReturn_Pos=0; for (size_t StreamKind=0; StreamKindsecond.Read(); ToReturn+=EOL; ++Temp; } return ToReturn; } Ztring MediaInfo_Config::Info_Version_Get () const { return MediaInfo_Version; } Ztring MediaInfo_Config::Info_Url_Get () const { return MediaInfo_Url; } const Ztring &MediaInfo_Config::EmptyString_Get () const { return EmptyZtring_Const; } const ZtringListList &MediaInfo_Config::EmptyStringListList_Get () const { return EmptyZtringListList_Const; } void MediaInfo_Config::FormatDetection_MaximumOffset_Set (int64u Value) { CriticalSectionLocker CSL(CS); FormatDetection_MaximumOffset=Value; } int64u MediaInfo_Config::FormatDetection_MaximumOffset_Get () { CriticalSectionLocker CSL(CS); return FormatDetection_MaximumOffset; } #if MEDIAINFO_ADVANCED void MediaInfo_Config::VariableGopDetection_Occurences_Set (int64u Value) { CriticalSectionLocker CSL(CS); VariableGopDetection_Occurences=Value; } int64u MediaInfo_Config::VariableGopDetection_Occurences_Get () { CriticalSectionLocker CSL(CS); return VariableGopDetection_Occurences; } #endif // MEDIAINFO_ADVANCED #if MEDIAINFO_ADVANCED void MediaInfo_Config::VariableGopDetection_GiveUp_Set (bool Value) { CriticalSectionLocker CSL(CS); VariableGopDetection_GiveUp=Value; } bool MediaInfo_Config::VariableGopDetection_GiveUp_Get () { CriticalSectionLocker CSL(CS); return VariableGopDetection_GiveUp; } #endif // MEDIAINFO_ADVANCED #if MEDIAINFO_ADVANCED void MediaInfo_Config::InitDataNotRepeated_Occurences_Set (int64u Value) { CriticalSectionLocker CSL(CS); InitDataNotRepeated_Occurences=Value; } int64u MediaInfo_Config::InitDataNotRepeated_Occurences_Get () { CriticalSectionLocker CSL(CS); return InitDataNotRepeated_Occurences; } #endif // MEDIAINFO_ADVANCED #if MEDIAINFO_ADVANCED void MediaInfo_Config::InitDataNotRepeated_GiveUp_Set (bool Value) { CriticalSectionLocker CSL(CS); InitDataNotRepeated_GiveUp=Value; } bool MediaInfo_Config::InitDataNotRepeated_GiveUp_Get () { CriticalSectionLocker CSL(CS); return InitDataNotRepeated_GiveUp; } #endif // MEDIAINFO_ADVANCED void MediaInfo_Config::MpegTs_MaximumOffset_Set (int64u Value) { CriticalSectionLocker CSL(CS); MpegTs_MaximumOffset=Value; } int64u MediaInfo_Config::MpegTs_MaximumOffset_Get () { CriticalSectionLocker CSL(CS); return MpegTs_MaximumOffset; } void MediaInfo_Config::MpegTs_MaximumScanDuration_Set (int64u Value) { CriticalSectionLocker CSL(CS); MpegTs_MaximumScanDuration=Value; } int64u MediaInfo_Config::MpegTs_MaximumScanDuration_Get () { CriticalSectionLocker CSL(CS); return MpegTs_MaximumScanDuration; } #if MEDIAINFO_ADVANCED void MediaInfo_Config::MpegTs_VbrDetection_Delta_Set (float64 Value) { CriticalSectionLocker CSL(CS); MpegTs_VbrDetection_Delta=Value; } float64 MediaInfo_Config::MpegTs_VbrDetection_Delta_Get () { CriticalSectionLocker CSL(CS); return MpegTs_VbrDetection_Delta; } #endif // MEDIAINFO_ADVANCED #if MEDIAINFO_ADVANCED void MediaInfo_Config::MpegTs_VbrDetection_Occurences_Set (int64u Value) { CriticalSectionLocker CSL(CS); MpegTs_VbrDetection_Occurences=Value; } int64u MediaInfo_Config::MpegTs_VbrDetection_Occurences_Get () { CriticalSectionLocker CSL(CS); return MpegTs_VbrDetection_Occurences; } #endif // MEDIAINFO_ADVANCED #if MEDIAINFO_ADVANCED void MediaInfo_Config::MpegTs_VbrDetection_GiveUp_Set (bool Value) { CriticalSectionLocker CSL(CS); MpegTs_VbrDetection_GiveUp=Value; } bool MediaInfo_Config::MpegTs_VbrDetection_GiveUp_Get () { CriticalSectionLocker CSL(CS); return MpegTs_VbrDetection_GiveUp; } #endif // MEDIAINFO_ADVANCED void MediaInfo_Config::MpegTs_ForceStreamDisplay_Set (bool Value) { CriticalSectionLocker CSL(CS); MpegTs_ForceStreamDisplay=Value; } bool MediaInfo_Config::MpegTs_ForceStreamDisplay_Get () { CriticalSectionLocker CSL(CS); return MpegTs_ForceStreamDisplay; } //*************************************************************************** // SubFile //*************************************************************************** //--------------------------------------------------------------------------- ZtringListList MediaInfo_Config::SubFile_Config_Get () { CriticalSectionLocker CSL(CS); return SubFile_Config; } //*************************************************************************** // Custom mapping //*************************************************************************** void MediaInfo_Config::CustomMapping_Set (const Ztring &Value) { ZtringList List; List.Separator_Set(0, __T(",")); List.Write(Value); if (List.size()==3) { CriticalSectionLocker CSL(CS); CustomMapping[List[0]][List[1]]=List[2]; } } Ztring MediaInfo_Config::CustomMapping_Get (const Ztring &Format, const Ztring &Field) { CriticalSectionLocker CSL(CS); return CustomMapping[Format][Field]; } bool MediaInfo_Config::CustomMapping_IsPresent(const Ztring &Format, const Ztring &Field) { CriticalSectionLocker CSL(CS); std::map >::iterator PerFormat=CustomMapping.find(Format); if (PerFormat==CustomMapping.end()) return false; std::map::iterator PerField=PerFormat->second.find(Field); if (PerField==PerFormat->second.end()) return false; return true; } //*************************************************************************** // Event //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_EVENTS bool MediaInfo_Config::Event_CallBackFunction_IsSet () { CriticalSectionLocker CSL(CS); return Event_CallBackFunction?true:false; } #endif //MEDIAINFO_EVENTS //--------------------------------------------------------------------------- #if MEDIAINFO_EVENTS Ztring MediaInfo_Config::Event_CallBackFunction_Set (const Ztring &Value) { ZtringList List=Value; CriticalSectionLocker CSL(CS); if (List.empty()) { Event_CallBackFunction=(MediaInfo_Event_CallBackFunction*)NULL; Event_UserHandler=NULL; } else for (size_t Pos=0; Pos using namespace ZenLib; using std::vector; using std::string; using std::map; using std::make_pair; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class MediaInfo_Config //*************************************************************************** class MediaInfo_Config { public : //Constructor/Destructor MediaInfo_Config() {} void Init(); //Must be called instead of constructor //General Ztring Option (const String &Option, const String &Value=Ztring()); //Info void Complete_Set (size_t NewValue); size_t Complete_Get (); void BlockMethod_Set (size_t NewValue); size_t BlockMethod_Get (); void Internet_Set (size_t NewValue); size_t Internet_Get (); void MultipleValues_Set (size_t NewValue); size_t MultipleValues_Get (); void ParseUnknownExtensions_Set (size_t NewValue); size_t ParseUnknownExtensions_Get (); void ShowFiles_Set (const ZtringListList &NewShowFiles); size_t ShowFiles_Nothing_Get (); size_t ShowFiles_VideoAudio_Get (); size_t ShowFiles_VideoOnly_Get (); size_t ShowFiles_AudioOnly_Get (); size_t ShowFiles_TextOnly_Get (); void ReadByHuman_Set (bool NewValue); bool ReadByHuman_Get (); void LegacyStreamDisplay_Set (bool Value); bool LegacyStreamDisplay_Get (); void SkipBinaryData_Set (bool Value); bool SkipBinaryData_Get (); void ParseSpeed_Set (float32 NewValue); float32 ParseSpeed_Get (); void Verbosity_Set (float32 NewValue); float32 Verbosity_Get (); void Trace_Level_Set (const ZtringListList &NewDetailsLevel); float32 Trace_Level_Get (); std::bitset<32> Trace_Layers_Get (); void Trace_TimeSection_OnlyFirstOccurrence_Set (bool Value); bool Trace_TimeSection_OnlyFirstOccurrence_Get (); enum trace_Format { Trace_Format_Tree, Trace_Format_CSV, }; void Trace_Format_Set (trace_Format NewValue); trace_Format Trace_Format_Get (); void Trace_Modificator_Set (const ZtringList &NewModifcator); //Not implemented Ztring Trace_Modificator_Get (const Ztring &Modificator); //Not implemented void Demux_Set (int8u NewValue); int8u Demux_Get (); void LineSeparator_Set (const Ztring &NewValue); Ztring LineSeparator_Get (); void Version_Set (const Ztring &NewValue); Ztring Version_Get (); void ColumnSeparator_Set (const Ztring &NewValue); Ztring ColumnSeparator_Get (); void TagSeparator_Set (const Ztring &NewValue); Ztring TagSeparator_Get (); void Quote_Set (const Ztring &NewValue); Ztring Quote_Get (); void DecimalPoint_Set (const Ztring &NewValue); Ztring DecimalPoint_Get (); void ThousandsPoint_Set (const Ztring &NewValue); Ztring ThousandsPoint_Get (); void StreamMax_Set (const ZtringListList &NewValue); Ztring StreamMax_Get (); void Language_Set (const ZtringListList &NewLanguage); Ztring Language_Get (); Ztring Language_Get (const Ztring &Value); Ztring Language_Get (const Ztring &Count, const Ztring &Value, bool ValueIsAlwaysSame=false); void Inform_Set (const ZtringListList &NewInform); Ztring Inform_Get (); Ztring Inform_Get (const Ztring &Value); void Inform_Replace_Set (const ZtringListList &NewInform_Replace); ZtringListList Inform_Replace_Get_All (); const Ztring &Format_Get (const Ztring &Value, infoformat_t KindOfFormatInfo=InfoFormat_Name); InfoMap &Format_Get(); //Should not be, but too difficult to hide it const Ztring &Codec_Get (const Ztring &Value, infocodec_t KindOfCodecInfo=InfoCodec_Name); const Ztring &Codec_Get (const Ztring &Value, infocodec_t KindOfCodecInfo, stream_t KindOfStream); const Ztring &CodecID_Get (stream_t KindOfStream, infocodecid_format_t Format, const Ztring &Value, infocodecid_t KindOfCodecIDInfo=InfoCodecID_Format); const Ztring &Library_Get (infolibrary_format_t Format, const Ztring &Value, infolibrary_t KindOfLibraryInfo=InfoLibrary_Version); const Ztring &Iso639_1_Get (const Ztring &Value); const Ztring &Iso639_2_Get (const Ztring &Value); const Ztring Iso639_Find (const Ztring &Value); const Ztring &Info_Get (stream_t KindOfStream, const Ztring &Value, info_t KindOfInfo=Info_Text); const Ztring &Info_Get (stream_t KindOfStream, size_t Pos, info_t KindOfInfo=Info_Text); const ZtringListList &Info_Get(stream_t KindOfStream); //Should not be, but too difficult to hide it Ztring Info_Parameters_Get (bool Complete=false); Ztring Info_Tags_Get () const; Ztring Info_CodecsID_Get (); Ztring Info_Codecs_Get (); Ztring Info_Version_Get () const; Ztring Info_Url_Get () const; const Ztring &EmptyString_Get() const; //Use it when we can't return a reference to a true string const ZtringListList &EmptyStringListList_Get() const; //Use it when we can't return a reference to a true string list list void FormatDetection_MaximumOffset_Set (int64u Value); int64u FormatDetection_MaximumOffset_Get (); #if MEDIAINFO_ADVANCED void VariableGopDetection_Occurences_Set (int64u Value); int64u VariableGopDetection_Occurences_Get (); void VariableGopDetection_GiveUp_Set (bool Value); bool VariableGopDetection_GiveUp_Get (); void InitDataNotRepeated_Occurences_Set (int64u Value); int64u InitDataNotRepeated_Occurences_Get (); void InitDataNotRepeated_GiveUp_Set (bool Value); bool InitDataNotRepeated_GiveUp_Get (); #endif //MEDIAINFO_ADVANCED void MpegTs_MaximumOffset_Set (int64u Value); int64u MpegTs_MaximumOffset_Get (); void MpegTs_MaximumScanDuration_Set (int64u Value); int64u MpegTs_MaximumScanDuration_Get (); void MpegTs_ForceStreamDisplay_Set (bool Value); bool MpegTs_ForceStreamDisplay_Get (); #if MEDIAINFO_ADVANCED void MpegTs_VbrDetection_Delta_Set (float64 Value); float64 MpegTs_VbrDetection_Delta_Get (); void MpegTs_VbrDetection_Occurences_Set (int64u Value); int64u MpegTs_VbrDetection_Occurences_Get (); void MpegTs_VbrDetection_GiveUp_Set (bool Value); bool MpegTs_VbrDetection_GiveUp_Get (); #endif //MEDIAINFO_ADVANCED ZtringListList SubFile_Config_Get (); void CustomMapping_Set (const Ztring &Value); Ztring CustomMapping_Get (const Ztring &Format, const Ztring &Field); bool CustomMapping_IsPresent (const Ztring &Format, const Ztring &Field); void ErrorLog_Callback_Set(const Ztring &Value); void ErrorLog(const Ztring &Value); #if MEDIAINFO_EVENTS bool Event_CallBackFunction_IsSet (); Ztring Event_CallBackFunction_Set (const Ztring &Value); Ztring Event_CallBackFunction_Get (); void Event_Send(const int8u* Data_Content, size_t Data_Size); void Event_Send(const int8u* Data_Content, size_t Data_Size, const Ztring &File_Name); void Log_Send(int8u Type, int8u Severity, int32u MessageCode, const Ztring &Message); void Log_Send(int8u Type, int8u Severity, int32u MessageCode, const char* Message) {return Log_Send(Type, Severity, MessageCode, Ztring().From_Local(Message));} #endif //MEDIAINFO_EVENTS #if defined(MEDIAINFO_LIBCURL_YES) void Ssh_PublicKeyFileName_Set (const Ztring &NewValue); Ztring Ssh_PublicKeyFileName_Get (); void Ssh_PrivateKeyFileName_Set (const Ztring &NewValue); Ztring Ssh_PrivateKeyFileName_Get (); void Ssh_IgnoreSecurity_Set (bool NewValue); void Ssh_KnownHostsFileName_Set (const Ztring &NewValue); Ztring Ssh_KnownHostsFileName_Get (); bool Ssh_IgnoreSecurity_Get (); void Ssl_CertificateFileName_Set (const Ztring &NewValue); Ztring Ssl_CertificateFileName_Get (); void Ssl_CertificateFormat_Set (const Ztring &NewValue); Ztring Ssl_CertificateFormat_Get (); void Ssl_PrivateKeyFileName_Set (const Ztring &NewValue); Ztring Ssl_PrivateKeyFileName_Get (); void Ssl_PrivateKeyFormat_Set (const Ztring &NewValue); Ztring Ssl_PrivateKeyFormat_Get (); void Ssl_CertificateAuthorityFileName_Set (const Ztring &NewValue); Ztring Ssl_CertificateAuthorityFileName_Get (); void Ssl_CertificateAuthorityPath_Set (const Ztring &NewValue); Ztring Ssl_CertificateAuthorityPath_Get (); void Ssl_CertificateRevocationListFileName_Set (const Ztring &NewValue); Ztring Ssl_CertificateRevocationListFileName_Get (); void Ssl_IgnoreSecurity_Set (bool NewValue); bool Ssl_IgnoreSecurity_Get (); #endif //defined(MEDIAINFO_LIBCURL_YES) private : int64u FormatDetection_MaximumOffset; #if MEDIAINFO_ADVANCED int64u VariableGopDetection_Occurences; bool VariableGopDetection_GiveUp; int64u InitDataNotRepeated_Occurences; bool InitDataNotRepeated_GiveUp; #endif //MEDIAINFO_ADVANCED int64u MpegTs_MaximumOffset; int64u MpegTs_MaximumScanDuration; bool MpegTs_ForceStreamDisplay; #if MEDIAINFO_ADVANCED float64 MpegTs_VbrDetection_Delta; int64u MpegTs_VbrDetection_Occurences; bool MpegTs_VbrDetection_GiveUp; #endif //MEDIAINFO_ADVANCED size_t Complete; size_t BlockMethod; size_t Internet; size_t MultipleValues; size_t ParseUnknownExtensions; size_t ShowFiles_Nothing; size_t ShowFiles_VideoAudio; size_t ShowFiles_VideoOnly; size_t ShowFiles_AudioOnly; size_t ShowFiles_TextOnly; float32 ParseSpeed; float32 Verbosity; float32 Trace_Level; bool Trace_TimeSection_OnlyFirstOccurrence; std::bitset<32> Trace_Layers; //0-7: Container, 8: Stream std::map Trace_Modificators; //If we want to add/remove some details bool Language_Raw; bool ReadByHuman; bool LegacyStreamDisplay; bool SkipBinaryData; int8u Demux; Ztring Version; Ztring ColumnSeparator; Ztring LineSeparator; Ztring TagSeparator; Ztring Quote; Ztring DecimalPoint; Ztring ThousandsPoint; Translation Language; //ex. : "KB;Ko" ZtringListList Custom_View; //Definition of "General", "Video", "Audio", "Text", "Other", "Image" ZtringListList Custom_View_Replace; //ToReplace;ReplaceBy trace_Format Trace_Format; InfoMap Container; InfoMap CodecID[InfoCodecID_Format_Max][Stream_Max]; InfoMap Format; InfoMap Codec; InfoMap Library[InfoLibrary_Format_Max]; InfoMap Iso639_1; InfoMap Iso639_2; ZtringListList Info[Stream_Max]; //General info ZtringListList SubFile_Config; std::map > CustomMapping; ZenLib::CriticalSection CS; void Language_Set (stream_t StreamKind); //Event #if MEDIAINFO_EVENTS MediaInfo_Event_CallBackFunction* Event_CallBackFunction; //void Event_Handler(unsigned char* Data_Content, size_t Data_Size, void* UserHandler) void* Event_UserHandler; #endif //MEDIAINFO_EVENTS #if defined(MEDIAINFO_LIBCURL_YES) Ztring Ssh_PublicKeyFileName; Ztring Ssh_PrivateKeyFileName; Ztring Ssh_KnownHostsFileName; bool Ssh_IgnoreSecurity; Ztring Ssl_CertificateFileName; Ztring Ssl_CertificateFormat; Ztring Ssl_PrivateKeyFileName; Ztring Ssl_PrivateKeyFormat; Ztring Ssl_CertificateAuthorityFileName; Ztring Ssl_CertificateAuthorityPath; Ztring Ssl_CertificateRevocationListFileName; bool Ssl_IgnoreSecurity; #endif //defined(MEDIAINFO_LIBCURL_YES) //Constructor MediaInfo_Config (const MediaInfo_Config&); // Prevent copy-construction MediaInfo_Config& operator=(const MediaInfo_Config&); // Prevent assignment }; extern MediaInfo_Config Config; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/MediaInfo_Config_Automatic.cpp100777 0 0 1164164 12262525402 17501 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Automaticly generated methods for MediaInfo // Don't modify, this will be deleted at the next automatic update // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #include "MediaInfo/PreComp.h" #include "ZenLib/ZtringListList.h" #include "ZenLib/InfoMap.h" #include "ZenLib/Translation.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- void MediaInfo_Config_DefaultLanguage (Translation &Info) { Info.Separator_Set(0, __T("\n")); Info.Write(Ztring().From_UTF8( " Language_ISO639;en\n" " Author_Email;Info@MediaArea.net\n" " Author_Name;Zen\n" " Author_OldNames;Initial translator\n" " Language_Name;English\n" " Config_Text_ColumnSize;40\n" " Config_Text_Separator; : \n" " Config_Text_NumberTag; #\n" " Config_Text_FloatSeparator;.\n" " Config_Text_ThousandsSeparator; \n" " audio stream1; audio stream\n" " audio stream2; audio streams\n" " audio stream3; audio streams\n" " bit1; bit\n" " bit2; bits\n" " bit3; bits\n" " bps; bps\n" " Bps; Bps\n" " Byte1; Byte\n" " Byte2; Bytes\n" " Byte3; Bytes\n" " channel1; channel\n" " channel2; channels\n" " channel3; channels\n" " chapter1; chapter\n" " chapter2; chapters\n" " chapter3; chapters\n" " chapters stream1; chapters stream\n" " chapters stream2; chapters streams\n" " chapters stream3; chapters streams\n" " day1; day\n" " day2; days\n" " day3; days\n" " dB1; dB\n" " dB2; dB\n" " dB3; dB\n" " file1; file\n" " file2; files\n" " file3; files\n" " frame1; frame\n" " frame2; frames\n" " frame3; frames\n" " fps1; fps\n" " fps2; fps\n" " fps3; fps\n" " GB; GB\n" " Gb; Gb\n" " Gbps; Gbps\n" " GBps; GBps\n" " GHz; GHz\n" " GiB; GiB\n" " GibiByte1; GibiBytes\n" " GibiByte2; GibiBytes\n" " GibiByte3; GibiBytes\n" " GiBps; GiBps\n" " GigaBit1; GigaBit\n" " GigaBit2; GigaBits\n" " GigaBit3; GigaBits\n" " GigaByte1; GigaByte\n" " GigaByte2; GigaBytes\n" " GigaByte3; GigaBytes\n" " hour1; hour\n" " hour2; hours\n" " hour3; hours\n" " Hz; Hz\n" " image stream1; image stream\n" " image stream2; image streams\n" " image stream3; image streams\n" " KB; KB\n" " Kb; Kb\n" " KBps; KBps\n" " Kbps; Kbps\n" " KHz; KHz\n" " KiB; KiB\n" " KibiBit1; KibiBit\n" " KibiBit2; KibiBits\n" " KibiBit3; KibiBits\n" " KibiByte1; KibiByte\n" " KibiByte2; KibiBytes\n" " KibiByte3; KibiBytes\n" " KiBps; KiBps\n" " KiloBit1; KiloBit\n" " KiloBit2; KiloBits\n" " KiloBit3; KiloBits\n" " KiloByte1; KiloByte\n" " KiloByte2; KiloBytes\n" " KiloByte3; KiloBytes\n" " MB; MB\n" " Mb; Mb\n" " Mbps; Mbps\n" " MBps; MebiBytes\n" " MebiBit1; MebiBit\n" " MebiBit2; MebiBits\n" " MebiBit3; MebiBits\n" " MebiByte1; MebiByte\n" " MebiByte2; MebiBytes\n" " MebiByte3; MebiBytes\n" " MegaBit1; MegaBit\n" " MegaBit2; MegaBits\n" " MegaBit3; MegaBits\n" " MegaByte1; MegaByte\n" " MegaByte2; MegaBytes\n" " MegaByte3; MegaBytes\n" " MHz; MHz\n" " MiB; MiB\n" " Mib; Mib\n" " MiBps; MiBps\n" " millisecond1; millisecond\n" " millisecond2; milliseconds\n" " millisecond3; milliseconds\n" " minute1; minute\n" " minute2; minutes\n" " minute3; minutes\n" " month1; month\n" " month2; months\n" " month3; months\n" " pixel1; pixel\n" " pixel2; pixels\n" " pixel3; pixels\n" " second1; second\n" " second2; seconds\n" " second3; seconds\n" " text stream1; text stream\n" " text stream2; text streams\n" " text stream3; text streams\n" " video frames1; video frame\n" " video frames2; video frames\n" " video frames3; video frames\n" " video stream1; video stream\n" " video stream2; video streams\n" " video stream3; video streams\n" " warppoint0;No warppoints\n" " warppoint1; warppoint\n" " warppoint2; warppoints\n" " warppoint3; warppoints\n" " week1; week\n" " week2; weeks\n" " week3; weeks\n" " year1; year\n" " year2; years\n" " year3; years\n" ", ;, \n" ": ;: \n" "About;About\n" "About_Hint;How to contact me and find last version\n" "Accompaniment;Accompaniment\n" "ActiveFormatDescription;Active Format Description\n" "ActiveFormatDescription_MuxingMode;Active Format Description, Muxing mode\n" "Actor;Actor\n" "Actor_Character;Character played\n" "Added_Date;Added date\n" "Address;Address\n" "Advanced;Advanced\n" "Advanced mode;Advanced mode\n" "Album;Album\n" "Album_ReplayGain_Gain;Album replay gain\n" "Album_ReplayGain_Peak;Album replay gain peak\n" "Alignment;Alignment\n" "Alignment_Aligned;Aligned on interleaves\n" "Alignment_Split;Split accross interleaves\n" "All;All\n" "Archival_Location;Archival location\n" "Arranger;Arranger\n" "ArtDirector;ArtDirector\n" "AspectRatio;Aspect ratio\n" "AssistantDirector;AssistantDirector\n" "at;at\n" "At least one file;(You must at least open one file)\n" "Audio;Audio\n" "Audio stream(s);Audio streams\n" "Audio_Codec_List;Audio codecs\n" "Audio_No;No audio\n" "Audio1;First audio stream\n" "Audio2;Second audio stream\n" "AudioCount;Count of audio streams\n" "Author;Author\n" "BarCode;BarCode\n" "Basic;Basic\n" "Basic_Note;Note : for more information about this file, you must select a different view (Sheet, Tree...)\n" "BitDepth;Bit depth\n" "BitRate;Bit rate\n" "BitRate_Maximum;Maximum bit rate\n" "BitRate_Minimum;Minimum bit rate\n" "BitRate_Mode;Bit rate mode\n" "BitRate_Mode_CBR;Constant\n" "BitRate_Mode_VBR;Variable\n" "BitRate_Nominal;Nominal bit rate\n" "BitRate_Encoded;Encoded bit rate\n" "Bits-(Pixel*Frame);Bits/(Pixel*Frame)\n" "BufferSize;Buffer size\n" "Cancel;Cancel\n" "Channel(s);Channel(s)\n" "ChannelPositions;Channel positions\n" "Chapter(s);Chapter(s)\n" "Chapters;Chapters\n" "Chapters stream(s);Chapters stream(s)\n" "Chapters_Codec_List;Chapters Codecs\n" "Chapters_No;No chapters\n" "ChaptersCount;Count of chapter streams\n" "CheckNewVersion;Check for new version\n" "Choose custom;Choose custom\n" "Choose custom sheet;Choose your desired custom sheet\n" "Choose custom text;Choose your desired custom text\n" "Choose export format;Choose your desired export format\n" "Choose file(s);Choose the files to open\n" "Choose filename;Choose your desired filename\n" "Choose language;Choose your desired language\n" "Choregrapher;Choregrapher\n" "Chroma;Chroma\n" "ChromaSubsampling;Chroma subsampling\n" "Close;Close\n" "Close all before open;Close all before open\n" "Codec;Codec\n" "Codec_Description;Codec description\n" "Codec_Info;Details for codec\n" "Codec_Settings;Codec settings\n" "Codec_Settings_PacketBitStream;Codec settings, Packet bitstream\n" "Codec_Settings_BVOP;Codec settings, BVOP\n" "Codec_Settings_QPel;Codec settings, QPel\n" "Codec_Settings_GMC;Codec settings, GMC\n" "Codec_Settings_Matrix;Codec settings, Matrix\n" "Codec_Settings_Floor;Codec settings, Floor\n" "Codec_Settings_CABAC;Codec settings, CABAC\n" "Codec_Settings_Firm;Codec settings, Firm\n" "Codec_Settings_Endianness;Codec settings, Endianness\n" "Codec_Settings_Sign;Codec settings, Sign\n" "Codec_Settings_Law;Codec settings, Law\n" "Codec_Settings_ITU;Codec settings, ITU\n" "Codec_Profile;Codec profile\n" "Codec_Url;Weblink for codec\n" "CodecID;Codec ID\n" "CodecID_Description;Description of the codec\n" "Collection;Collection\n" "Colorimetry;Colorimetry\n" "ColorSpace;Color space\n" "colour_primaries;Color primaries\n" "Comment;Comment\n" "CommissionedBy;Commissioned by\n" "Compilation;Compilation\n" "CompleteName;Complete name\n" "Composer;Composer\n" "Compression_Mode;Compression mode\n" "Compression_Mode_Lossless;Lossless\n" "Compression_Mode_Lossy;Lossy\n" "Compression_Ratio;Compression ratio\n" "Conductor;Conductor\n" "Container and general information;Container and general information\n" "ContentType;ContentType\n" "CoProducer;Coproducer\n" "Copyright;Copyright\n" "CostumeDesigner;Costume designer\n" "Count;Count\n" "Country;Country\n" "Cover;Cover\n" "Cover_Datas;Cover datas\n" "Cover_Description;Cover description\n" "Cover_Mime;Cover MIME\n" "Cover_Type;Cover type\n" "Cropped;Crop dimensions\n" "Custom;Custom\n" "Customize;Customize\n" "Date;Date\n" "Debug;Debug\n" "Decimal point;Decimal point\n" "Delay;Delay\n" "Delay_Source;Delay, origin\n" "Delay_Source_Container;Container\n" "Delay_Source_Stream;Raw stream\n" "Delete;Delete\n" "Description;Description\n" "Digitized_Date;Digitized date\n" "Dimensions;Dimensions\n" "Director;Director\n" "DirectorOfPhotography;Director of photography\n" "DisplayAspectRatio;Display aspect ratio\n" "DisplayAspectRatio_Original;Original display aspect ratio\n" "DistributedBy;Distributed by\n" "Donate;Donate\n" "DotsPerInch;Dots per inch\n" "Duration;Duration\n" "Duration_End;End time\n" "Duration_Start;Start time\n" "Edit;Edit\n" "EditedBy;Edited by\n" "EMail;E-Mail\n" "Encoded_Application;Writing application\n" "Encoded_Date;Encoded date\n" "Encoded_Library;Writing library\n" "Encoded_Library_Settings;Encoding settings\n" "Encoded_Original;Original support\n" "EncodedBy;Encoded by\n" "EPG_Positions;EPG positions (internal)\n" "Error_File;Error while reading file\n" "ExecutiveProducer;Executive producer\n" "Exit;Exit\n" "Exit_Hint;Quit the program\n" "Export;Export\n" "Export_Hint;Export in a customized format\n" "Extensions;Extensions usually used\n" "Family;Family\n" "Fax;Fax\n" "File;File\n" "File size;File size\n" "File_Append;Append to the existing file (Warning : be careful to have the same parameters)\n" "File_Created_Date;File creation date\n" "File_Created_Date_Local;File creation date (local)\n" "File_Hint;Select a multimedia file to examine\n" "File_Modified_Date;File last modification date\n" "File_Modified_Date_Local;File last modification date (local)\n" "FileExtension;File extension\n" "FileName;File name\n" "FileSize;File size\n" "Folder;Folder\n" "Folder (R);Folder (R)\n" "Folder (R)_Hint;Select a folder to examine (with all folders recursively)\n" "Folder (Recursively);Folder (Recursively)\n" "Folder_Hint;Select a folder to examine\n" "FolderName;Folder name\n" "Format;Format\n" "Format_Commercial;Commercial name\n" "Format_Commercial_IfAny;Commercial name\n" "Format_Description;Format description\n" "Format_Info;Details for format\n" "Format_Profile;Format profile\n" "Format_Settings;Format settings\n" "Format_Settings_PacketBitStream;Format settings, Packet bitstream\n" "Format_Settings_BVOP;Format settings, BVOP\n" "Format_Settings_QPel;Format settings, QPel\n" "Format_Settings_GMC;Format settings, GMC\n" "Format_Settings_Matrix;Format settings, Matrix\n" "Format_Settings_Matrix_Custom;Custom\n" "Format_Settings_Matrix_Default;Default\n" "Format_Settings_Floor;Format settings, Floor\n" "Format_Settings_CABAC;Format settings, CABAC\n" "Format_Settings_Firm;Format settings, Firm\n" "Format_Settings_Endianness;Format settings, Endianness\n" "Format_Settings_RefFrames;Format settings, ReFrames\n" "Format_Settings_Sign;Format settings, Sign\n" "Format_Settings_Law;Format settings, Law\n" "Format_Settings_ITU;Format settings, ITU\n" "Format_Settings_SBR;Format settings, SBR\n" "Format_Settings_PS;Format settings, PS\n" "Format_Settings_Pulldown;Format settings, Pulldown\n" "Format_Settings_Mode;Mode\n" "Format_Settings_FrameMode;Frame mode\n" "Format_Settings_Emphasis;Emphasis\n" "Format_Settings_ModeExtension;Mode extension\n" "Format_Settings_GOP;Format settings, GOP\n" "Format_Version;Format version\n" "Format_Url;Weblink for format\n" "FrameCount;Frame count\n" "FrameRate;Frame rate\n" "FrameRate_Mode;Frame rate mode\n" "FrameRate_Mode_CFR;Constant\n" "FrameRate_Mode_VFR;Variable\n" "FrameRate_Minimum;Minimum frame rate\n" "FrameRate_Nominal;Nominal frame rate\n" "FrameRate_Maximum;Maximum frame rate\n" "FrameRate_Original;Original frame rate\n" "General;General\n" "Genre;Genre\n" "Genre_000;Blues\n" "Genre_001;Classic Rock\n" "Genre_002;Country\n" "Genre_003;Dance\n" "Genre_004;Disco\n" "Genre_005;Funk\n" "Genre_006;Grunge\n" "Genre_007;Hip-Hop\n" "Genre_008;Jazz\n" "Genre_009;Metal\n" "Genre_010;New Age\n" "Genre_011;Oldies\n" "Genre_012;Other\n" "Genre_013;Pop\n" "Genre_014;R&B\n" "Genre_015;Rap\n" "Genre_016;Reggae\n" "Genre_017;Rock\n" "Genre_018;Techno\n" "Genre_019;Industrial\n" "Genre_020;Alternative\n" "Genre_021;Ska\n" "Genre_022;Death Metal\n" "Genre_023;Pranks\n" "Genre_024;Soundtrack\n" "Genre_025;Euro-Techno\n" "Genre_026;Ambient\n" "Genre_027;Trip-Hop\n" "Genre_028;Vocal\n" "Genre_029;Jazz+Funk\n" "Genre_030;Fusion\n" "Genre_031;Trance\n" "Genre_032;Classical\n" "Genre_033;Instrumental\n" "Genre_034;Acid\n" "Genre_035;House\n" "Genre_036;Game\n" "Genre_037;Sound Clip\n" "Genre_038;Gospel\n" "Genre_039;Noise\n" "Genre_040;Alt. Rock\n" "Genre_041;Bass\n" "Genre_042;Soul\n" "Genre_043;Punk\n" "Genre_044;Space\n" "Genre_045;Meditative\n" "Genre_046;Instrumental Pop\n" "Genre_047;Instrumental Rock\n" "Genre_048;Ethnic\n" "Genre_049;Gothic\n" "Genre_050;Darkwave\n" "Genre_051;Techno-Industrial\n" "Genre_052;Electronic\n" "Genre_053;Pop-Folk\n" "Genre_054;Eurodance\n" "Genre_055;Dream\n" "Genre_056;Southern Rock\n" "Genre_057;Comedy\n" "Genre_058;Cult\n" "Genre_059;Gangsta Rap\n" "Genre_060;Top 40\n" "Genre_061;Christian Rap\n" "Genre_062;Pop/Funk\n" "Genre_063;Jungle\n" "Genre_064;Native American\n" "Genre_065;Cabaret\n" "Genre_066;New Wave\n" "Genre_067;Psychedelic\n" "Genre_068;Rave\n" "Genre_069;Showtunes\n" "Genre_070;Trailer\n" "Genre_071;Lo-Fi\n" "Genre_072;Tribal\n" "Genre_073;Acid Punk\n" "Genre_074;Acid Jazz\n" "Genre_075;Polka\n" "Genre_076;Retro\n" "Genre_077;Musical\n" "Genre_078;Rock & Roll\n" "Genre_079;Hard Rock\n" "Genre_080;Folk\n" "Genre_081;Folk-Rock\n" "Genre_082;National Folk\n" "Genre_083;Swing\n" "Genre_084;Fast-Fusion\n" "Genre_085;Bebop\n" "Genre_086;Latin\n" "Genre_087;Revival\n" "Genre_088;Celtic\n" "Genre_089;Bluegrass\n" "Genre_090;Avantgarde\n" "Genre_091;Gothic Rock\n" "Genre_092;Progressive Rock\n" "Genre_093;Psychedelic Rock\n" "Genre_094;Symphonic Rock\n" "Genre_095;Slow Rock\n" "Genre_096;Big Band\n" "Genre_097;Chorus\n" "Genre_098;Easy Listening\n" "Genre_099;Acoustic\n" "Genre_100;Humour\n" "Genre_101;Speech\n" "Genre_102;Chanson\n" "Genre_103;Opera\n" "Genre_104;Chamber Music\n" "Genre_105;Sonata\n" "Genre_106;Symphony\n" "Genre_107;Booty Bass\n" "Genre_108;Primus\n" "Genre_109;Porn Groove\n" "Genre_110;Satire\n" "Genre_111;Slow Jam\n" "Genre_112;Club\n" "Genre_113;Tango\n" "Genre_114;Samba\n" "Genre_115;Folklore\n" "Genre_116;Ballad\n" "Genre_117;Power Ballad\n" "Genre_118;Rhythmic Soul\n" "Genre_119;Freestyle\n" "Genre_120;Duet\n" "Genre_121;Punk Rock\n" "Genre_122;Drum Solo\n" "Genre_123;A Cappella\n" "Genre_124;Euro-House\n" "Genre_125;Dance Hall\n" "Genre_126;Goa\n" "Genre_127;Drum & Bass\n" "Genre_128;Club-House\n" "Genre_129;Hardcore\n" "Genre_130;Terror\n" "Genre_131;Indie\n" "Genre_132;BritPop\n" "Genre_133;Afro-Punk\n" "Genre_134;Polsk Punk\n" "Genre_135;Beat\n" "Genre_136;Christian Gangsta Rap\n" "Genre_137;Heavy Metal\n" "Genre_138;Black Metal\n" "Genre_139;Crossover\n" "Genre_140;Contemporary Christian\n" "Genre_141;Christian Rock\n" "Genre_142;Merengue\n" "Genre_143;Salsa\n" "Genre_144;Thrash Metal\n" "Genre_145;Anime\n" "Genre_146;JPop\n" "Genre_147;Synthpop\n" "Genre_148;Abstract\n" "Genre_149;Art Rock\n" "Genre_150;Baroque\n" "Genre_151;Bhangra\n" "Genre_152;Big Beat\n" "Genre_153;Breakbeat\n" "Genre_154;Chillout\n" "Genre_155;Downtempo\n" "Genre_156;Dub\n" "Genre_157;EBM\n" "Genre_158;Eclectic\n" "Genre_159;Electro\n" "Genre_160;Electroclash\n" "Genre_161;Emo\n" "Genre_162;Experimental\n" "Genre_163;Garage\n" "Genre_164;Global\n" "Genre_165;IDM\n" "Genre_166;Illbient\n" "Genre_167;Industro-Goth\n" "Genre_168;Jam Band\n" "Genre_169;Krautrock\n" "Genre_170;Leftfield\n" "Genre_171;Lounge\n" "Genre_172;Math Rock\n" "Genre_173;New Romantic\n" "Genre_174;Nu-Breakz\n" "Genre_175;Post-Punk\n" "Genre_176;Post-Rock\n" "Genre_177;Psytrance\n" "Genre_178;Shoegaze\n" "Genre_179;Space Rock\n" "Genre_180;Trop Rock\n" "Genre_181;World Music\n" "Genre_182;Neoclassical\n" "Genre_183;Audiobook\n" "Genre_184;Audio Theatre\n" "Genre_185;Neue Deutsche Welle\n" "Genre_186;Podcast\n" "Genre_187;Indie Rock\n" "Genre_188;G-Funk\n" "Genre_189;Dubstep\n" "Genre_190;Garage Rock\n" "Genre_191;Psybient\n" "Go to WebSite;Go to website\n" "Grouping;Grouping\n" "h;h\n" "Header file;Create a header file\n" "Height;Height\n" "Height_Original;Original height\n" "Help;Help\n" "Hint;Hint\n" "How many audio streams?;How many audio streams?\n" "How many chapters streams?;How many chapters streams?\n" "How many text streams?;How many text streams?\n" "How many video streams?;How many video streams?\n" "HTML;HTML\n" "ID;ID\n" "Image;Image\n" "Image stream(s);Image streams\n" "Image_Codec_List;Codecs Image\n" "ImageCount;Count of image streams\n" "Info;Info\n" "Instruments;Instruments\n" "Interlacement;Interlacement\n" "Interlaced_Interlaced;Interlaced\n" "Interlaced_TFF;Top Field First\n" "Interlaced_BFF;Bottom Field First\n" "Interlaced_PPF;Progressive\n" "Interlaced_Progressive;Progressive\n" "Interleaved;Interleaved\n" "Interleave_Duration;Interleave, duration\n" "Interleave_Preload;Interleave, preload duration\n" "Interleave_VideoFrames;Interleave, duration\n" "InternetMediaType;Internet media type\n" "IRCA;IRCA\n" "ISBN;ISBN\n" "ISRC;ISRC\n" "Keywords;Keywords\n" "Known codecs;Known codecs\n" "Known formats;Known formats\n" "Known parameters;Known parameters\n" "Label;Label\n" "Language;Language\n" "Language_More;Language, more info\n" "Language_aa;Afar\n" "Language_ab;Abkhazian\n" "Language_ae;Avestan\n" "Language_af;Afrikaans\n" "Language_ak;Akan\n" "Language_am;Amharic\n" "Language_an;Aragonese\n" "Language_ar;Arabic\n" "Language_as;Assamese\n" "Language_av;Avaric\n" "Language_ay;Aymara\n" "Language_az;Azerbaijani\n" "Language_ba;Bashkir\n" "Language_be;Belarusian\n" "Language_bg;Bulgarian\n" "Language_bh;Bihari\n" "Language_bi;Bislama\n" "Language_bm;Bambara\n" "Language_bn;Bengali\n" "Language_bo;Tibetan\n" "Language_br;Breton\n" "Language_bs;Bosnian\n" "Language_ca;Catalan\n" "Language_ce;Chechen\n" "Language_ch;Chamorro\n" "Language_co;Corsican\n" "Language_cr;Cree\n" "Language_cs;Czech\n" "Language_cu;Slave\n" "Language_cv;Chuvash\n" "Language_cy;Welsh\n" "Language_da;Danish\n" "Language_de;German\n" "Language_dv;Divehi\n" "Language_dz;Dzongkha\n" "Language_ee;Ewe\n" "Language_el;Greek\n" "Language_en;English\n" "Language_en-gb;English (Great Britain)\n" "Language_en-us;English (United States)\n" "Language_eo;Esperanto\n" "Language_es;Spanish\n" "Language_et;Estonian\n" "Language_eu;Basque\n" "Language_fa;Persian\n" "Language_ff;Fulah\n" "Language_fi;Finnish\n" "Language_fj;Fijian\n" "Language_fo;Faroese\n" "Language_fr;French\n" "Language_fy;Frisian\n" "Language_ga;Irish\n" "Language_gd;Gaelic\n" "Language_gl;Galician\n" "Language_gn;Guarani\n" "Language_gu;Gujarati\n" "Language_gv;Manx\n" "Language_ha;Hausa\n" "Language_he;Hebrew\n" "Language_hi;Hindi\n" "Language_ho;Hiri Motu\n" "Language_hr;Croatian\n" "Language_ht;Haitian\n" "Language_hu;Hungarian\n" "Language_hy;Armenian\n" "Language_hz;Herero\n" "Language_ia;Auxiliary Language Association\n" "Language_id;Indonesian\n" "Language_ie;Interlingue\n" "Language_ig;Igbo\n" "Language_ii;Sichuan Yi\n" "Language_ik;Inupiaq\n" "Language_Info;Language info\n" "Language_io;Ido\n" "Language_is;Icelandic\n" "Language_it;Italian\n" "Language_iu;Inuktitut\n" "Language_ja;Japanese\n" "Language_jv;Javanese\n" "Language_ka;Georgian\n" "Language_kg;Kongo\n" "Language_ki;Kikuyu\n" "Language_kj;Kuanyama\n" "Language_kk;Kazakh\n" "Language_kl;Kalaallisut\n" "Language_km;Khmer\n" "Language_kn;Kannada\n" "Language_ko;Korean\n" "Language_kr;Kanuri\n" "Language_ks;Kashmiri\n" "Language_ku;Kurdish\n" "Language_kv;Komi\n" "Language_kw;Cornish\n" "Language_ky;Kirghiz\n" "Language_la;Latin\n" "Language_lb;Luxembourgish\n" "Language_lg;Ganda\n" "Language_li;Limburgish\n" "Language_ln;Lingala\n" "Language_lo;Lao\n" "Language_lt;Lithuanian\n" "Language_lu;Luba-Katanga\n" "Language_lv;Latvian\n" "Language_mg;Malagasy\n" "Language_mh;Marshallese\n" "Language_mi;Maori\n" "Language_mk;Macedonian\n" "Language_ml;Malayalam\n" "Language_mn;Mongolian\n" "Language_mo;Moldavian\n" "Language_mr;Marathi\n" "Language_ms;Malay\n" "Language_mt;Maltese\n" "Language_mul;Multiple languages\n" "Language_my;Burmese\n" "Language_na;Nauru\n" "Language_nb;Norwegian Bokmal\n" "Language_nd;Ndebele\n" "Language_ne;Nepali\n" "Language_ng;Ndonga\n" "Language_nl;Dutch\n" "Language_nn;Norwegian Nynorsk\n" "Language_no;Norwegian\n" "Language_nr;Ndebele\n" "Language_nv;Navaho\n" "Language_ny;Nyanja\n" "Language_oc;Occitan\n" "Language_oj;Ojibwa\n" "Language_om;Oromo\n" "Language_or;Oriya\n" "Language_os;Ossetic\n" "Language_pa;Panjabi\n" "Language_pi;Pali\n" "Language_pl;Polish\n" "Language_ps;Pushto\n" "Language_pt;Portuguese\n" "Language_pt-br;Portuguese (Brazil)\n" "Language_qu;Quechua\n" "Language_rm;Raeto-Romance\n" "Language_rn;Rundi\n" "Language_ro;Romanian\n" "Language_ru;Russian\n" "Language_rw;Kinyarwanda\n" "Language_sa;Sanskrit\n" "Language_sc;Sardinian\n" "Language_sd;Sindhi\n" "Language_se;Northern Sami\n" "Language_sg;Sango\n" "Language_si;Sinhala\n" "Language_sk;Slovak\n" "Language_sl;Slovenian\n" "Language_sm;Samoan\n" "Language_sn;Shona\n" "Language_so;Somali\n" "Language_sq;Albanian\n" "Language_sr;Serbian\n" "Language_ss;Swati\n" "Language_st;Sotho\n" "Language_su;Sundanese\n" "Language_sv;Swedish\n" "Language_sw;Swahili\n" "Language_ta;Tamil\n" "Language_te;Telugu\n" "Language_tg;Tajik\n" "Language_th;Thai\n" "Language_ti;Tigrinya\n" "Language_tk;Turkmen\n" "Language_tl;Tagalog\n" "Language_tn;Tswana\n" "Language_to;Tonga\n" "Language_tr;Turkish\n" "Language_ts;Tsonga\n" "Language_tt;Tatar\n" "Language_tw;Twi\n" "Language_ty;Tahitian\n" "Language_ug;Uighur\n" "Language_uk;Ukrainian\n" "Language_ur;Urdu\n" "Language_uz;Uzbek\n" "Language_ve;Venda\n" "Language_vi;Vietnamese\n" "Language_vo;Volapuk\n" "Language_wa;Walloon\n" "Language_wo;Wolof\n" "Language_xh;Xhosa\n" "Language_yi;Yiddish\n" "Language_yo;Yoruba\n" "Language_za;Zhuang\n" "Language_zh;Chinese\n" "Language_zh-cn;Chinese (China)\n" "Language_zh-tw;Chinese (Taiwan)\n" "Language_zu;Zulu\n" "LawRating;Law rating\n" "LCCN;LCCN\n" "Library;Muxing library\n" "Lightness;Lightness\n" "List;List\n" "Lyrics;Lyrics\n" "Lyricist;Lyricist\n" "Mastered_Date;Mastered date\n" "MasteredBy;Mastered by\n" "matrix_coefficients;Matrix coefficients\n" "MediaInfo_About;MediaInfo provides easy access to technical and tag information about video and audio files.\r\nExcept the Mac App Store graphical user interface, it is open-source software, which means that it is free of charge to the end user and developers have freedom to study, to improve and to redistribute the program (BSD license)\n" "Menu;Menu\n" "Menu stream(s);Menu streams\n" "Menu_Codec_List;Menu codecs\n" "Menu_No;No menu\n" "MenuCount;Count of menu streams\n" "Menu_Hint;More possibilities\n" "MenuID;Menu ID\n" "mn;mn\n" "Mood;Mood\n" "More;More\n" "Movie;Movie name\n" "ms;ms\n" "MSDI;MSDI\n" "MusicBy;Music by\n" "MuxingMode;Muxing mode\n" "MuxingMode_MoreInfo;Muxing mode, more info\n" "MuxingMode_PackedBitstream;Packed bitstream\n" "Name;Name\n" "Nationality;Nationality\n" "NetworkName;Network name\n" "New;New\n" "Newest version;Check for new versions (requires Internet connection)\n" "NewVersion_Menu;A new version is available\n" "NewVersion_Question_Title;A new version was released!\n" "NewVersion_Question_Content;A new version (v%Version%) is available, would you like to download it?\n" "No;No\n" "Not yet;Not yet\n" "NumColors;Number of colors\n" "OK;OK\n" "One output file per input file;One output file per input file\n" "Open;Open\n" "OpenCandy_01;Downloading ________\n" "OpenCandy_02;__% Complete\n" "OpenCandy_03;Internet connection interrupted\n" "OpenCandy_04;________ download complete\n" "OpenCandy_05;Click to install ________\n" "OpenCandy_06;Are you sure you wish to cancel the install?\r\nIf you wish to postpone the install until later, select 'No'.\r\nNote: You may select Exit from the menu to defer installation until after the next time you reboot.\n" "OpenCandy_07;Download of ________ has been paused.\r\nClick on the tray icon to resume downloading.\n" "OpenCandy_08;A critical error has occurred. Installation of _________ will be aborted.\n" "OpenCandy_09;Pause download\n" "OpenCandy_10;Cancel install\n" "OpenCandy_11;Resume download\n" "OpenCandy_12;Exit Installer\n" "OpenCandy_13;___________ - Recommended by ____________\n" "OpenCandy_14;Downloading _________\n" "OpenCandy_15;___________, the software recommended to you by ___________, is now downloading at your requestWe will let you know when it is ready to be installed.\n" "OpenCandy_16;___________ is ready for installation\n" "OpenCandy_17;___________ is now fully downloaded. Please click on 'Install' to proceed.\n" "OpenCandy_18;___________ of ___________ downloaded\n" "OpenCandy_19;Powered by OpenCandy\n" "OpenCandy_20;Learn more at OpenCandy.com\n" "OpenCandy_21;Install\n" "OpenCandy_22;Installation of ___________\n" "OpenCandy_23;This will cancel the installation of ___________\r\nAre you sure you wish to exit?\n" "OpenCandy_24;Pause\n" "OpenCandy_25;Your download has been paused. Click 'Resume' when you are ready to continue.\n" "OpenCandy_26;Resume\n" "OpenCandy_27;Install Now\n" "OpenCandy_28;Pause Download\n" "OpenCandy_29;Resume Download\n" "OpenCandy_30;Cancel Install\n" "OpenCandy_31;Please choose an installation option\n" "OpenCandy_32;Install ___________\n" "OpenCandy_33;Don't Install\n" "OpenCandy_34;Please select an install option\n" "OpenCandy_35;______ recommends this software\n" "OpenCandy_36;Your current installation will not be interrupted\n" "Options;Options\n" "Options_Hint;Preferences\n" "Original;Original\n" "OriginalNetworkName;Original network name\n" "OriginalSourceForm;Original source form\n" "OriginalSourceMedium;Original source medium\n" "Other;Other\n" "Output;Output\n" "Output format;Output format\n" "OverallBitRate;Overall bit rate\n" "OverallBitRate_Maximum;Maximum Overall bit rate\n" "OverallBitRate_Minimum;Minimum Overall bit rate\n" "OverallBitRate_Mode;Overall bit rate mode\n" "OverallBitRate_Nominal;Nominal Overall bit rate\n" "Part;Part\n" "Part_Count;Total count\n" "Performer;Performer\n" "Period;Period\n" "Phone;Phone\n" "PixelAspectRatio;Pixel aspect ratio\n" "PixelAspectRatio_Original;Original pixel aspect ratio\n" "PlayCounter;PlayCounter\n" "Played_Count;Times played\n" "Played_First_Date;First played\n" "Played_Last_Date;Last played\n" "PlayTime;PlayTime\n" "Position;Position\n" "Position_Total;Total\n" "Preferences;Preferences\n" "Producer;Producer\n" "ProductionDesigner;Production designer\n" "ProductionStudio;Production studio\n" "Publisher;Publisher\n" "Purchased_Date;purchased date\n" "Quote character;Quote character\n" "RadioStation;Radio station\n" "Rating;Rating\n" "Recorded_Date;Recorded date\n" "Recorded_Location;Recorded location\n" "Released_Date;Released date\n" "RemixedBy;Remixed by\n" "ReplayGain_Gain;Replay gain\n" "ReplayGain_Peak;Replay gain peak\n" "Resolution;Resolution\n" "s;s\n" "SamplingRate;Sampling rate\n" "Save;Save\n" "ScanType;Scan type\n" "ScanType_Original;Original scan type\n" "ScanOrder;Scan order\n" "ScanOrder_StoredDisplayedInverted;Scan order, stored/displayed inverted\n" "ScanOrder_Original;Original scan order\n" "ScreenplayBy;Screenplay by\n" "Season;Season\n" "see below;see below\n" "Send HeaderFile;Please send me the Header file here : http://sourceforge.net/projects/mediainfo/ (Bug section)\n" "Separator_Columns;columns separator\n" "Separator_Lines;lines separator\n" "ServiceChannel;Service channel number\n" "ServiceName;Service name\n" "ServiceProvider;Service provider\n" "ServiceType;Service type\n" "Set;Set\n" "Set_Count;Set count\n" "Setup;Setup\n" "Sharpness;Sharpness\n" "Sheet;Sheet\n" "Sheet (Complete);Sheet (Complete)\n" "Shell extension;Explorer extension (in Windows Explorer, right click on a file, there will be a MediaInfo option)\n" "Shell extension, folder;For folders too\n" "Shell InfoTip;Explorer Tooltip (in Windows Explorer, move the mouse over the file, info will be displayed)\n" "Show menu;Show menu\n" "Show toolbar;Show toolbar\n" "Sort;Sorted by\n" "SamplingCount;Samples count\n" "SoundEngineer;Sound engineer\n" "Source;Source\n" "Source_Duration;Source duration\n" "Source_FrameCount;Source frame count\n" "Source_SamplingCount;Source sample count\n" "Source_StreamSize;Source stream size\n" "Source_StreamSize_Encoded;Source encoded stream size\n" "Standard;Standard\n" "Stream;Stream\n" "Stream_MoreInfo;More information about the stream\n" "StreamCount;Count of stream of this kind\n" "StreamID;Stream ID\n" "StreamKind;Kind of stream\n" "StreamKindID;Stream identifier\n" "StreamKindPos;Stream identifier\n" "StreamSize;Stream size\n" "StreamSize_Encoded;Encoded stream size\n" "StreamSize_Proportion;Proportion of this stream\n" "Subject;Subject\n" "SubTrack;SubTrack\n" "Summary;Summary\n" "Supported formats;Supported formats\n" "Supported?;Supported?\n" "Synopsis;Synopsis\n" "SystemId;Id\n" "Tagged_Application;Tagging application\n" "Tagged_Date;Tagged date\n" "Technician;Technician\n" "TermsOfUse;Terms of use\n" "Text;Text\n" "Text - Custom;Text - Custom\n" "Text (HTML);Text (HTML)\n" "Text stream(s);Text streams\n" "Text streams;Text streams\n" "Text_Codec_List;Text codecs\n" "Text_No;No text\n" "Text1;First text stream\n" "Text2;Second text stream\n" "Text3;Third text stream\n" "TextCount;Count of text streams\n" "ThanksTo;Thanks to\n" "Thousands separator;Thousands separator\n" "Title;Title\n" "Title_More;Title, more info\n" "TimeCode;Time code\n" "TimeCode_FirstFrame;Time code of first frame\n" "TimeCode_Settings;Time code settings\n" "TimeCode_Source;Time code source\n" "TimeStamp;Time stamp\n" "TimeZone;Timezone\n" "Total;Total\n" "Track;Track name\n" "Track_Count;Track count\n" "transfer_characteristics;Transfer characteristics\n" "Translator;Translator\n" "Tree;Tree\n" "Tree & Text;Tree & Text\n" "Type;Type\n" "UniqueID;Unique ID\n" "Unknown;Unknown\n" "Url;Url\n" "Video;Video\n" "Video stream(s);Video stream(s)\n" "Video_Codec_List;Codecs Video\n" "Video_Delay;Delay relative to video\n" "Video_No;No video\n" "Video0_Delay;Video0 delay\n" "Video1;First video stream\n" "VideoCount;Count of video streams\n" "View;View\n" "View_Hint;Change the means of viewing information\n" "Warning : more streams in the files;Warning : there are more streams in the files\n" "Web;Web\n" "WebSite_Audio;Go to the web site of this audio codec\n" "WebSite_Audio_More;Go to the web site (%Url%) to find this audio codec\n" "WebSite_General;Go to the web site of a player for this file\n" "WebSite_General_More;Go to the web site of a player for this file\n" "WebSite_Text;Go to the web site of this text codec\n" "WebSite_Text_More;Go to the web site (%Url%) to find this text codec\n" "WebSite_Url;http://MediaArea.net/MediaInfo\n" "WebSite_Video;Go to the web site of this video codec\n" "WebSite_Video_More;Go to the web site (%Url%) to find this video codec\n" "Width;Width\n" "Width_Original;Original width\n" "WriteMe;Write mail to author\n" "WriteToTranslator;Write to translator\n" "Written_Date;Written date\n" "Written_Location;Written location\n" "WrittenBy;Written by\n" "Yes;Yes\n" "Your system;Your system\n" "ZZ_Automatic_Percent;100\n" "ZZ_AutomaticLanguage_Percent;100\n" )); Info.Separator_Set(0, ZenLib::EOL); } //--------------------------------------------------------------------------- void MediaInfo_Config_Format (InfoMap &Info) { Info.Separator_Set(0, __T("\n")); Info.Write(Ztring().From_UTF8( "AAF;;;M;Aaf;;aaf;;\n" "AIFF;;;M;Riff;Apple/SGI;aiff aifc aif;audio/x-aiff;\n" "AMV;;;M;Riff;Chinese hack of AVI;amv;;http://en.wikipedia.org/wiki/AMV_video_format\n" "AVI;;;M;Riff;Audio Video Interleave;avi;video/vnd.avi;\n" "BDAV;;;M;Bdav;Blu-ray Video;m2ts;;\n" "Blu-ray Clip info;;;M;Bdmv;;clpi;;\n" "Blu-ray Index;;;M;Bdmv;;bdmv;;\n" "Blu-ray Movie object;;;M;Bdmv;;bdmv;;\n" "Blu-ray Playlist;;;M;Bdmv;;mpls;;\n" "CDDA;;;M;Riff;;cda;;\n" "CDXA;;;M;Cdxa;;dat;;\n" "DASH MPD;;;M;DashMpd;;mpd;application/dash+xml;;Lossy\n" "DV;;;M;DvdDif;;dv dif;video/DV;;Lossy\n" "DivX;;;M;Riff;Hack of AVI;divx;video/vnd.avi;http://www.divx.com\n" "DPG;;;M;Dpg;Nintendo DS;dpg;;\n" "DVD Video;;;M;Dvdv;;ifo;;\n" "Flash Video;;;M;Flv;;flv;application/x-shockwave-flash;http://www.macromedia.com/go/getflashplayer\n" "GXF;;;M;Gxf;SMPTE 360M;gxf;;\n" "HDS F4M;Flash Media Manifest;;M;HdsF4m;;f4m\n" "HLS;;;M;Hls;;m3u8;\n" "Google Video;;;M;Riff;Hack of AVI;gvi;;http://video.google.com/playerdownload.html\n" "ISM;Internet Streaming Media;;M;Ism;;ism;;\n" "IVF;;;M;Ivf;;ivf;;\n" "LXF;;;M;Lxf;;lxf;video/lxf;\n" "Matroska;;;M;Mk;;mkv mk3d mka mks;;http://packs.matroska.org/\n" "MPEG-PS;;;M;MpegPs;;mpeg mpg m2p vob pss;video/MP2P;\n" "MPEG-TS;;;M;MpegTs;;ts m2t m2s m4t m4s ts tp trp;video/MP2T;\n" "MPEG-4;;;M;Mpeg4;;mp4 m4v m4a m4b m4p 3gpp 3gp 3gpp2 3g2 k3g jpm jpx mqv ismv isma f4v;video/mp4;\n" "MTV;;;M;Other;Chinese hack of MPEG-1 layer 3;mtv;;http://en.wikipedia.org/wiki/Chinese_MP4/MTV_Player\n" "MXF;;;M;Mxf;;mxf;application/mxf;\n" "NSV;;;M;Nsv;Nullsoft Streaming Video;nsv;;http://winamp.com\n" "Ogg;;;M;Ogg;;ogg ogm opus;video/ogg;http://www.free-codecs.com/Ogg_DirectShow_Filters_download.htm\n" "PMP;;;M;Pmp;Playstation Portable;pmp;;\n" "QuickTime;;;M;Mpeg4;Original Apple specifications;mov qt;video/quicktime;http://www.apple.com/quicktime/download/standalone.html\n" "RealMedia;;;M;Rm;;rm rmvb ra;application/vnd.rn-realmedia;\n" "RIFF-MMP;;;M;Riff;RIFF Multimedia Movie;;;\n" "ShockWave;;;M;Swf;;swf;application/x-shockwave;http://www.macromedia.com/go/getflashplayer\n" "SKM;;;M;Skm;Sky Korean Mobilephone;skm;;http://www.isky.co.kr/html/cs/download.jsp\n" "Windows Media;;;M;Wm;;asf wmv wma;video/x-ms-wmv;\n" "WebM;;;M;Mkv;;webm;video/webm;http://www.webmproject.org/\n" "AVC;;;V;Avc;Advanced Video Codec;avc h264;video/H264;http://developers.videolan.org/x264.html\n" "AVS Video;;;V;AvsV;Audio Video Standart, Video part;;;http://www.avs.org.cn/;Lossy\n" "Dirac;;;V;Dirac;;drc;;http://diracvideo.org/;Lossy\n" "FFV1;;;V;;;;;;Lossless\n" "FFV2;;;V;;;;;;Lossless\n" "FLC;;;V;Flic;;fli flc;;http://www.chem.nott.ac.uk/flc.html;Lossy\n" "FLI;;;V;Flic;;fli flc;;http://www.chem.nott.ac.uk/flc.html;Lossy\n" "FLIC;;;V;Flic;;fli flc;;http://www.chem.nott.ac.uk/flc.html;Lossy\n" "H.261;;;V;;;h261;video/H261;;Lossy\n" "H.263;;;V;;;h263;video/H263;;Lossy\n" "HEVC;;;V;Hevc;High Efficiency Video Coding;avc h264;video/H265;http://www.itu.int\n" "MPEG Video;;;V;Mpegv;;mpgv mpv mp1v m1v mp2v m2v;video/MPV;;Lossy\n" "MPEG-4 Visual;;;V;Mpeg4;;m4v mp4v;video/MP4V-ES;;Lossy\n" "Theora;;;V;;;;;http://www.theora.org/;Lossy\n" "VC-1;;;V;Vc1;;vc1;video/vc1;;Lossy\n" "YUV4MPEG2;;;V;Y4m;;y4m;;;Lossless\n" "VP8;;;V;;;;;http://www.webmproject.org/;Lossy\n" "YUV;;;V;;;;;;Lossless\n" "AAC;;;A;;Advanced Audio Codec;;;;Lossy\n" "AC-3;;;A;Ac3;Audio Coding 3;ac3;;;Lossy\n" "ADIF;;;A;Adif;Audio Data Interchange Format;;;\n" "ADTS;;;A;Adts;Audio Data Transport Stream;aac;;\n" "ALS;;;A;Als;MPEG-4 Audio Lossless Coding;als;;http://www.nue.tu-berlin.de/forschung/projekte/lossless/mp4als.html#downloads;Lossless\n" "AMR;;;A;Amr;Adaptive Multi-Rate;amr;audio/AMR;http://www.apple.com/quicktime/download/standalone.html\n" "Atrac;;;A;;;;audio/ATRAC;;Lossy\n" "Atrac3;;;A;;;;audio/ATRAC3;;Lossy\n" "AU;;;A;Au;uLaw/AU Audio File;au;audio/basic;\n" "DolbyE;;;A;Aes3;;dde\n" "DTS;;;A;Dts;Digital Theater Systems;dts;;;Lossy\n" "DTS-HD;;;A;Dts;Digital Theater Systems;dts;;;Lossy\n" "E-AC-3;;;A;Ac3;Audio Coding 3;dd+ ec3;audio/eac3;;Lossy\n" "Extended Module;;;A;ExtendedModule;;xm;;\n" "FLAC;;;A;Flac;Free Lossless Audio Codec;flac;;http://flac.sourceforge.net/\n" "G.719;;;A;;;;audio/G719;;Lossy\n" "G.722;;;A;;;;audio/G722;;Lossy\n" "G.722.1;;;A;;;;audio/G7221;;Lossy\n" "G.723;;;A;;;;audio/G723;;Lossy\n" "G.729;;;A;;;;audio/G729;;Lossy\n" "G.729.1;;;A;;;;audio/G7291;;Lossy\n" "Impulse Tracker;;;A;ImpulseTracker;;it;;\n" "LA;;;A;La;Lossless Audio Codec;la;;http://www.lossless-audio.com/;Lossless\n" "MIDI;;;A;Riff;RIFF Musical Instrument Digital Interface;midi mid kar;audio/midi;\n" "Module;;;A;Module;;mod;;\n" "Monkey's Audio;;;A;Ape;;ape mac;;http://www.monkeysaudio.com/;Lossless\n" "MPEG Audio;;;A;Mpega;;m1a mpa1 mp1 m2a mpa2 mp2 mp3;audio/mpeg;;Lossy\n" "Musepack SV7;;;A;Mpc;;mpc;;http://www.musepack.net;Lossy\n" "Musepack SV8;;;A;Mpc;;mp+;;http://www.musepack.net;Lossy\n" "QCELP;;;A;;;;audio/QCELP;\n" "RIFF-MIDI;;;A;Riff;RIFF Musical Instrument Digital Interface;;;\n" "RKAU;RK Audio;;A;Rkau;;rka;;http://www.msoftware.co.nz\n" "Scream Tracker 3;;;A;S3m;;s3m;;\n" "Shorten;;;A;;;shn;;http://etree.org/shnutils/shorten/;Lossless\n" "SLS;;;A;;MPEG-4 Scalable Lossless Coding;sls;;http://www.chiariglione.org/mpeg/technologies/mp04-sls/index.htm;Lossless\n" "Speex;;;A;;;;audio/speex;http://www.speex.org/;Lossy\n" "Opus;;;A;;;;audio/opus;http://opus-codec.org/;Lossy\n" "TAK;;;A;;;tak;;http://thbeck.de/Tak/Tak.html;Lossless\n" "TrueHD;;;A;Ac3;;dts;;;Lossless\n" "TwinVQ;;;A;TwinVQ;Transform domain Weighted INterleave Vector Quantization;vqf;;http://www.twinvq.org/english/index_en.html\n" "Vorbis;;;A;;;;audio/vorbis;http://www.vorbis.com/;Lossy\n" "Wave;;;A;Riff;;wav;audio/vnd.wave;\n" "Wave64;;;A;Riff;;w64;;\n" "WavPack;;;A;Wvpk;;wv wvc;;http://www.wavpack.com\n" "Bitmap;;;I;Bmp;;bmp;image/bmp;;Lossless\n" "DPX;;;I;Dpx;;dpx cin;;;Lossless\n" "EXR;;;I;Exr;;exr;;;Lossless\n" "DIB;;;I;Riff;RIFF Device Independent Bitmap;;;;Lossless\n" "GIF;;;I;Gif;Graphics Interchange Format;gif;image/gif;;Lossless\n" "ICO;;;I;Ico;;ico;image/vnd.microsoft.icon;;Lossless\n" "JNG;;;I;Jng;JPEG Network Graphic;jng;;;Lossy\n" "JPEG;;;I;Jpeg;;jpeg jpg jpe;image/jpeg;;Lossy\n" "JPEG 2000;;;I;Jpeg;;jp2;image/jp2;http://www.morgan-multimedia.com/JPEG 2000/\n" "LZ77;;;I;;;;;\n" "MNG;;;I;Mng;Multiple-Image Network Graphic;mng;;;Lossless\n" "PCX;;;I;pcx;Personal Computer eXchange;pcx;image/pcx;;Lossless\n" "PNG;;;I;Png;Portable Network Graphic;png;image/png;;Lossless\n" "PSD;;;I;Psd;Photoshop File Format;psd;image/psd;http://www.adobe.com/;Lossless\n" "RIFF Palette;;;I;Riff;RIFF Palette;;;\n" "RLE;;;I;;Run-length encoding;rle;;\n" "TIFF;;;I;Tiff;;tiff tif;image/tiff;\n" "TGA;;;I;Tga;;tga;image/tga;\n" "7-Zip;;;C;7z;;7z;;http://7-zip.org\n" "ACE;;;C;Ace;;ace;;http://winace.com\n" "ELF;;;C;Elf;;so;;\n" "ISO 9660;;;C;Iso9660;;iso;;\n" "MZ;;;C;Mz;;exe dll;;\n" "RAR;;;C;Rar;From Rarlabs;rar;application/x-rar-compressed;http://rarlabs.com\n" "ZIP;;;C;Zip;;zip;application/zip;http://winzip.com\n" "Adobe encore DVD;;;T;Other;;txt;;http://www.adobe.fr/products/encore/;Lossless\n" "AQTitle;;;T;Other;;aqt;;http://www.volny.cz/aberka/czech/aqt.html;Lossless\n" "ASS;;;T;Other;;ssa;;http://ffdshow.sourceforge.net/tikiwiki/tiki-index.php?page=Getting+ffdshow;Lossless\n" "Captions 32;;;T;Other;;txt;;;Lossless\n" "Captions Inc;;;T;Other;;txt;;;Lossless\n" "CPC Captioning;;;T;Other;;txt;;http://www.cpcweb.com/Captioning/cap_software.htm;Lossless\n" "Cheeta;;;T;Other;;asc;;;Lossless\n" "N19;;;T;N19;;stl;;;Lossless\n" "SAMI;;;T;Sami;;smi sami;;;Lossless\n" "SCC;;;T;SCC;;scc sc2;;;Lossless\n" "SubRip;;;T;SubRip;;srt;;http://ffdshow.sourceforge.net/tikiwiki/tiki-index.php?page=Getting+ffdshow;Lossless\n" "TTML;;;T;TTML;;dfxp;;;Lossless\n" "SSA;;;T;Other;;ssa;;http://ffdshow.sourceforge.net/tikiwiki/tiki-index.php?page=Getting+ffdshow;Lossless\n" "Blender;;;O;Other;;blenders;;http://www.blender3d.com\n" "AutoCAD;;;O;Other;;;;http://www.autodesk.com\n" "PlayLater Video;;;V;Other;;;;http://www.playon.tv/playlater\n" )); Info.Separator_Set(0, ZenLib::EOL); } //--------------------------------------------------------------------------- void MediaInfo_Config_CodecID_General_Mpeg4 (InfoMap &Info) { Info.Separator_Set(0, __T("\n")); Info.Write(Ztring().From_UTF8( "M4V ;MPEG-4;;;\n" "isom;MPEG-4;;;http://www.apple.com/quicktime/download/standalone.html;Base Media\n" "iso2;MPEG-4;;;http://www.apple.com/quicktime/download/standalone.html;Base Media\n" "iso4;MPEG-4;;;http://www.apple.com/quicktime/download/standalone.html;Base Media\n" "mp41;MPEG-4;;;http://www.apple.com/quicktime/download/standalone.html;Base Media / Version 1\n" "mp42;MPEG-4;;;http://www.apple.com/quicktime/download/standalone.html;Base Media / Version 2\n" "avc1;MPEG-4;;;http://www.apple.com/quicktime/download/standalone.html;JVT\n" "3gp1;MPEG-4;;;http://www.3gpp.org/;3GPP Media Release 1\n" "3gp2;MPEG-4;;;http://www.3gpp.org/;3GPP Media Release 2\n" "3gp3;MPEG-4;;;http://www.3gpp.org/;3GPP Media Release 3\n" "3gp4;MPEG-4;;;http://www.3gpp.org/;3GPP Media Release 4\n" "3gp5;MPEG-4;;;http://www.3gpp.org/;3GPP Media Release 5\n" "3gp6;MPEG-4;;;http://www.3gpp.org/;3GPP Media Release 6 Basic\n" "3gp6;MPEG-4;;;http://www.3gpp.org/;3GPP Media Release 6 Progressive Download\n" "3gp6;MPEG-4;;;http://www.3gpp.org/;3GPP Media Release 6 Streaming Servers\n" "3gp7;MPEG-4;;;http://www.3gpp.org/;3GPP Media Release 7 Streaming Servers\n" "3g2a;MPEG-4;;;http://www.3gpp2.org/;3GPP2 Media\n" "3ge6;MPEG-4;;;http://www.3gpp.org/;3GPP Release 6 MBMS Extended Presentation\n" "3ge7;MPEG-4;;;http://www.3gpp.org/;3GPP Release 7 MBMS Extended Presentation\n" "3gg6;MPEG-4;;;http://www.3gpp.org/;3GPP Release 6 General\n" "3gp8;MPEG-4;;;http://www.apple.com/quicktime/download/standalone.html\n" "3gp9;MPEG-4;;;http://www.apple.com/quicktime/download/standalone.html\n" "CAQV;MPEG-4;;;http://world.casio.com/;Casio\n" "FACE;MPEG-4;;;http://www.apple.com/quicktime/download/standalone.html;Facebook\n" "isml;MPEG-4;IIS Smooth Streaming file format;;http://www.apple.com/quicktime/download/standalone.html;ISML\n" "JP20;MPEG-4;;;http://gpac.sourceforge.net/;JPEG 2000\n" "JPM ;MPEG-4;;;http://www.iso.org/;JPEG 2000 Compound Image\n" "JPX ;MPEG-4;;;http://www.iso.org/;JPEG 2000 w/ extensions\n" "KDDI;MPEG-4;;;http://www.3gpp2.org/;3GPP2 EZMovie for KDDI 3G Cellphones\n" "MJ2S;MPEG-4;;;http://www.iso.org/;Motion JPEG 2000 Simple Profile\n" "MJP2;MPEG-4;;;http://www.iso.org/;Motion JPEG 2000 General Profile\n" "MQT ;MPEG-4;;;http://www.sony.com/;Sony/Mobile QuickTime\n" "MSNV;MPEG-4;;;http://www.sony.com/;Sony PSP\n" "ndas;MPEG-4;;;http://www.nerodigital.com;Nero Digital AAC Audio\n" "ndsc;MPEG-4;;;http://www.nerodigital.com;Nero Digital Cinema Profile\n" "ndsh;MPEG-4;;;http://www.nerodigital.com;Nero Digital HDTV Profile\n" "ndsm;MPEG-4;;;http://www.nerodigital.com;Nero Digital Mobile Profile\n" "ndsp;MPEG-4;;;http://www.nerodigital.com;Nero Digital Portable Profile\n" "ndss;MPEG-4;;;http://www.nerodigital.com;Nero Digital Standard Profile\n" "ndxc;MPEG-4;;;http://www.nerodigital.com;Nero Digital AVC Cinema Profile\n" "ndxh;MPEG-4;;;http://www.nerodigital.com;Nero Digital AVC HDTV Profile\n" "ndxm;MPEG-4;;;http://www.nerodigital.com;Nero Digital AVC Mobile Profile\n" "ndxp;MPEG-4;;;http://www.nerodigital.com;Nero Digital AVC Portable Profile\n" "ndxs;MPEG-4;;;http://www.nerodigital.com;Nero Digital AVC Standard Profile\n" "mmp4;MPEG-4;;;http://www.apple.com/quicktime/download/standalone.html;Mobile version\n" "mp71;MPEG-4;;;http://www.apple.com/quicktime/download/standalone.html;ISO 14496-12 MPEG-7 meta data\n" "mp7b;MPEG-4;;;http://www.apple.com/quicktime/download/standalone.html;ISO 14496-12 MPEG-7 meta data\n" "piff;MPEG-4;Protected Interoperable File Format;;http://www.apple.com/quicktime/download/standalone.html;PIFF\n" "qt ;MPEG-4;;;http://www.apple.com/quicktime/download/standalone.html;QuickTime\n" "SDV ;MPEG-4;;;http://www.sdcard.org/;SD Memory Card Video\n" "M4A ;MPEG-4;;;http://www.apple.com/itunes/;Apple audio with iTunes info\n" "M4B ;MPEG-4;;;http://www.apple.com/itunes/;Apple audio with iTunes position\n" "M4P ;MPEG-4;;;http://www.apple.com/itunes/;AES encrypted audio\n" "M4VP;MPEG-4;;;http://www.apple.com/iphone/;Apple iPhone\n" "iphE;MPEG-4;;;http://www.apple.com/iphone/;Apple iPhone (Cellular)\n" "M4VH;MPEG-4;;;http://www.apple.com/appletv/;Apple TV\n" "QTCA;MPEG-4;;;http://www.apple.com/quicktime/download/standalone.html;Quicktime compressed archive\n" "CAQV;MPEG-4;;;;Casio Digital Camera\n" "QTI ;MPEG-4;;;http://www.apple.com/quicktime/download/standalone.html;QuickTime Image\n" "f4v ;MPEG-4;;;http://www.apple.com/quicktime/download/standalone.html;Adobe Flash\n" )); Info.Separator_Set(0, ZenLib::EOL); } //--------------------------------------------------------------------------- void MediaInfo_Config_CodecID_Video_Matroska (InfoMap &Info) { Info.Separator_Set(0, __T("\n")); Info.Write(Ztring().From_UTF8( "V_UNCOMPRESSED;RGB;;Raw uncompressed video frames\n" "V_DIRAC;Dirac;;;http://diracvideo.org/\n" "V_MPEG4/IS0/SP;MPEG-4 Visual;;There is a zero instead of a O, may be a problem;http://www.divx.com\n" "V_MPEG4/IS0/ASP;MPEG-4 Visual;;There is a zero instead of a O, may be a problem;http://www.xvid.org/Downloads.15.0.html\n" "V_MPEG4/IS0/AP;MPEG-4 Visual;;There is a zero instead of a O, may be a problem;http://ffdshow-tryout.sourceforge.net/\n" "V_MPEG4/IS0/AVC;AVC;;There is a zero instead of a O, may be a problem;http://ffdshow-tryout.sourceforge.net/\n" "V_MPEG4/ISO/SP;MPEG-4 Visual;;Simple Profile;http://www.divx.com\n" "V_MPEG4/ISO/ASP;MPEG-4 Visual;;Advanced Simple Profile;http://www.xvid.org/Downloads.15.0.html\n" "V_MPEG4/ISO/AP;MPEG-4 Visual;;Advanced Profile;http://ffdshow-tryout.sourceforge.net/\n" "V_MPEG4/ISO/AVC;AVC;;;http://ffdshow-tryout.sourceforge.net/\n" "V_MPEGH/ISO/HEVC;HEVC;;\n" "V_MPEG4/MS/V2;MPEG-4 Visual;MS MPEG-4 v2;MS MPEG-4 v2;http://ffdshow-tryout.sourceforge.net/\n" "V_MPEG4/MS/V3;MPEG-4 Visual;MS MPEG-4 v3;MS MPEG-4 v3;http://ffdshow-tryout.sourceforge.net/\n" "V_MPEG1;MPEG Video;;MPEG 1 or 2 Video;http://ffdshow-tryout.sourceforge.net/\n" "V_MPEG2;MPEG Video;;MPEG 1 or 2 Video;http://ffdshow-tryout.sourceforge.net/\n" "V_PRORES;ProRes;;;http://www.apple.com/quicktime/download/standalone.html\n" "V_REAL/RV10;RealVideo 1;;RealVideo 1.0 aka RealVideo 5;http://www.real.com\n" "V_REAL/RV20;RealVideo 2;;RealVideo 2.0 aka G2 and RealVideo G2+SVT;http://www.real.com\n" "V_REAL/RV30;RealVideo 3;;RealVideo 3.0 aka RealVideo 8;http://www.real.com\n" "V_REAL/RV40;RealVideo 4;;RealVideo 4.0 aka RealVideo 9;http://www.real.com\n" "V_THEORA;Theora;;;http://www.theora.org\n" "V_VP8;VP8;;;http://www.webmproject.org/\n" "V_VP9;VP9;;;http://www.webmproject.org/\n" )); Info.Separator_Set(0, ZenLib::EOL); } //--------------------------------------------------------------------------- void MediaInfo_Config_CodecID_Video_Mpeg4 (InfoMap &Info) { Info.Separator_Set(0, __T("\n")); Info.Write(Ztring().From_UTF8( "2vuy;YUV;;;;;;YUV;4:2:2\n" "2Vuy;YUV;;;;;;YUV;4:2:2\n" "8BPS;RGB;;;;;;RGB;8:8:8\n" "ac16;YUV;;;;;;YUV;4:2:2\n" "ac32;YUV;;;;;;YUV;4:2:2\n" "acBG;YUV;;;;;;YUV;4:2:2\n" "apch;ProRes;;;http://www.apple.com/quicktime/download/standalone.html;High;;YUV;4:2:2\n" "apcn;ProRes;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n" "apcs;ProRes;;;http://www.apple.com/quicktime/download/standalone.html;LT;;YUV;4:2:2\n" "apco;ProRes;;;http://www.apple.com/quicktime/download/standalone.html;Proxy;;YUV;4:2:2\n" "ap4c;ProRes;;;http://www.apple.com/quicktime/download/standalone.html;;;;4:4:4\n" "ap4h;ProRes;;;http://www.apple.com/quicktime/download/standalone.html;;;;4:4:4\n" "ai12;AVC;;Advanced Video Coding;http://ffdshow-tryout.sourceforge.net;;\n" "ai15;AVC;;Advanced Video Coding;http://ffdshow-tryout.sourceforge.net;;\n" "ai1q;AVC;;Advanced Video Coding;http://ffdshow-tryout.sourceforge.net;;\n" "ai5q;AVC;;Advanced Video Coding;http://ffdshow-tryout.sourceforge.net;;\n" "AV1x;YUV;;;;;;YUV;4:2:2\n" "avc1;AVC;;Advanced Video Coding;http://www.apple.com/quicktime/download/standalone.html;;;\n" "avcp;AVC;;Advanced Video Coding Parameters;http://www.apple.com/quicktime/download/standalone.html;;;\n" "AVDJ;JPEG;;Avid\n" "AVdv;DV;;Avid;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n" "AVdn;VC-3;DNxHD;Avid;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n" "AVmp;MPEG Video;Avid IMX;;;;Version 2;;\n" "avr ;JPEG;;;;;;\n" "b16g;Gray;;;;;;Y;16\n" "b32a;Gray/Alpha;;;;;;YA;16:16\n" "b48r;RGB;;;;;;RGB;16:16:16\n" "b64a;RGBA;;;;;;RGBA;16:16:16:16\n" "base;RGBA;;;;;;RGBA;16:16:16:16\n" "blit;RGBA;;;;;;RGBA;16:16:16:16\n" "blnd;Alpha Compositor;;;;;;\n" "blur;Blur;;;;;;CMYK\n" "CFHD;CineForm;;CineForm High-Definition (HD) wavelet codec;http://www.cineform.com/;;;\n" "CHQX;Canopus HQX;;;;;;\n" "CLLC;Canopus Lossless;;;;;;\n" "CUVC;Canopus HQ;;;;;;\n" "cmyk;CMYK;;;;;;\n" "cvid;Cinepack;;;http://www.apple.com/quicktime/download/standalone.html;;;\n" "drac;Dirac;;Dirac Video Coder;http://www.bbc.co.uk/rd/projects/dirac/index.shtml;;;\n" "dslv;Cross Fade;;;http://www.apple.com/quicktime/download/standalone.html;;;\n" "DV10;Digital Voodoo;;Digital Voodoo 10 bit Uncompressed 4:2:2 codec;http://www.digitalvoodoo.net/;;;\n" "dv5n;DV;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n" "dv5p;DV;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n" "dvc ;DV;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n" "dvcp;DV;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n" "dvh1;DV;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n" "dvh2;DV;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n" "dvh3;DV;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n" "dvh4;DV;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n" "dvh5;DV;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n" "dvh6;DV;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n" "dvhp;DV;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n" "dvhq;DV;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n" "DVOO;Digital Voodoo;;Digital Voodoo 8 bit Uncompressed 4:2:2 codec;http://www.digitalvoodoo.net/;;;\n" "DVOR;Digital Voodoo;;Digital Voodoo intermediate raw;http://www.digitalvoodoo.net/;;;\n" "dvpp;DV;DVCPRO;;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n" "DVTV;Digital Voodoo;;Digital Voodoo intermediate 2vuy;http://www.digitalvoodoo.net/;;;\n" "DVVT;Digital Voodoo;;Digital Voodoo intermediate v210;http://www.digitalvoodoo.net/;;;\n" "encv;(Encrypted);;;http://www.apple.com/quicktime/download/standalone.html;;;\n" "gif ;M-GIF;;;;;;\n" "Hap1;Hap;;Hap Video Codec;https://github.com/Vidvox/hap;;;\n" "Hap5;Hap Alpha;;Hap Video Codec;https://github.com/Vidvox/hap;;;\n" "HapY;Hap Q;;Hap Video Codec;https://github.com/Vidvox/hap;;;\n" "h261;H.261;;;http://www.apple.com/quicktime/download/standalone.html;;;\n" "h263;H.263;;;http://www.apple.com/quicktime/download/standalone.html;;;\n" "H263;H.263;;;http://www.apple.com/quicktime/download/standalone.html;;;\n" "h264;H.264;;;http://www.apple.com/quicktime/download/standalone.html;;;\n" "hcpa;ProRes;;;http://www.apple.com/quicktime/download/standalone.html;High;;YUV;4:2:2\n" "HD10;Digital Voodoo;;Digital Voodoo 10 bit Uncompressed 4:2:2 HD codec;http://www.digitalvoodoo.net/;;;\n" "hdv1;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "hdv2;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "hdv3;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "hdv4;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "hdv5;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "hdv6;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "hdv7;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "hdv8;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "hdv9;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "hdva;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "hdvb;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "hdvc;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "hdvd;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "hdve;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "hdvf;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "hvc1;HEVC;;High Efficiency Video Coding;http://www.itu.int/;;;\n" "hev1;HEVC;;High Efficiency Video Coding;http://www.itu.int/;;;\n" "icod;AIC;;Apple Intermediate Codec;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:0\n" "j420;YUV;;;;;;YUV;4:2:0\n" "jpeg;JPEG;;;http://www.apple.com/quicktime/download/standalone.html;;;\n" "kpcd;Photo CD;;;;;;\n" "LMP2;MPEG Video;;;;;;YUV\n" "M105;Matrox;;;http://www.matrox.com/;;;\n" "MMES;MPEG Video;;;;;;YUV\n" "mmes;MPEG Video;;;;;;YUV\n" "mjp2;JPEG 2000;;;;;;\n" "mjpa;JPEG;;;;;;\n" "mjpb;JPEG;;;;;;\n" "mp4v;MPEG-4 Visual;;;;;;\n" "mpeg;MPEG Video;;;;;;\n" "mx3n;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "mx3p;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "mx4n;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "mx4p;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "mx5n;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "mx5p;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "myuv;YUV;;;;;;YUV;4:2:0\n" "ncpa;ProRes;;;http://www.apple.com/quicktime/download/standalone.html;Normal;;YUV;4:2:2\n" "ovc1;VC-1;;Smooth Streaming Media Video;http://alexzambelli.com/blog/2009/02/10/smooth-streaming-architecture/;;;\n" "png ;PNG;;;;;;\n" "PIM1;MPEG Video;;;;;;YUV\n" "PIM2;MPEG Video;;;;;;YUV\n" "PNTG;MacPaint;;Apple MacPaint image format;http://www.apple.com/quicktime/download/standalone.html;;;\n" "raw ;RGB;;;http://www.apple.com/quicktime/download/standalone.html;;;RGB\n" "rle ;RLE;;;http://www.apple.com/quicktime/download/standalone.html;;;RGB\n" "rpza;Road Pizza;;;http://www.apple.com/quicktime/download/standalone.html;;;\n" "s263;H.263;;;http://www.apple.com/quicktime/download/standalone.html;;;\n" "Shr0;SheerVideo;;Generic SheerVideo codec;http://www.bitjazz.com/;;;\n" "Shr1;SheerVideo;;SheerVideo RGB;http://www.bitjazz.com/;;;\n" "Shr2;SheerVideo;;SheerVideo Y'CbCr[A] 4:4:4;http://www.bitjazz.com/;;;\n" "Shr3;SheerVideo;;SheerVideo Y'CbCr 4:2:2;http://www.bitjazz.com/;;;\n" "Shr4;SheerVideo;;SheerVideo Y'CbCr 4:2:2;http://www.bitjazz.com/;;;\n" "SV10;Sorenson;;Sorenson Media Video R1;http://www.apple.com/quicktime/download/standalone.html;;;\n" "SVQ1;Sorenson 1;;Sorenson Media Video 1 (Apple QuickTime 3);http://www.apple.com/quicktime/download/standalone.html;;;\n" "SVQ2;Sorenson 2;;Sorenson Media Video 2 (Apple QuickTime 4);http://www.apple.com/quicktime/download/standalone.html;;;\n" "SVQ3;Sorenson 3;;Sorenson Media Video 3 (Apple QuickTime 5);http://www.apple.com/quicktime/download/standalone.html;;;\n" "v210;YUV;AJA Video Systems Xena;;;;;YUV;4:2:2\n" "vc-1;VC-1;;SMPTE VC-1;http://www.smpte.org/;;;YUV\n" "WMV3;VC-1;WMV3;Windows Media Video 9;http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx;;;\n" "WRLE;Bitmap;;Windows BMP image format;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xd50;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xd51;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xd52;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xd53;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xd54;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xd55;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xd56;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xd57;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xd58;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xd59;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xd5a;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xd5b;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xd5c;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xd5d;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xd5e;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xd5f;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdhd;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdh2;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdv0;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdv1;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdv2;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdv3;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdv4;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdv5;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdv6;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdv7;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdv8;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdv9;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdva;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdvb;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdvc;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdvd;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdve;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "xdvf;MPEG Video;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "yuv2;YUV;;;;;;YUV;4:2:2\n" "yuvs;YUV;;;;;;YUV;4:2:2\n" "yuvu;YUV;;;;;;YUV;4:2:2\n" "yuvx;YUV;;;;;;YUV;4:2:2\n" )); Info.Separator_Set(0, ZenLib::EOL); } //--------------------------------------------------------------------------- void MediaInfo_Config_CodecID_Video_Real (InfoMap &Info) { Info.Separator_Set(0, __T("\n")); Info.Write(Ztring().From_UTF8( "RV10;RealVideo 1;;Based on H.263, Real Player 5;http://www.real.com\n" "RV13;RealVideo 1.3;;Based on H.263, Real Player 5;http://www.real.com\n" "RV20;RealVideo 2;;Based on H.263, Real Player 6;http://www.real.com\n" "RV30;RealVideo 3;;Between H.263 and AVC (H.264), Real Player 8;http://www.real.com\n" "RV40;RealVideo 4;;Based on AVC (H.264), Real Player 9;http://www.real.com\n" )); Info.Separator_Set(0, ZenLib::EOL); } //--------------------------------------------------------------------------- void MediaInfo_Config_CodecID_Video_Riff (InfoMap &Info) { Info.Separator_Set(0, __T("\n")); Info.Write(Ztring().From_UTF8( "0x00000000;RGB;;Basic Windows bitmap format. 1, 4 and 8 bpp versions are palettised. 16, 24 and 32bpp contain raw RGB samples;http://www.fourcc.org/indexrgb.htm;;;;\n" "0x00000001;RLE;;Run length encoded 8bpp RGB image;http://www.fourcc.org/indexrgb.htm;;;;\n" "0x00000002;RLE;;Run length encoded 4bpp RGB image;http://www.fourcc.org/indexrgb.htm;;;;\n" "0x00000003;RGB;;Raw RGB with arbitrary sample packing within a pixel. Packing and precision of R, G and B components is determined by bit masks for each;http://www.fourcc.org/indexrgb.htm;;;;\n" "1978;RGB;A.M.Paredes predictor;;http://www.pegasusimaging.com/cgi-bin/download2.cgi?LVIDB;;;RGB;\n" " BIT;RGB;;;;;;RGB;\n" " JPG;JPEG;;;;;;YUV\n" " PNG;PNG;;;;;;RGB;\n" " RAW;RGB;;;http://www.fourcc.org/indexrgb.htm;;;RGB;\n" " raw;RGB;;;http://www.fourcc.org/indexrgb.htm;;;RGB;\n" " RGB;RGB;;;http://www.fourcc.org/indexrgb.htm;;;RGB;\n" " RL4;RLE;;;http://www.fourcc.org/indexrgb.htm;;;RGB;;4\n" " RL8;RLE;;;http://www.fourcc.org/indexrgb.htm;;;RGB;;8\n" "2VUY;YUV;Optibase VideoPump;;;;;YUV;4:2:2\n" "3IV0;MPEG-4 Visual;3ivX;3ivX pre-1.0;http://www.3ivx.com/download/;;;YUV;4:2:0\n" "3IV1;MPEG-4 Visual;3ivX;3ivX 1.0-3.5;http://www.3ivx.com/download/;;;YUV;4:2:0\n" "3IV2;MPEG-4 Visual;3ivX;3ivX 4.0;http://www.3ivx.com/download/;;;YUV;4:2:0\n" "3IVD;MPEG-4 Visual;3ivX;;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "3IVX;MPEG-4 Visual;3ivX;;http://www.3ivx.com/download/;;;YUV;4:2:0\n" "3VID;MPEG-4 Visual;3ivX;;http://www.3ivx.com/download/;;;YUV;4:2:0\n" "8BPS;RGB;Apple;;http://ffdshow-tryout.sourceforge.net/;;;RGBA\n" "AAS4;RLE;Autodesk;;http://mirror01.iptelecom.net.ua/~video/codecs/Autodesk.Animator.v1.11.Codec.exe;;;RGB\n" "AASC;RLE;Autodesk;;http://mirror01.iptelecom.net.ua/~video/codecs/Autodesk.Animator.v1.11.Codec.exe;;;RGB\n" "ABYR;Kensigton low;Kensington;Low resolution, low frame rate (6fps) for digital cameras;;;;\n" "ACTL;ACT-L2;Streambox;;http://www.streambox.com/products/act-L2_codec.htm;;;\n" "ADV1;WaveCodec;Loronix;;http://www.loronix.com/products/video_clips/wavecodec.asp;;;\n" "ADVJ;JPEG;Avid;;;;;YUV\n" "AEIK;Indeo 3.2;;Vector Quantization;;;;\n" "AEMI;MPEG Video;VideoONE;MPEG-1-I Capture;http://www.array.com;;;YUV;4:2:0\n" "AFLC;FLC;Autodesk;;http://mirror01.iptelecom.net.ua/~video/codecs/Autodesk.Animator.v1.11.Codec.exe;;;\n" "AFLI;FLI;Autodesk;;http://mirror01.iptelecom.net.ua/~video/codecs/Autodesk.Animator.v1.11.Codec.exe;;;\n" "AHDV;CineForm;CineForm HD;;http://www.cineform.com/products/ConnectHD.htm;;;\n" "AJPG;JPEG;;22fps for digital cameras;;;;YUV\n" "ALPH;Ziracom;;Ziracom Digital Communications Inc.;;;;\n" "AMM2;AMV2 MT;AMV2 MT Video Codec Version 2;;http://amamaman.hp.infoseek.co.jp/english/amv2_e.html;;;\n" "AMPG;MPEG-1;VideoONE;;http://www.array.com;;;YUV;4:2:0\n" "AMR ;AMR;;Speech codec;;;;\n" "AMV3;AMV3;AMV3 Video Codec Version 3;;http://amamaman.hp.infoseek.co.jp/english/amv2_e.html;;;YUV;4:2:0\n" "ANIM;RDX;Intel;;;;;\n" "AP41;MPEG-4 Visual;AngelPotion;Hack of MS MPEG-4 v3;http://www.divxity.com/download/ap4v1-702.exe;;;YUV;4:2:0\n" "AP42;MPEG-4 Visual;AngelPotion;Hack of MS MPEG-4 v3;http://www.divxity.com/download/ap4v1-702.exe;;;YUV;4:2:0\n" "ASLC;AlparySoft Lossless;;;http://www.free-codecs.com/download/Alparysoft_Lossless_Video_Codec.htm;;;\n" "ASV1;Asus 1;;;ftp://ftp.asuscom.de/pub/asuscom/treiber/vga/ASUS_VGA_TOOLS/asv2dec.zip;;;\n" "ASV2;Asus 2;;;ftp://ftp.asuscom.de/pub/asuscom/treiber/vga/ASUS_VGA_TOOLS/asv2dec.zip;;;\n" "ASVX;Asus X;;;ftp://ftp.asuscom.de/pub/asuscom/treiber/vga/ASUS_VGA_TOOLS/asv2dec.zip;;;\n" "ATM4;MPEG-4 Visual;Nero;;http://www.nero.com;;;YUV;4:2:0\n" "AUR2;YUV;;Auravision Aura 2;;;;YUV;4:2:2\n" "AURA;YUV;;Auravision Aura 1;;;;YUV;4:1:1\n" "AUVX;AUVX;;USH GmbH;;;;\n" "AV1X;Avid 1:1;;;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe;;;\n" "AVC1;AVC;;;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "avc1;AVC;;;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "AVD1;DV;Avid;;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe;;;YUV;\n" "AVDJ;JPEG;Avid;;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe;;;YUV\n" "AVDN;Avid HD;;;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe;;;;\n" "AVDV;DV;Avid;;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe;;;YUV;\n" "AVI1;JPEG;MainConcept;;;;;YUV\n" "AVI2;JPEG;MainConcept;;;;;YUV\n" "AVID;JPEG;Avid;;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe;;;YUV\n" "AVIS;AviSynth;;Wrapper for AviSynth (Dummy);http://ffdshow-tryout.sourceforge.net/;;;;\n" "AVMP;Avid IMX;;;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe;;;;\n" "AVR ;JPEG;Avid NuVista;Avid ABVB/NuVista JPEG with Alpha-channel;;;;YUV\n" "AVRn;JPEG;Avid JPEG;;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe;;;YUV\n" "AVRN;JPEG;Avid JPEG;;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe;;;YUV\n" "AVUI;Avid;;Avid Meridien Uncompressed with Alpha-channel;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe;;;;\n" "AVUP;Avid;;Avid 10bit Packed (Quick Time);http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe;;;;\n" "AYUV;YUV;YUV;;;;;YUVA;4:4:4;8\n" "AZPR;QuickTime;;;http://www.apple.com/quicktime/download/standalone.html;;;\n" "AZRP;QuickTime;;;http://www.apple.com/quicktime/download/standalone.html;;;\n" "BGR ;RGB;RGB;;;;;RGB\n" "BHIV;BeHere iVideo;;;;;;\n" "BINK;Bink;;;;;;\n" "BIT ;RGB;RGB;;;;;RGB\n" "BITM;H.261;Microsoft;;;;;YUV\n" "BLOX;MPEG Video;Blox;;http://www.ii.uj.edu.pl/~jezabek/blox/blox-0.1.0b.zip;;;YUV;4:2:0\n" "BLZ0;MPEG-4 Visual;DivX;DivX for Blizzard Decoder Filter;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "BT20;MediaStream;;Conexant ProSummer MediaStream;;;;\n" "BTCV;Composite;;Conexant Composite Video;;;;\n" "BTVC;Composite;;Conexant Composite Video;;;;\n" "BW00;Wavelet;BergWave;;;;;\n" "BW10;MPEG-1;Broadway;Data Translation Broadway MPEG Capture/Compression;;;;YUV\n" "BXBG;RGB;Boxx;;;;;RGB\n" "BXRG;RGB;Boxx;;;;;RGB\n" "BXY2;YUV;Boxx;10-bit;;;;YUV\n" "BXYV;YUV;Boxx;;;;;YUV\n" "CC12;YUV;Intel;;;;;YUV\n" "CDV5;DV;Canopus;Canopus SD50/DVHD;http://www.cineform.com/products/ConnectHD.htm;;;YUV\n" "CDVC;DV;Canopus;Canopus DV (DV);http://www.cineform.com/products/ConnectHD.htm;;;YUV\n" "CDVH;DV;Canopus;Canopus SD50/DVHD;http://www.cineform.com/products/ConnectHD.htm;;;YUV\n" "CFCC;JPEG;DPS Perception;Dummy format - only AVI header;;;;YUV\n" "CFHD;CineForm;;CineForm 10-bit Visually Perfect HD (Wavelet);;;;\n" "CGDI;Camcorder;;Camcorder Video (MS Office 97);;;;\n" "CHAM;Champagne;;Winnov Caviara Champagne;;;;\n" "CHQX;Canopus HQX;;;;;;\n" "CJPG;JPEG;Creative;Creative Video Blaster Webcam Go JPEG;;;;YUV\n" "CLJR;YUV;Cirrus Logic;Less than 8 bits per Y, U and V sample.;http://www.fourcc.org/indexyuv.htm;;;YUV;4:1:1\n" "CLLC;Canopus Lossless;;;;;;\n" "CLPL;YUV;;Format similar to YV12 but including a level of indirection.;;;;YUV\n" "CM10;MediaShow;;CyberLink Corporation;http://www.cyberlink.com;;;\n" "CMYK;CMYK;;Common Data Format in Printing;;;;\n" "COL0;MPEG-4 Visual;;Hacked MS MPEG-4 v3;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "COL1;MPEG-4 Visual;;Hacked MS MPEG-4 v3;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "CPLA;YUV;Weitek;;;;;YUV;4:2:0\n" "CRAM;MS Video;;Microsoft Video 1;;;;\n" "CSCD;CamStudio;;RenderSoft CamStudio lossless (LZO & GZIP compression);;;;\n" "CT10;TalkingShow;;CyberLink Corporation;http://www.cyberlink.com;;;\n" "CTRX;Citrix;;Citrix Scalable Video;;;;\n" "CUVC;Canopus HQ;;;;;;\n" "CVID;Cinepack;;;http://www.cinepak.com/text.html;;;\n" "cvid;Cinepack;;;http://www.cinepak.com/text.html;;;\n" "CWLT;WLT;;Microsoft Color WLT DIB;;;;\n" "CYUV;YUV;Creative Labs;;http://www.fourcc.org/indexyuv.htm;;;YUV;4:2:2\n" "cyuv;YUV;;;http://www.fourcc.org/indexyuv.htm;;;YUV;4:2:2\n" "CYUY;YUV;ATI;;http://www.fourcc.org/indexyuv.htm;;;YUV;4:2:2\n" "D261;H.261;DEC;;;;;\n" "D263;H.263;DEC;;;;;\n" "DAVC;AVC;Dicas;;;;;YUV;4:2:0\n" "DC25;DV;MainConcept;;;;;YUV\n" "DCAP;DV;Pinnacle;;;;;YUV\n" "DCL1;Data Connextion;;Conferencing;;;;\n" "DCT0;WniWni;;;;;;\n" "DFSC;VFW;;DebugMode FrameServer VFW;;;;\n" "DIB ;RGB;;;;;;RGB\n" "DIV1;MPEG-4 Visual;FFMpeg;Hacked MS MPEG-4 V1;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "DIV2;MPEG-4 Visual;MS MPEG-4 1/2;;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "DIV3;MPEG-4 Visual;DivX 3 Low;;http://www.divx.com;;;YUV;4:2:0\n" "DIV4;MPEG-4 Visual;DivX 3 Fast;;http://www.divx.com;;;YUV;4:2:0\n" "DIV5;MPEG-4 Visual;DivX 5;;http://www.divx.com;;;YUV;4:2:0\n" "DIV6;MPEG-4 Visual;MS MPEG-4 v3;;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "DIVX;MPEG-4 Visual;DivX 4;Project Mayo;http://mediaarea.net/DIVX;;;YUV;4:2:0\n" "divx;MPEG-4 Visual;DivX;Mainly used by Google;http://www.divx.com;;;YUV;4:2:0\n" "DJPG;JPEG;Broadway 101;Data Translation, Inc.;;;;YUV\n" "DM4V;MPEG-4 Visual;Dicas;;;;;YUV;4:2:0\n" "DMB1;JPEG;Rainbow;Matrox Rainbow Runner hardware compression;http://mirror01.iptelecom.net.ua/~video/codecs/PICVideo.MJPG.v2.10.27.codec.exe;;;YUV\n" "DMB2;JPEG;Paradigm;;;;;YUV\n" "DMK2;V36 PDA;;ViewSonic V36 PDA Video;;;;\n" "DP02;MPEG-4 Visual;DynaPel;;;;;YUV;4:2:0\n" "DP16;YUV;Matsushita;With DPCM 6-bit compression;;;;YUV;4:1:1\n" "DP18;YUV;Matsushita;With DPCM 8-bit compression;;;;YUV;4:1:1\n" "DP26;YUV;Matsushita;With DPCM 6-bit compression;;;;YUV;4:2:2\n" "DP28;YUV;Matsushita;With DPCM 8-bit compression;;;;YUV;4:2:2\n" "DP96;YUV;Matsushita;With DPCM 6-bit compression;;;;YUV\n" "DP98;YUV;Matsushita;With DPCM 8-bit compression;;;;YUV\n" "DP9L;YUV;Matsushita;With DPCM 6-bit compression;;;;YUV\n" "DPS0;JPEG;DPS Reality;Dummy format - only AVI header;;;;YUV\n" "DPSC;JPEG;DPS PAR;Dummy format - only AVI header;;;;YUV\n" "DRWX;DV;Pinnacle;;;;;YUV\n" "DSVD;DV;Microsoft;;;;;YUV\n" "DTMT;Media-100;;;;;\n" "DTNT;Media-100;;;;;\n" "DUCK;TrueMotion S;Duck Corporation;;;;\n" "DV10;RGB;BlueFish;BlueFish444 (lossless RGBA, YUV 10-bit);;;;RGB\n" "DV25;DV;DVCPro;;;;;YUV\n" "dv25;DV;DVCPro;;;;;YUV\n" "DV50;DV;DVCPro5;;;;;YUV\n" "dv50;DV;DVCPro5;;;;;YUV\n" "DVAN;DV;Pinnacle DV300;;;;;YUV\n" "DVC ;DV;Apple;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "DVCP;DV;Apple;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "DVCS;DV;MainConcept;;;;;YUV\n" "DVE2;DV;Insoft DVE-2;InSoft DVE-2 Videoconferencing;;;;YUV\n" "DVH1;DV;Pinnacle;;;;;YUV\n" "dvhd;DV;HD;;;;;YUV\n" "DVIS;DV;DualMoon;;;;;YUV\n" "DVL ;DV;Radius;;;;;YUV\n" "DVLP;DV;Radius;;;;;YUV\n" "DVMA;DV;Darim;;;;;YUV\n" "DVNM;DVNM;;Matsushita Electric Industrial Co., Ltd.;;;;\n" "DVOR;RGB;BlueFish;BlueFish444 (lossless RGBA, YUV 10-bit);;;;RGB\n" "DVPN;DV;Apple;;;;;YUV\n" "DVPP;DV;Apple;;;;;YUV\n" "DVR ;MPEG Video;ASF;;;;;YUV;4:2:0\n" "DVR1;Targa2000;;;;;;\n" "DVRS;DV;DualMoon;;;;;YUV\n" "dvsd;DV;Sony;;;;;YUV\n" "dvsl;DV;Sony;;;;;YUV\n" "DVSL;DV;;;;;;YUV\n" "DVX1;DVX 1 SP;;Lucent DVX1000SP Video Decoder;;;;\n" "DVX2;DVX 2 S;;Lucent DVX2000S Video Decoder;;;;\n" "DVX3;DVX 3 S;;Lucent DVX3000S Video Decoder;;;;\n" "DX50;MPEG-4 Visual;DivX 5;;http://mediaarea.net/DX50;;;YUV;4:2:0\n" "DXGM;EA GameVideo;;;;;;\n" "DXT1;DirectX TC;;DirectX Compressed Texture (1bit alpha channel)\n" "DXT2;DirectX TC;;DirectX Compressed Texture\n" "DXT3;DirectX TC;;DirectX Compressed Texture (4bit alpha channel)\n" "DXT4;DirectX TC;;DirectX Compressed Texture\n" "DXT5;DirectX TC;;DirectX Compressed Texture (3bit alpha channel with interpolation)\n" "DXTC;DirectX TC;;DirectX Texture Compression\n" "DXTn;DirectX TC;;Microsoft Compressed Texture\n" "DXTN;DirectX TC;;Microsoft DirectX Compressed Texture (DXTn)\n" "EKQ0;Elsa KQ;;Elsa graphics card quick\n" "ELK0;Elsa LK;;Elsa graphics card\n" "EM2V;Elymonyx MPEG-2;;Etymonix MPEG-2 I-frame\n" "EQK0;Elsa;;Elsa graphics card quick\n" "ESCP;Escape;;Eidos Escape\n" "ETV1;eTreppid 1;;eTreppid Video 1\n" "ETV2;eTreppid 2;;eTreppid Video 2\n" "ETVC;eTreppid C;;eTreppid Video C\n" "FFDS;FFDS;;;http://ffdshow-tryout.sourceforge.net/;;;\n" "FFV1;FFV1;;;http://ffdshow-tryout.sourceforge.net/;;;\n" "FFV2;FFV2;;;http://ffdshow-tryout.sourceforge.net/;;;\n" "FFVH;FFVH;;;http://ffdshow-tryout.sourceforge.net/;;;\n" "FLIC;FLI/FLC;Autodesk;;;;;\n" "FLJP;DField JPEG;;D-Vision Field Encoded JPEG with LSI (or Targa emulation);;;;\n" "FLV1;Sorenson Spark;;;http://ffdshow-tryout.sourceforge.net/;;;\n" "FLV4;VP6;On2;;http://ftp.pub.cri74.org/pub/win9x/video/codecs/VP6/vp6_vfw_codec.exe;Heightened Sharpness;;\n" "FMJP;JPEG;D-Vision;;;;;YUV\n" "FMP4;MPEG-4 Visual;;;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "FPS1;Fraps;;;http://www.fraps.com/;;;\n" "FRLE;JPEG;SoftLab-Nsk;SoftLab-NSK Y16 + Alpha RLE;;;;YUV\n" "FRWA;JPEG;SoftLab-Nsk;SoftLab-NSK Vision Forward JPEG with Alpha-channel;;;;YUV\n" "FRWD;JPEG;SoftLab-Nsk;SoftLab-NSK Vision Forward JPEG;;;;YUV\n" "FRWT;JPEG;SoftLab-Nsk;SoftLab-NSK Vision Forward JPEG with Alpha-channel;;;;YUV\n" "FRWU;JPEG;SoftLab-Nsk;SoftLab-NSK Vision Forward Uncompressed;;;;YUV\n" "FVF1;Itered Fractal;;;;;;\n" "FVFW;FVFW;;;http://ffdshow-tryout.sourceforge.net/;;;\n" "FXT1;3DFX;;;;;;\n" "G2M2;GoToMeeting2;;Citrix Systems, Inc.;http://www.gotomeeting.com/;;;\n" "G2M3;GoToMeeting3;;Citrix Systems, Inc.;http://www.gotomeeting.com/;;;\n" "GEPJ;JPEG;White Pine;;;;;YUV\n" "GJPG;Grand Tech GT891x;;;;;;\n" "GLCC;GigaLink;;;;;;\n" "GLZW;LZW;Gabest;;http://sourceforge.net/project/showfiles.php?group_id=82303&package_id=84358;;;\n" "GMP4;GeoVision Advanced MPEG-4;;;http://www.geovision.com.tw/;;;\n" "GM40;GeoVision Advanced MPEG-4;;;http://www.geovision.com.tw/;;;\n" "GPEG;JPEG;Gabest;;http://sourceforge.net/project/showfiles.php?group_id=82303&package_id=84358;;;YUV\n" "GPJM;JPEG;Pinnacle;;;;;YUV\n" "GREY;YUV;;Simple grayscale video;http://www.fourcc.org/indexyuv.htm;;;YUV\n" "GWLT;MS GWLT;;Microsoft Greyscale WLT DIB;;;;\n" "GXVE;ViVD V2;SoftMedia;;;;;\n" "H260;H.260;;;;;;\n" "H261;H.261;;;;;;\n" "H262;MPEG Video;;;;;;YUV;4:2:0\n" "H263;H.263;;;;;;\n" "h263;H.263;;;http://www.apple.com/quicktime/download/standalone.html;;;\n" "H264;AVC;;;;;;YUV;4:2:0\n" "h264;AVC;;;;;;YUV;4:2:0\n" "H265;H.265;;;;;;\n" "H266;H.266;;;;;;\n" "H267;H.267;;;;;;\n" "H268;H.268;;;;;;\n" "H269;H.263;;;;;;\n" "HD10;RGB;BlueFish;BlueFish444 (lossless RGBA, YUV 10-bit);;;;RGB\n" "HDX4;Jomigo HDX4;;;;;;\n" "HFYU;Huffman;;;;;;\n" "HMCR;Rendition;;Rendition Motion Compensation Format;;;;\n" "HMRR;Rendition;;Rendition Motion Compensation Format;;;;\n" "i263;H.263;;;;;;\n" "I420;YUV;;8 bit Y plane followed by 8 bit 2x2 subsampled U and V planes.;;;;\n" "IAN ;Indeo 4;;;;;;\n" "ICLB;CellB;;InSoft CellB Videoconferencing;;;;\n" "IDM0;Wavelets 2;;IDM Motion Wavelets 2.0;;;;\n" "IF09;H.261;Microsoft;;;;;\n" "IFO9;YUV;Intel;;;;;YUV\n" "IGOR;PowerDVD;;;;;;\n" "IJPG;JPEG;Intergraph;;;;;YUV\n" "ILVC;Layered Video;Intel;;;;;\n" "ILVR;H.263+;;;;;;\n" "IMAC;MotionComp;;Intel hardware motion compensation.;;;;\n" "IMC1;YUV;;As YV12, except the U and V planes each have the same stride as the Y plane;;;;YUV\n" "IMC2;YUV;;Similar to IMC1, except that the U and V lines are interleaved at half stride boundaries;;;;YUV\n" "IMC3;YUV;;As IMC1, except that U and V are swapped;;;;YUV\n" "IMC4;YUV;;As IMC2, except that U and V are swapped;;;;YUV\n" "IMG ;YUV;;;;;;YUV\n" "IMJG;Accom JPEG;;Accom SphereOUS JPEG with Alpha-channel;;;;\n" "IPDV;I-O DV;;I-O Data Device Giga AVI DV;;;\n" "IPJ2;JPEG 2000;;Image Power JPEG 2000;;;\n" "IR21;Indeo 2.1;;;;;\n" "IRAW;YUV;;;http://www.fourcc.org/indexyuv.htm;;;YUV\n" "ISME;ISME;;Intel;;;\n" "IUYV;YUV;;Lead 16bpp. Interlaced version of UYVY (line order 0, 2, 4,....,1, 3, 5....);;;;YUV\n" "IV30;Indeo 3;;Intel Indeo Video 3;;;\n" "IV31;Indeo 3;;Intel Indeo Video 3.1;;;\n" "IV32;Indeo 3;;Intel Indeo Video 3.2;;;\n" "IV33;Indeo 3;;Intel Indeo Video 3.3;;;\n" "IV34;Indeo 3;;Intel Indeo Video 3.4;;;\n" "IV35;Indeo 3;;Intel Indeo Video 3.5;;;\n" "IV36;Indeo 3;;Intel Indeo Video 3.6;;;\n" "IV37;Indeo 3;;Intel Indeo Video 3.7;;;\n" "IV38;Indeo 3;;Intel Indeo Video 3.8;;;\n" "IV39;Indeo 3;;Intel Indeo Video 3.9;;;\n" "IV40;Indeo 4;;Intel Indeo Video 4.0;;;\n" "IV41;Indeo 4;;Intel Indeo Video 4.1;;;\n" "IV42;Indeo 4;;Intel Indeo Video 4.2;;;\n" "IV43;Indeo 4;;Intel Indeo Video 4.3;;;\n" "IV44;Indeo 4;;Intel Indeo Video 4.4;;;\n" "IV45;Indeo 4;;Intel Indeo Video 4.5;;;\n" "IV46;Indeo 4;;Intel Indeo Video 4.6;;;\n" "IV47;Indeo 4;;Intel Indeo Video 4.7;;;\n" "IV48;Indeo 4;;Intel Indeo Video 4.8;;;\n" "IV49;Indeo 4;;Intel Indeo Video 4.9;;;\n" "IV50;Indeo 4;;Intel Indeo Video 5.0 Wavelet;http://www.fourcc.org/indexyuv.htm;;\n" "IY41;YUV;;Lead 16bpp. Interlaced version of Y41P (line order 0, 2, 4,....,1, 3, 5....);http://www.fourcc.org/indexyuv.htm;;;YUV\n" "IYU1;YUV;;IEEE1394 12bpp. 12 bit format used in mode 2 of the IEEE 1394 Digital Camera 1.04 spec;http://www.fourcc.org/indexyuv.htm;;;YUV\n" "IYU2;YUV;;IEEE1394 24bpp. 24 bit format used in mode 2 of the IEEE 1394 Digital Camera 1.04 spec;;;;YUV\n" "IYUV;YUV;;Intel Indeo iYUV 4:2:0;;;;YUV\n" "JBYR;Kensington;;Kensington Video;http://ffdshow-tryout.sourceforge.net/;;\n" "JFIF;JPEG;;;;;;YUV\n" "JPEG;JPEG;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n" "JPG;JPEG;;;http://mirror01.iptelecom.net.ua/~video/codecs/PICVideo.Lossless.JPEG.codec.v2.10.27.exe;;;YUV\n" "JPGL;JPEG;Pegasus;DIVIO JPEG Light for WebCams (Pegasus Lossless JPEG);;;;YUV\n" "KMVC;Karl;;Karl Morton's Video (presumably);http://www.apple.com/quicktime/download/standalone.html;;;\n" "kpcd;Photo CD;;Kodak Photo CD;;;;\n" "L261;H.261;Lead Technologies;;;;;\n" "L263;H.263+;Lead Technologies;;;;;\n" "LAGS;Lagarith;;;;;;\n" "LBYR;Creative WebCam;;;;;;\n" "LCMW;Lead CMW;;Lead Technologies Motion CMW;;;;\n" "LCW2;Lead MCMW;;LEADTools MCMW 9Motion Wavelet;http://mirror01.iptelecom.net.ua/~video/codecs/LEAD.MCMP-JPEG.v1.016.codec.exe;;;\n" "LEAD;Lead Video;;;;;;\n" "LGRY;Lead GrayScale;;;;;;\n" "LIA1;Liafail;;Liafail, Inc.;;;;\n" "LJ2K;JPEG 2000;Lead;;http://mirror01.iptelecom.net.ua/~video/codecs/LEAD.MCMP-JPEG.v1.016.codec.exe;;;\n" "LJPG;JPEG;Lead;;http://mirror01.iptelecom.net.ua/~video/codecs/LEAD.MCMP-JPEG.v1.016.codec.exe;;;YUV\n" "Ljpg;JPEG;Lead;;;;;YUV\n" "LMP2;MPEG-PS;Lead;;;;;\n" "LOCO;LOCO;;Lossless;;;;\n" "LSCR;Lead Screen capture;;;;;;\n" "LSV0;LSV0;;Infinop Inc.;;;;\n" "LSVC;Vmail;;Vianet Lighting Strike Vmail (Streaming);;;;\n" "LSVM;Vmail;;Vianet Lighting Strike Vmail (Streaming);;;;\n" "LSVW;Infinop;;Infinop Lightning Strike multiple bit rate video codec.;;;;\n" "LSVX;Vmail;;Vianet Lightning Strike Video Codec;;;;\n" "LZO1;LZO;;LZO compressed (lossless);;;;\n" "M101;YUV;Matrox;;;;;YUV\n" "M261;H.261;Microsoft;;;;;\n" "M263;H.263;Microsoft;;;;;\n" "M4CC;MPEG-4 Visual;ESS Divo;;;;;YUV;4:2:0\n" "M4S2;MPEG-4 Visual;Microsoft;;;;;YUV;4:2:0\n" "MC12;ATI Motion;;ATI Motion Compensation Format;;;;\n" "MC24;JPEG;MainConcept;;;;;YUV\n" "MCAM;ATI Motion;;ATI Motion Compensation Format;;;;\n" "MCZM;RGB;;Theory MicroCosm Lossless 64bit RGB with Alpha-channel;;;;RGB\n" "MDVD;MicroDVD;;Alex MicroDVD Video (hacked MS MPEG-4);;;;\n" "MDVF;DV;Pinnacle;Pinnacle DV/DV50/DVHD100;;;;YUV\n" "MHFY;YUV;;A.M.Paredes mhuffyYUV (LossLess);http://mirror01.iptelecom.net.ua/~video/codecs/Pinnacle.ReelTime.v2.5.software.only.codec.exe;;;YUV\n" "MJ2C;JPEG 2000;;Morgan Multimedia JPEG 2000 Compression;http://mirror01.iptelecom.net.ua/~video/codecs/Pinnacle.ReelTime.v2.5.software.only.codec.exe;;;\n" "MJPA;JPEG;Pinacle;Pinnacle ReelTime MJPG hardware;http://mediaxw.sourceforge.net;;;YUV\n" "MJPB;JPEG;Pinacle B;;;;;YUV\n" "MJPG;JPEG;;;;;;YUV\n" "mJPG;JPEG;IBM;Including Huffman Tables;;;;YUV\n" "MJPX;JPEG;Pegasus;Pegasus PICVideo JPEG;;;;YUV\n" "ML20;Webcam;;Mimic MSN Messenger Webcam;;;;\n" "MLCY;MLC;;MLC Lossless Codec;http://www.linek.sk/mlc/;;;;;;Lossless\n" "MMES;MPEG Video;Matrox;I-frame;;;;YUV;4:2:0\n" "MMIF;MPEG Video;Matrox;I-frame;;;;YUV;4:2:0\n" "MNVD;MindVid;;MindBend MindVid LossLess;;;;\n" "MP2V;MPEG Video;;Media Excel MPEG-2 Video;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "MP2v;MPEG Video;;MPEG-2 Video;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "MP41;MPEG-4 Visual;Microsoft;Microsoft MPEG-4 v1 (pre-standard);http://ffdshow-tryout.sourceforge.net/;;;\n" "MP42;MPEG-4 Visual;Microsoft;Microsoft MPEG-4 v2 (pre-standard);http://www.apple.com/quicktime/download/standalone.html;;;\n" "MP43;MPEG-4 Visual;Microsoft;Microsoft MPEG-4 v3 (pre-standard);;;;\n" "MP4S;MPEG-4 Visual;MS MPEG-4 v3;Microsoft MPEG-4 (Windows Media 7.0);;;;YUV;4:2:0\n" "MP4V;MPEG-4 Visual;;Apple QuickTime MPEG-4 native;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "MPEG;MPEG Video;;Chromatic MPEG 1 Video I Frame;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "mpeg;MPEG Video;;MPEG-1 Video;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "MPG1;MPEG Video;Ffmpeg;(MPEG-1/2) FFmpeg;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "mpg1;MPEG Video;Ffmpeg;(MPEG-1/2) FFmpeg;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "MPG2;MPEG Video;Ffmpeg;(MPEG-1/2) FFmpeg;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "mpg2;MPEG Video;Ffmpeg;(MPEG-1/2) FFmpeg;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n" "MPG3;MPEG-4 Visual;FFmpeg DivX 3;(MPEG-4) MS MPEG-4 v3;;;;YUV;4:2:0\n" "MPG4;MPEG-4 Visual;MS MPEG-4 v1;Microsoft MPEG-4 v1;;;;YUV;4:2:0\n" "MPGI;MPEG Video;Sigma;Sigma Design MPEG-1 I-frame;;;;YUV;4:2:0\n" "MPNG;PNG;;Motion PNG;;;;\n" "MRCA;Mrcodec;;FAST Multimedia;;;;\n" "MRLE;RLE;;Microsoft RLE;;;;RGB\n" "MSS1;Screen Video;Windows;Windows Screen Video;;;;\n" "MSS2;Windows Media;;Windows Media 9;;;;\n" "MSUC;MSU;;MSU LossLess;;;;\n" "MSUD;MSU;;MSU LossLess;;;;\n" "MSV1;Microsoft Video 1;;Microsoft Video 1;;;;\n" "MSVC;Microsoft Video 1;;Microsoft Video 1;;;;\n" "MSZH;AVImszh;;Lossless (ZIP compression);;;;\n" "MTGA;TGA;;Motion TGA images (24, 32 bpp);;;;\n" "MTX1;JPEG;Matrox;;;;;YUV\n" "MTX2;JPEG;Matrox;;;;;YUV\n" "MTX3;JPEG;Matrox;;;;;YUV\n" "MTX4;JPEG;Matrox;;;;;YUV\n" "MTX5;JPEG;Matrox;;;;;YUV\n" "MTX6;JPEG;Matrox;;;;;YUV\n" "MTX7;JPEG;Matrox;;;;;YUV\n" "MTX8;JPEG;Matrox;;;;;YUV\n" "MTX9;JPEG;Matrox;;;;;YUV\n" "MV10;Nokia;;Nokia Mobile Phones;;;;\n" "MV11;Nokia;;Nokia Mobile Phones;;;;\n" "MV12;MVI;;Motion Pixels (old);;;;\n" "MV99;Nokia;;Nokia Mobile Phones;;;;\n" "MVC1;Nokia;;Nokia Mobile Phones;;;;\n" "MVC2;Nokia;;Nokia Mobile Phones;;;;\n" "MVC9;Nokia;;Nokia Mobile Phones;;;;\n" "MVI1;MVI;;Motion Pixels MVI;;;;\n" "MVI2;MVI;;Motion Pixels MVI;;;;\n" "MWV1;Aware Motion Wavelets;;Aware Motion Wavelets;;;;\n" "MYUV;RGB;;Media-100 844/X Uncompressed;;;;RGB\n" "NAVI;MPEG-4 Visual;;nAVI video (hacked MS MPEG-4);;;;YUV;4:2:0\n" "NDIG;MPEG-4 Visual;Ahead;Ahead Nero Digital MPEG-4;;;;YUV;4:2:0\n" "NHVU;Nvidia Texture;;Nvidia Texture Format (GEForce 3);;;;\n" "NO16;RGB;;Theory None16 64bit uncompressed Uncompressed;;;;RGB\n" "NT00;YUV;LightWave;NewTek LightWave HDTV YUV with Alpha-channel;;;;YUV\n" "NTN1;NogaTech Video 1;;Nogatech Video Compression 1;;;;\n" "NTN2;NogaTech Video 2;;Nogatech Video Compression 2 (GrabBee hardware coder);;;;\n" "NUV1;Nuppel;;NuppelVideo;;;;\n" "NV12;YUV;;8-bit Y plane followed by an interleaved U/V plane with 2x2 subsampling;;;;YUV\n" "NV21;YUV;;As NV12 with U and V reversed in the interleaved plane;;;;YUV\n" "NVDS;Nvidia Texture;;Nvidia Texture Format;;;;\n" "NVHS;Nvidia Texture;;Nvidia Texture Format (GeForce 3);;;;\n" "NVHU;Nvidia Texture;;Nvidia Texture Format;;;;\n" "NVS0;Nvidia Texture;;Nvidia Texture Compression Format;;;;\n" "NVS1;Nvidia Texture;;Nvidia Texture Compression Format;;;;\n" "NVS2;Nvidia Texture;;Nvidia Texture Compression Format;;;;\n" "NVS3;Nvidia Texture;;Nvidia Texture Compression Format\n" "NVS4;Nvidia Texture;;Nvidia Texture Compression Format\n" "NVS5;Nvidia Texture;;Nvidia Texture Compression Format\n" "NVS6;Nvidia Texture;;Nvidia Texture Compression Format\n" "NVS7;Nvidia Texture;;Nvidia Texture Compression Format\n" "NVS8;Nvidia Texture;;Nvidia Texture Compression Format\n" "NVS9;Nvidia Texture;;Nvidia Texture Compression Format\n" "NVT0;Nvidia Texture;;Nvidia Texture Compression Format\n" "NVT1;Nvidia Texture;;Nvidia Texture Compression Format\n" "NVT2;Nvidia Texture;;Nvidia Texture Compression Format\n" "NVT3;Nvidia Texture;;Nvidia Texture Compression Format\n" "NVT4;Nvidia Texture;;Nvidia Texture Compression Format\n" "NVT5;Nvidia Texture;;Nvidia Texture Compression Format\n" "NVT6;Nvidia Texture;;Nvidia Texture Compression Format\n" "NVT7;Nvidia Texture;;Nvidia Texture Compression Format\n" "NVT8;Nvidia Texture;;Nvidia Texture Compression Format\n" "NVT9;Nvidia Texture;;Nvidia Texture Compression Format;;;;\n" "NY12;YUV;Nogatech;;;;;YUV\n" "NYUV;YUV;Nogatech;;;;;YUV\n" "ONYX;VP7;On2;;http://www.on2.com/vp7.php3;;;\n" "PCLE;Studio400;Pinnacle;;;;;\n" "PDVC;DV;Panasonic;;;;;YUV\n" "PGVV;Radius Video Vision;;;;;;\n" "PHMO;Photomotion;IBM;;;;;\n" "PIM1;JPEG;Pegasus;Pinnacle DC1000 hardware (MPEG compression);http://mirror01.iptelecom.net.ua/~video/codecs/PICVideo.Lossless.JPEG.codec.v2.10.27.exe;;;YUV\n" "PIM2;JPEG;Pegasus;Pegasus Imaging;http://mirror01.iptelecom.net.ua/~video/codecs/PICVideo.Lossless.JPEG.codec.v2.10.27.exe;;;YUV\n" "PIMJ;JPEG;Pegasus;Pegasus Imaging PICvideo Lossless JPEG;http://mirror01.iptelecom.net.ua/~video/codecs/PICVideo.Lossless.JPEG.codec.v2.10.27.exe;;;YUV\n" "PIXL;JPEG;Miro;MiroVideo XL (JPEG);;;;YUV\n" "PNG;PNG;;;;;;\n" "PNG1;PNG;;Corecodec.org CorePNG;;;;\n" "PVEZ;PowerEZ;;Horizons Technology PowerEZ;;;;\n" "PVMM;MPEG-4 Visual;Pegasus;PacketVideo Corporation MPEG-4;;;;YUV;4:2:0\n" "PVW2;Wavelet;Pegasus;Pegasus Imaging Wavelet 2000;;;;\n" "PVWV;Wavelet;Pegasus;Pegasus Imaging Wavelet 2000;;;;\n" "PXLT;Pixlet;;Apple Pixlet (Wavelet);;;;\n" "Q1.0;QPEG 1.0;;Q-Team QPEG 1.0;http://www.q-team.de;;;\n" "Q1.1;QPEG 1.1;;Q-Team QPEG 1.1;http://www.q-team.de;;;\n" "QDGX;Apple GX;;Apple QuickDUncompressed GX;;;;\n" "QDRW;Palettized Video;;Apple;;;;\n" "QPEG;QPEG 1.1;;Q-Team QPEG 1.1;;;;\n" "QPEQ;QPEG 1.1;;Q-Team QPEG 1.1;;;;\n" "R210;YUV;;BlackMagic YUV (Quick Time);;;;YUV\n" "R411;DV;Radius;Radius DV NTSC YUV;;;;YUV\n" "R420;DV;Radius;Radius DV PAL YUV;;;;YUV\n" "RAV_;MPEG-1;GroupTron;GroupTRON ReferenceAVI (dummy for MPEG compressor);;;;YUV;4:2:0\n" "RAVI;MPEG-1;GroupTron;GroupTRON ReferenceAVI (dummy for MPEG compressor);;;;YUV;4:2:0\n" "RAW ;RGB;;Full Frames (Uncompressed);;;;RGB\n" "raw ;RGB;;Full Frames (Uncompressed);http://www.apple.com/quicktime/download/standalone.html;;;RGB\n" "RGB ;RGB;;;;;;RGB;8:8:8\n" "RGB1;RGB;;;;;;RGB 3:3:2;3:3:2\n" "RGB2;RGB;;;;;;RGB 3:3:2;3:3:2\n" "RGBA;RGB;;;http://www.fourcc.org/indexrgb.htm;;;RGB\n" "RGBO;RGB;;Little Endian;;;;RGB 5:5:5;5:5:5\n" "RGBP;RGB;;Little Endian;;;;RGB 5:6:5;5:6:5\n" "RGBQ;RGB;;Big Endian;;;;RGB 5:5:5;5:5:5\n" "RGBR;RGB;;Big Endian;;;;RGB 5:6:5;5:6:5\n" "RGBT;RGBA;;;http://www.fourcc.org/indexrgb.htm;;;RGBA\n" "RIVA;Swizzled texture;;Nvidia;;;;\n" "RL4;RLE;;RLE 4bpp RGB;;;;RGB\n" "RL8;RLE;;RLE 8bpp RGB;;;;RGB\n" "RLE ;RLE;;RLE RGB with arbitrary sample packing within a pixel;http://www.fourcc.org/indexrgb.htm;;;RGB\n" "RLE4;RLE;;RLE 4bpp RGB;http://www.fourcc.org/indexrgb.htm;;;RGB\n" "RLE8;RLE;;RLE 8bpp RGB;http://www.fourcc.org/indexrgb.htm;;;RGB\n" "RLND;Roland;;Roland Corporation;;;;\n" "RMP4;MPEG-4 Visual;RealMagic;REALmagic MPEG-4 Video (Sigma Design, built on XviD);;;;YUV;4:2:0\n" "ROQV;Id RoQ;;Id RoQ File Video Decoder;;;;\n" "RT21;Intel Video 2.1;;Intel Real Time Video 2.1;;;;\n" "RTV0;NewTek VideoToaster;;NewTek VideoToaster (dummy format - only AVI header);;;;\n" "RUD0;Rududu;;Rududu video;;;;\n" "RV10;RealVideo 1;;H263, RealVideo 5;http://www.real.com;;;\n" "RV13;RealVideo 1;;H263, RealVideo 5;http://www.real.com;;;\n" "RV20;RealVideo 2;;H263, RealVideo 6;http://www.real.com;;;\n" "RV30;RealVideo 3;;Between H263 and H264, RealVideo 8;http://www.real.com;;;\n" "RV40;RealVideo 4;;H264, RealVideo 9;http://www.real.com;;;\n" "RVX ;RDX;;Intel RDX;;;;\n" "S263;H.263;;;http://ffdshow-tryout.sourceforge.net/;;;\n" "S422;YUV;VideoCap C210;VideoCap C210;;;;YUV\n" "SAN3;MPEG-4 Visual;;Direct copy of DivX 3.11;;;;YUV;4:2:0\n" "SANM;Smush v2;;LucasArts;http://www.lucasarts.com/;;;\n" "SCCD;SoftCam;;;;;;\n" "SDCC;DV;Sun;Sun Digital Camera;;;;YUV;4:1:1\n" "SEDG;MPEG-4 Visual;Samsung;Samsung MPEG-4;;;;YUV;4:2:0\n" "SEG4;Cinepak;;;http://www.sega.com/;;;\n" "SEGA;Cinepak;;;http://www.sega.com/;;;\n" "SFMC;CrystalNet;;CrystalNet Surface Fitting Method;;;;\n" "SHR0;BitJazz SheerVideo;;BitJazz SheerVideo (realtime lossless);;;;\n" "SHR1;BitJazz SheerVideo;;BitJazz SheerVideo (realtime lossless);;;;\n" "SHR2;BitJazz SheerVideo;;BitJazz SheerVideo (realtime lossless);;;;\n" "SHR3;BitJazz SheerVideo;;BitJazz SheerVideo (realtime lossless);;;;\n" "SHR4;BitJazz SheerVideo;;BitJazz SheerVideo (realtime lossless);;;;\n" "SHR5;BitJazz SheerVideo;;BitJazz SheerVideo (realtime lossless);;;;\n" "SHR6;BitJazz SheerVideo;;BitJazz SheerVideo (realtime lossless);;;;\n" "SHR7;BitJazz SheerVideo;;BitJazz SheerVideo (realtime lossless);;;;\n" "SIF1;SIF1;;;http://mysif.ru/SIF1_dd_Eng.htm;;;\n" "SJPG;JPEG;CuSeeMe;CuSeeMe;http://mirror01.iptelecom.net.ua/~video/codecs/CUseeMe.JPEG.CODEC.v1.17.exe;;;YUV\n" "SL25;DV;SoftLab DVCPro;SoftLab-NSK DVCPRO;;;;YUV;4:1:1\n" "SL50;DV;SoftLab DVCPro5;SoftLab-NSK ;;;;YUV;4:1:1\n" "SLDV;DV;SoftLab;SoftLab-NSK Forward DV Draw;;;;YUV;4:1:1\n" "SLIF;MPEG Video;SoftLab;SoftLab-NSK MPEG-2 I-frames;;;;YUV;4:2:0\n" "SLMJ;JPEG;SoftLab;SoftLab-NSK Forward JPEG;;;;YUV\n" "smc ;SMC;;Apple Graphics (SMC);http://www.apple.com/quicktime/download/standalone.html;;;\n" "SMSC;Radius;;;;;;\n" "SMSD;Radius;;;;;;\n" "SMSV;Wavelet Video;;WorldConnect Wavelet Streaming Video;;;;\n" "SNOW;Snow;;;http://ffdshow-tryout.sourceforge.net/;;;\n" "SP40;YUV;SunPlus;SunPlus YUV;;;;YUV\n" "SP44;MegaCam;;SunPlus Aiptek MegaCam;;;;\n" "SP53;MegaCam;;SunPlus Aiptek MegaCam;;;;\n" "SP54;MegaCam;;SunPlus Aiptek MegaCam;;;;\n" "SP55;MegaCam;;SunPlus Aiptek MegaCam;;;;\n" "SP56;MegaCam;;SunPlus Aiptek MegaCam;;;;\n" "SP57;MegaCam;;SunPlus Aiptek MegaCam;;;;\n" "SP58;MegaCam;;SunPlus Aiptek MegaCam;;;;\n" "SP61;MegaCam;;SunPlus Aiptek MegaCam;;;;\n" "SPIG;Spigot;;Radius Spigot;;;;\n" "SPLC;ACM audio;;Splash Studios ACM Audio;;;;\n" "SPRK;Spark;;;;;;\n" "SQZ2;VXTreme 2;;Microsoft VXTreme Video V2;;;;\n" "STVA;ST Imager;;ST Microelectronics CMOS Imager Data (Bayer);;;;\n" "STVB;ST Imager;;ST Microelectronics CMOS Imager Data (Nudged Bayer);;;;\n" "STVC;ST Imager;;ST Microelectronics CMOS Imager Data (Bunched);;;;\n" "STVX;ST Imager;;ST Microelectronics CMOS Imager Data (Extended Data Format);;;;\n" "STVY;ST Imager;;ST Microelectronics CMOS Imager Data (Extended Data Format with Correction Data);;;;\n" "SV10;Sorenson;;Sorenson Media Video R1;;;;\n" "SVQ1;AVC;Sorenson 1;Sorenson Media Video 1 (Apple QuickTime 3);;;;\n" "SVQ2;AVC;Sorenson 2;Sorenson Media Video 2 (Apple QuickTime 4);;;;\n" "SVQ3;AVC;Sorenson 3;Sorenson Media Video 3 (Apple QuickTime 5);;;;\n" "SWC1;JPEG;MainConcept;MainConcept JPEG;;;;YUV\n" "T420;YUV;Toshiba;Toshiba YUV 4:2:0;;;;YUV\n" "TGA ;TGA;Apple;Apple TGA (with Alpha-channel)\n" "THEO;Theora;;FFVFW Supported\n" "TIFF;Apple TIFF;;Apple TIFF (with Alpha-channel)\n" "TIM2;Pinnacle DVI;;Pinnacle RAL DVI\n" "TLMS;TeraLogic;;TeraLogic Motion Intraframe\n" "TLST;TeraLogic;;TeraLogic Motion Intraframe\n" "TM10;Duck;;Duck TrueMotion\n" "TM20;Duck 2;;Duck TrueMotion 2.0\n" "TM2A;Duck Archiver 2;;Duck TrueMotion Archiver 2.0\n" "TM2X;Duck 2;;Duck TrueMotion 2X\n" "TMIC;TeraLogic;;TeraLogic Motion Intraframe\n" "TMOT;Horizons TM S;;Horizons Technology TrueMotion Video\n" "TR20;Duck TM RT2;;Duck TrueMotion RT 2.0\n" "TRLE;Akula;;Akula Alpha Pro Custom AVI (LossLess)\n" "TSCC;TechSmith;;TechSmith Screen Capture\n" "tscc;TechSmith;;TechSmith Screen Capture\n" "TV10;Tecomac;;Tecomac Low-Bit Rate;;;;\n" "TVJP;Pinnacle/Truevision;;TrueVision Field Encoded JPEG (Targa emulation);;;;\n" "TVMJ;Pinnacle/Truevision;;Truevision TARGA JPEG Hardware (or Targa emulation);;;;\n" "TY0N;Trident;;Trident Decompression Driver;;;;\n" "TY2C;Trident;;Trident Decompression Driver;;;;\n" "TY2N;Trident;;Trident Decompression Driver;;;;\n" "U5.3.0, <5.9.0\n" "1438;>5.3.0, <5.9.0\n" "1453;5.9.0 Fusion (InertialConfinement);UTC 2005-01\n" "1461;5.9.0 Fusion (HiggsBoson);UTC 2005-01\n" "1528;5.9.0 Fusion (HiggsBoson);UTC 2005-03-05\n" "1571;6.0.0;UTC 2005-06-15\n" "1594;6.0.0 (DivX Converter1.0);UTC 2005-06\n" "1599;6.0.0 Helium;UTC 2005-06\n" "1612;6.0.0 Helium (GodFatherOfSoul);UTC 2005-06-15\n" "1697;6.0.3 Fusion (ThermonuclearFusion);UTC 2005-10-18\n" "1737;He-3 (TwinTurbocharger);UTC 2005-12\n" "1786;6.1.0;UTC 2005-12-12\n" "1828;6.1.1;UTC 2006-02-01\n" "1893;6.2.0 Beta1;UTC 2006-03-25\n" "1910;6.2.0;UTC 2006-04-11\n" "1913;6.2.1;UTC 2006-04\n" "1915;6.2.1 Patch1Beta;UTC 2006-04\n" "1920;6.2.2;UTC 2006-04-26\n" "1977;6.2.5;UTC 2006-06-16\n" "1988;6.2.5;UTC 2006-07\n" "2075;>6.2.5, <6.4.0\n" "2081;6.4.0 Beta1;UTC 2006-09-27\n" "2086;6.4.0;UTC 2006-10-03\n" "2201;6.5.0;UTC 2006-12\n" "2207;6.5.1;UTC 2007-03\n" "2292;6.6.0;UTC 2007-05-04\n" "2306;6.6.1\n" "2309;6.6.1\n" "2318;6.6.1.4\n" "2396;6.7 Beta;UTC 2007-08-26\n" "2432;6.7.0;UTC 2007-09-20\n" "2510;6.8.0;UTC 2007-12-04\n" "2521;6.8.0 Converter 6.6\n" "2559;6.8.2;UTC 2008-05-17\n" "2676;6.8.3-6.8.4;UTC 2008-06-07\n" "2816;6.8.5;UTC 2009-08-20\n" "2851;6.8.5;UTC 2009-08-20\n" )); Info.Separator_Set(0, ZenLib::EOL); } //--------------------------------------------------------------------------- void MediaInfo_Config_Library_XviD (InfoMap &Info) { Info.Separator_Set(0, __T("\n")); Info.Write(Ztring().From_UTF8( "Main source;http://xmm.sourceforge.net/DivX5-6_Xvid_Bitstream_version.php\n" "1;0.0.01;UTC 2002-10-17\n" "2;0.0.02;UTC 2002-10-30\n" "3;0.0.03;UTC 2002-12-09\n" "4;0.0.04;UTC 2003-01\n" "5;0.0.05;UTC 2003-01-11\n" "6;0.0.06;UTC 2003-01-12\n" "7;0.0.07;UTC 2003-01-13\n" "8;0.0.08;UTC 2003-01-14\n" "9;0.0.09;UTC 2003-03-25\n" "10;0.0.10;UTC 2003-06-09\n" "11;0.0.11;UTC 2003-06-09\n" "12;0.0.12;UTC 2003-06-11\n" "13;0.0.13;UTC 2003-06-11\n" "14;0.0.14;UTC 2003-06-28\n" "15;0.0.15;UTC 2003-07-28\n" "16;0.0.16;UTC 2003-07-28\n" "17;0.0.17;UTC 2003-08-06\n" "18;0.0.18;UTC 2003-09-04\n" "19;0.0.19;UTC 2003-09-28\n" "20;0.0.20;UTC 2003-10-09\n" "21;1.0.0 Beta1 (Aloha);UTC 2003-11-29\n" "22;1.0.0 Beta1.5;UTC 2003-12-03\n" "23;1.0.0 Beta2 (Ciao);UTC 2003-12-06\n" "24;1.0.0 Beta2.5;UTC 2003-12-18\n" "25;1.0.0 Beta3 (Selam);UTC 2003-12-27\n" "26;1.0.0 RC1 (Niltze);UTC 2004-01-26\n" "27;1.0.0 RC1b;UTC 2004-01-30\n" "28;1.0.0 RC2 (Jambo);UTC 2004-02-01\n" "29;1.0.0 RC3 (Nihao);UTC 2004-03-22\n" "30;1.0.0 RC4 (Hola);UTC 2004-04-05\n" "31;1.0.0 RC4b;UTC 2004-04-15\n" "32;1.0.0 RC4c;UTC 2004-05-02\n" "33;1.0.0 RC4d;UTC 2004-05-03\n" "34;1.0.0;UTC 2004-05-09\n" "35;1.0.1;UTC 2004-06-05\n" "36;1.0.2;UTC 2004-08-29\n" "37;1.0.3;UTC 2004-12-20\n" "38;1.1.0 Beta1;UTC 2005-01-16\n" "39;1.1.0 Beta2;UTC 2005-04-04\n" "40;1.1.0 RC;UTC 2005-11-22\n" "41;1.1.0;UTC 2005-11-22\n" "42;1.2.0.dev42;UTC 2005-12\n" "43;1.2.0SMP;UTC 2006-01-08\n" "44;1.1.1;UTC 2006-07-10\n" "45;1.2.0.dev45;UTC 2006-07-10\n" "46;1.1.2;UTC 2006-11-01\n" "47;1.2.0.dev47;UTC 2006-11-01\n" "48;1.2.0.dev48\n" "49;1.2.0.dev49\n" "50;1.2.1;UTC 2008-12-04\n" "55;1.3.0.dev55\n" )); Info.Separator_Set(0, ZenLib::EOL); } //--------------------------------------------------------------------------- void MediaInfo_Config_Library_MainConcept_Avc (InfoMap &Info) { Info.Separator_Set(0, __T("\n")); Info.Write(Ztring().From_UTF8( "2.0.1889;2.0.1889;UTC 2006-01-11\n" )); Info.Separator_Set(0, ZenLib::EOL); } //--------------------------------------------------------------------------- void MediaInfo_Config_Library_VorbisCom (InfoMap &Info) { Info.Separator_Set(0, __T("\n")); Info.Write(Ztring().From_UTF8( "Main source;http://wiki.hydrogenaudio.org/index.php?title=Recommended_Ogg_Vorbis\n" "Xiphophorus libVorbis I 20000508;1.0 Beta 1/2;UTC 2000-05-08\n" "Xiphophorus libVorbis I 20001031;1.0 Beta 3;UTC 2000-10-31\n" "Xiphophorus libVorbis I 20010225;1.0 Beta 4;UTC 2001-02-25\n" "Xiphophorus libVorbis I 20010615;1.0 RC1;UTC 2000-16-15\n" "Xiphophorus libVorbis I 20010813;1.0 RC2;UTC 2000-18-13\n" "Xiphophorus libVorbis I 20010816 (gtune 1);1.0 RC2 (GTune 1);UTC 2001-08-16\n" "Xiphophorus libVorbis I 20011014 (GTune 2);1.0 RC2 (GTune 2);UTC 2001-10-14\n" "Xiphophorus libVorbis I 20011217;1.0 RC3;UTC 2001-12-17\n" "Xiphophorus libVorbis I 20011231;1.0 RC3;UTC 2001-12-31\n" "Xiph.Org libVorbis I 20020717;1.0;UTC 2002-07-17\n" "Xiph.Org/Sjeng.Org libVorbis I 20020717 (GTune 3, beta 1);1.0 (GTune 3 Beta 1);UTC 2002-07-17\n" "Xiph.Org libVorbis I 20030308;1.0.1 (CVS);UTC 2003-03-08\n" "Xiph.Org libVorbis I 20030909;1.0.1;UTC 2003-09-09\n" "Xiph.Org/Sjeng.Org libVorbis I 20030909 (GTune 3, beta 2) EXPERIMENTAL;1.0 (GTune 3 Beta 2);UTC 2003-09-09\n" "Xiph.Org libVorbis I 20031230 (1.0.1);1.0.1 (CVS);UTC 2003-12-30\n" "Xiph.Org/Sjeng.Org libVorbis I 20031230 (GTune 3, beta 2);1.0.1 (GTune 3 Beta 2);UTC 2003-12-30\n" "AO aoTuV b2 [20040420] (based on Xiph.Org's 1.0.1);Beta 2;UTC 2004-04-20\n" "Xiph.Org libVorbis I 20040629;1.1;UTC 2004-06-29\n" "Xiph.Org libVorbis I 20040920;1.1 (with impulse_trigger_profile);UTC 2004-09-20\n" "AO aoTuV b3 [20041120] (based on Xiph.Org's libVorbis);Beta 3;UTC 2004-11-20\n" "Xiph.Org libVorbis I 20050304;1.1.1/1.1.2;UTC 2005-03-04\n" "AO aoTuV b4 [20050617] (based on Xiph.Org's libVorbis);Beta 4;UTC 2005-06-17\n" "BS Lancer [20050709] (based on aoTuV b4 [20050617]);(aoTuV Beta 4);UTC 2005-07-09\n" "AO aoTuV b4a [20051105] (based on Xiph.Org's libVorbis);Beta 4.5;UTC 2005-11-05\n" "AO aoTuV b4b [20051117] (based on Xiph.Org's libVorbis);Beta 4.51;UTC 2005-11-17\n" "BS Lancer [20051121] (based on aoTuV b4b [20051117]);(aoTuV Beta 4.51);UTC 2005-11-21\n" "AO aoTuV pre-beta5 [20060321] (based on Xiph.Org's libVorbis);Beta 5 (preBeta);UTC 2006-03-21\n" "AO aoTuV b5 [20061024] (based on Xiph.Org's libVorbis);Beta 5;UTC 2006-10-24\n" "Xiph.Org libVorbis I 20070622;1.2;UTC 2007-06-22\n" )); Info.Separator_Set(0, ZenLib::EOL); } //--------------------------------------------------------------------------- void MediaInfo_Config_Summary (ZtringListList &Info) { Info.Separator_Set(0, __T("\n")); Info.Write(Ztring().From_UTF8( "General;[%Format%][ (%Format_Profile%)][ (%Format_Commercial_IfAny%)]$if(%Format%,$: $)%FileSize/String%[, %Duration/String%]\n" "Video;[%Language/String%, ][%BitRate/String%$if(%BitRate_Nominal/String%, \\(%BitRate_Nominal/String%\\)), ][%Width%*][%Height%][ (%DisplayAspectRatio/String%), ][$at$ %FrameRate/String%, ][%Format%][ (%CodecID/Hint%)][ (%Standard%)]$if(%MuxingMode%, \\(%MuxingMode%\\))$if(%Format_Version%, \\(%Format_Version%\\))$if(%Format_Profile%, \\(%Format_Profile%\\))$if(%Format_Settings%, \\(%Format_Settings%\\))[ (%Format_Commercial_IfAny%)]\n" "Audio;[%Language/String%, ][%BitRate/String%$if(%BitRate_Nominal/String%, \\(%BitRate_Nominal/String%\\)), ][%SamplingRate/String%, ][%BitDepth/String%, ][%Channel(s)/String%, ][%Format%][ (%CodecID/Hint%)]$if(%MuxingMode%, \\(%MuxingMode%\\))$if(%Format_Version%, \\(%Format_Version%\\))$if(%Format_Profile%, \\(%Format_Profile%\\))$if(%Format_Settings%, \\(%Format_Settings%\\))[ (%Format_Commercial_IfAny%)]\n" "Text;[%Language/String%, ][%Format%][ (%Format_Commercial_IfAny%)]$if(%MuxingMode%, \\(%MuxingMode%\\))\n" "Image;[%Language/String%, ][%Width%*][%Height%][ (%DisplayAspectRatio/String%)][, %Format%]\n" "Chapters;[%Language/String%, ]%Total% chapters[, %Format%][ (%Format_Commercial_IfAny%)]\n" )); Info.Separator_Set(0, ZenLib::EOL); } } //NameSpace MediaInfoLib/Source/MediaInfo/MediaInfo_Config_MediaInfo.cpp100777 0 0 224402 12262743713 17364 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "MediaInfo/MediaInfo_Config.h" #include "ZenLib/ZtringListListF.h" #if MEDIAINFO_EVENTS #include "ZenLib/FileName.h" #endif //MEDIAINFO_EVENTS #if MEDIAINFO_IBI #include "base64.h" #endif //MEDIAINFO_IBI #include #if MEDIAINFO_DEMUX #include #endif //MEDIAINFO_DEMUX using namespace ZenLib; using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { const size_t Buffer_NormalSize=/*188*7;//*/64*1024; //*************************************************************************** // Info //*************************************************************************** MediaInfo_Config_MediaInfo::MediaInfo_Config_MediaInfo() { FileIsSeekable=true; FileIsSub=false; FileIsDetectingDuration=false; FileIsReferenced=false; FileTestContinuousFileNames=true; FileKeepInfo=false; FileStopAfterFilled=false; FileStopSubStreamAfterFilled=false; Audio_MergeMonoStreams=false; File_Demux_Interleave=false; File_ID_OnlyRoot=false; #if MEDIAINFO_ADVANCED File_IgnoreSequenceFileSize=false; File_DefaultFrameRate=0; File_Source_List=false; File_RiskyBitRateEstimation=false; #if MEDIAINFO_DEMUX File_Demux_Unpacketize_StreamLayoutChange_Skip=false; #endif //MEDIAINFO_DEMUX #endif //MEDIAINFO_ADVANCED #if MEDIAINFO_MD5 File_Md5=false; #endif //MEDIAINFO_MD5 #if defined(MEDIAINFO_REFERENCES_YES) File_CheckSideCarFiles=false; #endif //defined(MEDIAINFO_REFERENCES_YES) File_TimeToLive=0; File_Buffer_Size_Hint_Pointer=NULL; #if MEDIAINFO_NEXTPACKET NextPacket=false; #endif //MEDIAINFO_NEXTPACKET #if MEDIAINFO_FILTER File_Filter_Audio=false; File_Filter_HasChanged_=false; #endif //MEDIAINFO_FILTER #if MEDIAINFO_EVENTS Event_CallBackFunction=NULL; Event_UserHandler=NULL; SubFile_StreamID=(int64u)-1; ParseUndecodableFrames=false; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_ForceIds=false; Demux_PCM_20bitTo16bit=false; Demux_PCM_20bitTo24bit=false; Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10=false; Demux_Unpacketize=false; Demux_Rate=0; Demux_FirstDts=(int64u)-1; Demux_FirstFrameNumber=(int64u)-1; Demux_InitData=0; //In Demux event #endif //MEDIAINFO_DEMUX #if MEDIAINFO_IBI Ibi_Create=false; Ibi_UseIbiInfoIfAvailable=false; #endif //MEDIAINFO_IBI //Specific File_MpegTs_ForceMenu=false; File_MpegTs_stream_type_Trust=true; File_MpegTs_Atsc_transport_stream_id_Trust=true; File_MpegTs_RealTime=false; File_Bdmv_ParseTargetedFile=true; #if defined(MEDIAINFO_DVDIF_YES) File_DvDif_DisableAudioIfIsInContainer=false; File_DvDif_IgnoreTransmittingFlags=false; #endif //defined(MEDIAINFO_DVDIF_YES) #if defined(MEDIAINFO_DVDIF_ANALYZE_YES) File_DvDif_Analysis=false; #endif //defined(MEDIAINFO_DVDIF_ANALYZE_YES) #if MEDIAINFO_MACROBLOCKS File_Macroblocks_Parse=false; #endif //MEDIAINFO_MACROBLOCKS File_GrowingFile_Delay=10; #if defined(MEDIAINFO_LIBMMS_YES) File_Mmsh_Describe_Only=false; #endif //defined(MEDIAINFO_LIBMMS_YES) File_Eia608_DisplayEmptyStream=false; File_Eia708_DisplayEmptyStream=false; State=0; #if defined(MEDIAINFO_AC3_YES) File_Ac3_IgnoreCrc=false; #endif //defined(MEDIAINFO_AC3_YES) //Internal to MediaInfo, not thread safe File_Names_Pos=0; File_Buffer=NULL; File_Buffer_Size_Max=0; File_Buffer_Size_ToRead=Buffer_NormalSize; File_Buffer_Size=0; File_Buffer_Repeat=false; File_Buffer_Repeat_IsSupported=false; File_IsGrowing=false; File_IsNotGrowingAnymore=false; File_Current_Offset=0; File_Current_Size=(int64u)-1; File_Size=(int64u)-1; ParseSpeed=MediaInfoLib::Config.ParseSpeed_Get(); #if MEDIAINFO_DEMUX Demux_EventWasSent=false; Demux_Offset_Frame=(int64u)-1; Demux_Offset_DTS=(int64u)-1; Demux_Offset_DTS_FromStream=(int64u)-1; Events_Delayed_CurrentSource=NULL; #if MEDIAINFO_SEEK Demux_IsSeeking=false; #endif //MEDIAINFO_SEEK #endif //MEDIAINFO_DEMUX } MediaInfo_Config_MediaInfo::~MediaInfo_Config_MediaInfo() { delete[] File_Buffer; //File_Buffer=NULL; #if MEDIAINFO_EVENTS for (events_delayed::iterator Event=Events_Delayed.begin(); Event!=Events_Delayed.end(); ++Event) for (size_t Pos=0; Possecond.size(); Pos++) delete Event->second[Pos]; //Event->second[Pos]=NULL; #endif //MEDIAINFO_EVENTS } //*************************************************************************** // Info //*************************************************************************** Ztring MediaInfo_Config_MediaInfo::Option (const String &Option, const String &Value) { #if MEDIAINFO_EVENTS SubFile_Config(Option)=Value; #endif //MEDIAINFO_EVENTS String Option_Lower(Option); size_t Egal_Pos=Option_Lower.find(__T('=')); if (Egal_Pos==string::npos) Egal_Pos=Option_Lower.size(); transform(Option_Lower.begin(), Option_Lower.begin()+Egal_Pos, Option_Lower.begin(), (int(*)(int))tolower); //(int(*)(int)) is a patch for unix if (Option_Lower==__T("file_isseekable")) { File_IsSeekable_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_isseekable_get")) { return File_IsSeekable_Get()?"1":"0"; } if (Option_Lower==__T("file_issub")) { File_IsSub_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_issub_get")) { return File_IsSub_Get()?"1":"0"; } if (Option_Lower==__T("file_isdetectingduration")) { File_IsDetectingDuration_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_isdetectingduration_get")) { return File_IsDetectingDuration_Get()?"1":"0"; } if (Option_Lower==__T("file_isreferenced")) { File_IsReferenced_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_isreferenced_get")) { return File_IsReferenced_Get()?"1":"0"; } if (Option_Lower==__T("file_testcontinuousfilenames")) { File_TestContinuousFileNames_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_testcontinuousfilenames_get")) { return File_TestContinuousFileNames_Get()?"1":"0"; } if (Option_Lower==__T("file_keepinfo")) { File_KeepInfo_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_keepinfo_get")) { return File_KeepInfo_Get()?"1":"0"; } if (Option_Lower==__T("file_stopafterfilled")) { File_StopAfterFilled_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_stopafterfilled_get")) { return File_StopAfterFilled_Get()?"1":"0"; } if (Option_Lower==__T("file_stopsubstreamafterfilled")) { File_StopSubStreamAfterFilled_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_stopsubstreamafterfilled_get")) { return File_StopSubStreamAfterFilled_Get()?"1":"0"; } if (Option_Lower==__T("file_audio_mergemonostreams")) { File_Audio_MergeMonoStreams_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_audio_mergemonostreams_get")) { return File_Audio_MergeMonoStreams_Get()?"1":"0"; } else if (Option_Lower==__T("file_demux_interleave")) { File_Demux_Interleave_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_demux_interleave_get")) { return File_Demux_Interleave_Get()?"1":"0"; } else if (Option_Lower==__T("file_id_onlyroot")) { File_ID_OnlyRoot_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_id_onlyroot_get")) { return File_ID_OnlyRoot_Get()?"1":"0"; } else if (Option_Lower==__T("file_ignoresequencefilesize")) { #if MEDIAINFO_MD5 File_IgnoreSequenceFileSize_Set(!(Value==__T("0") || Value.empty())); return Ztring(); #else //MEDIAINFO_MD5 return __T("Disabled due to compilation options"); #endif //MEDIAINFO_MD5 } else if (Option_Lower==__T("file_defaultframerate")) { #if MEDIAINFO_MD5 File_DefaultFrameRate_Set(Ztring(Value).To_float64()); return Ztring(); #else //MEDIAINFO_MD5 return __T("File_DefaultFrameRate is disabled due to compilation options"); #endif //MEDIAINFO_MD5 } else if (Option_Lower==__T("file_source_list")) { #if MEDIAINFO_MD5 File_Source_List_Set(!(Value==__T("0") || Value.empty())); return Ztring(); #else //MEDIAINFO_MD5 return __T("MD5 is disabled due to compilation options"); #endif //MEDIAINFO_MD5 } else if (Option_Lower==__T("file_riskybitrateestimation")) { #if MEDIAINFO_ADVANCED File_RiskyBitRateEstimation_Set(!(Value==__T("0") || Value.empty())); return Ztring(); #else //MEDIAINFO_ADVANCED return __T("Advanced features are disabled due to compilation options"); #endif //MEDIAINFO_ADVANCED } else if (Option_Lower==__T("file_demux_unpacketize_streamlayoutchange_skip")) { #if MEDIAINFO_DEMUX #if MEDIAINFO_ADVANCED File_Demux_Unpacketize_StreamLayoutChange_Skip_Set(!(Value==__T("0") || Value.empty())); return Ztring(); #else //MEDIAINFO_ADVANCED return __T("Advanced features disabled due to compilation options"); #endif //MEDIAINFO_ADVANCED #else //MEDIAINFO_ADVANCED return __T("Advanced features disabled due to compilation options"); #endif //MEDIAINFO_ADVANCED } else if (Option_Lower==__T("file_md5")) { #if MEDIAINFO_MD5 File_Md5_Set(!(Value==__T("0") || Value.empty())); return Ztring(); #else //MEDIAINFO_MD5 return __T("MD5 is disabled due to compilation options"); #endif //MEDIAINFO_MD5 } else if (Option_Lower==__T("file_checksidecarfiles")) { #if defined(MEDIAINFO_REFERENCES_YES) File_CheckSideCarFiles_Set(!(Value==__T("0") || Value.empty())); return Ztring(); #else //defined(MEDIAINFO_REFERENCES_YES) return __T("Disabled due to compilation options"); #endif //defined(MEDIAINFO_REFERENCES_YES) } else if (Option_Lower==__T("file_filename")) { File_FileName_Set(Value); return __T(""); } else if (Option_Lower==__T("file_filename_get")) { return File_FileName_Get(); } else if (Option_Lower==__T("file_filenameformat")) { File_FileNameFormat_Set(Value); return __T(""); } else if (Option_Lower==__T("file_filenameformat_get")) { return File_FileNameFormat_Get(); } else if (Option_Lower==__T("file_timetolive")) { File_TimeToLive_Set(Ztring(Value).To_float64()); return __T(""); } else if (Option_Lower==__T("file_timetolive_get")) { return Ztring::ToZtring(File_TimeToLive_Get(), 9); } else if (Option_Lower==__T("file_partial_begin")) { File_Partial_Begin_Set(Value); return __T(""); } else if (Option_Lower==__T("file_partial_begin_get")) { return File_Partial_Begin_Get(); } else if (Option_Lower==__T("file_partial_end")) { File_Partial_End_Set(Value); return __T(""); } else if (Option_Lower==__T("file_partial_end_get")) { return File_Partial_End_Get(); } else if (Option_Lower==__T("file_forceparser")) { File_ForceParser_Set(Value); return __T(""); } else if (Option_Lower==__T("file_forceparser_get")) { return File_ForceParser_Get(); } else if (Option_Lower==__T("file_buffer_size_hint_pointer")) { File_Buffer_Size_Hint_Pointer_Set((size_t*)Ztring(Value).To_int64u()); return __T(""); } else if (Option_Lower==__T("file_buffer_size_hint_pointer_get")) { return Ztring::ToZtring((size_t)File_Buffer_Size_Hint_Pointer_Get()); } else if (Option_Lower==__T("file_filter")) { #if MEDIAINFO_FILTER Ztring ValueLowerCase=Ztring(Value).MakeLowerCase(); if (ValueLowerCase==__T("audio")) File_Filter_Audio_Set(true); else File_Filter_Set(ValueLowerCase.To_int64u()); return Ztring(); #else //MEDIAINFO_FILTER return __T("Filter manager is disabled due to compilation options"); #endif //MEDIAINFO_FILTER } else if (Option_Lower==__T("file_filter_get")) { #if MEDIAINFO_FILTER return Ztring();//.From_Number(File_Filter_Get()); #else //MEDIAINFO_FILTER return __T("Filter manager is disabled due to compilation options"); #endif //MEDIAINFO_FILTER } else if (Option_Lower==__T("file_duplicate")) { #if MEDIAINFO_DUPLICATE return File_Duplicate_Set(Value); #else //MEDIAINFO_DUPLICATE return __T("Duplicate manager is disabled due to compilation options"); #endif //MEDIAINFO_DUPLICATE } else if (Option_Lower==__T("file_duplicate_get")) { #if MEDIAINFO_DUPLICATE //if (File_Duplicate_Get()) return __T("1"); //else // return __T(""); #else //MEDIAINFO_DUPLICATE return __T("Duplicate manager is disabled due to compilation options"); #endif //MEDIAINFO_DUPLICATE } else if (Option_Lower==__T("file_demux_forceids")) { #if MEDIAINFO_DEMUX if (Value.empty()) Demux_ForceIds_Set(false); else Demux_ForceIds_Set(true); return Ztring(); #else //MEDIAINFO_DEMUX return __T("Demux manager is disabled due to compilation options"); #endif //MEDIAINFO_DEMUX } else if (Option_Lower==__T("file_demux_pcm_20bitto16bit")) { #if MEDIAINFO_DEMUX if (Value.empty()) Demux_PCM_20bitTo16bit_Set(false); else Demux_PCM_20bitTo16bit_Set(true); return Ztring(); #else //MEDIAINFO_DEMUX return __T("Demux manager is disabled due to compilation options"); #endif //MEDIAINFO_DEMUX } else if (Option_Lower==__T("file_demux_pcm_20bitto24bit")) { #if MEDIAINFO_DEMUX if (Value.empty()) Demux_PCM_20bitTo24bit_Set(false); else Demux_PCM_20bitTo24bit_Set(true); return Ztring(); #else //MEDIAINFO_DEMUX return __T("Demux manager is disabled due to compilation options"); #endif //MEDIAINFO_DEMUX } else if (Option_Lower==__T("file_demux_avc_transcode_iso14496_15_to_iso14496_10")) { #if MEDIAINFO_DEMUX if (Value.empty()) Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10_Set(false); else Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10_Set(true); return Ztring(); #else //MEDIAINFO_DEMUX return __T("Demux manager is disabled due to compilation options"); #endif //MEDIAINFO_DEMUX } else if (Option_Lower==__T("file_demux_unpacketize")) { #if MEDIAINFO_DEMUX if (Value.empty()) Demux_Unpacketize_Set(false); else Demux_Unpacketize_Set(true); return Ztring(); #else //MEDIAINFO_DEMUX return __T("Demux manager is disabled due to compilation options"); #endif //MEDIAINFO_DEMUX } else if (Option_Lower==__T("file_demux_rate")) { #if MEDIAINFO_DEMUX Demux_Rate_Set(Ztring(Value).To_float64()); return Ztring(); #else //MEDIAINFO_DEMUX return __T("Demux manager is disabled due to compilation options"); #endif //MEDIAINFO_DEMUX } else if (Option_Lower==__T("file_demux_firstdts")) { #if MEDIAINFO_DEMUX int64u ValueInt64u; if (Value.find(__T(":"))!=string::npos) { Ztring ValueZ=Value; ValueInt64u=0; size_t Value_Pos=ValueZ.find(__T(":")); if (Value_Pos==string::npos) Value_Pos=ValueZ.size(); ValueInt64u+=Ztring(ValueZ.substr(0, Value_Pos)).To_int64u()*60*60*1000*1000*1000; ValueZ.erase(0, Value_Pos+1); Value_Pos=ValueZ.find(__T(":")); if (Value_Pos==string::npos) Value_Pos=ValueZ.size(); ValueInt64u+=Ztring(ValueZ.substr(0, Value_Pos)).To_int64u()*60*1000*1000*1000; ValueZ.erase(0, Value_Pos+1); Value_Pos=ValueZ.find(__T(".")); if (Value_Pos==string::npos) Value_Pos=ValueZ.size(); ValueInt64u+=Ztring(ValueZ.substr(0, Value_Pos)).To_int64u()*1000*1000*1000; ValueZ.erase(0, Value_Pos+1); if (!ValueZ.empty()) ValueInt64u+=Ztring(ValueZ).To_int64u()*1000*1000*1000/(int64u)pow(10.0, (int)ValueZ.size()); } else ValueInt64u=Ztring(Value).To_int64u(); Demux_FirstDts_Set(ValueInt64u); return Ztring(); #else //MEDIAINFO_DEMUX return __T("Demux manager is disabled due to compilation options"); #endif //MEDIAINFO_DEMUX } else if (Option_Lower==__T("file_demux_firstframenumber")) { #if MEDIAINFO_DEMUX Demux_FirstFrameNumber_Set(Ztring(Value).To_int64u()); return Ztring(); #else //MEDIAINFO_DEMUX return __T("Demux manager is disabled due to compilation options"); #endif //MEDIAINFO_DEMUX } else if (Option_Lower==__T("file_demux_initdata")) { #if MEDIAINFO_DEMUX Ztring Value_Lower(Value); Value_Lower.MakeLowerCase(); if (Value_Lower==__T("event")) Demux_InitData_Set(0); else if (Value_Lower==__T("field")) Demux_InitData_Set(1); else return __T("Invalid value"); return Ztring(); #else //MEDIAINFO_DEMUX return __T("Demux manager is disabled due to compilation options"); #endif //MEDIAINFO_DEMUX } else if (Option_Lower==__T("file_ibi")) { #if MEDIAINFO_IBI Ibi_Set(Value); return Ztring(); #else //MEDIAINFO_IBI return __T("IBI support is disabled due to compilation options"); #endif //MEDIAINFO_IBI } else if (Option_Lower==__T("file_ibi_create")) { #if MEDIAINFO_IBI if (Value.empty()) Ibi_Create_Set(false); else Ibi_Create_Set(true); return Ztring(); #else //MEDIAINFO_IBI return __T("IBI support is disabled due to compilation options"); #endif //MEDIAINFO_IBI } else if (Option_Lower==__T("file_ibi_useibiinfoifavailable")) { #if MEDIAINFO_IBI if (Value.empty()) Ibi_UseIbiInfoIfAvailable_Set(false); else Ibi_UseIbiInfoIfAvailable_Set(true); return Ztring(); #else //MEDIAINFO_IBI return __T("IBI support is disabled due to compilation options"); #endif //MEDIAINFO_IBI } else if (Option_Lower==__T("file_nextpacket")) { #if MEDIAINFO_NEXTPACKET if (Value.empty()) NextPacket_Set(false); else NextPacket_Set(true); return Ztring(); #else //MEDIAINFO_NEXTPACKET return __T("NextPacket manager is disabled due to compilation options"); #endif //MEDIAINFO_NEXTPACKET } else if (Option_Lower==__T("file_subfile_streamid_set")) { #if MEDIAINFO_EVENTS SubFile_StreamID_Set(Value.empty()?(int64u)-1:Ztring(Value).To_int64u()); return Ztring(); #else //MEDIAINFO_EVENTS return __T("Event manager is disabled due to compilation options"); #endif //MEDIAINFO_EVENTS } else if (Option_Lower==__T("file_subfile_ids_set")) { #if MEDIAINFO_EVENTS SubFile_IDs_Set(Value); return Ztring(); #else //MEDIAINFO_EVENTS return __T("Event manager is disabled due to compilation options"); #endif //MEDIAINFO_EVENTS } else if (Option_Lower==__T("file_parseundecodableframes")) { #if MEDIAINFO_EVENTS ParseUndecodableFrames_Set(!(Value==__T("0") || Value.empty())); return Ztring(); #else //MEDIAINFO_EVENTS return __T("Event manager is disabled due to compilation options"); #endif //MEDIAINFO_EVENTS } else if (Option_Lower==__T("file_mpegts_forcemenu")) { File_MpegTs_ForceMenu_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_mpegts_forcemenu_get")) { return File_MpegTs_ForceMenu_Get()?"1":"0"; } else if (Option_Lower==__T("file_mpegts_stream_type_trust")) { File_MpegTs_stream_type_Trust_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_mpegts_stream_type_trust_get")) { return File_MpegTs_stream_type_Trust_Get()?"1":"0"; } else if (Option_Lower==__T("file_mpegts_atsc_transport_stream_id_trust")) { File_MpegTs_Atsc_transport_stream_id_Trust_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_mpegts_atsc_transport_stream_id_trust_get")) { return File_MpegTs_Atsc_transport_stream_id_Trust_Get()?"1":"0"; } else if (Option_Lower==__T("file_mpegts_realtime")) { File_MpegTs_RealTime_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_mpegts_realtime_get")) { return File_MpegTs_RealTime_Get()?"1":"0"; } else if (Option_Lower==__T("file_bdmv_parsetargetedfile")) { File_Bdmv_ParseTargetedFile_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_bdmv_parsetargetedfile_get")) { return File_Bdmv_ParseTargetedFile_Get()?"1":"0"; } else if (Option_Lower==__T("file_dvdif_disableaudioifisincontainer")) { #if defined(MEDIAINFO_DVDIF_YES) File_DvDif_DisableAudioIfIsInContainer_Set(!(Value==__T("0") || Value.empty())); return __T(""); #else //defined(MEDIAINFO_DVDIF_YES) return __T("DVDIF is disabled due to compilation options"); #endif //defined(MEDIAINFO_DVDIF_YES) } else if (Option_Lower==__T("file_dvdif_disableaudioifisincontainer_get")) { #if defined(MEDIAINFO_DVDIF_YES) return File_DvDif_DisableAudioIfIsInContainer_Get()?"1":"0"; #else //defined(MEDIAINFO_DVDIF_YES) return __T("DVDIF is disabled due to compilation options"); #endif //defined(MEDIAINFO_DVDIF_YES) } else if (Option_Lower==__T("file_dvdif_ignoretransmittingflags")) { #if defined(MEDIAINFO_DVDIF_YES) File_DvDif_IgnoreTransmittingFlags_Set(!(Value==__T("0") || Value.empty())); return __T(""); #else //defined(MEDIAINFO_DVDIF_YES) return __T("DVDIF is disabled due to compilation options"); #endif //defined(MEDIAINFO_DVDIF_YES) } else if (Option_Lower==__T("file_dvdif_ignoretransmittingflags_get")) { #if defined(MEDIAINFO_DVDIF_YES) return File_DvDif_IgnoreTransmittingFlags_Get()?"1":"0"; #else //defined(MEDIAINFO_DVDIF_YES) return __T("DVDIF is disabled due to compilation options"); #endif //defined(MEDIAINFO_DVDIF_YES) } else if (Option_Lower==__T("file_dvdif_analysis")) { #if defined(MEDIAINFO_DVDIF_ANALYZE_YES) File_DvDif_Analysis_Set(!(Value==__T("0") || Value.empty())); return __T(""); #else //defined(MEDIAINFO_DVDIF_ANALYZE_YES) return __T("DVDIF Analysis is disabled due to compilation options"); #endif //defined(MEDIAINFO_DVDIF_ANALYZE_YES) } else if (Option_Lower==__T("file_dvdif_analysis_get")) { #if defined(MEDIAINFO_DVDIF_ANALYZE_YES) return File_DvDif_Analysis_Get()?"1":"0"; #else //defined(MEDIAINFO_DVDIF_ANALYZE_YES) return __T("DVDIF Analysis is disabled due to compilation options"); #endif //defined(MEDIAINFO_DVDIF_ANALYZE_YES) } else if (Option_Lower==__T("file_macroblocks_parse")) { #if MEDIAINFO_MACROBLOCKS File_Macroblocks_Parse_Set(!(Value==__T("0") || Value.empty())); return __T(""); #else //MEDIAINFO_MACROBLOCKS return __T("Macroblock parsing is disabled due to compilation options"); #endif //MEDIAINFO_MACROBLOCKS } else if (Option_Lower==__T("file_macroblocks_parse_get")) { #if MEDIAINFO_MACROBLOCKS return File_Macroblocks_Parse_Get()?"1":"0"; #else //MEDIAINFO_MACROBLOCKS return __T("Macroblock parsing is disabled due to compilation options"); #endif //MEDIAINFO_MACROBLOCKS } else if (Option_Lower==__T("file_growingfile_delay")) { File_GrowingFile_Delay_Set(Ztring(Value).To_float64()); return Ztring(); } else if (Option_Lower==__T("file_growingfile_delay_get")) { return Ztring::ToZtring(File_GrowingFile_Delay_Get()); } else if (Option_Lower==__T("file_curl")) { #if defined(MEDIAINFO_LIBCURL_YES) File_Curl_Set(Value); return __T(""); #else //defined(MEDIAINFO_LIBCURL_YES) return __T("Libcurl support is disabled due to compilation options"); #endif //defined(MEDIAINFO_LIBCURL_YES) } else if (Option_Lower.find(__T("file_curl,"))==0 || Option_Lower.find(__T("file_curl;"))==0) { #if defined(MEDIAINFO_LIBCURL_YES) File_Curl_Set(Option.substr(10), Value); return __T(""); #else //defined(MEDIAINFO_LIBCURL_YES) return __T("Libcurl support is disabled due to compilation options"); #endif //defined(MEDIAINFO_LIBCURL_YES) } else if (Option_Lower==__T("file_curl_get")) { #if defined(MEDIAINFO_LIBCURL_YES) return File_Curl_Get(Value); #else //defined(MEDIAINFO_LIBCURL_YES) return __T("Libcurl support is disabled due to compilation options"); #endif //defined(MEDIAINFO_LIBCURL_YES) } else if (Option_Lower==__T("file_mmsh_describe_only")) { #if defined(MEDIAINFO_LIBMMS_YES) File_Mmsh_Describe_Only_Set(!(Value==__T("0") || Value.empty())); return __T(""); #else //defined(MEDIAINFO_LIBMMS_YES) return __T("Libmms support is disabled due to compilation options"); #endif //defined(MEDIAINFO_LIBMMS_YES) } else if (Option_Lower==__T("file_mmsh_describe_only_get")) { #if defined(MEDIAINFO_LIBMMS_YES) return File_Mmsh_Describe_Only_Get()?"1":"0"; #else //defined(MEDIAINFO_LIBMMS_YES) return __T("Libmms support is disabled due to compilation options"); #endif //defined(MEDIAINFO_LIBMMS_YES) } else if (Option_Lower==__T("file_eia708_displayemptystream")) { File_Eia708_DisplayEmptyStream_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_eia708_displayemptystream_get")) { return File_Eia708_DisplayEmptyStream_Get()?"1":"0"; } else if (Option_Lower==__T("file_eia608_displayemptystream")) { File_Eia608_DisplayEmptyStream_Set(!(Value==__T("0") || Value.empty())); return __T(""); } else if (Option_Lower==__T("file_eia608_displayemptystream_get")) { return File_Eia608_DisplayEmptyStream_Get()?"1":"0"; } else if (Option_Lower==__T("file_ac3_ignorecrc")) { #if defined(MEDIAINFO_AC3_YES) File_Ac3_IgnoreCrc_Set(!(Value==__T("0") || Value.empty())); return __T(""); #else //defined(MEDIAINFO_AC3_YES) return __T("AC-3 support is disabled due to compilation options"); #endif //defined(MEDIAINFO_AC3_YES) } else if (Option_Lower==__T("file_ac3_ignorecrc_get")) { #if defined(MEDIAINFO_AC3_YES) return File_Ac3_IgnoreCrc_Get()?"1":"0"; #else //defined(MEDIAINFO_AC3_YES) return __T("AC-3 support is disabled due to compilation options"); #endif //defined(MEDIAINFO_AC3_YES) } else if (Option_Lower==__T("file_event_callbackfunction")) { #if MEDIAINFO_EVENTS return Event_CallBackFunction_Set(Value); #else //MEDIAINFO_EVENTS return __T("Event manager is disabled due to compilation options"); #endif //MEDIAINFO_EVENTS } else return __T("Option not known"); } //*************************************************************************** // File Is Seekable //*************************************************************************** //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_IsSeekable_Set (bool NewValue) { CriticalSectionLocker CSL(CS); FileIsSeekable=NewValue; } bool MediaInfo_Config_MediaInfo::File_IsSeekable_Get () { CriticalSectionLocker CSL(CS); return FileIsSeekable; } //*************************************************************************** // File Is Sub //*************************************************************************** //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_IsSub_Set (bool NewValue) { CriticalSectionLocker CSL(CS); FileIsSub=NewValue; } bool MediaInfo_Config_MediaInfo::File_IsSub_Get () { CriticalSectionLocker CSL(CS); return FileIsSub; } //*************************************************************************** // File Is Detecting Duration //*************************************************************************** //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_IsDetectingDuration_Set (bool NewValue) { CriticalSectionLocker CSL(CS); FileIsDetectingDuration=NewValue; } bool MediaInfo_Config_MediaInfo::File_IsDetectingDuration_Get () { CriticalSectionLocker CSL(CS); return FileIsDetectingDuration; } //*************************************************************************** // File Is Referenced //*************************************************************************** //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_IsReferenced_Set (bool NewValue) { CriticalSectionLocker CSL(CS); FileIsReferenced=NewValue; } bool MediaInfo_Config_MediaInfo::File_IsReferenced_Get () { CriticalSectionLocker CSL(CS); return FileIsReferenced; } //*************************************************************************** // File Keep Info //*************************************************************************** //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_KeepInfo_Set (bool NewValue) { CriticalSectionLocker CSL(CS); FileKeepInfo=NewValue; } bool MediaInfo_Config_MediaInfo::File_KeepInfo_Get () { CriticalSectionLocker CSL(CS); return FileKeepInfo; } //*************************************************************************** // File test continuous file names //*************************************************************************** //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_TestContinuousFileNames_Set (bool NewValue) { CriticalSectionLocker CSL(CS); FileTestContinuousFileNames=NewValue; } bool MediaInfo_Config_MediaInfo::File_TestContinuousFileNames_Get () { CriticalSectionLocker CSL(CS); return FileTestContinuousFileNames; } //*************************************************************************** // Stop after filled //*************************************************************************** //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_StopAfterFilled_Set (bool NewValue) { CriticalSectionLocker CSL(CS); FileStopAfterFilled=NewValue; } bool MediaInfo_Config_MediaInfo::File_StopAfterFilled_Get () { CriticalSectionLocker CSL(CS); return FileStopAfterFilled; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_StopSubStreamAfterFilled_Set (bool NewValue) { CriticalSectionLocker CSL(CS); FileStopSubStreamAfterFilled=NewValue; } bool MediaInfo_Config_MediaInfo::File_StopSubStreamAfterFilled_Get () { CriticalSectionLocker CSL(CS); return FileStopSubStreamAfterFilled; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_Audio_MergeMonoStreams_Set (bool NewValue) { CriticalSectionLocker CSL(CS); Audio_MergeMonoStreams=NewValue; } bool MediaInfo_Config_MediaInfo::File_Audio_MergeMonoStreams_Get () { CriticalSectionLocker CSL(CS); return Audio_MergeMonoStreams; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_Demux_Interleave_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_Demux_Interleave=NewValue; } bool MediaInfo_Config_MediaInfo::File_Demux_Interleave_Get () { CriticalSectionLocker CSL(CS); return File_Demux_Interleave; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_ID_OnlyRoot_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_ID_OnlyRoot=NewValue; } bool MediaInfo_Config_MediaInfo::File_ID_OnlyRoot_Get () { CriticalSectionLocker CSL(CS); return File_ID_OnlyRoot; } //--------------------------------------------------------------------------- #if MEDIAINFO_MD5 void MediaInfo_Config_MediaInfo::File_Md5_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_Md5=NewValue; } bool MediaInfo_Config_MediaInfo::File_Md5_Get () { CriticalSectionLocker CSL(CS); return File_Md5; } #endif //MEDIAINFO_MD5 //--------------------------------------------------------------------------- #if defined(MEDIAINFO_REFERENCES_YES) void MediaInfo_Config_MediaInfo::File_CheckSideCarFiles_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_CheckSideCarFiles=NewValue; } bool MediaInfo_Config_MediaInfo::File_CheckSideCarFiles_Get () { CriticalSectionLocker CSL(CS); return File_CheckSideCarFiles; } #endif //defined(MEDIAINFO_REFERENCES_YES) //--------------------------------------------------------------------------- #if MEDIAINFO_ADVANCED void MediaInfo_Config_MediaInfo::File_IgnoreSequenceFileSize_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_IgnoreSequenceFileSize=NewValue; } bool MediaInfo_Config_MediaInfo::File_IgnoreSequenceFileSize_Get () { CriticalSectionLocker CSL(CS); return File_IgnoreSequenceFileSize; } #endif //MEDIAINFO_ADVANCED //--------------------------------------------------------------------------- #if MEDIAINFO_ADVANCED void MediaInfo_Config_MediaInfo::File_DefaultFrameRate_Set (float64 NewValue) { CriticalSectionLocker CSL(CS); File_DefaultFrameRate=NewValue; #if MEDIAINFO_DEMUX Demux_Rate=File_DefaultFrameRate; #endif //MEDIAINFO_DEMUX } float64 MediaInfo_Config_MediaInfo::File_DefaultFrameRate_Get () { CriticalSectionLocker CSL(CS); return File_DefaultFrameRate; } #endif //MEDIAINFO_ADVANCED //--------------------------------------------------------------------------- #if MEDIAINFO_ADVANCED void MediaInfo_Config_MediaInfo::File_Source_List_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_Source_List=NewValue; } bool MediaInfo_Config_MediaInfo::File_Source_List_Get () { CriticalSectionLocker CSL(CS); return File_Source_List; } #endif //MEDIAINFO_ADVANCED //--------------------------------------------------------------------------- #if MEDIAINFO_ADVANCED void MediaInfo_Config_MediaInfo::File_RiskyBitRateEstimation_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_RiskyBitRateEstimation=NewValue; } bool MediaInfo_Config_MediaInfo::File_RiskyBitRateEstimation_Get () { CriticalSectionLocker CSL(CS); return File_RiskyBitRateEstimation; } #endif //MEDIAINFO_ADVANCED //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX #if MEDIAINFO_ADVANCED void MediaInfo_Config_MediaInfo::File_Demux_Unpacketize_StreamLayoutChange_Skip_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_Demux_Unpacketize_StreamLayoutChange_Skip=NewValue; } bool MediaInfo_Config_MediaInfo::File_Demux_Unpacketize_StreamLayoutChange_Skip_Get () { CriticalSectionLocker CSL(CS); return File_Demux_Unpacketize_StreamLayoutChange_Skip; } #endif //MEDIAINFO_ADVANCED #endif //MEDIAINFO_DEMUX //*************************************************************************** // File name from somewhere else //*************************************************************************** //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_FileName_Set (const Ztring &NewValue) { CriticalSectionLocker CSL(CS); File_FileName=NewValue; } Ztring MediaInfo_Config_MediaInfo::File_FileName_Get () { CriticalSectionLocker CSL(CS); return File_FileName; } //*************************************************************************** // File name format //*************************************************************************** //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_FileNameFormat_Set (const Ztring &NewValue) { CriticalSectionLocker CSL(CS); File_FileNameFormat=NewValue; } Ztring MediaInfo_Config_MediaInfo::File_FileNameFormat_Get () { CriticalSectionLocker CSL(CS); return File_FileNameFormat; } //*************************************************************************** // Time to live //*************************************************************************** //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_TimeToLive_Set (float64 NewValue) { CriticalSectionLocker CSL(CS); File_TimeToLive=NewValue; } float64 MediaInfo_Config_MediaInfo::File_TimeToLive_Get () { CriticalSectionLocker CSL(CS); return File_TimeToLive; } //*************************************************************************** // Partial file (begin and end are cut) //*************************************************************************** //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_Partial_Begin_Set (const Ztring &NewValue) { CriticalSectionLocker CSL(CS); File_Partial_Begin=NewValue; } Ztring MediaInfo_Config_MediaInfo::File_Partial_Begin_Get () { CriticalSectionLocker CSL(CS); return File_Partial_Begin; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_Partial_End_Set (const Ztring &NewValue) { CriticalSectionLocker CSL(CS); File_Partial_End=NewValue; } Ztring MediaInfo_Config_MediaInfo::File_Partial_End_Get () { CriticalSectionLocker CSL(CS); return File_Partial_End; } //*************************************************************************** // Force Parser //*************************************************************************** //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_ForceParser_Set (const Ztring &NewValue) { CriticalSectionLocker CSL(CS); File_ForceParser=NewValue; } Ztring MediaInfo_Config_MediaInfo::File_ForceParser_Get () { CriticalSectionLocker CSL(CS); return File_ForceParser; } //*************************************************************************** /* 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. */ //*************************************************************************** //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_Buffer_Size_Hint_Pointer_Set (size_t* NewValue) { CriticalSectionLocker CSL(CS); File_Buffer_Size_Hint_Pointer=NewValue; } size_t* MediaInfo_Config_MediaInfo::File_Buffer_Size_Hint_Pointer_Get () { CriticalSectionLocker CSL(CS); return File_Buffer_Size_Hint_Pointer; } //*************************************************************************** // Filter //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_FILTER void MediaInfo_Config_MediaInfo::File_Filter_Set (int64u NewValue) { CriticalSectionLocker CSL(CS); File_Filter_16[(int16u)NewValue]=true; File_Filter_HasChanged_=true; } bool MediaInfo_Config_MediaInfo::File_Filter_Get (const int16u Value) { CriticalSectionLocker CSL(CS); //Test bool Exists; if (File_Filter_16.empty()) Exists=true; else Exists=(File_Filter_16.find(Value)!=File_Filter_16.end()); return Exists; } bool MediaInfo_Config_MediaInfo::File_Filter_Get () { CriticalSectionLocker CSL(CS); bool Exist=!File_Filter_16.empty(); return Exist; } void MediaInfo_Config_MediaInfo::File_Filter_Audio_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_Filter_Audio=NewValue; } bool MediaInfo_Config_MediaInfo::File_Filter_Audio_Get () { CriticalSectionLocker CSL(CS); return File_Filter_Audio; } bool MediaInfo_Config_MediaInfo::File_Filter_HasChanged () { CriticalSectionLocker CSL(CS); bool File_Filter_HasChanged_Temp=File_Filter_HasChanged_; File_Filter_HasChanged_=false; return File_Filter_HasChanged_Temp; } #endif //MEDIAINFO_FILTER //*************************************************************************** // Duplicate //*************************************************************************** #if MEDIAINFO_DUPLICATE Ztring MediaInfo_Config_MediaInfo::File_Duplicate_Set (const Ztring &Value_In) { //Preparing for File__Duplicate... CS.Enter(); File__Duplicate_List.push_back(Value_In); //Handling Memory index Ztring ToReturn; ZtringList List=Value_In; for (size_t Pos=0; Pos=File__Duplicate_List.size()) return Ztring(); //Nothing or not more than the last time Ztring Temp=File__Duplicate_List[AlreadyRead_Pos]; return Temp; } bool MediaInfo_Config_MediaInfo::File_Duplicate_Get_AlwaysNeeded (size_t AlreadyRead_Pos) { CriticalSectionLocker CSL(CS); bool Temp=AlreadyRead_Pos>=File__Duplicate_List.size(); return !Temp; //True if there is something to read } size_t MediaInfo_Config_MediaInfo::File__Duplicate_Memory_Indexes_Get (const Ztring &Value) { CriticalSectionLocker CSL(CS); return File__Duplicate_Memory_Indexes.Find(Value); } void MediaInfo_Config_MediaInfo::File__Duplicate_Memory_Indexes_Erase (const Ztring &Value) { CriticalSectionLocker CSL(CS); size_t Pos=File__Duplicate_Memory_Indexes.Find(Value); if (Pos!=Error) File__Duplicate_Memory_Indexes[Pos].clear(); } #endif //MEDIAINFO_DUPLICATE //*************************************************************************** // Demux //*************************************************************************** #if MEDIAINFO_DEMUX //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::Demux_ForceIds_Set (bool NewValue) { CriticalSectionLocker CSL(CS); Demux_ForceIds=NewValue; } bool MediaInfo_Config_MediaInfo::Demux_ForceIds_Get () { CriticalSectionLocker CSL(CS); return Demux_ForceIds; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::Demux_PCM_20bitTo16bit_Set (bool NewValue) { CriticalSectionLocker CSL(CS); Demux_PCM_20bitTo16bit=NewValue; } bool MediaInfo_Config_MediaInfo::Demux_PCM_20bitTo16bit_Get () { CriticalSectionLocker CSL(CS); return Demux_PCM_20bitTo16bit; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::Demux_PCM_20bitTo24bit_Set (bool NewValue) { CriticalSectionLocker CSL(CS); Demux_PCM_20bitTo24bit=NewValue; } bool MediaInfo_Config_MediaInfo::Demux_PCM_20bitTo24bit_Get () { CriticalSectionLocker CSL(CS); return Demux_PCM_20bitTo24bit; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10_Set (bool NewValue) { CriticalSectionLocker CSL(CS); Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10=NewValue; } bool MediaInfo_Config_MediaInfo::Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10_Get () { CriticalSectionLocker CSL(CS); return Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::Demux_Unpacketize_Set (bool NewValue) { CriticalSectionLocker CSL(CS); Demux_Unpacketize=NewValue; } bool MediaInfo_Config_MediaInfo::Demux_Unpacketize_Get () { CriticalSectionLocker CSL(CS); return Demux_Unpacketize; } #endif //MEDIAINFO_DEMUX //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX void MediaInfo_Config_MediaInfo::Demux_Rate_Set (float64 NewValue) { CriticalSectionLocker CSL(CS); Demux_Rate=NewValue; } float64 MediaInfo_Config_MediaInfo::Demux_Rate_Get () { CriticalSectionLocker CSL(CS); return Demux_Rate; } #endif //MEDIAINFO_DEMUX //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX void MediaInfo_Config_MediaInfo::Demux_FirstDts_Set (int64u NewValue) { CriticalSectionLocker CSL(CS); Demux_FirstDts=NewValue; } int64u MediaInfo_Config_MediaInfo::Demux_FirstDts_Get () { CriticalSectionLocker CSL(CS); return Demux_FirstDts; } #endif //MEDIAINFO_DEMUX //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX void MediaInfo_Config_MediaInfo::Demux_FirstFrameNumber_Set (int64u NewValue) { CriticalSectionLocker CSL(CS); Demux_FirstFrameNumber=NewValue; } int64u MediaInfo_Config_MediaInfo::Demux_FirstFrameNumber_Get () { CriticalSectionLocker CSL(CS); return Demux_FirstFrameNumber; } #endif //MEDIAINFO_DEMUX //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX void MediaInfo_Config_MediaInfo::Demux_InitData_Set (int8u NewValue) { CriticalSectionLocker CSL(CS); Demux_InitData=NewValue; } int8u MediaInfo_Config_MediaInfo::Demux_InitData_Get () { CriticalSectionLocker CSL(CS); return Demux_InitData; } #endif //MEDIAINFO_DEMUX //*************************************************************************** // IBI support //*************************************************************************** #if MEDIAINFO_IBI //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::Ibi_Set (const Ztring &Value) { string Data_Base64=Value.To_UTF8(); CriticalSectionLocker CSL(CS); Ibi=Base64::decode(Data_Base64); } string MediaInfo_Config_MediaInfo::Ibi_Get () { CriticalSectionLocker CSL(CS); return Ibi; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::Ibi_Create_Set (bool NewValue) { CriticalSectionLocker CSL(CS); Ibi_Create=NewValue; } bool MediaInfo_Config_MediaInfo::Ibi_Create_Get () { CriticalSectionLocker CSL(CS); return Ibi_Create; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::Ibi_UseIbiInfoIfAvailable_Set (bool NewValue) { CriticalSectionLocker CSL(CS); Ibi_UseIbiInfoIfAvailable=NewValue; } bool MediaInfo_Config_MediaInfo::Ibi_UseIbiInfoIfAvailable_Get () { CriticalSectionLocker CSL(CS); return Ibi_UseIbiInfoIfAvailable; } #endif //MEDIAINFO_IBI //*************************************************************************** // NextPacket //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_NEXTPACKET void MediaInfo_Config_MediaInfo::NextPacket_Set (bool NewValue) { CriticalSectionLocker CSL(CS); NextPacket=NewValue; } bool MediaInfo_Config_MediaInfo::NextPacket_Get () { CriticalSectionLocker CSL(CS); return NextPacket; } #endif //MEDIAINFO_NEXTPACKET //*************************************************************************** // SubFile //*************************************************************************** #if MEDIAINFO_EVENTS //--------------------------------------------------------------------------- ZtringListList MediaInfo_Config_MediaInfo::SubFile_Config_Get () { CriticalSectionLocker CSL(CS); return SubFile_Config; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::SubFile_StreamID_Set (int64u Value) { CriticalSectionLocker CSL(CS); SubFile_StreamID=Value; } //--------------------------------------------------------------------------- int64u MediaInfo_Config_MediaInfo::SubFile_StreamID_Get () { CriticalSectionLocker CSL(CS); return SubFile_StreamID; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::SubFile_IDs_Set (Ztring Value) { CriticalSectionLocker CSL(CS); SubFile_IDs=Value; } //--------------------------------------------------------------------------- Ztring MediaInfo_Config_MediaInfo::SubFile_IDs_Get () { CriticalSectionLocker CSL(CS); return SubFile_IDs; } #endif //MEDIAINFO_EVENTS //*************************************************************************** // SubFile //*************************************************************************** #if MEDIAINFO_EVENTS //--------------------------------------------------------------------------- bool MediaInfo_Config_MediaInfo::ParseUndecodableFrames_Get () { CriticalSectionLocker CSL(CS); return ParseUndecodableFrames; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::ParseUndecodableFrames_Set (bool Value) { CriticalSectionLocker CSL(CS); ParseUndecodableFrames=Value; } #endif //MEDIAINFO_EVENTS //*************************************************************************** // Event //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_EVENTS bool MediaInfo_Config_MediaInfo::Event_CallBackFunction_IsSet () { CriticalSectionLocker CSL(CS); return Event_CallBackFunction?true:false; } #endif //MEDIAINFO_EVENTS //--------------------------------------------------------------------------- #if MEDIAINFO_EVENTS Ztring MediaInfo_Config_MediaInfo::Event_CallBackFunction_Set (const Ztring &Value) { ZtringList List=Value; CriticalSectionLocker CSL(CS); if (List.empty()) { Event_CallBackFunction=(MediaInfo_Event_CallBackFunction*)NULL; Event_UserHandler=NULL; } else for (size_t Pos=0; PosFrameNumber!=(int64u)-1) Temp->FrameNumber+=Demux_Offset_Frame; if (Temp->FrameNumber_PresentationOrder!=(int64u)-1) Temp->FrameNumber_PresentationOrder+=Demux_Offset_Frame; } if (Demux_Offset_DTS!=(int64u)-1) // && (Demux_Offset_DTS_FromStream==(int64u)-1 || Demux_Offset_DTS!=Demux_Offset_DTS_FromStream)) { MediaInfo_Event_Generic* Temp=(MediaInfo_Event_Generic*)Data_Content; if (Temp->DTS!=(int64u)-1) { Temp->DTS+=Demux_Offset_DTS; if (Demux_Offset_DTS_FromStream!=(int64u)-1) Temp->DTS-=Demux_Offset_DTS_FromStream; } if (Temp->PTS!=(int64u)-1) { Temp->PTS+=Demux_Offset_DTS; if (Demux_Offset_DTS_FromStream!=(int64u)-1) Temp->PTS-=Demux_Offset_DTS_FromStream; } } } if (Source) { event_delayed* Event=new event_delayed(Data_Content, Data_Size, File_Name); Events_Delayed[Source].push_back(Event); // Copying buffers int32u* EventCode=(int32u*)Data_Content; if (((*EventCode)&0x00FFFFFF)==((MediaInfo_Event_Global_Demux<<8)|4) && Data_Size==sizeof(MediaInfo_Event_Global_Demux_4)) { MediaInfo_Event_Global_Demux_4* Old=(MediaInfo_Event_Global_Demux_4*)Data_Content; MediaInfo_Event_Global_Demux_4* New=(MediaInfo_Event_Global_Demux_4*)Event->Data_Content; if (New->Content_Size) { int8u* Content=new int8u[New->Content_Size]; std::memcpy(Content, Old->Content, New->Content_Size*sizeof(int8u)); New->Content=Content; } if (New->Offsets_Size) { int64u* Offsets_Stream=new int64u[New->Offsets_Size]; std::memcpy(Offsets_Stream, Old->Offsets_Stream, New->Offsets_Size*sizeof(int64u)); New->Offsets_Stream=Offsets_Stream; int64u* Offsets_Content=new int64u[New->Offsets_Size]; std::memcpy(Offsets_Content, Old->Offsets_Content, New->Offsets_Size*sizeof(int64u)); New->Offsets_Content=Offsets_Content; } if (New->OriginalContent_Size) { int8u* OriginalContent=new int8u[New->OriginalContent_Size]; std::memcpy(OriginalContent, Old->OriginalContent, New->OriginalContent_Size*sizeof(int8u)); New->OriginalContent=OriginalContent; } } } else if (Event_CallBackFunction) Event_CallBackFunction ((unsigned char*)Data_Content, Data_Size, Event_UserHandler); else if (!File_Name.empty()) { MediaInfo_Event_Generic* Event_Generic=(MediaInfo_Event_Generic*)Data_Content; if ((Event_Generic->EventCode&0x00FFFFFF)==((MediaInfo_Event_Global_Demux<<8)|0x04)) //Demux version 4 { if (!MediaInfoLib::Config.Demux_Get()) return; MediaInfo_Event_Global_Demux_4* Event=(MediaInfo_Event_Global_Demux_4*)Data_Content; Ztring File_Name_Final(File_Name); if (Event->StreamIDs_Size==0) File_Name_Final+=__T(".demux"); else for (size_t Pos=0; PosStreamIDs_Size; Pos++) { if (Event->StreamIDs_Width[Pos]==17) { Ztring ID; ID.From_CC4((int32u)Event->StreamIDs[Pos]); File_Name_Final+=__T('.')+ID; } else if (Event->StreamIDs_Width[Pos]) { Ztring ID; ID.From_Number(Event->StreamIDs[Pos], 16); while (ID.size()StreamIDs_Width[Pos]) ID.insert(0, 1, __T('0')); if (ID.size()>Event->StreamIDs_Width[Pos]) ID.erase(0, ID.size()-Event->StreamIDs_Width[Pos]); File_Name_Final+=__T('.')+ID; } else File_Name_Final+=__T(".raw"); } File F; F.Open(File_Name_Final, File::Access_Write_Append); F.Write(Event->Content, Event->Content_Size); } } } void MediaInfo_Config_MediaInfo::Event_Accepted (File__Analyze* Source) { #if MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET if (Demux_EventWasSent && NextPacket_Get()) { Events_Delayed_CurrentSource=Source; return; } #endif //MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET for (events_delayed::iterator Event=Events_Delayed.begin(); Event!=Events_Delayed.end(); ++Event) if (Event->first==Source) { for (size_t Pos=0; Possecond.size(); Pos++) if (Event->second[Pos]) { Event_Send(NULL, Event->second[Pos]->Data_Content, Event->second[Pos]->Data_Size, Event->second[Pos]->File_Name); int32u EventCode=*((int32u*)Event->second[Pos]->Data_Content); bool IsDemux=(EventCode&0x00FFFF00)==(MediaInfo_Event_Global_Demux<<8); if (IsDemux) { MediaInfo_Event_Global_Demux_4* Old=(MediaInfo_Event_Global_Demux_4*)Event->second[Pos]->Data_Content; delete[] Old->Content; Old->Content=NULL; if (Old->Offsets_Size) { delete[] Old->Offsets_Content; Old->Offsets_Content=NULL; } if (Old->Offsets_Size) { delete[] Old->OriginalContent; Old->OriginalContent=NULL; } } delete Event->second[Pos]; Event->second[Pos]=NULL; #if MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET if (IsDemux && NextPacket_Get()) { Demux_EventWasSent=true; Event->second.erase(Event->second.begin(), Event->second.begin()+Pos); Events_Delayed_CurrentSource=Source; return; } #endif //MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET } Events_Delayed.erase(Event->first); return; } } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::Event_SubFile_Start(const Ztring &FileName_Absolute) { Ztring FileName_Relative; if (File_Names_RootDirectory.empty()) { FileName FN(FileName_Absolute); FileName_Relative=FN.Name_Get(); if (!FN.Extension_Get().empty()) { FileName_Relative+=__T('.'); FileName_Relative+=FN.Extension_Get(); } } else { Ztring Root=File_Names_RootDirectory+PathSeparator; FileName_Relative=FileName_Absolute; if (FileName_Relative.find(Root)==0) FileName_Relative.erase(0, Root.size()); } struct MediaInfo_Event_General_SubFile_Start_0 Event; memset(&Event, 0xFF, sizeof(struct MediaInfo_Event_Generic)); Event.EventCode=MediaInfo_EventCode_Create(0, MediaInfo_Event_General_SubFile_Start, 0); Event.EventSize=sizeof(struct MediaInfo_Event_General_SubFile_Start_0); Event.StreamIDs_Size=0; std::string FileName_Relative_Ansi=FileName_Relative.To_UTF8(); std::wstring FileName_Relative_Unicode=FileName_Relative.To_Unicode(); std::string FileName_Absolute_Ansi=FileName_Absolute.To_UTF8(); std::wstring FileName_Absolute_Unicode=FileName_Absolute.To_Unicode(); Event.FileName_Relative=FileName_Relative_Ansi.c_str(); Event.FileName_Relative_Unicode=FileName_Relative_Unicode.c_str(); Event.FileName_Absolute=FileName_Absolute_Ansi.c_str(); Event.FileName_Absolute_Unicode=FileName_Absolute_Unicode.c_str(); Event_Send(NULL, (const int8u*)&Event, Event.EventSize); } #endif //MEDIAINFO_EVENTS //*************************************************************************** // Force Parser //*************************************************************************** //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_MpegTs_ForceMenu_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_MpegTs_ForceMenu=NewValue; } bool MediaInfo_Config_MediaInfo::File_MpegTs_ForceMenu_Get () { CriticalSectionLocker CSL(CS); bool Temp=File_MpegTs_ForceMenu; return Temp; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_MpegTs_stream_type_Trust_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_MpegTs_stream_type_Trust=NewValue; } bool MediaInfo_Config_MediaInfo::File_MpegTs_stream_type_Trust_Get () { CS.Enter(); bool Temp=File_MpegTs_stream_type_Trust; CS.Leave(); return Temp; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_MpegTs_Atsc_transport_stream_id_Trust_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_MpegTs_Atsc_transport_stream_id_Trust=NewValue; } bool MediaInfo_Config_MediaInfo::File_MpegTs_Atsc_transport_stream_id_Trust_Get () { CS.Enter(); bool Temp=File_MpegTs_Atsc_transport_stream_id_Trust; CS.Leave(); return Temp; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_MpegTs_RealTime_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_MpegTs_RealTime=NewValue; } bool MediaInfo_Config_MediaInfo::File_MpegTs_RealTime_Get () { CS.Enter(); bool Temp=File_MpegTs_RealTime; CS.Leave(); return Temp; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_Bdmv_ParseTargetedFile_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_Bdmv_ParseTargetedFile=NewValue; } bool MediaInfo_Config_MediaInfo::File_Bdmv_ParseTargetedFile_Get () { CriticalSectionLocker CSL(CS); bool Temp=File_Bdmv_ParseTargetedFile; return Temp; } //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DVDIF_YES) void MediaInfo_Config_MediaInfo::File_DvDif_DisableAudioIfIsInContainer_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_DvDif_DisableAudioIfIsInContainer=NewValue; } bool MediaInfo_Config_MediaInfo::File_DvDif_DisableAudioIfIsInContainer_Get () { CriticalSectionLocker CSL(CS); bool Temp=File_DvDif_DisableAudioIfIsInContainer; return Temp; } #endif //defined(MEDIAINFO_DVDIF_YES) //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DVDIF_YES) void MediaInfo_Config_MediaInfo::File_DvDif_IgnoreTransmittingFlags_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_DvDif_IgnoreTransmittingFlags=NewValue; } bool MediaInfo_Config_MediaInfo::File_DvDif_IgnoreTransmittingFlags_Get () { CriticalSectionLocker CSL(CS); bool Temp=File_DvDif_IgnoreTransmittingFlags; return Temp; } #endif //defined(MEDIAINFO_DVDIF_YES) //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DVDIF_ANALYZE_YES) void MediaInfo_Config_MediaInfo::File_DvDif_Analysis_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_DvDif_Analysis=NewValue; } bool MediaInfo_Config_MediaInfo::File_DvDif_Analysis_Get () { CriticalSectionLocker CSL(CS); bool Temp=File_DvDif_Analysis; return Temp; } #endif //defined(MEDIAINFO_DVDIF_ANALYZE_YES) //--------------------------------------------------------------------------- #if MEDIAINFO_MACROBLOCKS void MediaInfo_Config_MediaInfo::File_Macroblocks_Parse_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_Macroblocks_Parse=NewValue; } bool MediaInfo_Config_MediaInfo::File_Macroblocks_Parse_Get () { CriticalSectionLocker CSL(CS); bool Temp=File_Macroblocks_Parse; return Temp; } #endif //MEDIAINFO_MACROBLOCKS //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_GrowingFile_Delay_Set (float64 NewValue) { CriticalSectionLocker CSL(CS); File_GrowingFile_Delay=NewValue; } float64 MediaInfo_Config_MediaInfo::File_GrowingFile_Delay_Get () { CriticalSectionLocker CSL(CS); float64 Temp=File_GrowingFile_Delay; return Temp; } //--------------------------------------------------------------------------- #if defined(MEDIAINFO_LIBCURL_YES) void MediaInfo_Config_MediaInfo::File_Curl_Set (const Ztring &NewValue) { size_t Pos=NewValue.find(__T(',')); if (Pos==string::npos) Pos=NewValue.find(__T(';')); if (Pos!=string::npos) { Ztring Field=NewValue.substr(0, Pos); Field.MakeLowerCase(); Ztring Value=NewValue.substr(Pos+1, string::npos); CriticalSectionLocker CSL(CS); Curl[Field]=Value; } } void MediaInfo_Config_MediaInfo::File_Curl_Set (const Ztring &Field_, const Ztring &NewValue) { Ztring Field=Field_; Field.MakeLowerCase(); CriticalSectionLocker CSL(CS); Curl[Field]=NewValue; } Ztring MediaInfo_Config_MediaInfo::File_Curl_Get (const Ztring &Field_) { Ztring Field=Field_; Field.MakeLowerCase(); CriticalSectionLocker CSL(CS); std::map::iterator Value=Curl.find(Field); if (Value==Curl.end()) return Ztring(); else return Curl[Field]; } #endif //defined(MEDIAINFO_LIBCURL_YES) //--------------------------------------------------------------------------- #if defined(MEDIAINFO_LIBMMS_YES) void MediaInfo_Config_MediaInfo::File_Mmsh_Describe_Only_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_Mmsh_Describe_Only=NewValue; } bool MediaInfo_Config_MediaInfo::File_Mmsh_Describe_Only_Get () { CriticalSectionLocker CSL(CS); bool Temp=File_Mmsh_Describe_Only; return Temp; } #endif //defined(MEDIAINFO_LIBMMS_YES) //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_Eia608_DisplayEmptyStream_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_Eia608_DisplayEmptyStream=NewValue; } bool MediaInfo_Config_MediaInfo::File_Eia608_DisplayEmptyStream_Get () { CriticalSectionLocker CSL(CS); bool Temp=File_Eia608_DisplayEmptyStream; return Temp; } //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::File_Eia708_DisplayEmptyStream_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_Eia708_DisplayEmptyStream=NewValue; } bool MediaInfo_Config_MediaInfo::File_Eia708_DisplayEmptyStream_Get () { CriticalSectionLocker CSL(CS); bool Temp=File_Eia708_DisplayEmptyStream; return Temp; } //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AC3_YES) void MediaInfo_Config_MediaInfo::File_Ac3_IgnoreCrc_Set (bool NewValue) { CriticalSectionLocker CSL(CS); File_Ac3_IgnoreCrc=NewValue; } bool MediaInfo_Config_MediaInfo::File_Ac3_IgnoreCrc_Get () { CriticalSectionLocker CSL(CS); bool Temp=File_Ac3_IgnoreCrc; return Temp; } #endif //defined(MEDIAINFO_AC3_YES) //*************************************************************************** // Analysis internal //*************************************************************************** //--------------------------------------------------------------------------- void MediaInfo_Config_MediaInfo::State_Set (float NewValue) { CriticalSectionLocker CSL(CS); State=NewValue; } float MediaInfo_Config_MediaInfo::State_Get () { CriticalSectionLocker CSL(CS); float Temp=State; return Temp; } } //NameSpace MediaInfoLib/Source/MediaInfo/MediaInfo_Config_MediaInfo.h100777 0 0 43130 12262743712 17005 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Configuration of MediaInfo (per MediaInfo block) // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_Config_MediaInfoH #define MediaInfo_Config_MediaInfoH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/MediaInfo_Internal_Const.h" #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Config.h" #include "MediaInfo/MediaInfo_Events.h" #include "ZenLib/File.h" #endif //MEDIAINFO_EVENTS #include "ZenLib/CriticalSection.h" #include "ZenLib/Translation.h" #include "ZenLib/InfoMap.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { #if MEDIAINFO_EVENTS class File__Analyze; #endif //MEDIAINFO_EVENTS //*************************************************************************** // Class MediaInfo_Config_MediaInfo //*************************************************************************** class MediaInfo_Config_MediaInfo { public : //Constructor/Destructor MediaInfo_Config_MediaInfo(); ~MediaInfo_Config_MediaInfo(); //General Ztring Option (const String &Option, const String &Value=Ztring()); void File_IsSeekable_Set (bool NewValue); bool File_IsSeekable_Get (); void File_IsSub_Set (bool NewValue); bool File_IsSub_Get (); void File_IsDetectingDuration_Set (bool NewValue); bool File_IsDetectingDuration_Get (); void File_IsReferenced_Set (bool NewValue); bool File_IsReferenced_Get (); void File_TestContinuousFileNames_Set (bool NewValue); bool File_TestContinuousFileNames_Get (); void File_KeepInfo_Set (bool NewValue); bool File_KeepInfo_Get (); void File_StopAfterFilled_Set (bool NewValue); bool File_StopAfterFilled_Get (); void File_StopSubStreamAfterFilled_Set (bool NewValue); bool File_StopSubStreamAfterFilled_Get (); void File_Audio_MergeMonoStreams_Set (bool NewValue); bool File_Audio_MergeMonoStreams_Get (); void File_Demux_Interleave_Set (bool NewValue); bool File_Demux_Interleave_Get (); void File_ID_OnlyRoot_Set (bool NewValue); bool File_ID_OnlyRoot_Get (); #if MEDIAINFO_ADVANCED void File_IgnoreSequenceFileSize_Set (bool NewValue); bool File_IgnoreSequenceFileSize_Get (); #endif //MEDIAINFO_ADVANCED #if MEDIAINFO_ADVANCED void File_DefaultFrameRate_Set (float64 NewValue); float64 File_DefaultFrameRate_Get (); #endif //MEDIAINFO_ADVANCED #if MEDIAINFO_ADVANCED void File_Source_List_Set (bool NewValue); bool File_Source_List_Get (); #endif //MEDIAINFO_ADVANCED #if MEDIAINFO_ADVANCED void File_RiskyBitRateEstimation_Set (bool NewValue); bool File_RiskyBitRateEstimation_Get (); #endif //MEDIAINFO_ADVANCED #if MEDIAINFO_DEMUX #if MEDIAINFO_ADVANCED void File_Demux_Unpacketize_StreamLayoutChange_Skip_Set (bool NewValue); bool File_Demux_Unpacketize_StreamLayoutChange_Skip_Get (); #endif //MEDIAINFO_ADVANCED #endif //MEDIAINFO_DEMUX #if MEDIAINFO_MD5 void File_Md5_Set (bool NewValue); bool File_Md5_Get (); #endif //MEDIAINFO_MD5 #if defined(MEDIAINFO_REFERENCES_YES) void File_CheckSideCarFiles_Set (bool NewValue); bool File_CheckSideCarFiles_Get (); #endif //defined(MEDIAINFO_REFERENCES_YES) void File_FileName_Set (const Ztring &NewValue); Ztring File_FileName_Get (); void File_FileNameFormat_Set (const Ztring &NewValue); Ztring File_FileNameFormat_Get (); void File_TimeToLive_Set (float64 NewValue); float64 File_TimeToLive_Get (); void File_Partial_Begin_Set (const Ztring &NewValue); Ztring File_Partial_Begin_Get (); void File_Partial_End_Set (const Ztring &NewValue); Ztring File_Partial_End_Get (); void File_ForceParser_Set (const Ztring &NewValue); Ztring File_ForceParser_Get (); void File_Buffer_Size_Hint_Pointer_Set (size_t* NewValue); size_t* File_Buffer_Size_Hint_Pointer_Get (); #if MEDIAINFO_NEXTPACKET void NextPacket_Set (bool NewValue); bool NextPacket_Get (); #endif //MEDIAINFO_NEXTPACKET #if MEDIAINFO_FILTER void File_Filter_Set (int64u NewValue); bool File_Filter_Get (const int16u Value); bool File_Filter_Get (); void File_Filter_Audio_Set (bool NewValue); bool File_Filter_Audio_Get (); bool File_Filter_HasChanged(); #endif //MEDIAINFO_FILTER #if MEDIAINFO_DUPLICATE Ztring File_Duplicate_Set (const Ztring &Value); Ztring File_Duplicate_Get (size_t AlreadyRead_Pos); //Requester must say how many Get() it already read bool File_Duplicate_Get_AlwaysNeeded (size_t AlreadyRead_Pos); //Requester must say how many Get() it already read #endif //MEDIAINFO_DEMUX #if MEDIAINFO_DUPLICATE size_t File__Duplicate_Memory_Indexes_Get (const Ztring &ToFind); void File__Duplicate_Memory_Indexes_Erase (const Ztring &ToFind); #endif //MEDIAINFO_DEMUX #if MEDIAINFO_EVENTS ZtringListList SubFile_Config_Get (); void SubFile_StreamID_Set(int64u Value); int64u SubFile_StreamID_Get(); void SubFile_IDs_Set(Ztring Value); Ztring SubFile_IDs_Get(); #endif //MEDIAINFO_EVENTS #if MEDIAINFO_EVENTS bool ParseUndecodableFrames_Get (); void ParseUndecodableFrames_Set (bool Value); #endif //MEDIAINFO_EVENTS #if MEDIAINFO_EVENTS bool Event_CallBackFunction_IsSet (); Ztring Event_CallBackFunction_Set (const Ztring &Value); Ztring Event_CallBackFunction_Get (); void Event_Send(File__Analyze* Source, const int8u* Data_Content, size_t Data_Size, const Ztring &File_Name=Ztring()); void Event_Accepted(File__Analyze* Source); void Event_SubFile_Start(const Ztring &FileName_Absolute); #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX void Demux_ForceIds_Set (bool NewValue); bool Demux_ForceIds_Get (); void Demux_PCM_20bitTo16bit_Set (bool NewValue); bool Demux_PCM_20bitTo16bit_Get (); void Demux_PCM_20bitTo24bit_Set (bool NewValue); bool Demux_PCM_20bitTo24bit_Get (); void Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10_Set (bool NewValue); bool Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10_Get (); void Demux_Unpacketize_Set (bool NewValue); bool Demux_Unpacketize_Get (); void Demux_Rate_Set (float64 NewValue); float64 Demux_Rate_Get (); void Demux_FirstDts_Set (int64u NewValue); int64u Demux_FirstDts_Get (); void Demux_FirstFrameNumber_Set (int64u NewValue); int64u Demux_FirstFrameNumber_Get (); void Demux_InitData_Set (int8u NewValue); int8u Demux_InitData_Get (); #endif //MEDIAINFO_DEMUX #if MEDIAINFO_IBI void Ibi_Set (const Ztring &NewValue); std::string Ibi_Get (); void Ibi_Create_Set (bool NewValue); bool Ibi_Create_Get (); void Ibi_UseIbiInfoIfAvailable_Set (bool NewValue); bool Ibi_UseIbiInfoIfAvailable_Get (); #endif //MEDIAINFO_IBI //Specific void File_MpegTs_ForceMenu_Set (bool NewValue); bool File_MpegTs_ForceMenu_Get (); void File_MpegTs_stream_type_Trust_Set (bool NewValue); bool File_MpegTs_stream_type_Trust_Get (); void File_MpegTs_Atsc_transport_stream_id_Trust_Set (bool NewValue); bool File_MpegTs_Atsc_transport_stream_id_Trust_Get (); void File_MpegTs_RealTime_Set (bool NewValue); bool File_MpegTs_RealTime_Get (); void File_Bdmv_ParseTargetedFile_Set (bool NewValue); bool File_Bdmv_ParseTargetedFile_Get (); #if defined(MEDIAINFO_DVDIF_YES) void File_DvDif_DisableAudioIfIsInContainer_Set (bool NewValue); bool File_DvDif_DisableAudioIfIsInContainer_Get (); void File_DvDif_IgnoreTransmittingFlags_Set (bool NewValue); bool File_DvDif_IgnoreTransmittingFlags_Get (); #endif //defined(MEDIAINFO_DVDIF_YES) #if defined(MEDIAINFO_DVDIF_ANALYZE_YES) void File_DvDif_Analysis_Set (bool NewValue); bool File_DvDif_Analysis_Get (); #endif //defined(MEDIAINFO_DVDIF_ANALYZE_YES) #if MEDIAINFO_MACROBLOCKS void File_Macroblocks_Parse_Set (bool NewValue); bool File_Macroblocks_Parse_Get (); #endif //MEDIAINFO_MACROBLOCKS void File_GrowingFile_Delay_Set(float64 Value); float64 File_GrowingFile_Delay_Get(); #if defined(MEDIAINFO_LIBCURL_YES) void File_Curl_Set (const Ztring &NewValue); void File_Curl_Set (const Ztring &Field, const Ztring &NewValue); Ztring File_Curl_Get (const Ztring &Field); #endif //defined(MEDIAINFO_LIBCURL_YES) #if defined(MEDIAINFO_LIBMMS_YES) void File_Mmsh_Describe_Only_Set (bool NewValue); bool File_Mmsh_Describe_Only_Get (); #endif //defined(MEDIAINFO_LIBMMS_YES) void File_Eia608_DisplayEmptyStream_Set (bool NewValue); bool File_Eia608_DisplayEmptyStream_Get (); void File_Eia708_DisplayEmptyStream_Set (bool NewValue); bool File_Eia708_DisplayEmptyStream_Get (); #if defined(MEDIAINFO_AC3_YES) void File_Ac3_IgnoreCrc_Set (bool NewValue); bool File_Ac3_IgnoreCrc_Get (); #endif //defined(MEDIAINFO_AC3_YES) //Analysis internal void State_Set (float State); float State_Get (); //Internal to MediaInfo, not thread safe ZtringList File_Names; std::vector File_Sizes; size_t File_Names_Pos; size_t File_Buffer_Size_Max; size_t File_Buffer_Size_ToRead; size_t File_Buffer_Size; int8u* File_Buffer; bool File_Buffer_Repeat; bool File_Buffer_Repeat_IsSupported; bool File_IsGrowing; bool File_IsNotGrowingAnymore; int64u File_Current_Offset; int64u File_Current_Size; int64u File_Size; float32 ParseSpeed; #if MEDIAINFO_EVENTS Ztring File_Names_RootDirectory; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX bool Demux_EventWasSent; int64u Demux_Offset_Frame; int64u Demux_Offset_DTS; int64u Demux_Offset_DTS_FromStream; File__Analyze* Events_Delayed_CurrentSource; #if MEDIAINFO_SEEK bool Demux_IsSeeking; #endif //MEDIAINFO_SEEK #endif //MEDIAINFO_DEMUX private : bool FileIsSeekable; bool FileIsSub; bool FileIsDetectingDuration; bool FileIsReferenced; bool FileTestContinuousFileNames; bool FileKeepInfo; bool FileStopAfterFilled; bool FileStopSubStreamAfterFilled; bool Audio_MergeMonoStreams; bool File_Demux_Interleave; bool File_ID_OnlyRoot; #if MEDIAINFO_ADVANCED bool File_IgnoreSequenceFileSize; float64 File_DefaultFrameRate; bool File_Source_List; bool File_RiskyBitRateEstimation; #if MEDIAINFO_DEMUX bool File_Demux_Unpacketize_StreamLayoutChange_Skip; #endif //MEDIAINFO_DEMUX #endif //MEDIAINFO_ADVANCED #if MEDIAINFO_MD5 bool File_Md5; #endif //MEDIAINFO_MD5 #if defined(MEDIAINFO_REFERENCES_YES) bool File_CheckSideCarFiles; #endif //defined(MEDIAINFO_REFERENCES_YES) Ztring File_FileName; Ztring File_FileNameFormat; float64 File_TimeToLive; Ztring File_Partial_Begin; Ztring File_Partial_End; Ztring File_ForceParser; size_t* File_Buffer_Size_Hint_Pointer; //Extra #if MEDIAINFO_NEXTPACKET bool NextPacket; #endif //MEDIAINFO_NEXTPACKET #if MEDIAINFO_FILTER std::map File_Filter_16; bool File_Filter_Audio; bool File_Filter_HasChanged_; #endif //MEDIAINFO_FILTER #if MEDIAINFO_DUPLICATE std::vector File__Duplicate_List; ZtringList File__Duplicate_Memory_Indexes; #endif //MEDIAINFO_DUPLICATE //Event #if MEDIAINFO_EVENTS MediaInfo_Event_CallBackFunction* Event_CallBackFunction; //void Event_Handler(unsigned char* Data_Content, size_t Data_Size, void* UserHandler) struct event_delayed { int8u* Data_Content; size_t Data_Size; Ztring File_Name; event_delayed (const int8u* Data_Content_, size_t Data_Size_, const Ztring &File_Name_) { File_Name=File_Name_; Data_Size=Data_Size_; Data_Content=new int8u[Data_Size]; std::memcpy(Data_Content, Data_Content_, Data_Size); } ~event_delayed () { delete[] Data_Content; //Data_Content=NULL; } }; typedef std::map > events_delayed; events_delayed Events_Delayed; void* Event_UserHandler; ZtringListList SubFile_Config; int64u SubFile_StreamID; bool ParseUndecodableFrames; Ztring SubFile_IDs; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX bool Demux_ForceIds; bool Demux_PCM_20bitTo16bit; bool Demux_PCM_20bitTo24bit; bool Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10; bool Demux_Unpacketize; float64 Demux_Rate; int64u Demux_FirstDts; int64u Demux_FirstFrameNumber; int8u Demux_InitData; #endif //MEDIAINFO_DEMUX #if MEDIAINFO_IBI std::string Ibi; bool Ibi_Create; bool Ibi_UseIbiInfoIfAvailable; #endif //MEDIAINFO_IBI //Specific bool File_MpegTs_ForceMenu; bool File_MpegTs_stream_type_Trust; bool File_MpegTs_Atsc_transport_stream_id_Trust; bool File_MpegTs_RealTime; bool File_Bdmv_ParseTargetedFile; #if defined(MEDIAINFO_DVDIF_YES) bool File_DvDif_DisableAudioIfIsInContainer; bool File_DvDif_IgnoreTransmittingFlags; #endif //defined(MEDIAINFO_DVDIF_ANALYZE_YES) #if defined(MEDIAINFO_DVDIF_YES) bool File_DvDif_Analysis; #endif //defined(MEDIAINFO_DVDIF_ANALYZE_YES) #if MEDIAINFO_MACROBLOCKS bool File_Macroblocks_Parse; #endif //MEDIAINFO_MACROBLOCKS float64 File_GrowingFile_Delay; #if defined(MEDIAINFO_LIBMMS_YES) bool File_Mmsh_Describe_Only; #endif //defined(MEDIAINFO_LIBMMS_YES) bool File_Eia608_DisplayEmptyStream; bool File_Eia708_DisplayEmptyStream; #if defined(MEDIAINFO_AC3_YES) bool File_Ac3_IgnoreCrc; #endif //defined(MEDIAINFO_AC3_YES) //Analysis internal float State; //Generic #if defined(MEDIAINFO_LIBCURL_YES) std::map Curl; #endif //defined(MEDIAINFO_LIBCURL_YES) ZenLib::CriticalSection CS; //Constructor MediaInfo_Config_MediaInfo (const MediaInfo_Config_MediaInfo&); // Prevent copy-construction MediaInfo_Config_MediaInfo& operator=(const MediaInfo_Config_MediaInfo&); // Prevent assignment }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/MediaInfo_Const.h100777 0 0 13050 12226004262 14737 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Global configuration of MediaInfo // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_ConstH #define MediaInfo_ConstH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include #include //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- /// \mainpage MediaInfoLib Index Page /// /// \section Interfaces /// /// There is 2 access methods /// /// - MediaInfo class \n /// To manage one file, this is the simplest interface. \n /// - MediaInfo::Open to analyse file \n /// - MediaInfo::Inform to have a summary \n /// - MediaInfo::Get to retreive one piece of information \n /// /// - MediaInfoList class \n /// To manage a list of files \n /// - MediaInfoList::Open to analyse file \n /// - MediaInfoList::Inform to have a summary \n /// - MediaInfoList::Get to retreive one piece of information \n /// - MediaInfoList::Close to close one file \n /// /// \section C C Interface (MediaInfo_*) /// For compatibility and DLL interface \n /// This is a C interface for the List class \n /// Note : Don't forget to include the MediaInfoDLL.h file in your source file! \n /// - Example of commands: /// - MediaInfo_Open to analyse file \n /// - MediaInfo_Inform to have a summary \n /// - MediaInfo_Get to retreive one piece of information \n /// - MediaInfo_Close to free memory \n /// //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- /// @brief Kinds of Stream enum stream_t { Stream_General, ///< StreamKind = General Stream_Video, ///< StreamKind = Video Stream_Audio, ///< StreamKind = Audio Stream_Text, ///< StreamKind = Text Stream_Other, ///< StreamKind = Chapters Stream_Image, ///< StreamKind = Image Stream_Menu, ///< StreamKind = Menu Stream_Max }; /// @brief Kind of information enum info_t { Info_Name, ///< InfoKind = Unique name of parameter Info_Text, ///< InfoKind = Value of parameter Info_Measure, ///< InfoKind = Unique name of measure unit of parameter Info_Options, ///< InfoKind = See infooptions_t Info_Name_Text, ///< InfoKind = Translated name of parameter Info_Measure_Text, ///< InfoKind = Translated name of measure unit Info_Info, ///< InfoKind = More information about the parameter Info_HowTo, ///< InfoKind = How this parameter is supported, could be N (No), B (Beta), R (Read only), W (Read/Write) Info_Domain, ///< InfoKind = Domain of this piece of information Info_Max }; /// Get(...)[infooptions_t] return a string like "YNYN..." \n /// Use this enum to know at what correspond the Y (Yes) or N (No) /// If Get(...)[0]==Y, then : /// @brief Option if InfoKind = Info_Options enum infooptions_t { InfoOption_ShowInInform, ///< Show this parameter in Inform() InfoOption_Reserved, ///< InfoOption_ShowInSupported, ///< Internal use only (info : Must be showed in Info_Capacities() ) InfoOption_TypeOfValue, ///< Value return by a standard Get() can be : T (Text), I (Integer, warning up to 64 bits), F (Float), D (Date), B (Binary datas coded Base64) (Numbers are in Base 10) InfoOption_Max }; /// @brief File opening options enum fileoptions_t { FileOption_Nothing =0x00, FileOption_NoRecursive =0x01, ///< Do not browse folders recursively FileOption_CloseAll =0x02, ///< Close all files before open FileOption_Max =0x04 }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //Char types #undef __T #define __T(__x) __T(__x) #if defined(UNICODE) || defined (_UNICODE) typedef wchar_t Char; ///< Unicode/Ansi independant char #undef __T #define __T(__x) L ## __x #else typedef char Char; ///< Unicode/Ansi independant char #undef __T #define __T(__x) __x #endif typedef std::basic_string String; ///< Unicode/Ansi independant string typedef std::basic_stringstream StringStream; ///< Unicode/Ansi independant stringstream typedef std::basic_istringstream tiStringStream; ///< Unicode/Ansi independant istringstream typedef std::basic_ostringstream toStringStream; ///< Unicode/Ansi independant ostringstream //--------------------------------------------------------------------------- } //NameSpace #endif MediaInfoLib/Source/MediaInfo/MediaInfo_Events.h100777 0 0 72305 12262525402 15131 0/* 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. */ /*Structures for MediaInfo events */ #ifndef MediaInfo_EventsH #define MediaInfo_EventsH /***************************************************************************/ /* Platforms (from libzen) */ /***************************************************************************/ /*-------------------------------------------------------------------------*/ /*Win32*/ #if defined(__NT__) || defined(_WIN32) || defined(WIN32) #ifndef WIN32 #define WIN32 #endif #ifndef _WIN32 #define _WIN32 #endif #ifndef __WIN32__ #define __WIN32__ 1 #endif #endif /*-------------------------------------------------------------------------*/ /*Win64*/ #if defined(_WIN64) || defined(WIN64) #ifndef WIN64 #define WIN64 #endif #ifndef _WIN64 #define _WIN64 #endif #ifndef __WIN64__ #define __WIN64__ 1 #endif #endif /*-------------------------------------------------------------------------*/ /*Windows*/ #if defined(WIN32) || defined(WIN64) #ifndef WINDOWS #define WINDOWS #endif #ifndef _WINDOWS #define _WINDOWS #endif #ifndef __WINDOWS__ #define __WINDOWS__ 1 #endif #endif /*-------------------------------------------------------------------------*/ /*Unix (Linux, HP, Sun, BeOS...)*/ #if defined(UNIX) || defined(_UNIX) || defined(__UNIX__) \ || defined(__unix) || defined(__unix__) \ || defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) \ || defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) \ || defined(__EMX__) || defined(__VMS) || defined(__BEOS__) #ifndef UNIX #define UNIX #endif #ifndef _UNIX #define _UNIX #endif #ifndef __UNIX__ #define __UNIX__ 1 #endif #endif /*-------------------------------------------------------------------------*/ /*MacOS Classic*/ #if defined(macintosh) #ifndef MACOS #define MACOS #endif #ifndef _MACOS #define _MACOS #endif #ifndef __MACOS__ #define __MACOS__ 1 #endif #endif /*-------------------------------------------------------------------------*/ /*MacOS X*/ #if defined(__APPLE__) && defined(__MACH__) #ifndef MACOSX #define MACOSX #endif #ifndef _MACOSX #define _MACOSX #endif #ifndef __MACOSX__ #define __MACOSX__ 1 #endif #endif /*Test of targets*/ #if defined(WINDOWS) && defined(UNIX) && defined(MACOS) && defined(MACOSX) #pragma message Multiple platforms??? #endif #if !defined(WIN32) && !defined(UNIX) && !defined(MACOS) && !defined(MACOSX) #pragma message No known platforms, assume default #endif /*-------------------------------------------------------------------------*/ /*8-bit int */ #if UCHAR_MAX==0xff #undef MAXTYPE_INT #define MAXTYPE_INT 8 typedef signed char MediaInfo_int8s; typedef unsigned char MediaInfo_int8u; #else #pragma message This machine has no 8-bit integertype? #endif /*-------------------------------------------------------------------------*/ /*16-bit int */ #if UINT_MAX == 0xffff #undef MAXTYPE_INT #define MAXTYPE_INT 16 typedef signed int MediaInfo_int16s; typedef unsigned int MediaInfo_int16u; #elif USHRT_MAX == 0xffff #undef MAXTYPE_INT #define MAXTYPE_INT 16 typedef signed short MediaInfo_int16s; typedef unsigned short MediaInfo_int16u; #else #pragma message This machine has no 16-bit integertype? #endif /*-------------------------------------------------------------------------*/ /*32-bit int */ #if UINT_MAX == 0xfffffffful #undef MAXTYPE_INT #define MAXTYPE_INT 32 typedef signed int MediaInfo_int32s; typedef unsigned int MediaInfo_int32u; #elif ULONG_MAX == 0xfffffffful #undef MAXTYPE_INT #define MAXTYPE_INT 32 typedef signed long MediaInfo_int32s; typedef unsigned long MediaInfo_int32u; #elif USHRT_MAX == 0xfffffffful #undef MAXTYPE_INT #define MAXTYPE_INT 32 typedef signed short MediaInfo_int32s; typedef unsigned short MediaInfo_int32u; #else #pragma message This machine has no 32-bit integer type? #endif /*-------------------------------------------------------------------------*/ /*64-bit int */ #if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__UNIX__) || defined(__MACOSX__) #undef MAXTYPE_INT #define MAXTYPE_INT 64 typedef unsigned long long MediaInfo_int64u; typedef signed long long MediaInfo_int64s; #elif defined(__WIN32__) || defined(_WIN32) #undef MAXTYPE_INT #define MAXTYPE_INT 64 typedef unsigned __int64 MediaInfo_int64u; typedef signed __int64 MediaInfo_int64s; #else #pragma message This machine has no 64-bit integer type? #endif /*-------------------------------------------------------------------------*/ /***************************************************************************/ /* The callback function */ /***************************************************************************/ #if !defined(__WINDOWS__) #define __stdcall #endif //!defined(__WINDOWS__) #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ typedef void (__stdcall MediaInfo_Event_CallBackFunction)(unsigned char* Data_Content, size_t Data_Size, void* UserHandler); #ifdef __cplusplus } #endif /* __cplusplus */ /***************************************************************************/ /* EventCode management */ /***************************************************************************/ #define MediaInfo_EventCode_Create(ParserID, EventID, EventVersion) \ ( ((MediaInfo_int32u)ParserID )<<24 \ | ((MediaInfo_int32u)EventID )<< 8 \ | ((MediaInfo_int32u)EventVersion) ) /***************************************************************************/ /* Global */ /***************************************************************************/ /*-------------------------------------------------------------------------*/ /* Time code */ typedef struct MediaInfo_time_code { MediaInfo_int8u Hours; MediaInfo_int8u Minutes; MediaInfo_int8u Seconds; MediaInfo_int8u Frames; MediaInfo_int8u FramesPerSecond; MediaInfo_int8u DropFrame; //0= No, 1=Yes MediaInfo_int8u Reserved[2]; } MediaInfo_time_code; /*-------------------------------------------------------------------------*/ /* Generic */ #define MEDIAINFO_EVENT_GENERIC \ MediaInfo_int32u EventCode; \ MediaInfo_int32u ReservedI32; \ size_t EventSize; \ size_t StreamIDs_Size; \ MediaInfo_int64u StreamIDs[16]; \ MediaInfo_int8u StreamIDs_Width[16]; \ MediaInfo_int8u ParserIDs[16]; \ MediaInfo_int64u StreamOffset; \ MediaInfo_int64u FrameNumber; \ MediaInfo_int64u PCR; \ MediaInfo_int64u PTS; \ MediaInfo_int64u DTS; \ MediaInfo_int64u DUR; \ MediaInfo_int64u FrameNumber_PresentationOrder; \ MediaInfo_int64u ReservedI64[1]; \ MediaInfo_time_code TimeCode_Container; \ MediaInfo_time_code TimeCode_SDTI; \ MediaInfo_time_code TimeCode_RawStream; \ MediaInfo_time_code ReservedT[5]; \ typedef struct MediaInfo_Event_Generic { MEDIAINFO_EVENT_GENERIC } MediaInfo_Event_Generic; /*-------------------------------------------------------------------------*/ /* MediaInfo_Event_Log_0 */ #define MediaInfo_Event_Log 0x0F00 struct MediaInfo_Event_Log_0 { MEDIAINFO_EVENT_GENERIC MediaInfo_int8u Type; MediaInfo_int8u Severity; MediaInfo_int8u Reserved2; MediaInfo_int8u Reserved3; MediaInfo_int32u MessageCode; MediaInfo_int32u Reserved4; const wchar_t* MessageString; const wchar_t* MessageStringU; const char* MessageStringA; }; /*-------------------------------------------------------------------------*/ /* Demux */ #define MediaInfo_Event_Global_Demux 0xAF00 enum MediaInfo_Event_Global_Demux_0_contenttype { MediaInfo_Event_Global_Demux_0_ContentType_MainStream, MediaInfo_Event_Global_Demux_0_ContentType_SubStream, MediaInfo_Event_Global_Demux_0_ContentType_Header, MediaInfo_Event_Global_Demux_0_ContentType_Synchro }; struct MediaInfo_Event_Global_Demux_4 { MEDIAINFO_EVENT_GENERIC MediaInfo_int8u Content_Type; /*MediaInfo_Event_Global_Demux_0_contenttype*/ size_t Content_Size; const MediaInfo_int8u* Content; MediaInfo_int64u Flags; /*bit0=random_access*/ size_t Offsets_Size; const MediaInfo_int64u* Offsets_Stream; /* From the begin of the stream */ const MediaInfo_int64u* Offsets_Content; /* From the begin of the demuxed content */ size_t OriginalContent_Size; /* In case of decoded content inside MediaInfo, OriginalContent contain the not-decoded stream */ const MediaInfo_int8u* OriginalContent; /* In case of decoded content inside MediaInfo, OriginalContent contain the not-decoded stream */ }; /*-------------------------------------------------------------------------*/ /* MediaInfo_Event_Video_SliceInfo_0 */ #define MediaInfo_Event_Video_SliceInfo 0x7801 struct MediaInfo_Event_Video_SliceInfo_0 { MEDIAINFO_EVENT_GENERIC MediaInfo_int64u FieldPosition; MediaInfo_int64u SlicePosition; MediaInfo_int8u SliceType; MediaInfo_int64u Flags; }; /***************************************************************************/ /* General */ /***************************************************************************/ #define MediaInfo_Parser_None 0x00 #define MediaInfo_Parser_General 0x00 #define MediaInfo_Parser_Global 0x00 #define MediaInfo_Parser_Video 0x01 /*-------------------------------------------------------------------------*/ /* Start */ #define MediaInfo_Event_General_Start 0x7001 struct MediaInfo_Event_General_Start_0 { MEDIAINFO_EVENT_GENERIC MediaInfo_int64u Stream_Size; const char* FileName; const wchar_t* FileName_Unicode; }; /*-------------------------------------------------------------------------*/ /* End */ #define MediaInfo_Event_General_End 0x7002 struct MediaInfo_Event_General_End_0 { MEDIAINFO_EVENT_GENERIC MediaInfo_int64u Stream_Bytes_Analyzed; MediaInfo_int64u Stream_Size; MediaInfo_int64u Stream_Bytes_Padding; MediaInfo_int64u Stream_Bytes_Junk; }; /*-------------------------------------------------------------------------*/ /* Parser_Selected */ #define MediaInfo_Event_General_Parser_Selected 0x7003 struct MediaInfo_Event_General_Parser_Selected_0 { MEDIAINFO_EVENT_GENERIC char Name[16]; }; /*-------------------------------------------------------------------------*/ /* Move request */ #define MediaInfo_Event_General_Move_Request 0x7004 struct MediaInfo_Event_General_Move_Request_0 { MEDIAINFO_EVENT_GENERIC }; /*-------------------------------------------------------------------------*/ /* Move done */ #define MediaInfo_Event_General_Move_Done 0x7005 struct MediaInfo_Event_General_Move_Done_0 { MEDIAINFO_EVENT_GENERIC }; /*-------------------------------------------------------------------------*/ /* SubFile_Start */ #define MediaInfo_Event_General_SubFile_Start 0x7006 struct MediaInfo_Event_General_SubFile_Start_0 { MEDIAINFO_EVENT_GENERIC const char* FileName_Relative; const wchar_t* FileName_Relative_Unicode; const char* FileName_Absolute; const wchar_t* FileName_Absolute_Unicode; }; /*-------------------------------------------------------------------------*/ /* SubFile_End */ #define MediaInfo_Event_General_SubFile_End 0x7007 struct MediaInfo_Event_General_SubFile_End_0 { MEDIAINFO_EVENT_GENERIC }; /***************************************************************************/ /* MPEG-TS / BDAV / TSP */ /***************************************************************************/ #define MediaInfo_Parser_SideCar 0x72 /***************************************************************************/ /* MPEG-TS / BDAV / TSP */ /***************************************************************************/ #define MediaInfo_Parser_MpegTs 0x01 /***************************************************************************/ /* MPEG-PS */ /***************************************************************************/ #define MediaInfo_Parser_MpegPs 0x02 #define MediaInfo_Parser_MpegPs_Ext 0x70 /***************************************************************************/ /* DV / DIF */ /***************************************************************************/ #define MediaInfo_Parser_DvDif 0x03 /*-------------------------------------------------------------------------*/ /* Analysis */ #define MediaInfo_Event_DvDif_Analysis_Frame 0xB001 struct MediaInfo_Event_DvDif_Analysis_Frame_0 { MediaInfo_int32u EventCode; MediaInfo_int32u TimeCode; MediaInfo_int32u RecordedDateTime1; MediaInfo_int16u RecordedDateTime2; MediaInfo_int8u Arb; MediaInfo_int8u Verbosity; char* Errors; }; /***************************************************************************/ /* CDXA */ /***************************************************************************/ #define MediaInfo_Parser_Cdxa 0x04 /***************************************************************************/ /* FLV */ /***************************************************************************/ #define MediaInfo_Parser_Flv 0x06 /***************************************************************************/ /* GXF */ /***************************************************************************/ #define MediaInfo_Parser_Gxf 0x07 /***************************************************************************/ /* Matroska */ /***************************************************************************/ #define MediaInfo_Parser_Matroska 0x08 /***************************************************************************/ /* MPEG-4 */ /***************************************************************************/ #define MediaInfo_Parser_Mpeg4 0x09 #define MediaInfo_Parser_Mpeg4_Desc 0x71 /***************************************************************************/ /* MXF */ /***************************************************************************/ #define MediaInfo_Parser_Mxf 0x0A /***************************************************************************/ /* OGG */ /***************************************************************************/ #define MediaInfo_Parser_Ogg 0x0B /***************************************************************************/ /* RIFF */ /***************************************************************************/ #define MediaInfo_Parser_Riff 0x0C /***************************************************************************/ /* WM */ /***************************************************************************/ #define MediaInfo_Parser_Wm 0x0D /***************************************************************************/ /* LXF */ /***************************************************************************/ #define MediaInfo_Parser_Lxf 0x0E /***************************************************************************/ /* HLS */ /***************************************************************************/ #define MediaInfo_Parser_Hls 0x60 /***************************************************************************/ /* HLS Index */ /***************************************************************************/ #define MediaInfo_Parser_HlsIndex 0x61 /***************************************************************************/ /* Internet Streaming Media */ /***************************************************************************/ #define MediaInfo_Parser_Ism 0x62 /***************************************************************************/ /* DASH MPD */ /***************************************************************************/ #define MediaInfo_Parser_DashMpd 0x63 /***************************************************************************/ /* HDS F4M */ /***************************************************************************/ #define MediaInfo_Parser_HdsF4m 0x64 /***************************************************************************/ /* DCP Composition Asset Map */ /***************************************************************************/ #define MediaInfo_Parser_DcpAm 0x65 /***************************************************************************/ /* DCP Composition Playlist */ /***************************************************************************/ #define MediaInfo_Parser_DcpCpl 0x66 /***************************************************************************/ /* DCP Package List */ /***************************************************************************/ #define MediaInfo_Parser_DcpPkl 0x67 /***************************************************************************/ /* DCP Output List */ /***************************************************************************/ #define MediaInfo_Parser_DcpOpl 0x68 /***************************************************************************/ /* Pro Tools session 10 */ /***************************************************************************/ #define MediaInfo_Parser_Ptx 0x69 /***************************************************************************/ /* AAF */ /***************************************************************************/ #define MediaInfo_Parser_Aaf 0x6A /***************************************************************************/ /* MPEG Video */ /***************************************************************************/ #define MediaInfo_Parser_Mpegv 0x80 /***************************************************************************/ /* AVC */ /***************************************************************************/ #define MediaInfo_Parser_Avc 0x81 /***************************************************************************/ /* AVC */ /***************************************************************************/ #define MediaInfo_Parser_Hevc 0x83 /***************************************************************************/ /* VC-1 */ /***************************************************************************/ #define MediaInfo_Parser_Vc1 0x82 /***************************************************************************/ /* Active Format Description (AFD) */ /***************************************************************************/ #define MediaInfo_Parser_Afd 0x83 /***************************************************************************/ /* Bar Data */ /***************************************************************************/ #define MediaInfo_Parser_BarData 0x84 /***************************************************************************/ /* MPEG-4 Visual */ /***************************************************************************/ #define MediaInfo_Parser_Mpeg4v 0x85 /***************************************************************************/ /* DTS */ /***************************************************************************/ #define MediaInfo_Parser_Dts 0xA0 /***************************************************************************/ /* AC-3 */ /***************************************************************************/ #define MediaInfo_Parser_Ac3 0xA1 /***************************************************************************/ /* AAC */ /***************************************************************************/ #define MediaInfo_Parser_Aac 0xA2 /***************************************************************************/ /* MPEG Audio */ /***************************************************************************/ #define MediaInfo_Parser_Mpega 0xA3 /***************************************************************************/ /* PCM */ /***************************************************************************/ #define MediaInfo_Parser_Pcm 0xA4 /***************************************************************************/ /* AES-3 */ /***************************************************************************/ #define MediaInfo_Parser_Aes3 0xA5 /***************************************************************************/ /* Dolby E */ /***************************************************************************/ #define MediaInfo_Parser_DolbyE 0xA6 /***************************************************************************/ /* Channel grouping intermediate module */ /***************************************************************************/ #define MediaInfo_Parser_ChannelGrouping 0xA7 /***************************************************************************/ /* CEA-608 (formely IEA-608) */ /***************************************************************************/ #define MediaInfo_Parser_Eia608 0xF0 /***************************************************************************/ /* DTVCC Transport (CEA-708, formely IEA-708) */ /***************************************************************************/ #define MediaInfo_Parser_DtvccTransport 0xF1 #define MediaInfo_Parser_Eia708 0xF1 /*Deprecated*/ /***************************************************************************/ /* DTVCC Caption (CEA-708, formely IEA-708) */ /***************************************************************************/ #define MediaInfo_Parser_DtvccCaption 0xF2 /***************************************************************************/ /* CDP */ /***************************************************************************/ #define MediaInfo_Parser_Cdp 0xF3 /***************************************************************************/ /* DVD CC */ /***************************************************************************/ #define MediaInfo_Parser_DvdCc 0xF4 /***************************************************************************/ /* SCTE 20 */ /***************************************************************************/ #define MediaInfo_Parser_Scte20 0xF5 /***************************************************************************/ /* DVB Subtitle */ /***************************************************************************/ #define MediaInfo_Parser_DvbSubtitle 0xF6 /***************************************************************************/ /* Teletext */ /***************************************************************************/ #define MediaInfo_Parser_Teletext 0xF7 /***************************************************************************/ /* SCC */ /***************************************************************************/ #define MediaInfo_Parser_Scc 0xF8 /***************************************************************************/ /* ARIB STD B24/B37 */ /***************************************************************************/ #define MediaInfo_Parser_AribStdB24B37 0xF9 /***************************************************************************/ /* TTML */ /***************************************************************************/ #define MediaInfo_Parser_Ttml 0xFA /***************************************************************************/ /* SubRip */ /***************************************************************************/ #define MediaInfo_Parser_SubRip 0xFB /***************************************************************************/ /* N19 */ /***************************************************************************/ #define MediaInfo_Parser_N19 0xFC #endif //MediaInfo_EventsH MediaInfoLib/Source/MediaInfo/MediaInfo_Events_Internal.h100777 0 0 10507 12226004262 16755 0/* 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. */ #ifndef MediaInfo_Events_InternalH #define MediaInfo_Events_InternalH #include "MediaInfo/MediaInfo_Events.h" #include "MediaInfo/TimeCode.h" #include using namespace MediaInfoLib; using namespace std; //--------------------------------------------------------------------------- // Generic #define EVENT_BEGIN(_EventType, _EventName, _EventVersion) \ { \ struct MediaInfo_Event_##_EventType##_##_EventName##_##_EventVersion Event;\ Event_Prepare((struct MediaInfo_Event_Generic*)&Event); \ Event.EventCode=MediaInfo_EventCode_Create(MediaInfo_Parser_##_EventType, MediaInfo_Event_##_EventType##_##_EventName, _EventVersion); \ Event.EventSize=sizeof(struct MediaInfo_Event_##_EventType##_##_EventName##_##_EventVersion); \ #define EVENT_END() \ Config->Event_Send(Status[IsAccepted]?NULL:this, (const int8u*)&Event, Event.EventSize, IsSub?File_Name_WithoutDemux:File_Name); \ } \ #define EVENT(_EventType, _EventName, _EventVersion) \ EVENT_BEGIN(_EventType, _EventName, _EventVersion) \ EVENT_END () //--------------------------------------------------------------------------- // Helpers namespace MediaInfoLib { inline void Events_PCR(int64u PCR, int64u &Event_PCR, char* Event_PCR_HR) { Event_PCR=PCR; if (PCR!=(int64u)-1) { string PCR_HR=Ztring().Duration_From_Milliseconds(PCR/1000000).To_UTF8(); if (PCR_HR.size()==12) strcpy(Event_PCR_HR, PCR_HR.c_str()); else memset(Event_PCR_HR, 0x00, 13); } else memset(Event_PCR_HR, 0x00, 13); } inline void Events_PTS(int64u PTS, int64u &Event_PTS, char* Event_PTS_HR) { Event_PTS=PTS; if (PTS!=(int64u)-1) { string PTS_HR=Ztring().Duration_From_Milliseconds(PTS/1000000).To_UTF8(); if (PTS_HR.size()==12) strcpy(Event_PTS_HR, PTS_HR.c_str()); else memset(Event_PTS_HR, 0x00, 13); } else memset(Event_PTS_HR, 0x00, 13); } inline void Events_DTS(int64u DTS, int64u &Event_DTS, char* Event_DTS_HR) { Event_DTS=DTS; if (DTS!=(int64u)-1) { string DTS_HR=Ztring().Duration_From_Milliseconds(DTS/1000000).To_UTF8(); if (DTS_HR.size()==12) strcpy(Event_DTS_HR, DTS_HR.c_str()); else memset(Event_DTS_HR, 0x00, 13); } else memset(Event_DTS_HR, 0x00, 13); } inline void Events_TimeCode(const TimeCode &Tc, MediaInfo_time_code &Event_TimeCode, char* Event_TimeCode_HR) { if (Tc.IsValid()) { Event_TimeCode.Hours=Tc.Hours; Event_TimeCode.Minutes=Tc.Minutes; Event_TimeCode.Seconds=Tc.Seconds; Event_TimeCode.Frames=Tc.Frames; Event_TimeCode.FramesPerSecond=Tc.FramesPerSecond; Event_TimeCode.DropFrame=Tc.DropFrame; Event_TimeCode_HR[ 0]='0'+Tc.Hours/10; Event_TimeCode_HR[ 1]='0'+Tc.Hours%10; Event_TimeCode_HR[ 2]=':'; Event_TimeCode_HR[ 3]='0'+Tc.Minutes/10; Event_TimeCode_HR[ 4]='0'+Tc.Minutes%10; Event_TimeCode_HR[ 5]=':'; Event_TimeCode_HR[ 6]='0'+Tc.Seconds/10; Event_TimeCode_HR[ 7]='0'+Tc.Seconds%10; Event_TimeCode_HR[ 8]=Tc.DropFrame?';':':'; Event_TimeCode_HR[ 9]='0'+Tc.Frames/10; Event_TimeCode_HR[10]='0'+Tc.Frames%10; Event_TimeCode_HR[11]='\0'; Event_TimeCode_HR[12]='\0'; } else { Event_TimeCode.Hours=(MediaInfo_int8u)-1; Event_TimeCode.Minutes=(MediaInfo_int8u)-1; Event_TimeCode.Seconds=(MediaInfo_int8u)-1; Event_TimeCode.Frames=(MediaInfo_int8u)-1; Event_TimeCode.FramesPerSecond=(MediaInfo_int8u)-1; Event_TimeCode.DropFrame=(MediaInfo_int8u)-1; memset(Event_TimeCode_HR, 0x00, 13); } } } #endif //MediaInfo_EventsH MediaInfoLib/Source/MediaInfo/MediaInfo_File.cpp100777 0 0 131755 12262525402 15124 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // How to: // To add a new format, // Fill includes, SelectFromExtension, ListFormats and LibraryIsModified // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include "MediaInfo/Reader/Reader_File.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // Multiple #if defined(MEDIAINFO_AAF_YES) #include "MediaInfo/Multiple/File_Aaf.h" #endif #if defined(MEDIAINFO_BDMV_YES) #include "MediaInfo/Multiple/File_Bdmv.h" #endif #if defined(MEDIAINFO_CDXA_YES) #include "MediaInfo/Multiple/File_Cdxa.h" #endif #if defined(MEDIAINFO_DASHMPD_YES) #include "MediaInfo/Multiple/File_DashMpd.h" #endif #if defined(MEDIAINFO_DCP_YES) #include "MediaInfo/Multiple/File_DcpAm.h" #endif #if defined(MEDIAINFO_DCP_YES) #include "MediaInfo/Multiple/File_DcpCpl.h" #endif #if defined(MEDIAINFO_DCP_YES) #include "MediaInfo/Multiple/File_DcpPkl.h" #endif #if defined(MEDIAINFO_DVDIF_YES) #include "MediaInfo/Multiple/File_DvDif.h" #endif #if defined(MEDIAINFO_DVDV_YES) #include "MediaInfo/Multiple/File_Dvdv.h" #endif #if defined(MEDIAINFO_DXW_YES) #include "MediaInfo/Multiple/File_Dxw.h" #endif #if defined(MEDIAINFO_FLV_YES) #include "MediaInfo/Multiple/File_Flv.h" #endif #if defined(MEDIAINFO_GXF_YES) #include "MediaInfo/Multiple/File_Gxf.h" #endif #if defined(MEDIAINFO_HDSF4M_YES) #include "MediaInfo/Multiple/File_HdsF4m.h" #endif #if defined(MEDIAINFO_HLS_YES) #include "MediaInfo/Multiple/File_Hls.h" #endif #if defined(MEDIAINFO_IBI_YES) #include "MediaInfo/Multiple/File_Ibi.h" #endif #if defined(MEDIAINFO_ISM_YES) #include "MediaInfo/Multiple/File_Ism.h" #endif #if defined(MEDIAINFO_IMF_YES) #include "MediaInfo/Multiple/File_ImfCpl.h" #endif #if defined(MEDIAINFO_IVF_YES) #include "MediaInfo/Multiple/File_Ivf.h" #endif #if defined(MEDIAINFO_LXF_YES) #include "MediaInfo/Multiple/File_Lxf.h" #endif #if defined(MEDIAINFO_MK_YES) #include "MediaInfo/Multiple/File_Mk.h" #endif #if defined(MEDIAINFO_MPEG4_YES) #include "MediaInfo/Multiple/File_Mpeg4.h" #endif #if defined(MEDIAINFO_MPEGPS_YES) #include "MediaInfo/Multiple/File_MpegPs.h" #endif #if defined(MEDIAINFO_MPEGTS_YES) || defined(MEDIAINFO_BDAV_YES) || defined(MEDIAINFO_TSP_YES) #include "MediaInfo/Multiple/File_MpegTs.h" #endif #if defined(MEDIAINFO_MXF_YES) #include "MediaInfo/Multiple/File_Mxf.h" #endif #if defined(MEDIAINFO_NUT_YES) #include "MediaInfo/Multiple/File_Nut.h" #endif #if defined(MEDIAINFO_OGG_YES) #include "MediaInfo/Multiple/File_Ogg.h" #endif #if defined(MEDIAINFO_P2_YES) #include "MediaInfo/Multiple/File_P2_Clip.h" #endif #if defined(MEDIAINFO_PMP_YES) #include "MediaInfo/Multiple/File_Pmp.h" #endif #if defined(MEDIAINFO_PTX_YES) #include "MediaInfo/Multiple/File_Ptx.h" #endif #if defined(MEDIAINFO_RIFF_YES) #include "MediaInfo/Multiple/File_Riff.h" #endif #if defined(MEDIAINFO_RM_YES) #include "MediaInfo/Multiple/File_Rm.h" #endif #if defined(MEDIAINFO_SEQUENCEINFO_YES) #include "MediaInfo/Multiple/File_SequenceInfo.h" #endif #if defined(MEDIAINFO_SKM_YES) #include "MediaInfo/Multiple/File_Skm.h" #endif #if defined(MEDIAINFO_SWF_YES) #include "MediaInfo/Multiple/File_Swf.h" #endif #if defined(MEDIAINFO_WM_YES) #include "MediaInfo/Multiple/File_Wm.h" #endif #if defined(MEDIAINFO_XDCAM_YES) #include "MediaInfo/Multiple/File_Xdcam_Clip.h" #endif #if defined(MEDIAINFO_DPG_YES) #include "MediaInfo/Multiple/File_Dpg.h" #endif //--------------------------------------------------------------------------- // Video #if defined(MEDIAINFO_AVC_YES) #include "MediaInfo/Video/File_Avc.h" #endif #if defined(MEDIAINFO_AVSV_YES) #include "MediaInfo/Video/File_AvsV.h" #endif #if defined(MEDIAINFO_DIRAC_YES) #include "MediaInfo/Video/File_Dirac.h" #endif #if defined(MEDIAINFO_FLIC_YES) #include "MediaInfo/Video/File_Flic.h" #endif #if defined(MEDIAINFO_H263_YES) #include "MediaInfo/Video/File_H263.h" #endif #if defined(MEDIAINFO_HEVC_YES) #include "MediaInfo/Video/File_Hevc.h" #endif #if defined(MEDIAINFO_MPEG4V_YES) #include "MediaInfo/Video/File_Mpeg4v.h" #endif #if defined(MEDIAINFO_MPEGV_YES) #include "MediaInfo/Video/File_Mpegv.h" #endif #if defined(MEDIAINFO_VC1_YES) #include "MediaInfo/Video/File_Vc1.h" #endif #if defined(MEDIAINFO_VC3_YES) #include "MediaInfo/Video/File_Vc3.h" #endif #if defined(MEDIAINFO_Y4M_YES) #include "MediaInfo/Video/File_Y4m.h" #endif //--------------------------------------------------------------------------- // Audio #if defined(MEDIAINFO_AAC_YES) #include "MediaInfo/Audio/File_Aac.h" #endif #if defined(MEDIAINFO_AC3_YES) #include "MediaInfo/Audio/File_Ac3.h" #endif #if defined(MEDIAINFO_ALS_YES) #include "MediaInfo/Audio/File_Als.h" #endif #if defined(MEDIAINFO_AMR_YES) #include "MediaInfo/Audio/File_Amr.h" #endif #if defined(MEDIAINFO_AMV_YES) #include "MediaInfo/Audio/File_Amv.h" #endif #if defined(MEDIAINFO_APE_YES) #include "MediaInfo/Audio/File_Ape.h" #endif #if defined(MEDIAINFO_AU_YES) #include "MediaInfo/Audio/File_Au.h" #endif #if defined(MEDIAINFO_DTS_YES) #include "MediaInfo/Audio/File_Dts.h" #endif #if defined(MEDIAINFO_DOLBYE_YES) #include "MediaInfo/Audio/File_DolbyE.h" #endif #if defined(MEDIAINFO_FLAC_YES) #include "MediaInfo/Audio/File_Flac.h" #endif #if defined(MEDIAINFO_IT_YES) #include "MediaInfo/Audio/File_ImpulseTracker.h" #endif #if defined(MEDIAINFO_LA_YES) #include "MediaInfo/Audio/File_La.h" #endif #if defined(MEDIAINFO_MIDI_YES) #include "MediaInfo/Audio/File_Midi.h" #endif #if defined(MEDIAINFO_MOD_YES) #include "MediaInfo/Audio/File_Module.h" #endif #if defined(MEDIAINFO_MPC_YES) #include "MediaInfo/Audio/File_Mpc.h" #endif #if defined(MEDIAINFO_MPCSV8_YES) #include "MediaInfo/Audio/File_MpcSv8.h" #endif #if defined(MEDIAINFO_MPEGA_YES) #include "MediaInfo/Audio/File_Mpega.h" #endif #if defined(MEDIAINFO_RKAU_YES) #include "MediaInfo/Audio/File_Rkau.h" #endif #if defined(MEDIAINFO_S3M_YES) #include "MediaInfo/Audio/File_ScreamTracker3.h" #endif #if defined(MEDIAINFO_SMPTEST0337_YES) #include "MediaInfo/Audio/File_SmpteSt0337.h" #endif #if defined(MEDIAINFO_RKAU_YES) #include "MediaInfo/Audio/File_Rkau.h" #endif #if defined(MEDIAINFO_TAK_YES) #include "MediaInfo/Audio/File_Tak.h" #endif #if defined(MEDIAINFO_TTA_YES) #include "MediaInfo/Audio/File_Tta.h" #endif #if defined(MEDIAINFO_TWINVQ_YES) #include "MediaInfo/Audio/File_TwinVQ.h" #endif #if defined(MEDIAINFO_WVPK_YES) #include "MediaInfo/Audio/File_Wvpk.h" #endif #if defined(MEDIAINFO_XM_YES) #include "MediaInfo/Audio/File_ExtendedModule.h" #endif //--------------------------------------------------------------------------- // Text #if defined(MEDIAINFO_EIA608_YES) #include "MediaInfo/Text/File_Eia608.h" #endif #if defined(MEDIAINFO_N19_YES) #include "MediaInfo/Text/File_N19.h" #endif #if defined(MEDIAINFO_SCC_YES) #include "MediaInfo/Text/File_Scc.h" #endif #if defined(MEDIAINFO_SUBRIP_YES) #include "MediaInfo/Text/File_SubRip.h" #endif #if defined(MEDIAINFO_TTML_YES) #include "MediaInfo/Text/File_Ttml.h" #endif #if defined(MEDIAINFO_OTHERTEXT_YES) #include "MediaInfo/Text/File_OtherText.h" #endif //--------------------------------------------------------------------------- // Image #if defined(MEDIAINFO_BMP_YES) #include "MediaInfo/Image/File_Bmp.h" #endif #if defined(MEDIAINFO_DPX_YES) #include "MediaInfo/Image/File_Dpx.h" #endif #if defined(MEDIAINFO_EXR_YES) #include "MediaInfo/Image/File_Exr.h" #endif #if defined(MEDIAINFO_GIF_YES) #include "MediaInfo/Image/File_Gif.h" #endif #if defined(MEDIAINFO_ICO_YES) #include "MediaInfo/Image/File_Ico.h" #endif #if defined(MEDIAINFO_JPEG_YES) #include "MediaInfo/Image/File_Jpeg.h" #endif #if defined(MEDIAINFO_PCX_YES) #include "MediaInfo/Image/File_Pcx.h" #endif #if defined(MEDIAINFO_PNG_YES) #include "MediaInfo/Image/File_Png.h" #endif #if defined(MEDIAINFO_PSD_YES) #include "MediaInfo/Image/File_Psd.h" #endif #if defined(MEDIAINFO_TIFF_YES) #include "MediaInfo/Image/File_Tiff.h" #endif #if defined(MEDIAINFO_TGA_YES) #include "MediaInfo/Image/File_Tga.h" #endif //--------------------------------------------------------------------------- // Archive #if defined(MEDIAINFO_7Z_YES) #include "MediaInfo/Archive/File_7z.h" #endif #if defined(MEDIAINFO_ACE_YES) #include "MediaInfo/Archive/File_Ace.h" #endif #if defined(MEDIAINFO_BZIP2_YES) #include "MediaInfo/Archive/File_Bzip2.h" #endif #if defined(MEDIAINFO_ELF_YES) #include "MediaInfo/Archive/File_Elf.h" #endif #if defined(MEDIAINFO_GZIP_YES) #include "MediaInfo/Archive/File_Gzip.h" #endif #if defined(MEDIAINFO_ISO9660_YES) #include "MediaInfo/Archive/File_Iso9660.h" #endif #if defined(MEDIAINFO_MZ_YES) #include "MediaInfo/Archive/File_Mz.h" #endif #if defined(MEDIAINFO_RAR_YES) #include "MediaInfo/Archive/File_Rar.h" #endif #if defined(MEDIAINFO_TAR_YES) #include "MediaInfo/Archive/File_Tar.h" #endif #if defined(MEDIAINFO_ZIP_YES) #include "MediaInfo/Archive/File_Zip.h" #endif //--------------------------------------------------------------------------- // Other #if defined(MEDIAINFO_OTHER_YES) #include "MediaInfo/File_Other.h" #endif #if defined(MEDIAINFO_UNKNOWN_YES) #include "MediaInfo/File_Unknown.h" #endif #if defined(MEDIAINFO_DUMMY_YES) #include "MediaInfo/File_Dummy.h" #endif //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- extern MediaInfo_Config Config; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- bool MediaInfo_Internal::SelectFromExtension (const String &Parser) { CriticalSectionLocker CSL(CS); //Clear last value delete Info; Info=NULL; //Searching the right File_* if (0) {} //For #defines // Multiple #if defined(MEDIAINFO_AAF_YES) else if (Parser==__T("Aaf")) Info=new File_Aaf(); #endif #if defined(MEDIAINFO_BDAV_YES) else if (Parser==__T("Bdav")) {Info=new File_MpegTs(); ((File_MpegTs*)Info)->BDAV_Size=4;} #endif #if defined(MEDIAINFO_BDMV_YES) else if (Parser==__T("Bdmv")) Info=new File_Bdmv(); #endif #if defined(MEDIAINFO_CDXA_YES) else if (Parser==__T("Cdxa")) Info=new File_Cdxa(); #endif #if defined(MEDIAINFO_DASHMPD_YES) else if (Parser==__T("DashMpd")) Info=new File_DashMpd(); #endif #if defined(MEDIAINFO_DCP_YES) else if (Parser==__T("DcpAm")) Info=new File_DcpAm(); #endif #if defined(MEDIAINFO_DCP_YES) else if (Parser==__T("DcpCpl")) Info=new File_DcpCpl(); #endif #if defined(MEDIAINFO_DCP_YES) else if (Parser==__T("DcpPkg")) Info=new File_DcpPkl(); #endif #if defined(MEDIAINFO_DVDIF_YES) else if (Parser==__T("DvDif")) Info=new File_DvDif(); #endif #if defined(MEDIAINFO_DVDV_YES) else if (Parser==__T("Dvdv")) Info=new File_Dvdv(); #endif #if defined(MEDIAINFO_DXW_YES) else if (Parser==__T("Dxw")) Info=new File_Dxw(); #endif #if defined(MEDIAINFO_FLV_YES) else if (Parser==__T("Flv")) Info=new File_Flv(); #endif #if defined(MEDIAINFO_GXF_YES) else if (Parser==__T("Gxf")) Info=new File_Gxf(); #endif #if defined(MEDIAINFO_HDSF4M_YES) else if (Parser==__T("HdsF4m")) Info=new File_HdsF4m(); #endif #if defined(MEDIAINFO_HLS_YES) else if (Parser==__T("Hls")) Info=new File_Hls(); #endif #if defined(MEDIAINFO_IVF_YES) else if (Parser==__T("Ivf")) Info=new File_Ivf(); #endif #if defined(MEDIAINFO_ISM_YES) else if (Parser==__T("Ism")) Info=new File_Ism(); #endif #if defined(MEDIAINFO_LXF_YES) else if (Parser==__T("Lxf")) Info=new File_Lxf(); #endif #if defined(MEDIAINFO_MK_YES) else if (Parser==__T("Mk")) Info=new File_Mk(); #endif #if defined(MEDIAINFO_MPEG4_YES) else if (Parser==__T("Mpeg4")) Info=new File_Mpeg4(); #endif #if defined(MEDIAINFO_MPEGPS_YES) else if (Parser==__T("MpegPs")) Info=new File_MpegPs(); #endif #if defined(MEDIAINFO_MPEGTS_YES) else if (Parser==__T("MpegTs")) Info=new File_MpegTs(); #endif #if defined(MEDIAINFO_MXF_YES) else if (Parser==__T("Mxf")) Info=new File_Mxf(); #endif #if defined(MEDIAINFO_NUT_YES) else if (Parser==__T("Nut")) Info=new File_Nut(); #endif #if defined(MEDIAINFO_OGG_YES) else if (Parser==__T("Ogg")) Info=new File_Ogg(); #endif #if defined(MEDIAINFO_P2_YES) else if (Parser==__T("P2_Clip")) Info=new File_P2_Clip(); #endif #if defined(MEDIAINFO_PMP_YES) else if (Parser==__T("Pmp")) Info=new File_Pmp(); #endif #if defined(MEDIAINFO_PTX_YES) else if (Parser==__T("Ptx")) Info=new File_Ptx(); #endif #if defined(MEDIAINFO_RIFF_YES) else if (Parser==__T("Riff")) Info=new File_Riff(); #endif #if defined(MEDIAINFO_RM_YES) else if (Parser==__T("Rm")) Info=new File_Rm(); #endif #if defined(MEDIAINFO_SEQUENCEINFO_YES) else if (Parser==__T("SequenceInfo")) Info=new File_SequenceInfo(); #endif #if defined(MEDIAINFO_SKM_YES) else if (Parser==__T("Skm")) Info=new File_Skm(); #endif #if defined(MEDIAINFO_SWF_YES) else if (Parser==__T("Swf")) Info=new File_Swf(); #endif #if defined(MEDIAINFO_WM_YES) else if (Parser==__T("Wm")) Info=new File_Wm(); #endif #if defined(MEDIAINFO_XDCAM_YES) else if (Parser==__T("Xdcam_Clip")) Info=new File_Xdcam_Clip(); #endif #if defined(MEDIAINFO_DPG_YES) else if (Parser==__T("Dpg")) Info=new File_Dpg(); #endif // Video #if defined(MEDIAINFO_AVC_YES) else if (Parser==__T("Avc")) Info=new File_Avc(); #endif #if defined(MEDIAINFO_HEVC_YES) else if (Parser==__T("Hevc")) Info=new File_Hevc(); #endif #if defined(MEDIAINFO_AVSV_YES) else if (Parser==__T("AvsV")) Info=new File_AvsV(); #endif #if defined(MEDIAINFO_DIRAC_YES) else if (Parser==__T("Dirac")) Info=new File_Dirac(); #endif #if defined(MEDIAINFO_FLIC_YES) else if (Parser==__T("Flic")) Info=new File_Flic(); #endif #if defined(MEDIAINFO_H263_YES) else if (Parser==__T("H263")) Info=new File_H263(); #endif #if defined(MEDIAINFO_MPEG4V_YES) else if (Parser==__T("Mpeg4v")) Info=new File_Mpeg4v(); #endif #if defined(MEDIAINFO_MPEGV_YES) else if (Parser==__T("Mpegv")) Info=new File_Mpegv(); #endif #if defined(MEDIAINFO_VC1_YES) else if (Parser==__T("Vc1")) Info=new File_Vc1(); #endif #if defined(MEDIAINFO_VC3_YES) else if (Parser==__T("Vc3")) Info=new File_Vc3(); #endif #if defined(MEDIAINFO_Y4M_YES) else if (Parser==__T("Y4m")) Info=new File_Y4m(); #endif // Audio #if defined(MEDIAINFO_AAC_YES) else if (Parser==__T("Adts")) {Info=new File_Aac(); ((File_Aac*)Info)->Mode=File_Aac::Mode_ADTS;} // Prioritization against ADIF #endif #if defined(MEDIAINFO_AC3_YES) else if (Parser==__T("Ac3")) Info=new File_Ac3(); #endif #if defined(MEDIAINFO_SMPTEST0337_YES) else if (Parser==__T("Aes3")) Info=new File_SmpteSt0337(); #endif #if defined(MEDIAINFO_ALS_YES) else if (Parser==__T("Als")) Info=new File_Als(); #endif #if defined(MEDIAINFO_AMR_YES) else if (Parser==__T("Amr")) Info=new File_Amr(); #endif #if defined(MEDIAINFO_AMV_YES) else if (Parser==__T("Amv")) Info=new File_Amv(); #endif #if defined(MEDIAINFO_APE_YES) else if (Parser==__T("Ape")) Info=new File_Ape(); #endif #if defined(MEDIAINFO_AU_YES) else if (Parser==__T("Au")) Info=new File_Au(); #endif #if defined(MEDIAINFO_DTS_YES) else if (Parser==__T("Dts")) Info=new File_Dts(); #endif #if defined(MEDIAINFO_DOLBYE_YES) else if (Parser==__T("DolbyE")) Info=new File_DolbyE(); #endif #if defined(MEDIAINFO_FLAC_YES) else if (Parser==__T("Flac")) Info=new File_Flac(); #endif #if defined(MEDIAINFO_IT_YES) else if (Parser==__T("It")) Info=new File_ImpulseTracker(); #endif #if defined(MEDIAINFO_LA_YES) else if (Parser==__T("La")) Info=new File_La(); #endif #if defined(MEDIAINFO_MIDI_YES) else if (Parser==__T("Midi")) Info=new File_Midi(); #endif #if defined(MEDIAINFO_MOD_YES) else if (Parser==__T("Mod")) Info=new File_Module(); #endif #if defined(MEDIAINFO_MPC_YES) else if (Parser==__T("Mpc")) Info=new File_Mpc(); #endif #if defined(MEDIAINFO_MPCSV8_YES) else if (Parser==__T("Mpc")) Info=new File_MpcSv8(); #endif #if defined(MEDIAINFO_MPEGA_YES) else if (Parser==__T("Mpega")) Info=new File_Mpega(); #endif #if defined(MEDIAINFO_AU_YES) else if (Parser==__T("Au")) Info=new File_Au(); #endif #if defined(MEDIAINFO_RKAU_YES) else if (Parser==__T("Rkau")) Info=new File_Rkau(); #endif #if defined(MEDIAINFO_S3M_YES) else if (Parser==__T("S3m")) Info=new File_ScreamTracker3(); #endif #if defined(MEDIAINFO_TAK_YES) else if (Parser==__T("Tak")) Info=new File_Tak(); #endif #if defined(MEDIAINFO_TTA_YES) else if (Parser==__T("Tta")) Info=new File_Tta(); #endif #if defined(MEDIAINFO_TWINVQ_YES) else if (Parser==__T("TwinVQ")) Info=new File_TwinVQ(); #endif #if defined(MEDIAINFO_WVPK_YES) else if (Parser==__T("Wvpk")) Info=new File_Wvpk(); #endif #if defined(MEDIAINFO_XM_YES) else if (Parser==__T("Xm")) Info=new File_ExtendedModule(); #endif // Text #if defined(MEDIAINFO_EIA608_YES) else if (Parser==__T("CEA-608")) Info=new File_Eia608(); else if (Parser==__T("EIA-608")) Info=new File_Eia608(); #endif #if defined(MEDIAINFO_N19_YES) else if (Parser==__T("N19")) Info=new File_N19(); #endif #if defined(MEDIAINFO_SCC_YES) else if (Parser==__T("SCC")) Info=new File_Scc(); #endif #if defined(MEDIAINFO_SUBRIP_YES) else if (Parser==__T("SubRip")) Info=new File_SubRip(); #endif #if defined(MEDIAINFO_TTML_YES) else if (Parser==__T("TTML")) Info=new File_Ttml(); #endif #if defined(MEDIAINFO_OTHERTEXT_YES) else if (Parser==__T("OtherText")) Info=new File_OtherText(); #endif // Image #if defined(MEDIAINFO_GIF_YES) else if (Parser==__T("Gif")) Info=new File_Gif(); #endif #if defined(MEDIAINFO_BMP_YES) else if (Parser==__T("Bmp")) Info=new File_Bmp(); #endif #if defined(MEDIAINFO_DPX_YES) else if (Parser==__T("Dpx")) Info=new File_Dpx(); #endif #if defined(MEDIAINFO_EXR_YES) else if (Parser==__T("Exr")) Info=new File_Exr(); #endif #if defined(MEDIAINFO_ICO_YES) else if (Parser==__T("Ico")) Info=new File_Ico(); #endif #if defined(MEDIAINFO_JPEG_YES) else if (Parser==__T("Jpeg")) Info=new File_Jpeg(); #endif #if defined(MEDIAINFO_PCX_YES) else if (Parser==__T("PCX")) Info=new File_Pcx(); #endif #if defined(MEDIAINFO_PNG_YES) else if (Parser==__T("Png")) Info=new File_Png(); #endif #if defined(MEDIAINFO_PSD_YES) else if (Parser==__T("Psd")) Info=new File_Psd(); #endif #if defined(MEDIAINFO_TIFF_YES) else if (Parser==__T("Tiff")) Info=new File_Tiff(); #endif #if defined(MEDIAINFO_TGA_YES) else if (Parser==__T("Tga")) Info=new File_Tga(); #endif // Archive #if defined(MEDIAINFO_7Z_YES) else if (Parser==__T("7z")) Info=new File_7z(); #endif #if defined(MEDIAINFO_ACE_YES) else if (Parser==__T("Ace")) Info=new File_Ace(); #endif #if defined(MEDIAINFO_BZIP2_YES) else if (Parser==__T("Bzip2")) Info=new File_Bzip2(); #endif #if defined(MEDIAINFO_ELF_YES) else if (Parser==__T("Elf")) Info=new File_Elf(); #endif #if defined(MEDIAINFO_GZIP_YES) else if (Parser==__T("Gzip")) Info=new File_Gzip(); #endif #if defined(MEDIAINFO_ISO9660_YES) else if (Parser==__T("Iso9660")) Info=new File_Iso9660(); #endif #if defined(MEDIAINFO_MZ_YES) else if (Parser==__T("Mz")) Info=new File_Mz(); #endif #if defined(MEDIAINFO_RAR_YES) else if (Parser==__T("Rar")) Info=new File_Rar(); #endif #if defined(MEDIAINFO_TAR_YES) else if (Parser==__T("Tar")) Info=new File_Tar(); #endif #if defined(MEDIAINFO_ZIP_YES) else if (Parser==__T("Zip")) Info=new File_Zip(); #endif // Other #if defined(MEDIAINFO_OTHER_YES) else if (Parser==__T("Other")) Info=new File_Other(); #endif //No parser else return false; return true; } //--------------------------------------------------------------------------- #if !defined(MEDIAINFO_READER_NO) int MediaInfo_Internal::ListFormats(const String &File_Name) { // Multiple #if defined(MEDIAINFO_AAF_YES) delete Info; Info=new File_Aaf(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_BDAV_YES) delete Info; Info=new File_MpegTs(); ((File_MpegTs*)Info)->BDAV_Size=4; if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_BDMV_YES) delete Info; Info=new File_Bdmv(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_CDXA_YES) delete Info; Info=new File_Cdxa(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_DASHMPD_YES) delete Info; Info=new File_DashMpd(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_DCP_YES) delete Info; Info=new File_DcpAm(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_DCP_YES) delete Info; Info=new File_DcpCpl(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_DCP_YES) delete Info; Info=new File_DcpPkl(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_DVDIF_YES) delete Info; Info=new File_DvDif(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_DVDV_YES) delete Info; Info=new File_Dvdv(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_DXW_YES) delete Info; Info=new File_Dxw(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_FLV_YES) delete Info; Info=new File_Flv(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_GXF_YES) delete Info; Info=new File_Gxf(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_HDSF4M_YES) delete Info; Info=new File_HdsF4m(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_HLS_YES) delete Info; Info=new File_Hls(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_IBI_YES) delete Info; Info=new File_Ibi(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_ISM_YES) delete Info; Info=new File_Ism(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_IVF_YES) delete Info; Info=new File_Ivf(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_LXF_YES) delete Info; Info=new File_Lxf(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_MK_YES) delete Info; Info=new File_Mk(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_MPEG4_YES) delete Info; Info=new File_Mpeg4(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_MPEGPS_YES) delete Info; Info=new File_MpegPs(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_MPEGTS_YES) delete Info; Info=new File_MpegTs(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_MPLI_YES) delete Info; Info=new File_Mpli(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_MXF_YES) delete Info; Info=new File_Mxf(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_NUT_YES) delete Info; Info=new File_Nut(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_OGG_YES) delete Info; Info=new File_Ogg(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_P2_YES) delete Info; Info=new File_P2_Clip(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_PMP_YES) delete Info; Info=new File_Pmp(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_PTX_YES) delete Info; Info=new File_Ptx(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_RIFF_YES) delete Info; Info=new File_Riff(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_RM_YES) delete Info; Info=new File_Rm(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_SEQUENCEINFO_YES) delete Info; Info=new File_SequenceInfo(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_SKM_YES) delete Info; Info=new File_Skm(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_SWF_YES) delete Info; Info=new File_Swf(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_TSP_YES) delete Info; Info=new File_MpegTs(); ((File_MpegTs*)Info)->TSP_Size=16; if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_WM_YES) delete Info; Info=new File_Wm(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_XDCAM_YES) delete Info; Info=new File_Xdcam_Clip(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_DPG_YES) delete Info; Info=new File_Dpg(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif // Video #if defined(MEDIAINFO_AVC_YES) delete Info; Info=new File_Avc(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_HEVC_YES) delete Info; Info=new File_Hevc(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_AVSV_YES) delete Info; Info=new File_AvsV(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_DIRAC_YES) delete Info; Info=new File_Dirac(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_FLIC_YES) delete Info; Info=new File_Flic(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_H263_YES) delete Info; Info=new File_H263(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_MPEG4V_YES) delete Info; Info=new File_Mpeg4v(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_MPEGV_YES) delete Info; Info=new File_Mpegv(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_VC1_YES) delete Info; Info=new File_Vc1(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_VC3_YES) delete Info; Info=new File_Vc3(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_Y4M_YES) delete Info; Info=new File_Y4m(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif // Audio #if defined(MEDIAINFO_AAC_YES) delete Info; Info=new File_Aac(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_AC3_YES) delete Info; Info=new File_Ac3(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_SMPTEST0337_YES) delete Info; Info=new File_SmpteSt0337(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_ALS_YES) delete Info; Info=new File_Als(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_AMR_YES) delete Info; Info=new File_Amr(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_AMV_YES) delete Info; Info=new File_Amv(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_APE_YES) delete Info; Info=new File_Ape(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_AU_YES) delete Info; Info=new File_Au(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_DTS_YES) delete Info; Info=new File_Dts(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif // Too many false-positives // #if defined(MEDIAINFO_DOLBYE_YES) // delete Info; Info=new File_DolbyE(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; // #endif #if defined(MEDIAINFO_FLAC_YES) delete Info; Info=new File_Flac(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_IT_YES) delete Info; Info=new File_ImpulseTracker(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_LA_YES) delete Info; Info=new File_La(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_MIDI_YES) delete Info; Info=new File_Midi(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_MOD_YES) delete Info; Info=new File_Module(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_MPC_YES) delete Info; Info=new File_Mpc(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_MPCSV8_YES) delete Info; Info=new File_MpcSv8(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_MPEGA_YES) delete Info; Info=new File_Mpega(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_RKAU_YES) delete Info; Info=new File_Rkau(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_TAK_YES) delete Info; Info=new File_Tak(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_S3M_YES) delete Info; Info=new File_ScreamTracker3(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_TTA_YES) delete Info; Info=new File_Tta(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_TWINVQ_YES) delete Info; Info=new File_TwinVQ(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_WVPK_YES) delete Info; Info=new File_Wvpk(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_XM_YES) delete Info; Info=new File_ExtendedModule(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif // Text #if defined(MEDIAINFO_N19_YES) delete Info; Info=new File_N19(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_SCC_YES) delete Info; Info=new File_Scc(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_SUBRIP_YES) delete Info; Info=new File_SubRip(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_TTML_YES) delete Info; Info=new File_Ttml(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_OTHERTEXT_YES) delete Info; Info=new File_OtherText(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif // Image #if defined(MEDIAINFO_BMP_YES) delete Info; Info=new File_Bmp(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_DPX_YES) delete Info; Info=new File_Dpx(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_GIF_YES) delete Info; Info=new File_Gif(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_ICO_YES) delete Info; Info=new File_Ico(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_JPEG_YES) delete Info; Info=new File_Jpeg(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_PCX_YES) delete Info; Info=new File_Pcx(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_PNG_YES) delete Info; Info=new File_Png(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_PSD_YES) delete Info; Info=new File_Psd(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_TIFF_YES) delete Info; Info=new File_Tiff(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_TGA_YES) delete Info; Info=new File_Tga(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif // Archive #if defined(MEDIAINFO_ACE_YES) delete Info; Info=new File_Ace(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_7Z_YES) delete Info; Info=new File_7z(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_BZIP2_YES) delete Info; Info=new File_Bzip2(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_ELF_YES) delete Info; Info=new File_Elf(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_GZIP_YES) delete Info; Info=new File_Gzip(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_ISO9660_YES) delete Info; Info=new File_Iso9660(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_MZ_YES) delete Info; Info=new File_Mz(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_RAR_YES) delete Info; Info=new File_Rar(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_TAR_YES) delete Info; Info=new File_Tar(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif #if defined(MEDIAINFO_ZIP_YES) delete Info; Info=new File_Zip(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif // Other #if !defined(MEDIAINFO_OTHER_NO) delete Info; Info=new File_Other(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; #endif // Default (empty) delete Info; Info=new File_Unknown(); if (((Reader_File*)Reader)->Format_Test_PerParser(this, File_Name)>0) return 1; return 0; } #endif //!defined(MEDIAINFO_READER_NO) //--------------------------------------------------------------------------- bool MediaInfo_Internal::LibraryIsModified () { #if defined(MEDIAINFO_MULTI_NO) || defined(MEDIAINFO_VIDEO_NO) || defined(MEDIAINFO_AUDIO_NO) || defined(MEDIAINFO_TEXT_NO) || defined(MEDIAINFO_IMAGE_NO) || defined(MEDIAINFO_ARCHIVE_NO) \ || defined(MEDIAINFO_BDAV_NO) || defined(MEDIAINFO_MK_NO) || defined(MEDIAINFO_OGG_NO) || defined(MEDIAINFO_RIFF_NO) || defined(MEDIAINFO_MPEG4_NO) || defined(MEDIAINFO_MPEGPS_NO) || defined(MEDIAINFO_MPEGTS_NO) || defined(MEDIAINFO_DXW_NO) || defined(MEDIAINFO_FLV_NO) || defined(MEDIAINFO_GXF_NO) || defined(MEDIAINFO_HDSF4M_NO) || defined(MEDIAINFO_HLS_NO) || defined(MEDIAINFO_ISM_NO) || defined(MEDIAINFO_IVF_NO) || defined(MEDIAINFO_LXF_NO) || defined(MEDIAINFO_SWF_NO) || defined(MEDIAINFO_MXF_NO) || defined(MEDIAINFO_NUT_NO) || defined(MEDIAINFO_WM_NO) || defined(MEDIAINFO_QT_NO) || defined(MEDIAINFO_RM_NO) || defined(MEDIAINFO_DVDIF_NO) || defined(MEDIAINFO_DVDV_NO) || defined(MEDIAINFO_AAF_NO) || defined(MEDIAINFO_CDXA_NO) || defined(MEDIAINFO_DPG_NO) || defined(MEDIAINFO_TSP_NO) \ || defined(MEDIAINFO_AVC_NO) || defined(MEDIAINFO_AVSV_NO) || defined(MEDIAINFO_HEVC_NO) || defined(MEDIAINFO_MPEG4V_NO) || defined(MEDIAINFO_MPEGV_NO) || defined(MEDIAINFO_FLIC_NO) || defined(MEDIAINFO_THEORA_NO) || defined(MEDIAINFO_Y4M_NO) \ || defined(MEDIAINFO_AC3_NO) || defined(MEDIAINFO_ADIF_NO) || defined(MEDIAINFO_ADTS_NO) || defined(MEDIAINFO_SMPTEST0337_NO) || defined(MEDIAINFO_AMR_NO) || defined(MEDIAINFO_DTS_NO) || defined(MEDIAINFO_DOLBYE_NO) || defined(MEDIAINFO_FLAC_NO) || defined(MEDIAINFO_APE_NO) || defined(MEDIAINFO_MPC_NO) || defined(MEDIAINFO_MPCSV8_NO) || defined(MEDIAINFO_MPEGA_NO) || defined(MEDIAINFO_TWINVQ_NO) || defined(MEDIAINFO_XM_NO) || defined(MEDIAINFO_MOD_NO) || defined(MEDIAINFO_S3M_NO) || defined(MEDIAINFO_IT_NO) || defined(MEDIAINFO_SPEEX_NO) || defined(MEDIAINFO_TAK_NO) || defined(MEDIAINFO_PS2A_NO) \ || defined(MEDIAINFO_CMML_NO) || defined(MEDIAINFO_KATE_NO) || defined(MEDIAINFO_PGS_NO) || defined(MEDIAINFO_OTHERTEXT_NO) \ || defined(MEDIAINFO_BMP_NO) || defined(MEDIAINFO_DPX_NO) || defined(MEDIAINFO_EXR_NO) || defined(MEDIAINFO_GIF_NO) || defined(MEDIAINFO_ICO_NO) || defined(MEDIAINFO_JPEG_NO) || defined(MEDIAINFO_PNG_NO) || defined(MEDIAINFO_TGA_NO) || defined(MEDIAINFO_TIFF_NO) \ || defined(MEDIAINFO_7Z_NO) || defined(MEDIAINFO_ZIP_NO) || defined(MEDIAINFO_RAR_NO) || defined(MEDIAINFO_ACE_NO) || defined(MEDIAINFO_ELF_NO) || defined(MEDIAINFO_MZ_NO) \ || defined(MEDIAINFO_OTHER_NO) || defined(MEDIAINFO_DUMMY_NO) return true; #else return false; #endif } //--------------------------------------------------------------------------- void MediaInfo_Internal::CreateDummy (const String&) { #if defined(MEDIAINFO_DUMMY_YES) Info=new File_Dummy(); ((File_Dummy*)Info)->KindOfDummy=Value; #endif } } //NameSpace MediaInfoLib/Source/MediaInfo/MediaInfo_Inform.cpp100777 0 0 67542 12244641067 15467 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Inform part // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "ZenLib/Utils.h" #include "MediaInfo/Export/Export_EbuCore.h" #include "MediaInfo/Export/Export_Mpeg7.h" #include "MediaInfo/Export/Export_reVTMD.h" #include "MediaInfo/Export/Export_PBCore.h" #include "MediaInfo/File__Analyze.h" #include "base64.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- extern MediaInfo_Config Config; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- Ztring MediaInfo_Internal::Inform() { CS.Enter(); if (Info && Info->Status[File__Analyze::IsUpdated]) Info->Open_Buffer_Update(); CS.Leave(); #if MEDIAINFO_TRACE if (MediaInfoLib::Config.Trace_Level_Get() || MediaInfoLib::Config.Inform_Get()==__T("Details")) { if (!Details.empty()) { Ztring Content=Details; return Details; } else if (Info) return Info->Details_Get(); } #endif //MEDIAINFO_TRACE if (MediaInfoLib::Config.Inform_Get()==__T("EBUCore") || MediaInfoLib::Config.Inform_Get()==__T("EBUCore_1.4")) return Export_EbuCore().Transform(*this); if (MediaInfoLib::Config.Inform_Get()==__T("MPEG-7")) return Export_Mpeg7().Transform(*this); if (MediaInfoLib::Config.Inform_Get()==__T("PBCore") || MediaInfoLib::Config.Inform_Get()==__T("PBCore_1.2")) return Export_PBCore().Transform(*this); if (MediaInfoLib::Config.Inform_Get()==__T("reVTMD")) return __T("reVTMD is disabled due to its non-free licensing."); //return Export_reVTMD().Transform(*this); if (!( MediaInfoLib::Config.Inform_Get(__T("General")).empty() && MediaInfoLib::Config.Inform_Get(__T("Video")).empty() && MediaInfoLib::Config.Inform_Get(__T("Audio")).empty() && MediaInfoLib::Config.Inform_Get(__T("Text")).empty() && MediaInfoLib::Config.Inform_Get(__T("Chapters")).empty() && MediaInfoLib::Config.Inform_Get(__T("Image")).empty() && MediaInfoLib::Config.Inform_Get(__T("Menu")).empty() )) { Ztring Retour; Retour+=MediaInfoLib::Config.Inform_Get(__T("File_Begin")); Retour+=MediaInfoLib::Config.Inform_Get(__T("General_Begin")); Retour+=Inform(Stream_General, 0, false); Retour+=MediaInfoLib::Config.Inform_Get(__T("General_End")); if (Count_Get(Stream_Video)) Retour+=MediaInfoLib::Config.Inform_Get(__T("Video_Begin")); for (size_t I1=0; I1\n\n\n\n\n"); if (XML) Retour+=__T("\n"); for (size_t StreamKind=(size_t)Stream_General; StreamKind\n\n

"); if (XML) Retour+=__T("\n "); if (XML) Retour+=__T(">"); Retour+=MediaInfoLib::Config.LineSeparator_Get(); Retour+=Inform((stream_t)StreamKind, StreamPos, false); Retour.FindAndReplace(__T("\\"), __T("|SC1|"), 0, Ztring_Recursive); if (HTML) Retour+=__T("\n
"); if (XML) Retour+=__T("\n"); Retour+=MediaInfoLib::Config.LineSeparator_Get(); } } if (HTML) Retour+=__T("\n\n\n"); if (XML) Retour+=__T("\n"); Retour.FindAndReplace(__T("\\r\\n"), __T("\n"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\\r"), __T("\n"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\\n"), __T("\n"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\r"), __T("\n"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\n"), MediaInfoLib::Config.LineSeparator_Get(), 0, Ztring_Recursive); //Special characters Retour.FindAndReplace(__T("|SC1|"), __T("\\"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("|SC2|"), __T("["), 0, Ztring_Recursive); Retour.FindAndReplace(__T("|SC3|"), __T("]"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("|SC4|"), __T(","), 0, Ztring_Recursive); Retour.FindAndReplace(__T("|SC5|"), __T(";"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("|SC6|"), __T("("), 0, Ztring_Recursive); Retour.FindAndReplace(__T("|SC7|"), __T(")"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("|SC8|"), __T(")"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("|SC9|"), __T("),"), 0, Ztring_Recursive); return Retour; } //--------------------------------------------------------------------------- Ztring MediaInfo_Internal::Inform (stream_t StreamKind, size_t StreamPos, bool IsDirect) { //Integrity if (StreamKind>=Stream_Max || StreamPos>=Stream[StreamKind].size()) return Ztring(); if (MediaInfoLib::Config.Inform_Get(__T("General")).empty() && MediaInfoLib::Config.Inform_Get(__T("Video")).empty() && MediaInfoLib::Config.Inform_Get(__T("Audio")).empty() && MediaInfoLib::Config.Inform_Get(__T("Text")).empty() && MediaInfoLib::Config.Inform_Get(__T("Chapters")).empty() && MediaInfoLib::Config.Inform_Get(__T("Image")).empty() && MediaInfoLib::Config.Inform_Get(__T("Menu")).empty()) { Ztring Retour; bool HTML=false; bool XML=false; bool CSV=false; if (MediaInfoLib::Config.Inform_Get()==__T("HTML")) HTML=true; if (MediaInfoLib::Config.Inform_Get()==__T("XML")) XML=true; if (MediaInfoLib::Config.Inform_Get()==__T("CSV")) CSV=true; size_t Size=Count_Get(StreamKind, StreamPos); for (size_t Champ_Pos=0; Champ_Pos\n "); Retour+=Nom; Retour+=__T(" :\n "); Retour+=Valeur; Retour+=__T("\n "); } else if (XML) { Nom=Xml_Name_Escape(Nom); size_t Modified; Xml_Content_Escape_Modifying(Valeur, Modified); Retour+=__T("<"); Retour+=Nom; if (Modified==1 && !MediaInfoLib::Config.SkipBinaryData_Get()) //Base64 Retour+=__T(" dt=\"binary.base64\""); Retour+=__T(">"); if (Modified==1 && MediaInfoLib::Config.SkipBinaryData_Get()) Retour+=__T("(Binary data)"); else Retour+=Valeur; Retour+=__T(""); } else if (CSV) { Retour+=Nom; Retour+=__T(","); Retour+=Valeur; } else Retour+=Nom + MediaInfoLib::Config.Language_Get(__T(" Config_Text_Separator")) + Valeur; Retour+=MediaInfoLib::Config.LineSeparator_Get(); } } Retour.FindAndReplace(__T("\\r\\n"), __T("\n"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\\r"), __T("\n"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\\n"), __T("\n"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\r"), __T("\n"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\n"), MediaInfoLib::Config.LineSeparator_Get(), 0, Ztring_Recursive); Retour.FindAndReplace(__T("|SC1|"), __T("\\"), 0, Ztring_Recursive); return Retour; } Ztring Retour=MediaInfoLib::Config.Inform_Get(Get(StreamKind, 0, __T("StreamKind"), Info_Text)); ZtringList Info; if (StreamKind>=Stream_Max) return Ztring(); Info=Stream[StreamKind][StreamPos]; //Special characters Retour.FindAndReplace(__T("\\\\"), __T("|SC1|"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\\["), __T("|SC2|"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\\]"), __T("|SC3|"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\\,"), __T("|SC4|"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\\;"), __T("|SC5|"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\\("), __T("|SC6|"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\\)"), __T("|SC7|"), 0, Ztring_Recursive); //Gestion $xx$ size_t PosX=0; while (Retour.find(__T("$"), PosX)!=(size_t)-1) { PosX=Retour.find(__T("$"), PosX); if (Retour.size()>PosX+2 && !(Retour(PosX+1)==__T('i') && Retour(PosX+2)==__T('f') && Retour(PosX+3)==__T('('))) //To keep out "%" without any signification, or "$if(..." { Ztring ARemplacer=Ztring(__T("$")+Retour.SubString(__T("$"), __T("$"), PosX))+__T("$"); Ztring RemplacerPar=MediaInfoLib::Config.Language_Get(Retour.SubString(__T("$"), __T("$"), PosX)); //TODO : case sensitive Retour.FindAndReplace(ARemplacer, RemplacerPar); } else PosX++; } //Gestion $if() size_t Position=Retour.find(__T("$if(")); while (Position!=Error && Position>0) { ZtringList Elements; size_t Elements_Index; Elements.Separator_Set(0, __T(",")); Elements.Write(Retour.SubString(__T("$if("), __T(")"), Position)); Elements(0)=Elements(0).SubString(__T("%"), __T("%")); //Test if there is something to replace size_t Pos=MediaInfoLib::Config.Info_Get(StreamKind).Find(Elements(0)); if (Pos!=std::string::npos) { if (Info(Pos).size()>0) Elements_Index=1; else Elements_Index=2; } else Elements_Index=2; //Replace while (Elements(Elements_Index).SubString(__T("%"), __T("%")).size()>0) { Ztring ToReplace=Elements(Elements_Index).SubString(__T("%"), __T("%")); Ztring ReplacedBy=Info(MediaInfoLib::Config.Info_Get(StreamKind).Find(ToReplace)); ToReplace=Ztring(__T("%"))+ToReplace+Ztring(__T("%")); Elements(Elements_Index).FindAndReplace(ToReplace, ReplacedBy); } Ztring ToReplace=Ztring(__T("$if("))+Retour.SubString(__T("$if("), __T(")"), Position)+__T(")"); Retour.FindAndReplace(ToReplace, Elements(Elements_Index)); Position=Retour.find(__T("$if(")); } //Gestion [] while (!Retour.SubString(__T("["), __T("]")).empty()) { Ztring Crochets=Retour.SubString(__T("["), __T("]")); Ztring ValueToFind=Crochets.SubString(__T("%"), __T("%")); size_t ValueToFind_Pos=MediaInfoLib::Config.Info_Get(StreamKind).Find(ValueToFind); Ztring ARemplacer=Ztring(__T("[")+Crochets+__T("]")); if (ValueToFind_Pos!=Error) { Ztring RemplacerPar=Info(ValueToFind_Pos); if (RemplacerPar.empty()) Retour.FindAndReplace(ARemplacer, Ztring()); else { //Formate l'interieur Ztring ATraiter=Crochets; Ztring Crochets_ARemplacer=Ztring(__T("%")+ATraiter.SubString(__T("%"), __T("%")))+__T("%"); Ztring Crochets_RemplacerPar=Info(MediaInfoLib::Config.Info_Get(StreamKind).Find(ATraiter.SubString(__T("%"), __T("%")))); ATraiter.FindAndReplace(Crochets_ARemplacer, Crochets_RemplacerPar); Retour.FindAndReplace(ARemplacer, ATraiter); } } else Retour.FindAndReplace(ARemplacer, Ztring()); } //Gestion %xxx% PosX=0; while (Retour.find(__T("%"), PosX)!=(size_t)-1) { PosX=Retour.find(__T("%"), PosX); if (Retour.size()>PosX+2 && Retour[PosX+1]>=__T('A') && Retour[PosX+1]<=__T('Z')) //To keep out "%" without any signification { Ztring ARemplacer=Ztring(__T("%")+Retour.SubString(__T("%"), __T("%"), PosX))+__T("%"); Ztring RemplacerPar=Get(StreamKind, StreamPos, Retour.SubString(__T("%"), __T("%"), PosX)); RemplacerPar.FindAndReplace(__T("\\"), __T("|SC1|"), 0, Ztring_Recursive); RemplacerPar.FindAndReplace(__T("),"), __T("|SC9|"), 0, Ztring_Recursive); RemplacerPar.FindAndReplace(__T(")"), __T("|SC8|"), 0, Ztring_Recursive); Retour.FindAndReplace(ARemplacer, RemplacerPar); } else PosX++; } //Retour=__T("\n\n \n \r\n \n \n \n \r\n \n \n \n \r\n \n \n \n \r\n \n \n \n \r\n \n \n \n \r\n \n \n \n \r\n
Video #0
Codec :WMV1
Codec/Info :Windows Media Video 7
Width :200 pixels
Height :150 pixels
Aspect ratio :4/3
Resolution :24 bits
\n"); Retour.FindAndReplace(__T("\\r\\n"), __T("\n"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\\r"), __T("\n"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\\n"), __T("\n"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\r"), __T("\n"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("\n"), MediaInfoLib::Config.LineSeparator_Get(), 0, Ztring_Recursive); //Special characters if (IsDirect) { Retour.FindAndReplace(__T("|SC1|"), __T("\\"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("|SC2|"), __T("["), 0, Ztring_Recursive); Retour.FindAndReplace(__T("|SC3|"), __T("]"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("|SC4|"), __T(","), 0, Ztring_Recursive); Retour.FindAndReplace(__T("|SC5|"), __T(";"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("|SC6|"), __T("("), 0, Ztring_Recursive); Retour.FindAndReplace(__T("|SC7|"), __T(")"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("|SC8|"), __T(")"), 0, Ztring_Recursive); Retour.FindAndReplace(__T("|SC9|"), __T("),"), 0, Ztring_Recursive); } return Retour; } //--------------------------------------------------------------------------- void MediaInfo_Internal::Traiter(Ztring &C) { //$if(%a%,zezeze%a%,rrere) size_t Position=C.find(__T("$if(")); while (Position>0) { //Recuperation de la chaine entiere Ztring Total; Ztring ARemplacer; ZtringList Total1; Total1.Separator_Set(0, __T("),")); Total=C.SubString(__T("$if("), __T(")"), Position); ARemplacer=Ztring(__T("$if(")+Total+__T(")")); Total1.Write(Total); if (Total1(0).empty()) //mettre champ2 C.FindAndReplace(ARemplacer, Total1(2), Position); else C.FindAndReplace(ARemplacer, Total1(1), Position); Position=C.find(__T("$if("), Position); } //reformatage C.FindAndReplace(__T("|SC8|"), __T(")"), 0, Ztring_Recursive); C.FindAndReplace(__T("|SC9|"), __T("),"), 0, Ztring_Recursive); //C.FindAndReplace(__T("\\r\\n"), __T("\n"), 0, Ztring_Recursive); } //--------------------------------------------------------------------------- Ztring MediaInfo_Internal::Xml_Name_Escape (const Ztring &Name) { Ztring ToReturn(Name); if (ToReturn.operator()(0)>='0' && ToReturn.operator()(0)<='9') ToReturn.insert(0, 1, __T('_')); ToReturn.FindAndReplace(__T(" "), __T("_"), 0, Ztring_Recursive); ToReturn.FindAndReplace(__T("/"), __T("_"), 0, Ztring_Recursive); ToReturn.FindAndReplace(__T("("), __T("_"), 0, Ztring_Recursive); ToReturn.FindAndReplace(__T(")"), __T("_"), 0, Ztring_Recursive); ToReturn.FindAndReplace(__T("*"), __T("_"), 0, Ztring_Recursive); ToReturn.FindAndReplace(__T(","), __T("_"), 0, Ztring_Recursive); ToReturn.FindAndReplace(__T(":"), __T("_"), 0, Ztring_Recursive); ToReturn.FindAndReplace(__T("@"), __T("_"), 0, Ztring_Recursive); size_t ToReturn_Pos=0; while (ToReturn_Pos=__T('A') && ToReturn[ToReturn_Pos]<=__T('Z')) && !(ToReturn[ToReturn_Pos]>=__T('a') && ToReturn[ToReturn_Pos]<=__T('z')) && !(ToReturn[ToReturn_Pos]>=__T('0') && ToReturn[ToReturn_Pos]<=__T('9')) && !(ToReturn[ToReturn_Pos]==__T('_'))) ToReturn.erase(ToReturn_Pos, 1); else ToReturn_Pos++; } if (ToReturn.empty()) ToReturn="Unknown"; return ToReturn; } //--------------------------------------------------------------------------- Ztring MediaInfo_Internal::Xml_Content_Escape (const Ztring &Content, size_t &Modified) { Ztring ToReturn(Content); return Xml_Content_Escape_Modifying(ToReturn, Modified); } //--------------------------------------------------------------------------- size_t Xml_Content_Escape_MustEscape(const Ztring &Content) { size_t Pos=0; size_t Size=Content.size(); for (; Pos') : return Pos; default : if (Content[Pos]<0x20) return Pos; } } return Pos; } Ztring &MediaInfo_Internal::Xml_Content_Escape_Modifying (Ztring &Content, size_t &Modified) { size_t Pos=Xml_Content_Escape_MustEscape(Content); Ztring Content_Save=Content; Modified=0; if (Pos>=Content.size()) return Content; for (; Pos'): Content[Pos]=__T('&'); Content.insert(Pos+1, __T("gt;")); Pos+=3; break; default: if (Content[Pos]<0x20) { /* Is still invalid XML Ztring Character=__T("#x")+Ztring::ToZtring(Content[Pos]/16, 16)+Ztring::ToZtring(Content[Pos]%16, 16)+__T(";"); Content[Pos]=__T('&'); Content.insert(Pos+1, Character); Pos+=5; */ string Content_Utf8=Content_Save.To_UTF8(); //TODO: shouldn't we never convert to Unicode? string Content_Base64=Base64::encode(Content_Utf8); Content.From_UTF8(Content_Base64); Modified=1; //Base64 Pos=Content.size(); //End } } } return Content; } } //NameSpace MediaInfoLib/Source/MediaInfo/MediaInfo_Internal.cpp100777 0 0 156541 12226004261 16014 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/MediaInfo_Internal.h" #include "MediaInfo/MediaInfo_Config.h" #include "MediaInfo/File__Analyze.h" #include "MediaInfo/File__MultipleParsing.h" #include "ZenLib/Dir.h" #include "ZenLib/File.h" #include "ZenLib/FileName.h" #if defined(MEDIAINFO_DIRECTORY_YES) #include "MediaInfo/Reader/Reader_Directory.h" #endif #if defined(MEDIAINFO_FILE_YES) #include "MediaInfo/Reader/Reader_File.h" #endif #if defined(MEDIAINFO_LIBCURL_YES) #include "MediaInfo/Reader/Reader_libcurl.h" #endif #if defined(MEDIAINFO_LIBMMS_YES) #include "MediaInfo/Reader/Reader_libmms.h" #endif #if defined(MEDIAINFO_IBI_YES) #include "MediaInfo/Multiple/File_Ibi.h" #endif #include "MediaInfo/Multiple/File_Dxw.h" #include #ifdef MEDIAINFO_DEBUG_WARNING_GET #include #endif //MEDIAINFO_DEBUG_WARNING_GET #ifdef MEDIAINFO_DEBUG_BUFFER #include "ZenLib/FileName.h" #include #endif //MEDIAINFO_DEBUG_BUFFER using namespace ZenLib; using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- //To clarify the code namespace MediaInfo_Debug_MediaInfo_Internal { #if defined (MEDIAINFO_DEBUG_CONFIG) || defined (MEDIAINFO_DEBUG_BUFFER) || defined (MEDIAINFO_DEBUG_OUTPUT) #ifdef WINDOWS const Char* MediaInfo_Debug_Name=__T("MediaInfo_Debug"); #else const Char* MediaInfo_Debug_Name=__T("/tmp/MediaInfo_Debug"); #endif #endif #ifdef MEDIAINFO_DEBUG_CONFIG #define MEDIAINFO_DEBUG_CONFIG_TEXT(_TOAPPEND) \ { \ Ztring Debug; \ _TOAPPEND; \ Debug+=__T("\r\n"); \ if (!Debug_Config.Opened_Get()) \ { \ if (Config.File_Names.empty()) \ Debug_Config.Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".Config.txt")); \ else \ { \ Ztring File_Temp; \ if (Config.File_Names[0].rfind(__T('\\'))!=string::npos) \ File_Temp=Config.File_Names[0].substr(Config.File_Names[0].rfind(__T('\\'))+1, string::npos); \ else if (Config.File_Names[0].rfind(__T('/'))!=string::npos) \ File_Temp=Config.File_Names[0].substr(Config.File_Names[0].rfind(__T('/'))+1, string::npos); \ else \ File_Temp=Config.File_Names[0]; \ Debug_Config.Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".")+File_Temp+__T(".Config.txt")); \ } \ } \ Debug_Config.Write(Debug); \ } #else // MEDIAINFO_DEBUG_CONFIG #define MEDIAINFO_DEBUG_CONFIG_TEXT(_TOAPPEND) #endif // MEDIAINFO_DEBUG_CONFIG #ifdef MEDIAINFO_DEBUG_CONFIG #define EXECUTE_SIZE_T(_METHOD,_DEBUGB) \ { \ size_t ToReturn=_METHOD; \ MEDIAINFO_DEBUG_CONFIG_TEXT(_DEBUGB) \ return ToReturn; \ } #else //MEDIAINFO_DEBUG_CONFIG #define EXECUTE_SIZE_T(_METHOD, _DEBUGB) \ return _METHOD; #endif //MEDIAINFO_DEBUG_CONFIG #ifdef MEDIAINFO_DEBUG_CONFIG #define EXECUTE_INT64U(_METHOD,_DEBUGB) \ { \ int64u ToReturn=_METHOD; \ MEDIAINFO_DEBUG_CONFIG_TEXT(_DEBUGB) \ return ToReturn; \ } #else //MEDIAINFO_DEBUG_CONFIG #define EXECUTE_INT64U(_METHOD, _DEBUGB) \ return _METHOD; #endif //MEDIAINFO_DEBUG_CONFIG #ifdef MEDIAINFO_DEBUG_CONFIG #define EXECUTE_STRING(_METHOD,_DEBUGB) \ { \ Ztring ToReturn=_METHOD; \ MEDIAINFO_DEBUG_CONFIG_TEXT(_DEBUGB) \ return ToReturn; \ } #else //MEDIAINFO_DEBUG_CONFIG #define EXECUTE_STRING(_METHOD,_DEBUGB) \ return _METHOD; #endif //MEDIAINFO_DEBUG_CONFIG #ifdef MEDIAINFO_DEBUG_BUFFER #define MEDIAINFO_DEBUG_BUFFER_SAVE(_BUFFER, _SIZE) \ { \ if (!Debug_Buffer_Stream.Opened_Get()) \ { \ if (Config.File_Names.empty()) \ Debug_Buffer_Stream.Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".Buffer.Stream.0000000000000000")); \ else \ { \ Ztring File_Temp; \ if (Config.File_Names[0].rfind(__T('\\'))!=string::npos) \ File_Temp=Config.File_Names[0].substr(Config.File_Names[0].rfind(__T('\\'))+1, string::npos); \ else if (Config.File_Names[0].rfind(__T('/'))!=string::npos) \ File_Temp=Config.File_Names[0].substr(Config.File_Names[0].rfind(__T('/'))+1, string::npos); \ else \ File_Temp=Config.File_Names[0]; \ Debug_Buffer_Stream.Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".")+File_Temp+__T(".Buffer.Stream.0000000000000000")); \ } \ Debug_Buffer_Stream_Order=0; \ if (Config.File_Names.empty()) \ Debug_Buffer_Sizes.Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".Buffer.Sizes.0000000000000000")); \ else \ { \ Ztring File_Temp; \ if (Config.File_Names[0].rfind(__T('\\'))!=string::npos) \ File_Temp=Config.File_Names[0].substr(Config.File_Names[0].rfind(__T('\\'))+1, string::npos); \ else if (Config.File_Names[0].rfind(__T('/'))!=string::npos) \ File_Temp=Config.File_Names[0].substr(Config.File_Names[0].rfind(__T('/'))+1, string::npos); \ else \ File_Temp=Config.File_Names[0]; \ Debug_Buffer_Sizes.Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".")+File_Temp+__T(".Buffer.Sizes.0000000000000000")); \ } \ Debug_Buffer_Sizes_Count=0; \ } \ Debug_Buffer_Stream.Write(_BUFFER, _SIZE); \ Debug_Buffer_Sizes.Write((int8u*)&_SIZE, sizeof(size_t)); \ Debug_Buffer_Sizes_Count+=_SIZE; \ if (Debug_Buffer_Sizes_Count>=MEDIAINFO_DEBUG_BUFFER_SAVE_FileSize) \ { \ Debug_Buffer_Stream.Close(); \ Debug_Buffer_Sizes.Close(); \ Ztring Before=Ztring::ToZtring(Debug_Buffer_Stream_Order-1); \ while (Before.size()<16) \ Before.insert(0, 1, __T('0')); \ Ztring Next=Ztring::ToZtring(Debug_Buffer_Stream_Order+1); \ while (Next.size()<16) \ Next.insert(0, 1, __T('0')); \ Debug_Buffer_Stream.Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".Buffer.Stream.")+Next); \ Debug_Buffer_Sizes.Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".Buffer.Sizes.")+Next); \ File::Delete(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".Buffer.Stream.")+Before); \ File::Delete(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".Buffer.Sizes.")+Before); \ Debug_Buffer_Stream_Order++; \ Debug_Buffer_Sizes_Count=0; \ } \ } #else // MEDIAINFO_DEBUG_BUFFER #define MEDIAINFO_DEBUG_BUFFER_SAVE(_BUFFER, _SIZE) #endif // MEDIAINFO_DEBUG_BUFFER #ifdef MEDIAINFO_DEBUG_OUTPUT #define MEDIAINFO_DEBUG_OUTPUT_INIT(_VALUE, _DEBUGB) \ { \ if (OptionLower==__T("file_duplicate")) \ { \ size_t Pos=(size_t)ToReturn2.To_int64u(); \ if (Pos>=Debug_Output_Pos_Stream.size()) \ { \ Debug_Output_Pos_Stream.resize(Pos+1); \ Debug_Output_Pos_Stream[Pos]=new File(); \ Debug_Output_Pos_Sizes.resize(Pos+1); \ Debug_Output_Pos_Sizes[Pos]=new File(); \ Debug_Output_Pos_Pointer.resize(Pos+1); \ Debug_Output_Pos_Pointer[Pos]=(void*)Ztring(Value).SubString(__T("memory://"), __T(":")).To_int64u(); \ } \ } \ EXECUTE_STRING(_VALUE, _DEBUGB) \ } #else // MEDIAINFO_DEBUG_OUTPUT #define MEDIAINFO_DEBUG_OUTPUT_INIT(_VALUE, _DEBUGB) \ EXECUTE_STRING(_VALUE, _DEBUGB) #endif // MEDIAINFO_DEBUG_OUTPUT #ifdef MEDIAINFO_DEBUG_OUTPUT #define MEDIAINFO_DEBUG_OUTPUT_VALUE(_VALUE, _METHOD) \ { \ size_t ByteCount=Info->Output_Buffer_Get(Value); \ void* ValueH=(void*)Ztring(Value).SubString(__T("memory://"), __T(":")).To_int64u(); \ map::iterator F_Stream=Debug_Output_Value_Stream.find(ValueH); \ if (F_Stream!=Debug_Output_Value_Stream.end()) \ { \ map::iterator F_Sizes=Debug_Output_Value_Stream.find(ValueH); \ if (!F_Stream->second.Opened_Get()) \ { \ F_Stream->second.Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".Output.")+Ztring::ToZtring((size_t)ValueH, 16)+__T(".Stream")); \ F_Sizes->second.Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".Output.")+Ztring::ToZtring((size_t)ValueH, 16)+__T(".Sizes")); \ } \ F_Stream->second.Write((int8u*)ValueH, ByteCount); \ F_Sizes->second.Write((int8u*)&ByteCount, sizeof(ByteCount)); \ } \ return ByteCount; \ } #else // MEDIAINFO_DEBUG_OUTPUT #define MEDIAINFO_DEBUG_OUTPUT_VALUE(_VALUE, _METHOD) \ return _METHOD #endif // MEDIAINFO_DEBUG_OUTPUT #ifdef MEDIAINFO_DEBUG_OUTPUT #define MEDIAINFO_DEBUG_OUTPUT_POS(_POS, _METHOD) \ { \ size_t ByteCount=Info->Output_Buffer_Get(_POS); \ if (_POSOpened_Get()) \ { \ Debug_Output_Pos_Stream[_POS]->Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".Output.")+Ztring::ToZtring(Pos, 16)+__T(".Stream")); \ Debug_Output_Pos_Sizes[_POS]->Create(Ztring(MediaInfo_Debug_Name)+__T(".")+Ztring::ToZtring((size_t)this, 16)+__T(".Output.")+Ztring::ToZtring(Pos, 16)+__T(".Sizes")); \ } \ Debug_Output_Pos_Stream[_POS]->Write((int8u*)Debug_Output_Pos_Pointer[_POS], ByteCount); \ Debug_Output_Pos_Sizes[_POS]->Write((int8u*)&ByteCount, sizeof(ByteCount)); \ } \ return ByteCount; \ } #else // MEDIAINFO_DEBUG_OUTPUT #define MEDIAINFO_DEBUG_OUTPUT_POS(_VALUE, _METHOD) \ return _METHOD #endif // MEDIAINFO_DEBUG_OUTPUT } using namespace MediaInfo_Debug_MediaInfo_Internal; //*************************************************************************** // Constructor/destructor //*************************************************************************** //--------------------------------------------------------------------------- MediaInfo_Internal::MediaInfo_Internal() : Thread() { CriticalSectionLocker CSL(CS); MEDIAINFO_DEBUG_CONFIG_TEXT(Debug+=__T("Construction");) MediaInfoLib::Config.Init(); //Initialize Configuration BlockMethod=BlockMethod_Local; Info=NULL; #if !defined(MEDIAINFO_READER_NO) Reader=NULL; #endif //!defined(MEDIAINFO_READER_NO) Info_IsMultipleParsing=false; Stream.resize(Stream_Max); Stream_More.resize(Stream_Max); //Position in a MediaInfoList class IsFirst=true; IsLast=true; //Threading BlockMethod=0; IsInThread=false; } //--------------------------------------------------------------------------- MediaInfo_Internal::~MediaInfo_Internal() { Close(); CriticalSectionLocker CSL(CS); MEDIAINFO_DEBUG_CONFIG_TEXT(Debug+=__T("Destruction");) delete Info; //Info=NULL; #if !defined(MEDIAINFO_READER_NO) delete Reader; //Reader=NULL; #endif //!defined(MEDIAINFO_READER_NO) #ifdef MEDIAINFO_DEBUG_OUTPUT for (size_t Pos=0; Pos=6 && Config.File_Names[0][0]==__T('m') && Config.File_Names[0][1]==__T('m') && Config.File_Names[0][2]==__T('s') && Config.File_Names[0][3]==__T(':') && Config.File_Names[0][4]==__T('/') && Config.File_Names[0][5]==__T('/')) || (Config.File_Names[0].size()>=7 && Config.File_Names[0][0]==__T('m') && Config.File_Names[0][1]==__T('m') && Config.File_Names[0][2]==__T('s') && Config.File_Names[0][3]==__T('h') && Config.File_Names[0][4]==__T(':') && Config.File_Names[0][5]==__T('/') && Config.File_Names[0][6]==__T('/'))) #if defined(MEDIAINFO_LIBMMS_YES) Reader_libmms().Format_Test(this, Config.File_Names[0]); #else //MEDIAINFO_LIBMMS_YES { #if MEDIAINFO_EVENTS struct MediaInfo_Event_Log_0 Event; Event.EventCode=MediaInfo_EventCode_Create(MediaInfo_Parser_None, MediaInfo_Event_Log, 0); Event.Type=0xC0; Event.Severity=0xFF; Event.MessageCode=0; Event.MessageStringU=L"Libmms cupport is disabled due to compilation options"; Event.MessageStringA="Libmms cupport is disabled due to compilation options"; MediaInfoLib::Config.Event_Send((const int8u*)&Event, sizeof(MediaInfo_Event_Log_0)); #endif //MEDIAINFO_EVENTS } #endif //MEDIAINFO_LIBMMS_YES else if (Config.File_Names[0].find(__T("://"))!=string::npos) #if defined(MEDIAINFO_LIBCURL_YES) { CS.Enter(); if (Reader) { CS.Leave(); return; //There is a problem } Reader=new Reader_libcurl(); CS.Leave(); Reader->Format_Test(this, Config.File_Names[0]); #if MEDIAINFO_NEXTPACKET if (Config.NextPacket_Get()) return; #endif //MEDIAINFO_NEXTPACKET } #else //MEDIAINFO_LIBCURL_YES { #if MEDIAINFO_EVENTS struct MediaInfo_Event_Log_0 Event; Event.EventCode=MediaInfo_EventCode_Create(MediaInfo_Parser_None, MediaInfo_Event_Log, 0); Event.Type=0xC0; Event.Severity=0xFF; Event.MessageCode=0; Event.MessageStringU=L"Libcurl support is disabled due to compilation options"; Event.MessageStringA="Libcurl support is disabled due to compilation options"; MediaInfoLib::Config.Event_Send((const int8u*)&Event, sizeof(MediaInfo_Event_Log_0)); #endif //MEDIAINFO_EVENTS } #endif //MEDIAINFO_LIBCURL_YES #if defined(MEDIAINFO_DIRECTORY_YES) else if (Dir::Exists(Config.File_Names[0])) Reader_Directory().Format_Test(this, Config.File_Names[0]); #endif //MEDIAINFO_DIRECTORY_YES #if defined(MEDIAINFO_FILE_YES) else if (File::Exists(Config.File_Names[0])) { #if defined(MEDIAINFO_REFERENCES_YES) string Dxw; if (Config.File_CheckSideCarFiles_Get() && !Config.File_IsReferenced_Get()) { FileName Test(Config.File_Names[0]); Ztring FileExtension=Test.Extension_Get(); FileExtension.MakeLowerCase(); if (FileExtension!=__T("dfxp")) { Test.Extension_Set(__T("dfxp")); if (File::Exists(Test)) Dxw+=" \r\n"; } if (FileExtension!=__T("sami")) { Test.Extension_Set(__T("sami")); if (File::Exists(Test)) Dxw+=" \r\n"; } if (FileExtension!=__T("sc2")) { Test.Extension_Set(__T("sc2")); if (File::Exists(Test)) Dxw+=" \r\n"; } if (FileExtension!=__T("scc")) { Test.Extension_Set(__T("scc")); if (File::Exists(Test)) Dxw+=" \r\n"; } if (FileExtension!=__T("smi")) { Test.Extension_Set(__T("smi")); if (File::Exists(Test)) Dxw+=" \r\n"; } if (FileExtension!=__T("srt")) { Test.Extension_Set(__T("srt")); if (File::Exists(Test)) Dxw+=" \r\n"; } if (FileExtension!=__T("stl")) { Test.Extension_Set(__T("stl")); if (File::Exists(Test)) Dxw+=" \r\n"; } if (FileExtension!=__T("ttml")) { Test.Extension_Set(__T("ttml")); if (File::Exists(Test)) Dxw+=" \r\n"; } if (FileExtension!=__T("ssa")) { Test.Extension_Set(__T("ssa")); if (File::Exists(Test)) Dxw+=" \r\n"; } if (FileExtension!=__T("ass")) { Test.Extension_Set(__T("ass")); if (File::Exists(Test)) Dxw+=" \r\n"; } Ztring Name=Test.Name_Get(); Ztring BaseName=Name.SubString(Ztring(), __T("_")); if (!BaseName.empty()) { ZtringList List; List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_audio.mp4"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_sub.dfxp"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_sub.sami"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_sub.sc2"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_sub.scc"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_sub.smi"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_sub.srt"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_sub.stl"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_forcesub.dfxp"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_forcesub.sami"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_forcesub.sc2"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_forcesub.scc"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_forcesub.smi"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_forcesub.srt"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_forcesub.stl"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_cc.dfxp"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_cc.sami"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_cc.sc2"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_cc.scc"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_cc.smi"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_cc.srt"), Dir::Include_Files); List+=Dir::GetAllFileNames(Test.Path_Get()+PathSeparator+BaseName+__T("_*_cc.stl"), Dir::Include_Files); for (size_t Pos=0; Pos\r\n"; } if (!Dxw.empty()) { Dxw.insert(0, "\r\n" "\r\n" " \r\n"); Dxw.append("\r\n"); Config.File_FileNameFormat_Set(__T("Dxw")); } } if (Dxw.empty()) { CS.Enter(); if (Reader) { CS.Leave(); return; //There is a problem } Reader=new Reader_File(); CS.Leave(); Reader->Format_Test(this, Config.File_Names[0]); } else { Open_Buffer_Init(Dxw.size(), FileName(Config.File_Names[0]).Path_Get()+PathSeparator+FileName(Config.File_Names[0]).Name_Get()); Open_Buffer_Continue((const int8u*)Dxw.c_str(), Dxw.size()); #if MEDIAINFO_NEXTPACKET if (Config.NextPacket_Get()) return; #endif //MEDIAINFO_NEXTPACKET Open_Buffer_Finalize(); } #else //defined(MEDIAINFO_REFERENCES_YES) CS.Enter(); if (Reader) { CS.Leave(); return; //There is a problem } Reader=new Reader_File(); CS.Leave(); Reader->Format_Test(this, Config.File_Names[0]); #endif //defined(MEDIAINFO_REFERENCES_YES) #if MEDIAINFO_NEXTPACKET if (Config.NextPacket_Get()) return; #endif //MEDIAINFO_NEXTPACKET } #endif //MEDIAINFO_FILE_YES CS.Enter(); Config.State_Set(1); CS.Leave(); } //--------------------------------------------------------------------------- size_t MediaInfo_Internal::Open (const int8u* Begin, size_t Begin_Size, const int8u* End, size_t End_Size, int64u File_Size) { Open_Buffer_Init(File_Size); Open_Buffer_Continue(Begin, Begin_Size); if (End && Begin_Size+End_Size<=File_Size) { Open_Buffer_Init(File_Size, File_Size-End_Size); Open_Buffer_Continue(End, End_Size); } Open_Buffer_Finalize(); return 1; } //--------------------------------------------------------------------------- size_t MediaInfo_Internal::Open_Buffer_Init (int64u File_Size_, const String &File_Name) { CriticalSectionLocker CSL(CS); if (Config.File_Names.size()<=1) //If analyzing multiple files, theses members are adapted in File_Reader.cpp { if (File_Size_!=(int64u)-1) Config.File_Size=Config.File_Current_Size=File_Size_; } if (Info==NULL) { if (!Config.File_ForceParser_Get().empty()) { CS.Leave(); SelectFromExtension(Config.File_ForceParser_Get()); CS.Enter(); } if (Info==NULL) { Info=new File__MultipleParsing; Info_IsMultipleParsing=true; } } #if MEDIAINFO_TRACE Info->Init(&Config, &Details, &Stream, &Stream_More); #else //MEDIAINFO_TRACE Info->Init(&Config, &Stream, &Stream_More); #endif //MEDIAINFO_TRACE if (!File_Name.empty()) Info->File_Name=File_Name; Info->Open_Buffer_Init(File_Size_); #if MEDIAINFO_EVENTS { struct MediaInfo_Event_General_Start_0 Event; memset(&Event, 0xFF, sizeof(struct MediaInfo_Event_Generic)); Event.EventCode=MediaInfo_EventCode_Create(MediaInfo_Parser_None, MediaInfo_Event_General_Start, 0); Event.EventSize=sizeof(struct MediaInfo_Event_General_Start_0); Event.StreamIDs_Size=0; Event.Stream_Size=File_Size_; Event.FileName=NULL; Event.FileName_Unicode=File_Name.c_str(); Config.Event_Send(NULL, (const int8u*)&Event, sizeof(MediaInfo_Event_General_Start_0)); } #endif //MEDIAINFO_EVENTS return 1; } //--------------------------------------------------------------------------- size_t MediaInfo_Internal::Open_Buffer_Init (int64u File_Size_, int64u File_Offset_) { MEDIAINFO_DEBUG_CONFIG_TEXT(Debug+=__T("Open_Buffer_Init, File_Size=");Debug+=Ztring::ToZtring(File_Size_);Debug+=__T(", File_Offset=");Debug+=Ztring::ToZtring(File_Offset_);) #ifdef MEDIAINFO_DEBUG_BUFFER if (Info && File_Offset_>Info->File_Offset) { size_t Temp_Size=(size_t)(File_Offset_-Info->File_Offset); int8u* Temp=new int8u[Temp_Size]; std::memset(Temp, 0xCC, Temp_Size); MEDIAINFO_DEBUG_BUFFER_SAVE(Temp, Temp_Size); delete[] Temp; } #endif //MEDIAINFO_DEBUG_BUFFER if (Config.File_Names.size()<=1) //If analyzing multiple files, theses members are adapted in File_Reader.cpp { if (File_Size_!=(int64u)-1) Config.File_Size=Config.File_Current_Size=File_Size_; } if (Info==NULL || File_Size_!=(int64u)-1) Open_Buffer_Init(File_Size_); if (File_Offset_!=(int64u)-1 && Info) { CriticalSectionLocker CSL(CS); Info->Open_Buffer_Position_Set(File_Offset_); } #if MEDIAINFO_EVENTS if (Info && Info->Status[File__Analyze::IsAccepted]) { struct MediaInfo_Event_General_Move_Done_0 Event; memset(&Event, 0xFF, sizeof(struct MediaInfo_Event_Generic)); Event.EventCode=MediaInfo_EventCode_Create(MediaInfo_Parser_None, MediaInfo_Event_General_Move_Done, 0); Event.EventSize=sizeof(struct MediaInfo_Event_General_Move_Done_0); Event.StreamIDs_Size=0; Event.StreamOffset=File_Offset_; Config.Event_Send(NULL, (const int8u*)&Event, sizeof(MediaInfo_Event_General_Move_Done_0)); } else { struct MediaInfo_Event_General_Start_0 Event; memset(&Event, 0xFF, sizeof(struct MediaInfo_Event_Generic)); Event.EventCode=MediaInfo_EventCode_Create(MediaInfo_Parser_None, MediaInfo_Event_General_Start, 0); Event.EventSize=sizeof(struct MediaInfo_Event_General_Start_0); Event.StreamIDs_Size=0; Event.Stream_Size=File_Size_; Event.FileName=NULL; Event.FileName_Unicode=NULL; Config.Event_Send(NULL, (const int8u*)&Event, sizeof(MediaInfo_Event_General_Start_0)); } #endif //MEDIAINFO_EVENTS EXECUTE_SIZE_T(1, Debug+=__T("Open_Buffer_Init, will return 1");) } //--------------------------------------------------------------------------- void MediaInfo_Internal::Open_Buffer_Unsynch () { MEDIAINFO_DEBUG_CONFIG_TEXT(Debug+=__T("Open_Buffer_Unsynch");) if (Info==NULL) return; CriticalSectionLocker CSL(CS); Info->Open_Buffer_Unsynch(); } //--------------------------------------------------------------------------- std::bitset<32> MediaInfo_Internal::Open_Buffer_Continue (const int8u* ToAdd, size_t ToAdd_Size) { CriticalSectionLocker CSL(CS); MEDIAINFO_DEBUG_BUFFER_SAVE(ToAdd, ToAdd_Size); if (Info==NULL) return 0; Info->Open_Buffer_Continue(ToAdd, ToAdd_Size); if (Info_IsMultipleParsing && Info->Status[File__Analyze::IsAccepted]) { //Found File__Analyze* Info_ToDelete=Info; Info=((File__MultipleParsing*)Info)->Parser_Get(); delete Info_ToDelete; //Info_ToDelete=NULL; Info_IsMultipleParsing=false; } #if 0 //temp, for old users //The parser wanted seek but the buffer is not seekable if (Info->File_GoTo!=(int64u)-1 && Config.File_IsSeekable_Get()==0) { Info->Open_Buffer_Finalize(true); Info->File_GoTo=(int64u)-1; MEDIAINFO_DEBUG_CONFIG_TEXT(Debug+=__T("Open_Buffer_Continue, will return 0");) return 0; } return 1; #else //The parser wanted seek but the buffer is not seekable if (Info->File_GoTo!=(int64u)-1 && Config.File_IsSeekable_Get()==0) { Info->Fill(); Info->File_GoTo=(int64u)-1; } return Info->Status; #endif } //--------------------------------------------------------------------------- int64u MediaInfo_Internal::Open_Buffer_Continue_GoTo_Get () { CriticalSectionLocker CSL(CS); if (Info==NULL) return (int64u)-1; if (Info->File_GoTo==(int64u)-1 || (Info->File_GoTo>=Info->File_Offset && Info->File_GoToFile_Offset+0x10000)) //If jump is tiny, this is not worth the performance cost due to seek return (int64u)-1; else return Info->File_GoTo; } //--------------------------------------------------------------------------- bool MediaInfo_Internal::Open_Buffer_Position_Set(int64u File_Offset) { CriticalSectionLocker CSL(CS); if (Info==NULL) return false; Info->Open_Buffer_Position_Set(File_Offset); return true; } //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t MediaInfo_Internal::Open_Buffer_Seek (size_t Method, int64u Value, int64u ID) { CriticalSectionLocker CSL(CS); if (Info==NULL) return false; return Info->Open_Buffer_Seek(Method, Value, ID); } #endif //MEDIAINFO_SEEK //--------------------------------------------------------------------------- size_t MediaInfo_Internal::Open_Buffer_Finalize () { CS.Enter(); if (Info && Info->Status[File__Analyze::IsUpdated]) { Info->Open_Buffer_Update(); Info->Status[File__Analyze::IsUpdated]=false; for (size_t Pos=File__Analyze::User_16; PosStatus[Pos]=false; } CS.Leave(); CriticalSectionLocker CSL(CS); MEDIAINFO_DEBUG_CONFIG_TEXT(Debug+=__T("Open_Buffer_Finalize");) if (Info==NULL) return 0; Info->Open_Buffer_Finalize(); #if MEDIAINFO_DEMUX if (Config.Demux_EventWasSent) return 0; #endif //MEDIAINFO_DEMUX //Cleanup if (!Config.File_IsSub_Get() && !Config.File_KeepInfo_Get()) //We need info for the calling parser { delete Info; Info=NULL; } if (Config.File_Names_Pos>=Config.File_Names.size()) { delete[] Config.File_Buffer; Config.File_Buffer=NULL; Config.File_Buffer_Size=0; Config.File_Buffer_Size_Max=0; } EXECUTE_SIZE_T(1, Debug+=__T("Open_Buffer_Finalize, will return 1")) } //--------------------------------------------------------------------------- std::bitset<32> MediaInfo_Internal::Open_NextPacket () { CriticalSectionLocker CSL(CS); bool Demux_EventWasSent=false; if (Info==NULL || !Info->Status[File__Analyze::IsFinished]) { #if !defined(MEDIAINFO_READER_NO) if (Reader) { CS.Leave(); Demux_EventWasSent=(Reader->Format_Test_PerParser_Continue(this)==2); CS.Enter(); } else #endif //defined(MEDIAINFO_READER_NO) { #if MEDIAINFO_NEXTPACKET Config.Demux_EventWasSent=false; #endif //MEDIAINFO_NEXTPACKET Open_Buffer_Continue(NULL, 0); #if MEDIAINFO_NEXTPACKET Demux_EventWasSent=Config.Demux_EventWasSent; if (!Demux_EventWasSent) #endif //MEDIAINFO_NEXTPACKET Open_Buffer_Finalize(); } } std::bitset<32> ToReturn=Info==NULL?std::bitset<32>(0x0F):Info->Status; if (Demux_EventWasSent) ToReturn[8]=true; //bit 8 is for the reception of a frame return ToReturn; } //--------------------------------------------------------------------------- void MediaInfo_Internal::Close() { if (IsRunning()) { RequestTerminate(); while(IsExited()) Yield(); } CriticalSectionLocker CSL(CS); MEDIAINFO_DEBUG_CONFIG_TEXT(Debug+=__T("Close");) Stream.clear(); Stream.resize(Stream_Max); Stream_More.clear(); Stream_More.resize(Stream_Max); delete Info; Info=NULL; #if !defined(MEDIAINFO_READER_NO) delete Reader; Reader=NULL; #endif //defined(MEDIAINFO_READER_NO) } //*************************************************************************** // Get File info //*************************************************************************** /*//--------------------------------------------------------------------------- Ztring MediaInfo_Internal::Inform(size_t) { //Info case if (Info) return Info->Inform(); if (!Info) return MediaInfoLib::Config.EmptyString_Get(); return Info->Inform(); } */ //--------------------------------------------------------------------------- Ztring MediaInfo_Internal::Get(stream_t StreamKind, size_t StreamPos, size_t Parameter, info_t KindOfInfo) { CriticalSectionLocker CSL(CS); MEDIAINFO_DEBUG_CONFIG_TEXT(Debug+=__T("Get, StreamKind=");Debug+=Ztring::ToZtring((size_t)StreamKind);Debug+=__T(", StreamPos=");Debug+=Ztring::ToZtring(StreamPos);Debug+=__T(", Parameter=");Debug+=Ztring::ToZtring(Parameter);) if (Info && Info->Status[File__Analyze::IsUpdated]) { Info->Open_Buffer_Update(); Info->Status[File__Analyze::IsUpdated]=false; for (size_t Pos=File__Analyze::User_16; PosStatus[Pos]=false; } //Check integrity if (StreamKind>=Stream_Max || StreamPos>=Stream[StreamKind].size() || Parameter>=MediaInfoLib::Config.Info_Get(StreamKind).size()+Stream_More[StreamKind][StreamPos].size() || KindOfInfo>=Info_Max) return MediaInfoLib::Config.EmptyString_Get(); //Parameter is unknown else if (ParameterInfo_Text is in static lists if (KindOfInfo!=Info_Text) EXECUTE_STRING(MediaInfoLib::Config.Info_Get(StreamKind, Parameter, KindOfInfo), Debug+=__T("Get, will return ");Debug+=ToReturn;) //look for static information only else if (ParameterSet(StreamKind, StreamPos, Parameter, ToSet, OldValue); } //--------------------------------------------------------------------------- size_t MediaInfo_Internal::Set(const String &ToSet, stream_t StreamKind, size_t StreamPos, const String &Parameter, const String &OldValue) { CriticalSectionLocker CSL(CS); if (!Info) return 0; return Info->Set(StreamKind, StreamPos, Parameter, ToSet, OldValue); } //*************************************************************************** // Output buffer //*************************************************************************** //--------------------------------------------------------------------------- size_t MediaInfo_Internal::Output_Buffer_Get (const String &Value) { CriticalSectionLocker CSL(CS); if (!Info) return 0; MEDIAINFO_DEBUG_OUTPUT_VALUE(Value, Info->Output_Buffer_Get(Value)); } //--------------------------------------------------------------------------- size_t MediaInfo_Internal::Output_Buffer_Get (size_t Pos) { CriticalSectionLocker CSL(CS); if (!Info) return 0; MEDIAINFO_DEBUG_OUTPUT_POS(Pos, Info->Output_Buffer_Get(Pos)); } //*************************************************************************** // Information //*************************************************************************** //--------------------------------------------------------------------------- String MediaInfo_Internal::Option (const String &Option, const String &Value) { CriticalSectionLocker CSL(CS); MEDIAINFO_DEBUG_CONFIG_TEXT(Debug+=__T("Option, Option=");Debug+=Ztring(Option);Debug+=__T(", Value=");Debug+=Ztring(Value);) Ztring OptionLower=Option; OptionLower.MakeLowerCase(); if (Option.empty()) return __T(""); else if (OptionLower==__T("language_update")) { if (!Info || Info->Get(Stream_General, 0, __T("CompleteName"))==__T("")) return __T(""); ZtringListList Language=Value.c_str(); MediaInfoLib::Config.Language_Set(Language); return __T(""); } else if (OptionLower==__T("create_dummy")) { CreateDummy (Value); delete Info; Info=NULL; return __T(""); } else if (OptionLower==__T("thread")) { BlockMethod=1; return __T(""); } else if (Option==__T("info_capacities")) { return __T("Option removed"); } #if MEDIAINFO_TRACE else if (OptionLower.find(__T("file_details_clear"))==0) { if (Info) Info->Details_Clear(); return __T(""); } #endif //MEDIAINFO_TRACE else if (OptionLower.find(__T("file_seek"))==0) { #if MEDIAINFO_SEEK if (Reader==NULL && Info==NULL) return __T("Error: Reader pointer is empty"); size_t Method=(size_t)-1; int64u SeekValue=(int64u)-1; int64u ID=(int64u)-1; ZtringList List; List.Separator_Set(0, __T(",")); List.Write(Value); for (size_t Pos=0; PosOption_Manage(); MEDIAINFO_DEBUG_OUTPUT_INIT(ToReturn2, Debug+=__T("Option, will return ");Debug+=ToReturn;) } else EXECUTE_STRING(MediaInfoLib::Config.Option(Option, Value), Debug+=__T("Option, will return ");Debug+=ToReturn;) } //--------------------------------------------------------------------------- size_t MediaInfo_Internal::Count_Get (stream_t StreamKind, size_t StreamPos) { CriticalSectionLocker CSL(CS); if (Info && Info->Status[File__Analyze::IsUpdated]) { Info->Open_Buffer_Update(); Info->Status[File__Analyze::IsUpdated]=false; for (size_t Pos=File__Analyze::User_16; PosStatus[Pos]=false; } //Integrity if (StreamKind>=Stream_Max) return 0; //Count of streams if (StreamPos==Error) return Stream[StreamKind].size(); //Integrity if (StreamPos>=Stream[StreamKind].size()) return 0; //Count of piece of information in a stream return MediaInfoLib::Config.Info_Get(StreamKind).size()+Stream_More[StreamKind][StreamPos].size(); } //--------------------------------------------------------------------------- size_t MediaInfo_Internal::State_Get () { CriticalSectionLocker CSL(CS); return (size_t)(Config.State_Get()*10000); } //--------------------------------------------------------------------------- void MediaInfo_Internal::TestContinuousFileNames () { CriticalSectionLocker CSL(CS); if (Info) Info->TestContinuousFileNames(); } //--------------------------------------------------------------------------- #if MEDIAINFO_EVENTS void MediaInfo_Internal::Event_Prepare (struct MediaInfo_Event_Generic* Event) { CriticalSectionLocker CSL(CS); if (Info) Info->Event_Prepare(Event); } #endif // MEDIAINFO_EVENTS } //NameSpace MediaInfoLib/Source/MediaInfo/MediaInfo_Internal.h100777 0 0 20011 12226004262 15420 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Give information about a lot of media files // Dispatch the file to be tested by all containers // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_InternalH #define MediaInfo_InternalH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // For developer: you can disable or enable traces //#define MEDIAINFO_DEBUG_CONFIG //#define MEDIAINFO_DEBUG_BUFFER //#define MEDIAINFO_DEBUG_OUTPUT //#define MEDIAINFO_DEBUG_WARNING_GET // For developer: customization of traces #ifdef MEDIAINFO_DEBUG_BUFFER const size_t MEDIAINFO_DEBUG_BUFFER_SAVE_FileSize=128*1024*1024; #endif //MEDIAINFO_DEBUG_BUFFER //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/MediaInfo_Config.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "ZenLib/Thread.h" #if defined (MEDIAINFO_DEBUG_CONFIG) || defined (MEDIAINFO_DEBUG_BUFFER) || defined (MEDIAINFO_DEBUG_OUTPUT) #include #include #endif //MEDIAINFO_DEBUG //--------------------------------------------------------------------------- namespace MediaInfoLib { class File__Analyze; class Internet__Base; class Reader__Base; //*************************************************************************** /// @brief MediaInfo_Internal /// @version 0.7 //*************************************************************************** class MediaInfo_Internal : public ZenLib::Thread { public : //Constructor/Destructor MediaInfo_Internal (); ~MediaInfo_Internal (); //File size_t Open (const String &File_Name); size_t Open (const ZenLib::int8u* Begin, size_t Begin_Size, const ZenLib::int8u* End=NULL, size_t End_Size=0, ZenLib::int64u File_Size=0); size_t Open_Buffer_Init (ZenLib::int64u File_Size=(ZenLib::int64u)-1, const String &File_Name=String()); size_t Open_Buffer_Init (ZenLib::int64u File_Size, ZenLib::int64u File_Offset); std::bitset<32> Open_Buffer_Continue (const ZenLib::int8u* Buffer, size_t Buffer_Size); ZenLib::int64u Open_Buffer_Continue_GoTo_Get (); bool Open_Buffer_Position_Set(int64u File_Offset); #if MEDIAINFO_SEEK size_t Open_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK void Open_Buffer_Unsynch (); size_t Open_Buffer_Finalize (); std::bitset<32> Open_NextPacket (); void Close (); //General information Ztring Inform (); Ztring Inform (stream_t StreamKind, size_t StreamNumber, bool IsDirect); //All about only a specific stream //Get Ztring Get (stream_t StreamKind, size_t StreamNumber, size_t Parameter, info_t InfoKind=Info_Text); Ztring Get (stream_t StreamKind, size_t StreamNumber, const String &Parameter, info_t InfoKind=Info_Text, info_t SearchKind=Info_Name); //Set size_t Set (const String &ToSet, stream_t StreamKind, size_t StreamNumber, size_t Parameter, const String &OldValue=__T("")); size_t Set (const String &ToSet, stream_t StreamKind, size_t StreamNumber, const String &Parameter, const String &OldValue=__T("")); //Output_Buffered size_t Output_Buffer_Get (const String &Value); size_t Output_Buffer_Get (size_t Pos); //Info String Option (const String &Option, const String &Value=__T("")); size_t State_Get (); size_t Count_Get (stream_t StreamKind, size_t StreamNumber=(size_t)-1); //Position in a MediaInfoList class bool IsFirst; bool IsLast; //Internal static bool LibraryIsModified(); //Is the library has been modified? (#defines...) private : friend class File_Bdmv; //Theses classes need access to internal structure for optimization. There is recursivity with theses formats friend class File_Cdxa; //Theses classes need access to internal structure for optimization. There is recursivity with theses formats friend class File_Lxf; //Theses classes need access to internal structure for optimization. There is recursivity with theses formats friend class File_Mpeg4; //Theses classes need access to internal structure for optimization. There is recursivity with theses formats friend class File_MpegTs;//Theses classes need access to internal structure for optimization. There is recursivity with theses formats friend class File_MpegPs;//Theses classes need access to internal structure for optimization. There is recursivity with theses formats friend class File_Mxf; //Theses classes need access to internal structure for optimization. There is recursivity with theses formats friend class File_DcpAm; //Theses classes need access to internal structure for optimization. There is recursivity with theses formats friend class File_DcpCpl;//Theses classes need access to internal structure for optimization. There is recursivity with theses formats friend class File_DcpPkl;//Theses classes need access to internal structure for optimization. There is recursivity with theses formats friend class File__ReferenceFilesHelper; //Theses classes need access to internal structure for optimization. There is recursivity with theses formats //Parsing handles File__Analyze* Info; Internet__Base* Internet; #if !defined(MEDIAINFO_READER_NO) Reader__Base* Reader; #endif //defined(MEDIAINFO_READER_NO) //Helpers void CreateDummy (const String& Value); //Create dummy Information MediaInfo_Internal(const MediaInfo_Internal&); // Copy Constructor //Open Buffer bool Info_IsMultipleParsing; //Config std::vector > Stream; std::vector > Stream_More; Ztring Details; void Traiter(Ztring &C); //enleve les $if... public : bool SelectFromExtension (const String &Parser); //Select File_* from the parser name void TestContinuousFileNames(); #if MEDIAINFO_EVENTS void Event_Prepare (struct MediaInfo_Event_Generic* Event); #endif // MEDIAINFO_EVENTS #if !defined(MEDIAINFO_READER_NO) int ListFormats(const String &File_Name=String()); #else //!defined(MEDIAINFO_READER_NO) int ListFormats(const String &File_Name=String()) {return 0;} #endif //!defined(MEDIAINFO_READER_NO) MediaInfo_Config_MediaInfo Config; Ztring Xml_Name_Escape(const Ztring &Name); Ztring Xml_Content_Escape(const Ztring &Content, size_t &Modified); Ztring &Xml_Content_Escape_Modifying(Ztring &Content, size_t &Modified); private : //Threading size_t BlockMethod; //Open() return: 0=immedialtly, 1=after local info, 2=when user interaction is needed bool IsInThread; void Entry(); ZenLib::CriticalSection CS; #ifdef MEDIAINFO_DEBUG_CONFIG File Debug_Config; #endif //MEDIAINFO_DEBUG_CONFIG #ifdef MEDIAINFO_DEBUG_BUFFER File Debug_Buffer_Stream; int64u Debug_Buffer_Stream_Order; File Debug_Buffer_Sizes; int64u Debug_Buffer_Sizes_Count; #endif //MEDIAINFO_DEBUG_BUFFER #ifdef MEDIAINFO_DEBUG_OUTPUT map Debug_Output_Value_Stream; //Key is the memory address map Debug_Output_Value_Sizes; //Key is the memory address vector Debug_Output_Pos_Stream; //Key is the pos vector Debug_Output_Pos_Sizes; //Key is the pos vector Debug_Output_Pos_Pointer; //Key is the pos #endif //MEDIAINFO_DEBUG_OUTPUT }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/MediaInfo_Internal_Const.h100777 0 0 10331 12226004262 16572 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Global configuration of MediaInfo // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_Internal_ConstH #define MediaInfo_Internal_ConstH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/MediaInfo_Const.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- /// @brief Used with Format info enum infoformat_t { InfoFormat_Name, ///< InfoFormat_LongName, ///< InfoFormat_Family, ///< InfoFormat_KindofFormat, ///< InfoFormat_Parser, ///< InfoFormat_Info, ///< InfoFormat_Extensions, ///< InfoFormat_InternetMediaType, ///< InfoFormat_Url, ///< InfoFormat_Compression_Mode, ///< InfoFormat_Max }; /// @brief Used with Codec ID info enum infocodecid_t { InfoCodecID_Codec, ///< InfoCodecID_Format, ///< InfoCodecID_Hint, ///< InfoCodecID_Description, ///< InfoCodecID_Url, ///< InfoCodecID_Profile, ///< InfoCodecID_Version, ///< InfoCodecID_ColorSpace, ///< InfoCodecID_ChromaSubsampling, ///< InfoCodecID_BitDepth, ///< InfoCodecID_Compression_Mode, ///< InfoCodecID_Max }; /// @brief Used with Codec ID info (Format type part) enum infocodecid_format_t { InfoCodecID_Format_Matroska, ///< InfoCodecID_Format_Mpeg4, ///< InfoCodecID_Format_Real, ///< InfoCodecID_Format_Riff, ///< InfoCodecID_Format_Max }; /// @brief Used with Codec info enum infocodec_t { InfoCodec_Codec, ///< InfoCodec_Name, ///< InfoCodec_KindOfCode, ///< InfoCodec_KindOfStream, ///< InfoCodec_KindofCodec, ///< InfoCodec_BitRate_Mode, ///< InfoCodec_Description, ///< InfoCodec_Url, ///< InfoCodec_Max }; /// @brief Used with Encoder info enum infoencoder_t { InfoEncoder_Name, ///< InfoEncoder_LongName, ///< InfoEncoder_Date, ///< InfoEncoder_Max }; /// @brief Used with Library info enum infolibrary_t { InfoLibrary_Numlber, ///< InfoLibrary_Version, ///< InfoLibrary_Date, ///< InfoLibrary_Max }; /// @brief Used with Library info (Format type part) enum infolibrary_format_t { InfoLibrary_Format_DivX, ///< InfoLibrary_Format_XviD, ///< InfoLibrary_Format_MainConcept_Avc, ///< InfoLibrary_Format_VorbisCom, ///< InfoLibrary_Format_Max }; /// @brief Used by BlockMethod enum blockmethod_t { BlockMethod_Now, ///< Return now, without parsing (init only) BlockMethod_Often, ///< Return as often as possible BlockMethod_Local, ///< Return after local parsing (no Internet connection) BlockMethod_Needed, ///< Return when a user interaction is needed BlockMethod_Max }; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //Char types #if defined(UNICODE) || defined (_UNICODE) typedef wchar_t Char; #undef __T #define __T(__x) L ## __x #else typedef char Char; #undef __T #define __T(__x) __x #endif //--------------------------------------------------------------------------- } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/ 40777 0 0 0 12262743712 13253 5MediaInfoLib/Source/MediaInfo/Multiple/File_Aaf.cpp100777 0 0 56210 12262536007 15526 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AAF_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Aaf.h" #include "MediaInfo/Multiple/File__ReferenceFilesHelper.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "ZenLib/FileName.h" #include "ZenLib/File.h" #include "tinyxml2.h" using namespace ZenLib; using namespace tinyxml2; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Info //*************************************************************************** const char* AAf_tagSTGTY (int8u tagSTGTY) { switch (tagSTGTY) { case 0 : return "unknown"; case 1 : return "storage"; case 2 : return "stream"; case 3 : return "ILockBytes"; case 4 : return "IPropertyStorage"; case 5 : return "root"; default: return ""; } } const char* AAf_tagDECOLOR (int8u tagDECOLOR) { switch (tagDECOLOR) { case 0 : return "red"; case 1 : return "black"; default: return ""; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Aaf::File_Aaf() :File__Analyze() { #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Aaf; StreamIDs_Width[0]=16; #endif //MEDIAINFO_EVENTS //Temp ReferenceFiles=NULL; } //--------------------------------------------------------------------------- File_Aaf::~File_Aaf() { for (size_t Pos=0; PosParseReferences(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_Aaf::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { if (ReferenceFiles==NULL) return 0; return ReferenceFiles->Read_Buffer_Seek(Method, Value, ID); } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Aaf::FileHeader_Begin() { if (File_Size<0x100) { Reject("Aaf"); return false; } //Element_Size if (Buffer_Size109?109:csectFat); Pos++) { int32u sectFat; Get_L4 (sectFat, "sectFat"); sectsFat.push_back(sectFat); } if (csectFat<109) Skip_XX((109-csectFat)*4, "unused sectsFat"); Element_End(); Element_End(); FILLING_BEGIN(); Fill("Aaf"); Step=Step_Fat; sectsFat_Pos=0; if (sectsFat.empty()) { Finish(); } else GoTo((1+sectsFat[0])*(1<Size>SectorShift)-1; if (Pointers_PosStreamOffsets[0]); } } else Finish(); } else Finish(); } //--------------------------------------------------------------------------- void File_Aaf::Fat() { //Parsing while (Element_OffsetDirectory_Pos=Directory_Pos; Stream->Size=Size; Stream->Name=ab; if (Size>(SectorShift-MiniSectorShift); int32u MiniSectPos=Pointers_Pos&((((size_t)1)<<(SectorShift-MiniSectorShift))-1); Stream->StreamOffsets.push_back(((1+sectsMiniStream[SectPos])<StreamOffsets.push_back((1+Pointers_Pos)<=Streams.size() || Streams[Streams_Pos]->Size>=0x1000000) //TODO: more serious test about size return; //Incoherancy //Saving data if (Streams[Streams_Pos]->StreamOffsets.size()!=1) { Skip_XX(Element_Size, "Stream data"); int16u Shift=(Streams[Streams_Pos]->SizeBuffer==NULL) Streams[Streams_Pos]->Buffer=new int8u[(size_t)((1+(Streams[Streams_Pos]->Size>>Shift))<Buffer+Streams_Pos2*(((int64u)1)<=Streams[Streams_Pos]->StreamOffsets.size()) { Element_Offset=0; StreamElement_Parse(); Streams_Pos++; Streams_Pos2=0; } if (Streams_PosStreamOffsets[Streams_Pos2]); else Finish(); } //--------------------------------------------------------------------------- void File_Aaf::StreamElement_Parse() { //Searching emulation_prevention_three_byte const int8u* Save_Buffer=Buffer; int64u Save_File_Offset=File_Offset; size_t Save_Buffer_Offset=Buffer_Offset; int64u Save_Element_Size=Element_Size; if (Streams[Streams_Pos]->Buffer) { //We must change the buffer for keeping out Element_Size=Streams[Streams_Pos]->Size; File_Offset=Streams[Streams_Pos]->StreamOffsets[0]; Buffer_Offset=0; Buffer=Streams[Streams_Pos]->Buffer; } //Parsing Element_Info1(Streams[Streams_Pos]->Directory_Pos); Element_Info1(Streams[Streams_Pos]->Name); int16u Count; Skip_L2( "0x204C?"); Get_L2 (Count, "Count"); vector Sizes; vector Keys; for (int16u Pos=0; PosBuffer) { //We must change the buffer for keeping out Element_Size=Save_Element_Size; File_Offset=Save_File_Offset; Buffer_Offset=Save_Buffer_Offset; delete[] Buffer; Buffer=Save_Buffer; Element_Offset=Element_Size; } } //--------------------------------------------------------------------------- void File_Aaf::MetaDictionary() { Skip_UTF16L(xxxSize, "Data"); } //--------------------------------------------------------------------------- void File_Aaf::Header() { Skip_UTF16L(xxxSize, "Data"); } //--------------------------------------------------------------------------- void File_Aaf::ClassDefinitions() { Skip_UTF16L(xxxSize, "Data"); } //--------------------------------------------------------------------------- void File_Aaf::TypeDefinitions() { Skip_UTF16L(xxxSize, "Data"); } //--------------------------------------------------------------------------- void File_Aaf::Identification() { Skip_B8( "Part2"); Skip_B8( "Part1"); } //--------------------------------------------------------------------------- void File_Aaf::Name() { Skip_UTF16L(xxxSize, "Data"); } //--------------------------------------------------------------------------- void File_Aaf::MetaDefinition() { Skip_UTF16L(xxxSize, "Data"); } //--------------------------------------------------------------------------- void File_Aaf::ParentClass() { Skip_B5( "WeakReference"); Skip_B8( "Part2"); Skip_B8( "Part1"); } //--------------------------------------------------------------------------- void File_Aaf::Properties() { Skip_UTF16L(xxxSize, "Data"); } //--------------------------------------------------------------------------- void File_Aaf::IsConcrete() { Skip_L1( "Data"); } //--------------------------------------------------------------------------- void File_Aaf::Type() { Skip_B8( "Part2"); Skip_B8( "Part1"); } //--------------------------------------------------------------------------- void File_Aaf::IsOptional() { Skip_L1( "Data"); } //--------------------------------------------------------------------------- void File_Aaf::LocalIdentification() { Skip_L2( "Data"); } //--------------------------------------------------------------------------- void File_Aaf::IsUniqueIdentifier() { Skip_L1( "Data"); } //--------------------------------------------------------------------------- void File_Aaf::Size() { Skip_L1( "Data"); } //--------------------------------------------------------------------------- void File_Aaf::Locked() { Skip_L1( "Data"); //Descriptors[Streams[Streams_Pos]->Directory_Pos].StreamKind=Stream_Audio; } //--------------------------------------------------------------------------- void File_Aaf::NetworkLocator() { Ztring Data; Get_UTF16L(xxxSize, Data, "Data"); File__ReferenceFilesHelper::reference ReferenceFile; ReferenceFile.FileNames.push_back(Data); ReferenceFiles->References.push_back(ReferenceFile); //Locators[Streams[Streams_Pos]->Directory_Pos].EssenceLocator=Data; } } //NameSpace #endif //MEDIAINFO_AAF_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Aaf.h100777 0 0 10373 12260017427 15171 0/* 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 AAF files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_AafH #define MediaInfo_File_AafH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { class File__ReferenceFilesHelper; //*************************************************************************** // Class File_Aaf //*************************************************************************** class File_Aaf : public File__Analyze { public : //Constructor/Destructor File_Aaf(); ~File_Aaf(); private : //Streams management void Streams_Finish (); //Buffer - Global #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK void Read_Buffer_Continue (); //Buffer - File header bool FileHeader_Begin(); //Buffer - Per element void Header_Parse(); void Data_Parse(); //Elements void FatSect(); void Fat(); void MiniFat(); void Directory(); void Directory_Entry(); void StreamElement(); void StreamElement_Parse(); void MetaDictionary(); //0x0001 void Header(); //0x0002 void ClassDefinitions(); //0x0003 void TypeDefinitions(); //0x0004 void Identification(); //0x0005 void Name(); //0x0006 void MetaDefinition(); //0x0007 void ParentClass(); //0x0008 void Properties(); //0x0009 void IsConcrete(); //0x000A void Type(); //0x000B void IsOptional(); //0x000C void LocalIdentification(); //0x000D void IsUniqueIdentifier(); //0x000E void Size(); //0x000F void Locked(); //0x3D02 void NetworkLocator(); //0x4001 //Temp int16u xxxSize; int16u SectorShift; int16u MiniSectorShift; int32u sectMiniFatStart; int32u sectDirStart; int32u MiniSectorCutoff; typedef enum step { Step_None, Step_Fat, Step_MiniFat, Step_Directory, Step_Stream, } step; step Step; vector sectsFat; vector sectsMiniStream; vector Pointers; vector MiniPointers; typedef struct stream { Ztring Name; size_t Directory_Pos; int32u ChildSID; int64u Size; int8u* Buffer; vector StreamOffsets; stream() { Directory_Pos=(size_t)-1; ChildSID=(int32u)-1; Buffer=NULL; } } stream; vector Streams; size_t sectsFat_Pos; size_t Streams_Pos; size_t Streams_Pos2; size_t Directory_Pos; File__ReferenceFilesHelper* ReferenceFiles; //Descriptor /* struct descriptor { stream_t StreamKind; int32u ChildSID; descriptor() { StreamKind=Stream_Max; ChildSID=(int32u)-1; } }; typedef std::map descriptors; //Key is Directory_Pos of Descriptor descriptors Descriptors; */ //Locator /* struct locator { Ztring EssenceLocator; }; typedef std::map locators; //Key is Directory_Pos of the locator locators Locators; */ }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Ancillary.cpp100777 0 0 72363 12263604515 16765 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_ANCILLARY_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Ancillary.h" #if defined(MEDIAINFO_CDP_YES) #include "MediaInfo/Text/File_Cdp.h" #endif #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events.h" #endif //MEDIAINFO_EVENTS #if defined(MEDIAINFO_TIMECODE_YES) #include "MediaInfo/Multiple/File_Gxf_TimeCode.h" #endif #if defined(MEDIAINFO_ARIBSTDB24B37_YES) #include "MediaInfo/Text/File_AribStdB24B37.h" #endif #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- //*************************************************************************** // Infos //*************************************************************************** const char* Ancillary_DataID(int8u DataID, int8u SecondaryDataID) { if (DataID==0x00) return "Undefined format"; else if (DataID<=0x03) return "Reserved"; else if (DataID<=0x0F) return "Reserved for 8-bit applications"; else if (DataID<=0x3F) return "Reserved"; else if (DataID==0x41) { //SMPTE 2016-3-2007 switch (SecondaryDataID) { case 0x05 : return "Bar Data"; default : return "Internationally registered"; } } else if (DataID==0x45) { //SMPTE 2020-1-2008 switch (SecondaryDataID) { case 0x01 : return "Audio Metadata - No association"; case 0x02 : return "Audio Metadata - Channels 1/2"; case 0x03 : return "Audio Metadata - Channels 3/4"; case 0x04 : return "Audio Metadata - Channels 5/6"; case 0x05 : return "Audio Metadata - Channels 7/8"; case 0x06 : return "Audio Metadata - Channels 9/10"; case 0x07 : return "Audio Metadata - Channels 11/12"; case 0x08 : return "Audio Metadata - Channels 13/14"; case 0x09 : return "Audio Metadata - Channels 15/16"; default : return "SMPTE 2020-1-2008?"; } } else if (DataID<=0x4F) return "Internationally registered"; else if (DataID<=0x5F) return "Reserved"; else if (DataID==0x5F) { switch (SecondaryDataID&0xF0) { case 0xD0 : return "ARIB B37"; default : return "Reserved"; } } else if (DataID==0x60) return "Ancillary time code"; //RP188 else if (DataID==0x61) { switch (SecondaryDataID) { case 0x01 : return "EIA-708 (CDP)"; case 0x02 : return "EIA-608"; default : return "S334-1-2007 Defined data services?"; } } else if (DataID==0x62) { switch (SecondaryDataID) { case 0x01 : return "Program description"; case 0x02 : return "Data broadcast"; case 0x03 : return "VBI data"; default : return "S334-1-2007 Variable-format data services?"; } } else if (DataID<=0x7F) return "Internationally registered"; else if (DataID==0x80) return "Ancillary packet marked for deletion"; else if (DataID<=0x83) return "Reserved"; else if (DataID==0x84) return "Optional ancillary packet data end marker"; else if (DataID<=0x87) return "Reserved"; else if (DataID==0x88) return "Optional ancillary packet data start marker"; else if (DataID<=0x9F) return "Reserved"; else if (DataID<=0xBF) return "Internationally registered"; else if (DataID<=0xCF) return "User application"; else return "Internationally registered"; } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Ancillary::File_Ancillary() :File__Analyze() { //Configuration ParserName=__T("Ancillary"); PTS_DTS_Needed=true; //In WithTenBit=false; WithChecksum=false; HasBFrames=false; InDecodingOrder=false; LineNumber_IsSecondField=false; AspectRatio=0; FrameRate=0; LineNumber=(int32u)-1; #if defined(MEDIAINFO_CDP_YES) Cdp_Parser=NULL; #endif //defined(MEDIAINFO_CDP_YES) #if defined(MEDIAINFO_ARIBSTDB24B37_YES) AribStdB34B37_Parser=NULL; #endif //defined(MEDIAINFO_ARIBSTDB24B37_YES) } //--------------------------------------------------------------------------- File_Ancillary::~File_Ancillary() { #if defined(MEDIAINFO_CDP_YES) delete Cdp_Parser; //Cdp_Parser=NULL; for (size_t Pos=0; PosStatus[IsFinished] && Cdp_Parser->Status[IsAccepted]) { Finish(Cdp_Parser); for (size_t StreamPos=0; StreamPosCount_Get(Stream_Text); StreamPos++) { Merge(*Cdp_Parser, Stream_Text, StreamPos, StreamPos); Ztring MuxingMode=Cdp_Parser->Retrieve(Stream_Text, StreamPos, "MuxingMode"); Fill(Stream_Text, StreamPos, "MuxingMode", __T("Ancillary data / ")+MuxingMode, true); Ztring LawRating=Cdp_Parser->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); } Ztring LawRating=Cdp_Parser->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); } #endif //defined(MEDIAINFO_CDP_YES) #if defined(MEDIAINFO_ARIBSTDB24B37_YES) if (AribStdB34B37_Parser && !AribStdB34B37_Parser->Status[IsFinished] && AribStdB34B37_Parser->Status[IsAccepted]) { Finish(AribStdB34B37_Parser); for (size_t StreamPos=0; StreamPosCount_Get(Stream_Text); StreamPos++) { Merge(*AribStdB34B37_Parser, Stream_Text, StreamPos, StreamPos); Ztring MuxingMode=AribStdB34B37_Parser->Retrieve(Stream_Text, StreamPos, "MuxingMode"); Fill(Stream_Text, StreamPos, "MuxingMode", __T("Ancillary data / ")+MuxingMode, true); } } #endif //defined(MEDIAINFO_ARIBSTDB24B37_YES) } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Ancillary::Synchronize() { //Synchronizing while (Buffer_Offset+6<=Buffer_Size && ( Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+ 1]!=0xFF || Buffer[Buffer_Offset+ 2]!=0xFF)) Buffer_Offset++; if (!Status[IsAccepted]) { Accept(); Fill(Stream_General, 0, General_Format, "Ancillary"); } //Synched is OK return true; } //--------------------------------------------------------------------------- bool File_Ancillary::Synched_Test() { Synchronize(); //This is not always in synch directly, there may be some garbage //Must have enough buffer for having header if (Buffer_Offset+6>Buffer_Size) return false; //Quick test of synchro if (CC3(Buffer+Buffer_Offset)!=0x00FFFF) Synched=false; //We continue return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Ancillary::Read_Buffer_Continue() { if (!Cdp_Data.empty() && AspectRatio && FrameRate) { ((File_Cdp*)Cdp_Parser)->AspectRatio=AspectRatio; for (size_t Pos=0; PosPTS_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) { #if defined(MEDIAINFO_AFDBARDATA_YES) //Keeping only one, TODO: parse it without video stream for (size_t Pos=1; PosOpen_Buffer_Unsynch(); #endif //defined(MEDIAINFO_CDP_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) for (size_t Pos=0; PosOpen_Buffer_Unsynch(); #endif //defined(MEDIAINFO_ARIBSTDB24B37_YES) AspectRatio=0; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Ancillary::Header_Parse() { //Parsing if (MustSynchronize) { if (WithTenBit) { Skip_L2( "Ancillary data flag"); Skip_L2( "Ancillary data flag"); Skip_L2( "Ancillary data flag"); } else { Skip_L1( "Ancillary data flag"); Skip_L1( "Ancillary data flag"); Skip_L1( "Ancillary data flag"); } } Get_L1 (DataID, "Data ID"); if (WithTenBit) Skip_L1( "Parity+Unused"); //even:1, odd:2 Get_L1 (SecondaryDataID, "Secondary Data ID"); Param_Info1(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 //Test (in some container formats, Cheksum is present sometimes) bool WithChecksum_Temp=WithChecksum; if (!MustSynchronize && !WithChecksum && (size_t)((3+DataCount+1)*(WithTenBit?2:1))==Buffer_Size) WithChecksum_Temp=true; //Filling Header_Fill_Code((((int16u)DataID)<<8)|SecondaryDataID, Ztring().From_CC1(DataID)+__T('-')+Ztring().From_CC1(SecondaryDataID)); Header_Fill_Size(((MustSynchronize?3:0)+3+DataCount+(WithChecksum_Temp?1:0))*(WithTenBit?2:1)); } //--------------------------------------------------------------------------- void File_Ancillary::Data_Parse() { Element_Info1(Ancillary_DataID(DataID, SecondaryDataID)); //Buffer int8u* Payload=new int8u[DataCount]; Element_Begin1("Raw data"); for(int8u Pos=0; PosData=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 0x5F : // (from ARIB STD-B37) if ((SecondaryDataID&0xF0)==0xD0) //Digital Closed Caption { #if defined(MEDIAINFO_ARIBSTDB24B37_YES) if (AribStdB34B37_Parser==NULL) { AribStdB34B37_Parser=new File_AribStdB24B37; ((File_AribStdB24B37*)AribStdB34B37_Parser)->IsAncillaryData=true; ((File_AribStdB24B37*)AribStdB34B37_Parser)->ParseCcis=true; Open_Buffer_Init(AribStdB34B37_Parser); } if (!AribStdB34B37_Parser->Status[IsFinished]) { if (AribStdB34B37_Parser->PTS_DTS_Needed) AribStdB34B37_Parser->FrameInfo=FrameInfo; Open_Buffer_Continue(AribStdB34B37_Parser, Payload, (size_t)DataCount); } #endif //defined(MEDIAINFO_ARIBSTDB24B37_YES) } break; case 0x60 : switch (SecondaryDataID) { case 0x60 : // (from SMPTE RP 188 / SMPTE ST 12-2) // Time code ATC #if defined(MEDIAINFO_TIMECODE_YES) { File_Gxf_TimeCode Parser; Parser.IsAtc=true; Open_Buffer_Init(&Parser); Open_Buffer_Continue(&Parser, Payload, (size_t)DataCount); bool Exists=false; if (LineNumber!=(int32u)-1) for (size_t Pos=0; PosStatus[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 334-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 334-1) switch (SecondaryDataID) { case 0x01 : //Program description (from SMPTE 334-1), break; case 0x02 : //Data broadcast (from SMPTE 334-1) break; case 0x03 : //VBI data (from SMPTE 334-1) break; default : ; ; } break; case 0x64 : switch (SecondaryDataID) { case 0x64 : // (from SMPTE RP 196) // LTC in HANC space { bool Exists=false; if (LineNumber!=(int32u)-1) for (size_t Pos=0; Pos //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Ancillary //*************************************************************************** class File_Ancillary : public File__Analyze { public : //In bool WithTenBit; bool WithChecksum; bool HasBFrames; bool InDecodingOrder; bool LineNumber_IsSecondField; float64 AspectRatio; float64 FrameRate; int32u LineNumber; //In/Out struct buffered_data { size_t Size; int8u* Data; buffered_data() { Size=0; Data=NULL; } ~buffered_data() { delete[] Data; //Data=NULL; } }; #if defined(MEDIAINFO_CDP_YES) std::vector Cdp_Data; File__Analyze* Cdp_Parser; #endif //defined(MEDIAINFO_CDP_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) std::vector AfdBarData_Data; #endif //defined(MEDIAINFO_AFDBARDATA_YES) #if defined(MEDIAINFO_ARIBSTDB24B37_YES) File__Analyze* AribStdB34B37_Parser; #endif //defined(MEDIAINFO_ARIBSTDB24B37_YES) //Constructor/Destructor File_Ancillary(); ~File_Ancillary(); private : //Streams management void Streams_Finish(); //Buffer - Synchro bool Synchronize(); bool Synched_Test(); //Buffer - Global void Read_Buffer_Continue(); void Read_Buffer_AfterParsing(); void Read_Buffer_Unsynched(); //Buffer - Per element void Header_Parse(); void Data_Parse(); //Temp int8u DataID; int8u SecondaryDataID; int8u DataCount; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Bdmv.cpp100777 0 0 176253 12226004262 15752 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_BDMV_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Bdmv.h" #include "MediaInfo/MediaInfo.h" #include "MediaInfo/MediaInfo_Internal.h" #include "ZenLib/Dir.h" #include "ZenLib/FileName.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // index (INDX) with title // --> MovieObject (MOBJ) with mobj // --> PlayList (MPLS) // --> PlayItem (MPLS) with Mark // --> ClipInfo (CLPI) // --> Clip (?) (CLPI) // --> Stream (M2TS) //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //*************************************************************************** // Constants //*************************************************************************** //--------------------------------------------------------------------------- namespace Elements { const int32u CLPI=0x48444D56; //HDMV const int32u INDX=0x494E4458; const int32u MOBJ=0x4D4F424A; const int32u MPLS=0x4D504C53; } //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* Clpi_Offsets[]= { "ClipInfo", "SequenceInfo", "ProgramInfo", "CPI", "ClipMark", "ExtensionData", "Reserved", "Reserved", "Reserved", }; //--------------------------------------------------------------------------- const char* Indx_Offsets[]= { "AppInfoBDMV", "Indexes", "ExtensionData", "Reserved", "Reserved", "Reserved", "Reserved", "Reserved", "Reserved", }; //--------------------------------------------------------------------------- const char* Mobj_Offsets[]= { "MovieObjects", "Reserved", "Reserved", "Reserved", "Reserved", "Reserved", "Reserved", "Reserved", "Reserved", }; //--------------------------------------------------------------------------- const char* Mpls_Offsets[]= { "AppInfoPlayList", "PlayList", "PlayListMarks", "ExtensionData", "Reserved", "Reserved", "Reserved", "Reserved", "Reserved", }; //--------------------------------------------------------------------------- const char* Bdmv_Type(int32u Type_Indicator, size_t Start_Adress_Pos) { switch (Type_Indicator) { case Elements::CLPI : return Clpi_Offsets[Start_Adress_Pos]; case Elements::INDX : return Indx_Offsets[Start_Adress_Pos]; case Elements::MOBJ : return Mobj_Offsets[Start_Adress_Pos]; case Elements::MPLS : return Mpls_Offsets[Start_Adress_Pos]; default : return ""; } } //--------------------------------------------------------------------------- const char* Clpi_Format(int8u StreamType) { switch (StreamType) { case 0x01 : return "MPEG-1 Video"; case 0x02 : return "MPEG-2 Video"; case 0x03 : return "MPEG-1 Audio"; case 0x04 : return "MPEG-2 Audio"; case 0x1B : return "AVC"; case 0x20 : return "AVC"; case 0x80 : return "PCM"; case 0x81 : return "AC-3"; case 0x82 : return "DTS"; case 0x83 : return "TrueHD"; case 0x84 : return "E-AC-3"; case 0x85 : return "DTS"; case 0x86 : return "DTS"; case 0x90 : return "PGS"; case 0x91 : return "Interactive"; case 0x92 : return "Subtitle"; case 0xA1 : return "E-AC-3"; //Secondary case 0xA2 : return "DTS"; //Secondary case 0xEA : return "VC-1"; default : return ""; } } //--------------------------------------------------------------------------- const char* Clpi_Format_Profile(int8u StreamType) { switch (StreamType) { case 0x85 : return "HD"; case 0x86 : return "MA"; case 0xA2 : return "HD"; //Secondary default : return ""; } } //--------------------------------------------------------------------------- stream_t Clpi_Type(int8u StreamType) { switch (StreamType) { case 0x01 : return Stream_Video; case 0x02 : return Stream_Video; case 0x03 : return Stream_Audio; case 0x04 : return Stream_Audio; case 0x1B : return Stream_Video; case 0x20 : return Stream_Video; case 0x80 : return Stream_Audio; case 0x81 : return Stream_Audio; case 0x82 : return Stream_Audio; case 0x83 : return Stream_Audio; case 0x84 : return Stream_Audio; case 0x85 : return Stream_Audio; case 0x86 : return Stream_Audio; case 0x90 : return Stream_Text; case 0x91 : return Stream_Max; case 0x92 : return Stream_Text; case 0xA1 : return Stream_Audio; case 0xA2 : return Stream_Audio; case 0xEA : return Stream_Video; default : return Stream_Max; } } //--------------------------------------------------------------------------- const char* Clpi_Video_Format[]= { "", "480i", "576i", "480p", "1080i", "720p", "1080p", "576p", "", "", "", "", "", "", "", "", }; //--------------------------------------------------------------------------- const char* Clpi_Video_Interlacement[]= { "", "Interlaced", "Interlaced", "PPF", "Interlaced", "PPF", "PPF", "PPF", "", "", "", "", "", "", "", "", }; //--------------------------------------------------------------------------- const char* Clpi_Video_Standard[]= { "", "NTSC", "PAL", "NTSC", "", "", "", "PAL", "", "", "", "", "", "", "", "", }; //--------------------------------------------------------------------------- int16u Clpi_Video_Width[]= { 0, 720, 720, 720, 1920, 1280, 1920, 720, 0, 0, 0, 0, 0, 0, 0, 0, }; //--------------------------------------------------------------------------- int16u Clpi_Video_Height[]= { 0, 480, 576, 480, 1080, 720, 1080, 576, 0, 0, 0, 0, 0, 0, 0, 0, }; //--------------------------------------------------------------------------- float32 Clpi_Video_FrameRate[]= { (float32) 0.000, (float32)23.976, (float32)24.000, (float32)25.000, (float32)29.970, (float32) 0.000, (float32)50.000, (float32)59.940, (float32) 0.000, (float32) 0.000, (float32) 0.000, (float32) 0.000, (float32) 0.000, (float32) 0.000, (float32) 0.000, (float32) 0.000, }; //--------------------------------------------------------------------------- float32 Clpi_Video_AspectRatio[]= { (float32)0.000, (float32)0.000, (float32)1.333, (float32)1.778, (float32)2.210, (float32)0.000, (float32)0.000, (float32)0.000, (float32)0.000, (float32)0.000, (float32)0.000, (float32)0.000, (float32)0.000, (float32)0.000, (float32)0.000, (float32)0.000, }; //--------------------------------------------------------------------------- int8u Clpi_Audio_Channels[]= { 0, 1, 0, 2, 0, 0, 0, //Multi 6-8 0, 0, 0, 0, 0, 0, //Combo 0, 0, 0, }; //--------------------------------------------------------------------------- int32u Clpi_Audio_SamplingRate[]= { 0, 48000, 0, 0, 96000, 192000, 0, 0, 0, 0, 0, 0, 48000, //192000? 48000, // 96000? 0, 0, }; //--------------------------------------------------------------------------- const char* Indx_object_type[]= { "", "HDMV", "BD-J", "", }; //--------------------------------------------------------------------------- const char* Indx_playback_type[4][4]= { {"", "", "", "", }, {"Movie", "Interactive", "", "", }, {"", "", "Movie", "Interactive", }, {"", "", "", "", }, }; //--------------------------------------------------------------------------- const char* Indx_title_search[]= { "Permitted", "Prohibited1", "Prohibited2", "", }; //--------------------------------------------------------------------------- const char* Mpls_playback_type[]= { "Sequential", "Random", "Shuffle", "", }; //--------------------------------------------------------------------------- const char* Mpls_PlayListMarks_Mark_type(int8u type) { switch (type) { case 1 : return "entry-mark"; case 2 : return "link point"; default: return ""; } } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- Ztring Bdmv_Decimal_Hexa(int64u Number) { Ztring Temp; Temp.From_Number(Number); Temp+=__T(" (0x"); Temp+=Ztring::ToZtring(Number, 16); Temp+=__T(")"); return Temp; } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Bdmv::FileHeader_Begin() { size_t BDMV_Pos=File_Name.find(Ztring(1, PathSeparator)+__T("BDMV")); if (BDMV_Pos!=string::npos && BDMV_Pos+5==File_Name.size()) //Blu-ray directory return true; //Element_Size if (Buffer_Size<4) return false; //Must wait for more data switch (CC4(Buffer)) { case Elements::CLPI : case Elements::INDX : case Elements::MOBJ : case Elements::MPLS : break; default : Reject("Blu-ray"); return false; } //Init Mpls_PlayList_IsParsed=false; //All should be OK... return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Bdmv::Read_Buffer_Continue() { size_t BDMV_Pos=File_Name.find(Ztring(1, PathSeparator)+__T("BDMV")); if (BDMV_Pos!=string::npos && BDMV_Pos+5==File_Name.size()) //Blu-ray directory { BDMV(); return; } if (Buffer_Size::iterator Type=Types.begin(); Type!=Types.end(); ++Type) { if (Type->first>=Element_Offset) //If valid { if (Type->first>Element_Offset) Skip_XX(Type->first-Element_Offset, "unknown"); Element_Begin1(Bdmv_Type(type_indicator, Type->second)); int32u length; Get_B4 (length, "length"); int64u End=Element_Offset+length; switch (type_indicator) { case Elements::CLPI : switch(Type->second) { case 2 : Clpi_ProgramInfo(); break; case 5 : Clpi_ExtensionData(); break; default: ; } break; case Elements::INDX : switch(Type->second) { case 0 : Indx_AppInfoBDMV(); break; case 1 : Indx_Indexes(); break; case 2 : Indx_ExtensionData(); break; default: ; } break; case Elements::MOBJ : switch(Type->second) { case 0 : Mobj_MovieObjects(); break; case 1 : Mobj_ExtensionData(); break; default: ; } break; case Elements::MPLS : switch(Type->second) { case 0 : Mpls_AppInfoPlayList(); break; case 1 : Mpls_PlayList(); break; case 2 : Mpls_PlayListMarks (); break; case 3 : Mpls_ExtensionData (); break; default: ; } break; default : ; } if (End>Element_Offset) Skip_XX(End-Element_Offset, "Unknown"); Element_End0(); } } if (Element_Size>Element_Offset) Skip_XX(Element_Size-Element_Offset, "Unknown"); } else Skip_XX(Element_Size-Element_Offset, "Unknown"); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Bdmv::BDMV() { Accept("BDMV"); //Searching the longest playlist ZtringList List=Dir::GetAllFileNames(File_Name+PathSeparator+__T("PLAYLIST")+PathSeparator+__T("*.mpls"), Dir::Include_Files); std::vector MIs; MIs.resize(List.size()); size_t MaxDuration_Pos=(size_t)-1; int64u MaxDuration=0; if (Config->File_Bdmv_ParseTargetedFile_Get()) { for (size_t Pos=0; PosOption(__T("File_Bdmv_ParseTargetedFile"), __T("0")); MIs[Pos]->Open(List[Pos]); int64u Duration=Ztring(MIs[Pos]->Get(Stream_General, 0, General_Duration)).To_int64u(); if (Duration>MaxDuration) { MaxDuration=Duration; MaxDuration_Pos=Pos; } } } if (MaxDuration_Pos!=(size_t)-1) { //Merging MediaInfo_Internal MI; MI.Open(List[MaxDuration_Pos]); //Open it again for having the M2TS part Merge(MI); Clear(Stream_General, 0, General_Format); Clear(Stream_General, 0, General_Format_String); Clear(Stream_General, 0, General_Format_Extensions); Clear(Stream_General, 0, General_Format_Info); Clear(Stream_General, 0, General_Codec); Clear(Stream_General, 0, General_Codec_String); Clear(Stream_General, 0, General_Codec_Extensions); Clear(Stream_General, 0, General_FileSize); Clear(Stream_Video, 0, Video_ScanType_String); Clear(Stream_Video, 0, Video_Bits__Pixel_Frame_); } for (size_t Pos=0; Pos PIDs_StreamKind; std::map PIDs_StreamPos; if (Config->File_Bdmv_ParseTargetedFile_Get() && File_Name.size()>10+1+7) { Ztring file=File_Name.substr(File_Name.size()-10, 5); Ztring M2TS_File=File_Name; M2TS_File.resize(M2TS_File.size()-(10+1+7)); M2TS_File+=__T("STREAM"); M2TS_File+=PathSeparator; M2TS_File+=file; M2TS_File+=__T(".m2ts"); MediaInfo_Internal MI; MI.Option(__T("File_Bdmv_ParseTargetedFile"), __T("0")); if (MI.Open(M2TS_File)) { Merge(MI); for (size_t StreamKind=Stream_General+1; StreamKind::iterator PID_StreamKind=PIDs_StreamKind.find(stream_PID); if (PID_StreamKind!=PIDs_StreamKind.end()) { StreamKind_Last=PID_StreamKind->second; StreamPos_Last=PIDs_StreamPos.find(stream_PID)->second; } Get_B1 (stream_type, "Stream type"); Param_Info1(Clpi_Format(stream_type)); Element_Info1(Clpi_Format(stream_type)); switch (Clpi_Type(stream_type)) { case Stream_Video : StreamCodingInfo_Video(); break; case Stream_Audio : StreamCodingInfo_Audio(); break; case Stream_Text : StreamCodingInfo_Text() ; break; default : ; } if (Stream_End-Element_Offset) Skip_XX(Stream_End-Element_Offset, "Unknown"); Element_End0(); FILLING_BEGIN(); if (StreamKind_Last!=Stream_Max) { Fill(StreamKind_Last, StreamPos_Last, General_ID, stream_PID, 10, true); Fill(StreamKind_Last, StreamPos_Last, General_ID_String, Bdmv_Decimal_Hexa(stream_PID), true); } FILLING_END(); } } } struct entry { int16u ID1; int16u ID2; int32u Length; }; typedef std::map entries; //Key is the start address //--------------------------------------------------------------------------- void File_Bdmv::Clpi_ExtensionData() { entries Entries; //Key is the start address int32u Base_Pos=(int32u)Element_Offset-4; int8u number_of_ext_data_entries; Skip_B4( "Unknown"); Skip_B3( "Unknown"); Element_Begin1("Offsets"); Get_B1 (number_of_ext_data_entries, "number_of_ext_data_entries"); for (size_t Start_Adress_Pos=0; Start_Adress_Posfirst>=Element_Offset) //If valid { if (Entry->first>Element_Offset) Skip_XX(Entry->first-Element_Offset, "unknown"); Element_Begin1("Entry"); int32u length; Get_B4 (length, "length"); int64u End=Element_Offset+length; switch (Entry->second.ID1) { case 0x0002 : switch(Entry->second.ID2) { case 0x0005 : Clpi_ProgramInfo(); break; default: ; } break; default : ; } if (End>Element_Offset) Skip_XX(End-Element_Offset, "Unknown"); Element_End0(); } } if (Element_Size>Element_Offset) Skip_XX(Element_Size-Element_Offset, "Unknown"); } //--------------------------------------------------------------------------- void File_Bdmv::Indx_AppInfoBDMV() { //Parsing Skip_B2( "reserved"); Skip_Local(32, "user_data"); } //--------------------------------------------------------------------------- void File_Bdmv::Indx_Indexes() { //Parsing int16u number_of_Titles; Element_Begin1("FirstPlayback"); BS_Begin(); int8u FirstPlayback_object_type; Get_S1 ( 2, FirstPlayback_object_type, "object_type"); Param_Info1(Indx_object_type[FirstPlayback_object_type]); Skip_S4(30, "reserved"); BS_End(); Indx_Indexes_Index(FirstPlayback_object_type); Element_End0(); Element_Begin1("TopMenu"); BS_Begin(); int8u TopMenu_object_type; Get_S1 ( 2, TopMenu_object_type, "object_type"); Param_Info1(Indx_object_type[TopMenu_object_type]); Skip_S4(30, "reserved"); BS_End(); Indx_Indexes_Index(TopMenu_object_type); Element_End0(); Get_B2 (number_of_Titles, "number_of_Titles"); for (int16u Pos=0; Pos exts; //Key is the start address, value is length int64u Base_Offset=Element_Offset-4; //Size is included int8u number_of_ext_data_entries; Skip_B4( "data_block_start_adress"); Skip_B3( "reserved"); Get_B1 (number_of_ext_data_entries, "number_of_ext_data_entries"); for (int16u Pos=0; Pos::iterator ext=exts.begin(); ext!=exts.end(); ++ext) { if (Base_Offset+ext->first>=Element_Offset) { if (Base_Offset+ext->first>Element_Offset) Skip_XX(ext->first-Element_Offset, "Unknown"); Element_Begin0(); int64u End=Element_Offset+ext->second; int32u type_indicator; Get_C4(type_indicator, "type_indicator"); Element_Info1(Ztring().From_CC4(type_indicator)); switch (type_indicator) { case 0x49444558 : Indx_ExtensionData_IDEX(); break; default : Element_Name("Unknown"); Skip_XX(ext->second-4, "Unknown"); } if (End>Element_Offset) Skip_XX(End-Element_Offset, "Unknown"); Element_End0(); } } } //--------------------------------------------------------------------------- void File_Bdmv::Indx_ExtensionData_IDEX() { Element_Name("IndexExtension"); //Parsing int64u Base_Offset=Element_Offset-4; //Size is included int32u TableOfPlayLists_start_adress, MakersPrivateData_start_adress; Skip_B4( "reserved"); Get_B4 (TableOfPlayLists_start_adress, "TableOfPlayLists_start_adress"); Get_B4 (MakersPrivateData_start_adress, "MakersPrivateData_start_adress"); Skip_XX(24, "reserved"); Indx_ExtensionData_IDEX_UIAppInfoAVCHD(); if (TableOfPlayLists_start_adress) { if (Base_Offset+TableOfPlayLists_start_adress>Element_Offset) Skip_XX(Base_Offset+TableOfPlayLists_start_adress-Element_Offset, "Unknown"); Indx_ExtensionData_IDEX_TableOfPlayLists(); } if (MakersPrivateData_start_adress) { if (Base_Offset+MakersPrivateData_start_adress>Element_Offset) Skip_XX(Base_Offset+MakersPrivateData_start_adress-Element_Offset, "Unknown"); Indx_ExtensionData_IDEX_MakersPrivateData(); } } //--------------------------------------------------------------------------- void File_Bdmv::Indx_ExtensionData_IDEX_UIAppInfoAVCHD() { Element_Begin1("UIAppInfoAVCHD"); //Parsing int32u length, length2; int8u AVCHD_name_length; Get_B4 (length, "length"); Skip_B2( "maker_ID"); Skip_B2( "maker_model_code"); Skip_XX(32, "maker_private_area"); BS_Begin(); Skip_BS(15, "reserved"); Skip_SB( "AVCHD_write_protect_flag"); BS_End(); Skip_B2( "ref_to_menu_thumbail_index"); Skip_B1( "time_zone"); Skip_XX(7, "record_time_and_date"); Skip_B1( "reserved"); Skip_B1( "AVCHD_character_set"); Get_B1 (AVCHD_name_length, "AVCHD_name_length"); Skip_Local(AVCHD_name_length, "AVCHD_name"); Skip_XX(255-AVCHD_name_length, "AVCHD_name (junk)"); Element_Begin1("additional data"); Get_B4 (length2, "length2"); Skip_XX(length2, "reserved"); Element_End0(); Element_End0(); } //--------------------------------------------------------------------------- void File_Bdmv::Indx_ExtensionData_IDEX_TableOfPlayLists() { Element_Begin1("TableOfPlayLists"); //Parsing int32u length; Get_B4 (length, "length"); Skip_XX(length, "unknown"); Element_End0(); } //--------------------------------------------------------------------------- void File_Bdmv::Indx_ExtensionData_IDEX_MakersPrivateData() { Element_Begin1("MakersPrivateData"); //Parsing int64u Base_Offset=Element_Offset-4; //Size is included int32u length, datablock_start_adress; int8u number_of_maker_entries; Get_B4 (length, "length"); Get_B4 (datablock_start_adress, "datablock_start_adress"); Skip_XX(24, "reserved"); Get_B1 (number_of_maker_entries, "number_of_maker_entries"); for (int8u Pos=0; PosElement_Offset) Skip_XX(Base_Offset+datablock_start_adress-Element_Offset, "Unknown"); Skip_XX(length-datablock_start_adress, "Unknown"); } Element_End0(); } //--------------------------------------------------------------------------- void File_Bdmv::Mobj_MovieObjects() { //Parsing int16u number_of_mobjs; Skip_B4( "reserved"); Get_B2 (number_of_mobjs, "number_of_mobj"); for (int16u mobjs_Pos=0; mobjs_PosElement_Offset) Skip_XX(SubPath_End-Element_Offset, "unknown"); Element_End0(); } FILLING_BEGIN(); if (!Mpls_PlayList_IsParsed) { Mpls_PlayList_number_of_SubPaths=number_of_SubPaths; Mpls_PlayList_IsParsed=true; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Bdmv::Mpls_PlayList_PlayItem() { Element_Begin1("PlayItem"); Ztring Clip_Information_file_name; int32u Time_In, Time_Out; int16u length; Get_B2 (length, "length"); int64u End=Element_Offset+length; Get_Local (5, Clip_Information_file_name, "Clip_Information_file_name"); Element_Info1(Clip_Information_file_name); Skip_Local(4, "Clip_codec_identifier"); Skip_B2( "unknown"); Skip_B1( "Unknown"); Get_B4 (Time_In, "Time (In)"); Param_Info1((float32)Time_In/45000); Get_B4 (Time_Out, "Time (Out)"); Param_Info1((float32)Time_Out/45000); Skip_B4( "UO1"); Skip_B4( "UO2"); Skip_B4( "An?"); Mpls_PlayList_PlayItem_Duration=Time_Out-Time_In; if (Time_Out>Time_In) Mpls_PlayList_Duration+=Mpls_PlayList_PlayItem_Duration; std::vector StreamCount_Before; for (size_t StreamKind=Stream_General; StreamKind10+1+8) { Ztring CLPI_File=File_Name; CLPI_File.resize(CLPI_File.size()-(10+1+8)); CLPI_File+=__T("CLIPINF"); CLPI_File+=PathSeparator; CLPI_File+=Clip_Information_file_name; CLPI_File+=__T(".clpi"); MediaInfo_Internal MI; MI.Option(__T("File_Bdmv_ParseTargetedFile"), Config->File_Bdmv_ParseTargetedFile_Get()?__T("1"):__T("0")); if (MI.Open(CLPI_File)) { for (size_t StreamKind=Stream_General+1; StreamKind=Count_Get((stream_t)StreamKind)) Stream_Prepare((stream_t)StreamKind); Merge(MI, (stream_t)StreamKind, StreamPos, StreamCount_Before[StreamKind]+StreamPos); } } Clip_Information_file_names.insert(Clip_Information_file_name); } if (End>Element_Offset) Skip_XX(End-Element_Offset, "unknown"); Element_End0(); } //--------------------------------------------------------------------------- void File_Bdmv::Mpls_PlayList_PlayItem_STN_table() { Element_Begin1("STN"); int16u length; Get_B2 (length, "length"); int64u End=Element_Offset+length; if (End>Element_Size) { Skip_XX(Element_Size-Element_Offset, "Problem"); return; } Skip_B2( "unknown"); Skip_B1( "Vi"); Skip_B1( "Au"); Skip_B1( "PG"); Skip_B1( "IG"); Skip_B1( "sV"); Skip_B1( "sA"); Skip_B1( "PIP"); Skip_B1( "unknown"); Skip_B1( "unknown"); Skip_B1( "unknown"); Skip_B1( "unknown"); Skip_B1( "unknown"); while (Element_Offset+16<=End) { Element_Begin0(); Ztring language; int16u mPID; int8u IDs_length; Skip_B1( "type"); Skip_B1( "unknown"); Get_B2 (mPID, "mPID"); Element_Name(Ztring::ToZtring(mPID, 16)); Skip_B2( "SPid"); Skip_B2( "sCid"); Skip_B2( "sPID"); Get_B1 (IDs_length, "length"); int64u IDs_End=Element_Offset+IDs_length; Get_B1 (stream_type, "stream_type"); Param_Info1(Clpi_Format(stream_type)); Element_Info1(Clpi_Format(stream_type)); switch (Clpi_Type(stream_type)) { case Stream_Video : Mpls_PlayList_PlayItem_STN_table_Video(); break; case Stream_Audio : Mpls_PlayList_PlayItem_STN_table_Audio(); break; case Stream_Text : Mpls_PlayList_PlayItem_STN_table_Text() ; break; default : StreamKind_Last=Stream_Max; } Get_Local(3, language, "language"); Element_Info1(language); if (IDs_End-Element_Offset) Skip_XX(IDs_End-Element_Offset, "unknown"); Element_End0(); FILLING_BEGIN(); if (StreamKind_Last!=Stream_Max) { if (mPID) { Fill(StreamKind_Last, StreamPos_Last, General_ID, mPID, 10, true); Fill(StreamKind_Last, StreamPos_Last, General_ID_String, Bdmv_Decimal_Hexa(mPID), true); } Fill(StreamKind_Last, StreamPos_Last, "Language", language); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Duration), Mpls_PlayList_PlayItem_Duration/45); } FILLING_END(); } if (End>Element_Offset) Skip_XX(End-Element_Offset, "unknown"); Element_End0(); } //--------------------------------------------------------------------------- void File_Bdmv::Mpls_PlayList_PlayItem_STN_table_Video() { //Parsing int8u Format, FrameRate; BS_Begin(); Get_S1 (4, Format, "format"); Param_Info1(Clpi_Video_Format[Format]); Get_S1 (4, FrameRate, "frame_rate"); Param_Info1(Clpi_Video_FrameRate[FrameRate]); BS_End(); FILLING_BEGIN(); Stream_Prepare(Stream_Video); Fill(Stream_Video, StreamPos_Last, Video_Format, Clpi_Format(stream_type)); if (Clpi_Video_Width[Format]) Fill(Stream_Video, StreamPos_Last, Video_Width, Clpi_Video_Width[Format]); if (Clpi_Video_Height[Format]) Fill(Stream_Video, StreamPos_Last, Video_Height, Clpi_Video_Height[Format]); Fill(Stream_Video, StreamPos_Last, Video_Interlacement, Clpi_Video_Interlacement[Format]); Fill(Stream_Video, StreamPos_Last, Video_Standard, Clpi_Video_Standard[Format]); if (Clpi_Video_FrameRate[FrameRate]) Fill(Stream_Video, StreamPos_Last, Video_FrameRate, Clpi_Video_FrameRate[FrameRate]); FILLING_END(); } //--------------------------------------------------------------------------- void File_Bdmv::Mpls_PlayList_PlayItem_STN_table_Audio() { //Parsing int8u Channels, SamplingRate; BS_Begin(); Get_S1 (4, Channels, "channel_layout"); Param_Info1(Clpi_Audio_Channels[Channels]); Get_S1 (4, SamplingRate, "sampling_rate"); Param_Info1(Clpi_Audio_SamplingRate[SamplingRate]); BS_End(); FILLING_BEGIN(); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, StreamPos_Last, Audio_Format, Clpi_Format(stream_type)); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Profile, Clpi_Format_Profile(stream_type)); if (Clpi_Audio_Channels[Channels]) Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Clpi_Audio_Channels[Channels]); if (Clpi_Audio_SamplingRate[SamplingRate]) Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, Clpi_Audio_SamplingRate[SamplingRate]); FILLING_END(); } //--------------------------------------------------------------------------- void File_Bdmv::Mpls_PlayList_PlayItem_STN_table_Text() { //Parsing if (stream_type==0x92) //Subtitle Skip_B1( "Unknown"); FILLING_BEGIN(); Stream_Prepare(Stream_Text); Fill(Stream_Text, StreamPos_Last, Text_Format, Clpi_Format(stream_type)); FILLING_END(); } //--------------------------------------------------------------------------- void File_Bdmv::Mpls_PlayList_SubPlayItem(int8u SubPath_type, int16u Pos) { Element_Begin1("SubPlayItem"); Ztring Clip_Information_file_name; int16u length; Get_B2 (length, "length"); int64u End=Element_Offset+length; Get_Local (5, Clip_Information_file_name, "Clip_Information_file_name"); Element_Info1(Clip_Information_file_name); Skip_Local(4, "Clip_codec_identifier"); Skip_B4( "unknown"); Skip_B1( "unknown"); Info_B4(Time_In, "time (in)"); Param_Info1((float32)Time_In/45000); Info_B4(Time_Out, "time (out)"); Param_Info1((float32)Time_Out/45000); Skip_B2( "sync PI"); Skip_B4( "sync PTS"); if (End>Element_Offset) Skip_XX(End-Element_Offset, "unknown"); Element_End0(); FILLING_BEGIN(); if (SubPath_type==8 && Pos!=(int16u)-1) //MVC { if (File_Name.size()>=10+1+8) { Ztring CLPI_File=File_Name; CLPI_File.resize(CLPI_File.size()-(10+1+8)); CLPI_File+=__T("CLIPINF"); CLPI_File+=PathSeparator; CLPI_File+=Clip_Information_file_name; CLPI_File+=__T(".clpi"); MediaInfo_Internal MI; MI.Option(__T("File_Bdmv_ParseTargetedFile"), Config->File_Bdmv_ParseTargetedFile_Get()?__T("1"):__T("0")); if (MI.Open(CLPI_File)) { if (MI.Count_Get(Stream_Video)) { Ztring ID=Retrieve(Stream_Video, Pos, Video_ID); Ztring ID_String=Retrieve(Stream_Video, Pos, Video_ID_String); Ztring Format_Profile=Retrieve(Stream_Video, Pos, Video_Format_Profile); Ztring BitRate=Retrieve(Stream_Video, Pos, Video_BitRate); Ztring Source=Retrieve(Stream_Video, Pos, "Source"); Fill(Stream_Video, Pos, Video_ID, MI.Get(Stream_Video, 0, Video_ID)+__T(" / ")+ID, true); Fill(Stream_Video, Pos, Video_ID_String, MI.Get(Stream_Video, 0, Video_ID_String)+__T(" / ")+ID_String, true); if (!Format_Profile.empty()) Fill(Stream_Video, Pos, Video_Format_Profile, MI.Get(Stream_Video, 0, Video_Format_Profile)+__T(" / ")+Format_Profile, true); if (!BitRate.empty()) Fill(Stream_Video, Pos, Video_BitRate, Ztring::ToZtring(BitRate.To_int32u()+MI.Get(Stream_Video, 0, Video_BitRate).To_int32u())+__T(" / ")+BitRate, true); if (!Source.empty()) Fill(Stream_Video, Pos, "Source", Clip_Information_file_name +__T(".m2ts / ")+Source, true); } } } } FILLING_END(); } //--------------------------------------------------------------------------- void File_Bdmv::Mpls_PlayListMarks() { Stream_Prepare(Stream_Menu); Fill(Stream_Menu, StreamPos_Last, Menu_Chapters_Pos_Begin, Count_Get(Stream_Menu, StreamPos_Last), 10, true); //Parsing int32u time_Pos0=0, time_Pos=1; int16u count; Get_B2 (count, "count"); for (int16u Pos=0; Posfirst>=Element_Offset) //If valid { if (Entry->first>Element_Offset) Skip_XX(Entry->first-Element_Offset, "unknown"); Element_Begin1("Entry"); int64u End=Element_Offset+Entry->second.Length; switch (Entry->second.ID1) { case 0x0001 : switch(Entry->second.ID2) { case 0x0001 : break; //Mpls_ExtensionData_pip_metadata(); break; default: ; } break; case 0x0002 : switch(Entry->second.ID2) { case 0x0001 : break; //Mpls_ExtensionData_STN_table(); break; case 0x0002 : Mpls_ExtensionData_SubPath_entries(); break; case 0x0003 : break; //Mpls_ExtensionData_active_video_window(); break; default: ; } break; default : ; } if (End>Element_Offset) Skip_XX(End-Element_Offset, "Unknown"); Element_End0(); } } if (Element_Size>Element_Offset) Skip_XX(Element_Size-Element_Offset, "Unknown"); } //--------------------------------------------------------------------------- void File_Bdmv::Mpls_ExtensionData_SubPath_entries() { Element_Begin1("SubPath_entries"); int32u length; int16u number_of_SubPath_extensions; int8u SubPath_type; Get_B4 (length, "length"); int64u End=Element_Offset+length; Get_B2 (number_of_SubPath_extensions, "number_of_SubPath_extensions"); for (int8u SubPath_extension=0; SubPath_extension //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Bdmv //*************************************************************************** class File_Bdmv : public File__Analyze { public : void BDMV(); //The BDMV directory private : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Continue (); //Elements void Clpi_ProgramInfo(); void Clpi_ExtensionData(); void Indx_AppInfoBDMV(); void Indx_Indexes(); void Indx_Indexes_Index(int8u object_type); void Indx_ExtensionData(); void Indx_ExtensionData_IDEX(); void Indx_ExtensionData_IDEX_UIAppInfoAVCHD(); void Indx_ExtensionData_IDEX_TableOfPlayLists(); void Indx_ExtensionData_IDEX_MakersPrivateData(); void Mobj_MovieObjects(); void Mobj_ExtensionData(); void Mpls_AppInfoPlayList(); void Mpls_PlayList(); void Mpls_PlayList_PlayItem(); void Mpls_PlayList_PlayItem_STN_table(); void Mpls_PlayList_PlayItem_STN_table_Video(); void Mpls_PlayList_PlayItem_STN_table_Audio(); void Mpls_PlayList_PlayItem_STN_table_Text(); void Mpls_PlayList_SubPlayItem(int8u SubPath_type, int16u Pos); void Mpls_PlayListMarks(); void Mpls_ExtensionData(); void Mpls_ExtensionData_SubPath_entries(); void StreamCodingInfo_Video(); void StreamCodingInfo_Audio(); void StreamCodingInfo_Text(); //Temp int8u stream_type; std::map Types; //Key is the start address int64u Mpls_PlayList_Duration; int64u Mpls_PlayList_PlayItem_Duration; int16u Mpls_PlayList_number_of_SubPaths; bool Mpls_PlayList_IsParsed; std::set Clip_Information_file_names; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Cdxa.cpp100777 0 0 25164 12226004262 15713 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_CDXA_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Cdxa.h" #include "ZenLib/Utils.h" #include "MediaInfo/MediaInfo_Internal.h" #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events.h" #endif //MEDIAINFO_EVENTS using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Format //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // CDXA = RIFF header + Raw sectors // Riff header size = 44 // Raw sector size = 2352 // // Raw sector : // Sync 12 bytes (00 FF .. FF 00) // Header 4 bytes // SubHeader 8 bytes // Datas 2324 bytes // EDC (CRC) 4 bytes //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Cdxa::File_Cdxa() :File__Analyze() { //Configuration ParserName=__T("CDXA"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Cdxa; StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS MustSynchronize=true; //Temp MI=NULL; } //--------------------------------------------------------------------------- File_Cdxa::~File_Cdxa() { delete MI; //MI=NULL; } //*************************************************************************** // Buffer - File header //*************************************************************************** // RIFF Header, 44 bytes // RIFF header 4 bytes, Pos=0 // RIFF data size 4 bytes, Pos=4 // Format (CDXA) 4 bytes, Pos=8 // Format Header 4 bytes, Pos=12 // Format Size 4 bytes, Pos=16 // Format user_id 2 bytes, Pos=20 // Format group_id 2 bytes, Pos=22 // Format attributes 2 bytes, Pos=24 // Format xa_signature 2 bytes, Pos=26 ("XA") // Format xa_track_number 4 bytes, Pos=28 // Format Reserved 4 bytes, Pos=32 // Data Header 4 bytes, Pos=36 // Data Size 4 bytes, Pos=40 // // Attributes (big endian): // 15 Directory // 14 CDDA // 13 Interleaved // 12 Mode2Form2 --> 2324 bytes/block // 11 Mode2Form1 --> 2048 bytes/block // 10 Exec_Other // 09 Reserved // 08 Read_Other // 07 Reserved // 06 Exec_Group // 05 Reserved // 04 Read_Group // 03 Reserved // 02 Exec_User // 01 Reserved // 00 Read_User //--------------------------------------------------------------------------- bool File_Cdxa::FileHeader_Begin() { //Element_Size if (Buffer_Size<0x28) return false; //Must wait for more data if ( CC4(Buffer+0x00)!=0x52494646 //"RIFF" || LittleEndian2int32u(Buffer+0x04)!=LittleEndian2int32u(Buffer+0x28)+0x24 //Sizes of chunks || CC4(Buffer+0x08)!=0x43445841 //"CDXA" || CC4(Buffer+0x0C)!=0x666D7420 //"fmt " || LittleEndian2int32u(Buffer+0x10)!=0x10 || CC2(Buffer+0x1A)!=0x5841 //"XA" || CC4(Buffer+0x24)!=0x64617461) //"data" { Reject("CDXA"); return false; } //All should be OK... return true; } //--------------------------------------------------------------------------- void File_Cdxa::FileHeader_Parse() { //Parsing Skip_C4( "RIFF header"); Skip_L4( "RIFF data size"); Skip_C4( "CDXA"); Skip_C4( "fmt header"); Skip_L4( "fmt size"); Skip_L2( "user_id"); Skip_L2( "group_id"); Skip_L2( "attributes"); Skip_C2( "xa_signature"); Skip_L4( "xa_track_number"); Skip_L4( "reserved"); Skip_C4( "data header"); Skip_L4( "data size"); FILLING_BEGIN(); Accept("CDXA"); MI=new MediaInfo_Internal; MI->Option(__T("FormatDetection_MaximumOffset"), __T("1048576")); //MI->Option(__T("File_IsSub"), __T("1")); MI->Open_Buffer_Init(File_Size, File_Offset+Buffer_Offset); FILLING_END(); } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Cdxa::Synchronize() { //Synchronizing while ( Buffer_Offset+2352*3+12<=Buffer_Size && !(CC8(Buffer+Buffer_Offset+2352*0)==0x00FFFFFFFFFFFFFFLL && CC4(Buffer+Buffer_Offset+2352*0+8)==0xFFFFFF00 && CC8(Buffer+Buffer_Offset+2352*1)==0x00FFFFFFFFFFFFFFLL && CC4(Buffer+Buffer_Offset+2352*1+8)==0xFFFFFF00 && CC8(Buffer+Buffer_Offset+2352*2)==0x00FFFFFFFFFFFFFFLL && CC4(Buffer+Buffer_Offset+2352*2+8)==0xFFFFFF00 && CC8(Buffer+Buffer_Offset+2352*3)==0x00FFFFFFFFFFFFFFLL && CC4(Buffer+Buffer_Offset+2352*3+8)==0xFFFFFF00)) Buffer_Offset++; if (Buffer_Offset+2352*3+12>Buffer_Size) return false; //Synched is OK return true; } //--------------------------------------------------------------------------- bool File_Cdxa::Synched_Test() { //Must have enough buffer for having header if (Buffer_Offset+12>Buffer_Size) return false; //Quick test of synchro if (!(CC8(Buffer+Buffer_Offset)==0x00FFFFFFFFFFFFFFLL && CC4(Buffer+Buffer_Offset+8)==0xFFFFFF00)) Synched=false; //We continue return true; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Cdxa::Streams_Finish () { if (!MI) return; //If nothing if (MI->Info==NULL || !MI->Info->Status[IsAccepted]) { Fill(Stream_General, 0, General_Format, "CDXA"); } else { //General MI->Info->Open_Buffer_Finalize(); Merge(*(MI->Info)); Merge(*(MI->Info), Stream_General, 0, 0); const Ztring &Format=Retrieve(Stream_General, 0, General_Format); Fill(Stream_General, 0, General_Format, (Ztring(__T("CDXA/"))+Format).c_str(), Unlimited, true); Clear(Stream_General, 0, General_Duration); Clear(Stream_Video, 0, Video_Duration); } //Purge what is not needed anymore if (!File_Name.empty()) //Only if this is not a buffer, with buffer we can have more data { delete MI; MI=NULL; } } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Cdxa::Header_Parse() { //Parsing Skip_B4( "Sync1"); Skip_B4( "Sync2"); Skip_B4( "Sync3"); Skip_B4( "Header"); Skip_B8( "SubHeader"); //Filling Header_Fill_Size(2352); Header_Fill_Code(0, "Chunk"); } //--------------------------------------------------------------------------- void File_Cdxa::Data_Parse() { if (MI==NULL) { //Where is the header? --> Problem Reject("CDXA"); return; } //CRC or not? int64u CRC_Size=4; if (Element_Size!=2328) CRC_Size=0; //Parsing Skip_XX(Element_Size-CRC_Size, "Data"); if (CRC_Size>0) Skip_B4( "CRC"); //Preparing to fill MediaInfo with a buffer MI->Open_Buffer_Position_Set(File_Offset+Buffer_Offset); //Sending the buffer to MediaInfo MI->Open_Buffer_Continue(Buffer+Buffer_Offset, (size_t)(Element_Size-CRC_Size)); //Testing if filled if (MI->Info->Status[IsFilled]) { } //Testing if MediaInfo always need data File_GoTo=MI->Open_Buffer_Continue_GoTo_Get(); if (File_GoTo==(int64u)-1 && MI->Info->Status[IsFilled] && File_Size!=(int64u)-1 && File_Offset+Buffer_SizeInform().empty()) Element_Show_Add(MI->Inform()); } #endif //MEDIAINFO_TRACE //Demux Demux(Buffer+Buffer_Offset, (size_t)(Element_Size-CRC_Size), ContentType_MainStream); } } //NameSpace #endif //MEDIAINFO_CDXA_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Cdxa.h100777 0 0 3163 12226004262 15333 0/* 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 CDXA files // (like Video-CD...) // CDXA are read by MS-Windows with CRC bytes // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_CdxaH #define MediaInfo_File_CdxaH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { class MediaInfo_Internal; //*************************************************************************** // Class File_Cdxa //*************************************************************************** class File_Cdxa : public File__Analyze { public : //Constructor/Destructor File_Cdxa(); ~File_Cdxa(); private : //Streams management void Streams_Finish (); //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse(); //Buffer - Synchro bool Synchronize(); bool Synched_Test(); //Buffer - Per element void Header_Parse(); void Data_Parse(); //Temp MediaInfo_Internal* MI; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_DashMpd.cpp100777 0 0 67410 12226004262 16354 0/* 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. */ // Period // AdaptationSet --> One per stream // SegmentTemplate (optional) // SegmentTimeline // S --> duration per segment, count of segments // Representation --> file name from SegmentTemplate or BaseURL // SegmentBase // SegmentList // Representation --> file name from BaseURL //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DASHMPD_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_DashMpd.h" #include "MediaInfo/Multiple/File__ReferenceFilesHelper.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "ZenLib/FileName.h" #include "ZenLib/File.h" #include "tinyxml2.h" using namespace ZenLib; using namespace tinyxml2; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- void DashMpd_Transform (Ztring &Value, std::map &Attributes) { size_t Pos1=0; for (;;) { Pos1=Value.find(__T('$'), Pos1); if (Pos1==string::npos) break; size_t Pos2=Value.find(__T('$'), Pos1+1); if (Pos2==string::npos) break; Ztring Name=Value.substr(Pos1+1, Pos2-Pos1-1); if (Name.empty()) Value.erase(Pos1, 1); else { if (Name==__T("RepresentationID")) Name=__T("id"); if (Name==__T("Bandwidth")) Name=__T("bandwidth"); std::map::iterator Attribute_It=Attributes.find(Name); if (Attribute_It!=Attributes.end()) { Value.erase(Pos1, Pos2-Pos1+1); Value.insert(Pos1, Attribute_It->second); } else Pos1+=2+Name.size(); } } } //--------------------------------------------------------------------------- stream_t DashMpd_mimeType_StreamKind (const char* mimeType) { Ztring StreamKind; StreamKind.From_UTF8(mimeType); if (StreamKind.find(__T("video"))==0) return Stream_Video; else if (StreamKind.find(__T("audio"))==0) return Stream_Audio; else if (StreamKind.find(__T("application/ttml+xml"))==0) return Stream_Text; else return Stream_Other; } //--------------------------------------------------------------------------- Ztring DashMpd_codecid_CodecID (const char* codecid) { Ztring CodecID; Ztring Codecs; Codecs.From_UTF8(codecid); size_t DotPos=Codecs.find(__T('.')); if (DotPos==4 && Codecs.substr(0, DotPos).find(__T("mp4"))==0) DotPos=Codecs.find(__T('.'), 5); if (DotPos==string::npos) { CodecID=Codecs; } else { CodecID=Codecs.substr(0, DotPos); //TODO per format, rfc 6381 //ReferenceFile.Infos["Format_Profile"]=; } CodecID.FindAndReplace(__T("0x"), Ztring(), 0, Ztring_Recursive); return CodecID; } //--------------------------------------------------------------------------- struct template_generic { File__ReferenceFilesHelper::reference ReferenceFile; Ztring SourceDir; Ztring BaseURL; Ztring initialization; Ztring media; int64u duration; int64u startNumber; int64u duration_Max; int64u startNumber_Max; struct segmenttimeline { int64u t; //start time int64u d; //duration per segment int64u r; //repeat count segmenttimeline() { t=1; d=1; r=0; } }; std::vector SegmentTimeLines; std::map Attributes_ForMedia; template_generic(const Ztring &BaseURL=Ztring(), const Ztring &SourceDir=Ztring()) { template_generic::BaseURL=BaseURL; template_generic::SourceDir=SourceDir; duration=1; startNumber=1; duration_Max=0; startNumber_Max=0; } void AdaptationSet_Attributes_Parse (XMLElement* Item); void SegmentTemplate_Attributes_Parse (XMLElement* Item); void SegmentTimeline_Attributes_Parse (XMLElement* Item); void Representation_Attributes_Parse (XMLElement* Item); void Decode (); }; void template_generic::AdaptationSet_Attributes_Parse (XMLElement* Item) { const char* Attribute; //Attributes - mineType Attribute=Item->Attribute("mimeType"); if (Attribute) ReferenceFile.StreamKind=DashMpd_mimeType_StreamKind(Attribute); //Attributes - codecs Attribute=Item->Attribute("codecs"); if (Attribute) ReferenceFile.Infos["CodecID"]=DashMpd_codecid_CodecID(Attribute); //Attributes - lang Attribute=Item->Attribute("lang"); if (Attribute) ReferenceFile.Infos["Language"].From_UTF8(Attribute); } void template_generic::SegmentTemplate_Attributes_Parse (XMLElement* Item) { const char* Attribute; //Attributes - initialization Attribute=Item->Attribute("initialization"); if (Attribute) { initialization.From_UTF8(Attribute); } //Attributes - media Attribute=Item->Attribute("media"); if (Attribute) { media.From_UTF8(Attribute); } //Attributes - duration Attribute=Item->Attribute("duration"); if (Attribute) { duration=Ztring().From_UTF8(Attribute).To_int64u(); } //Attributes - startNumber Attribute=Item->Attribute("startNumber"); if (Attribute) { startNumber=Ztring().From_UTF8(Attribute).To_int64u(); } } void template_generic::SegmentTimeline_Attributes_Parse (XMLElement* Item) { const char* Attribute; segmenttimeline SegmentTimeLine; //Attributes - t (start time) Attribute=Item->Attribute("t"); if (Attribute) { SegmentTimeLine.t=Ztring().From_UTF8(Attribute).To_int64u(); } else SegmentTimeLine.t=startNumber; //Attributes - d (duration per segment) Attribute=Item->Attribute("d"); if (Attribute) { SegmentTimeLine.d=Ztring().From_UTF8(Attribute).To_int64u(); } else SegmentTimeLine.d=duration; //Attributes - r (repeat count) Attribute=Item->Attribute("r"); if (Attribute) { SegmentTimeLine.r=Ztring().From_UTF8(Attribute).To_int64u(); } SegmentTimeLines.push_back(SegmentTimeLine); duration_Max+=SegmentTimeLine.d*(SegmentTimeLine.r+1); startNumber_Max+=SegmentTimeLine.r+1; } void template_generic::Representation_Attributes_Parse (XMLElement* Item) { const char* Attribute; //Attributes - id Attribute=Item->Attribute("id"); if (Attribute) { ReferenceFile.StreamID=Ztring().From_UTF8(Attribute).To_int64u(16); } //Attributes - bandwidth Attribute=Item->Attribute("bandwidth"); if (Attribute) { ReferenceFile.Infos["BitRate"].From_UTF8(Attribute); } //Attributes - frame size Attribute=Item->Attribute("width"); if (Attribute) { ReferenceFile.Infos["Width"].From_UTF8(Attribute); } Attribute=Item->Attribute("height"); if (Attribute) { ReferenceFile.Infos["Height"].From_UTF8(Attribute); } //Attributes - mineType Attribute=Item->Attribute("mimeType"); if (Attribute) ReferenceFile.StreamKind=DashMpd_mimeType_StreamKind(Attribute); //Attributes - codecs Attribute=Item->Attribute("codecs"); if (Attribute) ReferenceFile.Infos["CodecID"]=DashMpd_codecid_CodecID(Attribute); //Attributes - lang Attribute=Item->Attribute("lang"); if (Attribute) ReferenceFile.Infos["Language"].From_UTF8(Attribute); //Attributes - Saving all attributes for (const XMLAttribute* Attribute_Item=Item->FirstAttribute(); Attribute_Item; Attribute_Item=Attribute_Item->Next()) { Ztring Name; Name.From_UTF8(Attribute_Item->Name()); Ztring Value; Value.From_UTF8(Attribute_Item->Value()); Attributes_ForMedia[Name]=Value; } } //--------------------------------------------------------------------------- void template_generic::Decode() { //initialization - URL decoding, template adaptation and add it if (!initialization.empty()) { DashMpd_Transform(initialization, Attributes_ForMedia); ReferenceFile.FileNames.push_back(BaseURL+initialization); } //media - URL decoding, template adaptation and add it if (!media.empty()) { DashMpd_Transform(media, Attributes_ForMedia); size_t Index_Pos=media.find(__T("$Index")); size_t Index_StringSize=5; if (Index_Pos==string::npos) { Index_Pos=media.find(__T("$Number")); Index_StringSize++; } int8u Index_Size=1; if (Index_Pos!=string::npos) { size_t Index_Pos_End=media.find(__T('$'), Index_Pos+1+Index_StringSize); if (Index_Pos_End!=string::npos && Index_Pos+1+Index_StringSize+2Index_Pos) Time_Pos-=1+Index_StringSize+1; } if (Time_Pos!=string::npos) { Media_Name.erase(Time_Pos, 6); if (Index_Pos!=string::npos && Index_Pos>Time_Pos) Index_Pos-=6; } if (SegmentTimeLines.empty()) { int64u Index_Pos_Temp=startNumber; for (;;) { Ztring Media_Name_Temp(Media_Name); Ztring Index; Index.From_Number(Index_Pos_Temp); if (Index.size()Index_Pos) Time_Pos_Temp+=Index.size(); } if (Time_Pos_Temp!=string::npos) { Ztring Time; Time.From_Number(SegmentTimeLines_duration); Media_Name_Temp.insert(Time_Pos_Temp, Time); } ReferenceFile.FileNames.push_back(BaseURL+Media_Name_Temp); SegmentTimeLines_duration+=SegmentTimeLines[SegmentTimeLines_Pos].d; SegmentTimeLines_startNumber++; } } } } else ReferenceFile.FileNames.push_back(BaseURL+media); } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_DashMpd::File_DashMpd() :File__Analyze() { #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_DashMpd; StreamIDs_Width[0]=16; #endif //MEDIAINFO_EVENTS //Temp ReferenceFiles=NULL; } //--------------------------------------------------------------------------- File_DashMpd::~File_DashMpd() { delete ReferenceFiles; //ReferenceFiles=NULL; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_DashMpd::Streams_Finish() { if (ReferenceFiles==NULL) return; ReferenceFiles->ParseReferences(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_DashMpd::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { if (ReferenceFiles==NULL) return 0; return ReferenceFiles->Read_Buffer_Seek(Method, Value, ID); } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_DashMpd::FileHeader_Begin() { XMLDocument document; if (!FileHeader_Begin_XML(document)) return false; { XMLElement* Root=document.FirstChildElement("MPD"); if (Root) { const char* Attribute=Root->Attribute("xmlns"); if (Attribute==NULL || (Ztring().From_UTF8(Attribute)!=__T("urn:mpeg:DASH:schema:MPD:2011") && Ztring().From_UTF8(Attribute)!=__T("urn:mpeg:dash:schema:mpd:2011") //Some muxers use lower case version && Ztring().From_UTF8(Attribute)!=__T("urn:3GPP:ns:PSS:AdaptiveHTTPStreamingMPD:2009"))) { Reject("DashMpd"); return false; } Accept("DashMpd"); Fill(Stream_General, 0, General_Format, "DASH MPD"); Config->File_ID_OnlyRoot_Set(false); ReferenceFiles=new File__ReferenceFilesHelper(this, Config); //Parsing main elements Ztring BaseURL; for (XMLElement* Root_Item=Root->FirstChildElement(); Root_Item; Root_Item=Root_Item->NextSiblingElement()) { //Common information if (string(Root_Item->Value())=="BaseURL") { if (BaseURL.empty()) //Using the first one BaseURL=Root_Item->GetText(); } //Period if (string(Root_Item->Value())=="Period") { for (XMLElement* Period_Item=Root_Item->FirstChildElement(); Period_Item; Period_Item=Period_Item->NextSiblingElement()) { //AdaptationSet (=a stream) if (string(Period_Item->Value())=="AdaptationSet") { template_generic Template_Generic(BaseURL, FileName(File_Name).Path_Get()); Template_Generic.AdaptationSet_Attributes_Parse(Period_Item); //Sub for (XMLElement* AdaptationSet_Item=Period_Item->FirstChildElement(); AdaptationSet_Item; AdaptationSet_Item=AdaptationSet_Item->NextSiblingElement()) { //SegmentTemplate if (string(AdaptationSet_Item->Value())=="SegmentTemplate") { Template_Generic.SegmentTemplate_Attributes_Parse(AdaptationSet_Item); //Sub for (XMLElement* SegmentTemplate_Item=AdaptationSet_Item->FirstChildElement(); SegmentTemplate_Item; SegmentTemplate_Item=SegmentTemplate_Item->NextSiblingElement()) { //SegmentTimeline if (string(SegmentTemplate_Item->Value())=="SegmentTimeline") { //Sub for (XMLElement* SegmentTimeline_Item=SegmentTemplate_Item->FirstChildElement(); SegmentTimeline_Item; SegmentTimeline_Item=SegmentTimeline_Item->NextSiblingElement()) { //SegmentTimeline if (string(SegmentTimeline_Item->Value())=="S") { Template_Generic.SegmentTimeline_Attributes_Parse(SegmentTimeline_Item); } } } } } //Representation if (string(AdaptationSet_Item->Value())=="Representation") { template_generic Template_Generic_PerRepresentation(Template_Generic); Template_Generic_PerRepresentation.Representation_Attributes_Parse(AdaptationSet_Item); //Sub for (XMLElement* Representation_Item=AdaptationSet_Item->FirstChildElement(); Representation_Item; Representation_Item=Representation_Item->NextSiblingElement()) { //BaseURL if (string(Representation_Item->Value())=="BaseURL") { Template_Generic_PerRepresentation.ReferenceFile.FileNames.push_back(BaseURL+Ztring().From_UTF8(Representation_Item->GetText())); } //SegmentTemplate if (string(Representation_Item->Value())=="SegmentTemplate") { Template_Generic_PerRepresentation.SegmentTemplate_Attributes_Parse(Representation_Item); } //SegmentBase if (string(Representation_Item->Value())=="SegmentBase") { //Sub for (XMLElement* SegmentBase_Item=Representation_Item->FirstChildElement(); SegmentBase_Item; SegmentBase_Item=SegmentBase_Item->NextSiblingElement()) { //Initialization if (string(SegmentBase_Item->Value())=="Initialization") { Attribute=SegmentBase_Item->Attribute("sourceURL"); if (Attribute) Template_Generic_PerRepresentation.ReferenceFile.FileNames.insert(Template_Generic_PerRepresentation.ReferenceFile.FileNames.begin(), BaseURL+Ztring().From_UTF8(Attribute)); } } } //SegmentList if (string(Representation_Item->Value())=="SegmentList") { //Sub for (XMLElement* SegmentBase_Item=Representation_Item->FirstChildElement(); SegmentBase_Item; SegmentBase_Item=SegmentBase_Item->NextSiblingElement()) { //Initialization if (string(SegmentBase_Item->Value())=="SegmentURL") { bool IsSupported=true; Attribute=SegmentBase_Item->Attribute("mediaRange"); if (Attribute) { size_t Length=strlen(Attribute); if (Length<2 || Attribute[0]!='0' || Attribute[1]!='-') IsSupported=false; //Currently, we do not support ranges } Attribute=SegmentBase_Item->Attribute("media"); if (Attribute && IsSupported) Template_Generic_PerRepresentation.ReferenceFile.FileNames.push_back(BaseURL+Ztring().From_UTF8(Attribute)); } } } } Template_Generic_PerRepresentation.Decode(); ReferenceFiles->References.push_back(Template_Generic_PerRepresentation.ReferenceFile); } } } //Representation (=a stream) if (string(Period_Item->Value())=="Representation") { File__ReferenceFilesHelper::reference ReferenceFile; int64u duration=1; //Attributes - mineType Attribute=Period_Item->Attribute("mimeType"); if (Attribute) ReferenceFile.StreamKind=DashMpd_mimeType_StreamKind(Attribute); //Attributes - codecs Attribute=Period_Item->Attribute("codecs"); if (Attribute) ReferenceFile.Infos["CodecID"]=DashMpd_codecid_CodecID(Attribute); //Attributes - lang Attribute=Period_Item->Attribute("lang"); if (Attribute) ReferenceFile.Infos["Language"].From_UTF8(Attribute); //Sub for (XMLElement* AdaptationSet_Item=Period_Item->FirstChildElement(); AdaptationSet_Item; AdaptationSet_Item=AdaptationSet_Item->NextSiblingElement()) { //SegmentInfo if (string(AdaptationSet_Item->Value())=="SegmentInfo") { //Attributes - duration Attribute=AdaptationSet_Item->Attribute("duration"); if (Attribute) { duration=Ztring().From_UTF8(Attribute).To_int64u(); } //Sub for (XMLElement* SegmentInfo_Item=AdaptationSet_Item->FirstChildElement(); SegmentInfo_Item; SegmentInfo_Item=SegmentInfo_Item->NextSiblingElement()) { //InitialisationSegmentURL if (string(SegmentInfo_Item->Value())=="InitialisationSegmentURL") { Attribute=SegmentInfo_Item->Attribute("sourceURL"); if (Attribute) ReferenceFile.FileNames.insert(ReferenceFile.FileNames.begin(), BaseURL+Ztring().From_UTF8(Attribute)); } //Url if (string(SegmentInfo_Item->Value())=="Url") { Attribute=SegmentInfo_Item->Attribute("sourceURL"); if (Attribute) ReferenceFile.FileNames.push_back(BaseURL+Ztring().From_UTF8(Attribute)); } } ReferenceFiles->References.push_back(ReferenceFile); } } } } } } } else { Reject("DashMpd"); return false; } } Element_Offset=File_Size; //All should be OK... return true; } } //NameSpace #endif //MEDIAINFO_DASHMPD_YES MediaInfoLib/Source/MediaInfo/Multiple/File_DashMpd.h100777 0 0 3202 12226004262 15766 0/* 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 DASH (.mpd) files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_DashMpdH #define MediaInfo_File_DashMpdH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { class File__ReferenceFilesHelper; //*************************************************************************** // Class File_DashMpd //*************************************************************************** class File_DashMpd : public File__Analyze { public : //Constructor/Destructor File_DashMpd(); ~File_DashMpd(); private : //Streams management void Streams_Finish (); //Buffer - Global #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK //Buffer - File header bool FileHeader_Begin(); //Helpers void Representation(); //Temp File__ReferenceFilesHelper* ReferenceFiles; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_DcpAm.cpp100777 0 0 24441 12232174331 16017 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DCP_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_DcpAm.h" #include "MediaInfo/MediaInfo.h" #include "MediaInfo/MediaInfo_Internal.h" #include "MediaInfo/Multiple/File__ReferenceFilesHelper.h" #include "MediaInfo/Multiple/File_DcpCpl.h" #include "ZenLib/Dir.h" #include "ZenLib/FileName.h" #include "tinyxml2.h" using namespace tinyxml2; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- extern void DcpCpl_MergeFromPkl(File__ReferenceFilesHelper* FromCpl, File__ReferenceFilesHelper* FromPkl); //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_DcpAm::File_DcpAm() :File__Analyze() { #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_DcpAm; StreamIDs_Width[0]=sizeof(size_t)*2; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_EventWasSent_Accept_Specific=true; #endif //MEDIAINFO_DEMUX //Temp ReferenceFiles=NULL; } //--------------------------------------------------------------------------- File_DcpAm::~File_DcpAm() { delete ReferenceFiles; //ReferenceFiles=NULL; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_DcpAm::Streams_Finish() { if (ReferenceFiles==NULL) return; ReferenceFiles->ParseReferences(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_DcpAm::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { if (ReferenceFiles==NULL) return 0; return ReferenceFiles->Read_Buffer_Seek(Method, Value, ID); } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_DcpAm::FileHeader_Begin() { XMLDocument document; if (!FileHeader_Begin_XML(document)) return false; bool IsDcp=false, IsImf=false; std::string NameSpace; XMLElement* AssetMap=document.FirstChildElement("AssetMap"); if (AssetMap==NULL) { NameSpace="am:"; AssetMap=document.FirstChildElement((NameSpace+"AssetMap").c_str()); } if (!AssetMap) { Reject("DcpAm"); return false; } const char* Attribute=AssetMap->Attribute(NameSpace.empty()?"xmlns":"xmlns:am"); if (!Attribute) { Reject("DcpAm"); return false; } if (!strcmp(Attribute, "http://www.digicine.com/PROTO-ASDCP-AM-20040311#")) IsDcp=true; if (!strcmp(Attribute, "http://www.smpte-ra.org/schemas/429-9/2007/AM")) { if (NameSpace.empty()) IsImf=true; else IsDcp=true; } if (!IsDcp && !IsImf) { Reject("DcpAm"); return false; } Accept("DcpAm"); Fill(Stream_General, 0, General_Format, IsDcp?"DCP AM":"IMF AM"); if (IsDcp) Fill(Stream_General, 0, General_Format_Version, NameSpace=="am:"?"SMPTE":"Interop"); Config->File_ID_OnlyRoot_Set(false); ReferenceFiles=new File__ReferenceFilesHelper(this, Config); Ztring CPL_FileName; for (XMLElement* AssetMap_Item=AssetMap->FirstChildElement(); AssetMap_Item; AssetMap_Item=AssetMap_Item->NextSiblingElement()) { //AssetList if (!strcmp(AssetMap_Item->Value(), (NameSpace+"AssetList").c_str())) { for (XMLElement* AssetList_Item=AssetMap_Item->FirstChildElement(); AssetList_Item; AssetList_Item=AssetList_Item->NextSiblingElement()) { //Asset if (!strcmp(AssetList_Item->Value(), (NameSpace+"Asset").c_str())) { File__ReferenceFilesHelper::reference ReferenceFile; bool IsCPL=false; for (XMLElement* Asset_Item=AssetList_Item->FirstChildElement(); Asset_Item; Asset_Item=Asset_Item->NextSiblingElement()) { //Id if (!strcmp(Asset_Item->Value(), (NameSpace+"Id").c_str())) ReferenceFile.Infos["UniqueID"].From_UTF8(Asset_Item->GetText()); //ChunkList if (!strcmp(Asset_Item->Value(), (NameSpace+"ChunkList").c_str())) { for (XMLElement* ChunkList_Item=Asset_Item->FirstChildElement(); ChunkList_Item; ChunkList_Item=ChunkList_Item->NextSiblingElement()) { //Chunk if (!strcmp(ChunkList_Item->Value(), (NameSpace+"Chunk").c_str())) { for (XMLElement* Chunk_Item=ChunkList_Item->FirstChildElement(); Chunk_Item; Chunk_Item=Chunk_Item->NextSiblingElement()) { //Path if (!strcmp(Chunk_Item->Value(), (NameSpace+"Path").c_str())) { ReferenceFile.FileNames.push_back(Ztring().From_UTF8(Chunk_Item->GetText())); string Text=Chunk_Item->GetText(); if (Text.size()>=8 && (Text.find("_cpl.xml")==Text.size()-8) || (Text.find("CPL_")==0 && Text.find(".xml")==Text.size()-4)) IsCPL=true; } } } } } } if (IsCPL) { for (size_t Pos=0; PosReferences.size()+1; ReferenceFiles->References.push_back(ReferenceFile); } } } //Creator if (!strcmp(AssetMap_Item->Value(), (NameSpace+"Creator").c_str())) Fill(Stream_General, 0, General_Encoded_Library, AssetMap_Item->GetText()); //IssueDate if (!strcmp(AssetMap_Item->Value(), (NameSpace+"IssueDate").c_str())) Fill(Stream_General, 0, General_Encoded_Date, AssetMap_Item->GetText()); //Issuer if (!strcmp(AssetMap_Item->Value(), (NameSpace+"Issuer").c_str())) Fill(Stream_General, 0, General_EncodedBy, AssetMap_Item->GetText()); } Element_Offset=File_Size; //Getting links between files if (!CPL_FileName.empty() && !Config->File_IsReferenced_Get()) { FileName Directory(File_Name); if (CPL_FileName.find(__T("file://"))==0 && CPL_FileName.find(__T("file:///"))==string::npos) CPL_FileName.erase(0, 7); //TODO: better handling of relative and absolute file naes MediaInfo_Internal MI; MI.Option(__T("File_KeepInfo"), __T("1")); Ztring ParseSpeed_Save=MI.Option(__T("ParseSpeed_Get"), __T("")); Ztring Demux_Save=MI.Option(__T("Demux_Get"), __T("")); MI.Option(__T("ParseSpeed"), __T("0")); MI.Option(__T("Demux"), Ztring()); MI.Option(__T("File_IsReferenced"), __T("1")); size_t MiOpenResult=MI.Open(Directory.Path_Get()+PathSeparator+CPL_FileName); MI.Option(__T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value MI.Option(__T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value if (MiOpenResult && ((IsDcp && MI.Get(Stream_General, 0, General_Format)==__T("DCP CPL")) || (IsImf && MI.Get(Stream_General, 0, General_Format)==__T("IMF CPL")))) { DcpCpl_MergeFromPkl(((File_DcpCpl*)MI.Info)->ReferenceFiles, ReferenceFiles); ReferenceFiles->References=((File_DcpCpl*)MI.Info)->ReferenceFiles->References; } } ReferenceFiles->FilesForStorage=true; //All should be OK... return true; } } //NameSpace #endif //MEDIAINFO_P2_YES MediaInfoLib/Source/MediaInfo/Multiple/File_DcpAm.h100777 0 0 3112 12226004262 15432 0/* 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 DCP AssetMap files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_DcpAmH #define MediaInfo_File_DcpAmH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { class File__ReferenceFilesHelper; //*************************************************************************** // Class File_DcpAm //*************************************************************************** class File_DcpAm : public File__Analyze { public : //Constructor/Destructor File_DcpAm(); ~File_DcpAm(); private : //Streams management void Streams_Finish (); //Buffer - Global #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK //Buffer - File header bool FileHeader_Begin(); //Temp File__ReferenceFilesHelper* ReferenceFiles; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_DcpCpl.cpp100777 0 0 31751 12243714072 16206 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DCP_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_DcpCpl.h" #include "MediaInfo/MediaInfo.h" #include "MediaInfo/MediaInfo_Internal.h" #include "MediaInfo/Multiple/File__ReferenceFilesHelper.h" #include "MediaInfo/Multiple/File_DcpPkl.h" #include "MediaInfo/Multiple/File_Mxf.h" #include "ZenLib/Dir.h" #include "ZenLib/FileName.h" #include "tinyxml2.h" #include using namespace tinyxml2; using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** struct DcpCpl_info { Ztring FileName; File__ReferenceFilesHelper::references::iterator Reference; }; //--------------------------------------------------------------------------- extern void DcpCpl_MergeFromPkl(File__ReferenceFilesHelper* FromCpl, File__ReferenceFilesHelper* FromPkl) { map Map; list List; ZtringList ExtraFiles_Name; for (File__ReferenceFilesHelper::references::iterator Reference=FromPkl->References.begin(); Reference!=FromPkl->References.end(); ++Reference) { map::iterator UniqueID=Reference->Infos.find("UniqueID"); for (size_t Pos=0; PosFileNames.size(); Pos++) if (UniqueID!=Reference->Infos.end()) { Map[UniqueID->second].FileName=Reference->FileNames[Pos]; Map[UniqueID->second].Reference=Reference; } List.push_back(Reference); } for (File__ReferenceFilesHelper::references::iterator Reference=FromCpl->References.begin(); Reference!=FromCpl->References.end(); ++Reference) for (size_t Pos=0; PosFileNames.size(); Pos++) { map::iterator Map_Item=Map.find(Reference->FileNames[Pos]); if (Map_Item!=Map.end()) { Reference->FileNames[Pos]=Map_Item->second.FileName; for (list::iterator Reference2=List.begin(); Reference2!=List.end(); ++Reference2) if (*Reference2==Map_Item->second.Reference) { List.erase(Reference2); break; } } } for (list::iterator Reference=List.begin(); Reference!=List.end(); ++Reference) { FromCpl->References.push_back(**Reference); FromCpl->References[FromCpl->References.size()-1].StreamID=FromCpl->References.size()-1; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_DcpCpl::File_DcpCpl() :File__Analyze() { #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_DcpCpl; StreamIDs_Width[0]=sizeof(size_t)*2; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_EventWasSent_Accept_Specific=true; #endif //MEDIAINFO_DEMUX //Temp ReferenceFiles=NULL; } //--------------------------------------------------------------------------- File_DcpCpl::~File_DcpCpl() { delete ReferenceFiles; //ReferenceFiles=NULL; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_DcpCpl::Streams_Finish() { if (Config->File_IsReferenced_Get() || ReferenceFiles==NULL) return; ReferenceFiles->ParseReferences(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_DcpCpl::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { if (Config->File_IsReferenced_Get() || ReferenceFiles==NULL) return 0; return ReferenceFiles->Read_Buffer_Seek(Method, Value, ID); } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_DcpCpl::FileHeader_Begin() { XMLDocument document; if (!FileHeader_Begin_XML(document)) return false; bool IsDcp=false, IsImf=false; XMLElement* Root=document.FirstChildElement("CompositionPlaylist"); if (!Root) { Reject("DcpCpl"); return false; } const char* Attribute=Root->Attribute("xmlns"); if (!Attribute) { Reject("DcpCpl"); return false; } if (!strcmp(Attribute, "http://www.digicine.com/PROTO-ASDCP-CPL-20040511#")) IsDcp=true; if (!strcmp(Attribute, "http://www.smpte-ra.org/schemas/2067-3/XXXX") //Some muxers use XXXX instead of year || !strcmp(Attribute, "http://www.smpte-ra.org/schemas/2067-3/2013")) IsImf=true; if (!IsDcp && !IsImf) { Reject("DcpCpl"); return false; } Accept("DcpCpl"); Fill(Stream_General, 0, General_Format, IsDcp?"DCP CPL":"IMF CPL"); Config->File_ID_OnlyRoot_Set(false); ReferenceFiles=new File__ReferenceFilesHelper(this, Config); //Parsing main elements for (XMLElement* Root_Item=Root->FirstChildElement(); Root_Item; Root_Item=Root_Item->NextSiblingElement()) { //ReelList / SegmentList if ((IsDcp && !strcmp(Root_Item->Value(), "ReelList")) || (IsImf && !strcmp(Root_Item->Value(), "SegmentList"))) { for (XMLElement* ReelList_Item=Root_Item->FirstChildElement(); ReelList_Item; ReelList_Item=ReelList_Item->NextSiblingElement()) { //Reel if ((IsDcp && !strcmp(ReelList_Item->Value(), "Reel")) || (IsImf && !strcmp(ReelList_Item->Value(), "Segment"))) { for (XMLElement* Reel_Item=ReelList_Item->FirstChildElement(); Reel_Item; Reel_Item=Reel_Item->NextSiblingElement()) { //AssetList if ((IsDcp && !strcmp(Reel_Item->Value(), "AssetList")) || (IsImf && !strcmp(Reel_Item->Value(), "SequenceList"))) { for (XMLElement* AssetList_Item=Reel_Item->FirstChildElement(); AssetList_Item; AssetList_Item=AssetList_Item->NextSiblingElement()) { //File //if ((IsDcp && (!strcmp(AssetList_Item->Value(), "MainPicture") || !strcmp(AssetList_Item->Value(), "MainSound"))) // || (IsImf && (!strcmp(AssetList_Item->Value(), "cc:MainImageSequence") || !strcmp(AssetList_Item->Value(), "cc:MainImage")))) { File__ReferenceFilesHelper::reference ReferenceFile; Ztring Id; if ((IsDcp && !strcmp(AssetList_Item->Value(), "MainPicture")) || (IsImf && !strcmp(AssetList_Item->Value(), "cc:MainImageSequence"))) ReferenceFile.StreamKind=Stream_Video; if ((IsDcp && !strcmp(AssetList_Item->Value(), "MainSound")) || (IsImf && !strcmp(AssetList_Item->Value(), "cc:MainAudioSequence"))) ReferenceFile.StreamKind=Stream_Audio; for (XMLElement* File_Item=AssetList_Item->FirstChildElement(); File_Item; File_Item=File_Item->NextSiblingElement()) { //Id if (!strcmp(File_Item->Value(), "Id") && Id.empty()) Id.From_UTF8(File_Item->GetText()); //ResourceList if (IsImf && !strcmp(File_Item->Value(), "ResourceList")) { for (XMLElement* ResourceList_Item=File_Item->FirstChildElement(); ResourceList_Item; ResourceList_Item=ResourceList_Item->NextSiblingElement()) { //Resource if (!strcmp(ResourceList_Item->Value(), "Resource")) { for (XMLElement* Resource_Item=ResourceList_Item->FirstChildElement(); Resource_Item; Resource_Item=Resource_Item->NextSiblingElement()) { //TrackFileId if (!strcmp(Resource_Item->Value(), "TrackFileId")) ReferenceFile.FileNames.push_back(Resource_Item->GetText()); } } } } } if (ReferenceFile.FileNames.empty()) ReferenceFile.FileNames.push_back(Id); ReferenceFile.StreamID=ReferenceFiles->References.size()+1; ReferenceFiles->References.push_back(ReferenceFile); } } } } } } } } Element_Offset=File_Size; //Getting files names if (!Config->File_IsReferenced_Get()) { FileName Directory(File_Name); ZtringList List; if (IsImf) List=Dir::GetAllFileNames(Directory.Path_Get()+PathSeparator+__T("PKL_*.xml"), Dir::Include_Files); if (IsDcp || List.empty()) List=Dir::GetAllFileNames(Directory.Path_Get()+PathSeparator+__T("*_pkl.xml"), Dir::Include_Files); for (size_t Pos=0; PosReferenceFiles); } } } ReferenceFiles->FilesForStorage=true; //All should be OK... return true; } } //NameSpace #endif //MEDIAINFO_DCP_YES MediaInfoLib/Source/MediaInfo/Multiple/File_DcpCpl.h100777 0 0 3576 12226004262 15631 0/* 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 DCP/IMF Composition Playlist files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_DcpCplH #define MediaInfo_File_DcpCplH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { class File__ReferenceFilesHelper; //*************************************************************************** // Class File_DcpCpl //*************************************************************************** class File_DcpCpl : public File__Analyze { public : //Constructor/Destructor File_DcpCpl(); ~File_DcpCpl(); private : //Streams management void Streams_Finish (); //Buffer - Global #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK //Buffer - File header bool FileHeader_Begin(); //Temp File__ReferenceFilesHelper* ReferenceFiles; friend class File_DcpAm; //Theses classes need access to internal structure for optimization. There is recursivity with theses formats friend class File_DcpPkl; //Theses classes need access to internal structure for optimization. There is recursivity with theses formats }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_DcpPkl.cpp100777 0 0 23640 12243714672 16222 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DCP_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_DcpPkl.h" #include "MediaInfo/MediaInfo.h" #include "MediaInfo/MediaInfo_Internal.h" #include "MediaInfo/Multiple/File__ReferenceFilesHelper.h" #include "MediaInfo/Multiple/File_DcpCpl.h" #include "ZenLib/Dir.h" #include "ZenLib/FileName.h" #include "tinyxml2.h" using namespace tinyxml2; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- extern void DcpCpl_MergeFromPkl(File__ReferenceFilesHelper* FromCpl, File__ReferenceFilesHelper* FromPkl); //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_DcpPkl::File_DcpPkl() :File__Analyze() { #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_DcpPkl; StreamIDs_Width[0]=sizeof(size_t)*2; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_EventWasSent_Accept_Specific=true; #endif //MEDIAINFO_DEMUX //Temp ReferenceFiles=NULL; HasCpl=false; } //--------------------------------------------------------------------------- File_DcpPkl::~File_DcpPkl() { delete ReferenceFiles; //ReferenceFiles=NULL; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_DcpPkl::Streams_Finish() { if (Config->File_IsReferenced_Get() || ReferenceFiles==NULL) return; ReferenceFiles->ParseReferences(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_DcpPkl::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { if (Config->File_IsReferenced_Get() || ReferenceFiles==NULL) return 0; return ReferenceFiles->Read_Buffer_Seek(Method, Value, ID); } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_DcpPkl::FileHeader_Begin() { XMLDocument document; if (!FileHeader_Begin_XML(document)) return false; bool IsDcp=false, IsImf=false; XMLElement* PackingList=document.FirstChildElement("PackingList"); if (!PackingList) { Reject("DcpPkl"); return false; } const char* Attribute=PackingList->Attribute("xmlns"); if (!Attribute) { Reject("DcpPkl"); return false; } if (!strcmp(Attribute, "http://www.digicine.com/PROTO-ASDCP-PKL-20040311#")) IsDcp=true; if (!strcmp(Attribute, "http://www.smpte-ra.org/schemas/429-8/2007/PKL")) IsImf=true; if (!IsDcp && !IsImf) { Reject("DcpPkl"); return false; } Accept("DcpPkl"); Fill(Stream_General, 0, General_Format, IsDcp?"DCP PKL":"IMF PKL"); Config->File_ID_OnlyRoot_Set(false); ReferenceFiles=new File__ReferenceFilesHelper(this, Config); Ztring CPL_FileName; //Parsing main elements for (XMLElement* PackingList_Item=PackingList->FirstChildElement(); PackingList_Item; PackingList_Item=PackingList_Item->NextSiblingElement()) { //AssetList if (!strcmp(PackingList_Item->Value(), "AssetList")) { for (XMLElement* AssetList_Item=PackingList_Item->FirstChildElement(); AssetList_Item; AssetList_Item=AssetList_Item->NextSiblingElement()) { //Asset if (!strcmp(AssetList_Item->Value(), "Asset")) { File__ReferenceFilesHelper::reference ReferenceFile; bool IsCPL=false; bool PreviousFileNameIsAnnotationText=false; for (XMLElement* File_Item=AssetList_Item->FirstChildElement(); File_Item; File_Item=File_Item->NextSiblingElement()) { //Id if (!strcmp(File_Item->Value(), "Id")) ReferenceFile.Infos["UniqueID"].From_UTF8(File_Item->GetText()); //Type if (!strcmp(File_Item->Value(), "Type")) { if (!strcmp(File_Item->GetText(), "application/x-smpte-mxf;asdcpKind=Picture")) ReferenceFile.StreamKind=Stream_Video; else if (!strcmp(File_Item->GetText(), "application/x-smpte-mxf;asdcpKind=Sound")) ReferenceFile.StreamKind=Stream_Audio; else if (!strcmp(File_Item->GetText(), "text/xml;asdcpKind=CPL")) { HasCpl=IsCPL=true; } else ReferenceFile.StreamKind=Stream_Other; } //Id if (!strcmp(File_Item->Value(), "OriginalFileName") || (ReferenceFile.FileNames.empty() && !strcmp(File_Item->Value(), "AnnotationText"))) // Annotation contains file name (buggy IMF file) { if (PreviousFileNameIsAnnotationText) ReferenceFile.FileNames.clear(); // Annotation is something else, no need of it if (!strcmp(File_Item->Value(), "AnnotationText")) PreviousFileNameIsAnnotationText=true; ReferenceFile.FileNames.push_back(Ztring().From_UTF8(File_Item->GetText())); string Text=File_Item->GetText(); if (Text.size()>=8 && (Text.find("_cpl.xml")==Text.size()-8) || Text.find("CPL_")==0 && Text.find(".xml")==Text.size()-4) { HasCpl=IsCPL=true; ReferenceFile.StreamKind=Stream_Max; } } } if (IsCPL && CPL_FileName.empty()) for (size_t Pos=0; PosReferences.size()+1; ReferenceFiles->References.push_back(ReferenceFile); } } } } Element_Offset=File_Size; //Getting links between files if (!CPL_FileName.empty() && !Config->File_IsReferenced_Get()) { FileName Directory(File_Name); if (CPL_FileName.find(__T("file://"))==0 && CPL_FileName.find(__T("file:///"))==string::npos) CPL_FileName.erase(0, 7); //TODO: better handling of relative and absolute file naes MediaInfo_Internal MI; MI.Option(__T("File_KeepInfo"), __T("1")); Ztring ParseSpeed_Save=MI.Option(__T("ParseSpeed_Get"), __T("")); Ztring Demux_Save=MI.Option(__T("Demux_Get"), __T("")); MI.Option(__T("ParseSpeed"), __T("0")); MI.Option(__T("Demux"), Ztring()); MI.Option(__T("File_IsReferenced"), __T("1")); size_t MiOpenResult=MI.Open(Directory.Path_Get()+PathSeparator+CPL_FileName); MI.Option(__T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value MI.Option(__T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value if (MiOpenResult && ((IsDcp && MI.Get(Stream_General, 0, General_Format)==__T("DCP CPL")) || (IsImf && MI.Get(Stream_General, 0, General_Format)==__T("IMF CPL")))) { DcpCpl_MergeFromPkl(((File_DcpCpl*)MI.Info)->ReferenceFiles, ReferenceFiles); ReferenceFiles->References=((File_DcpCpl*)MI.Info)->ReferenceFiles->References; } } ReferenceFiles->FilesForStorage=true; //All should be OK... return true; } } //NameSpace #endif //MEDIAINFO_DCP_YES MediaInfoLib/Source/MediaInfo/Multiple/File_DcpPkl.h100777 0 0 3424 12226004262 15631 0/* 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 DCP/IMF Package List files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_DcpPklH #define MediaInfo_File_DcpPklH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { class File__ReferenceFilesHelper; //*************************************************************************** // Class File_DcpPkl //*************************************************************************** class File_DcpPkl : public File__Analyze { public : //Constructor/Destructor File_DcpPkl(); ~File_DcpPkl(); private : //Streams management void Streams_Finish (); //Buffer - Global #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK //Buffer - File header bool FileHeader_Begin(); //Temp File__ReferenceFilesHelper* ReferenceFiles; bool HasCpl; friend class File_DpcCpl; //Theses classes need access to internal structure for optimization. There is recursivity with theses formats }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Dpg.cpp100777 0 0 15207 12226004262 15543 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Format: // * File header // * MPEG Audio stream // * MPEG Video stream // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DPG_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Dpg.h" #if defined(MEDIAINFO_MPEGV_YES) #include "MediaInfo/Video/File_Mpegv.h" #endif #if defined(MEDIAINFO_MPEGA_YES) #include "MediaInfo/Audio/File_Mpega.h" #endif //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Dpg::File_Dpg() { //Data Parser=NULL; } //--------------------------------------------------------------------------- File_Dpg::~File_Dpg() { delete Parser; //Parser=NULL; } //*************************************************************************** // Buffer - File offset //*************************************************************************** //--------------------------------------------------------------------------- bool File_Dpg::FileHeader_Begin() { //Element_Size if (Buffer_Size<0x14) return false; //Must wait for more data if ( CC4(Buffer )!=0x44504730 //"DPG0" || LittleEndian2int32u(Buffer+0x10)!=0) //Zero { Reject("DPG"); return false; } //All should be OK... return true; } //--------------------------------------------------------------------------- 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(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Dpg::Read_Buffer_Unsynched() { if (Parser) Parser->Open_Buffer_Unsynch(); } //--------------------------------------------------------------------------- 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_SizeStatus[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_SizeStatus[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 } } //NameSpace #endif //MEDIAINFO_DPG_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Dpg.h100777 0 0 3077 12226004262 15172 0/* 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 DPG (Nintendo DS) files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_DpgH #define MediaInfo_File_DpgH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Dpg //*************************************************************************** class File_Dpg : public File__Analyze { public : //Constructor/Destructor File_Dpg(); ~File_Dpg(); private : //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse(); //Buffer void Read_Buffer_Unsynched(); void Read_Buffer_Continue(); //Elements void Audio(); void Video(); //Data File__Analyze* Parser; //Temp int32u Audio_Offset; int32u Audio_Size; int32u Video_Offset; int32u Video_Size; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_DvDif.cpp100777 0 0 206512 12242442306 16051 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DVDIF_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_DvDif.h" #if defined(MEDIAINFO_EIA608_YES) #include "MediaInfo/Text/File_Eia608.h" #endif #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #if MEDIAINFO_SEEK #include "MediaInfo/MediaInfo_Internal.h" #endif //MEDIAINFO_SEEK //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- const char* Dv_sct[]= { "Header", "Subcode", "VAUX", "Audio", "Video", "", "", "", }; //--------------------------------------------------------------------------- const char* Dv_Ssyb_Pc0(int8u Pc0) { switch (Pc0) { case 0x13 : return "Timecode"; case 0x14 : return "Binary group"; case 0x50 : case 0x60 : return "Source"; case 0x51 : case 0x61 : return "Source control"; default : return ""; } } //--------------------------------------------------------------------------- const char* Dv_Disp[]= { "4/3", //S306M, S314M "16/9", //S306M "16/9", //S306M, S314M "4/3", //Which spec? "", "", "", "16/9 or 4/3 depends of ssyb AP3", //Which spec? }; //--------------------------------------------------------------------------- const int32u Dv_Audio_SamplingRate[]= { 48000, 44100, 32000, 0, 0, 0, 0, 0, }; //--------------------------------------------------------------------------- const char* Dv_StereoMode[]= { "Multi-Stero", "Lumped", }; //--------------------------------------------------------------------------- const int32u Dv_Audio_BitDepth[]= { 16, 12, 0, 0, 0, 0, 0, 0, }; //--------------------------------------------------------------------------- const int8u Dv_ChannelsPerBlock[]= { 1, 2, 0, 0, }; //--------------------------------------------------------------------------- const char* Dv_Pair[]= { "One pair of channels", "Independent channels", }; //--------------------------------------------------------------------------- const char* Dv_CopyGenerationManagementSystem[]= { "Unrestricted", "Not used", "One generation only", "No copy", }; //--------------------------------------------------------------------------- const char* Dv_InputType[]= { "Analog", "Digital", "Reserved", "No information", }; //--------------------------------------------------------------------------- const char* Dv_CompressionTimes[]= { "Once", "Twice", "Three+", "No information", }; //--------------------------------------------------------------------------- const char* Dv_Emphasis[]= { "Enphasis off", "Enphasis on", "Reserved", "Reserved", }; //--------------------------------------------------------------------------- const char* Dv_consumer_camera_1_ae_mode[]= { "full automatic", "gain priority mode", "shutter priority mode", "iris priority mode", "manual", "", "", "", "", "", "", "", "", "", "", "", //no info }; //--------------------------------------------------------------------------- const char* Dv_consumer_camera_1_wb_mode[]= { "automatic", "hold", "one push", "pre-set", "", "", "", "", //no info }; //--------------------------------------------------------------------------- const char* Dv_consumer_camera_1_white_balance(int8u white_balance) { switch (white_balance) { case 0x00 : return "candle"; case 0x01 : return "incandescent lamp"; case 0x02 : return "low color temperature; florescent lamp"; case 0x03 : return "high color temperature; florescent lamp"; case 0x04 : return "sunlight"; case 0x05 : return "cloudy weather"; case 0x1F : return ""; //No info default : return ""; } } //--------------------------------------------------------------------------- const char* Dv_consumer_camera_1_fcm[]= { "auto focus", "manual focus", }; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_DvDif::File_DvDif() :File__Analyze() { //Configuration ParserName=__T("DV"); MustSynchronize=true; Buffer_TotalBytes_FirstSynched_Max=64*1024; //In Frame_Count_Valid=2; AuxToAnalyze=0x00; //No Aux to analyze IgnoreAudio=false; //Temp FrameSize_Theory=0; Duration=0; TimeCode_FirstFrame_ms=(int64u)-1; Synched_Test_Reset(); DSF_IsValid=false; APT=0xFF; //Impossible video_source_stype=0xFF; audio_source_stype=0xFF; ssyb_AP3=0xFF; TF1=false; //Valid by default, for direct analyze TF2=false; //Valid by default, for direct analyze TF3=false; //Valid by default, for direct analyze system=false; FSC_WasSet=false; FSP_WasNotSet=false; video_sourcecontrol_IsParsed=false; audio_locked=false; #if MEDIAINFO_SEEK Duration_Detected=false; #endif //MEDIAINFO_SEEK #ifdef MEDIAINFO_DVDIF_ANALYZE_YES Analyze_Activated=false; video_source_Detected=false; Speed_FrameCount=0; Speed_FrameCount_Video_STA_Errors=0; Speed_FrameCount_Audio_Errors.resize(8); Speed_FrameCount_Timecode_Incoherency=0; Speed_FrameCount_Contains_NULL=0; Speed_Contains_NULL=0; Speed_FrameCount_Arb_Incoherency=0; Speed_FrameCount_Stts_Fluctuation=0; System_IsValid=false; Frame_AtLeast1DIF=false; QU=(int8u)-1; CH_IsPresent.resize(8); Speed_TimeCode_IsValid=false; Speed_Arb_IsValid=false; Mpeg4_stts=NULL; Mpeg4_stts_Pos=0; Stats.resize(10); Stats_Total=0; Stats_Total_WithoutArb=0; Stats_Total_AlreadyDetected=false; #endif //MEDIAINFO_DVDIF_ANALYZE_YES } //--------------------------------------------------------------------------- File_DvDif::~File_DvDif() { for (size_t Pos=0; PosFile_DvDif_DisableAudioIfIsInContainer_Get()) for (size_t Pos=0; Pos::iterator Info=Streams_Audio[Pos]->Infos.begin(); Info!=Streams_Audio[Pos]->Infos.end(); ++Info) Fill(Stream_Audio, StreamPos_Last, Info->first.c_str(), Info->second, true); Fill(Stream_Audio, StreamPos_Last, Audio_BitRate_Encoded, 0); } if (Stream_BitRateFromContainer && Retrieve(Stream_Video, 0, Video_BitRate).empty()) { if (Stream_BitRateFromContainer>=28800000*0.98 && Stream_BitRateFromContainer<=28800000*1.02) { Fill(Stream_Video, 0, Video_BitRate, ((float64)28800000)*134/150*76/80, 0); Fill(Stream_Video, 0, Video_BitRate_Encoded, 28800000); } if (Stream_BitRateFromContainer>=57600000*0.98 && Stream_BitRateFromContainer<=57600000*1.02) { Fill(Stream_Video, 0, Video_BitRate, ((float64)57600000)*134/150*76/80, 0); Fill(Stream_Video, 0, Video_BitRate_Encoded, 57600000); } if (Stream_BitRateFromContainer>=115200000*0.98 && Stream_BitRateFromContainer<=115200000*1.02) { Fill(Stream_Video, 0, Video_BitRate, ((float64)115200000)*134/150*76/80, 0); Fill(Stream_Video, 0, Video_BitRate_Encoded, 115200000); } } //Library settings Fill(Stream_Video, 0, Video_Encoded_Library_Settings, Encoded_Library_Settings); //Profile if (FSC_WasSet || IsHd) { if (FSP_WasNotSet || IsHd) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, "DVCPRO HD"); Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "DVCPRO HD"); Clear(Stream_Video, 0, Video_BitDepth); //MXF files say that DVCPRO HD streams are 8 or 10 bits, exact? } else { Fill(Stream_General, 0, General_Format_Commercial_IfAny, "DVCPRO 50"); Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "DVCPRO 50"); Fill(Stream_Video, 0, Video_BitRate_Mode, "CBR"); } } else if (audio_locked || (Retrieve(Stream_Video, 0, Video_Standard)==__T("PAL") && Retrieve(Stream_Video, 0, Video_Colorimetry)==__T("4:1:1"))) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, "DVCPRO"); Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "DVCPRO"); Fill(Stream_Video, 0, Video_BitRate_Mode, "CBR"); } else Fill(Stream_Video, 0, Video_BitRate_Mode, "CBR"); //Delay if (TimeCode_FirstFrame_ms!=(int64u)-1) { Fill(Stream_Video, 0, Video_Delay, TimeCode_FirstFrame_ms); if (TimeCode_FirstFrame.size()==11) Fill(Stream_Video, 0, Video_Delay_DropFrame, TimeCode_FirstFrame[8]==';'?"Yes":"No"); Fill(Stream_Video, 0, Video_Delay_Source, "Stream"); Fill(Stream_Video, 0, Video_TimeCode_FirstFrame, TimeCode_FirstFrame.c_str()); Fill(Stream_Video, 0, Video_TimeCode_Source, "Subcode time code"); for (size_t Pos=0; PosStatus[IsAccepted]) { Finish(CC_Parsers[Pos]); for (size_t Pos2=0; Pos2Count_Get(Stream_Text); Pos2++) { Stream_Prepare(Stream_Text); Merge(*CC_Parsers[Pos], Stream_Text, Pos2, StreamPos_Last); Fill(Stream_Text, StreamPos_Last, Text_ID, CC_Parsers[Pos]->Retrieve(Stream_Text, Pos2, Text_ID), true); } } #endif //defined(MEDIAINFO_EIA608_YES) } //--------------------------------------------------------------------------- void File_DvDif::Streams_Finish() { if (!Recorded_Date_Date.empty()) { Ztring Recorded_Date(Recorded_Date_Date); if (Recorded_Date_Time.size()>4) { Recorded_Date+=__T(" "); Recorded_Date+=Recorded_Date_Time; } if (Count_Get(Stream_General)==0) Stream_Prepare(Stream_General); Fill(Stream_General, 0, General_Recorded_Date, Recorded_Date, true); } if (!IsSub && Duration) Fill(Stream_General, 0, General_Duration, Duration); #ifdef MEDIAINFO_DVDIF_ANALYZE_YES if (Config->File_DvDif_Analysis_Get()) { //Errors stats Status[IsFinished]=true; //We need to fill it before the call to Errors_Stats_Update Errors_Stats_Update(); Errors_Stats_Update_Finnish(); } #endif //MEDIAINFO_DVDIF_ANALYZE_YES } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_DvDif::FileHeader_Begin() { //Must have enough buffer for having header if (Buffer_Size<8) return false; //Must wait for more data //False positives detection: detect some headers from other files, DV parser is not smart enough if (CC4(Buffer)==0x52494646 //RIFF || CC4(Buffer+4)==0x66747970 //ftyp || CC4(Buffer+4)==0x66726565 //free || CC4(Buffer+4)==0x6D646174 //mdat || CC4(Buffer+4)==0x6D6F6F76 //moov || CC4(Buffer+4)==0x736B6970 //skip || CC4(Buffer+4)==0x77696465 //wide || CC4(Buffer)==0x060E2B34) //MXF begin { Finish(); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_DvDif::Synchronize() { if (AuxToAnalyze) { Accept(); return true; } while (Buffer_Offset+8*80<=Buffer_Size //8 blocks && !((Buffer[Buffer_Offset+0*80]&0xE0)==0x00 && (Buffer[Buffer_Offset+0*80+1]&0xF0)==0x00 && Buffer[Buffer_Offset+0*80+2]==0x00 //Header 0 && (Buffer[Buffer_Offset+1*80]&0xE0)==0x20 && (Buffer[Buffer_Offset+1*80+1]&0xF0)==0x00 && Buffer[Buffer_Offset+1*80+2]==0x00 //Subcode 0 && (Buffer[Buffer_Offset+2*80]&0xE0)==0x20 && (Buffer[Buffer_Offset+2*80+1]&0xF0)==0x00 && Buffer[Buffer_Offset+2*80+2]==0x01 //Subcode 1 && (Buffer[Buffer_Offset+3*80]&0xE0)==0x40 && (Buffer[Buffer_Offset+3*80+1]&0xF0)==0x00 && Buffer[Buffer_Offset+3*80+2]==0x00 //VAUX 0 && (Buffer[Buffer_Offset+4*80]&0xE0)==0x40 && (Buffer[Buffer_Offset+4*80+1]&0xF0)==0x00 && Buffer[Buffer_Offset+4*80+2]==0x01 //VAUX 1 && (Buffer[Buffer_Offset+5*80]&0xE0)==0x40 && (Buffer[Buffer_Offset+5*80+1]&0xF0)==0x00 && Buffer[Buffer_Offset+5*80+2]==0x02 //VAUX 2 && (Buffer[Buffer_Offset+6*80]&0xE0)==0x60 && (Buffer[Buffer_Offset+6*80+1]&0xF0)==0x00 && Buffer[Buffer_Offset+6*80+2]==0x00 //Audio 0 && (Buffer[Buffer_Offset+7*80]&0xE0)==0x80 && (Buffer[Buffer_Offset+7*80+1]&0xF0)==0x00 && Buffer[Buffer_Offset+7*80+2]==0x00)) //Video 0 Buffer_Offset++; if (Buffer_Offset+8*80>Buffer_Size) return false; if (!Status[IsAccepted]) Accept(); return true; } //--------------------------------------------------------------------------- bool File_DvDif::Synched_Test() { if (AuxToAnalyze) return true; //Must have enough buffer for having header if (Buffer_Offset+80>Buffer_Size) return false; //NULL blocks if (Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x00 && Buffer[Buffer_Offset+2]==0x00) return true; SCT =(Buffer[Buffer_Offset ]&0xE0)>>5; DBN = Buffer[Buffer_Offset+2]; //DIF Sequence Numbers if (DSF_IsValid) { if (Dseq_Old!=Dseq) { if (Dseq==0 && !(!DSF && Dseq_Old==9) && !( DSF && Dseq_Old==11)) { if (!Status[IsAccepted]) Trusted_IsNot("Wrong order"); else Synched_Test_Reset(); } Dseq_Old=Dseq; } } //DIF Block Numbers if (SCT!=(int8u)-1) { int8u Number=DBN_Olds[SCT]+1; switch (SCT) { case 0 : //Header if (SCT_Old!=4 || DBN!=0) { if (!Status[IsAccepted]) Trusted_IsNot("Wrong order"); else Synched_Test_Reset(); } break; case 1 : //Subcode if (!((DBN==0 && SCT_Old==0) || (DBN!=0 && SCT_Old==1)) || (Number!=DBN && !(Number==2 && DBN==0))) { if (!Status[IsAccepted]) Trusted_IsNot("Wrong order"); else Synched_Test_Reset(); } break; case 2 : //VAUX if (!((DBN==0 && SCT_Old==1) || (DBN!=0 && SCT_Old==2)) || (Number!=DBN && !(Number==3 && DBN==0))) { if (!Status[IsAccepted]) Trusted_IsNot("Wrong order"); else Synched_Test_Reset(); } break; case 3 : //Audio if (!((DBN==0 && SCT_Old==2) || (DBN!=0 && SCT_Old==4)) || (Number!=DBN && !(Number==9 && DBN==0))) { if (!Status[IsAccepted]) Trusted_IsNot("Wrong order"); else Synched_Test_Reset(); } break; case 4 : //Video if (!(SCT_Old==3 || SCT_Old==4) || (Number!=DBN && !(Number==135 && DBN==0))) { if (!Status[IsAccepted]) Trusted_IsNot("Wrong order"); else Synched_Test_Reset(); } break; default: ; } if (SCT!=(int8u)-1) { SCT_Old=SCT; DBN_Olds[SCT]=DBN; } } //We continue return true; } //--------------------------------------------------------------------------- void File_DvDif::Synched_Test_Reset() { //Temp SCT=(int8u)-1; SCT_Old=4; //Video DBN_Olds[0]=0; DBN_Olds[1]=1; //SubCode DBN_Olds[2]=2; //Vaux DBN_Olds[3]=8; //Audio DBN_Olds[4]=134; //Video DBN_Olds[5]=0; DBN_Olds[6]=0; DBN_Olds[7]=0; //Synch Synched=false; } //--------------------------------------------------------------------------- void File_DvDif::Synched_Init() { //FrameInfo if (FrameInfo.DTS==(int64u)-1) FrameInfo.DTS=0; //No DTS in container if (FrameInfo.PTS==(int64u)-1) FrameInfo.PTS=0; //No PTS in container if (Frame_Count_NotParsedIncluded==(int64u)-1) Frame_Count_NotParsedIncluded=0; //No Frame_Count_NotParsedIncluded in the container } //*************************************************************************** // Buffer - Demux //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX bool File_DvDif::Demux_UnpacketizeContainer_Test() { //Must have enough buffer for having header if (Buffer_Offset+8*80>Buffer_Size) return false; if ((Buffer[Buffer_Offset]&0xE0)==0x00 //Speed up the parsing && (CC3(Buffer+Buffer_Offset+0*80)&0xE0FCFF)==0x000400 //Header 0 (with FSC==false and FSP==true) && (CC3(Buffer+Buffer_Offset+1*80)&0xE0F0FF)==0x200000 //Subcode 0 && (CC3(Buffer+Buffer_Offset+2*80)&0xE0F0FF)==0x200001 //Subcode 1 && (CC3(Buffer+Buffer_Offset+3*80)&0xE0F0FF)==0x400000 //VAUX 0 && (CC3(Buffer+Buffer_Offset+4*80)&0xE0F0FF)==0x400001 //VAUX 1 && (CC3(Buffer+Buffer_Offset+5*80)&0xE0F0FF)==0x400002 //VAUX 2 && (CC3(Buffer+Buffer_Offset+6*80)&0xE0F0FF)==0x600000 //Audio 0 && (CC3(Buffer+Buffer_Offset+7*80)&0xE0F0FF)==0x800000) //Video 0 { if (Demux_Offset==0) { Demux_Offset=Buffer_Offset+1; } while (Demux_Offset+8*80<=Buffer_Size //8 blocks && !((Buffer[Demux_Offset]&0xE0)==0x00 //Speed up the parsing && (CC3(Buffer+Demux_Offset+0*80)&0xE0FCFF)==0x000400 //Header 0 (with FSC==false and FSP==true) && (CC3(Buffer+Demux_Offset+1*80)&0xE0F0FF)==0x200000 //Subcode 0 && (CC3(Buffer+Demux_Offset+2*80)&0xE0F0FF)==0x200001 //Subcode 1 && (CC3(Buffer+Demux_Offset+3*80)&0xE0F0FF)==0x400000 //VAUX 0 && (CC3(Buffer+Demux_Offset+4*80)&0xE0F0FF)==0x400001 //VAUX 1 && (CC3(Buffer+Demux_Offset+5*80)&0xE0F0FF)==0x400002 //VAUX 2 && (CC3(Buffer+Demux_Offset+6*80)&0xE0F0FF)==0x600000 //Audio 0 && (CC3(Buffer+Demux_Offset+7*80)&0xE0F0FF)==0x800000)) //Video 0 Demux_Offset++; if (Demux_Offset+8*80>Buffer_Size && File_Offset+Buffer_Size!=File_Size) return false; //No complete frame if (Demux_Offset+8*80>Buffer_Size && File_Offset+Buffer_Size==File_Size) Demux_Offset=(size_t)(File_Size-File_Offset); //Using the complete buffer (no next sync) Demux_UnpacketizeContainer_Demux(); } return true; } #endif //MEDIAINFO_DEMUX //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_DvDif::Read_Buffer_Unsynched() { Synched_Test_Reset(); if (!IsSub && File_GoTo!=(int64u)-1 && (Frame_Count #if MEDIAINFO_SEEK || Duration_Detected #endif //MEDIAINFO_SEEK ) && !FSP_WasNotSet) { int64u BytesPerFrame=12000*(DSF?12:10); if (FSC_WasSet) BytesPerFrame*=2; Frame_Count_NotParsedIncluded=File_GoTo/BytesPerFrame; FrameInfo.PTS=FrameInfo.DTS=float64_int64s(Frame_Count_NotParsedIncluded/(DSF?25.000:(30.000*1000/1001))*1000000000); } } //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_DvDif::Read_Buffer_Seek (size_t Method, int64u Value, int64u /*ID*/) { //Init if (!Duration_Detected) { MediaInfo_Internal MI; MI.Option(__T("File_KeepInfo"), __T("1")); Ztring ParseSpeed_Save=MI.Option(__T("ParseSpeed_Get"), __T("")); Ztring Demux_Save=MI.Option(__T("Demux_Get"), __T("")); MI.Option(__T("ParseSpeed"), __T("0")); MI.Option(__T("Demux"), Ztring()); size_t MiOpenResult=MI.Open(File_Name); MI.Option(__T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value MI.Option(__T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value if (!MiOpenResult || MI.Get(Stream_General, 0, General_Format)!=__T("DV")) return 0; TotalFrames=Ztring(MI.Get(Stream_Video, 0, Video_FrameCount)).To_int64u(); int64u VideoBitRate=Ztring(MI.Get(Stream_Video, 0, Video_BitRate)).To_int64u(); if (VideoBitRate==0 || VideoBitRate>=50000000) { FSC_WasSet=true; FSP_WasNotSet=true; } else if (VideoBitRate>=30000000) FSC_WasSet=true; float32 FrameRate=Ztring(MI.Get(Stream_Video, 0, Video_FrameRate)).To_float32(); if (FrameRate>=24.0 && FrameRate<26.0) DSF=system=true; if (FrameRate>=29.0 && FrameRate<31.0) DSF=system=false; Duration_Detected=true; } //Parsing switch (Method) { case 0 : GoTo(Value); Open_Buffer_Unsynch(); return 1; case 1 : GoTo(File_Size*Value/10000); Open_Buffer_Unsynch(); return 1; case 2 : //Timestamp { //We transform TimeStamp to a frame number Value=float64_int64s(((float64)Value)*(DSF?25.000:(30.000*1000/1001))/1000000000); } //No break; case 3 : //FrameNumber if (!FSP_WasNotSet) { int64u BytesPerFrame=12000*(DSF?12:10); if (FSC_WasSet) BytesPerFrame*=2; GoTo(BytesPerFrame*Value); Open_Buffer_Unsynch(); Frame_Count_NotParsedIncluded=Value; FrameInfo.PTS=FrameInfo.DTS=float64_int64s(Frame_Count_NotParsedIncluded/(DSF?25.000:(30.000*1000/1001))*1000000000); return 1; } else return (size_t)-1; //Not supported default : return (size_t)-1; //Not supported } } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- void File_DvDif::Header_Parse() #if MEDIAINFO_TRACE { if (AuxToAnalyze!=0x00) { SCT=(int8u)-1; Header_Fill_Code(AuxToAnalyze, Ztring::ToZtring(AuxToAnalyze, 16)); Header_Fill_Size(4); return; } //Unsynch problems if (Element_Size<80) { Element_WaitForMoreData(); return; } if (Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x00 && Buffer[Buffer_Offset+2]==0x00) { SCT=(int8u)-1; Header_Fill_Code((int64u)-1); Header_Fill_Size(80); return; } //Parsing BS_Begin(); //0 Get_S1 (3, SCT, "SCT - Section Type"); Param_Info1(Dv_sct[SCT]); Skip_SB( "Res - Reserved"); Skip_S1(4, "Arb - Arbitrary bits"); //1 Get_S1 (4, Dseq, "Dseq - DIF sequence number"); //0-9 for 525/60; 0-11 for 625/50 Get_SB ( FSC, "FSC - Channel number"); Get_SB ( FSP, "FSP - Channel number"); //SMPTE 370M only Skip_S1(2, "Res - Reserved"); BS_End(); //2 Get_B1 (DBN, "DBN - DIF block number"); //Video: 0-134, Audio: 0-8 Header_Fill_Code(SCT, Dv_sct[SCT]); Header_Fill_Size(80); } #else //MEDIAINFO_TRACE { if (AuxToAnalyze!=0x00) { SCT=(int8u)-1; Header_Fill_Code(AuxToAnalyze); Header_Fill_Size(4); return; } //Unsynch problems if (Element_Size<80) { Element_WaitForMoreData(); return; } if (Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x00 && Buffer[Buffer_Offset+2]==0x00) { SCT=(int8u)-1; Header_Fill_Code((int64u)-1); Header_Fill_Size(80); return; } //Parsing SCT =(Buffer[Buffer_Offset ]&0xE0)>>5; Dseq=(Buffer[Buffer_Offset+1]&0xF0)>>4; FSC =(Buffer[Buffer_Offset+1]&0x08)==0x08; FSP =(Buffer[Buffer_Offset+1]&0x04)==0x04; DBN = Buffer[Buffer_Offset+2]; Element_Offset+=3; Header_Fill_Code(SCT); Header_Fill_Size(80); } #endif //MEDIAINFO_TRACE //--------------------------------------------------------------------------- void File_DvDif::Data_Parse() { if (Element_Code==(int64u)-1) { Skip_XX(Element_Size, "Junk"); return; } //Config if (SCT!=(int8u)-1) { if (!FSC_WasSet && FSC) FSC_WasSet=true; if (!FSP_WasNotSet && !FSP) FSP_WasNotSet=true; } if (AuxToAnalyze!=0x00) { Element(); return; } Element_Info1(DBN); switch (SCT) { case 0 : Header(); break; case 1 : Subcode(); break; case 2 : VAUX(); break; case 3 : Audio(); break; case 4 : Video(); break; default: Skip_XX(Element_Size, "Unknown"); } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_DvDif::Header() #if MEDIAINFO_TRACE { BS_Begin(); //3 Get_SB ( DSF, "DSF - DIF Sequence Flag"); //0=NTSC, 1=PAL Skip_SB( "Zero"); Skip_S1(6, "Reserved"); //4 Skip_S1(5, "Reserved"); Get_S1 (3, APT, "APT"); //Track application ID, 0=4:2:0, 1=not 4:2:0 //5 Get_SB ( TF1, "TF1 - Audio data is not valid"); Skip_S1(4, "Reserved"); Skip_S1(3, "AP1 - Audio application ID"); //6 Get_SB ( TF2, "TF2 - Video data is not valid"); Skip_S1(4, "Reserved"); Skip_S1(3, "AP2 - Video application ID"); //7 Get_SB ( TF3, "TF3 - Subcode is not valid"); Skip_S1(4, "Reserved"); Skip_S1(3, "AP3 - Subcode application ID"); //8-79 BS_End(); Skip_XX(72, "Reserved"); //Should be filled with 0xFF if (Config->File_DvDif_IgnoreTransmittingFlags_Get()) { TF1=false; TF2=false; TF3=false; } FILLING_BEGIN(); DSF_IsValid=true; Dseq_Old=DSF?11:9; FrameSize_Theory=(DSF?12:10)*150*80; //12 DIF sequences for PAL, 10 for NTSC if (TF1 && TF2) { //This is not logic, the header says no audio and no video! We do not trust the header, resetting all TF1=false; TF2=false; TF3=false; } FILLING_END(); } #else //MEDIAINFO_TRACE { if (Element_Size<77) { Trusted_IsNot("Size is wrong"); return; } DSF=(Buffer[Buffer_Offset ]&0x80)?true:false; APT=(Buffer[Buffer_Offset+1]&0x07); TF1=(Buffer[Buffer_Offset+2]&0x80)?true:false; TF2=(Buffer[Buffer_Offset+3]&0x80)?true:false; TF3=(Buffer[Buffer_Offset+4]&0x80)?true:false; if (Config->File_DvDif_IgnoreTransmittingFlags_Get()) { TF1=false; TF2=false; TF3=false; } FILLING_BEGIN(); DSF_IsValid=true; Dseq_Old=DSF?11:9; FrameSize_Theory=(DSF?12:10)*150*80; //12 DIF sequences for PAL, 10 for NTSC if (TF1 && TF2) { //This is not logic, the header says no audio and no video! We do not trust the header, resetting all TF1=false; TF2=false; TF3=false; } FILLING_END(); } #endif //MEDIAINFO_TRACE //--------------------------------------------------------------------------- void File_DvDif::Subcode() #if MEDIAINFO_TRACE { //Present? if (TF3) { Skip_XX(Element_Size, "Unused"); return; } //Parsing for (int8u syb_num=0; syb_num<6; syb_num++) Subcode_Ssyb(syb_num); Skip_XX(29, "Unused"); } #else //MEDIAINFO_TRACE { if (TF3) return; for (int8u syb_num=0; syb_num<6; syb_num++) Subcode_Ssyb(syb_num); } #endif //MEDIAINFO_TRACE //--------------------------------------------------------------------------- void File_DvDif::Subcode_Ssyb(int8u syb_num) { Element_Begin1("ssyb"); //Parsing BS_Begin(); //ID0-ID1 Skip_SB( "FR - Identification of half of channel"); //1=first half, 0=second if (syb_num==0) { if (FSC==false) Get_S1 ( 3, ssyb_AP3, "AP3 - Subcode application ID"); else Skip_S1( 3, "AP3 - Subcode application ID"); } else if (DBN==1 && syb_num==5) Skip_S1(3, "APT - track application ID"); else Skip_S1(3, "Res - Reserved"); Skip_S1(8, "Arb - Arbitrary bits"); Skip_S1(4, "Syb - SSYSB number"); BS_End(); //FFh Skip_B1( "0xFF"); //PC0-PC4 Element(); Element_End0(); } //--------------------------------------------------------------------------- void File_DvDif::VAUX() { //Present? if (TF2) { Skip_XX(Element_Size, "Unused"); return; } //Parsing for (int8u i=0; i<15; i++) Element(); Skip_XX(2, "Unused"); } //--------------------------------------------------------------------------- void File_DvDif::Audio() { //Present? if (TF1) { Skip_XX(Element_Size, "Unused"); return; } Element_Name("Audio"); Element(); //First 5 bytes Skip_XX(Element_Size-Element_Offset, "Unknown"); } //--------------------------------------------------------------------------- void File_DvDif::Video() { #if MEDIAINFO_TRACE //Present? if (TF2) { Skip_XX(Element_Size, "Unused"); return; } Element_Name("Video"); //Parsing BS_Begin(); Skip_S1(4, "STA"); Skip_S1(4, "QNO"); BS_End(); Skip_XX(Element_Size-Element_Offset, "Unknown"); #endif //MEDIAINFO_TRACE FILLING_BEGIN(); if (DBN==134 && video_source_stype!=(int8u)-1) { if (!Status[IsAccepted]) { Accept("DV DIF"); if (!IsSub) Fill(Stream_General, 0, General_Format, "DV"); } if (!Status[IsFilled] && Frame_Count>=Frame_Count_Valid) #ifdef MEDIAINFO_DVDIF_ANALYZE_YES { if (Config->File_DvDif_Analysis_Get()) Fill("DV DIF"); else Finish("DV DIF"); } #else //MEDIAINFO_DVDIF_ANALYZE_YES Finish("DV DIF"); #endif //MEDIAINFO_DVDIF_ANALYZE_YES } FILLING_END(); } //--------------------------------------------------------------------------- void File_DvDif::Element() { Element_Begin0(); int8u PackType; if (AuxToAnalyze==0x00) Get_B1 (PackType, "Pack Type"); else PackType=AuxToAnalyze; //Forced by parser switch(PackType) { case 0x13 : timecode(); break; case 0x14 : binary_group(); break; case 0x50 : audio_source(); break; case 0x51 : audio_sourcecontrol(); break; case 0x52 : audio_recdate(); break; case 0x53 : audio_rectime(); break; case 0x60 : video_source(); break; case 0x61 : video_sourcecontrol(); break; case 0x62 : video_recdate(); break; case 0x63 : video_rectime(); break; case 0x65 : closed_captions(); break; case 0x70 : consumer_camera_1(); break; case 0x71 : consumer_camera_2(); break; case 0xFF : Element_Name(Ztring().From_Number(PackType, 16)); Skip_B4( "Unused"); break; default : Element_Name(Ztring().From_Number(PackType, 16)); Skip_B4( "Unknown"); } Element_End0(); } //--------------------------------------------------------------------------- void File_DvDif::binary_group() { Element_Name("binary_group"); if (Buffer[Buffer_Offset+(size_t)Element_Offset ]==0xFF && Buffer[Buffer_Offset+(size_t)Element_Offset+1]==0xFF && Buffer[Buffer_Offset+(size_t)Element_Offset+2]==0xFF && Buffer[Buffer_Offset+(size_t)Element_Offset+3]==0xFF ) { Skip_XX(4, "All one"); return; } //Parsing BS_Begin(); Skip_S1(4, "Binary group 2"); Skip_S1(4, "Binary group 1"); Skip_S1(4, "Binary group 4"); Skip_S1(4, "Binary group 3"); Skip_S1(4, "Binary group 6"); Skip_S1(4, "Binary group 5"); Skip_S1(4, "Binary group 8"); Skip_S1(4, "Binary group 7"); BS_End(); } //--------------------------------------------------------------------------- void File_DvDif::timecode() { Element_Name("timecode"); if (Buffer[Buffer_Offset+(size_t)Element_Offset ]==0x00 && Buffer[Buffer_Offset+(size_t)Element_Offset+1]==0x00 && Buffer[Buffer_Offset+(size_t)Element_Offset+2]==0x00 && Buffer[Buffer_Offset+(size_t)Element_Offset+3]==0x00 ) { Skip_XX(4, "All zero"); return; } //Parsing int8u Frames_Units, Frames_Tens, Seconds_Units, Seconds_Tens, Minutes_Units, Minutes_Tens, Hours_Units, Hours_Tens; int64u MilliSeconds=0; int8u Frames=0; bool DropFrame=false; BS_Begin(); Skip_SB( "CF - Color fame"); if (!DSF_IsValid) Skip_SB( "Arbitrary bit or DP"); else if (DSF) //625/50 Skip_SB( "Arbitrary bit"); else //525/60 Get_SB (DropFrame, "DP - Drop frame"); //525/60 Get_S1 (2, Frames_Tens, "Frames (Tens)"); Frames+=Frames_Tens*10; Get_S1 (4, Frames_Units, "Frames (Units)"); Frames+=Frames_Units; if (!DSF_IsValid) Skip_SB( "BGF0 or PC"); else if (DSF) //625/50 Skip_SB( "BGF0 - Binary group flag"); else //525/60 Skip_SB( "PC - Biphase mark polarity correction"); //0=even; 1=odd Get_S1 (3, Seconds_Tens, "Seconds (Tens)"); MilliSeconds+=Seconds_Tens*10*1000; Get_S1 (4, Seconds_Units, "Seconds (Units)"); MilliSeconds+=Seconds_Units*1000; if (!DSF_IsValid) Skip_SB( "BGF2 or BGF0"); else if (DSF) //625/50 Skip_SB( "BGF2 - Binary group flag"); else //525/60 Skip_SB( "BGF0 - Binary group flag"); Get_S1 (3, Minutes_Tens, "Minutes (Tens)"); MilliSeconds+=Minutes_Tens*10*60*1000; Get_S1 (4, Minutes_Units, "Minutes (Units)"); MilliSeconds+=Minutes_Units*60*1000; if (!DSF_IsValid) Skip_SB( "PC or BGF1"); else if (DSF) //625/50 Skip_SB( "PC - Biphase mark polarity correction"); //0=even; 1=odd else //525/60 Skip_SB( "BGF1 - Binary group flag"); Skip_SB( "BGF2 - Binary group flag"); Get_S1 (2, Hours_Tens, "Hours (Tens)"); MilliSeconds+=Hours_Tens*10*60*60*1000; Get_S1 (4, Hours_Units, "Hours (Units)"); MilliSeconds+=Hours_Units*60*60*1000; Element_Info1(Ztring().Duration_From_Milliseconds(MilliSeconds+((DSF_IsValid && Frames!=45)?((int64u)(Frames/(DSF?25.000:29.970)*1000)):0))); BS_End(); if (TimeCode_FirstFrame_ms==(int64u)-1 && MilliSeconds!=167185000) //if all bits are set to 1, this is not a valid timestamp { TimeCode_FirstFrame_ms=MilliSeconds; if (DSF_IsValid && Frames!=45) //all bits are set to 1 TimeCode_FirstFrame_ms+=(int64u)(Frames/(DSF?25.000:29.970)*1000); TimeCode_FirstFrame+=('0'+Hours_Tens); TimeCode_FirstFrame+=('0'+Hours_Units); TimeCode_FirstFrame+=':'; TimeCode_FirstFrame+=('0'+Minutes_Tens); TimeCode_FirstFrame+=('0'+Minutes_Units); TimeCode_FirstFrame+=':'; TimeCode_FirstFrame+=('0'+Seconds_Tens); TimeCode_FirstFrame+=('0'+Seconds_Units); TimeCode_FirstFrame+=DropFrame?';':':'; TimeCode_FirstFrame+=('0'+Frames_Tens); TimeCode_FirstFrame+=('0'+Frames_Units); } } //--------------------------------------------------------------------------- void File_DvDif::audio_source() { if (TF1) { Skip_XX(4, "Unused"); return; } Element_Name("audio_source"); int8u SamplingRate, Resolution; BS_Begin(); //PC1 Get_SB ( audio_locked, "LF - Locked mode"); Skip_SB( "Reserved"); Skip_S1(6, "AF - Samples in this frame"); //PC2 Info_S1(1, StereoMode, "SM - Stereo mode"); Param_Info1(Dv_StereoMode[StereoMode]); Info_S1(2, ChannelsPerBlock, "CHN - Channels per block"); Param_Info1(Dv_ChannelsPerBlock[ChannelsPerBlock]); Info_S1(1, Pair, "PA - Pair"); Param_Info1(Dv_Pair[Pair]); Skip_S1(4, "AM - Audio mode"); Skip_SB( "Reserved"); Skip_SB( "ML - Multi-language"); Skip_SB( "50/60"); Get_S1 (5, audio_source_stype, "STYPE - audio blocks per video frame"); Param_Info1(audio_source_stype==0?"2 channels":(audio_source_stype==2?"4 channels":"Unknown")); //0=25 Mbps, 2=50 Mbps Skip_SB( "EF - Emphasis off"); Skip_SB( "TC - Time constant of emphasis"); Get_S1 (3, SamplingRate, "SMP - Sampling rate"); Param_Info1(Dv_Audio_SamplingRate[SamplingRate]); Get_S1 (3, Resolution, "QU - Resolution"); Param_Info1(Dv_Audio_BitDepth[Resolution]); BS_End(); FILLING_BEGIN(); if (!IgnoreAudio && Streams_Audio.empty() && Dv_Audio_SamplingRate[SamplingRate] && Dv_Audio_BitDepth[Resolution]) { //Calculating the count of audio size_t Audio_Count=1; if (audio_source_stype==2 || (Resolution==1 && SamplingRate==2)) //stype=2 or (Resolution=12 bits and SamplingRate=32 KHz) Audio_Count=2; if (audio_source_stype==3) Audio_Count=4; //Filling if (Streams_Audio.size()Infos["ID"].From_Number(Pos); Streams_Audio[Pos]->Infos["Format"]=__T("PCM"); Streams_Audio[Pos]->Infos["Codec"]=__T("PCM"); Streams_Audio[Pos]->Infos["BitRate_Mode"]=__T("CBR"); Streams_Audio[Pos]->Infos["Channel(s)"].From_Number(audio_source_stype==3?1:2); Streams_Audio[Pos]->Infos["SamplingRate"].From_Number(Dv_Audio_SamplingRate[SamplingRate]); Streams_Audio[Pos]->Infos["BitDepth"].From_Number(Dv_Audio_BitDepth[Resolution]); Streams_Audio[Pos]->Infos["BitRate"].From_Number((audio_source_stype==3?1:2)*Dv_Audio_SamplingRate[SamplingRate]*Dv_Audio_BitDepth[Resolution]); } } FILLING_END(); } //--------------------------------------------------------------------------- void File_DvDif::audio_sourcecontrol() { if (TF1) { Skip_XX(4, "Unused"); return; } Element_Name("audio_control"); BS_Begin(); //PC1 Info_S1(2, CopyGenerationManagementSystem, "CGMS - Copy generation management system"); Param_Info1(Dv_CopyGenerationManagementSystem[CopyGenerationManagementSystem]); Info_S1(2, InputType, "ISR - Input type"); Param_Info1(Dv_InputType[InputType]); Info_S1(2, CompressionTimes, "CMP - Compression times"); Param_Info1(Dv_CompressionTimes[CompressionTimes]); Info_S1(2, Emphasis, "EFC - Emphasis"); Param_Info1(Dv_Emphasis[Emphasis]); //PC2 Skip_SB( "REC S Non-recording start point"); Skip_SB( "REC E - Non-recording end point"); Skip_SB( "FADE S - Recording mode"); //1=Original Skip_SB( "FADE E - Unknown"); Skip_SB( "Reserved"); Skip_SB( "Reserved"); Skip_SB( "Reserved"); Skip_SB( "Reserved"); //PC3 Skip_SB( "DRF - Direction"); //1=Forward Skip_S1(7, "SPD - Speed"); //PC4 Skip_SB( "Reserved"); Skip_S1(7, "GEN - Category"); BS_End(); } //--------------------------------------------------------------------------- void File_DvDif::audio_recdate() { if (TF1) { Skip_XX(4, "Unused"); return; } Element_Name("audio_recdate"); recdate(); } //--------------------------------------------------------------------------- void File_DvDif::audio_rectime() { if (TF1) { Skip_XX(4, "Unused"); return; } Element_Name("audio_rectime"); rectime(); } //--------------------------------------------------------------------------- void File_DvDif::video_source() { if (TF2) { Skip_XX(4, "Unused"); return; } Element_Name("video_source"); BS_Begin(); //PC1 Skip_S1(4, "TVCH (tens of units, 09)"); Skip_S1(4, "TVCH (units, 09)"); //PC2 Skip_SB( "B/W - Black and White"); //0=Black and White, 1=Color Skip_SB( "EN - Color Frames is not valid"); Skip_S1(2, "CLF - Color frames id"); Skip_S1(4, "TVCH (hundreds of units, 09)"); //PC3 Skip_S1(2, "SRC"); Get_SB ( system, "50/60 - System"); Get_S1 (5, video_source_stype, "STYPE - Signal type of video signal"); //0=not 4:2:2, 4=4:2:2 //PC4 BS_End(); Skip_B1( "TUN/VISC"); FILLING_BEGIN(); if (FSC==false && FSP==true && Dseq==0) { Frame_Count++; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; FrameInfo.DUR=float64_int64s(((float64)1000000000)/(DSF?25.000:29.970)); if (FrameInfo.DTS!=(int64u)-1) FrameInfo.DTS+=FrameInfo.DUR; if (FrameInfo.PTS!=(int64u)-1) FrameInfo.PTS+=FrameInfo.DUR; } FILLING_END(); } //--------------------------------------------------------------------------- void File_DvDif::video_sourcecontrol() { if (TF2) { Skip_XX(4, "Unused"); return; } Element_Name("video_control"); BS_Begin(); //PC1 Info_S1(2, CopyGenerationManagementSystem, "CGMS - Copy generation management system"); Param_Info1(Dv_CopyGenerationManagementSystem[CopyGenerationManagementSystem]); Skip_S1(2, "ISR"); Skip_S1(2, "CMP"); Skip_S2(2, "SS"); //PC2 Skip_SB( "REC S"); Skip_SB( "Reserved"); Skip_S1(2, "REC M"); Skip_SB( "Reserved"); Get_S1 (3, aspect, "DISP - Aspect ratio"); Param_Info1(Dv_Disp[aspect]); //PC3 Get_SB ( FieldOrder_FF, "FF - Frame/Field"); //1=Frame, 0=Field Get_SB ( FieldOrder_FS, "FS - First/second field"); //0=Field 2, 1=Field 1, if FF=0 x is output twice, if FF=1, Field x fisrst, other second Skip_SB( "FC - Frame Change"); //0=Same picture as before Get_SB ( Interlaced, "IL - Interlaced"); //1=Interlaced Skip_SB( "SF"); Skip_SB( "SC"); Skip_S1(2, "BCS"); //PC4 Skip_SB( "Reserved"); Skip_S1(7, "GEN - Category"); BS_End(); FILLING_BEGIN(); video_sourcecontrol_IsParsed=true; FILLING_END(); } //--------------------------------------------------------------------------- void File_DvDif::video_recdate() { if (TF2) { Skip_XX(4, "Unused"); return; } Element_Name("video_recdate"); Ztring Date=recdate(); if (Recorded_Date_Date.empty()) Recorded_Date_Date=Date; } //--------------------------------------------------------------------------- void File_DvDif::video_rectime() { if (TF2) { Skip_XX(4, "Unused"); return; } Element_Name("video_rectime"); Ztring Date=rectime(); if (Recorded_Date_Time.empty()) Recorded_Date_Time=Date; } //--------------------------------------------------------------------------- void File_DvDif::closed_captions() { Element_Name("closed_captions"); #if defined(MEDIAINFO_EIA608_YES) if (CC_Parsers.empty()) { CC_Parsers.resize(2); for (int8u Pos=0; Pos<2; Pos++) { CC_Parsers[Pos]=new File_Eia608(); ((File_Eia608*)CC_Parsers[Pos])->cc_type=Pos; } Frame_Count_Valid*=10; //More frames } if (Dseq==0) //CC are duplicated for each DIF sequence! { for (size_t Pos=0; Pos<2; Pos++) { Open_Buffer_Init(CC_Parsers[Pos]); Open_Buffer_Continue(CC_Parsers[Pos], 2); } } #else Skip_XX(4, "Captions"); #endif } //--------------------------------------------------------------------------- void File_DvDif::consumer_camera_1() { Element_Name("consumer_camera_1"); //Parsing BS_Begin(); int8u ae_mode, wb_mode, white_balance, fcm; Mark_1_NoTrustError(); Mark_1_NoTrustError(); Skip_S1(6, "iris"); Get_S1 (4, ae_mode, "ae mode"); Param_Info1(Dv_consumer_camera_1_ae_mode[ae_mode]); Skip_S1(4, "agc(Automatic Gain Control)"); Get_S1 (3, wb_mode, "wb mode (white balance mode)"); Param_Info1(Dv_consumer_camera_1_wb_mode[wb_mode]); Get_S1 (5, white_balance, "white balance"); Param_Info1(Dv_consumer_camera_1_white_balance(white_balance)); Get_S1 (1, fcm, "fcm (Focus mode)"); Param_Info1(Dv_consumer_camera_1_fcm[fcm]); Skip_S1(7, "focus (focal point)"); BS_End(); if (Encoded_Library_Settings.empty()) { if (ae_mode<0x0F) Encoded_Library_Settings+=__T("ae mode=")+Ztring(Dv_consumer_camera_1_ae_mode[ae_mode])+__T(" / "); if (wb_mode<0x08) Encoded_Library_Settings+=__T("wb mode=")+Ztring(Dv_consumer_camera_1_wb_mode[wb_mode])+__T(" / "); if (wb_mode<0x1F) Encoded_Library_Settings+=__T("white balance=")+Ztring(Dv_consumer_camera_1_white_balance(white_balance))+__T(" / "); Encoded_Library_Settings+=__T("fcm=")+Ztring(Dv_consumer_camera_1_fcm[fcm]); } } //--------------------------------------------------------------------------- void File_DvDif::consumer_camera_2() { Element_Name("consumer_camera_2"); //Parsing BS_Begin(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Skip_S1(1, "vpd"); Skip_S1(5, "vertical panning speed"); Skip_S1(1, "is"); Skip_S1(1, "hpd"); Skip_S1(6, "horizontal panning speed"); Skip_S1(8, "focal length"); Skip_S1(1, "zen"); Info_S1(3, zoom_U, "units of e-zoom"); Info_S1(4, zoom_D, "1/10 of e-zoom"); /*if (zoom_D!=0xF)*/ Param_Info1(__T("zoom=")+Ztring().From_Number(zoom_U+((float32)zoom_U)/10, 2)); BS_End(); } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- Ztring File_DvDif::recdate() { BS_Begin(); int8u Temp; int16u Year=0; int8u Month=0, Day=0; Skip_S1(8, "Time zone specific"); //ds, tm, tens of time zone, units of time zone, 0xFF for Unknwon Skip_SB( "1"); Skip_SB( "1"); Get_S1 (2, Temp, "Days (Tens)"); Day+=Temp*10; Get_S1 (4, Temp, "Days (Units)"); Day+=Temp; Skip_SB( "1"); Skip_SB( "1"); Skip_SB( "1"); Get_S1 (1, Temp, "Month (Tens)"); Month+=Temp*10; Get_S1 (4, Temp, "Month (Units)"); Month+=Temp; Get_S1 (4, Temp, "Year (Tens)"); Year+=Temp*10; Get_S1 (4, Temp, "Year (Units)"); Year+=Temp; Year+=Year<25?2000:1900; Element_Info1(Ztring::ToZtring(Year)+__T("-")+Ztring::ToZtring(Month)+__T("-")+Ztring::ToZtring(Day)); BS_End(); if (Month>12 || Day>31) return Ztring(); //If all bits are set to 1, this is invalid Ztring MonthString; if (Month<10) MonthString=__T("0"); MonthString+=Ztring::ToZtring(Month); Ztring DayString; if (Day<10) DayString=__T("0"); DayString+=Ztring::ToZtring(Day); return Ztring::ToZtring(Year)+__T("-")+MonthString+__T("-")+DayString; } //--------------------------------------------------------------------------- Ztring File_DvDif::rectime() { if (!DSF_IsValid) { Trusted_IsNot("Not in right order"); return Ztring(); } BS_Begin(); if (Buffer[Buffer_Offset+(size_t)Element_Offset ]==0x00 && Buffer[Buffer_Offset+(size_t)Element_Offset+1]==0x00 && Buffer[Buffer_Offset+(size_t)Element_Offset+2]==0x00 && Buffer[Buffer_Offset+(size_t)Element_Offset+3]==0x00 ) { Skip_XX(4, "All zero"); return Ztring(); } int8u Temp; int64u Time=0; int8u Frames=0; Skip_SB( "Unknown"); Skip_SB( "1"); Get_S1 (2, Temp, "Frames (Tens)"); Frames+=Temp*10; Get_S1 (4, Temp, "Frames (Units)"); Frames+=Temp; if (Temp!=0xF && DSF_IsValid) Time+=(int64u)(Frames/(DSF?25.000:29.970)); Skip_SB( "1"); Get_S1 (3, Temp, "Seconds (Tens)"); Time+=Temp*10*1000; Get_S1 (4, Temp, "Seconds (Units)"); Time+=Temp*1000; Skip_SB( "1"); Get_S1 (3, Temp, "Minutes (Tens)"); Time+=Temp*10*60*1000; Get_S1 (4, Temp, "Minutes (Units)"); Time+=Temp*60*1000; Skip_SB( "1"); Skip_SB( "1"); Get_S1 (2, Temp, "Hours (Tens)"); Time+=Temp*10*60*60*1000; Get_S1 (4, Temp, "Hours (Units)"); Time+=Temp*60*60*1000; Element_Info1(Ztring().Duration_From_Milliseconds(Time)); BS_End(); if (Time!=167185000) return Ztring().Duration_From_Milliseconds(Time); else return Ztring(); //If all bits are set to 1, this is invalid } } //NameSpace #endif //MEDIAINFO_DV_YES MediaInfoLib/Source/MediaInfo/Multiple/File_DvDif.h100777 0 0 22167 12226004262 15475 0/* 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 DV-DIF (DV Digital Interface Format) // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_DvDifH #define MediaInfo_File_DvDifH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_DvDif //*************************************************************************** class File_DvDif : public File__Analyze { public : //In int64u Frame_Count_Valid; int8u AuxToAnalyze; //Only Aux must be parsed bool IgnoreAudio; //Constructor/Destructor File_DvDif(); ~File_DvDif(); protected : //Streams management void Streams_Fill(); void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); //Buffer - Synchro bool Synchronize(); bool Synched_Test(); void Synched_Test_Reset(); void Synched_Init(); //Buffer - Demux #if MEDIAINFO_DEMUX bool Demux_UnpacketizeContainer_Test(); #endif //MEDIAINFO_DEMUX //Buffer - Global #ifdef MEDIAINFO_DVDIF_ANALYZE_YES void Read_Buffer_Continue(); #endif //MEDIAINFO_DVDIF_ANALYZE_YES void Read_Buffer_Unsynched(); #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK //Buffer void Header_Parse(); void Data_Parse(); //Elements - Main void Header(); void Subcode(); void Subcode_Ssyb(int8u syb_num); void VAUX(); void Audio(); void Video(); //Elements - Sub void Element(); void timecode(); void binary_group(); void audio_source(); void audio_sourcecontrol(); void audio_recdate(); void audio_rectime(); void video_source(); void video_sourcecontrol(); void video_recdate(); void video_rectime(); void closed_captions(); void consumer_camera_1(); void consumer_camera_2(); //Helpers Ztring recdate(); Ztring rectime(); //Streams struct stream { std::map Infos; }; std::vector Streams_Audio; //Temp #if defined(MEDIAINFO_EIA608_YES) std::vector CC_Parsers; #endif Ztring Recorded_Date_Date; Ztring Recorded_Date_Time; Ztring Encoded_Library_Settings; string TimeCode_FirstFrame; int64u Duration; int64u TimeCode_FirstFrame_ms; int64u FrameSize_Theory; //The size of a frame int8u SCT; int8u SCT_Old; int8u Dseq; int8u Dseq_Old; int8u DBN; int8u DBN_Olds[8]; int8u video_source_stype; int8u audio_source_stype; bool FSC; bool FSP; bool DSF; bool DSF_IsValid; int8u APT; bool TF1; bool TF2; bool TF3; int8u aspect; int8u ssyb_AP3; bool FieldOrder_FF; bool FieldOrder_FS; bool Interlaced; bool system; bool FSC_WasSet; bool FSP_WasNotSet; bool video_sourcecontrol_IsParsed; bool audio_locked; #if MEDIAINFO_SEEK bool Duration_Detected; int64u TotalFrames; #endif //MEDIAINFO_SEEK #ifdef MEDIAINFO_DVDIF_ANALYZE_YES bool Analyze_Activated; bool video_source_Detected; void Errors_Stats_Update(); void Errors_Stats_Update_Finnish(); Ztring Errors_Stats_03; Ztring Errors_Stats_05; Ztring Errors_Stats_09; Ztring Errors_Stats_10; Ztring Date; Ztring Time; int64u Speed_FrameCount; //Global - Total int64u Speed_FrameCount_Video_STA_Errors; //Global - Error 1 std::vector Speed_FrameCount_Audio_Errors; //Global - Error 2 int64u Speed_FrameCount_Timecode_Incoherency; //Global - Error 3 int64u Speed_FrameCount_Contains_NULL; //Global - Error 4 int64u Speed_Contains_NULL; //Per Frame - Error 4 int64u Speed_FrameCount_Arb_Incoherency; //Global - Error 5 int64u Speed_FrameCount_Stts_Fluctuation; //Global - Error 6 int8u QU; bool QU_FSC; //Validity is with QU bool QU_System; //Validity is with QU bool REC_ST; bool REC_END; bool REC_IsValid; bool System; bool System_IsValid; bool Frame_AtLeast1DIF; struct dvdate { int8u Days; int8u Months; int8u Years; bool MultipleValues; bool IsValid; dvdate() {Clear();} void Clear() { MultipleValues=false; IsValid=false; } }; struct dvtime { struct time { int8u Frames; int8u Seconds; int8u Minutes; int8u Hours; bool DropFrame; time() { Frames=(int8u)-1; Seconds=(int8u)-1; Minutes=(int8u)-1; Hours=(int8u)-1; DropFrame=false; } }; time Time; bool MultipleValues; bool IsValid; dvtime() {Clear();} void Clear() { MultipleValues=false; IsValid=false; } }; dvtime Speed_TimeCode_Last; dvtime Speed_TimeCode_Current; dvtime Speed_TimeCode_Current_Theory; Ztring Speed_TimeCodeZ_First; Ztring Speed_TimeCodeZ_Last; Ztring Speed_TimeCodeZ_Current; bool Speed_TimeCode_IsValid; dvtime Speed_RecTime_Current; dvtime Speed_RecTime_Current_Theory; dvtime Speed_RecTime_Current_Theory2; Ztring Speed_RecTimeZ_First; Ztring Speed_RecTimeZ_Last; Ztring Speed_RecTimeZ_Current; dvdate Speed_RecDate_Current; Ztring Speed_RecDateZ_First; Ztring Speed_RecDateZ_Last; Ztring Speed_RecDateZ_Current; std::vector Video_STA_Errors; //Per STA type std::vector Video_STA_Errors_Total; //Per STA type std::vector Audio_Errors; //Per Dseq std::vector audio_source_IsPresent; std::vector CH_IsPresent; std::vector > Audio_Errors_Total; //Per Channel and Dseq std::vector > Audio_Invalids; //Per Channel and Dseq std::vector > Audio_Invalids_Total; //Per Channel and Dseq struct recZ_Single { int64u FramePos; Ztring Date; Ztring Time; recZ_Single() { FramePos=(int64u)-1; } }; struct recZ { recZ_Single First; recZ_Single Last; }; std::vector Speed_RecZ; struct timeCodeZ_Single { int64u FramePos; Ztring TimeCode; timeCodeZ_Single() { FramePos=(int64u)-1; } }; struct timeCodeZ { timeCodeZ_Single First; timeCodeZ_Single Last; }; std::vector Speed_TimeCodeZ; struct timeStampsZ_Single { int64u FramePos; Ztring Time; Ztring TimeCode; Ztring Date; timeStampsZ_Single() { FramePos=(int64u)-1; } }; struct timeStampsZ { timeStampsZ_Single First; timeStampsZ_Single Last; }; std::vector Speed_TimeStampsZ; struct arb { std::vector Value_Counters; int8u Value; bool MultipleValues; bool IsValid; arb() {Clear();} void Clear() { Value_Counters.clear(); Value_Counters.resize(16); Value=0xF; //Used only when we are sure MultipleValues=false; IsValid=false; } }; arb Speed_Arb_Last; arb Speed_Arb_Current; arb Speed_Arb_Current_Theory; bool Speed_Arb_IsValid; //Stats std::vector Stats; size_t Stats_Total; size_t Stats_Total_WithoutArb; bool Stats_Total_AlreadyDetected; public: //From MPEG-4 container struct stts_part { int64u Pos_Begin; int64u Pos_End; int32u Duration; }; typedef std::vector stts; stts* Mpeg4_stts; size_t Mpeg4_stts_Pos; #endif //MEDIAINFO_DVDIF_ANALYZE_YES }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_DvDif_Analysis.cpp100777 0 0 226235 12226004262 17715 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DVDIF_YES) && defined(MEDIAINFO_DVDIF_ANALYZE_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_DvDif.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Analysis //*************************************************************************** //--------------------------------------------------------------------------- void File_DvDif::Read_Buffer_Continue() { if (!Analyze_Activated) { if (Config->File_DvDif_Analysis_Get()) Analyze_Activated=true; else return; } //Errors stats while (Buffer_Offset+80<=Buffer_Size) { if ((Buffer[Buffer_Offset]&0xE0)==0x00 //SCT=0 (Header) && !(Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x00 && Buffer[Buffer_Offset+2]==0x00)) { Frame_AtLeast1DIF=true; if (!DSF_IsValid) { DSF=(Buffer[Buffer_Offset+3]&0x80)?true:false; DSF_IsValid=true; Dseq_Old=DSF?11:9; } } //Quick search depends of SCT switch(Buffer[Buffer_Offset]&0xE0) { case 0x20 : //SCT=1 (Subcode) { Frame_AtLeast1DIF=true; for (size_t Pos=3*8; Pos<40; Pos+=2*8) { int8u PackType=Buffer[Buffer_Offset+3+Pos+3]; //dv_timecode if (PackType==0x13) //Pack type=0x13 (dv_timecode) { bool DropFrame =( Buffer[Buffer_Offset+3+Pos+3+1]&0x40)?true:false; int8u Frames =((Buffer[Buffer_Offset+3+Pos+3+1]&0x30)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+3+1]&0x0F) ) ; int8u Seconds =((Buffer[Buffer_Offset+3+Pos+3+2]&0x70)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+3+2]&0x0F)) ; int8u Minutes =((Buffer[Buffer_Offset+3+Pos+3+3]&0x70)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+3+3]&0x0F) ) ; int8u Hours =((Buffer[Buffer_Offset+3+Pos+3+4]&0x30)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+3+4]&0x0F) ) ; if (Frames ==0x00 && Seconds==0x00 && Minutes==0x00 && Hours ==0x00 && Buffer[Buffer_Offset+3+Pos+3+1]==0x00 && Buffer[Buffer_Offset+3+Pos+3+2]==0x00 && Buffer[Buffer_Offset+3+Pos+3+3]==0x00 && Buffer[Buffer_Offset+3+Pos+3+4]==0x00 ) { Frames =45; Seconds=85; Minutes=85; Hours =45; } if (Frames !=45 && Seconds!=85 && Minutes!=85 && Hours !=45) //If not disabled { if (Speed_TimeCode_Current.IsValid && (Speed_TimeCode_Current.Time.DropFrame !=DropFrame || Speed_TimeCode_Current.Time.Frames !=Frames || Speed_TimeCode_Current.Time.Seconds !=Seconds || Speed_TimeCode_Current.Time.Minutes !=Minutes || Speed_TimeCode_Current.Time.Hours !=Hours)) { Speed_TimeCode_Current.MultipleValues=true; //There are 2+ different values } else if (!Speed_TimeCode_Current.IsValid && !Speed_TimeCode_Current.MultipleValues) { Speed_TimeCode_Current.Time.DropFrame=DropFrame; Speed_TimeCode_Current.Time.Frames =Frames; Speed_TimeCode_Current.Time.Seconds =Seconds; Speed_TimeCode_Current.Time.Minutes =Minutes; Speed_TimeCode_Current.Time.Hours =Hours; Speed_TimeCode_Current.IsValid =true; } } } //video_recdate if (PackType==0x62) //Pack type=0x62 (video_rectime) { int8u Days =((Buffer[Buffer_Offset+3+Pos+2]&0x30)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+2]&0x0F) ) ; int8u Months =((Buffer[Buffer_Offset+3+Pos+3]&0x10)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+3]&0x0F) ) ; int8u Years =((Buffer[Buffer_Offset+3+Pos+4]&0xF0)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+4]&0x0F) ) ; if (Months<=12 && Days <=31) { if (Speed_RecDate_Current.IsValid && Speed_RecDate_Current.Days !=Days && Speed_RecDate_Current.Months !=Months && Speed_RecDate_Current.Years !=Years) { Speed_RecDate_Current.MultipleValues=true; //There are 2+ different values } else if (!Speed_RecTime_Current.MultipleValues) { Speed_RecDate_Current.Days =Days; Speed_RecDate_Current.Months =Months; Speed_RecDate_Current.Years =Years; Speed_RecDate_Current.IsValid =true; } } } //video_rectime if (PackType==0x63) //Pack type=0x63 (video_rectime) { int8u Frames =((Buffer[Buffer_Offset+3+Pos+1]&0x30)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+1]&0x0F) ) ; int8u Seconds =((Buffer[Buffer_Offset+3+Pos+2]&0x70)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+2]&0x0F)) ; int8u Minutes =((Buffer[Buffer_Offset+3+Pos+3]&0x70)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+3]&0x0F) ) ; int8u Hours =((Buffer[Buffer_Offset+3+Pos+4]&0x30)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+4]&0x0F) ) ; if (Seconds<61 && Minutes<60 && Hours <24) //If not disabled { if (Speed_RecTime_Current.IsValid && Speed_RecTime_Current.Time.Frames !=Frames && Speed_RecTime_Current.Time.Seconds !=Seconds && Speed_RecTime_Current.Time.Minutes !=Minutes && Speed_RecTime_Current.Time.Hours !=Hours) { Speed_RecTime_Current.MultipleValues=true; //There are 2+ different values } else if (!Speed_RecTime_Current.MultipleValues) { Speed_RecTime_Current.Time.Frames =Frames; Speed_RecTime_Current.Time.Seconds =Seconds; Speed_RecTime_Current.Time.Minutes =Minutes; Speed_RecTime_Current.Time.Hours =Hours; Speed_RecTime_Current.IsValid =true; } } } } } break; case 0x40 : //SCT=2 (VAUX) { Frame_AtLeast1DIF=true; for (size_t Pos=0; Pos<15*5; Pos+=5) { int8u PackType=Buffer[Buffer_Offset+3+Pos]; //video_source if (PackType==0x60 && !System_IsValid) //Pack type=0x60 (video_source) { System=(Buffer[Buffer_Offset+3+Pos+3]&0x20)==0x20?true:false; System_IsValid=true; video_source_Detected=true; } //video_recdate if (PackType==0x62) //Pack type=0x62 (video_rectime) { int8u Days =((Buffer[Buffer_Offset+3+Pos+2]&0x30)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+2]&0x0F) ) ; int8u Months =((Buffer[Buffer_Offset+3+Pos+3]&0x10)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+3]&0x0F) ) ; int8u Years =((Buffer[Buffer_Offset+3+Pos+4]&0xF0)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+4]&0x0F) ) ; if (Months<=12 && Days <=31) { if (Speed_RecDate_Current.IsValid && Speed_RecDate_Current.Days !=Days && Speed_RecDate_Current.Months !=Months && Speed_RecDate_Current.Years !=Years) { Speed_RecDate_Current.MultipleValues=true; //There are 2+ different values } else if (!Speed_RecTime_Current.MultipleValues) { Speed_RecDate_Current.Days =Days; Speed_RecDate_Current.Months =Months; Speed_RecDate_Current.Years =Years; Speed_RecDate_Current.IsValid =true; } } } //video_rectime if (PackType==0x63) //Pack type=0x63 (video_rectime) { int8u Frames =((Buffer[Buffer_Offset+3+Pos+1]&0x30)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+1]&0x0F) ) ; int8u Seconds =((Buffer[Buffer_Offset+3+Pos+2]&0x70)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+2]&0x0F)) ; int8u Minutes =((Buffer[Buffer_Offset+3+Pos+3]&0x70)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+3]&0x0F) ) ; int8u Hours =((Buffer[Buffer_Offset+3+Pos+4]&0x30)>>4)*10 + ((Buffer[Buffer_Offset+3+Pos+4]&0x0F) ) ; if (Seconds!=85 && Minutes!=85 && Hours !=45) //If not disabled { if (Speed_RecTime_Current.IsValid && Speed_RecTime_Current.Time.Frames !=Frames && Speed_RecTime_Current.Time.Seconds !=Seconds && Speed_RecTime_Current.Time.Minutes !=Minutes && Speed_RecTime_Current.Time.Hours !=Hours) { Speed_RecTime_Current.MultipleValues=true; //There are 2+ different values } else if (!Speed_RecTime_Current.MultipleValues) { Speed_RecTime_Current.Time.Frames =Frames; Speed_RecTime_Current.Time.Seconds =Seconds; Speed_RecTime_Current.Time.Minutes =Minutes; Speed_RecTime_Current.Time.Hours =Hours; Speed_RecTime_Current.IsValid =true; } } } } } break; case 0x60 : //SCT=3 (Audio) { //audio_source if (Buffer[Buffer_Offset+3+0]==0x50) //audio_source { QU_FSC =(Buffer[Buffer_Offset+1 ]&0x08)?true:false; //FSC QU_System =(Buffer[Buffer_Offset+3+3]&0x20)?true:false; //50/60 int8u AUDIO_MODE=Buffer[Buffer_Offset+3+2]&0x0F; QU =Buffer[Buffer_Offset+3+4]&0x07; size_t Channel=(QU_FSC?2:0)+((Buffer[Buffer_Offset+1]>>4)>=(QU_System?6:5)?1:0); //If Dseq>=5 or 6 if (audio_source_IsPresent.empty()) audio_source_IsPresent.resize(8); audio_source_IsPresent[Channel]=true; if (AUDIO_MODE==0x0F) { if (Audio_Invalids.empty()) { Audio_Invalids.resize(8); for (size_t Pos=0; Pos<8; Pos++) Audio_Invalids[Pos].resize(16); } Audio_Invalids[Channel][Buffer[Buffer_Offset+1]>>4]+=9; } } //audio_source_control if (Buffer[Buffer_Offset+3+0]==0x51) //audio_source_control { REC_ST =(Buffer[Buffer_Offset+3+2]&0x80)?true:false; REC_END=(Buffer[Buffer_Offset+3+2]&0x40)?true:false; REC_IsValid=true; } //audio_recdate if (Buffer[Buffer_Offset+3+0]==0x52) //Pack type=0x52 (audio_rectime) { int8u Days =((Buffer[Buffer_Offset+3+2]&0x30)>>4)*10 + ((Buffer[Buffer_Offset+3+2]&0x0F) ) ; int8u Months =((Buffer[Buffer_Offset+3+3]&0x10)>>4)*10 + ((Buffer[Buffer_Offset+3+3]&0x0F) ) ; int8u Years =((Buffer[Buffer_Offset+3+4]&0xF0)>>4)*10 + ((Buffer[Buffer_Offset+3+4]&0x0F) ) ; if (Months<=12 && Days <=31) { if (Speed_RecDate_Current.IsValid && Speed_RecDate_Current.Days !=Days && Speed_RecDate_Current.Months !=Months && Speed_RecDate_Current.Years !=Years) { Speed_RecDate_Current.MultipleValues=true; //There are 2+ different values } else if (!Speed_RecTime_Current.MultipleValues) { Speed_RecDate_Current.Days =Days; Speed_RecDate_Current.Months =Months; Speed_RecDate_Current.Years =Years; Speed_RecDate_Current.IsValid =true; } } } //audio_rectime if (Buffer[Buffer_Offset+3+0]==0x53) //Pack type=0x53 (audio_rectime) { int8u Frames =((Buffer[Buffer_Offset+3+1]&0x30)>>4)*10 + ((Buffer[Buffer_Offset+3+1]&0x0F) ) ; int8u Seconds =((Buffer[Buffer_Offset+3+2]&0x70)>>4)*10 + ((Buffer[Buffer_Offset+3+2]&0x0F)) ; int8u Minutes =((Buffer[Buffer_Offset+3+3]&0x70)>>4)*10 + ((Buffer[Buffer_Offset+3+3]&0x0F) ) ; int8u Hours =((Buffer[Buffer_Offset+3+4]&0x30)>>4)*10 + ((Buffer[Buffer_Offset+3+4]&0x0F) ) ; if (Seconds!=85 && Minutes!=85 && Hours !=45) //If not disabled { if (Speed_RecTime_Current.IsValid && Speed_RecTime_Current.Time.Frames !=Frames && Speed_RecTime_Current.Time.Seconds !=Seconds && Speed_RecTime_Current.Time.Minutes !=Minutes && Speed_RecTime_Current.Time.Hours !=Hours) { Speed_RecTime_Current.MultipleValues=true; //There are 2+ different values } else if (!Speed_RecTime_Current.MultipleValues) { Speed_RecTime_Current.Time.Frames =Frames; Speed_RecTime_Current.Time.Seconds =Seconds; Speed_RecTime_Current.Time.Minutes =Minutes; Speed_RecTime_Current.Time.Hours =Hours; Speed_RecTime_Current.IsValid =true; } } } //Audio errors if (Buffer[Buffer_Offset+8]==0x80) { if ((QU==0 && Buffer[Buffer_Offset+ 9]==0x00) //16-bit 0x8000 || (QU==1 && Buffer[Buffer_Offset+10]==0x00) //12-bit 0x800 || (QU==(int8u)-1 && ((Buffer[Buffer_Offset+ 9]==0x00 && Buffer[Buffer_Offset+10]==0x80 && Buffer[Buffer_Offset+11]==0x00) || (Buffer[Buffer_Offset+ 9]==0x80 && Buffer[Buffer_Offset+10]==0x00)))) //In case of QU is not already detected { if (Audio_Errors.empty()) Audio_Errors.resize(16); Audio_Errors[Buffer[Buffer_Offset+1]>>4]++; } } } break; case 0x80 : //SCT=4 (Video) { //Speed_Arb_Current int8u Value=Buffer[Buffer_Offset+0]&0x0F; Speed_Arb_Current.Value_Counters[Value]++; if (Value==0xF) { if (!Speed_Arb_Current.IsValid) { Speed_Arb_Current.Value =0xF; Speed_Arb_Current.IsValid=true; } } else { if (Speed_Arb_Current.IsValid && Speed_Arb_Current.Value!=0xF && Speed_Arb_Current.Value!=Value) Speed_Arb_Current.MultipleValues=true; //There are 2+ different values else if (!Speed_Arb_Current.MultipleValues) { Speed_Arb_Current.Value =Value; Speed_Arb_Current.IsValid=true; } } //STA if (Buffer[Buffer_Offset+3]&0xF0) { if (video_source_Detected) { if (Video_STA_Errors.empty()) Video_STA_Errors.resize(16); Video_STA_Errors[Buffer[Buffer_Offset+3]>>4]++; } } } break; } //Errors stats if (Frame_AtLeast1DIF && (Buffer[Buffer_Offset ]&0xE0)==0x00 //SCT=0 (Header) && (Buffer[Buffer_Offset+1]&0xF0)==0x00 //Dseq=0 && (Buffer[Buffer_Offset+1]&0x08)==0x00) //FSC=0 Errors_Stats_Update(); //Coherency test if (Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x00 && Buffer[Buffer_Offset+2]==0x00) Speed_Contains_NULL++; Buffer_Offset+=80; } if (!Status[IsAccepted]) File__Analyze::Buffer_Offset=0; Config->State_Set(((float)File_Offset)/File_Size); } void File_DvDif::Errors_Stats_Update() { if (!Analyze_Activated) { if (Config->File_DvDif_Analysis_Get()) Analyze_Activated=true; else return; } Ztring Errors_Stats_Line; if (Speed_FrameCount) //We must have at least one complete frame { bool Errors_AreDetected=false; bool Infos_AreDetected=false; bool Arb_AreDetected=false; #if MEDIAINFO_EVENTS //Demux struct MediaInfo_Event_DvDif_Analysis_Frame_0 Event; Event.EventCode=MediaInfo_EventCode_Create(MediaInfo_Parser_DvDif, MediaInfo_Event_DvDif_Analysis_Frame, 0); Event.TimeCode=0; Event.RecordedDateTime1=0; Event.RecordedDateTime2=0; Event.Arb=0; Event.Verbosity=0; Event.Errors=NULL; #endif //MEDIAINFO_EVENTS //Framerate computing float64 FrameRate=29.970; if (System_IsValid) FrameRate=System?25.000:29.970; else if (DSF_IsValid) FrameRate=DSF?25.000:29.970; else FrameRate=29.970; if (FrameRate==29.970 && Speed_TimeCode_Current.IsValid && !Speed_TimeCode_Current.Time.DropFrame) FrameRate=30.000; //Frame number Ztring Frame_Number_Padded=Ztring::ToZtring(Speed_FrameCount-1); if (Frame_Number_Padded.size()<8) Frame_Number_Padded.insert(0, 8-Frame_Number_Padded.size(), __T(' ')); Errors_Stats_Line+=Frame_Number_Padded; Errors_Stats_Line+=__T('\t'); //Time Offset float64 Time_Offset=(Speed_FrameCount-1)*1000/FrameRate; Errors_Stats_Line+=Ztring().Duration_From_Milliseconds((int64u)Time_Offset); Errors_Stats_Line+=__T('\t'); //Timecode if (Speed_TimeCode_Current.IsValid) { Speed_TimeCodeZ_Last=Speed_TimeCodeZ_Current; Speed_TimeCodeZ_Current.clear(); Speed_TimeCodeZ_Current.reserve(12); Speed_TimeCodeZ_Current.reserve(11); Speed_TimeCodeZ_Current+=__T('0')+Speed_TimeCode_Current.Time.Hours /10; Speed_TimeCodeZ_Current+=__T('0')+Speed_TimeCode_Current.Time.Hours %10; Speed_TimeCodeZ_Current+=__T(':'); Speed_TimeCodeZ_Current+=__T('0')+Speed_TimeCode_Current.Time.Minutes/10; Speed_TimeCodeZ_Current+=__T('0')+Speed_TimeCode_Current.Time.Minutes%10; Speed_TimeCodeZ_Current+=__T(':'); Speed_TimeCodeZ_Current+=__T('0')+Speed_TimeCode_Current.Time.Seconds/10; Speed_TimeCodeZ_Current+=__T('0')+Speed_TimeCode_Current.Time.Seconds%10; Speed_TimeCodeZ_Current+=(!DSF && Speed_TimeCode_Current.Time.DropFrame)?__T(';'):__T(':'); Speed_TimeCodeZ_Current+=__T('0')+Speed_TimeCode_Current.Time.Frames /10; Speed_TimeCodeZ_Current+=__T('0')+Speed_TimeCode_Current.Time.Frames %10; Errors_Stats_Line+=Speed_TimeCodeZ_Current; if (Speed_TimeCodeZ.empty()) { Speed_TimeCodeZ.resize(1); Speed_TimeCodeZ[0].First.FramePos=Speed_FrameCount; Speed_TimeCodeZ[0].First.TimeCode=Speed_TimeCodeZ_Current; } if (Speed_TimeStampsZ.empty()) { Speed_TimeStampsZ.resize(1); Speed_TimeStampsZ[0].First.FramePos=Speed_FrameCount; Speed_TimeStampsZ[0].First.Time+=Ztring().Duration_From_Milliseconds((int64u)Time_Offset); } if (Speed_TimeStampsZ[0].First.FramePos==Speed_FrameCount) Speed_TimeStampsZ[0].First.TimeCode=Speed_TimeCodeZ_Current; #if MEDIAINFO_EVENTS int32u Seconds=Speed_TimeCode_Current.Time.Hours *60*60 + Speed_TimeCode_Current.Time.Minutes *60 + Speed_TimeCode_Current.Time.Seconds ; Event.TimeCode|=Seconds<<8; Event.TimeCode|=(!DSF && Speed_TimeCode_Current.Time.DropFrame)<<7; Event.TimeCode|=Speed_TimeCode_Current.Time.Frames; #endif //MEDIAINFO_EVENTS } else { Errors_Stats_Line+=__T("XX:XX:XX:XX"); #if MEDIAINFO_EVENTS Event.TimeCode|=0x7FFFF<<8; //Event.TimeCode|=Speed_TimeCode_Current.Time.DropFrame<<7; Event.TimeCode|=0x3F; #endif //MEDIAINFO_EVENTS } Errors_Stats_Line+=__T('\t'); //Timecode order coherency if (!Speed_TimeCode_IsValid && Speed_TimeCode_Current.IsValid && (Speed_TimeCode_Current.Time.Hours!=0 || Speed_TimeCode_Current.Time.Minutes!=0 || Speed_TimeCode_Current.Time.Seconds!=0 || Speed_TimeCode_Current.Time.Frames!=0)) Speed_TimeCode_IsValid=true; bool TimeCode_Disrupted=false; if (Speed_TimeCode_IsValid && Speed_TimeCode_Current.IsValid && Speed_TimeCode_Last.IsValid && Speed_TimeCode_Current.Time.Frames ==Speed_TimeCode_Last.Time.Frames && Speed_TimeCode_Current.Time.Seconds==Speed_TimeCode_Last.Time.Seconds && Speed_TimeCode_Current.Time.Minutes==Speed_TimeCode_Last.Time.Minutes && Speed_TimeCode_Current.Time.Hours ==Speed_TimeCode_Last.Time.Hours) { Errors_Stats_Line+=__T('R'); #if MEDIAINFO_EVENTS Event.TimeCode|=1<<31; #endif //MEDIAINFO_EVENTS if (Speed_TimeCode_Current.Time.Hours || Speed_TimeCode_Current.Time.Seconds || Speed_TimeCode_Current.Time.Minutes) Errors_AreDetected=true; } else if (Speed_TimeCode_IsValid && Speed_TimeCode_Current.IsValid && Speed_TimeCode_Current_Theory.IsValid && ( Speed_TimeCode_Current.Time.Frames !=Speed_TimeCode_Current_Theory.Time.Frames || Speed_TimeCode_Current.Time.Seconds!=Speed_TimeCode_Current_Theory.Time.Seconds || Speed_TimeCode_Current.Time.Minutes!=Speed_TimeCode_Current_Theory.Time.Minutes || Speed_TimeCode_Current.Time.Hours !=Speed_TimeCode_Current_Theory.Time.Hours)) { size_t Speed_TimeCodeZ_Pos=Speed_TimeCodeZ.size(); Speed_TimeCodeZ.resize(Speed_TimeCodeZ_Pos+1); Speed_TimeCodeZ[Speed_TimeCodeZ_Pos].First.FramePos=Speed_FrameCount-1; Speed_TimeCodeZ[Speed_TimeCodeZ_Pos].First.TimeCode=Speed_TimeCodeZ_Current; Speed_TimeCodeZ[Speed_TimeCodeZ_Pos-1].Last.FramePos=Speed_FrameCount-1; Speed_TimeCodeZ[Speed_TimeCodeZ_Pos-1].Last.TimeCode=Speed_TimeCodeZ_Last; Errors_Stats_Line+=__T('N'); #if MEDIAINFO_EVENTS Event.TimeCode|=1<<30; #endif //MEDIAINFO_EVENTS Speed_TimeCode_Current_Theory=Speed_TimeCode_Current; TimeCode_Disrupted=true; Errors_AreDetected=true; } else Errors_Stats_Line+=__T(' '); Errors_Stats_Line+=__T('\t'); //RecDate/RecTime if (Speed_RecDate_Current.IsValid) { Speed_RecDateZ_Last=Speed_RecDateZ_Current; Speed_RecDateZ_Current.clear(); Speed_RecDateZ_Current.reserve(10); Speed_RecDateZ_Current+=Speed_RecDate_Current.Years<75?__T("20"):__T("19"); Speed_RecDateZ_Current+=__T('0')+Speed_RecDate_Current.Years /10; Speed_RecDateZ_Current+=__T('0')+Speed_RecDate_Current.Years %10; Speed_RecDateZ_Current+=__T('-'); Speed_RecDateZ_Current+=__T('0')+Speed_RecDate_Current.Months /10; Speed_RecDateZ_Current+=__T('0')+Speed_RecDate_Current.Months %10; Speed_RecDateZ_Current+=__T('-'); Speed_RecDateZ_Current+=__T('0')+Speed_RecDate_Current.Days /10; Speed_RecDateZ_Current+=__T('0')+Speed_RecDate_Current.Days %10; Errors_Stats_Line+=Speed_RecDateZ_Current; if (Speed_RecZ.empty()) { Speed_RecZ.resize(1); Speed_RecZ[0].First.FramePos=Speed_FrameCount; Speed_RecZ[0].First.Date=Speed_RecDateZ_Current; } if (Speed_TimeStampsZ.empty()) { Speed_TimeStampsZ.resize(1); Speed_TimeStampsZ[0].First.FramePos=Speed_FrameCount; Speed_TimeStampsZ[0].First.Time+=Ztring().Duration_From_Milliseconds((int64u)Time_Offset); } if (Speed_TimeStampsZ[0].First.FramePos==Speed_FrameCount) Speed_TimeStampsZ[0].First.Date=Speed_RecDateZ_Current; #if MEDIAINFO_EVENTS Event.RecordedDateTime1|=Speed_RecDate_Current.Years<<17; Event.RecordedDateTime2|=Speed_RecDate_Current.Months<<12; Event.RecordedDateTime2|=Speed_RecDate_Current.Days<<8; #endif //MEDIAINFO_EVENTS } else { Errors_Stats_Line+=__T("XXXX-XX-XX"); #if MEDIAINFO_EVENTS Event.RecordedDateTime1|=0x7F<<17; Event.RecordedDateTime2|=0x0F<<12; Event.RecordedDateTime2|=0x1F<<8; #endif //MEDIAINFO_EVENTS } Errors_Stats_Line+=__T(" "); if (Speed_RecTime_Current.IsValid) { Speed_RecTimeZ_Last=Speed_RecTimeZ_Current; Speed_RecTimeZ_Current.clear(); Speed_RecTimeZ_Current.reserve(12); Speed_RecTimeZ_Current+=__T('0')+Speed_RecTime_Current.Time.Hours /10; Speed_RecTimeZ_Current+=__T('0')+Speed_RecTime_Current.Time.Hours %10; Speed_RecTimeZ_Current+=__T(':'); Speed_RecTimeZ_Current+=__T('0')+Speed_RecTime_Current.Time.Minutes/10; Speed_RecTimeZ_Current+=__T('0')+Speed_RecTime_Current.Time.Minutes%10; Speed_RecTimeZ_Current+=__T(':'); Speed_RecTimeZ_Current+=__T('0')+Speed_RecTime_Current.Time.Seconds/10; Speed_RecTimeZ_Current+=__T('0')+Speed_RecTime_Current.Time.Seconds%10; #if MEDIAINFO_EVENTS int32u Seconds=Speed_RecTime_Current.Time.Hours *60*60 + Speed_RecTime_Current.Time.Minutes *60 + Speed_RecTime_Current.Time.Seconds ; Event.RecordedDateTime1|=Seconds; #endif //MEDIAINFO_EVENTS if (Speed_RecTime_Current.Time.Frames!=45) { int32u Milliseconds; if (System_IsValid) Milliseconds=Speed_RecTime_Current.Time.Frames*(System?40:33); else if (DSF_IsValid) Milliseconds=Speed_RecTime_Current.Time.Frames*(DSF?40:33); else Milliseconds=Speed_RecTime_Current.Time.Frames*33; Speed_RecTimeZ_Current+=__T('.'); Speed_RecTimeZ_Current+=__T('0')+(Char)(Milliseconds/100); Speed_RecTimeZ_Current+=__T('0')+(Char)((Milliseconds%100)/10); Speed_RecTimeZ_Current+=__T('0')+(Char)(Milliseconds%10); #if MEDIAINFO_EVENTS Event.RecordedDateTime2|=Speed_RecTime_Current.Time.Frames; #endif //MEDIAINFO_EVENTS } else { Speed_RecTimeZ_Current+=__T(" "); #if MEDIAINFO_EVENTS Event.RecordedDateTime2|=0x7F; #endif //MEDIAINFO_EVENTS } Errors_Stats_Line+=Speed_RecTimeZ_Current; if (Speed_RecZ.empty() || Speed_RecZ[0].First.FramePos==Speed_FrameCount) //Empty or the same frame as RecDate { if (Speed_RecZ.empty()) Speed_RecZ.resize(1); Speed_RecZ[0].First.FramePos=Speed_FrameCount; Speed_RecZ[0].First.Time=Speed_RecTimeZ_Current; } if (Speed_TimeStampsZ.empty()) { Speed_TimeStampsZ.resize(1); Speed_TimeStampsZ[0].First.FramePos=Speed_FrameCount; Speed_TimeStampsZ[0].First.Time+=Ztring().Duration_From_Milliseconds((int64u)Time_Offset); } if (Speed_TimeStampsZ[0].First.FramePos==Speed_FrameCount) //Empty or the same frame as RecDate or the same frame as TimeCode Speed_TimeStampsZ[0].First.Time=Speed_RecTimeZ_Current; } else { Errors_Stats_Line+=__T("XX:XX:XX.XXX"); #if MEDIAINFO_EVENTS Event.RecordedDateTime1|=0x1FFFF; Event.RecordedDateTime2|=0x7F; #endif //MEDIAINFO_EVENTS } Errors_Stats_Line+=__T('\t'); //RecDate/RecTime coherency, Rec start/end bool RecTime_Disrupted=false; if (Speed_RecTime_Current.IsValid && Speed_RecTime_Current_Theory.IsValid && !( Speed_RecTime_Current.Time.Seconds==Speed_RecTime_Current_Theory.Time.Seconds && Speed_RecTime_Current.Time.Minutes==Speed_RecTime_Current_Theory.Time.Minutes && Speed_RecTime_Current.Time.Hours ==Speed_RecTime_Current_Theory.Time.Hours) && !( Speed_RecTime_Current.Time.Seconds==Speed_RecTime_Current_Theory2.Time.Seconds && Speed_RecTime_Current.Time.Minutes==Speed_RecTime_Current_Theory2.Time.Minutes && Speed_RecTime_Current.Time.Hours ==Speed_RecTime_Current_Theory2.Time.Hours)) { size_t Speed_RecZ_Pos=Speed_RecZ.size(); Speed_RecZ.resize(Speed_RecZ_Pos+1); Speed_RecZ[Speed_RecZ_Pos].First.FramePos=Speed_FrameCount-1; Speed_RecZ[Speed_RecZ_Pos].First.Date=Speed_RecDateZ_Current; Speed_RecZ[Speed_RecZ_Pos].First.Time=Speed_RecTimeZ_Current; Speed_RecZ[Speed_RecZ_Pos-1].Last.FramePos=Speed_FrameCount-1; Speed_RecZ[Speed_RecZ_Pos-1].Last.Date=Speed_RecDateZ_Last; Speed_RecZ[Speed_RecZ_Pos-1].Last.Time=Speed_RecTimeZ_Last; Errors_Stats_Line+=__T('N'); #if MEDIAINFO_EVENTS Event.RecordedDateTime1|=1<<30; #endif //MEDIAINFO_EVENTS if (!REC_IsValid || REC_ST) { RecTime_Disrupted=true; Errors_AreDetected=true; //If there is a start, this is not an error } } else Errors_Stats_Line+=__T(' '); Errors_Stats_Line+=__T('\t'); //Speed_Arb_Current if (Speed_Arb_Current.IsValid) { //Searching the bigest value count int8u Biggest_Pos=0xF; size_t Biggest_Count=0; for (int8u Pos=0; Pos<=0xF; Pos++) //0xF is not considered as a valid value. if (Speed_Arb_Current.Value_Counters[Pos]>Biggest_Count) { Biggest_Pos=Pos; Biggest_Count=Speed_Arb_Current.Value_Counters[Pos]; } Errors_Stats_Line+=Ztring::ToZtring(Biggest_Pos, 16); #if MEDIAINFO_EVENTS Event.Arb|=Biggest_Pos; Event.Arb|=1<<4; #endif //MEDIAINFO_EVENTS Speed_Arb_Current.Value=Biggest_Pos; } else Errors_Stats_Line+=__T('X'); Errors_Stats_Line+=__T('\t'); //Speed_Arb_Current coherency if (!Speed_Arb_IsValid && Speed_Arb_Current.IsValid && Speed_Arb_Current.Value!=0) Speed_Arb_IsValid=true; if (Speed_Arb_IsValid && Speed_Arb_Current.IsValid && Speed_Arb_Last.IsValid && Speed_Arb_Current.Value ==Speed_Arb_Last.Value && Speed_Arb_Current.Value!=0xF) { Errors_Stats_Line+=__T('R'); #if MEDIAINFO_EVENTS Event.Arb|=1<<7; #endif //MEDIAINFO_EVENTS if (Speed_Arb_Current.Value!=0xF) Arb_AreDetected=true; Speed_Arb_Current_Theory.IsValid=false; } else if (Speed_Arb_IsValid && Speed_Arb_Current.IsValid && Speed_Arb_Current_Theory.IsValid && Speed_Arb_Current.Value != Speed_Arb_Current_Theory.Value) { Errors_Stats_Line+=__T('N'); #if MEDIAINFO_EVENTS Event.Arb|=1<<6; #endif //MEDIAINFO_EVENTS Speed_Arb_Current_Theory=Speed_Arb_Current; Arb_AreDetected=true; } else Errors_Stats_Line+=__T(' '); Errors_Stats_Line+=__T('\t'); //Start if (REC_IsValid && !REC_ST) { Errors_Stats_Line+=__T('S'); #if MEDIAINFO_EVENTS Event.RecordedDateTime1|=1<<29; #endif //MEDIAINFO_EVENTS Infos_AreDetected=true; } else Errors_Stats_Line+=__T(' '); Errors_Stats_Line+=__T('\t'); //End if (REC_IsValid && !REC_END) { Errors_Stats_Line+=__T('E'); #if MEDIAINFO_EVENTS Event.RecordedDateTime1|=1<<28; #endif //MEDIAINFO_EVENTS Infos_AreDetected=true; } else Errors_Stats_Line+=__T(' '); Errors_Stats_Line+=__T('\t'); //TimeStamp (RecDate/RecTime and TimeCode together) if (TimeCode_Disrupted || RecTime_Disrupted) { size_t Speed_TimeStampsZ_Pos=Speed_TimeStampsZ.size(); Speed_TimeStampsZ.resize(Speed_TimeStampsZ_Pos+1); Speed_TimeStampsZ[Speed_TimeStampsZ_Pos].First.FramePos=Speed_FrameCount-1; Speed_TimeStampsZ[Speed_TimeStampsZ_Pos].First.TimeCode=Speed_TimeCodeZ_Current; Speed_TimeStampsZ[Speed_TimeStampsZ_Pos].First.Date=Speed_RecDateZ_Current; Speed_TimeStampsZ[Speed_TimeStampsZ_Pos].First.Time=Speed_RecTimeZ_Current; Speed_TimeStampsZ[Speed_TimeStampsZ_Pos-1].Last.FramePos=Speed_FrameCount-1; Speed_TimeStampsZ[Speed_TimeStampsZ_Pos-1].Last.TimeCode=Speed_TimeCodeZ_Last; Speed_TimeStampsZ[Speed_TimeStampsZ_Pos-1].Last.Date=Speed_RecDateZ_Last; Speed_TimeStampsZ[Speed_TimeStampsZ_Pos-1].Last.Time=Speed_RecTimeZ_Last; } //Channels for (size_t Channel=0; Channel<8; Channel++) { if (!audio_source_IsPresent.empty() && audio_source_IsPresent[Channel]) { if (Channel<4 && (!Audio_Invalids.empty() || !Audio_Errors.empty())) { size_t Audio_Errors_Count=0; size_t Pos_Begin=(Channel%2)*(QU_System?6:5); size_t Pos_End=(Channel%2+1)*(QU_System?6:5); if ((Channel>=2 && !QU_FSC) || (Channel< 2 && QU_FSC)) Pos_End=Pos_Begin; //Not here if (!Audio_Invalids.empty()) for (size_t Pos=Pos_Begin; Pos=(size_t)((QU_System?6:5)*9)) audio_source_IsPresent[Channel]=false; else CH_IsPresent[Channel]=true; } } } //Error 1: Video errors Ztring Errors_Stats_Line_Details; if (!Video_STA_Errors.empty()) { if (!Stats_Total_AlreadyDetected) { Stats_Total_AlreadyDetected=true; Stats_Total++; Stats_Total_WithoutArb++; } Stats[1]++; Errors_Stats_Line+=__T('1'); size_t Video_STA_Errors_Count=0; Ztring Video_STA_Errors_Details; for (size_t Pos=0; Pos<16; Pos++) { if (Video_STA_Errors[Pos]) { Video_STA_Errors_Count+=Video_STA_Errors[Pos]; Ztring Video_STA_Errors_Count_Padded=Ztring::ToZtring(Video_STA_Errors[Pos]); if (Video_STA_Errors_Count_Padded.size()<8) Video_STA_Errors_Count_Padded.insert(0, 8-Video_STA_Errors_Count_Padded.size(), __T(' ')); Video_STA_Errors_Details+=Video_STA_Errors_Count_Padded; Video_STA_Errors_Details+=__T(" \""); Video_STA_Errors_Details+=Ztring::ToZtring(Pos, 16); Video_STA_Errors_Details+=__T("\" errors, "); if (Video_STA_Errors_Total.empty()) Video_STA_Errors_Total.resize(16); Video_STA_Errors_Total[Pos]+=Video_STA_Errors[Pos]; } } if (Video_STA_Errors_Details.size()>2) { Ztring Video_STA_Errors_Count_Padded=Ztring::ToZtring(((float)Video_STA_Errors_Count)*100/((DSF_IsValid && DSF)?1500:1350)*(QU_FSC?2:1), 2); if (Video_STA_Errors_Count_Padded.size()<5) Video_STA_Errors_Count_Padded.insert(0, 5-Video_STA_Errors_Count_Padded.size(), __T(' ')); Errors_Stats_Line_Details+=Video_STA_Errors_Count_Padded+__T("%"); Video_STA_Errors_Details.resize(Video_STA_Errors_Details.size()-2); Errors_Stats_Line_Details+=__T(" (")+Video_STA_Errors_Details+__T(")"); Speed_FrameCount_Video_STA_Errors++; Errors_AreDetected=true; } } else Errors_Stats_Line+=__T(' '); Errors_Stats_Line+=__T('\t'); Errors_Stats_Line_Details+=__T('\t'); //Error 2: Audio errors if (QU!=(int8u)-1 && (!Audio_Invalids.empty() || !Audio_Errors.empty())) { if (Audio_Errors.empty()) Audio_Errors.resize(16); bool ErrorsAreAlreadyDetected=false; for (size_t Channel=0; Channel<4; Channel++) { size_t Audio_Errors_Count=0; Ztring Audio_Errors_Details; size_t Pos_Begin=(Channel%2)*(QU_System?6:5); size_t Pos_End=(Channel%2+1)*(QU_System?6:5); if ((Channel>=2 && !QU_FSC) || (Channel< 2 && QU_FSC) || !CH_IsPresent[Channel]) Pos_End=Pos_Begin; //Not here for (size_t Pos=Pos_Begin; Pos2) { Arb_Errors.resize(Arb_Errors.size()-2); Errors_Stats_Line_Details+=Arb_Errors; } Speed_FrameCount_Arb_Incoherency++; Arb_AreDetected=true; } else Errors_Stats_Line+=__T(' '); Errors_Stats_Line+=__T('\t'); Errors_Stats_Line_Details+=__T('\t'); //Error 6: if (Mpeg4_stts && Mpeg4_stts_Possize() && Speed_FrameCount-1>=Mpeg4_stts->at(Mpeg4_stts_Pos).Pos_Begin && Speed_FrameCount-1at(Mpeg4_stts_Pos).Pos_End) { if (!Stats_Total_AlreadyDetected) { Stats_Total_AlreadyDetected=true; Stats_Total++; Stats_Total_WithoutArb++; } Stats[6]++; Errors_Stats_Line+=__T('6'); Errors_Stats_Line_Details+=__T("stts flucuation"); Speed_FrameCount_Stts_Fluctuation++; Errors_AreDetected=true; } else Errors_Stats_Line+=__T(' '); Errors_Stats_Line+=__T('\t'); Errors_Stats_Line_Details+=__T('\t'); //Error 7: Errors_Stats_Line+=__T(' '); Errors_Stats_Line+=__T('\t'); Errors_Stats_Line_Details+=__T('\t'); //Error 8: Errors_Stats_Line+=__T(' '); Errors_Stats_Line+=__T('\t'); Errors_Stats_Line_Details+=__T('\t'); //Error 9: Errors_Stats_Line+=__T(' '); Errors_Stats_Line+=__T('\t'); Errors_Stats_Line_Details+=__T('\t'); //Error 0: Errors_Stats_Line+=__T(' '); Errors_Stats_Line+=__T('\t'); Errors_Stats_Line_Details+=__T('\t'); //Filling the main text if needed { #if MEDIAINFO_EVENTS if (!Config->Event_CallBackFunction_IsSet()) { Errors_Stats_10+=Errors_Stats_Line; Errors_Stats_10+=Errors_Stats_Line_Details; Errors_Stats_10+=__T("&"); } Event.Verbosity=10; #endif //MEDIAINFO_EVENTS } if (Speed_FrameCount==1 || Status[IsFinished] || Errors_AreDetected || Infos_AreDetected || Arb_AreDetected) { #if MEDIAINFO_EVENTS if (!Config->Event_CallBackFunction_IsSet()) { Errors_Stats_09+=Errors_Stats_Line; Errors_Stats_09+=Errors_Stats_Line_Details; Errors_Stats_09+=__T("&"); } Event.Verbosity=9; #endif //MEDIAINFO_EVENTS if (Speed_FrameCount==1 || Status[IsFinished] || Errors_AreDetected || Infos_AreDetected) { #if MEDIAINFO_EVENTS if (!Config->Event_CallBackFunction_IsSet()) { Errors_Stats_05+=Errors_Stats_Line; Errors_Stats_05+=Errors_Stats_Line_Details; Errors_Stats_05+=__T("&"); } Event.Verbosity=5; #endif //MEDIAINFO_EVENTS if (Speed_FrameCount==1 || Status[IsFinished] || Errors_AreDetected) { #if MEDIAINFO_EVENTS if (!Config->Event_CallBackFunction_IsSet()) { Errors_Stats_03+=Errors_Stats_Line; Errors_Stats_03+=Errors_Stats_Line_Details; Errors_Stats_03+=__T("&"); } Event.Verbosity=3; #endif //MEDIAINFO_EVENTS } } } #if MEDIAINFO_EVENTS std::string Errors; if (Errors_Stats_Line_Details.size()>10) { Errors=Errors_Stats_Line_Details.To_Local(); Event.Errors=(char*)Errors.c_str(); } Config->Event_Send(this, (const int8u*)&Event, sizeof(MediaInfo_Event_DvDif_Analysis_Frame_0)); #endif //MEDIAINFO_EVENTS } //Speed_TimeCode_Current if (!Speed_TimeCode_Current_Theory.IsValid) Speed_TimeCode_Current_Theory=Speed_TimeCode_Current; if (Speed_TimeCode_Current_Theory.IsValid) { int8u Frames_Max; if (System_IsValid) Frames_Max=System?25:30; else if (DSF_IsValid) Frames_Max=DSF?25:30; else Frames_Max=30; Speed_TimeCode_Current_Theory.Time.Frames++; if (Speed_TimeCode_Current_Theory.Time.Frames>=Frames_Max) { Speed_TimeCode_Current_Theory.Time.Seconds++; Speed_TimeCode_Current_Theory.Time.Frames=0; if (Speed_TimeCode_Current_Theory.Time.Seconds>=60) { Speed_TimeCode_Current_Theory.Time.Seconds=0; Speed_TimeCode_Current_Theory.Time.Minutes++; if (!DSF && Speed_TimeCode_Current_Theory.Time.DropFrame && Speed_TimeCode_Current_Theory.Time.Minutes%10) Speed_TimeCode_Current_Theory.Time.Frames=2; //frames 0 and 1 are dropped for every minutes except 00 10 20 30 40 50 if (Speed_TimeCode_Current_Theory.Time.Minutes>=60) { Speed_TimeCode_Current_Theory.Time.Minutes=0; Speed_TimeCode_Current_Theory.Time.Hours++; if (Speed_TimeCode_Current_Theory.Time.Hours>=24) { Speed_TimeCode_Current_Theory.Time.Hours=0; } } } } } //Speed_RecTime_Current_Theory Speed_RecTime_Current_Theory=Speed_RecTime_Current; Speed_RecTime_Current_Theory2=Speed_RecTime_Current; //Don't change it if (Speed_RecTime_Current_Theory.IsValid) { Speed_RecTime_Current_Theory.Time.Seconds++; if (Speed_RecTime_Current_Theory.Time.Seconds>=60) { Speed_RecTime_Current_Theory.Time.Seconds=0; Speed_RecTime_Current_Theory.Time.Minutes++; if (Speed_RecTime_Current_Theory.Time.Seconds>=60) { Speed_RecTime_Current_Theory.Time.Minutes=0; Speed_RecTime_Current_Theory.Time.Hours++; if (Speed_RecTime_Current_Theory.Time.Hours>=24) { Speed_RecTime_Current_Theory.Time.Hours=0; } } } } //Speed_Arb_Current_Theory if (!Speed_Arb_Current_Theory.IsValid && Speed_Arb_Current.Value!=0xF) Speed_Arb_Current_Theory=Speed_Arb_Current; if (Speed_Arb_Current_Theory.IsValid && Speed_Arb_Current.Value!=0xF) { Speed_Arb_Current_Theory.Value++; if (Speed_Arb_Current_Theory.Value>=12) { Speed_Arb_Current_Theory.Value=0; } } Speed_TimeCode_Last=Speed_TimeCode_Current; Speed_TimeCode_Current.Clear(); Speed_RecDate_Current.IsValid=false; Speed_RecDate_Current.MultipleValues=false; Speed_RecTime_Current.IsValid=false; Speed_RecTime_Current.MultipleValues=false; Speed_Arb_Last=Speed_Arb_Current; Speed_Arb_Current.Clear(); Speed_FrameCount++; REC_IsValid=false; Speed_Contains_NULL=0; Frame_AtLeast1DIF=true; if (Buffer_Offset+2>=Buffer_Size || (Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x00 && Buffer[Buffer_Offset+2]==0x00)) Frame_AtLeast1DIF=false; Video_STA_Errors.clear(); Audio_Errors.clear(); Audio_Invalids.clear(); Stats_Total_AlreadyDetected=false; } void File_DvDif::Errors_Stats_Update_Finnish() { if (!Analyze_Activated) { if (Config->File_DvDif_Analysis_Get()) Analyze_Activated=true; else return; } //Preparing next frame Speed_FrameCount--; Ztring Errors_Stats_End_03; Ztring Errors_Stats_End_05; Ztring Errors_Stats_End_Lines; //Frames if (Speed_FrameCount) Errors_Stats_End_Lines+=__T("Frame Count: ")+Ztring::ToZtring(Speed_FrameCount)+__T('&'); //One block if (!Errors_Stats_End_Lines.empty()) { Errors_Stats_End_05+=Errors_Stats_End_Lines; Errors_Stats_End_05+=__T('&'); Errors_Stats_End_Lines.clear(); } //Error 1: Video error concealment if (Speed_FrameCount_Video_STA_Errors) Errors_Stats_End_Lines+=__T("Frame count with video error concealment: ")+Ztring::ToZtring(Speed_FrameCount_Video_STA_Errors)+__T(" frames &"); if (!Video_STA_Errors_Total.empty()) { Ztring Errors_Details; size_t Errors_Count=0; for (size_t Pos=0; Pos<16; Pos++) { if (Video_STA_Errors_Total[Pos]) { Errors_Count+=Video_STA_Errors_Total[Pos]; Ztring Errors_Count_Padded=Ztring::ToZtring(Video_STA_Errors_Total[Pos]); if (Errors_Count_Padded.size()<8) Errors_Count_Padded.insert(0, 8-Errors_Count_Padded.size(), __T(' ')); Errors_Details+=Errors_Count_Padded; Errors_Details+=__T(" \""); Errors_Details+=Ztring::ToZtring(Pos, 16); Errors_Details+=__T("\" errors, "); } } if (Errors_Details.size()>2) { Errors_Stats_End_Lines+=__T("Total video error concealment: "); Ztring Errors_Count_Padded=Ztring::ToZtring(Errors_Count); if (Errors_Count_Padded.size()<8) Errors_Count_Padded.insert(0, 8-Errors_Count_Padded.size(), __T(' ')); Errors_Stats_End_Lines+=__T(" ")+Errors_Count_Padded+__T(" errors"); Errors_Details.resize(Errors_Details.size()-2); Errors_Stats_End_Lines+=__T(" (")+Errors_Details+__T(")")+__T('&'); } } //Error 2: Audio error code if (!Audio_Errors_Total.empty()) { for (size_t Channel=0; Channel<8; Channel++) { if (Speed_FrameCount_Audio_Errors[Channel]) Errors_Stats_End_Lines+=__T("Frame count with CH")+Ztring::ToZtring(Channel+1)+__T(" audio error code: ")+Ztring::ToZtring(Speed_FrameCount_Audio_Errors[Channel])+__T(" frames &"); Ztring Errors_Details; size_t Errors_Count=0; for (size_t Pos=0; Pos<16; Pos++) { if (Audio_Errors_Total[Channel][Pos]) { Errors_Count+=Audio_Errors_Total[Channel][Pos]; Ztring Errors_Count_Padded=Ztring::ToZtring(Audio_Errors_Total[Channel][Pos]); if (Errors_Count_Padded.size()<8) Errors_Count_Padded.insert(0, 8-Errors_Count_Padded.size(), __T(' ')); Errors_Details+=Errors_Count_Padded; Errors_Details+=__T(" Dseq="); Errors_Details+=Ztring::ToZtring(Pos, 16); Errors_Details+=__T(", "); } } if (Errors_Details.size()>2) { Errors_Stats_End_Lines+=__T("Total audio error code for CH")+Ztring::ToZtring(Channel+1)+__T(": "); Ztring Errors_Count_Padded=Ztring::ToZtring(Errors_Count); if (Errors_Count_Padded.size()<8) Errors_Count_Padded.insert(0, 8-Errors_Count_Padded.size(), __T(' ')); Errors_Stats_End_Lines+=__T(" ")+Errors_Count_Padded+__T(" errors"); Errors_Details.resize(Errors_Details.size()-2); Errors_Stats_End_Lines+=__T(" (")+Errors_Details+__T(")")+__T('&'); } } } //Error 3: Timecode incoherency if (Speed_FrameCount_Timecode_Incoherency) Errors_Stats_End_Lines+=__T("Frame count with DV timecode incoherency: ")+Ztring::ToZtring(Speed_FrameCount_Timecode_Incoherency)+__T(" frames &"); //Error 4: DIF incohereny if (Speed_FrameCount_Contains_NULL) Errors_Stats_End_Lines+=__T("Frame count with DIF incoherency: ")+Ztring::ToZtring(Speed_FrameCount_Contains_NULL)+__T(" frames &"); //Error 5: Arbitrary bit inconsistency if (Speed_FrameCount_Arb_Incoherency) Errors_Stats_End_Lines+=__T("Frame count with Arbitrary bit inconsistency: ")+Ztring::ToZtring(Speed_FrameCount_Arb_Incoherency)+__T(" frames &"); //Error 6: Stts fluctuation if (Speed_FrameCount_Stts_Fluctuation) Errors_Stats_End_Lines+=__T("Frame count with stts fluctuation: ")+Ztring::ToZtring(Speed_FrameCount_Stts_Fluctuation)+__T(" frames &"); //One block if (!Errors_Stats_End_Lines.empty()) { Errors_Stats_End_03+=Errors_Stats_End_Lines; Errors_Stats_End_03+=__T('&'); Errors_Stats_End_05+=Errors_Stats_End_Lines; Errors_Stats_End_05+=__T('&'); Errors_Stats_End_Lines.clear(); } //TimeStamps (RecDate/RecTime and TimeCode) if (!Speed_RecDateZ_Current.empty() || !Speed_RecTimeZ_Current.empty()) //Date and Time must be both available { size_t Speed_TimeStampsZ_Pos=Speed_TimeStampsZ.size(); if (Speed_TimeStampsZ_Pos) { Speed_TimeStampsZ_Pos--; Speed_TimeStampsZ[Speed_TimeStampsZ_Pos].Last.FramePos=Speed_FrameCount; Speed_TimeStampsZ[Speed_TimeStampsZ_Pos].Last.FramePos=Speed_FrameCount; Speed_TimeStampsZ[Speed_TimeStampsZ_Pos].Last.TimeCode=Speed_TimeCodeZ_Current; if (Speed_TimeStampsZ[Speed_TimeStampsZ_Pos].Last.FramePos-(Speed_TimeStampsZ_Pos?Speed_TimeStampsZ[Speed_TimeStampsZ_Pos-1].Last.FramePos:0)==1) //Only one frame, the "Last" part is not filled Speed_TimeStampsZ[Speed_TimeStampsZ_Pos].Last.TimeCode=Speed_TimeStampsZ[Speed_TimeStampsZ_Pos].First.TimeCode; Speed_TimeStampsZ[Speed_TimeStampsZ_Pos].Last.Date=Speed_RecDateZ_Current; Speed_TimeStampsZ[Speed_TimeStampsZ_Pos].Last.Time=Speed_RecTimeZ_Current; if (Speed_TimeStampsZ[Speed_TimeStampsZ_Pos].Last.FramePos-(Speed_TimeStampsZ_Pos?Speed_TimeStampsZ[Speed_TimeStampsZ_Pos-1].Last.FramePos:0)==1) { //Only one frame, the "Last" part is not filled Speed_TimeStampsZ[Speed_TimeStampsZ_Pos].Last.Date=Speed_TimeStampsZ[Speed_TimeStampsZ_Pos].First.Date; Speed_TimeStampsZ[Speed_TimeStampsZ_Pos].Last.Time=Speed_TimeStampsZ[Speed_TimeStampsZ_Pos].First.Time; } //Framerate computing float64 FrameRate=29.970; if (System_IsValid) FrameRate=System?25.000:29.970; else if (DSF_IsValid) FrameRate=DSF?25.000:29.970; else FrameRate=29.970; if (FrameRate==29.970 && Speed_TimeCode_Current.IsValid && !Speed_TimeCode_Current.Time.DropFrame) FrameRate=30.000; Errors_Stats_End_Lines+=__T("Absolute time\tDV timecode range \tRecorded date/time range \tFrame range&"); for (size_t Pos=0; Pos2) Errors_Stats_End_03.resize(Errors_Stats_End_03.size()-2); //Removing last carriage returns if (Errors_Stats_End_05.size()>2) Errors_Stats_End_05.resize(Errors_Stats_End_05.size()-2); //Removing last carriage returns if (Errors_Stats_End_03.empty()) { Errors_Stats_End_03+=__T("No identified errors"); Errors_Stats_End_05+=__T("&&No identified errors"); } //Filling if (Count_Get(Stream_Video)==0) Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, "Errors_Stats_Begin", "Frame # \tAbsolute time\tDV timecode\tN\tRecorded date/time \tN\tA\tN\tS\tE\t1\t2\t3\t4\t5\t6\t7\t8\t9\t0\t1\t2\t3\t4\t5\t6\t7\t8\t9\t0"); (*Stream_More)[Stream_Video][0](Ztring().From_Local("Errors_Stats_Begin"), Info_Options)=__T("N NT"); Fill(Stream_Video, 0, "Errors_Stats_03", Errors_Stats_03); (*Stream_More)[Stream_Video][0](Ztring().From_Local("Errors_Stats_03"), Info_Options)=__T("N NT"); Fill(Stream_Video, 0, "Errors_Stats_05", Errors_Stats_05); (*Stream_More)[Stream_Video][0](Ztring().From_Local("Errors_Stats_05"), Info_Options)=__T("N NT"); Fill(Stream_Video, 0, "Errors_Stats_09", Errors_Stats_09); (*Stream_More)[Stream_Video][0](Ztring().From_Local("Errors_Stats_09"), Info_Options)=__T("N NT"); Fill(Stream_Video, 0, "Errors_Stats_10", Errors_Stats_10); (*Stream_More)[Stream_Video][0](Ztring().From_Local("Errors_Stats_10"), Info_Options)=__T("N NT"); if (MediaInfoLib::Config.Verbosity_Get()>=(float32)1.0) Fill(Stream_Video, 0, "Errors_Stats", Errors_Stats_10); else if (MediaInfoLib::Config.Verbosity_Get()>=(float32)0.5) Fill(Stream_Video, 0, "Errors_Stats", Errors_Stats_09); else if (MediaInfoLib::Config.Verbosity_Get()>=(float32)0.9) Fill(Stream_Video, 0, "Errors_Stats", Errors_Stats_05); else Fill(Stream_Video, 0, "Errors_Stats", Errors_Stats_03); (*Stream_More)[Stream_Video][0](Ztring().From_Local("Errors_Stats"), Info_Options)=__T("N NT"); Fill(Stream_Video, 0, "Errors_Stats_End_03", Errors_Stats_End_03); (*Stream_More)[Stream_Video][0](Ztring().From_Local("Errors_Stats_End_03"), Info_Options)=__T("N NT"); Fill(Stream_Video, 0, "Errors_Stats_End_05", Errors_Stats_End_05); (*Stream_More)[Stream_Video][0](Ztring().From_Local("Errors_Stats_End_05"), Info_Options)=__T("N NT"); if (MediaInfoLib::Config.Verbosity_Get()>=(float32)0.5) Fill(Stream_Video, 0, "Errors_Stats_End", Errors_Stats_End_05); else Fill(Stream_Video, 0, "Errors_Stats_End", Errors_Stats_End_03); (*Stream_More)[Stream_Video][0](Ztring().From_Local("Errors_Stats_End"), Info_Options)=__T("N NT"); Fill(Stream_Video, 0, "FrameCount_Speed", Speed_FrameCount); (*Stream_More)[Stream_Video][0](Ztring().From_Local("FrameCount_Speed"), Info_Options)=__T("N NT"); } } //NameSpace #endif //MEDIAINFO_DV_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Dvdv.cpp100777 0 0 204253 12226004262 15755 0/* 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 DVD objects // (.ifo files on DVD-Video) // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Mainly from http://dvd.sourceforge.net/dvdinfo/ifo.html // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include using namespace std; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DVDV_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Dvdv.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- const char* IFO_VTS_Category[]= { "Normal", "Karaoke", }; const char* IFO_Format_V[]= { "MPEG Video", "MPEG Video", "", "", }; const char* IFO_Format_Version_V[]= { "Version 1", "Version 2", "", "", }; const char* IFO_CodecV[]= { "MPEG-1V", "MPEG-2V", "", "", }; const char* IFO_Standard[]= { "NTSC", "PAL", "", "", }; float32 IFO_AspectRatio[]= { (float32)1.333, (float32)0.000, (float32)0.000, (float32)1.778, }; const char* IFO_BitRate_Mode[]= { "VBR", "CBR", }; const size_t IFO_Width[]= {720, 704, 352, 352, 0, 0, 0, 0}; const size_t IFO_Height[4][8]= {{480, 480, 480, 240, 0, 0, 0, 0}, //NTSC {576, 576, 576, 288, 0, 0, 0, 0}, //PAL { 0, 0, 0, 0, 0, 0, 0, 0}, //Unknown { 0, 0, 0, 0, 0, 0, 0, 0}, //Unknown }; const float64 IFO_FrameRate[]= {29.970, 25.000}; const char* IFO_Format_A[]= { "AC-3", "", "MPEG Audio", "MPEG Audio", "PCM", "", "DTS", "SDDS", }; const char* IFO_Format_Profile_A[]= { "", "", "Version 1", "Version 2", "", "", "", "", }; const char* IFO_CodecA[]= { "AC3", "", "MPEG-1A", "MPEG-2A", "LPCM (Big Endian)", "", "DTS", "SDDS", }; const char* IFO_ModeA[]= { "", "Karaoke", "Surround", "", }; const char* IFO_ResolutionA[]= { "16", "20", "24", "DRC", }; const int16u IFO_SamplingRate[]= {48000, 0, 0, 0, 0, 0, 0, 0}; const char* IFO_Language_MoreA[]= { "", "", "For visually impaired", "Director's comments", "Director's comments", "", "", "", }; const char* IFO_Format_T[]= { "RLE", "", "", "", "", "", "", "", }; const char* IFO_Resolution_T[]= { "2", "", "", "", "", "", "", "", }; const char* IFO_CodecT[]= { "2-bit RLE", "", "", "", "", "", "", "", }; const char* IFO_Language_MoreT[]= { "", "Normal", "Large", "Children", "", "", "Large", "Children", "", "Forced", "", "", "", "Director comments", "Director comments large", "Director comments children", }; const size_t IFO_PlaybackTime_FrameRate[]= {1, 25, 1, 30}; const char* IFO_MenuType[]= { "", "", "", "root", "sub-picture", "audio", "angle", "PTT (chapter)", "", "", "", "", "", "", "", "", }; //--------------------------------------------------------------------------- extern const char* AC3_ChannelPositions[]; extern const char* AC3_ChannelPositions2[]; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Dvdv::File_Dvdv() :File__Analyze() { //Temp VTS_Attributes_AreHere=false; Program_Pos=0; Time_Pos=0; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Dvdv::Streams_Finish() { //Purge what is not needed anymore if (!File_Name.empty()) //Only if this is not a buffer, with buffer we can have more data Sectors.clear(); } //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- void File_Dvdv::FileHeader_Parse() { //Parsing int64u Identifier; int32u Type; Get_C8 (Identifier, "Identifier"); Get_C4 (Type, "Type"); FILLING_BEGIN(); //Identifier if (Identifier!=CC8("DVDVIDEO")) { Reject("DVD Video"); return; } Accept("DVD Video"); Fill(Stream_General, 0, General_Format, "DVD Video"); //Versions switch (Type) { case Dvdv::VMG : VMG(); break; case Dvdv::VTS : VTS(); break; default : Reject("DVD Video"); return; } FILLING_END(); } //--------------------------------------------------------------------------- //*************************************************************************** // Elements //*************************************************************************** #define SUBELEMENT(_ELEMENT) \ { \ Element_Begin1(#_ELEMENT); \ _ELEMENT(); \ Element_End0(); \ } \ //--------------------------------------------------------------------------- void File_Dvdv::VMG() { int32u Sector_Pointer_LastSector, Sector_Pointer_TT_SRPT, Sector_Pointer_VMGM_PGCI_UT, Sector_Pointer_VMG_PTL_MAIT, Sector_Pointer_VMG_VTS_ATRT, Sector_Pointer_VMG_TXTDT_MG, Sector_Pointer_VMGM_C_ADT, Sector_Pointer_VMGM_VOBU_ADMAP; int16u Version, Audio_Count, Text_Count; Element_Info1("DVD Video - VMG"); Element_Begin1("Header"); Info_B4(LastSector, "Last sector of VMG set (last sector of BUP)"); Param_Info2((LastSector+1)*2048, " bytes"); Skip_XX(12, "Unknown"); Get_B4 (Sector_Pointer_LastSector, "last sector of IFO"); Get_B2 (Version, "version number"); Param_Info1(Ztring::ToZtring((Version&0x00F0)>>4)+__T(".")+Ztring::ToZtring(Version&0x000F)); Info_B4(Category, "VMG category"); Skip_B2( "number of volumes"); Skip_B2( "volume number"); Skip_B1( "side ID"); Skip_XX(19, "Unknown"); Skip_B2( "number of title sets"); Skip_Local(32, "Provider ID"); Skip_B8( "VMG POS"); Skip_XX(24, "Unknown"); Skip_B4( "end byte address of VMGI_MAT"); Skip_B4( "start address of FP_PGC (First Play program chain)"); Skip_XX(56, "Unknown"); Info_B4(Sector_Pointer_Menu, "start sector of Menu VOB"); Get_B4 (Sector_Pointer_TT_SRPT, "sector pointer to TT_SRPT (table of titles)"); Get_B4 (Sector_Pointer_VMGM_PGCI_UT, "sector pointer to VMGM_PGCI_UT (Menu Program Chain table)"); Get_B4 (Sector_Pointer_VMG_PTL_MAIT, "sector pointer to VMG_PTL_MAIT (Parental Management masks)"); Get_B4 (Sector_Pointer_VMG_VTS_ATRT, "sector pointer to VMG_VTS_ATRT (copies of VTS audio/sub-picture attributes)"); Get_B4 (Sector_Pointer_VMG_TXTDT_MG, "sector pointer to VMG_TXTDT_MG (text data)"); Get_B4 (Sector_Pointer_VMGM_C_ADT, "sector pointer to VMGM_C_ADT (menu cell address table)"); Get_B4 (Sector_Pointer_VMGM_VOBU_ADMAP, "sector pointer to VMGM_VOBU_ADMAP (menu VOBU address map)"); Skip_XX(32, "Unknown"); Element_End0(); //-VTSM VTS_Attributes_AreHere=true; Element_Begin1("VMGM (VMG for Menu)"); Element_Begin1("Video streams"); Element_Info2(1, " streams"); SUBELEMENT(Video) Element_End0(); Element_Begin1("Audio streams"); Get_B2 (Audio_Count, "number of audio streams in VMGM_VOBS"); Element_Info2(Audio_Count, " streams"); for (int16u Pos=0; Pos<8; Pos++) { if (Pos0x001F) return; Sectors.resize(Sector_Pointer_LastSector+1); if (Sector_Pointer_TT_SRPT<=Sector_Pointer_LastSector) Sectors[Sector_Pointer_TT_SRPT]=Sector_TT_SRPT; if (Sector_Pointer_VMGM_PGCI_UT<=Sector_Pointer_LastSector) Sectors[Sector_Pointer_VMGM_PGCI_UT]=Sector_VMGM_PGCI_UT; if (Sector_Pointer_VMG_PTL_MAIT<=Sector_Pointer_LastSector) Sectors[Sector_Pointer_VMG_PTL_MAIT]=Sector_VMG_PTL_MAIT; if (Sector_Pointer_VMG_VTS_ATRT<=Sector_Pointer_LastSector) Sectors[Sector_Pointer_VMG_VTS_ATRT]=Sector_VMG_VTS_ATRT; if (Sector_Pointer_VMG_TXTDT_MG<=Sector_Pointer_LastSector) Sectors[Sector_Pointer_VMG_TXTDT_MG]=Sector_VMG_TXTDT_MG; if (Sector_Pointer_VMGM_C_ADT<=Sector_Pointer_LastSector) Sectors[Sector_Pointer_VMGM_C_ADT]=Sector_VMGM_C_ADT; if (Sector_Pointer_VMGM_VOBU_ADMAP<=Sector_Pointer_LastSector) Sectors[Sector_Pointer_VMGM_VOBU_ADMAP]=Sector_VMGM_VOBU_ADMAP; FILLING_END(); } //--------------------------------------------------------------------------- void File_Dvdv::VTS() { //Parsing int32u Sector_Pointer_LastSector, Sector_Pointer_VTS_PTT_SRPT, Sector_Pointer_VTS_PGCI, Sector_Pointer_VTSM_PGCI_UT, Sector_Pointer_VTS_TMAPTI, Sector_Pointer_VTSM_C_ADT, Sector_Pointer_VTSM_VOBU_ADMAP, Sector_Pointer_VTS_C_ADT, Sector_Pointer_VTS_VOBU_ADMAP; int16u Version, Audio_Count, Text_Count; Element_Info1("DVD Video - VTS (Video Title Set)"); Element_Begin1("Header"); Info_B4(LastSector, "Last sector of Title set (last sector of BUP)"); Param_Info2((LastSector+1)*2048, " bytes"); Skip_XX(12, "Unknown"); Get_B4 (Sector_Pointer_LastSector, "last sector of IFO"); Get_B2 (Version, "version number"); Param_Info1(Ztring::ToZtring((Version&0x00F0)>>4)+__T(".")+Ztring::ToZtring(Version&0x000F)); Info_B4(Category, "VTS category"); #if MEDIAINFO_TRACE if (Category<2) Param_Info1(IFO_VTS_Category[Category]); #endif //MEDIAINFO_TRACE Skip_XX(90, "Unknown"); Skip_B4( "end byte address of VTS_MAT"); Skip_XX(60, "Unknown"); Info_B4(StartSector_Menu, "start sector of Menu VOB"); Param_Info2((StartSector_Menu+1)*2048, " bytes"); Info_B4(StartSector_Title, "start sector of Title Vob"); Param_Info2((StartSector_Title+1)*2048, " bytes"); Get_B4 (Sector_Pointer_VTS_PTT_SRPT, "sector pointer to VTS_PTT_SRPT (Table of Titles and Chapters)"); Get_B4 (Sector_Pointer_VTS_PGCI, "sector pointer to VTS_PGCI (Title Program Chain table)"); Get_B4 (Sector_Pointer_VTSM_PGCI_UT, "sector pointer to VTSM_PGCI_UT (Menu Program Chain table)"); Get_B4 (Sector_Pointer_VTS_TMAPTI, "sector pointer to VTS_TMAPTI (Time map)"); Get_B4 (Sector_Pointer_VTSM_C_ADT, "sector pointer to VTSM_C_ADT (Menu cell address table)"); Get_B4 (Sector_Pointer_VTSM_VOBU_ADMAP, "sector pointer to VTSM_VOBU_ADMAP(menu VOBU address map)"); Get_B4 (Sector_Pointer_VTS_C_ADT, "sector pointer to VTS_C_ADT (Title set cell address table)"); Get_B4 (Sector_Pointer_VTS_VOBU_ADMAP, "sector pointer to VTS_VOBU_ADMAP (Title set VOBU address map)"); Skip_XX(24, "Unknown"); Element_End0(); //-VTSM Element_Begin1("VTSM (VTS for Menu, Vob 0)"); Element_Begin1("Video streams"); Element_Info2(1, " streams"); SUBELEMENT(Video) Element_End0(); Element_Begin1("Audio streams"); Get_B2 (Audio_Count, "number of audio streams in VTSM_VOBS"); Element_Info2(Audio_Count, " streams"); for (int16u Pos=0; Pos<8; Pos++) { if (Pos0x001F) return; if (Sector_Pointer_LastSector==(int32u)-1 || Sector_Pointer_LastSector+1>File_Size/2048) Sector_Pointer_LastSector=(int32u)(File_Size/2048); Sectors.resize(Sector_Pointer_LastSector+1); if (Sector_Pointer_VTS_PTT_SRPT<=Sector_Pointer_LastSector) Sectors[Sector_Pointer_VTS_PTT_SRPT]=Sector_VTS_PTT_SRPT; if (Sector_Pointer_VTS_PGCI<=Sector_Pointer_LastSector) Sectors[Sector_Pointer_VTS_PGCI]=Sector_VTS_PGCI; if (Sector_Pointer_VTSM_PGCI_UT<=Sector_Pointer_LastSector) Sectors[Sector_Pointer_VTSM_PGCI_UT]=Sector_VTSM_PGCI_UT; if (Sector_Pointer_VTS_TMAPTI<=Sector_Pointer_LastSector) Sectors[Sector_Pointer_VTS_TMAPTI]=Sector_VTS_TMAPTI; if (Sector_Pointer_VTSM_C_ADT<=Sector_Pointer_LastSector) Sectors[Sector_Pointer_VTSM_C_ADT]=Sector_VTSM_C_ADT; if (Sector_Pointer_VTSM_VOBU_ADMAP<=Sector_Pointer_LastSector) Sectors[Sector_Pointer_VTSM_VOBU_ADMAP]=Sector_VTSM_VOBU_ADMAP; if (Sector_Pointer_VTS_C_ADT<=Sector_Pointer_LastSector) Sectors[Sector_Pointer_VTS_C_ADT]=Sector_VTS_C_ADT; if (Sector_Pointer_VTS_VOBU_ADMAP<=Sector_Pointer_LastSector) Sectors[Sector_Pointer_VTS_VOBU_ADMAP]=Sector_VTS_VOBU_ADMAP; FILLING_END(); } //--------------------------------------------------------------------------- void File_Dvdv::Video() { //Parsing int32u Codec, Standard, AspectRatio, Resolution, BitRate_Mode; BS_Begin(); Get_BS (2, Codec, "Coding mode"); Param_Info1(IFO_CodecV[Codec]); Get_BS (2, Standard, "Standard"); Param_Info1(IFO_Standard[Standard]); Get_BS (2, AspectRatio, "Aspect ratio"); Param_Info1(IFO_AspectRatio[AspectRatio]); Info_BS(1, Pan, "Automatic Pan/Scan"); Param_Info1(Pan?"No":"Yes"); Info_BS(1, Letter, "Automatic Letterbox"); Param_Info1(Letter?"No":"Yes"); Skip_BS(1, "CC for line 21 field 1 in GOP (NTSC only)"); Skip_BS(1, "CC for line 21 field 2 in GOP (NTSC only)"); Get_BS (3, Resolution, "Resolution"); Param_Info1(Ztring::ToZtring(IFO_Width[Resolution])+__T("x")+Ztring::ToZtring(IFO_Height[Standard][Resolution])); Info_BS(1, Letterboxed, "Letterboxed"); Param_Info1(Letter?"Yes":"No"); Get_BS (1, BitRate_Mode, "Bitrate mode"); Param_Info1(IFO_BitRate_Mode[BitRate_Mode]); Info_BS(1, Camera, "Camera/Film"); Param_Info1(Letter?"Film":"Camera"); BS_End(); //Filling FILLING_BEGIN(); if (VTS_Attributes_AreHere) { Stream_Prepare(Stream_Video); Fill(Stream_Video, StreamPos_Last, Video_Format, IFO_Format_V[Codec]); Fill(Stream_Video, StreamPos_Last, Video_Format_Version, IFO_Format_Version_V[Codec]); Fill(Stream_Video, StreamPos_Last, Video_Codec, IFO_CodecV[Codec]); Fill(Stream_Video, StreamPos_Last, Video_Width, IFO_Width[Resolution]); Fill(Stream_Video, StreamPos_Last, Video_Height, IFO_Height[Standard][Resolution]); Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, IFO_AspectRatio[AspectRatio], 3, true); Fill(Stream_Video, StreamPos_Last, Video_FrameRate, IFO_FrameRate[Standard]); Fill(Stream_Video, StreamPos_Last, Video_BitRate_Mode, IFO_BitRate_Mode[BitRate_Mode]); Fill(Stream_Video, StreamPos_Last, General_ID, __T("224")); Fill(Stream_Video, StreamPos_Last, General_ID_String, __T("224 (0xE0)"), Unlimited, true); } FILLING_END(); } //--------------------------------------------------------------------------- void File_Dvdv::Audio() { //Parsing Ztring Language; int32u Codec, LanguageType, Mode, Resolution, SamplingRate, Channels; int8u Language_Extension, ChannelsK=(int8u)-1; BS_Begin(); Get_BS (3, Codec, "Coding mode"); Param_Info1(IFO_CodecA[Codec]); Info_BS(1, MultiChannel, "Multichannel extension present"); Param_Info1(MultiChannel?"Yes":"No"); Get_BS (2, LanguageType, "Language type"); Param_Info1(LanguageType==1?"2CC":"Unknown"); Get_BS (2, Mode, "Application mode"); Param_Info1(IFO_ModeA[Mode]); Get_BS (2, Resolution, "Resolution"); Param_Info1C((Codec==2 || Codec==3), IFO_ResolutionA[Resolution]); Param_Info1C((Codec==4), Mode?"DRC":"No DRC"); Get_BS (2, SamplingRate, "Sampling rate"); Param_Info1(Ztring::ToZtring(IFO_SamplingRate[SamplingRate])); Get_BS (4, Channels, "Channels"); Param_Info2(Channels+1, " channels"); BS_End(); Get_Local(3, Language, "Language code"); if (!Language.empty() && Language[0]>=0x80) Language.clear(); //this is 0xFF... if (Language==__T("iw")) Language=__T("he"); //Hebrew patch, is "iw" in DVDs Get_B1 (Language_Extension, "Language extension"); Param_Info1C((Language_Extension<8), IFO_Language_MoreA[Language_Extension]); Skip_B1( "Unknown"); switch (Mode) { case 1 : //Karaoke { BS_Begin(); Skip_BS(1, "Zero"); Get_S1 (3, ChannelsK, "Channels"); #ifdef MEDIAINFO_AC3_YES Param_Info1(AC3_ChannelPositions[ChannelsK]); #endif //MEDIAINFO_AC3_YES Skip_BS(2, "Version"); Info_BS(1, MC, "MC intro present"); Param_Info1(MC?"Yes":"No"); Info_BS(1, Duet, "Duet"); Param_Info1(Duet?"Duet":"Solo"); BS_End(); } break; case 2 : //Surround { BS_Begin(); Skip_BS(4, "Reserved"); Info_BS(1, DolbyDecode, "Suitable for Dolby surround decoding"); Param_Info1(DolbyDecode?"Yes":"No"); Skip_BS(3, "Reserved"); BS_End(); } break; default: { Skip_B1( "Reserved"); } } //Filling FILLING_BEGIN(); if (VTS_Attributes_AreHere) { Stream_Prepare(Stream_Audio); Fill(Stream_Audio, StreamPos_Last, Audio_Format, IFO_Format_A[Codec]); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Profile, IFO_Format_Profile_A[Codec]); Fill(Stream_Audio, StreamPos_Last, Audio_Codec, IFO_CodecA[Codec]); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, IFO_SamplingRate[SamplingRate]); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Channels+1); if (Codec==3) Fill(Stream_Audio, StreamPos_Last, Audio_BitDepth, IFO_ResolutionA[Resolution]); else if (Codec==4 && Mode) Fill(Stream_Audio, StreamPos_Last, Audio_BitDepth, "DRC"); Fill(Stream_Audio, StreamPos_Last, Audio_Language, Language); if (Language_Extension<8) Fill(Stream_Audio, StreamPos_Last, Audio_Language_More, IFO_Language_MoreA[Language_Extension]); #ifdef MEDIAINFO_AC3_YES if (Codec==0 && ChannelsK!=(int8u)-1) //AC-3 { Fill(Stream_Audio, 0, Audio_ChannelPositions, AC3_ChannelPositions[ChannelsK]); Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, AC3_ChannelPositions2[ChannelsK]); } #endif //MEDIAINFO_AC3_YES } FILLING_END(); } //--------------------------------------------------------------------------- void File_Dvdv::Text() { //Parsing Ztring Language; int32u Codec, LanguageType; int8u Language_Extension; BS_Begin(); Get_BS (3, Codec, "Coding mode"); Param_Info1(IFO_CodecT[Codec]); Skip_BS(3, "Reserved"); Get_BS (2, LanguageType, "Language type"); Param_Info1(LanguageType==1?"2CC":"Unknown"); BS_End(); Skip_B1( "Reserved"); Get_Local(3, Language, "Language code"); if (!Language.empty() && Language[0]>=0x80) Language.clear(); //this is 0xFF... if (Language==__T("iw")) Language=__T("he"); //Hebrew patch, is "iw" in DVDs Get_B1 (Language_Extension, "Language extension"); Param_Info1C((Language_Extension<16), IFO_Language_MoreT[Language_Extension]); //Filling FILLING_BEGIN(); if (VTS_Attributes_AreHere) { Stream_Prepare(Stream_Text); Fill(Stream_Text, StreamPos_Last, Text_Format, IFO_Format_T[Codec]); Fill(Stream_Text, StreamPos_Last, Text_BitDepth, IFO_Resolution_T[Codec]); Fill(Stream_Text, StreamPos_Last, Text_Codec, IFO_CodecT[Codec]); Fill(Stream_Text, StreamPos_Last, Text_Language, Language); if (Language_Extension<16) Fill(Stream_Text, StreamPos_Last, Text_Language_More, IFO_Language_MoreT[Language_Extension]); } FILLING_END(); } //--------------------------------------------------------------------------- void File_Dvdv::MultiChannel() { //Parsing BS_Begin(); Element_Begin1("ACH0"); Skip_BS(7, "Reserved"); Skip_BS(1, "ACH0 Guide Melody exists"); Element_End0(); Element_Begin1("ACH1"); Skip_BS(7, "Reserved"); Skip_BS(1, "ACH1 Guide Melody exists"); Element_End0(); Element_Begin1("ACH2"); Skip_BS(4, "Reserved"); Skip_BS(1, "ACH2 Guide Vocal 1 exists"); Skip_BS(1, "ACH2 Guide Vocal 2 exists"); Skip_BS(1, "ACH2 Guide Melody 1 exists"); Skip_BS(1, "ACH2 Guide Melody 2 exists"); Element_End0(); Element_Begin1("ACH3"); Skip_BS(4, "Reserved"); Skip_BS(1, "ACH3 Guide Vocal 1 exists"); Skip_BS(1, "ACH3 Guide Vocal 2 exists"); Skip_BS(1, "ACH3 Guide Melody A exists"); Skip_BS(1, "ACH3 Sound Effect A exists"); Element_End0(); Element_Begin1("ACH4"); Skip_BS(4, "Reserved"); Skip_BS(1, "ACH4 Guide Vocal 1 exists"); Skip_BS(1, "ACH4 Guide Vocal 2 exists"); Skip_BS(1, "ACH4 Guide Melody B exists"); Skip_BS(1, "ACH4 Sound Effect B exists"); Element_End0(); BS_End(); Skip_XX(19, "Unknown"); } //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- void File_Dvdv::Header_Parse() { //Calculating size_t Sector_Pos=(size_t)((File_Offset+Buffer_Offset)/2048); size_t Sector_Count=1; while (Sector_Pos+Sector_Count=Sectors.size()) { Accept("DVD Video"); Finish("DVD Video"); return; } //Parsing switch(Sectors[Sector_Pos]) { case Sector_VTS_PTT_SRPT : VTS_PTT_SRPT(); break; case Sector_VTS_PGCI : VTS_PGCI(); break; case Sector_VTSM_PGCI_UT : VTSM_PGCI_UT(); break; case Sector_VTS_TMAPTI : VTS_TMAPTI(); break; case Sector_VTSM_C_ADT : VTSM_C_ADT(); break; case Sector_VTSM_VOBU_ADMAP : VTSM_VOBU_ADMAP(); break; case Sector_VTS_C_ADT : VTS_C_ADT(); break; case Sector_VTS_VOBU_ADMAP : VTS_VOBU_ADMAP(); break; case Sector_TT_SRPT : TT_SRPT(); break; case Sector_VMGM_PGCI_UT : VMGM_PGCI_UT(); break; case Sector_VMG_PTL_MAIT : VMG_PTL_MAIT(); break; case Sector_VMG_VTS_ATRT : VMG_VTS_ATRT(); break; case Sector_VMG_TXTDT_MG : VMG_TXTDT_MG(); break; case Sector_VMGM_C_ADT : VMGM_C_ADT(); break; case Sector_VMGM_VOBU_ADMAP : VMGM_VOBU_ADMAP(); break; default : ; } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Dvdv::VTS_PTT_SRPT () { Element_Name("Table of Titles and Chapters"); //Parsing int32u Element_RealSize; Element_Begin1("Header"); Skip_B2( "Count of elements"); Skip_B2( "Unknown"); Get_B4 (Element_RealSize, "End address"); Element_RealSize++; //Last byte Element_End0(); Element_Begin1("Extra data"); int32u Offset; Get_B4 (Offset, "Offset of first element"); int64u Extra_Size=Offset-Element_Offset; if (Extra_Size>0) Skip_XX(Extra_Size, "Extra data (Unknown)"); Element_End0(); //For each chapter while (Element_Offset=Element_Size) EndAddress=(int32u)Element_Size-1; Element_Begin1("PGC category"); BS_Begin(); Skip_BS(1, "entry PGC"); Skip_BS(7, "title number"); BS_End(); Skip_B1( "Unknown"); Skip_B2( "parental management mask"); Element_End0(); Get_B4 (Offset, "offset to VTS_PGC - relative to VTS_PGCI"); if (Offset-16>0) Skip_XX(Offset-16, "Unknown"); Element_End0(); //For each Program //DETAILLEVEL_SET(1.0); while (Element_Offset<=EndAddress) { PGC(Offset, true); } } //--------------------------------------------------------------------------- void File_Dvdv::VTSM_PGCI_UT () { Element_Name("Menu Program Chain table"); //Parsing int16u LU_Count; Element_Begin1("Header"); int32u EndAddress, Offset; int8u Flags; Get_B2 (LU_Count, "Number of Language Units"); Skip_B2( "Reserved"); Get_B4 (EndAddress, "End address"); if (EndAddress>=Element_Size) EndAddress=(int32u)Element_Size-1; Skip_C3( "Language"); Get_B1 (Flags, "Menu existence flags"); Skip_Flags(Flags, 3, "PTT"); Skip_Flags(Flags, 4, "angle"); Skip_Flags(Flags, 5, "audio"); Skip_Flags(Flags, 6, "sub-picture"); Skip_Flags(Flags, 7, "root"); Get_B4 (Offset, "Offset to VTSM_LU relative to VTSM_PGCI_UT"); if (Offset-16>0) Skip_XX(Offset-16, "Unknown"); Element_End0(); for (int16u LU_Pos=0; LU_Pos0) Skip_XX(Offset-16, "Unknown"); Element_End0(); for (int16u PGC_Pos=0; PGC_Pos=Element_Size) EndAddress=(int32u)Element_Size-1; Get_B4 (Offset, "Offset to VTS_TMAP 1"); if (Offset-12>0) Skip_XX(Offset-12, "Unknown"); Element_End0(); //DETAILLEVEL_SET(1.0); while (Element_Offset<=EndAddress) { //VTS_TMAP Element_Begin1("Time Map"); //std::vector Sector_Times; int8u Sector_Times_SecondsPerTime; int16u Count; Get_B1 (Sector_Times_SecondsPerTime, "Time unit (seconds)"); Skip_B1( "Unknown"); Get_B2 (Count, "Number of entries in map"); //Sector_Times.resize(Count); BS_Begin(); for (int16u Pos=0; Pos=Element_Size) EndAddress=(int32u)Element_Size-1; Element_End0(); //DETAILLEVEL_SET(1.0); while (Element_Offset<=EndAddress) { //ADT Element_Begin1("Entry"); Skip_B2( "VOBidn"); Skip_B1( "CELLidn"); Skip_B1( "Unknown"); Skip_B4( "Starting sector within VOB"); Skip_B4( "Ending sector within VOB"); Element_End0(); } } //--------------------------------------------------------------------------- void File_Dvdv::VTSM_VOBU_ADMAP () { Element_Name("Menu VOBU address map"); //Parsing int32u EndAddress; Element_Begin1("Header"); Get_B4 (EndAddress, "End address"); if (EndAddress>=Element_Size) EndAddress=(int32u)Element_Size-1; Element_End0(); //DETAILLEVEL_SET(1.0); while (Element_Offset<=EndAddress) { //ADMAP Skip_B4( "Starting sector within VOB of first VOBU"); } } //--------------------------------------------------------------------------- void File_Dvdv::VTS_C_ADT () { Element_Name("Title set cell address table"); //Parsing int32u EndAddress; Element_Begin1("Header"); Skip_B2( "Number of cells"); Skip_B2( "Reserved"); Get_B4 (EndAddress, "End address"); if (EndAddress>=Element_Size) EndAddress=(int32u)Element_Size-1; Element_End0(); //DETAILLEVEL_SET(1.0); while (Element_Offset<=EndAddress) { //ADT Element_Begin1("Entry"); int32u Start, End; int16u VOBidn; int8u CELLidn; Get_B2 (VOBidn, "VOBidn"); Get_B1 (CELLidn, "CELLidn"); Skip_B1( "Unknown"); Get_B4 (Start, "Starting sector within VOB"); Param_Info1(Time_ADT(Start)); Get_B4 (End, "Ending sector within VOB"); Param_Info1(Time_ADT(End)); Element_End0(); //Filling FILLING_BEGIN(); FILLING_END(); //Fill(Ztring::ToZtring(CELLidn).To_Local().c_str(), Time_ADT(Start)); } } //--------------------------------------------------------------------------- void File_Dvdv::VTS_VOBU_ADMAP () { Element_Name("Title set VOBU address map"); //Parsing int32u EndAddress; Element_Begin1("Header"); Get_B4 (EndAddress, "End address"); if (EndAddress>=Element_Size) EndAddress=(int32u)Element_Size-1; Element_End0(); //DETAILLEVEL_SET(1.0); while (Element_Offset Stream_Control_Audio; vector Stream_Control_SubPicture_43; vector Stream_Control_SubPicture_Wide; vector Stream_Control_SubPicture_Letterbox; vector Stream_Control_SubPicture_PanScan; vector CellDurations; vector ProgramMap; //VTS_PGC Element_Begin1("PGC"); int16u commands, program_map, cell_playback, cell_position; int8u Program_Count; Element_Begin1("Header"); int32u Flags; int8u Cells; int64u TotalDuration; Skip_B2( "Unknown"); Get_B1 (Program_Count, "number of programs"); Get_B1 (Cells, "number of cells"); Get_Duration(TotalDuration, "Duration"); Get_B4 (Flags, "prohibited user ops"); /*Skip_Flags(Flags, 0, "Time play or search"); Skip_Flags(Flags, 1, PTT play or search); Skip_Flags(Flags, 2, Title play); Skip_Flags(Flags, 3, Stop); Skip_Flags(Flags, 4, GoUp); Skip_Flags(Flags, 5, Time or PTT search); Skip_Flags(Flags, 6, TopPG or PrevPG search); Skip_Flags(Flags, 7, NextPG search); Skip_Flags(Flags, 8, Forward scan); Skip_Flags(Flags, 9, Backward scan); Skip_Flags(Flags, 10, Menu call - Title); Skip_Flags(Flags, 11, Menu call - Root); Skip_Flags(Flags, 12, Menu call - Subpicture); Skip_Flags(Flags, 13, Menu call - Audio); Skip_Flags(Flags, 14, Menu call - Angle); Skip_Flags(Flags, 15, Menu call - PTT); Skip_Flags(Flags, 16, Resume); Skip_Flags(Flags, 17, Button select or activate); Skip_Flags(Flags, 18, Still off); Skip_Flags(Flags, 19, Pause on); Skip_Flags(Flags, 20, Audio stream change); Skip_Flags(Flags, 21, Subpicture stream change); Skip_Flags(Flags, 22, Angle change); Skip_Flags(Flags, 23, Karaoke audio mix change); Skip_Flags(Flags, 24, Video presentation mode change); */ /* Skip_Flags(Flags, 0, Video presentation mode change); Skip_Flags(Flags, 1, Karaoke audio mix change); Skip_Flags(Flags, 2, Angle change); Skip_Flags(Flags, 3, Subpicture stream change); Skip_Flags(Flags, 4, Audio stream change); Skip_Flags(Flags, 5, Pause on); Skip_Flags(Flags, 6, Still off); Skip_Flags(Flags, 7, Button select or activate); Skip_Flags(Flags, 8, Resume); Skip_Flags(Flags, 9, Menu call - PTT); Skip_Flags(Flags, 10, Menu call - Angle); Skip_Flags(Flags, 11, Menu call - Audio); Skip_Flags(Flags, 12, Menu call - Subpicture); Skip_Flags(Flags, 13, Menu call - Root); Skip_Flags(Flags, 14, Menu call - Title); Skip_Flags(Flags, 15, Backward scan); Skip_Flags(Flags, 16, Forward scan); Skip_Flags(Flags, 17, NextPG search); Skip_Flags(Flags, 18, TopPG or PrevPG search); Skip_Flags(Flags, 19, Time or PTT search); Skip_Flags(Flags, 20, GoUp); Skip_Flags(Flags, 21, Stop); Skip_Flags(Flags, 22, Title play); Skip_Flags(Flags, 23, PTT play or search); Skip_Flags(Flags, 24, Time play or search); */ Element_Begin1("Audio Stream Controls"); for (size_t Pos=0; Pos<8; Pos++) { Element_Begin1("Audio Stream Control"); Element_Info1(Ztring::ToZtring(Pos)); int8u Number; bool Available; BS_Begin(); Get_SB ( Available, "Stream available"); Get_S1 (7, Number, "Stream number"); BS_End(); Skip_B1( "Reserved"); Element_End0(); if (Available) Stream_Control_Audio.push_back(Number); if (Available && Retrieve(Stream_Audio, Pos, Text_ID).empty() && Sectors[(size_t)((File_Offset+Buffer_Offset)/2048)]==Sector_VTS_PGCI) { while (Pos>Count_Get(Stream_Audio)) Stream_Prepare(Stream_Audio); int8u ToAdd=0; if (Retrieve(Stream_Audio, Pos, Audio_Format)==__T("AC-3")) ToAdd=0x80; if (Retrieve(Stream_Audio, Pos, Audio_Format)==__T("DTS")) ToAdd=0x88; if (Retrieve(Stream_Audio, Pos, Audio_Format)==__T("LPCM")) ToAdd=0xA0; Ztring ID_String; ID_String.From_Number(ToAdd+Number); ID_String+=__T(" (0x"); ID_String+=Ztring::ToZtring(ToAdd+Number, 16); ID_String+=__T(")"); Fill(Stream_Audio, Pos, Audio_ID, ID_String); Fill(Stream_Audio, Pos, Audio_ID_String, ID_String, true); } } Element_End0(); Element_Begin1("Subpicture Stream Controls"); for (size_t Pos=0; Pos<32; Pos++) { Element_Begin1("Subpicture Stream Control"); Element_Info1(Ztring::ToZtring(Pos)); int8u Number_43, Number_Wide, Number_Letterbox, Number_PanScan; bool Available; BS_Begin(); Get_SB ( Available, "Stream available"); Get_S1 (7, Number_43, "Stream number for 4/3"); BS_End(); Get_B1 (Number_Wide, "Stream number for Wide"); Get_B1 (Number_Letterbox, "Stream number for Letterbox"); Get_B1 (Number_PanScan, "Stream number for Pan&Scan"); Element_End0(); if (Available) { Stream_Control_SubPicture_43.push_back(Number_43); Stream_Control_SubPicture_Wide.push_back(Number_Wide); Stream_Control_SubPicture_Letterbox.push_back(Number_Letterbox); Stream_Control_SubPicture_PanScan.push_back(Number_PanScan); } if (Available && Retrieve(Stream_Text, Pos, Text_ID).empty() && Sectors[(size_t)((File_Offset+Buffer_Offset)/2048)]==Sector_VTS_PGCI) { while (Pos>Count_Get(Stream_Text)) Stream_Prepare(Stream_Text); Ztring ID_String; ID_String.From_Number(0x20+Number_Wide); ID_String+=__T(" (0x"); ID_String+=Ztring::ToZtring(0x20+Number_Wide, 16); ID_String+=__T(")"); Fill(Stream_Text, Pos, Text_ID, ID_String); Fill(Stream_Text, Pos, Text_ID_String, ID_String, true); } } Element_End0(); Skip_B2( "next PGCN"); Skip_B2( "previous PGCN"); Skip_B2( "goup PGCN"); Skip_B1( "PGC still time - 255=infinite"); Skip_B1( "PG playback mode"); Element_Begin1("palette"); for (int Pos=0; Pos<16; Pos++) { Skip_B4( "palette (0 - Y - Cr - Cb)"); } Element_End0(); Get_B2 (commands, "offset within PGC to commands"); Get_B2 (program_map, "offset within PGC to program map"); Get_B2 (cell_playback, "offset within PGC to cell playback information table"); Get_B2 (cell_position, "offset within PGC to cell position information table"); Element_End0(); //commands if (commands>0) { if (Element_OffsetElement_Size) { Skip_XX(Element_Size-Element_Offset, "Unknown"); return; } Skip_XX(Offset+commands-Element_Offset, "Unknown"); } Element_Begin1("commands"); int16u PreCommands_Count, PostCommands_Count, CellCommands_Count, EndAdress; Get_B2 (PreCommands_Count, "Number of pre commands"); Get_B2 (PostCommands_Count, "Number of post commands"); Get_B2 (CellCommands_Count, "Number of cell commands"); Get_B2 (EndAdress, "End address relative to command table"); if (PreCommands_Count>0) { Element_Begin1("Pre commands"); for (int16u Pos=0; Pos0) { Element_Begin1("Post commands"); for (int16u Pos=0; Pos0) { Element_Begin1("Cell commands"); for (int16u Pos=0; Pos0) { if (Element_Offset0) { if (Element_Offset0) { if (Element_Offset=Program_Count) End=Cells+1; else End=ProgramMap[Pos+1]; int64u ProgramDuration=0; if (Pos=Element_Size) EndAddress=(int32u)Element_Size-1; Get_B4 (Offset, "Offset to VTSM_LU relative to VTSM_PGCI_UT"); if (Offset-12>0) Skip_XX(Offset-12, "Unknown"); Element_End0(); while (Element_Offset<=EndAddress) { Element_Begin1("VTS_ATRT"); Element_Begin1("Header"); int32u Size; Get_B4 (Size, "End address"); Size++; //Last byte Element_End0(); Element_Begin1("Copy of VTS Category"); Skip_B4( "VTS Category"); Element_End0(); Element_Begin1("Copy of VTS attributes"); Skip_XX(Size-8, "VTS attributes"); Element_End0(); Element_End0(); } } //--------------------------------------------------------------------------- void File_Dvdv::VMG_TXTDT_MG() { Element_Name("text data"); } //--------------------------------------------------------------------------- void File_Dvdv::VMGM_C_ADT() { Element_Name("menu cell address table"); } //--------------------------------------------------------------------------- void File_Dvdv::VMGM_VOBU_ADMAP() { Element_Name("menu VOBU address map"); } } //NameSpace #endif //MEDIAINFO_DVDV_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Dvdv.h100777 0 0 6200 12226004262 15352 0/* 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 DVD objects // (.ifo files on DVD-Video) // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_DvdvH #define MediaInfo_File_DvdvH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Dvdv //*************************************************************************** class File_Dvdv : public File__Analyze { protected : //Streams management void Streams_Finish(); public : File_Dvdv(); private : //Buffer void FileHeader_Parse (); void Header_Parse(); void Data_Parse(); //Elements void VMG(); void VTS(); void VTS_PTT_SRPT(); void VTS_PGCI(); void VTSM_PGCI_UT(); void VTS_TMAPTI(); void VTSM_C_ADT(); void VTSM_VOBU_ADMAP(); void VTS_C_ADT(); void VTS_VOBU_ADMAP(); void TT_SRPT(); void VMGM_PGCI_UT(); void VMG_PTL_MAIT(); void VMG_VTS_ATRT(); void VMG_TXTDT_MG(); void VMGM_C_ADT(); void VMGM_VOBU_ADMAP(); void Video(); void Audio(); void Text(); void MultiChannel(); //Temp bool VTS_Attributes_AreHere; //std::vector Sectors; //std::vector > Sectors_Times; //std::vector Sectors_Times_SecondsPerTime; enum sector { Sector_Nothing, Sector_VTS_PTT_SRPT, Sector_VTS_PGCI, Sector_VTSM_PGCI_UT, Sector_VTS_TMAPTI, Sector_VTSM_C_ADT, Sector_VTSM_VOBU_ADMAP, Sector_VTS_C_ADT, Sector_VTS_VOBU_ADMAP, Sector_TT_SRPT, Sector_VMGM_PGCI_UT, Sector_VMG_PTL_MAIT, Sector_VMG_VTS_ATRT, Sector_VMG_TXTDT_MG, Sector_VMGM_C_ADT, Sector_VMGM_VOBU_ADMAP, }; std::vector Sectors; //Helpers Ztring Time_ADT(int32u Value); size_t Program_Pos; size_t Time_Pos; void Get_Duration(int64u &Duration, const Ztring &Name); Ztring Time_String; //Value from Time_*() void PGC(int64u Offset, bool Title=false); }; //*************************************************************************** // Const //*************************************************************************** namespace Dvdv { const int32u VMG=0x2D564D47; const int32u VTS=0x2D565453; } } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Dxw.cpp100777 0 0 16752 12226004262 15601 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DXW_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Dxw.h" #include "MediaInfo/MediaInfo.h" #include "MediaInfo/MediaInfo_Internal.h" #include "MediaInfo/Multiple/File__ReferenceFilesHelper.h" #include "ZenLib/Dir.h" #include "ZenLib/FileName.h" #include "ZenLib/Format/Http/Http_Utils.h" #include "tinyxml2.h" using namespace tinyxml2; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Dxw::File_Dxw() :File__Analyze() { #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_None; //TODO StreamIDs_Width[0]=sizeof(size_t)*2; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_EventWasSent_Accept_Specific=true; #endif //MEDIAINFO_DEMUX //Temp ReferenceFiles=NULL; } //--------------------------------------------------------------------------- File_Dxw::~File_Dxw() { delete ReferenceFiles; //ReferenceFiles=NULL; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Dxw::Streams_Finish() { if (ReferenceFiles==NULL) return; ReferenceFiles->ParseReferences(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_Dxw::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { if (ReferenceFiles==NULL) return 0; return ReferenceFiles->Read_Buffer_Seek(Method, Value, ID); } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Dxw::FileHeader_Begin() { XMLDocument document; if (!FileHeader_Begin_XML(document)) return false; { XMLElement* Root=document.FirstChildElement("indexFile"); if (Root) { const char* Attribute=Root->Attribute("xmlns"); if (Attribute==NULL || Ztring().From_UTF8(Attribute)!=__T("urn:digimetrics-xml-wrapper")) { Reject("DXW"); return false; } Accept("DXW"); Fill(Stream_General, 0, General_Format, "DXW"); ReferenceFiles=new File__ReferenceFilesHelper(this, Config); XMLElement* Track=Root->FirstChildElement(); while (Track) { if (string(Track->Value())=="clip") { File__ReferenceFilesHelper::reference ReferenceFile; Attribute=Track->Attribute("file"); if (Attribute) { ReferenceFile.FileNames.push_back(Ztring().From_UTF8(Attribute)); Attribute=Track->Attribute("type"); if (Attribute) { Ztring StreamKind; StreamKind.From_UTF8(Attribute); if (StreamKind==__T("video")) ReferenceFile.StreamKind=Stream_Video; if (StreamKind==__T("audio")) ReferenceFile.StreamKind=Stream_Audio; if (StreamKind==__T("data")) ReferenceFile.StreamKind=Stream_Text; //Not sure this is a right mapping, but this is only used when file is missing } Attribute=Track->Attribute("source"); if (Attribute) { Ztring StreamKind; StreamKind.From_UTF8(Attribute); if (StreamKind==__T("main")) ReferenceFile.IsMain=true; } ReferenceFile.StreamID=ReferenceFiles->References.size()+1; } Attribute=Track->Attribute("framerate"); if (Attribute) { ReferenceFile.FrameRate=Ztring().From_UTF8(Attribute).To_float64(); Attribute=Track->Attribute("type"); if (Attribute) { Ztring StreamKind; StreamKind.From_UTF8(Attribute); if (StreamKind==__T("video")) ReferenceFile.StreamKind=Stream_Video; if (StreamKind==__T("audio")) ReferenceFile.StreamKind=Stream_Audio; if (StreamKind==__T("data")) ReferenceFile.StreamKind=Stream_Text; //Not sure this is a right mapping, but this is only used when file is missing } XMLElement* Frame=Track->FirstChildElement(); while (Frame) { if (string(Frame->Value())=="frame") { Attribute=Frame->Attribute("file"); if (Attribute) ReferenceFile.FileNames.push_back(Ztring().From_UTF8(Attribute)); } Frame=Frame->NextSiblingElement(); } } ReferenceFile.StreamID=ReferenceFiles->References.size()+1; ReferenceFiles->References.push_back(ReferenceFile); } Track=Track->NextSiblingElement(); } } else { Reject("DXW"); return false; } } Element_Offset=File_Size; Element_Offset=File_Size; //All should be OK... return true; } } //NameSpace #endif //MEDIAINFO_DXW_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Dxw.h100777 0 0 3065 12226004262 15217 0/* 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 DXW files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_DxwH #define MediaInfo_File_DxwH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { class File__ReferenceFilesHelper; //*************************************************************************** // Class File_Dxw //*************************************************************************** class File_Dxw : public File__Analyze { public : //Constructor/Destructor File_Dxw(); ~File_Dxw(); private : //Streams management void Streams_Finish (); //Buffer - Global #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK //Buffer - File header bool FileHeader_Begin(); //Temp File__ReferenceFilesHelper* ReferenceFiles; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Flv.cpp100777 0 0 156757 12226004262 15620 0/* 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. */ //--------------------------------------------------------------------------- // // Examples: // http://samples.mplayerhq.hu/FLV/ // // Reverse engineering // http://osflash.org/documentation/amf/astypes // //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_FLV_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Flv.h" #if defined(MEDIAINFO_AVC_YES) #include "MediaInfo/Video/File_Avc.h" #endif #if defined(MEDIAINFO_AAC_YES) #include "MediaInfo/Audio/File_Aac.h" #endif #if defined(MEDIAINFO_MPEGA_YES) #include "MediaInfo/Audio/File_Mpega.h" #endif #if defined(MEDIAINFO_RM_YES) #include "MediaInfo/Multiple/File_Rm.h" #endif #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events.h" #endif //MEDIAINFO_EVENTS #include //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- const int16u Flv_Channels[]= { 1, 2, }; const int16u Flv_Resolution[]= { 8, 16, }; const int16u Flv_SamplingRate[]= { 5500, 11025, 22050, 44100, 8000, //Special case for Nellymoser 8kHz mono }; const char* Flv_Format_Audio[16]= { "PCM", "ADPCM", "MPEG Audio", "PCM", "Nellymoser", //16 KHz "Nellymoser", //8 KHz "Nellymoser", "ADPCM", "ADPCM", "", "AAC", "Speex", "", "", "MPEG Audio", //8 KHz "", }; const char* Flv_Format_Profile_Audio[16]= { "", "", "Layer 3", "", "", "", "", "A-law", "U-law", "", "", "", "", "", "Layer 3", //8 KHz "", }; const char* Flv_Codec_Audio[16]= { "Uncompressed", "ADPCM", "MPEG-1 Audio Layer 3", "", "Nellymoser 16kHz mono", "Nellymoser 8kHz mono", "Nellymoser", "ADPCM", "ADPCM", "", "AAC", "Speex", "", "", "MPEG Audio Layer 3", "", }; const char* Flv_CodecID_Hint_Audio[16]= { "", "", "MP3", "", "", "", "", "", "", "", "", "", "", "", "MP3", //8 KHz "", }; const char* Flv_Format_Video[16]= { "", "", "Sorenson Spark", "Screen video", "VP6", "VP6", "Screen video 2", "AVC", "", "", "", "", "HEVC", "", "", "", }; const char* Flv_Format_Profile_Video[16]= { "", "", "", "", "", "Alpha channel", "", "", "", "", "", "", "", "", "", "", }; const char* Flv_Codec_Video[16]= { "", "", "Sorenson H263", "Screen video", "On2 VP6", "On2 VP6 with alpha channel", "Screen video 2", "AVC", "", "", "", "", "HEVC", "", "", "", }; const char* Flv_CodecID_Hint_Video[16]= { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }; const char* Flv_H263_PictureSize[]= { "custom, 1 byte", "custom, 2 bytes", "CIF (352x288)", "QCIF (176x144)", "SQCIF (128x96)", "320x240", "160x120", "", }; const int16u Flv_H263_WidthHeight[8][2]= { { 0, 0}, { 0, 0}, {352, 288}, {176, 144}, {128, 96}, {320, 240}, {160, 120}, {0, 0}, }; const char* Flv_H263_PictureType[]= { "IntraFrame", "InterFrame", "InterFrame (Disposable)", "", }; const char* Flv_VP6_FrameMode[]= { "IntraFrame", "", }; const char* Flv_VP6_Marker[]= { "VP6.1/6.2", "VP6.0", }; const char* Flv_VP6_Version[]= { "", "", "", "", "", "", "VP6.0/6.1", "VP6.0 (Electronic Arts)", "VP6.2", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }; const char* Flv_VP6_Version2[]= { "VP6.0", "", "", "VP6.1/6.2", }; const char* Flv_FrameType[]= { "", "KeyFrame", "InterFrame", "InterFrame (Disposable)", "", "", "", "", "", "", "", "", "", "", "", "", }; const char* Flv_TagType[]= { "DOUBLE", "UI8", "SCRIPTDATASTRING", "SCRIPTDATAOBJECT[n]", "SCRIPTDATASTRING defining the MovieClip path", "Null", "Undefined", "UI16", "SCRIPTDATAVARIABLE[ECMAArrayLength]", "EndOfObject", "SCRIPTDATAVARIABLE[n]", "SCRIPTDATADATE", "SCRIPTDATALONGSTRING", "Unsupported", "Recordset", "XML", "TypedObject", "AMF3 data", }; const char* Flv_Amf3Type[]= { "Undefined", "Null", "Boolean-false", "Boolean-true", "Integer", "Number", "String", "XML", "Data", "Array", "Object", "XML String", "ByteArray", }; const char* Flv_AVCPacketType(int8u Value) { switch (Value) { case 0 : return "AVC sequence header"; case 1 : return "NALU"; case 2 : return "end of sequence"; default: return ""; } } const char* Flv_AACPacketType(int8u Value) { switch (Value) { case 0 : return "AAC sequence header"; case 1 : return "AAC Raw"; default: return ""; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Flv::File_Flv() :File__Analyze() { //Configuration ParserName=__T("FLV"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Flv; StreamIDs_Width[0]=2; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_Level=2; //Container #endif //MEDIAINFO_DEMUX //Internal Stream.resize(3); //Null, Video, Audio //Temp Searching_Duration=false; MetaData_NotTrustable=false; PreviousTagSize=(int32u)-1; meta_filesize=(int64u)-1; meta_duration=0; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Flv::Streams_Fill() { //Coherency if (Count_Get(Stream_Video) && Count_Get(Stream_Audio) && !Retrieve(Stream_Video, 0, Video_BitRate).empty() && Retrieve(Stream_Audio, 0, Audio_BitRate).empty()) { Fill(Stream_General, 0, General_OverallBitRate, Retrieve(Stream_Video, 0, Video_BitRate)); Clear(Stream_Video, 0, Video_BitRate); } //Trying to detect VFR std::vector video_stream_FrameRate_Between; for (size_t Pos=1; Posvideo_stream_FrameRate_Between[video_stream_FrameRate_Between.size()-1]) { float Time; if (video_stream_FrameRate.size()>30) Time=((float)(video_stream_FrameRate[30]-video_stream_FrameRate[0]))/30; //30 frames for handling 30 fps rounding problems else Time=((float)(video_stream_FrameRate[video_stream_FrameRate.size()-1]-video_stream_FrameRate[0]))/(video_stream_FrameRate.size()-1); //30 frames for handling 30 fps rounding problems if (Time) { Fill(Stream_Video, 0, Video_FrameRate, 1000/Time); Fill(Stream_Video, 0, Video_FrameRate_Mode, "CFR"); } } else Fill(Stream_Video, 0, Video_FrameRate_Mode, "VFR"); } //Parsers if (Stream[Stream_Video].Parser!=NULL) { Fill(Stream[Stream_Video].Parser); Merge(*Stream[Stream_Video].Parser, Stream_Video, 0, 0); } if (Stream[Stream_Audio].Parser!=NULL) { Fill(Stream[Stream_Audio].Parser); Merge(*Stream[Stream_Audio].Parser, Stream_Audio, 0, 0); //Special case: AAC if (Retrieve(Stream_Audio, 0, Audio_Format)==__T("AAC") || Retrieve(Stream_Audio, 0, Audio_Format)==__T("MPEG Audio") || Retrieve(Stream_Audio, 0, Audio_Format)==__T("Vorbis")) Clear(Stream_Audio, 0, Audio_BitDepth); //Resolution is not valid for AAC / MPEG Audio / Vorbis } //Delay if (Stream[Stream_Video].Delay!=(int32u)-1) { Fill(Stream_Video, 0, Video_Delay, Stream[Stream_Video].Delay+Retrieve(Stream_Video, 0, Video_Delay).To_int32u(), 10, true); Fill(Stream_Video, 0, Video_Delay_Source, "Container"); } if (Stream[Stream_Audio].Delay!=(int32u)-1) { Fill(Stream_Audio, 0, Audio_Delay, Stream[Stream_Audio].Delay+Retrieve(Stream_Audio, 0, Audio_Delay).To_int32u(), 10, true); Fill(Stream_Audio, 0, Audio_Delay_Source, "Container"); } } //--------------------------------------------------------------------------- void File_Flv::Streams_Finish() { //Duration //if (meta_duration) // Fill(Stream_General, 0, General_Duration, meta_duration, 10, true); Streams_Finish_PerStream(Stream_Video); Streams_Finish_PerStream(Stream_Audio); /* float64 FrameRate=Retrieve(Stream_Video, 0, Video_FrameRate).To_float64(); if (LastFrame_Time!=(int32u)-1 && FirstFrame_Time!=(int32u)-1) Duration_Final=LastFrame_Time-FirstFrame_Time+((LastFrame_Type==9 && FrameRate)?((int64u)(1000/FrameRate)):0); if (Duration_Final) { if (Count_Get(Stream_Video)) Fill(Stream_Video, 0, Video_Duration, Duration_Final, 10, true); if (Count_Get(Stream_Audio)) Fill(Stream_Audio, 0, Audio_Duration, Duration_Final, 10, true); //Integrity if (Count_Get(Stream_Video) && File_Size!=(int64u)-1 && !Retrieve(Stream_Video, 0, Video_BitRate).empty() && !Retrieve(Stream_Video, 0, Video_Duration).empty()) { int64u BitRate_Video_Meta=Retrieve(Stream_Video, 0, Video_BitRate).To_int64u(); int64u Duration=Retrieve(Stream_Video, 0, Video_Duration).To_int64u(); int64u BitRate_Video_Duration=File_Size*8*1000/Duration; if (Count_Get(Stream_Audio) && !Retrieve(Stream_Audio, 0, Audio_BitRate).empty()) { int64u BitRate_Audio=Retrieve(Stream_Audio, 0, Audio_BitRate).To_int64u(); if (BitRate_AudioBitRate_Video_Duration*2) Clear(Stream_Video, 0, Video_BitRate); } } */ if (Stream[Stream_Video].Parser!=NULL) { Finish(Stream[Stream_Video].Parser); Merge(*Stream[Stream_Video].Parser, Stream_Video, 0, 0); } if (Stream[Stream_Audio].Parser!=NULL) { Finish(Stream[Stream_Audio].Parser); Merge(*Stream[Stream_Audio].Parser, Stream_Audio, 0, 0); } if (Retrieve(Stream_General, 0, General_Duration).empty() && Retrieve(Stream_Video, 0, Video_Duration).empty() && meta_duration) Fill(Stream_General, 0, General_Duration, meta_duration, 0, true); //Purge what is not needed anymore if (!File_Name.empty()) //Only if this is not a buffer, with buffer we can have more data Stream.clear(); } //--------------------------------------------------------------------------- void File_Flv::Streams_Finish_PerStream(stream_t StreamKind) { if (Stream[StreamKind].TimeStamp!=(int32u)-1) { //Calculating the last timestamp (last block included) if (!Stream[StreamKind].Durations.empty()) { int64u Durations_Total=0; for (size_t Pos=0; Pos9) Skip_XX(Size-9, "Unknown"); Element_End0(); FILLING_BEGIN(); //Integrity if (Signature!="FLV" || Version==0 || Size<9) { Reject(); return; } //Filling Accept(); Fill(Stream_General, 0, General_Format, "Flash Video"); if (!video_stream_Count && !audio_stream_Count) { //TODO: quick and awful hack for a file having both bools unset, should detect directly the streams video_stream_Count=true; audio_stream_Count=true; } if (video_stream_Count) { Stream_Prepare(Stream_Video); video_stream_FrameRate_Detected=false; } else video_stream_FrameRate_Detected=true; if (audio_stream_Count) Stream_Prepare(Stream_Audio); if (Version>1) { Finish(); return; //Version more than 1 is not supported } FILLING_END(); } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Flv::Synchronize() { if (File_Offset+Buffer_Offset+4==File_Size) return true; // Used by seek from end //Synchronizing while (Buffer_Offset+15<=Buffer_Size) { int32u BodyLength=BigEndian2int24u(Buffer+Buffer_Offset+5); if ((Buffer[Buffer_Offset ] || Buffer[Buffer_Offset+1] || Buffer[Buffer_Offset+2] || Buffer[Buffer_Offset+3]>=11) && File_Offset+Buffer_Offset+15+BodyLength==File_Size) break; //Last block if (File_Offset+Buffer_Offset+15+BodyLengthBuffer_Size) return false; //Need more data if ((Buffer[Buffer_Offset ] || Buffer[Buffer_Offset+1] || Buffer[Buffer_Offset+2] || Buffer[Buffer_Offset+3]>=11) && BigEndian2int32u(Buffer+Buffer_Offset+15+BodyLength)==11+BodyLength) // PreviousTagSize break; } Buffer_Offset++; } //Parsing last bytes if needed if (Buffer_Offset+15>Buffer_Size) return false; //Synched return true; } //--------------------------------------------------------------------------- bool File_Flv::Synched_Test() { if (File_Offset+Buffer_Offset+4==File_Size) return true; // Used by seek from end //Must have enough buffer for having header if (Buffer_Offset+15>Buffer_Size) return false; //Quick test of synchro if (Buffer[Buffer_Offset ]==0 && Buffer[Buffer_Offset+1]==0 && Buffer[Buffer_Offset+2]==0 && Buffer[Buffer_Offset+3]<11 && File_Offset+Buffer_Offset>9) { Synched=false; return true; } //We continue return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Flv::Read_Buffer_Unsynched() { if (!Searching_Duration) //If Searching_Duration, we are looking for end in inverse order, no timestamp reset { Stream[Stream_Video].TimeStamp=(int32u)-1; if (Stream[Stream_Video].Parser) Stream[Stream_Video].Parser->Open_Buffer_Unsynch(); Stream[Stream_Audio].TimeStamp=(int32u)-1; if (Stream[Stream_Audio].Parser) Stream[Stream_Audio].Parser->Open_Buffer_Unsynch(); } } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Flv::Header_Parse() { if (Searching_Duration && File_Offset+Buffer_Offset==File_Size-4) { Get_B4 (PreviousTagSize, "PreviousTagSize"); //Filling Header_Fill_Code((int64u)-1, "End Of File"); Header_Fill_Size(4); return; } //Parsing int32u BodyLength; int8u Type; Get_B4 (PreviousTagSize, "PreviousTagSize"); if (File_Offset+Buffer_Offset+4>12)&0x0F; if (Format==10 && (Format_Info&0xFF)==0) // AAC sequence header Skip_Timestamps=true; } //Filling if ((Type==0x08 && !Skip_Timestamps) || Type==0x09) { Time=(((int32u)Timestamp_Extended)<<24)|Timestamp_Base; stream_t StreamKind=(Type==0x08)?Stream_Audio:Stream_Video; if (Stream[StreamKind].Delay==(int32u)-1) Stream[StreamKind].Delay=Time; else if (Stream[StreamKind].TimeStamp!=(int32u)-1 && Time>Stream[StreamKind].TimeStamp) Stream[StreamKind].Durations.push_back(Time-Stream[StreamKind].TimeStamp); if (!Searching_Duration || Stream[StreamKind].TimeStamp==(int32u)-1) Stream[StreamKind].TimeStamp=Time; } if (Type==0) Trusted_IsNot("Wrong type"); } else { Type=0; BodyLength=0; } //Filling Header_Fill_Code(Type, Ztring().From_Number(Type, 16)); Header_Fill_Size(Element_Offset+BodyLength); } //--------------------------------------------------------------------------- void File_Flv::Data_Parse() { switch (Element_Code) { case 0x00 : Element_Name("End Of File"); break; case 0x08 : audio(); break; case 0x09 : video(); break; case 0x12 : meta(); break; case 0xFA : Rm(); break; case (int64u)-1 : //When searching the last frame if (8+PreviousTagSize>File_Size) { Searching_Duration=false; Open_Buffer_Unsynch(); //There is a problem, trying to sync PreviousTagSize=65536; } GoTo(File_Size-PreviousTagSize-8, "FLV"); return; default : if (Searching_Duration) { Finish(); //This is surely a bad en of file, don't try anymore return; } } if (Searching_Duration) { if ((((Count_Get(Stream_Video)==0 || Stream[Stream_Video].TimeStamp!=(int32u)-1) && (Count_Get(Stream_Audio)==0 || Stream[Stream_Audio].TimeStamp!=(int32u)-1)) || (File_Size>65536*2 && File_Offset+Buffer_Offset-Header_Size-PreviousTagSize-4ParseSpeed<1) Finish(); else if (Element_Code==0xFA) //RM metadata have a malformed PreviousTagSize, always { //Trying to sync Searching_Duration=false; Open_Buffer_Unsynch(); //There is a problem, trying to sync GoToFromEnd(Header_Size+Element_Size+65536); return; } else GoTo(File_Offset+Buffer_Offset-Header_Size-PreviousTagSize-4); } else if (!video_stream_Count && !audio_stream_Count && video_stream_FrameRate_Detected && File_Offset+65536*230) video_stream_FrameRate_Detected=true; } if (Element_Size==0) //Header says that video is present, but there is only one null packet { Element_Info1("Null"); return; } Demux(Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset), ContentType_MainStream); //Needed? if (!video_stream_Count && Config->ParseSpeed<1) return; //No more need of Video stream //Parsing int8u Codec, FrameType; Element_Begin1("Stream header"); BS_Begin(); Get_S1 (4, FrameType, "frameType"); Param_Info1(Flv_FrameType[FrameType]); Get_S1 (4, Codec, "codecID"); Param_Info1(Flv_Codec_Video[Codec]); Element_Info1(Flv_Codec_Video[Codec]); BS_End(); Element_End0(); FILLING_BEGIN(); //Filling if (Retrieve(Stream_Video, 0, Video_Format).empty()) { if (Count_Get(Stream_Video)==0) Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, Flv_Format_Video[Codec]); Fill(Stream_Video, 0, Video_Format_Profile, Flv_Format_Profile_Video[Codec]); Fill(Stream_Video, 0, Video_Codec, Flv_Codec_Video[Codec]); Fill(Stream_Video, 0, Video_CodecID, Codec); Fill(Stream_Video, 0, Video_CodecID_Hint, Flv_CodecID_Hint_Video[Codec]); Fill(Stream_Video, 0, Video_BitDepth, 8); //FLV is not known to support another bit depth MustSynchronize=true; // Now, synchronization test is possible } //Parsing video data switch (Codec) { case 2 : video_H263(); break; case 3 : video_ScreenVideo(1); break; case 4 : video_VP6(false); break; case 5 : video_VP6(true); break; case 6 : video_ScreenVideo(2); break; case 7 : video_AVC(); break; default : Skip_XX(Element_Size-Element_Offset, "Unknown"); video_stream_Count=false; //No more need of Video stream; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Flv::video_H263() { //Parsing int16u Width=0, Height=0; int8u Version, PictureSize, PictureType; bool ExtraInformationFlag; BS_Begin(); Skip_S3(17, "PictureStartCode"); Get_S1 ( 5, Version, "Version"); if (Version>1) return; Skip_S1( 8, "TemporalReference"); Get_S1 ( 3, PictureSize, "PictureSize"); Param_Info1(Flv_H263_PictureSize[PictureSize]); switch (PictureSize) { case 0 : Get_S2 ( 8, Width, "Width"); Get_S2 ( 8, Height, "Height"); break; case 1 : Get_S2 (16, Width, "Width"); Get_S2 (16, Height, "Height"); break; default : if (PictureSize<8) { Width=Flv_H263_WidthHeight[PictureSize][0]; Height=Flv_H263_WidthHeight[PictureSize][1]; } } Get_S1 ( 2, PictureType, "PictureSize"); Param_Info1(Flv_H263_PictureType[PictureType]); Skip_SB( "DeblockingFlag"); Skip_S1( 5, "Quantizer"); Get_SB ( ExtraInformationFlag, "ExtraInformationFlag"); while (ExtraInformationFlag) { Skip_S1( 8, "ExtraInformation"); Get_SB ( ExtraInformationFlag, "ExtraInformationFlag"); } BS_End(); FILLING_BEGIN(); Fill(Stream_Video, 0, Video_Width, Width, 10, true); Fill(Stream_Video, 0, Video_Height, Height, 10, true); video_stream_Count=false; //No more need of Video stream FILLING_END(); } //--------------------------------------------------------------------------- void File_Flv::video_ScreenVideo(int8u Version) { //Parsing int16u Width, Height; BS_Begin(); Info_S1( 4, BlockWidth, "BlockWidth"); Param_Info1((BlockWidth+1)*16); Get_S2 (12, Width, "ImageWidth"); Info_S1( 4, BlockHeight, "BlockHeight"); Param_Info1((BlockHeight+1)*16); Get_S2 (12, Height, "ImageHeight"); if (Version==2) { Skip_S1(6, "Reserved"); Skip_SB( "has IFrameImage"); Skip_SB( "has PaletteInfo"); } BS_End(); FILLING_BEGIN(); Fill(Stream_Video, 0, Video_Width, Width, 10, true); Fill(Stream_Video, 0, Video_Height, Height, 10, true); video_stream_Count=false; //No more need of Video stream FILLING_END(); } //--------------------------------------------------------------------------- // From: http://wiki.multimedia.cx/index.php?title=On2_VP6 // void File_Flv::video_VP6(bool WithAlpha) { //Parsing int8u HorizontalAdjustment, VerticalAdjustment; bool FrameMode, Marker; BS_Begin(); Get_S1 ( 4, HorizontalAdjustment, "HorizontalAdjustment"); Get_S1 ( 4, VerticalAdjustment, "VerticalAdjustment"); if (WithAlpha) Skip_S3(24, "OffsetToAlpha"); Get_SB ( FrameMode, "FrameMode"); Param_Info1(Flv_VP6_FrameMode[FrameMode]); Skip_S1( 6, "Quantization"); Get_SB ( Marker, "Marker"); Param_Info1(Flv_VP6_Marker[Marker]); BS_End(); if (FrameMode) { if (Marker==1) Skip_B2( "Offset"); } else { int8u Version, Version2, Width, Height; BS_Begin(); Get_S1 ( 5, Version, "Version"); Get_S1 ( 2, Version2, "Version2"); Skip_SB( "Interlace"); BS_End(); if (Marker || Version2==0) Skip_B2( "Offset"); Skip_B1( "MacroBlock_Height"); Skip_B1( "MacroBlock_Width"); Get_B1 (Height, "Height"); Param_Info1(Ztring::ToZtring(Height*16)+__T(" pixels")); Get_B1 (Width, "Width"); Param_Info1(Ztring::ToZtring(Width*16)+__T(" pixels")); FILLING_BEGIN(); if (Width && Height) { Fill(Stream_Video, 0, Video_Width, Width*16-HorizontalAdjustment, 10, true); Fill(Stream_Video, 0, Video_Height, Height*16-VerticalAdjustment, 10, true); } video_stream_Count=false; //No more need of Video stream FILLING_END(); } } //--------------------------------------------------------------------------- void File_Flv::video_AVC() { int8u AVCPacketType; Get_B1 (AVCPacketType, "AVCPacketType"); Param_Info1(Flv_AVCPacketType(AVCPacketType)); Info_B3(CompositionTime, "CompositionTime"); Param_Info1(Ztring::ToZtring((int32s)(CompositionTime+0xFF000000))); switch (AVCPacketType) { case 0 : #ifdef MEDIAINFO_AVC_YES if (Stream[Stream_Video].Parser==NULL) { Stream[Stream_Video].Parser=new File_Avc; Open_Buffer_Init(Stream[Stream_Video].Parser); ((File_Avc*)Stream[Stream_Video].Parser)->MustParse_SPS_PPS=true; ((File_Avc*)Stream[Stream_Video].Parser)->SizedBlocks=true; ((File_Avc*)Stream[Stream_Video].Parser)->MustSynchronize=false; } //Parsing Open_Buffer_Continue(Stream[Stream_Video].Parser); #else Skip_XX(Element_Size-Element_Offset, "AVC Data"); video_stream_Count=false; //Unable to parse it #endif break; case 1 : #ifdef MEDIAINFO_AVC_YES if (Stream[Stream_Video].Parser==NULL) { //Data before header, this is wrong video_stream_Count=false; break; } //Parsing Open_Buffer_Continue(Stream[Stream_Video].Parser); //Disabling this stream if (Stream[Stream_Video].Parser->File_GoTo!=(int64u)-1 || Stream[Stream_Video].Parser->Count_Get(Stream_Video)>0 || (Config->ParseSpeed<1.0 && Stream[Stream_Video].PacketCount>=300)) video_stream_Count=false; #else Skip_XX(Element_Size-Element_Offset, "AVC Data"); video_stream_Count=false; //Unable to parse it #endif break; default: Skip_XX(Element_Size-Element_Offset, "Unknown"); video_stream_Count=false; //Unable to parse it } } //--------------------------------------------------------------------------- void File_Flv::audio() { Element_Name("Audio"); Stream[Stream_Audio].PacketCount++; Element_Info1(Stream[Stream_Audio].PacketCount); if (Element_Size==0) //Header says that audio is present, but there is only one null packet { Element_Info1("Null"); return; } Demux(Buffer+Buffer_Offset+(size_t)Element_Offset+1, (size_t)(Element_Size-Element_Offset-1), ContentType_MainStream); //Needed? if (!audio_stream_Count && Config->ParseSpeed<1) return; //No more need of Audio stream //Parsing int8u codec, sampling_rate; bool is_16bit, is_stereo; Element_Begin1("Stream header"); BS_Begin(); Get_S1 (4, codec, "codec"); Param_Info1(Flv_Codec_Audio[codec]); Element_Info1(Flv_Codec_Audio[codec]); Get_S1 (2, sampling_rate, "sampling_rate"); Param_Info1(Ztring::ToZtring(Flv_SamplingRate[sampling_rate])+__T(" Hz")); Get_SB ( is_16bit, "is_16bit"); Param_Info1(Ztring::ToZtring(Flv_Resolution[is_16bit])+__T(" bits")); Get_SB ( is_stereo, "is_stereo"); Param_Info1(Ztring::ToZtring(Flv_Channels[is_stereo])+__T(" channel(s)")); BS_End(); Element_End0(); //Special case if (codec==5) //Nellymoser 8kHz mono { sampling_rate=5; //8000 Hz forced is_stereo=false; //Mono forced } FILLING_BEGIN(); if (Retrieve(Stream_Audio, 0, Audio_Format).empty()) { //Filling if (Count_Get(Stream_Audio)==0) Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Channel_s_, Flv_Channels[is_stereo], 10, true); if (codec!=2 && codec!=10 && codec!=14) //MPEG Audio and AAC are not fixed bit depth Fill(Stream_Audio, 0, Audio_BitDepth, Flv_Resolution[is_16bit], 10, true); if (sampling_rate<4) Fill(Stream_Audio, 0, Audio_SamplingRate, Flv_SamplingRate[sampling_rate], 10, true); Fill(Stream_Audio, 0, Audio_Format, Flv_Format_Audio[codec]); Fill(Stream_Audio, 0, Audio_Format_Profile, Flv_Format_Profile_Audio[codec]); Fill(Stream_Audio, 0, Audio_Codec, Flv_Codec_Audio[codec]); Fill(Stream_Audio, 0, Audio_CodecID, codec); Fill(Stream_Audio, 0, Audio_CodecID_Hint, Flv_CodecID_Hint_Audio[codec]); if (codec==1) { //ADPCM Fill(Stream_Audio, 0, Audio_Format_Settings, "ShockWave"); Fill(Stream_Audio, 0, Audio_Format_Settings_Firm, "ShockWave"); Fill(Stream_Audio, 0, Audio_Codec_Settings, "SWF"); Fill(Stream_Audio, 0, Audio_Codec_Settings_Firm, "SWF"); } MustSynchronize=true; // Now, synchronization test is possible } //Parsing audio data switch (codec) { case 2 : case 14 : audio_MPEG(); break; case 10 : audio_AAC(); break; default : Skip_XX(Element_Size-Element_Offset, "Unknown"); audio_stream_Count=false; //No more need of Audio stream } FILLING_END(); } //--------------------------------------------------------------------------- void File_Flv::audio_MPEG() { #if defined(MEDIAINFO_MPEGA_YES) if (Stream[Stream_Audio].Parser==NULL) { Stream[Stream_Audio].Parser=new File_Mpega; Open_Buffer_Init(Stream[Stream_Audio].Parser); ((File_Mpega*)Stream[Stream_Audio].Parser)->FrameIsAlwaysComplete=true; } //Parsing Open_Buffer_Continue(Stream[Stream_Audio].Parser); //Disabling this stream if (Stream[Stream_Audio].Parser->File_GoTo!=(int64u)-1 || Stream[Stream_Audio].Parser->Count_Get(Stream_Audio)>0) audio_stream_Count=false; #endif } //--------------------------------------------------------------------------- void File_Flv::audio_AAC() { int8u AACPacketType; Get_B1 (AACPacketType, "AACPacketType"); Param_Info1(Flv_AACPacketType(AACPacketType)); switch (AACPacketType) { case 0 : #if defined(MEDIAINFO_MPEG4_YES) if (Stream[Stream_Audio].Parser==NULL) { Stream[Stream_Audio].Parser=new File_Aac; ((File_Aac*)Stream[Stream_Audio].Parser)->Mode=File_Aac::Mode_AudioSpecificConfig; Open_Buffer_Init(Stream[Stream_Audio].Parser); } //Parsing Open_Buffer_Continue(Stream[Stream_Audio].Parser); #else Skip_XX(Element_Size-Element_Offset, "AAC Data"); audio_stream_Count=false; //Unable to parse it #endif break; case 1 : //Parsing Open_Buffer_Continue(Stream[Stream_Audio].Parser); audio_stream_Count=false; //No need of more break; default: Skip_XX(Element_Size-Element_Offset, "Unknown"); audio_stream_Count=false; //Unable to parse it } } //--------------------------------------------------------------------------- void File_Flv::meta() { Element_Name("Meta"); //Parsing meta_Level=0; meta_SCRIPTDATAOBJECT(); if (MetaData_NotTrustable) { meta_duration=0; Clear(Stream_Video, 0, Video_StreamSize); Clear(Stream_Video, 0, Video_BitRate); Clear(Stream_Video, 0, Video_Bits__Pixel_Frame_); Clear(Stream_Audio, 0, Audio_StreamSize); Clear(Stream_Audio, 0, Audio_BitRate); Clear(Stream_General, 0, General_Duration); Clear(Stream_General, 0, General_OverallBitRate); } } //--------------------------------------------------------------------------- void File_Flv::meta_SCRIPTDATAOBJECT() { //Parsing Value std::string StringData; meta_SCRIPTDATAVALUE(StringData); meta_SCRIPTDATAVALUE(StringData); } //--------------------------------------------------------------------------- void File_Flv::meta_SCRIPTDATAVARIABLE() { std::string StringData; int16u StringLength; Element_Begin0(); Get_B2 (StringLength, "StringLength"); Get_String(StringLength, StringData, "StringData"); Element_Name(StringData.c_str()); //Parsing Value meta_SCRIPTDATAVALUE(StringData); Element_End0(); } //--------------------------------------------------------------------------- void File_Flv::meta_SCRIPTDATAVALUE(const std::string &StringData) { std::string StringDataModified(StringData); if (!StringDataModified.empty() && StringDataModified[0]==__T('_')) StringDataModified.erase(StringDataModified.begin()); //Parsing int8u Type; Get_B1 (Type, "Type"); Param_Info1C((Type<0x12), Flv_TagType[Type]); switch (Type) { case 0x00 : //DOUBLE --> 64 bits Big endian float { float64 Value; Get_BF8(Value, "Value"); if (Value==0) break; std::string ToFill; Ztring ValueS; stream_t StreamKind=Stream_General; if (StringDataModified=="width") {ToFill="Width"; StreamKind=Stream_Video; ValueS.From_Number(Value, 0); video_stream_Count=true;} //1 file with FrameRate tag and video stream but no video present tag else if (StringDataModified=="height") {ToFill="Height"; StreamKind=Stream_Video; ValueS.From_Number(Value, 0); video_stream_Count=true;} //1 file with FrameRate tag and video stream but no video present tag else if (StringDataModified=="duration") meta_duration=Value*1000; else if (StringDataModified=="audiodatarate") {ToFill="BitRate"; StreamKind=Stream_Audio; ValueS.From_Number(Value*1000, 0);} else if (StringDataModified=="framerate") {ToFill="FrameRate"; StreamKind=Stream_Video; ValueS.From_Number(Value, 3); video_stream_FrameRate_Detected=true; video_stream_Count=true;} //1 file with FrameRate tag and video stream but no video present tag else if (StringDataModified=="videoframerate") {ToFill="FrameRate"; StreamKind=Stream_Video; ValueS.From_Number(Value, 3); video_stream_FrameRate_Detected=true; video_stream_Count=true;} //1 file with FrameRate tag and video stream but no video present tag else if (StringDataModified=="filesize") {meta_filesize=(int64u)Value;} else if (StringDataModified=="audiosize") {ToFill="StreamSize"; StreamKind=Stream_Audio; ValueS.From_Number(Value, 0); if (Value>File_Size) MetaData_NotTrustable=true;} else if (StringDataModified=="videosize") {ToFill="StreamSize"; StreamKind=Stream_Video; ValueS.From_Number(Value, 0); if (Value>File_Size) MetaData_NotTrustable=true; video_stream_Count=true;} //1 file with FrameRate tag and video stream but no video present tag else if (StringDataModified=="videodatarate") {ToFill="BitRate"; StreamKind=Stream_Video; ValueS.From_Number(Value*1000, 0); video_stream_Count=true;} //1 file with FrameRate tag and video stream but no video present tag else if (StringDataModified=="videocodecid") {; video_stream_Count=true;} //1 file with FrameRate tag and video stream but no video present tag else if (StringDataModified=="audiodelay") {ToFill="Delay"; StreamKind=Stream_Audio; if (Value>0) ValueS.From_Number(Value*1000, 0);} else if (StringDataModified=="audiosamplerate") {ToFill="SamplingRate"; StreamKind=Stream_Audio; if (Value>0) ValueS.From_Number(Value, 0);} else if (StringDataModified=="audiosamplesize") {ToFill="BitDepth"; StreamKind=Stream_Audio; if (Value>0) ValueS.From_Number(Value, 0);} else if (StringDataModified=="totalduration") {ToFill="Duration"; StreamKind=Stream_General; ValueS.From_Number(Value*1000, 0);} else if (StringDataModified=="totaldatarate") {ToFill="OverallBitRate"; StreamKind=Stream_General; ValueS.From_Number(Value*1000, 0);} else if (StringDataModified=="totalframes") {ToFill="FrameCount"; StreamKind=Stream_Video; ValueS.From_Number(Value*1000, 0);} else if (StringDataModified=="bytelength") {if (File_Size!=Value) MetaData_NotTrustable=true;} else if (!(StringDataModified=="datasize" || StringDataModified=="lasttimestamp" || StringDataModified=="lastkeyframetimestamp" || StringDataModified=="lastkeyframelocation" || StringDataModified=="canSeekToEnd" || StringDataModified=="keyframes_times" || StringDataModified=="keyframes_filepositions" || StringDataModified=="aacaot" || StringDataModified=="audiochannels" || StringDataModified=="audiocodecid" || StringDataModified=="avclevel" || StringDataModified=="avcprofile" || StringDataModified=="moovPosition")) {StreamKind=Stream_General; ToFill=StringData; ValueS.From_Number(Value);} #if MEDIAINFO_TRACE if (ValueS.empty()) ValueS.From_Number(Value, 0); Element_Info1(ValueS); #endif //MEDIAINFO_TRACE if (!ToFill.empty()) { Fill(StreamKind, 0, ToFill.c_str(), ValueS, true); if (ToFill=="FrameRate") Fill(StreamKind, 0, "FrameRate_Mode", "CFR", Unlimited, true, true); } } break; case 0x01 : //UI8 { int8u Value; Get_B1 (Value, "Value"); std::string ToFill; if (StringDataModified=="haskeyframes") {} else if (StringDataModified=="hasKeyframes") {} else if (StringDataModified=="hasVideo") {} else if (StringDataModified=="stereo") {} else if (StringDataModified=="canSeekToEnd") {} else if (StringDataModified=="hasAudio") {} else if (StringDataModified=="hasmetadata") {} else if (StringDataModified=="hasMetadata") {} else if (StringDataModified=="hasCuePoints") {} else if (StringDataModified=="canseekontime") {} else {ToFill=StringData;} Element_Info1(Value); Fill(Stream_General, 0, ToFill.c_str(), Value?"Yes":"No", Unlimited, true, true); } break; case 0x02 : //SCRIPTDATASTRING { int16u Value_Size; Get_B2 (Value_Size, "Value_Size"); if (Value_Size) { Ztring Value; Get_UTF8(Value_Size, Value, "Value"); size_t ToFill=(size_t)-1; std::string ToFillS; if (StringDataModified=="creator") {ToFill=General_Encoded_Application;} else if (StringDataModified=="creationdate") {ToFill=General_Encoded_Date; Value.Date_From_String(Value.To_UTF8().c_str());} else if (StringDataModified=="encoder") {ToFill=General_Encoded_Application;} else if (StringDataModified=="Encoded_With") {ToFill=General_Encoded_Application;} else if (StringDataModified=="Encoded_By") {ToFill=General_Encoded_Application;} else if (StringDataModified=="metadatacreator") {ToFill=General_Tagged_Application;} else if (StringDataModified=="creation_time") {ToFill=General_Encoded_Date; Value.insert(0, __T("UTC "));} else if (StringDataModified=="sourcedata") {} else if (StringDataModified=="audiocodecid") {} else if (StringDataModified=="videocodecid") {} else if (!(StringDataModified=="major_brand" || StringDataModified=="minor_version" || StringDataModified=="compatible_brands")) ToFillS=StringData; if (Value.find(__T('\r'))!=std::string::npos) Value.resize(Value.find(__T('\r'))); if (Value.find(__T('\n'))!=std::string::npos) Value.resize(Value.find(__T('\n'))); Element_Info1(Value); if (ToFill!=(size_t)-1) Fill(Stream_General, 0, ToFill, Value, true); else if (!ToFillS.empty()) Fill(Stream_General, 0, StringData.c_str(), Value, true); } } break; case 0x03 : //SCRIPTDATAOBJECT[n] case 0x10 : //Typed object - SCRIPTDATAOBJECT[n] { std::string StringData2; int16u StringLength2; meta_Level++; meta_LevelFinished[meta_Level]=false; while (!meta_LevelFinished[meta_Level]) { if (Element_Offset>=Element_Size) break; Element_Begin0(); Get_B2 (StringLength2, "StringLength2"); Get_String(StringLength2, StringData2, "StringData2"); Element_Name(StringData2.empty()?"EndOfObject":StringData2.c_str()); meta_SCRIPTDATAVALUE(StringData+'_'+StringData2); Element_End0(); } meta_Level--; } break; case 0x04 : //SCRIPTDATASTRING defining the MovieClip path { int16u Value_Size; Get_B2 (Value_Size, "Value_Size"); if (Value_Size) { Ztring Value; Get_Local(Value_Size, Value, "Value"); if (Value==__T("unknown")) Value.clear(); Element_Info1C((!Value.empty()), Value); Fill(Stream_General, 0, StringData.c_str(), Value, true); } } break; case 0x05 : //NULL case 0x06 : //Undefined - NULL case 0x0D : //Unsupported - NULL break; case 0x07 : //UI16 { int16u Value; Get_B2 (Value, "Value"); Element_Info1(Value); Fill(Stream_General, 0, StringData.c_str(), Value, true); } break; case 0x08 : //SCRIPTDATAVARIABLE[ECMAArrayLength] { int32u ECMAArrayLength; Get_B4 (ECMAArrayLength, "ECMAArrayLength"); Element_Info1(Ztring::ToZtring(ECMAArrayLength)+__T(" elements")); for (int32u Pos=0; Pos Durations; stream() { Parser=NULL; PacketCount=0; Delay=(int32u)-1; TimeStamp=(int32u)-1; } ~stream() { delete Parser; //Parser=NULL; } }; std::vector Stream; //Null, Video, Audio //Count bool video_stream_Count; bool audio_stream_Count; //Temp bool video_stream_FrameRate_Detected; std::vector video_stream_FrameRate; int32u Time; int8u meta_Level; std::map meta_LevelFinished; bool Searching_Duration; bool MetaData_NotTrustable; int32u PreviousTagSize; int64u meta_filesize; float64 meta_duration; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Gxf.cpp100777 0 0 230432 12262743712 15606 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_GXF_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Gxf.h" #include "MediaInfo/Multiple/File_Gxf_TimeCode.h" #if defined(MEDIAINFO_DVDIF_YES) #include "MediaInfo/Multiple/File_DvDif.h" #endif #if defined(MEDIAINFO_RIFF_YES) #include "MediaInfo/Multiple/File_Riff.h" #endif #if defined(MEDIAINFO_GXF_YES) #include "MediaInfo/Multiple/File_Umf.h" #endif #if defined(MEDIAINFO_MPEGV_YES) #include "MediaInfo/Video/File_Mpegv.h" #endif #if defined(MEDIAINFO_AC3_YES) #include "MediaInfo/Audio/File_Ac3.h" #endif #if defined(MEDIAINFO_PCM_YES) #include "MediaInfo/Audio/File_Pcm.h" #endif #if defined(MEDIAINFO_SMPTEST0337_YES) #include "MediaInfo/Audio/File_ChannelGrouping.h" #endif #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events.h" #endif //MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "ZenLib/Utils.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constants //*************************************************************************** //--------------------------------------------------------------------------- const char* Gxf_Tag_Name(int8u Tag) { switch (Tag) { case 0x40 : return "Media file name of material"; case 0x41 : return "First field of material in stream"; case 0x42 : return "Last field of material in stream"; case 0x43 : return "Mark in for the stream"; case 0x44 : return "Mark out for the stream"; case 0x45 : return "Estimated size of stream in 1024 byte units"; case 0x46 : case 0x47 : case 0x48 : case 0x49 : case 0x4A : case 0x4B : return "Reserved"; case 0x4C : return "Media file name"; case 0x4D : return "Auxiliary Information"; case 0x4E : return "Media file system version"; case 0x4F : return "MPEG auxiliary information"; case 0x50 : return "Frame rate"; case 0x51 : return "Lines per frame"; case 0x52 : return "Fields per frame"; default : return "Unknown"; } } //--------------------------------------------------------------------------- const char* Gxf_MediaTypes(int8u Type) { switch (Type) { case 3 : return "JPEG"; //525 lines case 4 : return "JPEG"; //625 lines case 7 : return "SMPTE 12M"; //525 lines case 8 : return "SMPTE 12M"; //625 lines case 9 : return "PCM"; //24-bit case 10 : return "PCM"; //16-bit case 11 : return "MPEG-2 Video"; //525 lines case 12 : return "MPEG-2 Video"; //625 lines case 13 : return "DV"; //25 Mbps, 525 lines case 14 : return "DV"; //25 Mbps, 625 lines case 15 : return "DV"; //50 Mbps, 525 lines case 16 : return "DV"; //50 Mbps, 625 lines case 17 : return "AC-3"; //16-bit case 18 : return "AES"; //non-PCM case 19 : return "Reserved"; case 20 : return "MPEG-2 Video"; //HD, Main Profile at High Level case 21 : return "Ancillary data"; //SMPTE 291M 10-bit type 2 component ancillary data case 22 : return "MPEG-1 Video"; //525 lines case 23 : return "MPEG-1 Video"; //625 lines case 24 : return "SMPTE 12M"; //HD default : return "Unknown"; } } //--------------------------------------------------------------------------- stream_t Gxf_MediaTypes_StreamKind(int8u Type) { switch (Type) { case 3 : return Stream_Video; case 4 : return Stream_Video; case 7 : return Stream_Max; case 8 : return Stream_Max; case 9 : return Stream_Audio; case 10 : return Stream_Audio; case 11 : return Stream_Video; case 12 : return Stream_Video; case 13 : return Stream_Video; case 14 : return Stream_Video; case 15 : return Stream_Video; case 16 : return Stream_Video; case 17 : return Stream_Audio; case 18 : return Stream_Audio; case 19 : return Stream_Max; case 20 : return Stream_Video; case 21 : return Stream_Max; case 22 : return Stream_Video; case 23 : return Stream_Video; case 24 : return Stream_Max; default : return Stream_Max; } } //--------------------------------------------------------------------------- const char* Gxf_MediaTypes_Format(int8u Type) { switch (Type) { case 3 : return "JPEG"; //525 lines case 4 : return "JPEG"; //625 lines case 9 : return "PCM"; //24-bit case 10 : return "PCM"; //16-bit case 11 : return "MPEG Video"; //525 lines case 12 : return "MPEG Video"; //625 lines case 13 : return "DV"; //25 Mbps, 525 lines case 14 : return "DV"; //25 Mbps, 625 lines case 15 : return "DV"; //50 Mbps, 525 lines case 16 : return "DV"; //50 Mbps, 625 lines case 17 : return "AC-3"; //16-bit case 18 : return "SMPTE 338M, table 1, data type 28"; //SMPTE 338M, table 1, data type 28 case 20 : return "MPEG Video"; //HD, Main Profile at High Level case 22 : return "MPEG Video"; //525 lines case 23 : return "MPEG Video"; //625 lines default : return ""; } } //--------------------------------------------------------------------------- double Gxf_FrameRate(int32u Content) { switch (Content) { case 1 : return 60.000; case 2 : return 59.940; case 3 : return 50.000; case 4 : return 30.000; case 5 : return 29.970; case 6 : return 25.000; case 7 : return 24.000; case 8 : return 23.976; default: return 0.000; } } //--------------------------------------------------------------------------- int32u Gxf_LinesPerFrame_Height(int32u Content) { switch (Content) { case 1 : return 480; case 2 : return 576; case 4 : return 1080; case 6 : return 720; default: return 0; } } //--------------------------------------------------------------------------- int32u Gxf_LinesPerFrame_Width(int32u Content) { switch (Content) { case 1 : return 720; case 2 : return 720; case 4 : return 1920; case 6 : return 1080; default: return 0; } } //--------------------------------------------------------------------------- const char* Gxf_FieldsPerFrame(int32u Tag) { switch (Tag) { case 1 : return "Progressive"; case 2 : return "Interlaced"; default: return ""; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Gxf::File_Gxf() :File__Analyze() { //Configuration ParserName=__T("GXF"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Gxf; StreamIDs_Width[0]=2; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_Level=2; //Container #endif //MEDIAINFO_DEMUX MustSynchronize=true; Buffer_TotalBytes_FirstSynched_Max=64*1024; Buffer_TotalBytes_Fill_Max=(int64u)-1; //Disabling this feature for this format, this is done in the parser #if MEDIAINFO_DEMUX Demux_EventWasSent_Accept_Specific=true; #endif //MEDIAINFO_DEMUX //Temp Material_Fields_FieldsPerFrame=1; //Progressive by default Parsers_Count=0; AncillaryData_StreamID=(int8u)-1; Material_Fields_First_IsValid=false; Material_Fields_Last_IsValid=false; Material_File_Size_IsValid=false; UMF_File=NULL; #if defined(MEDIAINFO_ANCILLARY_YES) Ancillary=NULL; #endif //defined(MEDIAINFO_ANCILLARY_YES) SizeToAnalyze=16*1024*1024; IsParsingMiddle_MaxOffset=(int64u)-1; Audio_Count=0; Element_Code=0x00; //Element_Code is used as a test for pre-existing parsing, it must be initialized #if MEDIAINFO_DEMUX Demux_HeaderParsed=false; #endif //MEDIAINFO_DEMUX #if MEDIAINFO_SEEK Flt_FieldPerEntry=(int32u)-1; IFrame_IsParsed=false; #endif //MEDIAINFO_SEEK } //--------------------------------------------------------------------------- File_Gxf::~File_Gxf() { //Temp delete Ancillary; //Ancillary=NULL; delete UMF_File; //UMF_File=NULL; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Gxf::Streams_Finish() { //Merging audio if Title are same for (size_t StreamID=0; StreamIDFile_Audio_MergeMonoStreams_Get()) { Ztring Title=Streams[StreamID].MediaName; size_t Title_Extension_Offset=Title.find(__T(".A0")); if (Title_Extension_Offset!=std::string::npos && Title_Extension_Offset==Title.size()-3) { Title.resize(Title.size()-3); for (size_t StreamID2=StreamID+1; StreamID2Retrieve(Stream_Audio, 0, Audio_Channel_s_).To_int32u()+Streams[StreamID2].Parsers[0]->Retrieve(Stream_Audio, 0, Audio_Channel_s_).To_int32u(); Streams[StreamID].Parsers[0]->Fill(Stream_Audio, 0, Audio_Channel_s_, Channels, 10, true); int32u BitRate=Streams[StreamID].Parsers[0]->Retrieve(Stream_Audio, 0, Audio_BitRate).To_int32u()+Streams[StreamID2].Parsers[0]->Retrieve(Stream_Audio, 0, Audio_BitRate).To_int32u(); Streams[StreamID].Parsers[0]->Fill(Stream_Audio, 0, Audio_BitRate, BitRate, 10, true); } Streams[StreamID2].MediaType=(int8u)-1; } } } } } //For each Streams for (size_t StreamID=0; StreamID::iterator TimeCode=TimeCodes.begin(); TimeCode!=TimeCodes.end(); ++TimeCode) { int64u TimeCode_FirstFrame_ms=((File_Gxf_TimeCode*)Streams[TimeCode->first].Parsers[0])->TimeCode_FirstFrame_ms; string TimeCode_FirstFrame=((File_Gxf_TimeCode*)Streams[TimeCode->first].Parsers[0])->TimeCode_FirstFrame; bool TimeCode_FirstFrame_Striped=false; if (TimeCode_FirstFrame_ms==(int64u)-1) { TimeCode_FirstFrame_ms=TimeCode->second.Milliseconds; TimeCode_FirstFrame=TimeCode->second.String; TimeCode_FirstFrame_Striped=true; } if (TimeCode_FirstFrame_ms!=(int64u)-1) { Stream_Prepare(Stream_Other); Fill(Stream_Other, StreamPos_Last, Other_ID, TimeCode->first); Fill(Stream_Other, StreamPos_Last, Other_Type, "Time code"); Fill(Stream_Other, StreamPos_Last, Other_Format, "SMPTE TC"); //Fill(Stream_Other, StreamPos_Last, Other_MuxingMode, "Time code track"); Fill(Stream_Other, StreamPos_Last, Other_TimeCode_FirstFrame, TimeCode_FirstFrame.c_str()); if (TimeCode_FirstFrame_Striped) Fill(Stream_Other, StreamPos_Last, Other_TimeCode_Settings, "Striped"); if (TimeCode->firstfirst].MediaName); } } } //--------------------------------------------------------------------------- void File_Gxf::Streams_Finish_PerStream(size_t StreamID, stream &Temp) { if (Temp.MediaType==(int8u)-1) return; //By the parser if (Temp.Parsers.size()==1 && Temp.Parsers[0]->Status[IsAccepted]) { StreamKind_Last=Stream_Max; StreamPos_Last=(size_t)-1; if (Config->ParseSpeed<=1.0) { Fill(Temp.Parsers[0]); Temp.Parsers[0]->Open_Buffer_Unsynch(); } Finish(Temp.Parsers[0]); //Video bool IsTimeCode=false; for (std::map::iterator TimeCode=TimeCodes.begin(); TimeCode!=TimeCodes.end(); ++TimeCode) if (StreamID==TimeCode->first) IsTimeCode=true; if (!IsTimeCode && Temp.DisplayInfo) { if (Temp.Parsers[0]->Count_Get(Stream_Video)) { Stream_Prepare(Stream_Video); if (TimeCodes.empty()) { Fill(Stream_Video, StreamPos_Last, Video_Delay, ((float64)(Material_Fields_First/Material_Fields_FieldsPerFrame))/Gxf_FrameRate(Streams[0x00].FrameRate_Code)*1000, 0); Fill(Stream_Video, StreamPos_Last, Video_Delay_Source, "Container"); } else for (std::map::iterator TimeCode=TimeCodes.begin(); TimeCode!=TimeCodes.end(); ++TimeCode) { int64u TimeCode_FirstFrame_ms=((File_Gxf_TimeCode*)Streams[TimeCode->first].Parsers[0])->TimeCode_FirstFrame_ms; string TimeCode_FirstFrame=((File_Gxf_TimeCode*)Streams[TimeCode->first].Parsers[0])->TimeCode_FirstFrame; if (TimeCode_FirstFrame_ms==(int64u)-1) { TimeCode_FirstFrame_ms=TimeCode->second.Milliseconds; TimeCode_FirstFrame=TimeCode->second.String; } if (TimeCode_FirstFrame_ms!=(int64u)-1) { Fill(Stream_Video, StreamPos_Last, Video_Delay, TimeCode_FirstFrame_ms, 0); if (TimeCode_FirstFrame.size()==11) Fill(Stream_Video, StreamPos_Last, Video_Delay_DropFrame, TimeCode_FirstFrame[8]==';'?"Yes":"No"); Fill(Stream_Video, StreamPos_Last, Video_Delay_Source, "Container"); //Fill(Stream_Video, StreamPos_Last, Video_TimeCode_FirstFrame, TimeCode_FirstFrame.c_str()); //Fill(Stream_Video, StreamPos_Last, Video_TimeCode_Source, "Time code track"); } } Merge(*Temp.Parsers[0], Stream_Video, 0, StreamPos_Last); Ztring LawRating=Temp.Parsers[0]->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); Fill(Stream_Video, StreamPos_Last, Video_ID, StreamID, 10, true); Fill(Stream_Video, StreamPos_Last, "Title", Temp.MediaName); //Special cases if (Temp.Parsers[0]->Count_Get(Stream_Text)) { //Video and Text are together size_t Parser_Text_Count=Temp.Parsers[0]->Count_Get(Stream_Text); for (size_t Parser_Text_Pos=0; Parser_Text_PosCount_Get(Stream_Audio); Pos++) { Stream_Prepare(Stream_Audio); if (TimeCodes.empty()) { Fill(Stream_Audio, StreamPos_Last, Audio_Delay, ((float64)(Material_Fields_First/Material_Fields_FieldsPerFrame))/Gxf_FrameRate(Streams[0x00].FrameRate_Code)*1000, 0); Fill(Stream_Audio, StreamPos_Last, Audio_Delay_Source, "Container"); } else for (std::map::iterator TimeCode=TimeCodes.begin(); TimeCode!=TimeCodes.end(); ++TimeCode) { int64u TimeCode_FirstFrame_ms=((File_Gxf_TimeCode*)Streams[TimeCode->first].Parsers[0])->TimeCode_FirstFrame_ms; string TimeCode_FirstFrame=((File_Gxf_TimeCode*)Streams[TimeCode->first].Parsers[0])->TimeCode_FirstFrame; if (TimeCode_FirstFrame_ms==(int64u)-1) { TimeCode_FirstFrame_ms=TimeCode->second.Milliseconds; TimeCode_FirstFrame=TimeCode->second.String; } if (TimeCode_FirstFrame_ms!=(int64u)-1) { Fill(Stream_Audio, StreamPos_Last, Audio_Delay, TimeCode_FirstFrame_ms, 0); if (TimeCode_FirstFrame.size()==11) Fill(Stream_Audio, StreamPos_Last, Audio_Delay_DropFrame, TimeCode_FirstFrame[8]==';'?"Yes":"No"); Fill(Stream_Audio, StreamPos_Last, Audio_Delay_Source, "Container"); //Fill(Stream_Audio, StreamPos_Last, Audio_TimeCode_FirstFrame, TimeCode_FirstFrame.c_str()); //Fill(Stream_Audio, StreamPos_Last, Audio_TimeCode_Source, "Time code track"); } } Merge(*Temp.Parsers[0], Stream_Audio, Pos, StreamPos_Last, false); Ztring ID; if (Temp.IsChannelGrouping) ID=Ztring::ToZtring(StreamID-1)+__T(" / "); //First half of the channel grouping ID+=Ztring::ToZtring(StreamID); //Second half of the channel grouping or standalone Ztring ID_String=ID; if (!Retrieve(Stream_Audio, StreamPos_Last, Audio_ID).empty()) { ID+=__T('-')+Retrieve(Stream_Audio, StreamPos_Last, Audio_ID); ID_String+=__T('-')+Retrieve(Stream_Audio, StreamPos_Last, Audio_ID_String); } Fill(Stream_Audio, StreamPos_Last, Audio_ID, ID, true); Fill(Stream_Audio, StreamPos_Last, Audio_ID_String, ID_String, true); if (Temp.IsChannelGrouping) Fill(Stream_Audio, StreamPos_Last, "Title", Streams[StreamID-1].MediaName); //First half of the channel grouping Fill(StreamKind_Last, StreamPos_Last, "Title", Temp.MediaName); //Second half of the channel grouping or standalone for (std::map::iterator Info=Temp.Infos.begin(); Info!=Temp.Infos.end(); ++Info) if (Info->first=="BitRate" && Temp.Parsers[0]->Count_Get(Stream_Audio)>1) Fill(Stream_Audio, StreamPos_Last, Audio_BitRate_Encoded, Pos?Ztring(__T("0")):Info->second); // In case of more than 1 audio sub-stream Encoded bit rate is the bit rate of all streams + overhead else if (Retrieve(Stream_Audio, StreamPos_Last, Info->first.c_str()).empty()) Fill(Stream_Audio, StreamPos_Last, Info->first.c_str(), Info->second); } //Text if (Temp.Parsers[0]->Count_Get(Stream_Text)) { size_t Parser_Text_Count=Temp.Parsers[0]->Count_Get(Stream_Text); for (size_t Parser_Text_Pos=0; Parser_Text_PosRetrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); StreamKind_Last=Stream_Max; StreamPos_Last=(size_t)-1; } //Other if (Temp.Parsers[0]->Count_Get(Stream_Other)) { size_t Parser_Other_Count=Temp.Parsers[0]->Count_Get(Stream_Other); for (size_t Parser_Other_Pos=0; Parser_Other_Pos=Buffer_Size || Buffer[Buffer_Offset-1]==0x00) Buffer_Offset--; } if (Buffer_Offset+16<=Buffer_Size) //Testing if size is coherant { //Retrieving some info int32u Size=BigEndian2int32u(Buffer+Buffer_Offset+6); //Testing if (Buffer_Offset+Size+16>Buffer_Size) return false; //Need more data if (Buffer[Buffer_Offset+Size ]!=0x00 || Buffer[Buffer_Offset+Size+1]!=0x00 || Buffer[Buffer_Offset+Size+2]!=0x00 || Buffer[Buffer_Offset+Size+3]!=0x00 || Buffer[Buffer_Offset+Size+4]!=0x01 || Buffer[Buffer_Offset+Size+14]!=0xE1 || Buffer[Buffer_Offset+Size+15]!=0xE2) Buffer_Offset++; else break; } } //Parsing last bytes if needed if (Buffer_Offset+16>Buffer_Size) { return false; } if (!Status[IsAccepted]) { Accept("GXF"); Fill(Stream_General, 0, General_Format, "GXF"); Streams.resize(0x40); } //Synched is OK return true; } //--------------------------------------------------------------------------- bool File_Gxf::Synched_Test() { //Must have enough buffer for having header if (Buffer_Offset+16>Buffer_Size) return false; //Quick test of synchro if (CC5(Buffer+Buffer_Offset )!=0x0000000001 || CC2(Buffer+Buffer_Offset+14)!=0xE1E2) Synched=false; //Test if the next synchro is available int32u PacketLength=BigEndian2int32u(Buffer+Buffer_Offset+6); if (File_Offset+Buffer_Offset+PacketLength+16<=File_Size) { if (Buffer_Offset+PacketLength+16>Buffer_Size) return false; if (CC5(Buffer+Buffer_Offset+PacketLength )!=0x0000000001 || CC2(Buffer+Buffer_Offset+PacketLength+14)!=0xE1E2) Synched=false; } //We continue return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Gxf::Read_Buffer_Unsynched() { for (size_t Pos=0; PosOpen_Buffer_Unsynch(); #if MEDIAINFO_SEEK IFrame_IsParsed=false; #endif //MEDIAINFO_SEEK } //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_Gxf::Read_Buffer_Seek (size_t Method, int64u Value, int64u) { //Parsing switch (Method) { case 0 : Open_Buffer_Unsynch(); GoTo(Value); return 1; case 1 : Open_Buffer_Unsynch(); GoTo(File_Size*Value/10000); return 1; case 2 : //Timestamp { //We transform TimeStamp to a frame number if (Streams.empty() || Gxf_FrameRate(Streams[0x00].FrameRate_Code)==0) return (size_t)-1; //Not supported int64u Delay=0; if (TimeCodes.empty()) { if (Material_Fields_First_IsValid) Delay=float64_int64s(((float64)(Material_Fields_First/Material_Fields_FieldsPerFrame))/Gxf_FrameRate(Streams[0x00].FrameRate_Code)*1000000000); else Delay=0; } else { for (std::map::iterator TimeCode=TimeCodes.begin(); TimeCode!=TimeCodes.end(); ++TimeCode) { int64u TimeCode_First=((File_Gxf_TimeCode*)Streams[TimeCode->first].Parsers[0])->TimeCode_FirstFrame_ms; if (TimeCode_First==(int64u)-1) TimeCode_First=TimeCode->second.Milliseconds; if (TimeCode_First==(int64u)-1) Delay=0; else { Delay=TimeCode_First*1000000; break; } } } if (ValueGopSize!=(int64u)-1) { Value/=((File_Umf*)UMF_File)->GopSize; Value*=((File_Umf*)UMF_File)->GopSize; } Value*=Material_Fields_FieldsPerFrame; for (size_t Pos=0; Pos=IsParsingMiddle_MaxOffset) { Fill(); Open_Buffer_Unsynch(); Finish(); return; } } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- bool File_Gxf::Header_Begin() { #if MEDIAINFO_DEMUX //Handling of multiple frames in one block if (Element_Code==0xBF && Config->Demux_Unpacketize_Get() && Streams[TrackNumber].Demux_EventWasSent) //media block { Open_Buffer_Continue(Streams[TrackNumber].Parsers[0], Buffer+Buffer_Offset, 0); if (Config->Demux_EventWasSent) return false; Streams[TrackNumber].Demux_EventWasSent=false; } #endif //MEDIAINFO_DEMUX return true; } //--------------------------------------------------------------------------- void File_Gxf::Header_Parse() { //Parsing int32u PacketLength; int8u PacketType; Skip_B5( "Packet leader"); Get_B1 (PacketType, "Packet type"); Get_B4 (PacketLength, "Packet length"); Skip_B4( "Reserved"); Skip_B2( "Packet trailer"); //Filling Header_Fill_Size(PacketLength); Header_Fill_Code(PacketType); #if MEDIAINFO_DEMUX if (!Demux_HeaderParsed) { if (PacketType==0xBF) //media { if (Config->NextPacket_Get() && Config->Event_CallBackFunction_IsSet()) Config->Demux_EventWasSent=true; //First set is to indicate the user that header is parsed Demux_HeaderParsed=true; } } #endif //MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- void File_Gxf::Data_Parse() { //Counting Frame_Count++; switch (Element_Code) { case 0x00 : Finish("GXF"); break; case 0xBC : map(); break; case 0xBF : media(); break; case 0xFB : end_of_stream(); break; case 0xFC : field_locator_table(); break; case 0xFD : UMF_file(); break; default: ; } } //--------------------------------------------------------------------------- void File_Gxf::map() { Element_Name("map"); //Parsing int8u Version; Element_Begin1("Preamble"); BS_Begin(); Mark_1(); Mark_1(); Mark_1(); Get_S1(5, Version, "Version"); BS_End(); Skip_B1( "Reserved"); Element_End0(); Element_Begin1("Material Data"); int16u SectionLength; Get_B2 (SectionLength, "Section Length"); if (Element_Offset+SectionLength>=Element_Size) SectionLength=(int16u)(Element_Size-Element_Offset); int64u Material_Data_End=Element_Offset+SectionLength; while (Element_Offset=Element_Size) SectionLength=(int16u)(Element_Size-Element_Offset); int64u Track_Data_End=Element_Offset+SectionLength; while (Element_Offset=Track_Data_End) TrackLength=(int16u)(Track_Data_End-Element_Offset); int64u Track_End=Element_Offset+TrackLength; Element_Info1(TrackID&0x3F); Element_Info1(Gxf_MediaTypes(MediaType&0x7F)); FILLING_BEGIN(); MediaType&=0x7F; //Remove the last bit TrackID&=0x3F; //Remove the 2 last bits Streams[TrackID].MediaType=MediaType; Streams[TrackID].TrackID=TrackID; if (Streams[TrackID].Parsers.empty()) { Streams[TrackID].MediaType=MediaType; Streams[TrackID].TrackID=TrackID; //Parsers #if MEDIAINFO_DEMUX Element_Code=TrackID; #endif //MEDIAINFO_DEMUX switch (MediaType) { case 3 : case 4 : //JPEG { File__Analyze* Parser=new File__Analyze; Open_Buffer_Init(Parser); Parser->Accept(); Parser->Fill(); Parser->Stream_Prepare(Stream_Video); Parser->Fill(Stream_Video, 0, Video_Format, "JPEG"); Streams[TrackID].Parsers.push_back(Parser); } break; case 7 : case 8 : case 24 : //TimeCode { File__Analyze* Parser=new File_Gxf_TimeCode; Open_Buffer_Init(Parser); Streams[TrackID].Parsers.push_back(Parser); Parsers_Count++; Streams[TrackID].Searching_Payload=true; TimeCodes[TrackID].Milliseconds=(int64u)-1; } break; case 9 : case 10 : { File__Analyze* Parser=new File__Analyze; Open_Buffer_Init(Parser); Parser->Accept(); Parser->Fill(); Parser->Stream_Prepare(Stream_Audio); Parser->Fill(Stream_Audio, 0, Audio_Format, "PCM"); Parser->Fill(Stream_Audio, 0, Audio_Format_Settings_Endianness, "Little"); Streams[TrackID].Parsers.push_back(Parser); Audio_Count++; } break; case 11 : case 12 : case 20 : case 22 : case 23 : //MPEG Video { File__Analyze* Parser=new File_Mpegv(); ((File_Mpegv*)Parser)->FrameIsAlwaysComplete=true; ((File_Mpegv*)Parser)->Ancillary=&Ancillary; Open_Buffer_Init(Parser); Streams[TrackID].Parsers.push_back(Parser); Parsers_Count++; Streams[TrackID].Searching_Payload=true; } break; case 13 : case 14 : case 15 : case 16 : //DV { File__Analyze* Parser=new File_DvDif(); Open_Buffer_Init(Parser); Streams[TrackID].Parsers.push_back(Parser); Parsers_Count++; Streams[TrackID].Searching_Payload=true; } break; case 17 : //AC-3 in AES3 (half) case 18 : //Dolby E in AES3 (half) { File__Analyze* Parser=ChooseParser_ChannelGrouping(TrackID); if (Parser) { Open_Buffer_Init(Parser); Streams[TrackID].Parsers.push_back(Parser); Parsers_Count++; Audio_Count++; Streams[TrackID].Searching_Payload=true; } } break; case 21 : //Ancillary Metadata { File__Analyze* Parser=new File_Riff(); ((File_Riff*)Parser)->Ancillary=&Ancillary; Open_Buffer_Init(Parser); Streams[TrackID].Parsers.push_back(Parser); Parsers_Count++; Streams[TrackID].Searching_Payload=true; Ancillary=new File_Ancillary; Ancillary->WithTenBit=true; Ancillary->WithChecksum=true; Open_Buffer_Init(Ancillary); AncillaryData_StreamID=TrackID; if (SizeToAnalyze<8*16*1024*1024) SizeToAnalyze*=8; //10x more, to be sure to find captions } break; default : ; } if (Gxf_MediaTypes_StreamKind(MediaType)==Stream_Audio) { //Resolution switch (MediaType) { case 9 : case 18 : //24-bit Streams[TrackID].Infos["BitDepth"].From_Number(24); break; case 10 : case 17 : //16-bit Streams[TrackID].Infos["BitDepth"].From_Number(16); break; default : ; } //Channels switch (MediaType) { case 9 : case 10 : //Mono Streams[TrackID].Infos["Channel(s)"].From_Number(1); break; case 18 : //Stereo Streams[TrackID].Infos["Channel(s)"].From_Number(2); break; default : ; } //Sampling rate switch (MediaType) { case 9 : case 10 : case 17 : case 18 : //48000 Streams[TrackID].Infos["SamplingRate"].From_Number(48000); break; default : ; } //Bit rate switch (MediaType) { case 9 : //Mono, 48 KHz, 24-bit (or padded up to 24-bit) Streams[TrackID].Infos["BitRate"].From_Number(1*48000*24); break; case 10 : //Mono, 48 KHz, 16-bit Streams[TrackID].Infos["BitRate"].From_Number(1*48000*16); break; case 18 : //Stereo, 48 KHz, 24-bit (or padded up to 24-bit) Streams[TrackID].Infos["BitRate"].From_Number(2*48000*24); break; default : ; } } } FILLING_END(); int8u Hours=(int8u)-1, Minutes=(int8u)-1, Seconds=(int8u)-1, Fields=(int8u)-1; bool Invalid=true, DropFrame=true; bool TimeCode_Parsed=false; while (Element_Offset::iterator TimeCode=TimeCodes.begin(); TimeCode!=TimeCodes.end(); ++TimeCode) if (TrackID==TimeCode->first) for (size_t Pos=0; PosFrameRate_Code=Streams[0x00].FrameRate_Code; if (Gxf_MediaTypes_StreamKind(MediaType)==Stream_Video) Stream_Video_FrameRate_Code=Streams[TrackID].FrameRate_Code; } else Skip_XX(DataLength, "Unknown"); break; case 0x51 : //Lines per frame if (DataLength==4) { Get_B4 (Streams[TrackID].LinesPerFrame_Code, "Content"); Param_Info1(Gxf_LinesPerFrame_Height(Streams[TrackID].LinesPerFrame_Code)); Element_Info1(Gxf_LinesPerFrame_Height(Streams[TrackID].LinesPerFrame_Code)); } else Skip_XX(DataLength, "Unknown"); break; case 0x52 : //Fields per frame if (DataLength==4) { Get_B4 (Streams[TrackID].FieldsPerFrame_Code, "Content"); Param_Info1(Gxf_FieldsPerFrame(Streams[TrackID].FieldsPerFrame_Code)); Element_Info1(Gxf_FieldsPerFrame(Streams[TrackID].FieldsPerFrame_Code)); if (Gxf_MediaTypes_StreamKind(MediaType)==Stream_Video) { Stream_Video_FieldsPerFrame_Code=Streams[TrackID].FieldsPerFrame_Code; Material_Fields_FieldsPerFrame=Streams[TrackID].FieldsPerFrame_Code; } for (std::map::iterator TimeCode=TimeCodes.begin(); TimeCode!=TimeCodes.end(); ++TimeCode) if (TrackID==TimeCode->first) for (size_t Pos=0; PosFieldsPerFrame_Code=Streams[0x00].FieldsPerFrame_Code; } else Skip_XX(DataLength, "Unknown"); break; default : Skip_XX(DataLength, "Unknown"); } Element_End0(); } Element_End0(); //Test on TimeCode if (TimeCode_Parsed && !Invalid) { std::map::iterator TimeCode=TimeCodes.find(TrackID); if (TimeCode==TimeCodes.end() || TimeCode->second.Milliseconds==(int64u)-1) { float64 FrameRate=Gxf_FrameRate(Streams[TrackID].FrameRate_Code); TimeCodes[TrackID].Milliseconds=Hours *60*60*1000 +Minutes *60*1000 +Seconds *1000; MediaInfoLib::TimeCode TC; TC.Hours=Hours; TC.Minutes=Minutes; TC.Seconds=Seconds; TC.Frames=Fields/2; TC.DropFrame=DropFrame; TimeCodes[TrackID].String=TC.ToString(); if (!FrameRate) { //Time code frame rate is missing, using the video frame rate for (size_t Pos=0; PosGopSize!=(int64u)-1) IFrame_IsParsed=(((MediaFieldNumber-(Material_Fields_First_IsValid?Material_Fields_First:0))/Material_Fields_FieldsPerFrame)%((File_Umf*)UMF_File)->GopSize)==0; else if (Gxf_MediaTypes_StreamKind(Streams[TrackNumber].MediaType)==Stream_Video) IFrame_IsParsed=true; } #endif //MEDIAINFO_SEEK #if MEDIAINFO_DEMUX if (Streams[TrackNumber].MediaType!=8) //Not a TimeCode stream { Element_Code=TrackNumber; int64u TimeCode_First=0; if (!TimeCodes.empty()) { TimeCode_First=((File_Gxf_TimeCode*)Streams[TimeCodes.begin()->first].Parsers[0])->TimeCode_FirstFrame_ms; if (TimeCode_First==(int64u)-1) TimeCode_First=TimeCodes.begin()->second.Milliseconds; } if (TimeCode_First!=(int64u)-1) TimeCode_First*=1000000; if (Gxf_MediaTypes_StreamKind(Streams[TrackNumber].MediaType)==Stream_Video) { if (Gxf_FrameRate(Streams[TrackNumber].FrameRate_Code)) { FrameInfo.DTS=TimeCode_First+float64_int64s(((float64)MediaFieldNumber-(Material_Fields_First_IsValid?Material_Fields_First:0))/Material_Fields_FieldsPerFrame*1000000000/Gxf_FrameRate(Streams[TrackNumber].FrameRate_Code)); FrameInfo.PTS=(int64u)-1; FrameInfo.DUR=float64_int64s(((float64)1000000000)/Gxf_FrameRate(Streams[TrackNumber].FrameRate_Code)); } else FrameInfo.DTS=FrameInfo.PTS=FrameInfo.DUR=(int64u)-1; if (MediaFieldNumber-(Material_Fields_First_IsValid?Material_Fields_First:0)==0) Demux_random_access=true; else { if (UMF_File && ((File_Umf*)UMF_File)->GopSize!=(int64u)-1) Demux_random_access=(((MediaFieldNumber-(Material_Fields_First_IsValid?Material_Fields_First:0))/Material_Fields_FieldsPerFrame)%((File_Umf*)UMF_File)->GopSize)==0; else Demux_random_access=false; } } else if (Gxf_MediaTypes_StreamKind(Streams[TrackNumber].MediaType)==Stream_Audio) { if (Gxf_FrameRate(Streams[TrackNumber].FrameRate_Code)) { Frame_Count_NotParsedIncluded=(int64u)((MediaFieldNumber-(Material_Fields_First_IsValid?Material_Fields_First:0))/Gxf_FrameRate(Streams[TrackNumber].FrameRate_Code)*48000/32768/Material_Fields_FieldsPerFrame); //A block is 32768 samples at 48 KHz FrameInfo.PTS=TimeCode_First+Frame_Count_NotParsedIncluded*1000000000*32768/48000; //A block is 32768 samples at 48 KHz if (Material_Fields_First_IsValid && MediaFieldNumber!=Material_Fields_First && Streams[TrackNumber].FirstFrameDuration) //In case of offset, MediaFieldNumber-Material_Fields_First is not well rounded { FrameInfo.PTS+=Streams[TrackNumber].FirstFrameDuration; Frame_Count_NotParsedIncluded++; } FrameInfo.DTS=FrameInfo.PTS; } else FrameInfo.DTS=FrameInfo.PTS=(int64u)-1; FrameInfo.DUR=float64_int64s(((float64)1000000000)*32768/48000); Demux_random_access=true; } else { if (Gxf_FrameRate(Streams[0x00].FrameRate_Code)) FrameInfo.DTS=FrameInfo.PTS=TimeCode_First+float64_int64s(((float64)(MediaFieldNumber-(Material_Fields_First_IsValid?Material_Fields_First:0)))*1000000000/Gxf_FrameRate(Streams[0x00].FrameRate_Code)/Material_Fields_FieldsPerFrame); else FrameInfo.DTS=FrameInfo.PTS=(int64u)-1; FrameInfo.DUR=(int64u)-1; Demux_random_access=true; } #if MEDIAINFO_SEEK if (Gxf_MediaTypes_StreamKind(Streams[TrackNumber].MediaType)!=Stream_Video || IFrame_IsParsed) #endif //MEDIAINFO_SEEK { if (Gxf_MediaTypes_StreamKind(Streams[TrackNumber].MediaType)!=Stream_Audio) Frame_Count_NotParsedIncluded=(MediaFieldNumber-(Material_Fields_First_IsValid?Material_Fields_First:0))/Material_Fields_FieldsPerFrame; Demux_Level=(!Streams[TrackNumber].Parsers.empty() && (Streams[TrackNumber].Parsers[0]->Demux_UnpacketizeContainer || Streams[TrackNumber].Parsers[0]->Demux_Level==2))?4:2; //Intermediate (D-10 Audio) / Container Demux(Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset), ContentType_MainStream); } Element_Code=0xBF; //media } #endif //MEDIAINFO_DEMUX //Needed? if (!Streams[TrackNumber].Searching_Payload && IsParsingMiddle_MaxOffset==(int64u)-1) { Skip_XX(Element_Size-Element_Offset, "data"); //Element_DoNotShow(); return; } for (size_t Pos=0; PosFrameInfo.DTS=FrameInfo.DTS; Open_Buffer_Continue(Streams[TrackNumber].Parsers[Pos], Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent && Config->Demux_Unpacketize_Get()) Streams[TrackNumber].Demux_EventWasSent=true; #endif //MEDIAINFO_DEMUX //Multiple parsers if (Streams[TrackNumber].Parsers.size()>1) { if (!Streams[TrackNumber].Parsers[Pos]->Status[IsAccepted] && Streams[TrackNumber].Parsers[Pos]->Status[IsFinished]) { delete *(Streams[TrackNumber].Parsers.begin()+Pos); Streams[TrackNumber].Parsers.erase(Streams[TrackNumber].Parsers.begin()+Pos); Pos--; } else if (Streams[TrackNumber].Parsers.size()>1 && Streams[TrackNumber].Parsers[Pos]->Status[IsAccepted]) { File__Analyze* Parser=Streams[TrackNumber].Parsers[Pos]; for (size_t Pos2=0; Pos2ParseSpeed<1 && Streams[TrackNumber].Parsers.size()==1 && Streams[TrackNumber].Parsers[0]->Status[IsFilled]) { Streams[TrackNumber].Searching_Payload=false; if (Parsers_Count>0) Parsers_Count--; if (Parsers_Count==0) { TryToFinish(); } } } //--------------------------------------------------------------------------- void File_Gxf::end_of_stream() { Element_Name("end of stream"); } //--------------------------------------------------------------------------- void File_Gxf::field_locator_table() { Element_Name("field locator table"); //Parsing int32u Entries; #if MEDIAINFO_SEEK Get_L4 (Flt_FieldPerEntry, "Number of fields per FLT entry"); #else //MEDIAINFO_SEEK Skip_L4( "Number of fields per FLT entry"); #endif //MEDIAINFO_SEEK Get_L4 (Entries, "Number of FLT entries"); for (size_t Pos=0; PosGopSize!=(int64u)-1) { size_t NextIFrame=0; for (size_t Pos=0; Pos=NextIFrame) { seek Seek; Seek.FrameNumber=(Material_Fields_First_IsValid?Material_Fields_First:0)+Pos*Flt_FieldPerEntry; Seek.StreamOffset=Flt_Offsets[Pos]; Seeks.push_back(Seek); NextIFrame+=(size_t)((File_Umf*)UMF_File)->GopSize*Material_Fields_FieldsPerFrame; } Flt_Offsets.clear(); } #endif //MEDIAINFO_SEEK } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- void File_Gxf::Detect_EOF() { if (File_Offset+Buffer_Size>=SizeToAnalyze) { TryToFinish(); } } //--------------------------------------------------------------------------- File__Analyze* File_Gxf::ChooseParser_ChannelGrouping(int8u TrackID) { File_ChannelGrouping* Parser; if (Audio_Count%2) { if (!Streams[TrackID-1].IsChannelGrouping) return NULL; //Not a channel grouping Parser=new File_ChannelGrouping; Parser->CanBePcm=true; Parser->Channel_Pos=1; Parser->Common=((File_ChannelGrouping*)Streams[TrackID-1].Parsers[0])->Common; Parser->StreamID=TrackID-1; Streams[TrackID].IsChannelGrouping=true; } else { Parser=new File_ChannelGrouping; Parser->CanBePcm=true; Parser->Channel_Pos=0; //if (Descriptor->second.Infos.find("SamplingRate")!=Descriptor->second.Infos.end()) Streams[TrackID].IsChannelGrouping=true; Streams[TrackID].DisplayInfo=false; } Parser->BitDepth=24; Parser->Channel_Total=2; Parser->SamplingRate=48000; //TODO: find where this piece of info is avaialble Parser->Endianness='L'; #if MEDIAINFO_DEMUX if (Demux_UnpacketizeContainer) { Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX return Parser; } //--------------------------------------------------------------------------- void File_Gxf::TryToFinish() { if (!IsSub && File_Size!=(int64u)-1 && Config->ParseSpeed<1 && IsParsingMiddle_MaxOffset==(int64u)-1 && File_Size/2>SizeToAnalyze*4) { IsParsingMiddle_MaxOffset=File_Size/2+SizeToAnalyze*4; GoTo(File_Size/2); Open_Buffer_Unsynch(); Parsers_Count=(int8u)-1; return; } Finish(); } } //NameSpace #endif //MEDIAINFO_GXF_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Gxf.h100777 0 0 12444 12226004262 15222 0/* 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 GXF files // SMPTE 360M - General Exchange Format // SMPTE RDD 14-2007 - General Exchange Format-2 // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_GxfH #define MediaInfo_File_GxfH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #if defined(MEDIAINFO_ANCILLARY_YES) #include #endif //defined(MEDIAINFO_ANCILLARY_YES) //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Gxf //*************************************************************************** class File_Gxf : public File__Analyze { public : //Constructor/Destructor File_Gxf(); ~File_Gxf(); private : //Streams management void Streams_Finish(); //Buffer - Synchro bool Synchronize(); bool Synched_Test(); //Buffer - Global void Read_Buffer_Unsynched(); #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK void Read_Buffer_AfterParsing(); //Buffer - Per element bool Header_Begin(); void Header_Parse(); void Data_Parse(); //Packets void map(); void media(); void end_of_stream(); void field_locator_table(); void UMF_file(); //Temp - Global #if defined(MEDIAINFO_ANCILLARY_YES) File_Ancillary* Ancillary; #endif //defined(MEDIAINFO_ANCILLARY_YES) int32u Material_Fields_First; int32u Material_Fields_Last; int32u Material_File_Size; int32u Material_Fields_FieldsPerFrame; int8u Parsers_Count; int8u AncillaryData_StreamID; struct tc { int64u Milliseconds; string String; tc() { Milliseconds=(int64u)-1; } }; std::map TimeCodes; //Key is StreamID bool Material_Fields_First_IsValid; bool Material_Fields_Last_IsValid; bool Material_File_Size_IsValid; //Temp - Stream struct stream { std::vector Parsers; int64u FirstFrameDuration; //In case of audio, indicates the duration of the first frame stream_t StreamKind; size_t StreamPos; int32u TimeStamp_Start; int32u TimeStamp_End; int32u FrameRate_Code; int32u LinesPerFrame_Code; int32u FieldsPerFrame_Code; int8u MediaType; int8u TrackID; bool Searching_Payload; bool Searching_TimeStamp_Start; bool Searching_TimeStamp_End; bool IsChannelGrouping; bool DisplayInfo; //In case of channel grouping, info is about the complete (2*half) stream, so second stream info must not be used Ztring MediaName; std::map Infos; #if MEDIAINFO_DEMUX bool Demux_EventWasSent; #endif //MEDIAINFO_DEMUX stream() { FirstFrameDuration=0; StreamKind=Stream_Max; StreamPos=(size_t)-1; Searching_Payload=false; Searching_TimeStamp_Start=false; Searching_TimeStamp_End=false; FrameRate_Code=(int32u)-1; LinesPerFrame_Code=(int32u)-1; FieldsPerFrame_Code=(int32u)-1; MediaType=(int8u)-1; TrackID=(int8u)-1; IsChannelGrouping=false; DisplayInfo=true; #if MEDIAINFO_DEMUX Demux_EventWasSent=false; #endif //MEDIAINFO_DEMUX } ~stream() { for (size_t Pos=0; Pos Streams; File__Analyze* UMF_File; int64u SizeToAnalyze; //Total size of a chunk to analyse, it may be changed by the parser int64u IsParsingMiddle_MaxOffset; int8u Audio_Count; int8u TrackNumber; //File__Analyze helpers void Streams_Finish_PerStream(size_t StreamID, stream &Temp); void Detect_EOF(); File__Analyze* ChooseParser_ChannelGrouping(int8u TrackID); void TryToFinish(); #if MEDIAINFO_DEMUX bool Demux_HeaderParsed; #endif //MEDIAINFO_DEMUX #if MEDIAINFO_SEEK int32u Flt_FieldPerEntry; std::vector Flt_Offsets; //In 1024-byte struct seek { int64u FrameNumber; int32u StreamOffset; //In 1024-byte }; std::vector Seeks; bool IFrame_IsParsed; #endif //MEDIAINFO_SEEK }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Gxf_TimeCode.cpp100777 0 0 36512 12226004262 17330 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_TIMECODE_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Gxf_TimeCode.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constants //*************************************************************************** //--------------------------------------------------------------------------- #if defined(MEDIAINFO_GXF_YES) extern double Gxf_FrameRate(int32u Content); #else //defined(MEDIAINFO_GXF_YES) double Gxf_FrameRate(int32u Content) //TODO: remove any relationship with GXF { switch (Content) { case 1 : return 60.000; case 2 : return 59.940; case 3 : return 50.000; case 4 : return 30.000; case 5 : return 29.970; case 6 : return 25.000; case 7 : return 24.000; case 8 : return 23.976; default: return 0.000; } } #endif //defined(MEDIAINFO_GXF_YES) //--------------------------------------------------------------------------- const char* Atc_PayloadType (int8u PayloadType) { switch (PayloadType) { case 0 : return "ATC_LTC"; case 1 : return "ATC_VITC1"; case 2 : return "ATC_VITC2"; default : return ""; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Gxf_TimeCode::File_Gxf_TimeCode() :File__Analyze() { //Configuration ParserName=__T("Time code"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Gxf; StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_Level=2; //Container #endif //MEDIAINFO_DEMUX //In FrameRate_Code=(int32u)-1; FieldsPerFrame_Code=(int32u)-1; IsAtc=false; //Out TimeCode_FirstFrame_ms=(int64u)-1; } //--------------------------------------------------------------------------- File_Gxf_TimeCode::~File_Gxf_TimeCode() { } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Gxf_TimeCode::Streams_Fill() { Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Delay, TimeCode_FirstFrame_ms); if (TimeCode_FirstFrame.size()==11) Fill(Stream_Video, StreamPos_Last, Video_Delay_DropFrame, TimeCode_FirstFrame[8]==';'?"Yes":"No"); Fill(Stream_Video, 0, Video_Delay_Source, "Container"); Fill(Stream_Video, 0, Video_TimeCode_FirstFrame, TimeCode_FirstFrame.c_str()); //Fill(Stream_Video, 0, Video_TimeCode_Source, "Time code track"); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Delay, TimeCode_FirstFrame_ms); if (TimeCode_FirstFrame.size()==11) Fill(Stream_Audio, StreamPos_Last, Audio_Delay_DropFrame, TimeCode_FirstFrame[8]==';'?"Yes":"No"); Fill(Stream_Audio, 0, Audio_Delay_Source, "Container"); Fill(Stream_Audio, 0, Video_TimeCode_FirstFrame, TimeCode_FirstFrame.c_str()); //Fill(Stream_Audio, 0, Video_TimeCode_Source, "Time code track"); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Gxf_TimeCode::Read_Buffer_Continue() { int8u Validity[504]; if (!IsAtc) { if (Element_Size!=4096) { Skip_XX(Element_Size, "Data"); return; } //Reading bitmap first (validity of first byte is at the end) Element_Offset=504*8; Element_Begin1("Validity"); BS_Begin_LE(); //is Little Endian for (size_t Pos=0; Pos<504; Pos++) { bool Validity_Bit; Get_TB (Validity_Bit, "Bit"); Validity[Pos]=Validity_Bit?1:0; } BS_End_LE(); Skip_B1( "Pad"); Element_End0(); } //Parsing Element_Offset=0; for (size_t Pos=0; Pos<(IsAtc?(size_t)1:(size_t)504); Pos++) { if (IsAtc || Validity[Pos]) { Element_Begin1("TimeCode"); int8u Frames_Units, Frames_Tens, Seconds_Units, Seconds_Tens, Minutes_Units, Minutes_Tens, Hours_Units, Hours_Tens; bool DropFrame; int8u DBB1=0, DBB2=0; if (IsAtc) { bool Temp; BS_Begin(); Get_S1 (4, Frames_Units, "Frames (Units)"); Get_SB ( Temp, "DBB1_0"); if (Temp) DBB1|=(1<<0); Skip_S1(3, "Zero"); Skip_S1(4, "BG1"); Get_SB ( Temp, "DBB1_1"); if (Temp) DBB1|=(1<<1); Skip_S1(3, "Zero"); Skip_SB( "CF - Color fame"); Get_SB ( DropFrame, "DP - Drop frame"); Get_S1 (2, Frames_Tens, "Frames (Tens)"); Get_SB ( Temp, "DBB1_2"); if (Temp) DBB1|=(1<<2); Skip_S1(3, "Zero"); Skip_S1(4, "BG2"); Get_SB ( Temp, "DBB1_3"); if (Temp) DBB1|=(1<<3); Skip_S1(3, "Zero"); Get_S1 (4, Seconds_Units, "Seconds (Units)"); Get_SB ( Temp, "DBB1_4"); if (Temp) DBB1|=(1<<4); Skip_S1(3, "Zero"); Skip_S1(4, "BG3"); Get_SB ( Temp, "DBB1_5"); if (Temp) DBB1|=(1<<5); Skip_S1(3, "Zero"); Skip_SB( "FM - Frame Mark"); Get_S1 (3, Seconds_Tens, "Seconds (Tens)"); Get_SB ( Temp, "DBB1_6"); if (Temp) DBB1|=(1<<6); Skip_S1(3, "Zero"); Skip_S1(4, "BG4"); Get_SB ( Temp, "DBB1_7"); if (Temp) DBB1|=(1<<7); Skip_S1(3, "Zero"); Get_S1 (4, Minutes_Units, "Minutes (Units)"); Get_SB ( Temp, "DBB2_0"); if (Temp) DBB2|=(1<<0); Skip_S1(3, "Zero"); Skip_S1(4, "BG5"); Get_SB ( Temp, "DBB2_1"); if (Temp) DBB2|=(1<<1); Skip_S1(3, "Zero"); Skip_SB( "BGF0"); Get_S1 (3, Minutes_Tens, "Minutes (Tens)"); Get_SB ( Temp, "DBB2_2"); if (Temp) DBB2|=(1<<2); Skip_S1(3, "Zero"); Skip_S1(4, "BG6"); Get_SB ( Temp, "DBB2_3"); if (Temp) DBB2|=(1<<3); Skip_S1(3, "Zero"); Get_S1 (4, Hours_Units, "Hours (Units)"); Get_SB ( Temp, "DBB2_4"); if (Temp) DBB2|=(1<<4); Skip_S1(3, "Zero"); Skip_S1(4, "BG7"); Get_SB ( Temp, "DBB2_5"); if (Temp) DBB2|=(1<<5); Skip_S1(3, "Zero"); Skip_SB( "BGF2"); Skip_SB( "BGF1"); Get_S1 (2, Hours_Tens, "Hours (Tens)"); Get_SB ( Temp, "DBB2_6"); if (Temp) DBB2|=(1<<6); Skip_S1(3, "Zero"); Skip_S1(4, "BG8"); Get_SB ( Temp, "DBB2_7"); if (Temp) DBB2|=(1<<7); Skip_S1(3, "Zero"); BS_End(); } else { BS_Begin(); Skip_S1(4, "BG1"); Get_S1 (4, Frames_Units, "Frames (Units)"); Skip_S1(4, "BG2"); Skip_SB( "CF - Color fame"); Get_SB ( DropFrame, "DP - Drop frame"); Get_S1 (2, Frames_Tens, "Frames (Tens)"); Skip_S1(4, "BG3"); Get_S1 (4, Seconds_Units, "Seconds (Units)"); Skip_S1(4, "BG4"); Skip_SB( "FM - Frame Mark"); Get_S1 (3, Seconds_Tens, "Seconds (Tens)"); Skip_S1(4, "BG5"); Get_S1 (4, Minutes_Units, "Minutes (Units)"); Skip_S1(4, "BG6"); Skip_SB( "BGF0"); Get_S1 (3, Minutes_Tens, "Minutes (Tens)"); Skip_S1(4, "BG7"); Get_S1 (4, Hours_Units, "Hours (Units)"); Skip_S1(4, "BG8"); Skip_SB( "BGF2"); Skip_SB( "BGF1"); Get_S1 (2, Hours_Tens, "Hours (Tens)"); BS_End(); } int64u TimeCode_Ms=(int64u)(Hours_Tens *10*60*60*1000 + Hours_Units *60*60*1000 + Minutes_Tens *10*60*1000 + Minutes_Units *60*1000 + Seconds_Tens *10*1000 + Seconds_Units *1000 + (Gxf_FrameRate(FrameRate_Code)==0?0:((Frames_Tens*10+Frames_Units)*1000/float64_int32s(Gxf_FrameRate(FrameRate_Code)/(Gxf_FrameRate(FrameRate_Code)>30?2:1))))); if (TimeCode_FirstFrame.empty()) { TimeCode_FirstFrame+=('0'+Hours_Tens); TimeCode_FirstFrame+=('0'+Hours_Units); TimeCode_FirstFrame+=':'; TimeCode_FirstFrame+=('0'+Minutes_Tens); TimeCode_FirstFrame+=('0'+Minutes_Units); TimeCode_FirstFrame+=':'; TimeCode_FirstFrame+=('0'+Seconds_Tens); TimeCode_FirstFrame+=('0'+Seconds_Units); TimeCode_FirstFrame+=DropFrame?';':':'; TimeCode_FirstFrame+=('0'+Frames_Tens); TimeCode_FirstFrame+=('0'+Frames_Units); } #if MEDIAINFO_TRACE string TimeCode; TimeCode+=('0'+Hours_Tens); TimeCode+=('0'+Hours_Units); TimeCode+=':'; TimeCode+=('0'+Minutes_Tens); TimeCode+=('0'+Minutes_Units); TimeCode+=':'; TimeCode+=('0'+Seconds_Tens); TimeCode+=('0'+Seconds_Units); TimeCode+=DropFrame?';':':'; TimeCode+=('0'+Frames_Tens); TimeCode+=('0'+Frames_Units); Element_Info1(TimeCode.c_str()); #endif //MEDIAINFO_TRACE if (IsAtc) { Settings=Atc_PayloadType(DBB1); Element_Info1(__T("PayloadType=")+Ztring().From_UTF8(Settings.c_str())); Element_Info1(__T("VitcLineSelect=")+Ztring::ToZtring(DBB2&0x1F)); } Element_End0(); FILLING_BEGIN(); if (TimeCode_FirstFrame_ms==(int64u)-1) TimeCode_FirstFrame_ms=TimeCode_Ms; FILLING_END(); } else Skip_XX(8, "Junk"); } //bitmap, already parsed Element_Offset+=64; FILLING_BEGIN(); if (!Status[IsFilled] && TimeCode_FirstFrame_ms!=(int64u)-1) { Accept(); Fill(); if (MediaInfoLib::Config.ParseSpeed_Get()<1) Finish(); } FILLING_END(); } } //NameSpace #endif //MEDIAINFO_TIMECODE_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Gxf_TimeCode.h100777 0 0 3452 12226004262 16752 0/* 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 GXF files // SMPTE 360M - General Exchange Format // SMPTE RDD 14-2007 - General Exchange Format-2 // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_Gxf_TimeCodeH #define MediaInfo_File_Gxf_TimeCodeH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #if defined(MEDIAINFO_ANCILLARY_YES) #include #endif //defined(MEDIAINFO_ANCILLARY_YES) #include "MediaInfo/TimeCode.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Gxf_TimeCode //*************************************************************************** class File_Gxf_TimeCode : public File__Analyze { public : //In int32u FrameRate_Code; int32u FieldsPerFrame_Code; bool IsAtc; // SMPTE ST 12-2 //Out int64u TimeCode_FirstFrame_ms; string TimeCode_FirstFrame; string Settings; //Constructor/Destructor File_Gxf_TimeCode(); ~File_Gxf_TimeCode(); private : //Streams management void Streams_Fill(); //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_HdsF4m.cpp100777 0 0 12216 12226004262 16113 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_HDSF4M_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_HdsF4m.h" #include "MediaInfo/Multiple/File__ReferenceFilesHelper.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "ZenLib/FileName.h" #include "ZenLib/File.h" #include "tinyxml2.h" using namespace ZenLib; using namespace tinyxml2; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_HdsF4m::File_HdsF4m() :File__Analyze() { #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_HdsF4m; StreamIDs_Width[0]=16; #endif //MEDIAINFO_EVENTS //Temp ReferenceFiles=NULL; } //--------------------------------------------------------------------------- File_HdsF4m::~File_HdsF4m() { delete ReferenceFiles; //ReferenceFiles=NULL; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_HdsF4m::Streams_Finish() { if (ReferenceFiles==NULL) return; ReferenceFiles->ParseReferences(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_HdsF4m::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { if (ReferenceFiles==NULL) return 0; return ReferenceFiles->Read_Buffer_Seek(Method, Value, ID); } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_HdsF4m::FileHeader_Begin() { XMLDocument document; if (!FileHeader_Begin_XML(document)) return false; { XMLElement* Root=document.FirstChildElement("manifest"); if (Root) { const char* Attribute=Root->Attribute("xmlns"); if (Attribute==NULL || Ztring().From_UTF8(Attribute)!=__T("http://ns.adobe.com/f4m/1.0")) { Reject("HdsF4m"); return false; } Accept("HdsF4m"); Fill(Stream_General, 0, General_Format, "HDS F4M"); Config->File_ID_OnlyRoot_Set(false); ReferenceFiles=new File__ReferenceFilesHelper(this, Config); //Parsing main elements Ztring BaseURL; for (XMLElement* Root_Item=Root->FirstChildElement(); Root_Item; Root_Item=Root_Item->NextSiblingElement()) { //Common information if (string(Root_Item->Value())=="BaseURL") { if (BaseURL.empty()) //Using the first one BaseURL=Root_Item->GetText(); } //Period if (string(Root_Item->Value())=="media") { File__ReferenceFilesHelper::reference ReferenceFile; const char* Attribute; //Attributes - mineType Attribute=Root_Item->Attribute("url"); if (Attribute) ReferenceFile.FileNames.push_back(Ztring().From_UTF8(Attribute)+__T("Seg1.f4f")); ReferenceFile.StreamID=ReferenceFiles->References.size()+1; ReferenceFiles->References.push_back(ReferenceFile); } } } else { Reject("HdsF4m"); return false; } } Element_Offset=File_Size; //All should be OK... return true; } } //NameSpace #endif //MEDIAINFO_HDSF4M_YES MediaInfoLib/Source/MediaInfo/Multiple/File_HdsF4m.h100777 0 0 3173 12226004262 15542 0/* 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 HDS (.f4m) files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_HdsF4mH #define MediaInfo_File_HdsF4mH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { class File__ReferenceFilesHelper; //*************************************************************************** // Class File_HdsF4m //*************************************************************************** class File_HdsF4m : public File__Analyze { public : //Constructor/Destructor File_HdsF4m(); ~File_HdsF4m(); private : //Streams management void Streams_Finish (); //Buffer - Global #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK //Buffer - File header bool FileHeader_Begin(); //Helpers void Representation(); //Temp File__ReferenceFilesHelper* ReferenceFiles; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Hls.cpp100777 0 0 13561 12226004262 15560 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_HLS_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Hls.h" #include "MediaInfo/MediaInfo.h" #include "MediaInfo/MediaInfo_Internal.h" #include "MediaInfo/Multiple/File__ReferenceFilesHelper.h" #include "ZenLib/Dir.h" #include "ZenLib/FileName.h" #include "ZenLib/ZtringList.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Hls::File_Hls() :File__Analyze() { #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Hls; StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_EventWasSent_Accept_Specific=true; #endif //MEDIAINFO_DEMUX //Temp ReferenceFiles=NULL; } //--------------------------------------------------------------------------- File_Hls::~File_Hls() { delete ReferenceFiles; //ReferenceFiles=NULL; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Hls::Streams_Finish() { if (ReferenceFiles==NULL) return; ReferenceFiles->ParseReferences(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_Hls::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { if (ReferenceFiles==NULL) return 0; return ReferenceFiles->Read_Buffer_Seek(Method, Value, ID); } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Hls::FileHeader_Begin() { //Element_Size if (File_Size>1024*1024 || File_Size<10) { Reject("HLS"); return false; //HLS files are not big } if (Buffer_SizeFile_Size-1) { Reject("HLS"); return false; } Ztring LinesSeparator; if (Document[LinesSeparator_Pos]==__T('\r') && Document[LinesSeparator_Pos+1]==__T('\n')) LinesSeparator=__T("\r\n"); else if (Document[LinesSeparator_Pos]==__T('\r')) LinesSeparator=__T("\r"); else if (Document[LinesSeparator_Pos]==__T('\n')) LinesSeparator=__T("\n"); else { Reject("HLS"); return false; } Lines.Separator_Set(0, LinesSeparator); Lines.Write(Document); if (Lines(0)!=__T("#EXTM3U")) { Reject("HLS"); return false; } Accept("HLS"); Fill(Stream_General, 0, General_Format, "HLS"); ReferenceFiles=new File__ReferenceFilesHelper(this, Config); if (!IsSub) ReferenceFiles->ContainerHasNoId=true; File__ReferenceFilesHelper::reference ReferenceFile; bool IsGroup=false; for (size_t Line=0; LineReferences.size()+1; ReferenceFiles->References.push_back(ReferenceStream); IsGroup=false; #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_HlsIndex; StreamIDs_Width[0]=sizeof(size_t)*2; #endif //MEDIAINFO_EVENTS } else ReferenceFile.FileNames.push_back(Lines[Line]); } } } if (ReferenceFiles->References.empty()) { ReferenceFiles->References.push_back(ReferenceFile); ReferenceFiles->TestContinuousFileNames=true; } Element_Offset=File_Size; //All should be OK... return true; } } //NameSpace #endif //MEDIAINFO_HLS_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Hls.h100777 0 0 3065 12226004262 15203 0/* 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 HLS files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_HlsH #define MediaInfo_File_HlsH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { class File__ReferenceFilesHelper; //*************************************************************************** // Class File_Hls //*************************************************************************** class File_Hls : public File__Analyze { public : //Constructor/Destructor File_Hls(); ~File_Hls(); private : //Streams management void Streams_Finish (); //Buffer - Global #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK //Buffer - File header bool FileHeader_Begin(); //Temp File__ReferenceFilesHelper* ReferenceFiles; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Ibi.cpp100777 0 0 67733 12226004262 15547 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if MEDIAINFO_IBI //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Ibi.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Ibi::File_Ibi() :File__Analyze() { //Configuration #if MEDIAINFO_DEMUX Demux_Level=2; //Container #endif //MEDIAINFO_DEMUX DataMustAlwaysBeComplete=false; //In Ibi=NULL; //Temp Ibi_MustDelete=false; } //--------------------------------------------------------------------------- File_Ibi::~File_Ibi() { if (Ibi_MustDelete) delete Ibi; //Ibi=NULL; } //*************************************************************************** // Get information //*************************************************************************** //--------------------------------------------------------------------------- const Ztring &File_Ibi::Get (stream_t /*StreamKind*/, size_t /*StreamNumber*/, const Ztring &Parameter, info_t /*KindOfInfo*/, info_t /*KindOfSearch*/) { ibi::streams::iterator IbiStream_Temp=Ibi->Streams.begin(); //TODO: management of multiple streams if (IbiStream_Temp!=Ibi->Streams.end() && !IbiStream_Temp->second->Infos.empty()) { int64u FrameNumber=Parameter.To_int64u(); for (size_t Pos=0; Possecond->Infos.size()-1; Pos++) if (IbiStream_Temp->second->Infos[Pos].FrameNumber==FrameNumber || IbiStream_Temp->second->Infos[Pos+1].FrameNumber>FrameNumber) { Get_Temp=__T("StreamOffset=")+Ztring::ToZtring(IbiStream_Temp->second->Infos[Pos].StreamOffset) + __T(" / FrameNumber=")+Ztring::ToZtring(IbiStream_Temp->second->Infos[Pos].FrameNumber) + __T(" / Dts=")+Ztring::ToZtring(IbiStream_Temp->second->Infos[Pos].Dts); return Get_Temp; } } //Can not be found Get_Temp.clear(); return Get_Temp; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Ibi::Streams_Accept() { Fill(Stream_General, 0, General_Format, "Ibi"); if (Ibi==NULL) { Ibi=new ibi(); Ibi_MustDelete=true; } } //--------------------------------------------------------------------------- void File_Ibi::Streams_Finish() { Config->File_KeepInfo_Set(true); //In order to let Get() available if (Count_Get(Stream_Video)==0) //If not yet done by Inform part for (ibi::streams::iterator IbiStream_Temp=Ibi->Streams.begin(); IbiStream_Temp!=Ibi->Streams.end(); ++IbiStream_Temp) { Stream_Prepare(Stream_Video); Fill(Stream_Video, StreamPos_Last, General_ID, IbiStream_Temp->first); } } //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- void File_Ibi::Header_Parse() { //Test of zero padding int8u Null; Peek_B1(Null); if (Null==0x00) { if (Buffer_Offset_Temp==0) Buffer_Offset_Temp=Buffer_Offset+1; while (Buffer_Offset_Temp=Buffer_Size) { Element_WaitForMoreData(); return; } Header_Fill_Code((int32u)-1); //Should be (int64u)-1 but Borland C++ does not like this Header_Fill_Size(Buffer_Offset_Temp-Buffer_Offset); Buffer_Offset_Temp=0; return; } //Parsing int64u Name, Size; Get_EB (Name, "Name"); Get_EB (Size, "Size"); //Filling Header_Fill_Code(Name, Ztring().From_Number(Name, 16)); Header_Fill_Size(Element_Offset+Size); } //--------------------------------------------------------------------------- namespace Elements { //Common const int64u Zero=(int32u)-1; //Should be (int64u)-1 but Borland C++ does not like this const int64u CRC32=0x3F; const int64u Void=0x6C; //EBML const int64u Ebml=0xA45DFA3; const int64u Ebml_Version=0x286; const int64u Ebml_ReadVersion=0x2F7; const int64u Ebml_MaxIDLength=0x2F2; const int64u Ebml_MaxSizeLength=0x2F3; const int64u Ebml_DocType=0x282; const int64u Ebml_DocTypeVersion=0x287; const int64u Ebml_DocTypeReadVersion=0x285; //Segment const int64u Stream=1; const int64u Stream_Header=1; const int64u Stream_ByteOffset=2; const int64u Stream_FrameNumber=3; const int64u Stream_Dts=4; const int64u CompressedIndex=2; const int64u WritingApplication=3; const int64u WritingApplication_Name=1; const int64u WritingApplication_Version=2; const int64u InformData=4; const int64u SourceInfo=5; const int64u SourceInfo_IndexCreationDate=1; const int64u SourceInfo_SourceModificationDate=2; const int64u SourceInfo_SourceSize=3; } //--------------------------------------------------------------------------- void File_Ibi::Data_Parse() { #define LIS2(_ATOM, _NAME) \ case Elements::_ATOM : \ if (Level==Element_Level) \ { \ Element_Name(_NAME); \ _ATOM(); \ Element_ThisIsAList(); \ } \ #define ATO2(_ATOM, _NAME) \ case Elements::_ATOM : \ if (Level==Element_Level) \ { \ if (Element_IsComplete_Get()) \ { \ Element_Name(_NAME); \ _ATOM(); \ } \ else \ { \ Element_WaitForMoreData(); \ return; \ } \ } \ break; \ #define ATOM_END_MK \ ATOM(Zero) \ ATOM(CRC32) \ ATOM(Void) \ ATOM_END //Parsing DATA_BEGIN LIST(Ebml) ATOM_BEGIN ATOM(Ebml_Version) ATOM(Ebml_ReadVersion) ATOM(Ebml_MaxIDLength) ATOM(Ebml_MaxSizeLength) ATOM(Ebml_DocType) ATOM(Ebml_DocTypeVersion) ATOM(Ebml_DocTypeReadVersion) ATOM_END_MK LIST(Stream) ATOM_BEGIN ATOM(Stream_Header) ATOM(Stream_ByteOffset) ATOM(Stream_FrameNumber) ATOM(Stream_Dts) ATOM_END_MK ATOM(CompressedIndex) LIST(WritingApplication) ATOM_BEGIN ATOM(WritingApplication_Name) ATOM(WritingApplication_Version) ATOM_END_MK LIST(SourceInfo) ATOM_BEGIN ATOM(SourceInfo_IndexCreationDate) ATOM(SourceInfo_SourceModificationDate) ATOM(SourceInfo_SourceSize) ATOM_END_MK ATOM(InformData) DATA_END_DEFAULT } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Ibi::Zero() { Element_Name("ZeroPadding"); } //--------------------------------------------------------------------------- void File_Ibi::CRC32() { Element_Name("CRC32"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Ibi::Void() { Element_Name("Void"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Ibi::Ebml() { Element_Name("Ebml"); } //--------------------------------------------------------------------------- void File_Ibi::Ebml_Version() { Element_Name("Version"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Ibi::Ebml_ReadVersion() { Element_Name("ReadVersion"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Ibi::Ebml_MaxIDLength() { Element_Name("MaxIDLength"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Ibi::Ebml_MaxSizeLength() { Element_Name("MaxSizeLength"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Ibi::Ebml_DocType() { Element_Name("DocType"); //Parsing Ztring Data; Get_Local(Element_Size, Data, "Data"); Element_Info1(Data); //Filling FILLING_BEGIN(); if (Data==__T("MediaInfo Index")) Accept("Ibi"); else { Reject("Ibi"); return; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Ibi::Ebml_DocTypeVersion() { Element_Name("DocTypeVersion"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Ibi::Ebml_DocTypeReadVersion() { Element_Name("DocTypeReadVersion"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Ibi::Stream() { Element_Name("Stream"); ID_Current=(int64u)-1; } void File_Ibi::Stream_Header() { Element_Name("Stream Header"); Get_EB (ID_Current, "ID"); FILLING_BEGIN(); if (Ibi) { //Filling information for ID after data ibi::streams::iterator IbiStream_Temp=Ibi->Streams.find((int64u)-1); if (IbiStream_Temp!=Ibi->Streams.end()) { Ibi->Streams[ID_Current]=IbiStream_Temp->second; Ibi->Streams.erase(IbiStream_Temp); } } FILLING_END(); } void File_Ibi::Stream_ByteOffset() { Element_Name("Byte Offset"); //Parsing size_t Pos=0; int64u Offset=0; while (Element_OffsetStreams[ID_Current]==NULL) Ibi->Streams[ID_Current]=new ibi::stream(); if (Pos>=Ibi->Streams[ID_Current]->Infos.size()) { Ibi->Streams[ID_Current]->Infos.push_back(ibi::stream::info()); Ibi->Streams[ID_Current]->Infos[Pos].IsContinuous=true; //default } Ibi->Streams[ID_Current]->Infos[Pos].StreamOffset=Offset; Pos++; } FILLING_END(); } } void File_Ibi::Stream_FrameNumber() { Element_Name("Frame Number"); //Parsing size_t Pos=0; int64u Offset=0; while (Element_OffsetStreams[ID_Current]==NULL) Ibi->Streams[ID_Current]=new ibi::stream(); if (Pos>=Ibi->Streams[ID_Current]->Infos.size()) { Ibi->Streams[ID_Current]->Infos.push_back(ibi::stream::info()); Ibi->Streams[ID_Current]->Infos[Pos].IsContinuous=true; //default } Ibi->Streams[ID_Current]->Infos[Pos].FrameNumber=Offset; Pos++; } FILLING_END(); } } void File_Ibi::Stream_Dts() { Element_Name("DTS"); //Parsing int64u Item; Get_EB (Item, "DtsFrequencyNumerator"); FILLING_BEGIN(); if (Ibi) Ibi->Streams[ID_Current]->DtsFrequencyNumerator=Item; FILLING_END(); Get_EB (Item, "DtsFrequencyDenominator"); FILLING_BEGIN(); if (Ibi) { Ibi->Streams[ID_Current]->DtsFrequencyDenominator=Item; //Handling of previous inverted Numerator/Denominator if (Ibi->Streams[ID_Current]->DtsFrequencyNumeratorStreams[ID_Current]->DtsFrequencyDenominator) std::swap(Ibi->Streams[ID_Current]->DtsFrequencyNumerator, Ibi->Streams[ID_Current]->DtsFrequencyDenominator); } FILLING_END(); size_t Pos=0; int64u Offset=0; while (Element_OffsetStreams[ID_Current]==NULL) Ibi->Streams[ID_Current]=new ibi::stream(); if (Pos>=Ibi->Streams[ID_Current]->Infos.size()) { Ibi->Streams[ID_Current]->Infos.push_back(ibi::stream::info()); Ibi->Streams[ID_Current]->Infos[Pos].IsContinuous=true; //default } Ibi->Streams[ID_Current]->Infos[Pos].Dts=Offset; Pos++; } FILLING_END(); } } void File_Ibi::CompressedIndex() { if (!Status[IsAccepted]) { Reject("Ibi"); return; } Element_Name("Compressed Index"); int64u UncompressedSize; Get_EB (UncompressedSize, "Uncompressed size"); //Sizes unsigned long Source_Size=(unsigned long)(Element_Size-Element_Offset); unsigned long Dest_Size=(unsigned long)UncompressedSize; //Uncompressing int8u* Dest; try { Dest=new int8u[Dest_Size]; } catch (...) { //Memory error Reject(); return; } if (uncompress((Bytef*)Dest, &Dest_Size, (const Bytef*)Buffer+Buffer_Offset+(size_t)Element_Offset, Source_Size)<0) { Skip_XX(Element_Size-Element_Offset, "Problem during the decompression"); delete[] Dest; //Dest=NULL; return; } //Exiting this element Skip_XX(Element_Size-Element_Offset, "Will be parsed"); //Configuring buffer const int8u* Buffer_Sav=Buffer; size_t Buffer_Size_Sav=Buffer_Size; int8u* Buffer_Temp_Sav=Buffer_Temp; size_t Buffer_Temp_Size_Sav=Buffer_Temp_Size; size_t Buffer_Offset_Sav=Buffer_Offset; size_t Buffer_Offset_Temp_Sav=Buffer_Offset_Temp; Buffer=NULL; Buffer_Size=0; Buffer_Temp=NULL; Buffer_Temp_Size=0; Buffer_Offset=0; Buffer_Offset_Temp=0; //Configuring level std::vector Element_Sizes_Sav; size_t Element_Level_Sav=Element_Level; while(Element_Level) { Element_Sizes_Sav.push_back(Element_TotalSize_Get()); Element_End0(); } //Configuring file size int64u File_Size_Sav=File_Size; if (File_SizeIbi_UseIbiInfoIfAvailable_Get()) { for (size_t Pos=0; PosFields.size() || Fields[Pos].size()<1) break; //End or problem if (Fields[Pos][0]==__T("General")) ; //Nothing to do else if (Fields[Pos][0]==__T("Video")) Stream_Prepare(Stream_Video); else if (Fields[Pos][0]==__T("Audio")) Stream_Prepare(Stream_Audio); else if (Fields[Pos][0]==__T("Text")) Stream_Prepare(Stream_Text); else if (Fields[Pos][0]==__T("Other")) Stream_Prepare(Stream_Other); else if (Fields[Pos][0]==__T("Image")) Stream_Prepare(Stream_Image); else if (Fields[Pos][0]==__T("Menu")) Stream_Prepare(Stream_Menu); else break; //Problem Pos++; } Fill(StreamKind_Last, StreamPos_Last, Fields[Pos][0].To_UTF8().c_str(), Fields[Pos][1], true); if (Info_Options #include #include #include "base64.h" #include "ZenLib/File.h" #include "ZenLib/OS_Utils.h" #ifdef WINDOWS #undef __TEXT #include #endif using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Info //*************************************************************************** extern const Char* MediaInfo_Version; //*************************************************************************** // Ibi structure //*************************************************************************** //--------------------------------------------------------------------------- ibi::ibi() { } //--------------------------------------------------------------------------- ibi::~ibi() { for (streams::iterator Stream=Streams.begin(); Stream!=Streams.end(); ++Stream) delete Stream->second; //Stream->second=NULL; } //--------------------------------------------------------------------------- void ibi::stream::Add (const info &Info) { if (!IsSynchronized) { //Searching the right insertion point for (Infos_Pos=0; Infos_Pos>8)); List[1]=(int8u)Value; } return 2; } //3 bytes if (Value<=2097150) //2^21-2 { if (List) { List[0]=0x20|((int8u)(Value>>16)); List[1]=(int8u)(Value>>8); List[2]=(int8u)Value; } return 3; } //4 bytes if (Value<=268435454) //2^28-2 { if (List) { List[0]=0x10|((int8u)(Value>>24)); List[1]=(int8u)(Value>>16); List[2]=(int8u)(Value>>8); List[3]=(int8u)Value; } return 4; } //5 bytes if (Value<=34359738366LL) //2^35-2 { if (List) { List[0]=0x08|((int8u)(Value>>32)); List[1]=(int8u)(Value>>24); List[2]=(int8u)(Value>>16); List[3]=(int8u)(Value>>8); List[4]=(int8u)Value; } return 5; } //6 bytes if (Value<=4398046511102LL) //2^42-2 { if (List) { List[0]=0x04|((int8u)(Value>>40)); List[1]=(int8u)(Value>>32); List[2]=(int8u)(Value>>24); List[3]=(int8u)(Value>>16); List[4]=(int8u)(Value>>8); List[5]=(int8u)Value; } return 6; } //7 bytes if (Value<=562949953421310LL) //2^49-2 { if (List) { List[0]=0x02|((int8u)(Value>>48)); List[1]=(int8u)(Value>>40); List[2]=(int8u)(Value>>32); List[3]=(int8u)(Value>>24); List[4]=(int8u)(Value>>16); List[5]=(int8u)(Value>>8); List[6]=(int8u)Value; } return 7; } //8 bytes if (Value<=72057594037927934LL) //2^56-2 { if (List) { List[0]=0x01; List[1]=(int8u)(Value>>56); List[2]=(int8u)(Value>>40); List[3]=(int8u)(Value>>32); List[4]=(int8u)(Value>>24); List[5]=(int8u)(Value>>16); List[6]=(int8u)(Value>>8); List[7]=(int8u)Value; } return 8; } if (List) List[0]=0xFF; return 1; } size_t EbmlBlock(int8u* List, size_t List_MaxSize, int64u Code, int8u* Content, size_t Content_Size) { if (Content_Size==0) return 0; size_t Code_EbmlSize=int64u2Ebml(NULL, Code); size_t Content_EbmlSize=int64u2Ebml(NULL, Content_Size); if (List && Code_EbmlSize+Content_EbmlSize+Content_Size>List_MaxSize) return 0; if (List) { List+=int64u2Ebml(List, Code); List+=int64u2Ebml(List, Content_Size); std::memcpy(List, Content, Content_Size); //List+=Content_Size; //Content } return Code_EbmlSize+Content_EbmlSize+Content_Size; } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Ibi_Creation::File_Ibi_Creation() { } //--------------------------------------------------------------------------- File_Ibi_Creation::~File_Ibi_Creation() { for (size_t Pos=0; PosContent=new int8u[1+int64u2Ebml(NULL, 1+int64u2Ebml(NULL, BlockSizeWithoutHeader))+BlockSizeWithoutHeader]; Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, 0x05); //Source information Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, BlockSizeWithoutHeader); //Size Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, 0x01); //Index creation date Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, 8); //Size int64u2BigEndian(Buffer->Content+Buffer->Size, (int64u)CurrentDate); Buffer->Size+=8; //Content if (LastModifiedDate_IsValid) { Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, 0x02); //Source file modification date Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, 8); //Size int64u2BigEndian(Buffer->Content+Buffer->Size, (int64u)LastModifiedDate); Buffer->Size+=8; //Content } if (FileSize_IsValid) { Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, 0x03); //Source file size Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, 8); //Size int64u2BigEndian(Buffer->Content+Buffer->Size, (int64u)CurrentDate); Buffer->Size+=8; //Content } Buffers.push_back(Buffer); } //Writing application { string Version=Ztring(MediaInfo_Version).SubString(__T(" - v"), Ztring()).To_UTF8(); buffer* Buffer=new buffer; Buffer->Content=new int8u[1+int64u2Ebml(NULL, 1+1+9+1+int64u2Ebml(NULL, Version.size())+Version.size())+1+1+9+1+int64u2Ebml(NULL, Version.size())+Version.size()]; Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, 0x03); //Writing application Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, 1+1+9+1+1+Version.size()); //Size Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, 0x01); //Writing application name Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, 9); //Size std::memcpy(Buffer->Content+Buffer->Size, "MediaInfo", 9); Buffer->Size+=9; //Content Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, 0x02); //Writing application version Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, Version.size()); //Size std::memcpy(Buffer->Content+Buffer->Size, Version.c_str(), Version.size()); Buffer->Size+=Version.size(); //Content Buffers.push_back(Buffer); } //InformData if (!Ibi.Inform_Data.empty()) { string Content(Ibi.Inform_Data.To_UTF8()); buffer* Buffer=new buffer; Buffer->Content=new int8u[1+int64u2Ebml(NULL, Content.size())+Content.size()]; Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, 0x04); //InformData Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, Content.size()); //Size std::memcpy(Buffer->Content+Buffer->Size, Content.c_str(), Content.size()); Buffer->Size+=Content.size(); //Content Buffers.push_back(Buffer); } //Streams for (ibi::streams::const_iterator IbiStream_Temp=Ibi.Streams.begin(); IbiStream_Temp!=Ibi.Streams.end(); ++IbiStream_Temp) Add(IbiStream_Temp->first, *IbiStream_Temp->second); } //--------------------------------------------------------------------------- void File_Ibi_Creation::Add(int64u ID, const ibi::stream &Stream) { //Useful? if (Stream.Infos.empty()) return; //Header int8u* IbiHeader; size_t IbiHeader_Offset=0; if (ID!=(int64u)-1) { IbiHeader=new int8u[int64u2Ebml(NULL, ID)]; IbiHeader_Offset+=int64u2Ebml(IbiHeader, ID); } else IbiHeader=NULL; //Init - Byte Offset int8u* IbiByteOffset=new int8u[8*Stream.Infos.size()]; size_t IbiByteOffset_Offset=0; //Init - Frame Number int8u* IbiFrameNumber=new int8u[8*Stream.Infos.size()]; size_t IbiFrameNumber_Offset=0; //Init - DTS int8u* IbiDts=new int8u[8*Stream.Infos.size()]; size_t IbiDts_Offset=0; IbiDts_Offset+=int64u2Ebml(IbiDts+IbiDts_Offset, Stream.DtsFrequencyNumerator); IbiDts_Offset+=int64u2Ebml(IbiDts+IbiDts_Offset, Stream.DtsFrequencyDenominator); //Per item for (size_t Pos=0; PosContent=new int8u[1+int64u2Ebml(NULL, IbiHeader_EbmlSize+IbiByteOffset_EbmlSize+IbiFrameNumber_EbmlSize+IbiDts_EbmlSize)+IbiHeader_EbmlSize+IbiByteOffset_EbmlSize+IbiFrameNumber_EbmlSize+IbiDts_EbmlSize]; Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, 0x01); //Stream Buffer->Size+=int64u2Ebml(Buffer->Content+Buffer->Size, IbiHeader_EbmlSize+IbiByteOffset_EbmlSize+IbiFrameNumber_EbmlSize+IbiDts_EbmlSize); //Size Buffer->Size+=EbmlBlock(Buffer->Content+Buffer->Size, IbiHeader_EbmlSize, 0x01, IbiHeader, IbiHeader_Offset); //IbiHeader Buffer->Size+=EbmlBlock(Buffer->Content+Buffer->Size, IbiByteOffset_EbmlSize, 0x02, IbiByteOffset, IbiByteOffset_Offset); //ByteOffset Buffer->Size+=EbmlBlock(Buffer->Content+Buffer->Size, IbiFrameNumber_EbmlSize, 0x03, IbiFrameNumber, IbiFrameNumber_Offset); //FrameNumber Buffer->Size+=EbmlBlock(Buffer->Content+Buffer->Size, IbiDts_EbmlSize, 0x04, IbiDts, IbiDts_Offset); //Dts Buffers.push_back(Buffer); } Ztring File_Ibi_Creation::Finish() { //Test if (Buffers.empty()) return Ztring(); //Size computing size_t Size=4+1+2+1+15+2+1+1; //Header size for (size_t Pos=0; PosSize; //Buffer creation int8u* Main=new int8u[Size]; size_t Main_Offset=0; //Header size_t Header_Offset=4+1+2+1+15+2+1+1; //Size (Code + Size + Content, twice) Main_Offset+=int64u2Ebml(Main+Main_Offset, 0x0A45DFA3); //EBML Main_Offset+=int64u2Ebml(Main+Main_Offset, Header_Offset-(4+1)); //Size (Complete header size minus header header size) Main_Offset+=int64u2Ebml(Main+Main_Offset, 0x0282); //DocType Main_Offset+=int64u2Ebml(Main+Main_Offset, 15); //Size std::memcpy(Main+Main_Offset, "MediaInfo Index", 15); Main_Offset+=15; //Content Main_Offset+=int64u2Ebml(Main+Main_Offset, 0x0285); //DocTypeReadVersion Main_Offset+=int64u2Ebml(Main+Main_Offset, 1); //Size Main[Main_Offset]=0x01; Main_Offset+=1; //Content //for each stream for (size_t Pos=0; PosContent, Buffers[Pos]->Size); Main_Offset+=Buffers[Pos]->Size; } //Compressed buffer Buffer; size_t UncompressedSize=Main_Offset-Header_Offset; int8u* Compressed=new int8u[UncompressedSize]; unsigned long CompressedSize=(unsigned long)Main_Offset; if (compress2(Compressed, &CompressedSize, Main+Header_Offset, (unsigned long)UncompressedSize, Z_BEST_COMPRESSION)==Z_OK && CompressedSize #include using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Ibi structure //*************************************************************************** struct ibi { struct stream { int64u DtsFrequencyNumerator; int64u DtsFrequencyDenominator; struct info { int64u StreamOffset; int64u FrameNumber; int64u Dts; bool IsContinuous; info() { StreamOffset=(int64u)-1; FrameNumber=(int64u)-1; Dts=(int64u)-1; IsContinuous=false; } }; std::vector Infos; size_t Infos_Pos; bool IsContinuous; bool IsModified; bool IsSynchronized; stream() { DtsFrequencyNumerator=1000000000; //nanosecond DtsFrequencyDenominator=1; Infos_Pos=0; IsContinuous=false; IsModified=false; IsSynchronized=false; } void Add (const info &Info); void Unsynch(); }; typedef std::map streams; streams Streams; Ztring Inform_Data; Ztring FileName; //Constructor/Destructor ibi(); ~ibi(); }; //*************************************************************************** /* 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. */ //*************************************************************************** class File_Ibi_Creation { public : File_Ibi_Creation(); File_Ibi_Creation(const ibi &Ibi) {Set(Ibi);} ~File_Ibi_Creation(); void Set(const ibi &Ibi); void Add(int64u ID, const ibi::stream &Stream); Ztring Finish(); private : struct buffer { int8u* Content; size_t Size; buffer() { Content=NULL; Size=0; } ~buffer() { delete[] Content; //Content=NULL; } }; std::vector Buffers; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Ism.cpp100777 0 0 15712 12226004262 15562 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_ISM_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Ism.h" #include #include "MediaInfo/MediaInfo.h" #include "MediaInfo/MediaInfo_Internal.h" #include "MediaInfo/Multiple/File__ReferenceFilesHelper.h" #include "ZenLib/Dir.h" #include "ZenLib/FileName.h" #include "ZenLib/Format/Http/Http_Utils.h" #include "tinyxml2.h" using namespace tinyxml2; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Ism::File_Ism() :File__Analyze() { #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Ism; StreamIDs_Width[0]=sizeof(size_t)*2; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_EventWasSent_Accept_Specific=true; #endif //MEDIAINFO_DEMUX //Temp ReferenceFiles=NULL; } //--------------------------------------------------------------------------- File_Ism::~File_Ism() { delete ReferenceFiles; //ReferenceFiles=NULL; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Ism::Streams_Finish() { if (ReferenceFiles==NULL) return; ReferenceFiles->ParseReferences(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_Ism::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { if (ReferenceFiles==NULL) return 0; return ReferenceFiles->Read_Buffer_Seek(Method, Value, ID); } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Ism::FileHeader_Begin() { XMLDocument document; if (!FileHeader_Begin_XML(document)) return false; { XMLElement* Root=document.FirstChildElement("smil"); if (Root) { Accept("ISM"); Fill(Stream_General, 0, General_Format, "ISM"); ReferenceFiles=new File__ReferenceFilesHelper(this, Config); std::set FileNames; XMLElement* Body=Root->FirstChildElement(); while (Body) { if (string(Body->Value())=="body") { XMLElement* Switch=Body->FirstChildElement(); while (Switch) { if (string(Switch->Value())=="switch") { XMLElement* Stream=Switch->FirstChildElement(); while (Stream) { if (string(Stream->Value())=="video" || string(Stream->Value())=="audio") { File__ReferenceFilesHelper::reference ReferenceFile; if (string(Stream->Value())=="video") ReferenceFile.StreamKind=Stream_Video; if (string(Stream->Value())=="audio") ReferenceFile.StreamKind=Stream_Audio; const char* Attribute=Stream->Attribute("src"); if (Attribute) ReferenceFile.FileNames.push_back(Ztring().From_UTF8(Attribute)); XMLElement* Param=Stream->FirstChildElement(); while (Param) { if (string(Param->Value())=="param") { Attribute=Param->Attribute("name"); if (Attribute && Ztring().From_UTF8(Attribute)==__T("trackID")) { Attribute=Param->Attribute("value"); if (Attribute) ReferenceFile.StreamID=Ztring().From_UTF8(Attribute).To_int64u(); } } Param=Param->NextSiblingElement(); } if (!ReferenceFile.FileNames.empty() && !ReferenceFile.FileNames[0].empty() && FileNames.find(ReferenceFile.FileNames[0])==FileNames.end()) { ReferenceFiles->References.push_back(ReferenceFile); FileNames.insert(ReferenceFile.FileNames[0]); } } Stream=Stream->NextSiblingElement(); } } Switch=Switch->NextSiblingElement(); } } Body=Body->NextSiblingElement(); } } else { Reject("ISM"); return false; } } Element_Offset=File_Size; //All should be OK... return true; } } //NameSpace #endif //MEDIAINFO_ISM_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Ism.h100777 0 0 3042 12226004262 15200 0/* 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 DXW files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_IsmH #define MediaInfo_File_IsmH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { class File__ReferenceFilesHelper; //*************************************************************************** // Class File_Ism //*************************************************************************** class File_Ism : public File__Analyze { public : //Constructor/Destructor File_Ism(); ~File_Ism(); private : //Streams management void Streams_Finish (); //Buffer - Global #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK //Buffer - File header bool FileHeader_Begin(); //Temp File__ReferenceFilesHelper* ReferenceFiles; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Ivf.cpp100777 0 0 10423 12226004262 15550 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Contributor: Lionel Duchateau, kurtnoise@free.fr // // From : http://www.webmproject.org/ // Specs: http://wiki.multimedia.cx/index.php?title=IVF // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_IVF_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Ivf.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Ivf::FileHeader_Begin() { //Synchro if (Buffer_Offset+4>Buffer_Size) return false; if (CC4(Buffer+Buffer_Offset)!=0x444B4946) //"DKIF" return false; return true; } //--------------------------------------------------------------------------- void File_Ivf::FileHeader_Parse() { //Parsing int32u frame_rate_num, frame_rate_den, frame_count, fourcc; int16u version, header_size, width, height; Skip_C4 ( "Signature"); Get_L2 (version, "Version"); if (version==0) { Get_L2 (header_size, "Header Size"); if (header_size>=32) { Get_C4 (fourcc, "Fourcc"); Get_L2 (width, "Width"); Get_L2 (height, "Height"); Get_L4 (frame_rate_num, "FrameRate Numerator"); Get_L4 (frame_rate_den, "FrameRate Denominator"); Get_L4 (frame_count, "Frame Count"); Skip_L4( "Unused"); if (header_size-32) Skip_XX(header_size-32, "Unknown"); } else { fourcc=0x00000000; width=0; height=0; frame_rate_num=0; frame_rate_den=0; frame_count=0; } } else { header_size=0; fourcc=0x00000000; width=0; height=0; frame_rate_num=0; frame_rate_den=0; frame_count=0; } FILLING_BEGIN(); Accept("IVF"); Fill(Stream_General, 0, General_Format, "IVF"); if (version==0 && header_size>=32) { Stream_Prepare(Stream_Video); CodecID_Fill(Ztring().From_CC4(fourcc), Stream_Video, 0, InfoCodecID_Format_Riff); Fill(Stream_Video, 0, Video_FrameRate, (float)frame_rate_num / frame_rate_den); Fill(Stream_Video, 0, Video_FrameCount, frame_count); Fill(Stream_Video, 0, Video_Width, width); Fill(Stream_Video, 0, Video_Height, height); Fill(Stream_Video, 0, Video_StreamSize, File_Size-header_size-12*frame_count); //Overhead is 12 byte per frame } //No more need data Finish("IVF"); FILLING_END(); } } //NameSpace #endif //MEDIAINFO_IVF_* MediaInfoLib/Source/MediaInfo/Multiple/File_Ivf.h100777 0 0 2421 12226004262 15174 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Contributor: Lionel Duchateau, kurtnoise@free.fr // // Information about IVF files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_IvfH #define MediaInfo_IvfH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Ivf //*************************************************************************** class File_Ivf : public File__Analyze { public : //In int64u Frame_Count_Valid; private : //Buffer bool FileHeader_Begin(); void FileHeader_Parse(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Lxf.cpp100777 0 0 241557 12226004262 15613 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_LXF_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Lxf.h" #if defined(MEDIAINFO_AVC_YES) #include "MediaInfo/Video/File_Avc.h" #endif #if defined(MEDIAINFO_DVDIF_YES) #include "MediaInfo/Multiple/File_DvDif.h" #endif #if defined(MEDIAINFO_VC3_YES) #include "MediaInfo/Video/File_Vc3.h" #endif #if defined(MEDIAINFO_MPEGV_YES) #include "MediaInfo/Video/File_Mpegv.h" #endif #if defined(MEDIAINFO_AAC_YES) #include "MediaInfo/Audio/File_Aac.h" #endif #if defined(MEDIAINFO_AC3_YES) #include "MediaInfo/Audio/File_Ac3.h" #endif #if defined(MEDIAINFO_DTS_YES) #include "MediaInfo/Audio/File_Dts.h" #endif #if defined(MEDIAINFO_SMPTEST0337_YES) #include "MediaInfo/Audio/File_ChannelGrouping.h" #endif #if defined(MEDIAINFO_DOLBYE_YES) #include "MediaInfo/Audio/File_DolbyE.h" #endif #if defined(MEDIAINFO_MPEGA_YES) #include "MediaInfo/Audio/File_Mpega.h" #endif #if defined(MEDIAINFO_PCM_YES) #include "MediaInfo/Audio/File_Pcm.h" #endif #if defined(MEDIAINFO_SMPTEST0337_YES) #include "MediaInfo/Audio/File_SmpteSt0337.h" #endif #if defined(MEDIAINFO_ANCILLARY_YES) #include "MediaInfo/Multiple/File_Ancillary.h" #endif //defined(MEDIAINFO_ANCILLARY_YES) #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events.h" #endif //MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include #include using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- const char* Lxf_Format_Video[16]= { "JPEG", "MPEG Video", //Version 1 "MPEG Video", //Version 2, 4:2:0 "MPEG Video", //Version 2, 4:2:2 "DV", //25 Mbps 4:1:1 or 4:2:0 "DV", //DVCPRO "DV", //DVCPRO 50 / HD "RGB", //RGB uncompressed "Gray", //Gray uncompressed "MPEG Video", //Version 2, 4:2:2, GOP=9 "AVC", "AVC", "AVC", "AVC", "", "", }; //--------------------------------------------------------------------------- const char* Lxf_PictureType[4]= { "I", //Closed "I", //Open "P", "B", }; //--------------------------------------------------------------------------- extern const float32 Mpegv_frame_rate[]; //In Video/File_Mpegv.cpp //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Lxf::File_Lxf() :File__Analyze() { //Configuration ParserName=__T("LXF"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Lxf; StreamIDs_Width[0]=4; //2 numbers for Code, 2 numbers for subcode #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_Level=2; //Container #endif //MEDIAINFO_DEMUX MustSynchronize=true; Buffer_TotalBytes_Fill_Max=(int64u)-1; //Disabling this feature for this format, this is done in the parser #if MEDIAINFO_DEMUX Demux_EventWasSent_Accept_Specific=true; #endif //MEDIAINFO_DEMUX //Streams #if defined(MEDIAINFO_ANCILLARY_YES) Ancillary=NULL; #endif //defined(MEDIAINFO_ANCILLARY_YES) //Temp LookingForLastFrame=false; Stream_Count=0; Info_General_StreamSize=0; Video_Sizes_Pos=(size_t)-1; Audio_Sizes_Pos=(size_t)-1; //Demux #if MEDIAINFO_DEMUX DemuxParser=NULL; #endif //MEDIAINFO_DEMUX //Seek #if MEDIAINFO_SEEK SeekRequest=(int64u)-1; #endif //MEDIAINFO_SEEK FrameRate=0; TimeStamp_Rate=720000; Duration_Detected=false; LastAudio_BufferOffset=(int64u)-1; } //--------------------------------------------------------------------------- File_Lxf::~File_Lxf() { for (size_t Pos=0; PosCount_Get(Stream_Audio) && Config->File_Audio_MergeMonoStreams_Get() && Parser->Retrieve(Stream_Audio, 0, Audio_Format)==__T("PCM")) { if (Count_Get(Stream_Audio)==0) { Merge(*Parser); Fill(Stream_Audio, 0, Audio_Channel_s_, Audio_Sizes.size(), 10, true); int64u BitRate=Retrieve(Stream_Audio, 0, Audio_BitRate).To_int64u(); Fill(Stream_Audio, 0, Audio_BitRate, BitRate*Audio_Sizes.size(), 10, true); #if MEDIAINFO_DEMUX if (Config->Demux_ForceIds_Get()) { for (size_t Audio_Pos=0; Audio_PosRetrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); #if MEDIAINFO_DEMUX if (Config->Demux_ForceIds_Get()) for (size_t StreamKind=Stream_General+1; StreamKindCount_Get((stream_t)StreamKind); StreamPos++) { Ztring ID; if (Parser->Count_Get(Stream_Audio) && Parser->Retrieve(Stream_Audio, 0, Audio_MuxingMode)==__T("AES3") && Parser_Pos%2) ID+=Ztring::ToZtring(0x100*Container_StreamKind+Parser_Pos-1)+__T(" / "); ID+=Ztring::ToZtring(0x100*Container_StreamKind+Parser_Pos); if (!Parser->Retrieve((stream_t)StreamKind, StreamPos, General_ID).empty()) ID+=__T('-')+Parser->Retrieve((stream_t)StreamKind, StreamPos, General_ID); Fill((stream_t)StreamKind, Count_Get((stream_t)StreamKind)-Parser->Count_Get((stream_t)StreamKind)+StreamPos, General_ID, ID, true); } #endif //MEDIAINFO_DEMUX } if (Format!=(int8u)-1) Fill(Container_StreamKind, Container_StreamKind==Stream_Video?0:Parser_Pos, Fill_Parameter(Container_StreamKind, Generic_CodecID), Format); if (Container_StreamKind==Stream_Video) for (size_t Pos=Count_Get(Stream_Audio)-Parser->Count_Get(Stream_Audio); PosRetrieve(Stream_General, 0, General_Format)); } //--------------------------------------------------------------------------- void File_Lxf::Streams_Finish() { if (Videos.size()>1 && Videos[1].Parsers.size()==1) //TODO: better handling of fill/finish for Ancillary data { Finish(Videos[1].Parsers[0]); Streams_Fill_PerStream(Videos[1].Parsers[0], Stream_Video, 1); } if (Videos.size()>2 && Videos[2].Parsers.size()==1) { Finish(Videos[2].Parsers[0]); Merge(*Videos[2].Parsers[0], Stream_Video, 0, 0); Ztring LawRating=Videos[2].Parsers[0]->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); } if (Audios_Header.TimeStamp_End!=(int64u)-1 && Audios_Header.TimeStamp_Begin!=(int64u)-1 && Audios_Header.Duration_First!=(int64u)-1) { int64u Duration=float64_int64s(((float64)(Audios_Header.TimeStamp_End-Audios_Header.TimeStamp_Begin))/TimeStamp_Rate*1000); int64u FrameCount=float64_int64s(((float64)(Audios_Header.TimeStamp_End-Audios_Header.TimeStamp_Begin))/Audios_Header.Duration_First); for (size_t Pos=0; Pos=Buffer_Size || Buffer[Buffer_Offset-1]==0x00) Buffer_Offset--; Buffer_Offset-=6; } //Parsing last bytes if needed if (Buffer_Offset+20>Buffer_Size) { while (Buffer_Offset+8>Buffer_Size) if (Buffer_Offset+8==Buffer_Size && CC8(Buffer+Buffer_Offset)!=0x4C45495443480000LL) Buffer_Offset++; else break; if (Buffer_Offset+7==Buffer_Size && CC7(Buffer+Buffer_Offset)!=0x4C454954434800LL) Buffer_Offset++; if (Buffer_Offset+6==Buffer_Size && CC6(Buffer+Buffer_Offset)!=0x4C4549544348LL) Buffer_Offset++; if (Buffer_Offset+5==Buffer_Size && CC5(Buffer+Buffer_Offset)!=0x4C45495443LL) Buffer_Offset++; if (Buffer_Offset+4==Buffer_Size && CC4(Buffer+Buffer_Offset)!=0x4C454954) Buffer_Offset++; if (Buffer_Offset+3==Buffer_Size && CC3(Buffer+Buffer_Offset)!=0x4C4549) Buffer_Offset++; if (Buffer_Offset+2==Buffer_Size && CC2(Buffer+Buffer_Offset)!=0x4C45) Buffer_Offset++; if (Buffer_Offset+1==Buffer_Size && CC1(Buffer+Buffer_Offset)!=0x4C) Buffer_Offset++; return false; } if (!Status[IsAccepted]) { Accept(); Fill(Stream_General, 0, General_Format, "LXF"); File_Buffer_Size_Hint_Pointer=Config->File_Buffer_Size_Hint_Pointer_Get(); } #if MEDIAINFO_SEEK //TimeStamp if (SeekRequest!=(int64u)-1) { if (TimeOffsets.find(File_Offset+Buffer_Offset)==TimeOffsets.end()) //Not already saved { if (Buffer_Offset+0x48>=Buffer_Size) return false; int32u Type =LittleEndian2int32u(Buffer+Buffer_Offset+16); if (Type==0) //Video { //Filling with the new frame Version=LittleEndian2int32u(Buffer+Buffer_Offset+8); int64u TimeStamp, Duration; switch (Version) { case 0 : TimeStamp =LittleEndian2int32u(Buffer+Buffer_Offset+24); Duration =LittleEndian2int32u(Buffer+Buffer_Offset+28); break; case 1 : TimeStamp =LittleEndian2int64u(Buffer+Buffer_Offset+24); Duration =LittleEndian2int64u(Buffer+Buffer_Offset+32); break; default: TimeStamp=Duration=0; } int8u PictureType=(LittleEndian2int8u (Buffer+Buffer_Offset+42)&0xC0)>>6; TimeOffsets[File_Offset+Buffer_Offset]=stream_header(TimeStamp, TimeStamp+Duration, Duration, PictureType); SeekRequest_Divider=2; } } if (Read_Buffer_Seek(2, (int64u)-1, (int64u)-1)) return false; } #endif //MEDIAINFO_SEEK //Synched is OK return true; } //--------------------------------------------------------------------------- bool File_Lxf::Synched_Test() { if (Video_Sizes_PosBuffer_Size) return false; //Quick test of synchro if (CC8(Buffer+Buffer_Offset)!=0x4C45495443480000LL) Synched=false; //We continue return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Lxf::Read_Buffer_Unsynched() { Video_Sizes.clear(); Audio_Sizes.clear(); LastAudio_BufferOffset=(int64u)-1; LastAudio_TimeOffset=stream_header(); Video_Sizes_Pos=(size_t)-1; Audio_Sizes_Pos=(size_t)-1; Videos_Header.TimeStamp_End=(int64u)-1; Audios_Header.TimeStamp_End=(int64u)-1; for (size_t Pos=0; PosOpen_Buffer_Unsynch(); for (size_t Pos=0; PosOpen_Buffer_Unsynch(); } //--------------------------------------------------------------------------- void File_Lxf::Read_Buffer_Continue() { #if MEDIAINFO_DEMUX if (DemuxParser) { Open_Buffer_Continue(DemuxParser, Buffer+Buffer_Offset, 0, false); if (!Config->Demux_EventWasSent) DemuxParser=NULL; //No more need of it } #endif //MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_Lxf::Read_Buffer_Seek (size_t Method, int64u Value, int64u) { //Init if (!Duration_Detected) { MediaInfo_Internal MI; MI.Option(__T("File_KeepInfo"), __T("1")); Ztring ParseSpeed_Save=MI.Option(__T("ParseSpeed_Get"), __T("")); Ztring Demux_Save=MI.Option(__T("Demux_Get"), __T("")); MI.Option(__T("ParseSpeed"), __T("0")); MI.Option(__T("Demux"), Ztring()); size_t MiOpenResult=MI.Open(File_Name); MI.Option(__T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value MI.Option(__T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value if (!MiOpenResult || MI.Get(Stream_General, 0, General_Format)!=__T("LXF")) return 0; for (time_offsets::iterator TimeOffset=((File_Lxf*)MI.Info)->TimeOffsets.begin(); TimeOffset!=((File_Lxf*)MI.Info)->TimeOffsets.end(); ++TimeOffset) TimeOffsets[TimeOffset->first]=TimeOffset->second; int64u Duration=float64_int64s(Ztring(MI.Get(Stream_General, 0, __T("Duration"))).To_float64()*TimeStamp_Rate/1000); TimeOffsets[File_Size]=stream_header(Duration, Duration, 0, (int8u)-1); SeekRequest_Divider=2; Duration_Detected=true; } //Parsing switch (Method) { case 0 : Open_Buffer_Unsynch(); GoTo(Value); return 1; case 1 : Open_Buffer_Unsynch(); GoTo(File_Size*Value/10000); return 1; case 3 : //Frame { if (FrameRate==0 && Videos_Header.TimeStamp_End!=(int64u)-1 && Videos_Header.TimeStamp_End-Videos_Header.TimeStamp_Begin!=0) FrameRate=TimeStamp_Rate/(Videos_Header.TimeStamp_End-Videos_Header.TimeStamp_Begin); if (FrameRate==0) return (size_t)-1; //Not supported float64 TimeStamp=((float64)Value)/FrameRate; Value=float64_int64s(TimeStamp*1000000000); // In nanoseconds } case 2 : //Timestamp { if (Value!=(int64u)-1) { Value=float64_int64s((float64)Value*TimeStamp_Rate/1000000000); //Convert in LXF unit time_offsets::iterator End=TimeOffsets.end(); --End; if (Value>=End->second.TimeStamp_End) return 2; //Higher than total size SeekRequest=Value; } //Looking if we already have the timestamp int64u SeekRequest_Mini=SeekRequest; if (SeekRequest_Mini>1000000) SeekRequest_Mini-=float64_int64s(TimeStamp_Rate/1000); //-1ms int64u SeekRequest_Maxi=SeekRequest+float64_int64s(TimeStamp_Rate/1000); //+1ms for (time_offsets::iterator TimeOffset=TimeOffsets.begin(); TimeOffset!=TimeOffsets.end(); ++TimeOffset) { if (TimeOffset->second.TimeStamp_Begin<=SeekRequest_Maxi && TimeOffset->second.TimeStamp_End>=SeekRequest_Mini) //If it is found in a frame we know { //Looking for the corresponding I-Frame while (TimeOffset->second.PictureType&0x2 && TimeOffset!=TimeOffsets.begin()) //Not an I-Frame (and not fisrt frame) { time_offsets::iterator Previous=TimeOffset; --Previous; if (Previous->second.TimeStamp_End!=TimeOffset->second.TimeStamp_Begin) //Testing if the previous frame is not known. { SeekRequest=TimeOffset->second.TimeStamp_Begin-(float64_int64s(TimeStamp_Rate/1000)+1); //1ms+1, so we are sure to not synch on the current frame again Open_Buffer_Unsynch(); GoTo((Previous->first+TimeOffset->first)/2); return 1; //Looking for previous frame } TimeOffset=Previous; } //We got the right I-Frame if (Value==0) { for (size_t Pos=0; PosUnsynch_Frame_Count=0; } Open_Buffer_Unsynch(); GoTo(TimeOffset->first); SeekRequest=(int64u)-1; return 1; } if (TimeOffset->second.TimeStamp_Begin>SeekRequest_Maxi) //Testing if too far { time_offsets::iterator Previous=TimeOffset; --Previous; int64u ReferenceOffset; if (File_Offset+Buffer_Offset==TimeOffset->first && TimeOffset->second.TimeStamp_Begin>SeekRequest) //If current frame is already too far ReferenceOffset=File_Offset+Buffer_Offset; else ReferenceOffset=TimeOffset->first; if (SeekRequest_Divider==0) { SeekRequest=Previous->second.TimeStamp_Begin-(float64_int64s(TimeStamp_Rate/1000)+1); //1ms+1, so we are sure to not synch on the current frame again ReferenceOffset=Previous->first; --Previous; SeekRequest_Divider=2; } Open_Buffer_Unsynch(); GoTo(Previous->first+(ReferenceOffset-Previous->first)/SeekRequest_Divider); SeekRequest_Divider*=2; return 1; } } } return 0; default : return (size_t)-1; } } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- bool File_Lxf::Header_Begin() { if (Buffer_Offset+16>Buffer_Size) return false; return true; } //--------------------------------------------------------------------------- void File_Lxf::Header_Parse() { while (Video_Sizes_Pos1) { //Filling Header_Fill_Code(0, "Unknown"); Header_Fill_Size(HeaderSize); Synched=false; return; } Get_L4 (Type, "Type"); Skip_L4( "Stream ID"); switch (Version) { case 0 : { int32u TimeStamp4, Duration4; Get_L4 (TimeStamp4, "TimeStamp"); TimeStamp=TimeStamp4; Param_Info3(((float64)TimeStamp4)/TimeStamp_Rate, 3, " s"); FrameInfo.DTS=FrameInfo.PTS=float64_int64s(((float64)TimeStamp)*1000000000/TimeStamp_Rate); Get_L4 (Duration4, "Duration"); Duration=Duration4; Param_Info3(((float64)Duration)/TimeStamp_Rate, 3, " s"); FrameInfo.DUR=float64_int64s(((float64)Duration)*1000000000/TimeStamp_Rate); } break; case 1 : Get_L8 (TimeStamp, "TimeStamp"); Param_Info3(((float64)TimeStamp)/720000, 3, " s"); FrameInfo.DTS=FrameInfo.PTS=float64_int64s(((float64)TimeStamp)*1000000/720); Get_L8 (Duration, "Duration"); Param_Info3(((float64)Duration)/720000, 3, " s"); FrameInfo.DUR=float64_int64s(((float64)Duration)*1000000/720); break; default: ; } switch(Type) { case 0 : //Video { Video_Sizes.resize(3); int32u Size; int8u VideoFormat, GOP_M, PictureType; BS_Begin_LE(); Get_T1 (4, VideoFormat, "Format"); Param_Info1(Lxf_Format_Video[VideoFormat]); Skip_T1(7, "GOP (N)"); Get_T1 (3, GOP_M, "GOP (M)"); Info_T1(8, BitRate, "Bit rate"); Param_Info2((BitRate*(BitRate>60?10:(BitRate>50?5:1))-(BitRate>60?500:(BitRate>50?200:0)))*1000000, " bps"); Get_T1 (2, PictureType, "Picture type"); Param_Info1(Lxf_PictureType[PictureType]); BS_End_LE(); Skip_L1( "Reserved"); Get_L4(Size, "Video data size"); Skip_L4( "Zero"); if (!Video_Sizes.empty()) Video_Sizes[2]=Size; BlockSize+=Size; Get_L4(Size, "VBI data size"); if (!Video_Sizes.empty()) Video_Sizes[1]=Size; BlockSize+=Size; Skip_L4( "Zero"); Get_L4(Size, "Meta data size"); if (!Video_Sizes.empty()) Video_Sizes[0]=Size; BlockSize+=Size; if (Videos_Header.TimeStamp_Begin==(int64u)-1) Videos_Header.TimeStamp_Begin=TimeStamp; Videos_Header.TimeStamp_End=TimeStamp+Duration; Videos_Header.Duration=Duration; if (TimeStamp==LastAudio_TimeOffset.TimeStamp_Begin) TimeOffsets[LastAudio_BufferOffset]=stream_header(TimeStamp, TimeStamp+Duration, Duration, PictureType); else TimeOffsets[File_Offset+Buffer_Offset]=stream_header(TimeStamp, TimeStamp+Duration, Duration, PictureType); int64u PTS_Computing=TimeStamp; #if MEDIAINFO_DEMUX switch (PictureType) { case 2 : case 3 : Demux_random_access=false; break; //P-Frame, B-Frame default: Demux_random_access=true ; //I-Frame } #endif //MEDIAINFO_DEMUX if (2>Videos.size()) Videos.resize(2+1); if (!Video_Sizes.empty()) Videos[2].Format=VideoFormat; if (GOP_M>1) //With B-frames { switch (PictureType) { case 2 : PTS_Computing+=GOP_M*Duration; break; //P-Frame case 3 : break; //B-Frame default: PTS_Computing+=Duration; //I-Frame } } FrameInfo.PTS=float64_int64s(((float64)PTS_Computing)*1000000000/TimeStamp_Rate); } break; case 1 : //Audio { int32u Size; int8u Channels_Count=0; if (Version==0) { Skip_L4( "First Active Field"); Skip_L4( "Total fields in packet"); } BS_Begin_LE(); Get_T1 ( 6, SampleSize, "Sample size"); Skip_T1( 6, "Sample precision"); Skip_T1(20, "Reserved"); BS_End_LE(); Element_Begin1("Tracks mask"); BS_Begin_LE(); for (size_t Pos=0; Pos<32; Pos++) { bool Channel; Get_TB(Channel, "Channel"); if (Channel) Channels_Count++; } BS_End_LE(); Element_End0(); Get_L4(Size, "Track size"); Skip_L4( "Zero"); if (Version>=1) { Skip_L4( "Zero"); Skip_L4( "Zero"); } Audio_Sizes.resize(Channels_Count); for (size_t Pos=0; PosBuffer_Size) { //Hints if (File_Buffer_Size_Hint_Pointer) { size_t Buffer_Size_Target=(size_t)(Buffer_Offset+0x48+BlockSize+0x48); //+0x48 for next packet header if ((*File_Buffer_Size_Hint_Pointer)6 && (Stream_Count==0 ||Config->ParseSpeed==0.0)) || Frame_Count>512)) //5 video frames for 1 Audio frame { Fill("LXF"); if (MediaInfoLib::Config.ParseSpeed_Get()<1) { LookingForLastFrame=true; if (3*(File_Offset+Buffer_Offset)<=File_Size) { GoToFromEnd((File_Offset+Buffer_Offset)*2*6/Frame_Count); Open_Buffer_Unsynch(); } } } } FILLING_END(); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Lxf::Header() { Element_Name("Header"); for (size_t Pos=0; PosNextPacket_Get() && Config->Event_CallBackFunction_IsSet()) Config->Demux_EventWasSent=true; //First set is to indicate the user that header is parsed #endif //MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- void File_Lxf::Header_Info() { Element_Begin1("Disk segment"); //Parsing int64u End=Element_Offset+Header_Sizes[0]; if (Header_Sizes[0]>=120) { Skip_L4( "prev"); Skip_L4( "next"); Skip_L4( "videoClusters"); Skip_L4( "audioClusters"); Skip_C8( "ID"); Skip_L4( "minFrame"); Skip_L4( "start"); Skip_L4( "duration"); Skip_L4( "tcOffset"); BS_Begin_LE(); Skip_T1(4, "Format"); Skip_T1(7, "GOP (N)"); Skip_T1(3, "GOP (M)"); Skip_T1(8, "Bit rate"); Skip_TB( "VBI present"); Skip_TB( "Aspect Ratio"); BS_End_LE(); Skip_L1( "reserved"); Skip_L4( "base"); Skip_L4( "prev"); Skip_L4( "next"); BS_Begin_LE(); Skip_T1(7, "recordDate - Year"); Skip_T1(4, "recordDate - Month"); Skip_T1(5, "recordDate - Day"); Skip_T1(7, "killDate - Year"); Skip_T1(4, "killDate - Month"); Skip_T1(5, "killDate - Day"); BS_End_LE(); Skip_L1( "tc_type"); Skip_L1( "status"); Skip_L1( "disk"); Skip_String(26, "description"); Skip_String(16, "agency"); Skip_String( 6, "description"); Skip_L1( "videoGain"); Skip_L1( "videoSetup"); Skip_L1( "chromaGain"); Skip_L1( "hueLSB"); Skip_L1( "reserved"); BS_Begin_LE(); Skip_T1(2, "hueMSB"); Skip_T1(4, "audioTracks"); Skip_TB( "writeProtected"); Skip_TB( "allocated"); Skip_TB( "sliding"); Skip_TB( "tcTranslate"); Skip_TB( "invisible"); Skip_TB( "macro"); Skip_TB( "alpha"); Skip_TB( "project"); Skip_TB( "purged"); Skip_TB( "reference"); Skip_TB( "looping"); Skip_TB( "notReadyToPlay"); Skip_TB( "notReadyToTransfer"); Skip_TB( "notReadyToArchive"); Skip_TB( "transferInProgress"); Skip_T2(11, "reserved"); BS_End_LE(); } if (Element_Offset=Audios.size()) Audios.resize(Pos+1); Audios[Pos].Format=Format; } BS_End_LE(); } break; case 24 : //Audio Tag Info { for (int8u Pos=0; PosParseSpeed<1 && Pos=Audios.size()) Audios.resize(Pos+1); if (Audios[Pos].Parsers.empty()) { //Trying to detect if this is PCM /* switch (Audios[Pos].Format) { case (int8u)-1 : //PCM without codec identifier (default) case 0 : //PCM { #ifdef MEDIAINFO_SMPTEST0337_YES { File_ChannelGrouping* Parser=new File_ChannelGrouping; if (Pos%2 && !Audios[Pos-1].Parsers.empty()) { Parser->Channel_Pos=1; Parser->Common=((File_ChannelGrouping*)Audios[Pos-1].Parsers[0])->Common; Parser->StreamID=Pos-1; Element_Code--; } else { Parser->Channel_Pos=0; Parser->SampleRate=48000; } Parser->Channel_Total=2; Parser->ByteDepth=SampleSize/8; Open_Buffer_Init(Parser); Audios[Pos].Parsers.push_back(Parser); } #endif //MEDIAINFO_SMPTEST0337_YES Audios[Pos].BytesPerFrame=Audio_Sizes[Pos]; #ifdef MEDIAINFO_PCM_YES File_Pcm* Parser=new File_Pcm; Parser->SamplingRate=48000; Parser->Channels=1; Parser->BitDepth=SampleSize; Parser->Endianness='L'; #if !defined(MEDIAINFO_MPEGA_YES) && !defined(MEDIAINFO_SMPTEST0337_YES) Parser->Frame_Count_Valid=1; #else Parser->Frame_Count_Valid=2; #endif #else //MEDIAINFO_PCM_YES File__Analyze* Parser=new File__Analyze; #endif //MEDIAINFO_PCM_YES Open_Buffer_Init(Parser); #ifndef MEDIAINFO_PCM_YES Parser->Accept(); Parser->Stream_Prepare(Stream_Audio); int64u BitRate=float64_int64s(Audio_Sizes[Pos]*TimeStamp_Rate*8/(Audios_Header.TimeStamp_End-Audios_Header.TimeStamp_Begin)); Parser->Fill(Stream_Audio, StreamPos_Last, Audio_BitRate, BitRate); Parser->Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR"); Parser->Fill(Stream_Audio, StreamPos_Last, Audio_Format, "PCM"); Parser->Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, 48000); Parser->Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, 1); Parser->Fill(Stream_Audio, StreamPos_Last, Audio_BitDepth, SampleSize); Parser->Fill(); #endif //MEDIAINFO_PCM_YES Audios[Pos].Parsers.push_back(Parser); #ifdef MEDIAINFO_MPEGA_YES { File_Mpega* Parser=new File_Mpega(); Open_Buffer_Init(Parser); Audios[Pos].Parsers.push_back(Parser); } #endif //MEDIAINFO_MPEGA_YES } break; case 1 : //DTS { #ifdef MEDIAINFO_DTS_YES File_Dts* Parser=new File_Dts(); #else //MEDIAINFO_DTS_YES File__Analyze* Parser=new File__Analyze; #endif //MEDIAINFO_DTS_YES Open_Buffer_Init(Parser); Audios[Pos].Parsers.push_back(Parser); } break; case 2 : //AC-3 case 5 : //E-AC-3 { #ifdef MEDIAINFO_AC3_YES File_Ac3* Parser=new File_Ac3; #else //MEDIAINFO_AAC_YES File__Analyze* Parser=new File__Analyze; #endif //MEDIAINFO_AAC_YES Open_Buffer_Init(Parser); Audios[Pos].Parsers.push_back(Parser); } break; case 3 : //Dolby E { #ifdef MEDIAINFO_SMPTEST0337_YES { File_ChannelGrouping* Parser=new File_ChannelGrouping; if (Pos%2 && !Audios[Pos-1].Parsers.empty()) { Parser->Channel_Pos=1; Parser->Common=((File_ChannelGrouping*)Audios[Pos-1].Parsers[0])->Common; Parser->StreamID=Pos-1; Element_Code--; } else { Parser->Channel_Pos=0; Parser->SampleRate=48000; } Parser->Channel_Total=2; Parser->ByteDepth=SampleSize/8; Open_Buffer_Init(Parser); Audios[Pos].Parsers.push_back(Parser); } #endif //MEDIAINFO_SMPTEST0337_YES #ifdef MEDIAINFO_DOLBYE_YES File_DolbyE* Parser=new File_DolbyE(); #else //MEDIAINFO_DOLBYE_YES File__Analyze* Parser=new File__Analyze; #endif //MEDIAINFO_DOLBYE_YES Open_Buffer_Init(Parser); Audios[Pos].Parsers.push_back(Parser); } case 4 : { #ifdef MEDIAINFO_MPEGA_YES File_Mpega* Parser=new File_Mpega(); #else //MEDIAINFO_MPEGA_YES File__Analyze* Parser=new File__Analyze; #endif //MEDIAINFO_MPEGA_YES Open_Buffer_Init(Parser); Audios[Pos].Parsers.push_back(Parser); } break; case 6 : { #ifdef MEDIAINFO_AAC_YES File_Aac* Parser=new File_Aac(); Parser->Mode=File_Aac::Mode_ADTS; #else //MEDIAINFO_AAC_YES File__Analyze* Parser=new File__Analyze; #endif //MEDIAINFO_AAC_YES Open_Buffer_Init(Parser); Audios[Pos].Parsers.push_back(Parser); } break; default : { File__Analyze* Parser=new File__Analyze; Open_Buffer_Init(Parser); Audios[Pos].Parsers.push_back(Parser); } } */ #ifdef MEDIAINFO_SMPTEST0337_YES if (!(Pos%2 && Audios[Pos-1].Parsers.size()<=1)) //If the first half-stream was already rejected, don't try this one { File_ChannelGrouping* Parser=new File_ChannelGrouping; if (Pos%2 && !Audios[Pos-1].Parsers.empty()) { Parser->Channel_Pos=1; Parser->Common=((File_ChannelGrouping*)Audios[Pos-1].Parsers[0])->Common; Parser->StreamID=Pos-1; } else Parser->Channel_Pos=0; Parser->BitDepth=SampleSize; Parser->Channel_Total=2; Parser->SamplingRate=48000; Parser->Endianness='L'; Audios[Pos].Parsers.push_back(Parser); } #endif //MEDIAINFO_SMPTEST0337_YES #ifdef MEDIAINFO_SMPTEST0337_YES { File_SmpteSt0337* Parser=new File_SmpteSt0337; Parser->Container_Bits=SampleSize; Parser->Endianness='L'; Parser->Aligned=true; Audios[Pos].Parsers.push_back(Parser); } #endif //MEDIAINFO_SMPTEST0337_YES #ifdef MEDIAINFO_AC3_YES Audios[Pos].Parsers.push_back(new File_Ac3()); #endif //MEDIAINFO_AC3_YES #ifdef MEDIAINFO_DTS_YES Audios[Pos].Parsers.push_back(new File_Dts()); #endif //MEDIAINFO_DTS_YES #ifdef MEDIAINFO_MPEGA_YES Audios[Pos].Parsers.push_back(new File_Mpega()); #endif //MEDIAINFO_MPEGA_YES #ifdef MEDIAINFO_AAC_YES { File_Aac* Parser=new File_Aac; Parser->Mode=File_Aac::Mode_ADTS; Audios[Pos].Parsers.push_back(Parser); } #endif //MEDIAINFO_AAC_YES #ifdef MEDIAINFO_PCM_YES { File_Pcm* Parser=new File_Pcm; Parser->SamplingRate=48000; Parser->Channels=1; Parser->BitDepth=SampleSize; Parser->Endianness='L'; #if !defined(MEDIAINFO_SMPTEST0337_YES) && !defined(MEDIAINFO_MPEGA_YES) Parser->Frame_Count_Valid=1; #else Parser->Frame_Count_Valid=2; #endif Audios[Pos].Parsers.push_back(Parser); } #endif //MEDIAINFO_PCM_YES for (size_t Pos2=0; Pos2Demux_Unpacketize_Get()) { Audios[Pos].Parsers[Pos2]->Demux_Level=2; //Container Audios[Pos].Parsers[Pos2]->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX } Stream_Count++; } /* #if MEDIAINFO_DEMUX #if MEDIAINFO_SEEK if (SeekRequest==(int64u)-1) #endif //MEDIAINFO_SEEK { Element_Code=0x200+Pos; Frame_Count_NotParsedIncluded=float64_int64s(((float64)(Audios_Header.TimeStamp_End-Audios_Header.Duration))/TimeStamp_Rate*FrameRate); if (SampleSize==20 && Config->Demux_PCM_20bitTo16bit_Get()) { //Removing bits 3-0 (Little endian) int8u* SixteenBit=new int8u[(size_t)Audio_Sizes[Pos]]; size_t SixteenBit_Pos=0; size_t Buffer_Pos=Buffer_Offset+(size_t)Element_Offset; size_t Buffer_Max=Buffer_Offset+(size_t)(Element_Offset+Audio_Sizes[Pos]); while (Buffer_Pos+5<=Buffer_Max) { int64u Temp=LittleEndian2int40u(Buffer+Buffer_Pos); Temp=((Temp&0xFFFF000000LL)>>8)|((Temp&0xFFFF0LL)>>4); int32s2LittleEndian(SixteenBit+SixteenBit_Pos, (int32s)Temp); SixteenBit_Pos+=4; Buffer_Pos+=5; } Demux(SixteenBit, SixteenBit_Pos, ContentType_MainStream); delete[] SixteenBit; } else if (SampleSize==20 && Config->Demux_PCM_20bitTo24bit_Get()) { //Padding bits 3-0 (Little endian) int8u* Output=new int8u[(size_t)Audio_Sizes[Pos]*24/20]; size_t Output_Pos=0; size_t Buffer_Pos=Buffer_Offset+(size_t)Element_Offset; size_t Buffer_Max=Buffer_Offset+(size_t)(Element_Offset+Audio_Sizes[Pos]); while (Buffer_Pos+5<=Buffer_Max) { Output[Output_Pos ] = Buffer[Buffer_Pos+0]<<4 ; Output[Output_Pos+1] = (Buffer[Buffer_Pos+1]<<4 ) | (Buffer[Buffer_Pos+0]>>4 ); Output[Output_Pos+2] = (Buffer[Buffer_Pos+2]<<4 ) | (Buffer[Buffer_Pos+1]>>4 ); Output[Output_Pos+3] = Buffer[Buffer_Pos+2]&0xF0 ; Output[Output_Pos+4] = Buffer[Buffer_Pos+3] ; Output[Output_Pos+5] = Buffer[Buffer_Pos+4] ; Buffer_Pos+=5; Output_Pos+=6; } Demux(Output, Output_Pos, ContentType_MainStream); delete[] Output; } else Demux(Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)Audio_Sizes[Pos], ContentType_MainStream); } #endif //MEDIAINFO_DEMUX */ #if MEDIAINFO_DEMUX #if MEDIAINFO_SEEK if (SeekRequest==(int64u)-1) #endif //MEDIAINFO_SEEK { Element_Code=0x200+Pos; Frame_Count_NotParsedIncluded=float64_int64s(((float64)(Audios_Header.TimeStamp_End-Audios_Header.Duration))/TimeStamp_Rate*FrameRate); Demux_Level=4; //Intermediate Demux(Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)Audio_Sizes[Pos], ContentType_MainStream); } #endif //MEDIAINFO_DEMUX //Parsing Frame_Count_NotParsedIncluded=float64_int64s(((float64)(Audios_Header.TimeStamp_End-Audios_Header.Duration))/TimeStamp_Rate*FrameRate); for (size_t Pos2=0; Pos2FrameInfo.DTS==(int64u)-1 || !((FrameInfo.DUR/2>FrameInfo.DTS || Audios[Pos].Parsers[Pos2]->FrameInfo.DTS>=FrameInfo.DTS-FrameInfo.DUR/2) && Audios[Pos].Parsers[Pos2]->FrameInfo.DTSFrameInfo=FrameInfo; Open_Buffer_Continue(Audios[Pos].Parsers[Pos2], Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)Audio_Sizes[Pos]); if (Audios[Pos].Parsers.size()>1) { if (!Audios[Pos].Parsers[Pos2]->Status[IsAccepted] && Audios[Pos].Parsers[Pos2]->Status[IsFinished]) { delete *(Audios[Pos].Parsers.begin()+Pos2); Audios[Pos].Parsers.erase(Audios[Pos].Parsers.begin()+Pos2); Pos2--; } else if (Audios[Pos].Parsers.size()>1 && Audios[Pos].Parsers[Pos2]->Status[IsAccepted]) { File__Analyze* Parser=Audios[Pos].Parsers[Pos2]; for (size_t Pos3=0; Pos3Status[IsFilled]) { if (Stream_Count>0) Stream_Count--; Audios[Pos].IsFilled=true; } #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) DemuxParser=Audios[Pos].Parsers[0]; #endif //MEDIAINFO_DEMUX } Element_Offset+=Audio_Sizes[Pos]; } //--------------------------------------------------------------------------- void File_Lxf::Video() { Element_Name("Video"); #if MEDIAINFO_SEEK if (FrameRate==0 && Videos_Header.TimeStamp_End-Videos_Header.TimeStamp_Begin!=0) FrameRate=TimeStamp_Rate/(Videos_Header.TimeStamp_End-Videos_Header.TimeStamp_Begin); #endif //MEDIAINFO_SEEK Video_Sizes_Pos=0; Element_ThisIsAList(); } //--------------------------------------------------------------------------- void File_Lxf::Video_Stream(size_t Pos) { if (LookingForLastFrame || (Config->ParseSpeed<1 && Pos=Videos.size()) Videos.resize(Pos+1); switch (Pos) { case 1 : Video_Stream_1(); break; case 2 : Video_Stream_2(); break; default: ; } } //--------------------------------------------------------------------------- void File_Lxf::Video_Stream_1() { if (Video_Sizes[1]<2) { Skip_XX(Video_Sizes[1], "Unknown"); return; } int8u Lines_Allocated, Lines_Used; Get_L1 (Lines_Allocated, "Lines allocated"); Get_L1 (Lines_Used, "Lines used"); if (Lines_Allocated==0 || Lines_Used>Lines_Allocated || Video_Sizes[1]<2+Lines_Used) { Skip_XX(Video_Sizes[1]-2, "Unknown"); return; } Videos[1].BytesPerFrame=Video_Sizes[1]-(2+Lines_Allocated); int64u BytesPerLine=Videos[1].BytesPerFrame/Lines_Allocated; std::vector FieldNumbers; std::vector FieldNumbers_IsSecondField; BS_Begin_LE(); for (int8u Pos=0; PosInDecodingOrder=true; Ancillary->WithChecksum=true; Ancillary->MustSynchronize=true; Open_Buffer_Init(Ancillary); Videos[1].Parsers.push_back(Ancillary); Stream_Count++; } Videos[1].Parsers[0]->FrameInfo=FrameInfo; ((File_Ancillary*)Videos[1].Parsers[0])->LineNumber=FieldNumbers[Pos]; ((File_Ancillary*)Videos[1].Parsers[0])->LineNumber_IsSecondField=FieldNumbers_IsSecondField[Pos]; Open_Buffer_Continue(Videos[1].Parsers[0], Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)BytesPerLine); if (Videos[1].Parsers[0]->Status[IsFilled]) { if (Stream_Count>0) Stream_Count--; Videos[1].IsFilled=true; } Element_Offset+=BytesPerLine; Element_End0(); #else Skip_XX(BytesPerLine, "VBI/VANC data"); #endif } Skip_XX((Lines_Allocated-Lines_Used)*BytesPerLine, "Unused lines"); if (Element_OffsetStream_Prepare(Stream_Video); Parser->Fill(Stream_Video, 0, Video_Format, "MPEG Video"); if (Videos_Header.TimeStamp_End-Videos_Header.TimeStamp_Begin) { FrameRate=((float64)1)*TimeStamp_Rate/(Videos_Header.TimeStamp_End-Videos_Header.TimeStamp_Begin); if (FrameRate) Parser->Fill(Stream_Video, 0, Video_FrameRate, FrameRate); } #endif //MEDIAINFO_MPEGV_YES Videos[2].Parsers.push_back(Parser); } break; case 0x04 : case 0x05 : case 0x06 : { #ifdef MEDIAINFO_DVDIF_YES File_DvDif* Parser=new File_DvDif(); #else //MEDIAINFO_DVDIF_YES File__Analyze* Parser=new File__Analyze; #endif //MEDIAINFO_DVDIF_YES Open_Buffer_Init(Parser); #ifndef MEDIAINFO_DVDIF_YES Parser->Stream_Prepare(Stream_Video); Parser->Fill(Stream_Video, 0, Video_Format, "DV"); if (Videos_Header.TimeStamp_End-Videos_Header.TimeStamp_Begin) { FrameRate=((float64)1)*TimeStamp_Rate/(Videos_Header.TimeStamp_End-Videos_Header.TimeStamp_Begin); if (FrameRate) Parser->Fill(Stream_Video, 0, Video_FrameRate, FrameRate); int64u BitRate=float64_int64s(((float64)Video_Sizes[1])*TimeStamp_Rate*8/(Videos_Header.TimeStamp_End-Videos_Header.TimeStamp_Begin)); if (BitRate) Parser->Fill(Stream_Video, 0, Video_BitRate, BitRate); Parser->Fill(Stream_Video, 0, Video_BitRate_Mode, "CBR"); } #endif //MEDIAINFO_DVDIF_YES Videos[2].Parsers.push_back(Parser); } #ifdef MEDIAINFO_VC3_YES if (Videos[2].Format==0x06) // One file with VideoFormat = 6 has VC-3 { File_Vc3* Parser=new File_Vc3(); Open_Buffer_Init(Parser); Videos[2].Parsers.push_back(Parser); } #endif //MEDIAINFO_VC3_YES break; case 0x0A : case 0x0B : case 0x0C : case 0x0D : { #ifdef MEDIAINFO_AVC_YES File_Avc* Parser=new File_Avc(); #else //MEDIAINFO_AVC_YES File__Analyze* Parser=new File__Analyze; #endif //MEDIAINFO_AVC_YES Open_Buffer_Init(Parser); #ifndef MEDIAINFO_AVC_YES Parser->Accept(); Parser->Stream_Prepare(Stream_Video); Parser->Fill(Stream_Video, 0, Video_Format, "AVC"); if (Videos_Header.TimeStamp_End-Videos_Header.TimeStamp_Begin) { FrameRate=((float64)1)*TimeStamp_Rate/(Videos_Header.TimeStamp_End-Videos_Header.TimeStamp_Begin); if (FrameRate) Parser->Fill(Stream_Video, 0, Video_FrameRate, FrameRate); } #endif //MEDIAINFO_AVC_YES Videos[2].Parsers.push_back(Parser); } break; default : { File__Analyze* Parser=new File__Analyze; Open_Buffer_Init(Parser); Videos[2].Parsers.push_back(Parser); } } */ #ifdef MEDIAINFO_DVDIF_YES Videos[2].Parsers.push_back(new File_DvDif()); #endif //MEDIAINFO_DVDIF_YES #ifdef MEDIAINFO_MPEGV_YES { File_Mpegv* Parser=new File_Mpegv(); #if defined(MEDIAINFO_ANCILLARY_YES) Parser->Ancillary=&Ancillary; #endif //defined(MEDIAINFO_ANCILLARY_YES) Videos[2].Parsers.push_back(Parser); } #endif //MEDIAINFO_MPEGV_YES #ifdef MEDIAINFO_AVC_YES Videos[2].Parsers.push_back(new File_Avc()); #endif //MEDIAINFO_AVC_YES #ifdef MEDIAINFO_VC3_YES Videos[2].Parsers.push_back(new File_Vc3()); #endif //MEDIAINFO_VC3_YES for (size_t Pos2=0; Pos2FrameInfo=FrameInfo; Open_Buffer_Continue(Videos[2].Parsers[Pos2], Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)Video_Sizes[2]); Element_Show(); if (Videos[2].Parsers.size()>1) { if (!Videos[2].Parsers[Pos2]->Status[IsAccepted] && Videos[2].Parsers[Pos2]->Status[IsFinished]) { delete *(Videos[2].Parsers.begin()+Pos2); Videos[2].Parsers.erase(Videos[2].Parsers.begin()+Pos2); Pos2--; } else if (Videos[2].Parsers.size()>1 && Videos[2].Parsers[Pos2]->Status[IsAccepted]) { File__Analyze* Parser=Videos[2].Parsers[Pos2]; for (size_t Pos3=0; Pos3Status[IsFilled]) { if (Stream_Count>0) Stream_Count--; Videos[2].IsFilled=true; } } Element_Offset+=Video_Sizes[2]; } } //NameSpace #endif //MEDIAINFO_LXF_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Lxf.h100777 0 0 11272 12226004262 15225 0/* 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 Lxf files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_LxfH #define MediaInfo_File_LxfH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #if defined(MEDIAINFO_ANCILLARY_YES) #include #endif //defined(MEDIAINFO_ANCILLARY_YES) #include //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Lxf //*************************************************************************** class File_Lxf : public File__Analyze { public : //Constructor/Destructor File_Lxf(); ~File_Lxf(); protected : //Streams management void Streams_Fill (); void Streams_Fill_PerStream (File__Analyze* Parser, stream_t Container_StreamKind, size_t Parser_Pos, int8u Format=(int8u)-1); void Streams_Finish (); //Buffer - Synchro bool Synchronize(); bool Synched_Test(); //Buffer - Global void Read_Buffer_Continue(); #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK void Read_Buffer_Unsynched(); //Buffer - Per element bool Header_Begin (); void Header_Parse(); void Data_Parse(); //Elements void Header(); void Header_Info(); void Header_Meta(); void Audio(); void Audio_Stream(size_t Pos); void Video(); void Video_Stream(size_t Pos); void Video_Stream_1(); void Video_Stream_2(); //Streams struct stream { std::vector Parsers; int64u BytesPerFrame; int8u Format; bool IsFilled; stream() { BytesPerFrame=(int64u)-1; Format=(int8u)-1; IsFilled=false; } }; typedef std::vector streams; streams Videos; streams Audios; struct stream_header { int64u TimeStamp_Begin; int64u TimeStamp_End; int64u Duration; int64u Duration_First; int8u PictureType; stream_header() { TimeStamp_Begin=(int64u)-1; TimeStamp_End=(int64u)-1; Duration=(int64u)-1; Duration_First=(int64u)-1; PictureType=(int8u)-1; } stream_header(int64u TimeStamp_Begin_, int64u TimeStamp_End_, int64u Duration_, int8u PictureType_) { TimeStamp_Begin=TimeStamp_Begin_; TimeStamp_End=TimeStamp_End_; Duration=Duration_; PictureType=PictureType_; } }; stream_header Videos_Header; stream_header Audios_Header; #if defined(MEDIAINFO_ANCILLARY_YES) File_Ancillary* Ancillary; #endif //defined(MEDIAINFO_ANCILLARY_YES) //Temp bool LookingForLastFrame; int64u Stream_Count; int64u Info_General_StreamSize; std::vector Header_Sizes; std::vector Audio_Sizes; size_t Audio_Sizes_Pos; std::vector Video_Sizes; size_t Video_Sizes_Pos; int8u SampleSize; int32u Version; //Hints size_t* File_Buffer_Size_Hint_Pointer; //Demux #if MEDIAINFO_DEMUX File__Analyze* DemuxParser; #endif //MEDIAINFO_DEMUX //Seek typedef std::map time_offsets; time_offsets TimeOffsets; #if MEDIAINFO_SEEK int64u SeekRequest_Divider; int64u SeekRequest; #endif //MEDIAINFO_SEEK float64 FrameRate; float64 TimeStamp_Rate; bool Duration_Detected; int64u LastAudio_BufferOffset; stream_header LastAudio_TimeOffset; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Mk.cpp100777 0 0 414432 12226004262 15423 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MK_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Mk.h" #if defined(MEDIAINFO_OGG_YES) #include "MediaInfo/Multiple/File_Ogg.h" #endif #if defined(MEDIAINFO_RM_YES) #include "MediaInfo/Multiple/File_Rm.h" #endif #if defined(MEDIAINFO_MPEG4V_YES) #include "MediaInfo/Video/File_Mpeg4v.h" #endif #if defined(MEDIAINFO_AVC_YES) #include "MediaInfo/Video/File_Avc.h" #endif #if defined(MEDIAINFO_HEVC_YES) #include "MediaInfo/Video/File_Hevc.h" #endif #if defined(MEDIAINFO_VC1_YES) #include "MediaInfo/Video/File_Vc1.h" #endif #if defined(MEDIAINFO_DIRAC_YES) #include "MediaInfo/Video/File_Dirac.h" #endif #if defined(MEDIAINFO_MPEGV_YES) #include "MediaInfo/Video/File_Mpegv.h" #endif #if defined(MEDIAINFO_VP8_YES) #include "MediaInfo/Video/File_Vp8.h" #endif #if defined(MEDIAINFO_AAC_YES) #include "MediaInfo/Audio/File_Aac.h" #endif #if defined(MEDIAINFO_AC3_YES) #include "MediaInfo/Audio/File_Ac3.h" #endif #if defined(MEDIAINFO_DTS_YES) #include "MediaInfo/Audio/File_Dts.h" #endif #if defined(MEDIAINFO_MPEGA_YES) #include "MediaInfo/Audio/File_Mpega.h" #endif #if defined(MEDIAINFO_FLAC_YES) #include "MediaInfo/Audio/File_Flac.h" #endif #if defined(MEDIAINFO_OPUS_YES) #include "MediaInfo/Audio/File_Opus.h" #endif #if defined(MEDIAINFO_WVPK_YES) #include "MediaInfo/Audio/File_Wvpk.h" #endif #if defined(MEDIAINFO_TTA_YES) #include "MediaInfo/Audio/File_Tta.h" #endif #if defined(MEDIAINFO_PCM_YES) #include "MediaInfo/Audio/File_Pcm.h" #endif #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events.h" #endif //MEDIAINFO_EVENTS #include #include //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constants //*************************************************************************** //--------------------------------------------------------------------------- const char* Mk_ContentCompAlgo(int64u Algo) { switch (Algo) { case 0x00 : return "zlib"; case 0x01 : return "bzlib"; case 0x02 : return "lzo1x"; case 0x03 : return "Header stripping"; default : return ""; } } //--------------------------------------------------------------------------- const char* Mk_StereoMode(int64u StereoMode) { switch (StereoMode) { case 0x00 : return ""; //Mono (default) case 0x01 : return "Side by Side (left eye first)"; case 0x02 : return "Top-Bottom (right eye first)"; case 0x03 : return "Top-Bottom (left eye first)"; case 0x04 : return "Checkboard (right eye first)"; case 0x05 : return "Checkboard (left eye first)"; case 0x06 : return "Row Interleaved (right eye first)"; case 0x07 : return "Row Interleaved (left eye first)"; case 0x08 : return "Column Interleaved (right eye first)"; case 0x09 : return "Column Interleaved (left eye first)"; case 0x0A : return "Anaglyph (cyan/red)"; case 0x0B : return "Side by Side (right eye first)"; case 0x0C : return "Anaglyph (green/magenta)"; case 0x0D : return "Both Eyes laced in one block (left eye first)"; case 0x0E : return "Both Eyes laced in one block (right eye first)"; default : return "Unknown"; } } //--------------------------------------------------------------------------- const char* Mk_StereoMode_v2(int64u StereoMode) { switch (StereoMode) { case 0x00 : return ""; //Mono (default) case 0x01 : return "Right Eye"; case 0x02 : return "Left Eye"; case 0x03 : return "Both Eye"; default : return "Unknown"; } } //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- extern std::string ExtensibleWave_ChannelMask (int32u ChannelMask); //--------------------------------------------------------------------------- extern std::string ExtensibleWave_ChannelMask2 (int32u ChannelMask); //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Mk::File_Mk() :File__Analyze() { //Configuration #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Matroska; StreamIDs_Width[0]=16; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_Level=2; //Container #endif //MEDIAINFO_DEMUX DataMustAlwaysBeComplete=false; //Temp Format_Version=0; TimecodeScale=1000000; //Default value Duration=0; Cluster_AlreadyParsed=false; //Helpers CodecPrivate=NULL; } //--------------------------------------------------------------------------- File_Mk::~File_Mk() { delete[] CodecPrivate; //CodecPrivate=NULL; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Mk::Streams_Finish() { if (Duration!=0 && TimecodeScale!=0) Fill(Stream_General, 0, General_Duration, Duration*int64u_float64(TimecodeScale)/1000000.0, 0); for (std::map::iterator Temp=Stream.begin(); Temp!=Stream.end(); ++Temp) { StreamKind_Last=Temp->second.StreamKind; StreamPos_Last=Temp->second.StreamPos; if (Temp->second.DisplayAspectRatio!=0) { //Corrections if (Temp->second.DisplayAspectRatio>=1.777 && Temp->second.DisplayAspectRatio<=1.778) Temp->second.DisplayAspectRatio=((float32)16)/9; if (Temp->second.DisplayAspectRatio>=1.333 && Temp->second.DisplayAspectRatio<=1.334) Temp->second.DisplayAspectRatio=((float32)4)/3; Fill(Stream_Video, Temp->second.StreamPos, Video_DisplayAspectRatio, Temp->second.DisplayAspectRatio, 3, true); int64u Width=Retrieve(Stream_Video, Temp->second.StreamPos, Video_Width).To_int64u(); int64u Height=Retrieve(Stream_Video, Temp->second.StreamPos, Video_Height).To_int64u(); if (Width) Fill(Stream_Video, Temp->second.StreamPos, Video_PixelAspectRatio, Temp->second.DisplayAspectRatio*Height/Width, 3, true); } if (Temp->second.Parser) { Fill(Temp->second.Parser); if (Config->ParseSpeed<=1.0) Temp->second.Parser->Open_Buffer_Unsynch(); } //Video specific if (StreamKind_Last==Stream_Video) { //FrameRate bool IsVfr=false; if (Temp->second.Segment_Cluster_BlockGroup_BlockDuration_Counts.size()>2) IsVfr=true; else if (Temp->second.TimeCodes.size()>1) { //Trying to detect VFR std::vector FrameRate_Between; std::sort(Temp->second.TimeCodes.begin(), Temp->second.TimeCodes.end()); //This is PTS, no DTS --> Some frames are out of order size_t FramesToAdd=0; for (size_t Pos=1; Possecond.TimeCodes.size(); Pos++) { int64u Duration=Temp->second.TimeCodes[Pos]-Temp->second.TimeCodes[Pos-1]; if (Duration) FrameRate_Between.push_back(Duration); else FramesToAdd++; } if (FrameRate_Between.size()>1) { int64s FrameRate_Between_Last=FrameRate_Between[FrameRate_Between.size()-1]; size_t Pos=FrameRate_Between.size()-2; while (Pos) { if (!(FrameRate_Between[Pos]*0.9FrameRate_Between_Last)) break; Pos--; } if (Pos) FrameRate_Between.resize(Pos+1); //We peek 40 frames, and remove the last ones, because this is PTS, no DTS --> Some frames are out of order } if (FrameRate_Between.size()>=30+1+FramesToAdd) FrameRate_Between.resize((FrameRate_Between.size()-4>30+1+FramesToAdd)?(FrameRate_Between.size()-4):(30+1+FramesToAdd)); //We peek 40 frames, and remove the last ones, because this is PTS, no DTS --> Some frames are out of order std::sort(FrameRate_Between.begin(), FrameRate_Between.end()); if (!FrameRate_Between.empty() && FrameRate_Between[0]*0.9FrameRate_Between[FrameRate_Between.size()-1]) { float Time=0; if (Temp->second.TimeCodes.size()>30+FramesToAdd) Time=(float)(Temp->second.TimeCodes[30+FramesToAdd]-Temp->second.TimeCodes[0])/30; //30 frames for handling 30 fps rounding problems else if (Temp->second.TrackDefaultDuration) Time=(float)Temp->second.TrackDefaultDuration/TimecodeScale; //TrackDefaultDuration is maybe more precise than the time code else Time=(float)(Temp->second.TimeCodes[Temp->second.TimeCodes.size()-1]-Temp->second.TimeCodes[0])/(Temp->second.TimeCodes.size()-1); if (Time) { float32 FrameRate_FromCluster=1000000000/Time/TimecodeScale; if (Temp->second.Parser) { float32 FrameRate_FromParser=Temp->second.Parser->Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate).To_float32(); if (FrameRate_FromParser && FrameRate_FromParser*2>FrameRate_FromCluster*0.9 && FrameRate_FromParser*2second.TrackDefaultDuration) { float32 FrameRate_FromCluster=1000000000/(float32)Temp->second.TrackDefaultDuration; Fill(Stream_Video, StreamPos_Last, Video_FrameRate, FrameRate_FromCluster); } Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Mode, IsVfr?"VFR":"CFR"); } if (Temp->second.Parser) { //Delay if (Temp->second.TimeCode_Start!=(int64u)-1 && TimecodeScale) { //From TimeCode float64 Delay=Temp->second.TimeCode_Start*int64u_float64(TimecodeScale)/1000000.0; //From stream format if (StreamKind_Last==Stream_Audio && Count_Get(Stream_Video)==1 && Temp->second.Parser->Count_Get(Stream_General)>0) { if (Temp->second.Parser->Buffer_TotalBytes_FirstSynched==0) ; else if (Temp->second.AvgBytesPerSec!=0) Delay+=((float64)Temp->second.Parser->Buffer_TotalBytes_FirstSynched)*1000/Temp->second.AvgBytesPerSec; else if (Temp->second.Parser->Retrieve(Stream_Audio, 0, Audio_BitRate).To_int64u()!=0) Delay+=((float64)Temp->second.Parser->Buffer_TotalBytes_FirstSynched)*1000/Temp->second.Parser->Retrieve(Stream_Audio, 0, Audio_BitRate).To_int64u(); else if (Temp->second.Parser->Retrieve(Stream_Audio, 0, Audio_BitRate_Nominal).To_int64u()!=0) Delay+=((float64)Temp->second.Parser->Buffer_TotalBytes_FirstSynched)*1000/Temp->second.Parser->Retrieve(Stream_Audio, 0, Audio_BitRate_Nominal).To_int64u(); } //Filling Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Delay), Delay, 0, true); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Delay_Source), "Container"); } Ztring Duration_Temp, Codec_Temp; Duration_Temp=Retrieve(StreamKind_Last, Temp->second.StreamPos, Fill_Parameter(StreamKind_Last, Generic_Duration)); //Duration from stream is sometimes false Codec_Temp=Retrieve(StreamKind_Last, Temp->second.StreamPos, Fill_Parameter(StreamKind_Last, Generic_Codec)); //We want to keep the 4CC Finish(Temp->second.Parser); Merge(*Temp->second.Parser, Temp->second.StreamKind, 0, Temp->second.StreamPos); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Duration), Duration_Temp, true); if (Temp->second.StreamKind==Stream_Video && !Codec_Temp.empty()) Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec), Codec_Temp, true); //Special case: AAC if (StreamKind_Last==Stream_Audio && (Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)==__T("AAC") || Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)==__T("MPEG Audio") || Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)==__T("Vorbis"))) Clear(Stream_Audio, StreamPos_Last, Audio_BitDepth); //Resolution is not valid for AAC / MPEG Audio / Vorbis //Special case: 5.1 if (StreamKind_Last==Stream_Audio && (Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)==__T("AC-3") || Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)==__T("E-AC-3") || Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)==__T("DTS")) && Retrieve(Stream_Audio, StreamPos_Last, Audio_Channel_s__Original)==__T("6") && Retrieve(Stream_Audio, StreamPos_Last, Audio_Channel_s_)==__T("5")) { Clear(Stream_Audio, StreamPos_Last, Audio_Channel_s__Original); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, 6, 10, true); //Some muxers do not count LFE in the channel count, let's say it is normal } //VFR if (Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate_Mode)==__T("VFR") && Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate_Original).empty()) { Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Original, Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate)); Clear(Stream_Video, StreamPos_Last, Video_FrameRate); } } if (Temp->second.FrameRate!=0 && Retrieve(Stream_Video, Temp->second.StreamPos, Video_FrameRate).empty()) Fill(Stream_Video, Temp->second.StreamPos, Video_FrameRate, Temp->second.FrameRate, 3); //Flags Fill(Temp->second.StreamKind, Temp->second.StreamPos, "Default", Temp->second.Default?"Yes":"No"); Fill(Temp->second.StreamKind, Temp->second.StreamPos, "Forced", Temp->second.Forced?"Yes":"No"); } //Chapters if (TimecodeScale) { for (EditionEntries_Pos=0; EditionEntries_Pos=Buffer_Size) { Element_WaitForMoreData(); return; } Header_Fill_Code((int32u)-1); //Should be (int64u)-1 but Borland C++ does not like this Header_Fill_Size(Buffer_Offset_Temp-Buffer_Offset); Buffer_Offset_Temp=0; return; } //Parsing int64u Name, Size; Get_EB (Name, "Name"); Get_EB (Size, "Size"); //Filling Header_Fill_Code(Name, Ztring().From_Number(Name, 16)); Header_Fill_Size(Element_Offset+Size); } //--------------------------------------------------------------------------- namespace Elements { //Common const int64u Zero=(int32u)-1; //Should be (int64u)-1 but Borland C++ does not like this const int64u CRC32=0x3F; const int64u Void=0x6C; //EBML const int64u Ebml=0xA45DFA3; const int64u Ebml_Version=0x286; const int64u Ebml_ReadVersion=0x2F7; const int64u Ebml_MaxIDLength=0x2F2; const int64u Ebml_MaxSizeLength=0x2F3; const int64u Ebml_DocType=0x282; const int64u Ebml_DocTypeVersion=0x287; const int64u Ebml_DocTypeReadVersion=0x285; //Segment const int64u Segment=0x8538067; const int64u Segment_Attachements=0x0941A469; const int64u Segment_Attachements_AttachedFile=0x21A7; const int64u Segment_Attachements_AttachedFile_FileData=0x065C; const int64u Segment_Attachements_AttachedFile_FileDescription=0x067E; const int64u Segment_Attachements_AttachedFile_FileName=0x066E; const int64u Segment_Attachements_AttachedFile_FileMimeType=0x0660; const int64u Segment_Attachements_AttachedFile_FileReferral=0x0675; const int64u Segment_Attachements_AttachedFile_FileUID=0x06AE; const int64u Segment_Chapters=0x43A770; const int64u Segment_Chapters_EditionEntry=0x05B9; const int64u Segment_Chapters_EditionEntry_ChapterAtom=0x36; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess=0x2944; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessCodecID=0x2955; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessCommand=0x2911; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessCommand_ChapProcessData=0x2933; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessCommand_ChapProcessTime=0x2922; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessPrivate=0x050D; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapterDisplay=0x00; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapterDisplay_ChapCountry=0x037E; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapterDisplay_ChapLanguage=0x037C; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapterDisplay_ChapString=0x05; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapterFlagEnabled=0x0598; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapterFlagHidden=0x18; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapterPhysicalEquiv=0x23C3; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapterSegmentEditionUID=0x2EBC; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapterSegmentUID=0x2E67; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapterTimeStart=0x11; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapterTimeEnd=0x12; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapterTrack=0x0F; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapterTrack_ChapterTrackNumber=0x09; const int64u Segment_Chapters_EditionEntry_ChapterAtom_ChapterUID=0x33C4; const int64u Segment_Chapters_EditionEntry_EditionFlagDefault=0x05DB; const int64u Segment_Chapters_EditionEntry_EditionFlagHidden=0x05BD; const int64u Segment_Chapters_EditionEntry_EditionFlagOrdered=0x05DD; const int64u Segment_Chapters_EditionEntry_EditionUID=0x05BC; const int64u Segment_Cluster=0xF43B675; const int64u Segment_Cluster_BlockGroup=0x20; const int64u Segment_Cluster_BlockGroup_Block=0x21; const int64u Segment_Cluster_BlockGroup_BlockAdditions=0x35A1; const int64u Segment_Cluster_BlockGroup_BlockAdditions_BlockMore=0x26; const int64u Segment_Cluster_BlockGroup_BlockAdditions_BlockMore_BlockAddID=0x6E; const int64u Segment_Cluster_BlockGroup_BlockAdditions_BlockMore_BlockAdditional=0x25; const int64u Segment_Cluster_BlockGroup_BlockDuration=0x1B; const int64u Segment_Cluster_BlockGroup_ReferenceBlock=0x7B; const int64u Segment_Cluster_BlockGroup_ReferencePriority=0x7A; const int64u Segment_Cluster_BlockGroup_Slices=0xE; const int64u Segment_Cluster_BlockGroup_Slices_TimeSlice=0x68; const int64u Segment_Cluster_BlockGroup_Slices_TimeSlice_Duration=0x4F; const int64u Segment_Cluster_BlockGroup_Slices_TimeSlice_LaceNumber=0x4C; const int64u Segment_Cluster_Position=0x27; const int64u Segment_Cluster_PrevSize=0x2B; const int64u Segment_Cluster_SilentTracks=0x1854; const int64u Segment_Cluster_SilentTracks_SilentTrackNumber=0x18D7; const int64u Segment_Cluster_SimpleBlock=0x23; const int64u Segment_Cluster_Timecode=0x67; const int64u Segment_Cues=0xC53BB6B; const int64u Segment_Cues_CuePoint=0x3B; const int64u Segment_Cues_CuePoint_CueTime=0x33; const int64u Segment_Cues_CuePoint_CueTrackPositions=0x37; const int64u Segment_Cues_CuePoint_CueTrackPositions_CueTrack=0x77; const int64u Segment_Cues_CuePoint_CueTrackPositions_CueClusterPosition=0x71; const int64u Segment_Cues_CuePoint_CueTrackPositions_CueBlockNumber=0x1378; const int64u Segment_Info=0x549A966; const int64u Segment_Info_ChapterTranslate=0x2924; const int64u Segment_Info_ChapterTranslate_ChapterTranslateCodec=0x29BF; const int64u Segment_Info_ChapterTranslate_ChapterTranslateEditionUID=0x29FC; const int64u Segment_Info_ChapterTranslate_ChapterTranslateID=0x29A5; const int64u Segment_Info_DateUTC=0x461; const int64u Segment_Info_Duration=0x489; const int64u Segment_Info_MuxingApp=0xD80; const int64u Segment_Info_NextFilename=0x1E83BB; const int64u Segment_Info_NextUID=0x1EB923; const int64u Segment_Info_PrevFilename=0x1C83AB; const int64u Segment_Info_PrevUID=0x1CB923; const int64u Segment_Info_SegmentFamily=0x444; const int64u Segment_Info_SegmentFilename=0x3384; const int64u Segment_Info_SegmentUID=0x33A4; const int64u Segment_Info_TimecodeScale=0xAD7B1; const int64u Segment_Info_Title=0x3BA9; const int64u Segment_Info_WritingApp=0x1741; const int64u Segment_SeekHead=0x14D9B74; const int64u Segment_SeekHead_Seek=0xDBB; const int64u Segment_SeekHead_Seek_SeekID=0x13AB; const int64u Segment_SeekHead_Seek_SeekPosition=0x13AC; const int64u Segment_Tags=0x0254C367; const int64u Segment_Tags_Tag=0x3373; const int64u Segment_Tags_Tag_SimpleTag=0x27C8; const int64u Segment_Tags_Tag_SimpleTag_TagBinary=0x485; const int64u Segment_Tags_Tag_SimpleTag_TagDefault=0x484; const int64u Segment_Tags_Tag_SimpleTag_TagLanguage=0x47A; const int64u Segment_Tags_Tag_SimpleTag_TagName=0x5A3; const int64u Segment_Tags_Tag_SimpleTag_TagString=0x487; const int64u Segment_Tags_Tag_Targets=0x23C0; const int64u Segment_Tags_Tag_Targets_AttachmentUID=0x23C6; const int64u Segment_Tags_Tag_Targets_ChapterUID=0x23C4; const int64u Segment_Tags_Tag_Targets_EditionUID=0x23C9; const int64u Segment_Tags_Tag_Targets_TargetType=0x23CA; const int64u Segment_Tags_Tag_Targets_TargetTypeValue=0x28CA; const int64u Segment_Tags_Tag_Targets_TrackUID=0x23C5; const int64u Segment_Tracks=0x654AE6B; const int64u Segment_Tracks_TrackEntry=0x2E; const int64u Segment_Tracks_TrackEntry_AttachmentLink=0x3446; const int64u Segment_Tracks_TrackEntry_Audio=0x61; const int64u Segment_Tracks_TrackEntry_Audio_BitDepth=0x2264; const int64u Segment_Tracks_TrackEntry_Audio_Channels=0x1F; const int64u Segment_Tracks_TrackEntry_Audio_OutputSamplingFrequency=0x38B5; const int64u Segment_Tracks_TrackEntry_Audio_SamplingFrequency=0x35; const int64u Segment_Tracks_TrackEntry_CodecDecodeAll=0x2A; const int64u Segment_Tracks_TrackEntry_CodecID=0x6; const int64u Segment_Tracks_TrackEntry_ContentEncodings=0x2D80; const int64u Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding=0x2240; const int64u Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Order=0x1031; const int64u Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Scope=0x1032; const int64u Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Type=0x1033; const int64u Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Compression=0x1034; const int64u Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Compression_ContentCompAlgo=0x0254; const int64u Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Compression_ContentCompSettings=0x0255; const int64u Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption=0x1035; const int64u Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentEncAlgo=0x07E1; const int64u Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentEncKeyID=0x07E2; const int64u Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentSignature=0x07E3; const int64u Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentSigKeyID=0x07E4; const int64u Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentSigAlgo=0x07E5; const int64u Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentSigHashAlgo=0x07E6; const int64u Segment_Tracks_TrackEntry_CodecName=0x58688; const int64u Segment_Tracks_TrackEntry_CodecPrivate=0x23A2; const int64u Segment_Tracks_TrackEntry_DefaultDuration=0x3E383; const int64u Segment_Tracks_TrackEntry_FlagDefault=0x8; const int64u Segment_Tracks_TrackEntry_FlagEnabled=0x39; const int64u Segment_Tracks_TrackEntry_FlagForced=0x15AA; const int64u Segment_Tracks_TrackEntry_FlagLacing=0x1C; const int64u Segment_Tracks_TrackEntry_Language=0x2B59C; const int64u Segment_Tracks_TrackEntry_MaxBlockAdditionID=0x15EE; const int64u Segment_Tracks_TrackEntry_MaxCache=0x2DF8; const int64u Segment_Tracks_TrackEntry_MinCache=0x2DE7; const int64u Segment_Tracks_TrackEntry_Name=0x136E; const int64u Segment_Tracks_TrackEntry_TrackNumber=0x57; const int64u Segment_Tracks_TrackEntry_TrackTimecodeScale=0x3314F; const int64u Segment_Tracks_TrackEntry_TrackType=0x3; const int64u Segment_Tracks_TrackEntry_TrackUID=0x33C5; const int64u Segment_Tracks_TrackEntry_Video=0x60; const int64u Segment_Tracks_TrackEntry_Video_AspectRatioType=0x14B3; const int64u Segment_Tracks_TrackEntry_Video_ColourSpace=0xEB524; const int64u Segment_Tracks_TrackEntry_Video_DisplayHeight=0x14BA; const int64u Segment_Tracks_TrackEntry_Video_DisplayUnit=0x14B2; const int64u Segment_Tracks_TrackEntry_Video_DisplayWidth=0x14B0; const int64u Segment_Tracks_TrackEntry_Video_FlagInterlaced=0x1A; const int64u Segment_Tracks_TrackEntry_Video_FrameRate=0x383E3; const int64u Segment_Tracks_TrackEntry_Video_PixelCropBottom=0x14AA; const int64u Segment_Tracks_TrackEntry_Video_PixelCropLeft=0x14CC; const int64u Segment_Tracks_TrackEntry_Video_PixelCropRight=0x14DD; const int64u Segment_Tracks_TrackEntry_Video_PixelCropTop=0x14BB; const int64u Segment_Tracks_TrackEntry_Video_PixelHeight=0x3A; const int64u Segment_Tracks_TrackEntry_Video_PixelWidth=0x30; const int64u Segment_Tracks_TrackEntry_Video_StereoMode=0x13B8; const int64u Segment_Tracks_TrackEntry_Video_StereoModeBuggy=0x13B9; const int64u Segment_Tracks_TrackEntry_TrackOverlay=0x2FAB; const int64u Segment_Tracks_TrackEntry_TrackTranslate=0x2624; const int64u Segment_Tracks_TrackEntry_TrackTranslate_Codec=0x26BF; const int64u Segment_Tracks_TrackEntry_TrackTranslate_EditionUID=0x26FC; const int64u Segment_Tracks_TrackEntry_TrackTranslate_TrackID=0x26A5; } //--------------------------------------------------------------------------- void File_Mk::Data_Parse() { #define LIS2(_ATOM, _NAME) \ case Elements::_ATOM : \ if (Level==Element_Level) \ { \ Element_Name(_NAME); \ _ATOM(); \ Element_ThisIsAList(); \ } \ #define ATO2(_ATOM, _NAME) \ case Elements::_ATOM : \ if (Level==Element_Level) \ { \ if (Element_IsComplete_Get()) \ { \ Element_Name(_NAME); \ _ATOM(); \ } \ else \ { \ Element_WaitForMoreData(); \ return; \ } \ } \ break; \ #define ATOM_END_MK \ ATOM(Zero) \ ATOM(CRC32) \ ATOM(Void) \ ATOM_END //Parsing DATA_BEGIN LIST(Ebml) ATOM_BEGIN ATOM(Ebml_Version) ATOM(Ebml_ReadVersion) ATOM(Ebml_MaxIDLength) ATOM(Ebml_MaxSizeLength) ATOM(Ebml_DocType) ATOM(Ebml_DocTypeVersion) ATOM(Ebml_DocTypeReadVersion) ATOM_END_MK LIST(Segment) ATOM_BEGIN LIST(Segment_Attachements) ATOM_BEGIN LIST(Segment_Attachements_AttachedFile) ATOM_BEGIN LIST_SKIP(Segment_Attachements_AttachedFile_FileData) //This is ATOM, but some ATOMs are too big ATOM(Segment_Attachements_AttachedFile_FileDescription) ATOM(Segment_Attachements_AttachedFile_FileName) ATOM(Segment_Attachements_AttachedFile_FileMimeType) ATOM(Segment_Attachements_AttachedFile_FileReferral) ATOM(Segment_Attachements_AttachedFile_FileUID) ATOM_END_MK ATOM_END_MK LIST(Segment_Chapters) ATOM_BEGIN LIST(Segment_Chapters_EditionEntry) ATOM_BEGIN LIST(Segment_Chapters_EditionEntry_ChapterAtom) ATOM_BEGIN LIST(Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess) ATOM_BEGIN ATOM(Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessCodecID) LIST(Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessCommand) ATOM_BEGIN ATOM(Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessCommand_ChapProcessData) ATOM(Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessCommand_ChapProcessTime) ATOM_END_MK ATOM(Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessPrivate) ATOM_END_MK LIST(Segment_Chapters_EditionEntry_ChapterAtom_ChapterDisplay) ATOM_BEGIN ATOM(Segment_Chapters_EditionEntry_ChapterAtom_ChapterDisplay_ChapCountry) ATOM(Segment_Chapters_EditionEntry_ChapterAtom_ChapterDisplay_ChapLanguage) ATOM(Segment_Chapters_EditionEntry_ChapterAtom_ChapterDisplay_ChapString) ATOM_END_MK ATOM(Segment_Chapters_EditionEntry_ChapterAtom_ChapterFlagEnabled) ATOM(Segment_Chapters_EditionEntry_ChapterAtom_ChapterFlagHidden) ATOM(Segment_Chapters_EditionEntry_ChapterAtom_ChapterPhysicalEquiv) ATOM(Segment_Chapters_EditionEntry_ChapterAtom_ChapterSegmentEditionUID) ATOM(Segment_Chapters_EditionEntry_ChapterAtom_ChapterSegmentUID) ATOM(Segment_Chapters_EditionEntry_ChapterAtom_ChapterTimeEnd) ATOM(Segment_Chapters_EditionEntry_ChapterAtom_ChapterTimeStart) LIST(Segment_Chapters_EditionEntry_ChapterAtom_ChapterTrack) ATOM_BEGIN ATOM(Segment_Chapters_EditionEntry_ChapterAtom_ChapterTrack_ChapterTrackNumber) ATOM_END_MK ATOM(Segment_Chapters_EditionEntry_ChapterAtom_ChapterUID) ATOM_END_MK ATOM(Segment_Chapters_EditionEntry_EditionFlagDefault) ATOM(Segment_Chapters_EditionEntry_EditionFlagHidden) ATOM(Segment_Chapters_EditionEntry_EditionFlagOrdered) ATOM(Segment_Chapters_EditionEntry_EditionUID) ATOM_END_MK ATOM_END_MK LIST(Segment_Cluster) ATOM_BEGIN LIST(Segment_Cluster_BlockGroup) ATOM_BEGIN ATOM(Segment_Cluster_BlockGroup_Block) LIST(Segment_Cluster_BlockGroup_BlockAdditions) ATOM_BEGIN LIST(Segment_Cluster_BlockGroup_BlockAdditions_BlockMore) ATOM_BEGIN ATOM(Segment_Cluster_BlockGroup_BlockAdditions_BlockMore_BlockAddID) ATOM(Segment_Cluster_BlockGroup_BlockAdditions_BlockMore_BlockAdditional) ATOM_END_MK ATOM_END_MK ATOM(Segment_Cluster_BlockGroup_BlockDuration) ATOM(Segment_Cluster_BlockGroup_ReferenceBlock) ATOM(Segment_Cluster_BlockGroup_ReferencePriority) LIST(Segment_Cluster_BlockGroup_Slices) ATOM_BEGIN LIST(Segment_Cluster_BlockGroup_Slices_TimeSlice) ATOM_BEGIN ATOM(Segment_Cluster_BlockGroup_Slices_TimeSlice_Duration) ATOM(Segment_Cluster_BlockGroup_Slices_TimeSlice_LaceNumber) ATOM_END_MK ATOM_END_MK ATOM_END_MK ATOM(Segment_Cluster_Position) ATOM(Segment_Cluster_PrevSize) LIST(Segment_Cluster_SilentTracks) ATOM_BEGIN ATOM(Segment_Cluster_SilentTracks_SilentTrackNumber) ATOM_END_MK ATOM(Segment_Cluster_SimpleBlock) ATOM(Segment_Cluster_Timecode) ATOM_END_MK LIST(Segment_Cues) ATOM_BEGIN LIST(Segment_Cues_CuePoint) ATOM_BEGIN ATOM(Segment_Cues_CuePoint_CueTime) LIST(Segment_Cues_CuePoint_CueTrackPositions) ATOM_BEGIN ATOM(Segment_Cues_CuePoint_CueTrackPositions_CueTrack) ATOM(Segment_Cues_CuePoint_CueTrackPositions_CueClusterPosition) ATOM(Segment_Cues_CuePoint_CueTrackPositions_CueBlockNumber) ATOM_END_MK ATOM_END_MK ATOM_END_MK LIST(Segment_Info) ATOM_BEGIN LIST(Segment_Info_ChapterTranslate) ATOM_BEGIN ATOM(Segment_Info_ChapterTranslate_ChapterTranslateCodec) ATOM(Segment_Info_ChapterTranslate_ChapterTranslateEditionUID) ATOM(Segment_Info_ChapterTranslate_ChapterTranslateID) ATOM_END_MK ATOM(Segment_Info_DateUTC) ATOM(Segment_Info_Duration) ATOM(Segment_Info_MuxingApp) ATOM(Segment_Info_NextFilename) ATOM(Segment_Info_NextUID) ATOM(Segment_Info_PrevFilename) ATOM(Segment_Info_PrevUID) ATOM(Segment_Info_SegmentFamily) ATOM(Segment_Info_SegmentFilename) ATOM(Segment_Info_SegmentUID) ATOM(Segment_Info_TimecodeScale) ATOM(Segment_Info_Title) ATOM(Segment_Info_WritingApp) ATOM_END_MK LIST(Segment_SeekHead) ATOM_BEGIN LIST(Segment_SeekHead_Seek) ATOM_BEGIN ATOM(Segment_SeekHead_Seek_SeekID) ATOM(Segment_SeekHead_Seek_SeekPosition) ATOM_END_MK ATOM_END_MK LIST(Segment_Tags) ATOM_BEGIN LIST(Segment_Tags_Tag) ATOM_BEGIN LIST(Segment_Tags_Tag_SimpleTag) ATOM_BEGIN LIST(Segment_Tags_Tag_SimpleTag) ATOM_BEGIN LIST(Segment_Tags_Tag_SimpleTag) ATOM_BEGIN ATOM(Segment_Tags_Tag_SimpleTag_TagBinary) ATOM(Segment_Tags_Tag_SimpleTag_TagDefault) ATOM(Segment_Tags_Tag_SimpleTag_TagLanguage) ATOM(Segment_Tags_Tag_SimpleTag_TagName) ATOM(Segment_Tags_Tag_SimpleTag_TagString) ATOM_END_MK ATOM(Segment_Tags_Tag_SimpleTag_TagBinary) ATOM(Segment_Tags_Tag_SimpleTag_TagDefault) ATOM(Segment_Tags_Tag_SimpleTag_TagLanguage) ATOM(Segment_Tags_Tag_SimpleTag_TagName) ATOM(Segment_Tags_Tag_SimpleTag_TagString) ATOM_END_MK ATOM(Segment_Tags_Tag_SimpleTag_TagBinary) ATOM(Segment_Tags_Tag_SimpleTag_TagDefault) ATOM(Segment_Tags_Tag_SimpleTag_TagLanguage) ATOM(Segment_Tags_Tag_SimpleTag_TagName) ATOM(Segment_Tags_Tag_SimpleTag_TagString) ATOM_END_MK LIST(Segment_Tags_Tag_Targets) ATOM_BEGIN ATOM(Segment_Tags_Tag_Targets_AttachmentUID) ATOM(Segment_Tags_Tag_Targets_ChapterUID) ATOM(Segment_Tags_Tag_Targets_EditionUID) ATOM(Segment_Tags_Tag_Targets_TargetType) ATOM(Segment_Tags_Tag_Targets_TargetTypeValue) ATOM(Segment_Tags_Tag_Targets_TrackUID) ATOM_END_MK ATOM_END_MK ATOM_END_MK LIST(Segment_Tracks) ATOM_BEGIN LIST(Segment_Tracks_TrackEntry) ATOM_BEGIN ATOM(Segment_Tracks_TrackEntry_AttachmentLink) LIST(Segment_Tracks_TrackEntry_Audio) ATOM_BEGIN ATOM(Segment_Tracks_TrackEntry_Audio_BitDepth) ATOM(Segment_Tracks_TrackEntry_Audio_Channels) ATOM(Segment_Tracks_TrackEntry_Audio_OutputSamplingFrequency) ATOM(Segment_Tracks_TrackEntry_Audio_SamplingFrequency) ATOM_END_MK ATOM(Segment_Tracks_TrackEntry_CodecDecodeAll) ATOM(Segment_Tracks_TrackEntry_CodecID) LIS2(Segment_Tracks_TrackEntry_ContentEncodings, "ContentEncodings") ATOM_BEGIN LIS2(Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding, "ContentEncoding") ATOM_BEGIN ATO2(Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Order, "Order") ATO2(Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Scope, "Scope") ATO2(Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Type, "Type") LIS2(Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Compression, "Compression") ATOM_BEGIN ATO2(Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Compression_ContentCompAlgo, "Algo") ATO2(Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Compression_ContentCompSettings, "Settings") ATOM_END_MK LIS2(Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption, "Encryption") ATOM_BEGIN ATO2(Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentEncAlgo, "Algo") ATO2(Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentEncKeyID, "KeyID") ATO2(Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentSignature, "Signature") ATO2(Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentSigKeyID, "SigKeyID") ATO2(Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentSigAlgo, "SigAlgo") ATO2(Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentSigHashAlgo, "SigHashAlgo") ATOM_END_MK ATOM_END_MK ATOM_END_MK ATOM(Segment_Tracks_TrackEntry_CodecName) ATOM(Segment_Tracks_TrackEntry_CodecPrivate) ATOM(Segment_Tracks_TrackEntry_DefaultDuration) ATOM(Segment_Tracks_TrackEntry_FlagDefault) ATOM(Segment_Tracks_TrackEntry_FlagEnabled) ATOM(Segment_Tracks_TrackEntry_FlagForced) ATOM(Segment_Tracks_TrackEntry_FlagLacing) ATOM(Segment_Tracks_TrackEntry_Language) ATOM(Segment_Tracks_TrackEntry_MaxBlockAdditionID) ATOM(Segment_Tracks_TrackEntry_MaxCache) ATOM(Segment_Tracks_TrackEntry_MinCache) ATOM(Segment_Tracks_TrackEntry_Name) ATOM(Segment_Tracks_TrackEntry_TrackNumber) ATOM(Segment_Tracks_TrackEntry_TrackTimecodeScale) ATOM(Segment_Tracks_TrackEntry_TrackType) ATOM(Segment_Tracks_TrackEntry_TrackUID) LIST(Segment_Tracks_TrackEntry_Video) ATOM_BEGIN ATOM(Segment_Tracks_TrackEntry_Video_AspectRatioType) ATOM(Segment_Tracks_TrackEntry_Video_ColourSpace) ATOM(Segment_Tracks_TrackEntry_Video_DisplayHeight) ATOM(Segment_Tracks_TrackEntry_Video_DisplayUnit) ATOM(Segment_Tracks_TrackEntry_Video_DisplayWidth) ATOM(Segment_Tracks_TrackEntry_Video_FlagInterlaced) ATOM(Segment_Tracks_TrackEntry_Video_FrameRate) ATOM(Segment_Tracks_TrackEntry_Video_PixelCropBottom) ATOM(Segment_Tracks_TrackEntry_Video_PixelCropLeft) ATOM(Segment_Tracks_TrackEntry_Video_PixelCropRight) ATOM(Segment_Tracks_TrackEntry_Video_PixelCropTop) ATOM(Segment_Tracks_TrackEntry_Video_PixelHeight) ATOM(Segment_Tracks_TrackEntry_Video_PixelWidth) ATOM(Segment_Tracks_TrackEntry_Video_StereoMode) ATOM_END_MK ATOM(Segment_Tracks_TrackEntry_TrackOverlay) LIST(Segment_Tracks_TrackEntry_TrackTranslate) ATOM_BEGIN ATOM(Segment_Tracks_TrackEntry_TrackTranslate_Codec) ATOM(Segment_Tracks_TrackEntry_TrackTranslate_EditionUID) ATOM(Segment_Tracks_TrackEntry_TrackTranslate_TrackID) ATOM_END_MK ATOM_END_MK ATOM_END_MK ATOM_END_MK DATA_END } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Mk::Zero() { Element_Name("ZeroPadding"); Skip_XX(Element_Size, "Padding"); } //--------------------------------------------------------------------------- void File_Mk::CRC32() { Element_Name("CRC32"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Void() { Element_Name("Void"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Ebml() { Element_Name("Ebml"); } //--------------------------------------------------------------------------- void File_Mk::Ebml_Version() { Element_Name("Version"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Ebml_ReadVersion() { Element_Name("ReadVersion"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Ebml_MaxIDLength() { Element_Name("MaxIDLength"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Ebml_MaxSizeLength() { Element_Name("MaxSizeLength"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Ebml_DocType() { Element_Name("DocType"); //Parsing Ztring Data; Get_Local(Element_Size, Data, "Data"); Element_Info1(Data); //Filling FILLING_BEGIN(); if (Data==__T("matroska")) { Accept("Matroska"); Fill(Stream_General, 0, General_Format, "Matroska"); } else if (Data==__T("webm")) { Accept("Matroska"); Fill(Stream_General, 0, General_Format, "WebM"); } else { Reject("Matroska"); return; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Ebml_DocTypeVersion() { Element_Name("DocTypeVersion"); //Parsing Format_Version=UInteger_Get(); //Filling FILLING_BEGIN(); Fill(Stream_General, 0, General_Format_Version, __T("Version ")+Ztring::ToZtring(Format_Version)); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Ebml_DocTypeReadVersion() { Element_Name("DocTypeReadVersion"); //Parsing int64u UInteger=UInteger_Get(); //Filling FILLING_BEGIN(); if (UInteger!=Format_Version) Fill(Stream_General, 0, General_Format_Version, __T("Version ")+Ztring::ToZtring(UInteger)); //Adding compatible version for info about legacy decoders FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment() { Element_Name("Segment"); if (!Status[IsAccepted]) { Accept("Matroska"); Fill(Stream_General, 0, General_Format, "Matroska"); //Default is Matroska } Segment_Offset_Begin=File_Offset+Buffer_Offset; Segment_Offset_End=File_Offset+Buffer_Offset+Element_TotalSize_Get(); } void File_Mk::Segment_Attachements() { Element_Name("Attachements"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Attachements_AttachedFile() { Element_Name("AttachedFile"); AttachedFiles.resize(AttachedFiles.size()+1); } //--------------------------------------------------------------------------- void File_Mk::Segment_Attachements_AttachedFile_FileData() { Element_Name("FileData"); //Parsing Skip_XX(Element_TotalSize_Get(), "Data"); FILLING_BEGIN(); if (AttachedFiles[AttachedFiles.size()-1].empty()) AttachedFiles[AttachedFiles.size()-1]=__T("Yes"); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Attachements_AttachedFile_FileDescription() { Element_Name("FileDescription"); //Parsing Ztring Data=Local_Get(); FILLING_BEGIN(); if (!Data.empty()) AttachedFiles[AttachedFiles.size()-1]=Data; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Attachements_AttachedFile_FileName() { Element_Name("FileName"); //Parsing UTF8_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Attachements_AttachedFile_FileMimeType() { Element_Name("FileMimeType"); //Parsing Local_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Attachements_AttachedFile_FileReferral() { Element_Name("FileReferral"); //Parsing Skip_XX(Element_Size, "Data"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Attachements_AttachedFile_FileUID() { Element_Name("FileUID"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters() { Element_Name("Chapters"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry() { Element_Name("EditionEntry"); //Filling EditionEntries_Pos=EditionEntries.size(); EditionEntries.resize(EditionEntries_Pos+1); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom() { Element_Name("ChapterAtom"); //Filling ChapterAtoms_Pos=EditionEntries[EditionEntries_Pos].ChapterAtoms.size(); EditionEntries[EditionEntries_Pos].ChapterAtoms.resize(ChapterAtoms_Pos+1); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess() { Element_Name("ChapProcess"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessCodecID() { Element_Name("ChapProcessCodecID"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessCommand() { Element_Name("ChapProcessCommand"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessCommand_ChapProcessData() { Element_Name("ChapProcessData"); //Parsing Skip_XX(Element_Size, "Data"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessCommand_ChapProcessTime() { Element_Name("ChapProcessTime"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessPrivate() { Element_Name("ChapProcessPrivate"); //Parsing Skip_XX(Element_Size, "Data"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapterDisplay() { Element_Name("ChapterDisplay"); //Filling ChapterDisplays_Pos=EditionEntries[EditionEntries_Pos].ChapterAtoms[ChapterAtoms_Pos].ChapterDisplays.size(); EditionEntries[EditionEntries_Pos].ChapterAtoms[ChapterAtoms_Pos].ChapterDisplays.resize(ChapterDisplays_Pos+1); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapterDisplay_ChapCountry() { Element_Name("ChapCountry"); //Parsing Local_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapterDisplay_ChapLanguage() { Element_Name("ChapLanguage"); //Parsing Ztring Data=Local_Get(); FILLING_BEGIN(); EditionEntries[EditionEntries_Pos].ChapterAtoms[ChapterAtoms_Pos].ChapterDisplays[ChapterDisplays_Pos].ChapLanguage=Data; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapterDisplay_ChapString() { Element_Name("ChapString"); //Parsing Ztring Data=UTF8_Get(); FILLING_BEGIN(); EditionEntries[EditionEntries_Pos].ChapterAtoms[ChapterAtoms_Pos].ChapterDisplays[ChapterDisplays_Pos].ChapString=Data; //if (TimecodeScale!=0 && ChapterTimeStart!=(int64u)-1) // Fill(StreamKind_Last, StreamPos_Last, Ztring::ToZtring(Chapter_Pos).To_Local().c_str(), Ztring().Duration_From_Milliseconds(ChapterTimeStart/TimecodeScale)+__T(" - ")+ChapterString, true); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapterFlagHidden() { Element_Name("ChapterFlagHidden"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapterFlagEnabled() { Element_Name("ChapterFlagEnabled"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapterPhysicalEquiv() { Element_Name("ChapterPhysicalEquiv"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapterSegmentEditionUID() { Element_Name("ChapterSegmentEditionUID"); //Parsing Skip_XX(Element_Size, "Data"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapterSegmentUID() { Element_Name("ChapterSegmentUID"); //Parsing Skip_XX(Element_Size, "Data"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapterTimeEnd() { Element_Name("ChapterTimeEnd"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapterTimeStart() { Element_Name("ChapterTimeStart"); //Parsing int64u Data=UInteger_Get(); FILLING_BEGIN(); EditionEntries[EditionEntries_Pos].ChapterAtoms[ChapterAtoms_Pos].ChapterTimeStart=Data; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapterTrack() { Element_Name("ChapterTrack"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapterTrack_ChapterTrackNumber() { Element_Name("ChapterTrackNumber"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_ChapterAtom_ChapterUID() { Element_Name("ChapterUID"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_EditionFlagDefault() { Element_Name("EditionFlagDefault"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_EditionFlagHidden() { Element_Name("EditionFlagHidden"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_EditionFlagOrdered() { Element_Name("EditionFlagOrdered"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Chapters_EditionEntry_EditionUID() { Element_Name("EditionUID"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster() { Element_Name("Cluster"); //For each stream std::map::iterator Temp=Stream.begin(); if (!Cluster_AlreadyParsed) { Stream_Count=0; while (Temp!=Stream.end()) { if (Temp->second.Parser) Temp->second.Searching_Payload=true; if (Temp->second.StreamKind==Stream_Video || Temp->second.StreamKind==Stream_Audio) Temp->second.Searching_TimeStamp_Start=true; if (Temp->second.StreamKind==Stream_Video) Temp->second.Searching_TimeStamps=true; if (Temp->second.Searching_Payload || Temp->second.Searching_TimeStamp_Start || Temp->second.Searching_TimeStamps) Stream_Count++; //Specific cases if (Retrieve(Temp->second.StreamKind, Temp->second.StreamPos, Audio_CodecID).find(__T("A_AAC/"))==0) ((File_Aac*)Stream[Temp->first].Parser)->Mode=File_Aac::Mode_raw_data_block; //In case AudioSpecificConfig is not present ++Temp; } //We must parse moov? if (Stream_Count==0) { //Jumping std::sort(Segment_Seeks.begin(), Segment_Seeks.end()); for (size_t Pos=0; PosFile_Offset+Buffer_Offset+Element_Size) { GoTo(Segment_Seeks[Pos]); break; } if (File_GoTo==(int64u)-1) GoTo(Segment_Offset_End); return; } } Cluster_AlreadyParsed=true; Segment_Cluster_TimeCode_Value=0; //Default } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_BlockGroup() { Element_Name("BlockGroup"); Segment_Cluster_BlockGroup_BlockDuration_Value=(int64u)-1; Segment_Cluster_BlockGroup_BlockDuration_TrackNumber=(int64u)-1; } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_BlockGroup_Block() { Element_Name("Block"); //Parsing int64u TrackNumber; Get_EB (TrackNumber, "TrackNumber"); //Finished? Stream[TrackNumber].PacketCount++; if (Stream[TrackNumber].Searching_Payload || Stream[TrackNumber].Searching_TimeStamps || Stream[TrackNumber].Searching_TimeStamp_Start) { //Parsing int16u TimeCode; Get_B2 (TimeCode, "TimeCode"); FILLING_BEGIN(); if (Stream[TrackNumber].Searching_TimeStamp_Start) { FILLING_BEGIN(); Stream[TrackNumber].TimeCode_Start=Segment_Cluster_TimeCode_Value+TimeCode; Stream[TrackNumber].Searching_TimeStamp_Start=false; FILLING_END(); } if (Stream[TrackNumber].Searching_TimeStamps) { Stream[TrackNumber].TimeCodes.push_back(Segment_Cluster_TimeCode_Value+TimeCode); if (Stream[TrackNumber].TimeCodes.size()>40) Stream[TrackNumber].Searching_TimeStamps=false; } if (Segment_Cluster_BlockGroup_BlockDuration_Value!=(int64u)-1) { Stream[TrackNumber].Segment_Cluster_BlockGroup_BlockDuration_Counts[Segment_Cluster_BlockGroup_BlockDuration_Value]++; Segment_Cluster_BlockGroup_BlockDuration_Value=(int64u)-1; } FILLING_END(); if (Stream[TrackNumber].Searching_Payload) { std::vector Laces; int32u Lacing; Element_Begin1("Flags"); BS_Begin(); Skip_BS(1, "KeyFrame"); Skip_BS(3, "Reserved"); Skip_BS(1, "Invisible"); Get_BS (2, Lacing, "Lacing"); Skip_BS(1, "Discardable"); BS_End(); Element_End0(); if (Lacing>0) { Element_Begin1("Lacing"); int8u FrameCountMinus1; Get_B1(FrameCountMinus1, "Frame count minus 1"); switch (Lacing) { case 1 : //Xiph lacing { int64u Element_Offset_Virtual=0; for (int8u Pos=0; PosElement_Size) Stream[TrackNumber].Searching_Payload=false; //There is a problem if (Stream[TrackNumber].Searching_Payload) { Element_Code=TrackNumber; //Content compression if (Stream[TrackNumber].ContentCompAlgo==3) //Header Stripping { Element_Offset-=(size_t)Stream[TrackNumber].ContentCompSettings_Buffer_Size; //This is an extra array, not in the stream Open_Buffer_Continue(Stream[TrackNumber].Parser, Stream[TrackNumber].ContentCompSettings_Buffer, (size_t)Stream[TrackNumber].ContentCompSettings_Buffer_Size); Element_Offset+=(size_t)Stream[TrackNumber].ContentCompSettings_Buffer_Size; Demux(Stream[TrackNumber].ContentCompSettings_Buffer, (size_t)Stream[TrackNumber].ContentCompSettings_Buffer_Size, ContentType_MainStream); } //Parsing Demux(Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset), ContentType_MainStream); Open_Buffer_Continue(Stream[TrackNumber].Parser, (size_t)Laces[Pos]); if (Stream[TrackNumber].Parser->Status[IsFilled] || Stream[TrackNumber].Parser->Status[IsFinished] || Stream[TrackNumber].PacketCount>=300) Stream[TrackNumber].Searching_Payload=false; } else Skip_XX(Laces[Pos], "Data"); } //Positionning Element_Offset=Element_Size; FILLING_END(); } else { Skip_XX(Element_Size-Element_Offset, "Data"); } if (!Stream[TrackNumber].Searching_Payload && !Stream[TrackNumber].Searching_TimeStamps && !Stream[TrackNumber].Searching_TimeStamp_Start) Stream_Count--; } else { Skip_XX(Element_Size-Element_Offset, "Data"); } //Filling Frame_Count++; if (!Status[IsFilled] && ((Frame_Count>6 && (Stream_Count==0 ||Config->ParseSpeed==0.0)) || Frame_Count>512*Stream.size())) { Fill(); if (MediaInfoLib::Config.ParseSpeed_Get()<1) { //Jumping std::sort(Segment_Seeks.begin(), Segment_Seeks.end()); for (size_t Pos=0; PosFile_Offset+Buffer_Offset+Element_Size) { GoTo(Segment_Seeks[Pos]); break; } if (File_GoTo==(int64u)-1) GoTo(Segment_Offset_End); } } Element_Show(); //For debug } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_BlockGroup_BlockAdditions() { Element_Name("BlockAdditions"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_BlockGroup_BlockAdditions_BlockMore() { Element_Name("BlockMore"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_BlockGroup_BlockAdditions_BlockMore_BlockAddID() { Element_Name("BlockAddID"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_BlockGroup_BlockAdditions_BlockMore_BlockAdditional() { Element_Name("BlockAdditional"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_BlockGroup_BlockDuration() { Element_Name("BlockDuration"); //Parsing int64u Segment_Cluster_TimeCode_Value=UInteger_Get(); FILLING_BEGIN(); if (Segment_Cluster_BlockGroup_BlockDuration_TrackNumber!=(int64u)-1) { Stream[Segment_Cluster_BlockGroup_BlockDuration_TrackNumber].Segment_Cluster_BlockGroup_BlockDuration_Counts[Segment_Cluster_TimeCode_Value]++; Segment_Cluster_BlockGroup_BlockDuration_TrackNumber=(int64u)-1; } else Segment_Cluster_BlockGroup_BlockDuration_Value=Segment_Cluster_TimeCode_Value; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_BlockGroup_ReferenceBlock() { Element_Name("ReferenceBlock"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_BlockGroup_ReferencePriority() { Element_Name("ReferencePriority"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_BlockGroup_Slices() { Element_Name("Slices"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_BlockGroup_Slices_TimeSlice() { Element_Name("TimeSlice"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_BlockGroup_Slices_TimeSlice_Duration() { Element_Name("Duration"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_BlockGroup_Slices_TimeSlice_LaceNumber() { Element_Name("LaceNumber"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_Position() { Element_Name("Position"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_PrevSize() { Element_Name("PrevSize"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_SilentTracks() { Element_Name("SilentTracks"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_SilentTracks_SilentTrackNumber() { Element_Name("SilentTrackNumber"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_SimpleBlock() { Segment_Cluster_BlockGroup_BlockDuration_Value=(int64u)-1; Segment_Cluster_BlockGroup_BlockDuration_TrackNumber=(int64u)-1; Segment_Cluster_BlockGroup_Block(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cluster_Timecode() { Element_Name("Timecode"); //Parsing Segment_Cluster_TimeCode_Value=UInteger_Get(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cues() { Element_Name("Cues"); //Skipping Cues, we don't need of them Skip_XX(Element_TotalSize_Get(), "Cues data, skipping"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cues_CuePoint() { Element_Name("CuePoint"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cues_CuePoint_CueTime() { Element_Name("CueTime"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cues_CuePoint_CueTrackPositions() { Element_Name("CueTrackPositions"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cues_CuePoint_CueTrackPositions_CueTrack() { Element_Name("CueTrack"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cues_CuePoint_CueTrackPositions_CueClusterPosition() { Element_Name("CueClusterPosition"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Cues_CuePoint_CueTrackPositions_CueBlockNumber() { Element_Name("CueBlockNumber"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info() { Element_Name("Info"); if (Cluster_AlreadyParsed) Skip_XX(Element_TotalSize_Get(), "Alreadys parsed, skipping"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info_ChapterTranslate() { Element_Name("ChapterTranslate"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info_ChapterTranslate_ChapterTranslateCodec() { Element_Name("ChapterTranslateCodec"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info_ChapterTranslate_ChapterTranslateEditionUID() { Element_Name("ChapterTranslateEditionUID"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info_ChapterTranslate_ChapterTranslateID() { Element_Name("ChapterTranslateID"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info_DateUTC() { Element_Name("DateUTC"); //Parsing int64u Data; Get_B8(Data, "Data"); Element_Info1(Data/1000000000+978307200); //From Beginning of the millenium, in nanoseconds FILLING_BEGIN(); Fill(Stream_General, 0, "Encoded_Date", Ztring().Date_From_Seconds_1970((int32u)(Data/1000000000+978307200))); //978307200s between beginning of the millenium and 1970 FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info_Duration() { Element_Name("Duration"); //Parsing float64 Float=Float_Get(); FILLING_BEGIN(); Duration=Float; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info_MuxingApp() { Element_Name("MuxingApp"); //Parsing Ztring Data=UTF8_Get(); FILLING_BEGIN(); Fill(Stream_General, 0, "Encoded_Library", Data); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info_NextFilename() { Element_Name("NextFilename"); //Parsing UTF8_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info_NextUID() { Element_Name("NextUID"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info_PrevFilename() { Element_Name("PrevFilename"); //Parsing UTF8_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info_PrevUID() { Element_Name("PrevUID"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info_SegmentFamily() { Element_Name("SegmentFamily"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info_SegmentFilename() { Element_Name("SegmentFilename"); //Parsing UTF8_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info_SegmentUID() { Element_Name("SegmentUID"); //Parsing int128u Data; Data=UInteger16_Get(); FILLING_BEGIN(); Fill(Stream_General, 0, General_UniqueID, Ztring().From_Local(Data.toString(10))); Fill(Stream_General, 0, General_UniqueID_String, Ztring().From_Local(Data.toString(10))+__T(" (0x")+Ztring().From_Local(Data.toString(16))+__T(')')); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info_TimecodeScale() { Element_Name("TimecodeScale"); //Parsing int64u UInteger=UInteger_Get(); FILLING_BEGIN(); TimecodeScale=UInteger; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info_Title() { Element_Name("Title"); //Parsing Ztring Data=UTF8_Get(); FILLING_BEGIN(); Fill(Stream_General, 0, "Title", Data); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Info_WritingApp() { Element_Name("WritingApp"); //Parsing Ztring Data=UTF8_Get(); FILLING_BEGIN(); Fill(Stream_General, 0, "Encoded_Application", Data); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_SeekHead() { Element_Name("SeekHead"); Segment_Seeks.clear(); } //--------------------------------------------------------------------------- void File_Mk::Segment_SeekHead_Seek() { Element_Name("Seek"); } //--------------------------------------------------------------------------- void File_Mk::Segment_SeekHead_Seek_SeekID() { Element_Name("SeekID"); //Parsing int64u Data; Get_EB (Data, "Data"); } //--------------------------------------------------------------------------- void File_Mk::Segment_SeekHead_Seek_SeekPosition() { Element_Name("SeekPosition"); //Parsing int64u Data=UInteger_Get(); Segment_Seeks.push_back(Segment_Offset_Begin+Data); Element_Info1(Ztring::ToZtring(Segment_Offset_Begin+Data, 16)); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tags() { Element_Name("Tags"); Segment_Tag_SimpleTag_TagNames.clear(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tags_Tag() { Element_Name("Tag"); Segment_Tag_TrackUID=(int64u)-1; } //--------------------------------------------------------------------------- void File_Mk::Segment_Tags_Tag_SimpleTag() { Element_Name("SimpleTag"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tags_Tag_SimpleTag_TagBinary() { Element_Name("TagBinary"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tags_Tag_SimpleTag_TagDefault() { Element_Name("TagDefault"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tags_Tag_SimpleTag_TagLanguage() { Element_Name("TagLanguage"); //Parsing Ztring Data; Get_Local(Element_Size, Data, "Data"); Element_Info1(Data); FILLING_BEGIN(); //Fill(StreamKind_Last, StreamPos_Last, "Language", Data); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tags_Tag_SimpleTag_TagName() { Element_Name("TagName"); //Parsing Ztring TagName=UTF8_Get(); Segment_Tag_SimpleTag_TagNames.resize(Element_Level-5); //5 is the first level of a tag Segment_Tag_SimpleTag_TagNames.push_back(TagName); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tags_Tag_SimpleTag_TagString() { Element_Name("TagString"); //Parsing Ztring TagString; TagString=UTF8_Get(); if (Segment_Tag_SimpleTag_TagNames.empty()) return; if (Segment_Tag_SimpleTag_TagNames[0]==__T("BITSPS")) return; //Useless if (Segment_Tag_SimpleTag_TagNames[0]==__T("BPS")) return; //Useless if (Segment_Tag_SimpleTag_TagNames[0]==__T("COMPATIBLE_BRANDS")) return; //QuickTime techinical info, useless if (Segment_Tag_SimpleTag_TagNames[0]==__T("CREATION_TIME")) {Segment_Tag_SimpleTag_TagNames[0]=__T("Encoded_Date"); TagString.insert(0, __T("UTC "));} if (Segment_Tag_SimpleTag_TagNames[0]==__T("DATE_DIGITIZED")) {Segment_Tag_SimpleTag_TagNames[0]=__T("Mastered_Date"); TagString.insert(0, __T("UTC "));} if (Segment_Tag_SimpleTag_TagNames[0]==__T("ENCODED_BY")) Segment_Tag_SimpleTag_TagNames[0]=__T("EncodedBy"); if (Segment_Tag_SimpleTag_TagNames[0]==__T("ENCODER")) Segment_Tag_SimpleTag_TagNames[0]=__T("Encoded_Library"); if (Segment_Tag_SimpleTag_TagNames[0]==__T("FPS")) return; //Useless if (Segment_Tag_SimpleTag_TagNames[0]==__T("LANGUAGE")) Segment_Tag_SimpleTag_TagNames[0]=__T("Language"); if (Segment_Tag_SimpleTag_TagNames[0]==__T("MAJOR_BRAND")) return; //QuickTime techinical info, useless if (Segment_Tag_SimpleTag_TagNames[0]==__T("MINOR_VERSION")) return; //QuickTime techinical info, useless if (Segment_Tag_SimpleTag_TagNames[0]==__T("ORIGINAL_MEDIA_TYPE")) Segment_Tag_SimpleTag_TagNames[0]=__T("OriginalSourceForm"); if (Segment_Tag_SimpleTag_TagNames[0]==__T("STEREO_MODE")) return; //Useless if (Segment_Tag_SimpleTag_TagNames[0]==__T("TERMS_OF_USE")) Segment_Tag_SimpleTag_TagNames[0]=__T("TermsOfUse"); for (size_t Pos=1; PosAudioSpecificConfig_OutOfBand((int32u)float64_int64s(Float)); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_CodecDecodeAll() { Element_Name("CodecDecodeAll"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_CodecID() { Element_Name("CodecID"); //Parsing Ztring Data; Get_Local(Element_Size, Data, "Data"); Element_Info1(Data); FILLING_BEGIN(); CodecID=Data; CodecID_Manage(); CodecPrivate_Manage(); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Compression() { FILLING_BEGIN(); Stream[TrackNumber].ContentCompAlgo=0; //0 is default Fill(StreamKind_Last, StreamPos_Last, "MuxingMode", Mk_ContentCompAlgo(0), Unlimited, true, true); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Compression_ContentCompAlgo() { //Parsing int64u Algo=UInteger_Get(); Param_Info1(Mk_ContentCompAlgo(Algo)); FILLING_BEGIN(); Stream[TrackNumber].ContentCompAlgo=Algo; Fill(StreamKind_Last, StreamPos_Last, "MuxingMode", Mk_ContentCompAlgo(Algo), Unlimited, true, true); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Compression_ContentCompSettings() { //Parsing Skip_XX(Element_Size, "Data"); FILLING_BEGIN(); Stream[TrackNumber].ContentCompSettings_Buffer=new int8u[(size_t)Element_Size]; std::memcpy(Stream[TrackNumber].ContentCompSettings_Buffer, Buffer+Buffer_Offset, (size_t)Element_Size); Stream[TrackNumber].ContentCompSettings_Buffer_Size=(size_t)Element_Size; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_CodecName() { Element_Name("CodecName"); //Parsing UTF8_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_CodecPrivate() { Element_Name("CodecPrivate"); //Creating the parser if (Stream.find(TrackNumber)==Stream.end() || Stream[TrackNumber].Parser==NULL) { if (Stream.find(TrackNumber)==Stream.end() || Retrieve(Stream[TrackNumber].StreamKind, Stream[TrackNumber].StreamPos, "CodecID").empty()) { //Codec not already known, saving CodecPrivate if (CodecPrivate) delete[] CodecPrivate; //CodecPrivate=NULL. CodecPrivate_Size=(size_t)Element_Size; CodecPrivate=new int8u[(size_t)Element_Size]; std::memcpy(CodecPrivate, Buffer+Buffer_Offset, (size_t)Element_Size); return; } if (Stream[TrackNumber].StreamKind==Stream_Audio && Retrieve(Stream_Audio, Stream[TrackNumber].StreamPos, Audio_CodecID)==__T("A_MS/ACM")) Segment_Tracks_TrackEntry_CodecPrivate_auds(); else if (Stream[TrackNumber].StreamKind==Stream_Video && Retrieve(Stream_Video, Stream[TrackNumber].StreamPos, Video_CodecID)==__T("V_MS/VFW/FOURCC")) Segment_Tracks_TrackEntry_CodecPrivate_vids(); else if (Element_Size>0) Skip_XX(Element_Size, "Unknown"); return; } //Parsing Open_Buffer_Continue(Stream[TrackNumber].Parser); //Filling if (Stream[TrackNumber].Parser->Status[IsFinished]) //Can be finnished here... { Stream[TrackNumber].Searching_Payload=false; Stream_Count--; } //In case of problem Element_Show(); } //-------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_CodecPrivate_auds() { Element_Info1("Copy of auds"); //Parsing int32u SamplesPerSec; int16u FormatTag, Channels, BitsPerSample; Get_L2 (FormatTag, "FormatTag"); Get_L2 (Channels, "Channels"); Get_L4 (SamplesPerSec, "SamplesPerSec"); Get_L4 (AvgBytesPerSec, "AvgBytesPerSec"); Skip_L2( "BlockAlign"); Get_L2 (BitsPerSample, "BitsPerSample"); //Filling FILLING_BEGIN(); InfoCodecID_Format_Type=InfoCodecID_Format_Riff; CodecID.From_Number(FormatTag, 16); CodecID_Fill(CodecID, Stream_Audio, StreamPos_Last, InfoCodecID_Format_Riff); Fill(Stream_Audio, StreamPos_Last, Audio_Codec, CodecID, true); //May be replaced by codec parser Fill(Stream_Audio, StreamPos_Last, Audio_Codec_CC, CodecID); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Channels!=5?Channels:6, 10, true); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, SamplesPerSec, 10, true); Fill(Stream_Audio, StreamPos_Last, Audio_BitRate, AvgBytesPerSec*8, 10, true); if (BitsPerSample) Fill(Stream_Audio, StreamPos_Last, Audio_BitDepth, BitsPerSample); CodecID_Manage(); if (TrackNumber!=(int64u)-1) Stream[TrackNumber].AvgBytesPerSec=AvgBytesPerSec; FILLING_END(); //Options if (Element_Offset+2>Element_Size) return; //No options //Parsing int16u Option_Size; Get_L2 (Option_Size, "cbSize"); //Filling if (Option_Size>0) { if (FormatTag==0xFFFE) //Extensible Wave Segment_Tracks_TrackEntry_CodecPrivate_auds_ExtensibleWave(); else Skip_XX(Option_Size, "Unknown"); } } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_CodecPrivate_auds_ExtensibleWave() { //Parsing int128u SubFormat; int32u ChannelMask; Skip_L2( "ValidBitsPerSample / SamplesPerBlock"); Get_L4 (ChannelMask, "ChannelMask"); Get_GUID(SubFormat, "SubFormat"); FILLING_BEGIN(); if ((SubFormat.hi&0xFFFFFFFFFFFF0000LL)==0x0010000000000000LL && SubFormat.lo==0x800000AA00389B71LL) { CodecID_Fill(Ztring().From_Number((int16u)SubFormat.hi, 16), Stream_Audio, StreamPos_Last, InfoCodecID_Format_Riff); Fill(Stream_Audio, StreamPos_Last, Audio_CodecID, Ztring().From_GUID(SubFormat), true); Fill(Stream_Audio, StreamPos_Last, Audio_Codec, MediaInfoLib::Config.Codec_Get(Ztring().From_Number((int16u)SubFormat.hi, 16)), true); //Creating the parser #if defined(MEDIAINFO_PCM_YES) if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Ztring().From_Number((int16u)SubFormat.hi, 16))==__T("PCM")) { //Creating the parser File_Pcm MI; MI.Frame_Count_Valid=0; MI.Codec=Ztring().From_Number((int16u)SubFormat.hi, 16); //Parsing Open_Buffer_Init(&MI); Open_Buffer_Continue(&MI, 0); //Filling Finish(&MI); Merge(MI, StreamKind_Last, 0, StreamPos_Last); } #endif } else { CodecID_Fill(Ztring().From_GUID(SubFormat), Stream_Audio, StreamPos_Last, InfoCodecID_Format_Riff); } Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions, ExtensibleWave_ChannelMask(ChannelMask)); Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions_String2, ExtensibleWave_ChannelMask2(ChannelMask)); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_CodecPrivate_vids() { Element_Info1("Copy of vids"); //Parsing int32u Width, Height, Compression; int16u Resolution; Skip_L4( "Size"); Get_L4 (Width, "Width"); Get_L4 (Height, "Height"); Skip_L2( "Planes"); Get_L2 (Resolution, "BitCount"); Get_C4 (Compression, "Compression"); Skip_L4( "SizeImage"); Skip_L4( "XPelsPerMeter"); Skip_L4( "YPelsPerMeter"); Skip_L4( "ClrUsed"); Skip_L4( "ClrImportant"); FILLING_BEGIN(); Ztring Codec; if (((Compression&0x000000FF)>=0x00000020 && (Compression&0x000000FF)<=0x0000007E && (Compression&0x0000FF00)>=0x00002000 && (Compression&0x0000FF00)<=0x00007E00 && (Compression&0x00FF0000)>=0x00200000 && (Compression&0x00FF0000)<=0x007E0000 && (Compression&0xFF000000)>=0x20000000 && (Compression&0xFF000000)<=0x7E000000) || Compression==0x00000000 ) //Sometimes this value is wrong, we have to test this { //Filling InfoCodecID_Format_Type=InfoCodecID_Format_Riff; CodecID.From_CC4(Compression); if (Compression==0x00000000) { Fill(Stream_Video, StreamPos_Last, Video_Format, "RGB", Unlimited, true, true); Fill(Stream_Video, StreamPos_Last, Video_Codec, "RGB", Unlimited, true, true); //Raw RGB, not handled by automatic codec mapping } else { CodecID_Fill(CodecID, Stream_Video, StreamPos_Last, InfoCodecID_Format_Riff); Fill(Stream_Video, StreamPos_Last, Video_Codec, CodecID, true); //FormatTag, may be replaced by codec parser Fill(Stream_Video, StreamPos_Last, Video_Codec_CC, CodecID); //FormatTag } Fill(Stream_Video, StreamPos_Last, Video_Width, Width, 10, true); Fill(Stream_Video, StreamPos_Last, Video_Height, Height, 10, true); if (Resolution==32 && Compression==0x74736363) //tscc Fill(StreamKind_Last, StreamPos_Last, "BitDepth", 8); else if (Compression==0x44495633) //DIV3 Fill(StreamKind_Last, StreamPos_Last, "BitDepth", 8); else if (Compression==0x44585342) //DXSB Fill(StreamKind_Last, StreamPos_Last, "BitDepth", Resolution); else if (Resolution>16 && MediaInfoLib::Config.CodecID_Get(StreamKind_Last, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_ColorSpace).find(__T("RGBA"))!=std::string::npos) //RGB codecs Fill(StreamKind_Last, StreamPos_Last, "BitDepth", Resolution/4); else if (Compression==0x00000000 //RGB || MediaInfoLib::Config.CodecID_Get(StreamKind_Last, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_ColorSpace).find(__T("RGB"))!=std::string::npos) //RGB codecs { if (Resolution==32) { Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Format), "RGBA", Unlimited, true, true); Fill(StreamKind_Last, StreamPos_Last, "BitDepth", Resolution/4); //With Alpha } else Fill(StreamKind_Last, StreamPos_Last, "BitDepth", Resolution<=16?8:(Resolution/3)); //indexed or normal } else if (Compression==0x56503632 //VP62 || MediaInfoLib::Config.CodecID_Get(StreamKind_Last, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_Format)==__T("H.263") //H.263 || MediaInfoLib::Config.CodecID_Get(StreamKind_Last, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_Format)==__T("VC-1")) //VC-1 Fill(StreamKind_Last, StreamPos_Last, "BitDepth", Resolution/3); } //Creating the parser CodecID_Manage(); FILLING_END(); if (Data_Remain()) { Element_Begin1("Private data"); if (Stream[TrackNumber].Parser) Open_Buffer_Continue(Stream[TrackNumber].Parser); else Skip_XX(Data_Remain(), "Unknown"); Element_End0(); } } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_DefaultDuration() { Element_Name("DefaultDuration"); //Parsing int64u UInteger=UInteger_Get(); FILLING_BEGIN(); Stream[TrackNumber].TrackDefaultDuration=UInteger; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_FlagDefault() { Element_Name("FlagDefault"); //Parsing int64u UInteger=UInteger_Get(); FILLING_BEGIN(); Stream[TrackNumber].Default=UInteger?true:false; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_FlagEnabled() { Element_Name("FlagEnabled"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_FlagForced() { Element_Name("FlagForced"); //Parsing int64u UInteger=UInteger_Get(); FILLING_BEGIN(); Stream[TrackNumber].Forced=UInteger?true:false; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_FlagLacing() { Element_Name("FlagLacing"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_Language() { Element_Name("Language"); //Parsing Ztring Data; Get_Local(Element_Size, Data, "Data"); Element_Info1(Data); FILLING_BEGIN(); Fill(StreamKind_Last, StreamPos_Last, "Language", Data, true); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_MaxBlockAdditionID() { Element_Name("MaxBlockAdditionID"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_MaxCache() { Element_Name("MaxCache"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_MinCache() { Element_Name("MinCache"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_Name() { Element_Name("Name"); //Parsing Ztring Data; Get_UTF8(Element_Size, Data, "Data"); Element_Info1(Data); FILLING_BEGIN(); Fill(StreamKind_Last, StreamPos_Last, "Title", Data); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_TrackNumber() { Element_Name("TrackNumber"); //Parsing TrackNumber=UInteger_Get(); FILLING_BEGIN(); Fill(StreamKind_Last, StreamPos_Last, General_ID, TrackNumber); if (StreamKind_Last!=Stream_Max) { Stream[TrackNumber].StreamKind=StreamKind_Last; Stream[TrackNumber].StreamPos=StreamPos_Last; } if (TrackVideoDisplayWidth && TrackVideoDisplayHeight) Stream[TrackNumber].DisplayAspectRatio=((float)TrackVideoDisplayWidth)/(float)TrackVideoDisplayHeight; if (AvgBytesPerSec) Stream[TrackNumber].AvgBytesPerSec=AvgBytesPerSec; CodecID_Manage(); CodecPrivate_Manage(); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_TrackTimecodeScale() { Element_Name("TrackTimecodeScale"); Float_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_TrackType() { Element_Name("TrackType"); //Parsing int64u UInteger=UInteger_Get(); //Filling FILLING_BEGIN(); TrackType=UInteger; switch(UInteger) { case 0x01 : Stream_Prepare(Stream_Video); break; case 0x02 : Stream_Prepare(Stream_Audio); break; case 0x11 : Stream_Prepare(Stream_Text ); break; default : ; } if (TrackNumber!=(int64u)-1 && StreamKind_Last!=Stream_Max) { Stream[TrackNumber].StreamKind=StreamKind_Last; Stream[TrackNumber].StreamPos=StreamPos_Last; } CodecID_Manage(); CodecPrivate_Manage(); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_TrackUID() { Element_Name("TrackUID"); //Parsing int64u UInteger=UInteger_Get(); //Filling FILLING_BEGIN(); Fill(StreamKind_Last, StreamPos_Last, General_UniqueID, UInteger); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_Video() { Element_Name("Video"); //Preparing TrackVideoDisplayWidth=0; TrackVideoDisplayHeight=0; } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_Video_AspectRatioType() { Element_Name("AspectRatioType"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_Video_ColourSpace() { Element_Name("ColourSpace"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_Video_DisplayHeight() { Element_Name("DisplayHeight"); //Parsing int64u UInteger=UInteger_Get(); //Filling FILLING_BEGIN(); TrackVideoDisplayHeight=UInteger; if (TrackNumber!=(int64u)-1 && TrackVideoDisplayWidth && TrackVideoDisplayHeight) Stream[TrackNumber].DisplayAspectRatio=((float)TrackVideoDisplayWidth)/(float)TrackVideoDisplayHeight; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_Video_DisplayUnit() { Element_Name("DisplayUnit"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_Video_DisplayWidth() { Element_Name("DisplayWidth"); //Parsing int64u UInteger=UInteger_Get(); //Filling FILLING_BEGIN(); TrackVideoDisplayWidth=UInteger; if (TrackNumber!=(int64u)-1 && TrackVideoDisplayWidth && TrackVideoDisplayHeight) Stream[TrackNumber].DisplayAspectRatio=((float)TrackVideoDisplayWidth)/(float)TrackVideoDisplayHeight; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_Video_FlagInterlaced() { Element_Name("FlagInterlaced"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_Video_FrameRate() { Element_Name("FrameRate"); //Parsing float64 Value=Float_Get(); //Filling FILLING_BEGIN(); Stream[TrackNumber].FrameRate=Value; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_Video_PixelCropBottom() { Element_Name("PixelCropBottom"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_Video_PixelCropLeft() { Element_Name("PixelCropLeft"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_Video_PixelCropRight() { Element_Name("PixelCropRight"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_Video_PixelCropTop() { Element_Name("PixelCropTop"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_Video_PixelHeight() { Element_Name("PixelHeight"); //Parsing int64u UInteger=UInteger_Get(); //Filling FILLING_BEGIN(); Fill(Stream_Video, StreamPos_Last, Video_Height, UInteger, 10, true); if (!TrackVideoDisplayHeight) TrackVideoDisplayHeight=UInteger; //Default value of DisplayHeight is PixelHeight FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_Video_PixelWidth() { Element_Name("PixelWidth"); //Parsing int64u UInteger=UInteger_Get(); //Filling FILLING_BEGIN(); Fill(Stream_Video, StreamPos_Last, Video_Width, UInteger, 10, true); if (!TrackVideoDisplayWidth) TrackVideoDisplayWidth=UInteger; //Default value of DisplayWidth is PixelWidth FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_Video_StereoMode() { Element_Name("StereoMode"); //Parsing int64u UInteger=UInteger_Get(); Element_Info1(Format_Version==2?Mk_StereoMode_v2(UInteger):Mk_StereoMode(UInteger)); //Filling FILLING_BEGIN(); Fill(Stream_Video, StreamPos_Last, Video_MultiView_Count, 2); //Matroska seems to be limited to 2 views Fill(Stream_Video, StreamPos_Last, Video_MultiView_Layout, Format_Version==2?Mk_StereoMode_v2(UInteger):Mk_StereoMode(UInteger)); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_TrackOverlay() { Element_Name("TrackOverlay"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_TrackTranslate() { Element_Name("TrackTranslate"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_TrackTranslate_Codec() { Element_Name("Codec"); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_TrackTranslate_EditionUID() { Element_Name("EditionUID"); //Parsing UInteger_Info(); } //--------------------------------------------------------------------------- void File_Mk::Segment_Tracks_TrackEntry_TrackTranslate_TrackID() { Element_Name("TrackID"); //Parsing UInteger_Info(); } //*************************************************************************** // Data //*************************************************************************** //--------------------------------------------------------------------------- void File_Mk::UInteger_Info() { switch (Element_Size) { case 1 : { Info_B1(Data, "Data"); Element_Info1(Data); return; } case 2 : { Info_B2(Data, "Data"); Element_Info1(Data); return; } case 3 : { Info_B3(Data, "Data"); Element_Info1(Data); return; } case 4 : { Info_B4(Data, "Data"); Element_Info1(Data); return; } case 5 : { Info_B5(Data, "Data"); Element_Info1(Data); return; } case 6 : { Info_B6(Data, "Data"); Element_Info1(Data); return; } case 7 : { Info_B7(Data, "Data"); Element_Info1(Data); return; } case 8 : { Info_B8(Data, "Data"); Element_Info1(Data); return; } case 16: { Info_B16(Data, "Data"); Element_Info1(Data); return; } default : Skip_XX(Element_Size, "Data"); } } //--------------------------------------------------------------------------- int64u File_Mk::UInteger_Get() { switch (Element_Size) { case 1 : { int8u Data; Get_B1 (Data, "Data"); Element_Info1(Data); return Data; } case 2 : { int16u Data; Get_B2 (Data, "Data"); Element_Info1(Data); return Data; } case 3 : { int32u Data; Get_B3 (Data, "Data"); Element_Info1(Data); return Data; } case 4 : { int32u Data; Get_B4 (Data, "Data"); Element_Info1(Data); return Data; } case 5 : { int64u Data; Get_B5 (Data, "Data"); Element_Info1(Data); return Data; } case 6 : { int64u Data; Get_B6 (Data, "Data"); Element_Info1(Data); return Data; } case 7 : { int64u Data; Get_B7 (Data, "Data"); Element_Info1(Data); return Data; } case 8 : { int64u Data; Get_B8 (Data, "Data"); Element_Info1(Data); return Data; } default : Skip_XX(Element_Size, "Data"); return 0; } } //--------------------------------------------------------------------------- int128u File_Mk::UInteger16_Get() { switch (Element_Size) { case 1 : { int8u Data; Get_B1 (Data, "Data"); Element_Info1(Data); return Data; } case 2 : { int16u Data; Get_B2 (Data, "Data"); Element_Info1(Data); return Data; } case 3 : { int32u Data; Get_B3 (Data, "Data"); Element_Info1(Data); return Data; } case 4 : { int32u Data; Get_B4 (Data, "Data"); Element_Info1(Data); return Data; } case 5 : { int64u Data; Get_B5 (Data, "Data"); Element_Info1(Data); return Data; } case 6 : { int64u Data; Get_B6 (Data, "Data"); Element_Info1(Data); return Data; } case 7 : { int64u Data; Get_B7 (Data, "Data"); Element_Info1(Data); return Data; } case 8 : { int64u Data; Get_B8 (Data, "Data"); Element_Info1(Data); return Data; } case 16: { int128u Data; Get_B16(Data, "Data"); Element_Info1(Data); return Data; } default : Skip_XX(Element_Size, "Data"); return 0; } } //--------------------------------------------------------------------------- float64 File_Mk::Float_Get() { switch (Element_Size) { case 4 : { float32 Data; Get_BF4(Data, "Data"); Element_Info1(Data); return Data; } case 8 : { float64 Data; Get_BF8(Data, "Data"); Element_Info1(Data); return Data; } default : Skip_XX(Element_Size, "Data"); return 0.0; } } //--------------------------------------------------------------------------- void File_Mk::Float_Info() { switch (Element_Size) { case 4 : { Info_BF4(Data, "Data"); Element_Info1(Data); return; } case 8 : { Info_BF8(Data, "Data"); Element_Info1(Data); return; } default : Skip_XX(Element_Size, "Data"); return; } } //--------------------------------------------------------------------------- Ztring File_Mk::UTF8_Get() { Ztring Data; Get_UTF8(Element_Size, Data, "Data"); Element_Info1(Data); return Data; } //--------------------------------------------------------------------------- void File_Mk::UTF8_Info() { Info_UTF8(Element_Size, Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- Ztring File_Mk::Local_Get() { Ztring Data; Get_Local(Element_Size, Data, "Data"); Element_Info1(Data); return Data; } //--------------------------------------------------------------------------- void File_Mk::Local_Info() { Info_Local(Element_Size, Data, "Data"); Element_Info1(Data); } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- void File_Mk::CodecID_Manage() { if (TrackType==(int64u)-1 || TrackNumber==(int64u)-1 || CodecID.empty() || Stream[TrackNumber].Parser) return; //Not ready (or not needed) if (Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_CodecID)).empty()) { CodecID_Fill(CodecID, StreamKind_Last, StreamPos_Last, InfoCodecID_Format_Matroska); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec), CodecID); } //Creating the parser #if defined(MEDIAINFO_MPEG4V_YES) || defined(MEDIAINFO_AVC_YES) || defined(MEDIAINFO_HEVC_YES) || defined(MEDIAINFO_VC1_YES) || defined(MEDIAINFO_DIRAC_YES) || defined(MEDIAINFO_MPEGV_YES) || defined(MEDIAINFO_VP8_YES) || defined(MEDIAINFO_OGG_YES) const Ztring &Format=MediaInfoLib::Config.CodecID_Get(StreamKind_Last, InfoCodecID_Format_Type, CodecID, InfoCodecID_Format); #endif if (0); #if defined(MEDIAINFO_MPEG4V_YES) else if (Format==__T("MPEG-4 Visual")) { Stream[TrackNumber].Parser=new File_Mpeg4v; ((File_Mpeg4v*)Stream[TrackNumber].Parser)->FrameIsAlwaysComplete=true; ((File_Mpeg4v*)Stream[TrackNumber].Parser)->Frame_Count_Valid=1; } #endif #if defined(MEDIAINFO_AVC_YES) else if (Format==__T("AVC")) { Stream[TrackNumber].Parser=new File_Avc; ((File_Avc*)Stream[TrackNumber].Parser)->FrameIsAlwaysComplete=true; if (InfoCodecID_Format_Type==InfoCodecID_Format_Matroska) { ((File_Avc*)Stream[TrackNumber].Parser)->MustSynchronize=false; ((File_Avc*)Stream[TrackNumber].Parser)->MustParse_SPS_PPS=true; ((File_Avc*)Stream[TrackNumber].Parser)->SizedBlocks=true; } } #endif #if defined(MEDIAINFO_HEVC_YES) else if (Format==__T("HEVC")) { Stream[TrackNumber].Parser=new File_Hevc; ((File_Hevc*)Stream[TrackNumber].Parser)->FrameIsAlwaysComplete=true; if (InfoCodecID_Format_Type==InfoCodecID_Format_Matroska) { ((File_Hevc*)Stream[TrackNumber].Parser)->MustSynchronize=false; ((File_Hevc*)Stream[TrackNumber].Parser)->MustParse_VPS_SPS_PPS=true; ((File_Hevc*)Stream[TrackNumber].Parser)->MustParse_VPS_SPS_PPS_FromMatroska=true; ((File_Hevc*)Stream[TrackNumber].Parser)->SizedBlocks=true; } } #endif #if defined(MEDIAINFO_VC1_YES) else if (Format==__T("VC-1")) { Stream[TrackNumber].Parser=new File_Vc1; ((File_Vc1*)Stream[TrackNumber].Parser)->FrameIsAlwaysComplete=true; ((File_Vc1*)Stream[TrackNumber].Parser)->Frame_Count_Valid=1; } #endif #if defined(MEDIAINFO_DIRAC_YES) else if (Format==__T("Dirac")) { Stream[TrackNumber].Parser=new File_Dirac; ((File_Dirac*)Stream[TrackNumber].Parser)->Frame_Count_Valid=1; } #endif #if defined(MEDIAINFO_MPEGV_YES) else if (Format==__T("MPEG Video")) { Stream[TrackNumber].Parser=new File_Mpegv; ((File_Mpegv*)Stream[TrackNumber].Parser)->FrameIsAlwaysComplete=true; ((File_Mpegv*)Stream[TrackNumber].Parser)->Frame_Count_Valid=1; } #endif #if defined(MEDIAINFO_VP8_YES) else if (Format==__T("VP8")) { Stream[TrackNumber].Parser=new File_Vp8; } #endif #if defined(MEDIAINFO_OGG_YES) else if (Format==__T("Theora") || Format==__T("Vorbis")) { Stream[TrackNumber].Parser=new File_Ogg; Stream[TrackNumber].Parser->MustSynchronize=false; ((File_Ogg*)Stream[TrackNumber].Parser)->XiphLacing=true; } #endif #if defined(MEDIAINFO_RM_YES) else if (CodecID.find(__T("V_REAL/"))==0) { Stream[TrackNumber].Parser=new File_Rm; ((File_Rm*)Stream[TrackNumber].Parser)->FromMKV_StreamType=Stream_Video; } #endif #if defined(MEDIAINFO_AC3_YES) else if (Format==__T("AC-3") || Format==__T("E-AC-3") || Format==__T("TrueHD")) { Stream[TrackNumber].Parser=new File_Ac3; ((File_Ac3*)Stream[TrackNumber].Parser)->Frame_Count_Valid=2; } #endif #if defined(MEDIAINFO_DTS_YES) else if (Format==__T("DTS")) { Stream[TrackNumber].Parser=new File_Dts; ((File_Dts*)Stream[TrackNumber].Parser)->Frame_Count_Valid=2; } #endif #if defined(MEDIAINFO_AAC_YES) else if (CodecID==(__T("A_AAC"))) { Stream[TrackNumber].Parser=new File_Aac; ((File_Aac*)Stream[TrackNumber].Parser)->Mode=File_Aac::Mode_AudioSpecificConfig; } #endif #if defined(MEDIAINFO_AAC_YES) else if (CodecID.find(__T("A_AAC/"))==0) { Ztring Profile; int8u audioObjectType=0, Version=0, SBR=2, PS=2; if (CodecID==__T("A_AAC/MPEG2/MAIN")) {Version=2; Profile=__T("Main"); audioObjectType=1;} else if (CodecID==__T("A_AAC/MPEG2/LC")) {Version=2; Profile=__T("LC"); audioObjectType=2; SBR=0;} else if (CodecID==__T("A_AAC/MPEG2/LC/SBR")) {Version=2; Profile=__T("HE-AAC / LC"); audioObjectType=2; SBR=1;} else if (CodecID==__T("A_AAC/MPEG2/SSR")) {Version=2; Profile=__T("SSR"); audioObjectType=3;} else if (CodecID==__T("A_AAC/MPEG4/MAIN")) {Version=4; Profile=__T("Main"); audioObjectType=1;} else if (CodecID==__T("A_AAC/MPEG4/LC")) {Version=4; Profile=__T("LC"); audioObjectType=2; SBR=0;} else if (CodecID==__T("A_AAC/MPEG4/LC/SBR")) {Version=4; Profile=__T("HE-AAC / LC"); audioObjectType=2; SBR=1; PS=0;} else if (CodecID==__T("A_AAC/MPEG4/LC/SBR/PS")){Version=4; Profile=__T("HE-AACv2 / HE-AAC / LC"); audioObjectType=2; SBR=1; PS=1;} else if (CodecID==__T("A_AAC/MPEG4/SSR")) {Version=4; Profile=__T("SSR"); audioObjectType=3;} else if (CodecID==__T("A_AAC/MPEG4/LTP")) {Version=4; Profile=__T("LTP"); audioObjectType=4;} else if (CodecID==__T("raac")) { Profile=__T("LC"); audioObjectType=2;} else if (CodecID==__T("racp")) { Profile=__T("HE-AAC / LC"); audioObjectType=2; SBR=1; PS=0;} if (Version>0) Fill(Stream_Audio, StreamPos_Last, Audio_Format_Version, Version==2?"Version 2":"Version 4"); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Profile, Profile); if (SBR!=2) Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings_SBR, SBR?"Yes":"No"); if (PS!=2) Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings_PS, PS?"Yes":"No"); int32u sampling_frequency=Retrieve(Stream_Audio, StreamPos_Last, Audio_SamplingRate).To_int32u(); Stream[TrackNumber].Parser=new File_Aac; ((File_Aac*)Stream[TrackNumber].Parser)->Mode=File_Aac::Mode_AudioSpecificConfig; ((File_Aac*)Stream[TrackNumber].Parser)->AudioSpecificConfig_OutOfBand(sampling_frequency, audioObjectType, SBR==1?true:false, PS==1?true:false, SBR==1?true:false, PS==1?true:false); } #endif #if defined(MEDIAINFO_AAC_YES) else if (Format==(__T("AAC"))) { Stream[TrackNumber].Parser=new File_Aac; ((File_Aac*)Stream[TrackNumber].Parser)->Mode=File_Aac::Mode_ADTS; } #endif #if defined(MEDIAINFO_MPEGA_YES) else if (Format==__T("MPEG Audio")) { Stream[TrackNumber].Parser=new File_Mpega; } #endif #if defined(MEDIAINFO_FLAC_YES) else if (Format==__T("Flac")) { Stream[TrackNumber].Parser=new File_Flac; } #endif #if defined(MEDIAINFO_OPUS_YES) else if (CodecID.find(__T("A_OPUS"))==0) //http://wiki.xiph.org/MatroskaOpus { Stream[TrackNumber].Parser=new File_Opus; } #endif #if defined(MEDIAINFO_WVPK_YES) else if (Format==__T("WavPack")) { Stream[TrackNumber].Parser=new File_Wvpk; ((File_Wvpk*)Stream[TrackNumber].Parser)->FromMKV=true; } #endif #if defined(MEDIAINFO_TTA_YES) else if (Format==__T("TTA")) { //Stream[TrackNumber].Parser=new File_Tta; //Parser is not needed, because header is useless and dropped (the parser analyses only the header) } #endif #if defined(MEDIAINFO_PCM_YES) else if (Format==__T("PCM")) { Stream[TrackNumber].Parser=new File_Pcm; ((File_Pcm*)Stream[TrackNumber].Parser)->Codec=CodecID; } #endif #if defined(MEDIAINFO_RM_YES) else if (CodecID.find(__T("A_REAL/"))==0) { Stream[TrackNumber].Parser=new File_Rm; ((File_Rm*)Stream[TrackNumber].Parser)->FromMKV_StreamType=Stream_Audio; } #endif Open_Buffer_Init(Stream[TrackNumber].Parser); CodecID.clear(); } //--------------------------------------------------------------------------- void File_Mk::CodecPrivate_Manage() { if (CodecPrivate==NULL || TrackNumber==(int64u)-1 || TrackType==(int64u)-1) return; //Not ready (or not needed) //Codec Private is already here, so we can parse it now const int8u* Buffer_Save=Buffer; size_t Buffer_Offset_Save=Buffer_Offset; size_t Buffer_Size_Save=Buffer_Size; int64u Element_Size_Save=Element_Size; Buffer=CodecPrivate; Buffer_Offset=0; Buffer_Size=CodecPrivate_Size; Element_Offset=0; Element_Size=Buffer_Size; Segment_Tracks_TrackEntry_CodecPrivate(); Buffer=Buffer_Save; Buffer_Offset=Buffer_Offset_Save; Buffer_Size=Buffer_Size_Save; Element_Size=Element_Size_Save; Element_Offset=Element_Size_Save; delete[] CodecPrivate; CodecPrivate=NULL; CodecPrivate_Size=0; Element_Name("(Multiple info)"); } } //NameSpace #endif //MEDIAINFO_MK_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Mk.h100777 0 0 35434 12226004262 15051 0/* 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 Matroska files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_MatroskaH #define MediaInfo_File_MatroskaH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Classe File_Matroska //*************************************************************************** class File_Mk : public File__Analyze { protected : //Streams management void Streams_Finish(); public : File_Mk(); ~File_Mk(); private : //Buffer void Header_Parse(); void Data_Parse(); //Elements void Zero(); void CRC32(); void Void(); void Ebml(); void Ebml_Version(); void Ebml_ReadVersion(); void Ebml_MaxIDLength(); void Ebml_MaxSizeLength(); void Ebml_DocType(); void Ebml_DocTypeVersion(); void Ebml_DocTypeReadVersion(); void Segment(); void Segment_Attachements(); void Segment_Attachements_AttachedFile(); void Segment_Attachements_AttachedFile_FileData(); void Segment_Attachements_AttachedFile_FileDescription(); void Segment_Attachements_AttachedFile_FileName(); void Segment_Attachements_AttachedFile_FileMimeType(); void Segment_Attachements_AttachedFile_FileReferral(); void Segment_Attachements_AttachedFile_FileUID(); void Segment_Chapters(); void Segment_Chapters_EditionEntry(); void Segment_Chapters_EditionEntry_ChapterAtom(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessCodecID(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessCommand(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessCommand_ChapProcessData(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessCommand_ChapProcessTime(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapProcess_ChapProcessPrivate(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapterDisplay(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapterDisplay_ChapCountry(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapterDisplay_ChapLanguage(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapterDisplay_ChapString(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapterFlagHidden(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapterFlagEnabled(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapterPhysicalEquiv(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapterSegmentEditionUID(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapterSegmentUID(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapterTimeEnd(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapterTimeStart(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapterTrack(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapterTrack_ChapterTrackNumber(); void Segment_Chapters_EditionEntry_ChapterAtom_ChapterUID(); void Segment_Chapters_EditionEntry_EditionFlagDefault(); void Segment_Chapters_EditionEntry_EditionFlagHidden(); void Segment_Chapters_EditionEntry_EditionFlagOrdered(); void Segment_Chapters_EditionEntry_EditionUID(); void Segment_Cluster(); void Segment_Cluster_BlockGroup(); void Segment_Cluster_BlockGroup_Block(); void Segment_Cluster_BlockGroup_BlockAdditions(); void Segment_Cluster_BlockGroup_BlockAdditions_BlockMore(); void Segment_Cluster_BlockGroup_BlockAdditions_BlockMore_BlockAddID(); void Segment_Cluster_BlockGroup_BlockAdditions_BlockMore_BlockAdditional(); void Segment_Cluster_BlockGroup_BlockDuration(); void Segment_Cluster_BlockGroup_ReferenceBlock(); void Segment_Cluster_BlockGroup_ReferencePriority(); void Segment_Cluster_BlockGroup_Slices(); void Segment_Cluster_BlockGroup_Slices_TimeSlice(); void Segment_Cluster_BlockGroup_Slices_TimeSlice_Duration(); void Segment_Cluster_BlockGroup_Slices_TimeSlice_LaceNumber(); void Segment_Cluster_Position(); void Segment_Cluster_PrevSize(); void Segment_Cluster_SilentTracks(); void Segment_Cluster_SilentTracks_SilentTrackNumber(); void Segment_Cluster_SimpleBlock(); void Segment_Cluster_Timecode(); void Segment_Cues(); void Segment_Cues_CuePoint(); void Segment_Cues_CuePoint_CueTime(); void Segment_Cues_CuePoint_CueTrackPositions(); void Segment_Cues_CuePoint_CueTrackPositions_CueTrack(); void Segment_Cues_CuePoint_CueTrackPositions_CueClusterPosition(); void Segment_Cues_CuePoint_CueTrackPositions_CueBlockNumber(); void Segment_Info(); void Segment_Info_ChapterTranslate(); void Segment_Info_ChapterTranslate_ChapterTranslateCodec(); void Segment_Info_ChapterTranslate_ChapterTranslateEditionUID(); void Segment_Info_ChapterTranslate_ChapterTranslateID(); void Segment_Info_DateUTC(); void Segment_Info_Duration(); void Segment_Info_MuxingApp(); void Segment_Info_NextFilename(); void Segment_Info_NextUID(); void Segment_Info_PrevFilename(); void Segment_Info_PrevUID(); void Segment_Info_SegmentFamily(); void Segment_Info_SegmentFilename(); void Segment_Info_SegmentUID(); void Segment_Info_TimecodeScale(); void Segment_Info_Title(); void Segment_Info_WritingApp(); void Segment_SeekHead(); void Segment_SeekHead_Seek(); void Segment_SeekHead_Seek_SeekID(); void Segment_SeekHead_Seek_SeekPosition(); void Segment_Tags(); void Segment_Tags_Tag(); void Segment_Tags_Tag_SimpleTag(); void Segment_Tags_Tag_SimpleTag_TagBinary(); void Segment_Tags_Tag_SimpleTag_TagDefault(); void Segment_Tags_Tag_SimpleTag_TagLanguage(); void Segment_Tags_Tag_SimpleTag_TagName(); void Segment_Tags_Tag_SimpleTag_TagString(); void Segment_Tags_Tag_Targets(); void Segment_Tags_Tag_Targets_AttachmentUID(); void Segment_Tags_Tag_Targets_ChapterUID(); void Segment_Tags_Tag_Targets_EditionUID(); void Segment_Tags_Tag_Targets_TargetType(); void Segment_Tags_Tag_Targets_TargetTypeValue(); void Segment_Tags_Tag_Targets_TrackUID(); void Segment_Tracks(); void Segment_Tracks_TrackEntry(); void Segment_Tracks_TrackEntry_AttachmentLink(); void Segment_Tracks_TrackEntry_Audio(); void Segment_Tracks_TrackEntry_Audio_BitDepth(); void Segment_Tracks_TrackEntry_Audio_Channels(); void Segment_Tracks_TrackEntry_Audio_OutputSamplingFrequency(); void Segment_Tracks_TrackEntry_Audio_SamplingFrequency(); void Segment_Tracks_TrackEntry_CodecDecodeAll(); void Segment_Tracks_TrackEntry_CodecID(); void Segment_Tracks_TrackEntry_ContentEncodings() {}; void Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding() {}; void Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Order() {UInteger_Info();}; void Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Scope() {UInteger_Info();}; void Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Type() {UInteger_Info();}; void Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Compression(); void Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Compression_ContentCompAlgo(); void Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Compression_ContentCompSettings(); void Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption() {}; void Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentEncAlgo() {UInteger_Info();}; void Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentEncKeyID() {Skip_XX(Element_Size, "Data");}; void Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentSignature() {Skip_XX(Element_Size, "Data");}; void Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentSigKeyID() {Skip_XX(Element_Size, "Data");}; void Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentSigAlgo() {UInteger_Info();}; void Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Encryption_ContentSigHashAlgo() {UInteger_Info();}; void Segment_Tracks_TrackEntry_CodecName(); void Segment_Tracks_TrackEntry_CodecPrivate(); void Segment_Tracks_TrackEntry_CodecPrivate_auds(); void Segment_Tracks_TrackEntry_CodecPrivate_auds_ExtensibleWave(); void Segment_Tracks_TrackEntry_CodecPrivate_vids(); void Segment_Tracks_TrackEntry_DefaultDuration(); void Segment_Tracks_TrackEntry_FlagDefault(); void Segment_Tracks_TrackEntry_FlagEnabled(); void Segment_Tracks_TrackEntry_FlagForced(); void Segment_Tracks_TrackEntry_FlagLacing(); void Segment_Tracks_TrackEntry_Language(); void Segment_Tracks_TrackEntry_MaxBlockAdditionID(); void Segment_Tracks_TrackEntry_MaxCache(); void Segment_Tracks_TrackEntry_MinCache(); void Segment_Tracks_TrackEntry_Name(); void Segment_Tracks_TrackEntry_TrackNumber(); void Segment_Tracks_TrackEntry_TrackTimecodeScale(); void Segment_Tracks_TrackEntry_TrackType(); void Segment_Tracks_TrackEntry_TrackUID(); void Segment_Tracks_TrackEntry_Video(); void Segment_Tracks_TrackEntry_Video_AspectRatioType(); void Segment_Tracks_TrackEntry_Video_ColourSpace(); void Segment_Tracks_TrackEntry_Video_DisplayHeight(); void Segment_Tracks_TrackEntry_Video_DisplayUnit(); void Segment_Tracks_TrackEntry_Video_DisplayWidth(); void Segment_Tracks_TrackEntry_Video_FlagInterlaced(); void Segment_Tracks_TrackEntry_Video_FrameRate(); void Segment_Tracks_TrackEntry_Video_PixelCropBottom(); void Segment_Tracks_TrackEntry_Video_PixelCropLeft(); void Segment_Tracks_TrackEntry_Video_PixelCropRight(); void Segment_Tracks_TrackEntry_Video_PixelCropTop(); void Segment_Tracks_TrackEntry_Video_PixelHeight(); void Segment_Tracks_TrackEntry_Video_PixelWidth(); void Segment_Tracks_TrackEntry_Video_StereoMode(); void Segment_Tracks_TrackEntry_Video_StereoModeBuggy() {Segment_Tracks_TrackEntry_Video_StereoMode();} void Segment_Tracks_TrackEntry_TrackOverlay(); void Segment_Tracks_TrackEntry_TrackTranslate(); void Segment_Tracks_TrackEntry_TrackTranslate_Codec(); void Segment_Tracks_TrackEntry_TrackTranslate_EditionUID(); void Segment_Tracks_TrackEntry_TrackTranslate_TrackID(); struct stream { std::vector TimeCodes; int64u TimeCode_Start; File__Analyze* Parser; stream_t StreamKind; size_t StreamPos; size_t PacketCount; int32u AvgBytesPerSec; //Only used by x_MS/* codecIDs float32 DisplayAspectRatio; float64 FrameRate; bool Searching_Payload; bool Searching_TimeStamps; bool Searching_TimeStamp_Start; bool Default; bool Forced; int64u ContentCompAlgo; size_t ContentCompSettings_Buffer_Size; int8u* ContentCompSettings_Buffer; std::map Infos; int64u TrackDefaultDuration; std::map Segment_Cluster_BlockGroup_BlockDuration_Counts; stream() { TimeCode_Start=(int64u)-1; Parser=NULL; StreamKind=Stream_Max; StreamPos=0; PacketCount=0; AvgBytesPerSec=0; DisplayAspectRatio=0; FrameRate=0; Searching_Payload=false; Searching_TimeStamps=false; Searching_TimeStamp_Start=false; Default=true; Forced=false; ContentCompAlgo=(int32u)-1; ContentCompSettings_Buffer_Size=0; ContentCompSettings_Buffer=NULL; TrackDefaultDuration=0; } ~stream() { delete Parser; //Parser=NULL; delete[] ContentCompSettings_Buffer; //ContentCompSettings_Buffer=NULL; } }; std::map Stream; size_t Stream_Count; //Data int64u UInteger_Get(); int128u UInteger16_Get(); void UInteger_Info(); float64 Float_Get(); void Float_Info(); Ztring UTF8_Get(); void UTF8_Info(); Ztring Local_Get(); void Local_Info(); //Temp - TrackEntry int8u* CodecPrivate; size_t CodecPrivate_Size; void CodecPrivate_Manage(); Ztring CodecID; infocodecid_format_t InfoCodecID_Format_Type; void CodecID_Manage(); int64u TrackType; //Temp std::vector AttachedFiles; int64u Format_Version; int64u TimecodeScale; float64 Duration; int64u TrackNumber; int64u TrackVideoDisplayWidth; int64u TrackVideoDisplayHeight; int32u AvgBytesPerSec; int64u Segment_Cluster_TimeCode_Value; bool Cluster_AlreadyParsed; //Chapters struct chapterdisplay { Ztring ChapLanguage; Ztring ChapString; }; struct chapteratom { int64u ChapterTimeStart; std::vector ChapterDisplays; chapteratom() { ChapterTimeStart=(int64u)-1; } }; struct editionentry { std::vector ChapterAtoms; }; std::vector EditionEntries; size_t EditionEntries_Pos; size_t ChapterAtoms_Pos; size_t ChapterDisplays_Pos; int64u Segment_Offset_Begin; int64u Segment_Offset_End; std::vector Segment_Seeks; int64u Segment_Tag_TrackUID; std::vector Segment_Tag_SimpleTag_TagNames; int64u Segment_Cluster_BlockGroup_BlockDuration_Value; int64u Segment_Cluster_BlockGroup_BlockDuration_TrackNumber; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Mpeg4.cpp100777 0 0 335273 12253120644 16040 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Main part // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #ifdef MEDIAINFO_MPEG4_YES //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Mpeg4.h" #include "MediaInfo/Multiple/File_Mpeg4_Descriptors.h" #if defined(MEDIAINFO_MPEGPS_YES) #include "MediaInfo/Multiple/File_MpegPs.h" #endif #include "ZenLib/FileName.h" #include "MediaInfo/MediaInfo_Internal.h" #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events.h" #endif //MEDIAINFO_EVENTS #ifdef MEDIAINFO_REFERENCES_YES #include "MediaInfo/Multiple/File__ReferenceFilesHelper.h" #endif //MEDIAINFO_REFERENCES_YES #include "ZenLib/Format/Http/Http_Utils.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Const //*************************************************************************** namespace Elements { const int64u free=0x66726565; const int64u mdat=0x6D646174; const int64u moov_meta______=0x2D2D2D2D; const int64u moov_meta___ART=0xA9415254; const int64u moov_meta___alb=0xA9616C62; const int64u moov_meta___ard=0xA9617264; const int64u moov_meta___arg=0xA9617267; const int64u moov_meta___aut=0xA9617574; const int64u moov_meta___con=0xA963696E; const int64u moov_meta___cmt=0xA9636D74; const int64u moov_meta___cpy=0xA9637079; const int64u moov_meta___day=0xA9646179; const int64u moov_meta___des=0xA9646573; const int64u moov_meta___dir=0xA9646972; const int64u moov_meta___dis=0xA9646973; const int64u moov_meta___edl=0xA965646C; const int64u moov_meta___enc=0xA9656E63; const int64u moov_meta___fmt=0xA9666D74; const int64u moov_meta___gen=0xA967656E; const int64u moov_meta___grp=0xA9677270; const int64u moov_meta___hos=0xA9686F73; const int64u moov_meta___inf=0xA9696E66; const int64u moov_meta___key=0xA96B6579; const int64u moov_meta___lyr=0xA96C7972; const int64u moov_meta___mak=0xA96D616B; const int64u moov_meta___mod=0xA96D6F64; const int64u moov_meta___nam=0xA96E616D; const int64u moov_meta___ope=0xA96F7065; const int64u moov_meta___prd=0xA9707264; const int64u moov_meta___PRD=0xA9505244; const int64u moov_meta___prf=0xA9707266; const int64u moov_meta___req=0xA9726571; const int64u moov_meta___sne=0xA9736E65; const int64u moov_meta___sol=0xA9736F6C; const int64u moov_meta___src=0xA9737263; const int64u moov_meta___st3=0xA9737403; const int64u moov_meta___swr=0xA9737772; const int64u moov_meta___too=0xA9746F6F; const int64u moov_meta___url=0xA975726C; const int64u moov_meta___wrn=0xA977726E; const int64u moov_meta___wrt=0xA9777274; const int64u moov_meta___xpd=0xA9787064; const int64u moov_meta__aART=0x61415254; const int64u moov_meta__akID=0x616B4944; const int64u moov_meta__albm=0x616C626D; const int64u moov_meta__apID=0x61704944; const int64u moov_meta__atID=0x61744944; const int64u moov_meta__auth=0x61757468; const int64u moov_meta__catg=0x63617467; const int64u moov_meta__cnID=0x636E4944; const int64u moov_meta__cpil=0x6370696C; const int64u moov_meta__cprt=0x63707274; const int64u moov_meta__covr=0x636F7672; const int64u moov_meta__desc=0x64657363; const int64u moov_meta__disk=0x6469736B; const int64u moov_meta__dscp=0x64736370; const int64u moov_meta__egid=0x65676964; const int64u moov_meta__flvr=0x666C7672; const int64u moov_meta__gnre=0x676E7265; const int64u moov_meta__geID=0x67654944; const int64u moov_meta__grup=0x67727570; const int64u moov_meta__hdvd=0x68647664; const int64u moov_meta__itnu=0x69746E75; const int64u moov_meta__keyw=0x6B657977; const int64u moov_meta__ldes=0x6C646573; const int64u moov_meta__name=0x6E616D65; const int64u moov_meta__pcst=0x70637374; const int64u moov_meta__perf=0x70657266; const int64u moov_meta__pgap=0x70676170; const int64u moov_meta__plID=0x706C4944; const int64u moov_meta__purd=0x70757264; const int64u moov_meta__purl=0x7075726C; const int64u moov_meta__rate=0x72617465; const int64u moov_meta__rndu=0x726E6475; const int64u moov_meta__rpdu=0x72706475; const int64u moov_meta__rtng=0x72746E67; const int64u moov_meta__sdes=0x73646573; const int64u moov_meta__sfID=0x73664944; const int64u moov_meta__soaa=0x736F6161; const int64u moov_meta__soal=0x736F616C; const int64u moov_meta__soar=0x736F6172; const int64u moov_meta__soco=0x736F636F; const int64u moov_meta__sonm=0x736F6E6D; const int64u moov_meta__sosn=0x736F736E; const int64u moov_meta__stik=0x7374696B; const int64u moov_meta__titl=0x7469746C; const int64u moov_meta__tool=0x746F6F6C; const int64u moov_meta__trkn=0x74726B6E; const int64u moov_meta__tmpo=0x746D706F; const int64u moov_meta__tven=0x7476656E; const int64u moov_meta__tves=0x74766573; const int64u moov_meta__tvnn=0x74766E6E; const int64u moov_meta__tvsh=0x74767368; const int64u moov_meta__tvsn=0x7476736E; const int64u moov_meta__xid_=0x78696420; const int64u moov_meta__year=0x79656172; const int64u moov_meta__yyrc=0x79797263; const int64u skip=0x736B6970; const int64u wide=0x77696465; } //--------------------------------------------------------------------------- Ztring Mpeg4_Encoded_Library(int32u Vendor) { switch (Vendor) { case 0x33495658 : return __T("3ivX"); //3IVX case 0x6170706C : return __T("Apple QuickTime"); //appl case 0x6E696B6F : return __T("Nikon"); //niko case 0x6F6C796D : return __T("Olympus"); //olym case 0x6F6D6E65 : return __T("Omneon"); //omne default: return Ztring().From_CC4(Vendor); } } //--------------------------------------------------------------------------- Ztring Mpeg4_Language_Apple(int16u Language) { switch (Language) { case 0 : return __T("en"); case 1 : return __T("fr"); case 2 : return __T("de"); case 6 : return __T("es"); default: return Ztring::ToZtring(Language); } } //--------------------------------------------------------------------------- extern const char* Mpeg4_chan(int16u Ordering); extern const char* Mpeg4_chan_Layout(int16u Ordering); //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Mpeg4::File_Mpeg4() :File__Analyze() { //Configuration #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Mpeg4; StreamIDs_Width[0]=8; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_Level=2; //Container #endif //MEDIAINFO_DEMUX #if MEDIAINFO_TRACE Trace_Layers_Update(0); //Container1 #endif //MEDIAINFO_TRACE DataMustAlwaysBeComplete=false; //Temp mdat_MustParse=false; TimeScale=1; Vendor=0x00000000; FirstMdatPos=(int64u)-1; LastMdatPos=0; FirstMoovPos=(int64u)-1; MajorBrand=0x00000000; IsSecondPass=false; IsParsing_mdat=false; IsFragmented=false; moov_trak_tkhd_TrackID=(int32u)-1; #if defined(MEDIAINFO_REFERENCES_YES) ReferenceFiles=NULL; #endif //defined(MEDIAINFO_REFERENCES_YES) mdat_Pos_NormalParsing=false; moof_traf_base_data_offset=(int64u)-1; data_offset_present=true; #if MEDIAINFO_NEXTPACKET ReferenceFiles_IsParsing=false; #endif //MEDIAINFO_NEXTPACKET #if MEDIAINFO_DEMUX TimeCode_FrameOffset=0; TimeCode_DtsOffset=0; #endif //MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- File_Mpeg4::~File_Mpeg4() { } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpeg4::Streams_Accept() { if (!IsSub) { /*bool IsDashMpd=false; for (size_t Pos=0; posFile_Names.size()>1 || Config->File_IsReferenced_Get())?Stream_Video:Stream_Image); if (StreamKind_Last==Stream_Video) Fill(Stream_Video, StreamPos_Last, Video_FrameCount, Config->File_Names.size()); } //Configuration Buffer_MaximumSize=64*1024*1024; //Some big frames are possible (e.g YUV 4:2:2 10 bits 1080p) } //--------------------------------------------------------------------------- void File_Mpeg4::Streams_Finish() { #if defined(MEDIAINFO_REFERENCES_YES) && MEDIAINFO_NEXTPACKET //Locators only if (ReferenceFiles_IsParsing) { ReferenceFiles->ParseReferences(); #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) return; #endif //MEDIAINFO_DEMUX Streams_Finish_CommercialNames(); return; } #endif //defined(MEDIAINFO_REFERENCES_YES) && MEDIAINFO_NEXTPACKET //Final Cut EIA-608 format if (Retrieve(Stream_General, 0, General_Format)==__T("Final Cut EIA-608")) { for (streams::iterator Stream=Streams.begin(); Stream!=Streams.end(); ++Stream) { Stream->second.Parsers[0]->Finish(); if (Stream->second.Parsers[0]->Count_Get(Stream_Text)) { Stream_Prepare(Stream_Text); Fill(Stream_Text, StreamPos_Last, Text_ID, Stream->first==1?"608-1":"608-2"); Fill(Stream_Text, StreamPos_Last, "MuxingMode", __T("Final Cut"), Unlimited); Merge(*Stream->second.Parsers[0], Stream_Text, 0, StreamPos_Last); } //Law rating Ztring LawRating=Stream->second.Parsers[0]->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); } return; } Fill_Flush(); int64u File_Size_Total=File_Size; //TimeCode for (streams::iterator Temp=Streams.begin(); Temp!=Streams.end(); ++Temp) if (Temp->second.TimeCode) TimeCode_Associate(Temp->first); //For each stream streams::iterator Temp=Streams.begin(); while (Temp!=Streams.end()) { //Preparing StreamKind_Last=Temp->second.StreamKind; StreamPos_Last=Temp->second.StreamPos; //if (Temp->second.stsz_StreamSize) // Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_StreamSize), Temp->second.stsz_StreamSize); //Edit lists coherencies if (Temp->second.edts.size()>1 && Temp->second.edts[0].Duration==Temp->second.tkhd_Duration) { bool Duplicates=true; for (size_t Pos=1; Possecond.edts.size(); Pos++) if (Temp->second.edts[Pos-1].Delay!=Temp->second.edts[Pos].Delay || Temp->second.edts[Pos-1].Duration!=Temp->second.edts[Pos].Duration || Temp->second.edts[Pos-1].Rate!=Temp->second.edts[Pos].Rate) Duplicates=false; if (Duplicates) Temp->second.edts.resize(1); } //Fragments if (IsFragmented) { Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Duration), Temp->second.stts_Duration/((float)Temp->second.mdhd_TimeScale)*1000, 0, true); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_FrameCount), Temp->second.stts_FrameCount, 10, true); } //Duration/StreamSize if (TimeScale && Temp->second.TimeCode==NULL && Temp->second.mdhd_TimeScale) { Ztring Duration_stts_FirstFrame, Duration_stts_LastFrame; if (Temp->second.stts_Duration_FirstFrame) Duration_stts_FirstFrame.From_Number(((float32)(((int32s)Temp->second.stts_Duration_FirstFrame)-((int32s)Temp->second.stts[1].SampleDuration)))*1000/Temp->second.mdhd_TimeScale, 0); //The duration of the frame minus 1 normal frame duration if (Temp->second.stts_Duration_LastFrame) Duration_stts_LastFrame.From_Number(((float32)(((int32s)Temp->second.stts_Duration_LastFrame)-((int32s)Temp->second.stts[Temp->second.stts_Duration_FirstFrame?1:0].SampleDuration)))*1000/Temp->second.mdhd_TimeScale, 0); //The duration of the frame minus 1 normal frame duration float32 Duration_tkhd_H=((float32)(Temp->second.tkhd_Duration+1))/TimeScale; float32 Duration_tkhd_L=((float32)(Temp->second.tkhd_Duration-1))/TimeScale; float32 Duration_stts=((float32)Temp->second.stts_Duration)/Temp->second.mdhd_TimeScale; if (!IsFragmented && Duration_stts && !(Duration_stts>=Duration_tkhd_L && Duration_stts<=Duration_tkhd_H)) { //There is a difference between media/stts atom and track atom Fill(StreamKind_Last, StreamPos_Last, "Source_Duration", Duration_stts*1000, 0); Fill(StreamKind_Last, StreamPos_Last, "Source_Duration_FirstFrame", Duration_stts_FirstFrame); Fill(StreamKind_Last, StreamPos_Last, "Source_Duration_LastFrame", Duration_stts_LastFrame); if (Temp->second.stts.size()!=1 || Temp->second.mdhd_TimeScale<100 || Temp->second.stts[0].SampleDuration!=1) //TODO: test PCM if (Temp->second.stts_FrameCount) Fill(StreamKind_Last, StreamPos_Last, "Source_FrameCount", Temp->second.stts_FrameCount); if (Temp->second.stsz_StreamSize) Fill(StreamKind_Last, StreamPos_Last, "Source_StreamSize", Temp->second.stsz_StreamSize); //Calculating new properties based on track duration Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Duration), ((float32)Temp->second.tkhd_Duration)/TimeScale*1000, 0, true); //Fill(StreamKind_Last, StreamPos_Last, "Duration_FirstFrame", Duration_stts_FirstFrame); Clear(StreamKind_Last, StreamPos_Last, "Duration_LastFrame"); //TODO int64u FrameCount; if (Temp->second.stts_Min && Temp->second.stts_Min==Temp->second.stts_Max) FrameCount=float64_int64s(((float64)Temp->second.tkhd_Duration)/TimeScale*Temp->second.mdhd_TimeScale/Temp->second.stts_Min); else { FrameCount=0; int64u Ticks_Max=float64_int64s(((float64)Temp->second.tkhd_Duration)/TimeScale*Temp->second.mdhd_TimeScale); int64u Ticks=0; for (size_t stts_Pos=0; stts_Possecond.stts.size(); stts_Pos++) { int64u Ticks_Complete=Temp->second.stts[stts_Pos].SampleCount*Temp->second.stts[stts_Pos].SampleDuration; if (Ticks+Ticks_Complete>=Ticks_Max) { if (Temp->second.stts[stts_Pos].SampleDuration) FrameCount+=float64_int64s(((float64)(Ticks_Max-Ticks))/Temp->second.stts[stts_Pos].SampleDuration); break; } Ticks+=Ticks_Complete; FrameCount+=Temp->second.stts[stts_Pos].SampleCount; } } if (Temp->second.stts.size()!=1 || Temp->second.mdhd_TimeScale<100 || Temp->second.stts[0].SampleDuration!=1) //TODO: test PCM Fill(StreamKind_Last, StreamPos_Last, "FrameCount", FrameCount, 10, true); if (Temp->second.stsz_Total.empty()) Fill(StreamKind_Last, StreamPos_Last, "StreamSize", FrameCount*Temp->second.stsz_Sample_Size*Temp->second.stsz_Sample_Multiplier); else if (FrameCount<=Temp->second.stsz_Total.size()) { int64u StreamSize=0; for (size_t stsz_Pos=0; stsz_Possecond.stsz_Total[stsz_Pos]; bool HasEncodedBitRate=!Retrieve(StreamKind_Last, StreamPos_Last, "BitRate_Encoded").empty(); Fill(StreamKind_Last, StreamPos_Last, HasEncodedBitRate?"StreamSize_Encoded":"StreamSize", StreamSize); } } else { //Normal if (Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Duration)).empty()) Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Duration), Duration_stts*1000, 0); Fill(StreamKind_Last, StreamPos_Last, "Duration_FirstFrame", Duration_stts_FirstFrame); Fill(StreamKind_Last, StreamPos_Last, "Duration_LastFrame", Duration_stts_LastFrame); if (Temp->second.stts.size()!=1 || Temp->second.mdhd_TimeScale<100 || Temp->second.stts[0].SampleDuration!=1) //TODO: test PCM if (Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_FrameCount)).empty() && Temp->second.stts_FrameCount) Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_FrameCount), Temp->second.stts_FrameCount); bool HasPadding=(Temp->second.Parsers.size()==1 && !Temp->second.Parsers[0]->Retrieve(StreamKind_Last, StreamPos_Last, "BitRate_Encoded").empty()) || (Temp->second.Parsers.size()==1 && Temp->second.Parsers[0]->Buffer_TotalBytes && ((float32)Temp->second.Parsers[0]->Buffer_PaddingBytes)/Temp->second.Parsers[0]->Buffer_TotalBytes>0.02); if (Temp->second.stsz_StreamSize) Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, HasPadding?Generic_StreamSize_Encoded:Generic_StreamSize), Temp->second.stsz_StreamSize); } } //Edit Lists float64 Delay=0; switch (Temp->second.edts.size()) { case 0 : break; case 1 : if (Temp->second.edts[0].Duration==Temp->second.tkhd_Duration && Temp->second.edts[0].Rate==0x00010000) { Delay=Temp->second.edts[0].Delay; Delay=-Delay; if (Temp->second.mdhd_TimeScale) Delay/=Temp->second.mdhd_TimeScale; //In seconds } break; case 2 : if (Temp->second.edts[0].Delay==(int32u)-1 && Temp->second.edts[0].Duration+Temp->second.edts[1].Duration==Temp->second.tkhd_Duration && Temp->second.edts[0].Rate==0x00010000 && Temp->second.edts[1].Rate==0x00010000) { Delay=Temp->second.edts[0].Duration; Temp->second.tkhd_Duration-=float64_int64s(Delay); Delay/=TimeScale; //In seconds } break; default: break; //TODO: handle more complex Edit Lists } if (Delay && !Retrieve(StreamKind_Last, StreamPos_Last, "Source_Duration").empty()) { Delay+=Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Delay)).To_float64()/1000; //TODO: use TimeCode value directly instead of the rounded value if (!Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Delay_Source)).empty() && Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Delay_Source))!=__T("Container")) { Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Delay_Original), Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Delay))); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Delay_Original_Source), Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Delay_Source))); } Fill(StreamKind_Last, StreamPos_Last, "Source_Delay", Delay*1000, 0, true); Fill(StreamKind_Last, StreamPos_Last, "Source_Delay_Source", "Container", Unlimited, true, true); (*Stream_More)[StreamKind_Last][StreamPos_Last](Ztring().From_Local("Source_Delay"), Info_Options)=__T("N NT"); (*Stream_More)[StreamKind_Last][StreamPos_Last](Ztring().From_Local("Source_Delay_Source"), Info_Options)=__T("N NT"); } if (StreamKind_Last==Stream_Video && Temp->second.TimeCode==NULL) { if (Temp->second.mdhd_TimeScale && Temp->second.stts_Min && Temp->second.stts_Max) { if (Temp->second.stts_Min==0 || Temp->second.stts_Max==0 || (Temp->second.stts_Min!=Temp->second.stts_Max && ((float)Temp->second.mdhd_TimeScale)/Temp->second.stts_Min-((float)Temp->second.mdhd_TimeScale)/Temp->second.stts_Max>=0.001)) { if (Temp->second.stts_Max) Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Minimum, ((float)Temp->second.mdhd_TimeScale)/Temp->second.stts_Max, 3, true); if (Temp->second.stts_Min) Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Maximum, ((float)Temp->second.mdhd_TimeScale)/Temp->second.stts_Min, 3, true); if (Temp->second.stts_Duration) Fill(Stream_Video, StreamPos_Last, Video_FrameRate, ((float)Temp->second.stts_FrameCount)/Temp->second.stts_Duration*Temp->second.mdhd_TimeScale, 3, true); Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Mode, "VFR", Unlimited, true, true); } else { Fill(Stream_Video, StreamPos_Last, Video_FrameRate, ((float)Temp->second.mdhd_TimeScale)/Temp->second.stts_Max, 3, true); Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Mode, "CFR", Unlimited, true, true); } } } //Coherency if (!IsFragmented && Temp->second.stts_Duration!=Temp->second.mdhd_Duration && Temp->second.mdhd_TimeScale) { //There is a difference between media/mdhd atom and track atom Fill(StreamKind_Last, StreamPos_Last, "mdhd_Duration", ((float32)Temp->second.mdhd_Duration)/Temp->second.mdhd_TimeScale*1000, 0); } //When there are few frames, difficult to detect PCM if (Temp->second.IsPcm && !Temp->second.Parsers.empty() && !Temp->second.Parsers[0]->Status[IsAccepted]) { for (size_t Pos=0; Possecond.Parsers.size()-1; Pos++) delete Temp->second.Parsers[Pos]; Temp->second.Parsers.erase(Temp->second.Parsers.begin(), Temp->second.Parsers.begin()+Temp->second.Parsers.size()-1); Temp->second.Parsers[0]->Accept(); } //Parser specific if (Temp->second.Parsers.size()==1) { if (Config->ParseSpeed<=1.0) { Fill(Temp->second.Parsers[0]); Temp->second.Parsers[0]->Open_Buffer_Unsynch(); } //Finalizing and Merging Finish(Temp->second.Parsers[0]); if (StreamKind_Last==Stream_General) { //Special case for TimeCode without link for (std::map::iterator Target=Streams.begin(); Target!=Streams.end(); ++Target) if (Target->second.StreamKind!=Stream_General) Merge(*Temp->second.Parsers[0], Target->second.StreamKind, 0, Target->second.StreamPos); } else { //Hacks - Before Ztring FrameRate_Temp, FrameRate_Mode_Temp, Duration_Temp, Delay_Temp; if (StreamKind_Last==Stream_Video) { if (Temp->second.Parsers[0] && Retrieve(Stream_Video, 0, Video_CodecID_Hint)==__T("DVCPRO HD")) { Temp->second.Parsers[0]->Clear(Stream_Video, 0, Video_FrameRate); Temp->second.Parsers[0]->Clear(Stream_Video, 0, Video_Width); Temp->second.Parsers[0]->Clear(Stream_Video, 0, Video_Height); Temp->second.Parsers[0]->Clear(Stream_Video, 0, Video_DisplayAspectRatio); Temp->second.Parsers[0]->Clear(Stream_Video, 0, Video_PixelAspectRatio); } FrameRate_Temp=Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate); FrameRate_Mode_Temp=Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate_Mode); Duration_Temp=Retrieve(Stream_Video, StreamPos_Last, Video_Duration); Delay_Temp=Retrieve(Stream_Video, StreamPos_Last, Video_Delay); //Special case: DV 1080i and MPEG-4 header is lying (saying this is 1920 pixel wide, but this is 1440 pixel wide) if (Temp->second.Parsers[0]->Get(Stream_Video, 0, Video_Format)==__T("DV") && Retrieve(Stream_Video, StreamKind_Last, Video_Width)==__T("1080")) Clear(Stream_Video, StreamKind_Last, Video_Width); } //Special case - Multiple sub-streams in a stream if ((Temp->second.Parsers[0]->Retrieve(Stream_General, 0, General_Format)==__T("ChannelGrouping") && Temp->second.Parsers[0]->Count_Get(Stream_Audio)) || Temp->second.Parsers[0]->Retrieve(Stream_General, 0, General_Format)==__T("Final Cut EIA-608") || Temp->second.Parsers[0]->Retrieve(Stream_General, 0, General_Format)==__T("Final Cut CDP")) { //Before Clear(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_StreamSize)); if (StreamKind_Last==Stream_Audio) { Clear(Stream_Audio, StreamPos_Last, Audio_Format_Settings_Sign); } ZtringList StreamSave; StreamSave.Write((*File__Analyze::Stream)[StreamKind_Last][StreamPos_Last].Read()); ZtringListList StreamMoreSave; StreamMoreSave.Write((*Stream_More)[StreamKind_Last][StreamPos_Last].Read()); //Erasing former streams data stream_t NewKind=StreamKind_Last; size_t NewPos1; Ztring ID; if (Temp->second.Parsers[0]->Retrieve(Stream_General, 0, General_Format)==__T("ChannelGrouping")) { //Channel coupling, removing the 2 corresponding streams NewPos1=(StreamPos_Last/2)*2; size_t NewPos2=NewPos1+1; ID=Retrieve(StreamKind_Last, NewPos1, General_ID)+__T(" / ")+Retrieve(StreamKind_Last, NewPos2, General_ID); Stream_Erase(NewKind, NewPos2); Stream_Erase(NewKind, NewPos1); streams::iterator NextStream=Temp; ++NextStream; size_t NewAudio_Count=Temp->second.Parsers[0]->Count_Get(Stream_Audio); while (NextStream!=Streams.end()) { if (NextStream->second.StreamKind==Stream_Audio) { NextStream->second.StreamPos-=2; NextStream->second.StreamPos+=NewAudio_Count; } ++NextStream; } } else { //One channel NewPos1=StreamPos_Last; ID=Retrieve(StreamKind_Last, NewPos1, General_ID); Stream_Erase(StreamKind_Last, StreamPos_Last); } //After size_t New_Count=Temp->second.Parsers[0]->Count_Get(NewKind); for (size_t StreamPos=0; StreamPossecond.Parsers[0], StreamKind_Last, StreamPos, StreamPos_Last); Ztring Parser_ID=Retrieve(StreamKind_Last, StreamPos_Last, General_ID); Fill(StreamKind_Last, StreamPos_Last, General_ID, ID+__T("-")+Parser_ID, true); for (size_t Pos=0; Possecond.Parsers[0]->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); } else { //Temp->second.Parsers[0]->Clear(StreamKind_Last, StreamPos_Last, "Delay"); //DV TimeCode is removed Merge(*Temp->second.Parsers[0], StreamKind_Last, 0, StreamPos_Last); //Law rating Ztring LawRating=Temp->second.Parsers[0]->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); } //Hacks - After if (StreamKind_Last==Stream_Video) { Fill(Stream_Video, StreamPos_Last, Video_Duration, Duration_Temp, true); if (!FrameRate_Temp.empty() && FrameRate_Temp!=Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate)) Fill(Stream_Video, StreamPos_Last, Video_FrameRate, FrameRate_Temp, true); if (!FrameRate_Mode_Temp.empty() && FrameRate_Mode_Temp!=Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate_Mode)) Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Mode, FrameRate_Mode_Temp, true); //Special case for TimeCode and DV multiple audio if (!Delay_Temp.empty() && Delay_Temp!=Retrieve(Stream_Video, StreamPos_Last, Video_Delay)) { for (size_t Pos=0; Possecond.Parsers[0] && (Temp->second.Parsers[0]->Count_Get(Stream_Audio) || Temp->second.Parsers[0]->Count_Get(Stream_Text))) { //Video and Audio are together size_t Audio_Count=Temp->second.Parsers[0]->Count_Get(Stream_Audio); for (size_t Audio_Pos=0; Audio_Possecond.Parsers[0], Stream_Audio, Audio_Pos, StreamPos_Last); Fill(Stream_Audio, Pos, Audio_MuxingMode_MoreInfo, __T("Muxed in Video #")+Ztring().From_Number(Temp->second.StreamPos+1)); Fill(Stream_Audio, Pos, Audio_Duration, Retrieve(Stream_Video, Temp->second.StreamPos, Video_Duration)); Fill(Stream_Audio, Pos, Audio_StreamSize_Encoded, 0); //Included in the DV stream size Ztring ID=Retrieve(Stream_Audio, Pos, Audio_ID); Fill(Stream_Audio, Pos, Audio_ID, Retrieve(Stream_Video, Temp->second.StreamPos, Video_ID)+__T("-")+ID, true); Fill(Stream_Audio, Pos, "Source", Retrieve(Stream_Video, Temp->second.StreamPos, "Source")); Fill(Stream_Audio, Pos, "Source_Info", Retrieve(Stream_Video, Temp->second.StreamPos, "Source_Info")); } //Video and Text are together size_t Text_Count=Temp->second.Parsers[0]->Count_Get(Stream_Text); for (size_t Text_Pos=0; Text_Possecond.Parsers[0], Stream_Text, Text_Pos, StreamPos_Last); Fill(Stream_Text, Pos, Text_MuxingMode_MoreInfo, __T("Muxed in Video #")+Ztring().From_Number(Temp->second.StreamPos+1)); Fill(Stream_Text, Pos, Text_Duration, Retrieve(Stream_Video, Temp->second.StreamPos, Video_Duration)); Fill(Stream_Text, Pos, Text_StreamSize_Encoded, 0); //Included in the DV stream size Ztring ID=Retrieve(Stream_Text, Pos, Text_ID); Fill(Stream_Text, Pos, Text_ID, Retrieve(Stream_Video, Temp->second.StreamPos, Video_ID)+__T("-")+ID, true); Fill(Stream_Text, Pos, "Source", Retrieve(Stream_Video, Temp->second.StreamPos, "Source")); Fill(Stream_Text, Pos, "Source_Info", Retrieve(Stream_Video, Temp->second.StreamPos, "Source_Info")); } StreamKind_Last=Temp->second.StreamKind; StreamPos_Last=Temp->second.StreamPos; } } } //ScanOrder_StoredDisplayedInverted if (Temp->second.ScanOrder_StoredDisplayedInverted) { if (Retrieve(Stream_Video, 0, Video_ScanOrder)==__T("BFF")) Fill(Stream_Video, 0, Video_ScanOrder, "TFF", Unlimited, true, true); else if (Retrieve(Stream_Video, 0, Video_ScanOrder)==__T("TFF")) Fill(Stream_Video, 0, Video_ScanOrder, "BFF", Unlimited, true, true); Fill(Stream_Video, 0, Video_ScanOrder_StoredDisplayedInverted, "Yes"); } //External file name specific if (Temp->second.MI && Temp->second.MI->Info) { //Preparing StreamKind_Last=Temp->second.StreamKind; StreamPos_Last=Temp->second.StreamPos; //Hacks - Before Ztring CodecID=Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_CodecID)); Ztring Source=Retrieve(StreamKind_Last, StreamPos_Last, "Source"); Ztring Source_Info=Retrieve(StreamKind_Last, StreamPos_Last, "Source_Info"); Merge(*Temp->second.MI->Info, Temp->second.StreamKind, 0, Temp->second.StreamPos); File_Size_Total+=Ztring(Temp->second.MI->Get(Stream_General, 0, General_FileSize)).To_int64u(); //Hacks - After if (CodecID!=Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_CodecID))) { if (!CodecID.empty()) CodecID+=__T(" / "); CodecID+=Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_CodecID)); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_CodecID), CodecID, true); } if (Source!=Retrieve(StreamKind_Last, StreamPos_Last, "Source")) { Ztring Source_Original=Retrieve(StreamKind_Last, StreamPos_Last, "Source"); Ztring Source_Original_Info=Retrieve(StreamKind_Last, StreamPos_Last, "Source_Info"); Fill(StreamKind_Last, StreamPos_Last, "Source", Source, true); Fill(StreamKind_Last, StreamPos_Last, "Source_Info", Source_Info, true); Fill(StreamKind_Last, StreamPos_Last, "Source_Original", Source_Original, true); Fill(StreamKind_Last, StreamPos_Last, "Source_Original_Info", Source_Original_Info, true); } if (StreamKind_Last==Stream_Audio && Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)!=__T("PCM") && !Retrieve(Stream_Audio, StreamPos_Last, Audio_Channel_s__Original).empty()) { Clear(Stream_Audio, StreamPos_Last, Audio_Channel_s__Original); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, 6, 10, true); //The PCM channel count is fake } //Muxing Mode Fill(StreamKind_Last, StreamPos_Last, "MuxingMode", Temp->second.MI->Get(Stream_General, 0, General_Format)); //Special case: DV with Audio or/and Text in the video stream if (StreamKind_Last==Stream_Video && Temp->second.MI->Info && (Temp->second.MI->Info->Count_Get(Stream_Audio) || Temp->second.MI->Info->Count_Get(Stream_Text))) { //Video and Audio are together size_t Audio_Count=Temp->second.MI->Info->Count_Get(Stream_Audio); for (size_t Audio_Pos=0; Audio_Possecond.MI->Info, Stream_Audio, Audio_Pos, StreamPos_Last); if (Retrieve(Stream_Audio, Pos, Audio_MuxingMode).empty()) Fill(Stream_Audio, Pos, Audio_MuxingMode, Retrieve(Stream_Video, Temp->second.StreamPos, Video_Format), true); else Fill(Stream_Audio, Pos, Audio_MuxingMode, Retrieve(Stream_Video, Temp->second.StreamPos, Video_Format)+__T(" / ")+Retrieve(Stream_Audio, Pos, Audio_MuxingMode), true); Fill(Stream_Audio, Pos, Audio_MuxingMode_MoreInfo, __T("Muxed in Video #")+Ztring().From_Number(Temp->second.StreamPos+1)); Fill(Stream_Audio, Pos, Audio_Duration, Retrieve(Stream_Video, Temp->second.StreamPos, Video_Duration), true); Fill(Stream_Audio, Pos, Audio_StreamSize_Encoded, 0); //Included in the DV stream size Ztring ID=Retrieve(Stream_Audio, Pos, Audio_ID); Fill(Stream_Audio, Pos, Audio_ID, Retrieve(Stream_Video, Temp->second.StreamPos, Video_ID)+__T("-")+ID, true); Fill(Stream_Audio, Pos, "Source", Retrieve(Stream_Video, Temp->second.StreamPos, "Source")); Fill(Stream_Audio, Pos, "Source_Info", Retrieve(Stream_Video, Temp->second.StreamPos, "Source_Info")); } //Video and Text are together size_t Text_Count=Temp->second.MI->Info->Count_Get(Stream_Text); for (size_t Text_Pos=0; Text_Possecond.MI->Info, Stream_Text, Text_Pos, StreamPos_Last); if (Retrieve(Stream_Text, Pos, Text_MuxingMode).empty()) Fill(Stream_Text, Pos, Text_MuxingMode, Retrieve(Stream_Video, Temp->second.StreamPos, Video_Format), true); else Fill(Stream_Text, Pos, Text_MuxingMode, Retrieve(Stream_Video, Temp->second.StreamPos, Video_Format)+__T(" / ")+Retrieve(Stream_Text, Pos, Text_MuxingMode), true); Fill(Stream_Text, Pos, Text_MuxingMode_MoreInfo, __T("Muxed in Video #")+Ztring().From_Number(Temp->second.StreamPos+1)); Fill(Stream_Text, Pos, Text_Duration, Retrieve(Stream_Video, Temp->second.StreamPos, Video_Duration)); Fill(Stream_Text, Pos, Text_StreamSize_Encoded, 0); //Included in the DV stream size Ztring ID=Retrieve(Stream_Text, Pos, Text_ID); Fill(Stream_Text, Pos, Text_ID, Retrieve(Stream_Video, Temp->second.StreamPos, Video_ID)+__T("-")+ID, true); Fill(Stream_Text, Pos, "Source", Retrieve(Stream_Video, Temp->second.StreamPos, "Source")); Fill(Stream_Text, Pos, "Source_Info", Retrieve(Stream_Video, Temp->second.StreamPos, "Source_Info")); } } } //Aperture size if (Temp->second.CleanAperture_Width) { Ztring CleanAperture_Width=Ztring().From_Number(Temp->second.CleanAperture_Width, 0); Ztring CleanAperture_Height=Ztring().From_Number(Temp->second.CleanAperture_Height, 0); if (CleanAperture_Width!=Retrieve(Stream_Video, StreamPos_Last, Video_Width)) { Fill(Stream_Video, StreamPos_Last, Video_Width_Original, Retrieve(Stream_Video, StreamPos_Last, Video_Width), true); Fill(Stream_Video, StreamPos_Last, Video_Width, Temp->second.CleanAperture_Width, 0, true); } if (CleanAperture_Height!=Retrieve(Stream_Video, StreamPos_Last, Video_Height)) { Fill(Stream_Video, StreamPos_Last, Video_Height_Original, Retrieve(Stream_Video, StreamPos_Last, Video_Height), true); Fill(Stream_Video, StreamPos_Last, Video_Height, Temp->second.CleanAperture_Height, 0, true); } if (Temp->second.CleanAperture_PixelAspectRatio) { Clear(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio); Clear(Stream_Video, StreamPos_Last, Video_PixelAspectRatio); Fill(Stream_Video, StreamPos_Last, Video_PixelAspectRatio, Temp->second.CleanAperture_PixelAspectRatio, 3, true); if (Retrieve(Stream_Video, StreamPos_Last, Video_PixelAspectRatio)==Retrieve(Stream_Video, StreamPos_Last, Video_PixelAspectRatio_Original)) Clear(Stream_Video, StreamPos_Last, Video_PixelAspectRatio_Original); if (Retrieve(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio)==Retrieve(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio_Original)) { Clear(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio_Original); Clear(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio_Original_String); } } } //Special case: QuickTime files and Stereo streams, there is a default value in QuickTime player, a QuickTime "standard"? if (StreamKind_Last==Stream_Audio && Retrieve(Stream_Audio, StreamPos_Last, Audio_Channel_s_)==__T("2") && Retrieve(Stream_Audio, StreamPos_Last, Audio_ChannelLayout).empty() && Retrieve(Stream_Audio, StreamPos_Last, Audio_ChannelPositions).empty() && Retrieve(Stream_General, 0, General_Format_Profile)==__T("QuickTime")) { Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions, Mpeg4_chan(101)); Fill(Stream_Audio, StreamPos_Last, Audio_ChannelLayout, Mpeg4_chan_Layout(101)); } //Bitrate Mode if (Retrieve(StreamKind_Last, StreamPos_Last, "BitRate_Mode").empty()) { if (Temp->second.stss.empty() && Temp->second.stss.size()!=Temp->second.stsz_Total.size() && !IsFragmented) { int64u Size_Min=(int64u)-1, Size_Max=0; for (size_t Pos=0; Possecond.stsz_Total.size(); Pos++) { if (Temp->second.stsz_Total[Pos]second.stsz_Total[Pos]; if (Temp->second.stsz_Total[Pos]>Size_Max) Size_Max=Temp->second.stsz_Total[Pos]; } if (Size_Min*(1.005+0.005)0) Fill(Stream_General, 0, General_InternetMediaType, "audio/mp4", Unlimited, true, true); //Parsing reference files #ifdef MEDIAINFO_REFERENCES_YES for (streams::iterator Stream=Streams.begin(); Stream!=Streams.end(); ++Stream) if (!Stream->second.File_Name.empty()) { if (ReferenceFiles==NULL) ReferenceFiles=new File__ReferenceFilesHelper(this, Config); File__ReferenceFilesHelper::reference ReferenceFile; ReferenceFile.FileNames.push_back(Stream->second.File_Name); ReferenceFile.StreamKind=Stream->second.StreamKind; ReferenceFile.StreamPos=Stream->second.StreamPos; ReferenceFile.StreamID=Retrieve(Stream->second.StreamKind, Stream->second.StreamPos, General_ID).To_int64u(); if (Stream->second.StreamKind==Stream_Video) { ReferenceFile.FrameRate=Retrieve(Stream_Video, Stream->second.StreamPos, Video_FrameRate).To_float64(); #ifdef MEDIAINFO_IBI_YES for (size_t stss_Pos=0; stss_Possecond.stss.size(); stss_Pos++) { int64u Value=Stream->second.stss[stss_Pos]; //Searching the corresponding stco std::vector::iterator Stsc=Stream->second.stsc.begin(); int64u SamplePos=0; for (; Stsc!=Stream->second.stsc.end(); ++Stsc) { std::vector::iterator Stsc_Next=Stsc; ++Stsc_Next; int64u CountOfSamples=((Stsc_Next==Stream->second.stsc.end()?Stream->second.stco.size():Stsc_Next->FirstChunk)-Stsc->FirstChunk)*Stsc->SamplesPerChunk; if (Stsc_Next!=Stream->second.stsc.end() && Value>=SamplePos+CountOfSamples) SamplePos+=CountOfSamples; else { int64u CountOfChunks=(Value-SamplePos)/Stsc->SamplesPerChunk; size_t stco_Pos=(size_t)(Stsc->FirstChunk-1+CountOfChunks); //-1 because first chunk is number 1 if (stco_Possecond.stco.size()) { stream::stts_durations::iterator stts_Duration=Stream->second.stts_Durations.begin()+Stream->second.stts_Durations_Pos; ibi::stream::info IbiInfo; IbiInfo.StreamOffset=Stream->second.stco[stco_Pos]; IbiInfo.FrameNumber=Value; IbiInfo.Dts=TimeCode_DtsOffset+(stts_Duration->DTS_Begin+(((int64u)stts_Duration->SampleDuration)*(Value-stts_Duration->Pos_Begin)))*1000000000/Stream->second.mdhd_TimeScale; ReferenceFile.IbiStream.Add(IbiInfo); } } } } #endif //MEDIAINFO_IBI_YES } ReferenceFiles->References.push_back(ReferenceFile); } if (ReferenceFiles) { ReferenceFiles->ParseReferences(); #if MEDIAINFO_NEXTPACKET if (Config->NextPacket_Get() && ReferenceFiles && !ReferenceFiles->References.empty()) { ReferenceFiles_IsParsing=true; return; } #endif //MEDIAINFO_NEXTPACKET } #endif //MEDIAINFO_REFERENCES_YES //Commercial names Streams_Finish_CommercialNames(); } //--------------------------------------------------------------------------- void File_Mpeg4::Streams_Finish_CommercialNames() { if (Count_Get(Stream_Video)==1) { Streams_Finish_StreamOnly(); if (Retrieve(Stream_Video, 0, Video_Format)==__T("DV") && Retrieve(Stream_Video, 0, Video_Format_Commercial)==__T("DVCPRO HD")) { int32u BitRate=Retrieve(Stream_Video, 0, Video_BitRate).To_int32u(); int32u BitRate_Max=Retrieve(Stream_Video, 0, Video_BitRate_Maximum).To_int32u(); if (BitRate_Max && BitRate>=BitRate_Max) { Clear(Stream_Video, 0, Video_BitRate_Maximum); Fill(Stream_Video, 0, Video_BitRate, BitRate_Max, 10, true); Fill(Stream_Video, 0, Video_BitRate_Mode, "CBR", Unlimited, true, true); } } if (!Retrieve(Stream_Video, 0, Video_Format_Commercial_IfAny).empty()) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, Retrieve(Stream_Video, 0, Video_Format_Commercial_IfAny)); Fill(Stream_General, 0, General_Format_Commercial, Retrieve(Stream_General, 0, General_Format)+__T(' ')+Retrieve(Stream_Video, 0, Video_Format_Commercial_IfAny)); } else if (Retrieve(Stream_Video, 0, Video_Format)==__T("MPEG Video") && Retrieve(Stream_Video, 0, Video_Format_Settings_GOP)!=__T("N=1") && Retrieve(Stream_Video, 0, Video_Colorimetry)==__T("4:2:0") && (Retrieve(Stream_Video, 0, Video_BitRate)==__T("18000000") || Retrieve(Stream_Video, 0, Video_BitRate_Nominal)==__T("18000000") || Retrieve(Stream_Video, 0, Video_BitRate_Maximum)==__T("18000000"))) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, "XDCAM EX 18"); Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "XDCAM EX 18"); } else if (Retrieve(Stream_Video, 0, Video_Format)==__T("MPEG Video") && Retrieve(Stream_Video, 0, Video_Format_Settings_GOP)!=__T("N=1") && Retrieve(Stream_Video, 0, Video_Colorimetry)==__T("4:2:0") && (Retrieve(Stream_Video, 0, Video_BitRate)==__T("25000000") || Retrieve(Stream_Video, 0, Video_BitRate_Nominal)==__T("25000000") || Retrieve(Stream_Video, 0, Video_BitRate_Maximum)==__T("25000000"))) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, "XDCAM EX 25"); Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "XDCAM EX 25"); } else if (Retrieve(Stream_Video, 0, Video_Format)==__T("MPEG Video") && Retrieve(Stream_Video, 0, Video_Format_Settings_GOP)!=__T("N=1") && Retrieve(Stream_Video, 0, Video_Colorimetry)==__T("4:2:0") && (Retrieve(Stream_Video, 0, Video_BitRate)==__T("35000000") || Retrieve(Stream_Video, 0, Video_BitRate_Nominal)==__T("35000000") || Retrieve(Stream_Video, 0, Video_BitRate_Maximum)==__T("35000000"))) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, "XDCAM EX 35"); Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "XDCAM EX 35"); } else if (Retrieve(Stream_Video, 0, Video_Format)==__T("MPEG Video") && Retrieve(Stream_Video, 0, Video_Format_Settings_GOP)!=__T("N=1") && Retrieve(Stream_Video, 0, Video_Colorimetry)==__T("4:2:2") && (Retrieve(Stream_Video, 0, Video_BitRate)==__T("50000000") || Retrieve(Stream_Video, 0, Video_BitRate_Nominal)==__T("50000000") || Retrieve(Stream_Video, 0, Video_BitRate_Maximum)==__T("50000000"))) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, "XDCAM HD422"); Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "XDCAM HD422"); } } } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpeg4::Read_Buffer_Unsynched() { if (!IsSub && MajorBrand==0x6A703220) //"jp2 " return Read_Buffer_Unsynched_OneFramePerFile(); mdat_Pos_Temp=mdat_Pos.begin(); while (mdat_Pos_Temp!=mdat_Pos.end() && mdat_Pos_Temp->firstfirst>File_GoTo) mdat_Pos_Temp--; //Previous frame if (mdat_Pos_Temp==mdat_Pos.end()) { IsParsing_mdat=false; return; } IsParsing_mdat=true; #if MEDIAINFO_SEEK //Searching the ID of the first stream to be demuxed std::map::iterator Next_Stream=Streams.end(); #if MEDIAINFO_DEMUX size_t Next_Stream_Stco=(size_t)-1; #endif //MEDIAINFO_DEMUX for (std::map::iterator Stream=Streams.begin(); Stream!=Streams.end(); ++Stream) { for (size_t Stco_Pos=0; Stco_Possecond.stco.size(); Stco_Pos++) if (Stream->second.stco[Stco_Pos]==mdat_Pos_Temp->first) { Next_Stream=Stream; #if MEDIAINFO_DEMUX Next_Stream_Stco=Stco_Pos; #endif //MEDIAINFO_DEMUX break; } if (Next_Stream!=Streams.end()) break; } #endif //MEDIAINFO_SEEK for (std::map::iterator Stream=Streams.begin(); Stream!=Streams.end(); ++Stream) { for (size_t Pos=0; Possecond.Parsers.size(); Pos++) Stream->second.Parsers[Pos]->Open_Buffer_Unsynch(); #if MEDIAINFO_SEEK && MEDIAINFO_DEMUX //Searching the next position for this stream int64u StreamOffset=(int64u)-1; if (StreamOffset_Jump.empty() || File_GoTo==mdat_Pos.begin()->first) StreamOffset=mdat_Pos_Temp->first; else if (Next_Stream_Stco!=(size_t)-1) { //Searching the right place for this stream int64u StreamOffset_Temp=Next_Stream->second.stco[Next_Stream_Stco]; std::map::iterator StreamOffset_Jump_Temp; for (;;) { StreamOffset_Jump_Temp=StreamOffset_Jump.find(StreamOffset_Temp); if (StreamOffset_Jump_Temp==StreamOffset_Jump.end()) break; if (Stream==Next_Stream) StreamOffset_Temp=StreamOffset_Jump_Temp->first; else { ++StreamOffset_Jump_Temp; if (StreamOffset_Jump_Temp==StreamOffset_Jump.end()) break; StreamOffset_Temp=StreamOffset_Jump_Temp->second; } if (!Stream->second.stco.empty() && StreamOffset_Temp>=Stream->second.stco[0] && StreamOffset_Temp<=Stream->second.stco[Stream->second.stco.size()-1]) for (size_t Stco_Pos=0; Stco_Possecond.stco.size(); Stco_Pos++) if (StreamOffset_Temp==Stream->second.stco[Stco_Pos]) { StreamOffset=Stream->second.stco[Stco_Pos]; break; } if (StreamOffset!=(int64u)-1) break; } } if (StreamOffset!=(int64u)-1) for (size_t stco_Pos=0; stco_Possecond.stco.size(); stco_Pos++) if (Stream->second.stco[stco_Pos]>=StreamOffset) { //Searching the corresponding frame position std::vector::iterator Stsc=Stream->second.stsc.begin(); int64u SamplePos=0; for (; Stsc!=Stream->second.stsc.end(); ++Stsc) { std::vector::iterator Stsc_Next=Stsc; ++Stsc_Next; if (Stsc_Next!=Stream->second.stsc.end() && stco_Pos+1>=Stsc_Next->FirstChunk) { int64u CountOfSamples=(Stsc_Next->FirstChunk-Stsc->FirstChunk)*Stsc->SamplesPerChunk; SamplePos+=CountOfSamples; } else { int64u CountOfSamples=(stco_Pos+1-Stsc->FirstChunk)*Stsc->SamplesPerChunk; SamplePos+=CountOfSamples; Stream->second.stts_FramePos=SamplePos; //Searching the corresponding duration block position for (stream::stts_durations::iterator Stts_Duration=Stream->second.stts_Durations.begin(); Stts_Duration!=Stream->second.stts_Durations.end(); ++Stts_Duration) if (SamplePos>=Stts_Duration->Pos_Begin && SamplePosPos_End) { Stream->second.stts_Durations_Pos=Stts_Duration-Stream->second.stts_Durations.begin(); break; } break; } } break; } #endif //MEDIAINFO_SEEK && MEDIAINFO_DEMUX } } //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_Mpeg4::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { #if defined(MEDIAINFO_REFERENCES_YES) if (ReferenceFiles) return ReferenceFiles->Read_Buffer_Seek(Method, Value, ID); #endif //defined(MEDIAINFO_REFERENCES_YES) if (!IsSub && MajorBrand==0x6A703220) //"jp2 " return Read_Buffer_Seek_OneFramePerFile(Method, Value, ID); //Parsing switch (Method) { case 0 : if (Value==0) return Read_Buffer_Seek(3, 0, ID); if (FirstMoovPos==(int64u)-1) return 6; //Internal error if (Value>=LastMdatPos) { GoTo(File_Size); Open_Buffer_Unsynch(); return 1; } { //Looking for the minimal stream offset, for every video/audio/text stream int64u JumpTo=File_Size; for (std::map::iterator Stream=Streams.begin(); Stream!=Streams.end(); ++Stream) switch (Stream->second.StreamKind) { case Stream_Video : case Stream_Audio : case Stream_Text : { //Searching the corresponding chunk offset std::vector::iterator Stco=Stream->second.stco.begin(); if (Value<*Stco) return Read_Buffer_Seek(3, 0, ID); for (; Stco!=Stream->second.stco.end(); ++Stco) { std::vector::iterator Stco_Next=Stco; ++Stco_Next; if (Stco_Next!=Stream->second.stco.end() && Value>=*Stco && Value<*Stco_Next) { if (JumpTo>*Stco) JumpTo=*Stco; break; } } } break; default : ; } GoTo(JumpTo); Open_Buffer_Unsynch(); return 1; } case 1 : if (Value==0) return Read_Buffer_Seek(3, 0, ID); if (FirstMoovPos==(int64u)-1) return 6; //Internal error return Read_Buffer_Seek(0, FirstMdatPos+(LastMdatPos-FirstMdatPos)*Value/10000, ID); case 2 : //Timestamp #if MEDIAINFO_DEMUX { //Searching time stamp offset due to Time code offset for (std::map::iterator Stream=Streams.begin(); Stream!=Streams.end(); ++Stream) if (Stream->second.StreamKind==Stream_Video) { if (Value>TimeCode_DtsOffset) //Removing Time Code offset Value-=TimeCode_DtsOffset; else Value=0; //Sooner break; } //Looking for the minimal stream offset, for every video/audio/text stream int64u JumpTo=File_Size; for (std::map::iterator Stream=Streams.begin(); Stream!=Streams.end(); ++Stream) switch (Stream->second.StreamKind) { case Stream_Video : case Stream_Audio : case Stream_Text : { int64u Value2=float64_int64s(((float64)Value)*Stream->second.mdhd_TimeScale/1000000000); //Transformed in mpeg4 ticks (per track) //Searching the corresponding frame for (stream::stts_durations::iterator stts_Duration=Stream->second.stts_Durations.begin(); stts_Duration!=Stream->second.stts_Durations.end(); ++stts_Duration) { if (Value2>=stts_Duration->DTS_Begin && Value2DTS_End) { int64u FrameNumber=stts_Duration->Pos_Begin+(Value2-stts_Duration->DTS_Begin)/stts_Duration->SampleDuration; //Searching the I-Frame if (!Stream->second.stss.empty()) { for (size_t Pos=0; Possecond.stss.size(); Pos++) if (FrameNumber<=Stream->second.stss[Pos]) { if (Pos && FrameNumbersecond.stss[Pos]) FrameNumber=Stream->second.stss[Pos-1]; break; } } //Searching the corresponding stco std::vector::iterator Stsc=Stream->second.stsc.begin(); int64u SamplePos=0; for (; Stsc!=Stream->second.stsc.end(); ++Stsc) { std::vector::iterator Stsc_Next=Stsc; ++Stsc_Next; int64u CountOfSamples=((Stsc_Next==Stream->second.stsc.end()?Stream->second.stco.size():Stsc_Next->FirstChunk)-Stsc->FirstChunk)*Stsc->SamplesPerChunk; if (Stsc_Next!=Stream->second.stsc.end() && FrameNumber>=SamplePos+CountOfSamples) SamplePos+=CountOfSamples; else { int64u CountOfChunks=(FrameNumber-SamplePos)/Stsc->SamplesPerChunk; size_t stco_Pos=(size_t)(Stsc->FirstChunk-1+CountOfChunks); //-1 because first chunk is number 1 if (stco_Pos>Stream->second.stco.size()) return 2; //Invalid FrameNumber if (JumpTo>Stream->second.stco[stco_Pos]) JumpTo=Stream->second.stco[stco_Pos]; break; } } } } } break; default : ; } GoTo(JumpTo); Open_Buffer_Unsynch(); return 1; } #else //MEDIAINFO_DEMUX return (size_t)-1; //Not supported #endif //MEDIAINFO_DEMUX case 3 : //FrameNumber #if MEDIAINFO_DEMUX { //Looking for video stream std::map::iterator Stream; for (Stream=Streams.begin(); Stream!=Streams.end(); ++Stream) if (Stream->second.StreamKind==Stream_Video) break; if (Stream==Streams.end()) for (Stream=Streams.begin(); Stream!=Streams.end(); ++Stream) if (Stream->second.StreamKind==Stream_Audio) break; if (Stream==Streams.end()) return 0; //Not supported //Searching the I-Frame if (!Stream->second.stss.empty()) { for (size_t Pos=0; Possecond.stss.size(); Pos++) if (Value<=Stream->second.stss[Pos]) { if (Pos && Valuesecond.stss[Pos]) Value=Stream->second.stss[Pos-1]; break; } } //Searching the corresponding stco std::vector::iterator Stsc=Stream->second.stsc.begin(); int64u SamplePos=0; for (; Stsc!=Stream->second.stsc.end(); ++Stsc) { std::vector::iterator Stsc_Next=Stsc; ++Stsc_Next; int64u CountOfSamples=((Stsc_Next==Stream->second.stsc.end()?Stream->second.stco.size():Stsc_Next->FirstChunk)-Stsc->FirstChunk)*Stsc->SamplesPerChunk; if (Stsc_Next!=Stream->second.stsc.end() && Value>=SamplePos+CountOfSamples) SamplePos+=CountOfSamples; else { int64u CountOfChunks=(Value-SamplePos)/Stsc->SamplesPerChunk; size_t stco_Pos=(size_t)(Stsc->FirstChunk-1+CountOfChunks); //-1 because first chunk is number 1 if (stco_Pos>Stream->second.stco.size()) return 2; //Invalid value int64u Offset=Stream->second.stco[stco_Pos]; //Seeking back to audio/text frames before this video frame if (!StreamOffset_Jump.empty()) { if (stco_Pos==0) //The first Stco is considered as the last byte of previous stram { if (!mdat_Pos.empty()) Offset=mdat_Pos.begin()->first; } else { std::map::iterator StreamOffset_Jump_Temp=StreamOffset_Jump.find(Stream->second.stco[stco_Pos]); if (StreamOffset_Jump_Temp!=StreamOffset_Jump.end()) Offset=StreamOffset_Jump_Temp->second; } } else { //TODO } GoTo(Offset); Open_Buffer_Unsynch(); return 1; } } return 2; //Invalid value } #else //MEDIAINFO_DEMUX return (size_t)-1; //Not supported #endif //MEDIAINFO_DEMUX default : return 0; } } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpeg4::Read_Buffer_Init() { if (MediaInfoLib::Config.ParseSpeed_Get()==1.00) FrameCount_MaxPerStream=(int64u)-1; else if (MediaInfoLib::Config.ParseSpeed_Get()<=0.3) FrameCount_MaxPerStream=128; else FrameCount_MaxPerStream=512; } //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- bool File_Mpeg4::Header_Begin() { #if MEDIAINFO_DEMUX //Handling of multiple frames in one block if (IsParsing_mdat && Config->Demux_Unpacketize_Get() && Streams[(int32u)Element_Code].Demux_EventWasSent) { Open_Buffer_Continue(Streams[(int32u)Element_Code].Parsers[0], Buffer+Buffer_Offset, 0); if (Config->Demux_EventWasSent) return false; Stream->second.Demux_EventWasSent=false; } #endif //MEDIAINFO_DEMUX if (IsParsing_mdat && Element_Level==0) Element_Begin0(); return true; } //--------------------------------------------------------------------------- void File_Mpeg4::Header_Parse() { //mdat if (IsParsing_mdat) { //Positionning if (mdat_Pos_Temp==mdat_Pos.end() || File_Offset+Buffer_Offsetfirst) { Header_Fill_Code(0, "(Junk)"); int64u Size=mdat_Pos_Temp==mdat_Pos.end()?Element_TotalSize_Get():(mdat_Pos_Temp->first-(File_Offset+Buffer_Offset)); if (Size>1 && Size>=Buffer_MaximumSize/2) Size=Buffer_MaximumSize; if (Size==Element_TotalSize_Get()) IsParsing_mdat=false; Header_Fill_Size(Size); return; } //Filling Header_Fill_Code(mdat_Pos_Temp->second.StreamID, Ztring::ToZtring(mdat_Pos_Temp->second.StreamID)); Header_Fill_Size(mdat_Pos_Temp->second.Size); if (Buffer_Offset+mdat_Pos_Temp->second.Size<=Buffer_Size) //Only if we will not need it later (in case of partial data, this function will be called again for the same chunk) { mdat_Pos_Temp++; while (mdat_Pos_Temp!=mdat_Pos.end()) { if (mdat_Pos_NormalParsing && !Streams[mdat_Pos_Temp->second.StreamID].IsPriorityStream) break; if (!mdat_Pos_NormalParsing && Streams[mdat_Pos_Temp->second.StreamID].IsPriorityStream) break; mdat_Pos_Temp++; } } else Element_WaitForMoreData(); return; } //Parsing int64u Size; int32u Size_32, Name; Get_B4 (Size_32, "Size"); if (Size_32==0 && (Element_Size==4 || Element_Size==8)) { //Filling Header_Fill_Code(0, "Junk"); Header_Fill_Size(4); return; } Size=Size_32; Get_C4 (Name, "Name"); if (Name==0x33647666) //3dvf Name=0x6D6F6F76; //moov if (Name==0x61766964) //avid Name=0x6D646174; //mdat if (Size<8) { //Special case: until the end of the atom if (Size==0) { Size=Config->File_Current_Size-(File_Offset+Buffer_Offset); if (Status[IsAccepted] && Element_Level==2 && Name==0x00000000) //First real level (Level 1 is atom, level 2 is header block) { Element_Offset=0; Name=Elements::mdat; } } //Special case: Big files, size is 64-bit else if (Size==1) { //Reading Extended size Get_B8 (Size, "Size (Extended)"); } //Not in specs! else { Size=Config->File_Current_Size-(File_Offset+Buffer_Offset); } } //Specific case: file begin with "free" atom if (!Status[IsAccepted] && (Name==Elements::free || Name==Elements::skip || Name==Elements::wide)) { Accept("MPEG-4"); Fill(Stream_General, 0, General_Format, "QuickTime"); } //Filling Header_Fill_Code(Name, Ztring().From_CC4(Name)); Header_Fill_Size(Size); } //--------------------------------------------------------------------------- struct Mpeg4_muxing { int64u MinimalOffset; int64u MaximalOffset; Mpeg4_muxing() { MinimalOffset=(int64u)-1; MaximalOffset=0; } }; bool File_Mpeg4::BookMark_Needed() { #if MEDIAINFO_MD5 if (!mdat_MustParse && !mdat_Pos_NormalParsing && Config->File_Md5_Get() && FirstMdatPos0) Element_End0(); mdat_Pos_NormalParsing=true; GoTo(0); IsSecondPass=true; return false; } #endif //MEDIAINFO_MD5 if (!mdat_MustParse) return false; //Handling of some wrong stsz and stsc atoms (ADPCM) if (!IsSecondPass) for (std::map::iterator Temp=Streams.begin(); Temp!=Streams.end(); ++Temp) if (Temp->second.StreamKind==Stream_Audio && (Retrieve(Stream_Audio, Temp->second.StreamPos, Audio_CodecID)==__T("ima4") || Retrieve(Stream_Audio, Temp->second.StreamPos, Audio_CodecID)==__T("11"))) { Temp->second.stsz_StreamSize/=16; Temp->second.stsz_StreamSize*=17; float32 BitRate_Nominal=Retrieve(Stream_Audio, Temp->second.StreamPos, Audio_BitRate_Nominal).To_float32(); if (BitRate_Nominal) { BitRate_Nominal/=16; BitRate_Nominal*=17; Fill(Stream_Audio, Temp->second.StreamPos, Audio_BitRate_Nominal, BitRate_Nominal, 0, true); } int64u Channels=Retrieve(Stream_Audio, Temp->second.StreamPos, Audio_Channel_s_).To_int64u(); if (Channels!=2) { Temp->second.stsz_StreamSize/=2; Temp->second.stsz_StreamSize*=Channels; } for (size_t Pos=0; Possecond.stsc.size(); Pos++) { Temp->second.stsc[Pos].SamplesPerChunk/=16; Temp->second.stsc[Pos].SamplesPerChunk*=17; if (Channels!=2) { Temp->second.stsc[Pos].SamplesPerChunk/=2; Temp->second.stsc[Pos].SamplesPerChunk*=(int32u)Channels; } } } //In case of second pass if (mdat_Pos.empty()) { std::map Muxing; //key is StreamID size_t stco_Count=(size_t)-1; bool stco_IsDifferent=false; //For each stream for (std::map::iterator Temp=Streams.begin(); Temp!=Streams.end(); ++Temp) if (!Temp->second.Parsers.empty()) { if (!Temp->second.File_Name.empty()) { #if MEDIAINFO_DEMUX if (Config_Demux && Config->File_Demux_Interleave_Get() && Temp->second.StreamKind!=Stream_Other) // e.g. a time code, we can live without demuxing the time code { //Remark: supporting both embedded and referenced streams is currently not supported mdat_Pos.clear(); return false; } else #endif // MEDIAINFO_DEMUX continue; } if (!Temp->second.stsz.empty() || Temp->second.stsz_Sample_Size) { if (!stco_IsDifferent) { if (stco_Count==(size_t)-1) stco_Count=Temp->second.stco.size(); else if (stco_Count!=Temp->second.stco.size()) stco_IsDifferent=true; } size_t stsc_Pos=0; size_t stsz_Pos=0; size_t Chunk_FrameCount=0; int32u Chunk_Number=1; int32u Sample_ByteSize=0; if (Temp->second.StreamKind==Stream_Audio) Sample_ByteSize=Retrieve(Stream_Audio, Temp->second.StreamPos, Audio_BitDepth).To_int32u()*Retrieve(Stream_Audio, Temp->second.StreamPos, Audio_Channel_s_).To_int32u()/8; #if MEDIAINFO_DEMUX stream::stts_durations Temp_stts_Durations; #endif //MEDIAINFO_DEMUX for (size_t stco_Pos=0; stco_Possecond.stco.size(); stco_Pos++) { if (Muxing[Temp->first].MinimalOffset>Temp->second.stco[stco_Pos]) Muxing[Temp->first].MinimalOffset=Temp->second.stco[stco_Pos]; if (Muxing[Temp->first].MaximalOffsetsecond.stco[stco_Pos]) Muxing[Temp->first].MaximalOffset=Temp->second.stco[stco_Pos]; while (stsc_Pos+1second.stsc.size() && Chunk_Number>=Temp->second.stsc[stsc_Pos+1].FirstChunk) stsc_Pos++; if (Temp->second.stsz_Sample_Size==0) { //Each sample has its own size int64u Chunk_Offset=0; for (size_t Pos=0; Possecond.stsc[stsc_Pos].SamplesPerChunk; Pos++) if (Temp->second.stsz[stsz_Pos]) { mdat_Pos[Temp->second.stco[stco_Pos]+Chunk_Offset].StreamID=Temp->first; mdat_Pos[Temp->second.stco[stco_Pos]+Chunk_Offset].Size=Temp->second.stsz[stsz_Pos]; Chunk_Offset+=Temp->second.stsz[stsz_Pos]; stsz_Pos++; if (stsz_Pos>=Temp->second.stsz.size()) break; } if (stsz_Pos>=Temp->second.stsz.size()) break; } else if (Temp->second.IsPcm && (!Sample_ByteSize || Temp->second.stsz_Sample_Size<=Sample_ByteSize) && Temp->second.stsc[stsc_Pos].SamplesPerChunk*Temp->second.stsz_Sample_Size*Temp->second.stsz_Sample_Multiplier<0x1000000) { //Same size per sample, but granularity is too small mdat_Pos[Temp->second.stco[stco_Pos]].StreamID=Temp->first; mdat_Pos[Temp->second.stco[stco_Pos]].Size=Temp->second.stsc[stsc_Pos].SamplesPerChunk*Temp->second.stsz_Sample_Size*Temp->second.stsz_Sample_Multiplier; #if MEDIAINFO_DEMUX if (Temp_stts_Durations.empty() || Temp->second.stsc[stsc_Pos].SamplesPerChunk!=Temp_stts_Durations[Temp_stts_Durations.size()-1].SampleDuration) { stream::stts_duration stts_Duration; stts_Duration.Pos_Begin=Temp_stts_Durations.empty()?0:Temp_stts_Durations[Temp_stts_Durations.size()-1].Pos_End; stts_Duration.Pos_End=stts_Duration.Pos_Begin+1; stts_Duration.SampleDuration=Temp->second.stsc[stsc_Pos].SamplesPerChunk; stts_Duration.DTS_Begin=Temp_stts_Durations.empty()?0:Temp_stts_Durations[Temp_stts_Durations.size()-1].DTS_End; stts_Duration.DTS_End=stts_Duration.DTS_Begin+stts_Duration.SampleDuration; Temp_stts_Durations.push_back(stts_Duration); //Temp->second.stsc[stsc_Pos].SamplesPerChunk=1; } else { Temp_stts_Durations[Temp_stts_Durations.size()-1].Pos_End++; Temp_stts_Durations[Temp_stts_Durations.size()-1].DTS_End+=Temp_stts_Durations[Temp_stts_Durations.size()-1].SampleDuration; } #endif //MEDIAINFO_DEMUX } else if (stsc_Possecond.stsc.size()) { //Same size per sample int64u Chunk_Offset=0; for (size_t Pos=0; Possecond.stsc[stsc_Pos].SamplesPerChunk; Pos++) if (Temp->second.stsz_Sample_Size*Temp->second.stsz_Sample_Multiplier) { mdat_Pos[Temp->second.stco[stco_Pos]+Chunk_Offset].StreamID=Temp->first; mdat_Pos[Temp->second.stco[stco_Pos]+Chunk_Offset].Size=Temp->second.stsz_Sample_Size*Temp->second.stsz_Sample_Multiplier; Chunk_Offset+=Temp->second.stsz_Sample_Size*Temp->second.stsz_Sample_Multiplier; Chunk_FrameCount++; } if (Chunk_FrameCount>=FrameCount_MaxPerStream) break; } Chunk_Number++; } for (size_t Pos=0; Possecond.Parsers.size(); Pos++) Temp->second.Parsers[Pos]->Stream_BitRateFromContainer=Temp->second.stsz_StreamSize*8/(((float64)Temp->second.stts_Duration)/Temp->second.mdhd_TimeScale); #if MEDIAINFO_DEMUX if (FrameCount_MaxPerStream==(int64u)-1 && !Temp_stts_Durations.empty()) { Temp->second.stts_Durations=Temp_stts_Durations; for (stsc_Pos=0; stsc_Possecond.stsc.size(); stsc_Pos++) Temp->second.stsc[stsc_Pos].SamplesPerChunk=1; Temp->second.stts_FrameCount=Temp_stts_Durations[Temp_stts_Durations.size()-1].Pos_End; } #endif //MEDIAINFO_DEMUX } //special cases #if MEDIAINFO_DEMUX if (Temp->second.stsz.empty() && Temp->second.StreamKind==Stream_Video && Retrieve(Stream_Video, Temp->second.StreamPos, Video_CodecID)==__T("AV1x")) { //Found unknown data before the raw content int64u Width=Retrieve(Stream_Video, Temp->second.StreamPos, Video_Width).To_int64u(); int64u Height=Retrieve(Stream_Video, Temp->second.StreamPos, Video_Height).To_int64u(); if (Width && Height && Temp->second.stsz_Sample_Size>(Width*Height*2)) Temp->second.Demux_Offset=Temp->second.stsz_Sample_Size-(Width*Height*2); // YUV 4:2:2 8 bit = 2 bytes per pixel } #endif //MEDIAINFO_DEMUX } mdat_Pos_Temp=mdat_Pos.begin(); #if MEDIAINFO_DEMUX if (!stco_IsDifferent && Muxing.size()==2) { std::map::iterator Muxing_1=Muxing.begin(); std::map::iterator Muxing_2=Muxing.begin(); ++Muxing_2; if (Muxing_1->second.MaximalOffset>Muxing_2->second.MinimalOffset) swap(Muxing_1, Muxing_2); if (Muxing_1->second.MaximalOffset<=Muxing_2->second.MinimalOffset) { for (size_t stco_Pos=1; stco_Posfirst].stco[stco_Pos]]=Streams[Muxing_2->first].stco[stco_Pos-1]; StreamOffset_Jump[Streams[Muxing_2->first].stco[stco_Pos]]=Streams[Muxing_1->first].stco[stco_Pos]; } StreamOffset_Jump[Streams[Muxing_2->first].stco[0]]=Streams[Muxing_2->first].stco[stco_Count-1]; } } #endif //MEDIAINFO_DEMUX } if (mdat_Pos.empty()) return false; IsParsing_mdat=false; if (!mdat_Pos_ToParseInPriority_StreamIDs.empty()) { //Hanlding StreamIDs to parse in priority (currently, only the first block of each stream is parsed in priority) if (!Streams[mdat_Pos_ToParseInPriority_StreamIDs[0]].stco.empty()) { mdat_pos::iterator Temp=mdat_Pos.find(Streams[mdat_Pos_ToParseInPriority_StreamIDs[0]].stco[0]); if (Temp!=mdat_Pos.end() && Temp->first0) Element_End0(); Element_Begin1("Priority streams"); mdat_Pos_Temp=Temp; GoTo(Temp->first); IsParsing_mdat=true; } } mdat_Pos_ToParseInPriority_StreamIDs.erase(mdat_Pos_ToParseInPriority_StreamIDs.begin()); } if (File_GoTo==(int64u)-1 && !mdat_Pos_NormalParsing && !mdat_Pos.empty() && mdat_Pos.begin()->first0) Element_End0(); Element_Begin1("Second pass"); mdat_Pos_Temp=mdat_Pos.begin(); #if MEDIAINFO_MD5 if (Config->File_Md5_Get()) { GoTo(0); Md5_ParseUpTo=mdat_Pos_Temp->first; } else #endif //MEDIAINFO_MD5 GoTo(mdat_Pos_Temp->first); IsParsing_mdat=true; mdat_Pos_NormalParsing=true; } IsSecondPass=true; return false; //We do not want to use the bookmark feature, only detect the end of the file } //--------------------------------------------------------------------------- //Get language string from 2CC Ztring File_Mpeg4::Language_Get(int16u Language) { if (Language==0x7FFF || Language==0xFFFF) return Ztring(); if (Language<0x100) return Mpeg4_Language_Apple(Language); Ztring ToReturn; ToReturn.append(1, (Char)((Language>>10&0x1F)+0x60)); ToReturn.append(1, (Char)((Language>> 5&0x1F)+0x60)); ToReturn.append(1, (Char)((Language>> 0&0x1F)+0x60)); return ToReturn; } //--------------------------------------------------------------------------- //Get Metadata definition from 4CC File_Mpeg4::method File_Mpeg4::Metadata_Get(std::string &Parameter, int64u Meta) { File_Mpeg4::method Method; switch (Meta) { //http://atomicparsley.sourceforge.net/mpeg-4files.html //http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/QuickTime.html#ItemList case Elements::moov_meta___alb : Parameter="Album"; Method=Method_String; break; case Elements::moov_meta___ard : Parameter="Director"; Method=Method_String; break; case Elements::moov_meta___arg : Parameter="Arranger"; Method=Method_String; break; case Elements::moov_meta___ART : Parameter="Performer"; Method=Method_String; break; case Elements::moov_meta___aut : Parameter="Performer"; Method=Method_String; break; case Elements::moov_meta___con : Parameter="Conductor"; Method=Method_String; break; case Elements::moov_meta___cmt : Parameter="Comment"; Method=Method_String; break; case Elements::moov_meta___cpy : Parameter="Copyright"; Method=Method_String; break; case Elements::moov_meta___day : Parameter="Recorded_Date"; Method=Method_String; break; case Elements::moov_meta___des : Parameter="Title/More"; Method=Method_String; break; case Elements::moov_meta___dir : Parameter="Director"; Method=Method_String; break; case Elements::moov_meta___dis : Parameter="TermsOfUse"; Method=Method_String; break; case Elements::moov_meta___edl : Parameter="Tagged_Date"; Method=Method_String; break; case Elements::moov_meta___enc : Parameter="Encoded_Application"; Method=Method_String; break; case Elements::moov_meta___fmt : Parameter="Origin"; Method=Method_String; break; case Elements::moov_meta___gen : Parameter="Genre"; Method=Method_String; break; case Elements::moov_meta___grp : Parameter="Grouping"; Method=Method_String; break; case Elements::moov_meta___hos : Parameter="HostComputer"; Method=Method_String; break; case Elements::moov_meta___inf : Parameter="Title/More"; Method=Method_String; break; case Elements::moov_meta___key : Parameter="Keywords"; Method=Method_String; break; case Elements::moov_meta___lyr : Parameter="Lyrics"; Method=Method_String; break; case Elements::moov_meta___mak : Parameter="Make"; Method=Method_String; break; case Elements::moov_meta___mod : Parameter="Model"; Method=Method_String; break; case Elements::moov_meta___nam : Parameter="Title"; Method=Method_String3; break; case Elements::moov_meta___ope : Parameter="Original/Performer"; Method=Method_String; break; case Elements::moov_meta___prd : Parameter="Producer"; Method=Method_String; break; case Elements::moov_meta___PRD : Parameter="Product"; Method=Method_String; break; case Elements::moov_meta___prf : Parameter="Performer"; Method=Method_String; break; case Elements::moov_meta___req : Parameter="Comment"; Method=Method_String; break; case Elements::moov_meta___sne : Parameter="SoundEngineer"; Method=Method_String; break; case Elements::moov_meta___sol : Parameter="Conductor"; Method=Method_String; break; case Elements::moov_meta___src : Parameter="DistributedBy"; Method=Method_String; break; case Elements::moov_meta___st3 : Parameter="Subtitle"; Method=Method_String; break; case Elements::moov_meta___swr : Parameter="Encoded_Application"; Method=Method_String; break; case Elements::moov_meta___too : Parameter="Encoded_Application"; Method=Method_String; break; case Elements::moov_meta___url : Parameter="Track/Url"; Method=Method_String; break; case Elements::moov_meta___wrn : Parameter="Warning"; Method=Method_String; break; case Elements::moov_meta___wrt : Parameter="Composer"; Method=Method_String; break; case Elements::moov_meta___xpd : Parameter="ExecutiveProducer"; Method=Method_String; break; case Elements::moov_meta__aART : Parameter="Album/Performer"; Method=Method_String2; break; case Elements::moov_meta__akID : Parameter="AppleStoreAccountType"; Method=Method_Binary; break; case Elements::moov_meta__albm : Parameter="Album"; Method=Method_String2; break; //Has a optional track number after the NULL byte case Elements::moov_meta__apID : Parameter="AppleStoreAccount"; Method=Method_String; break; case Elements::moov_meta__atID : Parameter="AlbumTitleID"; Method=Method_Binary; break; case Elements::moov_meta__auth : Parameter="Performer"; Method=Method_String2; break; case Elements::moov_meta__catg : Parameter="Category"; Method=Method_String; break; case Elements::moov_meta__cnID : Parameter="AppleStoreCatalogID"; Method=Method_String; break; case Elements::moov_meta__cpil : Parameter="Compilation"; Method=Method_Binary; break; case Elements::moov_meta__cprt : Parameter="Copyright"; Method=Method_String2; break; case Elements::moov_meta__desc : Parameter="Description"; Method=Method_String; break; case Elements::moov_meta__disk : Parameter="Part"; Method=Method_Binary; break; case Elements::moov_meta__dscp : Parameter="Title/More"; Method=Method_String2; break; case Elements::moov_meta__egid : Parameter="EpisodeGlobalUniqueID"; Method=Method_Binary; break; case Elements::moov_meta__flvr : Parameter="Flavour"; Method=Method_Binary; break; case Elements::moov_meta__gnre : Parameter="Genre"; Method=Method_String2; break; case Elements::moov_meta__geID : Parameter="GenreID"; Method=Method_Binary; break; case Elements::moov_meta__grup : Parameter="Grouping"; Method=Method_String; break; case Elements::moov_meta__hdvd : Parameter="HDVideo"; Method=Method_Binary; break; case Elements::moov_meta__itnu : Parameter="iTunesU"; Method=Method_Binary; break; case Elements::moov_meta__keyw : Parameter="Keyword"; Method=Method_String; break; case Elements::moov_meta__ldes : Parameter="LongDescription"; Method=Method_String; break; case Elements::moov_meta__name : Parameter="Title"; Method=Method_String; break; case Elements::moov_meta__pcst : Parameter="Podcast"; Method=Method_Binary; break; case Elements::moov_meta__perf : Parameter="Performer"; Method=Method_String2; break; case Elements::moov_meta__pgap : Parameter.clear(); Method=Method_None; break; case Elements::moov_meta__plID : Parameter="PlayListID"; Method=Method_Binary; break; case Elements::moov_meta__purd : Parameter="PurchaseDate"; Method=Method_String; break; case Elements::moov_meta__purl : Parameter="PodcastURL"; Method=Method_String; break; case Elements::moov_meta__rate : Parameter="Rating"; Method=Method_Binary; break; case Elements::moov_meta__rtng : Parameter="Rating"; Method=Method_Binary; break; case Elements::moov_meta__sdes : Parameter="Description"; Method=Method_String; break; case Elements::moov_meta__sfID : Parameter="AppleStoreCountry"; Method=Method_Binary; break; case Elements::moov_meta__soaa : Parameter="Album/Performer/Sort"; Method=Method_String; break; //SortAlbumArtist case Elements::moov_meta__soal : Parameter="Album/Sort"; Method=Method_String2; break; //SortAlbum case Elements::moov_meta__soar : Parameter="Performer/Sort"; Method=Method_String; break; //SortArtist case Elements::moov_meta__soco : Parameter="Composer/Sort"; Method=Method_String; break; //SortComposer case Elements::moov_meta__sonm : Parameter="Title/Sort"; Method=Method_String; break; //SortName case Elements::moov_meta__sosn : Parameter="Title/Sort"; Method=Method_String; break; //SortShow case Elements::moov_meta__stik : Parameter="ContentType"; Method=Method_Binary; break; case Elements::moov_meta__titl : Parameter="Title"; Method=Method_String2; break; case Elements::moov_meta__tool : Parameter="Encoded_Application"; Method=Method_String3; break; case Elements::moov_meta__tmpo : Parameter="BPM"; Method=Method_Binary; break; case Elements::moov_meta__trkn : Parameter="Track"; Method=Method_Binary; break; case Elements::moov_meta__tven : Parameter="Part_ID"; Method=Method_Binary; break; //TVEpisodeID case Elements::moov_meta__tves : Parameter="Part"; Method=Method_String; break; //TVEpisode case Elements::moov_meta__tvnn : Parameter="TVNetworkName"; Method=Method_String; break; case Elements::moov_meta__tvsh : Parameter="Title"; Method=Method_String; break; //TVShow case Elements::moov_meta__tvsn : Parameter="Season"; Method=Method_String; break; //TVSeason case Elements::moov_meta__xid_ : Parameter="Vendor"; Method=Method_String; break; case Elements::moov_meta__year : Parameter="Recorded_Date"; Method=Method_String2; break; case Elements::moov_meta__yyrc : Parameter="Recorded_Date"; Method=Method_String2; break; default : { Parameter.clear(); Parameter.append(1, (char)((Meta&0xFF000000)>>24)); Parameter.append(1, (char)((Meta&0x00FF0000)>>16)); Parameter.append(1, (char)((Meta&0x0000FF00)>> 8)); Parameter.append(1, (char)((Meta&0x000000FF)>> 0)); Method=Method_String; } } Ztring Value; Value.append(1, (Char)((Meta&0xFF000000)>>24)); //Can not use From_CC4 because there is sometimes the (C) character, not in Ansi 7-bit, so wrongly decoded on UTF-8 systems Value.append(1, (Char)((Meta&0x00FF0000)>>16)); Value.append(1, (Char)((Meta&0x0000FF00)>> 8)); Value.append(1, (Char)((Meta&0x000000FF)>> 0)); if (MediaInfoLib::Config.CustomMapping_IsPresent(__T("MP4"), Value)) Parameter=MediaInfoLib::Config.CustomMapping_Get(__T("MP4"), Value).To_Local(); return Method; } //--------------------------------------------------------------------------- //Get Metadata definition from string File_Mpeg4::method File_Mpeg4::Metadata_Get(std::string &Parameter, const std::string &Meta) { if (Meta=="com.apple.quicktime.copyright") Parameter="Copyright"; else if (Meta=="com.apple.quicktime.displayname") Parameter="Title"; else if (Meta=="DATE") Parameter="Encoded_Date"; else if (Meta=="iTunEXTC") Parameter="ContentRating"; else if (Meta=="iTunMOVI") Parameter="iTunMOVI"; else if (Meta=="iTunNORM") Parameter=""; else if (Meta=="iTunes_CDDB_IDs") Parameter=""; else if (Meta=="iTunSMPB") Parameter=""; else if (Meta=="PERFORMER") Parameter="Performer"; else if (Meta=="PUBLISHER") Parameter="Publisher"; else Parameter=Meta; return Method_String; } //--------------------------------------------------------------------------- void File_Mpeg4::Descriptors() { //Preparing File_Mpeg4_Descriptors MI; MI.KindOfStream=StreamKind_Last; MI.PosOfStream=StreamPos_Last; MI.Parser_DoNotFreeIt=true; int64u Elemen_Code_Save=Element_Code; Element_Code=moov_trak_tkhd_TrackID; //Element_Code is use for stream identifier Open_Buffer_Init(&MI); Element_Code=Elemen_Code_Save; mdat_MustParse=true; //Data is in MDAT //Parsing Open_Buffer_Continue(&MI); //Filling Finish(&MI); Merge(MI, StreamKind_Last, 0, StreamPos_Last); //Special case: AAC if (StreamKind_Last==Stream_Audio && (Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)==__T("AAC") || Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)==__T("MPEG Audio") || Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)==__T("Vorbis"))) Clear(Stream_Audio, StreamPos_Last, Audio_BitDepth); //Resolution is not valid for AAC / MPEG Audio / Vorbis //Parser from Descriptor if (MI.Parser) { for (size_t Pos=0; Pos::iterator Strea=Streams.begin(); Strea!=Streams.end(); ++Strea) if (Strea->second.TimeCode_TrackID!=(int32u)-1) { if (TimeCode_TrackID==(int32u)-1) TimeCode_TrackID=Strea->second.TimeCode_TrackID; else TimeCode_TrackID_MoreThanOne=true; } if (!TimeCode_TrackID_MoreThanOne && TimeCode_TrackID!=(int32u)-1) for (std::map::iterator Strea=Streams.begin(); Strea!=Streams.end(); ++Strea) Strea->second.TimeCode_TrackID=TimeCode_TrackID; //For all tracks actually //Is it general or for a specific stream? bool IsGeneral=true; for (std::map::iterator Strea=Streams.begin(); Strea!=Streams.end(); ++Strea) if (Strea->second.TimeCode_TrackID==TrackID) IsGeneral=false; //For each track in the file (but only the last one will be used!) for (std::map::iterator Strea=Streams.begin(); Strea!=Streams.end(); ++Strea) if (!Streams[TrackID].Parsers.empty() && (IsGeneral && Strea->second.StreamKind!=Stream_Max) || Strea->second.TimeCode_TrackID==TrackID) { if (Strea->second.StreamKind==Stream_Video) { Fill(Stream_Video, Strea->second.StreamPos, Video_Delay_Settings, Ztring(__T("DropFrame="))+(Streams[TrackID].TimeCode->DropFrame?__T("Yes"):__T("No"))); Fill(Stream_Video, Strea->second.StreamPos, Video_Delay_Settings, Ztring(__T("24HourMax="))+(Streams[TrackID].TimeCode->H24?__T("Yes"):__T("No"))); Fill(Stream_Video, Strea->second.StreamPos, Video_Delay_Settings, Ztring(__T("IsVisual="))+(Streams[TrackID].TimeCode_IsVisual?__T("Yes"):__T("No"))); } if (Strea->second.StreamKind!=Stream_Other) { Fill(Strea->second.StreamKind, Strea->second.StreamPos, "Delay", Streams[TrackID].Parsers[0]->Get(Stream_General, 0, "Delay")); Fill(Strea->second.StreamKind, Strea->second.StreamPos, "Delay_DropFrame", Streams[TrackID].TimeCode->DropFrame?__T("Yes"):__T("No")); Fill(Strea->second.StreamKind, Strea->second.StreamPos, "Delay_Source", "Container"); } //Fill(Strea->second.StreamKind, Strea->second.StreamPos, "TimeCode_FirstFrame", Streams[TrackID].Parsers[0]->Get(Stream_General, 0, "TimeCode_FirstFrame")); //Fill(Strea->second.StreamKind, Strea->second.StreamPos, "TimeCode_Source", Streams[TrackID].Parsers[0]->Get(Stream_General, 0, "TimeCode_Source")); } } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_MPEG4_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Mpeg4.h100777 0 0 44601 12253103107 15450 0/* 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. */ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_Mpeg4H #define MediaInfo_File_Mpeg4H //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include "MediaInfo/MediaInfo_Internal.h" class File_MpegPs; //--------------------------------------------------------------------------- namespace MediaInfoLib { class File__ReferenceFilesHelper; //*************************************************************************** // Class File_Mpeg4 //*************************************************************************** class File_Mpeg4 : public File__Analyze { protected : //Streams management void Streams_Accept(); void Streams_Finish(); void Streams_Finish_CommercialNames (); public : File_Mpeg4(); ~File_Mpeg4(); private : //Buffer - Global void Read_Buffer_Init(); void Read_Buffer_Unsynched(); #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK //Buffer bool Header_Begin(); void Header_Parse(); void Data_Parse(); bool BookMark_Needed(); //Elements void bloc(); void cdat(); void cdt2() {cdat();} void free(); void ftyp(); void idat(); void idsc(); void jp2c(); void jp2h(); void jp2h_ihdr(); void jp2h_colr(); void mdat(); void mdat_xxxx(); void mdat_StreamJump(); void mfra(); void mfra_mfro(); void mfra_tfra(); void moof(); void moof_mfhd(); void moof_traf(); void moof_traf_sdtp(); void moof_traf_tfhd(); void moof_traf_trun(); void moov(); void moov_ainf(); void moov_cmov(); void moov_cmov_cmvd(); void moov_cmov_cmvd_zlib(); void moov_cmov_dcom(); void moov_ctab(); void moov_iods(); void moov_meta(); void moov_meta_hdlr(); void moov_meta_bxml(); void moov_meta_keys(); void moov_meta_keys_mdta(); void moov_meta_ilst(); void moov_meta_ilst_xxxx(); void moov_meta_ilst_xxxx_data(); void moov_meta_ilst_xxxx_mean(); void moov_meta_ilst_xxxx_name(); void moov_meta_xml(); void moov_mvex(); void moov_mvex_mehd(); void moov_mvex_trex(); void moov_mvhd(); void moov_trak(); void moov_trak_edts(); void moov_trak_edts_elst(); void moov_trak_load(); void moov_trak_mdia(); void moov_trak_mdia_hdlr(); void moov_trak_mdia_imap(); void moov_trak_mdia_imap_sean(); void moov_trak_mdia_imap_sean___in(); void moov_trak_mdia_imap_sean___in___ty(); void moov_trak_mdia_imap_sean___in_dtst(); void moov_trak_mdia_imap_sean___in_obid(); void moov_trak_mdia_mdhd(); void moov_trak_mdia_minf(); void moov_trak_mdia_minf_code(); void moov_trak_mdia_minf_code_sean(); void moov_trak_mdia_minf_code_sean_RU_A(); void moov_trak_mdia_minf_dinf(); void moov_trak_mdia_minf_dinf_url_(); void moov_trak_mdia_minf_dinf_urn_(); void moov_trak_mdia_minf_dinf_dref(); void moov_trak_mdia_minf_dinf_dref_alis(); void moov_trak_mdia_minf_dinf_dref_rsrc(); void moov_trak_mdia_minf_gmhd(); void moov_trak_mdia_minf_gmhd_gmin(); void moov_trak_mdia_minf_gmhd_tmcd(); void moov_trak_mdia_minf_gmhd_tmcd_tcmi(); void moov_trak_mdia_minf_gmhd_tcmi(); void moov_trak_mdia_minf_hint(); void moov_trak_mdia_minf_hdlr(); void moov_trak_mdia_minf_hmhd(); void moov_trak_mdia_minf_nmhd(); void moov_trak_mdia_minf_smhd(); void moov_trak_mdia_minf_vmhd(); void moov_trak_mdia_minf_stbl(); void moov_trak_mdia_minf_stbl_cslg(); void moov_trak_mdia_minf_stbl_co64(); void moov_trak_mdia_minf_stbl_ctts(); void moov_trak_mdia_minf_stbl_sdtp(); void moov_trak_mdia_minf_stbl_stco(); void moov_trak_mdia_minf_stbl_stdp(); void moov_trak_mdia_minf_stbl_stps(); void moov_trak_mdia_minf_stbl_stsc(); void moov_trak_mdia_minf_stbl_stsd(); void moov_trak_mdia_minf_stbl_stsd_text(); void moov_trak_mdia_minf_stbl_stsd_tmcd(); void moov_trak_mdia_minf_stbl_stsd_tmcd_name(); void moov_trak_mdia_minf_stbl_stsd_tx3g(); void moov_trak_mdia_minf_stbl_stsd_tx3g_ftab(); void moov_trak_mdia_minf_stbl_stsd_xxxx(); void moov_trak_mdia_minf_stbl_stsd_xxxxSound(); void moov_trak_mdia_minf_stbl_stsd_xxxxStream(); void moov_trak_mdia_minf_stbl_stsd_xxxxText(); void moov_trak_mdia_minf_stbl_stsd_xxxxVideo(); void moov_trak_mdia_minf_stbl_stsd_xxxx_alac(); void moov_trak_mdia_minf_stbl_stsd_xxxx_ACLR(); void moov_trak_mdia_minf_stbl_stsd_xxxx_APRG(); void moov_trak_mdia_minf_stbl_stsd_xxxx_ARES(); void moov_trak_mdia_minf_stbl_stsd_xxxx_avcC(); void moov_trak_mdia_minf_stbl_stsd_xxxx_bitr(); void moov_trak_mdia_minf_stbl_stsd_xxxx_btrt(); void moov_trak_mdia_minf_stbl_stsd_xxxx_chan(); void moov_trak_mdia_minf_stbl_stsd_xxxx_clap(); void moov_trak_mdia_minf_stbl_stsd_xxxx_colr(); void moov_trak_mdia_minf_stbl_stsd_xxxx_d263(); void moov_trak_mdia_minf_stbl_stsd_xxxx_dac3(); void moov_trak_mdia_minf_stbl_stsd_xxxx_damr(); void moov_trak_mdia_minf_stbl_stsd_xxxx_dec3(); void moov_trak_mdia_minf_stbl_stsd_xxxx_ddts(); void moov_trak_mdia_minf_stbl_stsd_xxxx_dvc1(); void moov_trak_mdia_minf_stbl_stsd_xxxx_esds(); void moov_trak_mdia_minf_stbl_stsd_xxxx_fiel(); void moov_trak_mdia_minf_stbl_stsd_xxxx_glbl(); void moov_trak_mdia_minf_stbl_stsd_xxxx_hvcC(); void moov_trak_mdia_minf_stbl_stsd_xxxx_idfm(); void moov_trak_mdia_minf_stbl_stsd_xxxx_jp2h() {jp2h();} void moov_trak_mdia_minf_stbl_stsd_xxxx_jp2h_colr() {jp2h_colr();} void moov_trak_mdia_minf_stbl_stsd_xxxx_jp2h_ihdr() {jp2h_ihdr();} void moov_trak_mdia_minf_stbl_stsd_xxxx_pasp(); void moov_trak_mdia_minf_stbl_stsd_xxxx_sinf(); void moov_trak_mdia_minf_stbl_stsd_xxxx_sinf_frma(); void moov_trak_mdia_minf_stbl_stsd_xxxx_sinf_imif(); void moov_trak_mdia_minf_stbl_stsd_xxxx_sinf_schm(); void moov_trak_mdia_minf_stbl_stsd_xxxx_sinf_schi(); void moov_trak_mdia_minf_stbl_stsd_xxxx_wave(); void moov_trak_mdia_minf_stbl_stsd_xxxx_wave_acbf(); void moov_trak_mdia_minf_stbl_stsd_xxxx_wave_enda(); void moov_trak_mdia_minf_stbl_stsd_xxxx_wave_frma(); void moov_trak_mdia_minf_stbl_stsd_xxxx_wave_samr(); void moov_trak_mdia_minf_stbl_stsd_xxxx_wave_srcq(); void moov_trak_mdia_minf_stbl_stsd_xxxx_wave_xxxx(); void moov_trak_mdia_minf_stbl_stsh(); void moov_trak_mdia_minf_stbl_stss(); void moov_trak_mdia_minf_stbl_stsz(); void moov_trak_mdia_minf_stbl_stts(); void moov_trak_mdia_minf_stbl_stts_Common(int32u SampleCount, int32u SampleDuration, int32u Pos=0, int32u NumberOfEntries=1); void moov_trak_mdia_minf_stbl_stz2() {moov_trak_mdia_minf_stbl_stsz();} void moov_trak_meta() {moov_meta();} void moov_trak_meta_hdlr() {moov_meta_hdlr();} void moov_trak_meta_bxml() {moov_meta_bxml();} void moov_trak_meta_keys() {moov_meta_keys();} void moov_trak_meta_keys_mdta() {moov_meta_keys_mdta();} void moov_trak_meta_ilst() {moov_meta_ilst();} void moov_trak_meta_ilst_xxxx() {moov_meta_ilst_xxxx();} void moov_trak_meta_ilst_xxxx_data() {moov_meta_ilst_xxxx_data();} void moov_trak_meta_ilst_xxxx_mean() {moov_meta_ilst_xxxx_mean();} void moov_trak_meta_ilst_xxxx_name() {moov_meta_ilst_xxxx_name();} void moov_trak_meta_xml() {moov_meta_xml();} void moov_trak_tapt(); void moov_trak_tapt_clef(); void moov_trak_tapt_prof(); void moov_trak_tapt_enof(); void moov_trak_tkhd(); void moov_trak_tref(); void moov_trak_tref_chap(); void moov_trak_tref_clcp(); void moov_trak_tref_dpnd(); void moov_trak_tref_fall(); void moov_trak_tref_folw(); void moov_trak_tref_forc(); void moov_trak_tref_ipir(); void moov_trak_tref_hint(); void moov_trak_tref_mpod(); void moov_trak_tref_scpt(); void moov_trak_tref_ssrc(); void moov_trak_tref_sync(); void moov_trak_tref_tmcd(); void moov_udta(); void moov_udta_AllF(); void moov_udta_chpl(); void moov_udta_clsf(); void moov_udta_cprt(); void moov_udta_DcMD(); void moov_udta_DcMD_Cmbo(); void moov_udta_DcMD_DcME(); void moov_udta_DcMD_DcME_Keyw(); void moov_udta_DcMD_DcME_Mtmd(); void moov_udta_DcMD_DcME_Rate(); void moov_udta_FIEL(); void moov_udta_FXTC(); void moov_udta_hinf(); void moov_udta_hinv(); void moov_udta_hnti(); void moov_udta_hnti_rtp (); void moov_udta_ID32(); void moov_udta_kywd(); void moov_udta_loci(); void moov_udta_LOOP(); void moov_udta_MCPS(); void moov_udta_meta(); void moov_udta_meta_hdlr(); void moov_udta_meta_ilst(); void moov_udta_meta_ilst_xxxx(); void moov_udta_meta_ilst_xxxx_data(); void moov_udta_meta_ilst_xxxx_mean(); void moov_udta_meta_ilst_xxxx_name(); void moov_udta_ndrm(); void moov_udta_nsav(); void moov_udta_rtng(); void moov_udta_ptv (); void moov_udta_Sel0(); void moov_udta_tags(); void moov_udta_tags_meta(); void moov_udta_tags_tseg(); void moov_udta_tags_tseg_tshd(); void moov_udta_WLOC(); void moov_udta_XMP_(); void moov_udta_yrrc(); void moov_udta_xxxx(); void pdin(); void PICT(); void pckg(); void pnot(); void RDAO(); void RDAS(); void RDVO(); void RDVS(); void RED1(); void REDA(); void REDV(); void REOB(); void skip(); void wide(); //Helpers bool Element_Level_Get(); bool Element_Name_Get(); bool Element_Size_Get(); Ztring Language_Get(int16u Language); enum method { Method_None, Method_String, Method_String2, Method_String3, Method_Integer, Method_Binary }; method Metadata_Get(std::string &Parameter, int64u Meta); method Metadata_Get(std::string &Parameter, const std::string &Meta); void Descriptors(); void TimeCode_Associate(int32u TrackID); //Temp bool List; bool mdat_MustParse; int32u moov_cmov_dcom_Compressor; int32u moov_meta_hdlr_Type; std::string moov_meta_ilst_xxxx_name_Name; size_t moov_trak_mdia_minf_stbl_stsd_Pos; int32u moov_trak_tkhd_TrackID; float32 moov_trak_tkhd_Width; float32 moov_trak_tkhd_Height; float32 moov_trak_tkhd_DisplayAspectRatio; float32 moov_trak_tkhd_Rotation; std::vector moov_udta_meta_keys_List; size_t moov_udta_meta_keys_ilst_Pos; int32u TimeScale; int32u Vendor; Ztring Vendor_Version; int64u FirstMdatPos; int64u LastMdatPos; //This is the position of the byte after the last byte of mdat int64u FirstMoovPos; int64u moof_base_data_offset; int64u FrameCount_MaxPerStream; bool data_offset_present; int64u moof_traf_base_data_offset; int32u moof_traf_default_sample_duration; int32u moof_traf_default_sample_size; int32u MajorBrand; bool IsSecondPass; bool IsParsing_mdat; bool IsFragmented; //Data struct stream { Ztring File_Name; std::vector Parsers; MediaInfo_Internal* MI; struct timecode { int32u TimeScale; int32u FrameDuration; bool DropFrame; bool H24; bool NegativeTimes; }; timecode* TimeCode; stream_t StreamKind; size_t StreamPos; struct edts_struct { int32u Duration; int32u Delay; int32u Rate; }; std::vector edts; std::vector stco; struct stsc_struct { int32u FirstChunk; int32u SamplesPerChunk; }; std::vector stsc; std::vector stsz; std::vector stsz_Total; //TODO: merge with stsz int64u stsz_StreamSize; //TODO: merge with stsz std::vector stss; //Sync Sample, base=0 struct stts_struct { int32u SampleCount; int32u SampleDuration; }; std::vector stts; int64u stsz_Sample_Size; int64u stsz_Sample_Multiplier; int64u stsz_Sample_Count; int64u tkhd_Duration; int32u mdhd_TimeScale; int64u mdhd_Duration; int32u stts_Min; int32u stts_Max; int64u stts_FrameCount; int64u stts_Duration; int64u stts_Duration_FirstFrame; int64u stts_Duration_LastFrame; int64u stts_SampleDuration; int32u mvex_trex_default_sample_duration; int32u mvex_trex_default_sample_size; int32u TimeCode_TrackID; bool TimeCode_IsVisual; bool IsPcm; bool IsPcmMono; bool IsPriorityStream; bool IsFilled; bool IsChapter; bool ScanOrder_StoredDisplayedInverted; float32 CleanAperture_Width; float32 CleanAperture_Height; float32 CleanAperture_PixelAspectRatio; #if MEDIAINFO_DEMUX || MEDIAINFO_SEEK int8u Demux_Level; int64u Demux_Offset; struct stts_duration { int64u Pos_Begin; int64u Pos_End; int64u DTS_Begin; int64u DTS_End; int32u SampleDuration; }; typedef std::vector stts_durations; stts_durations stts_Durations; size_t stts_Durations_Pos; int64u stts_FramePos; #endif //MEDIAINFO_DEMUX || MEDIAINFO_SEEK #if MEDIAINFO_DEMUX bool PtsDtsAreSame; bool Demux_EventWasSent; #endif //MEDIAINFO_DEMUX stream() { MI=NULL; TimeCode=NULL; StreamKind=Stream_Max; StreamPos=0; stsz_StreamSize=0; stsz_Sample_Size=0; stsz_Sample_Multiplier=1; stsz_Sample_Count=0; tkhd_Duration=0; mdhd_TimeScale=0; mdhd_Duration=0; stts_Min=(int32u)-1; stts_Max=0; stts_FrameCount=0; stts_Duration=0; stts_Duration_FirstFrame=0; stts_Duration_LastFrame=0; mvex_trex_default_sample_duration=0; mvex_trex_default_sample_size=0; TimeCode_TrackID=(int32u)-1; TimeCode_IsVisual=false; IsPcm=false; IsPcmMono=false; IsPriorityStream=false; IsFilled=false; IsChapter=false; ScanOrder_StoredDisplayedInverted=false; CleanAperture_Width=0; CleanAperture_Height=0; CleanAperture_PixelAspectRatio=0; #if MEDIAINFO_DEMUX Demux_Level=2; //Container Demux_Offset=0; stts_Durations_Pos=0; stts_FramePos=0; #endif //MEDIAINFO_DEMUX #if MEDIAINFO_DEMUX PtsDtsAreSame=false; Demux_EventWasSent=false; #endif //MEDIAINFO_DEMUX } ~stream() { for (size_t Pos=0; Pos streams; streams Streams; streams::iterator Stream; #if defined(MEDIAINFO_REFERENCES_YES) File__ReferenceFilesHelper* ReferenceFiles; #endif //defined(MEDIAINFO_REFERENCES_YES) #if MEDIAINFO_NEXTPACKET bool ReferenceFiles_IsParsing; #endif //MEDIAINFO_NEXTPACKET //Positions struct mdat_Pos_Type { int32u StreamID; int64u Size; }; typedef std::map mdat_pos; mdat_pos mdat_Pos; mdat_pos::iterator mdat_Pos_Temp; std::vector mdat_Pos_ToParseInPriority_StreamIDs; bool mdat_Pos_NormalParsing; #if MEDIAINFO_DEMUX int64u TimeCode_FrameOffset; int64u TimeCode_DtsOffset; std::map StreamOffset_Jump; //Key is the current position, value is the jump position #endif //MEDIAINFO_DEMUX }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Mpeg4_Descriptors.cpp100777 0 0 142045 12207073352 20414 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Descriptors part // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #ifdef MEDIAINFO_MPEG4_YES //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Mpeg4_Descriptors.h" #include #if defined(MEDIAINFO_OGG_YES) #include "MediaInfo/Multiple/File_Ogg.h" #endif #if defined(MEDIAINFO_AVC_YES) #include "MediaInfo/Video/File_Avc.h" #endif #if defined(MEDIAINFO_VC1_YES) #include "MediaInfo/Video/File_Vc1.h" #endif #if defined(MEDIAINFO_DIRAC_YES) #include "MediaInfo/Video/File_Dirac.h" #endif #if defined(MEDIAINFO_MPEG4V_YES) #include "MediaInfo/Video/File_Mpeg4v.h" #endif #if defined(MEDIAINFO_MPEGV_YES) #include "MediaInfo/Video/File_Mpegv.h" #endif #if defined(MEDIAINFO_JPEG_YES) #include "MediaInfo/Image/File_Jpeg.h" #endif #if defined(MEDIAINFO_PNG_YES) #include "MediaInfo/Image/File_Png.h" #endif #if defined(MEDIAINFO_AAC_YES) #include "MediaInfo/Audio/File_Aac.h" #endif #if defined(MEDIAINFO_AC3_YES) #include "MediaInfo/Audio/File_Ac3.h" #endif #if defined(MEDIAINFO_DTS_YES) #include "MediaInfo/Audio/File_Dts.h" #endif #if defined(MEDIAINFO_MPEGA_YES) #include "MediaInfo/Audio/File_Mpega.h" #endif #if MEDIAINFO_DEMUX #include "base64.h" #endif //MEDIAINFO_DEMUX //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- #ifdef MEDIAINFO_MPEG4V_YES const char* Mpeg4v_Profile_Level(int32u Profile_Level); #endif //MEDIAINFO_MPEG4V_YES //--------------------------------------------------------------------------- //*************************************************************************** // Constants //*************************************************************************** //--------------------------------------------------------------------------- const char* Mpeg4_Descriptors_Predefined(int8u ID) { switch (ID) { case 0x00 : return "Custom"; case 0x01 : return "null SL packet header"; case 0x02 : return "Reserved for use in MP4 files"; default : return ""; } } //--------------------------------------------------------------------------- const char* Mpeg4_Descriptors_ObjectTypeIndication(int8u ID) { switch (ID) { case 0x01 : return "Systems ISO/IEC 14496-1"; case 0x02 : return "Systems ISO/IEC 14496-1 (v2)"; case 0x03 : return "Interaction Stream"; case 0x05 : return "AFX Stream"; case 0x06 : return "Font Data Stream"; case 0x07 : return "Synthesized Texture Stream"; case 0x08 : return "Streaming Text Stream"; case 0x20 : return "Visual ISO/IEC 14496-2 (MPEG-4 Visual)"; case 0x21 : return "Visual ISO/IEC 14496-10 (AVC)"; case 0x22 : return "Parameter Sets for Visual ISO/IEC 14496-10 (AVC)"; case 0x24 : return "ALS"; //Not sure case 0x2B : return "SAOC"; //Not sure case 0x40 : return "Audio ISO/IEC 14496-3 (AAC)"; case 0x60 : return "Visual ISO/IEC 13818-2 Simple Profile (MPEG Video)"; case 0x61 : return "Visual ISO/IEC 13818-2 Main Profile (MPEG Video)"; case 0x62 : return "Visual ISO/IEC 13818-2 SNR Profile (MPEG Video)"; case 0x63 : return "Visual ISO/IEC 13818-2 Spatial Profile (MPEG Video)"; case 0x64 : return "Visual ISO/IEC 13818-2 High Profile (MPEG Video)"; case 0x65 : return "Visual ISO/IEC 13818-2 422 Profile (MPEG Video)"; case 0x66 : return "Audio ISO/IEC 13818-7 Main Profile (AAC)"; case 0x67 : return "Audio ISO/IEC 13818-7 Low Complexity Profile (AAC)"; case 0x68 : return "Audio ISO/IEC 13818-7 Scaleable Sampling Rate Profile (AAC)"; case 0x69 : return "Audio ISO/IEC 13818-3 (MPEG Audio)"; case 0x6A : return "Visual ISO/IEC 11172-2 (MPEG Video)"; case 0x6B : return "Audio ISO/IEC 11172-3 (MPEG Audio)"; case 0x6C : return "Visual ISO/IEC 10918-1 (JPEG)"; case 0x6D : return "PNG"; case 0xA0 : return "EVRC"; case 0xA1 : return "SMV"; case 0xA2 : return "3GPP2 Compact Multimedia Format (CMF)"; case 0xA3 : return "VC-1"; case 0xA4 : return "Dirac"; case 0xA5 : return "AC-3"; case 0xA6 : return "E-AC-3"; case 0xA9 : return "DTS"; case 0xAA : return "DTS-HD High Resolution"; case 0xAB : return "DTS-HD Master Audio"; case 0xAC : return "DTS-HD Express"; case 0xD1 : return "Private - EVRC"; case 0xD3 : return "Private - AC-3"; case 0xD4 : return "Private - DTS"; case 0xDD : return "Private - Ogg"; case 0xDE : return "Private - Ogg"; case 0xE1 : return "Private - QCELP"; default : return ""; } } //--------------------------------------------------------------------------- const char* Mpeg4_Descriptors_StreamType(int8u ID) { switch (ID) { case 0x01 : return "ObjectDescriptorStream"; case 0x02 : return "ClockReferenceStream"; case 0x03 : return "SceneDescriptionStream"; case 0x04 : return "VisualStream"; case 0x05 : return "AudioStream"; case 0x06 : return "MPEG7Stream"; case 0x07 : return "IPMPStream"; case 0x08 : return "ObjectContentInfoStream"; case 0x09 : return "MPEGJStream"; case 0x0A : return "Interaction Stream"; case 0x0B : return "IPMPToolStream"; case 0x0C : return "FontDataStream"; case 0x0D : return "StreamingText"; default : return ""; } } //--------------------------------------------------------------------------- const char* Mpeg4_Descriptors_ODProfileLevelIndication(int8u /*ID*/) { return ""; } //--------------------------------------------------------------------------- const char* Mpeg4_Descriptors_SceneProfileLevelIndication(int8u ID) { switch (ID) { case 1 : return "Simple2D@L1"; case 2 : return "Simple2D@L2"; case 11 : return "Basic2D@L1"; case 12 : return "Core2D@L1"; case 13 : return "Core2D@L2"; case 14 : return "Advanced2D@L1"; case 15 : return "Advanced2D@L2"; case 16 : return "Advanced2D@L3"; case 17 : return "Main2D@L1"; case 18 : return "Main2D@L2"; case 19 : return "Main2D@L3"; default : return ""; } } //--------------------------------------------------------------------------- const char* Mpeg4_Descriptors_AudioProfileLevelIndication(int8u ID) { switch (ID) { case 1 : return "Main@L1"; case 2 : return "Main@L2"; case 3 : return "Main@L3"; case 4 : return "Main@L4"; case 5 : return "Scalable@L1"; case 6 : return "Scalable@L2"; case 7 : return "Scalable@L3"; case 8 : return "Scalable@L4"; case 9 : return "Speech@L1"; case 10 : return "Speech@L2"; case 11 : return "Synthesis@L1"; case 12 : return "Synthesis@L2"; case 13 : return "Synthesis@L3"; case 14 : return "HighQualityAudio@L1"; case 15 : return "HighQualityAudio@L2"; case 16 : return "HighQualityAudio@L3"; case 17 : return "HighQualityAudio@L4"; case 18 : return "HighQualityAudio@L5"; case 19 : return "HighQualityAudio@L6"; case 20 : return "HighQualityAudio@L7"; case 21 : return "HighQualityAudio@L8"; case 22 : return "LowDelayAudio@L1"; case 23 : return "LowDelayAudio@L2"; case 24 : return "LowDelayAudio@L3"; case 25 : return "LowDelayAudio@L4"; case 26 : return "LowDelayAudio@L5"; case 27 : return "LowDelayAudio@L6"; case 28 : return "LowDelayAudio@L7"; case 29 : return "LowDelayAudio@L8"; case 30 : return "NaturalAudio@L1"; case 31 : return "NaturalAudio@L2"; case 32 : return "NaturalAudio@L3"; case 33 : return "NaturalAudio@L4"; case 34 : return "MobileAudioInternetworking@L1"; case 35 : return "MobileAudioInternetworking@L2"; case 36 : return "MobileAudioInternetworking@L3"; case 37 : return "MobileAudioInternetworking@L4"; case 38 : return "MobileAudioInternetworking@L5"; case 39 : return "MobileAudioInternetworking@L6"; case 40 : return "AAC@L1"; case 41 : return "AAC@L2"; case 42 : return "AAC@L4"; case 43 : return "AAC@L5"; case 44 : return "HighEfficiencyAAC@L2"; case 45 : return "HighEfficiencyAAC@L3"; case 46 : return "HighEfficiencyAAC@L4"; case 47 : return "HighEfficiencyAAC@L5"; case 59 : return "HighDefinitionAAC@L1"; case 60 : return "ALSSimple@L1"; default : return ""; } } //--------------------------------------------------------------------------- extern const char* Mpeg4v_Profile_Level(int32u Profile_Level); //--------------------------------------------------------------------------- const char* Mpeg4_Descriptors_GraphicsProfileLevelIndication(int8u ID) { switch (ID) { case 1 : return "Simple2D@L1"; case 2 : return "Simple2D+Text@L1"; case 3 : return "Simple2D+Text@L2"; case 4 : return "Core2D@L1"; case 5 : return "Core2D@L2"; case 6 : return "Advanced2D@L1"; case 7 : return "Advanced2D@L2"; default : return ""; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Mpeg4_Descriptors::File_Mpeg4_Descriptors() :File__Analyze() { //Configuration ParserName=__T("MPEG-4 Descriptor"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Mpeg4_Desc; StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS IsRawStream=true; //In KindOfStream=Stream_Max; PosOfStream=(size_t)-1; Parser_DoNotFreeIt=false; SLConfig_DoNotFreeIt=false; //Out Parser=NULL; ES_ID=0x0000; SLConfig=NULL; //Temp ObjectTypeId=0x00; } //--------------------------------------------------------------------------- File_Mpeg4_Descriptors::~File_Mpeg4_Descriptors() { if (!Parser_DoNotFreeIt) delete Parser;// Parser=NULL; if (!SLConfig_DoNotFreeIt) delete SLConfig;// SLConfig=NULL; } //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpeg4_Descriptors::Header_Parse() { //Parsing size_t Size=0; int8u type, Size_ToAdd; Get_B1(type, "type"); if (type==0) { Header_Fill_Code(0x00, "Padding"); Header_Fill_Size(1); return; } do { Get_B1(Size_ToAdd, "size"); Size=(Size<<7) | (Size_ToAdd&0x7F); } while (Size_ToAdd&0x80); //Filling Header_Fill_Code(type, Ztring().From_CC1(type)); if (Element_Offset+Size>=Element_Size) Size=(size_t)(Element_Size-Element_Offset); //Found one file with too big size but content is OK, cutting the block Header_Fill_Size(Element_Offset+Size); } //--------------------------------------------------------------------------- void File_Mpeg4_Descriptors::Data_Parse() { //Preparing Status[IsAccepted]=true; #define ELEMENT_CASE(_NAME, _DETAIL) \ case 0x##_NAME : Element_Name(_DETAIL); Descriptor_##_NAME(); break; //Parsing switch (Element_Code) { ELEMENT_CASE(00, "Forbidden"); ELEMENT_CASE(01, "ObjectDescrTag"); ELEMENT_CASE(02, "InitialObjectDescrTag"); ELEMENT_CASE(03, "ES_DescrTag"); ELEMENT_CASE(04, "DecoderConfigDescrTag"); ELEMENT_CASE(05, "DecSpecificInfoTag"); ELEMENT_CASE(06, "SLConfigDescrTag"); ELEMENT_CASE(07, "ContentIdentDescrTag"); ELEMENT_CASE(08, "SupplContentIdentDescrTag"); ELEMENT_CASE(09, "IPI_DescrPointerTag"); ELEMENT_CASE(0A, "IPMP_DescrPointerTag"); ELEMENT_CASE(0B, "IPMP_DescrTag"); ELEMENT_CASE(0C, "QoS_DescrTag"); ELEMENT_CASE(0D, "RegistrationDescrTag"); ELEMENT_CASE(0E, "ES_ID_IncTag"); ELEMENT_CASE(0F, "ES_ID_RefTag"); ELEMENT_CASE(10, "MP4_IOD_Tag"); ELEMENT_CASE(11, "MP4_OD_Tag"); ELEMENT_CASE(12, "IPL_DescrPointerRefTag"); ELEMENT_CASE(13, "ExtendedProfileLevelDescrTag"); ELEMENT_CASE(14, "profileLevelIndicationIndexDescrTag"); ELEMENT_CASE(40, "ContentClassificationDescrTag"); ELEMENT_CASE(41, "KeyWordDescrTag"); ELEMENT_CASE(42, "RatingDescrTag"); ELEMENT_CASE(43, "LanguageDescrTag"); ELEMENT_CASE(44, "ShortTextualDescrTag"); ELEMENT_CASE(45, "ExpandedTextualDescrTag"); ELEMENT_CASE(46, "ContentCreatorNameDescrTag"); ELEMENT_CASE(47, "ContentCreationDateDescrTag"); ELEMENT_CASE(48, "OCICreatorNameDescrTag"); ELEMENT_CASE(49, "OCICreationDateDescrTag"); ELEMENT_CASE(4A, "SmpteCameraPositionDescrTag"); ELEMENT_CASE(4B, "SegmentDescrTag"); ELEMENT_CASE(4C, "MediaTimeDescrTag"); ELEMENT_CASE(60, "IPMP_ToolsListDescrTag"); ELEMENT_CASE(61, "IPMP_ToolTag"); ELEMENT_CASE(62, "FLEXmuxTimingDescrTag"); ELEMENT_CASE(63, "FLEXmuxCodeTableDescrTag"); ELEMENT_CASE(64, "ExtSLConfigDescrTag"); ELEMENT_CASE(65, "FLEXmuxBufferSizeDescrTag"); ELEMENT_CASE(66, "FLEXmuxIdentDescrTag"); ELEMENT_CASE(67, "DependencyPointerTag"); ELEMENT_CASE(68, "DependencyMarkerTag"); ELEMENT_CASE(69, "FLEXmuxChannelDescrTag"); default: if (Element_Code>=0xC0) Element_Name("user private"); else Element_Name("unknown"); Skip_XX(Element_Size, "Data"); break; } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpeg4_Descriptors::Descriptor_01() { //Parsing bool URL_Flag; BS_Begin(); Skip_S2(10, "ObjectDescriptorID"); Get_SB ( URL_Flag, "URL_Flag"); Skip_SB( "includeInlineProfileLevelFlag"); Skip_S1( 4, "reserved"); BS_End(); if (URL_Flag) { int8u URLlength; Get_B1 (URLlength, "URLlength"); Skip_UTF8(URLlength, "URLstring"); } if (Element_Code==0x02 || Element_Code==0x10) { Info_B1(ODProfileLevel, "ODProfileLevelIndication"); Param_Info1(Mpeg4_Descriptors_ODProfileLevelIndication(ODProfileLevel)); Info_B1(SceneProfileLevel, "sceneProfileLevelIndication"); Param_Info1(Mpeg4_Descriptors_SceneProfileLevelIndication(SceneProfileLevel)); Info_B1(AudioProfileLevel, "audioProfileLevelIndication"); Param_Info1(Mpeg4_Descriptors_AudioProfileLevelIndication(AudioProfileLevel)); Info_B1(VisualProfileLevel, "visualProfileLevelIndication"); Param_Info1(Mpeg4v_Profile_Level(VisualProfileLevel)); Info_B1(GraphicsProfileLevel, "graphicsProfileLevelIndication"); Param_Info1(Mpeg4_Descriptors_GraphicsProfileLevelIndication(GraphicsProfileLevel)); } FILLING_BEGIN(); Element_ThisIsAList(); FILLING_END(); } //--------------------------------------------------------------------------- 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(); } //--------------------------------------------------------------------------- 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_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_06() { delete SLConfig; SLConfig=new slconfig; //Parsing int8u predefined; Get_B1 (predefined, "predefined"); Param_Info1(Mpeg4_Descriptors_Predefined(predefined)); switch (predefined) { case 0x00 : { BS_Begin(); Get_SB (SLConfig->useAccessUnitStartFlag, "useAccessUnitStartFlag"); Get_SB (SLConfig->useAccessUnitEndFlag, "useAccessUnitEndFlag"); Get_SB (SLConfig->useRandomAccessPointFlag, "useRandomAccessPointFlag"); Get_SB (SLConfig->hasRandomAccessUnitsOnlyFlag, "hasRandomAccessUnitsOnlyFlag"); Get_SB (SLConfig->usePaddingFlag, "usePaddingFlag"); Get_SB (SLConfig->useTimeStampsFlag, "useTimeStampsFlag"); Get_SB (SLConfig->useIdleFlag, "useIdleFlag"); Get_SB (SLConfig->durationFlag, "durationFlag"); BS_End(); Get_B4 (SLConfig->timeStampResolution, "timeStampResolution"); Get_B4( SLConfig->OCRResolution, "OCRResolution"); Get_B1 (SLConfig->timeStampLength, "timeStampLength"); Get_B1 (SLConfig->OCRLength, "OCRLength"); Get_B1 (SLConfig->AU_Length, "AU_Length"); Get_B1 (SLConfig->instantBitrateLength, "instantBitrateLength"); BS_Begin(); Get_S1 (4, SLConfig->degradationPriorityLength, "degradationPriorityLength"); Get_S1 (5, SLConfig->AU_seqNumLength, "AU_seqNumLength"); Get_S1 (5, SLConfig->packetSeqNumLength, "packetSeqNumLength"); Skip_S1(2, "reserved"); BS_End(); } break; case 0x01 : SLConfig->useAccessUnitStartFlag =false; SLConfig->useAccessUnitEndFlag =false; SLConfig->useRandomAccessPointFlag =false; SLConfig->hasRandomAccessUnitsOnlyFlag =false; SLConfig->usePaddingFlag =false; SLConfig->useTimeStampsFlag =false; SLConfig->useIdleFlag =false; SLConfig->durationFlag =false; //- SLConfig->timeStampResolution =1000; SLConfig->OCRResolution =0; //- SLConfig->timeStampLength =32; SLConfig->OCRLength =0; //- SLConfig->AU_Length =0; SLConfig->instantBitrateLength =0; //- SLConfig->degradationPriorityLength =0; SLConfig->AU_seqNumLength =0; SLConfig->packetSeqNumLength =0; break; case 0x02 : SLConfig->useAccessUnitStartFlag =false; SLConfig->useAccessUnitEndFlag =false; SLConfig->useRandomAccessPointFlag =false; SLConfig->hasRandomAccessUnitsOnlyFlag =false; SLConfig->usePaddingFlag =false; SLConfig->useTimeStampsFlag =true; SLConfig->useIdleFlag =false; SLConfig->durationFlag =false; SLConfig->timeStampResolution =0; //- SLConfig->OCRResolution =0; //- SLConfig->timeStampLength =0; SLConfig->OCRLength =0; SLConfig->AU_Length =0; SLConfig->instantBitrateLength =0; SLConfig->degradationPriorityLength =0; SLConfig->AU_seqNumLength =0; SLConfig->packetSeqNumLength =0; break; default : SLConfig->useAccessUnitStartFlag =false; SLConfig->useAccessUnitEndFlag =false; SLConfig->useRandomAccessPointFlag =false; SLConfig->hasRandomAccessUnitsOnlyFlag =false; SLConfig->usePaddingFlag =false; SLConfig->useTimeStampsFlag =false; SLConfig->useIdleFlag =false; SLConfig->durationFlag =false; SLConfig->timeStampResolution =0; SLConfig->OCRResolution =0; SLConfig->timeStampLength =0; SLConfig->AU_Length =0; SLConfig->instantBitrateLength =0; SLConfig->degradationPriorityLength =0; SLConfig->AU_seqNumLength =0; SLConfig->packetSeqNumLength =0; } if (SLConfig->durationFlag) { Get_B4 (SLConfig->timeScale, "timeScale"); Get_B2 (SLConfig->accessUnitDuration, "accessUnitDuration"); Get_B2 (SLConfig->compositionUnitDuration, "compositionUnitDuration"); } else { SLConfig->timeScale =0; //- SLConfig->accessUnitDuration =0; //- SLConfig->compositionUnitDuration =0; //- } if (!SLConfig->useTimeStampsFlag) { BS_Begin(); Get_S8 (SLConfig->timeStampLength, SLConfig->startDecodingTimeStamp, "startDecodingTimeStamp"); Get_S8 (SLConfig->timeStampLength, SLConfig->startCompositionTimeStamp, "startCompositionTimeStamp"); BS_End(); } else { SLConfig->startDecodingTimeStamp =0; //- SLConfig->startCompositionTimeStamp =0; //- } } //--------------------------------------------------------------------------- void File_Mpeg4_Descriptors::Descriptor_09() { //Parsing Skip_B2( "IPI_ES_Id"); } //--------------------------------------------------------------------------- void File_Mpeg4_Descriptors::Descriptor_0E() { //Parsing Skip_B4( "Track_ID"); //ID of the track to use } //--------------------------------------------------------------------------- void File_Mpeg4_Descriptors::Descriptor_0F() { //Parsing Skip_B2( "ref_index"); //track ref. index of the track to use } //--------------------------------------------------------------------------- void File_Mpeg4_Descriptors::Descriptor_10() { Descriptor_02(); } //--------------------------------------------------------------------------- void File_Mpeg4_Descriptors::Descriptor_11() { Descriptor_01(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_MPEG4_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Mpeg4_Descriptors.h100777 0 0 11342 12207073352 20034 0/* 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-4 files, Descriptors // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_Mpeg4_DescriptorsH #define MediaInfo_Mpeg4_DescriptorsH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Mpeg4_Descriptors //*************************************************************************** class File_Mpeg4_Descriptors : public File__Analyze { public : //In stream_t KindOfStream; size_t PosOfStream; bool Parser_DoNotFreeIt; //If you want to keep the Parser bool SLConfig_DoNotFreeIt; //If you want to keep the SLConfig //Out File__Analyze* Parser; int16u ES_ID; struct slconfig { bool useAccessUnitStartFlag; bool useAccessUnitEndFlag; bool useRandomAccessPointFlag; bool hasRandomAccessUnitsOnlyFlag; bool usePaddingFlag; bool useTimeStampsFlag; bool useIdleFlag; bool durationFlag; int32u timeStampResolution; int32u OCRResolution; int8u timeStampLength; int8u OCRLength; int8u AU_Length; int8u instantBitrateLength; int8u degradationPriorityLength; int8u AU_seqNumLength; int8u packetSeqNumLength; int32u timeScale; int16u accessUnitDuration; int16u compositionUnitDuration; int64u startDecodingTimeStamp; int64u startCompositionTimeStamp; }; slconfig* SLConfig; public : //Constructor/Destructor File_Mpeg4_Descriptors(); ~File_Mpeg4_Descriptors(); private : //Buffer void Header_Parse(); void Data_Parse(); //Elements void Descriptor_00() {Skip_XX(Element_Size, "Data");}; void Descriptor_01(); void Descriptor_02() {Descriptor_01();} void Descriptor_03(); void Descriptor_04(); void Descriptor_05(); void Descriptor_06(); void Descriptor_07() {Skip_XX(Element_Size, "Data");}; void Descriptor_08() {Skip_XX(Element_Size, "Data");}; void Descriptor_09(); void Descriptor_0A() {Skip_XX(Element_Size, "Data");}; void Descriptor_0B() {Skip_XX(Element_Size, "Data");}; void Descriptor_0C() {Skip_XX(Element_Size, "Data");}; void Descriptor_0D() {Skip_XX(Element_Size, "Data");}; void Descriptor_0E(); void Descriptor_0F(); void Descriptor_10(); void Descriptor_11(); void Descriptor_12() {Skip_XX(Element_Size, "Data");}; void Descriptor_13() {Skip_XX(Element_Size, "Data");}; void Descriptor_14() {Skip_XX(Element_Size, "Data");}; void Descriptor_40() {Skip_XX(Element_Size, "Data");}; void Descriptor_41() {Skip_XX(Element_Size, "Data");}; void Descriptor_42() {Skip_XX(Element_Size, "Data");}; void Descriptor_43() {Skip_XX(Element_Size, "Data");}; void Descriptor_44() {Skip_XX(Element_Size, "Data");}; void Descriptor_45() {Skip_XX(Element_Size, "Data");}; void Descriptor_46() {Skip_XX(Element_Size, "Data");}; void Descriptor_47() {Skip_XX(Element_Size, "Data");}; void Descriptor_48() {Skip_XX(Element_Size, "Data");}; void Descriptor_49() {Skip_XX(Element_Size, "Data");}; void Descriptor_4A() {Skip_XX(Element_Size, "Data");}; void Descriptor_4B() {Skip_XX(Element_Size, "Data");}; void Descriptor_4C() {Skip_XX(Element_Size, "Data");}; void Descriptor_60() {Skip_XX(Element_Size, "Data");}; void Descriptor_61() {Skip_XX(Element_Size, "Data");}; void Descriptor_62() {Skip_XX(Element_Size, "Data");}; void Descriptor_63() {Skip_XX(Element_Size, "Data");}; void Descriptor_64() {Skip_XX(Element_Size, "Data");}; void Descriptor_65() {Skip_XX(Element_Size, "Data");}; void Descriptor_66() {Skip_XX(Element_Size, "Data");}; void Descriptor_67() {Skip_XX(Element_Size, "Data");}; void Descriptor_68() {Skip_XX(Element_Size, "Data");}; void Descriptor_69() {Skip_XX(Element_Size, "Data");}; //Temp int8u ObjectTypeId; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Mpeg4_Elements.cpp100777 0 0 1076206 12253103107 17706 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Contributor: Lionel Duchateau, kurtnoise@free.fr // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #ifdef MEDIAINFO_MPEG4_YES //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Mpeg4.h" #if defined(MEDIAINFO_DVDIF_YES) #include "MediaInfo/Multiple/File_DvDif.h" #endif #if defined(MEDIAINFO_MXF_YES) #include "MediaInfo/Multiple/File_Mxf.h" #endif #if defined(MEDIAINFO_AIC_YES) #include "MediaInfo/Video/File_Aic.h" #endif #if defined(MEDIAINFO_AVC_YES) #include "MediaInfo/Video/File_Avc.h" #endif #if defined(MEDIAINFO_H263_YES) #include "MediaInfo/Video/File_H263.h" #endif #if defined(MEDIAINFO_HEVC_YES) #include "MediaInfo/Video/File_Hevc.h" #endif #if defined(MEDIAINFO_MPEGV_YES) #include "MediaInfo/Video/File_Mpegv.h" #endif #if defined(MEDIAINFO_PRORES_YES) #include "MediaInfo/Video/File_ProRes.h" #endif #if defined(MEDIAINFO_VC1_YES) #include "MediaInfo/Video/File_Vc1.h" #endif #if defined(MEDIAINFO_VC3_YES) #include "MediaInfo/Video/File_Vc3.h" #endif #if defined(MEDIAINFO_AAC_YES) #include "MediaInfo/Audio/File_Aac.h" #endif #if defined(MEDIAINFO_AC3_YES) #include "MediaInfo/Audio/File_Ac3.h" #endif #if defined(MEDIAINFO_SMPTEST0337_YES) #include "MediaInfo/Audio/File_ChannelGrouping.h" #endif #if defined(MEDIAINFO_AMR_YES) #include "MediaInfo/Audio/File_Amr.h" #endif #if defined(MEDIAINFO_ADPCM_YES) #include "MediaInfo/Audio/File_Adpcm.h" #endif #if defined(MEDIAINFO_MPEGA_YES) #include "MediaInfo/Audio/File_Mpega.h" #endif #if defined(MEDIAINFO_PCM_YES) #include "MediaInfo/Audio/File_Pcm.h" #endif #if defined(MEDIAINFO_CDP_YES) #include "MediaInfo/Text/File_Cdp.h" #endif #if defined(MEDIAINFO_EIA608_YES) #include "MediaInfo/Text/File_Eia608.h" #endif #if defined(MEDIAINFO_TIMEDTEXT_YES) #include "MediaInfo/Text/File_TimedText.h" #endif #if defined(MEDIAINFO_JPEG_YES) #include "MediaInfo/Image/File_Jpeg.h" #endif #include "MediaInfo/Multiple/File_Mpeg4_TimeCode.h" #include "ZenLib/FileName.h" #include "base64.h" #include #include #include //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* Mpeg4_Meta_Kind(int32u Kind) { switch (Kind) { case 0x00 : return "Binary"; case 0x01 : return "UTF8"; case 0x02 : return "UTF16"; case 0x03 : return "Mac String"; case 0x0E : return "Jpeg"; case 0x15 : return "Signed Integer"; //the size of the integer is derived from the container size case 0x16 : return "Float 32"; case 0x17 : return "Float 64"; default : return "Unknown"; } } //--------------------------------------------------------------------------- const char* Mpeg4_TypeModifierName(int32u TypeModifierName) { switch (TypeModifierName) { case 0x01 : return "Matrix"; case 0x02 : return "Clip"; case 0x03 : return "Volume"; case 0x04 : return "Audio balance"; case 0x05 : return "Graphic mode"; case 0x06 : return "Matrix object"; case 0x07 : return "Graphics mode object"; case 0x76696465 : return "Image type"; default : return "Unknown"; } } //--------------------------------------------------------------------------- const char* Mpeg4_sample_depends_on[]= { "", "this sample does depend on others (not an I picture)", "this sample does not depend on others (I picture)", "reserved", }; //--------------------------------------------------------------------------- const char* Mpeg4_sample_is_depended_on[]= { "", "other samples depend on this one (not disposable)", "no other sample depends on this one (disposable)", "reserved", }; //--------------------------------------------------------------------------- const char* Mpeg4_sample_has_redundancy[]= { "", "there is redundant coding in this sample", "there is no redundant coding in this sample", "reserved", }; //--------------------------------------------------------------------------- Ztring Mpeg4_Vendor(int32u Vendor) { switch (Vendor) { case 0x46464D50 : return __T("FFMpeg"); case 0x4D4F544F : return __T("Motorola"); case 0x50484C50 : return __T("Philips"); case 0x6170706C : return __T("Apple"); case 0x6E6F6B69 : return __T("Nokia"); case 0x6D6F746F : return __T("Motorola"); default : return Ztring().From_CC4(Vendor); } } //--------------------------------------------------------------------------- const char* Mpeg4_chan(int16u Ordering) { //Source: http://developer.apple.com/library/mac/#documentation/MusicAudio/Reference/CACoreAudioReference/CoreAudioTypes/CompositePage.html //Arbitrary decision (0 = Front): //Front = 0-80 //Side = 80-120 //Rear = 120-180 switch(Ordering) { case 100 : return "Front: C"; case 101 : return "Front: L R"; case 102 : return "Front: L R (Headphones)"; //With headphones case 103 : return "Front: L R (Matrix)"; //With matrix case 104 : return "Front: C S"; case 105 : return "Front: X Y"; case 106 : return "Front: L R (Binaural)"; case 107 : return "Front: W X Y Z"; case 108 : return "Front: L R, Side: L R"; case 109 : return "Front: L C R, Rear: L R"; case 110 : return "Front: L C R, Rear: L C R"; case 111 : return "Front: L C R, Side: L R, Rear: L C R"; case 112 : return "Front: L R, TopFront: L R, Rear: L R, TopRear: L R"; case 113 : return "Front: L C R"; case 114 : return "Front: L C R"; case 115 : return "Front: L C R, Rear: C"; case 116 : return "Front: L C R, Rear: C"; case 117 : return "Front: L C R, Side: L R"; case 118 : return "Front: L C R, Side: L R"; case 119 : return "Front: L C R, Side: L R"; case 120 : return "Front: L C R, Side: L R"; case 121 : return "Front: L C R, Side: L R, LFE"; case 122 : return "Front: L C R, Side: L R, LFE"; case 123 : return "Front: L C R, Side: L R, LFE"; case 124 : return "Front: L C R, Side: L R, LFE"; case 125 : return "Front: L C R, Side: L C R"; case 126 : return "Front: L Lc C Rc R, Side: L R"; case 127 : return "Front: L Lc Rc R, Side: L R, LFE"; case 128 : return "Front: L C R, Side: L R, Rear: L R, LFE"; case 129 : return "Front: L C R, Side: L R, Rear: L R, LFE"; case 130 : return "Front: L C R, Side: L R, LF, Front: L R (Matrix)"; case 131 : return "Front: L R, Rear: C"; case 132 : return "Front: L R, Side: L R"; case 133 : return "Front: L R, LFE"; case 134 : return "Front: L R, Rear: C, LFE"; case 135 : return "Front: L C R, Side: L R, LFE"; case 136 : return "Front: L C R, LFE"; case 137 : return "Front: L C R, Rear: C, LFE"; case 138 : return "Front: L R, Rear: L R, LFE"; case 139 : return "Front: L C R, Rear: L R, LFE"; case 140 : return "Front: L C R, Side: L R, Rear: L R"; case 141 : return "Front: L C R, Side: L R, Rear: C"; case 142 : return "Front: L C R, Side: L R, Rear: C, LFE"; case 143 : return "Front: L C R, Side: L R, Rear: L R"; case 144 : return "Front: L C R, Side: L R, Rear: L C R"; case 145 : return "Front: Lw L C R Rw, TopFront: L C R, Side: L R, Rear: L C Cd R, LFE: L R"; //d=direct, all must be confirmed case 146 : return "Front: Lw L Lc C Rc R Rw, TopFront: L C R, Side: L R, Rear: L C Cd R, LFE: L R, HI, VI, Haptic"; //d=direct, all must be confirmed default : return ""; } } //--------------------------------------------------------------------------- const char* Mpeg4_chan_Layout(int16u Ordering) { //Source: http://developer.apple.com/library/mac/#documentation/MusicAudio/Reference/CACoreAudioReference/CoreAudioTypes/CompositePage.html // L - left // R - right // C - center // Ls - left surround // Rs - right surround // Cs - center surround // Rls - rear left surround // Rrs - rear right surround // Lw - left wide // Rw - right wide // Lsd - left surround direct // Rsd - right surround direct // Lc - left center // Rc - right center // Ts - top surround // Vhl - vertical height left // Vhc - vertical height center // Vhr - vertical height right // Lt - left matrix total. for matrix encoded stereo. // Rt - right matrix total. for matrix encoded stereo. switch(Ordering) { case 100 : return "C"; case 101 : return "L R"; case 102 : return "L R"; //With headphones case 103 : return "Lt Rt"; //L R with matrix case 104 : return "M S"; case 105 : return "X Y"; case 106 : return "L R"; case 107 : return "W X Y Z"; case 108 : return "L R Ls Rs"; case 109 : return "L R Lrs Rrs C"; case 110 : return "L R Lrs Rrs C Cs"; case 111 : return "L R Lrs Rrs C Crs, Ls, Rs"; case 112 : return "L R Lrs Rrs Vhl Vhr, Vhlrs, Vhrrs"; case 113 : return "L R C"; case 114 : return "C L R"; case 115 : return "L R C Cs"; case 116 : return "C L R Cs"; case 117 : return "L R C Ls Rs"; case 118 : return "L R Ls Rs C"; case 119 : return "L C R Ls Rs"; case 120 : return "C L R Ls Rs"; case 121 : return "L R C LFE Ls Rs"; case 122 : return "L R Ls Rs C LFE"; case 123 : return "L C R Ls Rs LFE"; case 124 : return "C L R Ls Rs LFE"; case 125 : return "L R C LFE Ls Rs Cs"; case 126 : return "L R C LFE Ls Rs Lc Rc"; case 127 : return "C Lc Rc L R Ls Rs LFE"; case 128 : return "L R C LFE Ls R Rls Rrs"; case 129 : return "L R Ls Rs C LFE Lc Rc"; case 130 : return "L R C LFE Ls Rs Lt Rt"; case 131 : return "L R Cs"; case 132 : return "L R Ls Rs"; case 133 : return "L R LFE"; case 134 : return "L R LFE Cs"; case 135 : return "L R LFE Ls Rs"; case 136 : return "L R C LFE"; case 137 : return "L R C LFE Cs"; case 138 : return "L R Ls Rs LFE"; case 139 : return "L R Ls Rs C Cs"; case 140 : return "L R Ls Rs C Rls Rrs"; case 141 : return "C L R Ls Rs Cs "; case 142 : return "C L R Ls Rs Cs LFE"; case 143 : return "C L R Ls Rs Rls Rrs"; case 144 : return "C L R Ls Rs Rls Rrs Cs"; case 145 : return "L R C Vhc Lsd Rsd Ls Rs Vhl Vhr Lw Rw Csd Cs LFE1 LFE2"; case 146 : return "L R C Vhc Lsd Rsd Ls Rs Vhl Vhr Lw Rw Csd Cs LFE1 LFE2 Lc Rc HI VI Haptic"; case 147 : return ""; default : return ""; } } //--------------------------------------------------------------------------- std::string Mpeg4_chan_ChannelDescription (int64u ChannelLabels) { std::string Text; if ((ChannelLabels&0x000E)!=0x0000) Text+="Front:"; if (ChannelLabels&0x0002) Text+=" L"; if (ChannelLabels&0x0008) Text+=" C"; if (ChannelLabels&0x0004) Text+=" R"; if ((ChannelLabels&0x0C00)!=0x0000) { if (!Text.empty()) Text+=", "; Text+="Side:"; } if (ChannelLabels&0x0400) Text+=" L"; if (ChannelLabels&0x0800) Text+=" R"; if ((ChannelLabels&0x0260)!=0x0000) { if (!Text.empty()) Text+=", "; Text+="Back:"; } if (ChannelLabels&0x0020) Text+=" L"; if (ChannelLabels&0x0200) Text+=" C"; if (ChannelLabels&0x0040) Text+=" R"; if ((ChannelLabels&0x0010)!=0x0000) { if (!Text.empty()) Text+=", "; Text+="LFE"; } if (ChannelLabels&0x000000C000000000LL) { if (!Text.empty()) Text+=", "; Text+="Front:"; } if (ChannelLabels&0x0000004000000000LL) Text+=" L"; if (ChannelLabels&0x0000008000000000LL) Text+=" R"; if (ChannelLabels&0x000000C000000000LL) Text+=" (Matrix)"; return Text; } //--------------------------------------------------------------------------- const char* Mpeg4_chan_ChannelDescription_Layout (int32u ChannelLabel) { switch(ChannelLabel) { case 1 : return "L"; case 2 : return "R"; case 3 : return "C"; case 4 : return "LFE"; case 5 : return "Ls"; case 6 : return "Rs"; case 7 : return "Lc"; case 8 : return "Rc"; case 9 : return "Cs"; case 10 : return "Lsd"; case 11 : return "Rsd"; case 12 : return "Tcs"; case 13 : return "Vhl"; case 14 : return "Vhc"; case 15 : return "Vhr"; case 16 : return "Trs"; case 17 : return "Trs"; case 18 : return "Trs"; case 33 : return "Lrs"; case 34 : return "Rrs"; case 35 : return "Lw"; case 36 : return "Rw"; case 37 : return "LFE2"; case 38 : return "Lt"; case 39 : return "Rt"; case 200 : return "W"; case 201 : return "X"; case 202 : return "Y"; case 203 : return "Z"; case 204 : return "M"; case 205 : return "S"; case 206 : return "X"; case 207 : return "Y"; case 0x10000 : return "Discrete-0"; case 0x10001 : return "Discrete-1"; case 0x10002 : return "Discrete-2"; case 0x10003 : return "Discrete-3"; case 0x10004 : return "Discrete-4"; case 0x10005 : return "Discrete-5"; case 0x10006 : return "Discrete-6"; case 0x10007 : return "Discrete-7"; case 0x10008 : return "Discrete-8"; case 0x10009 : return "Discrete-9"; case 0x1000A : return "Discrete-10"; case 0x1000B : return "Discrete-11"; case 0x1000C : return "Discrete-12"; case 0x1000D : return "Discrete-13"; case 0x1000E : return "Discrete-14"; case 0x1000F : return "Discrete-15"; default : return "?"; } } //--------------------------------------------------------------------------- std::string Mpeg4_chan_ChannelBitmap (int32u ChannelBitmap) { std::string Text; if ((ChannelBitmap&0x0007)!=0x0000) Text+="Front:"; if (ChannelBitmap&0x0001) Text+=" L"; if (ChannelBitmap&0x0004) Text+=" C"; if (ChannelBitmap&0x0002) Text+=" R"; if ((ChannelBitmap&0x0600)!=0x0000) Text+=", Side:"; if (ChannelBitmap&0x0200) Text+=" L"; if (ChannelBitmap&0x0400) Text+=" R"; if ((ChannelBitmap&0x0130)!=0x0000) Text+=", Back:"; if (ChannelBitmap&0x0010) Text+=" L"; if (ChannelBitmap&0x0100) Text+=" C"; if (ChannelBitmap&0x0020) Text+=" R"; if ((ChannelBitmap&0x0008)!=0x0000) Text+=", LFE"; return Text; } //--------------------------------------------------------------------------- const char* Mpeg4_chan_ChannelBitmap_Layout (int32u ChannelBitmap) { switch(ChannelBitmap) { case 0 : return "L"; // Left case 1 : return "R"; // Right case 2 : return "C"; // Center case 3 : return "LFE"; // LFEScreen case 4 : return "Ls"; // LeftSurround / Back Left case 5 : return "Rs"; // RightSurround / Back Right case 6 : return "?"; // LeftCenter case 7 : return "?"; // RightCenter case 8 : return "Cs"; // CenterSurround / Back Center case 9 : return "Lsd"; // LeftSurroundDirect / Side Left case 10 : return "Rsd"; // RightSurroundDirect / Side Right case 11 : return "?"; // TopCenterSurround case 12 : return "?"; // VerticalHeightLeft / Top Front Left case 13 : return "?"; // VerticalHeightCenter / Top Front Center case 14 : return "?"; // VerticalHeightRight / Top Front Right" case 15 : return "?"; // TopBackLeft case 16 : return "?"; // TopBackCenter case 17 : return "?"; // TopBackRight default : return "?"; } } //--------------------------------------------------------------------------- const char* Mpeg4_jp2h_METH(int8u METH) { switch (METH) { case 0x01 : return "Enumerated colourspace"; case 0x02 : return "Restricted ICC profile"; default : return ""; } } //--------------------------------------------------------------------------- const char* Mpeg4_jp2h_EnumCS(int32u EnumCS) { switch (EnumCS) { case 0x10 : return "RGB"; //sRGB case 0x11 : return "Y"; case 0x12 : return "YUV"; //sYUV default : return ""; } } //--------------------------------------------------------------------------- const char* Mpegv_colour_primaries(int8u colour_primaries); const char* Mpegv_transfer_characteristics(int8u transfer_characteristics); const char* Mpegv_matrix_coefficients(int8u matrix_coefficients); //--------------------------------------------------------------------------- // DTS #if defined(MEDIAINFO_DTS_YES) extern const char* DTS_ChannelPositions[16]; extern const char* DTS_ChannelPositions2[16]; extern std::string DTS_HD_SpeakerActivityMask (int16u SpeakerActivityMask); extern std::string DTS_HD_SpeakerActivityMask2 (int16u SpeakerActivityMask); #endif //defined(MEDIAINFO_DTS_YES) //*************************************************************************** // Constants //*************************************************************************** //--------------------------------------------------------------------------- namespace Elements { const int64u bloc=0x626C6F63; const int64u cdat=0x63646174; const int64u cdt2=0x63647432; const int64u free=0x66726565; const int64u ftyp=0x66747970; const int64u ftyp_qt=0x71742020; const int64u ftyp_dash=0x64617368; const int64u ftyp_isom=0x69736F6D; const int64u ftyp_caqv=0x63617176; const int64u idat=0x69646174; const int64u idsc=0x69647363; const int64u jp2c=0x6A703263; const int64u jp2h=0x6A703268; const int64u jp2h_ihdr=0x69686472; const int64u jp2h_colr=0x636F6C72; const int64u mdat=0x6D646174; const int64u mfra=0x6D667261; const int64u mfra_mfro=0x6D66726F; const int64u mfra_tfra=0x74667261; const int64u moof=0x6D6F6F66; const int64u moof_mfhd=0x6D666864; const int64u moof_traf=0x74726166; const int64u moof_traf_sdtp=0x73647470; const int64u moof_traf_tfhd=0x74666864; const int64u moof_traf_trun=0x7472756E; const int64u moov=0x6D6F6F76; const int64u moov_ainf=0x61696E66; const int64u moov_cmov=0x636D6F76; const int64u moov_cmov_cmvd=0x636D7664; const int64u moov_cmov_dcom=0x64636F6D; const int64u moov_cmov_dcom_zlib=0x7A6C6962; const int64u moov_ctab=0x63746162; const int64u moov_iods=0x696F6473; const int64u moov_meta=0x6D657461; const int64u moov_meta______=0x2D2D2D2D; const int64u moov_meta___day=0xA9646179; const int64u moov_meta__disk=0x6469736B; const int64u moov_meta__trkn=0x74726B6E; const int64u moov_meta__trng=0x74726E67; const int64u moov_meta__covr=0x636F7672; const int64u moov_meta__gnre=0x676E7265; const int64u moov_meta_bxml=0x62786D6C; const int64u moov_meta_hdlr=0x68646C72; const int64u moov_meta_hdlr_mdir=0x6D646972; const int64u moov_meta_hdlr_mdta=0x6D647461; const int64u moov_meta_hdlr_mp7b=0x6D703762; const int64u moov_meta_hdlr_mp7t=0x6D703774; const int64u moov_meta_keys=0x6B657973; const int64u moov_meta_keys_mdta=0x6D647461; const int64u moov_meta_ilst=0x696C7374; const int64u moov_meta_ilst_xxxx_data=0x64617461; const int64u moov_meta_ilst_xxxx_mean=0x6D65616E; const int64u moov_meta_ilst_xxxx_name=0x6E616D65; const int64u moov_meta_xml=0x786D6C20; const int64u moov_mvex=0x6D766578; const int64u moov_mvex_mehd=0x6D656864; const int64u moov_mvex_trex=0x74726578; const int64u moov_mvhd=0x6D766864; const int64u moov_trak=0x7472616B; const int64u moov_trak_edts=0x65647473; const int64u moov_trak_edts_elst=0x656C7374; const int64u moov_trak_load=0x6C6F6164; const int64u moov_trak_mdia=0x6D646961; const int64u moov_trak_mdia_hdlr=0x68646C72; const int64u moov_trak_mdia_hdlr_clcp=0x636C6370; const int64u moov_trak_mdia_hdlr_MPEG=0x4D504547; const int64u moov_trak_mdia_hdlr_sbtl=0x7362746C; const int64u moov_trak_mdia_hdlr_soun=0x736F756E; const int64u moov_trak_mdia_hdlr_subp=0x73756270; const int64u moov_trak_mdia_hdlr_text=0x74657874; const int64u moov_trak_mdia_hdlr_tmcd=0x746D6364; const int64u moov_trak_mdia_hdlr_vide=0x76696465; const int64u moov_trak_mdia_imap=0x696D6170; const int64u moov_trak_mdia_imap_sean=0x7365616E; const int64u moov_trak_mdia_imap_sean___in=0x0000696E; const int64u moov_trak_mdia_imap_sean___in___ty=0x00007479; const int64u moov_trak_mdia_imap_sean___in_dtst=0x64747374; const int64u moov_trak_mdia_imap_sean___in_obid=0x6F626964; const int64u moov_trak_mdia_mdhd=0x6D646864; const int64u moov_trak_mdia_minf=0x6D696E66; const int64u moov_trak_mdia_minf_code=0x636F6465; const int64u moov_trak_mdia_minf_code_sean=0x7365616E; const int64u moov_trak_mdia_minf_code_sean_RU_A=0x52552A41; const int64u moov_trak_mdia_minf_dinf=0x64696E66; const int64u moov_trak_mdia_minf_dinf_url_=0x75726C20; const int64u moov_trak_mdia_minf_dinf_urn_=0x75726E20; const int64u moov_trak_mdia_minf_dinf_dref=0x64726566; const int64u moov_trak_mdia_minf_dinf_dref_alis=0x616C6973; const int64u moov_trak_mdia_minf_dinf_dref_rsrc=0x72737263; const int64u moov_trak_mdia_minf_dinf_dref_url_=0x75726C20; const int64u moov_trak_mdia_minf_dinf_derf_urn_=0x75726E20; const int64u moov_trak_mdia_minf_gmhd=0x676D6864; const int64u moov_trak_mdia_minf_gmhd_gmin=0x676D696E; const int64u moov_trak_mdia_minf_gmhd_tmcd=0x746D6364; const int64u moov_trak_mdia_minf_gmhd_tmcd_tcmi=0x74636D69; const int64u moov_trak_mdia_minf_gmhd_tcmi=0x74636D69; const int64u moov_trak_mdia_minf_hint=0x68696E74; const int64u moov_trak_mdia_minf_hdlr=0x68646C72; const int64u moov_trak_mdia_minf_hmhd=0x686D6864; const int64u moov_trak_mdia_minf_nmhd=0x6E6D6864; const int64u moov_trak_mdia_minf_smhd=0x736D6864; const int64u moov_trak_mdia_minf_stbl=0x7374626C; const int64u moov_trak_mdia_minf_stbl_co64=0x636F3634; const int64u moov_trak_mdia_minf_stbl_cslg=0x63736C67; const int64u moov_trak_mdia_minf_stbl_ctts=0x63747473; const int64u moov_trak_mdia_minf_stbl_sdtp=0x73647470; const int64u moov_trak_mdia_minf_stbl_stco=0x7374636F; const int64u moov_trak_mdia_minf_stbl_stdp=0x73746470; const int64u moov_trak_mdia_minf_stbl_stps=0x73747073; const int64u moov_trak_mdia_minf_stbl_stsc=0x73747363; const int64u moov_trak_mdia_minf_stbl_stsd=0x73747364; const int64u moov_trak_mdia_minf_stbl_stsd_alac=0x616C6163; const int64u moov_trak_mdia_minf_stbl_stsd_mp4a=0x6D703461; const int64u moov_trak_mdia_minf_stbl_stsd_mp4s=0x6D703473; const int64u moov_trak_mdia_minf_stbl_stsd_mp4v=0x6D703476; const int64u moov_trak_mdia_minf_stbl_stsd_text=0x74657874; const int64u moov_trak_mdia_minf_stbl_stsd_tmcd=0x746D6364; const int64u moov_trak_mdia_minf_stbl_stsd_tmcd_name=0x6E616D65; const int64u moov_trak_mdia_minf_stbl_stsd_tx3g=0x74783367; const int64u moov_trak_mdia_minf_stbl_stsd_tx3g_ftab=0x66746162; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_alac=0x616C6163; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_ACLR=0x41434C52; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_APRG=0x41505247; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_ARES=0x41524553; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_avcC=0x61766343; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_bitr=0x62697472; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_btrt=0x62747274; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_clap=0x636C6170; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_chan=0x6368616E; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_colr=0x636F6C72; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_d263=0x64323633; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_dac3=0x64616333; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_damr=0x64616D72; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_dec3=0x64656333; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_ddts=0x64647473; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_dvc1=0x64766331; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_esds=0x65736473; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_fiel=0x6669656C; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_glbl=0x676C626C; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_hvcC=0x68766343; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_idfm=0x6964666D; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_idfm_atom=0x61746F6D; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_idfm_qtat=0x71746174; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_idfm_fxat=0x66786174; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_idfm_priv=0x70726976; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_idfm_subs=0x73756273; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_idfm_cspc=0x63737063; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_jp2h=0x6A703268; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_jp2h_colr=0x636F6C72; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_jp2h_ihdr=0x69686472; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_pasp=0x70617370; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_sinf=0x73696E66; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_sinf_frma=0x66726D61; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_sinf_imif=0x696D6966; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_sinf_schi=0x73636869; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_sinf_schm=0x7363686D; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_wave=0x77617665; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_wave_acbf=0x61636266; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_wave_enda=0x656E6461; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_wave_frma=0x66726D61; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_wave_samr=0x73616D72; const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_wave_srcq=0x73726371; const int64u moov_trak_mdia_minf_stbl_stsh=0x73747368; const int64u moov_trak_mdia_minf_stbl_stss=0x73747373; const int64u moov_trak_mdia_minf_stbl_stsz=0x7374737A; const int64u moov_trak_mdia_minf_stbl_stts=0x73747473; const int64u moov_trak_mdia_minf_stbl_stz2=0x73747A32; const int64u moov_trak_mdia_minf_vmhd=0x766D6864; const int64u moov_trak_meta=0x6D657461; const int64u moov_trak_meta______=0x2D2D2D2D; const int64u moov_trak_meta___day=0xA9646179; const int64u moov_trak_meta__disk=0x6469736B; const int64u moov_trak_meta__trkn=0x74726B6E; const int64u moov_trak_meta__trng=0x74726E67; const int64u moov_trak_meta__covr=0x636F7672; const int64u moov_trak_meta__gnre=0x676E7265; const int64u moov_trak_meta_bxml=0x62786D6C; const int64u moov_trak_meta_hdlr=0x68646C72; const int64u moov_trak_meta_hdlr_mdir=0x6D646972; const int64u moov_trak_meta_hdlr_mdta=0x6D647461; const int64u moov_trak_meta_hdlr_mp7b=0x6D703762; const int64u moov_trak_meta_hdlr_mp7t=0x6D703774; const int64u moov_trak_meta_keys=0x6B657973; const int64u moov_trak_meta_keys_mdta=0x6D647461; const int64u moov_trak_meta_ilst=0x696C7374; const int64u moov_trak_meta_ilst_xxxx_data=0x64617461; const int64u moov_trak_meta_ilst_xxxx_mean=0x6D65616E; const int64u moov_trak_meta_ilst_xxxx_name=0x6E616D65; const int64u moov_trak_meta_xml=0x786D6C20; const int64u moov_trak_tapt=0x74617074; const int64u moov_trak_tapt_clef=0x636C6566; const int64u moov_trak_tapt_enof=0x656E6F66; const int64u moov_trak_tapt_prof=0x70726F66; const int64u moov_trak_tkhd=0x746B6864; const int64u moov_trak_tref=0x74726566; const int64u moov_trak_tref_dpnd=0x64706E64; const int64u moov_trak_tref_chap=0x63686170; const int64u moov_trak_tref_clcp=0x636C6370; const int64u moov_trak_tref_fall=0x66616C6C; const int64u moov_trak_tref_folw=0x666F6C77; const int64u moov_trak_tref_forc=0x666F7263; const int64u moov_trak_tref_hint=0x68696E74; const int64u moov_trak_tref_ipir=0x69706972; const int64u moov_trak_tref_mpod=0x6D706F64; const int64u moov_trak_tref_scpt=0x73637074; const int64u moov_trak_tref_ssrc=0x73737263; const int64u moov_trak_tref_sync=0x73796E63; const int64u moov_trak_tref_tmcd=0x746D6364; const int64u moov_udta=0x75647461; const int64u moov_udta_AllF=0x416C6C46; const int64u moov_udta_chpl=0x6368706C; const int64u moov_udta_clsf=0x636C7366; const int64u moov_udta_DcMD=0x44634D44; const int64u moov_udta_DcMD_Cmbo=0x436D626F; const int64u moov_udta_DcMD_DcME=0x44634D45; const int64u moov_udta_DcMD_DcME_Keyw=0x4B657977; const int64u moov_udta_DcMD_DcME_Mtmd=0x4D746D64; const int64u moov_udta_DcMD_DcME_Rate=0x52617465; const int64u moov_udta_FIEL=0x4649454C; const int64u moov_udta_FXTC=0x46585443; const int64u moov_udta_hinf=0x68696E66; const int64u moov_udta_hinv=0x68696E76; const int64u moov_udta_hnti=0x686E7469; const int64u moov_udta_hnti_rtp=0x72747020; const int64u moov_udta_ID32=0x49443332; const int64u moov_udta_kywd=0x6B797764; const int64u moov_udta_loci=0x6C6F6369; const int64u moov_udta_LOOP=0x4C4F4F50; const int64u moov_udta_MCPS=0x4D435053; const int64u moov_udta_meta=0x6D657461; const int64u moov_udta_meta_hdlr=0x68646C72; const int64u moov_udta_meta_ilst=0x696C7374; const int64u moov_udta_meta_ilst_xxxx_data=0x64617461; const int64u moov_udta_meta_ilst_xxxx_mean=0x6D65616E; const int64u moov_udta_meta_ilst_xxxx_name=0x6E616D65; const int64u moov_udta_ndrm=0x6E64726D; const int64u moov_udta_nsav=0x6E736176; const int64u moov_udta_ptv =0x70747620; const int64u moov_udta_rtng=0x72746E67; const int64u moov_udta_Sel0=0x53656C30; const int64u moov_udta_tags=0x74616773; const int64u moov_udta_tags_meta=0x6D657461; const int64u moov_udta_tags_tseg=0x74736567; const int64u moov_udta_tags_tseg_tshd=0x74736864; const int64u moov_udta_WLOC=0x574C4F43; const int64u moov_udta_XMP_=0x584D505F; const int64u moov_udta_yrrc=0x79727263; const int64u pdin=0x7064696E; const int64u PICT=0x50494354; const int64u pckg=0x70636B67; const int64u pnot=0x706E6F74; const int64u RDAO=0x5244414F; const int64u RDAS=0x52444153; const int64u RDVO=0x5244564F; const int64u RDVS=0x52445653; const int64u RED1=0x52454431; const int64u REDA=0x52454441; const int64u REDV=0x52454456; const int64u REOB=0x52454F42; const int64u skip=0x736B6970; const int64u wide=0x77696465; } //--------------------------------------------------------------------------- const char* Mpeg4_Description(int32u Description) { switch (Description) { case Elements::moov_trak_mdia_minf_stbl_stsd_xxxx_idfm_atom : return "Classic atom structure"; case Elements::moov_trak_mdia_minf_stbl_stsd_xxxx_idfm_qtat : return "QT atom structure"; case Elements::moov_trak_mdia_minf_stbl_stsd_xxxx_idfm_fxat : return "Effect"; case Elements::moov_trak_mdia_minf_stbl_stsd_xxxx_idfm_priv : return "Private"; case Elements::moov_trak_mdia_minf_stbl_stsd_xxxx_idfm_subs : return "Substitute if main codec not available"; case Elements::moov_trak_mdia_minf_stbl_stsd_xxxx_idfm_cspc : return "Native pixel format"; default : return "Unknown"; } } //*************************************************************************** // Format //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpeg4::Data_Parse() { //mdat if (IsParsing_mdat) { mdat_xxxx(); return; } //Parsing DATA_BEGIN ATOM(bloc) ATOM(cdat) ATOM(cdt2) LIST_SKIP(free) ATOM(ftyp) ATOM(idat) ATOM(idsc) ATOM(jp2c) LIST(jp2h) ATOM_BEGIN ATOM(jp2h_colr) ATOM(jp2h_ihdr) ATOM_END LIST(mdat) ATOM_DEFAULT_ALONE(mdat_xxxx) LIST(mfra) ATOM_BEGIN ATOM(mfra_mfro) ATOM(mfra_tfra) ATOM_END LIST(moof) ATOM_BEGIN ATOM(moof_mfhd) LIST(moof_traf) ATOM_BEGIN ATOM(moof_traf_sdtp) ATOM(moof_traf_tfhd) ATOM(moof_traf_trun) ATOM_END ATOM_END LIST(moov) ATOM_BEGIN ATOM(moov_ainf) LIST(moov_cmov) ATOM_BEGIN ATOM(moov_cmov_dcom) ATOM(moov_cmov_cmvd) ATOM_END ATOM(moov_ctab) ATOM(moov_iods) LIST(moov_meta) ATOM_BEGIN ATOM(moov_meta_bxml) LIST(moov_meta_keys) ATOM_BEGIN ATOM(moov_meta_keys_mdta) ATOM_END ATOM(moov_meta_hdlr) LIST(moov_meta_ilst) LIST_DEFAULT_ALONE_BEGIN (moov_meta_ilst_xxxx) ATOM_BEGIN ATOM (moov_meta_ilst_xxxx_data) ATOM (moov_meta_ilst_xxxx_mean) ATOM (moov_meta_ilst_xxxx_name) ATOM_END LIST_DEFAULT_ALONE_END ATOM(moov_meta_xml) ATOM_END LIST(moov_mvex) ATOM_BEGIN ATOM(moov_mvex_mehd) ATOM(moov_mvex_trex) ATOM_END ATOM(moov_mvhd) LIST(moov_trak) ATOM_BEGIN LIST(moov_trak_edts) ATOM_BEGIN ATOM(moov_trak_edts_elst) ATOM_END ATOM(moov_trak_load) LIST(moov_trak_mdia) ATOM_BEGIN ATOM(moov_trak_mdia_hdlr) LIST(moov_trak_mdia_imap) ATOM_BEGIN LIST(moov_trak_mdia_imap_sean) ATOM_BEGIN LIST(moov_trak_mdia_imap_sean___in) ATOM_BEGIN ATOM(moov_trak_mdia_imap_sean___in___ty) ATOM(moov_trak_mdia_imap_sean___in_dtst) ATOM(moov_trak_mdia_imap_sean___in_obid) ATOM_END ATOM_END ATOM_END ATOM(moov_trak_mdia_mdhd) LIST(moov_trak_mdia_minf) ATOM_BEGIN LIST(moov_trak_mdia_minf_code) ATOM_BEGIN LIST(moov_trak_mdia_minf_code_sean) ATOM_BEGIN ATOM(moov_trak_mdia_minf_code_sean_RU_A) ATOM_END ATOM_END LIST(moov_trak_mdia_minf_dinf) ATOM_BEGIN ATOM(moov_trak_mdia_minf_dinf_url_) ATOM(moov_trak_mdia_minf_dinf_urn_) LIST(moov_trak_mdia_minf_dinf_dref) ATOM_BEGIN ATOM(moov_trak_mdia_minf_dinf_dref_alis) ATOM(moov_trak_mdia_minf_dinf_dref_rsrc) ATOM(moov_trak_mdia_minf_dinf_url_) ATOM(moov_trak_mdia_minf_dinf_urn_) ATOM_END ATOM_END ATOM(moov_trak_mdia_minf_hdlr) LIST(moov_trak_mdia_minf_gmhd) ATOM_BEGIN ATOM(moov_trak_mdia_minf_gmhd_gmin) LIST(moov_trak_mdia_minf_gmhd_tmcd) ATOM_BEGIN ATOM(moov_trak_mdia_minf_gmhd_tmcd_tcmi) ATOM_END ATOM(moov_trak_mdia_minf_gmhd_tcmi) ATOM_END ATOM(moov_trak_mdia_minf_hint) ATOM(moov_trak_mdia_minf_hmhd) ATOM(moov_trak_mdia_minf_nmhd) ATOM(moov_trak_mdia_minf_smhd) LIST(moov_trak_mdia_minf_stbl) ATOM_BEGIN ATOM(moov_trak_mdia_minf_stbl_co64) ATOM(moov_trak_mdia_minf_stbl_cslg) ATOM(moov_trak_mdia_minf_stbl_ctts) ATOM(moov_trak_mdia_minf_stbl_sdtp) ATOM(moov_trak_mdia_minf_stbl_stco) ATOM(moov_trak_mdia_minf_stbl_stdp) ATOM(moov_trak_mdia_minf_stbl_stps) ATOM(moov_trak_mdia_minf_stbl_stsc) LIST(moov_trak_mdia_minf_stbl_stsd) ATOM_BEGIN ATOM(moov_trak_mdia_minf_stbl_stsd_text) LIST(moov_trak_mdia_minf_stbl_stsd_tmcd) ATOM_BEGIN ATOM(moov_trak_mdia_minf_stbl_stsd_tmcd_name) ATOM_END LIST(moov_trak_mdia_minf_stbl_stsd_tx3g) ATOM_BEGIN ATOM(moov_trak_mdia_minf_stbl_stsd_tx3g_ftab) ATOM_END LIST_DEFAULT(moov_trak_mdia_minf_stbl_stsd_xxxx) ATOM_BEGIN ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_alac) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_ACLR) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_APRG) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_ARES) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_avcC) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_bitr) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_btrt) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_chan) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_clap) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_colr) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_d263) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_dac3) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_damr) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_dec3) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_ddts) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_dvc1) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_esds) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_fiel) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_glbl) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_hvcC) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_idfm) LIST(moov_trak_mdia_minf_stbl_stsd_xxxx_jp2h) ATOM_BEGIN ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_jp2h_colr) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_jp2h_ihdr) ATOM_END ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_pasp) LIST(moov_trak_mdia_minf_stbl_stsd_xxxx_sinf) ATOM_BEGIN ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_sinf_frma) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_sinf_imif) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_sinf_schi) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_sinf_schm) ATOM_END LIST(moov_trak_mdia_minf_stbl_stsd_xxxx_wave) ATOM_BEGIN ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_esds) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_wave_acbf) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_wave_enda) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_wave_frma) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_wave_samr) ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_wave_srcq) ATOM_DEFAULT(moov_trak_mdia_minf_stbl_stsd_xxxx_wave_xxxx) ATOM_END_DEFAULT ATOM_END ATOM_END_DEFAULT ATOM(moov_trak_mdia_minf_stbl_stsh) ATOM(moov_trak_mdia_minf_stbl_stss) ATOM(moov_trak_mdia_minf_stbl_stsz) ATOM(moov_trak_mdia_minf_stbl_stts) ATOM(moov_trak_mdia_minf_stbl_stz2) ATOM_END ATOM(moov_trak_mdia_minf_vmhd) ATOM_END ATOM_END /* Need additional tests LIST(moov_trak_meta) ATOM_BEGIN ATOM(moov_trak_meta_bxml) LIST(moov_trak_meta_keys) ATOM_BEGIN ATOM(moov_trak_meta_keys_mdta) ATOM_END ATOM(moov_trak_meta_hdlr) LIST(moov_trak_meta_ilst) ATOM_BEGIN LIST_DEFAULT (moov_trak_meta_ilst_xxxx) ATOM_BEGIN ATOM (moov_trak_meta_ilst_xxxx_data) ATOM (moov_trak_meta_ilst_xxxx_mean) ATOM (moov_trak_meta_ilst_xxxx_name) ATOM_END ATOM_END_DEFAULT ATOM(moov_trak_meta_xml) ATOM_END */ LIST(moov_trak_tapt) ATOM_BEGIN ATOM(moov_trak_tapt_clef) ATOM(moov_trak_tapt_prof) ATOM(moov_trak_tapt_enof) ATOM_END ATOM(moov_trak_tkhd) LIST(moov_trak_tref) ATOM_BEGIN ATOM(moov_trak_tref_chap) ATOM(moov_trak_tref_clcp) ATOM(moov_trak_tref_dpnd) ATOM(moov_trak_tref_fall) ATOM(moov_trak_tref_folw) ATOM(moov_trak_tref_forc) ATOM(moov_trak_tref_ipir) ATOM(moov_trak_tref_hint) ATOM(moov_trak_tref_mpod) ATOM(moov_trak_tref_scpt) ATOM(moov_trak_tref_ssrc) ATOM(moov_trak_tref_sync) ATOM(moov_trak_tref_tmcd) ATOM_END ATOM_END LIST(moov_udta) ATOM_BEGIN ATOM(moov_udta_AllF) ATOM(moov_udta_chpl) ATOM(moov_udta_clsf) LIST(moov_udta_DcMD) ATOM_BEGIN ATOM(moov_udta_DcMD_Cmbo) LIST(moov_udta_DcMD_DcME) ATOM_BEGIN ATOM(moov_udta_DcMD_DcME_Keyw) ATOM(moov_udta_DcMD_DcME_Mtmd) ATOM(moov_udta_DcMD_DcME_Rate) ATOM_END ATOM_END ATOM(moov_udta_FIEL) ATOM(moov_udta_FXTC) ATOM(moov_udta_hinf) ATOM(moov_udta_hinv) LIST(moov_udta_hnti) ATOM_BEGIN ATOM(moov_udta_hnti_rtp) ATOM_END ATOM(moov_udta_ID32) ATOM(moov_udta_kywd) ATOM(moov_udta_loci) ATOM(moov_udta_LOOP) ATOM(moov_udta_MCPS) LIST(moov_udta_meta) ATOM_BEGIN ATOM(moov_udta_meta_hdlr) LIST(moov_udta_meta_ilst) LIST_DEFAULT_ALONE_BEGIN (moov_udta_meta_ilst_xxxx) ATOM_BEGIN ATOM (moov_udta_meta_ilst_xxxx_data); ATOM (moov_udta_meta_ilst_xxxx_mean); ATOM (moov_udta_meta_ilst_xxxx_name); ATOM_END LIST_DEFAULT_ALONE_END ATOM_END ATOM(moov_udta_ndrm) ATOM(moov_udta_nsav) ATOM(moov_udta_ptv ) ATOM(moov_udta_rtng) ATOM(moov_udta_Sel0) LIST(moov_udta_tags) ATOM_BEGIN ATOM(moov_udta_tags_meta) LIST(moov_udta_tags_tseg) ATOM_BEGIN ATOM(moov_udta_tags_tseg_tshd); ATOM_END ATOM_END ATOM(moov_udta_WLOC) ATOM(moov_udta_XMP_) ATOM(moov_udta_yrrc) ATOM_DEFAULT (moov_udta_xxxx); //User data ATOM_END_DEFAULT ATOM_END ATOM(pdin) ATOM(PICT) ATOM(RDAO) ATOM(RDAS) ATOM(RDVO) ATOM(RDVS) ATOM(RED1) ATOM(REDA) ATOM(REDV) ATOM(REOB) ATOM(pckg) ATOM(pnot) LIST_SKIP(skip) LIST_SKIP(wide) DATA_END } //*************************************************************************** // Elements //*************************************************************************** #define NAME_VERSION_FLAG(ELEMENT_NAME) \ Element_Name(ELEMENT_NAME); \ int32u Flags; \ int8u Version; \ { \ Get_B1(Version, "Version"); \ Get_B3(Flags, "Flags"); \ } \ #define INTEGRITY_VERSION(_VERSION) \ if (Version>_VERSION) \ { \ Skip_XX(Element_Size-Element_Offset, "Unknown data"); \ return; \ } \ #define INTEGRITY(TOVALIDATE, ERRORTEXT) \ if (!(TOVALIDATE)) \ { \ Trusted_IsNot(ERRORTEXT); \ return; \ } \ #define INTEGRITY_SIZE1(ELEMENT_SIZE0) \ INTEGRITY_VERSION(0); \ if (Element_Size!=ELEMENT_SIZE0+4) \ { \ Trusted_IsNot("Size is wrong"); \ return; \ } \ #define INTEGRITY_SIZE2(ELEMENT_SIZE0, ELEMENT_SIZE1) \ INTEGRITY_VERSION(1); \ if (Version==0 && Element_Size!=ELEMENT_SIZE0 \ || Version==1 && Element_Size!=ELEMENT_SIZE1) \ { \ Trusted_IsNot("Size is wrong"); \ return; \ } \ #define INTEGRITY_SIZE_ATLEAST1(ELEMENT_SIZE0) \ INTEGRITY_VERSION(0); \ if (Version==0 && Element_SizeFrameInfo=FrameInfo; #endif //MEDIAINFO_DEMUX while (Element_Offset+2<=Element_Size) { Open_Buffer_Continue(Streams[(int32u)Element_Code].Parsers[0], Buffer+Buffer_Offset+(size_t)Element_Offset, 2); Element_Offset+=2; } } //--------------------------------------------------------------------------- void File_Mpeg4::free() { Element_Name("Free space"); //Parsing #if MEDIAINFO_TRACE if (Trace_Activated) Param("Data", Ztring("(")+Ztring::ToZtring(Element_TotalSize_Get())+Ztring(" bytes)")); #endif //MEDIAINFO_TRACE #if MEDIAINFO_MD5 if (MD5==NULL || (!IsSecondPass && FirstMdatPossecond.stco.push_back(File_Offset+Buffer_Offset); } //--------------------------------------------------------------------------- void File_Mpeg4::ftyp() { Element_Name("File Type"); if (Count_Get(Stream_General)) { Skip_XX(Element_Size, "Duplicate ftyp"); return; } //Parsing std::vector ftyps; Get_C4 (MajorBrand, "MajorBrand"); ftyps.push_back(MajorBrand); Skip_B4( "MajorBrandVersion"); while (Element_OffsetFile_Names.size()==1)TestContinuousFileNames(1, __T("m4s")); break; case Elements::ftyp_caqv : Fill(StreamKind_Last, StreamPos_Last, "Encoded_Application", "Casio Digital Camera"); break; default : ; } CodecID_Fill(Ztring().From_CC4(MajorBrand), Stream_General, 0, InfoCodecID_Format_Mpeg4); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::idat() { Element_Name("QTI"); //Parsing Skip_XX(Element_Size, "Data"); FILLING_BEGIN(); Accept("QTI"); Fill(Stream_General, 0, General_Format, "MPEG-4"); CodecID_Fill(__T("QTI"), Stream_General, 0, InfoCodecID_Format_Mpeg4); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::idsc() { Element_Name("QTI"); //Parsing Skip_XX(Element_Size, "Data"); FILLING_BEGIN(); Accept("QTI"); Fill(Stream_General, 0, General_Format, "MPEG-4"); CodecID_Fill(__T("QTI"), Stream_General, 0, InfoCodecID_Format_Mpeg4); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::jp2c() { Element_Name("JPEG 2000 content"); #if defined(MEDIAINFO_JPEG_YES) //Creating the parser File_Jpeg MI; if (IsSub || Config->File_Names.size()>1) //If contained in another container or several files, this is a video stream MI.StreamKind=Stream_Video; Open_Buffer_Init(&MI); //Demux #if MEDIAINFO_DEMUX #if MEDIAINFO_EVENTS StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS if (Frame_Count_NotParsedIncluded==(int64u)-1) Frame_Count_NotParsedIncluded=0; if (Config->Demux_Rate_Get()) { FrameInfo.DTS=float64_int64s(Frame_Count_NotParsedIncluded*1000000000/Config->Demux_Rate_Get()); FrameInfo.PTS=FrameInfo.DTS; FrameInfo.DUR=float64_int64s(1000000000/Config->Demux_Rate_Get()); } Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream); #endif //MEDIAINFO_DEMUX //Parsing Open_Buffer_Continue(&MI); //Filling if (Frame_Count==0) { Accept("MPEG-4"); Fill(Stream_General, 0, General_Format, "JPEG 2000", Unlimited, true, true); Fill(Stream_General, 0, General_Format_Profile, "MPEG-4"); Finish(&MI); Merge(MI, MI.StreamKind, 0, 0); Fill("MPEG-4"); if (Config->File_Names.size()>1) { int64u OverHead=Config->File_Sizes[0]-Element_Size; Fill(Stream_Video, 0, Video_StreamSize, File_Size-Config->File_Names.size()*OverHead, 10, true); } if (Config->ParseSpeed<1.0) Finish("MPEG-4"); } Frame_Count++; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; #endif } //--------------------------------------------------------------------------- void File_Mpeg4::jp2h() { Element_Name("JPEG-2000 header"); } //--------------------------------------------------------------------------- void File_Mpeg4::jp2h_colr() { Element_Name("Color"); //Parsing int8u METH; Get_B1 (METH, "METH - Specification method"); Param_Info1(Mpeg4_jp2h_METH(METH)); Skip_B1( "PREC - Precedence"); Skip_B1( "APPROX - Colourspace approximation"); switch (METH) { case 0x01 : { int32u EnumCS; Get_B4 (EnumCS, "EnumCS - Enumerated colourspace"); Param_Info1(Mpeg4_jp2h_EnumCS(EnumCS)); Fill(StreamKind_Last, 0, "ColorSpace", Mpeg4_jp2h_EnumCS(EnumCS)); } break; case 0x02 : Skip_XX(Element_Size-Element_Offset, "PROFILE"); break; default : Skip_XX(Element_Size-Element_Offset, "Unknown"); return; } } //--------------------------------------------------------------------------- void File_Mpeg4::jp2h_ihdr() { Element_Name("Header"); //Parsing Skip_B4( "Height"); Skip_B4( "Width"); Skip_B2( "NC - Number of components"); BS_Begin(); Skip_SB( "BPC - Bits per component (Sign)"); Skip_S1(7, "BPC - Bits per component (Value)"); BS_End(); Skip_B1( "C - Compression type"); Skip_B1( "UnkC - Colourspace Unknown"); Skip_B1( "IPR - Intellectual Property"); } //--------------------------------------------------------------------------- void File_Mpeg4::mdat() { #if MEDIAINFO_TRACE Trace_Layers_Update(8); //Streams #endif //MEDIAINFO_TRACE if (!Status[IsAccepted]) { Data_Accept("MPEG-4"); Fill(Stream_General, 0, General_Format, "QuickTime"); } Element_Name("Data"); //Sizes if (Retrieve(Stream_General, 0, General_HeaderSize).empty()) { Fill(Stream_General, 0, General_HeaderSize, File_Offset+Buffer_Offset-Header_Size); Fill(Stream_General, 0, General_DataSize, Element_TotalSize_Get()+Header_Size); if (File_Size!=(int64u)-1 && File_Offset+Buffer_Offset+Element_TotalSize_Get()<=File_Size) Fill(Stream_General, 0, General_FooterSize, File_Size-(File_Offset+Buffer_Offset+Element_TotalSize_Get())); Fill(Stream_General, 0, General_IsStreamable, FirstMoovPos==(int64u)-1?"No":"Yes"); } //Trace #if MEDIAINFO_TRACE Trace_Layers_Update(0); //Container1 #endif //MEDIAINFO_TRACE if (IsSecondPass && !mdat_Pos.empty() && mdat_Pos.begin()->firstLastMdatPos) LastMdatPos=File_Offset+Buffer_Offset+Element_TotalSize_Get(); //Parsing #if MEDIAINFO_TRACE if (Trace_Activated) Param("Data", Ztring("(")+Ztring::ToZtring(Element_TotalSize_Get())+Ztring(" bytes)")); #endif //MEDIAINFO_TRACE #if MEDIAINFO_MD5 if (MD5==NULL || (!IsSecondPass && FirstMdatPossecond.stco.push_back(File_Offset+Buffer_Offset); } //--------------------------------------------------------------------------- void File_Mpeg4::mdat_xxxx() { if (!Element_IsComplete_Get()) { Element_WaitForMoreData(); return; } if (!IsSub) { if (Config->ParseSpeed>=1.0) Config->State_Set(((float)Buffer_TotalBytes)/File_Size); } std::map::iterator Stream=Streams.find((int32u)Element_Code); if (Stream==Streams.end()) { Skip_XX(Element_Size, "Unknown"); mdat_StreamJump(); return; } #if MEDIAINFO_DEMUX if (Streams[(int32u)Element_Code].StreamKind!=Stream_Other && Streams[(int32u)Element_Code].StreamKind!=Stream_Max) { //DTS Frame_Count_NotParsedIncluded=Stream->second.stts_FramePos; if (Stream->second.stts_Durations_Possecond.stts_Durations.size()) { stream::stts_durations::iterator stts_Duration=Stream->second.stts_Durations.begin()+Stream->second.stts_Durations_Pos; FrameInfo.DTS=TimeCode_DtsOffset+(stts_Duration->DTS_Begin+(((int64u)stts_Duration->SampleDuration)*(Frame_Count_NotParsedIncluded-stts_Duration->Pos_Begin)))*1000000000/Stream->second.mdhd_TimeScale; FrameInfo.PTS=Streams[(int32u)Element_Code].PtsDtsAreSame?FrameInfo.DTS:(int64u)-1; FrameInfo.DUR=((int64u)stts_Duration->SampleDuration)*1000000000/Stream->second.mdhd_TimeScale; Streams[(int32u)Element_Code].stts_FramePos++; if (Stream->second.stts_FramePos>=stts_Duration->Pos_End) Stream->second.stts_Durations_Pos++; if (!Stream->second.stss.empty()) { Demux_random_access=false; for (size_t Pos=0; Possecond.stss.size(); Pos++) if (Stream->second.stss[Pos]==Frame_Count_NotParsedIncluded) { Demux_random_access=true; break; } } else Demux_random_access=true; } else { FrameInfo.DTS=(int64u)-1; FrameInfo.DUR=(int64u)-1; Streams[(int32u)Element_Code].stts_FramePos++; } Demux_Level=Streams[(int32u)Element_Code].Demux_Level; Demux(Buffer+Buffer_Offset+Streams[(int32u)Element_Code].Demux_Offset, (size_t)(Element_Size-Streams[(int32u)Element_Code].Demux_Offset), ContentType_MainStream); } #endif //MEDIAINFO_DEMUX for (size_t Pos=0; Possecond.Parsers.size(); Pos++) { #if MEDIAINFO_DEMUX Stream->second.Parsers[Pos]->FrameInfo=FrameInfo; #endif //MEDIAINFO_DEMUX Open_Buffer_Continue(Stream->second.Parsers[Pos], Buffer+Buffer_Offset, (size_t)Element_Size); #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent && Config->Demux_Unpacketize_Get()) Stream->second.Demux_EventWasSent=true; #endif //MEDIAINFO_DEMUX Element_Show(); #if MEDIAINFO_DEMUX if (!Stream->second.IsFilled && Stream->second.Parsers[Pos]->Status[IsFilled]) { if (Stream->second.StreamKind==Stream_Other) //If this is a TimeCode track { if (((File_Mpeg4_TimeCode*)Stream->second.Parsers[Pos])->Pos!=(int32u)-1) { for (std::map::iterator StreamTemp=Streams.begin(); StreamTemp!=Streams.end(); ++StreamTemp) if (StreamTemp->second.TimeCode_TrackID==Stream->first) { TimeCode_FrameOffset=((File_Mpeg4_TimeCode*)Stream->second.Parsers[Pos])->Pos; TimeCode_DtsOffset=float64_int64s(((float64)TimeCode_FrameOffset)*1000000000*Stream->second.TimeCode->FrameDuration/Stream->second.TimeCode->TimeScale); } } } Stream->second.IsFilled=true; if (Config->ParseSpeed<1) { bool File_Offset_Next_IsValid; int64u File_Offset_Next; if (mdat_Pos_Temp!=mdat_Pos.end()) { File_Offset_Next=mdat_Pos_Temp->first; File_Offset_Next_IsValid=true; } else { File_Offset_Next=(int64u)-1; File_Offset_Next_IsValid=false; } mdat_pos mdat_Pos_New; for (mdat_pos::iterator mdat_Pos_Item=mdat_Pos.begin(); mdat_Pos_Item!=mdat_Pos.end(); ++mdat_Pos_Item) if (mdat_Pos_Item->second.StreamID!=Stream->first) mdat_Pos_New[mdat_Pos_Item->first]=mdat_Pos_Item->second; mdat_Pos=mdat_Pos_New; if (File_Offset_Next_IsValid) for (mdat_Pos_Temp=mdat_Pos.begin(); mdat_Pos_Temp!=mdat_Pos.end(); ++mdat_Pos_Temp) if (mdat_Pos_Temp->first>=File_Offset_Next) break; } } #endif //MEDIAINFO_DEMUX //Multiple parsers if (Stream->second.Parsers.size()>1) { if (!Stream->second.Parsers[Pos]->Status[IsAccepted] && Stream->second.Parsers[Pos]->Status[IsFinished]) { delete *(Stream->second.Parsers.begin()+Pos); Stream->second.Parsers.erase(Stream->second.Parsers.begin()+Pos); Pos--; } else if (Stream->second.Parsers.size()>1 && Stream->second.Parsers[Pos]->Status[IsAccepted]) { File__Analyze* Parser=Stream->second.Parsers[Pos]; for (size_t Pos2=0; Pos2second.Parsers.size(); Pos2++) { if (Pos2!=Pos) delete *(Stream->second.Parsers.begin()+Pos2); } Stream->second.Parsers.clear(); Stream->second.Parsers.push_back(Parser); } } } //Next piece of data Element_Offset=Element_Size; Element_Show(); mdat_StreamJump(); } //--------------------------------------------------------------------------- void File_Mpeg4::mdat_StreamJump() { //Finding right file offset int64u ToJump=File_Size; if (mdat_Pos_Temp!=mdat_Pos.end()) { ToJump=mdat_Pos_Temp->first; #if MEDIAINFO_DEMUX if (Config->ParseSpeed==1) { std::map::iterator StreamOffset_Jump_Temp=StreamOffset_Jump.find(ToJump); if (StreamOffset_Jump_Temp!=StreamOffset_Jump.end()) { ToJump=StreamOffset_Jump_Temp->second; mdat_Pos_Temp=mdat_Pos.find(ToJump); } } #endif // MEDIAINFO_DEMUX } if (ToJump>File_Size) ToJump=File_Size; if (ToJump!=File_Offset+Buffer_Offset+Element_Size) { if (!Status[IsAccepted]) Data_Accept("MPEG-4"); #if MEDIAINFO_MD5 if (Config->File_Md5_Get() && ((IsSecondPass && mdat_Pos_NormalParsing) || FirstMoovPossecond.mvex_trex_default_sample_duration; moof_traf_default_sample_size=Stream->second.mvex_trex_default_sample_size; } //--------------------------------------------------------------------------- void File_Mpeg4::moof_traf_sdtp() { NAME_VERSION_FLAG("Independent and Disposable Samples"); //Parsing //for (int32u Pos=0; Possecond.mvex_trex_default_sample_duration; if (!default_sample_size_present) moof_traf_default_sample_size=Stream->second.mvex_trex_default_sample_size; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moof_traf_trun() { NAME_VERSION_FLAG("Track Fragment Run"); //Parsing int32u sample_count; bool first_sample_flags_present, sample_duration_present, sample_size_present, sample_flags_present, sample_composition_time_offset_present; Get_Flags (Flags, 0, data_offset_present, "data-offset-present"); Get_Flags (Flags, 2, first_sample_flags_present, "first-sample-flags-present"); Get_Flags (Flags, 8, sample_duration_present, "sample-duration-present"); Get_Flags (Flags, 9, sample_size_present, "sample-size-present"); Get_Flags (Flags, 10, sample_flags_present, "sample-flags-present"); Get_Flags (Flags, 11, sample_composition_time_offset_present, "sample-composition-time-offsets-present"); Get_B4 (sample_count, "sample_count"); int64u data_offset_Final=moof_traf_base_data_offset!=(int64u)-1?moof_traf_base_data_offset:moof_base_data_offset; if (data_offset_present) { int32u data_offset; Get_B4 (data_offset, "data_offset"); data_offset_Final+=data_offset; } //Filling if (moof_traf_base_data_offset!=(int64u)-1 || data_offset_present) Stream->second.stco.push_back(data_offset_Final); stream::stsc_struct Stsc; if (Stream->second.stsc.empty()) Stsc.FirstChunk=1; else Stsc.FirstChunk=Stream->second.stsc[Stream->second.stsc.size()-1].FirstChunk+1; Stsc.SamplesPerChunk=sample_count; Stream->second.stsc.push_back(Stsc); if (!sample_duration_present) moov_trak_mdia_minf_stbl_stts_Common(sample_count, moof_traf_default_sample_duration); if (!sample_size_present) Stream->second.stsz.resize(Stream->second.stsz.size()+sample_count, moof_traf_default_sample_size); if (first_sample_flags_present) Skip_B4( "first_sample_flags"); for (int32u Pos=0; Possecond.stsz_StreamSize+=sample_size; Stream->second.stsz_Total.push_back(sample_size); if (Stream->second.stsz.size()second.stsz.push_back(sample_size); } if (sample_flags_present) Skip_B4( "sample_flags"); if (sample_composition_time_offset_present) Skip_B4( "sample_composition_time_offset"); Element_End0(); } } //--------------------------------------------------------------------------- void File_Mpeg4::moov() { if (!Status[IsAccepted]) { Data_Accept("MPEG-4"); Fill(Stream_General, 0, General_Format, "QuickTime"); //If there is no ftyp atom, this is an old Quictime file } Element_Name("File header"); if (IsSecondPass || FirstMoovPos!=(int64u)-1) //Currently, the 1 moov atom is used { #if MEDIAINFO_TRACE if (Trace_Activated) Param("Data", Ztring("(")+Ztring::ToZtring(Element_TotalSize_Get())+Ztring(" bytes)")); #endif //MEDIAINFO_TRACE #if MEDIAINFO_MD5 if (MD5==NULL || (!IsSecondPass && FirstMdatPos Element_Sizes_Sav; size_t Element_Level_Sav=Element_Level; while(Element_Level) { Element_Sizes_Sav.push_back(Element_TotalSize_Get()); Element_End0(); } //Configuring buffer const int8u* Buffer_Sav=Buffer; size_t Buffer_Size_Sav=Buffer_Size; int8u* Buffer_Temp_Sav=Buffer_Temp; size_t Buffer_Temp_Size_Sav=Buffer_Temp_Size; size_t Buffer_Offset_Sav=Buffer_Offset; size_t Buffer_Offset_Temp_Sav=Buffer_Offset_Temp; Buffer=NULL; Buffer_Size=0; Buffer_Temp=NULL; Buffer_Temp_Size=0; Buffer_Offset=0; Buffer_Offset_Temp=0; //Configuring file size int64u File_Offset_Sav=File_Offset; int64u File_Size_Sav=File_Size; if (File_Size=Duration*0.99 && Streams[moov_trak_tkhd_TrackID].tkhd_Duration*0.99<=Duration*1.01 && TimeScale && File_Mpeg4::TimeScale!=TimeScale) { float64 Ratio=((float64)TimeScale)/((float64)File_Mpeg4::TimeScale); Streams[moov_trak_tkhd_TrackID].tkhd_Duration=float64_int64s(Streams[moov_trak_tkhd_TrackID].tkhd_Duration/Ratio); Clear(StreamKind_Last, StreamPos_Last, "Duration_Source"); Fill(StreamKind_Last, StreamPos_Last, "Duration", float64_int64s(((float64)Streams[moov_trak_tkhd_TrackID].tkhd_Duration)*1000/((float64)File_Mpeg4::TimeScale)), 10, true); } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf() { Element_Name("Media Information"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_code() { Element_Name("code (found in Avid?)"); //Parsing Skip_B4( "Unknown"); Skip_B4( "Unknown"); Skip_B4( "Unknown"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_code_sean() { Element_Name("sean (found in Avid?)"); //Parsing Skip_B4( "Unknown"); Skip_B4( "Unknown"); Skip_B4( "Unknown"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_code_sean_RU_A() { Element_Name("RU*A (found in Avid?)"); //Parsing Ztring Path; Skip_B4( "Unknown"); Skip_B4( "Unknown"); Skip_B4( "Unknown"); Get_Local(Element_Size-Element_Offset, Path, "Path?"); FILLING_BEGIN(); Streams[moov_trak_tkhd_TrackID].File_Name=Path; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_dinf() { Element_Name("Data Information"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_dinf_url_() { NAME_VERSION_FLAG("Data Location"); //Parsing Skip_Local(Element_Size-Element_Offset, "location"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_dinf_urn_() { NAME_VERSION_FLAG("Data Name"); //Parsing Skip_Local(Element_Size-Element_Offset, "name TODO location after null string"); //Skip_Local(Element_Size, location); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_dinf_dref() { NAME_VERSION_FLAG("Data Reference"); //Parsing Skip_B4( "entry_count"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_dinf_dref_alis() { NAME_VERSION_FLAG("Alias"); //bit 0 = external/internal data //Often empty bool IsInternal; Get_Flags (Flags, 0, IsInternal, "IsInternal"); if (IsInternal) return; //Internal stream, no alias //Parsing Ztring file_name_string, volume_name_string, Directory_Name; int16u record_size, record_version, alias_kind; int8u volume_name_string_length, file_name_string_length; Element_Begin1("Mac OS Alias Record"); Skip_B4( "user type name/app creator code"); Get_B2 (record_size, "record size"); Get_B2 (record_version, "record version"); if (record_version!=2) { Skip_XX(Element_Size-Element_Offset, "unknown"); return; } int64u End=Element_Offset-8+record_size; if (End>Element_Size) End=Element_Size; //Found one file having record_size = the size of the atom, header included Get_B2 (alias_kind, "alias kind"); Param_Info1(alias_kind?"directory":"file"); Get_B1 (volume_name_string_length, "volume name string length"); if (volume_name_string_length>27) volume_name_string_length=27; Get_Local(volume_name_string_length, volume_name_string, "volume name string"); if (volume_name_string_length<27) Skip_XX(27-volume_name_string_length, "volume name string padding"); Skip_B4( "volume created mac local date"); //seconds since beginning 1904 to 2040 Skip_B2( "file system type"); Skip_B2( "drive type"); Skip_B4( "parent directory ID"); Get_B1 (file_name_string_length, "file name string length"); if (file_name_string_length>99) file_name_string_length=99; Get_Local(file_name_string_length, file_name_string, "file name string"); if (file_name_string_length<63) Skip_XX(63-file_name_string_length, "file name string padding"); if (file_name_string_length<=63) Skip_B4( "file number"); else if (file_name_string_length<67) Skip_XX(67-file_name_string_length, "file name string padding (hack)"); if (file_name_string_length<=67) Skip_B4( "file created mac local date"); else if (file_name_string_length<71) Skip_XX(71-file_name_string_length, "file name string padding (hack)"); if (file_name_string_length<=71) Skip_B4( "file type name"); else if (file_name_string_length<75) Skip_XX(75-file_name_string_length, "file name string padding (hack)"); if (file_name_string_length<=75) Skip_B4( "file creator name"); else if (file_name_string_length<79) Skip_XX(79-file_name_string_length, "file name string padding (hack)"); if (file_name_string_length<=79) Skip_B2( "next level up from alias"); else if (file_name_string_length<81) Skip_XX(81-file_name_string_length, "file name string padding (hack)"); if (file_name_string_length<=81) Skip_B2( "next level down to target"); else if (file_name_string_length<83) Skip_XX(83-file_name_string_length, "file name string padding (hack)"); if (file_name_string_length<=83) Skip_B4( "volume attributes"); else if (file_name_string_length<87) Skip_XX(87-file_name_string_length, "file name string padding (hack)"); if (file_name_string_length<=87) Skip_B2( "volume file system ID"); else if (file_name_string_length<89) Skip_XX(89-file_name_string_length, "file name string padding (hack)"); if (file_name_string_length<=89) Skip_XX(10, "Reserved"); else if (file_name_string_length<99) Skip_XX(99-file_name_string_length, "file name string padding (hack)"); while(Element_Offset=25 && 25+Buffer[Buffer_Offset+24]==Element_Size) Skip_BFP4(16, "Text size"); //Non-Standard, but found in several files else Skip_B2( "Text size"); Skip_B2( "Text color (red)"); Skip_B2( "Text color (green)"); Skip_B2( "Text color (blue)"); Skip_B2( "Background color (red)"); Skip_B2( "Background color (green)"); Skip_B2( "Background color (blue)"); Get_B1 (FontNameSize, "Font name size"); Skip_Local(FontNameSize, "Font name"); FILLING_BEGIN(); Streams[moov_trak_tkhd_TrackID].TimeCode_IsVisual=IsVisual; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_hint() { NAME_VERSION_FLAG("Hint"); //Parsing Skip_B2( "Maximum packet delivery unit"); Skip_B2( "Average packet delivery unit"); Skip_B4( "Maximum bit rate"); Skip_B4( "Average bit rate"); Skip_B4( "Reserved"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_hdlr() { moov_trak_mdia_hdlr(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_hmhd() { NAME_VERSION_FLAG("Hint Media Header"); //Parsing Skip_B2( "maxPDUsize"); Skip_B2( "avgPDUsize"); Skip_B4( "maxbitrate"); Skip_B4( "avgbitrate"); Skip_B4( "reserved"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_nmhd() { NAME_VERSION_FLAG("Null Media Header"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_smhd() { NAME_VERSION_FLAG("Sound Media Header"); //Parsing Skip_B2( "Audio balance"); Skip_B2( "Reserved"); FILLING_BEGIN(); if (StreamKind_Last!=Stream_Audio) Stream_Prepare(Stream_Audio); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_vmhd() { NAME_VERSION_FLAG("Video Media Header") //Parsing Skip_B2( "Graphic mode"); Skip_B2( "Graphic mode color R"); Skip_B2( "Graphic mode color G"); Skip_B2( "Graphic mode color B"); FILLING_BEGIN(); if (StreamKind_Last!=Stream_Video) { Stream_Prepare(Stream_Video); Streams[moov_trak_tkhd_TrackID].StreamKind=Stream_Video; Streams[moov_trak_tkhd_TrackID].StreamPos=StreamPos_Last; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl() { Element_Name("Sample Table"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_co64() { NAME_VERSION_FLAG("Chunk offset"); int64u Offset; int32u Count; Get_B4 (Count, "Number of entries"); for (int32u Pos=0; PosElement_Size) break; //Problem Offset=BigEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=8; if (PosElement_Size) break; //Problem sample_count =BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset ); sample_offset=BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset+4); Element_Offset+=8; */ } } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_sdtp() { Element_Name("Sample Dependency"); //Parsing Skip_XX(Element_Size, "Unknown"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stco() { NAME_VERSION_FLAG("Chunk offset"); int32u Count, Offset; Get_B4 (Count, "Number of entries"); for (int32u Pos=0; PosElement_Size) break; //Problem Offset=BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=4; if (PosElement_Size) break; //Problem sample_number=BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=4; //Coherency testing (first frame is 0 or 1) if (sample_number==0 && Offset) { for (size_t Pos=0; Streams[moov_trak_tkhd_TrackID].stss.size(); Pos++) Streams[moov_trak_tkhd_TrackID].stss[Pos]--; Offset=0; } Streams[moov_trak_tkhd_TrackID].stss.push_back(sample_number-Offset); } if (!stss_PreviouslyEmpty) std::sort(Streams[moov_trak_tkhd_TrackID].stss.begin(), Streams[moov_trak_tkhd_TrackID].stss.end()); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsc() { NAME_VERSION_FLAG("Sample To Chunk"); //Parsing int32u Count; stream::stsc_struct Stsc; Get_B4 (Count, "Number of entries"); for (int32u Pos=0; PosElement_Size) break; //Problem Stsc.FirstChunk =BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset ); Stsc.SamplesPerChunk=BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset+4); Element_Offset+=12; Streams[moov_trak_tkhd_TrackID].stsc.push_back(Stsc); } else Element_Offset=Element_Size; //No need } } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd() { NAME_VERSION_FLAG("Sample Description"); //Parsing Skip_B4( "Count"); //Filling moov_trak_mdia_minf_stbl_stsd_Pos=0; } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_text() { Element_Name("Text (Apple)"); //Parsing int8u TextName_Size; Skip_B4( "Reserved"); Skip_B2( "Reserved"); Skip_B2( "Data reference index"); Info_B4(Flags, "Display flags"); Skip_Flags(Flags, 1, "Don't auto scale"); Skip_Flags(Flags, 3, "Use movie background color"); Skip_Flags(Flags, 5, "Scroll in"); Skip_Flags(Flags, 6, "Scroll out"); Skip_Flags(Flags, 7, "Horizontal scroll"); Skip_Flags(Flags, 8, "Reverse scroll"); Skip_Flags(Flags, 9, "Continuous scroll"); Skip_Flags(Flags, 12, "Drop shadow"); Skip_Flags(Flags, 13, "Anti-alias"); Skip_Flags(Flags, 14, "Key text"); Skip_B4( "Text justification"); Skip_B2( "Background color (Red)"); Skip_B2( "Background color (Green)"); Skip_B2( "Background color (Blue)"); Element_Begin1("Default text box"); Skip_B2( "top"); Skip_B2( "left"); Skip_B2( "bottom"); Skip_B2( "right"); Element_End0(); Skip_B8( "Reserved"); Skip_B2( "Font number"); Info_B2(FontFace, "Font face"); Skip_Flags(FontFace, 0, "Bold"); Skip_Flags(FontFace, 1, "Italic"); Skip_Flags(FontFace, 2, "Underline"); Skip_Flags(FontFace, 3, "Outline"); Skip_Flags(FontFace, 4, "Shadow"); Skip_Flags(FontFace, 5, "Condense"); Skip_Flags(FontFace, 6, "Extend"); Skip_B1( "Reserved"); Skip_B1( "Reserved"); //Specs say 16-bits, but not in coherency with my test sample Skip_B2( "Foreground color (Red)"); Skip_B2( "Foreground color (Green)"); Skip_B2( "Foreground color (Blue)"); Get_B1 (TextName_Size, "Text name size"); Skip_Local(TextName_Size, "Text name"); FILLING_BEGIN(); CodecID_Fill(__T("text"), StreamKind_Last, StreamPos_Last, InfoCodecID_Format_Mpeg4); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec), "text", Unlimited, true, true); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Format), "Timed Text", Unlimited, true, true); #ifdef MEDIAINFO_TIMEDTEXT_YES File_TimedText* Parser=new File_TimedText; int64u Elemen_Code_Save=Element_Code; Element_Code=moov_trak_tkhd_TrackID; //Element_Code is use for stream identifier Open_Buffer_Init(Parser); Element_Code=Elemen_Code_Save; Parser->IsChapter=Streams[moov_trak_tkhd_TrackID].IsChapter; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); mdat_MustParse=true; //Data is in MDAT #endif //MEDIAINFO_TIMEDTEXT_YES FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_tmcd() { Element_Name("TimeCode"); //Parsing stream::timecode *tc=new stream::timecode(); int32u TimeCodeFlags; int8u NumberOfFrames; Skip_B4( "Reserved"); Skip_B2( "Reserved"); Skip_B2( "Data reference index"); Skip_B4( "Reserved"); Get_B4 (TimeCodeFlags, "Flags (timecode)"); Get_Flags (TimeCodeFlags, 0, tc->DropFrame, "Drop frame"); Get_Flags (TimeCodeFlags, 1, tc->H24, "24 hour max "); Get_Flags (TimeCodeFlags, 2, tc->NegativeTimes, "Negative times OK"); Skip_Flags(TimeCodeFlags, 3, "Counter"); Get_B4 (tc->TimeScale, "Time scale"); Get_B4 (tc->FrameDuration, "Frame duration"); Get_B1 (NumberOfFrames, "Number of frames"); if (Element_Size==Element_Offset+3 || (Element_Size>=Element_Offset+7 && Element_Size>=Element_Offset+7+BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset+3))) Skip_B3( "Reserved"); else Skip_B1( "Reserved"); //Non-standard but several files are like that FILLING_BEGIN(); //Bug in one file if (tc->TimeScale==25 && tc->FrameDuration==100) tc->TimeScale=2500; if (StreamKind_Last!=Stream_Other) { Stream_Prepare(Stream_Other); Fill(Stream_Other, StreamPos_Last, Other_Type, "Time code"); Fill(Stream_Other, StreamPos_Last, Other_Format, "QuickTime TC"); Streams[moov_trak_tkhd_TrackID].StreamKind=Stream_Other; Streams[moov_trak_tkhd_TrackID].StreamPos=StreamPos_Last; } //Filling Streams[moov_trak_tkhd_TrackID].TimeCode=tc; //Preparing TimeCode parser File_Mpeg4_TimeCode* Parser=new File_Mpeg4_TimeCode; Open_Buffer_Init(Parser); mdat_Pos_ToParseInPriority_StreamIDs.push_back(moov_trak_tkhd_TrackID); Streams[moov_trak_tkhd_TrackID].IsPriorityStream=true; ((File_Mpeg4_TimeCode*)Parser)->NumberOfFrames=NumberOfFrames; //tc->FrameDuration?(((float64)tc->TimeScale)/tc->FrameDuration):0; ((File_Mpeg4_TimeCode*)Parser)->DropFrame=tc->DropFrame; ((File_Mpeg4_TimeCode*)Parser)->NegativeTimes=tc->NegativeTimes; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); mdat_MustParse=true; //Data is in MDAT FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_tmcd_name() { Element_Name("Name (TimeCode)"); //Parsing Ztring Value; int16u Size, Language; Get_B2(Size, "Size"); Get_B2(Language, "Language"); Param_Info1(Language_Get(Language)); if (Size) { int8u Junk; Peek_B1(Junk); if (Junk<0x20) { Skip_B1( "Junk"); Size--; } } Get_Local(Size, Value, "Value"); FILLING_BEGIN(); Fill(Stream_Other, StreamPos_Last, "Title", Value); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_tx3g() { Element_Name("Text"); //Parsing Skip_B4( "Reserved"); Skip_B2( "Reserved"); Skip_B2( "Data reference index"); Info_B4(Flags, "displayFlags"); Skip_Flags(Flags, 5, "Scroll in"); Skip_Flags(Flags, 6, "Scroll out"); Skip_Flags(Flags, 7, "Horizontal scroll"); Skip_Flags(Flags, 8, "Reverse scroll"); Skip_Flags(Flags, 10, "Continuous karaoke"); Skip_Flags(Flags, 17, "write text vertically"); Skip_Flags(Flags, 18, "fill text region"); Skip_B1( "horizontal-justification"); Skip_B1( "vertical-justification"); Skip_B1( "background-color-rgba (red)"); Skip_B1( "background-color-rgba (green)"); Skip_B1( "background-color-rgba (blue)"); Skip_B1( "background-color-rgba (alpha)"); Element_Begin1("default-text-box"); if (Element_Size>42 && CC4(Buffer+Buffer_Offset+38)==Elements::moov_trak_mdia_minf_stbl_stsd_tx3g_ftab) { Skip_B1( "top"); //Specs say 16-bits, but not in coherency with a test sample Skip_B1( "left"); //Specs say 16-bits, but not in coherency with a test sample Skip_B1( "bottom"); //Specs say 16-bits, but not in coherency with a test sample Skip_B1( "right"); //Specs say 16-bits, but not in coherency with a test sample } else { Skip_B2( "top"); Skip_B2( "left"); Skip_B2( "bottom"); Skip_B2( "right"); } Element_End0(); Element_Begin1("default-style"); Skip_B2( "startChar"); Skip_B2( "endChar"); Skip_B2( "font-ID"); Skip_B1( "face-style-flags"); Skip_B1( "font-size"); Skip_B1( "text-color-rgba (red)"); Skip_B1( "text-color-rgba (green)"); Skip_B1( "text-color-rgba (blue)"); Skip_B1( "text-color-rgba (alpha)"); Element_End0(); FILLING_BEGIN(); CodecID_Fill(__T("tx3g"), StreamKind_Last, StreamPos_Last, InfoCodecID_Format_Mpeg4); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec), "tx3g", Unlimited, true, true); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Format), "Timed Text", Unlimited, true, true); #ifdef MEDIAINFO_TIMEDTEXT_YES File_TimedText* Parser=new File_TimedText; int64u Elemen_Code_Save=Element_Code; Element_Code=moov_trak_tkhd_TrackID; //Element_Code is use for stream identifier Open_Buffer_Init(Parser); Element_Code=Elemen_Code_Save; Parser->IsChapter=Streams[moov_trak_tkhd_TrackID].IsChapter; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); mdat_MustParse=true; //Data is in MDAT #endif //MEDIAINFO_TIMEDTEXT_YES FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_tx3g_ftab() { Element_Name("Font table"); //Found strange data in one file, but no specs about this if (Element_Size==0x17-8 && (BigEndian2int16u(Buffer+Buffer_Offset)!=1 || BigEndian2int16u(Buffer+Buffer_Offset+4)!=0x17-8-5)) { Skip_XX(Element_Size, "Unknown"); return; } //Parsing int16u entry_count; Get_B2 (entry_count, "entry-count"); for (int16u Pos=0; Pos=1) { Skip_B4( "Samples per packet"); Skip_B4( "Bytes per packet"); Skip_B4( "Bytes per frame"); Skip_B4( "Bytes per sample"); } Channels=Channels16; SampleSize=SampleSize16; SampleRate=SampleRate16; } else if (Version==2) { float64 SampleRateF64; Skip_B2( "Reserved (0x0003)"); Skip_B2( "Reserved (0x0010)"); Skip_B2( "Reserved (0xFFFE)"); Skip_B2( "Reserved (0x0000)"); Skip_B4( "Reserved (0x00010000)"); Skip_B4( "Size of Struct"); Get_BF8(SampleRateF64, "Sample rate"); Get_B4 (Channels, "Number of channels"); Skip_B4( "Reserved (0x7F000000)"); Get_B4 (SampleSize, "Sample size"); Get_B4 (Flags, "Flags"); Skip_B4( "Bytes per packet"); Skip_B4( "Frames per packet"); SampleRate=(int32u)SampleRateF64; } else { Skip_XX(Element_Size, "Unknown"); return; } //Bug found in one file: sample size is 16 with a 24-bit CodecID ("in24") if (Element_Code==0x696E3234 && SampleSize==16) SampleSize=24; //Correcting the header //Bug found in one file: sample size is 16 with a 32-bit CodecID ("fl32") if (Element_Code==0x666C3332 && SampleSize==16) SampleSize=32; //Correcting the header if (moov_trak_mdia_minf_stbl_stsd_Pos) return; //Handling only the first description FILLING_BEGIN(); //samr bug viewed in some files: channels and Sampling rate are wrong if (Element_Code==0x73616D72) //"samr" { SampleRate=8000; Channels=1; } //lpcm puts "1" in the SampleRate field and Timescale is the real sample size if (Element_Code==0x6C70636D && SampleRate==1) //"lpcm" { SampleRate=Streams[moov_trak_tkhd_TrackID].mdhd_TimeScale; } std::string Codec; Codec.append(1, (char)((Element_Code&0xFF000000)>>24)); Codec.append(1, (char)((Element_Code&0x00FF0000)>>16)); if (Codec!="ms") //Normal { Codec.append(1, (char)((Element_Code&0x0000FF00)>> 8)); Codec.append(1, (char)((Element_Code&0x000000FF)>> 0)); if (Codec!="mp4a") //mp4a is for Mpeg4 system CodecID_Fill(Ztring(Codec.c_str()), Stream_Audio, StreamPos_Last, InfoCodecID_Format_Mpeg4); if (Codec!="raw ") Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Codec, false, true); else Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "PCM", Error, false, true); Fill(Stream_Audio, StreamPos_Last, Audio_Codec_CC, Codec, false, true); if (Codec=="drms") Fill(Stream_Audio, StreamPos_Last, Audio_Encryption, "iTunes"); if (Codec=="enca") Fill(Stream_Audio, StreamPos_Last, Audio_Encryption, "Encrypted"); } else //Microsoft 2CC { int64u CodecI= ((Element_Code&0x0000FF00ULL)>> 8) + ((Element_Code&0x000000FFULL)>> 0); //FormatTag Codec=Ztring().From_Number(CodecI, 16).To_Local(); CodecID_Fill(Ztring::ToZtring(CodecI, 16), Stream_Audio, StreamPos_Last, InfoCodecID_Format_Riff); Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Codec, true); Fill(Stream_Audio, StreamPos_Last, Audio_Codec_CC, Codec, true); } #if defined(MEDIAINFO_AAC_YES) if (Version==2 && Element_Code==Elements::moov_trak_mdia_minf_stbl_stsd_mp4a) //This is not normal, but I don't know where is audioObjectType, default to 2 (AAC LC) { File_Aac* Parser=new File_Aac; Parser->AudioSpecificConfig_OutOfBand(SampleRate, 2); Parser->Mode=File_Aac::Mode_raw_data_block; Parser->FrameIsAlwaysComplete=true; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_AMR_YES) if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Mpeg4, Ztring(Codec.c_str()), InfoCodecID_Format)==__T("AMR")) { //Creating the parser File_Amr MI; MI.Codec=Ztring().From_Local(Codec.c_str()); Open_Buffer_Init(&MI); //Parsing Open_Buffer_Continue(&MI, 0); //Filling Finish(&MI); Merge(MI, StreamKind_Last, 0, StreamPos_Last); } #endif #if defined(MEDIAINFO_ADPCM_YES) if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Mpeg4, Ztring(Codec.c_str()), InfoCodecID_Format)==__T("ADPCM")) { //Creating the parser File_Adpcm MI; MI.Codec=Ztring().From_Local(Codec.c_str()); Open_Buffer_Init(&MI); //Parsing Open_Buffer_Continue(&MI, 0); //Filling Finish(&MI); Merge(MI, StreamKind_Last, 0, StreamPos_Last); } #endif #if defined(MEDIAINFO_PCM_YES) if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Mpeg4, Ztring(Codec.c_str()), InfoCodecID_Format)==__T("PCM")) { //Info of stream size Streams[moov_trak_tkhd_TrackID].stsz_Sample_Multiplier=Channels*SampleSize/8; #if MEDIAINFO_DEMUX Streams[moov_trak_tkhd_TrackID].PtsDtsAreSame=true; #endif // MEDIAINFO_DEMUX //Creating the parser if ((Channels==1 && (StreamPos_Last%2)==0) || (Streams.find(moov_trak_tkhd_TrackID-1)!=Streams.end() && Streams[moov_trak_tkhd_TrackID-1].IsPcmMono)) { File_ChannelGrouping* Parser=new File_ChannelGrouping; if (StreamPos_Last%2 && !Streams[moov_trak_tkhd_TrackID-1].Parsers.empty()) { Parser->Channel_Pos=1; Parser->Common=((File_ChannelGrouping*)Streams[moov_trak_tkhd_TrackID-1].Parsers[0])->Common; Parser->StreamID=moov_trak_tkhd_TrackID-1; Element_Code=moov_trak_tkhd_TrackID-1; } else { Parser->Channel_Pos=0; Streams[moov_trak_tkhd_TrackID].IsPcmMono=true; } Parser->Channel_Total=2; Parser->SamplingRate=(int16u)SampleRate; Parser->BitDepth=(int8u)SampleSize; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); } //PCM parser File_Pcm* Parser=new File_Pcm; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX if (Version==2) { if (Flags&0x01) Parser->Endianness='F'; else { Parser->Endianness=(Flags&0x02)?'B':'L'; Parser->Sign=(Flags&0x04)?'S':'U'; } } Parser->Codec=Ztring().From_Local(Codec.c_str()); Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); Streams[moov_trak_tkhd_TrackID].IsPcm=true; #if MEDIAINFO_DEMUX Streams[moov_trak_tkhd_TrackID].Demux_Level=4; //Intermediate #endif //MEDIAINFO_DEMUX } #endif #if defined(MEDIAINFO_MPEGA_YES) if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Mpeg4, Ztring(Codec.c_str()), InfoCodecID_Format)==__T("MPEG Audio")) { //Creating the parser File_Mpega* Parser=new File_Mpega; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); } #endif if (Element_Code==0x6F776D61) //"owma" { //Parsing int32u SamplingRate, BytesPerSec; int16u CodecID, Channels, Data_Size, Resolution; Get_L2 (CodecID, "Codec ID"); Get_L2 (Channels, "Number of Channels"); Get_L4 (SamplingRate, "Samples Per Second"); Get_L4 (BytesPerSec, "Average Number of Bytes Per Second"); Skip_L2( "Block Alignment"); Get_L2 (Resolution, "Bits / Sample"); Get_L2 (Data_Size, "Codec Specific Data Size"); //Filling Ztring Codec; Codec.From_Number(CodecID, 16); Codec.MakeUpperCase(); CodecID_Fill(Codec, Stream_Audio, StreamPos_Last, InfoCodecID_Format_Riff); Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Codec); //May be replaced by codec parser Fill(Stream_Audio, StreamPos_Last, Audio_Codec_CC, Codec); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Channels, 10, true); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, SamplingRate, 10, true); Fill(Stream_Audio, StreamPos_Last, Audio_BitRate, BytesPerSec*8, 10, true); Fill(Stream_Audio, StreamPos_Last, Audio_BitDepth, Resolution, 10, true); FILLING_BEGIN(); //Creating the parser if (0); #if defined(MEDIAINFO_MPEGA_YES) else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Ztring::ToZtring(CodecID, 16))==__T("MPEG Audio")) { File_Mpega* Parser=new File_Mpega; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); } #endif FILLING_END(); //Parsing if (Data_Size>0) { Element_Begin1("Codec Specific Data"); switch (CodecID) { case 0x0161 : //Parsing Skip_L4( "SamplesPerBlock"); Skip_L2( "EncodeOptions"); Skip_L4( "SuperBlockAlign"); break; default : Skip_XX(Data_Size, "Unknown"); } Element_End0(); } //Demux #if MEDIAINFO_DEMUX if (!Config->Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10_Get()) switch (Config->Demux_InitData_Get()) { case 0 : //In demux event Demux_Level=2; //Container Demux(Buffer+Buffer_Offset+Element_Offset-(18+Data_Size), (size_t)(18+Data_Size), ContentType_Header); break; case 1 : //In field { std::string Data_Raw((const char*)(Buffer+Buffer_Offset+Element_Offset-(18+Data_Size)), (size_t)(18+Data_Size)); std::string Data_Base64(Base64::encode(Data_Raw)); Fill(Stream_Audio, StreamPos_Last, "Demux_InitBytes", Data_Base64); (*Stream_More)[Stream_Audio][StreamPos_Last](Ztring().From_Local("Demux_InitBytes"), Info_Options)=__T("N NT"); } break; default : ; } #endif //MEDIAINFO_DEMUX } #if MEDIAINFO_DEMUX if (Streams[moov_trak_tkhd_TrackID].Parsers.empty() && Config_Demux) { File__Analyze* Parser=new File__Analyze; //Only for activating Demux Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); } #endif //MEDIAINFO_DEMUX for (size_t Pos=0; PosWithAppleHeader=true; Parser->AspectRatio=((float)16)/9; //TODO: this is hardcoded, must adapt it to the real video aspect ratio Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); } #endif #if MEDIAINFO_DEMUX if (Streams[moov_trak_tkhd_TrackID].Parsers.empty() && Config_Demux) { File__Analyze* Parser=new File__Analyze; //Only for activating Demux Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); } #endif //MEDIAINFO_DEMUX for (size_t Pos=0; Pos>24)); Codec.append(1, (char)((Element_Code&0x00FF0000)>>16)); Codec.append(1, (char)((Element_Code&0x0000FF00)>> 8)); Codec.append(1, (char)((Element_Code&0x000000FF)>> 0)); if (Codec!="mp4v") //mp4v is for Mpeg4 system CodecID_Fill(Ztring(Codec.c_str()), Stream_Video, StreamPos_Last, InfoCodecID_Format_Mpeg4); Fill(Stream_Video, StreamPos_Last, Video_Codec, Codec, false, true); Fill(Stream_Video, StreamPos_Last, Video_Codec_CC, Codec, false, true); if (Codec=="drms") Fill(Stream_Video, StreamPos_Last, Video_Encryption, "iTunes"); if (Codec=="encv") Fill(Stream_Video, StreamPos_Last, Video_Encryption, "Encrypted"); if (Width) Fill(Stream_Video, StreamPos_Last, Video_Width, Width, 10, true); if (Height) Fill(Stream_Video, StreamPos_Last, Video_Height, Height, 10, true); if (moov_trak_tkhd_DisplayAspectRatio && Height && moov_trak_tkhd_DisplayAspectRatio!=((float32)Width)/Height) { Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, moov_trak_tkhd_DisplayAspectRatio, 3, true); Fill(Stream_Video, StreamPos_Last, Video_PixelAspectRatio, moov_trak_tkhd_DisplayAspectRatio/Width*Height, 3, true); } Fill(Stream_Video, StreamPos_Last, Video_Rotation, moov_trak_tkhd_Rotation, 3); if (moov_trak_tkhd_Rotation) Fill(Stream_Video, StreamPos_Last, Video_Rotation_String, Ztring::ToZtring(moov_trak_tkhd_Rotation, 0)+__T("\xB0")); //degree sign //Specific cases if (Streams[moov_trak_tkhd_TrackID].Parsers.empty()) { #if defined(MEDIAINFO_DVDIF_YES) if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Mpeg4, Ztring(Codec.c_str()), InfoCodecID_Format)==__T("DV")) { File_DvDif* Parser=new File_DvDif; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_MXF_YES) if (Element_Code==0x6D78336E || Element_Code==0x6D783370 || Element_Code==0x6D78356E || Element_Code==0x6D783570) //mx3n, mx3p, mx5n, mx5p { Fill(Stream_Video, StreamPos_Last, Video_MuxingMode, "MXF"); File_Mxf* Parser=new File_Mxf; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); #if MEDIAINFO_DEMUX Streams[moov_trak_tkhd_TrackID].Demux_Level=4; //Intermediate #endif //MEDIAINFO_DEMUX } #endif #if defined(MEDIAINFO_AIC_YES) if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Mpeg4, Ztring().From_CC4((int32u)Element_Code), InfoCodecID_Format)==__T("AIC")) { File_Aic* Parser=new File_Aic; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_AVC_YES) if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Mpeg4, Ztring().From_CC4((int32u)Element_Code), InfoCodecID_Format)==__T("AVC")) { File_Avc* Parser=new File_Avc; Parser->FrameIsAlwaysComplete=true; #if MEDIAINFO_DEMUX if (Config->Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10_Get()) { Streams[moov_trak_tkhd_TrackID].Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_H263_YES) if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Mpeg4, Ztring().From_CC4((int32u)Element_Code), InfoCodecID_Format)==__T("H.263")) { File_H263* Parser=new File_H263; Parser->FrameIsAlwaysComplete=true; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_MPEGV_YES) if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Mpeg4, Ztring().From_CC4((int32u)Element_Code), InfoCodecID_Format)==__T("MPEG Video") && Element_Code!=0x6D78336E && Element_Code!=0x6D783370 && Element_Code!=0x6D78356E && Element_Code!=0x6D783570) //mx3n, mx3p, mx5n, mx5p { File_Mpegv* Parser=new File_Mpegv; Parser->FrameIsAlwaysComplete=true; #if MEDIAINFO_ADVANCED Parser->InitDataNotRepeated_Optional=true; #endif // MEDIAINFO_ADVANCED Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_PRORES_YES) if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Mpeg4, Ztring().From_CC4((int32u)Element_Code), InfoCodecID_Format)==__T("ProRes")) { File_ProRes* Parser=new File_ProRes; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_VC1_YES) if (Element_Code!=0x76632D31 && MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Mpeg4, Ztring().From_CC4((int32u)Element_Code), InfoCodecID_Format)==__T("VC-1")) // If "vc-1" CodecID, there is a dvc1 atom, not using the hack with Sequence Header direct search { File_Vc1* Parser=new File_Vc1; Parser->FrameIsAlwaysComplete=true; Open_Buffer_Init(Parser); Open_Buffer_Continue(Parser); Element_Offset=Element_Size; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); mdat_MustParse=true; //Data is in MDAT } #endif #if defined(MEDIAINFO_VC3_YES) if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Mpeg4, Ztring().From_CC4((int32u)Element_Code), InfoCodecID_Format)==__T("VC-3")) { File_Vc3* Parser=new File_Vc3; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_JPEG_YES) if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Mpeg4, Ztring(Codec.c_str()), InfoCodecID_Format)==__T("JPEG")) { File_Jpeg* Parser=new File_Jpeg; Parser->StreamKind=Stream_Video; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_MPEG4_YES) if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Mpeg4, Ztring(Codec.c_str()), InfoCodecID_Format)==__T("JPEG 2000")) { File_Mpeg4* Parser=new File_Mpeg4; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); #if MEDIAINFO_DEMUX Streams[moov_trak_tkhd_TrackID].Demux_Level=4; //Intermediate #endif //MEDIAINFO_DEMUX } #endif #if MEDIAINFO_DEMUX if (Streams[moov_trak_tkhd_TrackID].Parsers.empty() && Config_Demux) { File__Analyze* Parser=new File__Analyze; //Only for activating Demux Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); } #endif //MEDIAINFO_DEMUX for (size_t Pos=0; PosStatus[IsAccepted]) { int64u Elemen_Code_Save=Element_Code; Element_Code=moov_trak_tkhd_TrackID; //Element_Code is use for stream identifier Open_Buffer_Init(Streams[moov_trak_tkhd_TrackID].Parsers[Pos]); Element_Code=Elemen_Code_Save; mdat_MustParse=true; //Data is in MDAT } } //RGB(A) if (Codec=="raw " || Codec=="rle ") { if (Depth==1) { Fill(Stream_Video, StreamPos_Last, Video_ColorSpace, "Y", Unlimited, true, true); Fill(Stream_Video, StreamPos_Last, Video_BitDepth, 1); } else if (Depth<15) { Fill(Stream_Video, StreamPos_Last, Video_ColorSpace, "RGB", Unlimited, true, true); Fill(Stream_Video, StreamPos_Last, Video_BitDepth, 8); } else if (Depth==32 || Depth==36) { Fill(Stream_Video, StreamPos_Last, Video_ColorSpace, "RGBA", Unlimited, true, true); Fill(Stream_Video, StreamPos_Last, Video_BitDepth, Depth/4); } else Fill(Stream_Video, StreamPos_Last, Video_BitDepth, Depth/3); } //Descriptors or a list (we can see both!) if (Element_Offset+8<=Element_Size && ((CC1(Buffer+Buffer_Offset+(size_t)Element_Offset+4+0)>='A' && CC1(Buffer+Buffer_Offset+(size_t)Element_Offset+4+0)<='z') || (CC1(Buffer+Buffer_Offset+(size_t)Element_Offset+4+0)>='0' && CC1(Buffer+Buffer_Offset+(size_t)Element_Offset+4+0)<='9')) && ((CC1(Buffer+Buffer_Offset+(size_t)Element_Offset+4+1)>='A' && CC1(Buffer+Buffer_Offset+(size_t)Element_Offset+4+1)<='z') || (CC1(Buffer+Buffer_Offset+(size_t)Element_Offset+4+1)>='0' && CC1(Buffer+Buffer_Offset+(size_t)Element_Offset+4+1)<='9')) && ((CC1(Buffer+Buffer_Offset+(size_t)Element_Offset+4+2)>='A' && CC1(Buffer+Buffer_Offset+(size_t)Element_Offset+4+2)<='z') || (CC1(Buffer+Buffer_Offset+(size_t)Element_Offset+4+2)>='0' && CC1(Buffer+Buffer_Offset+(size_t)Element_Offset+4+2)<='9')) && ((CC1(Buffer+Buffer_Offset+(size_t)Element_Offset+4+3)>='A' && CC1(Buffer+Buffer_Offset+(size_t)Element_Offset+4+3)<='z') || (CC1(Buffer+Buffer_Offset+(size_t)Element_Offset+4+3)>='0' && CC1(Buffer+Buffer_Offset+(size_t)Element_Offset+4+3)<='9'))) Element_ThisIsAList(); else if (Element_Offset1) { Skip_XX(Element_Size-Element_Offset, "Data not analyzed"); return; //Handling only the first description } else if (Version==1) { #ifdef MEDIAINFO_AVC_YES for (size_t Pos=0; PosFrameIsAlwaysComplete=true; #if MEDIAINFO_DEMUX Element_Code=moov_trak_tkhd_TrackID; if (Config->Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10_Get()) { Streams[moov_trak_tkhd_TrackID].Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX Open_Buffer_Init(Parser); Parser->MustParse_SPS_PPS=true; Parser->MustSynchronize=false; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); mdat_MustParse=true; //Data is in MDAT //Demux #if MEDIAINFO_DEMUX if (!Config->Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10_Get()) 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)); Fill(Stream_Video, StreamPos_Last, "Demux_InitBytes", Data_Base64); (*Stream_More)[Stream_Video][StreamPos_Last](Ztring().From_Local("Demux_InitBytes"), Info_Options)=__T("N NT"); } break; default : ; } #endif //MEDIAINFO_DEMUX //Parsing Open_Buffer_Continue(Parser); Parser->MustParse_SPS_PPS=false; Parser->SizedBlocks=true; //Now this is SizeBlocks #else Skip_XX(Element_Size, "AVC Data"); #endif } else Skip_XX(Element_Size, "Data"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_bitr() { Element_Name("BitRate"); //Parsing int32u Avg_Bitrate, Max_Bitrate; Get_B4 (Avg_Bitrate, "Avg_Bitrate"); Get_B4 (Max_Bitrate, "Max_Bitrate"); if (moov_trak_mdia_minf_stbl_stsd_Pos>1) return; //Handling only the first description FILLING_BEGIN(); if (Avg_Bitrate) Fill(StreamKind_Last, StreamPos_Last, "BitRate", Avg_Bitrate); if (Max_Bitrate) Fill(StreamKind_Last, StreamPos_Last, "BitRate_Maximum", Max_Bitrate); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_btrt() { Element_Name("BitRate"); //Parsing int32u maxBitrate, avgBitrate; Skip_B4( "bufferSizeDB"); Get_B4 (maxBitrate, "maxBitrate"); Get_B4 (avgBitrate, "avgBitrate"); if (moov_trak_mdia_minf_stbl_stsd_Pos>1) return; //Handling only the first description FILLING_BEGIN(); //if (avgBitrate) // Fill(StreamKind_Last, StreamPos_Last, "BitRate", avgBitrate); //Not trustable enough, and we have precise bitrate from stream size with if (maxBitrate) Fill(StreamKind_Last, StreamPos_Last, "BitRate_Maximum", maxBitrate); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_chan() { NAME_VERSION_FLAG("Channels"); //Parsing //From http://developer.apple.com/mac/library/documentation/MusicAudio/Reference/CAFSpec/CAF_spec/CAF_spec.html std::string ChannelDescription_Layout; int64u ChannelLabels=0; int32u ChannelLayoutTag, ChannelBitmap, NumberChannelDescriptions; bool ChannelLabels_Valid=true; Get_B4 (ChannelLayoutTag, "ChannelLayoutTag"); Get_B4 (ChannelBitmap, "ChannelBitmap"); Get_B4 (NumberChannelDescriptions, "NumberChannelDescriptions"); if (ChannelLayoutTag==0) //UseChannelDescriptions { for (int32u Pos=0; Pos1) return; //Handling only the first description FILLING_BEGIN(); if (ChannelLayoutTag==0) //UseChannelDescriptions { Fill(Stream_Audio, StreamPos_Last, Audio_ChannelLayout, ChannelDescription_Layout.c_str(), Unlimited, true, true); if (ChannelLabels_Valid) Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions, Mpeg4_chan_ChannelDescription(ChannelLabels), true, true); else Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions, ChannelDescription_Layout); } else if (ChannelLayoutTag==0x10000) //UseChannelBitmap { int8u Channels=0; for (size_t Bit=0; Bit<18; Bit++) if (ChannelBitmap&(1<0x10000) { //int16u Channels=ChannelLayoutTag&0x0000FFFF; int16u Ordering=(ChannelLayoutTag&0xFFFF0000)>>16; //Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Channels, 10, true); //Channel count from this atom should not be used as a primary source, it may be wrong Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions, Mpeg4_chan(Ordering), Unlimited, true, true); Fill(Stream_Audio, StreamPos_Last, Audio_ChannelLayout, Mpeg4_chan_Layout(Ordering)); } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_clap() { Element_Name("Clean Aperture"); //Parsing int32u apertureWidth_N, apertureWidth_D, apertureHeight_N, apertureHeight_D; Get_B4 (apertureWidth_N, "apertureWidth_N"); Get_B4 (apertureWidth_D, "apertureWidth_D"); Get_B4 (apertureHeight_N, "apertureHeight_N"); Get_B4 (apertureHeight_D, "apertureHeight_D"); Skip_B4( "horizOff_N"); Skip_B4( "horizOff_D"); Skip_B4( "vertOff_N"); Skip_B4( "vertOff_D"); if (moov_trak_mdia_minf_stbl_stsd_Pos>1) return; //Handling only the first description FILLING_BEGIN(); if (apertureWidth_N && apertureWidth_D && apertureHeight_N && apertureHeight_D) { Streams[moov_trak_tkhd_TrackID].CleanAperture_Width=((float)apertureWidth_N)/apertureWidth_D; Streams[moov_trak_tkhd_TrackID].CleanAperture_Height=((float)apertureHeight_N)/apertureHeight_D; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_colr() { Element_Name("Color Parameter"); //Parsing int16u colour_primaries, transfer_characteristics, matrix_coefficients; Skip_C4( "Color parameter type"); Get_B2 (colour_primaries, "Primaries index"); Param_Info1(Mpegv_colour_primaries((int8u)colour_primaries)); Get_B2 (transfer_characteristics, "Transfer function index"); Param_Info1(Mpegv_transfer_characteristics((int8u)transfer_characteristics)); Get_B2 (matrix_coefficients, "Matrix index"); Param_Info1(Mpegv_matrix_coefficients((int8u)matrix_coefficients)); FILLING_BEGIN(); if (Retrieve(Stream_Video, StreamPos_Last, Video_colour_description_present).empty()) //Using only the first one met { Fill(Stream_Video, StreamPos_Last, Video_colour_description_present, "Yes"); Fill(Stream_Video, StreamPos_Last, Video_colour_primaries, Mpegv_colour_primaries((int8u)colour_primaries)); Fill(Stream_Video, StreamPos_Last, Video_transfer_characteristics, Mpegv_transfer_characteristics((int8u)transfer_characteristics)); Fill(Stream_Video, StreamPos_Last, Video_matrix_coefficients, Mpegv_matrix_coefficients((int8u)matrix_coefficients)); } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_d263() { Element_Name("H263SpecificBox"); //Parsing int32u Vendor; int8u Version, H263_Level, H263_Profile; Get_C4 (Vendor, "Encoder vendor"); Get_B1 (Version, "Encoder version"); Get_B1 (H263_Level, "H263_Level"); Get_B1 (H263_Profile, "H263_Profile"); if (moov_trak_mdia_minf_stbl_stsd_Pos>1) return; //Handling only the first description Ztring ProfileLevel; switch (H263_Profile) { case 0x00 : ProfileLevel=__T("BaseLine"); break; default : ProfileLevel.From_Number(H263_Profile); } ProfileLevel+=__T('@'); ProfileLevel+=Ztring::ToZtring(((float32)H263_Level)/10, 1); Fill(Stream_Video, StreamPos_Last, Video_Format_Profile, ProfileLevel); Fill(Stream_Video, StreamPos_Last, Video_Encoded_Library_Name, Mpeg4_Vendor(Vendor)); Fill(Stream_Video, StreamPos_Last, Video_Encoded_Library_Version, Version); Fill(Stream_Video, StreamPos_Last, Video_Encoded_Library, Retrieve(Stream_Video, StreamPos_Last, Video_Encoded_Library_Name)+__T(' ')+Ztring::ToZtring(Version)); Ztring Encoded_Library_String=Retrieve(Stream_Video, StreamPos_Last, Video_Encoded_Library_Name)+(Version?(__T(" Revision ")+Ztring::ToZtring(Version)):Ztring()); Fill(Stream_Video, StreamPos_Last, Video_Encoded_Library_String, Encoded_Library_String, true); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_dac3() { Element_Name("AC3SpecificBox"); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, "", Unlimited, true, true); //Remove the value (is always wrong in the stsd atom) //Parsing if (Retrieve(Stream_Audio, StreamPos_Last, Audio_CodecID)==__T("sac3")) { Element_Info1("Nero specific"); int8u Version; Get_B1 (Version, "Version"); if (Version==1) { int8u bsid; Get_B1 (bsid, "bsid"); Skip_XX(Element_Size-Element_Offset, "unknown"); #ifdef MEDIAINFO_AC3_YES if (Streams[moov_trak_tkhd_TrackID].Parsers.empty()) { File_Ac3* Parser=new File_Ac3; Open_Buffer_Init(Parser); Parser->Frame_Count_Valid=2; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); mdat_MustParse=true; //Data is in MDAT } #else if (bsid<=0x08) Fill(Stream_Audio, StreamKind_Last, Audio_Format, "AC-3"); if (bsid>0x0A && bsid<=0x10) Fill(Stream_Audio, StreamKind_Last, Audio_Format, "E-AC-3"); #endif return; } else { Skip_XX(Element_Size, "Data"); return; } } if (moov_trak_mdia_minf_stbl_stsd_Pos>1) return; //Handling only the first description #ifdef MEDIAINFO_AC3_YES if (Streams[moov_trak_tkhd_TrackID].Parsers.empty()) { File_Ac3* Parser=new File_Ac3; Open_Buffer_Init(Parser); Parser->MustParse_dac3=true; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); mdat_MustParse=true; //Data is in MDAT //Parsing Open_Buffer_Continue(Parser); } #else Skip_XX(Element_Size, "AC-3 Data"); Fill(Stream_Audio, StreamKind_Last, Audio_Format, "AC-3"); #endif } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_damr() { Element_Name("AMR decode config"); //Parsing int32u Vendor; int8u Version; Get_C4 (Vendor, "Encoder vendor"); Get_B1 (Version, "Encoder version"); Skip_B2( "Packet modes"); Skip_B1( "Number of packet mode changes"); Skip_B1( "Samples per packet"); if (moov_trak_mdia_minf_stbl_stsd_Pos>1) return; //Handling only the first description Fill(Stream_Audio, StreamPos_Last, Audio_Encoded_Library_Name, Mpeg4_Vendor(Vendor)); Fill(Stream_Audio, StreamPos_Last, Audio_Encoded_Library_Version, Version); Fill(Stream_Audio, StreamPos_Last, Audio_Encoded_Library, Retrieve(Stream_Audio, StreamPos_Last, Audio_Encoded_Library_Name)+__T(' ')+Ztring::ToZtring(Version)); Ztring Encoded_Library_String=Retrieve(Stream_Audio, StreamPos_Last, Audio_Encoded_Library_Name)+(Version?(__T(" Revision ")+Ztring::ToZtring(Version)):Ztring()); Fill(Stream_Audio, StreamPos_Last, Audio_Encoded_Library_String, Encoded_Library_String, true); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_dec3() { Element_Name("EAC3SpecificBox"); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, "", Unlimited, true, true); //Remove the value (is always wrong in the stsd atom) if (moov_trak_mdia_minf_stbl_stsd_Pos>1) { return; //Handling only the first description } #ifdef MEDIAINFO_AC3_YES if (moov_trak_mdia_minf_stbl_stsd_Pos>1) { Skip_XX(Element_Size, "Data not analyzed"); return; //Handling only the first description } if (Streams[moov_trak_tkhd_TrackID].Parsers.empty()) { File_Ac3* Parser=new File_Ac3; Open_Buffer_Init(Parser); Parser->Frame_Count_Valid=2; Parser->MustParse_dec3=true; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); mdat_MustParse=true; //Data is in MDAT //Parsing Open_Buffer_Continue(Parser); } #else Skip_XX(Element_Size, "E-AC-3 Data"); Fill(Stream_Audio, StreamKind_Last, Audio_Format, "E-AC-3"); Fill(Stream_Audio, StreamKind_Last, Audio_Format, "", Unlimited, true, true); //Remove the value (is always wrong in the stsd atom) #endif } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_ddts() { Element_Name("DTSSpecificBox"); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, "", Unlimited, true, true); //Remove the value (is always wrong in the stsd atom) if (moov_trak_mdia_minf_stbl_stsd_Pos>1) { return; //Handling only the first description } //Comments about the new CodecIDs having this atom: //dtsc: DTS Core only //dtse: DTS Express, not having DTS Core //dtsh: DTS Core + DTS Lossless (MA), mixed //dtsl: DTS Lossless (MA), not having DTS Core int32u DTSSamplingFrequency, maxBitrate, avgBitrate; int16u ChannelLayout; int8u CoreLayout; //Parsing Get_B4 (DTSSamplingFrequency, "DTSSamplingFrequency"); Get_B4 (maxBitrate, "maxBitrate"); Get_B4 (avgBitrate, "avgBitrate"); Skip_B1( "pcmSampleDepth"); // 16 or 24 bits BS_Begin(); Skip_S1(2, "FrameDuration"); // 0 = 512, 1 = 1024, 2 = 2048, 3 = 4096 Skip_S1(5, "StreamConstruction"); Skip_SB( "CoreLFEPresent"); // 0 = none, 1 = LFE exists Get_S1 (6, CoreLayout, "CoreLayout"); Skip_S2(14, "CoreSize"); Skip_SB( "StereoDownmix"); // 0 = none, 1 = downmix present Skip_S1 (3, "RepresentationType"); Get_S2 (16, ChannelLayout, "ChannelLayout"); Skip_SB( "MultiAssetFlag"); // 0 = none, 1 = multiple asset Skip_SB( "LBRDurationMod"); // 0 = ignore, 1 = Special LBR duration modifier Skip_S1(6, "reserved"); BS_End(); FILLING_BEGIN(); if (DTSSamplingFrequency) Fill(StreamKind_Last, StreamPos_Last, Audio_SamplingRate, DTSSamplingFrequency, 10, true); //This is the maximum sampling frequency if (avgBitrate) Fill(StreamKind_Last, StreamPos_Last, Audio_BitRate, avgBitrate); if (maxBitrate) Fill(StreamKind_Last, StreamPos_Last, Audio_BitRate_Maximum, maxBitrate); #if defined(MEDIAINFO_DTS_YES) if (ChannelLayout) { Fill(Stream_Audio, 0, Audio_ChannelPositions, DTS_HD_SpeakerActivityMask(ChannelLayout).c_str()); Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, DTS_HD_SpeakerActivityMask2(ChannelLayout).c_str()); } if (CoreLayout && CoreLayout<16) { Fill(Stream_Audio, 0, Audio_ChannelPositions, DTS_ChannelPositions[CoreLayout]); Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, DTS_ChannelPositions2[CoreLayout]); } #endif //defined(MEDIAINFO_DTS_YES) FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_dvc1() { Element_Name("VC1SpecificBox"); // Parsing int32u hrd_buffer, hrd_rate, framerate=0; int8u profile, level, frmrtq_pp, bitrtq_pp, dquant, vtransform, overlap, syncmarker, rangered, maxbframes, quantizer, finterpflag, no_interlace, no_multiple_seq, no_multiple_entry, no_slice_code, no_bframe; bool cbr, loopfilter, multires, fastuvmc, extended_mv; BS_Begin(); Get_S1 (4, profile, "Profile"); Get_S1 (3, level, "Level"); Skip_SB( "reserved"); BS_End(); switch(profile) { case 0 : // Simple Profile case 4 : // Main Profile BS_Begin(); Get_S1 (3, level, "Level"); // should be the same as above Get_SB (cbr, "CBR"); // should be equal to 1 if CBR Mode, 0 otherwhise Skip_S1(4, "Reserved"); // should be set to 0 BS_End(); Get_B3 (hrd_buffer, "HRD_Buffer"); // Buffer Size of Hypothetical Reference Decoder in ms Get_B4 (hrd_rate, "HRD_Rate"); // Peak Transmisson Rate of the Hypothetical Reference Decoder in bps Get_B4 (framerate, "FrameRate"); // Rounded FPS of the track BS_Begin(); Get_S1 (4, profile, "Profile"); // should be the same as above Get_S1 (3, frmrtq_pp, "Frmrtq_postproc"); Get_S1 (5, bitrtq_pp, "Bitrtq_postproc"); Get_SB (loopfilter, "Loopfilter"); Skip_SB( "Reserved"); // should be set to 0 Get_SB (multires, "MultiRes"); Skip_SB( "Reserved"); // should be set to 1 Get_SB (fastuvmc, "Fastuvmc"); Get_SB (extended_mv, "Extended_mv"); Get_S1 (2, dquant, "Dquant"); Get_S1 (1, vtransform, "Vtransform"); Skip_SB( "Reserved"); // should be set to 0 Get_S1 (1, overlap, "Overlap"); Get_S1 (1, syncmarker, "Syncmarker"); Get_S1 (1, rangered, "Rangered"); Get_S1 (3, maxbframes, "MaxBFrames"); // should be equal to 0 with SP Get_S1 (2, quantizer, "Quantizer"); Get_S1 (1, finterpflag, "Finterpflag"); Skip_SB( "Reserved"); // should be set to 1 BS_End(); break; case 12 : // Advanced Profile BS_Begin(); Get_S1 (3, level, "Level"); // should be the same as above Get_SB (cbr, "CBR"); // should be equal to 1 if CBR Mode, 0 otherwhise Skip_S1(6, "Reserved"); // should be set to 0 Get_S1 (1, no_interlace, "No Interlace"); // should be set to 0 for Interlaced Content Get_S1 (1, no_multiple_seq, "No Multiple Sequence"); Get_S1 (1, no_multiple_entry, "No Multiple Entry"); Get_S1 (1, no_slice_code, "No Slice Code"); Get_S1 (1, no_bframe, "No BFrame"); Skip_SB( "Reserved"); BS_End(); Get_B4 (framerate, "FrameRate"); Element_Begin1("Sequence HDR"); File_Vc1* Parser=new File_Vc1; Parser->FrameIsAlwaysComplete=true; Open_Buffer_Init(Parser); Open_Buffer_Continue(Parser); Element_Offset=Element_Size; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); mdat_MustParse=true; //Data is in MDAT*/ Element_End0(); break; } FILLING_BEGIN(); #if defined(MEDIAINFO_VC1_YES) if ((profile) && (level)) { Ztring Profile, Level; switch (profile) { case 0 : Profile=__T("Simple"); break; case 4 : Profile=__T("Main"); break; case 12 : Profile=__T("Advanced"); break; default : Profile=__T(""); } Profile+=__T("@"); if (profile == 0) // Simple Profile { switch (level) { case 0 : Level=__T("Low"); break; case 2 : Level=__T("Medium"); break; default : Level=__T(""); } } else if (profile == 4) // Main Profile { switch (level) { case 0 : Level=__T("Low"); break; case 2 : Level=__T("Medium"); break; case 4 : Level=__T("High"); break; default : Level=__T(""); } } else if (profile == 12) // Advanced Profile { switch (level) { case 0 : Level=__T("L0"); break; case 1 : Level=__T("L1"); break; case 2 : Level=__T("L2"); break; case 3 : Level=__T("L3"); break; case 4 : Level=__T("L4"); break; default : Level=__T(""); } } Profile+=Level; Fill(Stream_Video, StreamPos_Last, Video_Format_Profile, Profile); Fill(Stream_Video, StreamPos_Last, Video_Codec_Profile, Profile); } #endif //defined(MEDIAINFO_VC1_YES) if (framerate && framerate!=(int32u)-1) Fill(StreamKind_Last, StreamPos_Last, Video_FrameRate, framerate, 3); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_esds() { NAME_VERSION_FLAG("ES Descriptor"); INTEGRITY_VERSION(0); if (moov_trak_mdia_minf_stbl_stsd_Pos>1) return; //Handling only the first description FILLING_BEGIN(); Descriptors(); if (Streams[moov_trak_tkhd_TrackID].Parsers.size()==1 && !Retrieve(StreamKind_Last, StreamPos_Last, "Encryption").empty()) { Finish(Streams[moov_trak_tkhd_TrackID].Parsers[0]); } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_fiel() { //Source: http://developer.apple.com/quicktime/icefloe/dispatch019.html#fiel //Source: QuickTimeFileFormat2011.pdf: // 1 T is displayed earliest, T is stored first in the file. // 6 B is displayed earliest, B is stored first in the file. // 9 B is displayed earliest, T is stored first in the file. //14 T is displayed earliest, B is stored first in the file. Element_Name("Field/Frame Information"); //Parsing int8u fields, detail; Get_B1 (fields, "fields"); Get_B1 (detail, "detail"); if (moov_trak_mdia_minf_stbl_stsd_Pos>1) return; //Handling only the first description FILLING_BEGIN(); switch(fields) { case 0x01 : Fill(Stream_Video, StreamPos_Last, Video_ScanType, "Progressive", Unlimited, true, true); break; case 0x02 : Fill(Stream_Video, StreamPos_Last, Video_ScanType, "Interlaced", Unlimited, true, true); switch(detail) { case 1 : // T is displayed earliest, T is stored first in the file. case 9 : // B is displayed earliest, T is stored first in the file. Fill(Stream_Video, StreamPos_Last, Video_ScanOrder, "TFF", Unlimited, true, true); break; case 6 : // B is displayed earliest, B is stored first in the file. case 14 : // T is displayed earliest, B is stored first in the file. Fill(Stream_Video, StreamPos_Last, Video_ScanOrder, "BFF", Unlimited, true, true); break; default : ; } switch(detail) { case 9 : // B is displayed earliest, T is stored first in the file. case 14 : // T is displayed earliest, B is stored first in the file. Streams[moov_trak_tkhd_TrackID].ScanOrder_StoredDisplayedInverted=true; break; default : ; } #ifdef MEDIAINFO_JPEG_YES if (Retrieve(Stream_Video, StreamPos_Last, Video_Format)==__T("JPEG") && Streams[moov_trak_tkhd_TrackID].Parsers.size()==1) ((File_Jpeg*)Streams[moov_trak_tkhd_TrackID].Parsers[0])->Interlaced=true; #endif //MEDIAINFO_JPEG_YES break; default : ; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_glbl() { Element_Name("Global"); if (Retrieve(Stream_Video, StreamPos_Last, Video_MuxingMode)==__T("MXF")) { Clear(Stream_Video, StreamPos_Last, Video_MuxingMode); for (size_t Pos=0; Pos1) { Skip_XX(Element_Size-Element_Offset, "Data not analyzed"); return; //Handling only the first description } else if (Version==1) { #ifdef MEDIAINFO_HEVC_YES for (size_t Pos=0; PosFrameIsAlwaysComplete=true; Open_Buffer_Init(Parser); Parser->MustParse_VPS_SPS_PPS=true; Parser->MustSynchronize=false; Streams[moov_trak_tkhd_TrackID].Parsers.push_back(Parser); mdat_MustParse=true; //Data is in MDAT //Parsing Open_Buffer_Continue(Parser); Parser->SizedBlocks=true; //Now this is SizeBlocks #else Skip_XX(Element_Size, "HEVC Data"); #endif } else Skip_XX(Element_Size, "Data"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_idfm() { Element_Name("Description"); Info_C4(Description, "Description"); Param_Info1(Mpeg4_Description(Description)); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_pasp() { Element_Name("Pixel Aspect Ratio"); //Parsing int32u hSpacing, vSpacing; Get_B4 (hSpacing, "hSpacing"); Get_B4 (vSpacing, "vSpacing"); if (moov_trak_mdia_minf_stbl_stsd_Pos>1) return; //Handling only the first description FILLING_BEGIN(); if (vSpacing) { float32 PixelAspectRatio=(float32)hSpacing/vSpacing; Clear(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio); Fill(Stream_Video, StreamPos_Last, Video_PixelAspectRatio, PixelAspectRatio, 3, true); Streams[moov_trak_tkhd_TrackID].CleanAperture_PixelAspectRatio=PixelAspectRatio; //This is the PAR of the clean aperture } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_sinf() { Element_Name("Protection scheme information box"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_sinf_frma() { Element_Name("Original format box"); //Parsing std::string Codec; Get_String(4, Codec, "data_format"); FILLING_BEGIN(); CodecID_Fill(Ztring(Codec.c_str()), Stream_Video, StreamPos_Last, InfoCodecID_Format_Mpeg4); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_sinf_imif() { NAME_VERSION_FLAG("IPMP Information box"); //Parsing Descriptors(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_sinf_schi() { Element_Name("scheme information box"); //Parsing Skip_XX(Element_Size, "scheme_specific_data"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_sinf_schm() { NAME_VERSION_FLAG("scheme type box"); //Parsing Skip_C4( "scheme_type"); Skip_B4( "scheme_version"); if (Flags&0x000001) Skip_UTF8(Element_Size-Element_Offset, "scheme_uri"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_wave() { Element_Name("Wave"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_wave_acbf() { Element_Name("Audio Bitrate Control Mode"); //Parsing Skip_B4( "Bit Rate Control Mode"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_wave_enda() { //Parsing int16u Endianness; Get_B2 (Endianness, "Endianness"); if (moov_trak_mdia_minf_stbl_stsd_Pos>1) return; //Handling only the first description FILLING_BEGIN(); if (Streams[moov_trak_tkhd_TrackID].IsPcm) { if (Streams[moov_trak_tkhd_TrackID].Parsers.size()==1) ((File_Pcm*)Streams[moov_trak_tkhd_TrackID].Parsers[0])->Endianness=Endianness?'L':'B'; if (Streams[moov_trak_tkhd_TrackID].Parsers.size()==2) { ((File_ChannelGrouping*)Streams[moov_trak_tkhd_TrackID].Parsers[0])->Endianness=Endianness?'L':'B'; ((File_Pcm*)Streams[moov_trak_tkhd_TrackID].Parsers[1])->Endianness=Endianness?'L':'B'; } } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_wave_frma() { Element_Name("Data format"); //Parsing int16u Codec_Peek; Peek_B2(Codec_Peek); if (Codec_Peek==0x6D73) //"ms", Microsoft 2CC { int16u CodecMS; Skip_C2( "Codec_MS"); Get_B2 (CodecMS, "CC2"); if (moov_trak_mdia_minf_stbl_stsd_Pos>1) return; //Handling only the first description FILLING_BEGIN(); Ztring OldFormat=Retrieve(Stream_Audio, StreamPos_Last, Audio_CodecID); Ztring NewFormat=Ztring::ToZtring(CodecMS, 16); if (OldFormat!=NewFormat) { Clear(Stream_Audio, StreamPos_Last, Audio_CodecID); CodecID_Fill(NewFormat, Stream_Audio, StreamPos_Last, InfoCodecID_Format_Riff); } Fill(Stream_Audio, StreamPos_Last, Audio_Codec, CodecMS, 16, true); Fill(Stream_Audio, StreamPos_Last, Audio_Codec_CC, CodecMS, 16, true); FILLING_END(); } else { int32u Codec; Get_C4(Codec, "Codec"); if (moov_trak_mdia_minf_stbl_stsd_Pos>1) return; //Handling only the first description FILLING_BEGIN(); if (Codec!=0x6D703461) //"mp4a" { Ztring OldFormat=Retrieve(Stream_Audio, StreamPos_Last, Audio_CodecID); Ztring NewFormat=Ztring().From_CC4(Codec); if (OldFormat!=NewFormat) { Clear(Stream_Audio, StreamPos_Last, Audio_CodecID); CodecID_Fill(NewFormat, Stream_Audio, StreamPos_Last, InfoCodecID_Format_Mpeg4); } } Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Ztring().From_CC4(Codec), true); Fill(Stream_Audio, StreamPos_Last, Audio_Codec_CC, Ztring().From_CC4(Codec), true); FILLING_END(); } } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_wave_samr() { Element_Name("AMR decode config"); //Parsing int32u Vendor; int8u Version; Get_C4 (Vendor, "Encoder vendor"); Get_B1 (Version, "Encoder version"); Skip_XX(Element_Size-Element_Offset, "Unknown"); if (moov_trak_mdia_minf_stbl_stsd_Pos>1) return; //Handling only the first description Fill(Stream_Audio, StreamPos_Last, Audio_Encoded_Library_Name, Mpeg4_Vendor(Vendor)); Fill(Stream_Audio, StreamPos_Last, Audio_Encoded_Library_Version, Version); Fill(Stream_Audio, StreamPos_Last, Audio_Encoded_Library, Retrieve(Stream_Audio, StreamPos_Last, Audio_Encoded_Library_Name)+__T(' ')+Ztring::ToZtring(Version)); Ztring Encoded_Library_String=Retrieve(Stream_Audio, StreamPos_Last, Audio_Encoded_Library_Name)+(Version?(__T("Revision")+Ztring::ToZtring(Version)):Ztring()); Fill(Stream_Audio, StreamPos_Last, Audio_Encoded_Library_String, Encoded_Library_String, true); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_wave_srcq() { Element_Name("Source Quality"); //Parsing Skip_B4( "Source Quality"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_wave_xxxx() { if ((Element_Code&0x6D730000)!=0x6D730000) return; //Only msxx format is known Element_Name("Microsoft Audio"); //Parsing int32u SamplesPerSec, AvgBytesPerSec; int16u FormatTag, Channels, BitsPerSample; Get_L2 (FormatTag, "FormatTag"); Get_L2 (Channels, "Channels"); Get_L4 (SamplesPerSec, "SamplesPerSec"); Get_L4 (AvgBytesPerSec, "AvgBytesPerSec"); Skip_L2( "BlockAlign"); Get_L2 (BitsPerSample, "BitsPerSample"); FILLING_BEGIN(); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Channels!=5?Channels:6, 10, true); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, SamplesPerSec, 10, true); Fill(Stream_Audio, StreamPos_Last, Audio_BitRate_Nominal, AvgBytesPerSec*8, 10, true); FILLING_END(); //Options if (Element_Offset+2>Element_Size) return; //No options //Parsing int16u Option_Size; Get_L2 (Option_Size, "cbSize"); //Filling if (Option_Size>0) { Skip_XX(Option_Size, "Unknown"); } } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stsh() { Element_Name("Shadow Sync Sample"); //Parsing int32u entry_count; Get_B4 (entry_count, "entry-count"); for (int32u Pos=0; PosElement_Size) break; //Problem sample_number=BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=4; //Coherency testing (first frame is 0 or 1) if (sample_number==0 && Offset) { for (size_t Pos=0; Pos0) { //Detecting wrong stream size with some PCM streams if (StreamKind_Last==Stream_Audio) { const Ztring &Codec=Retrieve(Stream_Audio, StreamPos_Last, Audio_CodecID); if (Codec==__T("raw ") || MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Mpeg4, Codec).find(__T("PCM"))==0 || MediaInfoLib::Config.Codec_Get(Codec, InfoCodec_KindofCodec).find(__T("PCM"))==0) { int64u Duration=Retrieve(StreamKind_Last, StreamPos_Last, Audio_Duration).To_int64u(); int64u Resolution=Retrieve(StreamKind_Last, StreamPos_Last, Audio_BitDepth).To_int64u(); int64u SamplingRate=Retrieve(StreamKind_Last, StreamPos_Last, Audio_SamplingRate).To_int64u(); int64u Channels=Retrieve(StreamKind_Last, StreamPos_Last, Audio_Channel_s_).To_int64u(); int64u Stream_Size_Theory=Duration*Resolution*SamplingRate*Channels/8/1000; int64u Stream_Size_Real=Sample_Size; Stream_Size_Real*=Sample_Count; for (int64u Multiplier=1; Multiplier<=32; Multiplier++) if (Stream_Size_Real*Multiplier>Stream_Size_Theory*0.995 && Stream_Size_Real*Multipliersecond.stsz_StreamSize=Sample_Size; Stream->second.stsz_StreamSize*=Sample_Count; if (Sample_Size==1) Stream->second.stsz_StreamSize*=Streams[moov_trak_tkhd_TrackID].stsz_Sample_Multiplier; else Stream->second.stsz_Sample_Multiplier=1; //Sampe_Size is correct, no need of stsz_Sample_Multiplier Stream->second.stsz_Sample_Size=Sample_Size; Stream->second.stsz_Sample_Count=Sample_Count; if (Sample_Count>1 && Retrieve(StreamKind_Last, StreamPos_Last, "BitRate_Mode").empty()) Fill(StreamKind_Last, StreamPos_Last, "BitRate_Mode", "CBR"); } else { int32u Size; /* if (FieldSize==4) BS_Begin(); //Too much slow */ for (int32u Pos=0; PosElement_Size) break; //Problem switch(FieldSize) { case 4 : if (Sample_Count%2) Size=Buffer[Buffer_Offset+(size_t)Element_Offset]&0x0F; else { Size=Buffer[Buffer_Offset+(size_t)Element_Offset]>>4; Element_Offset++; } break; case 8 : Size=BigEndian2int8u (Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset++; break; case 16 : Size=BigEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=2; break; case 32 : Size=BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset); Element_Offset+=4; break; default : return; } Stream->second.stsz_StreamSize+=Size; Stream->second.stsz_Total.push_back(Size); if (Possecond.stsz.push_back(Size); } /* if (FieldSize==4) BS_End(); //Too much slow */ } } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_mdia_minf_stbl_stts() { NAME_VERSION_FLAG("Time to Sample"); //Parsing int32u NumberOfEntries; Get_B4(NumberOfEntries, "Number of entries"); Stream=Streams.find(moov_trak_tkhd_TrackID); Stream->second.stts_Min=(int32u)-1; Stream->second.stts_Max=0; Stream->second.stts_FrameCount=0; #ifdef MEDIAINFO_DVDIF_ANALYZE_YES std::map Duration_FrameCount; //key is duration int64u Duration_FrameCount_Max=0; int32u Duration_FrameCount_Max_Duration=0; if (StreamKind_Last==Stream_Video && Retrieve(Stream_Video, StreamPos_Last, "Format")==__T("DV") && Streams[moov_trak_tkhd_TrackID].Parsers[0] && ((File_DvDif*)Streams[moov_trak_tkhd_TrackID].Parsers[0])->Mpeg4_stts==NULL) ((File_DvDif*)Streams[moov_trak_tkhd_TrackID].Parsers[0])->Mpeg4_stts=new File_DvDif::stts; #endif //MEDIAINFO_DVDIF_ANALYZE_YES #if MEDIAINFO_DEMUX Streams[moov_trak_tkhd_TrackID].stts_Durations.clear(); #endif //MEDIAINFO_DEMUX for (int32u Pos=0; Possecond.stts_FrameCount-SampleCount; DV_stts_Part.Pos_End=Stream->second.stts_FrameCount; DV_stts_Part.Duration=SampleDuration; ((File_DvDif*)Streams[moov_trak_tkhd_TrackID].Parsers[0])->Mpeg4_stts->push_back(DV_stts_Part); Duration_FrameCount[SampleDuration]+=Stream->second.stts_FrameCount; if (Duration_FrameCount_Max<=Duration_FrameCount[SampleDuration]) { Duration_FrameCount_Max=Duration_FrameCount[SampleDuration]; Duration_FrameCount_Max_Duration=SampleDuration; } } #endif //MEDIAINFO_DVDIF_ANALYZE_YES } FILLING_BEGIN(); if (StreamKind_Last==Stream_Video) { Fill(Stream_Video, StreamPos_Last, Video_FrameCount, Stream->second.stts_FrameCount); #ifdef MEDIAINFO_DVDIF_ANALYZE_YES if (StreamKind_Last==Stream_Video && Retrieve(Stream_Video, StreamPos_Last, "Format")==__T("DV")) { //Clean up the "normal" value for (size_t Pos=0; Pos<((File_DvDif*)Streams[moov_trak_tkhd_TrackID].Parsers[0])->Mpeg4_stts->size(); Pos++) { if (((File_DvDif*)Streams[moov_trak_tkhd_TrackID].Parsers[0])->Mpeg4_stts->at(Pos).Duration==Duration_FrameCount_Max_Duration) { ((File_DvDif*)Streams[moov_trak_tkhd_TrackID].Parsers[0])->Mpeg4_stts->erase(((File_DvDif*)Streams[moov_trak_tkhd_TrackID].Parsers[0])->Mpeg4_stts->begin()+Pos); Pos--; } } if (((File_DvDif*)Streams[moov_trak_tkhd_TrackID].Parsers[0])->Mpeg4_stts->empty()) {delete ((File_DvDif*)Streams[moov_trak_tkhd_TrackID].Parsers[0])->Mpeg4_stts; ((File_DvDif*)Streams[moov_trak_tkhd_TrackID].Parsers[0])->Mpeg4_stts=NULL;} } #endif //MEDIAINFO_DVDIF_ANALYZE_YES } FILLING_END(); } void File_Mpeg4::moov_trak_mdia_minf_stbl_stts_Common(int32u SampleCount, int32u SampleDuration, int32u Pos, int32u NumberOfEntries) { FILLING_BEGIN(); stream::stts_struct Stts; Stts.SampleCount=SampleCount; Stts.SampleDuration=SampleDuration; Stream->second.stts.push_back(Stts); if (Pos==1 && NumberOfEntries>=2 && NumberOfEntries<=3 && Stream->second.stts_FrameCount==1 && Stts.SampleDuration!=Stream->second.stts_Max && Stream->second.mdhd_TimeScale) { Stream->second.stts_Duration_FirstFrame=Stream->second.stts[0].SampleDuration; Stream->second.stts_Min=Stts.SampleDuration; Stream->second.stts_Max=Stts.SampleDuration; } if (NumberOfEntries>=2 && NumberOfEntries<=3 && Pos+1==NumberOfEntries && Stts.SampleCount==1 && Stream->second.stts_Min==Stream->second.stts_Max && Stts.SampleDuration!=Stream->second.stts_Max && Stream->second.mdhd_TimeScale) { Stream->second.stts_Duration_LastFrame=Stts.SampleDuration; } else { if (Stts.SampleDurationsecond.stts_Min) Stream->second.stts_Min=Stts.SampleDuration; if (Stts.SampleDuration>Stream->second.stts_Max) Stream->second.stts_Max=Stts.SampleDuration; } Stream->second.stts_FrameCount+=Stts.SampleCount; if (Stts.SampleDuration<0x80000000) Stream->second.stts_Duration+=Stts.SampleCount*Stts.SampleDuration; else Stream->second.stts_Duration-=Stts.SampleCount*(((int32u)-1)-Stts.SampleDuration+1); //Negative value #if MEDIAINFO_DEMUX stream::stts_duration stts_Duration; stts_Duration.Pos_Begin=Stream->second.stts_FrameCount-Stts.SampleCount; stts_Duration.Pos_End=Stream->second.stts_FrameCount; stts_Duration.SampleDuration=Stts.SampleDuration; if (Streams[moov_trak_tkhd_TrackID].stts_Durations.empty()) stts_Duration.DTS_Begin=0; else { stream::stts_durations::iterator Previous=Streams[moov_trak_tkhd_TrackID].stts_Durations.end(); --Previous; stts_Duration.DTS_Begin=Previous->DTS_End; } stts_Duration.DTS_End=stts_Duration.DTS_Begin+Stts.SampleCount*Stts.SampleDuration; Streams[moov_trak_tkhd_TrackID].stts_Durations.push_back(stts_Duration); #endif //MEDIAINFO_DEMUX FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_tapt() { Element_Name("Aperture Mode Dimensions"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_tapt_clef() { NAME_VERSION_FLAG("Clean Aperture Dimensions"); //Parsing Skip_BFP4(16, "cleanApertureWidth"); Skip_BFP4(16, "cleanApertureHeight"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_tapt_prof() { NAME_VERSION_FLAG("Production Aperture Dimensions"); //Parsing Skip_BFP4(16, "productionApertureWidth"); Skip_BFP4(16, "productionApertureHeight"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_tapt_enof() { NAME_VERSION_FLAG("Encoded Pixels Dimensions"); //Parsing Skip_BFP4(16, "encodedApertureWidth"); Skip_BFP4(16, "encodedApertureHeight"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_tkhd() { NAME_VERSION_FLAG("Track Header") //Parsing Ztring Date_Created, Date_Modified; float32 a, b, u, c, d, v, x, y, w; int64u Duration; int16u Volume; Skip_Flags(Flags, 0, "Track Enabled"); Skip_Flags(Flags, 1, "Track in Movie"); Skip_Flags(Flags, 2, "Track in Preview"); Skip_Flags(Flags, 3, "Track in Poster"); Get_DATE1904_DEPENDOFVERSION(Date_Created, "Creation time"); Get_DATE1904_DEPENDOFVERSION(Date_Modified, "Modification time"); Get_B4 (moov_trak_tkhd_TrackID, "Track ID"); Element_Info1(moov_trak_tkhd_TrackID); Skip_B4( "Reserved"); Get_B_DEPENDOFVERSION(Duration, "Duration"); if (TimeScale) {Param_Info2(Duration*1000/TimeScale, " ms"); Element_Info2(Duration*1000/TimeScale, " ms");} Skip_B4( "Reserved"); Skip_B4( "Reserved"); Skip_B2( "Layer"); Skip_B2( "Alternate group"); Get_B2 (Volume, "Volume"); Param_Info1(Ztring::ToZtring(((float)Volume)/256)); Skip_B2( "Reserved"); Element_Begin1("Matrix structure"); Get_BFP4(16, a, "a (width scale)"); Get_BFP4(16, b, "b (width rotate)"); Get_BFP4( 2, u, "u (width angle)"); Get_BFP4(16, c, "c (height rotate)"); Get_BFP4(16, d, "d (height scale)"); Get_BFP4( 2, v, "v (height angle)"); Get_BFP4(16, x, "x (position left)"); Get_BFP4(16, y, "y (position top)"); Get_BFP4( 2, w, "w (divider)"); Element_End0(); Get_BFP4(16, moov_trak_tkhd_Width, "Track width"); Get_BFP4(16, moov_trak_tkhd_Height, "Track height"); FILLING_BEGIN(); //Case of header is after main part std::map::iterator Temp=Streams.find((int32u)-1); if (Temp!=Streams.end()) { Streams[moov_trak_tkhd_TrackID]=Temp->second; Temp->second.Parsers.clear(); //They are a copy, we don't want that the destructor deletes the Parser Streams.erase(Temp); } Fill(StreamKind_Last, StreamPos_Last, "Duration", float64_int64s(((float64)Duration)*1000/TimeScale)); Fill(StreamKind_Last, StreamPos_Last, "Encoded_Date", Date_Created); Fill(StreamKind_Last, StreamPos_Last, "Tagged_Date", Date_Modified); Fill(StreamKind_Last, StreamPos_Last, General_ID, moov_trak_tkhd_TrackID, 10, true); Streams[moov_trak_tkhd_TrackID].tkhd_Duration=Duration; if (moov_trak_tkhd_Height*d) moov_trak_tkhd_DisplayAspectRatio=(moov_trak_tkhd_Width*a)/(moov_trak_tkhd_Height*d); moov_trak_tkhd_Rotation=(float32)(std::atan2(b, a)*180.0/3.14159); if (moov_trak_tkhd_Rotation<0) moov_trak_tkhd_Rotation+=360; #if MEDIAINFO_EVENTS if (StreamIDs_Size>1 && Config->File_ID_OnlyRoot_Get()) StreamIDs_Width[StreamIDs_Size-1]=Streams.size()<=1?0:8; //If referenced file and more than 1 stream, referenced ID is discarded, else referenced ID is used #endif //MEDIAINFO_EVENTS FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_tref() { Element_Name("Track Reference"); } //--------------------------------------------------------------------------- void File_Mpeg4::moov_trak_tref_chap() { Element_Name("Chapters List"); //Parsing int32u TrackID; while (Element_OffsetElement_Size) { Size32=0; Peek_B2(Size16); if (4+(int64u)Size16>Element_Size) IsText=false; } } if (!IsText) { Skip_XX(Element_Size, "Unknown"); return; } while(Element_Offset #include #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "MediaInfo/MediaInfo_Events_Internal.h" #endif //MEDIAINFO_EVENTS #if MEDIAINFO_IBI #if MEDIAINFO_SEEK #include "MediaInfo/Multiple/File_Ibi.h" #endif //MEDIAINFO_SEEK #endif //MEDIAINFO_IBI using namespace ZenLib; using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constants //*************************************************************************** //--------------------------------------------------------------------------- const char* MpegPs_System_Fixed[]= { "CBR", "VBR", }; //--------------------------------------------------------------------------- const char* MpegPs_stream_id(int8u Element_Name) { if (Element_Name>=0xC0 && Element_Name<=0xDF) return "MPEG Audio"; else if (Element_Name>=0xE0 && Element_Name<=0xEF) return "MPEG Video"; else if (Element_Name==0xB8) return "For all MPEG Audio streams"; else if (Element_Name==0xB9) return "For all MPEG Video streams"; else if (Element_Name==0xBD) return "Private 1"; else if (Element_Name==0xBF) return "Private 2"; else if (Element_Name==0xFD) return "Private HD"; else return ""; } //--------------------------------------------------------------------------- const char* MpegPs_Codec(int8u Element_Name) { if (Element_Name>=0xC0 && Element_Name<=0xDF) return "MPEG-A"; else if (Element_Name>=0xE0 && Element_Name<=0xEF) return "MPEG-V"; else return ""; } //--------------------------------------------------------------------------- int32u MpegPs_Default_stream_type(int8u Element_Name, int8u Mpeg_Version) { if (Element_Name>=0xC0 && Element_Name<=0xDF) return Mpeg_Version==0x02?0x04:0x03; else if (Element_Name>=0xE0 && Element_Name<=0xEF) return Mpeg_Version==0x02?0x02:0x01; else return 0x00; } //--------------------------------------------------------------------------- const char* MpegPs_trick_mode_control_values[8]= { "Fast forward", "Slow motion", "Freeze frame", "Fast reverse", "Slow reverse", "Reserved", "Reserved", "Reserved" }; //--------------------------------------------------------------------------- const char* MpegPs_stream_id_extension(int8u stream_id_extension) { switch (stream_id_extension) { case 0x00 : return "IPMP Control Information Streams"; //ISO/IEC 13818-11 case 0x01 : return "IPMP Streams"; //ISO/IEC 13818-11 default : if (stream_id_extension>=0x02 && stream_id_extension<=0x11) return "ISO/IEC 14496-17 text Streams"; else if (stream_id_extension>=0x12 && stream_id_extension<=0x21) return "ISO/IEC 23002-3 auxiliary video data Streams"; else if (stream_id_extension>=0x55 && stream_id_extension<=0x5F) return "VC-1"; else if (stream_id_extension>=0x60 && stream_id_extension<=0x6F) return "Dirac"; else if (stream_id_extension==0x71) return "Audio"; else if (stream_id_extension==0x72) return "Audio Ext"; else if (stream_id_extension==0x76) return "Audio"; else if (stream_id_extension>=0x75 && stream_id_extension<=0x7F) return "VC-1"; else return ""; } } //--------------------------------------------------------------------------- extern const char* Mpeg_Psi_stream_type_Format(int8u stream_type, int32u format_identifier); extern const char* Mpeg_Psi_stream_type_Codec(int8u stream_type, int32u format_identifier); extern stream_t Mpeg_Psi_stream_type_StreamKind(int32u stream_type, int32u format_identifier); extern const char* Mpeg_Psi_stream_type_Info(int8u stream_type, int32u format_identifier); //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_MpegPs::File_MpegPs() :File__Analyze() { //Configuration ParserName=__T("MpegPs"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_MpegPs; StreamIDs_Width[0]=2; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_Level=2; //Container #endif //MEDIAINFO_DEMUX #if MEDIAINFO_TRACE Trace_Layers_Update(0); //Container1 #endif //MEDIAINFO_TRACE MustSynchronize=true; Buffer_TotalBytes_FirstSynched_Max=64*1024; Buffer_TotalBytes_Fill_Max=(int64u)-1; //Disabling this feature for this format, this is done in the parser Trusted_Multiplier=2; //In FromTS=false; FromTS_stream_type=0x00; //No info FromTS_program_format_identifier=0x00000000; //No info FromTS_format_identifier=0x00000000; //No info FromTS_descriptor_tag=0x00; //No info MPEG_Version=0; //No info Searching_TimeStamp_Start=true; #ifdef MEDIAINFO_MPEG4_YES ParserFromTs=NULL; SLConfig=NULL; #endif #if MEDIAINFO_DEMUX SubStream_Demux=NULL; Demux_StreamIsBeingParsed_type=(int8u)-1; #endif //MEDIAINFO_DEMUX #if defined(MEDIAINFO_ARIBSTDB24B37_YES) FromAribStdB24B37=false; #endif //defined(MEDIAINFO_ARIBSTDB24B37_YES) //Out HasTimeStamps=false; //Temp SizeToAnalyze=8*1024*1024; video_stream_Unlimited=false; Buffer_DataSizeToParse=0; #if MEDIAINFO_SEEK Seek_Value=(int64u)-1; Seek_ID=(int64u)-1; Duration_Detected=false; #endif //MEDIAINFO_SEEK //From packets program_mux_rate=(int32u)-1; BookMark_Set(); //for stream parsing in phase 2 } //--------------------------------------------------------------------------- File_MpegPs::~File_MpegPs() { #if MEDIAINFO_DEMUX if (FromTS_stream_type==0x20) //If SubStream, this object owns the demux handler delete SubStream_Demux; //SubStream_Demux=NULL; #endif //MEDIAINFO_DEMUX #ifdef MEDIAINFO_MPEG4_YES delete ParserFromTs; //ParserFromTs=NULL; delete SLConfig; //SLConfig=NULL; #endif } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_MpegPs::Streams_Fill() { //For each Streams for (size_t StreamID=0; StreamID<0x100; StreamID++) Streams_Fill_PerStream(StreamID, Streams[StreamID], KindOfStream_Main); //For each private Streams for (size_t StreamID=0; StreamID<0x100; StreamID++) Streams_Fill_PerStream(StreamID, Streams_Private1[StreamID], KindOfStream_Private); //For each extension Streams for (size_t StreamID=0; StreamID<0x100; StreamID++) { Streams_Fill_PerStream(StreamID, Streams_Extension[StreamID], KindOfStream_Extension); //Special cases if ((StreamID==0x71 || StreamID==0x76) && !Streams_Extension[StreamID].Parsers.empty() && Streams_Extension[0x72].StreamIsRegistred) //DTS-HD and TrueHD { Fill(Stream_Audio, StreamPos_Last, Audio_MuxingMode, "Stream extension"); if (!IsSub) Fill(Stream_Audio, StreamPos_Last, Audio_MuxingMode_MoreInfo, "HD part is in stream extension 114 (0x72)"); } } //Tags in MPEG Video if (Count_Get(Stream_Video)>0) Fill(Stream_General, 0, General_Encoded_Library, Retrieve(Stream_Video, 0, Video_Encoded_Library)); //Special case: Video PTS if (video_stream_PTS.size()>=2+4*2+1*2 && Retrieve(Stream_Video, 0, Video_FrameRate).To_float64()>30.000) //TODO: Parser all kind of files { sort(video_stream_PTS.begin(), video_stream_PTS.end()); video_stream_PTS.erase(video_stream_PTS.begin(), video_stream_PTS.begin()+4); //Removing first frames, they may lack of B/P frames video_stream_PTS.resize(video_stream_PTS.size()-4); //Removing last frames, they may lack of B/P frames //Trying to detect container FPS std::vector video_stream_PTS_Between; for (size_t Pos=1; Posvideo_stream_PTS_Between[video_stream_PTS_Between.size()-1]) { float64 Time=(float)(video_stream_PTS[video_stream_PTS.size()-1]-video_stream_PTS[0])/(video_stream_PTS.size()-1)/90; if (Time) { float64 FrameRate_Container=1000/Time; if (Retrieve(Stream_Video, 0, Video_ScanType)==__T("Interlaced")) FrameRate_Container/=2; //PTS is per field float64 FrameRate_Original=Retrieve(Stream_Video, 0, Video_FrameRate).To_float64(); if (!(FrameRate_Original>=FrameRate_Container*0.9 && FrameRate_Original<=FrameRate_Container*1.1) && !(FrameRate_Container>=FrameRate_Original*0.9 && FrameRate_Container<=FrameRate_Original*1.1)) { Clear(Stream_Video, 0, Video_FrameRate); //Or automatic filling thinks current FrameRate is the container FrameRate (usaly Conatainer FrameRate is filled first, not here) Fill(Stream_Video, 0, Video_FrameRate, FrameRate_Container, 3, true); if (FrameRate_Original) Fill(Stream_Video, 0, Video_FrameRate_Original, FrameRate_Original); } } } } if (Count_Get(Stream_Video)==1 && Retrieve(Stream_Video, 0, Video_Format_Version)==__T("Version 1")) Fill(Stream_General, 0, General_InternetMediaType, "video/mpeg", Unlimited, true, true); } //--------------------------------------------------------------------------- void File_MpegPs::Streams_Fill_PerStream(size_t StreamID, ps_stream &Temp, kindofstream KindOfStream) { //By the parser StreamKind_Last=Stream_Max; size_t Count=0; if (!Temp.Parsers.empty() && Temp.Parsers[0] && Temp.Parsers[0]->Status[IsAccepted]) { Fill(Temp.Parsers[0]); if (Temp.Parsers[0]->Count_Get(Stream_Video) && Temp.Parsers[0]->Count_Get(Stream_Text)) { //Special case: Video and Text are together Stream_Prepare(Stream_Video); Count=Merge(*Temp.Parsers[0], Stream_Video, 0, StreamPos_Last); } else Count=Merge(*Temp.Parsers[0]); Ztring LawRating=Temp.Parsers[0]->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); } //By the TS stream_type if (StreamKind_Last==Stream_Max) { //Disabling stream_private_1 if needed (will be done by Streams_Private1 object) if (Temp.stream_type!=0 && (StreamID==0xBD /*|| StreamID==0xBF*/)) { bool StreamIsDetected=false; for (size_t Pos=0; Pos16) { if (StreamID>=0xC0 && StreamID<=0xDF) { Stream_Prepare(Stream_Audio); Count=1; } if (StreamID>=0xE0 && StreamID<=0xEF) { Stream_Prepare(Stream_Video); Count=1; } } } #ifdef MEDIAINFO_MPEG4_YES if (StreamKind_Last==Stream_Audio && SLConfig) Fill(Stream_Audio, StreamPos_Last, Audio_MuxingMode, "SL"); #endif //MEDIAINFO_MPEG4_YES //More info for (size_t StreamPos=Count_Get(StreamKind_Last)-Count; StreamPosRetrieve(StreamKind_Last, StreamPos, General_ID).empty()) ID+=__T("-")+Temp.Parsers[0]->Retrieve(StreamKind_Last, StreamPos, General_ID); Fill(StreamKind_Last, StreamPos, General_ID, ID, true); Ztring ID_String=__T("189 (0xBD)"); if (StreamID) ID_String+=__T("-")+Ztring::ToZtring(StreamID)+__T(" (0x")+Ztring::ToZtring(StreamID, 16)+__T(")"); if (!Temp.Parsers[0]->Retrieve(StreamKind_Last, StreamPos, General_ID_String).empty()) ID_String+=__T("-")+Temp.Parsers[0]->Retrieve(StreamKind_Last, StreamPos, General_ID_String); else if (!Temp.Parsers[0]->Retrieve(StreamKind_Last, StreamPos, General_ID).empty()) ID_String+=__T("-")+Temp.Parsers[0]->Retrieve(StreamKind_Last, StreamPos, General_ID); Fill(StreamKind_Last, StreamPos, General_ID_String, ID_String, true); //TODO: merge with Decimal_Hexa in file_MpegTs if (StreamID) Fill(StreamKind_Last, StreamPos, "MuxingMode", "DVD-Video", Unlimited, true, true); } else if (KindOfStream==KindOfStream_Extension) { Ztring ID=__T("253"); if (StreamID) ID+=__T("-")+Ztring::ToZtring(StreamID); Fill(StreamKind_Last, StreamPos, General_ID, ID, true); Ztring ID_String=__T("253 (0xFD)"); if (StreamID) ID_String+=__T("-")+Ztring::ToZtring(StreamID)+__T(" (0x")+Ztring::ToZtring(StreamID, 16)+__T(")"); Fill(StreamKind_Last, StreamPos, General_ID_String, ID_String, true); //TODO: merge with Decimal_Hexa in file_MpegTs } if (Retrieve(StreamKind_Last, StreamPos, Fill_Parameter(StreamKind_Last, Generic_Format)).empty() && Temp.stream_type!=0) Fill(StreamKind_Last, StreamPos, Fill_Parameter(StreamKind_Last, Generic_Format), Mpeg_Psi_stream_type_Format(Temp.stream_type, 0x0000)); if (Retrieve(StreamKind_Last, StreamPos, Fill_Parameter(StreamKind_Last, Generic_Codec)).empty() && Temp.stream_type!=0) Fill(StreamKind_Last, StreamPos, Fill_Parameter(StreamKind_Last, Generic_Codec), Mpeg_Psi_stream_type_Codec(Temp.stream_type, 0x0000)); if (Temp.TimeStamp_Start.PTS.TimeStamp!=(int64u)-1) { Fill(StreamKind_Last, StreamPos, Fill_Parameter(StreamKind_Last, Generic_Delay_Original), Retrieve(StreamKind_Last, StreamPos, Fill_Parameter(StreamKind_Last, Generic_Delay)), true); Clear(StreamKind_Last, StreamPos, Fill_Parameter(StreamKind_Last, Generic_Delay)); Fill(StreamKind_Last, StreamPos, Fill_Parameter(StreamKind_Last, Generic_Delay_Original_Source), Retrieve(StreamKind_Last, StreamPos, Fill_Parameter(StreamKind_Last, Generic_Delay_Source)), true); Clear(StreamKind_Last, StreamPos, Fill_Parameter(StreamKind_Last, Generic_Delay_Source)); Fill(StreamKind_Last, StreamPos, Fill_Parameter(StreamKind_Last, Generic_Delay_Original_Settings), Retrieve(StreamKind_Last, StreamPos, Fill_Parameter(StreamKind_Last, Generic_Delay_Settings)), true); Clear(StreamKind_Last, StreamPos, Fill_Parameter(StreamKind_Last, Generic_Delay_Settings)); Fill(StreamKind_Last, StreamPos, Fill_Parameter(StreamKind_Last, Generic_Delay), ((float64)Temp.TimeStamp_Start.PTS.TimeStamp)/90, 3, true); Fill(StreamKind_Last, StreamPos, Fill_Parameter(StreamKind_Last, Generic_Delay_Source), "Container"); } //Bitrate calculation if (FrameInfo.PTS!=(int64u)-1 && (StreamKind_Last==Stream_Video || StreamKind_Last==Stream_Audio)) { int64u BitRate=Retrieve(StreamKind_Last, StreamPos, "BitRate").To_int64u(); if (BitRate==0) BitRate=Retrieve(StreamKind_Last, StreamPos, "BitRate_Nominal").To_int64u(); if (BitRate==0) FrameInfo.PTS=(int64u)-1; else FrameInfo.PTS+=BitRate; //Saving global BitRate } } } //--------------------------------------------------------------------------- void File_MpegPs::Streams_Update() { //For each Streams for (size_t StreamID=0; StreamID<0x100; StreamID++) for (size_t Pos=0; PosOpen_Buffer_Update(); //For each private Streams for (size_t StreamID=0; StreamID<0x100; StreamID++) for (size_t Pos=0; PosOpen_Buffer_Update(); //For each extension Streams for (size_t StreamID=0; StreamID<0x100; StreamID++) for (size_t Pos=0; PosOpen_Buffer_Update(); } //--------------------------------------------------------------------------- void File_MpegPs::Streams_Finish() { if (Streams.empty()) return; //Parsing already done. ToDo: real time FrameInfo.PTS=0; //Will be used for BitRate calculation FrameInfo.DTS=0; //Will be used for Duration calculation //For each Streams for (size_t StreamID=0; StreamID<0x100; StreamID++) Streams_Finish_PerStream(StreamID, Streams[StreamID], KindOfStream_Main); //For each private Streams StreamOrder_CountOfPrivateStreams_Temp=0; for (size_t StreamID=0; StreamID<0x100; StreamID++) Streams_Finish_PerStream(StreamID, Streams_Private1[StreamID], KindOfStream_Private); //For each extesnion Streams for (size_t StreamID=0; StreamID<0x100; StreamID++) Streams_Finish_PerStream(StreamID, Streams_Extension[StreamID], KindOfStream_Extension); //Bitrate coherancy if (!IsSub && FrameInfo.PTS>0 && FrameInfo.PTS!=(int64u)-1 && FrameInfo.DTS!=0 && File_Size!=(int64u)-1) { int64u BitRate_FromDuration=File_Size*8000*90/FrameInfo.DTS; int64u BitRate_FromBitRates=FrameInfo.PTS; if (BitRate_FromDuration>=BitRate_FromBitRates*3 || BitRate_FromDuration<=BitRate_FromBitRates/20) { //Clearing durations for (size_t StreamKind=0; StreamKind<=Stream_Text; StreamKind++) for (size_t StreamPos=0; StreamPossecond && IbiStream_Temp->second->DtsFrequencyNumerator==1000000000 && IbiStream_Temp->second->DtsFrequencyDenominator==1) { bool IsOk=true; for (size_t Pos=0; Possecond->Infos.size(); Pos++) if (!IbiStream_Temp->second->Infos[Pos].IsContinuous && Pos+1!=IbiStream_Temp->second->Infos.size()) IsOk=false; if (IsOk) //Only is all items are continuous (partial IBI not yet supported) { IbiStream_Temp->second->DtsFrequencyNumerator=90000; for (size_t Pos=0; Possecond->Infos.size(); Pos++) { int64u Temp=IbiStream_Temp->second->Infos[Pos].Dts*90/1000000; IbiStream_Temp->second->Infos[Pos].Dts=Temp; } } } } } #endif //MEDIAINFO_IBI } //--------------------------------------------------------------------------- void File_MpegPs::Streams_Finish_PerStream(size_t StreamID, ps_stream &Temp, kindofstream KindOfStream) { //By the parser if (Temp.StreamKind==Stream_Max && !Temp.Parsers.empty() && Temp.Parsers[0]) Streams_Fill_PerStream(StreamID, Temp, KindOfStream); //Init if (Temp.StreamKind==Stream_Max) return; StreamKind_Last=Temp.StreamKind; StreamPos_Last=Temp.StreamPos; //By the parser if (!Temp.Parsers.empty() && Temp.Parsers[0]) { if (!Temp.Parsers[0]->Status[IsFinished]) { Temp.Parsers[0]->ShouldContinueParsing=false; int64u File_Size_Temp=File_Size; File_Size=File_Offset+Buffer_Offset+Element_Offset; #if MEDIAINFO_EVENTS Temp.Parsers[0]->PES_FirstByte_IsAvailable=false; #endif //MEDIAINFO_EVENTS Open_Buffer_Continue(Temp.Parsers[0], Buffer, 0, false); File_Size=File_Size_Temp; Finish(Temp.Parsers[0]); #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) return; #endif //MEDIAINFO_DEMUX } Ztring ID=Retrieve(StreamKind_Last, StreamPos_Last, General_ID); Ztring ID_String=Retrieve(StreamKind_Last, StreamPos_Last, General_ID_String); Merge(*Temp.Parsers[0], StreamKind_Last, 0, StreamPos_Last); Fill(StreamKind_Last, StreamPos_Last, General_ID, ID, true); Fill(StreamKind_Last, StreamPos_Last, General_ID_String, ID_String, true); if (!IsSub) { switch (KindOfStream) { case KindOfStream_Private : if (Streams[0xBD].StreamOrder!=(size_t)-1) Fill(StreamKind_Last, StreamPos_Last, General_StreamOrder, Streams[0xBD].StreamOrder+StreamOrder_CountOfPrivateStreams_Temp); if (StreamOrder_CountOfPrivateStreams_Minus1 && StreamOrder_CountOfPrivateStreams_TempCount_Get(Stream_Video) && Temp.Parsers[0]->Count_Get(Stream_Text)) { //Video and Text are together size_t Text_Count=Temp.Parsers[0]->Count_Get(Stream_Text); for (size_t Parser_Pos=0; Parser_PosRetrieve(Stream_Text, Parser_Pos, Text_ID); StreamPos_Last=(size_t)-1; for (size_t Pos=0; PosRetrieve(Stream_Text, Parser_Pos, "MuxingMode")) { StreamPos_Last=Pos; break; } if (StreamPos_Last==(size_t)-1) Stream_Prepare(Stream_Text, StreamPos_Last); Merge(*Temp.Parsers[0], Stream_Text, Parser_Pos, StreamPos_Last); if (!IsSub) Fill(Stream_Text, StreamPos_Last, "MuxingMode_MoreInfo", __T("Muxed in Video #")+Ztring().From_Number(Temp.StreamPos+1)); Fill(Stream_Text, StreamPos_Last, Text_ID, ID, true); Fill(Stream_Text, StreamPos_Last, Text_ID_String, Retrieve(Stream_Video, Temp.StreamPos, Video_ID_String)+__T("-")+Temp.Parsers[0]->Retrieve(Stream_Text, Parser_Pos, Text_ID), true); Fill(Stream_Text, StreamPos_Last, Text_Delay, Retrieve(Stream_Video, Temp.StreamPos, Video_Delay), true); if (!IsSub) { switch (KindOfStream) { case KindOfStream_Private : if (Streams[0xBD].StreamOrder!=(size_t)-1) Fill(Stream_Text, StreamPos_Last, General_StreamOrder, Streams[0xBD].StreamOrder); break; case KindOfStream_Extension : if (Streams[0xFD].StreamOrder!=(size_t)-1) Fill(Stream_Text, StreamPos_Last, General_StreamOrder, Streams[0xFD].StreamOrder); break; default : if (Temp.StreamOrder!=(size_t)-1) Fill(Stream_Text, StreamPos_Last, General_StreamOrder, Temp.StreamOrder); } Fill(StreamKind_Last, StreamPos_Last, General_FirstPacketOrder, Temp.FirstPacketOrder); } } StreamKind_Last=Temp.StreamKind; StreamPos_Last=Temp.StreamPos; } //Law rating Ztring LawRating=Temp.Parsers[0]->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); } //Duration if it is missing from the parser if (Temp.StreamKind!=Stream_Max && Retrieve(Temp.StreamKind, Temp.StreamPos, Fill_Parameter(Temp.StreamKind, Generic_Duration)).empty()) { StreamKind_Last=Temp.StreamKind; StreamPos_Last=Temp.StreamPos; int64u Start=(int64u)-1, End=(int64u)-1, ByteDifference=(int64u)-1; if (Temp.TimeStamp_Start.DTS.TimeStamp!=(int64u)-1 && Temp.TimeStamp_End.DTS.TimeStamp!=(int64u)-1) { Start=Temp.TimeStamp_Start.DTS.TimeStamp; End=Temp.TimeStamp_End.DTS.TimeStamp; } else if (Temp.TimeStamp_Start.PTS.TimeStamp!=(int64u)-1 && Temp.TimeStamp_End.PTS.TimeStamp!=(int64u)-1) { Start=Temp.TimeStamp_Start.PTS.TimeStamp; End=Temp.TimeStamp_End.PTS.TimeStamp; if (Temp.TimeStamp_Start.PTS.File_Pos0x100000000LL) //Testing coherancy: no 13 hours long files. End+=0x200000000LL; //33 bits, cyclic if (Start10000000000LL) Duration=0; } if (Duration) { if (StreamKind_Last==Stream_Video) { float64 FrameRate=Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate).To_float64(); if (FrameRate!=0) Duration+=Ztring::ToZtring(90*1000/FrameRate, 0).To_int64u(); //We imagine that there is one frame in it } Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Duration), Duration/90, 10, true); } } } } //Bitrate calculation if (FrameInfo.PTS!=(int64u)-1 && (StreamKind_Last==Stream_Video || StreamKind_Last==Stream_Audio)) { int64u BitRate=Retrieve(StreamKind_Last, StreamPos_Last, "BitRate").To_int64u(); if (BitRate==0) BitRate=Retrieve(StreamKind_Last, StreamPos_Last, "BitRate_Nominal").To_int64u(); if (BitRate==0) FrameInfo.PTS=(int64u)-1; else FrameInfo.PTS+=BitRate; //Saving global BitRate } } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_MpegPs::Synchronize() { //Synchronizing while (Buffer_Offset+4<=Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x01 || Buffer[Buffer_Offset+3]< 0xB9)) { Buffer_Offset+=2; while(Buffer_Offset=Buffer_Size || Buffer[Buffer_Offset-1]==0x00) Buffer_Offset--; } //Parsing last bytes if needed if (Buffer_Offset+4==Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x01 || Buffer[Buffer_Offset+3]< 0xB9)) Buffer_Offset++; if (Buffer_Offset+3==Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x01)) Buffer_Offset++; if (Buffer_Offset+2==Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00)) Buffer_Offset++; if (Buffer_Offset+1==Buffer_Size && Buffer[Buffer_Offset ]!=0x00) Buffer_Offset++; if (Buffer_Offset+3>Buffer_Size) return false; //Synched is OK return true; } //--------------------------------------------------------------------------- bool File_MpegPs::Synched_Test() { //Trailing 0xFF while(Buffer_OffsetBuffer_Size) return false; //Quick test of synchro if (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x01) Synched=false; //Quick search if (Synched && !Header_Parser_QuickSearch()) return false; //We continue return true; } //--------------------------------------------------------------------------- void File_MpegPs::Synched_Init() { //private_stream_1 specific private_stream_1_ID=0x00; private_stream_1_Offset=0; private_stream_1_IsDvdVideo=false; //Count video_stream_Count=(int8u)-1; audio_stream_Count=(int8u)-1; private_stream_1_Count=(int8u)-1; private_stream_2_Count=(int8u)-1; extension_stream_Count=(int8u)-1; SL_packetized_stream_Count=(int8u)-1; //From packets program_mux_rate=0; //Default values Streams.resize(0x100); Streams_Private1.resize(0x100); Streams_Extension.resize(0x100); Streams[0xBA].Searching_Payload=true; //Temp stream_id_extension=0x55; //Default is set to VC-1, should never happens, but happens sometimes FirstPacketOrder_Last=0; //Case of extraction from MPEG-TS files if (File_Offset==0 && Buffer_Size>=4 && ((CC4(Buffer)&0xFFFFFFF0)==0x000001E0 || (CC4(Buffer)&0xFFFFFFE0)==0x000001C0 || CC4(Buffer)==0x000001BD || CC4(Buffer)==0x000001FA || CC4(Buffer)==0x000001FD || CC4(Buffer)==0x000001FE)) { FromTS=true; //We want to anlyze this kind of file MPEG_Version=2; //By default, MPEG-TS is version 2 Streams[Buffer[3]].Searching_Payload=true; //Activating the Streams } //TS specific if (FromTS) { Streams[0xBD].Searching_Payload=true; //private_stream_1 Streams[0xBD].Searching_TimeStamp_Start=true; //private_stream_1 Streams[0xBD].Searching_TimeStamp_End=true; //private_stream_1 Streams[0xBF].Searching_Payload=true; //private_stream_2 Streams[0xBF].Searching_TimeStamp_Start=true; //private_stream_2 Streams[0xBF].Searching_TimeStamp_End=true; //private_stream_2 for (int8u Pos=0xC0; Pos<=0xEF; Pos++) { Streams[Pos].Searching_Payload=true; //audio_stream or video_stream Streams[Pos].Searching_TimeStamp_Start=true; //audio_stream or video_stream Streams[Pos].Searching_TimeStamp_End=true; //audio_stream or video_stream } Streams[0xFA].Searching_Payload=true; //LATM Streams[0xFA].Searching_TimeStamp_Start=true; //LATM Streams[0xFA].Searching_TimeStamp_End=true; //LATM Streams[0xFD].Searching_Payload=true; //extension_stream Streams[0xFD].Searching_TimeStamp_Start=true; //extension_stream Streams[0xFD].Searching_TimeStamp_End=true; //extension_stream Streams[0xFE].Searching_Payload=true; //extension_stream? Streams[0xFE].Searching_TimeStamp_Start=true; //extension_stream? Streams[0xFE].Searching_TimeStamp_End=true; //extension_stream? } } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_MpegPs::Read_Buffer_Init() { #if MEDIAINFO_DEMUX // Demux_UnpacketizeContainer=Config->Demux_Unpacketize_Get(); #endif //MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- void File_MpegPs::Read_Buffer_Unsynched() { Searching_TimeStamp_Start=false; if (Streams.empty()) return; //No need anymore of this Streams Streams[0xBB].Searching_Payload=false; //system_start //Reactivating interessant PS streams for (size_t StreamID=0; StreamID<0x100; StreamID++) { //End timestamp is out of date Streams[StreamID].TimeStamp_End.PTS.File_Pos=(int64u)-1; Streams[StreamID].TimeStamp_End.DTS.File_Pos=(int64u)-1; Streams[StreamID].TimeStamp_End.PTS.TimeStamp=(int64u)-1; Streams[StreamID].TimeStamp_End.DTS.TimeStamp=(int64u)-1; Streams[StreamID].Searching_TimeStamp_Start=false; for (size_t Pos=0; PosUnsynch_Frame_Count=Frame_Count_NotParsedIncluded; #endif //MEDIAINFO_SEEK Streams[StreamID].Parsers[Pos]->Open_Buffer_Unsynch(); } Streams_Private1[StreamID].TimeStamp_End.PTS.File_Pos=(int64u)-1; Streams_Private1[StreamID].TimeStamp_End.DTS.File_Pos=(int64u)-1; Streams_Private1[StreamID].TimeStamp_End.PTS.TimeStamp=(int64u)-1; Streams_Private1[StreamID].TimeStamp_End.DTS.TimeStamp=(int64u)-1; Streams_Private1[StreamID].Searching_TimeStamp_Start=false; for (size_t Pos=0; PosUnsynch_Frame_Count=Unsynch_Frame_Count; #endif //MEDIAINFO_SEEK Streams_Private1[StreamID].Parsers[Pos]->Open_Buffer_Unsynch(); } Streams_Extension[StreamID].TimeStamp_End.PTS.File_Pos=(int64u)-1; Streams_Extension[StreamID].TimeStamp_End.DTS.File_Pos=(int64u)-1; Streams_Extension[StreamID].TimeStamp_End.PTS.TimeStamp=(int64u)-1; Streams_Extension[StreamID].TimeStamp_End.DTS.TimeStamp=(int64u)-1; Streams_Extension[StreamID].Searching_TimeStamp_Start=false; for (size_t Pos=0; PosUnsynch_Frame_Count=Unsynch_Frame_Count; #endif //MEDIAINFO_SEEK Streams_Extension[StreamID].Parsers[Pos]->Open_Buffer_Unsynch(); } } #if MEDIAINFO_SEEK Unsynch_Frame_Count=(int64u)-1; //We do not use it #endif //MEDIAINFO_SEEK video_stream_Unlimited=false; Buffer_DataSizeToParse=0; PES_FirstByte_IsAvailable=false; } //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_MpegPs::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { //Reset Seek_Value=(int64u)-1; Seek_ID=(int64u)-1; //Init if (!Duration_Detected) { //External IBI #if MEDIAINFO_IBI std::string IbiFile=Config->Ibi_Get(); if (!IbiFile.empty()) { Ibi.Streams.clear(); //TODO: support IBI data from different inputs File_Ibi MI; Open_Buffer_Init(&MI, IbiFile.size()); MI.Ibi=&Ibi; MI.Open_Buffer_Continue((const int8u*)IbiFile.c_str(), IbiFile.size()); } //Creating base IBI from a quick analysis of the file else { MediaInfo_Internal MI; MI.Option(__T("File_KeepInfo"), __T("1")); Ztring ParseSpeed_Save=MI.Option(__T("ParseSpeed_Get"), __T("")); Ztring Demux_Save=MI.Option(__T("Demux_Get"), __T("")); MI.Option(__T("ParseSpeed"), __T("0")); MI.Option(__T("Demux"), Ztring()); size_t MiOpenResult=MI.Open(File_Name); MI.Option(__T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value MI.Option(__T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value if (!MiOpenResult) return 0; for (ibi::streams::iterator IbiStream_Temp=((File_MpegPs*)MI.Info)->Ibi.Streams.begin(); IbiStream_Temp!=((File_MpegPs*)MI.Info)->Ibi.Streams.end(); ++IbiStream_Temp) { if (Ibi.Streams[IbiStream_Temp->first]==NULL) Ibi.Streams[IbiStream_Temp->first]=new ibi::stream(*IbiStream_Temp->second); Ibi.Streams[IbiStream_Temp->first]->Unsynch(); for (size_t Pos=0; Possecond->Infos.size(); Pos++) { Ibi.Streams[IbiStream_Temp->first]->Add(IbiStream_Temp->second->Infos[Pos]); if (!IbiStream_Temp->second->Infos[Pos].IsContinuous) Ibi.Streams[IbiStream_Temp->first]->Unsynch(); } Ibi.Streams[IbiStream_Temp->first]->Unsynch(); } if (Ibi.Streams.empty()) return 4; //Problem during IBI file parsing } #endif //#if MEDIAINFO_IBI Duration_Detected=true; } //Parsing switch (Method) { case 0 : GoTo(Value); Open_Buffer_Unsynch(); return 1; case 1 : GoTo(File_Size*Value/10000); Open_Buffer_Unsynch(); return 1; case 2 : //Timestamp #if MEDIAINFO_IBI { ibi::streams::iterator IbiStream_Temp; if (ID==(int64u)-1) IbiStream_Temp=Ibi.Streams.begin(); else IbiStream_Temp=Ibi.Streams.find(ID); if (IbiStream_Temp==Ibi.Streams.end() || IbiStream_Temp->second->Infos.empty()) return 5; //Invalid ID if (!(IbiStream_Temp->second->DtsFrequencyNumerator==1000000000 && IbiStream_Temp->second->DtsFrequencyDenominator==1)) { float64 ValueF=(float64)Value; ValueF/=1000000000; //Value is in ns ValueF/=IbiStream_Temp->second->DtsFrequencyDenominator; ValueF*=IbiStream_Temp->second->DtsFrequencyNumerator; Value=float64_int64s(ValueF); } for (size_t Pos=0; Possecond->Infos.size(); Pos++) { if (Value<=IbiStream_Temp->second->Infos[Pos].Dts) { if (Valuesecond->Infos[Pos].Dts && Pos) Pos--; //Checking continuity of Ibi if (!IbiStream_Temp->second->Infos[Pos].IsContinuous && Pos+1second->Infos.size()) { Config->Demux_IsSeeking=true; Seek_Value=Value; Seek_Value_Maximal=IbiStream_Temp->second->Infos[Pos+1].StreamOffset; Seek_ID=IbiStream_Temp->first; GoTo((IbiStream_Temp->second->Infos[Pos].StreamOffset+IbiStream_Temp->second->Infos[Pos+1].StreamOffset)/2); Open_Buffer_Unsynch(); return 1; } Config->Demux_IsSeeking=false; if (!Streams[(size_t)IbiStream_Temp->first].Parsers.empty()) for (size_t Parser_Pos=0; Parser_Posfirst].Parsers.size(); Parser_Pos++) Streams[(size_t)IbiStream_Temp->first].Parsers[Parser_Pos]->Unsynch_Frame_Count=IbiStream_Temp->second->Infos[Pos].FrameNumber; else Unsynch_Frame_Counts[(int16u)IbiStream_Temp->first]=IbiStream_Temp->second->Infos[Pos].FrameNumber; GoTo(IbiStream_Temp->second->Infos[Pos].StreamOffset); Open_Buffer_Unsynch(); return 1; } } return 2; //Invalid value } #else //MEDIAINFO_IBI return (size_t)-2; //Not supported / IBI disabled #endif //MEDIAINFO_IBI case 3 : //FrameNumber #if MEDIAINFO_IBI { ibi::streams::iterator IbiStream_Temp; if (ID==(int64u)-1) IbiStream_Temp=Ibi.Streams.begin(); else IbiStream_Temp=Ibi.Streams.find(ID); if (IbiStream_Temp==Ibi.Streams.end() || IbiStream_Temp->second->Infos.empty()) return 5; //Invalid ID for (size_t Pos=0; Possecond->Infos.size(); Pos++) { if (Value<=IbiStream_Temp->second->Infos[Pos].FrameNumber) { if (Valuesecond->Infos[Pos].FrameNumber && Pos) Pos--; if (!Streams[(size_t)IbiStream_Temp->first].Parsers.empty()) for (size_t Parser_Pos=0; Parser_Posfirst].Parsers.size(); Parser_Pos++) Streams[(size_t)IbiStream_Temp->first].Parsers[Parser_Pos]->Unsynch_Frame_Count=IbiStream_Temp->second->Infos[Pos].FrameNumber; else Unsynch_Frame_Counts[(int16u)IbiStream_Temp->first]=IbiStream_Temp->second->Infos[Pos].FrameNumber; GoTo(IbiStream_Temp->second->Infos[Pos].StreamOffset); Open_Buffer_Unsynch(); return 1; } } return 2; //Invalid value } #else //MEDIAINFO_IBI return (size_t)-2; //Not supported / IBI disabled #endif //MEDIAINFO_IBI default : return (size_t)-1; //Not supported } } #endif //MEDIAINFO_SEEK //--------------------------------------------------------------------------- void File_MpegPs::Read_Buffer_Continue() { #if MEDIAINFO_DEMUX if (Demux_StreamIsBeingParsed_type!=(int8u)-1) { switch (Demux_StreamIsBeingParsed_type) //TODO: transform the switch() case to a enum with a vector of streams { case 0 : Open_Buffer_Continue(Streams[Demux_StreamIsBeingParsed_stream_id].Parsers[0], Buffer, 0, false); if (IsSub && Streams[Demux_StreamIsBeingParsed_stream_id].Parsers[0]->Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded=Streams[Demux_StreamIsBeingParsed_stream_id].Parsers[0]->Frame_Count_NotParsedIncluded; break; case 1 : Open_Buffer_Continue(Streams_Private1[Demux_StreamIsBeingParsed_stream_id].Parsers[0], Buffer, 0, false); if (IsSub && Streams_Private1[Demux_StreamIsBeingParsed_stream_id].Parsers[0]->Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded=Streams_Private1[Demux_StreamIsBeingParsed_stream_id].Parsers[0]->Frame_Count_NotParsedIncluded; break; case 2 : Open_Buffer_Continue(Streams_Extension[Demux_StreamIsBeingParsed_stream_id].Parsers[0], Buffer, 0, false); if (IsSub && Streams_Extension[Demux_StreamIsBeingParsed_stream_id].Parsers[0]->Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded=Streams_Extension[Demux_StreamIsBeingParsed_stream_id].Parsers[0]->Frame_Count_NotParsedIncluded; break; default: ; } if (Config->Demux_EventWasSent) return; Demux_StreamIsBeingParsed_type=(int8u)-1; } #endif //MEDIAINFO_DEMUX if (!IsSub) { if (Config->ParseSpeed>=1.0) Config->State_Set(((float)Buffer_TotalBytes)/File_Size); else if (Buffer_TotalBytes>2*SizeToAnalyze) Config->State_Set((float)0.99); //Nearly the end else Config->State_Set(((float)Buffer_TotalBytes)/(2*SizeToAnalyze)); } if (Buffer_DataSizeToParse) { #if MEDIAINFO_EVENTS if (FromTS) { PES_FirstByte_IsAvailable=true; PES_FirstByte_Value=false; } #endif //MEDIAINFO_EVENTS if (Buffer_Size<=Buffer_DataSizeToParse) { Element_Size=Buffer_Size; //All the buffer is used Buffer_DataSizeToParse-=(int16u)Buffer_Size; } else { Element_Size=Buffer_DataSizeToParse; Buffer_DataSizeToParse=0; } Element_Begin0(); Data_Parse(); Element_Offset=Element_Size; Element_End0(); } //Video unlimited specific, we didn't wait for the end (because this is... unlimited) if (video_stream_Unlimited) { PES_FirstByte_IsAvailable=true; PES_FirstByte_Value=false; //Look for next Sync word size_t Buffer_Offset_Temp=0; while (Buffer_Offset_Temp+4<=Buffer_Size && (Buffer[Buffer_Offset_Temp ]!=0x00 || Buffer[Buffer_Offset_Temp+1]!=0x00 || Buffer[Buffer_Offset_Temp+2]!=0x01 || Buffer[Buffer_Offset_Temp+3]< 0xB9)) { Buffer_Offset_Temp+=2; while(Buffer_Offset_Temp=Buffer_Size || Buffer[Buffer_Offset_Temp-1]==0x00) Buffer_Offset_Temp--; } //Parsing last bytes if needed if (Buffer_Offset_Temp+4==Buffer_Size && (Buffer[Buffer_Offset_Temp ]!=0x00 || Buffer[Buffer_Offset_Temp+1]!=0x00 || Buffer[Buffer_Offset_Temp+2]!=0x01)) Buffer_Offset_Temp++; if (Buffer_Offset_Temp+3==Buffer_Size && (Buffer[Buffer_Offset_Temp ]!=0x00 || Buffer[Buffer_Offset_Temp+1]!=0x00 || Buffer[Buffer_Offset_Temp+2]!=0x01)) Buffer_Offset_Temp++; if (Buffer_Offset_Temp+2==Buffer_Size && (Buffer[Buffer_Offset_Temp ]!=0x00 || Buffer[Buffer_Offset_Temp+1]!=0x00)) Buffer_Offset_Temp++; if (Buffer_Offset_Temp+1==Buffer_Size && Buffer[Buffer_Offset_Temp ]!=0x00) Buffer_Offset_Temp++; if (Buffer_Offset_Temp==Buffer_Size) { Element_Size=Buffer_Size; //All the buffer is used } else { Element_Size=Buffer_Offset_Temp; if (Buffer_Offset_Temp+4<=Buffer_Size) video_stream_Unlimited=false; else Element_IsWaitingForMoreData(); //We don't know if the next bytes are a stream_id or data } if (Element_Size) { Element_Begin0(); Data_Parse(); Element_Offset=Element_Size; Element_End0(); } } } //--------------------------------------------------------------------------- void File_MpegPs::Read_Buffer_AfterParsing() { if (!Status[IsFilled]) { //In case of problem with some streams if (Buffer_TotalBytes>Buffer_TotalBytes_FirstSynched+SizeToAnalyze) { if (!Status[IsAccepted]) { Reject("MPEG-PS"); return; } video_stream_Count=0; audio_stream_Count=0; private_stream_1_Count=0; private_stream_2_Count=false; extension_stream_Count=0; SL_packetized_stream_Count=false; } //Jumping only if needed if (Streams.empty() || video_stream_Count || audio_stream_Count || private_stream_1_Count || private_stream_2_Count || extension_stream_Count || SL_packetized_stream_Count) return; //Jumping if needed if (!Status[IsAccepted]) { Accept("MPEG-PS"); if (!IsSub) Fill(Stream_General, 0, General_Format, "MPEG-PS"); } Fill("MPEG-PS"); if (!ShouldContinueParsing && File_Offset+Buffer_Size+SizeToAnalyzeParseSpeed<1.0) { //Jumping GoToFromEnd(SizeToAnalyze, "MPEG-PS"); Open_Buffer_Unsynch(); } } } //*************************************************************************** // Buffer - Par element //*************************************************************************** //--------------------------------------------------------------------------- void File_MpegPs::Header_Parse() { PES_FirstByte_IsAvailable=true; PES_FirstByte_Value=true; //Reinit #if defined(MEDIAINFO_ARIBSTDB24B37_YES) if (!FromAribStdB24B37) #endif //defined(MEDIAINFO_ARIBSTDB24B37_YES) { FrameInfo.PTS=(int64u)-1; FrameInfo.DTS=(int64u)-1; } #if MEDIAINFO_TRACE if (Trace_Activated) { //Parsing Skip_B3( "synchro"); Get_B1 (stream_id, "stream_id"); } else { #endif //MEDIAINFO_TRACE //Parsing stream_id=Buffer[Buffer_Offset+3]; Element_Offset+=4; #if MEDIAINFO_TRACE } #endif //MEDIAINFO_TRACE if (stream_id!=0xB9 && stream_id!=0xBA) //MPEG_program_end or pack_start have no PES { if (!Header_Parse_PES_packet(stream_id)) { Element_WaitForMoreData(); return; } } else if (!Header_Parse_Fill_Size()) //MPEG_program_end or pack_start specific { Element_WaitForMoreData(); return; } Header_Fill_Code(stream_id); } //--------------------------------------------------------------------------- bool File_MpegPs::Header_Parse_Fill_Size() { //Look for next Sync word if (Buffer_Offset_Temp==0) //Buffer_Offset_Temp is not 0 if Header_Parse_Fill_Size() has already parsed first frames Buffer_Offset_Temp=Buffer_Offset+4; while (Buffer_Offset_Temp+4<=Buffer_Size && (Buffer[Buffer_Offset_Temp ]!=0x00 || Buffer[Buffer_Offset_Temp+1]!=0x00 || Buffer[Buffer_Offset_Temp+2]!=0x01 || Buffer[Buffer_Offset_Temp+3]< 0xB9)) { Buffer_Offset_Temp+=2; while(Buffer_Offset_Temp=Buffer_Size || Buffer[Buffer_Offset_Temp-1]==0x00) Buffer_Offset_Temp--; } //Parsing last bytes if needed if (Buffer_Offset_Temp+4==Buffer_Size && (Buffer[Buffer_Offset_Temp ]!=0x00 || Buffer[Buffer_Offset_Temp+1]!=0x00 || Buffer[Buffer_Offset_Temp+2]!=0x01)) Buffer_Offset_Temp++; if (Buffer_Offset_Temp+3==Buffer_Size && (Buffer[Buffer_Offset_Temp ]!=0x00 || Buffer[Buffer_Offset_Temp+1]!=0x00 || Buffer[Buffer_Offset_Temp+2]!=0x01)) Buffer_Offset_Temp++; if (Buffer_Offset_Temp+2==Buffer_Size && (Buffer[Buffer_Offset_Temp ]!=0x00 || Buffer[Buffer_Offset_Temp+1]!=0x00)) Buffer_Offset_Temp++; if (Buffer_Offset_Temp+1==Buffer_Size && Buffer[Buffer_Offset_Temp ]!=0x00) Buffer_Offset_Temp++; if (Buffer_Offset_Temp+4>Buffer_Size) { if (File_Offset+Buffer_Size>=File_Size) Buffer_Offset_Temp=Buffer_Size; //We are sure that the next bytes are a start else return false; } //OK, we continue Header_Fill_Size(Buffer_Offset_Temp-Buffer_Offset); Buffer_Offset_Temp=0; return true; } //--------------------------------------------------------------------------- bool File_MpegPs::Header_Parse_PES_packet(int8u stream_id) { //Parsing int16u PES_packet_length; Get_B2 (PES_packet_length, "PES_packet_length"); #if MEDIAINFO_DEMUX if (Demux_UnpacketizeContainer && Buffer_Offset+6+PES_packet_length>Buffer_Size) return false; #endif //MEDIAINFO_DEMUX if (PES_packet_length && File_Offset+Buffer_Offset+6+PES_packet_length>=File_Size) PES_packet_length=(int16u)(File_Size-(File_Offset+Buffer_Offset+6)); //Parsing switch (stream_id) { //Header is only Size case 0xBB : //system_header_start case 0xBC : //program_stream_map case 0xBE : //padding_stream case 0xBF : //private_stream_2 case 0xF0 : //ECM case 0xF1 : //EMM case 0xF2 : //DSMCC Streams case 0xF8 : //ITU-T Rec. H .222.1 type E case 0xFF : //Program Streams directory break; //Element with PES Header default : switch (MPEG_Version) { case 1 : Header_Parse_PES_packet_MPEG1(stream_id); break; case 2 : Header_Parse_PES_packet_MPEG2(stream_id); break; default : ; //We don't know what to parse... } } //Video unlimited specific if (PES_packet_length==0) { if (!Header_Parse_Fill_Size()) { //Return directly if we must unpack the elementary stream; #if MEDIAINFO_DEMUX if (Demux_UnpacketizeContainer) return false; #endif //MEDIAINFO_DEMUX //Next PS packet is not found, we will use all the buffer Header_Fill_Size(Buffer_Size-Buffer_Offset); //All the buffer is used video_stream_Unlimited=true; Buffer_Offset_Temp=0; //We use the buffer } } else //Filling Header_Fill_Size(6+PES_packet_length); //Can be cut in small chunks if (Element_IsWaitingForMoreData()) return false; if (PES_packet_length!=0 && Element_OffsetBuffer_Size-Buffer_Offset && ((stream_id&0xE0)==0xC0 || (stream_id&0xF0)==0xE0)) { //Return directly if we must unpack the elementary stream; #if MEDIAINFO_DEMUX if (Demux_UnpacketizeContainer) return false; #endif //MEDIAINFO_DEMUX Header_Fill_Size(Buffer_Size-Buffer_Offset); //All the buffer is used Buffer_DataSizeToParse=6+PES_packet_length-(int16u)(Buffer_Size-Buffer_Offset); Buffer_Offset_Temp=0; //We use the buffer } return true; } //--------------------------------------------------------------------------- // Packet header data - MPEG-1 void File_MpegPs::Header_Parse_PES_packet_MPEG1(int8u stream_id) { int8u stuffing_byte; do { Peek_B1(stuffing_byte); if (stuffing_byte==0xFF) Skip_B1( "stuffing_byte"); } while(stuffing_byte==0xFF); if ((stuffing_byte&0xC0)==0x40) { BS_Begin(); Mark_0(); Mark_1(); Skip_SB( "STD_buffer_scale"); Skip_S2(13, "STD_buffer_size"); BS_End(); Peek_B1(stuffing_byte); } if ((stuffing_byte&0xF0)==0x20) { int16u PTS_29, PTS_14; int8u PTS_32; Element_Begin1("PTS"); BS_Begin(); Mark_0(); Mark_0(); Mark_1(); Mark_0(); Get_S1 ( 3, PTS_32, "PTS_32"); Mark_1_NoTrustError(); //Found 0 in one file Get_S2 (15, PTS_29, "PTS_29"); Mark_1(); Get_S2 (15, PTS_14, "PTS_14"); Mark_1(); BS_End(); //Filling #if defined(MEDIAINFO_ARIBSTDB24B37_YES) if (!FromAribStdB24B37) #endif //defined(MEDIAINFO_ARIBSTDB24B37_YES) FrameInfo.PTS=(((int64u)PTS_32)<<30) | (((int64u)PTS_29)<<15) | (((int64u)PTS_14)); if (Streams[stream_id].Searching_TimeStamp_End && stream_id!=0xBD && stream_id!=0xFD) //0xBD and 0xFD can contain multiple streams, TimeStamp management is in Streams management { if (Streams[stream_id].TimeStamp_End.PTS.TimeStamp==(int64u)-1) Streams[stream_id].TimeStamp_End.PTS.TimeStamp=FrameInfo.PTS; #if defined(MEDIAINFO_ARIBSTDB24B37_YES) if (!FromAribStdB24B37) #endif //defined(MEDIAINFO_ARIBSTDB24B37_YES) while (FrameInfo.PTS+0x100000000LL=Element_Size) { Trusted_IsNot(""); return; } size_t Buffer_Pos_Flags=Buffer_Offset+(size_t)Element_Offset; if ((Buffer[Buffer_Pos_Flags]&0xC0)!=0x80) //bit 6 and 7 are 01 { Element_DoNotTrust(""); //Mark bits are wrong return; } Buffer_Pos_Flags++; PTS_DTS_flags =Buffer[Buffer_Pos_Flags]>>6; ESCR_flag =Buffer[Buffer_Pos_Flags]&0x20?true:false; ES_rate_flag =Buffer[Buffer_Pos_Flags]&0x10?true:false; DSM_trick_mode_flag =Buffer[Buffer_Pos_Flags]&0x08?true:false; additional_copy_info_flag =Buffer[Buffer_Pos_Flags]&0x04?true:false; PES_CRC_flag =Buffer[Buffer_Pos_Flags]&0x02?true:false; PES_extension_flag =Buffer[Buffer_Pos_Flags]&0x01?true:false; Buffer_Pos_Flags++; PES_header_data_length =Buffer[Buffer_Pos_Flags]; Element_Offset+=3; #if MEDIAINFO_TRACE } #endif //MEDIAINFO_TRACE int64u Element_Pos_After_Data=Element_Offset+PES_header_data_length; if (Element_Pos_After_Data>Element_Size) { Element_WaitForMoreData(); return; } //Options if (PTS_DTS_flags==0x2) { #if MEDIAINFO_TRACE if (Trace_Activated) { int16u PTS_29, PTS_14; int8u PTS_32; Element_Begin1("PTS_DTS_flags"); Element_Begin1("PTS"); BS_Begin(); Mark_0(); Mark_0(); Mark_1_NoTrustError(); //Is "0" in one sample Mark_0_NoTrustError(); //Is "1" in one sample Get_S1 ( 3, PTS_32, "PTS_32"); Mark_1(); Get_S2 (15, PTS_29, "PTS_29"); Mark_1(); Get_S2 (15, PTS_14, "PTS_14"); Mark_1(); BS_End(); #if defined(MEDIAINFO_ARIBSTDB24B37_YES) if (!FromAribStdB24B37) #endif //defined(MEDIAINFO_ARIBSTDB24B37_YES) FrameInfo.PTS=(((int64u)PTS_32)<<30) | (((int64u)PTS_29)<<15) | (((int64u)PTS_14)); Element_Info_From_Milliseconds(float64_int64s(((float64)FrameInfo.PTS)/90)); Element_End0(); Element_End0(); } else { #endif //MEDIAINFO_TRACE if (Element_Offset+5>Element_Size) { Element_WaitForMoreData(); return; } size_t Buffer_Pos=Buffer_Offset+(size_t)Element_Offset; if ((Buffer[Buffer_Pos ]&0xC1)!=0x01 //bit 5 and 4 are not tested because of one sample with wrong mark bits || (Buffer[Buffer_Pos+2]&0x01)!=0x01 || (Buffer[Buffer_Pos+4]&0x01)!=0x01) { Element_DoNotTrust(""); //Mark bits are wrong return; } #if defined(MEDIAINFO_ARIBSTDB24B37_YES) if (!FromAribStdB24B37) #endif //defined(MEDIAINFO_ARIBSTDB24B37_YES) FrameInfo.PTS= ((((int64u)Buffer[Buffer_Pos ]&0x0E))<<29) | ( ((int64u)Buffer[Buffer_Pos+1] )<<22)|((((int64u)Buffer[Buffer_Pos+2]&0xFE))<<14) | ( ((int64u)Buffer[Buffer_Pos+3] )<< 7)|((((int64u)Buffer[Buffer_Pos+4]&0xFE))>> 1); Element_Offset+=5; #if MEDIAINFO_TRACE } #endif //MEDIAINFO_TRACE //Filling if (Streams[stream_id].Searching_TimeStamp_End) { if (Streams[stream_id].TimeStamp_End.PTS.TimeStamp==(int64u)-1) Streams[stream_id].TimeStamp_End.PTS.TimeStamp=FrameInfo.PTS; #if defined(MEDIAINFO_ARIBSTDB24B37_YES) if (!FromAribStdB24B37) #endif //defined(MEDIAINFO_ARIBSTDB24B37_YES) while (FrameInfo.PTS+0x100000000LLElement_Size) { Element_WaitForMoreData(); return; } Buffer_Pos=Buffer_Offset+(size_t)Element_Offset; if ((Buffer[Buffer_Pos ]&0xC1)!=0x01 //bit 5 and 4 are not tested because of one sample with wrong mark bits || (Buffer[Buffer_Pos+2]&0x01)!=0x01 || (Buffer[Buffer_Pos+4]&0x01)!=0x01) { Element_DoNotTrust(""); //Mark bits are wrong return; } #if defined(MEDIAINFO_ARIBSTDB24B37_YES) if (!FromAribStdB24B37) #endif //defined(MEDIAINFO_ARIBSTDB24B37_YES) FrameInfo.PTS= ((((int64u)Buffer[Buffer_Pos ]&0x0E))<<29) | ( ((int64u)Buffer[Buffer_Pos+1] )<<22)|((((int64u)Buffer[Buffer_Pos+2]&0xFE))<<14) | ( ((int64u)Buffer[Buffer_Pos+3] )<< 7)|((((int64u)Buffer[Buffer_Pos+4]&0xFE))>> 1); Element_Offset+=5; #if MEDIAINFO_TRACE } #endif //MEDIAINFO_TRACE //Filling if (Streams[stream_id].Searching_TimeStamp_End) { if (Streams[stream_id].TimeStamp_End.PTS.TimeStamp==(int64u)-1) Streams[stream_id].TimeStamp_End.PTS.TimeStamp=FrameInfo.PTS; #if defined(MEDIAINFO_ARIBSTDB24B37_YES) if (!FromAribStdB24B37) #endif //defined(MEDIAINFO_ARIBSTDB24B37_YES) while (FrameInfo.PTS+0x100000000LLElement_Size) { Element_WaitForMoreData(); return; } Buffer_Pos=Buffer_Offset+(size_t)Element_Offset; if ((Buffer[Buffer_Pos ]&0xC1)!=0x01 //bit 5 and 4 are not tested because of one sample with wrong mark bits || (Buffer[Buffer_Pos+2]&0x01)!=0x01 || (Buffer[Buffer_Pos+4]&0x01)!=0x01) { Element_DoNotTrust(""); //Mark bits are wrong return; } FrameInfo.DTS= ((((int64u)Buffer[Buffer_Pos ]&0x0E))<<29) | ( ((int64u)Buffer[Buffer_Pos+1] )<<22)|((((int64u)Buffer[Buffer_Pos+2]&0xFE))<<14) | ( ((int64u)Buffer[Buffer_Pos+3] )<< 7)|((((int64u)Buffer[Buffer_Pos+4]&0xFE))>> 1); Element_Offset+=5; #if MEDIAINFO_TRACE } #endif //MEDIAINFO_TRACE //Filling if (Streams[stream_id].Searching_TimeStamp_End) { if (Streams[stream_id].TimeStamp_End.DTS.TimeStamp==(int64u)-1) Streams[stream_id].TimeStamp_End.DTS.TimeStamp=FrameInfo.DTS; #if defined(MEDIAINFO_ARIBSTDB24B37_YES) if (!FromAribStdB24B37) #endif //defined(MEDIAINFO_ARIBSTDB24B37_YES) while (FrameInfo.DTS+0x100000000LLElement_Pos_After_Data) { //There is a problem PES_private_data_flag=false; pack_header_field_flag=false; program_packet_sequence_counter_flag=false; p_STD_buffer_flag=false; PES_extension_flag_2=false; } if (PES_private_data_flag) { Element_Begin1("PES_private_data"); int32u Code; Peek_B4(Code); if (Code==0x43434953) // "CCIS" { if (Streams_Private1[private_stream_1_ID].Parsers.size()>1) { //Should not happen, this is only in case the previous packet was without CCIS Streams_Private1[private_stream_1_ID].Parsers.clear(); Streams_Private1[private_stream_1_ID].StreamIsRegistred=false; } if (!Streams_Private1[private_stream_1_ID].StreamIsRegistred) { Streams_Private1[private_stream_1_ID].Parsers.push_back(ChooseParser_AribStdB24B37(true)); Open_Buffer_Init(Streams_Private1[private_stream_1_ID].Parsers[0]); Streams_Private1[private_stream_1_ID].StreamIsRegistred=true; } if (Streams_Private1[private_stream_1_ID].Parsers.size()==1) { File_AribStdB24B37* Parser=(File_AribStdB24B37*)Streams_Private1[private_stream_1_ID].Parsers[0]; Parser->ParseCcis=true; Open_Buffer_Continue(Parser, Buffer+Buffer_Offset+(size_t)Element_Offset, 16); } else Skip_B16( "PES_private_data"); } else Skip_B16( "PES_private_data"); Element_End0(); } if (pack_header_field_flag) { Element_Begin1("pack_header_field_flag"); int8u pack_field_length; Get_B1 (pack_field_length, "pack_field_length"); Skip_XX(pack_field_length, "pack_header"); Element_End0(); } if (program_packet_sequence_counter_flag) { Element_Begin1("program_packet_sequence_counter_flag"); int8u program_packet_sequence_counter, original_stuff_length; bool MPEG1_MPEG2_identifier; BS_Begin(); Mark_1(); Get_S1 (7, program_packet_sequence_counter, "program_packet_sequence_counter"); Mark_1(); Get_SB ( MPEG1_MPEG2_identifier, "MPEG1_MPEG2_identifier"); Get_S1 (6, original_stuff_length, "original_stuff_length"); BS_End(); Element_End0(); } if (p_STD_buffer_flag) { Element_Begin1("p_STD_buffer_flag"); bool P_STD_buffer_scale; BS_Begin(); Mark_0(); Skip_SB( "Should be 1"); //But I saw a file with "0" Get_SB ( P_STD_buffer_scale, "P-STD_buffer_scale"); Skip_S2(13, "P-STD_buffer_size"); BS_End(); Element_End0(); } if (PES_extension_flag_2) { Element_Begin1("PES_extension_flag_2"); int8u PES_extension_field_length; bool stream_id_extension_flag; BS_Begin(); Mark_1(); Get_S1 (7, PES_extension_field_length, "PES_extension_field_length"); Get_SB (stream_id_extension_flag, "stream_id_extension_flag"); if (stream_id_extension_flag==0) //This should be limited to stream_id_extension_flag==0, but I found a file with stream_id_extension_flag=1 and a real code... { Get_S1 (7, stream_id_extension, "stream_id_extension"); Param_Info1(MpegPs_stream_id_extension(stream_id_extension)); } BS_End(); if (PES_extension_field_length-1>0) Skip_XX(PES_extension_field_length-1, "reserved"); Element_End0(); } Element_End0(); } if (Element_Pos_After_Data>Element_Offset) Skip_XX(Element_Pos_After_Data-Element_Offset, "stuffing_bytes"); } //--------------------------------------------------------------------------- void File_MpegPs::Data_Parse() { //Counting Frame_Count++; //Needed? if (!Streams[stream_id].Searching_Payload) { Skip_XX(Element_Size, "data"); Element_DoNotShow(); return; } //From TS if (FromTS && !Status[IsAccepted]) { Data_Accept("MPEG-PS"); if (!IsSub) Fill(Stream_General, 0, General_Format, "MPEG-PS"); } //Parsing switch (stream_id) { case 0xB9 : MPEG_program_end(); break; case 0xBA : pack_start(); break; case 0xBB : system_header_start(); break; case 0xBC : program_stream_map(); break; case 0xBD : private_stream_1(); break; case 0xBE : padding_stream(); break; case 0xBF : private_stream_2(); break; case 0xF0 : Element_Name("ECM_Stream"); Skip_XX(Element_Size, "Data"); break; case 0xF1 : Element_Name("EMM_Stream"); Skip_XX(Element_Size, "Data"); break; case 0xF2 : Element_Name("DSMCC_stream"); Skip_XX(Element_Size, "Data"); break; case 0xF3 : Element_Name("ISO/IEC_13522_stream"); Skip_XX(Element_Size, "Data"); break; case 0xF4 : Element_Name("ITU-T Rec. H.222.1 type A"); Skip_XX(Element_Size, "Data"); break; case 0xF5 : Element_Name("ITU-T Rec. H.222.1 type B"); Skip_XX(Element_Size, "Data"); break; case 0xF6 : Element_Name("ITU-T Rec. H.222.1 type C"); Skip_XX(Element_Size, "Data"); break; case 0xF7 : Element_Name("ITU-T Rec. H.222.1 type D"); Skip_XX(Element_Size, "Data"); break; case 0xF8 : Element_Name("ITU-T Rec. H.222.1 type E"); Skip_XX(Element_Size, "Data"); break; case 0xF9 : Element_Name("ancillary_stream"); Skip_XX(Element_Size, "Data"); break; case 0xFA : SL_packetized_stream(); break; case 0xFB : Element_Name("FlexMux_stream"); Skip_XX(Element_Size, "Data"); break; case 0xFC : Element_Name("descriptive data stream"); Skip_XX(Element_Size, "Data"); break; case 0xFD : extension_stream(); break; case 0xFE : video_stream(); break; case 0xFF : Element_Name("program_stream_directory"); Skip_XX(Element_Size, "Data"); break; default: if ((stream_id&0xE0)==0xC0) audio_stream(); else if ((stream_id&0xF0)==0xE0) video_stream(); else Trusted_IsNot("Unattended element!"); } #if MEDIAINFO_EVENTS PES_FirstByte_IsAvailable=false; #endif //MEDIAINFO_EVENTS } //--------------------------------------------------------------------------- //Jumping to the last DTS if needed bool File_MpegPs::BookMark_Needed() { if (IsSub || Streams.empty() || Config->ParseSpeed>=1.0) return false; int64u ToJump=(int64u)-1; for (size_t StreamID=0; StreamID<0x100; StreamID++) { //End timestamp is out of date if (Streams[StreamID].TimeStamp_End.PTS.File_Pos!=(int64u)-1) { if (Streams[StreamID].TimeStamp_End.PTS.File_Pos>6; #if MEDIAINFO_TRACE } #endif //MEDIAINFO_TRACE if (Version==1) { //MPEG-2 #if MEDIAINFO_TRACE if (Trace_Activated) { //Parsing int8u Padding; Mark_0(); Mark_1(); Get_S1 ( 3, SysClock_32, "system_clock_reference_base32"); Mark_1(); Get_S2 (15, SysClock_29, "system_clock_reference_base29"); Mark_1(); Get_S2 (15, SysClock_14, "system_clock_reference_base14"); //Filling Streams[0xBA].TimeStamp_End.PTS.TimeStamp=(((int64u)SysClock_32)<<30) | (((int64u)SysClock_29)<<15) | (((int64u)SysClock_14)); if (Searching_TimeStamp_Start && Streams[0xBA].Searching_TimeStamp_Start) { Streams[0xBA].TimeStamp_Start=Streams[0xBA].TimeStamp_End; Streams[0xBA].Searching_TimeStamp_Start=false; } Param_Info_From_Milliseconds(Streams[0xBA].TimeStamp_End.PTS.TimeStamp/90); Mark_1(); Skip_S2( 9, "system_clock_reference_extension"); Mark_1(); Get_S3 (22, program_mux_rate, "program_mux_rate"); Param_Info2(program_mux_rate*400, " bps"); Mark_1(); Mark_1(); Skip_S1( 5, "reserved"); Get_S1 ( 3, Padding, "pack_stuffing_length"); BS_End(); if (Padding>0) Skip_XX(Padding, "padding"); } else { #endif //MEDIAINFO_TRACE //Parsing Streams[0xBA].TimeStamp_End.PTS.TimeStamp=((Buffer[Buffer_Pos ]&0x38)<<30) | ((Buffer[Buffer_Pos ]&0x03)<<28) | ((Buffer[Buffer_Pos+1] )<<20) | ((Buffer[Buffer_Pos+2]&0xF8)<<15) | ((Buffer[Buffer_Pos+2]&0x03)<<13) | ((Buffer[Buffer_Pos+3] )<< 5) | ((Buffer[Buffer_Pos+4]&0xF8)>> 3); if (!Status[IsAccepted]) { program_mux_rate =((Buffer[Buffer_Pos+6] )<<14) | ((Buffer[Buffer_Pos+7] )<< 6) | ((Buffer[Buffer_Pos+8] )>> 2); } int8u Padding = Buffer[Buffer_Pos+9]&0x07; Element_Offset=10+Padding; #if MEDIAINFO_TRACE } #endif //MEDIAINFO_TRACE } else { BS_Begin(); Mark_0(); Mark_0(); Mark_1(); Mark_0(); Get_S1 ( 3, SysClock_32, "system_clock_reference_base32"); Mark_1(); Get_S2 (15, SysClock_29, "system_clock_reference_base29"); Mark_1(); Get_S2 (15, SysClock_14, "system_clock_reference_base14"); //Filling Streams[0xBA].TimeStamp_End.PTS.TimeStamp=(((int64u)SysClock_32)<<30) | (((int64u)SysClock_29)<<15) | (((int64u)SysClock_14)); if (Searching_TimeStamp_Start && Streams[0xBA].Searching_TimeStamp_Start) { Streams[0xBA].TimeStamp_Start=Streams[0xBA].TimeStamp_End; Streams[0xBA].Searching_TimeStamp_Start=false; } Param_Info_From_Milliseconds(Streams[0xBA].TimeStamp_End.PTS.TimeStamp/90); Mark_1(); Mark_1(); Get_S3(22, program_mux_rate, "mux_rate"); Param_Info2(program_mux_rate*400, " bps"); Mark_1(); BS_End(); } //Filling FILLING_BEGIN_PRECISE(); if (!Status[IsAccepted]) { Data_Accept("MPEG-PS"); if (!IsSub) Fill(Stream_General, 0, General_Format, "MPEG-PS"); //Autorisation of other streams Streams[0xB9].Searching_Payload=true; //MPEG_program_end Streams[0xBB].Searching_Payload=true; //system_header_start Streams[0xBD].Searching_Payload=true; //private_stream_1 Streams[0xBD].Searching_TimeStamp_Start=true; //private_stream_1 Streams[0xBD].Searching_TimeStamp_End=true; //private_stream_1 Streams[0xBF].Searching_Payload=true; //private_stream_2 Streams[0xFD].Searching_Payload=true; //private_stream_1 or video_stream Streams[0xFD].Searching_TimeStamp_Start=true; //private_stream_1 or video_stream Streams[0xFD].Searching_TimeStamp_End=true; //private_stream_1 or video_stream for (int8u Pos=0xC0; Pos<=0xEF; Pos++) { Streams[Pos].Searching_Payload=true; //audio_stream or video_stream Streams[Pos].Searching_TimeStamp_Start=true; //audio_stream or video_stream Streams[Pos].Searching_TimeStamp_End=true; //audio_stream or video_stream } MPEG_Version=Version==1?2:1; SizeToAnalyze=program_mux_rate*50*4*(MustExtendParsingDuration?4:1); //standard delay between TimeStamps is 0.7s, we try 4s to be sure if (SizeToAnalyze>16*1024*1024) SizeToAnalyze=16*1024*1024; //Not too much if (SizeToAnalyze<2*1024*1024) SizeToAnalyze=2*1024*1024; //Not too less } #if MEDIAINFO_IBI if (!IsSub) Ibi_SynchronizationOffset_Current=File_Offset+Buffer_Offset-Header_Size; #endif //MEDIAINFO_IBI FILLING_END(); } //--------------------------------------------------------------------------- // Packet "BB" void File_MpegPs::system_header_start() { Element_Name("system_header_start"); //If there is system_header_start, default value for private sections are false private_stream_1_Count=0; private_stream_2_Count=0; SL_packetized_stream_Count=0; //StreamOrder StreamOrder_CountOfPrivateStreams_Minus1=0; //Parsing int32u rate_bound; int8u audio_bound, video_bound; BS_Begin(); Mark_1(); Get_S3 (22, rate_bound, "rate_bound"); Param_Info2(rate_bound*400, " bps"); Mark_1(); Get_S1 ( 6, audio_bound, "audio_bound"); Info_SB( fixed_flag, "fixed_flag"); Param_Info1(MpegPs_System_Fixed[fixed_flag]); Skip_SB( "CSPS_flag"); Skip_SB( "system_audio_lock_flag"); Skip_SB( "system_video_lock_flag"); Mark_1(); Get_S1 ( 5, video_bound, "video_bound"); Skip_SB( "packet_rate_restriction_flag"); Skip_S1( 7, "reserved_byte"); bool one=false; size_t StreamOrder=0; if (Element_IsNotFinished()) Peek_SB(one); while (one) { Element_Begin0(); int16u STD_buffer_size_bound; int8u stream_id, stream_id_extension=0; bool STD_buffer_bound_scale; Get_S1 ( 8, stream_id, "stream_id"); Param_Info1(MpegPs_stream_id(stream_id)); Element_Name(Ztring().From_CC1(stream_id)); Element_Info1(MpegPs_stream_id(stream_id)); if (stream_id==0xB7) { Mark_1(); Mark_1(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Get_S1 (8, stream_id_extension, "stream_id_extension"); Mark_1(); Mark_0(); Mark_1(); Mark_1(); Mark_0(); Mark_1(); Mark_1(); Mark_0(); } Mark_1(); Mark_1(); Get_SB ( STD_buffer_bound_scale, "STD_buffer_bound_scale"); Get_S2 (13, STD_buffer_size_bound, "STD_buffer_size_bound"); Param_Info1(Ztring::ToZtring(STD_buffer_size_bound*(STD_buffer_bound_scale?1024:128)) + __T(" bytes")); Element_End0(); FILLING_BEGIN(); switch (stream_id) { case 0xBD : private_stream_1_Count=(int8u)-1; break; case 0xBF : private_stream_2_Count=(int8u)-1; break; case 0xFA : SL_packetized_stream_Count=(int8u)-1; break; case 0xFD : extension_stream_Count=(int8u)-1; break; default : ; } if (stream_id==0xBD && Streams[stream_id].StreamOrder!=(size_t)-1) StreamOrder_CountOfPrivateStreams_Minus1++; else if (stream_id>0xB9) { Streams[stream_id].StreamOrder=StreamOrder; StreamOrder++; } FILLING_END(); if (Element_IsNotFinished()) Peek_SB(one); else one=false; } BS_End(); //Filling if (audio_stream_Count==(int8u)-1) //0xBB may be multipart audio_stream_Count=0; audio_stream_Count+=audio_bound; if (video_stream_Count==(int8u)-1) //0xBB may be multipart video_stream_Count=0; video_stream_Count+=video_bound; if (private_stream_1_Count>0 && program_mux_rate*50==SizeToAnalyze) SizeToAnalyze*=32; //If there is a private section, this may be DVD, with late data --> 10s minimum if (SizeToAnalyze>8*1024*1024) SizeToAnalyze=8*1024*1024; //Autorisation of other streams if ((private_stream_1_Count>0 || audio_stream_Count>0) && video_stream_Count>0) //0xBB may be multipart Streams[0xBB].Searching_Payload=false; Streams[0xBC].Searching_Payload=true; //program_stream_map } //--------------------------------------------------------------------------- // Packet "BC" void File_MpegPs::program_stream_map() { Element_Name("program_stream_map"); MPEG_Version=2; //program_stream_map does NOT exist in MPEG-1 specs File_Mpeg_Psi Parser; Parser.From_TS=false; Parser.Complete_Stream=new complete_stream; Parser.Complete_Stream->Streams.resize(0x100); for (size_t StreamID=0; StreamID<0x100; StreamID++) Parser.Complete_Stream->Streams[StreamID]=new complete_stream::stream; Open_Buffer_Init(&Parser); Open_Buffer_Continue(&Parser); Finish(&Parser); FILLING_BEGIN(); //Time stamps Streams[0xBC].TimeStamp_End=Streams[0xBA].TimeStamp_End; if (Streams[0xBC].TimeStamp_Start.PTS.TimeStamp==(int64u)-1) Streams[0xBC].TimeStamp_Start=Streams[0xBC].TimeStamp_End; //Registering the streams for (int8u Pos=0; Pos<0xFF; Pos++) if (Parser.Complete_Stream->Streams[Pos]->stream_type!=(int8u)-1) { if (!Parser.Complete_Stream->Transport_Streams.empty() && !Parser.Complete_Stream->Transport_Streams.begin()->second.Programs.empty()) Streams[Pos].program_format_identifier=Parser.Complete_Stream->Transport_Streams.begin()->second.Programs.begin()->second.registration_format_identifier; Streams[Pos].format_identifier=Parser.Complete_Stream->Streams[Pos]->registration_format_identifier; Streams[Pos].stream_type=Parser.Complete_Stream->Streams[Pos]->stream_type; } else { } FILLING_END(); delete Parser.Complete_Stream; //Parser.Complete_Stream=NULL; } //--------------------------------------------------------------------------- // Packet "BD" void File_MpegPs::private_stream_1() { Element_Name("private_stream_1"); if (!FromTS) { //From PS, trying DVD system private_stream_1_ID=0; private_stream_1_Offset=0; if (!private_stream_1_Choose_DVD_ID()) { Skip_XX(Element_Size-Element_Offset, "Unknown"); return; } Element_Info1C(private_stream_1_ID, Ztring::ToZtring(private_stream_1_ID, 16)); } if (!Streams_Private1[private_stream_1_ID].StreamIsRegistred) { //For TS streams, which does not have Start chunk if (FromTS) { if (video_stream_Count==(int8u)-1 && audio_stream_Count==(int8u)-1) { video_stream_Count=0; audio_stream_Count=0; private_stream_1_Count=1; private_stream_2_Count=0; extension_stream_Count=0; SL_packetized_stream_Count=0; private_stream_1_ID=0; private_stream_1_Offset=0; Streams_Private1[private_stream_1_ID].stream_type=FromTS_stream_type; } else if (!IsSub) { //2 streams in the file, this can not be From TS, we have no idea of the count of streams video_stream_Count=(int8u)-1; audio_stream_Count=(int8u)-1; private_stream_1_Count=(int8u)-1; private_stream_2_Count=(int8u)-1; extension_stream_Count=(int8u)-1; SL_packetized_stream_Count=(int8u)-1; FromTS=false; } } //Registering if (!Status[IsAccepted]) { Data_Accept("MPEG-PS"); if (!IsSub) Fill(Stream_General, 0, General_Format, "MPEG-PS"); } Streams[stream_id].StreamIsRegistred++; Streams_Private1[private_stream_1_ID].StreamIsRegistred++; Streams_Private1[private_stream_1_ID].Searching_Payload=true; Streams_Private1[private_stream_1_ID].Searching_TimeStamp_Start=true; Streams_Private1[private_stream_1_ID].Searching_TimeStamp_End=true; Streams_Private1[private_stream_1_ID].FirstPacketOrder=FirstPacketOrder_Last; FirstPacketOrder_Last++; //New parsers Streams_Private1[private_stream_1_ID].Parsers.push_back(private_stream_1_ChooseParser()); if (Streams_Private1[private_stream_1_ID].Parsers[Streams_Private1[private_stream_1_ID].Parsers.size()-1]==NULL) { Streams_Private1[private_stream_1_ID].Parsers.clear(); #if defined(MEDIAINFO_AC3_YES) Streams_Private1[private_stream_1_ID].Parsers.push_back(ChooseParser_AC3()); #endif #if defined(MEDIAINFO_DTS_YES) Streams_Private1[private_stream_1_ID].Parsers.push_back(ChooseParser_DTS()); #endif #if defined(MEDIAINFO_SMPTEST0337_YES) Streams_Private1[private_stream_1_ID].Parsers.push_back(ChooseParser_SmpteSt0302()); #endif #if defined(MEDIAINFO_ARIBSTDB24B37_YES) Streams_Private1[private_stream_1_ID].Parsers.push_back(ChooseParser_AribStdB24B37()); #endif } #if MEDIAINFO_EVENTS if (private_stream_1_Offset) { //Multiple substreams in 1 stream StreamIDs[StreamIDs_Size-1]=Element_Code; Element_Code=private_stream_1_ID; //The upper level ID is filled by Element_Code in the common code StreamIDs_Width[StreamIDs_Size]=2; ParserIDs[StreamIDs_Size]=MediaInfo_Parser_MpegPs_Ext; StreamIDs_Size++; } #endif //MEDIAINFO_EVENTS for (size_t Pos=0; PosCA_system_ID_MustSkipSlices=CA_system_ID_MustSkipSlices; Open_Buffer_Init(Streams_Private1[private_stream_1_ID].Parsers[Pos]); } #if MEDIAINFO_EVENTS if (private_stream_1_Offset) { StreamIDs_Size--; Element_Code=StreamIDs[StreamIDs_Size-1]; } #endif //MEDIAINFO_EVENTS } //Demux #if MEDIAINFO_DEMUX if (Streams_Private1[private_stream_1_ID].Searching_Payload) { if (private_stream_1_Offset) { //Multiple substreams in 1 stream StreamIDs[StreamIDs_Size-1]=Element_Code; Element_Code=private_stream_1_ID; //The upper level ID is filled by Element_Code in the common code StreamIDs_Width[StreamIDs_Size]=2; ParserIDs[StreamIDs_Size]=MediaInfo_Parser_MpegPs_Ext; StreamIDs_Size++; Demux(Buffer+Buffer_Offset+private_stream_1_Offset, (size_t)(Element_Size-private_stream_1_Offset), ContentType_MainStream); StreamIDs_Size--; Element_Code=StreamIDs[StreamIDs_Size-1]; } else Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream); } #endif //MEDIAINFO_DEMUX //Parsing if (Element_OffsetDemux_EventWasSent) { Demux_StreamIsBeingParsed_type=1; Demux_StreamIsBeingParsed_stream_id=private_stream_1_ID; } #endif //MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- bool File_MpegPs::private_stream_1_Choose_DVD_ID() { private_stream_1_IsDvdVideo=false; if (Element_Size<4) return false; //Testing false-positives if (CC2(Buffer+Buffer_Offset+(size_t)Element_Offset)==0x0B77) return true; //Parsing int8u CodecID; Get_B1 (CodecID, "CodecID"); //Testing //Subtitles (CVD) if (CodecID<=0x0F) { private_stream_1_IsDvdVideo=true; private_stream_1_Offset=1; } //Subtitles (DVD) else if (CodecID>=0x20 && CodecID<=0x3F) { private_stream_1_IsDvdVideo=true; private_stream_1_Offset=1; } //Subtitles (SVCD) else if (CodecID>=0x70 && CodecID<=0x7F) { private_stream_1_IsDvdVideo=true; private_stream_1_Offset=1; } //AC-3 (OTA?) else if (CodecID==0x80 && CC3(Buffer+Buffer_Offset+1)==0x000000) { private_stream_1_IsDvdVideo=true; //Not sure private_stream_1_Offset=4; } //PCM else if (CodecID>=0xA0 && CodecID<=0xAF && Element_Size>=7 && Buffer[Buffer_Offset+6]==0x80) { private_stream_1_IsDvdVideo=true; private_stream_1_Offset=1; } //PS2-MPG else if (CodecID==0xFF) { int16u StreamID; int8u SubID; Get_B1 (SubID, "CodecID (part 2)"); Get_B2 (StreamID, "Stream ID"); if ((SubID&0xFE)==0xA0) //0xFFA0 or 0xFFA1 { //PS2-MPG PCM/ADPCM private_stream_1_Offset=4; private_stream_1_ID=(int8u)StreamID; //ID is maybe 2 byte long, but private_stream_1_ID is an int8u return true; } else if (SubID==0x90) //0xFF90 { //PS2-MPG AC-3 or subtitles private_stream_1_Offset=4; private_stream_1_ID=(int8u)StreamID; //ID is maybe 2 byte long, but private_stream_1_ID is an int8u return true; } else return false; } else { int16u Next; int8u Count; Get_B1 (Count, "Count of next frame headers"); Get_B2 (Next, "Next frame offset minus 1"); if (Count>0 && 4+(int64u)Next+4<=Element_Size) { //Subtitles (CVD) // if (CodecID>=0x00 && CodecID<=0x0F) // ; //Seems to not work with subtitles, to be confirmed //Subtitles (DVD) // if (CodecID>=0x20 && CodecID<=0x3F) // ; //Seems to not work with subtitles, to be confirmed //Subtitles (SVCD) // if (CodecID>=0x70 && CodecID<=0x7F) // ; //Seems to not work with subtitles, to be confirmed //AC3 if (CodecID>=0x80 && CodecID<=0x87) { if (CC2(Buffer+Buffer_Offset+4+Next)!=0x0B77 && CC2(Buffer+Buffer_Offset+3+Next)!=0x0B77 && CC2(Buffer+Buffer_Offset+2+Next)!=0x0B77) return false; } //DTS else if (CodecID>=0x88 && CodecID<=0x8F) { if (CC4(Buffer+Buffer_Offset+4+Next)!=0x7FFE8001 && CC4(Buffer+Buffer_Offset+3+Next)!=0x7FFE8001 && CC4(Buffer+Buffer_Offset+2+Next)!=0x7FFE8001) return false; } //DTS else if (CodecID>=0x98 && CodecID<=0x9F) { if (CC4(Buffer+Buffer_Offset+4+Next)!=0x7FFE8001 && CC4(Buffer+Buffer_Offset+3+Next)!=0x7FFE8001 && CC4(Buffer+Buffer_Offset+2+Next)!=0x7FFE8001) return false; } //PCM //else if (CodecID>=0xA0 && CodecID<=0xAF) // ; //MLP else if (CodecID>=0xB0 && CodecID<=0xBF) { if (CC2(Buffer+Buffer_Offset+4+Next)!=0x0B77 && CC2(Buffer+Buffer_Offset+3+Next)!=0x0B77 && CC2(Buffer+Buffer_Offset+2+Next)!=0x0B77) return false; } //AC3+ else if (CodecID>=0xC0 && CodecID<=0xCF) { if (CC2(Buffer+Buffer_Offset+4+Next)!=0x0B77 && CC2(Buffer+Buffer_Offset+3+Next)!=0x0B77 && CC2(Buffer+Buffer_Offset+2+Next)!=0x0B77) return false; } else return false; private_stream_1_IsDvdVideo=true; private_stream_1_Offset=4; } } //Filling private_stream_1_ID=CodecID; return true; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::private_stream_1_ChooseParser() { if (FromTS || Streams[stream_id].program_format_identifier || Streams[stream_id].format_identifier || Streams[stream_id].descriptor_tag) { int32u format_identifier=FromTS?FromTS_format_identifier:Streams[stream_id].format_identifier; if (format_identifier==0x42535344) //"BSSD" { return ChooseParser_SmpteSt0302(); //AES3 (SMPTE 302M) } int32u stream_type=FromTS?FromTS_stream_type:Streams[stream_id].stream_type; switch (stream_type) { case 0x03 : case 0x04 : return ChooseParser_Mpega(); //MPEG Audio case 0x0F : return ChooseParser_Adts(); //ADTS case 0x11 : return ChooseParser_Latm(); //LATM case 0x80 : return ChooseParser_PCM(); //PCM case 0x81 : case 0x83 : case 0x84 : case 0x87 : case 0xA1 : return ChooseParser_AC3(); //AC3/AC3+ case 0x82 : case 0x85 : case 0x86 : case 0xA2 : return ChooseParser_DTS(); //DTS case 0x90 : return ChooseParser_PGS(); //PGS from Bluray case 0xEA : return ChooseParser_NULL(); //VC1() default : { int8u descriptor_tag=FromTS?FromTS_descriptor_tag:Streams[stream_id].descriptor_tag; switch (descriptor_tag) { case 0x56 : return ChooseParser_Teletext(); //Teletext case 0x59 : return ChooseParser_DvbSubtitle(); //DVB Subtiles case 0x6A : case 0x7A : case 0x81 : return ChooseParser_AC3(); //AC3/AC3+ case 0x7B : return ChooseParser_DTS(); //DTS case 0x7C : return ChooseParser_AAC(); //AAC default : if (Element_Size>2 && CC2(Buffer+Buffer_Offset)==0x0B77) return ChooseParser_AC3(); //AC3/AC3+ else if (Element_Size>4 && CC4(Buffer+Buffer_Offset)==0x7FFE8001) return ChooseParser_DTS(); //DTS else return NULL; } } } } else if (Element_Code==0xBD && private_stream_1_IsDvdVideo) { //Subtitles (CVD) if (private_stream_1_ID<=0x0F) return ChooseParser_RLE(); //Subtitles (DVD) if (private_stream_1_ID>=0x20 && private_stream_1_ID<=0x3F) return ChooseParser_RLE(); //Subtitles (SVCD) if (private_stream_1_ID>=0x70 && private_stream_1_ID<=0x7F) return ChooseParser_RLE(); //AC3 else if (private_stream_1_ID>=0x80 && private_stream_1_ID<=0x87) return ChooseParser_AC3(); //DTS else if (private_stream_1_ID>=0x88 && private_stream_1_ID<=0x8F) return ChooseParser_DTS(); //SDDS else if (private_stream_1_ID>=0x90 && private_stream_1_ID<=0x97) return ChooseParser_DTS(); //DTS else if (private_stream_1_ID>=0x98 && private_stream_1_ID<=0x9F) return ChooseParser_DTS(); //PCM else if (private_stream_1_ID>=0xA0 && private_stream_1_ID<=0xAF) return ChooseParser_PCM(); //AC3+ else if (private_stream_1_ID>=0xC0 && private_stream_1_ID<=0xCF) return ChooseParser_AC3(); else return NULL; } else { if (Element_Size>2 && CC2(Buffer+Buffer_Offset)==0x0B77) return ChooseParser_AC3(); //AC3/AC3+ else if (Element_Size>4 && CC4(Buffer+Buffer_Offset)==0x7FFE8001) return ChooseParser_DTS(); //DTS else if (Element_Size>2 && (CC2(Buffer+Buffer_Offset)&0xFFFE)==0xFFA0) //0xFFA0 or 0xFFA1 return ChooseParser_PS2(); //PS2-MPG PCM/ADPCM else if (Element_Size>6 && CC2(Buffer+Buffer_Offset)==0xFF90 && CC2(Buffer+Buffer_Offset+4)==0x0B77) return ChooseParser_AC3(); //PS2-MPG AC-3 else if (Element_Size>6 && CC2(Buffer+Buffer_Offset)==0xFF90 && CC2(Buffer+Buffer_Offset+4)==0x0000) return ChooseParser_RLE(); //PS2-MPG Subtitles else return NULL; } } //--------------------------------------------------------------------------- const ZenLib::Char* File_MpegPs::private_stream_1_ChooseExtension() { if (FromTS) { switch (private_stream_1_ID) { case 0x80 : return __T(".pcm"); //PCM case 0x81 : return __T(".ac3"); //AC3 case 0x83 : case 0x87 : return __T(".dd+"); //AC3+ case 0x86 : return __T(".dts"); //DTS case 0xEA : return __T(".vc1"); //DTS default : return __T(".raw"); } } else { //Subtitles if (private_stream_1_ID>=0x20 && private_stream_1_ID<=0x3F) return __T(".sub"); //AC3 else if (private_stream_1_ID>=0x80 && private_stream_1_ID<=0x87) return __T(".ac3"); //DTS else if (private_stream_1_ID>=0x88 && private_stream_1_ID<=0x8F) return __T(".dts"); //SDDS else if (private_stream_1_ID>=0x90 && private_stream_1_ID<=0x97) return __T(".sdds"); //DTS else if (private_stream_1_ID>=0x98 && private_stream_1_ID<=0x9F) return __T(".dts"); //PCM else if (private_stream_1_ID>=0xA0 && private_stream_1_ID<=0xAF) return __T(".pcm"); //MLP else if (private_stream_1_ID>=0xB0 && private_stream_1_ID<=0xBF) return __T(".dd+"); //AC3+ else if (private_stream_1_ID>=0xC0 && private_stream_1_ID<=0xCF) return __T(".dd+"); else return __T(".raw"); } } //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File_MpegPs::private_stream_1_Element_Info1() { if (FromTS) { switch (private_stream_1_ID) { case 0x80 : Element_Info1("PCM"); return; case 0x81 : Element_Info1("AC3"); return; case 0x83 : case 0x87 : Element_Info1("AC3+"); return; case 0x86 : Element_Info1("DTS"); return; case 0xEA : Element_Info1("VC1"); return; default : return; } } else { //Subtitles if (private_stream_1_ID>=0x20 && private_stream_1_ID<=0x3F) Element_Info1("RLE"); //AC3 else if (private_stream_1_ID>=0x80 && private_stream_1_ID<=0x87) Element_Info1("AC3"); //DTS else if (private_stream_1_ID>=0x88 && private_stream_1_ID<=0x8F) Element_Info1("DTS"); //SDDS else if (private_stream_1_ID>=0x90 && private_stream_1_ID<=0x97) Element_Info1("SDDS"); //DTS else if (private_stream_1_ID>=0x98 && private_stream_1_ID<=0x9F) Element_Info1("DTS"); //PCM else if (private_stream_1_ID>=0xA0 && private_stream_1_ID<=0xAF) Element_Info1("LPCM"); //MLP else if (private_stream_1_ID>=0xB0 && private_stream_1_ID<=0xBF) Element_Info1("MLP"); //AC3+ else if (private_stream_1_ID>=0xC0 && private_stream_1_ID<=0xCF) Element_Info1("AC3+"); } } #endif //MEDIAINFO_TRACE //--------------------------------------------------------------------------- // Packet "BE" void File_MpegPs::padding_stream() { Element_Name("padding_stream"); Skip_XX(Element_Size, "stuffing_bytes"); } //--------------------------------------------------------------------------- // Packet "BF" void File_MpegPs::private_stream_2() { Element_Name("private_stream_2"); //Filling if (FromTS) { switch (FromTS_program_format_identifier) { case 0x54534856 : //TSHV switch (FromTS_stream_type) { case 0xA0 : private_stream_2_TSHV_A0(); break; case 0xA1 : private_stream_2_TSHV_A1(); break; default : Skip_XX(Element_Size, "Unknown"); } default : Skip_XX(Element_Size, "Unknown"); } //Disabling the program if (!Status[IsAccepted]) Data_Accept("MPEG-PS"); } else //DVD? { Stream_Prepare(Stream_Menu); Fill(Stream_Menu, StreamPos_Last, Menu_Format, "DVD-Video"); Fill(Stream_Menu, StreamPos_Last, Menu_Codec, "DVD-Video"); //Disabling this Stream Streams[0xBF].Searching_Payload=false; private_stream_2_Count=0; } } //--------------------------------------------------------------------------- void File_MpegPs::private_stream_2_TSHV_A0() { Element_Name("DV A0"); //Parsing Skip_XX(Element_Size, "Unknown"); //Filling Data_Accept("MPEG-PS"); Finish("MPEG-PS"); } //--------------------------------------------------------------------------- void File_MpegPs::private_stream_2_TSHV_A1() { Element_Name("DV A1"); //Parsing int8u day, month, year, second, minute, hour; Skip_XX(31, "Unknown"); BS_Begin(); Skip_S1(2, "Unknown"); Skip_S1(6, "timecode_frame"); Skip_S1(1, "Unknown"); Skip_S1(7, "timecode_second"); Skip_S1(1, "Unknown"); Skip_S1(7, "timecode_minute"); Skip_S1(2, "Unknown"); Skip_S1(6, "timecode_hour"); Skip_S1(8, "Unknown"); Skip_S1(2, "Unknown"); Get_S1 (6, day, "day"); Skip_S1(3, "Unknown"); Get_S1 (5, month, "month"); Get_S1 (8, year, "year"); Skip_S1(8, "Unknown"); Skip_S1(1, "Unknown"); Get_S1 (7, second, "second"); Skip_S1(1, "Unknown"); Get_S1 (7, minute, "minute"); Skip_S1(2, "Unknown"); Get_S1 (6, hour, "hour"); Skip_S1(2, "Unknown"); Skip_S1(1, "scene_start"); Skip_S1(5, "Unknown"); BS_End(); Skip_XX(Element_Size-Element_Offset, "Unknown"); FILLING_BEGIN(); Ztring Date_Time=Ztring().Date_From_Numbers(year/0x10*10+year%0x10, month/0x10*10+month%0x10, day/0x10*10+day%0x10, hour/0x10*10+hour%0x10, minute/0x10*10+minute%0x10, second/0x10*10+second%0x10); if (Retrieve(Stream_General, 0, General_Encoded_Date).empty()) { Fill(Stream_General, 0, General_Encoded_Date, Date_Time); Fill(Stream_General, 0, General_Duration_Start, Date_Time); } Fill(Stream_General, 0, General_Duration_End, Date_Time, true); FILLING_END(); } //--------------------------------------------------------------------------- void File_MpegPs::audio_stream() { Element_Name("Audio"); if (!Streams[stream_id].StreamIsRegistred) { //For TS streams, which does not have Start chunk if (FromTS) { if (video_stream_Count==(int8u)-1 && audio_stream_Count==(int8u)-1) { video_stream_Count=0; audio_stream_Count=1; private_stream_1_Count=0; private_stream_2_Count=0; extension_stream_Count=0; SL_packetized_stream_Count=0; Streams[stream_id].stream_type=FromTS_stream_type; } else if (!IsSub) { //2 streams in the file, this can not be From TS, we have no idea of the count of streams video_stream_Count=(int8u)-1; audio_stream_Count=(int8u)-1; private_stream_1_Count=(int8u)-1; private_stream_2_Count=(int8u)-1; extension_stream_Count=(int8u)-1; SL_packetized_stream_Count=(int8u)-1; FromTS=false; } } //If we have no Streams map --> Registering the Streams as MPEG Audio if (Streams[stream_id].stream_type==0 && !FromTS) { if (MPEG_Version==2) Streams[stream_id].stream_type=0x04; //MPEG-2 Audio else Streams[stream_id].stream_type=0x03; //MPEG-1 Audio } //Registering if (!Status[IsAccepted]) { Data_Accept("MPEG-PS"); if (!IsSub) Fill(Stream_General, 0, General_Format, "MPEG-PS"); } Streams[stream_id].StreamIsRegistred++; Streams[stream_id].FirstPacketOrder=FirstPacketOrder_Last; FirstPacketOrder_Last++; //New parsers Streams[stream_id].Parsers.push_back(private_stream_1_ChooseParser()); if (Streams[stream_id].Parsers[Streams[stream_id].Parsers.size()-1]==NULL) { Streams[stream_id].Parsers.clear(); #if defined(MEDIAINFO_MPEGA_YES) Streams[stream_id].Parsers.push_back(ChooseParser_Mpega()); #endif #if defined(MEDIAINFO_AC3_YES) Streams[stream_id].Parsers.push_back(ChooseParser_AC3()); #endif #if defined(MEDIAINFO_DTS_YES) Streams[stream_id].Parsers.push_back(ChooseParser_DTS()); #endif #if defined(MEDIAINFO_AAC_YES) Streams[stream_id].Parsers.push_back(ChooseParser_Adts()); #endif #if defined(MEDIAINFO_AAC_YES) Streams[stream_id].Parsers.push_back(ChooseParser_Latm()); #endif } for (size_t Pos=0; PosCA_system_ID_MustSkipSlices=CA_system_ID_MustSkipSlices; Open_Buffer_Init(Streams[stream_id].Parsers[Pos]); } } //Demux #if MEDIAINFO_DEMUX if (Streams[stream_id].Parsers.empty() || !Streams[stream_id].Parsers[0]->Demux_UnpacketizeContainer) Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream); #endif //MEDIAINFO_DEMUX //Parsing #if MEDIAINFO_EVENTS StreamIDs[StreamIDs_Size-1]=Element_Code; #endif //MEDIAINFO_EVENTS xxx_stream_Parse(Streams[stream_id], audio_stream_Count); #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) { Demux_StreamIsBeingParsed_type=0; Demux_StreamIsBeingParsed_stream_id=stream_id; } #endif //MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- void File_MpegPs::video_stream() { Element_Name("Video"); if (!Streams[stream_id].StreamIsRegistred) { //For TS streams, which does not have Start chunk if (FromTS) { if (video_stream_Count==(int8u)-1 && audio_stream_Count==(int8u)-1) { video_stream_Count=1; audio_stream_Count=0; private_stream_1_Count=0; private_stream_2_Count=0; extension_stream_Count=0; SL_packetized_stream_Count=0; Streams[stream_id].stream_type=FromTS_stream_type; } else if (!IsSub) { //2 streams in the file, this can not be From TS, we have no idea of the count of streams video_stream_Count=(int8u)-1; audio_stream_Count=(int8u)-1; private_stream_1_Count=(int8u)-1; private_stream_2_Count=(int8u)-1; extension_stream_Count=(int8u)-1; SL_packetized_stream_Count=(int8u)-1; FromTS=false; } } //Registering if (!Status[IsAccepted]) { Data_Accept("MPEG-PS"); if (!IsSub) Fill(Stream_General, 0, General_Format, "MPEG-PS"); } Streams[stream_id].StreamIsRegistred++; Streams[stream_id].FirstPacketOrder=FirstPacketOrder_Last; FirstPacketOrder_Last++; //New parsers switch (Streams[stream_id].stream_type) { case 0x10 : Streams[stream_id].Parsers.push_back(ChooseParser_Mpeg4v()); break; case 0x1B : Streams[stream_id].Parsers.push_back(ChooseParser_Avc() ); break; case 0x27 : Streams[stream_id].Parsers.push_back(ChooseParser_Hevc() ); break; case 0x01 : case 0x02 : case 0x80 : Streams[stream_id].Parsers.push_back(ChooseParser_Mpegv() ); break; default : #if defined(MEDIAINFO_MPEGV_YES) Streams[stream_id].Parsers.push_back(ChooseParser_Mpegv()); #endif #if defined(MEDIAINFO_AVC_YES) Streams[stream_id].Parsers.push_back(ChooseParser_Avc()); #endif #if defined(MEDIAINFO_HEVC_YES) Streams[stream_id].Parsers.push_back(ChooseParser_Hevc()); #endif #if defined(MEDIAINFO_MPEG4V_YES) Streams[stream_id].Parsers.push_back(ChooseParser_Mpeg4v()); #endif #if defined(MEDIAINFO_AVSV_YES) { File_AvsV* Parser=new File_AvsV; Streams[stream_id].Parsers.push_back(Parser); } #endif } for (size_t Pos=0; PosCA_system_ID_MustSkipSlices=CA_system_ID_MustSkipSlices; Open_Buffer_Init(Streams[stream_id].Parsers[Pos]); #if MEDIAINFO_IBI if (FromTS) Streams[stream_id].Parsers[Pos]->IbiStream=IbiStream; else { if (Ibi.Streams[stream_id]==NULL) Ibi.Streams[stream_id]=new ibi::stream; Streams[stream_id].Parsers[Pos]->IbiStream=Ibi.Streams[stream_id]; } #endif //MEDIAINFO_IBI #if MEDIAINFO_SEEK if (Unsynch_Frame_Counts.find(stream_id)!=Unsynch_Frame_Counts.end()) Streams[stream_id].Parsers[Pos]->Frame_Count_NotParsedIncluded=Unsynch_Frame_Counts[stream_id]; #endif //MEDIAINFO_SEEK } #if MEDIAINFO_SEEK if (Unsynch_Frame_Counts.find(stream_id)!=Unsynch_Frame_Counts.end()) Unsynch_Frame_Counts.erase(stream_id); #endif //MEDIAINFO_SEEK } //Demux #if MEDIAINFO_DEMUX if (!(FromTS_stream_type==0x20 && SubStream_Demux) && (Streams[stream_id].Parsers.empty() || !Streams[stream_id].Parsers[0]->Demux_UnpacketizeContainer)) Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream); #endif //MEDIAINFO_DEMUX //Parsing #if MEDIAINFO_EVENTS StreamIDs[StreamIDs_Size-1]=Element_Code; #endif //MEDIAINFO_EVENTS xxx_stream_Parse(Streams[stream_id], video_stream_Count); #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) { Demux_StreamIsBeingParsed_type=0; Demux_StreamIsBeingParsed_stream_id=stream_id; } #endif //MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- // Packet "FA" void File_MpegPs::SL_packetized_stream() { Element_Name("SL-packetized_stream"); if (!Streams[stream_id].StreamIsRegistred) { //For TS streams, which does not have Start chunk if (FromTS) { if (video_stream_Count==(int8u)-1 && audio_stream_Count==(int8u)-1) { video_stream_Count=0; audio_stream_Count=0; private_stream_1_Count=0; private_stream_2_Count=0; extension_stream_Count=0; SL_packetized_stream_Count=1; Streams[stream_id].stream_type=FromTS_stream_type; } else if (!IsSub) { //2 streams in the file, this can not be From TS, we have no idea of the count of streams video_stream_Count=(int8u)-1; audio_stream_Count=(int8u)-1; private_stream_1_Count=(int8u)-1; private_stream_2_Count=(int8u)-1; extension_stream_Count=(int8u)-1; SL_packetized_stream_Count=(int8u)-1; FromTS=false; } } //Registering Streams[stream_id].StreamIsRegistred++; Streams[stream_id].FirstPacketOrder=FirstPacketOrder_Last; FirstPacketOrder_Last++; if (!Status[IsAccepted]) Data_Accept("MPEG-PS"); Streams[stream_id].Searching_TimeStamp_Start=true; //New parsers #ifdef MEDIAINFO_MPEG4_YES if (ParserFromTs) { Streams[stream_id].Parsers.push_back(ParserFromTs); ParserFromTs=NULL; } else #endif if (FromTS_stream_type) switch (FromTS_stream_type) { case 0x0F : Streams[stream_id].Parsers.push_back(ChooseParser_Adts()); break; case 0x11 : Streams[stream_id].Parsers.push_back(ChooseParser_Latm()); break; default : ; } else { #if defined(MEDIAINFO_AAC_YES) Streams[stream_id].Parsers.push_back(ChooseParser_Adts()); #endif #if defined(MEDIAINFO_AAC_YES) Streams[stream_id].Parsers.push_back(ChooseParser_Latm()); #endif } for (size_t Pos=0; PosCA_system_ID_MustSkipSlices=CA_system_ID_MustSkipSlices; Open_Buffer_Init(Streams[stream_id].Parsers[Pos]); } } //Parsing #ifdef MEDIAINFO_MPEG4_YES if (SLConfig) //SL { BS_Begin(); int8u paddingBits=0; bool paddingFlag=false, idleFlag=false, OCRflag=false, accessUnitStartFlag=false; if (SLConfig->useAccessUnitStartFlag) Get_SB (accessUnitStartFlag, "accessUnitStartFlag"); if (SLConfig->useAccessUnitEndFlag) Skip_SB( "accessUnitEndFlag"); if (SLConfig->OCRLength>0) Get_SB (OCRflag, "OCRflag"); if (SLConfig->useIdleFlag) Get_SB (idleFlag, "idleFlag"); if (SLConfig->usePaddingFlag) Get_SB (paddingFlag, "paddingFlag"); if (paddingFlag) Get_S1(3, paddingBits, "paddingBits"); if (!idleFlag && (!paddingFlag || paddingBits!=0)) { bool DegPrioflag=false; if (SLConfig->packetSeqNumLength>0) Skip_S2(SLConfig->packetSeqNumLength, "packetSequenceNumber"); if (SLConfig->degradationPriorityLength>0) Get_SB (DegPrioflag, "DegPrioflag"); if (DegPrioflag) Skip_S2(SLConfig->degradationPriorityLength, "degradationPriority"); if (OCRflag) Skip_S8(SLConfig->OCRLength, "objectClockReference"); if (accessUnitStartFlag) { bool decodingTimeStampFlag=false, compositionTimeStampFlag=false, instantBitrateFlag=false; if (SLConfig->useRandomAccessPointFlag) Skip_SB( "randomAccessPointFlag"); if (SLConfig->AU_seqNumLength >0) Skip_S2(SLConfig->AU_seqNumLength, "AU_sequenceNumber"); if (SLConfig->useTimeStampsFlag) { Get_SB (decodingTimeStampFlag, "decodingTimeStampFlag"); Get_SB (compositionTimeStampFlag, "compositionTimeStampFlag"); } if (SLConfig->instantBitrateLength>0) Get_SB (instantBitrateFlag, "instantBitrateFlag"); if (decodingTimeStampFlag) Skip_S2(SLConfig->timeStampLength, "decodingTimeStamp"); if (compositionTimeStampFlag) Skip_S2(SLConfig->timeStampLength, "compositionTimeStamp"); if (SLConfig->AU_Length > 0) Skip_S2(SLConfig->AU_Length, "accessUnitLength"); if (instantBitrateFlag) Skip_S2(SLConfig->instantBitrateLength, "instantBitrate"); } } BS_End(); } #else //MEDIAINFO_MPEG4_YES Skip_XX(Element_Size, "LATM (not decoded)"); #endif //MEDIAINFO_MPEG4_YES //Demux /* if (Config_Demux) { int8u A[7]; //TODO: Only for 24KHz stuff, should be modified... output is ADTS A[0]=0xFF; A[1]=0xF9; A[2]=0x58; A[3]=0x80; A[4]=0x00; A[5]=0x1F; A[6]=0xFC; int32u Size=(int32u)(Element_Size+7); Size=Size<<13; A[3]=A[3]|((int8u)(Size>>24)); A[4]=A[4]|((int8u)(Size>>16)); A[5]=A[5]|((int8u)(Size>>8)); //Demux Demux(A, 7, ContentType_Header); Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream); } */ #if MEDIAINFO_DEMUX Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream); #endif //MEDIAINFO_DEMUX //Parsing #if MEDIAINFO_EVENTS StreamIDs[StreamIDs_Size-1]=Element_Code; #endif //MEDIAINFO_EVENTS xxx_stream_Parse(Streams[stream_id], SL_packetized_stream_Count); #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) { Demux_StreamIsBeingParsed_type=0; Demux_StreamIsBeingParsed_stream_id=stream_id; } #endif //MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- // Packet "FD" void File_MpegPs::extension_stream() { Element_Name("With Extension"); Element_Info1(MpegPs_stream_id_extension(stream_id_extension)); if (!Streams_Extension[stream_id_extension].StreamIsRegistred) { //For TS streams, which does not have Start chunk if (FromTS) { if (video_stream_Count==(int8u)-1 && audio_stream_Count==(int8u)-1) { video_stream_Count=0; audio_stream_Count=0; private_stream_1_Count=0; private_stream_2_Count=0; extension_stream_Count=1; SL_packetized_stream_Count=0; Streams_Extension[stream_id_extension].stream_type=FromTS_stream_type; } else if (!IsSub) { //2 streams in the file, this can not be From TS, we have no idea of the count of streams video_stream_Count=(int8u)-1; audio_stream_Count=(int8u)-1; private_stream_1_Count=(int8u)-1; private_stream_2_Count=(int8u)-1; extension_stream_Count=(int8u)-1; SL_packetized_stream_Count=(int8u)-1; FromTS=false; } } //Registering if (!Status[IsAccepted]) Data_Accept("MPEG-PS"); Streams[stream_id].StreamIsRegistred++; Streams_Extension[stream_id_extension].StreamIsRegistred++; Streams_Extension[stream_id_extension].Searching_Payload=true; Streams_Extension[stream_id_extension].Searching_TimeStamp_Start=true; Streams_Extension[stream_id_extension].Searching_TimeStamp_End=true; Streams_Extension[stream_id_extension].FirstPacketOrder=FirstPacketOrder_Last; FirstPacketOrder_Last++; //New parsers if (Streams_Extension[stream_id_extension].stream_type && Streams_Extension[stream_id_extension].stream_type<0x80) //Standard switch (Streams_Extension[stream_id_extension].stream_type) { case 0x0F : Streams_Extension[stream_id_extension].Parsers.push_back(ChooseParser_Adts()); break; default : ; } else switch (FromTS_format_identifier) { case 0x41432D33 : Streams_Extension[stream_id_extension].Parsers.push_back(ChooseParser_AC3()); break; case 0x44545331 : case 0x44545332 : case 0x44545333 : Streams_Extension[stream_id_extension].Parsers.push_back(ChooseParser_DTS()); break; case 0x56432D31 : Streams_Extension[stream_id_extension].Parsers.push_back(ChooseParser_VC1()); break; case 0x64726163 : Streams_Extension[stream_id_extension].Parsers.push_back(ChooseParser_Dirac()); break; default : switch (FromTS_program_format_identifier) { case 0x48444D56 : //HDMV (BluRay) switch (Streams_Extension[stream_id_extension].stream_type) { case 0x81 : case 0x83 : case 0x84 : case 0xA1 : Streams_Extension[stream_id_extension].Parsers.push_back(ChooseParser_AC3()); break; case 0x82 : case 0x85 : case 0x86 : case 0xA2 : Streams_Extension[stream_id_extension].Parsers.push_back(ChooseParser_DTS()); break; case 0xEA : Streams_Extension[stream_id_extension].Parsers.push_back(ChooseParser_VC1()); break; default : ; } break; default : ; if (stream_id_extension==0x00) {} //IPMP Control Information stream else if (stream_id_extension==0x01) {} //IPMP stream else if (stream_id_extension>=0x55 && stream_id_extension<=0x5F) Streams_Extension[stream_id_extension].Parsers.push_back(ChooseParser_VC1()); else if (stream_id_extension>=0x60 && stream_id_extension<=0x6F) Streams_Extension[stream_id_extension].Parsers.push_back(ChooseParser_Dirac()); else if (stream_id_extension==0x71 || stream_id_extension==0x72 || stream_id_extension==0x76) { Streams_Extension[stream_id_extension].Parsers.push_back(ChooseParser_DTS()); Streams_Extension[stream_id_extension].Parsers.push_back(ChooseParser_AC3()); } else if (stream_id_extension==0x75 && stream_id_extension<=0x7F) Streams_Extension[stream_id_extension].Parsers.push_back(ChooseParser_VC1()); } } if (Streams_Extension[stream_id_extension].Parsers.empty()) { #if defined(MEDIAINFO_DIRAC_YES) Streams_Extension[stream_id_extension].Parsers.push_back(ChooseParser_Dirac()); #endif #if defined(MEDIAINFO_VC1_YES) Streams_Extension[stream_id_extension].Parsers.push_back(ChooseParser_VC1()); #endif #if defined(MEDIAINFO_AC3_YES) Streams_Extension[stream_id_extension].Parsers.push_back(ChooseParser_AC3()); #endif #if defined(MEDIAINFO_DTS_YES) Streams_Extension[stream_id_extension].Parsers.push_back(ChooseParser_DTS()); #endif } //In case of HD part before Core part switch (stream_id_extension) { case 0x71 : case 0x76 : for (size_t Pos=0; PosCA_system_ID_MustSkipSlices=CA_system_ID_MustSkipSlices; Open_Buffer_Init(Streams_Extension[stream_id_extension].Parsers[Pos]); } } //Demux #if MEDIAINFO_DEMUX if (Streams_Extension[stream_id_extension].Searching_Payload) { StreamIDs[StreamIDs_Size-1]=Element_Code; if (stream_id_extension==0x72 && !(Streams_Extension[0x71].Parsers.empty() && Streams_Extension[0x76].Parsers.empty())) { if (!Streams_Extension[0x71].Parsers.empty()) Element_Code=0x71; if (!Streams_Extension[0x76].Parsers.empty()) Element_Code=0x76; } else Element_Code=stream_id_extension; //The upper level ID is filled by Element_Code in the common code StreamIDs_Width[StreamIDs_Size]=2; ParserIDs[StreamIDs_Size]=MediaInfo_Parser_MpegPs_Ext; StreamIDs_Size++; if (stream_id_extension==0x72 && !(Streams_Extension[0x71].Parsers.empty() && Streams_Extension[0x76].Parsers.empty())) Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_SubStream); else Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream); StreamIDs_Size--; Element_Code=StreamIDs[StreamIDs_Size-1]; } #endif //MEDIAINFO_DEMUX //Parsing if (stream_id_extension==0x72 && !(Streams_Extension[0x71].Parsers.empty() && Streams_Extension[0x76].Parsers.empty())) { if (!Streams_Extension[0x71].Parsers.empty()) { #if MEDIAINFO_EVENTS //Multiple substreams in 1 stream StreamIDs[StreamIDs_Size-1]=Element_Code; StreamIDs[StreamIDs_Size]=Element_Code=0x71; StreamIDs_Width[StreamIDs_Size]=2; ParserIDs[StreamIDs_Size]=MediaInfo_Parser_MpegPs_Ext; StreamIDs_Size++; #endif //MEDIAINFO_EVENTS xxx_stream_Parse(Streams_Extension[0x71], extension_stream_Count); #if MEDIAINFO_EVENTS StreamIDs_Size--; Element_Code=StreamIDs[StreamIDs_Size-1]; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) { Demux_StreamIsBeingParsed_type=2; Demux_StreamIsBeingParsed_stream_id=0x71; } #endif //MEDIAINFO_DEMUX } if (!Streams_Extension[0x76].Parsers.empty()) { #if MEDIAINFO_EVENTS //Multiple substreams in 1 stream StreamIDs[StreamIDs_Size-1]=Element_Code; StreamIDs[StreamIDs_Size]=Element_Code=0x76; StreamIDs_Width[StreamIDs_Size]=2; ParserIDs[StreamIDs_Size]=MediaInfo_Parser_MpegPs_Ext; StreamIDs_Size++; #endif //MEDIAINFO_EVENTS xxx_stream_Parse(Streams_Extension[0x76], extension_stream_Count); #if MEDIAINFO_EVENTS StreamIDs_Size--; Element_Code=StreamIDs[StreamIDs_Size-1]; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) { Demux_StreamIsBeingParsed_type=2; Demux_StreamIsBeingParsed_stream_id=0x76; } #endif //MEDIAINFO_DEMUX } } else { #if MEDIAINFO_EVENTS //Multiple substreams in 1 stream StreamIDs[StreamIDs_Size-1]=Element_Code; StreamIDs[StreamIDs_Size]=Element_Code=stream_id_extension; StreamIDs_Width[StreamIDs_Size]=2; ParserIDs[StreamIDs_Size]=MediaInfo_Parser_MpegPs_Ext; StreamIDs_Size++; #endif //MEDIAINFO_EVENTS xxx_stream_Parse(Streams_Extension[stream_id_extension], extension_stream_Count); #if MEDIAINFO_EVENTS StreamIDs_Size--; Element_Code=StreamIDs[StreamIDs_Size-1]; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) { Demux_StreamIsBeingParsed_type=2; Demux_StreamIsBeingParsed_stream_id=stream_id_extension; } #endif //MEDIAINFO_DEMUX } } //--------------------------------------------------------------------------- const ZenLib::Char* File_MpegPs::extension_stream_ChooseExtension() { //AC3 if ((stream_id_extension>=0x55 && stream_id_extension<=0x5F) || (stream_id_extension==0x75 && stream_id_extension<=0x7F)) return __T(".vc1"); //AC3+ else if (stream_id_extension>=0x60 && stream_id_extension<=0x6F) return __T(".dirac"); else if (stream_id_extension==0x71) return private_stream_1_ChooseExtension(); else return __T(".raw"); } //*************************************************************************** // xxx_stream helpers //*************************************************************************** //--------------------------------------------------------------------------- void File_MpegPs::xxx_stream_Parse(ps_stream &Temp, int8u &stream_Count) { switch (stream_id) { case 0xBD : //case 0xBF : case 0xFD : //PTS if (Streams[stream_id].TimeStamp_End.PTS.TimeStamp!=(int64u)-1) { if (Streams[stream_id].Searching_TimeStamp_End) { Temp.TimeStamp_End.PTS.File_Pos=File_Offset+Buffer_Offset; Temp.TimeStamp_End.PTS.TimeStamp=Streams[stream_id].TimeStamp_End.PTS.TimeStamp; } if (Searching_TimeStamp_Start && Temp.Searching_TimeStamp_Start) { Temp.TimeStamp_Start.PTS.File_Pos=File_Offset+Buffer_Offset; Temp.TimeStamp_Start.PTS.TimeStamp=Streams[stream_id].TimeStamp_End.PTS.TimeStamp; Temp.Searching_TimeStamp_Start=false; } } //DTS if (Streams[stream_id].TimeStamp_End.DTS.TimeStamp!=(int64u)-1) { if (Streams[stream_id].Searching_TimeStamp_End) { Temp.TimeStamp_End.DTS.File_Pos=File_Offset+Buffer_Offset; Temp.TimeStamp_End.DTS.TimeStamp=Streams[stream_id].TimeStamp_End.DTS.TimeStamp; } if (Searching_TimeStamp_Start && Streams[stream_id].TimeStamp_End.DTS.TimeStamp!=(int64u)-1 && Temp.Searching_TimeStamp_Start) { Temp.TimeStamp_Start.DTS.TimeStamp=Streams[stream_id].TimeStamp_End.DTS.TimeStamp; Temp.Searching_TimeStamp_Start=false; } } default : ; } //Needed? if (Temp.Parsers.size()==1 && Temp.Parsers[0]->Status[IsFinished]) { Skip_XX(Element_Size-Element_Offset, "data"); return; } #if MEDIAINFO_TRACE if (stream_id==0xBD /*|| stream_id==0xBF*/) private_stream_1_Element_Info1(); #endif //MEDIAINFO_TRACE for (size_t Pos=0; PosStatus[IsFinished]) { //PTS/DTS if (Temp.Parsers[Pos]->PTS_DTS_Needed) { if (FrameInfo.PCR!=(int64u)-1) Temp.Parsers[Pos]->FrameInfo.PCR=FrameInfo.PCR; if (FrameInfo.PTS!=(int64u)-1) Temp.Parsers[Pos]->FrameInfo.PTS=FrameInfo.PTS; if (FrameInfo.DTS!=(int64u)-1) Temp.Parsers[Pos]->FrameInfo.DTS=FrameInfo.DTS; } #if MEDIAINFO_TRACE if (Temp.Parsers.size()>1) Element_Begin1("Test"); #endif //MEDIAINFO_TRACE #if MEDIAINFO_IBI Temp.Parsers[Pos]->Ibi_SynchronizationOffset_Current=Ibi_SynchronizationOffset_Current; #endif //MEDIAINFO_IBI Open_Buffer_Continue(Temp.Parsers[Pos], Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); if (IsSub && Temp.Parsers[Pos]->Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded=Temp.Parsers[Pos]->Frame_Count_NotParsedIncluded; if (!MustExtendParsingDuration && Temp.Parsers[Pos]->MustExtendParsingDuration) { SizeToAnalyze*=4; //Normally 4 seconds, now 16 seconds MustExtendParsingDuration=true; } #if MEDIAINFO_TRACE if (Temp.Parsers.size()>1) Element_End0(); #endif //MEDIAINFO_TRACE if (Temp.Parsers.size()>1) { if (!Temp.Parsers[Pos]->Status[IsAccepted] && Temp.Parsers[Pos]->Status[IsFinished]) { delete *(Temp.Parsers.begin()+Pos); Temp.Parsers.erase(Temp.Parsers.begin()+Pos); Pos--; } else if (Temp.Parsers.size()>1 && Temp.Parsers[Pos]->Status[IsAccepted]) { File__Analyze* Parser=Temp.Parsers[Pos]; for (size_t Pos2=0; Pos2Status[IsFilled]) { stream_Count--; Temp.IsFilled=true; } } //FrameInfo.PCR=(int64u)-1; FrameInfo.DTS=(int64u)-1; FrameInfo.PTS=(int64u)-1; Element_Show(); #if MEDIAINFO_EVENTS if (FrameInfo.DTS==(int64u)-1) FrameInfo.DTS=FrameInfo.PTS; //New PES #if MEDIAINFO_DEMUX if (PES_FirstByte_IsAvailable && PES_FirstByte_Value) { //Demux of substream data if (FromTS_stream_type==0x1B && SubStream_Demux) { if (!SubStream_Demux->Buffers.empty() && !SubStream_Demux->Buffers.empty() && SubStream_Demux->Buffers[0] && SubStream_Demux->Buffers[0]->DTSBuffers[0]->Buffer, SubStream_Demux->Buffers[0]->Buffer_Size, ContentType_SubStream); delete SubStream_Demux->Buffers[0]->Buffer; SubStream_Demux->Buffers[0]->Buffer=NULL; SubStream_Demux->Buffers.erase(SubStream_Demux->Buffers.begin()); //Moving 2nd Buffer to 1st position } } } //Demux of SubStream if (FromTS_stream_type==0x20 && SubStream_Demux) { //Searching an available slot size_t Buffers_Pos; if (SubStream_Demux->Buffers.empty() || SubStream_Demux->Buffers[SubStream_Demux->Buffers.size()-1]->DTS!=FrameInfo.DTS) { Buffers_Pos=SubStream_Demux->Buffers.size(); SubStream_Demux->Buffers.push_back(new demux::buffer); } else { Buffers_Pos=SubStream_Demux->Buffers.size()-1; } //Filling buffer if (SubStream_Demux->Buffers[Buffers_Pos]->Buffer==NULL) { SubStream_Demux->Buffers[Buffers_Pos]->DTS=FrameInfo.DTS; SubStream_Demux->Buffers[Buffers_Pos]->Buffer_Size_Max=128*1024; SubStream_Demux->Buffers[Buffers_Pos]->Buffer_Size=0; SubStream_Demux->Buffers[Buffers_Pos]->Buffer=new int8u[SubStream_Demux->Buffers[Buffers_Pos]->Buffer_Size_Max]; } if (SubStream_Demux->Buffers[Buffers_Pos]->Buffer_Size_Max>SubStream_Demux->Buffers[Buffers_Pos]->Buffer_Size+(size_t)(Element_Size-Element_Offset) && SubStream_Demux->Buffers[Buffers_Pos]->Buffer_Size_Max<=16*1024*1024) { SubStream_Demux->Buffers[Buffers_Pos]->Buffer_Size_Max*=2; int8u* Buffer_Demux=SubStream_Demux->Buffers[Buffers_Pos]->Buffer; SubStream_Demux->Buffers[Buffers_Pos]->Buffer=new int8u[SubStream_Demux->Buffers[Buffers_Pos]->Buffer_Size_Max]; std::memcpy(SubStream_Demux->Buffers[Buffers_Pos]->Buffer, Buffer_Demux, SubStream_Demux->Buffers[Buffers_Pos]->Buffer_Size); delete[] Buffer_Demux; //Buffer_Demux=NULL; } if (SubStream_Demux->Buffers[Buffers_Pos]->Buffer_Size+(size_t)(Element_Size-Element_Offset)<=SubStream_Demux->Buffers[Buffers_Pos]->Buffer_Size_Max) { std::memcpy(SubStream_Demux->Buffers[Buffers_Pos]->Buffer+SubStream_Demux->Buffers[Buffers_Pos]->Buffer_Size, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); SubStream_Demux->Buffers[Buffers_Pos]->Buffer_Size+=(size_t)(Element_Size-Element_Offset); } } #endif //MEDIAINFO_DEMUX #endif //MEDIAINFO_EVENTS #if MEDIAINFO_SEEK && MEDIAINFO_IBI if (Seek_ID!=(int64u)-1) { if (Ibi.Streams[Seek_ID]->IsModified) { Read_Buffer_Seek(2, Seek_Value, Seek_ID); } else if (File_Offset+Buffer_Offset>=Seek_Value_Maximal) { //No intermediate seek point found, going to previous seek point for (size_t Pos=1; PosInfos.size(); Pos++) if (Ibi.Streams[Seek_ID]->Infos[Pos].StreamOffset>=Seek_Value_Maximal) { if (Ibi.Streams[Seek_ID]->IsSynchronized) { //No intermediate point is possible Ibi.Streams[Seek_ID]->Infos[Pos-1].IsContinuous=true; Read_Buffer_Seek(2, Seek_Value, Seek_ID); } else { //Going to last known seek point GoTo(Ibi.Streams[Seek_ID]->Infos[Pos-1].StreamOffset); Open_Buffer_Unsynch(); } break; } } } #endif //MEDIAINFO_SEEK && MEDIAINFO_IBI } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- bool File_MpegPs::Header_Parser_QuickSearch() { while ( Buffer_Offset+4<=Buffer_Size && CC3(Buffer+Buffer_Offset)==0x000001) { //Getting stream_id int8u stream_id=Buffer[Buffer_Offset+3]; //Trace config #if MEDIAINFO_TRACE if (Config_Trace_Level) { if (stream_id==0xC0 || stream_id==0xE0) { if (!Trace_Layers[8]) Trace_Layers_Update(8); //Stream } else Trace_Layers_Update(IsSub?1:0); } #endif //MEDIAINFO_TRACE //Searching start if (Streams[stream_id].Searching_Payload) { if (stream_id!=0xBD /*&& stream_id!=0xBF)*/ || !private_stream_1_IsDvdVideo) //Not (private_stream_1 and IsDvdVideo) return true; //private_stream_1 and IsDvdVideo, looking for substream ID if (Buffer_Offset+9>=Buffer_Size) return false; //Need more data size_t Data_Offset=Buffer[Buffer_Offset+8]; if (Buffer_Offset+9+Data_Offset>=Buffer_Size) return false; //Need more data int8u private_stream_1_ID=Buffer[Buffer_Offset+9+Data_Offset]; if (!Streams_Private1[private_stream_1_ID].StreamIsRegistred || Streams_Private1[private_stream_1_ID].Searching_Payload) return true; } //Searching TimeStamp_End if (Streams[stream_id].Searching_TimeStamp_End) { switch(stream_id) { //Element with no PES Header case 0xB9 : //MPEG_program_end case 0xBA : //pack_start case 0xBB : //system_header_start case 0xBC : //program_stream_map case 0xBE : //padding_stream case 0xBF : //private_stream_2 case 0xF0 : //ECM case 0xF1 : //EMM case 0xF2 : //DSMCC Streams case 0xF8 : //ITU-T Rec. H .222.1 type E case 0xFF : //Program Streams directory break; //Element with PES Header default : if (MPEG_Version==1) { size_t Buffer_Offset_Temp=Buffer_Offset+6; while(Buffer_Offset_Temp=Buffer_Size) return false; //Not enough data } if (Buffer_Offset_Temp+1>=Buffer_Size) return false; //Not enough data if (Buffer_Offset_TempBuffer_Size) return false; //Not enough buffer if ((Buffer[Buffer_Offset+7]&0xC0)!=0x00) return true; //With a PTS } } } //Getting size switch(stream_id) { //No size case 0xB9 : //MPEG_program_end case 0xBA : //pack_start Buffer_Offset+=4; while(Buffer_Offset+4<=Buffer_Size && !(CC3(Buffer+Buffer_Offset)==0x000001 && Buffer[Buffer_Offset+3]>=0xB9)) { Buffer_Offset+=2; while(Buffer_Offset=Buffer_Size || Buffer[Buffer_Offset-1]==0x00) Buffer_Offset--; } //Parsing last bytes if needed if (Buffer_Offset+4>Buffer_Size) { if (Buffer_Offset+3==Buffer_Size && CC3(Buffer+Buffer_Offset)!=0x000001) Buffer_Offset++; if (Buffer_Offset+2==Buffer_Size && CC2(Buffer+Buffer_Offset)!=0x0000) Buffer_Offset++; if (Buffer_Offset+1==Buffer_Size && CC1(Buffer+Buffer_Offset)!=0x00) Buffer_Offset++; } break; //Element with size default : if (Buffer_Offset+6>=Buffer_Size) return false; //Not enough data int16u Size=CC2(Buffer+Buffer_Offset+4); if (Size>0) { Buffer_Offset+=6+Size; //Trailing 0xFF while(Buffer_Offset=0xB9)) Buffer_Offset++; if (Buffer_Offset+4>Buffer_Size) { if (Buffer_Offset+3==Buffer_Size && CC3(Buffer+Buffer_Offset)!=0x000001) Buffer_Offset++; if (Buffer_Offset+2==Buffer_Size && CC2(Buffer+Buffer_Offset)!=0x0000) Buffer_Offset++; if (Buffer_Offset+1==Buffer_Size && CC1(Buffer+Buffer_Offset)!=0x00) Buffer_Offset++; } } } } if (Buffer_Offset+3==Buffer_Size) return false; //Sync is OK, but stream_id is not available if (Buffer_Offset+4<=Buffer_Size) Trusted_IsNot("MPEG-PS, Synchronisation lost"); Synched=false; return Synchronize(); } //*************************************************************************** // Parsers //*************************************************************************** //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_Mpegv() { //Filling #if defined(MEDIAINFO_MPEGV_YES) File_Mpegv* Parser=new File_Mpegv; Parser->MPEG_Version=MPEG_Version; Parser->ShouldContinueParsing=true; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_UnpacketizeContainer=false; //No demux from this parser Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Video); Parser->Fill(Stream_Video, 0, Video_Format, "MPEG Video"); switch (FromTS_stream_type) { case 0x01 : Parser->Fill(Stream_Video, 0, Video_Codec, "MPEG-1V"); Parser->Fill(Stream_Video, 0, Video_Format_Version, "Version 1"); break; case 0x02 : Parser->Fill(Stream_Video, 0, Video_Codec, "MPEG-2V"); Parser->Fill(Stream_Video, 0, Video_Format_Version, "Version 2"); break; default : Parser->Fill(Stream_Video, 0, Video_Codec, "MPEG-V"); } #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_Mpeg4v() { //Filling #if defined(MEDIAINFO_MPEG4V_YES) File_Mpeg4v* Parser=new File_Mpeg4v; Parser->Frame_Count_Valid=1; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_UnpacketizeContainer=false; //No demux from this parser Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Video); Parser->Fill(Stream_Video, 0, Video_Codec, "MPEG-4V"); Parser->Fill(Stream_Video, 0, Video_Format, "MPEG-4 Visual"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_Avc() { //Filling #if defined(MEDIAINFO_AVC_YES) File_Avc* Parser=new File_Avc; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_UnpacketizeContainer=false; //No demux from this parser Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Video); Parser->Fill(Stream_Video, 0, Video_Codec, "AVC"); Parser->Fill(Stream_Video, 0, Video_Format, "AVC"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_Hevc() { //Filling #if defined(MEDIAINFO_HEVC_YES) File_Hevc* Parser=new File_Hevc; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_UnpacketizeContainer=false; //No demux from this parser Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Video); Parser->Fill(Stream_Video, 0, Video_Codec, "HEVC"); Parser->Fill(Stream_Video, 0, Video_Format, "HEVC"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_VC1() { //Filling #if defined(MEDIAINFO_VC1_YES) File_Vc1* Parser=new File_Vc1; Parser->Frame_Count_Valid=30; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_UnpacketizeContainer=false; //No demux from this parser Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Video); Parser->Fill(Stream_Video, 0, Video_Codec, "VC-1"); Parser->Fill(Stream_Video, 0, Video_Format, "VC-1"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_Dirac() { //Filling #if defined(MEDIAINFO_DIRAC_YES) File__Analyze* Parser=new File_Dirac; ((File_Dirac*)Parser)->Frame_Count_Valid=1; #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Video); Parser->Fill(Stream_Video, 0, Video_Codec, "Dirac"); Parser->Fill(Stream_Video, 0, Video_Format, "Dirac"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_Mpega() { //Filling #if defined(MEDIAINFO_MPEGA_YES) File_Mpega* Parser=new File_Mpega; Parser->Frame_Count_Valid=1; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_UnpacketizeContainer=false; //No demux from this parser Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Audio); Parser->Fill(Stream_Audio, 0, Audio_Format, "MPEG Audio"); switch (FromTS_stream_type) { case 0x03 : Parser->Fill(Stream_Audio, 0, Audio_Codec, "MPEG-1A"); Parser->Fill(Stream_Audio, 0, Audio_Format_Version, "Version 1"); break; case 0x04 : Parser->Fill(Stream_Audio, 0, Audio_Codec, "MPEG-2A"); Parser->Fill(Stream_Audio, 0, Audio_Format_Version, "Version 2"); break; default : Parser->Fill(Stream_Audio, 0, Audio_Codec, "MPEG-A"); break; } #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_Adts() { //Filling #if defined(MEDIAINFO_AAC_YES) File_Aac* Parser=new File_Aac; Parser->Mode=File_Aac::Mode_ADTS; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_UnpacketizeContainer=false; //No demux from this parser Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Audio); Parser->Fill(Stream_Audio, 0, Audio_Codec, "AAC"); Parser->Fill(Stream_Audio, 0, Audio_Format, "AAC"); Parser->Fill(Stream_Audio, 0, Audio_MuxingMode, "ADTS"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_Latm() { //Filling #if defined(MEDIAINFO_AAC_YES) File_Aac* Parser=new File_Aac; Parser->Mode=File_Aac::Mode_LATM; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_UnpacketizeContainer=false; //No demux from this parser Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Audio); Parser->Fill(Stream_Audio, 0, Audio_Codec, "AAC"); Parser->Fill(Stream_Audio, 0, Audio_Format, "AAC"); Parser->Fill(Stream_Audio, 0, Audio_MuxingMode, "LATM"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_AC3() { //Filling #if defined(MEDIAINFO_AC3_YES) File_Ac3* Parser=new File_Ac3(); Parser->Frame_Count_Valid=2; //2 frames to be sure #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_UnpacketizeContainer=false; //No demux from this parser Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Audio); Parser->Fill(Stream_Audio, 0, Audio_Format, private_stream_1_ID==0x83?"E-AC-3":"AC-3"); Parser->Fill(Stream_Audio, 0, Audio_Codec, private_stream_1_ID==0x83?"AC3+":"AC3"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_DTS() { //Filling #if defined(MEDIAINFO_DTS_YES) File__Analyze* Parser=new File_Dts(); ((File_Dts*)Parser)->Frame_Count_Valid=2; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_UnpacketizeContainer=false; //No demux from this parser Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Audio); Parser->Fill(Stream_Audio, 0, Audio_Format, "DTS"); Parser->Fill(Stream_Audio, 0, Audio_Codec, "DTS"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_SDDS() { //Filling #if defined(MEDIAINFO_SDDS_YES) //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Audio); Parser->Fill(Stream_Audio, StreamPos_Last, Audio_Format, "SDDS"); Parser->Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "SDDS"); #else //Filling File__Analyze* Parser=new File_Unknown(); Parser->Stream_Prepare(Stream_Audio); Parser->Fill(Stream_Audio, 0, Audio_Format, "SDDS"); Parser->Fill(Stream_Audio, 0, Audio_Codec, "SDDS"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_AAC() { //Filling #if defined(MEDIAINFO_AAC_YES) File_Aac* Parser=new File_Aac; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_UnpacketizeContainer=false; //No demux from this parser Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Audio); Parser->Fill(Stream_Audio, 0, Audio_Format, "AAC"); Parser->Fill(Stream_Audio, 0, Audio_Codec, "AAC"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_PCM() { //Filling #if defined(MEDIAINFO_PCM_YES) File__Analyze* Parser; switch (FromTS_stream_type) { case 0x80 : Parser=new File_Pcm_M2ts(); break; default : Parser=new File_Pcm_Vob(); } #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_UnpacketizeContainer=false; //No demux from this parser Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Audio); Parser->Fill(Stream_Audio, 0, Audio_Format, "PCM"); Parser->Fill(Stream_Audio, 0, Audio_Codec, "PCM"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_RLE() { //Filling #if defined(MEDIAINFO_RLE_YES) File__Analyze* Parser=new File_Rle(); #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Text); Parser->Fill(Stream_Text, 0, Text_Format, "RLE"); Parser->Fill(Stream_Text, 0, Text_Codec, "RLE"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_AribStdB24B37(bool HasCcis) { //Filling #if defined(MEDIAINFO_ARIBSTDB24B37_YES) File_AribStdB24B37* Parser=new File_AribStdB24B37(); Parser->HasCcis=HasCcis; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_UnpacketizeContainer=false; //No demux from this parser Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Text); Parser->Fill(Stream_Text, 0, Text_Format, "ARIB STD B24/B37"); Parser->Fill(Stream_Text, 0, Text_Codec, "ARIB STD B24/B37"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_DvbSubtitle() { //Filling #if defined(MEDIAINFO_DVBSUBTITLE_YES) File__Analyze* Parser=new File_DvbSubtitle(); #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_UnpacketizeContainer=false; //No demux from this parser Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Text); Parser->Fill(Stream_Text, 0, Text_Format, "DVB Subtitle"); Parser->Fill(Stream_Text, 0, Text_Codec, "DVB Subtitle"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_Teletext() { //Filling #if defined(MEDIAINFO_TELETEXT_YES) File__Analyze* Parser=new File_Teletext(); #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Text); Parser->Fill(Stream_Text, 0, Text_Format, "Teletext"); Parser->Fill(Stream_Text, 0, Text_Codec, "Teletext"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_PGS() { //Filling #if defined(MEDIAINFO_PGS_YES) File__Analyze* Parser=new File_Pgs(); #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Text); Parser->Fill(Stream_Text, 0, Text_Format, "PGS"); Parser->Fill(Stream_Text, 0, Text_Codec, "PGS"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_SmpteSt0302() { //Filling #if defined(MEDIAINFO_SMPTEST0302_YES) File_SmpteSt0302* Parser=new File_SmpteSt0302(); #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Demux_UnpacketizeContainer=false; //No demux from this parser Demux_Level=4; //Intermediate Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Audio); Parser->Fill(Stream_Audio, 0, Audio_Format, "AES3"); Parser->Fill(Stream_Audio, 0, Audio_Codec, "AES3"); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_PS2() { //Filling #if defined(MEDIAINFO_PS2A_YES) File__Analyze* Parser=new File_Ps2Audio(); #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Audio); #endif return Parser; } //--------------------------------------------------------------------------- File__Analyze* File_MpegPs::ChooseParser_NULL() { //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); return Parser; } //*************************************************************************** // Output_Buffer //*************************************************************************** //--------------------------------------------------------------------------- size_t File_MpegPs::Output_Buffer_Get (const String &Code) { //Parsing Parsers for (size_t Streams_Pos=0; Streams_PosOutput_Buffer_Get(Code)) return Size; return 0; } //--------------------------------------------------------------------------- size_t File_MpegPs::Output_Buffer_Get (size_t Pos_) { //Parsing Parsers for (size_t Streams_Pos=0; Streams_PosOutput_Buffer_Get(Pos_)) return Size; return 0; } } //Namespace #endif //MEDIAINFO_MPEGPS_YES MediaInfoLib/Source/MediaInfo/Multiple/File_MpegPs.h100777 0 0 23424 12254661613 15703 0/* 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 { struct Mpeg_TimeStamp { struct Mpeg_TimeStamp_TS { int64u File_Pos; int64u TimeStamp; Mpeg_TimeStamp_TS() { File_Pos=(int64u)-1; TimeStamp=(int64u)-1; } }; Mpeg_TimeStamp_TS PTS; Mpeg_TimeStamp_TS DTS; }; stream_t StreamKind; size_t StreamPos; 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 StreamIsRegistred; size_t StreamOrder; size_t FirstPacketOrder; bool Searching_Payload; bool Searching_TimeStamp_Start; bool Searching_TimeStamp_End; bool IsFilled; ps_stream() { StreamKind=Stream_Max; StreamPos=0; stream_type=0; program_format_identifier=0x00000000; //No info format_identifier=0x00000000; //No info descriptor_tag=0x00; //No info DVD_Identifier=0; StreamIsRegistred=0; StreamOrder=(size_t)-1; FirstPacketOrder=(size_t)-1; Searching_Payload=false; Searching_TimeStamp_Start=false; Searching_TimeStamp_End=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_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_Adts(); File__Analyze* ChooseParser_Latm(); File__Analyze* ChooseParser_AC3(); 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_Finish_PerStream(size_t StreamID, ps_stream &Temp, kindofstream KindOfStream); void xxx_stream_Parse(ps_stream &Temp, int8u &stream_Count); //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 MediaInfoLib/Source/MediaInfo/Multiple/File_MpegTs.cpp100777 0 0 542665 12262743712 16277 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPEGTS_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_MpegTs.h" #include "MediaInfo/Multiple/File_MpegPs.h" #include "MediaInfo/Multiple/File_Mpeg_Descriptors.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "MediaInfo/MediaInfo.h" #include "MediaInfo/MediaInfo_Internal.h" #include "ZenLib/File.h" #include #include #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "MediaInfo/MediaInfo_Events_Internal.h" #endif //MEDIAINFO_EVENTS #if MEDIAINFO_IBI #if MEDIAINFO_SEEK #include "MediaInfo/Multiple/File_Ibi.h" #endif //MEDIAINFO_SEEK #endif //MEDIAINFO_IBI using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constants //*************************************************************************** namespace Elements { const int32u HDMV=0x48444D56; //BluRay } #if !MEDIAINFO_ADVANCED const float64 Config_VbrDetection_Delta=0; const int64u Config_VbrDetection_Occurences=4; #endif // MEDIAINFO_ADVANCED //*************************************************************************** // Depends of configuration //*************************************************************************** #if !defined(MEDIAINFO_BDAV_YES) const size_t BDAV_Size=0; #endif #if !defined(MEDIAINFO_TSP_YES) const size_t TSP_Size=0; #endif #if !defined(MEDIAINFO_BDAV_YES) && !defined(MEDIAINFO_TSP_YES) const size_t TS_Size=188; #endif //*************************************************************************** // Info //*************************************************************************** //--------------------------------------------------------------------------- //From Mpeg_Psi extern const char* Mpeg_Descriptors_registration_format_identifier_Format(int32u format_identifier); extern stream_t Mpeg_Descriptors_registration_format_identifier_StreamKind(int32u format_identifier); extern const char* Mpeg_Psi_stream_type_Format(int8u stream_type, int32u format_identifier); extern const char* Mpeg_Psi_stream_type_Codec(int8u stream_type, int32u format_identifier); extern stream_t Mpeg_Psi_stream_type_StreamKind(int32u stream_type, int32u format_identifier); extern const char* Mpeg_Psi_stream_type_Info(int8u stream_type, int32u format_identifier); extern const char* Mpeg_Psi_table_id(int8u table_id); extern const char* Mpeg_Descriptors_stream_Format(int8u descriptor_tag, int32u format_identifier); extern const char* Mpeg_Descriptors_stream_Codec(int8u descriptor_tag, int32u format_identifier); extern stream_t Mpeg_Descriptors_stream_Kind(int8u descriptor_tag, int32u format_identifier); extern const char* Mpeg_Descriptors_CA_system_ID(int16u CA_system_ID); //--------------------------------------------------------------------------- Ztring Decimal_Hexa(int64u Number) { Ztring Temp; Temp.From_Number(Number); Temp+=__T(" (0x"); Temp+=Ztring::ToZtring(Number, 16); Temp+=__T(")"); return Temp; } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_MpegTs::File_MpegTs() #if MEDIAINFO_DUPLICATE :File__Duplicate() #endif //MEDIAINFO_DUPLICATE { //Configuration ParserName=__T("MpegTs"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_MpegTs; StreamIDs_Width[0]=4; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_Level=4; //Intermediate #endif //MEDIAINFO_DEMUX MustSynchronize=true; Buffer_TotalBytes_FirstSynched_Max=64*1024; Buffer_TotalBytes_Fill_Max=(int64u)-1; //Disabling this feature for this format, this is done in the parser Trusted_Multiplier=2; #if MEDIAINFO_DEMUX Demux_EventWasSent_Accept_Specific=true; #endif //MEDIAINFO_DEMUX //Internal config #if defined(MEDIAINFO_BDAV_YES) BDAV_Size=0; //No BDAV header #endif #if defined(MEDIAINFO_TSP_YES) TSP_Size=0; //No TSP footer #endif #ifdef MEDIAINFO_ARIBSTDB24B37_YES FromAribStdB24B37=false; #endif //Data MpegTs_JumpTo_Begin=MediaInfoLib::Config.MpegTs_MaximumOffset_Get(); MpegTs_JumpTo_End=MediaInfoLib::Config.MpegTs_MaximumOffset_Get()/4; Searching_TimeStamp_Start=true; Complete_Stream=NULL; Begin_MaxDuration=MediaInfoLib::Config.ParseSpeed_Get()>=0.8?(int64u)-1:MediaInfoLib::Config.MpegTs_MaximumScanDuration_Get()*27/1000; ForceStreamDisplay=MediaInfoLib::Config.MpegTs_ForceStreamDisplay_Get(); #if MEDIAINFO_SEEK Seek_Value=(int64u)-1; Seek_ID=(int64u)-1; InfiniteLoop_Detect=0; Duration_Detected=false; #endif //MEDIAINFO_SEEK } File_MpegTs::~File_MpegTs () { delete Complete_Stream; Complete_Stream=NULL; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_MpegTs::Streams_Accept() { Fill(Stream_General, 0, General_Format, BDAV_Size?"BDAV":(TSP_Size?"MPEG-TS 188+16":"MPEG-TS"), Unlimited, true, true); #if MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET if (Config->NextPacket_Get() && Config->Event_CallBackFunction_IsSet()) Config->Demux_EventWasSent=true; #endif //MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET } //--------------------------------------------------------------------------- void File_MpegTs::Streams_Fill () { Status[User_20]=true; } //--------------------------------------------------------------------------- void File_MpegTs::Streams_Update() { if (Status[User_19]) Streams_Update_Programs(); if (Status[User_18]) Streams_Update_EPG(); #ifdef MEDIAINFO_MPEGTS_PCR_YES if (Status[User_16]) Streams_Update_Duration_Update(); #endif //MEDIAINFO_MPEGTS_PCR_YES if (Status[User_17]) Streams_Update_Duration_End(); if (File_Name.empty() && Config->ParseSpeed>=1.0) Fill(Stream_General, 0, General_FileSize, (File_Offset+Buffer_Offset!=File_Size)?Buffer_TotalBytes:File_Size, 10, true); } //--------------------------------------------------------------------------- void File_MpegTs::Streams_Update_Programs() { //Per stream bool PerStream_AlwaysParse=ForceStreamDisplay; if (!PerStream_AlwaysParse) { size_t Programs_Size=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs.size(); PerStream_AlwaysParse=true; if (Programs_Size<=2) { //Testing if it is a Blu-ray for (complete_stream::transport_stream::programs::iterator Program=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs.begin(); Program!=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs.end(); ++Program) if (Program->first!=0x0000 && Program->second.registration_format_identifier!=Elements::HDMV) { PerStream_AlwaysParse=false; break; } } } for (std::set::iterator StreamID=Complete_Stream->PES_PIDs.begin(); StreamID!=Complete_Stream->PES_PIDs.end(); ++StreamID) if (PerStream_AlwaysParse || Complete_Stream->Streams[*StreamID]->IsUpdated_IsRegistered || Complete_Stream->Streams[*StreamID]->IsUpdated_Info) { Streams_Update_Programs_PerStream(*StreamID); Complete_Stream->Streams[*StreamID]->IsUpdated_IsRegistered=false; Complete_Stream->Streams[*StreamID]->IsUpdated_Info=false; } //Fill General if (Complete_Stream->transport_stream_id_IsValid) { Fill(Stream_General, 0, General_ID, Complete_Stream->transport_stream_id, 10, true); Fill(Stream_General, 0, General_ID_String, Decimal_Hexa(Complete_Stream->transport_stream_id), true); } if (!Complete_Stream->network_name.empty()) { Fill(Stream_General, 0, General_NetworkName, Complete_Stream->network_name, true); Complete_Stream->network_name.clear(); } if (!Complete_Stream->original_network_name.empty()) { Fill(Stream_General, 0, General_OriginalNetworkName, Complete_Stream->original_network_name, true); Complete_Stream->original_network_name.clear(); } Ztring Countries; Ztring TimeZones; for (std::map::iterator TimeZone=Complete_Stream->TimeZones.begin(); TimeZone!=Complete_Stream->TimeZones.end(); ++TimeZone) { Countries+=TimeZone->first+__T(" / "); TimeZones+=TimeZone->second+__T(" / "); } if (!Countries.empty()) { Countries.resize(Countries.size()-3); Fill(Stream_General, 0, General_Country, Countries, true); Complete_Stream->TimeZones.clear(); } if (!TimeZones.empty()) { TimeZones.resize(TimeZones.size()-3); Fill(Stream_General, 0, General_TimeZone, TimeZones, true); Complete_Stream->TimeZones.clear(); } if (!Complete_Stream->Duration_Start.empty()) { Fill(Stream_General, 0, General_Duration_Start, Complete_Stream->Duration_Start, true); Complete_Stream->Duration_Start.clear(); } complete_stream::transport_streams::iterator Transport_Stream=Complete_Stream->transport_stream_id_IsValid?Complete_Stream->Transport_Streams.find(Complete_Stream->transport_stream_id):Complete_Stream->Transport_Streams.end(); if (Transport_Stream!=Complete_Stream->Transport_Streams.end()) { //TS info for (std::map::iterator Info=Transport_Stream->second.Infos.begin(); Info!=Transport_Stream->second.Infos.end(); ++Info) Fill(Stream_General, 0, Info->first.c_str(), Info->second, true); Transport_Stream->second.Infos.clear(); //Per source (ATSC) if (Transport_Stream->second.source_id_IsValid) { complete_stream::sources::iterator Source=Complete_Stream->Sources.find(Transport_Stream->second.source_id); if (Source!=Complete_Stream->Sources.end()) { if (!Source->second.texts.empty()) { Ztring Texts; for (std::map::iterator text=Source->second.texts.begin(); text!=Source->second.texts.end(); ++text) Texts+=text->second+__T(" - "); if (!Texts.empty()) Texts.resize(Texts.size()-3); Fill(Stream_General, 0, General_ServiceProvider, Texts); } } } //Per program for (complete_stream::transport_stream::programs::iterator Program=Transport_Stream->second.Programs.begin(); Program!=Transport_Stream->second.Programs.end(); ++Program) { if (Program->second.IsParsed) { //Per pid Ztring Languages, Codecs, Formats, StreamKinds, StreamPoss, elementary_PIDs, elementary_PIDs_String, Delay, LawRating; for (size_t Pos=0; Possecond.elementary_PIDs.size(); Pos++) { int16u elementary_PID=Program->second.elementary_PIDs[Pos]; if (PerStream_AlwaysParse || Complete_Stream->Streams[elementary_PID]->IsRegistered) { Ztring Format=Retrieve(Complete_Stream->Streams[elementary_PID]->StreamKind, Complete_Stream->Streams[elementary_PID]->StreamPos, Fill_Parameter(Complete_Stream->Streams[elementary_PID]->StreamKind, Generic_Format)); if (Format.empty()) Format=Mpeg_Psi_stream_type_Format(Complete_Stream->Streams[elementary_PID]->stream_type, Program->second.registration_format_identifier); if (Format.empty()) { std::map::iterator Format_FromInfo=Complete_Stream->Streams[elementary_PID]->Infos.find("Format"); if (Format_FromInfo!=Complete_Stream->Streams[elementary_PID]->Infos.end()) Format=Format_FromInfo->second; } if (Format.empty()) Program->second.HasNotDisplayableStreams=true; Formats+=Format+__T(" / "); Codecs+=Retrieve(Complete_Stream->Streams[elementary_PID]->StreamKind, Complete_Stream->Streams[elementary_PID]->StreamPos, Fill_Parameter(Complete_Stream->Streams[elementary_PID]->StreamKind, Generic_Codec))+__T(" / "); if (Complete_Stream->Streams[elementary_PID]->StreamKind!=Stream_Max) { StreamKinds+=Ztring::ToZtring(Complete_Stream->Streams[elementary_PID]->StreamKind); StreamPoss+=Ztring::ToZtring(Complete_Stream->Streams[elementary_PID]->StreamPos); } StreamKinds+=__T(" / "); StreamPoss+=__T(" / "); elementary_PIDs+=Ztring::ToZtring(elementary_PID)+__T(" / "); Ztring Language=Retrieve(Complete_Stream->Streams[elementary_PID]->StreamKind, Complete_Stream->Streams[elementary_PID]->StreamPos, "Language/String"); Languages+=Language+__T(" / "); Ztring List_String=Decimal_Hexa(elementary_PID); List_String+=__T(" ("); List_String+=Format; if (!Language.empty()) { List_String+=__T(", "); List_String+=Language; } List_String+=__T(")"); elementary_PIDs_String+=List_String+__T(" / "); if (Complete_Stream->Streams[elementary_PID]->IsPCR) { Delay=Ztring::ToZtring(((float64)Complete_Stream->Streams[elementary_PID]->TimeStamp_Start)/27000, 6); } //Law rating if (Complete_Stream->Streams[elementary_PID] && Complete_Stream->Streams[elementary_PID]->Parser) { Ztring LawRating_Temp=Complete_Stream->Streams[elementary_PID]->Parser->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating_Temp.empty()) LawRating+=LawRating_Temp+__T(" / ");; } } } if (Program->second.Update_Needed_Info || Program->second.Update_Needed_IsRegistered || Program->second.Update_Needed_StreamCount || Program->second.Update_Needed_StreamPos) { if (!Transport_Stream->second.Programs.empty() && (Transport_Stream->second.Programs.size()>1 || Transport_Stream->second.Programs.begin()->second.HasNotDisplayableStreams || !Transport_Stream->second.Programs.begin()->second.Infos.empty() || !Transport_Stream->second.Programs.begin()->second.DVB_EPG_Blocks.empty() || (Transport_Stream->second.Programs.begin()->second.source_id_IsValid && Complete_Stream->Sources.find(Transport_Stream->second.Programs.begin()->second.source_id)!=Complete_Stream->Sources.end()) || Config->File_MpegTs_ForceMenu_Get())) { if (Program->second.StreamPos==(size_t)-1) { size_t StreamPos=(size_t)-1; for (size_t program_number=0; program_numberprogram_number_Order.size(); program_number++) if (Program->firstprogram_number_Order[program_number]) { StreamPos=program_number; for (size_t program_number2=program_number; program_number2program_number_Order.size(); program_number2++) Transport_Stream->second.Programs[Complete_Stream->program_number_Order[program_number2]].StreamPos++; Complete_Stream->program_number_Order.insert(Complete_Stream->program_number_Order.begin()+program_number, Program->first); break; } if (StreamPos==(size_t)-1) { Complete_Stream->program_number_Order.push_back(Program->first); } Stream_Prepare(Stream_Menu, StreamPos); Program->second.StreamPos=StreamPos_Last; } else StreamPos_Last=Program->second.StreamPos; Fill(Stream_Menu, StreamPos_Last, Menu_ID, Program->second.pid, 10, true); Fill(Stream_Menu, StreamPos_Last, Menu_ID_String, Decimal_Hexa(Program->second.pid), true); Fill(Stream_Menu, StreamPos_Last, Menu_MenuID, Program->first, 10, true); Fill(Stream_Menu, StreamPos_Last, Menu_MenuID_String, Decimal_Hexa(Program->first), true); Clear(Stream_Menu, StreamPos_Last, General_StreamOrder); for (size_t programs_List_Pos=0; programs_List_Possecond.programs_List.size(); ++programs_List_Pos) if (Transport_Stream->second.programs_List[programs_List_Pos]==Program->first) Fill(Stream_Menu, StreamPos_Last, General_StreamOrder, programs_List_Pos); for (std::map::iterator Info=Program->second.Infos.begin(); Info!=Program->second.Infos.end(); ++Info) Fill(Stream_Menu, StreamPos_Last, Info->first.c_str(), Info->second, true); Program->second.Infos.clear(); for (std::map::iterator Info=Program->second.ExtraInfos_Content.begin(); Info!=Program->second.ExtraInfos_Content.end(); ++Info) Fill(Stream_Menu, StreamPos_Last, Info->first.c_str(), Info->second, true); Program->second.ExtraInfos_Content.clear(); for (std::map::iterator Info=Program->second.ExtraInfos_Option.begin(); Info!=Program->second.ExtraInfos_Option.end(); ++Info) (*Stream_More)[Stream_Menu][StreamPos_Last](Ztring().From_Local(Info->first.c_str()), Info_Options)=Info->second; Program->second.ExtraInfos_Option.clear(); if (!Formats.empty()) Formats.resize(Formats.size()-3); Fill(Stream_Menu, StreamPos_Last, Menu_Format, Formats, true); if (!Codecs.empty()) Codecs.resize(Codecs.size()-3); Fill(Stream_Menu, StreamPos_Last, Menu_Codec, Codecs, true); if (!StreamKinds.empty()) StreamKinds.resize(StreamKinds.size()-3); Fill(Stream_Menu, StreamPos_Last, Menu_List_StreamKind, StreamKinds, true); if (!elementary_PIDs_String.empty()) elementary_PIDs_String.resize(elementary_PIDs_String.size()-3); Fill(Stream_Menu, StreamPos_Last, Menu_List_String, elementary_PIDs_String, true); if (!elementary_PIDs.empty()) elementary_PIDs.resize(elementary_PIDs.size()-3); Fill(Stream_Menu, StreamPos_Last, Menu_List, elementary_PIDs, true); if (!StreamPoss.empty()) StreamPoss.resize(StreamPoss.size()-3); Fill(Stream_Menu, StreamPos_Last, Menu_List_StreamPos, StreamPoss, true); if (!Languages.empty()) Languages.resize(Languages.size()-3); Fill(Stream_Menu, StreamPos_Last, Menu_Language, Languages, true); if (!LawRating.empty()) LawRating.resize(LawRating.size()-3); Fill(Stream_Menu, StreamPos_Last, "LawRating", LawRating, true); if (!LawRating.empty() && StreamPos_Last) Clear(Stream_General, 0, General_LawRating); //More than 1 menu, can not be in General part } } //Delay if (Program->second.Update_Needed_IsRegistered) { switch (Count_Get(Stream_Menu)) { case 0 : Fill(Stream_General, 0, General_Delay, Delay, true); break; default: Fill(Stream_Menu, StreamPos_Last, Menu_Delay, Delay, true); break; } Program->second.Update_Needed_IsRegistered=false; } if (Count_Get(Stream_Menu)==2) Clear(Stream_General, 0, General_Delay); //Not valid, multiple menus } } } //Commercial name if (Count_Get(Stream_Video)==1 && Count_Get(Stream_Audio)==1 && Retrieve(Stream_Video, 0, Video_Format)==__T("MPEG Video") && Retrieve(Stream_Video, 0, Video_Format_Commercial_IfAny).find(__T("HDV"))==0 && Retrieve(Stream_Audio, 0, Audio_Format)==__T("MPEG Audio") && Retrieve(Stream_Audio, 0, Audio_Format_Version)==__T("Version 1") && Retrieve(Stream_Audio, 0, Audio_Format_Profile)==__T("Layer 2") && Retrieve(Stream_Audio, 0, Audio_BitRate)==__T("384000")) Fill(Stream_General, 0, General_Format_Commercial_IfAny, Retrieve(Stream_Video, 0, Video_Format_Commercial_IfAny)); } //--------------------------------------------------------------------------- void File_MpegTs::Streams_Update_Programs_PerStream(size_t StreamID) { complete_stream::stream* Temp=Complete_Stream->Streams[StreamID]; //No direct handling of Sub streams; if (Temp->stream_type==0x20 && Temp->SubStream_pid) //Stereoscopic is not alone return; if (Temp->Parser) Temp->Parser->Open_Buffer_Update(); //Merging from a previous merge size_t Count; if (Temp->StreamKind!=Stream_Max) { Count=1; //TODO: more than 1 Merge(*Temp->Parser, Temp->StreamKind, 0, Temp->StreamPos); StreamKind_Last=Temp->StreamKind; StreamPos_Last=Temp->StreamPos; } else { //By the parser StreamKind_Last=Stream_Max; Count=0; if (Temp->Parser && Temp->Parser->Status[IsAccepted]) { if (Temp->SubStream_pid!=0x0000) //With a substream Fill(Complete_Stream->Streams[Temp->SubStream_pid]->Parser); if (Temp->Parser->Count_Get(Stream_Video) && Temp->Parser->Count_Get(Stream_Text)) { //Special case: Video and Text are together Stream_Prepare(Stream_Video); Count=Merge(*Temp->Parser, Stream_Video, 0, StreamPos_Last); } else Count=Merge(*Temp->Parser); //More from the FMC parser if (Temp->FMC_ES_ID_IsValid) { complete_stream::transport_stream::iod_ess::iterator IOD_ES=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].IOD_ESs.find(Temp->FMC_ES_ID); if (IOD_ES!=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].IOD_ESs.end() && IOD_ES->second.Parser) { Finish(IOD_ES->second.Parser); Count=Merge(*IOD_ES->second.Parser, StreamKind_Last, StreamPos_Last, 0); } } //LATM complete_stream::transport_stream::iod_ess::iterator IOD_ES=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].IOD_ESs.find(Complete_Stream->Streams[StreamID]->FMC_ES_ID); #ifdef MEDIAINFO_MPEG4_YES if (IOD_ES!=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].IOD_ESs.end() && IOD_ES->second.SLConfig && Retrieve(Stream_Audio, StreamPos_Last, Audio_MuxingMode).empty()) Fill(Stream_Audio, StreamPos_Last, Audio_MuxingMode, "SL"); #endif if (Complete_Stream->Streams[StreamID]->stream_type==0x11 && Retrieve(Stream_Audio, StreamPos_Last, Audio_MuxingMode).empty()) Fill(Stream_Audio, StreamPos_Last, Audio_MuxingMode, "LATM"); } //By the descriptors if (StreamKind_Last==Stream_Max && Complete_Stream->transport_stream_id_IsValid && !Temp->program_numbers.empty() && !Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs.empty()) { int32u format_identifier=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Temp->program_numbers[0]].registration_format_identifier; if (Temp->IsRegistered && Mpeg_Descriptors_registration_format_identifier_StreamKind(format_identifier)!=Stream_Max) { StreamKind_Last=Mpeg_Descriptors_registration_format_identifier_StreamKind(format_identifier); Stream_Prepare(StreamKind_Last); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Format), Mpeg_Descriptors_registration_format_identifier_Format(format_identifier)); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec), Mpeg_Descriptors_registration_format_identifier_Format(format_identifier)); Count=1; } } //By registration_format_identifier if (StreamKind_Last==Stream_Max && Temp->registration_format_identifier && Temp->IsRegistered && Mpeg_Descriptors_registration_format_identifier_StreamKind(Temp->registration_format_identifier)!=Stream_Max) { StreamKind_Last=Mpeg_Descriptors_registration_format_identifier_StreamKind(Temp->registration_format_identifier); Stream_Prepare(StreamKind_Last); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Format), Mpeg_Descriptors_registration_format_identifier_Format(Temp->registration_format_identifier)); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec), Mpeg_Descriptors_registration_format_identifier_Format(Temp->registration_format_identifier)); Count=1; } //By the stream_type if (StreamKind_Last==Stream_Max && Complete_Stream->transport_stream_id_IsValid && !Temp->program_numbers.empty() && !Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs.empty()) { int32u format_identifier=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Temp->program_numbers[0]].registration_format_identifier; if (Mpeg_Psi_stream_type_StreamKind(Temp->stream_type, format_identifier)!=Stream_Max && (Temp->IsRegistered || ForceStreamDisplay || format_identifier==Elements::HDMV)) { StreamKind_Last=Mpeg_Psi_stream_type_StreamKind(Temp->stream_type, format_identifier); if (StreamKind_Last==Stream_General && Temp->Parser) //Only information, no streams { Merge (*Temp->Parser, Stream_General, 0, 0); StreamKind_Last=Stream_Max; } Stream_Prepare(StreamKind_Last); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Format), Mpeg_Psi_stream_type_Format(Temp->stream_type, format_identifier)); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec), Mpeg_Psi_stream_type_Codec(Temp->stream_type, format_identifier)); Count=1; } } //By the StreamKind if (StreamKind_Last==Stream_Max && Temp->StreamKind_FromDescriptor!=Stream_Max && (Temp->IsRegistered || ForceStreamDisplay || (!Temp->program_numbers.empty() && Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Temp->program_numbers[0]].registration_format_identifier==Elements::HDMV))) { Stream_Prepare(Temp->StreamKind_FromDescriptor); Count=1; } } //More info if (StreamKind_Last!=Stream_Max) { for (size_t StreamPos=StreamPos_Last+1-Count; StreamPos<=StreamPos_Last; StreamPos++) { Temp->StreamKind=StreamKind_Last; Temp->StreamPos=StreamPos; //Encryption if (Temp->CA_system_ID) Fill(StreamKind_Last, StreamPos, "Encryption", Mpeg_Descriptors_CA_system_ID(Temp->CA_system_ID)); else if (Temp->IsScrambled>16) Fill(StreamKind_Last, StreamPos, "Encryption", "Encrypted"); //TS info for (std::map::iterator Info=Temp->Infos.begin(); Info!=Temp->Infos.end(); ++Info) { if (Retrieve(StreamKind_Last, StreamPos, Info->first.c_str()).empty()) Fill(StreamKind_Last, StreamPos, Info->first.c_str(), Info->second, true); } Temp->Infos.clear(); for (std::map::iterator Info=Temp->Infos_Option.begin(); Info!=Temp->Infos_Option.end(); ++Info) (*Stream_More)[StreamKind_Last][StreamPos](Ztring().From_Local(Info->first.c_str()), Info_Options)=Info->second; Temp->Infos_Option.clear(); //Common if (Temp->SubStream_pid!=0x0000) //Wit a substream { Ztring Format_Profile=Retrieve(Stream_Video, StreamPos, Video_Format_Profile); Fill(Stream_Video, StreamPos, Video_ID, Ztring::ToZtring(Temp->SubStream_pid)+__T(" / ")+Ztring::ToZtring(StreamID), true); Fill(Stream_Video, StreamPos, Video_ID_String, Decimal_Hexa(Temp->SubStream_pid)+__T(" / ")+Decimal_Hexa(StreamID), true); if (!Format_Profile.empty() && Complete_Stream->Streams[Temp->SubStream_pid] && Complete_Stream->Streams[Temp->SubStream_pid]->Parser) Fill(Stream_Video, StreamPos, Video_Format_Profile, Complete_Stream->Streams[Temp->SubStream_pid]->Parser->Retrieve(Stream_Video, 0, Video_Format_Profile)+__T(" / ")+Format_Profile, true); } else if (Count>1 || (StreamKind_Last==Stream_Text && Retrieve(StreamKind_Last, StreamPos, General_ID).find(__T('-'))!=string::npos)) { Ztring ID=Retrieve(StreamKind_Last, StreamPos, General_ID); size_t ID_Pos=ID.find(__T('-')); if (ID_Pos!=string::npos) ID.erase(ID.begin(), ID.begin()+ID_Pos+1); //Removing the PS part Ztring ID_String=Retrieve(StreamKind_Last, StreamPos, General_ID_String); size_t ID_String_Pos=ID_String.find(__T('-')); if (ID_String_Pos!=string::npos) ID_String.erase(ID_String.begin(), ID_String.begin()+ID_String_Pos+1); //Removing the PS part #ifdef MEDIAINFO_ARIBSTDB24B37_YES if (FromAribStdB24B37) { Fill(StreamKind_Last, StreamPos, General_ID, ID, true); Fill(StreamKind_Last, StreamPos, General_ID_String, ID_String, true); } else #endif //MEDIAINFO_ARIBSTDB24B37_YES { Fill(StreamKind_Last, StreamPos, General_ID, Ztring::ToZtring(StreamID)+__T('-')+ID, true); Fill(StreamKind_Last, StreamPos, General_ID_String, Decimal_Hexa(StreamID)+__T('-')+ID_String, true); } } else { Fill(StreamKind_Last, StreamPos, General_ID, StreamID, 10, true); Fill(StreamKind_Last, StreamPos, General_ID_String, Decimal_Hexa(StreamID), true); } for (size_t Pos=0; Posprogram_numbers.size(); Pos++) { Fill(StreamKind_Last, StreamPos, General_MenuID, Temp->program_numbers[Pos], 10, Pos==0); Fill(StreamKind_Last, StreamPos, General_MenuID_String, Decimal_Hexa(Temp->program_numbers[Pos]), Pos==0); } //StreamOrder Clear(StreamKind_Last, StreamPos, General_StreamOrder); for (size_t program_FromStream=0; program_FromStreamprogram_numbers.size(); ++program_FromStream) { int16u program_number=Temp->program_numbers[program_FromStream]; std::vector &programs_List=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].programs_List; size_t programs_List_Pos=0; for (; programs_List_PosTransport_Streams[Complete_Stream->transport_stream_id].Programs[program_number]; for (size_t elementary_PID_Pos=0; elementary_PID_PosParser && Temp->Parser->Count_Get(Stream_Text)) { } } //Special cases if (Temp->Parser && Temp->Parser->Count_Get(Stream_Video)) { //Video and Text may be together //Retrieving IDs int16u ID_Video=Retrieve(Stream_Video, StreamPos_Last, Text_ID).To_int16u(); //Language std::map Eia708_Languages; //Key is caption_service_number Eia708_Languages.insert(Temp->Eia708_Languages.begin(), Temp->Eia708_Languages.end()); //708 from video descriptor bool Eia608_FromDescriptor=Temp->Eia608_IsPresent; for (size_t ProgramPos=0; ProgramPosStreams[ID_Video]->program_numbers.size(); ProgramPos++) { //608 from program descriptor if (!Eia608_FromDescriptor) Eia608_FromDescriptor=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Complete_Stream->Streams[ID_Video]->program_numbers[ProgramPos]].Eia608_IsPresent; //708 from program descriptor Eia708_Languages.insert(Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Complete_Stream->Streams[ID_Video]->program_numbers[ProgramPos]].Eia708_Languages.begin(), Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Complete_Stream->Streams[ID_Video]->program_numbers[ProgramPos]].Eia708_Languages.end()); //608/708 from ATSC EIT if (Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Complete_Stream->Streams[ID_Video]->program_numbers[ProgramPos]].source_id_IsValid) { int16u source_id=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Complete_Stream->Streams[ID_Video]->program_numbers[ProgramPos]].source_id; complete_stream::sources::iterator Source=Complete_Stream->Sources.find(source_id); if (Source!=Complete_Stream->Sources.end()) for (complete_stream::source::atsc_epg_blocks::iterator ATSC_EPG_Block=Source->second.ATSC_EPG_Blocks.begin(); ATSC_EPG_Block!=Source->second.ATSC_EPG_Blocks.end(); ++ATSC_EPG_Block) for (complete_stream::source::atsc_epg_block::events::iterator Event=ATSC_EPG_Block->second.Events.begin(); Event!=ATSC_EPG_Block->second.Events.end(); ++Event) { Eia708_Languages.insert(Event->second.Eia708_Languages.begin(), Event->second.Eia708_Languages.end()); if (!Eia608_FromDescriptor) Eia608_FromDescriptor=Event->second.Eia608_IsPresent; } } } size_t Text_Count=Temp->Parser->Count_Get(Stream_Text); bool Eia608_IsPresent=false; for (size_t Text_Pos=0; Text_PosParser->Retrieve(Stream_Text, Text_Pos, Text_ID); if (Parser_ID.find(__T('-'))!=string::npos) Parser_ID.erase(Parser_ID.begin(), Parser_ID.begin()+Parser_ID.find(__T('-'))+1); Ztring ID=Retrieve(Stream_Video, Temp->StreamPos, Video_ID)+__T('-')+Parser_ID; Ztring ID_String=Retrieve(Stream_Video, Temp->StreamPos, Video_ID_String)+__T('-')+Parser_ID; StreamPos_Last=(size_t)-1; for (size_t Pos=0; PosParser->Retrieve(Stream_Text, Text_Pos, "MuxingMode")) { StreamPos_Last=Pos; break; } if (StreamPos_Last==(size_t)-1) Stream_Prepare(Stream_Text, StreamPos_Last); if (!IsSub) Fill(Stream_Text, StreamPos_Last, "MuxingMode_MoreInfo", __T("Muxed in Video #")+Ztring().From_Number(Temp->StreamPos+1), true); Merge(*Temp->Parser, Stream_Text, Text_Pos, StreamPos_Last); Fill(Stream_Text, StreamPos_Last, Text_ID, ID, true); Fill(Stream_Text, StreamPos_Last, Text_ID_String, ID_String, true); Fill(Stream_Text, StreamPos_Last, General_StreamOrder, Retrieve(Stream_Video, Temp->StreamPos, General_StreamOrder), true); Fill(Stream_Text, StreamPos_Last, Text_MenuID, Retrieve(Stream_Video, Temp->StreamPos, Video_MenuID), true); Fill(Stream_Text, StreamPos_Last, Text_MenuID_String, Retrieve(Stream_Video, Temp->StreamPos, Video_MenuID_String), true); Fill(Stream_Text, StreamPos_Last, Text_Duration, Retrieve(Stream_Video, Temp->StreamPos, Video_Duration), true); Fill(Stream_Text, StreamPos_Last, Text_Delay, Retrieve(Stream_Video, Temp->StreamPos, Video_Delay), true); Fill(Stream_Text, StreamPos_Last, Text_Delay_Source, Retrieve(Stream_Video, Temp->StreamPos, Video_Delay_Source), true); if (Retrieve(Stream_Text, StreamPos_Last, Text_Format).find(__T("EIA-708"))!=string::npos && Retrieve(Stream_Text, StreamPos_Last, Text_Language).empty()) { Ztring ID_Complete=Retrieve(Stream_Text, StreamPos_Last, Text_ID); int8u ID_Text=Ztring(ID_Complete.substr(ID_Complete.rfind(__T('-'))+1, string::npos)).To_int8u(); std::map::iterator Language=Eia708_Languages.find(ID_Text); if (Language!=Eia708_Languages.end()) { Fill(Stream_Text, StreamPos_Last, Text_Language, Language->second); Eia708_Languages.erase(Language); } } if (Retrieve(Stream_Text, StreamPos_Last, Text_Format).find(__T("EIA-608"))!=string::npos) Eia608_IsPresent=true; } //Undetected text streams but present is service_descriptor - 608 if (Eia608_FromDescriptor && !Eia608_IsPresent) { Ztring ID=Retrieve(Stream_Video, Temp->StreamPos, Video_ID)+__T("-608"); Ztring ID_String=Retrieve(Stream_Video, Temp->StreamPos, Video_ID_String)+__T("-608"); StreamPos_Last=(size_t)-1; for (size_t Pos=0; PosStreamPos+1), true); Fill(Stream_Text, StreamPos_Last, Text_ID, ID, true); Fill(Stream_Text, StreamPos_Last, Text_ID_String, ID_String, true); Fill(Stream_Text, StreamPos_Last, General_StreamOrder, Retrieve(Stream_Video, Temp->StreamPos, General_StreamOrder), true); Fill(Stream_Text, StreamPos_Last, Text_MenuID, Retrieve(Stream_Video, Temp->StreamPos, Video_MenuID), true); Fill(Stream_Text, StreamPos_Last, Text_MenuID_String, Retrieve(Stream_Video, Temp->StreamPos, Video_MenuID_String), true); Fill(Stream_Text, StreamPos_Last, Text_Duration, Retrieve(Stream_Video, Temp->StreamPos, Video_Duration), true); Fill(Stream_Text, StreamPos_Last, Text_Delay, Retrieve(Stream_Video, Temp->StreamPos, Video_Delay), true); Fill(Stream_Text, StreamPos_Last, Text_Delay_Source, Retrieve(Stream_Video, Temp->StreamPos, Video_Delay_Source), true); } //Undetected text streams but present is service_descriptor - 708 for (std::map::iterator Language=Eia708_Languages.begin(); Language!=Eia708_Languages.end(); ++Language) { //TODO: merge both methods (see above) Ztring Parser_ID=Ztring::ToZtring(Language->first); Ztring ID=Retrieve(Stream_Video, Temp->StreamPos, Video_ID)+__T('-')+Parser_ID; Ztring ID_String=Retrieve(Stream_Video, Temp->StreamPos, Video_ID_String)+__T('-')+Parser_ID; StreamPos_Last=(size_t)-1; for (size_t Pos=0; Posfirst); //TODO: put this in File_Eia708 Fill(Stream_Text, StreamPos_Last, Text_Format, "EIA-708"); Fill(Stream_Text, StreamPos_Last, Text_StreamSize, 0); Fill(Stream_Text, StreamPos_Last, Text_BitRate_Mode, "CBR"); Fill(Stream_Text, StreamPos_Last, "MuxingMode", __T("A/53 / DTVCC Transport")); } if (!IsSub) Fill(Stream_Text, StreamPos_Last, "MuxingMode_MoreInfo", __T("Muxed in Video #")+Ztring().From_Number(Temp->StreamPos+1), true); Fill(Stream_Text, StreamPos_Last, Text_ID, ID, true); Fill(Stream_Text, StreamPos_Last, Text_ID_String, ID_String, true); Fill(Stream_Text, StreamPos_Last, General_StreamOrder, Retrieve(Stream_Video, Temp->StreamPos, General_StreamOrder), true); Fill(Stream_Text, StreamPos_Last, Text_MenuID, Retrieve(Stream_Video, Temp->StreamPos, Video_MenuID), true); Fill(Stream_Text, StreamPos_Last, Text_MenuID_String, Retrieve(Stream_Video, Temp->StreamPos, Video_MenuID_String), true); Fill(Stream_Text, StreamPos_Last, Text_Duration, Retrieve(Stream_Video, Temp->StreamPos, Video_Duration), true); Fill(Stream_Text, StreamPos_Last, Text_Delay, Retrieve(Stream_Video, Temp->StreamPos, Video_Delay), true); Fill(Stream_Text, StreamPos_Last, Text_Delay_Source, Retrieve(Stream_Video, Temp->StreamPos, Video_Delay_Source), true); //Language Fill(Stream_Text, StreamPos_Last, Text_Language, Language->second); } StreamKind_Last=Temp->StreamKind; StreamPos_Last=Temp->StreamPos; } } //Teletext if (StreamKind_Last==Stream_Max) { for (std::map::iterator Teletext=Temp->Teletexts.begin(); Teletext!=Temp->Teletexts.end(); ++Teletext) { Stream_Prepare(Stream_Text); Fill(StreamKind_Last, StreamPos_Last, General_ID, Ztring::ToZtring(StreamID)+__T('-')+Ztring::ToZtring(Teletext->first), true); Fill(StreamKind_Last, StreamPos_Last, General_ID_String, Decimal_Hexa(StreamID)+__T('-')+Ztring::ToZtring(Teletext->first), true); for (size_t Pos=0; Posprogram_numbers.size(); Pos++) { Fill(StreamKind_Last, StreamPos_Last, General_MenuID, Temp->program_numbers[Pos], 10, Pos==0); Fill(StreamKind_Last, StreamPos_Last, General_MenuID_String, Decimal_Hexa(Temp->program_numbers[Pos]), Pos==0); } //TS info for (std::map::iterator Info=Teletext->second.Infos.begin(); Info!=Teletext->second.Infos.end(); ++Info) { if (Retrieve(StreamKind_Last, StreamPos_Last, Info->first.c_str()).empty()) Fill(StreamKind_Last, StreamPos_Last, Info->first.c_str(), Info->second); } Teletext->second.Infos.clear(); } } //Law rating if (Temp->Parser) { Ztring LawRating=Temp->Parser->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) { if (Count_Get(Stream_Menu)) { Ztring MenuID=Retrieve(Temp->StreamKind, Temp->StreamPos, General_MenuID); for (size_t Pos=0; Postransport_stream_id_IsValid?Complete_Stream->Transport_Streams.find(Complete_Stream->transport_stream_id):Complete_Stream->Transport_Streams.end(); if (Transport_Stream==Complete_Stream->Transport_Streams.end()) return; //Per source (ATSC) if (Transport_Stream->second.source_id_IsValid) { complete_stream::sources::iterator Source=Complete_Stream->Sources.find(Transport_Stream->second.source_id); if (Source!=Complete_Stream->Sources.end()) { //EPG std::map EPGs; for (complete_stream::source::atsc_epg_blocks::iterator ATSC_EPG_Block=Source->second.ATSC_EPG_Blocks.begin(); ATSC_EPG_Block!=Source->second.ATSC_EPG_Blocks.end(); ++ATSC_EPG_Block) for (complete_stream::source::atsc_epg_block::events::iterator Event=ATSC_EPG_Block->second.Events.begin(); Event!=ATSC_EPG_Block->second.Events.end(); ++Event) { Ztring Texts; for (std::map::iterator text=Event->second.texts.begin(); text!=Event->second.texts.end(); ++text) Texts+=text->second+__T(" - "); if (!Texts.empty()) Texts.resize(Texts.size()-3); EPGs[Ztring().Date_From_Seconds_1970(Event->second.start_time+315964800-Complete_Stream->GPS_UTC_offset)]=Event->second.title+__T(" / ")+Texts+__T(" / / / ")+Event->second.duration+__T(" / "); } if (!EPGs.empty()) { //Trashing old EPG size_t Begin=Retrieve(Stream_General, 0, General_EPG_Positions_Begin).To_int32u(); size_t End=Retrieve(Stream_General, 0, General_EPG_Positions_End).To_int32u(); if (Begin && End && Begin=Begin; Pos--) Clear(Stream_General, 0, Pos); //Filling Fill(Stream_General, 0, General_EPG_Positions_Begin, Count_Get(Stream_General, 0), 10, true); for (std::map::iterator EPG=EPGs.begin(); EPG!=EPGs.end(); ++EPG) Fill(Stream_General, 0, EPG->first.To_Local().c_str(), EPG->second, true); Fill(Stream_General, 0, General_EPG_Positions_End, Count_Get(Stream_General, 0), 10, true); } } } //Per program if (!Transport_Stream->second.Programs.empty() && (Transport_Stream->second.Programs.size()>1 || !Transport_Stream->second.Programs.begin()->second.Infos.empty() || !Transport_Stream->second.Programs.begin()->second.DVB_EPG_Blocks.empty() || Complete_Stream->Sources.find(Transport_Stream->second.Programs.begin()->second.source_id)!=Complete_Stream->Sources.end() || Config->File_MpegTs_ForceMenu_Get())) for (complete_stream::transport_stream::programs::iterator Program=Transport_Stream->second.Programs.begin(); Program!=Transport_Stream->second.Programs.end(); ++Program) { if (Program->second.IsParsed) { bool EPGs_IsUpdated=false; std::map EPGs; //EPG - DVB if (Program->second.DVB_EPG_Blocks_IsUpdated) { for (complete_stream::transport_stream::program::dvb_epg_blocks::iterator DVB_EPG_Block=Program->second.DVB_EPG_Blocks.begin(); DVB_EPG_Block!=Program->second.DVB_EPG_Blocks.end(); ++DVB_EPG_Block) for (complete_stream::transport_stream::program::dvb_epg_block::events::iterator Event=DVB_EPG_Block->second.Events.begin(); Event!=DVB_EPG_Block->second.Events.end(); ++Event) if (EPGs.find(Event->second.start_time)==EPGs.end() || DVB_EPG_Block->first==0x4E) //Does not exist or "DVB - event_information_section - actual_transport_stream : return present/following" EPGs[Event->second.start_time]=Event->second.short_event.event_name+__T(" / ")+Event->second.short_event.text+__T(" / ")+Event->second.content+__T(" / / ")+Event->second.duration+__T(" / ")+Event->second.running_status; Program->second.DVB_EPG_Blocks_IsUpdated=false; EPGs_IsUpdated=true; } //EPG - ATSC if (Program->second.source_id_IsValid) { complete_stream::sources::iterator Source=Complete_Stream->Sources.find(Program->second.source_id); if (Source!=Complete_Stream->Sources.end()) { if (!Source->second.texts.empty()) { Ztring Texts; for (std::map::iterator text=Source->second.texts.begin(); text!=Source->second.texts.end(); ++text) Texts+=text->second+__T(" - "); if (!Texts.empty()) Texts.resize(Texts.size()-3); if (Program->second.StreamPos==(size_t)-1) { Complete_Stream->program_number_Order.push_back(Program->first); Stream_Prepare(Stream_Menu); Program->second.StreamPos=StreamPos_Last; } Fill(Stream_Menu, Program->second.StreamPos, Menu_ServiceProvider, Texts, true); } if (Source->second.ATSC_EPG_Blocks_IsUpdated) { for (complete_stream::source::atsc_epg_blocks::iterator ATSC_EPG_Block=Source->second.ATSC_EPG_Blocks.begin(); ATSC_EPG_Block!=Source->second.ATSC_EPG_Blocks.end(); ++ATSC_EPG_Block) for (complete_stream::source::atsc_epg_block::events::iterator Event=ATSC_EPG_Block->second.Events.begin(); Event!=ATSC_EPG_Block->second.Events.end(); ++Event) if (Event->second.start_time!=(int32u)-1) //TODO: find the reason when start_time is not set { Ztring Texts; for (std::map::iterator text=Event->second.texts.begin(); text!=Event->second.texts.end(); ++text) Texts+=text->second+__T(" - "); if (!Texts.empty()) Texts.resize(Texts.size()-3); EPGs[Ztring().Date_From_Seconds_1970(Event->second.start_time+315964800-Complete_Stream->GPS_UTC_offset)]=Event->second.title+__T(" / ")+Texts+__T(" / / / ")+Event->second.duration+__T(" / "); } Source->second.ATSC_EPG_Blocks_IsUpdated=false; EPGs_IsUpdated=true; } } } //EPG - Filling if (EPGs_IsUpdated) { if (Program->second.StreamPos==(size_t)-1) { Complete_Stream->program_number_Order.push_back(Program->first); Stream_Prepare(Stream_Menu); Program->second.StreamPos=StreamPos_Last; } Program->second.EPGs=EPGs; Streams_Update_EPG_PerProgram(Program); } } } Complete_Stream->Sources_IsUpdated=false; Complete_Stream->Programs_IsUpdated=false; } //--------------------------------------------------------------------------- void File_MpegTs::Streams_Update_EPG_PerProgram(complete_stream::transport_stream::programs::iterator Program) { size_t Chapters_Pos_Begin=Retrieve(Stream_Menu, Program->second.StreamPos, Menu_Chapters_Pos_Begin).To_int32u(); size_t Chapters_Pos_End=Retrieve(Stream_Menu, Program->second.StreamPos, Menu_Chapters_Pos_End).To_int32u(); if (Chapters_Pos_Begin && Chapters_Pos_End) { for (size_t Pos=Chapters_Pos_End-1; Pos>=Chapters_Pos_Begin; Pos--) Clear(Stream_Menu, Program->second.StreamPos, Pos); Clear(Stream_Menu, Program->second.StreamPos, Menu_Chapters_Pos_Begin); Clear(Stream_Menu, Program->second.StreamPos, Menu_Chapters_Pos_End); } if (!Program->second.EPGs.empty()) { Fill(Stream_Menu, Program->second.StreamPos, Menu_Chapters_Pos_Begin, Count_Get(Stream_Menu, Program->second.StreamPos), 10, true); for (std::map::iterator EPG=Program->second.EPGs.begin(); EPG!=Program->second.EPGs.end(); ++EPG) Fill(Stream_Menu, Program->second.StreamPos, EPG->first.To_UTF8().c_str(), EPG->second, true); Fill(Stream_Menu, Program->second.StreamPos, Menu_Chapters_Pos_End, Count_Get(Stream_Menu, Program->second.StreamPos), 10, true); } } //--------------------------------------------------------------------------- #ifdef MEDIAINFO_MPEGTS_PCR_YES void File_MpegTs::Streams_Update_Duration_Update() { bool IsVbr=false; bool IsCbr=false; #if MEDIAINFO_ADVANCED float64 TimeStamp_InstantaneousBitRate_Min_Raw=DBL_MAX; float64 TimeStamp_InstantaneousBitRate_Max_Raw=0; int64u TimeStamp_Distance_Min=(int64u)-1; int64u TimeStamp_Distance_Max=0; int64u TimeStamp_Distance_Total=0; int64u TimeStamp_Distance_Count=0; int64u TimeStamp_HasProblems=0; #endif // MEDIAINFO_ADVANCED for (std::map::iterator PCR_PID=Complete_Stream->PCR_PIDs.begin(); PCR_PID!=Complete_Stream->PCR_PIDs.end(); ++PCR_PID) { complete_stream::streams::iterator Stream=Complete_Stream->Streams.begin()+PCR_PID->first; if (*Stream && (*Stream)->TimeStamp_End_IsUpdated) { if ((*Stream)->TimeStamp_End<0x100000000LL*300 && (*Stream)->TimeStamp_Start>0x100000000LL*300) (*Stream)->TimeStamp_End+=0x200000000LL*300; //33 bits, cyclic if ((*Stream)->TimeStamp_Start<(*Stream)->TimeStamp_End) { int64u Duration=0; int64u Bytes=0; #if MEDIAINFO_ADVANCED if (Config->ParseSpeed>=1 && !(*Stream)->TimeStamp_Intermediate.empty()) { Duration=(*Stream)->TimeStamp_Intermediate[0]-(*Stream)->TimeStamp_Start; size_t Last=(*Stream)->TimeStamp_Intermediate.size()-1; for (size_t Pos=1; Pos+1TimeStamp_Intermediate[Pos+1]-(*Stream)->TimeStamp_Intermediate[Pos]; Duration+=(*Stream)->TimeStamp_End-(*Stream)->TimeStamp_Intermediate[Last]; } else #endif // MEDIAINFO_ADVANCED { Duration=(*Stream)->TimeStamp_End-(*Stream)->TimeStamp_Start; } Bytes=(*Stream)->TimeStamp_End_Offset-(*Stream)->TimeStamp_Start_Offset; if (Duration && Bytes) { Fill(Stream_General, 0, General_Duration, ((float64)Duration)/27000, 6, true); Fill(Stream_General, 0, General_OverallBitRate, Bytes*8/(((float64)Duration)/27000000), 0, true); } (*Stream)->TimeStamp_End_IsUpdated=false; (*Stream)->IsPCR_Duration=(float64)Duration; //Filling menu duration if (Count_Get(Stream_Menu)) { complete_stream::transport_streams::iterator Transport_Stream=Complete_Stream->transport_stream_id_IsValid?Complete_Stream->Transport_Streams.find(Complete_Stream->transport_stream_id):Complete_Stream->Transport_Streams.end(); if (Transport_Stream!=Complete_Stream->Transport_Streams.end()) { //Per program for (size_t Pos=0; Pos<(*Stream)->program_numbers.size(); Pos++) { int16u program_number=(*Stream)->program_numbers[Pos]; if (Transport_Stream->second.Programs[program_number].IsRegistered) //Only if the menu is already displayed Fill(Stream_Menu, Transport_Stream->second.Programs[program_number].StreamPos, Menu_Duration, ((float64)Duration)/27000, 6, true); } } } } if ((*Stream)->TimeStamp_InstantaneousBitRate_BitRateMode_IsVbr>=Config_VbrDetection_Occurences) IsVbr=true; if ((*Stream)->TimeStamp_InstantaneousBitRate_BitRateMode_IsCbr) IsCbr=true; #if MEDIAINFO_ADVANCED if (Config->ParseSpeed>=1) { if (TimeStamp_InstantaneousBitRate_Min_Raw>(*Stream)->TimeStamp_InstantaneousBitRate_Min_Raw) TimeStamp_InstantaneousBitRate_Min_Raw=(*Stream)->TimeStamp_InstantaneousBitRate_Min_Raw; if (TimeStamp_InstantaneousBitRate_Max_Raw<(*Stream)->TimeStamp_InstantaneousBitRate_Max_Raw) TimeStamp_InstantaneousBitRate_Max_Raw=(*Stream)->TimeStamp_InstantaneousBitRate_Max_Raw; TimeStamp_Distance_Total+=(*Stream)->TimeStamp_Distance_Total; TimeStamp_Distance_Count+=(*Stream)->TimeStamp_Distance_Count; if (TimeStamp_Distance_Min>(*Stream)->TimeStamp_Distance_Min) TimeStamp_Distance_Min=(*Stream)->TimeStamp_Distance_Min; if (TimeStamp_Distance_Max<(*Stream)->TimeStamp_Distance_Max) TimeStamp_Distance_Max=(*Stream)->TimeStamp_Distance_Max; TimeStamp_HasProblems+=(*Stream)->TimeStamp_HasProblems; } #endif // MEDIAINFO_ADVANCED } } if (IsVbr) Fill(Stream_General, 0, General_OverallBitRate_Mode, "VBR", Unlimited, true, true); else if (IsCbr) Fill(Stream_General, 0, General_OverallBitRate_Mode, "CBR", Unlimited, true, true); else Clear(Stream_General, 0, General_OverallBitRate_Mode); #if MEDIAINFO_ADVANCED if (Config->ParseSpeed>=1) { if ((IsVbr || !IsCbr) && TimeStamp_InstantaneousBitRate_Min_RawDuration_End, true); Complete_Stream->Duration_End_IsUpdated=false; } //--------------------------------------------------------------------------- void File_MpegTs::Streams_Finish() { //Per stream for (size_t StreamID=0; StreamID<0x2000; StreamID++) if (Complete_Stream->Streams[StreamID]->Parser) { if (!Complete_Stream->Streams[StreamID]->Parser->Status[IsFinished]) { int64u File_Size_Temp=File_Size; File_Size=File_Offset+Buffer_Offset+Element_Offset; Open_Buffer_Continue(Complete_Stream->Streams[StreamID]->Parser, Buffer, 0, false); File_Size=File_Size_Temp; Finish(Complete_Stream->Streams[StreamID]->Parser); #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) return; #endif //MEDIAINFO_DEMUX } } #if MEDIAINFO_DUPLICATE File__Duplicate_Streams_Finish(); #endif //MEDIAINFO_DUPLICATE #if MEDIAINFO_IBI if (!IsSub && Config_Ibi_Create) { for (ibi::streams::iterator IbiStream_Temp=Ibi.Streams.begin(); IbiStream_Temp!=Ibi.Streams.end(); ++IbiStream_Temp) { if (IbiStream_Temp->second && IbiStream_Temp->second->DtsFrequencyNumerator==1000000000 && IbiStream_Temp->second->DtsFrequencyDenominator==1) { bool IsOk=true; for (size_t Pos=0; Possecond->Infos.size(); Pos++) if (!IbiStream_Temp->second->Infos[Pos].IsContinuous && Pos+1!=IbiStream_Temp->second->Infos.size()) IsOk=false; if (IsOk) //Only is all items are continuous (partial IBI not yet supported) { IbiStream_Temp->second->DtsFrequencyNumerator=90000; for (size_t Pos=0; Possecond->Infos.size(); Pos++) { int64u Temp=IbiStream_Temp->second->Infos[Pos].Dts*90/1000000; IbiStream_Temp->second->Infos[Pos].Dts=Temp; } } } } } #endif //MEDIAINFO_IBI } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_MpegTs::Synchronize() { //Synchronizing while ( Buffer_Offset+188*16+BDAV_Size*16+TSP_Size*16<=Buffer_Size && !(Buffer[Buffer_Offset+188* 0+BDAV_Size* 1+TSP_Size* 0]==0x47 && Buffer[Buffer_Offset+188* 1+BDAV_Size* 2+TSP_Size* 1]==0x47 && Buffer[Buffer_Offset+188* 2+BDAV_Size* 3+TSP_Size* 2]==0x47 && Buffer[Buffer_Offset+188* 3+BDAV_Size* 4+TSP_Size* 3]==0x47 && Buffer[Buffer_Offset+188* 4+BDAV_Size* 5+TSP_Size* 4]==0x47 && Buffer[Buffer_Offset+188* 5+BDAV_Size* 6+TSP_Size* 5]==0x47 && Buffer[Buffer_Offset+188* 6+BDAV_Size* 7+TSP_Size* 6]==0x47 && Buffer[Buffer_Offset+188* 7+BDAV_Size* 8+TSP_Size* 7]==0x47 && Buffer[Buffer_Offset+188* 8+BDAV_Size* 9+TSP_Size* 8]==0x47 && Buffer[Buffer_Offset+188* 9+BDAV_Size*10+TSP_Size* 9]==0x47 && Buffer[Buffer_Offset+188*10+BDAV_Size*11+TSP_Size*10]==0x47 && Buffer[Buffer_Offset+188*11+BDAV_Size*12+TSP_Size*11]==0x47 && Buffer[Buffer_Offset+188*12+BDAV_Size*13+TSP_Size*12]==0x47 && Buffer[Buffer_Offset+188*13+BDAV_Size*14+TSP_Size*13]==0x47 && Buffer[Buffer_Offset+188*14+BDAV_Size*15+TSP_Size*14]==0x47 && Buffer[Buffer_Offset+188*15+BDAV_Size*16+TSP_Size*15]==0x47)) { Buffer_Offset++; while ( Buffer_Offset+BDAV_Size+1<=Buffer_Size && Buffer[Buffer_Offset+BDAV_Size]!=0x47) Buffer_Offset++; } if (Buffer_Offset+188*16+BDAV_Size*16+TSP_Size*16>=Buffer_Size #ifdef MEDIAINFO_ARIBSTDB24B37_YES && !FromAribStdB24B37 #endif ) return false; //Synched is OK if (!Status[IsAccepted]) { Accept(); } return true; } //--------------------------------------------------------------------------- bool File_MpegTs::Synched_Test() { while (Buffer_Offset+TS_Size<=Buffer_Size) { //Synchro testing if (Buffer[Buffer_Offset+BDAV_Size]!=0x47) { Synched=false; #if MEDIAINFO_DUPLICATE if (File__Duplicate_Get()) Trusted++; //We don't want to stop parsing if duplication is requested, TS is not a lot stable, normal... #endif //MEDIAINFO_DUPLICATE return true; } //Getting pid pid=(Buffer[Buffer_Offset+BDAV_Size+1]&0x1F)<<8 | Buffer[Buffer_Offset+BDAV_Size+2]; complete_stream::stream* Stream=Complete_Stream->Streams[pid]; if (Stream->Searching) { //Trace config #if MEDIAINFO_TRACE if (Config_Trace_Level) { if (Stream->Kind==complete_stream::stream::pes) { if (!Trace_Layers[8]) Trace_Layers_Update(8); //Stream } else Trace_Layers_Update(IsSub?1:0); } #endif //MEDIAINFO_TRACE payload_unit_start_indicator=(Buffer[Buffer_Offset+BDAV_Size+1]&0x40)!=0; if (payload_unit_start_indicator) { //Searching start if (Stream->Searching_Payload_Start) //payload_unit_start_indicator { if (Stream->Kind==complete_stream::stream::psi) { //Searching table_id size_t Version_Pos=BDAV_Size +4 //standart header +((Buffer[Buffer_Offset+BDAV_Size+3]&0x20)?(1+Buffer[Buffer_Offset+BDAV_Size+4]):0); //adaptation_field_control (adaptation) --> adaptation_field_length if (Version_Pos>=BDAV_Size+188) return true; //There is a problem with this block, accelerated parsing disabled Version_Pos+=1+Buffer[Buffer_Offset+Version_Pos]; //pointer_field if (Version_Pos>=BDAV_Size+188) return true; //There is a problem with this block, accelerated parsing disabled int8u table_id=Buffer[Buffer_Offset+Version_Pos]; //table_id #if MEDIAINFO_TRACE if (Trace_Activated) Stream->Element_Info1=Mpeg_Psi_table_id(table_id); #endif //MEDIAINFO_TRACE if (table_id==0xCD) //specifc case for ATSC STT { if (Config_Trace_TimeSection_OnlyFirstOccurrence) { if (!TimeSection_FirstOccurrenceParsed) TimeSection_FirstOccurrenceParsed=true; #if MEDIAINFO_TRACE else { Trace_Layers.reset(); //We do not want to display data about other occurences Trace_Layers_Update(); } #endif //MEDIAINFO_TRACE } return true; //Version has no meaning } #if MEDIAINFO_IBI if (table_id==0x00) Complete_Stream->Streams[pid]->Ibi_SynchronizationOffset_BeginOfFrame=File_Offset+Buffer_Offset; if (table_id==0x02) Complete_Stream->Streams[pid]->Ibi_SynchronizationOffset_BeginOfFrame=Complete_Stream->Streams[0x0000]->Ibi_SynchronizationOffset_BeginOfFrame; #endif //MEDIAINFO_IBI complete_stream::stream::table_ids::iterator Table_ID=Stream->Table_IDs.begin()+table_id; if (*Table_ID) { //Searching table_id_extension, version_number, section_number if (!(Buffer[Buffer_Offset+Version_Pos+1]&0x80)) //section_syntax_indicator { if (table_id==0x70 && Config_Trace_TimeSection_OnlyFirstOccurrence) { if (!TimeSection_FirstOccurrenceParsed) TimeSection_FirstOccurrenceParsed=true; #if MEDIAINFO_TRACE else { Trace_Layers.reset(); //We do not want to display data about other occurences Trace_Layers_Update(); } #endif //MEDIAINFO_TRACE } return true; //No version } Version_Pos+=3; //Header size if (Version_Pos+5>=BDAV_Size+188) return true; //Not able to detect version (too far) int16u table_id_extension=(Buffer[Buffer_Offset+Version_Pos]<<8)|Buffer[Buffer_Offset+Version_Pos+1]; int8u version_number=(Buffer[Buffer_Offset+Version_Pos+2]&0x3F)>>1; int8u section_number=Buffer[Buffer_Offset+Version_Pos+3]; complete_stream::stream::table_id::table_id_extensions::iterator Table_ID_Extension=(*Table_ID)->Table_ID_Extensions.find(table_id_extension); if (Table_ID_Extension==(*Table_ID)->Table_ID_Extensions.end()) { if ((*Table_ID)->Table_ID_Extensions_CanAdd) { (*Table_ID)->Table_ID_Extensions[table_id_extension].version_number=version_number; (*Table_ID)->Table_ID_Extensions[table_id_extension].Section_Numbers.resize(0x100); (*Table_ID)->Table_ID_Extensions[table_id_extension].Section_Numbers[section_number]=true; return true; //table_id_extension is not yet parsed } } else if (Table_ID_Extension->second.version_number!=version_number) { if (Table_ID_Extension->second.version_number!=(int8u)-1 && Config_Trace_TimeSection_OnlyFirstOccurrence) break; Table_ID_Extension->second.version_number=version_number; Table_ID_Extension->second.Section_Numbers.clear(); Table_ID_Extension->second.Section_Numbers.resize(0x100); Table_ID_Extension->second.Section_Numbers[section_number]=true; return true; //version is different } else if (!Table_ID_Extension->second.Section_Numbers[section_number]) { Table_ID_Extension->second.Section_Numbers[section_number]=true; return true; //section is not yet parsed } else if (table_id==0x02 && Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs_NotParsedCount) { //PMT is looping, so this is nearly sure that all PMT available in the stream are assigned #ifdef MEDIAINFO_MPEGTS_ALLSTREAMS_YES for (size_t pid=0x10; pid<0x1FFF; pid++) //Wanting 0x10-->0x2F (DVB), 0x1ABC (cea_osd), 0x1FF7-->0x1FFF (ATSC) for (size_t Table_ID=0x00; Table_ID<0xFF; Table_ID++) { Complete_Stream->Streams[pid]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[pid]->Kind=complete_stream::stream::psi; Complete_Stream->Streams[pid]->Table_IDs.resize(0x100); Complete_Stream->Streams[pid]->Table_IDs[Table_ID]=new complete_stream::stream::table_id; //event_information_section - actual_transport_stream, schedule if (Pos==0x001F) Pos=0x1ABB; //Skipping normal data if (Pos==0x01ABC) Pos=0x1FF6; //Skipping normal data } #else //MEDIAINFO_MPEGTS_ALLSTREAMS_YES if (Complete_Stream->Streams[0x0010]->Kind==complete_stream::stream::unknown) { Complete_Stream->Streams[0x0010]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[0x0010]->Kind=complete_stream::stream::psi; Complete_Stream->Streams[0x0010]->Table_IDs.resize(0x100); Complete_Stream->Streams[0x0010]->Table_IDs[0x40]=new complete_stream::stream::table_id; //network_information_section - actual_network } if (Complete_Stream->Streams[0x0011]->Kind==complete_stream::stream::unknown) { Complete_Stream->Streams[0x0011]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[0x0011]->Kind=complete_stream::stream::psi; Complete_Stream->Streams[0x0011]->Table_IDs.resize(0x100); Complete_Stream->Streams[0x0011]->Table_IDs[0x42]=new complete_stream::stream::table_id; //service_description_section - actual_transport_stream } if (Complete_Stream->Streams[0x0012]->Kind==complete_stream::stream::unknown) { Complete_Stream->Streams[0x0012]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[0x0012]->Kind=complete_stream::stream::psi; Complete_Stream->Streams[0x0012]->Table_IDs.resize(0x100); Complete_Stream->Streams[0x0012]->Table_IDs[0x4E]=new complete_stream::stream::table_id; //event_information_section - actual_transport_stream, present/following for (size_t Table_ID=0x50; Table_ID<0x60; Table_ID++) Complete_Stream->Streams[0x0012]->Table_IDs[Table_ID]=new complete_stream::stream::table_id; //event_information_section - actual_transport_stream, schedule } if (Complete_Stream->Streams[0x0014]->Kind==complete_stream::stream::unknown) { Complete_Stream->Streams[0x0014]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[0x0014]->Kind=complete_stream::stream::psi; Complete_Stream->Streams[0x0014]->Table_IDs.resize(0x100); Complete_Stream->Streams[0x0014]->Table_IDs[0x70]=new complete_stream::stream::table_id; //time_date_section Complete_Stream->Streams[0x0014]->Table_IDs[0x73]=new complete_stream::stream::table_id; //time_offset_section } if (Complete_Stream->Streams[0x1FFB]->Kind==complete_stream::stream::unknown) { Complete_Stream->Streams[0x1FFB]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[0x1FFB]->Kind=complete_stream::stream::psi; Complete_Stream->Streams[0x1FFB]->Table_IDs.resize(0x100); Complete_Stream->Streams[0x1FFB]->Table_IDs[0xC7]=new complete_stream::stream::table_id; //Master Guide Table Complete_Stream->Streams[0x1FFB]->Table_IDs[0xCD]=new complete_stream::stream::table_id; //System Time Table } #endif //MEDIAINFO_MPEGTS_ALLSTREAMS_YES } } } else return true; //No version in this pid } } //Searching continue and parser timestamp if (Stream->Searching_Payload_Continue #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES || Stream->Searching_ParserTimeStamp_Start || Stream->Searching_ParserTimeStamp_End #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES ) return true; //Adaptation layer #ifdef MEDIAINFO_MPEGTS_PCR_YES if (( Stream->Searching_TimeStamp_Start || Stream->Searching_TimeStamp_End) #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES && !Stream->Searching_ParserTimeStamp_End #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES ) { if ((Buffer[Buffer_Offset+BDAV_Size+3]&0x20)==0x20) //adaptation_field_control (adaptation) { int8u adaptation_field_length=Buffer[Buffer_Offset+BDAV_Size+4]; if (adaptation_field_length>=5) //adaptation_field_length { bool discontinuity_indicator=(Buffer[Buffer_Offset+BDAV_Size+5]&0x80)!=0; bool PCR_flag=(Buffer[Buffer_Offset+BDAV_Size+5]&0x10)!=0; if (PCR_flag) { int64u program_clock_reference=( (((int64u)Buffer[Buffer_Offset+BDAV_Size+6])<<25) | (((int64u)Buffer[Buffer_Offset+BDAV_Size+7])<<17) | (((int64u)Buffer[Buffer_Offset+BDAV_Size+8])<< 9) | (((int64u)Buffer[Buffer_Offset+BDAV_Size+9])<< 1) | (((int64u)Buffer[Buffer_Offset+BDAV_Size+10])>>7)); program_clock_reference*=300; program_clock_reference+=( (((int64u)Buffer[Buffer_Offset+BDAV_Size+10]&0x01)<<8) | (((int64u)Buffer[Buffer_Offset+BDAV_Size+11]) )); if (Complete_Stream->Streams[pid]->Searching_TimeStamp_End #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES && (!Complete_Stream->Streams[pid]->Searching_ParserTimeStamp_End || Complete_Stream->Streams[pid]->IsPCR) //If PCR, we always want it. #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES ) { Header_Parse_Events_Duration(program_clock_reference); if (program_clock_reference!=Complete_Stream->Streams[pid]->TimeStamp_End) //Some PCRs are buggy (low precision), using the first stream offset in the case of duplicate PCR value { if (Complete_Stream->Streams[pid]->TimeStamp_End_Offset!=(int64u)-1) { if (program_clock_reference+0x12c00000000LLStreams[pid]->TimeStamp_End) program_clock_reference+=0x25800000000LL; //33 bits and *300 if (!discontinuity_indicator && program_clock_reference>Complete_Stream->Streams[pid]->TimeStamp_End && program_clock_referenceStreams[pid]->TimeStamp_End+10*27000000) //Not before, not after 10 seconds, else there is a problem { float64 Duration_InstantaneousBitRate_Min=(float64)(program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End-(Config_VbrDetection_Delta?0:810)); float64 Duration_InstantaneousBitRate_Max=(float64)(program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End+(Config_VbrDetection_Delta?0:810)); float64 Bytes_InstantaneousBitRate=(float64)(File_Offset+Buffer_Offset-Complete_Stream->Streams[pid]->TimeStamp_End_Offset); float64 TimeStamp_InstantaneousBitRate_Current_Min=Bytes_InstantaneousBitRate*8/Duration_InstantaneousBitRate_Max*27000000*(1-Config_VbrDetection_Delta); float64 TimeStamp_InstantaneousBitRate_Current_Raw=Bytes_InstantaneousBitRate*8/Duration_InstantaneousBitRate_Min*27000000; float64 TimeStamp_InstantaneousBitRate_Current_Max=Bytes_InstantaneousBitRate*8/Duration_InstantaneousBitRate_Min*27000000*(1+Config_VbrDetection_Delta); if (Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Min) { if (TimeStamp_InstantaneousBitRate_Current_MaxStreams[pid]->TimeStamp_InstantaneousBitRate_Current_Min || TimeStamp_InstantaneousBitRate_Current_Min>Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Max) { Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_BitRateMode_IsVbr++; #if MEDIAINFO_ADVANCED if (Config_VbrDetection_GiveUp && Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_BitRateMode_IsVbr>=Config_VbrDetection_Occurences) Config->ParseSpeed=0; #endif // MEDIAINFO_ADVANCED } else Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_BitRateMode_IsCbr++; } float64 Duration_Min=(float64)(program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End-1); float64 Duration_Raw=(float64)(program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End); float64 Duration_Max=(float64)(program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End+1); float64 Bytes=(float64)(File_Offset+Buffer_Offset-Complete_Stream->Streams[pid]->TimeStamp_End_Offset); float64 TimeStamp_Min=Bytes*8/Duration_Max*27000000*(1-Config_VbrDetection_Delta); float64 TimeStamp_Raw=Bytes*8/Duration_Raw*27000000; float64 TimeStamp_Max=Bytes*8/Duration_Min*27000000*(1+Config_VbrDetection_Delta); Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Min=TimeStamp_Min; Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Raw=TimeStamp_Raw; Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Max=TimeStamp_Max; #if MEDIAINFO_ADVANCED if (Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Min_Raw>TimeStamp_InstantaneousBitRate_Current_Raw) Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Min_Raw=TimeStamp_InstantaneousBitRate_Current_Raw; if (Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Max_RawStreams[pid]->TimeStamp_InstantaneousBitRate_Max_Raw=TimeStamp_InstantaneousBitRate_Current_Raw; int64u Distance=program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End; if (Complete_Stream->Streams[pid]->TimeStamp_Distance_Min>Distance) Complete_Stream->Streams[pid]->TimeStamp_Distance_Min=Distance; if (Complete_Stream->Streams[pid]->TimeStamp_Distance_MaxStreams[pid]->TimeStamp_Distance_Max=Distance; Complete_Stream->Streams[pid]->TimeStamp_Distance_Total+=Distance; Complete_Stream->Streams[pid]->TimeStamp_Distance_Count++; #endif // MEDIAINFO_ADVANCED } #if MEDIAINFO_ADVANCED else { if (!discontinuity_indicator) Complete_Stream->Streams[pid]->TimeStamp_HasProblems++; float64 Bytes=(float64)(File_Offset+Buffer_Offset-Complete_Stream->Streams[pid]->TimeStamp_End_Offset); int64u TimeToAdd; if (Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Raw) TimeToAdd=float64_int64s(Bytes*8/Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Raw*27000000); else TimeToAdd=0; Complete_Stream->Streams[pid]->TimeStamp_Intermediate.push_back(Complete_Stream->Streams[pid]->TimeStamp_End+TimeToAdd); Complete_Stream->Streams[pid]->TimeStamp_Intermediate.push_back(program_clock_reference); } #endif // MEDIAINFO_ADVANCED } Complete_Stream->Streams[pid]->TimeStamp_End=program_clock_reference; Complete_Stream->Streams[pid]->TimeStamp_End_IsUpdated=true; Complete_Stream->Streams[pid]->TimeStamp_End_Offset=File_Offset+Buffer_Offset; { Status[IsUpdated]=true; Status[User_16]=true; } } } if (Complete_Stream->Streams[pid]->Searching_TimeStamp_Start) { //This is the first PCR Complete_Stream->Streams[pid]->TimeStamp_Start=program_clock_reference; Complete_Stream->Streams[pid]->TimeStamp_Start_Offset=File_Offset+Buffer_Offset; Complete_Stream->Streams[pid]->TimeStamp_End=program_clock_reference; Complete_Stream->Streams[pid]->TimeStamp_End_IsUpdated=true; Complete_Stream->Streams[pid]->TimeStamp_End_Offset=File_Offset+Buffer_Offset; Complete_Stream->Streams[pid]->Searching_TimeStamp_Start_Set(false); Complete_Stream->Streams[pid]->Searching_TimeStamp_End_Set(true); Complete_Stream->Streams_With_StartTimeStampCount++; { Status[IsUpdated]=true; Status[User_16]=true; } } //Test if we can find the TS bitrate if (!Complete_Stream->Streams[pid]->EndTimeStampMoreThanxSeconds && Complete_Stream->Streams[pid]->TimeStamp_Start!=(int64u)-1 && (File_Offset+Buffer_Offset-Buffer_TotalBytes_FirstSynched)*2Streams[pid]->TimeStamp_Start) program_clock_reference+=0x200000000LL*300; //33 bits, cyclic if ((program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_Start)>Begin_MaxDuration) { Complete_Stream->Streams[pid]->EndTimeStampMoreThanxSeconds=true; Complete_Stream->Streams_With_EndTimeStampMoreThanxSecondsCount++; if (Complete_Stream->Streams_NotParsedCount && Complete_Stream->Streams_With_StartTimeStampCount>0 && Complete_Stream->Streams_With_StartTimeStampCount==Complete_Stream->Streams_With_EndTimeStampMoreThanxSecondsCount) { //We are already parsing 16 seconds (for all PCRs), we don't hope to have more info MpegTs_JumpTo_Begin=File_Offset+Buffer_Offset-Buffer_TotalBytes_FirstSynched; if (MpegTs_JumpTo_End>MpegTs_JumpTo_Begin) MpegTs_JumpTo_End=MpegTs_JumpTo_Begin; } } } } } } } #endif //MEDIAINFO_MPEGTS_PCR_YES } #if MEDIAINFO_DUPLICATE if (Stream->ShouldDuplicate) { Element_Size=TS_Size; File__Duplicate_Write(); } #endif //MEDIAINFO_DUPLICATE Header_Parse_Events(); Buffer_Offset+=TS_Size; } if (File_Offset+Buffer_Size>=File_Size) Detect_EOF(); //for TRP files return false; //Not enough data } //--------------------------------------------------------------------------- void File_MpegTs::Synched_Init() { //Config->File_Filter_Set(462); //Default values Complete_Stream=new complete_stream; Complete_Stream->Streams.resize(0x2000); for (size_t StreamID=0; StreamID<0x2000; StreamID++) Complete_Stream->Streams[StreamID]=new complete_stream::stream; Complete_Stream->Streams[0x0000]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[0x0000]->Kind=complete_stream::stream::psi; // Program Association Table Complete_Stream->Streams[0x0000]->Table_IDs.resize(0x100); Complete_Stream->Streams[0x0000]->Table_IDs[0x00]=new complete_stream::stream::table_id; // program_association_section Complete_Stream->Streams[0x0001]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[0x0001]->Kind=complete_stream::stream::psi; // Conditional Access Table Complete_Stream->Streams[0x0001]->Table_IDs.resize(0x100); Complete_Stream->Streams[0x0001]->Table_IDs[0x01]=new complete_stream::stream::table_id; // CA_section Complete_Stream->Streams[0x0002]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[0x0002]->Kind=complete_stream::stream::psi; // Transport Stream Description Table Complete_Stream->Streams[0x0002]->Table_IDs.resize(0x100); Complete_Stream->Streams[0x0003]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[0x0003]->Kind=complete_stream::stream::psi; // IPMP Control Information Table Complete_Stream->Streams[0x0003]->Table_IDs.resize(0x100); //Temp MpegTs_JumpTo_Begin=(File_Offset_FirstSynched==(int64u)-1?0:Buffer_TotalBytes_LastSynched)+MediaInfoLib::Config.MpegTs_MaximumOffset_Get(); MpegTs_JumpTo_End=MediaInfoLib::Config.MpegTs_MaximumOffset_Get()/4; Buffer_TotalBytes_LastSynched=Buffer_TotalBytes_FirstSynched; if (MpegTs_JumpTo_Begin==(int64u)-1 || MpegTs_JumpTo_Begin+MpegTs_JumpTo_End>=File_Size) { if (MpegTs_JumpTo_Begin+MpegTs_JumpTo_End>File_Size) { MpegTs_JumpTo_Begin=File_Size; MpegTs_JumpTo_End=0; } else MpegTs_JumpTo_Begin=File_Size-MpegTs_JumpTo_End; } //Config Config_Trace_TimeSection_OnlyFirstOccurrence=MediaInfoLib::Config.Trace_TimeSection_OnlyFirstOccurrence_Get(); TimeSection_FirstOccurrenceParsed=false; #if MEDIAINFO_ADVANCED Config_VbrDetection_Delta=MediaInfoLib::Config.MpegTs_VbrDetection_Delta_Get(); Config_VbrDetection_Occurences=MediaInfoLib::Config.MpegTs_VbrDetection_Occurences_Get(); Config_VbrDetection_GiveUp=MediaInfoLib::Config.MpegTs_VbrDetection_GiveUp_Get(); #endif // MEDIAINFO_ADVANCED #ifdef MEDIAINFO_ARIBSTDB24B37_YES if (FromAribStdB24B37) { #if MEDIAINFO_EVENTS StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS SetAllToPES(); } #endif //MEDIAINFO_ARIBSTDB24B37_YES //Continue, again, for Duplicate and Filter Option_Manage(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_MpegTs::Read_Buffer_Unsynched() { if (Complete_Stream==NULL || Complete_Stream->Streams.empty()) return; for (size_t StreamID=0; StreamID<0x2000; StreamID++)//std::map::iterator Stream=Streams.begin(); Stream!=Streams.end(); Stream++) { //End timestamp is out of date #if defined(MEDIAINFO_MPEGTS_PCR_YES) || defined(MEDIAINFO_MPEGTS_PESTIMESTAMP_YES) Complete_Stream->Streams[StreamID]->Searching_TimeStamp_Start_Set(false); //No more searching start Complete_Stream->Streams[StreamID]->TimeStamp_End=(int64u)-1; Complete_Stream->Streams[StreamID]->TimeStamp_End_IsUpdated=false; Complete_Stream->Streams[StreamID]->TimeStamp_End_Offset=(int64u)-1; if (Complete_Stream->Streams[StreamID]->TimeStamp_Start!=(int64u)-1) Complete_Stream->Streams[StreamID]->Searching_TimeStamp_End_Set(true); //Searching only for a start found #endif //defined(MEDIAINFO_MPEGTS_PCR_YES) || defined(MEDIAINFO_MPEGTS_PESTIMESTAMP_YES) if (Complete_Stream->Streams[StreamID]->Parser) { #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES Complete_Stream->Streams[StreamID]->Searching_ParserTimeStamp_Start_Set(false); //No more searching start if (((File_MpegPs*)Complete_Stream->Streams[StreamID]->Parser)->HasTimeStamps) Complete_Stream->Streams[StreamID]->Searching_ParserTimeStamp_End_Set(true); //Searching only for a start found #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES if (File_GoTo==0) Complete_Stream->Streams[StreamID]->Parser->Unsynch_Frame_Count=0; Complete_Stream->Streams[StreamID]->Parser->Open_Buffer_Unsynch(); } #if MEDIAINFO_IBI Complete_Stream->Streams[StreamID]->Ibi_SynchronizationOffset_BeginOfFrame=(int64u)-1; for (complete_stream::stream::table_ids::iterator TableID=Complete_Stream->Streams[StreamID]->Table_IDs.begin(); TableID!=Complete_Stream->Streams[StreamID]->Table_IDs.end(); ++TableID) if (*TableID) for (complete_stream::stream::table_id::table_id_extensions::iterator TableIdExtension=(*TableID)->Table_ID_Extensions.begin(); TableIdExtension!=(*TableID)->Table_ID_Extensions.end(); ++TableIdExtension) TableIdExtension->second.version_number=(int8u)-1; #endif //MEDIAINFO_IBI } Complete_Stream->Duration_End.clear(); //Clearing durations Clear(Stream_General, 0, General_Duration); Clear(Stream_General, 0, General_Duration_End); for (size_t StreamPos=0; StreamPosParseSpeed>=1.0) Config->State_Set(((float)Buffer_TotalBytes)/File_Size); else if (Buffer_TotalBytes>MpegTs_JumpTo_Begin+MpegTs_JumpTo_End) Config->State_Set((float)0.99); //Nearly the end else Config->State_Set(((float)Buffer_TotalBytes)/(MpegTs_JumpTo_Begin+MpegTs_JumpTo_End)); } #if MEDIAINFO_DEMUX if (Complete_Stream && pid<0x2000 && Complete_Stream->Streams[pid]->Kind==complete_stream::stream::pes && Complete_Stream->Streams[pid]->Parser && ((File_MpegPs*)Complete_Stream->Streams[pid]->Parser)->Demux_StreamIsBeingParsed_type!=(int8u)-1) { Open_Buffer_Continue(Complete_Stream->Streams[pid]->Parser, Buffer, 0, false); PES_Parse_Finish(); } #endif //MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- void File_MpegTs::Read_Buffer_AfterParsing() { if (Complete_Stream==NULL) return; //No synchronization yet if (!Status[IsFilled]) { //Test if parsing of headers is OK if ((Complete_Stream->Streams_NotParsedCount==0 && (Complete_Stream->NoPatPmt || (Complete_Stream->transport_stream_id_IsValid && Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs_NotParsedCount==0))) || (Buffer_TotalBytes-Buffer_TotalBytes_FirstSynched>=MpegTs_JumpTo_Begin && Config->ParseSpeed<0.8) || File_Offset+Buffer_Size==File_Size) { //Test if PAT/PMT are missing (ofen in .trp files) if (!Complete_Stream->transport_stream_id_IsValid && !Complete_Stream->NoPatPmt) { //Activating all streams as PES SetAllToPES(); Fill(Stream_General, 0, General_Format_Profile, "No PAT/PMT"); Buffer_TotalBytes=0; Buffer_TotalBytes_LastSynched=(int64u)-1; Open_Buffer_Unsynch(); GoTo(0); return; } //Filling for (std::set::iterator StreamID=Complete_Stream->PES_PIDs.begin(); StreamID!=Complete_Stream->PES_PIDs.end(); ++StreamID) { if (Complete_Stream->Streams[*StreamID]->Parser) { Fill(Complete_Stream->Streams[*StreamID]->Parser); Complete_Stream->Streams[*StreamID]->Parser->Status[IsUpdated]=false; Complete_Stream->Streams[*StreamID]->IsUpdated_Info=true; } for (size_t Pos=0; PosStreams[*StreamID]->program_numbers.size(); Pos++) Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Complete_Stream->Streams[*StreamID]->program_numbers[Pos]].Update_Needed_IsRegistered=true; } Complete_Stream->Streams_NotParsedCount=0; Fill(); //Deactivating if (Config->File_StopSubStreamAfterFilled_Get()) for (std::set::iterator StreamID=Complete_Stream->PES_PIDs.begin(); StreamID!=Complete_Stream->PES_PIDs.end(); ++StreamID) { Complete_Stream->Streams[*StreamID]->Searching_Payload_Start_Set(false); Complete_Stream->Streams[*StreamID]->Searching_Payload_Continue_Set(false); } //Status Status[IsUpdated]=true; Status[User_19]=true; //Jumping if (Config->ParseSpeed<1.0 && Config->File_IsSeekable_Get() && File_Offset+Buffer_SizeDemux_IsSeeking=false; #endif //MEDIAINFO_DEMUX //Init if (!Duration_Detected) { //External IBI #if MEDIAINFO_IBI std::string IbiFile=Config->Ibi_Get(); if (!IbiFile.empty()) { Ibi.Streams.clear(); //TODO: support IBI data from different inputs File_Ibi MI; Open_Buffer_Init(&MI, IbiFile.size()); MI.Ibi=&Ibi; MI.Open_Buffer_Continue((const int8u*)IbiFile.c_str(), IbiFile.size()); } //Creating base IBI from a quick analysis of the file else { MediaInfo_Internal MI; MI.Option(__T("File_KeepInfo"), __T("1")); Ztring ParseSpeed_Save=MI.Option(__T("ParseSpeed_Get"), __T("")); Ztring Demux_Save=MI.Option(__T("Demux_Get"), __T("")); MI.Option(__T("ParseSpeed"), __T("0")); MI.Option(__T("Demux"), Ztring()); Ztring File_Names=Config->File_Names.Read(); MI.Option(__T("File_FileNameFormat"), __T("CSV")); size_t MiOpenResult=MI.Open(File_Names); MI.Option(__T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value MI.Option(__T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value if (!MiOpenResult) return 0; for (ibi::streams::iterator IbiStream_Temp=((File_MpegTs*)MI.Info)->Ibi.Streams.begin(); IbiStream_Temp!=((File_MpegTs*)MI.Info)->Ibi.Streams.end(); ++IbiStream_Temp) { if (Ibi.Streams[IbiStream_Temp->first]==NULL) Ibi.Streams[IbiStream_Temp->first]=new ibi::stream(*IbiStream_Temp->second); Ibi.Streams[IbiStream_Temp->first]->Unsynch(); for (size_t Pos=0; Possecond->Infos.size(); Pos++) { Ibi.Streams[IbiStream_Temp->first]->Add(IbiStream_Temp->second->Infos[Pos]); if (!IbiStream_Temp->second->Infos[Pos].IsContinuous) Ibi.Streams[IbiStream_Temp->first]->Unsynch(); } Ibi.Streams[IbiStream_Temp->first]->Unsynch(); } if (Ibi.Streams.empty()) return 4; //Problem during IBI file parsing } #endif //#if MEDIAINFO_IBI Duration_Detected=true; } //Parsing switch (Method) { case 0 : GoTo(Value); Open_Buffer_Unsynch(); return 1; case 1 : GoTo(File_Size*Value/10000); Open_Buffer_Unsynch(); return 1; case 2 : //Timestamp #if MEDIAINFO_IBI { ibi::streams::iterator IbiStream_Temp; if (ID==(int64u)-1) IbiStream_Temp=Ibi.Streams.begin(); else IbiStream_Temp=Ibi.Streams.find(ID); if (IbiStream_Temp==Ibi.Streams.end() || IbiStream_Temp->second->Infos.empty()) { for (IbiStream_Temp=Ibi.Streams.begin(); IbiStream_Temp!=Ibi.Streams.end(); ++IbiStream_Temp) if (!IbiStream_Temp->second->Infos.empty()) break; if (IbiStream_Temp==Ibi.Streams.end()) return 5; //Invalid ID } if (!(IbiStream_Temp->second->DtsFrequencyNumerator==1000000000 && IbiStream_Temp->second->DtsFrequencyDenominator==1)) { float64 ValueF=(float64)Value; ValueF/=1000000000; //Value is in ns ValueF/=IbiStream_Temp->second->DtsFrequencyDenominator; ValueF*=IbiStream_Temp->second->DtsFrequencyNumerator; Value=float64_int64s(ValueF); } for (size_t Pos=0; Possecond->Infos.size(); Pos++) { if (Value<=IbiStream_Temp->second->Infos[Pos].Dts || Pos+1==IbiStream_Temp->second->Infos.size()) { if (Valuesecond->Infos[Pos].Dts && Pos) Pos--; //Checking continuity of Ibi if (!IbiStream_Temp->second->Infos[Pos].IsContinuous && Pos+1second->Infos.size() && InfiniteLoop_Detect<8) //With infinite loop detect { InfiniteLoop_Detect++; Config->Demux_IsSeeking=true; Seek_Value=Value; Seek_Value_Maximal=IbiStream_Temp->second->Infos[Pos+1].StreamOffset; Seek_ID=IbiStream_Temp->first; GoTo((IbiStream_Temp->second->Infos[Pos].StreamOffset+IbiStream_Temp->second->Infos[Pos+1].StreamOffset)/2); Open_Buffer_Unsynch(); return 1; } InfiniteLoop_Detect=0; Config->Demux_IsSeeking=false; if (Complete_Stream && Complete_Stream->Streams[(size_t)IbiStream_Temp->first] && Complete_Stream->Streams[(size_t)IbiStream_Temp->first]->Parser) Complete_Stream->Streams[(size_t)IbiStream_Temp->first]->Parser->Unsynch_Frame_Count=IbiStream_Temp->second->Infos[Pos].FrameNumber; else Unsynch_Frame_Counts[(int16u)IbiStream_Temp->first]=IbiStream_Temp->second->Infos[Pos].FrameNumber; GoTo(IbiStream_Temp->second->Infos[Pos].StreamOffset); Open_Buffer_Unsynch(); return 1; } } return 2; //Invalid value } #else //MEDIAINFO_IBI return (size_t)-2; //Not supported / IBI disabled #endif //MEDIAINFO_IBI case 3 : //FrameNumber #if MEDIAINFO_IBI { ibi::streams::iterator IbiStream_Temp; if (ID==(int64u)-1) IbiStream_Temp=Ibi.Streams.begin(); else IbiStream_Temp=Ibi.Streams.find(ID); if (IbiStream_Temp==Ibi.Streams.end() || IbiStream_Temp->second->Infos.empty()) { for (IbiStream_Temp=Ibi.Streams.begin(); IbiStream_Temp!=Ibi.Streams.end(); ++IbiStream_Temp) if (!IbiStream_Temp->second->Infos.empty()) break; if (IbiStream_Temp==Ibi.Streams.end()) return 5; //Invalid ID } for (size_t Pos=0; Possecond->Infos.size(); Pos++) { if (Value<=IbiStream_Temp->second->Infos[Pos].FrameNumber || Pos+1==IbiStream_Temp->second->Infos.size()) { if (Valuesecond->Infos[Pos].FrameNumber && Pos) Pos--; Config->Demux_IsSeeking=false; if (Complete_Stream && Complete_Stream->Streams[(size_t)IbiStream_Temp->first] && Complete_Stream->Streams[(size_t)IbiStream_Temp->first]->Parser) Complete_Stream->Streams[(size_t)IbiStream_Temp->first]->Parser->Unsynch_Frame_Count=IbiStream_Temp->second->Infos[Pos].FrameNumber; else Unsynch_Frame_Counts[(int16u)IbiStream_Temp->first]=IbiStream_Temp->second->Infos[Pos].FrameNumber; GoTo(IbiStream_Temp->second->Infos[Pos].StreamOffset); Open_Buffer_Unsynch(); return 1; } } return 2; //Invalid value } #else //MEDIAINFO_IBI return (size_t)-2; //Not supported / IBI disabled #endif //MEDIAINFO_IBI default : return (size_t)-1; //Not supported } } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_MpegTs::FileHeader_Begin() { if (Buffer_Size<8) return false; //Wait for more data //False positives detection: detect some headers from other files, DV parser is not smart enough if (CC8(Buffer+Buffer_Offset)==0x444C472056312E30LL //DLG || CC4(Buffer)==0x52494646 //RIFF || CC4(Buffer+4)==0x66747970 //ftyp || CC4(Buffer+4)==0x66726565 //free || CC4(Buffer+4)==0x6D646174 //mdat || CC4(Buffer+4)==0x6D6F6F76 //moov || CC4(Buffer+4)==0x736B6970 //skip || CC4(Buffer+4)==0x77696465 //wide || CC4(Buffer)==0x060E2B34) //MXF begin { Reject("MPEG-TS"); return true; } //Configuring #if defined(MEDIAINFO_BDAV_YES) || defined(MEDIAINFO_TSP_YES) TS_Size=188 #if defined(MEDIAINFO_BDAV_YES) +BDAV_Size #endif #if defined(MEDIAINFO_TSP_YES) +TSP_Size #endif ; #endif //Configuration Option_Manage(); return true; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_MpegTs::Header_Parse() { #if MEDIAINFO_TRACE if (Trace_Activated) { //Parsing bool adaptation, payload; if (BDAV_Size) Skip_B4( "BDAV"); //BDAV supplement Skip_B1( "sync_byte"); BS_Begin(); Skip_SB( "transport_error_indicator"); Get_SB ( payload_unit_start_indicator, "payload_unit_start_indicator"); Skip_SB( "transport_priority"); Get_S2 (13, pid, "pid"); Get_S1 ( 2, transport_scrambling_control, "transport_scrambling_control"); Get_SB ( adaptation, "adaptation_field_control (adaptation)"); Get_SB ( payload, "adaptation_field_control (payload)"); Skip_S1( 4, "continuity_counter"); BS_End(); //Info /* Trace: used to display program number(s) if (!Complete_Stream->Streams[pid]->program_numbers.empty()) { Ztring Program_Numbers; for (size_t Pos=0; PosStreams[pid]->program_numbers.size(); Pos++) Program_Numbers+=Ztring::ToZtring_From_CC2(Complete_Stream->Streams[pid]->program_numbers[Pos])+__T('/'); if (!Program_Numbers.empty()) Program_Numbers.resize(Program_Numbers.size()-1); Data_Info(Program_Numbers); } else Data_Info(" "); */ Data_Info(Complete_Stream->Streams[pid]->Element_Info1); //Adaptation if (adaptation) Header_Parse_AdaptationField(); else { } //Data if (payload) { //Encryption if (transport_scrambling_control>0) Complete_Stream->Streams[pid]->IsScrambled++; } else if (Element_Offset0) Complete_Stream->Streams[pid]->IsScrambled++; } //Filling /*Element[1].Next=File_Offset+Buffer_Offset+TS_Size; //*/Header_Fill_Size(TS_Size); //Element[1].IsComplete=true; //Header_Fill_Size(TS_Size); Header_Parse_Events(); #if MEDIAINFO_TRACE } #endif //MEDIAINFO_TRACE } //--------------------------------------------------------------------------- void File_MpegTs::Header_Parse_AdaptationField() { #if MEDIAINFO_TRACE if (Trace_Activated) { int64u Element_Pos_Save=Element_Offset; Element_Begin1("adaptation_field"); int8u adaptation_field_length; Get_B1 (adaptation_field_length, "adaptation_field_length"); if (adaptation_field_length>188-4-1) //TS size - header - adaptation_field_length { adaptation_field_length=188-4-1; Skip_XX(188-4-1, "stuffing_bytes"); } else if (adaptation_field_length>0) { bool discontinuity_indicator, PCR_flag, OPCR_flag, splicing_point_flag, transport_private_data_flag, adaptation_field_extension_flag; BS_Begin(); Get_SB ( discontinuity_indicator, "discontinuity_indicator"); Skip_SB( "random_access_indicator"); Skip_SB( "elementary_stream_priority_indicator"); Get_SB ( PCR_flag, "PCR_flag"); Get_SB ( OPCR_flag, "OPCR_flag"); Get_SB ( splicing_point_flag, "splicing_point_flag"); Get_SB ( transport_private_data_flag, "transport_private_data_flag"); Get_SB ( adaptation_field_extension_flag, "adaptation_field_extension_flag"); BS_End(); if (PCR_flag) { #ifdef MEDIAINFO_MPEGTS_PCR_YES BS_Begin(); int64u program_clock_reference_base; int16u program_clock_reference_extension; Get_S8 (33, program_clock_reference_base, "program_clock_reference_base"); Param_Info_From_Milliseconds(program_clock_reference_base/90); Data_Info_From_Milliseconds(program_clock_reference_base/90); Skip_S1( 6, "reserved"); Get_S2 ( 9, program_clock_reference_extension, "program_clock_reference_extension"); int64u program_clock_reference=program_clock_reference_base*300+program_clock_reference_extension; Param_Info1(program_clock_reference); BS_End(); if (Complete_Stream->Streams[pid]->Searching_TimeStamp_End #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES && (!Complete_Stream->Streams[pid]->Searching_ParserTimeStamp_End || Complete_Stream->Streams[pid]->IsPCR) //If PCR, we always want it. #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES ) { Header_Parse_Events_Duration(program_clock_reference); if (program_clock_reference!=Complete_Stream->Streams[pid]->TimeStamp_End) //Some PCRs are buggy (low precision), using the first stream offset in the case of duplicate PCR value { if (Complete_Stream->Streams[pid]->TimeStamp_End_Offset!=(int64u)-1) { if (program_clock_reference+0x12c00000000LLStreams[pid]->TimeStamp_End) program_clock_reference+=0x25800000000LL; //33 bits and *300 if (!discontinuity_indicator && program_clock_reference>Complete_Stream->Streams[pid]->TimeStamp_End && program_clock_referenceStreams[pid]->TimeStamp_End+10*27000000) //Not before, not after 10 seconds, else there is a problem { float64 Duration_InstantaneousBitRate_Min=(float64)(program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End-(Config_VbrDetection_Delta?0:810)); float64 Duration_InstantaneousBitRate_Max=(float64)(program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End+(Config_VbrDetection_Delta?0:810)); float64 Bytes_InstantaneousBitRate=(float64)(File_Offset+Buffer_Offset-Complete_Stream->Streams[pid]->TimeStamp_End_Offset); float64 TimeStamp_InstantaneousBitRate_Current_Min=Bytes_InstantaneousBitRate*8/Duration_InstantaneousBitRate_Max*27000000*(1-Config_VbrDetection_Delta); float64 TimeStamp_InstantaneousBitRate_Current_Raw=Bytes_InstantaneousBitRate*8/Duration_InstantaneousBitRate_Min*27000000; float64 TimeStamp_InstantaneousBitRate_Current_Max=Bytes_InstantaneousBitRate*8/Duration_InstantaneousBitRate_Min*27000000*(1+Config_VbrDetection_Delta); if (Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Min) { if (TimeStamp_InstantaneousBitRate_Current_MaxStreams[pid]->TimeStamp_InstantaneousBitRate_Current_Min || TimeStamp_InstantaneousBitRate_Current_Min>Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Max) { Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_BitRateMode_IsVbr++; #if MEDIAINFO_ADVANCED if (Config_VbrDetection_GiveUp && Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_BitRateMode_IsVbr>=Config_VbrDetection_Occurences) Config->ParseSpeed=0; #endif // MEDIAINFO_ADVANCED } else Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_BitRateMode_IsCbr++; } float64 Duration_Min=(float64)(program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End-1); float64 Duration_Raw=(float64)(program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End); float64 Duration_Max=(float64)(program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End+1); float64 Bytes=(float64)(File_Offset+Buffer_Offset-Complete_Stream->Streams[pid]->TimeStamp_End_Offset); float64 TimeStamp_Min=Bytes*8/Duration_Max*27000000*(1-Config_VbrDetection_Delta); float64 TimeStamp_Raw=Bytes*8/Duration_Raw*27000000; float64 TimeStamp_Max=Bytes*8/Duration_Min*27000000*(1+Config_VbrDetection_Delta); Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Min=TimeStamp_Min; Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Raw=TimeStamp_Raw; Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Max=TimeStamp_Max; #if MEDIAINFO_ADVANCED if (Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Min_Raw>TimeStamp_InstantaneousBitRate_Current_Raw) Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Min_Raw=TimeStamp_InstantaneousBitRate_Current_Raw; if (Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Max_RawStreams[pid]->TimeStamp_InstantaneousBitRate_Max_Raw=TimeStamp_InstantaneousBitRate_Current_Raw; int64u Distance=program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End; if (Complete_Stream->Streams[pid]->TimeStamp_Distance_Min>Distance) Complete_Stream->Streams[pid]->TimeStamp_Distance_Min=Distance; if (Complete_Stream->Streams[pid]->TimeStamp_Distance_MaxStreams[pid]->TimeStamp_Distance_Max=Distance; Complete_Stream->Streams[pid]->TimeStamp_Distance_Total+=Distance; Complete_Stream->Streams[pid]->TimeStamp_Distance_Count++; #endif // MEDIAINFO_ADVANCED } #if MEDIAINFO_ADVANCED else { if (!discontinuity_indicator) Complete_Stream->Streams[pid]->TimeStamp_HasProblems++; float64 Bytes=(float64)(File_Offset+Buffer_Offset-Complete_Stream->Streams[pid]->TimeStamp_End_Offset); int64u TimeToAdd; if (Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Raw) TimeToAdd=float64_int64s(Bytes*8/Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Raw*27000000); else TimeToAdd=0; Complete_Stream->Streams[pid]->TimeStamp_Intermediate.push_back(Complete_Stream->Streams[pid]->TimeStamp_End+TimeToAdd); Complete_Stream->Streams[pid]->TimeStamp_Intermediate.push_back(program_clock_reference); } #endif // MEDIAINFO_ADVANCED } Complete_Stream->Streams[pid]->TimeStamp_End=program_clock_reference; Complete_Stream->Streams[pid]->TimeStamp_End_IsUpdated=true; Complete_Stream->Streams[pid]->TimeStamp_End_Offset=File_Offset+Buffer_Offset; { Status[IsUpdated]=true; Status[User_16]=true; } } } if (Complete_Stream->Streams[pid]->Searching_TimeStamp_Start) { //This is the first PCR Complete_Stream->Streams[pid]->TimeStamp_Start=program_clock_reference; Complete_Stream->Streams[pid]->TimeStamp_Start_Offset=File_Offset+Buffer_Offset; Complete_Stream->Streams[pid]->TimeStamp_End=program_clock_reference; Complete_Stream->Streams[pid]->TimeStamp_End_IsUpdated=true; Complete_Stream->Streams[pid]->TimeStamp_End_Offset=File_Offset+Buffer_Offset; Complete_Stream->Streams[pid]->Searching_TimeStamp_Start_Set(false); Complete_Stream->Streams[pid]->Searching_TimeStamp_End_Set(true); Complete_Stream->Streams_With_StartTimeStampCount++; { Status[IsUpdated]=true; Status[User_16]=true; } } //Test if we can find the TS bitrate if (!Complete_Stream->Streams[pid]->EndTimeStampMoreThanxSeconds && Complete_Stream->Streams[pid]->TimeStamp_Start!=(int64u)-1 && (File_Offset+Buffer_Offset-Buffer_TotalBytes_FirstSynched)*2Streams[pid]->TimeStamp_Start) program_clock_reference+=0x200000000LL*300; //33 bits, cyclic if ((program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_Start)>Begin_MaxDuration) { Complete_Stream->Streams[pid]->EndTimeStampMoreThanxSeconds=true; Complete_Stream->Streams_With_EndTimeStampMoreThanxSecondsCount++; if (Complete_Stream->Streams_NotParsedCount && Complete_Stream->Streams_With_StartTimeStampCount>0 && Complete_Stream->Streams_With_StartTimeStampCount==Complete_Stream->Streams_With_EndTimeStampMoreThanxSecondsCount) { //We are already parsing 16 seconds (for all PCRs), we don't hope to have more info MpegTs_JumpTo_Begin=File_Offset+Buffer_Offset-Buffer_TotalBytes_FirstSynched; if (MpegTs_JumpTo_End>MpegTs_JumpTo_Begin) MpegTs_JumpTo_End=MpegTs_JumpTo_Begin; } } } #else //MEDIAINFO_MPEGTS_PCR_YES Skip_B6( "program_clock_reference"); #endif //MEDIAINFO_MPEGTS_PCR_YES } if (OPCR_flag) { BS_Begin(); Skip_S8(33, "original_program_clock_reference_base"); Skip_S1( 6, "reserved"); Skip_S2( 9, "original_program_clock_reference_extension"); BS_End(); } if (splicing_point_flag) { Skip_B1( "splice_countdown"); } if (transport_private_data_flag) { int8u transport_private_data_length; Get_B1 (transport_private_data_length, "transport_private_data_length"); if (Element_Offset+transport_private_data_length<=Element_Pos_Save+1+adaptation_field_length) Skip_XX(transport_private_data_length, "transport_private_data"); else Skip_XX(Element_Pos_Save+1+adaptation_field_length-Element_Offset, "problem"); } if (adaptation_field_extension_flag) { int8u adaptation_field_extension_length; Get_B1 (adaptation_field_extension_length, "adaptation_field_extension_length"); if (Element_Offset+adaptation_field_extension_length<=Element_Pos_Save+1+adaptation_field_length) { Element_Begin1("adaptation_field_extension"); int64u End=Element_Offset+adaptation_field_extension_length; bool ltw_flag, piecewise_rate_flag, seamless_splice_flag; BS_Begin(); Get_SB ( ltw_flag, "ltw_flag"); Get_SB ( piecewise_rate_flag, "piecewise_rate_flag"); Get_SB ( seamless_splice_flag, "seamless_splice_flag"); Skip_S1( 5, "reserved"); if (ltw_flag) { Skip_SB( "ltw_valid_flag"); Skip_S2(15, "ltw_offset"); } if (piecewise_rate_flag) { Skip_S1( 2, "reserved"); Skip_S3(22, "piecewise_rate"); } if (seamless_splice_flag) { Skip_S1( 4, "splice_type"); int16u DTS_29, DTS_14; int8u DTS_32; Element_Begin1("DTS"); Get_S1 ( 3, DTS_32, "DTS_32"); Mark_1(); Get_S2 (15, DTS_29, "DTS_29"); Mark_1(); Get_S2 (15, DTS_14, "DTS_14"); Mark_1(); //Filling int64u DTS; DTS=(((int64u)DTS_32)<<30) | (((int64u)DTS_29)<<15) | (((int64u)DTS_14)); Element_Info_From_Milliseconds(DTS/90); Element_End0(); } BS_End(); if (Element_Offset188-4-1) //TS size - header - adaptation_field_length adaptation_field_length=188-4-1; else if (adaptation_field_length) { bool discontinuity_indicator=(Buffer[Buffer_Offset+BDAV_Size+5]&0x80)!=0; bool PCR_flag=(Buffer[Buffer_Offset+BDAV_Size+5]&0x10)!=0; if (PCR_flag) { int64u program_clock_reference=( (((int64u)Buffer[Buffer_Offset+BDAV_Size+6])<<25) | (((int64u)Buffer[Buffer_Offset+BDAV_Size+7])<<17) | (((int64u)Buffer[Buffer_Offset+BDAV_Size+8])<< 9) | (((int64u)Buffer[Buffer_Offset+BDAV_Size+9])<< 1) | (((int64u)Buffer[Buffer_Offset+BDAV_Size+10])>>7)); program_clock_reference*=300; program_clock_reference+=( (((int64u)Buffer[Buffer_Offset+BDAV_Size+10]&0x01)<<8) | (((int64u)Buffer[Buffer_Offset+BDAV_Size+11]) )); if (Complete_Stream->Streams[pid]->Searching_TimeStamp_End #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES && (!Complete_Stream->Streams[pid]->Searching_ParserTimeStamp_End || Complete_Stream->Streams[pid]->IsPCR) //If PCR, we always want it. #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES ) { Header_Parse_Events_Duration(program_clock_reference); if (program_clock_reference!=Complete_Stream->Streams[pid]->TimeStamp_End) //Some PCRs are buggy (low precision), using the first stream offset in the case of duplicate PCR value { if (Complete_Stream->Streams[pid]->TimeStamp_End_Offset!=(int64u)-1) { if (program_clock_reference+0x12c00000000LLStreams[pid]->TimeStamp_End) program_clock_reference+=0x25800000000LL; //33 bits and *300 if (!discontinuity_indicator && program_clock_reference>Complete_Stream->Streams[pid]->TimeStamp_End && program_clock_referenceStreams[pid]->TimeStamp_End+10*27000000) //Not before, not after 10 seconds, else there is a problem { float64 Duration_InstantaneousBitRate_Min=(float64)(program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End-(Config_VbrDetection_Delta?0:810)); float64 Duration_InstantaneousBitRate_Max=(float64)(program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End+(Config_VbrDetection_Delta?0:810)); float64 Bytes_InstantaneousBitRate=(float64)(File_Offset+Buffer_Offset-Complete_Stream->Streams[pid]->TimeStamp_End_Offset); float64 TimeStamp_InstantaneousBitRate_Current_Min=Bytes_InstantaneousBitRate*8/Duration_InstantaneousBitRate_Max*27000000*(1-Config_VbrDetection_Delta); float64 TimeStamp_InstantaneousBitRate_Current_Max=Bytes_InstantaneousBitRate*8/Duration_InstantaneousBitRate_Min*27000000*(1+Config_VbrDetection_Delta); if (Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Min) { if (TimeStamp_InstantaneousBitRate_Current_MaxStreams[pid]->TimeStamp_InstantaneousBitRate_Current_Min || TimeStamp_InstantaneousBitRate_Current_Min>Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Max) { Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_BitRateMode_IsVbr++; #if MEDIAINFO_ADVANCED if (Config_VbrDetection_GiveUp && Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_BitRateMode_IsVbr>=Config_VbrDetection_Occurences) Config->ParseSpeed=0; #endif // MEDIAINFO_ADVANCED } else Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_BitRateMode_IsCbr++; } float64 Duration_Min=(float64)(program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End-1); float64 Duration_Raw=(float64)(program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End); float64 Duration_Max=(float64)(program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End+1); float64 Bytes=(float64)(File_Offset+Buffer_Offset-Complete_Stream->Streams[pid]->TimeStamp_End_Offset); float64 InstantaneousBitRate_Min=Bytes*8/Duration_Max*27000000*(1-Config_VbrDetection_Delta); float64 InstantaneousBitRate_Raw=Bytes*8/Duration_Raw*27000000; float64 InstantaneousBitRate_Max=Bytes*8/Duration_Min*27000000*(1+Config_VbrDetection_Delta); Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Min=InstantaneousBitRate_Min; Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Raw=InstantaneousBitRate_Raw; Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Max=InstantaneousBitRate_Max; #if MEDIAINFO_ADVANCED if (Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Min_Raw>InstantaneousBitRate_Raw) Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Min_Raw=InstantaneousBitRate_Raw; if (Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Max_RawStreams[pid]->TimeStamp_InstantaneousBitRate_Max_Raw=InstantaneousBitRate_Raw; int64u Distance=program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_End; if (Complete_Stream->Streams[pid]->TimeStamp_Distance_Min>Distance) Complete_Stream->Streams[pid]->TimeStamp_Distance_Min=Distance; if (Complete_Stream->Streams[pid]->TimeStamp_Distance_MaxStreams[pid]->TimeStamp_Distance_Max=Distance; Complete_Stream->Streams[pid]->TimeStamp_Distance_Total+=Distance; Complete_Stream->Streams[pid]->TimeStamp_Distance_Count++; #endif // MEDIAINFO_ADVANCED } #if MEDIAINFO_ADVANCED else { if (!discontinuity_indicator) Complete_Stream->Streams[pid]->TimeStamp_HasProblems++; float64 Bytes=(float64)(File_Offset+Buffer_Offset-Complete_Stream->Streams[pid]->TimeStamp_End_Offset); int64u TimeToAdd; if (Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Raw) TimeToAdd=float64_int64s(Bytes*8/Complete_Stream->Streams[pid]->TimeStamp_InstantaneousBitRate_Current_Raw*27000000); else TimeToAdd=0; Complete_Stream->Streams[pid]->TimeStamp_Intermediate.push_back(Complete_Stream->Streams[pid]->TimeStamp_End+TimeToAdd); Complete_Stream->Streams[pid]->TimeStamp_Intermediate.push_back(program_clock_reference); } #endif // MEDIAINFO_ADVANCED } Complete_Stream->Streams[pid]->TimeStamp_End=program_clock_reference; Complete_Stream->Streams[pid]->TimeStamp_End_IsUpdated=true; Complete_Stream->Streams[pid]->TimeStamp_End_Offset=File_Offset+Buffer_Offset; { Status[IsUpdated]=true; Status[User_16]=true; } } } if (Complete_Stream->Streams[pid]->Searching_TimeStamp_Start) { //This is the first PCR Complete_Stream->Streams[pid]->TimeStamp_Start=program_clock_reference; Complete_Stream->Streams[pid]->TimeStamp_Start_Offset=File_Offset+Buffer_Offset; Complete_Stream->Streams[pid]->TimeStamp_End=program_clock_reference; Complete_Stream->Streams[pid]->TimeStamp_End_IsUpdated=true; Complete_Stream->Streams[pid]->TimeStamp_End_Offset=File_Offset+Buffer_Offset; Complete_Stream->Streams[pid]->Searching_TimeStamp_Start_Set(false); Complete_Stream->Streams[pid]->Searching_TimeStamp_End_Set(true); Complete_Stream->Streams_With_StartTimeStampCount++; { Status[IsUpdated]=true; Status[User_16]=true; } } //Test if we can find the TS bitrate if (!Complete_Stream->Streams[pid]->EndTimeStampMoreThanxSeconds && Complete_Stream->Streams[pid]->TimeStamp_Start!=(int64u)-1 && (File_Offset+Buffer_Offset-Buffer_TotalBytes_FirstSynched)*2Streams[pid]->TimeStamp_Start) program_clock_reference+=0x200000000LL*300; //33 bits, cyclic if ((program_clock_reference-Complete_Stream->Streams[pid]->TimeStamp_Start)>Begin_MaxDuration) { Complete_Stream->Streams[pid]->EndTimeStampMoreThanxSeconds=true; Complete_Stream->Streams_With_EndTimeStampMoreThanxSecondsCount++; if (Complete_Stream->Streams_NotParsedCount && Complete_Stream->Streams_With_StartTimeStampCount>0 && Complete_Stream->Streams_With_StartTimeStampCount==Complete_Stream->Streams_With_EndTimeStampMoreThanxSecondsCount) { //We are already parsing 16 seconds (for all PCRs), we don't hope to have more info MpegTs_JumpTo_Begin=File_Offset+Buffer_Offset-Buffer_TotalBytes_FirstSynched; if (MpegTs_JumpTo_End>MpegTs_JumpTo_Begin) MpegTs_JumpTo_End=MpegTs_JumpTo_Begin; } } } } } #endif //MEDIAINFO_MPEGTS_PCR_YES Element_Offset+=1+adaptation_field_length; #if MEDIAINFO_TRACE } #endif //MEDIAINFO_TRACE } //--------------------------------------------------------------------------- #if MEDIAINFO_EVENTS void File_MpegTs::Header_Parse_Events() { } #endif //MEDIAINFO_EVENTS //--------------------------------------------------------------------------- #if MEDIAINFO_EVENTS void File_MpegTs::Header_Parse_Events_Duration(int64u program_clock_reference) { } #endif //MEDIAINFO_EVENTS //--------------------------------------------------------------------------- void File_MpegTs::Data_Parse() { //Counting Frame_Count++; //TSP specific if (TSP_Size && Element_Size>TSP_Size) Element_Size-=TSP_Size; #if MEDIAINFO_DUPLICATE if (Complete_Stream->Streams[pid]->ShouldDuplicate) File__Duplicate_Write(); #endif //MEDIAINFO_DUPLICATE //Parsing if (!Complete_Stream->Streams[pid]->Searching_Payload_Start && !Complete_Stream->Streams[pid]->Searching_Payload_Continue #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES && !Complete_Stream->Streams[pid]->Searching_ParserTimeStamp_Start && !Complete_Stream->Streams[pid]->Searching_ParserTimeStamp_End #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES ) Skip_XX(Element_Size, "data"); else switch (Complete_Stream->Streams[pid]->Kind) { case complete_stream::stream::pes : PES(); break; case complete_stream::stream::psi : PSI(); break; default: ; } //TSP specific if (TSP_Size && Element_Size>TSP_Size) { Element_Size+=TSP_Size; Skip_B4( "TSP"); //TSP supplement } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_MpegTs::PES() { //Info DETAILS_INFO(if (Complete_Stream->transport_stream_id_IsValid) Element_Info1(Mpeg_Psi_stream_type_Info(Complete_Stream->Streams[pid]->stream_type, Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Complete_Stream->Streams[pid]->program_numbers[0]].registration_format_identifier));) //Demux #if MEDIAINFO_DEMUX Element_Code=pid; Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream); #endif //MEDIAINFO_DEMUX //Exists if (!Complete_Stream->Streams[pid]->IsRegistered) { Complete_Stream->Streams[pid]->IsRegistered=true; for (size_t Pos=0; PosStreams[pid]->program_numbers.size(); Pos++) if (!Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Complete_Stream->Streams[pid]->program_numbers[Pos]].IsRegistered) { Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Complete_Stream->Streams[pid]->program_numbers[Pos]].Update_Needed_IsRegistered=true; Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Complete_Stream->Streams[pid]->program_numbers[Pos]].IsRegistered=true; } Complete_Stream->Streams[pid]->IsUpdated_IsRegistered=true; Complete_Stream->PES_PIDs.insert(pid); Status[IsUpdated]=true; Status[User_19]=true; } //Case of encrypted streams if (transport_scrambling_control) { if (!Complete_Stream->Streams[pid]->Searching_Payload_Continue) Complete_Stream->Streams[pid]->Searching_Payload_Continue_Set(true); //In order to count the packets if (Complete_Stream->Streams[pid]->IsScrambled>16) { //Don't need anymore Complete_Stream->Streams[pid]->Searching_Payload_Start_Set(false); Complete_Stream->Streams[pid]->Searching_Payload_Continue_Set(false); #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES Complete_Stream->Streams[pid]->Searching_ParserTimeStamp_Start_Set(false); #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES if (!Complete_Stream->Streams[pid]->IsParsed && Complete_Stream->Streams_NotParsedCount) { Complete_Stream->Streams[pid]->IsParsed=true; Complete_Stream->Streams_NotParsedCount--; } } Skip_XX(Element_Size-Element_Offset, "Scrambled data"); return; } else if (Complete_Stream->Streams[pid]->IsScrambled) Complete_Stream->Streams[pid]->IsScrambled--; //Parser creation if (Complete_Stream->Streams[pid]->Parser==NULL) { //Waiting for first payload_unit_start_indicator if (!payload_unit_start_indicator) { Element_DoNotShow(); //We don't want to show this item because there is no interessant info return; //This is not the start of the PES } //If unknown stream_type if (Complete_Stream->transport_stream_id_IsValid && Mpeg_Psi_stream_type_StreamKind(Complete_Stream->Streams[pid]->stream_type, Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Complete_Stream->Streams[pid]->program_numbers[0]].registration_format_identifier)==Stream_Max && Complete_Stream->Streams[pid]->stream_type!=0x06 //Exception for private data && Complete_Stream->Streams[pid]->stream_type<=0x7F //Exception for private data && Mpeg_Descriptors_registration_format_identifier_StreamKind(Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Complete_Stream->Streams[pid]->program_numbers[0]].registration_format_identifier)==Stream_Max //From Descriptor && Config->File_MpegTs_stream_type_Trust_Get()) { Complete_Stream->Streams[pid]->Searching_Payload_Start_Set(false); Complete_Stream->Streams[pid]->Searching_Payload_Continue_Set(false); #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES Complete_Stream->Streams[pid]->Searching_ParserTimeStamp_Start_Set(false); Complete_Stream->Streams[pid]->Searching_ParserTimeStamp_End_Set(false); #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES if (!Complete_Stream->Streams[pid]->IsParsed && Complete_Stream->Streams_NotParsedCount) { Complete_Stream->Streams[pid]->IsParsed=true; Complete_Stream->Streams_NotParsedCount--; } return; } //Allocating an handle if needed #if defined(MEDIAINFO_MPEGPS_YES) Complete_Stream->Streams[pid]->Parser=new File_MpegPs; #if MEDIAINFO_SEEK if (Unsynch_Frame_Counts.find(pid)!=Unsynch_Frame_Counts.end()) { ((File_MpegPs*)Complete_Stream->Streams[pid]->Parser)->Unsynch_Frame_Count_Temp=Unsynch_Frame_Counts[pid]; Unsynch_Frame_Counts.erase(pid); } #endif //MEDIAINFO_SEEK #if MEDIAINFO_DEMUX if (Config_Demux) { if (Complete_Stream->Streams[pid]->stream_type==0x20 && Complete_Stream->Streams[pid]->SubStream_pid) { //Creating the demux buffer ((File_MpegPs*)Complete_Stream->Streams[pid]->Parser)->SubStream_Demux=new File_MpegPs::demux; //If main parser is already created, associating the new demux buffer if (Complete_Stream->Streams[Complete_Stream->Streams[pid]->SubStream_pid]->Parser) ((File_MpegPs*)Complete_Stream->Streams[Complete_Stream->Streams[pid]->SubStream_pid]->Parser)->SubStream_Demux=((File_MpegPs*)Complete_Stream->Streams[pid]->Parser)->SubStream_Demux; } if (Complete_Stream->Streams[pid]->stream_type!=0x20 && Complete_Stream->Streams[pid]->SubStream_pid && (File_MpegPs*)Complete_Stream->Streams[Complete_Stream->Streams[pid]->SubStream_pid]->Parser) { //If SubStream parser is already created, associating the SubStream demux buffer ((File_MpegPs*)Complete_Stream->Streams[pid]->Parser)->SubStream_Demux=((File_MpegPs*)Complete_Stream->Streams[Complete_Stream->Streams[pid]->SubStream_pid]->Parser)->SubStream_Demux; } } #endif //MEDIAINFO_DEMUX #if defined(MEDIAINFO_ARIBSTDB24B37_YES) if (FromAribStdB24B37) ((File_MpegPs*)Complete_Stream->Streams[pid]->Parser)->FromAribStdB24B37=true; #endif //defined(MEDIAINFO_ARIBSTDB24B37_YES) #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES if (Searching_TimeStamp_Start) Complete_Stream->Streams[pid]->Searching_ParserTimeStamp_Start_Set(true); ((File_MpegPs*)Complete_Stream->Streams[pid]->Parser)->Searching_TimeStamp_Start=Complete_Stream->Streams[pid]->Searching_ParserTimeStamp_Start; #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES ((File_MpegPs*)Complete_Stream->Streams[pid]->Parser)->FromTS=true; if (Config->File_MpegTs_stream_type_Trust_Get()) ((File_MpegPs*)Complete_Stream->Streams[pid]->Parser)->FromTS_stream_type=Complete_Stream->Streams[pid]->stream_type; ((File_MpegPs*)Complete_Stream->Streams[pid]->Parser)->FromTS_descriptor_tag=Complete_Stream->Streams[pid]->descriptor_tag; if (!Complete_Stream->Streams[pid]->program_numbers.empty()) ((File_MpegPs*)Complete_Stream->Streams[pid]->Parser)->FromTS_program_format_identifier=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Complete_Stream->Streams[pid]->program_numbers[0]].registration_format_identifier; ((File_MpegPs*)Complete_Stream->Streams[pid]->Parser)->FromTS_format_identifier=Complete_Stream->Streams[pid]->registration_format_identifier; ((File_MpegPs*)Complete_Stream->Streams[pid]->Parser)->MPEG_Version=2; complete_stream::transport_stream::iod_ess::iterator IOD_ES=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].IOD_ESs.find(Complete_Stream->Streams[pid]->FMC_ES_ID); if (IOD_ES!=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].IOD_ESs.end()) { #ifdef MEDIAINFO_MPEG4_YES ((File_MpegPs*)Complete_Stream->Streams[pid]->Parser)->ParserFromTs=IOD_ES->second.Parser; IOD_ES->second.Parser=NULL; ((File_MpegPs*)Complete_Stream->Streams[pid]->Parser)->SLConfig=IOD_ES->second.SLConfig; IOD_ES->second.SLConfig=NULL; #endif } #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES Complete_Stream->Streams[pid]->Parser->ShouldContinueParsing=true; #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES Complete_Stream->Streams[pid]->Searching_Payload_Continue_Set(true); #else //Filling Streams[pid]->Parser=new File_Unknown(); #endif Complete_Stream->Streams[pid]->Parser->CA_system_ID_MustSkipSlices=Complete_Stream->Streams[pid]->CA_system_ID_MustSkipSlices; #if MEDIAINFO_IBI if (Ibi.Streams[pid]==NULL) Ibi.Streams[pid]=new ibi::stream; Complete_Stream->Streams[pid]->Parser->IbiStream=Ibi.Streams[pid]; #endif //MEDIAINFO_IBI Open_Buffer_Init(Complete_Stream->Streams[pid]->Parser); } //If unsynched, waiting for first payload_unit_start_indicator if (!Complete_Stream->Streams[pid]->Parser->Synched && !payload_unit_start_indicator) { Element_DoNotShow(); //We don't want to show this item because there is no interessant info return; //This is not the start of the PES } //Parsing if (Complete_Stream->Streams[pid]->IsPCR) ((File_MpegPs*)Complete_Stream->Streams[pid]->Parser)->FrameInfo.PCR=Complete_Stream->Streams[pid]->TimeStamp_End==(int64u)-1?(int64u)-1:Complete_Stream->Streams[pid]->TimeStamp_End*1000/27; //27 MHz #if MEDIAINFO_IBI if (Complete_Stream->transport_stream_id!=(int16u)-1 && !Complete_Stream->Streams[pid]->program_numbers.empty()) { int16u Program_PID=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Complete_Stream->Streams[pid]->program_numbers[0]].pid; Complete_Stream->Streams[pid]->Parser->Ibi_SynchronizationOffset_Current=Complete_Stream->Streams[Program_PID]->Ibi_SynchronizationOffset_BeginOfFrame; if (Complete_Stream->Streams[pid]->Parser->Ibi_SynchronizationOffset_Current==(int64u)-1) return; //Not yet synchronized } else Complete_Stream->Streams[pid]->Parser->Ibi_SynchronizationOffset_Current=File_Offset+Buffer_Offset-Header_Size; #endif //MEDIAINFO_IBI #if defined(MEDIAINFO_ARIBSTDB24B37_YES) if (FromAribStdB24B37) Complete_Stream->Streams[pid]->Parser->FrameInfo=FrameInfo; #endif //defined(MEDIAINFO_ARIBSTDB24B37_YES) Open_Buffer_Continue(Complete_Stream->Streams[pid]->Parser); PES_Parse_Finish(); } //--------------------------------------------------------------------------- void File_MpegTs::PES_Parse_Finish() { if (Complete_Stream->Streams[pid]->Parser->Status[IsUpdated]) { Complete_Stream->Streams[pid]->Parser->Status[IsUpdated]=false; Complete_Stream->Streams[pid]->IsUpdated_Info=true; for (size_t Pos=0; PosStreams[pid]->program_numbers.size(); Pos++) Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Complete_Stream->Streams[pid]->program_numbers[Pos]].Update_Needed_IsRegistered=true; Status[IsUpdated]=true; Status[User_19]=true; } #if defined(MEDIAINFO_MPEGPS_YES) && defined(MEDIAINFO_MPEGTS_PESTIMESTAMP_YES) if (MpegTs_JumpTo_Begin+MpegTs_JumpTo_End>File_Size && !Complete_Stream->Streams[pid]->Searching_ParserTimeStamp_End && ((File_MpegPs*)Complete_Stream->Streams[pid]->Parser)->HasTimeStamps) { Complete_Stream->Streams[pid]->Searching_ParserTimeStamp_Start_Set(false); Complete_Stream->Streams[pid]->Searching_ParserTimeStamp_End_Set(true); } #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES //Need anymore? if (Complete_Stream->Streams[pid]->Parser->Status[IsFilled] || Complete_Stream->Streams[pid]->Parser->Status[IsFinished]) { if ((Complete_Stream->Streams[pid]->Searching_Payload_Start || Complete_Stream->Streams[pid]->Searching_Payload_Continue) && Config->ParseSpeed<1 && MpegTs_JumpTo_End) { if (Config->File_StopSubStreamAfterFilled_Get()) { Complete_Stream->Streams[pid]->Searching_Payload_Start_Set(false); Complete_Stream->Streams[pid]->Searching_Payload_Continue_Set(false); } if (!Complete_Stream->Streams[pid]->IsParsed && Complete_Stream->Streams_NotParsedCount) { Complete_Stream->Streams[pid]->IsParsed=true; Complete_Stream->Streams_NotParsedCount--; } } #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES if (Complete_Stream->Streams[pid]->Searching_ParserTimeStamp_Start) Complete_Stream->Streams[pid]->Searching_ParserTimeStamp_Start_Set(false); #else //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES if (Config->ParseSpeed<1.0) Finish(Complete_Stream->Streams[pid]->Parser); #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES } #if MEDIAINFO_SEEK && MEDIAINFO_IBI if (Seek_ID!=(int64u)-1) { if (Ibi.Streams[Seek_ID]->IsModified) { Read_Buffer_Seek(2, Seek_Value, Seek_ID); } else if (Ibi.Streams[Seek_ID]->Infos_Pos>=2 && Ibi.Streams[Seek_ID]->IsSynchronized && Ibi.Streams[Seek_ID]->Infos[Ibi.Streams[Seek_ID]->Infos_Pos-1].StreamOffset>=Seek_Value_Maximal) { InfiniteLoop_Detect++; if (InfiniteLoop_Detect>16) { //Infinite loop Seek_ID=(int64u)-1; Seek_Value=(int64u)-1; InfiniteLoop_Detect=0; Config->Demux_IsSeeking=false; } else { //No intermediate seek point found, going to previous seek point GoTo(Ibi.Streams[Seek_ID]->Infos[Ibi.Streams[Seek_ID]->Infos_Pos-2].StreamOffset); Open_Buffer_Unsynch(); } } } #endif //MEDIAINFO_SEEK && MEDIAINFO_IBI } //--------------------------------------------------------------------------- void File_MpegTs::PSI() { //Initializing if (payload_unit_start_indicator) { delete ((File_Mpeg_Psi*)Complete_Stream->Streams[pid]->Parser); Complete_Stream->Streams[pid]->Parser=new File_Mpeg_Psi; Open_Buffer_Init(Complete_Stream->Streams[pid]->Parser); ((File_Mpeg_Psi*)Complete_Stream->Streams[pid]->Parser)->Complete_Stream=Complete_Stream; ((File_Mpeg_Psi*)Complete_Stream->Streams[pid]->Parser)->pid=pid; } else if (Complete_Stream->Streams[pid]->Parser==NULL) { Skip_XX(Element_Size, "data"); return; //This is not the start of the PSI } //Parsing #if MEDIAINFO_IBI Complete_Stream->Streams[pid]->Parser->Ibi_SynchronizationOffset_Current=File_Offset+Buffer_Offset-Header_Size; #endif //MEDIAINFO_IBI Open_Buffer_Continue(Complete_Stream->Streams[pid]->Parser); //Filling if (Complete_Stream->Streams[pid]->Parser->Status[IsFilled]) { //Accept if (!Status[IsAccepted] && pid==0x0000 && Complete_Stream->Streams[pid]->Parser->Status[IsAccepted]) Accept("MPEG-TS"); //Disabling this pid delete Complete_Stream->Streams[pid]->Parser; Complete_Stream->Streams[pid]->Parser=NULL; Complete_Stream->Streams[pid]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[pid]->Searching_Payload_Continue_Set(false); //EPG if (Complete_Stream->Sources_IsUpdated || Complete_Stream->Programs_IsUpdated) { Status[IsUpdated]=true; Status[User_18]=true; } //Duration if (Complete_Stream->Duration_End_IsUpdated) { Status[IsUpdated]=true; Status[User_17]=true; } //Program change if (pid==0x0000) { Buffer_TotalBytes_LastSynched=Buffer_TotalBytes+Buffer_Offset-Header_Size; Status[IsFilled]=false; Status[IsUpdated]=true; Status[User_19]=true; } if (!Complete_Stream->Streams[pid]->Table_IDs.empty() && Complete_Stream->Streams[pid]->Table_IDs[0x02]) { Buffer_TotalBytes_LastSynched=Buffer_TotalBytes+Buffer_Offset-Header_Size; Status[IsFilled]=false; //Status[IsUpdated]=true; //Status[User_19]=true; } //Item removal if (pid==0x0000 || (!Complete_Stream->Streams[pid]->Table_IDs.empty() && Complete_Stream->Streams[pid]->Table_IDs[0x02])) { for (size_t StreamKind=Stream_General+1; StreamKindStreamPos_ToRemove[StreamKind].empty()) { sort(Complete_Stream->StreamPos_ToRemove[StreamKind].begin(), Complete_Stream->StreamPos_ToRemove[StreamKind].end()); size_t Pos=Complete_Stream->StreamPos_ToRemove[StreamKind].size(); do { Pos--; //Erasing text substreams Ztring ID_ToFind=Retrieve((stream_t)StreamKind, Complete_Stream->StreamPos_ToRemove[StreamKind][Pos], General_ID)+__T('-'); for (size_t TextPos=0; TextPosStreamPos_ToRemove[StreamKind][Pos]); //Moving other StreamPos for (size_t Pos2=Pos+1; Pos2StreamPos_ToRemove[StreamKind].size(); Pos2++) Complete_Stream->StreamPos_ToRemove[StreamKind][Pos]--; //Informing that the menu must be recalculated - TODO: only the related programs if (StreamKind!=Stream_Menu) { for (complete_stream::transport_stream::programs::iterator Program=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs.begin(); Program!=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs.end(); ++Program) Program->second.Update_Needed_StreamPos=true; } else if (Complete_Stream->StreamPos_ToRemove[StreamKind][Pos]program_number_Order.size()) { Complete_Stream->program_number_Order.erase(Complete_Stream->program_number_Order.begin()+Complete_Stream->StreamPos_ToRemove[StreamKind][Pos]); } } while (Pos); Complete_Stream->StreamPos_ToRemove[StreamKind].clear(); } Status[IsUpdated]=true; Status[User_19]=true; } } else //Waiting for more data Complete_Stream->Streams[pid]->Searching_Payload_Continue_Set(true); } //--------------------------------------------------------------------------- void File_MpegTs::SetAllToPES() { Complete_Stream->Streams_NotParsedCount=(size_t)-1; for (size_t StreamID=0; StreamID<0x2000; StreamID++) { delete Complete_Stream->Streams[StreamID]; Complete_Stream->Streams[StreamID]=new complete_stream::stream; } #ifdef MEDIAINFO_ARIBSTDB24B37_YES size_t StreamID=FromAribStdB24B37?0x00:0x20; #else //MEDIAINFO_ARIBSTDB24B37_YES size_t StreamID=0x20; #endif //MEDIAINFO_ARIBSTDB24B37_YES for (; StreamID<0x1FFF; StreamID++) { Complete_Stream->Streams[StreamID]->Kind=complete_stream::stream::pes; Complete_Stream->Streams[StreamID]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[StreamID]->Searching_Payload_Continue_Set(false); #if MEDIAINFO_TRACE if (Trace_Activated) Complete_Stream->Streams[StreamID]->Element_Info1="PES"; #endif //MEDIAINFO_TRACE #ifdef MEDIAINFO_MPEGTS_PCR_YES Complete_Stream->Streams[StreamID]->Searching_TimeStamp_Start_Set(true); Complete_Stream->Streams[StreamID]->Searching_TimeStamp_End_Set(false); #endif //MEDIAINFO_MPEGTS_PCR_YES #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES Complete_Stream->Streams[StreamID]->Searching_ParserTimeStamp_Start_Set(true); Complete_Stream->Streams[StreamID]->Searching_ParserTimeStamp_End_Set(false); #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES } Complete_Stream->NoPatPmt=true; } } //NameSpace #endif //MEDIAINFO_MPEGTS_YES MediaInfoLib/Source/MediaInfo/Multiple/File_MpegTs.h100777 0 0 11633 12254662362 15710 0/* 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 Transport Stream files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_MpegTsH #define MediaInfo_MpegTsH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Duplicate.h" #include "MediaInfo/Multiple/File_Mpeg_Psi.h" #include "MediaInfo/Duplicate/File__Duplicate_MpegTs.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_MpegTs //*************************************************************************** class File_MpegTs : #if MEDIAINFO_DUPLICATE public File__Duplicate #else //MEDIAINFO_DUPLICATE public File__Analyze #endif //MEDIAINFO_DUPLICATE { public : //In #ifdef MEDIAINFO_BDAV_YES size_t BDAV_Size; #endif #ifdef MEDIAINFO_TSP_YES size_t TSP_Size; #endif #ifdef MEDIAINFO_ARIBSTDB24B37_YES bool FromAribStdB24B37; #endif //Constructor/Destructor File_MpegTs(); ~File_MpegTs(); private : //Streams management void Streams_Accept(); void Streams_Fill(); void Streams_Update(); void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); //Buffer - Synchro bool Synchronize(); bool Synched_Test(); void Synched_Init(); //Options void Option_Manage (); //Buffer - Global void Read_Buffer_Continue(); void Read_Buffer_AfterParsing (); void Read_Buffer_Unsynched(); #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK //Buffer - Per element void Header_Parse(); void Header_Parse_AdaptationField(); void Data_Parse(); int16u pid; int8u transport_scrambling_control; bool payload_unit_start_indicator; //Global infos complete_stream* Complete_Stream; //Elements void PSI(); void PES(); void PES_Parse_Finish(); //Helpers bool Header_Parser_QuickSearch(); //Temp #if defined(MEDIAINFO_BDAV_YES) || defined(MEDIAINFO_TSP_YES) size_t TS_Size; #endif int64u MpegTs_JumpTo_Begin; int64u MpegTs_JumpTo_End; int64u Begin_MaxDuration; //in 27 MHz int64u Buffer_TotalBytes_LastSynched; bool ForceStreamDisplay; bool Searching_TimeStamp_Start; #if MEDIAINFO_EVENTS void Header_Parse_Events(); void Header_Parse_Events_Duration(int64u program_clock_reference); #else //MEDIAINFO_EVENTS inline void Header_Parse_Events() {} inline void Header_Parse_Events_Duration(int64u) {} #endif //MEDIAINFO_EVENTS //Helpers void Streams_Update_Programs(); void Streams_Update_Programs_PerStream(size_t StreamID); void Streams_Update_EPG(); void Streams_Update_EPG_PerProgram(complete_stream::transport_stream::programs::iterator Program); #ifdef MEDIAINFO_MPEGTS_PCR_YES void Streams_Update_Duration_Update(); #if MEDIAINFO_ADVANCED float64 Config_VbrDetection_Delta; int64u Config_VbrDetection_Occurences; bool Config_VbrDetection_GiveUp; #endif // MEDIAINFO_ADVANCED #endif //MEDIAINFO_MPEGTS_PCR_YES void Streams_Update_Duration_End(); void SetAllToPES(); #if MEDIAINFO_DUPLICATE //File__Duplicate void File__Duplicate_Streams_Finish (); bool File__Duplicate_Set (const Ztring &Value); //Fill a new File__Duplicate value void File__Duplicate_Write (); //Output buffer size_t Output_Buffer_Get (const String &Value); size_t Output_Buffer_Get (size_t Pos); std::vector Output_Buffer_Get_Pos; #endif //MEDIAINFO_DUPLICATE //Config bool Config_Trace_TimeSection_OnlyFirstOccurrence; bool TimeSection_FirstOccurrenceParsed; #if MEDIAINFO_SEEK std::map Unsynch_Frame_Counts; int64u Seek_Value; int64u Seek_Value_Maximal; int64u Seek_ID; size_t InfiniteLoop_Detect; bool Duration_Detected; #endif //MEDIAINFO_SEEK }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_MpegTs_Duplicate.cpp100777 0 0 36606 12226004262 20230 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Duplication helper for some specific formats // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPEGTS_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_MpegTs.h" #include "MediaInfo/MediaInfo_Config.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "ZenLib/ZtringList.h" #include "ZenLib/File.h" using namespace ZenLib; using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Format //*************************************************************************** #if MEDIAINFO_DUPLICATE void File_MpegTs::File__Duplicate_Streams_Finish () { if (!File_Name.empty()) //Only if this is not a buffer, with buffer we can have more data Complete_Stream->Duplicates_Speed_FromPID.clear(); } #endif //MEDIAINFO_DUPLICATE //*************************************************************************** // Options //*************************************************************************** //--------------------------------------------------------------------------- void File_MpegTs::Option_Manage() { if (Complete_Stream && !Complete_Stream->Streams.empty()) { #if MEDIAINFO_FILTER //File_Filter configuration if (Config->File_Filter_HasChanged()) { bool Searching_Payload_Start=!Config->File_Filter_Get(); for (int32u Pos=0x01; Pos<0x10; Pos++) Complete_Stream->Streams[Pos]->Searching_Payload_Start_Set(Searching_Payload_Start); //base PID depends of File_Filter configuration Complete_Stream->Streams[0x0000]->Searching_Payload_Start_Set(true); //program_map } #endif //MEDIAINFO_FILTER #if MEDIAINFO_DUPLICATE //File__Duplicate configuration if (File__Duplicate_HasChanged()) { for (size_t Pos=0x0000; Pos<0x2000; Pos++) Complete_Stream->Streams[Pos]->ShouldDuplicate=false; Complete_Stream->Streams[0x0000]->ShouldDuplicate=true; //For each program for (complete_stream::transport_stream::programs::iterator Program=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs.begin(); Program!=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs.end(); ++Program) { //Do we want this program? bool Wanted=false; for (std::map::iterator Duplicate=Complete_Stream->Duplicates.begin(); Duplicate!=Complete_Stream->Duplicates.end(); ++Duplicate) { if (Duplicate->second->Wanted_program_numbers.find(Program->first)!=Duplicate->second->Wanted_program_numbers.end()) Wanted=true; if (Duplicate->second->Wanted_program_map_PIDs.find(Program->second.pid)!=Duplicate->second->Wanted_program_map_PIDs.end()) Wanted=true; } //Enabling it if wanted if (Wanted) { Complete_Stream->Streams[Program->second.pid]->ShouldDuplicate=true; for (size_t Pos=0; Possecond.elementary_PIDs.size(); Pos++) Complete_Stream->Streams[Program->second.elementary_PIDs[Pos]]->ShouldDuplicate=true; } } } #endif //MEDIAINFO_DUPLICATE } } //*************************************************************************** // Set //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DUPLICATE bool File_MpegTs::File__Duplicate_Set (const Ztring &Value) { //Form: "Code;Target" <--Generic //Form: "program_number" or <--clear it //Form: "program_number;file" or <--the exported filename is filename.program_number //Form: "program_number;file://filename" or <--the exported filename is specified by user //Form: "program_number;memory" or <--This will be a MediaInfo memory block //Form: "program_number;memory://pointer:size" <--Memory block is specified by user //WARNING: program_number & pointer must be in ***DECIMAL*** format. //Example: "451;memory://123456789:1316" ZtringList List(Value); //Backward compatibility bool Orders_ToRemove_Global=false; //Searching Target bool IsForUs=true; //True by default for backward compatibility std::vector Targets_ToAdd; std::vector Targets_ToRemove; std::vector Orders_ToAdd; std::vector Orders_ToRemove; for (ZtringList::iterator Current=List.begin(); Currentfind(__T('-'))==0) { ToRemove=true; Current->erase(Current->begin()); } //Managing targets if (Current->find(__T("file:"))==0 || Current->find(__T("memory:"))==0) (ToRemove?Targets_ToRemove:Targets_ToAdd).push_back(Current); //Parser name else if (Current->find(__T("parser="))==0) { if (*Current==__T("parser=MpegTs")) IsForUs=true; else IsForUs=false; //Backward compatibility with missing parser name } //Backward compatibility with "0" else if (*Current==__T("0")) Orders_ToRemove_Global=true; //Managing orders else (ToRemove?Orders_ToRemove:Orders_ToAdd).push_back(Current); } //For us? if (!IsForUs) return false; //Backward compatibility if (Orders_ToRemove_Global) //with "0" { for (std::vector::iterator Order=Orders_ToAdd.begin(); Order::iterator Target=Targets_ToAdd.begin(); TargetDuplicates.find(**Target)==Complete_Stream->Duplicates.end()) { Complete_Stream->Duplicates[**Target]=new File__Duplicate_MpegTs(**Target); size_t Pos=Config->File__Duplicate_Memory_Indexes_Get(**Target); if (Pos!=Error) { if (Pos>=Complete_Stream->Duplicates_Speed.size()) Complete_Stream->Duplicates_Speed.resize(Pos+1); Complete_Stream->Duplicates_Speed[Pos]=Complete_Stream->Duplicates[**Target]; } } //For each order to add for (std::vector::iterator Order=Orders_ToAdd.begin(); OrderDuplicates[**Target]->Configure(**Order, false); //For each order to remove for (std::vector::iterator Order=Orders_ToRemove.begin(); OrderDuplicates[**Target]->Configure(**Order, true); } //For each target to remove for (std::vector::iterator Target=Targets_ToRemove.begin(); Target::iterator Pointer=Complete_Stream->Duplicates.find(**Target); if (Pointer!=Complete_Stream->Duplicates.end()) { //Duplicates_Speed for (std::vector::iterator Duplicate=Complete_Stream->Duplicates_Speed.begin(); DuplicateDuplicates_Speed.end(); ++Duplicate) if (*Duplicate==Pointer->second) *Duplicate=NULL; //Duplicates_Speed_FromPID for (std::vector >::iterator Duplicate_FromPID=Complete_Stream->Duplicates_Speed_FromPID.begin(); Duplicate_FromPIDDuplicates_Speed_FromPID.end(); ++Duplicate_FromPID) for (std::vector::iterator Duplicate=Duplicate_FromPID->begin(); Duplicateend(); ++Duplicate) if (*Duplicate==Pointer->second) *Duplicate=NULL; //Duplicate Complete_Stream->Duplicates.erase(**Target); } } //Informing the status has changed Complete_Stream->File__Duplicate_HasChanged_=true; if (Complete_Stream->Duplicates_Speed_FromPID.empty()) Complete_Stream->Duplicates_Speed_FromPID.resize(0x2000); Complete_Stream->Duplicates_Speed_FromPID[0x00]=Complete_Stream->Duplicates_Speed; return true; } #endif //MEDIAINFO_DUPLICATE //*************************************************************************** // Write //*************************************************************************** #if MEDIAINFO_DUPLICATE void File_MpegTs::File__Duplicate_Write () { const int8u* ToAdd=Buffer+Buffer_Offset-(size_t)Header_Size; size_t ToAdd_Size=(size_t)(Element_Size+Header_Size); std::vector &Dup_FromPID=Complete_Stream->Duplicates_Speed_FromPID[pid]; size_t Duplicates_Speed_FromPID_Size=Complete_Stream->Duplicates_Speed_FromPID[pid].size(); bool ToUpdate=false; for (size_t Pos=0; PosWrite(pid, ToAdd, ToAdd_Size)) ToUpdate=true; if (ToUpdate) { Complete_Stream->Duplicates_Speed_FromPID.clear(); Complete_Stream->Duplicates_Speed_FromPID.resize(0x2000); Complete_Stream->Duplicates_Speed_FromPID[0x0000]=Complete_Stream->Duplicates_Speed; size_t Duplicates_Speed_Size=Complete_Stream->Duplicates_Speed.size(); for (size_t Pos=0; PosDuplicates_Speed[Pos]; size_t program_map_PIDs_Size=Complete_Stream->Duplicates_Speed[Pos]->program_map_PIDs.size(); for (size_t program_map_PIDs_Pos=0; program_map_PIDs_Posprogram_map_PIDs[program_map_PIDs_Pos]) { bool AlreadyPresent=false; for (size_t Duplicates_Speed_FromPID_Pos=0; Duplicates_Speed_FromPID_PosDuplicates_Speed_FromPID[program_map_PIDs_Pos].size(); Duplicates_Speed_FromPID_Pos++) if (Complete_Stream->Duplicates_Speed_FromPID[program_map_PIDs_Pos][Duplicates_Speed_FromPID_Pos]==Dup) AlreadyPresent=true; if (!AlreadyPresent) Complete_Stream->Duplicates_Speed_FromPID[program_map_PIDs_Pos].push_back(Dup); } size_t elementary_PIDs_Size=Complete_Stream->Duplicates_Speed[Pos]->program_map_PIDs.size(); for (size_t elementary_PIDs_Pos=0; elementary_PIDs_Poselementary_PIDs[elementary_PIDs_Pos]) { bool AlreadyPresent=false; for (size_t Duplicates_Speed_FromPID_Pos=0; Duplicates_Speed_FromPID_PosDuplicates_Speed_FromPID[elementary_PIDs_Pos].size(); Duplicates_Speed_FromPID_Pos++) if (Complete_Stream->Duplicates_Speed_FromPID[elementary_PIDs_Pos][Duplicates_Speed_FromPID_Pos]==Dup) AlreadyPresent=true; if (!AlreadyPresent) Complete_Stream->Duplicates_Speed_FromPID[elementary_PIDs_Pos].push_back(Dup); } } } } #endif //MEDIAINFO_DUPLICATE //*************************************************************************** // Output_Buffer //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DUPLICATE size_t File_MpegTs::Output_Buffer_Get (const String &Code) { if (Complete_Stream==NULL) return 0; std::map::iterator Stream=Complete_Stream->Duplicates.find(Code); if (Stream==Complete_Stream->Duplicates.end()) return 0; return Stream->second->Output_Buffer_Get(); //Was used for test (AVC output), but is a lot too slow, must find something else /* if (size_t Size=Stream->second->Output_Buffer_Get()) return Size; //Parsing Parsers for (size_t Stream_Pos=0; Stream_PosOutput_Buffer_Get(Code)) return Size; return 0; */ } #endif //MEDIAINFO_DUPLICATE //--------------------------------------------------------------------------- #if MEDIAINFO_DUPLICATE size_t File_MpegTs::Output_Buffer_Get (size_t Pos) { if (Complete_Stream!=NULL && PosDuplicates_Speed.size() && Complete_Stream->Duplicates_Speed[Pos]!=NULL) if (size_t Size=Complete_Stream->Duplicates_Speed[Pos]->Output_Buffer_Get()) return Size; //Parsing Parsers /* for (size_t Stream_Pos=0; Stream_PosStreams.size(); Stream_Pos++) if (Complete_Stream->Streams[Stream_Pos].Parser) if (size_t Size=Complete_Stream->Streams[Stream_Pos].Parser->Output_Buffer_Get(Pos)) { //Optimization //if (Output_Buffer_Get_Pos.size()<=Pos) // Output_Buffer_Get_Pos.resize(Pos+1, (int16u)-1); //Output_Buffer_Get_Pos[Pos]=Stream_Pos; return Size; } */ return 0; } #endif //MEDIAINFO_DUPLICATE } //NameSpace #endif //MEDIAINFO_MPEGTS_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Mpeg_Descriptors.cpp100777 0 0 447366 12226004262 20341 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPEGPS_YES) || defined(MEDIAINFO_MPEGTS_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Mpeg_Descriptors.h" #ifdef MEDIAINFO_MPEG4_YES #include "MediaInfo/Multiple/File_Mpeg4_Descriptors.h" #endif #include using namespace std; using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constants //*************************************************************************** namespace Elements { const int32u AC_3=0x41432D33; //Exactly AC-3 const int32u BSSD=0x42535344; //PCM const int32u CUEI=0x43554549; //SCTE const int32u DTS1=0x44545331; //DTS const int32u DTS2=0x44545332; //DTS const int32u DTS3=0x44545333; //DTS const int32u GA94=0x47413934; //ATSC - Terrestrial const int32u HDMV=0x48444D56; //BluRay const int32u HEVC=0x48455643; //HEVC const int32u KLVA=0x4B4C5641; //KLV Packets const int32u S14A=0x53313441; //ATSC - Satellite const int32u SCTE=0x53435445; //SCTE const int32u TSHV=0x54534856; //TSHV const int32u VC_1=0x56432D31; //Exactly VC-1 const int32u drac=0x64726163; //Dirac const int32u MANZ=0x4D414E5A; //Manzanita Systems const int32u DVB =0x00000001; //Forced value, does not exist is stream } //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- //Extern extern const char* Avc_profile_idc(int8u profile_idc); //--------------------------------------------------------------------------- const char* Mpeg_Descriptors_audio_type(int8u ID) { switch (ID) { case 0x00 : return "Undefined"; case 0x01 : return "Clean effects"; case 0x02 : return "Hearing impaired"; case 0x03 : return "Visual impaired commentary"; default : return "Reserved"; } } const char* Mpeg_Descriptors_alignment_type(int8u alignment_type) { switch (alignment_type) { case 0x01 : return "Slice or video access unit (Video), or sync word (Audio)"; case 0x02 : return "Video access unit"; case 0x03 : return "GOP, or SEQ"; case 0x04 : return "SEQ"; default : return "Reserved"; } } const char* Mpeg_Descriptors_teletext_type(int8u teletext_type) { switch (teletext_type) { case 0x01 : return "Teletext"; case 0x02 : return "Teletext Subtitle"; case 0x03 : return "Teletext"; //additional information page case 0x04 : return "Teletext"; //programme schedule page case 0x05 : return "Teletext Subtitle"; //for hearing impaired people default : return "reserved for future use"; } } const char* Mpeg_Descriptors_content_nibble_level_1(int8u content_nibble_level_1) { switch (content_nibble_level_1) { case 0x00 : return "undefined"; case 0x01 : return "movie/drama"; case 0x02 : return "news/current affairs"; case 0x03 : return "show/game show"; case 0x04 : return "sports"; case 0x05 : return "children's/youth programmes"; case 0x06 : return "music/ballet/dance"; case 0x07 : return "arts/culture (without music)"; case 0x08 : return "social/political issues/economics"; case 0x09 : return "education/science/factual topics"; case 0x0A : return "leisure hobbies"; case 0x0B : return "Special characteristics:"; default : if (content_nibble_level_1==0x0F) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_content_nibble_level_2_01(int8u content_nibble_level_2) { switch (content_nibble_level_2) { case 0x00 : return "movie/drama"; case 0x01 : return "detective/thriller"; case 0x02 : return "adventure/western/war"; case 0x03 : return "science fiction/fantasy/horror"; case 0x04 : return "comedy"; case 0x05 : return "soap/melodrama/folkloric"; case 0x06 : return "romance"; case 0x07 : return "serious/classical/religious/historical movie/drama"; case 0x08 : return "adult movie/drama"; default : if (content_nibble_level_2==0x0F) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_content_nibble_level_2_02(int8u content_nibble_level_2) { switch (content_nibble_level_2) { case 0x00 : return "news/current affairs"; case 0x01 : return "news/weather report"; case 0x02 : return "news magazine"; case 0x03 : return "documentary"; case 0x04 : return "discussion/interview/debate"; default : if (content_nibble_level_2==0x0F) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_content_nibble_level_2_03(int8u content_nibble_level_2) { switch (content_nibble_level_2) { case 0x00 : return "show/game show"; case 0x01 : return "game show/quiz/contest"; case 0x02 : return "variety show"; case 0x03 : return "talk show"; default : if (content_nibble_level_2==0x0F) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_content_nibble_level_2_04(int8u content_nibble_level_2) { switch (content_nibble_level_2) { case 0x00 : return "sports"; case 0x01 : return "special events"; case 0x02 : return "sports magazines"; case 0x03 : return "football/soccer"; case 0x04 : return "tennis/squash"; case 0x05 : return "team sports (excluding football)"; case 0x06 : return "athletics"; case 0x07 : return "motor sport"; case 0x08 : return "water sport"; case 0x09 : return "winter sports"; case 0x0A : return "equestrian"; case 0x0B : return "martial sports"; default : if (content_nibble_level_2==0x0F) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_content_nibble_level_2_05(int8u content_nibble_level_2) { switch (content_nibble_level_2) { case 0x00 : return "children's/youth programmes"; case 0x01 : return "pre-school children's programmes"; case 0x02 : return "entertainment programmes for 6 to 14"; case 0x03 : return "entertainment programmes for 10 to 16"; case 0x04 : return "informational/educational/school programmes"; case 0x05 : return "cartoons/puppets"; default : if (content_nibble_level_2==0x0F) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_content_nibble_level_2_06(int8u content_nibble_level_2) { switch (content_nibble_level_2) { case 0x00 : return "music/ballet/dance"; case 0x01 : return "rock/pop"; case 0x02 : return "serious music/classical music"; case 0x03 : return "folk/traditional music"; case 0x04 : return "jazz"; case 0x05 : return "musical/opera"; case 0x06 : return "ballet"; default : if (content_nibble_level_2==0x0F) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_content_nibble_level_2_07(int8u content_nibble_level_2) { switch (content_nibble_level_2) { case 0x00 : return "arts/culture (without music)"; case 0x01 : return "performing arts"; case 0x02 : return "fine arts"; case 0x03 : return "religion"; case 0x04 : return "popular culture/traditional arts"; case 0x05 : return "literature"; case 0x06 : return "film/cinema"; case 0x07 : return "experimental film/video"; case 0x08 : return "broadcasting/press"; case 0x09 : return "new media"; case 0x0A : return "arts/culture magazines"; case 0x0B : return "fashion"; default : if (content_nibble_level_2==0x0F) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_content_nibble_level_2_08(int8u content_nibble_level_2) { switch (content_nibble_level_2) { case 0x00 : return "social/political issues/economics"; case 0x01 : return "magazines/reports/documentary"; case 0x02 : return "economics/social advisory"; case 0x03 : return "remarkable people"; default : if (content_nibble_level_2==0x0F) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_content_nibble_level_2_09(int8u content_nibble_level_2) { switch (content_nibble_level_2) { case 0x00 : return "education/science/factual topics"; case 0x01 : return "nature/animals/environment"; case 0x02 : return "technology/natural sciences"; case 0x03 : return "medicine/physiology/psychology"; case 0x04 : return "foreign countries/expeditions"; case 0x05 : return "social/spiritual sciences"; case 0x06 : return "further education"; case 0x07 : return "languages"; default : if (content_nibble_level_2==0x0F) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_content_nibble_level_2_0A(int8u content_nibble_level_2) { switch (content_nibble_level_2) { case 0x00 : return "leisure hobbies"; case 0x01 : return "tourism/travel"; case 0x02 : return "handicraft"; case 0x03 : return "motoring"; case 0x04 : return "fitness and health"; case 0x05 : return "cooking"; case 0x06 : return "advertisement/shopping"; case 0x07 : return "gardening"; default : if (content_nibble_level_2==0x0F) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_content_nibble_level_2_0B(int8u content_nibble_level_2) { switch (content_nibble_level_2) { case 0x00 : return "original language"; case 0x01 : return "black and white"; case 0x02 : return "unpublished"; case 0x03 : return "live broadcast"; default : if (content_nibble_level_2==0x0F) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_content_nibble_level_2(int8u content_nibble_level_1, int8u content_nibble_level_2) { switch (content_nibble_level_1) { case 0x00 : return "undefined"; case 0x01 : return Mpeg_Descriptors_content_nibble_level_2_01(content_nibble_level_2); case 0x02 : return Mpeg_Descriptors_content_nibble_level_2_02(content_nibble_level_2); case 0x03 : return Mpeg_Descriptors_content_nibble_level_2_03(content_nibble_level_2); case 0x04 : return Mpeg_Descriptors_content_nibble_level_2_04(content_nibble_level_2); case 0x05 : return Mpeg_Descriptors_content_nibble_level_2_05(content_nibble_level_2); case 0x06 : return Mpeg_Descriptors_content_nibble_level_2_06(content_nibble_level_2); case 0x07 : return Mpeg_Descriptors_content_nibble_level_2_07(content_nibble_level_2); case 0x08 : return Mpeg_Descriptors_content_nibble_level_2_08(content_nibble_level_2); case 0x09 : return Mpeg_Descriptors_content_nibble_level_2_09(content_nibble_level_2); case 0x0A : return Mpeg_Descriptors_content_nibble_level_2_0A(content_nibble_level_2); case 0x0B : return Mpeg_Descriptors_content_nibble_level_2_0B(content_nibble_level_2); default : if (content_nibble_level_1==0x0F) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_linkage_type(int8u linkage_type) { switch (linkage_type) { case 0x00 : return "reserved for future use"; case 0x01 : return "information service"; case 0x02 : return "Electronic Programme Guide (EPG) service"; case 0x03 : return "CA replacement service"; case 0x04 : return "transport stream containing complete Network/Bouquet SI"; case 0x05 : return "service replacement service"; case 0x06 : return "data broadcast service"; case 0xFF : return "reserved for future use"; default : if (linkage_type>=0x80) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_dvb_service_type(int8u service_type) { switch (service_type) { case 0x01 : return "digital television"; case 0x02 : return "digital radio"; case 0x03 : return "teletext"; case 0x04 : return "NVOD reference"; case 0x05 : return "NVOD time-shifted"; case 0x06 : return "Mosaic"; case 0x0A : return "advanced codec digital radio sound"; case 0x0B : return "advanced codec mosaic service"; case 0x0C : return "data broadcast"; case 0x0D : return "reserved for Common Interface Usage"; case 0x0E : return "RCS Map"; case 0x0F : return "RCS FLS"; case 0x10 : return "DVB MHP"; case 0x11 : return "MPEG-2 HD digital television"; case 0x16 : return "advanced codec SD digital television"; case 0x17 : return "advanced codec SD NVOD time-shifted"; case 0x18 : return "advanced codec SD NVOD reference"; case 0x19 : return "advanced codec HD digital television"; case 0x1A : return "advanced codec HD NVOD time-shifted"; case 0x1B : return "advanced codec HD NVOD reference"; case 0xFF : return "reserved for future use"; default : if (service_type>=0x80) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_stream_content(int8u stream_content) { switch (stream_content) { case 0x01 : return "MPEG-2 Video"; case 0x02 : return "MPEG-1 Audio L2"; case 0x03 : return "Subtitle"; case 0x04 : return "AC3"; case 0x05 : return "AVC"; case 0x06 : return "HE-AAC"; case 0x07 : return "DTS"; default : if (stream_content>=0x0C) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_component_type_O1(int8u component_type) { switch (component_type) { case 0x01 : return "4:3 aspect ratio, 25 Hz"; case 0x02 : return "16:9 aspect ratio with pan vectors, 25 Hz"; case 0x03 : return "16:9 aspect ratio without pan vectors, 25 Hz"; case 0x04 : return ">16:9 aspect ratio, 25 Hz"; case 0x05 : return "4:3 aspect ratio, 30 Hz"; case 0x06 : return "16:9 aspect ratio with pan vectors, 30 Hz"; case 0x07 : return "16:9 aspect ratio without pan vectors, 30 Hz"; case 0x08 : return ">16:9 aspect ratio, 30 Hz"; case 0x09 : return "4:3 aspect ratio, 25 Hz (high definition)"; case 0x0A : return "16:9 aspect ratio with pan vectors, 25 Hz (high definition)"; case 0x0B : return "16:9 aspect ratio without pan vectors, 25 Hz (high definition)"; case 0x0C : return ">16:9 aspect ratio, 25 Hz (high definition)"; case 0x0D : return "4:3 aspect ratio, 30 Hz (high definition)"; case 0x0E : return "16:9 aspect ratio with pan vectors, 30 Hz (high definition)"; case 0x0F : return "16:9 aspect ratio without pan vectors, 30 Hz (high definition)"; case 0x10 : return ">16:9 aspect ratio, 30 Hz (high definition)"; default : if (component_type>=0xB0 && component_type<=0xFE) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_component_type_O2(int8u component_type) { switch (component_type) { case 0x01 : return "single mono channel"; case 0x02 : return "dual mono channel"; case 0x03 : return "stereo (2 channel)"; case 0x04 : return "multi-lingual, multi-channel"; case 0x05 : return "surround sound"; case 0x40 : return "description for the visually impaired"; case 0x41 : return "for the hard of hearing"; case 0x42 : return "receiver-mixed supplementary audio"; default : if (component_type>=0xB0 && component_type<=0xFE) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_component_type_O3(int8u component_type) { switch (component_type) { case 0x01 : return "EBU Teletext subtitles"; case 0x02 : return "associated EBU Teletext"; case 0x03 : return "VBI data"; case 0x10 : return "DVB subtitle (normal) with no monitor aspect ratio criticality"; case 0x11 : return "DVB subtitle (normal) for display on 4:3 aspect ratio monitor"; case 0x12 : return "DVB subtitle (normal) for display on 16:9 aspect ratio monitor"; case 0x13 : return "DVB subtitle (normal) for display on 2.21:1 aspect ratio monitor"; case 0x20 : return "DVB subtitle (for the hard of hearing) with no monitor aspect ratio criticality"; case 0x21 : return "DVB subtitle (for the hard of hearing) for display on 4:3 aspect ratio monitor"; case 0x22 : return "DVB subtitle (for the hard of hearing) for display on 16:9 aspect ratio monitor"; case 0x23 : return "DVB subtitle (for the hard of hearing) for display on 2.21:1 aspect ratio monitor"; default : if (component_type>=0xB0 && component_type<=0xFE) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_component_type_O4(int8u) { return "Defined by AC3"; } const char* Mpeg_Descriptors_component_type_O5(int8u component_type) { switch (component_type) { case 0x01 : return "4:3 aspect ratio, 25 Hz"; case 0x03 : return "16:9 aspect ratio, 25 Hz"; case 0x04 : return ">16:9 aspect ratio, 25 Hz"; case 0x05 : return "4:3 aspect ratio, 30 Hz"; case 0x07 : return "16:9 aspect ratio, 30 Hz"; case 0x08 : return ">16:9 aspect ratio, 30 Hz"; case 0x0B : return "16:9 aspect ratio, 25 Hz (high definition)"; case 0x0C : return ">16:9 aspect ratio, 25 Hz (high definition)"; case 0x0F : return "16:9 aspect ratio, 30 Hz (high definition)"; case 0x10 : return ">16:9 aspect ratio, 30 Hz (high definition)"; default : if (component_type>=0xB0 && component_type<=0xFE) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_component_type_O6(int8u component_type) { switch (component_type) { case 0x01 : return "single mono channel"; case 0x03 : return "stereo"; case 0x05 : return "surround sound"; case 0x40 : return "description for the visually impaired"; case 0x41 : return "for the hard of hearing"; case 0x42 : return "receiver-mixed supplementary audio"; case 0x43 : return "astereo (v2)"; case 0x44 : return "description for the visually impaired (v2)"; case 0x45 : return "for the hard of hearing (v2)"; case 0x46 : return "receiver-mixed supplementary audio (v2)"; default : if (component_type>=0xB0 && component_type<=0xFE) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_component_type_O7(int8u) { return "Defined by DTS"; } const char* Mpeg_Descriptors_codepage_1(int8u codepage) { switch (codepage) { case 0x01 : return "ISO/IEC 8859-5 (Cyrillic)"; case 0x02 : return "ISO/IEC 8859-6 (Arabic)"; case 0x03 : return "ISO/IEC 8859-7 (Greek)"; case 0x04 : return "ISO/IEC 8859-8 (Hebrew)"; case 0x05 : return "ISO/IEC 8859-9 (Latin)"; case 0x06 : return "ISO/IEC 8859-10 (Latin)"; case 0x07 : return "ISO/IEC 8859-11 (Thai)"; case 0x08 : return "ISO/IEC 8859-12 (Indian)"; case 0x09 : return "ISO/IEC 8859-13 (Latin)"; case 0x0A : return "ISO/IEC 8859-14 (Celtic)"; case 0x0B : return "ISO/IEC 8859-15 (Latin)"; case 0x11 : return "ISO/IEC 10646-1 (Basic Multilingual Plane)"; case 0x12 : return "KSC5601-1987 (Korean)"; case 0x13 : return "GB-2312-1980 (Simplified Chinese)"; case 0x14 : return "Big5 (Traditional Chinese)"; case 0x15 : return "UTF-8 (Basic Multilingual Plane)"; default : return "reserved for future use"; } } const char* Mpeg_Descriptors_component_type(int8u stream_content, int8u component_type) { switch (stream_content) { case 0x01 : return Mpeg_Descriptors_component_type_O1(component_type); case 0x02 : return Mpeg_Descriptors_component_type_O2(component_type); case 0x03 : return Mpeg_Descriptors_component_type_O3(component_type); case 0x04 : return Mpeg_Descriptors_component_type_O4(component_type); case 0x05 : return Mpeg_Descriptors_component_type_O5(component_type); case 0x06 : return Mpeg_Descriptors_component_type_O6(component_type); case 0x07 : return Mpeg_Descriptors_component_type_O7(component_type); default : if (component_type>=0xB0 && component_type<=0xFE) return "user defined"; else return "reserved for future use"; } } const char* Mpeg_Descriptors_registration_format_identifier_Format(int32u format_identifier) { switch (format_identifier) { case Elements::AC_3 : return "AC-3"; case Elements::BSSD : return "PCM"; //AES3 case Elements::CUEI : return "SCTE 35 2003 - Digital Program Insertion Cueing Message for Cable"; case Elements::DTS1 : return "DTS"; //512 case Elements::DTS2 : return "DTS"; //1024 case Elements::DTS3 : return "DTS"; //2048 case Elements::GA94 : return "ATSC - Terrestrial"; case Elements::HDMV : return "Blu-ray"; case Elements::HEVC : return "HEVC"; case Elements::KLVA : return "KLV"; case Elements::S14A : return "ATSC - Satellite"; case Elements::SCTE : return "SCTE 54 2003 - DV Service Multiplex and Transport System for Cable Television"; case Elements::TSHV : return "DV"; case Elements::VC_1 : return "VC-1"; case Elements::MANZ : return "Manzanita Systems"; //Manzanita Systems default : return ""; } } stream_t Mpeg_Descriptors_registration_format_identifier_StreamKind(int32u format_identifier) { switch (format_identifier) { case Elements::AC_3 : return Stream_Audio; case Elements::BSSD : return Stream_Audio; case Elements::DTS1 : return Stream_Audio; case Elements::DTS2 : return Stream_Audio; case Elements::DTS3 : return Stream_Audio; case Elements::HEVC : return Stream_Video; case Elements::VC_1 : return Stream_Video; default : return Stream_Max; } } const char* Mpeg_Descriptors_stream_Format(int8u descriptor_tag, int32u format_identifier) { switch (descriptor_tag) { case 0x02 : return "MPEG Video"; case 0x03 : return "MPEG Audio"; case 0x1B : return "MPEG-4 Visual"; case 0x1C : return "AAC"; case 0x28 : return "AVC"; case 0x2B : return "AAC"; case 0x2D : return "Text"; default : switch (format_identifier) { case Elements::CUEI : case Elements::SCTE : //SCTE case Elements::GA94 : case Elements::S14A : //ATSC switch (descriptor_tag) { case 0x81 : return "AC-3"; default : return ""; } case Elements::AC_3 : return "AC-3"; case Elements::DTS1 : return "DTS"; case Elements::DTS2 : return "DTS"; case Elements::DTS3 : return "DTS"; case Elements::KLVA : return "KLV"; case Elements::HEVC : return "HEVC"; case Elements::VC_1 : return "VC-1"; case Elements::drac : return "Dirac"; default : switch (descriptor_tag) { case 0x56 : return "Teletext"; case 0x59 : return "DVB Subtitle"; case 0x6A : return "AC-3"; case 0x7A : return "E-AC-3"; case 0x7B : return "DTS"; case 0x7C : return "AAC"; case 0x81 : return "AC-3"; default : return ""; } } } } const char* Mpeg_Descriptors_stream_Codec(int8u descriptor_tag, int32u format_identifier) { switch (descriptor_tag) { case 0x02 : return "MPEG-V"; case 0x03 : return "MPEG-A"; case 0x1B : return "MPEG-4V"; case 0x1C : return "AAC"; case 0x28 : return "AVC"; case 0x2B : return "AAC"; case 0x2D : return "Text"; default : switch (format_identifier) { case Elements::CUEI : case Elements::SCTE : //SCTE case Elements::GA94 : case Elements::S14A : //ATSC switch (descriptor_tag) { case 0x81 : return "AC3"; default : return ""; } case Elements::AC_3 : return "AC3"; case Elements::DTS1 : return "DTS"; case Elements::DTS2 : return "DTS"; case Elements::DTS3 : return "DTS"; case Elements::KLVA : return "KLV"; case Elements::HEVC : return "HEVC"; case Elements::VC_1 : return "VC-1"; case Elements::drac : return "Dirac"; default : switch (descriptor_tag) { case 0x56 : return "Teletext"; case 0x59 : return "DVB Subtitle"; case 0x6A : return "AC3"; case 0x7A : return "AC3+"; case 0x7B : return "DTS"; case 0x7C : return "AAC"; case 0x81 : return "AC3"; default : return ""; } } } } stream_t Mpeg_Descriptors_stream_Kind(int8u descriptor_tag, int32u format_identifier) { switch (descriptor_tag) { case 0x02 : return Stream_Video; case 0x03 : return Stream_Audio; case 0x1B : return Stream_Video; case 0x1C : return Stream_Audio; case 0x28 : return Stream_Video; case 0x2B : return Stream_Audio; case 0x2D : return Stream_Text; default : switch (format_identifier) { case Elements::CUEI : case Elements::SCTE : //SCTE case Elements::GA94 : case Elements::S14A : //ATSC switch (descriptor_tag) { case 0x81 : return Stream_Audio; default : return Stream_Max; } case Elements::AC_3 : return Stream_Audio; case Elements::DTS1 : return Stream_Audio; case Elements::DTS2 : return Stream_Audio; case Elements::DTS3 : return Stream_Audio; case Elements::HEVC : return Stream_Video; case Elements::VC_1 : return Stream_Video; case Elements::drac : return Stream_Video; default : switch (descriptor_tag) { case 0x56 : return Stream_Text; case 0x59 : return Stream_Text; case 0x6A : return Stream_Audio; case 0x7A : return Stream_Audio; case 0x7B : return Stream_Audio; case 0x7C : return Stream_Audio; case 0x81 : return Stream_Audio; default : return Stream_Max; } } } } const char* Mpeg_Descriptors_MPEG_4_audio_profile_and_level(int8u MPEG_4_audio_profile_and_level) { switch (MPEG_4_audio_profile_and_level) { case 0x10 : return "Main@L1"; case 0x11 : return "Main@L2"; case 0x12 : return "Main@L3"; case 0x13 : return "Main@L4"; case 0x18 : return "Scalable@L1"; case 0x19 : return "Scalable@L2"; case 0x1A : return "Scalable@L3"; case 0x1B : return "Scalable@L4"; case 0x20 : return "Speech@L1"; case 0x21 : return "Speech@L2"; case 0x28 : return "Synthesis@L1"; case 0x29 : return "Synthesis@L2"; case 0x2A : return "Synthesis@L3"; case 0x30 : return "High quality audio@L1"; case 0x31 : return "High quality audio@L2"; case 0x32 : return "High quality audio@L3"; case 0x33 : return "High quality audio@L4"; case 0x34 : return "High quality audio@L5"; case 0x35 : return "High quality audio@L6"; case 0x36 : return "High quality audio@L7"; case 0x37 : return "High quality audio@L8"; case 0x38 : return "Low delay audio@L1"; case 0x39 : return "Low delay audio@L2"; case 0x3A : return "Low delay audio@L3"; case 0x3B : return "Low delay audio@L4"; case 0x3C : return "Low delay audio@L5"; case 0x3D : return "Low delay audio@L6"; case 0x3E : return "Low delay audio@L7"; case 0x3F : return "Low delay audio@L8"; case 0x40 : return "Natural audio@L1"; case 0x41 : return "Natural audio@L2"; case 0x42 : return "Natural audio@L3"; case 0x43 : return "Natural audio@L4"; case 0x48 : return "Mobile audio internetworking@L1"; case 0x49 : return "Mobile audio internetworking@L2"; case 0x4A : return "Mobile audio internetworking@L3"; case 0x4B : return "Mobile audio internetworking@L4"; case 0x4C : return "Mobile audio internetworking@L5"; case 0x4D : return "Mobile audio internetworking@L6"; case 0x50 : return "LC@L1"; case 0x51 : return "LC@L2"; case 0x52 : return "LC@L3"; case 0x53 : return "LC@L4"; case 0x58 : return "HE-AAC@L2 / LC@L2"; case 0x59 : return "HE-AAC@L3 / LC@L3"; case 0x5A : return "HE-AAC@L4 / LC@L4"; case 0x5B : return "HE-AAC@L5 / LC@L5"; case 0x60 : return "HE-AACv2@L2 / HE-AAC@L2 / LC@L2"; case 0x61 : return "HE-AACv2@L3 / HE-AAC@L3 / LC@L3"; case 0x62 : return "HE-AACv2@L4 / HE-AAC@L4 / LC@L4"; case 0x63 : return "HE-AACv2@L5 / HE-AAC@L5 / LC@L5"; default : return ""; } } //--------------------------------------------------------------------------- extern const float32 Mpegv_frame_rate[]; //In Video/File_Mpegv.cpp extern const char* Mpegv_Colorimetry_format[]; //In Video/File_Mpegv.cpp extern const char* Mpegv_profile_and_level_indication_profile[]; //In Video/File_Mpegv.cpp extern const char* Mpegv_profile_and_level_indication_level[]; //In Video/File_Mpegv.cpp //--------------------------------------------------------------------------- extern const char* Mpega_Version[]; //In Audio/File_Mpega.cpp extern const char* Mpega_Layer[]; //In Audio/File_Mpega.cpp extern const char* Mpega_Format_Profile_Version[]; //In Audio/File_Mpega.cpp extern const char* Mpega_Format_Profile_Layer[]; //In Audio/File_Mpega.cpp //--------------------------------------------------------------------------- extern const int32u AC3_SamplingRate[]; //In Audio/File_Ac3.cpp extern const int16u AC3_BitRate[]; //In Audio/File_Ac3.cpp extern const char* AC3_ChannelPositions[]; //In Audio/File_Ac3.cpp extern const int8u AC3_Channels[]; //In Audio/File_Ac3.cpp extern const char* AC3_Mode[]; //In Audio/File_Ac3.cpp extern const char* AC3_Surround[]; //In Audio/File_Ac3.cpp const char* Mpeg_Descriptors_AC3_Channels[]= { "1", "2", "2", "2", "3+", "6+", "", "", }; const char* Mpeg_Descriptors_AC3_Priority[]= { "", "Primary Audio", "Other Audio", "", }; //--------------------------------------------------------------------------- const char* Mpeg_Descriptors_bandwidth[]= { "8 MHz", "7 MHz", "6 MHz", "5 MHz", "", "", "", "", }; //--------------------------------------------------------------------------- const char* Mpeg_Descriptors_constellation[]= { "QPSK", "16-QAM", "64-QAM", "", }; //--------------------------------------------------------------------------- const char* Mpeg_Descriptors_hierarchy_information[]= { "non-hierarchical, native interleaver", "1, native interleaver", "2, native interleaver", "4, native interleaver", "non-hierarchical, in-depth interleaver", "1, in-depth interleaver", "2, in-depth interleaver", "4, in-depth interleaver", }; //--------------------------------------------------------------------------- const char* Mpeg_Descriptors_code_rate[]= { "1/2", "2/3", "3/4", "5/6", "7/8", "", "", "", }; //--------------------------------------------------------------------------- const char* Mpeg_Descriptors_guard_interval[]= { "1/32", "1/16", "1/8", "1/4", }; //--------------------------------------------------------------------------- const char* Mpeg_Descriptors_transmission_mode[]= { "2k mode", "8k mode", "4k mode", "", }; //--------------------------------------------------------------------------- const char* Mpeg_Descriptors_original_network_id(int16u original_network_id) { switch (original_network_id) { case 0x0001 : return "Astra Satellite Network 19,2'E"; case 0x0002 : return "Astra Satellite Network 28,2'E"; case 0x0003 : return "Astra 1"; case 0x0004 : return "Astra 2"; case 0x0005 : return "Astra 3"; case 0x0006 : return "Astra 4"; case 0x0007 : return "Astra 5"; case 0x0008 : return "Astra 6"; case 0x0009 : return "Astra 7"; case 0x000A : return "Astra 8"; case 0x000B : return "Astra 9"; case 0x000C : return "Astra 10"; case 0x000D : return "Astra 11"; case 0x000E : return "Astra 12"; case 0x000F : return "Astra 13"; case 0x0010 : return "Astra 14"; case 0x0011 : return "Astra 15"; case 0x0012 : return "Astra 16"; case 0x0013 : return "Astra 17"; case 0x0014 : return "Astra 18"; case 0x0015 : return "Astra 19"; case 0x0016 : return "Astra 20"; case 0x0017 : return "Astra 21"; case 0x0018 : return "Astra 22"; case 0x0019 : return "Astra 23"; case 0x0020 : return "ASTRA"; case 0x0021 : return "Hispasat Network 1"; case 0x0022 : return "Hispasat Network 2"; case 0x0023 : return "Hispasat Network 3"; case 0x0024 : return "Hispasat Network 4"; case 0x0025 : return "Hispasat Network 5"; case 0x0026 : return "Hispasat Network 6"; case 0x0027 : return "Hispasat 30'W (FSS)"; case 0x0028 : return "Hispasat 30'W (DBS)"; case 0x0029 : return "Hispasat 30'W (America)"; case 0x0030 : return "Canal+ Satellite Network"; case 0x0031 : return "Hispasat VIA DIGITAL"; case 0x0032 : return "Hispasat Network 7"; case 0x0033 : return "Hispasat Network 8"; case 0x0034 : return "Hispasat Network 9"; case 0x0035 : return "Nethold Main Mux System"; case 0x0037 : return "STENTOR"; case 0x0040 : return "HPT Croatian Post and Telecommunications"; case 0x0041 : return "Mindport"; case 0x0046 : return "1 degree W (Telenor)"; case 0x0047 : return "1 degree W (Telenor)"; case 0x0050 : return "HRT Croatian Radio and Television"; case 0x0051 : return "Havas"; case 0x0052 : return "Osaka Yusen Satellite"; case 0x0055 : return "Sirius Satellite System"; case 0x0058 : return "Thiacom 1 & 2 co-located 78.5'E (UBC Thailand)"; case 0x005E : return "Sirius Satellite System (Nordic Coverage)"; case 0x005F : return "Sirius Satellite System (FSS)"; case 0x0060 : return "Deutsche Telekom"; case 0x0069 : return "Optus B3 156'E"; case 0x0070 : return "BONUM1 36 Degrees East (NTV+)"; case 0x007E : return "Eutelsat Satellite System at 7'E"; case 0x0073 : return "PanAmSat 4 68.5'E"; case 0x0085 : return "BetaTechnik"; case 0x0090 : return "TDF"; case 0x00A0 : return "News Datacom"; case 0x00A1 : return "News Datacom"; case 0x00A2 : return "News Datacom"; case 0x00A3 : return "News Datacom"; case 0x00A4 : return "News Datacom"; case 0x00A5 : return "News Datacom"; case 0x00A6 : return "ART"; case 0x00A7 : return "Globecast"; case 0x00A8 : return "Foxtel"; case 0x00A9 : return "Sky New Zealand"; case 0x00B0 : return "TPS"; case 0x00B1 : return "TPS"; case 0x00B2 : return "TPS"; case 0x00B3 : return "TPS"; case 0x00B4 : return "Telesat 107.3'W"; case 0x00B5 : return "Telesat 111.1'W"; case 0x00BA : return "Satellite Express 6 (80'E)"; case 0x00C0 : return "Canal+"; case 0x00C1 : return "Canal+"; case 0x00C2 : return "Canal+"; case 0x00C3 : return "Canal+"; case 0x00C4 : return "Canal+"; case 0x00C5 : return "Canal+"; case 0x00C6 : return "Canal+"; case 0x00C7 : return "Canal+"; case 0x00C8 : return "Canal+"; case 0x00C9 : return "Canal+"; case 0x00CA : return "Canal+"; case 0x00CB : return "Canal+"; case 0x00CC : return "Canal+"; case 0x00CD : return "Canal+"; case 0x0100 : return "ExpressVu Express"; case 0x010E : return "Eutelsat Satellite System at 10'E"; case 0x0110 : return "Mediaset"; case 0x013E : return "Eutelsat Satellite System at 13'E"; case 0x016E : return "Eutelsat Satellite System at 16'E"; case 0x029E : return "Eutelsat Satellite System at 29'E"; case 0x02BE : return "Arabsat Arabsat (Scientific Atlanta, Eutelsat)"; case 0x036E : return "Eutelsat Satellite System at 36'E"; case 0x03E8 : return "Telia"; case 0x048E : return "Eutelsat Satellite System at 48'E"; case 0x0800 : return "Nilesat 101"; case 0x0801 : return "Nilesat 101"; case 0x0880 : return "MEASAT 1, 91.5'E"; case 0x0882 : return "MEASAT 2, 91.5'E"; case 0x0883 : return "MEASAT 2, 148.0'E"; case 0x088F : return "MEASAT 3"; case 0x1000 : return "Optus B3 156'E Optus Communications"; case 0x1001 : return "DISH Network Echostar Communications"; case 0x1002 : return "Dish Network 61.5 W Echostar Communications"; case 0x1003 : return "Dish Network 83 W Echostar Communications"; case 0x1004 : return "Dish Network 119 W Echostar Communications"; case 0x1005 : return "Dish Network 121 W Echostar Communications"; case 0x1006 : return "Dish Network 148 W Echostar Communications"; case 0x1007 : return "Dish Network 175 W Echostar Communications"; case 0x1008 : return "Dish Network W Echostar Communications"; case 0x1009 : return "Dish Network X Echostar Communications"; case 0x100A : return "Dish Network Y Echostar Communications"; case 0x100B : return "Dish Network Z Echostar Communications"; case 0x2000 : return "Thiacom 1 & 2 co-located 78.5'E"; case 0x22D4 : return "Spanish Digital Terrestrial Television"; case 0x22F1 : return "Swedish Digital Terrestrial Television"; case 0x233A : return "UK Digital Terrestrial Television"; case 0x2024 : return "Australian Digital Terrestrial Television"; case 0x2114 : return "German Digital Terrestrial Television"; case 0x3000 : return "PanAmSat 4 68.5'E"; case 0x5000 : return "Irdeto Mux System"; case 0xF000 : return "Small Cable networks"; case 0xF001 : return "Deutsche Telekom"; case 0xF010 : return "Telefonica Cable"; case 0xF020 : return "Cable and Wireless Communication"; case 0xFBFC : return "MATAV"; case 0xFBFD : return "Telia Kabel-TV"; case 0xFBFE : return "TPS"; case 0xFBFF : return "Stream"; case 0xFC00 : return "France Telecom Cable"; case 0xFC10 : return "Rhone Vision Cable"; case 0xFD00 : return "Lyonnaise Communications"; case 0xFE00 : return "TeleDenmark Cable TV"; default : return ""; } } //--------------------------------------------------------------------------- const char* Mpeg_Descriptors_CA_system_ID(int16u CA_system_ID) { switch (CA_system_ID) { case 0x0100 : return "Seca Mediaguard 1/2"; case 0x0101 : return "RusCrypto"; case 0x0464 : return "EuroDec"; case 0x0500 : return "TPS-Crypt or Viaccess"; case 0x0602 : case 0x0604 : case 0x0606 : case 0x0608 : case 0x0622 : case 0x0626 : return "Irdeto"; case 0x0700 : return "DigiCipher 2"; case 0x0911 : case 0x0919 : case 0x0960 : case 0x0961 : return "NDS Videoguard 1/2"; case 0x0B00 : return "Conax CAS 5 /7"; case 0x0D00 : case 0x0D02 : case 0x0D03 : case 0x0D05 : case 0x0D07 : case 0x0D20 : return "Cryptoworks"; case 0x0E00 : return "PowerVu"; case 0x1000 : return "RAS (Remote Authorisation System)"; case 0x1702 : case 0x1722 : case 0x1762 : return "BetaCrypt 1 or Nagravision"; case 0x1710 : return "BetaCrypt 2"; case 0x1800 : case 0x1801 : case 0x1810 : case 0x1830 : return "Nagravision"; case 0x22F0 : return "Codicrypt"; case 0x2600 : return "BISS"; case 0x4800 : return "Accessgate"; case 0x4900 : return "China Crypt"; case 0x4A10 : return "EasyCas"; case 0x4A20 : return "AlphaCrypt"; case 0x4A60 : case 0x4A61 : case 0x4A63 : return "SkyCrypt or Neotioncrypt or Neotion SHL"; case 0x4A70 : return "DreamCrypt"; case 0x4A80 : return "ThalesCrypt"; case 0x4AA1 : return "KeyFly"; case 0x4ABF : return "DG-Crypt"; case 0x4AD0 : case 0x4AD1 : return "X-Crypt"; case 0x4AD4 : return "OmniCrypt"; case 0x4AE0 : return "RossCrypt"; case 0x4B13 : return "PlayReady"; case 0x5500 : return "Z-Crypt or DRE-Crypt"; case 0x5501 : return "Griffin"; default : return "Encrypted"; } } //--------------------------------------------------------------------------- bool Mpeg_Descriptors_CA_system_ID_MustSkipSlices(int16u CA_system_ID) { switch (CA_system_ID) { case 0x4B13 : // PlayReady return true; default : return false; //We try, it is not sure } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Mpeg_Descriptors::File_Mpeg_Descriptors() { //In Complete_Stream=NULL; transport_stream_id=0x0000; pid=0x0000; table_id=0x00; table_id_extension=0x0000; elementary_PID=0x0000; program_number=0x0000; stream_type=0x00; event_id=0x0000; elementary_PID_IsValid=false; program_number_IsValid=false; stream_type_IsValid=false; event_id_IsValid=false; //Out } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::FileHeader_Parse() { Accept(); } //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Header_Parse() { int8u descriptor_tag=0, descriptor_length=0; Get_B1 (descriptor_tag, "descriptor_tag"); Get_B1 (descriptor_length, "descriptor_length"); //Size if (Element_Size) Header_Fill_Size(Element_Size); if (Element_Offset) Header_Fill_Size(Element_Offset); if (descriptor_length) Header_Fill_Size(descriptor_length); if (Element_Size 0x00 && table_id<0x40) { switch (Element_Code) { ELEMENT_CASE(00, "Reserved"); ELEMENT_CASE(01, "Reserved"); ELEMENT_CASE(02, "video_stream"); ELEMENT_CASE(03, "audio_stream"); ELEMENT_CASE(04, "hierarchy"); ELEMENT_CASE(05, "registration"); ELEMENT_CASE(06, "data_stream_alignment"); ELEMENT_CASE(07, "target_background_grid"); ELEMENT_CASE(08, "Video_window"); ELEMENT_CASE(09, "CA"); ELEMENT_CASE(0A, "ISO_639_language"); ELEMENT_CASE(0B, "System_clock"); ELEMENT_CASE(0C, "Multiplex_buffer_utilization"); ELEMENT_CASE(0D, "Copyright"); ELEMENT_CASE(0E, "Maximum_bitrate"); ELEMENT_CASE(0F, "Private_data_indicator"); ELEMENT_CASE(10, "Smoothing_buffer"); ELEMENT_CASE(11, "STD"); ELEMENT_CASE(12, "IBP"); ELEMENT_CASE(13, "Defined in ISO/IEC 13818-6"); ELEMENT_CASE(14, "Defined in ISO/IEC 13818-6"); ELEMENT_CASE(15, "Defined in ISO/IEC 13818-6"); ELEMENT_CASE(16, "Defined in ISO/IEC 13818-6"); ELEMENT_CASE(17, "Defined in ISO/IEC 13818-6"); ELEMENT_CASE(18, "Defined in ISO/IEC 13818-6"); ELEMENT_CASE(19, "Defined in ISO/IEC 13818-6"); ELEMENT_CASE(1A, "Defined in ISO/IEC 13818-6"); ELEMENT_CASE(1B, "MPEG-4_video"); ELEMENT_CASE(1C, "MPEG-4_audio"); ELEMENT_CASE(1D, "IOD"); ELEMENT_CASE(1E, "SL"); ELEMENT_CASE(1F, "FMC"); ELEMENT_CASE(20, "External_ES_ID"); ELEMENT_CASE(21, "MuxCode"); ELEMENT_CASE(22, "FmxBufferSize"); ELEMENT_CASE(23, "multiplexbuffer"); ELEMENT_CASE(24, "content_labeling"); ELEMENT_CASE(25, "metadata_pointer"); ELEMENT_CASE(26, "metadata"); ELEMENT_CASE(27, "metadata_STD"); ELEMENT_CASE(28, "AVC video"); ELEMENT_CASE(29, "IPMP"); //ISO-IEC 13818-11 ELEMENT_CASE(2A, "AVC timing and HRD"); ELEMENT_CASE(2B, "MPEG-2 AAC audio"); ELEMENT_CASE(2C, "FlexMux_Timing"); ELEMENT_CASE(2D, "MPEG-4_text"); ELEMENT_CASE(2E, "MPEG-4_audio_extension"); ELEMENT_CASE(2F, "Auxiliary_video_data"); ELEMENT_CASE(30, "SVC extension"); ELEMENT_CASE(31, "MVC extension"); ELEMENT_CASE(32, "J2K video"); ELEMENT_CASE(33, "MVC operation point"); ELEMENT_CASE(34, "MPEG2_stereoscopic_video_format"); ELEMENT_CASE(35, "Stereoscopic_program_info"); ELEMENT_CASE(36, "Stereoscopic_video_info"); ELEMENT_CASE(37, "ODUpdate"); ELEMENT_CASE(38, "Transport_profile"); ELEMENT_CASE(39, "HEVC video"); ELEMENT_CASE(3A, "HEVC timing and HRD"); ELEMENT_CASE(3F, "Extension"); //Following is in private sections, in case there is not network type detected ELEMENT_CASE(40, "DVB - network_name_descriptor"); ELEMENT_CASE(41, "DVB - service_list_descriptor"); ELEMENT_CASE(42, "DVB - stuffing_descriptor"); ELEMENT_CASE(43, "DVB - satellite_delivery_system_descriptor"); ELEMENT_CASE(44, "DVB - cable_delivery_system_descriptor"); ELEMENT_CASE(45, "DVB - VBI_data_descriptor"); ELEMENT_CASE(46, "DVB - VBI_teletext_descriptor"); ELEMENT_CASE(47, "DVB - bouquet_name_descriptor"); ELEMENT_CASE(48, "DVB - service_descriptor"); ELEMENT_CASE(49, "DVB - country_availability_descriptor"); ELEMENT_CASE(4A, "DVB - linkage_descriptor"); ELEMENT_CASE(4B, "DVB - NVOD_reference_descriptor"); ELEMENT_CASE(4C, "DVB - time_shifted_service_descriptor"); ELEMENT_CASE(4D, "DVB - short_event_descriptor"); ELEMENT_CASE(4E, "DVB - extended_event_descriptor"); ELEMENT_CASE(4F, "DVB - time_shifted_event_descriptor"); ELEMENT_CASE(50, "DVB - component_descriptor"); ELEMENT_CASE(51, "DVB - mosaic_descriptor"); ELEMENT_CASE(52, "DVB - stream_identifier_descriptor"); ELEMENT_CASE(53, "DVB - CA_identifier_descriptor"); ELEMENT_CASE(54, "DVB - content_descriptor"); ELEMENT_CASE(55, "DVB - parental_rating_descriptor"); ELEMENT_CASE(56, "DVB - teletext_descriptor"); ELEMENT_CASE(57, "DVB - telephone_descriptor"); ELEMENT_CASE(58, "DVB - local_time_offset_descriptor"); ELEMENT_CASE(59, "DVB - subtitling_descriptor"); ELEMENT_CASE(5A, "DVB - terrestrial_delivery_system_descriptor"); ELEMENT_CASE(5B, "DVB - multilingual_network_name_descriptor"); ELEMENT_CASE(5C, "DVB - multilingual_bouquet_name_descriptor"); ELEMENT_CASE(5D, "DVB - multilingual_service_name_descriptor"); ELEMENT_CASE(5E, "DVB - multilingual_component_descriptor"); ELEMENT_CASE(5F, "DVB - private_data_specifier_descriptor"); ELEMENT_CASE(60, "DVB - service_move_descriptor"); ELEMENT_CASE(61, "DVB - short_smoothing_buffer_descriptor"); ELEMENT_CASE(62, "DVB - frequency_list_descriptor"); ELEMENT_CASE(63, "DVB - partial_transport_stream_descriptor"); ELEMENT_CASE(64, "DVB - data_broadcast_descriptor"); ELEMENT_CASE(65, "DVB - scrambling_descriptor"); ELEMENT_CASE(66, "DVB - data_broadcast_id_descriptor"); ELEMENT_CASE(67, "DVB - transport_stream_descriptor"); ELEMENT_CASE(68, "DVB - DSNG_descriptor"); ELEMENT_CASE(69, "DVB - PDC_descriptor"); ELEMENT_CASE(6A, "DVB - AC-3_descriptor"); ELEMENT_CASE(6B, "DVB - ancillary_data_descriptor"); ELEMENT_CASE(6C, "DVB - cell_list_descriptor"); ELEMENT_CASE(6D, "DVB - cell_frequency_link_descriptor"); ELEMENT_CASE(6E, "DVB - announcement_support_descriptor"); ELEMENT_CASE(6F, "DVB - application_signalling_descriptor"); ELEMENT_CASE(70, "DVB - adaptation_field_data_descriptor"); ELEMENT_CASE(71, "DVB - service_identifier_descriptor"); ELEMENT_CASE(72, "DVB - service_availability_descriptor"); ELEMENT_CASE(73, "DVB - default_authority_descriptor"); ELEMENT_CASE(74, "DVB - related_content_descriptor"); ELEMENT_CASE(75, "DVB - TVA_id_descriptor"); ELEMENT_CASE(76, "DVB - content_identifier_descriptor"); ELEMENT_CASE(77, "DVB - time_slice_fec_identifier_descriptor"); ELEMENT_CASE(78, "DVB - ECM_repetition_rate_descriptor"); ELEMENT_CASE(79, "DVB - S2_satellite_delivery_system_descriptor"); ELEMENT_CASE(7A, "DVB - enhanced_AC-3_descriptor"); ELEMENT_CASE(7B, "DVB - DTS descriptor"); ELEMENT_CASE(7C, "DVB - AAC descriptor"); ELEMENT_CASE(7D, "DVB - reserved for future use"); ELEMENT_CASE(7E, "DVB - reserved for future use"); ELEMENT_CASE(7F, "DVB - extension descriptor"); ELEMENT_CASE(80, "ATSC - stuffing"); ELEMENT_CASE(81, "ATSC - AC-3 audio"); ELEMENT_CASE(86, "ATSC - caption service"); ELEMENT_CASE(87, "ATSC - content advisory"); ELEMENT_CASE(A0, "ATSC - extended channel name"); ELEMENT_CASE(A1, "ATSC - service location"); ELEMENT_CASE(A2, "ATSC - time-shifted service"); ELEMENT_CASE(A3, "ATSC - component name"); ELEMENT_CASE(A8, "ATSC - DCC Departing Request"); ELEMENT_CASE(A9, "ATSC - DCC Arriving Request"); ELEMENT_CASE(AA, "ATSC - Redistribution Control"); ELEMENT_CASE(AB, "ATSC - DCC Location Code"); ELEMENT_CASE(C1, "ARIB - Digital Copy Control"); ELEMENT_CASE(C8, "ARIB - Video Decode Control"); ELEMENT_CASE(DE, "ARIB - Content Availability"); ELEMENT_CASE(FC, "ARIB - Emergency Information"); ELEMENT_CASE(FD, "ARIB - Data Component"); default: if (Element_Code>=0x40) Element_Info1("user private"); else Element_Info1("unknown"); Skip_XX(Element_Size, "Data"); break; } } else if (table_id>=0x40 && table_id<0x80) { switch (Element_Code) { ELEMENT_CASE(40, "DVB - network_name_descriptor"); ELEMENT_CASE(41, "DVB - service_list_descriptor"); ELEMENT_CASE(42, "DVB - stuffing_descriptor"); ELEMENT_CASE(43, "DVB - satellite_delivery_system_descriptor"); ELEMENT_CASE(44, "DVB - cable_delivery_system_descriptor"); ELEMENT_CASE(45, "DVB - VBI_data_descriptor"); ELEMENT_CASE(46, "DVB - VBI_teletext_descriptor"); ELEMENT_CASE(47, "DVB - bouquet_name_descriptor"); ELEMENT_CASE(48, "DVB - service_descriptor"); ELEMENT_CASE(49, "DVB - country_availability_descriptor"); ELEMENT_CASE(4A, "DVB - linkage_descriptor"); ELEMENT_CASE(4B, "DVB - NVOD_reference_descriptor"); ELEMENT_CASE(4C, "DVB - time_shifted_service_descriptor"); ELEMENT_CASE(4D, "DVB - short_event_descriptor"); ELEMENT_CASE(4E, "DVB - extended_event_descriptor"); ELEMENT_CASE(4F, "DVB - time_shifted_event_descriptor"); ELEMENT_CASE(50, "DVB - component_descriptor"); ELEMENT_CASE(51, "DVB - mosaic_descriptor"); ELEMENT_CASE(52, "DVB - stream_identifier_descriptor"); ELEMENT_CASE(53, "DVB - CA_identifier_descriptor"); ELEMENT_CASE(54, "DVB - content_descriptor"); ELEMENT_CASE(55, "DVB - parental_rating_descriptor"); ELEMENT_CASE(56, "DVB - teletext_descriptor"); ELEMENT_CASE(57, "DVB - telephone_descriptor"); ELEMENT_CASE(58, "DVB - local_time_offset_descriptor"); ELEMENT_CASE(59, "DVB - subtitling_descriptor"); ELEMENT_CASE(5A, "DVB - terrestrial_delivery_system_descriptor"); ELEMENT_CASE(5B, "DVB - multilingual_network_name_descriptor"); ELEMENT_CASE(5C, "DVB - multilingual_bouquet_name_descriptor"); ELEMENT_CASE(5D, "DVB - multilingual_service_name_descriptor"); ELEMENT_CASE(5E, "DVB - multilingual_component_descriptor"); ELEMENT_CASE(5F, "DVB - private_data_specifier_descriptor"); ELEMENT_CASE(60, "DVB - service_move_descriptor"); ELEMENT_CASE(61, "DVB - short_smoothing_buffer_descriptor"); ELEMENT_CASE(62, "DVB - frequency_list_descriptor"); ELEMENT_CASE(63, "DVB - partial_transport_stream_descriptor"); ELEMENT_CASE(64, "DVB - data_broadcast_descriptor"); ELEMENT_CASE(65, "DVB - scrambling_descriptor"); ELEMENT_CASE(66, "DVB - data_broadcast_id_descriptor"); ELEMENT_CASE(67, "DVB - transport_stream_descriptor"); ELEMENT_CASE(68, "DVB - DSNG_descriptor"); ELEMENT_CASE(69, "DVB - PDC_descriptor"); ELEMENT_CASE(6A, "DVB - AC-3_descriptor"); ELEMENT_CASE(6B, "DVB - ancillary_data_descriptor"); ELEMENT_CASE(6C, "DVB - cell_list_descriptor"); ELEMENT_CASE(6D, "DVB - cell_frequency_link_descriptor"); ELEMENT_CASE(6E, "DVB - announcement_support_descriptor"); ELEMENT_CASE(6F, "DVB - application_signalling_descriptor"); ELEMENT_CASE(70, "DVB - adaptation_field_data_descriptor"); ELEMENT_CASE(71, "DVB - service_identifier_descriptor"); ELEMENT_CASE(72, "DVB - service_availability_descriptor"); ELEMENT_CASE(73, "DVB - default_authority_descriptor"); ELEMENT_CASE(74, "DVB - related_content_descriptor"); ELEMENT_CASE(75, "DVB - TVA_id_descriptor"); ELEMENT_CASE(76, "DVB - content_identifier_descriptor"); ELEMENT_CASE(77, "DVB - time_slice_fec_identifier_descriptor"); ELEMENT_CASE(78, "DVB - ECM_repetition_rate_descriptor"); ELEMENT_CASE(79, "DVB - S2_satellite_delivery_system_descriptor"); ELEMENT_CASE(7A, "DVB - enhanced_AC-3_descriptor"); ELEMENT_CASE(7B, "DVB - DTS descriptor"); ELEMENT_CASE(7C, "DVB - AAC descriptor"); ELEMENT_CASE(7D, "DVB - reserved for future use"); ELEMENT_CASE(7E, "DVB - reserved for future use"); ELEMENT_CASE(7F, "DVB - extension descriptor"); default: if (Element_Code>=0x40) Element_Info1("user private"); else Element_Info1("unknown"); Skip_XX(Element_Size, "Data"); break; } } else if ((table_id>=0xC0 && table_id<0xE0)) { switch (Element_Code) { ELEMENT_CASE(80, "ATSC - stuffing"); ELEMENT_CASE(81, "ATSC - AC-3 audio"); ELEMENT_CASE(86, "ATSC - caption service"); ELEMENT_CASE(87, "ATSC - content advisory"); ELEMENT_CASE(A0, "ATSC - extended channel name"); ELEMENT_CASE(A1, "ATSC - service location"); ELEMENT_CASE(A2, "ATSC - time-shifted service"); ELEMENT_CASE(A3, "ATSC - component name"); ELEMENT_CASE(A8, "ATSC - DCC Departing Request"); ELEMENT_CASE(A9, "ATSC - DCC Arriving Request"); ELEMENT_CASE(AA, "ATSC - Redistribution Control"); ELEMENT_CASE(AB, "ATSC - DCC Location Code"); default: if (Element_Code>=0x40) Element_Info1("user private"); else Element_Info1("unknown"); Skip_XX(Element_Size, "Data"); break; } } else if (table_id==0xFC) { //SCTE 35 #undef ELEMENT_CASE #define ELEMENT_CASE(_NAME, _DETAIL) \ case 0x##_NAME : Element_Name(_DETAIL); CUEI_##_NAME(); break; switch (Element_Code) { ELEMENT_CASE(00, "SCTE35 - avail_descriptor"); ELEMENT_CASE(01, "SCTE35 - DTMF_descriptor"); ELEMENT_CASE(02, "SCTE35 - segmentation_descriptor"); default: Element_Info1("SCTE35 - Reserved"); Skip_XX(Element_Size, "Data"); break; } } else { if (Element_Code>=0x40) Element_Info1("user private"); else Element_Info1("unknown"); Skip_XX(Element_Size, "Data"); } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_02() { //Parsing int8u frame_rate_code; bool multiple_frame_rate_flag, MPEG_1_only_flag; int8u profile_and_level_indication_profile=4, profile_and_level_indication_level=10, chroma_format=1; bool frame_rate_extension_flag=false; BS_Begin(); Get_SB ( multiple_frame_rate_flag, "multiple_frame_rate_flag"); Get_S1 (4, frame_rate_code, "frame_rate_code"); Param_Info1(Mpegv_frame_rate[frame_rate_code]); Get_SB ( MPEG_1_only_flag, "MPEG_1_only_flag"); Skip_SB( "constrained_parameter_flag"); Skip_SB( "still_picture_flag"); if (MPEG_1_only_flag==0) { Skip_SB( "profile_and_level_indication_escape"); Get_S1 (3, profile_and_level_indication_profile, "profile_and_level_indication_profile"); Param_Info1(Mpegv_profile_and_level_indication_profile[profile_and_level_indication_profile]); Get_S1 (4, profile_and_level_indication_level, "profile_and_level_indication_level"); Param_Info1(Mpegv_profile_and_level_indication_level[profile_and_level_indication_level]); Get_S1 (2, chroma_format, "chroma_format"); Param_Info1(Mpegv_Colorimetry_format[chroma_format]); Get_SB ( frame_rate_extension_flag, "frame_rate_extension_flag"); Skip_S1(5, "reserved"); } BS_End(); //Filling FILLING_BEGIN(); switch (table_id) { case 0x02 : //program_map_section if (elementary_PID_IsValid) { if (!multiple_frame_rate_flag && !frame_rate_extension_flag && frame_rate_code) Complete_Stream->Streams[elementary_PID]->Infos["FrameRate"]=Ztring::ToZtring(Mpegv_frame_rate[frame_rate_code]); Complete_Stream->Streams[elementary_PID]->Infos["Format_Version"]=MPEG_1_only_flag?__T("Version 1"):__T("Version 2"); Complete_Stream->Streams[elementary_PID]->Infos["Colorimetry"]=Mpegv_Colorimetry_format[chroma_format]; if (profile_and_level_indication_profile) { Complete_Stream->Streams[elementary_PID]->Infos["Format_Profile"]=Ztring().From_Local(Mpegv_profile_and_level_indication_profile[profile_and_level_indication_profile])+__T("@")+Ztring().From_Local(Mpegv_profile_and_level_indication_level[profile_and_level_indication_level]); Complete_Stream->Streams[elementary_PID]->Infos["Codec_Profile"]=Ztring().From_Local(Mpegv_profile_and_level_indication_profile[profile_and_level_indication_profile])+__T("@")+Ztring().From_Local(Mpegv_profile_and_level_indication_level[profile_and_level_indication_level]); } } break; default : ; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_03() { //Parsing int8u ID, layer; bool variable_rate_audio_indicator; BS_Begin(); Skip_SB( "free_format_flag"); Get_S1 (1, ID, "ID"); Param_Info1(Mpega_Version[2+ID]); //Mpega_Version is with MPEG2.5 hack Get_S1 (2, layer, "layer"); Param_Info1(Mpega_Layer[layer]); Get_SB ( variable_rate_audio_indicator, "variable_rate_audio_indicator"); Skip_S1(3, "reserved"); BS_End(); FILLING_BEGIN(); if (elementary_PID_IsValid) { Complete_Stream->Streams[elementary_PID]->Infos["BitRate_Mode"]=variable_rate_audio_indicator?__T("VBR"):__T("CBR"); Complete_Stream->Streams[elementary_PID]->Infos["Codec"]=Ztring(Mpega_Version[ID])+Ztring(Mpega_Layer[layer]); Complete_Stream->Streams[elementary_PID]->Infos["Format"]=__T("MPEG Audio"); Complete_Stream->Streams[elementary_PID]->Infos["Format_Version"]=Mpega_Format_Profile_Version[ID]; Complete_Stream->Streams[elementary_PID]->Infos["Format_Profile"]=Mpega_Format_Profile_Layer[layer]; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_05() { //Parsing int32u format_identifier; Get_B4 (format_identifier, "format_identifier"); Element_Info1(Mpeg_Descriptors_registration_format_identifier_Format(format_identifier)); Param_Info1(Mpeg_Descriptors_registration_format_identifier_Format(format_identifier)); if (Element_Size-Element_Offset>0) Skip_XX(Element_Size-Element_Offset, "additional_identification_info"); FILLING_BEGIN(); switch (table_id) { case 0x02 : //program_map_section switch (elementary_PID_IsValid) { case false : //Per program Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[table_id_extension].registration_format_identifier=format_identifier; break; case true : //Per PES Complete_Stream->Streams[elementary_PID]->registration_format_identifier=format_identifier; Complete_Stream->Streams[elementary_PID]->Infos["format_identifier"]=Ztring().From_CC4(format_identifier); if (Complete_Stream->Streams[elementary_PID]->Infos["format_identifier"].size()!=4) { Ztring Temp; Temp.From_Number(format_identifier, 16); if (Temp.size()<8) Temp.insert(0, 8-Temp.size(), __T('0')); Complete_Stream->Streams[elementary_PID]->Infos["format_identifier"]=__T("0x")+Temp; } Complete_Stream->Streams[elementary_PID]->Infos_Option["format_identifier"]=__T("N NT"); if (format_identifier==Elements::KLVA) { Complete_Stream->Streams[elementary_PID]->Infos["Format"]=__T("KLV"); Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[table_id_extension].HasNotDisplayableStreams=true; } //Coherency if (stream_type==0x81 && Complete_Stream->Streams[elementary_PID]->registration_format_identifier==Elements::BSSD) Complete_Stream->Streams[elementary_PID]->registration_format_identifier=0x00000000; //Reseting it, this combinaision is not possible but a stream has it break; } break; default : ; } FILLING_ELSE() switch (table_id) { case 0x02 : //program_map_section switch (elementary_PID_IsValid) { case false : //Per program break; case true : //Per PES Complete_Stream->Streams[elementary_PID]->Infos["format_identifier"]=__T("(INVALID)"); Complete_Stream->Streams[elementary_PID]->Infos_Option["format_identifier"]=__T("N NT"); break; } break; default : ; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_06() { //Parsing Info_B1(alignment_type, "alignment_type"); Param_Info1(Mpeg_Descriptors_alignment_type(alignment_type)); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_07() { //Parsing BS_Begin(); Skip_S1(14, "horizontal_size"); Skip_S1(14, "vertical_size"); Skip_S1( 4, "aspect_ratio_information"); //Same as ISO/IEC 13818-2 BS_End(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_08() { //Parsing BS_Begin(); Skip_S1(14, "horizontal_offset"); Skip_S1(14, "vertical_offset"); Skip_S1( 4, "window_priority"); BS_End(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_09() { //Parsing int16u CA_system_ID, CA_PID; Get_B2 (CA_system_ID, "CA_system_ID"); Param_Info1(Mpeg_Descriptors_CA_system_ID(CA_system_ID)); BS_Begin(); Skip_S1( 3, "reserved"); Get_S2 (13, CA_PID, "CA_PID"); BS_End(); if (Element_Size-Element_Offset>0) Skip_XX(Element_Size-Element_Offset, "private_data_byte"); FILLING_BEGIN(); switch (table_id) { case 0x01 : //conditional_access_section if (Complete_Stream->Streams[CA_PID]->Kind==complete_stream::stream::unknown) //Priority to PES, if this is a PES, we skip the CA { Complete_Stream->Streams[CA_PID]->Kind=complete_stream::stream::psi; Complete_Stream->Streams[CA_PID]->Table_IDs.resize(0x100); #ifdef MEDIAINFO_MPEGTS_ALLSTREAMS_YES Complete_Stream->Streams[CA_PID]->Searching_Payload_Start_Set(true); #endif } break; case 0x02 : //program_map_section if (elementary_PID_IsValid) { Complete_Stream->Streams[elementary_PID]->CA_system_ID=CA_system_ID; Complete_Stream->Streams[elementary_PID]->CA_system_ID_MustSkipSlices=Mpeg_Descriptors_CA_system_ID_MustSkipSlices(CA_system_ID); if (CA_PIDStreams.size() && Complete_Stream->Streams[CA_PID]->Kind==complete_stream::stream::unknown) //Priority to PES, if this is a PES, we skip the CA { Complete_Stream->Streams[CA_PID]->Kind=complete_stream::stream::psi; Complete_Stream->Streams[CA_PID]->Table_IDs.resize(0x100); #ifdef MEDIAINFO_MPEGTS_ALLSTREAMS_YES Complete_Stream->Streams[CA_PID]->Searching_Payload_Start_Set(true); #endif } } break; default : ; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_0A() { //Parsing int32u ISO_639_language_code; int8u audio_type; Get_C3 (ISO_639_language_code, "ISO_639_language_code"); Get_B1 (audio_type, "audio_type"); Param_Info1(Mpeg_Descriptors_audio_type(audio_type)); FILLING_BEGIN(); switch (table_id) { case 0x02 : //program_map_section if (elementary_PID_IsValid) { Ztring ISO_639_2; if (ISO_639_language_code) ISO_639_2.From_CC3(ISO_639_language_code); const Ztring& ISO_639_1=MediaInfoLib::Config.Iso639_1_Get(ISO_639_2); Complete_Stream->Streams[elementary_PID]->Infos["Language"]=ISO_639_1.empty()?ISO_639_2:ISO_639_1; if (audio_type) Complete_Stream->Streams[elementary_PID]->Infos["Language_More"]=Mpeg_Descriptors_audio_type(audio_type); } break; default : ; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_0B() { //Parsing int8u clock_accuracy_integer, clock_accuracy_exponent; BS_Begin(); Skip_SB( "external_clock_reference_indicator"); Skip_SB( "reserved"); Get_S1 (6, clock_accuracy_integer, "clock_accuracy_integer"); Get_S1 (3, clock_accuracy_exponent, "clock_accuracy_exponent"); Param_Info1(Ztring::ToZtring(clock_accuracy_integer*(int64u)pow(10.0, clock_accuracy_exponent))); Skip_S1(5, "reserved"); BS_End(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_0D() { //Parsing int32u copyright_identifier; Get_B4 (copyright_identifier, "copyright_identifier"); if ((copyright_identifier&0xFF000000)>=0x61000000 && (copyright_identifier&0xFF000000)<=0x7A000000 && (copyright_identifier&0x00FF0000)>=0x00610000 && (copyright_identifier&0x00FF0000)<=0x007A0000 && (copyright_identifier&0x0000FF00)>=0x00006100 && (copyright_identifier&0x0000FF00)<=0x00007A00 && (copyright_identifier&0x000000FF)>=0x00000061 && (copyright_identifier&0x000000FF)<=0x0000007A) { Param_Info1(Ztring().From_CC4(copyright_identifier)); Element_Info1(Ztring().From_CC4(copyright_identifier)); } if (copyright_identifier==Elements::MANZ) { if (Element_OffsetTransport_Streams[Complete_Stream->transport_stream_id].Infos["Encoded_Library"]=__T("Manzanita Systems"); } if (Element_OffsetStreams[elementary_PID]->Infos["BitRate_Maximum"]=Ztring::ToZtring(maximum_bitrate*400); else Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[table_id_extension].Infos["BitRate_Maximum"]=Ztring::ToZtring(maximum_bitrate*400); break; default : ; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_0F() { //Parsing int32u private_data_indicator; Get_B4 (private_data_indicator, "private_data_indicator"); if ((private_data_indicator&0xFF000000)>=0x41000000 && (private_data_indicator&0xFF000000)<=0x7A000000 && (private_data_indicator&0x00FF0000)>=0x00410000 && (private_data_indicator&0x00FF0000)<=0x007A0000 && (private_data_indicator&0x0000FF00)>=0x00004100 && (private_data_indicator&0x0000FF00)<=0x00007A00 && (private_data_indicator&0x000000FF)>=0x00000041 && (private_data_indicator&0x000000FF)<=0x0000007A) { Param_Info1(Ztring().From_CC4(private_data_indicator)); Element_Info1(Ztring().From_CC4(private_data_indicator)); } } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_10() { //Parsing BS_Begin(); Skip_S1( 2, "reserved"); Info_S3(22, sb_leak_rate, "sb_leak_rate"); Param_Info2(sb_leak_rate*400, " bps"); Skip_S1( 2, "reserved"); Info_S3(22, sb_size, "sb_size"); Param_Info2(sb_size, " bytes"); BS_End(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_11() { //Parsing BS_Begin(); Skip_S1( 7, "reserved"); Skip_SB( "leak_valid_flag"); BS_End(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_1C() { //Parsing int8u Profile_and_level; Get_B1 ( Profile_and_level, "Profile_and_level"); Param_Info1(Mpeg_Descriptors_MPEG_4_audio_profile_and_level(Profile_and_level)); FILLING_BEGIN(); Complete_Stream->Streams[elementary_PID]->Infos["Format_Profile"]=Mpeg_Descriptors_MPEG_4_audio_profile_and_level(Profile_and_level); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_1D() { //Parsing int8u IOD_label; Skip_B1( "Scope_of_IOD_label"); Get_B1 (IOD_label, "IOD_label"); #ifdef MEDIAINFO_MPEG4_YES if (Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].IOD_ESs.find(IOD_label)==Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].IOD_ESs.end()) { File_Mpeg4_Descriptors MI; MI.Parser_DoNotFreeIt=true; MI.SLConfig_DoNotFreeIt=true; Open_Buffer_Init(&MI); Open_Buffer_Continue(&MI); Finish(&MI); Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].IOD_ESs[MI.ES_ID].Parser=MI.Parser; Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].IOD_ESs[MI.ES_ID].SLConfig=MI.SLConfig; } #else Skip_XX(Element_Size-Element_Offset, "MPEG-4 Descriptor"); #endif } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_1F() { //Parsing int16u ES_ID; while (Element_OffsetStreams[elementary_PID]->FMC_ES_ID=ES_ID; Complete_Stream->Streams[elementary_PID]->FMC_ES_ID_IsValid=true; } break; default : ; } FILLING_END(); } } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_28() { //Parsing int8u profile_idc, level_idc; Get_B1 (profile_idc, "profile_idc"); Param_Info1(Avc_profile_idc(profile_idc)); BS_Begin(); Element_Begin1("constraints"); Skip_SB( "constraint_set0_flag"); Skip_SB( "constraint_set1_flag"); Skip_SB( "constraint_set2_flag"); Skip_SB( "constraint_set3_flag"); Skip_SB( "reserved_zero_4bits"); Skip_SB( "reserved_zero_4bits"); Skip_SB( "reserved_zero_4bits"); Skip_SB( "reserved_zero_4bits"); Element_End0(); BS_End(); Get_B1 (level_idc, "level_idc"); BS_Begin(); Skip_SB( "AVC_still_present"); Skip_SB( "AVC_24_hour_picture_flag"); Skip_S1(6, "reserved"); BS_End(); FILLING_BEGIN(); switch (table_id) { case 0x02 : //program_map_section if (elementary_PID_IsValid) { Complete_Stream->Streams[elementary_PID]->Infos["Format"]=__T("AVC"); Complete_Stream->Streams[elementary_PID]->Infos["Format_Profile"]=Ztring().From_Local(Avc_profile_idc(profile_idc))+__T("@L")+Ztring().From_Number(((float)level_idc)/10, 1); } break; default : ; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_2A() { //Parsing BS_Begin(); Skip_SB( "hrd_management_valid_flag"); Skip_S1(6, "reserved"); TEST_SB_SKIP( "picture_and_timing_info_present"); bool x90kHz_flag; Get_SB (x90kHz_flag, "90kHz_flag"); Skip_S1(7, "reserved"); BS_End(); if (x90kHz_flag) { Skip_B4( "N"); Skip_B4( "K"); } Skip_B4( "num_units_in_tick"); BS_Begin(); TEST_SB_END(); Skip_SB( "fixed_frame_rate_flag"); Skip_SB( "temporal_poc_flag"); Skip_SB( "picture_to_display_conversion_flag"); Skip_S1(5, "reserved"); BS_End(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_2F() { //Parsing int8u aux_video_params_length; Skip_B1( "aux_video_type"); //ISO/IEC 23002-3 Get_B1 (aux_video_params_length, "aux_video_params_length"); Skip_XX(aux_video_params_length, "aux_video_params"); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_40() { //Parsing Ztring network_name; Get_DVB_Text(Element_Size, network_name, "network_name"); FILLING_BEGIN(); Complete_Stream->network_name=network_name; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_41() { //Parsing while (Element_OffsetTransport_Streams[table_id_extension].Programs[service_id].Infos["ServiceType"]=Mpeg_Descriptors_dvb_service_type(service_type); FILLING_END(); } } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_43() { //Parsing int32u frequency, symbol_rate; int16u orbital_position; int8u polarization, roll_off, modulation_type, FEC_inner; bool west_east_flag, modulation_system; Get_B4 (frequency, "frequency"); Param_Info1(Frequency_DVB__BCD(frequency)); Get_B2 (orbital_position, "orbital_position"); Param_Info1(OrbitalPosition_DVB__BCD(orbital_position)); BS_Begin(); Get_SB ( west_east_flag, "west_east_flag"); Param_Info1(west_east_flag?"E":"W"); Get_S1 ( 2, polarization, "polarization"); Get_S1 ( 2, roll_off, "roll_off"); Get_SB ( modulation_system, "modulation_system"); Get_S1 ( 2, modulation_type, "modulation_type"); Get_S4 (28, symbol_rate, "symbol_rate"); Get_S1 ( 4, FEC_inner, "FEC_inner"); BS_End(); FILLING_BEGIN(); Complete_Stream->Transport_Streams[transport_stream_id].Infos["Frequency"]=Frequency_DVB__BCD(frequency); Complete_Stream->Transport_Streams[transport_stream_id].Infos["OrbitalPosition"]=OrbitalPosition_DVB__BCD(orbital_position)+(west_east_flag?__T('E'):__T('W')); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_48() { //Parsing Ztring service_provider_name, service_name; int8u service_type, service_provider_name_length, service_name_length; Get_B1 (service_type, "service_type"); Param_Info1(Mpeg_Descriptors_dvb_service_type(service_type)); Get_B1 (service_provider_name_length, "service_provider_name_length"); Get_DVB_Text(service_provider_name_length, service_provider_name, "service_provider_name"); Get_B1 (service_name_length, "service_name_length"); Get_DVB_Text(service_name_length, service_name, "service_name"); //Filling FILLING_BEGIN(); if (program_number_IsValid) { Complete_Stream->Transport_Streams[table_id_extension].Programs[program_number].Infos["ServiceName"]=service_name; Complete_Stream->Transport_Streams[table_id_extension].Programs[program_number].Infos["ServiceProvider"]=service_provider_name; Complete_Stream->Transport_Streams[table_id_extension].Programs[program_number].Infos["ServiceType"]=Mpeg_Descriptors_dvb_service_type(service_type); } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_4A() { //Parsing int8u linkage_type; Skip_B2( "transport_stream_id"); Info_B2(original_network_id, "original_network_id"); Param_Info1(Mpeg_Descriptors_original_network_id(original_network_id)); Skip_B2( "service_id"); Get_B1 (linkage_type, "linkage_type"); Param_Info1(Mpeg_Descriptors_linkage_type(linkage_type)); if (Element_Size>7) Skip_XX(Element_Size-7, "private_data"); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_4D() { //Parsing Ztring event_name, text; int32u ISO_639_language_code; int8u event_name_length, text_length; Get_C3 (ISO_639_language_code, "ISO_639_language_code"); Get_B1 (event_name_length, "event_name_length"); Get_DVB_Text(event_name_length, event_name, "event_name"); Element_Info1(event_name); Get_B1 (text_length, "text_length"); Get_DVB_Text(text_length, text, "text"); FILLING_BEGIN(); if (table_id>=0x4E && table_id<=0x6F) //event_information_section { if (event_id_IsValid) { Ztring ISO_639_2; ISO_639_2.From_CC3(ISO_639_language_code); const Ztring& ISO_639_1=MediaInfoLib::Config.Iso639_1_Get(ISO_639_2); Complete_Stream->Transport_Streams[transport_stream_id].Programs[table_id_extension].DVB_EPG_Blocks[table_id].Events[event_id].short_event.event_name=(ISO_639_1.empty()?ISO_639_2:ISO_639_1)+__T(':')+event_name; Complete_Stream->Transport_Streams[transport_stream_id].Programs[table_id_extension].DVB_EPG_Blocks[table_id].Events[event_id].short_event.text=(ISO_639_1.empty()?ISO_639_2:ISO_639_1)+__T(':')+text; Complete_Stream->Transport_Streams[transport_stream_id].Programs[table_id_extension].DVB_EPG_Blocks_IsUpdated=true; Complete_Stream->Programs_IsUpdated=true; } } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_50() { //Parsing int32u ISO_639_language_code; int8u stream_content; BS_Begin(); Skip_S1(4, "reserved_future_use"); Get_S1 (4, stream_content, "stream_content"); Param_Info1(Mpeg_Descriptors_stream_content(stream_content)); Element_Info1(Mpeg_Descriptors_stream_content(stream_content)); BS_End(); Info_B1(component_type, "component_type"); Param_Info1(Mpeg_Descriptors_component_type(stream_content, component_type)); Element_Info1(Mpeg_Descriptors_component_type(stream_content, component_type)); Info_B1(component_tag, "component_tag"); Get_C3 (ISO_639_language_code, "ISO_639_language_code"); Skip_DVB_Text(Element_Size-Element_Offset, "text"); FILLING_BEGIN(); switch (table_id) { case 0x02 : //program_map_section if (elementary_PID_IsValid) { Ztring ISO_639_2; ISO_639_2.From_CC3(ISO_639_language_code); const Ztring& ISO_639_1=MediaInfoLib::Config.Iso639_1_Get(ISO_639_2); Complete_Stream->Streams[elementary_PID]->Infos["Language"]=ISO_639_1.empty()?ISO_639_2:ISO_639_1; } break; default : ; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_52() { //Parsing Skip_B1( "component_tag"); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_54() { //Parsing while (Element_OffsetTransport_Streams[transport_stream_id].Programs[table_id_extension].DVB_EPG_Blocks[table_id].Events[event_id].content=Ztring().From_UTF8(Mpeg_Descriptors_content_nibble_level_2(content_nibble_level_1, content_nibble_level_2))+__T(", "); Complete_Stream->Transport_Streams[transport_stream_id].Programs[table_id_extension].DVB_EPG_Blocks_IsUpdated=true; Complete_Stream->Programs_IsUpdated=true; } FILLING_END(); } FILLING_BEGIN(); if (event_id_IsValid) { if (!Complete_Stream->Transport_Streams[transport_stream_id].Programs[table_id_extension].DVB_EPG_Blocks[table_id].Events[event_id].content.empty()) { Complete_Stream->Transport_Streams[transport_stream_id].Programs[table_id_extension].DVB_EPG_Blocks[table_id].Events[event_id].content.resize(Complete_Stream->Transport_Streams[transport_stream_id].Programs[table_id_extension].DVB_EPG_Blocks[table_id].Events[event_id].content.size()-2); Complete_Stream->Transport_Streams[transport_stream_id].Programs[table_id_extension].DVB_EPG_Blocks_IsUpdated=true; Complete_Stream->Programs_IsUpdated=true; } } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_55() { //Parsing while (Element_OffsetStreams[elementary_PID]->descriptor_tag=0x56; Complete_Stream->Streams[elementary_PID]->Teletexts[ID].Infos["Language"]=MediaInfoLib::Config.Iso639_1_Get(ISO_639_language_code); Complete_Stream->Streams[elementary_PID]->Teletexts[ID].Infos["Format"]=Mpeg_Descriptors_teletext_type(teletext_type); Complete_Stream->Streams[elementary_PID]->Teletexts[ID].Infos["Codec"]=Mpeg_Descriptors_teletext_type(teletext_type); } break; default : ; } FILLING_END(); Element_End0(); } } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_58() { //Parsing while (Element_OffsetTimeZones[Country]=(local_time_offset_polarity?__T('-'):__T('+'))+TimeHHMM_BCD(local_time_offset); FILLING_END(); } } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_59() { //Parsing Ztring Languages; while (Element_OffsetStreams[elementary_PID]->StreamKind_FromDescriptor=Stream_Text; Complete_Stream->Streams[elementary_PID]->descriptor_tag=0x59; if (!Languages.empty()) Languages.resize(Languages.size()-3); Complete_Stream->Streams[elementary_PID]->Infos["Language"]=Languages; Complete_Stream->Streams[elementary_PID]->Infos["Format"]=__T("DVB Subtitle"); Complete_Stream->Streams[elementary_PID]->Infos["Codec"]=__T("DVB Subtitle"); } break; default : ; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_5A() { //Parsing Info_B4(centre_frequency, "centre_frequency"); Param_Info2(((int64u)centre_frequency)*10, " Hz"); BS_Begin(); Info_S1(3, bandwidth, "bandwidth"); Param_Info1(Mpeg_Descriptors_bandwidth[bandwidth]); Info_SB( priority, "priority"); Param_Info1(priority?"HP":"LP"); Skip_SB( "Time_Slicing_indicator"); Skip_SB( "MPE-FEC_indicator"); Skip_S1(2, "reserved"); Info_S1(2, constellation, "constellation"); Param_Info1(Mpeg_Descriptors_constellation[constellation]); Info_S1(3, hierarchy_information, "hierarchy_information"); Param_Info1(Mpeg_Descriptors_hierarchy_information[hierarchy_information]); Info_S1(3, code_rate_HP, "code_rate-HP_stream"); Param_Info1(Mpeg_Descriptors_code_rate[code_rate_HP]); Info_S1(3, code_rate_LP, "code_rate-LP_stream"); Param_Info1(Mpeg_Descriptors_code_rate[code_rate_LP]); Info_S1(2, guard_interval, "guard_interval"); Param_Info1(Mpeg_Descriptors_guard_interval[guard_interval]); Info_S1(2, transmission_mode, "transmission_mode"); Param_Info1(Mpeg_Descriptors_transmission_mode[transmission_mode]); Skip_SB( "other_frequency_flag"); BS_End(); Skip_B4( "reserved"); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_5D() { //Parsing Ztring ServiceProvider, ServiceName; while (Element_OffsetTransport_Streams[table_id_extension].Programs[program_number].Infos["ServiceProvider"]=ServiceProvider; } if (!ServiceName.empty()) { ServiceName.resize(ServiceName.size()-3); if (program_number_IsValid) Complete_Stream->Transport_Streams[table_id_extension].Programs[program_number].Infos["ServiceName"]=ServiceName; } } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_5F() { //Parsing Info_B4(private_data_specifier, "private_data_specifier"); Param_Info1(Ztring().From_CC4(private_data_specifier)); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_63() { //Parsing int32u peak_rate; BS_Begin(); Skip_S1( 2, "DVB_reserved_future_use"); Get_S3 (22, peak_rate, "peak_rate"); Skip_S1( 2, "DVB_reserved_future_use"); Skip_S3(22, "minimum_overall_smoothing_rate"); Skip_S1( 2, "DVB_reserved_future_use"); Skip_S2(14, "maximum_overall_smoothing_buffer"); BS_End(); FILLING_BEGIN(); switch (table_id) { case 0x02 : //program_map_section if (elementary_PID_IsValid) Complete_Stream->Streams[elementary_PID]->Infos["OverallBitRate_Maximum"]=Ztring::ToZtring(peak_rate*400); break; case 0x7F : //selection_information_section Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Infos["OverallBitRate_Maximum"]=Ztring::ToZtring(peak_rate*400); break; default : ; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_66() { //Parsing Ztring ISO_639_language_code; int8u selector_length, text_length; Skip_B2( "data_broadcast_id"); Skip_B1( "component_tag"); Get_B1 (selector_length, "selector_length"); Skip_XX(selector_length, "selector_bytes"); Get_Local(3, ISO_639_language_code, "ISO_639_language_code"); Get_B1 (text_length, "text_length"); Skip_Local(text_length, "text_chars"); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_6A() { //Parsing BS_Begin(); bool component_type_flag, bsid_flag, mainid_flag, asvc_flag, enhanced_ac3=false; Get_SB ( component_type_flag, "component_type_flag"); Get_SB ( bsid_flag, "bsid_flag"); Get_SB ( mainid_flag, "mainid_flag"); Get_SB ( asvc_flag, "asvc_flag"); Skip_SB( "reserved_flag"); Skip_SB( "reserved_flag"); Skip_SB( "reserved_flag"); Skip_SB( "reserved_flag"); BS_End(); if (component_type_flag) { int8u service_type, number_of_channels; BS_Begin(); Get_SB ( enhanced_ac3, "enhanced AC-3"); Skip_SB( "full_service"); Get_S1 (3, service_type, "service_type"); Param_Info1(AC3_Mode[service_type]); Get_S1 (3, number_of_channels, "number_of_channels"); Param_Info2(Mpeg_Descriptors_AC3_Channels[number_of_channels], " channels"); BS_End(); FILLING_BEGIN(); switch (table_id) { case 0x02 : //program_map_section if (elementary_PID_IsValid) { Complete_Stream->Streams[elementary_PID]->descriptor_tag=0x6A; Complete_Stream->Streams[elementary_PID]->Infos["Channel(s)"]=Ztring().From_Local(Mpeg_Descriptors_AC3_Channels[number_of_channels]); } break; default : ; } FILLING_END(); } if (bsid_flag) { BS_Begin(); Skip_S1(3, "zero"); Skip_S1(5, "bsid"); BS_End(); } if (mainid_flag) { Skip_B1( "mainid"); } if (asvc_flag) { Skip_B1( "asvc"); } FILLING_BEGIN(); //Can be more switch (table_id) { case 0x02 : //program_map_section if (elementary_PID_IsValid) { Complete_Stream->Streams[elementary_PID]->StreamKind_FromDescriptor=Stream_Audio; Complete_Stream->Streams[elementary_PID]->Infos["Format"]=enhanced_ac3?__T("E-AC-3"):__T("AC-3"); Complete_Stream->Streams[elementary_PID]->Infos["Codec"]=__T("AC3+"); if (Complete_Stream->Streams[elementary_PID]->registration_format_identifier==Elements::BSSD) Complete_Stream->Streams[elementary_PID]->registration_format_identifier=0x00000000; //Reseting it, this combinaision is not possible but an stream has it } break; default : ; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_7A() { //Parsing bool component_type_flag, bsid_flag, mainid_flag, asvc_flag, mixinfoexists, substream1_flag, substream2_flag, substream3_flag, enhanced_ac3=0; BS_Begin(); Get_SB ( component_type_flag, "component_type_flag"); Get_SB ( bsid_flag, "bsid_flag"); Get_SB ( mainid_flag, "mainid_flag"); Get_SB ( asvc_flag, "asvc_flag"); Get_SB ( mixinfoexists, "mixinfoexists"); Get_SB ( substream1_flag, "substream1_flag"); Get_SB ( substream2_flag, "substream2_flag"); Get_SB ( substream3_flag, "substream3_flag"); BS_End(); if (component_type_flag) { int8u service_type, number_of_channels; BS_Begin(); Get_SB ( enhanced_ac3, "enhanced AC-3"); Skip_SB( "full_service"); Get_S1 (3, service_type, "service_type"); Param_Info1(AC3_Mode[service_type]); Get_S1 (3, number_of_channels, "number_of_channels"); Param_Info2(Mpeg_Descriptors_AC3_Channels[number_of_channels], " channels"); FILLING_BEGIN(); switch (table_id) { case 0x02 : //program_map_section if (elementary_PID_IsValid) { Complete_Stream->Streams[elementary_PID]->descriptor_tag=0x7A; Complete_Stream->Streams[elementary_PID]->Infos["Channel(s)"]=Ztring().From_Local(Mpeg_Descriptors_AC3_Channels[number_of_channels]); } break; default : ; } FILLING_END(); BS_End(); } if (bsid_flag) { BS_Begin(); Skip_S1(3, "zero"); Skip_S1(5, "bsid"); BS_End(); } if (mainid_flag) { Skip_B1( "mainid"); } if (asvc_flag) { Skip_B1( "asvc"); } if (substream1_flag) { Skip_B1( "substream1"); } if (substream2_flag) { Skip_B1( "substream2"); } if (substream3_flag) { Skip_B1( "substream3"); } FILLING_BEGIN(); //Can be more switch (table_id) { case 0x02 : //program_map_section if (elementary_PID_IsValid) { Complete_Stream->Streams[elementary_PID]->StreamKind_FromDescriptor=Stream_Audio; Complete_Stream->Streams[elementary_PID]->Infos["Format"]=enhanced_ac3?__T("E-AC-3"):__T("AC-3"); Complete_Stream->Streams[elementary_PID]->Infos["Codec"]=__T("AC3+"); } break; default : ; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_7B() { //Parsing BS_Begin(); Skip_S1(6, "bit_rate_code"); Skip_S2(7, "nblks"); Skip_S2(14, "fsize"); Skip_S1(6, "surround_mode"); Skip_SB( "lfe_flag"); Skip_S1(2, "extended_surround_flag"); BS_End(); //BS_End_CANBEMORE(); FILLING_BEGIN(); switch (table_id) { case 0x02 : //program_map_section if (elementary_PID_IsValid) { Complete_Stream->Streams[elementary_PID]->descriptor_tag=0x7B; } default : ; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_7C() { //Parsing int8u Profile_and_level; bool AAC_type_flag; Get_B1 ( Profile_and_level, "Profile_and_level"); Param_Info1(Mpeg_Descriptors_MPEG_4_audio_profile_and_level(Profile_and_level)); BS_Begin(); Get_SB ( AAC_type_flag, "AAC_type_flag"); Skip_SB( "reserved"); Skip_SB( "reserved"); Skip_SB( "reserved"); Skip_SB( "reserved"); Skip_SB( "reserved"); Skip_SB( "reserved"); Skip_SB( "reserved"); BS_End(); if (AAC_type_flag) { Skip_B1( "AAC_type"); } if (Element_Size-Element_Offset) Skip_XX(Element_Size-Element_Offset, "Unknown"); FILLING_BEGIN(); switch (table_id) { case 0x02 : //program_map_section if (elementary_PID_IsValid) { Complete_Stream->Streams[elementary_PID]->descriptor_tag=0x7C; Complete_Stream->Streams[elementary_PID]->Infos["Format_Profile"]=Mpeg_Descriptors_MPEG_4_audio_profile_and_level(Profile_and_level); } default : ; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_81() { //Parsing Ztring Text, Language1, Language2; int8u sample_rate_code, bit_rate_code, surround_mode, bsmod, num_channels, langcod, textlen, text_code; bool language_flag, language_flag_2; BS_Begin(); Get_S1 (3, sample_rate_code, "sample_rate_code"); if (sample_rate_code<4) {Param_Info2(AC3_SamplingRate[sample_rate_code], " Hz");} Skip_S1(5, "bsid"); Get_S1 (6, bit_rate_code, "bit_rate_code"); Param_Info2(AC3_BitRate[bit_rate_code]*1000, " Kbps"); Get_S1 (2, surround_mode, "surround_mode"); Param_Info1(AC3_Surround[surround_mode]); Get_S1 (3, bsmod, "bsmod"); Get_S1 (4, num_channels, "num_channels"); if (num_channels<8) {Param_Info2(AC3_Channels[num_channels], " channels");} Skip_SB( "full_svc"); BS_End(); FILLING_BEGIN(); switch (table_id) { case 0x02 : //program_map_section if (elementary_PID_IsValid) { Complete_Stream->Streams[elementary_PID]->descriptor_tag=0x81; if (sample_rate_code<4) Complete_Stream->Streams[elementary_PID]->Infos["SamplingRate"]=Ztring::ToZtring(AC3_SamplingRate[sample_rate_code]); Complete_Stream->Streams[elementary_PID]->Infos["BitRate"]=Ztring::ToZtring(AC3_BitRate[bit_rate_code]*1000); if (num_channels<8) Complete_Stream->Streams[elementary_PID]->Infos["Channel(s)"]=Ztring::ToZtring(AC3_Channels[num_channels]); } } FILLING_END(); //Parsing if (Element_Offset==Element_Size) return; Get_B1 (langcod, "langcod"); //Parsing if (Element_Offset==Element_Size) return; if (num_channels==0) //1+1 mode Skip_B1( "langcod2"); //Parsing if (Element_Offset==Element_Size) return; if (bsmod<2) { BS_Begin(); Skip_S1(3, "mainid"); Info_BS(2, priority, "priority"); Param_Info1(Mpeg_Descriptors_AC3_Priority[priority]); Skip_S1(3, "reserved"); BS_End(); } else Skip_B1( "asvcflags"); //Parsing if (Element_Offset==Element_Size) return; BS_Begin(); Get_S1 (7, textlen, "textlen"); Get_S1 (1, text_code, "text_code"); Param_Info1C((text_code), "Unicode"); BS_End(); if (textlen) Get_Local(textlen, Text, "text"); //Parsing if (Element_Offset==Element_Size) return; BS_Begin(); Get_SB ( language_flag, "language_flag"); Get_SB ( language_flag_2, "language_flag_2"); Skip_S1(6, "reserved"); BS_End(); //Parsing if (Element_Offset==Element_Size) return; if (language_flag) Get_Local(3, Language1, "language1"); //Parsing if (Element_Offset==Element_Size) return; if (language_flag_2) Get_Local(3, Language2, "language2"); //Parsing if (Element_Offset==Element_Size) return; Skip_XX(Element_Size-Element_Offset, "additional_info"); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_86() { if (event_id_IsValid) { Complete_Stream->Sources[table_id_extension].ATSC_EPG_Blocks[Complete_Stream->Streams[pid]->table_type].Events[event_id].Eia708_Languages.clear(); Complete_Stream->Sources[table_id_extension].ATSC_EPG_Blocks[Complete_Stream->Streams[pid]->table_type].Events[event_id].Eia608_IsPresent=false; } else if (elementary_PID_IsValid) { Complete_Stream->Streams[elementary_PID]->Eia708_Languages.clear(); Complete_Stream->Streams[elementary_PID]->Eia608_IsPresent=false; } else if (program_number_IsValid) { Complete_Stream->Transport_Streams[transport_stream_id].Programs[program_number].Eia708_Languages.clear(); Complete_Stream->Transport_Streams[transport_stream_id].Programs[program_number].Eia608_IsPresent=false; } //Parsing Ztring Text, Language1, Language2; int8u number_of_services; BS_Begin(); Skip_S1(3, "reserved"); Get_S1 (5, number_of_services, "number_of_services"); BS_End(); for (int8u Pos=0; PosSources[table_id_extension].ATSC_EPG_Blocks[Complete_Stream->Streams[pid]->table_type].Events[event_id].Eia708_Languages[caption_service_number]; if (!Value.empty()) Value+=" / "; Value+=language; } else Complete_Stream->Sources[table_id_extension].ATSC_EPG_Blocks[Complete_Stream->Streams[pid]->table_type].Events[event_id].Eia608_IsPresent=true; } else if (elementary_PID_IsValid) { if (digital_cc) { string &Value=Complete_Stream->Streams[elementary_PID]->Eia708_Languages[caption_service_number]; if (!Value.empty()) Value+=" / "; Value+=language; } else Complete_Stream->Streams[elementary_PID]->Eia608_IsPresent=true; } else if (program_number_IsValid) { if (digital_cc) { string &Value=Complete_Stream->Transport_Streams[transport_stream_id].Programs[program_number].Eia708_Languages[caption_service_number]; if (!Value.empty()) Value+=" / "; Value+=language; } else Complete_Stream->Transport_Streams[transport_stream_id].Programs[program_number].Eia608_IsPresent=true; } } } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_87() { //Parsing int8u rating_region_count; BS_Begin(); Skip_S1(2, "reserved"); Get_S1 (6, rating_region_count, "rating_region_count"); BS_End(); for (int8u rating_region_Pos=0; rating_region_PosTransport_Streams[table_id_extension].Programs[program_number].Infos["ServiceName"]=title; break; default : ; } FILLING_END(); FILLING_BEGIN(); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_A1() { //Parsing int8u number_elements; BS_Begin(); Skip_S1( 3, "reserved"); Skip_S2(13, "PCR_PID"); BS_End(); Get_B1 ( number_elements, "number_elements"); for (int8u Pos=0; PosStreams.size() && Complete_Stream->Streams[elementary_PID]->Infos["Language"].empty()) //We use only the first detected value Complete_Stream->Streams[elementary_PID]->Infos["Language"]=Language; } } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_A3() { //Parsing Ztring Value; ATSC_multiple_string_structure(Value, "name"); FILLING_BEGIN(); switch (table_id) { case 0x02 : //program_map_section if (elementary_PID_IsValid) if (!Value.empty()) Complete_Stream->Streams[elementary_PID]->Infos["Name"]=Value; break; default : ; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_AA() { //Parsing Skip_XX(Element_Size, "rc_information"); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::Descriptor_C1() { // ARIB B15 //Parsing int8u copy_control_type; bool maximum_bit_rate_flag, component_control_flag; BS_Begin(); Skip_S1(2, "digital_recording_control_data"); Get_SB ( maximum_bit_rate_flag, "maximum_bit_rate_flag "); Get_SB ( component_control_flag, "component_control_flag "); Get_S1 (2, copy_control_type, "copy_control_type"); //Skip_S1(2, (copy_control_type&0x1)?"copy_control_type":"reserved_future_use"); BS_End(); while (Element_OffsetStreams[elementary_PID]->Infos["Format"]=__T("ARIB STD B24/B37"); //Complete_Stream->Streams[elementary_PID]->StreamKind=Stream_Text; } break; default : ; } FILLING_END(); } } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::CUEI_00() { Skip_C4( "identifier (\"CUEI\")"); //CUEI Skip_B4( "provider_avail_id"); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::CUEI_01() { Skip_XX(Element_Size, "Data"); } //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::CUEI_02() { //Parsing int32u segmentation_event_id; bool segmentation_event_cancel_indicator; Skip_C4( "identifier (\"CUEI\")"); //CUEI Get_B4 (segmentation_event_id, "segmentation_event_id"); BS_Begin(); Get_SB ( segmentation_event_cancel_indicator, "segmentation_event_cancel_indicator"); Skip_S1( 7, "reserved"); BS_End(); if (!segmentation_event_cancel_indicator) { int8u segmentation_upid_length, segmentation_type_id; bool program_segmentation_flag, segmentation_duration_flag; BS_Begin(); Get_SB ( program_segmentation_flag, "program_segmentation_flag"); Get_SB ( segmentation_duration_flag, "segmentation_duration_flag"); Skip_S1( 6, "reserved"); BS_End(); if (!program_segmentation_flag) { int8u component_count; Get_B1 (component_count, "component_count"); for (int8u Pos=0; PosStreams[pid]->program_numbers.size(); Program_Pos++) { complete_stream::transport_stream::program::scte35* Scte35=Complete_Stream->Transport_Streams[transport_stream_id].Programs[Complete_Stream->Streams[pid]->program_numbers[Program_Pos]].Scte35; if (Scte35) { int8u Status=0; //Running switch (segmentation_type_id) { case 0x11 : segmentation_type_id=0x10; Status=1; break; //Program Start/End case 0x12 : segmentation_type_id=0x10; Status=2; break; //Program Start/Early Termination case 0x14 : segmentation_type_id=0x13; Status=1; break; //Program Breakaway/Resumption case 0x21 : segmentation_type_id=0x20; Status=1; break; //Chapter Start/End case 0x31 : segmentation_type_id=0x30; Status=1; break; //Provider Advertisement Start/End case 0x33 : segmentation_type_id=0x32; Status=1; break; //Distributor Advertisement Start/End case 0x41 : segmentation_type_id=0x40; Status=1; break; //Unscheduled Event Start/End default : ; } Scte35->Segmentations[segmentation_event_id].Segments[segmentation_type_id].Status=Status; } } FILLING_END(); } } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpeg_Descriptors::ATSC_multiple_string_structure(Ztring &Value, const char* Name) { //Parsing Ztring string; int8u number_strings, number_segments; Element_Begin1(Name); Get_B1(number_strings, "number_strings"); for (int8u string_Pos=0; string_Pos>16)&0xFF)<10?__T("0"):__T("")) + Ztring::ToZtring((Time>>16)&0xFF, 16)+__T(":") //BCD + (((Time>> 8)&0xFF)<10?__T("0"):__T("")) + Ztring::ToZtring((Time>> 8)&0xFF, 16)+__T(":") //BCD + (((Time )&0xFF)<10?__T("0"):__T("")) + Ztring::ToZtring((Time )&0xFF, 16); //BCD } //--------------------------------------------------------------------------- //Form: HHMM, BCD Ztring File_Mpeg_Descriptors::TimeHHMM_BCD(int16u Time) { return (((Time>> 8)&0xFF)<10?__T("0"):__T("")) + Ztring::ToZtring((Time>> 8)&0xFF, 16)+__T(":") //BCD + (((Time )&0xFF)<10?__T("0"):__T("")) + Ztring::ToZtring((Time )&0xFF, 16)+__T(":00"); //BCD } //--------------------------------------------------------------------------- //Form: Frequency in 10 KHz Ztring File_Mpeg_Descriptors::Frequency_DVB__BCD(int32u Frequency) { int64u ToReturn=((((int64u)Frequency)>>28)&0xF)*10000000 + ((((int64u)Frequency)>>24)&0xF)* 1000000 + ((((int64u)Frequency)>>20)&0xF)* 100000 + ((((int64u)Frequency)>>16)&0xF)* 10000 + ((((int64u)Frequency)>>12)&0xF)* 1000 + ((((int64u)Frequency)>> 8)&0xF)* 100 + ((((int64u)Frequency)>> 4)&0xF)* 10 + ((((int64u)Frequency) )&0xF)* 1; return Ztring::ToZtring(ToReturn*10000); } //--------------------------------------------------------------------------- //Form: Orbital Position Ztring File_Mpeg_Descriptors::OrbitalPosition_DVB__BCD(int32u OrbitalPosition) { int64u ToReturn=((OrbitalPosition>>12)&0xF)* 1000 + ((OrbitalPosition>> 8)&0xF)* 100 + ((OrbitalPosition>> 4)&0xF)* 10 + ((OrbitalPosition )&0xF) ; return Ztring::ToZtring(((float)ToReturn)/10, 1); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_MPEGTS_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Mpeg_Descriptors.h100777 0 0 71654 12226004262 17757 0/* 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, Descriptors // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_Mpeg_DescriptorsH #define MediaInfo_Mpeg_DescriptorsH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Mpeg4_Descriptors.h" #include "MediaInfo/Duplicate/File__Duplicate_MpegTs.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Global object //*************************************************************************** struct complete_stream { //Global int16u transport_stream_id; //The processed transport_stream_id bool transport_stream_id_IsValid; //The processed transport_stream_id Ztring original_network_name; Ztring network_name; Ztring Duration_Start; Ztring Duration_End; bool Duration_End_IsUpdated; std::map TimeZones; //Key is country code //Per transport_stream struct transport_stream { bool HasChanged; std::map Infos; struct program { bool HasChanged; std::map Eia708_Languages; //Sometimes, it is in program descriptors instead of inside the video stream descriptors //Key is caption_service_number std::map Infos; std::map ExtraInfos_Content; std::map ExtraInfos_Option; std::map EPGs; std::vector elementary_PIDs; size_t StreamPos; //Stream_Menu int32u registration_format_identifier; int16u pid; int16u PCR_PID; int16u source_id; //ATSC bool source_id_IsValid; bool IsParsed; bool IsRegistered; bool HasNotDisplayableStreams; //e.g. unknown stream, KLV, SCTE 35 bool Update_Needed_IsRegistered; bool Update_Needed_StreamCount; bool Update_Needed_StreamPos; bool Update_Needed_Info; bool Eia608_IsPresent; //DVB struct dvb_epg_block { struct event { Ztring start_time; Ztring duration; struct short_event_ { Ztring event_name; Ztring text; }; short_event_ short_event; Ztring content; Ztring running_status; }; typedef std::map events; //Key is event_id events Events; //Key is event_id }; typedef std::map dvb_epg_blocks; //Key is table_id dvb_epg_blocks DVB_EPG_Blocks; //Key is table_id bool DVB_EPG_Blocks_IsUpdated; //SCTE 35 struct scte35 { struct segmentation { struct segment { int8u Status; //If it is currently in the program: 0=Running, 1=Ended, 2=Early termination segment() { Status=(int8u)-1; } }; typedef std::map segments; //Key is segmentation_type_id segments Segments; ; }; typedef std::map segmentations; //Key is segmentation_event_id segmentations Segmentations; int16u pid; scte35() { pid=(int16u)-1; } }; scte35* Scte35; //Constructor/Destructor program() { HasChanged=false; StreamPos=(size_t)-1; registration_format_identifier=0x00000000; pid=0x00000; PCR_PID=0x0000; source_id=(int16u)-1; source_id_IsValid=false; IsParsed=false; IsRegistered=false; HasNotDisplayableStreams=false; Update_Needed_IsRegistered=false; Update_Needed_StreamCount=false; Update_Needed_StreamPos=false; Update_Needed_Info=false; DVB_EPG_Blocks_IsUpdated=false; Eia608_IsPresent=false; Scte35=NULL; } }; typedef std::map programs; //Key is program_number programs Programs; //Key is program_number std::vector programs_List; size_t Programs_NotParsedCount; //Per IOD struct iod_es { File__Analyze* Parser; #ifdef MEDIAINFO_MPEG4_YES File_Mpeg4_Descriptors::slconfig* SLConfig; #endif //Constructor/Destructor iod_es() { Parser=NULL; #ifdef MEDIAINFO_MPEG4_YES SLConfig=NULL; #endif } ~iod_es() { delete Parser; //Parser=NULL; #ifdef MEDIAINFO_MPEG4_YES delete SLConfig; //SLConfig=NULL; #endif } }; typedef std::map iod_ess; //Key is ES_ID std::map IOD_ESs; //Key is ES_ID //ATSC int16u source_id; //Global int16u source_id_IsValid; transport_stream() { HasChanged=false; source_id=(int16u)-1; source_id_IsValid=false; Programs_NotParsedCount=(size_t)-1; } }; typedef std::map transport_streams; //Key is transport_stream_id transport_streams Transport_Streams; //Key is transport_stream_id //Per pid struct stream { File__Analyze* Parser; enum ts_kind { //MPEG unknown, pes, psi, ts_kind_Max, }; std::vector program_numbers; struct table_id { struct table_id_extension { typedef std::vector section_numbers; //Key is section_number section_numbers Section_Numbers; //Key is section_number int8u version_number; }; typedef std::map table_id_extensions; //Key is table_id_extensions table_id_extensions Table_ID_Extensions; //Key is table_id_extensions bool Table_ID_Extensions_CanAdd; table_id() { Table_ID_Extensions_CanAdd=true; } }; typedef std::vector table_ids; table_ids Table_IDs; //Key is table_id std::map Infos; std::map Infos_Option; std::map Eia708_Languages; //Key is caption_service_number struct teletext { std::map Infos; }; std::map Teletexts; //Key is teletext_magazine_number #if MEDIAINFO_TRACE Ztring Element_Info1; #endif //MEDIAINFO_TRACE stream_t StreamKind; stream_t StreamKind_FromDescriptor; size_t StreamPos; ts_kind Kind; bool IsParsed; bool IsPCR; float64 IsPCR_Duration; #ifdef MEDIAINFO_MPEGTS_PCR_YES int64u TimeStamp_Start; int64u TimeStamp_Start_Offset; int64u TimeStamp_End; int64u TimeStamp_End_Offset; int16u PCR_PID; //If this pid has no PCR, decide which PCR should be used bool TimeStamp_End_IsUpdated; float64 TimeStamp_InstantaneousBitRate_Current_Min; float64 TimeStamp_InstantaneousBitRate_Current_Raw; float64 TimeStamp_InstantaneousBitRate_Current_Max; int64u TimeStamp_InstantaneousBitRate_BitRateMode_IsCbr; int64u TimeStamp_InstantaneousBitRate_BitRateMode_IsVbr; #if MEDIAINFO_ADVANCED float64 TimeStamp_InstantaneousBitRate_Min_Raw; float64 TimeStamp_InstantaneousBitRate_Max_Raw; int64u TimeStamp_Distance_Min; int64u TimeStamp_Distance_Max; int64u TimeStamp_Distance_Total; int64u TimeStamp_Distance_Count; int64u TimeStamp_HasProblems; std::vector TimeStamp_Intermediate; #endif // MEDIAINFO_ADVANCED #endif //MEDIAINFO_MPEGTS_PCR_YES int32u registration_format_identifier; int16u FMC_ES_ID; int16u table_type; //ATSC int8u stream_type; int8u descriptor_tag; bool FMC_ES_ID_IsValid; bool Searching; bool Searching_Payload_Start; bool Searching_Payload_Continue; #ifdef MEDIAINFO_MPEGTS_PCR_YES bool Searching_TimeStamp_Start; bool Searching_TimeStamp_End; #endif //MEDIAINFO_MPEGTS_PCR_YES #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES bool Searching_ParserTimeStamp_Start; bool Searching_ParserTimeStamp_End; #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES bool EndTimeStampMoreThanxSeconds; bool ShouldDuplicate; bool IsRegistered; bool IsUpdated_IsRegistered; bool IsUpdated_Info; bool CA_system_ID_MustSkipSlices; bool Eia608_IsPresent; size_t IsScrambled; int16u CA_system_ID; int16u SubStream_pid; #if MEDIAINFO_IBI int64u Ibi_SynchronizationOffset_BeginOfFrame; #endif //MEDIAINFO_IBI //Constructor/Destructor stream() { Parser=NULL; StreamKind=Stream_Max; StreamKind_FromDescriptor=Stream_Max; StreamPos=(size_t)-1; Kind=unknown; IsParsed=false; IsPCR=false; IsPCR_Duration=0; #ifdef MEDIAINFO_MPEGTS_PCR_YES TimeStamp_Start=(int64u)-1; TimeStamp_Start_Offset=(int64u)-1; TimeStamp_End=(int64u)-1; TimeStamp_End_Offset=(int64u)-1; PCR_PID=0x0000; TimeStamp_End_IsUpdated=false; TimeStamp_InstantaneousBitRate_Current_Min=0; TimeStamp_InstantaneousBitRate_Current_Raw=0; TimeStamp_InstantaneousBitRate_Current_Max=0; TimeStamp_InstantaneousBitRate_BitRateMode_IsCbr=0; TimeStamp_InstantaneousBitRate_BitRateMode_IsVbr=0; #if MEDIAINFO_ADVANCED TimeStamp_InstantaneousBitRate_Min_Raw=DBL_MAX; TimeStamp_InstantaneousBitRate_Max_Raw=0; TimeStamp_Distance_Min=(int64u)-1; TimeStamp_Distance_Max=0; TimeStamp_Distance_Total=0; TimeStamp_Distance_Count=0; TimeStamp_HasProblems=0; #endif // MEDIAINFO_ADVANCED #endif //MEDIAINFO_MPEGTS_PCR_YES registration_format_identifier=0x00000000; FMC_ES_ID=0x0000; table_type=0x0000; stream_type=(int8u)-1; descriptor_tag=(int8u)-1; FMC_ES_ID_IsValid=false; Searching=false; Searching_Payload_Start=false; Searching_Payload_Continue=false; #ifdef MEDIAINFO_MPEGTS_PCR_YES Searching_TimeStamp_Start=false; Searching_TimeStamp_End=false; #endif //MEDIAINFO_MPEGTS_PCR_YES #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES Searching_ParserTimeStamp_Start=false; Searching_ParserTimeStamp_End=false; #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES EndTimeStampMoreThanxSeconds=false; ShouldDuplicate=false; IsRegistered=false; IsUpdated_IsRegistered=false; IsUpdated_Info=false; IsScrambled=false; CA_system_ID_MustSkipSlices=false; CA_system_ID=0x0000; Eia608_IsPresent=false; SubStream_pid=0x0000; #if MEDIAINFO_IBI Ibi_SynchronizationOffset_BeginOfFrame=(int64u)-1; #endif //MEDIAINFO_IBI } ~stream() { delete Parser; //Parser=NULL; for (size_t Pos=0; Pos streams; streams Streams; //Key is pid size_t Streams_NotParsedCount; size_t Streams_With_StartTimeStampCount; size_t Streams_With_EndTimeStampMoreThanxSecondsCount; //ATSC int8u GPS_UTC_offset; struct source { std::map texts; struct atsc_epg_block { struct event { int32u start_time; Ztring duration; Ztring title; std::map Eia708_Languages; //Key is caption_service_number std::map texts; bool Eia608_IsPresent; event() { start_time=(int32u)-1; Eia608_IsPresent=false; } }; typedef std::map events; //Key is event_id events Events; //Key is event_id }; typedef std::map atsc_epg_blocks; //Key is table_id atsc_epg_blocks ATSC_EPG_Blocks; //Key is table_id bool ATSC_EPG_Blocks_IsUpdated; source() { ATSC_EPG_Blocks_IsUpdated=false; } }; typedef std::map sources; //Key is source_id sources Sources; //Key is source_id bool Sources_IsUpdated; //For EPG ATSC bool Programs_IsUpdated; //For EPG DVB bool NoPatPmt; //File__Duplicate bool File__Duplicate_HasChanged_; size_t Config_File_Duplicate_Get_AlwaysNeeded_Count; std::vector Duplicates_Speed; std::vector > Duplicates_Speed_FromPID; std::map Duplicates; bool File__Duplicate_Get_From_PID (int16u pid) { if (Duplicates_Speed_FromPID.empty()) return false; return !Duplicates_Speed_FromPID[pid].empty(); } //SpeedUp information std::vector > StreamPos_ToRemove; std::map PCR_PIDs; //Key is PCR_PID, value is count of programs using it std::set PES_PIDs; //Key is pid std::vector program_number_Order; //Constructor/Destructor complete_stream() { transport_stream_id=(int16u)-1; transport_stream_id_IsValid=false; Duration_End_IsUpdated=false; Streams_NotParsedCount=(size_t)-1; Streams_With_StartTimeStampCount=0; Streams_With_EndTimeStampMoreThanxSecondsCount=0; GPS_UTC_offset=0; Sources_IsUpdated=false; Programs_IsUpdated=false; NoPatPmt=false; StreamPos_ToRemove.resize(Stream_Max); } ~complete_stream() { for (size_t StreamID=0; StreamID::iterator Duplicates_Temp=Duplicates.begin(); while (Duplicates_Temp!=Duplicates.end()) { delete Duplicates_Temp->second; //Duplicates_Temp->second=NULL ++Duplicates_Temp; } } }; //*************************************************************************** // Class File_Mpeg_Descriptors //*************************************************************************** class File_Mpeg_Descriptors : public File__Analyze { public : //In complete_stream* Complete_Stream; int16u transport_stream_id; int16u pid; int8u table_id; int16u table_id_extension; int16u elementary_PID; int16u program_number; int32u registration_format_identifier; int8u stream_type; int16u event_id; bool elementary_PID_IsValid; bool program_number_IsValid; bool registration_format_identifier_IsValid; bool stream_type_IsValid; bool event_id_IsValid; //Out //Constructor/Destructor File_Mpeg_Descriptors(); private : //Buffer - File header void FileHeader_Parse(); //Buffer - Per element void Header_Parse(); void Data_Parse(); //Elements void Descriptors(); void Descriptor(); void Descriptor_00() {Skip_XX(Element_Size, "Data");}; void Descriptor_01() {Skip_XX(Element_Size, "Data");}; void Descriptor_02(); void Descriptor_03(); void Descriptor_04() {Skip_XX(Element_Size, "Data");}; void Descriptor_05(); void Descriptor_06(); void Descriptor_07(); void Descriptor_08(); void Descriptor_09(); void Descriptor_0A(); void Descriptor_0B(); void Descriptor_0C() {Skip_XX(Element_Size, "Data");}; void Descriptor_0D(); void Descriptor_0E(); void Descriptor_0F(); void Descriptor_10(); void Descriptor_11(); void Descriptor_12() {Skip_XX(Element_Size, "Data");}; void Descriptor_13() {Skip_XX(Element_Size, "Data");}; void Descriptor_14() {Skip_XX(Element_Size, "Data");}; void Descriptor_15() {Skip_XX(Element_Size, "Data");}; void Descriptor_16() {Skip_XX(Element_Size, "Data");}; void Descriptor_17() {Skip_XX(Element_Size, "Data");}; void Descriptor_18() {Skip_XX(Element_Size, "Data");}; void Descriptor_19() {Skip_XX(Element_Size, "Data");}; void Descriptor_1A() {Skip_XX(Element_Size, "Data");}; void Descriptor_1B() {Skip_XX(Element_Size, "Data");}; void Descriptor_1C(); void Descriptor_1D(); void Descriptor_1E() {Skip_XX(Element_Size, "Data");}; void Descriptor_1F(); void Descriptor_20() {Skip_XX(Element_Size, "Data");}; void Descriptor_21() {Skip_XX(Element_Size, "Data");}; void Descriptor_22() {Skip_XX(Element_Size, "Data");}; void Descriptor_23() {Skip_XX(Element_Size, "Data");}; void Descriptor_24() {Skip_XX(Element_Size, "Data");}; void Descriptor_25() {Skip_XX(Element_Size, "Data");}; void Descriptor_26() {Skip_XX(Element_Size, "Data");}; void Descriptor_27() {Skip_XX(Element_Size, "Data");}; void Descriptor_28(); void Descriptor_29() {Skip_XX(Element_Size, "Data");}; void Descriptor_2A(); void Descriptor_2B() {Skip_XX(Element_Size, "Data");}; void Descriptor_2C() {Skip_XX(Element_Size, "Data");}; void Descriptor_2D() {Skip_XX(Element_Size, "Data");}; void Descriptor_2E() {Skip_XX(Element_Size, "Data");}; void Descriptor_2F(); void Descriptor_30() {Skip_XX(Element_Size, "Data");}; void Descriptor_31() {Skip_XX(Element_Size, "Data");}; void Descriptor_32() {Skip_XX(Element_Size, "Data");}; void Descriptor_33() {Skip_XX(Element_Size, "Data");}; void Descriptor_34() {Skip_XX(Element_Size, "Data");}; void Descriptor_35() {Skip_XX(Element_Size, "Data");}; void Descriptor_36() {Skip_XX(Element_Size, "Data");}; void Descriptor_37() {Skip_XX(Element_Size, "Data");}; void Descriptor_38() {Skip_XX(Element_Size, "Data");}; void Descriptor_39() {Skip_XX(Element_Size, "Data");}; void Descriptor_3A() {Skip_XX(Element_Size, "Data");}; void Descriptor_3F() {Skip_XX(Element_Size, "Data");}; void Descriptor_40(); void Descriptor_41(); void Descriptor_42() {Skip_XX(Element_Size, "Data");}; void Descriptor_43(); void Descriptor_44() {Skip_XX(Element_Size, "Data");}; void Descriptor_45() {Skip_XX(Element_Size, "Data");}; void Descriptor_46() {Skip_XX(Element_Size, "Data");}; void Descriptor_47() {Skip_XX(Element_Size, "Data");}; void Descriptor_48(); void Descriptor_49() {Skip_XX(Element_Size, "Data");}; void Descriptor_4A(); void Descriptor_4B() {Skip_XX(Element_Size, "Data");}; void Descriptor_4C() {Skip_XX(Element_Size, "Data");}; void Descriptor_4D(); void Descriptor_4E() {Skip_XX(Element_Size, "Data");}; void Descriptor_4F() {Skip_XX(Element_Size, "Data");}; void Descriptor_50(); void Descriptor_51() {Skip_XX(Element_Size, "Data");}; void Descriptor_52(); void Descriptor_53() {Skip_XX(Element_Size, "Data");}; void Descriptor_54(); void Descriptor_55(); void Descriptor_56(); void Descriptor_57() {Skip_XX(Element_Size, "Data");}; void Descriptor_58(); void Descriptor_59(); void Descriptor_5A(); void Descriptor_5B() {Skip_XX(Element_Size, "Data");}; void Descriptor_5C() {Skip_XX(Element_Size, "Data");}; void Descriptor_5D(); void Descriptor_5E() {Skip_XX(Element_Size, "Data");}; void Descriptor_5F(); void Descriptor_60() {Skip_XX(Element_Size, "Data");}; void Descriptor_61() {Skip_XX(Element_Size, "Data");}; void Descriptor_62() {Skip_XX(Element_Size, "Data");}; void Descriptor_63(); void Descriptor_64() {Skip_XX(Element_Size, "Data");}; void Descriptor_65() {Skip_XX(Element_Size, "Data");}; void Descriptor_66(); void Descriptor_67() {Skip_XX(Element_Size, "Data");}; void Descriptor_68() {Skip_XX(Element_Size, "Data");}; void Descriptor_69() {Skip_XX(Element_Size, "Data");}; void Descriptor_6A(); void Descriptor_6B() {Skip_XX(Element_Size, "Data");}; void Descriptor_6C() {Skip_XX(Element_Size, "Data");}; void Descriptor_6D() {Skip_XX(Element_Size, "Data");}; void Descriptor_6E() {Skip_XX(Element_Size, "Data");}; void Descriptor_6F() {Skip_XX(Element_Size, "Data");}; void Descriptor_70() {Skip_XX(Element_Size, "Data");}; void Descriptor_71() {Skip_XX(Element_Size, "Data");}; void Descriptor_72() {Skip_XX(Element_Size, "Data");}; void Descriptor_73() {Skip_XX(Element_Size, "Data");}; void Descriptor_74() {Skip_XX(Element_Size, "Data");}; void Descriptor_75() {Skip_XX(Element_Size, "Data");}; void Descriptor_76() {Skip_XX(Element_Size, "Data");}; void Descriptor_77() {Skip_XX(Element_Size, "Data");}; void Descriptor_78() {Skip_XX(Element_Size, "Data");}; void Descriptor_79() {Skip_XX(Element_Size, "Data");}; void Descriptor_7A(); void Descriptor_7B(); void Descriptor_7C(); void Descriptor_7D() {Skip_XX(Element_Size, "Data");}; void Descriptor_7E() {Skip_XX(Element_Size, "Data");}; void Descriptor_7F() {Skip_XX(Element_Size, "Data");}; void Descriptor_80() {Skip_XX(Element_Size, "Data");}; void Descriptor_81(); void Descriptor_86(); void Descriptor_87(); void Descriptor_A0(); void Descriptor_A1(); void Descriptor_A2() {Skip_XX(Element_Size, "Data");}; void Descriptor_A3(); void Descriptor_A8() {Skip_XX(Element_Size, "Data");}; void Descriptor_A9() {Skip_XX(Element_Size, "Data");}; void Descriptor_AA(); void Descriptor_AB() {Skip_XX(Element_Size, "Data");}; void Descriptor_C1(); void Descriptor_C8(); void Descriptor_DE(); void Descriptor_FC(); void Descriptor_FD(); //SCTE 35 void CUEI_00(); void CUEI_01(); void CUEI_02(); //Helpers void ATSC_multiple_string_structure(Ztring &Value, const char* Info); void Get_DVB_Text(int64u Size, Ztring &Value, const char* Info); void Skip_DVB_Text(int64u Size, const char* Info) {Ztring Temp; Get_DVB_Text(Size, Temp, Info);}; Ztring Date_MJD(int16u Date); Ztring Time_BCD(int32u Time); Ztring TimeHHMM_BCD(int16u Time); Ztring Frequency_DVB__BCD(int32u Frequency); Ztring OrbitalPosition_DVB__BCD(int32u OrbitalPosition); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Mpeg_Psi.cpp100777 0 0 362257 12226004262 16566 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPEGPS_YES) || defined(MEDIAINFO_MPEGTS_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Mpeg_Psi.h" #include "MediaInfo/Multiple/File_Mpeg_Descriptors.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "MediaInfo/MediaInfo_Internal.h" #include "ZenLib/Dir.h" #include #include using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constants //*************************************************************************** namespace Elements { const int32u CUEI=0x43554549; //SCTE const int32u GA94=0x47413934; //ATSC - Terrestrial const int32u HDMV=0x48444D56; //BluRay const int32u S14A=0x53313441; //ATSC - Satellite const int32u SCTE=0x53435445; //SCTE const int32u TSHV=0x54534856; //TSHV } //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* Mpeg_Psi_ATSC_table_type(int16u ID) { switch (ID) { case 0x0000 : return "Terrestrial VCT with current_next_indicator=1"; case 0x0001 : return "Terrestrial VCT with current_next_indicator=0"; case 0x0002 : return "Cable VCT with current_next_indicator=1"; case 0x0003 : return "Cable VCT with current_next_indicator==0"; case 0x0004 : return "Channel ETT"; case 0x0005 : return "DCCSCT"; case 0x0010 : return "Short-form Virtual Channel Table-VCM Subtyp"; case 0x0011 : return "Short-form Virtual Channel Table-DCM Subtyp"; case 0x0012 : return "Short-form Virtual Channel Table-ICM Subtyp"; case 0x0020 : return "Network Information Table-CDS Table Subtype"; case 0x0021 : return "Network Information Table-MMS Table Subtype"; case 0x0030 : return "Network Text Tabl e-SNS Subtype"; default : if (ID>=0x0100 && ID<=0x017F) return "Event Information Table (EIT)"; if (ID>=0x0200 && ID<=0x027F) return "Event Extended Text Table (EETT)"; if (ID>=0x0300 && ID<=0x03FF) return "Rating Region Table (RRT)"; if (ID>=0x0400 && ID<=0x0FFF) return "User private"; if (ID>=0x1000 && ID<=0x10FF) return "Aggregate Event Information Table (AEIT)"; if (ID>=0x1100 && ID<=0x11FF) return "Aggregate Extended Text Table (AETT)"; if (ID>=0x1400 && ID<=0x14FF) return "DCCT"; return "Reserved"; } } //--------------------------------------------------------------------------- const char* Mpeg_Psi_stream_type_Format(int8u stream_type, int32u format_identifier) { switch (stream_type) { case 0x01 : return "MPEG Video"; //Version 1 case 0x02 : return "MPEG Video"; //Version 2 case 0x03 : return "MPEG Audio"; //Version 1 case 0x04 : return "MPEG Audio"; //Version 2 case 0x0F : return "AAC"; case 0x10 : return "MPEG-4 Visual"; case 0x11 : return "AAC"; case 0x1B : return "AVC"; case 0x1C : return "AAC"; case 0x1D : return "Timed Text"; case 0x1E : return "MPEG Video"; //ISO/IEC 23002-3 case 0x1F : return "AVC"; case 0x20 : return "AVC"; case 0x27 : return "HEVC"; default : switch (format_identifier) { case Elements::CUEI : case Elements::SCTE : //SCTE case Elements::GA94 : case Elements::S14A : //ATSC switch (stream_type) { case 0x80 : return "MPEG Video"; case 0x81 : return "AC-3"; case 0x82 : return "Text"; case 0x86 : return "SCTE 35"; case 0x87 : return "E-AC-3"; default : return ""; } case Elements::HDMV : //Bluray switch (stream_type) { case 0x80 : return "PCM"; case 0x81 : return "AC-3"; case 0x82 : return "DTS"; case 0x83 : return "AC-3"; // (TrueHD)" case 0x84 : return "E-AC-3"; case 0x85 : return "DTS"; //" (HD-HRA)" case 0x86 : return "DTS"; //" (HD-MA)" case 0x90 : return "PGS"; case 0xA1 : return "AC-3"; case 0xA2 : return "DTS"; case 0xEA : return "VC-1"; default : return ""; } case 0xFFFFFFFF : //Unknown return ""; default : switch (stream_type) { case 0x80 : return "MPEG Video"; case 0x81 : return "AC-3"; case 0x87 : return "E-AC-3"; case 0x88 : return "VC-1"; case 0xD1 : return "Dirac"; default : return ""; } } } } //--------------------------------------------------------------------------- const char* Mpeg_Psi_stream_type_Codec(int8u stream_type, int32u format_identifier) { switch (stream_type) { case 0x01 : return "MPEG-1V"; case 0x02 : return "MPEG-2V"; case 0x03 : return "MPEG-1A"; case 0x04 : return "MPEG-2A"; case 0x0F : return "AAC"; case 0x10 : return "MPEG-4V"; case 0x11 : return "AAC"; case 0x1B : return "AVC"; case 0x1C : return "AAC"; case 0x1D : return "Text"; case 0x1E : return "MPEG-2V"; case 0x1F : return "AVC"; case 0x20 : return "AVC"; case 0x27 : return "HEVC"; default : switch (format_identifier) { case Elements::CUEI : case Elements::SCTE : //SCTE case Elements::GA94 : case Elements::S14A : //ATSC switch (stream_type) { case 0x80 : return "MPEG-2V"; case 0x81 : return "AC3"; case 0x82 : return "Text"; case 0x87 : return "AC3+"; default : return ""; } case Elements::HDMV : //Bluray switch (stream_type) { case 0x80 : return "PCM"; case 0x81 : return "AC3"; case 0x82 : return "DTS"; case 0x83 : return "AC3+"; case 0x86 : return "DTS"; case 0x90 : return "PGS"; case 0xEA : return "VC1"; default : return ""; } case 0xFFFFFFFF : //Unknown return ""; default : switch (stream_type) { case 0x80 : return "MPEG-2V"; case 0x81 : return "AC3"; case 0x87 : return "AC3+"; case 0x88 : return "VC-1"; case 0xD1 : return "Dirac"; default : return ""; } } } } //--------------------------------------------------------------------------- stream_t Mpeg_Psi_stream_type_StreamKind(int32u stream_type, int32u format_identifier) { switch (stream_type) { case 0x01 : return Stream_Video; case 0x02 : return Stream_Video; case 0x03 : return Stream_Audio; case 0x04 : return Stream_Audio; case 0x0F : return Stream_Audio; case 0x10 : return Stream_Video; case 0x11 : return Stream_Audio; case 0x1B : return Stream_Video; case 0x1C : return Stream_Audio; case 0x1D : return Stream_Text; case 0x1E : return Stream_Video; case 0x1F : return Stream_Video; case 0x20 : return Stream_Video; default : switch (format_identifier) { case Elements::CUEI : case Elements::SCTE : //SCTE case Elements::GA94 : case Elements::S14A : //ATSC switch (stream_type) { case 0x80 : return Stream_Video; case 0x81 : return Stream_Audio; case 0x82 : return Stream_Text; case 0x87 : return Stream_Audio; default : return Stream_Max; } case Elements::HDMV : //Bluray switch (stream_type) { case 0x80 : return Stream_Audio; case 0x81 : return Stream_Audio; case 0x82 : return Stream_Audio; case 0x83 : return Stream_Audio; case 0x84 : return Stream_Audio; case 0x85 : return Stream_Audio; case 0x86 : return Stream_Audio; case 0x90 : return Stream_Text; case 0xA1 : return Stream_Audio; case 0xA2 : return Stream_Audio; case 0xEA : return Stream_Video; default : return Stream_Max; } case Elements::TSHV : //DV switch (stream_type) { case 0xA0 : return Stream_General; case 0xA1 : return Stream_General; default : return Stream_Max; } case 0xFFFFFFFF : //Unknown return Stream_Max; default : switch (stream_type) { case 0x80 : return Stream_Video; case 0x81 : return Stream_Audio; case 0x87 : return Stream_Audio; case 0x88 : return Stream_Video; case 0xD1 : return Stream_Video; default : return Stream_Max; } } } } //--------------------------------------------------------------------------- const char* Mpeg_Psi_stream_type_Info(int8u stream_type, int32u format_identifier) { switch (stream_type) { case 0x00 : return "ITU-T | ISO/IEC Reserved"; case 0x01 : return "ISO/IEC 11172 Video"; case 0x02 : return "ITU-T Rec. H.262 | ISO/IEC 13818-2 Video or ISO/IEC 11172-2 constrained parameter video stream"; case 0x03 : return "ISO/IEC 11172 Audio"; case 0x04 : return "ISO/IEC 13818-3 Audio"; case 0x05 : return "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 private_sections"; case 0x06 : return "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES packets containing private data"; case 0x07 : return "ISO/IEC 13522 MHEG"; case 0x08 : return "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Annex A DSM-CC"; case 0x09 : return "ITU-T Rec. H.222.1"; case 0x0A : return "ISO/IEC 13818-6 type A"; case 0x0B : return "ISO/IEC 13818-6 type B"; case 0x0C : return "ISO/IEC 13818-6 type C"; case 0x0D : return "ISO/IEC 13818-6 type D"; case 0x0E : return "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 auxiliary"; case 0x0F : return "ISO/IEC 13818-7 Audio with ADTS transport syntax"; case 0x10 : return "ISO/IEC 14496-2 Visual"; case 0x11 : return "ISO/IEC 14496-3 Audio with the LATM transport syntax as defined in ISO/IEC 14496-3 / AMD 1"; case 0x12 : return "ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in PES packets"; case 0x13 : return "ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in ISO/IEC14496_sections."; case 0x14 : return "ISO/IEC 13818-6 Synchronized Download Protocol"; case 0x15 : return "Metadata carried in PES packets"; case 0x16 : return "Metadata carried in metadata_sections"; case 0x17 : return "Metadata carried in ISO/IEC 13818-6 Data Carousel"; case 0x18 : return "Metadata carried in ISO/IEC 13818-6 Object Carousel"; case 0x19 : return "Metadata carried in ISO/IEC 13818-6 Synchronized Download Protocol"; case 0x1A : return "IPMP stream (defined in ISO/IEC 13818-11, MPEG-2 IPMP)"; case 0x1B : return "AVC video stream as defined in ITU-T Rec. H.264 | ISO/IEC 14496-10 Video"; case 0x1C : return "ISO/IEC 14496-3 Audio, without using any additional transport syntax"; case 0x1D : return "ISO/IEC 14496-17 Text"; case 0x1E : return "Auxiliary video data stream as defined in ISO/IEC 23002-3"; case 0x1F : return "SVC video sub-bitstream of an AVC video stream conforming to one or more profiles defined in Annex G of ITU-T Rec. H.264 | ISO/IEC 14496-10"; case 0x20 : return "MVC video sub-bitstream of an AVC video stream conforming to one or more profiles defined in Annex H of ITU-T Rec. H.264 | ISO/IEC 14496-10"; case 0x27 : return "ITU-T Rec. H.265 | ISO/IEC 23008-2 MPEG-H Part 2 / HEVC video stream"; case 0x7F : return "IPMP stream"; default : if (stream_type<=0x7F) return "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 reserved"; switch (format_identifier) { case Elements::CUEI : case Elements::GA94 : case Elements::S14A : //ATSC case Elements::SCTE : //SCTE switch (stream_type) { case 0x80 : return "SCTE - MPEG Video"; case 0x81 : return "ATSC - AC-3"; case 0x82 : return "SCTE - Standard Subtitle"; case 0x83 : return "SCTE - Isochronous Data"; case 0x84 : return "ATSC - Reserved"; case 0x85 : return "ATSC - Program Identifier"; case 0x86 : return "SCTE - Splice"; case 0x87 : return "ATSC - E-AC-3"; case 0x90 : return "DVB - stream_type value for Time Slicing / MPE-FEC"; case 0x95 : return "ATSC - Data Service Table, Network Resources Table"; default : return "ATSC/SCTE - Unknown"; } case Elements::HDMV : //Bluray switch (stream_type) { case 0x80 : return "BluRay - PCM"; case 0x81 : return "BluRay - AC-3"; case 0x82 : return "BluRay - DTS"; case 0x83 : return "BluRay - AC-3 (TrueHD)"; case 0x84 : return "BluRay - E-AC-3"; case 0x85 : return "BluRay - DTS (HD-HRA)"; case 0x86 : return "BluRay - DTS (HD-MA)"; case 0x90 : return "BluRay - PGS"; case 0xA1 : return "BluRay - AC-3"; case 0xA2 : return "BluRay - DTS"; case 0xEA : return "BluRay - VC-1"; default : return "Bluray - Unknown"; } case Elements::TSHV : //DV switch (stream_type) { case 0xA0 : return "DV - Data 0"; case 0xA1 : return "DV - Data 1"; default : return "Bluray - Unknown"; } case 0xFFFFFFFF : //Unknown return ""; default : switch (stream_type) { case 0x80 : return "DigiCipher II video"; case 0x81 : return "AC-3"; case 0x88 : return "VC-1"; case 0x87 : return "E-AC-3"; case 0xD1 : return "Dirac"; default : return "User Private"; } } } } //--------------------------------------------------------------------------- const char* Mpeg_Psi_table_id(int8u table_id) { switch (table_id) { case 0x00 : return "program_association_section"; case 0x01 : return "conditional_access_section"; case 0x02 : return "TS_program_map_section"; case 0x03 : return "TS_description_section"; case 0x04 : return "ISO_IEC_14496_scene_description_section"; case 0x05 : return "ISO_IEC_14496_object_descriptor_section"; case 0x06 : return "Metadata?"; case 0x38 : return "ISO/IEC 13818-6 reserved"; case 0x39 : return "DSM-CC addressable section"; case 0x3A : return "DSM-CC : return MPE"; case 0x3B : return "DSM-CC : return U-N messages : return except DDM"; case 0x3C : return "DSM-CC : return DDM"; case 0x3D : return "DSM-CC : return stream descriptors"; case 0x3E : return "DSM-CC : return private data : return IP-Datagram"; case 0x3F : return "DSM-CC addressable section"; case 0x40 : return "DVB - network_information_section - actual_network"; case 0x41 : return "DVB - network_information_section - other_network"; case 0x42 : return "DVB - service_description_section - actual_transport_stream"; case 0x46 : return "DVB - service_description_section - other_transport_stream"; case 0x4A : return "DVB - bouquet_association_section"; case 0x4E : return "DVB - event_information_section - actual_transport_stream : return present/following"; case 0x4F : return "DVB - event_information_section - other_transport_stream : return present/following"; case 0x50 : case 0x51 : case 0x52 : case 0x53 : case 0x54 : case 0x55 : case 0x56 : case 0x57 : case 0x58 : case 0x59 : case 0x5A : case 0x5B : case 0x5C : case 0x5E : case 0x5F : return "DVB - event_information_section - actual_transport_stream : return schedule"; case 0x60 : case 0x61 : case 0x62 : case 0x63 : case 0x64 : case 0x65 : case 0x66 : case 0x67 : case 0x68 : case 0x69 : case 0x6A : case 0x6B : case 0x6C : case 0x6D : case 0x6E : case 0x6F : return "DVB - event_information_section - other_transport_stream : return schedule"; case 0x70 : return "DVB - time_date_section"; case 0x71 : return "DVB - running_status_section"; case 0x72 : return "DVB - stuffing_section"; case 0x73 : return "DVB - time_offset_section"; case 0x74 : return "DVB - application information section"; case 0x75 : return "DVB - container section"; case 0x76 : return "DVB - related content section"; case 0x77 : return "DVB - content identifier section"; case 0x78 : return "DVB - MPE-FEC section"; case 0x79 : return "DVB - resolution notification section"; case 0x7E : return "DVB - discontinuity_information_section"; case 0x7F : return "DVB - selection_information_section"; case 0xC0 : return "ATSC - Program Information Message"; case 0xC1 : return "ATSC - Program Name Message"; case 0xC2 : return "ATSC/SCTE - Network Information Message"; case 0xC3 : return "ATSC/SCTE - Network Text Table (NTT)"; case 0xC4 : return "ATSC/SCTE - Short Form Virtual Channel Table (S-VCT)"; case 0xC5 : return "ATSC/SCTE - System Time Table (STT)"; case 0xC6 : return "ATSC/SCTE - Subtitle Message"; case 0xC7 : return "ATSC - Master Guide Table (MGT)"; case 0xC8 : return "ATSC - Terrestrial Virtual Channel Table (TVCT)"; case 0xC9 : return "ATSC - Cable Virtual Channel Table (CVCT) / Long-form Virtual Channel Table (L-VCT)"; case 0xCA : return "ATSC - Rating Region Table (RRT)"; case 0xCB : return "ATSC - Event Information Table (EIT)"; case 0xCC : return "ATSC - Extended Text Table (ETT)"; case 0xCD : return "ATSC - System Time Table (STT)"; case 0xCE : return "ATSC - Data Event Table (DET)"; case 0xCF : return "ATSC - Data Service Table (DST)"; case 0xD0 : return "ATSC - Program Identifier Table (PIT)"; case 0xD1 : return "ATSC - Network Resource Table (NRT)"; case 0xD2 : return "ATSC - Long-term Service Table (L-TST)"; case 0xD3 : return "ATSC - Directed Channel Change Table (DCCT)"; case 0xD4 : return "ATSC - DCC Selection Code Table (DCCSCT)"; case 0xD5 : return "ATSC - Selection Information Table (SIT)"; case 0xD6 : return "ATSC - Aggregate Event Information Table (AEIT)"; case 0xD7 : return "ATSC - Aggregate Extended Text Table (AETT)"; case 0xD8 : return "ATSC - Cable Emergency Alert"; case 0xD9 : return "ATSC - Aggregate Data Event Table"; case 0xDA : return "ATSC - Satellite VCT (SVCT)"; case 0xFC : return "SCTE - Splice"; default : if (table_id>=0x06 && table_id<=0x37) return "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 reserved"; if (table_id>=0x40 && table_id<=0x7F) return "DVB - reserved"; if (table_id>=0x80 && table_id<=0x8F) return "CA message"; if (table_id>=0xC0 && table_id<=0xDF) return "ATSC/SCTE - reserved"; if (table_id<=0xFE) return "User Private"; return "unknown"; } } //--------------------------------------------------------------------------- const char* Mpeg_Psi_atsc_service_type(int8u service_type) { switch (service_type) { case 0x00 : return "reserved"; case 0x01 : return "Analog television"; case 0x02 : return "Digital television"; case 0x03 : return "Digital radio"; case 0x04 : return "Data"; default : return "reserved for future use"; } } //--------------------------------------------------------------------------- const char* Mpeg_Psi_table_id_extension(int8u table_id) { switch (table_id) { case 0x00 : return "transport_stream_id"; case 0x01 : return "reserved"; case 0x02 : return "program_number"; case 0x03 : return "reserved"; case 0x40 : return "network_id"; case 0x42 : case 0x46 : return "transport_stream_id"; case 0x4E : case 0x4F : case 0x50 : case 0x51 : case 0x52 : case 0x53 : case 0x54 : case 0x55 : case 0x56 : case 0x57 : case 0x58 : case 0x59 : case 0x5A : case 0x5B : case 0x5C : case 0x5E : case 0x5F : case 0x60 : case 0x61 : case 0x62 : case 0x63 : case 0x64 : case 0x65 : case 0x66 : case 0x67 : case 0x68 : case 0x69 : case 0x6A : case 0x6B : case 0x6C : case 0x6D : case 0x6E : case 0x6F : return "service_id"; case 0x7F : return "DVB_reserved_for_future_use"; case 0xC8 : case 0xC9 : return "transport_stream_id"; case 0xCA : return "reserved + rating_region"; case 0xCB : return "source_id"; case 0xCC : return "ETT_table_id_extension"; case 0xD9 : return "AEIT_subtype + MGT_tag"; case 0xDA : return "SVCT_subtype + SVCT_id"; default : return "table_id_extension"; } } //--------------------------------------------------------------------------- // CRC_32_Table // A CRC is computed like this: // Init: int32u CRC_32 = 0xFFFFFFFF; // for each data byte do // CRC_32=(CRC_32<<8) ^ CRC_32_Table[(CRC_32>>24)^(data_byte)]; int32u Psi_CRC_32_Table[256] = { 0x00000000, 0x04C11DB7, 0x09823B6E, 0x0D4326D9, 0x130476DC, 0x17C56B6B, 0x1A864DB2, 0x1E475005, 0x2608EDB8, 0x22C9F00F, 0x2F8AD6D6, 0x2B4BCB61, 0x350C9B64, 0x31CD86D3, 0x3C8EA00A, 0x384FBDBD, 0x4C11DB70, 0x48D0C6C7, 0x4593E01E, 0x4152FDA9, 0x5F15ADAC, 0x5BD4B01B, 0x569796C2, 0x52568B75, 0x6A1936C8, 0x6ED82B7F, 0x639B0DA6, 0x675A1011, 0x791D4014, 0x7DDC5DA3, 0x709F7B7A, 0x745E66CD, 0x9823B6E0, 0x9CE2AB57, 0x91A18D8E, 0x95609039, 0x8B27C03C, 0x8FE6DD8B, 0x82A5FB52, 0x8664E6E5, 0xBE2B5B58, 0xBAEA46EF, 0xB7A96036, 0xB3687D81, 0xAD2F2D84, 0xA9EE3033, 0xA4AD16EA, 0xA06C0B5D, 0xD4326D90, 0xD0F37027, 0xDDB056FE, 0xD9714B49, 0xC7361B4C, 0xC3F706FB, 0xCEB42022, 0xCA753D95, 0xF23A8028, 0xF6FB9D9F, 0xFBB8BB46, 0xFF79A6F1, 0xE13EF6F4, 0xE5FFEB43, 0xE8BCCD9A, 0xEC7DD02D, 0x34867077, 0x30476DC0, 0x3D044B19, 0x39C556AE, 0x278206AB, 0x23431B1C, 0x2E003DC5, 0x2AC12072, 0x128E9DCF, 0x164F8078, 0x1B0CA6A1, 0x1FCDBB16, 0x018AEB13, 0x054BF6A4, 0x0808D07D, 0x0CC9CDCA, 0x7897AB07, 0x7C56B6B0, 0x71159069, 0x75D48DDE, 0x6B93DDDB, 0x6F52C06C, 0x6211E6B5, 0x66D0FB02, 0x5E9F46BF, 0x5A5E5B08, 0x571D7DD1, 0x53DC6066, 0x4D9B3063, 0x495A2DD4, 0x44190B0D, 0x40D816BA, 0xACA5C697, 0xA864DB20, 0xA527FDF9, 0xA1E6E04E, 0xBFA1B04B, 0xBB60ADFC, 0xB6238B25, 0xB2E29692, 0x8AAD2B2F, 0x8E6C3698, 0x832F1041, 0x87EE0DF6, 0x99A95DF3, 0x9D684044, 0x902B669D, 0x94EA7B2A, 0xE0B41DE7, 0xE4750050, 0xE9362689, 0xEDF73B3E, 0xF3B06B3B, 0xF771768C, 0xFA325055, 0xFEF34DE2, 0xC6BCF05F, 0xC27DEDE8, 0xCF3ECB31, 0xCBFFD686, 0xD5B88683, 0xD1799B34, 0xDC3ABDED, 0xD8FBA05A, 0x690CE0EE, 0x6DCDFD59, 0x608EDB80, 0x644FC637, 0x7A089632, 0x7EC98B85, 0x738AAD5C, 0x774BB0EB, 0x4F040D56, 0x4BC510E1, 0x46863638, 0x42472B8F, 0x5C007B8A, 0x58C1663D, 0x558240E4, 0x51435D53, 0x251D3B9E, 0x21DC2629, 0x2C9F00F0, 0x285E1D47, 0x36194D42, 0x32D850F5, 0x3F9B762C, 0x3B5A6B9B, 0x0315D626, 0x07D4CB91, 0x0A97ED48, 0x0E56F0FF, 0x1011A0FA, 0x14D0BD4D, 0x19939B94, 0x1D528623, 0xF12F560E, 0xF5EE4BB9, 0xF8AD6D60, 0xFC6C70D7, 0xE22B20D2, 0xE6EA3D65, 0xEBA91BBC, 0xEF68060B, 0xD727BBB6, 0xD3E6A601, 0xDEA580D8, 0xDA649D6F, 0xC423CD6A, 0xC0E2D0DD, 0xCDA1F604, 0xC960EBB3, 0xBD3E8D7E, 0xB9FF90C9, 0xB4BCB610, 0xB07DABA7, 0xAE3AFBA2, 0xAAFBE615, 0xA7B8C0CC, 0xA379DD7B, 0x9B3660C6, 0x9FF77D71, 0x92B45BA8, 0x9675461F, 0x8832161A, 0x8CF30BAD, 0x81B02D74, 0x857130C3, 0x5D8A9099, 0x594B8D2E, 0x5408ABF7, 0x50C9B640, 0x4E8EE645, 0x4A4FFBF2, 0x470CDD2B, 0x43CDC09C, 0x7B827D21, 0x7F436096, 0x7200464F, 0x76C15BF8, 0x68860BFD, 0x6C47164A, 0x61043093, 0x65C52D24, 0x119B4BE9, 0x155A565E, 0x18197087, 0x1CD86D30, 0x029F3D35, 0x065E2082, 0x0B1D065B, 0x0FDC1BEC, 0x3793A651, 0x3352BBE6, 0x3E119D3F, 0x3AD08088, 0x2497D08D, 0x2056CD3A, 0x2D15EBE3, 0x29D4F654, 0xC5A92679, 0xC1683BCE, 0xCC2B1D17, 0xC8EA00A0, 0xD6AD50A5, 0xD26C4D12, 0xDF2F6BCB, 0xDBEE767C, 0xE3A1CBC1, 0xE760D676, 0xEA23F0AF, 0xEEE2ED18, 0xF0A5BD1D, 0xF464A0AA, 0xF9278673, 0xFDE69BC4, 0x89B8FD09, 0x8D79E0BE, 0x803AC667, 0x84FBDBD0, 0x9ABC8BD5, 0x9E7D9662, 0x933EB0BB, 0x97FFAD0C, 0xAFB010B1, 0xAB710D06, 0xA6322BDF, 0xA2F33668, 0xBCB4666D, 0xB8757BDA, 0xB5365D03, 0xB1F740B4 }; //--------------------------------------------------------------------------- const char* Mpeg_Psi_running_status[]= { "", "Not running", "Starts in a few seconds", "Pausing", "Running", "Reserved", "Reserved", "Reserved", }; //--------------------------------------------------------------------------- extern const char* Mpeg_Descriptors_original_network_id(int16u original_network_id); //--------------------------------------------------------------------------- const char* Mpeg_Psi_splice_command_type(int8u splice_command_type) { switch (splice_command_type) { case 0x00 : return "splice_null"; case 0x04 : return "splice_schedule"; case 0x05 : return "splice_insert"; case 0x06 : return "time_signal"; case 0x07 : return "bandwidth_reservation"; default : return "Reserved"; } }; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Mpeg_Psi::File_Mpeg_Psi() :File__Analyze() { //In From_TS=true; //Default is from TS Complete_Stream=NULL; pid=(int16u)-1; //Temp transport_stream_id=0x0000; //Impossible CRC_32=0; elementary_PID=0x0000; program_number=0x0000; stream_type=0x00; event_id=0x0000; elementary_PID_IsValid=false; program_number_IsValid=false; stream_type_IsValid=false; event_id_IsValid=false; current_next_indicator=false; IsATSC=false; ForceStreamDisplay=MediaInfoLib::Config.MpegTs_ForceStreamDisplay_Get(); } //--------------------------------------------------------------------------- File_Mpeg_Psi::~File_Mpeg_Psi() { } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpeg_Psi::FileHeader_Parse() { //Parsing if (From_TS) { int8u pointer_field; Get_B1 (pointer_field, "pointer_field"); if (pointer_field) Skip_XX(pointer_field, "payload"); } } //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- bool File_Mpeg_Psi::Header_Begin() { if (Buffer_Offset) //Not the first one { Peek_B1(table_id); if (table_id==0xFF) { Accept(); Fill(); Finish(); return false; } } return true; } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Header_Parse() { //From Program stream if (!From_TS) { //Filling table_id=0xFF; //Make it invalid section_syntax_indicator=false; Header_Fill_Code((int64u)-1, "program_stream_map"); //(int64u)-1 for precising "out of scope" Header_Fill_Size(Element_Size-4); return; } //Parsing int16u section_length; Get_B1 (table_id, "table_id"); BS_Begin(); Get_SB ( section_syntax_indicator, "section_syntax_indicator"); Skip_SB( "private_indicator"); Skip_S1( 2, "reserved"); Get_S2 (12, section_length, "section_length"); BS_End(); //Size if ((size_t)section_length>24)^(*CRC_32_Buffer)]; CRC_32_Buffer++; } if (CRC_32) { Trusted_IsNot("CRC error"); Reject(); return; } } //Filling Header_Fill_Code(table_id, Ztring().From_Number(table_id, 16)); Header_Fill_Size(3+section_length); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Data_Parse() { //Check if OK if (table_id<=0x06 && !section_syntax_indicator) { Skip_XX(Element_Size, "Data (section_syntax_indicator failed)"); Finish("PSI"); return; } if (section_syntax_indicator) { Element_Size-=4; //Reserving size of CRC32 Get_B2( table_id_extension, Mpeg_Psi_table_id_extension(table_id)); Element_Name(Ztring(Mpeg_Psi_table_id_extension(table_id))+__T("=")+Ztring::ToZtring_From_CC2(table_id_extension)); BS_Begin(); Skip_S1( 2, "reserved"); Get_S1 ( 5, version_number, "version_number"); Element_Info1(__T("Version=")+Ztring::ToZtring(version_number)); Get_SB ( current_next_indicator, "current_next_indicator"); BS_End(); Info_B1( section_number, "section_number"); Element_Info1(__T("Section=")+Ztring::ToZtring(section_number)); Skip_B1( "last_section_number"); } else if (table_id==0xC1) { Element_Size-=4; //Reserving size of CRC32 } #define ELEMENT_CASE(_NAME, _DETAIL) \ case 0x##_NAME : Element_Name(_DETAIL); Table_##_NAME(); break; switch (table_id) { ELEMENT_CASE(00, "program_association_section"); ELEMENT_CASE(01, "conditional_access_section"); ELEMENT_CASE(02, "TS_program_map_section"); ELEMENT_CASE(03, "TS_description_section"); ELEMENT_CASE(04, "ISO_IEC_14496_scene_description_section"); ELEMENT_CASE(05, "ISO_IEC_14496_object_descriptor_section"); ELEMENT_CASE(06, "Metadata?"); ELEMENT_CASE(38, "ISO/IEC 13818-6 reserved"); ELEMENT_CASE(39, "DSM-CC addressable section"); ELEMENT_CASE(3A, "DSM-CC, MPE"); ELEMENT_CASE(3B, "DSM-CC, U-N messages, except DDM"); ELEMENT_CASE(3C, "DSM-CC, DDM"); ELEMENT_CASE(3D, "DSM-CC, stream descriptors"); ELEMENT_CASE(3E, "DSM-CC, private data, IP-Datagram"); ELEMENT_CASE(3F, "DSM-CC addressable section"); ELEMENT_CASE(40, "DVB - network_information_section - actual_network"); ELEMENT_CASE(41, "DVB - network_information_section - other_network"); ELEMENT_CASE(42, "DVB - service_description_section - actual_transport_stream"); ELEMENT_CASE(46, "DVB - service_description_section - other_transport_stream"); ELEMENT_CASE(4A, "DVB - bouquet_association_section"); ELEMENT_CASE(4E, "DVB - event_information_section - actual_transport_stream, present/following"); ELEMENT_CASE(4F, "DVB - event_information_section - other_transport_stream, present/following"); case 0x50 : case 0x51 : case 0x52 : case 0x53 : case 0x54 : case 0x55 : case 0x56 : case 0x57 : case 0x58 : case 0x59 : case 0x5A : case 0x5B : case 0x5C : case 0x5E : ELEMENT_CASE(5F, "DVB - event_information_section - actual_transport_stream, schedule"); case 0x60 : case 0x61 : case 0x62 : case 0x63 : case 0x64 : case 0x65 : case 0x66 : case 0x67 : case 0x68 : case 0x69 : case 0x6A : case 0x6B : case 0x6C : case 0x6D : case 0x6E : ELEMENT_CASE(6F, "DVB - event_information_section - other_transport_stream, schedule"); ELEMENT_CASE(70, "DVB - time_date_section"); ELEMENT_CASE(71, "DVB - running_status_section"); ELEMENT_CASE(72, "DVB - stuffing_section"); ELEMENT_CASE(73, "DVB - time_offset_section"); ELEMENT_CASE(74, "DVB - application information section"); ELEMENT_CASE(75, "DVB - container section"); ELEMENT_CASE(76, "DVB - related content section"); ELEMENT_CASE(77, "DVB - content identifier section"); ELEMENT_CASE(78, "DVB - MPE-FEC section"); ELEMENT_CASE(79, "DVB - resolution notification section"); ELEMENT_CASE(7E, "DVB - discontinuity_information_section"); ELEMENT_CASE(7F, "DVB - selection_information_section"); ELEMENT_CASE(C0, "ATSC - Program Information Message"); ELEMENT_CASE(C1, "ATSC - Program Name Message"); ELEMENT_CASE(C2, "ATSC/SCTE - Network Information Message"); ELEMENT_CASE(C3, "ATSC/SCTE - Network Text Table (NTT)"); ELEMENT_CASE(C4, "ATSC/SCTE - Short Form Virtual Channel Table (S-VCT)"); ELEMENT_CASE(C5, "ATSC/SCTE - System Time Table (STT)"); ELEMENT_CASE(C6, "ATSC/SCTE - Subtitle Message"); ELEMENT_CASE(C7, "ATSC - Master Guide Table (MGT)"); ELEMENT_CASE(C8, "ATSC - Terrestrial Virtual Channel Table (TVCT)"); ELEMENT_CASE(C9, "ATSC - Cable Virtual Channel Table (CVCT) / Long-form Virtual Channel Table (L-VCT)"); ELEMENT_CASE(CA, "ATSC - Rating Region Table (RRT)"); ELEMENT_CASE(CB, "ATSC - Event Information Table (EIT)"); ELEMENT_CASE(CC, "ATSC - Extended Text Table (ETT)"); ELEMENT_CASE(CD, "ATSC - System Time Table (STT)"); ELEMENT_CASE(CE, "ATSC - Data Event Table (DET)"); ELEMENT_CASE(CF, "ATSC - Data Service Table (DST)"); ELEMENT_CASE(D0, "ATSC - Program Identifier Table (PIT)"); ELEMENT_CASE(D1, "ATSC - Network Resource Table (NRT)"); ELEMENT_CASE(D2, "ATSC - Long-term Service Table (L-TST)"); ELEMENT_CASE(D3, "ATSC - Directed Channel Change Table (DCCT)"); ELEMENT_CASE(D4, "ATSC - DCC Selection Code Table (DCCSCT)"); ELEMENT_CASE(D5, "ATSC - Selection Information Table (SIT)"); ELEMENT_CASE(D6, "ATSC - Aggregate Event Information Table (AEIT)"); ELEMENT_CASE(D7, "ATSC - Aggregate Extended Text Table (AETT)"); ELEMENT_CASE(D8, "ATSC - Cable Emergency Alert"); ELEMENT_CASE(D9, "ATSC - Aggregate Data Event Table"); ELEMENT_CASE(DA, "ATSC - Satellite VCT"); ELEMENT_CASE(FC, "SCTE - Splice"); default : if (table_id>=0x06 && table_id<=0x37) {Element_Name("ITU-T Rec. H.222.0 | ISO/IEC 13818-1 reserved"); Skip_XX(Element_Size, "Unknown"); break;} if (table_id>=0x40 && table_id<=0x7F) {Element_Name("DVB - reserved"); Skip_XX(Element_Size, "Unknown"); break;} if (table_id>=0x80 && table_id<=0x8F) {Element_Name("CA message, EMM, ECM"); Skip_XX(Element_Size, "Unknown"); break;} if (table_id>=0xC0 && table_id<=0xDF) {Element_Name("ATSC/SCTE - reserved");Skip_XX(Element_Size, "Unknown"); break;} if (table_id<=0xFE) {Element_Name("User Private"); Skip_XX(Element_Size, "Unknown"); break;} if (Element_Code==(int64u)-1) {program_stream_map(); break;} //Specific to MPEG-PS {Element_Name("forbidden"); Skip_XX(Element_Size, "Unknown"); break;} } if (section_syntax_indicator || table_id==0xC1) { Element_Size+=4; Skip_B4( "CRC32"); } if (table_id>=0x40 && Config->ParseSpeed>=0.5 && Complete_Stream->Streams_NotParsedCount!=(size_t)-1 && Complete_Stream->Streams_NotParsedCount!=0) Complete_Stream->Streams_NotParsedCount=(size_t)-1; //Disabling speed up for detection in case of DVB/ATSC tables, we want all of them. if (Buffer_Offset+Element_Size==Buffer_Size) { Accept(); Fill(); Finish(); } } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_reserved() { } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_iso13818_6() { Element_Info1("Defined in ISO/IEC 13818-6"); Skip_XX(Element_Size, "Data"); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_user_private() { Element_Info1("user_private"); Skip_XX(Element_Size, "Data"); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_forbidden() { Element_Info1("forbidden"); Skip_XX(Element_Size, "Data"); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::program_stream_map() { Element_Name("program_stream_map"); table_id=0x02; // program_map_section //Parsing int16u elementary_stream_map_length; bool single_extension_stream_flag; BS_Begin(); Skip_SB( "current_next_indicator"); Get_SB (single_extension_stream_flag, "single_extension_stream_flag"); Skip_SB( "reserved"); Skip_S1( 5, "program_stream_map_version"); Skip_S1( 7, "reserved"); Mark_1 (); BS_End(); Get_B2 (Descriptors_Size, "program_stream_info_length"); if (Descriptors_Size>0) Descriptors(); Get_B2 (elementary_stream_map_length, "elementary_stream_map_length"); int16u elementary_stream_map_Pos=0; while (Element_Offset=3) Descriptors_Size-=3; } if (Descriptors_Size>0) { elementary_PID=elementary_stream_id; elementary_PID_IsValid=true; Descriptors(); } Element_End0(); elementary_stream_map_Pos+=4+ES_info_length; FILLING_BEGIN(); Complete_Stream->Streams[elementary_stream_id]->stream_type=stream_type; Complete_Stream->Streams[elementary_stream_id]->Infos["CodecID"].From_Number(stream_type); FILLING_END(); } } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_00() { //transport_stream_id if (!Complete_Stream->transport_stream_id_IsValid || table_id_extension!=Complete_Stream->transport_stream_id) { if (Complete_Stream->Transport_Streams.find(Complete_Stream->transport_stream_id)!=Complete_Stream->Transport_Streams.end()) while (!Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs.empty()) { program_number=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs.begin()->first; program_number_Remove(); } Complete_Stream->transport_stream_id=table_id_extension; Complete_Stream->transport_stream_id_IsValid=true; } if (Complete_Stream->Transport_Streams[table_id_extension].Programs_NotParsedCount==(size_t)-1) Complete_Stream->Transport_Streams[table_id_extension].Programs_NotParsedCount=0; Complete_Stream->Transport_Streams[table_id_extension].programs_List.clear(); //Saving previous status std::map program_numbers_Previous=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs; //Reseting std::vector Table_ID_Extension_List; for (complete_stream::stream::table_id::table_id_extensions::iterator Table_ID_Extension=Complete_Stream->Streams[0x0000]->Table_IDs[0x00]->Table_ID_Extensions.begin(); Table_ID_Extension!=Complete_Stream->Streams[0x0000]->Table_IDs[0x00]->Table_ID_Extensions.end(); ++Table_ID_Extension) if (Table_ID_Extension->first!=table_id_extension) Table_ID_Extension_List.push_back(Table_ID_Extension->first); for (size_t Pos=0; PosStreams[0x0000]->Table_IDs[0x00]->Table_ID_Extensions.erase(Table_ID_Extension_List[Pos]); //Parsing while (Element_OffsetFile_Filter_Get(program_number) #endif //MEDIAINFO_FILTER ) { program_number_Update(); std::map::iterator program_number_Previous=program_numbers_Previous.find(program_number); if (program_number_Previous!=program_numbers_Previous.end()) program_numbers_Previous.erase(program_number_Previous); } FILLING_END(); } BS_End(); FILLING_BEGIN(); //Removing previous elementary_PIDs no more used for (std::map::iterator program_number_Previous=program_numbers_Previous.begin(); program_number_Previous!=program_numbers_Previous.end(); ++program_number_Previous) { program_number=program_number_Previous->first; program_number_Remove(); } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_01() { //Parsing if (Element_Offset0) Descriptors(); } } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_02() { //Informing PSI is parsed if (!Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[table_id_extension].IsParsed && Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs_NotParsedCount) { Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs_NotParsedCount--; Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[table_id_extension].IsParsed=true; } //Saving previous status std::vector elementary_PIDs_Previous=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[table_id_extension].elementary_PIDs; //Parsing int16u PCR_PID; BS_Begin(); Skip_S1( 3, "reserved"); Get_S2 (13, PCR_PID, "PCR_PID"); Skip_S1( 4, "reserved"); Get_S2 (12, Descriptors_Size, "program_info_length"); BS_End(); //Descriptors transport_stream_id=Complete_Stream->transport_stream_id; program_number=table_id_extension; program_number_IsValid=true; if (Descriptors_Size>0) Descriptors(); //Parsing while (Element_OffsetTransport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].registration_format_identifier)); Param_Info1(Mpeg_Psi_stream_type_Info(stream_type, Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].registration_format_identifier)); Skip_S1( 3, "reserved"); Get_S2 (13, elementary_PID, "elementary_PID"); Skip_S1( 4, "reserved"); Get_S2 (12, Descriptors_Size, "ES_info_length"); BS_End(); FILLING_BEGIN(); //Searching for hidden Stereoscopic stream if (stream_type==0x20 && File_Name_WithoutDemux.size()>=4+1+6+1+4+1+10 && Config->File_Bdmv_ParseTargetedFile_Get()) { //Searching the playlist with the pid Ztring Name=File_Name_WithoutDemux; Name.resize(Name.size()-(4+1+6+1+4+1+10)); //Removing BDMV/STREAM/SSIF/xxxxx.ssif ZtringList List=Dir::GetAllFileNames(Name+__T("BDMV")+PathSeparator+__T("PLAYLIST")+PathSeparator+__T("*.mpls"), Dir::Include_Files); std::vector MIs; MIs.resize(List.size()); size_t FileWithRightPID_Pos=(size_t)-1; for (size_t Pos=0; PosOption(__T("File_Bdmv_ParseTargetedFile"), __T("0")); MIs[Pos]->Open(List[Pos]); if (MIs[Pos]->Count_Get(Stream_Video)==1) { int16u pid=Ztring(MIs[Pos]->Get(Stream_Video, 0, Video_ID)).To_int16u(); if (pid==elementary_PID) { FileWithRightPID_Pos=Pos; break; } } } if (FileWithRightPID_Pos!=(size_t)-1) { ZtringList ID_List; ID_List.Separator_Set(0, __T(" / ")); ID_List.Write(MIs[FileWithRightPID_Pos]->Get(Stream_Video, 0, Video_ID)); if (ID_List.size()==2) { Complete_Stream->Streams[ID_List[1].To_int16u()]->SubStream_pid=elementary_PID; Complete_Stream->Streams[elementary_PID]->SubStream_pid=ID_List[1].To_int16u(); elementary_PID=ID_List[1].To_int16u(); stream_type=0x1B; bool IsAlreadyPresent=false; for (size_t Pos=0; PosStreams[elementary_PID]->program_numbers.size(); Pos++) if (Complete_Stream->Streams[elementary_PID]->program_numbers[Pos]==program_number) IsAlreadyPresent=true; if (!IsAlreadyPresent) { Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].elementary_PIDs.push_back(elementary_PID); Complete_Stream->Streams[elementary_PID]->program_numbers.push_back(program_number); Complete_Stream->Streams[elementary_PID]->registration_format_identifier=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].registration_format_identifier; } if (Complete_Stream->Streams[elementary_PID]->Kind!=complete_stream::stream::pes) { if (Complete_Stream->Streams_NotParsedCount==(size_t)-1) Complete_Stream->Streams_NotParsedCount=0; Complete_Stream->Streams_NotParsedCount++; Complete_Stream->Streams[elementary_PID]->Kind=complete_stream::stream::pes; Complete_Stream->Streams[elementary_PID]->stream_type=stream_type; Complete_Stream->Streams[elementary_PID]->Searching_Payload_Start_Set(true); #ifdef MEDIAINFO_MPEGTS_PCR_YES Complete_Stream->Streams[elementary_PID]->Searching_TimeStamp_Start_Set(true); Complete_Stream->Streams[elementary_PID]->PCR_PID=PCR_PID; #endif //MEDIAINFO_MPEGTS_PCR_YES #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES //Complete_Stream->Streams[elementary_PID]->Searching_ParserTimeStamp_Start_Set(true); #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES #if MEDIAINFO_TRACE Complete_Stream->Streams[elementary_PID]->Element_Info1="PES"; #endif //MEDIAINFO_TRACE if (Complete_Stream->File__Duplicate_Get_From_PID(elementary_PID)) Complete_Stream->Streams[elementary_PID]->ShouldDuplicate=true; } } } for (size_t Pos=0; Pos0) Descriptors(); Element_End1(Ztring::ToZtring_From_CC2(elementary_PID)); } FILLING_BEGIN(); //Removing previous elementary_PIDs no more used if (Config->File_MpegTs_RealTime_Get()) { for (size_t Pos=0; PosTransport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].Update_Needed_StreamCount=true; } } #ifdef MEDIAINFO_MPEGTS_PCR_YES if (PCR_PID!=0x1FFF) //Not padding packet { Complete_Stream->Streams[PCR_PID]->IsPCR=true; Complete_Stream->PCR_PIDs[PCR_PID]++; Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].PCR_PID=PCR_PID; if (Complete_Stream->Streams[PCR_PID]->TimeStamp_Start==(int64u)-1) Complete_Stream->Streams[PCR_PID]->Searching_TimeStamp_Start_Set(true); #if MEDIAINFO_TRACE if (Complete_Stream->Streams[PCR_PID]->Kind==complete_stream::stream::unknown) Complete_Stream->Streams[PCR_PID]->Element_Info1="PCR"; #endif //MEDIAINFO_TRACE } #endif //MEDIAINFO_MPEGTS_PCR_YES //Handling ATSC/CEA/DVB if (!Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs_NotParsedCount) { //We know what is each pid, so we can try known values #ifdef MEDIAINFO_MPEGTS_ALLSTREAMS_YES for (size_t pid=0x10; pid<0x1FFF; pid++) //Wanting 0x10-->0x2F (DVB), 0x1ABC (cea_osd), 0x1FF7-->0x1FFF (ATSC) for (size_t Table_ID=0x00; Table_ID<0xFF; Table_ID++) { Complete_Stream->Streams[pid]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[pid]->Kind=complete_stream::stream::psi; Complete_Stream->Streams[pid]->Table_IDs.resize(0x100); Complete_Stream->Streams[pid]->Table_IDs[Table_ID]=new complete_stream::stream::table_id; //event_information_section - actual_transport_stream, schedule if (Pos==0x001F) Pos=0x1ABB; //Skipping normal data if (Pos==0x01ABC) Pos=0x1FF6; //Skipping normal data } #else //MEDIAINFO_MPEGTS_ALLSTREAMS_YES if (Complete_Stream->Streams[0x0010]->Kind==complete_stream::stream::unknown) { Complete_Stream->Streams[0x0010]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[0x0010]->Kind=complete_stream::stream::psi; Complete_Stream->Streams[0x0010]->Table_IDs.resize(0x100); Complete_Stream->Streams[0x0010]->Table_IDs[0x40]=new complete_stream::stream::table_id; //network_information_section - actual_network } if (Complete_Stream->Streams[0x0011]->Kind==complete_stream::stream::unknown) { Complete_Stream->Streams[0x0011]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[0x0011]->Kind=complete_stream::stream::psi; Complete_Stream->Streams[0x0011]->Table_IDs.resize(0x100); Complete_Stream->Streams[0x0011]->Table_IDs[0x42]=new complete_stream::stream::table_id; //service_description_section - actual_transport_stream } if (Complete_Stream->Streams[0x0012]->Kind==complete_stream::stream::unknown) { Complete_Stream->Streams[0x0012]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[0x0012]->Kind=complete_stream::stream::psi; Complete_Stream->Streams[0x0012]->Table_IDs.resize(0x100); Complete_Stream->Streams[0x0012]->Table_IDs[0x4E]=new complete_stream::stream::table_id; //event_information_section - actual_transport_stream, present/following for (size_t Table_ID=0x50; Table_ID<0x60; Table_ID++) Complete_Stream->Streams[0x0012]->Table_IDs[Table_ID]=new complete_stream::stream::table_id; //event_information_section - actual_transport_stream, schedule } if (Complete_Stream->Streams[0x0014]->Kind==complete_stream::stream::unknown) { Complete_Stream->Streams[0x0014]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[0x0014]->Kind=complete_stream::stream::psi; Complete_Stream->Streams[0x0014]->Table_IDs.resize(0x100); Complete_Stream->Streams[0x0014]->Table_IDs[0x70]=new complete_stream::stream::table_id; //time_date_section Complete_Stream->Streams[0x0014]->Table_IDs[0x73]=new complete_stream::stream::table_id; //time_offset_section } if (Complete_Stream->Streams[0x1FFB]->Kind==complete_stream::stream::unknown) { Complete_Stream->Streams[0x1FFB]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[0x1FFB]->Kind=complete_stream::stream::psi; Complete_Stream->Streams[0x1FFB]->Table_IDs.resize(0x100); Complete_Stream->Streams[0x1FFB]->Table_IDs[0xC7]=new complete_stream::stream::table_id; //Master Guide Table Complete_Stream->Streams[0x1FFB]->Table_IDs[0xCD]=new complete_stream::stream::table_id; //System Time Table } #endif //MEDIAINFO_MPEGTS_ALLSTREAMS_YES } if (Buffer_Offset>=4) { Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].ExtraInfos_Content["pointer_field"].From_Number(Buffer_Offset-4); Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].ExtraInfos_Option["pointer_field"]=__T("N NT"); } Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].ExtraInfos_Content["section_length"].From_Number(Element_Size+4); Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].ExtraInfos_Option["section_length"]=__T("N NT"); FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_03() { //Parsing if (Element_Offset0) Descriptors(); } } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_40() { if (IsATSC) { Skip_XX(Element_Size, "Unknown ATSC"); return; } //Parsing BS_Begin(); Skip_S1( 4, "reserved"); Get_S2 (12, Descriptors_Size, "network_descriptors_length"); BS_End(); //Descriptors if (Descriptors_Size>0) Descriptors(); //Parsing int16u transport_stream_loop_length; BS_Begin(); Skip_S1( 4, "reserved"); Get_S2 (12, transport_stream_loop_length, "transport_stream_loop_length"); BS_End(); if (Element_Offset0) Descriptors(); Element_End0(); FILLING_BEGIN(); Complete_Stream->original_network_name=Mpeg_Descriptors_original_network_id(original_network_id); FILLING_END(); } } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_42() { //Parsing Skip_B2( "original_network_id"); Skip_B1( "reserved_future_use"); while (Element_Offset0) Descriptors(); Element_End1(Ztring::ToZtring_From_CC2(program_number)); } else { Skip_XX(Element_Size-Element_Offset, "Junk"); Element_End1("Junk"); } } } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_46() { Table_42(); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_4E() { //Clearing Complete_Stream->Transport_Streams[transport_stream_id].Programs[table_id_extension].DVB_EPG_Blocks[table_id].Events.clear(); Complete_Stream->Transport_Streams[transport_stream_id].Programs[table_id_extension].DVB_EPG_Blocks_IsUpdated=true; Complete_Stream->Programs_IsUpdated=true; //Parsing Get_B2 (transport_stream_id, "transport_stream_id"); if (table_id==0x4E || (table_id&0xF0)==0x50) //current transport_stream_id transport_stream_id=Complete_Stream->transport_stream_id; //On the example I have, transport_stream_id is something else, what? Skip_B2( "original_network_id"); Skip_B1( "segment_last_section_number"); Skip_B1( "last_table_id"); if (Element_Offset==Element_Size) { Element_DoNotShow(); //This is empty! return; } while (Element_Offset0) Descriptors(); Element_End1(Ztring::ToZtring_From_CC2(event_id)); FILLING_BEGIN(); Complete_Stream->Transport_Streams[transport_stream_id].Programs[table_id_extension].DVB_EPG_Blocks[table_id].Events[event_id].start_time=__T("UTC ")+Date_MJD(date)+__T(" ")+Time_BCD(time); Complete_Stream->Transport_Streams[transport_stream_id].Programs[table_id_extension].DVB_EPG_Blocks[table_id].Events[event_id].duration=Time_BCD(duration); if (running_status) Complete_Stream->Transport_Streams[transport_stream_id].Programs[table_id_extension].DVB_EPG_Blocks[table_id].Events[event_id].running_status=Mpeg_Psi_running_status[running_status]; FILLING_END(); } } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_4F() { Table_4E(); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_5F() { Table_4E(); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_6F() { Table_4F(); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_70() { //Parsing int32u time; int16u date; Get_B2 (date, "UTC_time (date)"); Param_Info1(Date_MJD(date)); Get_B3 (time, "UTC_time (time)"); Param_Info1(Time_BCD(time)); FILLING_BEGIN(); if (Complete_Stream->Duration_Start.empty()) Complete_Stream->Duration_Start=__T("UTC ")+Date_MJD(date)+__T(" ")+Time_BCD(time); Complete_Stream->Duration_End=__T("UTC ")+Date_MJD(date)+__T(" ")+Time_BCD(time); Complete_Stream->Duration_End_IsUpdated=true; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_73() { //Parsing int32u time; int16u date; Get_B2 (date, "UTC_time (date)"); Param_Info1(Date_MJD(date)); Get_B3 (time, "UTC_time (time)"); Param_Info1(Time_BCD(time)); BS_Begin(); Skip_S1( 4, "DVB_reserved_for_future_use"); Get_S2 (12, Descriptors_Size, "transmission_info_loop_length"); BS_End(); //Descriptors if (Descriptors_Size>0) Descriptors(); Skip_B4( "CRC32"); FILLING_BEGIN(); if (Complete_Stream->Duration_Start.empty()) Complete_Stream->Duration_Start=__T("UTC ")+Date_MJD(date)+__T(" ")+Time_BCD(time); Complete_Stream->Duration_End=__T("UTC ")+Date_MJD(date)+__T(" ")+Time_BCD(time); Complete_Stream->Duration_End_IsUpdated=true; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_7F() { //Parsing BS_Begin(); Skip_S1( 4, "DVB_reserved_for_future_use"); Get_S2 (12, Descriptors_Size, "transmission_info_loop_length"); BS_End(); //Descriptors if (Descriptors_Size>0) Descriptors(); while (Element_Offset0) Descriptors(); Element_End1(Ztring::ToZtring_From_CC2(program_number)); } } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_C0() { //TODO Skip_XX(Element_Size-Element_Offset, "data"); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_C1() { IsATSC=true; //Parsing Ztring program_name, alternate_program_name; int8u protocol_version, program_name_length, alternate_program_name_length, package_count; BS_Begin(); Skip_S1(3, "reserved"); Get_S1 (5, protocol_version, "protocol_version"); BS_End(); if (protocol_version!=0) { Skip_XX(Element_Size-Element_Offset, "data"); return; } Skip_C3( "ISO_639_language_code"); Skip_B2( "program_number"); Skip_B1( "reserved"); Skip_B1( "sequence"); Skip_B1( "program_epoch_number"); BS_Begin(); Skip_SB( "display_name_when_not_auth"); Skip_SB( "use_alt_name_in_purchase_history"); Skip_SB( "use_alt_name_if_not_auth"); Skip_SB( "display_ratings"); Skip_S1(4, "reserved"); BS_End(); Get_B1 (program_name_length, "program_name_length"); SCTE_multilingual_text_string(program_name_length, program_name, "program_name"); Get_B1 (alternate_program_name_length, "alternate_program_name_length"); SCTE_multilingual_text_string(alternate_program_name_length, alternate_program_name, "alternate_program_name"); BS_Begin(); Skip_S1(3, "reserved"); Get_S1 (5, package_count, "package_count"); BS_End(); for (int8u Pos=0; Pos0) Descriptors(); } } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_C7() { //Parsing int16u tables_defined; int8u protocol_version; Get_B1 (protocol_version, "protocol_version"); if (protocol_version!=0) { Skip_XX(Element_Size-Element_Offset, "data"); return; } Get_B2 (tables_defined, "tables_defined"); for (int16u Pos=0; Pos0) Descriptors(); Element_Info1(Mpeg_Psi_ATSC_table_type(table_type)); Element_Info1C((table_type>=0x0100), table_type%0x100); Element_End1(Ztring::ToZtring_From_CC2(table_type_PID)); FILLING_BEGIN(); if (Complete_Stream->Streams[table_type_PID]->Kind==complete_stream::stream::unknown && table_type!=0x0001 && table_type!=0x0003) //Not activing current_next_indicator='0' { Complete_Stream->Streams[table_type_PID]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[table_type_PID]->Kind=complete_stream::stream::psi; Complete_Stream->Streams[table_type_PID]->Table_IDs.resize(0x100); } #ifdef MEDIAINFO_MPEGTS_ALLSTREAMS_YES for (int8u table_id=0x00; table_id<0xFF; table_id++) if (Complete_Stream->Streams[table_type_PID].Table_IDs[table_id]==NULL) Complete_Stream->Streams[table_type_PID].Table_IDs[table_id]=new complete_stream::stream::table_id; //Master Guide Table #else //MEDIAINFO_MPEGTS_ALLSTREAMS_YES int8u table_id; if (table_type==0x0000) //Terrestrial VCT with current_next_indicator=1 table_id=0xC8; else if (table_type==0x0002) //Cable VCT with current_next_indicator=1 table_id=0xC9; else if (table_type==0x0004) //Channel ETT table_id=0xCC; else if (table_type>=0x0100 && table_type<=0x017F) //EIT-0 to EIT-127 table_id=0xCB; else if (table_type>=0x0200 && table_type<=0x027F) //Event ETT-0 to event ETT-127 table_id=0xCC; else if (table_type>=0x0301 && table_type<=0x03FF) //RRT with rating_region 1-255 table_id=0xCA; else if (table_type>=0x1000 && table_type<0x10FF) //Aggregate Event Information Table table_id=0xD6; else if (table_type>=0x1100 && table_type<0x11FF) //Aggregate Extended Text Table table_id=0xD7; else if (table_type>=0x1600 && table_type<0x16FF) //Satellite Virtual Channel Table table_id=0xDA; else table_id=0xFF; if (table_id!=0xFF && Complete_Stream->Streams[table_type_PID]->Table_IDs[table_id]==NULL) Complete_Stream->Streams[table_type_PID]->Table_IDs[table_id]=new complete_stream::stream::table_id; //Master Guide Table #endif //MEDIAINFO_MPEGTS_ALLSTREAMS_YES Complete_Stream->Streams[table_type_PID]->table_type=table_type-((table_type&0x200)?0x100:0); //For having the same table_type for both EIT and ETT FILLING_END(); } BS_Begin(); Skip_S1( 4, "reserved"); Get_S2 (12, Descriptors_Size, "descriptors_length"); BS_End(); //Descriptors if (Descriptors_Size>0) Descriptors(); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_C9() { //Parsing Ztring short_name; int8u num_channels_in_section; Skip_B1( "protocol_version"); Get_B1 ( num_channels_in_section, "num_channels_in_section"); BS_End(); for (int8u Pos=0; PosFile_MpegTs_Atsc_transport_stream_id_Trust_Get()) table_id_extension=Complete_Stream->transport_stream_id; Ztring Channel=Ztring::ToZtring(major_channel_number); if (minor_channel_number) Channel+=__T("-")+Ztring::ToZtring(minor_channel_number); if (minor_channel_number==0 || program_number==0xFFFF) { Complete_Stream->Transport_Streams[table_id_extension].Infos["ServiceName"]=short_name; Complete_Stream->Transport_Streams[table_id_extension].Infos["ServiceChannel"]=Channel; Complete_Stream->Transport_Streams[table_id_extension].Infos["ServiceType"]=Mpeg_Psi_atsc_service_type(service_type); Complete_Stream->Transport_Streams[table_id_extension].source_id=source_id; Complete_Stream->Transport_Streams[table_id_extension].source_id_IsValid=true; } else if (program_number<0x2000) { Complete_Stream->Transport_Streams[table_id_extension].Programs[program_number].Infos["ServiceName"]=short_name; Complete_Stream->Transport_Streams[table_id_extension].Programs[program_number].Infos["ServiceChannel"]=Channel; Complete_Stream->Transport_Streams[table_id_extension].Programs[program_number].Infos["ServiceType"]=Mpeg_Psi_atsc_service_type(service_type); Complete_Stream->Transport_Streams[table_id_extension].Programs[program_number].source_id=source_id; Complete_Stream->Transport_Streams[table_id_extension].Programs[program_number].source_id_IsValid=true; } FILLING_END(); //Descriptors program_number_IsValid=true; if (Descriptors_Size>0) Descriptors(); Element_End1(Ztring::ToZtring_From_CC2(program_number)); } BS_Begin(); Skip_S1( 6, "reserved"); Get_S2 (10, Descriptors_Size, "additional_descriptors_length"); BS_End(); //Descriptors if (Descriptors_Size>0) Descriptors(); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_CA() { //Parsing Ztring rating_region_name; int8u dimensions_defined; Skip_B1( "protocol_version"); Skip_B1( "rating_region_name_length"); //Not used ATSC_multiple_string_structure(rating_region_name, "rating_region_name"); Get_B1 ( dimensions_defined, "dimensions_defined"); BS_End(); for (int8u dimension_Pos=0; dimension_Pos0) Descriptors(); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_CB() { //Clear Complete_Stream->Sources[table_id_extension].ATSC_EPG_Blocks[table_id].Events.clear(); Complete_Stream->Sources[table_id_extension].ATSC_EPG_Blocks_IsUpdated=true; Status[IsUpdated]=true; //Parsing int8u num_events_in_section; if (table_id==0xCB) //EIT (not A-EIT) Skip_B1( "protocol_version"); Get_B1 ( num_events_in_section, "num_events_in_section"); BS_End(); for (int8u Pos=0; PosGPS_UTC_offset)); //UTC 1980-01-06 00:00:00 BS_Begin(); Skip_S1( 2, "reserved"); Skip_S1( 2, table_id==0xCB?"ETM_location":"reserved"); Get_S3 (20, length_in_seconds, "length_in_seconds"); BS_End(); Skip_B1 ( "title_length"); //We don't use it for verification ATSC_multiple_string_structure(title, "title"); BS_Begin(); Skip_S1( 6, "reserved"); Get_S2 (10, Descriptors_Size, "descriptors_length"); BS_End(); //Descriptors event_id_IsValid=true; if (Descriptors_Size>0) Descriptors(); Element_End1(Ztring::ToZtring_From_CC2(event_id)); FILLING_BEGIN(); Complete_Stream->Sources[table_id_extension].ATSC_EPG_Blocks[Complete_Stream->Streams[pid]->table_type].Events[event_id].start_time=start_time; Ztring duration =(length_in_seconds<36000?__T("0"):__T(""))+Ztring::ToZtring(length_in_seconds/3600)+__T(":"); length_in_seconds%=3600; duration+=(length_in_seconds< 600?__T("0"):__T(""))+Ztring::ToZtring(length_in_seconds/ 60)+__T(":"); length_in_seconds%=60; duration+=(length_in_seconds< 10?__T("0"):__T(""))+Ztring::ToZtring(length_in_seconds ); Complete_Stream->Sources[table_id_extension].ATSC_EPG_Blocks[Complete_Stream->Streams[pid]->table_type].Events[event_id].duration=duration; Complete_Stream->Sources[table_id_extension].ATSC_EPG_Blocks[Complete_Stream->Streams[pid]->table_type].Events[event_id].title=title; FILLING_END(); } } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_CC() { //Parsing Ztring extended_text_message; int16u source_id, event_id; Skip_B1( "protocol_version"); Element_Begin1("ETM_id"); Get_B2 ( source_id, "source_id"); BS_Begin(); Get_S2 (14, event_id, "event_id"); Skip_S1( 2, "lsb"); BS_End(); Element_End0(); ATSC_multiple_string_structure(extended_text_message, "extended_text_message"); FILLING_BEGIN(); if (Complete_Stream->Streams[pid]->table_type==4) Complete_Stream->Sources[source_id].texts[table_id_extension]=extended_text_message; else { Complete_Stream->Sources[source_id].ATSC_EPG_Blocks[Complete_Stream->Streams[pid]->table_type].Events[event_id].texts[table_id_extension]=extended_text_message; Complete_Stream->Sources[source_id].ATSC_EPG_Blocks_IsUpdated=true; Complete_Stream->Sources_IsUpdated=true; } FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_CD() { //Parsing int32u system_time; int8u GPS_UTC_offset; Skip_B1( "protocol_version"); Get_B4 (system_time, "system_time"); Param_Info1(Ztring().Date_From_Seconds_1970(system_time+315964800)); //UTC 1980-01-06 00:00:00 Get_B1 (GPS_UTC_offset, "GPS_UTC_offset"); Element_Begin1("daylight_savings"); BS_Begin(); Skip_SB( "DS_status"); Skip_SB( "Reserved"); Skip_SB( "Reserved"); Skip_S1(5, "DS_day_of_month"); BS_End(); Skip_B1( "DS_hour"); Element_End0(); //Descriptors Descriptors_Size=(int16u)(Element_Size-Element_Offset); if (Descriptors_Size>0) Descriptors(); FILLING_BEGIN(); if (Complete_Stream->Duration_Start.empty()) Complete_Stream->Duration_Start=Ztring().Date_From_Seconds_1970(system_time+315964800-GPS_UTC_offset); Complete_Stream->Duration_End=Ztring().Date_From_Seconds_1970(system_time+315964800-GPS_UTC_offset); Complete_Stream->Duration_End_IsUpdated=true; Complete_Stream->GPS_UTC_offset=GPS_UTC_offset; FILLING_END(); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::Table_D6() { //Parsing if ((table_id_extension&0xFF00)==0x0000) { int8u num_sources_in_section; Get_B1 ( num_sources_in_section, "num_sources_in_section"); for (int8u Pos=0; Postransport_stream_id; //SCTE 35 is automaticly linked to the current transport_stream_id if (Descriptors_Size>0) Descriptors(); } if (Element_Offset+4Element_Size) { Trusted_IsNot("Descriptor size too big"); return; } //Configuring File_Mpeg_Descriptors Descriptors; Descriptors.Complete_Stream=Complete_Stream; Descriptors.transport_stream_id=transport_stream_id; Descriptors.pid=pid; Descriptors.table_id=table_id; Descriptors.table_id_extension=table_id_extension; Descriptors.elementary_PID=elementary_PID; Descriptors.program_number=program_number; Descriptors.stream_type=stream_type; Descriptors.event_id=event_id; Descriptors.elementary_PID_IsValid=elementary_PID_IsValid; Descriptors.program_number_IsValid=program_number_IsValid; Descriptors.stream_type_IsValid=stream_type_IsValid; Descriptors.event_id_IsValid=event_id_IsValid; //Parsing if (Descriptors_Size!=0) { Element_Begin1("Descriptors"); Open_Buffer_Init(&Descriptors); Open_Buffer_Continue(&Descriptors, Descriptors_Size); Element_End0(); } //Configuring elementary_PID_IsValid=false; program_number_IsValid=false; stream_type_IsValid=false; event_id_IsValid=false; } //--------------------------------------------------------------------------- void File_Mpeg_Psi::ATSC_multiple_string_structure(Ztring &Value, const char* Name) { //Parsing Ztring string; int8u number_strings, number_segments; Element_Begin1(Name); Get_B1(number_strings, "number_strings"); for (int8u string_Pos=0; string_Pos=0xA0) { int8u format_effector_param_length; Get_B1 (format_effector_param_length, "format_effector_param_length"); Skip_XX(format_effector_param_length, "format_effector_data"); } } Element_End0(); } //--------------------------------------------------------------------------- //Modified Julian Date Ztring File_Mpeg_Psi::Date_MJD(int16u Date_) { //Calculating float64 Date=Date_; int Y2=(int)((Date-15078.2)/365.25); int M2=(int)(((Date-14956.1) - ((int)(Y2*365.25))) /30.6001); int D =(int)(Date-14956 - ((int)(Y2*365.25)) - ((int)(M2*30.6001))); int K=0; if (M2==14 || M2==15) K=1; int Y =Y2+K; int M =M2-1-K*12; //Formating return Ztring::ToZtring(1900+Y)+__T("-") + (M<10?__T("0"):__T(""))+Ztring::ToZtring( M)+__T("-") + (D<10?__T("0"):__T(""))+Ztring::ToZtring( D); } //--------------------------------------------------------------------------- //Form: HHMMSS, BCD Ztring File_Mpeg_Psi::Time_BCD(int32u Time) { return (((Time>>16)&0xFF)<10?__T("0"):__T("")) + Ztring::ToZtring((Time>>16)&0xFF, 16)+__T(":") //BCD + (((Time>> 8)&0xFF)<10?__T("0"):__T("")) + Ztring::ToZtring((Time>> 8)&0xFF, 16)+__T(":") //BCD + (((Time )&0xFF)<10?__T("0"):__T("")) + Ztring::ToZtring((Time )&0xFF, 16); //BCD } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpeg_Psi::program_number_Update() { //Setting the pid as program_map_section if (Complete_Stream->Streams[elementary_PID]->Kind!=complete_stream::stream::psi) { Complete_Stream->Streams[elementary_PID]->Searching_Payload_Start_Set(true); Complete_Stream->Streams[elementary_PID]->Kind=complete_stream::stream::psi; Complete_Stream->Streams[elementary_PID]->Table_IDs.resize(0x100); if (program_number) Complete_Stream->Streams[elementary_PID]->Table_IDs[0x02]=new complete_stream::stream::table_id; //program_map_section } if (Complete_Stream->File__Duplicate_Get_From_PID(elementary_PID)) Complete_Stream->Streams[elementary_PID]->ShouldDuplicate=true; //Handling a program if (program_number) { Complete_Stream->Transport_Streams[table_id_extension].Programs_NotParsedCount++; Complete_Stream->Transport_Streams[table_id_extension].Programs[program_number].pid=elementary_PID; Complete_Stream->Transport_Streams[table_id_extension].programs_List.push_back(program_number); if (Complete_Stream->Streams.size()<0x2000) Complete_Stream->Streams.resize(0x2000); //TODO: find the reason this code is called Complete_Stream->Streams[elementary_PID]->program_numbers.push_back(program_number); if (Complete_Stream->Streams[elementary_PID]->Table_IDs.size()<0x100) Complete_Stream->Streams[elementary_PID]->Table_IDs.resize(0x100); //TODO: find the reason this code is called if (Complete_Stream->Streams[elementary_PID]->Table_IDs[0x02]==NULL) Complete_Stream->Streams[elementary_PID]->Table_IDs[0x02]=new complete_stream::stream::table_id; //TODO: find the reason this code is called if (Complete_Stream->Streams[elementary_PID]->Table_IDs[0x02]->Table_ID_Extensions.find(program_number)==Complete_Stream->Streams[elementary_PID]->Table_IDs[0x02]->Table_ID_Extensions.end()) { Complete_Stream->Streams[elementary_PID]->Table_IDs[0x02]->Table_ID_Extensions_CanAdd=false; Complete_Stream->Streams[elementary_PID]->Table_IDs[0x02]->Table_ID_Extensions[program_number].version_number=0xFF; Complete_Stream->Streams[elementary_PID]->Table_IDs[0x02]->Table_ID_Extensions[program_number].Section_Numbers.clear(); Complete_Stream->Streams[elementary_PID]->Table_IDs[0x02]->Table_ID_Extensions[program_number].Section_Numbers.resize(0x100); } } //Handling a network except basic version else if (Complete_Stream->Streams[elementary_PID]->Table_IDs[0x00]==NULL) { for (size_t Table_ID=1; Table_ID<0x100; Table_ID++) { if (Complete_Stream->Streams[elementary_PID]->Table_IDs[Table_ID]==NULL) Complete_Stream->Streams[elementary_PID]->Table_IDs[Table_ID]=new complete_stream::stream::table_id; //all if (Table_ID==1) Table_ID++; //Skipping TableID 2 } } } //--------------------------------------------------------------------------- void File_Mpeg_Psi::program_number_Remove() { //Removing this program_number from the list of program_numbers for each elementary_PID for (size_t Pos=0; PosTransport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].elementary_PIDs.size(); Pos++) { int16u elementary_PID_Temp=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].elementary_PIDs[Pos]; //Removing this program_number from the list of program_numbers for this elementary_PID for (size_t Pos=0; PosStreams[elementary_PID_Temp]->program_numbers.size(); Pos++) if (Complete_Stream->Streams[elementary_PID_Temp]->program_numbers[Pos]==program_number) Complete_Stream->Streams[elementary_PID_Temp]->program_numbers.erase(Complete_Stream->Streams[elementary_PID_Temp]->program_numbers.begin()+Pos); //Removing parser if no more program_number if (Complete_Stream->Streams[elementary_PID_Temp]->program_numbers.empty()) { stream_t StreamKind=Complete_Stream->Streams[elementary_PID_Temp]->StreamKind; size_t StreamPos=Complete_Stream->Streams[elementary_PID_Temp]->StreamPos; if (StreamKind!=Stream_Max && StreamPos!=(size_t)-1) Complete_Stream->StreamPos_ToRemove[StreamKind].push_back(StreamPos); if (Complete_Stream->Streams_NotParsedCount!=(size_t)-1 && Complete_Stream->Streams_NotParsedCount && !Complete_Stream->Streams[elementary_PID_Temp]->IsParsed) Complete_Stream->Streams_NotParsedCount--; //Not parsed, and no need to parse it now delete Complete_Stream->Streams[elementary_PID_Temp]; Complete_Stream->Streams[elementary_PID_Temp]=new complete_stream::stream; } } //Removing related PCR std::map::iterator PCR_PID=Complete_Stream->PCR_PIDs.find(Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].PCR_PID); if (PCR_PID!=Complete_Stream->PCR_PIDs.end()) { PCR_PID->second--; if (PCR_PID->second==0) Complete_Stream->PCR_PIDs.erase(PCR_PID); } //Removing program_number size_t StreamPos=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].StreamPos; if (StreamPos!=(size_t)-1) { Complete_Stream->StreamPos_ToRemove[Stream_Menu].push_back(StreamPos); Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].StreamPos=(size_t)-1; } int16u program_number_pid=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].pid; if (program_number_pid) { for (size_t Pos=0; PosStreams[program_number_pid]->program_numbers.size(); Pos++) if (Complete_Stream->Streams[program_number_pid]->program_numbers[Pos]==program_number) Complete_Stream->Streams[program_number_pid]->program_numbers.erase(Complete_Stream->Streams[program_number_pid]->program_numbers.begin()+Pos); if (Complete_Stream->Streams[program_number_pid]->Table_IDs[0x02]) Complete_Stream->Streams[program_number_pid]->Table_IDs[0x02]->Table_ID_Extensions.erase(program_number); } Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs.erase(program_number); } //--------------------------------------------------------------------------- void File_Mpeg_Psi::elementary_PID_Update(int16u PCR_PID) { if (Complete_Stream->Streams[elementary_PID]->Kind==complete_stream::stream::psi) { //A PID can not be PSI and PES at the same time return; } //stream_type if (stream_type!=Complete_Stream->Streams[elementary_PID]->stream_type && Complete_Stream->Streams[elementary_PID]->stream_type!=(int8u)-1) { if (Complete_Stream->Streams_NotParsedCount!=(size_t)-1 && Complete_Stream->Streams_NotParsedCount && !Complete_Stream->Streams[elementary_PID]->IsParsed) Complete_Stream->Streams_NotParsedCount--; //Not parsed, and no need to parse it now delete Complete_Stream->Streams[elementary_PID]; Complete_Stream->Streams[elementary_PID]=new complete_stream::stream; Complete_Stream->Streams[elementary_PID]->Kind=complete_stream::stream::unknown; } if (Complete_Stream->Streams[elementary_PID]->Kind!=complete_stream::stream::pes) { delete Complete_Stream->Streams[elementary_PID]; Complete_Stream->Streams[elementary_PID]=new complete_stream::stream; if (Complete_Stream->Streams_NotParsedCount==(size_t)-1) Complete_Stream->Streams_NotParsedCount=0; Complete_Stream->Streams_NotParsedCount++; if (stream_type==0x86 && Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[table_id_extension].registration_format_identifier==Elements::CUEI) { Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[table_id_extension].HasNotDisplayableStreams=true; Complete_Stream->Streams[elementary_PID]->Kind=complete_stream::stream::psi; Complete_Stream->Streams[elementary_PID]->Table_IDs.resize(0x100); Complete_Stream->Streams[elementary_PID]->Table_IDs[0xFC]=new complete_stream::stream::table_id; //Splice if (Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[table_id_extension].Scte35==NULL) { Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[table_id_extension].Scte35=new complete_stream::transport_stream::program::scte35; Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[table_id_extension].Scte35->pid=elementary_PID; } #if MEDIAINFO_TRACE Complete_Stream->Streams[elementary_PID]->Element_Info1="PSI"; #endif //MEDIAINFO_TRACE } else { Complete_Stream->Streams[elementary_PID]->Kind=complete_stream::stream::pes; Complete_Stream->Streams[elementary_PID]->Infos["CodecID"].From_Number(stream_type); #if MEDIAINFO_TRACE Complete_Stream->Streams[elementary_PID]->Element_Info1="PES"; #endif //MEDIAINFO_TRACE } Complete_Stream->Streams[elementary_PID]->stream_type=stream_type; Complete_Stream->Streams[elementary_PID]->Searching_Payload_Start_Set(true); #ifdef MEDIAINFO_MPEGTS_PCR_YES Complete_Stream->Streams[elementary_PID]->Searching_TimeStamp_Start_Set(true); Complete_Stream->Streams[elementary_PID]->PCR_PID=PCR_PID; #endif //MEDIAINFO_MPEGTS_PCR_YES #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES //Complete_Stream->Streams[elementary_PID]->Searching_ParserTimeStamp_Start_Set(true); #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES if (Complete_Stream->File__Duplicate_Get_From_PID(elementary_PID)) Complete_Stream->Streams[elementary_PID]->ShouldDuplicate=true; } //Program information bool IsAlreadyPresent=false; for (size_t Pos=0; PosStreams[elementary_PID]->program_numbers.size(); Pos++) if (Complete_Stream->Streams[elementary_PID]->program_numbers[Pos]==program_number) IsAlreadyPresent=true; if (!IsAlreadyPresent) { Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].elementary_PIDs.push_back(elementary_PID); Complete_Stream->Streams[elementary_PID]->program_numbers.push_back(program_number); if (ForceStreamDisplay || (Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].registration_format_identifier==Elements::HDMV && Complete_Stream->Streams[elementary_PID]->stream_type==0x90)) //Testing if forcing display of all streams or if it is a PGS from Blu-ray Complete_Stream->PES_PIDs.insert(elementary_PID); //Adding it for sure } } //--------------------------------------------------------------------------- void File_Mpeg_Psi::elementary_PID_Remove() { //Removing this elementary_PID from the list of elementary_PIDs for this program_number for (size_t Pos=0; PosTransport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].elementary_PIDs.size(); Pos++) if (Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].elementary_PIDs[Pos]==elementary_PID) Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].elementary_PIDs.erase(Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].elementary_PIDs.begin()+Pos); //Removing this program_number from the list of program_numbers for this elementary_PID for (size_t Pos=0; PosStreams[elementary_PID]->program_numbers.size(); Pos++) if (Complete_Stream->Streams[elementary_PID]->program_numbers[Pos]==program_number) Complete_Stream->Streams[elementary_PID]->program_numbers.erase(Complete_Stream->Streams[elementary_PID]->program_numbers.begin()+Pos); //Removing parser if no more program_number if (Complete_Stream->Streams[elementary_PID]->program_numbers.empty()) { stream_t StreamKind=Complete_Stream->Streams[elementary_PID]->StreamKind; size_t StreamPos=Complete_Stream->Streams[elementary_PID]->StreamPos; if (StreamKind!=Stream_Max && StreamPos!=(size_t)-1) Complete_Stream->StreamPos_ToRemove[StreamKind].push_back(StreamPos); if (Complete_Stream->Streams_NotParsedCount!=(size_t)-1 && Complete_Stream->Streams_NotParsedCount && !Complete_Stream->Streams[elementary_PID]->IsParsed) Complete_Stream->Streams_NotParsedCount--; //Not parsed, and no need to parse it now delete Complete_Stream->Streams[elementary_PID]; Complete_Stream->Streams[elementary_PID]=new complete_stream::stream; Complete_Stream->PES_PIDs.erase(elementary_PID); } } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_MPEGTS_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Mpeg_Psi.h100777 0 0 14160 12226004262 16176 0/* 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, Program Map Section // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_Mpeg_PsiH #define MediaInfo_Mpeg_PsiH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Mpeg_Descriptors.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Mpeg_Psi //*************************************************************************** class File_Mpeg_Psi : public File__Analyze { public : //In bool From_TS; complete_stream* Complete_Stream; int16u pid; public : File_Mpeg_Psi(); ~File_Mpeg_Psi(); private : //Buffer - File header void FileHeader_Parse(); //Buffer - Per element bool Header_Begin(); void Header_Parse(); void Data_Parse(); //Elements - Base void Table_reserved(); void Table_iso13818_6(); void Table_user_private(); void Table_forbidden(); //Elements - MPEG void program_stream_map(); //From PS void Table_00(); void Table_01(); void Table_02(); void Table_03(); void Table_04() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_05() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_06() {Skip_XX(Element_Size-Element_Offset, "Data");}; //Elements - DVB void Table_38() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_39() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_3A() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_3B() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_3C() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_3D() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_3E() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_3F() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_40(); void Table_41() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_42(); void Table_46(); void Table_4A() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_4E(); void Table_4F(); void Table_5F(); //50 --> 5F void Table_6F(); //60 --> 6F void Table_70(); void Table_71() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_72() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_73(); void Table_74() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_75() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_76() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_77() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_78() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_79() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_7E() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_7F(); //Elements - ASTC void Table_C0(); void Table_C1(); void Table_C2() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_C3() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_C4() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_C5() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_C6() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_C7(); void Table_C8() {Table_C9();}; void Table_C9(); void Table_CA(); void Table_CB(); void Table_CC(); void Table_CD(); void Table_CE() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_CF() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_D0() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_D1() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_D2() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_D3() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_D4() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_D5() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_D6(); void Table_D7() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_D8() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_D9() {Skip_XX(Element_Size-Element_Offset, "Data");}; void Table_DA() {Table_C9();}; void Table_FC(); void Table_FC_00(); void Table_FC_04(); void Table_FC_05(); void Table_FC_05_break_duration(); void Table_FC_05_splice_time(); void Table_FC_06(); void Table_FC_07(); //Helpers int16u Descriptors_Size; void Descriptors(); void ATSC_multiple_string_structure(Ztring &Value, const char* Info); void SCTE_multilingual_text_string(int8u Size, Ztring &Value, const char* Info); Ztring Date_MJD(int16u Date); Ztring Time_BCD(int32u Time); //Items removal void program_number_Update(); void program_number_Remove(); void elementary_PID_Update(int16u PCR_PID); void elementary_PID_Remove(); //Data int32u CRC_32; int16u transport_stream_id; int16u table_id_extension; int16u elementary_PID; int16u program_number; int8u stream_type; int16u event_id; int8u pointer_field; int8u table_id; int8u version_number; bool current_next_indicator; bool section_syntax_indicator; bool elementary_PID_IsValid; bool program_number_IsValid; bool stream_type_IsValid; bool event_id_IsValid; bool IsATSC; bool ForceStreamDisplay; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Mxf.cpp100777 0 0 1641230 12263604515 15635 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MXF_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Mxf.h" #if defined(MEDIAINFO_DVDIF_YES) #include "MediaInfo/Multiple/File_DvDif.h" #endif #if defined(MEDIAINFO_DVDIF_YES) #include "MediaInfo/Multiple/File_DvDif.h" #endif #if defined(MEDIAINFO_AVC_YES) #include "MediaInfo/Video/File_Avc.h" #endif #if defined(MEDIAINFO_MPEG4V_YES) #include "MediaInfo/Video/File_Mpeg4v.h" #endif #if defined(MEDIAINFO_MPEGV_YES) #include "MediaInfo/Video/File_Mpegv.h" #endif #if defined(MEDIAINFO_VC3_YES) #include "MediaInfo/Video/File_Vc3.h" #endif #if defined(MEDIAINFO_AAC_YES) #include "MediaInfo/Audio/File_Aac.h" #endif #if defined(MEDIAINFO_AC3_YES) #include "MediaInfo/Audio/File_Ac3.h" #endif #if defined(MEDIAINFO_SMPTEST0337_YES) #include "MediaInfo/Audio/File_ChannelGrouping.h" #endif #if defined(MEDIAINFO_MPEGA_YES) #include "MediaInfo/Audio/File_Mpega.h" #endif #if defined(MEDIAINFO_PCM_YES) #include "MediaInfo/Audio/File_Pcm.h" #endif #if defined(MEDIAINFO_SMPTEST0331_YES) #include "MediaInfo/Audio/File_SmpteSt0331.h" #endif #if defined(MEDIAINFO_SMPTEST0337_YES) #include "MediaInfo/Audio/File_SmpteSt0337.h" #endif #if defined(MEDIAINFO_JPEG_YES) #include "MediaInfo/Image/File_Jpeg.h" #endif #include "MediaInfo/TimeCode.h" #include "MediaInfo/File_Unknown.h" #include "ZenLib/File.h" #include "ZenLib/FileName.h" #include "ZenLib/Dir.h" #include "MediaInfo/MediaInfo_Internal.h" #include "MediaInfo/Multiple/File__ReferenceFilesHelper.h" #include "ZenLib/Format/Http/Http_Utils.h" #if MEDIAINFO_SEEK #include #endif //MEDIAINFO_SEEK //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // // PartitionPack // Primer // Preface // --> ContentStorage // --> Packages --> Package (Material, Source) // --> Tracks --> Track // --> Sequence // --> StructuralComponents --> StructuralComponent (Timecode, SourceClip) // --> Descriptors --> Descriptor (Multiple, Essence) // --> Descriptors --> Descriptor (Essence) // --> EssenceContainerData // --> Identifications --> Identification // //*************************************************************************** //*************************************************************************** // Constants //*************************************************************************** #define UUID(NAME, PART1, PART2, PART3, PART4) \ const int32u NAME##1=0x##PART1; \ const int32u NAME##2=0x##PART2; \ const int32u NAME##3=0x##PART3; \ const int32u NAME##4=0x##PART4; \ namespace Elements { //Item - Elements - Interpretive - Fundamental - Data Interpretations and Definitions - Name-Value Construct Interpretations UUID(Ansi_01, 060E2B34, 01010105, 0301020A, 01000000) UUID(UTF16_01, 060E2B34, 01010105, 0301020A, 01010000) UUID(Ansi_02, 060E2B34, 01010105, 0301020A, 02000000) UUID(UTF16_02, 060E2B34, 01010105, 0301020A, 02010000) //Item - Elements - Interpretive - Fundamental - Data Interpretations and Definitions - KLV Interpretations UUID(Filler01, 060E2B34, 01010101, 03010210, 01000000) UUID(Filler02, 060E2B34, 01010102, 03010210, 01000000) UUID(TerminatingFiller, 060E2B34, 01010102, 03010210, 05000000) //Item - Elements - Interpretive - Fundamental - Data Interpretations and Definitions - XML Constructs and Interpretations UUID(XmlDocumentText, 060E2B34, 01010105, 03010220, 01000000) //Item - Elements - Interpretive - Fundamental - Data Interpretations and Definitions - ? UUID(SubDescriptors, 060E2B34, 01010109, 06010104, 06100000) // SMPTE ST 0429-10 //Item - Elements - User organization registred for public use - AAF Association - Generic Container - Version 1 UUID(GenericContainer_Aaf, 060E2B34, 01020101, 0D010301, 00000000) //Item - Elements - User organization registred for private use - Avid - Generic Container - Version 1 UUID(GenericContainer_Avid, 060E2B34, 01020101, 0E040301, 00000000) //Item - Elements - Interpretive - UUID(DMScheme1_PrimaryExtendedSpokenLanguage, 060E2B34, 01010107, 03010102, 03110000) UUID(DMScheme1_SecondaryExtendedSpokenLanguage, 060E2B34, 01010107, 03010102, 03110000) UUID(DMScheme1_OriginalExtendedSpokenLanguage, 060E2B34, 01010107, 03010102, 03110000) //Item - Elements - Parametric - Video and Image Essence Characteristics - Digital Video and Image Compression Parameters - MPEG Coding Parameters - MPEG-2 Coding Parameters UUID(MPEG2VideoDescriptor_SingleSequence, 060E2B34, 01010105, 04010602, 01020000) UUID(MPEG2VideoDescriptor_ConstantBFrames, 060E2B34, 01010105, 04010602, 01030000) UUID(MPEG2VideoDescriptor_CodedContentType, 060E2B34, 01010105, 04010602, 01040000) UUID(MPEG2VideoDescriptor_LowDelay, 060E2B34, 01010105, 04010602, 01050000) UUID(MPEG2VideoDescriptor_ClosedGOP, 060E2B34, 01010105, 04010602, 01060000) UUID(MPEG2VideoDescriptor_IdenticalGOP, 060E2B34, 01010105, 04010602, 01070000) UUID(MPEG2VideoDescriptor_MaxGOP, 060E2B34, 01010105, 04010602, 01080000) UUID(MPEG2VideoDescriptor_BPictureCount, 060E2B34, 01010105, 04010602, 01090000) UUID(MPEG2VideoDescriptor_ProfileAndLevel, 060E2B34, 01010105, 04010602, 010A0000) UUID(MPEG2VideoDescriptor_BitRate, 060E2B34, 01010105, 04010602, 010B0000) //Groups - Elements - User organization registred for public use - AAF Association - AAF Attributes - AAF Information Attributes - Version 1 - Enumerated Attributes UUID(Sequence, 060E2B34, 02530101, 0D010101, 01010F00) UUID(SourceClip, 060E2B34, 02530101, 0D010101, 01011100) UUID(TimecodeComponent, 060E2B34, 02530101, 0D010101, 01011400) UUID(ContentStorage, 060E2B34, 02530101, 0D010101, 01011800) UUID(EssenceContainerData, 060E2B34, 02530101, 0D010101, 01012300) UUID(CDCIEssenceDescriptor, 060E2B34, 02530101, 0D010101, 01012800) UUID(RGBAEssenceDescriptor, 060E2B34, 02530101, 0D010101, 01012900) UUID(Preface, 060E2B34, 02530101, 0D010101, 01012F00) UUID(Identification, 060E2B34, 02530101, 0D010101, 01013000) UUID(NetworkLocator, 060E2B34, 02530101, 0D010101, 01013200) UUID(TextLocator, 060E2B34, 02530101, 0D010101, 01013300) UUID(StereoscopicPictureSubDescriptor, 060E2B34, 0253010C, 0D010101, 01016300) // SMPTE ST 0429-10 UUID(MaterialPackage, 060E2B34, 02530101, 0D010101, 01013600) UUID(SourcePackage, 060E2B34, 02530101, 0D010101, 01013700) UUID(EventTrack, 060E2B34, 02530101, 0D010101, 01013900) UUID(StaticTrack, 060E2B34, 02530101, 0D010101, 01013A00) UUID(Track, 060E2B34, 02530101, 0D010101, 01013B00) UUID(DMSegment, 060E2B34, 02530101, 0D010101, 01014100) UUID(GenericSoundEssenceDescriptor, 060E2B34, 02530101, 0D010101, 01014200) UUID(GenericDataEssenceDescriptor, 060E2B34, 02530101, 0D010101, 01014300) UUID(MultipleDescriptor, 060E2B34, 02530101, 0D010101, 01014400) UUID(AES3PCMDescriptor, 060E2B34, 02530101, 0D010101, 01014700) UUID(WaveAudioDescriptor, 060E2B34, 02530101, 0D010101, 01014800) UUID(MPEG2VideoDescriptor, 060E2B34, 02530101, 0D010101, 01015100) UUID(JPEG2000PictureSubDescriptor, 060E2B34, 02530101, 0D010101, 01015A00) UUID(VbiPacketsDescriptor, 060E2B34, 02530101, 0D010101, 01015B00) UUID(AncPacketsDescriptor, 060E2B34, 02530101, 0D010101, 01015C00) //Groups - Elements - User organization registred for public use - AAF Association - ? - Version 1 - ? UUID(OpenIncompleteHeaderPartition, 060E2B34, 02050101, 0D010201, 01020100) UUID(ClosedIncompleteHeaderPartition, 060E2B34, 02050101, 0D010201, 01020200) UUID(OpenCompleteHeaderPartition, 060E2B34, 02050101, 0D010201, 01020300) UUID(ClosedCompleteHeaderPartition, 060E2B34, 02050101, 0D010201, 01020400) UUID(OpenIncompleteBodyPartition, 060E2B34, 02050101, 0D010201, 01030100) UUID(ClosedIncompleteBodyPartition, 060E2B34, 02050101, 0D010201, 01030200) UUID(OpenCompleteBodyPartition, 060E2B34, 02050101, 0D010201, 01030300) UUID(ClosedCompleteBodyPartition, 060E2B34, 02050101, 0D010201, 01030400) UUID(OpenIncompleteFooterPartition, 060E2B34, 02050101, 0D010201, 01040100) UUID(ClosedIncompleteFooterPartition, 060E2B34, 02050101, 0D010201, 01040200) UUID(OpenCompleteFooterPartition, 060E2B34, 02050101, 0D010201, 01040300) UUID(ClosedCompleteFooterPartition, 060E2B34, 02050101, 0D010201, 01040400) //Groups - Elements - User organization registred for public use - AAF Association - ? - Version 1 - ? UUID(Primer, 060E2B34, 02050101, 0D010201, 01050100) //Groups - Elements - User organization registred for public use - AAF Association - ? - Version 1 - ? UUID(IndexTableSegment, 060E2B34, 02530101, 0D010201, 01100100) //Groups - Elements - User organization registred for public use - AAF Association - ? - Version 1 - ? UUID(RandomIndexMetadata, 060E2B34, 02050101, 0D010201, 01110100) //Groups - Elements - User organization registred for public use - AAF Association - ? - Version 1 - ? (SDTI-CP (SMPTE 385M)) UUID(SDTI_SystemMetadataPack, 060E2B34, 02050101, 0D010301, 04010100) UUID(SDTI_PackageMetadataSet, 060E2B34, 02430101, 0D010301, 04010200) UUID(SDTI_PictureMetadataSet, 060E2B34, 02430101, 0D010301, 04010300) UUID(SDTI_SoundMetadataSet, 060E2B34, 02430101, 0D010301, 04010400) UUID(SDTI_DataMetadataSet, 060E2B34, 02430101, 0D010301, 04010500) UUID(SDTI_ControlMetadataSet, 060E2B34, 02630101, 0D010301, 04010600) //Groups - Elements - User organization registred for public use - AAF Association - ? - Version 1 - ? (SystemScheme (SMPTE 405M)) UUID(SystemScheme1, 060E2B34, 02530101, 0D010301, 14020100) //Groups - Elements - User organization registred for public use - AAF Association - Descriptive Metadata Scheme - Version 1 (SystemScheme (SMPTE 380M)) UUID(DMScheme1, 060E2B34, 02530101, 0D010401, 01010100) //Groups - Elements - User organization registred for private use - Omneon Video Networks UUID(Omneon_010201010100, 060E2B34, 02530105, 0E0B0102, 01010100) UUID(Omneon_010201020100, 060E2B34, 02530105, 0E0B0102, 01020100) } //--------------------------------------------------------------------------- const char* Mxf_Category(int8u Category) { switch(Category) { case 0x01 : return "Item"; case 0x02 : return "Group (Set/Pack)"; case 0x03 : return "Wrapper"; case 0x04 : return "Value"; default : return ""; } } //--------------------------------------------------------------------------- const char* Mxf_Registry(int8u Category, int8u Registry) { switch(Category) { case 0x01 : //"Item" switch(Registry) { case 0x01 : return "Metadata"; case 0x02 : return "Essence"; default : return ""; } case 0x02 : //"Group (Set/Pack)" switch(Registry) { case 0x05 : return "Predefined items"; case 0x43 : return "1-byte tag, 2-byte length"; case 0x53 : return "2-byte tag, 2-byte length"; case 0x63 : return "1-byte tag, 4-byte length"; default : return ""; } case 0x04 : //"Value" switch(Registry) { case 0x01 : return "Fixed"; default : return ""; } default : return ""; } } //--------------------------------------------------------------------------- const char* Mxf_Structure(int8u Category, int8u Registry, int8u Structure) { switch(Category) { case 0x01 : //"Item" switch(Registry) { case 0x02 : //Essence switch(Structure) { case 0x01 : return "Standard"; default : return ""; } default : return ""; } default : return ""; } } //--------------------------------------------------------------------------- const char* Mxf_MPEG2_CodedContentType(int8u CodedContentType) { switch(CodedContentType) { case 0x01 : return "Progressive"; case 0x02 : return "Interlaced"; case 0x03 : return ""; //Mixed default : return ""; } } //--------------------------------------------------------------------------- const char* Mxf_OperationalPattern(const int128u OperationalPattern) { //Item and Package Complexity int32u Code_Compare4=(int32u)OperationalPattern.lo; switch ((int8u)(Code_Compare4>>24)) { case 0x01 : switch ((int8u)(Code_Compare4>>16)) { case 0x01 : return "OP-1a"; case 0x02 : return "OP-1b"; case 0x03 : return "OP-1c"; default : return ""; } case 0x02 : switch ((int8u)(Code_Compare4>>16)) { case 0x01 : return "OP-2a"; case 0x02 : return "OP-2b"; case 0x03 : return "OP-2c"; default : return ""; } case 0x03 : switch ((int8u)(Code_Compare4>>16)) { case 0x01 : return "OP-3a"; case 0x02 : return "OP-3b"; case 0x03 : return "OP-3c"; default : return ""; } case 0x10 : return "OP-Atom"; default : return ""; } } //--------------------------------------------------------------------------- const char* Mxf_EssenceElement(const int128u EssenceElement) { if ((EssenceElement.hi&0xFFFFFFFFFFFFFF00LL)!=0x060E2B3401020100LL) return ""; int8u Code5=(int8u)((EssenceElement.lo&0x00000000FF000000LL)>>24); int8u Code7=(int8u)((EssenceElement.lo&0x000000000000FF00LL)>> 8); switch (Code5) { case 0x05 : //CP Picture (SMPTE 386M) switch (Code7) { case 0x01 : return "D-10 Video"; default : return "Unknown stream"; } case 0x06 : //CP Sound (SMPTE 386M) switch (Code7) { case 0x10 : return "D-10 Audio"; default : return "Unknown stream"; } case 0x07 : //CP Data (SMPTE 386M) return ""; case 0x14 : //MXF in MXF? switch (Code7) { case 0x01 : return "MXF in MXF?"; default : return "Unknown stream"; } case 0x15 : //GC Picture switch (Code7) { case 0x01 : return "RGB"; case 0x05 : return "MPEG stream (Frame)"; case 0x06 : return "MPEG stream (Clip)"; case 0x07 : return "MPEG stream (Custom)"; case 0x08 : return "JPEG 2000"; default : return "Unknown stream"; } case 0x16 : //GC Sound switch (Code7) { case 0x01 : return "PCM"; //BWF case 0x02 : return "PCM"; //BWF case 0x03 : return "PCM"; //DV Audio case 0x04 : return "PCM"; //BWF case 0x05 : return "MPEG Audio / AC-3"; case 0x0A : return "A-law"; default : return "Unknown stream"; } case 0x17 : //GC Data switch (Code7) { case 0x01 : return "VBI"; //Frame-Wrapped VBI Data Element case 0x02 : return "ANC"; //Frame-Wrapped ANC Data Element default : return "Unknown stream"; } case 0x18 : //GC Compound switch (Code7) { case 0x01 : return "DV"; //Frame case 0x02 : return "DV"; //Clip default : return "Unknown stream"; } default : return "Unknown stream"; } } //--------------------------------------------------------------------------- const char* Mxf_EssenceContainer(const int128u EssenceContainer) { if ((EssenceContainer.hi&0xFFFFFFFFFFFFFF00LL)!=0x060E2B3404010100LL) return ""; int8u Code1=(int8u)((EssenceContainer.lo&0xFF00000000000000LL)>>56); int8u Code2=(int8u)((EssenceContainer.lo&0x00FF000000000000LL)>>48); int8u Code3=(int8u)((EssenceContainer.lo&0x0000FF0000000000LL)>>40); int8u Code4=(int8u)((EssenceContainer.lo&0x000000FF00000000LL)>>32); int8u Code5=(int8u)((EssenceContainer.lo&0x00000000FF000000LL)>>24); int8u Code6=(int8u)((EssenceContainer.lo&0x0000000000FF0000LL)>>16); //int8u Code7=(int8u)((EssenceContainer.lo&0x000000000000FF00LL)>> 8); switch (Code1) { case 0x0D : //Public Use switch (Code2) { case 0x01 : //AAF switch (Code3) { case 0x03 : //Essence Container Application switch (Code4) { case 0x01 : //MXF EC Structure version switch (Code5) { case 0x02 : //Essence container kind switch (Code6) { case 0x01 : return "D-10"; // Video and Audio case 0x02 : return "DV"; case 0x05 : return "Uncompressed pictures"; case 0x06 : return "PCM"; case 0x04 : return "MPEG ES mappings with Stream ID"; case 0x0A : return "A-law"; case 0x0C : return "JPEG 2000"; case 0x10 : return "AVC"; case 0x11 : return "VC-3"; default : return ""; } default : return ""; } default : return ""; } default : return ""; } default : return ""; } case 0x0E : //Private Use switch (Code2) { case 0x04 : //Avid switch (Code3) { case 0x03 : //Essence Container Application switch (Code4) { case 0x01 : //MXF EC Structure version switch (Code5) { case 0x02 : //Essence container kind switch (Code6) { case 0x06 : return "VC-3"; default : return ""; } default : return ""; } default : return ""; } default : return ""; } default : return ""; } default : return ""; } } //--------------------------------------------------------------------------- const char* Mxf_EssenceContainer_Mapping(int8u Code6, int8u Code7, int8u Code8) { switch (Code6) { case 0x01 : //D-10, SMPTE 386M return "Frame (D-10)"; case 0x02 : //DV, SMPTE 383M switch (Code8) { case 0x01 : return "Frame"; case 0x02 : return "Clip"; default : return ""; } case 0x04 : //MPEG ES, SMPTE 381M case 0x07 : //MPEG PES, SMPTE 381M case 0x08 : //MPEG PS, SMPTE 381M case 0x09 : //MPEG TS, SMPTE 381M case 0x10 : //AVC case 0x15 : //YUV switch (Code8) { case 0x01 : return "Frame"; case 0x02 : return "Clip"; case 0x03 : return "Custom: Stripe"; case 0x04 : return "Custom: PES"; case 0x05 : return "Custom: Fixed Audio Size"; case 0x06 : return "Custom: Splice"; case 0x07 : return "Custom: Closed GOP"; case 0x08 : return "Custom: Slave"; case 0x7F : return "Custom"; default : return ""; } case 0x05 : //Uncompressed pictures, SMPTE 384M switch (Code8) { case 0x01 : return "Frame"; case 0x02 : return "Clip"; case 0x03 : return "Line"; default : return ""; } case 0x06 : //AES-PCM, SMPTE 382M switch (Code7) { case 0x01 : return "Frame (BWF)"; case 0x02 : return "Clip (BWF)"; case 0x03 : return "Frame (AES)"; case 0x04 : return "Clip (AES)"; case 0x08 : return "Custom (BWF)"; case 0x09 : return "Custom (AES)"; default : return ""; } case 0x0A : //A-Law switch (Code7) { case 0x01 : return "Frame"; case 0x02 : return "Clip"; case 0x03 : return "?"; case 0x07 : return "Custom"; default : return ""; } case 0x0C : //JPEG 2000 switch (Code7) { case 0x01 : return "Frame"; case 0x02 : return "Clip"; default : return ""; } case 0x11 : //VC-3, SMPTE 2019-4 switch (Code7) { case 0x01 : return "Frame"; case 0x02 : return "Clip"; default : return ""; } default : return ""; } } //--------------------------------------------------------------------------- const char* Mxf_EssenceCompression(const int128u EssenceCompression) { if ((EssenceCompression.hi&0xFFFFFFFFFFFFFF00LL)!=0x060E2B3404010100LL || !((EssenceCompression.lo&0xFF00000000000000LL)==0x0400000000000000LL || (EssenceCompression.lo&0xFF00000000000000LL)==0x0E00000000000000LL)) return ""; int8u Code1=(int8u)((EssenceCompression.lo&0xFF00000000000000LL)>>56); int8u Code2=(int8u)((EssenceCompression.lo&0x00FF000000000000LL)>>48); int8u Code3=(int8u)((EssenceCompression.lo&0x0000FF0000000000LL)>>40); int8u Code4=(int8u)((EssenceCompression.lo&0x000000FF00000000LL)>>32); int8u Code5=(int8u)((EssenceCompression.lo&0x00000000FF000000LL)>>24); int8u Code6=(int8u)((EssenceCompression.lo&0x0000000000FF0000LL)>>16); int8u Code7=(int8u)((EssenceCompression.lo&0x000000000000FF00LL)>> 8); switch (Code1) { case 0x04 : // switch (Code2) { case 0x01 : //Picture switch (Code3) { case 0x02 : //Coding characteristics switch (Code4) { case 0x01 : //Uncompressed coding switch (Code5) { case 0x01 : //Uncompressed picture coding return "YUV"; default : return ""; } case 0x02 : //Compressed coding switch (Code5) { case 0x01 : //MPEG Compression switch (Code6) { case 0x01 : return "MPEG Video"; //Version 2 case 0x02 : return "MPEG Video"; //Version 2 case 0x03 : return "MPEG Video"; //Version 2 case 0x04 : return "MPEG Video"; //Version 2 case 0x11 : return "MPEG Video"; //Version 1 case 0x20 : return "MPEG-4 Visual"; case 0x32 : return "AVC"; default : return ""; } case 0x02 : return "DV"; case 0x03 : //Individual Picture Coding Schemes switch (Code6) { case 0x01 : return "JPEG 2000"; default : return ""; } case 0x71 : return "VC-3"; default : return ""; } default : return ""; } default : return ""; } case 0x02 : //Sound switch (Code3) { case 0x02 : //Coding characteristics switch (Code4) { case 0x01 : //Uncompressed Sound Coding switch (Code5) { case 0x00 : return "PCM"; case 0x01 : return "PCM"; case 0x7E : return "PCM"; //AIFF case 0x7F : return "PCM"; // TODO: Undefined default : return ""; } case 0x02 : //Compressed coding switch (Code5) { case 0x03 : //Compressed Audio Coding switch (Code6) { case 0x01 : //Compandeded Audio Coding switch (Code7) { case 0x01 : return "A-law"; case 0x10 : return "DV Audio"; //DV 12-bit default : return ""; //Unknown } case 0x02 : //SMPTE 338M Audio Coding switch (Code7) { case 0x01 : return "AC-3"; case 0x04 : return "MPEG-1 Audio Layer 1"; case 0x05 : return "MPEG-1 Audio Layer 2 or 3"; case 0x06 : return "MPEG-2 Audio Layer 1"; case 0x1C : return "Dolby E"; default : return ""; //Unknown } case 0x03 : //MPEG-2 Coding (not defined in SMPTE 338M) switch (Code7) { case 0x01 : return "AAC version 2"; default : return ""; //Unknown } case 0x04 : //MPEG-4 Audio Coding switch (Code7) { case 0x01 : return "MPEG-4 Speech Profile"; case 0x02 : return "MPEG-4 Synthesis Profile"; case 0x03 : return "MPEG-4 Scalable Profile"; case 0x04 : return "MPEG-4 Main Profile"; case 0x05 : return "MPEG-4 High Quality Audio Profile"; case 0x06 : return "MPEG-4 Low Delay Audio Profile"; case 0x07 : return "MPEG-4 Natural Audio Profile"; case 0x08 : return "MPEG-4 Mobile Audio Internetworking Profile"; default : return ""; //Unknown } default : return ""; } default : return ""; } default : return ""; } default : return ""; } default : return ""; } case 0x0E : //Private Use switch (Code2) { case 0x04 : //Avid switch (Code3) { case 0x02 : //Essence Compression ? switch (Code4) { case 0x01 : //? switch (Code5) { case 0x02 : //? switch (Code6) { case 0x04 : return "VC-3"; default : return ""; } default : return ""; } default : return ""; } default : return ""; } default : return ""; } default : return ""; } } //--------------------------------------------------------------------------- const char* Mxf_EssenceCompression_Version(const int128u EssenceCompression) { int8u Code2=(int8u)((EssenceCompression.lo&0x00FF000000000000LL)>>48); int8u Code3=(int8u)((EssenceCompression.lo&0x0000FF0000000000LL)>>40); int8u Code4=(int8u)((EssenceCompression.lo&0x000000FF00000000LL)>>32); int8u Code5=(int8u)((EssenceCompression.lo&0x00000000FF000000LL)>>24); int8u Code6=(int8u)((EssenceCompression.lo&0x0000000000FF0000LL)>>16); int8u Code7=(int8u)((EssenceCompression.lo&0x000000000000FF00LL)>> 8); switch (Code2) { case 0x01 : //Picture switch (Code3) { case 0x02 : //Coding characteristics switch (Code4) { case 0x02 : //Compressed coding switch (Code5) { case 0x01 : //MPEG Compression switch (Code6) { case 0x01 : return "Version 2"; case 0x02 : return "Version 2"; case 0x03 : return "Version 2"; case 0x04 : return "Version 2"; case 0x11 : return "Version 1"; default : return ""; } default : return ""; } default : return ""; } default : return ""; } case 0x02 : //Sound switch (Code3) { case 0x02 : //Coding characteristics switch (Code4) { case 0x02 : //Compressed coding switch (Code5) { case 0x03 : //Compressed Audio Coding switch (Code6) { case 0x02 : //SMPTE 338M Audio Coding switch (Code7) { case 0x04 : return "Version 1"; //Layer 1 case 0x05 : return "Version 1"; //Layer 2 or 3 case 0x06 : return "Version 2"; //Layer 1 default : return ""; //Unknown } default : return ""; } default : return ""; } default : return ""; } default : return ""; } default : return ""; } } //--------------------------------------------------------------------------- const char* Mxf_Sequence_DataDefinition(const int128u DataDefinition) { int8u Code4=(int8u)((DataDefinition.lo&0x000000FF00000000LL)>>32); int8u Code5=(int8u)((DataDefinition.lo&0x00000000FF000000LL)>>24); switch (Code4) { case 0x01 : return "Time"; case 0x02 : switch (Code5) { case 0x01 : return "Picture"; case 0x02 : return "Sound"; case 0x03 : return "Data"; default : return ""; } default : return ""; } } //--------------------------------------------------------------------------- const char* Mxf_FrameLayout(int8u FrameLayout) { switch (FrameLayout) { case 0x00 : return "Full frame"; case 0x01 : return "Separated fields"; case 0x02 : return "Single field"; case 0x03 : return "Mixed fields"; case 0x04 : return "Segmented frame"; default : return ""; } } //--------------------------------------------------------------------------- const char* Mxf_FrameLayout_ScanType(int8u FrameLayout) { switch (FrameLayout) { case 0x01 : case 0x04 : case 0xFF : //Seen in one file return "Interlaced"; default : return "Progressive"; } } //--------------------------------------------------------------------------- int8u Mxf_FrameLayout_Multiplier(int8u FrameLayout) { switch (FrameLayout) { case 0x01 : case 0x04 : case 0xFF : //Seen in one file return 2; default : return 1; } } //--------------------------------------------------------------------------- extern const char* Mpegv_profile_and_level_indication_profile[]; extern const char* Mpegv_profile_and_level_indication_level[]; //--------------------------------------------------------------------------- extern const char* AfdBarData_active_format[]; extern const char* AfdBarData_active_format_4_3[]; extern const char* AfdBarData_active_format_16_9[]; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Mxf::File_Mxf() :File__Analyze() { //Configuration ParserName=__T("MXF"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Mxf; StreamIDs_Width[0]=8; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_Level=2; //Container #endif //MEDIAINFO_DEMUX MustSynchronize=true; DataMustAlwaysBeComplete=false; Buffer_TotalBytes_Fill_Max=(int64u)-1; //Disabling this feature for this format, this is done in the parser FrameInfo.DTS=0; Frame_Count_NotParsedIncluded=0; #if MEDIAINFO_DEMUX Demux_EventWasSent_Accept_Specific=true; #endif //MEDIAINFO_DEMUX //Temp RandomIndexMetadatas_AlreadyParsed=false; Streams_Count=(size_t)-1; OperationalPattern=0; Buffer_Begin=(int64u)-1; Buffer_End=0; Buffer_End_Unlimited=false; Buffer_Header_Size=0; Preface_Current.hi=0; Preface_Current.lo=0; IsParsingMiddle_MaxOffset=(int64u)-1; Track_Number_IsAvailable=false; IsParsingEnd=false; IsCheckingRandomAccessTable=false; IsCheckingFooterPartitionAddress=false; FooterPartitionAddress_Jumped=false; PartitionPack_Parsed=false; IdIsAlwaysSame_Offset=0; PartitionMetadata_PreviousPartition=(int64u)-1; PartitionMetadata_FooterPartition=(int64u)-1; TimeCode_StartTimecode=(int64u)-1; TimeCode_RoundedTimecodeBase=0; TimeCode_DropFrame=false; DTS_Delay=0; StreamPos_StartAtOne=true; SDTI_TimeCode_StartTimecode_ms=(int64u)-1; SDTI_SizePerFrame=0; SDTI_IsPresent=false; SDTI_IsInIndexStreamOffset=true; SystemScheme1_TimeCodeArray_StartTimecode_ms=(int64u)-1; SystemScheme1_FrameRateFromDescriptor=0; Essences_FirstEssence_Parsed=false; StereoscopicPictureSubDescriptor_IsPresent=false; #if MEDIAINFO_ADVANCED Footer_Position=(int64u)-1; #endif //MEDIAINFO_ADVANCED ReferenceFiles=NULL; #if MEDIAINFO_NEXTPACKET ReferenceFiles_IsParsing=false; #endif //MEDIAINFO_NEXTPACKET #if defined(MEDIAINFO_ANCILLARY_YES) Ancillary=NULL; Ancillary_IsBinded=false; #endif //defined(MEDIAINFO_ANCILLARY_YES) #if MEDIAINFO_DEMUX Demux_HeaderParsed=false; #endif //MEDIAINFO_DEMUX Partitions_Pos=0; Partitions_IsCalculatingHeaderByteCount=false; Partitions_IsCalculatingSdtiByteCount=false; Partitions_IsFooter=false; #if MEDIAINFO_SEEK IndexTables_Pos=0; Clip_Header_Size=0; Clip_Begin=(int64u)-1; Clip_End=0; OverallBitrate_IsCbrForSure=0; Duration_Detected=false; #endif //MEDIAINFO_SEEK } //--------------------------------------------------------------------------- File_Mxf::~File_Mxf() { delete ReferenceFiles; if (!Ancillary_IsBinded) delete Ancillary; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Mxf::Streams_Fill() { for (essences::iterator Essence=Essences.begin(); Essence!=Essences.end(); ++Essence) for (parsers::iterator Parser=Essence->second.Parsers.begin(); Parser!=Essence->second.Parsers.end(); ++Parser) Fill(*Parser); } //--------------------------------------------------------------------------- void File_Mxf::Streams_Finish() { #if MEDIAINFO_NEXTPACKET //Locators only if (ReferenceFiles_IsParsing) { ReferenceFiles->ParseReferences(); #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) return; #endif //MEDIAINFO_DEMUX Streams_Finish_CommercialNames(); return; } #endif //MEDIAINFO_NEXTPACKET //Per stream for (essences::iterator Essence=Essences.begin(); Essence!=Essences.end(); ++Essence) { if (Essence->second.Parsers.size()!=1 && Essence->second.StreamKind==Stream_Audio) // Last parser is PCM, impossible to detect with another method if there is only one block { for (size_t Pos=0; Possecond.Parsers.size()-1; Pos++) delete Essence->second.Parsers[Pos]; Essence->second.Parsers.erase(Essence->second.Parsers.begin(), Essence->second.Parsers.begin()+Essence->second.Parsers.size()-1); Essence->second.Parsers[0]->Accept(); Essence->second.Parsers[0]->Fill(); } for (parsers::iterator Parser=Essence->second.Parsers.begin(); Parser!=Essence->second.Parsers.end(); ++Parser) { if (!(*Parser)->Status[IsFinished]) { if (Config->ParseSpeed>=1) { int64u File_Size_Temp=File_Size; File_Size=File_Offset+Buffer_Offset+Element_Offset; Open_Buffer_Continue(*Parser, Buffer, 0); File_Size=File_Size_Temp; } Finish(*Parser); #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) return; #endif //MEDIAINFO_DEMUX } } } if (!Track_Number_IsAvailable) { if (Tracks.empty()) { for (essences::iterator Essence=Essences.begin(); Essence!=Essences.end(); ++Essence) for (parsers::iterator Parser=Essence->second.Parsers.begin(); Parser!=Essence->second.Parsers.end(); ++Parser) Merge(*(*Parser)); } else for (tracks::iterator Track=Tracks.begin(); Track!=Tracks.end(); ++Track) { //Searching the corresponding Descriptor stream_t StreamKind=Stream_Max; for (descriptors::iterator Descriptor=Descriptors.begin(); Descriptor!=Descriptors.end(); ++Descriptor) if (Descriptor->second.LinkedTrackID==Track->second.TrackID) { StreamKind=Descriptor->second.StreamKind; break; } if (StreamKind!=Stream_Max) { for (essences::iterator Essence=Essences.begin(); Essence!=Essences.end(); ++Essence) if (Essence->second.StreamKind==StreamKind && !Essence->second.Track_Number_IsMappedToTrack) { Track->second.TrackNumber=Essence->first; Essence->second.Track_Number_IsMappedToTrack=true; break; } } } } File_Size_Total=File_Size; StreamKind_Last=Stream_Max; StreamPos_Last=(size_t)-1; Streams_Finish_Preface(Preface_Current); //OperationalPattern Fill(Stream_General, 0, General_Format_Profile, Mxf_OperationalPattern(OperationalPattern)); //Time codes if (SDTI_TimeCode_StartTimecode_ms!=(int64u)-1) { bool IsDuplicate=false; for (size_t Pos2=0; Pos2NextPacket_Get() && ReferenceFiles && !ReferenceFiles->References.empty()) { ReferenceFiles_IsParsing=true; return; } #endif //MEDIAINFO_NEXTPACKET //Sizes #if MEDIAINFO_ADVANCED if (Footer_Position!=(int64u)-1) Fill(Stream_General, 0, General_FooterSize, File_Size-Footer_Position); #endif //MEDIAINFO_ADVANCED //Commercial names Streams_Finish_CommercialNames(); //Handling separate streams for (size_t StreamKind=Stream_General+1; StreamKindsecond.ContentStorage); //Identifications for (size_t Pos=0; Possecond.Identifications.size(); Pos++) Streams_Finish_Identification(Preface->second.Identifications[Pos]); } //--------------------------------------------------------------------------- void File_Mxf::Streams_Finish_ContentStorage (const int128u ContentStorageUID) { contentstorages::iterator ContentStorage=ContentStorages.find(ContentStorageUID); if (ContentStorage==ContentStorages.end()) return; for (size_t Pos=0; Possecond.Packages.size(); Pos++) Streams_Finish_Package(ContentStorage->second.Packages[Pos]); } //--------------------------------------------------------------------------- void File_Mxf::Streams_Finish_Package (const int128u PackageUID) { packages::iterator Package=Packages.find(PackageUID); if (Package==Packages.end() || !Package->second.IsSourcePackage) return; for (size_t Pos=0; Possecond.Tracks.size(); Pos++) Streams_Finish_Track(Package->second.Tracks[Pos]); Streams_Finish_Descriptor(Package->second.Descriptor, PackageUID); } //--------------------------------------------------------------------------- void File_Mxf::Streams_Finish_Track(const int128u TrackUID) { tracks::iterator Track=Tracks.find(TrackUID); if (Track==Tracks.end() || Track->second.Stream_Finish_Done) return; StreamKind_Last=Stream_Max; StreamPos_Last=(size_t)-1; Streams_Finish_Essence(Track->second.TrackNumber, TrackUID); //Sequence Streams_Finish_Component(Track->second.Sequence, Track->second.EditRate, Track->second.TrackID, Track->second.Origin); //Done Track->second.Stream_Finish_Done=true; } //--------------------------------------------------------------------------- void File_Mxf::Streams_Finish_Essence(int32u EssenceUID, int128u TrackUID) { essences::iterator Essence=Essences.find(EssenceUID); if (Essence==Essences.end() || Essence->second.Stream_Finish_Done) return; if (Essence->second.Parsers.size()!=1) return; parsers::iterator Parser=Essence->second.Parsers.begin(); //Descriptive Metadata std::vector DMScheme1s_List; int32u TrackID=(int32u)-1; tracks::iterator Track=Tracks.find(TrackUID); if (Track!=Tracks.end()) TrackID=Track->second.TrackID; for (dmsegments::iterator DMSegment=DMSegments.begin(); DMSegment!=DMSegments.end(); ++DMSegment) for (size_t Pos=0; Possecond.TrackIDs.size(); Pos++) if (DMSegment->second.TrackIDs[Pos]==TrackID) DMScheme1s_List.push_back(DMSegment->second.Framework); if (Config->ParseSpeed<1.0 && !(*Parser)->Status[IsFinished]) { Fill(*Parser); (*Parser)->Open_Buffer_Unsynch(); } Finish(*Parser); StreamKind_Last=Stream_Max; if ((*Parser)->Count_Get(Stream_Video)) Stream_Prepare(Stream_Video); else if ((*Parser)->Count_Get(Stream_Audio)) Stream_Prepare(Stream_Audio); else if ((*Parser)->Count_Get(Stream_Text)) Stream_Prepare(Stream_Text); else if ((*Parser)->Count_Get(Stream_Other)) Stream_Prepare(Stream_Other); else if (Essence->second.StreamKind!=Stream_Max) Stream_Prepare(Essence->second.StreamKind); else { for (descriptors::iterator Descriptor=Descriptors.begin(); Descriptor!=Descriptors.end(); ++Descriptor) if (Descriptor->second.LinkedTrackID==Essence->second.TrackID) { if (Descriptor->second.StreamKind!=Stream_Max) { Stream_Prepare(Descriptor->second.StreamKind); Descriptor->second.StreamPos=StreamPos_Last; } break; } if (StreamKind_Last==Stream_Max) return; //Not found } for (descriptors::iterator Descriptor=Descriptors.begin(); Descriptor!=Descriptors.end(); ++Descriptor) if (Descriptor->second.LinkedTrackID==Essence->second.TrackID) { if (Descriptor->second.StreamKind!=Stream_Max) Descriptor->second.StreamPos=StreamPos_Last; break; } for (std::map::iterator Info=Essence->second.Infos.begin(); Info!=Essence->second.Infos.end(); ++Info) Fill(StreamKind_Last, StreamPos_Last, Info->first.c_str(), Info->second, true); if (TimeCode_RoundedTimecodeBase && TimeCode_StartTimecode!=(int64u)-1) { Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Delay), DTS_Delay*1000, 0, true); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Delay_Source), "Container"); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Delay_DropFrame), TimeCode_DropFrame?"Yes":"No"); //TimeCode TC(TimeCode_StartTimecode, TimeCode_RoundedTimecodeBase, TimeCode_DropFrame); //Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_TimeCode_FirstFrame), TC.ToString().c_str()); //Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_TimeCode_Source), "Time code track (stripped)"); } if (SDTI_TimeCode_StartTimecode_ms!=(int64u)-1) { Fill(StreamKind_Last, StreamPos_Last, "Delay_SDTI", SDTI_TimeCode_StartTimecode_ms); if (StreamKind_Last!=Stream_Max) (*Stream_More)[StreamKind_Last][StreamPos_Last](Ztring().From_Local("Delay_SDTI"), Info_Options)=__T("N NT"); //Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_TimeCode_FirstFrame), SDTI_TimeCode_StartTimecode.c_str()); //Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_TimeCode_Source), "SDTI"); } if (SystemScheme1_TimeCodeArray_StartTimecode_ms!=(int64u)-1) { Fill(StreamKind_Last, StreamPos_Last, "Delay_SystemScheme1", SystemScheme1_TimeCodeArray_StartTimecode_ms); if (StreamKind_Last!=Stream_Max) (*Stream_More)[StreamKind_Last][StreamPos_Last](Ztring().From_Local("Delay_SystemScheme1"), Info_Options)=__T("N NT"); //Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_TimeCode_FirstFrame), SystemScheme1_TimeCodeArray_StartTimecode.c_str()); //Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_TimeCode_Source), "System scheme 1"); } //Special case - Multiple sub-streams in a stream if (((*Parser)->Retrieve(Stream_General, 0, General_Format)==__T("ChannelGrouping") || (*Parser)->Count_Get(StreamKind_Last)>1) && (*Parser)->Count_Get(Stream_Audio)) { //Before if (StreamKind_Last==Stream_Audio) { Clear(Stream_Audio, StreamPos_Last, Audio_Format_Settings_Sign); } ZtringList StreamSave; StreamSave.Write((*File__Analyze::Stream)[StreamKind_Last][StreamPos_Last].Read()); ZtringListList StreamMoreSave; StreamMoreSave.Write((*Stream_More)[StreamKind_Last][StreamPos_Last].Read()); //Erasing former streams data stream_t NewKind=StreamKind_Last; size_t NewPos1; Ztring ID; if ((*Parser)->Retrieve(Stream_General, 0, General_Format)==__T("ChannelGrouping")) { //Searching second stream size_t StreamPos_Difference=Essence->second.StreamPos-Essence->second.StreamPos_Initial; essences::iterator Essence1=Essence; --Essence1; Essence->second.StreamPos=Essence1->second.StreamPos; for (descriptors::iterator Descriptor=Descriptors.begin(); Descriptor!=Descriptors.end(); ++Descriptor) { if (Descriptor->second.LinkedTrackID==Essence1->second.TrackID) Descriptor->second.StreamPos=Essence1->second.StreamPos; if (Descriptor->second.LinkedTrackID==Essence->second.TrackID) Descriptor->second.StreamPos=Essence->second.StreamPos; } //Removing the 2 corresponding streams NewPos1=(Essence->second.StreamPos_Initial/2)*2+StreamPos_Difference; size_t NewPos2=NewPos1+1; ID=Ztring::ToZtring(Essence1->second.TrackID)+__T(" / ")+Ztring::ToZtring(Essence->second.TrackID); Stream_Erase(NewKind, NewPos2); Stream_Erase(NewKind, NewPos1); } else { NewPos1=StreamPos_Last; ID=Ztring::ToZtring(Essence->second.TrackID); Stream_Erase(NewKind, NewPos1); } //After for (size_t StreamPos=0; StreamPos<(*Parser)->Count_Get(NewKind); StreamPos++) { Stream_Prepare(NewKind, NewPos1+StreamPos); Merge(*(*Parser), StreamKind_Last, StreamPos, StreamPos_Last); Ztring Parser_ID=Retrieve(StreamKind_Last, StreamPos_Last, General_ID); Fill(StreamKind_Last, StreamPos_Last, General_ID, ID+(Parser_ID.empty()?Ztring():(__T("-")+Parser_ID)), true); for (size_t Pos=0; PosCount_Get(NewKind)>1 && (!StreamSave[Pos].empty() || StreamPos)) Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_BitRate_Encoded), StreamPos?0:(StreamSave[Pos].To_int64u()*2)); else if (Pos==Fill_Parameter(StreamKind_Last, Generic_StreamSize) && (*Parser)->Count_Get(NewKind)>1 && (!StreamSave[Pos].empty() || StreamPos)) Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_StreamSize_Encoded), StreamPos?0:(StreamSave[Pos].To_int64u()*2)); else if (Retrieve(StreamKind_Last, StreamPos_Last, Pos).empty()) Fill(StreamKind_Last, StreamPos_Last, Pos, StreamSave[Pos]); } for (size_t Pos=0; Possecond.PrimaryExtendedSpokenLanguage, true); } } } //Positioning other streams for (essences::iterator Essence_Temp=Essence; Essence_Temp!=Essences.end(); ++Essence_Temp) if (*(Essence_Temp->second.Parsers.begin()) && (*(Essence_Temp->second.Parsers.begin()))->Count_Get(Stream_Audio)) { Essence_Temp->second.StreamPos-=2; //ChannelGrouping Essence_Temp->second.StreamPos+=(*(Essence_Temp->second.Parsers.begin()))->Count_Get(Stream_Audio); } } else //Normal { //From descriptor if ((*Parser)->Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)==__T("PCM")) // MXF handles channel count only with PCM, not with compressed data for (descriptors::iterator Descriptor=Descriptors.begin(); Descriptor!=Descriptors.end(); ++Descriptor) if (Descriptor->second.LinkedTrackID==Essence->second.TrackID && Descriptor->second.StreamKind==Stream_Audio && StreamKind_Last==Stream_Audio && Descriptor->second.ChannelCount!=(int32u)-1) { Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Descriptor->second.ChannelCount); break; } Merge(*(*Parser), StreamKind_Last, 0, StreamPos_Last); for (size_t Pos=0; Possecond.PrimaryExtendedSpokenLanguage, true); } } for (size_t StreamPos=1; StreamPos<(*Parser)->Count_Get(StreamKind_Last); StreamPos++) //If more than 1 stream, TODO: better way to do this { Stream_Prepare(StreamKind_Last); Merge(*(*Parser), StreamKind_Last, StreamPos, StreamPos_Last); } } if (Retrieve(StreamKind_Last, StreamPos_Last, General_ID).empty() || StreamKind_Last==Stream_Text || StreamKind_Last==Stream_Other) //TODO: better way to do detect subID { //Looking for Material package TrackID int32u TrackID=(int32u)-1; for (packages::iterator SourcePackage=Packages.begin(); SourcePackage!=Packages.end(); ++SourcePackage) if (SourcePackage->second.PackageUID.hi.hi) //Looking fo a SourcePackage with PackageUID only { //Testing if the Track is in this SourcePackage for (size_t Tracks_Pos=0; Tracks_Possecond.Tracks.size(); Tracks_Pos++) if (SourcePackage->second.Tracks[Tracks_Pos]==TrackUID) { tracks::iterator Track=Tracks.find(SourcePackage->second.Tracks[Tracks_Pos]); if (Track!=Tracks.end()) TrackID=Track->second.TrackID; } } Ztring ID; Ztring ID_String; if (TrackID!=(int32u)-1) ID=Ztring::ToZtring(TrackID); else if (Tracks[TrackUID].TrackID!=(int32u)-1) ID=Ztring::ToZtring(Tracks[TrackUID].TrackID); else { ID=Ztring::ToZtring(Essence->first); ID_String=Ztring::ToZtring(Essence->first, 16); } if (!ID.empty()) { for (size_t StreamPos=StreamPos_Last-((*Parser)->Count_Get(StreamKind_Last)?((*Parser)->Count_Get(StreamKind_Last)-1):0); StreamPos<=StreamPos_Last; StreamPos++) //If more than 1 stream { Ztring ID_Temp(ID); if (!Retrieve(StreamKind_Last, StreamPos, General_ID).empty()) { ID_Temp+=__T("-"); ID_Temp+=Retrieve(StreamKind_Last, StreamPos, General_ID); } Fill(StreamKind_Last, StreamPos, General_ID, ID_Temp, true); if (!ID_String.empty()) Fill(StreamKind_Last, StreamPos, General_ID_String, ID_String, true); } } if (!Tracks[TrackUID].TrackName.empty()) { for (size_t StreamPos=StreamPos_Last-((*Parser)->Count_Get(StreamKind_Last)?((*Parser)->Count_Get(StreamKind_Last)-1):0); StreamPos<=StreamPos_Last; StreamPos++) //If more than 1 stream Fill(StreamKind_Last, StreamPos, "Title", Tracks[TrackUID].TrackName); } } //Special case - DV #if defined(MEDIAINFO_DVDIF_YES) if (StreamKind_Last==Stream_Video && Retrieve(Stream_Video, StreamPos_Last, Video_Format)==__T("DV")) { if (Retrieve(Stream_General, 0, General_Recorded_Date).empty()) Fill(Stream_General, 0, General_Recorded_Date, (*Parser)->Retrieve(Stream_General, 0, General_Recorded_Date)); //Video and Audio are together size_t Audio_Count=(*Parser)->Count_Get(Stream_Audio); for (size_t Audio_Pos=0; Audio_PosFinish(); if (TimeCode_RoundedTimecodeBase && TimeCode_StartTimecode!=(int64u)-1) { Fill(Stream_Audio, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Delay), DTS_Delay*1000, 0, true); Fill(Stream_Audio, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Delay_Source), "Container"); } Merge(*(*Parser), Stream_Audio, Audio_Pos, StreamPos_Last); if (Retrieve(Stream_Audio, Pos, Audio_MuxingMode).empty()) Fill(Stream_Audio, Pos, Audio_MuxingMode, Retrieve(Stream_Video, Essence->second.StreamPos-(StreamPos_StartAtOne?1:0), Video_Format), true); else Fill(Stream_Audio, Pos, Audio_MuxingMode, Retrieve(Stream_Video, Essence->second.StreamPos-(StreamPos_StartAtOne?1:0), Video_Format)+__T(" / ")+Retrieve(Stream_Audio, Pos, Audio_MuxingMode), true); Fill(Stream_Audio, Pos, Audio_Duration, Retrieve(Stream_Video, Essence->second.StreamPos-(StreamPos_StartAtOne?1:0), Video_Duration)); Fill(Stream_Audio, Pos, Audio_StreamSize_Encoded, 0); //Included in the DV stream size Ztring ID=Retrieve(Stream_Audio, Pos, Audio_ID); Fill(Stream_Audio, Pos, Audio_ID, Retrieve(Stream_Video, Count_Get(Stream_Video)-1, Video_ID)+__T("-")+ID, true); Fill(Stream_Audio, Pos, Audio_ID_String, Retrieve(Stream_Video, Count_Get(Stream_Video)-1, Video_ID_String)+__T("-")+ID, true); Fill(Stream_Audio, Pos, Audio_Title, Retrieve(Stream_Video, Count_Get(Stream_Video)-1, Video_Title), true); } StreamKind_Last=Stream_Video; StreamPos_Last=Essence->second.StreamPos-(StreamPos_StartAtOne?1:0); } #endif //Special case - MPEG Video + Captions if (StreamKind_Last==Stream_Video && (*Parser)->Count_Get(Stream_Text)) { //Video and Text are together size_t Parser_Text_Count=(*Parser)->Count_Get(Stream_Text); for (size_t Parser_Text_Pos=0; Parser_Text_PosFinish(); if (TimeCode_RoundedTimecodeBase && TimeCode_StartTimecode!=(int64u)-1) { Fill(Stream_Text, Parser_Text_Pos, Fill_Parameter(StreamKind_Last, Generic_Delay), DTS_Delay*1000, 0, true); Fill(Stream_Text, Parser_Text_Pos, Fill_Parameter(StreamKind_Last, Generic_Delay_Source), "Container"); } Merge(*(*Parser), Stream_Text, Parser_Text_Pos, StreamPos_Last); Fill(Stream_Text, StreamPos_Last, Text_Duration, Retrieve(Stream_Video, StreamPos_Video, Video_Duration)); Ztring ID=Retrieve(Stream_Text, StreamPos_Last, Text_ID); if (Retrieve(Stream_Text, StreamPos_Last, Text_MuxingMode).find(__T("Ancillary"))!=string::npos) { for (descriptors::iterator Descriptor=Descriptors.begin(); Descriptor!=Descriptors.end(); ++Descriptor) if (Descriptor->second.Type==descriptor::Type_AncPackets) { Fill(Stream_Text, StreamPos_Last, Text_ID, Ztring::ToZtring(Descriptor->second.LinkedTrackID)+__T("-")+ID, true); Fill(Stream_Text, StreamPos_Last, Text_ID_String, Ztring::ToZtring(Descriptor->second.LinkedTrackID)+__T("-")+ID, true); Fill(Stream_Text, StreamPos_Last, Text_Title, Tracks[TrackUID].TrackName, true); break; } } else { Fill(Stream_Text, StreamPos_Last, Text_ID, Retrieve(Stream_Video, Count_Get(Stream_Video)-1, Video_ID)+__T("-")+ID, true); Fill(Stream_Text, StreamPos_Last, Text_ID_String, Retrieve(Stream_Video, Count_Get(Stream_Video)-1, Video_ID_String)+__T("-")+ID, true); Fill(Stream_Text, StreamPos_Last, Text_Title, Retrieve(Stream_Video, Count_Get(Stream_Video)-1, Video_Title), true); } for (size_t Pos=0; Possecond.PrimaryExtendedSpokenLanguage, true); } } } StreamKind_Last=Stream_Video; StreamPos_Last=Essence->second.StreamPos-(StreamPos_StartAtOne?1:0); } //Stream size if (StreamKind_Last!=Stream_Max && Count_Get(Stream_Video)+Count_Get(Stream_Audio)==1 && Essence->second.Stream_Size!=(int64u)-1) Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_StreamSize), Essence->second.Stream_Size); //Done Essence->second.Stream_Finish_Done=true; } //--------------------------------------------------------------------------- void File_Mxf::Streams_Finish_Descriptor(const int128u DescriptorUID, const int128u PackageUID) { descriptors::iterator Descriptor=Descriptors.find(DescriptorUID); if (Descriptor==Descriptors.end()) return; //Subs if (!Descriptor->second.SubDescriptors.empty()) { for (size_t Pos=0; Possecond.SubDescriptors.size(); Pos++) Streams_Finish_Descriptor(Descriptor->second.SubDescriptors[Pos], PackageUID); return; //Is not a real descriptor } StreamKind_Last=Descriptor->second.StreamKind; StreamPos_Last=Descriptor->second.StreamPos; if (StreamPos_Last==(size_t)-1) { for (size_t Pos=0; Possecond.LinkedTrackID)==ID) { StreamPos_Last=Pos; break; } } } if (StreamPos_Last==(size_t)-1) { if (Descriptors.size()==1) StreamPos_Last=0; else if (Descriptor->second.LinkedTrackID!=(int32u)-1) { //Workaround for a specific file with same ID if (!Locators.empty()) for (descriptors::iterator Descriptor1=Descriptors.begin(); Descriptor1!=Descriptor; ++Descriptor1) if (Descriptor1->second.LinkedTrackID==Descriptor->second.LinkedTrackID) { IdIsAlwaysSame_Offset++; break; } Stream_Prepare(Descriptor->second.StreamKind); Fill(StreamKind_Last, StreamPos_Last, General_ID, Descriptor->second.LinkedTrackID+IdIsAlwaysSame_Offset); } else { //Looking for Material package TrackID packages::iterator SourcePackage=Packages.find(PackageUID); //We have the the right PackageUID, looking for SourceClip from Sequence from Track from MaterialPackage for (components::iterator SourceClip=Components.begin(); SourceClip!=Components.end(); ++SourceClip) if (SourceClip->second.SourcePackageID.lo==SourcePackage->second.PackageUID.lo) //int256u doesn't support yet == { //We have the right SourceClip, looking for the Sequence from Track from MaterialPackage for (components::iterator Sequence=Components.begin(); Sequence!=Components.end(); ++Sequence) for (size_t StructuralComponents_Pos=0; StructuralComponents_Possecond.StructuralComponents.size(); StructuralComponents_Pos++) if (Sequence->second.StructuralComponents[StructuralComponents_Pos]==SourceClip->first) { //We have the right Sequence, looking for Track from MaterialPackage for (tracks::iterator Track=Tracks.begin(); Track!=Tracks.end(); ++Track) { if (Track->second.Sequence==Sequence->first) { Ztring ID=Ztring::ToZtring(Track->second.TrackID); StreamKind_Last=Stream_Max; StreamPos_Last=(size_t)-1; for (size_t StreamKind=Stream_General+1; StreamKindsecond.Locators.empty()) //TODO: 1 file has a TimeCode stream linked to a video stream, and it is displayed if Locator test is removed. Why? AS02 files streams are not filled if I remove completely this block, why? { if (Descriptor->second.StreamKind!=Stream_Max) Stream_Prepare(Descriptor->second.StreamKind); if (Track->second.TrackID!=(int32u)-1) { if (Descriptor->second.LinkedTrackID==(int32u)-1) Descriptor->second.LinkedTrackID=Track->second.TrackID; if (Descriptor->second.StreamKind!=Stream_Max) { Fill(StreamKind_Last, StreamPos_Last, General_ID, ID); Fill(StreamKind_Last, StreamPos_Last, "Title", Track->second.TrackName); } } } } } } } } } //Locators size_t Before_Count[Stream_Max]; for (size_t Pos=0; Possecond.Locators.size(); Locator_Pos++) { //Locator Streams_Finish_Locator(DescriptorUID, Descriptor->second.Locators[Locator_Pos]); } if (StreamPos_Last==(size_t)-1 && Essences.size()==1) { //Only one essence, there is sometimes no LinkedTrackID if (Count_Get(Stream_Video)==1) { StreamKind_Last=Stream_Video; StreamPos_Last=0; } else if (Count_Get(Stream_Audio)==1) { StreamKind_Last=Stream_Audio; StreamPos_Last=0; } } if (StreamKind_Last!=Stream_Max && StreamPos_Last!=(size_t)-1) { //Handling buggy files if (Descriptor->second.ScanType==__T("Interlaced") && Descriptor->second.Height==1152 && Descriptor->second.Height_Display==1152 && Descriptor->second.Width==720) //Height value is height of the frame instead of the field Descriptor->second.Height_Display/=2; //ID if (Descriptor->second.LinkedTrackID!=(int32u)-1 && Retrieve(StreamKind_Last, StreamPos_Last, General_ID).empty()) { for (size_t StreamKind=0; StreamKindFile_ID_OnlyRoot_Get()) Fill((stream_t)StreamKind, StreamPos, General_ID, Descriptor->second.LinkedTrackID, 10, true); else Fill((stream_t)StreamKind, StreamPos, General_ID, Ztring::ToZtring(Descriptor->second.LinkedTrackID)+ID, true); } } if (Descriptor->second.Width!=(int32u)-1 && Retrieve(Stream_Video, StreamPos_Last, Video_Width).empty()) Fill(Stream_Video, StreamPos_Last, Video_Width, Descriptor->second.Width, 10, true); if (Descriptor->second.Width_Display!=(int32u)-1 && Descriptor->second.Width_Display!=Retrieve(Stream_Video, StreamPos_Last, Video_Width).To_int32u()) { Fill(Stream_Video, StreamPos_Last, Video_Width_Original, Retrieve(Stream_Video, StreamPos_Last, Video_Width), true); if (Retrieve(Stream_Video, StreamPos_Last, Video_PixelAspectRatio_Original).empty()) Fill(Stream_Video, StreamPos_Last, Video_PixelAspectRatio_Original, Retrieve(Stream_Video, StreamPos_Last, Video_PixelAspectRatio), true); Clear(Stream_Video, StreamPos_Last, Video_PixelAspectRatio); Fill(Stream_Video, StreamPos_Last, Video_Width, Descriptor->second.Width_Display, 10, true); if (Descriptor->second.Width_Display_Offset!=(int32u)-1) Fill(Stream_Video, StreamPos_Last, Video_Width_Offset, Descriptor->second.Width_Display_Offset, 10, true); } if (Descriptor->second.Height!=(int32u)-1 && Retrieve(Stream_Video, StreamPos_Last, Video_Height).empty()) Fill(Stream_Video, StreamPos_Last, Video_Height, Descriptor->second.Height, 10, true); if (Descriptor->second.Height_Display!=(int32u)-1 && Descriptor->second.Height_Display!=Retrieve(Stream_Video, StreamPos_Last, Video_Height).To_int32u()) { Fill(Stream_Video, StreamPos_Last, Video_Height_Original, Retrieve(Stream_Video, StreamPos_Last, Video_Height), true); if (Retrieve(Stream_Video, StreamPos_Last, Video_PixelAspectRatio_Original).empty()) Fill(Stream_Video, StreamPos_Last, Video_PixelAspectRatio_Original, Retrieve(Stream_Video, StreamPos_Last, Video_PixelAspectRatio), true); Clear(Stream_Video, StreamPos_Last, Video_PixelAspectRatio); Fill(Stream_Video, StreamPos_Last, Video_Height, Descriptor->second.Height_Display, 10, true); if (Descriptor->second.Height_Display_Offset!=(int32u)-1) Fill(Stream_Video, StreamPos_Last, Video_Height_Offset, Descriptor->second.Height_Display_Offset, 10, true); } //Special case if (StreamKind_Last==Stream_Audio) { std::map::iterator Info=Descriptor->second.Infos.find("FrameRate"); if (Info!=Descriptor->second.Infos.end()) Descriptor->second.Infos.erase(Info); } //Info const Ztring &ID=Retrieve(StreamKind_Last, StreamPos_Last, General_ID); size_t ID_Dash_Pos=ID.find(__T('-')); size_t StreamWithSameID=1; if (ID_Dash_Pos!=(size_t)-1) { Ztring RealID=ID.substr(0, ID_Dash_Pos+1); while (StreamPos_Last+StreamWithSameID::iterator Info=Descriptor->second.Infos.begin(); Info!=Descriptor->second.Infos.end(); ++Info) if (Retrieve(StreamKind_Last, StreamPos_Last, Info->first.c_str()).empty()) { //Special case if (StereoscopicPictureSubDescriptor_IsPresent && StreamKind_Last==Stream_Video && Info->first=="FrameRate") { Info->second.From_Number(Descriptor->second.SampleRate/2, 3); Fill(Stream_Video, StreamPos_Last, Video_MultiView_Count, 2, 10, true); } if (Info->first=="BitRate" && Retrieve(StreamKind_Last, StreamPos_Last, General_ID).find(__T(" / "))!=string::npos) { if (Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_BitRate)).empty() || Retrieve(StreamKind_Last, StreamPos_Last, General_ID).find(__T("-"))!=string::npos) Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_BitRate_Encoded), Info->second.To_int64u()*2, 10, true); else Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_BitRate), Info->second.To_int64u()*2, 10, true); } else { for (size_t Pos=0; Posfirst.c_str(), Info->second, true); } } Ztring CodecID; if (Descriptor->second.EssenceContainer.hi!=(int64u)-1) { CodecID.From_Number(Descriptor->second.EssenceContainer.lo, 16); if (CodecID.size()<16) CodecID.insert(0, 16-CodecID.size(), __T('0')); } if (Descriptor->second.EssenceCompression.hi!=(int64u)-1) { if (!CodecID.empty()) CodecID+=__T('-'); Ztring EssenceCompression; EssenceCompression.From_Number(Descriptor->second.EssenceCompression.lo, 16); if (EssenceCompression.size()<16) EssenceCompression.insert(0, 16-EssenceCompression.size(), __T('0')); CodecID+=EssenceCompression; } if (!CodecID.empty()) for (size_t Pos=0; Possecond.HasMPEG2VideoDescriptor) Fill(Stream_Video, StreamPos_Last, Video_Format, "MPEG Video"); //Bitrate (PCM) if (StreamKind_Last==Stream_Audio && Retrieve(Stream_Audio, StreamPos_Last, Audio_BitRate).empty() && Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)==__T("PCM") && Retrieve(Stream_Audio, StreamPos_Last, Audio_Format_Settings_Wrapping).find(__T("D-10"))!=string::npos) { int64u SamplingRate=Retrieve(Stream_Audio, StreamPos_Last, Audio_SamplingRate).To_int64u(); if (SamplingRate) Fill(Stream_Audio, StreamPos_Last, Audio_BitRate, 8*SamplingRate*32); } if (StreamKind_Last==Stream_Audio && Retrieve(Stream_Audio, StreamPos_Last, Audio_BitRate).empty() && Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)==__T("PCM")) { int64u Channels=Retrieve(Stream_Audio, StreamPos_Last, Audio_Channel_s_).To_int64u(); int64u SamplingRate=Retrieve(Stream_Audio, StreamPos_Last, Audio_SamplingRate).To_int64u(); int64u Resolution=Retrieve(Stream_Audio, StreamPos_Last, Audio_BitDepth).To_int64u(); if (Channels && SamplingRate && Resolution) Fill(Stream_Audio, StreamPos_Last, Audio_BitRate, Channels*SamplingRate*Resolution); } //Bitrate (Video) if (StreamKind_Last==Stream_Video && Retrieve(Stream_Video, StreamPos_Last, Video_BitRate).empty()) { //Until now, I only found CBR files Fill(Stream_Video, StreamPos_Last, Video_BitRate, Retrieve(Stream_Video, StreamPos_Last, Video_BitRate_Nominal)); } //Frame rate if (StreamKind_Last==Stream_Video && Descriptor->second.Infos.find("FrameRate")!=Descriptor->second.Infos.end() && Descriptor->second.Infos["FrameRate"]!=Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate)) { //Until now, I only found CBR files Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Original, Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate)); Fill(Stream_Video, StreamPos_Last, Video_FrameRate, Descriptor->second.Infos["FrameRate"], true); } //Display Aspect Ratio if (StreamKind_Last==Stream_Video && !Descriptor->second.Infos["DisplayAspectRatio"].empty() && Retrieve(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio)!=Descriptor->second.Infos["DisplayAspectRatio"]) { Ztring DAR=Retrieve(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio); Clear(Stream_Video, StreamPos_Last, Video_PixelAspectRatio); Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, Descriptor->second.Infos["DisplayAspectRatio"], true); Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio_Original, DAR); float32 Width =Retrieve(Stream_Video, StreamPos_Last, Video_Width ).To_float32(); float32 Height=Retrieve(Stream_Video, StreamPos_Last, Video_Height ).To_float32(); float32 DAR_F =DAR.To_float32(); if (Width && Height && DAR_F) { float32 PAR =1/(Width/Height/DAR_F); if (PAR>(float32)12/(float32)11*0.99 && PAR<(float32)12/(float32)11*1.01) PAR=(float32)12/(float32)11; if (PAR>(float32)10/(float32)11*0.99 && PAR<(float32)10/(float32)11*1.01) PAR=(float32)10/(float32)11; if (PAR>(float32)16/(float32)11*0.99 && PAR<(float32)16/(float32)11*1.01) PAR=(float32)16/(float32)11; if (PAR>(float32)40/(float32)33*0.99 && PAR<(float32)40/(float32)33*1.01) PAR=(float32)40/(float32)33; if (PAR>(float32)24/(float32)11*0.99 && PAR<(float32)24/(float32)11*1.01) PAR=(float32)24/(float32)11; if (PAR>(float32)20/(float32)11*0.99 && PAR<(float32)20/(float32)11*1.01) PAR=(float32)20/(float32)11; if (PAR>(float32)32/(float32)11*0.99 && PAR<(float32)32/(float32)11*1.01) PAR=(float32)32/(float32)11; if (PAR>(float32)80/(float32)33*0.99 && PAR<(float32)80/(float32)33*1.01) PAR=(float32)80/(float32)33; if (PAR>(float32)18/(float32)11*0.99 && PAR<(float32)18/(float32)11*1.01) PAR=(float32)18/(float32)11; if (PAR>(float32)15/(float32)11*0.99 && PAR<(float32)15/(float32)11*1.01) PAR=(float32)15/(float32)11; if (PAR>(float32)64/(float32)33*0.99 && PAR<(float32)64/(float32)33*1.01) PAR=(float32)64/(float32)33; if (PAR>(float32)160/(float32)99*0.99 && PAR<(float32)160/(float32)99*1.01) PAR=(float32)160/(float32)99; if (PAR>(float32)4/(float32)3*0.99 && PAR<(float32)4/(float32)3*1.01) PAR=(float32)4/(float32)3; if (PAR>(float32)3/(float32)2*0.99 && PAR<(float32)3/(float32)2*1.01) PAR=(float32)3/(float32)2; if (PAR>(float32)2/(float32)1*0.99 && PAR<(float32)2/(float32)1*1.01) PAR=(float32)2; if (PAR>(float32)59/(float32)54*0.99 && PAR<(float32)59/(float32)54*1.01) PAR=(float32)59/(float32)54; } } //ActiveFormatDescriptor if (StreamKind_Last==Stream_Video && Descriptor->second.ActiveFormat!=(int8u)-1 && Retrieve(Stream_Video, StreamPos_Last, Video_ActiveFormatDescription).empty()) { Fill(Stream_Video, 0, Video_ActiveFormatDescription, Descriptor->second.ActiveFormat); if (Descriptor->second.ActiveFormat<16) { float32 DAR=Retrieve(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio).To_float32(); if (DAR>(float32)4/(float32)3*0.99 && DAR<(float32)4/(float32)3*1.01) Fill(Stream_Video, 0, Video_ActiveFormatDescription_String, AfdBarData_active_format_4_3[Descriptor->second.ActiveFormat]); if (DAR>(float32)16/(float32)9*0.99 && DAR<(float32)16/(float32)9*1.01) Fill(Stream_Video, 0, Video_ActiveFormatDescription_String, AfdBarData_active_format_16_9[Descriptor->second.ActiveFormat]); } if (Retrieve(Stream_Video, 0, Video_ActiveFormatDescription_String).empty()) Fill(Stream_Video, 0, Video_ActiveFormatDescription_String, Descriptor->second.ActiveFormat); } //ScanType / ScanOrder if (StreamKind_Last==Stream_Video && Retrieve(Stream_Video, StreamPos_Last, Video_ScanType_Original).empty()) { //ScanType if (!Descriptor->second.ScanType.empty() && (Descriptor->second.ScanType!=Retrieve(Stream_Video, StreamPos_Last, Video_ScanType) && !(Descriptor->second.ScanType==__T("Interlaced") && Retrieve(Stream_Video, StreamPos_Last, Video_ScanType)==__T("MBAFF")))) { Fill(Stream_Video, StreamPos_Last, Video_ScanType_Original, Retrieve(Stream_Video, StreamPos_Last, Video_ScanType)); Fill(Stream_Video, StreamPos_Last, Video_ScanType, Descriptor->second.ScanType, true); } //ScanOrder Ztring ScanOrder_Temp; if ((Descriptor->second.FieldDominance==1 && Descriptor->second.FieldTopness==1) || (Descriptor->second.FieldDominance!=1 && Descriptor->second.FieldTopness==2)) ScanOrder_Temp.From_UTF8("TFF"); if ((Descriptor->second.FieldDominance==1 && Descriptor->second.FieldTopness==2) || (Descriptor->second.FieldDominance!=1 && Descriptor->second.FieldTopness==1)) ScanOrder_Temp.From_UTF8("BFF"); if ((!ScanOrder_Temp.empty() && ScanOrder_Temp!=Retrieve(Stream_Video, StreamPos_Last, Video_ScanOrder)) || !Retrieve(Stream_Video, StreamPos_Last, Video_ScanType_Original).empty()) { Fill(Stream_Video, StreamPos_Last, Video_ScanOrder_Original, Retrieve(Stream_Video, StreamPos_Last, Video_ScanOrder), true); if (ScanOrder_Temp.empty()) { Clear(Stream_Video, StreamPos_Last, Video_ScanOrder); Clear(Stream_Video, StreamPos_Last, Video_ScanOrder_String); } else Fill(Stream_Video, StreamPos_Last, Video_ScanOrder, ScanOrder_Temp, true); } } } //Fallback on partition data if classic methods failed if (StreamKind_Last!=Stream_Max && StreamPos_Last!=(size_t)-1 && Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Format)).empty() && Descriptors.size()==1 && Count_Get(StreamKind_Last)==1) Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Format), Mxf_EssenceContainer(EssenceContainer_FromPartitionMetadata)); } //--------------------------------------------------------------------------- void File_Mxf::Streams_Finish_Locator(const int128u DescriptorUID, const int128u LocatorUID) { descriptors::iterator Descriptor=Descriptors.find(DescriptorUID); if (Descriptor==Descriptors.end()) return; locators::iterator Locator=Locators.find(LocatorUID); if (Locator==Locators.end()) return; //External file name specific if (!Locator->second.IsTextLocator && !Locator->second.EssenceLocator.empty()) { //Preparing Locator->second.StreamKind=StreamKind_Last; Locator->second.StreamPos=StreamPos_Last; Locator->second.LinkedTrackID=Descriptor->second.LinkedTrackID; } } //--------------------------------------------------------------------------- void File_Mxf::Streams_Finish_CommercialNames () { //Commercial names if (Count_Get(Stream_Video)==1) { Streams_Finish_StreamOnly(); if (!Retrieve(Stream_Video, 0, Video_Format_Commercial_IfAny).empty()) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, Retrieve(Stream_Video, 0, Video_Format_Commercial_IfAny)); Fill(Stream_General, 0, General_Format_Commercial, __T("MXF ")+Retrieve(Stream_Video, 0, Video_Format_Commercial_IfAny)); } else if (Retrieve(Stream_Video, 0, Video_Format)==__T("DV")) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, "DV"); Fill(Stream_General, 0, General_Format_Commercial, "MXF DV"); } else if (Retrieve(Stream_Video, 0, Video_Format)==__T("AVC") && Retrieve(Stream_Video, 0, Video_Format_Settings_GOP)==__T("N=1") && Retrieve(Stream_Video, 0, Video_Colorimetry)==__T("4:2:0") && Retrieve(Stream_Video, 0, Video_BitRate)==__T("56064000")) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, "AVC-Intra 50"); Fill(Stream_General, 0, General_Format_Commercial, "MXF AVC-Intra 50"); Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "AVC-Intra 50"); } else if (Retrieve(Stream_Video, 0, Video_Format)==__T("AVC") && Retrieve(Stream_Video, 0, Video_Format_Settings_GOP)==__T("N=1") && Retrieve(Stream_Video, 0, Video_Colorimetry)==__T("4:2:2") && Retrieve(Stream_Video, 0, Video_BitRate)==__T("113664000")) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, "AVC-Intra 100"); Fill(Stream_General, 0, General_Format_Commercial, "MXF AVC-Intra 100"); Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "AVC-Intra 100"); } else if (Retrieve(Stream_Video, 0, Video_Format)==__T("MPEG Video") && Retrieve(Stream_Video, 0, Video_Format_Settings_GOP)==__T("N=1") && Retrieve(Stream_Video, 0, Video_Colorimetry)==__T("4:2:2") && (Retrieve(Stream_Video, 0, Video_BitRate)==__T("30000000") || Retrieve(Stream_Video, 0, Video_BitRate_Nominal)==__T("30000000") || Retrieve(Stream_Video, 0, Video_BitRate_Maximum)==__T("30000000"))) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, "IMX 30"); Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "IMX 30"); } else if (Retrieve(Stream_Video, 0, Video_Format)==__T("MPEG Video") && Retrieve(Stream_Video, 0, Video_Format_Settings_GOP)==__T("N=1") && Retrieve(Stream_Video, 0, Video_Colorimetry)==__T("4:2:2") && (Retrieve(Stream_Video, 0, Video_BitRate)==__T("40000000") || Retrieve(Stream_Video, 0, Video_BitRate_Nominal)==__T("40000000") || Retrieve(Stream_Video, 0, Video_BitRate_Maximum)==__T("40000000"))) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, "IMX 40"); Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "IMX 40"); } else if (Retrieve(Stream_Video, 0, Video_Format)==__T("MPEG Video") && Retrieve(Stream_Video, 0, Video_Format_Settings_GOP)==__T("N=1") && Retrieve(Stream_Video, 0, Video_Colorimetry)==__T("4:2:2") && (Retrieve(Stream_Video, 0, Video_BitRate)==__T("50000000") || Retrieve(Stream_Video, 0, Video_BitRate_Nominal)==__T("50000000") || Retrieve(Stream_Video, 0, Video_BitRate_Maximum)==__T("50000000"))) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, "IMX 50"); Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "IMX 50"); } else if (Retrieve(Stream_Video, 0, Video_Format)==__T("MPEG Video") && !Retrieve(Stream_Video, 0, Video_Format_Settings_GOP).empty() && Retrieve(Stream_Video, 0, Video_Format_Settings_GOP)!=__T("N=1") && Retrieve(Stream_Video, 0, Video_Colorimetry)==__T("4:2:0") && (Retrieve(Stream_Video, 0, Video_BitRate)==__T("18000000") || Retrieve(Stream_Video, 0, Video_BitRate_Nominal)==__T("18000000") || Retrieve(Stream_Video, 0, Video_BitRate_Maximum)==__T("18000000"))) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, "XDCAM HD 18"); Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "XDCAM HD 18"); } else if (Retrieve(Stream_Video, 0, Video_Format)==__T("MPEG Video") && !Retrieve(Stream_Video, 0, Video_Format_Settings_GOP).empty() && Retrieve(Stream_Video, 0, Video_Format_Settings_GOP)!=__T("N=1") && Retrieve(Stream_Video, 0, Video_Colorimetry)==__T("4:2:0") && (Retrieve(Stream_Video, 0, Video_BitRate)==__T("25000000") || Retrieve(Stream_Video, 0, Video_BitRate_Nominal)==__T("25000000") || Retrieve(Stream_Video, 0, Video_BitRate_Maximum)==__T("25000000"))) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, "XDCAM HD 25"); Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "XDCAM HD 25"); } else if (Retrieve(Stream_Video, 0, Video_Format)==__T("MPEG Video") && !Retrieve(Stream_Video, 0, Video_Format_Settings_GOP).empty() && Retrieve(Stream_Video, 0, Video_Format_Settings_GOP)!=__T("N=1") && Retrieve(Stream_Video, 0, Video_Colorimetry)==__T("4:2:0") && (Retrieve(Stream_Video, 0, Video_BitRate)==__T("35000000") || Retrieve(Stream_Video, 0, Video_BitRate_Nominal)==__T("35000000") || Retrieve(Stream_Video, 0, Video_BitRate_Maximum)==__T("35000000"))) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, "XDCAM HD 35"); Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "XDCAM HD 35"); } else if (Retrieve(Stream_Video, 0, Video_Format)==__T("MPEG Video") && !Retrieve(Stream_Video, 0, Video_Format_Settings_GOP).empty() && Retrieve(Stream_Video, 0, Video_Format_Settings_GOP)!=__T("N=1") && Retrieve(Stream_Video, 0, Video_Colorimetry)==__T("4:2:2") && (Retrieve(Stream_Video, 0, Video_BitRate)==__T("50000000") || Retrieve(Stream_Video, 0, Video_BitRate_Nominal)==__T("50000000") || Retrieve(Stream_Video, 0, Video_BitRate_Maximum)==__T("50000000"))) { Fill(Stream_General, 0, General_Format_Commercial_IfAny, "XDCAM HD422"); Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "XDCAM HD422"); } } } //--------------------------------------------------------------------------- void File_Mxf::Streams_Finish_Component(const int128u ComponentUID, float64 EditRate, int32u TrackID, int64u Origin) { components::iterator Component=Components.find(ComponentUID); if (Component==Components.end()) return; //Duration if (EditRate && StreamKind_Last!=Stream_Max && Component->second.Duration!=(int64u)-1) { Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Duration), Component->second.Duration*1000/EditRate, 0, true); size_t ID_SubStreamInfo_Pos=Retrieve(StreamKind_Last, StreamPos_Last, General_ID).find(__T("-")); if (ID_SubStreamInfo_Pos!=string::npos) { Ztring ID=Retrieve(StreamKind_Last, StreamPos_Last, General_ID); ID.resize(ID_SubStreamInfo_Pos+1); size_t StreamPos_Last_Temp=StreamPos_Last; while (StreamPos_Last_Temp) { StreamPos_Last_Temp--; if (Retrieve(StreamKind_Last, StreamPos_Last_Temp, General_ID).find(ID)!=0) break; Fill(StreamKind_Last, StreamPos_Last_Temp, Fill_Parameter(StreamKind_Last, Generic_Duration), Component->second.Duration*1000/EditRate, 0, true); } } if (Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_FrameCount)).empty()) Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_FrameCount), Component->second.Duration); } //For the sequence, searching Structural componenents for (size_t Pos=0; Possecond.StructuralComponents.size(); Pos++) { components::iterator Component2=Components.find(Component->second.StructuralComponents[Pos]); if (Component2!=Components.end() && Component2->second.TimeCode_StartTimecode!=(int64u)-1 && !Config->File_IsReferenced_Get()) { bool IsDuplicate=false; for (size_t Pos2=0; Pos2second.TimeCode_StartTimecode-Origin, (int8u)Component2->second.TimeCode_RoundedTimecodeBase, Component2->second.TimeCode_DropFrame); Stream_Prepare(Stream_Other); Fill(Stream_Other, StreamPos_Last, Other_ID, TrackID); Fill(Stream_Other, StreamPos_Last, Other_Type, "Time code"); Fill(Stream_Other, StreamPos_Last, Other_Format, "MXF TC"); //Fill(Stream_Other, StreamPos_Last, Other_MuxingMode, "Time code track"); Fill(Stream_Other, StreamPos_Last, Other_TimeCode_FirstFrame, TC.ToString().c_str()); Fill(Stream_Other, StreamPos_Last, Other_TimeCode_Settings, "Striped"); } } } } //--------------------------------------------------------------------------- void File_Mxf::Streams_Finish_Identification (const int128u IdentificationUID) { identifications::iterator Identification=Identifications.find(IdentificationUID); if (Identification==Identifications.end()) return; if (!Identification->second.ProductName.empty()) { Ztring Encoded_Library_Name; if (!Identification->second.CompanyName.empty()) { Encoded_Library_Name+=Identification->second.CompanyName; Encoded_Library_Name+=__T(' '); } Encoded_Library_Name+=Identification->second.ProductName; Ztring Encoded_Library_Version; if (!Identification->second.ProductVersion.empty()) { Encoded_Library_Version=Identification->second.ProductVersion; } else if (!Identification->second.VersionString.empty()) { Encoded_Library_Version=Identification->second.VersionString; } Ztring Encoded_Application=Encoded_Library_Name; if (!Encoded_Library_Version.empty()) { Encoded_Application+=__T(' '); Encoded_Application+=Encoded_Library_Version; } Fill(Stream_General, 0, General_Encoded_Application, Encoded_Application, true); Fill(Stream_General, 0, General_Encoded_Library_Name, Encoded_Library_Name, true); Fill(Stream_General, 0, General_Encoded_Library_Version, Encoded_Library_Version, true); } for (std::map::iterator Info=Identification->second.Infos.begin(); Info!=Identification->second.Infos.end(); ++Info) Fill(Stream_General, 0, Info->first.c_str(), Info->second, true); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Mxf::Read_Buffer_Init() { EssenceContainer_FromPartitionMetadata=0; #if MEDIAINFO_DEMUX Demux_UnpacketizeContainer=Config->Demux_Unpacketize_Get(); Demux_Rate=Config->Demux_Rate_Get(); #endif //MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- void File_Mxf::Read_Buffer_Continue() { if (!IsSub) { if (Config->ParseSpeed>=1.0) { bool Buffer_End_IsUpdated=false; if (Config->File_IsGrowing && !Config->File_IsNotGrowingAnymore) { File F; F.Open(File_Name); std::vector SearchingPartitionPack(65536); size_t SearchingPartitionPack_Size=F.Read(&SearchingPartitionPack[0], SearchingPartitionPack.size()); for (size_t Pos=0; Pos+16File_IsNotGrowingAnymore=true; MediaInfo_Internal MI; Ztring ParseSpeed_Save=MI.Option(__T("ParseSpeed_Get"), __T("")); Ztring Demux_Save=MI.Option(__T("Demux_Get"), __T("")); MI.Option(__T("ParseSpeed"), __T("0")); MI.Option(__T("Demux"), Ztring()); size_t MiOpenResult=MI.Open(File_Name); MI.Option(__T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value MI.Option(__T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value if (MiOpenResult) { Fill(Stream_General, 0, General_Format_Settings, MI.Get(Stream_General, 0, General_Format_Settings), true); Fill(Stream_General, 0, General_Duration, MI.Get(Stream_General, 0, General_Duration), true); Fill(Stream_General, 0, General_FileSize, MI.Get(Stream_General, 0, General_FileSize), true); if (Buffer_End_Unlimited) { Buffer_End=MI.Get(Stream_General, 0, General_FileSize).To_int64u()-MI.Get(Stream_General, 0, General_FooterSize).To_int64u(); Buffer_End_IsUpdated=true; } } } break; default : ; } } if (Buffer_End && Buffer_End_Unlimited && !Buffer_End_IsUpdated) Buffer_End=Config->File_Size; //Updating Clip end in case the } Config->State_Set(((float)Buffer_TotalBytes)/Config->File_Size); } } if ((IsCheckingRandomAccessTable || IsCheckingFooterPartitionAddress) && File_Offset+Buffer_Offset+16Buffer_Size) { Element_WaitForMoreData(); return; } if (CC4(Buffer+Buffer_Offset)!=0x060E2B34 || CC3(Buffer+Buffer_Offset+4)!=0x020501 || CC3(Buffer+Buffer_Offset+8)!=0x0D0102 || CC1(Buffer+Buffer_Offset+12)!=0x01) { if (IsCheckingRandomAccessTable || (IsCheckingFooterPartitionAddress && FooterPartitionAddress_Jumped)) TryToFinish(); //No footer else if (IsCheckingFooterPartitionAddress) { IsParsingEnd=true; GoToFromEnd(4); //For random access table FooterPartitionAddress_Jumped=true; Open_Buffer_Unsynch(); } } IsCheckingRandomAccessTable=false; IsCheckingFooterPartitionAddress=false; } if (Config->ParseSpeed<1.0 && File_Offset+Buffer_Offset+4==File_Size) { int32u Length; Get_B4 (Length, "Length (Random Index)"); if (Length>=16+4 && Length=IsParsingMiddle_MaxOffset) { Fill(); Open_Buffer_Unsynch(); Finish(); return; } if (File_Offset+Buffer_Size>=File_Size) { if (Partitions_IsCalculatingHeaderByteCount) { Partitions_IsCalculatingHeaderByteCount=false; if (Partitions_Pos=Buffer_End //Too much late || File_GoTo<=Buffer_Begin) //Too much early { Buffer_Begin=(int64u)-1; Buffer_End=0; Buffer_End_Unlimited=false; Buffer_Header_Size=0; MustSynchronize=true; Synched=false; UnSynched_IsNotJunk=true; } else Synched=true; //Always in clip data } FrameInfo=frame_info(); FrameInfo.DTS=float64_int64s(DTS_Delay*1000000000); Frame_Count_NotParsedIncluded=(int64u)-1; #if MEDIAINFO_DEMUX || MEDIAINFO_SEEK if (!Tracks.empty() && Tracks.begin()->second.EditRate) //TODO: use the corresponding track instead of the first one FrameInfo.DUR=float64_int64s(1000000000/Tracks.begin()->second.EditRate); else if (!IndexTables.empty() && IndexTables[0].IndexEditRate) FrameInfo.DUR=float64_int64s(1000000000/IndexTables[0].IndexEditRate); //Calculating the byte count not included in seek information (partition, index...) int64u FutureFileOffset=File_GoTo==(int64u)-1?(File_Offset+Buffer_Offset):File_GoTo; int64u StreamOffset_Offset=0; Partitions_Pos=0; while (Partitions_Possecond.ByteRate!=(int32u)-1 && Descriptors.begin()->second.SampleRate) { float64 BytePerFrame=Descriptors.begin()->second.ByteRate/Descriptors.begin()->second.SampleRate; float64 Frame_Count_NotParsedIncluded_Precise; if (FutureFileOffset>(StreamOffset_Offset+Buffer_Header_Size)) Frame_Count_NotParsedIncluded_Precise=(FutureFileOffset-(StreamOffset_Offset+Buffer_Header_Size))/BytePerFrame; //In case of audio at frame rate not an integer else Frame_Count_NotParsedIncluded_Precise=0; Frame_Count_NotParsedIncluded=float64_int64s(Frame_Count_NotParsedIncluded_Precise); FrameInfo.DTS=float64_int64s(DTS_Delay*1000000000+((float64)Frame_Count_NotParsedIncluded_Precise)*1000000000/Descriptors.begin()->second.SampleRate); FrameInfo.PTS=FrameInfo.DTS; if (!Tracks.empty() && Tracks.begin()->second.EditRate) //TODO: use the corresponding track instead of the first one FrameInfo.DUR=float64_int64s(1000000000/Tracks.begin()->second.EditRate); else if (!IndexTables.empty() && IndexTables[0].IndexEditRate) FrameInfo.DUR=float64_int64s(1000000000/IndexTables[0].IndexEditRate); else FrameInfo.DUR=float64_int64s(1000000000/Descriptors.begin()->second.SampleRate); Demux_random_access=true; } else if (!IndexTables.empty() && IndexTables[0].EditUnitByteCount) { int64u Position=0; Frame_Count_NotParsedIncluded=0; for (size_t Pos=0; Pos=((Buffer_End?Buffer_Begin:(StreamOffset_Offset+Buffer_Header_Size))+Position)+IndexTables[Pos].IndexDuration*IndexTables[Pos].EditUnitByteCount) //Considering IndexDuration=0 as unlimited { Position+=SDTI_SizePerFrame+IndexTables[Pos].EditUnitByteCount*IndexTables[Pos].IndexDuration; Frame_Count_NotParsedIncluded+=IndexTables[Pos].IndexDuration; } else { int64u FramesToAdd; if (FutureFileOffset>((Buffer_End?Buffer_Begin:(StreamOffset_Offset+Buffer_Header_Size))+Position)) FramesToAdd=(FutureFileOffset-((Buffer_End?Buffer_Begin:(StreamOffset_Offset+Buffer_Header_Size))+Position))/IndexTables[Pos].EditUnitByteCount; else FramesToAdd=0; Position+=(SDTI_SizePerFrame+IndexTables[Pos].EditUnitByteCount)*FramesToAdd; if (IndexTables[Pos].IndexEditRate) { if (Descriptors.size()==1 && Descriptors.begin()->second.SampleRate!=IndexTables[Pos].IndexEditRate) { float64 Frame_Count_NotParsedIncluded_Precise=((float64)FramesToAdd)/IndexTables[Pos].IndexEditRate*Descriptors.begin()->second.SampleRate; Frame_Count_NotParsedIncluded+=float64_int64s(((float64)FramesToAdd)/IndexTables[Pos].IndexEditRate*Descriptors.begin()->second.SampleRate); FrameInfo.PTS=FrameInfo.DTS=float64_int64s(DTS_Delay*1000000000+((float64)Frame_Count_NotParsedIncluded_Precise)*1000000000/Descriptors.begin()->second.SampleRate); } else { Frame_Count_NotParsedIncluded+=FramesToAdd; FrameInfo.PTS=FrameInfo.DTS=float64_int64s(DTS_Delay*1000000000+((float64)Frame_Count_NotParsedIncluded)*1000000000/IndexTables[Pos].IndexEditRate); } } else FrameInfo.PTS=FrameInfo.DTS=(int64u)-1; Demux_random_access=true; break; } } } else if (!IndexTables.empty() && !IndexTables[0].Entries.empty()) { int64u StreamOffset; if (StreamOffset_Offset=IndexTables[Pos].Entries[0].StreamOffset+(IndexTables[Pos].IndexStartPosition)*SDTI_SizePerFrame && (Pos+1>=IndexTables.size() || IndexTables[Pos+1].Entries.empty() || StreamOffsetEntry_StreamOffset || Entry_StreamOffset>Entry1_StreamOffset) break; //Problem if (StreamOffset>=Entry_StreamOffset && StreamOffsetsecond.SampleRate) FrameInfo.PTS=FrameInfo.DTS=float64_int64s(DTS_Delay*1000000000+((float64)Frame_Count_NotParsedIncluded)*1000000000/Descriptors.begin()->second.SampleRate); } else if (Frame_Count_NotParsedIncluded==0) { FrameInfo.DTS=float64_int64s(DTS_Delay*1000000000); } #endif //if MEDIAINFO_DEMUX || MEDIAINFO_SEEK if (!Tracks.empty() && Tracks.begin()->second.EditRate) //TODO: use the corresponding track instead of the first one FrameInfo.DUR=float64_int64s(1000000000/Tracks.begin()->second.EditRate); #if MEDIAINFO_DEMUX || MEDIAINFO_SEEK else if (!IndexTables.empty() && IndexTables[0].IndexEditRate) FrameInfo.DUR=float64_int64s(1000000000/IndexTables[0].IndexEditRate); #endif //if MEDIAINFO_DEMUX || MEDIAINFO_SEEK for (essences::iterator Essence=Essences.begin(); Essence!=Essences.end(); ++Essence) for (parsers::iterator Parser=Essence->second.Parsers.begin(); Parser!=Essence->second.Parsers.end(); ++Parser) { (*Parser)->Open_Buffer_Unsynch(); Essence->second.FrameInfo=FrameInfo; Essence->second.Frame_Count_NotParsedIncluded=Frame_Count_NotParsedIncluded; } Partitions_Pos=0; if (Partitions_IsCalculatingHeaderByteCount) { Partitions.erase(Partitions.end()-1); Partitions_IsCalculatingHeaderByteCount=false; } if (Partitions_IsCalculatingSdtiByteCount) Partitions_IsCalculatingSdtiByteCount=false; Essences_FirstEssence_Parsed=false; #if MEDIAINFO_SEEK IndexTables_Pos=0; #endif //MEDIAINFO_SEEK } //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX || MEDIAINFO_SEEK bool File_Mxf::DetectDuration () { if (Duration_Detected) return false; MediaInfo_Internal MI; MI.Option(__T("File_IsDetectingDuration"), __T("1")); MI.Option(__T("File_KeepInfo"), __T("1")); Ztring ParseSpeed_Save=MI.Option(__T("ParseSpeed_Get"), __T("")); Ztring Demux_Save=MI.Option(__T("Demux_Get"), __T("")); MI.Option(__T("ParseSpeed"), __T("0")); MI.Option(__T("Demux"), Ztring()); size_t MiOpenResult=MI.Open(File_Name); MI.Option(__T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value MI.Option(__T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value if (!MiOpenResult || MI.Get(Stream_General, 0, General_Format)!=__T("MXF")) return false; Partitions=((File_Mxf*)MI.Info)->Partitions; std::sort(Partitions.begin(), Partitions.end()); IndexTables=((File_Mxf*)MI.Info)->IndexTables; std::sort(IndexTables.begin(), IndexTables.end()); SDTI_SizePerFrame=((File_Mxf*)MI.Info)->SDTI_SizePerFrame; Clip_Begin=((File_Mxf*)MI.Info)->Clip_Begin; Clip_End=((File_Mxf*)MI.Info)->Clip_End; Clip_Header_Size=((File_Mxf*)MI.Info)->Clip_Header_Size; Clip_Code=((File_Mxf*)MI.Info)->Clip_Code; Tracks=((File_Mxf*)MI.Info)->Tracks; //In one file (*-009.mxf), the TrackNumber is known only at the end of the file (Open and incomplete header/footer) for (tracks::iterator Track=Tracks.begin(); Track!=Tracks.end(); ++Track) Track->second.Stream_Finish_Done=false; //Reseting the value, it is not done in this instance if (MI.Get(Stream_General, 0, General_OverallBitRate_Mode)==__T("CBR") && Partitions.size()==2 && Partitions[0].FooterPartition==Partitions[1].StreamOffset && !Descriptors.empty()) { //Searching duration int64u Duration=0; for (descriptors::iterator Descriptor=Descriptors.begin(); Descriptor!=Descriptors.end(); ++Descriptor) if (Descriptor->second.Duration!=(int64u)-1 && Descriptor->second.Duration) { if (Duration && Duration!=Descriptor->second.Duration) { Duration=0; break; //Not supported } Duration=Descriptor->second.Duration; } //Computing the count of bytes per frame if (Duration) { int64u Begin=Partitions[0].StreamOffset+Partitions[0].PartitionPackByteCount+Partitions[0].HeaderByteCount+Partitions[0].IndexByteCount; float64 BytesPerFrameF=((float64)(Partitions[0].FooterPartition-Begin)/Duration); OverallBitrate_IsCbrForSure=float64_int64s(BytesPerFrameF); if (OverallBitrate_IsCbrForSure!=BytesPerFrameF) //Testing integrity of the computing OverallBitrate_IsCbrForSure=0; } } Duration_Detected=true; return true; } #endif //MEDIAINFO_DEMUX || MEDIAINFO_SEEK #if MEDIAINFO_SEEK size_t File_Mxf::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { if (ReferenceFiles) return ReferenceFiles->Read_Buffer_Seek(Method, Value, ID); //Init if (!Duration_Detected) { if (!DetectDuration()) return 0; } //Parsing switch (Method) { case 0 : { //Calculating the byte count not included in seek information (partition, index...) Partitions_Pos=0; while (Partitions_Pos=Partitions.size()) { GoTo(0); Open_Buffer_Unsynch(); return 1; } int64u StreamOffset_Offset=Partitions[Partitions_Pos].StreamOffset-Partitions[Partitions_Pos].BodyOffset+Partitions[Partitions_Pos].PartitionPackByteCount+Partitions[Partitions_Pos].HeaderByteCount+Partitions[Partitions_Pos].IndexByteCount; //If in header if ((Clip_Begin!=(int64u)-1 && Valuesecond.ByteRate!=(int32u)-1 && Descriptors.begin()->second.BlockAlign && Descriptors.begin()->second.BlockAlign!=(int16u)-1 && Descriptors.begin()->second.SampleRate) { if (Value>StreamOffset_Offset) { float64 BytesPerFrame=Descriptors.begin()->second.ByteRate/Descriptors.begin()->second.SampleRate; int64u FrameCount=(int64u)((Value-Buffer_Begin)/BytesPerFrame); int64u SizeBlockAligned=float64_int64s(FrameCount*BytesPerFrame); SizeBlockAligned/=Descriptors.begin()->second.BlockAlign; SizeBlockAligned*=Descriptors.begin()->second.BlockAlign; GoTo(Buffer_Begin+SizeBlockAligned); Open_Buffer_Unsynch(); return 1; } } else if (Buffer_End && !IndexTables.empty() && IndexTables[0].EditUnitByteCount) { int64u Stream_Offset=0; for (size_t Pos=0; Possecond.SampleRate) break; if (Descriptor==Descriptors.end()) return (size_t)-1; //Not supported if (TimeCode_StartTimecode!=(int64u)-1) { int64u Delay=float64_int64s(DTS_Delay*1000000000); if (Valuesecond.SampleRate); } //No break; case 3 : //FrameNumber if (Descriptors.size()==1 && Descriptors.begin()->second.ByteRate!=(int32u)-1 && Descriptors.begin()->second.BlockAlign && Descriptors.begin()->second.BlockAlign!=(int16u)-1 && Descriptors.begin()->second.SampleRate) { //Config - TODO: merge with the one in Data_Parse() if (!Essences_FirstEssence_Parsed) { if (Demux_UnpacketizeContainer && Descriptors.size()==1 && Descriptors.begin()->second.StreamKind==Stream_Audio) { //Configuring bitrate is not available in descriptor if (Descriptors.begin()->second.ByteRate==(int32u)-1 && Descriptors.begin()->second.Infos.find("SamplingRate")!=Descriptors.begin()->second.Infos.end()) { int32u SamplingRate=Descriptors.begin()->second.Infos["SamplingRate"].To_int32u(); if (Descriptors.begin()->second.BlockAlign!=(int16u)-1) Descriptors.begin()->second.ByteRate=SamplingRate*Descriptors.begin()->second.BlockAlign; else if (Descriptors.begin()->second.QuantizationBits!=(int8u)-1) Descriptors.begin()->second.ByteRate=SamplingRate*Descriptors.begin()->second.QuantizationBits/8; } //Configuring EditRate if needed (e.g. audio at 48000 Hz) if (Demux_Rate) //From elsewhere { Descriptors.begin()->second.SampleRate=Demux_Rate; } else if (Descriptors.begin()->second.SampleRate>1000) { Descriptors.begin()->second.SampleRate=25; //Default value } } Essences_FirstEssence_Parsed=true; } float64 BytesPerFrame=Descriptors.begin()->second.ByteRate/Descriptors.begin()->second.SampleRate; int64u StreamOffset=(int64u)(Value*BytesPerFrame); StreamOffset/=Descriptors.begin()->second.BlockAlign; StreamOffset*=Descriptors.begin()->second.BlockAlign; //Calculating the byte count not included in seek information (partition, index...) int64u StreamOffset_Offset=0; Partitions_Pos=0; while (Partitions_Possecond.Parsers.size()==1 && (*(Essences.begin()->second.Parsers.begin()))->Demux_UnpacketizeContainer) { (*(Essences.begin()->second.Parsers.begin()))->Demux_Level=2; //Container (*(Essences.begin()->second.Parsers.begin()))->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX } GoTo(StreamOffset_Offset+Buffer_Header_Size+StreamOffset+Value*SDTI_SizePerFrame); Open_Buffer_Unsynch(); return 1; } else if (!IndexTables.empty() && IndexTables[0].EditUnitByteCount) { if (Descriptors.size()==1 && Descriptors.begin()->second.SampleRate!=IndexTables[0].IndexEditRate) { float64 ValueF=(float64)Value; ValueF/=Descriptors.begin()->second.SampleRate; ValueF*=IndexTables[0].IndexEditRate; Value=float64_int64s(ValueF); } if (IndexTables[IndexTables.size()-1].IndexDuration && IndexTables[IndexTables.size()-1].IndexStartPosition!=(int64u)-1 && Value>=IndexTables[IndexTables.size()-1].IndexStartPosition+IndexTables[IndexTables.size()-1].IndexDuration) //Considering IndexDuration=0 as unlimited return 2; //Invalid value int64u StreamOffset=0; for (size_t Pos=0; PosIndexTables[Pos].IndexStartPosition+IndexTables[Pos].IndexDuration) //Considering IndexDuration=0 as unlimited StreamOffset+=IndexTables[Pos].EditUnitByteCount*IndexTables[Pos].IndexDuration; else { StreamOffset+=IndexTables[Pos].EditUnitByteCount*(Value-IndexTables[Pos].IndexStartPosition); break; } } //Calculating the byte count not included in seek information (partition, index...) int64u StreamOffset_Offset=0; Partitions_Pos=0; while (Partitions_Possecond.Parsers.size()==1 && (*(Essences.begin()->second.Parsers.begin()))->Demux_UnpacketizeContainer) { (*(Essences.begin()->second.Parsers.begin()))->Demux_Level=2; //Container (*(Essences.begin()->second.Parsers.begin()))->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX } GoTo(StreamOffset_Offset+Buffer_Header_Size+StreamOffset+Value*SDTI_SizePerFrame); Open_Buffer_Unsynch(); return 1; } else if (!IndexTables.empty() && !IndexTables[0].Entries.empty()) { for (size_t Pos=0; Pos=IndexTables[Pos].IndexStartPosition && Value=IndexTables[Pos].IndexStartPosition && IndexTables[Pos].Entries[(size_t)(Value-IndexTables[Pos].IndexStartPosition)].Type) { Value--; if (Valuesecond.Parsers.size()==1 && (*(Essences.begin()->second.Parsers.begin()))->Demux_UnpacketizeContainer) { (*(Essences.begin()->second.Parsers.begin()))->Demux_Level=2; //Container (*(Essences.begin()->second.Parsers.begin()))->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX } GoTo(StreamOffset_Offset+Buffer_Header_Size+StreamOffset+Value*SDTI_SizePerFrame); Open_Buffer_Unsynch(); return 1; } } return 2; //Invalid value } else if (OverallBitrate_IsCbrForSure) { int64u Begin=Partitions[0].StreamOffset+Partitions[0].PartitionPackByteCount+Partitions[0].HeaderByteCount+Partitions[0].IndexByteCount; GoTo(Begin+Value*OverallBitrate_IsCbrForSure); Open_Buffer_Unsynch(); return 1; } else return (size_t)-1; //Not supported default : return (size_t)-1; //Not supported } } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Mxf::FileHeader_Begin() { //AAF has some MXF start codes if (Buffer[ 0x0]==0xD0 && Buffer[ 0x1]==0xCF && Buffer[ 0x2]==0x11 && Buffer[ 0x3]==0xE0 && Buffer[ 0x4]==0xA1 && Buffer[ 0x5]==0xB1 && Buffer[ 0x6]==0x1A && Buffer[ 0x7]==0xE1 && Buffer[ 0x8]==0x41 && Buffer[ 0x9]==0x41 && Buffer[ 0xA]==0x46 && Buffer[ 0xB]==0x42 && Buffer[ 0xC]==0x0D && Buffer[ 0xD]==0x00 && Buffer[ 0xE]==0x4F && Buffer[ 0xF]==0x4D && Buffer[0x10]==0x06 && Buffer[0x11]==0x0E && Buffer[0x12]==0x2B && Buffer[0x13]==0x34 && Buffer[0x14]==0x01 && Buffer[0x15]==0x01 && Buffer[0x16]==0x01 && Buffer[0x17]==0xFF) { Reject("Mxf"); return false; } //DCA uses buffer interface without filename if (File_Name.empty()) File_Name=Config->File_FileName_Get(); return true; } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Mxf::Synchronize() { //Synchronizing while (Buffer_Offset+4<=Buffer_Size && (Buffer[Buffer_Offset ]!=0x06 || Buffer[Buffer_Offset+1]!=0x0E || Buffer[Buffer_Offset+2]!=0x2B || Buffer[Buffer_Offset+3]!=0x34)) { Buffer_Offset++; while (Buffer_OffsetBuffer_Size) { if (Buffer_Offset+3==Buffer_Size && CC3(Buffer+Buffer_Offset)!=0x060E2B) Buffer_Offset++; if (Buffer_Offset+2==Buffer_Size && CC2(Buffer+Buffer_Offset)!=0x060E) Buffer_Offset++; if (Buffer_Offset+1==Buffer_Size && CC1(Buffer+Buffer_Offset)!=0x06) Buffer_Offset++; return false; } if (!Status[IsAccepted]) { Accept(); Fill(Stream_General, 0, General_Format, "MXF"); File_Buffer_Size_Hint_Pointer=Config->File_Buffer_Size_Hint_Pointer_Get(); } //Synched is OK return true; } //--------------------------------------------------------------------------- bool File_Mxf::Synched_Test() { //Must have enough buffer for having header if (Buffer_Offset+16>Buffer_Size) return false; //Quick test of synchro if (CC4(Buffer+Buffer_Offset)!=0x060E2B34) Synched=false; //Trace config #if MEDIAINFO_TRACE if (Synched) { int64u Compare=CC8(Buffer+Buffer_Offset+ 4); if (Compare==0x010201010D010301LL //Raw stream || (Compare==0x0101010203010210LL && CC1(Buffer+Buffer_Offset+12)==0x01) //Filler || (Compare==0x020501010D010301LL && CC3(Buffer+Buffer_Offset+12)==0x040101) //SDTI Package Metadata Pack || (Compare==0x024301010D010301LL && CC3(Buffer+Buffer_Offset+12)==0x040102) //SDTI Package Metadata Set || (Compare==0x025301010D010301LL && CC3(Buffer+Buffer_Offset+12)==0x140201)) //System Scheme 1 { Trace_Layers_Update(8); //Stream } else { Trace_Layers_Update(0); //Container1 } } #endif //MEDIAINFO_TRACE //We continue return true; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- bool File_Mxf::Header_Begin() { while (Buffer_End) { #if MEDIAINFO_DEMUX if (Demux_UnpacketizeContainer && Descriptors.size()==1 && Descriptors.begin()->second.ByteRate!=(int32u)-1 && Descriptors.begin()->second.BlockAlign && Descriptors.begin()->second.BlockAlign!=(int16u)-1 && Descriptors.begin()->second.SampleRate) { float64 BytesPerFrame=((float64)Descriptors.begin()->second.ByteRate)/Descriptors.begin()->second.SampleRate; int64u FramesAlreadyParsed=float64_int64s(((float64)(File_Offset+Buffer_Offset-Buffer_Begin))/BytesPerFrame); Element_Size=float64_int64s(Descriptors.begin()->second.ByteRate/Descriptors.begin()->second.SampleRate*(FramesAlreadyParsed+1)); Element_Size/=Descriptors.begin()->second.BlockAlign; Element_Size*=Descriptors.begin()->second.BlockAlign; Element_Size-=File_Offset+Buffer_Offset-Buffer_Begin; if (Config->File_IsGrowing && Element_Size && File_Offset+Buffer_Offset+Element_Size>Buffer_End) return false; //Waiting for more data while (Element_Size && File_Offset+Buffer_Offset+Element_Size>Buffer_End) Element_Size-=Descriptors.begin()->second.BlockAlign; if (Element_Size==0) Element_Size=Buffer_End-(File_Offset+Buffer_Offset); if (Buffer_Offset+Element_Size>Buffer_Size) return false; } else if (Demux_UnpacketizeContainer && !IndexTables.empty() && IndexTables[0].EditUnitByteCount) { //Calculating the byte count not included in seek information (partition, index...) int64u StreamOffset_Offset; if (!Partitions.empty()) { while (Partitions_Pos=StreamOffset_Offset+Buffer_Header_Size+Position+IndexTables[Pos].IndexDuration*IndexTables[Pos].EditUnitByteCount) //Considering IndexDuration==0 as unlimited Position+=IndexTables[Pos].EditUnitByteCount*IndexTables[Pos].IndexDuration; else { Element_Size=IndexTables[Pos].EditUnitByteCount; if (File_Offset+Buffer_Offset+Element_Size>Buffer_End) { Element_Size=Buffer_End-(File_Offset+Buffer_Offset); break; //There is a problem } if (Buffer_Offset+Element_Size>Buffer_Size) { //Hints if (File_Buffer_Size_Hint_Pointer) { size_t Buffer_Size_Target=(size_t)(Buffer_Offset+Element_Size-Buffer_Size+24); //+24 for next packet header if ((*File_Buffer_Size_Hint_Pointer)Buffer_Size) Element_Size=Buffer_Size-Buffer_Offset; //There is a problem } else if (Demux_UnpacketizeContainer && !IndexTables.empty() && !IndexTables[0].Entries.empty()) { //Calculating the byte count not included in seek information (partition, index...) int64u StreamOffset_Offset; if (!Partitions.empty()) { while (Partitions_Pos=IndexTables[Pos].Entries[0].StreamOffset+(IndexTables[Pos].IndexStartPosition)*SDTI_SizePerFrame && (Pos+1>=IndexTables.size() || StreamOffsetEntry_StreamOffset || Entry_StreamOffset>Entry1_StreamOffset) break; //Problem if (StreamOffset>=Entry_StreamOffset && StreamOffsetBuffer_End) { Element_Size=Buffer_End-(File_Offset+Buffer_Offset); break; //There is a problem } if (Buffer_Offset+Element_Size>Buffer_Size) { //Hints if (File_Buffer_Size_Hint_Pointer) { size_t Buffer_Size_Target=(size_t)(Buffer_Offset+Element_Size-Buffer_Size+24); //+24 for next packet header if ((*File_Buffer_Size_Hint_Pointer)=Buffer_Size) return false; #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) return false; #endif //MEDIAINFO_DEMUX } return true; } //--------------------------------------------------------------------------- void File_Mxf::Header_Parse() { //Parsing int64u Length; Get_UL(Code, "Code", NULL); Get_BER(Length, "Length"); if (Element_IsWaitingForMoreData()) return; if (Length==0 && ((int32u)Code.hi)==Elements::GenericContainer_Aaf2 && (((int32u)(Code.lo>>32))==Elements::GenericContainer_Aaf3 || ((int32u)(Code.lo>>32))==Elements::GenericContainer_Avid3) && Retrieve(Stream_General, 0, General_Format_Settings).find(__T(" / Incomplete"))!=string::npos ) { if (Buffer_Offset+Element_Offset+4>Buffer_Size) { Element_WaitForMoreData(); return; } if (BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset)!=0x060E2B34) { Buffer_End_Unlimited=true; Length=File_Size-(File_Offset+Buffer_Offset+Element_Offset); } } if (Config->File_IsGrowing && File_Offset+Buffer_Offset+Element_Offset+Length>File_Size) { Element_WaitForMoreData(); return; } if (Length==0 && Essences.empty() && Retrieve(Stream_General, 0, General_Format_Settings).find(__T(" / Incomplete"))!=string::npos) { if (Buffer_Offset+Element_Offset+4>Buffer_Size) { Element_WaitForMoreData(); return; } if (BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset)!=0x060E2B34) { Buffer_End_Unlimited=true; Length=File_Size-(File_Offset+Buffer_Offset+Element_Offset); } } if (Config->File_IsGrowing && File_Offset+Buffer_Offset+Element_Offset+Length>File_Size) { Element_WaitForMoreData(); return; } //Filling int32u Code_Compare1=Code.hi>>32; int32u Code_Compare2=(int32u)Code.hi; int32u Code_Compare3=Code.lo>>32; int32u Code_Compare4=(int32u)Code.lo; if (Partitions_IsCalculatingHeaderByteCount) { if (!(Code_Compare1==Elements::Filler011 && (Code_Compare2&0xFFFFFF00)==(Elements::Filler012&0xFFFFFF00) && Code_Compare3==Elements::Filler013)) { Partitions_IsCalculatingHeaderByteCount=false; if (Partitions_PosNextPacket_Get() && Config->Event_CallBackFunction_IsSet()) { if (Locators.empty()) { Config->Demux_EventWasSent=true; //First set is to indicate the user that header is parsed return; } } } #endif //MEDIAINFO_NEXTPACKET && MEDIAINFO_DEMUX #if MEDIAINFO_DEMUX || MEDIAINFO_SEEK if (IsParsingEnd && PartitionPack_Parsed && !Partitions.empty() && Partitions[Partitions.size()-1].StreamOffset+Partitions[Partitions.size()-1].PartitionPackByteCount+Partitions[Partitions.size()-1].HeaderByteCount+Partitions[Partitions.size()-1].IndexByteCount==File_Offset+Buffer_Offset && !(Code_Compare1==Elements::RandomIndexMetadata1 && Code_Compare2==Elements::RandomIndexMetadata2 && Code_Compare3==Elements::RandomIndexMetadata3 && Code_Compare4==Elements::RandomIndexMetadata4)) { if (RandomIndexMetadatas.empty()) { if (!RandomIndexMetadatas_AlreadyParsed) { Partitions_Pos=0; while (Partitions_Pos(size_t)-1 || Buffer_Offset+(size_t)(Element_Offset+Length)>Buffer_Size) //Not complete { #if MEDIAINFO_DEMUX || MEDIAINFO_SEEK if (Length>File_Size/2) //Divided by 2 for testing if this is a big chunk = Clip based and not frames. { //Calculating the byte count not included in seek information (partition, index...) int64u StreamOffset_Offset; if (!Partitions.empty()) { while (Partitions_Pos>32; int32u Code_Compare2=(int32u)Code.hi; int32u Code_Compare3=Code.lo>>32; int32u Code_Compare4=(int32u)Code.lo; #undef ELEMENT #define ELEMENT(_ELEMENT, _NAME) \ else if (Code_Compare1==Elements::_ELEMENT##1 \ && Code_Compare2==Elements::_ELEMENT##2 \ && Code_Compare3==Elements::_ELEMENT##3 \ && Code_Compare4==Elements::_ELEMENT##4) \ { \ if (!Element_IsComplete_Get()) \ { \ if (Buffer_End==0) \ { \ Element_WaitForMoreData(); \ return; \ } \ Skip_XX(Element_Size, "Data"); \ } \ Element_Name(_NAME); \ switch (Code_Compare2>>24) \ { \ case 0x01 : _ELEMENT(); break; \ case 0x02 : switch ((int8u)(Code_Compare2>>16)) \ { \ case 0x05 : _ELEMENT(); break; \ case 0x43 : _ELEMENT(); break; \ case 0x53 : \ while(Element_Offsetsecond.StreamKind==Stream_Audio) { //Configuring bitrate is not available in descriptor if (Descriptors.begin()->second.ByteRate==(int32u)-1 && Descriptors.begin()->second.Infos.find("SamplingRate")!=Descriptors.begin()->second.Infos.end()) { int32u SamplingRate=Descriptors.begin()->second.Infos["SamplingRate"].To_int32u(); if (Descriptors.begin()->second.BlockAlign!=(int16u)-1) Descriptors.begin()->second.ByteRate=SamplingRate*Descriptors.begin()->second.BlockAlign; else if (Descriptors.begin()->second.QuantizationBits!=(int8u)-1) Descriptors.begin()->second.ByteRate=SamplingRate*Descriptors.begin()->second.QuantizationBits/8; } //Configuring EditRate if needed (e.g. audio at 48000 Hz) if (Demux_Rate) //From elsewhere { Descriptors.begin()->second.SampleRate=Demux_Rate; } else if (Descriptors.begin()->second.SampleRate>1000) { Descriptors.begin()->second.SampleRate=25; //Default value } } Essences_FirstEssence_Parsed=true; } #endif //MEDIAINFO_DEMUX || MEDIAINFO_SEEK if (IsParsingEnd) { //We have the necessary for indexes, jumping to next index Skip_XX(Element_Size, "Data"); if (RandomIndexMetadatas.empty()) { if (!RandomIndexMetadatas_AlreadyParsed) { Partitions_Pos=0; while (Partitions_Possecond.Parsers.empty()) { //Format_Settings_Wrapping if (Descriptors.size()==1 && (Descriptors.begin()->second.Infos.find("Format_Settings_Wrapping")==Descriptors.begin()->second.Infos.end() || Descriptors.begin()->second.Infos["Format_Settings_Wrapping"].empty()) && (Buffer_End?(Buffer_End-Buffer_Begin):Element_Size)>File_Size/2) //Divided by 2 for testing if this is a big chunk = Clip based and not frames. Descriptors.begin()->second.Infos["Format_Settings_Wrapping"]=__T("Clip"); //By default, not sure about it, should be from descriptor //Searching the corresponding Track (for TrackID) if (!Essence->second.TrackID_WasLookedFor) { for (tracks::iterator Track=Tracks.begin(); Track!=Tracks.end(); ++Track) if (Track->second.TrackNumber==Code_Compare4) Essence->second.TrackID=Track->second.TrackID; #if MEDIAINFO_DEMUX || MEDIAINFO_SEEK if (Essence->second.TrackID==(int32u)-1 && !Duration_Detected && !Config->File_IsDetectingDuration_Get()) { DetectDuration(); //In one file (*-009.mxf), the TrackNumber is known only at the end of the file (Open and incomplete header/footer) for (tracks::iterator Track=Tracks.begin(); Track!=Tracks.end(); ++Track) if (Track->second.TrackNumber==Code_Compare4) Essence->second.TrackID=Track->second.TrackID; } #endif //MEDIAINFO_DEMUX || MEDIAINFO_SEEK Essence->second.TrackID_WasLookedFor=true; } //Searching the corresponding Descriptor for (descriptors::iterator Descriptor=Descriptors.begin(); Descriptor!=Descriptors.end(); ++Descriptor) if (Descriptors.size()==1 || (Descriptor->second.LinkedTrackID==Essence->second.TrackID && Descriptor->second.LinkedTrackID!=(int32u)-1)) { Essence->second.StreamPos_Initial=Essence->second.StreamPos=Code_Compare4&0x000000FF; if ((Code_Compare4&0x000000FF)==0x00000000) StreamPos_StartAtOne=false; if (Descriptor->second.StreamKind==Stream_Audio && Descriptor->second.Infos.find("Format_Settings_Endianness")==Descriptor->second.Infos.end()) { Ztring Format; Format.From_Local(Mxf_EssenceCompression(Descriptor->second.EssenceCompression)); if (Format.empty()) Format.From_Local(Mxf_EssenceContainer(Descriptor->second.EssenceContainer)); if (Format.find(__T("PCM"))==0) Descriptor->second.Infos["Format_Settings_Endianness"]=__T("Little"); } ChooseParser(Essence, Descriptor); //Searching by the descriptor if (Essence->second.Parsers.empty()) ChooseParser__FromEssence(Essence, Descriptor); //Searching by the track identifier #ifdef MEDIAINFO_VC3_YES if (Ztring().From_Local(Mxf_EssenceContainer(Descriptor->second.EssenceContainer))==__T("VC-3")) ((File_Vc3*)(*(Essence->second.Parsers.begin())))->FrameRate=Descriptor->second.Infos["FrameRate"].To_float32(); #endif //MEDIAINFO_VC3_YES break; } //Searching by the track identifier if (Essence->second.Parsers.empty()) ChooseParser__FromEssence(Essence, Descriptors.end()); //Demux #if MEDIAINFO_DEMUX //Configuration if (!IsSub) //Updating for MXF only if MXF is not embedded in another container { Essence->second.Frame_Count_NotParsedIncluded=Frame_Count_NotParsedIncluded; Essence->second.FrameInfo.DTS=FrameInfo.DTS; if (!Tracks.empty() && Tracks.begin()->second.EditRate) //TODO: use the corresponding track instead of the first one Essence->second.FrameInfo.DUR=float64_int64s(1000000000/Tracks.begin()->second.EditRate); else if (!IndexTables.empty() && IndexTables[0].IndexEditRate) Essence->second.FrameInfo.DUR=float64_int64s(1000000000/IndexTables[0].IndexEditRate); #if MEDIAINFO_DEMUX if (Buffer_End && Demux_UnpacketizeContainer && Essences.size()==1 && !Essences.begin()->second.Parsers.empty() && !(*(Essences.begin()->second.Parsers.begin()))->Demux_UnpacketizeContainer) for (parsers::iterator Parser=Essence->second.Parsers.begin(); Parser!=Essence->second.Parsers.end(); ++Parser) { (*Parser)->Demux_Level=2; //Container (*Parser)->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX } if (Essence->second.TrackID!=(int32u)-1) Element_Code=Essence->second.TrackID; else Element_Code=Code.lo; #endif //MEDIAINFO_DEMUX Element_Code=Essence->second.TrackID; for (parsers::iterator Parser=Essence->second.Parsers.begin(); Parser!=Essence->second.Parsers.end(); ++Parser) { Open_Buffer_Init(*Parser); if ((*Parser)->Status[IsFinished]) if (Streams_Count>0) Streams_Count--; } //Stream size is sometime easy to find if ((Buffer_End?(Buffer_End-Buffer_Begin):Element_Size)>=File_Size*0.98) //let imagine: if element size is 98% of file size, this is the only one element in the file Essence->second.Stream_Size=Buffer_End?(Buffer_End-Buffer_Begin):Element_Size; //Compute stream bit rate if there is only one stream int64u Stream_Size; if (Essence->second.Stream_Size!=(int64u)-1) Stream_Size=Essence->second.Stream_Size; else Stream_Size=File_Size; //TODO: find a way to remove header/footer correctly if (Stream_Size!=(int64u)-1) { if (Descriptors.size()==1 && Descriptors.begin()->second.ByteRate!=(int32u)-1) for (parsers::iterator Parser=Essence->second.Parsers.begin(); Parser!=Essence->second.Parsers.end(); ++Parser) (*Parser)->Stream_BitRateFromContainer=Descriptors.begin()->second.ByteRate*8; else if (Descriptors.size()==1 && Descriptors.begin()->second.Infos["Duration"].To_float64()) for (parsers::iterator Parser=Essences.begin()->second.Parsers.begin(); Parser!=Essences.begin()->second.Parsers.end(); ++Parser) (*Parser)->Stream_BitRateFromContainer=((float64)Stream_Size)*8/(Descriptors.begin()->second.Infos["Duration"].To_float64()/1000); } } //Frame info is specific to the container, and it is not updated frame_info FrameInfo_Temp=FrameInfo; int64u Frame_Count_NotParsedIncluded_Temp=Frame_Count_NotParsedIncluded; if (!IsSub) //Updating for MXF only if MXF is not embedded in another container { FrameInfo=frame_info(); Frame_Count_NotParsedIncluded=(int64u)-1; } //Demux #if MEDIAINFO_DEMUX if (Essence->second.TrackID!=(int32u)-1) Element_Code=Essence->second.TrackID; else Element_Code=Code.lo; Demux_Level=(!Essence->second.Parsers.empty() && ((*(Essence->second.Parsers.begin()))->Demux_UnpacketizeContainer || (*(Essence->second.Parsers.begin()))->Demux_Level==2))?4:2; //Intermediate (D-10 Audio) / Container if (!IsSub) //Updating for MXF only if MXF is not embedded in another container { FrameInfo=Essence->second.FrameInfo; Frame_Count_NotParsedIncluded=Essence->second.Frame_Count_NotParsedIncluded; } Demux_random_access=true; Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream); #endif //MEDIAINFO_DEMUX if (!Essence->second.Parsers.empty() && !(*(Essence->second.Parsers.begin()))->Status[IsFinished]) { if ((Code_Compare4&0xFF00FF00)==0x17000100 || (Code_Compare4&0xFF00FF00)==0x17000200) { if (Element_Size) { parsers::iterator Parser=Essence->second.Parsers.begin(); //Ancillary with int16u Count; Get_B2 (Count, "Number of Lines"); if (Count*14>Element_Size) { (*Parser)->Finish(); Skip_XX(Element_Size-2, "Unknown"); Count=0; } for (int16u Pos=0; Possecond.Frame_Count_NotParsedIncluded!=(int64u)-1) (*Parser)->Frame_Count_NotParsedIncluded=Essence->second.Frame_Count_NotParsedIncluded; if (Essence->second.FrameInfo.DTS!=(int64u)-1) (*Parser)->FrameInfo.DTS=Essence->second.FrameInfo.DTS; if (Essence->second.FrameInfo.PTS!=(int64u)-1) (*Parser)->FrameInfo.PTS=Essence->second.FrameInfo.PTS; if (Essence->second.FrameInfo.DUR!=(int64u)-1) (*Parser)->FrameInfo.DUR=Essence->second.FrameInfo.DUR; if ((*Parser)->ParserName==__T("Ancillary")) ((File_Ancillary*)(*Parser))->LineNumber=LineNumber; if ((*Parser)->ParserName==__T("Ancillary") && (((File_Ancillary*)(*Parser))->FrameRate==0 || ((File_Ancillary*)(*Parser))->AspectRatio==0)) { //Configuring with video info for (descriptors::iterator Descriptor=Descriptors.begin(); Descriptor!=Descriptors.end(); ++Descriptor) if (Descriptor->second.StreamKind==Stream_Video) { ((File_Ancillary*)(*Parser))->HasBFrames=Descriptor->second.HasBFrames; ((File_Ancillary*)(*Parser))->AspectRatio=Descriptor->second.DisplayAspectRatio; ((File_Ancillary*)(*Parser))->FrameRate=Descriptor->second.SampleRate; break; } } if (Element_Offset+Size>Element_Size) Size=(int16u)(Element_Size-Element_Offset); Open_Buffer_Continue((*Parser), Buffer+Buffer_Offset+(size_t)(Element_Offset), Size); if ((Code_Compare4&0xFF00FF00)==0x17000100 && LineNumber==21 && (*Parser)->Count_Get(Stream_Text)==0) { (*Parser)->Accept(); (*Parser)->Stream_Prepare(Stream_Text); (*Parser)->Fill(Stream_Text, StreamPos_Last, Text_Format, "EIA-608"); (*Parser)->Fill(Stream_Text, StreamPos_Last, Text_MuxingMode, "VBI / Line 21"); } Element_Offset+=Size; if (Sizesecond.Parsers.size(); Pos++) { //Parsing if (Essence->second.Frame_Count_NotParsedIncluded!=(int64u)-1) Essence->second.Parsers[Pos]->Frame_Count_NotParsedIncluded=Essence->second.Frame_Count_NotParsedIncluded; if (Essence->second.FrameInfo.DTS!=(int64u)-1) Essence->second.Parsers[Pos]->FrameInfo.DTS=Essence->second.FrameInfo.DTS; if (Essence->second.FrameInfo.PTS!=(int64u)-1) Essence->second.Parsers[Pos]->FrameInfo.PTS=Essence->second.FrameInfo.PTS; if (Essence->second.FrameInfo.DUR!=(int64u)-1) Essence->second.Parsers[Pos]->FrameInfo.DUR=Essence->second.FrameInfo.DUR; Open_Buffer_Continue(Essence->second.Parsers[Pos], Buffer+Buffer_Offset, (size_t)Element_Size); //Multiple parsers if (Essence->second.Parsers.size()>1) { if (!Essence->second.Parsers[Pos]->Status[IsAccepted] && Essence->second.Parsers[Pos]->Status[IsFinished]) { delete *(Essence->second.Parsers.begin()+Pos); Essence->second.Parsers.erase(Essence->second.Parsers.begin()+Pos); Pos--; } else if (Essence->second.Parsers.size()>1 && Essence->second.Parsers[Pos]->Status[IsAccepted]) { File__Analyze* Parser=Essence->second.Parsers[Pos]; for (size_t Pos2=0; Pos2second.Parsers.size(); Pos2++) { if (Pos2!=Pos) delete *(Essence->second.Parsers.begin()+Pos2); } Essence->second.Parsers.clear(); Essence->second.Parsers.push_back(Parser); } } } Element_Offset=Element_Size; } if (Buffer_End) { Essence->second.Frame_Count_NotParsedIncluded=(int64u)-1; Essence->second.FrameInfo=frame_info(); } else { if (Essence->second.Frame_Count_NotParsedIncluded!=(int64u)-1) Essence->second.Frame_Count_NotParsedIncluded++; if (Essence->second.FrameInfo.DTS!=(int64u)-1 && Essence->second.FrameInfo.DUR!=(int64u)-1) Essence->second.FrameInfo.DTS+=Essence->second.FrameInfo.DUR; if (Essence->second.FrameInfo.PTS!=(int64u)-1 && Essence->second.FrameInfo.DUR!=(int64u)-1) Essence->second.FrameInfo.PTS+=Essence->second.FrameInfo.DUR; } //Disabling this Streams if (!Essence->second.IsFilled && Essence->second.Parsers.size()==1 && Essence->second.Parsers[0]->Status[IsFilled]) { if (Streams_Count>0) Streams_Count--; Essence->second.IsFilled=true; if (Config->ParseSpeed<1.0 && IsSub) { Fill(); Open_Buffer_Unsynch(); Finish(); } } } else Skip_XX(Element_Size, "Data"); //Frame info is specific to the container, and it is not updated FrameInfo=FrameInfo_Temp; Frame_Count_NotParsedIncluded=Frame_Count_NotParsedIncluded_Temp; } else Skip_XX(Element_Size, "Unknown"); if (Buffer_End && File_Offset+Buffer_Offset+Element_Size>=Buffer_End) { Buffer_Begin=(int64u)-1; Buffer_End=0; Buffer_End_Unlimited=false; Buffer_Header_Size=0; MustSynchronize=true; } if ((!IsParsingEnd && IsParsingMiddle_MaxOffset==(int64u)-1 && MediaInfoLib::Config.ParseSpeed_Get()<1.0) && ((!IsSub && File_Offset>=0x4000000) //TODO: 64 MB by default (security), should be changed || (Streams_Count==0 && !Descriptors.empty()))) { Fill(); IsParsingEnd=true; if (PartitionMetadata_FooterPartition!=(int64u)-1) { GoTo(PartitionMetadata_FooterPartition); IsCheckingFooterPartitionAddress=true; } else { GoToFromEnd(4); //For random access table FooterPartitionAddress_Jumped=true; } Open_Buffer_Unsynch(); } } //*************************************************************************** // Elements //*************************************************************************** #undef ELEMENT #define ELEMENT(_CODE, _CALL, _NAME) \ case 0x##_CODE : Element_Name(_NAME); _CALL(); break; \ #define ELEMENT_UUID(_ELEMENT, _NAME) \ else if (Code_Compare1==Elements::_ELEMENT##1 \ && Code_Compare2==Elements::_ELEMENT##2 \ && Code_Compare3==Elements::_ELEMENT##3 \ && Code_Compare4==Elements::_ELEMENT##4) \ { \ Element_Name(_NAME); \ _ELEMENT(); \ } //--------------------------------------------------------------------------- void File_Mxf::AES3PCMDescriptor() { Descriptors[InstanceUID].IsAes3Descriptor=true; switch(Code2) { ELEMENT(3D08, AES3PCMDescriptor_AuxBitsMode, "Use of Auxiliary Bits") ELEMENT(3D0D, AES3PCMDescriptor_Emphasis, "Emphasis") ELEMENT(3D0F, AES3PCMDescriptor_BlockStartOffset, "Position of first Z preamble in essence stream") ELEMENT(3D10, AES3PCMDescriptor_ChannelStatusMode, "Enumerated mode of carriage of channel status data") ELEMENT(3D11, AES3PCMDescriptor_FixedChannelStatusData, "Fixed data pattern for channel status data") ELEMENT(3D12, AES3PCMDescriptor_UserDataMode, "Mode of carriage of user data") ELEMENT(3D13, AES3PCMDescriptor_FixedUserData, "Fixed data pattern for user data") default: WaveAudioDescriptor(); } } //--------------------------------------------------------------------------- void File_Mxf::CDCIEssenceDescriptor() { switch(Code2) { ELEMENT(3301, CDCIEssenceDescriptor_ComponentDepth, "Active bits per sample") ELEMENT(3302, CDCIEssenceDescriptor_HorizontalSubsampling, "Horizontal colour subsampling") ELEMENT(3303, CDCIEssenceDescriptor_ColorSiting, "Color siting") ELEMENT(3304, CDCIEssenceDescriptor_BlackRefLevel, "Black refernece level") ELEMENT(3305, CDCIEssenceDescriptor_WhiteReflevel, "White reference level") ELEMENT(3306, CDCIEssenceDescriptor_ColorRange, "Color range") ELEMENT(3307, CDCIEssenceDescriptor_PaddingBits, "Bits to round up each pixel to stored size") ELEMENT(3308, CDCIEssenceDescriptor_VerticalSubsampling,"Vertical colour subsampling") ELEMENT(3309, CDCIEssenceDescriptor_AlphaSampleDepth, "Bits per alpha sample") ELEMENT(330B, CDCIEssenceDescriptor_ReversedByteOrder, "Luma followed by Chroma") default: GenericPictureEssenceDescriptor(); } if (Descriptors[InstanceUID].Infos["ColorSpace"].empty()) Descriptors[InstanceUID].Infos["ColorSpace"]="YUV"; } //--------------------------------------------------------------------------- void File_Mxf::OpenIncompleteHeaderPartition() { //Parsing PartitionMetadata(); } //--------------------------------------------------------------------------- void File_Mxf::ClosedIncompleteHeaderPartition() { //Parsing PartitionMetadata(); } //--------------------------------------------------------------------------- void File_Mxf::OpenCompleteHeaderPartition() { //Parsing PartitionMetadata(); } //--------------------------------------------------------------------------- void File_Mxf::ClosedCompleteHeaderPartition() { //Parsing PartitionMetadata(); } //--------------------------------------------------------------------------- void File_Mxf::OpenIncompleteBodyPartition() { //Parsing PartitionMetadata(); #if MEDIAINFO_NEXTPACKET && MEDIAINFO_DEMUX if (!Demux_HeaderParsed) { Demux_HeaderParsed=true; //Testing locators Locators_CleanUp(); if (Config->NextPacket_Get() && Config->Event_CallBackFunction_IsSet()) { if (Locators.empty()) { Config->Demux_EventWasSent=true; //First set is to indicate the user that header is parsed return; } } } #endif //MEDIAINFO_NEXTPACKET && MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- void File_Mxf::ClosedIncompleteBodyPartition() { //Parsing PartitionMetadata(); #if MEDIAINFO_NEXTPACKET && MEDIAINFO_DEMUX if (!Demux_HeaderParsed) { Demux_HeaderParsed=true; //Testing locators Locators_CleanUp(); if (Config->NextPacket_Get() && Config->Event_CallBackFunction_IsSet()) { if (Locators.empty()) { Config->Demux_EventWasSent=true; //First set is to indicate the user that header is parsed return; } } } #endif //MEDIAINFO_NEXTPACKET && MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- void File_Mxf::OpenCompleteBodyPartition() { //Parsing PartitionMetadata(); #if MEDIAINFO_NEXTPACKET && MEDIAINFO_DEMUX if (!Demux_HeaderParsed) { Demux_HeaderParsed=true; //Testing locators Locators_CleanUp(); if (Config->NextPacket_Get() && Config->Event_CallBackFunction_IsSet()) { if (Locators.empty()) { Config->Demux_EventWasSent=true; //First set is to indicate the user that header is parsed return; } } } #endif //MEDIAINFO_NEXTPACKET && MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- void File_Mxf::ClosedCompleteBodyPartition() { //Parsing PartitionMetadata(); #if MEDIAINFO_NEXTPACKET && MEDIAINFO_DEMUX if (!Demux_HeaderParsed) { Demux_HeaderParsed=true; //Testing locators Locators_CleanUp(); if (Config->NextPacket_Get() && Config->Event_CallBackFunction_IsSet()) { if (Locators.empty()) { Config->Demux_EventWasSent=true; //First set is to indicate the user that header is parsed return; } } } #endif //MEDIAINFO_NEXTPACKET && MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- void File_Mxf::OpenIncompleteFooterPartition() { //Parsing PartitionMetadata(); } //--------------------------------------------------------------------------- void File_Mxf::ClosedIncompleteFooterPartition() { //Parsing PartitionMetadata(); } //--------------------------------------------------------------------------- void File_Mxf::OpenCompleteFooterPartition() { //Parsing PartitionMetadata(); } //--------------------------------------------------------------------------- void File_Mxf::ClosedCompleteFooterPartition() { //Parsing PartitionMetadata(); } //--------------------------------------------------------------------------- void File_Mxf::ContentStorage() { switch(Code2) { ELEMENT(1901, ContentStorage_Packages, "Packages") ELEMENT(1902, ContentStorage_EssenceContainerData, "EssenceContainerData") default: GenerationInterchangeObject(); } if (Code2==0x3C0A && InstanceUID==Prefaces[Preface_Current].ContentStorage) //InstanceIUD { Element_Level--; Element_Info1("Valid from Preface"); Element_Level++; } } //--------------------------------------------------------------------------- void File_Mxf::DMSegment() { switch(Code2) { ELEMENT(6101, DMSegment_DMFramework, "DM Framework") ELEMENT(6102, DMSegment_TrackIDs, "Track IDs") default: StructuralComponent(); } } //--------------------------------------------------------------------------- void File_Mxf::EssenceContainerData() { switch(Code2) { ELEMENT(2701, EssenceContainerData_LinkedPackageUID, "LinkedPackageUID") ELEMENT(3F06, EssenceContainerData_IndexSID, "IndexSID") ELEMENT(3F07, EssenceContainerData_BodySID, "BodySID") default: GenerationInterchangeObject(); } } //--------------------------------------------------------------------------- void File_Mxf::EventTrack() { switch(Code2) { ELEMENT(4901, EventTrack_EventEditRate, "Edit Rate of Event Track") ELEMENT(4902, EventTrack_EventOrigin, "Offset used to resolved timeline references to this event track") default: GenericTrack(); } } //--------------------------------------------------------------------------- void File_Mxf::FileDescriptor() { switch(Code2) { ELEMENT(3001, FileDescriptor_SampleRate, "SampleRate") ELEMENT(3002, FileDescriptor_ContainerDuration, "ContainerDuration") ELEMENT(3004, FileDescriptor_EssenceContainer, "EssenceContainer") ELEMENT(3005, FileDescriptor_Codec, "Codec") ELEMENT(3006, FileDescriptor_LinkedTrackID, "LinkedTrackID") default: GenericDescriptor(); } } //--------------------------------------------------------------------------- void File_Mxf::Identification() { switch(Code2) { ELEMENT(3C01, Identification_CompanyName, "CompanyName") ELEMENT(3C02, Identification_ProductName, "ProductName") ELEMENT(3C03, Identification_ProductVersion, "ProductVersion") ELEMENT(3C04, Identification_VersionString, "VersionString") ELEMENT(3C05, Identification_ProductUID, "ProductUID") ELEMENT(3C06, Identification_ModificationDate , "ModificationDate ") ELEMENT(3C07, Identification_ToolkitVersion, "ToolkitVersion") ELEMENT(3C08, Identification_Platform, "Platform") ELEMENT(3C09, Identification_ThisGenerationUID, "ThisGenerationUID") default: InterchangeObject(); } } //--------------------------------------------------------------------------- void File_Mxf::IndexTableSegment() { if (Element_Offset==4) { #if MEDIAINFO_DEMUX || MEDIAINFO_SEEK //Testing if already parsed for (size_t Pos=0; Possecond.Packages.size(); Pos++) if (InstanceUID==ContentStorage->second.Packages[Pos]) { Element_Level--; Element_Info1("Valid from Content storage"); Element_Level++; } } } } //--------------------------------------------------------------------------- void File_Mxf::MPEG2VideoDescriptor() { Descriptors[InstanceUID].HasMPEG2VideoDescriptor=true; std::map::iterator Primer_Value=Primer_Values.find(Code2); if (Primer_Value==Primer_Values.end()) //if not a standard code or unknown user defined code { CDCIEssenceDescriptor(); return; } int32u Code_Compare1=Primer_Value->second.hi>>32; int32u Code_Compare2=(int32u)Primer_Value->second.hi; int32u Code_Compare3=Primer_Value->second.lo>>32; int32u Code_Compare4=(int32u)Primer_Value->second.lo; if(0); ELEMENT_UUID(MPEG2VideoDescriptor_SingleSequence, "Single sequence") ELEMENT_UUID(MPEG2VideoDescriptor_ConstantBFrames, "Number of B frames always constant") ELEMENT_UUID(MPEG2VideoDescriptor_CodedContentType, "Coded content type") ELEMENT_UUID(MPEG2VideoDescriptor_LowDelay, "Low delay") ELEMENT_UUID(MPEG2VideoDescriptor_ClosedGOP, "Closed GOP") ELEMENT_UUID(MPEG2VideoDescriptor_IdenticalGOP, "Identical GOP") ELEMENT_UUID(MPEG2VideoDescriptor_MaxGOP, "Maximum occurring spacing between I frames") ELEMENT_UUID(MPEG2VideoDescriptor_BPictureCount, "Maximum number of B pictures between P or I frames") ELEMENT_UUID(MPEG2VideoDescriptor_ProfileAndLevel, "Profile and level") ELEMENT_UUID(MPEG2VideoDescriptor_BitRate, "Maximum bit rate") } //--------------------------------------------------------------------------- void File_Mxf::MultipleDescriptor() { switch(Code2) { ELEMENT(3F01, MultipleDescriptor_SubDescriptorUIDs, "SubDescriptorUIDs") default: FileDescriptor(); } } //--------------------------------------------------------------------------- void File_Mxf::NetworkLocator() { switch(Code2) { ELEMENT(4001, NetworkLocator_URLString, "A URL indicating where the essence may be found.") default: GenerationInterchangeObject(); } if (Code2==0x3C0A) { for (descriptors::iterator Descriptor=Descriptors.begin(); Descriptor!=Descriptors.end(); ++Descriptor) { for (size_t Pos=0; Possecond.Locators.size(); Pos++) if (InstanceUID==Descriptor->second.Locators[Pos]) { Element_Level--; Element_Info1("Valid from Descriptor"); Element_Level++; } } } } //--------------------------------------------------------------------------- void File_Mxf::Preface() { switch(Code2) { ELEMENT(3B02, Preface_LastModifiedDate, "LastModifiedDate") ELEMENT(3B03, Preface_ContentStorage, "ContentStorage") ELEMENT(3B05, Preface_Version, "Version") ELEMENT(3B06, Preface_Identifications, "Identifications") ELEMENT(3B07, Preface_ObjectModelVersion, "ObjectModelVersion") ELEMENT(3B08, Preface_PrimaryPackage, "PrimaryPackage") ELEMENT(3B09, Preface_OperationalPattern, "OperationalPattern") ELEMENT(3B0A, Preface_EssenceContainers, "EssenceContainers") ELEMENT(3B0B, Preface_DMSchemes, "DMSchemes") default: GenerationInterchangeObject(); } if (Code2==0x3C0A) //InstanceIUD { Preface_Current=InstanceUID; } } //--------------------------------------------------------------------------- void File_Mxf::Primer() { //Parsing //Vector int32u Count, Length; Get_B4 (Count, "Count"); Get_B4 (Length, "Length"); for (int32u Pos=0; Pos=0x8000) //user defined Primer_Values[LocalTag]=UID; FILLING_END(); } } //--------------------------------------------------------------------------- void File_Mxf::RGBAEssenceDescriptor() { if (Code2>0x8000) { std::map::iterator Primer_Value=Primer_Values.find(Code2); if (Primer_Value==Primer_Values.end()) //if not a standard code or unknown user defined code { GenericPictureEssenceDescriptor(); return; } int32u Code_Compare1=Primer_Value->second.hi>>32; int32u Code_Compare2=(int32u)Primer_Value->second.hi; int32u Code_Compare3=Primer_Value->second.lo>>32; int32u Code_Compare4=(int32u)Primer_Value->second.lo; if(0); ELEMENT_UUID(SubDescriptors, "Sub Descriptors") return; } switch(Code2) { ELEMENT(3401, RGBAEssenceDescriptor_PixelLayout, "Pixel Layout") ELEMENT(3403, RGBAEssenceDescriptor_Palette, "Palette") ELEMENT(3404, RGBAEssenceDescriptor_PaletteLayout, "Palette Layout") ELEMENT(3405, RGBAEssenceDescriptor_ScanningDirection, "Enumerated Scanning Direction") ELEMENT(3406, RGBAEssenceDescriptor_ComponentMaxRef, "Maximum value for RGB components") ELEMENT(3407, RGBAEssenceDescriptor_ComponentMinRef, "Minimum value for RGB components") ELEMENT(3408, RGBAEssenceDescriptor_AlphaMaxRef, "Maximum value for alpha component") ELEMENT(3409, RGBAEssenceDescriptor_AlphaMinRef, "Minimum value for alpha component") default: GenericPictureEssenceDescriptor(); } if (Descriptors[InstanceUID].Infos["ColorSpace"].empty()) Descriptors[InstanceUID].Infos["ColorSpace"]="RGB"; } //--------------------------------------------------------------------------- void File_Mxf::RandomIndexMetadata() { //Parsing while (Element_Offset+4::iterator Track=Tracks.begin(); Track!=Tracks.end(); ++Track) { if (InstanceUID==Track->second.Sequence) { Element_Level--; Element_Info1("Valid from track"); Element_Level++; } } } } //--------------------------------------------------------------------------- void File_Mxf::SourceClip() { switch(Code2) { ELEMENT(1101, SourceClip_SourcePackageID, "SourcePackageID") ELEMENT(1102, SourceClip_SourceTrackID, "SourceTrackID") ELEMENT(1201, SourceClip_StartPosition, "StartPosition") default: StructuralComponent(); } } //--------------------------------------------------------------------------- void File_Mxf::SourcePackage() { switch(Code2) { //SourcePackage ELEMENT(4701, SourcePackage_Descriptor, "Descriptor") default: GenericPackage(); Packages[InstanceUID].IsSourcePackage=true; } } //--------------------------------------------------------------------------- void File_Mxf::StaticTrack() { GenericTrack(); } //--------------------------------------------------------------------------- //SMPTE 405M void File_Mxf::SystemScheme1() { switch(Code2) { ELEMENT(0102, SystemScheme1_TimeCodeArray, "TimeCode Array") default: InterchangeObject(); } } //--------------------------------------------------------------------------- //SMPTE 380M void File_Mxf::DMScheme1() { std::map::iterator Primer_Value=Primer_Values.find(Code2); if (Primer_Value==Primer_Values.end()) //if not a standard code or unknown user defined code { InterchangeObject(); return; } int32u Code_Compare1=Primer_Value->second.hi>>32; int32u Code_Compare2=(int32u)Primer_Value->second.hi; int32u Code_Compare3=Primer_Value->second.lo>>32; int32u Code_Compare4=(int32u)Primer_Value->second.lo; if(0); ELEMENT_UUID(DMScheme1_PrimaryExtendedSpokenLanguage, "Primary Extended Spoken Language") ELEMENT_UUID(DMScheme1_SecondaryExtendedSpokenLanguage, "Secondary Extended Spoken Language") ELEMENT_UUID(DMScheme1_OriginalExtendedSpokenLanguage, "Original Extended Spoken Language") } //--------------------------------------------------------------------------- void File_Mxf::StructuralComponent() { switch(Code2) { ELEMENT(0201, StructuralComponent_DataDefinition, "DataDefinition") ELEMENT(0202, StructuralComponent_Duration, "Duration") default: GenerationInterchangeObject(); } } //--------------------------------------------------------------------------- void File_Mxf::TextLocator() { switch(Code2) { ELEMENT(4101, TextLocator_LocatorName, "Human-readable locator text string for manual location of essence") default: GenerationInterchangeObject(); } } //--------------------------------------------------------------------------- void File_Mxf::StereoscopicPictureSubDescriptor() { StereoscopicPictureSubDescriptor_IsPresent=true; //switch(Code2) //{ // default: GenerationInterchangeObject(); //} } //--------------------------------------------------------------------------- void File_Mxf::TimecodeComponent() { if (Element_Offset==4) { TimeCode_StartTimecode=(int64u)-1; TimeCode_RoundedTimecodeBase=0; TimeCode_DropFrame=false; DTS_Delay=0; FrameInfo.DTS=0; } switch(Code2) { ELEMENT(1501, TimecodeComponent_StartTimecode, "StartTimecode") ELEMENT(1502, TimecodeComponent_RoundedTimecodeBase, "RoundedTimecodeBase") ELEMENT(1503, TimecodeComponent_DropFrame, "DropFrame") default: StructuralComponent(); } } //--------------------------------------------------------------------------- void File_Mxf::WaveAudioDescriptor() { switch(Code2) { ELEMENT(3D09, WaveAudioDescriptor_AvgBps, "Average Bytes per second") ELEMENT(3D0A, WaveAudioDescriptor_BlockAlign, "Sample Block alignment") ELEMENT(3D0B, WaveAudioDescriptor_SequenceOffset, "Frame number of first essence") ELEMENT(3D29, WaveAudioDescriptor_PeakEnvelopeVersion, "Peak envelope version information") ELEMENT(3D2A, WaveAudioDescriptor_PeakEnvelopeFormat, "Format of a peak point") ELEMENT(3D2B, WaveAudioDescriptor_PointsPerPeakValue, "Number of peak points per peak value") ELEMENT(3D2C, WaveAudioDescriptor_PeakEnvelopeBlockSize,"Number of audio samples used to generate each peak frame") ELEMENT(3D2D, WaveAudioDescriptor_PeakChannels, "Number of peak channels") ELEMENT(3D2E, WaveAudioDescriptor_PeakFrames, "Number of peak frames") ELEMENT(3D2F, WaveAudioDescriptor_PeakOfPeaksPosition, "Offset to the first audio sample whose absolute value is the maximum value of the entire audio file") ELEMENT(3D30, WaveAudioDescriptor_PeakEnvelopeTimestamp,"Time stamp of the creation of the peak data") ELEMENT(3D31, WaveAudioDescriptor_PeakEnvelopeData , "Peak envelope data") ELEMENT(3D32, WaveAudioDescriptor_ChannelAssignment, "Channel assignment in use") default: GenericSoundEssenceDescriptor(); } } //--------------------------------------------------------------------------- void File_Mxf::VbiPacketsDescriptor() { //switch(Code2) //{ // default: GenericDataEssenceDescriptor(); //} if (Descriptors[InstanceUID].Type==descriptor::Type_Unknown) { Descriptors[InstanceUID].Type=descriptor::Type_AncPackets; if (Streams_Count==(size_t)-1) Streams_Count=0; Streams_Count++; } } //--------------------------------------------------------------------------- void File_Mxf::AncPacketsDescriptor() { //switch(Code2) //{ // default: GenericDataEssenceDescriptor(); //} if (Descriptors[InstanceUID].Type==descriptor::Type_Unknown) { Descriptors[InstanceUID].Type=descriptor::Type_AncPackets; if (Streams_Count==(size_t)-1) Streams_Count=0; Streams_Count++; } } //--------------------------------------------------------------------------- void File_Mxf::Filler() { Skip_XX(Element_Size, "Junk"); Buffer_PaddingBytes+=Element_Size; } //--------------------------------------------------------------------------- void File_Mxf::TerminatingFiller() { Skip_XX(Element_Size, "Junk"); Buffer_PaddingBytes+=Element_Size; } //--------------------------------------------------------------------------- void File_Mxf::XmlDocumentText() { Skip_XX(Element_Size, "XML data"); } //--------------------------------------------------------------------------- void File_Mxf::SubDescriptors() { //Parsing //Vector int32u Count, Length; Get_B4 (Count, "Count"); Get_B4 (Length, "Length"); for (int32u Pos=0; Pos>16)&0xFF) { case 0x00 : Skip_Local(Length,"Data"); break; case 0x01 : Skip_UTF16L(Length,"Data"); break; default : Skip_XX(Length, "Data"); } } } break; default : Skip_XX(Length, "Unknown"); } Element_End0(); } //Filling if (SDTI_SizePerFrame==0) Partitions_IsCalculatingSdtiByteCount=true; } //--------------------------------------------------------------------------- void File_Mxf::SDTI_PictureMetadataSet() { Skip_XX(Element_Size, "Data"); //Filling if (SDTI_SizePerFrame==0) Partitions_IsCalculatingSdtiByteCount=true; } //--------------------------------------------------------------------------- void File_Mxf::SDTI_SoundMetadataSet() { Skip_XX(Element_Size, "Data"); //Filling if (SDTI_SizePerFrame==0) Partitions_IsCalculatingSdtiByteCount=true; } //--------------------------------------------------------------------------- void File_Mxf::SDTI_DataMetadataSet() { Skip_XX(Element_Size, "Data"); //Filling if (SDTI_SizePerFrame==0) Partitions_IsCalculatingSdtiByteCount=true; } //--------------------------------------------------------------------------- void File_Mxf::SDTI_ControlMetadataSet() { Skip_XX(Element_Size, "Data"); //Filling if (SDTI_SizePerFrame==0) Partitions_IsCalculatingSdtiByteCount=true; } //--------------------------------------------------------------------------- void File_Mxf::Omneon_010201010100() { //Parsing switch(Code2) { ELEMENT(8001, Omneon_010201010100_8001, "Omneon (80.01)") ELEMENT(8003, Omneon_010201010100_8003, "Omneon (80.03)") default: GenerationInterchangeObject(); } } //--------------------------------------------------------------------------- void File_Mxf::Omneon_010201020100() { //Parsing switch(Code2) { ELEMENT(8002, Omneon_010201020100_8002, "Omneon (80.02)") ELEMENT(8003, Omneon_010201020100_8003, "Omneon (80.03)") ELEMENT(8004, Omneon_010201020100_8004, "Omneon (80.04)") ELEMENT(8005, Omneon_010201020100_8005, "Omneon (80.05)") ELEMENT(8006, Omneon_010201020100_8006, "Omneon (80.06)") default: GenerationInterchangeObject(); } } //--------------------------------------------------------------------------- void File_Mxf::Track() { //Parsing switch(Code2) { ELEMENT(4B01, Track_EditRate, "EditRate") ELEMENT(4B02, Track_Origin, "Origin") default: GenericTrack(); } if (Code2==0x3C0A) { for (packages::iterator Package=Packages.begin(); Package!=Packages.end(); ++Package) { if (Package->first==Prefaces[Preface_Current].PrimaryPackage) //InstanceIUD { Element_Level--; Element_Info1("Primary package"); Element_Level++; } for (size_t Pos=0; Possecond.Tracks.size(); Pos++) if (InstanceUID==Package->second.Tracks[Pos]) { Element_Level--; Element_Info1("Valid from Package"); Element_Level++; } } } } //*************************************************************************** // Base //*************************************************************************** //--------------------------------------------------------------------------- // 0x3D08 void File_Mxf::AES3PCMDescriptor_AuxBitsMode() { //Parsing Info_B1(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x3D0D void File_Mxf::AES3PCMDescriptor_Emphasis() { //Parsing Info_B1(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x3D0F void File_Mxf::AES3PCMDescriptor_BlockStartOffset() { //Parsing Info_B2(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x3D10 void File_Mxf::AES3PCMDescriptor_ChannelStatusMode() { //Parsing Skip_XX(Length2, "Batch"); } //--------------------------------------------------------------------------- // 0x3D11 void File_Mxf::AES3PCMDescriptor_FixedChannelStatusData() { //Parsing Skip_XX(Length2, "Data"); } //--------------------------------------------------------------------------- // 0x3D12 void File_Mxf::AES3PCMDescriptor_UserDataMode() { //Parsing Skip_XX(Length2, "Data"); } //--------------------------------------------------------------------------- // 0x3D13 void File_Mxf::AES3PCMDescriptor_FixedUserData() { //Parsing Skip_XX(Length2, "Data"); } //--------------------------------------------------------------------------- // 0x3301 void File_Mxf::CDCIEssenceDescriptor_ComponentDepth() { //Parsing int32u Data; Get_B4 (Data, "Data"); Element_Info1(Data); FILLING_BEGIN(); if (Data) Descriptors[InstanceUID].Infos["BitDepth"].From_Number(Data); FILLING_END(); } //--------------------------------------------------------------------------- // 0x3302 void File_Mxf::CDCIEssenceDescriptor_HorizontalSubsampling() { //Parsing int32u Data; Get_B4 (Data, "Data"); Element_Info1(Data); FILLING_BEGIN(); Descriptors[InstanceUID].SubSampling_Horizontal=Data; Subsampling_Compute(Descriptors.find(InstanceUID)); FILLING_END(); } //--------------------------------------------------------------------------- // 0x3303 void File_Mxf::CDCIEssenceDescriptor_ColorSiting() { //Parsing Info_B1(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x3304 void File_Mxf::CDCIEssenceDescriptor_BlackRefLevel() { //Parsing Info_B4(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x3305 void File_Mxf::CDCIEssenceDescriptor_WhiteReflevel() { //Parsing Info_B4(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x3306 void File_Mxf::CDCIEssenceDescriptor_ColorRange() { //Parsing Info_B4(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x3307 void File_Mxf::CDCIEssenceDescriptor_PaddingBits() { //Parsing Info_B2(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x3308 void File_Mxf::CDCIEssenceDescriptor_VerticalSubsampling() { //Parsing int32u Data; Get_B4 (Data, "Data"); Element_Info1(Data); FILLING_BEGIN(); Descriptors[InstanceUID].SubSampling_Vertical=Data; Subsampling_Compute(Descriptors.find(InstanceUID)); FILLING_END(); } //--------------------------------------------------------------------------- // 0x3309 void File_Mxf::CDCIEssenceDescriptor_AlphaSampleDepth() { //Parsing Info_B4(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x330B void File_Mxf::CDCIEssenceDescriptor_ReversedByteOrder() { //Parsing Info_B1(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x1901 void File_Mxf::ContentStorage_Packages() { //Parsing //Vector int32u Count, Length; Get_B4 (Count, "Count"); Get_B4 (Length, "Length"); for (int32u Pos=0; Pos>16); int8u Code7=(int8u)((EssenceContainer.lo&0x000000000000FF00LL)>> 8); int8u Code8=(int8u)((EssenceContainer.lo&0x00000000000000FFLL) ); Descriptors[InstanceUID].EssenceContainer=EssenceContainer; Descriptors[InstanceUID].Infos["Format_Settings_Wrapping"].From_UTF8(Mxf_EssenceContainer_Mapping(Code6, Code7, Code8)); if (!DataMustAlwaysBeComplete && Descriptors[InstanceUID].Infos["Format_Settings_Wrapping"].find(__T("Frame"))!=string::npos) DataMustAlwaysBeComplete=true; FILLING_END(); } //--------------------------------------------------------------------------- // 0x3005 void File_Mxf::FileDescriptor_Codec() { //Parsing Skip_UL( "UUID"); } //--------------------------------------------------------------------------- // 0x3006 void File_Mxf::FileDescriptor_LinkedTrackID() { //Parsing int32u Data; Get_B4 (Data, "Data"); Element_Info1(Data); FILLING_BEGIN(); if (Descriptors[InstanceUID].LinkedTrackID==(int32u)-1) Descriptors[InstanceUID].LinkedTrackID=Data; FILLING_END(); } //--------------------------------------------------------------------------- // 0x3C0A void File_Mxf::InterchangeObject_InstanceUID() { //Parsing Get_UUID(InstanceUID, "UUID"); Element_Info1(Ztring().From_UUID(InstanceUID)); FILLING_BEGIN(); //Putting the right UID for already parsed items prefaces::iterator Preface=Prefaces.find(0); if (Preface!=Prefaces.end()) { Prefaces[InstanceUID]=Preface->second; Prefaces.erase(Preface); } identifications::iterator Identification=Identifications.find(0); if (Identification!=Identifications.end()) { Identifications[InstanceUID]=Identification->second; Identifications.erase(Identification); } contentstorages::iterator ContentStorage=ContentStorages.find(0); if (ContentStorage!=ContentStorages.end()) { ContentStorages[InstanceUID]=ContentStorage->second; ContentStorages.erase(ContentStorage); } packages::iterator Package=Packages.find(0); if (Package!=Packages.end()) { Packages[InstanceUID]=Package->second; Packages.erase(Package); } tracks::iterator Track=Tracks.find(0); if (Track!=Tracks.end()) { Tracks[InstanceUID]=Track->second; Tracks.erase(Track); } descriptors::iterator Descriptor=Descriptors.find(0); if (Descriptor!=Descriptors.end()) { descriptors::iterator Descriptor_Previous=Descriptors.find(InstanceUID); if (Descriptor_Previous!=Descriptors.end()) { //Merging Descriptor->second.Infos.insert(Descriptor_Previous->second.Infos.begin(), Descriptor_Previous->second.Infos.end()); //TODO: better implementation } Descriptors[InstanceUID]=Descriptor->second; Descriptors.erase(Descriptor); } locators::iterator Locator=Locators.find(0); if (Locator!=Locators.end()) { Locators[InstanceUID]=Locator->second; Locators.erase(Locator); } components::iterator Component=Components.find(0); if (Component!=Components.end()) { Components[InstanceUID].Update(Component->second); Components.erase(Component); } FILLING_END(); } //--------------------------------------------------------------------------- // 0x0102 void File_Mxf::GenerationInterchangeObject_GenerationUID() { //Parsing Skip_UUID( "UUID"); } //--------------------------------------------------------------------------- // 0x2F01 void File_Mxf::GenericDescriptor_Locators() { Descriptors[InstanceUID].Locators.clear(); //Parsing //Vector int32u Count, Length; Get_B4 (Count, "Count"); Get_B4 (Length, "Length"); for (int32u Pos=0; Pos>8)&0xFF) { case 0x01 : Fill(Stream_General, 0, General_Format_Settings, "Open / Incomplete" , Unlimited, true, true); if (Config->ParseSpeed>=1.0) { Config->File_IsGrowing=true; #if MEDIAINFO_MD5 delete MD5; MD5=NULL; #endif //MEDIAINFO_MD5 } break; case 0x02 : Fill(Stream_General, 0, General_Format_Settings, "Closed / Incomplete", Unlimited, true, true); break; case 0x03 : Fill(Stream_General, 0, General_Format_Settings, "Open / Complete" , Unlimited, true, true); if (Config->ParseSpeed>=1.0) { Config->File_IsGrowing=true; #if MEDIAINFO_MD5 delete MD5; MD5=NULL; #endif //MEDIAINFO_MD5 } break; case 0x04 : Fill(Stream_General, 0, General_Format_Settings, "Closed / Complete" , Unlimited, true, true); break; default : ; } if ((Code.lo&0xFF0000)==0x040000) //If Footer Partition Pack { switch ((Code.lo>>8)&0xFF) { case 0x02 : case 0x04 : Config->File_IsGrowing=false; break; default : ; } #if MEDIAINFO_ADVANCED if (Footer_Position==(int64u)-1) Footer_Position=File_Offset+Buffer_Offset-Header_Size; #endif //MEDIAINFO_ADVANCED } PartitionPack_AlreadyParsed.insert(File_Offset+Buffer_Offset-Header_Size); } //--------------------------------------------------------------------------- // 0x3B03 void File_Mxf::Preface_ContentStorage() { //Parsing int128u Data; Get_UUID(Data, "Data"); Element_Info1(Ztring().From_UUID(Data)); FILLING_BEGIN(); Prefaces[Preface_Current].ContentStorage=Data; FILLING_END(); } //--------------------------------------------------------------------------- // 0x3B05 void File_Mxf::Preface_Version() { //Parsing Info_B1(Major, "Major"); //1 Info_B1(Minor, "Minor"); //2 Element_Info1(Ztring::ToZtring(Major)+__T('.')+Ztring::ToZtring(Minor)); } //--------------------------------------------------------------------------- // 0x3B06 void File_Mxf::Preface_Identifications() { //Parsing //Vector int32u Count, Length; Get_B4 (Count, "Count"); Get_B4 (Length, "Length"); for (int32u Pos=0; PosDemux_Offset_DTS_FromStream=FrameInfo.DTS; #endif //MEDIAINFO_DEMUX } } Components[InstanceUID].TimeCode_StartTimecode=Data; FILLING_END(); } //--------------------------------------------------------------------------- // 0x1502 void File_Mxf::TimecodeComponent_RoundedTimecodeBase() { //Parsing int16u Data; Get_B2 (Data, "Data"); Element_Info1(Data); FILLING_BEGIN(); if (Data && Data!=(int16u)-1) { TimeCode_RoundedTimecodeBase=Data; if (TimeCode_StartTimecode!=(int64u)-1) { DTS_Delay=((float64)TimeCode_StartTimecode)/TimeCode_RoundedTimecodeBase; if (TimeCode_DropFrame) { DTS_Delay*=1001; DTS_Delay/=1000; } FrameInfo.DTS=float64_int64s(DTS_Delay*1000000000); #if MEDIAINFO_DEMUX Config->Demux_Offset_DTS_FromStream=FrameInfo.DTS; #endif //MEDIAINFO_DEMUX } } Components[InstanceUID].TimeCode_RoundedTimecodeBase=Data; FILLING_END(); } //--------------------------------------------------------------------------- // 0x1503 void File_Mxf::TimecodeComponent_DropFrame() { //Parsing int8u Data; Get_B1 (Data, "Data"); Element_Info1(Data); FILLING_BEGIN(); if (Data!=(int8u)-1 && Data) { TimeCode_DropFrame=true; if (DTS_Delay) { DTS_Delay*=1001; DTS_Delay/=1000; } FrameInfo.DTS=float64_int64s(DTS_Delay*1000000000); #if MEDIAINFO_DEMUX Config->Demux_Offset_DTS_FromStream=FrameInfo.DTS; #endif //MEDIAINFO_DEMUX } Components[InstanceUID].TimeCode_DropFrame=Data?true:false; FILLING_END(); } //--------------------------------------------------------------------------- // 0x4B01 void File_Mxf::Track_EditRate() { //Parsing float64 Data; Get_Rational(Data); Element_Info1(Data); FILLING_BEGIN(); Tracks[InstanceUID].EditRate=Data; FILLING_END(); } //--------------------------------------------------------------------------- // 0x4B02 void File_Mxf::Track_Origin() { //Parsing int64u Data; Get_B8 (Data, "Data"); Element_Info1(Data); FILLING_BEGIN(); if (Data!=(int64u)-1) Tracks[InstanceUID].Origin=Data; FILLING_END(); } //--------------------------------------------------------------------------- // 0x3D09 void File_Mxf::WaveAudioDescriptor_AvgBps() { //Parsing int32u Data; Get_B4 (Data, "Data"); Element_Info1(Data); FILLING_BEGIN(); Descriptors[InstanceUID].Infos["BitRate"].From_Number(Data*8); Descriptors[InstanceUID].ByteRate=Data; FILLING_END(); } //--------------------------------------------------------------------------- // 0x3D0A void File_Mxf::WaveAudioDescriptor_BlockAlign() { //Parsing int16u Data; Get_B2 (Data, "Data"); Element_Info1(Data); FILLING_BEGIN(); Descriptors[InstanceUID].BlockAlign=Data; FILLING_END(); } //--------------------------------------------------------------------------- // 0x3D0B void File_Mxf::WaveAudioDescriptor_SequenceOffset() { //Parsing Info_B1(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x3D29 void File_Mxf::WaveAudioDescriptor_PeakEnvelopeVersion() { //Parsing Info_B4(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x3D2A void File_Mxf::WaveAudioDescriptor_PeakEnvelopeFormat() { //Parsing Info_B4(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x3D2B void File_Mxf::WaveAudioDescriptor_PointsPerPeakValue() { //Parsing Info_B4(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x3D2C void File_Mxf::WaveAudioDescriptor_PeakEnvelopeBlockSize() { //Parsing Info_B4(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x3D2D void File_Mxf::WaveAudioDescriptor_PeakChannels() { //Parsing Info_B4(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x3D2E void File_Mxf::WaveAudioDescriptor_PeakFrames() { //Parsing Info_B4(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x3D2F void File_Mxf::WaveAudioDescriptor_PeakOfPeaksPosition() { //Parsing Info_B8(Data, "Data"); Element_Info1(Data); } //--------------------------------------------------------------------------- // 0x3D30 void File_Mxf::WaveAudioDescriptor_PeakEnvelopeTimestamp() { //Parsing Info_Timestamp(); } //--------------------------------------------------------------------------- // 0x3D31 void File_Mxf::WaveAudioDescriptor_PeakEnvelopeData() { //Parsing Skip_XX(Length2, "Data"); } //--------------------------------------------------------------------------- // 0x3D32 void File_Mxf::WaveAudioDescriptor_ChannelAssignment() { //Parsing Skip_B16( "Label"); } //--------------------------------------------------------------------------- // 0x8001 void File_Mxf::Omneon_010201010100_8001() { //Parsing //Vector int32u Count, Length; Get_B4 (Count, "Count"); Get_B4 (Length, "Length"); for (int32u Pos=0; Pos=0x10 && Code7<=0x7F) Param_Info1("Pack coded System Elements (SMPTE 336M)"); } Info_B1(Code8, "Element Number"); } break; default : Info_B1(Code7, "Metadata or Control Element Identifier"); Info_B1(Code8, "Unknown"); } } break; default : Skip_B3( "Unknown"); } } break; default : Skip_B4( "Unknown"); } } break; case 0x04 : { Param_Info1("MXF / AAF Descriptive Metadata sets"); Info_B1(Code4, "Structure Version"); switch (Code4) { case 0x01 : { Param_Info1("Version 1"); Info_B1(Code5, "Structure / Scheme Kind"); Info_B1(Code6, "Reserved"); Info_B1(Code7, "Reserved"); Info_B1(Code8, "Reserved"); } break; default : Skip_B4( "Unknown"); } } break; default : Skip_B5( "Unknown"); } } break; default : Skip_B6( "Unknown"); } } break; case 0x0E : { Param_Info1("User Organisation Registered For Private Use"); Skip_B7( "Private"); break; } default : Skip_B7( "Unknown"); } } #endif //MEDIAINFO_TRACE //--------------------------------------------------------------------------- #if MEDIAINFO_TRACE void File_Mxf::Info_UL_040101_Values() { Info_B1(Code1, "Item Designator"); switch (Code1) { case 0x01 : { Param_Info1("Interpretive"); Info_B1(Code2, "Code (2)"); switch (Code2) { case 0x03 : { Info_B1(Code3, "Code (3)"); switch (Code3) { case 0x02 : Skip_B5( "Track identifier"); break; default : Skip_B5( "Unknown"); } } break; default : Skip_B6( "Unknown"); } } break; case 0x04 : { Param_Info1("Parametric"); Info_B1(Code2, "Code (2)"); switch (Code2) { case 0x01 : { Param_Info1("Picture essence"); Info_B1(Code3, "Code (3)"); switch (Code3) { case 0x01 : Param_Info1("Fundamental Picture Characteristics"); Skip_B5( "Picture coding or compression"); break; case 0x02 : Param_Info1("Picture Coding Characteristics"); Info_B1(Code4, "Code (4)"); switch (Code4) { case 0x01 : Param_Info1("Uncompressed Picture Coding"); Skip_B1( "Item Type Identifier"); //if 0x14: SMPTE 384M Uncompressed picture Line wrapped Skip_B1( "System Scheme Identifier"); //SMPTE 384M Skip_B1( "System Element Identifier"); //SMPTE 384M Skip_B1( "Reserved"); break; case 0x02 : { Param_Info1("Compressed Picture Coding"); Info_B1(Code5, "Code (5)"); switch (Code5) { case 0x01 : { Param_Info1("MPEG Compression"); Info_B1(Code6, "Code (6)"); switch (Code6) { case 0x01 : Param_Info1("MPEG-2 MP@ML"); Skip_B2( "Unknown"); break; case 0x02 : Param_Info1("MPEG-2 422P@ML"); Skip_B2( "Unknown"); break; case 0x03 : Param_Info1("MPEG-2 MP@HL"); Skip_B2( "Unknown"); break; case 0x04 : Param_Info1("MPEG-2 422P@HL"); Skip_B2( "Unknown"); break; case 0x10 : Param_Info1("MPEG-1"); Skip_B2( "Unknown"); break; case 0x20 : Param_Info1("MPEG-4 Visual"); Skip_B2( "Unknown"); break; case 0x32 : Param_Info1("AVC"); Skip_B2( "Unknown"); break; default : Skip_B2( "Unknown"); } } break; case 0x02 : { Param_Info1("DV Video Compression"); Info_B1(Code6, "Code (6)"); switch (Code6) { case 0x02 : Param_Info1("DV-Based Compression"); Info_B1(Code7, "DV type (SMPTE 383)"); Info_B1(Code8, "Mapping Kind"); Param_Info1(Mxf_EssenceContainer_Mapping(Code6, Code7, Code8)); break; default : Skip_B2( "Unknown"); } } break; case 0x03 : { Param_Info1("Individual Picture Coding Schemes"); Info_B1(Code6, "Code (6)"); switch (Code6) { case 0x01 : Param_Info1("JPEG 2000"); Skip_B1( "Unused"); Skip_B1( "Unused"); break; default : Skip_B2( "Unknown"); } } break; case 0x71 : { Param_Info1("VC-3"); Skip_B1( "Variant"); Skip_B1( "Unused"); Skip_B1( "Unused"); } break; default : Skip_B3( "Unknown"); } } break; default : Skip_B4( "Unknown"); } break; default : Skip_B5( "Unknown"); } } break; case 0x02 : { Param_Info1("Sound essence"); Info_B1(Code3, "Code (3)"); switch (Code3) { case 0x01 : Skip_B5( "Sound coding or compression"); break; case 0x02 : { Param_Info1("Sound Coding Characteristics"); Info_B1(Code4, "Code (4)"); switch (Code4) { case 0x01 : { Param_Info1("Uncompressed Sound Coding"); Info_B1(Code5, "Code (5)"); switch (Code5) { case 0x7E : { Param_Info1("PCM (AIFF)"); Skip_B3( "Reserved"); } break; case 0x7F : { Param_Info1("Undefined"); Skip_B3( "Reserved"); } break; default : Skip_B3( "Unknown"); } } break; case 0x02 : { Param_Info1("Compressed Sound Coding"); Info_B1(Code5, "Code (5)"); switch (Code5) { case 0x03 : { Param_Info1("Compressed Audio Coding"); Info_B1(Code6, "Code (6)"); switch (Code6) { case 0x01 : { Param_Info1("Compandeded Audio Coding"); Info_B1(Code7, "Code (7)"); switch (Code7) { case 0x01 : Param_Info1("A-law Coded Audio (default)"); Skip_B1("Unknown"); break; case 0x02 : Param_Info1("DV Compressed Audio"); Skip_B1("Unknown"); break; default : Skip_B2("Unknown"); } } break; case 0x02 : { Param_Info1("SMPTE 338M Audio Coding"); Info_B1(Code7, "Code (7)"); switch (Code7) { case 0x01 : Param_Info1("AC-3"); Skip_B1("Unknown"); break; case 0x04 : Param_Info1("MPEG-1 Audio Layer 1"); Skip_B1("Unknown"); break; case 0x05 : Param_Info1("MPEG-1 Audio Layer 2"); Skip_B1("Unknown"); break; case 0x06 : Param_Info1("MPEG-2 Audio Layer 1"); Skip_B1("Unknown"); break; case 0x1C : Param_Info1("Dolby E"); Skip_B1("Unknown"); break; default : Skip_B2("Unknown"); } } break; case 0x03 : { Param_Info1("MPEG-2 Coding (not defined in SMPTE 338M)"); Info_B1(Code7, "Code (7)"); switch (Code7) { case 0x01 : Param_Info1("AAC version 2"); Skip_B1("Unknown"); break; default : Skip_B2("Unknown"); } } break; case 0x04 : { Param_Info1("MPEG-4 Audio Coding"); Info_B1(Code7, "Code (7)"); switch (Code7) { case 0x01 : Param_Info1("MPEG-4 Speech Profile"); Skip_B1("Unknown"); break; case 0x02 : Param_Info1("MPEG-4 Synthesis Profile"); Skip_B1("Unknown"); break; case 0x03 : Param_Info1("MPEG-4 Scalable Profile"); Skip_B1("Unknown"); break; case 0x04 : Param_Info1("MPEG-4 Main Profile"); Skip_B1("Unknown"); break; case 0x05 : Param_Info1("MPEG-4 High Quality Audio Profile"); Skip_B1("Unknown"); break; case 0x06 : Param_Info1("MPEG-4 Low Delay Audio Profile"); Skip_B1("Unknown"); break; case 0x07 : Param_Info1("MPEG-4 Natural Audio Profile"); Skip_B1("Unknown"); break; case 0x08 : Param_Info1("MPEG-4 Mobile Audio Internetworking Profile"); Skip_B1("Unknown"); break; default : Skip_B2("Unknown"); } } break; default : Skip_B2( "Unknown"); } } break; default : Skip_B3( "Unknown"); } } break; default : Skip_B4( "Unknown"); } } break; default : Skip_B5( "Unknown"); } } break; default : Skip_B6( "Unknown"); } } break; case 0x0D : { Param_Info1("User Organisation Registered For Public Use"); Info_B1(Code2, "Organization"); switch (Code2) { case 0x01 : { Param_Info1("AAF"); Info_B1(Code3, "Application"); switch (Code3) { case 0x02 : { Param_Info1("Operational Patterns"); Info_B1(Code4, "Version"); switch (Code4) { case 0x01 : { Param_Info1("Version 1"); Info_B1(Code5, "Item Complexity"); Info_B1(Code6, "Package Complexity"); Info_B1(Code7, "Qualifier"); Skip_Flags(Code7, 3, "uni/multi-track"); Skip_Flags(Code7, 2, "stream/non-stream file"); Skip_Flags(Code7, 1, "internal/external essence"); Info_B1(Code8, "Reserved"); } break; case 0x02 : { Info_B1(Code5, "Code (5)"); switch (Code5) { case 0x01 : Skip_B3( "Essence container kind"); break; default : Skip_B3( "Unknown"); } } break; default : Skip_B4( "Unknown"); } } break; case 0x03 : { Param_Info1("Essence Container Application"); Info_B1(Code4, "Structure Version"); switch (Code4) { case 0x01 : { Param_Info1("MXF EC Structure Version 1"); Info_B1(Code5, "Essence container Kind"); switch (Code5) { case 0x01 : Param_Info1("Deprecated Essence Container Kind"); Skip_B3( "Unknown"); break; case 0x02 : { Param_Info1("Essence Container Kind"); Info_B1(Code6, "Code (6)"); switch (Code6) { case 0x01 : //SMPTE 386M { Param_Info1("Type D-10 Mapping"); Skip_B1( "MPEG Constraints"); //SMPTE 356M Skip_B1( "Template Extension"); } break; case 0x02 : { Param_Info1("DV Mappings"); Skip_B1( "Mapping Kind"); Skip_B1( "Locally defined"); } break; case 0x03 : { Param_Info1("Type D-11 Mapping"); Skip_B1( "Mapping Kind"); Skip_B1( "Locally defined"); } break; case 0x04 : { Param_Info1("MPEG ES mappings"); Info_B1(Code7, "ISO13818-1 stream_id bits 6..0"); Param_Info1(Ztring::ToZtring(0x80+Code7, 16)); Info_B1(Code8, "Mapping Kind"); Param_Info1(Mxf_EssenceContainer_Mapping(Code6, Code7, Code8)); } break; case 0x05 : //SMPTE 384M { Param_Info1("Uncompressed Pictures"); Info_B1(Code7, "Number of lines / field rate combination"); //SMPTE 384M Info_B1(Code8, "Mapping Kind"); Param_Info1(Mxf_EssenceContainer_Mapping(Code6, Code7, Code8)); } break; case 0x06 : { Param_Info1("AES-BWF"); Info_B1(Code7, "Mapping Kind"); Param_Info1(Mxf_EssenceContainer_Mapping(Code6, Code7, 0x00)); Skip_B1( "Locally defined"); } break; case 0x07 : { Param_Info1("MPEG PES mappings"); Info_B1(Code7, "ISO13818-1 stream_id bits 6..0"); Param_Info1(Ztring::ToZtring(0x80+Code7, 16)); Info_B1(Code8, "Mapping Kind"); Param_Info1(Mxf_EssenceContainer_Mapping(Code6, Code7, Code8)); } break; case 0x08 : { Param_Info1("MPEG PS mappings"); Info_B1(Code7, "ISO13818-1 stream_id bits 6..0"); Param_Info1(Ztring::ToZtring(0x80+Code7, 16)); Info_B1(Code8, "Mapping Kind"); Param_Info1(Mxf_EssenceContainer_Mapping(Code6, Code7, Code8)); } break; case 0x09 : { Param_Info1("MPEG TS mappings"); Info_B1(Code7, "ISO13818-1 stream_id bits 6..0"); Param_Info1(Ztring::ToZtring(0x80+Code7, 16)); Info_B1(Code8, "Mapping Kind"); Param_Info1(Mxf_EssenceContainer_Mapping(Code6, Code7, Code8)); } break; case 0x0A : { Param_Info1("A-law Sound Element Mapping"); Info_B1(Code7, "Mapping Kind"); Param_Info1(Mxf_EssenceContainer_Mapping(Code6, Code7, 0xFF)); Skip_B1( "Locally defined"); } break; case 0x0B : { Param_Info1("Encrypted Generic Container"); Skip_B1( "Mapping Kind"); Skip_B1( "Locally defined"); } break; case 0x0C : { Param_Info1("JPEG 2000 Picture Mapping"); Skip_B1( "Mapping Kind"); Skip_B1( "Locally defined"); } break; case 0x11 : { Param_Info1("VC-3 Picture Element"); Info_B1(Code7, "Content Kind"); Param_Info1(Mxf_EssenceContainer_Mapping(Code6, Code7, 0xFF)); Skip_B1( "Reserved"); } break; case 0x16 : { Param_Info1("AVC Picture Element"); Skip_B1( "Unknown"); Skip_B1( "Unknown"); } break; case 0x7F : { Param_Info1("Generic Essence Container Wrapping"); Skip_B1( "Mapping Kind"); Skip_B1( "Locally defined"); } break; default : { Skip_B1( "Mapping Kind"); Skip_B1( "Locally defined"); } } } break; default : Skip_B1( "Essence container Kind"); Skip_B1( "Mapping Kind"); Skip_B1( "Locally defined"); } } break; default : Skip_B4( "Unknown"); } } break; case 0x04 : { Param_Info1("MXF / AAF compatible Descriptive Metadata Labels"); Info_B1(Code4, "Label Version"); switch (Code4) { case 0x01 : { Param_Info1("Version 1"); Info_B1(Code5, "Scheme Kind"); Info_B1(Code6, "Reserved"); Info_B1(Code7, "Reserved"); Info_B1(Code8, "Reserved"); } break; default : Skip_B4( "Unknown"); } } break; default : Skip_B5( "Unknown"); } } break; case 0x02 : { Param_Info1("EBU/UER"); Skip_B6( "Unknown"); } break; case 0x03 : { Param_Info1("Pro-MPEG Forum"); Skip_B6( "Unknown"); } break; case 0x04 : { Param_Info1("BBC"); Skip_B6( "Unknown"); } break; case 0x05 : { Param_Info1("IRT"); Skip_B6( "Unknown"); } break; case 0x06 : { Param_Info1("ARIB"); Skip_B6( "Unknown"); } break; default : Skip_B6( "Unknown"); } } break; case 0x0E : { Param_Info1("User Organisation Registered For Private Use"); Info_B1(Code2, "Code (2)"); switch (Code2) { case 0x04 : { Param_Info1("Avid"); Info_B1(Code3, "Code (3)"); switch (Code3) { case 0x02 : { Param_Info1("Essence Compression?"); Info_B1(Code4, "?"); switch (Code4) { case 0x01 : { Param_Info1("?"); Info_B1(Code5, "?"); switch (Code5) { case 0x02 : { Param_Info1("?"); Info_B1(Code6, "Code (6)"); switch (Code6) { case 0x04 : Param_Info1("VC-3"); Skip_B2( "Unknown"); break; default : Skip_B2( "Unknown"); } } break; default : Skip_B3( "Unknown"); } } break; default : Skip_B4( "Unknown"); } } break; case 0x03 : { Param_Info1("Essence Container Application"); Info_B1(Code4, "Structure Version"); switch (Code4) { case 0x01 : { Param_Info1("MXF EC Structure Version 1"); Info_B1(Code5, "Essence container Kind"); switch (Code5) { case 0x02 : { Param_Info1("Essence Container Kind"); Info_B1(Code6, "Code (6)"); switch (Code6) { case 0x06 : Param_Info1("VC-3"); Skip_B2( "Unknown"); break; default : Skip_B2( "Unknown"); } } break; default : Skip_B3( "Unknown"); } } break; default : Skip_B4( "Unknown"); } } break; default : Skip_B5( "Unknown"); } } break; default : Skip_B6( "Private"); } } break; default : Skip_B7( "Unknown"); } } #endif //MEDIAINFO_TRACE //--------------------------------------------------------------------------- void File_Mxf::Skip_UL(const char* Name) { #ifdef MEDIAINFO_MINIMIZE_SIZE Skip_UUID(); #else int128u Value; Get_UL(Value, Name, NULL); #endif } //--------------------------------------------------------------------------- void File_Mxf::Get_UMID(int256u &Value, const char* Name) { Element_Name(Name); //Parsing Get_UUID (Value.hi, "Fixed"); Get_UUID (Value.lo, "UUID"); Element_Info1(Ztring().From_UUID(Value.lo)); } //--------------------------------------------------------------------------- void File_Mxf::Skip_UMID() { //Parsing Skip_UUID( "Fixed"); Info_UUID(Data, "UUID"); Element_Info1(Ztring().From_UUID(Data)); } //--------------------------------------------------------------------------- void File_Mxf::Get_Timestamp(Ztring &Value) { //Parsing int16u Year; int8u Month, Day, Hours, Minutes, Seconds, Milliseconds; Get_B2 (Year, "Year"); Get_B1 (Month, "Month"); Get_B1 (Day, "Day"); Get_B1 (Hours, "Hours"); Get_B1 (Minutes, "Minutes"); Get_B1 (Seconds, "Seconds"); Get_B1 (Milliseconds, "Milliseconds/4"); Param_Info2(Milliseconds*4, " ms"); Value.From_Number(Year); Value+=__T('-'); Ztring Temp; Temp.From_Number(Month); if (Temp.size()<2) Temp.insert(0, 1, __T('0')); Value+=Temp; Value+=__T('-'); Temp.From_Number(Day); if (Temp.size()<2) Temp.insert(0, 1, __T('0')); Value+=Temp; Value+=__T(' '); Temp.From_Number(Hours); if (Temp.size()<2) Temp.insert(0, 1, __T('0')); Value+=Temp; Value+=__T(':'); Temp.From_Number(Minutes); if (Temp.size()<2) Temp.insert(0, 1, __T('0')); Value+=Temp; Value+=__T(':'); Temp.From_Number(Seconds); if (Temp.size()<2) Temp.insert(0, 1, __T('0')); Value+=Temp; Value+=__T('.'); Temp.From_Number(Milliseconds*4); if (Temp.size()<3) Temp.insert(0, 3-Temp.size(), __T('0')); Value+=Temp; } //--------------------------------------------------------------------------- void File_Mxf::Skip_Timestamp() { //Parsing Skip_B2( "Year"); Skip_B1( "Month"); Skip_B1( "Day"); Skip_B1( "Hours"); Skip_B1( "Minutes"); Skip_B1( "Seconds"); Info_B1(Milliseconds, "Milliseconds/4"); Param_Info2(Milliseconds*4, " ms"); } //--------------------------------------------------------------------------- void File_Mxf::Info_Timestamp() { //Parsing Info_B2(Year, "Year"); Info_B1(Month, "Month"); Info_B1(Day, "Day"); Info_B1(Hours, "Hours"); Info_B1(Minutes, "Minutes"); Info_B1(Seconds, "Seconds"); Info_B1(Milliseconds, "Milliseconds/4"); Param_Info2(Milliseconds*4, " ms"); Element_Info1(Ztring::ToZtring(Year )+__T('-')+ Ztring::ToZtring(Month )+__T('-')+ Ztring::ToZtring(Day )+__T(' ')+ Ztring::ToZtring(Hours )+__T(':')+ Ztring::ToZtring(Minutes )+__T(':')+ Ztring::ToZtring(Seconds )+__T('.')+ Ztring::ToZtring(Milliseconds*4) ); } //--------------------------------------------------------------------------- void File_Mxf::Get_BER(int64u &Value, const char* Name) { int8u Length; Get_B1(Length, Name); if (Length<0x80) { Value=Length; //1-byte return; } Length&=0x7F; switch (Length) { case 1 : { int8u Length1; Get_B1(Length1, Name); Value=Length1; break; } case 2 : { int16u Length2; Get_B2(Length2, Name); Value=Length2; break; } case 3 : { int32u Length3; Get_B3(Length3, Name); Value=Length3; break; } case 4 : { int32u Length4; Get_B4(Length4, Name); Value=Length4; break; } case 5 : { int64u Length5; Get_B5(Length5, Name); Value=Length5; break; } case 6 : { int64u Length6; Get_B6(Length6, Name); Value=Length6; break; } case 7 : { int64u Length7; Get_B7(Length7, Name); Value=Length7; break; } case 8 : { int64u Length8; Get_B8(Length8, Name); Value=Length8; break; } default:Value=(int64u)-1; //Problem } } //*************************************************************************** // Parsers //*************************************************************************** //--------------------------------------------------------------------------- void File_Mxf::ChooseParser(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { if ((Descriptor->second.EssenceCompression.hi&0xFFFFFFFFFFFFFF00LL)!=0x060E2B3404010100LL || (Descriptor->second.EssenceCompression.lo&0xFF00000000000000LL)!=0x0400000000000000LL) return ChooseParser__FromEssenceContainer (Essence, Descriptor); int8u Code2=(int8u)((Descriptor->second.EssenceCompression.lo&0x00FF000000000000LL)>>48); int8u Code3=(int8u)((Descriptor->second.EssenceCompression.lo&0x0000FF0000000000LL)>>40); int8u Code4=(int8u)((Descriptor->second.EssenceCompression.lo&0x000000FF00000000LL)>>32); int8u Code5=(int8u)((Descriptor->second.EssenceCompression.lo&0x00000000FF000000LL)>>24); int8u Code6=(int8u)((Descriptor->second.EssenceCompression.lo&0x0000000000FF0000LL)>>16); int8u Code7=(int8u)((Descriptor->second.EssenceCompression.lo&0x000000000000FF00LL)>> 8); switch (Code2) { case 0x01 : //Picture switch (Code3) { case 0x02 : //Coding characteristics switch (Code4) { case 0x01 : //Uncompressed Picture Coding switch (Code5) { case 0x01 : return ChooseParser_Raw(Essence, Descriptor); case 0x7F : return ChooseParser_RV24(Essence, Descriptor); default : return; } case 0x02 : //Compressed coding switch (Code5) { case 0x01 : //MPEG Compression switch (Code6) { case 0x01 : case 0x02 : case 0x03 : case 0x04 : case 0x11 : return ChooseParser_Mpegv(Essence, Descriptor); case 0x20 : return ChooseParser_Mpeg4v(Essence, Descriptor); case 0x32 : return ChooseParser_Avc(Essence, Descriptor); default : return; } case 0x02 : return ChooseParser_DV(Essence, Descriptor); case 0x03 : //Individual Picture Coding Schemes switch (Code6) { case 0x01 : return ChooseParser_Jpeg2000(Essence, Descriptor); default : return; } case 0x71 : return ChooseParser_Vc3(Essence, Descriptor); default : return; } default : return; } default : return; } case 0x02 : //Sound switch (Code3) { case 0x02 : //Coding characteristics switch (Code4) { case 0x01 : //Uncompressed Sound Coding switch (Code5) { case 0x01 : case 0x7F : if (Descriptor->second.ChannelCount==1) //PCM, but one file is found with Dolby E in it ChooseParser_ChannelGrouping(Essence, Descriptor); if (Descriptor->second.ChannelCount==2) //PCM, but one file is found with Dolby E in it ChooseParser_SmpteSt0337(Essence, Descriptor); default : return ChooseParser_Pcm(Essence, Descriptor); } case 0x02 : //Compressed coding switch (Code5) { case 0x03 : //Compressed Audio Coding switch (Code6) { case 0x01 : //Compandeded Audio Coding switch (Code7) { case 0x01 : if ((Descriptor->second.EssenceContainer.lo&0xFFFF0000)==0x02060000) //Test coherency between container and compression return ChooseParser_Pcm(Essence, Descriptor); //Compression is A-Law but Container is PCM, not logic, prioritizing PCM else return ChooseParser_Alaw(Essence, Descriptor); case 0x10 : return ChooseParser_Pcm(Essence, Descriptor); //DV 12-bit default : return; } case 0x02 : //SMPTE 338M Audio Coding switch (Code7) { case 0x01 : if (Descriptor->second.IsAes3Descriptor) return ChooseParser_SmpteSt0337(Essence, Descriptor); else return ChooseParser_Ac3(Essence, Descriptor); case 0x04 : case 0x05 : case 0x06 : if (Descriptor->second.IsAes3Descriptor) return ChooseParser_SmpteSt0337(Essence, Descriptor); else return ChooseParser_Mpega(Essence, Descriptor); case 0x1C : if (Descriptor->second.ChannelCount==1) return ChooseParser_ChannelGrouping(Essence, Descriptor); //Dolby E (in 2 mono streams) else return ChooseParser_SmpteSt0337(Essence, Descriptor); //Dolby E (in 1 stereo streams) default : return; } case 0x03 : //MPEG-2 Coding (not defined in SMPTE 338M) switch (Code7) { case 0x01 : return ChooseParser_Aac(Essence, Descriptor); default : return; } case 0x04 : //MPEG-4 Audio Coding switch (Code7) { case 0x01 : case 0x02 : case 0x03 : case 0x04 : case 0x05 : case 0x06 : case 0x07 : case 0x08 : return ChooseParser_Aac(Essence, Descriptor); default : return; } default : return; } default : return; } default : return; } default : return; } default : return; } } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser__FromEssenceContainer(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { int8u Code1=(int8u)((Descriptor->second.EssenceContainer.lo&0xFF00000000000000LL)>>56); int8u Code2=(int8u)((Descriptor->second.EssenceContainer.lo&0x00FF000000000000LL)>>48); int8u Code3=(int8u)((Descriptor->second.EssenceContainer.lo&0x0000FF0000000000LL)>>40); int8u Code4=(int8u)((Descriptor->second.EssenceContainer.lo&0x000000FF00000000LL)>>32); int8u Code5=(int8u)((Descriptor->second.EssenceContainer.lo&0x00000000FF000000LL)>>24); int8u Code6=(int8u)((Descriptor->second.EssenceContainer.lo&0x0000000000FF0000LL)>>16); //int8u Code7=(int8u)((Descriptor->second.EssenceContainer.lo&0x000000000000FF00LL)>> 8); switch (Code1) { case 0x0D : //Public Use switch (Code2) { case 0x01 : //AAF switch (Code3) { case 0x03 : //Essence Container Application switch (Code4) { case 0x01 : //MXF EC Structure version switch (Code5) { case 0x02 : //Essence container kind switch (Code6) { case 0x01 : switch(Descriptor->second.StreamKind) { case Stream_Video : return ChooseParser_Mpegv(Essence, Descriptor); case Stream_Audio : return ChooseParser_SmpteSt0331(Essence, Descriptor); default : return; } case 0x02 : return; //DV case 0x05 : return ChooseParser_Raw(Essence, Descriptor); case 0x06 : if (Descriptor->second.ChannelCount==1) //PCM, but one file is found with Dolby E in it ChooseParser_ChannelGrouping(Essence, Descriptor); if (Descriptor->second.ChannelCount==2) //PCM, but one file is found with Dolby E in it ChooseParser_SmpteSt0337(Essence, Descriptor); return ChooseParser_Pcm(Essence, Descriptor); case 0x04 : return; //MPEG ES mappings with Stream ID case 0x0A : return ChooseParser_Alaw(Essence, Descriptor); case 0x0C : return ChooseParser_Jpeg2000(Essence, Descriptor); case 0x10 : return ChooseParser_Avc(Essence, Descriptor); case 0x11 : return ChooseParser_Vc3(Essence, Descriptor); default : return; } default : return; } default : return; } default : return; } default : return; } case 0x0E : //Private Use switch (Code2) { case 0x04 : //Avid switch (Code3) { case 0x03 : //Essence Container Application switch (Code4) { case 0x01 : //MXF EC Structure version switch (Code5) { case 0x02 : //Essence container kind switch (Code6) { case 0x06 : return ChooseParser_Vc3(Essence, Descriptor); default : return; } default : return; } default : return; } default : return; } default : return; } default : return; } } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser__FromEssence(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { int32u Code_Compare3=Code.lo>>32; switch (Code_Compare3) { case Elements::GenericContainer_Aaf3 : return ChooseParser__Aaf(Essence, Descriptor); case Elements::GenericContainer_Avid3 : return ChooseParser__Avid(Essence, Descriptor); default : return; } } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser__Aaf(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { int32u Code_Compare4=(int32u)Code.lo; int8u Code_Compare4_1=Code_Compare4>>24; switch (Code_Compare4_1) { case 0x05 : //CP Picture ChooseParser__Aaf_CP_Picture(Essence, Descriptor); break; case 0x06 : //CP Sound ChooseParser__Aaf_CP_Sound(Essence, Descriptor); break; case 0x07 : //CP Data ChooseParser__Aaf_CP_Data(Essence, Descriptor); break; case 0x14 : //MXF in MXF? ChooseParser__Aaf_14(Essence, Descriptor); break; case 0x15 : //CP Picture ChooseParser__Aaf_GC_Picture(Essence, Descriptor); break; case 0x16 : //CP Sound ChooseParser__Aaf_GC_Sound(Essence, Descriptor); break; case 0x17 : //CP Data ChooseParser__Aaf_GC_Data(Essence, Descriptor); break; case 0x18 : //CP Compound ChooseParser__Aaf_GC_Compound(Essence, Descriptor); break; default : //Unknown ; } } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser__Avid(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { int32u Code_Compare4=(int32u)Code.lo; int8u Code_Compare4_1=Code_Compare4>>24; switch (Code_Compare4_1) { case 0x15 : //CP Picture ChooseParser__Avid_Picture(Essence, Descriptor); break; default : //Unknown ; } } //--------------------------------------------------------------------------- // 0x05, SMPTE 386M void File_Mxf::ChooseParser__Aaf_CP_Picture(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { int32u Code_Compare4=(int32u)Code.lo; int8u Code_Compare4_3=(int8u)(Code_Compare4>>8); Essences[Code_Compare4].StreamKind=Stream_Video; Essences[Code_Compare4].StreamPos=Code_Compare4&0x000000FF; switch (Code_Compare4_3) { case 0x01 : //D-10 Video, SMPTE 386M ChooseParser_Mpegv(Essence, Descriptor); break; default : //Unknown ; } } //--------------------------------------------------------------------------- // 0x06, SMPTE 386M void File_Mxf::ChooseParser__Aaf_CP_Sound(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { int32u Code_Compare4=(int32u)Code.lo; int8u Code_Compare4_3=(int8u)(Code_Compare4>>8); Essences[Code_Compare4].StreamKind=Stream_Audio; Essences[Code_Compare4].StreamPos=Code_Compare4&0x000000FF; switch (Code_Compare4_3) { case 0x10 : //D-10 Audio, SMPTE 386M ChooseParser_SmpteSt0331(Essence, Descriptor); break; default : //Unknown ; } } //--------------------------------------------------------------------------- // 0x07, SMPTE 386M void File_Mxf::ChooseParser__Aaf_CP_Data(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { } //--------------------------------------------------------------------------- // 0x14 void File_Mxf::ChooseParser__Aaf_14(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { int32u Code_Compare4=(int32u)Code.lo; int8u Code_Compare4_3=(int8u)(Code_Compare4>>8); switch (Code_Compare4_3) { case 0x01 : //MXF in MXF? Essence->second.Parsers.push_back(new File_Mxf()); break; default : ; } } //--------------------------------------------------------------------------- // 0x15 void File_Mxf::ChooseParser__Aaf_GC_Picture(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { int32u Code_Compare4=(int32u)Code.lo; int8u Code_Compare4_3=(int8u)(Code_Compare4>>8); Essences[Code_Compare4].StreamKind=Stream_Video; Essences[Code_Compare4].StreamPos=Code_Compare4&0x000000FF; switch (Code_Compare4_3) { case 0x01 : //RV24 ChooseParser_RV24(Essence, Descriptor); break; case 0x02 : //Raw video ChooseParser_Raw(Essence, Descriptor); break; case 0x05 : //SMPTE 381M, Frame wrapped ChooseParser_Mpegv(Essence, Descriptor); //Trying... Essences[Code_Compare4].Infos["Format_Settings_Wrapping"]=__T("Frame"); DataMustAlwaysBeComplete=true; break; case 0x06 : //SMPTE 381M, Clip wrapped ChooseParser_Mpegv(Essence, Descriptor); //Trying... Essences[Code_Compare4].Infos["Format_Settings_Wrapping"]=__T("Clip"); break; case 0x07 : //SMPTE 381M, Custom wrapped ChooseParser_Mpegv(Essence, Descriptor); //Trying... Essences[Code_Compare4].Infos["Format_Settings_Wrapping"]=__T("Custom"); break; case 0x08 : //JPEG 2000 ChooseParser_Jpeg2000(Essence, Descriptor); break; case 0x0D : //VC-3 ChooseParser_Vc3(Essence, Descriptor); break; default : //Unknown ; } } //--------------------------------------------------------------------------- // 0x16 void File_Mxf::ChooseParser__Aaf_GC_Sound(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { int32u Code_Compare4=(int32u)Code.lo; int8u Code_Compare4_3=(int8u)(Code_Compare4>>8); Essences[Code_Compare4].StreamKind=Stream_Audio; Essences[Code_Compare4].StreamPos=Code_Compare4&0x000000FF; switch (Code_Compare4_3) { case 0x01 : //BWF (PCM) case 0x02 : //BWF (PCM) case 0x03 : //DV Audio (PCM) case 0x04 : //P2 Audio (PCM) ChooseParser_Pcm(Essence, Descriptor); break; case 0x05 : //MPEG Audio ChooseParser_Mpega(Essence, Descriptor); break; case 0x08 : //A-law, Frame wrapped ChooseParser_Alaw(Essence, Descriptor); Essences[Code_Compare4].Infos["Format_Settings_Wrapping"]=__T("Frame"); DataMustAlwaysBeComplete=true; break; case 0x09 : //A-law, Clip wrapped ChooseParser_Alaw(Essence, Descriptor); Essences[Code_Compare4].Infos["Format_Settings_Wrapping"]=__T("Clip"); break; case 0x0A : //A-law, Custom wrapped ChooseParser_Alaw(Essence, Descriptor); Essences[Code_Compare4].Infos["Format_Settings_Wrapping"]=__T("Custom"); break; default : //Unknown ; } } //--------------------------------------------------------------------------- // 0x17 void File_Mxf::ChooseParser__Aaf_GC_Data(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { int32u Code_Compare4=(int32u)Code.lo; int8u Code_Compare4_3=(int8u)(Code_Compare4>>8); switch (Code_Compare4_3) { case 0x01 : //VBI, SMPTE ST 436 Essence->second.Parsers.push_back(new File__Analyze()); break; case 0x02 : //Ancillary if (!Ancillary) Ancillary=new File_Ancillary(); Essence->second.Parsers.push_back(Ancillary); Ancillary_IsBinded=true; break; case 0x08 : //Line Wrapped Data Element, SMPTE 384M case 0x09 : //Line Wrapped VANC Data Element, SMPTE 384M case 0x0A : //Line Wrapped HANC Data Element, SMPTE 384M break; default : //Unknown ; } } //--------------------------------------------------------------------------- // 0x18 void File_Mxf::ChooseParser__Aaf_GC_Compound(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { int32u Code_Compare4=(int32u)Code.lo; int8u Code_Compare4_3=(int8u)(Code_Compare4>>8); Essences[Code_Compare4].StreamKind=Stream_Video; //Default to video, audio will be merge later Essences[Code_Compare4].StreamPos=Code_Compare4&0x000000FF; switch (Code_Compare4_3) { case 0x01 : //DV case 0x02 : //DV ChooseParser_DV(Essence, Descriptor); break; default : //Unknown ; } } //--------------------------------------------------------------------------- // 0x15 void File_Mxf::ChooseParser__Avid_Picture(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { int32u Code_Compare4=(int32u)Code.lo; int8u Code_Compare4_3=(int8u)(Code_Compare4>>8); Essences[Code_Compare4].StreamKind=Stream_Video; Essences[Code_Compare4].StreamPos=Code_Compare4&0x000000FF; switch (Code_Compare4_3) { case 0x05 : //VC-1, Frame wrapped ChooseParser_Vc3(Essence, Descriptor); Essences[Code_Compare4].Infos["Format_Settings_Wrapping"]=__T("Frame"); DataMustAlwaysBeComplete=true; break; case 0x06 : //VC-1, Clip wrapped ChooseParser_Vc3(Essence, Descriptor); Essences[Code_Compare4].Infos["Format_Settings_Wrapping"]=__T("Clip"); break; case 0x07 : //VC-1, Custom wrapped ChooseParser_Vc3(Essence, Descriptor); Essences[Code_Compare4].Infos["Format_Settings_Wrapping"]=__T("Custom"); break; default : //Unknown ; } } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser_Avc(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { Essence->second.StreamKind=Stream_Video; //Filling #if defined(MEDIAINFO_AVC_YES) File_Avc* Parser=new File_Avc; #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Video); Parser->Fill(Stream_Video, 0, Video_Format, "AVC"); #endif Essence->second.Parsers.push_back(Parser); } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser_DV(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { Essence->second.StreamKind=Stream_Video; //Filling #if defined(MEDIAINFO_DVDIF_YES) File_DvDif* Parser=new File_DvDif; #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Video); Parser->Fill(Stream_Audio, 0, Audio_Format, "DV"); #endif Essence->second.Parsers.push_back(Parser); } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser_Mpeg4v(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { Essence->second.StreamKind=Stream_Video; //Filling #if defined(MEDIAINFO_MPEG4V_YES) File_Mpeg4v* Parser=new File_Mpeg4v; Parser->OnlyVOP(); #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Video); Parser->Fill(Stream_Video, 0, Video_Format, "MPEG-4 Visual"); #endif Essence->second.Parsers.push_back(Parser); } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser_Mpegv(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { Essence->second.StreamKind=Stream_Video; //Filling #if defined(MEDIAINFO_MPEGV_YES) File_Mpegv* Parser=new File_Mpegv(); Parser->Ancillary=&Ancillary; #if MEDIAINFO_ADVANCED Parser->InitDataNotRepeated_Optional=true; #endif // MEDIAINFO_ADVANCED #else File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Video); Parser->Fill(Stream_Video, 0, Video_Format, "MPEG Video"); #endif Essence->second.Parsers.push_back(Parser); } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser_Raw(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { Essence->second.StreamKind=Stream_Video; //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Video); Parser->Fill(Stream_Video, 0, Video_Format, "YUV"); Essence->second.Parsers.push_back(Parser); } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser_RV24(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { Essence->second.StreamKind=Stream_Video; //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Video); Parser->Fill(Stream_Video, 0, Video_Format, "RV24"); Essence->second.Parsers.push_back(Parser); } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser_Vc3(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { Essence->second.StreamKind=Stream_Video; //Filling #if defined(MEDIAINFO_VC3_YES) File_Vc3* Parser=new File_Vc3; if (Descriptor!=Descriptors.end()) Parser->FrameRate=Descriptor->second.Infos["FrameRate"].To_float32(); #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Video); Parser->Fill(Stream_Video, 0, Video_Format, "VC-3"); #endif Essence->second.Parsers.push_back(Parser); } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser_Aac(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { Essence->second.StreamKind=Stream_Audio; //Filling #if defined(MEDIAINFO_AAC_YES) File_Aac* Parser=new File_Aac; #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Audio); Parser->Fill(Stream_Audio, 0, Audio_Format, "AAC"); #endif Essence->second.Parsers.push_back(Parser); } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser_Ac3(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { Essence->second.StreamKind=Stream_Audio; //Filling #if defined(MEDIAINFO_AC3_YES) File_Ac3* Parser=new File_Ac3; #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Audio); Parser->Fill(Stream_Audio, 0, Audio_Format, "AC-3"); #endif Essence->second.Parsers.push_back(Parser); } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser_Alaw(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { Essence->second.StreamKind=Stream_Audio; //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Audio); Parser->Fill(Stream_Audio, 0, Audio_Format, "Alaw"); Essence->second.Parsers.push_back(Parser); } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser_ChannelGrouping(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { Essence->second.StreamKind=Stream_Audio; //Creating the parser if (!((Essence->second.StreamPos-(StreamPos_StartAtOne?1:0))%2 && Essences[Essence->first-1].Parsers.size()<=1)) { File_ChannelGrouping* Parser; if ((Essence->second.StreamPos-(StreamPos_StartAtOne?1:0))%2) //If the first half-stream was already rejected, don't try this one { essences::iterator FirstChannel=Essences.find(Essence->first-1); if (FirstChannel==Essences.end() || !FirstChannel->second.IsChannelGrouping) return ChooseParser_Pcm(Essence, Descriptor); //Not a channel grouping Parser=new File_ChannelGrouping; Parser->Channel_Pos=1; Parser->Common=((File_ChannelGrouping*)Essences[Essence->first-1].Parsers[0])->Common; Parser->StreamID=Essence->second.TrackID-1; } else { Parser=new File_ChannelGrouping; Parser->Channel_Pos=0; if (Descriptor!=Descriptors.end() && Descriptor->second.Infos.find("SamplingRate")!=Descriptor->second.Infos.end()) Parser->SamplingRate=Descriptor->second.Infos["SamplingRate"].To_int16u(); Essence->second.IsChannelGrouping=true; } Parser->Channel_Total=2; if (Descriptor!=Descriptors.end()) { Parser->BitDepth=(int8u)(Descriptor->second.BlockAlign<=4?(Descriptor->second.BlockAlign*8):(Descriptor->second.BlockAlign*4)); //In one file, BlockAlign is size of the aggregated channelgroup if (Descriptor->second.Infos.find("Format_Settings_Endianness")!=Descriptor->second.Infos.end()) { if (Descriptor->second.Infos["Format_Settings_Endianness"]==__T("Big")) Parser->Endianness='B'; else Parser->Endianness='L'; } else Parser->Endianness='L'; } else Parser->Endianness='L'; #if MEDIAINFO_DEMUX if (Demux_UnpacketizeContainer) { Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX Essence->second.Parsers.push_back(Parser); } //Adding PCM ChooseParser_Pcm(Essence, Descriptor); } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser_Mpega(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { Essence->second.StreamKind=Stream_Audio; //Filling #if defined(MEDIAINFO_MPEGA_YES) File_Mpega* Parser=new File_Mpega; #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Audio); Parser->Fill(Stream_Audio, 0, Audio_Format, "MPEG Audio"); #endif Essence->second.Parsers.push_back(Parser); } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser_Pcm(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { Essence->second.StreamKind=Stream_Audio; //Creating the parser #if defined(MEDIAINFO_PCM_YES) File_Pcm* Parser=new File_Pcm; if (Descriptor!=Descriptors.end()) { if (Descriptor->second.Infos.find("Channel(s)")!=Descriptor->second.Infos.end()) Parser->Channels=Descriptor->second.Infos["Channel(s)"].To_int8u(); if (Parser->Channels && Descriptor->second.BlockAlign!=(int16u)-1) Parser->BitDepth=(int8u)(Descriptor->second.BlockAlign*8/Parser->Channels); else if (Descriptor->second.QuantizationBits<256) Parser->BitDepth=(int8u)Descriptor->second.QuantizationBits; else if (Descriptor->second.Infos.find("BitDepth")!=Descriptor->second.Infos.end()) Parser->BitDepth=Descriptor->second.Infos["BitDepth"].To_int8u(); if (Descriptor->second.Infos.find("Format_Settings_Endianness")!=Descriptor->second.Infos.end()) { if (Descriptor->second.Infos["Format_Settings_Endianness"]==__T("Big")) Parser->Endianness='B'; else Parser->Endianness='L'; } else Parser->Endianness='L'; } else Parser->Endianness='L'; #if MEDIAINFO_DEMUX if (Demux_UnpacketizeContainer) { Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX Essence->second.Parsers.push_back(Parser); #endif } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser_SmpteSt0331(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { Essence->second.StreamKind=Stream_Audio; //Filling #if defined(MEDIAINFO_SMPTEST0331_YES) File_SmpteSt0331* Parser=new File_SmpteSt0331; if (Descriptor!=Descriptors.end() && Descriptor->second.QuantizationBits!=(int32u)-1) Parser->QuantizationBits=Descriptor->second.QuantizationBits; #if MEDIAINFO_DEMUX if (Demux_UnpacketizeContainer) { Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX Essence->second.Parsers.push_back(Parser); #endif } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser_SmpteSt0337(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { Essence->second.StreamKind=Stream_Audio; //Filling #if defined(MEDIAINFO_SMPTEST0337_YES) File_SmpteSt0337* Parser=new File_SmpteSt0337; if (Descriptor!=Descriptors.end()) { if (Descriptor->second.BlockAlign<64) Parser->Container_Bits=(int8u)(Descriptor->second.BlockAlign*4); else if (Descriptor->second.QuantizationBits!=(int32u)-1) Parser->Container_Bits=(int8u)Descriptor->second.QuantizationBits; if (Descriptor->second.Infos.find("Format_Settings_Endianness")!=Descriptor->second.Infos.end()) { if (Descriptor->second.Infos["Format_Settings_Endianness"]==__T("Big")) Parser->Endianness='B'; else Parser->Endianness='L'; } else Parser->Endianness='L'; } else Parser->Endianness='L'; Parser->Aligned=true; #if MEDIAINFO_DEMUX if (Demux_UnpacketizeContainer) { Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; } #endif //MEDIAINFO_DEMUX Essence->second.Parsers.push_back(Parser); #endif } //--------------------------------------------------------------------------- void File_Mxf::ChooseParser_Jpeg2000(const essences::iterator &Essence, const descriptors::iterator &Descriptor) { Essence->second.StreamKind=Stream_Video; //Filling #if defined(MEDIAINFO_JPEG_YES) File_Jpeg* Parser=new File_Jpeg; Parser->StreamKind=Stream_Video; if (Descriptor!=Descriptors.end()) Parser->Interlaced=Descriptor->second.ScanType==__T("Interlaced"); #else //Filling File__Analyze* Parser=new File_Unknown(); Open_Buffer_Init(Parser); Parser->Stream_Prepare(Stream_Video); Parser->Fill(Stream_Video, 0, Video_Format, "JPEG 2000"); #endif Essence->second.Parsers.push_back(Parser); } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- void File_Mxf::Subsampling_Compute(descriptors::iterator Descriptor) { if (Descriptor!=Descriptors.end() && (Descriptor->second.SubSampling_Horizontal==(int32u)-1 || Descriptor->second.SubSampling_Vertical==(int32u)-1)) return; switch (Descriptor->second.SubSampling_Horizontal) { case 1 : switch (Descriptor->second.SubSampling_Vertical) { case 1 : Descriptor->second.Infos["ChromaSubsampling"]=__T("4:4:4"); return; default: Descriptor->second.Infos["ChromaSubsampling"].clear(); return; } case 2 : switch (Descriptor->second.SubSampling_Vertical) { case 1 : Descriptor->second.Infos["ChromaSubsampling"]=__T("4:2:2"); return; case 2 : Descriptor->second.Infos["ChromaSubsampling"]=__T("4:2:0"); return; default: Descriptor->second.Infos["ChromaSubsampling"].clear(); return; } case 4 : switch (Descriptor->second.SubSampling_Vertical) { case 1 : Descriptor->second.Infos["ChromaSubsampling"]=__T("4:1:1"); return; default: Descriptor->second.Infos["ChromaSubsampling"].clear(); return; } default: return; } } //--------------------------------------------------------------------------- void File_Mxf::Locators_CleanUp() { //Testing locators (TODO: check if this is still useful) if (Locators.size()==1) { Locators.clear(); return; } locators::iterator Locator=Locators.begin(); while (Locator!=Locators.end()) { bool IsReferenced=false; for (descriptors::iterator Descriptor=Descriptors.begin(); Descriptor!=Descriptors.end(); ++Descriptor) for (size_t Pos=0; Possecond.Locators.size(); Pos++) if (Locator->first==Descriptor->second.Locators[Pos]) IsReferenced=true; if (!IsReferenced) { //Deleting current locator locators::iterator LocatorToDelete=Locator; ++Locator; Locators.erase(LocatorToDelete); } else ++Locator; } } //--------------------------------------------------------------------------- void File_Mxf::Locators_Test() { Locators_CleanUp(); if (!Locators.empty() && ReferenceFiles==NULL) { ReferenceFiles=new File__ReferenceFilesHelper(this, Config); for (locators::iterator Locator=Locators.begin(); Locator!=Locators.end(); ++Locator) if (!Locator->second.IsTextLocator && !Locator->second.EssenceLocator.empty()) { File__ReferenceFilesHelper::reference ReferenceFile; ReferenceFile.FileNames.push_back(Locator->second.EssenceLocator); ReferenceFile.StreamKind=Locator->second.StreamKind; ReferenceFile.StreamPos=Locator->second.StreamPos; if (Locator->second.LinkedTrackID!=(int32u)-1) ReferenceFile.StreamID=Locator->second.LinkedTrackID; else if (!Retrieve(Locator->second.StreamKind, Locator->second.StreamPos, General_ID).empty()) ReferenceFile.StreamID=Retrieve(Locator->second.StreamKind, Locator->second.StreamPos, General_ID).To_int64u(); ReferenceFile.Delay=float64_int64s(DTS_Delay*1000000000); //Special cases if (Locator->second.StreamKind==Stream_Video) { //Searching the corresponding frame rate for (descriptors::iterator Descriptor=Descriptors.begin(); Descriptor!=Descriptors.end(); ++Descriptor) for (size_t LocatorPos=0; LocatorPossecond.Locators.size(); LocatorPos++) if (Descriptor->second.Locators[LocatorPos]==Locator->first) ReferenceFile.FrameRate=Descriptor->second.SampleRate; } if (ReferenceFile.StreamID!=(int32u)-1) { //Descriptive Metadata std::vector DMScheme1s_List; for (dmsegments::iterator DMSegment=DMSegments.begin(); DMSegment!=DMSegments.end(); ++DMSegment) for (size_t Pos=0; Possecond.TrackIDs.size(); Pos++) if (DMSegment->second.TrackIDs[Pos]==ReferenceFile.StreamID) DMScheme1s_List.push_back(DMSegment->second.Framework); for (size_t Pos=0; Possecond.PrimaryExtendedSpokenLanguage; } } } ReferenceFiles->References.push_back(ReferenceFile); } else { Fill(Stream_General, 0, "UnsupportedSources", Locator->second.EssenceLocator); (*Stream_More)[Stream_General][0](Ztring().From_Local("UnsupportedSources"), Info_Options)=__T("N NT"); } ReferenceFiles->ParseReferences(); } } //--------------------------------------------------------------------------- void File_Mxf::TryToFinish() { Frame_Count_NotParsedIncluded=(int64u)-1; if (!IsSub && IsParsingEnd && File_Size!=(int64u)-1 && Config->ParseSpeed<1 && IsParsingMiddle_MaxOffset==(int64u)-1 && File_Size/2>0x4000000) //TODO: 64 MB by default; { IsParsingMiddle_MaxOffset=File_Size/2+0x4000000; //TODO: 64 MB by default; GoTo(File_Size/2); Open_Buffer_Unsynch(); IsParsingEnd=false; Streams_Count=(size_t)-1; return; } } } //NameSpace #endif //MEDIAINFO_MXF_* MediaInfoLib/Source/MediaInfo/Multiple/File_Mxf.h100777 0 0 110112 12252707240 15244 0/* 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 Mxf files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_MxfH #define MediaInfo_File_MxfH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #if defined(MEDIAINFO_ANCILLARY_YES) #include #endif //defined(MEDIAINFO_ANCILLARY_YES) #include "MediaInfo/MediaInfo_Internal.h" #include #include //--------------------------------------------------------------------------- namespace MediaInfoLib { class File__ReferenceFilesHelper; //*************************************************************************** // Class File_Mxf //*************************************************************************** class File_Mxf : public File__Analyze { public : //Constructor/Destructor File_Mxf(); ~File_Mxf(); //int256u class int256u { public: // Binary correct representation of signed 256bit integer int128u lo; int128u hi; int256u() { lo.lo=0; lo.hi=0; hi.lo=0; hi.hi=0; } }; protected : //Streams management void Streams_Fill (); void Streams_Finish (); void Streams_Finish_Preface (const int128u PrefaceUID); void Streams_Finish_ContentStorage (const int128u ContentStorageUID); void Streams_Finish_Package (const int128u PackageUID); void Streams_Finish_Track (const int128u TrackUID); void Streams_Finish_Essence (int32u EssenceUID, int128u TrackUID); void Streams_Finish_Descriptor (const int128u DescriptorUID, const int128u PackageUID); void Streams_Finish_Locator (const int128u DescriptorUID, const int128u LocatorUID); void Streams_Finish_Component (const int128u ComponentUID, float64 EditRate, int32u TrackID, int64u Origin); void Streams_Finish_Identification (const int128u IdentificationUID); void Streams_Finish_CommercialNames (); //Buffer - Global void Read_Buffer_Init (); void Read_Buffer_Continue (); void Read_Buffer_AfterParsing (); void Read_Buffer_Unsynched(); #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK //Buffer - File header bool FileHeader_Begin(); //Buffer - Synchro bool Synchronize(); bool Synched_Test(); //Buffer - Per element bool Header_Begin(); void Header_Parse(); void Data_Parse(); //Elements void Filler(); void Filler01() {Filler();} void Filler02() {Filler();} void TerminatingFiller(); void XmlDocumentText(); void SubDescriptors(); void Sequence(); void SourceClip(); void TimecodeComponent(); void ContentStorage(); void EssenceContainerData(); void CDCIEssenceDescriptor(); void RGBAEssenceDescriptor(); void Preface(); void Identification(); void NetworkLocator(); void TextLocator(); void StereoscopicPictureSubDescriptor(); void MaterialPackage(); void SourcePackage(); void EventTrack(); void StaticTrack(); void Track(); void DMSegment(); void GenericSoundEssenceDescriptor(); void GenericDataEssenceDescriptor(); void MultipleDescriptor(); void AES3PCMDescriptor(); void WaveAudioDescriptor(); void MPEG2VideoDescriptor(); void JPEG2000PictureSubDescriptor(); void VbiPacketsDescriptor(); void AncPacketsDescriptor(); void OpenIncompleteHeaderPartition(); void ClosedIncompleteHeaderPartition(); void OpenCompleteHeaderPartition(); void ClosedCompleteHeaderPartition(); void OpenIncompleteBodyPartition(); void ClosedIncompleteBodyPartition(); void OpenCompleteBodyPartition(); void ClosedCompleteBodyPartition(); void OpenIncompleteFooterPartition(); void ClosedIncompleteFooterPartition(); void OpenCompleteFooterPartition(); void ClosedCompleteFooterPartition(); void Primer(); void IndexTableSegment(); void RandomIndexMetadata(); void SDTI_SystemMetadataPack(); void SDTI_PackageMetadataSet(); void SDTI_PictureMetadataSet(); void SDTI_SoundMetadataSet(); void SDTI_DataMetadataSet(); void SDTI_ControlMetadataSet(); void SystemScheme1(); void DMScheme1(); void Omneon_010201010100(); void Omneon_010201020100(); //Common void GenerationInterchangeObject(); void InterchangeObject(); void GenericPictureEssenceDescriptor(); void PartitionMetadata(); void GenericTrack(); void GenericPackage(); void FileDescriptor(); void StructuralComponent(); void GenericDescriptor(); //Complex types void AES3PCMDescriptor_AuxBitsMode(); //3D08 void AES3PCMDescriptor_Emphasis(); //3D0D void AES3PCMDescriptor_BlockStartOffset(); //3D0F void AES3PCMDescriptor_ChannelStatusMode(); //3D10 void AES3PCMDescriptor_FixedChannelStatusData(); //3D11 void AES3PCMDescriptor_UserDataMode(); //3D12 void AES3PCMDescriptor_FixedUserData(); //3D13 void CDCIEssenceDescriptor_ComponentDepth(); //3301 void CDCIEssenceDescriptor_HorizontalSubsampling(); //3302 void CDCIEssenceDescriptor_ColorSiting(); //3303 void CDCIEssenceDescriptor_BlackRefLevel(); //3304 void CDCIEssenceDescriptor_WhiteReflevel(); //3305 void CDCIEssenceDescriptor_ColorRange(); //3306 void CDCIEssenceDescriptor_PaddingBits(); //3307 void CDCIEssenceDescriptor_VerticalSubsampling(); //3308 void CDCIEssenceDescriptor_AlphaSampleDepth(); //3309 void CDCIEssenceDescriptor_ReversedByteOrder(); //330B void ContentStorage_Packages(); //1901 void ContentStorage_EssenceContainerData(); //1902 void DMSegment_DMFramework(); //6101 void DMSegment_TrackIDs(); //6102 void EssenceContainerData_LinkedPackageUID(); //2701 void EssenceContainerData_IndexSID(); //3F06 void EssenceContainerData_BodySID(); //3F07 void EventTrack_EventEditRate(); //4901 void EventTrack_EventOrigin(); //4902 void FileDescriptor_SampleRate(); //3001 void FileDescriptor_ContainerDuration(); //3002 void FileDescriptor_EssenceContainer(); //3004 void FileDescriptor_Codec(); //3005 void FileDescriptor_LinkedTrackID(); //3006 void InterchangeObject_InstanceUID(); //3C0A void GenerationInterchangeObject_GenerationUID(); //0102 void GenericDescriptor_Locators(); //2F01 void GenericPackage_PackageUID(); //4401 void GenericPackage_Name(); //4402 void GenericPackage_Tracks(); //4403 void GenericPackage_PackageModifiedDate(); //4404 void GenericPackage_PackageCreationDate(); //4405 void GenericPictureEssenceDescriptor_PictureEssenceCoding();//3201 void GenericPictureEssenceDescriptor_StoredHeight(); //3202 void GenericPictureEssenceDescriptor_StoredWidth(); //3203 void GenericPictureEssenceDescriptor_SampledHeight(); //3204 void GenericPictureEssenceDescriptor_SampledWidth(); //3205 void GenericPictureEssenceDescriptor_SampledXOffset(); //3206 void GenericPictureEssenceDescriptor_SampledYOffset(); //3207 void GenericPictureEssenceDescriptor_DisplayHeight(); //3208 void GenericPictureEssenceDescriptor_DisplayWidth(); //3209 void GenericPictureEssenceDescriptor_DisplayXOffset(); //320A void GenericPictureEssenceDescriptor_DisplayYOffset(); //320B void GenericPictureEssenceDescriptor_FrameLayout(); //320C void GenericPictureEssenceDescriptor_VideoLineMap(); //320D void GenericPictureEssenceDescriptor_AspectRatio(); //320E void GenericPictureEssenceDescriptor_AlphaTransparency(); //320F void GenericPictureEssenceDescriptor_Gamma(); //3210 void GenericPictureEssenceDescriptor_ImageAlignmentOffset();//3211 void GenericPictureEssenceDescriptor_FieldDominance(); //3212 void GenericPictureEssenceDescriptor_ImageStartOffset(); //3213 void GenericPictureEssenceDescriptor_ImageEndOffset(); //3214 void GenericPictureEssenceDescriptor_SignalStandard(); //3215 void GenericPictureEssenceDescriptor_StoredF2Offset(); //3216 void GenericPictureEssenceDescriptor_DisplayF2Offset(); //3217 void GenericPictureEssenceDescriptor_ActiveFormatDescriptor();//3218 void GenericSoundEssenceDescriptor_QuantizationBits(); //3D01 void GenericSoundEssenceDescriptor_Locked(); //3D02 void GenericSoundEssenceDescriptor_AudioSamplingRate(); //3D03 void GenericSoundEssenceDescriptor_AudioRefLevel(); //3D04 void GenericSoundEssenceDescriptor_ElectroSpatialFormulation(); //3D05 void GenericSoundEssenceDescriptor_SoundEssenceCompression(); //3D06 void GenericSoundEssenceDescriptor_ChannelCount(); //3D07 void GenericSoundEssenceDescriptor_DialNorm(); //3D0C void GenericDataEssenceDescriptor_DataEssenceCoding(); //3E01 void GenericTrack_TrackID(); //4801 void GenericTrack_TrackName(); //4802 void GenericTrack_Sequence(); //4803 void GenericTrack_TrackNumber(); //4804 void Identification_CompanyName(); //3C01 void Identification_ProductName(); //3C02 void Identification_ProductVersion(); //3C03 void Identification_VersionString(); //3C04 void Identification_ProductUID(); //3C05 void Identification_ModificationDate(); //3C06 void Identification_ToolkitVersion(); //3C07 void Identification_Platform(); //3C08 void Identification_ThisGenerationUID(); //3C09 void IndexTableSegment_EditUnitByteCount(); //3F05 void IndexTableSegment_IndexSID(); //3F06 void IndexTableSegment_BodySID(); //3F07 void IndexTableSegment_SliceCount(); //3F08 void IndexTableSegment_DeltaEntryArray(); //3F09 void IndexTableSegment_IndexEntryArray(); //3F0A void IndexTableSegment_IndexEditRate(); //3F0B void IndexTableSegment_IndexStartPosition(); //3F0C void IndexTableSegment_IndexDuration(); //3F0D void IndexTableSegment_PosTableCount(); //3F0E void IndexTableSegment_8002(); //8002 void JPEG2000PictureSubDescriptor_Rsiz(); //8001 void JPEG2000PictureSubDescriptor_Xsiz(); //8002 void JPEG2000PictureSubDescriptor_Ysiz(); //8003 void JPEG2000PictureSubDescriptor_XOsiz(); //8004 void JPEG2000PictureSubDescriptor_YOsiz(); //8005 void JPEG2000PictureSubDescriptor_XTsiz(); //8006 void JPEG2000PictureSubDescriptor_YTsiz(); //8007 void JPEG2000PictureSubDescriptor_XTOsiz(); //8008 void JPEG2000PictureSubDescriptor_YTOsiz(); //8009 void JPEG2000PictureSubDescriptor_Csiz(); //800A void JPEG2000PictureSubDescriptor_PictureComponentSizing(); //800B void MultipleDescriptor_SubDescriptorUIDs(); //3F01 void DMScheme1_PrimaryExtendedSpokenLanguage(); // void DMScheme1_SecondaryExtendedSpokenLanguage(); // void DMScheme1_OriginalExtendedSpokenLanguage(); // void MPEG2VideoDescriptor_SingleSequence(); // void MPEG2VideoDescriptor_ConstantBFrames(); // void MPEG2VideoDescriptor_CodedContentType(); // void MPEG2VideoDescriptor_LowDelay(); // void MPEG2VideoDescriptor_ClosedGOP(); // void MPEG2VideoDescriptor_IdenticalGOP(); // void MPEG2VideoDescriptor_MaxGOP(); // void MPEG2VideoDescriptor_BPictureCount(); // void MPEG2VideoDescriptor_ProfileAndLevel(); // void MPEG2VideoDescriptor_BitRate(); // void NetworkLocator_URLString(); //4001 void Preface_LastModifiedDate(); //3B02 void Preface_ContentStorage(); //3B03 void Preface_Version(); //3B05 void Preface_Identifications(); //3B06 void Preface_ObjectModelVersion(); //3B07 void Preface_PrimaryPackage(); //3B08 void Preface_OperationalPattern(); //3B09 void Preface_EssenceContainers(); //3B0A void Preface_DMSchemes(); //3B0B void RGBAEssenceDescriptor_PixelLayout(); //3401 void RGBAEssenceDescriptor_Palette(); //3403 void RGBAEssenceDescriptor_PaletteLayout(); //3404 void RGBAEssenceDescriptor_ScanningDirection(); //3405 void RGBAEssenceDescriptor_ComponentMaxRef(); //3406 void RGBAEssenceDescriptor_ComponentMinRef(); //3407 void RGBAEssenceDescriptor_AlphaMaxRef(); //3408 void RGBAEssenceDescriptor_AlphaMinRef(); //3409 void Sequence_StructuralComponents(); //1001 void SourceClip_SourcePackageID(); //1101 void SourceClip_SourceTrackID(); //1102 void SourceClip_StartPosition(); //1201 void SourcePackage_Descriptor(); //4701 void StructuralComponent_DataDefinition(); //0201 void StructuralComponent_Duration(); //0202 void SystemScheme1_TimeCodeArray(); //0102 void TextLocator_LocatorName(); //4101 void TimecodeComponent_StartTimecode(); //1501 void TimecodeComponent_RoundedTimecodeBase(); //1502 void TimecodeComponent_DropFrame(); //1503 void Track_EditRate(); //4B01 void Track_Origin(); //4B02 void WaveAudioDescriptor_AvgBps(); //3D09 void WaveAudioDescriptor_BlockAlign(); //3D0A void WaveAudioDescriptor_SequenceOffset(); //3D0B void WaveAudioDescriptor_PeakEnvelopeVersion(); //3D29 void WaveAudioDescriptor_PeakEnvelopeFormat(); //3D2A void WaveAudioDescriptor_PointsPerPeakValue(); //3D2B void WaveAudioDescriptor_PeakEnvelopeBlockSize(); //3D2C void WaveAudioDescriptor_PeakChannels(); //3D2D void WaveAudioDescriptor_PeakFrames(); //3D2E void WaveAudioDescriptor_PeakOfPeaksPosition(); //3D2F void WaveAudioDescriptor_PeakEnvelopeTimestamp(); //3D30 void WaveAudioDescriptor_PeakEnvelopeData(); //3D31 void WaveAudioDescriptor_ChannelAssignment(); //3D31 void Omneon_010201010100_8001(); //8001 void Omneon_010201010100_8003(); //8003 void Omneon_010201020100_8002(); //8002 void Omneon_010201020100_8003(); //8003 void Omneon_010201020100_8004(); //8004 void Omneon_010201020100_8005(); //8005 void Omneon_010201020100_8006(); //8006 //Basic types void Get_Rational(float64 &Value); void Skip_Rational(); void Info_Rational(); void Get_Timestamp (Ztring &Value); void Skip_Timestamp(); void Info_Timestamp(); void Get_UMID (int256u &Value, const char* Name); void Skip_UMID (); void Get_UL (int128u &Value, const char* Name, const char* (*Param) (int128u)); void Skip_UL(const char* Name); void Get_BER(int64u &Value, const char* Name); #if MEDIAINFO_TRACE void Info_UL_01xx01_Items (); void Info_UL_02xx01_Groups (); void Info_UL_040101_Values (); #define Info_UL(_INFO, _NAME, _PARAM) int128u _INFO; Get_UL(_INFO, _NAME, _PARAM) #else //MEDIAINFO_TRACE void Info_UL_01xx01_Items () {Element_Offset+=8;}; void Info_UL_02xx01_Groups () {Element_Offset+=8;}; void Info_UL_040101_Values () {Element_Offset+=8;}; #define Info_UL(_INFO, _NAME, _PARAM) int128u _INFO; #endif //MEDIAINFO_TRACE struct randomindexmetadata { int64u ByteOffset; int32u BodySID; }; std::vector RandomIndexMetadatas; bool RandomIndexMetadatas_AlreadyParsed; std::set PartitionPack_AlreadyParsed; size_t Streams_Count; int128u Code; int128u OperationalPattern; int128u InstanceUID; int64u Buffer_Begin; int64u Buffer_End; bool Buffer_End_Unlimited; int64u Buffer_Header_Size; int16u Code2; int16u Length2; int64u File_Size_Total; //Used only in Finish() int64u IsParsingMiddle_MaxOffset; bool Track_Number_IsAvailable; bool IsParsingEnd; bool IsCheckingRandomAccessTable; bool IsCheckingFooterPartitionAddress; bool FooterPartitionAddress_Jumped; bool PartitionPack_Parsed; size_t IdIsAlwaysSame_Offset; //Primer std::map Primer_Values; //Preface struct preface { int128u PrimaryPackage; std::vector Identifications; int128u ContentStorage; preface() { PrimaryPackage.hi=(int64u)-1; PrimaryPackage.lo=(int64u)-1; ContentStorage.hi=(int64u)-1; ContentStorage.lo=(int64u)-1; } }; typedef std::map prefaces; //Key is InstanceUID of preface prefaces Prefaces; int128u Preface_Current; //Identification struct identification { Ztring CompanyName; Ztring ProductName; Ztring ProductVersion; Ztring VersionString; std::map Infos; }; typedef std::map identifications; //Key is InstanceUID of identification identifications Identifications; //ContentStorage struct contentstorage { std::vector Packages; }; typedef std::map contentstorages; //Key is InstanceUID of ContentStorage contentstorages ContentStorages; //Package struct package { int256u PackageUID; int128u Descriptor; std::vector Tracks; bool IsSourcePackage; package() { Descriptor=0; IsSourcePackage=false; } }; typedef std::map packages; //Key is InstanceUID of package packages Packages; //Track struct track { int128u Sequence; int32u TrackID; Ztring TrackName; int32u TrackNumber; float64 EditRate; int64u Origin; bool Stream_Finish_Done; track() { Sequence=0; TrackID=(int32u)-1; TrackNumber=(int32u)-1; EditRate=(float64)0; Origin=0; Stream_Finish_Done=false; } }; typedef std::map tracks; //Key is InstanceUID of the track tracks Tracks; //Essence typedef std::vector parsers; struct essence { stream_t StreamKind; size_t StreamPos; size_t StreamPos_Initial; parsers Parsers; std::map Infos; int64u Stream_Size; int32u TrackID; bool TrackID_WasLookedFor; bool Stream_Finish_Done; bool Track_Number_IsMappedToTrack; //if !Track_Number_IsAvailable, is true when it was euristicly mapped bool IsFilled; bool IsChannelGrouping; int64u Frame_Count_NotParsedIncluded; frame_info FrameInfo; essence() { StreamKind=Stream_Max; StreamPos=(size_t)-1; StreamPos_Initial=(size_t)-1; Stream_Size=(int64u)-1; TrackID=(int32u)-1; TrackID_WasLookedFor=false; Stream_Finish_Done=false; Track_Number_IsMappedToTrack=false; IsFilled=false; IsChannelGrouping=false; Frame_Count_NotParsedIncluded=(int64u)-1; FrameInfo.DTS=(int64u)-1; } ~essence() { for (size_t Pos=0; Pos essences; //Key is TrackNumber essences Essences; //Descriptor struct descriptor { std::vector SubDescriptors; std::vector Locators; Ztring ScanType; stream_t StreamKind; size_t StreamPos; float64 SampleRate; float64 DisplayAspectRatio; int128u InstanceUID; int128u EssenceContainer; int128u EssenceCompression; int32u LinkedTrackID; int32u Width; int32u Width_Display; int32u Width_Display_Offset; int32u Height; int32u Height_Display; int32u Height_Display_Offset; int32u SubSampling_Horizontal; int32u SubSampling_Vertical; int32u ChannelCount; std::map Infos; int16u BlockAlign; int32u QuantizationBits; int64u Duration; int8u ActiveFormat; int8u FieldTopness; int8u FieldDominance; enum type { Type_Unknown, Type_CDCI, Type_RGBA, Type_MPEG2Video, Type_WaveAudio, Type_AES3PCM, Type_JPEG2000Picture, Type_AncPackets, }; type Type; bool HasBFrames; bool HasMPEG2VideoDescriptor; bool IsAes3Descriptor; int32u ByteRate; descriptor() { StreamKind=Stream_Max; StreamPos=(size_t)-1; SampleRate=0; DisplayAspectRatio=0; InstanceUID.hi=(int64u)-1; InstanceUID.lo=(int64u)-1; EssenceContainer.hi=(int64u)-1; EssenceContainer.lo=(int64u)-1; EssenceCompression.hi=(int64u)-1; EssenceCompression.lo=(int64u)-1; LinkedTrackID=(int32u)-1; Width=(int32u)-1; Width_Display=(int32u)-1; Width_Display_Offset=(int32u)-1; Height=(int32u)-1; Height_Display=(int32u)-1; Height_Display_Offset=(int32u)-1; SubSampling_Horizontal=(int32u)-1; SubSampling_Vertical=(int32u)-1; ChannelCount=(int32u)-1; BlockAlign=(int16u)-1; QuantizationBits=(int32u)-1; Duration=(int64u)-1; ActiveFormat=(int8u)-1; FieldTopness=(int8u)-1; //Field x is upper field FieldDominance=1; //Default is field 1 temporaly first Type=Type_Unknown; HasBFrames=false; HasMPEG2VideoDescriptor=false; IsAes3Descriptor=false; ByteRate=(int32u)-1; } }; typedef std::map descriptors; //Key is InstanceUID of Descriptor descriptors Descriptors; //Locator struct locator { Ztring EssenceLocator; stream_t StreamKind; size_t StreamPos; int32u LinkedTrackID; bool IsTextLocator; locator() { StreamKind=Stream_Max; StreamPos=(size_t)-1; LinkedTrackID=(int32u)-1; IsTextLocator=false; } ~locator() { } }; typedef std::map locators; //Key is InstanceUID of the locator locators Locators; File__ReferenceFilesHelper* ReferenceFiles; #if MEDIAINFO_NEXTPACKET bool ReferenceFiles_IsParsing; #endif //MEDIAINFO_NEXTPACKET //Component (Sequence, TimeCode, Source Clip) struct component { int64u Duration; int256u SourcePackageID; //Sequence from SourcePackage only int32u SourceTrackID; std::vector StructuralComponents; //Sequence from MaterialPackage only //Time code component int16u TimeCode_RoundedTimecodeBase; int64u TimeCode_StartTimecode; bool TimeCode_DropFrame; component() { Duration=(int64u)-1; SourceTrackID=(int32u)-1; //Time code component TimeCode_RoundedTimecodeBase=(int16u)-1; TimeCode_StartTimecode=(int64u)-1; TimeCode_DropFrame=false; } void Update (struct component &New) { if (New.Duration!=(int64u)-1) Duration=New.Duration; if (New.SourcePackageID.hi || New.SourcePackageID.lo) SourcePackageID=New.SourcePackageID; if (New.SourceTrackID!=(int32u)-1) SourceTrackID=New.SourceTrackID; if (!New.StructuralComponents.empty()) StructuralComponents=New.StructuralComponents; if (New.TimeCode_StartTimecode!=(int64u)-1) TimeCode_StartTimecode=New.TimeCode_StartTimecode; if (New.TimeCode_RoundedTimecodeBase!=(int16u)-1) { TimeCode_RoundedTimecodeBase=New.TimeCode_RoundedTimecodeBase; TimeCode_DropFrame=New.TimeCode_DropFrame; } } }; typedef std::map components; //Key is InstanceUID of the component components Components; //Descriptive Metadata - DMSegments struct dmsegment { int128u Framework; std::vector TrackIDs; dmsegment() { } ~dmsegment() { } }; typedef std::map dmsegments; //Key is InstanceUID of the DMSegment dmsegments DMSegments; //Descriptive Metadata - DMScheme1 struct dmscheme1 { Ztring PrimaryExtendedSpokenLanguage; dmscheme1() { } ~dmscheme1() { } }; typedef std::map dmscheme1s; //Key is InstanceUID of the DMScheme1 dmscheme1s DMScheme1s; //Parsers void ChooseParser__FromEssence(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser__Aaf(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser__Aaf_CP_Picture(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser__Aaf_CP_Sound(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser__Aaf_CP_Data(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser__Aaf_14(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser__Aaf_GC_Picture(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser__Aaf_GC_Sound(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser__Aaf_GC_Data(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser__Aaf_GC_Compound(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser__Avid(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser__Avid_Picture(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser__FromEssenceContainer(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser_Avc(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser_DV(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser_Mpeg4v(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser_Mpegv(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser_Raw(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser_RV24(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser_Vc3(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser_Aac(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser_Ac3(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser_Alaw(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser_ChannelGrouping(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser_Mpega(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser_Pcm(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser_SmpteSt0331(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser_SmpteSt0337(const essences::iterator &Essence, const descriptors::iterator &Descriptor); void ChooseParser_Jpeg2000(const essences::iterator &Essence, const descriptors::iterator &Descriptor); //Helpers void Subsampling_Compute(descriptors::iterator Descriptor); void Locators_CleanUp(); void Locators_Test(); void TryToFinish(); //Temp int128u EssenceContainer_FromPartitionMetadata; int64u PartitionMetadata_PreviousPartition; int64u PartitionMetadata_FooterPartition; int64u TimeCode_StartTimecode; int16u TimeCode_RoundedTimecodeBase; bool TimeCode_DropFrame; float64 DTS_Delay; //In seconds bool StreamPos_StartAtOne; //information about the base of StreamPos (0 or 1, 1 is found in 1 file) string SDTI_TimeCode_StartTimecode; int64u SDTI_TimeCode_StartTimecode_ms; int64u SDTI_SizePerFrame; bool SDTI_IsPresent; //Used to test if SDTI packet is used for Index StreamOffset calculation bool SDTI_IsInIndexStreamOffset; //Used to test if SDTI packet is used for Index StreamOffset calculation string SystemScheme1_TimeCodeArray_StartTimecode; int64u SystemScheme1_TimeCodeArray_StartTimecode_ms; int64u SystemScheme1_FrameRateFromDescriptor; bool Essences_FirstEssence_Parsed; bool StereoscopicPictureSubDescriptor_IsPresent; int32u IndexTable_NSL; int32u IndexTable_NPE; #if MEDIAINFO_ADVANCED int64u Footer_Position; #endif //MEDIAINFO_ADVANCED #if defined(MEDIAINFO_ANCILLARY_YES) File_Ancillary* Ancillary; bool Ancillary_IsBinded; #endif //defined(MEDIAINFO_ANCILLARY_YES) //Hints size_t* File_Buffer_Size_Hint_Pointer; //Partitions struct partition { int64u StreamOffset; //From file, not MXF one int64u PartitionPackByteCount; //Fill included int64u FooterPartition; int64u HeaderByteCount; int64u IndexByteCount; int64u BodyOffset; partition() { StreamOffset=0; PartitionPackByteCount=(int64u)-1; FooterPartition=0; HeaderByteCount=0; IndexByteCount=0; BodyOffset=0; } bool operator < (const partition& lhs) const { return StreamOffset partitions; partitions Partitions; size_t Partitions_Pos; bool Partitions_IsCalculatingHeaderByteCount; bool Partitions_IsCalculatingSdtiByteCount; bool Partitions_IsFooter; #if MEDIAINFO_DEMUX || MEDIAINFO_SEEK bool Demux_HeaderParsed; size_t CountOfLocatorsToParse; float64 Demux_Rate; //IndexTable struct indextable { int64u StreamOffset; //From file, not MXF one int64u IndexStartPosition; int64u IndexDuration; int32u EditUnitByteCount; float64 IndexEditRate; struct entry { int64u StreamOffset; int8u Type; }; std::vector Entries; indextable() { StreamOffset=(int64u)-1; IndexStartPosition=0; IndexDuration=0; EditUnitByteCount=0; IndexEditRate=0; } bool operator < (const indextable& lhs) const { return IndexStartPosition indextables; indextables IndexTables; size_t IndexTables_Pos; //Other int64u Clip_Header_Size; int64u Clip_Begin; int64u Clip_End; int128u Clip_Code; int64u OverallBitrate_IsCbrForSure; bool Duration_Detected; bool DetectDuration(); #endif //MEDIAINFO_DEMUX || MEDIAINFO_SEEK }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Nut.cpp100777 0 0 23470 12226004262 15600 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Source: http://svn.mplayerhq.hu/nut/docs/nut.txt?view=markup // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_NUT_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Nut.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Const //*************************************************************************** //--------------------------------------------------------------------------- namespace Elements { const int64u main =0x4E4D7A561F5F04ADLL; const int64u stream =0x4E5311405BF2F9DBLL; const int64u syncpoint =0x4E4BE4ADEECA4569LL; const int64u index =0x4E58DD672F23E64ELL; const int64u info =0x4E49AB68B596BA78LL; } //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- void File_Nut::Header_Parse() { /* //Parsing int8u N; Peek_B1(N); if (N==0x4E) //'N' { //Header int64u startcode, forward_ptr; Get_B8(startcode, "startcode"); Get_VS(forward_ptr, "forward_ptr"); if (forward_ptr>4096) Skip_B4( "header_checksum"); Header_Fill_Code(startcode, Ztring().From_Number(startcode, 16)); //Quick filling for CC8 with text Header_Fill_Size(Element_Offset+forward_ptr); //4 for cheksum } else { //Frame Header_Fill_Code(0, "Frame"); Header_Fill_Size(0); Finished(); } */ } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Nut::FileHeader_Parse() { //Parsing Element_Begin1("Nut header"); std::string file_id_string; Get_String(25, file_id_string, "file_id_string"); Element_End0(); FILLING_BEGIN(); //Integrity if (file_id_string!="nut/multimedia container") { Reject("Nut"); return; } //Filling Accept("Nut"); Fill(Stream_General, 0, General_Format, "Nut"); Finish("Nut"); FILLING_END(); } //--------------------------------------------------------------------------- void File_Nut::Data_Parse() { } /* //--------------------------------------------------------------------------- void File_Nut::Data_Parse() { #define ELEMENT_CASE(_NAME) \ case Elements::_NAME : _NAME(); break; //Parsing #ifndef __BORLANDC__ switch (Element_Code) #else //__BORLANDC__ switch (Element_Code&0xFFFFFFFF) //Borland does not like int64u for const? #endif //__BORLANDC__ { ELEMENT_CASE(main); ELEMENT_CASE(stream); ELEMENT_CASE(syncpoint); ELEMENT_CASE(index); ELEMENT_CASE(info); default : Skip_XX(Element_Size-4, "Data"); } Skip_B4( "cheksum"); } */ //*************************************************************************** // Elements //*************************************************************************** /* //--------------------------------------------------------------------------- void File_Nut::main() { Element_Name("main"); //Parsing int64u time_base_count; Skip_VS( "version"); Skip_VS( "stream_count"); Skip_VS( "max_distance"); Get_VS (time_base_count, "time_base_count"); for(int64u i=0; i0) Skip_SL( "tmp_pts"); if(tmp_fields>1) Skip_VS( "tmp_mul"); if(tmp_fields>2) Skip_VS( "tmp_stream"); if(tmp_fields>3) Get_VS (tmp_size, "tmp_size"); else tmp_size=0; if(tmp_fields>4) Get_VS (tmp_res, "tmp_res"); else tmp_res=0; if(tmp_fields>5) Skip_VS( "count"); else count=tmp_mul-tmp_size; for(int64u j=6; j::iterator Stream_Temp=Stream.begin(); while (Stream_Temp!=Stream.end()) { //Filling if (Stream_Temp->second.Parser) { Stream_Temp->second.Parser->Fill(); Merge(*Stream_Temp->second.Parser); Merge(*Stream_Temp->second.Parser, Stream_General, 0, 0); Stream_Temp->second.StreamKind=((File_Ogg_SubElement*)Stream_Temp->second.Parser)->StreamKind; Stream_Temp->second.StreamPos=Count_Get(Stream_Temp->second.StreamKind)-1; if (!SizedBlocks && !XiphLacing) Stream_Temp->second.absolute_granule_position_Resolution=((File_Ogg_SubElement*)Stream_Temp->second.Parser)->absolute_granule_position_Resolution; if (Stream_Temp->second.StreamKind==Stream_Audio && Stream_Temp->second.absolute_granule_position_Resolution==0) Stream_Temp->second.absolute_granule_position_Resolution=Retrieve(Stream_Audio, Stream_Temp->second.StreamPos, Audio_SamplingRate).To_int64u(); if (!IsSub && Stream_Temp->second.absolute_granule_position && Stream_Temp->second.absolute_granule_position_Resolution) { if (Stream_Temp->second.StreamKind==Stream_Audio) Fill(Stream_Temp->second.StreamKind, Stream_Temp->second.StreamPos, Fill_Parameter(Stream_Temp->second.StreamKind, Generic_Duration), float64_int64s(((float64)(Stream_Temp->second.absolute_granule_position))*1000/Stream_Temp->second.absolute_granule_position_Resolution), 10, true); } if (!IsSub) { if (Stream_Temp->second.StreamKind==Stream_Max) { Stream_Temp->second.StreamKind=Stream_General; Stream_Temp->second.StreamPos=0; } Fill(Stream_Temp->second.StreamKind, Stream_Temp->second.StreamPos, General_ID, Stream_Temp->first); Fill(Stream_Temp->second.StreamKind, Stream_Temp->second.StreamPos, General_ID_String, Ztring::ToZtring(Stream_Temp->first)+__T(" (0x")+Ztring::ToZtring(Stream_Temp->first, 16)+__T(')'), true); } } ++Stream_Temp; } Fill(Stream_General, 0, General_Format, "OGG", Unlimited, true, true); if (Count_Get(Stream_Video)==0 && Count_Get(Stream_Image)==0) Fill(Stream_General, 0, General_InternetMediaType, "audio/ogg", Unlimited, true, true); } //--------------------------------------------------------------------------- void File_Ogg::Streams_Finish() { std::map::iterator Stream_Temp=Stream.begin(); while (Stream_Temp!=Stream.end()) { //Filling if (Stream_Temp->second.Parser) { Finish(Stream_Temp->second.Parser); Merge(*Stream_Temp->second.Parser, Stream_Temp->second.StreamKind, 0, Stream_Temp->second.StreamPos); Merge(*Stream_Temp->second.Parser, Stream_General, 0, 0); } ++Stream_Temp; } //No more need if (!File_Name.empty()) //Only if this is not a buffer, with buffer we can have more data Stream.clear(); } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Ogg::FileHeader_Begin() { //Must have enough buffer for having header if (Buffer_Size<4) return false; //Must wait for more data //False positives detection: Detect AVI files, or the parser can synchronize with OggS stream in a AVI chunk if (CC4(Buffer)==0x52494646) //"RIFF" { Finish("OGG"); return false; } //All should be OK... return true; } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Ogg::Synchronize() { //Synchronizing while (Buffer_Offset+4<=Buffer_Size) { while(Buffer_Offset+4<=Buffer_Size && (Buffer[Buffer_Offset ]!=0x4F || Buffer[Buffer_Offset+1]!=0x67 || Buffer[Buffer_Offset+2]!=0x67 || Buffer[Buffer_Offset+3]!=0x53)) //"OggS" { Buffer_Offset+=1+2; while(Buffer_Offset=Buffer_Size || Buffer[Buffer_Offset-1]==0x67) Buffer_Offset--; Buffer_Offset--; } if (Buffer_Offset+4<=Buffer_Size) //Testing if size is coherant { //Retrieving some info if (Buffer_Offset+27>Buffer_Size) return false; //Need more data int8u page_segments=CC1(Buffer+Buffer_Offset+26); if (Buffer_Offset+27+page_segments>Buffer_Size) return false; //Need more data size_t Size=0; for (int8u Pos=0; PosBuffer_Size) return false; //Need more data if (CC4(Buffer+Buffer_Offset+27+page_segments+Size)!=0x4F676753) //"OggS" Buffer_Offset++; else break; } } //Parsing last bytes if needed if (Buffer_Offset+4>Buffer_Size) { if (Buffer_Offset+3==Buffer_Size && CC3(Buffer+Buffer_Offset)!=0x4F6767) //"Ogg" Buffer_Offset++; if (Buffer_Offset+2==Buffer_Size && CC2(Buffer+Buffer_Offset)!=0x4F67) //"Og" Buffer_Offset++; if (Buffer_Offset+1==Buffer_Size && CC1(Buffer+Buffer_Offset)!=0x4F) //"O" Buffer_Offset++; return false; } //Synched is OK return true; } //--------------------------------------------------------------------------- bool File_Ogg::Synched_Test() { //Must have enough buffer for having header if (Buffer_Offset+4>Buffer_Size) return false; //Quick test of synchro if (CC4(Buffer+Buffer_Offset)!=0x4F676753) //"OggS" Synched=false; //We continue return true; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Ogg::Header_Parse() { //Specific case if (SizedBlocks) { int16u Size; Get_B2 (Size, "Size"); Chunk_Sizes.clear(); Chunk_Sizes.push_back(Size); Header_Fill_Size(2+Size); Header_Fill_Code(0, Ztring::ToZtring(0, 16)); return; } if (XiphLacing) { if (Chunk_Sizes.empty()) { int8u CountMinus1; Get_B1 (CountMinus1, "Number of frames minus one"); int64u UsedSize=0; for (size_t Pos=0; PosInAnotherContainer=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_PosFile_Offset!=Parser->File_Size) Open_Buffer_Continue(Parser, Buffer+Buffer_Offset+(size_t)Element_Offset, Chunk_Sizes[Chunk_Sizes_Pos]); if (Chunk_Sizes_PosFile_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::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(); } } //NameSpace #endif //MEDIAINFO_OGG_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Ogg.h100777 0 0 5027 12226004262 15171 0/* 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 Ogg files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_OggH #define MediaInfo_File_OggH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Ogg //*************************************************************************** class File_Ogg : public File__Analyze { public : //In bool SizedBlocks; bool XiphLacing; //Constructor/Destructor File_Ogg(); private : //Streams management void Streams_Fill(); void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); //Buffer - Synchro bool Synchronize(); bool Synched_Test(); //Buffer - Per element void Header_Parse(); void Header_Parse_AdaptationField(); void Data_Parse(); //Temp - Global int32u StreamsToDo; bool Parsing_End; //Temp - Stream struct stream { File__Analyze* Parser; stream_t StreamKind; size_t StreamPos; bool SearchingPayload; bool SearchingTimeCode; int64u absolute_granule_position; int64u absolute_granule_position_Resolution; stream() { Parser=NULL; StreamKind=Stream_Max; StreamPos=(size_t)-1; SearchingPayload=true; SearchingTimeCode=true; absolute_granule_position=0; absolute_granule_position_Resolution=0; } ~stream() { delete Parser; //Parser=NULL } }; int8u packet_type; bool continued; bool eos; bool continued_NextFrame; std::map Stream; std::vector Chunk_Sizes; bool Chunk_Sizes_Finished; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Ogg_SubElement.cpp100777 0 0 76115 12226004262 17675 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_OGG_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Ogg_SubElement.h" #include "MediaInfo/Tag/File_VorbisCom.h" #include "ZenLib/ZtringListList.h" #include "ZenLib/BitStream.h" #include "ZenLib/Utils.h" #include #include #if defined(MEDIAINFO_DIRAC_YES) #include "MediaInfo/Video/File_Dirac.h" #endif #if defined(MEDIAINFO_MPEG4V_YES) #include "MediaInfo/Video/File_Mpeg4v.h" #endif #if defined(MEDIAINFO_AC3_YES) #include "MediaInfo/Audio/File_Ac3.h" #endif #if defined(MEDIAINFO_CELT_YES) #include "MediaInfo/Audio/File_Celt.h" #endif #if defined(MEDIAINFO_FLAC_YES) #include "MediaInfo/Audio/File_Flac.h" #endif #if defined(MEDIAINFO_MPEGA_YES) #include "MediaInfo/Audio/File_Mpega.h" #endif #if defined(MEDIAINFO_OPUS_YES) #include "MediaInfo/Audio/File_Opus.h" #endif #if defined(MEDIAINFO_SPEEX_YES) #include "MediaInfo/Audio/File_Speex.h" #endif #if defined(MEDIAINFO_THEORA_YES) #include "MediaInfo/Video/File_Theora.h" #endif #if defined(MEDIAINFO_VORBIS_YES) #include "MediaInfo/Audio/File_Vorbis.h" #endif #if defined(MEDIAINFO_CMML_YES) #include "MediaInfo/Text/File_Cmml.h" #endif #if defined(MEDIAINFO_KATE_YES) #include "MediaInfo/Text/File_Kate.h" #endif using namespace ZenLib; using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { #ifdef __BORLANDC__ //Borland converts int64u to int32u without error or warning #define OGG_ID(NAME, PART1, PART2, COUNT) \ const int32u Identifier_##NAME##1=0x##PART1; \ const int32u Identifier_##NAME##2=0x##PART2; \ const size_t Identifier_##NAME##3=0x##COUNT; \ #elif defined(WINDOWS) //__BORLANDC__ #define OGG_ID(NAME, PART1, PART2, COUNT) \ const int64u Identifier_##NAME=(int64u)0x##PART1##PART2##ULL; \ const size_t Identifier_##NAME##3=0x##COUNT; \ #else //__BORLANDC__ #define OGG_ID(NAME, PART1, PART2, COUNT) \ const int64u Identifier_##NAME=(int64u)0x##PART1##PART2##LL; \ const size_t Identifier_##NAME##3=0x##COUNT; \ #endif //__BORLANDC__ namespace Elements { const int32u fLaC=0x664C6143; //http://wiki.xiph.org/index.php/MIMETypesCodecs OGG_ID(CELT, 43454C54, 20202020, 8) OGG_ID(CMML, 434D4D4C, 00000000, 8) OGG_ID(BBCD, 42, 42434400, 5) OGG_ID(FLAC, 7F, 464C4143, 5) OGG_ID(JNG, 8B4A4E47, 0D0A1A0A, 8) OGG_ID(kate, 806B6174, 65000000, 8) OGG_ID(kateTags, 6B617465, 00000000, 8) OGG_ID(KW_DIRAC, 4B572D44, 49524143, 8) OGG_ID(OggMIDI, 4D67674D, 49444900, 8) OGG_ID(MNG, 8A4D4E47, 0D0A1A0A, 8) OGG_ID(OpusHead, 4F707573, 48656164, 8) OGG_ID(OpusTags, 4F707573, 54616773, 8) OGG_ID(PCM, 50434D20, 20202020, 8) OGG_ID(PNG, 89504E47, 0D0A1A0A, 8) OGG_ID(Speex, 53706565, 78202020, 8) OGG_ID(theora, 807468, 656F7261, 7) OGG_ID(vorbis, 01766F, 72626973, 7) OGG_ID(YUV4MPEG, 59555634, 4D504547, 8) //Not Xiph registered, but found OGG_ID(video, 017669, 64656F00, 7) OGG_ID(audio, 016175, 64696F00, 7) OGG_ID(text, 017465, 78740000, 7) OGG_ID(fLaC, 0, 664C6143, 4) //Ogg Skeleton OGG_ID(fishead, 66697368, 65616400, 8) OGG_ID(fisbone, 66697362, 6F6E6500, 8) } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Ogg_SubElement::File_Ogg_SubElement() :File__Analyze() { //In StreamKind=Stream_Max; MultipleStreams=false; InAnotherContainer=false; absolute_granule_position_Resolution=0; //Temp Parser=NULL; OldSize=0; Identified=false; WithType=true; } //--------------------------------------------------------------------------- File_Ogg_SubElement::~File_Ogg_SubElement() { delete Parser; //Parser=NULL; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Ogg_SubElement::Streams_Fill() { if (Parser==NULL) return; Fill(Parser); if (Parser->Count_Get(Stream_Video)) { //Hack - Before Ztring Codec_Temp=Retrieve(Stream_Video, 0, Video_Codec); //We want to keep the 4CC of AVI Merge(*Parser, Stream_Video, 0, 0); //Hacks - After if (!Codec_Temp.empty()) Fill(Stream_Video, StreamPos_Last, Video_Codec, Codec_Temp, true); } if (Parser->Count_Get(Stream_Audio)) { //Hack - Before Ztring Codec_Temp=Retrieve(Stream_Audio, 0, Audio_Codec); //We want to keep the 2CC of AVI Merge(*Parser, Stream_Audio, 0, 0); //Hacks - After if (!Codec_Temp.empty()) Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Codec_Temp, true); } Merge(*Parser, Stream_Text, 0, 0); Merge(*Parser, Stream_Image, 0, 0); } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Streams_Finish() { if (Parser==NULL) return; Finish(Parser); if (Parser->Count_Get(Stream_Video)) { //Hack - Before Ztring Codec_Temp=Retrieve(Stream_Video, 0, Video_Codec); //We want to keep the 4CC of AVI Merge(*Parser, Stream_Video, 0, 0); //Hacks - After if (!Codec_Temp.empty()) Fill(Stream_Video, StreamPos_Last, Video_Codec, Codec_Temp, true); } if (Parser->Count_Get(Stream_Audio)) { //Hack - Before Ztring Codec_Temp=Retrieve(Stream_Audio, 0, Audio_Codec); //We want to keep the 2CC of AVI Merge(*Parser, Stream_Audio, 0, 0); //Hacks - After if (!Codec_Temp.empty()) Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Codec_Temp, true); } Merge(*Parser, Stream_Text, 0, 0); Merge(*Parser, Stream_Image, 0, 0); } //*************************************************************************** // Format //*************************************************************************** //--------------------------------------------------------------------------- void File_Ogg_SubElement::FileHeader_Parse() { Accept("OGG (Sub element)"); } //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- bool File_Ogg_SubElement::Header_Begin() { //Already parsed (there is only one pass) if (Buffer_Offset!=0) return false; //We are waiting for the end of the stream, signaled by a empty buffer adding if (Buffer_Size!=OldSize) { OldSize=Buffer_Size; return false; } else { OldSize=0; return true; } } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Header_Parse() { //Parsing int8u Type; if (Identified && WithType) { bool lenbytes0, lenbytes1, lenbytes2; Get_L1 (Type, "Type"); Skip_Flags(Type, 0, "Indicates data packet"); Get_Flags (Type, 1, lenbytes2, "Bit 2 of lenbytes"); Skip_Flags(Type, 2, "unused"); Skip_Flags(Type, 3, "Keyframe"); Skip_Flags(Type, 4, "unused"); Skip_Flags(Type, 5, "unused"); Get_Flags (Type, 6, lenbytes0, "Bit 0 of lenbytes"); Get_Flags (Type, 7, lenbytes1, "Bit 1 of lenbytes"); if ((Type&0x01)==0) //TODO : find a better algo { if (lenbytes2) { if (lenbytes1) { if (lenbytes0) Skip_L7( "SamplesCount"); else Skip_L6( "SamplesCount"); } else { if (lenbytes0) Skip_L5( "SamplesCount"); else Skip_L4( "SamplesCount"); } } else { if (lenbytes1) { if (lenbytes0) Skip_L3 ( "SamplesCount"); else Skip_L2 ( "SamplesCount"); } else { if (lenbytes0) Skip_L1 ( "SamplesCount"); } } } //Filling Header_Fill_Code(Type, Ztring::ToZtring(Type, 16)); } else //Filling Header_Fill_Code(0, "Identification"); //Filling Header_Fill_Size(Element_Size); } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Data_Parse() { //Parsing if (!Identified) Identification(); else if (!WithType) Default(); else switch (Element_Code&0x7F) { case 0x01 : case 0x03 : Comment(); break; case 0x00 : case 0x02 : case 0x05 : case 0x08 : Default(); break; default : Skip_XX(Element_Size, "Unknown"); Finish("OggSubElement"); } } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification() { Element_Name("Identification"); //Parsing int64u ID_Identification; if (Element_Size==4) { int32u ID_Identification_32; Peek_B4(ID_Identification_32); ID_Identification=((int64u)ID_Identification_32)<<32; } else Peek_B8(ID_Identification); //Filling #undef ELEMENT_CASE #ifdef __BORLANDC__ //Borland converts int64u to int32u #define ELEMENT_CASE(_NAME) \ else if (ID_Identification>>(64-8*Elements::Identifier_##_NAME##3)==(((int64u)Elements::Identifier_##_NAME##1)*0x100000000LL+Elements::Identifier_##_NAME##2)) Identification_##_NAME(); #else //__BORLANDC__ #define ELEMENT_CASE(_NAME) \ else if (ID_Identification>>(64-8*Elements::Identifier_##_NAME##3)==Elements::Identifier_##_NAME) Identification_##_NAME(); #endif //__BORLANDC__ if (0) ; ELEMENT_CASE(CELT) ELEMENT_CASE(CMML) ELEMENT_CASE(BBCD) ELEMENT_CASE(FLAC) ELEMENT_CASE(JNG) ELEMENT_CASE(kate) ELEMENT_CASE(KW_DIRAC) ELEMENT_CASE(OggMIDI) ELEMENT_CASE(MNG) ELEMENT_CASE(OpusHead) ELEMENT_CASE(PCM) ELEMENT_CASE(PNG) ELEMENT_CASE(Speex) ELEMENT_CASE(theora) ELEMENT_CASE(vorbis) ELEMENT_CASE(YUV4MPEG) ELEMENT_CASE(video) ELEMENT_CASE(audio) ELEMENT_CASE(text) ELEMENT_CASE(fLaC) ELEMENT_CASE(fishead) ELEMENT_CASE(fisbone) else { Skip_XX(Element_Size, "Unknown"); Accept("OggSubElement"); Finish("OggSubElement"); return; } Open_Buffer_Init(Parser); //Parsing Default(); //Filling StreamKind=StreamKind_Last; if (0) ; ELEMENT_CASE(fishead) ELEMENT_CASE(fisbone) else Identified=true; Accept("OggSubElement"); Element_Show(); } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_CELT() { #if defined(MEDIAINFO_CELT_YES) StreamKind_Last=Stream_Audio; Parser=new File_Celt; #else Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "celt"); Fill(Stream_Audio, 0, Audio_Codec, "celt"); #endif WithType=false; } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_CMML() { #if defined(MEDIAINFO_CMML_YES) StreamKind_Last=Stream_Text; Parser=new File_Cmml; #else Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, Text_Format, "CMML"); Fill(Stream_Text, 0, Text_Codec, "CMML"); #endif WithType=false; } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_BBCD() { #if defined(MEDIAINFO_DIRAC_YES) StreamKind_Last=Stream_Video; Parser=new File_Dirac; ((File_Dirac*)Parser)->Ignore_End_of_Sequence=true; #else Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "Dirac"); Fill(Stream_Video, 0, Video_Codec, "Dirac"); #endif WithType=false; } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_FLAC() { #if defined(MEDIAINFO_FLAC_YES) StreamKind_Last=Stream_Audio; Parser=new File_Flac; ((File_Flac*)Parser)->VorbisHeader=true; #else Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "FLAC"); Fill(Stream_Audio, 0, Audio_Codec, "FLAC"); #endif WithType=false; } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_JNG() { #if defined(MEDIAINFO__YES) StreamKind_Last=Stream_Video; Parser=new File_Jng; #else Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "JNG"); Fill(Stream_Video, 0, Video_Codec, "JNG"); #endif } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_kate() { #if defined(MEDIAINFO_KATE_YES) StreamKind_Last=Stream_Text; Parser=new File_Kate; #else Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, Text_Format, "Kate"); Fill(Stream_Text, 0, Text_Codec, "Kate"); #endif } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_KW_DIRAC() { Identification_BBCD(); Fill(Stream_Video, 0, Video_CodecID, "KW-DIRAC", Unlimited, true, true); } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_OggMIDI() { #if defined(MEDIAINFO__YES) StreamKind_Last=Stream_Audio; Parser=new File_Midi; #else Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "Midi"); Fill(Stream_Audio, 0, Audio_Codec, "Midi"); #endif } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_OpusHead() { #if defined(MEDIAINFO_OPUS_YES) StreamKind_Last=Stream_Audio; Parser=new File_Opus; #else Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "Opus"); Fill(Stream_Audio, 0, Audio_Codec, "Opus"); #endif WithType=false; absolute_granule_position_Resolution=48000; // From specs: "It is possible to run a decoder at other sampling rates, but the format and this specification always count samples assuming a 48 kHz decoding rate." } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_MNG() { #if defined(MEDIAINFO__YES) StreamKind_Last=Stream_Video; Parser=new File_Mng; #else Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "MNG"); Fill(Stream_Video, 0, Video_Codec, "MNG"); #endif } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_PCM() { #if defined(MEDIAINFO__YES) StreamKind_Last=Stream_Audio; Parser=new File_Pcm; #else Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "PCM"); Fill(Stream_Audio, 0, Audio_Codec, "PCM"); #endif } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_PNG() { #if defined(MEDIAINFO__YES) StreamKind_Last=Stream_Video; Parser=new File_Png; #else Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "PNG"); Fill(Stream_Video, 0, Video_Codec, "PNG"); #endif } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_Speex() { #if defined(MEDIAINFO_SPEEX_YES) StreamKind_Last=Stream_Audio; Parser=new File_Speex; #else Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "Speex"); Fill(Stream_Audio, 0, Audio_Codec, "Speex"); #endif WithType=false; } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_theora() { #if defined(MEDIAINFO_THEORA_YES) StreamKind_Last=Stream_Video; Parser=new File_Theora; #else Stream_Prepare(Stream_Audio); Fill(Stream_Video, 0, Text_Format, "Theora"); Fill(Stream_Video, 0, Text_Codec, "Theora"); #endif } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_vorbis() { #if defined(MEDIAINFO_VORBIS_YES) StreamKind_Last=Stream_Audio; Parser=new File_Vorbis; #else Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Text_Format, "Vorbis"); Fill(Stream_Audio, 0, Text_Codec, "Vorbis"); #endif } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_YUV4MPEG() { #if defined(MEDIAINFO__YES) StreamKind_Last=Stream_Video; Parser=new File_Yuv; #else Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "YUV"); Fill(Stream_Video, 0, Video_Codec, "YUV"); #endif } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_video() { Element_Info1("Video"); //Parsing int64u TimeUnit; int32u fccHandler, Width, Height; Skip_B1 ( "Signature"); Skip_Local(6, "Signature"); Skip_L2( "Reserved"); Get_C4 (fccHandler, "fccHandler"); Skip_L4( "SizeOfStructure"); Get_L8 (TimeUnit, "TimeUnit"); //10000000/TimeUnit is stream tick rate in ticks/sec Skip_L4( "SamplesPerUnit"); Skip_L8( "DefaultLengh"); //in media time Skip_L4( "BufferSize"); Skip_L2( "BitsPerSample"); Skip_L2( "Reserved"); Get_L4 (Width, "Width"); Get_L4 (Height, "Height"); if (Element_OffsetFrameIsAlwaysComplete=true; } #endif } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_audio() { Element_Info1("Audio"); //Parsing int64u TimeUnit, SamplesPerUnit; int32u fccHandler, AvgBytesPerSec; int16u Channels; Skip_B1 ( "Signature"); Skip_Local(6, "Signature"); Skip_L2( "Reserved"); Get_C4 (fccHandler, "fccHandler"); Skip_L4( "SizeOfStructure"); Get_L8 (TimeUnit, "TimeUnit"); //10000000/TimeUnit is stream tick rate in ticks/sec Get_L8 (SamplesPerUnit, "SamplesPerUnit"); Skip_L4( "DefaultLengh"); //in media time Skip_L4( "BufferSize"); Skip_L2( "BitsPerSample"); Skip_L2( "Reserved"); Get_L2 (Channels, "Channels"); Skip_L2( "BlockAlign"); Get_L4 (AvgBytesPerSec, "AvgBytesPerSec"); if (Element_OffsetFrame_Count_Valid=2; } #endif } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Identification_text() { Element_Info1("Text"); //Parsing Skip_B1 ( "Signature"); Skip_Local(6, "Signature"); Skip_L2( "Reserved"); if (Element_Offset>(64-8*Elements::Identifier_##_NAME##3)==(((int64u)Elements::Identifier_##_NAME##1)*0x100000000LL|Elements::Identifier_##_NAME##2)) #else //__BORLANDC__ #define ELEMENT_CASE(_NAME) \ else if (ID_Identification>>(64-8*Elements::Identifier_##_NAME##3)==Elements::Identifier_##_NAME) #endif //__BORLANDC__ int32u ID_Identification_Size; if (0) ; ELEMENT_CASE(OpusTags) ID_Identification_Size=8; else if (WithType) { if (0) ; ELEMENT_CASE(kateTags) ID_Identification_Size=8; else ID_Identification_Size=6; //Default } else return; //Not a comment Element_Name("Comment"); Skip_Local(ID_Identification_Size, "ID"); //Preparing File_VorbisCom Vorbis; Vorbis.StreamKind_Specific=StreamKind; Vorbis.StreamKind_Multiple=MultipleStreams?StreamKind:Stream_General; Vorbis.StreamKind_Common=InAnotherContainer?StreamKind:Stream_General; Open_Buffer_Init(&Vorbis); //Parsing Open_Buffer_Continue(&Vorbis); //Filling Finish(&Vorbis); Merge(Vorbis, Stream_General, 0, 0); Merge(Vorbis, StreamKind, 0, 0); Merge(Vorbis, Stream_Menu, 0, 0); //Testing if we must continue if (Identified && (Parser==NULL || Parser->Status[IsFinished])) Finish("OggSubElement"); } //--------------------------------------------------------------------------- void File_Ogg_SubElement::Default() { Element_Name("Frame"); if (Parser) { if (!WithType) Comment(); //In case of comments Open_Buffer_Continue(Parser); if (Identified && Parser->Status[IsFilled]) Finish("OggSubElement"); } else if (Element_OffsetParseReferences(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_P2_Clip::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { if (ReferenceFiles==NULL) return 0; return ReferenceFiles->Read_Buffer_Seek(Method, Value, ID); } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_P2_Clip::FileHeader_Begin() { XMLDocument document; if (!FileHeader_Begin_XML(document)) return false; { XMLElement* Root=document.FirstChildElement("P2Main"); if (Root) { Accept("P2_Clip"); Fill(Stream_General, 0, General_Format, "P2 Clip"); ReferenceFiles=new File__ReferenceFilesHelper(this, Config); XMLElement* ClipContent=Root->FirstChildElement("ClipContent"); if (ClipContent) { XMLElement* ChildElement; //ID ChildElement=ClipContent->FirstChildElement("GlobalClipID"); if (ChildElement) Fill(Stream_General, 0, General_UniqueID, ChildElement->GetText()); //Duration Ztring Duration, EditUnit; ChildElement=ClipContent->FirstChildElement("Duration"); if (ChildElement) Duration=ChildElement->GetText(); ChildElement=ClipContent->FirstChildElement("EditUnit"); if (ChildElement) EditUnit=ChildElement->GetText(); int64u Duration_Frames=Duration.To_int64u(); int64u EditUnit_Numerator=EditUnit.SubString(Ztring(), __T("/")).To_int64u(); int64u EditUnit_Denominator=EditUnit.SubString(__T("/"), Ztring()).To_int64u(); if (Duration_Frames && EditUnit_Numerator && EditUnit_Denominator) Fill(Stream_General, 0, General_Duration, ((float32)Duration_Frames)*1000*EditUnit_Numerator/EditUnit_Denominator, 0); //EssenceList XMLElement* EssenceList=ClipContent->FirstChildElement("EssenceList"); if (EssenceList) { XMLElement* Track=EssenceList->FirstChildElement(); #if defined(MEDIAINFO_MXF_YES) size_t Audio_Count=0; #endif while (Track) { string Field=Track->Value(); if (Field=="Video") { File__ReferenceFilesHelper::reference ReferenceFile; //FrameRate ChildElement=Track->FirstChildElement("FrameRate"); if (ChildElement) { Ztring FrameRateS=Ztring(ChildElement->GetText()); if (FrameRateS.find(__T("23.97"))==0) ReferenceFile.FrameRate=((float64)24)*1000/1001; else if (FrameRateS.find(__T("29.97"))==0) ReferenceFile.FrameRate=((float64)30)*1000/1001; else if (FrameRateS.find(__T("59.94"))==0) ReferenceFile.FrameRate=((float64)60)*1000/1001; else ReferenceFile.FrameRate=FrameRateS.To_float64(); if (FrameRateS.find('i')!=string::npos) ReferenceFile.FrameRate/=2; } //CreationDate ChildElement=Track->FirstChildElement("StartTimecode"); if (ChildElement) { string Text=ChildElement->GetText(); if (Text.size()==11) { int64u ToFill=(Text[0]-'0')*10*60*60*1000 + (Text[1]-'0') *60*60*1000 + (Text[3]-'0') *10*60*1000 + (Text[4]-'0') *60*1000 + (Text[6]-'0') *10*1000 + (Text[7]-'0') *1000; if (ReferenceFile.FrameRate) ToFill+=float64_int64s(((Text[9]-'0')*10+(Text[10]-'0'))*1000/ReferenceFile.FrameRate); //Fill(Stream_Video, StreamPos_Last, Video_Delay, ToFill); //Fill(Stream_Video, StreamPos_Last, Video_Delay_Source, "P2 Clip"); } } #if defined(MEDIAINFO_MXF_YES) if (File_Name.size()>10+1+4+1 && File_Name[File_Name.size()-10-1]==PathSeparator && (File_Name[File_Name.size()-10-2]&(~0x20))==__T('P') && (File_Name[File_Name.size()-10-3]&(~0x20))==__T('I') && (File_Name[File_Name.size()-10-4]&(~0x20))==__T('L') && (File_Name[File_Name.size()-10-5]&(~0x20))==__T('C') && File_Name[File_Name.size()-10-6]==PathSeparator) { Ztring file=File_Name.substr(File_Name.size()-10, 6); Ztring MXF_File=__T(".."); MXF_File+=PathSeparator; Ztring Path=File_Name.substr(0, File_Name.size()-10-6); ZtringList Dirs=Dir::GetAllFileNames(Path, Dir::Include_Dirs); bool Exists=false; for (size_t Pos=0; Pos6 && (Dirs[Pos][Dirs[Pos].size()-1]&(~0x20))==__T('O') && (Dirs[Pos][Dirs[Pos].size()-2]&(~0x20))==__T('E') && (Dirs[Pos][Dirs[Pos].size()-3]&(~0x20))==__T('D') && (Dirs[Pos][Dirs[Pos].size()-4]&(~0x20))==__T('I') && (Dirs[Pos][Dirs[Pos].size()-5]&(~0x20))==__T('V') && Dirs[Pos][Dirs[Pos].size()-6]==PathSeparator) { MXF_File+=Dirs[Pos].substr(Dirs[Pos].size()-5, 5); Exists=true; break; } if (!Exists) MXF_File+=__T("AUDIO"); MXF_File+=PathSeparator; MXF_File+=file; Dirs=Dir::GetAllFileNames(File_Name.substr(0, File_Name.size()-10-1)+PathSeparator+MXF_File+__T(".MXF"), Dir::Include_Files); Exists=false; for (size_t Pos=0; Pos4 && (Dirs[Pos][Dirs[Pos].size()-1]&(~0x20))==__T('F') && (Dirs[Pos][Dirs[Pos].size()-2]&(~0x20))==__T('X') && (Dirs[Pos][Dirs[Pos].size()-3]&(~0x20))==__T('M') && Dirs[Pos][Dirs[Pos].size()-4]==__T('.')) { MXF_File+=Dirs[Pos].substr(Dirs[Pos].size()-4, 4); Exists=true; break; } if (!Exists) MXF_File+=__T(".MXF"); ReferenceFile.FileNames.push_back(MXF_File); ReferenceFile.StreamKind=Stream_Video; ReferenceFile.StreamID=ReferenceFiles->References.size()+1; ReferenceFiles->References.push_back(ReferenceFile); } #endif //defined(MEDIAINFO_MXF_YES) } else if (Field=="Audio") { #if defined(MEDIAINFO_MXF_YES) if (File_Name.size()>10+1+4+1 && File_Name[File_Name.size()-10-1]==PathSeparator && (File_Name[File_Name.size()-10-2]&(~0x20))==__T('P') && (File_Name[File_Name.size()-10-3]&(~0x20))==__T('I') && (File_Name[File_Name.size()-10-4]&(~0x20))==__T('L') && (File_Name[File_Name.size()-10-5]&(~0x20))==__T('C') && File_Name[File_Name.size()-10-6]==PathSeparator) { Ztring file=File_Name.substr(File_Name.size()-10, 6); Ztring MXF_File=__T(".."); MXF_File+=PathSeparator; Ztring Path=File_Name.substr(0, File_Name.size()-10-6); ZtringList Dirs=Dir::GetAllFileNames(Path, Dir::Include_Dirs); bool Exists=false; for (size_t Pos=0; Pos6 && (Dirs[Pos][Dirs[Pos].size()-1]&(~0x20))==__T('O') && (Dirs[Pos][Dirs[Pos].size()-2]&(~0x20))==__T('I') && (Dirs[Pos][Dirs[Pos].size()-3]&(~0x20))==__T('D') && (Dirs[Pos][Dirs[Pos].size()-4]&(~0x20))==__T('U') && (Dirs[Pos][Dirs[Pos].size()-5]&(~0x20))==__T('A') && Dirs[Pos][Dirs[Pos].size()-6]==PathSeparator) { MXF_File+=Dirs[Pos].substr(Dirs[Pos].size()-5, 5); Exists=true; break; } if (!Exists) MXF_File+=__T("AUDIO"); MXF_File+=PathSeparator; MXF_File+=file; Ztring Pos=Ztring::ToZtring(Audio_Count); if (Pos.size()<2) Pos.insert(0, 1, __T('0')); MXF_File+=Pos; Dirs=Dir::GetAllFileNames(File_Name.substr(0, File_Name.size()-10-1)+PathSeparator+MXF_File+__T(".MXF"), Dir::Include_Files); Exists=false; for (size_t Pos=0; Pos4 && (Dirs[Pos][Dirs[Pos].size()-1]&(~0x20))==__T('F') && (Dirs[Pos][Dirs[Pos].size()-2]&(~0x20))==__T('X') && (Dirs[Pos][Dirs[Pos].size()-3]&(~0x20))==__T('M') && Dirs[Pos][Dirs[Pos].size()-4]==__T('.')) { MXF_File+=Dirs[Pos].substr(Dirs[Pos].size()-4, 4); Exists=true; break; } if (!Exists) MXF_File+=__T(".MXF"); File__ReferenceFilesHelper::reference ReferenceFile; ReferenceFile.FileNames.push_back(MXF_File); ReferenceFile.StreamKind=Stream_Audio; ReferenceFile.StreamID=ReferenceFiles->References.size()+1; ReferenceFiles->References.push_back(ReferenceFile); Audio_Count++; } #endif //defined(MEDIAINFO_MXF_YES) } Track=Track->NextSiblingElement(); } } //ClipMetadata XMLElement* ClipMetadata=ClipContent->FirstChildElement("ClipMetadata"); if (ClipMetadata) { XMLElement* Access=ClipMetadata->FirstChildElement("Access"); if (Access) { //CreationDate ChildElement=Access->FirstChildElement("CreationDate"); if (ChildElement) { Ztring Content=ChildElement->GetText(); if (Content.size()>=11 && Content[10]==__T('T')) Content[10]=__T(' '); if (Content.find(__T("+00:00"))!=string::npos) { Content.resize(10+1+8); Content.insert(0, __T("UTC ")); } Fill(Stream_General, 0, General_Recorded_Date, Content); } //CreationDate ChildElement=Access->FirstChildElement("LastUpdateDate"); if (ChildElement) { Ztring Content=ChildElement->GetText(); if (Content.size()>=11 && Content[10]==__T('T')) Content[10]=__T(' '); if (Content.find(__T("+00:00"))!=string::npos) { Content.resize(10+1+8); Content.insert(0, __T("UTC ")); } Fill(Stream_General, 0, General_Tagged_Date, Content); } } XMLElement* Device=ClipMetadata->FirstChildElement("Device"); if (Device) { //Manufacturer+ModelName XMLElement* Manufacturer=Device->FirstChildElement("Manufacturer"); XMLElement* ModelName=Device->FirstChildElement("ModelName"); if (Manufacturer && ModelName) Fill(Stream_General, 0, General_Encoded_Application, string(Manufacturer->GetText())+" "+ModelName->GetText()); } XMLElement* Shoot=ClipMetadata->FirstChildElement("Shoot"); if (Shoot) { //StartDate ChildElement=Shoot->FirstChildElement("StartDate"); if (ChildElement) { Ztring Content=ChildElement->GetText(); if (Content.size()>=11 && Content[10]==__T('T')) Content[10]=__T(' '); if (Content.find(__T("+00:00"))!=string::npos) { Content.resize(10+1+8); Content.insert(0, __T("UTC ")); } Fill(Stream_General, 0, General_Duration_Start, Content); } //EndDate ChildElement=Shoot->FirstChildElement("EndDate"); if (ChildElement) { Ztring Content=ChildElement->GetText(); if (Content.size()>=11 && Content[10]==__T('T')) Content[10]=__T(' '); if (Content.find(__T("+00:00"))!=string::npos) { Content.resize(10+1+8); Content.insert(0, __T("UTC ")); } Fill(Stream_General, 0, General_Duration_End, Content); } //Location XMLElement* Location=Shoot->FirstChildElement("Location"); if (Location) { //Longitude+Latitude XMLElement* Longitude=Location->FirstChildElement("Longitude"); XMLElement* Latitude=Location->FirstChildElement("Latitude"); if (Longitude && Latitude) Fill(Stream_General, 0, General_Recorded_Location, string(Latitude->GetText())+", "+Longitude->GetText()); } } XMLElement* Scenario=ClipMetadata->FirstChildElement("Scenario"); if (Scenario) { //ProgramName ChildElement=Scenario->FirstChildElement("ProgramName"); if (ChildElement) Fill(Stream_General, 0, General_Title, ChildElement->GetText()); //SceneNo. ChildElement=Scenario->FirstChildElement("SceneNo."); if (ChildElement) Fill(Stream_General, 0, "Scene Number", ChildElement->GetText()); //TakeNo. ChildElement=Scenario->FirstChildElement("TakeNo."); if (ChildElement) Fill(Stream_General, 0, "Take Number", ChildElement->GetText()); } XMLElement* News=ClipMetadata->FirstChildElement("News"); if (News) { //Reporter ChildElement=News->FirstChildElement("Reporter"); if (ChildElement) Fill(Stream_General, 0, "Reporter", ChildElement->GetText()); //Purpose ChildElement=News->FirstChildElement("Purpose"); if (ChildElement) Fill(Stream_General, 0, "Purpose", ChildElement->GetText()); //Object ChildElement=News->FirstChildElement("Object"); if (ChildElement) Fill(Stream_General, 0, "Object", ChildElement->GetText()); } } } } else { Reject("P2_Clip"); return false; } } Element_Offset=File_Size; //All should be OK... return true; } } //NameSpace #endif //MEDIAINFO_P2_YES MediaInfoLib/Source/MediaInfo/Multiple/File_P2_Clip.h100777 0 0 3121 12226004262 15676 0/* 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 P2 Clip files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_P2_ClipH #define MediaInfo_File_P2_ClipH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { class File__ReferenceFilesHelper; //*************************************************************************** // Class File_P2_Clip //*************************************************************************** class File_P2_Clip : public File__Analyze { public : //Constructor/Destructor File_P2_Clip(); ~File_P2_Clip(); private : //Streams management void Streams_Finish (); //Buffer - Global #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK //Buffer - File header bool FileHeader_Begin(); //Temp File__ReferenceFilesHelper* ReferenceFiles; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Pmp.cpp100777 0 0 11650 12226004262 15563 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Contributor: Lionel Duchateau, kurtnoise@free.fr // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_PMP_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Pmp.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Info //*************************************************************************** //--------------------------------------------------------------------------- const char* Pmp_video_format(int32u video_format) { switch (video_format) { case 0 : return "MPEG-4 Visual"; case 1 : return "AVC"; default : return ""; } } //--------------------------------------------------------------------------- const char* Pmp_audio_format(int32u audio_format) { switch (audio_format) { case 0 : return "MPEG Audio"; case 1 : return "AAC"; default : return ""; } } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Pmp::FileHeader_Begin() { //Synchro if (Buffer_Offset+4>Buffer_Size) return false; if (CC4(Buffer+Buffer_Offset)!=0x706D706D) //"pmpm" return false; return true; } //--------------------------------------------------------------------------- void File_Pmp::FileHeader_Parse() { //Parsing int32u version, video_format=0, nb_frames=0, video_width=0, video_height=0, time_base_num=0, time_base_den=0, audio_format=0, sample_rate=0, channels=0; Skip_C4( "Signature"); Get_L4 (version, "Version"); if (version==1) { Get_L4 (video_format, "video_format"); Get_L4 (nb_frames, "number of frames"); Get_L4 (video_width, "video_width"); Get_L4 (video_height, "video_height"); Get_L4 (time_base_num, "time_base_num"); Get_L4 (time_base_den, "time_base_den"); Skip_L4( "number of audio streams"); Get_L4 (audio_format, "audio_format"); Get_L4 (channels, "channels"); Skip_L4( "unknown"); Get_L4 (sample_rate, "sample_rate"); } FILLING_BEGIN(); Accept("PMP"); Fill(Stream_General, 0, General_Format, "PMP"); if (version==1) { Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, Pmp_video_format(video_format)); Fill(Stream_Video, 0, Video_FrameCount, nb_frames); Fill(Stream_Video, 0, Video_Width, video_width); Fill(Stream_Video, 0, Video_Height, video_height); Fill(Stream_Video, 0, Video_FrameRate, (float)time_base_den / 100); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, Pmp_audio_format(audio_format)); Fill(Stream_Audio, 0, Audio_Channel_s_, channels); Fill(Stream_Audio, 0, Audio_SamplingRate, sample_rate); } //No more need data Finish("PMP"); FILLING_END(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_PMP_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Pmp.h100777 0 0 2432 12226004262 15206 0/* 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 PMP files // // Contributor: Lionel Duchateau, kurtnoise@free.fr // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_PmpH #define MediaInfo_File_PmpH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Tag/File__Tags.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Pmp //*************************************************************************** class File_Pmp : public File__Analyze { public : //In int64u Frame_Count_Valid; private : //Buffer bool FileHeader_Begin(); void FileHeader_Parse(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Ptx.cpp100777 0 0 50172 12262743712 15616 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_PTX_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Ptx.h" #include "MediaInfo/Multiple/File__ReferenceFilesHelper.h" using namespace tinyxml2; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Ptx::File_Ptx() :File__Analyze() { #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Ptx; StreamIDs_Width[0]=sizeof(size_t); #endif //MEDIAINFO_EVENTS //Temp ReferenceFiles=NULL; } //--------------------------------------------------------------------------- File_Ptx::~File_Ptx() { delete ReferenceFiles; //ReferenceFiles=NULL; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Ptx::Streams_Finish() { ReferenceFiles->ParseReferences(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_Ptx::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { return ReferenceFiles->Read_Buffer_Seek(Method, Value, ID); } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Ptx::FileHeader_Begin() { if (File_Size<0x100) { Reject("Ptx"); return false; } //Element_Size if (Buffer_SizeElement_Size) { Element_End(); Reject(); return; } for (int32u Pos=0; PosElement_Size) { Element_End(); Reject(); return; } for (int16u Pos=0; Pos<1+Names_Count; Pos++) { Element_Begin1("Name"); Get_L4 (Name_Length, "Name length"); if (Name_Length) { Info_UTF8(Name_Length, Name, "Name"); Element_Name(Name); } Element_End(); } Element_End(); Skip_L4( "0x00000000"); Skip_L4( "0x0000002A"); Skip_L4( "Unknown"); Skip_L4( "Unknown"); Element_Begin1("Names list 2"); Get_L4 (Names_Count, "Names count"); if (4*Names_Count>Element_Size) { Element_End(); Reject(); return; } for (int16u Pos=0; PosElement_Size) { Reject(); return; } Element_Begin1("Audio tracks list 1"); for (int16u Pos=0; PosElement_Size) { Reject(); return; } Skip_L2( "0x00"); Element_Begin1("Audio tracks list 3"); for (int16u Pos=0; PosElement_Size) { Reject(); return; } Get_L4 (Directory_Length, "Directory length"); Get_UTF8(Directory_Length, Directory, "Directory"); Skip_L4( "0x00000000"); Element_Begin1("File names"); size_t Pos_Offset=0; for (int32u Pos=0; PosReferences.push_back(ReferenceFile); } else if (ReferenceFiles->References.empty()) Pos_Offset++; default: ; } } Element_End(); Skip_XX(Element_Size-Element_Offset, "Unknown"); FILLING_BEGIN(); Accept("Ptx"); //Could be Ptf (former formatn but not supported, so we don't care currently Fill("Ptx"); Fill(Stream_General, 0, General_Format, "Pro Tools Session"); Fill(Stream_General, 0, General_Format_Version, "Version 10"); Fill(Stream_General, 0, General_Encoded_Library_Name, LibraryName); Fill(Stream_General, 0, General_Encoded_Library_Version, LibraryVersion); FILLING_END(); } } //NameSpace #endif //MEDIAINFO_PTX_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Ptx.h100777 0 0 3445 12252340744 15241 0/* 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 Pro Tools session 10 files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_PtxH #define MediaInfo_File_PtxH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { class File__ReferenceFilesHelper; //*************************************************************************** // Class File_Ptx //*************************************************************************** class File_Ptx : public File__Analyze { public : //Constructor/Destructor File_Ptx(); ~File_Ptx(); private : //Streams management void Streams_Finish (); //Buffer - Global #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK void Read_Buffer_Continue (); //Buffer - File header bool FileHeader_Begin(); //Temp File__ReferenceFilesHelper* ReferenceFiles; bool HasCpl; friend class File_DpcCpl; //Theses classes need access to internal structure for optimization. There is recursivity with theses formats }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Riff.cpp100777 0 0 123621 12226004262 15737 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #ifdef MEDIAINFO_RIFF_YES //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Riff.h" #if defined(MEDIAINFO_MPEG4V_YES) #include "MediaInfo/Video/File_Mpeg4v.h" #endif #if defined(MEDIAINFO_MPEGA_YES) #include "MediaInfo/Audio/File_Mpega.h" #endif #if defined(MEDIAINFO_AC3_YES) #include "MediaInfo/Audio/File_Ac3.h" #endif #if defined(MEDIAINFO_DTS_YES) #include "MediaInfo/Audio/File_Dts.h" #endif #if defined(MEDIAINFO_DVDIF_YES) #include "MediaInfo/Multiple/File_DvDif.h" #endif #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events.h" #endif //MEDIAINFO_EVENTS #include #include using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Const //*************************************************************************** namespace Elements { const int32u AIFF_SSND=0x53534E44; const int32u AVI_=0x41564920; const int32u AVI__hdlr_strl_strh_txts=0x74787473; const int32u FORM=0x464F524D; const int32u LIST=0x4C495354; const int32u MThd=0x4D546864; const int32u ON2_=0x4F4E3220; const int32u ON2f=0x4F4E3266; const int32u RIFF=0x52494646; const int32u riff=0x72696666; const int32u RF64=0x52463634; const int32u SMV0=0x534D5630; const int32u SMV0_xxxx=0x534D563A; const int32u W3DI=0x57334449; const int32u WAVE=0x57415645; const int32u WAVE_data=0x64617461; const int32u WAVE_ds64=0x64733634; } //*************************************************************************** // Format //*************************************************************************** //--------------------------------------------------------------------------- File_Riff::File_Riff() :File__Analyze() { //Configuration #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Riff; StreamIDs_Width[0]=4; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_Level=2; //Container #endif //MEDIAINFO_DEMUX DataMustAlwaysBeComplete=false; //In/Out #if defined(MEDIAINFO_ANCILLARY_YES) Ancillary=NULL; #endif //defined(MEDIAINFO_ANCILLARY_YES) //Data Interleaved0_1=0; Interleaved0_10=0; Interleaved1_1=0; Interleaved1_10=0; //Temp WAVE_data_Size=0xFFFFFFFF; WAVE_fact_samplesCount=0xFFFFFFFF; Buffer_DataToParse_Begin=(int64u)-1; Buffer_DataToParse_End=0; #if MEDIAINFO_DEMUX AvgBytesPerSec=0; #endif //!MEDIAINFO_DEMUX avih_FrameRate=0; avih_TotalFrame=0; dmlh_TotalFrame=0; Idx1_Offset=(int64u)-1; movi_Size=0; TimeReference=(int64u)-1; SMV_BlockSize=0; SamplesPerSec=0; stream_Count=0; rec__Present=false; NeedOldIndex=true; IsBigEndian=false; IsWave64=false; IsRIFF64=false; IsWaveBroken=false; IsNotWordAligned=false; IsNotWordAligned_Tested=false; SecondPass=false; DV_FromHeader=NULL; Kind=Kind_None; #if MEDIAINFO_DEMUX Demux_Parser=NULL; #endif //MEDIAINFO_DEMUX //Pointers Stream_Structure_Temp=Stream_Structure.end(); } //--------------------------------------------------------------------------- File_Riff::~File_Riff() { #ifdef MEDIAINFO_DVDIF_YES delete (File_DvDif*)DV_FromHeader; //DV_FromHeader=NULL #endif //MEDIAINFO_DVDIF_YES } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Riff::Streams_Finish () { //Ancillary specific #if defined(MEDIAINFO_ANCILLARY_YES) if (Ancillary && (*Ancillary)) { Clear(); Stream_Prepare(Stream_General); Finish(*Ancillary); Merge(**Ancillary); Ztring LawRating=(*Ancillary)->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); return; } #endif //defined(MEDIAINFO_ANCILLARY_YES) //Global if (IsRIFF64) Fill(Stream_General, 0, General_Format_Profile, "RF64"); //Time codes TimeCode_Fill(__T("ISMP"), INFO_ISMP); TimeCode_Fill(__T("Adobe tc_A"), Tdat_tc_A); TimeCode_Fill(__T("Adobe tc_O"), Tdat_tc_O); //For each stream std::map::iterator Temp=Stream.begin(); while (Temp!=Stream.end()) { //Preparing StreamKind_Last=Temp->second.StreamKind; StreamPos_Last=Temp->second.StreamPos; //StreamSize if (Temp->second.StreamSize>0) Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_StreamSize), Temp->second.StreamSize); //When there are few frames, difficult to detect PCM if (Temp->second.IsPcm && !Temp->second.Parsers.empty() && !Temp->second.Parsers[0]->Status[IsAccepted]) { for (size_t Pos=0; Possecond.Parsers.size()-1; Pos++) delete Temp->second.Parsers[Pos]; Temp->second.Parsers.erase(Temp->second.Parsers.begin(), Temp->second.Parsers.begin()+Temp->second.Parsers.size()-1); Temp->second.Parsers[0]->Accept(); } //PAR if (PAR && StreamKind_Last==Stream_Video) Fill(Stream_Video, StreamPos_Last, Video_PixelAspectRatio, PAR); Ztring ID; if (Temp->first!=(int32u)-1) ID.From_Number(((Temp->first>>24)-'0')*10+(((Temp->first>>16)&0xFF)-'0')); //Parser specific if (Temp->second.Parsers.size()==1) { //Finalizing and Merging (except Video codec and 120 fps hack) Temp->second.Parsers[0]->ShouldContinueParsing=false; //Hack - Before Ztring StreamSize, Codec_Temp; if (StreamKind_Last==Stream_Video) Codec_Temp=Retrieve(Stream_Video, StreamPos_Last, Video_Codec); //We want to keep the 4CC of AVI StreamSize=Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_StreamSize)); //We want to keep the 4CC of AVI //Merging if (Config->ParseSpeed<=1.0) { Fill(Temp->second.Parsers[0]); Temp->second.Parsers[0]->Open_Buffer_Unsynch(); } Finish(Temp->second.Parsers[0]); if (!Temp->second.Parsers.empty() && Temp->second.Parsers[0]->Count_Get(StreamKind_Last)) for (size_t Pos=0; Possecond.Parsers[0]->Count_Get(StreamKind_Last); Pos++) { Ztring Temp_ID=ID; Ztring Temp_ID_String=ID; Merge(*Temp->second.Parsers[0], StreamKind_Last, Pos, StreamPos_Last+Pos); if (!Retrieve(StreamKind_Last, StreamPos_Last, General_ID).empty()) { if (!Temp_ID.empty()) { Temp_ID+=__T('-'); Temp_ID_String+=__T('-'); } Temp_ID+=Retrieve(StreamKind_Last, StreamPos_Last, General_ID); Temp_ID_String+=Retrieve(StreamKind_Last, StreamPos_Last, General_ID); } Fill(StreamKind_Last, StreamPos_Last, General_ID, Temp_ID, true); Fill(StreamKind_Last, StreamPos_Last, General_StreamOrder, Temp_ID_String, true); //Special case: Compressed audio hidden in PCM if (StreamKind_Last==Stream_Audio && Temp->second.Compression==1 && Retrieve(Stream_General, 0, General_Format)==__T("Wave") //Some DTS or SMPTE ST 337 streams are coded "1" && !Retrieve(Stream_Audio, StreamPos_Last, Audio_Channel_s__Original).empty()) { Clear(Stream_Audio, StreamPos_Last, Audio_Channel_s__Original); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, 6, 10, true); //The PCM channel count is fake } } else { Fill(StreamKind_Last, StreamPos_Last, General_ID, ID, true); Fill(StreamKind_Last, StreamPos_Last, General_StreamOrder, ID, true); } //Hacks - After Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_StreamSize), StreamSize, true); if (StreamKind_Last==Stream_Video) { if (!Codec_Temp.empty()) Fill(Stream_Video, StreamPos_Last, Video_Codec, Codec_Temp, true); //120 fps hack const Ztring &FrameRate=Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate); if (FrameRate.To_int32u()==120) { Fill(Stream_Video, StreamPos_Last, Video_FrameRate_String, MediaInfoLib::Config.Language_Get(FrameRate+__T(" (24/30)"), __T(" fps")), true); Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Minimum, 24, 10, true); Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Maximum, 30, 10, true); Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Mode, "VFR"); } } //Hack - SMPTE ST 337, RIFF channels count is wrong if (StreamKind_Last==Stream_Audio && Retrieve(Stream_Audio, StreamPos_Last, Audio_MuxingMode)==__T("AES3") && Temp->second.Parsers[0]->Get(Stream_Audio, 0, Audio_Channel_s_).empty()) Clear(Stream_Audio, StreamPos_Last, Audio_Channel_s_); //Alignment if (StreamKind_Last==Stream_Audio && Count_Get(Stream_Video)>0) //Only if this is not a WAV file { Fill(Stream_Audio, StreamPos_Last, Audio_Alignment, Temp->second.ChunksAreComplete?"Aligned":"Split"); Fill(Stream_Audio, StreamPos_Last, Audio_Alignment_String, MediaInfoLib::Config.Language_Get(Temp->second.ChunksAreComplete?__T("Alignment_Aligned"):__T("Alignment_Split"))); } //Delay if (StreamKind_Last==Stream_Audio && Count_Get(Stream_Video)==1 && Temp->second.Rate!=0 && Temp->second.Parsers[0]->Status[IsAccepted]) { float Delay=0; bool Delay_IsValid=false; if (Temp->second.Parsers[0]->Buffer_TotalBytes_FirstSynched==0) { Delay=0; Delay_IsValid=true; } else if (Temp->second.Rate!=0) { Delay=((float)Temp->second.Parsers[0]->Buffer_TotalBytes_FirstSynched)*1000/Temp->second.Rate; Delay_IsValid=true; } else if (Temp->second.Parsers[0]->Retrieve(Stream_Audio, 0, Audio_BitRate).To_int64u()!=0) { Delay=((float)Temp->second.Parsers[0]->Buffer_TotalBytes_FirstSynched)*1000/Temp->second.Parsers[0]->Retrieve(Stream_Audio, 0, Audio_BitRate).To_int64u(); Delay_IsValid=true; } else if (Temp->second.Parsers[0]->Retrieve(Stream_Audio, 0, Audio_BitRate_Nominal).To_int64u()!=0) { Delay=((float)Temp->second.Parsers[0]->Buffer_TotalBytes_FirstSynched)*1000/Temp->second.Parsers[0]->Retrieve(Stream_Audio, 0, Audio_BitRate_Nominal).To_int64u(); Delay_IsValid=true; } if (Delay_IsValid) { Delay+=((float)Temp->second.Start)*1000/Temp->second.Rate; Fill(Stream_Audio, StreamPos_Last, Audio_Delay, Delay, 0, true); Fill(Stream_Audio, StreamPos_Last, Audio_Delay_Source, "Stream", Unlimited, true, true); for (size_t StreamPos=0; StreamPossecond.Compression), InfoCodec_KindofCodec).find(__T("DV"))==0 || Retrieve(Stream_Video, StreamPos_Last, Video_Format)==__T("DV") || Retrieve(Stream_Video, StreamPos_Last, Video_Codec)==__T("DV"))) { if (Retrieve(Stream_General, 0, General_Recorded_Date).empty()) Fill(Stream_General, 0, General_Recorded_Date, Temp->second.Parsers[0]->Retrieve(Stream_General, 0, General_Recorded_Date)); //Video and Audio are together size_t Audio_Count=Temp->second.Parsers[0]->Count_Get(Stream_Audio); for (size_t Audio_Pos=0; Audio_Possecond.Parsers[0], Stream_Audio, Audio_Pos, StreamPos_Last); Fill(Stream_Audio, Pos, Audio_MuxingMode, "DV"); Fill(Stream_Audio, Pos, Audio_Duration, Retrieve(Stream_Video, Temp->second.StreamPos, Video_Duration)); Fill(Stream_Audio, Pos, "MuxingMode_MoreInfo", __T("Muxed in Video #")+Ztring().From_Number(Temp->second.StreamPos+1)); Fill(Stream_Audio, Pos, Audio_StreamSize_Encoded, 0); //Included in the DV stream size Ztring ID=Retrieve(Stream_Audio, Pos, Audio_ID); Fill(Stream_Audio, Pos, Audio_ID, Retrieve(Stream_Video, Temp->second.StreamPos, Video_ID)+__T("-")+ID, true); } StreamKind_Last=Stream_Video; StreamPos_Last=Temp->second.StreamPos; } #endif } else if (StreamKind_Last!=Stream_General) Fill(StreamKind_Last, StreamPos_Last, General_ID, ID); //Duration if (Temp->second.PacketCount>0) { if (StreamKind_Last==Stream_Video) // && Retrieve(Stream_Video, StreamPos_Last, Video_Duration).empty()) { //Duration in case it is missing from header (malformed header...) if (Temp->second.indx_Duration && Temp->second.Rate) Fill(Stream_Video, StreamPos_Last, Video_Duration, ((float64)Temp->second.indx_Duration)*1000*Temp->second.Scale/Temp->second.Rate, 0, true); else Fill(Stream_Video, StreamPos_Last, Video_FrameCount, Temp->second.PacketCount, 10, true); } if (StreamKind_Last==Stream_Audio) { //Duration in case it is missing from header (malformed header...) int64u SamplingCount=0; #if defined(MEDIAINFO_MPEGA_YES) if (Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)==__T("MPEG Audio")) { if (Temp->second.Parsers[0] && Temp->second.PacketPos==((File_Mpega*)Temp->second.Parsers[0])->Frame_Count_Valid) //Only for stream with one frame per chunk { Ztring Version=Retrieve(Stream_Audio, StreamPos_Last, Audio_Format_Version); Ztring Layer=Retrieve(Stream_Audio, StreamPos_Last, Audio_Format_Profile); if (Version==__T("Version 1") && Layer==__T("Layer 1")) SamplingCount=Temp->second.PacketCount*384; //MPEG-1 Layer 1 else if ((Version==__T("Version 2") || Version==__T("Version 2.5")) && Layer==__T("Layer 1")) SamplingCount=Temp->second.PacketCount*192; //MPEG-2 or 2.5 Layer 1 else if ((Version==__T("Version 2") || Version==__T("Version 2.5")) && Layer==__T("Layer 3")) SamplingCount=Temp->second.PacketCount*576; //MPEG-2 or 2.5 Layer 3 else SamplingCount=Temp->second.PacketCount*1152; } } #endif if (Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)==__T("PCM")) { int64u Resolution=Retrieve(Stream_Audio, StreamPos_Last, Audio_BitDepth).To_int64u(); int64u Channels=Retrieve(Stream_Audio, StreamPos_Last, Audio_Channel_s_).To_int64u(); if (Resolution>0 && Channels>0) SamplingCount=Temp->second.StreamSize*8/Resolution/Channels; } if (Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)==__T("ADPCM")) { int64u Resolution=Retrieve(Stream_Audio, StreamPos_Last, Audio_BitDepth).To_int64u(); int64u Channels=Retrieve(Stream_Audio, StreamPos_Last, Audio_Channel_s_).To_int64u(); if (Resolution>0 && Channels>0) SamplingCount=(int64u)(Temp->second.StreamSize*8/Resolution/Channels*0.98); //0.98 is not precise! //ADPCM estimation is not precise, if container sampling count is around our value, using it rather than the estimation float32 SamplingRate=Retrieve(Stream_Audio, StreamPos_Last, Audio_SamplingRate).To_float32(); if (SamplingRate>0 && SamplingCount*1000/SamplingRate<((float32)avih_TotalFrame)/avih_FrameRate*1000*1.10 && SamplingCount*1000/SamplingRate>((float32)avih_TotalFrame)/avih_FrameRate*1000*0.10) SamplingCount=0; //Value disabled } //One AC-3 frame is 32 ms //One DTS frame is 21 ms float32 SamplingRate=Retrieve(Stream_Audio, StreamPos_Last, Audio_SamplingRate).To_float32(); if (SamplingCount>0 && SamplingRate>0) Fill(Stream_Audio, StreamPos_Last, Audio_Duration, SamplingCount*1000/SamplingRate, 0, true); else if (Temp->second.indx_Duration && Temp->second.Rate) Fill(Stream_Audio, StreamPos_Last, Audio_Duration, ((float64)Temp->second.indx_Duration)*1000*Temp->second.Scale/Temp->second.Rate, 0, true); else if (Temp->second.Rate && Temp->second.Scale!=1) //Note: some files with Scale==1 are buggy Fill(Stream_Audio, StreamPos_Last, Audio_Duration, ((float64)Temp->second.Length)*1000*Temp->second.Scale/Temp->second.Rate, 0, true); //Interleave if (Stream[0x30300000].PacketCount && Temp->second.PacketCount) { Fill(Stream_Audio, StreamPos_Last, "Interleave_VideoFrames", (float)Stream[0x30300000].PacketCount/Temp->second.PacketCount, 2); if (Retrieve(Stream_Video, 0, Video_FrameRate).To_float32()) { Fill(Stream_Audio, StreamPos_Last, "Interleave_Duration", (float)Stream[0x30300000].PacketCount/Temp->second.PacketCount*1000/Retrieve(Stream_Video, 0, Video_FrameRate).To_float32(), 0); Ztring Interleave_Duration_String; Interleave_Duration_String+=Retrieve(Stream_Audio, StreamPos_Last, "Interleave_Duration"); Interleave_Duration_String+=__T(" "); Interleave_Duration_String+=MediaInfoLib::Config.Language_Get(__T("ms")); if (!Retrieve(Stream_Audio, StreamPos_Last, "Interleave_VideoFrames").empty()) { Interleave_Duration_String+=__T(" ("); Interleave_Duration_String+=MediaInfoLib::Config.Language_Get(Retrieve(Stream_Audio, StreamPos_Last, "Interleave_VideoFrames"), __T(" video frames")); Interleave_Duration_String+=__T(")"); } Fill(Stream_Audio, StreamPos_Last, "Interleave_Duration/String", Interleave_Duration_String); } int64u Audio_FirstBytes=0; for (std::map::iterator Stream_Structure_Temp=Stream_Structure.begin(); Stream_Structure_Temp!=Stream_Structure.end(); ++Stream_Structure_Temp) { if (Stream_Structure_Temp->second.Name==0x30300000) break; if (Stream_Structure_Temp->second.Name==Temp->first) Audio_FirstBytes+=Stream_Structure_Temp->second.Size; } if (Audio_FirstBytes && Temp->second.AvgBytesPerSec) { Fill(Stream_Audio, StreamPos_Last, "Interleave_Preload", Audio_FirstBytes*1000/Temp->second.AvgBytesPerSec); Fill(Stream_Audio, StreamPos_Last, "Interleave_Preload/String", Retrieve(Stream_Audio, StreamPos_Last, "Interleave_Preload")+__T(" ")+MediaInfoLib::Config.Language_Get(__T("ms"))); } } } //Source duration if (Temp->second.PacketCount && Temp->second.Length!=Temp->second.PacketCount) { if (StreamKind_Last==Stream_Video && Temp->second.Rate) Fill(Stream_Video, StreamPos_Last, "Source_Duration", ((float64)Temp->second.PacketCount)*1000*Temp->second.Scale/Temp->second.Rate, 0); if (StreamKind_Last==Stream_Audio && Temp->second.Rate) { float64 Duration_Source=((float64)Temp->second.StreamSize)*1000/Temp->second.AvgBytesPerSec; float64 Duration_Header=Retrieve(Stream_Audio, StreamPos_Last, Audio_Duration).To_float64(); float64 Difference=Duration_Source-Duration_Header; if (Temp->second.Scale!=1 && float64_int64s(Duration_Header/Duration_Source)==Temp->second.Scale) Fill(Stream_Audio, StreamPos_Last, Audio_Duration, Duration_Source, 0, true); //Found 1 stream with Scale not being right else if (Difference<-2 || Difference>2) //+/- 2 ms Fill(Stream_Audio, StreamPos_Last, "Source_Duration", Duration_Source, 0); } } } ++Temp; } //Some work on the first video stream if (Count_Get(Stream_Video)) { //ODML if (dmlh_TotalFrame!=0 && Retrieve(Stream_Video, 0, Video_Duration).empty()) for (size_t StreamPos=0; StreamPosInterleaved1_1) || (Interleaved1_1Interleaved0_1))?"Yes":"No"); //MD5 size_t Pos=0; for (size_t StreamKind=Stream_General+1; StreamKindDemux_Unpacketize_Get(); Demux_Rate=Config->Demux_Rate_Get(); if (Demux_Rate==0) Demux_Rate=25; //Default value #endif //MEDIAINFO_DEMUX PAR=0; } //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_Riff::Read_Buffer_Seek (size_t Method, int64u Value, int64u /*ID*/) { //Only Wave and AIFF switch (Kind) { case Kind_Wave : case Kind_Aiff : break; default : return (size_t)-1; } //Parsing switch (Method) { case 0 : if (ValueBuffer_DataToParse_End) Value=Buffer_DataToParse_End; GoTo(Value); Open_Buffer_Unsynch(); return 1; case 1 : GoTo(Buffer_DataToParse_Begin+(Buffer_DataToParse_End-Buffer_DataToParse_Begin)*Value/10000); Open_Buffer_Unsynch(); return 1; case 2 : //Timestamp { if (AvgBytesPerSec==0) return (size_t)-1; float64 ValueF=(float64)Value; ValueF/=1000000000; //Value is in ns ValueF*=AvgBytesPerSec; GoTo(Buffer_DataToParse_Begin+float64_int64s(ValueF)); return 1; } case 3 : //FrameNumber { if (AvgBytesPerSec==0 || Demux_Rate==0 || BlockAlign==0) return (size_t)-1; float64 BytesPerFrame=AvgBytesPerSec/Demux_Rate; int64u StreamOffset=(int64u)(Value*BytesPerFrame); StreamOffset/=BlockAlign; StreamOffset*=BlockAlign; GoTo(Buffer_DataToParse_Begin+StreamOffset); return 1; } default : return (size_t)-1; //Not supported } } #endif //MEDIAINFO_SEEK //--------------------------------------------------------------------------- void File_Riff::Read_Buffer_Unsynched() { for (std::map::iterator Stream_Item=Stream.begin(); Stream_Item!=Stream.end(); ++Stream_Item) for (size_t Pos=0; Possecond.Parsers.size(); Pos++) Stream_Item->second.Parsers[Pos]->Open_Buffer_Unsynch(); if (IsSub) { while(Element_Level) Element_End0(); #if defined(MEDIAINFO_ANCILLARY_YES) //Ancillary specific if (Ancillary && (*Ancillary)) (*Ancillary)->Open_Buffer_Unsynch(); #endif //defined(MEDIAINFO_ANCILLARY_YES) } } //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX void File_Riff::Read_Buffer_Continue() { if (Demux_Parser) { Open_Buffer_Continue(Demux_Parser, Buffer+Buffer_Offset, 0, false); Demux_Parser=NULL; //if (Config->Demux_EventWasSent) // return; } } #endif //MEDIAINFO_DEMUX //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- bool File_Riff::Header_Begin() { while (File_Offset+Buffer_OffsetBuffer_DataToParse_End) Element_Size-=BlockAlign; if (Element_Size==0) Element_Size=BlockAlign; if (Buffer_Offset+Element_Size>Buffer_Size) return false; } else #endif //MEDIAINFO_DEMUX if (File_Offset+Buffer_Size<=Buffer_DataToParse_End) Element_Size=Buffer_Size; //All the buffer is used else { Element_Size=File_Offset+Buffer_Size-Buffer_DataToParse_End; Buffer_DataToParse_End=0; } if (Buffer_Offset+(size_t)Element_Size>Buffer_Size) return false; // Fake header Element_Begin0(); Element_Begin0(); Header_Fill_Size(Buffer_DataToParse_End-(File_Offset+Buffer_Offset)); Element_End(); switch (Kind) { case Kind_Wave : WAVE_data_Continue(); break; case Kind_Aiff : AIFF_SSND_Continue(); break; case Kind_Rmp3 : RMP3_data_Continue(); break; default : AVI__movi_xxxx(); } if (Config->ParseSpeed<1.0 && File_Offset+Buffer_Offset+Element_Offset-Buffer_DataToParse_Begin>=0x10000) { File_GoTo=Buffer_DataToParse_End; Buffer_Offset=Buffer_Size; Element_Size=0; } else { Buffer_Offset+=(size_t)Element_Size; Element_Size-=Element_Offset; } Element_Offset=0; Element_End0(); if (Status[IsFinished] || (File_GoTo!=(int64u)-1 && (File_GoTo<=Buffer_DataToParse_Begin || File_GoTo>=Buffer_DataToParse_End))) { Buffer_DataToParse_Begin=(int64u)-1; Buffer_DataToParse_End=0; return false; } if (Buffer_Offset>=Buffer_Size) return false; #if MEDIAINFO_DEMUX if (Config->Demux_EventWasSent) return false; #endif //MEDIAINFO_DEMUX } return true; } //--------------------------------------------------------------------------- void File_Riff::Header_Parse() { //Special case : W3DI tags (unknown format!) are at the end of the file if (Element_Level==2 && File_Offset+Buffer_Size==File_Size && Buffer_Size>8) { if (CC4(Buffer+Buffer_Size-4)==Elements::W3DI) { int32u Size=LittleEndian2int32u(Buffer+Buffer_Size-8); if (Size>8 && Size<=Buffer_Size && Buffer_Offset+Size==Buffer_Size) { //Filling Header_Fill_Code(Elements::W3DI, "W3DI"); Header_Fill_Size(Size); return; } } } //Special case : SMV file detected if (SMV_BlockSize) { //Filling Header_Fill_Code(Elements::SMV0_xxxx, "SMV Block"); Header_Fill_Size(SMV_BlockSize); return; } //Parsing int32u Size, Name; Get_C4 (Name, "Name"); if (Name==Elements::SMV0) { //SMV specific //Filling Header_Fill_Code(Elements::SMV0, "SMV header"); Header_Fill_Size(51); return; } if (Name==Elements::riff) IsWave64=true; if (IsWave64) { //Wave64 specific int64u Size_Complete; Skip_XX(12, "Name (GUID)"); Get_L8 (Size_Complete, "Size"); //Alignment if (Name!=Elements::riff && Size_Complete%8) { Alignement_ExtraByte=Size_Complete%8; Size_Complete+=Alignement_ExtraByte; //Always 8-byte aligned } else Alignement_ExtraByte=0; //Top level chunks if (Name==Elements::riff) { Get_C4 (Name, "Real Name"); Skip_XX(12, "Real Name (GUID)"); } //Filling Header_Fill_Code(Name, Ztring().From_CC4(Name)); Header_Fill_Size(Size_Complete); return; } if (Name==Elements::FORM || Name==Elements::MThd) IsBigEndian=true; //Swap from Little to Big Endian for "FORM" files (AIFF...) if (IsBigEndian) Get_B4 (Size, "Size"); else { Get_L4 (Size, "Size"); //Testing malformed (not word aligned) if (!IsNotWordAligned_Tested && Size%2) { if (File_Offset+Buffer_Offset+8+Size==File_Size) IsNotWordAligned=true; else if (!File_Name.empty()) { File F(File_Name); F.GoTo(File_Offset+Buffer_Offset+8+Size); int8u Temp; if (F.Read(&Temp, 1)) { if (!((Temp<'A' || Temp>'z') && Temp!=' ')) IsNotWordAligned=true; } } IsNotWordAligned_Tested=true; } } //RF64 int64u Size_Complete=Size; if (Size==0 && Name==Elements::RIFF) Size_Complete=File_Size-8; else if (Size==0xFFFFFFFF) { if (Element_Size<0x1C) { Element_WaitForMoreData(); return; } if (Name==Elements::RF64 && CC4(Buffer+Buffer_Offset+0x0C)==Elements::WAVE_ds64) { Size_Complete=LittleEndian2int64u(Buffer+Buffer_Offset+0x14); Param_Info1(Size_Complete); } else if (Name==Elements::WAVE_data) { Size_Complete=WAVE_data_Size; Param_Info1(Size_Complete); } } //Coherency if (Stream_Structure_Temp!=Stream_Structure.end() && Stream_Structure_Temp->second.Size==0) { Name=(int32u)-1; Size_Complete=0; //Hack in some indexes with Size==0 (why?), ignoring content of header } if (File_Offset+Buffer_Offset+8+Size_Complete>File_Size) Size_Complete=File_Size-(File_Offset+Buffer_Offset+8); //Alignment if (Size_Complete%2 && !IsNotWordAligned) { Size_Complete++; //Always 2-byte aligned Alignement_ExtraByte=1; } else Alignement_ExtraByte=0; //Top level chunks if (Name==Elements::LIST || Name==Elements::RIFF || Name==Elements::RF64 || Name==Elements::ON2_ || Name==Elements::FORM) { if (Name==Elements::RF64) IsRIFF64=true; Get_C4 (Name, "Real Name"); } //Integrity if (Name==0x00000000) { //Filling Header_Fill_Code(0, "Junk"); Header_Fill_Size(File_Size-(File_Offset+Buffer_Offset)); Alignement_ExtraByte=0; return; } //Specific if (Name==Elements::ON2f) Name=Elements::AVI_; //Tests if (Element_Level==2 && Name==Elements::WAVE && !IsRIFF64 && File_Size>0xFFFFFFFF) IsWaveBroken=true; //Non standard big files detection if (IsWaveBroken && (Name==Elements::WAVE || Name==Elements::WAVE_data)) Size_Complete=File_Size-(File_Offset+Buffer_Offset+8); //Non standard big files detection if (movi_Size && Size_Complete>movi_Size/2 && 8+Size_Complete>1024*1024 && !((Name&0xFFFF0000)==0x69780000 || (Name&0x0000FFFF)==0x00006978) && Element_Level==(rec__Present?(size_t)5:(size_t)4) && Buffer_Offset+8+Size_Complete>Buffer_Size) { Buffer_DataToParse_End=File_Offset+Buffer_Offset+8+Size_Complete; Size_Complete=Buffer_Size-(Buffer_Offset+8); } if ((Name==Elements::WAVE_data || Name==Elements::AIFF_SSND)) { Buffer_DataToParse_Begin=File_Offset+Buffer_Offset+8; if (Size_Complete) Buffer_DataToParse_End=File_Offset+Buffer_Offset+8+Size_Complete; else Buffer_DataToParse_End=File_Size; //Found one file with 0 as size of data part Size_Complete=0; } //Filling Header_Fill_Code(Name, Ztring().From_CC4(Name)); Header_Fill_Size(Size_Complete+8); } //--------------------------------------------------------------------------- bool File_Riff::BookMark_Needed() { //Go to the first usefull chunk if (stream_Count==0 && Stream_Structure.empty()) return false; //No need Stream_Structure_Temp=Stream_Structure.begin(); if (!Stream_Structure.empty()) { #if MEDIAINFO_MD5 if (Config->File_Md5_Get()) { GoTo(0); Md5_ParseUpTo=Stream_Structure_Temp->first; } else #endif //MEDIAINFO_MD5 GoTo(Stream_Structure_Temp->first); } NeedOldIndex=false; SecondPass=true; Index_Pos.clear(); //We didn't succeed to find theses indexes :( return true; } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- void File_Riff::TimeCode_Fill(const Ztring &Name, const Ztring &Value) { if (Value.empty()) return; for (size_t StreamPos=0; StreamPos #endif //defined(MEDIAINFO_ANCILLARY_YES) #include //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Riff //*************************************************************************** class File_Riff : public File__Analyze { public : //In/Out #if defined(MEDIAINFO_ANCILLARY_YES) File_Ancillary** Ancillary; #endif //defined(MEDIAINFO_ANCILLARY_YES) protected : //Streams management void Streams_Finish(); public : File_Riff(); ~File_Riff(); private : //Buffer - Global void Read_Buffer_Init(); #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK #if MEDIAINFO_DEMUX void Read_Buffer_Continue (); #endif //MEDIAINFO_DEMUX void Read_Buffer_Unsynched(); //Buffer - Per element bool Header_Begin(); void Header_Parse(); void Data_Parse(); bool BookMark_Needed(); //Data struct stream { std::vector Parsers; int32u fccType; int32u fccHandler; int32u Scale; int32u Rate; int32u Start; int32u Length; int32u Compression; stream_t StreamKind; size_t StreamPos; int32u AvgBytesPerSec; size_t PacketPos; size_t PacketCount; int64u StreamSize; int64u indx_Duration; bool SearchingPayload; bool Specific_IsMpeg4v; bool ChunksAreComplete; bool IsPcm; stream() { fccType=0x00000000; fccHandler=0x00000000; Scale=0; Rate=0; Start=0; Length=0; Compression=0x00000000; StreamKind=Stream_Max; StreamPos=0; AvgBytesPerSec=0; PacketPos=0; PacketCount=0; StreamSize=0; indx_Duration=0; SearchingPayload=true; Specific_IsMpeg4v=false; ChunksAreComplete=true; IsPcm=false; } ~stream() { for (size_t Pos=0; Pos Stream; int32u Stream_ID; struct stream_structure { int64u Name; int64u Size; }; std::map Stream_Structure; std::map::iterator Stream_Structure_Temp; std::map Index_Pos; int64u Interleaved0_1; int64u Interleaved0_10; int64u Interleaved1_1; int64u Interleaved1_10; //Temp Ztring INFO_ISMP; Ztring Tdat_tc_A; Ztring Tdat_tc_O; ZtringList MD5s; int64u WAVE_data_Size; //RF64 WAVE_data real chunk size int64u WAVE_fact_samplesCount; //RF64 WAVE_fact real samplesCount int64u Alignement_ExtraByte; //Padding from the container int64u Buffer_DataToParse_Begin; int64u Buffer_DataToParse_End; int32u AvgBytesPerSec; int16u BlockAlign; float64 PAR; float64 Demux_Rate; float64 avih_FrameRate; //FrameRate of the first video stream in one MOVI chunk int32u avih_TotalFrame; //Count of frames in one MOVI chunk int32u dmlh_TotalFrame; //Count of frames in the whole AVI file (with odml too) int64u Idx1_Offset; //Pos of the data part (AVI) for Idx1 chunk int64u movi_Size; //Size of the data part (AVI and AVIX) int64u TimeReference; //Only used by Brodcast extension int32u SMV_BlockSize; //Size of a SMV block, 0 if not SMV int32u SMV_FrameCount; //Frame count of a SMV block, 0 if not SMV int32u SamplesPerSec; //For bext int16u BitsPerSample; //For PCM only int8u stream_Count; //How many stream we have to parse bool rec__Present; //True if synchro element is present bool NeedOldIndex; bool IsBigEndian; bool IsWave64; bool IsRIFF64; bool IsWaveBroken; bool IsNotWordAligned; bool IsNotWordAligned_Tested; bool SecondPass; //Second pass for streams File__Analyze* DV_FromHeader; enum kind { Kind_None, Kind_Avi, Kind_Wave, Kind_Aiff, Kind_Rmp3, }; kind Kind; #if defined(MEDIAINFO_GXF_YES) int32u rcrd_fld__anc__pos__LineNumber; #endif //defined(MEDIAINFO_GXF_YES) void TimeCode_Fill(const Ztring &Name, const Ztring &Value); //Chunks void AIFC (); void AIFC_COMM (); void AIFC_COMT (); void AIFC_FVER (); void AIFC_SSND (); void AIFF_SSND_Continue(); void AIFC_xxxx (); void AIFF (); void AIFF_COMM (); void AIFF_COMT (); void AIFF_ID3_ () {WAVE_ID3_();} void AIFF_SSND (); void AIFF_xxxx (); void AVI_ (); void AVI__cset (); void AVI__Cr8r (); void AVI__exif (); void AVI__exif_xxxx (); void AVI__goog (); void AVI__goog_GDAT (); void AVI__hdlr (); void AVI__hdlr_avih (); void AVI__hdlr_JUNK (); void AVI__hdlr_strl (); void AVI__hdlr_strl_indx (); void AVI__hdlr_strl_indx_StandardIndex (int32u Entry_Count, int32u ChunkId); void AVI__hdlr_strl_indx_FieldIndex (int32u Entry_Count, int32u ChunkId); void AVI__hdlr_strl_indx_SuperIndex (int32u Entry_Count, int32u ChunkId); void AVI__hdlr_strl_JUNK (); void AVI__hdlr_strl_strd (); void AVI__hdlr_strl_strf (); void AVI__hdlr_strl_strf_auds (); void AVI__hdlr_strl_strf_auds_Mpega(); void AVI__hdlr_strl_strf_auds_Aac(); void AVI__hdlr_strl_strf_auds_Vorbis(); void AVI__hdlr_strl_strf_auds_Vorbis2(); void AVI__hdlr_strl_strf_auds_ExtensibleWave(); void AVI__hdlr_strl_strf_iavs (); void AVI__hdlr_strl_strf_mids (); void AVI__hdlr_strl_strf_txts (); void AVI__hdlr_strl_strf_vids (); void AVI__hdlr_strl_strf_vids_Avc (); void AVI__hdlr_strl_strh (); void AVI__hdlr_strl_strn (); void AVI__hdlr_strl_vprp (); void AVI__hdlr_odml (); void AVI__hdlr_odml_dmlh (); void AVI__hdlr_ON2h (); void AVI__hdlr_xxxx (); void AVI__idx1 (); void AVI__INFO (); void AVI__INFO_IID3 (); void AVI__INFO_ILYC (); void AVI__INFO_IMP3 (); void AVI__INFO_JUNK (); void AVI__INFO_xxxx (); void AVI__JUNK (); void AVI__MD5_ (); void AVI__movi (); void AVI__movi_xxxx (); void AVI__movi_xxxx___dc (); void AVI__movi_xxxx___tx (); void AVI__movi_xxxx___wb (); void AVI__movi_rec_ (); void AVI__movi_rec__xxxx (); void AVI__movi_StreamJump (); void AVI__PrmA (); void AVI__Tdat (); void AVI__Tdat_rn_A (); void AVI__Tdat_rn_O (); void AVI__Tdat_tc_A (); void AVI__Tdat_tc_O (); void AVI__GMET (); void AVI__xxxx (); void AVIX (); void AVIX_idx1 (); void AVIX_movi (); void AVIX_movi_xxxx (); void AVIX_movi_rec_ (); void AVIX_movi_rec__xxxx (); void CADP (); void CDDA (); void CDDA_fmt_ (); void CMJP (); void CMP4 (); void IDVX (); void INDX (); void INDX_xxxx (); void JUNK (); void menu (); void MThd (); void MTrk (); void PAL_ (); void QLCM (); void QLCM_fmt_ (); #if defined(MEDIAINFO_GXF_YES) void rcrd (); void rcrd_desc (); void rcrd_fld_ (); void rcrd_fld__anc_ (); void rcrd_fld__anc__pos_ (); void rcrd_fld__anc__pyld (); void rcrd_fld__finf (); #endif //defined(MEDIAINFO_GXF_YES) void RDIB (); void RMID (); void RMMP (); void RMP3 (); void RMP3_data (); void RMP3_data_Continue(); void RMP3_INFO() {AVI__INFO();} void RMP3_INFO_IID3() {AVI__INFO_IID3();} void RMP3_INFO_ILYC() {AVI__INFO_ILYC();} void RMP3_INFO_IMP3() {AVI__INFO_IMP3();} void RMP3_INFO_JUNK() {AVI__INFO_JUNK ();} void RMP3_INFO_xxxx() {AVI__INFO_xxxx ();} void SMV0 (); void SMV0_xxxx (); void WAVE (); void WAVE__pmx (); void WAVE_aXML (); void WAVE_bext (); void WAVE_cue_ (); void WAVE_data (); void WAVE_data_Continue (); void WAVE_ds64 (); void WAVE_fact (); void WAVE_fmt_ (); void WAVE_ID3_ (); void WAVE_id3_ () {WAVE_ID3_();} void WAVE_INFO() {AVI__INFO();} void WAVE_INFO_xxxx() {AVI__INFO_xxxx ();} void WAVE_iXML (); void wave (); void wave_data () {WAVE_data();} void wave_fmt_ () {WAVE_fmt_();} void W3DI(); //Temp #if MEDIAINFO_DEMUX File__Analyze* Demux_Parser; #endif //MEDIAINFO_DEMUX }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Riff_Elements.cpp100777 0 0 441161 12253650370 17604 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Elements part // // Contributor: Lionel Duchateau, kurtnoise@free.fr // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #ifdef MEDIAINFO_RIFF_YES //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Riff.h" #if defined(MEDIAINFO_DVDIF_YES) #include "MediaInfo/Multiple/File_DvDif.h" #endif #if defined(MEDIAINFO_OGG_YES) #include "MediaInfo/Multiple/File_Ogg.h" #include "MediaInfo/Multiple/File_Ogg_SubElement.h" #endif #if defined(MEDIAINFO_MPEG4V_YES) #include "MediaInfo/Video/File_Mpeg4v.h" #endif #if defined(MEDIAINFO_MPEGV_YES) #include "MediaInfo/Video/File_Mpegv.h" #endif #if defined(MEDIAINFO_AVC_YES) #include "MediaInfo/Video/File_Avc.h" #endif #if defined(MEDIAINFO_CANOPUS_YES) #include "MediaInfo/Video/File_Canopus.h" #endif #if defined(MEDIAINFO_FRAPS_YES) #include "MediaInfo/Video/File_Fraps.h" #endif #if defined(MEDIAINFO_LAGARITH_YES) #include "MediaInfo/Video/File_Lagarith.h" #endif #if defined(MEDIAINFO_MPEGA_YES) #include "MediaInfo/Audio/File_Mpega.h" #endif #if defined(MEDIAINFO_AAC_YES) #include "MediaInfo/Audio/File_Aac.h" #endif #if defined(MEDIAINFO_AC3_YES) #include "MediaInfo/Audio/File_Ac3.h" #endif #if defined(MEDIAINFO_DTS_YES) #include "MediaInfo/Audio/File_Dts.h" #endif #if defined(MEDIAINFO_JPEG_YES) #include "MediaInfo/Image/File_Jpeg.h" #endif #if defined(MEDIAINFO_SUBRIP_YES) #include "MediaInfo/Text/File_SubRip.h" #endif #if defined(MEDIAINFO_OTHERTEXT_YES) #include "MediaInfo/Text/File_OtherText.h" #endif #if defined(MEDIAINFO_ADPCM_YES) #include "MediaInfo/Audio/File_Adpcm.h" #endif #if defined(MEDIAINFO_PCM_YES) #include "MediaInfo/Audio/File_Pcm.h" #endif #if defined(MEDIAINFO_SMPTEST0337_YES) #include "MediaInfo/Audio/File_SmpteSt0337.h" #endif #if defined(MEDIAINFO_ID3_YES) #include "MediaInfo/Tag/File_Id3.h" #endif #if defined(MEDIAINFO_ID3V2_YES) #include "MediaInfo/Tag/File_Id3v2.h" #endif #if defined(MEDIAINFO_GXF_YES) #if defined(MEDIAINFO_CDP_YES) #include "MediaInfo/Text/File_Cdp.h" #include #endif #endif //MEDIAINFO_GXF_YES #include "MediaInfo/MediaInfo_Config_MediaInfo.h" using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- std::string ExtensibleWave_ChannelMask (int32u ChannelMask) { std::string Text; if ((ChannelMask&0x0007)!=0x0000) Text+="Front:"; if (ChannelMask&0x0001) Text+=" L"; if (ChannelMask&0x0004) Text+=" C"; if (ChannelMask&0x0002) Text+=" R"; if ((ChannelMask&0x0600)!=0x0000) Text+=", Side:"; if (ChannelMask&0x0200) Text+=" L"; if (ChannelMask&0x0400) Text+=" R"; if ((ChannelMask&0x0130)!=0x0000) Text+=", Back:"; if (ChannelMask&0x0010) Text+=" L"; if (ChannelMask&0x0100) Text+=" C"; if (ChannelMask&0x0020) Text+=" R"; if ((ChannelMask&0x0008)!=0x0000) Text+=", LFE"; return Text; } //--------------------------------------------------------------------------- std::string ExtensibleWave_ChannelMask2 (int32u ChannelMask) { std::string Text; int8u Count=0; if (ChannelMask&0x0001) Count++; if (ChannelMask&0x0004) Count++; if (ChannelMask&0x0002) Count++; Text+=Ztring::ToZtring(Count).To_UTF8(); Count=0; if (ChannelMask&0x0200) Count++; if (ChannelMask&0x0400) Count++; Text+="/"+Ztring::ToZtring(Count).To_UTF8(); Count=0; if (ChannelMask&0x0010) Count++; if (ChannelMask&0x0100) Count++; if (ChannelMask&0x0020) Count++; Text+="/"+Ztring::ToZtring(Count).To_UTF8(); Count=0; if (ChannelMask&0x0008) Text+=".1"; return Text; } //*************************************************************************** // Const //*************************************************************************** namespace Elements { const int32u FORM=0x464F524D; const int32u LIST=0x4C495354; const int32u ON2_=0x4F4E3220; const int32u RIFF=0x52494646; const int32u RF64=0x52463634; const int32u AIFC=0x41494643; const int32u AIFC_COMM=0x434F4D4D; const int32u AIFC_COMT=0x434F4D54; const int32u AIFC_FVER=0x46564552; const int32u AIFC_SSND=0x53534E44; const int32u AIFF=0x41494646; const int32u AIFF_COMM=0x434F4D4D; const int32u AIFF_COMT=0x434F4D54; const int32u AIFF_SSND=0x53534E44; const int32u AIFF__c__=0x28632920; const int32u AIFF_ANNO=0x414E4E4F; const int32u AIFF_AUTH=0x41555448; const int32u AIFF_NAME=0x4E414D45; const int32u AIFF_ID3_=0x49443320; const int32u AVI_=0x41564920; const int32u AVI__cset=0x63736574; const int32u AVI__Cr8r=0x43723872; const int32u AVI__exif=0x65786966; const int32u AVI__exif_ecor=0x65636F72; const int32u AVI__exif_emdl=0x656D646C; const int32u AVI__exif_emnt=0x656D6E74; const int32u AVI__exif_erel=0x6572656C; const int32u AVI__exif_etim=0x6574696D; const int32u AVI__exif_eucm=0x6575636D; const int32u AVI__exif_ever=0x65766572; const int32u AVI__goog=0x676F6F67; const int32u AVI__goog_GDAT=0x47444154; const int32u AVI__GMET=0x474D4554; const int32u AVI__hdlr=0x6864726C; const int32u AVI__hdlr_avih=0x61766968; const int32u AVI__hdlr_JUNK=0x4A554E4B; const int32u AVI__hdlr_strl=0x7374726C; const int32u AVI__hdlr_strl_indx=0x696E6478; const int32u AVI__hdlr_strl_JUNK=0x4A554E4B; const int32u AVI__hdlr_strl_strd=0x73747264; const int32u AVI__hdlr_strl_strf=0x73747266; const int32u AVI__hdlr_strl_strh=0x73747268; const int32u AVI__hdlr_strl_strh_auds=0x61756473; const int32u AVI__hdlr_strl_strh_iavs=0x69617673; const int32u AVI__hdlr_strl_strh_mids=0x6D696473; const int32u AVI__hdlr_strl_strh_vids=0x76696473; const int32u AVI__hdlr_strl_strh_txts=0x74787473; const int32u AVI__hdlr_strl_strn=0x7374726E; const int32u AVI__hdlr_strl_vprp=0x76707270; const int32u AVI__hdlr_odml=0x6F646D6C; const int32u AVI__hdlr_odml_dmlh=0x646D6C68; const int32u AVI__hdlr_ON2h=0x4F4E3268; const int32u AVI__idx1=0x69647831; const int32u AVI__INFO=0x494E464F; const int32u AVI__INFO_IARL=0x4941524C; const int32u AVI__INFO_IART=0x49415254; const int32u AVI__INFO_IAS1=0x49415331; const int32u AVI__INFO_IAS2=0x49415332; const int32u AVI__INFO_IAS3=0x49415333; const int32u AVI__INFO_IAS4=0x49415334; const int32u AVI__INFO_IAS5=0x49415335; const int32u AVI__INFO_IAS6=0x49415336; const int32u AVI__INFO_IAS7=0x49415337; const int32u AVI__INFO_IAS8=0x49415338; const int32u AVI__INFO_IAS9=0x49415339; const int32u AVI__INFO_ICDS=0x49434453; const int32u AVI__INFO_ICMS=0x49434D53; const int32u AVI__INFO_ICMT=0x49434D54; const int32u AVI__INFO_ICNT=0x49434E54; const int32u AVI__INFO_ICOP=0x49434F50; const int32u AVI__INFO_ICNM=0x49434E4D; const int32u AVI__INFO_ICRD=0x49435244; const int32u AVI__INFO_ICRP=0x49435250; const int32u AVI__INFO_IDIM=0x4944494D; const int32u AVI__INFO_IDIT=0x49444954; const int32u AVI__INFO_IDPI=0x49445049; const int32u AVI__INFO_IDST=0x49445354; const int32u AVI__INFO_IEDT=0x49454454; const int32u AVI__INFO_IENG=0x49454E47; const int32u AVI__INFO_IFRM=0x4946524D; const int32u AVI__INFO_IGNR=0x49474E52; const int32u AVI__INFO_IID3=0x49494433; const int32u AVI__INFO_IKEY=0x494B4559; const int32u AVI__INFO_ILGT=0x494C4754; const int32u AVI__INFO_ILNG=0x494C4E47; const int32u AVI__INFO_ILYC=0x494C5943; const int32u AVI__INFO_IMED=0x494D4544; const int32u AVI__INFO_IMP3=0x494D5033; const int32u AVI__INFO_IMUS=0x494D5553; const int32u AVI__INFO_INAM=0x494E414D; const int32u AVI__INFO_IPLT=0x49504C54; const int32u AVI__INFO_IPDS=0x49504453; const int32u AVI__INFO_IPRD=0x49505244; const int32u AVI__INFO_IPRT=0x49505254; const int32u AVI__INFO_IPRO=0x4950524F; const int32u AVI__INFO_IRTD=0x49525444; const int32u AVI__INFO_ISBJ=0x4953424A; const int32u AVI__INFO_ISGN=0x4953474E; const int32u AVI__INFO_ISTD=0x49535444; const int32u AVI__INFO_ISTR=0x49535452; const int32u AVI__INFO_ISFT=0x49534654; const int32u AVI__INFO_ISHP=0x49534850; const int32u AVI__INFO_ISMP=0x49534D50; const int32u AVI__INFO_ISRC=0x49535243; const int32u AVI__INFO_ISRF=0x49535246; const int32u AVI__INFO_ITCH=0x49544348; const int32u AVI__INFO_IWEB=0x49574542; const int32u AVI__INFO_IWRI=0x49575249; const int32u AVI__INFO_JUNK=0x4A554E4B; const int32u AVI__JUNK=0x4A554E4B; const int32u AVI__MD5_=0x4D443520; const int32u AVI__movi=0x6D6F7669; const int32u AVI__movi_rec_=0x72656320; const int32u AVI__movi_xxxx_____=0x00005F5F; const int32u AVI__movi_xxxx___db=0x00006462; const int32u AVI__movi_xxxx___dc=0x00006463; const int32u AVI__movi_xxxx___sb=0x00007362; const int32u AVI__movi_xxxx___tx=0x00007478; const int32u AVI__movi_xxxx___wb=0x00007762; const int32u AVI__PrmA=0x50726D41; const int32u AVI__Tdat=0x54646174; const int32u AVI__Tdat_rn_A=0x726E5F41; const int32u AVI__Tdat_rn_O=0x726E5F4F; const int32u AVI__Tdat_tc_A=0x74635F41; const int32u AVI__Tdat_tc_O=0x74635F4F; const int32u AVIX=0x41564958; const int32u AVIX_idx1=0x69647831; const int32u AVIX_movi=0x6D6F7669; const int32u AVIX_movi_rec_=0x72656320; const int32u CADP=0x43414450; const int32u CDDA=0x43444441; const int32u CDDA_fmt_=0x666D7420; const int32u CMJP=0x434D4A50; const int32u CMP4=0x434D5034; const int32u IDVX=0x49445658; const int32u INDX=0x494E4458; const int32u JUNK=0x4A554E4B; const int32u menu=0x6D656E75; const int32u MThd=0x4D546864; const int32u MTrk=0x4D54726B; const int32u PAL_=0x50414C20; const int32u QLCM=0x514C434D; const int32u QLCM_fmt_=0x666D7420; const int32u rcrd=0x72637264; const int32u rcrd_desc=0x64657363; const int32u rcrd_fld_=0x666C6420; const int32u rcrd_fld__anc_=0x616E6320; const int32u rcrd_fld__anc__pos_=0x706F7320; const int32u rcrd_fld__anc__pyld=0x70796C64; const int32u rcrd_fld__finf=0x66696E66; const int32u RDIB=0x52444942; const int32u RMID=0x524D4944; const int32u RMMP=0x524D4D50; const int32u RMP3=0x524D5033; const int32u RMP3_data=0x64617461; const int32u RMP3_INFO=0x494E464F; const int32u RMP3_INFO_IID3=0x49494433; const int32u RMP3_INFO_ILYC=0x494C5943; const int32u RMP3_INFO_IMP3=0x494D5033; const int32u RMP3_INFO_JUNK=0x4A554E4B; const int32u SMV0=0x534D5630; const int32u SMV0_xxxx=0x534D563A; const int32u WAVE=0x57415645; const int32u WAVE__pmx=0x20786D70; const int32u WAVE_aXML=0x61584D4C; const int32u WAVE_bext=0x62657874; const int32u WAVE_cue_=0x63756520; const int32u WAVE_data=0x64617461; const int32u WAVE_ds64=0x64733634; const int32u WAVE_fact=0x66616374; const int32u WAVE_fmt_=0x666D7420; const int32u WAVE_ID3_=0x49443320; const int32u WAVE_id3_=0x69643320; const int32u WAVE_INFO=0x494E464F; const int32u WAVE_iXML=0x69584D4C; const int32u wave=0x77617665; const int32u wave_data=0x64617461; const int32u wave_fmt_=0x666D7420; const int32u W3DI=0x57334449; #define UUID(NAME, PART1, PART2, PART3, PART4, PART5) \ const int64u NAME =0x##PART3##PART2##PART1##ULL; \ const int64u NAME##2=0x##PART4##PART5##ULL; \ UUID(QLCM_QCELP1, 5E7F6D41, B115, 11D0, BA91, 00805FB4B97E) UUID(QLCM_QCELP2, 5E7F6D42, B115, 11D0, BA91, 00805FB4B97E) UUID(QLCM_EVRC, E689D48D, 9076, 46B5, 91EF, 736A5100CEB4) UUID(QLCM_SMV, 8D7C2B75, A797, ED49, 985E, D53C8CC75F84) } //*************************************************************************** // Format //*************************************************************************** //--------------------------------------------------------------------------- void File_Riff::Data_Parse() { //Alignement specific Element_Size-=Alignement_ExtraByte; DATA_BEGIN LIST(AIFC) ATOM_BEGIN ATOM(AIFC_COMM) ATOM(AIFC_COMT) ATOM(AIFC_FVER) ATOM(AIFC_SSND) ATOM_DEFAULT(AIFC_xxxx) ATOM_END_DEFAULT LIST(AIFF) ATOM_BEGIN ATOM(AIFF_COMM) ATOM(AIFF_COMT) ATOM(AIFF_ID3_) LIST_SKIP(AIFF_SSND) ATOM_DEFAULT(AIFF_xxxx) ATOM_END_DEFAULT LIST(AVI_) ATOM_BEGIN ATOM(AVI__Cr8r); ATOM(AVI__cset) LIST(AVI__exif) ATOM_DEFAULT_ALONE(AVI__exif_xxxx) LIST(AVI__goog) ATOM_BEGIN ATOM(AVI__goog_GDAT) ATOM_END ATOM(AVI__GMET) LIST(AVI__hdlr) ATOM_BEGIN ATOM(AVI__hdlr_avih) ATOM(AVI__hdlr_JUNK) LIST(AVI__hdlr_strl) ATOM_BEGIN ATOM(AVI__hdlr_strl_indx) ATOM(AVI__hdlr_strl_JUNK) ATOM(AVI__hdlr_strl_strd) ATOM(AVI__hdlr_strl_strf) ATOM(AVI__hdlr_strl_strh) ATOM(AVI__hdlr_strl_strn) ATOM(AVI__hdlr_strl_vprp) ATOM_END LIST(AVI__hdlr_odml) ATOM_BEGIN ATOM(AVI__hdlr_odml_dmlh) ATOM_END ATOM(AVI__hdlr_ON2h) LIST(AVI__INFO) ATOM_BEGIN ATOM(AVI__INFO_IID3) ATOM(AVI__INFO_ILYC) ATOM(AVI__INFO_IMP3) ATOM(AVI__INFO_JUNK) ATOM_DEFAULT(AVI__INFO_xxxx) ATOM_END_DEFAULT ATOM_DEFAULT(AVI__hdlr_xxxx) ATOM_END_DEFAULT ATOM(AVI__idx1) LIST(AVI__INFO) ATOM_BEGIN ATOM(AVI__INFO_IID3) ATOM(AVI__INFO_ILYC) ATOM(AVI__INFO_IMP3) ATOM(AVI__INFO_JUNK) ATOM_DEFAULT(AVI__INFO_xxxx) ATOM_END_DEFAULT ATOM(AVI__JUNK) ATOM(AVI__MD5_) LIST(AVI__movi) ATOM_BEGIN LIST(AVI__movi_rec_) ATOM_DEFAULT_ALONE(AVI__movi_xxxx) ATOM_DEFAULT(AVI__movi_xxxx) ATOM_END_DEFAULT ATOM(AVI__PrmA); LIST(AVI__Tdat) ATOM_BEGIN ATOM(AVI__Tdat_rn_A) ATOM(AVI__Tdat_rn_O) ATOM(AVI__Tdat_tc_A) ATOM(AVI__Tdat_tc_O) ATOM_END ATOM_DEFAULT(AVI__xxxx) ATOM_END_DEFAULT LIST(AVIX) //OpenDML ATOM_BEGIN ATOM(AVIX_idx1) LIST(AVIX_movi) ATOM_BEGIN LIST(AVIX_movi_rec_) ATOM_DEFAULT_ALONE(AVIX_movi_xxxx) ATOM_DEFAULT(AVIX_movi_xxxx) ATOM_END_DEFAULT ATOM_END ATOM_PARTIAL(CADP) LIST(CDDA) ATOM_BEGIN ATOM(CDDA_fmt_) ATOM_END ATOM_PARTIAL(CMJP) ATOM(CMP4) ATOM(IDVX) LIST(INDX) ATOM_DEFAULT_ALONE(INDX_xxxx) LIST_SKIP(JUNK) LIST_SKIP(menu) ATOM(MThd) LIST_SKIP(MTrk) LIST_SKIP(PAL_) LIST(QLCM) ATOM_BEGIN ATOM(QLCM_fmt_) ATOM_END #if defined(MEDIAINFO_GXF_YES) LIST(rcrd) ATOM_BEGIN ATOM(rcrd_desc) LIST(rcrd_fld_) ATOM_BEGIN LIST(rcrd_fld__anc_) ATOM_BEGIN ATOM(rcrd_fld__anc__pos_) ATOM(rcrd_fld__anc__pyld) ATOM_END ATOM(rcrd_fld__finf) ATOM_END ATOM_END #endif //defined(MEDIAINFO_GXF_YES) LIST_SKIP(RDIB) LIST_SKIP(RMID) LIST_SKIP(RMMP) LIST(RMP3) ATOM_BEGIN LIST(RMP3_data) break; LIST(RMP3_INFO) ATOM_BEGIN ATOM(RMP3_INFO_IID3) ATOM(RMP3_INFO_ILYC) ATOM(RMP3_INFO_IMP3) ATOM(RMP3_INFO_JUNK) ATOM_DEFAULT(RMP3_INFO_xxxx) ATOM_END_DEFAULT ATOM_END ATOM(SMV0) ATOM(SMV0_xxxx) ATOM(W3DI) LIST(WAVE) ATOM_BEGIN ATOM(WAVE__pmx) ATOM(WAVE_aXML) ATOM(WAVE_bext) LIST(WAVE_data) break; ATOM(WAVE_cue_) ATOM(WAVE_ds64) ATOM(WAVE_fact) ATOM(WAVE_fmt_) ATOM(WAVE_ID3_) ATOM(WAVE_id3_) LIST(WAVE_INFO) ATOM_DEFAULT_ALONE(WAVE_INFO_xxxx) ATOM(WAVE_iXML) ATOM_END LIST(wave) ATOM_BEGIN LIST(wave_data) break; ATOM(wave_fmt_) ATOM_END DATA_END if (Alignement_ExtraByte) { Element_Size+=Alignement_ExtraByte; if (Element_Offset+Alignement_ExtraByte==Element_Size) Skip_XX(Alignement_ExtraByte, "Alignement"); } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Riff::AIFC() { Data_Accept("AIFF Compressed"); Element_Name("AIFF Compressed"); //Filling Fill(Stream_General, 0, General_Format, "AIFF"); Stream_Prepare(Stream_Audio); Kind=Kind_Aiff; #if MEDIAINFO_EVENTS StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS } //--------------------------------------------------------------------------- void File_Riff::AIFC_COMM() { AIFF_COMM(); } //--------------------------------------------------------------------------- void File_Riff::AIFC_COMT() { AIFF_COMT(); } //--------------------------------------------------------------------------- void File_Riff::AIFC_FVER() { Element_Name("Format Version"); //Parsing Skip_B4( "Version"); } //--------------------------------------------------------------------------- void File_Riff::AIFC_SSND() { AIFF_SSND(); } //--------------------------------------------------------------------------- void File_Riff::AIFC_xxxx() { AIFF_xxxx(); } //--------------------------------------------------------------------------- void File_Riff::AIFF() { Data_Accept("AIFF"); Element_Name("AIFF"); //Filling Fill(Stream_General, 0, General_Format, "AIFF"); Stream_Prepare(Stream_Audio); Kind=Kind_Aiff; #if MEDIAINFO_EVENTS StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS } //--------------------------------------------------------------------------- void File_Riff::AIFF_COMM() { Element_Name("Common"); int32u numSampleFrames; int16u numChannels, sampleSize; float80 sampleRate; //Parsing Get_B2 (numChannels, "numChannels"); Get_B4 (numSampleFrames, "numSampleFrames"); Get_B2 (sampleSize, "sampleSize"); Get_BF10(sampleRate, "sampleRate"); if (Data_Remain()) //AIFC { int32u compressionType; Get_C4 (compressionType, "compressionType"); Skip_PA( "compressionName"); //Filling CodecID_Fill(Ztring().From_CC4(compressionType), Stream_Audio, StreamPos_Last, InfoCodecID_Format_Mpeg4); Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Ztring().From_CC4(compressionType)); } else { //Filling Fill(Stream_Audio, StreamPos_Last, Audio_Format, "PCM"); Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "PCM"); } //Filling Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, numChannels); Fill(Stream_Audio, StreamPos_Last, Audio_BitDepth, sampleSize); if (sampleRate) Fill(Stream_Audio, StreamPos_Last, Audio_Duration, numSampleFrames/sampleRate*1000); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, sampleRate, 0); //Compute the current codec ID Element_Code=(int64u)-1; Stream_ID=(int32u)-1; stream_Count=1; //Specific cases #if defined(MEDIAINFO_SMPTEST0337_YES) if (Retrieve(Stream_Audio, 0, Audio_CodecID).empty() && numChannels==2 && sampleSize<=32 && sampleRate==48000) //Some SMPTE ST 337 streams are hidden in PCM stream { File_SmpteSt0337* Parser=new File_SmpteSt0337; Parser->Endianness='B'; Parser->Container_Bits=(int8u)sampleSize; Parser->ShouldContinueParsing=true; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; Demux_Level=4; //Intermediate } #endif //MEDIAINFO_DEMUX Stream[Stream_ID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_PCM_YES) File_Pcm* Parser=new File_Pcm; Parser->Codec=Retrieve(Stream_Audio, StreamPos_Last, Audio_CodecID); if (Parser->Codec.empty() || Parser->Codec==__T("NONE")) Parser->Endianness='B'; Parser->BitDepth=(int8u)sampleSize; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) { Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; Demux_Level=4; //Intermediate } #endif //MEDIAINFO_DEMUX Stream[Stream_ID].Parsers.push_back(Parser); Stream[Stream_ID].IsPcm=true; Stream[Stream_ID].StreamKind=Stream_Audio; #endif #if MEDIAINFO_DEMUX BlockAlign=numChannels*sampleSize/8; AvgBytesPerSec=(int32u)float64_int64s(BlockAlign*(float64)sampleRate); #endif //MEDIAINFO_DEMUX Element_Code=(int64u)-1; for (size_t Pos=0; Pos0) avih_FrameRate=1000000.0/MicrosecPerFrame; } //--------------------------------------------------------------------------- void File_Riff::AVI__hdlr_JUNK() { Element_Name("Garbage"); } //--------------------------------------------------------------------------- void File_Riff::AVI__hdlr_odml() { Element_Name("OpenDML"); } //--------------------------------------------------------------------------- void File_Riff::AVI__hdlr_odml_dmlh() { Element_Name("OpenDML Header"); //Parsing Get_L4(dmlh_TotalFrame, "GrandFrames"); if (Element_OffsetElement_Size) break; //Malformed index int32u Offset=LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset ); int32u Size =LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset+4)&0x7FFFFFFF; Element_Offset+=8; //Stream Position and size if (Pos<300 || MediaInfoLib::Config.ParseSpeed_Get()==1.00) { Stream_Structure[BaseOffset+Offset-8].Name=ChunkId&0xFFFF0000; Stream_Structure[BaseOffset+Offset-8].Size=Size; } StreamSize+=(Size&0x7FFFFFFF); Stream[ChunkId&0xFFFF0000].PacketCount++; //Interleaved if (Pos== 0 && (ChunkId&0xFFFF0000)==0x30300000 && Interleaved0_1 ==0) Interleaved0_1 =BaseOffset+Offset-8; if (Pos==Entry_Count/10 && (ChunkId&0xFFFF0000)==0x30300000 && Interleaved0_10==0) Interleaved0_10=BaseOffset+Offset-8; if (Pos== 0 && (ChunkId&0xFFFF0000)==0x30310000 && Interleaved1_1 ==0) Interleaved1_1 =BaseOffset+Offset-8; if (Pos==Entry_Count/10 && (ChunkId&0xFFFF0000)==0x30310000 && Interleaved1_10==0) Interleaved1_10=BaseOffset+Offset-8; } Stream[ChunkId&0xFFFF0000].StreamSize+=StreamSize; if (Element_OffsetFrame_Count_Valid=2; Parser->ShouldContinueParsing=true; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get() && Retrieve(Stream_General, 0, General_Format)==__T("Wave")) { Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; Demux_Level=4; //Intermediate } #endif //MEDIAINFO_DEMUX Stream[Stream_ID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_SMPTEST0337_YES) { File_SmpteSt0337* Parser=new File_SmpteSt0337; Parser->Container_Bits=(int8u)BitsPerSample; Parser->Aligned=true; Parser->ShouldContinueParsing=true; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get() && Retrieve(Stream_General, 0, General_Format)==__T("Wave")) { Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; Demux_Level=4; //Intermediate } #endif //MEDIAINFO_DEMUX Stream[Stream_ID].Parsers.push_back(Parser); } #endif } #endif //Creating the parser if (0); #if defined(MEDIAINFO_MPEGA_YES) else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==__T("MPEG Audio")) { File_Mpega* Parser=new File_Mpega; Parser->CalculateDelay=true; Parser->ShouldContinueParsing=true; Stream[Stream_ID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_AC3_YES) else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==__T("AC-3")) { File_Ac3* Parser=new File_Ac3; Parser->Frame_Count_Valid=2; Parser->CalculateDelay=true; Parser->ShouldContinueParsing=true; Stream[Stream_ID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_DTS_YES) else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==__T("DTS")) { File_Dts* Parser=new File_Dts; Parser->Frame_Count_Valid=2; Parser->ShouldContinueParsing=true; Stream[Stream_ID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_AAC_YES) else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==__T("AAC")) { File_Aac* Parser=new File_Aac; Parser->Mode=File_Aac::Mode_ADTS; Parser->Frame_Count_Valid=1; Parser->ShouldContinueParsing=true; Stream[Stream_ID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_PCM_YES) else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==__T("PCM")) { File_Pcm* Parser=new File_Pcm; Parser->Codec=Codec; Parser->Endianness='L'; Parser->BitDepth=(int8u)BitsPerSample; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get() && Retrieve(Stream_General, 0, General_Format)==__T("Wave")) { Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; Demux_Level=4; //Intermediate } #endif //MEDIAINFO_DEMUX Stream[Stream_ID].Parsers.push_back(Parser); Stream[Stream_ID].IsPcm=true; } #endif #if defined(MEDIAINFO_ADPCM_YES) else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==__T("ADPCM")) { //Creating the parser File_Adpcm MI; MI.Codec=Codec; //Parsing Open_Buffer_Init(&MI); Open_Buffer_Continue(&MI, 0); //Filling Finish(&MI); Merge(MI, StreamKind_Last, 0, StreamPos_Last); } #endif #if defined(MEDIAINFO_OGG_YES) else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==__T("Vorbis") && FormatTag!=0x566F) //0x566F has config in this chunk { File_Ogg* Parser=new File_Ogg; Parser->ShouldContinueParsing=true; Stream[Stream_ID].Parsers.push_back(Parser); } #endif for (size_t Pos=0; PosElement_Size) return; //No options //Parsing int16u Option_Size; Get_L2 (Option_Size, "cbSize"); //Filling if (Option_Size>0) { if (0); else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==__T("MPEG Audio")) { if (Option_Size==12) AVI__hdlr_strl_strf_auds_Mpega(); else Skip_XX(Option_Size, "MPEG Audio - Uknown"); } else if (Codec==__T("AAC") || Codec==__T("FF") || Codec==__T("8180")) AVI__hdlr_strl_strf_auds_Aac(); else if (FormatTag==0x566F) //Vorbis with Config in this chunk AVI__hdlr_strl_strf_auds_Vorbis(); else if (FormatTag==0x6750) //Vorbis with Config in this chunk AVI__hdlr_strl_strf_auds_Vorbis2(); else if (FormatTag==0xFFFE) //Extensible Wave AVI__hdlr_strl_strf_auds_ExtensibleWave(); else if (Element_Offset+Option_Size<=Element_Size) Skip_XX(Option_Size, "Unknown"); else if (Element_Offset!=Element_Size) Skip_XX(Element_Size-Element_Offset, "Error"); } } //--------------------------------------------------------------------------- void File_Riff::AVI__hdlr_strl_strf_auds_Mpega() { //Parsing Element_Begin1("MPEG Audio options"); Skip_L2( "ID"); Skip_L4( "Flags"); Skip_L2( "BlockSize"); Skip_L2( "FramesPerBlock"); Skip_L2( "CodecDelay"); Element_End0(); } //--------------------------------------------------------------------------- void File_Riff::AVI__hdlr_strl_strf_auds_Aac() { //Parsing Element_Begin1("AAC options"); #if defined(MEDIAINFO_AAC_YES) File_Aac* MI=new File_Aac(); MI->Mode=File_Aac::Mode_AudioSpecificConfig; Open_Buffer_Init(MI); Open_Buffer_Continue(MI); Finish(MI); Merge(*MI, StreamKind_Last, 0, StreamPos_Last); delete MI; //MI=NULL; #else //MEDIAINFO_MPEG4_YES Skip_XX(Element_Size-Element_Offset, "(AudioSpecificConfig)"); #endif Element_End0(); } //--------------------------------------------------------------------------- void File_Riff::AVI__hdlr_strl_strf_auds_Vorbis() { //Parsing Element_Begin1("Vorbis options"); #if defined(MEDIAINFO_OGG_YES) File_Ogg_SubElement MI; Open_Buffer_Init(&MI); Element_Begin1("Element sizes"); //All elements parsing, except last one std::vector Elements_Size; size_t Elements_TotalSize=0; int8u Elements_Count; Get_L1(Elements_Count, "Element count"); Elements_Size.resize(Elements_Count+1); //+1 for the last block for (int8u Pos=0; PosElement_Size) return; //Adding the last block Elements_Size[Elements_Count]=(size_t)(Element_Size-(Element_Offset+Elements_TotalSize)); Elements_Count++; //Parsing blocks for (int8u Pos=0; PosCodec=Ztring().From_GUID(SubFormat); Parser->Endianness='L'; Parser->Sign='S'; Parser->BitDepth=(int8u)BitsPerSample; #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get() && Retrieve(Stream_General, 0, General_Format)==__T("Wave")) { Parser->Demux_Level=2; //Container Parser->Demux_UnpacketizeContainer=true; Demux_Level=4; //Intermediate } #endif //MEDIAINFO_DEMUX Stream[Stream_ID].Parsers.push_back(Parser); Stream[Stream_ID].IsPcm=true; } #endif for (size_t Pos=0; PosAuxToAnalyze=0x50; //Audio source Open_Buffer_Continue(DV_FromHeader, 4); //DVAAuxCtl ((File_DvDif*)DV_FromHeader)->AuxToAnalyze=0x51; //Audio control Open_Buffer_Continue(DV_FromHeader, Buffer+Buffer_Offset+(size_t)Element_Offset, 4); Element_Offset+=4; //DVAAuxSrc1 Skip_L4( "DVAAuxSrc1"); //DVAAuxCtl1 Skip_L4( "DVAAuxCtl1"); //DVVAuxSrc ((File_DvDif*)DV_FromHeader)->AuxToAnalyze=0x60; //Video source Open_Buffer_Continue(DV_FromHeader, 4); //DVAAuxCtl ((File_DvDif*)DV_FromHeader)->AuxToAnalyze=0x61; //Video control Open_Buffer_Continue(DV_FromHeader, 4); //Reserved if (Element_Offset=0x00000020 && (Compression&0x000000FF)<=0x0000007E && (Compression&0x0000FF00)>=0x00002000 && (Compression&0x0000FF00)<=0x00007E00 && (Compression&0x00FF0000)>=0x00200000 && (Compression&0x00FF0000)<=0x007E0000 && (Compression&0xFF000000)>=0x20000000 && (Compression&0xFF000000)<=0x7E000000) || Compression==0x00000000 || Compression==0x01000000 || Compression==0x02000000 || Compression==0x03000000 ) //Sometimes this value is wrong, we have to test this { if (Compression==CC4("DXSB")) { //Divx.com hack for subtitle, this is a text stream in a DivX Format Fill(Stream_General, 0, General_Format, "DivX", Unlimited, true, true); Stream_Prepare(Stream_Text); } else Stream_Prepare(Stream_Video); //Filling if (Compression==0x00000000 || Compression==0x01000000 || Compression==0x02000000 || Compression==0x03000000) { Ztring CodecID=__T("0x0000000")+Ztring::ToZtring(Compression>>24); CodecID_Fill(CodecID, StreamKind_Last, StreamPos_Last, InfoCodecID_Format_Riff); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec), CodecID); //FormatTag, may be replaced by codec parser Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec_CC), CodecID); //FormatTag } else { CodecID_Fill(Ztring().From_CC4(Compression), StreamKind_Last, StreamPos_Last, InfoCodecID_Format_Riff); Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec), Ztring().From_CC4(Compression).To_Local().c_str()); //FormatTag, may be replaced by codec parser Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec_CC), Ztring().From_CC4(Compression).To_Local().c_str()); //FormatTag } Fill(StreamKind_Last, StreamPos_Last, "Width", Width, 10, true); Fill(StreamKind_Last, StreamPos_Last, "Height", Height>=0x80000000?(-Height):Height, 10, true); // AVI can use negative height for raw to signal that it's coded top-down, not bottom-up if (Resolution==32 && Compression==0x74736363) //tscc Fill(StreamKind_Last, StreamPos_Last, "BitDepth", 8); else if (Compression==0x44495633) //DIV3 Fill(StreamKind_Last, StreamPos_Last, "BitDepth", 8); else if (MediaInfoLib::Config.CodecID_Get(StreamKind_Last, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression)).find(__T("Canopus"))!=std::string::npos) //Canopus codecs Fill(StreamKind_Last, StreamPos_Last, "BitDepth", Resolution/3); else if (Compression==0x44585342) //DXSB Fill(StreamKind_Last, StreamPos_Last, "BitDepth", Resolution); else if (MediaInfoLib::Config.CodecID_Get(StreamKind_Last, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_ColorSpace).find(__T("RGBA"))!=std::string::npos) //RGB codecs Fill(StreamKind_Last, StreamPos_Last, "BitDepth", Resolution/4); else if (Compression==0x00000000 //RGB || MediaInfoLib::Config.CodecID_Get(StreamKind_Last, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_ColorSpace).find(__T("RGB"))!=std::string::npos) //RGB codecs { if (Resolution==32) { Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Format), "RGBA", Unlimited, true, true); Fill(StreamKind_Last, StreamPos_Last, "BitDepth", Resolution/4); //With Alpha } else Fill(StreamKind_Last, StreamPos_Last, "BitDepth", Resolution<=16?8:(Resolution/3)); //indexed or normal } else if (Compression==0x56503632 //VP62 || MediaInfoLib::Config.CodecID_Get(StreamKind_Last, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_Format)==__T("H.263") //H.263 || MediaInfoLib::Config.CodecID_Get(StreamKind_Last, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_Format)==__T("VC-1")) //VC-1 Fill(StreamKind_Last, StreamPos_Last, "BitDepth", Resolution/3); } else { //Some Stream headers are broken, must use AVISTREAMINFOA structure instead of AVIFILEINFOA Stream_Prepare(Stream_Video); } Stream[Stream_ID].StreamKind=StreamKind_Last; //Creating the parser if (0); #if defined(MEDIAINFO_MPEGV_YES) else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_Format)==__T("MPEG Video")) { File_Mpegv* Parser=new File_Mpegv; Parser->FrameIsAlwaysComplete=true; Parser->TimeCodeIsNotTrustable=true; Stream[Stream_ID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_MPEG4V_YES) else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression))==__T("MPEG-4 Visual")) { File_Mpeg4v* Parser=new File_Mpeg4v; Stream[Stream_ID].Specific_IsMpeg4v=true; Parser->FrameIsAlwaysComplete=true; if (MediaInfoLib::Config.ParseSpeed_Get()>=0.5) Parser->ShouldContinueParsing=true; Stream[Stream_ID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_AVC_YES) else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression))==__T("AVC")) { File_Avc* Parser=new File_Avc; Parser->FrameIsAlwaysComplete=true; Stream[Stream_ID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_CANOPUS_YES) else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression))==__T("Canopus HQ")) { File_Canopus* Parser=new File_Canopus; Stream[Stream_ID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_JPEG_YES) else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression))==__T("JPEG")) { File_Jpeg* Parser=new File_Jpeg; Parser->StreamKind=Stream_Video; Stream[Stream_ID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_DVDIF_YES) else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression))==__T("DV")) { File_DvDif* Parser=new File_DvDif; Parser->IgnoreAudio=true; Stream[Stream_ID].Parsers.push_back(Parser); } #endif #if defined(MEDIAINFO_FRAPS_YES) else if (Compression==0x46505331) //"FPS1" { File_Fraps* Parser=new File_Fraps; Stream[Stream_ID].Parsers.push_back(Parser); } #endif else if (Compression==0x48465955) //"HFUY" { switch (Resolution) { case 16 : Fill(Stream_Video, StreamPos_Last, Video_ColorSpace, "YUV"); Fill(Stream_Video, StreamPos_Last, Video_ChromaSubsampling, "4:2:2"); Fill(Stream_Video, StreamPos_Last, Video_BitDepth, 8); break; case 24 : Fill(Stream_Video, StreamPos_Last, Video_ColorSpace, "RGB"); Fill(Stream_Video, StreamPos_Last, Video_BitDepth, 8); break; case 32 : Fill(Stream_Video, StreamPos_Last, Video_ColorSpace, "RGBA"); Fill(Stream_Video, StreamPos_Last, Video_BitDepth, 8); break; default : ; } } #if defined(MEDIAINFO_LAGARITH_YES) else if (Compression==0x4C414753) //"LAGS" { File_Lagarith* Parser=new File_Lagarith; Stream[Stream_ID].Parsers.push_back(Parser); } #endif for (size_t Pos=0; Pos=Element_Size) return; //No options //Filling if (0); else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression))==__T("AVC")) AVI__hdlr_strl_strf_vids_Avc(); else Skip_XX(Element_Size-Element_Offset, "Unknown"); } //--------------------------------------------------------------------------- void File_Riff::AVI__hdlr_strl_strf_vids_Avc() { //Parsing Element_Begin1("AVC options"); #if defined(MEDIAINFO_AVC_YES) //Can be sized block or with 000001 File_Avc* Parser=(File_Avc*)Stream[Stream_ID].Parsers[0]; Parser->MustParse_SPS_PPS=false; Parser->SizedBlocks=false; Parser->MustSynchronize=true; int64u Element_Offset_Save=Element_Offset; Open_Buffer_Continue(Parser); if (!Parser->Status[IsAccepted]) { Element_Offset=Element_Offset_Save; delete Stream[Stream_ID].Parsers[0]; Stream[Stream_ID].Parsers[0]=new File_Avc; Parser=(File_Avc*)Stream[Stream_ID].Parsers[0]; Open_Buffer_Init(Parser); Parser->FrameIsAlwaysComplete=true; Parser->MustParse_SPS_PPS=true; Parser->SizedBlocks=true; Parser->MustSynchronize=false; Open_Buffer_Continue(Parser); Element_Show(); } #else //MEDIAINFO_AVC_YES Skip_XX(Element_Size-Element_Offset, "(AVC headers)"); #endif Element_End0(); } //--------------------------------------------------------------------------- void File_Riff::AVI__hdlr_strl_strh() { Element_Name("Stream header"); //Parsing int32u fccType, fccHandler, Scale, Rate, Start, Length; int16u Left, Top, Right, Bottom; Get_C4 (fccType, "fccType"); switch (fccType) { case Elements::AVI__hdlr_strl_strh_auds : Get_L4 (fccHandler, "fccHandler"); break; default: Get_C4 (fccHandler, "fccHandler"); } Skip_L4( "Flags"); Skip_L2( "Priority"); Skip_L2( "Language"); Skip_L4( "InitialFrames"); Get_L4 (Scale, "Scale"); Get_L4 (Rate, "Rate"); //Rate/Scale is stream tick rate in ticks/sec Get_L4 (Start, "Start"); Get_L4 (Length, "Length"); Skip_L4( "SuggestedBufferSize"); Skip_L4( "Quality"); Skip_L4( "SampleSize"); Get_L2 (Left, "Frame_Left"); Get_L2 (Top, "Frame_Top"); Get_L2 (Right, "Frame_Right"); Get_L2 (Bottom, "Frame_Bottom"); if(Element_Offset0 && Scale>0) { //FrameRate (without known value detection) FrameRate=((float32)Rate)/Scale; if (FrameRate>1) { float32 Rest=FrameRate-(int32u)FrameRate; if (Rest<0.01) FrameRate-=Rest; else if (Rest>0.99) FrameRate+=1-Rest; else { float32 Rest1001=FrameRate*1001/1000-(int32u)(FrameRate*1001/1000); if (Rest1001<0.001) FrameRate=(float32)((int32u)(FrameRate*1001/1000))*1000/1001; if (Rest1001>0.999) FrameRate=(float32)((int32u)(FrameRate*1001/1000)+1)*1000/1001; } } //Duration if (FrameRate) { int64u Duration=float32_int64s((1000*(float32)Length)/FrameRate); if (avih_TotalFrame>0 //avih_TotalFrame is here because some files have a wrong Audio Duration if TotalFrame==0 (which is a bug, of course!) && (avih_FrameRate==0 || Duration<((float32)avih_TotalFrame)/avih_FrameRate*1000*1.10) //Some file have a nearly perfect header, except that the value is false, trying to detect it (false if 10% more than 1st video) && (avih_FrameRate==0 || Duration>((float32)avih_TotalFrame)/avih_FrameRate*1000*0.90)) //Some file have a nearly perfect header, except that the value is false, trying to detect it (false if 10% less than 1st video) { Fill(StreamKind_Last, StreamPos_Last, "Duration", Duration); } } } switch (fccType) { case Elements::AVI__hdlr_strl_strh_vids : if (FrameRate>0) Fill(Stream_Video, StreamPos_Last, "FrameRate", FrameRate, 3); case Elements::AVI__hdlr_strl_strh_txts : if (Right-Left>0) Fill(Stream_Text, StreamPos_Last, "Width", Right-Left, 10, true); if (Bottom-Top>0) Fill(Stream_Text, StreamPos_Last, "Height", Bottom-Top, 10, true); break; default: ; } Stream[Stream_ID].fccType=fccType; Stream[Stream_ID].fccHandler=fccHandler; Stream[Stream_ID].Scale=Scale; Stream[Stream_ID].Rate=Rate; Stream[Stream_ID].Start=Start; Stream[Stream_ID].Length=Length; } //--------------------------------------------------------------------------- void File_Riff::AVI__hdlr_strl_strn() { Element_Name("Stream name"); //Parsing Ztring Title; Get_Local(Element_Size, Title, "StreamName"); //Filling Fill(StreamKind_Last, StreamPos_Last, "Title", Title); } //--------------------------------------------------------------------------- void File_Riff::AVI__hdlr_strl_vprp() { Element_Name("Video properties"); //Parsing int32u FieldPerFrame; int16u FrameAspectRatio_H, FrameAspectRatio_W; Skip_L4( "VideoFormatToken"); Skip_L4( "VideoStandard"); Skip_L4( "VerticalRefreshRate"); Skip_L4( "HTotalInT"); Skip_L4( "VTotalInLines"); Get_L2 (FrameAspectRatio_H, "FrameAspectRatio Height"); Get_L2 (FrameAspectRatio_W, "FrameAspectRatio Width"); Skip_L4( "FrameWidthInPixels"); Skip_L4( "FrameHeightInLines"); Get_L4 (FieldPerFrame, "FieldPerFrame"); for (int32u Pos=0; Pos::iterator Temp=Stream_Structure.begin(); Temp!=Stream_Structure.end(); ++Temp) { switch (Temp->second.Name) { case 0x30300000 : if (Interleaved0_1==0) Interleaved0_1=Temp->first; if (Interleaved0_10==0) { Pos0++; if (Pos0>1) Interleaved0_10=Temp->first; } break; case 0x30310000 : if (Interleaved1_1==0) Interleaved1_1=Temp->first; if (Interleaved1_10==0) { Pos1++; if (Pos1>1) Interleaved1_10=Temp->first; } break; default:; } } } //--------------------------------------------------------------------------- void File_Riff::AVI__INFO() { Element_Name("Tags"); } //--------------------------------------------------------------------------- void File_Riff::AVI__INFO_IID3() { Element_Name("ID3 Tag"); //Parsing #if defined(MEDIAINFO_ID3_YES) File_Id3 MI; Open_Buffer_Init(&MI); Open_Buffer_Continue(&MI); Finish(&MI); Merge(MI, Stream_General, 0, 0); #endif } //--------------------------------------------------------------------------- void File_Riff::AVI__INFO_ILYC() { Element_Name("Lyrics"); } //--------------------------------------------------------------------------- void File_Riff::AVI__INFO_IMP3() { Element_Name("MP3 Information"); } //--------------------------------------------------------------------------- void File_Riff::AVI__INFO_JUNK() { Element_Name("Garbage"); } //--------------------------------------------------------------------------- // List of information atoms // Name X bytes, Pos=0 // void File_Riff::AVI__INFO_xxxx() { //Parsing Ztring Value; Get_Local(Element_Size, Value, "Value"); //Filling stream_t StreamKind=Stream_General; size_t StreamPos=0; size_t Parameter=(size_t)-1; switch (Element_Code) { case 0x00000000 : Parameter=General_Comment; break; case Elements::AVI__INFO_IARL : Parameter=General_Archival_Location; break; case Elements::AVI__INFO_IART : Parameter=General_Director; break; case Elements::AVI__INFO_IAS1 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=0; break; case Elements::AVI__INFO_IAS2 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=1; break; case Elements::AVI__INFO_IAS3 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=2; break; case Elements::AVI__INFO_IAS4 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=3; break; case Elements::AVI__INFO_IAS5 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=4; break; case Elements::AVI__INFO_IAS6 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=5; break; case Elements::AVI__INFO_IAS7 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=6; break; case Elements::AVI__INFO_IAS8 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=7; break; case Elements::AVI__INFO_IAS9 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=8; break; case Elements::AVI__INFO_ICDS : Parameter=General_CostumeDesigner; break; case Elements::AVI__INFO_ICMS : Parameter=General_CommissionedBy; break; case Elements::AVI__INFO_ICMT : Parameter=General_Comment; break; case Elements::AVI__INFO_ICNM : Parameter=General_DirectorOfPhotography; break; case Elements::AVI__INFO_ICNT : Parameter=General_Movie_Country; break; case Elements::AVI__INFO_ICOP : Parameter=General_Copyright; break; case Elements::AVI__INFO_ICRD : Parameter=General_Recorded_Date; Value.Date_From_String(Value.To_Local().c_str()); break; case Elements::AVI__INFO_ICRP : Parameter=General_Cropped; break; case Elements::AVI__INFO_IDIM : Parameter=General_Dimensions; break; case Elements::AVI__INFO_IDIT : Parameter=General_Mastered_Date; Value.Date_From_String(Value.To_Local().c_str()); break; case Elements::AVI__INFO_IDPI : Parameter=General_DotsPerInch; break; case Elements::AVI__INFO_IDST : Parameter=General_DistributedBy; break; case Elements::AVI__INFO_IEDT : Parameter=General_EditedBy; break; case Elements::AVI__INFO_IENG : Parameter=General_EncodedBy; break; case Elements::AVI__INFO_IGNR : Parameter=General_Genre; break; case Elements::AVI__INFO_IFRM : Parameter=General_Part_Position_Total; break; case Elements::AVI__INFO_IKEY : Parameter=General_Keywords; break; case Elements::AVI__INFO_ILGT : Parameter=General_Lightness; break; case Elements::AVI__INFO_ILNG : Parameter=Audio_Language; StreamKind=Stream_Audio; break; case Elements::AVI__INFO_IMED : Parameter=General_OriginalSourceMedium; break; case Elements::AVI__INFO_IMUS : Parameter=General_MusicBy; break; case Elements::AVI__INFO_INAM : Parameter=General_Title; break; case Elements::AVI__INFO_IPDS : Parameter=General_ProductionDesigner; break; case Elements::AVI__INFO_IPLT : Parameter=General_OriginalSourceForm_NumColors; break; case Elements::AVI__INFO_IPRD : Parameter=General_OriginalSourceForm_Name; break; case Elements::AVI__INFO_IPRO : Parameter=General_Producer; break; case Elements::AVI__INFO_IPRT : Parameter=General_Part_Position; break; case Elements::AVI__INFO_IRTD : Parameter=General_LawRating; break; case Elements::AVI__INFO_ISBJ : Parameter=General_Subject; break; case Elements::AVI__INFO_ISFT : Parameter=General_Encoded_Application; break; case Elements::AVI__INFO_ISGN : Parameter=General_Genre; break; case Elements::AVI__INFO_ISHP : Parameter=General_OriginalSourceForm_Sharpness; break; case Elements::AVI__INFO_ISRC : Parameter=General_OriginalSourceForm_DistributedBy; break; case Elements::AVI__INFO_ISRF : Parameter=General_OriginalSourceForm; break; case Elements::AVI__INFO_ISTD : Parameter=General_ProductionStudio; break; case Elements::AVI__INFO_ISTR : Parameter=General_Performer; break; case Elements::AVI__INFO_ITCH : Parameter=General_EncodedBy; break; case Elements::AVI__INFO_IWEB : Parameter=General_Movie_Url; break; case Elements::AVI__INFO_IWRI : Parameter=General_WrittenBy; break; default : ; } Element_Name(MediaInfoLib::Config.Info_Get(StreamKind, Parameter, Info_Name)); Element_Info1(Value); switch (Element_Code) { case Elements::AVI__INFO_ISMP : INFO_ISMP=Value; break; case Elements::AVI__INFO_IGNR : { Ztring ISGN=Retrieve(Stream_General, 0, General_Genre); Clear(Stream_General, 0, General_Genre); Fill(StreamKind, StreamPos, General_Genre, Value); if (!ISGN.empty()) Fill(StreamKind, StreamPos, General_Genre, ISGN); } break; default : if (!Value.empty()) { if (Parameter!=(size_t)-1) Fill(StreamKind, StreamPos, Parameter, Value); else Fill(StreamKind, StreamPos, Ztring().From_CC4((int32u)Element_Code).To_Local().c_str(), Value, true); } } } //--------------------------------------------------------------------------- void File_Riff::AVI__JUNK() { Element_Name("Garbage"); //Library defined size for padding, often used to store library name if (Element_Size<8) { Skip_XX(Element_Size, "Junk"); return; } //Detect DivX files if (CC5(Buffer+Buffer_Offset)==CC5("DivX ")) { Fill(Stream_General, 0, General_Format, "DivX", Unlimited, true, true); } //MPlayer else if (CC8(Buffer+Buffer_Offset)==CC8("[= MPlay") && Retrieve(Stream_General, 0, General_Encoded_Library).empty()) Fill(Stream_General, 0, General_Encoded_Library, "MPlayer"); //Scenalyzer else if (CC8(Buffer+Buffer_Offset)==CC8("scenalyz") && Retrieve(Stream_General, 0, General_Encoded_Library).empty()) Fill(Stream_General, 0, General_Encoded_Library, "Scenalyzer"); //FFMpeg broken files detection else if (CC8(Buffer+Buffer_Offset)==CC8("odmldmlh")) dmlh_TotalFrame=0; //this is not normal to have this string in a JUNK block!!! and in files tested, in this case TotalFrame is broken too //VirtualDubMod else if (CC8(Buffer+Buffer_Offset)==CC8("INFOISFT")) { int32u Size=LittleEndian2int32u(Buffer+Buffer_Offset+8); if (Size>Element_Size-12) Size=(int32u)Element_Size-12; Fill(Stream_General, 0, General_Encoded_Library, (const char*)(Buffer+Buffer_Offset+12), Size); } else if (CC8(Buffer+Buffer_Offset)==CC8("INFOIENG")) { int32u Size=LittleEndian2int32u(Buffer+Buffer_Offset+8); if (Size>Element_Size-12) Size=(int32u)Element_Size-12; Fill(Stream_General, 0, General_Encoded_Library, (const char*)(Buffer+Buffer_Offset+12), Size); } //Other libraries? else if (CC1(Buffer+Buffer_Offset)>=CC1("A") && CC1(Buffer+Buffer_Offset)<=CC1("z") && Retrieve(Stream_General, 0, General_Encoded_Library).empty()) Fill(Stream_General, 0, General_Encoded_Library, (const char*)(Buffer+Buffer_Offset), (size_t)Element_Size); Skip_XX(Element_Size, "Data"); } //--------------------------------------------------------------------------- void File_Riff::AVI__MD5_() { //Parsing while (Element_Offset::iterator Temp=Stream.begin(); while (Temp!=Stream.end()) { if ((Temp->second.Parsers.empty() || Temp->second.Parsers[0]==NULL) && Temp->second.fccType!=Elements::AVI__hdlr_strl_strh_txts) { Temp->second.SearchingPayload=false; stream_Count--; } ++Temp; } } //Filling movi_Size+=Element_TotalSize_Get(); //Probing rec (with index, this is not always tested in the flow if (Element_Size<12) { Element_WaitForMoreData(); return; } if (CC4(Buffer+Buffer_Offset+8)==0x72656320) //"rec " rec__Present=true; //We must parse moov? if (NeedOldIndex || (stream_Count==0 && Index_Pos.empty())) { //Jumping #if MEDIAINFO_TRACE if (Trace_Activated) Param("Data", Ztring("(")+Ztring::ToZtring(Element_TotalSize_Get())+Ztring(" bytes)")); #endif //MEDIAINFO_TRACE Element_Offset=Element_TotalSize_Get(); //Not using Skip_XX() because we want to skip data we don't have, and Skip_XX() does a test on size of buffer return; } //Jump to next useful data AVI__movi_StreamJump(); } //--------------------------------------------------------------------------- void File_Riff::AVI__movi_rec_() { Element_Name("Syncronisation"); rec__Present=true; } //--------------------------------------------------------------------------- void File_Riff::AVI__movi_rec__xxxx() { AVI__movi_xxxx(); } //--------------------------------------------------------------------------- void File_Riff::AVI__movi_xxxx() { if (Element_Code==Elements::AVI__JUNK) { Skip_XX(Element_Size, "Junk"); AVI__movi_StreamJump(); return; } if (Element_Code!=(int64u)-1) Stream_ID=(int32u)(Element_Code&0xFFFF0000); else Stream_ID=(int32u)-1; if (Stream_ID==0x69780000) //ix.. { //AVI Standard Index Chunk AVI__hdlr_strl_indx(); Stream_ID=(int32u)(Element_Code&0x0000FFFF)<<16; AVI__movi_StreamJump(); return; } if ((Element_Code&0x0000FFFF)==0x00006978) //..ix (Out of specs, but found in a Adobe After Effects CS4 DV file { //AVI Standard Index Chunk AVI__hdlr_strl_indx(); Stream_ID=(int32u)(Element_Code&0xFFFF0000); AVI__movi_StreamJump(); return; } #if MEDIAINFO_DEMUX if (Stream[Stream_ID].Rate) //AVI { int64u Element_Code_Old=Element_Code; Element_Code=((Element_Code_Old>>24)&0xF)*10+((Element_Code_Old>>16)&0xF); Frame_Count_NotParsedIncluded=Stream[Stream_ID].PacketPos; FrameInfo.DTS=Frame_Count_NotParsedIncluded*1000000000*Stream[Stream_ID].Scale/Stream[Stream_ID].Rate; Element_Code=Stream_ID; Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream); Element_Code=Element_Code_Old; Frame_Count_NotParsedIncluded=(int64u)-1; } else //WAV { //TODO } #endif //MEDIAINFO_DEMUX Stream[Stream_ID].PacketPos++; //Finished? if (!Stream[Stream_ID].SearchingPayload) { Element_DoNotShow(); AVI__movi_StreamJump(); return; } #if MEDIAINFO_TRACE if (Config_Trace_Level) { switch (Element_Code&0x0000FFFF) //2 last bytes { case Elements::AVI__movi_xxxx_____ : Element_Info1("DV"); break; case Elements::AVI__movi_xxxx___db : case Elements::AVI__movi_xxxx___dc : Element_Info1("Video"); break; case Elements::AVI__movi_xxxx___sb : case Elements::AVI__movi_xxxx___tx : Element_Info1("Text"); break; case Elements::AVI__movi_xxxx___wb : Element_Info1("Audio"); break; default : Element_Info1("Unknown"); break; } Element_Info1(Stream[Stream_ID].PacketPos); } #endif //MEDIAINFO_TRACE //Some specific stuff switch (Element_Code&0x0000FFFF) //2 last bytes { case Elements::AVI__movi_xxxx___tx : AVI__movi_xxxx___tx(); break; default : ; } //Parsing for (size_t Pos=0; PosFrameInfo.PTS=FrameInfo.PTS; if (FrameInfo.DTS!=(int64u)-1) Stream[Stream_ID].Parsers[Pos]->FrameInfo.DTS=FrameInfo.DTS; Open_Buffer_Continue(Stream[Stream_ID].Parsers[Pos], Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); Element_Show(); if (Stream[Stream_ID].Parsers.size()==1 && Stream[Stream_ID].Parsers[Pos]->Buffer_Size>0) Stream[Stream_ID].ChunksAreComplete=false; if (Stream[Stream_ID].Parsers.size()>1) { if (!Stream[Stream_ID].Parsers[Pos]->Status[IsAccepted] && Stream[Stream_ID].Parsers[Pos]->Status[IsFinished]) { delete *(Stream[Stream_ID].Parsers.begin()+Pos); Stream[Stream_ID].Parsers.erase(Stream[Stream_ID].Parsers.begin()+Pos); Pos--; } else if (Stream[Stream_ID].Parsers.size()>1 && Stream[Stream_ID].Parsers[Pos]->Status[IsAccepted]) { File__Analyze* Parser=Stream[Stream_ID].Parsers[Pos]; for (size_t Pos2=0; Pos2Demux_EventWasSent) { Demux_Parser=Stream[Stream_ID].Parsers[Pos]; return; } #endif //MEDIAINFO_DEMUX } Element_Offset=Element_Size; //Some specific stuff switch (Element_Code&0x0000FFFF) //2 last bytes { case Elements::AVI__movi_xxxx_____ : case Elements::AVI__movi_xxxx___db : case Elements::AVI__movi_xxxx___dc : AVI__movi_xxxx___dc(); break; case Elements::AVI__movi_xxxx___wb : AVI__movi_xxxx___wb(); break; default : ; } //We must always parse moov? AVI__movi_StreamJump(); Element_Show(); } //--------------------------------------------------------------------------- void File_Riff::AVI__movi_xxxx___dc() { //Finish (if requested) if (Stream[Stream_ID].Parsers.empty() || Stream[Stream_ID].Parsers[0]->Status[IsFinished] || (Stream[Stream_ID].PacketPos>=300 && MediaInfoLib::Config.ParseSpeed_Get()<1.00)) { Stream[Stream_ID].SearchingPayload=false; stream_Count--; return; } } //--------------------------------------------------------------------------- void File_Riff::AVI__movi_xxxx___tx() { //Parsing int32u Name_Size; Ztring Value; int32u GAB2; Peek_B4(GAB2); if (GAB2==0x47414232 && Element_Size>=17) { Skip_C4( "GAB2"); Skip_L1( "Zero"); Skip_L2( "CodePage"); //2=Unicode Get_L4 (Name_Size, "Name_Size"); Skip_UTF16L(Name_Size, "Name"); Skip_L2( "Four"); Skip_L4( "File_Size"); if (Element_Offset>Element_Size) Element_Offset=Element_Size; //Problem } //Skip it Stream[Stream_ID].SearchingPayload=false; stream_Count--; } //--------------------------------------------------------------------------- void File_Riff::AVI__movi_xxxx___wb() { //Finish (if requested) if (Stream[Stream_ID].PacketPos>=4 //For having the chunk alignement && (Stream[Stream_ID].Parsers.empty() || Stream[Stream_ID].Parsers[0]->Status[IsFinished] || (Stream[Stream_ID].PacketPos>=300 && MediaInfoLib::Config.ParseSpeed_Get()<1.00))) { Stream[Stream_ID].SearchingPayload=false; stream_Count--; } } //--------------------------------------------------------------------------- void File_Riff::AVI__movi_StreamJump() { //Jump to next useful data if (!Index_Pos.empty()) { if (Index_Pos.begin()->first<=File_Offset+Buffer_Offset && Element_Code!=Elements::AVI__movi) Index_Pos.erase(Index_Pos.begin()); int64u ToJump=File_Size; if (!Index_Pos.empty()) ToJump=Index_Pos.begin()->first; if (ToJump>File_Size) ToJump=File_Size; if (ToJump>=File_Offset+Buffer_Offset+Element_TotalSize_Get(Element_Level-2)) //We want always Element movi { #if MEDIAINFO_MD5 if (Config->File_Md5_Get() && SecondPass) Md5_ParseUpTo=File_Offset+Buffer_Offset+Element_TotalSize_Get(Element_Level-2); else #endif //MEDIAINFO_MD5 GoTo(File_Offset+Buffer_Offset+Element_TotalSize_Get(Element_Level-2), "AVI"); //Not in this chunk } else if (ToJump!=File_Offset+Buffer_Offset+(Element_Code==Elements::AVI__movi?0:Element_Size)) { #if MEDIAINFO_MD5 if (Config->File_Md5_Get() && SecondPass) Md5_ParseUpTo=File_Offset+Buffer_Offset+Element_TotalSize_Get(Element_Level-2); else #endif //MEDIAINFO_MD5 GoTo(ToJump, "AVI"); //Not just after } } else if (stream_Count==0) { //Jumping Element_Show(); if (rec__Present) Element_End0(); Info("movi, Jumping to end of chunk"); if (SecondPass) { std::map::iterator Temp=Stream.begin(); while (Temp!=Stream.end()) { for (size_t Pos=0; Possecond.Parsers.size(); ++Pos) Temp->second.Parsers[Pos]->Open_Buffer_Unsynch(); ++Temp; } Finish("AVI"); //The rest is already parsed } else GoTo(File_Offset+Buffer_Offset+Element_TotalSize_Get(), "AVI"); } else if (Stream_Structure_Temp!=Stream_Structure.end()) { do Stream_Structure_Temp++; while (Stream_Structure_Temp!=Stream_Structure.end() && !(Stream[(int32u)Stream_Structure_Temp->second.Name].SearchingPayload && Config->ParseSpeed<1.0)); if (Stream_Structure_Temp!=Stream_Structure.end()) { int64u ToJump=Stream_Structure_Temp->first; if (ToJump>=File_Offset+Buffer_Offset+Element_TotalSize_Get(Element_Level-2)) { #if MEDIAINFO_MD5 if (Config->File_Md5_Get() && SecondPass) Md5_ParseUpTo=File_Offset+Buffer_Offset+Element_TotalSize_Get(Element_Level-2); else #endif //MEDIAINFO_MD5 GoTo(File_Offset+Buffer_Offset+Element_TotalSize_Get(Element_Level-2), "AVI"); //Not in this chunk } else if (ToJump!=File_Offset+Buffer_Offset+Element_Size) { #if MEDIAINFO_MD5 if (Config->File_Md5_Get() && SecondPass) Md5_ParseUpTo=ToJump; else #endif //MEDIAINFO_MD5 GoTo(ToJump, "AVI"); //Not just after } } else Finish("AVI"); } } //--------------------------------------------------------------------------- void File_Riff::AVI__PrmA() { Element_Name("Adobe Premiere PrmA"); //Parsing int32u FourCC, Size; Get_C4 (FourCC, "FourCC"); Get_B4 (Size, "Size"); switch (FourCC) { case 0x50415266: if (Size==20) { int32u PAR_X, PAR_Y; Skip_B4( "Unknown"); Get_B4 (PAR_X, "PAR_X"); Get_B4 (PAR_Y, "PAR_Y"); if (PAR_Y) PAR=((float64)PAR_X)/PAR_Y; } else Skip_XX(Element_Size-Element_Offset, "Unknown"); break; default: for (int32u Pos=8; PosStreamKind=Stream_Video; Open_Buffer_Continue(Parser); Element_Offset=Element_TotalSize_Get(); //Not using Skip_XX() because we want to skip data we don't have, and Skip_XX() does a test on size of buffer FILLING_BEGIN(); Stream_Prepare(Stream_Video); Fill(Stream_Video, StreamPos_Last, Video_StreamSize, Element_TotalSize_Get()); Finish(Parser); Merge(*Parser, StreamKind_Last, 0, StreamPos_Last); FILLING_END(); Stream[Stream_ID].Parsers.push_back(Parser); #else Element_Offset=Element_TotalSize_Get(); //Not using Skip_XX() because we want to skip data we don't have, and Skip_XX() does a test on size of buffer FILLING_BEGIN(); Stream_Prepare(Stream_Video); Fill(Stream_Video, StreamPos_Last, Video_Format, "JPEG"); Fill(Stream_Video, StreamPos_Last, Video_StreamSize, Element_TotalSize_Get()); FILLING_END(); #endif } //--------------------------------------------------------------------------- void File_Riff::CMP4() { Accept("CMP4"); Element_Name("CMP4 - Header"); //Parsing Ztring Title; Get_Local(Element_Size, Title, "Title"); FILLING_BEGIN(); Fill(Stream_General, 0, General_Format, "CMP4"); Fill(Stream_General, 0, "Title", Title); FILLING_END(); } //--------------------------------------------------------------------------- void File_Riff::IDVX() { Element_Name("Tags"); } //--------------------------------------------------------------------------- void File_Riff::INDX() { Element_Name("Index (from which spec?)"); } //--------------------------------------------------------------------------- void File_Riff::INDX_xxxx() { Stream_ID=(int32u)(Element_Code&0xFFFF0000); if (Stream_ID==0x69780000) //ix.. { //Index int32u Entry_Count, ChunkId; int16u LongsPerEntry; int8u IndexType, IndexSubType; Get_L2 (LongsPerEntry, "LongsPerEntry"); //Size of each entry in aIndex array Get_L1 (IndexSubType, "IndexSubType"); Get_L1 (IndexType, "IndexType"); Get_L4 (Entry_Count, "EntriesInUse"); //Index of first unused member in aIndex array Get_C4 (ChunkId, "ChunkId"); //FCC of what is indexed Skip_L4( "Unknown"); Skip_L4( "Unknown"); Skip_L4( "Unknown"); for (int32u Pos=0; PosFrameInfo.DTS=FrameInfo.DTS; Open_Buffer_Continue(*Ancillary, Buffer, 0); } } //--------------------------------------------------------------------------- void File_Riff::rcrd_desc() { Element_Name("Ancillary media packet description"); //Parsing int32u Version; Get_L4 (Version, "Version"); if (Version==2) { Skip_L4( "Number of fields"); Skip_L4( "Length of the ancillary data field descriptions"); Skip_L4( "Byte size of the complete ancillary media packet"); Skip_L4( "Format of the video"); } else Skip_XX(Element_Size-Element_Offset, "Unknown"); } //--------------------------------------------------------------------------- void File_Riff::rcrd_fld_() { Element_Name("Ancillary data field description"); } //--------------------------------------------------------------------------- void File_Riff::rcrd_fld__anc_() { Element_Name("Ancillary data sample description"); rcrd_fld__anc__pos__LineNumber=(int32u)-1; } //--------------------------------------------------------------------------- void File_Riff::rcrd_fld__anc__pos_() { Element_Name("Ancillary data sample description"); //Parsing Get_L4 (rcrd_fld__anc__pos__LineNumber, "Video line number"); Skip_L4( "Ancillary video color difference or luma space"); Skip_L4( "Ancillary video space"); } //--------------------------------------------------------------------------- void File_Riff::rcrd_fld__anc__pyld() { Element_Name("Ancillary data sample payload"); if (Ancillary) { (*Ancillary)->FrameInfo.DTS=FrameInfo.DTS; (*Ancillary)->LineNumber=rcrd_fld__anc__pos__LineNumber; Open_Buffer_Continue(*Ancillary); } } //--------------------------------------------------------------------------- void File_Riff::rcrd_fld__finf() { Element_Name("Data field description"); //Parsing Skip_L4( "Video field identifier"); } #endif //MEDIAINFO_GXF_YES //--------------------------------------------------------------------------- void File_Riff::RDIB() { Data_Accept("RIFF DIB"); Element_Name("RIFF DIB"); //Filling Fill(Stream_General, 0, General_Format, "RIFF DIB"); } //--------------------------------------------------------------------------- void File_Riff::RMID() { Data_Accept("RIFF MIDI"); Element_Name("RIFF MIDI"); //Filling Fill(Stream_General, 0, General_Format, "RIFF MIDI"); } //--------------------------------------------------------------------------- void File_Riff::RMMP() { Data_Accept("RIFF MMP"); Element_Name("RIFF MMP"); //Filling Fill(Stream_General, 0, General_Format, "RIFF MMP"); } //--------------------------------------------------------------------------- void File_Riff::RMP3() { Data_Accept("RMP3"); Element_Name("RMP3"); //Filling Fill(Stream_General, 0, General_Format, "RMP3"); Kind=Kind_Rmp3; } //--------------------------------------------------------------------------- void File_Riff::RMP3_data() { Element_Name("Raw datas"); Fill(Stream_Audio, 0, Audio_StreamSize, Buffer_DataToParse_End-Buffer_DataToParse_Begin); Stream_Prepare(Stream_Audio); //Creating parser #if defined(MEDIAINFO_MPEGA_YES) File_Mpega* Parser=new File_Mpega; Parser->CalculateDelay=true; Parser->ShouldContinueParsing=true; Open_Buffer_Init(Parser); stream& StreamItem=Stream[(int32u)-1]; StreamItem.StreamKind=Stream_Audio; StreamItem.StreamPos=0; StreamItem.Parsers.push_back(Parser); #else //MEDIAINFO_MPEG4_YES Fill(Stream_Audio, 0, Audio_Format, "MPEG Audio"); Skip_XX(Buffer_DataToParse_End-Buffer_DataToParse_Begin, "Data"); #endif } //--------------------------------------------------------------------------- void File_Riff::RMP3_data_Continue() { #if MEDIAINFO_DEMUX if (Element_Size) { Demux_random_access=true; Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream); } #endif //MEDIAINFO_DEMUX Element_Code=(int64u)-1; AVI__movi_xxxx(); } //--------------------------------------------------------------------------- void File_Riff::SMV0() { Accept("SMV"); //Parsing int8u Version; Skip_C1( "Identifier (continuing)"); Get_C1 (Version, "Version"); Skip_C3( "Identifier (continuing)"); if (Version=='1') { int32u Width, Height, FrameRate, BlockSize, FrameCount; Get_B3 (Width, "Width"); Get_B3 (Height, "Height"); Skip_B3( "0x000010"); Skip_B3( "0x000001"); Get_B3 (BlockSize, "Block size"); Get_B3 (FrameRate, "Frame rate"); Get_B3 (FrameCount, "Frame count"); Skip_B3( "0x000000"); Skip_B3( "0x000000"); Skip_B3( "0x000000"); Skip_B3( "0x010101"); Skip_B3( "0x010101"); Skip_B3( "0x010101"); Skip_B3( "0x010101"); //Filling Fill(Stream_General, 0, General_Format_Profile, "SMV v1"); Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_MuxingMode, "SMV v1"); Fill(Stream_Video, 0, Video_Width, Width); Fill(Stream_Video, 0, Video_Height, Height); Fill(Stream_Video, 0, Video_FrameRate, (float)FrameRate); Fill(Stream_Video, 0, Video_FrameCount, FrameCount); Finish("SMV"); } else if (Version=='2') { int32u Width, Height, FrameRate; Get_L3 (Width, "Width"); Get_L3 (Height, "Height"); Skip_L3( "0x000010"); Skip_L3( "0x000001"); Get_L3 (SMV_BlockSize, "Block size"); Get_L3 (FrameRate, "Frame rate"); Get_L3 (SMV_FrameCount, "Frame count"); Skip_L3( "0x000001"); Skip_L3( "0x000000"); Skip_L3( "Frame rate"); Skip_L3( "0x010101"); Skip_L3( "0x010101"); Skip_L3( "0x010101"); Skip_L3( "0x010101"); //Filling SMV_BlockSize+=3; SMV_FrameCount++; Fill(Stream_General, 0, General_Format_Profile, "SMV v2"); Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "JPEG"); Fill(Stream_Video, 0, Video_Codec, "JPEG"); Fill(Stream_Video, 0, Video_MuxingMode, "SMV v2"); Fill(Stream_Video, 0, Video_Width, Width); Fill(Stream_Video, 0, Video_Height, Height); Fill(Stream_Video, 0, Video_FrameRate, FrameRate); Fill(Stream_Video, 0, Video_FrameCount, SMV_FrameCount); Fill(Stream_Video, 0, Video_StreamSize, SMV_BlockSize*SMV_FrameCount); } else Finish("SMV"); } //--------------------------------------------------------------------------- void File_Riff::SMV0_xxxx() { //Parsing int32u Size; Get_L3 (Size, "Size"); #if defined(MEDIAINFO_JPEG_YES) //Creating the parser File_Jpeg MI; Open_Buffer_Init(&MI); //Parsing Open_Buffer_Continue(&MI, Size); //Filling Finish(&MI); Merge(MI, Stream_Video, 0, StreamPos_Last); //Positioning Element_Offset+=Size; #else //Parsing Skip_XX(Size, "JPEG data"); #endif Skip_XX(Element_Size-Element_Offset, "Padding"); //Filling #if MEDIAINFO_MD5 if (Config->File_Md5_Get()) Element_Offset=Element_Size+(SMV_FrameCount-1)*SMV_BlockSize; #endif //MEDIAINFO_MD5 Data_GoTo(File_Offset+Buffer_Offset+(size_t)Element_Size+(SMV_FrameCount-1)*SMV_BlockSize, "SMV"); SMV_BlockSize=0; } //--------------------------------------------------------------------------- void File_Riff::WAVE() { Data_Accept("Wave"); Element_Name("Wave"); //Filling Fill(Stream_General, 0, General_Format, "Wave"); Kind=Kind_Wave; #if MEDIAINFO_EVENTS StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS } //--------------------------------------------------------------------------- void File_Riff::WAVE__pmx() { Element_Name("XMP"); //Parsing Ztring XML_Data; Get_Local(Element_Size, XML_Data, "XML data"); } //--------------------------------------------------------------------------- void File_Riff::WAVE_aXML() { Element_Name("aXML"); //Parsing Skip_Local(Element_Size, "XML data"); } //--------------------------------------------------------------------------- void File_Riff::WAVE_bext() { Element_Name("Broadcast extension"); //Parsing Ztring Description, Originator, OriginatorReference, OriginationDate, OriginationTime, History; int16u Version; Get_Local(256, Description, "Description"); Get_Local( 32, Originator, "Originator"); Get_Local( 32, OriginatorReference, "OriginatorReference"); Get_Local( 10, OriginationDate, "OriginationDate"); Get_Local( 8, OriginationTime, "OriginationTime"); Get_L8 ( TimeReference, "TimeReference"); //To be divided by SamplesPerSec Get_L2 ( Version, "Version"); if (Version==1) Skip_UUID( "UMID"); Skip_XX (602-Element_Offset, "Reserved"); if (Element_OffsetBitRate*1.05) Fill(Stream_Audio, 0, Audio_BitRate, BitRate_New, 10, true); //Correcting the bitrate, it was false in the header } else if (BitRate) { if (IsSub) //Retrieving "data" real size, in case of truncated files and/or wave header in another container Duration=((int64u)LittleEndian2int32u(Buffer+Buffer_Offset-4))*8*1000/BitRate; //TODO: RF64 is not handled else Duration=(Buffer_DataToParse_End-Buffer_DataToParse_Begin)*8*1000/BitRate; Fill(Stream_General, 0, General_Duration, Duration, 10, true); Fill(Stream_Audio, 0, Audio_Duration, Duration, 10, true); } FILLING_END(); } //--------------------------------------------------------------------------- void File_Riff::WAVE_data_Continue() { #if MEDIAINFO_DEMUX Element_Code=(int64u)-1; if (AvgBytesPerSec && Demux_Rate) { FrameInfo.DTS=float64_int64s((File_Offset+Buffer_Offset-Buffer_DataToParse_Begin)*1000000000.0/AvgBytesPerSec); FrameInfo.PTS=FrameInfo.DTS; Frame_Count_NotParsedIncluded=float64_int64s(((float64)FrameInfo.DTS)/1000000000.0*Demux_Rate); } Demux_random_access=true; Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream); Frame_Count_NotParsedIncluded=(int64u)-1; #endif //MEDIAINFO_DEMUX Element_Code=(int64u)-1; AVI__movi_xxxx(); } //--------------------------------------------------------------------------- void File_Riff::WAVE_ds64() { Element_Name("DataSize64"); //Parsing int32u tableLength; Skip_L8( "riffSize"); //Is directly read from the header parser Get_L8 (WAVE_data_Size, "dataSize"); Get_L8 (WAVE_fact_samplesCount, "sampleCount"); Get_L4 (tableLength, "tableLength"); for (int32u Pos=0; PosDuration*1.10 || Duration_FromBitRate #include #include "MediaInfo/Multiple/File_Rm.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { // https://common.helixcommunity.org/2003/HCS_SDK_r5/htmfiles/rmff.htm // http://wiki.multimedia.cx/index.php?title=RealMedia //*************************************************************************** // Const //*************************************************************************** //--------------------------------------------------------------------------- namespace Elements { const int32u RMF=0x2E524D46; const int32u CONT=0x434F4E54; const int32u DATA=0x44415441; const int32u INDX=0x494E4458; const int32u MDPR=0x4D445052; const int32u PROP=0x50524F50; const int32u RJMD=0x524A4D44; const int32u RMJE=0x524D4A45; const int32u RMMD=0x524D4D44; const int32u TAG =0x54414700; } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Rm::File_Rm() :File__Analyze() { //In FromMKV_StreamType=Stream_Max; } //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- void File_Rm::Header_Parse() { //Specific case if (FromMKV_StreamType!=Stream_Max) { //Filling Header_Fill_Code(0, __T("Real Media Header")); Header_Fill_Size(Element_Size); return; } //Parsing int32u Name, Size; Get_C4 (Name, "Name"); if (Name==Elements::RMMD) { Size=8; //Name + Size of the Metadata section (after Version) in bytes. } else if (Name==Elements::RJMD) { Skip_B4( "Version"); Get_B4 (Size, "Size"); Size+=8; //Name + Version + Size of the section (after Version) in bytes. if (Element_Size>=12) Element_Offset-=8; //Is valid, so we must keep Version and size in the stream } else if (Name==Elements::RMJE) { Size=12; } else if ((Name&0xFFFFFF00)==Elements::TAG) { Name=Elements::TAG; Element_Offset-=4; Size=0; } else { Get_B4 (Size, "Size"); } //Filling Header_Fill_Code(Name, Ztring().From_CC4(Name)); Header_Fill_Size(Size); } //--------------------------------------------------------------------------- void File_Rm::Data_Parse() { //Specific case if (FromMKV_StreamType!=Stream_Max) { switch (FromMKV_StreamType) { case Stream_Video : MDPR_realvideo(); break; case Stream_Audio : MDPR_realaudio(); break; default : ; } Finish("RealMedia"); return; } //Parsing DATA_BEGIN ATOM( RMF) ATOM(CONT) LIST_SKIP(DATA) ATOM(INDX) ATOM(MDPR) ATOM(PROP) ATOM(RJMD) ATOM(RMJE) ATOM(RMMD) ATOM(TAG) DATA_END } //*************************************************************************** // Elements //*************************************************************************** #define NAME_VERSION(ELEMENT_NAME) \ Element_Name(ELEMENT_NAME); \ int16u Version; \ { \ Get_B2(Version, "ObjectVersion"); \ } \ #define INTEGRITY_VERSION(_VERSION) \ if (Version>_VERSION) \ { \ Skip_XX(Element_Size-Element_Offset, "Data"); \ return; \ } \ //--------------------------------------------------------------------------- void File_Rm::RMF() { NAME_VERSION("Real Media Format"); INTEGRITY_VERSION(1); //Parsing if (Element_Size==4) Skip_B2( "file_version"); //The version of the RealMedia file. else Skip_B4( "file_version"); //The version of the RealMedia file. Skip_B4( "num_headers"); //The number of headers in the header section that follow the RealMedia File Header. //Filling Accept("RealMedia"); Fill(Stream_General, 0, General_Format, "RealMedia"); } //--------------------------------------------------------------------------- void File_Rm::CONT() { NAME_VERSION("Content"); INTEGRITY_VERSION(0); //Parsing Ztring title, author, copyright, comment; int16u title_len, author_len, copyright_len, comment_len; Get_B2 (title_len, "title_len"); //The length of the title data in bytes. Get_Local(title_len, title, "title"); //An array of ASCII characters that represents the title information for the RealMedia file. Get_B2 (author_len, "author_len"); //The length of the author data in bytes. Get_Local(author_len, author, "author"); //An array of ASCII characters that represents the author information for the RealMedia file. Get_B2 (copyright_len, "copyright_len"); //The length of the copyright data in bytes. Get_Local(copyright_len, copyright, "copyright"); //An array of ASCII characters that represents the copyright information for the RealMedia file. Get_B2 (comment_len, "comment_len"); //The length of the comment data in bytes. Get_Local(comment_len, comment, "comment"); //An array of ASCII characters that represents the comment information for the RealMedia file. //Filling Fill(Stream_General, 0, General_Title, title); Fill(Stream_General, 0, General_Performer, author); Fill(Stream_General, 0, General_Copyright, copyright); Fill(Stream_General, 0, General_Comment, comment); } //--------------------------------------------------------------------------- void File_Rm::DATA() { NAME_VERSION("Data"); //Currently, we stop here, enough info Finish("RealMedia"); return; /* //Parsing int32u num_packets; int16u length; int8u flags; Get_B4 (num_packets, "num_packets"); //Number of packets in the data chunk. Skip_B4( "next_data_header"); //Offset from start of file to the next data chunk. A non-zero value refers to the file offset of the next data chunk. A value of zero means there are no more data chunks in this file. This field is not typically used. for (int32u Pos=0; Pos10) { Pos=num_packets; Element_Info1("(...)"); } Element_End0(); } */ } //--------------------------------------------------------------------------- void File_Rm::INDX() { NAME_VERSION("INDeX"); //Parsing int32u num_indices; Get_B4 (num_indices, "num_indices"); //Number of index records in the index chunk. Skip_B2( "stream_number"); //The stream number for which the index records in this index chunk are associated. Skip_B4( "next_index_header"); //Offset from start of file to the next index chunk. This member enables RealMedia file format readers to find all the index chunks quickly. A value of zero for this member indicates there are no more index headers in this file. for (int32u Pos=0; PosParseReferences(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_SequenceInfo::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { if (ReferenceFiles==NULL) return 0; return ReferenceFiles->Read_Buffer_Seek(Method, Value, ID); } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_SequenceInfo::FileHeader_Begin() { XMLDocument document; if (!FileHeader_Begin_XML(document)) return false; { XMLElement* Root=document.FirstChildElement("SEQUENCEINFO"); if (Root) { Accept("SequenceInfo"); Fill(Stream_General, 0, General_Format, "SequenceInfo"); ReferenceFiles=new File__ReferenceFilesHelper(this, Config); File__ReferenceFilesHelper::reference ReferenceFile; ReferenceFile.StreamKind=Stream_Video; FileName FN(File_Name); Ztring Base=FN.Path_Get(); size_t Pos=Base.rfind(PathSeparator); if (Pos!=string::npos) { Ztring ToAdd=Base.substr(Pos, string::npos); Ztring DirectoryBase=Base; DirectoryBase+=ToAdd; DirectoryBase+=__T('_'); size_t DirNumberCount=1; Ztring Directory=DirectoryBase; for (; DirNumberCount<9; DirNumberCount++) { Directory+=__T('0'); if (Dir::Exists(Directory)) break; } if (DirNumberCount<9) { int32u DirNumber=0; do { Ztring Number=Ztring::ToZtring(DirNumber); if (Number.size()=2) { FileNumberCount=(size_t)-1; //Problem, which one to choose? break; } else if (List.size()==1) { FileName Temp(List[0]); Extension=Temp.Extension_Get(); FileBase+=Extension; FullFile=FileBase; break; } } else if (File::Exists(FullFile)) break; } bool FromZero=true; if (FileNumberCount>=9) { //Trying with consecutive file numbers betweens dirs Number=Ztring::ToZtring(ReferenceFile.FileNames.size()); FullFile=FileBase; FullFile.insert(FullFile.size()-Extension.size()-1, Number); FileNumberCount=Number.size(); if (!File::Exists(FullFile)) { FileNumberCount++; for (; FileNumberCount<10; FileNumberCount++) { FullFile.insert(FullFile.begin()+FullFile.size()-Extension.size()-Number.size()-1, __T('0')); if (File::Exists(FullFile)) { FromZero=false; break; } } } else FromZero=false; } if (FileNumberCount<9) { size_t FileNumber=FromZero?0:ReferenceFile.FileNames.size(); do { Number=Ztring::ToZtring(FileNumber); if (Number.size()References.push_back(ReferenceFile); } } } else { Reject("SequenceInfo"); return false; } } Element_Offset=File_Size; //All should be OK... return true; } } //NameSpace #endif //MEDIAINFO_SEQUENCEINFO_YES MediaInfoLib/Source/MediaInfo/Multiple/File_SequenceInfo.h100777 0 0 3206 12226004262 17036 0/* 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 XML files starting with SEQUENCEINFO // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_SequenceInfoH #define MediaInfo_File_SequenceInfoH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { class File__ReferenceFilesHelper; //*************************************************************************** // Class File_SequenceInfo //*************************************************************************** class File_SequenceInfo : public File__Analyze { public : //Constructor/Destructor File_SequenceInfo(); ~File_SequenceInfo(); private : //Streams management void Streams_Finish (); //Buffer - Global #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK //Buffer - File header bool FileHeader_Begin(); //Temp File__ReferenceFilesHelper* ReferenceFiles; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Skm.cpp100777 0 0 14210 12226004262 15554 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_SKM_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Skm.h" #if defined(MEDIAINFO_MPEG4V_YES) #include "MediaInfo/Video/File_Mpeg4v.h" #endif #include "ZenLib/Utils.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Skm::File_Skm() :File__Analyze() { //Configuration MustSynchronize=true; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Skm::Streams_Finish() { if (Stream.Parser) { Finish(Stream.Parser); Merge(*Stream.Parser); } } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Skm::FileHeader_Begin() { if (Buffer_Size<5) return false; if (CC5(Buffer)!=0x444D534B4DLL) //DMSKM { Reject("SKM"); return false; } return true; } //--------------------------------------------------------------------------- void File_Skm::FileHeader_Parse() { Skip_C5( "Signature"); FILLING_BEGIN(); Accept("SKM"); Fill(Stream_General, 0, General_Format, "SKM"); FILLING_END(); } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Skm::Synched_Test() { //Must have enough buffer for having header if (Buffer_Offset+3>Buffer_Size) return false; //Quick test of synchro if (CC3(Buffer+Buffer_Offset)!=0x000001) Synched=false; //We continue return true; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Skm::Header_Parse() { //Parsing int32u BodyLength; int8u Type; Skip_B4( "PreviousTagSize"); if (File_Offset+Buffer_Offset+4Buffer_Size) { if (File_Offset+Buffer_Size==File_Size) Buffer_Offset_Temp=Buffer_Size; //We are sure that the next bytes are a start else return false; } //OK, we continue Header_Fill_Size(Buffer_Offset_Temp-Buffer_Offset); Buffer_Offset_Temp=0; return true; } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- 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 } } //NameSpace #endif //MEDIAINFO_SKM_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Skm.h100777 0 0 3456 12226004262 15213 0/* 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 SKM (Korean mobilphoner) files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_SkmH #define MediaInfo_File_SkmH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Skm //*************************************************************************** class File_Skm : public File__Analyze { public : //Constructor/Destructor File_Skm(); private : //Streams management void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse(); //Buffer - Synchro bool Synchronize() {return Synchronize_0x000001();} bool Synched_Test(); //Buffer - Per element void Header_Parse(); bool Header_Parse_Fill_Size(); void Data_Parse(); //Streams struct stream { File__Analyze* Parser; stream() { Parser=NULL; } ~stream() { delete Parser; //Parser=NULL; } }; stream Stream; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Swf.cpp100777 0 0 62570 12226004262 15575 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_SWF_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Swf.h" #include using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const int8u Swf_SoundType[]= { 1, 2, }; //--------------------------------------------------------------------------- const int8u Swf_SoundSize[]= { 8, 16, }; //--------------------------------------------------------------------------- const int16u Swf_SoundRate[]= { 5500, 11025, 22050, 44100, }; //--------------------------------------------------------------------------- const char* Swf_Format_Audio[]= { "PCM", "ADPCM", "MPEG Audio", "PCM", "Nellymoser", "Nellymoser", "Nellymoser", "", "", "", "", "Speex", "", "", "", "", }; //--------------------------------------------------------------------------- const char* Swf_Format_Version_Audio[]= { "", "", "Version 1", "", "", "", "", "", "", "", "", "", "", "", "", "", }; //--------------------------------------------------------------------------- const char* Swf_Format_Profile_Audio[]= { "", "", "Layer 3", "", "", "", "", "", "", "", "", "", "", "", "", "", }; //--------------------------------------------------------------------------- const char* Swf_SoundFormat[]= { "Uncompressed", "SWF ADPCM", "MPEG-1L3", "Uncompressed Little Endian", "", "", "Nellymoser", "", "", "", "", "", "", "", "", "", }; //--------------------------------------------------------------------------- const char* Swf_Format_Video[]= { "", "", "H.263", "Screen video", "VP6", "VP6", "Screen video 2", "AVC", "", "", "", "", "", "", "", "", }; //--------------------------------------------------------------------------- const char* Swf_Format_Profile_Video[]= { "", "", "", "", "", "Alpha channel", "", "", "", "", "", "", "", "", "", "", }; //--------------------------------------------------------------------------- const char* Swf_Codec_Video[]= { "", "", "Sorenson H263", "Screen video", "On2 VP6", "On2 VP6 with alpha channel", "Screen video 2", "AVC", "", "", "", "", "", "", "", "", }; //*************************************************************************** // Constants //*************************************************************************** namespace Elements { const int16u End = 0; //V1+ const int16u ShowFrame = 1; //V1+ const int16u DefineShape = 2; //V1+ const int16u PlaceObject = 4; //V1+ const int16u RemoveObject = 5; //V1+ const int16u DefineBits = 6; //V1+ const int16u DefineButton = 7; //V1+ const int16u JPEGTables = 8; //V1+ const int16u SetBackgroundColor = 9; //V1+ const int16u DefineFont = 10; //V1+ const int16u DefineText = 11; //V1+ const int16u DoAction = 12; //V3+ const int16u DefineFontInfo = 13; //V1+ const int16u DefineSound = 14; //V1+ const int16u StartSound = 15; //V1+ const int16u DefineButtonSound = 17; //V2+ const int16u SoundStreamHead = 18; //V1+ const int16u SoundStreamBlock = 19; //V1+ const int16u DefineBitsLossless = 20; //V2+ const int16u DefineBitsJPEG2 = 21; //V2+ const int16u DefineShape2 = 22; //V2+ const int16u DefineCxform = 23; //V2+ const int16u Protect = 24; //V2+ const int16u PlaceObject2 = 26; //V3+ const int16u RemoveObject2 = 28; //V3+ const int16u DefineShape3 = 32; //V3+ const int16u DefineText2 = 33; //V3+ const int16u DefineButton2 = 34; //V3+ const int16u DefineBitsJPEG3 = 35; //V3+ const int16u DefineBitsLossless2 = 36; //V3+ const int16u DefineEditText = 37; //V4+ const int16u DefineSprite = 39; //V3+ const int16u FrameLabel = 43; //V3+ const int16u SoundStreamHead2 = 45; //V3+ const int16u DefineMorphShape = 46; //V3+ const int16u DefineFont2 = 48; //V3+ const int16u ExportAssets = 56; //V5+ const int16u ImportAssets = 57; //V5+ const int16u EnableDebugger = 58; //V5 const int16u DoInitAction = 59; //V6+ const int16u DefineVideoStream = 60; //V6+ const int16u DefineVideoFrame = 61; //V6+ const int16u DefineFontInfo2 = 62; //V6+ const int16u EnableDebugger2 = 64; //V6+ const int16u ScriptLimits = 65; //V6+ const int16u SetTabIndex = 66; //V7+ const int16u FileAttributes = 69; //V1+ const int16u PlaceObject3 = 70; //V8+ const int16u ImportAssets2 = 71; //V8+ const int16u DefineFontAlignZones = 73; //V8+ const int16u CSMTextSettings = 74; //V8+ const int16u DefineFont3 = 75; //V8+ const int16u SymbolClass = 76; //V9+ const int16u Metadata = 77; //V1+ const int16u DefineScalingGrid = 78; //V8+ const int16u DoABC = 82; //V9+ const int16u DefineShape4 = 83; //V8+ const int16u DefineMorphShape2 = 84; //V8+ const int16u DefineSceneAndFrameLabelData = 86; //V9+ const int16u DefineBinaryData = 87; //V9+ const int16u DefineFontName = 88; //V9+ const int16u StartSound2 = 89; //V9+ } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Swf::File_Swf() :File__Analyze() { //In Frame_Count_Valid=1024; FileLength=0; Version=0; } //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- bool File_Swf::FileHeader_Begin() { //Parsing if (Buffer_Size<8) return false; if (CC3(Buffer)!=0x435753) //CWS return true; //Compressed file if (File_Size>16*1024*1024) return true; //The file is too big, we will not parse all, only say this is SWF if (CC4(Buffer+4)<4*16*1024*1024) //FileLength return true; //The file is too big, we will not parse all, only say this is SWF Buffer_MaximumSize=(size_t)File_Size; if (Buffer_Size!=File_Size) return false; return true; } //--------------------------------------------------------------------------- void File_Swf::FileHeader_Parse() { //Parsing int32u Signature; if (FileLength==0 && Version==0) { Element_Begin1("SWF header"); Get_C3 (Signature, "Signature"); Get_L1 (Version, "Version"); Get_L4 (FileLength, "FileLength"); Element_End0(); } else { //Was already done by compressed file handling Signature=0x465753; } //Compressed file handling if (Signature==0x435753) //CWS { Decompress(); return; } //Parsing //Parsing - BitStream float32 FrameRate; int32u Xmin, Xmax, Ymin, Ymax; int16u FrameCount; int8u Nbits; BS_Begin(); Get_S1 (5, Nbits, "Nbits"); Get_BS (Nbits, Xmin, "Xmin"); Get_BS (Nbits, Xmax, "Xmax"); Param_Info2((Xmax-Xmin)/20, " pixels"); Get_BS (Nbits, Ymin, "Ymin"); Get_BS (Nbits, Ymax, "Ymax"); Param_Info2((Ymax-Ymin)/20, " pixels"); BS_End(); if (Version<=7) { int8u FrameRate_8; Skip_L1( "Ignored"); Get_L1 (FrameRate_8, "FrameRate"); FrameRate=FrameRate_8; } else { int16u FrameRate_8_8; Get_L2(FrameRate_8_8, "FrameRate"); FrameRate=((float32)FrameRate_8_8)/0x0100+(((float32)(FrameRate_8_8&0x00FF))/0x0100); //8.8 format Param_Info1(FrameRate); } Get_L2 (FrameCount, "FrameCount"); FILLING_BEGIN(); //Integrity if (Signature!=0x465753 && Signature!=0x435753) //FWS or CWS { Reject("SWF"); return; } //Filling Accept("SWF"); if (!IsSub) Fill(Stream_General, 0, General_Format, "ShockWave"); Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Width, (Xmax-Xmin)/20); Fill(Stream_Video, 0, Video_Height, (Ymax-Ymin)/20); if (FrameRate) Fill(Stream_Video, 0, Video_FrameRate, FrameRate); if (FrameCount) Fill(Stream_Video, 0, Video_FrameCount, FrameCount); FILLING_END(); } //--------------------------------------------------------------------------- void File_Swf::Header_Parse() { //Parsing int16u TagCodeAndLength; Get_L2 (TagCodeAndLength, "TagCodeAndLength"); //Filling int16u Tag=(TagCodeAndLength&0xFFC0)>>6; Param_Info1(Tag); Header_Fill_Code(Tag, Ztring().From_Number(Tag, 16)); //Size int16u Length=TagCodeAndLength&0x003F; if (Length<0x003F) { Param_Info2(Length, " bytes"); //Filling Header_Fill_Size(Element_Offset+Length); } else { int32u Length2; Get_L4(Length2, "Length"); Param_Info2(Length2, " bytes"); //Filling Header_Fill_Size(Element_Offset+Length2); } } //--------------------------------------------------------------------------- void File_Swf::Data_Parse() { #define LIS2(_ATOM, _NAME) \ case Elements::_ATOM : \ if (Level==Element_Level) \ { \ Element_Name(_NAME); \ _ATOM(); \ Element_ThisIsAList(); \ } \ #define ATO2(_ATOM, _NAME) \ case Elements::_ATOM : \ if (Level==Element_Level) \ { \ if (Element_IsComplete_Get()) \ { \ Element_Name(_NAME); \ _ATOM(); \ } \ else \ { \ Element_WaitForMoreData(); \ return; \ } \ } \ break; \ //Parsing DATA_BEGIN ATO2(End, "End"); ATO2(ShowFrame, "ShowFrame"); ATO2(DefineShape, "DefineShape"); ATO2(PlaceObject, "PlaceObject"); ATO2(RemoveObject, "RemoveObject"); ATO2(DefineBits, "DefineBits"); ATO2(DefineButton, "DefineButton"); ATO2(JPEGTables, "JPEGTables"); ATO2(SetBackgroundColor, "SetBackgroundColor"); ATO2(DefineFont, "DefineFont"); ATO2(DefineText, "DefineText"); ATO2(DoAction, "DoAction"); ATO2(DefineFontInfo, "DefineFontInfo"); ATO2(DefineSound, "DefineSound"); ATO2(StartSound, "StartSound"); ATO2(DefineButtonSound, "DefineButtonSound"); ATO2(SoundStreamHead, "SoundStreamHead"); ATO2(SoundStreamBlock, "SoundStreamBlock"); ATO2(DefineBitsLossless, "DefineBitsLossless"); ATO2(DefineBitsJPEG2, "DefineBitsJPEG2"); ATO2(DefineShape2, "DefineShape2"); ATO2(DefineCxform, "DefineCxform"); ATO2(Protect, "Protect"); ATO2(PlaceObject2, "PlaceObject2"); ATO2(RemoveObject2, "RemoveObject2"); ATO2(DefineShape3, "DefineShape3"); ATO2(DefineText2, "DefineText2"); ATO2(DefineButton2, "DefineButton2"); ATO2(DefineBitsJPEG3, "DefineBitsJPEG3"); ATO2(DefineBitsLossless2, "DefineBitsLossless2"); ATO2(DefineEditText, "DefineEditText"); LIS2(DefineSprite, "DefineSprite"); ATOM_BEGIN ATO2(ShowFrame, "ShowFrame"); ATO2(PlaceObject, "PlaceObject"); ATO2(RemoveObject, "RemoveObject"); ATO2(StartSound, "StartSound"); ATO2(SoundStreamHead, "SoundStreamHead"); ATO2(SoundStreamBlock, "SoundStreamBlock"); ATO2(PlaceObject2, "PlaceObject2"); ATO2(RemoveObject2, "RemoveObject2"); ATO2(FrameLabel, "FrameLabel"); ATO2(SoundStreamHead2, "SoundStreamHead2"); ATO2(End, "End"); ATOM_END ATO2(FrameLabel, "FrameLabel"); ATO2(DefineMorphShape, "DefineMorphShape"); ATO2(SoundStreamHead2, "SoundStreamHead2"); ATO2(DefineFont2, "DefineFont2"); ATO2(ExportAssets, "ExportAssets"); ATO2(ImportAssets, "ImportAssets"); ATO2(EnableDebugger, "EnableDebugger"); ATO2(DoInitAction, "DoInitAction"); ATO2(DefineVideoStream, "DefineVideoStream"); ATO2(DefineVideoFrame, "DefineVideoFrame"); ATO2(DefineFontInfo2, "DefineFontInfo2"); ATO2(EnableDebugger2, "EnableDebugger2"); ATO2(ScriptLimits, "ScriptLimits"); ATO2(SetTabIndex, "SetTabIndex"); ATO2(FileAttributes, "FileAttributes"); ATO2(PlaceObject3, "PlaceObject3"); ATO2(ImportAssets2, "ImportAssets2"); ATO2(DefineFontAlignZones, "DefineFontAlignZones"); ATO2(CSMTextSettings, "CSMTextSettings"); ATO2(DefineFont3, "DefineFont3"); ATO2(SymbolClass, "SymbolClass"); ATO2(Metadata, "Metadata"); ATO2(DefineScalingGrid, "DefineScalingGrid"); ATO2(DoABC, "DoABC"); ATO2(DefineShape4, "DefineShape4"); ATO2(DefineMorphShape2, "DefineMorphShape2"); ATO2(DefineSceneAndFrameLabelData, "DefineSceneAndFrameLabelData"); ATO2(DefineBinaryData, "DefineBinaryData"); ATO2(DefineFontName, "DefineFontName"); ATO2(StartSound2, "StartSound2"); DATA_END Frame_Count++; if (Frame_Count>=Frame_Count_Valid) Data_Finish("SWF"); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Swf::DefineSound() { //Parsing int16u SoundId; int8u SoundFormat, SoundRate, SoundSize, SoundType; Get_L2 (SoundId, "SoundId"); BS_Begin(); Get_S1 (4, SoundFormat, "SoundFormat"); Param_Info1(Swf_SoundFormat[SoundFormat]); Get_S1 (2, SoundRate, "SoundRate"); Param_Info2(Swf_SoundRate[SoundRate], " Hz"); Get_S1 (1, SoundSize, "SoundSize"); Param_Info2(Swf_SoundSize[SoundSize], " bits"); Get_S1 (1, SoundType, "SoundType"); Param_Info2(Swf_SoundType[SoundType], " channel(s)"); BS_End(); Skip_L4( "SoundSampleCount"); Skip_XX(Element_Size-Element_Offset, "SoundData"); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, StreamPos_Last, Audio_ID, SoundId); Fill(Stream_Audio, StreamPos_Last, Audio_Format, Swf_Format_Audio[SoundFormat]); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Version, Swf_Format_Version_Audio[SoundFormat]); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Profile, Swf_Format_Profile_Audio[SoundFormat]); Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Swf_SoundFormat[SoundFormat]); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, Swf_SoundRate[SoundRate]); if (SoundFormat!=2) //SoundSize is not valid for MPEG Audio Fill(Stream_Audio, StreamPos_Last, Audio_BitDepth, Swf_SoundSize[SoundSize]); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Swf_SoundType[SoundType]); } //--------------------------------------------------------------------------- void File_Swf::SoundStreamHead() { //Parsing int16u StreamSoundSampleCount; int8u StreamSoundCompression, StreamSoundRate, StreamSoundType, StreamSoundSize; BS_Begin(); Skip_S1(4, "Reserved"); Info_S1(2, PlaybackSoundRate, "PlaybackSoundRate"); Param_Info2(Swf_SoundRate[PlaybackSoundRate], " Hz"); Info_S1(1, PlaybackSoundSize, "PlaybackSoundSize"); Param_Info2(Swf_SoundSize[PlaybackSoundSize], " bits"); Info_S1(1, PlaybackSoundType, "PlaybackSoundType"); Param_Info2(Swf_SoundType[PlaybackSoundType], " channel(s)"); Get_S1 (4, StreamSoundCompression, "StreamSoundCompression"); Param_Info1(Swf_SoundFormat[StreamSoundCompression]); Get_S1 (2, StreamSoundRate, "StreamSoundRate"); Param_Info2(Swf_SoundRate[StreamSoundRate], " Hz"); Get_S1 (1, StreamSoundSize, "StreamSoundSize"); Param_Info2(Swf_SoundSize[StreamSoundSize], " bits"); Get_S1 (1, StreamSoundType, "StreamSoundType"); Param_Info2(Swf_SoundType[StreamSoundType], " channel(s)"); BS_End(); Get_L2 (StreamSoundSampleCount, "StreamSoundSampleCount"); if (StreamSoundCompression==2) Skip_L2( "LatencySeek"); if (StreamSoundSampleCount>0) { Stream_Prepare(Stream_Audio); Fill(Stream_Audio, StreamPos_Last, Audio_Format, Swf_Format_Audio[StreamSoundCompression]); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Version, Swf_Format_Version_Audio[StreamSoundCompression]); Fill(Stream_Audio, StreamPos_Last, Audio_Format_Profile, Swf_Format_Profile_Audio[StreamSoundCompression]); Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Swf_SoundFormat[StreamSoundCompression]); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, Swf_SoundRate[StreamSoundRate]); if (StreamSoundCompression!=2) //SoundSize is not valid for MPEG Audio Fill(Stream_Audio, StreamPos_Last, Audio_BitDepth, Swf_SoundSize[StreamSoundSize]); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Swf_SoundType[StreamSoundType]); } } //--------------------------------------------------------------------------- void File_Swf::DefineSprite() { //Parsing Skip_B2( "Character ID of sprite"); Skip_B2( "Number of frames in sprite"); } //--------------------------------------------------------------------------- void File_Swf::DefineVideoStream() { //Parsing int16u CharacterID, NumFrames, Width, Height; int8u CodecID; Get_L2 (CharacterID, "CharacterID"); Get_L2 (NumFrames, "NumFrames"); Get_L2 (Width, "Width"); Get_L2 (Height, "Height"); BS_Begin(); Skip_BS(4, "VideoFlagsReserved"); Skip_BS(3, "VideoFlagsDeblocking"); Skip_BS(1, "VideoFlagsSmoothing"); BS_End(); Get_L1 (CodecID, "CodecID"); Param_Info1(Swf_Format_Video[CodecID]); if (CodecID>=16) CodecID=0; //Should never happen (FLV is only 4-bit sized) Stream_Prepare(Stream_Video); Fill(Stream_Video, StreamPos_Last, Video_ID, CharacterID); Fill(Stream_Video, StreamPos_Last, Video_Width, Width); Fill(Stream_Video, StreamPos_Last, Video_Height, Height); Fill(Stream_Video, StreamPos_Last, Video_Format, Swf_Format_Video[CodecID]); Fill(Stream_Video, StreamPos_Last, Video_Format_Profile, Swf_Format_Profile_Video[CodecID]); Fill(Stream_Video, StreamPos_Last, Video_Codec, Swf_Codec_Video[CodecID]); Fill(Stream_Video, StreamPos_Last, Video_FrameCount, NumFrames); } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- bool File_Swf::Decompress() { if (Buffer_Size!=File_Size) { //We must have the complete file in memory, but this is too big (not handled by FileHeader_Begin()), only saying this is SWF Fill(Stream_General, 0, General_Format, "ShockWave"); Stream_Prepare(Stream_Video); Finish("SWF"); return true; } //Sizes unsigned long Source_Size=(unsigned long)(File_Size-8); unsigned long Dest_Size=(unsigned long)(FileLength-8); //Uncompressing int8u* Dest=new int8u[Dest_Size]; if (uncompress((Bytef*)Dest, &Dest_Size, (const Bytef*)Buffer+Buffer_Offset+8, Source_Size)<0) { delete[] Dest; //Dest=NULL Trusted_IsNot("Error while decompressing"); Reject("SWF"); return false; } Accept("SWF"); Fill(Stream_General, 0, General_Format, "ShockWave"); File_Swf MI; MI.FileLength=FileLength; MI.Version=Version; Open_Buffer_Init(&MI); MI.Open_Buffer_Continue(Dest, FileLength-8); MI.Open_Buffer_Finalize(); Merge(MI, Stream_General, 0, 0); Merge(MI); delete[] Dest; //Dest=NULL; Finish("SWF"); return true; } } //NameSpace #endif //MEDIAINFO_SWF_* MediaInfoLib/Source/MediaInfo/Multiple/File_Swf.h100777 0 0 10175 12226004262 15234 0/* 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 SWF files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_SwfH #define MediaInfo_File_SwfH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Swf //*************************************************************************** class File_Swf : public File__Analyze { public : //In int64u Frame_Count_Valid; int32u FileLength; int8u Version; public : File_Swf(); private : //Buffer bool FileHeader_Begin(); void FileHeader_Parse(); void Header_Parse(); void Data_Parse(); //Elements void Header(); void Header_Continue(); void End() {}; void ShowFrame() {}; void DefineShape() {}; void PlaceObject() {}; void RemoveObject() {}; void DefineBits() {}; void DefineButton() {}; void JPEGTables() {}; void SetBackgroundColor() {}; void DefineFont() {}; void DefineText() {}; void DoAction() {}; void DefineFontInfo() {}; void DefineSound(); void StartSound() {}; void DefineButtonSound() {}; void SoundStreamHead(); void SoundStreamBlock() {}; void DefineBitsLossless() {}; void DefineBitsJPEG2() {}; void DefineShape2() {}; void DefineCxform() {}; void Protect() {}; void PlaceObject2() {}; void RemoveObject2() {}; void DefineShape3() {}; void DefineText2() {}; void DefineButton2() {}; void DefineBitsJPEG3() {}; void DefineBitsLossless2() {}; void DefineEditText() {}; void DefineSprite(); void FrameLabel() {}; void DefineMorphShape() {}; void SoundStreamHead2() {SoundStreamHead();}; void DefineFont2() {}; void ExportAssets() {}; void ImportAssets() {}; void EnableDebugger() {}; void DoInitAction() {}; void DefineVideoStream(); void DefineVideoFrame() {}; void DefineFontInfo2() {}; void EnableDebugger2() {}; void ScriptLimits() {}; void SetTabIndex() {}; void FileAttributes() {}; void PlaceObject3() {}; void ImportAssets2() {}; void DefineFontAlignZones() {}; void CSMTextSettings() {}; void DefineFont3() {}; void SymbolClass() {}; void Metadata() {}; void DefineScalingGrid() {}; void DoABC() {}; void DefineShape4() {}; void DefineMorphShape2() {}; void DefineSceneAndFrameLabelData() {}; void DefineBinaryData() {}; void DefineFontName() {}; void StartSound2() {}; //Helpers bool Decompress(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Umf.cpp100777 0 0 33000 12226004262 15547 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_GXF_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Umf.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Umf::File_Umf() :File__Analyze() { //In #if MEDIAINFO_SEEK || MEDIAINFO_DEMUX GopSize=(int64u)-1; #endif //MEDIAINFO_SEEK || MEDIAINFO_DEMUX } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Umf::FileHeader_Begin() { //Element_Size if (Buffer_Size<2) return false; //Must wait for more data int16u Length=LittleEndian2int16u(Buffer); if (Buffer_Size=Element_Size) break; } for (int32u Pos=0; Pos=Element_Size) break; } while (Element_Offset18) Skip_XX(Length-18, "User data"); else Skip_XX(Element_Size-Element_Offset-2, "User data"); Skip_L1( "NULL byte"); Skip_L1( "Reserved byte"); Element_End0(); } } } //NameSpace #endif //MEDIAINFO_UMF_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Umf.h100777 0 0 2663 12226004262 15207 0/* 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 UMF files // Unified Material Format // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_UmfH #define MediaInfo_File_UmfH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Umf //*************************************************************************** class File_Umf : public File__Analyze { public : //Constructor/Destructor File_Umf(); //Out #if MEDIAINFO_SEEK || MEDIAINFO_DEMUX int64u GopSize; #endif //MEDIAINFO_SEEK || MEDIAINFO_DEMUX protected : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Wm.cpp100777 0 0 26420 12226004262 15413 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Main part // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #ifdef MEDIAINFO_WM_YES //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Wm.h" #if defined(MEDIAINFO_MPEGPS_YES) #include "MediaInfo/Multiple/File_MpegPs.h" #endif #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events.h" #endif //MEDIAINFO_EVENTS #include "ZenLib/Utils.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Format //*************************************************************************** //--------------------------------------------------------------------------- File_Wm::File_Wm() :File__Analyze() { //Configuration ParserName=__T("Wm"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Wm; StreamIDs_Width[0]=2; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_Level=2; //Container #endif //MEDIAINFO_DEMUX DataMustAlwaysBeComplete=false; //Stream Packet_Count=0; MaximumDataPacketSize=(int32u)-1; Header_ExtendedContentDescription_AspectRatioX=0; Header_ExtendedContentDescription_AspectRatioY=0; SizeOfMediaObject_BytesAlreadyParsed=0; FileProperties_Preroll=0; Codec_Description_Count=0; Stream_Number=0; Data_Parse_Padding=0; NumberPayloads=1; NumberPayloads_Pos=0; Data_Parse_Begin=true; IsDvrMs=false; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Wm::Streams_Finish() { //Encryption management /*const Ztring& Encryption=Retrieve(Stream_General, 0, General_Encryption); if (!Encryption.empty()) { for (size_t StreamKind=Stream_General+1; StreamKind::iterator Temp=Stream.begin(); while (Temp!=Stream.end()) { for (std::map::iterator Info_Temp=Temp->second.Info.begin(); Info_Temp!=Temp->second.Info.end(); ++Info_Temp) Fill(Temp->second.StreamKind, Temp->second.StreamPos, Info_Temp->first.c_str(), Info_Temp->second, true); //Codec Info for (size_t Pos=0; Possecond.StreamKind==Stream_Video) || (CodecInfos[Pos].Type==2 && Temp->second.StreamKind==Stream_Audio)) { Fill(Temp->second.StreamKind, Temp->second.StreamPos, "CodecID_Description", CodecInfos[Pos].Info, true); Fill(Temp->second.StreamKind, Temp->second.StreamPos, "Codec_Description", CodecInfos[Pos].Info, true); } } if (Temp->second.StreamKind==Stream_Video) { //Some tests about the frame rate std::map PresentationTime_Deltas_Problem; std::map PresentationTime_Deltas_Most; for (std::map::iterator PresentationTime_Delta=Temp->second.PresentationTime_Deltas.begin(); PresentationTime_Delta!=Temp->second.PresentationTime_Deltas.end(); ++PresentationTime_Delta) { if (PresentationTime_Delta->second>=5) PresentationTime_Deltas_Problem[PresentationTime_Delta->first]=PresentationTime_Delta->second; if (PresentationTime_Delta->second>=30) PresentationTime_Deltas_Most[PresentationTime_Delta->first]=PresentationTime_Delta->second; } if (PresentationTime_Deltas_Most.empty() || (PresentationTime_Deltas_Most.size()==1 && PresentationTime_Deltas_Problem.size()>1) || (PresentationTime_Deltas_Most.size()==2 && PresentationTime_Deltas_Problem.size()>2)) { if (Temp->second.AverageTimePerFrame>0) Fill(Stream_Video, Temp->second.StreamPos, Video_FrameRate, ((float)10000000)/Temp->second.AverageTimePerFrame, 3, true); } else if (PresentationTime_Deltas_Most.size()==1) { if (PresentationTime_Deltas_Most.begin()->first>1) //Not 0, we want to remove Delta incremented 1 per 1 Fill(Stream_Video, Temp->second.StreamPos, Video_FrameRate, 1000/((float64)PresentationTime_Deltas_Most.begin()->first), 3, true); if (Temp->second.AverageTimePerFrame>0) Fill(Stream_Video, Temp->second.StreamPos, Video_FrameRate_Nominal, ((float)10000000)/Temp->second.AverageTimePerFrame, 3, true); } else if (PresentationTime_Deltas_Most.size()==2) { std::map::iterator PresentationTime_Delta_Most=PresentationTime_Deltas_Most.begin(); float64 PresentationTime_Deltas_1_Value=(float64)PresentationTime_Delta_Most->first; float64 PresentationTime_Deltas_1_Count=(float64)PresentationTime_Delta_Most->second; ++PresentationTime_Delta_Most; float64 PresentationTime_Deltas_2_Value=(float64)PresentationTime_Delta_Most->first; float64 PresentationTime_Deltas_2_Count=(float64)PresentationTime_Delta_Most->second; float64 FrameRate_Real=1000/(((PresentationTime_Deltas_1_Value*PresentationTime_Deltas_1_Count)+(PresentationTime_Deltas_2_Value*PresentationTime_Deltas_2_Count))/(PresentationTime_Deltas_1_Count+PresentationTime_Deltas_2_Count)); Fill(Temp->second.StreamKind, Temp->second.StreamPos, Video_FrameRate, FrameRate_Real, 3, true); if (Temp->second.AverageTimePerFrame>0) Fill(Stream_Video, Temp->second.StreamPos, Video_FrameRate_Nominal, ((float)10000000)/Temp->second.AverageTimePerFrame, 3, true); } else { Fill(Stream_Video, Temp->second.StreamPos, Video_FrameRate_Mode, "VFR"); if (Temp->second.AverageTimePerFrame>0) Fill(Stream_Video, Temp->second.StreamPos, Video_FrameRate_Nominal, ((float)10000000)/Temp->second.AverageTimePerFrame, 3, true); } } if (Temp->second.AverageBitRate>0) Fill(Temp->second.StreamKind, Temp->second.StreamPos, "BitRate", Temp->second.AverageBitRate, 10, true); if (Temp->second.LanguageID!=(int16u)-1 && Temp->second.LanguageID<(int16u)Languages.size()) Fill(Temp->second.StreamKind, Temp->second.StreamPos, "Language", Languages[Temp->second.LanguageID]); else if (!Language_ForAll.empty()) Fill(Temp->second.StreamKind, Temp->second.StreamPos, "Language", Language_ForAll); if (Temp->second.Parser) { if (Temp->second.StreamKind==Stream_Max) if (Temp->second.Parser->Count_Get(Stream_Audio)) { Stream_Prepare(Stream_Audio); Temp->second.StreamKind=StreamKind_Last; Temp->second.StreamPos=StreamPos_Last; } Ztring Format_Profile; if (Temp->second.StreamKind==Stream_Video) Format_Profile=Retrieve(Stream_Video, Temp->second.StreamPos, Video_Format_Profile); Finish(Temp->second.Parser); if (Temp->second.Parser->Get(Stream_Video, 0, Video_Format)==__T("MPEG Video")) { //Width/Height are junk Clear(Stream_Video, Temp->second.StreamPos, Video_Width); Clear(Stream_Video, Temp->second.StreamPos, Video_Height); Clear(Stream_Video, Temp->second.StreamPos, Video_PixelAspectRatio); Clear(Stream_Video, Temp->second.StreamPos, Video_DisplayAspectRatio); } //Delay (in case of MPEG-PS) if (Temp->second.TimeCode_First!=(int64u)-1) { Fill(Temp->second.StreamKind, Temp->second.StreamPos, Fill_Parameter(Temp->second.StreamKind, Generic_Delay), Temp->second.TimeCode_First, 10); Fill(Temp->second.StreamKind, Temp->second.StreamPos, Fill_Parameter(Temp->second.StreamKind, Generic_Delay_Source), "Container"); } Merge(*Temp->second.Parser, Temp->second.StreamKind, 0, Temp->second.StreamPos); if (!Format_Profile.empty() && Format_Profile.find(Retrieve(Stream_Video, Temp->second.StreamPos, Video_Format_Profile))==0) Fill(Stream_Video, Temp->second.StreamPos, Video_Format_Profile, Format_Profile, true); } ++Temp; } if (Count_Get(Stream_Video)==0 && Count_Get(Stream_Image)==0) Fill(Stream_General, 0, General_InternetMediaType, "audio/x-ms-wma", Unlimited, true, true); //Purge what is not needed anymore if (!File_Name.empty()) //Only if this is not a buffer, with buffer we can have more data Stream.clear(); } //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- void File_Wm::Header_Parse() { if (!MustUseAlternativeParser) { //Parsing int128u Name; int64u Size; Get_GUID(Name, "Name"); Get_L8 (Size, "Size"); //Filling Header_Fill_Code(Name.hi, Ztring().From_GUID(Name)); Header_Fill_Size(Size); } else { Header_Fill_Code(0, "Packet"); Header_Fill_Size(MaximumDataPacketSize); } } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_WM_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Wm.h100777 0 0 14223 12226004262 15056 0/* 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. */ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_WmH #define MediaInfo_File_WmH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Wm //*************************************************************************** class File_Wm : public File__Analyze { public : File_Wm(); protected : //Streams management void Streams_Finish(); private : //Buffer void Header_Parse(); void Data_Parse(); //Elements void Header(); void Header_FileProperties(); void Header_StreamProperties(); void Header_StreamProperties_Audio(); void Header_StreamProperties_Audio_WMA(); void Header_StreamProperties_Audio_AMR(); void Header_StreamProperties_Video(); void Header_StreamProperties_JFIF(); void Header_StreamProperties_DegradableJPEG(); void Header_StreamProperties_Binary(); void Header_HeaderExtension(); void Header_HeaderExtension_ExtendedStreamProperties(); void Header_HeaderExtension_AdvancedMutualExclusion(); void Header_HeaderExtension_GroupMutualExclusion(); void Header_HeaderExtension_StreamPrioritization(); void Header_HeaderExtension_BandwidthSharing(); void Header_HeaderExtension_LanguageList(); void Header_HeaderExtension_Metadata(); void Header_HeaderExtension_MetadataLibrary(); void Header_HeaderExtension_IndexParameters(); void Header_HeaderExtension_MediaIndexParameters(); void Header_HeaderExtension_TimecodeIndexParameters(); void Header_HeaderExtension_Compatibility(); void Header_HeaderExtension_AdvancedContentEncryption(); void Header_HeaderExtension_IndexPlaceholder(); void Header_CodecList(); void Header_ScriptCommand(); void Header_Marker(); void Header_BitRateMutualExclusion(); void Header_ErrorCorrection(); void Header_ContentDescription(); void Header_ExtendedContentDescription(); void Header_ExtendedContentDescription_ASFLeakyBucketPairs(int16u Value_Length); void Header_StreamBitRate(); void Header_ContentBranding(); void Header_ContentEncryption(); void Header_ExtendedContentEncryption(); void Header_DigitalSignature(); void Header_Padding(); void Data(); void Data_Packet(); void Data_Packet_ReplicatedData(int32u Size); void Data_Packet_ReplicatedData_TimeStamp(); void SimpleIndex(); void Index(); void MediaIndex(); void TimecodeIndex(); //Data struct stream { struct payload_extension_system { int128u ID; int16u Size; }; File__Analyze* Parser; File__Analyze* Parser2; File__Analyze* Parser3; stream_t StreamKind; size_t StreamPos; size_t PacketCount; int64u AverageTimePerFrame; int32u AverageBitRate; int16u LanguageID; std::map Info; bool IsCreated; //if Stream_Prepare() is done bool SearchingPayload; int32u PresentationTime_Old; int32u PresentationTime_Count; std::map PresentationTime_Deltas; std::vector Payload_Extension_Systems; int64u TimeCode_First; stream() { Parser=NULL; Parser2=NULL; Parser3=NULL; StreamKind=Stream_Max; StreamPos=0; PacketCount=0; AverageTimePerFrame=0; AverageBitRate=0; LanguageID=(int16u)-1; IsCreated=false; SearchingPayload=false; PresentationTime_Old=0; PresentationTime_Count=0; TimeCode_First=(int64u)-1; } ~stream() { delete Parser; //Parser=NULL; delete Parser2; //Parser2=NULL delete Parser3; //Parser3=NULL } }; struct codecinfo { int16u Type; Ztring Info; }; std::map Stream; int16u Stream_Number; //In header: current pos, in Data: Count of enabled parsers std::vector Languages; std::vector CodecInfos; Ztring Language_ForAll; int32u Data_Parse_Padding; int32u MaximumDataPacketSize; bool Data_Parse_Begin; bool Data_Parse_MultiplePayloads; bool Data_Parse_CompressedPayload; bool IsDvrMs; //Is DVR-Ms format (for finding MPEG Audio) //From Data headers size_t Codec_Description_Count; size_t Packet_Count; size_t Streams_Count; int64u Header_ExtendedContentDescription_AspectRatioX; int64u Header_ExtendedContentDescription_AspectRatioY; size_t Header_StreamProperties_StreamOrder; int64u Data_AfterTheDataChunk; int32u SizeOfMediaObject_BytesAlreadyParsed; int32u FileProperties_Preroll; int8u ReplicatedDataLengthType; int8u OffsetIntoMediaObjectLengthType; int8u MediaObjectNumberLengthType; int8u StreamNumberLengthType; int8u PayloadLengthType; int8u NumberPayloads; int8u NumberPayloads_Pos; bool MultiplePayloadsPresent; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File_Wm_Elements.cpp100777 0 0 243652 12226004262 17277 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Elements part // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #ifdef MEDIAINFO_WM_YES //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Wm.h" #if defined(MEDIAINFO_VC1_YES) #include "MediaInfo/Video/File_Vc1.h" #endif #if defined(MEDIAINFO_MPEGV_YES) #include "MediaInfo/Video/File_Mpegv.h" #endif #if defined(MEDIAINFO_AC3_YES) #include "MediaInfo/Audio/File_Ac3.h" #endif #if defined(MEDIAINFO_MPEGA_YES) #include "MediaInfo/Audio/File_Mpega.h" #endif #if MEDIAINFO_DEMUX #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "base64.h" #endif //MEDIAINFO_DEMUX #include "ZenLib/Utils.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constants //*************************************************************************** const char* Wm_CodecList_Kind(int32u Kind) { switch (Kind) { case 0x01 : return "Video"; case 0x02 : return "Audio"; default : return "Unknown"; } } const char* Wm_BannerImageData_Type(int32u Type) { switch (Type) { case 0x00 : return ""; case 0x01 : return "Bitmap"; case 0x02 : return "JPEG"; case 0x03 : return "GIF"; default : return "Unknown"; } } #define UUID(NAME, PART1, PART2, PART3, PART4, PART5) \ const int64u NAME =0x##PART3##PART2##PART1##ULL; \ const int64u NAME##2=0x##PART4##PART5##ULL; \ namespace Elements { UUID(Header, 75B22630, 668E, 11CF, A6D9, 00AA0062CE6C) UUID(Header_FileProperties, 8CABDCA1, A947, 11CF, 8EE4, 00C00C205365) UUID(Header_StreamProperties, B7DC0791, A9B7, 11CF, 8EE6, 00C00C205365) UUID(Header_StreamProperties_Audio, F8699E40, 5B4D, 11CF, A8FD, 00805F5C442B) UUID(Header_StreamProperties_Video, BC19EFC0, 5B4D, 11CF, A8FD, 00805F5C442B) UUID(Header_StreamProperties_Command, 59DACFC0, 59E6, 11D0, A3AC, 00A0C90348F6) UUID(Header_StreamProperties_JFIF, B61BE100, 5B4E, 11CF, A8FD, 00805F5C442B) UUID(Header_StreamProperties_DegradableJPEG, 35907DE0, E415, 11CF, A917, 00805F5C442B) UUID(Header_StreamProperties_FileTransfer, 91BD222C, F21C, 497A, 8B6D, 5AA86BFC0185) UUID(Header_StreamProperties_Binary, 3AFB65E2, 47EF, 40F2, AC2C, 70A90D71D343) UUID(Header_StreamProperties_Binary_WebStreamMediaSubType, 776257D4, C627, 41CB, 8F81, 7AC7FF1C40CC) UUID(Header_StreamProperties_Binary_WebStreamFormat, DA1E6B13, 8359, 4050, B398, 388E965BF00C) UUID(Header_HeaderExtension, 5FBF03B5, A92E, 11CF, 8EE3, 00C00C205365) UUID(Header_HeaderExtension_ExtendedStreamProperties, 14E6A5CB, C672, 4332, 8399, A96952065B5A) UUID(Header_HeaderExtension_AdvancedMutualExclusion, A08649CF, 4775, 4670, 8A16, 6E35357566CD) UUID(Header_HeaderExtension_GroupMutualExclusion, D1465A40, 5A79, 4338, B71B, E36B8FD6C249) UUID(Header_HeaderExtension_StreamPrioritization, D4FED15B, 88D3, 454F, 81F0, ED5C45999E24) UUID(Header_HeaderExtension_BandwidthSharing, A69609E6, 517B, 11D2, B6AF, 00C04FD908E9) UUID(Header_HeaderExtension_LanguageList, 7C4346A9, EFE0, 4BFC, B229, 393EDE415C85) UUID(Header_HeaderExtension_Metadata, C5F8CBEA, 5BAF, 4877, 8467, AA8C44FA4CCA) UUID(Header_HeaderExtension_MetadataLibrary, 44231C94, 9498, 49D1, A141, 1D134E457054) UUID(Header_HeaderExtension_IndexParameters, D6E229DF, 35DA, 11D1, 9034, 00A0C90349BE) UUID(Header_HeaderExtension_MediaIndexParameters, 6B203BAD, 3F11, 48E4, ACA8, D7613DE2CFA7) UUID(Header_HeaderExtension_TimecodeIndexParameters, F55E496D, 9797, 4B5D, 8C8B, 604DFE9BFB24) UUID(Header_HeaderExtension_Compatibility, 26F18B5D, 4584, 47EC, 9F5F, 0E651F0452C9) UUID(Header_HeaderExtension_AdvancedContentEncryption, 43058533, 6981, 49E6, 9B74, AD12CB86D58C) UUID(Header_HeaderExtension_IndexPlaceholder, D9AADE20, 7C17, 4F9C, BC28, 8555DD98E2A2) UUID(Header_CodecList, 86D15240, 311D, 11D0, A3A4, 00ACC90348F6) UUID(Header_ScriptCommand, 1EFB1A30, 0B62, 11D0, A39B, 00A0C90348F6) UUID(Header_Marker, F487CD01, A951, 11CF, 8EE6, 00C00C205365) UUID(Header_BitRateMutualExclusion, D6E229DC, 35DA, 11D1, 9034, 00A0C90349BE) UUID(Header_ErrorCorrection, 75B22635, 668E, 11CF, A6D9, 00AA0062CE6C) UUID(Header_ContentDescription, 75B22633, 668E, 11CF, A6D9, 00AA0062CE6C) UUID(Header_ExtendedContentDescription, D2D0A440, E307, 11D2, 97F0, 00A0C95EA850) UUID(Header_StreamBitRate, 7BF875CE, 468D, 11D1, 8D82, 006097C9A2B2) UUID(Header_ContentBranding, 2211B3FA, BD23, 11D2, B4B7, 00A0C955FC6E) UUID(Header_ContentEncryption, 2211B3FB, BD23, 11D2, B4B7, 00A0C955FC6E) UUID(Header_ExtendedContentEncryption, 298AE614, 2622, 4C17, B935, DAE07EE9289C) UUID(Header_DigitalSignature, 2211B3FC, BD23, 11D2, B4B7, 00A0C955FC6E) UUID(Header_Padding, 1806D474, CADF, 4509, A4BA, 9AABCB96AAE8) UUID(Data, 75B22636, 668E, 11CF, A6D9, 00AA0062CE6C) UUID(SimpleIndex, 33000890, E5B1, 11CF, 89F4, 00A0C90349CB) UUID(Index, D6E229D3, 35DA, 11D1, 9034, 00A0C90349BE) UUID(MediaIndex, FEB103F8, 12AD, 4C64, 840F, 2A1D2F7AD48C) UUID(TimecodeIndex, 3CB73FD0, 0C4A, 4803, 953D, EDF7B6228F0C) UUID(Payload_Extension_System_TimeStamp, 1135BEB7, 3A39, 478A, 98D9, 15C76B00EB69); UUID(Mutex_Language, D6E22A00, 35DA, 11D1, 9034, 00A0C90349BE); UUID(Mutex_Bitrate, D6E22A01, 35DA, 11D1, 9034, 00A0C90349BE); } const char* Wm_StreamType(const int128u Kind) { switch (Kind.hi) { case Elements::Header_StreamProperties_Audio : return "Audio"; case Elements::Header_StreamProperties_Video : return "Video"; case Elements::Header_StreamProperties_Command : return "Command"; case Elements::Header_StreamProperties_JFIF : return "JFIF"; case Elements::Header_StreamProperties_DegradableJPEG : return "Degradable JPEG"; case Elements::Header_StreamProperties_FileTransfer : return "File Transfer"; case Elements::Header_StreamProperties_Binary : return "Binary"; default : return "Unknown"; } } const char* Wm_ExclusionType(const int128u ExclusionType) { switch (ExclusionType.hi) { case Elements::Header_StreamProperties_Audio : return "Language"; case Elements::Header_StreamProperties_Video : return "Bitrate"; default : return "Unknown"; } } //*************************************************************************** // Format //*************************************************************************** //--------------------------------------------------------------------------- // Element parse // void File_Wm::Data_Parse() { //Parsing DATA_BEGIN LIST(Header) ATOM_BEGIN ATOM(Header_FileProperties) ATOM(Header_StreamProperties) LIST(Header_HeaderExtension) ATOM_BEGIN ATOM(Header_HeaderExtension_ExtendedStreamProperties) ATOM(Header_HeaderExtension_AdvancedMutualExclusion) ATOM(Header_HeaderExtension_GroupMutualExclusion) ATOM(Header_HeaderExtension_StreamPrioritization) ATOM(Header_HeaderExtension_BandwidthSharing) ATOM(Header_HeaderExtension_LanguageList) ATOM(Header_HeaderExtension_Metadata) ATOM(Header_HeaderExtension_MetadataLibrary) ATOM(Header_HeaderExtension_IndexParameters) ATOM(Header_HeaderExtension_MediaIndexParameters) ATOM(Header_HeaderExtension_TimecodeIndexParameters) ATOM(Header_HeaderExtension_Compatibility) ATOM(Header_HeaderExtension_AdvancedContentEncryption) ATOM(Header_HeaderExtension_IndexPlaceholder) ATOM(Header_Padding) ATOM_END ATOM(Header_CodecList) ATOM(Header_ScriptCommand) ATOM(Header_Marker) ATOM(Header_BitRateMutualExclusion) ATOM(Header_ErrorCorrection) ATOM(Header_ContentDescription) ATOM(Header_ExtendedContentDescription) ATOM(Header_StreamBitRate) ATOM(Header_ContentBranding) ATOM(Header_ContentEncryption) ATOM(Header_ExtendedContentEncryption) ATOM(Header_DigitalSignature) ATOM(Header_Padding) ATOM_END LIST(Data) ATOM_DEFAULT_ALONE(Data_Packet) LIST_SKIP(SimpleIndex) LIST_SKIP(Index) ATOM(MediaIndex) ATOM(TimecodeIndex) DATA_END } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Wm::Header() { Data_Accept("Windows Media"); Element_Name("Header"); //Parsing Skip_L4( "Number of Header Objects"); Skip_L1( "Alignment"); Skip_L1( "Architecture"); FILLING_BEGIN(); Fill(Stream_General, 0, General_Format, "Windows Media"); Header_StreamProperties_StreamOrder=0; FILLING_END(); } //--------------------------------------------------------------------------- void File_Wm::Header_FileProperties() { Element_Name("File Properties"); //Parsing int64u CreationDate, PlayDuration, SendDuration, Preroll; int32u Flags, MaximumBitRate; Skip_GUID( "File ID"); Skip_L8( "File Size"); Get_L8 (CreationDate, "Creation Date"); Param_Info1(Ztring().Date_From_Milliseconds_1601(CreationDate/10000)); Skip_L8( "Data Packets Count"); Get_L8 (PlayDuration, "Play Duration"); Param_Info_From_Milliseconds(PlayDuration/10000); Get_L8 (SendDuration, "Send Duration"); Param_Info_From_Milliseconds(SendDuration/10000); Get_L8 (Preroll, "Preroll"); Param_Info_From_Milliseconds(Preroll); Get_L4 (Flags, "Flags"); Skip_Flags(Flags, 0, "Broadcast"); Skip_Flags(Flags, 1, "Seekable"); Skip_Flags(Flags, 2, "Use Packet Template"); Skip_Flags(Flags, 3, "Live"); Skip_Flags(Flags, 4, "Recordable"); Skip_Flags(Flags, 5, "Unknown Data Size"); Skip_L4( "Minimum Data Packet Size"); Get_L4 (MaximumDataPacketSize, "Maximum Data Packet Size"); Get_L4 (MaximumBitRate, "Maximum Bitrate"); //Filling if (MaximumBitRate) Fill(Stream_General, 0, General_OverallBitRate_Maximum, MaximumBitRate); Fill(Stream_General, 0, General_Encoded_Date, Ztring().Date_From_Milliseconds_1601(CreationDate/10000)); if (PlayDuration/1000>Preroll) Fill(Stream_General, 0, General_Duration, PlayDuration/10000-Preroll); FileProperties_Preroll=(int32u)(Preroll); } //--------------------------------------------------------------------------- void File_Wm::Header_StreamProperties () { Element_Name("Stream Properties"); //Parsing int128u StreamType; int32u StreamTypeLength, ErrorCorrectionTypeLength; Get_GUID(StreamType, "StreamType"); Param_Info1(Wm_StreamType(StreamType)); Element_Info1(Wm_StreamType(StreamType)); Skip_GUID( "Error Correction Type"); Skip_L8( "Time Offset"); Get_L4 (StreamTypeLength, "Type-Specific Data Length"); Get_L4 (ErrorCorrectionTypeLength, "Error Correction Data Length"); Get_L2 (Stream_Number, "Stream Number"); if (Stream_Number&0x8000) { Param_Info1("Encrypted Content"); Stream[Stream_Number&0x007F].Info["Encryption"]=__T("Encrypted"); } Stream_Number&=0x007F; //Only 7bits Element_Info1(Stream_Number); Skip_L4( "Reserved"); switch (StreamType.hi) { case Elements::Header_StreamProperties_Audio : Element_Begin0(); //size is StreamTypeLength Header_StreamProperties_Audio(); Element_End0(); break; case Elements::Header_StreamProperties_Video : Element_Begin0(); //size is StreamTypeLength Header_StreamProperties_Video(); Element_End0(); break; case Elements::Header_StreamProperties_JFIF : Element_Begin0(); //size is StreamTypeLength Header_StreamProperties_JFIF(); Element_End0(); break; case Elements::Header_StreamProperties_DegradableJPEG : Element_Begin0(); //size is StreamTypeLength Header_StreamProperties_DegradableJPEG(); Element_End0(); break; case Elements::Header_StreamProperties_FileTransfer : case Elements::Header_StreamProperties_Binary : Element_Begin0(); //size is StreamTypeLength Header_StreamProperties_Binary(); StreamKind_Last=Stream_Max; StreamPos_Last=(size_t)-1; Element_End0(); break; default : if (StreamTypeLength>0) Skip_XX(StreamTypeLength, "Type-Specific Data"); StreamKind_Last=Stream_Max; StreamPos_Last=(size_t)-1; } if (ErrorCorrectionTypeLength) Skip_XX(ErrorCorrectionTypeLength, "Error Correction Data"); //Filling Stream[Stream_Number].StreamKind=StreamKind_Last; Stream[Stream_Number].StreamPos=StreamPos_Last; Stream[Stream_Number].Info["ID"].From_Number(Stream_Number); Stream[Stream_Number].Info["StreamOrder"].From_Number(Header_StreamProperties_StreamOrder); Header_StreamProperties_StreamOrder++; } //--------------------------------------------------------------------------- void File_Wm::Header_StreamProperties_Audio () { Element_Name("Audio"); //Parsing int32u SamplingRate, BytesPerSec; int16u CodecID, Channels, Data_Size, Resolution; Get_L2 (CodecID, "Codec ID"); Get_L2 (Channels, "Number of Channels"); Get_L4 (SamplingRate, "Samples Per Second"); Get_L4 (BytesPerSec, "Average Number of Bytes Per Second"); Skip_L2( "Block Alignment"); Get_L2 (Resolution, "Bits / Sample"); Get_L2 (Data_Size, "Codec Specific Data Size"); //Filling Stream_Prepare(Stream_Audio); Stream[Stream_Number].IsCreated=true; Ztring Codec; Codec.From_Number(CodecID, 16); Codec.MakeUpperCase(); CodecID_Fill(Codec, Stream_Audio, StreamPos_Last, InfoCodecID_Format_Riff); Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Codec); //May be replaced by codec parser Fill(Stream_Audio, StreamPos_Last, Audio_Codec_CC, Codec); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Channels); Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, SamplingRate); Fill(Stream_Audio, StreamPos_Last, Audio_BitRate, BytesPerSec*8); Fill(Stream_Audio, StreamPos_Last, Audio_BitDepth, Resolution); FILLING_BEGIN(); //Creating the parser if (0); #if defined(MEDIAINFO_MPEGA_YES) else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Ztring::ToZtring(CodecID, 16))==__T("MPEG Audio")) { Stream[Stream_Number].Parser=new File_Mpega; ((File_Mpega*)Stream[Stream_Number].Parser)->Frame_Count_Valid=8; Stream[Stream_Number].Parser->ShouldContinueParsing=true; } #endif Open_Buffer_Init(Stream[Stream_Number].Parser); FILLING_END(); //Parsing if (Data_Size>0) { Element_Begin1("Codec Specific Data"); switch (CodecID) { case 0x0161 : case 0x0162 : case 0x0163 : Header_StreamProperties_Audio_WMA(); break; case 0x7A21 : case 0x7A22 : Header_StreamProperties_Audio_AMR(); break; default : Skip_XX(Data_Size, "Unknown"); } Element_End0(); } } //--------------------------------------------------------------------------- void File_Wm::Header_StreamProperties_Audio_WMA () { Element_Info1("WMA"); //Demux #if MEDIAINFO_DEMUX 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+Element_Offset), (size_t)10);//Element_Size-(Element_Offset)); std::string Data_Base64(Base64::encode(Data_Raw)); Fill(Stream_Audio, StreamPos_Last, "Demux_InitBytes", Data_Base64); (*Stream_More)[Stream_Audio][StreamPos_Last](Ztring().From_Local("Demux_InitBytes"), Info_Options)=__T("N NT"); } break; default : ; } #endif //MEDIAINFO_DEMUX //Parsing Skip_L4( "SamplesPerBlock"); Skip_L2( "EncodeOptions"); Skip_L4( "SuperBlockAlign"); } //--------------------------------------------------------------------------- void File_Wm::Header_StreamProperties_Audio_AMR () { Element_Info1("AMR"); //Parsing int32u Flags; bool VBR; Get_L4 (Flags, "Flags"); Skip_Flags(Flags, 0, "SID is used"); Get_Flags (Flags, 1, VBR, "Varying bitrate"); //Filling Fill(Stream_Audio, StreamPos_Last, Audio_BitRate_Mode, VBR?"VBR":"CBR"); } //--------------------------------------------------------------------------- void File_Wm::Header_StreamProperties_Video () { Element_Name("Video"); //Parsing int32u Width, Height, Compression; int16u Data_Size, Resolution; Get_L4 (Width, "Width"); Get_L4 (Height, "Height"); Skip_L1( "Flags"); Get_L2 (Data_Size, "Format Data Size"); Skip_L4( "Size"); Get_L4 (Width, "Width"); Get_L4 (Height, "Height"); Skip_L2( "Planes"); Get_L2 (Resolution, "BitCount"); Get_C4 (Compression, "Compression"); Skip_L4( "SizeImage"); Skip_L4( "XPelsPerMeter"); Skip_L4( "YPelsPerMeter"); Skip_L4( "ClrUsed"); Skip_L4( "ClrImportant"); //Filling Stream_Prepare(Stream_Video); Stream[Stream_Number].IsCreated=true; CodecID_Fill(Ztring().From_CC4(Compression), Stream_Video, StreamPos_Last, InfoCodecID_Format_Riff); Fill(Stream_Video, StreamPos_Last, Video_Codec, Ztring().From_CC4(Compression)); //May be replaced by codec parser Fill(Stream_Video, StreamPos_Last, Video_Codec_CC, Ztring().From_CC4(Compression)); Fill(Stream_Video, StreamPos_Last, Video_Width, Width); Fill(Stream_Video, StreamPos_Last, Video_Height, Height); if (Resolution>0) Fill(Stream_Video, StreamPos_Last, Video_BitDepth, (Resolution%3)?Resolution:(Resolution/3)); //If not a multiple of 3, the total resolution is filled if (Compression==CC4("DVR ")) IsDvrMs=true; //From Content description (we imagine that data is for all video streams...) if (Header_ExtendedContentDescription_AspectRatioX && Header_ExtendedContentDescription_AspectRatioY) { if (Header_ExtendedContentDescription_AspectRatioX==16 && Header_ExtendedContentDescription_AspectRatioY==9) Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, ((float32)16)/9, 3); else if (Header_ExtendedContentDescription_AspectRatioX==4 && Header_ExtendedContentDescription_AspectRatioY==3) Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, ((float32)4)/3, 3); else Fill(Stream_Video, StreamPos_Last, Video_PixelAspectRatio, ((float32)Header_ExtendedContentDescription_AspectRatioX)/Header_ExtendedContentDescription_AspectRatioY, 3, true); } //Creating the parser if (0); #if defined(MEDIAINFO_VC1_YES) else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_Format)==__T("VC-1")) { Stream[Stream_Number].Parser=new File_Vc1; if (Compression==CC4("WMV3")) { ((File_Vc1*)Stream[Stream_Number].Parser)->From_WMV3=true; ((File_Vc1*)Stream[Stream_Number].Parser)->MustSynchronize=false; } ((File_Vc1*)Stream[Stream_Number].Parser)->FrameIsAlwaysComplete=true; //Warning: this is not always the case, see data parsing Open_Buffer_Init(Stream[Stream_Number].Parser); if (Data_Size>40) { //Demux #if MEDIAINFO_DEMUX switch (Config->Demux_InitData_Get()) { case 0 : //In demux event Element_Code=Stream_Number; Demux_Level=2; //Container Demux(Buffer+(size_t)Element_Offset, (size_t)(Data_Size-40), ContentType_Header); break; case 1 : //In field { std::string Data_Raw((const char*)(Buffer+(size_t)Element_Offset), (size_t)(Data_Size-40)); std::string Data_Base64(Base64::encode(Data_Raw)); Fill(Stream_Video, StreamPos_Last, "Demux_InitBytes", Data_Base64); (*Stream_More)[Stream_Video][StreamPos_Last](Ztring().From_Local("Demux_InitBytes"), Info_Options)=__T("N NT"); } break; default : ; } #endif //MEDIAINFO_DEMUX Open_Buffer_Continue(Stream[Stream_Number].Parser, (size_t)(Data_Size-40)); if (Stream[Stream_Number].Parser->Status[IsFinished]) { Finish(Stream[Stream_Number].Parser); Merge(*Stream[Stream_Number].Parser, Stream_Video, 0, StreamPos_Last); delete Stream[Stream_Number].Parser; Stream[Stream_Number].Parser=NULL; } else { ((File_Vc1*)Stream[Stream_Number].Parser)->Only_0D=true; ((File_Vc1*)Stream[Stream_Number].Parser)->MustSynchronize=false; } } } #endif #if defined(MEDIAINFO_MPEGV_YES) else if (MediaInfoLib::Config.Codec_Get(Ztring().From_CC4(Compression), InfoCodec_KindofCodec).find(__T("MPEG-2"))==0) { Stream[Stream_Number].Parser=new File_Mpegv; ((File_Mpegv*)Stream[Stream_Number].Parser)->Frame_Count_Valid=30; //For searching Pulldown Open_Buffer_Init(Stream[Stream_Number].Parser); } #endif else if (Data_Size>40) //TODO: see "The Mummy_e" Skip_XX(Data_Size-40, "Codec Specific Data"); } //--------------------------------------------------------------------------- void File_Wm::Header_StreamProperties_JFIF () { Element_Name("JFIF"); //Parsing int32u Width, Height; Get_L4 (Width, "Width"); Get_L4 (Height, "Height"); Skip_L4( "Reserved"); //Filling Stream_Prepare(Stream_Image); Fill(Stream_Video, StreamPos_Last, Video_Format, "JPEG"); Fill(Stream_Video, StreamPos_Last, Video_Codec, "JPEG"); Fill(Stream_Video, StreamPos_Last, Video_Width, Width); Fill(Stream_Video, StreamPos_Last, Video_Height, Height); } //--------------------------------------------------------------------------- void File_Wm::Header_StreamProperties_DegradableJPEG () { Element_Name("Degradable JPEG"); int32u Width, Height; int16u InterchangeDataLength; Get_L4 (Width, "Width"); Get_L4 (Height, "Height"); Skip_L2( "Reserved"); Skip_L2( "Reserved"); Skip_L2( "Reserved"); Get_L2 (InterchangeDataLength, "Interchange data length"); if (InterchangeDataLength>0) Skip_XX(InterchangeDataLength, "Interchange data"); else Skip_L1( "Zero"); //Filling Stream_Prepare(Stream_Image); Fill(Stream_Video, StreamPos_Last, Video_Format, "JPEG"); Fill(Stream_Video, StreamPos_Last, Video_Codec, "JPEG"); Fill(Stream_Video, StreamPos_Last, Video_Width, Width); Fill(Stream_Video, StreamPos_Last, Video_Height, Height); } //--------------------------------------------------------------------------- void File_Wm::Header_StreamProperties_Binary () { Element_Name("Binary"); //Parsing int32u FormatDataLength; Skip_GUID( "Major media type"); Skip_GUID( "Media subtype"); Skip_L4( "Fixed-size samples"); Skip_L4( "Temporal compression"); Skip_L4( "Sample size"); Skip_GUID( "Format type"); Get_L4 (FormatDataLength, "Format data size"); if (FormatDataLength>0) Skip_XX(FormatDataLength, "Format data"); } //--------------------------------------------------------------------------- void File_Wm::Header_HeaderExtension() { Element_Name("Header Extension"); //Parsing int32u Size; Skip_GUID( "ClockType"); Skip_L2( "ClockSize"); Get_L4 (Size, "Extension Data Size"); } //--------------------------------------------------------------------------- void File_Wm::Header_HeaderExtension_ExtendedStreamProperties() { Element_Name("Extended Stream Properties"); //Parsing int64u AverageTimePerFrame; int32u DataBitrate, Flags; int16u StreamNumber, LanguageID, StreamNameCount, PayloadExtensionSystemCount; Info_L8(StartTime, "Start Time"); Param_Info_From_Milliseconds(StartTime); Info_L8(EndTime, "End Time"); Param_Info_From_Milliseconds(EndTime); Get_L4 (DataBitrate, "Data Bitrate"); Skip_L4( "Buffer Size"); Skip_L4( "Initial Buffer Fullness"); Skip_L4( "Alternate Data Bitrate"); Skip_L4( "Alternate Buffer Size"); Skip_L4( "Alternate Initial Buffer Fullness"); Skip_L4( "Maximum Object Size"); Get_L4 (Flags, "Flags"); Skip_Flags(Flags, 0, "Reliable"); Skip_Flags(Flags, 1, "Seekable"); Skip_Flags(Flags, 2, "No Cleanpoints"); Skip_Flags(Flags, 3, "Resend Live Cleanpoints"); Get_L2 (StreamNumber, "Stream Number"); Element_Info1(StreamNumber); Get_L2 (LanguageID, "Stream Language ID Index"); Get_L8 (AverageTimePerFrame, "Average Time Per Frame"); Get_L2 (StreamNameCount, "Stream Name Count"); Get_L2 (PayloadExtensionSystemCount, "Payload Extension System Count"); for (int16u Pos=0; Pos0) Skip_XX(ExtensionSystemInfoLength, "Extension System Info"); Element_End0(); //Filling Stream[StreamNumber].Payload_Extension_Systems.push_back(Payload_Extension_System); } //Header_StreamProperties if (Element_Offset=24 && Element_Offset+Size-24==Element_Size) { switch (Name.hi) { case Elements::Header_StreamProperties : Header_StreamProperties(); break; default : Skip_XX(Size-24, "Unknown"); } } else Skip_XX(Element_Size-Element_Offset, "Problem"); Element_End0(); } //Filling Stream[StreamNumber].LanguageID=LanguageID; Stream[StreamNumber].AverageBitRate=DataBitrate; Stream[StreamNumber].AverageTimePerFrame=AverageTimePerFrame; } //--------------------------------------------------------------------------- void File_Wm::Header_HeaderExtension_AdvancedMutualExclusion() { Element_Name("Advanced Mutual Exclusion"); //Parsing int16u Count; Info_GUID(ExclusionType, "Exclusion Type"); Param_Info1(Wm_ExclusionType(ExclusionType)); Get_L2 (Count, "Stream Numbers Count"); for (int16u Pos=0; Pos0) { Get_UTF16L(LanguageID_Length, LanguageID, "Language ID"); Element_Info1(LanguageID); } Element_End0(); //Filling Languages.push_back(LanguageID); } } //--------------------------------------------------------------------------- void File_Wm::Header_HeaderExtension_MetadataLibrary() { Element_Name("Metadata Library"); } //--------------------------------------------------------------------------- void File_Wm::Header_HeaderExtension_Metadata() { Element_Name("Metadata"); //Parsing float32 AspectRatioX=0, AspectRatioY=0; int16u Count; Get_L2 (Count, "Description Records Count"); for (int16u Pos=0; Pos0) Skip_UTF16L(Length*2, "Command Type"); Element_End0(); } for (int16u Pos=0; Pos0) Skip_UTF16L(Length*2, "Command"); Element_End0(); } } //--------------------------------------------------------------------------- void File_Wm::Header_Marker() { Element_Name("Markers"); //Parsing Skip_GUID( "Reserved"); int32u Markers_Count; int16u Name_Length; Get_L4 (Markers_Count, "Markers Count"); Skip_L2( "Reserved"); Get_L2 (Name_Length, "Name Length"); if (Name_Length>0) Skip_UTF16L(Name_Length, "Name"); //Filling if (Markers_Count>0) Stream_Prepare(Stream_Menu); //Parsing for (int32u Pos=0; Pos0) Get_UTF16L(Marker_Length*2, Marker, "Marker Description"); Element_End0(); } } //--------------------------------------------------------------------------- void File_Wm::Header_BitRateMutualExclusion() { Element_Name("BitRate Mutual Exclusion"); //Parsing int16u Count; Skip_GUID( "Exclusion Type"); Get_L2 (Count, "Stream Numbers Count"); for (int16u Pos=0; Pos0) Get_UTF16L(TitleLength, Title, "Title"); if (AuthorLength>0) Get_UTF16L(AuthorLength, Author, "Author"); if (CopyrightLength>0) Get_UTF16L(CopyrightLength, Copyright, "Copyright"); if (DescriptionLength>0) Get_UTF16L(DescriptionLength, Description, "Description"); if (RatingLength>0) Get_UTF16L(RatingLength, Rating, "Rating"); //Filling Fill(Stream_General, 0, General_Title, Title); Fill(Stream_General, 0, General_Performer, Author); Fill(Stream_General, 0, General_Copyright, Copyright); Fill(Stream_General, 0, General_Comment, Description); Fill(Stream_General, 0, General_Rating, Rating); } //--------------------------------------------------------------------------- void File_Wm::Header_ExtendedContentDescription() { Element_Name("Extended Content Description"); //Parsing int16u Count; Get_L2 (Count, "Content Descriptors Count"); for (int16u Pos=0; Pos0) Skip_XX(BannerImageData_Length, "Banner Image Data"); Get_L4 (BannerImageURL_Length, "Banner Image URL Length"); if (BannerImageURL_Length>0) Get_Local(BannerImageURL_Length, BannerImageURL, "Banner Image URL"); Get_L4 (CopyrightURL_Length, "Copyright URL Length"); if (CopyrightURL_Length>0) Get_Local(CopyrightURL_Length, CopyrightURL, "Copyright URL"); } //--------------------------------------------------------------------------- void File_Wm::Header_ContentEncryption() { Element_Name("Content Encryption"); //Parsing Ztring LicenseURL; int32u SecretDataLength, ProtectionTypeLength, KeyIDLength, LicenseURLLength; Get_L4 (SecretDataLength, "Secret Data Length"); Skip_XX(SecretDataLength, "Secret Data"); Get_L4 (ProtectionTypeLength, "Protection Type Length"); Skip_Local(ProtectionTypeLength, "Protection Type"); Get_L4 (KeyIDLength, "Key ID Length"); Skip_Local(KeyIDLength, "Key ID Type"); Get_L4 (LicenseURLLength, "License URL Length"); Get_Local(LicenseURLLength, LicenseURL, "License URL"); //Filling Fill(Stream_General, 0, "Encryption", LicenseURL); } //--------------------------------------------------------------------------- void File_Wm::Header_ExtendedContentEncryption() { Element_Name("Extended Content Encryption"); //Parsing int32u DataLength; Get_L4 (DataLength, "Data Length"); Skip_XX(DataLength, "Data"); } //--------------------------------------------------------------------------- void File_Wm::Header_DigitalSignature() { Element_Name("Digital Signature"); //Parsing int32u DataLength; Skip_L4( "Signature Type"); Get_L4 (DataLength, "Signature Data Length"); Skip_XX(DataLength, "Signature Data"); } //--------------------------------------------------------------------------- void File_Wm::Header_Padding() { Element_Name("Padding"); //Parsing Skip_XX(Element_Size, "Padding"); } //--------------------------------------------------------------------------- void File_Wm::Data() { Element_Name("Data"); //Parsing Skip_GUID( "File ID"); Skip_L8( "Total Data Packets"); Skip_L1( "Alignment"); Skip_L1( "Packet Alignment"); //Filling Fill(Stream_General, 0, General_HeaderSize, File_Offset+Buffer_Offset-24); Fill(Stream_General, 0, General_DataSize, Element_TotalSize_Get()+24); //For each stream Streams_Count=0; std::map::iterator Temp=Stream.begin(); while (Temp!=Stream.end()) { #if defined(MEDIAINFO_MPEGA_YES) if (IsDvrMs && !Temp->second.Parser && Temp->second.AverageBitRate>=32768) { Temp->second.Parser=new File_Mpega; //No stream properties, trying to detect it in datas... ((File_Mpega*)Temp->second.Parser)->Frame_Count_Valid=8; Open_Buffer_Init(Temp->second.Parser); } #endif if (Temp->second.Parser || Temp->second.StreamKind==Stream_Video) //We need Stream_Video for Frame_Rate computing { Temp->second.SearchingPayload=true; Streams_Count++; } ++Temp; } //Enabling the alternative parser MustUseAlternativeParser=true; Data_AfterTheDataChunk=File_Offset+Buffer_Offset+Element_TotalSize_Get(); } //--------------------------------------------------------------------------- void File_Wm::Data_Packet() { //Counting Packet_Count++; Element_Info1(Packet_Count); size_t Element_Show_Count=0; //Parsing int32u PacketLength=0, SizeOfMediaObject=0; int8u Flags, ErrorCorrectionData_Length, ErrorCorrectionLengthType, SequenceType, PaddingLengthType, PacketLengthType; bool ErrorCorrectionPresent; Element_Begin1("Error Correction"); Get_L1 (Flags, "Flags"); Get_FlagsM(Flags&0x0F, ErrorCorrectionData_Length, "Error Correction Data Length"); //4 lowest bits Skip_Flags(Flags, 4, "Opaque Data Present"); Get_FlagsM((Flags>>5)&0x03, ErrorCorrectionLengthType, "Error Correction Length Type"); //bits 6 and 7 Get_Flags (Flags, 7, ErrorCorrectionPresent, "Error Correction Present"); if (ErrorCorrectionPresent && ErrorCorrectionLengthType==0 && ErrorCorrectionData_Length==2) { int8u TypeNumber; Get_L1 (TypeNumber, "Type/Number"); Skip_FlagsM((TypeNumber>>4)&0x0F, "Type"); Skip_FlagsM( TypeNumber &0x0F, "Number"); Skip_L1( "Cycle"); } Element_End0(); Element_Begin1("Payload Parsing Information"); Get_L1 (Flags, "Length Type Flags"); Get_Flags (Flags, 0, MultiplePayloadsPresent, "Multiple Payloads Present"); Get_FlagsM((Flags>>1)&0x3, SequenceType, "Sequence Type"); Get_FlagsM((Flags>>3)&0x3, PaddingLengthType, "Padding Length Type"); Get_FlagsM((Flags>>5)&0x3, PacketLengthType, "Packet Length Type"); Skip_Flags(Flags, 7, "Error Correction Present"); Get_L1 (Flags, "Property Flags"); Get_FlagsM( Flags &0x3, ReplicatedDataLengthType, "Replicated Data Length Type"); Get_FlagsM((Flags>>2)&0x3, OffsetIntoMediaObjectLengthType, "Offset Into Media Object Length Type"); Get_FlagsM((Flags>>4)&0x3, MediaObjectNumberLengthType, "Media Object Number Length Type"); Get_FlagsM((Flags>>6)&0x3, StreamNumberLengthType, "Stream Number Length Type"); switch (PacketLengthType) { case 1 : {int8u Data; Get_L1(Data, "Packet Length"); PacketLength=Data;} break; case 2 : {int16u Data; Get_L2(Data, "Packet Length"); PacketLength=Data;} break; case 3 : Get_L4(PacketLength, "Packet Length"); break; default: ; } switch (SequenceType) { case 1 : Skip_L1( "Sequence"); break; case 2 : Skip_L2( "Sequence"); break; case 3 : Skip_L4( "Sequence"); break; default: ; } switch (PaddingLengthType) { case 1 : {int8u Data; Get_L1(Data, "Padding Length"); Data_Parse_Padding=Data;} break; case 2 : {int16u Data; Get_L2(Data, "Padding Length"); Data_Parse_Padding=Data;} break; case 3 : Get_L4(Data_Parse_Padding, "Padding Length"); break; default: Data_Parse_Padding=0; } Skip_L4( "Send Time"); Skip_L2( "Duration"); Element_End0(); if (MultiplePayloadsPresent) { //Parsing Element_Begin1("Multiple Payloads additional flags"); int8u AdditionalFlags; Get_L1 (AdditionalFlags, "Flags"); Get_FlagsM( AdditionalFlags &0x3F, NumberPayloads, "Number of Payloads"); //6 bits Get_FlagsM((AdditionalFlags>>6)&0x03, PayloadLengthType, "Payload Length Type"); //bits 6 and 7 Element_End0(); } else { SizeOfMediaObject=(int32u)(Element_Size-Element_Offset-Data_Parse_Padding); NumberPayloads=1; } for (NumberPayloads_Pos=0; NumberPayloads_Pos0) { if (ReplicatedDataLength>=8) { int32u PresentationTime; Get_L4 (SizeOfMediaObject, "Size Of Media Object"); Get_L4 (PresentationTime, "Presentation Time"); if (ReplicatedDataLength>8) Data_Packet_ReplicatedData(ReplicatedDataLength-8); //Presentation time delta std::map::iterator Strea=Stream.find(Stream_Number); if (Strea!=Stream.end() && Strea->second.StreamKind==Stream_Video) { if (Strea->second.PresentationTime_Old==0) Strea->second.PresentationTime_Old=FileProperties_Preroll; if (PresentationTime!=Strea->second.PresentationTime_Old) { Strea->second.PresentationTime_Deltas[PresentationTime-Strea->second.PresentationTime_Old]++; Strea->second.PresentationTime_Old=PresentationTime; Strea->second.PresentationTime_Count++; } } } else if (ReplicatedDataLength==1) { Skip_L1( "Presentation Time Delta"); //TODO } else { Skip_XX(ReplicatedDataLength, "Replicated Data"); } } if (MultiplePayloadsPresent) { switch (PayloadLengthType) { case 1 : {int8u Data; Get_L1(Data, "Payload Length"); PayloadLength=Data;} break; case 2 : {int16u Data; Get_L2(Data, "Payload Length"); PayloadLength=Data;} break; case 3 : Get_L4(PayloadLength, "Payload Length"); break; default: Trusted_IsNot("Payload Length"); return; //Problem } } else if (Element_Size-Element_Offset>Data_Parse_Padding) PayloadLength=(int32u)(Element_Size-(Element_Offset+Data_Parse_Padding)); else { Trusted_IsNot("Padding size problem"); return; //Problem } if (Element_Offset+PayloadLength+Data_Parse_Padding>Element_Size) { Trusted_IsNot("Payload Length problem"); return; //problem } //Demux Element_Code=Stream_Number; Demux(Buffer+(size_t)Element_Offset, (size_t)PayloadLength, ContentType_MainStream); //Analyzing if (Stream[Stream_Number].Parser && Stream[Stream_Number].SearchingPayload) { //Handling of spanned on multiple chunks #if defined(MEDIAINFO_VC1_YES) bool FrameIsAlwaysComplete=true; #endif if (PayloadLength!=SizeOfMediaObject) { if (SizeOfMediaObject_BytesAlreadyParsed==0) SizeOfMediaObject_BytesAlreadyParsed=SizeOfMediaObject-PayloadLength; else SizeOfMediaObject_BytesAlreadyParsed-=PayloadLength; if (SizeOfMediaObject_BytesAlreadyParsed==0) Element_Show_Count++; #if defined(MEDIAINFO_VC1_YES) else FrameIsAlwaysComplete=false; #endif } else Element_Show_Count++; //Codec specific #if defined(MEDIAINFO_VC1_YES) if (Retrieve(Stream[Stream_Number].StreamKind, Stream[Stream_Number].StreamPos, Fill_Parameter(Stream[Stream_Number].StreamKind, Generic_Format))==__T("VC-1")) ((File_Vc1*)Stream[Stream_Number].Parser)->FrameIsAlwaysComplete=FrameIsAlwaysComplete; #endif Open_Buffer_Continue(Stream[Stream_Number].Parser, (size_t)PayloadLength); if (Stream[Stream_Number].Parser->Status[IsFinished] || (Stream[Stream_Number].PresentationTime_Count>=300 && MediaInfoLib::Config.ParseSpeed_Get()<1)) { Stream[Stream_Number].Parser->Open_Buffer_Unsynch(); Stream[Stream_Number].SearchingPayload=false; Streams_Count--; } Element_Show(); } else { Skip_XX(PayloadLength, "Data"); if (Stream[Stream_Number].SearchingPayload && (Stream[Stream_Number].StreamKind==Stream_Video && Stream[Stream_Number].PresentationTime_Count>=300)) { Stream[Stream_Number].SearchingPayload=false; Streams_Count--; } } Element_End0(); } if (Data_Parse_Padding) Skip_XX(Data_Parse_Padding, "Padding"); //Jumping if needed if (Streams_Count==0 || (Packet_Count>=1000 && MediaInfoLib::Config.ParseSpeed_Get()<1)) { Info("Data, Jumping to end of chunk"); GoTo(Data_AfterTheDataChunk, "Windows Media"); } if (Element_Show_Count>0) Element_Show(); } //--------------------------------------------------------------------------- void File_Wm::Data_Packet_ReplicatedData(int32u Size) { Element_Begin1("Replicated Data"); int64u Element_Offset_Final=Element_Offset+Size; for (size_t Pos=0; PosFirstChildElement("CreationDate"); if (Element) Fill(Stream_General, 0, General_Recorded_Date, Element->Attribute("value")); //LastUpdate Element=Root->FirstChildElement("LastUpdate"); if (Element) Fill(Stream_General, 0, General_Tagged_Date, Element->Attribute("value")); //Duration Ztring Duration, EditUnit; Element=Root->FirstChildElement("Duration"); if (Element) Duration=Element->Attribute("value"); Element=Root->FirstChildElement("LtcChangeTable"); if (Element) EditUnit=Element->Attribute("tcFps"); int64u Duration_Frames=Duration.To_int64u(); int64u EditUnit_Denominator=EditUnit.To_int64u(); if (Duration_Frames && EditUnit_Denominator) Fill(Stream_General, 0, General_Duration, ((float32)Duration_Frames)*1000/EditUnit_Denominator, 0); int64u File_Size_Total=File_Size; #if defined(MEDIAINFO_MXF_YES) if (File_Name.size()>12 && File_Name[File_Name.size()-7]==__T('M') && File_Name[File_Name.size()-6]==__T('0') && File_Name[File_Name.size()-5]==__T('1') && File_Name[File_Name.size()-4]==__T('.') && File_Name[File_Name.size()-3]==__T('X') && File_Name[File_Name.size()-2]==__T('M') && File_Name[File_Name.size()-1]==__T('L')) { Ztring file=File_Name.substr(File_Name.size()-12, 5); Ztring MXF_File=File_Name; MXF_File.resize(MXF_File.size()-12); MXF_File+=file; if (File::Exists(MXF_File+__T(".MXF"))) MXF_File+=__T(".MXF"); if (File::Exists(MXF_File+__T(".MP4"))) MXF_File+=__T(".MP4"); //int8u ReadByHuman=Ztring(MediaInfo::Option_Static(__T("ReadByHuman_Get"))).To_int8u(); //MediaInfo::Option_Static(__T("ReadByHuman"), __T("0")); MediaInfo_Internal MI; if (MI.Open(MXF_File)) { //MediaInfo::Option_Static(__T("ReadByHuman"), ReadByHuman?__T("1"):__T("0")); Merge(MI); Fill(Stream_Video, StreamPos_Last, "Source", MXF_File); File_Size_Total+=Ztring(MI.Get(Stream_General, 0, General_FileSize)).To_int64u(); //Commercial names Fill(Stream_General, 0, General_Format_Commercial_IfAny, MI.Get(Stream_General, 0, General_Format_Commercial_IfAny)); Ztring Format_Commercial=MI.Get(Stream_General, 0, General_Format_Commercial_IfAny); if (!Format_Commercial.empty()) { Format_Commercial.FindAndReplace(__T("XDCAM "), Ztring()); Fill(Stream_General, 0, General_Format_Commercial, __T("XDCAM Clip ")+Format_Commercial, true); } } //else // MediaInfo::Option_Static(__T("ReadByHuman"), ReadByHuman?__T("1"):__T("0")); } #endif //defined(MEDIAINFO_MXF_YES) //Device Element=Root->FirstChildElement("Device"); if (Element) Fill(Stream_General, 0, General_Encoded_Application, string(Element->Attribute("manufacturer"))+" "+Element->Attribute("modelName"), true, true); if (File_Size_Total!=File_Size) Fill(Stream_General, 0, General_FileSize, File_Size_Total, 10, true); } else { Reject("Xdcam_Clip"); return false; } } Element_Offset=File_Size; //All should be OK... return true; } } //NameSpace #endif //MEDIAINFO_XDCAM_YES MediaInfoLib/Source/MediaInfo/Multiple/File_Xdcam_Clip.h100777 0 0 2310 12226004262 16450 0/* 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 XDCAM Clip Movie files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_Xdcam_ClipH #define MediaInfo_File_Xdcam_ClipH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Xdcam_Clip //*************************************************************************** class File_Xdcam_Clip : public File__Analyze { private : //Buffer - File header bool FileHeader_Begin(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Multiple/File__ReferenceFilesHelper.cpp100777 0 0 234422 12262743712 21245 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_REFERENCES_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File__ReferenceFilesHelper.h" #include "MediaInfo/MediaInfo_Internal.h" #include "ZenLib/Dir.h" #include "ZenLib/File.h" #include "ZenLib/FileName.h" #include "ZenLib/Format/Http/Http_Utils.h" #include #include #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events_Internal.h" #endif //MEDIAINFO_EVENTS //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File__ReferenceFilesHelper::File__ReferenceFilesHelper(File__Analyze* MI_, MediaInfo_Config_MediaInfo* Config_) { //Temp MI=MI_; Config=Config_; Reference=References.end(); Init_Done=false; TestContinuousFileNames=false; FilesForStorage=false; ContainerHasNoId=false; HasMainFile=false; HasMainFile_Filled=false; ID_Max=0; FrameRate=0; Duration=0; #if MEDIAINFO_NEXTPACKET DTS_Interval=(int64u)-1; #endif //MEDIAINFO_NEXTPACKET #if MEDIAINFO_EVENTS StreamID_Previous=(int64u)-1; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Offset_Video_DTS=0; #endif //MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- File__ReferenceFilesHelper::~File__ReferenceFilesHelper() { for (references::iterator ReferenceTemp=References.begin(); ReferenceTemp!=References.end(); ++ReferenceTemp) delete ReferenceTemp->MI; //ReferenceTemp->MI=NULL; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- bool File__ReferenceFilesHelper_Algo1 (const File__ReferenceFilesHelper::reference &Ref1, const File__ReferenceFilesHelper::reference &Ref2) { return (Ref1.StreamID Iterators; for (File__ReferenceFilesHelper::references::iterator Reference=References.begin(); Reference4 && Name.rfind(__T('.'))==Name.size()) Name.resize(Name.size()-4); List2.Write(Name); for (size_t Pos=0; Pos=List[Pos].size()) break; //Maybe begin of title const Ztring &Test=List[Pos][List[Pos].size()-1-Pos2]; //ChannelLayout if (Test!=__T("l") && Test!=__T("r") && Test!=__T("c") && Test!=__T("lfe") && Test!=__T("sub") && Test!=__T("ls") && Test!=__T("rs") && Test!=__T("b")) IsChannelLayout=false; //Language if (Test!=__T("deu") && Test!=__T("eng") && Test!=__T("fra") && Test!=__T("fre") && Test!=__T("ita") && Test!=__T("spa")) IsLanguage=false; } if (IsChannelLayout) ChannelLayout_Pos=Pos2; if (IsLanguage) Language_Pos=Pos2; } //ChannelLayout if (ChannelLayout_Pos!=(size_t)-1) for (size_t Pos=0; PosConfig->File_Filter_Audio_Get()) for (size_t Pos=0; Pos StreamList; bool StreamList_DuplicatedIds=false; for (Reference=References.begin(); ReferenceStreamID==(int64u)-1) ContainerHasNoId=true; std::sort(References.begin(), References.end(), File__ReferenceFilesHelper_Algo1); std::sort(References.begin(), References.end(), File__ReferenceFilesHelper_Algo2); std::sort(References.begin(), References.end(), File__ReferenceFilesHelper_Algo3); //InfoFromFileName File__ReferenceFilesHelper_InfoFromFileName(References); //Configuring file names Reference=References.begin(); while (Reference!=References.end()) { ZtringList Names=Reference->FileNames; ZtringList AbsoluteNames; AbsoluteNames.Separator_Set(0, ","); for (size_t Pos=0; PosFile_Name.find(__T("://"))==string::npos) AbsoluteName=ZenLib::FileName::Path_Get(MI->File_Name); else { size_t Pos_Path=MI->File_Name.find_last_of('/'); if (Pos_Path!=Ztring::npos) AbsoluteName=MI->File_Name.substr(0, Pos_Path); } if (!AbsoluteName.empty()) AbsoluteName+=ZenLib::PathSeparator; } AbsoluteName+=Names[Pos]; #ifdef __WINDOWS__ if (AbsoluteName.find(__T("://"))==string::npos) AbsoluteName.FindAndReplace(__T("/"), __T("\\"), 0, Ztring_Recursive); //Names[Pos] normalization local file else AbsoluteName.FindAndReplace(__T("\\"), __T("/"), 0, Ztring_Recursive); //Names[Pos] normalization with protocol (so "/" in all cases) #endif //__WINDOWS__ AbsoluteNames.push_back(AbsoluteName); } if (AbsoluteNames.empty() || !(AbsoluteNames[0].find(__T("://"))!=string::npos || File::Exists(AbsoluteNames[0]))) { AbsoluteNames.clear(); //Configuring file name (this time, we try to force URL decode in all cases) for (size_t Pos=0; PosFile_Name.find(__T("://"))==string::npos) AbsoluteName=ZenLib::FileName::Path_Get(MI->File_Name); else { size_t Pos_Path=MI->File_Name.find_last_of('/'); if (Pos_Path!=Ztring::npos) AbsoluteName=MI->File_Name.substr(0, Pos_Path); } if (!AbsoluteName.empty()) AbsoluteName+=ZenLib::PathSeparator; } AbsoluteName+=Names[Pos]; #ifdef __WINDOWS__ AbsoluteName.FindAndReplace(__T("/"), __T("\\"), 0, Ztring_Recursive); //Names[Pos] normalization #endif //__WINDOWS__ AbsoluteNames.push_back(AbsoluteName); } if (AbsoluteNames.empty() || !File::Exists(AbsoluteNames[0])) { AbsoluteNames.clear(); Names=Reference->FileNames; //Configuring file name (this time, we try to test local files) size_t PathSeparator_Pos=Names.empty()?string::npos:Names[0].find_last_of(__T("\\/")); if (PathSeparator_Pos!=string::npos && PathSeparator_Pos) { Ztring PathToRemove=Names[0].substr(0, PathSeparator_Pos); bool IsOk=true; for (size_t Pos=0; PosFile_Name.find(__T("://"))==string::npos) AbsoluteName=ZenLib::FileName::Path_Get(MI->File_Name); else { size_t Pos_Path=MI->File_Name.find_last_of('/'); if (Pos_Path!=Ztring::npos) AbsoluteName=MI->File_Name.substr(0, Pos_Path); } if (!AbsoluteName.empty()) AbsoluteName+=ZenLib::PathSeparator; AbsoluteName+=Names[Pos]; #ifdef __WINDOWS__ if (AbsoluteName.find(__T("://"))==string::npos) AbsoluteName.FindAndReplace(__T("/"), __T("\\"), 0, Ztring_Recursive); //Names[Pos] normalization local file else AbsoluteName.FindAndReplace(__T("\\"), __T("/"), 0, Ztring_Recursive); //Names[Pos] normalization with protocol (so "/" in all cases) #endif //__WINDOWS__ AbsoluteNames.push_back(AbsoluteName); } if (!File::Exists(AbsoluteNames[0])) { AbsoluteNames.clear(); Names=Reference->FileNames; //Configuring file name (this time, we try to test local files) size_t PathSeparator_Pos=Names[0].find_last_of(__T("\\/")); if (PathSeparator_Pos!=string::npos && PathSeparator_Pos) PathSeparator_Pos=Names[0].find_last_of(__T("\\/"), PathSeparator_Pos-1); if (PathSeparator_Pos!=string::npos && PathSeparator_Pos) { Ztring PathToRemove=Names[0].substr(0, PathSeparator_Pos); bool IsOk=true; for (size_t Pos=0; PosFile_Name.find(__T("://"))==string::npos) AbsoluteName=ZenLib::FileName::Path_Get(MI->File_Name); else { size_t Pos_Path=MI->File_Name.find_last_of('/'); if (Pos_Path!=Ztring::npos) AbsoluteName=MI->File_Name.substr(0, Pos_Path); } if (!AbsoluteName.empty()) AbsoluteName+=ZenLib::PathSeparator; AbsoluteName+=Names[Pos]; #ifdef __WINDOWS__ AbsoluteName.FindAndReplace(__T("/"), __T("\\"), 0, Ztring_Recursive); //Names[Pos] normalization #endif //__WINDOWS__ AbsoluteNames.push_back(AbsoluteName); } } if (!AbsoluteNames.empty() && !File::Exists(AbsoluteNames[0])) AbsoluteNames.clear(); } } } } } Reference->Source=Reference->FileNames.Read(0); if (Reference->StreamKind!=Stream_Max) { if (Reference->StreamPos==(size_t)-1) Reference->StreamPos=Stream_Prepare(Reference->StreamKind); MI->Fill(Reference->StreamKind, Reference->StreamPos, "Source", Reference->Source); } if (!AbsoluteNames.empty()) Reference->FileNames=AbsoluteNames; if (!AbsoluteNames.empty() && AbsoluteNames[0]==MI->File_Name) { Reference->IsCircular=true; Reference->FileNames.clear(); Reference->Status.set(File__Analyze::IsFinished); } else if (!AbsoluteNames.empty()) Reference->FileNames=AbsoluteNames; else { Reference->FileNames.clear(); Reference->Status.set(File__Analyze::IsFinished); if (Reference->StreamKind!=Stream_Max) { MI->Fill(Reference->StreamKind, Reference->StreamPos, "Source_Info", "Missing"); if (MI->Retrieve(Reference->StreamKind, Reference->StreamPos, General_ID).empty()) MI->Fill(Reference->StreamKind, Reference->StreamPos, General_ID, Reference->StreamID); for (std::map::iterator Info=Reference->Infos.begin(); Info!=Reference->Infos.end(); ++Info) { if (Info->first=="CodecID") MI->CodecID_Fill(Info->second, Reference->StreamKind, Reference->StreamPos, InfoCodecID_Format_Mpeg4); else MI->Fill(Reference->StreamKind, Reference->StreamPos, Info->first.c_str(), Info->second); } } } if (FilesForStorage && Reference->FileNames.size()>1) { for (size_t Pos=0; PosFileNames.size(); Pos++) { reference::completeduration* Temp=new reference::completeduration; Temp->FileName=Reference->FileNames[Pos]; Reference->CompleteDuration.push_back(Temp); } Reference->FileNames.resize(1); } ++Reference; } #if MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET if (Config->NextPacket_Get()) { Demux_Interleave=Config->File_Demux_Interleave_Get(); if (Demux_Interleave) { CountOfReferencesToParse=References.size(); for (references::iterator ReferenceSource=References.begin(); ReferenceSource!=References.end(); ++ReferenceSource) if (ReferenceSource->FileNames.empty()) CountOfReferencesToParse--; DTS_Interval=3000000000; // 3 seconds } } else Demux_Interleave=false; //Using the frame rate from the first stream having a frame rate if (!FrameRate) for (references::iterator ReferenceFrameRate=References.begin(); ReferenceFrameRate!=References.end(); ++ReferenceFrameRate) if (ReferenceFrameRate->FrameRate) { FrameRate=ReferenceFrameRate->FrameRate; break; } if (Config->NextPacket_Get()) { Reference=References.begin(); while (Reference!=References.end()) { ParseReference(); //Init Reference++; } //Cleanup for (size_t Pos=0; PosConfig->File_Size!=MI->File_Size) { MI->Fill(Stream_General, 0, General_FileSize, MI->Config->File_Size, 10, true); MI->Fill(Stream_General, 0, General_StreamSize, MI->File_Size, 10, true); } } #endif //MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET FileSize_Compute(); Reference=References.begin(); Init_Done=true; #if MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET if (Config->NextPacket_Get() && MI->Demux_EventWasSent_Accept_Specific) { MI->Config->Demux_EventWasSent=true; return; } #endif //MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET } while (Reference!=References.end()) { #if MEDIAINFO_NEXTPACKET if (!Reference->Status[File__Analyze::IsFinished]) #endif //MEDIAINFO_NEXTPACKET ParseReference(); //State int64u FileSize_Parsed=0; #if MEDIAINFO_NEXTPACKET DTS_Minimal=(int64u)-1; #endif //MEDIAINFO_NEXTPACKET for (references::iterator ReferenceTemp=References.begin(); ReferenceTemp!=References.end(); ++ReferenceTemp) { if (ReferenceTemp->MI) { if (ReferenceTemp->State<10000) { if (ReferenceTemp->MI) ReferenceTemp->State=ReferenceTemp->MI->State_Get(); if (ReferenceTemp->State && ReferenceTemp->MI->Config.File_Size!=(int64u)-1) FileSize_Parsed+=(int64u)(ReferenceTemp->MI->Config.File_Size*(((float)ReferenceTemp->State)/10000)); } else FileSize_Parsed+=ReferenceTemp->MI->Config.File_Size; #if MEDIAINFO_NEXTPACKET //Minimal DTS if (DTS_Interval!=(int64u)-1 && !Reference->Status[File__Analyze::IsFinished] && ReferenceTemp->CompleteDuration_PosCompleteDuration.size()) { int64u DTS_Temp; if (ReferenceTemp->CompleteDuration_Pos) DTS_Temp=ReferenceTemp->CompleteDuration[ReferenceTemp->CompleteDuration_Pos]->MI->Info->FrameInfo.DTS; else DTS_Temp=ReferenceTemp->MI->Info->FrameInfo.DTS; if (DTS_Minimal>DTS_Temp) DTS_Minimal=DTS_Temp; } #endif //MEDIAINFO_NEXTPACKET } else FileSize_Parsed+=ReferenceTemp->FileSize; } Config->State_Set(((float)FileSize_Parsed)/MI->Config->File_Size); #if MEDIAINFO_EVENTS struct MediaInfo_Event_General_SubFile_End_0 Event; MI->Event_Prepare((struct MediaInfo_Event_Generic*)&Event); Event.EventCode=MediaInfo_EventCode_Create(0, MediaInfo_Event_General_SubFile_End, 0); Event.EventSize=sizeof(struct MediaInfo_Event_General_SubFile_End_0); MI->Config->Event_Send(NULL, (const int8u*)&Event, Event.EventSize, MI->File_Name); #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET if (Demux_Interleave) { references::iterator Reference_Next=Reference; ++Reference_Next; if (Reference_Next==References.end() && Config->NextPacket_Get() && CountOfReferencesToParse) Reference=References.begin(); else Reference=Reference_Next; if (Config->Demux_EventWasSent) return; } else { if (Config->Demux_EventWasSent) return; Reference++; } #else //MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET ++Reference; #endif //MEDIAINFO_DEMUX } //File size handling FileSize_Compute(); if (MI->Config->File_Size!=MI->File_Size #if MEDIAINFO_ADVANCED && !Config->File_IgnoreSequenceFileSize_Get() #endif //MEDIAINFO_ADVANCED ) { MI->Fill(Stream_General, 0, General_FileSize, MI->Config->File_Size, 10, true); MI->Fill(Stream_General, 0, General_StreamSize, MI->File_Size, 10, true); } } //--------------------------------------------------------------------------- bool File__ReferenceFilesHelper::ParseReference_Init() { //Configuration Reference->MI=MI_Create(); if (Config->ParseSpeed>=1) { for (size_t Pos=0; PosCompleteDuration.size(); Pos++) { MediaInfo_Internal MI2; MI2.Option(__T("File_KeepInfo"), __T("1")); Ztring ParseSpeed_Save=MI2.Option(__T("ParseSpeed_Get"), __T("0")); Ztring Demux_Save=MI2.Option(__T("Demux_Get"), __T("")); MI2.Option(__T("ParseSpeed"), __T("0")); MI2.Option(__T("Demux"), Ztring()); size_t MiOpenResult=MI2.Open(Reference->CompleteDuration[Pos]->FileName); MI2.Option(__T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value MI2.Option(__T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value if (MiOpenResult) { #if MEDIAINFO_DEMUX int64u Duration=MI2.Get(Reference->StreamKind, 0, __T("Duration")).To_int64u()*1000000; int64u FrameCount=MI2.Get(Reference->StreamKind, 0, __T("FrameCount")).To_int64u(); if (Pos==0) { int64u Delay=MI2.Get(Stream_Video, 0, Video_Delay).To_int64u()*1000000; if (Reference->StreamKind==Stream_Video && Offset_Video_DTS==0) Offset_Video_DTS=Delay; Reference->CompleteDuration[0]->Demux_Offset_DTS=Offset_Video_DTS; Reference->CompleteDuration[0]->Demux_Offset_Frame=0; } if (Pos+1CompleteDuration.size()) { Reference->CompleteDuration[Pos+1]->Demux_Offset_DTS=Reference->CompleteDuration[Pos]->Demux_Offset_DTS+Duration; Reference->CompleteDuration[Pos+1]->Demux_Offset_Frame=Reference->CompleteDuration[Pos]->Demux_Offset_Frame+FrameCount; } else Duration=Reference->CompleteDuration[Pos]->Demux_Offset_DTS+Duration-Reference->CompleteDuration[0]->Demux_Offset_DTS; #endif //MEDIAINFO_DEMUX } if (Pos) { Reference->CompleteDuration[Pos]->MI=MI_Create(); #if MEDIAINFO_DEMUX Reference->CompleteDuration[Pos]->MI->Config.Demux_Offset_Frame=Reference->CompleteDuration[Pos]->Demux_Offset_Frame; Reference->CompleteDuration[Pos]->MI->Config.Demux_Offset_DTS=Reference->CompleteDuration[Pos]->Demux_Offset_DTS; #endif //MEDIAINFO_DEMUX } } #if MEDIAINFO_DEMUX if (!Reference->CompleteDuration.empty()) { Reference->MI->Config.Demux_Offset_Frame=Reference->CompleteDuration[0]->Demux_Offset_Frame; Reference->MI->Config.Demux_Offset_DTS=Reference->CompleteDuration[0]->Demux_Offset_DTS; } #endif //MEDIAINFO_DEMUX } if (Reference->IsCircular) { MI->Fill(Reference->StreamKind, Reference->StreamPos, "Source_Info", "Circular"); if (!Config->File_KeepInfo_Get()) { #if MEDIAINFO_DEMUX if (CountOfReferencesToParse) CountOfReferencesToParse--; #endif //MEDIAINFO_DEMUX Reference->StreamKind=Stream_Max; Reference->StreamPos=(size_t)-1; Reference->FileSize=Reference->MI->Config.File_Size; delete Reference->MI; Reference->MI=NULL; } Reference->FileNames.clear(); Reference->Status.set(File__Analyze::IsFinished); } else { //Run #if MEDIAINFO_EVENTS SubFile_Start(); #endif //MEDIAINFO_EVENTS if (!Reference->MI->Open(Reference->FileNames.Read())) { MI->Fill(Reference->StreamKind, Reference->StreamPos, "Source_Info", "Missing"); if (!Config->File_KeepInfo_Get()) { #if MEDIAINFO_DEMUX if (CountOfReferencesToParse) CountOfReferencesToParse--; #endif //MEDIAINFO_DEMUX Reference->StreamKind=Stream_Max; Reference->StreamPos=(size_t)-1; Reference->FileSize=Reference->MI->Config.File_Size; delete Reference->MI; Reference->MI=NULL; } Reference->FileNames.clear(); Reference->Status.set(File__Analyze::IsFinished); } if (Config->ParseSpeed>=1) for (size_t Pos=1; PosCompleteDuration.size(); Pos++) Reference->CompleteDuration[Pos]->MI->Open(Reference->CompleteDuration[Pos]->FileName); #if MEDIAINFO_NEXTPACKET && MEDIAINFO_DEMUX if (Config->NextPacket_Get()) return false; #endif //MEDIAINFO_NEXTPACKET } return true; } //--------------------------------------------------------------------------- void File__ReferenceFilesHelper::ParseReference() { if (Reference->MI==NULL && !Reference->FileNames.empty()) { if (!ParseReference_Init()) return; } if (Reference->MI) { #if MEDIAINFO_EVENTS && MEDIAINFO_NEXTPACKET if (DTS_Interval!=(int64u)-1 && !Reference->Status[File__Analyze::IsFinished] && Reference->MI->Info->FrameInfo.DTS!=(int64u)-1 && DTS_Minimal!=(int64u)-1 && Reference->CompleteDuration_PosCompleteDuration.size()) { int64u DTS_Temp; if (Reference->CompleteDuration_Pos) DTS_Temp=Reference->CompleteDuration[Reference->CompleteDuration_Pos]->MI->Info->FrameInfo.DTS; else DTS_Temp=Reference->MI->Info->FrameInfo.DTS; if (DTS_Temp>DTS_Minimal+DTS_Interval) return; } if (Config->Event_CallBackFunction_IsSet() && !Reference->Status[File__Analyze::IsFinished]) { #if MEDIAINFO_DEMUX SubFile_Start(); if (Reference->CompleteDuration_Pos==0) { while ((Reference->Status=Reference->MI->Open_NextPacket())[8]) { if (Config->Event_CallBackFunction_IsSet()) { Config->Demux_EventWasSent=true; return; } } Reference->CompleteDuration_Pos++; } #if MEDIAINFO_NEXTPACKET && MEDIAINFO_DEMUX if (Config->ParseSpeed<1.0) Reference->CompleteDuration_Pos=Reference->CompleteDuration.size(); //No need to parse all files #endif //MEDIAINFO_NEXTPACKET while (Reference->CompleteDuration_PosCompleteDuration.size()) { while ((Reference->Status=Reference->CompleteDuration[Reference->CompleteDuration_Pos]->MI->Open_NextPacket())[8]) { if (Config->Event_CallBackFunction_IsSet()) { Config->Demux_EventWasSent=true; return; } } Reference->CompleteDuration_Pos++; } if (CountOfReferencesToParse) CountOfReferencesToParse--; #endif //MEDIAINFO_DEMUX } #endif //MEDIAINFO_EVENTS && MEDIAINFO_NEXTPACKET ParseReference_Finalize(); if (!Config->File_KeepInfo_Get()) { Reference->StreamKind=Stream_Max; Reference->StreamPos=(size_t)-1; Reference->State=10000; if (Reference->CompleteDuration.empty()) Reference->FileSize=Reference->MI->Config.File_Size; else { Reference->FileSize=0; for (size_t Pos=0; PosCompleteDuration.size(); Pos++) Reference->FileSize+=File::Size_Get(Reference->CompleteDuration[Pos]->FileName); } delete Reference->MI; Reference->MI=NULL; } } } //--------------------------------------------------------------------------- void File__ReferenceFilesHelper::ParseReference_Finalize () { //Removing wrong initial value if (Reference->MI->Count_Get(Reference->StreamKind)==0 && Reference->StreamPos!=(size_t)-1 && Reference->MI->Count_Get(Stream_Video)+Reference->MI->Count_Get(Stream_Audio)+Reference->MI->Count_Get(Stream_Image)+Reference->MI->Count_Get(Stream_Text)+Reference->MI->Count_Get(Stream_Other)) { MI->Stream_Erase(Reference->StreamKind, Reference->StreamPos); for (references::iterator ReferenceTemp=References.begin(); ReferenceTemp!=References.end(); ++ReferenceTemp) if (ReferenceTemp->StreamKind==Reference->StreamKind && ReferenceTemp->StreamPos!=(size_t)-1 && ReferenceTemp->StreamPos>Reference->StreamPos) ReferenceTemp->StreamPos--; Reference->StreamPos=(size_t)-1; } bool StreamFound=false; for (size_t StreamKind=Stream_General+1; StreamKindMI->Count_Get((stream_t)StreamKind); StreamPos++) { StreamKind_Last=(stream_t)StreamKind; if (Reference->StreamPos!=(size_t)-1 && StreamKind_Last==Reference->StreamKind && StreamPos==0) { StreamPos_To=Reference->StreamPos; StreamFound=true; } else { size_t ToInsert=(size_t)-1; for (references::iterator ReferencePos=References.begin(); ReferencePos!=References.end(); ++ReferencePos) if (ReferencePos->StreamKind==StreamKind_Last && Reference->StreamIDStreamID) { ToInsert=ReferencePos->StreamPos; break; } StreamPos_To=Stream_Prepare((stream_t)StreamKind, ToInsert); } StreamPos_From=StreamPos; ParseReference_Finalize_PerStream(); } if (!StreamFound && Reference->StreamKind!=Stream_Max && Reference->StreamPos!=(size_t)-1) { Ztring MuxingMode=MI->Retrieve(Reference->StreamKind, Reference->StreamPos, "MuxingMode"); if (!MuxingMode.empty()) MuxingMode.insert(0, __T(" / ")); MI->Fill(Reference->StreamKind, Reference->StreamPos, "MuxingMode", Reference->MI->Info->Get(Stream_General, 0, General_Format)+MuxingMode, true); } } //--------------------------------------------------------------------------- void File__ReferenceFilesHelper::ParseReference_Finalize_PerStream () { //Hacks - Before Ztring CodecID=MI->Retrieve(StreamKind_Last, StreamPos_To, MI->Fill_Parameter(StreamKind_Last, Generic_CodecID)); Ztring ID_Base; if (HasMainFile_Filled && !Reference->IsMain) { ID_Base=Ztring::ToZtring(ID_Max+Reference->StreamID-1); MI->Fill(StreamKind_Last, StreamPos_To, "SideCar_FilePos", Reference->StreamID-1); (*MI->Stream_More)[StreamKind_Last][StreamPos_To](Ztring().From_Local("SideCar_FilePos"), Info_Options)=__T("N NT"); } else if (Reference->StreamID!=(int64u)-1) ID_Base=Ztring::ToZtring(Reference->StreamID); Ztring ID=ID_Base; Ztring ID_String=ID_Base; Ztring MenuID; Ztring MenuID_String; if (!HasMainFile_Filled && Reference->IsMain) { MI->Fill(Stream_General, 0, General_Format, Reference->MI->Get(Stream_General, 0, General_Format) , true); MI->Fill(Stream_General, 0, General_CompleteName, Reference->MI->Get(Stream_General, 0, General_CompleteName) , true); MI->Fill(Stream_General, 0, General_FileExtension, Reference->MI->Get(Stream_General, 0, General_FileExtension) , true); HasMainFile=true; HasMainFile_Filled=true; } if (Reference->IsMain) { int64u ID_New=Reference->MI->Get(StreamKind_Last, StreamPos_From, General_ID).To_int64u(); if (ID_MaxClear(StreamKind_Last, StreamPos_To, General_ID); MI->Merge(*Reference->MI->Info, StreamKind_Last, StreamPos_From, StreamPos_To); if (!Reference->CompleteDuration.empty()) { MI->Clear(StreamKind_Last, StreamPos_To, MI->Fill_Parameter(StreamKind_Last, Generic_BitRate)); MI->Clear(StreamKind_Last, StreamPos_To, MI->Fill_Parameter(StreamKind_Last, Generic_Duration)); MI->Clear(StreamKind_Last, StreamPos_To, MI->Fill_Parameter(StreamKind_Last, Generic_FrameCount)); MI->Clear(StreamKind_Last, StreamPos_To, MI->Fill_Parameter(StreamKind_Last, Generic_StreamSize)); int64u Duration_Temp=0; int64u FrameCount_Temp=0; int64u StreamSize_Temp=0; for (size_t Pos=0; PosCompleteDuration.size(); Pos++) { MediaInfo_Internal MI2; MI2.Option(__T("File_KeepInfo"), __T("1")); Ztring ParseSpeed_Save=MI2.Option(__T("ParseSpeed_Get"), __T("")); Ztring Demux_Save=MI2.Option(__T("Demux_Get"), __T("")); MI2.Option(__T("ParseSpeed"), __T("0")); MI2.Option(__T("Demux"), Ztring()); size_t MiOpenResult=MI2.Open(Reference->CompleteDuration[Pos]->FileName); MI2.Option(__T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value MI2.Option(__T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value if (MiOpenResult) { Ztring Duration_Temp2=MI2.Get(StreamKind_Last, StreamPos_From, MI->Fill_Parameter(StreamKind_Last, Generic_Duration)); if (!Duration_Temp2.empty()) Duration_Temp+=Duration_Temp2.To_int64u(); else Duration_Temp=(int64u)-1; Ztring FrameCount_Temp2=MI2.Get(StreamKind_Last, StreamPos_From, MI->Fill_Parameter(StreamKind_Last, Generic_FrameCount)); if (!FrameCount_Temp2.empty()) FrameCount_Temp+=FrameCount_Temp2.To_int64u(); else FrameCount_Temp=(int64u)-1; Ztring StreamSize_Temp2=MI2.Get(StreamKind_Last, StreamPos_From, MI->Fill_Parameter(StreamKind_Last, Generic_StreamSize)); if (!StreamSize_Temp2.empty()) StreamSize_Temp+=StreamSize_Temp2.To_int64u(); else StreamSize_Temp=(int64u)-1; } } if (Duration_Temp!=(int64u)-1) MI->Fill(StreamKind_Last, StreamPos_To, MI->Fill_Parameter(StreamKind_Last, Generic_Duration), Duration_Temp, 10, true); if (FrameCount_Temp!=(int64u)-1) MI->Fill(StreamKind_Last, StreamPos_To, MI->Fill_Parameter(StreamKind_Last, Generic_FrameCount), FrameCount_Temp, 10, true); if (StreamSize_Temp!=(int64u)-1) MI->Fill(StreamKind_Last, StreamPos_To, MI->Fill_Parameter(StreamKind_Last, Generic_StreamSize), StreamSize_Temp, 10, true); } //Frame rate if available from container if (StreamKind_Last==Stream_Video && Reference->FrameRate) MI->Fill(Stream_Video, StreamPos_To, Video_FrameRate, Reference->FrameRate, 3 , true); //Hacks - After if (!Reference->IsMain && CodecID!=MI->Retrieve(StreamKind_Last, StreamPos_To, MI->Fill_Parameter(StreamKind_Last, Generic_CodecID))) { if (!CodecID.empty()) CodecID+=__T(" / "); CodecID+=MI->Retrieve(StreamKind_Last, StreamPos_To, MI->Fill_Parameter(StreamKind_Last, Generic_CodecID)); MI->Fill(StreamKind_Last, StreamPos_To, MI->Fill_Parameter(StreamKind_Last, Generic_CodecID), CodecID, true); } if (!Reference->IsMain && Reference->MI->Count_Get(Stream_Video)+Reference->MI->Count_Get(Stream_Audio)>1 && Reference->MI->Get(Stream_Video, 0, Video_Format)!=__T("DV")) { if (StreamKind_Last==Stream_Menu) { ZtringList List; List.Separator_Set(0, __T(" / ")); List.Write(MI->Retrieve(StreamKind_Last, StreamPos_To, "List")); ZtringList List_String; List_String.Separator_Set(0, __T(" / ")); List_String.Write(MI->Retrieve(StreamKind_Last, StreamPos_To, "List/String")); if (!ID_Base.empty()) for (size_t Pos=0; PosFill(Stream_Menu, StreamPos_To, Menu_List, List.Read(), true); MI->Fill(Stream_Menu, StreamPos_To, Menu_List_String, List_String.Read(), true); } else if (References.size()>1 && Reference->MI->Count_Get(Stream_Menu)==0) { if (Reference->MenuPos==(size_t)-1) { Reference->MenuPos=MI->Stream_Prepare(Stream_Menu); MI->Fill(Stream_Menu, Reference->MenuPos, General_ID, ID_Base); MI->Fill(Stream_Menu, Reference->StreamPos, "Source", Reference->Source); } Ztring List=Reference->MI->Get(StreamKind_Last, StreamPos_From, General_ID); Ztring List_String=Reference->MI->Get(StreamKind_Last, StreamPos_From, General_ID_String); if (!ID_Base.empty()) { List.insert(0, ID_Base+__T("-")); List_String.insert(0, ID_Base+__T("-")); } MI->Fill(Stream_Menu, Reference->MenuPos, Menu_List, List); MI->Fill(Stream_Menu, Reference->MenuPos, Menu_List_String, List_String); } } if (!Reference->IsMain && (ContainerHasNoId || !Config->File_ID_OnlyRoot_Get() || Reference->MI->Get(Stream_General, 0, General_Format)==__T("SCC") || Reference->MI->Count_Get(Stream_Video)+Reference->MI->Count_Get(Stream_Audio)>1) && !MI->Retrieve(StreamKind_Last, StreamPos_To, General_ID).empty()) { if (!ID.empty()) ID+=__T('-'); ID+=MI->Retrieve(StreamKind_Last, StreamPos_To, General_ID); if (!ID_String.empty()) ID_String+=__T('-'); ID_String+=MI->Retrieve(StreamKind_Last, StreamPos_To, General_ID_String); if (!MI->Retrieve(StreamKind_Last, StreamPos_To, "MenuID").empty()) { if (!ID_Base.empty()) MenuID=ID_Base+__T('-'); MenuID+=MI->Retrieve(StreamKind_Last, StreamPos_To, "MenuID"); if (!ID_Base.empty()) MenuID_String=ID_Base+__T('-'); MenuID_String+=MI->Retrieve(StreamKind_Last, StreamPos_To, "MenuID/String"); } else if (Reference->MenuPos!=(size_t)-1) { MenuID=ID_Base; MenuID_String=ID_Base; } } if (!Reference->IsMain) { MI->Fill(StreamKind_Last, StreamPos_To, General_ID, ID, true); MI->Fill(StreamKind_Last, StreamPos_To, General_ID_String, ID_String, true); MI->Fill(StreamKind_Last, StreamPos_To, "MenuID", MenuID, true); MI->Fill(StreamKind_Last, StreamPos_To, "MenuID/String", MenuID_String, true); MI->Fill(StreamKind_Last, StreamPos_To, "Source", Reference->Source, true); } for (std::map::iterator Info=Reference->Infos.begin(); Info!=Reference->Infos.end(); ++Info) if (MI->Retrieve(StreamKind_Last, StreamPos_To, Info->first.c_str()).empty()) MI->Fill(StreamKind_Last, StreamPos_To, Info->first.c_str(), Info->second); //Others if (!Reference->IsMain && Reference->MI->Info && MI->Retrieve(StreamKind_Last, StreamPos_To, Reference->MI->Info->Fill_Parameter(StreamKind_Last, Generic_Format))!=Reference->MI->Info->Get(Stream_General, 0, General_Format)) { Ztring MuxingMode=MI->Retrieve(StreamKind_Last, StreamPos_To, "MuxingMode"); if (!MuxingMode.empty()) MuxingMode.insert(0, __T(" / ")); MI->Fill(StreamKind_Last, StreamPos_To, "MuxingMode", Reference->MI->Info->Get(Stream_General, 0, General_Format)+MuxingMode, true); } //Lists #if MEDIAINFO_ADVANCED || MEDIAINFO_MD5 if (!Reference->List_Compute_Done && (Reference->MI->Count_Get(Stream_Menu)==0 || StreamKind_Last==Stream_Menu)) { List_Compute(); Reference->List_Compute_Done=true; } #endif //MEDIAINFO_ADVANCED || MEDIAINFO_MD5 } //--------------------------------------------------------------------------- #if MEDIAINFO_ADVANCED || MEDIAINFO_MD5 void File__ReferenceFilesHelper::List_Compute() { stream_t StreamKind=References.size()>1?StreamKind_Last:Stream_General; size_t StreamPos=References.size()>1?StreamPos_To:0; stream_t StreamKind_Target=Reference->MenuPos==(size_t)-1?StreamKind:Stream_Menu; size_t StreamPos_Target=Reference->MenuPos==(size_t)-1?StreamPos:Reference->MenuPos; //MD5 #if MEDIAINFO_MD5 if (!HasMainFile && Config->File_Md5_Get()) { if (!Reference->MI->Get(Stream_General, 0, __T("MD5_Generated")).empty()) { if (Reference->MI->Config.File_Names.size()==1) { if (MI->Retrieve(StreamKind_Target, StreamPos_Target, "Source").empty()) { Ztring SourcePath; Ztring SourceName=MI->Retrieve(Stream_General, 0, General_CompleteName); if (SourceName.find(__T("://"))==string::npos) SourcePath=ZenLib::FileName::Path_Get(SourceName); else { size_t Pos_Path=SourceName.find_last_of('/'); if (Pos_Path!=Ztring::npos) SourcePath=SourceName.substr(0, Pos_Path); } size_t SourcePath_Size=SourcePath.size()+1; //Path size + path separator size Ztring Temp=Reference->MI->Config.File_Names[0]; if (!Config->File_IsReferenced_Get()) Temp.erase(0, SourcePath_Size); MI->Fill(StreamKind_Target, StreamPos_Target, "Source", Temp); } MI->Fill(StreamKind_Target, StreamPos_Target, "Source_MD5_Generated", Reference->MI->Get(Stream_General, 0, __T("MD5_Generated"))); (*MI->Stream_More)[StreamKind_Target][StreamPos_Target](Ztring().From_Local("Source_MD5_Generated"), Info_Options)=__T("N NT"); } MI->Fill(StreamKind_Target, StreamPos_Target, "Source_List_MD5_Generated", Reference->MI->Get(Stream_General, 0, __T("MD5_Generated"))); (*MI->Stream_More)[StreamKind_Target][StreamPos_Target](Ztring().From_Local("Source_List_MD5_Generated"), Info_Options)=__T("N NT"); } if (!Reference->MI->Get(Stream_General, 0, __T("Source_List_MD5_Generated")).empty()) { MI->Fill(StreamKind_Target, StreamPos_Target, "Source_List_MD5_Generated", Reference->MI->Get(Stream_General, 0, __T("Source_List_MD5_Generated"))); (*MI->Stream_More)[StreamKind_Target][StreamPos_Target](Ztring().From_Local("Source_List_MD5_Generated"), Info_Options)=__T("N NT"); } else if (!Reference->MI->Get(StreamKind, StreamPos, __T("Source_List_MD5_Generated")).empty()) { MI->Fill(StreamKind_Target, StreamPos_Target, "Source_List_MD5_Generated", Reference->MI->Get(StreamKind, StreamPos, __T("Source_List_MD5_Generated"))); (*MI->Stream_More)[StreamKind_Target][StreamPos_Target](Ztring().From_Local("Source_List_MD5_Generated"), Info_Options)=__T("N NT"); } } #endif //MEDIAINFO_MD5 //Source_List #if MEDIAINFO_ADVANCED if (!HasMainFile && Config->File_Source_List_Get()) { Ztring SourcePath; Ztring SourceName=MI->Retrieve(Stream_General, 0, General_CompleteName); if (SourceName.find(__T("://"))==string::npos) SourcePath=ZenLib::FileName::Path_Get(SourceName); else { size_t Pos_Path=SourceName.find_last_of('/'); if (Pos_Path!=Ztring::npos) SourcePath=SourceName.substr(0, Pos_Path); } size_t SourcePath_Size=SourcePath.size()+1; //Path size + path separator size for (size_t Pos=0; PosFileNames.size(); Pos++) { Ztring Temp=Reference->FileNames[Pos]; if (!Config->File_IsReferenced_Get()) Temp.erase(0, SourcePath_Size); MI->Fill(StreamKind_Target, StreamPos_Target, "Source_List", Temp); } if (!Reference->MI->Get(Stream_General, 0, __T("Source_List")).empty()) { ZtringList List; List.Separator_Set(0, __T(" / ")); List.Write(Reference->MI->Get(Stream_General, 0, __T("Source_List"))); for (size_t Pos=0; PosFile_IsReferenced_Get()) Temp.erase(0, SourcePath_Size); MI->Fill(StreamKind_Target, StreamPos_Target, "Source_List", Temp); } } (*MI->Stream_More)[StreamKind_Target][StreamPos_Target](Ztring().From_Local("Source_List"), Info_Options)=__T("N NT"); } #endif //MEDIAINFO_ADVANCED } #endif //defined(MEDIAINFO_ADVANCED) || defined(MEDIAINFO_MD5) //--------------------------------------------------------------------------- MediaInfo_Internal* File__ReferenceFilesHelper::MI_Create() { //Configuration MediaInfo_Internal* MI_Temp=new MediaInfo_Internal(); MI_Temp->Option(__T("File_IsReferenced"), __T("1")); MI_Temp->Option(__T("File_FileNameFormat"), __T("CSV")); MI_Temp->Option(__T("File_KeepInfo"), __T("1")); MI_Temp->Option(__T("File_ID_OnlyRoot"), Config->File_ID_OnlyRoot_Get()?__T("1"):__T("0")); MI_Temp->Option(__T("File_DvDif_DisableAudioIfIsInContainer"), Config->File_DvDif_DisableAudioIfIsInContainer_Get()?__T("1"):__T("0")); if ((References.size()>1 || Config->File_MpegTs_ForceMenu_Get()) && !Reference->IsMain && !HasMainFile) MI_Temp->Option(__T("File_MpegTs_ForceMenu"), __T("1")); #if MEDIAINFO_NEXTPACKET if (Config->NextPacket_Get()) MI_Temp->Option(__T("File_NextPacket"), __T("1")); #endif //MEDIAINFO_NEXTPACKET #if MEDIAINFO_ADVANCED if (Config->File_IgnoreSequenceFileSize_Get()) MI_Temp->Option(__T("File_IgnoreSequenceFileSize"), __T("1")); if (Config->File_Source_List_Get()) MI_Temp->Option(__T("File_Source_List"), __T("1")); #endif //MEDIAINFO_ADVANCED #if MEDIAINFO_MD5 if (Config->File_Md5_Get()) MI_Temp->Option(__T("File_MD5"), __T("1")); #endif //MEDIAINFO_MD5 #if MEDIAINFO_EVENTS if (Config->Event_CallBackFunction_IsSet()) MI_Temp->Option(__T("File_Event_CallBackFunction"), Config->Event_CallBackFunction_Get()); MI_Temp->Config.File_Names_RootDirectory=FileName(MI->File_Name).Path_Get(); if (Reference->FileNames.size()>1) MI_Temp->Option(__T("File_TestContinuousFileNames"), __T("0")); ZtringListList SubFile_IDs; if (Reference->IsMain) HasMainFile=true; if (HasMainFile && !Reference->IsMain) { ZtringList ID; ID.push_back(Ztring::ToZtring((((int64u)MediaInfo_Parser_SideCar)<<56)|Reference->StreamID-1)); ID.push_back(Ztring::ToZtring(16)); ID.push_back(Ztring::ToZtring(MediaInfo_Parser_SideCar)); SubFile_IDs.push_back(ID); } else if (!Reference->IsMain) for (size_t Pos=0; PosStreamIDs_Size; Pos++) { ZtringList ID; if (MI->StreamIDs_Width[Pos]==0) ID.push_back(Ztring::ToZtring(-1)); else if (Pos+1==MI->StreamIDs_Size) ID.push_back(Ztring::ToZtring(Reference->StreamID)); else ID.push_back(Ztring::ToZtring(MI->StreamIDs[Pos])); ID.push_back(Ztring::ToZtring(MI->StreamIDs_Width[Pos])); ID.push_back(Ztring::ToZtring(MI->ParserIDs[Pos])); SubFile_IDs.push_back(ID); } if (!SubFile_IDs.empty()) { SubFile_IDs.Separator_Set(0, EOL); SubFile_IDs.Separator_Set(1, __T(",")); MI_Temp->Option(__T("File_SubFile_IDs_Set"), SubFile_IDs.Read()); } #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX if (Config->Demux_Unpacketize_Get()) MI_Temp->Option(__T("File_Demux_Unpacketize"), __T("1")); if (FrameRate) MI_Temp->Option(__T("File_Demux_Rate"), Ztring::ToZtring(FrameRate, 25)); switch (Config->Demux_InitData_Get()) { case 0 : MI_Temp->Option(__T("File_Demux_InitData"), __T("Event")); break; case 1 : MI_Temp->Option(__T("File_Demux_InitData"), __T("Field")); break; default: ; } #endif //MEDIAINFO_DEMUX #if MEDIAINFO_IBI if (!Reference->IbiStream.Infos.empty()) { ibi Ibi; Ibi.Streams[(int64u)-1]=new ibi::stream(Reference->IbiStream); //IBI Creation File_Ibi_Creation IbiCreation(Ibi); Ztring IbiText=IbiCreation.Finish(); if (!IbiText.empty()) MI_Temp->Option(__T("File_Ibi"), IbiText); } #endif //MEDIAINFO_IBI return MI_Temp; } //--------------------------------------------------------------------------- void File__ReferenceFilesHelper::Read_Buffer_Unsynched() { MI->Open_Buffer_Unsynch(); for (references::iterator Reference=References.begin(); Reference!=References.end(); ++Reference) if (Reference->MI) Reference->MI->Open_Buffer_Unsynch(); #if MEDIAINFO_DEMUX DTS_Minimal=(int64u)-1; Config->Demux_EventWasSent=true; //We want not try to read new data from the file #endif //MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File__ReferenceFilesHelper::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { for (Reference=References.begin(); Reference!=References.end(); Reference++) if (Reference->MI==NULL && !Reference->FileNames.empty()) ParseReference_Init(); //Parsing switch (Method) { case 0 : #if MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET { if (Value) { if (Value>MI->Config->File_Size) return 2; //Invalid value //Init if (!Duration) { MediaInfo_Internal MI2; MI2.Option(__T("File_KeepInfo"), __T("1")); Ztring ParseSpeed_Save=MI2.Option(__T("ParseSpeed_Get"), __T("")); Ztring Demux_Save=MI2.Option(__T("Demux_Get"), __T("")); MI2.Option(__T("ParseSpeed"), __T("0")); MI2.Option(__T("Demux"), Ztring()); size_t MiOpenResult=MI2.Open(MI->File_Name); MI2.Option(__T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value MI2.Option(__T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value if (!MiOpenResult) return (size_t)-1; Duration=MI2.Get(Stream_General, 0, General_Duration).To_float64()/1000; } //Time percentage float64 DurationF=Duration; DurationF*=Value; DurationF/=MI->Config->File_Size; size_t DurationM=(size_t)(DurationF*1000); Ztring DurationS; DurationS+=L'0'+(wchar_t)(DurationM/(10*60*60*1000)); DurationM%=10*60*60*1000; DurationS+=L'0'+(wchar_t)(DurationM/( 60*60*1000)); DurationM%= 60*60*1000; DurationS+=L':'; DurationS+=L'0'+(wchar_t)(DurationM/( 10*60*1000)); DurationM%= 10*60*1000; DurationS+=L'0'+(wchar_t)(DurationM/( 60*1000)); DurationM%= 60*1000; DurationS+=L':'; DurationS+=L'0'+(wchar_t)(DurationM/( 10*1000)); DurationM%= 10*1000; DurationS+=L'0'+(wchar_t)(DurationM/( 1000)); DurationM%= 1000; DurationS+=L'.'; DurationS+=L'0'+(wchar_t)(DurationM/( 100)); DurationM%= 100; DurationS+=L'0'+(wchar_t)(DurationM/( 10)); DurationM%= 10; DurationS+=L'0'+(wchar_t)(DurationM); CountOfReferencesToParse=References.size(); bool HasProblem=false; for (Reference=References.begin(); Reference!=References.end(); Reference++) { if (Reference->MI) { Ztring Result; if (Reference->CompleteDuration.empty() || DurationMCompleteDuration[1]->Demux_Offset_DTS) { Reference->CompleteDuration_Pos=0; Result=Reference->MI->Option(__T("File_Seek"), DurationS); } else { size_t CompleteDuration_Pos_Temp=1; while (CompleteDuration_Pos_TempCompleteDuration.size() && DurationM>=Reference->CompleteDuration[CompleteDuration_Pos_Temp]->Demux_Offset_DTS) CompleteDuration_Pos_Temp++; CompleteDuration_Pos_Temp--; Result=Reference->CompleteDuration[CompleteDuration_Pos_Temp]->MI->Option(__T("File_Seek"), DurationS); if (Result.empty()) Reference->CompleteDuration_Pos=CompleteDuration_Pos_Temp; } if (!Result.empty()) HasProblem=true; } Reference->Status.reset(); } Reference=References.begin(); Open_Buffer_Unsynch(); return HasProblem?(size_t)-1:1; //Not supported value if there is a problem (TODO: better info) } CountOfReferencesToParse=References.size(); bool HasProblem=false; for (Reference=References.begin(); Reference!=References.end(); Reference++) { if (Reference->MI) { Reference->CompleteDuration_Pos=0; Ztring Result=Reference->MI->Option(__T("File_Seek"), Ztring::ToZtring(Value)); if (!Result.empty()) HasProblem=true; } Reference->Status.reset(); } Reference=References.begin(); Open_Buffer_Unsynch(); return HasProblem?(size_t)-1:1; //Not supported value if there is a problem (TODO: better info) } #else //MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET return (size_t)-1; //Not supported #endif //MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET case 1 : #if MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET { //Time percentage int64u Duration=MI->Get(Stream_General, 0, General_Duration).To_int64u(); Ztring DurationS; if (Duration) { Duration*=Value; Duration/=10000; DurationS+=L'0'+(wchar_t)(Duration/(10*60*60*1000)); Duration%=10*60*60*1000; DurationS+=L'0'+(wchar_t)(Duration/( 60*60*1000)); Duration%= 60*60*1000; DurationS+=L':'; DurationS+=L'0'+(wchar_t)(Duration/( 10*60*1000)); Duration%= 10*60*1000; DurationS+=L'0'+(wchar_t)(Duration/( 60*1000)); Duration%= 60*1000; DurationS+=L':'; DurationS+=L'0'+(wchar_t)(Duration/( 10*1000)); Duration%= 10*1000; DurationS+=L'0'+(wchar_t)(Duration/( 1000)); Duration%= 1000; DurationS+=L'.'; DurationS+=L'0'+(wchar_t)(Duration/( 100)); Duration%= 100; DurationS+=L'0'+(wchar_t)(Duration/( 10)); Duration%= 10; DurationS+=L'0'+(wchar_t)(Duration); } else DurationS=Ztring::ToZtring(((float64)Value)/100)+__T('%'); CountOfReferencesToParse=References.size(); bool HasProblem=false; for (Reference=References.begin(); Reference!=References.end(); Reference++) { if (Reference->MI) { Ztring Result; if (Reference->CompleteDuration.empty() || DurationCompleteDuration[1]->Demux_Offset_DTS) { Reference->CompleteDuration_Pos=0; Result=Reference->MI->Option(__T("File_Seek"), DurationS); } else { size_t CompleteDuration_Pos_Temp=1; while (CompleteDuration_Pos_TempCompleteDuration.size() && Duration>=Reference->CompleteDuration[CompleteDuration_Pos_Temp]->Demux_Offset_DTS) CompleteDuration_Pos_Temp++; CompleteDuration_Pos_Temp--; Result=Reference->CompleteDuration[CompleteDuration_Pos_Temp]->MI->Option(__T("File_Seek"), DurationS); if (Result.empty()) Reference->CompleteDuration_Pos=CompleteDuration_Pos_Temp; } if (!Result.empty()) HasProblem=true; } Reference->Status.reset(); } Reference=References.begin(); Open_Buffer_Unsynch(); return HasProblem?2:1; //Invalid value if there is a problem (TODO: better info) } #else //MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET return (size_t)-1; //Not supported #endif //MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET case 2 : //Timestamp #if MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET { CountOfReferencesToParse=References.size(); Ztring Time; Time.Duration_From_Milliseconds(Value/1000000); for (Reference=References.begin(); Reference!=References.end(); Reference++) { if (Reference->MI) { Ztring Result; if (Reference->CompleteDuration.empty() || ValueCompleteDuration[1]->Demux_Offset_DTS) { Reference->CompleteDuration_Pos=0; Result=Reference->MI->Option(__T("File_Seek"), Time); } else { size_t CompleteDuration_Pos_Temp=1; while (CompleteDuration_Pos_TempCompleteDuration.size() && Value>=Reference->CompleteDuration[CompleteDuration_Pos_Temp]->Demux_Offset_DTS) CompleteDuration_Pos_Temp++; CompleteDuration_Pos_Temp--; Result=Reference->CompleteDuration[CompleteDuration_Pos_Temp]->MI->Option(__T("File_Seek"), Time); if (Result.empty()) Reference->CompleteDuration_Pos=CompleteDuration_Pos_Temp; } if (!Result.empty()) return 2; //Invalid value } else { //There was a problem, removing Reference References.clear(); return Read_Buffer_Seek(Method, Value, ID); } Reference->Status.reset(); } Reference=References.begin(); Open_Buffer_Unsynch(); return 1; } #else //MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET return (size_t)-1; //Not supported #endif //MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET case 3 : //FrameNumber #if MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET CountOfReferencesToParse=References.size(); for (Reference=References.begin(); Reference!=References.end(); Reference++) { if (Reference->MI) { Ztring Result; if (Reference->CompleteDuration.empty() || ValueCompleteDuration[1]->Demux_Offset_Frame) { Reference->CompleteDuration_Pos=0; Result=Reference->MI->Option(__T("File_Seek"), __T("Frame=")+Ztring::ToZtring(Value)); } else { size_t CompleteDuration_Pos_Temp=1; while (CompleteDuration_Pos_TempCompleteDuration.size() && Value>=Reference->CompleteDuration[CompleteDuration_Pos_Temp]->Demux_Offset_Frame) CompleteDuration_Pos_Temp++; CompleteDuration_Pos_Temp--; Result=Reference->CompleteDuration[CompleteDuration_Pos_Temp]->MI->Option(__T("File_Seek"), __T("Frame=")+Ztring::ToZtring(Value-Reference->CompleteDuration[CompleteDuration_Pos_Temp]->Demux_Offset_Frame)); if (Result.empty()) Reference->CompleteDuration_Pos=CompleteDuration_Pos_Temp; } if (!Result.empty()) return 2; //Invalid value } Reference->Status.reset(); } Reference=References.begin(); Open_Buffer_Unsynch(); return 1; #else //MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET return (size_t)-1; //Not supported #endif //MEDIAINFO_DEMUX && MEDIAINFO_NEXTPACKET default : return 0; } } #endif //MEDIAINFO_SEEK //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- size_t File__ReferenceFilesHelper::Stream_Prepare (stream_t StreamKind, size_t StreamPos) { size_t StreamPos_Last=MI->Stream_Prepare(StreamKind, StreamPos); for (references::iterator ReferencePos=References.begin(); ReferencePos!=References.end(); ++ReferencePos) if (ReferencePos->StreamKind==StreamKind && ReferencePos->StreamPos>=StreamPos_Last) if (ReferencePos->StreamPos!=(size_t)-1) ReferencePos->StreamPos++; return StreamPos_Last; } //--------------------------------------------------------------------------- void File__ReferenceFilesHelper::FileSize_Compute () { if (MI->Config==NULL) return; MI->Config->File_Size=MI->File_Size; for (references::iterator Reference=References.begin(); Reference!=References.end(); ++Reference) { if (Reference->FileSize!=(int64u)-1) MI->Config->File_Size+=Reference->FileSize; else if (Reference->MI && Reference->MI->Config.File_Size!=(int64u)-1) { MI->Config->File_Size+=Reference->MI->Config.File_Size; #if MEDIAINFO_ADVANCED if (!Config->File_IgnoreSequenceFileSize_Get()) #endif //MEDIAINFO_ADVANCED { if (!Reference->CompleteDuration.empty()) for (size_t Pos=1; PosCompleteDuration.size(); Pos++) MI->Config->File_Size+=File::Size_Get(Reference->CompleteDuration[Pos]->FileName); } } else { #if MEDIAINFO_ADVANCED if (!Config->File_IgnoreSequenceFileSize_Get()) #endif //MEDIAINFO_ADVANCED { if (Reference->CompleteDuration.empty()) for (size_t Pos=0; PosFileNames.size(); Pos++) MI->Config->File_Size+=File::Size_Get(Reference->FileNames[Pos]); else for (size_t Pos=0; PosCompleteDuration.size(); Pos++) MI->Config->File_Size+=File::Size_Get(Reference->CompleteDuration[Pos]->FileName); } } } } //--------------------------------------------------------------------------- #if MEDIAINFO_EVENTS void File__ReferenceFilesHelper::SubFile_Start() { if (Reference->StreamID!=StreamID_Previous) { Ztring FileName_Absolute, FileName_Relative; if (Reference->MI && Reference->MI->Config.File_Names_Pos && Reference->MI->Config.File_Names_PosMI->Config.File_Names.size()) FileName_Absolute=Reference->MI->Config.File_Names[Reference->MI->Config.File_Names_Pos-1]; else if (!Reference->FileNames.empty()) FileName_Absolute=Reference->FileNames[0]; else FileName_Absolute=Reference->Source.c_str(); Reference->MI->Config.Event_SubFile_Start(FileName_Absolute); StreamID_Previous=Reference->StreamID; } } #endif //MEDIAINFO_EVENTS } //NameSpace #endif //MEDIAINFO_REFERENCES_YES MediaInfoLib/Source/MediaInfo/Multiple/File__ReferenceFilesHelper.h100777 0 0 14003 12226004262 20647 0/* 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. */ //--------------------------------------------------------------------------- #ifndef File__ReferenceFilesHelperH #define File__ReferenceFilesHelperH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include "MediaInfo/MediaInfo_Internal.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File__ReferenceFilesHelper //*************************************************************************** class File__ReferenceFilesHelper { public : //In struct reference { ZtringList FileNames; Ztring Source; //Source file name (relative path) stream_t StreamKind; size_t StreamPos; size_t MenuPos; int64u StreamID; float64 FrameRate; int64u Delay; int64u FileSize; bool IsCircular; bool IsMain; #if MEDIAINFO_ADVANCED || MEDIAINFO_MD5 bool List_Compute_Done; #endif //MEDIAINFO_ADVANCED || MEDIAINFO_MD5 size_t State; std::map Infos; MediaInfo_Internal* MI; struct completeduration { Ztring FileName; MediaInfo_Internal* MI; #if MEDIAINFO_DEMUX int64u Demux_Offset_Frame; int64u Demux_Offset_DTS; int64u Demux_Offset_FileSize; #endif //MEDIAINFO_DEMUX completeduration() { MI=NULL; #if MEDIAINFO_DEMUX Demux_Offset_Frame=0; Demux_Offset_DTS=0; Demux_Offset_FileSize=0; #endif //MEDIAINFO_DEMUX } ~completeduration() { delete MI; } }; vector CompleteDuration; size_t CompleteDuration_Pos; #if MEDIAINFO_FILTER int64u Enabled; #endif //MEDIAINFO_FILTER std::bitset<32> Status; #if MEDIAINFO_NEXTPACKET && MEDIAINFO_IBI ibi::stream IbiStream; #endif //MEDIAINFO_NEXTPACKET && MEDIAINFO_IBI reference() { FileNames.Separator_Set(0, __T(",")); StreamKind=Stream_Max; StreamPos=(size_t)-1; MenuPos=(size_t)-1; StreamID=(int64u)-1; FrameRate=0; Delay=0; FileSize=(int64u)-1; IsCircular=false; IsMain=false; #if MEDIAINFO_ADVANCED || MEDIAINFO_MD5 List_Compute_Done=false; #endif //MEDIAINFO_ADVANCED || MEDIAINFO_MD5 State=0; MI=NULL; CompleteDuration_Pos=0; #if MEDIAINFO_FILTER Enabled=true; #endif //MEDIAINFO_FILTER } ~reference() { for (size_t Pos=0; Pos references; references References; bool TestContinuousFileNames; bool FilesForStorage; bool ContainerHasNoId; bool HasMainFile; bool HasMainFile_Filled; int64u ID_Max; //Streams management bool ParseReference_Init(); void ParseReferences(); //Constructor / Destructor File__ReferenceFilesHelper(File__Analyze* MI, MediaInfo_Config_MediaInfo* Config); ~File__ReferenceFilesHelper(); #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK private : //Streams management void ParseReference (); void ParseReference_Finalize (); void ParseReference_Finalize_PerStream (); void Open_Buffer_Unsynch() {Read_Buffer_Unsynched();} //Buffer - Global void Read_Buffer_Unsynched(); //temp File__Analyze* MI; MediaInfo_Config_MediaInfo* Config; references::iterator Reference; bool Init_Done; bool Demux_Interleave; size_t CountOfReferencesToParse; float64 FrameRate; float64 Duration; stream_t StreamKind_Last; size_t StreamPos_From; size_t StreamPos_To; #if MEDIAINFO_NEXTPACKET int64u DTS_Minimal; int64u DTS_Interval; #endif //MEDIAINFO_NEXTPACKET //Helpers size_t Stream_Prepare(stream_t StreamKind, size_t StreamPos=(size_t)-1); void FileSize_Compute(); MediaInfo_Internal* MI_Create(); #if MEDIAINFO_ADVANCED || MEDIAINFO_MD5 void List_Compute(); #endif //MEDIAINFO_ADVANCED || MEDIAINFO_MD5 #if MEDIAINFO_EVENTS void SubFile_Start(); int64u StreamID_Previous; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX int64u Offset_Video_DTS; #endif //MEDIAINFO_DEMUX }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/PreComp.cpp100777 0 0 1150 12226004262 13614 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Helpers for compilers (precompilation) // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #include "MediaInfo/PreComp.h" //--------------------------------------------------------------------------- MediaInfoLib/Source/MediaInfo/PreComp.h100777 0 0 1745 12226004262 13273 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Helpers for compilers (precompilation) // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_PreCompH #define MediaInfo_PreCompH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(_MSC_VER) || defined(__BORLANDC__) #include "MediaInfo/Setup.h" #include "MediaInfo/File__Analyze.h" #endif //_MSC_VER #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- #endif MediaInfoLib/Source/MediaInfo/Reader/ 40777 0 0 0 12226004262 12650 5MediaInfoLib/Source/MediaInfo/Reader/Reader_Directory.cpp100777 0 0 21273 12226004262 16727 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DIRECTORY_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Reader/Reader_Directory.h" #include "ZenLib/Dir.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { size_t Reader_Directory::Format_Test(MediaInfo_Internal* MI, String File_Name) { #ifdef MEDIAINFO_BDMV_YES if (Dir::Exists(File_Name) && File_Name.find(Ztring(1, PathSeparator)+__T("BDMV"))+5==File_Name.size()) return Bdmv_Format_Test(MI, File_Name); #endif //MEDIAINFO_BDMV_YES #ifdef MEDIAINFO_P2_YES if (Dir::Exists(File_Name) && File_Name.rfind(Ztring(1, PathSeparator)+__T("CONTENT"))+8==File_Name.size()) return P2_Format_Test(MI, File_Name); #endif //MEDIAINFO_P2_YES #ifdef MEDIAINFO_XDCAM_YES if (Dir::Exists(File_Name) && File_Name.rfind(Ztring(1, PathSeparator)+__T("XDCAM"))+5==File_Name.size()) return Xdcam_Format_Test(MI, File_Name); #endif //MEDIAINFO_XDCAM_YES return 0; } //--------------------------------------------------------------------------- void Reader_Directory::Directory_Cleanup(ZtringList &List) { #ifdef MEDIAINFO_BDMV_YES Bdmv_Directory_Cleanup(List); #endif //MEDIAINFO_BDMV_YES #ifdef MEDIAINFO_P2_YES P2_Directory_Cleanup(List); #endif //MEDIAINFO_P2_YES #ifdef MEDIAINFO_XDCAM_YES Xdcam_Directory_Cleanup(List); #endif //MEDIAINFO_XDCAM_YES } //*************************************************************************** // Blu-ray stuff //*************************************************************************** //--------------------------------------------------------------------------- #ifdef MEDIAINFO_BDMV_YES int Reader_Directory::Bdmv_Format_Test(MediaInfo_Internal* MI, const String &File_Name) { if (!MI->SelectFromExtension(__T("Bdmv"))) return 0; MI->Open_Buffer_Init(0, File_Name); MI->Open_Buffer_Continue(NULL, 0); MI->Open_Buffer_Finalize(); return 1; } #endif //MEDIAINFO_BDMV_YES //--------------------------------------------------------------------------- #ifdef MEDIAINFO_BDMV_YES void Reader_Directory::Bdmv_Directory_Cleanup(ZtringList &List) { //if there is a BDMV folder, this is blu-ray Ztring ToSearch=Ztring(1, PathSeparator)+__T("BDMV")+PathSeparator+__T("index.bdmv"); //"\BDMV\index.bdmv" for (size_t File_Pos=0; File_PosSelectFromExtension(__T("P2_Clip"))) return 0; MI->Open(File_Name+__T("CLIP")+PathSeparator+__T("0013MM.XML")); return 1; } #endif //MEDIAINFO_P2_YES //--------------------------------------------------------------------------- #ifdef MEDIAINFO_P2_YES void Reader_Directory::P2_Directory_Cleanup(ZtringList &List) { //if there is a CONTENTS/CLIP folder, this is P2 Ztring ToSearch=Ztring(1, PathSeparator)+__T("CONTENTS")+PathSeparator+__T("CLIP")+PathSeparator; //"/CONTENTS/CLIP/" for (size_t File_Pos=0; File_PosSelectFromExtension(__T("Xdcam_Clip"))) return 0; MI->Open(File_Name+__T("CLIP")+PathSeparator+__T("0013MM.XML")); return 1; } #endif //MEDIAINFO_XDCAM_YES //--------------------------------------------------------------------------- #ifdef MEDIAINFO_XDCAM_YES void Reader_Directory::Xdcam_Directory_Cleanup(ZtringList &List) { //if there is a XDCAM/Clip folder, this is Xdcam Ztring ToSearch=Ztring(1, PathSeparator)+__T("Clip")+PathSeparator; //"/Clip/" for (size_t File_Pos=0; File_Pos #endif // MEDIAINFO_DEBUG //--------------------------------------------------------------------------- namespace MediaInfoLib { const size_t Buffer_NoJump=128*1024; //--------------------------------------------------------------------------- size_t Reader_File::Format_Test(MediaInfo_Internal* MI, String File_Name) { //std::cout<Config.Event_Send(NULL, (const int8u*)&Event, sizeof(MediaInfo_Event_General_Start_0)); } #endif //MEDIAINFO_EVENTS //With Parser MultipleParsing /* MI->Open_Buffer_Init((int64u)-1, File_Name); if (Format_Test_PerParser(MI, File_Name)) return 1; return 0; //There is a problem */ //Get the Extension Ztring Extension=FileName::Extension_Get(File_Name); Extension.MakeLowerCase(); //Search the theorical format from extension InfoMap &FormatList=MediaInfoLib::Config.Format_Get(); InfoMap::iterator Format=FormatList.end(); if (!MI->Config.File_ForceParser_Get().empty()) Format=FormatList.find(MI->Config.File_ForceParser_Get()); if (Format==FormatList.end()) { Format=FormatList.begin(); while (Format!=FormatList.end()) { const Ztring &Extensions=FormatList.Get(Format->first, InfoFormat_Extensions); if (Extensions.find(Extension)!=Error) { if(Extension.size()==Extensions.size()) break; //Only one extenion in the list if(Extensions.find(Extension+__T(" "))!=Error || Extensions.find(__T(" ")+Extension)!=Error) break; } ++Format; } } if (Format!=FormatList.end()) { const Ztring &Parser=Format->second(InfoFormat_Parser); if (MI->SelectFromExtension(Parser)) { //Test the theorical format if (Format_Test_PerParser(MI, File_Name)>0) return 1; } } size_t ToReturn=MI->ListFormats(File_Name); return ToReturn; } //--------------------------------------------------------------------------- size_t Reader_File::Format_Test_PerParser(MediaInfo_Internal* MI, const String &File_Name) { //Opening the file F.Open(File_Name); if (!F.Opened_Get()) return 0; //Info Status=0; MI->Config.File_Size=F.Size_Get(); MI->Config.File_Current_Offset=0; MI->Config.File_Current_Size=MI->Config.File_Size; MI->Config.File_Sizes.clear(); MI->Config.File_Sizes.push_back(MI->Config.File_Size); if (MI->Config.File_Names.size()>1 #if MEDIAINFO_ADVANCED && !MI->Config.File_IgnoreSequenceFileSize_Get() #endif //MEDIAINFO_ADVANCED ) { for (size_t Pos=1; PosConfig.File_Names.size(); Pos++) { int64u Size=File::Size_Get(MI->Config.File_Names[Pos]); MI->Config.File_Sizes.push_back(Size); MI->Config.File_Size+=Size; } } //Partial file handling Ztring Config_Partial_Begin=MI->Config.File_Partial_Begin_Get(); if (!Config_Partial_Begin.empty() && Config_Partial_Begin[0]>=__T('0') && Config_Partial_Begin[0]<=__T('9')) { if (Config_Partial_Begin.find(__T('%'))==Config_Partial_Begin.size()-1) Partial_Begin=float64_int64s(MI->Config.File_Size*Config_Partial_Begin.To_float64()/100); else Partial_Begin=Config_Partial_Begin.To_int64u(); if (Partial_Begin) F.GoTo(Partial_Begin); } else Partial_Begin=0; Ztring Config_Partial_End=MI->Config.File_Partial_End_Get(); if (!Config_Partial_End.empty() && Config_Partial_End[0]>=__T('0') && Config_Partial_End[0]<=__T('9')) { if (Config_Partial_End.find(__T('%'))==Config_Partial_End.size()-1) Partial_End=float64_int64s(MI->Config.File_Size*Config_Partial_End.To_float64()/100); else Partial_End=Config_Partial_End.To_int64u(); } else Partial_End=(int64u)-1; if (Partial_Begin>MI->Config.File_Size) Partial_Begin=0; //Wrong value if (Partial_Begin>Partial_End) Partial_Begin=0; //Wrong value //Parser MI->Open_Buffer_Init((Partial_End<=MI->Config.File_Size?Partial_End:MI->Config.File_Size)-Partial_Begin, File_Name); //Buffer MI->Option(__T("File_Buffer_Size_Hint_Pointer"), Ztring::ToZtring((size_t)(&MI->Config.File_Buffer_Size_ToRead))); MI->Config.File_Buffer_Repeat_IsSupported=true; //Test the format with buffer return Format_Test_PerParser_Continue(MI); } //--------------------------------------------------------------------------- size_t Reader_File::Format_Test_PerParser_Continue (MediaInfo_Internal* MI) { bool StopAfterFilled=MI->Config.File_StopAfterFilled_Get(); bool ShouldContinue=true; //Previous data if (MI->Config.File_Buffer_Repeat) { MI->Config.File_Buffer_Repeat=false; #if MEDIAINFO_DEMUX MI->Config.Demux_EventWasSent=false; #endif //MEDIAINFO_DEMUX Status=MI->Open_Buffer_Continue(MI->Config.File_Buffer, MI->Config.File_Buffer_Size); #if MEDIAINFO_DEMUX //Demux if (MI->Config.Demux_EventWasSent) return 2; //Must return immediately #endif //MEDIAINFO_DEMUX //Threading if (MI->IsTerminating()) return 1; //Termination is requested if (Status[File__Analyze::IsFinished] || (StopAfterFilled && Status[File__Analyze::IsFilled])) ShouldContinue=false; } #if MEDIAINFO_DEMUX //PerPacket if (ShouldContinue && MI->Config.Demux_EventWasSent) { MI->Config.Demux_EventWasSent=false; Status=MI->Open_Buffer_Continue(NULL, 0); //Demux if (MI->Config.Demux_EventWasSent) return 2; //Must return immediately //Threading if (MI->IsTerminating()) return 1; //Termination is requested if (Status[File__Analyze::IsFinished] || (StopAfterFilled && Status[File__Analyze::IsFilled])) ShouldContinue=false; } #endif //MEDIAINFO_DEMUX if (ShouldContinue) { //Test the format with buffer while (!(Status[File__Analyze::IsFinished] || (StopAfterFilled && Status[File__Analyze::IsFilled]))) { //Seek (if needed) if (MI->Open_Buffer_Continue_GoTo_Get()!=(int64u)-1) { #ifdef MEDIAINFO_DEBUG std::cout<Open_Buffer_Continue_GoTo_Get(); Reader_File_BytesRead=0; Reader_File_Count++; #endif //MEDIAINFO_DEBUG int64u GoTo=Partial_Begin+MI->Open_Buffer_Continue_GoTo_Get(); MI->Config.File_Current_Offset=0; int64u Buffer_NoJump_Temp=Buffer_NoJump; if (MI->Config.File_Names.size()>1) { size_t Pos; for (Pos=0; PosConfig.File_Sizes.size(); Pos++) { if (GoTo>=MI->Config.File_Sizes[Pos]) { GoTo-=MI->Config.File_Sizes[Pos]; MI->Config.File_Current_Offset+=MI->Config.File_Sizes[Pos]; } else break; } if (Pos>=MI->Config.File_Sizes.size()) break; if (Pos!=MI->Config.File_Names_Pos-1) { F.Close(); F.Open(MI->Config.File_Names[Pos]); MI->Config.File_Names_Pos=Pos+1; MI->Config.File_Current_Size=MI->Config.File_Current_Offset+F.Size_Get(); Buffer_NoJump_Temp=0; } } if (GoTo>=F.Size_Get()) break; //Seek requested, but on a file bigger in theory than what is in the real file, we can't do this if (!(GoTo>F.Position_Get() && GoToOpen_Buffer_Init((int64u)-1, MI->Config.File_Current_Offset+F.Position_Get()-Partial_Begin); } } //Handling of hints if (MI->Config.File_Buffer_Size_ToRead==0) break; //Problem while config if (MI->Config.File_Buffer_Size_ToRead>MI->Config.File_Buffer_Size_Max) { delete[] MI->Config.File_Buffer; if (MI->Config.File_Buffer_Size_Max==0) MI->Config.File_Buffer_Size_Max=1; while (MI->Config.File_Buffer_Size_ToRead>MI->Config.File_Buffer_Size_Max) MI->Config.File_Buffer_Size_Max*=2; MI->Config.File_Buffer=new int8u[MI->Config.File_Buffer_Size_Max]; } //Testing multiple file per stream if (F.Position_Get()>=F.Size_Get()) { if (MI->Config.File_Names_PosConfig.File_Names.size()) { MI->Config.File_Current_Offset+=F.Size_Get(); F.Close(); #if MEDIAINFO_EVENTS MI->Config.Event_SubFile_Start(MI->Config.File_Names[MI->Config.File_Names_Pos]); #endif //MEDIAINFO_EVENTS F.Open(MI->Config.File_Names[MI->Config.File_Names_Pos]); MI->Config.File_Names_Pos++; MI->Config.File_Current_Size+=F.Size_Get(); } } MI->Config.File_Buffer_Size=F.Read(MI->Config.File_Buffer, (F.Position_Get()+MI->Config.File_Buffer_Size_ToRead<(Partial_End<=MI->Config.File_Size?Partial_End:MI->Config.File_Size))?MI->Config.File_Buffer_Size_ToRead:((size_t)((Partial_End<=MI->Config.File_Size?Partial_End:MI->Config.File_Size)-F.Position_Get()))); //Testing growing files int64u Growing_Temp=(int64u)-1; if (MI->Config.ParseSpeed>=1.0 && !MI->Config.File_IsGrowing && MI->Config.File_Current_Offset+F.Position_Get()>=MI->Config.File_Size) { if (MI->Config.File_Names.size()==1) { Growing_Temp=F.Size_Get(); if (MI->Config.File_Size!=Growing_Temp) MI->Config.File_IsGrowing=true; } else if (MI->Config.File_TestContinuousFileNames_Get()) { Growing_Temp=MI->Config.File_Names.size(); MI->TestContinuousFileNames(); if (MI->Config.File_Names.size()!=Growing_Temp) MI->Config.File_IsGrowing=true; } } if (MI->Config.File_IsNotGrowingAnymore) { MI->Config.File_Current_Size=MI->Config.File_Size=F.Size_Get(); MI->Open_Buffer_Init(MI->Config.File_Size, F.Position_Get()-MI->Config.File_Buffer_Size); MI->Config.File_IsGrowing=false; MI->Config.File_IsNotGrowingAnymore=false; } if (MI->Config.File_IsGrowing && (Growing_Temp!=(int64u)-1 || MI->Config.File_Current_Offset+F.Position_Get()>=MI->Config.File_Size)) { for (size_t CountOfSeconds=0; CountOfSeconds<(size_t)MI->Config.File_GrowingFile_Delay_Get(); CountOfSeconds++) { if (MI->Config.File_Names.size()==1) { Growing_Temp=F.Size_Get(); if (MI->Config.File_Size!=Growing_Temp) { MI->Config.File_Current_Size=MI->Config.File_Size=Growing_Temp; MI->Open_Buffer_Init(MI->Config.File_Size, MI->Config.File_Current_Offset+F.Position_Get()-MI->Config.File_Buffer_Size); break; } } else { Growing_Temp=MI->Config.File_Names.size(); MI->TestContinuousFileNames(); if (MI->Config.File_Names.size()!=Growing_Temp) { MI->Open_Buffer_Init(MI->Config.File_Size, MI->Config.File_Current_Offset+F.Position_Get()-MI->Config.File_Buffer_Size); break; } } #ifdef WINDOWS Sleep(1000); #endif //WINDOWS } } #ifdef MEDIAINFO_DEBUG Reader_File_BytesRead_Total+=MI->Config.File_Buffer_Size; Reader_File_BytesRead+=MI->Config.File_Buffer_Size; #endif //MEDIAINFO_DEBUG //Parser Status=MI->Open_Buffer_Continue(MI->Config.File_Buffer, MI->Config.File_Buffer_Size); if (MI->Config.File_Buffer_Size==0) { #if MEDIAINFO_EVENTS MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0xF0F00101, "File read error"); #endif //MEDIAINFO_EVENTS break; } #if MEDIAINFO_DEMUX if (MI->Config.Demux_EventWasSent) return 2; //Must return immediately #endif //MEDIAINFO_DEMUX //Threading if (MI->IsTerminating()) break; //Termination is requested } } //Deleting buffer delete[] MI->Config.File_Buffer; MI->Config.File_Buffer=NULL; MI->Config.File_Buffer_Size_Max=0; #ifdef MEDIAINFO_DEBUG std::cout<Config.File_KeepInfo_Get()) { //File F.Close(); } //Is this file detected? if (!Status[File__Analyze::IsAccepted]) return 0; MI->Open_Buffer_Finalize(); #if MEDIAINFO_DEMUX if (MI->Config.Demux_EventWasSent) return 2; //Must return immediately #endif //MEDIAINFO_DEMUX return 1; } //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t Reader_File::Format_Test_PerParser_Seek (MediaInfo_Internal* MI, size_t Method, int64u Value, int64u ID) { size_t ToReturn=MI->Open_Buffer_Seek(Method, Value, ID); if (ToReturn==0 || ToReturn==1) { //Reset Status=0; } return ToReturn; } #endif //MEDIAINFO_SEEK } //NameSpace MediaInfoLib/Source/MediaInfo/Reader/Reader_File.h100777 0 0 3322 12226004262 15262 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Give information about a lot of media files // Dispatch the file to be tested by all containers // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef Reader_FileH #define Reader_FileH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Reader/Reader__Base.h" #include "ZenLib/File.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** /// @brief Reader_File //*************************************************************************** class Reader_File : public Reader__Base { public : //Constructor/Destructor virtual ~Reader_File() {} //Format testing size_t Format_Test(MediaInfo_Internal* MI, String File_Name); size_t Format_Test_PerParser(MediaInfo_Internal* MI, const String &File_Name); size_t Format_Test_PerParser_Continue (MediaInfo_Internal* MI); size_t Format_Test_PerParser_Seek (MediaInfo_Internal* MI, size_t Method, int64u Value, int64u ID); ZenLib::File F; std::bitset<32> Status; int64u Partial_Begin; int64u Partial_End; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Reader/Reader_libcurl.cpp100777 0 0 112136 12226004262 16436 0/* 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. */ //--------------------------------------------------------------------------- // For user: you can disable or enable it //#define MEDIAINFO_DEBUG //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_LIBCURL_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Reader/Reader_libcurl.h" #include "MediaInfo/File__Analyze.h" #if defined MEDIAINFO_LIBCURL_DLL_RUNTIME //Copy of cURL include files #include "MediaInfo/Reader/Reader_libcurl_Include.h" #else #define CURL_STATICLIB #undef __TEXT #include "curl/curl.h" #endif #include #include "ZenLib/File.h" using namespace ZenLib; using namespace std; #ifdef MEDIAINFO_DEBUG #include #endif // MEDIAINFO_DEBUG //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // libcurl stuff //*************************************************************************** //--------------------------------------------------------------------------- struct Reader_libcurl::curl_data { MediaInfo_Internal* MI; CURL* Curl; char ErrorBuffer[CURL_ERROR_SIZE]; #if MEDIAINFO_NEXTPACKET CURLM* CurlM; #endif MEDIAINFO_NEXTPACKET struct curl_slist* HttpHeader; std::bitset<32> Status; String File_Name; std::string Ssl_CertificateFileName; std::string Ssl_CertificateFormat; std::string Ssl_PrivateKeyFileName; std::string Ssl_PrivateKeyFormat; std::string Ssl_CertificateAuthorityFileName; std::string Ssl_CertificateAuthorityPath; std::string Ssl_CertificateRevocationListFileName; bool Ssl_IgnoreSecurity; std::string Ssh_KnownHostsFileName; std::string Ssh_PublicKeyFileName; std::string Ssh_PrivateKeyFileName; bool Ssh_IgnoreSecurity; bool Init_AlreadyDone; bool Init_NotAFile; #if MEDIAINFO_NEXTPACKET bool NextPacket; #endif MEDIAINFO_NEXTPACKET time_t Time_Max; #ifdef MEDIAINFO_DEBUG int64u Debug_BytesRead_Total; int64u Debug_BytesRead; int64u Debug_Count; #endif // MEDIAINFO_DEBUG curl_data() { MI=NULL; Curl=NULL; ErrorBuffer[0]='\0'; #if MEDIAINFO_NEXTPACKET CurlM=NULL; #endif MEDIAINFO_NEXTPACKET HttpHeader=NULL; Ssl_IgnoreSecurity=false; Ssh_IgnoreSecurity=false; Init_AlreadyDone=false; Init_NotAFile=false; #if MEDIAINFO_NEXTPACKET NextPacket=false; #endif MEDIAINFO_NEXTPACKET Time_Max=0; #ifdef MEDIAINFO_DEBUG Debug_BytesRead_Total=0; Debug_BytesRead=0; Debug_Count=1; #endif // MEDIAINFO_DEBUG } }; //--------------------------------------------------------------------------- size_t libcurl_WriteData_CallBack(void *ptr, size_t size, size_t nmemb, void *data) { #ifdef MEDIAINFO_DEBUG ((Reader_libcurl::curl_data*)data)->Debug_BytesRead_Total+=size*nmemb; ((Reader_libcurl::curl_data*)data)->Debug_BytesRead+=size*nmemb; #endif //MEDIAINFO_DEBUG //Init if (!((Reader_libcurl::curl_data*)data)->Init_AlreadyDone) { double File_SizeD; CURLcode Result=curl_easy_getinfo(((Reader_libcurl::curl_data*)data)->Curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &File_SizeD); if (Result==CURLE_OK && File_SizeD==0) { ((Reader_libcurl::curl_data*)data)->Init_NotAFile=true; return 0; //Great chances it is FTP file listing due to interogation mark in the file name } else if (Result==CURLE_OK && File_SizeD!=-1) { ((Reader_libcurl::curl_data*)data)->MI->Open_Buffer_Init((int64u)File_SizeD, ((Reader_libcurl::curl_data*)data)->File_Name); } else ((Reader_libcurl::curl_data*)data)->MI->Open_Buffer_Init((int64u)-1, ((Reader_libcurl::curl_data*)data)->File_Name); ((Reader_libcurl::curl_data*)data)->Init_AlreadyDone=true; } //Continue ((Reader_libcurl::curl_data*)data)->Status=((Reader_libcurl::curl_data*)data)->MI->Open_Buffer_Continue((int8u*)ptr, size*nmemb); time_t CurrentTime = time(0); if (((Reader_libcurl::curl_data*)data)->Status[File__Analyze::IsFinished] || (((Reader_libcurl::curl_data*)data)->Time_Max && CurrentTime>=((Reader_libcurl::curl_data*)data)->Time_Max)) { return 0; } //GoTo if (((Reader_libcurl::curl_data*)data)->MI->Open_Buffer_Continue_GoTo_Get()!=(int64u)-1) { return 0; } //Continue parsing return size*nmemb; } Ztring Reader_libcurl_FileNameWithoutPassword(const Ztring &FileName) { Ztring FileName_Modified(FileName); size_t Begin=FileName_Modified.find(__T(':'), 6); size_t End=FileName_Modified.find(__T('@')); if (Begin!=string::npos && End!=string::npos && BeginCurlM) { curl_multi_remove_handle(Curl_Data->CurlM, Curl_Data->Curl); curl_multi_cleanup(Curl_Data->CurlM); } #endif //MEDIAINFO_NEXTPACKET if (Curl_Data->Curl) curl_easy_cleanup(Curl_Data->Curl); if (Curl_Data->HttpHeader) curl_slist_free_all(Curl_Data->HttpHeader); delete Curl_Data; //Curl_Data=NULL; } //*************************************************************************** // //*************************************************************************** //--------------------------------------------------------------------------- size_t Reader_libcurl::Format_Test(MediaInfo_Internal* MI, String File_Name) { #if defined MEDIAINFO_LIBCURL_DLL_RUNTIME if (libcurl_Module_Count==0) { size_t Errors=0; /* Load library */ #ifdef MEDIAINFO_GLIBC libcurl_Module=g_module_open(MEDIAINFODLL_NAME, G_MODULE_BIND_LAZY); #elif defined (_WIN32) || defined (WIN32) libcurl_Module=LoadLibrary(MEDIAINFODLL_NAME); #else libcurl_Module=dlopen(MEDIAINFODLL_NAME, RTLD_LAZY); if (!libcurl_Module) libcurl_Module=dlopen("./" MEDIAINFODLL_NAME, RTLD_LAZY); if (!libcurl_Module) libcurl_Module=dlopen("/usr/local/lib/" MEDIAINFODLL_NAME, RTLD_LAZY); if (!libcurl_Module) libcurl_Module=dlopen("/usr/local/lib64/" MEDIAINFODLL_NAME, RTLD_LAZY); if (!libcurl_Module) libcurl_Module=dlopen("/usr/lib/" MEDIAINFODLL_NAME, RTLD_LAZY); if (!libcurl_Module) libcurl_Module=dlopen("/usr/lib64/" MEDIAINFODLL_NAME, RTLD_LAZY); #endif if (!libcurl_Module) { #if MEDIAINFO_EVENTS MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0, Reader_libcurl_FileNameWithoutPassword(File_Name)+__T(", Libcurl library is not found")); #endif //MEDIAINFO_EVENTS return 0; } /* Load methods */ MEDIAINFO_ASSIGN (curl_easy_init, "curl_easy_init") MEDIAINFO_ASSIGN (curl_easy_setopt, "curl_easy_setopt") MEDIAINFO_ASSIGN (curl_easy_perform, "curl_easy_perform") MEDIAINFO_ASSIGN (curl_easy_cleanup, "curl_easy_cleanup") MEDIAINFO_ASSIGN (curl_easy_getinfo, "curl_easy_getinfo") MEDIAINFO_ASSIGN (curl_slist_append, "curl_slist_append") MEDIAINFO_ASSIGN (curl_slist_free_all, "curl_slist_free_all") MEDIAINFO_ASSIGN (curl_easy_duphandle, "curl_easy_duphandle") MEDIAINFO_ASSIGN (curl_easy_strerror, "curl_easy_strerror") MEDIAINFO_ASSIGN (curl_version_info, "curl_version_info") MEDIAINFO_ASSIGN (curl_multi_init, "curl_multi_init") MEDIAINFO_ASSIGN (curl_multi_add_handle, "curl_multi_add_handle") MEDIAINFO_ASSIGN (curl_multi_remove_handle, "curl_multi_remove_handle") MEDIAINFO_ASSIGN (curl_multi_perform, "curl_multi_perform") MEDIAINFO_ASSIGN (curl_multi_cleanup, "curl_multi_cleanup") if (Errors>0) { #if MEDIAINFO_EVENTS MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0, Reader_libcurl_FileNameWithoutPassword(File_Name)+__T(", Libcurl library is not correctly loaded")); #endif //MEDIAINFO_EVENTS return 0; } libcurl_Module_Count++; } #endif //defined MEDIAINFO_LIBCURL_DLL_RUNTIME #if MEDIAINFO_EVENTS { struct MediaInfo_Event_General_Start_0 Event; memset(&Event, 0xFF, sizeof(struct MediaInfo_Event_General_Start_0)); Event.StreamIDs_Size=0; Event.EventCode=MediaInfo_EventCode_Create(MediaInfo_Parser_None, MediaInfo_Event_General_Start, 0); Event.Stream_Size=(int64u)-1; Event.FileName=NULL; Event.FileName_Unicode=NULL; MI->Config.Event_Send(NULL, (const int8u*)&Event, sizeof(MediaInfo_Event_General_Start_0)); } #endif //MEDIAINFO_EVENTS //With Parser MultipleParsing return Format_Test_PerParser(MI, File_Name); } //--------------------------------------------------------------------------- size_t Reader_libcurl::Format_Test_PerParser(MediaInfo_Internal* MI, const String &File_Name) { #if defined MEDIAINFO_LIBCURL_DLL_RUNTIME if (libcurl_Module_Count==0) return 0; //No libcurl library #endif //defined MEDIAINFO_LIBCURL_DLL_RUNTIME Curl_Data=new curl_data(); Curl_Data->Ssl_CertificateFileName=MediaInfoLib::Config.Ssl_CertificateFileName_Get().To_Local(); Curl_Data->Ssl_CertificateFormat=MediaInfoLib::Config.Ssl_CertificateFormat_Get().To_Local(); Curl_Data->Ssl_PrivateKeyFileName=MediaInfoLib::Config.Ssl_PrivateKeyFileName_Get().To_Local(); Curl_Data->Ssl_PrivateKeyFormat=MediaInfoLib::Config.Ssl_PrivateKeyFormat_Get().To_Local(); Curl_Data->Ssl_CertificateAuthorityFileName=MediaInfoLib::Config.Ssl_CertificateAuthorityFileName_Get().To_Local(); Curl_Data->Ssl_CertificateAuthorityPath=MediaInfoLib::Config.Ssl_CertificateAuthorityPath_Get().To_Local(); Curl_Data->Ssl_CertificateRevocationListFileName=MediaInfoLib::Config.Ssl_CertificateRevocationListFileName_Get().To_Local(); Curl_Data->Ssl_IgnoreSecurity=MediaInfoLib::Config.Ssl_IgnoreSecurity_Get(); Curl_Data->Ssh_PublicKeyFileName=Reader_libcurl_ExpandFileName(MediaInfoLib::Config.Ssh_PublicKeyFileName_Get()).To_Local(); if (Curl_Data->Ssh_PublicKeyFileName.empty()) { if (Reader_libcurl_HomeIsSet()) { Ztring Temp=Reader_libcurl_ExpandFileName(__T("$HOME/.ssh/id_rsa.pub")); if (File::Exists(Temp)) Curl_Data->Ssh_PublicKeyFileName=Temp.To_Local(); } else { if (File::Exists(__T("id_rsa.pub"))) Curl_Data->Ssh_PublicKeyFileName="id_rsa.pub"; } } Curl_Data->Ssh_PrivateKeyFileName=Reader_libcurl_ExpandFileName(MediaInfoLib::Config.Ssh_PrivateKeyFileName_Get()).To_Local(); if (Curl_Data->Ssh_PrivateKeyFileName.empty()) { if (Reader_libcurl_HomeIsSet()) { Ztring Temp=Reader_libcurl_ExpandFileName(__T("$HOME/.ssh/id_rsa")); if (File::Exists(Temp)) Curl_Data->Ssh_PrivateKeyFileName=Temp.To_Local(); } else { if (File::Exists(__T("id_rsa"))) Curl_Data->Ssh_PublicKeyFileName="id_rsa"; } } Curl_Data->Ssh_KnownHostsFileName=Reader_libcurl_ExpandFileName(MediaInfoLib::Config.Ssh_KnownHostsFileName_Get()).To_Local(); if (Curl_Data->Ssh_KnownHostsFileName.empty()) { if (Reader_libcurl_HomeIsSet()) Curl_Data->Ssh_KnownHostsFileName=Reader_libcurl_ExpandFileName(__T("$HOME/.ssh/known_hosts")).To_Local(); else Curl_Data->Ssh_KnownHostsFileName="known_hosts"; } Curl_Data->Ssh_IgnoreSecurity=MediaInfoLib::Config.Ssh_IgnoreSecurity_Get(); Curl_Data->Curl=curl_easy_init(); if (Curl_Data->Curl==NULL) return 0; #if MEDIAINFO_NEXTPACKET if (MI->Config.NextPacket_Get()) { Curl_Data->CurlM=curl_multi_init( ); if (Curl_Data->CurlM==NULL) return 0; CURLMcode CodeM=curl_multi_add_handle(Curl_Data->CurlM, Curl_Data->Curl); if (CodeM!=CURLM_OK) return 0; Curl_Data->NextPacket=true; } #endif //MEDIAINFO_NEXTPACKET Curl_Data->MI=MI; Curl_Data->File_Name=File_Name; string FileName_String=Ztring(Curl_Data->File_Name).To_UTF8(); if (MI->Config.File_TimeToLive_Get()) Curl_Data->Time_Max=time(0)+(time_t)MI->Config.File_TimeToLive_Get(); if (!MI->Config.File_Curl_Get(__T("UserAgent")).empty()) curl_easy_setopt(Curl_Data->Curl, CURLOPT_USERAGENT, MI->Config.File_Curl_Get(__T("UserAgent")).To_Local().c_str()); if (!MI->Config.File_Curl_Get(__T("Proxy")).empty()) curl_easy_setopt(Curl_Data->Curl, CURLOPT_PROXY, MI->Config.File_Curl_Get(__T("Proxy")).To_Local().c_str()); if (!MI->Config.File_Curl_Get(__T("HttpHeader")).empty()) { ZtringList HttpHeaderStrings; HttpHeaderStrings.Separator_Set(0, EOL); //End of line is set depending of the platform: \n on Linux, \r on Mac, or \r\n on Windows HttpHeaderStrings.Write(MI->Config.File_Curl_Get(__T("HttpHeader"))); for (size_t Pos=0; PosHttpHeader, HttpHeaderStrings[Pos].To_Local().c_str()); curl_easy_setopt(Curl_Data->Curl, CURLOPT_HTTPHEADER, Curl_Data->HttpHeader); } curl_easy_setopt(Curl_Data->Curl, CURLOPT_URL, FileName_String.c_str()); curl_easy_setopt(Curl_Data->Curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(Curl_Data->Curl, CURLOPT_MAXREDIRS, 3); curl_easy_setopt(Curl_Data->Curl, CURLOPT_WRITEFUNCTION, &libcurl_WriteData_CallBack); curl_easy_setopt(Curl_Data->Curl, CURLOPT_WRITEDATA, Curl_Data); curl_easy_setopt(Curl_Data->Curl, CURLOPT_ERRORBUFFER, Curl_Data->ErrorBuffer); size_t Protocol_Limit=File_Name.find(__T(":")); if (Protocol_Limit!=string::npos) { Ztring Protocol=File_Name; Protocol.resize(Protocol_Limit); Protocol.MakeLowerCase(); if (Protocol==__T("sftp") || Protocol==__T("scp")) { if (!Curl_Data->Ssh_PublicKeyFileName.empty()) { CURLcode Result=curl_easy_setopt(Curl_Data->Curl, CURLOPT_SSH_PUBLIC_KEYFILE, Curl_Data->Ssh_PublicKeyFileName.c_str()); if (Result) { #if MEDIAINFO_EVENTS if (Result==CURLE_UNKNOWN_TELNET_OPTION) MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0xF1010101, Reader_libcurl_FileNameWithoutPassword(File_Name)+__T(", The Curl library you use has no support for secure connections.")); else { Ztring MessageString; MessageString.From_Local(Curl_Data->ErrorBuffer); if (MessageString.empty()) MessageString.From_Local(curl_easy_strerror(Result)); MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0, Reader_libcurl_FileNameWithoutPassword(File_Name)+__T(", ")+MessageString); } Curl_Data->ErrorBuffer[0]='\0'; #endif //MEDIAINFO_EVENTS return 0; } } if (!Curl_Data->Ssh_PrivateKeyFileName.empty()) { CURLcode Result=curl_easy_setopt(Curl_Data->Curl, CURLOPT_SSH_PRIVATE_KEYFILE, Curl_Data->Ssh_PrivateKeyFileName.c_str()); if (Result) { #if MEDIAINFO_EVENTS if (Result==CURLE_UNKNOWN_TELNET_OPTION) MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0xF1010101, Reader_libcurl_FileNameWithoutPassword(File_Name)+__T(", The Curl library you use has no support for secure connections.")); else { Ztring MessageString; MessageString.From_Local(Curl_Data->ErrorBuffer); if (MessageString.empty()) MessageString.From_Local(curl_easy_strerror(Result)); MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0, Reader_libcurl_FileNameWithoutPassword(File_Name)+__T(", ")+MessageString); } Curl_Data->ErrorBuffer[0]='\0'; #endif //MEDIAINFO_EVENTS return 0; } } if (!Curl_Data->Ssh_IgnoreSecurity) { CURLcode Result=curl_easy_setopt(Curl_Data->Curl, CURLOPT_SSH_KNOWNHOSTS, Curl_Data->Ssh_KnownHostsFileName.c_str()); if (Result) { #if MEDIAINFO_EVENTS if (Result==CURLE_UNKNOWN_TELNET_OPTION) MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0xF1010102, Reader_libcurl_FileNameWithoutPassword(File_Name)+__T(", The Curl library you use has no support for known_host security file, transfer would not be secure.")); else { Ztring MessageString; MessageString.From_Local(Curl_Data->ErrorBuffer); if (MessageString.empty()) MessageString.From_Local(curl_easy_strerror(Result)); MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0, Reader_libcurl_FileNameWithoutPassword(File_Name)+__T(", ")+MessageString); } Curl_Data->ErrorBuffer[0]='\0'; #endif //MEDIAINFO_EVENTS return 0; } } } if (Protocol==__T("ftps")) { if (!Curl_Data->Ssl_CertificateFileName.empty()) { CURLcode Result=curl_easy_setopt(Curl_Data->Curl, CURLOPT_SSLCERT, Curl_Data->Ssl_CertificateFileName.c_str()); if (Result) { #if MEDIAINFO_EVENTS Ztring MessageString; MessageString.From_Local(Curl_Data->ErrorBuffer); if (MessageString.empty()) MessageString.From_Local(curl_easy_strerror(Result)); Curl_Data->ErrorBuffer[0]='\0'; MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0, Reader_libcurl_FileNameWithoutPassword(File_Name)+__T(", ")+MessageString); #endif //MEDIAINFO_EVENTS return 0; } } if (!Curl_Data->Ssl_CertificateFormat.empty()) { CURLcode Result=curl_easy_setopt(Curl_Data->Curl, CURLOPT_SSLCERTTYPE, Curl_Data->Ssl_CertificateFormat.c_str()); if (Result) { #if MEDIAINFO_EVENTS Ztring MessageString; MessageString.From_Local(Curl_Data->ErrorBuffer); if (MessageString.empty()) MessageString.From_Local(curl_easy_strerror(Result)); Curl_Data->ErrorBuffer[0]='\0'; MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0, Reader_libcurl_FileNameWithoutPassword(File_Name)+__T(", ")+MessageString); #endif //MEDIAINFO_EVENTS return 0; } } if (!Curl_Data->Ssl_PrivateKeyFileName.empty()) { CURLcode Result=curl_easy_setopt(Curl_Data->Curl, CURLOPT_SSLKEY, Curl_Data->Ssl_PrivateKeyFileName.c_str()); if (Result) { #if MEDIAINFO_EVENTS Ztring MessageString; MessageString.From_Local(Curl_Data->ErrorBuffer); if (MessageString.empty()) MessageString.From_Local(curl_easy_strerror(Result)); Curl_Data->ErrorBuffer[0]='\0'; MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0, Reader_libcurl_FileNameWithoutPassword(File_Name)+__T(", ")+MessageString); #endif //MEDIAINFO_EVENTS return 0; } } if (!Curl_Data->Ssl_PrivateKeyFormat.empty()) { CURLcode Result=curl_easy_setopt(Curl_Data->Curl, CURLOPT_SSLKEYTYPE, Curl_Data->Ssl_PrivateKeyFormat.c_str()); if (Result) { #if MEDIAINFO_EVENTS Ztring MessageString; MessageString.From_Local(Curl_Data->ErrorBuffer); if (MessageString.empty()) MessageString.From_Local(curl_easy_strerror(Result)); Curl_Data->ErrorBuffer[0]='\0'; MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0, Reader_libcurl_FileNameWithoutPassword(File_Name)+__T(", ")+MessageString); #endif //MEDIAINFO_EVENTS return 0; } } if (!Curl_Data->Ssl_CertificateAuthorityFileName.empty()) { CURLcode Result=curl_easy_setopt(Curl_Data->Curl, CURLOPT_CAINFO, Curl_Data->Ssl_CertificateAuthorityFileName.c_str()); if (Result) { #if MEDIAINFO_EVENTS Ztring MessageString; MessageString.From_Local(Curl_Data->ErrorBuffer); if (MessageString.empty()) MessageString.From_Local(curl_easy_strerror(Result)); Curl_Data->ErrorBuffer[0]='\0'; MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0, Reader_libcurl_FileNameWithoutPassword(File_Name)+__T(", ")+MessageString); #endif //MEDIAINFO_EVENTS return 0; } } if (!Curl_Data->Ssl_CertificateAuthorityPath.empty()) { CURLcode Result=curl_easy_setopt(Curl_Data->Curl, CURLOPT_CAPATH, Curl_Data->Ssl_CertificateAuthorityPath.c_str()); if (Result) { #if MEDIAINFO_EVENTS Ztring MessageString; MessageString.From_Local(Curl_Data->ErrorBuffer); if (MessageString.empty()) MessageString.From_Local(curl_easy_strerror(Result)); Curl_Data->ErrorBuffer[0]='\0'; MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0, Reader_libcurl_FileNameWithoutPassword(File_Name)+__T(", ")+MessageString); #endif //MEDIAINFO_EVENTS return 0; } } if (!Curl_Data->Ssl_CertificateRevocationListFileName.empty()) { CURLcode Result=curl_easy_setopt(Curl_Data->Curl, CURLOPT_CRLFILE, Curl_Data->Ssl_CertificateRevocationListFileName.c_str()); if (Result) { #if MEDIAINFO_EVENTS Ztring MessageString; MessageString.From_Local(Curl_Data->ErrorBuffer); if (MessageString.empty()) MessageString.From_Local(curl_easy_strerror(Result)); Curl_Data->ErrorBuffer[0]='\0'; MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0, Reader_libcurl_FileNameWithoutPassword(File_Name)+__T(", ")+MessageString); #endif //MEDIAINFO_EVENTS return 0; } } if (Curl_Data->Ssl_IgnoreSecurity) { CURLcode Result=curl_easy_setopt(Curl_Data->Curl, CURLOPT_SSL_VERIFYPEER, 0); if (Result) { #if MEDIAINFO_EVENTS Ztring MessageString; MessageString.From_Local(Curl_Data->ErrorBuffer); if (MessageString.empty()) MessageString.From_Local(curl_easy_strerror(Result)); Curl_Data->ErrorBuffer[0]='\0'; MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0, Reader_libcurl_FileNameWithoutPassword(File_Name)+__T(", ")+MessageString); #endif //MEDIAINFO_EVENTS return 0; } Result=curl_easy_setopt(Curl_Data->Curl, CURLOPT_SSL_VERIFYHOST, 0); if (Result) { #if MEDIAINFO_EVENTS Ztring MessageString; MessageString.From_Local(Curl_Data->ErrorBuffer); if (MessageString.empty()) MessageString.From_Local(curl_easy_strerror(Result)); Curl_Data->ErrorBuffer[0]='\0'; MediaInfoLib::Config.Log_Send(0xC0, 0xFF, 0, Reader_libcurl_FileNameWithoutPassword(File_Name)+__T(", ")+MessageString); #endif //MEDIAINFO_EVENTS return 0; } } } } //Test the format with buffer return Format_Test_PerParser_Continue(MI); } //--------------------------------------------------------------------------- size_t Reader_libcurl::Format_Test_PerParser_Continue (MediaInfo_Internal* MI) { bool StopAfterFilled=MI->Config.File_StopAfterFilled_Get(); bool ShouldContinue=true; #if MEDIAINFO_DEMUX //PerPacket if (ShouldContinue && MI->Config.Demux_EventWasSent) { MI->Config.Demux_EventWasSent=false; Curl_Data->Status=MI->Open_Buffer_Continue(NULL, 0); //Demux if (MI->Config.Demux_EventWasSent) return 2; //Must return immediately //Threading if (MI->IsTerminating()) return 1; //Termination is requested if (Curl_Data->Status[File__Analyze::IsFinished] || (StopAfterFilled && Curl_Data->Status[File__Analyze::IsFilled])) ShouldContinue=false; } #endif //MEDIAINFO_DEMUX if (ShouldContinue) { CURLcode Result=CURLE_WRITE_ERROR; while ((!(Curl_Data->Status[File__Analyze::IsFinished] || (StopAfterFilled && Curl_Data->Status[File__Analyze::IsFilled]))) && Result==CURLE_WRITE_ERROR) { //GoTo if (Curl_Data->MI->Open_Buffer_Continue_GoTo_Get()!=(int64u)-1) { #ifdef MEDIAINFO_DEBUG std::cout<File_Offset-Curl_Data->Debug_BytesRead<<" - "<File_Offset<<" : "<Debug_BytesRead<<" bytes"<Debug_BytesRead=0; Curl_Data->Debug_Count++; #endif //MEDIAINFO_DEBUG CURLcode Code; CURL* Temp=curl_easy_duphandle(Curl_Data->Curl); if (Temp==0) return 0; #if MEDIAINFO_NEXTPACKET if (Curl_Data->CurlM) curl_multi_remove_handle(Curl_Data->CurlM, Curl_Data->Curl); #endif //MEDIAINFO_NEXTPACKET curl_easy_cleanup(Curl_Data->Curl); Curl_Data->Curl=Temp; #if MEDIAINFO_NEXTPACKET if (Curl_Data->CurlM) curl_multi_add_handle(Curl_Data->CurlM, Curl_Data->Curl); #endif //MEDIAINFO_NEXTPACKET if (Curl_Data->MI->Open_Buffer_Continue_GoTo_Get()<0x80000000) { //We do NOT use large version if we can, because some version (tested: 7.15 linux) do NOT like large version (error code 18) long File_GoTo_Long=(long)Curl_Data->MI->Open_Buffer_Continue_GoTo_Get(); Code=curl_easy_setopt(Curl_Data->Curl, CURLOPT_RESUME_FROM, File_GoTo_Long); } else { curl_off_t File_GoTo_Off=(curl_off_t)Curl_Data->MI->Open_Buffer_Continue_GoTo_Get(); Code=curl_easy_setopt(Curl_Data->Curl, CURLOPT_RESUME_FROM_LARGE, File_GoTo_Off); } if (Code==CURLE_OK) MI->Open_Buffer_Init((int64u)-1, Curl_Data->MI->Open_Buffer_Continue_GoTo_Get()); } //Parsing #if MEDIAINFO_NEXTPACKET if (Curl_Data->NextPacket) { int running_handles=0; do { CURLMcode CodeM=curl_multi_perform(Curl_Data->CurlM, &running_handles); if (Result==CURLE_WRITE_ERROR && Curl_Data->Init_NotAFile) { //Not possible to get the file with UTF-8, trying local code page Curl_Data->Init_NotAFile=false; string FileName_String=Ztring(Curl_Data->File_Name).To_Local(); curl_easy_setopt(Curl_Data->Curl, CURLOPT_URL, FileName_String.c_str()); CodeM=curl_multi_perform(Curl_Data->CurlM, &running_handles); } if (CodeM!=CURLM_OK && CodeM!=CURLM_CALL_MULTI_PERFORM) break; //There is a problem #if MEDIAINFO_DEMUX if (MI->Config.Demux_EventWasSent) return 2; //Must return immediately #endif //MEDIAINFO_DEMUX if (running_handles==0) break; //cUrl has finished } while (running_handles); if (running_handles==0 && Curl_Data->MI->Open_Buffer_Continue_GoTo_Get()==(int64u)-1) break; //cUrl has finished Result=CURLE_WRITE_ERROR; //Configuring as if classic method is used } else #endif //MEDIAINFO_NEXTPACKET { Result=curl_easy_perform(Curl_Data->Curl); if (Result==CURLE_WRITE_ERROR && Curl_Data->Init_NotAFile) { //Not possible to get the file with UTF-8, trying local code page Curl_Data->Init_NotAFile=false; string FileName_String=Ztring(Curl_Data->File_Name).To_Local(); curl_easy_setopt(Curl_Data->Curl, CURLOPT_URL, FileName_String.c_str()); Result=curl_easy_perform(Curl_Data->Curl); } } if (Result!=CURLE_OK && Result!=CURLE_WRITE_ERROR) { #if MEDIAINFO_EVENTS Ztring MessageString; int32u MessageCode=0; MessageString.From_Local(Curl_Data->ErrorBuffer); if (MessageString.empty()) MessageString.From_Local(curl_easy_strerror(Result)); if (Result==CURLE_PEER_FAILED_VERIFICATION) { size_t Protocol_Limit=Curl_Data->File_Name.find(__T(":")); if (Protocol_Limit!=string::npos) { Ztring Protocol=Curl_Data->File_Name; Protocol.resize(Protocol_Limit); Protocol.MakeLowerCase(); if (Protocol==__T("sftp") || Protocol==__T("scp")) { MessageString=__T("The remote server's SSH fingerprint was deemed not OK (not in your known_host file)."); MessageCode=0xF1010103; } else if (Protocol==__T("https") || Protocol==__T("ftps")) { MessageString=__T("The remote server's SSL certificate was deemed not OK."); MessageCode=0xF1010104; } } } Curl_Data->ErrorBuffer[0]='\0'; MediaInfoLib::Config.Log_Send(0xC0, 0xFF, MessageCode, Reader_libcurl_FileNameWithoutPassword(Curl_Data->File_Name)+__T(", ")+MessageString); #endif //MEDIAINFO_EVENTS } #if MEDIAINFO_DEMUX if (MI->Config.Demux_EventWasSent) return 2; //Must return immediately #endif //MEDIAINFO_DEMUX //Threading if (MI->IsTerminating()) break; //Termination is requested } } #ifdef MEDIAINFO_DEBUG std::cout<File_Offset-Curl_Data->Debug_BytesRead<<" - "<File_Offset<<" : "<Debug_BytesRead<<" bytes"<Debug_BytesRead_Total<<" bytes in "<Debug_Count<<" blocks"<Status[File__Analyze::IsAccepted]) return 0; MI->Open_Buffer_Finalize(); #if MEDIAINFO_DEMUX if (MI->Config.Demux_EventWasSent) return 2; //Must return immediately #endif //MEDIAINFO_DEMUX return 1; } //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t Reader_libcurl::Format_Test_PerParser_Seek (MediaInfo_Internal* MI, size_t Method, int64u Value, int64u ID) { size_t ToReturn=MI->Open_Buffer_Seek(Method, Value, ID); if (ToReturn==0 || ToReturn==1) { //Reset Curl_Data->Status=0; } return ToReturn; } #endif //MEDIAINFO_SEEK } //NameSpace #endif //MEDIAINFO_LIBCURL_YES MediaInfoLib/Source/MediaInfo/Reader/Reader_libcurl.h100777 0 0 3270 12226004262 16041 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Give information about a lot of media files // Dispatch the file to be tested by all containers // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef Reader_libcurlH #define Reader_libcurlH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Reader/Reader__Base.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** /// @brief Reader_libcurl //*************************************************************************** class Reader_libcurl : public Reader__Base { public : //Constructor/Destructor Reader_libcurl (); virtual ~Reader_libcurl(); //Format testing size_t Format_Test(MediaInfo_Internal* MI, String File_Name); size_t Format_Test_PerParser(MediaInfo_Internal* MI, const String &File_Name); size_t Format_Test_PerParser_Continue (MediaInfo_Internal* MI); size_t Format_Test_PerParser_Seek (MediaInfo_Internal* MI, size_t Method, int64u Value, int64u ID); public: struct curl_data; private : curl_data* Curl_Data; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Reader/Reader_libcurl_Include.h100777 0 0 121443 12226004262 17547 0/* 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. */ //--------------------------------------------------------------------------- #ifndef MediaInfo_Reader_libcurl_IncludeH #define MediaInfo_Reader_libcurl_IncludeH //--------------------------------------------------------------------------- //*************************************************************************** // Copy of curl include files - Easy interface //*************************************************************************** typedef void CURL; typedef enum { CURLE_OK = 0, CURLE_UNSUPPORTED_PROTOCOL, /* 1 */ CURLE_FAILED_INIT, /* 2 */ CURLE_URL_MALFORMAT, /* 3 */ CURLE_OBSOLETE4, /* 4 - NOT USED */ CURLE_COULDNT_RESOLVE_PROXY, /* 5 */ CURLE_COULDNT_RESOLVE_HOST, /* 6 */ CURLE_COULDNT_CONNECT, /* 7 */ CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */ CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server due to lack of access - when login fails this is not returned. */ CURLE_OBSOLETE10, /* 10 - NOT USED */ CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */ CURLE_OBSOLETE12, /* 12 - NOT USED */ CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */ CURLE_FTP_WEIRD_227_FORMAT, /* 14 */ CURLE_FTP_CANT_GET_HOST, /* 15 */ CURLE_OBSOLETE16, /* 16 - NOT USED */ CURLE_FTP_COULDNT_SET_TYPE, /* 17 */ CURLE_PARTIAL_FILE, /* 18 */ CURLE_FTP_COULDNT_RETR_FILE, /* 19 */ CURLE_OBSOLETE20, /* 20 - NOT USED */ CURLE_QUOTE_ERROR, /* 21 - quote command failure */ CURLE_HTTP_RETURNED_ERROR, /* 22 */ CURLE_WRITE_ERROR, /* 23 */ CURLE_OBSOLETE24, /* 24 - NOT USED */ CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */ CURLE_READ_ERROR, /* 26 - couldn't open/read from file */ CURLE_OUT_OF_MEMORY, /* 27 */ /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error instead of a memory allocation error if CURL_DOES_CONVERSIONS is defined */ CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was reached */ CURLE_OBSOLETE29, /* 29 - NOT USED */ CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */ CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */ CURLE_OBSOLETE32, /* 32 - NOT USED */ CURLE_RANGE_ERROR, /* 33 - RANGE "command" didn't work */ CURLE_HTTP_POST_ERROR, /* 34 */ CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */ CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */ CURLE_FILE_COULDNT_READ_FILE, /* 37 */ CURLE_LDAP_CANNOT_BIND, /* 38 */ CURLE_LDAP_SEARCH_FAILED, /* 39 */ CURLE_OBSOLETE40, /* 40 - NOT USED */ CURLE_FUNCTION_NOT_FOUND, /* 41 */ CURLE_ABORTED_BY_CALLBACK, /* 42 */ CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */ CURLE_OBSOLETE44, /* 44 - NOT USED */ CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */ CURLE_OBSOLETE46, /* 46 - NOT USED */ CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */ CURLE_UNKNOWN_TELNET_OPTION, /* 48 - User specified an unknown option */ CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */ CURLE_OBSOLETE50, /* 50 - NOT USED */ CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint wasn't verified fine */ CURLE_GOT_NOTHING, /* 52 - when this is a specific error */ CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */ CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as default */ CURLE_SEND_ERROR, /* 55 - failed sending network data */ CURLE_RECV_ERROR, /* 56 - failure in receiving network data */ CURLE_OBSOLETE57, /* 57 - NOT IN USE */ CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */ CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */ CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */ CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized transfer encoding */ CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */ CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */ CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */ CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind that failed */ CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */ CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not accepted and we failed to login */ CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */ CURLE_TFTP_PERM, /* 69 - permission problem on server */ CURLE_REMOTE_DISK_FULL, /* 70 - out of disk space on server */ CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */ CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */ CURLE_REMOTE_FILE_EXISTS, /* 73 - File already exists */ CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */ CURLE_CONV_FAILED, /* 75 - conversion failed */ CURLE_CONV_REQD, /* 76 - caller must register conversion callbacks using curl_easy_setopt options CURLOPT_CONV_FROM_NETWORK_FUNCTION, CURLOPT_CONV_TO_NETWORK_FUNCTION, and CURLOPT_CONV_FROM_UTF8_FUNCTION */ CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing or wrong format */ CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */ CURLE_SSH, /* 79 - error from the SSH layer, somewhat generic so the error message will be of interest when this has happened */ CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL connection */ CURLE_AGAIN, /* 81 - socket is not ready for send/recv, wait till it's ready and try again (Added in 7.18.2) */ CURLE_SSL_CRL_BADFILE, /* 82 - could not load CRL file, missing or wrong format (Added in 7.19.0) */ CURLE_SSL_ISSUER_ERROR, /* 83 - Issuer check failed. (Added in 7.19.0) */ CURL_LAST /* never use! */ } CURLcode; #define CURLINFO_STRING 0x100000 #define CURLINFO_LONG 0x200000 #define CURLINFO_DOUBLE 0x300000 #define CURLINFO_SLIST 0x400000 #define CURLINFO_MASK 0x0fffff #define CURLINFO_TYPEMASK 0xf00000 typedef enum { CURLINFO_NONE, /* first, never use this */ CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1, CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2, CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3, CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4, CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5, CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6, CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7, CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8, CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9, CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10, CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11, CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12, CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13, CURLINFO_FILETIME = CURLINFO_LONG + 14, CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15, CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16, CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17, CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18, CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19, CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20, CURLINFO_PRIVATE = CURLINFO_STRING + 21, CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22, CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23, CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24, CURLINFO_OS_ERRNO = CURLINFO_LONG + 25, CURLINFO_NUM_CONNECTS = CURLINFO_LONG + 26, CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27, CURLINFO_COOKIELIST = CURLINFO_SLIST + 28, CURLINFO_LASTSOCKET = CURLINFO_LONG + 29, CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30, CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31, CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32, CURLINFO_APPCONNECT_TIME = CURLINFO_DOUBLE + 33, CURLINFO_CERTINFO = CURLINFO_SLIST + 34, CURLINFO_CONDITION_UNMET = CURLINFO_LONG + 35, /* Fill in new entries below here! */ CURLINFO_LASTONE = 35 } CURLINFO; /* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */ #define CURLPROTO_HTTP (1<<0) #define CURLPROTO_HTTPS (1<<1) #define CURLPROTO_FTP (1<<2) #define CURLPROTO_FTPS (1<<3) #define CURLPROTO_SCP (1<<4) #define CURLPROTO_SFTP (1<<5) #define CURLPROTO_TELNET (1<<6) #define CURLPROTO_LDAP (1<<7) #define CURLPROTO_LDAPS (1<<8) #define CURLPROTO_DICT (1<<9) #define CURLPROTO_FILE (1<<10) #define CURLPROTO_TFTP (1<<11) #define CURLPROTO_ALL (~0) /* enable everything */ /* long may be 32 or 64 bits, but we should never depend on anything else but 32 */ #define CURLOPTTYPE_LONG 0 #define CURLOPTTYPE_OBJECTPOINT 10000 #define CURLOPTTYPE_FUNCTIONPOINT 20000 #define CURLOPTTYPE_OFF_T 30000 #define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number /* * This macro-mania below setups the CURLOPT_[what] enum, to be used with * curl_easy_setopt(). The first argument in the CINIT() macro is the [what] * word. */ typedef enum { /* This is the FILE * or void * the regular output should be written to. */ CINIT(FILE, OBJECTPOINT, 1), /* The full URL to get/put */ CINIT(URL, OBJECTPOINT, 2), /* Port number to connect to, if other than default. */ CINIT(PORT, LONG, 3), /* Name of proxy to use. */ CINIT(PROXY, OBJECTPOINT, 4), /* "name:password" to use when fetching. */ CINIT(USERPWD, OBJECTPOINT, 5), /* "name:password" to use with proxy. */ CINIT(PROXYUSERPWD, OBJECTPOINT, 6), /* Range to get, specified as an ASCII string. */ CINIT(RANGE, OBJECTPOINT, 7), /* not used */ /* Specified file stream to upload from (use as input): */ CINIT(INFILE, OBJECTPOINT, 9), /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE * bytes big. If this is not used, error messages go to stderr instead: */ CINIT(ERRORBUFFER, OBJECTPOINT, 10), /* Function that will be called to store the output (instead of fwrite). The * parameters will use fwrite() syntax, make sure to follow them. */ CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11), /* Function that will be called to read the input (instead of fread). The * parameters will use fread() syntax, make sure to follow them. */ CINIT(READFUNCTION, FUNCTIONPOINT, 12), /* Time-out the read operation after this amount of seconds */ CINIT(TIMEOUT, LONG, 13), /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about * how large the file being sent really is. That allows better error * checking and better verifies that the upload was successful. -1 means * unknown size. * * For large file support, there is also a _LARGE version of the key * which takes an off_t type, allowing platforms with larger off_t * sizes to handle larger files. See below for INFILESIZE_LARGE. */ CINIT(INFILESIZE, LONG, 14), /* POST static input fields. */ CINIT(POSTFIELDS, OBJECTPOINT, 15), /* Set the referrer page (needed by some CGIs) */ CINIT(REFERER, OBJECTPOINT, 16), /* Set the FTP PORT string (interface name, named or numerical IP address) Use i.e '-' to use default address. */ CINIT(FTPPORT, OBJECTPOINT, 17), /* Set the User-Agent string (examined by some CGIs) */ CINIT(USERAGENT, OBJECTPOINT, 18), /* If the download receives less than "low speed limit" bytes/second * during "low speed time" seconds, the operations is aborted. * You could i.e if you have a pretty high speed connection, abort if * it is less than 2000 bytes/sec during 20 seconds. */ /* Set the "low speed limit" */ CINIT(LOW_SPEED_LIMIT, LONG, 19), /* Set the "low speed time" */ CINIT(LOW_SPEED_TIME, LONG, 20), /* Set the continuation offset. * * Note there is also a _LARGE version of this key which uses * off_t types, allowing for large file offsets on platforms which * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE. */ CINIT(RESUME_FROM, LONG, 21), /* Set cookie in request: */ CINIT(COOKIE, OBJECTPOINT, 22), /* This points to a linked list of headers, struct curl_slist kind */ CINIT(HTTPHEADER, OBJECTPOINT, 23), /* This points to a linked list of post entries, struct curl_httppost */ CINIT(HTTPPOST, OBJECTPOINT, 24), /* name of the file keeping your private SSL-certificate */ CINIT(SSLCERT, OBJECTPOINT, 25), /* password for the SSL or SSH private key */ CINIT(KEYPASSWD, OBJECTPOINT, 26), /* send TYPE parameter? */ CINIT(CRLF, LONG, 27), /* send linked-list of QUOTE commands */ CINIT(QUOTE, OBJECTPOINT, 28), /* send FILE * or void * to store headers to, if you use a callback it is simply passed to the callback unmodified */ CINIT(WRITEHEADER, OBJECTPOINT, 29), /* point to a file to read the initial cookies from, also enables "cookie awareness" */ CINIT(COOKIEFILE, OBJECTPOINT, 31), /* What version to specifically try to use. See CURL_SSLVERSION defines below. */ CINIT(SSLVERSION, LONG, 32), /* What kind of HTTP time condition to use, see defines */ CINIT(TIMECONDITION, LONG, 33), /* Time to use with the above condition. Specified in number of seconds since 1 Jan 1970 */ CINIT(TIMEVALUE, LONG, 34), /* 35 = OBSOLETE */ /* Custom request, for customizing the get command like HTTP: DELETE, TRACE and others FTP: to use a different list command */ CINIT(CUSTOMREQUEST, OBJECTPOINT, 36), /* HTTP request, for odd commands like DELETE, TRACE and others */ CINIT(STDERR, OBJECTPOINT, 37), /* 38 is not used */ /* send linked-list of post-transfer QUOTE commands */ CINIT(POSTQUOTE, OBJECTPOINT, 39), /* Pass a pointer to string of the output using full variable-replacement as described elsewhere. */ CINIT(WRITEINFO, OBJECTPOINT, 40), CINIT(VERBOSE, LONG, 41), /* talk a lot */ CINIT(HEADER, LONG, 42), /* throw the header out too */ CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */ CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */ CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 300 */ CINIT(UPLOAD, LONG, 46), /* this is an upload */ CINIT(POST, LONG, 47), /* HTTP POST method */ CINIT(DIRLISTONLY, LONG, 48), /* return bare names when listing directories */ CINIT(APPEND, LONG, 50), /* Append instead of overwrite on upload! */ /* Specify whether to read the user+password from the .netrc or the URL. * This must be one of the CURL_NETRC_* enums below. */ CINIT(NETRC, LONG, 51), CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */ CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */ CINIT(PUT, LONG, 54), /* HTTP PUT */ /* 55 = OBSOLETE */ /* Function that will be called instead of the internal progress display * function. This function should be defined as the curl_progress_callback * prototype defines. */ CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56), /* Data passed to the progress callback */ CINIT(PROGRESSDATA, OBJECTPOINT, 57), /* We want the referrer field set automatically when following locations */ CINIT(AUTOREFERER, LONG, 58), /* Port of the proxy, can be set in the proxy string as well with: "[host]:[port]" */ CINIT(PROXYPORT, LONG, 59), /* size of the POST input data, if strlen() is not good to use */ CINIT(POSTFIELDSIZE, LONG, 60), /* tunnel non-http operations through a HTTP proxy */ CINIT(HTTPPROXYTUNNEL, LONG, 61), /* Set the interface string to use as outgoing network interface */ CINIT(INTERFACE, OBJECTPOINT, 62), /* Set the krb4/5 security level, this also enables krb4/5 awareness. This * is a string, 'clear', 'safe', 'confidential' or 'private'. If the string * is set but doesn't match one of these, 'private' will be used. */ CINIT(KRBLEVEL, OBJECTPOINT, 63), /* Set if we should verify the peer in ssl handshake, set 1 to verify. */ CINIT(SSL_VERIFYPEER, LONG, 64), /* The CApath or CAfile used to validate the peer certificate this option is used only if SSL_VERIFYPEER is true */ CINIT(CAINFO, OBJECTPOINT, 65), /* 66 = OBSOLETE */ /* 67 = OBSOLETE */ /* Maximum number of http redirects to follow */ CINIT(MAXREDIRS, LONG, 68), /* Pass a long set to 1 to get the date of the requested document (if possible)! Pass a zero to shut it off. */ CINIT(FILETIME, LONG, 69), /* This points to a linked list of telnet options */ CINIT(TELNETOPTIONS, OBJECTPOINT, 70), /* Max amount of cached alive connections */ CINIT(MAXCONNECTS, LONG, 71), /* What policy to use when closing connections when the cache is filled up */ CINIT(CLOSEPOLICY, LONG, 72), /* 73 = OBSOLETE */ /* Set to explicitly use a new connection for the upcoming transfer. Do not use this unless you're absolutely sure of this, as it makes the operation slower and is less friendly for the network. */ CINIT(FRESH_CONNECT, LONG, 74), /* Set to explicitly forbid the upcoming transfer's connection to be re-used when done. Do not use this unless you're absolutely sure of this, as it makes the operation slower and is less friendly for the network. */ CINIT(FORBID_REUSE, LONG, 75), /* Set to a file name that contains random data for libcurl to use to seed the random engine when doing SSL connects. */ CINIT(RANDOM_FILE, OBJECTPOINT, 76), /* Set to the Entropy Gathering Daemon socket pathname */ CINIT(EGDSOCKET, OBJECTPOINT, 77), /* Time-out connect operations after this amount of seconds, if connects are OK within this time, then fine... This only aborts the connect phase. [Only works on unix-style/SIGALRM operating systems] */ CINIT(CONNECTTIMEOUT, LONG, 78), /* Function that will be called to store headers (instead of fwrite). The * parameters will use fwrite() syntax, make sure to follow them. */ CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79), /* Set this to force the HTTP request to get back to GET. Only really usable if POST, PUT or a custom request have been used first. */ CINIT(HTTPGET, LONG, 80), /* Set if we should verify the Common name from the peer certificate in ssl * handshake, set 1 to check existence, 2 to ensure that it matches the * provided hostname. */ CINIT(SSL_VERIFYHOST, LONG, 81), /* Specify which file name to write all known cookies in after completed operation. Set file name to "-" (dash) to make it go to stdout. */ CINIT(COOKIEJAR, OBJECTPOINT, 82), /* Specify which SSL ciphers to use */ CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83), /* Specify which HTTP version to use! This must be set to one of the CURL_HTTP_VERSION* enums set below. */ CINIT(HTTP_VERSION, LONG, 84), /* Specifically switch on or off the FTP engine's use of the EPSV command. By default, that one will always be attempted before the more traditional PASV command. */ CINIT(FTP_USE_EPSV, LONG, 85), /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */ CINIT(SSLCERTTYPE, OBJECTPOINT, 86), /* name of the file keeping your private SSL-key */ CINIT(SSLKEY, OBJECTPOINT, 87), /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */ CINIT(SSLKEYTYPE, OBJECTPOINT, 88), /* crypto engine for the SSL-sub system */ CINIT(SSLENGINE, OBJECTPOINT, 89), /* set the crypto engine for the SSL-sub system as default the param has no meaning... */ CINIT(SSLENGINE_DEFAULT, LONG, 90), /* Non-zero value means to use the global dns cache */ CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* To become OBSOLETE soon */ /* DNS cache timeout */ CINIT(DNS_CACHE_TIMEOUT, LONG, 92), /* send linked-list of pre-transfer QUOTE commands */ CINIT(PREQUOTE, OBJECTPOINT, 93), /* set the debug function */ CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94), /* set the data for the debug function */ CINIT(DEBUGDATA, OBJECTPOINT, 95), /* mark this as start of a cookie session */ CINIT(COOKIESESSION, LONG, 96), /* The CApath directory used to validate the peer certificate this option is used only if SSL_VERIFYPEER is true */ CINIT(CAPATH, OBJECTPOINT, 97), /* Instruct libcurl to use a smaller receive buffer */ CINIT(BUFFERSIZE, LONG, 98), /* Instruct libcurl to not use any signal/alarm handlers, even when using timeouts. This option is useful for multi-threaded applications. See libcurl-the-guide for more background information. */ CINIT(NOSIGNAL, LONG, 99), /* Provide a CURLShare for mutexing non-ts data */ CINIT(SHARE, OBJECTPOINT, 100), /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default), CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */ CINIT(PROXYTYPE, LONG, 101), /* Set the Accept-Encoding string. Use this to tell a server you would like the response to be compressed. */ CINIT(ENCODING, OBJECTPOINT, 102), /* Set pointer to private data */ CINIT(PRIVATE, OBJECTPOINT, 103), /* Set aliases for HTTP 200 in the HTTP Response header */ CINIT(HTTP200ALIASES, OBJECTPOINT, 104), /* Continue to send authentication (user+password) when following locations, even when hostname changed. This can potentially send off the name and password to whatever host the server decides. */ CINIT(UNRESTRICTED_AUTH, LONG, 105), /* Specifically switch on or off the FTP engine's use of the EPRT command ( it also disables the LPRT attempt). By default, those ones will always be attempted before the good old traditional PORT command. */ CINIT(FTP_USE_EPRT, LONG, 106), /* Set this to a bitmask value to enable the particular authentications methods you like. Use this in combination with CURLOPT_USERPWD. Note that setting multiple bits may cause extra network round-trips. */ CINIT(HTTPAUTH, LONG, 107), /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx in second argument. The function must be matching the curl_ssl_ctx_callback proto. */ CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108), /* Set the userdata for the ssl context callback function's third argument */ CINIT(SSL_CTX_DATA, OBJECTPOINT, 109), /* FTP Option that causes missing dirs to be created on the remote server. In 7.19.4 we introduced the convenience enums for this option using the CURLFTP_CREATE_DIR prefix. */ CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110), /* Set this to a bitmask value to enable the particular authentications methods you like. Use this in combination with CURLOPT_PROXYUSERPWD. Note that setting multiple bits may cause extra network round-trips. */ CINIT(PROXYAUTH, LONG, 111), /* FTP option that changes the timeout, in seconds, associated with getting a response. This is different from transfer timeout time and essentially places a demand on the FTP server to acknowledge commands in a timely manner. */ CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112), /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to tell libcurl to resolve names to those IP versions only. This only has affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */ CINIT(IPRESOLVE, LONG, 113), /* Set this option to limit the size of a file that will be downloaded from an HTTP or FTP server. Note there is also _LARGE version which adds large file support for platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */ CINIT(MAXFILESIZE, LONG, 114), /* See the comment for INFILESIZE above, but in short, specifies * the size of the file being uploaded. -1 means unknown. */ CINIT(INFILESIZE_LARGE, OFF_T, 115), /* Sets the continuation offset. There is also a LONG version of this; * look above for RESUME_FROM. */ CINIT(RESUME_FROM_LARGE, OFF_T, 116), /* Sets the maximum size of data that will be downloaded from * an HTTP or FTP server. See MAXFILESIZE above for the LONG version. */ CINIT(MAXFILESIZE_LARGE, OFF_T, 117), /* Set this option to the file name of your .netrc file you want libcurl to parse (using the CURLOPT_NETRC option). If not set, libcurl will do a poor attempt to find the user's home directory and check for a .netrc file in there. */ CINIT(NETRC_FILE, OBJECTPOINT, 118), /* Enable SSL/TLS for FTP, pick one of: CURLFTPSSL_TRY - try using SSL, proceed anyway otherwise CURLFTPSSL_CONTROL - SSL for the control connection or fail CURLFTPSSL_ALL - SSL for all communication or fail */ CINIT(USE_SSL, LONG, 119), /* The _LARGE version of the standard POSTFIELDSIZE option */ CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120), /* Enable/disable the TCP Nagle algorithm */ CINIT(TCP_NODELAY, LONG, 121), /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ /* 123 OBSOLETE. Gone in 7.16.0 */ /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ /* 127 OBSOLETE. Gone in 7.16.0 */ /* 128 OBSOLETE. Gone in 7.16.0 */ /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option can be used to change libcurl's default action which is to first try "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK response has been received. Available parameters are: CURLFTPAUTH_DEFAULT - let libcurl decide CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL */ CINIT(FTPSSLAUTH, LONG, 129), CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130), CINIT(IOCTLDATA, OBJECTPOINT, 131), /* 132 OBSOLETE. Gone in 7.16.0 */ /* 133 OBSOLETE. Gone in 7.16.0 */ /* zero terminated string for pass on to the FTP server when asked for "account" info */ CINIT(FTP_ACCOUNT, OBJECTPOINT, 134), /* feed cookies into cookie engine */ CINIT(COOKIELIST, OBJECTPOINT, 135), /* ignore Content-Length */ CINIT(IGNORE_CONTENT_LENGTH, LONG, 136), /* Set to non-zero to skip the IP address received in a 227 PASV FTP server response. Typically used for FTP-SSL purposes but is not restricted to that. libcurl will then instead use the same IP address it used for the control connection. */ CINIT(FTP_SKIP_PASV_IP, LONG, 137), /* Select "file method" to use when doing FTP, see the curl_ftpmethod above. */ CINIT(FTP_FILEMETHOD, LONG, 138), /* Local port number to bind the socket to */ CINIT(LOCALPORT, LONG, 139), /* Number of ports to try, including the first one set with LOCALPORT. Thus, setting it to 1 will make no additional attempts but the first. */ CINIT(LOCALPORTRANGE, LONG, 140), /* no transfer, set up connection and let application use the socket by extracting it with CURLINFO_LASTSOCKET */ CINIT(CONNECT_ONLY, LONG, 141), /* Function that will be called to convert from the network encoding (instead of using the iconv calls in libcurl) */ CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142), /* Function that will be called to convert to the network encoding (instead of using the iconv calls in libcurl) */ CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143), /* Function that will be called to convert from UTF8 (instead of using the iconv calls in libcurl) Note that this is used only for SSL certificate processing */ CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144), /* if the connection proceeds too quickly then need to slow it down */ /* limit-rate: maximum number of bytes per second to send or receive */ CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145), CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146), /* Pointer to command string to send if USER/PASS fails. */ CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147), /* callback function for setting socket options */ CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148), CINIT(SOCKOPTDATA, OBJECTPOINT, 149), /* set to 0 to disable session ID re-use for this transfer, default is enabled (== 1) */ CINIT(SSL_SESSIONID_CACHE, LONG, 150), /* allowed SSH authentication methods */ CINIT(SSH_AUTH_TYPES, LONG, 151), /* Used by scp/sftp to do public/private key authentication */ CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152), CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153), /* Send CCC (Clear Command Channel) after authentication */ CINIT(FTP_SSL_CCC, LONG, 154), /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */ CINIT(TIMEOUT_MS, LONG, 155), CINIT(CONNECTTIMEOUT_MS, LONG, 156), /* set to zero to disable the libcurl's decoding and thus pass the raw body data to the application even when it is encoded/compressed */ CINIT(HTTP_TRANSFER_DECODING, LONG, 157), CINIT(HTTP_CONTENT_DECODING, LONG, 158), /* Permission used when creating new files and directories on the remote server for protocols that support it, SFTP/SCP/FILE */ CINIT(NEW_FILE_PERMS, LONG, 159), CINIT(NEW_DIRECTORY_PERMS, LONG, 160), /* Set the behaviour of POST when redirecting. Values must be set to one of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */ CINIT(POSTREDIR, LONG, 161), /* used by scp/sftp to verify the host's public key */ CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162), /* Callback function for opening socket (instead of socket(2)). Optionally, callback is able change the address or refuse to connect returning CURL_SOCKET_BAD. The callback should have type curl_opensocket_callback */ CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163), CINIT(OPENSOCKETDATA, OBJECTPOINT, 164), /* POST volatile input fields. */ CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165), /* set transfer mode (;type=) when doing FTP via an HTTP proxy */ CINIT(PROXY_TRANSFER_MODE, LONG, 166), /* Callback function for seeking in the input stream */ CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167), CINIT(SEEKDATA, OBJECTPOINT, 168), /* CRL file */ CINIT(CRLFILE, OBJECTPOINT, 169), /* Issuer certificate */ CINIT(ISSUERCERT, OBJECTPOINT, 170), /* (IPv6) Address scope */ CINIT(ADDRESS_SCOPE, LONG, 171), /* Collect certificate chain info and allow it to get retrievable with CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only working with OpenSSL-powered builds. */ CINIT(CERTINFO, LONG, 172), /* "name" and "pwd" to use when fetching. */ CINIT(USERNAME, OBJECTPOINT, 173), CINIT(PASSWORD, OBJECTPOINT, 174), /* "name" and "pwd" to use with Proxy when fetching. */ CINIT(PROXYUSERNAME, OBJECTPOINT, 175), CINIT(PROXYPASSWORD, OBJECTPOINT, 176), /* Comma separated list of hostnames defining no-proxy zones. These should match both hostnames directly, and hostnames within a domain. For example, local.com will match local.com and www.local.com, but NOT notlocal.com or www.notlocal.com. For compatibility with other implementations of this, .local.com will be considered to be the same as local.com. A single * is the only valid wildcard, and effectively disables the use of proxy. */ CINIT(NOPROXY, OBJECTPOINT, 177), /* block size for TFTP transfers */ CINIT(TFTP_BLKSIZE, LONG, 178), /* Socks Service */ CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179), /* Socks Service */ CINIT(SOCKS5_GSSAPI_NEC, LONG, 180), /* set the bitmask for the protocols that are allowed to be used for the transfer, which thus helps the app which takes URLs from users or other external inputs and want to restrict what protocol(s) to deal with. Defaults to CURLPROTO_ALL. */ CINIT(PROTOCOLS, LONG, 181), /* set the bitmask for the protocols that libcurl is allowed to follow to, as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs to be set in both bitmasks to be allowed to get redirected to. Defaults to all protocols except FILE and SCP. */ CINIT(REDIR_PROTOCOLS, LONG, 182), /* set the SSH knownhost file name to use */ CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183), /* set the SSH host key callback, must point to a curl_sshkeycallback function */ CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184), /* set the SSH host key callback custom pointer */ CINIT(SSH_KEYDATA, OBJECTPOINT, 185), CURLOPT_LASTENTRY /* the last unused */ } CURLoption; /* three convenient "aliases" that follow the name scheme better */ #define CURLOPT_WRITEDATA CURLOPT_FILE #define CURLOPT_READDATA CURLOPT_INFILE #define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER typedef int64u curl_off_t; //*************************************************************************** // Copy of curl include files - Multi interface //*************************************************************************** typedef void CURLM; typedef enum { CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or curl_multi_socket*() soon */ CURLM_OK, CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */ CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */ CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */ CURLM_INTERNAL_ERROR, /* this is a libcurl bug */ CURLM_BAD_SOCKET, /* the passed in socket argument did not match */ CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */ CURLM_LAST } CURLMcode; typedef enum { CURLVERSION_FIRST, CURLVERSION_SECOND, CURLVERSION_THIRD, CURLVERSION_FOURTH, CURLVERSION_LAST /* never actually use this */ } CURLversion; #define CURLVERSION_NOW CURLVERSION_FOURTH typedef struct { CURLversion age; /* age of the returned struct */ const char *version; /* LIBCURL_VERSION */ unsigned int version_num; /* LIBCURL_VERSION_NUM */ const char *host; /* OS/host/cpu/machine when configured */ int features; /* bitmask, see defines below */ const char *ssl_version; /* human readable string */ long ssl_version_num; /* not used anymore, always 0 */ const char *libz_version; /* human readable string */ /* protocols is terminated by an entry with a NULL protoname */ const char * const *protocols; /* The fields below this were added in CURLVERSION_SECOND */ const char *ares; int ares_num; /* This field was added in CURLVERSION_THIRD */ const char *libidn; /* These field were added in CURLVERSION_FOURTH */ /* Same as '_libiconv_version' if built with HAVE_ICONV */ int iconv_ver_num; const char *libssh_version; /* human readable string */ } curl_version_info_data; #define CURL_ERROR_SIZE 256 //*************************************************************************** // Dynamic load stuff //*************************************************************************** extern "C" { #if defined (_WIN32) || defined (WIN32) #ifdef _UNICODE #define MEDIAINFODLL_NAME L"libcurl.dll" #else //_UNICODE #define MEDIAINFODLL_NAME "libcurl.dll" #endif //_UNICODE #elif defined(__APPLE__) && defined(__MACH__) #define MEDIAINFODLL_NAME "libcurl.0.dylib" #define __stdcall #else #define MEDIAINFODLL_NAME "libcurl.so.0" #define __stdcall #endif //!defined(_WIN32) || defined (WIN32) #ifdef MEDIAINFO_GLIBC #include static GModule* libcurl_Module=NULL; #elif defined (_WIN32) || defined (WIN32) #undef __TEXT #include static HMODULE libcurl_Module=NULL; #else #include static void* libcurl_Module=NULL; #endif size_t libcurl_Module_Count=0; #ifdef MEDIAINFO_GLIBC #define MEDIAINFO_ASSIGN(_Name,_Name2) \ if (!g_module_symbol (libcurl_Module, _Name2, (gpointer*)&_Name)) \ Errors++; #elif defined (_WIN32) || defined (WIN32) #define MEDIAINFO_ASSIGN(_Name,_Name2) \ _Name=(LIBCURL_##_Name)GetProcAddress(libcurl_Module, _Name2); \ if (_Name==NULL) Errors++; #else #define MEDIAINFO_ASSIGN(_Name,_Name2) \ _Name=(LIBCURL_##_Name)dlsym(libcurl_Module, _Name2); \ if (_Name==NULL) Errors++; #endif //--------------------------------------------------------------------------- // Easy interface typedef CURL* (*LIBCURL_curl_easy_init) (); static LIBCURL_curl_easy_init curl_easy_init; typedef CURLcode (*LIBCURL_curl_easy_setopt) (CURL *curl, CURLoption option, ...); static LIBCURL_curl_easy_setopt curl_easy_setopt; typedef CURLcode (*LIBCURL_curl_easy_perform)(CURL *curl); static LIBCURL_curl_easy_perform curl_easy_perform; typedef void (*LIBCURL_curl_easy_cleanup)(CURL *curl); static LIBCURL_curl_easy_cleanup curl_easy_cleanup; typedef CURLcode (*LIBCURL_curl_easy_getinfo)(CURL *curl, CURLINFO info, ...); static LIBCURL_curl_easy_getinfo curl_easy_getinfo; typedef struct curl_slist* (*LIBCURL_curl_slist_append) (struct curl_slist *, const char *); static LIBCURL_curl_slist_append curl_slist_append; typedef void (*LIBCURL_curl_slist_free_all) (struct curl_slist *); static LIBCURL_curl_slist_free_all curl_slist_free_all; typedef CURL* (*LIBCURL_curl_easy_duphandle)(CURL *curl); static LIBCURL_curl_easy_duphandle curl_easy_duphandle; typedef const char* (*LIBCURL_curl_easy_strerror)(CURLcode curlcode); static LIBCURL_curl_easy_strerror curl_easy_strerror; typedef curl_version_info_data* (*LIBCURL_curl_version_info)(CURLversion version); static LIBCURL_curl_version_info curl_version_info; //--------------------------------------------------------------------------- // Multi interface typedef CURLM* (*LIBCURL_curl_multi_init) (); static LIBCURL_curl_multi_init curl_multi_init; typedef CURLMcode (*LIBCURL_curl_multi_add_handle) (CURLM *multi_handle, CURL *curl_handle); static LIBCURL_curl_multi_add_handle curl_multi_add_handle; typedef CURLMcode (*LIBCURL_curl_multi_remove_handle) (CURLM *multi_handle, CURL *curl_handle); static LIBCURL_curl_multi_remove_handle curl_multi_remove_handle; typedef CURLMcode (*LIBCURL_curl_multi_perform)(CURLM *curl, int *running_handles); static LIBCURL_curl_multi_perform curl_multi_perform; typedef void (*LIBCURL_curl_multi_cleanup)(CURLM *curl); static LIBCURL_curl_multi_cleanup curl_multi_cleanup; } #endif MediaInfoLib/Source/MediaInfo/Reader/Reader_libmms.cpp100777 0 0 12276 12226004262 16251 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // Config #ifndef MEDIAINFO_LIBMMS_DESCRIBE_SUPPORT //If not defined by the compiler #define MEDIAINFO_LIBMMS_DESCRIBE_SUPPORT 0 //0=without, 1=with libmms customized version containing DESCRIBE only API #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_LIBMMS_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Reader/Reader_libmms.h" #include "MediaInfo/File__Analyze.h" #if defined LIBMMS_DLL_RUNTIME #elif defined LIBMMS_DLL_STATIC #else #ifdef MEDIAINFO_LIBMMS_FROMSOURCE #include "mmsx.h" #include "mmsh.h" #else //MEDIAINFO_LIBMMS_FROMSOURCE #include "libmms/mmsx.h" #include "libmms/mmsh.h" #endif //MEDIAINFO_LIBMMS_FROMSOURCE #endif #include using namespace ZenLib; using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { const size_t Buffer_NormalSize=64*1024; //*************************************************************************** // libmms stuff //*************************************************************************** //--------------------------------------------------------------------------- size_t Reader_libmms::Format_Test(MediaInfo_Internal* MI, String File_Name) { mmsx_t* Handle; //Opening the file #if MEDIAINFO_LIBMMS_DESCRIBE_SUPPORT if (MI->Config.File_Mmsh_Describe_Only_Get()) { // Use MMSH & Send a DESCRIBE request mmsh_t* MmshHandle; MmshHandle=mmsh_describe_request(0, 0, Ztring(File_Name).To_Local().c_str()); if (MmshHandle==NULL) return 0; Handle=mmsx_set_mmsh_handle(MmshHandle); if (Handle==NULL) { mmsh_close(MmshHandle); return 0; } } else #endif //MEDIAINFO_LIBMMS_DESCRIBE_SUPPORT { // Use MMS or MMSH (Send a DESCRIBE & PLAY request) Handle=mmsx_connect(0, 0, Ztring(File_Name).To_Local().c_str(), (int)-1); if (Handle==NULL) return 0; } //Init size_t Buffer_Size_Max; uint32_t Length; if (!MI->Config.File_Mmsh_Describe_Only_Get()) { //Buffer Buffer_Size_Max=Buffer_NormalSize; //MediaInfo init mms_off_t Offset=mmsx_seek(0, Handle, 0, SEEK_SET); uint32_t Length=mmsx_get_length(Handle); MI->Open_Buffer_Init(Length, File_Name); } else { //Buffer Buffer_Size_Max=mmsx_get_asf_header_len(Handle); //MediaInfo init Length=(uint32_t)-1; MI->Open_Buffer_Init((int64u)-1, File_Name); } int8u* Buffer=new int8u[Buffer_Size_Max]; //Test the format with buffer bool StopAfterFilled=MI->Config.File_StopAfterFilled_Get(); std::bitset<32> Status; do { //Seek (if needed) if (MI->Open_Buffer_Continue_GoTo_Get()!=(int64u)-1) { if (MI->Open_Buffer_Continue_GoTo_Get()>=Length) break; //Seek requested, but on a file bigger in theory than what is in the real file, we can't do this if (mmsx_seek(0, Handle, mms_off_t(MI->Open_Buffer_Continue_GoTo_Get()), SEEK_SET)!=MI->Open_Buffer_Continue_GoTo_Get()) break; //File is not seekable MI->Open_Buffer_Init((int64u)-1, MI->Open_Buffer_Continue_GoTo_Get()); } //Buffering size_t Buffer_Size; if (!MI->Config.File_Mmsh_Describe_Only_Get()) Buffer_Size=mmsx_read(0, Handle, (char*)Buffer, (int)Buffer_Size_Max); else Buffer_Size=mmsx_peek_header(Handle, (char*)Buffer, (int)Buffer_Size_Max); //Parser Status=MI->Open_Buffer_Continue(Buffer, Buffer_Size); if (Buffer_Size==0 || MI->Config.File_Mmsh_Describe_Only_Get()) break; } while (!(Status[File__Analyze::IsFinished] || (StopAfterFilled && Status[File__Analyze::IsFilled]))); //File mmsx_close(Handle); //Buffer delete[] Buffer; //Buffer=NULL; //Is this file detected? if (!Status[File__Analyze::IsAccepted]) return 0; MI->Open_Buffer_Finalize(); return 1; } } //NameSpace #endif //MEDIAINFO_LIBMMS_YES MediaInfoLib/Source/MediaInfo/Reader/Reader_libmms.h100777 0 0 2506 12226004262 15671 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Give information about a lot of media files // Dispatch the file to be tested by all containers // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef Reader_libmmsH #define Reader_libmmsH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Reader/Reader__Base.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** /// @brief Reader_libmms //*************************************************************************** class Reader_libmms : public Reader__Base { public : //Constructor/Destructor virtual ~Reader_libmms() {} //Format testing size_t Format_Test(MediaInfo_Internal* MI, String File_Name); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Reader/Reader__Base.h100777 0 0 3060 12226004262 15413 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Give information about a lot of media files // Dispatch the file to be tested by all containers // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef Reader__BaseH #define Reader__BaseH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/MediaInfo_Internal.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** /// @brief Reader__Base //*************************************************************************** class Reader__Base { public : //Constructor/Destructor virtual ~Reader__Base() {} //Format testing virtual size_t Format_Test(MediaInfo_Internal* MI, String File_Name)=0; virtual size_t Format_Test_PerParser_Continue (MediaInfo_Internal* /*MI*/) {return 0;}; #if MEDIAINFO_SEEK virtual size_t Format_Test_PerParser_Seek (MediaInfo_Internal*, size_t, int64u, int64u) {return 0;}; #endif //MEDIAINFO_SEEK }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Setup.h100777 0 0 75556 12262525402 13065 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // All compilation definitions // Helpers for compilers (precompilation) // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_SetupH #define MediaInfo_SetupH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- //Needed in the whole library #include "ZenLib/Conf.h" //*************************************************************************** // General configuration //*************************************************************************** //--------------------------------------------------------------------------- // Legacy #if defined(MEDIAINFO_MINIMIZESIZE) #if !defined (MEDIAINFO_TRACE_NO) && !defined (MEDIAINFO_TRACE_YES) #define MEDIAINFO_TRACE_NO #endif //#if !defined (MEDIAINFO_FILTER_NO) && !defined (MEDIAINFO_FILTER_YES) // #define MEDIAINFO_FILTER_NO //#endif //#if !defined (MEDIAINFO_DUPLICATE_NO) && !defined (MEDIAINFO_DUPLICATE_YES) // #define MEDIAINFO_DUPLICATE_NO //#endif #if !defined (MEDIAINFO_MACROBLOCKS_NO) && !defined (MEDIAINFO_MACROBLOCKS_YES) #define MEDIAINFO_MACROBLOCKS_NO #endif #if !defined (MEDIAINFO_NEXTPACKET_NO) && !defined (MEDIAINFO_NEXTPACKET_YES) #define MEDIAINFO_NEXTPACKET_NO #endif #if !defined (MEDIAINFO_SEEK_NO) && !defined (MEDIAINFO_SEEK_YES) #define MEDIAINFO_SEEK_NO #endif #if !defined (MEDIAINFO_EVENTS_NO) && !defined (MEDIAINFO_EVENTS_YES) #define MEDIAINFO_EVENTS_NO #endif #if !defined (MEDIAINFO_DEMUX_NO) && !defined (MEDIAINFO_DEMUX_YES) #define MEDIAINFO_DEMUX_NO #endif #if !defined (MEDIAINFO_IBI_NO) && !defined (MEDIAINFO_IBI_YES) #define MEDIAINFO_IBI_NO #endif #endif #if defined(MEDIAINFO_EVENTS) #undef MEDIAINFO_EVENTS #if !defined (MEDIAINFO_EVENTS_NO) && !defined (MEDIAINFO_EVENTS_YES) #define MEDIAINFO_EVENTS_YES #endif #endif //--------------------------------------------------------------------------- // Special configurations #if defined(MEDIAINFO_MINIMAL_YES) #if !defined (MEDIAINFO_TRACE_NO) && !defined (MEDIAINFO_TRACE_YES) #define MEDIAINFO_TRACE_NO #endif #if !defined (MEDIAINFO_FILTER_NO) && !defined (MEDIAINFO_FILTER_YES) #define MEDIAINFO_FILTER_NO #endif #if !defined (MEDIAINFO_DUPLICATE_NO) && !defined (MEDIAINFO_DUPLICATE_YES) #define MEDIAINFO_DUPLICATE_NO #endif #if !defined (MEDIAINFO_MACROBLOCKS_NO) && !defined (MEDIAINFO_MACROBLOCKS_YES) #define MEDIAINFO_MACROBLOCKS_NO #endif #if !defined (MEDIAINFO_NEXTPACKET_NO) && !defined (MEDIAINFO_NEXTPACKET_YES) #define MEDIAINFO_NEXTPACKET_NO #endif #if !defined (MEDIAINFO_SEEK_NO) && !defined (MEDIAINFO_SEEK_YES) #define MEDIAINFO_SEEK_NO #endif #if !defined (MEDIAINFO_EVENTS_NO) && !defined (MEDIAINFO_EVENTS_YES) #define MEDIAINFO_EVENTS_NO #endif #if !defined (MEDIAINFO_DEMUX_NO) && !defined (MEDIAINFO_DEMUX_YES) #define MEDIAINFO_DEMUX_NO #endif #if !defined (MEDIAINFO_IBI_NO) && !defined (MEDIAINFO_IBI_YES) #define MEDIAINFO_IBI_NO #endif #if !defined (MEDIAINFO_DIRECTORY_NO) && !defined (MEDIAINFO_DIRECTORY_YES) #define MEDIAINFO_DIRECTORY_NO #endif #if !defined (MEDIAINFO_LIBCURL_NO) && !defined (MEDIAINFO_LIBCURL_YES) #define MEDIAINFO_LIBCURL_NO #endif #if !defined (MEDIAINFO_LIBMMS_NO) && !defined (MEDIAINFO_LIBMM_YES) #define MEDIAINFO_LIBMMS_NO #endif #if !defined (MEDIAINFO_DVDIF_ANALYZE_NO) && !defined (MEDIAINFO_DVDIF_ANALYZE_YES) #define MEDIAINFO_DVDIF_ANALYZE_NO #endif #if !defined (MEDIAINFO_MPEGTS_DUPLICATE_NO) && !defined (MEDIAINFO_MPEGTS_DUPLICATE_YES) #define MEDIAINFO_MPEGTS_DUPLICATE_NO #endif #endif //--------------------------------------------------------------------------- // Optional features #if !defined(MEDIAINFO_TRACE) #if defined(MEDIAINFO_TRACE_NO) && defined(MEDIAINFO_TRACE_YES) #undef MEDIAINFO_TRACE_NO //MEDIAINFO_TRACE_YES has priority #endif #if defined(MEDIAINFO_TRACE_NO) #define MEDIAINFO_TRACE 0 #else #define MEDIAINFO_TRACE 1 #endif #endif #if !defined(MEDIAINFO_FILTER) #if defined(MEDIAINFO_FILTER_NO) && defined(MEDIAINFO_FILTER_YES) #undef MEDIAINFO_FILTER_NO //MEDIAINFO_FILTER_YES has priority #endif #if defined(MEDIAINFO_FILTER_NO) #define MEDIAINFO_FILTER 0 #else #define MEDIAINFO_FILTER 1 #endif #endif #if !defined(MEDIAINFO_DUPLICATE) #if defined(MEDIAINFO_DUPLICATE_NO) && defined(MEDIAINFO_DUPLICATE_YES) #undef MEDIAINFO_DUPLICATE_NO //MEDIAINFO_DUPLICATE_YES has priority #endif #if defined(MEDIAINFO_DUPLICATE_NO) #define MEDIAINFO_DUPLICATE 0 #else #define MEDIAINFO_DUPLICATE 1 #endif #endif #if !defined(MEDIAINFO_MACROBLOCKS) #if defined(MEDIAINFO_MACROBLOCKS_NO) && defined(MEDIAINFO_MACROBLOCKS_YES) #undef MEDIAINFO_MACROBLOCKS_NO //MEDIAINFO_MACROBLOCKS_YES has priority #endif #if defined(MEDIAINFO_MACROBLOCKS_NO) #define MEDIAINFO_MACROBLOCKS 0 #else #define MEDIAINFO_MACROBLOCKS 1 #endif #endif #if !defined(MEDIAINFO_NEXTPACKET) #if defined(MEDIAINFO_NEXTPACKET_NO) && defined(MEDIAINFO_NEXTPACKET_YES) #undef MEDIAINFO_NEXTPACKET_NO //MEDIAINFO_NEXTPACKET_YES has priority #endif #if defined(MEDIAINFO_NEXTPACKET_NO) #define MEDIAINFO_NEXTPACKET 0 #else #define MEDIAINFO_NEXTPACKET 1 #endif #endif #if !defined(MEDIAINFO_SEEK) #if defined(MEDIAINFO_SEEK_NO) && defined(MEDIAINFO_SEEK_YES) #undef MEDIAINFO_SEEK_NO //MEDIAINFO_SEEK_YES has priority #endif #if defined(MEDIAINFO_SEEK_NO) #define MEDIAINFO_SEEK 0 #else #define MEDIAINFO_SEEK 1 #endif #endif #if !defined(MEDIAINFO_EVENTS) #if defined(MEDIAINFO_EVENTS_NO) && defined(MEDIAINFO_EVENTS_YES) #undef MEDIAINFO_EVENTS_NO //MEDIAINFO_EVENTS_YES has priority #endif #if defined(MEDIAINFO_EVENTS_NO) #define MEDIAINFO_EVENTS 0 #else #define MEDIAINFO_EVENTS 1 #endif #endif #if !defined(MEDIAINFO_ADVANCED) #if defined(MEDIAINFO_ADVANCED_NO) && defined(MEDIAINFO_ADVANCED_YES) #undef MEDIAINFO_ADVANCED_NO //MEDIAINFO_ADVANCED_YES has priority #endif #if defined(MEDIAINFO_ADVANCED_NO) #define MEDIAINFO_ADVANCED 0 #else #define MEDIAINFO_ADVANCED 1 #endif #endif #if !defined(MEDIAINFO_MD5) #if defined(MEDIAINFO_MD5_NO) && defined(MEDIAINFO_MD5_YES) #undef MEDIAINFO_MD5_NO //MEDIAINFO_MD5_YES has priority #endif #if defined(MEDIAINFO_MD5_NO) #define MEDIAINFO_MD5 0 #else #define MEDIAINFO_MD5 1 #endif #endif #if !defined(MEDIAINFO_DEMUX) #if !defined(MEDIAINFO_DEMUX_NO) && !defined(MEDIAINFO_DEMUX_YES) && !MEDIAINFO_EVENTS #define MEDIAINFO_DEMUX_NO //MEDIAINFO_DEMUX is disabled by default if MEDIAINFO_EVENTS is set to 0 #endif #if defined(MEDIAINFO_DEMUX_NO) && defined(MEDIAINFO_DEMUX_YES) #undef MEDIAINFO_DEMUX_NO //MEDIAINFO_DEMUX_YES has priority #endif #if defined(MEDIAINFO_DEMUX_NO) #define MEDIAINFO_DEMUX 0 #else #define MEDIAINFO_DEMUX 1 #endif #endif #if MEDIAINFO_DEMUX && !MEDIAINFO_EVENTS pragma error MEDIAINFO_DEMUX can be set to 1 only if MEDIAINFO_EVENTS is set to 1 #endif #if !defined(MEDIAINFO_IBI) #if defined(MEDIAINFO_IBI_NO) && defined(MEDIAINFO_IBI_YES) #undef MEDIAINFO_IBI_NO //MEDIAINFO_IBI_YES has priority #endif #if defined(MEDIAINFO_IBI_NO) #define MEDIAINFO_IBI 0 #else #define MEDIAINFO_IBI 1 #endif #endif //*************************************************************************** // Precise configuration //*************************************************************************** //--------------------------------------------------------------------------- // Readers #if !defined(MEDIAINFO_READER_NO) && !defined(MEDIAINFO_DIRECTORY_NO) && !defined(MEDIAINFO_DIRECTORY_YES) #define MEDIAINFO_DIRECTORY_YES #endif #if !defined(MEDIAINFO_READER_NO) && !defined(MEDIAINFO_FILE_NO) && !defined(MEDIAINFO_FILE_YES) #define MEDIAINFO_FILE_YES #endif #if !defined(MEDIAINFO_READER_NO) && !defined(MEDIAINFO_LIBCURL_NO) && !defined(MEDIAINFO_LIBCURL_YES) #define MEDIAINFO_LIBCURL_YES #endif #if !defined(MEDIAINFO_READER_NO) && !defined(MEDIAINFO_LIBMMS_NO) && !defined(MEDIAINFO_LIBMMS_YES) #ifndef WINDOWS #define MEDIAINFO_LIBMMS_YES #endif //WINDOWS #endif //--------------------------------------------------------------------------- // All in one for no parsers #if defined(MEDIAINFO_ALL_NO) && !defined(MEDIAINFO_MULTI_NO) #define MEDIAINFO_MULTI_NO #endif #if defined(MEDIAINFO_ALL_NO) && !defined(MEDIAINFO_VIDEO_NO) #define MEDIAINFO_VIDEO_NO #endif #if defined(MEDIAINFO_ALL_NO) && !defined(MEDIAINFO_AUDIO_NO) #define MEDIAINFO_AUDIO_NO #endif #if defined(MEDIAINFO_ALL_NO) && !defined(MEDIAINFO_TEXT_NO) #define MEDIAINFO_TEXT_NO #endif #if defined(MEDIAINFO_ALL_NO) && !defined(MEDIAINFO_IMAGE_NO) #define MEDIAINFO_IMAGE_NO #endif #if defined(MEDIAINFO_ALL_NO) && !defined(MEDIAINFO_ARCHIVE_NO) #define MEDIAINFO_ARCHIVE_NO #endif #if defined(MEDIAINFO_ALL_NO) && !defined(MEDIAINFO_TAG_NO) #define MEDIAINFO_TAG_NO #endif //--------------------------------------------------------------------------- // Multiple #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_REFERENCES_NO) && !defined(MEDIAINFO_REFERENCES_YES) #define MEDIAINFO_REFERENCES_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_AAF_NO) && !defined(MEDIAINFO_AAF_YES) #define MEDIAINFO_AAF_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_ANCILLARY_NO) && !defined(MEDIAINFO_ANCILLARY_YES) #define MEDIAINFO_ANCILLARY_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_BDAV_NO) && !defined(MEDIAINFO_BDAV_YES) #define MEDIAINFO_BDAV_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_BDMV_NO) && !defined(MEDIAINFO_BDMV_YES) #define MEDIAINFO_BDMV_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_CDXA_NO) && !defined(MEDIAINFO_CDXA_YES) #define MEDIAINFO_CDXA_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_DASHMPD_NO) && !defined(MEDIAINFO_DASHMPD_YES) #define MEDIAINFO_DASHMPD_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_DCP_NO) && !defined(MEDIAINFO_DCP_YES) #define MEDIAINFO_DCP_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_DVDIF_NO) && !defined(MEDIAINFO_DVDIF_YES) #define MEDIAINFO_DVDIF_YES #endif #if defined(MEDIAINFO_DVDIF_YES) && !defined(MEDIAINFO_DVDIF_ANALYZE_NO) && !defined(MEDIAINFO_DVDIF_ANALYZE_YES) #define MEDIAINFO_DVDIF_ANALYZE_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_DVDV_NO) && !defined(MEDIAINFO_DVDV_YES) #define MEDIAINFO_DVDV_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_DXW_NO) && !defined(MEDIAINFO_DXW_YES) #define MEDIAINFO_DXW_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_FLV_NO) && !defined(MEDIAINFO_FLV_YES) #define MEDIAINFO_FLV_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_GXF_NO) && !defined(MEDIAINFO_GXF_YES) #define MEDIAINFO_GXF_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_HDSF4M_NO) && !defined(MEDIAINFO_HDSF4M_YES) #define MEDIAINFO_HDSF4M_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_HLS_NO) && !defined(MEDIAINFO_HLS_YES) #define MEDIAINFO_HLS_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_ISM_NO) && !defined(MEDIAINFO_ISM_YES) #define MEDIAINFO_ISM_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_IVF_NO) && !defined(MEDIAINFO_IVF_YES) #define MEDIAINFO_IVF_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_IBI_NO) && !defined(MEDIAINFO_IBI_YES) #define MEDIAINFO_IBI_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_LXF_NO) && !defined(MEDIAINFO_LXF_YES) #define MEDIAINFO_LXF_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_MK_NO) && !defined(MEDIAINFO_MK_YES) #define MEDIAINFO_MK_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_MPEG4_NO) && !defined(MEDIAINFO_MPEG4_YES) #define MEDIAINFO_MPEG4_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_MPEGPS_NO) && !defined(MEDIAINFO_MPEGPS_YES) #define MEDIAINFO_MPEGPS_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_MPEGTS_NO) && !defined(MEDIAINFO_MPEGTS_YES) #define MEDIAINFO_MPEGTS_YES #endif #if defined(MEDIAINFO_MPEGTS_YES) && !defined(MEDIAINFO_MPEGTS_PCR_NO) && !defined(MEDIAINFO_MPEGTS_PCR_YES) #define MEDIAINFO_MPEGTS_PCR_YES #endif #if defined(MEDIAINFO_MPEGTS_YES) && !defined(MEDIAINFO_MPEGTS_PESTIMESTAMP_NO) && !defined(MEDIAINFO_MPEGTS_PESTIMESTAMP_YES) #define MEDIAINFO_MPEGTS_PESTIMESTAMP_YES #endif #if defined(MEDIAINFO_MPEGTS_YES) && !defined(MEDIAINFO_MPEGTS_DUPLICATE_NO) && !defined(MEDIAINFO_MPEGTS_DUPLICATE_YES) #define MEDIAINFO_MPEGTS_DUPLICATE_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_MXF_NO) && !defined(MEDIAINFO_MXF_YES) #define MEDIAINFO_MXF_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_NUT_NO) && !defined(MEDIAINFO_NUT_YES) #define MEDIAINFO_NUT_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_OGG_NO) && !defined(MEDIAINFO_OGG_YES) #define MEDIAINFO_OGG_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_P2_NO) && !defined(MEDIAINFO_P2_YES) #define MEDIAINFO_P2_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_PMP_NO) && !defined(MEDIAINFO_PMP_YES) #define MEDIAINFO_PMP_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_PTX_NO) && !defined(MEDIAINFO_PTX_YES) #define MEDIAINFO_PTX_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_RIFF_NO) && !defined(MEDIAINFO_RIFF_YES) #define MEDIAINFO_RIFF_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_RM_NO) && !defined(MEDIAINFO_RM_YES) #define MEDIAINFO_RM_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_SEQUENCEINFO_NO) && !defined(MEDIAINFO_SEQUENCEINFO_YES) #define MEDIAINFO_SEQUENCEINFO_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_SKM_NO) && !defined(MEDIAINFO_SKM_YES) #define MEDIAINFO_SKM_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_SWF_NO) && !defined(MEDIAINFO_SWF_YES) #define MEDIAINFO_SWF_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_TSP_NO) && !defined(MEDIAINFO_TSP_YES) #define MEDIAINFO_TSP_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_UMF_NO) && !defined(MEDIAINFO_UMF_YES) #define MEDIAINFO_UMF_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_WM_NO) && !defined(MEDIAINFO_WM_YES) #define MEDIAINFO_WM_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_XDCAM_NO) && !defined(MEDIAINFO_XDCAM_YES) #define MEDIAINFO_XDCAM_YES #endif #if !defined(MEDIAINFO_MULTI_NO) && !defined(MEDIAINFO_DPG_NO) && !defined(MEDIAINFO_DPG_YES) #define MEDIAINFO_DPG_YES #endif //--------------------------------------------------------------------------- // Video #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_AIC_NO) && !defined(MEDIAINFO_AIC_YES) #define MEDIAINFO_AIC_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_AFDBARDATA_NO) && !defined(MEDIAINFO_AFDBARDATA_YES) #define MEDIAINFO_AFDBARDATA_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_AVC_NO) && !defined(MEDIAINFO_AVC_YES) #define MEDIAINFO_AVC_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_AVSV_NO) && !defined(MEDIAINFO_AVSV_YES) #define MEDIAINFO_AVSV_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_CANOPUS_NO) && !defined(MEDIAINFO_CANOPUS_YES) #define MEDIAINFO_CANOPUS_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_DIRAC_NO) && !defined(MEDIAINFO_DIRAC_YES) #define MEDIAINFO_DIRAC_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_FLIC_NO) && !defined(MEDIAINFO_FLIC_YES) #define MEDIAINFO_FLIC_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_FRAPS_NO) && !defined(MEDIAINFO_FRAPS_YES) #define MEDIAINFO_FRAPS_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_H263_NO) && !defined(MEDIAINFO_H263_YES) #define MEDIAINFO_H263_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_HEVC_NO) && !defined(MEDIAINFO_HEVC_YES) #define MEDIAINFO_HEVC_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_LAGARITH_NO) && !defined(MEDIAINFO_LAGARITH_YES) #define MEDIAINFO_LAGARITH_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_MPEG4V_NO) && !defined(MEDIAINFO_MPEG4V_YES) #define MEDIAINFO_MPEG4V_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_MPEGV_NO) && !defined(MEDIAINFO_MPEGV_YES) #define MEDIAINFO_MPEGV_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_PRORES_NO) && !defined(MEDIAINFO_PRORES_YES) #define MEDIAINFO_PRORES_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_VC1_NO) && !defined(MEDIAINFO_VC1_YES) #define MEDIAINFO_VC1_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_VC3_NO) && !defined(MEDIAINFO_VC3_YES) #define MEDIAINFO_VC3_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_TIMECODE_NO) && !defined(MEDIAINFO_TIMECODE_YES) #define MEDIAINFO_TIMECODE_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_THEORA_NO) && !defined(MEDIAINFO_THEORA_YES) #define MEDIAINFO_THEORA_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_VP8_NO) && !defined(MEDIAINFO_VP8_YES) #define MEDIAINFO_VP8_YES #endif #if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_Y4M_NO) && !defined(MEDIAINFO_Y4M_YES) #define MEDIAINFO_Y4M_YES #endif //--------------------------------------------------------------------------- // Audio #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_AAC_NO) && !defined(MEDIAINFO_AAC_YES) #define MEDIAINFO_AAC_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_AC3_NO) && !defined(MEDIAINFO_AC3_YES) #define MEDIAINFO_AC3_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_ADPCM_NO) && !defined(MEDIAINFO_ADPCM_YES) #define MEDIAINFO_ADPCM_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_ALS_NO) && !defined(MEDIAINFO_ALS_YES) #define MEDIAINFO_ALS_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_LATM_NO) && !defined(MEDIAINFO_LATM_YES) #define MEDIAINFO_LATM_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_AMR_NO) && !defined(MEDIAINFO_AMR_YES) #define MEDIAINFO_AMR_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_AMV_NO) && !defined(MEDIAINFO_AMV_YES) #define MEDIAINFO_AMV_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_APE_NO) && !defined(MEDIAINFO_APE_YES) #define MEDIAINFO_APE_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_AU_NO) && !defined(MEDIAINFO_AU_YES) #define MEDIAINFO_AU_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_CELT_NO) && !defined(MEDIAINFO_CELT_YES) #define MEDIAINFO_CELT_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_DOLBYE_NO) && !defined(MEDIAINFO_DOLBYE_YES) #define MEDIAINFO_DOLBYE_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_DTS_NO) && !defined(MEDIAINFO_DTS_YES) #define MEDIAINFO_DTS_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_FLAC_NO) && !defined(MEDIAINFO_FLAC_YES) #define MEDIAINFO_FLAC_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_IT_NO) && !defined(MEDIAINFO_IT_YES) #define MEDIAINFO_IT_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_LA_NO) && !defined(MEDIAINFO_LA_YES) #define MEDIAINFO_LA_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_MIDO_NO) && !defined(MEDIAINFO_MIDO_YES) #define MEDIAINFO_MIDI_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_MOD_NO) && !defined(MEDIAINFO_MOD_YES) #define MEDIAINFO_MOD_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_MPC_NO) && !defined(MEDIAINFO_MPC_YES) #define MEDIAINFO_MPC_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_MPCSV8_NO) && !defined(MEDIAINFO_MPCSV8_YES) #define MEDIAINFO_MPCSV8_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_MPEGA_NO) && !defined(MEDIAINFO_MPEGA_YES) #define MEDIAINFO_MPEGA_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_OPUS_NO) && !defined(MEDIAINFO_OPUS_YES) #define MEDIAINFO_OPUS_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_PCM_NO) && !defined(MEDIAINFO_PCM_YES) #define MEDIAINFO_PCM_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_PCMM2TS_NO) && !defined(MEDIAINFO_PCMM2TS_YES) #define MEDIAINFO_PCMM2TS_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_PCMVOB_NO) && !defined(MEDIAINFO_PCMVOB_YES) #define MEDIAINFO_PCMVOB_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_PS2A_NO) && !defined(MEDIAINFO_PS2A_YES) #define MEDIAINFO_PS2A_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_RKAU_NO) && !defined(MEDIAINFO_RKAU_YES) #define MEDIAINFO_RKAU_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_S3M_NO) && !defined(MEDIAINFO_S3M_YES) #define MEDIAINFO_S3M_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_SPEEX_NO) && !defined(MEDIAINFO_SPEEX_YES) #define MEDIAINFO_SPEEX_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_SMPTEST0302_NO) && !defined(MEDIAINFO_SMPTEST0302_YES) #define MEDIAINFO_SMPTEST0302_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_SMPTEST0331_NO) && !defined(MEDIAINFO_SMPTEST0331_YES) #define MEDIAINFO_SMPTEST0331_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_SMPTEST0337_NO) && !defined(MEDIAINFO_SMPTEST0337_YES) #define MEDIAINFO_SMPTEST0337_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_TAK_NO) && !defined(MEDIAINFO_TAK_YES) #define MEDIAINFO_TAK_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_TTA_NO) && !defined(MEDIAINFO_TTA_YES) #define MEDIAINFO_TTA_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_TWINVQ_NO) && !defined(MEDIAINFO_TWINVQ_YES) #define MEDIAINFO_TWINVQ_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_VORBIS_NO) && !defined(MEDIAINFO_VORBIS_YES) #define MEDIAINFO_VORBIS_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_WVPK_NO) && !defined(MEDIAINFO_WVPK_YES) #define MEDIAINFO_WVPK_YES #endif #if !defined(MEDIAINFO_AUDIO_NO) && !defined(MEDIAINFO_XM_NO) && !defined(MEDIAINFO_XM_YES) #define MEDIAINFO_XM_YES #endif //--------------------------------------------------------------------------- // Text #if !defined(MEDIAINFO_TEXT_NO) && !defined(MEDIAINFO_ARIBSTDB24B37_NO) && !defined(MEDIAINFO_ARIBSTDB24B37_YES) #define MEDIAINFO_ARIBSTDB24B37_YES #endif #if !defined(MEDIAINFO_TEXT_NO) && !defined(MEDIAINFO_CDP_NO) && !defined(MEDIAINFO_CDP_YES) #define MEDIAINFO_CDP_YES #endif #if !defined(MEDIAINFO_TEXT_NO) && !defined(MEDIAINFO_CMML_NO) && !defined(MEDIAINFO_CMML_YES) #define MEDIAINFO_CMML_YES #endif #if !defined(MEDIAINFO_TEXT_NO) && !defined(MEDIAINFO_DVBSUBTITLE_NO) && !defined(MEDIAINFO_DVBSUBTITLE_YES) #define MEDIAINFO_DVBSUBTITLE_YES #endif #if !defined(MEDIAINFO_TEXT_NO) && !defined(MEDIAINFO_DTVCCTRANSPORT_NO) && !defined(MEDIAINFO_DTVCCTRANSPORT_YES) #define MEDIAINFO_DTVCCTRANSPORT_YES #endif #if !defined(MEDIAINFO_TEXT_NO) && !defined(MEDIAINFO_EIA608_NO) && !defined(MEDIAINFO_EIA608_YES) #define MEDIAINFO_EIA608_YES #endif #if !defined(MEDIAINFO_TEXT_NO) && !defined(MEDIAINFO_EIA708_NO) && !defined(MEDIAINFO_EIA708_YES) #define MEDIAINFO_EIA708_YES #endif #if !defined(MEDIAINFO_TEXT_NO) && !defined(MEDIAINFO_N19_NO) && !defined(MEDIAINFO_N19_YES) #define MEDIAINFO_N19_YES #endif #if !defined(MEDIAINFO_TEXT_NO) && !defined(MEDIAINFO_KATE_NO) && !defined(MEDIAINFO_KATE_YES) #define MEDIAINFO_KATE_YES #endif #if !defined(MEDIAINFO_TEXT_NO) && !defined(MEDIAINFO_PGS_NO) && !defined(MEDIAINFO_PGS_YES) #define MEDIAINFO_PGS_YES #endif #if !defined(MEDIAINFO_TEXT_NO) && !defined(MEDIAINFO_SCC_NO) && !defined(MEDIAINFO_SCC_YES) #define MEDIAINFO_SCC_YES #endif #if !defined(MEDIAINFO_TEXT_NO) && !defined(MEDIAINFO_SCTE20_NO) && !defined(MEDIAINFO_SCTE20_YES) #define MEDIAINFO_SCTE20_YES #endif #if !defined(MEDIAINFO_TEXT_NO) && !defined(MEDIAINFO_SUBRIP_NO) && !defined(MEDIAINFO_SUBRIP_YES) #define MEDIAINFO_SUBRIP_YES #endif #if !defined(MEDIAINFO_TEXT_NO) && !defined(MEDIAINFO_TELETEXT_NO) && !defined(MEDIAINFO_TELETEXT_YES) #define MEDIAINFO_TELETEXT_YES #endif #if !defined(MEDIAINFO_TEXT_NO) && !defined(MEDIAINFO_TIMEDTEXT_NO) && !defined(MEDIAINFO_TIMEDTEXT_YES) #define MEDIAINFO_TIMEDTEXT_YES #endif #if !defined(MEDIAINFO_TEXT_NO) && !defined(MEDIAINFO_TTML_NO) && !defined(MEDIAINFO_TTML_YES) #define MEDIAINFO_TTML_YES #endif #if !defined(MEDIAINFO_TEXT_NO) && !defined(MEDIAINFO_OTHERTEXT_NO) && !defined(MEDIAINFO_OTHERTEXT_YES) #define MEDIAINFO_OTHERTEXT_YES #endif //--------------------------------------------------------------------------- // Image #if !defined(MEDIAINFO_IMAGE_NO) && !defined(MEDIAINFO_BMP_NO) && !defined(MEDIAINFO_BMP_YES) #define MEDIAINFO_BMP_YES #endif #if !defined(MEDIAINFO_IMAGE_NO) && !defined(MEDIAINFO_DPX_NO) && !defined(MEDIAINFO_DPX_YES) #define MEDIAINFO_DPX_YES #endif #if !defined(MEDIAINFO_IMAGE_NO) && !defined(MEDIAINFO_EXR_NO) && !defined(MEDIAINFO_EXR_YES) #define MEDIAINFO_EXR_YES #endif #if !defined(MEDIAINFO_IMAGE_NO) && !defined(MEDIAINFO_GIF_NO) && !defined(MEDIAINFO_GIF_YES) #define MEDIAINFO_GIF_YES #endif #if !defined(MEDIAINFO_IMAGE_NO) && !defined(MEDIAINFO_ICO_NO) && !defined(MEDIAINFO_ICO_YES) #define MEDIAINFO_ICO_YES #endif #if !defined(MEDIAINFO_IMAGE_NO) && !defined(MEDIAINFO_JPEG_NO) && !defined(MEDIAINFO_JPEG_YES) #define MEDIAINFO_JPEG_YES #endif #if !defined(MEDIAINFO_IMAGE_NO) && !defined(MEDIAINFO_PCX_NO) && !defined(MEDIAINFO_PCX_YES) #define MEDIAINFO_PCX_YES #endif #if !defined(MEDIAINFO_IMAGE_NO) && !defined(MEDIAINFO_PNG_NO) && !defined(MEDIAINFO_PNG_YES) #define MEDIAINFO_PNG_YES #endif #if !defined(MEDIAINFO_IMAGE_NO) && !defined(MEDIAINFO_PSD_NO) && !defined(MEDIAINFO_PSD_YES) #define MEDIAINFO_PSD_YES #endif #if !defined(MEDIAINFO_IMAGE_NO) && !defined(MEDIAINFO_RLE_NO) && !defined(MEDIAINFO_RLE_YES) #define MEDIAINFO_RLE_YES #endif #if !defined(MEDIAINFO_IMAGE_NO) && !defined(MEDIAINFO_TIFF_NO) && !defined(MEDIAINFO_TIFF_YES) #define MEDIAINFO_TIFF_YES #endif #if !defined(MEDIAINFO_IMAGE_NO) && !defined(MEDIAINFO_TGA_NO) && !defined(MEDIAINFO_TGA_YES) #define MEDIAINFO_TGA_YES #endif //--------------------------------------------------------------------------- // Archive #if !defined(MEDIAINFO_ARCHIVE_NO) && !defined(MEDIAINFO_7Z_NO) && !defined(MEDIAINFO_7Z_YES) #define MEDIAINFO_7Z_YES #endif #if !defined(MEDIAINFO_ARCHIVE_NO) && !defined(MEDIAINFO_ACE_NO) && !defined(MEDIAINFO_ACE_YES) #define MEDIAINFO_ACE_YES #endif #if !defined(MEDIAINFO_ARCHIVE_NO) && !defined(MEDIAINFO_BZIP2_NO) && !defined(MEDIAINFO_BZIP2_YES) #define MEDIAINFO_BZIP2_YES #endif #if !defined(MEDIAINFO_ARCHIVE_NO) && !defined(MEDIAINFO_ELF_NO) && !defined(MEDIAINFO_ELF_YES) #define MEDIAINFO_ELF_YES #endif #if !defined(MEDIAINFO_ARCHIVE_NO) && !defined(MEDIAINFO_GZIP_NO) && !defined(MEDIAINFO_GZIP_YES) #define MEDIAINFO_GZIP_YES #endif #if !defined(MEDIAINFO_ARCHIVE_NO) && !defined(MEDIAINFO_ISO9660_NO) && !defined(MEDIAINFO_ISO9660_YES) #define MEDIAINFO_ISO9660_YES #endif #if !defined(MEDIAINFO_ARCHIVE_NO) && !defined(MEDIAINFO_MZ_NO) && !defined(MEDIAINFO_MZ_YES) #define MEDIAINFO_MZ_YES #endif #if !defined(MEDIAINFO_ARCHIVE_NO) && !defined(MEDIAINFO_RAR_NO) && !defined(MEDIAINFO_RAR_YES) #define MEDIAINFO_RAR_YES #endif #if !defined(MEDIAINFO_ARCHIVE_NO) && !defined(MEDIAINFO_TAR_NO) && !defined(MEDIAINFO_TAR_YES) #define MEDIAINFO_TAR_YES #endif #if !defined(MEDIAINFO_ARCHIVE_NO) && !defined(MEDIAINFO_ZIP_NO) && !defined(MEDIAINFO_ZIP_YES) #define MEDIAINFO_ZIP_YES #endif //--------------------------------------------------------------------------- // Tag #if !defined(MEDIAINFO_TAG_NO) && !defined(MEDIAINFO_TAG_NO) && !defined(MEDIAINFO_TAG_YES) #define MEDIAINFO_TAG_YES #endif #if !defined(MEDIAINFO_TAG_NO) && !defined(MEDIAINFO_APETAG_NO) && !defined(MEDIAINFO_APETAG_YES) #define MEDIAINFO_APETAG_YES #endif #if !defined(MEDIAINFO_TAG_NO) && !defined(MEDIAINFO_ID3_NO) && !defined(MEDIAINFO_ID3_YES) #define MEDIAINFO_ID3_YES #endif #if !defined(MEDIAINFO_TAG_NO) && !defined(MEDIAINFO_ID3V2_NO) && !defined(MEDIAINFO_ID3V2_YES) #define MEDIAINFO_ID3V2_YES #endif #if !defined(MEDIAINFO_TAG_NO) && !defined(MEDIAINFO_LYRICS3_NO) && !defined(MEDIAINFO_LYRICS3_YES) #define MEDIAINFO_LYRICS3_YES #endif #if !defined(MEDIAINFO_TAG_NO) && !defined(MEDIAINFO_LYRICS3V2_NO) && !defined(MEDIAINFO_LYRICS3V2_YES) #define MEDIAINFO_LYRICS3V2_YES #endif #if !defined(MEDIAINFO_TAG_NO) && !defined(MEDIAINFO_VORBISCOM_NO) && !defined(MEDIAINFO_VORBISCOM_YES) #define MEDIAINFO_VORBISCOM_YES #endif //--------------------------------------------------------------------------- // Other #if !defined(MEDIAINFO_DUMMY_NO) //#define MEDIAINFO_DUMMY_YES #endif #if !defined(MEDIAINFO_OTHER_NO) #define MEDIAINFO_OTHER_YES #endif #if !defined(MEDIAINFO_UNKNOWN_NO) #define MEDIAINFO_UNKNOWN_YES #endif #endif MediaInfoLib/Source/MediaInfo/Tag/ 40777 0 0 0 12226004262 12161 5MediaInfoLib/Source/MediaInfo/Tag/File_ApeTag.cpp100777 0 0 21673 12226004262 15116 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_APETAG_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Tag/File_ApeTag.h" #include #include using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- void File_ApeTag::FileHeader_Parse() { //Parsing int64u Signature; Peek_B8(Signature); if (Signature==0x4150455441474558LL) //"APETAGEX" HeaderFooter(); //v2 FILLING_BEGIN(); Accept("ApeTag"); Stream_Prepare(Stream_General); Stream_Prepare(Stream_Audio); FILLING_END(); } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- bool File_ApeTag::Header_Begin() { if (Buffer_Size<0x20) return false; //At least 32 bytes are needed for footer return true; } //--------------------------------------------------------------------------- void File_ApeTag::Header_Parse() { //Testing if begin or end of tags if (CC8(Buffer+Buffer_Offset)==0x4150455441474558LL) //"APETAGEX" { //Filling Header_Fill_Code((int64u)-1, "File Footer"); Header_Fill_Size(0x20); return; } //Parsing Ztring Value; int32u Flags, Length; Get_L4 (Length, "Length"); Get_L4 (Flags, "Flags"); Skip_Flags(Flags, 0, "Read Only"); Skip_Flags(Flags, 1, "Binary"); Skip_Flags(Flags, 2, "Locator of external stored information"); Skip_Flags(Flags, 29, "Is the header"); Skip_Flags(Flags, 30, "Contains a footer"); Skip_Flags(Flags, 31, "Contains a header"); size_t Pos=(size_t)Element_Offset; for (; Pos using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* Id3v2_TextEnc[]= { "ISO 8859-1", "UTF-16", "UTF-16BE", "UTF-8", }; //--------------------------------------------------------------------------- const char* Id3v2_RGAD_Name_code[]= { "", "Radio Gain Adjustment", "Audiophile Gain Adjustment", "", "", "", "", "", }; //--------------------------------------------------------------------------- const char* Id3v2_RGAD_Originator_code[]= { "", "Pre-set by artist/producer/mastering engineer", "Set by user", "Determined automatically", "", "", "", "", }; //*************************************************************************** // Constants //*************************************************************************** namespace Elements { const int32u AENC=0x41454E47; const int32u APIC=0x41504943; const int32u ASPI=0x41535049; const int32u COMM=0x434F4D4D; const int32u COMR=0x434F4D52; const int32u ENCR=0x454E4352; const int32u EQU2=0x45515532; const int32u EQUA=0x45515541; const int32u ETCO=0x4554434F; const int32u GEOB=0x47454F42; const int32u GRID=0x47524944; const int32u IPLS=0x49504C53; const int32u LINK=0x4C494E4B; const int32u MCDI=0x4D434449; const int32u MLLT=0x4D4C4C54; const int32u OWNE=0x4F574E45; const int32u PCNT=0x50434E58; const int32u POPM=0x504F504D; const int32u POSS=0x504F5353; const int32u PRIV=0x50524956; const int32u RBUF=0x52425546; const int32u RGAD=0x52474144; const int32u RVA2=0x52564132; const int32u RVRB=0x52565242; const int32u SEEK=0x5345454B; const int32u SIGN=0x5349474E; const int32u SYLT=0x53594C54; const int32u SYTC=0x53595443; const int32u TALB=0x54414C42; const int32u TBPM=0x5442504D; const int32u TCMP=0x54434D50; const int32u TCOM=0x54434F4D; const int32u TCON=0x54434F4E; const int32u TCOP=0x54434F50; const int32u TDAT=0x54444154; const int32u TDEN=0x5444454E; const int32u TDLY=0x54444C59; const int32u TDOR=0x54444F52; const int32u TDRC=0x54445243; const int32u TDRL=0x5444524C; const int32u TDTG=0x54445447; const int32u TENC=0x54454E43; const int32u TEXT=0x54455854; const int32u TFLT=0x54464C54; const int32u TIME=0x54494D45; const int32u TIPL=0x5449504C; const int32u TIT1=0x54495431; const int32u TIT2=0x54495432; const int32u TIT3=0x54495433; const int32u TKEY=0x544B4559; const int32u TLAN=0x544C414E; const int32u TLEN=0x544C454E; const int32u TMCL=0x544D434C; const int32u TMED=0x544D4544; const int32u TMOO=0x544D4F4F; const int32u TOAL=0x544F414C; const int32u TOFN=0x544F464E; const int32u TOLY=0x544F4C59; const int32u TOPE=0x544F5045; const int32u TORY=0x544F5259; const int32u TOWN=0x544F574E; const int32u TPE1=0x54504531; const int32u TPE2=0x54504532; const int32u TPE3=0x54504533; const int32u TPE4=0x54504534; const int32u TPOS=0x54504F53; const int32u TPRO=0x5450524F; const int32u TPUB=0x54505542; const int32u TRCK=0x5452434B; const int32u TRDA=0x54524441; const int32u TRSN=0x5452534E; const int32u TRSO=0x5452534F; const int32u TSIZ=0x5453495A; const int32u TSO2=0x54534F32; const int32u TSOA=0x54534F41; const int32u TSOC=0x54534F43; const int32u TSOP=0x54534F50; const int32u TSOT=0x54534F54; const int32u TSRC=0x54535243; const int32u TSSE=0x54535345; const int32u TSST=0x54535354; const int32u TXXX=0x54585858; const int32u TYER=0x54594552; const int32u UFID=0x55464944; const int32u USER=0x55534552; const int32u USLT=0x55534C54; const int32u WCOM=0x57434F4D; const int32u WCOP=0x57434F50; const int32u WOAF=0x574F4146; const int32u WOAR=0x574F4152; const int32u WOAS=0x574F4153; const int32u WORS=0x574F5253; const int32u WPAY=0x57504159; const int32u WPUB=0x57505542; const int32u WXXX=0x57585858; const int32u XRVA=0x58525641; const int32u BUF=0x425546; const int32u CNT=0x434E56; const int32u COM=0x434F4D; const int32u CRA=0x435241; const int32u CRM=0x43524D; const int32u EQU=0x455155; const int32u ETC=0x455443; const int32u GEO=0x47454F; const int32u IPL=0x49504C; const int32u LNK=0x4C4E4B; const int32u MCI=0x4D4349; const int32u MLL=0x4D4C4C; const int32u PIC_=0x504943; //PIC is used by shared libs in GCC const int32u POP=0x504F50; const int32u REV=0x524556; const int32u RVA=0x525641; const int32u SLT=0x534C54; const int32u STC=0x535443; const int32u TAL=0x54414C; const int32u TBP=0x544250; const int32u TCM=0x54434D; const int32u TCO=0x54434F; const int32u TCP=0x544350; const int32u TCR=0x544352; const int32u TDA=0x544441; const int32u TDY=0x544459; const int32u TEN=0x54454E; const int32u TFT=0x544654; const int32u TIM=0x54494D; const int32u TKE=0x544B45; const int32u TLA=0x544C41; const int32u TLE=0x544C45; const int32u TMT=0x544D54; const int32u TOA=0x544F41; const int32u TOF=0x544F46; const int32u TOL=0x544F4C; const int32u TOR=0x544F52; const int32u TOT=0x544F54; const int32u TP1=0x545031; const int32u TP2=0x545032; const int32u TP3=0x545033; const int32u TP4=0x545034; const int32u TPA=0x545041; const int32u TPB=0x545042; const int32u TRC=0x545243; const int32u TRD=0x545244; const int32u TRK=0x54524B; const int32u TSI=0x545349; const int32u TSS=0x545353; const int32u TT1=0x545431; const int32u TT2=0x545432; const int32u TT3=0x545433; const int32u TXT=0x545854; const int32u TXX=0x545858; const int32u TYE=0x545945; const int32u UFI=0x554649; const int32u ULT=0x554C54; const int32u WAF=0x574146; const int32u WAR=0x574152; const int32u WAS=0x574153; const int32u WCM=0x57434D; const int32u WCP=0x574350; const int32u WPB=0x575042; const int32u WXX=0x575858; } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Id3v2::File_Id3v2() :File__Analyze() { //Temp Id3v2_Size=0; } //*************************************************************************** // Static stuff //*************************************************************************** //--------------------------------------------------------------------------- bool File_Id3v2::Static_Synchronize_Tags(const int8u* Buffer, size_t Buffer_Offset, size_t Buffer_Size, bool &Tag_Found) { //Buffer size if (Buffer_Offset+3>Buffer_Size) return false; //ID Tag_Found=CC3(Buffer+Buffer_Offset)==0x494433; //"ID3" //Continue return true; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Id3v2::Streams_Fill() { if (Count_Get(Stream_General)==0) return; //Specific formats (multiple Id3v2 tags for one MI tag) if (Retrieve(Stream_General, 0, General_Recorded_Date).empty() && !Year.empty()) { Ztring Recorded_Date=Year; if (!Month.empty()) { Recorded_Date+=__T('-'); Recorded_Date+=Month; if (!Day.empty()) { Recorded_Date+=__T('-'); Recorded_Date+=Day; if (!Hour.empty()) { Recorded_Date+=__T(' '); Recorded_Date+=Hour; if (!Minute.empty()) { Recorded_Date+=__T(':'); Recorded_Date+=Minute; } } } } Fill(Stream_General, 0, General_Recorded_Date, Recorded_Date); } } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- void File_Id3v2::FileHeader_Parse() { //Parsing int32u Size; int8u Flags; bool ExtendedHeader; Skip_C3( "identifier"); Get_B1 (Id3v2_Version, "version_major"); Skip_B1( "version_revision"); Get_B1 (Flags, "flags"); Get_Flags (Flags, 7, Unsynchronisation_Global, "Unsynchronisation"); Get_Flags (Flags, 6, ExtendedHeader, "Extended header"); Skip_Flags(Flags, 5, "Experimental indicator"); Get_B4 (Size, "Size"); Id3v2_Size=((Size>>0)&0x7F) | ((Size>>1)&0x3F80) | ((Size>>2)&0x1FC000) | ((Size>>3)&0x0FE00000); Param_Info1(Id3v2_Size); if (ExtendedHeader) { Element_Begin1("Extended header"); int32u Size_Extended; Get_B4 (Size_Extended, "Size"); Skip_XX(Size_Extended, "Extended header"); Element_End0(); } FILLING_BEGIN(); //Versions switch (Id3v2_Version) { case 2 : break; case 3 : break; case 4 : break; default : Skip_XX(Id3v2_Size, "Data"); return; } Accept("Id3v2"); Stream_Prepare(Stream_General); Stream_Prepare(Stream_Audio); FILLING_END(); } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Id3v2::Header_Parse() { Unsynchronisation_Frame=false; DataLengthIndicator=false; if (Id3v2_Size<10) //first 10 is minimum size of a tag, Second 10 is ID3v2 header size { //Not enough place for a tag, must be padding Header_Fill_Code((int64u)-1, "Padding"); Header_Fill_Size(Id3v2_Size); return; } if (Buffer_Offset+10>Buffer_Size) { Element_WaitForMoreData(); return; //Not enough buffer } //Testing padding int32u Frame_ID, Size; Frame_ID=CC1(Buffer+Buffer_Offset); if (Frame_ID==0x00) { //This is the padding Header_Fill_Code(0xFFFFFFFF, "Padding"); Header_Fill_Size(Id3v2_Size); return; } //Parsing if (Id3v2_Version==2) { Get_C3 (Frame_ID, "Frame ID"); Get_B3 (Size, "Size"); } else { int16u Flags; Get_C4 (Frame_ID, "Frame ID"); Get_B4 (Size, "Size"); if (Id3v2_Version!=3) { Size=((Size>>0)&0x7F) | ((Size>>1)&0x3F80) | ((Size>>2)&0x1FC000) | ((Size>>3)&0x0FE00000); Param_Info2(Size, " bytes"); } Get_B2 (Flags, "Flags"); if (Id3v2_Version==3) { Skip_Flags(Flags, 15, "Tag alter preservation"); Skip_Flags(Flags, 14, "File alter preservation"); Skip_Flags(Flags, 13, "Read only"); Skip_Flags(Flags, 7, "Compression"); Skip_Flags(Flags, 6, "Encryption"); Skip_Flags(Flags, 5, "Grouping identity"); } if (Id3v2_Version==4) { Skip_Flags(Flags, 14, "Tag alter preservation"); Skip_Flags(Flags, 13, "File alter preservation"); Skip_Flags(Flags, 12, "Read only"); Skip_Flags(Flags, 6, "Grouping identity"); Skip_Flags(Flags, 3, "Compression"); Skip_Flags(Flags, 2, "Encryption"); Get_Flags (Flags, 1, Unsynchronisation_Frame, "Unsynchronisation"); Get_Flags (Flags, 0, DataLengthIndicator, "Data length indicator"); } } //Hanlding Unsynchronisation if (Unsynchronisation_Global || Unsynchronisation_Frame) { if (Buffer_Offset+(size_t)Element_Offset+Size>Buffer_Size) { Element_WaitForMoreData(); return; } for (size_t Element_Offset_Unsynch=0; Element_Offset_Unsynch+2Buffer_Size) { Element_WaitForMoreData(); return; } } } //Filling Ztring ToShow; if (Id3v2_Version==2) ToShow.From_CC3(Frame_ID); else ToShow.From_CC4(Frame_ID); Header_Fill_Code(Frame_ID, ToShow); Header_Fill_Size(Element_Offset+Size); } //--------------------------------------------------------------------------- void File_Id3v2::Data_Parse() { Id3v2_Size-=Header_Size+Element_Size; int32u DataLength=(int32u)-1; if (DataLengthIndicator) { Get_B4 (DataLength, "Data length"); DataLength=((DataLength>>0)&0x7F) | ((DataLength>>1)&0x3F80) | ((DataLength>>2)&0x1FC000) | ((DataLength>>3)&0x0FE00000); Param_Info2(DataLength, " bytes"); } //Unsynchronisation int8u* Buffer_Unsynch=NULL; const int8u* Save_Buffer=Buffer; int64u Save_File_Offset=File_Offset; size_t Save_Buffer_Offset=Buffer_Offset; int64u Save_Element_Size=Element_Size; int64u Element_Offset_Unsynch=Element_Offset; std::vector Unsynch_List; if (Unsynchronisation_Global || Unsynchronisation_Frame) { while (Element_Offset_Unsynch+2=Element_Size) return; //Problem switch (Encoding) { case 0 : Get_ISO_8859_1 (Value0_Size, Element_Values(0), "Short_content_descrip"); break; case 3 : Get_UTF8 (Value0_Size, Element_Values(0), "Short_content_descrip"); break; default : ; } Skip_B1( "Null"); switch (Encoding) { case 0 : Get_ISO_8859_1 (Element_Size-Element_Offset, Element_Values(1), "The_actual_text"); break; case 3 : Get_UTF8 (Element_Size-Element_Offset, Element_Values(1), "The_actual_text"); break; default : ; } break; case 1 : case 2 : //2-byte char while (Element_Offset+Value0_Size+1=Element_Size) return; //Problem switch (Encoding) { case 1 : Get_UTF16 (Value0_Size, Element_Values(0), "Short_content_descrip"); break; case 2 : Get_UTF16B(Value0_Size, Element_Values(0), "Short_content_descrip"); break; default : ; } Skip_B2( "Null"); switch (Encoding) { case 1 : Get_UTF16 (Element_Size-Element_Offset, Element_Values(1), "The_actual_text"); break; case 2 : Get_UTF16B(Element_Size-Element_Offset, Element_Values(1), "The_actual_text"); break; default : ; } break; default: //Unknown Skip_XX(Element_Size-Element_Offset, "Unknown"); ; } } //--------------------------------------------------------------------------- void File_Id3v2::W___() { Get_ISO_8859_1(Element_Size, Element_Value, "URL"); //Filling Fill_Name(); } //--------------------------------------------------------------------------- void File_Id3v2::W__X() { if (Element_Size<1) return; //Problem int8u Encoding; Get_B1 (Encoding, "Text_encoding"); switch (Encoding) { case 0 : Get_ISO_8859_1 (Element_Size-1, Element_Values(0), "Description"); break; case 1 : Get_UTF16 (Element_Size-1, Element_Values(0), "Description"); break; case 2 : Get_UTF16B (Element_Size-1, Element_Values(0), "Description"); break; case 3 : Get_UTF8 (Element_Size-1, Element_Values(0), "Description"); break; default : ; } Element_Offset=1; switch (Encoding) { case 0 : Element_Offset+=Element_Values(0).size()+1; break; //NULL case 1 : Element_Offset+=Element_Values(0).size()*2+4; break; //UTF-16 BOM + UTF-16 NULL case 2 : Element_Offset+=Element_Values(0).size()*2+2; break; //UTF-16 NULL case 3 : Element_Offset+=Element_Values(0).To_UTF8().size()+1; break; //UTF-8 NULL default : ; } if (Element_OffsetElement_Size) return; //There is a problem std::string Data_Raw((const char*)(Buffer+(size_t)(Buffer_Offset+Element_Offset)), (size_t)(Element_Size-Element_Offset)); std::string Data_Base64(Base64::encode(Data_Raw)); //Filling Fill_Name(); Fill(Stream_General, 0, General_Cover_Description, Description); Fill(Stream_General, 0, General_Cover_Type, Id3v2_PictureType(PictureType)); Fill(Stream_General, 0, General_Cover_Mime, Mime); Fill(Stream_General, 0, General_Cover_Data, Data_Base64); } //--------------------------------------------------------------------------- void File_Id3v2::COMM() { T__X(); //Testing if (Element_Values(0)==__T("iTunes_CDDB_IDs")) return; else if (Element_Values(0)==__T("iTunNORM")) return; else if (Element_Values(0)==__T("iTunSMPB")) return; else if (Element_Values(0)==__T("Songs-DB_Tempo")) return; else if (Element_Values(0)==__T("Songs-DB_Preference")) return; else if (Element_Values(0)==__T("MusicMatch_Tempo")) return; else if (Element_Values(0)==__T("MusicMatch_Mood")) { if (Retrieve(Stream_General, 0, General_Mood).empty()) Element_Values(0)==__T("Mood"); else return; } else if (Element_Values(0)==__T("MusicMatch_Preference")) return; //Filling if (Element_Values(0).empty()) { if (Element_Values(1).find(__T("ExactAudioCopy"))==0) { Fill(Stream_General, 0, General_Encoded_Application, Element_Values(1)); return; } Element_Values(0)=__T("Comment"); } Fill_Name(); } //--------------------------------------------------------------------------- void File_Id3v2::RGAD() { //Parsing float32 Peak_Amplitude; Get_BF4 (Peak_Amplitude, "Peak Amplitude"); while (Element_Offset+2<=Element_Size) { Element_Begin1("Gain Adjustement"); int16u Replay_Gain_Adjustment; int8u Name_code; bool Sign_bit; BS_Begin(); Get_S1 (3, Name_code, "Name code"); Param_Info1(Id3v2_RGAD_Name_code[Name_code]); Info_S1(3, Originator_code, "Originator code"); Param_Info1(Id3v2_RGAD_Originator_code[Originator_code]); Get_SB (Sign_bit, "Sign bit"); Get_S2 (9, Replay_Gain_Adjustment, "Replay Gain Adjustment"); Param_Info3 ((Sign_bit?-1:1)*(float)Replay_Gain_Adjustment/10, 1, " dB"); BS_End(); Element_End0(); FILLING_BEGIN(); switch (Name_code) { case 1 : if (Retrieve(Stream_Audio, 0, Audio_ReplayGain_Gain).empty()) //this tag is not precise, we prefer other RG tags Fill(Stream_Audio, 0, Audio_ReplayGain_Gain, (Sign_bit?-1:1)*(float)Replay_Gain_Adjustment/10, 1); case 2 : if (Retrieve(Stream_General, 0, General_Album_ReplayGain_Gain).empty()) //this tag is not precise, we prefer other RG tags Fill(Stream_General, 0, General_Album_ReplayGain_Gain, (Sign_bit?-1:1)*(float)Replay_Gain_Adjustment/10, 1); } FILLING_END(); } FILLING_BEGIN(); if (Peak_Amplitude && Retrieve(Stream_Audio, 0, Audio_ReplayGain_Peak).empty()) //this tag is not precise, we prefer other RG tags Fill(Stream_Audio, 0, Audio_ReplayGain_Peak, Peak_Amplitude, 6); FILLING_END(); } //--------------------------------------------------------------------------- void File_Id3v2::PRIV() { //Parsing Ztring Owner; Get_ISO_8859_1(Element_Size, Owner, "Owner identifier"); Element_Offset=Owner.size()+1; Skip_XX(Element_Size-Element_Offset, "Data"); } //--------------------------------------------------------------------------- void File_Id3v2::USLT() { T__X(); //Filling if (!Element_Values(0).empty()) Element_Values(1)=Element_Values(0)+MediaInfoLib::Config.Language_Get(__T(": "))+Element_Values(1); Element_Values(0)=__T("Lyrics"); Fill_Name(); } //--------------------------------------------------------------------------- void File_Id3v2::TXXX() { T__X(); //Filling if (Element_Values(0).empty()) Element_Values(0)=__T("Comment"); Fill_Name(); } //--------------------------------------------------------------------------- void File_Id3v2::SYLT() { if (Element_Size<6) { Skip_XX(Element_Size, "(Problem)"); return; } int8u Encoding; Get_B1 (Encoding, "Text encoding"); Skip_C3( "Language"); Skip_B1( "Time_stamp_format"); Skip_B1( "Content_type"); switch (Encoding) { case 0 : Get_ISO_8859_1 (Element_Size-6, Element_Value, "Short_content_descrip"); break; case 1 : Get_UTF16 (Element_Size-6, Element_Value, "Short_content_descrip"); break; case 2 : Get_UTF16B (Element_Size-6, Element_Value, "Short_content_descrip"); break; case 3 : Get_UTF8 (Element_Size-6, Element_Value, "Short_content_descrip"); break; default : ; } //Filling Fill_Name(); } //--------------------------------------------------------------------------- void File_Id3v2::WXXX() { W__X(); //Filling if (Element_Values(1).empty()) return; if (Element_Values(0).empty()) Element_Values(0)=__T("URL"); Fill_Name(); } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- void File_Id3v2::Fill_Name() { Ztring Value=Ztring().From_CC4((int32u)Element_Code); if (MediaInfoLib::Config.CustomMapping_IsPresent(__T("Id3v2"), Value)) { Fill(Stream_General, 0, MediaInfoLib::Config.CustomMapping_Get(__T("Id3v2"), Value).To_Local().c_str(), Element_Value); return; } switch (Element_Code) { case Elements::AENC : break; case Elements::APIC : Fill(Stream_General, 0, General_Cover, "Yes"); break; case Elements::ASPI : break; case Elements::COMM : Fill(Stream_General, 0, Element_Values(0).To_UTF8().c_str(), Element_Values(1)); break; case Elements::COMR : Fill(Stream_General, 0, "Commercial frame", Element_Value); break; case Elements::ENCR : break; case Elements::EQU2 : break; case Elements::EQUA : break; case Elements::ETCO : break; case Elements::GEOB : break; case Elements::GRID : Fill(Stream_General, 0, "Group identification registration", Element_Value); break; case Elements::IPLS : Fill(Stream_General, 0, "Involved people list", Element_Value); break; case Elements::LINK : Fill(Stream_General, 0, "Linked information", Element_Value); break; case Elements::MCDI : Fill(Stream_General, 0, "MCDI", "Yes"); break; case Elements::MLLT : break; case Elements::OWNE : Fill(Stream_General, 0, General_Owner, Element_Value); break; case Elements::PCNT : break; case Elements::POPM : break; case Elements::POSS : break; case Elements::PRIV : break; case Elements::RBUF : break; case Elements::RVA2 : break; case Elements::RVRB : break; case Elements::SEEK : break; case Elements::SIGN : break; case Elements::SYLT : Fill(Stream_General, 0, General_Lyrics, Element_Value); break; case Elements::SYTC : break; case Elements::TALB : Fill(Stream_General, 0, General_Album, Element_Value); break; case Elements::TBPM : Fill(Stream_General, 0, General_BPM, Element_Value); break; case Elements::TCMP : Fill(Stream_General, 0, General_Compilation, Element_Value); break; case Elements::TCOM : Fill(Stream_General, 0, General_Composer, Element_Value); break; case Elements::TCON : { if (Element_Value.find(__T("("))==0) Element_Value=Element_Value.SubString(__T("("), __T(")")); //Replace (nn) by nn if (Element_Value==__T("0") || Element_Value==__T("255")) Element_Value.clear(); Fill(Stream_General, 0, General_Genre, Element_Value); } break; case Elements::TCOP : Fill(Stream_General, 0, General_Copyright, Element_Value); break; case Elements::TDA : case Elements::TDAT : if (Element_Value.size()==4) { Month.assign(Element_Value.c_str(), 0, 2); Day.assign (Element_Value.c_str(), 2, 2); break; } case Elements::TDEN : Normalize_Date(Element_Value); Fill(Stream_General, 0, "Encoded_Date", Element_Value); break; case Elements::TDLY : break; case Elements::TDOR : Normalize_Date(Element_Value); Fill(Stream_General, 0, "Original/Released_Date", Element_Value); break; case Elements::TDRC : Normalize_Date(Element_Value); Fill(Stream_General, 0, General_Recorded_Date, Element_Value); break; case Elements::TDRL : Normalize_Date(Element_Value); Fill(Stream_General, 0, General_Released_Date, Element_Value); break; case Elements::TDTG : Normalize_Date(Element_Value); Fill(Stream_General, 0, General_Tagged_Date, Element_Value); break; case Elements::TENC : Fill(Stream_General, 0, General_EncodedBy, Element_Value); break; case Elements::TEXT : Fill(Stream_General, 0, General_Lyricist, Element_Value); break; case Elements::TFLT : Fill(Stream_General, 0, "File type", Element_Value); break; case Elements::TIM : case Elements::TIME : if (Element_Value.size()==4) { Hour.assign (Element_Value.c_str(), 0, 2); Minute.assign(Element_Value.c_str(), 2, 2); break; } case Elements::TIPL : Fill(Stream_General, 0, General_ThanksTo, Element_Value); break; case Elements::TIT1 : Fill(Stream_General, 0, General_Grouping, Element_Value); break; case Elements::TIT2 : Fill(Stream_General, 0, General_Track, Element_Value); break; case Elements::TIT3 : Fill(Stream_General, 0, General_Track_More, Element_Value); break; case Elements::TKEY : Fill(Stream_General, 0, "Initial key", Element_Value); break; case Elements::TLAN : Fill(Stream_Audio, 0, Audio_Language, Element_Value); break; case Elements::TLEN : break; //Fill(Stream_General, 0, "Length", Element_Value); break; case Elements::TMCL : Fill(Stream_General, 0, "Musician Credit List", Element_Value); break; case Elements::TMED : Fill(Stream_General, 0, "Media Type", Element_Value); break; case Elements::TMOO : Fill(Stream_General, 0, "Mood", Element_Value); break; case Elements::TOAL : Fill(Stream_General, 0, "Original/Album", Element_Value); break; case Elements::TOFN : Fill(Stream_General, 0, "Original/FileName", Element_Value); break; case Elements::TOLY : Fill(Stream_General, 0, "Original/Lyricist", Element_Value); break; case Elements::TOPE : Fill(Stream_General, 0, "Original/Performer", Element_Value); break; case Elements::TORY : Normalize_Date(Element_Value); Fill(Stream_General, 0, "Original/Released_Date", Element_Value); break; case Elements::TOWN : Fill(Stream_General, 0, General_Owner, Element_Value); break; case Elements::TPE1 : Fill(Stream_General, 0, General_Performer, Element_Value); break; case Elements::TPE2 : Fill(Stream_General, 0, General_Album_Performer, Element_Value); break; case Elements::TPE3 : Fill(Stream_General, 0, General_Conductor, Element_Value); break; case Elements::TPE4 : Fill(Stream_General, 0, General_RemixedBy, Element_Value); break; case Elements::TPOS : { ZtringList List; List.Separator_Set(0, __T("/")); List.Write(Element_Value); if (!List(0).empty()) Fill(Stream_General, 0, General_Part_Position, List(0)); if (!List(1).empty()) Fill(Stream_General, 0, General_Part_Position_Total, List(1)); } break; case Elements::TPRO : Fill(Stream_General, 0, General_Producer_Copyright, Element_Value); break; case Elements::TPUB : Fill(Stream_General, 0, General_Publisher, Element_Value); break; case Elements::TRCK : { ZtringList List; List.Separator_Set(0, __T("/")); List.Write(Element_Value); if (!List(0).empty()) Fill(Stream_General, 0, General_Track_Position, List(0)); if (!List(1).empty()) Fill(Stream_General, 0, General_Track_Position_Total, List(1)); } break; case Elements::TRDA : Normalize_Date(Element_Value); Fill(Stream_General, 0, "Recorded_Date", Element_Value); break; case Elements::TRSN : Fill(Stream_General, 0, General_ServiceName, Element_Value); break; case Elements::TRSO : Fill(Stream_General, 0, General_ServiceProvider, Element_Value); break; case Elements::TSIZ : Fill(Stream_General, 0, "Size", Element_Value); break; case Elements::TSO2 : Fill(Stream_General, 0, General_Performer_Sort, Element_Value); break; case Elements::TSOA : Fill(Stream_General, 0, General_Album_Sort, Element_Value); break; case Elements::TSOC : Fill(Stream_General, 0, "Composer/Sort", Element_Value); break; case Elements::TSOP : Fill(Stream_General, 0, General_Performer_Sort, Element_Value); break; case Elements::TSOT : Fill(Stream_General, 0, General_Track_Sort, Element_Value); break; case Elements::TSRC : Fill(Stream_General, 0, General_ISRC, Element_Value); break; case Elements::TSSE : Fill(Stream_General, 0, General_Encoded_Library, Element_Value); break; case Elements::TSST : Fill(Stream_General, 0, "Set subtitle", Element_Value); break; case Elements::TXXX : if (Element_Values(0)==__T("AccurateRipResult")) ; else if (Element_Values(0)==__T("AccurateRipDiscID")) ; else if (Element_Values(0)==__T("CT_GAPLESS_DATA")) ; else if (Element_Values(0)==__T("DISCNUMBER")) Fill(Stream_General, 0, General_Part_Position, Element_Values(1), true); else if (Element_Values(0)==__T("DISCTOTAL")) Fill(Stream_General, 0, General_Part_Position_Total, Element_Values(1), true); else if (Element_Values(0)==__T("first_played_timestamp")) Fill(Stream_General, 0, General_Played_First_Date, Ztring().Date_From_Milliseconds_1601(Element_Values(1).To_int64u()/10000)); else if (Element_Values(0)==__T("last_played_timestamp")) Fill(Stream_General, 0, General_Played_Last_Date, Ztring().Date_From_Milliseconds_1601(Element_Values(1).To_int64u()/10000)); else if (Element_Values(0)==__T("play_count")) Fill(Stream_General, 0, General_Played_Count, Element_Values(1).To_int64u()); else if (Element_Values(0)==__T("added_timestamp")) Fill(Stream_General, 0, General_Added_Date, Ztring().Date_From_Milliseconds_1601(Element_Values(1).To_int64u()/10000)); else if (Element_Values(0)==__T("replaygain_album_gain")) Fill(Stream_General, 0, General_Album_ReplayGain_Gain, Element_Values(1).To_float64(), 2, true); else if (Element_Values(0)==__T("replaygain_album_peak")) Fill(Stream_General, 0, General_Album_ReplayGain_Peak, Element_Values(1).To_float64(), 6, true); else if (Element_Values(0)==__T("replaygain_track_gain")) Fill(Stream_Audio, 0, Audio_ReplayGain_Gain, Element_Values(1).To_float64(), 2, true); else if (Element_Values(0)==__T("replaygain_track_peak")) Fill(Stream_Audio, 0, Audio_ReplayGain_Peak, Element_Values(1).To_float64(), 6, true); else if (Element_Values(0)==__T("TRACKTOTAL")) Fill(Stream_General, 0, General_Track_Position_Total, Element_Values(1), true); else Fill(Stream_General, 0, Element_Values(0).To_UTF8().c_str(), Element_Values(1)); break; case Elements::TYER : Year=Element_Value; break; case Elements::UFID : Fill(Stream_Audio, 0, "UID", Element_Value); break; case Elements::USER : Fill(Stream_General, 0, General_TermsOfUse, Element_Value); break; case Elements::USLT : Fill(Stream_General, 0, Element_Values(0).To_UTF8().c_str(), Element_Values(1)); break; case Elements::WCOM : Fill(Stream_General, 0, "Commercial information", Element_Value); break; case Elements::WCOP : Fill(Stream_General, 0, "Copyright/Legal information", Element_Value); break; case Elements::WOAF : Fill(Stream_General, 0, "Official audio file webpage", Element_Value); break; case Elements::WOAR : Fill(Stream_General, 0, "Performer/Url", Element_Value); break; case Elements::WOAS : Fill(Stream_General, 0, "Official audio source webpage", Element_Value); break; case Elements::WORS : Fill(Stream_General, 0, General_Service_Url, Element_Value); break; case Elements::WPAY : Fill(Stream_General, 0, "Payment", Element_Value); break; case Elements::WPUB : Fill(Stream_General, 0, "Publisher/Url", Element_Value); break; case Elements::WXXX : Fill(Stream_General, 0, Element_Values(0).To_UTF8().c_str(), Element_Values(1)); break; case Elements::BUF : break; case Elements::CNT : break; case Elements::COM : Fill(Stream_General, 0, Element_Values(0).To_UTF8().c_str(), Element_Values(1)); break; case Elements::CRA : break; case Elements::CRM : break; case Elements::EQU : break; case Elements::ETC : break; case Elements::GEO : break; case Elements::IPL : Fill(Stream_General, 0, "Involved people list", Element_Value); break; case Elements::LNK : Fill(Stream_General, 0, "Linked information,", Element_Value); break; case Elements::MCI : Fill(Stream_General, 0, "MCDI", Element_Value); break; case Elements::MLL : break; case Elements::PIC_ : Fill(Stream_General, 0, "Cover", "Yes"); break; case Elements::POP : break; case Elements::REV : break; case Elements::RVA : break; case Elements::SLT : break; case Elements::STC : break; case Elements::TAL : Fill(Stream_General, 0, "Album", Element_Value); break; case Elements::TBP : Fill(Stream_General, 0, "BPM", Element_Value); break; case Elements::TCM : Fill(Stream_General, 0, "Composer", Element_Value); break; case Elements::TCO : { if (Element_Value.find(__T("("))==0) Element_Value=Element_Value.SubString(__T("("), __T(")")); //Replace (nn) by nn if (Element_Value==__T("0") || Element_Value==__T("255")) Element_Value.clear(); if (!Element_Value.empty()) Fill(Stream_General, 0, General_Genre, Element_Value); } break; case Elements::TCR : Fill(Stream_General, 0, "Copyright", Element_Value); break; case Elements::TDY : break; case Elements::TEN : Fill(Stream_General, 0, "Encoded_Library", Element_Value); break; case Elements::TFT : Fill(Stream_General, 0, "File type", Element_Value); break; case Elements::TKE : Fill(Stream_General, 0, "Initial key", Element_Value); break; case Elements::TLA : Fill(Stream_Audio, 0, Audio_Language, Element_Value); break; case Elements::TLE : break; case Elements::TMT : Fill(Stream_General, 0, "Media type", Element_Value); break; case Elements::TOA : Fill(Stream_General, 0, "Original/Performer", Element_Value); break; case Elements::TOF : Fill(Stream_General, 0, "Original/FileName", Element_Value); break; case Elements::TOL : Fill(Stream_General, 0, "Original/Lyricist", Element_Value); break; case Elements::TOR : Normalize_Date(Element_Value); Fill(Stream_General, 0, "Original/Released_Date", Element_Value); break; case Elements::TOT : Fill(Stream_General, 0, "Original/Album", Element_Value); break; case Elements::TP1 : Fill(Stream_General, 0, "Performer", Element_Value); break; case Elements::TP2 : Fill(Stream_General, 0, "Accompaniment", Element_Value); break; case Elements::TP3 : Fill(Stream_General, 0, "Conductor", Element_Value); break; case Elements::TP4 : Fill(Stream_General, 0, "RemixedBy", Element_Value); break; case Elements::TPA : { ZtringList List; List.Separator_Set(0, __T("/")); List.Write(Element_Value); if (!List(0).empty()) Fill(Stream_General, 0, General_Part_Position, List(0)); if (!List(1).empty()) Fill(Stream_General, 0, General_Part_Position_Total, List(1)); } break; case Elements::TPB : Fill(Stream_General, 0, "Publisher", Element_Value); break; case Elements::TRC : Fill(Stream_General, 0, "ISRC", Element_Value); break; case Elements::TRD : Normalize_Date(Element_Value); Fill(Stream_General, 0, "Recorded_Date", Element_Value); break; case Elements::TRK : { ZtringList List; List.Separator_Set(0, __T("/")); List.Write(Element_Value); if (!List(0).empty()) Fill(Stream_General, 0, General_Track_Position, List(0)); if (!List(1).empty()) Fill(Stream_General, 0, General_Track_Position_Total, List(1)); } break; case Elements::TSI : break; case Elements::TSS : break; case Elements::TT1 : Fill(Stream_General, 0, "Grouping", Element_Value); break; case Elements::TT2 : Fill(Stream_General, 0, "Track", Element_Value); break; case Elements::TT3 : Fill(Stream_General, 0, "Track/More", Element_Value); break; case Elements::TXT : Fill(Stream_General, 0, "Lyricist", Element_Value); break; case Elements::TXX : Fill(Stream_General, 0, Element_Values(0).To_UTF8().c_str(), Element_Values(1)); break; case Elements::TYE : Year=Element_Value; break; case Elements::UFI : Fill(Stream_Audio, 0, "UID", Element_Value); break; case Elements::ULT : Fill(Stream_General, 0, Element_Values(0).To_UTF8().c_str(), Element_Values(1)); break; case Elements::WAF : break; case Elements::WAR : Fill(Stream_General, 0, General_Service_Url, Element_Value); break; case Elements::WAS : Fill(Stream_General, 0, "Official audio source webpage", Element_Value); break; case Elements::WCM : Fill(Stream_General, 0, "Commercial information", Element_Value); break; case Elements::WCP : Fill(Stream_General, 0, "Copyright/Legal information", Element_Value); break; case Elements::WPB : Fill(Stream_General, 0, "Publisher/Url", Element_Value); break; case Elements::WXX : Fill(Stream_General, 0, Element_Values(0).To_UTF8().c_str(), Element_Values(1)); break; default : ; } } //--------------------------------------------------------------------------- void File_Id3v2::Normalize_Date(Ztring& Date) { if (Date.size()<=8) return; //Format unknown Date[8]=__T(' '); //could be "T" Date=Ztring(__T("UTC "))+Date; //Id3v2 specify a UTC date } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_MPEGA_YES MediaInfoLib/Source/MediaInfo/Tag/File_Id3v2.h100777 0 0 16637 12226004262 14315 0/* 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 ID3v2 tagged files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_Id3v2H #define MediaInfo_File_Id3v2H //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { ///*************************************************************************** // Class File_Id3v2 //*************************************************************************** class File_Id3v2 : public File__Analyze { public : //Constructor/Destructor File_Id3v2(); //Static stuff static bool Static_Synchronize_Tags (const int8u* Buffer, size_t Buffer_Offset, size_t Buffer_Size, bool &Tag_Found); private : //Streams management void Streams_Fill(); //Buffer - File header void FileHeader_Parse (); //Buffer - Per element void Header_Parse(); void Data_Parse(); //Elements #ifdef TEXT #undef TEXT #endif void T___(); void T__X(); void W___(); void W__X(); void AENC() {Skip_XX(Element_Size, "Data");} void APIC(); void ASPI() {Skip_XX(Element_Size, "Data");} void COMM(); void COMR() {Skip_XX(Element_Size, "Data");} void ENCR() {Skip_XX(Element_Size, "Data");} void EQU2() {Skip_XX(Element_Size, "Data");} void EQUA() {Skip_XX(Element_Size, "Data");} void ETCO() {Skip_XX(Element_Size, "Data");} void GEOB() {Skip_XX(Element_Size, "Data");} void GRID() {Skip_XX(Element_Size, "Data");} void IPLS() {Skip_XX(Element_Size, "Data");} void LINK() {Skip_XX(Element_Size, "Data");} void MCDI() {T___();} void MLLT() {Skip_XX(Element_Size, "Data");} void OWNE() {Skip_XX(Element_Size, "Data");} void PCNT() {Skip_XX(Element_Size, "Data");} void POPM() {Skip_XX(Element_Size, "Data");} void POSS() {Skip_XX(Element_Size, "Data");} void PRIV(); void RBUF() {Skip_XX(Element_Size, "Data");} void RGAD(); void RVA2() {Skip_XX(Element_Size, "Data");} void RVRB() {Skip_XX(Element_Size, "Data");} void SEEK() {Skip_XX(Element_Size, "Data");} void SIGN() {Skip_XX(Element_Size, "Data");} void SYLT(); void SYTC() {Skip_XX(Element_Size, "Data");} void TALB() {T___();} void TBPM() {T___();} void TCMP() {T___();} void TCOM() {T___();} void TCON() {T___();} void TCOP() {T___();} void TDAT() {T___();} void TDEN() {T___();} void TDLY() {T___();} void TDOR() {T___();} void TDRC() {T___();} void TDRL() {T___();} void TDTG() {T___();} void TENC() {T___();} void TEXT() {T___();} void TFLT() {T___();} void TIME() {T___();} void TIPL() {T___();} void TIT1() {T___();} void TIT2() {T___();} void TIT3() {T___();} void TKEY() {T___();} void TLAN() {T___();} void TLEN() {T___();} void TMCL() {T___();} void TMED() {T___();} void TMOO() {T___();} void TOAL() {T___();} void TOFN() {T___();} void TOLY() {T___();} void TOPE() {T___();} void TORY() {T___();} void TOWN() {T___();} void TPE1() {T___();} void TPE2() {T___();} void TPE3() {T___();} void TPE4() {T___();} void TPOS() {T___();} void TPRO() {T___();} void TPUB() {T___();} void TRCK() {T___();} void TRDA() {T___();} void TRSN() {T___();} void TRSO() {T___();} void TSIZ() {T___();} void TSO2() {T___();} void TSOA() {T___();} void TSOC() {T___();} void TSOP() {T___();} void TSOT() {T___();} void TSRC() {T___();} void TSSE() {T___();} void TSST() {T___();} void TXXX(); void TYER() {T___();} void UFID() {Skip_XX(Element_Size, "Data");} void USER() {Skip_XX(Element_Size, "Data");} void USLT(); void WCOM() {W___();} void WCOP() {W___();} void WOAF() {W___();} void WOAR() {W___();} void WOAS() {W___();} void WORS() {W___();} void WPAY() {W___();} void WPUB() {W___();} void WXXX(); void BUF() {Skip_XX(Element_Size, "Data");} void CNT() {Skip_XX(Element_Size, "Data");} void COM() {COMM();} void CRA() {Skip_XX(Element_Size, "Data");} void CRM() {Skip_XX(Element_Size, "Data");} void EQU() {Skip_XX(Element_Size, "Data");} void ETC() {Skip_XX(Element_Size, "Data");} void GEO() {Skip_XX(Element_Size, "Data");} void IPL() {Skip_XX(Element_Size, "Data");} void LNK() {Skip_XX(Element_Size, "Data");} void MCI() {Skip_XX(Element_Size, "Data");} void MLL() {Skip_XX(Element_Size, "Data");} void PIC_() {APIC();} void POP() {Skip_XX(Element_Size, "Data");} void REV() {Skip_XX(Element_Size, "Data");} void RVA() {Skip_XX(Element_Size, "Data");} void SLT() {Skip_XX(Element_Size, "Data");} void STC() {Skip_XX(Element_Size, "Data");} void TAL() {T___();} void TBP() {T___();} void TCM() {T___();} void TCO() {T___();} void TCP() {Skip_XX(Element_Size, "Data");} void TCR() {T___();} void TDA() {T___();} void TDY() {T___();} void TEN() {T___();} void TFT() {T___();} void TIM() {T___();} void TKE() {T___();} void TLA() {T___();} void TLE() {T___();} void TMT() {T___();} void TOA() {T___();} void TOF() {T___();} void TOL() {T___();} void TOR() {T___();} void TOT() {T___();} void TP1() {T___();} void TP2() {T___();} void TP3() {T___();} void TP4() {T___();} void TPA() {T___();} void TPB() {T___();} void TRC() {T___();} void TRD() {T___();} void TRK() {T___();} void TSI() {T___();} void TSS() {T___();} void TT1() {T___();} void TT2() {T___();} void TT3() {T___();} void TXT() {T___();} void TXX() {TXXX();} void TYE() {T___();} void UFI() {Skip_XX(Element_Size, "Data");} void ULT() {USLT();} void WAF() {W___();} void WAR() {W___();} void WAS() {W___();} void WCM() {W___();} void WCP() {W___();} void WPB() {W___();} void WXX() {WXXX();} void XRVA() {RVA2();} //Temp ZtringList Element_Values; Ztring Element_Value; Ztring Year, Month, Day, Hour, Minute; stream_t StreamKind; int64u Id3v2_Size; int8u Id3v2_Version; bool Unsynchronisation_Global; bool Unsynchronisation_Frame; bool DataLengthIndicator; //Helpers void Fill_Name(); void Normalize_Date (Ztring& Date); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Tag/File_Lyrics3.cpp100777 0 0 5161 12226004262 15257 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_LYRICS3_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Tag/File_Lyrics3.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Lyrics3::File_Lyrics3() :File__Analyze() { //Configuration TotalSize=(int64u)-1; } //*************************************************************************** // Format //*************************************************************************** //--------------------------------------------------------------------------- void File_Lyrics3::Read_Buffer_Continue() { if (TotalSize==(int64u)-1) TotalSize=Buffer_Size; //Coherency if (TotalSize<20) { Reject("Lyrics3"); return; } //Buffer size if (Buffer_SizeTotalSize) Size=TotalSize-15; Header_Fill_Code(Field, Ztring().From_CC3(Field)); Header_Fill_Size(Size); TotalSize-=Size; } //--------------------------------------------------------------------------- void File_Lyrics3v2::Data_Parse() { #define CASE_INFO(_NAME, _DETAIL) \ case Elements::_NAME : Element_Info1(_DETAIL); _NAME(); break; //Parsing switch (Element_Code) { CASE_INFO(AUT, "Lyrics Author Name"); CASE_INFO(CRC, "CRC"); CASE_INFO(EAL, "Extended Album name"); CASE_INFO(EAR, "Extended Artist name"); CASE_INFO(ETT, "Extended Track Title"); CASE_INFO(IMG, "Image location"); CASE_INFO(IND, "Indications field"); CASE_INFO(INF, "Additional information"); CASE_INFO(LYR, "Lyrics"); case (int64u)-1 : Footer(); break; default : Skip_XX(Element_Size, "Data"); } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Lyrics3v2::Footer() { //Parsing Skip_Local(6, "Size"); Skip_Local(9, "Signature"); Finish("Lyrics3v2"); } //--------------------------------------------------------------------------- void File_Lyrics3v2::EAL() { //Parsing Ztring Value; Get_Local(Element_Size, Value, "Value"); //Filling Fill(Stream_General, 0, General_Album, Value); } //--------------------------------------------------------------------------- void File_Lyrics3v2::EAR() { //Parsing Ztring Value; Get_Local(Element_Size, Value, "Value"); //Filling Fill(Stream_General, 0, General_Performer, Value); } //--------------------------------------------------------------------------- void File_Lyrics3v2::ETT() { //Parsing Ztring Value; Get_Local(Element_Size, Value, "Value"); //Filling Fill(Stream_General, 0, General_Title, Value); } //--------------------------------------------------------------------------- void File_Lyrics3v2::IND() { //Parsing if (Element_Size>=1) Skip_Local(1, "lyrics present"); if (Element_Size>=2) Skip_Local(1, "timestamp in lyrics"); if (Element_Size>=3) Skip_Local(1, "inhibits tracks for random selection"); while (Element_Offset9) { Library_Version=Library_Date.substr(9, std::string::npos); if (Library_Version.find(__T("("))==std::string::npos) { Library_Version.FindAndReplace(__T(" "), __T("."), 0, Ztring_Recursive); Library_Date.resize(8); } } } else if (vendor_string.size()>9 && Ztring(vendor_string.substr(vendor_string.size()-8, std::string::npos)).To_int32u()>20000000) { Library_Name=vendor_string.substr(0, vendor_string.size()-9); Library_Date=vendor_string.substr(vendor_string.size()-8, std::string::npos); if (!Library_Name.empty()) { std::string::size_type Pos=Library_Name.rfind(__T(' ')); if (Pos=__T('0') && Library_Name[Pos+1]<=__T('9')) { Library_Version=Library_Name.substr(Pos+1, std::string::npos); Library_Name.resize(Pos); } } } else if (vendor_string.find(__T("aoTuV "))!=std::string::npos) { Library_Name=__T("aoTuV"); Library_Version=vendor_string.SubString(__T("aoTuV "), __T("[")); Library_Date=vendor_string.SubString(__T("["), __T("]")); } else if (vendor_string.find(__T("Lancer "))!=std::string::npos) { Library_Name=__T("Lancer"); Library_Date=vendor_string.SubString(__T("["), __T("]")); } if (Library_Version.empty()) Library_Version=Library_Date; if (Library_Date.size()==8) { Library_Date.insert(6, 1, __T('-')); Library_Date.insert(4, 1, __T('-')); Library_Date.insert(0, __T("UTC ")); } } if (vendor_string.find(__T("libFLAC"))!=std::string::npos) Library_Name="libFLAC"; if (vendor_string.find(__T("libVorbis I"))!=std::string::npos) Library_Name="libVorbis"; if (vendor_string.find(__T("libTheora I"))!=std::string::npos) Library_Name="libTheora"; if (vendor_string.find(__T("AO; aoTuV"))==0) Library_Name="aoTuV"; if (vendor_string.find(__T("BS; Lancer"))==0) Library_Name="Lancer"; Fill(StreamKind_Specific, 0, "Encoded_Library", vendor_string); Fill(StreamKind_Specific, 0, "Encoded_Library/Name", Library_Name); Fill(StreamKind_Specific, 0, "Encoded_Library/Version", Library_Version); Fill(StreamKind_Specific, 0, "Encoded_Library/Date", Library_Date); FILLING_END(); } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_VorbisCom::Header_Parse() { //Parsing int32u user_comment_length; Get_L4 (user_comment_length, "length"); //Filling Header_Fill_Size(Element_Offset+user_comment_length); } //--------------------------------------------------------------------------- void File_VorbisCom::Data_Parse() { user_comment_list_length--; //Parsing Ztring comment; Get_UTF8(Element_Size, comment, "comment"); if (Element_Size && comment.empty()) { Element_Offset=0; //Retry Get_Local(Element_Size, comment, "comment"); } Element_Name(comment); FILLING_BEGIN_PRECISE(); Ztring Key=comment.SubString(__T(""), __T("=")); Key.MakeUpperCase(); Ztring Value=comment.SubString(__T("="), __T("")); if (Key==__T("ADDED_TIMESTAMP")) Fill(StreamKind_Common, 0, "Added_Date", Ztring().Date_From_Milliseconds_1601(Value.To_int64u()/1000)); else if (Key==__T("ALBUM ARTIST")) AlbumArtists.push_back(Value); else if (Key==__T("ALBUM")) Fill(StreamKind_Common, 0, "Album", Value); else if (Key==__T("ALBUM_COMMENT")) Fill(StreamKind_Common, 0, "Comment", Value); else if (Key==__T("ALBUMARTIST")) AlbumArtists.push_back(Value); else if (Key==__T("ARTIST")) Artists.push_back(Value); else if (Key==__T("AUTHOR")) Fill(StreamKind_Common, 0, "WrittenBy", Value); else if (Key==__T("BUYCDURL")) {} else if (Key==__T("CLASS")) Fill(StreamKind_Common, 0, "ContentType", Value); else if (Key==__T("COMPOSER")) Fill(StreamKind_Common, 0, "Composer", Value); else if (Key==__T("COMMENT")) Fill(StreamKind_Common, 0, "Comment", Value); else if (Key==__T("COMMENTS")) Fill(StreamKind_Common, 0, "Comment", Value); else if (Key==__T("CONDUCTOR")) Fill(StreamKind_Common, 0, "Conductor", Value); else if (Key==__T("CONTACT")) Fill(StreamKind_Common, 0, "Publisher", Value); else if (Key==__T("COPYRIGHT")) Fill(StreamKind_Common, 0, "Copyright", Value); else if (Key==__T("DATE")) Fill(StreamKind_Common, 0, "Recorded_Date", Value, true); else if (Key==__T("DESCRIPTION")) Fill(StreamKind_Common, 0, "Description", Value); else if (Key==__T("DISC")) Fill(StreamKind_Common, 0, "Part", Value, true); else if (Key==__T("DISCID")) {} else if (Key==__T("DISCNUMBER")) Fill(StreamKind_Common, 0, "Part", Value, true); else if (Key==__T("DISCTOTAL")) Fill(StreamKind_Common, 0, "Part/Position_Total", Value); else if (Key==__T("ENCODEDBY")) Fill(StreamKind_Common, 0, "EncodedBy", Value); else if (Key==__T("ENCODED-BY")) Fill(StreamKind_Common, 0, "EncodedBy", Value); else if (Key==__T("ENCODER")) Fill(StreamKind_Common, 0, "Encoded_Application", Value); else if (Key==__T("ENCODED_USING")) Fill(StreamKind_Common, 0, "Encoded_Application", Value); else if (Key==__T("ENCODER_URL")) Fill(StreamKind_Common, 0, "Encoded_Application/Url", Value); else if (Key==__T("ENSEMBLE")) Accompaniments.push_back(Value); else if (Key==__T("GENRE")) Fill(StreamKind_Common, 0, "Genre", Value); else if (Key==__T("FIRST_PLAYED_TIMESTAMP")) Fill(StreamKind_Common, 0, "Played_First_Date", Ztring().Date_From_Milliseconds_1601(Value.To_int64u()/10000)); else if (Key==__T("ISRC")) Fill(StreamKind_Multiple, 0, "ISRC", Value); else if (Key==__T("LABEL")) Fill(StreamKind_Common, 0, "Label", Value); else if (Key==__T("LANGUAGE")) {if (Value.find(__T("Director"))==0) Fill(StreamKind_Specific, 0, "Language_More", Value); else if (!Value.SubString(__T("["), __T("]")).empty()) Fill(StreamKind_Specific, 0, "Language", Value.SubString(__T("["), __T("]"))); else Fill(StreamKind_Specific, 0, "Language", Value);} else if (Key==__T("LAST_PLAYED_TIMESTAMP")) Fill(StreamKind_Multiple, 0, "Played_Last_Date", Ztring().Date_From_Milliseconds_1601(Value.To_int64u()/10000)); else if (Key==__T("LICENCE")) Fill(StreamKind_Common, 0, "TermsOfUse", Value); else if (Key==__T("LICENSE")) Fill(StreamKind_Common, 0, "TermsOfUse", Value); else if (Key==__T("LYRICS")) Fill(StreamKind_Common, 0, "Lyrics", Value); else if (Key==__T("LWING_GAIN")) Fill(StreamKind_Multiple, 0, "ReplayGain_Gain", Value.To_float64(), 2); else if (Key==__T("LOCATION")) Fill(StreamKind_Common, 0, "Recorded/Location", Value); else if (Key==__T("MUSICBRAINZ_ALBUMID")) {} else if (Key==__T("MUSICBRAINZ_ALBUMARTISTID")) {} else if (Key==__T("MUSICBRAINZ_ARTISTID")) {} else if (Key==__T("MUSICBRAINZ_TRACKID")) {} else if (Key==__T("MUSICBRAINZ_SORTNAME")) Fill(StreamKind_Common, 0, "Performer/Sort", Value); else if (Key==__T("MUSICBRAINZ_DISCID")) {} else if (Key==__T("ORGANIZATION")) Fill(StreamKind_Common, 0, "Producer", Value); else if (Key==__T("PERFORMER")) Performers.push_back(Value); else if (Key==__T("PLAY_COUNT")) Fill(StreamKind_Multiple, 0, "Played_Count", Value.To_int64u()); else if (Key==__T("RATING")) Fill(StreamKind_Multiple, 0, "Rating", Value); else if (Key==__T("REPLAYGAIN_ALBUM_GAIN")) Fill(StreamKind_Common, 0, "Album_ReplayGain_Gain", Value.To_float64(), 2); else if (Key==__T("REPLAYGAIN_ALBUM_PEAK")) Fill(StreamKind_Common, 0, "Album_ReplayGain_Peak", Value.To_float64(), 6); else if (Key==__T("REPLAYGAIN_REFERENCE_LOUDNESS")) {} else if (Key==__T("REPLAYGAIN_TRACK_GAIN")) Fill(StreamKind_Specific, 0, "ReplayGain_Gain", Value.To_float64(), 2); else if (Key==__T("REPLAYGAIN_TRACK_PEAK")) Fill(StreamKind_Specific, 0, "ReplayGain_Peak", Value.To_float64(), 6); else if (Key==__T("TITLE")) Fill(StreamKind_Common, 0, "Title", Value); else if (Key==__T("TOTALTRACKS")) Fill(StreamKind_Common, 0, "Track/Position_Total", Value); else if (Key==__T("TOTALDISCS")) Fill(StreamKind_Common, 0, "Part/Position_Total", Value); else if (Key==__T("TRACK_COMMENT")) Fill(StreamKind_Multiple, 0, "Comment", Value); else if (Key==__T("TRACKNUMBER")) Fill(StreamKind_Multiple, 0, "Track/Position", Value); else if (Key==__T("TRACKTOTAL")) Fill(StreamKind_Multiple, 0, "Track/Position_Total", Value); else if (Key==__T("VERSION")) Fill(StreamKind_Common, 0, "Track/More", Value); else if (Key==__T("BPM")) Fill(StreamKind_Common, 0, "BPM", Value); else if (Key==__T("WAVEFORMATEXTENSIBLE_CHANNEL_MASK")) { //This is an hexadecimal value if (Value.size()>2 && Value[0]==__T('0') && Value[1]==__T('x')) { int16u ValueI=0; for (size_t Pos=2; Pos=__T('0') && Value[Pos]<=__T('9')) ValueI+=Value[Pos]-__T('0'); else if (Value[Pos]>=__T('A') && Value[Pos]<=__T('F')) ValueI+=10+Value[Pos]-__T('A'); else if (Value[Pos]>=__T('a') && Value[Pos]<=__T('f')) ValueI+=10+Value[Pos]-__T('a'); else break; } Fill(Stream_Audio, 0, Audio_ChannelPositions, ExtensibleWave_ChannelMask(ValueI)); Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, ExtensibleWave_ChannelMask2(ValueI)); } } else if (Key==__T("YEAR")) {if (Value!=Retrieve(StreamKind_Common, 0, "Recorded_Date")) Fill(StreamKind_Common, 0, "Recorded_Date", Value);} else if (Key.find(__T("COVERART"))==0) { if (Key==__T("COVERARTCOUNT")) ; else if (Key.find(__T("COVERARTMIME"))==0) Fill(Stream_General, 0, General_Cover_Mime, Value); else if (Key.find(__T("COVERARTFILELINK"))==0) Fill(Stream_General, 0, General_Cover_Data, __T("file://")+Value); else if (Key.find(__T("COVERARTTYPE"))==0) Fill(Stream_General, 0, General_Cover_Type, Id3v2_PictureType(Value.To_int8u())); } else if (Key.find(__T("CHAPTER"))==0) { if (Count_Get(Stream_Menu)==0) { Stream_Prepare(Stream_Menu); Fill(Stream_Menu, StreamPos_Last, Menu_Chapters_Pos_Begin, Count_Get(Stream_Menu, StreamPos_Last), 10, true); } if (Key.find(__T("NAME"))==Error) { Chapter_Pos=Key.SubString(__T("CHAPTER"), __T("")); Chapter_Time=Value; } else { Value.FindAndReplace(__T("\n"), __T(""), Count_Get(Stream_Text)-1); //Some chapters names have extra characters, not needed Value.FindAndReplace(__T("\r"), __T(""), Count_Get(Stream_Text)-1); //Some chapters names have extra characters, not needed Value.FindAndReplace(__T(" "), __T(""), Count_Get(Stream_Text)-1); //Some chapters names have extra characters, not needed Fill(Stream_Menu, 0, Chapter_Time.To_UTF8().c_str(), Value); } Fill(Stream_Menu, StreamPos_Last, Menu_Chapters_Pos_End, Count_Get(Stream_Menu, StreamPos_Last), 10, true); } else Fill(Stream_General, 0, comment.SubString(__T(""), __T("=")).To_Local().c_str(), Value); FILLING_END(); if (user_comment_list_length==0) Finish("VorbisCom"); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_VORBISCOM_YES MediaInfoLib/Source/MediaInfo/Tag/File_VorbisCom.h100777 0 0 3616 12226004262 15302 0/* 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 Vorbis comments // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_VorbisComH #define MediaInfo_File_VorbisComH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include "ZenLib/ZtringList.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_VorbisCom //*************************************************************************** class File_VorbisCom : public File__Analyze { public : //In stream_t StreamKind_Specific; //Always in this stream kind whatever is the configuration stream_t StreamKind_Multiple; //Specific stream kind depend if there is multiple streams or not stream_t StreamKind_Common; //Stream kind for common values //Constructor/Destructor File_VorbisCom(); private : //Streams management void Streams_Fill(); //Buffer - File header void FileHeader_Parse(); //Buffer - Per element void Header_Parse(); void Data_Parse(); //Temp int32u user_comment_list_length; Ztring Chapter_Pos; Ztring Chapter_Time; ZtringList Performers; ZtringList Artists; ZtringList Accompaniments; ZtringList AlbumArtists; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Tag/File__Tags.cpp100777 0 0 61364 12253626447 15032 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Tag/File__Tags.h" #if defined(MEDIAINFO_APETAG_YES) #include "MediaInfo/Tag/File_ApeTag.h" #endif //MEDIAINFO_APETAG_YES #if defined(MEDIAINFO_ID3_YES) #include "MediaInfo/Tag/File_Id3.h" #endif //MEDIAINFO_ID3_YES #if defined(MEDIAINFO_ID3V2_YES) #include "MediaInfo/Tag/File_Id3v2.h" #endif //MEDIAINFO_ID3V2_YES #if defined(MEDIAINFO_LYRICS3_YES) #include "MediaInfo/Tag/File_Lyrics3.h" #endif //MEDIAINFO_LYRICS3_YES #if defined(MEDIAINFO_LYRICS3V2_YES) #include "MediaInfo/Tag/File_Lyrics3v2.h" #endif //MEDIAINFO_LYRICS3V2_YES #include "MediaInfo/File_Unknown.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File__Tags_Helper::File__Tags_Helper() { //In Base=NULL; //Out TagsSize=0; File_BeginTagSize=0; File_EndTagSize=0; //Temp Parser=NULL; Id3v1_Offset=(int64u)-1; Lyrics3_Offset=(int64u)-1; Lyrics3v2_Offset=(int64u)-1; ApeTag_Offset=(int64u)-1; JumpTo_WantedByParser=(int64u)-1; Id3v1_Size=0; Lyrics3_Size=0; Lyrics3v2_Size=0; ApeTag_Size=0; TagSizeIsFinal=false; SearchingForEndTags=false; } //--------------------------------------------------------------------------- File__Tags_Helper::~File__Tags_Helper() { delete Parser; //Parser=NULL; for (size_t Pos=0; PosStatus[File__Analyze::IsAccepted]) { #ifndef MEDIAINFO_ID3V2_YES const bool Priority=false; #else bool Priority=Parser_Streams_Fill_Priority[Pos]; #endif Parser_Streams_Fill[Pos]->Read_Buffer_Finalize(); Base->Merge(*(Parser_Streams_Fill[Pos]), Stream_General, 0, 0, Priority); Base->Merge(*(Parser_Streams_Fill[Pos]), Stream_Audio , 0, 0, Priority); } delete Parser_Streams_Fill[Pos]; //Parser_Streams_Fill[Pos]=NULL; } Parser_Streams_Fill.clear(); } //--------------------------------------------------------------------------- void File__Tags_Helper::Streams_Finish() { if (!Base->IsSub) { Base->Fill(Stream_General, 0, General_StreamSize, TagsSize+Base->Retrieve(Stream_General, 0, General_StreamSize).To_int64u(), 10, true); if (Base->Retrieve(Stream_Audio, 0, Audio_StreamSize).empty()) Base->Fill(Stream_Audio, 0, Audio_StreamSize, Base->File_Size-TagsSize); } } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- bool File__Tags_Helper::Read_Buffer_Continue() { //Tags bool Tag_Found; if (File__Tags_Helper::Synchronize(Tag_Found) && Tag_Found) File__Tags_Helper::Synched_Test(); return true; } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File__Tags_Helper::Synchronize(bool &Tag_Found, size_t Synchro_Offset) { //Buffer size if (Parser) { Synched_Test(); if (Parser) return false; } if (SearchingForEndTags) { GoTo(0, "Tags detected"); return false; } if (!Synchro_Offset) { if (!Synched_Test()) //Handling begin/intermediate Id3v2 return false; } //ID if (Base->Buffer_Offset+Synchro_Offset+8>Base->Buffer_Size) return false; int32u ID3=CC3(Base->Buffer+Base->Buffer_Offset+Synchro_Offset); int64u ID8=CC8(Base->Buffer+Base->Buffer_Offset+Synchro_Offset); if (ID3==0x494433 //"ID3" || ID8==0x4150455441474558LL //"APETAGEX" || ID8==0x4C59524943534245LL //"LYRICSBE" || ID3==0x544147) //"TAG" / "TAG+" Tag_Found=true; else Tag_Found=false; return true; } //--------------------------------------------------------------------------- bool File__Tags_Helper::Synched_Test() { if (SearchingForEndTags) return true; for (;;) { #ifdef MEDIAINFO_ID3V2_YES bool Priority=false; #else const bool Priority=false; #endif if (!Parser) { //Must have enough buffer for having header if (Base->Buffer_Offset+8>Base->Buffer_Size) return Base->IsSub; //If IsSub, we consider this is a complete block //Quick test of synchro int32u ID=CC3(Base->Buffer+Base->Buffer_Offset); int32u ID4=CC4(Base->Buffer+Base->Buffer_Offset); int64u ID8=CC8(Base->Buffer+Base->Buffer_Offset); if (ID==0x494433) //"ID3" { if (Base->Buffer_Offset+10>Base->Buffer_Size) return false; int32u Size=BigEndian2int32u(Base->Buffer+Base->Buffer_Offset+6); Parser_Buffer_Size=(((Size>>0)&0x7F) | ((Size>>1)&0x3F80) | ((Size>>2)&0x1FC000) | ((Size>>3)&0x0FE00000)) +10; if (Base->Buffer_Offset+Parser_Buffer_Size>Base->Buffer_Size) return false; if (!TagSizeIsFinal) File_BeginTagSize+=Parser_Buffer_Size; if (Base->File_Offset_FirstSynched==(int64u)-1) Base->Buffer_TotalBytes_FirstSynched_Max+=Parser_Buffer_Size; #ifdef MEDIAINFO_ID3V2_YES Parser=new File_Id3v2; Priority=true; #else Parser=new File_Unknown; #endif Base->Element_Begin1("Id3v2"); } else if (ID8==0x4150455441474558LL) //"APETAGEX" { if (Base->Buffer_Offset+16>Base->Buffer_Size) return false; Parser_Buffer_Size=LittleEndian2int32u(Base->Buffer+Base->Buffer_Offset+12); if (LittleEndian2int32u(Base->Buffer+Base->Buffer_Offset+8)) Parser_Buffer_Size+=32; if (Base->Buffer_Offset+Parser_Buffer_Size>Base->Buffer_Size) return false; if (!TagSizeIsFinal) File_BeginTagSize+=Parser_Buffer_Size; if (Base->File_Offset_FirstSynched==(int64u)-1) Base->Buffer_TotalBytes_FirstSynched_Max+=Parser_Buffer_Size; #ifdef MEDIAINFO_APETAG_YES Parser=new File_ApeTag; #else Parser=new File_Unknown; #endif Base->Element_Begin1("ApeTag"); } else if (ID8==0x4C59524943534245LL) //"LYRICSBE" { if (Base->Buffer_Offset+16>Base->Buffer_Size) return false; //Searching for "LYRICS200" std::string Buf((const char*)(Base->Buffer+Base->Buffer_Offset), Base->Buffer_Size-Base->Buffer_Offset); size_t Pos2=Buf.find("LYRICS200"); size_t Pos1=std::string::npos; if (Pos2==std::string::npos) Pos1=Buf.find("LYRICSEND"); if (Pos2!=std::string::npos) Parser_Buffer_Size=Pos2+9; else if (Pos1!=std::string::npos) Parser_Buffer_Size=Pos1+9; else Parser_Buffer_Size=(size_t)(Base->File_Size-(Base->File_Offset+Base->Buffer_Offset)); if (Base->Buffer_Offset+Parser_Buffer_Size>Base->Buffer_Size) return false; if (!TagSizeIsFinal) File_BeginTagSize+=Parser_Buffer_Size; if (Base->File_Offset_FirstSynched==(int64u)-1) Base->Buffer_TotalBytes_FirstSynched_Max+=Parser_Buffer_Size; if (Pos2!=std::string::npos) { #ifdef MEDIAINFO_LYRICS3V2_YES Parser=new File_Lyrics3v2; ((File_Lyrics3v2*)Parser)->TotalSize=Parser_Buffer_Size; #else Parser=new File_Unknown; #endif Base->Element_Begin1("Lyrics2"); } else if (Pos1!=std::string::npos) { #ifdef MEDIAINFO_LYRICS3_YES Parser=new File_Lyrics3; ((File_Lyrics3*)Parser)->TotalSize=Parser_Buffer_Size; #else Parser=new File_Unknown; #endif Base->Element_Begin1("Lyrics"); } else { Parser=new File_Unknown; Base->Element_Begin1("Problem"); } } else if (ID4==0x5441472B) //"TAG+" { #ifdef MEDIAINFO_ID3_YES Parser=new File_Id3; #else Parser=new File_Unknown; #endif Parser_Buffer_Size=227+128; Base->Element_Begin1("Id3+"); } else if (ID==0x544147) //"TAG" { #ifdef MEDIAINFO_ID3_YES Parser=new File_Id3; #else Parser=new File_Unknown; #endif Parser_Buffer_Size=128; if (!TagSizeIsFinal) File_BeginTagSize+=Parser_Buffer_Size; Base->Element_Begin1("Id3"); } else if (Base->File_Offset+Base->Buffer_Offset==Lyrics3_Offset) { #ifdef MEDIAINFO_LYRICS3_YES Parser=new File_Lyrics3; ((File_Lyrics3*)Parser)->TotalSize=Lyrics3_Size; #else Parser=new File__Analyze; #endif Parser_Buffer_Size=(size_t)Lyrics3_Size; if (!TagSizeIsFinal) File_BeginTagSize+=Parser_Buffer_Size; Base->Element_Begin1("Lyrics3"); } else if (Base->File_Offset+Base->Buffer_Offset==Lyrics3v2_Offset) { #ifdef MEDIAINFO_LYRICS3V2_YES Parser=new File_Lyrics3v2; ((File_Lyrics3v2*)Parser)->TotalSize=Lyrics3v2_Size; #else Parser=new File_Unknown; #endif Parser_Buffer_Size=(size_t)Lyrics3v2_Size; if (!TagSizeIsFinal) File_BeginTagSize+=Parser_Buffer_Size; Base->Element_Begin1("Lyrics3v2"); } else if (Base->File_Offset+Base->Buffer_Offset==ApeTag_Offset) { #ifdef MEDIAINFO_APETAG_YES Parser=new File_ApeTag; #else Parser=new File_Unknown; #endif if (!TagSizeIsFinal) File_BeginTagSize+=Parser_Buffer_Size; Parser_Buffer_Size=(size_t)ApeTag_Size; Base->Element_Begin1("ApeTag"); } else break; Base->Open_Buffer_Init(Parser); } //We continue if (Parser) { if (!Parser_Buffer_Size) { delete Parser; Parser=NULL; return false; //Probably stuck in a loop, exit } int64u Size_ToParse=(Parser_Buffer_SizeBuffer_Size-Base->Buffer_Offset)?Parser_Buffer_Size:(Base->Buffer_Size-Base->Buffer_Offset); Base->Open_Buffer_Continue(Parser, Base->Buffer+Base->Buffer_Offset, (size_t)Size_ToParse); Base->Buffer_Offset+=(size_t)Size_ToParse; TagsSize+=Size_ToParse; Parser_Buffer_Size-=(size_t)Size_ToParse; if (Parser->Status[File__Analyze::IsFinished] || Parser_Buffer_Size==0) { if (Base->Status[File__Analyze::IsAccepted] && Parser->Count_Get(Stream_General)>0) { if (!Base->Status[File__Analyze::IsFilled]) Base->Fill(); Parser->Read_Buffer_Finalize(); Base->Merge(*Parser, Stream_General, 0, 0, Priority); Base->Merge(*Parser, Stream_Audio , 0, 0, Priority); delete Parser; Parser=NULL; } else { Parser_Streams_Fill.push_back(Parser); #ifdef MEDIAINFO_ID3V2_YES Parser_Streams_Fill_Priority.push_back(Priority); #endif Parser=NULL; } if (Parser_Buffer_Size) Base->Skip_XX(Parser_Buffer_Size, "Data continued"); Base->Element_Show(); Base->Element_End0(); } else break; } } return true; } //*************************************************************************** // Streams //*************************************************************************** //--------------------------------------------------------------------------- size_t File__Tags_Helper::Stream_Prepare(stream_t StreamKind) { if (Base->Count_Get(StreamKind)) return 1; //Only one is permited return Base->Stream_Prepare(StreamKind); } //*************************************************************************** // End //*************************************************************************** //--------------------------------------------------------------------------- void File__Tags_Helper::GoTo (int64u GoTo, const char* ParserName) { if (Base->IsSub) { Base->GoTo(GoTo, ParserName); return; } //Normal Data_GoTo; //Configuring if (!SearchingForEndTags) { if (GoTo==(int64u)-1) JumpTo_WantedByParser=Base->File_Offset+Base->Buffer_Offset; else JumpTo_WantedByParser=GoTo; SearchingForEndTags=true; } //Trying to parse tags while (!TagSizeIsFinal && DetectBeginOfEndTags_Test()); //If a jump is requested if (!TagSizeIsFinal) return; //Positionning (if finnished) if (TagSizeIsFinal) { if (JumpTo_WantedByParser!=(int64u)-1) { if (JumpTo_WantedByParserGoTo(JumpTo_WantedByParser, ParserName); else Base->GoTo(JumpTo_WantedByParser-Id3v1_Size-Lyrics3_Size-Lyrics3v2_Size-ApeTag_Size, ParserName); } SearchingForEndTags=false; } else Base->GoTo(GoTo, ParserName); } //--------------------------------------------------------------------------- void File__Tags_Helper::GoToFromEnd (int64u GoToFromEnd, const char* ParserName) { if (GoToFromEnd>Base->File_Size) { if (ParserName) { bool MustElementBegin=Base->Element_Level?true:false; if (Base->Element_Level>0) Base->Element_End0(); //Element Base->Info(Ztring(ParserName)+__T(", wants to go to somewhere, but not valid")); if (MustElementBegin) Base->Element_Level++; } Finish(ParserName); return; } GoTo(Base->File_Size-GoToFromEnd, ParserName); } //--------------------------------------------------------------------------- void File__Tags_Helper::Accept (const char* ParserName) { Base->Accept(ParserName); } //--------------------------------------------------------------------------- void File__Tags_Helper::Reject (const char* ParserName) { Base->Reject(ParserName); } //--------------------------------------------------------------------------- void File__Tags_Helper::Finish (const char* ParserName) { if (ParserName) { bool MustElementBegin=Base->Element_Level?true:false; if (Base->Element_Level>0) Base->Element_End0(); //Element Base->Info(Ztring(ParserName)+__T(", finished but searching tags")); if (MustElementBegin) Base->Element_Level++; } GoToFromEnd(0, ParserName); } //--------------------------------------------------------------------------- bool File__Tags_Helper::DetectBeginOfEndTags_Test() { TagSizeIsFinal=true; //Id3v1 if (Id3v1_Size==0 && File_EndTagSize==0 && Base->File_Size>=128) //Only one, at the end, larger than 128 bytes { if (Base->File_Offset>Base->File_Size-128-32) //Must be at least at the end less 128 bytes { Base->GoTo(Base->File_Size-128-32, "Tags detection"); //32 to be able to quickly see another tag system TagSizeIsFinal=false; return false; } if (Base->File_Offset+Base->Buffer_SizeFile_Size) //Must be at least at the end less 128 bytes of tags { if (Base->File_OffsetFile_Size-128-32) Base->GoTo(Base->File_Size-128-32, "Tags detection"); TagSizeIsFinal=false; return false; } if (CC3(Base->Buffer+((size_t)((Base->File_Size-128)-Base->File_Offset)))==CC3("TAG")) { Id3v1_Size=128; File_EndTagSize+=128; Id3v1_Offset=Base->File_Size-File_EndTagSize; TagSizeIsFinal=false; } } //Lyrics3 if (Lyrics3_Size==0 && Base->File_Size>=File_EndTagSize+9) //Only one, larger than File_EndTagSize+15 bytes { if (Base->File_Offset>Base->File_Size-File_EndTagSize-9) //Must be at the end less 15 bytes { Base->GoTo(Base->File_Size-File_EndTagSize-9, "Tags"); TagSizeIsFinal=false; return false; } if (Base->File_Offset+Base->Buffer_SizeFile_Size-File_EndTagSize) //Must be at the end less File_EndTagSize+9 bytes plus 9 bytes of tags { if (Base->File_Offset!=Base->File_Size-File_EndTagSize) Base->GoTo(Base->File_Size-File_EndTagSize, "Tags"); TagSizeIsFinal=false; return false; } if (CC8(Base->Buffer+((size_t)((Base->File_Size-File_EndTagSize-9)-Base->File_Offset)))==CC8("LYRICSEN")) { //Must find the beginning, 5100 bytes before if (Base->File_Offset>Base->File_Size-File_EndTagSize-5100) //Must be at the end less 15 bytes { Base->GoTo(Base->File_Size-File_EndTagSize-5100, "Tags"); TagSizeIsFinal=false; return false; } if (Base->File_Offset+Base->Buffer_SizeFile_Size-File_EndTagSize) //Must be at the end less File_EndTagSize { if (Base->File_Offset!=Base->File_Size-File_EndTagSize) Base->GoTo(Base->File_Size-File_EndTagSize, "Tags"); TagSizeIsFinal=false; return false; } //Searching for "LYRICSBEGIN" std::string Buf((const char*)(Base->Buffer+Base->Buffer_Offset), Base->Buffer_Size-Base->Buffer_Offset); size_t Pos=Buf.find("LYRICSBEGIN"); if (Pos!=std::string::npos) { Lyrics3_Size=Base->File_Size-File_EndTagSize-(Base->File_Offset+Base->Buffer_Offset+Pos); File_EndTagSize+=Lyrics3_Size; Lyrics3_Offset=Base->File_Size-File_EndTagSize; TagSizeIsFinal=false; } } } //Lyrics3v2 if (Lyrics3v2_Size==0 && Base->File_Size>=File_EndTagSize+15) //Only one, larger than File_EndTagSize+15 bytes { if (Base->File_Offset>Base->File_Size-File_EndTagSize-15) //Must be at the end less 15 bytes { Base->GoTo(Base->File_Size-File_EndTagSize-15, "Tags"); TagSizeIsFinal=false; return false; } if (Base->File_Offset+Base->Buffer_SizeFile_Size-File_EndTagSize) //Must be at the end less File_EndTagSize { if (Base->File_Offset!=Base->File_Size-File_EndTagSize) Base->GoTo(Base->File_Size-File_EndTagSize, "Tags"); TagSizeIsFinal=false; return false; } if (CC8(Base->Buffer+((size_t)((Base->File_Size-File_EndTagSize-15+6)-Base->File_Offset)))==CC8("LYRICS20")) { Lyrics3v2_Size=Ztring((const char*)(Base->Buffer+((size_t)((Base->File_Size-File_EndTagSize-15)-Base->File_Offset))), 6).To_int32u()+15; File_EndTagSize+=Lyrics3v2_Size; Lyrics3v2_Offset=Base->File_Size-File_EndTagSize; TagSizeIsFinal=false; } } //ApeTag if (ApeTag_Size==0 && Base->File_Size>=File_EndTagSize+32) //Only one, larger than File_EndTagSize+32 bytes { if (Base->File_Offset>Base->File_Size-File_EndTagSize-32) //Must be at the end less 32 bytes { Base->GoTo(Base->File_Size-File_EndTagSize-32, "Tags"); TagSizeIsFinal=false; return false; } if (Base->File_Offset+Base->Buffer_SizeFile_Size-File_EndTagSize) //Must be at the end less File_EndTagSize+15 bytes plus 15 bytes of tags { if (Base->File_Offset!=Base->File_Size-File_EndTagSize-32) Base->GoTo(Base->File_Size-File_EndTagSize-32, "Tags"); TagSizeIsFinal=false; return false; } if (CC8(Base->Buffer+((size_t)((Base->File_Size-File_EndTagSize-32)-Base->File_Offset)))==CC8("APETAGEX")) { ApeTag_Size=LittleEndian2int32u(Base->Buffer+((size_t)((Base->File_Size-File_EndTagSize-32+12)-Base->File_Offset))); if (LittleEndian2int32u(Base->Buffer+((size_t)((Base->File_Size-File_EndTagSize-32+8)-Base->File_Offset)))==2000) ApeTag_Size+=32; File_EndTagSize+=ApeTag_Size; ApeTag_Offset=Base->File_Size-File_EndTagSize; TagSizeIsFinal=false; } } //Finished return true; } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace MediaInfoLib/Source/MediaInfo/Tag/File__Tags.h100777 0 0 5560 12226004262 14434 0/* 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 all kind of framed tags tagged files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File__TagsH #define MediaInfo_File__TagsH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File__Tags_Helper //*************************************************************************** class File__Tags_Helper { public : //In File__Analyze* Base; //Out int64u TagsSize; int64u File_BeginTagSize; int64u File_EndTagSize; //Constructor/Destructor File__Tags_Helper(); ~File__Tags_Helper(); //Streams management void Streams_Fill(); void Streams_Finish(); //Buffer - File header bool FileHeader_Begin() {return Synched_Test();} //Buffer - Synchro bool Synchronize(bool &Tag_Found, size_t Synchro_Offset=0); bool Synched_Test(); //Buffer - Global bool Read_Buffer_Continue (); //Per element bool Header_Begin() {return Synched_Test();} //Streams size_t Stream_Prepare(stream_t StreamKind); //End void GoTo (int64u GoTo, const char* ParserName=NULL); void GoToFromEnd (int64u GoToFromEnd=0, const char* ParserName=NULL); void Accept (const char* ParserName=NULL); void Reject (const char* ParserName=NULL); void Finish (const char* ParserName=NULL); private : //Temp File__Analyze* Parser; vector Parser_Streams_Fill; //Parser to merge when filling #ifdef MEDIAINFO_ID3V2_YES vector Parser_Streams_Fill_Priority; //Parser to merge when filling #endif size_t Parser_Buffer_Size; int64u Id3v1_Offset; int64u Lyrics3_Offset; int64u Lyrics3v2_Offset; int64u ApeTag_Offset; int64u JumpTo_WantedByParser; int64u Id3v1_Size; int64u Lyrics3_Size; int64u Lyrics3v2_Size; int64u ApeTag_Size; bool TagSizeIsFinal; bool SearchingForEndTags; //Helpers bool DetectBeginOfEndTags(); //return true if we can continue, false if want return bool DetectBeginOfEndTags_Test(); };} //NameSpace #endif MediaInfoLib/Source/MediaInfo/Text/ 40777 0 0 0 12262743712 12404 5MediaInfoLib/Source/MediaInfo/Text/File_AribStdB24B37.cpp100777 0 0 164335 12263604515 16275 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_ARIBSTDB24B37_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Text/File_AribStdB24B37.h" #if defined(MEDIAINFO_MPEGTS_YES) #include "MediaInfo/Multiple/File_MpegTs.h" #endif #include #ifdef __WINDOWS__ #undef __TEXT #include "windows.h" #endif // __WINDOWS__ //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Info //*************************************************************************** //--------------------------------------------------------------------------- const char* AribStdB24B37_Caption_conversion_type(int8u Caption_conversion_type) { switch (Caption_conversion_type) { case 0 : return "Analog"; case 1 : return "HD side panel"; case 2 : return "SD (4:3)"; case 3 : return "SD wide side panel"; case 4 : return "Mobile closed caption"; default: return ""; } } //--------------------------------------------------------------------------- const char* AribStdB24B37_Caption_DataIdentifier(int8u DataIdentifier) { switch (DataIdentifier) { case 0 : return "Exchange format data (closed caption data label)"; case 1 : return "Exchange format data (program management information)"; case 2 : return "Exchange format data (page information 1)"; case 3 : return "Exchange format data (page information 2)"; case 4 : return "Short form data (closed caption management data)"; case 5 : return "Short form data (closed caption text data)"; case 6 : return "Undefined"; case 7 : return "Dummy data"; default: return ""; } } //--------------------------------------------------------------------------- const char* AribStdB24B37_DRCS_conversion_type(int8u DRCS_conversion_type) { switch (DRCS_conversion_type) { case 0 : return "DRCS conversion mode A"; case 1 : return "DRCS conversion mode B"; case 2 : return "Mobile DRCS"; case 3 : return "DRCS conversion not possible"; default: return ""; } } //--------------------------------------------------------------------------- const char* AribStdB24B37_data_group_id(int8u data_group_id) { switch (data_group_id) { case 0 : return "Caption management"; case 1 : return "Caption statement (1st)"; case 2 : return "Caption statement (2nd)"; case 3 : return "Caption statement (3rd)"; case 4 : return "Caption statement (4th)"; case 5 : return "Caption statement (5th)"; case 6 : return "Caption statement (6th)"; case 7 : return "Caption statement (7th)"; case 8 : return "Caption statement (8th)"; default: return ""; } } //--------------------------------------------------------------------------- const char* AribStdB24B37_TMD(int8u TMD) { switch (TMD) { case 0 : return "Free"; case 1 : return "Real time"; case 2 : return "Offset time"; default: return ""; } } //--------------------------------------------------------------------------- const char* AribStdB24B37_DMF_reception(int8u DMF_reception) { switch (DMF_reception) { case 0 : return "Automatic display when received"; case 1 : return "Non-displayed automatically when received"; case 2 : return "Selectable display when received"; case 3 : return "Automatic display/non-display under specific condition when received"; default: return ""; } } //--------------------------------------------------------------------------- const char* AribStdB24B37_DMF_recording(int8u DMF_recording) { switch (DMF_recording) { case 0 : return "Automatic display when recording and playback"; case 1 : return "Non- displayed automatically when recording and playback"; case 2 : return "Selectable display when recording and playback"; default: return ""; } } //--------------------------------------------------------------------------- const char* AribStdB24B37_format(int8u format) { switch (format) { case 0 : return "Horizontal writing in standard density"; case 1 : return "Vertical writing in standard density"; case 2 : return "Horizontal writing in high density"; case 3 : return "Vertical writing in high density"; case 4 : return "Horizontal writing of Western language"; case 5 : return "Horizontal writing in 1920 x 1080"; case 6 : return "Vertical writing in 1920 x 1080"; case 7 : return "Horizontal writing in 960 x 540"; case 8 : return "Vertical writing in 960 x 540"; case 9 : return "Horizontal writing in 1280 x 720"; case 10 : return "Vertical writing in 1280 x 720"; case 11 : return "Horizontal writing in 720 x 480"; case 12 : return "Vertical writing in 720 x 480"; default : return ""; } } //--------------------------------------------------------------------------- const char* AribStdB24B37_TCS(int8u TCS) { switch (TCS) { case 0 : return "8-bit character codes"; case 1 : return "UCS"; default: return ""; } } //--------------------------------------------------------------------------- const char* AribStdB24B37_rollup_mode(int8u rollup_mode) { switch (rollup_mode) { case 0 : return "Non-roll up"; case 1 : return "Roll up"; default: return ""; } } //--------------------------------------------------------------------------- const char* AribStdB24B37_data_unit_parameter(int8u data_unit_parameter) { switch (data_unit_parameter) { case 0x20 : return "Texts"; case 0x28 : return "Geometric graphics"; case 0x2C : return "Synthesized sound"; case 0x30 : return "1 byte DRCS"; case 0x31 : return "2 byte DRCS"; case 0x34 : return "color map"; case 0x35 : return "Bit map"; default : return ""; } } //--------------------------------------------------------------------------- // Table 7-18 Default macro code strings static const int8u AribStdB24B37_DefaultMacros[][19] = { { 0x1B, 0x24, 0x42, 0x1B, 0x29, 0x4A, 0x1B, 0x2A, 0x30, 0x1B, 0x2B, 0x20, 0x70, 0x0F, 0x1B, 0x7D }, { 0x1B, 0x24, 0x42, 0x1B, 0x29, 0x31, 0x1B, 0x2A, 0x30, 0x1B, 0x2B, 0x20, 0x70, 0x0F, 0x1B, 0x7D }, { 0x1B, 0x24, 0x42, 0x1B, 0x29, 0x20, 0x41, 0x1B, 0x2A, 0x30, 0x1B, 0x2B, 0x20, 0x70, 0x0F, 0x1B, 0x7D }, { 0x1B, 0x28, 0x32, 0x1B, 0x29, 0x34, 0x1B, 0x2A, 0x35, 0x1B, 0x2B, 0x20, 0x70, 0x0F, 0x1B, 0x7D }, { 0x1B, 0x28, 0x32, 0x1B, 0x29, 0x33, 0x1B, 0x2A, 0x35, 0x1B, 0x2B, 0x20, 0x70, 0x0F, 0x1B, 0x7D }, { 0x1B, 0x28, 0x32, 0x1B, 0x29, 0x20, 0x41, 0x1B, 0x2A, 0x35, 0x1B, 0x2B, 0x20, 0x70, 0x0F, 0x1B, 0x7D }, { 0x1B, 0x28, 0x20, 0x41, 0x1B, 0x29, 0x20, 0x42, 0x1B, 0x2A, 0x20, 0x43, 0x1B, 0x2B, 0x20, 0x70, 0x0F, 0x1B, 0x7D }, { 0x1B, 0x28, 0x20, 0x44, 0x1B, 0x29, 0x20, 0x45, 0x1B, 0x2A, 0x20, 0x46, 0x1B, 0x2B, 0x20, 0x70, 0x0F, 0x1B, 0x7D }, { 0x1B, 0x28, 0x20, 0x47, 0x1B, 0x29, 0x20, 0x48, 0x1B, 0x2A, 0x20, 0x49, 0x1B, 0x2B, 0x20, 0x70, 0x0F, 0x1B, 0x7D }, { 0x1B, 0x28, 0x20, 0x4A, 0x1B, 0x29, 0x20, 0x4B, 0x1B, 0x2A, 0x20, 0x4C, 0x1B, 0x2B, 0x20, 0x70, 0x0F, 0x1B, 0x7D }, { 0x1B, 0x28, 0x20, 0x4D, 0x1B, 0x29, 0x20, 0x4E, 0x1B, 0x2A, 0x20, 0x4F, 0x1B, 0x2B, 0x20, 0x70, 0x0F, 0x1B, 0x7D }, { 0x1B, 0x24, 0x42, 0x1B, 0x29, 0x20, 0x42, 0x1B, 0x2A, 0x30, 0x1B, 0x2B, 0x20, 0x70, 0x0F, 0x1B, 0x7D }, { 0x1B, 0x24, 0x42, 0x1B, 0x29, 0x20, 0x43, 0x1B, 0x2A, 0x30, 0x1B, 0x2B, 0x20, 0x70, 0x0F, 0x1B, 0x7D }, { 0x1B, 0x24, 0x42, 0x1B, 0x29, 0x20, 0x44, 0x1B, 0x2A, 0x30, 0x1B, 0x2B, 0x20, 0x70, 0x0F, 0x1B, 0x7D }, { 0x1B, 0x28, 0x31, 0x1B, 0x29, 0x30, 0x1B, 0x2A, 0x4A, 0x1B, 0x2B, 0x20, 0x70, 0x0F, 0x1B, 0x7D }, { 0x1B, 0x28, 0x4A, 0x1B, 0x29, 0x32, 0x1B, 0x2A, 0x20, 0x41, 0x1B, 0x2B, 0x20, 0x70, 0x0F, 0x1B, 0x7D }, }; //--------------------------------------------------------------------------- static const int8u AribStdB24B37_DefaultMacros_size[] = { 16, 16, 17, 16, 16, 17, 19, 19, 19, 19, 19, 17, 17, 17, 16, 17, }; //--------------------------------------------------------------------------- // CRC_CCIT_Xmodem_Table // A CRC is computed like this: // Init: int16u CRC_CCIT_Xmodem = 0x0000; // for each data byte do // CRC_CCIT_Xmodem=(CRC_CCIT_Xmodem<<8) ^ CRC_CCIT_Xmodem_Table[(CRC_CCIT_Xmodem>>8)^(data_byte)]; // Array built with the help of http://www.sanity-free.com/133/crc_16_ccitt_in_csharp.html int16u AribStdB24B37_CRC_CCIT_Xmodem_Table[256] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF, 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6, 0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE, 0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485, 0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D, 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4, 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC, 0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823, 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B, 0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12, 0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A, 0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41, 0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49, 0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70, 0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78, 0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F, 0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E, 0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256, 0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D, 0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C, 0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634, 0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB, 0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3, 0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A, 0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92, 0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9, 0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1, 0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8, 0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0, }; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_AribStdB24B37::File_AribStdB24B37() :File__Analyze() { //Configuration #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_AribStdB24B37; StreamIDs_Width[0]=1; #endif //MEDIAINFO_EVENTS PTS_DTS_Needed=true; //In HasCcis=false; ParseCcis=false; IsAncillaryData=false; //Config Caption_conversion_type=(int8u)-1; //Ancillary #if defined(MEDIAINFO_MPEGTS_YES) Parser=NULL; #endif } //--------------------------------------------------------------------------- File_AribStdB24B37::~File_AribStdB24B37() { #if defined(MEDIAINFO_MPEGTS_YES) delete Parser; #endif } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_AribStdB24B37::Streams_Fill() { for (size_t Pos=0; Pos6) { Skip_XX(245, "Dummy"); } else if (DataIdentifier<4) { Skip_XX(245, "Exchange format data, not supported"); } else { Element_Begin1("Short form data"); int8u LEN, Label_01, Label_3A, Data_Length; Get_B1(LEN, "LEN"); Element_Begin1("display timing"); Get_B1(Label_01, "Label (01)"); BS_Begin(); Skip_S1(6, "Undefined"); Skip_S1(2, "Data-type identifier"); Skip_S1(6, "Undefined"); Skip_S1(2, "Timing-type identifier"); Skip_S1(6, "Undefined"); Skip_S1(2, "Timing-direction identifier"); Skip_B5( "Display timing value"); BS_End(); Element_End0(); Element_Begin1("closed caption data"); Get_B1(Label_3A, "Label (3A)"); Get_B1(Data_Length, "Data Length"); #if defined(MEDIAINFO_MPEGTS_YES) if (Parser==NULL) { Parser=new File_MpegTs; ((File_MpegTs*)Parser)->FromAribStdB24B37=true; Open_Buffer_Init(Parser); } if (FrameInfo.PTS==(int64u)-1) FrameInfo.PTS=FrameInfo.DTS; Parser->FrameInfo=FrameInfo; Open_Buffer_Continue(Parser, Buffer+Buffer_Offset+(size_t)Element_Offset, 188); Element_Offset+=188; #else Skip_XX(188, "TS data"); #endif if (Data_Length==192) { Skip_B2( "Group-A CRC"); Skip_B2( "Group-B CRC"); } else if (Data_Length>188) Skip_XX(Data_Length-188, "Unknown"); Element_End0(); if (LEN>203) Skip_XX(LEN-204, "User Data"); if (LEN<244) Skip_XX(244-LEN, "Unused"); Skip_XX(Element_Size-Element_Offset-6, "Format data"); Element_End0(); } Skip_B6( "ECC"); return; } if (ParseCcis) { int32u CCIS_code; Get_C4 ( CCIS_code, "CCIS_code"); if (CCIS_code==0xFFFFFFFF) { Skip_XX(Element_Size, "?"); return; } Get_B1 ( Caption_conversion_type, "Caption_conversion_type"); Param_Info1(AribStdB24B37_Caption_conversion_type(Caption_conversion_type)); BS_Begin(); Info_S1(2, DRCS_conversion_type, "DRCS_conversion_type"); Param_Info1(AribStdB24B37_DRCS_conversion_type(DRCS_conversion_type)); Skip_S1(6, "reserved"); BS_End(); Skip_B2( "reserved"); Skip_B8( "reserved"); ParseCcis=false; return; } Skip_B1( "Data_identifier"); Skip_B1( "Private_stream_id"); BS_Begin(); Skip_S1(4, "reserved"); Skip_S1(4, "PES_data_packet_header_length"); BS_End(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::Read_Buffer_Unsynched() { #if defined(MEDIAINFO_MPEGTS_YES) if (Parser) Parser->Open_Buffer_Unsynch(); #endif } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_AribStdB24B37::Header_Parse() { //Parsing int16u data_group_size; int8u data_group_id; BS_Begin(); Skip_SB( "data_group_id (update part)"); Get_S1 (5, data_group_id, "data_group_id"); Param_Info1(AribStdB24B37_data_group_id(data_group_id)); Skip_S1(2, "data_group_version"); BS_End(); Skip_B1( "data_group_link_number"); Skip_B1( "last_data_group_link_number"); Get_B2 (data_group_size, "data_group_size"); //Filling Header_Fill_Code(data_group_id, AribStdB24B37_data_group_id(data_group_id)); Header_Fill_Size(Element_Offset+data_group_size+2); } //--------------------------------------------------------------------------- void File_AribStdB24B37::Data_Parse() { //CRC int16u CRC_CCIT_Xmodem=0x0000; const int8u* CRC_CCIT_Xmodem_Buffer=Buffer+Buffer_Offset-Header_Size; //data_group_id position while(CRC_CCIT_Xmodem_Buffer>8)^(*CRC_CCIT_Xmodem_Buffer)]; CRC_CCIT_Xmodem_Buffer++; } if (CRC_CCIT_Xmodem) { Skip_XX(Element_Size, "Data"); Trusted_IsNot("CRC error"); return; } Element_Size-=2; switch (Element_Code) { case 0 : caption_management(); break; case 1 : case 2 : case 3 : case 4 : case 5 : case 6 : case 7 : case 8 : if (Streams.empty()) { Skip_XX(Element_Size, "Waiting for caption_management"); break; } if (Element_Code>Streams.size()) { Skip_XX(Element_Size, "Unknown service"); Trusted_IsNot("Invalid service number"); break; } Streams[(size_t)(Element_Code-1)].Line.clear(); caption_statement(); Streams[(size_t)(Element_Code-1)].Line.clear(); break; default: Skip_XX(Element_Size, "Unknown"); } Element_Size+=2; Skip_B2( "CRC_16"); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_AribStdB24B37::caption_management() //caption_management_data() { //Parsing int32u data_unit_loop_length; int8u TMD, num_languages; BS_Begin(); Get_S1 (2, TMD, "TMD"); Param_Info1(AribStdB24B37_TMD(TMD)); Skip_S1(6, "Reserved"); if (TMD==2) { Skip_S5(36, "OTM"); //Note: time offset (HHMMSSmmm in BCD format) is currently not supported Skip_S5( 4, "Reserved"); } BS_End(); Get_B1 (num_languages, "num_languages"); Streams.clear(); Streams.resize(num_languages); for (int8u pos_languages=0; pos_languages>1) + (Row<=94?112:176); if (Row%2) ShiftJIS[1]=Column+31+(Column>=96); else ShiftJIS[1]=Column+126; wchar_t Temp[5]; int CharSize=MultiByteToWideChar(932, 0, ShiftJIS, 2, Temp, 500); //932 = Shift-JIS (Windows-31J) if (CharSize>0) { Temp[CharSize]=__T('\0'); Param_Info1(Temp); Add (Temp[0]); } #else // __WINDOWS__ //TODO #endif // __WINDOWS__ } //--------------------------------------------------------------------------- void File_AribStdB24B37::Add (Char Character) { Streams[(size_t)(Element_Code-1)].Line+=Character; } //--------------------------------------------------------------------------- void File_AribStdB24B37::Add (Ztring Character) { Streams[(size_t)(Element_Code-1)].Line+=Character; } //--------------------------------------------------------------------------- void File_AribStdB24B37::DefaultMacro() { Element_Begin1("Default Macro"); int8u control_code; Get_B1 (control_code, "control_code"); if ((control_code&0xF0)==0x60) //Known macros { //Buffer const int8u* Save_Buffer=Buffer; size_t Save_Buffer_Offset=Buffer_Offset; size_t Save_Buffer_Size=Buffer_Size; int64u Save_Element_Offset=Element_Offset; int64u Save_Element_Size=Element_Size; Buffer=AribStdB24B37_DefaultMacros[control_code&0x0F]; Buffer_Offset=0; Buffer_Size=AribStdB24B37_DefaultMacros_size[control_code&0x0F]; Element_Offset=0; Element_Size=Buffer_Size; data_unit_data(Element_Size); Buffer=Save_Buffer; Save_Buffer=NULL; Buffer_Offset=Save_Buffer_Offset; Buffer_Size=Save_Buffer_Size; Element_Offset=Save_Element_Offset; Element_Size=Save_Element_Size; } else { Element_Info1("Unknown"); Param_Info1("Unknown"); } Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::Character (int16u CharacterSet, int8u G_Value, int8u FirstByte, int8u SecondByte) { int16u Value=(FirstByte<<8) | SecondByte; //ARIB STD B24/B37 provide numbers with 2 number (Row and Colupmn) a shift of 32 (b00100000) #define Compute(f,s) (((f+32)<<8) | (s+32)) switch (CharacterSet) { case GS_Kanji: Skip_B2( "Character"); if (Value<=Compute(84, 6)) JIS(FirstByte, SecondByte); else switch (Value) { case Compute(92, 1): JIS( 35, 42); break; case Compute(92, 2): JIS( 35, 43); break; case Compute(92, 3): JIS( 35, 44); break; case Compute(92, 4): JIS( 35, 45); break; case Compute(93, 79): JIS( 40, 110); break; case Compute(93, 88): Param_Info1(Ztring().From_UTF8("\xE2\x99\xAB")+__T(" (not exact)")); Add (Ztring().From_UTF8("\xE2\x99\xAB")); break; //Ending music note? case Compute(93, 89): Param_Info1(Ztring().From_UTF8("\xE2\x99\xAB")+__T(" (not exact)")); Add (Ztring().From_UTF8("\xE2\x99\xAB")); break; //Opening music note? case Compute(93, 90): Param_Info1(Ztring().From_UTF8("\xE2\x99\xAB")); Add (Ztring().From_UTF8("\xE2\x99\xAB")); break; //Music note default: Param_Info1("(Unsupported)"); //empty in spec or not yet mapped } break; case GS_Hiragana: case GS_PropHiragana: Skip_C1( "Character"); switch (FirstByte) { case 0x74: case 0x75: case 0x76: Param_Info1("(Unsupported)"); break; //empty in spec case 0x77: JIS( 33, 53); break; case 0x78: JIS( 33, 54); break; case 0x79: JIS( 33, 60); break; case 0x7A: JIS( 33, 35); break; case 0x7B: JIS( 33, 86); break; case 0x7C: JIS( 33, 87); break; case 0x7D: JIS( 33, 34); break; case 0x7E: JIS( 33, 38); break; default : JIS( 36, FirstByte); } break; case GS_Katakana: case GS_PropKatakana: Skip_C1( "Character"); switch (FirstByte) { case 0x77: JIS( 33, 41); break; case 0x78: JIS( 33, 42); break; case 0x79: JIS( 33, 51); break; case 0x7A: JIS( 33, 33); break; case 0x7B: JIS( 33, 86); break; case 0x7C: JIS( 33, 87); break; case 0x7D: JIS( 33, 34); break; case 0x7E: JIS( 33, 38); break; default : JIS( 37, FirstByte); break; } break; case GS_Alphanumeric: case GS_PropAscii: Skip_C1( "Character"); Add(FirstByte); break; case GS_DRCS|GS_Macro : DefaultMacro(); break; default : ; switch (Streams[(size_t)(Element_Code-1)].G_Width[G_Value]) { case 1 : Skip_C1("Character (unsupported)"); break; case 2 : Skip_C2("Character (unsupported)"); break; default: Skip_XX(Streams[(size_t)(Element_Code-1)].G_Width[G_Value], "Character (unsupported)"); } } } //--------------------------------------------------------------------------- void File_AribStdB24B37::control_code() { int8u control_code; Peek_B1(control_code); switch (control_code) { // Table 7-15 C0 control set case 0x00 : NUL(); break; case 0x07 : BEL(); break; case 0x08 : APB(); break; case 0x09 : APF(); break; case 0x0A : APD(); break; case 0x0B : APU(); break; case 0x0C : CS(); break; case 0x0D : APR(); break; case 0x0E : LS1(); break; case 0x0F : LS0(); break; case 0x16 : PAPF(); break; case 0x18 : CAN(); break; case 0x19 : SS2(); break; case 0x1B : ESC(); break; case 0x1C : APS(); break; case 0x1D : SS3(); break; case 0x1E : RS(); break; case 0x1F : US(); break; // Table 7-16 C1 control set case 0x80: //BKF case 0x81: //RDF case 0x82: //GRF case 0x83: //YLF case 0x84: //BLF case 0x85: //MGF case 0x86: //CNF case 0x87: //WHF xxF(); break; case 0x88: //SSZ case 0x89: //MSZ case 0x8A: //NSZ xxZ(); break; case 0x8B : SZX(); break; case 0x90 : COL(); break; case 0x91 : FLC(); break; case 0x92 : CDC(); break; case 0x93 : POL(); break; case 0x94 : WMM(); break; case 0x95 : MACRO(); break; case 0x97 : HLC(); break; case 0x98 : RPC(); break; case 0x99 : SPL(); break; case 0x9A : STL(); break; case 0x9B : CSI(); break; case 0x9D : TIME(); break; // Unknown default : Skip_XX(Element_Size-Element_Offset, "Unknown"); } } //--------------------------------------------------------------------------- void File_AribStdB24B37::NUL() { Element_Begin1("NUL - Empty"); Skip_B1( "control_code"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::BEL() { Element_Begin1("BEL - Bell"); Skip_B1( "control_code"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::APB() { Element_Begin1("APB - Active position backward"); Skip_B1( "control_code"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::APF() { Element_Begin1("APF - Active position forwards"); Skip_B1( "control_code"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::APD() { Element_Begin1("APD - Active position down"); Skip_B1( "control_code"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::APU() { Element_Begin1("APU - Active position up"); Skip_B1( "control_code"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::CS() { Element_Begin1("CS - Clear Screen"); Skip_B1( "control_code"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::APR() { Element_Begin1("APR - Line return at operation position"); Skip_B1( "control_code"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::LS1() { Element_Begin1("LS1 - Locking shift 1"); Skip_B1( "control_code"); Element_End0(); Streams[(size_t)(Element_Code-1)].GL=1; } //--------------------------------------------------------------------------- void File_AribStdB24B37::LS0() { Element_Begin1("LS0 - Locking shift 0"); Skip_B1( "control_code"); Element_End0(); Streams[(size_t)(Element_Code-1)].GL=0; } //--------------------------------------------------------------------------- void File_AribStdB24B37::PAPF() { Element_Begin1("PAPF - Move forwards at specified operation position"); Skip_B1( "control_code"); Skip_B1( "P1"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::CAN() { Element_Begin1("CAN - Cancel"); Skip_B1( "control_code"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::SS2() { Element_Begin1("SS2 - Single shift 2"); Skip_B1( "control_code"); Element_End0(); Streams[(size_t)(Element_Code-1)].GL_SS=3; } //--------------------------------------------------------------------------- void File_AribStdB24B37::ESC() { Element_Begin1("ESC - Escape"); int8u P1; Skip_B1( "control_code"); Get_B1 (P1, "P1"); switch (P1) { // Table 7-2 Designation of graphic sets case 0x24 : { int8u P2; Get_B1 (P2, "P2"); switch (P2) { case 0x28 : { int8u P3; Get_B1 (P3, "P3"); switch (P3) { case 0x20 : { int8u P4; Get_B1 (P4, "P4"); Streams[(size_t)(Element_Code-1)].G[0]=GS_DRCS|P4; Streams[(size_t)(Element_Code-1)].G_Width[0]=2; } break; case 0x29 : case 0x2A : case 0x2B : default : Streams[(size_t)(Element_Code-1)].G[0]=P2; Streams[(size_t)(Element_Code-1)].G_Width[0]=2; } } break; case 0x29 : case 0x2A : case 0x2B : { int8u P3; Get_B1 (P3, "P3"); if (P3==0x20) { int8u P4; Get_B1 (P4, "P4"); Streams[(size_t)(Element_Code-1)].G[P2-0x28]=GS_DRCS|P4; } else Streams[(size_t)(Element_Code-1)].G[P2 - 0x28]=P3; Streams[(size_t)(Element_Code-1)].G_Width[P2-0x28]=2; } break; default : Streams[(size_t)(Element_Code-1)].G[0]=P2; Streams[(size_t)(Element_Code-1)].G_Width[0]=2; } } break; case 0x28 : case 0x29 : case 0x2A : case 0x2B : { int8u P2; Get_B1 (P2, "P2"); if (P2==0x20) { int8u P3; Get_B1 (P3, "P3"); Streams[(size_t)(Element_Code-1)].G[P1-0x28]=GS_DRCS|P3; } else Streams[(size_t)(Element_Code-1)].G[P1 - 0x28]=P2; Streams[(size_t)(Element_Code-1)].G_Width[P1-0x28]=1; } break; // Table 7-1 Invocation of code elements (locking shift) case 0x6E : Streams[(size_t)(Element_Code-1)].GL=2; break; case 0x6F : Streams[(size_t)(Element_Code-1)].GL=3; break; case 0x7C : Streams[(size_t)(Element_Code-1)].GR=3; break; case 0x7D : Streams[(size_t)(Element_Code-1)].GR=2; break; case 0x7E : Streams[(size_t)(Element_Code-1)].GR=1; break; default : ; //Problem? } Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::APS() { Element_Begin1("APS - Specify operation position"); Skip_B1( "control_code"); Skip_B1( "P1"); Skip_B1( "P2"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::SS3() { Element_Begin1("SS3 - Single shift 3"); Skip_B1( "control_code"); Element_End0(); Streams[(size_t)(Element_Code-1)].GL_SS=3; } //--------------------------------------------------------------------------- void File_AribStdB24B37::RS() { Element_Begin1("RS - Record separator"); Skip_B1( "control_code"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::US() { Element_Begin1("US - Unit separator"); Skip_B1( "control_code"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::xxF() { Element_Begin1("xxF - foreground"); Skip_B1( "control_code"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::xxZ() { Element_Begin1("xxZ - size"); Skip_B1( "control_code"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::SZX() { Element_Begin1("SZX - Specified size"); Skip_B1( "control_code"); Skip_B1( "P1"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::COL() { Element_Begin1("COL - Color specification"); int8u P1; Skip_B1( "control_code"); Get_B1 (P1, "P1"); if (P1==0x20) Skip_B1( "P2"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::FLC() { Element_Begin1("FLC - Flashing control"); Skip_B1( "control_code"); Skip_B1( "P1"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::CDC() { Element_Begin1("CDC - Conceal Display Controls"); int8u P1; Skip_B1( "control_code"); Get_B1 (P1, "P1"); if (P1==0x20) Skip_B1( "P2"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::POL() { Element_Begin1("POL - Pattern polarity"); Skip_B1( "control_code"); Skip_B1( "P1"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::WMM() { Element_Begin1("WMM - Modification of write mode"); Skip_B1( "control_code"); Skip_B1( "P1"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::MACRO() { Element_Begin1("MACRO - Macro specification"); Skip_B1( "control_code"); Skip_B1( "P1"); Element_End0(); //TODO: save macros } //--------------------------------------------------------------------------- void File_AribStdB24B37::HLC() { Element_Begin1("HLC - Enclosure control"); Skip_B1( "control_code"); Skip_B1( "P1"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::RPC() { Element_Begin1("RPC - Character repeat"); Skip_B1( "control_code"); Skip_B1( "P1"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::SPL() { Element_Begin1("SPL - End of underline and mosaic separation"); Skip_B1( "control_code"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::STL() { Element_Begin1("STL - Start of underline and mosaic separation"); Skip_B1( "control_code"); Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::CSI() { Element_Begin1("CSI - Extended Control Codes"); Skip_B1( "control_code"); vector Params; Params.push_back(0); size_t Pos=0; while (Element_Offset+Pos<=Element_Size) { int8u Value=Buffer[Buffer_Offset+Element_Offset+Pos]; Pos++; if (Value==0x3B) Params.push_back(0); else if (Value>=0x30 && Value<0x3A) { Params[Params.size()-1]*=10; Params[Params.size()-1]+=Value&0x0F; } else if (Value>=0x40 && Value<0x80) { Pos--; Skip_Local(Pos, "Values"); Get_B1(Value, "Delimiter"); switch (Value) { case 0x3B: Element_Info1("SRC - Raster Colour Designation"); break; case 0x42: Element_Info1("GSM - Character deformation"); break; case 0x53: Element_Info1("SWF - Set Writing Format"); if (!Params.empty() && Params[0]<0x100) Streams[(size_t)(Element_Code-1)].Format=(int8u)Params[0]; break; case 0x54: Element_Info1("CCC - Composite Character Composition"); break; case 0x56: Element_Info1("SDF - Set Display Format"); break; case 0x57: Element_Info1("SSM - Character composition dot designation"); break; case 0x58: Element_Info1("SHS - Set Horizontal Spacing"); break; case 0x59: Element_Info1("SVS - Set Vertical Spacing"); break; case 0x5B: Element_Info1("PLD - Partially Line Down"); break; case 0x5C: Element_Info1("PLU - Partialyl Line Up"); break; case 0x5D: Element_Info1("GAA - Colouring block"); break; case 0x5F: Element_Info1("SDF - Set Display Position"); break; case 0x61: Element_Info1("ACPS - Active Coordinate Position Set"); //TODO: positioning break; case 0x62: Element_Info1("TCC - Switching control"); // Also Table 5-3 break; case 0x63: Element_Info1("ORN - Ornament Control"); break; case 0x64: Element_Info1("MDF - Font"); break; case 0x65: Element_Info1("CFS - Character Font Set"); break; case 0x66: Element_Info1("XCS - External Character Set"); break; case 0x67: Element_Info1("SCR - Scroll designation"); // Also Table 5-4 break; case 0x68: Element_Info1("PRA - Built-in sound replay"); break; case 0x69: Element_Info1("ACS - Alternative Character Set"); break; case 0x6E: Element_Info1("RCS - Raster Colour command"); break; case 0x6F: Element_Info1("SCS - Skip Character Set"); break; default: ; //Unknown } break; } } Element_End0(); } //--------------------------------------------------------------------------- void File_AribStdB24B37::TIME() { Element_Begin1("TIME - Time"); Skip_B1( "control_code"); Skip_B1( "P1"); Skip_B1( "P2"); Element_End0(); // if P1 is 0x20, there should be a delay } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_DVBSUBTITLE_YES MediaInfoLib/Source/MediaInfo/Text/File_AribStdB24B37.h100777 0 0 10615 12263604515 15711 0/* 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 DVB Subtitle streams // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_AribStdB24B37H #define MediaInfo_File_AribStdB24B37H //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_AribStdB24B37 //*************************************************************************** class File_AribStdB24B37 : public File__Analyze { public : //Constructor/Destructor File_AribStdB24B37(); ~File_AribStdB24B37(); //In bool HasCcis; bool ParseCcis; bool IsAncillaryData; //enums enum graphic_set { // Table 7-3 Classification of code set and Final Byte GS_Kanji = 0x42, //2-byte GS_Alphanumeric = 0x4A, GS_Hiragana = 0x30, GS_Katakana = 0x31, GS_Mosaic_A = 0x32, GS_Mosaic_B = 0x33, GS_Mosaic_C = 0x34, GS_Mosaic_D = 0x35, GS_PropAscii = 0x36, GS_PropHiragana = 0x37, GS_PropKatakana = 0x38, GS_JisX0201_Katakana = 0x49, GS_Jis_Kanji_Plane1 = 0x39, //2-byte GS_Jis_Kanji_Plane2 = 0x3A, //2-byte GS_AddSymbols = 0x3B, //2-byte GS_Macro = 0x70, GS_G = 0x0000, // G set GS_DRCS = 0x0100, // DRCS set }; private : //Streams management void Streams_Fill(); void Streams_Finish(); //Buffer - Per element void Read_Buffer_Continue(); void Read_Buffer_Unsynched(); //Buffer - Per element void Header_Parse(); void Data_Parse(); //Elements void caption_management(); void caption_statement(); void data_unit_data(int64u End); void Character(int16u CharacterSet, int8u G_Value, int8u FirstByte, int8u SecondByte); void Add(Char Character); void Add(Ztring Character); void DefaultMacro(); void control_code(); void NUL(); void BEL(); void APB(); void APF(); void APD(); void APU(); void CS(); void APR(); void LS1(); void LS0(); void PAPF(); void CAN(); void SS2(); void ESC(); void APS(); void SS3(); void RS(); void US(); void xxF(); void xxZ(); void SZX(); void COL(); void FLC(); void CDC(); void POL(); void WMM(); void MACRO(); void HLC(); void RPC(); void SPL(); void STL(); void CSI(); void TIME(); //Stream struct stream { string ISO_639_language_code; int8u DMF_reception; int8u Format; int16u G[4]; int8u G_Width[4]; int8u GL; // Locked int8u GL_SS; // Single int8u GR; // Locked Ztring Line; stream() { DMF_reception=(int8u)-1; Format=(int8u)-1; // Table 8-2 Initial status G[0]=GS_Kanji; G[1]=GS_Alphanumeric; G[2]=GS_Hiragana; G[3]=GS_DRCS|GS_Macro; G_Width[0]=2; G_Width[1]=1; G_Width[2]=1; G_Width[3]=1; GL=0; GL_SS=0; GR=2; } }; typedef std::vector streams; streams Streams; //Temp void JIS (int8u Row, int8u Column); //Config int8u Caption_conversion_type; //Ancillary #if defined(MEDIAINFO_MPEGTS_YES) File__Analyze* Parser; #endif }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Text/File_Cdp.cpp100777 0 0 46650 12226004262 14676 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_CDP_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Text/File_Cdp.h" #if defined(MEDIAINFO_EIA708_YES) #include "MediaInfo/Text/File_Eia708.h" #endif #if defined(MEDIAINFO_EIA608_YES) #include "MediaInfo/Text/File_Eia608.h" #endif #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events.h" #endif //MEDIAINFO_EVENTS using namespace std; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- //*************************************************************************** // Info //*************************************************************************** //--------------------------------------------------------------------------- const char* Cdp_cc_type(int8u cc_type) { switch (cc_type) { case 0 : return "CEA-608 line 21 field 1 closed captions"; //closed caption 3 if this is second field case 1 : return "CEA-608 line 21 field 2 closed captions"; //closed caption 4 if this is second field case 2 : return "DTVCC Channel Packet Data"; case 3 : return "DTVCC Channel Packet Start"; default : return ""; } } //--------------------------------------------------------------------------- float32 Cdp_cdp_frame_rate(int8u cdp_frame_rate) { switch (cdp_frame_rate) { case 1 : return (float32)23.976; case 2 : return (float32)24.000; case 3 : return (float32)25.000; case 4 : return (float32)29.970; case 5 : return (float32)30.000; case 6 : return (float32)50.000; case 7 : return (float32)59.940; case 8 : return (float32)60.000; default : return (float32) 0.000; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Cdp::File_Cdp() :File__Analyze() { //Config PTS_DTS_Needed=true; //In AspectRatio=0; //Temp ParserName=__T("CDP"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Cdp; StreamIDs_Width[0]=1; #endif //MEDIAINFO_EVENTS Streams.resize(3); //CEA-608 Field 1, CEA-608 Field 2, CEA-708 Channel Streams_Count=0; //In WithAppleHeader=false; AspectRatio=0; } //--------------------------------------------------------------------------- File_Cdp::~File_Cdp() { for (size_t Pos=0; PosParser && Streams[Pos]->Parser->Status[IsFilled] /*&& Streams[Pos]->Parser->Status[IsUpdated]*/ && Streams[Pos]->Parser->Count_Get(Stream_Text)) Streams_Update_PerStream(Pos); } //--------------------------------------------------------------------------- void File_Cdp::Streams_Update_PerStream(size_t Pos) { if (Streams[Pos]==NULL) return; Update(Streams[Pos]->Parser); if (Streams[Pos]->Parser) { for (size_t Pos2=0; Pos2Parser->Count_Get(Stream_Text); Pos2++) { Stream_Prepare(Stream_Text); Merge(*Streams[Pos]->Parser, Stream_Text, Pos2, StreamPos_Last); if (WithAppleHeader) Fill(Stream_Text, StreamPos_Last, "MuxingMode", "Final Cut"); Fill(Stream_Text, StreamPos_Last, "MuxingMode", "CDP"); Fill(Stream_Text, StreamPos_Last, Text_ID, Streams[Pos]->Parser->Retrieve(Stream_Text, Pos2, Text_ID), true); Ztring LawRating=Streams[Pos]->Parser->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); } Ztring LawRating=Streams[Pos]->Parser->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); } } //--------------------------------------------------------------------------- void File_Cdp::Streams_Finish() { Clear(Stream_Text); //Per stream for (size_t Pos=0; PosParser && Streams[Pos]->Parser->Status[IsAccepted] /*&& Streams[Pos]->Parser->Status[IsUpdated]*/) { Finish(Streams[Pos]->Parser); Streams_Update_PerStream(Pos); } } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- void File_Cdp::Read_Buffer_Unsynched() { //Parsing for (size_t Pos=0; PosParser) Streams[Pos]->Parser->Open_Buffer_Unsynch(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Cdp::Read_Buffer_Continue() { if (Buffer_Size==0) return; if (WithAppleHeader) { int32u Size, Magic; Get_B4 (Size, "Size"); Get_B4 (Magic, "Magic"); FILLING_BEGIN(); if (Magic!=0x63636470) { Reject("CDP"); return; } FILLING_END(); } //CRC int8u CRC=0; for (size_t Pos=WithAppleHeader?8:0; Pos=0x75 && section_id<=0xEF) future_section(); else Skip_XX(Element_Size-Element_Offset, "Unknown"); } } } //*************************************************************************** // Functions //*************************************************************************** //--------------------------------------------------------------------------- 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(); } //--------------------------------------------------------------------------- void File_Cdp::time_code_section() { Element_Begin1("time_code_section"); Skip_B1( "time_code_section_id"); BS_Begin(); Mark_1(); Mark_1(); Skip_S1(2, "tc_10hrs"); Skip_S1(4, "tc_1hrs"); Mark_1(); Skip_S1(3, "tc_10min"); Skip_S1(4, "tc_1min"); Skip_SB( "tc_field_flag"); Skip_S1(3, "tc_10sec"); Skip_S1(4, "tc_1sec"); Skip_SB( "drop_frame_flag"); Mark_0(); Skip_S1(2, "tc_10fr"); Skip_S1(4, "tc_1fr"); BS_End(); Element_End0(); } //--------------------------------------------------------------------------- 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; PosParser==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_Cdp::ccsvcinfo_section() { //Parsing int8u svc_count; Element_Begin1("ccsvcinfo_section"); Skip_B1( "ccsvcinfo_id"); BS_Begin(); Skip_SB( "reserved"); Skip_SB( "svc_info_start"); Skip_SB( "svc_info_change"); Skip_SB( "svc_info_complete"); Get_S1 (4, svc_count, "svc_count"); BS_End(); for (int8u Pos=0; Pos Streams; size_t Streams_Count; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Text/File_Cmml.cpp100777 0 0 7436 12226004262 15037 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Note : the buffer must be given in ONE call // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_CMML_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Text/File_Cmml.h" using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Cmml::Header_Parse() { //Filling Header_Fill_Code(0, "Cmml"); Header_Fill_Size(Element_Size); } //--------------------------------------------------------------------------- void File_Cmml::Data_Parse() { //Parsing if (Status[IsAccepted]) Configuration(); else Identification(); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Cmml::Identification() { Element_Name("Identification"); //Parsing int16u VersionMajor, VersionMinor; Skip_Local(8, "Signature"); Get_L2 (VersionMajor, "version major"); Get_L2 (VersionMinor, "version minor"); Skip_L8( "granule rate numerator"); Skip_L8( "granule rate denominator"); Skip_L1( "granule shift"); FILLING_BEGIN(); Accept("CMML"); Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, Text_Format, "CMML"); Fill(Stream_Text, 0, Text_Codec, "CMML"); FILLING_END(); } //--------------------------------------------------------------------------- void File_Cmml::Configuration() { Element_Name("Configuration"); //Parsing Ztring Data; Get_UTF8(Element_Size, Data, "Data"); FILLING_BEGIN(); Ztring Value; Value=Data.SubString(__T(""), __T("")); if (!Value.empty()) Fill(Stream_Text, 0, Text_Title, Value.SubString(__T(""), __T(""))); if (Data.find(__T("Parser && Streams[Pos]->Parser->Status[IsFilled] /*&& Streams[Pos]->Parser->Status[IsUpdated]*/ && Streams[Pos]->Parser->Count_Get(Stream_Text)) Streams_Update_PerStream(Pos); } //--------------------------------------------------------------------------- void File_DtvccTransport::Streams_Update_PerStream(size_t Pos) { if (Streams[Pos]==NULL) return; Update(Streams[Pos]->Parser); if (Streams[Pos]->Parser) { for (size_t Pos2=0; Pos2Parser->Count_Get(Stream_Text); Pos2++) { Stream_Prepare(Stream_Text); Merge(*Streams[Pos]->Parser, Stream_Text, Pos2, StreamPos_Last); Fill(Stream_Text, StreamPos_Last, "MuxingMode", Format==Format_DVD?__T("DVD-Video"):__T("DTVCC Transport")); Fill(Stream_Text, StreamPos_Last, Text_ID, Streams[Pos]->Parser->Retrieve(Stream_Text, Pos2, Text_ID), true); } Ztring LawRating=Streams[Pos]->Parser->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); } } //--------------------------------------------------------------------------- void File_DtvccTransport::Streams_Finish() { Clear(Stream_Text); //Per stream for (size_t Pos=0; PosParser && Streams[Pos]->Parser->Status[IsAccepted] /*&& Streams[Pos]->Parser->Status[IsUpdated]*/) { Finish(Streams[Pos]->Parser); Streams_Update_PerStream(Pos); } } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- void File_DtvccTransport::Read_Buffer_Unsynched() { //Parsing for (size_t Pos=0; PosParser) Streams[Pos]->Parser->Open_Buffer_Unsynch(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_DtvccTransport::Read_Buffer_Continue() { //Parsing Element_Begin1(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; PosParser==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]) { //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; if (AspectRatio) ((File_Eia708*)Streams[2]->Parser)->AspectRatio=AspectRatio; #endif if (cc_type==3) { ((File_Eia708*)Streams[2]->Parser)->cc_type=4; //Magic value saying that the buffer must be kept (this is only a point of synchro from the undelying layer) Open_Buffer_Continue(Streams[Parser_Pos]->Parser, Buffer+(size_t)(Buffer_Offset+Element_Offset), 0); ((File_Eia708*)Streams[2]->Parser)->cc_type=3; } } else { } Open_Buffer_Continue(Streams[Parser_Pos]->Parser, Buffer+(size_t)(Buffer_Offset+Element_Offset), 2); Element_Show(); Element_Offset+=2; //Filled if (!Status[IsAccepted]) Accept("DTVCC Transport"); } else Skip_XX(2, "Data"); Element_End0(); } else Skip_XX(2, "Junk"); Element_End0(); } } 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 //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_DtvccTransport //*************************************************************************** class File_DtvccTransport : public File__Analyze { public : //In enum format { Format_Unknown, Format_A53_4_GA94_03, //MPEG_cc_data Format_DVD, //Unknown standard }; format Format; float64 AspectRatio; //Constructor/Destructor File_DtvccTransport(); ~File_DtvccTransport(); private : //Streams management void Streams_Update(); void Streams_Update_PerStream(size_t Pos); void Streams_Finish(); //Synchro void Read_Buffer_Unsynched(); //Buffer - Global void Read_Buffer_Continue(); //Temp struct stream { File__Analyze* Parser; stream() { Parser=NULL; } ~stream() { delete Parser; //Parser=NULL; } }; std::vector Streams; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Text/File_DvbSubtitle.cpp100777 0 0 37130 12226004262 16410 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DVBSUBTITLE_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Text/File_DvbSubtitle.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Info //*************************************************************************** const int8u DvbSubtitle_region_depth[8]= { 0, 2, 4, 8, 0, 0, 0, 0, }; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_DvbSubtitle::File_DvbSubtitle() :File__Analyze() { //Configuration ParserName=__T("DVB Subtitle"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_DvbSubtitle; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_TRACE Trace_Layers_Update(8); //Stream #endif //MEDIAINFO_TRACE PTS_DTS_Needed=true; IsRawStream=true; MustSynchronize=true; //In Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.3?32:2; //Temp MustFindDvbHeader=true; } //--------------------------------------------------------------------------- File_DvbSubtitle::~File_DvbSubtitle() { } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_DvbSubtitle::Streams_Fill() { Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, Text_Format, "DVB Subtitle"); for (std::map::iterator subtitle_stream=subtitle_streams.begin(); subtitle_stream!=subtitle_streams.end(); ++subtitle_stream) for (std::map::iterator page=subtitle_stream->second.pages.begin(); page!=subtitle_stream->second.pages.end(); ++page) for (std::map::iterator region=page->second.regions.begin(); region!=page->second.regions.end(); ++region) { Fill(Stream_Text, 0, "subtitle_stream_id", subtitle_stream->first); (*Stream_More)[Stream_Text][0](Ztring().From_Local("subtitle_stream_id"), Info_Options)=__T("N NI"); Fill(Stream_Text, 0, "page_id", page->first); (*Stream_More)[Stream_Text][0](Ztring().From_Local("page_id"), Info_Options)=__T("N NI"); Fill(Stream_Text, 0, "region_id", region->first); (*Stream_More)[Stream_Text][0](Ztring().From_Local("region_id"), Info_Options)=__T("N NI"); Fill(Stream_Text, 0, "region_horizontal_address", region->second.page_composition_segment?Ztring::ToZtring(region->second.region_horizontal_address):Ztring()); (*Stream_More)[Stream_Text][0](Ztring().From_Local("region_horizontal_address"), Info_Options)=__T("N NI"); Fill(Stream_Text, 0, "region_vertical_address", region->second.page_composition_segment?Ztring::ToZtring(region->second.region_vertical_address):Ztring()); (*Stream_More)[Stream_Text][0](Ztring().From_Local("region_vertical_address"), Info_Options)=__T("N NI"); Fill(Stream_Text, 0, "region_width", region->second.region_composition_segment?Ztring::ToZtring(region->second.region_width):Ztring()); (*Stream_More)[Stream_Text][0](Ztring().From_Local("region_width"), Info_Options)=__T("N NI"); Fill(Stream_Text, 0, "region_height", region->second.region_composition_segment?Ztring::ToZtring(region->second.region_height):Ztring()); (*Stream_More)[Stream_Text][0](Ztring().From_Local("region_height"), Info_Options)=__T("N NI"); Fill(Stream_Text, 0, "region_depth", region->second.region_composition_segment?Ztring::ToZtring(DvbSubtitle_region_depth[region->second.region_depth]):Ztring()); (*Stream_More)[Stream_Text][0](Ztring().From_Local("region_depth"), Info_Options)=__T("N NI"); } } //--------------------------------------------------------------------------- void File_DvbSubtitle::Streams_Finish() { } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_DvbSubtitle::Synchronize() { //Synchronizing if (MustFindDvbHeader) { while(Buffer_Offset+3<=Buffer_Size) { if (Buffer[Buffer_Offset]==0x20 && Buffer[Buffer_Offset+1]==0x00 && (Buffer[Buffer_Offset+2]==0x0F || Buffer[Buffer_Offset+1]==0xFF)) break; Buffer_Offset++; } if (Buffer_Offset+3>Buffer_Size) return false; Accept(); } else { while(Buffer_Offset=Buffer_Size) return false; } //Synched is OK Synched=true; return true; } //--------------------------------------------------------------------------- bool File_DvbSubtitle::Synched_Test() { if (MustFindDvbHeader) { //Must have enough buffer for having header if (Buffer_Offset+1>Buffer_Size) return false; if (CC2(Buffer+Buffer_Offset)!=0x2000) { Synched=false; return true; } //Displaying it Element_Size=2; Skip_B1( "data_identifier"); Get_B1 (subtitle_stream_id, "subtitle_stream_id"); Buffer_Offset+=2; MustFindDvbHeader=false; } //Must have enough buffer for having header if (Buffer_Offset+1>Buffer_Size) return false; //Quick test of synchro if (Buffer[Buffer_Offset]!=0x0F && Buffer[Buffer_Offset]!=0xFF) { Synched=false; return true; } //We continue return true; } //--------------------------------------------------------------------------- void File_DvbSubtitle::Read_Buffer_Unsynched() { MustParseTheHeaderFile=true; Synched=false; } //*************************************************************************** // Buffer - Demux //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX bool File_DvbSubtitle::Demux_UnpacketizeContainer_Test() { if (Demux_Offset==0) { Demux_Offset=Buffer_Offset; } while (Demux_OffsetBuffer_Size) return false; //No complete frame int16u segment_length=BigEndian2int16u(Buffer+Demux_Offset+4); Demux_Offset+=6+segment_length; if (Demux_Offset>=Buffer_Size) return false; //No complete frame } if (Demux_Offset>=Buffer_Size) return false; //No complete frame Demux_UnpacketizeContainer_Demux(); Demux_TotalBytes++; //0xFF is not demuxed return true; } #endif //MEDIAINFO_DEMUX //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_DvbSubtitle::Header_Parse() { //Parsing int8u sync_byte; Get_B1 (sync_byte, "sync_byte"); switch (sync_byte) { case 0xFF : //Stuffing MustFindDvbHeader=true; //Filling Header_Fill_Code(0xFF, "end_of_PES_data_field_marker"); Header_Fill_Size(1); return; default : ; //Normal (0x0F) } int16u segment_length; int8u segment_type; Get_B1 (segment_type, "segment_type"); Get_B2 (page_id, "page_id"); Get_B2 (segment_length, "segment_length"); //Filling Header_Fill_Code(segment_type); Header_Fill_Size(Element_Offset+segment_length); } //--------------------------------------------------------------------------- void File_DvbSubtitle::Data_Parse() { switch (Element_Code) { case 0x10 : page_composition_segment(); break; case 0x11 : region_composition_segment(); break; case 0xFF : //end_of_PES_data_field_marker Frame_Count++; if (!Status[IsFilled] && Frame_Count>Frame_Count_Valid) { Fill(); Finish(); } return; default : if (Element_Size) Skip_XX(Element_Size, "Unknown"); } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_DvbSubtitle::page_composition_segment() { Element_Name("page_composition_segment"); //Parsing Skip_B1( "page_time_out"); BS_Begin(); Skip_S1(4, "page_version_number"); Skip_S1(2, "page_state"); Skip_S1(2, "reserved"); BS_End(); while(Element_Offset regions; //Key is region_id }; struct subtitle_stream_data { std::map pages; //Key is page_id }; std::map subtitle_streams; //Key is subtitle_stream_id }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Text/File_Eia608.cpp100777 0 0 127776 12262743712 15167 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_EIA608_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Text/File_Eia608.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" using namespace std; //--------------------------------------------------------------------------- //*************************************************************************** // Constants //*************************************************************************** //--------------------------------------------------------------------------- // CAE-608-E section F.1.1.5 static const int8u Eia608_PAC_Row[]= { 10, 0, //or 1 2, //or 3 11, //or 12 13, //or 14 4, //or 5 6, //or 7 8 //or 9 }; //*************************************************************************** // //*************************************************************************** namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Eia608::File_Eia608() :File__Analyze() { //Configuration #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Eia608; StreamIDs_Width[0]=1; #endif //MEDIAINFO_EVENTS ParserName=__T("EIA-608"); PTS_DTS_Needed=true; //In cc_type=(int8u)-1; //Temp XDS_Level=(size_t)-1; TextMode=false; DataChannelMode=false; cc_data_1_Old=0x00; cc_data_2_Old=0x00; HasContent=false; } //--------------------------------------------------------------------------- File_Eia608::~File_Eia608() { for (size_t Pos=0; PosFile_Eia608_DisplayEmptyStream_Get() && Streams.size()<2) Streams.resize(2); for (size_t StreamPos=0; StreamPosFile_Eia608_DisplayEmptyStream_Get())) { Stream_Prepare(Stream_Text); Fill(Stream_Text, StreamPos_Last, Text_Format, "EIA-608"); Fill(Stream_Text, StreamPos_Last, Text_StreamSize, 0); Fill(Stream_Text, StreamPos_Last, Text_BitRate_Mode, "CBR"); if (cc_type!=(int8u)-1) { string ID=StreamPos<2?"CC":"T"; ID+='1'+(cc_type*2)+(StreamPos%2); Fill(Stream_Text, StreamPos_Last, Text_ID, ID); Fill(Stream_Text, StreamPos_Last, "ServiceName", ID); (*Stream_More)[StreamKind_Last][StreamPos_Last](Ztring().From_Local("ServiceName"), Info_Options)=__T("N NT"); } } } //--------------------------------------------------------------------------- void File_Eia608::Streams_Finish() { } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- void File_Eia608::Read_Buffer_Unsynched() { for (size_t StreamPos=0; StreamPosCC_Displayed.size(); Pos_Y++) { for (size_t Pos_X=0; Pos_XCC_Displayed[Pos_Y].size(); Pos_X++) if (Streams[StreamPos]) { Streams[StreamPos]->CC_Displayed[Pos_Y][Pos_X].Value=L' '; Streams[StreamPos]->CC_Displayed[Pos_Y][Pos_X].Attribute=0; if (StreamPos<2) { Streams[StreamPos]->CC_NonDisplayed[Pos_Y][Pos_X].Value=L' '; Streams[StreamPos]->CC_NonDisplayed[Pos_Y][Pos_X].Attribute=0; } } } Streams[StreamPos]->Synched=false; } XDS_Data.clear(); XDS_Level=(size_t)-1; #if MEDIAINFO_EVENTS TextMode=true; DataChannelMode=true; HasChanged(); TextMode=true; DataChannelMode=false; HasChanged(); TextMode=false; DataChannelMode=true; HasChanged(); TextMode=false; DataChannelMode=false; HasChanged(); #endif //MEDIAINFO_EVENTS } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Eia608::Read_Buffer_Init() { #if MEDIAINFO_DEMUX if (Frame_Count_NotParsedIncluded==(int64u)-1) Frame_Count_NotParsedIncluded=Config->Demux_FirstFrameNumber_Get(); if (FrameInfo.DUR==(int64u)-1 && Config->Demux_Rate_Get()) FrameInfo.DUR=float64_int64s(((float64)1000000000)/Config->Demux_Rate_Get()); if (FrameInfo.DTS==(int64u)-1) FrameInfo.DTS=Config->Demux_FirstDts_Get(); #endif //MEDIAINFO_DEMUX if (FrameInfo.DUR!=(int64u)-1) { if (FrameInfo.DTS==(int64u)-1) FrameInfo.DTS=0; if (FrameInfo.PTS==(int64u)-1) FrameInfo.PTS=0; } } //--------------------------------------------------------------------------- void File_Eia608::Read_Buffer_AfterParsing() { Frame_Count++; Frame_Count_InThisBlock++; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; if (FrameInfo.DUR!=(int64u)-1) { FrameInfo.DTS+=FrameInfo.DUR; FrameInfo.PTS=FrameInfo.DTS; } } //--------------------------------------------------------------------------- void File_Eia608::Read_Buffer_Continue() { FrameInfo.PTS=FrameInfo.DTS; if (!Status[IsAccepted]) Accept("EIA-608"); int8u cc_data_1, cc_data_2; Get_B1 (cc_data_1, "cc_data"); Get_B1 (cc_data_2, "cc_data"); //Removing checksume cc_data_1&=0x7F; cc_data_2&=0x7F; //Test if non-printing chars (0x10-0x1F) are repeated (CEA-608-E section D.2) if (cc_data_1_Old) { if (cc_data_1_Old==cc_data_1 && cc_data_2_Old==cc_data_2) { //This is duplicate cc_data_1_Old=0x00; cc_data_2_Old=0x00; return; //Nothing to do } else if (cc_type==0) // Field 1 only { //They should be duplicated, there is a problem } cc_data_1_Old=0x00; cc_data_2_Old=0x00; } if ((cc_data_1 && cc_data_1<0x10) || (XDS_Level!=(size_t)-1 && cc_data_1>=0x20)) //XDS { XDS(cc_data_1, cc_data_2); } else if (cc_data_1>=0x20) //Basic characters { size_t StreamPos=TextMode*2+DataChannelMode; if (StreamPos>=Streams.size() || Streams[StreamPos]==NULL || !Streams[StreamPos]->Synched) return; //Not synched Standard(cc_data_1); if ((cc_data_2&0x7F)>=0x20) Standard(cc_data_2); } else if (cc_data_1) //Special Special(cc_data_1, cc_data_2); } //*************************************************************************** // Functions //*************************************************************************** //--------------------------------------------------------------------------- void File_Eia608::XDS(int8u cc_data_1, int8u cc_data_2) { if (cc_data_1 && cc_data_1<0x10 && cc_data_1%2==0) { // Continue cc_data_1--; for (XDS_Level=0; XDS_Level=2 && XDS_Data[XDS_Level][0]==cc_data_1 && XDS_Data[XDS_Level][1]==cc_data_2) break; if (XDS_Level>=XDS_Data.size()) XDS_Level=(size_t)-1; // There is a problem return; } else if (cc_data_1 && cc_data_1<0x0F) { // Start for (XDS_Level=0; XDS_Level=2 && XDS_Data[XDS_Level][0]==cc_data_1 && XDS_Data[XDS_Level][1]==cc_data_2) break; if (XDS_Level>=XDS_Data.size()) { XDS_Level=XDS_Data.size(); XDS_Data.resize(XDS_Level+1); } else XDS_Data[XDS_Level].clear(); // There is a problem, erasing the previous item } if (XDS_Level==(size_t)-1) return; //There is a problem XDS_Data[XDS_Level].push_back(cc_data_1); XDS_Data[XDS_Level].push_back(cc_data_2); if (cc_data_1==0x0F) XDS(); if (XDS_Level!=(size_t)-1 && XDS_Data[XDS_Level].size()>=36) XDS_Data[XDS_Level].clear(); // Clear, this is a security TextMode=0; // This is CC } //--------------------------------------------------------------------------- void File_Eia608::XDS() { if (XDS_Data[XDS_Level].size()<4) { XDS_Data.erase(XDS_Data.begin()+XDS_Level); XDS_Level=(size_t)-1; return; //There is a problem } switch (XDS_Data[XDS_Level][0]) { case 0x01 : XDS_Current(); break; case 0x05 : XDS_Channel(); break; case 0x09 : XDS_PublicService(); break; default : ; } XDS_Data.erase(XDS_Data.begin()+XDS_Level); XDS_Level=(size_t)-1; } //--------------------------------------------------------------------------- void File_Eia608::XDS_Current() { switch (XDS_Data[XDS_Level][1]) { case 0x03 : XDS_Current_ProgramName(); break; case 0x05 : XDS_Current_ContentAdvisory(); break; case 0x08 : XDS_Current_CopyAndRedistributionControlPacket(); break; default : ; } } //--------------------------------------------------------------------------- void File_Eia608::XDS_Current_ContentAdvisory() { if (XDS_Data[XDS_Level].size()!=6) { return; //There is a problem } Clear(Stream_General, 0, General_LawRating); int8u a1a0=(XDS_Data[XDS_Level][2]>>3)&0x3; const char* ContentAdvisory=NULL; string ContentDescriptors; switch (a1a0) { case 0: case 2: switch (XDS_Data[XDS_Level][2]&0x7) //r2r1r0 { case 0 : ContentAdvisory="N/A"; break; case 1 : ContentAdvisory="G"; break; case 2 : ContentAdvisory="PG"; break; case 3 : ContentAdvisory="PG-13"; break; case 4 : ContentAdvisory="R"; break; case 5 : ContentAdvisory="NC-17"; break; case 6 : ContentAdvisory="C"; break; default: ; } break; case 1: switch (XDS_Data[XDS_Level][3]&0x7) //g2g1g0 { case 0 : ContentAdvisory="None"; break; case 1 : ContentAdvisory="TV-Y"; break; case 2 : ContentAdvisory="TV-Y7"; break; case 3 : ContentAdvisory="TV-G"; break; case 4 : ContentAdvisory="TV-PG"; break; case 5 : ContentAdvisory="TV-14"; break; case 6 : ContentAdvisory="TV-MA"; break; case 7 : ContentAdvisory="None"; break; } if (XDS_Data[XDS_Level][2]&0x20) //Suggestive dialogue ContentDescriptors+='D'; if (XDS_Data[XDS_Level][3]&0x8) //Coarse language ContentDescriptors+='L'; if (XDS_Data[XDS_Level][3]&0x10) //Sexual content ContentDescriptors+='S'; if (XDS_Data[XDS_Level][3]&0x20) //Violence { if ((XDS_Data[XDS_Level][3]&0x7)==2) //"TV-Y7" --> Fantasy Violence ContentDescriptors+="FV"; else ContentDescriptors+='V'; } break; case 3: if (XDS_Data[XDS_Level][3]&0x8) //a3 { ContentAdvisory="(Reserved)"; } else { if (XDS_Data[XDS_Level][2]&0x20) //a2 switch (XDS_Data[XDS_Level][3]&0x7) //g2g1g0 { case 0 : ContentAdvisory="E"; break; case 1 : ContentAdvisory="G"; break; case 2 : ContentAdvisory="8+"; break; case 3 : ContentAdvisory="13+"; break; case 4 : ContentAdvisory="16+"; break; case 5 : ContentAdvisory="18+"; break; default: ; } else switch (XDS_Data[XDS_Level][3]&0x7) //g2g1g0 { case 0 : ContentAdvisory="E"; break; case 1 : ContentAdvisory="C"; break; case 2 : ContentAdvisory="C8+"; break; case 3 : ContentAdvisory="G"; break; case 4 : ContentAdvisory="PG"; break; case 5 : ContentAdvisory="14+"; break; case 6 : ContentAdvisory="18+"; break; default: ; } } break; } if (ContentAdvisory) { string ContentAdvisory_String=ContentAdvisory; if (!ContentDescriptors.empty()) ContentAdvisory_String+=" ("+ContentDescriptors+')'; Fill(Stream_General, 0, General_LawRating, ContentAdvisory_String.c_str()); } } //--------------------------------------------------------------------------- void File_Eia608::XDS_Current_ProgramName() { string ValueS; for (size_t Pos=2; Pos=Streams.size() || Streams[StreamPos]==NULL || !Streams[StreamPos]->Synched) return; //Not synched if (Streams[StreamPos]->x && cc_data_2>=0x20 && cc_data_2<0x40) Streams[StreamPos]->x--; //Erasing previous character switch (cc_data_2) { //CEA-608-E, Section 6.4.2 case 0x20 : Character_Fill(L'A' ); break; //A with tilde case 0x21 : Character_Fill(L'a' ); break; //a with tilde case 0x22 : Character_Fill(L'I' ); break; //I with acute accent case 0x23 : Character_Fill(L'I' ); break; //I with grave accent case 0x24 : Character_Fill(L'i' ); break; //i with grave accent case 0x25 : Character_Fill(L'O' ); break; //O with grave accent case 0x26 : Character_Fill(L'o' ); break; //o with grave accent case 0x27 : Character_Fill(L'O' ); break; //O with tilde case 0x28 : Character_Fill(L'o' ); break; //o with tilde case 0x29 : Character_Fill(L'{' ); break; //opening brace case 0x2A : Character_Fill(L'}' ); break; //closing brace case 0x2B : Character_Fill(L'\\' ); break; //backslash case 0x2C : Character_Fill(L'^' ); break; //caret case 0x2D : Character_Fill(L'_' ); break; //Underbar case 0x2E : Character_Fill(L'|' ); break; //pipe case 0x2F : Character_Fill(L'~' ); break; //tilde case 0x30 : Character_Fill(L'A' ); break; //A with diaeresis or umlaut mark case 0x31 : Character_Fill(L'a' ); break; //a with diaeresis or umlaut mark case 0x32 : Character_Fill(L'O' ); break; //o with diaeresis or umlaut mark case 0x33 : Character_Fill(L'o' ); break; //o with diaeresis or umlaut mark case 0x34 : Character_Fill(L's' ); break; //eszett (mall sharp s) case 0x35 : Character_Fill(L'Y' ); break; //yen case 0x36 : Character_Fill(L' ' ); break; //non-specific currency sign case 0x37 : Character_Fill(L'|' ); break; //Vertical bar case 0x38 : Character_Fill(L'A' ); break; //I with diaeresis or umlaut mark case 0x39 : Character_Fill(L'a' ); break; //i with diaeresis or umlaut mark case 0x3A : Character_Fill(L'O' ); break; //O with ring case 0x3B : Character_Fill(L'o' ); break; //a with ring case 0x3C : Character_Fill(L' ' ); break; //upper left corner case 0x3D : Character_Fill(L' ' ); break; //upper right corner case 0x3E : Character_Fill(L' ' ); break; //lower left corner case 0x3F : Character_Fill(L' ' ); break; //lower right corner default : Illegal(0x13, cc_data_2); } } //--------------------------------------------------------------------------- void File_Eia608::Special_14(int8u cc_data_2) { size_t StreamPos=TextMode*2+DataChannelMode; switch (cc_data_2) { case 0x20 : //RCL - Resume Caption Loading case 0x25 : //RU2 - Roll-Up Captions2 Rows case 0x26 : //RU3 - Roll-Up Captions3 Rows case 0x27 : //RU4 - Roll-Up Captions4 Rows case 0x29 : //RDC - Resume Direct Captioning case 0x2A : //TR - Text Restart case 0x2B : //RTD - Resume Text Display TextMode=cc_data_2>=0x2A; XDS_Level=(size_t)-1; // No more XDS StreamPos=TextMode*2+DataChannelMode; //Alloc if (StreamPos>=Streams.size()) Streams.resize(StreamPos+1); if (Streams[StreamPos]==NULL) { Streams[StreamPos]=new stream(); Streams[StreamPos]->CC_Displayed.resize(Eia608_Rows); for (size_t Pos=0; PosCC_Displayed.size(); Pos++) Streams[StreamPos]->CC_Displayed[Pos].resize(Eia608_Columns); if (StreamPos<2) //CC only, not in Text { Streams[StreamPos]->CC_NonDisplayed.resize(Eia608_Rows); for (size_t Pos=0; PosCC_NonDisplayed.size(); Pos++) Streams[StreamPos]->CC_NonDisplayed[Pos].resize(Eia608_Columns); } } Streams[StreamPos]->Synched=true; break; case 0x2F : //EOC - end of Caption TextMode=false; StreamPos=TextMode*2+DataChannelMode; default: ; } if (StreamPos>=Streams.size() || Streams[StreamPos]==NULL || !Streams[StreamPos]->Synched) return; //Not synched switch (cc_data_2) { case 0x20 : TextMode=false; Streams[StreamPos]->InBack=true; break; //RCL - Resume Caption Loading (Select pop-on style) case 0x21 : if (Streams[StreamPos]->x) Streams[StreamPos]->x--; (Streams[StreamPos]->InBack?Streams[StreamPos]->CC_NonDisplayed:Streams[StreamPos]->CC_Displayed)[Streams[StreamPos]->y][Streams[StreamPos]->x].Value=L' '; //Clear the character if (!Streams[StreamPos]->InBack) HasChanged(); break; //BS - Backspace case 0x22 : Special_14(0x2D); //Found 1 file with AOF and non CR break; //AOF - Alarm Off case 0x23 : break; //AON - Alarm On case 0x24 : for (size_t Pos=Streams[StreamPos]->x; PosInBack?Streams[StreamPos]->CC_NonDisplayed:Streams[StreamPos]->CC_Displayed)[Streams[StreamPos]->y][Pos].Value=L' '; //Clear up to the end of line if (!Streams[StreamPos]->InBack) HasChanged(); break; //DER - Delete to End of Row case 0x25 : //RU2 - Roll-Up Captions2 Rows case 0x26 : //RU3 - Roll-Up Captions3 Rows case 0x27 : //RU4 - Roll-Up Captions4 Rows Streams[StreamPos]->RollUpLines=cc_data_2-0x25+2; Streams[StreamPos]->InBack=false; break; //RUx - Roll-Up Captionsx Rows case 0x28 : break; //FON - Flash On case 0x29 : Streams[StreamPos]->InBack=false; break; //RDC - Resume Direct Captioning (paint-on style) case 0x2A : TextMode=true; Streams[StreamPos]->RollUpLines=Eia608_Rows; //Roll up all the lines Streams[StreamPos]->y=Eia608_Rows-1; //Base is the bottom line Streams[StreamPos]->Attribute_Current=0; //Reset all attributes Special_14(0x2D); //Next line break; //TR - Text Restart (clear Text, but not boxes) case 0x2B : TextMode=true; break; //RTD - Resume Text Display case 0x2C : if (StreamPosCC_Displayed[Pos_Y][Pos_X].Value!=L' ') { Streams[StreamPos]->CC_Displayed[Pos_Y][Pos_X].Value=L' '; Streams[StreamPos]->CC_Displayed[Pos_Y][Pos_X].Attribute=0; HasChanged_=true; } if (HasChanged_) HasChanged(); } break; //EDM - Erase Displayed Memory case 0x2D : for (size_t Pos=1; PosRollUpLines; Pos++) { if (Streams[StreamPos]->y>=Streams[StreamPos]->RollUpLines-Pos && Streams[StreamPos]->y-Streams[StreamPos]->RollUpLines+Pos+1CC_Displayed[Streams[StreamPos]->y-Streams[StreamPos]->RollUpLines+Pos]=Streams[StreamPos]->CC_Displayed[Streams[StreamPos]->y-Streams[StreamPos]->RollUpLines+Pos+1]; } for (size_t Pos_X=0; Pos_XCC_Displayed[Streams[StreamPos]->y][Pos_X].Value=L' '; Streams[StreamPos]->CC_Displayed[Streams[StreamPos]->y][Pos_X].Attribute=0; } if (!Streams[StreamPos]->InBack) HasChanged(); Streams[StreamPos]->x=0; break; //CR - Carriage Return case 0x2E : for (size_t Pos_Y=0; Pos_YCC_NonDisplayed.size(); Pos_Y++) for (size_t Pos_X=0; Pos_XCC_NonDisplayed[Pos_Y].size(); Pos_X++) { Streams[StreamPos]->CC_NonDisplayed[Pos_Y][Pos_X].Value=L' '; Streams[StreamPos]->CC_NonDisplayed[Pos_Y][Pos_X].Attribute=0; } break; //ENM - Erase Non-Displayed Memory case 0x2F : Streams[StreamPos]->CC_Displayed.swap(Streams[StreamPos]->CC_NonDisplayed); HasChanged(); Streams[StreamPos]->Synched=false; break; //EOC - End of Caption default : Illegal(0x14, cc_data_2); } } //--------------------------------------------------------------------------- void File_Eia608::Special_17(int8u cc_data_2) { size_t StreamPos=TextMode*2+DataChannelMode; if (StreamPos>=Streams.size() || Streams[StreamPos]==NULL || !Streams[StreamPos]->Synched) return; //Not synched switch (cc_data_2) { //CEA-608-E, section B.4 case 0x21 : //TO1 - Tab Offset 1 Column case 0x22 : //TO2 - Tab Offset 2 Columns case 0x23 : //TO3 - Tab Offset 3 Columns Streams[StreamPos]->x+=cc_data_2&0x03; if (Streams[StreamPos]->x>=Eia608_Columns) Streams[StreamPos]->x=Eia608_Columns-1; break; //CEA-608-E, section 6.3 case 0x24 : break; //Select the standard line 21 character set in normal size case 0x25 : break; //Select the standard line 21 character set in double size case 0x26 : break; //Select the first private character set case 0x27 : break; //Select the second private character set case 0x28 : break; //Select the People's Republic of China character set: GB 2312-80 case 0x29 : break; //Select the Korean Standard character set: KSC 5601-1987 case 0x2A : break; //Select the first registered character set //CEA-608-E, section 6.2 case 0x2D : break; //Background Transparent case 0x2E : break; //Foreground Black case 0x2F : break; //Foreground Black Underline default : Illegal(0x17, cc_data_2); } } //--------------------------------------------------------------------------- void File_Eia608::Standard(int8u Character) { switch (Character) { //CEA-608-E, Section F.1.1.2 case 0x20 : Character_Fill(L' ' ); break; case 0x21 : Character_Fill(L'!' ); break; case 0x22 : Character_Fill(L'"' ); break; case 0x23 : Character_Fill(L'#' ); break; case 0x24 : Character_Fill(L'$' ); break; case 0x25 : Character_Fill(L'%' ); break; case 0x26 : Character_Fill(L'&' ); break; case 0x27 : Character_Fill(L'\'' ); break; case 0x28 : Character_Fill(L'(' ); break; case 0x29 : Character_Fill(L')' ); break; case 0x2A : Character_Fill(L'\xE1' ); break; //a acute case 0x2B : Character_Fill(L'+' ); break; case 0x2C : Character_Fill(L',' ); break; case 0x2D : Character_Fill(L'-' ); break; case 0x2E : Character_Fill(L'.' ); break; case 0x2F : Character_Fill(L'/' ); break; case 0x30 : Character_Fill(L'0' ); break; case 0x31 : Character_Fill(L'1' ); break; case 0x32 : Character_Fill(L'2' ); break; case 0x33 : Character_Fill(L'3' ); break; case 0x34 : Character_Fill(L'4' ); break; case 0x35 : Character_Fill(L'5' ); break; case 0x36 : Character_Fill(L'6' ); break; case 0x37 : Character_Fill(L'7' ); break; case 0x38 : Character_Fill(L'8' ); break; case 0x39 : Character_Fill(L'9' ); break; case 0x3A : Character_Fill(L':' ); break; case 0x3B : Character_Fill(L';' ); break; case 0x3C : Character_Fill(L'<' ); break; case 0x3E : Character_Fill(L'>' ); break; case 0x3F : Character_Fill(L'?' ); break; case 0x40 : Character_Fill(L'@' ); break; case 0x41 : Character_Fill(L'A' ); break; case 0x42 : Character_Fill(L'B' ); break; case 0x43 : Character_Fill(L'C' ); break; case 0x44 : Character_Fill(L'D' ); break; case 0x45 : Character_Fill(L'E' ); break; case 0x46 : Character_Fill(L'F' ); break; case 0x47 : Character_Fill(L'G' ); break; case 0x48 : Character_Fill(L'H' ); break; case 0x49 : Character_Fill(L'I' ); break; case 0x4A : Character_Fill(L'J' ); break; case 0x4B : Character_Fill(L'K' ); break; case 0x4C : Character_Fill(L'L' ); break; case 0x4D : Character_Fill(L'M' ); break; case 0x4E : Character_Fill(L'N' ); break; case 0x4F : Character_Fill(L'O' ); break; case 0x50 : Character_Fill(L'P' ); break; case 0x51 : Character_Fill(L'Q' ); break; case 0x52 : Character_Fill(L'R' ); break; case 0x53 : Character_Fill(L'S' ); break; case 0x54 : Character_Fill(L'T' ); break; case 0x55 : Character_Fill(L'U' ); break; case 0x56 : Character_Fill(L'V' ); break; case 0x57 : Character_Fill(L'W' ); break; case 0x58 : Character_Fill(L'X' ); break; case 0x59 : Character_Fill(L'Y' ); break; case 0x5A : Character_Fill(L'Z' ); break; case 0x5B : Character_Fill(L'[' ); break; case 0x5C : Character_Fill(L'\xE9' ); break; //e acute case 0x5D : Character_Fill(L']' ); break; case 0x5E : Character_Fill(L'\xED' ); break; //i acute case 0x5F : Character_Fill(L'\xF3' ); break; //o acute case 0x60 : Character_Fill(L'\xFA' ); break; //u acute case 0x61 : Character_Fill(L'a' ); break; case 0x62 : Character_Fill(L'b' ); break; case 0x63 : Character_Fill(L'c' ); break; case 0x64 : Character_Fill(L'd' ); break; case 0x65 : Character_Fill(L'e' ); break; case 0x66 : Character_Fill(L'f' ); break; case 0x67 : Character_Fill(L'g' ); break; case 0x68 : Character_Fill(L'h' ); break; case 0x69 : Character_Fill(L'i' ); break; case 0x6A : Character_Fill(L'j' ); break; case 0x6B : Character_Fill(L'k' ); break; case 0x6C : Character_Fill(L'l' ); break; case 0x6D : Character_Fill(L'm' ); break; case 0x6E : Character_Fill(L'n' ); break; case 0x6F : Character_Fill(L'o' ); break; case 0x70 : Character_Fill(L'p' ); break; case 0x71 : Character_Fill(L'q' ); break; case 0x72 : Character_Fill(L'r' ); break; case 0x73 : Character_Fill(L's' ); break; case 0x74 : Character_Fill(L't' ); break; case 0x75 : Character_Fill(L'u' ); break; case 0x76 : Character_Fill(L'v' ); break; case 0x77 : Character_Fill(L'w' ); break; case 0x78 : Character_Fill(L'x' ); break; case 0x79 : Character_Fill(L'y' ); break; case 0x7A : Character_Fill(L'z' ); break; case 0x7B : Character_Fill(L'\xE7' ); break; //c with cedilla case 0x7C : Character_Fill(L'\xF7' ); break; //division symbol case 0x7D : Character_Fill(L'\xD1' ); break; //N tilde case 0x7E : Character_Fill(L'\xF1' ); break; //n tilde case 0x7F : Character_Fill(L'\x25A0'); break; //Solid block default : Illegal(0x00, Character); } } //--------------------------------------------------------------------------- void File_Eia608::Character_Fill(wchar_t Character) { size_t StreamPos=TextMode*2+DataChannelMode; if (StreamPos>=Streams.size() || Streams[StreamPos]==NULL || !Streams[StreamPos]->Synched) return; //Not synched if (Streams[StreamPos]->x==Eia608_Columns) { Streams[StreamPos]->x--; //There is a problem //TODO: Put it at the end, for the conversion //TODO: Handle special chars } if (Streams[StreamPos]->InBack) Streams[StreamPos]->CC_NonDisplayed[Streams[StreamPos]->y][Streams[StreamPos]->x].Value=Character; else Streams[StreamPos]->CC_Displayed[Streams[StreamPos]->y][Streams[StreamPos]->x].Value=Character; Streams[StreamPos]->x++; if (TextMode || !Streams[StreamPos]->InBack) HasChanged(); if (!HasContent) HasContent=true; } //--------------------------------------------------------------------------- void File_Eia608::HasChanged() { } //--------------------------------------------------------------------------- void File_Eia608::Illegal(int8u cc_data_1, int8u cc_data_2) { } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_EIA608_YES MediaInfoLib/Source/MediaInfo/Text/File_Eia608.h100777 0 0 7767 12226004262 14557 0/* 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 PGS files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_Eia608H #define MediaInfo_File_Eia608H //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include #include //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Eia608 //*************************************************************************** static const int8u Eia608_Rows=15; //Screen size, specified by the standard static const int8u Eia608_Columns=32; //Screen size, specified by the standard class File_Eia608 : public File__Analyze { public : //In int8u cc_type; //Constructor/Destructor File_Eia608(); ~File_Eia608(); private : //Streams management void Streams_Fill(); void Streams_Finish(); //Synchro void Read_Buffer_Unsynched(); //Buffer - Global void Read_Buffer_Init(); void Read_Buffer_Continue(); void Read_Buffer_AfterParsing(); //Function void Standard (int8u Character); std::vector > XDS_Data; size_t XDS_Level; bool TextMode; //CC or T bool DataChannelMode; //if true, CC2/CC4/T2/T4 void XDS(int8u cc_data_1, int8u cc_data_2); void XDS(); void XDS_Current(); void XDS_Current_ProgramName(); void XDS_Current_ContentAdvisory(); void XDS_Current_CopyAndRedistributionControlPacket(); void XDS_PublicService(); void XDS_PublicService_NationalWeatherService(); void XDS_Channel(); void XDS_Channel_NetworkName(); void Special(int8u cc_data_1, int8u cc_data_2); void Special_10(int8u cc_data_2); void Special_11(int8u cc_data_2); void Special_12(int8u cc_data_2); void Special_13(int8u cc_data_2); void Special_14(int8u cc_data_2); void Special_17(int8u cc_data_2); void PreambleAddressCode(int8u cc_data_1, int8u cc_data_2); //An attribute consists of Attribute_Color_*, optionally OR'd with Attribute_Underline and/or Attribute_Italic enum attributes { Attribute_Color_White =0x00, Attribute_Color_Green =0x01, Attribute_Color_Blue =0x02, Attribute_Color_Cyan =0x03, Attribute_Color_Red =0x04, Attribute_Color_Yellow =0x05, Attribute_Color_Magenta =0x06, Attribute_Underline =0x10, Attribute_Italic =0x20, }; struct character { wchar_t Value; int8u Attribute; character() { Value=L' '; } }; void Character_Fill(wchar_t Character); void HasChanged(); void Illegal(int8u cc_data_1, int8u cc_data_2); struct stream { vector > CC_Displayed; vector > CC_NonDisplayed; bool InBack; //The back buffer is written size_t x; size_t y; int8u Attribute_Current; size_t RollUpLines; bool Synched; stream() { InBack=false; x=0; y=Eia608_Rows-1; Attribute_Current=0; RollUpLines=0; Synched=false; } }; std::vector Streams; int8u cc_data_1_Old; int8u cc_data_2_Old; bool HasContent; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Text/File_Eia708.cpp100777 0 0 155433 12226004262 15145 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_EIA708_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Text/File_Eia708.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Eia708::File_Eia708() :File__Analyze() { //Config PTS_DTS_Needed=true; MustSynchronize=true; //In cc_type=(int8u)-1; AspectRatio=((float32)4)/3; //Default to 4:3 ParserName=__T("EIA-708"); //Stream service_number=(int8u)-1; //Temp StandAloneCommand=false; HasContent=false; } //--------------------------------------------------------------------------- File_Eia708::~File_Eia708() { for (size_t Pos=0; PosFile_Eia708_DisplayEmptyStream_Get() && Streams.size()<2) Streams.resize(2); for (size_t Pos=0; PosFile_Eia708_DisplayEmptyStream_Get())) { Stream_Prepare(Stream_Text); Fill(Stream_Text, StreamPos_Last, Text_ID, Pos); Fill(Stream_Text, StreamPos_Last, "CaptionServiceName", Pos); (*Stream_More)[StreamKind_Last][StreamPos_Last](Ztring().From_Local("CaptionServiceName"), Info_Options)=__T("N NT"); Fill(Stream_Text, StreamPos_Last, Text_Format, "EIA-708"); Fill(Stream_Text, StreamPos_Last, Text_StreamSize, 0); Fill(Stream_Text, StreamPos_Last, Text_BitRate_Mode, "CBR"); } } //--------------------------------------------------------------------------- void File_Eia708::Streams_Finish() { } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Eia708::Synchronize() { if (cc_type!=3) return false; //Waiting for sync from underlying layer if (!Status[IsAccepted]) Accept("EIA-708"); //Synched is OK return true; } //--------------------------------------------------------------------------- bool File_Eia708::Synched_Test() { if (cc_type==4) //Magic value saying that the buffer must be kept (this is only a point of synchro from the undelying layer) Buffer_Offset=Buffer_Size; //Sync point //We continue return true; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Eia708::Read_Buffer_Init() { } //--------------------------------------------------------------------------- void File_Eia708::Read_Buffer_Continue() { FrameInfo.PTS=FrameInfo.DTS; } //--------------------------------------------------------------------------- void File_Eia708::Read_Buffer_Unsynched() { for (int8u service_number=1; service_numberWindows.size(); WindowID++) { window* Window=Streams[service_number]->Windows[WindowID]; if (Window) for (size_t Pos_Y=0; Pos_YMinimal.CC.size(); Pos_Y++) { for (size_t Pos_X=0; Pos_XMinimal.CC[Pos_Y].size(); Pos_X++) { Window->Minimal.CC[Pos_Y][Pos_X].Value=L' '; Window->Minimal.CC[Pos_Y][Pos_X].Attribute=0; } } } //Global display for (size_t Pos_Y=0; Pos_YMinimal.CC.size(); Pos_Y++) { for (size_t Pos_X=0; Pos_XMinimal.CC[Pos_Y].size(); Pos_X++) { Streams[service_number]->Minimal.CC[Pos_Y][Pos_X].Value=L' '; Streams[service_number]->Minimal.CC[Pos_Y][Pos_X].Attribute=0; } } } } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Eia708::Header_Parse() { //Parsing int8u packet_size, sequence_number; BS_Begin(); Get_S1(2, sequence_number, "sequence_number"); Get_S1(6, packet_size, "packet_size_code"); BS_End(); Header_Fill_Code(0, __T("DTVCC packet")); Header_Fill_Size(packet_size==0?128:(packet_size*2)); } //--------------------------------------------------------------------------- void File_Eia708::Data_Parse() { //Parsing while (Element_Offset=Streams.size()) Streams.resize(service_number+1); if (Streams[service_number]==NULL) { Streams[service_number]=new stream; Streams[service_number]->Minimal.CC.resize(15); for (int8u Pos_Y=0; Pos_Y<15; Pos_Y++) Streams[service_number]->Minimal.CC[Pos_Y].resize((size_t)(24*AspectRatio)); Streams[service_number]->Windows.resize(8); } for (int8u Pos=0; Pos=0x08 && cc_data_2<0x10) { Skip_B1( "EXT1 1 byte"); Pos++; } else if (cc_data_2>=0x10 && cc_data_2<0x18) { Skip_B2( "EXT1 2 byte"); Pos+=2; } else if (cc_data_2>=0x18 && cc_data_2<0x20) { Skip_B3( "EXT1 3 byte"); Pos+=3; } //CEA-708-D, Section 7.1.11 (C3) else if (cc_data_2>=0x80 && cc_data_2<0x88) { Skip_B4( "EXT1 4 byte"); Pos+=4; } else if (cc_data_2>=0x88 && cc_data_2<0x90) { Skip_B5( "EXT1 5 byte"); Pos+=5; } else if (cc_data_2>=0x90 && cc_data_2<0xA0) { //CEA-708-D, Section 7.1.11.2 (Variable Length Codes) int8u Length; BS_Begin(); Skip_S1(2, "Type"); Mark_0(); Get_S1 (5, Length, "Length"); Skip_XX(Length, "Data"); Pos+=1+Length; } //CEA-708-D, Section 7.1.9 (G3) else Character_Fill(L'_' ); } } break; case 0x11 : case 0x12 : case 0x13 : case 0x14 : case 0x15 : case 0x16 : case 0x17 : //2-byte long undefined { Skip_B1( "Undefined"); Pos++; } break; case 0x18 : //P16 { Skip_B2( "P16"); Pos+=2; } break; case 0x19 : case 0x1A : case 0x1B : case 0x1C : case 0x1D : case 0x1E : case 0x1F : //3-byte long undefined { Skip_B2( "Undefined"); Pos+=2; } break; //CEA-708-D, Section 7.1.6 (G0) case 0x20 : Character_Fill(L' ' ); break; case 0x21 : Character_Fill(L'!' ); break; case 0x22 : Character_Fill(L'"' ); break; case 0x23 : Character_Fill(L'#' ); break; case 0x24 : Character_Fill(L'$' ); break; case 0x25 : Character_Fill(L'%' ); break; case 0x26 : Character_Fill(L'&' ); break; case 0x27 : Character_Fill(L'\'' ); break; case 0x28 : Character_Fill(L'(' ); break; case 0x29 : Character_Fill(L')' ); break; case 0x2A : Character_Fill(L'*' ); break; case 0x2B : Character_Fill(L'+' ); break; case 0x2C : Character_Fill(L',' ); break; case 0x2D : Character_Fill(L'-' ); break; case 0x2E : Character_Fill(L'.' ); break; case 0x2F : Character_Fill(L'/' ); break; case 0x30 : Character_Fill(L'0' ); break; case 0x31 : Character_Fill(L'1' ); break; case 0x32 : Character_Fill(L'2' ); break; case 0x33 : Character_Fill(L'3' ); break; case 0x34 : Character_Fill(L'4' ); break; case 0x35 : Character_Fill(L'5' ); break; case 0x36 : Character_Fill(L'6' ); break; case 0x37 : Character_Fill(L'7' ); break; case 0x38 : Character_Fill(L'8' ); break; case 0x39 : Character_Fill(L'9' ); break; case 0x3A : Character_Fill(L':' ); break; case 0x3B : Character_Fill(L';' ); break; case 0x3C : Character_Fill(L'<' ); break; case 0x3E : Character_Fill(L'>' ); break; case 0x3F : Character_Fill(L'?' ); break; case 0x40 : Character_Fill(L'@' ); break; case 0x41 : Character_Fill(L'A' ); break; case 0x42 : Character_Fill(L'B' ); break; case 0x43 : Character_Fill(L'C' ); break; case 0x44 : Character_Fill(L'D' ); break; case 0x45 : Character_Fill(L'E' ); break; case 0x46 : Character_Fill(L'F' ); break; case 0x47 : Character_Fill(L'G' ); break; case 0x48 : Character_Fill(L'H' ); break; case 0x49 : Character_Fill(L'I' ); break; case 0x4A : Character_Fill(L'J' ); break; case 0x4B : Character_Fill(L'K' ); break; case 0x4C : Character_Fill(L'L' ); break; case 0x4D : Character_Fill(L'M' ); break; case 0x4E : Character_Fill(L'N' ); break; case 0x4F : Character_Fill(L'O' ); break; case 0x50 : Character_Fill(L'P' ); break; case 0x51 : Character_Fill(L'Q' ); break; case 0x52 : Character_Fill(L'R' ); break; case 0x53 : Character_Fill(L'S' ); break; case 0x54 : Character_Fill(L'T' ); break; case 0x55 : Character_Fill(L'U' ); break; case 0x56 : Character_Fill(L'V' ); break; case 0x57 : Character_Fill(L'W' ); break; case 0x58 : Character_Fill(L'X' ); break; case 0x59 : Character_Fill(L'Y' ); break; case 0x5A : Character_Fill(L'Z' ); break; case 0x5B : Character_Fill(L'[' ); break; case 0x5C : Character_Fill(L'\\' ); break; case 0x5D : Character_Fill(L']' ); break; case 0x5E : Character_Fill(L'^' ); break; case 0x5F : Character_Fill(L'_' ); break; case 0x60 : Character_Fill(L'`' ); break; case 0x61 : Character_Fill(L'a' ); break; case 0x62 : Character_Fill(L'b' ); break; case 0x63 : Character_Fill(L'c' ); break; case 0x64 : Character_Fill(L'd' ); break; case 0x65 : Character_Fill(L'e' ); break; case 0x66 : Character_Fill(L'f' ); break; case 0x67 : Character_Fill(L'g' ); break; case 0x68 : Character_Fill(L'h' ); break; case 0x69 : Character_Fill(L'i' ); break; case 0x6A : Character_Fill(L'j' ); break; case 0x6B : Character_Fill(L'k' ); break; case 0x6C : Character_Fill(L'l' ); break; case 0x6D : Character_Fill(L'm' ); break; case 0x6E : Character_Fill(L'n' ); break; case 0x6F : Character_Fill(L'o' ); break; case 0x70 : Character_Fill(L'p' ); break; case 0x71 : Character_Fill(L'q' ); break; case 0x72 : Character_Fill(L'r' ); break; case 0x73 : Character_Fill(L's' ); break; case 0x74 : Character_Fill(L't' ); break; case 0x75 : Character_Fill(L'u' ); break; case 0x76 : Character_Fill(L'v' ); break; case 0x77 : Character_Fill(L'w' ); break; case 0x78 : Character_Fill(L'x' ); break; case 0x79 : Character_Fill(L'y' ); break; case 0x7A : Character_Fill(L'z' ); break; case 0x7B : Character_Fill(L'{' ); break; case 0x7C : Character_Fill(L'|' ); break; case 0x7D : Character_Fill(L'}' ); break; case 0x7E : Character_Fill(L'~' ); break; case 0x7F : Character_Fill(L'\x266A'); break; //CEA-708-D, Section 7.1.5 (C1) case 0x80 : //CW0 case 0x81 : //CW1 case 0x82 : //CW2 case 0x83 : //CW3 case 0x84 : //CW4 case 0x85 : //CW5 case 0x86 : //CW6 case 0x87 : //CW7 CWx(cc_data_1-0x80); break; //SetCurrentWindow case 0x88 : CLW(); Pos+=1; break; //ClearWindows case 0x89 : DSW(); Pos+=1; break; //DisplayWindows case 0x8A : HDW(); Pos+=1; break; //HideWindows case 0x8B : TGW(); Pos+=1; break; //ToggleWindows case 0x8C : DLW(); Pos+=1; break; //DeleteWindows case 0x8D : DLY(); Pos+=1; break; //Delay case 0x8E : DLC(); break; //Delay Cancel case 0x8F : RST(); break; //Reset case 0x90 : SPA(); Pos+=2; break; //SetPenAttributes case 0x91 : SPC(); Pos+=3; break; //SetPenColor case 0x92 : SPL(); Pos+=2; break; //SetPenLocation case 0x97 : SWA(); Pos+=5; break; //SetWindowAttributes case 0x98 : //DF0 case 0x99 : //DF1 case 0x9A : //DF2 case 0x9B : //DF3 case 0x9C : //DF4 case 0x9D : //DF5 case 0x9E : //DF6 case 0x9F : //DF7 DFx(cc_data_1-0x98); Pos+=6; break; //DefineWindow //CEA-708-D, Section 7.1.6 (G1) case 0xA0 : Character_Fill(L'\xA0' ); break; case 0xA1 : Character_Fill(L'\xA1' ); break; case 0xA2 : Character_Fill(L'\xA2' ); break; case 0xA3 : Character_Fill(L'\xA3' ); break; case 0xA4 : Character_Fill(L'\xA4' ); break; case 0xA5 : Character_Fill(L'\xA5' ); break; case 0xA6 : Character_Fill(L'\xA6' ); break; case 0xA7 : Character_Fill(L'\xA7' ); break; case 0xA8 : Character_Fill(L'\xA8' ); break; case 0xA9 : Character_Fill(L'\xA9' ); break; case 0xAA : Character_Fill(L'\xAA' ); break; case 0xAB : Character_Fill(L'\xAB' ); break; case 0xAC : Character_Fill(L'\xAC' ); break; case 0xAD : Character_Fill(L'\xAD' ); break; case 0xAE : Character_Fill(L'\xAE' ); break; case 0xAF : Character_Fill(L'\xAF' ); break; case 0xB0 : Character_Fill(L'\xB0' ); break; case 0xB1 : Character_Fill(L'\xB1' ); break; case 0xB2 : Character_Fill(L'\xB2' ); break; case 0xB3 : Character_Fill(L'\xB3' ); break; case 0xB4 : Character_Fill(L'\xB4' ); break; case 0xB5 : Character_Fill(L'\xB5' ); break; case 0xB6 : Character_Fill(L'\xB6' ); break; case 0xB7 : Character_Fill(L'\xB7' ); break; case 0xB8 : Character_Fill(L'\xB8' ); break; case 0xB9 : Character_Fill(L'\xB9' ); break; case 0xBA : Character_Fill(L'\xBA' ); break; case 0xBB : Character_Fill(L'\xBB' ); break; case 0xBC : Character_Fill(L'\xBC' ); break; case 0xBD : Character_Fill(L'\xBD' ); break; case 0xBE : Character_Fill(L'\xBE' ); break; case 0xBF : Character_Fill(L'\xBF' ); break; case 0xC0 : Character_Fill(L'\xC0' ); break; case 0xC1 : Character_Fill(L'\xC1' ); break; case 0xC2 : Character_Fill(L'\xC2' ); break; case 0xC3 : Character_Fill(L'\xC3' ); break; case 0xC4 : Character_Fill(L'\xC4' ); break; case 0xC5 : Character_Fill(L'\xC5' ); break; case 0xC6 : Character_Fill(L'\xC6' ); break; case 0xC7 : Character_Fill(L'\xC7' ); break; case 0xC8 : Character_Fill(L'\xC8' ); break; case 0xC9 : Character_Fill(L'\xC9' ); break; case 0xCA : Character_Fill(L'\xCA' ); break; case 0xCB : Character_Fill(L'\xCB' ); break; case 0xCC : Character_Fill(L'\xCC' ); break; case 0xCD : Character_Fill(L'\xCD' ); break; case 0xCE : Character_Fill(L'\xCE' ); break; case 0xCF : Character_Fill(L'\xCF' ); break; case 0xD0 : Character_Fill(L'\xD0' ); break; case 0xD1 : Character_Fill(L'\xD1' ); break; case 0xD2 : Character_Fill(L'\xD2' ); break; case 0xD3 : Character_Fill(L'\xD3' ); break; case 0xD4 : Character_Fill(L'\xD4' ); break; case 0xD5 : Character_Fill(L'\xD5' ); break; case 0xD6 : Character_Fill(L'\xD6' ); break; case 0xD7 : Character_Fill(L'\xD7' ); break; case 0xD8 : Character_Fill(L'\xD8' ); break; case 0xD9 : Character_Fill(L'\xD9' ); break; case 0xDA : Character_Fill(L'\xDA' ); break; case 0xDB : Character_Fill(L'\xDB' ); break; case 0xDC : Character_Fill(L'\xDC' ); break; case 0xDD : Character_Fill(L'\xDD' ); break; case 0xDE : Character_Fill(L'\xDE' ); break; case 0xDF : Character_Fill(L'\xDF' ); break; case 0xE0 : Character_Fill(L'\xE0' ); break; case 0xE1 : Character_Fill(L'\xE1' ); break; case 0xE2 : Character_Fill(L'\xE2' ); break; case 0xE3 : Character_Fill(L'\xE3' ); break; case 0xE4 : Character_Fill(L'\xE4' ); break; case 0xE5 : Character_Fill(L'\xE5' ); break; case 0xE6 : Character_Fill(L'\xE6' ); break; case 0xE7 : Character_Fill(L'\xE7' ); break; case 0xE8 : Character_Fill(L'\xE8' ); break; case 0xE9 : Character_Fill(L'\xE9' ); break; case 0xEA : Character_Fill(L'\xEA' ); break; case 0xEB : Character_Fill(L'\xEB' ); break; case 0xEC : Character_Fill(L'\xEC' ); break; case 0xED : Character_Fill(L'\xED' ); break; case 0xEE : Character_Fill(L'\xEE' ); break; case 0xEF : Character_Fill(L'\xEF' ); break; case 0xF0 : Character_Fill(L'\xF0' ); break; case 0xF1 : Character_Fill(L'\xF1' ); break; case 0xF2 : Character_Fill(L'\xF2' ); break; case 0xF3 : Character_Fill(L'\xF3' ); break; case 0xF4 : Character_Fill(L'\xF4' ); break; case 0xF5 : Character_Fill(L'\xF5' ); break; case 0xF6 : Character_Fill(L'\xF6' ); break; case 0xF7 : Character_Fill(L'\xF7' ); break; case 0xF8 : Character_Fill(L'\xF8' ); break; case 0xF9 : Character_Fill(L'\xF9' ); break; case 0xFA : Character_Fill(L'\xFA' ); break; case 0xFB : Character_Fill(L'\xFB' ); break; case 0xFC : Character_Fill(L'\xFC' ); break; case 0xFD : Character_Fill(L'\xFD' ); break; case 0xFE : Character_Fill(L'\xFE' ); break; case 0xFF : Character_Fill(L'\xFF' ); break; default : Illegal(1, cc_data_1); } } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- //NUL void File_Eia708::NUL() { } //--------------------------------------------------------------------------- //End Of Text void File_Eia708::ETX() { } //--------------------------------------------------------------------------- //Backspace void File_Eia708::BS() { Param_Info1("Backspace"); int8u WindowID=Streams[service_number]->WindowID; if (WindowID==(int8u)-1) return; //Must wait for the corresponding CWx window* Window=Streams[service_number]->Windows[WindowID]; if (Window==NULL) return; //Must wait for the corresponding DFx if (Window->Minimal.x) { //Clearing window Window->Minimal.x--; Window->Minimal.CC[Window->Minimal.y][Window->Minimal.x]=character(); if (Window->visible) { //Clearing global area if (Window->Minimal.Window_y+Window->Minimal.y<(int8u)Streams[service_number]->Minimal.CC.size() && Window->Minimal.Window_x+Window->Minimal.x<(int8u)Streams[service_number]->Minimal.CC[Window->Minimal.Window_y+Window->Minimal.y].size()) Streams[service_number]->Minimal.CC[Window->Minimal.Window_y+Window->Minimal.y][Window->Minimal.Window_x+Window->Minimal.x]=character(); //Has changed Window_HasChanged(); HasChanged(); } } } //--------------------------------------------------------------------------- //Form Feed void File_Eia708::FF() { Param_Info1("Form Feed"); int8u WindowID=Streams[service_number]->WindowID; if (WindowID==(int8u)-1) return; //Must wait for the corresponding CWx window* Window=Streams[service_number]->Windows[WindowID]; if (Window==NULL) return; //Must wait for the corresponding DFx for (size_t Pos_Y=0; Pos_Yrow_count; Pos_Y++) for (size_t Pos_X=0; Pos_Xcolumn_count; Pos_X++) { //Clearing window Streams[service_number]->Windows[Streams[service_number]->WindowID]->Minimal.CC[Pos_Y][Pos_X]=character(); if (Window->visible) { //Clearing global area if (Window->Minimal.Window_y+Pos_YMinimal.CC.size() && Window->Minimal.Window_x+Pos_XMinimal.CC[Window->Minimal.Window_y+Pos_Y].size()) Streams[service_number]->Minimal.CC[Window->Minimal.Window_y+Pos_Y][Window->Minimal.Window_x+Pos_X]=character(); } } if (Window->visible) { //Has changed Window_HasChanged(); HasChanged(); } //SetPenLocation Window->Minimal.x=0; Window->Minimal.y=0; } //--------------------------------------------------------------------------- //Carriage return void File_Eia708::CR() { Param_Info1("Carriage return"); int8u WindowID=Streams[service_number]->WindowID; if (WindowID==(int8u)-1) return; //Must wait for the corresponding CWx window* Window=Streams[service_number]->Windows[WindowID]; if (Window==NULL) return; //Must wait for the corresponding DFx int8u y=Window->Minimal.y; y++; if (y>=Window->row_count) { //Rolling up window for (int8u Pos_Y=0; Pos_Yrow_count-1; Pos_Y++) Window->Minimal.CC[Pos_Y]=Window->Minimal.CC[Pos_Y+1]; //SetPenLocation y=Window->row_count-1; //Clearing last line of window for (int8u Pos_X=0; Pos_Xcolumn_count; Pos_X++) Window->Minimal.CC[y][Pos_X]=character(); if (Window->visible) { //Updating global area for (int8u Pos_Y=0; Pos_Yrow_count; Pos_Y++) for (int8u Pos_X=0; Pos_Xcolumn_count; Pos_X++) if (Window->Minimal.Window_y+Pos_Y<(int8u)Streams[service_number]->Minimal.CC.size() && Window->Minimal.Window_x+Pos_X<(int8u)Streams[service_number]->Minimal.CC[Window->Minimal.Window_y+Pos_Y].size()) Streams[service_number]->Minimal.CC[Window->Minimal.Window_y+Pos_Y][Window->Minimal.Window_x+Pos_X]=Window->Minimal.CC[Pos_Y][Pos_X]; //Has changed Window_HasChanged(); HasChanged(); } } //SetPenLocation Window->Minimal.x=0; Window->Minimal.y=y; } //--------------------------------------------------------------------------- //Horizontal Carriage Return void File_Eia708::HCR() { Param_Info1("Horizontal Carriage Return"); int8u WindowID=Streams[service_number]->WindowID; if (WindowID==(int8u)-1) return; //Must wait for the corresponding CWx window* Window=Streams[service_number]->Windows[WindowID]; if (Window==NULL) return; //Must wait for the corresponding DFx int8u y=Window->Minimal.y; for (int8u Pos_X=0; Pos_Xcolumn_count; Pos_X++) { //Clearing window Streams[service_number]->Windows[Streams[service_number]->WindowID]->Minimal.CC[y][Pos_X]=character(); if (Window->visible) { //Clearing global area if (Window->Minimal.Window_y+y<(int8u)Streams[service_number]->Minimal.CC.size() && Window->Minimal.Window_x+Pos_X<(int8u)Streams[service_number]->Minimal.CC[Window->Minimal.Window_y+Window->Minimal.y].size()) Streams[service_number]->Minimal.CC[Window->Minimal.Window_y+y][Window->Minimal.Window_x+Pos_X]=character(); //Has changed Window_HasChanged(); HasChanged(); } } //SetPenLocation Window->Minimal.x=0; } //--------------------------------------------------------------------------- //SetCurrentWindow void File_Eia708::CWx(int8u WindowID) { Param_Info1("SetCurrentWindow"); Param_Info1(WindowID); Streams[service_number]->WindowID=WindowID; } //--------------------------------------------------------------------------- //ClearWindows void File_Eia708::CLW() { Param_Info1("ClearWindows"); int8u Save_WindowID=Streams[service_number]->WindowID; bool Save_StandAloneCommand=StandAloneCommand; StandAloneCommand=false; Element_Begin1("ClearWindows"); BS_Begin(); int8u WindowID=8; bool HasChanged_=false; do { WindowID--; bool IsSet; Get_SB ( IsSet, Ztring(__T("window ")+Ztring::ToZtring(WindowID)).To_Local().c_str()); if (IsSet) { Streams[service_number]->WindowID=WindowID; window* Window=Streams[service_number]->Windows[WindowID]; //ClearWindow is like Form Feed FF(); if (Window && Window->visible) { //Has changed HasChanged_=true; Window_HasChanged(); } } } while (WindowID>0); BS_End(); Element_End0(); Streams[service_number]->WindowID=Save_WindowID; StandAloneCommand=Save_StandAloneCommand; if (HasChanged_) { //Has changed HasChanged(); } } //--------------------------------------------------------------------------- //DisplayWindows void File_Eia708::DSW() { Param_Info1("DisplayWindows"); int8u Save_WindowID=Streams[service_number]->WindowID; bool Save_StandAloneCommand=StandAloneCommand; StandAloneCommand=false; Element_Begin1("DisplayWindows"); BS_Begin(); int8u WindowID=8; bool HasChanged_=false; do { WindowID--; bool IsSet; Get_SB ( IsSet, Ztring(__T("window ")+Ztring::ToZtring(WindowID)).To_Local().c_str()); if (IsSet) { window* Window=Streams[service_number]->Windows[WindowID]; if (Window && !Window->visible) { Window->visible=true; //Filling global area for (size_t Pos_Y=0; Pos_Yrow_count; Pos_Y++) for (size_t Pos_X=0; Pos_Xcolumn_count; Pos_X++) { if (Window->Minimal.Window_y+Pos_YMinimal.CC.size() && Window->Minimal.Window_x+Pos_XMinimal.CC[Window->Minimal.Window_y+Pos_Y].size()) Streams[service_number]->Minimal.CC[Window->Minimal.Window_y+Pos_Y][Window->Minimal.Window_x+Pos_X]=Window->Minimal.CC[Pos_Y][Pos_X]; } //Has changed HasChanged_=true; Window_HasChanged(); } } } while (WindowID>0); BS_End(); Element_End0(); Streams[service_number]->WindowID=Save_WindowID; StandAloneCommand=Save_StandAloneCommand; if (HasChanged_) { //Has changed HasChanged(); } } //--------------------------------------------------------------------------- //HideWindows void File_Eia708::HDW() { Param_Info1("HideWindows"); int8u Save_WindowID=Streams[service_number]->WindowID; bool Save_StandAloneCommand=StandAloneCommand; StandAloneCommand=false; Element_Begin1("HideWindows"); BS_Begin(); int8u WindowID=8; bool HasChanged_=false; do { WindowID--; bool IsSet; Get_SB ( IsSet, Ztring(__T("window ")+Ztring::ToZtring(WindowID)).To_Local().c_str()); if (IsSet) { window* Window=Streams[service_number]->Windows[WindowID]; if (Window && Window->visible) { Window->visible=false; for (size_t Pos_Y=0; Pos_Yrow_count; Pos_Y++) for (size_t Pos_X=0; Pos_Xcolumn_count; Pos_X++) { //Clearing window Window->Minimal.CC[Pos_Y][Pos_X]=character(); //Filling global area if (Window->Minimal.Window_y+Pos_YMinimal.CC.size() && Window->Minimal.Window_x+Pos_XMinimal.CC[Window->Minimal.Window_y+Pos_Y].size()) Streams[service_number]->Minimal.CC[Window->Minimal.Window_y+Pos_Y][Window->Minimal.Window_x+Pos_X]=character(); } //Has changed HasChanged_=true; Window_HasChanged(); } } } while (WindowID>0); BS_End(); Element_End0(); Streams[service_number]->WindowID=Save_WindowID; StandAloneCommand=Save_StandAloneCommand; if (HasChanged_) { //Has changed HasChanged(); } } //--------------------------------------------------------------------------- //ToggleWindows void File_Eia708::TGW() { Param_Info1("ToggleWindows"); int8u Save_WindowID=Streams[service_number]->WindowID; bool Save_StandAloneCommand=StandAloneCommand; StandAloneCommand=false; Element_Begin1("ToggleWindows"); BS_Begin(); int8u WindowID=8; bool HasChanged_=false; do { WindowID--; bool IsSet; Get_SB ( IsSet, Ztring(__T("window ")+Ztring::ToZtring(WindowID)).To_Local().c_str()); if (IsSet) { window* Window=Streams[service_number]->Windows[WindowID]; if (Window) { Window->visible=!Window->visible; //Filling global area for (size_t Pos_Y=0; Pos_Yrow_count; Pos_Y++) for (size_t Pos_X=0; Pos_Xcolumn_count; Pos_X++) { if (Window->Minimal.Window_y+Pos_YMinimal.CC.size() && Window->Minimal.Window_x+Pos_XMinimal.CC[Window->Minimal.Window_y+Pos_Y].size()) Streams[service_number]->Minimal.CC[Window->Minimal.Window_y+Pos_Y][Window->Minimal.Window_x+Pos_X]=Window->visible?Window->Minimal.CC[Pos_Y][Pos_X]:character(); } //Has changed HasChanged_=true; Window_HasChanged(); } } } while (WindowID>0); BS_End(); Element_End0(); Streams[service_number]->WindowID=Save_WindowID; StandAloneCommand=Save_StandAloneCommand; if (HasChanged_) { //Has changed HasChanged(); } } //--------------------------------------------------------------------------- //DeleteWindows void File_Eia708::DLW() { Param_Info1("DeleteWindows"); int8u Save_WindowID=Streams[service_number]->WindowID; bool Save_StandAloneCommand=StandAloneCommand; StandAloneCommand=false; //Bug in some files bool Bug_WindowOffset=false; Element_Begin1("DeleteWindows"); BS_Begin(); int8u WindowID=8; bool HasChanged_=false; do { WindowID--; bool IsSet; Get_SB ( IsSet, Ztring(__T("window ")+Ztring::ToZtring(WindowID)).To_Local().c_str()); //Bug in some files if (IsSet && WindowID==1 && Streams[service_number]->Windows[0]!=NULL && Streams[service_number]->Windows[1]==NULL) //Mix between Windows 0 and 1 Bug_WindowOffset=true; if (!IsSet && WindowID==0 && Bug_WindowOffset) IsSet=true; if (IsSet) { window* Window=Streams[service_number]->Windows[WindowID]; if (Window && Window->visible) { //Filling global area for (size_t Pos_Y=0; Pos_Yrow_count; Pos_Y++) for (size_t Pos_X=0; Pos_Xcolumn_count; Pos_X++) { //Clearing window Window->Minimal.CC[Pos_Y][Pos_X]=character(); //Filling global area if (Window->Minimal.Window_y+Pos_YMinimal.CC.size() && Window->Minimal.Window_x+Pos_XMinimal.CC[Window->Minimal.Window_y+Pos_Y].size()) Streams[service_number]->Minimal.CC[Window->Minimal.Window_y+Pos_Y][Window->Minimal.Window_x+Pos_X]=character(); } //Has changed HasChanged_=true; Window_HasChanged(); } //Removing the window delete Streams[service_number]->Windows[WindowID]; Streams[service_number]->Windows[WindowID]=NULL; if (WindowID==Save_WindowID) Save_WindowID=(int8u)-1; } } while (WindowID>0); BS_End(); Element_End0(); Streams[service_number]->WindowID=Save_WindowID; StandAloneCommand=Save_StandAloneCommand; if (HasChanged_) { //Has changed HasChanged(); } } //--------------------------------------------------------------------------- //Delay void File_Eia708::DLY() { Param_Info1("Delay"); Element_Begin1("Delay"); Skip_B1( "tenths of seconds"); Element_End0(); } //--------------------------------------------------------------------------- //Delay Cancel void File_Eia708::DLC() { Param_Info1("Delay Cancel"); } //--------------------------------------------------------------------------- //Reset void File_Eia708::RST() { //TODO: Should clear all buffers Param_Info1("Reset"); } //--------------------------------------------------------------------------- //Set Pen Attributes void File_Eia708::SPA() { Param_Info1("Set Pen Attributes"); Element_Begin1("Set Pen Attributes"); BS_Begin(); Skip_S1(4, "text tag"); Skip_S1(2, "offset"); Skip_S1(2, "pen size"); Skip_SB( "italics"); Skip_SB( "underline"); Skip_S1(3, "edge type"); Skip_S1(3, "font style"); BS_End(); Element_End0(); } //--------------------------------------------------------------------------- //Set Pen Color void File_Eia708::SPC() { Param_Info1("Set Pen Color"); Element_Begin1("Set Pen Color"); BS_Begin(); Skip_S1(2, "foreground opacity"); Skip_S1(2, "foreground red"); Skip_S1(2, "foreground green"); Skip_S1(2, "foreground blue"); Skip_S1(2, "background opacity"); Skip_S1(2, "background red"); Skip_S1(2, "background green"); Skip_S1(2, "background blue"); Mark_0(); Mark_0(); Skip_S1(2, "edge red"); Skip_S1(2, "edge green"); Skip_S1(2, "edge blue"); BS_End(); Element_End0(); } //--------------------------------------------------------------------------- //SetPenLocation void File_Eia708::SPL() { Param_Info1("SetPenLocation"); Element_Begin1("SetPenLocation"); int8u row, column; BS_Begin(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Get_S1 (4, row, "row"); Mark_0(); Mark_0(); Get_S1 (6, column, "column"); BS_End(); Element_End0(); int8u WindowID=Streams[service_number]->WindowID; if (WindowID==(int8u)-1) return; //Must wait for the corresponding CWx window* Window=Streams[service_number]->Windows[WindowID]; if (Window==NULL) return; //Must wait for the corresponding DFx if (rowMinimal.CC.size() && columnMinimal.CC[Window->Minimal.y].size()) { Window->Minimal.x=column; Window->Minimal.y=row; } else { // There is a problem, resetting pen location Window->Minimal.x=0; Window->Minimal.y=0; } } //--------------------------------------------------------------------------- //SetWindowAttributes void File_Eia708::SWA() { Param_Info1("SetWindowAttributes"); Element_Begin1("SetWindowAttributes"); BS_Begin(); Skip_S1(2, "fill opacity"); Skip_S1(2, "fill red"); Skip_S1(2, "fill green"); Skip_S1(2, "fill blue"); Skip_S1(2, "border type (low)"); Skip_S1(2, "border red"); Skip_S1(2, "border green"); Skip_S1(2, "border blue"); Skip_SB( "border type (high)"); Skip_SB( "wordwrap"); Skip_S1(2, "print direction"); Skip_S1(2, "scroll direction"); Skip_S1(2, "justify"); Skip_S1(4, "effect speed"); Skip_S1(2, "effect direction"); Skip_S1(2, "display effect"); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Skip_S1(2, "edge red"); Skip_S1(2, "edge green"); Skip_S1(2, "edge blue"); BS_End(); Element_End0(); } //--------------------------------------------------------------------------- //DefineWindow void File_Eia708::DFx(int8u WindowID) { Param_Info1("DefineWindow"); Param_Info1(WindowID); Element_Begin1("DefineWindow"); int8u anchor_vertical, anchor_horizontal, anchor_point, row_count, column_count; bool visible, relative_positioning; BS_Begin(); Mark_0(); Mark_0(); Get_SB ( visible, "visible"); Skip_SB( "row lock"); Skip_SB( "column lock"); Skip_S1(3, "priority"); Get_SB ( relative_positioning, "relative positioning"); Get_S1 (7, anchor_vertical, "anchor vertical"); //Top left Get_S1 (8, anchor_horizontal, "anchor horizontal"); //Top left Get_S1 (4, anchor_point, "anchor point"); Get_S1 (4, row_count, "row count"); //Maximum=14 Mark_0(); Mark_0(); Get_S1 (6, column_count, "column count"); //Maximum=31 Mark_0(); Mark_0(); Skip_S1(4, "window style"); Skip_S1(2, "pen style ID"); BS_End(); Element_End0(); Streams[service_number]->WindowID=WindowID; if (Streams[service_number]->Windows[WindowID]==NULL) Streams[service_number]->Windows[WindowID]=new window; window* Window=Streams[service_number]->Windows[WindowID]; Window->visible=visible; Window->relative_positioning=relative_positioning; Window->anchor_vertical=anchor_vertical; if (relative_positioning) Window->Minimal.Window_y=(int8u)(((float)15)*anchor_vertical/100); else Window->Minimal.Window_y=anchor_vertical/5; Window->anchor_horizontal=anchor_horizontal; int8u offset_y; switch (anchor_point) { case 0 : case 1 : case 2 : offset_y=0; break; case 3 : case 4 : case 5 : offset_y=(row_count+1)/2; break; case 6 : case 7 : case 8 : offset_y=(row_count+1); break; default: offset_y=0; //Not valid } if (offset_yMinimal.Window_y) Window->Minimal.Window_y-=offset_y; if (relative_positioning) Window->Minimal.Window_x=(int8u)(24*AspectRatio*anchor_horizontal/100); else Window->Minimal.Window_x=anchor_horizontal/5; int8u offset_x; switch (anchor_point) { case 0 : case 3 : case 6 : offset_x=0; break; case 1 : case 4 : case 7 : offset_x=(column_count+1)/2; break; case 2 : case 5 : case 8 : offset_x=(column_count+1); break; default: offset_x=0; //Not valid } if (offset_xMinimal.Window_x) Window->Minimal.Window_x-=offset_x; Window->row_count=row_count+1; Window->column_count=column_count+1; Window->Minimal.x=0; Window->Minimal.y=0; if (Window->row_count>12) { Window->row_count=12; //Limitation of specifications } if (AspectRatio && Window->column_count>(int8u)(24*AspectRatio)) { Window->column_count=(int8u)(24*AspectRatio); //Limitation of specifications } Window->Minimal.CC.resize(Window->row_count); for (int8u Pos_Y=0; Pos_Yrow_count; Pos_Y++) Window->Minimal.CC[Pos_Y].resize(Window->column_count); if (Window->row_count>12) { Window->row_count=12; //Limitation of specifications } if (AspectRatio && Window->column_count>(int8u)(24*AspectRatio)) { Window->column_count=(int8u)(24*AspectRatio); //Limitation of specifications } Window->Minimal.CC.resize(Window->row_count); for (int8u Pos_Y=0; Pos_Yrow_count; Pos_Y++) Window->Minimal.CC[Pos_Y].resize(Window->column_count); } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- void File_Eia708::Character_Fill(wchar_t Character) { Param_Info1(Ztring(1, Character)); int8u WindowID=Streams[service_number]->WindowID; if (WindowID==(int8u)-1) return; //Must wait for the corresponding CWx window* Window=Streams[service_number]->Windows[WindowID]; if (Window==NULL) return; //Must wait for the corresponding DFx int8u x=Window->Minimal.x; int8u y=Window->Minimal.y; int8u Window_x=Window->Minimal.Window_x; int8u Window_y=Window->Minimal.Window_y; if (xcolumn_count && yrow_count) { //Filling window Window->Minimal.CC[y][x].Value=Character; if (Window->visible) { //Filling global area if (Window_y+y<(int8u)Streams[service_number]->Minimal.CC.size() && Window_x+x<(int8u)Streams[service_number]->Minimal.CC[Window_y+y].size()) Streams[service_number]->Minimal.CC[Window_y+y][Window_x+x].Value=Character; //Has changed Window_HasChanged(); HasChanged(); } x++; Window->Minimal.x=x; } if (!HasContent) HasContent=true; } //--------------------------------------------------------------------------- void File_Eia708::Window_HasChanged() { } //--------------------------------------------------------------------------- void File_Eia708::HasChanged() { } //--------------------------------------------------------------------------- void File_Eia708::Illegal(int8u Size, int8u cc_data_1, int8u cc_data_2, int8u cc_data_3, int8u cc_data_4, int8u cc_data_5, int8u cc_data_6) { } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_EIA708_YES MediaInfoLib/Source/MediaInfo/Text/File_Eia708.h100777 0 0 11750 12226004262 14563 0/* 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 PGS files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_Eia708H #define MediaInfo_File_Eia708H //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include #include //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Eia708 //*************************************************************************** class File_Eia708 : public File__Analyze { public : //In int8u cc_type; float64 AspectRatio; //Constructor/Destructor File_Eia708(); ~File_Eia708(); private : //Streams management void Streams_Fill(); void Streams_Finish(); //Buffer - Synchro bool Synchronize(); bool Synched_Test(); //Buffer - Global void Read_Buffer_Init(); void Read_Buffer_Continue(); void Read_Buffer_Unsynched(); //Buffer - Per element void Header_Parse(); void Data_Parse(); //Temp struct character { wchar_t Value; int8u Attribute; character() { Value=L' '; } }; struct window { enum scroll_direction { Scroll_Direction_Unknown, Scroll_Direction_LeftToRight, Scroll_Direction_RightToLeft, Scroll_Direction_TopToBottom, }; bool visible; scroll_direction Scroll_Direction; int8u row_count; int8u column_count; bool relative_positioning; int8u anchor_vertical; int8u anchor_horizontal; struct data { vector > CC; int8u Window_x; //x of the Windows, relative to the global area int8u Window_y; int8u x; int8u y; data() { Window_x=0; Window_y=0; x=0; y=0; } }; data Minimal; //In characters int8u PenSize; window() { visible=false; Scroll_Direction=Scroll_Direction_Unknown; row_count=(int8u)-1; column_count=(int8u)-1; relative_positioning=false; anchor_vertical=(int8u)-1; anchor_horizontal=(int8u)-1; PenSize=1; //Standard } }; struct stream { std::vector Windows; struct data { vector > CC; }; data Minimal; int8u WindowID; stream() { WindowID=(int8u)-1; } ~stream() { for (size_t Pos=0; Pos Streams; int8u service_number; int8u block_size; bool HasContent; //Elements void NUL(); //NUL void ETX(); //End Of Text void BS(); //Backspace void FF(); //Form Feed void CR(); //Carriage Return void HCR(); //Horizontal Carriage Return void CWx(int8u WindowID); //SetCurrentWindow void CLW(); //ClearWindows void DSW(); //DisplayWindows void HDW(); //HideWindows void TGW(); //ToggleWindows void DLW(); //DeleteWindows void DLY(); //Delay void DLC(); //Delay Cancel void RST(); //Reset void SPA(); //SetPenAttributes void SPC(); //SetPenColor void SPL(); //SetPenLocation void SWA(); //SetWindowAttributes void DFx(int8u WindowID); //DefineWindow //Temp bool StandAloneCommand; //If this is a command simulated from another command //Helpers void Service(); void Character_Fill(wchar_t Character); void HasChanged(); void Window_HasChanged(); void Illegal(int8u Size, int8u cc_data_1, int8u cc_data_2=(int8u)-1, int8u cc_data_3=(int8u)-1, int8u cc_data_4=(int8u)-1, int8u cc_data_5=(int8u)-1, int8u cc_data_6=(int8u)-1); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Text/File_Kate.cpp100777 0 0 13432 12226004262 15044 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Note : the buffer must be given in ONE call // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_KATE_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Text/File_Kate.h" using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- Ztring Kate_Category(const Ztring &Category) { //http://wiki.xiph.org/index.php/OggText#Categories_of_Text_Codecs if (Category==__T("CC")) return __T("Closed caption"); if (Category==__T("SUB")) return __T("Subtitles"); if (Category==__T("TAD")) return __T("Textual audio descriptions"); if (Category==__T("KTV")) return __T("Karaoke"); if (Category==__T("TIK")) return __T("Ticker text"); if (Category==__T("AR")) return __T("Active regions"); if (Category==__T("NB")) return __T("Semantic annotations"); if (Category==__T("META")) return __T("Metadata, mostly machine-readable"); if (Category==__T("TRX")) return __T("Transcript"); if (Category==__T("LRC")) return __T("Lyrics"); if (Category==__T("LIN")) return __T("Linguistic markup"); if (Category==__T("CUE")) return __T("Cue points"); //From Kate if (Category==__T("K-SLD-I")) return __T("Slides, as images"); if (Category==__T("K-SLD-T")) return __T("Slides, as text"); return Category; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Kate::Data_Parse() { //Parsing Identification(); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Kate::Identification() { Element_Name("Identification"); //Parsing Ztring Language, Category; int16u Width, Height; int8u VersionMajor, VersionMinor, NumHeaders, TextEncoding; Skip_B1 ( "Signature"); Skip_Local(7, "Signature"); Skip_L1( "Reserved"); Get_L1 (VersionMajor, "version major"); Get_L1 (VersionMinor, "version minor"); Get_L1 (NumHeaders, "num headers"); Get_L1 (TextEncoding, "text encoding"); Skip_L1( "directionality"); Skip_L1( "Reserved"); Skip_L1( "granule shift"); Skip_L4( "Reserved"); Get_L2 (Width, "cw sh + canvas width"); Get_L2 (Height, "ch sh + canvas height"); /* BS_Begin(); Skip_BS( 4, "cw sh"); Get_BS (12, Width, "canvas width"); Skip_BS( 4, "ch sh"); Get_BS (12, Height, "canvas height"); BS_End(); */ Skip_L4( "granule rate numerator"); Skip_L4( "granule rate denominator"); Get_UTF8(16, Language, "Language"); Get_UTF8(16, Category, "Category"); FILLING_BEGIN(); Accept("Kate"); Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, Text_Format, "Kate"); Fill(Stream_Text, 0, Text_Codec, "Kate"); Fill(Stream_Text, 0, Text_Language, Language); Fill(Stream_Text, 0, Text_Language_More, Kate_Category(Category)); Finish("Kate"); FILLING_END(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_KATE_YES MediaInfoLib/Source/MediaInfo/Text/File_Kate.h100777 0 0 2312 12226004262 14464 0/* 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 Kate files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_KateH #define MediaInfo_File_KateH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Kate //*************************************************************************** class File_Kate : public File__Analyze { private : //Buffer - Per element void Data_Parse(); //Elements void Identification(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Text/File_N19.cpp100777 0 0 41273 12226004262 14533 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_N19_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Text/File_N19.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events_Internal.h" #endif //MEDIAINFO_EVENTS using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constants //*************************************************************************** //--------------------------------------------------------------------------- const char* N19_CodePageNumber(int32u CPN) { switch (CPN) { case 0x343337 : return "United States"; case 0x383530 : return "Multilingual"; case 0x383630 : return "Portugal"; case 0x383633 : return "Canada-French"; case 0x383635 : return "Nordic"; default : return ""; } } //--------------------------------------------------------------------------- float32 N19_DiskFormatCode_FrameRate(int64u DFC) { switch (DFC) { case 0x53544C32352E3031LL : return 25.000; case 0x53544C33302E3031LL : return 30.000; default : return 0.000; } } //--------------------------------------------------------------------------- const char* N19_DisplayStandardCode(int8u DSC) { switch (DSC) { case 0x30 : return "Open subtitling"; case 0x31 : return "Level-1 teletext"; case 0x32 : return "Level-2 teletext"; default : return ""; } } //--------------------------------------------------------------------------- const char* N19_LanguageCode(int16u LC) { switch (LC) { case 0x3030 : return ""; case 0x3031 : return "sq"; case 0x3032 : return "br"; case 0x3033 : return "ca"; case 0x3034 : return "hr"; case 0x3035 : return "cy"; case 0x3036 : return "cs"; case 0x3037 : return "da"; case 0x3038 : return "de"; case 0x3039 : return "en"; case 0x3041 : return "es"; case 0x3042 : return "eo"; case 0x3043 : return "et"; case 0x3044 : return "eu"; case 0x3045 : return "fo"; case 0x3046 : return "fr"; case 0x3130 : return "fy"; case 0x3131 : return "ga"; case 0x3132 : return "gd"; case 0x3133 : return "gl"; case 0x3134 : return "is"; case 0x3135 : return "it"; case 0x3136 : return "Lappish"; case 0x3137 : return "la"; case 0x3138 : return "lv"; case 0x3139 : return "lb"; case 0x3141 : return "lt"; case 0x3142 : return "hu"; case 0x3143 : return "mt"; case 0x3144 : return "nl"; case 0x3145 : return "no"; case 0x3146 : return "oc"; case 0x3230 : return "pl"; case 0x3231 : return "pt"; case 0x3232 : return "ro"; case 0x3233 : return "Romansh"; case 0x3234 : return "sr"; case 0x3235 : return "sk"; case 0x3236 : return "sl"; case 0x3237 : return "fi"; case 0x3238 : return "sv"; case 0x3239 : return "tr"; case 0x3241 : return "Flemish"; case 0x3242 : return "wa"; case 0x3435 : return "zu"; case 0x3436 : return "vi"; case 0x3437 : return "uz"; case 0x3438 : return "ur"; case 0x3439 : return "uk"; case 0x3441 : return "th"; case 0x3442 : return "te"; case 0x3443 : return "tt"; case 0x3444 : return "ta"; case 0x3445 : return "Tadzhik"; case 0x3446 : return "sw"; case 0x3530 : return "Sranan Tongo"; case 0x3531 : return "so"; case 0x3532 : return "si"; case 0x3533 : return "sn"; case 0x3534 : return "sr"; case 0x3535 : return "Ruthenian"; case 0x3536 : return "ru"; case 0x3537 : return "qu"; case 0x3538 : return "ps"; case 0x3539 : return "Punjabi"; case 0x3541 : return "fa"; case 0x3542 : return "Papamiento"; case 0x3543 : return "or"; case 0x3544 : return "ne"; case 0x3545 : return "nr"; case 0x3546 : return "mr"; case 0x3630 : return "mo"; case 0x3631 : return "ms"; case 0x3632 : return "mg"; case 0x3633 : return "mk"; case 0x3634 : return "Laotian"; case 0x3635 : return "kr"; case 0x3636 : return "km"; case 0x3637 : return "kk"; case 0x3638 : return "kn"; case 0x3639 : return "jp"; case 0x3641 : return "id"; case 0x3642 : return "hi"; case 0x3643 : return "he"; case 0x3644 : return "ha"; case 0x3645 : return "Gurani"; case 0x3646 : return "Gujurati"; case 0x3730 : return "hr"; case 0x3731 : return "ka"; case 0x3732 : return "ff"; case 0x3733 : return "Dari"; case 0x3734 : return "Churash"; case 0x3735 : return "zh"; case 0x3736 : return "my"; case 0x3737 : return "bg"; case 0x3738 : return "bn"; case 0x3739 : return "be"; case 0x3741 : return "bm"; case 0x3742 : return "az"; case 0x3743 : return "as"; case 0x3744 : return "hy"; case 0x3745 : return "ar"; case 0x3746 : return "am"; default : return ""; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_N19::File_N19() :File__Analyze() { //Configuration #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_N19; StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_N19::FileHeader_Begin() { //Element_Size if (Buffer_Size<11) return false; //Must wait for more data int64u DiskFormatCode=CC8(Buffer+3); if (DiskFormatCode!=0x53544C32352E3031LL && DiskFormatCode!=0x53544C33302E3031LL) { Reject("N19"); return false; } //Element_Size if (Buffer_Size<1024) return false; //Must wait for more data about GSI //All should be OK... return true; } //--------------------------------------------------------------------------- void File_N19::FileHeader_Parse() { Element_Name("General Subtitle Information"); //Parsing Ztring OPT, RD, TNS, MNC, MNR, CO, EN; string TCP; int16u LC; int8u TCS; Info_C3 ( CPN, "CPN - Code Page Number"); Param_Info1(N19_CodePageNumber(CPN)); Get_C8 ( DFC, "DFC - Disk Format Code"); Param_Info1(N19_DiskFormatCode_FrameRate(DFC)); Info_C1 ( DSC, "DSC - Display Standard Code"); Param_Info1(N19_DisplayStandardCode(DSC)); Skip_C2 ( "CCT - Character Code Table number"); Get_C2 ( LC, "LC - Language Code"); Param_Info1(N19_LanguageCode(LC)); Get_Local (32, OPT, "OPT - Original Programme Title"); Skip_Local(32, "OET - Original Episode Title"); Skip_Local(32, "TPT - Translated Programme"); Skip_Local(32, "TET - Translated Episode"); Skip_Local(32, "TN - Translator's Name"); Skip_Local(32, "TCD - Translator's Contact Details"); Skip_Local(16, "SLR - Subtitle List Reference Code"); Skip_Local( 6, "CD - Creation Date"); Get_Local ( 6, RD, "RD - Revision Date"); Skip_C2 ( "RN - Revision number"); Skip_C5 ( "TNB - Total Number of Text and Timing Information (TTI) blocks"); Get_Local ( 5, TNS, "TNS - Total Number of Subtitles"); Skip_C3 ( "TNG - Total Number of Subtitle Groups"); Get_Local ( 2, MNC, "MNC - Maximum Number of Displayable Characters in any text row"); Get_Local ( 2, MNR, "MNR - Maximum Number of Displayable Rows"); Get_C1 ( TCS, "TCS - Time Code: Status"); Get_String( 8, TCP, "TCP - Time Code: Start-of-Programme"); Skip_Local( 8, "TCF - Time Code: First In-Cue"); Skip_C1 ( "TND - Total Number of Disks"); Skip_C1 ( "DSN - Disk Sequence Number"); Get_Local ( 3, CO, "CO - Country of Origin"); Skip_Local(32, "PUB - Publisher"); Get_Local (32, EN, "EN - Editor's Name"); Skip_Local(32, "ECD - Editor's Contact Details"); Skip_XX(75, "Spare Bytes"); Skip_XX(576, "UDA - User-Defined Area"); FILLING_BEGIN(); Accept("N19"); Fill(Stream_General, 0, General_Format, "N19"); Fill(Stream_General, 0, General_Title, OPT); RD.insert(0, __T("20")); RD.insert(4, __T("-")); RD.insert(7, __T("-")); Fill(Stream_General, 0, General_Recorded_Date, RD); Fill(Stream_General, 0, General_Country, Ztring(CO).MakeLowerCase()); Fill(Stream_General, 0, General_DistributedBy, EN); Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, Text_Format, "N19"); if (N19_DiskFormatCode_FrameRate(DFC)) { Fill(Stream_Text, 0, "FrameRate", N19_DiskFormatCode_FrameRate(DFC)); if (TCS==0x31 && TCP.size()==8 && TCP[0]>='0' && TCP[0]<='9' && TCP[1]>='0' && TCP[1]<='9' && TCP[2]>='0' && TCP[2]<='6' && TCP[3]>='0' && TCP[3]<='9' && TCP[4]>='0' && TCP[4]<='6' && TCP[5]>='0' && TCP[5]<='9' && TCP[6]>='0' && TCP[6]<='2' && TCP[7]>='0' && TCP[7]<='9') { int32u Delay=0; Delay+=(((int32u)TCP[0])-'0')*10*60*60*1000; Delay+=(((int32u)TCP[1])-'0')* 60*60*1000; Delay+=(((int32u)TCP[2])-'0')* 10*60*1000; Delay+=(((int32u)TCP[3])-'0')* 60*1000; Delay+=(((int32u)TCP[4])-'0')* 10*1000; Delay+=(((int32u)TCP[5])-'0')* 1000; int8u Frames=0; Frames+=(((int8u)TCP[6])-'0')*10; Frames+=(((int8u)TCP[7])-'0'); Delay+=float32_int32s(Frames*1000/N19_DiskFormatCode_FrameRate(DFC)); //Fill(Stream_Text, 0, Text_Delay, Delay); //TODO is 0??? /*TCP.insert(':', 2); TCP.insert(':', 5); TCP.insert(':', 8); Fill(Stream_Text, 0, "Delay/String4", TCP);*/ } } Fill(Stream_Text, 0, Text_Width, MNC.To_int32u()); Fill(Stream_Text, 0, Text_Width_String, Ztring::ToZtring(MNC.To_int32u())+__T(" characters"), true); Fill(Stream_Text, 0, Text_Height, MNR.To_int32u()); Fill(Stream_Text, 0, Text_Height_String, Ztring::ToZtring(MNR.To_int32u())+__T(" characters"), true); Fill(Stream_Text, 0, Text_Language, N19_LanguageCode(LC)); //Init FirstFrame_TCI=(int64u)-1; #if MEDIAINFO_DEMUX Frame_Count=0; TCO_Latest=(int64u)-1; #endif //MEDIAINFO_DEMUX FILLING_END(); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_N19::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { #if MEDIAINFO_DEMUX TCO_Latest=(int64u)-1; #endif //MEDIAINFO_DEMUX GoTo(0x400); Open_Buffer_Unsynch(); return 1; } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_N19::Header_Parse() { //Filling Header_Fill_Size(128); Header_Fill_Code(0, __T("TTI")); } //--------------------------------------------------------------------------- void File_N19::Data_Parse() { //Parsing int32u TCI, TCO; Skip_B1 ( "SGN - Subtitle Group Number"); Skip_B2 ( "SN - Subtitle Number"); Skip_B1 ( "EBN - Extension Block Number"); Skip_B1 ( "CS - Cumulative Status"); Get_B4 (TCI, "TCI - Time Code In"); TCI=((TCI>>24)&0xFF)*60*60*1000 + ((TCI>>16)&0xFF) *60*1000 + ((TCI>>8 )&0xFF) *1000 + float32_int32s((TCI &0xFF) *1000/N19_DiskFormatCode_FrameRate(DFC)); Param_Info1(Ztring().Duration_From_Milliseconds((int64u)TCI)); Get_B4 (TCO, "TCO - Time Code Out"); TCO=((TCO>>24)&0xFF)*60*60*1000 + ((TCO>>16)&0xFF) *60*1000 + ((TCO>>8 )&0xFF) *1000 + float32_int32s((TCO &0xFF) *1000/N19_DiskFormatCode_FrameRate(DFC)); Param_Info1(Ztring().Duration_From_Milliseconds((int64u)TCO)); Skip_B1 ( "VP - Vertical Position"); Skip_B1 ( "JC - Justification Code"); Skip_B1 ( "CF - Comment Flag"); Skip_Local(112, "TF - Text Field"); FILLING_BEGIN(); if (FirstFrame_TCI==(int64u)-1) { FirstFrame_TCI=TCI; Fill(Stream_Text, 0, Text_Delay, TCI); Fill(Stream_Text, 0, Text_Delay_Source, "Container"); } if (File_Offset+Buffer_Offset+Element_Size+128>File_Size) { Fill(Stream_Text, 0, Text_Duration, TCO-FirstFrame_TCI); } else if (Config->ParseSpeed<1.0) //Jumping GoToFromEnd(128, "N19"); FILLING_END(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_N19_YES MediaInfoLib/Source/MediaInfo/Text/File_N19.h100777 0 0 3113 12226004262 14147 0/* 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 N19 files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_N19H #define MediaInfo_File_N19H //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_N19 //*************************************************************************** class File_N19 : public File__Analyze { public : File_N19(); private : //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse(); //Buffer - Global #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK //Buffer - Per element void Header_Parse(); void Data_Parse(); //Temp int64u FirstFrame_TCI; int64u DFC; #if MEDIAINFO_DEMUX int64u TCO_Latest; #endif //MEDIAINFO_DEMUX }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Text/File_OtherText.cpp100777 0 0 14352 12226004262 16110 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_OTHERTEXT_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Text/File_OtherText.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Functions //*************************************************************************** void File_OtherText::Read_Buffer_Continue() { if (Buffer_Size<0x200) { Element_WaitForMoreData(); return; } Element_Offset=File_Size-(File_Offset+Buffer_Offset); Ztring Format, FormatMore, Codec; Ztring File; ZtringList Lines; //Feed File and Lines File.From_UTF8((const char*)Buffer, Buffer_Size>65536?65536:Buffer_Size); if (File.empty()) File.From_Local((const char*)Buffer, Buffer_Size>65536?65536:Buffer_Size); // Trying from local code page if (File.size()<0x100) { File.From_Unicode((wchar_t*)Buffer, 0, Buffer_Size/sizeof(wchar_t)); //Unicode with BOM //TODO: Order of bytes (big or Little endian) if (File.size()<0x100) { Reject("Other text"); return; } } if (File.size()>0x1000) File.resize(0x1000); //Do not work on too big File.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive); File.FindAndReplace(__T("\r"), __T("\n"), 0, Ztring_Recursive); Lines.Separator_Set(0, __T("\n")); Lines.Write(File); Lines.resize(0x20); if (Lines[0]==__T("[Script Info]") && (Lines.Find(__T("ScriptType: v4.00"))!=Error || Lines.Find(__T("Script Type: V4.00"))!=Error) && Lines.Find(__T("[V4 Styles]"))!=Error ) { Format=__T("SSA"); FormatMore=__T("SubStation Alpha"); Codec=__T("SSA"); } else if (Lines[0]==__T("[Script Info]") && (Lines.Find(__T("ScriptType: v4.00+"))!=Error || Lines.Find(__T("Script Type: V4.00+"))!=Error) && Lines.Find(__T("[V4+ Styles]"))!=Error ) { Format=__T("ASS"); FormatMore=__T("Advanced SubStation Alpha"); Codec=__T("ASS"); } else if (Lines[0].size()>24 && Lines[0][ 0]==__T('0') && Lines[0][ 1]==__T('0') && Lines[0][ 2]==__T(':') && Lines[0][ 5]==__T(':') && Lines[0][ 8]==__T(':') && Lines[0][11]==__T(' ') && Lines[0][12]==__T('0') && Lines[0][13]==__T('0') && Lines[0][14]==__T(':') && Lines[0][17]==__T(':') && Lines[0][20]==__T(':') && Lines[0][23]==__T(' ') ) { Format=__T("Adobe encore DVD"); Codec=__T("Adobe"); } else if (Lines[0].size()==11 && Lines[0][0]==__T('-') && Lines[0][1]==__T('-') && Lines[0][2]==__T('>') && Lines[0][3]==__T('>') && Lines[0][4]==__T(' ') && Lines[0][5]==__T('0') && Lines[1].empty()!=true ) { Format=__T("AQTitle"); Codec=__T("AQTitle"); } else if (Lines[0].size()>28 && Lines[0][ 0]==__T('0') && Lines[0][ 1]==__T('0') && Lines[0][ 2]==__T(':') && Lines[0][ 5]==__T(':') && Lines[0][ 8]==__T(':') && Lines[0][11]==__T(' ') && Lines[0][12]==__T(',') && Lines[0][13]==__T(' ') && Lines[0][14]==__T('0') && Lines[0][15]==__T('0') && Lines[0][16]==__T(':') && Lines[0][19]==__T(':') && Lines[0][22]==__T(':') && Lines[0][25]==__T(' ') && Lines[0][16]==__T(',') && Lines[0][27]==__T(' ') ) { Format=__T("Captions 32"); Codec=__T("Caption 32"); } else if (Lines[0].size()==23 && Lines[0]==__T("*Timecode type: PAL/EBU") && Lines[1].empty() && Lines[2].size()==23 && Lines[2][ 0]==__T('0') && Lines[2][ 1]==__T('0') && Lines[2][ 2]==__T(':') && Lines[2][ 5]==__T(':') && Lines[2][ 8]==__T(':') && Lines[2][11]==__T(' ') && Lines[2][12]==__T('0') && Lines[2][13]==__T('0') && Lines[2][14]==__T(':') && Lines[2][17]==__T(':') && Lines[2][20]==__T(':') && Lines[2].size()>0 ) { Format=__T("Captions Inc"); Codec=__T("Captions inc"); } else if (Lines[0].size()>1 && Lines[0][0]==__T('*') && Lines.Find(__T("** Caption Number 1"))!=Error ) { Format=__T("Cheeta"); } else if (Lines[0].size()>10 && Lines[0][0]==__T('~') && Lines[0][1]==__T('C') && Lines[0][2]==__T('P') && Lines[0][3]==__T('C') && Lines[0][9]==__T('~') && Lines[1][ 0]==__T('0') && Lines[1][ 1]==__T('0') && Lines[1][ 2]==__T(':') && Lines[1][ 5]==__T(':') && Lines[1][ 8]==__T(':') ) { Format=__T("CPC Captioning"); Codec=__T("CPC Captioning"); } else if (Lines[0].find(__T(""))==0) { Format=__T("SAMI"); } else return; if (Format.empty()) return; Accept("Other text"); if (!IsSub) { Fill(Stream_General, 0, General_Format, Format); Fill(Stream_General, 0, General_Format_Info, FormatMore, true); } Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, Text_Format, Format); Fill(Stream_Text, 0, Text_Codec, Codec); //No more need data Element_Begin1(Format); Element_End0(); Finish("Other text"); } } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Text/File_OtherText.h100777 0 0 2300 12226004262 15523 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Use magic number to detect only the format (Text) // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_OtherTextH #define MediaInfo_File_OtherTextH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_OtherText //*************************************************************************** class File_OtherText : public File__Analyze { //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Text/File_Pgs.cpp100777 0 0 4301 12226004262 14664 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_PGS_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Text/File_Pgs.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Pgs::Streams_Fill() { Stream_Prepare(Stream_Text); //TODO: This is currenlty only text Fill(Stream_Text, 0, Text_Format, "PGS"); Fill(Stream_Text, 0, Text_Codec, "PGS"); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Pgs::Read_Buffer_Continue() { Skip_XX(Element_Size, "PGS data"); if (!Status[IsAccepted]) { Accept("PGS"); Finish("PGS"); } } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_PGS_YES MediaInfoLib/Source/MediaInfo/Text/File_Pgs.h100777 0 0 2322 12226004262 14332 0/* 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 PGS files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_PgsH #define MediaInfo_File_PgsH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Pgs //*************************************************************************** class File_Pgs : public File__Analyze { private : //Streams management void Streams_Fill(); //Buffer - Global void Read_Buffer_Continue(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Text/File_Scc.cpp100777 0 0 21327 12226004262 14672 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_SCC_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Text/File_Scc.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "MediaInfo/Text/File_Eia608.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Utils //*************************************************************************** int64u Scc_str2timecode(const char* Value) { size_t Length=strlen(Value); if (Length==11 && Value[0]>='0' && Value[0]<='9' && Value[1]>='0' && Value[1]<='9' && Value[2]==':' && Value[3]>='0' && Value[3]<='9' && Value[4]>='0' && Value[4]<='9' && Value[5]==':' && Value[6]>='0' && Value[6]<='9' && Value[7]>='0' && Value[7]<='9' && (Value[8]==':' || Value[8]==';') && Value[9]>='0' && Value[9]<='9' && Value[10]>='0' && Value[10]<='9') { int64u ToReturn=(int64u)(Value[0]-'0')*10*60*60*1000000000 +(int64u)(Value[1]-'0') *60*60*1000000000 +(int64u)(Value[3]-'0') *10*60*1000000000 +(int64u)(Value[4]-'0') *60*1000000000 +(int64u)(Value[6]-'0') *10*1000000000 +(int64u)(Value[7]-'0') *1000000000 +(int64u)(Value[9]-'0') * 333333333 +(int64u)(Value[10]-'0') * 33333333; return ToReturn; } else return (int64u)-1; } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Scc::File_Scc() :File__Analyze() { //Configuration ParserName=__T("SCC"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Scc; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_TRACE Trace_Layers_Update(8); //Stream #endif //MEDIAINFO_TRACE PTS_DTS_Needed=true; //Temp Parser=NULL; } //--------------------------------------------------------------------------- File_Scc::~File_Scc() { delete Parser; //Parser=NULL; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_Scc::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { GoTo(0); Open_Buffer_Unsynch(); return 1; } #endif //MEDIAINFO_SEEK //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK void File_Scc::Read_Buffer_Unsynched() { if (Parser) Parser->Open_Buffer_Unsynch(); } #endif //MEDIAINFO_SEEK //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK void File_Scc::Read_Buffer_AfterParsing() { if (Parser && File_Offset+Buffer_Size==File_Size) Parser->Open_Buffer_Unsynch(); } #endif //MEDIAINFO_SEEK //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Scc::Streams_Finish() { if (Parser && Parser->Status[IsAccepted]) { Finish(Parser); for (size_t Pos2=0; Pos2Count_Get(Stream_Text); Pos2++) { Stream_Prepare(Stream_Text); Merge(*Parser, Stream_Text, StreamPos_Last, Pos2); Fill(Stream_Text, StreamPos_Last, Text_ID, Parser->Retrieve(Stream_Text, Pos2, Text_ID), true); } } } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Scc::FileHeader_Begin() { //Element_Size if (File_Size<22) { Reject("N19"); return false; } if (Buffer_Size<22) return false; //Must wait for more data if (Buffer[ 0]!=0x53 || Buffer[ 1]!=0x63 || Buffer[ 2]!=0x65 || Buffer[ 3]!=0x6E || Buffer[ 4]!=0x61 || Buffer[ 5]!=0x72 || Buffer[ 6]!=0x69 || Buffer[ 7]!=0x73 || Buffer[ 8]!=0x74 || Buffer[ 9]!=0x5F || Buffer[10]!=0x53 || Buffer[11]!=0x43 || Buffer[12]!=0x43 || Buffer[13]!=0x20 || Buffer[14]!=0x56 || Buffer[15]!=0x31 || Buffer[16]!=0x2E || Buffer[17]!=0x30 ) { Reject("SCC"); return false; } //Element_Size if (Buffer_SizeFrameInfo.DTS=Scc_str2timecode(TimeStamp.c_str()); while (Element_Offset+5<=Element_Size) { int8u Buffer_Temp[2]; Buffer_Temp[0]=(Buffer[Buffer_Offset+(size_t)Element_Offset+1]-(Buffer[Buffer_Offset+(size_t)Element_Offset+1]>='a'?('a'-10):'0'))<<4 | (Buffer[Buffer_Offset+(size_t)Element_Offset+2]-(Buffer[Buffer_Offset+(size_t)Element_Offset+2]>='a'?('a'-10):'0')); Buffer_Temp[1]=(Buffer[Buffer_Offset+(size_t)Element_Offset+3]-(Buffer[Buffer_Offset+(size_t)Element_Offset+3]>='a'?('a'-10):'0'))<<4 | (Buffer[Buffer_Offset+(size_t)Element_Offset+4]-(Buffer[Buffer_Offset+(size_t)Element_Offset+4]>='a'?('a'-10):'0')); Open_Buffer_Continue(Parser, Buffer_Temp, 2); Element_Offset+=5; if (Parser->FrameInfo.DTS!=(int64u)-1) Parser->FrameInfo.DTS+=33333333; } } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_SCC_YES MediaInfoLib/Source/MediaInfo/Text/File_Scc.h100777 0 0 3241 12226004262 14312 0/* 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 SCC (Scenarist Closed Captioning) files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_SccH #define MediaInfo_File_SccH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Scc //*************************************************************************** class File_Scc : public File__Analyze { public : File_Scc(); ~File_Scc(); private : //Streams management void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); void FileHeader_Parse(); //Buffer - Global #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); void Read_Buffer_Unsynched (); void Read_Buffer_AfterParsing (); #endif //MEDIAINFO_SEEK //Buffer - Per element void Header_Parse(); void Data_Parse(); //Temp File__Analyze* Parser; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Text/File_Scte20.cpp100777 0 0 24243 12226004262 15222 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_SCTE20_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Text/File_Scte20.h" #if defined(MEDIAINFO_EIA608_YES) #include "MediaInfo/Text/File_Eia608.h" #endif #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events.h" #endif //MEDIAINFO_EVENTS //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* Scte20_field_number (int8u field_number) { switch (field_number) { case 0 : return "Forbidden"; case 1 : return "1st display field"; case 2 : return "2nd display field"; case 3 : return "3rd display field"; default : return ""; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Scte20::File_Scte20() :File__Analyze() { //Configuration ParserName=__T("SCTE 20"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Scte20; StreamIDs_Width[0]=1; #endif //MEDIAINFO_EVENTS PTS_DTS_Needed=true; //In picture_structure=(int8u)-1; progressive_sequence=false; progressive_frame=false; top_field_first=false; repeat_first_field=false; //Temp Streams.resize(2); //CEA-608 Field 1, CEA-608 Field 2 Streams_Count=0; } //--------------------------------------------------------------------------- File_Scte20::~File_Scte20() { for (size_t Pos=0; PosParser && Streams[Pos]->Parser->Status[IsFilled] /*&& Streams[Pos]->Parser->Status[IsUpdated]*/ && Streams[Pos]->Parser->Count_Get(Stream_Text)) Streams_Update_PerStream(Pos); } //--------------------------------------------------------------------------- void File_Scte20::Streams_Update_PerStream(size_t Pos) { if (Streams[Pos]==NULL) return; Update(Streams[Pos]->Parser); if (Streams[Pos]->Parser) { for (size_t Pos2=0; Pos2Parser->Count_Get(Stream_Text); Pos2++) { Stream_Prepare(Stream_Text); Merge(*Streams[Pos]->Parser, Stream_Text, Pos2, StreamPos_Last); Fill(Stream_Text, StreamPos_Last, "MuxingMode", "SCTE 20"); Fill(Stream_Text, StreamPos_Last, Text_ID, Streams[Pos]->Parser->Retrieve(Stream_Text, Pos2, Text_ID), true); } Ztring LawRating=Streams[Pos]->Parser->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); } } //--------------------------------------------------------------------------- void File_Scte20::Streams_Finish() { Clear(Stream_Text); //Per stream for (size_t Pos=0; PosParser && Streams[Pos]->Parser->Status[IsAccepted] /*&& Streams[Pos]->Parser->Status[IsUpdated]*/) { Finish(Streams[Pos]->Parser); Streams_Update_PerStream(Pos); } } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- void File_Scte20::Read_Buffer_Unsynched() { //Parsing for (size_t Pos=0; PosParser) Streams[Pos]->Parser->Open_Buffer_Unsynch(); } //*************************************************************************** // Buffer - Global //*************************************************************************** static inline int8u ReverseBits(int8u c) { // Input: bit order is 76543210 //Output: bit order is 01234567 c = (c & 0x0F) << 4 | (c & 0xF0) >> 4; c = (c & 0x33) << 2 | (c & 0xCC) >> 2; c = (c & 0x55) << 1 | (c & 0xAA) >> 1; return c; } //--------------------------------------------------------------------------- void File_Scte20::Read_Buffer_Continue() { //Parsing Element_Begin1("SCTE 20"); int8u cc_count; bool vbi_data_flag; BS_Begin(); Mark_1_NoTrustError(); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Get_SB (vbi_data_flag, "vbi_data_flag"); if (vbi_data_flag) { Get_S1 (5, cc_count, "cc_count"); for (int8u Pos=0; PosParser==NULL) { #if defined(MEDIAINFO_EIA608_YES) Streams[cc_type]->Parser=new File_Eia608(); ((File_Eia608*)Streams[cc_type]->Parser)->cc_type=cc_type; #else //defined(MEDIAINFO_EIA608_YES) Streams[cc_type]->Parser=new File__Analyze(); #endif //defined(MEDIAINFO_EIA608_YES) Open_Buffer_Init(Streams[cc_type]->Parser); } Demux(cc_data, 2, ContentType_MainStream); if (!Streams[cc_type]->Parser->Status[IsFinished]) { //Parsing if (Streams[cc_type]->Parser->PTS_DTS_Needed) { Streams[cc_type]->Parser->FrameInfo.PCR=FrameInfo.PCR; Streams[cc_type]->Parser->FrameInfo.PTS=FrameInfo.PTS; Streams[cc_type]->Parser->FrameInfo.DTS=FrameInfo.DTS; } Open_Buffer_Continue(Streams[cc_type]->Parser, cc_data, 2); Element_Show(); //Filled if (!Status[IsAccepted]) Accept("SCTE 20"); } else Skip_XX(2, "Data"); Element_End0(); } Element_End0(); } } Skip_S1(4, "non_real_time_video_count"); BS_End(); if (Element_Size-Element_Offset) Skip_XX(Element_Size-Element_Offset, "non_real_time_video + reserved"); Element_End0(); Element_Show(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_SCTE20_YES MediaInfoLib/Source/MediaInfo/Text/File_Scte20.h100777 0 0 4046 12226004262 14646 0/* 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 SCTE 20 streams // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_Scte20H #define MediaInfo_Scte20H //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Scte20 //*************************************************************************** class File_Scte20 : public File__Analyze { public : //In int8u picture_structure; bool progressive_sequence; bool progressive_frame; bool top_field_first; bool repeat_first_field; //Constructor/Destructor File_Scte20(); ~File_Scte20(); private : //Streams management void Streams_Update(); void Streams_Update_PerStream(size_t Pos); void Streams_Finish(); //Synchro void Read_Buffer_Unsynched(); //Buffer - Global void Read_Buffer_Continue(); //Temp struct stream { File__Analyze* Parser; size_t StreamPos; bool IsFilled; stream() { Parser=NULL; StreamPos=(size_t)-1; IsFilled=false; } ~stream() { delete Parser; //Parser=NULL; } }; std::vector Streams; size_t Streams_Count; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Text/File_SubRip.cpp100777 0 0 16457 12226004262 15376 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_SUBRIP_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Text/File_SubRip.h" #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "MediaInfo/MediaInfo_Events_Internal.h" #endif //MEDIAINFO_EVENTS using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Utils //*************************************************************************** int64u SubRip_str2timecode(const char* Value) { size_t Length=strlen(Value); if (Length>=8 && Value[0]>='0' && Value[0]<='9' && Value[1]>='0' && Value[1]<='9' && Value[2]==':' && Value[3]>='0' && Value[3]<='9' && Value[4]>='0' && Value[4]<='9' && Value[5]==':' && Value[6]>='0' && Value[6]<='9' && Value[7]>='0' && Value[7]<='9') { int64u ToReturn=(int64u)(Value[0]-'0')*10*60*60*1000000000 +(int64u)(Value[1]-'0') *60*60*1000000000 +(int64u)(Value[3]-'0') *10*60*1000000000 +(int64u)(Value[4]-'0') *60*1000000000 +(int64u)(Value[6]-'0') *10*1000000000 +(int64u)(Value[7]-'0') *1000000000; if (Length>=9 && (Value[8]=='.' || Value[8]==',')) { if (Length>9+9) Length=9+9; //Nanoseconds max const char* Value_End=Value+Length; Value+=9; int64u Multiplier=100000000; while (Value=2 && Value[Length-1]=='s') { return (int64u)(atof(Value)*1000000000); } else return (int64u)-1; } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_SubRip::File_SubRip() :File__Analyze() { //Configuration #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_SubRip; StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS //Init Frame_Count=0; } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_SubRip::FileHeader_Begin() { if (!IsSub && (Buffer_Size65536?65536:Buffer_Size); if (Temp.empty()) { Temp.From_Local((const char*)Buffer, Buffer_Size>65536?65536:Buffer_Size); // Trying from local code page IsLocal=true; } Temp.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive); Temp.FindAndReplace(__T("\r"), __T("\n"), 0, Ztring_Recursive); List.Write(Temp); size_t IsOk=0; size_t IsNok=0; for (size_t Pos=0; Pos22 && List(Pos, 1)[2]==__T(':') && List(Pos, 1)[5]==__T(':') && List(Pos, 1).find(__T(" --> "))!=string::npos) IsOk++; else IsNok++; } if (!IsOk || IsNok>IsOk/2) { Reject(); return true; } if (!IsSub && File_Size!=(int64u)-1 && Buffer_Size!=File_Size) { Element_WaitForMoreData(); return false; } if (!Status[IsAccepted]) { Accept(); Fill(Stream_General, 0, General_Format, "SubRip"); Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, "Format", "SubRip"); Fill(Stream_Text, 0, "Codec", "SubRip"); } if (IsLocal) Temp.From_Local((const char*)Buffer, Buffer_Size); else Temp.From_UTF8((const char*)Buffer, Buffer_Size); Temp.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive); Temp.FindAndReplace(__T("\r"), __T("\n"), 0, Ztring_Recursive); List.Write(Temp); #if MEDIAINFO_DEMUX size_t Pos=0; for (;;) { if (Pos>=List.size()) break; if (List[Pos].size()>=3) { Ztring PTS_Begin_String=List[Pos][1].SubString(Ztring(), __T(" --> ")); Ztring PTS_End_String=List[Pos][1].SubString(__T(" --> "), Ztring()); item Item; Item.PTS_Begin=SubRip_str2timecode(PTS_Begin_String.To_UTF8().c_str()); Item.PTS_End=SubRip_str2timecode(PTS_End_String.To_UTF8().c_str()); for (size_t Pos2=2; Pos2 //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_SubRip //*************************************************************************** class File_SubRip : public File__Analyze { public : File_SubRip(); private : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK void Read_Buffer_Continue(); //Temp #if MEDIAINFO_DEMUX struct item { int64u PTS_Begin; int64u PTS_End; Ztring Content; }; std::vector Items; #endif //MEDIAINFO_DEMUX }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Text/File_Teletext.cpp100777 0 0 5555 12226004262 15745 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DVBSUBTITLE_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Text/File_Teletext.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Teletext::File_Teletext() :File__Analyze() { //Configuration ParserName=__T("Teletext"); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Teletext; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_TRACE Trace_Layers_Update(8); //Stream #endif //MEDIAINFO_TRACE PTS_DTS_Needed=true; IsRawStream=true; } //--------------------------------------------------------------------------- File_Teletext::~File_Teletext() { } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Teletext::Streams_Fill() { Stream_Prepare(Stream_Text); } //--------------------------------------------------------------------------- void File_Teletext::Streams_Finish() { } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Teletext::Read_Buffer_Continue() { Fill(); Finish(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_DVBSUBTITLE_YES MediaInfoLib/Source/MediaInfo/Text/File_Teletext.h100777 0 0 2502 12226004262 15377 0/* 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 Teletext streams // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_TeletextH #define MediaInfo_File_TeletextH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Teletext //*************************************************************************** class File_Teletext : public File__Analyze { public : File_Teletext(); ~File_Teletext(); private : //Streams management void Streams_Fill(); void Streams_Finish(); //Buffer - Global void Read_Buffer_Continue(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Text/File_TimedText.cpp100777 0 0 6730 12226004262 16052 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_TIMEDTEXT_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Text/File_TimedText.h" #include "tinyxml2.h" using namespace tinyxml2; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_TimedText::File_TimedText() { //Configuration ParserName=__T("Timed Text"); //Temp #ifdef MEDIAINFO_MPEG4_YES IsChapter=false; #endif //MEDIAINFO_MPEG4_YES } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_TimedText::Header_Parse() { //Parsing int16u Size; Get_B2 (Size, "Size"); //Filling Header_Fill_Code(0, "Block"); Header_Fill_Size(Element_Offset+Size); } //--------------------------------------------------------------------------- void File_TimedText::Data_Parse() { //Parsing Ztring Value; Get_UTF8 (Element_Size, Value, "Value"); FILLING_BEGIN(); if (!Status[IsAccepted]) { Accept(); #ifdef MEDIAINFO_MPEG4_YES if (IsChapter) { Stream_Prepare(Stream_Menu); } else #endif //MEDIAINFO_MPEG4_YES { Stream_Prepare(Stream_Text); } Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Format), "Timed Text"); } #ifdef MEDIAINFO_MPEG4_YES if (IsChapter) { } else #endif //MEDIAINFO_MPEG4_YES { Finish(); } #ifdef MEDIAINFO_MPEG4_YES if (IsChapter && FrameInfo.DTS!=(int64u)-1 && Buffer_Offset==2) Fill(Stream_Menu, 0, Ztring().Duration_From_Milliseconds(FrameInfo.DTS/1000000).To_UTF8().c_str(), Value); #endif //MEDIAINFO_MPEG4_YES FILLING_END(); Element_Offset=Buffer_Size-Buffer_Offset; //Buffer can also contain atoms after the text, ignoring them } } //NameSpace #endif //MEDIAINFO_TIMEDTEXT_YES MediaInfoLib/Source/MediaInfo/Text/File_TimedText.h100777 0 0 2565 12226004262 15521 0/* 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 Timed Text (MPEG-4 Part 17) // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_TimedTextH #define MediaInfo_File_TimedTextH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Sami //*************************************************************************** class File_TimedText : public File__Analyze { public: //Constructor/Destructor File_TimedText(); #ifdef MEDIAINFO_MPEG4_YES bool IsChapter; #endif //MEDIAINFO_MPEG4_YES private : //Buffer - Per element void Header_Parse(); void Data_Parse(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Text/File_Ttml.cpp100777 0 0 15714 12226004262 15105 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_TTML_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Text/File_Ttml.h" #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "MediaInfo/MediaInfo_Events_Internal.h" #endif //MEDIAINFO_EVENTS #include "tinyxml2.h" #include using namespace tinyxml2; using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Utils //*************************************************************************** int64u Ttml_str2timecode(const char* Value) { size_t Length=strlen(Value); if (Length>=8 && Value[0]>='0' && Value[0]<='9' && Value[1]>='0' && Value[1]<='9' && Value[2]==':' && Value[3]>='0' && Value[3]<='9' && Value[4]>='0' && Value[4]<='9' && Value[5]==':' && Value[6]>='0' && Value[6]<='9' && Value[7]>='0' && Value[7]<='9') { int64u ToReturn=(int64u)(Value[0]-'0')*10*60*60*1000000000 +(int64u)(Value[1]-'0') *60*60*1000000000 +(int64u)(Value[3]-'0') *10*60*1000000000 +(int64u)(Value[4]-'0') *60*1000000000 +(int64u)(Value[6]-'0') *10*1000000000 +(int64u)(Value[7]-'0') *1000000000; if (Length>=9 && (Value[8]=='.' || Value[8]==',')) { if (Length>9+9) Length=9+9; //Nanoseconds max const char* Value_End=Value+Length; Value+=9; int64u Multiplier=100000000; while (Value=2 && Value[Length-1]=='s') { return (int64u)(atof(Value)*1000000000); } else return (int64u)-1; } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Ttml::File_Ttml() :File__Analyze() { //Configuration #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Ttml; StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS //Init Frame_Count=0; //Temp document=NULL; div=NULL; p=NULL; } //--------------------------------------------------------------------------- File_Ttml::~File_Ttml() { delete document; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_SEEK size_t File_Ttml::Read_Buffer_Seek (size_t Method, int64u Value, int64u ID) { if (!div) return (size_t)-1; p=div->FirstChildElement(); Open_Buffer_Unsynch(); return 1; } #endif //MEDIAINFO_SEEK //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Ttml::FileHeader_Begin() { document=new tinyxml2::XMLDocument; if (!FileHeader_Begin_XML(*document)) return false; XMLElement* Root=document->FirstChildElement("tt"); if (!Root) { Reject(); return false; } Accept(); Fill(Stream_General, 0, General_Format, "TTML"); Stream_Prepare(Stream_Text); Fill(Stream_Text, 0, "Format", "TTML"); for (XMLElement* tt_element=Root->FirstChildElement(); tt_element; tt_element=tt_element->NextSiblingElement()) { //body if (!strcmp(tt_element->Value(), "body")) { for (XMLElement* body_element=tt_element->FirstChildElement(); body_element; body_element=body_element->NextSiblingElement()) { //div if (!strcmp(body_element->Value(), "div")) { for (XMLElement* div_element=body_element->FirstChildElement(); div_element; div_element=div_element->NextSiblingElement()) { //p if (!strcmp(div_element->Value(), "p")) { div=body_element; p=div_element; break; } } if (div) break; } } if (div) break; } } //All should be OK... return true; } //--------------------------------------------------------------------------- void File_Ttml::Read_Buffer_Continue() { #if MEDIAINFO_DEMUX Demux(Buffer, Buffer_Size, ContentType_MainStream); #endif //MEDIAINFO_DEMUX // Output #if MEDIAINFO_EVENTS for (; p; p=p->NextSiblingElement()) { //p if (!strcmp(p->Value(), "p")) { const char* Attribute; int64u DTS_Begin=(int64u)-1; Attribute=p->Attribute("begin"); if (Attribute) DTS_Begin=Ttml_str2timecode(Attribute); int64u DTS_End=(int64u)-1; Attribute=p->Attribute("end"); if (Attribute) DTS_End=Ttml_str2timecode(Attribute); Ztring Content; if (p->FirstChild()) Content.From_UTF8(p->FirstChild()->Value()); Frame_Count++; } } #endif MEDIAINFO_EVENTS Buffer_Offset=Buffer_Size; } } //NameSpace #endif //MEDIAINFO_TTML_YES MediaInfoLib/Source/MediaInfo/Text/File_Ttml.h100777 0 0 3112 12226004262 14517 0/* 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 TTML files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_TtmlH #define MediaInfo_File_TtmlH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- class tinyxml2::XMLDocument; class tinyxml2::XMLElement; namespace MediaInfoLib { //*************************************************************************** // Class File_Sami //*************************************************************************** class File_Ttml : public File__Analyze { public : File_Ttml(); ~File_Ttml(); private : //Buffer - File header bool FileHeader_Begin(); //Buffer - Global #if MEDIAINFO_SEEK size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); #endif //MEDIAINFO_SEEK void Read_Buffer_Continue(); //Temp tinyxml2::XMLDocument* document; tinyxml2::XMLElement* div; tinyxml2::XMLElement* p; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/TimeCode.cpp100777 0 0 14161 12226004262 13766 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/TimeCode.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- TimeCode::TimeCode () { Hours=(int8u)-1; Minutes=(int8u)-1; Seconds=(int8u)-1; Frames=(int8u)-1; FramesPerSecond=0; DropFrame=false; MustUseSecondField=false; IsSecondField=false; } //--------------------------------------------------------------------------- TimeCode::TimeCode (int8u Hours_, int8u Minutes_, int8u Seconds_, int8u Frames_, int8u FramesPerSecond_, bool DropFrame_, bool MustUseSecondField_, bool IsSecondField_) { Hours=Hours_; Minutes=Minutes_; Seconds=Seconds_; Frames=Frames_; FramesPerSecond=FramesPerSecond_; DropFrame=DropFrame_; MustUseSecondField=MustUseSecondField_; IsSecondField=IsSecondField_; } //--------------------------------------------------------------------------- TimeCode::TimeCode (int64u Frames_, int8u FramesPerSecond_, bool DropFrame_, bool MustUseSecondField_, bool IsSecondField_) { int8u Dropped=0; if (DropFrame_) { Dropped=2; if (FramesPerSecond_>30) Dropped+=2; if (FramesPerSecond_>60) Dropped+=2; if (FramesPerSecond_>90) Dropped+=2; if (FramesPerSecond_>120) Dropped+=2; } int64u Minutes_Tens = Frames_/(600*FramesPerSecond_-Dropped*9); //Count of 10 minutes int64u Minutes_Units = (Frames_-Minutes_Tens*(600*FramesPerSecond_-Dropped*9))/(60*FramesPerSecond_-Dropped); Frames_ += 9*Dropped*Minutes_Tens+Dropped*Minutes_Units; if (Minutes_Units && ((Frames_/FramesPerSecond_)%60)==0 && (Frames_%FramesPerSecond_)=FramesPerSecond) { Seconds++; Frames=0; if (Seconds>=60) { Seconds=0; Minutes++; if (DropFrame && Minutes%10) Frames=2; //frames 0 and 1 are dropped for every minutes except 00 10 20 30 40 50 if (Minutes>=60) { Minutes=0; Hours++; if (Hours>=24) { Hours=0; } } } } } //--------------------------------------------------------------------------- void TimeCode::MinusOne() { if (FramesPerSecond==0) return; if (MustUseSecondField && IsSecondField) IsSecondField=false; else { if (Frames==0 || (DropFrame && Minutes%10 && Frames<=2)) { Frames=FramesPerSecond; if (Seconds==0) { Seconds=60; if (Minutes==0) { Minutes=60; if (Hours==0) Hours=24; Hours--; } Minutes--; } Seconds--; } Frames--; if (MustUseSecondField) IsSecondField=true; } } //--------------------------------------------------------------------------- string TimeCode::ToString() { string TC; TC+=('0'+Hours/10); TC+=('0'+Hours%10); TC+=':'; TC+=('0'+Minutes/10); TC+=('0'+Minutes%10); TC+=':'; TC+=('0'+Seconds/10); TC+=('0'+Seconds%10); TC+=DropFrame?';':':'; TC+=('0'+Frames/10); TC+=('0'+Frames%10); return TC; } //--------------------------------------------------------------------------- int32u TimeCode::ToFrames() { if (!FramesPerSecond) return (int32u)-1; int32u TC=(Hours *3600 + Minutes * 60 + Seconds )*FramesPerSecond + Frames; if (DropFrame) { TC-= Hours *108 + (Minutes/10)*18 + (Minutes%10)*2; } return TC; } //*************************************************************************** // //*************************************************************************** } //NameSpace MediaInfoLib/Source/MediaInfo/TimeCode.h100777 0 0 5641 12226004261 13415 0/* 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. */ //--------------------------------------------------------------------------- #ifndef MediaInfo_TimeCodeH #define MediaInfo_TimeCodeH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Unknown //*************************************************************************** class TimeCode { public: //constructor/Destructor TimeCode (); TimeCode (int8u Hours, int8u Minutes, int8u Seconds, int8u Frames, int8u FramesPerSecond, bool DropFrame, bool MustUseSecondField=false, bool IsSecondField=false); TimeCode (int64u Frames, int8u FramesPerSecond, bool DropFrame, bool MustUseSecondField=false, bool IsSecondField_=false); //Operators TimeCode &operator ++() { PlusOne(); return *this; } TimeCode operator ++(int) { PlusOne(); return *this; } TimeCode &operator --() { MinusOne(); return *this; } TimeCode operator --(int) { MinusOne(); return *this; } bool operator== (const TimeCode &tc) const { return Hours ==tc.Hours && Minutes ==tc.Minutes && Seconds ==tc.Seconds && Frames ==tc.Frames && FramesPerSecond ==tc.FramesPerSecond && DropFrame ==tc.DropFrame && MustUseSecondField ==tc.MustUseSecondField && IsSecondField ==tc.IsSecondField; } bool operator!= (const TimeCode &tc) const { return Hours !=tc.Hours || Minutes !=tc.Minutes || Seconds !=tc.Seconds || Frames !=tc.Frames || FramesPerSecond !=tc.FramesPerSecond || DropFrame !=tc.DropFrame || MustUseSecondField !=tc.MustUseSecondField || IsSecondField !=tc.IsSecondField; } //Helpers bool IsValid() const { return FramesPerSecond?true:false; } void PlusOne(); void MinusOne(); string ToString(); int32u ToFrames(); public: int8u Hours; int8u Minutes; int8u Seconds; int8u Frames; int8u FramesPerSecond; bool DropFrame; bool MustUseSecondField; bool IsSecondField; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Video/ 40777 0 0 0 12255624201 12517 5MediaInfoLib/Source/MediaInfo/Video/File_AfdBarData.cpp100777 0 0 30571 12226004262 16216 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AFDBARDATA_YES) || defined(MEDIAINFO_MXF_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* AfdBarData_active_format[]= { //1st value is for 4:3, 2nd is for 16:9 "", //Undefined "Reserved", "Not recommended", "Not recommended", "Aspect ratio greater than 16:9", //Use GA94 "Reserved", "Reserved", "Reserved", "4:3 full frame image / 16:9 full frame image", "4:3 full frame image / 4:3 pillarbox image", "16:9 letterbox image / 16:9 full frame image", "14:9 letterbox image / 14:9 pillarbox image", "Reserved", "4:3 full frame image, alternative 14:9 center / 4:3 pillarbox image, alternative 14:9 center", "16:9 letterbox image, alternative 14:9 center / 16:9 full frame image, alternative 14:9 center", "16:9 letterbox image, alternative 4:3 center / 16:9 full frame image, alternative 4:3 center", }; //--------------------------------------------------------------------------- const char* AfdBarData_active_format_4_3[]= { "", //Undefined "Reserved", "Letterbox 16:9 image (top)", "Letterbox 14:9 image (top)", "Letterbox image with an aspect ratio greater than 16:9", "Reserved", "Reserved", "Reserved", "Full frame 4:3 image", "Full frame 4:3 image", "Letterbox 16:9 image", "Letterbox 14:9 image", "Reserved", "Full frame 4:3 image, with alternative 14:9 center", "Letterbox 16:9 image, with alternative 14:9 center", "Letterbox 16:9 image, with alternative 4:3 center", }; //--------------------------------------------------------------------------- const char* AfdBarData_active_format_16_9[]= { "", //Undefined "Reserved", "Letterbox 16:9 image (top)", "Pillarbox 14:9 image (top)", "Letterbox image with an aspect ratio greater than 16:9", "Reserved", "Reserved", "Reserved", "Full frame 16:9 image", "Pillarbox 4:3 image", "Letterbox 16:9 image", "Pillarbox 14:9 image", "Reserved", "Full frame 4:3 image, with alternative 14:9 center", "Letterbox 16:9 image, with alternative 14:9 center", "Letterbox 16:9 image, with alternative 4:3 center", }; //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //defined(MEDIAINFO_AFDBARDATA_YES) || defined(MEDIAINFO_MXF_YES) //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AFDBARDATA_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_AfdBarData.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* AfdBarData_aspect_ratio[]= { "4:3", "16:9", }; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_AfdBarData::File_AfdBarData() :File__Analyze() { //Configuration PTS_DTS_Needed=true; //In Format=Format_Unknown; aspect_ratio_FromContainer=(int8u)-1; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_AfdBarData::Streams_Fill() { //Filling Stream_Prepare(Stream_Video); if (active_format!=(int8u)-1) { Fill(Stream_Video, 0, Video_ActiveFormatDescription, Stream.active_format); if (aspect_ratio==(int8u)-1) aspect_ratio=aspect_ratio_FromContainer; if (aspect_ratio!=(int8u)-1) { Fill(Stream_Video, 0, Video_ActiveFormatDescription_String, Stream.aspect_ratio?AfdBarData_active_format_16_9[Stream.active_format]:AfdBarData_active_format_4_3[Stream.active_format]); switch (Format) { case Format_A53_4_DTG1 : Fill(Stream_Video, 0, Video_ActiveFormatDescription_MuxingMode, "A/53"); break; case Format_S2016_3 : Fill(Stream_Video, 0, Video_ActiveFormatDescription_MuxingMode, "SMPTE ST 2016-3"); break; default : Skip_XX(Element_Size, "Unknown"); return; } } } } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_AfdBarData::Read_Buffer_Continue() { //Default line_number_end_of_top_bar=(int16u)-1; line_number_start_of_bottom_bar=(int16u)-1; pixel_number_end_of_left_bar=(int16u)-1; pixel_number_start_of_right_bar=(int16u)-1; active_format=(int8u)-1; aspect_ratio=(int8u)-1; //Parsing switch (Format) { case Format_A53_4_DTG1 : afd_data(); break; case Format_A53_4_GA94_06 : bar_data(); break; case Format_S2016_3 : afd_data(); Skip_B1( "Reserved"); Skip_B1( "Reserved"); bar_data(); break; default : Skip_XX(Element_Size, "Unknown"); return; } FILLING_BEGIN(); //Filling Stream.line_number_end_of_top_bar=line_number_end_of_top_bar; Stream.line_number_start_of_bottom_bar=line_number_start_of_bottom_bar; Stream.pixel_number_end_of_left_bar=pixel_number_end_of_left_bar; Stream.pixel_number_start_of_right_bar=pixel_number_start_of_right_bar; Stream.active_format=active_format; Stream.aspect_ratio=aspect_ratio; if (!Status[IsAccepted]) { Accept("AfdBarData"); Fill("AfdBarData"); } if (MediaInfoLib::Config.ParseSpeed_Get()<1) Finish("AfdBarData"); FILLING_END(); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_AfdBarData::afd_data() { //Parsing Element_Begin1("Active Format Description"); BS_Begin(); if (Format==Format_S2016_3) { Mark_0_NoTrustError(); Get_S1 (4, active_format, "active_format"); Param_Info1(AfdBarData_active_format[active_format]); Get_S1 (1, aspect_ratio, "aspect_ratio"); Param_Info1(AfdBarData_aspect_ratio[aspect_ratio]); Mark_0_NoTrustError(); Mark_0_NoTrustError(); } else { bool active_format_flag; Mark_0(); Get_SB (active_format_flag, "active_format_flag"); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_1_NoTrustError(); if (active_format_flag) { Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Get_S1 (4, active_format, "active_format"); Param_Info1(AfdBarData_active_format[active_format]); } } BS_End(); Element_End0(); } //--------------------------------------------------------------------------- void File_AfdBarData::bar_data() { //Parsing Element_Begin1("bar_data"); bool top_bar_flag, bottom_bar_flag, left_bar_flag, right_bar_flag; BS_Begin(); Get_SB (top_bar_flag, "top_bar_flag"); Get_SB (bottom_bar_flag, "bottom_bar_flag"); Get_SB (left_bar_flag, "left_bar_flag"); Get_SB (right_bar_flag, "right_bar_flag"); if (Format==Format_S2016_3) { Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_0_NoTrustError(); } else { Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); } if (top_bar_flag) { Mark_1(); Mark_1(); Get_S2 (14, line_number_end_of_top_bar, "line_number_end_of_top_bar"); } if (bottom_bar_flag) { Mark_1(); Mark_1(); Get_S2 (14, line_number_start_of_bottom_bar, "line_number_start_of_bottom_bar"); } if (left_bar_flag) { Mark_1(); Mark_1(); Get_S2 (14, pixel_number_end_of_left_bar, "pixel_number_end_of_left_bar"); } if (right_bar_flag) { Mark_1(); Mark_1(); Get_S2 (14, pixel_number_start_of_right_bar, "pixel_number_start_of_right_bar"); } if (!top_bar_flag && !bottom_bar_flag && !left_bar_flag && !right_bar_flag) { Mark_1_NoTrustError(); Mark_1_NoTrustError(); Skip_S2(14, "reserved"); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Skip_S2(14, "reserved"); } BS_End(); Element_End0(); if (Format==Format_A53_4_DTG1) { BS_Begin(); Mark_1(); Mark_1(); Mark_1(); Mark_1(); Mark_1(); Mark_1(); Mark_1(); Mark_1(); BS_End(); if (Element_Size-Element_Offset) Skip_XX(Element_Size-Element_Offset, "additional_bar_data"); } } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_AFDBARDATA_YES MediaInfoLib/Source/MediaInfo/Video/File_AfdBarData.h100777 0 0 5112 12226004262 15634 0/* 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 AFD and Bar Data files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_AfdBarDataH #define MediaInfo_AfdBarDataH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_AfdBarData //*************************************************************************** class File_AfdBarData : public File__Analyze { public : //In enum format { Format_Unknown, Format_A53_4_DTG1, //Active Format Description Format_A53_4_GA94_06, //Bar Data Format_S2016_3, //Active Format Description & Bar Data }; format Format; int8u aspect_ratio_FromContainer; //May come from the containing parser //Constructor/Destructor File_AfdBarData(); private : //Streams management void Streams_Fill(); //Buffer - Global void Read_Buffer_Continue(); //Elements void afd_data(); void bar_data(); //Sream struct stream { int16u line_number_end_of_top_bar; int16u line_number_start_of_bottom_bar; int16u pixel_number_end_of_left_bar; int16u pixel_number_start_of_right_bar; int8u active_format; int8u aspect_ratio; stream() { line_number_end_of_top_bar=(int16u)-1; line_number_start_of_bottom_bar=(int16u)-1; pixel_number_end_of_left_bar=(int16u)-1; pixel_number_start_of_right_bar=(int16u)-1; active_format=(int8u)-1; aspect_ratio=(int8u)-1; } }; stream Stream; //Temp int16u line_number_end_of_top_bar; int16u line_number_start_of_bottom_bar; int16u pixel_number_end_of_left_bar; int16u pixel_number_start_of_right_bar; int8u active_format; int8u aspect_ratio; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Video/File_Aic.cpp100777 0 0 10216 12226004262 14773 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AIC_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_Aic.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Aic::Streams_Fill() { //Filling Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "AIC"); Fill(Stream_Video, 0, Video_Width, Width); Fill(Stream_Video, 0, Video_Height, Height); Fill(Stream_Video, 0, Video_BitDepth, 8); //Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); //Fill(Stream_Video, 0, Video_ChromaSubsampling, "4:2:0"); switch (FieldFrame) { case 0 : Fill(Stream_Video, 0, Video_ScanType, "Progressive"); break; case 3 : Fill(Stream_Video, 0, Video_ScanType, "Interlaced"); break; default: ; } } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Aic::Header_Parse() { //Parsing int32u Size; int16u Sync; Get_B2 (Sync, "Sync"); Get_B4 (Size, "Size"); if (Sync!=0x0116 || Size<24 || Size!=Buffer_Size) { Reject("AIC"); return; } Get_B2 (Width, "Width"); Get_B2 (Height, "Height"); Skip_B2( "Width again?"); Skip_B2( "Height again?"); Skip_B2( "Unknown"); BS_Begin(); Get_S1 (4, FieldFrame, "field/Frame info?"); Skip_S1(4, "Unknown"); Skip_S1(4, "Unknown"); Skip_S1(4, "Unknown"); BS_End(); Skip_B3( "Unknown"); Skip_B3( "Unknown"); Header_Fill_Code(0, "Frame"); Header_Fill_Size(Size); } //--------------------------------------------------------------------------- void File_Aic::Data_Parse() { //Parsing Skip_XX(Element_Size, "Data"); FILLING_BEGIN(); Frame_Count++; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; if (!Status[IsFilled]) { Accept("AIC"); Finish("AIC"); } FILLING_END(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_AIC_* MediaInfoLib/Source/MediaInfo/Video/File_Aic.h100777 0 0 2511 12226004262 14417 0/* 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 Apple Intermediate Codec video streams // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_AicH #define MediaInfo_AicH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Aic //*************************************************************************** class File_Aic : public File__Analyze { private : //Streams management void Streams_Fill(); //Buffer - Per element void Header_Parse (); void Data_Parse (); //Temp int16u Width; int16u Height; int8u FieldFrame; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Video/File_Avc.cpp100777 0 0 520620 12253632471 15046 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //*************************************************************************** // Constants //*************************************************************************** //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AVC_YES) || defined(MEDIAINFO_MPEGPS_YES) || defined(MEDIAINFO_MPEGTS_YES) //--------------------------------------------------------------------------- namespace MediaInfoLib { #include "ZenLib/Conf.h" using namespace ZenLib; //--------------------------------------------------------------------------- const char* Avc_profile_idc(int8u profile_idc) { switch (profile_idc) { case 44 : return "CAVLC 4:4:4 Intra"; case 66 : return "Baseline"; case 77 : return "Main"; case 83 : return "Scalable Baseline"; case 86 : return "Scalable High"; case 88 : return "Extended"; case 100 : return "High"; case 110 : return "High 10"; case 118 : return "Multiview High"; case 122 : return "High 4:2:2"; case 128 : return "Stereo High"; case 144 : return "High 4:4:4"; case 244 : return "High 4:4:4 Predictive"; default : return "Unknown"; } } //--------------------------------------------------------------------------- } //NameSpace //--------------------------------------------------------------------------- #endif //... //--------------------------------------------------------------------------- //*************************************************************************** // //*************************************************************************** //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AVC_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_Avc.h" #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) #include "MediaInfo/Text/File_DtvccTransport.h" #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "MediaInfo/MediaInfo_Events.h" #include "MediaInfo/MediaInfo_Events_Internal.h" #endif //MEDIAINFO_EVENTS #include #include #include using namespace std; using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const size_t Avc_Errors_MaxCount=32; //--------------------------------------------------------------------------- extern const int8u Avc_PixelAspectRatio_Size=17; extern const float32 Avc_PixelAspectRatio[]= { (float32)1, //Reserved (float32)1, (float32)12/(float32)11, (float32)10/(float32)11, (float32)16/(float32)11, (float32)40/(float32)33, (float32)24/(float32)11, (float32)20/(float32)11, (float32)32/(float32)11, (float32)80/(float32)33, (float32)18/(float32)11, (float32)15/(float32)11, (float32)64/(float32)33, (float32)160/(float32)99, (float32)4/(float32)3, (float32)3/(float32)2, (float32)2, }; //--------------------------------------------------------------------------- extern const char* Avc_video_format[]= { "Component", "PAL", "NTSC", "SECAM", "MAC", "", "Reserved", "Reserved", }; //--------------------------------------------------------------------------- const char* Avc_primary_pic_type[]= { "I", "I, P", "I, P, B", "SI", "SI, SP", "I, SI", "I, SI, P, SP", "I, SI, P, SP, B", }; //--------------------------------------------------------------------------- const char* Avc_slice_type[]= { "P", "B", "I", "SP", "SI", "P", "B", "I", "SP", "SI", }; //--------------------------------------------------------------------------- const int8u Avc_pic_struct_Size=9; const char* Avc_pic_struct[]= { "frame", "top field", "bottom field", "top field, bottom field", "bottom field, top field", "top field, bottom field, top field repeated", "bottom field, top field, bottom field repeated", "frame doubling", "frame tripling", }; //--------------------------------------------------------------------------- const int8u Avc_NumClockTS[]= { 1, 1, 1, 2, 2, 3, 3, 2, 3, }; //--------------------------------------------------------------------------- const char* Avc_ct_type[]= { "Progressive", "Interlaced", "Unknown", "Reserved", }; //--------------------------------------------------------------------------- const char* Avc_Colorimetry_format_idc[]= { "monochrome", "4:2:0", "4:2:2", "4:4:4", }; //--------------------------------------------------------------------------- const int8u Avc_SubWidthC[]= { 1, 2, 2, 1, }; //--------------------------------------------------------------------------- const int8u Avc_SubHeightC[]= { 1, 2, 1, 1, }; //--------------------------------------------------------------------------- const char* Avc_user_data_DTG1_active_format[]= { //1st value is for 4:3, 2nd is for 16:9 "", //Undefined "Reserved", "Not recommended", "Not recommended", "Aspect ratio greater than 16:9", //Use GA94 "Reserved", "Reserved", "Reserved", "4:3 full frame image / 16:9 full frame image", "4:3 full frame image / 4:3 pillarbox image", "16:9 letterbox image / 16:9 full frame image", "14:9 letterbox image / 14:9 pillarbox image", "Reserved", "4:3 full frame image, alternative 14:9 center / 4:3 pillarbox image, alternative 14:9 center", "16:9 letterbox image, alternative 14:9 center / 16:9 full frame image, alternative 14:9 center", "16:9 letterbox image, alternative 4:3 center / 16:9 full frame image, alternative 4:3 center", }; //--------------------------------------------------------------------------- const char* Mpegv_colour_primaries(int8u colour_primaries); const char* Mpegv_transfer_characteristics(int8u transfer_characteristics); const char* Mpegv_matrix_coefficients(int8u matrix_coefficients); //--------------------------------------------------------------------------- const char* Avc_user_data_GA94_cc_type(int8u cc_type) { switch (cc_type) { case 0 : return "CEA-608 line 21 field 1 closed captions"; //closed caption 3 if this is second field case 1 : return "CEA-608 line 21 field 2 closed captions"; //closed caption 4 if this is second field case 2 : return "DTVCC Channel Packet Data"; case 3 : return "DTVCC Channel Packet Start"; default : return ""; } } //--------------------------------------------------------------------------- int32u Avc_MaxDpbMbs(int8u level) { switch (level) { case 10 : return 1485; case 11 : return 3000; case 12 : return 6000; case 13 : case 20 : return 11880; case 21 : return 19800; case 22 : return 20250; case 30 : return 40500; case 31 : return 108000; case 32 : return 216000; case 40 : case 41 : return 245760; case 42 : return 522240; case 50 : return 589824; case 51 : return 983040; default : return 0; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Avc::File_Avc() #if MEDIAINFO_DUPLICATE :File__Duplicate() #endif //MEDIAINFO_DUPLICATE { //Config #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Avc; StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_TRACE Trace_Layers_Update(8); //Stream #endif //MEDIAINFO_TRACE MustSynchronize=true; Buffer_TotalBytes_FirstSynched_Max=64*1024; PTS_DTS_Needed=true; IsRawStream=true; Frame_Count_NotParsedIncluded=0; //In Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.3?512:2; FrameIsAlwaysComplete=false; MustParse_SPS_PPS=false; SizedBlocks=false; //Temporal references TemporalReferences_DelayedElement=NULL; //Text #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) GA94_03_Parser=NULL; #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) } //--------------------------------------------------------------------------- File_Avc::~File_Avc() { for (size_t Pos=0; Pos::iterator seq_parameter_set_Item=seq_parameter_sets.begin(); seq_parameter_set_Item!=seq_parameter_sets.end(); ++seq_parameter_set_Item) if ((*seq_parameter_set_Item)) Streams_Fill(seq_parameter_set_Item); for (std::vector::iterator subset_seq_parameter_set_Item=subset_seq_parameter_sets.begin(); subset_seq_parameter_set_Item!=subset_seq_parameter_sets.end(); ++subset_seq_parameter_set_Item) if ((*subset_seq_parameter_set_Item)) { if (seq_parameter_sets.empty()) Streams_Fill(subset_seq_parameter_set_Item); else Streams_Fill_subset(subset_seq_parameter_set_Item); Fill(Stream_Video, 0, Video_MultiView_Count, (*subset_seq_parameter_set_Item)->num_views_minus1+1); } } //--------------------------------------------------------------------------- void File_Avc::Streams_Fill(std::vector::iterator seq_parameter_set_Item) { //Calculating - Pixels int32u Width =((*seq_parameter_set_Item)->pic_width_in_mbs_minus1 +1)*16; int32u Height=((*seq_parameter_set_Item)->pic_height_in_map_units_minus1+1)*16*(2-(*seq_parameter_set_Item)->frame_mbs_only_flag); int32u CropUnitX=Avc_SubWidthC [(*seq_parameter_set_Item)->ChromaArrayType()]; int32u CropUnitY=Avc_SubHeightC[(*seq_parameter_set_Item)->ChromaArrayType()]*(2-(*seq_parameter_set_Item)->frame_mbs_only_flag); Width -=((*seq_parameter_set_Item)->frame_crop_left_offset+(*seq_parameter_set_Item)->frame_crop_right_offset )*CropUnitX; Height-=((*seq_parameter_set_Item)->frame_crop_top_offset +(*seq_parameter_set_Item)->frame_crop_bottom_offset)*CropUnitY; //From vui_parameters float64 PixelAspectRatio=1; if ((*seq_parameter_set_Item)->vui_parameters) { if ((*seq_parameter_set_Item)->vui_parameters->aspect_ratio_info_present_flag) { if ((*seq_parameter_set_Item)->vui_parameters->aspect_ratio_idcvui_parameters->aspect_ratio_idc]; else if ((*seq_parameter_set_Item)->vui_parameters->aspect_ratio_idc==0xFF && (*seq_parameter_set_Item)->vui_parameters->sar_height) PixelAspectRatio=((float64)(*seq_parameter_set_Item)->vui_parameters->sar_width)/(*seq_parameter_set_Item)->vui_parameters->sar_height; } if ((*seq_parameter_set_Item)->vui_parameters->timing_info_present_flag) { if (!(*seq_parameter_set_Item)->vui_parameters->fixed_frame_rate_flag) Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Mode, "VFR"); else if ((*seq_parameter_set_Item)->vui_parameters->timing_info_present_flag && (*seq_parameter_set_Item)->vui_parameters->time_scale && (*seq_parameter_set_Item)->vui_parameters->num_units_in_tick) Fill(Stream_Video, StreamPos_Last, Video_FrameRate, (float64)(*seq_parameter_set_Item)->vui_parameters->time_scale/(*seq_parameter_set_Item)->vui_parameters->num_units_in_tick/((*seq_parameter_set_Item)->frame_mbs_only_flag?2:((*seq_parameter_set_Item)->pic_order_cnt_type==2?1:2))/FrameRate_Divider); } //Colour description if ((*seq_parameter_set_Item)->vui_parameters->video_signal_type_present_flag) { Fill(Stream_Video, 0, Video_Standard, Avc_video_format[(*seq_parameter_set_Item)->vui_parameters->video_format]); if ((*seq_parameter_set_Item)->vui_parameters->colour_description_present_flag) { Fill(Stream_Video, 0, Video_colour_description_present, "Yes"); Fill(Stream_Video, 0, Video_colour_primaries, Mpegv_colour_primaries((*seq_parameter_set_Item)->vui_parameters->colour_primaries)); Fill(Stream_Video, 0, Video_transfer_characteristics, Mpegv_transfer_characteristics((*seq_parameter_set_Item)->vui_parameters->transfer_characteristics)); Fill(Stream_Video, 0, Video_matrix_coefficients, Mpegv_matrix_coefficients((*seq_parameter_set_Item)->vui_parameters->matrix_coefficients)); } } //hrd_parameter_sets int32u bit_rate_value=(int32u)-1; bool bit_rate_value_IsValid=true; bool cbr_flag=false; bool cbr_flag_IsSet=false; bool cbr_flag_IsValid=true; seq_parameter_set_struct::vui_parameters_struct::xxl* NAL=(*seq_parameter_set_Item)->vui_parameters->NAL; if (NAL) for (size_t Pos=0; PosSchedSel.size(); Pos++) { if (NAL->SchedSel[Pos].cpb_size_value!=(int32u)-1) Fill(Stream_Video, 0, Video_BufferSize, NAL->SchedSel[Pos].cpb_size_value); if (bit_rate_value!=(int32u)-1 && bit_rate_value!=NAL->SchedSel[Pos].bit_rate_value) bit_rate_value_IsValid=false; if (bit_rate_value==(int32u)-1) bit_rate_value=NAL->SchedSel[Pos].bit_rate_value; if (cbr_flag_IsSet==true && cbr_flag!=NAL->SchedSel[Pos].cbr_flag) cbr_flag_IsValid=false; if (cbr_flag_IsSet==0) { cbr_flag=NAL->SchedSel[Pos].cbr_flag; cbr_flag_IsSet=true; } } seq_parameter_set_struct::vui_parameters_struct::xxl* VCL=(*seq_parameter_set_Item)->vui_parameters->VCL; if (VCL) for (size_t Pos=0; PosSchedSel.size(); Pos++) { Fill(Stream_Video, 0, Video_BufferSize, VCL->SchedSel[Pos].cpb_size_value); if (bit_rate_value!=(int32u)-1 && bit_rate_value!=VCL->SchedSel[Pos].bit_rate_value) bit_rate_value_IsValid=false; if (bit_rate_value==(int32u)-1) bit_rate_value=VCL->SchedSel[Pos].bit_rate_value; if (cbr_flag_IsSet==true && cbr_flag!=VCL->SchedSel[Pos].cbr_flag) cbr_flag_IsValid=false; if (cbr_flag_IsSet==0) { cbr_flag=VCL->SchedSel[Pos].cbr_flag; cbr_flag_IsSet=true; } } if (cbr_flag_IsSet && cbr_flag_IsValid) { Fill(Stream_Video, 0, Video_BitRate_Mode, cbr_flag?"CBR":"VBR"); if (bit_rate_value!=(int32u)-1 && bit_rate_value_IsValid) Fill(Stream_Video, 0, cbr_flag?Video_BitRate_Nominal:Video_BitRate_Maximum, bit_rate_value); } } if (Count_Get(Stream_Video)==0) Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "AVC"); Fill(Stream_Video, 0, Video_Codec, "AVC"); Ztring Profile=Ztring().From_Local(Avc_profile_idc((*seq_parameter_set_Item)->profile_idc))+__T("@L")+Ztring().From_Number(((float)(*seq_parameter_set_Item)->level_idc)/10, 1); Fill(Stream_Video, 0, Video_Format_Profile, Profile); Fill(Stream_Video, 0, Video_Codec_Profile, Profile); Fill(Stream_Video, StreamPos_Last, Video_Width, Width); Fill(Stream_Video, StreamPos_Last, Video_Height, Height); Fill(Stream_Video, 0, Video_PixelAspectRatio, PixelAspectRatio, 3, true); Fill(Stream_Video, 0, Video_DisplayAspectRatio, Width*PixelAspectRatio/Height, 3, true); //More precise if (FrameRate_Divider==2) { Fill(Stream_Video, StreamPos_Last, Video_Format_Settings_FrameMode, "Frame doubling"); Fill(Stream_Video, StreamPos_Last, Video_Format_Settings, "Frame doubling"); } if (FrameRate_Divider==3) { Fill(Stream_Video, StreamPos_Last, Video_Format_Settings_FrameMode, "Frame tripling"); Fill(Stream_Video, StreamPos_Last, Video_Format_Settings, "Frame tripling"); } //Interlacement if ((*seq_parameter_set_Item)->mb_adaptive_frame_field_flag && Structure_Frame>0) //Interlaced macro-block { Fill(Stream_Video, 0, Video_ScanType, "MBAFF"); Fill(Stream_Video, 0, Video_Interlacement, "MBAFF"); } else if ((*seq_parameter_set_Item)->frame_mbs_only_flag || (Structure_Frame>0 && Structure_Field==0)) //No interlaced frame { Fill(Stream_Video, 0, Video_ScanType, "Progressive"); Fill(Stream_Video, 0, Video_Interlacement, "PPF"); } else if (Structure_Field>0) { Fill(Stream_Video, 0, Video_ScanType, "Interlaced"); Fill(Stream_Video, 0, Video_Interlacement, "Interlaced"); } std::string ScanOrders, PictureTypes(PictureTypes_PreviousFrames); ScanOrders.reserve(TemporalReferences.size()); for (size_t Pos=0; PosIsTop?'T':'B'; if ((Pos%2)==0) PictureTypes+=Avc_slice_type[TemporalReferences[Pos]->slice_type]; } else if (!PictureTypes.empty()) //Only if stream already started { ScanOrders+=' '; if ((Pos%2)==0) PictureTypes+=' '; } Fill(Stream_Video, 0, Video_ScanOrder, ScanOrder_Detect(ScanOrders)); { //Legacy string Result=ScanOrder_Detect(ScanOrders); if (!Result.empty()) Fill(Stream_Video, 0, Video_Interlacement, Result, true, true); } Fill(Stream_Video, 0, Video_Format_Settings_GOP, GOP_Detect(PictureTypes)); Fill(Stream_Video, 0, Video_Encoded_Library, Encoded_Library); Fill(Stream_Video, 0, Video_Encoded_Library_Name, Encoded_Library_Name); Fill(Stream_Video, 0, Video_Encoded_Library_Version, Encoded_Library_Version); Fill(Stream_Video, 0, Video_Encoded_Library_Settings, Encoded_Library_Settings); Fill(Stream_Video, 0, Video_BitRate_Nominal, BitRate_Nominal); Fill(Stream_Video, 0, Video_MuxingMode, MuxingMode); for (std::vector::iterator pic_parameter_set_Item=pic_parameter_sets.begin(); pic_parameter_set_Item!=pic_parameter_sets.end(); ++pic_parameter_set_Item) if (*pic_parameter_set_Item && (*pic_parameter_set_Item)->seq_parameter_set_id==seq_parameter_set_Item-(seq_parameter_sets.empty()?subset_seq_parameter_sets.begin():seq_parameter_sets.begin())) { if ((*pic_parameter_set_Item)->entropy_coding_mode_flag) { Fill(Stream_Video, 0, Video_Format_Settings, "CABAC"); Fill(Stream_Video, 0, Video_Format_Settings_CABAC, "Yes"); Fill(Stream_Video, 0, Video_Codec_Settings, "CABAC"); Fill(Stream_Video, 0, Video_Codec_Settings_CABAC, "Yes"); } else { Fill(Stream_Video, 0, Video_Format_Settings_CABAC, "No"); Fill(Stream_Video, 0, Video_Codec_Settings_CABAC, "No"); } break; //TODO: currently, testing only the first pic_parameter_set } if ((*seq_parameter_set_Item)->max_num_ref_frames>0) { Fill(Stream_Video, 0, Video_Format_Settings, Ztring::ToZtring((*seq_parameter_set_Item)->max_num_ref_frames)+__T(" Ref Frames")); Fill(Stream_Video, 0, Video_Codec_Settings, Ztring::ToZtring((*seq_parameter_set_Item)->max_num_ref_frames)+__T(" Ref Frames")); Fill(Stream_Video, 0, Video_Format_Settings_RefFrames, (*seq_parameter_set_Item)->max_num_ref_frames); Fill(Stream_Video, 0, Video_Codec_Settings_RefFrames, (*seq_parameter_set_Item)->max_num_ref_frames); } Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_Colorimetry, Avc_Colorimetry_format_idc[(*seq_parameter_set_Item)->chroma_format_idc]); if ((*seq_parameter_set_Item)->bit_depth_luma_minus8==(*seq_parameter_set_Item)->bit_depth_chroma_minus8) Fill(Stream_Video, 0, Video_BitDepth, (*seq_parameter_set_Item)->bit_depth_luma_minus8+8); } //--------------------------------------------------------------------------- void File_Avc::Streams_Fill_subset(const std::vector::iterator seq_parameter_set_Item) { Ztring Profile=Ztring().From_Local(Avc_profile_idc((*seq_parameter_set_Item)->profile_idc))+__T("@L")+Ztring().From_Number(((float)(*seq_parameter_set_Item)->level_idc)/10, 1); Ztring Profile_Base=Retrieve(Stream_Video, 0, Video_Format_Profile); Fill(Stream_Video, 0, Video_Format_Profile, Profile, true); if (!Profile_Base.empty()) Fill(Stream_Video, 0, Video_Format_Profile, Profile_Base); } //--------------------------------------------------------------------------- void File_Avc::Streams_Finish() { if (PTS_End!=(int64u)-1 && (IsSub || File_Offset+Buffer_Offset+Element_Size==File_Size)) { if (PTS_End>PTS_Begin) Fill(Stream_Video, 0, Video_Duration, float64_int64s(((float64)(PTS_End-PTS_Begin))/1000000)); } //GA94 captions #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) if (GA94_03_Parser && GA94_03_Parser->Status[IsAccepted]) { Finish(GA94_03_Parser); Merge(*GA94_03_Parser); Ztring LawRating=GA94_03_Parser->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); for (size_t Pos=0; Posvui_parameters && (*seq_parameter_sets.begin())->vui_parameters->timing_info_present_flag && (*seq_parameter_sets.begin())->vui_parameters->fixed_frame_rate_flag) Ibi_Stream_Finish((*seq_parameter_sets.begin())->vui_parameters->time_scale, (*seq_parameter_sets.begin())->vui_parameters->num_units_in_tick); #endif //MEDIAINFO_IBI } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Avc::FileHeader_Begin() { if (!File__Analyze::FileHeader_Begin_0x000001()) return false; if (!MustSynchronize) { Synched_Init(); Buffer_TotalBytes_FirstSynched=0; File_Offset_FirstSynched=File_Offset; } //All should be OK return true; } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Avc::Synchronize() { //Synchronizing size_t Buffer_Offset_Min=Buffer_Offset; while(Buffer_Offset+4<=Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x01)) { Buffer_Offset+=2; while(Buffer_Offset=Buffer_Size || Buffer[Buffer_Offset-1]==0x00) Buffer_Offset--; } if (Buffer_Offset>Buffer_Offset_Min && Buffer[Buffer_Offset-1]==0x00) Buffer_Offset--; //Parsing last bytes if needed if (Buffer_Offset+4==Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x00 || Buffer[Buffer_Offset+3]!=0x01)) Buffer_Offset++; if (Buffer_Offset+3==Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x01)) Buffer_Offset++; if (Buffer_Offset+2==Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00)) Buffer_Offset++; if (Buffer_Offset+1==Buffer_Size && Buffer[Buffer_Offset ]!=0x00) Buffer_Offset++; if (Buffer_Offset+4>Buffer_Size) return false; //Synched is OK Synched=true; return true; } //--------------------------------------------------------------------------- bool File_Avc::Synched_Test() { //Must have enough buffer for having header if (Buffer_Offset+6>Buffer_Size) return false; //Quick test of synchro if (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || (Buffer[Buffer_Offset+2]!=0x01 && (Buffer[Buffer_Offset+2]!=0x00 || Buffer[Buffer_Offset+3]!=0x01))) { Synched=false; return true; } //Quick search if (!Header_Parser_QuickSearch()) return false; #if MEDIAINFO_IBI bool zero_byte=Buffer[Buffer_Offset+2]==0x00; bool RandomAccess=(Buffer[Buffer_Offset+(zero_byte?4:3)]&0x1F)==0x07 || ((Buffer[Buffer_Offset+(zero_byte?4:3)]&0x1F)==0x09 && ((Buffer[Buffer_Offset+(zero_byte?5:4)]&0xE0)==0x00 || (Buffer[Buffer_Offset+(zero_byte?5:4)]&0xE0)==0xA0)); //seq_parameter_set or access_unit_delimiter with value=0 or 5 (3 bits) if (RandomAccess) Ibi_Add(); #endif //MEDIAINFO_IBI //We continue return true; } //*************************************************************************** // Buffer - Demux //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX bool File_Avc::Demux_UnpacketizeContainer_Test() { const int8u* Buffer_Temp=NULL; size_t Buffer_Temp_Size=0; bool RandomAccess=true; //Default, in case of problem if ((MustParse_SPS_PPS || SizedBlocks) && Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10) { if (MustParse_SPS_PPS) return true; //Wait for SPS and PPS //Random access check RandomAccess=false; //Computing final size size_t TranscodedBuffer_Size=0; while (Buffer_Offset+SizeOfNALU_Minus1+1+1<=Buffer_Size) { size_t Size; switch (SizeOfNALU_Minus1) { case 0: Size=Buffer[Buffer_Offset]; TranscodedBuffer_Size+=2; break; case 1: Size=BigEndian2int16u(Buffer+Buffer_Offset); TranscodedBuffer_Size++; break; case 2: Size=BigEndian2int24u(Buffer+Buffer_Offset); break; case 3: Size=BigEndian2int32u(Buffer+Buffer_Offset); TranscodedBuffer_Size--; break; default: return true; //Problem } Size+=SizeOfNALU_Minus1+1; //Coherency checking if (Size==0 || Buffer_Offset+Size>Buffer_Size || (Buffer_Offset+Size!=Buffer_Size && Buffer_Offset+Size+SizeOfNALU_Minus1+1>Buffer_Size)) Size=Buffer_Size-Buffer_Offset; //Random access check if (!RandomAccess && Buffer_Offset+SizeOfNALU_Minus1+1Iso14496_10_Buffer_Size; for (seq_parameter_set_structs::iterator Data_Item=subset_seq_parameter_sets.begin(); Data_Item!=subset_seq_parameter_sets.end(); ++Data_Item) TranscodedBuffer_Size+=(*Data_Item)->Iso14496_10_Buffer_Size; for (pic_parameter_set_structs::iterator Data_Item=pic_parameter_sets.begin(); Data_Item!=pic_parameter_sets.end(); ++Data_Item) TranscodedBuffer_Size+=(*Data_Item)->Iso14496_10_Buffer_Size; } //Copying int8u* TranscodedBuffer=new int8u[TranscodedBuffer_Size+100]; size_t TranscodedBuffer_Pos=0; if (RandomAccess) { for (seq_parameter_set_structs::iterator Data_Item=seq_parameter_sets.begin(); Data_Item!=seq_parameter_sets.end(); ++Data_Item) { std::memcpy(TranscodedBuffer+TranscodedBuffer_Pos, (*Data_Item)->Iso14496_10_Buffer, (*Data_Item)->Iso14496_10_Buffer_Size); TranscodedBuffer_Pos+=(*Data_Item)->Iso14496_10_Buffer_Size; } for (seq_parameter_set_structs::iterator Data_Item=subset_seq_parameter_sets.begin(); Data_Item!=subset_seq_parameter_sets.end(); ++Data_Item) { std::memcpy(TranscodedBuffer+TranscodedBuffer_Pos, (*Data_Item)->Iso14496_10_Buffer, (*Data_Item)->Iso14496_10_Buffer_Size); TranscodedBuffer_Pos+=(*Data_Item)->Iso14496_10_Buffer_Size; } for (pic_parameter_set_structs::iterator Data_Item=pic_parameter_sets.begin(); Data_Item!=pic_parameter_sets.end(); ++Data_Item) { std::memcpy(TranscodedBuffer+TranscodedBuffer_Pos, (*Data_Item)->Iso14496_10_Buffer, (*Data_Item)->Iso14496_10_Buffer_Size); TranscodedBuffer_Pos+=(*Data_Item)->Iso14496_10_Buffer_Size; } } while (Buffer_OffsetBuffer_Size || (Buffer_Offset+Size!=Buffer_Size && Buffer_Offset+Size+SizeOfNALU_Minus1+1>Buffer_Size)) Size=Buffer_Size-Buffer_Offset; std::memcpy(TranscodedBuffer+TranscodedBuffer_Pos, Buffer+Buffer_Offset, Size); TranscodedBuffer_Pos+=Size; Buffer_Offset+=Size; } Buffer_Offset=0; Buffer_Temp=Buffer; Buffer=TranscodedBuffer; Buffer_Temp_Size=Buffer_Size; Buffer_Size=TranscodedBuffer_Size; Demux_Offset=Buffer_Size; } else { bool zero_byte=Buffer[Buffer_Offset+2]==0x00; if (!(((Buffer[Buffer_Offset+(zero_byte?4:3)]&0x1B)==0x01 && (Buffer[Buffer_Offset+(zero_byte?5:4)]&0x80)!=0x80) || (Buffer[Buffer_Offset+(zero_byte?4:3)]&0x1F)==0x0C)) { if (Demux_Offset==0) { Demux_Offset=Buffer_Offset; Demux_IntermediateItemFound=false; } while (Demux_Offset+6<=Buffer_Size) { //Synchronizing while(Demux_Offset+6<=Buffer_Size && (Buffer[Demux_Offset ]!=0x00 || Buffer[Demux_Offset+1]!=0x00 || Buffer[Demux_Offset+2]!=0x01)) { Demux_Offset+=2; while(Demux_Offset=Buffer_Size || Buffer[Demux_Offset-1]==0x00) Demux_Offset--; } if (Demux_Offset+6>Buffer_Size) { if (File_Offset+Buffer_Size==File_Size) Demux_Offset=Buffer_Size; break; } zero_byte=Buffer[Demux_Offset+2]==0x00; if (Demux_IntermediateItemFound) { if (!(((Buffer[Demux_Offset+(zero_byte?4:3)]&0x1B)==0x01 && (Buffer[Demux_Offset+(zero_byte?5:4)]&0x80)!=0x80) || (Buffer[Demux_Offset+(zero_byte?4:3)]&0x1F)==0x0C)) break; } else { if ((Buffer[Demux_Offset+(zero_byte?4:3)]&0x1B)==0x01 && (Buffer[Demux_Offset+(zero_byte?5:4)]&0x80)==0x80) Demux_IntermediateItemFound=true; } Demux_Offset++; } if (Demux_Offset+6>Buffer_Size && !FrameIsAlwaysComplete && File_Offset+Buffer_SizeDemux_EventWasSent) return false; } if (IFrame_Count || RandomAccess) { bool Frame_Count_NotParsedIncluded_PlusOne=false; int64u PTS_Temp=FrameInfo.PTS; if (!IsSub) FrameInfo.PTS=(int64u)-1; if (Frame_Count_NotParsedIncluded!=(int64u)-1 && Interlaced_Top!=Interlaced_Bottom) { Frame_Count_NotParsedIncluded--; Frame_Count_NotParsedIncluded_PlusOne=true; } Demux_UnpacketizeContainer_Demux(RandomAccess); if (!IsSub) FrameInfo.PTS=PTS_Temp; if (Frame_Count_NotParsedIncluded_PlusOne) Frame_Count_NotParsedIncluded++; } else Demux_UnpacketizeContainer_Demux_Clear(); if (Buffer_Temp) { Demux_TotalBytes-=Buffer_Size; Demux_TotalBytes+=Buffer_Temp_Size; delete[] Buffer; Buffer=Buffer_Temp; Buffer_Size=Buffer_Temp_Size; } return true; } #endif //MEDIAINFO_DEMUX //--------------------------------------------------------------------------- void File_Avc::Synched_Init() { //FrameInfo PTS_End=0; if (FrameInfo.DTS==(int64u)-1) FrameInfo.DTS=0; //No DTS in container DTS_Begin=FrameInfo.DTS; DTS_End=FrameInfo.DTS; //Temporal references TemporalReferences_DelayedElement=NULL; TemporalReferences_Min=0; TemporalReferences_Max=0; TemporalReferences_Reserved=0; TemporalReferences_Offset=0; TemporalReferences_Offset_pic_order_cnt_lsb_Last=0; TemporalReferences_pic_order_cnt_Min=0; //Text #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) GA94_03_IsPresent=false; #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) //File specific SizeOfNALU_Minus1=(int8u)-1; //Status IFrame_Count=0; prevPicOrderCntMsb=0; prevPicOrderCntLsb=(int32u)-1; prevTopFieldOrderCnt=(int32u)-1; prevFrameNum=(int32u)-1; prevFrameNumOffset=(int32u)-1; //Count of a Packets Block_Count=0; Interlaced_Top=0; Interlaced_Bottom=0; Structure_Field=0; Structure_Frame=0; //Temp FrameRate_Divider=1; FirstPFrameInGop_IsParsed=false; tc=0; //Default values Streams.resize(0x100); Streams[0x06].Searching_Payload=true; //sei Streams[0x07].Searching_Payload=true; //seq_parameter_set Streams[0x09].Searching_Payload=true; //access_unit_delimiter Streams[0x0F].Searching_Payload=true; //subset_seq_parameter_set for (int8u Pos=0xFF; Pos>=0xB9; Pos--) Streams[Pos].Searching_Payload=true; //Testing MPEG-PS //Options Option_Manage(); //Specific cases #if MEDIAINFO_EVENTS if (Config->ParseUndecodableFrames_Get()) { Accept(); //In some case, we must accept the stream very quickly and before the sequence header is detected Streams[0x01].Searching_Payload=true; //slice_header Streams[0x05].Searching_Payload=true; //slice_header } #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10=Config->Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10_Get(); #endif //MEDIAINFO_DEMUX } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Avc::Read_Buffer_Unsynched() { //Temporal references for (size_t Pos=0; PosOpen_Buffer_Unsynch(); #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) //parameter_sets if (SizedBlocks) //If sized blocks, it is not a broadcasted stream so SPS/PPS are only in container header, we must not disable them. { //Rebuilding immediatly TemporalReferences for (std::vector::iterator seq_parameter_set_Item=seq_parameter_sets.begin(); seq_parameter_set_Item!=seq_parameter_sets.end(); ++seq_parameter_set_Item) if ((*seq_parameter_set_Item)) { size_t MaxNumber; switch ((*seq_parameter_set_Item)->pic_order_cnt_type) { case 0 : MaxNumber=(*seq_parameter_set_Item)->MaxPicOrderCntLsb; break; case 2 : MaxNumber=(*seq_parameter_set_Item)->MaxFrameNum*2; break; default: Trusted_IsNot("Not supported"); return; } TemporalReferences.resize(4*MaxNumber); TemporalReferences_Reserved=MaxNumber; } } else { for (std::vector::iterator seq_parameter_set_Item=seq_parameter_sets.begin(); seq_parameter_set_Item!=seq_parameter_sets.end(); ++seq_parameter_set_Item) if ((*seq_parameter_set_Item)) (*seq_parameter_set_Item)->IsSynched=false; for (std::vector::iterator subset_seq_parameter_set_Item=subset_seq_parameter_sets.begin(); subset_seq_parameter_set_Item!=subset_seq_parameter_sets.end(); ++subset_seq_parameter_set_Item) if ((*subset_seq_parameter_set_Item)) (*subset_seq_parameter_set_Item)->IsSynched=false; for (std::vector::iterator pic_parameter_set_Item=pic_parameter_sets.begin(); pic_parameter_set_Item!=pic_parameter_sets.end(); ++pic_parameter_set_Item) if ((*pic_parameter_set_Item)) (*pic_parameter_set_Item)->IsSynched=false; } //Status Interlaced_Top=0; Interlaced_Bottom=0; prevPicOrderCntMsb=0; prevPicOrderCntLsb=(int32u)-1; prevTopFieldOrderCnt=(int32u)-1; prevFrameNum=(int32u)-1; prevFrameNumOffset=(int32u)-1; //Temp FrameRate_Divider=1; FirstPFrameInGop_IsParsed=false; tc=0; //Impossible to know TimeStamps now PTS_End=0; DTS_End=0; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Avc::Header_Parse() { //Specific case if (MustParse_SPS_PPS) { Header_Fill_Size(Element_Size); Header_Fill_Code((int64u)-1, "Specific"); return; } //Parsing int8u nal_unit_type; if (!SizedBlocks) { if (Buffer[Buffer_Offset+2]==0x00) Skip_B1( "zero_byte"); Skip_B3( "start_code_prefix_one_3bytes"); BS_Begin(); Mark_0 (); Get_S1 ( 2, nal_ref_idc, "nal_ref_idc"); Get_S1 ( 5, nal_unit_type, "nal_unit_type"); BS_End(); if (!Header_Parser_Fill_Size()) { Element_WaitForMoreData(); return; } } else { int32u Size; switch (SizeOfNALU_Minus1) { case 0: { int8u Size_; Get_B1 (Size_, "size"); Size=Size_; } break; case 1: { int16u Size_; Get_B2 (Size_, "size"); Size=Size_; } break; case 2: { int32u Size_; Get_B3 (Size_, "size"); Size=Size_; } break; case 3: Get_B4 (Size, "size"); break; default: Trusted_IsNot("No size of NALU defined"); Size=(int32u)(Buffer_Size-Buffer_Offset); } BS_Begin(); Mark_0 (); Get_S1 ( 2, nal_ref_idc, "nal_ref_idc"); Get_S1 ( 5, nal_unit_type, "nal_unit_type"); BS_End(); FILLING_BEGIN(); Header_Fill_Size(Size?(Element_Offset-1+Size):(Buffer_Size-Buffer_Offset)); //If Size is 0, it is not normal, we skip the complete frame FILLING_END(); } //Filling #if MEDIAINFO_TRACE if (Trace_Activated) Header_Fill_Code(nal_unit_type, Ztring().From_CC1(nal_unit_type)); else #endif //MEDIAINFO_TRACE Header_Fill_Code(nal_unit_type); } //--------------------------------------------------------------------------- bool File_Avc::Header_Parser_Fill_Size() { //Look for next Sync word if (Buffer_Offset_Temp==0) //Buffer_Offset_Temp is not 0 if Header_Parse_Fill_Size() has already parsed first frames Buffer_Offset_Temp=Buffer_Offset+4; while (Buffer_Offset_Temp+5<=Buffer_Size && CC3(Buffer+Buffer_Offset_Temp)!=0x000001) { Buffer_Offset_Temp+=2; while(Buffer_Offset_Temp=Buffer_Size || Buffer[Buffer_Offset_Temp-1]==0x00) Buffer_Offset_Temp--; } //Must wait more data? if (Buffer_Offset_Temp+5>Buffer_Size) { if (FrameIsAlwaysComplete || File_Offset+Buffer_Size>=File_Size) Buffer_Offset_Temp=Buffer_Size; //We are sure that the next bytes are a start else return false; } if (Buffer[Buffer_Offset_Temp-1]==0x00) Buffer_Offset_Temp--; //OK, we continue Header_Fill_Size(Buffer_Offset_Temp-Buffer_Offset); Buffer_Offset_Temp=0; return true; } //--------------------------------------------------------------------------- bool File_Avc::Header_Parser_QuickSearch() { while ( Buffer_Offset+6<=Buffer_Size && Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x00 && (Buffer[Buffer_Offset+2]==0x01 || (Buffer[Buffer_Offset+2]==0x00 && Buffer[Buffer_Offset+3]==0x01))) { //Getting start_code int8u start_code; if (Buffer[Buffer_Offset+2]==0x00) start_code=CC1(Buffer+Buffer_Offset+4)&0x1F; else start_code=CC1(Buffer+Buffer_Offset+3)&0x1F; //Searching start if (Streams[start_code].Searching_Payload || Streams[start_code].ShouldDuplicate) return true; //Synchronizing Buffer_Offset+=4; Synched=false; if (!Synchronize()) { UnSynched_IsNotJunk=true; return false; } if (Buffer_Offset+6>Buffer_Size) { UnSynched_IsNotJunk=true; return false; } } Trusted_IsNot("AVC, Synchronisation lost"); return Synchronize(); } //--------------------------------------------------------------------------- void File_Avc::Data_Parse() { //Specific case if (Element_Code==(int64u)-1) { SPS_PPS(); return; } //Trailing zeroes int64u Element_Size_SaveBeforeZeroes=Element_Size; if (Element_Size) { while (Element_Size && Buffer[Buffer_Offset+(size_t)Element_Size-1]==0) Element_Size--; } //svc_extension bool svc_extension_flag=false; if (Element_Code==0x0E || Element_Code==0x14) { BS_Begin(); Get_SB (svc_extension_flag, "svc_extension_flag"); if (svc_extension_flag) nal_unit_header_svc_extension(); else nal_unit_header_mvc_extension(); BS_End(); } //Searching emulation_prevention_three_byte int8u* Buffer_3Bytes=NULL; const int8u* Save_Buffer=Buffer; int64u Save_File_Offset=File_Offset; size_t Save_Buffer_Offset=Buffer_Offset; int64u Save_Element_Size=Element_Size; size_t Element_Offset_3Bytes=(size_t)Element_Offset; std::vector ThreeByte_List; while (Element_Offset_3Bytes+3<=Element_Size) { if (CC3(Buffer+Buffer_Offset+(size_t)Element_Offset_3Bytes)==0x000003) ThreeByte_List.push_back(Element_Offset_3Bytes+2); Element_Offset_3Bytes+=2; while(Element_Offset_3Bytes=Element_Size || Buffer[Buffer_Offset+(size_t)Element_Offset_3Bytes-1]==0x00) Element_Offset_3Bytes--; } if (!ThreeByte_List.empty()) { //We must change the buffer for keeping out Element_Size=Save_Element_Size-ThreeByte_List.size(); File_Offset+=Buffer_Offset; Buffer_Offset=0; Buffer_3Bytes=new int8u[(size_t)Element_Size]; for (size_t Pos=0; Pos<=ThreeByte_List.size(); Pos++) { size_t Pos0=(Pos==ThreeByte_List.size())?(size_t)Save_Element_Size:(ThreeByte_List[Pos]); size_t Pos1=(Pos==0)?0:(ThreeByte_List[Pos-1]+1); size_t Buffer_3bytes_Begin=Pos1-Pos; size_t Save_Buffer_Begin =Pos1; size_t Size= Pos0-Pos1; std::memcpy(Buffer_3Bytes+Buffer_3bytes_Begin, Save_Buffer+Save_Buffer_Offset+Save_Buffer_Begin, Size); } Buffer=Buffer_3Bytes; } //Parsing switch (Element_Code) { case 0x00 : Element_Name("unspecified"); Skip_XX(Element_Size-Element_Offset, "Data"); break; case 0x01 : slice_layer_without_partitioning_non_IDR(); break; case 0x02 : Element_Name("slice_data_partition_a_layer"); Skip_XX(Element_Size-Element_Offset, "Data"); break; case 0x03 : Element_Name("slice_data_partition_b_layer"); Skip_XX(Element_Size-Element_Offset, "Data"); break; case 0x04 : Element_Name("slice_data_partition_c_layer"); Skip_XX(Element_Size-Element_Offset, "Data"); break; case 0x05 : slice_layer_without_partitioning_IDR(); break; case 0x06 : sei(); break; case 0x07 : seq_parameter_set(); break; case 0x08 : pic_parameter_set(); break; case 0x09 : access_unit_delimiter(); break; case 0x0A : Element_Name("end_of_seq"); Skip_XX(Element_Size-Element_Offset, "Data"); break; case 0x0B : Element_Name("end_of_stream"); Skip_XX(Element_Size-Element_Offset, "Data"); break; case 0x0C : filler_data(); break; case 0x0D : Element_Name("seq_parameter_set_extension"); Skip_XX(Element_Size-Element_Offset, "Data"); break; case 0x0E : prefix_nal_unit(svc_extension_flag); break; case 0x0F : subset_seq_parameter_set(); break; case 0x13 : Element_Name("slice_layer_without_partitioning"); Skip_XX(Element_Size-Element_Offset, "Data"); break; case 0x14 : slice_layer_extension(svc_extension_flag); break; default : if (Element_Code<0x18) Element_Name("reserved"); else Element_Name("unspecified"); Skip_XX(Element_Size-Element_Offset, "Data"); } if (!ThreeByte_List.empty()) { //We must change the buffer for keeping out Element_Size=Save_Element_Size; File_Offset=Save_File_Offset; Buffer_Offset=Save_Buffer_Offset; delete[] Buffer; Buffer=Save_Buffer; Buffer_3Bytes=NULL; //Same as Buffer... Element_Offset+=ThreeByte_List.size(); } //Duplicate #if MEDIAINFO_DUPLICATE if (!Streams.empty() && Streams[(size_t)Element_Code].ShouldDuplicate) File__Duplicate_Write(Element_Code); #endif //MEDIAINFO_DUPLICATE #if MEDIAINFO_DEMUX if (Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10) { if (Element_Code==0x07) { std::vector::iterator Data_Item=seq_parameter_sets.begin(); if (Data_Item!=seq_parameter_sets.end() && (*Data_Item)) { delete[] (*Data_Item)->Iso14496_10_Buffer; (*Data_Item)->Iso14496_10_Buffer_Size=(size_t)(Element_Size+4); (*Data_Item)->Iso14496_10_Buffer=new int8u[(*Data_Item)->Iso14496_10_Buffer_Size]; (*Data_Item)->Iso14496_10_Buffer[0]=0x00; (*Data_Item)->Iso14496_10_Buffer[1]=0x00; (*Data_Item)->Iso14496_10_Buffer[2]=0x01; (*Data_Item)->Iso14496_10_Buffer[3]=0x67; std::memcpy((*Data_Item)->Iso14496_10_Buffer+4, Buffer+Buffer_Offset, (size_t)Element_Size); } } if (Element_Code==0x08) { std::vector::iterator Data_Item=pic_parameter_sets.begin(); if (Data_Item!=pic_parameter_sets.end() && (*Data_Item)) { delete[] (*Data_Item)->Iso14496_10_Buffer; (*Data_Item)->Iso14496_10_Buffer_Size=(size_t)(Element_Size+4); (*Data_Item)->Iso14496_10_Buffer=new int8u[(*Data_Item)->Iso14496_10_Buffer_Size]; (*Data_Item)->Iso14496_10_Buffer[0]=0x00; (*Data_Item)->Iso14496_10_Buffer[1]=0x00; (*Data_Item)->Iso14496_10_Buffer[2]=0x01; (*Data_Item)->Iso14496_10_Buffer[3]=0x68; std::memcpy((*Data_Item)->Iso14496_10_Buffer+4, Buffer+Buffer_Offset, (size_t)Element_Size); } } if (Element_Code==0x0F) { std::vector::iterator Data_Item=subset_seq_parameter_sets.begin(); if (Data_Item!=subset_seq_parameter_sets.end() && (*Data_Item)) { SizeOfNALU_Minus1=0; delete[] (*Data_Item)->Iso14496_10_Buffer; (*Data_Item)->Iso14496_10_Buffer_Size=(size_t)(Element_Size+4); (*Data_Item)->Iso14496_10_Buffer=new int8u[(*Data_Item)->Iso14496_10_Buffer_Size]; (*Data_Item)->Iso14496_10_Buffer[0]=0x00; (*Data_Item)->Iso14496_10_Buffer[1]=0x00; (*Data_Item)->Iso14496_10_Buffer[2]=0x01; (*Data_Item)->Iso14496_10_Buffer[3]=0x6F; std::memcpy((*Data_Item)->Iso14496_10_Buffer+4, Buffer+Buffer_Offset, (size_t)Element_Size); } } } #endif //MEDIAINFO_DEMUX //Trailing zeroes Element_Size=Element_Size_SaveBeforeZeroes; } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- // Packet "01" void File_Avc::slice_layer_without_partitioning_non_IDR() { Element_Name("slice_layer_without_partitioning (non-IDR)"); //Parsing BS_Begin(); slice_header(); slice_data(true); BS_End(); } //--------------------------------------------------------------------------- // Packet "05" void File_Avc::slice_layer_without_partitioning_IDR() { Element_Name("slice_layer_without_partitioning (IDR)"); //Parsing BS_Begin(); slice_header(); slice_data(true); BS_End(); FILLING_BEGIN_PRECISE(); //NextCode for (int8u Pos=0x01; Pos<=0x05; Pos++) NextCode_Add(Pos); FILLING_END(); } //--------------------------------------------------------------------------- // void File_Avc::slice_header() { //Encryption management if (CA_system_ID_MustSkipSlices) { //Is not decodable Skip_BS(Data_BS_Remain(), "Data"); Finish("AVC"); return; } Element_Begin1("slice_header"); //Parsing int32u slice_type, pic_order_cnt_lsb=(int32u)-1; int32u first_mb_in_slice, pic_parameter_set_id, frame_num, num_ref_idx_l0_active_minus1, num_ref_idx_l1_active_minus1, disable_deblocking_filter_idc, num_slice_groups_minus1, slice_group_map_type, slice_group_change_cycle=(int32u)-1; int32s delta_pic_order_cnt_bottom=0; bool field_pic_flag=false, bottom_field_flag=false; Get_UE (first_mb_in_slice, "first_mb_in_slice"); Get_UE (slice_type, "slice_type"); Param_Info1C((slice_type<10), Avc_slice_type[slice_type]); #if MEDIAINFO_EVENTS { EVENT_BEGIN (Video, SliceInfo, 0) Event.FieldPosition=Field_Count; Event.SlicePosition=Element_IsOK()?first_mb_in_slice:(int64u)-1; switch (slice_type) { case 0 : case 3 : case 5 : case 8 : Event.SliceType=1; break; case 1 : case 6 : Event.SliceType=2; break; case 2 : case 4 : case 7 : case 9 : Event.SliceType=0; break; default: Event.SliceType=(int8u)-1; } Event.Flags=0; EVENT_END () } #endif //MEDIAINFO_EVENTS if (slice_type>=10) { Skip_BS(Data_BS_Remain(), "Data"); Element_End0(); return; } Get_UE (pic_parameter_set_id, "pic_parameter_set_id"); std::vector::iterator pic_parameter_set_Item; if (pic_parameter_set_id>=pic_parameter_sets.size() || (*(pic_parameter_set_Item=pic_parameter_sets.begin()+pic_parameter_set_id))==NULL || !(*pic_parameter_set_Item)->IsSynched) { //Not yet present Skip_BS(Data_BS_Remain(), "Data (pic_parameter_set is missing)"); Element_End0(); return; } std::vector::iterator seq_parameter_set_Item; if ((*pic_parameter_set_Item)->seq_parameter_set_id>=seq_parameter_sets.size() || (*(seq_parameter_set_Item=seq_parameter_sets.begin()+(*pic_parameter_set_Item)->seq_parameter_set_id))==NULL || !(*seq_parameter_set_Item)->IsSynched) { if ((*pic_parameter_set_Item)->seq_parameter_set_id>=subset_seq_parameter_sets.size() || (*(seq_parameter_set_Item=subset_seq_parameter_sets.begin()+(*pic_parameter_set_Item)->seq_parameter_set_id))==NULL || !(*seq_parameter_set_Item)->IsSynched) { //Not yet present Skip_BS(Data_BS_Remain(), "Data (seq_parameter_set is missing)"); Element_End0(); return; } } if ((*seq_parameter_set_Item)->separate_colour_plane_flag==1) Skip_S1(2, "color_plane_id"); num_ref_idx_l0_active_minus1=(*pic_parameter_set_Item)->num_ref_idx_l0_default_active_minus1; //Default num_ref_idx_l1_active_minus1=(*pic_parameter_set_Item)->num_ref_idx_l1_default_active_minus1; //Default Get_BS ((*seq_parameter_set_Item)->log2_max_frame_num_minus4+4, frame_num, "frame_num"); if (!(*seq_parameter_set_Item)->frame_mbs_only_flag) { TEST_SB_GET(field_pic_flag, "field_pic_flag"); Get_SB (bottom_field_flag, "bottom_field_flag"); TEST_SB_END(); } if (Element_Code==5) //IdrPicFlag Skip_UE( "idr_pic_id"); if ((*seq_parameter_set_Item)->pic_order_cnt_type==0) { Get_BS ((*seq_parameter_set_Item)->log2_max_pic_order_cnt_lsb_minus4+4, pic_order_cnt_lsb, "pic_order_cnt_lsb"); if ((*pic_parameter_set_Item)->bottom_field_pic_order_in_frame_present_flag && !field_pic_flag) Get_SE (delta_pic_order_cnt_bottom, "delta_pic_order_cnt_bottom"); } if ((*seq_parameter_set_Item)->pic_order_cnt_type==1 && !(*seq_parameter_set_Item)->delta_pic_order_always_zero_flag ) { Skip_SE( "delta_pic_order_cnt[0]"); if((*pic_parameter_set_Item)->bottom_field_pic_order_in_frame_present_flag && !field_pic_flag) Skip_SE( "delta_pic_order_cnt[1]"); } if((*pic_parameter_set_Item)->redundant_pic_cnt_present_flag) Skip_UE( "redundant_pic_cnt"); if (slice_type==1 || slice_type==6) //B-Frame Skip_SB( "direct_spatial_mv_pred_flag"); switch (slice_type) { case 0 : //P-Frame case 1 : //B-Frame case 3 : //SP-Frame case 5 : //P-Frame case 6 : //B-Frame case 8 : //SP-Frame TEST_SB_SKIP( "num_ref_idx_active_override_flag"); Get_UE (num_ref_idx_l0_active_minus1, "num_ref_idx_l0_active_minus1"); switch (slice_type) { case 1 : //B-Frame case 6 : //B-Frame Get_UE (num_ref_idx_l1_active_minus1, "num_ref_idx_l1_active_minus1"); break; default: ; } TEST_SB_END(); break; default: ; } ref_pic_list_modification(slice_type, Element_Code==20); //nal_unit_type==20 --> ref_pic_list_mvc_modification() if (((*pic_parameter_set_Item)->weighted_pred_flag && (slice_type==0 || slice_type==3 || slice_type==5 || slice_type==8)) || ((*pic_parameter_set_Item)->weighted_bipred_idc==1 && (slice_type==1 || slice_type==6))) pred_weight_table(num_ref_idx_l0_active_minus1, num_ref_idx_l1_active_minus1, (*seq_parameter_set_Item)->ChromaArrayType()); std::vector memory_management_control_operations; if (nal_ref_idc) dec_ref_pic_marking(memory_management_control_operations); if ((*pic_parameter_set_Item)->entropy_coding_mode_flag && (slice_type!=2 && slice_type!=7 && //I-Frames slice_type!=4 && slice_type!=9)) //SI-Frames Skip_UE( "cabac_init_idc"); Skip_SE( "slice_qp_delta"); switch (slice_type) { case 3 : //SP-Frame case 4 : //SI-Frame case 8 : //SP-Frame case 9 : //SI-Frame switch (slice_type) { case 3 : //SP-Frame case 8 : //SP-Frame Skip_SB( "sp_for_switch_flag"); break; default: ; } Skip_SE ( "slice_qs_delta"); break; default: ; } if ((*pic_parameter_set_Item)->deblocking_filter_control_present_flag) { Get_UE(disable_deblocking_filter_idc, "disable_deblocking_filter_idc"); if (disable_deblocking_filter_idc!=1) { Skip_SE( "slice_alpha_c0_offset_div2"); Skip_SE( "slice_beta_offset_div2"); } } num_slice_groups_minus1=(*pic_parameter_set_Item)->num_slice_groups_minus1; //Default slice_group_map_type=(*pic_parameter_set_Item)->slice_group_map_type; //Default if (num_slice_groups_minus1 > 0 && slice_group_map_type >=3 && slice_group_map_type <=5) Get_BS ((*seq_parameter_set_Item)->log2_max_slice_group_change_cycle_minus4+4, slice_group_change_cycle, "slice_group_change_cycle"); Element_End0(); FILLING_BEGIN(); //Count of I-Frames if (first_mb_in_slice==0 && Element_Code!=20 && (slice_type==2 || slice_type==7)) //Not slice_layer_extension, I-Frame IFrame_Count++; //pic_struct if (field_pic_flag && (*seq_parameter_set_Item)->pic_struct_FirstDetected==(int8u)-1) (*seq_parameter_set_Item)->pic_struct_FirstDetected=bottom_field_flag?2:1; //2=BFF, 1=TFF //Saving some info int32s TemporalReferences_Offset_pic_order_cnt_lsb_Diff=0; if ((*seq_parameter_set_Item)->pic_order_cnt_type!=1 && first_mb_in_slice==0 && (Element_Code!=0x14 || seq_parameter_sets.empty())) //Not slice_layer_extension except if MVC only { if (field_pic_flag) { Structure_Field++; if (bottom_field_flag) Interlaced_Bottom++; else Interlaced_Top++; } else Structure_Frame++; //Frame order detection int64s pic_order_cnt=0; switch ((*seq_parameter_set_Item)->pic_order_cnt_type) { case 0 : { if (Element_Code==5) //IDR { prevPicOrderCntMsb=0; prevPicOrderCntLsb=0; TemporalReferences_Offset=TemporalReferences_Max; if (TemporalReferences_Offset%2) TemporalReferences_Offset++; TemporalReferences_pic_order_cnt_Min=0; } else { bool Has5=false; for (std::vector::iterator Temp=memory_management_control_operations.begin(); Temp!=memory_management_control_operations.end(); ++Temp) if ((*Temp)==5) { Has5=true; break; } if (Has5) { prevPicOrderCntMsb=0; if (bottom_field_flag) prevPicOrderCntLsb=0; else prevPicOrderCntLsb=prevTopFieldOrderCnt; } } int32s PicOrderCntMsb; if (prevPicOrderCntLsb==(int32u)-1) { PicOrderCntMsb=0; if ((int32u)(2*((*seq_parameter_set_Item)->max_num_ref_frames+3))max_num_ref_frames+3); } else if (pic_order_cnt_lsb=(*seq_parameter_set_Item)->MaxPicOrderCntLsb/2) PicOrderCntMsb=prevPicOrderCntMsb+(*seq_parameter_set_Item)->MaxPicOrderCntLsb; else if (pic_order_cnt_lsb>prevPicOrderCntLsb && pic_order_cnt_lsb-prevPicOrderCntLsb>(*seq_parameter_set_Item)->MaxPicOrderCntLsb/2) PicOrderCntMsb=prevPicOrderCntMsb-(*seq_parameter_set_Item)->MaxPicOrderCntLsb; else PicOrderCntMsb=prevPicOrderCntMsb; int32s TopFieldOrderCnt=PicOrderCntMsb+pic_order_cnt_lsb; int32s BottomFieldOrderCnt; if (field_pic_flag) BottomFieldOrderCnt=TopFieldOrderCnt+delta_pic_order_cnt_bottom; else BottomFieldOrderCnt=PicOrderCntMsb+pic_order_cnt_lsb; prevPicOrderCntMsb=PicOrderCntMsb; prevPicOrderCntLsb=pic_order_cnt_lsb; prevTopFieldOrderCnt=TopFieldOrderCnt; pic_order_cnt=bottom_field_flag?BottomFieldOrderCnt:TopFieldOrderCnt; } break; case 2 : { bool Has5=false; for (std::vector::iterator Temp=memory_management_control_operations.begin(); Temp!=memory_management_control_operations.end(); ++Temp) if ((*Temp)==5) { Has5=true; break; } if (Has5) prevFrameNumOffset=0; int32u FrameNumOffset; if (Element_Code==5) //IdrPicFlag { TemporalReferences_Offset=TemporalReferences_Max; if (TemporalReferences_Offset%2) TemporalReferences_Offset++; FrameNumOffset=0; } else if (prevFrameNumOffset==(int32u)-1) FrameNumOffset=0; else if (prevFrameNum>frame_num) FrameNumOffset=prevFrameNumOffset+(*seq_parameter_set_Item)->MaxFrameNum; else FrameNumOffset=prevFrameNumOffset; int32u tempPicOrderCnt; if (Element_Code==5) //IdrPicFlag tempPicOrderCnt=0; else if (nal_ref_idc) tempPicOrderCnt=2*(FrameNumOffset+frame_num); else tempPicOrderCnt=2*(FrameNumOffset+frame_num)-1; pic_order_cnt=tempPicOrderCnt; prevFrameNum=frame_num; prevFrameNumOffset=FrameNumOffset; pic_order_cnt_lsb=frame_num; } break; default: ; } if (pic_order_cnt=4*TemporalReferences_Reserved || Base>=4*TemporalReferences_Reserved || ToInsert+TemporalReferences_Max>=4*TemporalReferences_Reserved || TemporalReferences_Max>=4*TemporalReferences_Reserved || TemporalReferences_Max-Base>=4*TemporalReferences_Reserved) { Trusted_IsNot("Problem in temporal references"); return; } Element_Info1(__T("Offset of ")+Ztring::ToZtring(ToInsert)); TemporalReferences.insert(TemporalReferences.begin()+Base, ToInsert, NULL); TemporalReferences_Offset+=ToInsert; TemporalReferences_Max+=ToInsert; TemporalReferences_pic_order_cnt_Min=pic_order_cnt; } else if (TemporalReferences_Min>(size_t)(TemporalReferences_Offset+pic_order_cnt)) TemporalReferences_Min=(size_t)(TemporalReferences_Offset+pic_order_cnt); } if (pic_order_cnt<0 && TemporalReferences_Offset<(size_t)(-pic_order_cnt)) //Found in playreadyEncryptedBlowUp.ts without encryption test { Trusted_IsNot("Problem in temporal references"); return; } if ((size_t)(TemporalReferences_Offset+pic_order_cnt)>=3*TemporalReferences_Reserved) { size_t Offset=TemporalReferences_Max-TemporalReferences_Offset; if (Offset%2) Offset++; if (Offset>=TemporalReferences_Reserved && pic_order_cnt>=(int64s)TemporalReferences_Reserved) { TemporalReferences_Offset+=TemporalReferences_Reserved; pic_order_cnt-=TemporalReferences_Reserved; switch ((*seq_parameter_set_Item)->pic_order_cnt_type) { case 0 : prevPicOrderCntMsb-=(int32u)TemporalReferences_Reserved; break; case 2 : prevFrameNumOffset-=(int32u)TemporalReferences_Reserved/2; break; default:; } } else if (Offset && Offset<=2) //Only I-frames TemporalReferences_Offset+=2; while (TemporalReferences_Offset+pic_order_cnt>=3*TemporalReferences_Reserved) { for (size_t Pos=0; Posslice_type]; } else if (!PictureTypes_PreviousFrames.empty()) //Only if stream already started { if ((Pos%2)==0) PictureTypes_PreviousFrames+=' '; } delete TemporalReferences[Pos]; } if (PictureTypes_PreviousFrames.size()>=8*TemporalReferences.size()) PictureTypes_PreviousFrames.erase(PictureTypes_PreviousFrames.begin(), PictureTypes_PreviousFrames.begin()+PictureTypes_PreviousFrames.size()-TemporalReferences.size()); TemporalReferences.erase(TemporalReferences.begin(), TemporalReferences.begin()+TemporalReferences_Reserved); TemporalReferences.resize(4*TemporalReferences_Reserved); if (TemporalReferences_Reservedframe_mbs_only_flag?2:1); if (TemporalReferences_Min>TemporalReferences_Offset_pic_order_cnt_lsb_Last) TemporalReferences_Min=TemporalReferences_Offset_pic_order_cnt_lsb_Last; if (TemporalReferences_DelayedElement) { delete TemporalReferences[TemporalReferences_Offset_pic_order_cnt_lsb_Last]; TemporalReferences[TemporalReferences_Offset_pic_order_cnt_lsb_Last]=TemporalReferences_DelayedElement; } if (TemporalReferences[TemporalReferences_Offset_pic_order_cnt_lsb_Last]==NULL) TemporalReferences[TemporalReferences_Offset_pic_order_cnt_lsb_Last]=new temporal_reference(); TemporalReferences[TemporalReferences_Offset_pic_order_cnt_lsb_Last]->frame_num=frame_num; TemporalReferences[TemporalReferences_Offset_pic_order_cnt_lsb_Last]->slice_type=(int8u)slice_type; TemporalReferences[TemporalReferences_Offset_pic_order_cnt_lsb_Last]->IsTop=!bottom_field_flag; TemporalReferences[TemporalReferences_Offset_pic_order_cnt_lsb_Last]->IsField=field_pic_flag; if (TemporalReferences_DelayedElement) { TemporalReferences_DelayedElement=NULL; sei_message_user_data_registered_itu_t_t35_GA94_03_Delayed((*pic_parameter_set_Item)->seq_parameter_set_id); } } if ((*seq_parameter_set_Item)->vui_parameters && (*seq_parameter_set_Item)->vui_parameters->timing_info_present_flag && (*seq_parameter_set_Item)->vui_parameters->num_units_in_tick) tc=float64_int64s(((float64)1000000000)/((float64)(*seq_parameter_set_Item)->vui_parameters->time_scale/(*seq_parameter_set_Item)->vui_parameters->num_units_in_tick/((*seq_parameter_set_Item)->pic_order_cnt_type==2?1:2)/FrameRate_Divider)/((!(*seq_parameter_set_Item)->frame_mbs_only_flag && field_pic_flag)?2:1)); if (first_mb_in_slice==0) { if (Frame_Count==0) { if (FrameInfo.PTS==(int64u)-1) FrameInfo.PTS=FrameInfo.DTS+tc*(TemporalReferences_Offset_pic_order_cnt_lsb_Diff?2:1)*((!(*seq_parameter_set_Item)->frame_mbs_only_flag && field_pic_flag)?2:1); //No PTS in container PTS_Begin=FrameInfo.PTS; } if (slice_type==2 || slice_type==7) //IFrame FirstPFrameInGop_IsParsed=false; } else { if (FrameInfo.PTS!=(int64u)-1) FrameInfo.PTS-=tc; if (FrameInfo.DTS!=(int64u)-1) FrameInfo.DTS-=tc; } //Frame pos if (Frame_Count!=(int64u)-1 && Frame_Count && ((!(*seq_parameter_set_Item)->frame_mbs_only_flag && Interlaced_Top==Interlaced_Bottom && field_pic_flag) || first_mb_in_slice!=0 || (Element_Code==0x14 && !seq_parameter_sets.empty()))) { Frame_Count--; if (IFrame_Count && Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded--; Frame_Count_InThisBlock--; } else if (first_mb_in_slice==0) { if ((*seq_parameter_set_Item)->pic_order_cnt_type!=1 && (Element_Code!=0x14 || seq_parameter_sets.empty())) //Not slice_layer_extension except if MVC only { if ((!IsSub || Frame_Count_InThisBlock) && TemporalReferences_Offset_pic_order_cnt_lsb_Diff && TemporalReferences_Offset_pic_order_cnt_lsb_Diff!=2) FrameInfo.PTS+=(TemporalReferences_Offset_pic_order_cnt_lsb_Diff-(field_pic_flag?1:2))/((!(*seq_parameter_set_Item)->frame_mbs_only_flag && field_pic_flag)?1:2)*(int64s)tc; } if (!FirstPFrameInGop_IsParsed && (slice_type==0 || slice_type==5)) //P-Frame { FirstPFrameInGop_IsParsed=true; //Testing if we have enough to test GOP if (Frame_Count<=Frame_Count_Valid) { std::string PictureTypes(PictureTypes_PreviousFrames); PictureTypes.reserve(TemporalReferences.size()); for (size_t Pos=0; Posslice_type]; } else if (!PictureTypes.empty()) //Only if stream already started { if ((Pos%2)==0) PictureTypes+=' '; } if (!GOP_Detect(PictureTypes).empty() && !GA94_03_IsPresent) Frame_Count_Valid=Frame_Count; //We have enough frames } } } #if MEDIAINFO_TRACE if (Trace_Activated) { Element_Info1(TemporalReferences_Offset_pic_order_cnt_lsb_Last); Element_Info1((((*seq_parameter_set_Item)->frame_mbs_only_flag || !field_pic_flag)?__T("Frame "):(bottom_field_flag?__T("Field (Bottom) "):__T("Field (Top) ")))+Ztring::ToZtring(Frame_Count)); if (slice_type<9) Element_Info1(__T("slice_type ")+Ztring().From_Local(Avc_slice_type[slice_type])); Element_Info1(__T("frame_num ")+Ztring::ToZtring(frame_num)); if ((*seq_parameter_set_Item)->vui_parameters && (*seq_parameter_set_Item)->vui_parameters->fixed_frame_rate_flag) { if (FrameInfo.PCR!=(int64u)-1) Element_Info1(__T("PCR ")+Ztring().Duration_From_Milliseconds(float64_int64s(((float64)FrameInfo.PCR)/1000000))); if (FrameInfo.DTS!=(int64u)-1) Element_Info1(__T("DTS ")+Ztring().Duration_From_Milliseconds(float64_int64s(((float64)FrameInfo.DTS)/1000000))); if (FrameInfo.PTS!=(int64u)-1) Element_Info1(__T("PTS ")+Ztring().Duration_From_Milliseconds(float64_int64s(((float64)FrameInfo.PTS)/1000000))); } if ((*seq_parameter_set_Item)->pic_order_cnt_type==0) Element_Info1(__T("pic_order_cnt_lsb ")+Ztring::ToZtring(pic_order_cnt_lsb)); if (first_mb_in_slice) Element_Info1(__T("first_mb_in_slice ")+Ztring::ToZtring(first_mb_in_slice)); } #endif //MEDIAINFO_TRACE //Counting if (Frame_Count!=(int64u)-1) { if (File_Offset+Buffer_Offset+Element_Size==File_Size) Frame_Count_Valid=Frame_Count; //Finish frames in case of there are less than Frame_Count_Valid frames Frame_Count++; if (IFrame_Count && Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; Frame_Count_InThisBlock++; } if ((*seq_parameter_set_Item)->pic_order_cnt_type==0 && field_pic_flag) { Field_Count++; Field_Count_InThisBlock++; } if (FrameInfo.PTS!=(int64u)-1) FrameInfo.PTS+=tc; if (FrameInfo.DTS!=(int64u)-1) FrameInfo.DTS+=tc; if (FrameInfo.PTS!=(int64u)-1 && (FrameInfo.PTS>PTS_End || (PTS_End>1000000000 && FrameInfo.PTS<=PTS_End-1000000000))) //More than current PTS_End or less than current PTS_End minus 1 second (there is a problem?) PTS_End=FrameInfo.PTS; #if MEDIAINFO_DUPLICATE if (Streams[(size_t)Element_Code].ShouldDuplicate) File__Duplicate_Write(Element_Code, (*seq_parameter_set_Item)->pic_order_cnt_type==0?pic_order_cnt_lsb:frame_num); #endif //MEDIAINFO_DUPLICATE //Filling only if not already done if (Frame_Count==1 && !Status[IsAccepted]) Accept("AVC"); if (!Status[IsFilled]) { if (!GA94_03_IsPresent && IFrame_Count>=8) Frame_Count_Valid=Frame_Count; //We have enough frames if (Frame_Count>=Frame_Count_Valid) { Fill("AVC"); if (!IsSub && !Streams[(size_t)Element_Code].ShouldDuplicate && MediaInfoLib::Config.ParseSpeed_Get()<1.0) Finish("AVC"); } } FILLING_END(); } //--------------------------------------------------------------------------- // void File_Avc::slice_data(bool AllCategories) { Element_Begin1("slice_data"); Skip_BS(Data_BS_Remain(), "(ToDo)"); Element_End0(); } //--------------------------------------------------------------------------- // void File_Avc::ref_pic_list_modification(int32u slice_type, bool mvc) { if ((slice_type%5)!=2 && (slice_type%5)!=4) { TEST_SB_SKIP( "ref_pic_list_modification_flag_l0"); int32u modification_of_pic_nums_idc; do { Get_UE (modification_of_pic_nums_idc, "modification_of_pic_nums_idc"); if (modification_of_pic_nums_idc<2) Skip_UE( "abs_diff_pic_num_minus1"); else if (modification_of_pic_nums_idc==2) Skip_UE( "long_term_pic_num"); else if (mvc && (modification_of_pic_nums_idc==4 || modification_of_pic_nums_idc==5)) //ref_pic_list_mvc_modification only Skip_UE( "abs_diff_view_idx_minus1"); else if (modification_of_pic_nums_idc!=3) { Trusted_IsNot("ref_pic_list_modification_flag_l0"); Skip_BS(Data_BS_Remain(), "(Remaining bits)"); } } while (modification_of_pic_nums_idc!=3 && Data_BS_Remain()); TEST_SB_END(); } if ((slice_type%5)==1) { TEST_SB_SKIP( "ref_pic_list_modification_flag_l1"); int32u modification_of_pic_nums_idc; do { Get_UE (modification_of_pic_nums_idc, "modification_of_pic_nums_idc"); if (modification_of_pic_nums_idc<2) Skip_UE( "abs_diff_pic_num_minus1"); else if (modification_of_pic_nums_idc==2) Skip_UE( "long_term_pic_num"); else if (mvc && (modification_of_pic_nums_idc==4 || modification_of_pic_nums_idc==5)) //ref_pic_list_mvc_modification only Skip_UE( "abs_diff_view_idx_minus1"); else if (modification_of_pic_nums_idc!=3) { Trusted_IsNot("ref_pic_list_modification_flag_l1"); Skip_BS(Data_BS_Remain(), "(Remaining bits)"); } } while (modification_of_pic_nums_idc!=3 && Data_BS_Remain()); TEST_SB_END(); } } //--------------------------------------------------------------------------- // void File_Avc::pred_weight_table(int32u num_ref_idx_l0_active_minus1, int32u num_ref_idx_l1_active_minus1, int8u ChromaArrayType) { Skip_UE( "luma_log2_weight_denom"); if (ChromaArrayType) Skip_UE( "chroma_log2_weight_denom"); for(int32u i=0; i<=num_ref_idx_l0_active_minus1; i++) { TEST_SB_SKIP( "luma_weight_l0_flag"); Skip_SE( "luma_weight_l0"); Skip_SE( "luma_offset_l0"); TEST_SB_END(); } if (ChromaArrayType) { TEST_SB_SKIP( "chroma_weight_l0_flag"); Skip_SE( "chroma_weight_l0"); Skip_SE( "chroma_offset_l0"); TEST_SB_END(); } } //--------------------------------------------------------------------------- // void File_Avc::dec_ref_pic_marking(std::vector &memory_management_control_operations) { if (Element_Code==5) //IdrPicFlag { Skip_SB( "no_output_of_prior_pics_flag"); Skip_SB( "long_term_reference_flag"); } else { TEST_SB_SKIP( "adaptive_ref_pic_marking_mode_flag"); int32u memory_management_control_operation; do { Get_UE (memory_management_control_operation, "memory_management_control_operation"); switch (memory_management_control_operation) { case 1 : Skip_UE( "difference_of_pic_nums_minus1"); break; case 2 : Skip_UE( "long_term_pic_num"); break; case 3 : Skip_UE( "difference_of_pic_nums_minus1"); //break; 3 --> difference_of_pic_nums_minus1 then long_term_frame_idx case 6 : Skip_UE( "long_term_frame_idx"); break; case 4 : Skip_UE( "max_long_term_frame_idx_plus1"); break; } memory_management_control_operations.push_back((int8u)memory_management_control_operation); } while (Data_BS_Remain() && memory_management_control_operation); TEST_SB_END() } } //--------------------------------------------------------------------------- // Packet "06" void File_Avc::sei() { Element_Name("sei"); //Parsing int32u seq_parameter_set_id=(int32u)-1; while(Element_Offset+1Element_Size) { Trusted_IsNot("Wrong size"); Skip_XX(Element_Size-Element_Offset, "unknown"); return; } int64u Element_Size_Save=Element_Size; Element_Size=Element_Offset_Save; switch (payloadType) { case 0 : sei_message_buffering_period(seq_parameter_set_id); break; case 1 : sei_message_pic_timing(payloadSize, seq_parameter_set_id); break; case 4 : sei_message_user_data_registered_itu_t_t35(); break; case 5 : sei_message_user_data_unregistered(payloadSize); break; case 6 : sei_message_recovery_point(); break; case 32 : sei_message_mainconcept(payloadSize); break; default : Element_Info1("unknown"); Skip_XX(payloadSize, "data"); } Element_Offset=Element_Offset_Save; //Positionning in the right place. Element_Size=Element_Size_Save; //Positionning in the right place. } //--------------------------------------------------------------------------- // SEI - 0 void File_Avc::sei_message_buffering_period(int32u &seq_parameter_set_id) { Element_Info1("buffering_period"); //Parsing if (Element_Offset==Element_Size) return; //Nothing to do BS_Begin(); Get_UE (seq_parameter_set_id, "seq_parameter_set_id"); std::vector::iterator seq_parameter_set_Item; if (seq_parameter_set_id>=seq_parameter_sets.size() || (*(seq_parameter_set_Item=seq_parameter_sets.begin()+seq_parameter_set_id))==NULL || !(*seq_parameter_set_Item)->IsSynched) { //Not yet present Skip_BS(Data_BS_Remain(), "Data (seq_parameter_set is missing)"); BS_End(); return; } if ((*seq_parameter_set_Item)->NalHrdBpPresentFlag()) sei_message_buffering_period_xxl((*seq_parameter_set_Item)->vui_parameters->NAL); if ((*seq_parameter_set_Item)->VclHrdBpPresentFlag()) sei_message_buffering_period_xxl((*seq_parameter_set_Item)->vui_parameters->VCL); BS_End(); } void File_Avc::sei_message_buffering_period_xxl(void* xxl_) { if (xxl_==NULL) return; seq_parameter_set_struct::vui_parameters_struct::xxl* xxl=(seq_parameter_set_struct::vui_parameters_struct::xxl*)xxl_; for (int32u SchedSelIdx=0; SchedSelIdxSchedSel.size(); SchedSelIdx++) { Get_S4 (xxl->initial_cpb_removal_delay_length_minus1+1, xxl->SchedSel[SchedSelIdx].initial_cpb_removal_delay, "initial_cpb_removal_delay"); Param_Info2(xxl->SchedSel[SchedSelIdx].initial_cpb_removal_delay/90, " ms"); Get_S4 (xxl->initial_cpb_removal_delay_length_minus1+1, xxl->SchedSel[SchedSelIdx].initial_cpb_removal_delay_offset, "initial_cpb_removal_delay_offset"); Param_Info2(xxl->SchedSel[SchedSelIdx].initial_cpb_removal_delay_offset/90, " ms"); } } //--------------------------------------------------------------------------- // SEI - 1 void File_Avc::sei_message_pic_timing(int32u /*payloadSize*/, int32u seq_parameter_set_id) { Element_Info1("pic_timing"); //Testing if we can parsing it now. TODO: handle case seq_parameter_set_id is unknown (buffering of message, decoding in slice parsing) if (seq_parameter_set_id==(int32u)-1 && seq_parameter_sets.size()==1) seq_parameter_set_id=0; std::vector::iterator seq_parameter_set_Item; if (seq_parameter_set_id>=seq_parameter_sets.size() || (*(seq_parameter_set_Item=seq_parameter_sets.begin()+seq_parameter_set_id))==NULL || !(*seq_parameter_set_Item)->IsSynched) { //Not yet present Skip_BS(Data_BS_Remain(), "Data (seq_parameter_set is missing)"); return; } //Parsing int8u pic_struct=(int8u)-1; BS_Begin(); if ((*seq_parameter_set_Item)->CpbDpbDelaysPresentFlag()) { int8u cpb_removal_delay_length_minus1=(*seq_parameter_set_Item)->vui_parameters->NAL?(*seq_parameter_set_Item)->vui_parameters->NAL->cpb_removal_delay_length_minus1:(*seq_parameter_set_Item)->vui_parameters->VCL->cpb_removal_delay_length_minus1; //Spec is not precise, I am not sure int8u dpb_output_delay_length_minus1=(*seq_parameter_set_Item)->vui_parameters->NAL?(*seq_parameter_set_Item)->vui_parameters->NAL->dpb_output_delay_length_minus1:(*seq_parameter_set_Item)->vui_parameters->VCL->dpb_output_delay_length_minus1; //Spec is not precise, I am not sure Skip_S4(cpb_removal_delay_length_minus1+1, "cpb_removal_delay"); Skip_S4(dpb_output_delay_length_minus1+1, "dpb_output_delay"); } if ((*seq_parameter_set_Item)->vui_parameters && (*seq_parameter_set_Item)->vui_parameters->pic_struct_present_flag) { Get_S1 (4, pic_struct, "pic_struct"); switch (pic_struct) { case 0 : case 1 : case 2 : case 3 : case 4 : case 5 : case 6 : break; case 7 : FrameRate_Divider=2; break; case 8 : FrameRate_Divider=3; break; default : Param_Info1("Reserved"); return; //NumClockTS is unknown } Param_Info1(Avc_pic_struct[pic_struct]); int8u NumClockTS=Avc_NumClockTS[pic_struct]; int8u seconds_value=0, minutes_value=0, hours_value=0; //Here because theses values can be reused in later ClockTSs. for (int8u i=0; iCpbDpbDelaysPresentFlag()) { int8u time_offset_length=(*seq_parameter_set_Item)->vui_parameters->NAL?(*seq_parameter_set_Item)->vui_parameters->NAL->time_offset_length:(*seq_parameter_set_Item)->vui_parameters->VCL->time_offset_length; //Spec is not precise, I am not sure if (time_offset_length) Get_S4 (time_offset_length, time_offset, "time_offset"); } if ((*seq_parameter_set_Item)->vui_parameters && (*seq_parameter_set_Item)->vui_parameters->timing_info_present_flag && (*seq_parameter_set_Item)->vui_parameters->time_scale) { float32 Milliseconds=((float32)(n_frames*((*seq_parameter_set_Item)->vui_parameters->num_units_in_tick*(1+(nuit_field_based_flag?1:0)))+time_offset))/(*seq_parameter_set_Item)->vui_parameters->time_scale; TimeStamp+=__T('.'); TimeStamp+=Ztring::ToZtring(Milliseconds); } Param_Info1(TimeStamp); TEST_SB_END(); Element_End0(); } } BS_End(); FILLING_BEGIN(); if ((*seq_parameter_set_Item)->pic_struct_FirstDetected==(int8u)-1 && (*seq_parameter_set_Item)->vui_parameters && (*seq_parameter_set_Item)->vui_parameters->pic_struct_present_flag) (*seq_parameter_set_Item)->pic_struct_FirstDetected=pic_struct; FILLING_END(); } //--------------------------------------------------------------------------- // SEI - 5 void File_Avc::sei_message_user_data_registered_itu_t_t35() { Element_Info1("user_data_registered_itu_t_t35"); //Parsing int8u itu_t_t35_country_code; Get_B1 (itu_t_t35_country_code, "itu_t_t35_country_code"); if (itu_t_t35_country_code==0xFF) Skip_B1( "itu_t_t35_country_code_extension_byte"); if (itu_t_t35_country_code!=0xB5 || Element_Offset+2>=Element_Size) { if (Element_Size-Element_Offset) Skip_XX(Element_Size-Element_Offset, "Unknown"); return; } //United-States int16u id; Get_B2 (id, "id?"); if (id!=0x0031 || Element_Offset+4>=Element_Size) { if (Element_Size-Element_Offset) Skip_XX(Element_Size-Element_Offset, "Unknown"); return; } int32u Identifier; Peek_B4(Identifier); switch (Identifier) { case 0x44544731 : sei_message_user_data_registered_itu_t_t35_DTG1(); return; case 0x47413934 : sei_message_user_data_registered_itu_t_t35_GA94(); return; default : if (Element_Size-Element_Offset) Skip_XX(Element_Size-Element_Offset, "Unknown"); } } //--------------------------------------------------------------------------- // SEI - 5 - DTG1 void File_Avc::sei_message_user_data_registered_itu_t_t35_DTG1() { Element_Info1("Active Format Description"); //Parsing bool active_format_flag; Skip_C4( "afd_identifier"); BS_Begin(); Mark_0(); Get_SB (active_format_flag, "active_format_flag"); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_0_NoTrustError(); Mark_1_NoTrustError(); if (active_format_flag) { Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Info_S1(4, active_format, "active_format"); Param_Info1(Avc_user_data_DTG1_active_format[active_format]); } BS_End(); } //--------------------------------------------------------------------------- // SEI - 5 - GA94 void File_Avc::sei_message_user_data_registered_itu_t_t35_GA94() { //Parsing int8u user_data_type_code; Skip_B4( "GA94_identifier"); Get_B1 (user_data_type_code, "user_data_type_code"); switch (user_data_type_code) { case 0x03 : sei_message_user_data_registered_itu_t_t35_GA94_03(); break; case 0x06 : sei_message_user_data_registered_itu_t_t35_GA94_06(); break; default : Skip_XX(Element_Size-Element_Offset, "GA94_reserved_user_data"); } } //--------------------------------------------------------------------------- // SEI - 5 - GA94 - 0x03 void File_Avc::sei_message_user_data_registered_itu_t_t35_GA94_03() { #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) GA94_03_IsPresent=true; MustExtendParsingDuration=true; Buffer_TotalBytes_Fill_Max=(int64u)-1; //Disabling this feature for this format, this is done in the parser Element_Info1("DTVCC Transport"); //Coherency delete TemporalReferences_DelayedElement; TemporalReferences_DelayedElement=new temporal_reference(); TemporalReferences_DelayedElement->GA94_03=new temporal_reference::buffer_data; TemporalReferences_DelayedElement->GA94_03->Size=(size_t)(Element_Size-Element_Offset); delete[] TemporalReferences_DelayedElement->GA94_03->Data; TemporalReferences_DelayedElement->GA94_03->Data=new int8u[(size_t)(Element_Size-Element_Offset)]; std::memcpy(TemporalReferences_DelayedElement->GA94_03->Data, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); //Parsing Skip_XX(Element_Size-Element_Offset, "CC data"); #else //defined(MEDIAINFO_DTVCCTRANSPORT_YES) Skip_XX(Element_Size-Element_Offset, "DTVCC Transport data"); #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) } void File_Avc::sei_message_user_data_registered_itu_t_t35_GA94_03_Delayed(int32u seq_parameter_set_id) { // Skipping missing frames if (TemporalReferences_Max-TemporalReferences_Min>(size_t)(4*(seq_parameter_sets[seq_parameter_set_id]->max_num_ref_frames+3))) // max_num_ref_frames ref frame maximum { TemporalReferences_Min=TemporalReferences_Max-4*(seq_parameter_sets[seq_parameter_set_id]->max_num_ref_frames+3); while (TemporalReferences[TemporalReferences_Min]==NULL) TemporalReferences_Min++; } // Parsing captions while (TemporalReferences[TemporalReferences_Min] && TemporalReferences_Min+2*seq_parameter_sets[seq_parameter_set_id]->max_num_ref_framesFormat=File_DtvccTransport::Format_A53_4_GA94_03; } if (((File_DtvccTransport*)GA94_03_Parser)->AspectRatio==0) { float64 PixelAspectRatio=1; std::vector::iterator seq_parameter_set_Item=seq_parameter_sets.begin(); for (; seq_parameter_set_Item!=seq_parameter_sets.end(); ++seq_parameter_set_Item) if ((*seq_parameter_set_Item)) break; if (seq_parameter_set_Item!=seq_parameter_sets.end()) { if ((*seq_parameter_set_Item)->vui_parameters->aspect_ratio_info_present_flag) { if ((*seq_parameter_set_Item)->vui_parameters->aspect_ratio_idcvui_parameters->aspect_ratio_idc]; else if ((*seq_parameter_set_Item)->vui_parameters->aspect_ratio_idc==0xFF && (*seq_parameter_set_Item)->vui_parameters->sar_height) PixelAspectRatio=((float64)(*seq_parameter_set_Item)->vui_parameters->sar_width)/(*seq_parameter_set_Item)->vui_parameters->sar_height; } int32u Width =((*seq_parameter_set_Item)->pic_width_in_mbs_minus1 +1)*16; int32u Height=((*seq_parameter_set_Item)->pic_height_in_map_units_minus1+1)*16*(2-(*seq_parameter_set_Item)->frame_mbs_only_flag); ((File_DtvccTransport*)GA94_03_Parser)->AspectRatio=Width*PixelAspectRatio/Height; } } if (GA94_03_Parser->PTS_DTS_Needed) { GA94_03_Parser->FrameInfo.PCR=FrameInfo.PCR; GA94_03_Parser->FrameInfo.PTS=FrameInfo.PTS; GA94_03_Parser->FrameInfo.DTS=FrameInfo.DTS; } #if MEDIAINFO_DEMUX if (TemporalReferences[TemporalReferences_Min]->GA94_03) { int8u Demux_Level_Save=Demux_Level; Demux_Level=8; //Ancillary Demux(TemporalReferences[TemporalReferences_Min]->GA94_03->Data, TemporalReferences[TemporalReferences_Min]->GA94_03->Size, ContentType_MainStream); Demux_Level=Demux_Level_Save; } Element_Code=Element_Code_Old; #endif //MEDIAINFO_DEMUX if (TemporalReferences[TemporalReferences_Min]->GA94_03) Open_Buffer_Continue(GA94_03_Parser, TemporalReferences[TemporalReferences_Min]->GA94_03->Data, TemporalReferences[TemporalReferences_Min]->GA94_03->Size); Element_End0(); #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) TemporalReferences_Min+=((seq_parameter_sets[seq_parameter_set_id]->frame_mbs_only_flag | !TemporalReferences[TemporalReferences_Min]->IsField)?2:1); } } //--------------------------------------------------------------------------- // SEI - 5 - GA94 - 0x03 void File_Avc::sei_message_user_data_registered_itu_t_t35_GA94_06() { Element_Info1("Bar data"); //Parsing bool top_bar_flag, bottom_bar_flag, left_bar_flag, right_bar_flag; BS_Begin(); Get_SB (top_bar_flag, "top_bar_flag"); Get_SB (bottom_bar_flag, "bottom_bar_flag"); Get_SB (left_bar_flag, "left_bar_flag"); Get_SB (right_bar_flag, "right_bar_flag"); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); BS_End(); if (top_bar_flag) { Mark_1(); Mark_1(); Skip_S2(14, "line_number_end_of_top_bar"); } if (bottom_bar_flag) { Mark_1(); Mark_1(); Skip_S2(14, "line_number_start_of_bottom_bar"); } if (left_bar_flag) { Mark_1(); Mark_1(); Skip_S2(14, "pixel_number_end_of_left_bar"); } if (right_bar_flag) { Mark_1(); Mark_1(); Skip_S2(14, "pixel_number_start_of_right_bar"); } Mark_1(); Mark_1(); Mark_1(); Mark_1(); Mark_1(); Mark_1(); Mark_1(); Mark_1(); BS_End(); if (Element_Size-Element_Offset) Skip_XX(Element_Size-Element_Offset, "additional_bar_data"); } //--------------------------------------------------------------------------- // SEI - 5 void File_Avc::sei_message_user_data_unregistered(int32u payloadSize) { Element_Info1("user_data_unregistered"); //Parsing int128u uuid_iso_iec_11578; Get_GUID(uuid_iso_iec_11578, "uuid_iso_iec_11578"); switch (uuid_iso_iec_11578.hi) { case 0xB748D9E6BDE945DCLL : Element_Info1("x264"); sei_message_user_data_unregistered_x264(payloadSize-16); break; case 0x684E92AC604A57FBLL : Element_Info1("eavc"); sei_message_user_data_unregistered_x264(payloadSize-16); break; default : Element_Info1("unknown"); Skip_XX(payloadSize-16, "data"); } } //--------------------------------------------------------------------------- // SEI - 5 - x264 void File_Avc::sei_message_user_data_unregistered_x264(int32u payloadSize) { //Parsing Ztring Data; Peek_Local(payloadSize, Data); if (Data.size()!=payloadSize && Data.size()+1!=payloadSize) { Skip_XX(payloadSize, "Unknown"); return; //This is not a text string } size_t Data_Pos_Before=0; size_t Loop=0; do { size_t Data_Pos=Data.find(__T(" - "), Data_Pos_Before); if (Data_Pos==std::string::npos) Data_Pos=Data.size(); if (Data.find(__T("options: "), Data_Pos_Before)==Data_Pos_Before) { Element_Begin1("options"); size_t Options_Pos_Before=Data_Pos_Before; Encoded_Library_Settings.clear(); do { size_t Options_Pos=Data.find(__T(" "), Options_Pos_Before); if (Options_Pos==std::string::npos) Options_Pos=Data.size(); Ztring option; Get_Local (Options_Pos-Options_Pos_Before, option, "option"); Options_Pos_Before=Options_Pos; do { Ztring Separator; Peek_Local(1, Separator); if (Separator==__T(" ")) { Skip_Local(1, "separator"); Options_Pos_Before+=1; } else break; } while (Options_Pos_Before!=Data.size()); //Filling if (option!=__T("options:")) { if (!Encoded_Library_Settings.empty()) Encoded_Library_Settings+=__T(" / "); Encoded_Library_Settings+=option; if (option.find(__T("bitrate="))==0) BitRate_Nominal=option.substr(8)+__T("000"); //After "bitrate=" } } while (Options_Pos_Before!=Data.size()); Element_End0(); } else { Ztring Value; Get_Local(Data_Pos-Data_Pos_Before, Value, "data"); //Saving if (Loop==0) { //Cleaning a little the value while (!Value.empty() && Value[0]<0x30) Value.erase(Value.begin()); while (!Value.empty() && Value[Value.size()-1]<0x30) Value.erase(Value.end()-1); Encoded_Library=Value; } if (Loop==1 && Encoded_Library.find(__T("x264"))==0) { Encoded_Library+=__T(" - "); Encoded_Library+=Value; } } Data_Pos_Before=Data_Pos; if (Data_Pos_Before+3<=Data.size()) { Skip_Local(3, "separator"); Data_Pos_Before+=3; } Loop++; } while (Data_Pos_Before!=Data.size()); //Encoded_Library if (Encoded_Library.find(__T("eavc "))==0) { Encoded_Library_Name=__T("eavc"); Encoded_Library_Version=Encoded_Library.SubString(__T("eavc "), __T("")); } else if (Encoded_Library.find(__T("x264 - "))==0) { Encoded_Library_Name=__T("x264"); Encoded_Library_Version=Encoded_Library.SubString(__T("x264 - "), __T("")); } else if (Encoded_Library.find(__T("SUPER(C) by eRightSoft "))==0) { Encoded_Library_Name=__T("SUPER(C) by eRightSoft"); Encoded_Library_Date=Ztring(__T("UTC "))+Encoded_Library.SubString(__T("2000-"), __T(" ")); } else Encoded_Library_Name=Encoded_Library; } //--------------------------------------------------------------------------- // SEI - 6 void File_Avc::sei_message_recovery_point() { Element_Info1("recovery_point"); //Parsing BS_Begin(); Skip_UE( "recovery_frame_cnt"); Skip_SB( "exact_match_flag"); Skip_SB( "broken_link_flag"); Skip_S1(2, "changing_slice_group_idc"); BS_End(); } //--------------------------------------------------------------------------- // SEI - 32 void File_Avc::sei_message_mainconcept(int32u payloadSize) { Element_Info1("MainConcept text"); //Parsing Ztring Text; Get_Local(payloadSize, Text, "text"); if (Text.find(__T("produced by MainConcept H.264/AVC Codec v"))!=std::string::npos) { Encoded_Library=Text.SubString(__T("produced by "), __T(" MainConcept AG")); Encoded_Library_Name=__T("MainConcept H.264/AVC Codec"); Encoded_Library_Version=Text.SubString(__T("produced by MainConcept H.264/AVC Codec v"), __T(" (c) ")); Encoded_Library_Date=MediaInfoLib::Config.Library_Get(InfoLibrary_Format_MainConcept_Avc, Encoded_Library_Version, InfoLibrary_Date); } } //--------------------------------------------------------------------------- // Packet "07" void File_Avc::seq_parameter_set() { Element_Name("seq_parameter_set"); //parsing int32u seq_parameter_set_id; if (!seq_parameter_set_data(seq_parameter_sets, seq_parameter_set_id)) return; Mark_1( ); size_t BS_bits=Data_BS_Remain()%8; while (BS_bits) { Mark_0( ); BS_bits--; } BS_End(); //Hack for 00003.m2ts: There is a trailing 0x89, why? if (Element_Offset+1==Element_Size) { int8u ToTest; Peek_B1(ToTest); if (ToTest==0x98) Skip_B1( "Unknown"); } //Hack for : There is a trailing data, why? if (Element_Offset+4==Element_Size) { int32u ToTest; Peek_B4(ToTest); if (ToTest==0xE30633C0) Skip_B4( "Unknown"); } //NULL bytes while (Element_Offset::iterator seq_parameter_set_Item; if (seq_parameter_set_id>=seq_parameter_sets.size() || (*(seq_parameter_set_Item=seq_parameter_sets.begin()+seq_parameter_set_id))==NULL || !(*seq_parameter_set_Item)->IsSynched) { if (seq_parameter_set_id>=subset_seq_parameter_sets.size() || (*(seq_parameter_set_Item=subset_seq_parameter_sets.begin()+seq_parameter_set_id))==NULL || !(*seq_parameter_set_Item)->IsSynched) { //Not yet present Skip_BS(Data_BS_Remain(), "Data (seq_parameter_set is missing)"); return; } } Get_SB (entropy_coding_mode_flag, "entropy_coding_mode_flag"); Get_SB (bottom_field_pic_order_in_frame_present_flag, "bottom_field_pic_order_in_frame_present_flag"); Get_UE (num_slice_groups_minus1, "num_slice_groups_minus1"); if (num_slice_groups_minus1>7) { Trusted_IsNot("num_slice_groups_minus1 too high"); num_slice_groups_minus1=0; } if (num_slice_groups_minus1>0) { Get_UE (slice_group_map_type, "slice_group_map_type"); if (slice_group_map_type==0) { for (int32u Pos=0; Pos<=num_slice_groups_minus1; Pos++) Skip_UE( "run_length_minus1"); } else if (slice_group_map_type==2) { for (int32u Pos=0; Pos((*seq_parameter_set_Item)->pic_width_in_mbs_minus1+1)*((*seq_parameter_set_Item)->pic_height_in_map_units_minus1+1)) { Trusted_IsNot("pic_size_in_map_units_minus1 too high"); return; } #if defined (__mips__) || defined (__mipsel__) int32u slice_group_id_Size=(int32u)(std::ceil(std::log((double)(num_slice_groups_minus1+1))/std::log((double)10))); //std::log is natural logarithm #else int32u slice_group_id_Size=(int32u)(std::ceil(std::log((float32)(num_slice_groups_minus1+1))/std::log((float32)10))); //std::log is natural logarithm #endif for (int32u Pos=0; Pos<=pic_size_in_map_units_minus1; Pos++) Skip_BS(slice_group_id_Size, "slice_group_id"); } } Get_UE (num_ref_idx_l0_default_active_minus1, "num_ref_idx_l0_default_active_minus1"); Get_UE (num_ref_idx_l1_default_active_minus1, "num_ref_idx_l1_default_active_minus1"); Get_SB (weighted_pred_flag, "weighted_pred_flag"); Get_S1 (2, weighted_bipred_idc, "weighted_bipred_idc"); Skip_SE( "pic_init_qp_minus26"); Skip_SE( "pic_init_qs_minus26"); Skip_SE( "chroma_qp_index_offset"); Get_SB (deblocking_filter_control_present_flag, "deblocking_filter_control_present_flag"); Skip_SB( "constrained_intra_pred_flag"); Get_SB (redundant_pic_cnt_present_flag, "redundant_pic_cnt_present_flag"); bool more_rbsp_data=false; if (Element_Size) { int64u Offset=Element_Size-1; while (Offset && Buffer[Buffer_Offset+(size_t)Offset]==0x00) //Searching if there are NULL bytes at the end of the data Offset--; size_t Bit_Pos=7; while (Bit_Pos && !(Buffer[Buffer_Offset+(size_t)Offset]&(1<<(7-Bit_Pos)))) Bit_Pos--; if (Data_BS_Remain()>1+(7-Bit_Pos)+(Element_Size-Offset-1)*8) more_rbsp_data=true; } if (more_rbsp_data) { bool transform_8x8_mode_flag; Get_SB (transform_8x8_mode_flag, "transform_8x8_mode_flag"); TEST_SB_SKIP( "pic_scaling_matrix_present_flag"); for (int8u Pos=0; Pos<6+(transform_8x8_mode_flag?((*seq_parameter_set_Item)->chroma_format_idc!=3?2:6):0); Pos++ ) { TEST_SB_SKIP( "pic_scaling_list_present_flag"); scaling_list(Pos<6?16:64); TEST_SB_END(); } TEST_SB_END(); Skip_SE( "second_chroma_qp_index_offset"); } Mark_1( ); BS_End(); while (Element_Offset=256) { Trusted_IsNot("pic_parameter_set_id not valid"); return; //Problem, not valid } if (seq_parameter_set_id>=31) { Trusted_IsNot("seq_parameter_set_id not valid"); return; //Problem, not valid } //NextCode NextCode_Clear(); NextCode_Add(0x05); NextCode_Add(0x06); if (!subset_seq_parameter_sets.empty()) NextCode_Add(0x14); //slice_layer_extension //Filling if (pic_parameter_set_id>=pic_parameter_sets.size()) pic_parameter_sets.resize(pic_parameter_set_id+1); std::vector::iterator pic_parameter_sets_Item=pic_parameter_sets.begin()+pic_parameter_set_id; delete *pic_parameter_sets_Item; *pic_parameter_sets_Item=new pic_parameter_set_struct(); (*pic_parameter_sets_Item)->IsSynched =true; (*pic_parameter_sets_Item)->seq_parameter_set_id =(int8u)seq_parameter_set_id; (*pic_parameter_sets_Item)->entropy_coding_mode_flag =entropy_coding_mode_flag; (*pic_parameter_sets_Item)->bottom_field_pic_order_in_frame_present_flag =bottom_field_pic_order_in_frame_present_flag; (*pic_parameter_sets_Item)->num_slice_groups_minus1 =(int32u)num_slice_groups_minus1; (*pic_parameter_sets_Item)->slice_group_map_type =(int32u)slice_group_map_type; (*pic_parameter_sets_Item)->num_ref_idx_l0_default_active_minus1 =(int8u)num_ref_idx_l0_default_active_minus1; (*pic_parameter_sets_Item)->num_ref_idx_l1_default_active_minus1 =(int8u)num_ref_idx_l1_default_active_minus1; (*pic_parameter_sets_Item)->weighted_pred_flag =weighted_pred_flag; (*pic_parameter_sets_Item)->weighted_bipred_idc =weighted_bipred_idc; (*pic_parameter_sets_Item)->deblocking_filter_control_present_flag =deblocking_filter_control_present_flag; (*pic_parameter_sets_Item)->redundant_pic_cnt_present_flag =redundant_pic_cnt_present_flag; //Autorisation of other streams if (!seq_parameter_sets.empty()) { for (int8u Pos=0x01; Pos<=0x06; Pos++) { Streams[Pos].Searching_Payload=true; //Coded slice... if (Streams[0x08].ShouldDuplicate) Streams[Pos].ShouldDuplicate=true; } } if (!subset_seq_parameter_sets.empty()) { Streams[0x14].Searching_Payload=true; //slice_layer_extension if (Streams[0x08].ShouldDuplicate) Streams[0x14].ShouldDuplicate=true; //slice_layer_extension } //Setting as OK if (!Status[IsAccepted]) Accept("AVC"); FILLING_END(); } //--------------------------------------------------------------------------- // Packet "09" void File_Avc::access_unit_delimiter() { Element_Name("access_unit_delimiter"); int8u primary_pic_type; BS_Begin(); Get_S1 ( 3, primary_pic_type, "primary_pic_type"); Param_Info1(Avc_primary_pic_type[primary_pic_type]); Mark_1_NoTrustError( ); //Found 1 file without this bit BS_End(); } //--------------------------------------------------------------------------- // Packet "09" void File_Avc::filler_data() { Element_Name("filler_data"); while (Element_Offset::iterator subset_seq_parameter_sets_Item=subset_seq_parameter_sets.begin()+subset_seq_parameter_set_id; if ((*subset_seq_parameter_sets_Item)->profile_idc==83 || (*subset_seq_parameter_sets_Item)->profile_idc==86) { //bool svc_vui_parameters_present_flag; seq_parameter_set_svc_extension(); /* The rest is not yet implemented Get_SB (svc_vui_parameters_present_flag, "svc_vui_parameters_present_flag"); if (svc_vui_parameters_present_flag) svc_vui_parameters_extension(); */ } else if ((*subset_seq_parameter_sets_Item)->profile_idc==118 || (*subset_seq_parameter_sets_Item)->profile_idc==128) { //bool mvc_vui_parameters_present_flag, additional_extension2_flag; Mark_1(); seq_parameter_set_mvc_extension(subset_seq_parameter_set_id); /* The rest is not yet implemented Get_SB (mvc_vui_parameters_present_flag, "mvc_vui_parameters_present_flag"); if (mvc_vui_parameters_present_flag) mvc_vui_parameters_extension(); Get_SB (additional_extension2_flag, "additional_extension2_flag"); if (additional_extension2_flag) { //Not handled, should skip all bits except 1 BS_End(); return; } */ } /* The rest is not yet implemented Mark_1( ); */ BS_End(); FILLING_BEGIN(); //NextCode NextCode_Clear(); NextCode_Add(0x08); //Autorisation of other streams Streams[0x08].Searching_Payload=true; //pic_parameter_set if (Streams[0x0F].ShouldDuplicate) Streams[0x08].ShouldDuplicate=true; //pic_parameter_set Streams[0x0A].Searching_Payload=true; //end_of_seq if (Streams[0x0F].ShouldDuplicate) Streams[0x0A].ShouldDuplicate=true; //end_of_seq Streams[0x0B].Searching_Payload=true; //end_of_stream if (Streams[0x0F].ShouldDuplicate) Streams[0x0B].ShouldDuplicate=true; //end_of_stream FILLING_END(); } //--------------------------------------------------------------------------- // Packet "14" void File_Avc::slice_layer_extension(bool svc_extension_flag) { Element_Name("slice_layer_extension"); //Parsing if (svc_extension_flag) { Skip_XX(Element_Size-Element_Offset, "slice_header_in_scalable_extension + slice_data_in_scalable_extension"); } else { BS_Begin(); slice_header(); slice_data(true); BS_End(); } } //*************************************************************************** // SubElements //*************************************************************************** //--------------------------------------------------------------------------- bool File_Avc::seq_parameter_set_data(std::vector &Data, int32u &Data_id) { //Parsing void* vui_parameters_Item=NULL; int32u chroma_format_idc=1, bit_depth_luma_minus8=0, bit_depth_chroma_minus8=0, log2_max_frame_num_minus4, pic_order_cnt_type, log2_max_pic_order_cnt_lsb_minus4=(int32u)-1, max_num_ref_frames, pic_width_in_mbs_minus1, pic_height_in_map_units_minus1, frame_crop_left_offset=0, frame_crop_right_offset=0, frame_crop_top_offset=0, frame_crop_bottom_offset=0; int8u profile_idc, level_idc; bool constraint_set3_flag, separate_colour_plane_flag=false, delta_pic_order_always_zero_flag=false, frame_mbs_only_flag, mb_adaptive_frame_field_flag=false; Get_B1 (profile_idc, "profile_idc"); BS_Begin(); Element_Begin1("constraints"); Skip_SB( "constraint_set0_flag"); Skip_SB( "constraint_set1_flag"); Skip_SB( "constraint_set2_flag"); Get_SB (constraint_set3_flag, "constraint_set3_flag"); Skip_SB( "reserved_zero_4bits"); Skip_SB( "reserved_zero_4bits"); Skip_SB( "reserved_zero_4bits"); Skip_SB( "reserved_zero_4bits"); Element_End0(); Get_S1 ( 8, level_idc, "level_idc"); Get_UE ( Data_id, "seq_parameter_set_id"); switch (profile_idc) { case 100 : case 110 : case 122 : case 244 : case 44 : case 83 : case 86 : case 118 : case 128 : //High profiles Element_Begin1("high profile specific"); Get_UE (chroma_format_idc, "chroma_format_idc"); Param_Info1C((chroma_format_idc<3), Avc_Colorimetry_format_idc[chroma_format_idc]); if (chroma_format_idc==3) Get_SB (separate_colour_plane_flag, "separate_colour_plane_flag"); Get_UE (bit_depth_luma_minus8, "bit_depth_luma_minus8"); Get_UE (bit_depth_chroma_minus8, "bit_depth_chroma_minus8"); Skip_SB( "qpprime_y_zero_transform_bypass_flag"); TEST_SB_SKIP( "seq_scaling_matrix_present_flag"); for (int32u Pos=0; Pos<8; Pos++) { TEST_SB_SKIP( "seq_scaling_list_present_flag"); scaling_list(Pos<6?16:64); TEST_SB_END(); } TEST_SB_END(); Element_End0(); break; default : ; } Get_UE (log2_max_frame_num_minus4, "log2_max_frame_num_minus4"); Get_UE (pic_order_cnt_type, "pic_order_cnt_type"); if (pic_order_cnt_type==0) Get_UE (log2_max_pic_order_cnt_lsb_minus4, "log2_max_pic_order_cnt_lsb_minus4"); else if (pic_order_cnt_type==1) { int32u num_ref_frames_in_pic_order_cnt_cycle; Get_SB (delta_pic_order_always_zero_flag, "delta_pic_order_always_zero_flag"); Skip_SE( "offset_for_non_ref_pic"); Skip_SE( "offset_for_top_to_bottom_field"); Get_UE (num_ref_frames_in_pic_order_cnt_cycle, "num_ref_frames_in_pic_order_cnt_cycle"); if (num_ref_frames_in_pic_order_cnt_cycle>=256) { Trusted_IsNot("num_ref_frames_in_pic_order_cnt_cycle too high"); return false; } for(int32u Pos=0; Pos=32) { Trusted_IsNot("seq_parameter_set_id not valid"); delete (seq_parameter_set_struct::vui_parameters_struct*)vui_parameters_Item; return false; //Problem, not valid } if (pic_order_cnt_type==0 && log2_max_pic_order_cnt_lsb_minus4>12) { Trusted_IsNot("log2_max_pic_order_cnt_lsb_minus4 not valid"); delete (seq_parameter_set_struct::vui_parameters_struct*)vui_parameters_Item; return false; //Problem, not valid } if (log2_max_frame_num_minus4>12) { Trusted_IsNot("log2_max_frame_num_minus4 not valid"); delete (seq_parameter_set_struct::vui_parameters_struct*)vui_parameters_Item; return false; //Problem, not valid } //Creating Data if (Data_id>=Data.size()) Data.resize(Data_id+1); std::vector::iterator Data_Item=Data.begin()+Data_id; delete *Data_Item; *Data_Item=new seq_parameter_set_struct(); //Filling from stream (*Data_Item)->IsSynched =true; (*Data_Item)->constraint_set3_flag =constraint_set3_flag; (*Data_Item)->profile_idc =profile_idc; (*Data_Item)->level_idc =level_idc; (*Data_Item)->chroma_format_idc =(int8u)chroma_format_idc; (*Data_Item)->separate_colour_plane_flag =separate_colour_plane_flag; (*Data_Item)->bit_depth_luma_minus8 =(int8u)bit_depth_luma_minus8; (*Data_Item)->bit_depth_chroma_minus8 =(int8u)bit_depth_chroma_minus8; (*Data_Item)->log2_max_frame_num_minus4 =(int8u)log2_max_frame_num_minus4; (*Data_Item)->pic_order_cnt_type =(int8u)pic_order_cnt_type; (*Data_Item)->log2_max_pic_order_cnt_lsb_minus4 =(int8u)log2_max_pic_order_cnt_lsb_minus4; (*Data_Item)->delta_pic_order_always_zero_flag =delta_pic_order_always_zero_flag; (*Data_Item)->max_num_ref_frames =(int8u)max_num_ref_frames; (*Data_Item)->pic_width_in_mbs_minus1 =pic_width_in_mbs_minus1; (*Data_Item)->pic_height_in_map_units_minus1 =pic_height_in_map_units_minus1; (*Data_Item)->frame_mbs_only_flag =frame_mbs_only_flag; (*Data_Item)->mb_adaptive_frame_field_flag =mb_adaptive_frame_field_flag; (*Data_Item)->frame_crop_left_offset =frame_crop_left_offset; (*Data_Item)->frame_crop_right_offset =frame_crop_right_offset; (*Data_Item)->frame_crop_top_offset =frame_crop_top_offset; (*Data_Item)->frame_crop_bottom_offset =frame_crop_bottom_offset; (*Data_Item)->vui_parameters =(seq_parameter_set_struct::vui_parameters_struct*)vui_parameters_Item; //Computing values (for speed) (*Data_Item)->pic_struct_FirstDetected =(int8u)-1; //For stats only, init size_t MaxNumber; switch (pic_order_cnt_type) { case 0 : MaxNumber=(*Data_Item)->MaxPicOrderCntLsb =(int32u)pow(2.0, (int)(log2_max_pic_order_cnt_lsb_minus4+4)); break; case 2 : MaxNumber=(*Data_Item)->MaxFrameNum =(int32u)pow(2.0, (int)(log2_max_frame_num_minus4+4)); MaxNumber*=2; break; default: Trusted_IsNot("Not supported"); return false; } if (MaxNumber>TemporalReferences_Reserved) { TemporalReferences.resize(4*MaxNumber); TemporalReferences_Reserved=MaxNumber; } FILLING_ELSE(); return false; FILLING_END(); return true; } //--------------------------------------------------------------------------- void File_Avc::scaling_list(int32u ScalingList_Size) { //From http://mpeg4ip.cvs.sourceforge.net/mpeg4ip/mpeg4ip/util/h264/main.cpp?revision=1.17&view=markup int32u lastScale=8, nextScale=8; for (int32u Pos=0; Posnum_reorder_frames=(int8u)num_reorder_frames; TEST_SB_END(); FILLING_BEGIN(); seq_parameter_set_struct::vui_parameters_struct* vui_parameters_Item=new seq_parameter_set_struct::vui_parameters_struct(); vui_parameters_Item_=vui_parameters_Item; vui_parameters_Item->aspect_ratio_info_present_flag=aspect_ratio_info_present_flag; if (aspect_ratio_info_present_flag) { vui_parameters_Item->aspect_ratio_idc=aspect_ratio_idc; if (aspect_ratio_idc==0xFF) { vui_parameters_Item->sar_width=sar_width; vui_parameters_Item->sar_height=sar_height; } } vui_parameters_Item->video_signal_type_present_flag=video_signal_type_present_flag; if (video_signal_type_present_flag) { vui_parameters_Item->video_format=video_format; vui_parameters_Item->colour_description_present_flag=colour_description_present_flag; if (colour_description_present_flag) { vui_parameters_Item->colour_primaries=colour_primaries; vui_parameters_Item->transfer_characteristics=transfer_characteristics; vui_parameters_Item->matrix_coefficients=matrix_coefficients; } } vui_parameters_Item->timing_info_present_flag=timing_info_present_flag; if (timing_info_present_flag) { vui_parameters_Item->num_units_in_tick=num_units_in_tick; vui_parameters_Item->time_scale=time_scale; vui_parameters_Item->fixed_frame_rate_flag=fixed_frame_rate_flag; } vui_parameters_Item->NAL=(seq_parameter_set_struct::vui_parameters_struct::xxl*)NAL; vui_parameters_Item->VCL=(seq_parameter_set_struct::vui_parameters_struct::xxl*)VCL; vui_parameters_Item->pic_struct_present_flag=pic_struct_present_flag; vui_parameters_Item->bitstream_restriction=bitstream_restriction; FILLING_ELSE(); delete (seq_parameter_set_struct::vui_parameters_struct::xxl*)NAL; delete (seq_parameter_set_struct::vui_parameters_struct::xxl*)VCL; delete bitstream_restriction; FILLING_END(); } //--------------------------------------------------------------------------- void File_Avc::hrd_parameters(void* &hrd_parameters_Item_) { //Parsing int32u cpb_cnt_minus1; int8u bit_rate_scale, cpb_size_scale, initial_cpb_removal_delay_length_minus1, cpb_removal_delay_length_minus1, dpb_output_delay_length_minus1, time_offset_length; Get_UE ( cpb_cnt_minus1, "cpb_cnt_minus1"); Get_S1 (4, bit_rate_scale, "bit_rate_scale"); Get_S1 (4, cpb_size_scale, "cpb_size_scale"); if (cpb_cnt_minus1>31) { Trusted_IsNot("cpb_cnt_minus1 too high"); cpb_cnt_minus1=0; } seq_parameter_set_struct::vui_parameters_struct::xxl* ToTest=new seq_parameter_set_struct::vui_parameters_struct::xxl(); hrd_parameters_Item_=ToTest; ToTest->SchedSel.resize(cpb_cnt_minus1+1); for (int32u SchedSelIdx=0; SchedSelIdx<=cpb_cnt_minus1; SchedSelIdx++) { Element_Begin1("ShedSel"); int32u bit_rate_value_minus1, cpb_size_value_minus1; Get_UE (bit_rate_value_minus1, "bit_rate_value_minus1"); ToTest->SchedSel[SchedSelIdx].bit_rate_value=(int32u)((bit_rate_value_minus1+1)*pow(2.0, 6+bit_rate_scale)); Param_Info2(ToTest->SchedSel[SchedSelIdx].bit_rate_value, " bps"); Get_UE (cpb_size_value_minus1, "cpb_size_value_minus1"); ToTest->SchedSel[SchedSelIdx].cpb_size_value=(int32u)((cpb_size_value_minus1+1)*pow(2.0, 4+cpb_size_scale)); Param_Info2(ToTest->SchedSel[SchedSelIdx].cpb_size_value, " bits"); Get_SB (ToTest->SchedSel[SchedSelIdx].cbr_flag, "cbr_flag"); Element_End0(); } Get_S1 (5, initial_cpb_removal_delay_length_minus1, "initial_cpb_removal_delay_length_minus1"); Get_S1 (5, cpb_removal_delay_length_minus1, "cpb_removal_delay_length_minus1"); Get_S1 (5, dpb_output_delay_length_minus1, "dpb_output_delay_length_minus1"); Get_S1 (5, time_offset_length, "time_offset_length"); //Validity test if (!Element_IsOK() || (ToTest->SchedSel.size()==1 && ToTest->SchedSel[0].bit_rate_value==64)) { delete ToTest; ToTest=NULL; hrd_parameters_Item_=NULL; //We do not trust this kind of data return; } //Filling ToTest->initial_cpb_removal_delay_length_minus1 =initial_cpb_removal_delay_length_minus1; ToTest->cpb_removal_delay_length_minus1 =cpb_removal_delay_length_minus1; ToTest->dpb_output_delay_length_minus1 =dpb_output_delay_length_minus1; ToTest->time_offset_length =time_offset_length; } //--------------------------------------------------------------------------- void File_Avc::nal_unit_header_svc_extension() { //Parsing Element_Begin1("nal_unit_header_svc_extension"); Skip_SB( "idr_flag"); Skip_S1( 6, "priority_id"); Skip_SB( "no_inter_layer_pred_flag"); Skip_S1( 3, "dependency_id"); Skip_S1( 4, "quality_id"); Skip_S1( 3, "temporal_id"); Skip_SB( "use_ref_base_pic_flag"); Skip_SB( "discardable_flag"); Skip_SB( "output_flag"); Skip_S1( 2, "reserved_three_2bits"); Element_End0(); } //--------------------------------------------------------------------------- void File_Avc::nal_unit_header_mvc_extension() { //Parsing Element_Begin1("nal_unit_header_mvc_extension"); Skip_SB( "non_idr_flag"); Skip_S1( 6, "priority_id"); Skip_S1(10, "view_id"); Skip_S1( 3, "temporal_id"); Skip_SB( "anchor_pic_flag"); Skip_SB( "inter_view_flag"); Skip_SB( "reserved_one_bit"); Element_End0(); } //--------------------------------------------------------------------------- void File_Avc::seq_parameter_set_svc_extension() { //Parsing Element_Begin1("seq_parameter_set_svc_extension"); //Skip_SB( ""); Element_End0(); } //--------------------------------------------------------------------------- void File_Avc::svc_vui_parameters_extension() { //Parsing Element_Begin1("svc_vui_parameters_extension"); //Skip_SB( ""); Element_End0(); } //--------------------------------------------------------------------------- void File_Avc::seq_parameter_set_mvc_extension(int32u subset_seq_parameter_sets_id) { //Parsing Element_Begin1("seq_parameter_set_mvc_extension"); int32u num_views_minus1; Get_UE (num_views_minus1, "num_views_minus1"); //Skip_SB( ""); Element_End0(); std::vector::iterator subset_seq_parameter_sets_Item=subset_seq_parameter_sets.begin()+subset_seq_parameter_sets_id; FILLING_BEGIN(); (*subset_seq_parameter_sets_Item)->num_views_minus1 =(int16u)num_views_minus1; FILLING_ELSE(); delete (*subset_seq_parameter_sets_Item); (*subset_seq_parameter_sets_Item)=NULL; FILLING_END(); } //--------------------------------------------------------------------------- void File_Avc::mvc_vui_parameters_extension() { //Parsing Element_Begin1("mvc_vui_parameters_extension"); Skip_SB( ""); Element_End0(); } //*************************************************************************** // Specific //*************************************************************************** //--------------------------------------------------------------------------- void File_Avc::SPS_PPS() { //Parsing int8u Profile, Level, seq_parameter_set_count, pic_parameter_set_count; if (SizedBlocks) Skip_B1( "Version"); Get_B1 (Profile, "Profile"); Skip_B1( "Compatible profile"); Get_B1 (Level, "Level"); BS_Begin(); Skip_S1(6, "Reserved"); Get_S1 (2, SizeOfNALU_Minus1, "Size of NALU length minus 1"); Skip_S1(3, "Reserved"); Get_S1 (5, seq_parameter_set_count, "seq_parameter_set count"); BS_End(); for (int8u Pos=0; PosElement_Size) { Trusted_IsNot("Size is wrong"); break; //There is an error } int64u Element_Offset_Save=Element_Offset; int64u Element_Size_Save=Element_Size; Buffer_Offset+=(size_t)Element_Offset_Save; Element_Offset=0; Element_Size=Size-(Size?1:0); Element_Code=0x07; //seq_parameter_set Data_Parse(); Buffer_Offset-=(size_t)Element_Offset_Save; Element_Offset=Element_Offset_Save+Size-1; Element_Size=Element_Size_Save; Element_End0(); } Get_B1 (pic_parameter_set_count, "pic_parameter_set count"); for (int8u Pos=0; PosElement_Size_Save-Element_Offset_Save) break; //There is an error Element_Code=0x08; //pic_parameter_set Data_Parse(); Buffer_Offset-=(size_t)Element_Offset_Save; Element_Offset=Element_Offset_Save+Size-1; Element_Size=Element_Size_Save; Element_End0(); } if (Element_Offsetprofile_idc || Level!=seq_parameter_sets[0]->level_idc)) MuxingMode=Ztring("Container profile=")+Ztring().From_Local(Avc_profile_idc(Profile))+__T("@")+Ztring().From_Number(((float)Level)/10, 1); MustParse_SPS_PPS=false; if (!Status[IsAccepted]) Accept("AVC"); FILLING_END(); } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- std::string File_Avc::GOP_Detect (std::string PictureTypes) { //Finding a string without blanks size_t PictureTypes_Limit=PictureTypes.find(' '); if (PictureTypes_Limit!=string::npos) { if (PictureTypes_Limit>PictureTypes.size()/2) PictureTypes.resize(PictureTypes_Limit); else { //Trim size_t TrimPos; TrimPos=PictureTypes.find_first_not_of(' '); if (TrimPos!=string::npos) PictureTypes.erase(0, TrimPos); TrimPos=PictureTypes.find_last_not_of(' '); if (TrimPos!=string::npos) PictureTypes.erase(TrimPos+1); //Finding the longest string ZtringList List; List.Separator_Set(0, __T(" ")); List.Write(Ztring().From_Local(PictureTypes)); size_t MaxLength=0; size_t MaxLength_Pos=0; for (size_t Pos=0; PosMaxLength) { MaxLength=List[Pos].size(); MaxLength_Pos=Pos; } PictureTypes=List[MaxLength_Pos].To_Local(); } } //Creating all GOP values std::vector GOPs; size_t GOP_Frame_Count=0; size_t GOP_BFrames_Max=0; size_t I_Pos1=PictureTypes.find('I'); while (I_Pos1!=std::string::npos) { size_t I_Pos2=PictureTypes.find('I', I_Pos1+1); if (I_Pos2!=std::string::npos) { std::vector P_Positions; size_t P_Position=I_Pos1; do { P_Position=PictureTypes.find('P', P_Position+1); if (P_Position1 && P_Positions[0]>I_Pos1+1 && P_Positions[P_Positions.size()-1]==I_Pos2-1) P_Positions.resize(P_Positions.size()-1); //Removing last P-Frame for next test, this is often a terminating P-Frame replacing a B-Frame Ztring GOP; bool IsOK=true; if (!P_Positions.empty()) { size_t Delta=P_Positions[0]-I_Pos1; for (size_t Pos=1; PosGOP_BFrames_Max) GOP_BFrames_Max=P_Positions[0]-I_Pos1; } } if (IsOK) { GOP+=__T("N=")+Ztring::ToZtring(I_Pos2-I_Pos1); GOPs.push_back(GOP); } else GOPs.push_back(Ztring()); //There is a problem, blank GOP_Frame_Count+=I_Pos2-I_Pos1; } I_Pos1=I_Pos2; } //Some clean up if (GOP_Frame_Count+GOP_BFrames_Max>Frame_Count && !GOPs.empty()) GOPs.resize(GOPs.size()-1); //Removing the last one, there may have uncomplete B-frame filling if (GOPs.size()>4) GOPs.erase(GOPs.begin()); //Removing the first one, it is sometime different and we have enough to deal with //Filling if (GOPs.size()>=4) { bool IsOK=true; for (size_t Pos=1; PosScanOrders.size()/2) ScanOrders.resize(ScanOrders_Limit); else { //Trim size_t TrimPos; TrimPos=ScanOrders.find_first_not_of(' '); if (TrimPos!=string::npos) ScanOrders.erase(0, TrimPos); TrimPos=ScanOrders.find_last_not_of(' '); if (TrimPos!=string::npos) ScanOrders.erase(TrimPos+1); //Finding the longest string ZtringList List; List.Separator_Set(0, __T(" ")); List.Write(Ztring().From_Local(ScanOrders)); size_t MaxLength=0; size_t MaxLength_Pos=0; for (size_t Pos=0; PosMaxLength) { MaxLength=List[Pos].size(); MaxLength_Pos=Pos; } ScanOrders=List[MaxLength_Pos].To_Local(); } } //Filling if (ScanOrders.find("TBTBTBTB")==0) return ("TFF"); if (ScanOrders.find("BTBTBTBT")==0) return ("BFF"); return string(); } } //NameSpace #endif //MEDIAINFO_AVC_YES MediaInfoLib/Source/MediaInfo/Video/File_Avc.h100777 0 0 37447 12226004262 14474 0/* 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. */ //--------------------------------------------------------------------------- #ifndef MediaInfo_AvcH #define MediaInfo_AvcH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include "MediaInfo/File__Duplicate.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Avc //*************************************************************************** class File_Avc : #if MEDIAINFO_DUPLICATE public File__Duplicate #else //MEDIAINFO_DUPLICATE public File__Analyze #endif //MEDIAINFO_DUPLICATE { public : //In int64u Frame_Count_Valid; bool FrameIsAlwaysComplete; bool MustParse_SPS_PPS; bool SizedBlocks; //Constructor/Destructor File_Avc(); ~File_Avc(); private : File_Avc(const File_Avc &File_Avc); //No copy //Structures - seq_parameter_set struct seq_parameter_set_struct { struct vui_parameters_struct { struct xxl { struct xxl_data { //HRD configuration int32u bit_rate_value; int32u cpb_size_value; bool cbr_flag; //sei_message_buffering_period int32u initial_cpb_removal_delay; int32u initial_cpb_removal_delay_offset; xxl_data() { //HRD configuration bit_rate_value=(int32u)-1; cpb_size_value=(int32u)-1; cbr_flag=true; //sei_message_buffering_period initial_cpb_removal_delay=(int32u)-1; initial_cpb_removal_delay_offset=(int32u)-1; } }; vector SchedSel; int8u initial_cpb_removal_delay_length_minus1; int8u cpb_removal_delay_length_minus1; int8u dpb_output_delay_length_minus1; int8u time_offset_length; }; struct bitstream_restriction_struct { int8u num_reorder_frames; }; xxl* NAL; xxl* VCL; bitstream_restriction_struct* bitstream_restriction; int32u num_units_in_tick; int32u time_scale; int16u sar_width; int16u sar_height; int8u aspect_ratio_idc; int8u video_format; int8u colour_primaries; int8u transfer_characteristics; int8u matrix_coefficients; bool aspect_ratio_info_present_flag; bool video_signal_type_present_flag; bool colour_description_present_flag; bool timing_info_present_flag; bool fixed_frame_rate_flag; bool pic_struct_present_flag; vui_parameters_struct() { NAL=NULL; VCL=NULL; bitstream_restriction=NULL; aspect_ratio_info_present_flag=false; video_signal_type_present_flag=false; colour_description_present_flag=false; timing_info_present_flag=false; fixed_frame_rate_flag=false; pic_struct_present_flag=false; } ~vui_parameters_struct() { delete NAL; //NAL=NULL; delete VCL; //VCL=NULL; delete bitstream_restriction; //bitstream_restriction=NULL; } }; vui_parameters_struct* vui_parameters; int32u pic_width_in_mbs_minus1; int32u pic_height_in_map_units_minus1; int32u frame_crop_left_offset; int32u frame_crop_right_offset; int32u frame_crop_top_offset; int32u frame_crop_bottom_offset; int32u MaxPicOrderCntLsb; //Computed value (for speed) int32u MaxFrameNum; //Computed value (for speed) int16u num_views_minus1; //MultiView specific field int8u chroma_format_idc; int8u profile_idc; int8u level_idc; int8u bit_depth_luma_minus8; int8u bit_depth_chroma_minus8; int8u log2_max_frame_num_minus4; int8u pic_order_cnt_type; int8u log2_max_pic_order_cnt_lsb_minus4; int8u max_num_ref_frames; int8u pic_struct_FirstDetected; //For stats only int8u log2_max_slice_group_change_cycle_minus4; bool constraint_set3_flag; bool separate_colour_plane_flag; bool delta_pic_order_always_zero_flag; bool frame_mbs_only_flag; bool mb_adaptive_frame_field_flag; bool IsSynched; //Computed value //Computed values bool NalHrdBpPresentFlag() {return vui_parameters && vui_parameters->NAL;} bool VclHrdBpPresentFlag() {return vui_parameters && vui_parameters->VCL;} bool CpbDpbDelaysPresentFlag() {return vui_parameters && (vui_parameters->NAL || vui_parameters->VCL);} int8u ChromaArrayType() {return separate_colour_plane_flag?0:chroma_format_idc;} #if MEDIAINFO_DEMUX int8u* Iso14496_10_Buffer; size_t Iso14496_10_Buffer_Size; #endif //MEDIAINFO_DEMUX //Constructor/Destructor #if MEDIAINFO_DEMUX seq_parameter_set_struct() { Iso14496_10_Buffer=NULL; Iso14496_10_Buffer_Size=0; } #endif //MEDIAINFO_DEMUX ~seq_parameter_set_struct() { delete vui_parameters; //vui_parameters=NULL; #if MEDIAINFO_DEMUX delete[] Iso14496_10_Buffer; #endif //MEDIAINFO_DEMUX } }; typedef vector seq_parameter_set_structs; //Structures - pic_parameter_set struct pic_parameter_set_struct { int8u seq_parameter_set_id; int8u num_ref_idx_l0_default_active_minus1; int8u num_ref_idx_l1_default_active_minus1; int8u weighted_bipred_idc; int32u num_slice_groups_minus1; int32u slice_group_map_type; bool entropy_coding_mode_flag; bool bottom_field_pic_order_in_frame_present_flag; bool weighted_pred_flag; bool redundant_pic_cnt_present_flag; bool IsSynched; //Computed value bool deblocking_filter_control_present_flag; #if MEDIAINFO_DEMUX int8u* Iso14496_10_Buffer; size_t Iso14496_10_Buffer_Size; #endif //MEDIAINFO_DEMUX //Constructor/Destructor #if MEDIAINFO_DEMUX pic_parameter_set_struct() { Iso14496_10_Buffer=NULL; Iso14496_10_Buffer_Size=0; } #endif //MEDIAINFO_DEMUX ~pic_parameter_set_struct() { #if MEDIAINFO_DEMUX delete[] Iso14496_10_Buffer; #endif //MEDIAINFO_DEMUX } }; typedef vector pic_parameter_set_structs; //Streams management void Streams_Fill(); void Streams_Fill(vector::iterator seq_parameter_set_Item); void Streams_Fill_subset(vector::iterator seq_parameter_set_Item); void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); //Buffer - Synchro bool Synchronize(); bool Synched_Test(); void Synched_Init(); //Buffer - Demux #if MEDIAINFO_DEMUX bool Demux_UnpacketizeContainer_Test(); bool Demux_Avc_Transcode_Iso14496_15_to_Iso14496_10; #endif //MEDIAINFO_DEMUX //Buffer - Global void Read_Buffer_Unsynched(); //Buffer - Per element void Header_Parse(); bool Header_Parser_QuickSearch(); bool Header_Parser_Fill_Size(); void Data_Parse(); #if MEDIAINFO_DUPLICATE //Output buffer size_t Output_Buffer_Get (const String &Value); size_t Output_Buffer_Get (size_t Pos); #endif //MEDIAINFO_DUPLICATE //Options void Option_Manage (); //Elements void slice_layer_without_partitioning_IDR(); void slice_layer_without_partitioning_non_IDR(); void slice_header(); void slice_data (bool AllCategories); void seq_parameter_set(); void pic_parameter_set(); void sei(); void sei_message(int32u &seq_parameter_set_id); void sei_message_buffering_period(int32u &seq_parameter_set_id); void sei_message_buffering_period_xxl(void* xxl); void sei_message_pic_timing(int32u payloadSize, int32u seq_parameter_set_id); void sei_message_user_data_registered_itu_t_t35(); void sei_message_user_data_registered_itu_t_t35_DTG1(); void sei_message_user_data_registered_itu_t_t35_GA94(); void sei_message_user_data_registered_itu_t_t35_GA94_03(); void sei_message_user_data_registered_itu_t_t35_GA94_03_Delayed(int32u seq_parameter_set_id); void sei_message_user_data_registered_itu_t_t35_GA94_06(); void sei_message_user_data_unregistered(int32u payloadSize); void sei_message_user_data_unregistered_x264(int32u payloadSize); void sei_message_recovery_point(); void sei_message_mainconcept(int32u payloadSize); void access_unit_delimiter(); void filler_data(); void prefix_nal_unit(bool svc_extension_flag); void subset_seq_parameter_set(); void slice_layer_extension(bool svc_extension_flag); //Packets - SubElements bool seq_parameter_set_data(vector &Data, int32u &Data_id); void seq_parameter_set_svc_extension(); void seq_parameter_set_mvc_extension(int32u subset_seq_parameter_sets_id); void scaling_list(int32u ScalingList_Size); void vui_parameters(void* &vui_parameters_Item); void svc_vui_parameters_extension(); void mvc_vui_parameters_extension(); void hrd_parameters(void* &hrd_parameters_Item); void nal_unit_header_svc_extension(); void nal_unit_header_mvc_extension(); void ref_pic_list_modification(int32u slice_type, bool mvc); void pred_weight_table(int32u num_ref_idx_l0_active_minus1, int32u num_ref_idx_l1_active_minus1, int8u ChromaArrayType); void dec_ref_pic_marking(vector &memory_management_control_operations); //Packets - Specific void SPS_PPS(); //Streams struct stream { bool Searching_Payload; bool ShouldDuplicate; stream() { Searching_Payload=false; ShouldDuplicate=false; } }; vector Streams; //Temporal references struct temporal_reference { struct buffer_data { size_t Size; int8u* Data; buffer_data() { Size=0; Data=NULL; } ~buffer_data() { delete[] Data; //Data=NULL; } }; #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) buffer_data* GA94_03; #endif //MEDIAINFO_DTVCCTRANSPORT_YES int32u frame_num; int8u slice_type; bool IsTop; bool IsField; temporal_reference() { #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) GA94_03=NULL; #endif //MEDIAINFO_DTVCCTRANSPORT_YES slice_type=(int8u)-1; } ~temporal_reference() { #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) delete GA94_03; //GA94_03=NULL; #endif //MEDIAINFO_DTVCCTRANSPORT_YES } }; typedef vector temporal_references; temporal_references TemporalReferences; //per pic_order_cnt_lsb temporal_reference* TemporalReferences_DelayedElement; size_t TemporalReferences_Min; size_t TemporalReferences_Max; size_t TemporalReferences_Reserved; size_t TemporalReferences_Offset; size_t TemporalReferences_Offset_pic_order_cnt_lsb_Last; int64s TemporalReferences_pic_order_cnt_Min; //Text #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) File__Analyze* GA94_03_Parser; bool GA94_03_IsPresent; #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) //Replacement of File__Analyze buffer const int8u* Buffer_ToSave; size_t Buffer_Size_ToSave; //parameter_sets seq_parameter_set_structs seq_parameter_sets; seq_parameter_set_structs subset_seq_parameter_sets; pic_parameter_set_structs pic_parameter_sets; //File specific int8u SizeOfNALU_Minus1; //Status size_t IFrame_Count; int32s prevPicOrderCntMsb; int32u prevPicOrderCntLsb; int32u prevTopFieldOrderCnt; int32u prevFrameNum; int32u prevFrameNumOffset; vector prevMemoryManagementControlOperations; //Count of a Packets size_t Block_Count; size_t Interlaced_Top; size_t Interlaced_Bottom; size_t Structure_Field; size_t Structure_Frame; //Temp Ztring Encoded_Library; Ztring Encoded_Library_Name; Ztring Encoded_Library_Version; Ztring Encoded_Library_Date; Ztring Encoded_Library_Settings; Ztring BitRate_Nominal; Ztring MuxingMode; string PictureTypes_PreviousFrames; int64u tc; int32u Firstpic_order_cnt_lsbInBlock; int8u nal_ref_idc; int8u FrameRate_Divider; bool FirstPFrameInGop_IsParsed; //Helpers string GOP_Detect (string PictureTypes); string ScanOrder_Detect (string ScanOrders); #if MEDIAINFO_DUPLICATE bool File__Duplicate_Set (const Ztring &Value); //Fill a new File__Duplicate value void File__Duplicate_Write (int64u Element_Code, int32u frame_num=(int32u)-1); File__Duplicate__Writer Writer; int8u Duplicate_Buffer[1024*1024]; size_t Duplicate_Buffer_Size; size_t frame_num_Old; bool SPS_PPS_AlreadyDone; bool FLV; #endif //MEDIAINFO_DUPLICATE }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Video/File_Avc_Duplicate.cpp100777 0 0 22061 12226004262 17003 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Duplication helper for some specific formats // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AVC_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_Avc.h" #include "MediaInfo/MediaInfo_Config.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "ZenLib/ZtringList.h" #include "ZenLib/File.h" #include using namespace ZenLib; using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Options //*************************************************************************** //--------------------------------------------------------------------------- void File_Avc::Option_Manage() { #if MEDIAINFO_DUPLICATE //File__Duplicate configuration if (File__Duplicate_HasChanged()) { //Autorisation of other streams Streams[0x07].ShouldDuplicate=true; } #endif //MEDIAINFO_DUPLICATE } //*************************************************************************** // Set //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DUPLICATE bool File_Avc::File__Duplicate_Set (const Ztring &Value) { ZtringList List(Value); //Searching Target bool IsForUs=false; std::vector Targets_ToAdd; std::vector Targets_ToRemove; std::vector Orders_ToAdd; std::vector Orders_ToRemove; for (ZtringList::iterator Current=List.begin(); Currentfind(__T('-'))==0) { ToRemove=true; Current->erase(Current->begin()); } //Managing targets if (Current->find(__T("file:"))==0 || Current->find(__T("memory:"))==0) (ToRemove?Targets_ToRemove:Targets_ToAdd).push_back(Current); //Parser name else if (Current->find(__T("parser=Avc"))==0) IsForUs=true; //Managing orders else (ToRemove?Orders_ToRemove:Orders_ToAdd).push_back(Current); } //For us? if (!IsForUs) return false; //Configuration of initial values frame_num_Old=(int32u)-1; Duplicate_Buffer_Size=0; SPS_PPS_AlreadyDone=false; FLV=false; //For each target to add for (std::vector::iterator Target=Targets_ToAdd.begin(); Target::iterator Order=Orders_ToAdd.begin(); Orderprofile_idc:0x00; //Compatible Profile. TODO: Handling more than 1 seq_parameter_set SPS_SQS[2]=0x00; //Reserved } else { SPS_SQS[0]=(!seq_parameter_sets.empty() && seq_parameter_sets[0])?seq_parameter_sets[0]->profile_idc:0x00; //Profile MPEG-4. TODO: Handling more than 1 seq_parameter_set SPS_SQS[1]=0x00; //Compatible Profile } SPS_SQS[2+Extra]=(!seq_parameter_sets.empty() && seq_parameter_sets[0])?seq_parameter_sets[0]->level_idc:0x00; //Level. TODO: Handling more than 1 seq_parameter_set SPS_SQS[3+Extra]=0xFF; //Reserved + Size of NALU length minus 1 SPS_SQS[4+Extra]=0xE1; //Reserved + seq_parameter_set count Writer.Write(SPS_SQS, 5+Extra); //NALU int8u NALU[2]; NALU[0]=((Duplicate_Buffer_Size)>> 8)&0xFF; NALU[1]=((Duplicate_Buffer_Size)>> 0)&0xFF; Writer.Write(NALU, 2); //SPS Writer.Write(Duplicate_Buffer, Duplicate_Buffer_Size); Duplicate_Buffer_Size=0; //PPS count SPS_SQS[0]=0x01; //pic_parameter_set count Writer.Write(SPS_SQS, 1); delete[] SPS_SQS; //NALU NALU[0]=((ToAdd_Size)>> 8)&0xFF; NALU[1]=((ToAdd_Size)>> 0)&0xFF; Writer.Write(NALU, 2); //PPS Writer.Write(ToAdd, ToAdd_Size); SPS_PPS_AlreadyDone=true; } } else if (frame_num!=(int32u)-1) { if (frame_num!=frame_num_Old && frame_num_Old!=(int32u)-1 && frame_num!=(int32u)-1) { // Form: // 8 bytes : PTS // 8 bytes : DTS // 8 bytes : Size (without header) // 1 byte : Type (0=Frame, 1=Header); // 7 bytes : Reserved int8u Header[32]; int64u2BigEndian(Header+ 0, FrameInfo.PTS); int64u2BigEndian(Header+ 8, FrameInfo.DTS); int64u2BigEndian(Header+16, Duplicate_Buffer_Size); Header[24]=0; int56u2BigEndian(Header+25, 0); Writer.Write(Header, 32); Writer.Write(Duplicate_Buffer, Duplicate_Buffer_Size); Duplicate_Buffer_Size=0; } //NALU int32u2BigEndian(Duplicate_Buffer+Duplicate_Buffer_Size, (int32u)ToAdd_Size); //4 bytes for NALU header Duplicate_Buffer_Size+=4; //Frame (partial) std::memcpy(Duplicate_Buffer+Duplicate_Buffer_Size, ToAdd, ToAdd_Size); Duplicate_Buffer_Size+=ToAdd_Size; frame_num_Old=frame_num; } } #endif //MEDIAINFO_DUPLICATE //*************************************************************************** // Output_Buffer //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DUPLICATE size_t File_Avc::Output_Buffer_Get (const String &) { return Writer.Output_Buffer_Get(); } #endif //MEDIAINFO_DUPLICATE //--------------------------------------------------------------------------- #if MEDIAINFO_DUPLICATE size_t File_Avc::Output_Buffer_Get (size_t) { return Writer.Output_Buffer_Get(); } #endif //MEDIAINFO_DUPLICATE } //NameSpace #endif //MEDIAINFO_AVC_YES MediaInfoLib/Source/MediaInfo/Video/File_AvsV.cpp100777 0 0 73060 12226004262 15164 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AVSV_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_AvsV.h" #undef FILLING_BEGIN #define FILLING_BEGIN() \ while (Element_Offset0) //Only if we have at least one progressive_frame definition { if (progressive_sequence || progressive_frame_Count==Frame_Count) { Fill(Stream_Video, 0, Video_ScanType, "Progressive"); Fill(Stream_Video, 0, Video_Interlacement, "PPF"); } else { Fill(Stream_Video, 0, Video_ScanType, "Interlaced"); if ((Interlaced_Top && Interlaced_Bottom) || (!Interlaced_Top && !Interlaced_Bottom)) Fill(Stream_Video, 0, Video_Interlacement, "Interlaced"); else { Fill(Stream_Video, 0, Video_ScanOrder, Interlaced_Top?"TFF":"BFF"); Fill(Stream_Video, 0, Video_Interlacement, Interlaced_Top?"TFF":"BFF"); } } } Fill(Stream_Video, 0, Video_BitRate_Nominal, bit_rate*8); //From extensions Fill(Stream_Video, 0, Video_Standard, AvsV_video_format[video_format]); //Library name if (!Library.empty()) { Fill(Stream_Video, 0, Video_Encoded_Library, Library); Fill(Stream_Video, 0, Video_Encoded_Library_Name, Library_Name); Fill(Stream_Video, 0, Video_Encoded_Library_Version, Library_Version); Fill(Stream_Video, 0, Video_Encoded_Library_Date, Library_Date); } } //--------------------------------------------------------------------------- void File_AvsV::Streams_Finish() { //Purge what is not needed anymore if (!File_Name.empty()) //Only if this is not a buffer, with buffer we can have more data Streams.clear(); } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_AvsV::Synched_Test() { //Must have enough buffer for having header if (Buffer_Offset+3>Buffer_Size) return false; //Quick test of synchro if (CC3(Buffer+Buffer_Offset)!=0x000001) Synched=false; //Quick search if (Synched && !Header_Parser_QuickSearch()) return false; //We continue return true; } //--------------------------------------------------------------------------- void File_AvsV::Synched_Init() { //Count of a Packets progressive_frame_Count=0; Interlaced_Top=0; Interlaced_Bottom=0; //Temp bit_rate=0; horizontal_size=0; vertical_size=0; display_horizontal_size=0; display_vertical_size=0; profile_id=0; level_id=0; chroma_format=0; aspect_ratio=0; frame_rate_code=0; video_format=5; //Unspecified video format progressive_sequence=false; low_delay=false; //Default stream values Streams.resize(0x100); Streams[0xB0].Searching_Payload=true; //video_sequence_start for (int8u Pos=0xFF; Pos>=0xB9; Pos--) Streams[Pos].Searching_Payload=true; //Testing MPEG-PS } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_AvsV::Header_Parse() { //Parsing int8u start_code; Skip_B3( "synchro"); Get_B1 (start_code, "start_code"); if (!Header_Parser_Fill_Size()) { Element_WaitForMoreData(); return; } //Filling Header_Fill_Code(start_code, Ztring().From_CC1(start_code)); } //--------------------------------------------------------------------------- bool File_AvsV::Header_Parser_QuickSearch() { while ( Buffer_Offset+4<=Buffer_Size && Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x00 && Buffer[Buffer_Offset+2]==0x01) { //Getting start_code int8u start_code=Buffer[Buffer_Offset+3]; //Searching start or timestamp if (Streams[start_code].Searching_Payload) return true; //Synchronizing Buffer_Offset+=4; Synched=false; if (!Synchronize_0x000001()) { UnSynched_IsNotJunk=true; return false; } } if (Buffer_Offset+3==Buffer_Size) return false; //Sync is OK, but start_code is not available Trusted_IsNot("AVS Video, Synchronisation lost"); return Synchronize(); } //--------------------------------------------------------------------------- bool File_AvsV::Header_Parser_Fill_Size() { //Look for next Sync word if (Buffer_Offset_Temp==0) //Buffer_Offset_Temp is not 0 if Header_Parse_Fill_Size() has already parsed first frames Buffer_Offset_Temp=Buffer_Offset+4; while (Buffer_Offset_Temp+4<=Buffer_Size && CC3(Buffer+Buffer_Offset_Temp)!=0x000001) { Buffer_Offset_Temp+=2; while(Buffer_Offset_Temp=Buffer_Size || Buffer[Buffer_Offset_Temp-1]==0x00) Buffer_Offset_Temp--; } //Must wait more data? if (Buffer_Offset_Temp+4>Buffer_Size) { if (FrameIsAlwaysComplete || File_Offset+Buffer_Size==File_Size) Buffer_Offset_Temp=Buffer_Size; //We are sure that the next bytes are a start else return false; } //OK, we continue Header_Fill_Size(Buffer_Offset_Temp-Buffer_Offset); Buffer_Offset_Temp=0; return true; } //--------------------------------------------------------------------------- void File_AvsV::Data_Parse() { //Parsing switch (Element_Code) { case 0xB0: video_sequence_start(); break; case 0xB1: video_sequence_end(); break; case 0xB2: user_data_start(); break; case 0xB5: extension_start(); break; case 0xB3: case 0xB6: picture_start(); break; case 0xB7: video_edit(); break; case 0xB4: case 0xB8: reserved(); break; default: if (Element_Code>=0x00 && Element_Code<=0xAF) slice(); else { if (Frame_Count==0 && Buffer_TotalBytes>Buffer_TotalBytes_FirstSynched_Max) Trusted=0; Trusted_IsNot("Unattended element"); } } if (File_Offset+Buffer_Offset+Element_Size==File_Size && Frame_Count>0 && Count_Get(Stream_Video)==0) //Finalize frames in case of there are less than Frame_Count_Valid frames { //No need of more Accept("AVS Video"); Finish("AVS Video"); } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- // Packet "00" to "AF" void File_AvsV::slice() { Element_Name("Slice"); //Parsing Skip_XX(Element_Size, "Unknown"); FILLING_BEGIN(); //NextCode NextCode_Test(); FILLING_END(); } //--------------------------------------------------------------------------- // Packet "B0" void File_AvsV::video_sequence_start() { Element_Name("video_sequence_start"); //Parsing int32u bit_rate_upper, bit_rate_lower; Get_B1 ( profile_id, "profile_id"); Get_B1 ( level_id, "level_id"); BS_Begin(); Get_SB ( progressive_sequence, "progressive_sequence"); Get_S2 (14, horizontal_size, "horizontal_size"); Get_S2 (14, vertical_size, "vertical_size"); Get_S1 ( 2, chroma_format, "chroma_format"); Skip_S1( 3, "sample_precision"); Get_S1 ( 4, aspect_ratio, "aspect_ratio"); Param_Info1(AvsV_aspect_ratio[aspect_ratio]); Get_S1 ( 4, frame_rate_code, "frame_rate_code"); Param_Info1(AvsV_frame_rate[frame_rate_code]); Get_S3 (18, bit_rate_lower, "bit_rate_lower"); Mark_1 (); Get_S3 (12, bit_rate_upper, "bit_rate_upper"); bit_rate=(bit_rate_upper<<18)+bit_rate_lower; Param_Info2(bit_rate*8, " bps"); Get_SB ( low_delay, "low_delay"); Mark_1 (); Skip_S3(18, "bbv_buffer_size"); Skip_SB( "reserved"); Skip_SB( "reserved"); Skip_SB( "reserved"); BS_End(); //Not sure, but the 3 first official files have this if (Element_Size-Element_Offset) { BS_Begin(); Mark_1(); BS_End(); } FILLING_BEGIN(); //NextCode NextCode_Clear(); NextCode_Add(0xB2); //user_data_start NextCode_Add(0xB3); //picture_start (I) NextCode_Add(0xB5); //extension_start //Autorisation of other streams Streams[0xB1].Searching_Payload=true, //video_sequence_end Streams[0xB2].Searching_Payload=true; //user_data_start Streams[0xB3].Searching_Payload=true, //picture_start (I) Streams[0xB4].Searching_Payload=true, //reserved Streams[0xB5].Searching_Payload=true; //extension_start Streams[0xB6].Searching_Payload=true, //picture_start (P or B) Streams[0xB7].Searching_Payload=true; //video_edit Streams[0xB8].Searching_Payload=true, //reserved video_sequence_start_IsParsed=true; FILLING_END(); } //--------------------------------------------------------------------------- // Packet "B1" void File_AvsV::video_sequence_end() { Element_Name("video_sequence_start"); FILLING_BEGIN(); //NextCode NextCode_Clear(); NextCode_Add(0xB0); //SeqenceHeader FILLING_END(); } //--------------------------------------------------------------------------- // Packet "B2", User defined size, this is often used of library name void File_AvsV::user_data_start() { Element_Name("user_data_start"); //Rejecting junk from the end size_t Library_End_Offset=(size_t)Element_Size; while (Library_End_Offset>0 && (Buffer[Buffer_Offset+Library_End_Offset-1]<0x20 || Buffer[Buffer_Offset+Library_End_Offset-1]>0x7D || (Buffer[Buffer_Offset+Library_End_Offset-1]>=0x3A && Buffer[Buffer_Offset+Library_End_Offset-1]<=0x40))) Library_End_Offset--; if (Library_End_Offset==0) return; //No good info //Accepting good data after junk size_t Library_Start_Offset=Library_End_Offset-1; while (Library_Start_Offset>0 && (Buffer[Buffer_Offset+Library_Start_Offset-1]>=0x20 && Buffer[Buffer_Offset+Library_Start_Offset-1]<=0x7D)) Library_Start_Offset--; //But don't accept non-alpha caracters at the beginning (except for "3ivx") if (Library_End_Offset-Library_Start_Offset!=4 || CC4(Buffer+Buffer_Offset+Library_Start_Offset)!=0x33697678) //3ivx while (Library_Start_Offset0) Skip_XX(Library_Start_Offset, "junk"); if (Library_End_Offset-Library_Start_Offset) Get_Local(Library_End_Offset-Library_Start_Offset, Temp,"data"); if (Element_Offset=4) Library=Temp; FILLING_END(); } //--------------------------------------------------------------------------- // Packet "B5" void File_AvsV::extension_start() { Element_Name("Extension"); //Parsing int8u extension_start_code_identifier; BS_Begin(); Get_S1 ( 4, extension_start_code_identifier, "extension_start_code_identifier"); Param_Info1(AvsV_extension_start_code_identifier[extension_start_code_identifier]); Element_Info1(AvsV_extension_start_code_identifier[extension_start_code_identifier]); switch (extension_start_code_identifier) { case 2 :{ //sequence_display //Parsing Get_S1 ( 3, video_format, "video_format"); Param_Info1(AvsV_video_format[video_format]); Skip_SB( "sample_range"); TEST_SB_SKIP( "colour_description"); Skip_S1( 8, "colour_primaries"); Skip_S1( 8, "transfer_characteristics"); Skip_S1( 8, "matrix_coefficients"); TEST_SB_END(); Get_S2 (14, display_horizontal_size, "display_horizontal_size"); Mark_1 (); Get_S2 (14, display_vertical_size, "display_vertical_size"); Skip_SB( "reserved"); Skip_SB( "reserved"); BS_End(); } break; case 4 :{ //copyright //Parsing Skip_SB( "copyright_flag"); Skip_S1( 8, "copyright_id"); Skip_SB( "original_or_copy"); Skip_S1( 7, "reserved"); Mark_1 (); Info_S3(20, copyright_number_1, "copyright_number_1"); Mark_1 (); Info_S3(22, copyright_number_2, "copyright_number_2"); Mark_1 (); Info_S3(22, copyright_number_3, "copyright_number_3"); Param_Info1(Ztring::ToZtring(((int64u)copyright_number_1<<44)+((int64u)copyright_number_2<<22)+(int64u)copyright_number_3, 16)); BS_End(); } break; case 11 :{ //camera_parameters //Parsing Skip_SB( "reserved"); Skip_S1( 7, "camera_id"); Mark_1 (); Skip_S3(22, "height_of_image_device"); Mark_1 (); Skip_S3(22, "focal_length"); Mark_1 (); Skip_S3(22, "f_number"); Mark_1 (); Skip_S3(22, "vertical_angle_of_view"); Mark_1 (); Skip_S3(16, "camera_position_x_upper"); Mark_1 (); Skip_S3(16, "camera_position_x_lower"); Mark_1 (); Skip_S3(16, "camera_position_y_upper"); Mark_1 (); Skip_S3(16, "camera_position_y_lower"); Mark_1 (); Skip_S3(16, "camera_position_z_upper"); Mark_1 (); Skip_S3(16, "camera_position_z_lower"); Mark_1 (); Skip_S3(22, "camera_direction_x"); Mark_1 (); Skip_S3(22, "camera_direction_y"); Mark_1 (); Skip_S3(22, "camera_direction_z"); Mark_1 (); Skip_S3(22, "camera_plane_vertical_x"); Mark_1 (); Skip_S3(22, "camera_plane_vertical_y"); Mark_1 (); Skip_S3(22, "camera_plane_vertical_z"); Mark_1 (); Skip_S4(32, "reserved"); BS_End(); } break; default:{ //Parsing Skip_S1(4, "data"); BS_End(); Skip_XX(Element_Size-Element_Offset, "data"); } } //Not sure, but the 3 first official files have this if (Element_Size-Element_Offset) { BS_Begin(); Mark_1(); BS_End(); } FILLING_BEGIN(); //NextCode NextCode_Test(); FILLING_END(); } //--------------------------------------------------------------------------- // 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_Info1(Ztring::ToZtring(Frame_Count)); Element_Info1C((Element_Code==0xB3), __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_Info1(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(); } //--------------------------------------------------------------------------- // Packet "B7" void File_AvsV::video_edit() { Element_Name("video_edit"); } //--------------------------------------------------------------------------- // Packet "B4" and "B8" void File_AvsV::reserved() { Element_Name("reserved"); //Parsing if (Element_Size) Skip_XX(Element_Size, "reserved"); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_AVSV_* MediaInfoLib/Source/MediaInfo/Video/File_AvsV.h100777 0 0 6720 12226004262 14610 0/* 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 AVS Video files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_AvsVH #define MediaInfo_AvsVH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include "MediaInfo/Multiple/File_Mpeg4.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Avs //*************************************************************************** class File_AvsV : public File__Analyze { public : //In int64u Frame_Count_Valid; bool FrameIsAlwaysComplete; //constructor/Destructor File_AvsV(); private : //Streams management void Streams_Fill(); void Streams_Finish(); //Buffer - File header bool FileHeader_Begin() {return FileHeader_Begin_0x000001();} //Buffer - Synchro bool Synchronize() {return Synchronize_0x000001();} bool Synched_Test(); void Synched_Init(); //Buffer - Per element void Header_Parse(); bool Header_Parser_QuickSearch(); bool Header_Parser_Fill_Size(); void Data_Parse(); //Elements void slice(); void video_sequence_start(); void video_sequence_end(); void user_data_start(); void extension_start(); void picture_start(); void video_edit(); void reserved(); //Count of a Packets size_t progressive_frame_Count; size_t Interlaced_Top; size_t Interlaced_Bottom; //From user_data Ztring Library; Ztring Library_Name; Ztring Library_Version; Ztring Library_Date; //Temp int32u bit_rate; //From video_sequence_start int16u horizontal_size; //From video_sequence_start int16u vertical_size; //From video_sequence_start int16u display_horizontal_size; //From sequence_display int16u display_vertical_size; //From sequence_display int8u profile_id; //From video_sequence_start int8u level_id; //From video_sequence_start int8u chroma_format; //From video_sequence_start int8u aspect_ratio; //From video_sequence_start int8u frame_rate_code; //From video_sequence_start int8u video_format; //From sequence_display bool progressive_sequence; //From video_sequence_start bool low_delay; //From video_sequence_start bool video_sequence_start_IsParsed; //From video_sequence_start //Streams struct stream { bool Searching_Payload; stream() { Searching_Payload=false; } }; std::vector Streams; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Video/File_Canopus.cpp100777 0 0 20407 12234235017 15715 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_CANOPUS_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_Canopus.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Canopus::File_Canopus() :File__Analyze() { //Configuration ParserName=__T("Canopus"); } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Canopus::Streams_Fill() { Stream_Prepare(Stream_Video); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Canopus::Read_Buffer_Continue() { //Parsing int32u PAR_X=0, PAR_Y=0, FieldOrder=(int32u)-1; while (Element_OffsetElement_Size) { Skip_XX(Element_Size-Element_Offset, "Problem"); Element_End0(); return; } Skip_L4( "Unknown"); Skip_L4( "Unknown"); Get_L4 (PAR_X, "PAR_X"); Get_L4 (PAR_Y, "PAR_Y"); while (Element_OffsetInfo_End) { Skip_XX(Info_End-Element_Offset, "Problem"); break; } if (Element_OffsetInfo_End) { Skip_XX(Info_End-Element_Offset, "Problem"); break; } while (Element_OffsetParseSpeed<1.0) Finish(); } FILLING_END(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_CANOPUS_YES MediaInfoLib/Source/MediaInfo/Video/File_Canopus.h100777 0 0 2451 12226004262 15336 0/* 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 Canopus streams // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_CanopusH #define MediaInfo_File_CanopusH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Theora //*************************************************************************** class File_Canopus : public File__Analyze { public : //Constructor/Destructor File_Canopus(); private : //Streams management void Streams_Fill(); //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Video/File_Dirac.cpp100777 0 0 103572 12226004262 15351 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_DIRAC_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_Dirac.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- const char* Dirac_base_video_format(intu base_video_format) { switch (base_video_format) { case 1 : return "QSIF525"; case 2 : return "QCIF"; case 3 : return "SIF525"; case 4 : return "CIF"; case 5 : return "4SIF525"; case 6 : return "4CIF"; case 7 : return "480i60"; case 8 : return "576i50"; case 9 : return "720p50"; case 10 : return "720p60"; case 11 : return "1080i60"; case 12 : return "1080i50"; case 13 : return "1080p60"; case 14 : return "1080p60"; case 15 : return "2K-24"; case 16 : return "4K-24"; case 17 : return "4K-60"; case 18 : return "4K-50"; case 19 : return "8K-60"; case 20 : return "8K-50"; default : return ""; } } //--------------------------------------------------------------------------- float32 Dirac_frame_rate(int32u frame_rate_index) { switch (frame_rate_index) { case 0 : return (float32)0; //Reserved case 1 : return (float32)24000/(float32)1001; case 2 : return (float32)24; case 3 : return (float32)25; case 4 : return (float32)30000/(float32)1001; case 5 : return (float32)30; case 6 : return (float32)50; case 7 : return (float32)60000/(float32)1001; case 8 : return (float32)60; case 9 : return (float32)15000/(float32)1001; case 10 : return (float32)12.5; default : return (float32)0; //Unknown } } //--------------------------------------------------------------------------- float32 Dirac_pixel_aspect_ratio(int32u pixel_aspect_ratio_index) { switch (pixel_aspect_ratio_index) { case 0 : return (float32)0; //Reserved case 1 : return (float32)1; //Reserved case 2 : return (float32)10/(float32)11; case 3 : return (float32)12/(float32)11; case 4 : return (float32)40/(float32)33; case 5 : return (float32)16/(float32)11; case 6 : return (float32) 4/(float32) 3; default : return (float32)0; //Unknown } } //--------------------------------------------------------------------------- const char* Dirac_picture_coding_mode(int32u picture_coding_mode) { switch (picture_coding_mode) { case 0 : return "PPF"; case 1 : return "Interlaced"; default: return ""; } } //--------------------------------------------------------------------------- const char* Dirac_source_sampling(int32u source_sampling) { switch (source_sampling) { case 0 : return "Progressive"; case 1 : return "Interlaced"; default: return ""; } } //--------------------------------------------------------------------------- const char* Dirac_source_sampling_Codec(int32u source_sampling) { switch (source_sampling) { case 0 : return "PPF"; case 1 : return "Interlaced"; default: return ""; } } //--------------------------------------------------------------------------- const char* Dirac_chroma_format(int32u chroma_format) { switch (chroma_format) { case 0 : return "4:4:4"; case 1 : return "4:2:2"; case 2 : return "4:2:0"; default: return ""; } } //--------------------------------------------------------------------------- void Dirac_base_video_format(int32u base_video_format, int32u &frame_width, int32u &frame_height, int32u &chroma_format, int32u &source_sampling, int32u &clean_width, int32u &clean_height, int32u &clean_left_offset, int32u &clean_top_offset, float32 &frame_rate, float32 &pixel_aspect_ratio) { switch (base_video_format) { case 0 : frame_width=640; frame_height=480; chroma_format=2; source_sampling=0; clean_width=640; clean_height=480; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(1); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(1); return; case 1 : frame_width=176; frame_height=120; chroma_format=2; source_sampling=0; clean_width=176; clean_height=144; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(9); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(2); return; case 2 : frame_width=176; frame_height=144; chroma_format=2; source_sampling=0; clean_width=176; clean_height=144; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(10); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(3); return; case 3 : frame_width=352; frame_height=240; chroma_format=2; source_sampling=0; clean_width=352; clean_height=240; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(9); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(2); return; case 4 : frame_width=352; frame_height=288; chroma_format=2; source_sampling=0; clean_width=352; clean_height=288; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(10); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(3); return; case 5 : frame_width=704; frame_height=480; chroma_format=2; source_sampling=0; clean_width=704; clean_height=480; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(9); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(2); return; case 6 : frame_width=704; frame_height=576; chroma_format=2; source_sampling=0; clean_width=704; clean_height=576; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(10); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(3); return; case 7 : frame_width=720; frame_height=480; chroma_format=1; source_sampling=1; clean_width=704; clean_height=480; clean_left_offset=8; clean_top_offset=0; frame_rate=Dirac_frame_rate(4); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(2); return; case 8 : frame_width=720; frame_height=576; chroma_format=1; source_sampling=1; clean_width=704; clean_height=576; clean_left_offset=8; clean_top_offset=0; frame_rate=Dirac_frame_rate(3); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(3); return; case 9 : frame_width=1280; frame_height=720; chroma_format=1; source_sampling=0; clean_width=1280; clean_height=720; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(7); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(1); return; case 10 : frame_width=1280; frame_height=720; chroma_format=1; source_sampling=0; clean_width=1280; clean_height=720; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(6); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(1); return; case 11 : frame_width=1920; frame_height=1080; chroma_format=1; source_sampling=1; clean_width=1920; clean_height=1080; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(4); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(1); return; case 12 : frame_width=1920; frame_height=1080; chroma_format=1; source_sampling=1; clean_width=1920; clean_height=1080; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(3); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(1); return; case 13 : frame_width=1920; frame_height=1080; chroma_format=1; source_sampling=0; clean_width=1920; clean_height=1080; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(7); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(1); return; case 14 : frame_width=1920; frame_height=1080; chroma_format=1; source_sampling=0; clean_width=1920; clean_height=1080; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(6); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(1); return; case 15 : frame_width=2048; frame_height=1080; chroma_format=0; source_sampling=0; clean_width=2048; clean_height=1080; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(2); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(1); return; case 16 : frame_width=4096; frame_height=2160; chroma_format=0; source_sampling=0; clean_width=4096; clean_height=2160; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(2); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(1); return; case 17 : frame_width=3840; frame_height=2160; chroma_format=0; source_sampling=0; clean_width=3840; clean_height=2160; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(7); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(1); return; case 18 : frame_width=3840; frame_height=2160; chroma_format=0; source_sampling=0; clean_width=3840; clean_height=2160; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(6); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(1); return; case 19 : frame_width=7680; frame_height=4320; chroma_format=0; source_sampling=0; clean_width=7680; clean_height=4320; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(7); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(1); return; case 20 : frame_width=7680; frame_height=4320; chroma_format=0; source_sampling=0; clean_width=7680; clean_height=4320; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate(6); pixel_aspect_ratio=Dirac_pixel_aspect_ratio(1); return; default : frame_width=0; frame_height=0; chroma_format=(int32u)-1; source_sampling=(int32u)-1; clean_width=0; clean_height=0; clean_left_offset=0; clean_top_offset=0; frame_rate=Dirac_frame_rate((int32u)-1); pixel_aspect_ratio=Dirac_pixel_aspect_ratio((int32u)-1); return; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Dirac::File_Dirac() :File__Analyze() { //Configuration MustSynchronize=true; Buffer_TotalBytes_FirstSynched_Max=64*1024; //In Frame_Count_Valid=1; Ignore_End_of_Sequence=false; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Dirac::Streams_Fill() { Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "Dirac"); Fill(Stream_Video, 0, Video_Codec, "Dirac"); if (clean_width) Fill(Stream_Video, StreamPos_Last, Video_Width, clean_width); if (clean_height) Fill(Stream_Video, StreamPos_Last, Video_Height, clean_height); if (pixel_aspect_ratio) { Fill(Stream_Video, 0, Video_PixelAspectRatio, pixel_aspect_ratio, 3, true); if (clean_height!=0) Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, ((float)clean_width)/clean_height*pixel_aspect_ratio, 3, true); } if (frame_rate) Fill(Stream_Video, StreamPos_Last, Video_FrameRate, frame_rate); Fill(Stream_Video, 0, Video_Colorimetry, Dirac_chroma_format(chroma_format)); Fill(Stream_Video, 0, Video_ScanType, Dirac_source_sampling(source_sampling)); Fill(Stream_Video, 0, Video_Interlacement, Dirac_source_sampling_Codec(source_sampling)); } //--------------------------------------------------------------------------- void File_Dirac::Streams_Finish() { //Purge what is not needed anymore if (!File_Name.empty()) //Only if this is not a buffer, with buffer we can have more data Streams.clear(); } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Dirac::Synchronize() { //Synchronizing while(Buffer_Offset+4<=Buffer_Size && (Buffer[Buffer_Offset ]!=0x42 || Buffer[Buffer_Offset+1]!=0x42 || Buffer[Buffer_Offset+2]!=0x43 || Buffer[Buffer_Offset+3]!=0x44)) //"BBCD" { Buffer_Offset+=2; while(Buffer_Offset=Buffer_Size || Buffer[Buffer_Offset-1]==0x42) Buffer_Offset--; } //Parsing last bytes if needed if (Buffer_Offset+4>Buffer_Size) { if (Buffer_Offset+3==Buffer_Size && CC3(Buffer+Buffer_Offset)!=0x424243) //"BBC" Buffer_Offset++; if (Buffer_Offset+2==Buffer_Size && CC2(Buffer+Buffer_Offset)!=0x4242) //"BB" Buffer_Offset++; if (Buffer_Offset+1==Buffer_Size && CC1(Buffer+Buffer_Offset)!=0x42) //"B" Buffer_Offset++; return false; } //Synched is OK return true; } //--------------------------------------------------------------------------- bool File_Dirac::Synched_Test() { //Must have enough buffer for having header if (Buffer_Offset+4>Buffer_Size) return false; //Quick test of synchro if (CC4(Buffer+Buffer_Offset)!=0x42424344) //"BBCD" Synched=false; //Quick search if (Synched && !Header_Parser_QuickSearch()) return false; //We continue return true; } //--------------------------------------------------------------------------- void File_Dirac::Synched_Init() { //Temp Dirac_base_video_format((int32u)-1, frame_width, frame_height, chroma_format, source_sampling, clean_width, clean_height, clean_left_offset, clean_top_offset, frame_rate, pixel_aspect_ratio); //Default stream values Streams.resize(0x100); Streams[0x00].Searching_Payload=true; //Sequence header } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Dirac::Header_Parse() { //Parsing int32u Next_Parse_Offset, Previous_Parse_Offset; int8u Parse_Code; Skip_C4( "Parse Info Prefix"); Get_B1 (Parse_Code, "Parse Code"); Get_B4 (Next_Parse_Offset, "Next Parse Offset"); Get_B4 (Previous_Parse_Offset, "Previous Parse Offset"); //Filling Header_Fill_Code(Parse_Code, Ztring().From_CC1(Parse_Code)); Header_Fill_Size((Parse_Code==0x10 && Next_Parse_Offset==0)?13:Next_Parse_Offset); //Speacial case if this is the End Of Sequence } //--------------------------------------------------------------------------- bool File_Dirac::Header_Parser_QuickSearch() { while ( Buffer_Offset+5<=Buffer_Size && Buffer[Buffer_Offset ]==0x42 && Buffer[Buffer_Offset+1]==0x42 && Buffer[Buffer_Offset+2]==0x43 && Buffer[Buffer_Offset+3]==0x44) //"BBCD" { //Getting start_code int8u start_code=CC1(Buffer+Buffer_Offset+4); //Searching start if (Streams[start_code].Searching_Payload) return true; //Getting size Buffer_Offset+=BigEndian2int32u(Buffer+Buffer_Offset+5); } if (Buffer_Offset+4==Buffer_Size) return false; //Sync is OK, but start_code is not available if (Buffer_Offset+5<=Buffer_Size) Trusted_IsNot("Dirac, Synchronisation lost"); Synched=false; return Synchronize(); } //--------------------------------------------------------------------------- void File_Dirac::Data_Parse() { //Parsing switch (Element_Code) { case 0x00 : Sequence_header(); break; case 0x10 : End_of_Sequence(); break; case 0x20 : Auxiliary_data(); break; case 0x30 : Padding_data(); break; case 0x0C : Intra_Reference_Picture(); break; case 0x08 : Intra_Non_Reference_Picture(); break; case 0x4C : Intra_Reference_Picture_No(); break; case 0x48 : Intra_Non_Reference_Picture_No(); break; case 0x0D : Inter_Reference_Picture_1(); break; case 0x0E : Inter_Reference_Picture_2(); break; case 0x09 : Inter_Non_Reference_Picture_1(); break; case 0x0A : Inter_Non_Reference_Picture_2(); break; case 0xCC : Reference_Picture_Low(); break; case 0xC8 : Intra_Non_Reference_Picture_Low(); break; default : Reserved(); } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- // Packet "00" void File_Dirac::Sequence_header() { Element_Name("Sequence header"); //Parsing int32u version_major, version_minor, profile, level, base_video_format; BS_Begin(); Get_UI(version_major, "version major"); Get_UI(version_minor, "version minor"); Get_UI(profile, "profile"); Get_UI(level, "level"); if (version_major<=2) { Get_UI(base_video_format, "base video format"); //Param_Info1(Dirac_base_video_format(base_video_format)); Dirac_base_video_format(base_video_format, frame_width, frame_height, chroma_format, source_sampling, clean_width, clean_height, clean_left_offset, clean_top_offset, frame_rate, pixel_aspect_ratio); TEST_SB_SKIP( "custom dimensions flag"); Get_UI (frame_width, "frame width"); Get_UI (frame_height, "frame height"); TEST_SB_END(); TEST_SB_SKIP( "custom chroma format flag"); Get_UI (chroma_format, "chroma format"); Param_Info1(Dirac_chroma_format(chroma_format)); TEST_SB_END(); TEST_SB_SKIP( "custom scan format flag"); Get_UI (source_sampling, "source sampling"); Param_Info1(Dirac_source_sampling(source_sampling)); TEST_SB_END(); TEST_SB_SKIP( "frame rate flag"); int32u frame_rate_index; Get_UI (frame_rate_index, "index"); Param_Info1(Dirac_frame_rate(frame_rate_index)); if (frame_rate_index==0) { int32u frame_rate_numer, frame_rate_denom; Get_UI (frame_rate_numer, "frame rate numer"); Get_UI (frame_rate_denom, "frame rate denom"); frame_rate=((float32)frame_rate_numer)/((float32)frame_rate_denom); } else frame_rate=Dirac_frame_rate(frame_rate_index); TEST_SB_END(); TEST_SB_SKIP( "pixel aspect ratio flag"); int32u pixel_aspect_ratio_index; Get_UI (pixel_aspect_ratio_index, "index"); Param_Info1(Dirac_pixel_aspect_ratio(pixel_aspect_ratio_index)); if (pixel_aspect_ratio_index==0) { int32u pixel_aspect_ratio_numer, pixel_aspect_ratio_denom; Get_UI (pixel_aspect_ratio_numer, "pixel aspect ratio numer"); Get_UI (pixel_aspect_ratio_denom, "pixel aspect ratio denom"); pixel_aspect_ratio=((float32)pixel_aspect_ratio_numer)/((float32)pixel_aspect_ratio_denom); } else pixel_aspect_ratio=Dirac_pixel_aspect_ratio(pixel_aspect_ratio_index); TEST_SB_END(); TESTELSE_SB_SKIP( "custom clean area flag"); Get_UI (clean_width, "clean width"); Get_UI (clean_height, "clean height"); Get_UI (clean_left_offset, "clean left offset"); Get_UI (clean_top_offset, "clean top offset"); TESTELSE_SB_ELSE( "custom clean area flag"); clean_width=frame_width; clean_height=frame_height; TESTELSE_SB_END(); TEST_SB_SKIP( "custom signal range flag"); int32u custom_signal_range_index; Get_UI(custom_signal_range_index, "index"); if (custom_signal_range_index==0) { Skip_UI( "luma offset"); Skip_UI( "luma excursion"); Skip_UI( "chroma offset"); Skip_UI( "chroma excursion"); } TEST_SB_END(); TEST_SB_SKIP( "custom colour spec flag"); int32u custom_colour_spec_index; Get_UI(custom_colour_spec_index, "index"); if (custom_colour_spec_index==0) { TEST_SB_SKIP( "custom colour primaries flag"); Skip_UI( "custom colour primaries index"); TEST_SB_END(); TEST_SB_SKIP( "colour matrix flag"); Skip_UI( "colour matrix index"); TEST_SB_END(); TEST_SB_SKIP( "custom transfer function flag"); Skip_UI( "custom transfer function index"); TEST_SB_END(); } TEST_SB_END(); Info_UI(picture_coding_mode, "picture coding mode"); Param_Info1(Dirac_picture_coding_mode(picture_coding_mode)); } else { Skip_XX(Element_Size-Element_Offset, "Unknown"); } FILLING_BEGIN(); //Autorisation of other streams Streams[0x10].Searching_Payload=true; //End_of_Sequence Streams[0x20].Searching_Payload=true; //Auxiliary_data Streams[0x30].Searching_Payload=true; //Padding_data Streams[0x0C].Searching_Payload=true; //Intra_Reference_Picture Streams[0x08].Searching_Payload=true; //Intra_Non_Reference_Picture Streams[0x4C].Searching_Payload=true; //Intra_Reference_Picture_No Streams[0x48].Searching_Payload=true; //Intra_Non_Reference_Picture_No Streams[0x0D].Searching_Payload=true; //Inter_Reference_Picture_1 Streams[0x0E].Searching_Payload=true; //Inter_Reference_Picture_2 Streams[0x09].Searching_Payload=true; //Inter_Non_Reference_Picture_1 Streams[0x0A].Searching_Payload=true; //Inter_Non_Reference_Picture_2 Streams[0xCC].Searching_Payload=true; //Reference_Picture_Low Streams[0xC8].Searching_Payload=true; //Intra_Non_Reference_Picture_Low FILLING_END(); } //--------------------------------------------------------------------------- // Packet "10" void File_Dirac::End_of_Sequence() { Element_Name("End of Sequence"); //Parsing if (!Ignore_End_of_Sequence) { NextCode_Clear(); Accept("Dirac"); Finish("Dirac"); } } //--------------------------------------------------------------------------- // Packet "20" void File_Dirac::Auxiliary_data() { Element_Name("Auxiliary data"); //Parsing Skip_XX(Element_Size, "Auxiliary data"); } //--------------------------------------------------------------------------- // Packet "30" void File_Dirac::Padding_data() { Element_Name("Padding data"); //Parsing Skip_XX(Element_Size, "Padding data"); } //--------------------------------------------------------------------------- // Packet "0C" void File_Dirac::Intra_Reference_Picture() { Element_Name("Intra Reference Picture"); //Parsing picture(); } //--------------------------------------------------------------------------- // Packet "08" void File_Dirac::Intra_Non_Reference_Picture() { Element_Name("Intra Non Reference Picture"); //Parsing picture(); } //--------------------------------------------------------------------------- // Packet "4C" void File_Dirac::Intra_Reference_Picture_No() { Element_Name("Intra Reference Picture (no arithmetic coding)"); //Parsing picture(); } //--------------------------------------------------------------------------- // Packet "48" void File_Dirac::Intra_Non_Reference_Picture_No() { Element_Name("Intra Non Reference Picture (no arithmetic coding)"); //Parsing picture(); } //--------------------------------------------------------------------------- // Packet "0D" void File_Dirac::Inter_Reference_Picture_1() { Element_Name("Inter Reference Picture (1 picture)"); //Parsing picture(); } //--------------------------------------------------------------------------- // Packet "0E" void File_Dirac::Inter_Reference_Picture_2() { Element_Name("Inter Reference Picture (2 pictures)"); //Parsing picture(); } //--------------------------------------------------------------------------- // Packet "09" void File_Dirac::Inter_Non_Reference_Picture_1() { Element_Name("Inter Non Reference Picture (1 picture)"); //Parsing picture(); } //--------------------------------------------------------------------------- // Packet "0A" void File_Dirac::Inter_Non_Reference_Picture_2() { Element_Name("Inter Non Reference Picture (2 pictures)"); //Parsing picture(); } //--------------------------------------------------------------------------- // Packet "CC" void File_Dirac::Reference_Picture_Low() { Element_Name("Reference Picture (low-delay)"); //Parsing picture(); } //--------------------------------------------------------------------------- // Packet "C8" void File_Dirac::Intra_Non_Reference_Picture_Low() { Element_Name("Intra Non Reference Picture (low-delay)"); //Parsing picture(); } //--------------------------------------------------------------------------- void File_Dirac::Reserved() { Element_Name("Reserved"); Skip_XX(Element_Size, "Unknown"); } //--------------------------------------------------------------------------- void File_Dirac::picture() { //Parsing Skip_XX(Element_Size, "Data"); FILLING_BEGIN(); //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 //Name Element_Info1(Ztring::ToZtring(Frame_Count)); //Filling only if not already done Frame_Count++; Frame_Count_InThisBlock++; if (Frame_Count>=Frame_Count_Valid && Count_Get(Stream_Video)==0) { NextCode_Clear(); Accept("Dirac"); Finish("Dirac"); } FILLING_END(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_DIRAC_YES MediaInfoLib/Source/MediaInfo/Video/File_Dirac.h100777 0 0 5333 12226004262 14752 0/* 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 Dirac files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_DiracH #define MediaInfo_File_DiracH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Dirac //*************************************************************************** class File_Dirac : public File__Analyze { public : //In int64u Frame_Count_Valid; bool Ignore_End_of_Sequence; //Constructor/Destructor File_Dirac(); private : //Streams management void Streams_Fill(); void Streams_Finish(); //Buffer - File header bool FileHeader_Begin() {return FileHeader_Begin_0x000001();} //Buffer - Synchro bool Synchronize(); bool Synched_Test(); void Synched_Init(); //Buffer - Per element void Header_Parse(); bool Header_Parser_QuickSearch(); bool Header_Parser_Fill_Size(); void Data_Parse(); //Elements void Sequence_header(); void End_of_Sequence(); void Auxiliary_data(); void Padding_data(); void Intra_Reference_Picture(); void Intra_Non_Reference_Picture(); void Intra_Reference_Picture_No(); void Intra_Non_Reference_Picture_No(); void Inter_Reference_Picture_1(); void Inter_Reference_Picture_2(); void Inter_Non_Reference_Picture_1(); void Inter_Non_Reference_Picture_2(); void Reference_Picture_Low(); void Intra_Non_Reference_Picture_Low(); void Reserved(); void picture(); //Streams struct stream { bool Searching_Payload; stream() { Searching_Payload=false; } }; std::vector Streams; //Temp int32u frame_width; int32u frame_height; int32u chroma_format; int32u source_sampling; int32u clean_width; int32u clean_height; int32u clean_left_offset; int32u clean_top_offset; float32 frame_rate; float32 pixel_aspect_ratio; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Video/File_Flic.cpp100777 0 0 14123 12226004262 15155 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // From : http://www.compuphase.com/flic.htm // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_FLIC_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_Flic.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Format //*************************************************************************** //--------------------------------------------------------------------------- void File_Flic::FileHeader_Parse() { //Parsing int32u DelayBetweenFrames; int16u Type, Frames, Width, Height, BitsPerPixel, AspectX=0, AspectY=0; Skip_L4( "Size of FLIC including this header"); Get_L2 (Type, "File type"); Get_L2 (Frames, "Number of frames in first segment"); Get_L2 (Width, "Width"); Get_L2 (Height, "Height"); Get_L2 (BitsPerPixel, "Bits per pixel"); Skip_L2( "Flags"); Get_L4 (DelayBetweenFrames, "Delay between frames"); if (Type!=0xAF11) { Skip_L2( "Reserved"); Skip_L4( "Date of Creation)"); Skip_L4( "Serial number or compiler id"); Skip_L4( "Date of FLIC update"); Skip_L4( "Serial number"); Get_L2 (AspectX, "Width of square rectangle"); Get_L2 (AspectY, "Height of square rectangle"); } else Skip_XX(22, "Reserved"); Skip_L2( "EGI: flags for specific EGI extensions"); Skip_L2( "EGI: key-image frequency"); Skip_L2( "EGI: total number of frames (segments)"); Skip_L4( "EGI: maximum chunk size (uncompressed)"); Skip_L2( "EGI: max. number of regions in a CHK_REGION chunk"); Skip_L2( "EGI: number of transparent levels"); if (Type!=0xAF11) { Skip_XX(24, "Reserved"); Skip_L4( "Offset to frame 1"); Skip_L4( "Offset to frame 2"); Skip_XX(40, "Reserved"); } else Skip_XX(72, "Reserved"); //Filling FILLING_BEGIN(); switch (Type) { case 0xAF11 : case 0xAF12 : case 0xAF30 : case 0xAF31 : case 0xAF44 : break; default : Reject("FLIC"); return; } //Filling Accept("FLIC"); Fill(Stream_General, 0, General_Format, "FLIC"); Stream_Prepare(Stream_Video); if (Type==0xAF11) { Fill(Stream_Video, 0, Video_Format, "FLI"); Fill(Stream_Video, 0, Video_Codec, "FLI"); if (DelayBetweenFrames) { Fill(Stream_Video, StreamPos_Last, Video_FrameRate, 1000.0/(DelayBetweenFrames*70)); //multiple of 1/70 per frame Fill(Stream_Video, 0, Video_Duration, Frames*DelayBetweenFrames*70); } } else { Fill(Stream_Video, 0, Video_Format, "FLC"); Fill(Stream_Video, 0, Video_Codec, "FLC"); if (DelayBetweenFrames) { Fill(Stream_Video, StreamPos_Last, Video_FrameRate, 1000.0/DelayBetweenFrames); //ms per frame Fill(Stream_Video, 0, Video_Duration, Frames*DelayBetweenFrames); } if (AspectY>0) Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, AspectX/AspectY, 3, true); } Fill(Stream_Video, 0, Video_FrameCount, Frames); Fill(Stream_Video, StreamPos_Last, Video_Width, Width); Fill(Stream_Video, StreamPos_Last, Video_Height, Height); Fill(Stream_Video, 0, Video_BitDepth, (BitsPerPixel%3)?BitsPerPixel:(BitsPerPixel/3), 10, true); //If not a multiple of 3, the total resolution is filled //No more need data Finish("FLIC"); FILLING_END(); } } //NameSpace #endif //MEDIAINFO_FLIC_* MediaInfoLib/Source/MediaInfo/Video/File_Flic.h100777 0 0 2212 12226004262 14576 0/* 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 Flic files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_FlicH #define MediaInfo_FlicH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Flic //*************************************************************************** class File_Flic : public File__Analyze { private : //Buffer void FileHeader_Parse(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Video/File_Fraps.cpp100777 0 0 11234 12226004262 15353 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_FRAPS_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_Fraps.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Fraps::File_Fraps() :File__Analyze() { //Configuration ParserName=__T("Fraps"); } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Fraps::Streams_Fill() { Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "Fraps"); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Fraps::Read_Buffer_Continue() { //Parsing int8u version, flags; Get_L1 (version, "version"); Skip_L2( "unknown"); Get_L1 (flags, "flags"); if (flags&0x40) Skip_L4( "unknown"); switch (version) { case 0x00 : Version0(); break; case 0x01 : Version1(); break; case 0x02 : case 0x04 : Version2(); break; default : Skip_XX(Element_Size-Element_Offset, "data"); } Finish(); } //--------------------------------------------------------------------------- void File_Fraps::Version0() { //Parsing Skip_XX(Element_Size-Element_Offset, "data"); FILLING_BEGIN(); Accept(); Fill(); Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_ChromaSubsampling, "4:2:0"); Fill(Stream_Video, 0, Video_BitDepth, 8); FILLING_END(); } //--------------------------------------------------------------------------- void File_Fraps::Version1() { //Parsing Skip_XX(Element_Size-Element_Offset, "data"); FILLING_BEGIN(); Accept(); Fill(); Fill(Stream_Video, 0, Video_ColorSpace, "RGB"); Fill(Stream_Video, 0, Video_BitDepth, 8); FILLING_END(); } //--------------------------------------------------------------------------- void File_Fraps::Version2() { //Parsing if (Element_Size>8) //Else this is a repeat frame { Skip_C4( "FPSx"); Skip_L4( "offset to the Y plane (minus 8)"); Skip_L4( "offset to the U plane (minus 8)"); Skip_L4( "offset to the V plane (minus 8)"); Skip_XX(Element_Size-Element_Offset, "data"); } FILLING_BEGIN(); Accept(); Fill(); Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_BitDepth, 8); FILLING_END(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_FRAPS_YES MediaInfoLib/Source/MediaInfo/Video/File_Fraps.h100777 0 0 2556 12226004262 15007 0/* 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 Fraps files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_FrapsH #define MediaInfo_File_FrapsH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Fraps //*************************************************************************** class File_Fraps : public File__Analyze { public : //Constructor/Destructor File_Fraps(); private : //Streams management void Streams_Fill(); //Buffer - Global void Read_Buffer_Continue (); //Elements void Version0(); void Version1(); void Version2(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Video/File_H263.cpp100777 0 0 34663 12226004262 14735 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_H263_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_H263.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "ZenLib/BitStream.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* H263_Source_Format[]= { "", "sub-QCIF", "QCIF", "CIF", "4CIF", "16CIF", "", "", }; //--------------------------------------------------------------------------- const int16u H263_Source_Format_Width[]= { 0, 128, 176, 352, 704, 1408, 0, 0, }; //--------------------------------------------------------------------------- const int16u H263_Source_Format_Height[]= { 0, 96, 144, 288, 576, 1152, 0, 0, }; //--------------------------------------------------------------------------- const int8u H263_PAR_W[]= { 0, 12, 10, 16, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; const int8u H263_PAR_H[]= { 0, 11, 11, 11, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_H263::File_H263() :File__Analyze() { //Configuration ParserName=__T("H.263"); MustSynchronize=true; Buffer_TotalBytes_FirstSynched_Max=64*1024; IsRawStream=true; //In Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.3?8:2; FrameIsAlwaysComplete=false; } //--------------------------------------------------------------------------- File_H263::~File_H263() { } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_H263::Streams_Accept() { Stream_Prepare(Stream_Video); } //--------------------------------------------------------------------------- void File_H263::Streams_Update() { } //--------------------------------------------------------------------------- void File_H263::Streams_Fill() { Fill(Stream_General, 0, General_Format_Version, "H.263"); Fill(Stream_Video, 0, Video_Format, "H.263"); Fill(Stream_Video, 0, Video_Codec, "H.263"); Fill(Stream_Video, 0, Video_Width, H263_Source_Format_Width[Source_Format]); Fill(Stream_Video, 0, Video_Height, H263_Source_Format_Height[Source_Format]); Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_Colorimetry, "4:2:0"); Fill(Stream_Video, 0, Video_BitDepth, 8); Fill(Stream_Video, 0, Video_PixelAspectRatio, ((float32)PAR_W)/PAR_H, 3); } //--------------------------------------------------------------------------- void File_H263::Streams_Finish() { } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_H263::Synchronize() { //Synchronizing while(Buffer_Offset+3<=Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || (Buffer[Buffer_Offset+2]&0xFC)!=0x80)) { Buffer_Offset+=2; while(Buffer_Offset=Buffer_Size) Buffer_Offset--; } //Parsing last bytes if needed if (Buffer_Offset+3==Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || (Buffer[Buffer_Offset+2]&0xFC)!=0x80)) Buffer_Offset++; if (Buffer_Offset+2==Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00)) Buffer_Offset++; if (Buffer_Offset+1==Buffer_Size && Buffer[Buffer_Offset ]!=0x00) Buffer_Offset++; if (Buffer_Offset+3>Buffer_Size) return false; //Synched is OK Synched=true; return true; } //--------------------------------------------------------------------------- bool File_H263::Synched_Test() { //Must have enough buffer for having header if (Buffer_Offset+4>Buffer_Size) return false; //Quick test of synchro if (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || (Buffer[Buffer_Offset+2]&0xFC)!=0x80) { Synched=false; return true; } //We continue return true; } //--------------------------------------------------------------------------- void File_H263::Synched_Init() { //Temp PAR_W=12; PAR_H=11; Temporal_Reference_IsValid=false; } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_H263::Read_Buffer_Unsynched() { Temporal_Reference_IsValid=false; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_H263::Header_Parse() { Header_Fill_Code(0x00, "Frame"); Header_Parser_Fill_Size(); } //--------------------------------------------------------------------------- bool File_H263::Header_Parser_Fill_Size() { //Look for next Sync word if (Buffer_Offset_Temp==0) //Buffer_Offset_Temp is not 0 if Header_Parse_Fill_Size() has already parsed first frames Buffer_Offset_Temp=Buffer_Offset+3; while (Buffer_Offset_Temp+3<=Buffer_Size && (Buffer[Buffer_Offset_Temp ]!=0x00 || Buffer[Buffer_Offset_Temp+1]!=0x00 || (Buffer[Buffer_Offset_Temp+2]&0xFC)!=0x80)) { Buffer_Offset_Temp+=2; while(Buffer_Offset_Temp=Buffer_Size || Buffer[Buffer_Offset_Temp-1]==0x00) Buffer_Offset_Temp--; } //Must wait more data? if (Buffer_Offset_Temp+3>Buffer_Size) { if (FrameIsAlwaysComplete || File_Offset+Buffer_Size==File_Size) Buffer_Offset_Temp=Buffer_Size; //We are sure that the next bytes are a start else return false; } //OK, we continue Header_Fill_Size(Buffer_Offset_Temp-Buffer_Offset); Buffer_Offset_Temp=0; return true; } //--------------------------------------------------------------------------- void File_H263::Data_Parse() { //Parsing int8u Temporal_Reference_Temp; BS_Begin(); Skip_S3(22, "Picture Start Code (PSC)"); Get_S1 ( 8, Temporal_Reference_Temp, "Temporal Reference (TR)"); if (!Temporal_Reference_IsValid) { Temporal_Reference=Temporal_Reference_Temp; Temporal_Reference_IsValid=true; } else Temporal_Reference++; if (Temporal_Reference_Temp!=Temporal_Reference) { Trusted_IsNot("Out of Order"); Open_Buffer_Unsynch(); return; } Element_Begin1("Type Information (PTYPE)"); Mark_1(); Mark_0(); Skip_SB( "Split screen indicator"); Skip_SB( "Document camera indicator"); Skip_SB( "Full Picture Freeze Release"); Get_S1 (3, Source_Format, "Source Format"); Param_Info1(H263_Source_Format[Source_Format]); if (Source_Format!=7) { Skip_SB( "Picture Coding Type"); Skip_SB( "Unrestricted Motion Vector mode"); Skip_SB( "Syntax-based Arithmetic Coding mode"); Skip_SB( "Advanced Prediction mode"); Skip_SB( "PB-frames mode"); } Element_End0(); if (Source_Format==7) // Extended PTYPE { Element_Begin1("Plus PTYPE (PLUSPTYPE)"); int8u Ufep, PixelAspectRatioCode=0, Width=0, Height=0; Get_S1 ( 3, Ufep, "Update Full Extended PTYPE (UFEP)"); switch (Ufep) { case 0 : break; case 1 : Element_Begin1("Optional Part of PLUSPTYPE (OPPTYPE)"); Get_S1 (3, Source_Format, "Source Format"); Param_Info1(H263_Source_Format[Source_Format]); Skip_SB( "Custom PCF"); Skip_SB( "Unrestricted Motion Vector (UMV) mode"); Skip_SB( "Syntax-based Arithmetic Coding (SAC) mode"); Skip_SB( "Advanced Prediction (AP) mode"); Skip_SB( "Advanced INTRA Coding (AIC) mode"); Skip_SB( "Deblocking Filter (DF) mode"); Skip_SB( "Slice Structured (SS) mode"); Skip_SB( "Reference Picture Selection (RPS) mode"); Skip_SB( "Independent Segment Decoding (ISD) mode"); Skip_SB( "Alternative INTER VLC (AIV) mode"); Skip_SB( "Modified Quantization (MQ) mode"); Mark_1(); Mark_0(); Mark_0(); Mark_0(); Element_End0(); break; default : BS_End(); Skip_XX(Element_Size-Element_Offset, "Unknown"); return; //TODO: frame count... } Element_Begin1("mandatory part of PLUSPTYPE when PLUSPTYPE present (MPPTYPE)"); Skip_S1(3, "Picture Type Code"); Skip_SB( "Reference Picture Resampling (RPR) mode"); Skip_SB( "Reduced-Resolution Update (RRU) mode"); Skip_SB( "Rounding Type (RTYPE)"); Mark_0(); Mark_0(); Mark_1(); Element_End0(); Element_End0(); Skip_SB( "CPM"); Skip_S1(2, "PSBI"); Element_Begin1("Custom Picture Format (CPFMT)"); Get_S1 (4, PixelAspectRatioCode, "Pixel Aspect Ratio Code"); Get_S1 (4, Width, "Picture Width Indication"); Width++; Width<<=2; Param_Info2(Width, " pixels"); Mark_1(); Get_S1 (4, Height, "Picture Height Indication"); Height<<=2; Param_Info2(Height, " pixels"); Element_End0(); if (PixelAspectRatioCode==0xF) { Element_Begin1("Extended Pixel Aspect Ratio (EPAR)"); Get_S1 (8, PAR_W, "PAR Width"); Get_S1 (8, PAR_H, "PAR Height"); Element_End0(); } else { PAR_W=H263_PAR_W[PixelAspectRatioCode]; PAR_H=H263_PAR_H[PixelAspectRatioCode]; } } BS_End(); Skip_XX(Element_Size-Element_Offset, "Other data"); FILLING_BEGIN(); Element_Info1(Frame_Count); Frame_Count++; //Filling if (!Status[IsFilled] && Frame_Count>=Frame_Count_Valid) { Accept("H.263"); Finish("H.263"); } FILLING_END(); } } //NameSpace #endif //MEDIAINFO_H263_YES MediaInfoLib/Source/MediaInfo/Video/File_H263.h100777 0 0 3500 12226004262 14344 0/* 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 h.263 files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_H263H #define MediaInfo_H263H //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_H263 //*************************************************************************** class File_H263 : public File__Analyze { public : //In int64u Frame_Count_Valid; bool FrameIsAlwaysComplete; //Constructor/Destructor File_H263(); ~File_H263(); private : //Streams management void Streams_Accept(); void Streams_Update(); void Streams_Fill(); void Streams_Finish(); //Buffer - Synchro bool Synchronize(); bool Synched_Test(); void Synched_Init(); //Buffer - Global void Read_Buffer_Unsynched(); //Buffer - Per element void Header_Parse(); bool Header_Parser_Fill_Size(); void Data_Parse(); //Elements //Temp int8u Temporal_Reference; int8u Source_Format; int8u PAR_W; int8u PAR_H; bool Temporal_Reference_IsValid; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Video/File_Hevc.cpp100777 0 0 243427 12250742215 15224 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_HEVC_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_Hevc.h" #include #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "MediaInfo/MediaInfo_Events.h" #include "MediaInfo/MediaInfo_Events_Internal.h" #endif //MEDIAINFO_EVENTS using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Info //*************************************************************************** //--------------------------------------------------------------------------- const char* Hevc_profile_idc(int32u profile_idc) { switch (profile_idc) { case 0 : return "No profile"; case 1 : return "Main"; case 2 : return "Main 10"; case 3 : return "Main Still"; default : return "Unknown"; } } //--------------------------------------------------------------------------- const char* Hevc_chroma_format_idc(int8u chroma_format_idc) { switch (chroma_format_idc) { case 0 : return "monochrome"; case 1 : return "4:2:0"; case 2 : return "4:2:2"; case 3 : return "4:4:4"; default : return "Unknown"; } } //--------------------------------------------------------------------------- const char* Hevc_pic_type[]= { "I", "I, P", "I, P, B", "", "", "", "", "", "", "", }; //--------------------------------------------------------------------------- const char* Hevc_slice_type(int32u slice_type) { switch (slice_type) { case 0 : return "P"; case 1 : return "B"; case 2 : return "I"; default: return ""; } }; //--------------------------------------------------------------------------- extern const char* Mpegv_colour_primaries(int8u colour_primaries); extern const char* Mpegv_transfer_characteristics(int8u transfer_characteristics); extern const char* Mpegv_matrix_coefficients(int8u matrix_coefficients); //--------------------------------------------------------------------------- extern const int8u Avc_PixelAspectRatio_Size; extern const float32 Avc_PixelAspectRatio[]; extern const char* Avc_video_format[]; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Hevc::File_Hevc() { //Config #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Hevc; StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS #if MEDIAINFO_TRACE Trace_Layers_Update(8); //Stream #endif //MEDIAINFO_TRACE MustSynchronize=true; Buffer_TotalBytes_FirstSynched_Max=64*1024; PTS_DTS_Needed=true; IsRawStream=true; Frame_Count_NotParsedIncluded=0; //In Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.3?2:2; //Note: should be replaced by "512:2" when I-frame/GOP detection is OK FrameIsAlwaysComplete=false; MustParse_VPS_SPS_PPS=false; MustParse_VPS_SPS_PPS_FromMatroska=false; SizedBlocks=false; //File specific lengthSizeMinusOne=(int8u)-1; } //--------------------------------------------------------------------------- File_Hevc::~File_Hevc() { } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Hevc::Streams_Fill() { if (Count_Get(Stream_Video)==0) Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "HEVC"); Fill(Stream_Video, 0, Video_Codec, "HEVC"); for (std::vector::iterator seq_parameter_set_Item=seq_parameter_sets.begin(); seq_parameter_set_Item!=seq_parameter_sets.end(); ++seq_parameter_set_Item) if ((*seq_parameter_set_Item)) Streams_Fill(seq_parameter_set_Item); } //--------------------------------------------------------------------------- void File_Hevc::Streams_Fill(std::vector::iterator seq_parameter_set_Item) { Ztring Profile; if ((*seq_parameter_set_Item)->profile_space==0) { if ((*seq_parameter_set_Item)->profile_idc) Profile=Ztring().From_Local(Hevc_profile_idc((*seq_parameter_set_Item)->profile_idc)); if ((*seq_parameter_set_Item)->level_idc) { if ((*seq_parameter_set_Item)->profile_idc) Profile+=__T('@'); Profile+=__T('L')+Ztring().From_Number(((float)(*seq_parameter_set_Item)->level_idc)/30, 1); } } Fill(Stream_Video, 0, Video_Format_Profile, Profile); Fill(Stream_Video, 0, Video_Codec_Profile, Profile); Fill(Stream_Video, StreamPos_Last, Video_Width, (*seq_parameter_set_Item)->pic_width_in_luma_samples); Fill(Stream_Video, StreamPos_Last, Video_Height, (*seq_parameter_set_Item)->pic_height_in_luma_samples); //Fill(Stream_Video, 0, Video_PixelAspectRatio, PixelAspectRatio, 3, true); //Fill(Stream_Video, 0, Video_DisplayAspectRatio, Width*PixelAspectRatio/Height, 3, true); //More precise Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_Colorimetry, Hevc_chroma_format_idc((*seq_parameter_set_Item)->chroma_format_idc)); if ((*seq_parameter_set_Item)->bit_depth_luma_minus8==(*seq_parameter_set_Item)->bit_depth_chroma_minus8) Fill(Stream_Video, 0, Video_BitDepth, (*seq_parameter_set_Item)->bit_depth_luma_minus8+8); } //--------------------------------------------------------------------------- void File_Hevc::Streams_Finish() { } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Hevc::FileHeader_Begin() { if (!File__Analyze::FileHeader_Begin_0x000001()) return false; if (!MustSynchronize) { Synched_Init(); Buffer_TotalBytes_FirstSynched=0; File_Offset_FirstSynched=File_Offset; } //All should be OK return true; } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Hevc::Synchronize() { //Synchronizing size_t Buffer_Offset_Min=Buffer_Offset; while(Buffer_Offset+4<=Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x01)) { Buffer_Offset+=2; while(Buffer_Offset=Buffer_Size || Buffer[Buffer_Offset-1]==0x00) Buffer_Offset--; } if (Buffer_Offset>Buffer_Offset_Min && Buffer[Buffer_Offset-1]==0x00) Buffer_Offset--; //Parsing last bytes if needed if (Buffer_Offset+4==Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x00 || Buffer[Buffer_Offset+3]!=0x01)) Buffer_Offset++; if (Buffer_Offset+3==Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x01)) Buffer_Offset++; if (Buffer_Offset+2==Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00)) Buffer_Offset++; if (Buffer_Offset+1==Buffer_Size && Buffer[Buffer_Offset ]!=0x00) Buffer_Offset++; if (Buffer_Offset+4>Buffer_Size) return false; if (File_Offset==0 && Buffer_Offset==0 && (Buffer[3]==0xE0 || Buffer[3]==0xFE)) { //It is from MPEG-PS Reject(); return false; } //Synched is OK Synched=true; return true; } //--------------------------------------------------------------------------- bool File_Hevc::Synched_Test() { //Must have enough buffer for having header if (Buffer_Offset+6>Buffer_Size) return false; //Quick test of synchro if (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || (Buffer[Buffer_Offset+2]!=0x01 && (Buffer[Buffer_Offset+2]!=0x00 || Buffer[Buffer_Offset+3]!=0x01))) { Synched=false; return true; } //Quick search if (!Header_Parser_QuickSearch()) return false; //We continue return true; } //*************************************************************************** // Buffer - Demux //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX bool File_Hevc::Demux_UnpacketizeContainer_Test() { return true; } #endif //MEDIAINFO_DEMUX //--------------------------------------------------------------------------- void File_Hevc::Synched_Init() { //FrameInfo PTS_End=0; if (FrameInfo.DTS==(int64u)-1) FrameInfo.DTS=0; //No DTS in container DTS_Begin=FrameInfo.DTS; DTS_End=FrameInfo.DTS; //Status IFrame_Count=0; //Temp //Default values Streams.resize(0x100); Streams[32].Searching_Payload=true; //video_parameter_set Streams[35].Searching_Payload=true; //access_unit_delimiter Streams[39].Searching_Payload=true; //sei for (int8u Pos=0xFF; Pos>=48; Pos--) Streams[Pos].Searching_Payload=true; //unspecified } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Hevc::Read_Buffer_Unsynched() { //Impossible to know TimeStamps now PTS_End=0; DTS_End=0; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Hevc::Header_Parse() { //Specific case if (MustParse_VPS_SPS_PPS) { Header_Fill_Size(Element_Size); Header_Fill_Code((int64u)-1, "Specific"); return; } //Parsing int8u nal_unit_type, nuh_temporal_id_plus1; if (!SizedBlocks) { if (Buffer[Buffer_Offset+2]==0x00) Skip_B1( "zero_byte"); Skip_B3( "start_code_prefix_one_3bytes"); BS_Begin(); Mark_0 (); Get_S1 (6, nal_unit_type, "nal_unit_type"); Get_S1 (6, nuh_layer_id, "nuh_layer_id"); Get_S1 (3, nuh_temporal_id_plus1, "nuh_temporal_id_plus1"); BS_End(); if (!Header_Parser_Fill_Size()) { Element_WaitForMoreData(); return; } if (nuh_temporal_id_plus1==0) Trusted_IsNot("nuh_temporal_id_plus1"); } else { int32u Size; switch (lengthSizeMinusOne) { case 0: { int8u Size_; Get_B1 (Size_, "size"); Size=Size_; } break; case 1: { int16u Size_; Get_B2 (Size_, "size"); Size=Size_; } break; case 2: { int32u Size_; Get_B3 (Size_, "size"); Size=Size_; } break; case 3: Get_B4 (Size, "size"); break; default: Trusted_IsNot("No size of NALU defined"); Size=(int32u)(Buffer_Size-Buffer_Offset); } BS_Begin(); Mark_0 (); Get_S1 (6, nal_unit_type, "nal_unit_type"); Get_S1 (6, nuh_layer_id, "nuh_layer_id"); Get_S1 (3, nuh_temporal_id_plus1, "nuh_temporal_id_plus1"); BS_End(); if (nuh_temporal_id_plus1==0) Trusted_IsNot("nuh_temporal_id_plus1"); FILLING_BEGIN(); Header_Fill_Size(Size?(Element_Offset-2+Size):(Buffer_Size-Buffer_Offset)); //If Size is 0, it is not normal, we skip the complete frame FILLING_END(); } //Filling #if MEDIAINFO_TRACE if (Trace_Activated) Header_Fill_Code(nal_unit_type, Ztring().From_CC1(nal_unit_type)); else #endif //MEDIAINFO_TRACE Header_Fill_Code(nal_unit_type); } //--------------------------------------------------------------------------- bool File_Hevc::Header_Parser_Fill_Size() { //Look for next Sync word if (Buffer_Offset_Temp==0) //Buffer_Offset_Temp is not 0 if Header_Parse_Fill_Size() has already parsed first frames Buffer_Offset_Temp=Buffer_Offset+4; while (Buffer_Offset_Temp+5<=Buffer_Size && CC3(Buffer+Buffer_Offset_Temp)!=0x000001) { Buffer_Offset_Temp+=2; while(Buffer_Offset_Temp=Buffer_Size || Buffer[Buffer_Offset_Temp-1]==0x00) Buffer_Offset_Temp--; } //Must wait more data? if (Buffer_Offset_Temp+5>Buffer_Size) { if (FrameIsAlwaysComplete || File_Offset+Buffer_Size>=File_Size) Buffer_Offset_Temp=Buffer_Size; //We are sure that the next bytes are a start else return false; } if (Buffer[Buffer_Offset_Temp-1]==0x00) Buffer_Offset_Temp--; //OK, we continue Header_Fill_Size(Buffer_Offset_Temp-Buffer_Offset); Buffer_Offset_Temp=0; return true; } //--------------------------------------------------------------------------- bool File_Hevc::Header_Parser_QuickSearch() { while ( Buffer_Offset+6<=Buffer_Size && Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x00 && (Buffer[Buffer_Offset+2]==0x01 || (Buffer[Buffer_Offset+2]==0x00 && Buffer[Buffer_Offset+3]==0x01))) { //Getting start_code int8u nal_unit_type; if (Buffer[Buffer_Offset+2]==0x00) nal_unit_type=(CC1(Buffer+Buffer_Offset+4)&0x7E)>>1; else nal_unit_type=(CC1(Buffer+Buffer_Offset+3)&0x7E)>>1; //Searching start if (Streams[nal_unit_type].Searching_Payload) return true; //Synchronizing Buffer_Offset+=4; Synched=false; if (!Synchronize()) { UnSynched_IsNotJunk=true; return false; } if (Buffer_Offset+6>Buffer_Size) { UnSynched_IsNotJunk=true; return false; } } Trusted_IsNot("HEVC, Synchronisation lost"); return Synchronize(); } //--------------------------------------------------------------------------- void File_Hevc::Data_Parse() { //Specific case if (Element_Code==(int64u)-1) { VPS_SPS_PPS(); return; } if (nuh_layer_id) { //Skip_XX(Element_Size, "(Extension)"); //return; } //Trailing zeroes int64u Element_Size_SaveBeforeZeroes=Element_Size; if (Element_Size) { while (Element_Size && Buffer[Buffer_Offset+(size_t)Element_Size-1]==0) Element_Size--; } //Searching emulation_prevention_three_byte int8u* Buffer_3Bytes=NULL; const int8u* Save_Buffer=Buffer; int64u Save_File_Offset=File_Offset; size_t Save_Buffer_Offset=Buffer_Offset; int64u Save_Element_Size=Element_Size; size_t Element_Offset_3Bytes=(size_t)Element_Offset; std::vector ThreeByte_List; while (Element_Offset_3Bytes+3<=Element_Size) { if (CC3(Buffer+Buffer_Offset+(size_t)Element_Offset_3Bytes)==0x000003) ThreeByte_List.push_back(Element_Offset_3Bytes+2); Element_Offset_3Bytes+=2; while(Element_Offset_3Bytes=Element_Size || Buffer[Buffer_Offset+(size_t)Element_Offset_3Bytes-1]==0x00) Element_Offset_3Bytes--; } if (!ThreeByte_List.empty()) { //We must change the buffer for keeping out Element_Size=Save_Element_Size-ThreeByte_List.size(); File_Offset+=Buffer_Offset; Buffer_Offset=0; Buffer_3Bytes=new int8u[(size_t)Element_Size]; for (size_t Pos=0; Pos<=ThreeByte_List.size(); Pos++) { size_t Pos0=(Pos==ThreeByte_List.size())?(size_t)Save_Element_Size:(ThreeByte_List[Pos]); size_t Pos1=(Pos==0)?0:(ThreeByte_List[Pos-1]+1); size_t Buffer_3bytes_Begin=Pos1-Pos; size_t Save_Buffer_Begin =Pos1; size_t Size= Pos0-Pos1; std::memcpy(Buffer_3Bytes+Buffer_3bytes_Begin, Save_Buffer+Save_Buffer_Offset+Save_Buffer_Begin, Size); } Buffer=Buffer_3Bytes; } //Parsing switch (Element_Code) { case 0 : case 1 : case 2 : case 3 : case 16 : case 17 : case 18 : case 19 : case 20 : case 21 : slice_segment_layer(); break; case 4 : case 5 : case 6 : case 7 : case 8 : case 9 : slice_layer(); break; case 32 : video_parameter_set(); break; case 33 : seq_parameter_set(); break; case 34 : pic_parameter_set(); break; case 35 : access_unit_delimiter(); break; case 36 : end_of_seq(); break; case 37 : end_of_bitstream(); break; case 38 : filler_data(); break; case 39 : case 40 : sei(); break; default : Skip_XX(Element_Size-Element_Offset, "Data"); if (Element_Code>=48) Trusted_IsNot("Unspecified"); } if (!ThreeByte_List.empty()) { //We must change the buffer for keeping out Element_Size=Save_Element_Size; File_Offset=Save_File_Offset; Buffer_Offset=Save_Buffer_Offset; delete[] Buffer; Buffer=Save_Buffer; Buffer_3Bytes=NULL; //Same as Buffer... Element_Offset+=ThreeByte_List.size(); } //Trailing zeroes Element_Size=Element_Size_SaveBeforeZeroes; } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- // Packets void File_Hevc::slice_segment_layer() { #if MEDIAINFO_TRACE Element_Name("slice_segment_layer"); switch (Element_Code) { case 0 : case 1 : break; case 2 : case 3 : Element_Info("TSA"); break; case 16 : case 17 : case 18 : Element_Info("BLA"); break; case 19 : case 20 : Element_Info("IDR"); break; case 21 : Element_Info("CRA"); break; default: ; } #endif //MEDIAINFO_TRACE //Parsing RapPicFlag=Element_Code>=16 && Element_Code<=23; BS_Begin(); slice_segment_header(); BS_End(); Skip_XX(Element_Size-Element_Offset, "(ToDo)"); FILLING_BEGIN(); if (slice_pic_parameter_set_id==(int32u)-1) return; //Count of I-Frames if (first_slice_segment_in_pic_flag && Element_Code==20) IFrame_Count++; if (first_slice_segment_in_pic_flag) { //Frame_Count Frame_Count++; if (IFrame_Count && Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; Frame_Count_InThisBlock++; //Filling only if not already done if (Frame_Count==1 && !Status[IsAccepted]) Accept("HEVC"); if (!Status[IsFilled]) { if (IFrame_Count>=8) Frame_Count_Valid=Frame_Count; //We have enough frames if (Frame_Count>=Frame_Count_Valid) { Fill("HEVC"); if (!IsSub && MediaInfoLib::Config.ParseSpeed_Get()<1.0) Finish("HEVC"); } } } FILLING_END(); } //--------------------------------------------------------------------------- // Packets void File_Hevc::slice_layer() { #if MEDIAINFO_TRACE Element_Name("slice_layer"); switch (Element_Code) { case 4 : case 5 : Element_Info("STSA"); break; case 6 : case 7 : Element_Info("RADL"); break; case 8 : case 9 : Element_Info("RASL"); break; default: ; } #endif //MEDIAINFO_TRACE //Parsing Skip_XX(Element_Size-Element_Offset, "(ToDo)"); } //--------------------------------------------------------------------------- // Packet "32" void File_Hevc::video_parameter_set() { Element_Name("video_parameter_set"); //Warning: based on a draft of the specification, it is maybe not compliant to the final specification //Parsing int32u vps_num_layer_sets_minus1; int8u vps_video_parameter_set_id, vps_max_sub_layers_minus1, vps_max_layer_id; bool vps_temporal_id_nesting_flag, vps_sub_layer_ordering_info_present_flag; BS_Begin(); Get_S1 (4, vps_video_parameter_set_id, "vps_video_parameter_set_id"); Skip_S1(2, "vps_reserved_three_2bits"); Skip_S1(6, "vps_reserved_zero_6bits"); Get_S1 (3, vps_max_sub_layers_minus1, "vps_max_sub_layers_minus1"); if (vps_max_sub_layers_minus1>6) { Trusted_IsNot("vps_max_sub_layers_minus1 not valid"); BS_End(); return; //Problem, not valid } Get_SB ( vps_temporal_id_nesting_flag, "vps_temporal_id_nesting_flag"); if (vps_max_sub_layers_minus1==0 && !vps_temporal_id_nesting_flag) { Trusted_IsNot("vps_temporal_id_nesting_flag not valid"); BS_End(); return; //Problem, not valid } Skip_S2(16, "vps_reserved_0xffff_16bits"); profile_tier_level(vps_max_sub_layers_minus1); Get_SB ( vps_sub_layer_ordering_info_present_flag, "vps_sub_layer_ordering_info_present_flag"); for (int32u SubLayerPos=(vps_sub_layer_ordering_info_present_flag?0:vps_max_sub_layers_minus1); SubLayerPos<=vps_max_sub_layers_minus1; SubLayerPos++) { Element_Begin1("SubLayer"); Skip_UE( "vps_max_dec_pic_buffering_minus1"); Skip_UE( "vps_max_num_reorder_pics"); Skip_UE( "vps_max_latency_increase_plus1"); Element_End0(); } Get_S1 ( 6, vps_max_layer_id, "vps_max_layer_id"); Get_UE ( vps_num_layer_sets_minus1, "vps_num_layer_sets_minus1"); if (vps_num_layer_sets_minus1>=1024) { Trusted_IsNot("vps_num_layer_sets_minus1 not valid"); BS_End(); return; //Problem, not valid } for (int32u LayerSetPos=1; LayerSetPos<=vps_num_layer_sets_minus1; LayerSetPos++) for (int8u LayerId=0; LayerId<=vps_max_layer_id; LayerId++) Skip_SB( "layer_id_included_flag"); TEST_SB_SKIP( "vps_timing_info_present_flag"); int32u vps_time_scale, vps_num_hrd_parameters; Skip_S4(32, "vps_num_units_in_tick"); Get_S4 (32, vps_time_scale, "vps_time_scale"); if (vps_time_scale==0) { Trusted_IsNot("vps_time_scale not valid"); Element_End0(); BS_End(); return; //Problem, not valid } TEST_SB_SKIP( "vps_poc_proportional_to_timing_flag"); Skip_UE( "vps_num_ticks_poc_diff_one_minus1"); TEST_SB_END(); Get_UE ( vps_num_hrd_parameters, "vps_num_hrd_parameters"); if (vps_num_hrd_parameters>1024) { Trusted_IsNot("vps_num_hrd_parameters not valid"); vps_num_hrd_parameters=0; } for (int32u HrdPos=0; HrdPos=1024) Trusted_IsNot("hrd_layer_set_idx not valid"); if (HrdPos) Skip_SB( "cprms_present_flag"); Trusted_IsNot("hrd_parameters not supported"); //hrd_parameters } TEST_SB_END(); TESTELSE_SB_SKIP( "vps_extension_flag"); Skip_BS(Data_BS_Remain(), "vps_extension_data"); Trusted_IsNot("(Not supported)"); // Should be skipped, but the detection is too sensible in that case, do not remove it until the detection is adapted TESTELSE_SB_ELSE( "vps_extension_flag"); Mark_1(); while (Data_BS_Remain()) Mark_0(); TESTELSE_SB_END(); BS_End(); FILLING_BEGIN_PRECISE(); //Creating Data if (vps_video_parameter_set_id>=video_parameter_sets.size()) video_parameter_sets.resize(vps_video_parameter_set_id+1); std::vector::iterator Data_Item=video_parameter_sets.begin()+vps_video_parameter_set_id; delete *Data_Item; *Data_Item=new video_parameter_set_struct(); //Filling from stream (*Data_Item)->IsSynched =true; //NextCode NextCode_Clear(); NextCode_Add(33); //Autorisation of other streams Streams[33].Searching_Payload=true; //seq_parameter_set Streams[36].Searching_Payload=true; //end_of_seq Streams[37].Searching_Payload=true; //end_of_bitstream Streams[38].Searching_Payload=true; //filler_data FILLING_END(); } //--------------------------------------------------------------------------- // Packet "33" void File_Hevc::seq_parameter_set() { Element_Name("seq_parameter_set"); //Warning: based on a draft of the specification, it is maybe not compliant to the final specification //Parsing void* vui_parameters_Item=NULL; int32u sps_seq_parameter_set_id, chroma_format_idc, pic_width_in_luma_samples, pic_height_in_luma_samples, bit_depth_luma_minus8, bit_depth_chroma_minus8, log2_max_pic_order_cnt_lsb_minus4, num_short_term_ref_pic_sets; int8u sps_video_parameter_set_id, sps_max_sub_layers_minus1; bool sps_sub_layer_ordering_info_present_flag; BS_Begin(); Get_S1 (4, sps_video_parameter_set_id, "sps_video_parameter_set_id"); std::vector::iterator video_parameter_set_Item; if (sps_video_parameter_set_id>=video_parameter_sets.size() || (*(video_parameter_set_Item=video_parameter_sets.begin()+sps_video_parameter_set_id))==NULL || !(*video_parameter_set_Item)->IsSynched) { //Not yet present Skip_BS(Data_BS_Remain(), "Data (video_parameter_set is missing)"); BS_End(); return; } Get_S1 (3, sps_max_sub_layers_minus1, "sps_max_sub_layers_minus1"); Skip_SB( "sps_temporal_id_nesting_flag"); profile_tier_level(sps_max_sub_layers_minus1); Get_UE ( sps_seq_parameter_set_id, "sps_seq_parameter_set_id"); Get_UE ( chroma_format_idc, "chroma_format_idc"); Param_Info1(Hevc_chroma_format_idc((int8u)chroma_format_idc)); if (chroma_format_idc>=4) { Trusted_IsNot("chroma_format_idc not valid"); BS_End(); return; //Problem, not valid } if (chroma_format_idc==3) Skip_SB( "separate_colour_plane_flag"); Get_UE ( pic_width_in_luma_samples, "pic_width_in_luma_samples"); Get_UE ( pic_height_in_luma_samples, "pic_height_in_luma_samples"); TEST_SB_SKIP( "conformance_window_flag "); Skip_UE( "conf_win_left_offset"); Skip_UE( "conf_win_right_offset"); Skip_UE( "conf_win_top_offset"); Skip_UE( "conf_win_bottom_offset"); TEST_SB_END(); Get_UE ( bit_depth_luma_minus8, "bit_depth_luma_minus8"); if (bit_depth_luma_minus8>6) { Trusted_IsNot("bit_depth_luma_minus8 not valid"); return; //Problem, not valid } Get_UE ( bit_depth_chroma_minus8, "bit_depth_chroma_minus8"); if (bit_depth_chroma_minus8>6) { Trusted_IsNot("bit_depth_chroma_minus8 not valid"); return; //Problem, not valid } Get_UE ( log2_max_pic_order_cnt_lsb_minus4, "log2_max_pic_order_cnt_lsb_minus4"); if (log2_max_pic_order_cnt_lsb_minus4>12) { Trusted_IsNot("log2_max_pic_order_cnt_lsb_minus4 not valid"); return; //Problem, not valid } Get_SB ( sps_sub_layer_ordering_info_present_flag, "sps_sub_layer_ordering_info_present_flag"); for (int32u SubLayerPos=(sps_sub_layer_ordering_info_present_flag?0:sps_max_sub_layers_minus1); SubLayerPos<=sps_max_sub_layers_minus1; SubLayerPos++) { Element_Begin1("SubLayer"); Skip_UE( "sps_max_dec_pic_buffering_minus1"); Skip_UE( "sps_max_num_reorder_pics"); Skip_UE( "sps_max_latency_increase_plus1"); Element_End0(); } Skip_UE( "log2_min_luma_coding_block_size_minus3"); Skip_UE( "log2_diff_max_min_luma_coding_block_size"); Skip_UE( "log2_min_transform_block_size_minus2"); Skip_UE( "log2_diff_max_min_transform_block_size"); Skip_UE( "max_transform_hierarchy_depth_inter"); Skip_UE( "max_transform_hierarchy_depth_intra"); TEST_SB_SKIP( "scaling_list_enabled_flag"); TEST_SB_SKIP( "sps_scaling_list_data_present_flag"); Trusted_IsNot("scaling_list_data not supported"); //scaling_list_data(); TEST_SB_END(); TEST_SB_END(); Skip_SB( "amp_enabled_flag"); Skip_SB( "sample_adaptive_offset_enabled_flag"); TEST_SB_SKIP( "pcm_enabled_flag"); Element_Begin1("pcm"); Skip_S1(4, "pcm_sample_bit_depth_luma_minus1"); Skip_S1(4, "pcm_sample_bit_depth_chroma_minus1"); Skip_UE( "log2_min_pcm_luma_coding_block_size_minus3"); Skip_UE( "log2_diff_max_min_pcm_luma_coding_block_size"); Skip_SB( "pcm_loop_filter_disabled_flag"); Element_End0(); TEST_SB_END(); Get_UE ( num_short_term_ref_pic_sets, "num_short_term_ref_pic_sets"); if (num_short_term_ref_pic_sets>64) { BS_End(); Trusted_IsNot("num_short_term_ref_pic_sets not valid"); return; //Problem, not valid } short_term_ref_pic_sets((int8u)num_short_term_ref_pic_sets); TEST_SB_SKIP( "long_term_ref_pics_present_flag"); Element_Begin1("long_term_ref_pics"); int32u num_long_term_ref_pics_sps; Get_UE (num_long_term_ref_pics_sps, "num_long_term_ref_pics_sps"); for (int32u long_term_ref_pics_sps_pos=0; long_term_ref_pics_sps_pos=seq_parameter_sets.size()) seq_parameter_sets.resize(sps_seq_parameter_set_id+1); std::vector::iterator Data_Item=seq_parameter_sets.begin()+sps_seq_parameter_set_id; delete *Data_Item; *Data_Item=new seq_parameter_set_struct(); //Filling from stream (*Data_Item)->IsSynched =true; (*Data_Item)->video_parameter_set_id =(int8u)sps_video_parameter_set_id; (*Data_Item)->profile_space =profile_space; (*Data_Item)->profile_idc =profile_idc; (*Data_Item)->level_idc =level_idc; (*Data_Item)->general_progressive_source_flag =general_progressive_source_flag; (*Data_Item)->general_interlaced_source_flag =general_interlaced_source_flag; (*Data_Item)->general_frame_only_constraint_flag =general_frame_only_constraint_flag; (*Data_Item)->pic_width_in_luma_samples =pic_width_in_luma_samples; (*Data_Item)->pic_height_in_luma_samples =pic_height_in_luma_samples; (*Data_Item)->chroma_format_idc =(int8u)chroma_format_idc; (*Data_Item)->log2_max_pic_order_cnt_lsb_minus4 =(int8u)log2_max_pic_order_cnt_lsb_minus4; (*Data_Item)->bit_depth_luma_minus8 =(int8u)bit_depth_luma_minus8; (*Data_Item)->bit_depth_chroma_minus8 =(int8u)bit_depth_chroma_minus8; (*Data_Item)->vui_parameters =(seq_parameter_set_struct::vui_parameters_struct*)vui_parameters_Item; //NextCode NextCode_Clear(); NextCode_Add(34); //Autorisation of other streams Streams[34].Searching_Payload=true; //pic_parameter_set FILLING_END(); } //--------------------------------------------------------------------------- // Packet "34" void File_Hevc::pic_parameter_set() { Element_Name("pic_parameter_set"); //Warning: based on a draft of the specification, it is maybe not compliant to the final specification //Parsing int32u pps_pic_parameter_set_id, pps_seq_parameter_set_id, num_ref_idx_l0_default_active_minus1, num_ref_idx_l1_default_active_minus1; int8u num_extra_slice_header_bits; bool tiles_enabled_flag, dependent_slice_segments_enabled_flag; BS_Begin(); Get_UE ( pps_pic_parameter_set_id, "pps_pic_parameter_set_id"); if (pps_pic_parameter_set_id>=64) { Trusted_IsNot("pic_parameter_set_id not valid"); BS_End(); return; //Problem, not valid } Get_UE ( pps_seq_parameter_set_id, "pps_seq_parameter_set_id"); if (pps_seq_parameter_set_id>=16) { Trusted_IsNot("seq_parameter_set_id not valid"); return; //Problem, not valid } std::vector::iterator seq_parameter_set_Item; if (pps_seq_parameter_set_id>=seq_parameter_sets.size() || (*(seq_parameter_set_Item=seq_parameter_sets.begin()+pps_seq_parameter_set_id))==NULL || !(*seq_parameter_set_Item)->IsSynched) { //Not yet present Skip_BS(Data_BS_Remain(), "Data (seq_parameter_set is missing)"); BS_End(); return; } Get_SB ( dependent_slice_segments_enabled_flag, "dependent_slice_segments_enabled_flag"); Skip_SB( "output_flag_present_flag"); Get_S1 (3, num_extra_slice_header_bits, "num_extra_slice_header_bits"); Skip_SB( "sign_data_hiding_flag"); Skip_SB( "cabac_init_present_flag"); Get_UE ( num_ref_idx_l0_default_active_minus1, "num_ref_idx_l0_default_active_minus1"); Get_UE ( num_ref_idx_l1_default_active_minus1, "num_ref_idx_l1_default_active_minus1"); Skip_SE( "init_qp_minus26"); Skip_SB( "constrained_intra_pred_flag"); Skip_SB( "transform_skip_enabled_flag"); TEST_SB_SKIP( "cu_qp_delta_enabled_flag"); Skip_UE( "diff_cu_qp_delta_depth"); TEST_SB_END(); Skip_SE( "pps_cb_qp_offset"); Skip_SE( "pps_cr_qp_offset"); Skip_SB( "pps_slice_chroma_qp_offsets_present_flag"); Skip_SB( "weighted_pred_flag"); Skip_SB( "weighted_bipred_flag"); Skip_SB( "transquant_bypass_enable_flag"); Get_SB ( tiles_enabled_flag, "tiles_enabled_flag"); Skip_SB( "entropy_coding_sync_enabled_flag"); if (tiles_enabled_flag) { Element_Begin1("tiles"); int32u num_tile_columns_minus1, num_tile_rows_minus1; bool uniform_spacing_flag; Get_UE ( num_tile_columns_minus1, "num_tile_columns_minus1"); Get_UE ( num_tile_rows_minus1, "num_tile_rows_minus1"); Get_SB ( uniform_spacing_flag, "uniform_spacing_flag"); if (!uniform_spacing_flag) { for (int32u tile_pos=0; tile_pos=pic_parameter_sets.size()) pic_parameter_sets.resize(pps_pic_parameter_set_id+1); std::vector::iterator pic_parameter_sets_Item=pic_parameter_sets.begin()+pps_pic_parameter_set_id; delete *pic_parameter_sets_Item; *pic_parameter_sets_Item=new pic_parameter_set_struct(); (*pic_parameter_sets_Item)->IsSynched =true; (*pic_parameter_sets_Item)->seq_parameter_set_id =(int8u)pps_seq_parameter_set_id; (*pic_parameter_sets_Item)->num_ref_idx_l0_default_active_minus1 =(int8u)num_ref_idx_l0_default_active_minus1; (*pic_parameter_sets_Item)->num_ref_idx_l1_default_active_minus1 =(int8u)num_ref_idx_l1_default_active_minus1; (*pic_parameter_sets_Item)->dependent_slice_segments_enabled_flag =dependent_slice_segments_enabled_flag; (*pic_parameter_sets_Item)->num_extra_slice_header_bits =num_extra_slice_header_bits; //Autorisation of other streams //if (!seq_parameter_sets.empty()) //{ // for (int8u Pos=0x01; Pos<=0x06; Pos++) // { // Streams[Pos].Searching_Payload=true; //Coded slice... // if (Streams[0x08].ShouldDuplicate) // Streams[Pos].ShouldDuplicate=true; // } //} //NextCode NextCode_Clear(); //Autorisation of other streams Streams[ 0].Searching_Payload=true; //slice_segment_layer Streams[ 1].Searching_Payload=true; //slice_segment_layer Streams[ 2].Searching_Payload=true; //slice_segment_layer Streams[ 3].Searching_Payload=true; //slice_segment_layer Streams[ 4].Searching_Payload=true; //slice_layer Streams[ 5].Searching_Payload=true; //slice_layer Streams[ 6].Searching_Payload=true; //slice_layer Streams[ 7].Searching_Payload=true; //slice_layer Streams[ 8].Searching_Payload=true; //slice_layer Streams[ 9].Searching_Payload=true; //slice_layer Streams[16].Searching_Payload=true; //slice_segment_layer Streams[17].Searching_Payload=true; //slice_segment_layer Streams[18].Searching_Payload=true; //slice_segment_layer Streams[19].Searching_Payload=true; //slice_segment_layer Streams[20].Searching_Payload=true; //slice_segment_layer Streams[21].Searching_Payload=true; //slice_segment_layer FILLING_END(); } //--------------------------------------------------------------------------- // Packet "35" void File_Hevc::access_unit_delimiter() { Element_Name("access_unit_delimiter"); //Parsing BS_Begin(); Info_S1( 3, pic_type, "pic_type"); Param_Info1(Hevc_pic_type[pic_type]); BS_End(); } //--------------------------------------------------------------------------- // Packet "36" void File_Hevc::end_of_seq() { Element_Name("end_of_seq"); } //--------------------------------------------------------------------------- // Packet "37" void File_Hevc::end_of_bitstream() { Element_Name("end_of_bitstream"); } //--------------------------------------------------------------------------- // Packet "38" void File_Hevc::filler_data() { Element_Name("filler_data"); //Parsing Skip_XX(Element_Size, "ff_bytes"); } //--------------------------------------------------------------------------- // Packet "39" or "40 void File_Hevc::sei() { Element_Name("sei"); //Parsing while(Element_Offset+1Element_Size) { Trusted_IsNot("Wrong size"); Skip_XX(Element_Size-Element_Offset, "unknown"); return; } int64u Element_Size_Save=Element_Size; Element_Size=Element_Offset_Save; switch (payloadType) { //case 0 : sei_message_buffering_period(seq_parameter_set_id); break; //case 1 : sei_message_pic_timing(payloadSize, seq_parameter_set_id); break; //case 4 : sei_message_user_data_registered_itu_t_t35(); break; //case 5 : sei_message_user_data_unregistered(payloadSize); break; //case 6 : sei_message_recovery_point(); break; //case 32 : sei_message_mainconcept(payloadSize); break; case 132 : sei_message_decoded_picture_hash(payloadSize); break; default : Element_Info1("unknown"); Skip_XX(payloadSize, "data"); } Element_Offset=Element_Offset_Save; //Positionning in the right place. Element_Size=Element_Size_Save; //Positionning in the right place. } //--------------------------------------------------------------------------- void File_Hevc::sei_message_decoded_picture_hash(int32u payloadSize) { //Parsing int8u hash_type; Get_B1 (hash_type, "hash_type"); for (int8u cIdx=0; cIdx<(chroma_format_idc?3:1); cIdx++) switch (hash_type) { case 0 : // md5 Skip_XX(16, "md5"); break; case 1 : // crc Skip_XX( 2, "crc"); break; case 2 : // checksum Skip_XX( 4, "checksum"); break; default : // Skip_XX((Element_Size-1)/(chroma_format_idc?1:3), "unknown"); break; } } //*************************************************************************** // Sub-elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Hevc::slice_segment_header() { Element_Begin1("slice_segment_header"); //Parsing bool dependent_slice_segment_flag=false; Get_SB ( first_slice_segment_in_pic_flag, "first_slice_segment_in_pic_flag"); if (RapPicFlag) Skip_SB( "no_output_of_prior_pics_flag"); Get_UE ( slice_pic_parameter_set_id, "slice_pic_parameter_set_id"); std::vector::iterator pic_parameter_set_Item; if (slice_pic_parameter_set_id>=pic_parameter_sets.size() || (*(pic_parameter_set_Item=pic_parameter_sets.begin()+slice_pic_parameter_set_id))==NULL || !(*pic_parameter_set_Item)->IsSynched) { //Not yet present Skip_BS(Data_BS_Remain(), "Data (pic_parameter_set is missing)"); Element_End0(); slice_pic_parameter_set_id=(int32u)-1; slice_type=(int32u)-1; return; } if (!first_slice_segment_in_pic_flag) { if ((*pic_parameter_set_Item)->dependent_slice_segments_enabled_flag) Get_SB (dependent_slice_segment_flag, "dependent_slice_segment_flag"); //Skip_BS(Ceil( Log2( PicSizeInCtbsY ) ), "slice_segment_address"); Skip_BS(Data_BS_Remain(), "(ToDo)"); Element_End0(); slice_type=(int32u)-1; return; } if (!dependent_slice_segment_flag) { Skip_S1((*pic_parameter_set_Item)->num_extra_slice_header_bits, "slice_reserved_flags"); Get_UE (slice_type, "slice_type"); Param_Info1(Hevc_slice_type(slice_type)); } //TODO... Skip_BS(Data_BS_Remain(), "(ToDo)"); Element_End0(); } //--------------------------------------------------------------------------- void File_Hevc::profile_tier_level(int8u maxNumSubLayersMinus1) { Element_Begin1("profile_tier_level"); //Parsing std::vectorsub_layer_profile_present_flags, sub_layer_level_present_flags; Get_S1 (2, profile_space, "general_profile_space"); Skip_SB( "general_tier_flag"); Get_S1 (5, profile_idc, "general_profile_idc"); Element_Begin1("general_profile_compatibility_flags"); for (int8u profile_pos=0; profile_pos<32; profile_pos++) if (profile_pos==profile_idc) { bool general_profile_compatibility_flag; Get_SB ( general_profile_compatibility_flag, "general_profile_compatibility_flag"); if (!general_profile_compatibility_flag) Trusted_IsNot("general_profile_compatibility_flag not valid"); } else Skip_SB( "general_profile_compatibility_flag"); Element_End0(); Get_SB ( general_progressive_source_flag, "general_progressive_source_flag"); Get_SB ( general_interlaced_source_flag, "general_interlaced_source_flag"); Skip_SB( "general_non_packed_constraint_flag"); Get_SB ( general_frame_only_constraint_flag, "general_frame_only_constraint_flag"); Skip_S8(44, "general_reserved_zero_44bits"); Get_S1 (8, level_idc, "general_level_idc"); for (int32u SubLayerPos=0; SubLayerPosstRpsIdx) { Skip_BS(Data_BS_Remain(), "(Problem)"); Element_End0(); Element_End0(); return; } Get_SB ( delta_rps_sign, "delta_rps_sign"); Get_UE ( abs_delta_rps_minus1, "abs_delta_rps_minus1"); int32u num_pics_new=0; for(int32u pic_pos=0 ; pic_pos<=num_pics; pic_pos++) { TESTELSE_SB_SKIP( "used_by_curr_pic_flag"); num_pics_new++; TESTELSE_SB_ELSE( "used_by_curr_pic_flag"); bool use_delta_flag; Get_SB (use_delta_flag, "use_delta_flag"); if (use_delta_flag) num_pics_new++; TESTELSE_SB_END(); } num_pics=num_pics_new; } else { int32u num_negative_pics, num_positive_pics; Get_UE (num_negative_pics, "num_negative_pics"); Get_UE (num_positive_pics, "num_positive_pics"); num_pics=num_negative_pics+num_positive_pics; for (int32u i=0; iaspect_ratio_info_present_flag=aspect_ratio_info_present_flag; if (aspect_ratio_info_present_flag) { vui_parameters_Item->aspect_ratio_idc=aspect_ratio_idc; if (aspect_ratio_idc==0xFF) { vui_parameters_Item->sar_width=sar_width; vui_parameters_Item->sar_height=sar_height; } } vui_parameters_Item->video_signal_type_present_flag=video_signal_type_present_flag; if (video_signal_type_present_flag) { vui_parameters_Item->video_format=video_format; vui_parameters_Item->colour_description_present_flag=colour_description_present_flag; if (colour_description_present_flag) { vui_parameters_Item->colour_primaries=colour_primaries; vui_parameters_Item->transfer_characteristics=transfer_characteristics; vui_parameters_Item->matrix_coefficients=matrix_coefficients; } } vui_parameters_Item->timing_info_present_flag=timing_info_present_flag; if (timing_info_present_flag) { vui_parameters_Item->num_units_in_tick=num_units_in_tick; vui_parameters_Item->time_scale=time_scale; vui_parameters_Item->fixed_frame_rate_flag=fixed_frame_rate_flag; } vui_parameters_Item->NAL=(seq_parameter_set_struct::vui_parameters_struct::xxl*)NAL; vui_parameters_Item->VCL=(seq_parameter_set_struct::vui_parameters_struct::xxl*)VCL; vui_parameters_Item->pic_struct_present_flag=pic_struct_present_flag; FILLING_ELSE(); delete (seq_parameter_set_struct::vui_parameters_struct::xxl*)NAL; delete (seq_parameter_set_struct::vui_parameters_struct::xxl*)VCL; FILLING_END(); } //--------------------------------------------------------------------------- void File_Hevc::hrd_parameters(void* &hrd_parameters_Item_) { //Parsing int32u cpb_cnt_minus1; int8u bit_rate_scale, cpb_size_scale, initial_cpb_removal_delay_length_minus1, cpb_removal_delay_length_minus1, dpb_output_delay_length_minus1, time_offset_length; Get_UE ( cpb_cnt_minus1, "cpb_cnt_minus1"); Get_S1 (4, bit_rate_scale, "bit_rate_scale"); Get_S1 (4, cpb_size_scale, "cpb_size_scale"); if (cpb_cnt_minus1>31) { Trusted_IsNot("cpb_cnt_minus1 too high"); cpb_cnt_minus1=0; } seq_parameter_set_struct::vui_parameters_struct::xxl* ToTest=new seq_parameter_set_struct::vui_parameters_struct::xxl(); hrd_parameters_Item_=ToTest; ToTest->SchedSel.resize(cpb_cnt_minus1+1); for (int32u SchedSelIdx=0; SchedSelIdx<=cpb_cnt_minus1; SchedSelIdx++) { Element_Begin1("ShedSel"); int32u bit_rate_value_minus1, cpb_size_value_minus1; Get_UE (bit_rate_value_minus1, "bit_rate_value_minus1"); ToTest->SchedSel[SchedSelIdx].bit_rate_value=(int32u)((bit_rate_value_minus1+1)*pow(2.0, 6+bit_rate_scale)); Param_Info2(ToTest->SchedSel[SchedSelIdx].bit_rate_value, " bps"); Get_UE (cpb_size_value_minus1, "cpb_size_value_minus1"); ToTest->SchedSel[SchedSelIdx].cpb_size_value=(int32u)((cpb_size_value_minus1+1)*pow(2.0, 4+cpb_size_scale)); Param_Info2(ToTest->SchedSel[SchedSelIdx].cpb_size_value, " bits"); Get_SB (ToTest->SchedSel[SchedSelIdx].cbr_flag, "cbr_flag"); Element_End0(); } Get_S1 (5, initial_cpb_removal_delay_length_minus1, "initial_cpb_removal_delay_length_minus1"); Get_S1 (5, cpb_removal_delay_length_minus1, "cpb_removal_delay_length_minus1"); Get_S1 (5, dpb_output_delay_length_minus1, "dpb_output_delay_length_minus1"); Get_S1 (5, time_offset_length, "time_offset_length"); //Validity test if (!Element_IsOK() || (ToTest->SchedSel.size()==1 && ToTest->SchedSel[0].bit_rate_value==64)) { delete ToTest; ToTest=NULL; hrd_parameters_Item_=NULL; //We do not trust this kind of data return; } //Filling ToTest->initial_cpb_removal_delay_length_minus1 =initial_cpb_removal_delay_length_minus1; ToTest->cpb_removal_delay_length_minus1 =cpb_removal_delay_length_minus1; ToTest->dpb_output_delay_length_minus1 =dpb_output_delay_length_minus1; ToTest->time_offset_length =time_offset_length; } //*************************************************************************** // Specific //*************************************************************************** //--------------------------------------------------------------------------- void File_Hevc::VPS_SPS_PPS() { if (MustParse_VPS_SPS_PPS_FromMatroska) return VPS_SPS_PPS_FromMatroska(); //Parsing int32u profile_compatibility_indications; int16u constraint_indicator_flags; int8u chromaFormat, bitDepthLumaMinus8, bitDepthChromaMinus8; int8u profile_space, profile_idc, level_idc, min_spatial_segmentation_idc; int8u numOfArrays, constantFrameRate, numTemporalLayers; bool temporalIdNested; //Warning: based on a draft of the specification, it is definitely not compliant to the final specification (unknown addtional bytes) BS_Begin(); Get_S1 (2, profile_space, "profile_space"); Skip_SB( "tier_flag"); Get_S1 (5, profile_idc, "profile_idc"); BS_End(); Get_B4 (profile_compatibility_indications, "profile_compatibility_indications"); Get_B2 (constraint_indicator_flags, "constraint_indicator_flags"); Get_B1 (level_idc, "level_idc"); Get_B1 (min_spatial_segmentation_idc, "min_spatial_segmentation_idc"); Skip_B1( "Unknown"); Skip_B1( "Unknown"); Skip_B1( "Unknown"); Skip_B1( "Unknown"); Skip_B1( "Unknown"); BS_Begin(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Skip_S1(2, "parallelismType"); BS_End(); BS_Begin(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Get_S1 (2, chromaFormat, "chromaFormat"); BS_End(); BS_Begin(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Get_S1 (3, bitDepthLumaMinus8, "bitDepthLumaMinus8"); BS_End(); BS_Begin(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Get_S1 (3, bitDepthChromaMinus8, "bitDepthChromaMinus8"); BS_End(); Skip_B2( "avgFrameRate"); BS_Begin(); Get_S1 (2, constantFrameRate, "constantFrameRate"); Get_S1 (3, numTemporalLayers, "numTemporalLayers"); Get_SB ( temporalIdNested, "temporalIdNested"); Get_S1 (2, lengthSizeMinusOne, "lengthSizeMinusOne"); BS_End(); Get_B1 (numOfArrays, "numOfArrays"); for (size_t ArrayPos=0; ArrayPosElement_Size) { Trusted_IsNot("Size is wrong"); break; //There is an error } //Header int8u nal_unit_type, nuh_temporal_id_plus1; BS_Begin(); Mark_0 (); Get_S1 (6, nal_unit_type, "nal_unit_type"); Get_S1 (6, nuh_layer_id, "nuh_layer_id"); Get_S1 (3, nuh_temporal_id_plus1, "nuh_temporal_id_plus1"); if (nuh_temporal_id_plus1==0) Trusted_IsNot("nuh_temporal_id_plus1 is invalid"); BS_End(); //Data int64u Element_Offset_Save=Element_Offset; int64u Element_Size_Save=Element_Size; Buffer_Offset+=(size_t)Element_Offset_Save; Element_Offset=0; Element_Size=nalUnitLength-2; Element_Code=nal_unit_type; Data_Parse(); Buffer_Offset-=(size_t)Element_Offset_Save; Element_Offset=Element_Offset_Save+nalUnitLength-2; Element_Size=Element_Size_Save; Element_End0(); } Element_End0(); } MustParse_VPS_SPS_PPS=false; } //--------------------------------------------------------------------------- void File_Hevc::VPS_SPS_PPS_FromMatroska() { //Parsing int8u Profile, Level, vid_parameter_set_count, seq_parameter_set_count, pic_parameter_set_count; if (SizedBlocks) Skip_B1( "Version"); Get_B1 (Profile, "Profile"); Skip_B1( "Compatible profile"); Get_B1 (Level, "Level"); BS_Begin(); Skip_S1(6, "Reserved"); Get_S1 (2, lengthSizeMinusOne, "Size of NALU length minus 1"); Skip_S1(3, "Reserved"); Get_S1 (5, vid_parameter_set_count, "seq_parameter_set count"); BS_End(); for (int8u Pos=0; PosElement_Size) { Trusted_IsNot("Size is wrong"); break; //There is an error } //Header int8u nal_unit_type, nuh_temporal_id_plus1; BS_Begin(); Mark_0 (); Get_S1 (6, nal_unit_type, "nal_unit_type"); Get_S1 (6, nuh_layer_id, "nuh_layer_id"); Get_S1 (3, nuh_temporal_id_plus1, "nuh_temporal_id_plus1"); if (nuh_temporal_id_plus1==0) Trusted_IsNot("nuh_temporal_id_plus1 is invalid"); BS_End(); //Data int64u Element_Offset_Save=Element_Offset; int64u Element_Size_Save=Element_Size; Buffer_Offset+=(size_t)Element_Offset_Save; Element_Offset=0; Element_Size=nalUnitLength-2; Element_Code=nal_unit_type; Data_Parse(); Buffer_Offset-=(size_t)Element_Offset_Save; Element_Offset=Element_Offset_Save+nalUnitLength-2; Element_Size=Element_Size_Save; Element_End0(); } BS_Begin(); Skip_S1(3, "Reserved"); Get_S1 (5, seq_parameter_set_count, "seq_parameter_set count"); BS_End(); for (int8u Pos=0; PosElement_Size) { Trusted_IsNot("Size is wrong"); break; //There is an error } //Header int8u nal_unit_type, nuh_temporal_id_plus1; BS_Begin(); Mark_0 (); Get_S1 (6, nal_unit_type, "nal_unit_type"); Get_S1 (6, nuh_layer_id, "nuh_layer_id"); Get_S1 (3, nuh_temporal_id_plus1, "nuh_temporal_id_plus1"); if (nuh_temporal_id_plus1==0) Trusted_IsNot("nuh_temporal_id_plus1 is invalid"); BS_End(); //Data int64u Element_Offset_Save=Element_Offset; int64u Element_Size_Save=Element_Size; Buffer_Offset+=(size_t)Element_Offset_Save; Element_Offset=0; Element_Size=nalUnitLength-2; Element_Code=nal_unit_type; Data_Parse(); Buffer_Offset-=(size_t)Element_Offset_Save; Element_Offset=Element_Offset_Save+nalUnitLength-2; Element_Size=Element_Size_Save; Element_End0(); } Get_B1 (pic_parameter_set_count, "pic_parameter_set count"); for (int8u Pos=0; PosElement_Size) { Trusted_IsNot("Size is wrong"); break; //There is an error } //Header int8u nal_unit_type, nuh_temporal_id_plus1; BS_Begin(); Mark_0 (); Get_S1 (6, nal_unit_type, "nal_unit_type"); Get_S1 (6, nuh_layer_id, "nuh_layer_id"); Get_S1 (3, nuh_temporal_id_plus1, "nuh_temporal_id_plus1"); if (nuh_temporal_id_plus1==0) Trusted_IsNot("nuh_temporal_id_plus1 is invalid"); BS_End(); //Data int64u Element_Offset_Save=Element_Offset; int64u Element_Size_Save=Element_Size; Buffer_Offset+=(size_t)Element_Offset_Save; Element_Offset=0; Element_Size=nalUnitLength-2; Element_Code=nal_unit_type; Data_Parse(); Buffer_Offset-=(size_t)Element_Offset_Save; Element_Offset=Element_Offset_Save+nalUnitLength-2; Element_Size=Element_Size_Save; Element_End0(); } if (Element_Offset video_parameter_set_structs; //Structures - seq_parameter_set struct seq_parameter_set_struct { struct vui_parameters_struct { struct xxl { struct xxl_data { //HRD configuration int32u bit_rate_value; int32u cpb_size_value; bool cbr_flag; //sei_message_buffering_period int32u initial_cpb_removal_delay; int32u initial_cpb_removal_delay_offset; xxl_data() { //HRD configuration bit_rate_value=(int32u)-1; cpb_size_value=(int32u)-1; cbr_flag=true; //sei_message_buffering_period initial_cpb_removal_delay=(int32u)-1; initial_cpb_removal_delay_offset=(int32u)-1; } }; vector SchedSel; int8u initial_cpb_removal_delay_length_minus1; int8u cpb_removal_delay_length_minus1; int8u dpb_output_delay_length_minus1; int8u time_offset_length; }; xxl* NAL; xxl* VCL; int32u num_units_in_tick; int32u time_scale; int16u sar_width; int16u sar_height; int8u aspect_ratio_idc; int8u video_format; int8u colour_primaries; int8u transfer_characteristics; int8u matrix_coefficients; bool aspect_ratio_info_present_flag; bool video_signal_type_present_flag; bool colour_description_present_flag; bool timing_info_present_flag; bool fixed_frame_rate_flag; bool pic_struct_present_flag; vui_parameters_struct() { NAL=NULL; VCL=NULL; aspect_ratio_info_present_flag=false; video_signal_type_present_flag=false; colour_description_present_flag=false; timing_info_present_flag=false; fixed_frame_rate_flag=false; pic_struct_present_flag=false; } ~vui_parameters_struct() { delete NAL; //NAL=NULL; delete VCL; //VCL=NULL; } }; vui_parameters_struct* vui_parameters; int32u profile_space; int32u profile_idc; int32u level_idc; int32u pic_width_in_luma_samples; int32u pic_height_in_luma_samples; int8u video_parameter_set_id; int8u chroma_format_idc; int8u log2_max_pic_order_cnt_lsb_minus4; int8u bit_depth_luma_minus8; int8u bit_depth_chroma_minus8; bool general_progressive_source_flag; bool general_interlaced_source_flag; bool general_frame_only_constraint_flag; bool IsSynched; //Computed value }; typedef vector seq_parameter_set_structs; //Structures - pic_parameter_set struct pic_parameter_set_struct { int8u seq_parameter_set_id; int8u num_ref_idx_l0_default_active_minus1; int8u num_ref_idx_l1_default_active_minus1; int8u num_extra_slice_header_bits; bool dependent_slice_segments_enabled_flag; bool IsSynched; //Computed value }; typedef vector pic_parameter_set_structs; //Streams management void Streams_Fill(); void Streams_Fill(vector::iterator seq_parameter_set_Item); void Streams_Finish(); //Buffer - File header bool FileHeader_Begin(); //Buffer - Synchro bool Synchronize(); bool Synched_Test(); void Synched_Init(); //Buffer - Demux #if MEDIAINFO_DEMUX bool Demux_UnpacketizeContainer_Test(); #endif //MEDIAINFO_DEMUX //Buffer - Global void Read_Buffer_Unsynched(); //Buffer - Per element void Header_Parse(); bool Header_Parser_QuickSearch(); bool Header_Parser_Fill_Size(); void Data_Parse(); //Elements void slice_segment_layer(); void slice_layer(); void video_parameter_set(); void seq_parameter_set(); void pic_parameter_set(); void access_unit_delimiter(); void end_of_seq(); void end_of_bitstream(); void filler_data(); void sei(); void sei_message(); void sei_message_decoded_picture_hash(int32u payloadSize); //Packets - SubElements void slice_segment_header(); void profile_tier_level(int8u maxNumSubLayersMinus1); void short_term_ref_pic_sets(int8u num_short_term_ref_pic_sets); void vui_parameters(void* &vui_parameters_Item); void hrd_parameters(void* &hrd_parameters_Item); //Packets - Specific void VPS_SPS_PPS(); void VPS_SPS_PPS_FromMatroska(); //Streams struct stream { bool Searching_Payload; stream() { Searching_Payload=false; } }; vector Streams; //Replacement of File__Analyze buffer const int8u* Buffer_ToSave; size_t Buffer_Size_ToSave; //parameter_sets video_parameter_set_structs video_parameter_sets; seq_parameter_set_structs seq_parameter_sets; pic_parameter_set_structs pic_parameter_sets; //File specific size_t IFrame_Count; //Temp int32u chroma_format_idc; int32u slice_pic_parameter_set_id; int32u slice_type; int8u nuh_layer_id; int8u profile_space; int8u profile_idc; int8u level_idc; bool general_progressive_source_flag; bool general_interlaced_source_flag; bool general_frame_only_constraint_flag; bool RapPicFlag; bool first_slice_segment_in_pic_flag; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Video/File_Lagarith.cpp100777 0 0 7545 12226004262 16025 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_LAGARITH_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_Lagarith.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Lagarith::File_Lagarith() :File__Analyze() { //Configuration ParserName=__T("Lagarith"); } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Lagarith::Streams_Fill() { Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "Lagarith"); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Lagarith::Read_Buffer_Continue() { //Parsing int8u version; Get_L1 (version, "version"); Skip_XX(Element_Size-Element_Offset, "data"); FILLING_BEGIN(); Accept(); Fill(); switch (version) { case 0x02 : Fill(Stream_Video, 0, Video_ColorSpace, "RGB"); Fill(Stream_Video, 0, Video_BitDepth, 8); break; case 0x03 : Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_ChromaSubsampling, "4:2:2"); Fill(Stream_Video, 0, Video_BitDepth, 8); break; case 0x04 : Fill(Stream_Video, 0, Video_ColorSpace, "RGB"); Fill(Stream_Video, 0, Video_BitDepth, 8); break; case 0x05 : Fill(Stream_Video, 0, Video_ColorSpace, "Grey"); break; case 0x06 : Fill(Stream_Video, 0, Video_ColorSpace, "RGB"); break; case 0x07 : Fill(Stream_Video, 0, Video_ColorSpace, "RGB"); break; case 0x08 : Fill(Stream_Video, 0, Video_ColorSpace, "RGBA"); break; case 0x09 : Fill(Stream_Video, 0, Video_ColorSpace, "RGBA"); break; case 0x0A : Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_ChromaSubsampling, "4:2:0"); Fill(Stream_Video, 0, Video_BitDepth, 8); break; case 0x0B : Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_ChromaSubsampling, "4:2:0"); Fill(Stream_Video, 0, Video_BitDepth, 8); break; default : ; } FILLING_END(); Finish(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_LAGARITH_YES MediaInfoLib/Source/MediaInfo/Video/File_Lagarith.h100777 0 0 2454 12226004262 15464 0/* 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 Lagarith files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File_LagarithH #define MediaInfo_File_LagarithH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Lagarith //*************************************************************************** class File_Lagarith : public File__Analyze { public : //Constructor/Destructor File_Lagarith(); private : //Streams management void Streams_Fill(); //Buffer - Global void Read_Buffer_Continue (); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Video/File_Mpeg4v.cpp100777 0 0 226753 12252672743 15516 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //*************************************************************************** // Constants (Common) //*************************************************************************** //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPEG4V_YES) || defined(MEDIAINFO_MPEG4_YES) //--------------------------------------------------------------------------- #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events_Internal.h" #endif //MEDIAINFO_EVENTS #include "ZenLib/Conf.h" #include "ZenLib/Utils.h" using namespace ZenLib; namespace MediaInfoLib { //--------------------------------------------------------------------------- const char* Mpeg4v_Profile_Level(int32u Profile_Level) { switch (Profile_Level) { case B8(00000001) : return "Simple@L1"; case B8(00000010) : return "Simple@L2"; case B8(00000011) : return "Simple@L3"; case B8(00000100) : return "Simple@L4a"; case B8(00000101) : return "Simple@L5"; case B8(00000110) : return "Simple@L6"; case B8(00001000) : return "Simple@L0"; case B8(00001001) : return "Simple@L0b"; case B8(00010000) : return "Simple Scalable@L0"; case B8(00010001) : return "Simple Scalable@L1"; case B8(00010010) : return "Simple Scalable@L2"; case B8(00010101) : return "AVC"; //For descriptors case B8(00100001) : return "Core@L1"; case B8(00100010) : return "Core@L2"; case B8(00110010) : return "Main@L2"; case B8(00110011) : return "Main@L3"; case B8(00110100) : return "Main@L4"; case B8(01000010) : return "N-bit@L2"; case B8(01010001) : return "Scalable Texture@L1"; case B8(01100001) : return "Simple Face Animation@L1"; case B8(01100010) : return "Simple Face Animation@L2"; case B8(01100011) : return "Simple FBA@L1"; case B8(01100100) : return "Simple FBA@L2"; case B8(01110001) : return "Basic Animated Texture@L1"; case B8(01110010) : return "Basic Animated Texture@L2"; case B8(01111111) : return "AVC"; //For descriptors case B8(10000001) : return "Hybrid@L1"; case B8(10000010) : return "Hybrid@L2"; case B8(10010001) : return "Advanced Real Time Simple@L1"; case B8(10010010) : return "Advanced Real Time Simple@L2"; case B8(10010011) : return "Advanced Real Time Simple@L3"; case B8(10010100) : return "Advanced Real Time Simple@L4"; case B8(10100001) : return "Core Scalable@L1"; case B8(10100010) : return "Core Scalable@L2"; case B8(10100011) : return "Core Scalable@L3"; case B8(10110001) : return "Advanced Coding Efficiency@L1"; case B8(10110010) : return "Advanced Coding Efficiency@L2"; case B8(10110011) : return "Advanced Coding Efficiency@L3"; case B8(10110100) : return "Advanced Coding Efficiency@L4"; case B8(11000001) : return "Advanced Core@L1"; case B8(11000010) : return "Advanced Core@L2"; case B8(11010001) : return "Advanced Scalable Texture@L1"; case B8(11010010) : return "Advanced Scalable Texture@L2"; case B8(11010011) : return "Advanced Scalable Texture@L3"; case B8(11100001) : return "Simple Studio@L1"; case B8(11100010) : return "Simple Studio@L2"; case B8(11100011) : return "Simple Studio@L3"; case B8(11100100) : return "Simple Studio@L4"; case B8(11100101) : return "Core Studio@L1"; case B8(11100110) : return "Core Studio@L2"; case B8(11100111) : return "Core Studio@L3"; case B8(11101000) : return "Core Studio@L4"; case B8(11110000) : return "Advanced Simple@L0"; case B8(11110001) : return "Advanced Simple@L1"; case B8(11110010) : return "Advanced Simple@L2"; case B8(11110011) : return "Advanced Simple@L3"; case B8(11110100) : return "Advanced Simple@L4"; case B8(11110101) : return "Advanced Simple@L5"; case B8(11110111) : return "Advanced Simple@L3b"; case B8(11111000) : return "Fine Granularity Scalable@L0"; case B8(11111001) : return "Fine Granularity Scalable@L1"; case B8(11111010) : return "Fine Granularity Scalable@L2"; case B8(11111011) : return "Fine Granularity Scalable@L3"; case B8(11111100) : return "Fine Granularity Scalable@L4"; case B8(11111101) : return "Fine Granularity Scalable@L5"; default : return ""; } } //--------------------------------------------------------------------------- } //NameSpace //--------------------------------------------------------------------------- #endif //... //--------------------------------------------------------------------------- //*************************************************************************** // //*************************************************************************** //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPEG4V_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_Mpeg4v.h" #include "ZenLib/BitStream.h" #include "ZenLib/Utils.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Constants //*************************************************************************** //--------------------------------------------------------------------------- const char* Mpeg4v_Colorimetry[]= { "", "4:2:0", "", "", }; //--------------------------------------------------------------------------- const char* Mpeg4v_visual_object_type[]= { "", "video", "still texture", "mesh", "FBA", "3D mesh", "", "", "", "", "", "", "", "", "", "", }; //--------------------------------------------------------------------------- const char* Mpeg4v_visual_object_verid[]= { "", "ISO/IEC 14496-2", "ISO/IEC 14496-2 AMD 1", "ISO/IEC 14496-2 AMD 2", "ISO/IEC 14496-2 AMD 3 (Studio)", "ISO/IEC 14496-2 AMD 4 (SVP)", "", "", "", "", "", "", "", "", "", "", }; //--------------------------------------------------------------------------- const char* Mpeg4v_video_object_layer_verid[]= { "", "ISO/IEC 14496-2", "ISO/IEC 14496-2 AMD 1", "ISO/IEC 14496-2 AMD 2", "ISO/IEC 14496-2 AMD 3 (Studio)", "ISO/IEC 14496-2 AMD 4 (SVP)", "", "", "", "", "", "", "", "", "", "", }; //--------------------------------------------------------------------------- const char* Mpeg4v_vop_coding_type[]= { "I", "P", "B", "S", }; //--------------------------------------------------------------------------- const char* Mpegv_colour_primaries(int8u colour_primaries); const char* Mpegv_transfer_characteristics(int8u transfer_characteristics); const char* Mpegv_matrix_coefficients(int8u matrix_coefficients); //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Mpeg4v::File_Mpeg4v() :File__Analyze() { //Config Trusted_Multiplier=2; MustSynchronize=true; Buffer_TotalBytes_FirstSynched_Max=64*1024; PTS_DTS_Needed=true; IsRawStream=true; //In Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.3?30:2; FrameIsAlwaysComplete=false; //Temp video_object_layer_start_IsParsed=false; colour_description=false; } //--------------------------------------------------------------------------- void File_Mpeg4v::OnlyVOP() { //Default stream values Synched_Init(); Streams[0xB3].Searching_Payload=true; //group_of_vop_start Streams[0xB6].Searching_Payload=true; //vop_start } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Mpeg4v::Synched_Test() { //Must have enough buffer for having header if (Buffer_Offset+4>Buffer_Size) return false; //Quick test of synchro if (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x01) { Synched=false; return true; } //Quick search if (!Header_Parser_QuickSearch()) return false; #if MEDIAINFO_IBI bool RandomAccess=Buffer[Buffer_Offset+3]==0xB0; //SequenceHeader if (RandomAccess) Ibi_Add(); #endif //MEDIAINFO_IBI //We continue return true; } //--------------------------------------------------------------------------- void File_Mpeg4v::Synched_Init() { //Count of a Packets IVOP_Count=0; PVOP_Count=0; BVOP_Count=0; BVOP_Count_Max=0; SVOP_Count=0; NVOP_Count=0; Interlaced_Top=0; Interlaced_Bottom=0; Frame_Count_InThisBlock_Max=0; if (Frame_Count_NotParsedIncluded==(int64u)-1) Frame_Count_NotParsedIncluded=0; //No Frame_Count_NotParsedIncluded in the container //From VOL, needed in VOP fixed_vop_time_increment=0; Time_Begin_Seconds=(int32u)-1; Time_End_Seconds=(int32u)-1; Time_Begin_MilliSeconds=(int16u)-1; Time_End_MilliSeconds=(int16u)-1; object_layer_width=0; object_layer_height=0; vop_time_increment_resolution=0; visual_object_verid=1; profile_and_level_indication=0; no_of_sprite_warping_points=0; aspect_ratio_info=0; par_width=0; par_height=0; bits_per_pixel=8; shape=0; sprite_enable=0; estimation_method=0; chroma_format=(int8u)-1; colour_primaries=(int8u)-1; transfer_characteristics=(int8u)-1; matrix_coefficients=(int8u)-1; quarter_sample=false; low_delay=false; load_intra_quant_mat=false; load_nonintra_quant_mat=false; load_intra_quant_mat_grayscale=false; load_nonintra_quant_mat_grayscale=false; interlaced=false; newpred_enable=0; time_size=0; reduced_resolution_vop_enable=0; scalability=0; enhancement_type=0; complexity_estimation_disable=false; opaque=false; transparent=false; intra_cae=false; inter_cae=false; no_update=false; upsampling=false; intra_blocks=false; inter_blocks=false; inter4v_blocks=false; not_coded_blocks=false; dct_coefs=false; dct_lines=false; vlc_symbols=false; vlc_bits=false; apm=false; npm=false; interpolate_mc_q=false; forw_back_mc_q=false; halfpel2=false; halfpel4=false; sadct=false; quarterpel=false; quant_type=false; if (!IsSub) FrameInfo.DTS=0; //Default stream values Streams.resize(0x100); Streams[0x00].Searching_Payload=true; //video_object_start Streams[0x20].Searching_Payload=true; //video_object_layer_start Streams[0xB0].Searching_Payload=true; //visual_object_sequence_start Streams[0xB5].Searching_Payload=true; //visual_object_start NextCode_Add(0x20); //video_object_layer_start for (int8u Pos=0xFF; Pos>=0xB9; Pos--) Streams[Pos].Searching_Payload=true; //Testing MPEG-PS } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpeg4v::Streams_Fill() { //Filling Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "MPEG-4 Visual"); Fill(Stream_Video, 0, Video_Codec, "MPEG-4V"); if (profile_and_level_indication>0) { Fill(Stream_Video, 0, Video_Format_Profile, Mpeg4v_Profile_Level(profile_and_level_indication)); Fill(Stream_Video, 0, Video_Codec_Profile, Mpeg4v_Profile_Level(profile_and_level_indication)); } if (fixed_vop_time_increment && vop_time_increment_resolution) Fill(Stream_Video, StreamPos_Last, Video_FrameRate, ((float)vop_time_increment_resolution)/fixed_vop_time_increment); if (object_layer_height) { Fill(Stream_Video, StreamPos_Last, Video_Width, object_layer_width); Fill(Stream_Video, StreamPos_Last, Video_Height, object_layer_height); float32 PixelAspectRatio_Value=1.0; if (aspect_ratio_info==0x01) PixelAspectRatio_Value=(float32)1; if (aspect_ratio_info==0x02) PixelAspectRatio_Value=(float32)12/(float32)11; else if (aspect_ratio_info==0x03) PixelAspectRatio_Value=(float32)10/(float32)11; else if (aspect_ratio_info==0x04) PixelAspectRatio_Value=(float32)16/(float32)11; else if (aspect_ratio_info==0x05) PixelAspectRatio_Value=(float32)40/(float32)33; else if (aspect_ratio_info==0x0F && par_height) PixelAspectRatio_Value=((float32)par_width)/par_height; Fill(Stream_Video, 0, Video_PixelAspectRatio, PixelAspectRatio_Value, 3, true); Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, ((float)object_layer_width)/object_layer_height*PixelAspectRatio_Value, 3, true); } Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_BitDepth, bits_per_pixel); if (chroma_format<4) Fill(Stream_Video, 0, Video_Colorimetry, Mpeg4v_Colorimetry[chroma_format]); if (colour_description) { Fill(Stream_Video, 0, Video_colour_description_present, "Yes"); Fill(Stream_Video, 0, Video_colour_primaries, Mpegv_colour_primaries(colour_primaries)); Fill(Stream_Video, 0, Video_transfer_characteristics, Mpegv_transfer_characteristics(transfer_characteristics)); Fill(Stream_Video, 0, Video_matrix_coefficients, Mpegv_matrix_coefficients(matrix_coefficients)); } if (low_delay) { Fill(Stream_Video, 0, Video_Format_Settings_BVOP, "No"); Fill(Stream_Video, 0, Video_Codec_Settings_BVOP, "No"); } else { Fill(Stream_Video, 0, Video_Format_Settings, "BVOP"); Fill(Stream_Video, 0, Video_Format_Settings_BVOP, "Yes"); Fill(Stream_Video, 0, Video_Codec_Settings, "BVOP"); Fill(Stream_Video, 0, Video_Codec_Settings_BVOP, "Yes"); } if (no_of_sprite_warping_points) { Fill(Stream_Video, 0, Video_Format_Settings, Ztring(__T("GMC"))+Ztring::ToZtring(no_of_sprite_warping_points)); Fill(Stream_Video, 0, Video_Format_Settings_GMC, no_of_sprite_warping_points); Fill(Stream_Video, 0, Video_Codec_Settings, Ztring(__T("GMC"))+Ztring::ToZtring(no_of_sprite_warping_points)); Fill(Stream_Video, 0, Video_Codec_Settings_GMC, no_of_sprite_warping_points); } else { Fill(Stream_Video, 0, Video_Format_Settings_GMC, 0); Fill(Stream_Video, 0, Video_Codec_Settings_GMC, 0); } if (quarter_sample) { Fill(Stream_Video, 0, Video_Format_Settings, "QPel"); Fill(Stream_Video, 0, Video_Format_Settings_QPel, "Yes"); Fill(Stream_Video, 0, Video_Codec_Settings, "QPel"); Fill(Stream_Video, 0, Video_Codec_Settings_QPel, "Yes"); } else { Fill(Stream_Video, 0, Video_Format_Settings_QPel, "No"); Fill(Stream_Video, 0, Video_Codec_Settings_QPel, "No"); } if (!quant_type) { Fill(Stream_Video, 0, Video_Format_Settings_Matrix, "Default (H.263)"); Fill(Stream_Video, 0, Video_Codec_Settings_Matrix, "Default (H.263)"); } else if (load_intra_quant_mat_grayscale || load_nonintra_quant_mat_grayscale) { Fill(Stream_Video, 0, Video_Format_Settings, "Custom Matrix (Gray)"); Fill(Stream_Video, 0, Video_Format_Settings_Matrix, "Custom (Gray)"); Fill(Stream_Video, 0, Video_Codec_Settings, "Custom Matrix (Gray)"); Fill(Stream_Video, 0, Video_Codec_Settings_Matrix, "Custom (Gray)"); } else if (load_intra_quant_mat || load_nonintra_quant_mat) { Fill(Stream_Video, 0, Video_Format_Settings, "Custom Matrix"); Fill(Stream_Video, 0, Video_Format_Settings_Matrix, "Custom"); Fill(Stream_Video, 0, Video_Format_Settings_Matrix_Data, Matrix_intra); Fill(Stream_Video, 0, Video_Format_Settings_Matrix_Data, Matrix_nonintra); Fill(Stream_Video, 0, Video_Codec_Settings, "Custom Matrix"); Fill(Stream_Video, 0, Video_Codec_Settings_Matrix, "Custom"); } else { Fill(Stream_Video, 0, Video_Format_Settings_Matrix, "Default (MPEG)"); Fill(Stream_Video, 0, Video_Codec_Settings_Matrix, "Default (MPEG)"); } if (interlaced) { Fill(Stream_Video, 0, Video_ScanType, "Interlaced"); if ((Interlaced_Top && Interlaced_Bottom) || (!Interlaced_Top && !Interlaced_Bottom)) Fill(Stream_Video, 0, Video_Interlacement, "Interlaced"); else { Fill(Stream_Video, 0, Video_ScanOrder, Interlaced_Top?"TFF":"BFF"); Fill(Stream_Video, 0, Video_Interlacement, Interlaced_Top?"TFF":"BFF"); } } else { Fill(Stream_Video, 0, Video_ScanType, "Progressive"); Fill(Stream_Video, 0, Video_Interlacement, "PPF"); } if (!Library.empty()) { Fill(Stream_Video, 0, Video_Encoded_Library, Library); Fill(Stream_Video, 0, Video_Encoded_Library_Name, Library_Name); Fill(Stream_Video, 0, Video_Encoded_Library_Version, Library_Version); Fill(Stream_Video, 0, Video_Encoded_Library_Date, Library_Date); } for (size_t Pos=0; Pos=Buffer_Size || Buffer[Demux_Offset-1]==0x00) Demux_Offset--; } if (Demux_Offset+4<=Buffer_Size) { if (Demux_IntermediateItemFound) { bool MustBreak; switch (Buffer[Demux_Offset+3]) { case 0xB0 : case 0xB3 : case 0xB6 : MustBreak=true; break; default : Demux_Offset+=3; MustBreak=false; } if (MustBreak) break; //while() loop } else { if (Buffer[Demux_Offset+3]==0xB6) Demux_IntermediateItemFound=true; } } Demux_Offset++; } if (Demux_Offset+4>Buffer_Size && File_Offset+Buffer_Size!=File_Size) return false; //No complete frame if (!Status[IsAccepted]) { Accept("MPEG-4 Visual"); if (Config->Demux_EventWasSent) return false; } Demux_UnpacketizeContainer_Demux(Buffer[Buffer_Offset+3]==0xB0); } return true; } #endif //MEDIAINFO_DEMUX //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpeg4v::Read_Buffer_Unsynched() { Time_End_Seconds=(int32u)-1; Time_End_MilliSeconds=(int16u)-1; } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpeg4v::Header_Parse() { //Parsing int8u start_code; Skip_B3( "synchro"); Get_B1 (start_code, "start_code"); if (!Header_Parser_Fill_Size()) { Element_WaitForMoreData(); return; } //Filling Header_Fill_Code(start_code, Ztring().From_CC1(start_code)); } //--------------------------------------------------------------------------- bool File_Mpeg4v::Header_Parser_Fill_Size() { //Look for next Sync word if (Buffer_Offset_Temp==0) //Buffer_Offset_Temp is not 0 if Header_Parse_Fill_Size() has already parsed first frames Buffer_Offset_Temp=Buffer_Offset+4; while (Buffer_Offset_Temp+4<=Buffer_Size && CC3(Buffer+Buffer_Offset_Temp)!=0x000001) { Buffer_Offset_Temp+=2; while(Buffer_Offset_Temp=Buffer_Size || Buffer[Buffer_Offset_Temp-1]==0x00) Buffer_Offset_Temp--; } //Must wait more data? if (Buffer_Offset_Temp+4>Buffer_Size) { if (FrameIsAlwaysComplete || File_Offset+Buffer_Size==File_Size) Buffer_Offset_Temp=Buffer_Size; //We are sure that the next bytes are a start else return false; } //OK, we continue Header_Fill_Size(Buffer_Offset_Temp-Buffer_Offset); Buffer_Offset_Temp=0; return true; } //--------------------------------------------------------------------------- bool File_Mpeg4v::Header_Parser_QuickSearch() { while ( Buffer_Offset+4<=Buffer_Size && Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x00 && Buffer[Buffer_Offset+2]==0x01) { //Getting start_code int8u start_code=CC1(Buffer+Buffer_Offset+3); //Searching start if (Streams[start_code].Searching_Payload) return true; //Synchronizing Buffer_Offset+=4; Synched=false; if (!Synchronize()) { UnSynched_IsNotJunk=true; return false; } if (Buffer_Offset+4>Buffer_Size) { UnSynched_IsNotJunk=true; return false; } } if (Buffer_Offset+3==Buffer_Size) return false; //Sync is OK, but start_code is not available Trusted_IsNot("MPEG-4 Visual, Synchronisation lost"); return Synchronize(); } //--------------------------------------------------------------------------- void File_Mpeg4v::Data_Parse() { //Parsing switch (Element_Code) { case 0xB0: visual_object_sequence_start(); break; case 0xB1: visual_object_sequence_end(); break; case 0xB2: user_data_start(); break; case 0xB3: group_of_vop_start(); break; case 0xB4: video_session_error(); break; case 0xB5: visual_object_start(); break; case 0xB6: vop_start(); break; case 0xB7: slice_start(); break; case 0xB8: extension_start(); break; case 0xB9: fgs_vop_start(); break; case 0xBA: fba_object_start(); break; case 0xBB: fba_object_plane_start(); break; case 0xBC: mesh_object_start(); break; case 0xBD: mesh_object_plane_start(); break; case 0xBE: still_texture_object_start(); break; case 0xBF: texture_spatial_layer_start(); break; case 0xC0: texture_snr_layer_start(); break; case 0xC1: texture_tile_start(); break; case 0xC2: texture_shape_layer_start(); break; case 0xC3: stuffing_start(); break; default: if (Element_Code<=0x1F) video_object_start(); else if (Element_Code>=0x20 && Element_Code<=0x2F) video_object_layer_start(); else if (Element_Code>=0x40 && Element_Code<=0x4F) fgs_bp_start(); else if (Element_Code<=0xC5) reserved(); else { if (Frame_Count==0 && Buffer_TotalBytes>Buffer_TotalBytes_FirstSynched_Max) Trusted=0; Trusted_IsNot("Unattended element!"); } } } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- // Packet "00" void File_Mpeg4v::video_object_start() { Element_Name("video_object_start"); //Integrity if (Element_Size>0) { Trusted_IsNot("size is wrong"); return; } } //--------------------------------------------------------------------------- // Packet "20" void File_Mpeg4v::video_object_layer_start() { Element_Name("video_object_layer_start"); //Default Matrix_intra.clear(); Matrix_nonintra.clear(); //Parsing int8u video_object_layer_verid=visual_object_verid; int8u shape_extension=0; int32u aux_comp_count=0; BS_Begin(); Skip_SB( "random_accessible_vol"); Skip_S1(8, "video_object_type_indication"); TEST_SB_SKIP( "is_object_layer_identifier"); Get_S1 (4, video_object_layer_verid, "video_object_layer_verid"); Param_Info1(Mpeg4v_video_object_layer_verid[video_object_layer_verid]); Skip_S1(3, "video_object_layer_priority"); TEST_SB_END(); Get_S1 (4, aspect_ratio_info, "aspect_ratio_info"); if (aspect_ratio_info==0x0F) { Get_S1 (8, par_width, "par_width"); Get_S1 (8, par_height, "par_height"); } TEST_SB_SKIP( "vol_control_parameters"); Get_S1 (2, chroma_format, "chroma_format"); Get_SB ( low_delay, "low_delay"); TEST_SB_SKIP( "vbv_parameters"); Skip_S2(15, "first_half_bit_rate"); Mark_1 (); Skip_S2(15, "latter_half_bit_rate"); Mark_1 (); Skip_S2(15, "first_half_vbv_Element_Size"); Mark_1 (); Skip_S1( 3, "latter_half_vbv_Element_Size"); Skip_S2(11, "first_half_vbv_occupancy"); Mark_1 (); Skip_S2(15, "latter_half_vbv_occupancy"); Mark_1 (); TEST_SB_END(); TEST_SB_END(); Get_S1 (2, shape, "video_object_layer_shape"); if (shape==3 && video_object_layer_verid!=1) //Shape=GrayScale Get_S1 (4, shape_extension, "video_object_layer_shape_extension"); switch (shape_extension) { case 0 : case 1 : case 5 : case 7 : case 8 : aux_comp_count=1; break; case 2 : case 3 : case 6 : case 9 : case 11 : aux_comp_count=2; break; case 4 : case 10 : case 12 : aux_comp_count=3; break; default : ; } Mark_1 (); Get_S2 (16, vop_time_increment_resolution, "vop_time_increment_resolution"); int32u PowerOf2=1; for (time_size=0; time_size<=16; time_size++) { if ((int32u)vop_time_increment_resolution10) Trusted_IsNot("Problem with width and height!"); FILLING_BEGIN(); //NextCode NextCode_Test(); NextCode_Clear(); NextCode_Add(0xB2); //user_data NextCode_Add(0xB3); //group_of_vop_start NextCode_Add(0xB6); //vop_start for (int8u Pos=0x00; Pos<0x1F; Pos++) NextCode_Add(Pos); //video_object_start //Autorisation of other streams Streams[0xB2].Searching_Payload=true; //user_data Streams[0xB3].Searching_Payload=true; //group_of_vop_start Streams[0xB6].Searching_Payload=true; //vop_start //Setting as OK video_object_layer_start_IsParsed=true; if (!Status[IsAccepted]) Accept("MPEG-4 Visual"); FILLING_END(); } //--------------------------------------------------------------------------- // Packet "40" // void File_Mpeg4v::fgs_bp_start() { Element_Name("fgs_bp_start"); } //--------------------------------------------------------------------------- // Packet "B0" void File_Mpeg4v::visual_object_sequence_start() { Element_Name("visual_object_sequence_start"); //Parsing Get_B1 (profile_and_level_indication, "profile_and_level_indication"); Param_Info1(Mpeg4v_Profile_Level(profile_and_level_indication)); //Integrity if (Element_Size>1) { Trusted_IsNot("Size is wrong"); return; } FILLING_BEGIN(); //NextCode NextCode_Clear(); NextCode_Add(0xB1); //visual_object_sequence_end NextCode_Add(0xB2); //user_data NextCode_Add(0xB5); //visual_object_start //Autorisation of other streams Streams[0xB1].Searching_Payload=true, //visual_object_sequence_end Streams[0xB2].Searching_Payload=true; //user_data FILLING_END(); } //--------------------------------------------------------------------------- // Packet "B1" void File_Mpeg4v::visual_object_sequence_end() { Element_Name("visual_object_sequence_end"); FILLING_BEGIN(); //NextCode NextCode_Clear(); NextCode_Add(0xB0); //visual_object_sequence_start FILLING_END(); } //--------------------------------------------------------------------------- // Packet "B2", User defined size, this is often used of library name void File_Mpeg4v::user_data_start() { Element_Name("user_data_start"); //Sony SNC files (security video) if (Element_Size>=120 && Element_Size<=140) { int64u SNC_Identifier; Peek_B8(SNC_Identifier); if (SNC_Identifier==0x43616D54696D3A20ULL) { user_data_start_SNC(); return; } } //Rejecting junk at the begin size_t Library_Start_Offset=0; while (Library_Start_Offset+4<=Element_Size) { bool OK=true; for (size_t Pos=0; Pos<4; Pos++) { if (!((Buffer[Buffer_Offset+Library_Start_Offset+Pos]==0x20 && Pos) || Buffer[Buffer_Offset+Library_Start_Offset+Pos]==0x22 || Buffer[Buffer_Offset+Library_Start_Offset+Pos]==0x27 || Buffer[Buffer_Offset+Library_Start_Offset+Pos]==0x28 || (Buffer[Buffer_Offset+Library_Start_Offset+Pos]==0x29 && Pos) || (Buffer[Buffer_Offset+Library_Start_Offset+Pos]>=0x30 && Buffer[Buffer_Offset+Library_Start_Offset+Pos]<=0x3F) || (Buffer[Buffer_Offset+Library_Start_Offset+Pos]>=0x41 && Buffer[Buffer_Offset+Library_Start_Offset+Pos]<=0x7D))) { OK=false; break; } } if (OK) break; Library_Start_Offset++; } if (Library_Start_Offset+4>Element_Size) { Skip_XX(Element_Size, "junk"); return; //No good info } //Accepting good data after junk size_t Library_End_Offset=Library_Start_Offset+4; while (Library_End_Offset=0x20 && Buffer[Buffer_Offset+Library_End_Offset]<=0x3F) || (Buffer[Buffer_Offset+Library_End_Offset]>=0x41 && Buffer[Buffer_Offset+Library_End_Offset]<=0x7D))) Library_End_Offset++; //Parsing Ztring Temp; if (Library_Start_Offset>0) Skip_XX(Library_Start_Offset, "junk"); if (Library_End_Offset-Library_Start_Offset) Get_Local(Library_End_Offset-Library_Start_Offset, Temp,"data"); if (Element_Offset3 && Temp[1]==__T('e') && Temp[2]==__T('n') && Temp[3]==__T('c')) Temp.erase(0, 1); while(Temp.size()>5 && Temp[3]==__T('M') && Temp[4]==__T('P') && Temp[5]==__T('E')) Temp.erase(0, 1); FILLING_BEGIN(); if (Temp.size()>=4) { if (Temp.find(__T("build"))==0) Library+=Ztring(__T(" "))+Temp; else Library=Temp; //Library if (Library.find(__T("DivX50"))==0) { Library_Name=__T("DivX"); Ztring Version=Library.SubString(__T("Build"), __T("")); if (Version.empty()) Version=Library.SubString(__T("b"), __T("p")); if (Version.empty()) Version=Library.SubString(__T("b"), __T("")); Library_Version=MediaInfoLib::Config.Library_Get(InfoLibrary_Format_DivX, Version, InfoLibrary_Version); if (Library_Version.empty()) Library_Version=Version; Library_Date=MediaInfoLib::Config.Library_Get(InfoLibrary_Format_DivX, Version, InfoLibrary_Date); } if (Library.find(__T("XviD"))==0) { Library_Name=__T("XviD"); if (Library.find(__T("build="))==std::string::npos) { Ztring Version=Library.SubString(__T("XviD"), __T("")); Version.FindAndReplace(__T("C"), __T("")); Version.TrimLeft(__T('0')); Library_Version=MediaInfoLib::Config.Library_Get(InfoLibrary_Format_XviD, Version, InfoLibrary_Version); if (Library_Version.empty()) Library_Version=Version; Library_Date=MediaInfoLib::Config.Library_Get(InfoLibrary_Format_XviD, Version, InfoLibrary_Date); } else { Library_Version=Library.SubString(__T("XviD"), __T("")); Ztring Date=Library.SubString(__T(" build="), __T("")); if (Date.size()==10) { Date[4]=__T('-'); Date[7]=__T('-'); Library_Date=__T("UTC ")+Date; } } } } FILLING_END(); } //--------------------------------------------------------------------------- // Packet "B2", SNC (From Sony SNC surveillance video) void File_Mpeg4v::user_data_start_SNC() { Element_Info1("Sony SNC"); if (!user_data_start_SNC_Data.empty()) { Skip_XX(Element_Size, "Value"); return; } //Parsing Ztring Value; Get_Local(Element_Size, Value, "Value"); ZtringListList List; List.Separator_Set(0, __T("\r\n")); List.Separator_Set(1, __T(": ")); List.Write(Value); for (size_t Pos=0; PosFrame_Count_InThisBlock_Max) Frame_Count_InThisBlock_Max=Frame_Count_InThisBlock; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; //Name Element_Name("vop_start"); Element_Info1(Ztring(__T("Frame ")+Ztring::ToZtring(Frame_Count))); //Parsing int32u vop_time_increment; int8u vop_coding_type; bool vop_coded; BS_Begin(); Get_S1 (2, vop_coding_type, "vop_coding_type"); Param_Info1(Mpeg4v_vop_coding_type[vop_coding_type]); Element_Info1(Mpeg4v_vop_coding_type[vop_coding_type]); bool modulo_time_base_Continue; int8u modulo_time_base=0; do { Get_SB (modulo_time_base_Continue, "modulo_time_base"); if (modulo_time_base_Continue) modulo_time_base++; } while (modulo_time_base_Continue); Mark_1 (); FILLING_BEGIN(); if (time_size==0) { //Filling only if not already done if (Frame_Count>=Frame_Count_Valid && Count_Get(Stream_Video)==0) { Accept("MPEG-4 Visual"); Finish("MPEG-4 Visual"); } return; } FILLING_END(); Get_S4 (time_size, vop_time_increment, "vop_time_increment"); Param_Info2C((vop_time_increment_resolution), vop_time_increment*1000/vop_time_increment_resolution, " ms"); Mark_1 (); Get_SB (vop_coded, "vop_coded"); if (vop_coded) { if (newpred_enable) { Skip_S3(time_size+3<15?time_size+3:15, "vop_id"); TEST_SB_SKIP( "vop_id_for_prediction_indication"); Skip_BS(time_size+3<15?time_size+3:15, "vop_id_for_prediction"); TEST_SB_END(); Mark_1 (); } if (shape!=2 //Shape!=BinaryOnly && (vop_coding_type==1 //Type=P || (vop_coding_type==3 //Type=S && sprite_enable==2))) //Sprite_Enable=GMC Skip_SB( "vop_rounding_type"); if (reduced_resolution_vop_enable==1 && shape==0 //Shape=Rectangular && (vop_coding_type==1 //Type=P || vop_coding_type==0)) //Type=I Skip_SB( "vop_reduced_resolution"); if (shape!=0) //Shape!=Rectangular { if (sprite_enable==1 //Sprite_Enable=Static && vop_coding_type==0) //Type=I { Skip_S2(13, "vop_width"); Mark_1 (); Skip_S2(13, "vop_height"); Mark_1 (); Skip_S2(13, "vop_horizontal_mc_spatial_ref"); Mark_1 (); Skip_S2(13, "vop_vertical_mc_spatial_ref"); Mark_1 (); } if (shape!=2 //Shape=BinaryOnly && scalability==1 && enhancement_type==1) Skip_SB( "background_composition"); Skip_SB( "change_conv_ratio_disable"); TEST_SB_SKIP( "vop_constant_alpha"); Skip_S1(8, "vop_constant_alpha_value"); TEST_SB_END(); } if (shape!=2) //Shape=BinaryOnly if (complexity_estimation_disable==0) { if (estimation_method==0) { if (vop_coding_type==0) //I { if (opaque) Skip_S1(8, "dcecs_opaque"); if (transparent) Skip_S1(8, "dcecs_transparent"); if (intra_cae) Skip_S1(8, "dcecs_intra_cae"); if (inter_cae) Skip_S1(8, "dcecs_inter_cae"); if (no_update) Skip_S1(8, "dcecs_no_update"); if (upsampling) Skip_S1(8, "dcecs_upsampling"); if (intra_blocks) Skip_S1(8, "dcecs_intra_blocks"); if (not_coded_blocks) Skip_S1(8, "dcecs_not_coded_blocks"); if (dct_coefs) Skip_S1(8, "dcecs_dct_coefs"); if (dct_lines) Skip_S1(8, "dcecs_dct_lines"); if (vlc_symbols) Skip_S1(8, "dcecs_vlc_symbols"); if (vlc_bits) Skip_S1(4, "dcecs_vlc_bits"); if (sadct) Skip_S1(8, "dcecs_sadct"); } if (vop_coding_type==1) //P { if (opaque) Skip_S1(8, "dcecs_opaque"); if (transparent) Skip_S1(8, "dcecs_transparent"); if (intra_cae) Skip_S1(8, "dcecs_intra_cae"); if (inter_cae) Skip_S1(8, "dcecs_inter_cae"); if (no_update) Skip_S1(8, "dcecs_no_update"); if (upsampling) Skip_S1(8, "dcecs_upsampling"); if (intra_blocks) Skip_S1(8, "dcecs_intra_blocks"); if (not_coded_blocks) Skip_S1(8, "dcecs_not_coded_blocks"); if (dct_coefs) Skip_S1(8, "dcecs_dct_coefs"); if (dct_lines) Skip_S1(8, "dcecs_dct_lines"); if (vlc_symbols) Skip_S1(8, "dcecs_vlc_symbols"); if (vlc_bits) Skip_S1(4, "dcecs_vlc_bits"); if (inter_blocks) Skip_S1(8, "dcecs_inter_blocks"); if (inter4v_blocks) Skip_S1(8, "dcecs_inter4v_blocks"); if (apm) Skip_S1(8, "dcecs_apm"); if (npm) Skip_S1(8, "dcecs_npm"); if (forw_back_mc_q) Skip_S1(8, "dcecs_forw_back_mc_q"); if (halfpel2) Skip_S1(8, "dcecs_halfpel2"); if (halfpel4) Skip_S1(8, "dcecs_halfpel4"); if (sadct) Skip_S1(8, "dcecs_sadct"); if (quarterpel) Skip_S1(8, "dcecs_quarterpel"); } if (vop_coding_type==2) //B { if (opaque) Skip_S1(8, "dcecs_opaque"); if (transparent) Skip_S1(8, "dcecs_transparent"); if (intra_cae) Skip_S1(8, "dcecs_intra_cae"); if (inter_cae) Skip_S1(8, "dcecs_inter_cae"); if (no_update) Skip_S1(8, "dcecs_no_update"); if (upsampling) Skip_S1(8, "dcecs_upsampling"); if (intra_blocks) Skip_S1(8, "dcecs_intra_blocks"); if (not_coded_blocks) Skip_S1(8, "dcecs_not_coded_blocks"); if (dct_coefs) Skip_S1(8, "dcecs_dct_coefs"); if (dct_lines) Skip_S1(8, "dcecs_dct_lines"); if (vlc_symbols) Skip_S1(8, "dcecs_vlc_symbols"); if (vlc_bits) Skip_S1(4, "dcecs_vlc_bits"); if (inter_blocks) Skip_S1(8, "dcecs_inter_blocks"); if (inter4v_blocks) Skip_S1(8, "dcecs_inter4v_blocks"); if (apm) Skip_S1(8, "dcecs_apm"); if (npm) Skip_S1(8, "dcecs_npm"); if (forw_back_mc_q) Skip_S1(8, "dcecs_forw_back_mc_q"); if (halfpel2) Skip_S1(8, "dcecs_halfpel2"); if (halfpel4) Skip_S1(8, "dcecs_halfpel4"); if (interpolate_mc_q) Skip_S1(8, "dcecs_interpolate_mc_q"); if (sadct) Skip_S1(8, "dcecs_sadct"); if (quarterpel) Skip_S1(8, "dcecs_sadct"); } if (vop_coding_type==3 && sprite_enable==1) //B and static { if (intra_blocks) Skip_S1(8, "dcecs_intra_blocks"); if (not_coded_blocks) Skip_S1(8, "dcecs_not_coded_blocks"); if (dct_coefs) Skip_S1(8, "dcecs_dct_coefs"); if (dct_lines) Skip_S1(8, "dcecs_dct_lines"); if (vlc_symbols) Skip_S1(8, "dcecs_vlc_symbols"); if (vlc_bits) Skip_S1(4, "dcecs_vlc_bits"); if (inter_blocks) Skip_S1(8, "dcecs_inter_blocks"); if (inter4v_blocks) Skip_S1(8, "dcecs_inter4v_blocks"); if (apm) Skip_S1(8, "dcecs_apm"); if (npm) Skip_S1(8, "dcecs_npm"); if (forw_back_mc_q) Skip_S1(8, "dcecs_forw_back_mc_q"); if (halfpel2) Skip_S1(8, "dcecs_halfpel2"); if (halfpel4) Skip_S1(8, "dcecs_halfpel4"); if (interpolate_mc_q) Skip_S1(8, "dcecs_interpolate_mc_q"); } } } if (shape!=2) //Shape!=BinaryOnly { Skip_S1(3, "intra_dc_vlc_thr"); if (interlaced) { bool top_field_first; Get_SB (top_field_first, "top_field_first"); Skip_SB( "alternate_vertical_scan_flag"); //Filling if (top_field_first) Interlaced_Top++; else Interlaced_Bottom++; } } //... } if (!vop_coded) //VOP with no data NVOP_Count++; else if (vop_coding_type==0) //Type I { IVOP_Count++; PVOP_Count=0; BVOP_Count=0; } else if (vop_coding_type==1) //Type P { PVOP_Count++; BVOP_Count=0; } else if (vop_coding_type==2) //Type B { BVOP_Count++; if (BVOP_Count>BVOP_Count_Max) BVOP_Count_Max=BVOP_Count; } else if (vop_coding_type==3) { SVOP_Count++; //Type S BVOP_Count=0; } FILLING_BEGIN(); //Duration if (vop_time_increment_resolution) { int16u Time=modulo_time_base*1000+(int16u)vop_time_increment*1000/vop_time_increment_resolution; while (Time_End_MilliSeconds!=(int16u)-1 && Time+500=Frame_Count_Valid && Count_Get(Stream_Video)==0) { //TODO: better handling of the difference if (IsSub) Finish("MPEG-4 Visual"); else { Fill("MPEG-4 Visual"); if (Config->ParseSpeed<1.0) { if (!IsSub) Open_Buffer_Unsynch(); GoToFromEnd(1024*1024, "MPEG-4 Visual"); } } } #if MEDIAINFO_EVENTS { EVENT_BEGIN (Video, SliceInfo, 0) Event.FieldPosition=Field_Count; Event.SlicePosition=0; switch (vop_coding_type) { case 0 : Event.SliceType=0; break; case 1 : Event.SliceType=1; break; case 2 : Event.SliceType=2; break; case 3 : Event.SliceType=3; break; default: Event.SliceType=(int8u)-1; } Event.Flags=0; EVENT_END () } #endif //MEDIAINFO_EVENTS FILLING_END(); } //--------------------------------------------------------------------------- // Packet "B7" void File_Mpeg4v::slice_start() { Element_Name("slice_start"); } //--------------------------------------------------------------------------- // Packet "B8" void File_Mpeg4v::extension_start() { Element_Name("extension_start"); } //--------------------------------------------------------------------------- // Packet "B9" void File_Mpeg4v::fgs_vop_start() { Element_Name("fgs_vop_start"); } //--------------------------------------------------------------------------- // Packet "BA" void File_Mpeg4v::fba_object_start() { Element_Name("fba_object_start"); } //--------------------------------------------------------------------------- // Packet "BB" void File_Mpeg4v::fba_object_plane_start() { Element_Name("fba_object_plane_start"); } //--------------------------------------------------------------------------- // Packet "BC" void File_Mpeg4v::mesh_object_start() { Element_Name("mesh_object_start"); } //--------------------------------------------------------------------------- // Packet "BD" void File_Mpeg4v::mesh_object_plane_start() { Element_Name("mesh_object_plane_start"); } //--------------------------------------------------------------------------- // Packet "BE" void File_Mpeg4v::still_texture_object_start() { Element_Name("still_texture_object_start"); } //--------------------------------------------------------------------------- // Packet "BF" void File_Mpeg4v::texture_spatial_layer_start() { Element_Name("texture_spatial_layer_start"); } //--------------------------------------------------------------------------- // Packet "C0" void File_Mpeg4v::texture_snr_layer_start() { Element_Name("texture_snr_layer_start"); } //--------------------------------------------------------------------------- // Packet "C1" void File_Mpeg4v::texture_tile_start() { Element_Name("texture_tile_start"); } //--------------------------------------------------------------------------- // Packet "C2" void File_Mpeg4v::texture_shape_layer_start() { Element_Name("texture_shape_layer_start"); } //--------------------------------------------------------------------------- // Packet "C3" void File_Mpeg4v::stuffing_start() { Element_Name("stuffing_start"); } //--------------------------------------------------------------------------- // Packet "C4" and C5" void File_Mpeg4v::reserved() { Element_Name("reserved"); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_MPEG4V_YES MediaInfoLib/Source/MediaInfo/Video/File_Mpeg4v.h100777 0 0 12426 12226004262 15113 0/* 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-4 Visual files // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_Mpeg4vH #define MediaInfo_Mpeg4vH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Multiple/File_Mpeg4.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Mpeg4v //*************************************************************************** class File_Mpeg4v : public File__Analyze { public : //In int64u Frame_Count_Valid; bool FrameIsAlwaysComplete; void OnlyVOP(); //Data has only VOPs in it (configuration is elsewhere) //Constructor/Destructor File_Mpeg4v(); private : //Streams management void Streams_Fill(); void Streams_Finish(); //Buffer - File header bool FileHeader_Begin() {return FileHeader_Begin_0x000001();} //Buffer - Global void Read_Buffer_Unsynched(); //Buffer - Synchro bool Synchronize() {return Synchronize_0x000001();} bool Synched_Test(); void Synched_Init(); //Buffer - Demux #if MEDIAINFO_DEMUX bool Demux_UnpacketizeContainer_Test(); #endif //MEDIAINFO_DEMUX //Buffer - Per element void Header_Parse(); bool Header_Parser_QuickSearch(); bool Header_Parser_Fill_Size(); void Data_Parse(); //Elements void video_object_start(); void video_object_layer_start(); void fgs_bp_start(); void visual_object_sequence_start(); void visual_object_sequence_end(); void user_data_start(); void user_data_start_SNC(); void group_of_vop_start(); void video_session_error(); void visual_object_start(); void vop_start(); void slice_start(); void extension_start(); void fgs_vop_start(); void fba_object_start(); void fba_object_plane_start(); void mesh_object_start(); void mesh_object_plane_start(); void still_texture_object_start(); void texture_spatial_layer_start(); void texture_snr_layer_start(); void texture_tile_start(); void texture_shape_layer_start(); void stuffing_start(); void reserved(); //Streams struct stream { bool Searching_Payload; stream() { Searching_Payload=false; } }; std::vector Streams; //Count of a Packets size_t IVOP_Count; size_t PVOP_Count; size_t BVOP_Count; size_t BVOP_Count_Max; size_t SVOP_Count; size_t NVOP_Count; size_t Interlaced_Top; size_t Interlaced_Bottom; int64u Frame_Count_InThisBlock_Max; //From video_object_layer int32u fixed_vop_time_increment; int32u Time_Begin_Seconds; int32u Time_End_Seconds; int16u Time_Begin_MilliSeconds; int16u Time_End_MilliSeconds; int16u object_layer_width; int16u object_layer_height; int16u vop_time_increment_resolution; int8u time_size; int8u visual_object_verid; int8u profile_and_level_indication; int8u no_of_sprite_warping_points; int8u aspect_ratio_info; int8u par_width; int8u par_height; int8u bits_per_pixel; int8u shape; int8u sprite_enable; int8u estimation_method; int8u chroma_format; int8u colour_primaries; int8u transfer_characteristics; int8u matrix_coefficients; bool quarter_sample; bool low_delay; bool load_intra_quant_mat; bool load_nonintra_quant_mat; bool load_intra_quant_mat_grayscale; bool load_nonintra_quant_mat_grayscale; bool interlaced; bool newpred_enable; bool reduced_resolution_vop_enable; bool scalability; bool enhancement_type; bool complexity_estimation_disable; bool opaque; bool transparent; bool intra_cae; bool inter_cae; bool no_update; bool upsampling; bool intra_blocks; bool inter_blocks; bool inter4v_blocks; bool not_coded_blocks; bool dct_coefs; bool dct_lines; bool vlc_symbols; bool vlc_bits; bool apm; bool npm; bool interpolate_mc_q; bool forw_back_mc_q; bool halfpel2; bool halfpel4; bool sadct; bool quarterpel; bool video_object_layer_start_IsParsed; bool quant_type; bool data_partitioned; bool reversible_vlc; bool colour_description; //From user_data Ztring Library; Ztring Library_Name; Ztring Library_Version; Ztring Library_Date; Ztring Matrix_intra; Ztring Matrix_nonintra; ZtringListList user_data_start_SNC_Data; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Video/File_Mpegv.cpp100777 0 0 527523 12263056611 15421 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //*************************************************************************** // Infos (Global) //*************************************************************************** //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPEGV_YES) || defined(MEDIAINFO_MPEG4V_YES) || defined(MEDIAINFO_AVC_YES) || defined(MEDIAINFO_MPEG4_YES) || defined(MEDIAINFO_PRORES_YES) //--------------------------------------------------------------------------- namespace MediaInfoLib { #include "ZenLib/Conf.h" using namespace ZenLib; //--------------------------------------------------------------------------- extern const char* Mpegv_colour_primaries(int8u colour_primaries) { switch (colour_primaries) { case 1 : return "BT.709"; case 4 : return "BT.470 System M"; case 5 : return "BT.601 PAL"; case 6 : return "BT.601 NTSC"; case 7 : return "SMPTE 240M"; //Same as BT.601 NTSC case 8 : return "Generic film"; case 9 : return "BT.2020"; //Added in HEVC default : return ""; } } //--------------------------------------------------------------------------- extern const char* Mpegv_transfer_characteristics(int8u transfer_characteristics) { switch (transfer_characteristics) { case 1 : return "BT.709"; //Same as BT.609 case 4 : return "BT.470 System M"; case 5 : return "BT.470 System B, BT.470 System G"; case 6 : return "BT.601"; case 7 : return "SMPTE 240M"; case 8 : return "Linear"; case 9 : return "Logarithmic (100:1)"; //Added in MPEG-4 Visual case 10 : return "Logarithmic (316.22777:1)"; //Added in MPEG-4 Visual case 11 : return "IEC 61966-2-4"; //Added in AVC case 12 : return "BT.1361 extended colour gamut system"; //Added in AVC case 13 : return "sYCC"; //Added in HEVC case 14 : return "BT.2020"; //Added in HEVC case 15 : return "BT.2020"; //Added in HEVC default : return ""; } } //--------------------------------------------------------------------------- extern const char* Mpegv_matrix_coefficients(int8u matrix_coefficients) { switch (matrix_coefficients) { case 0 : return "RGB"; //Added in AVC case 1 : return "BT.709"; case 4 : return "FCC 73.682"; case 5 : return "BT.601"; case 6 : return "BT.601"; case 7 : return "SMPTE 240M"; case 8 : return "YCgCo"; //Added in AVC case 9 : return "BT.2020 non-constant"; //Added in HEVC case 10 : return "BT.2020 constant"; //Added in HEVC default : return ""; } } } //NameSpace #if !MEDIAINFO_ADVANCED const int64u Config_VariableGopDetection_Occurences=4; #endif // MEDIAINFO_ADVANCED //--------------------------------------------------------------------------- #endif //... //--------------------------------------------------------------------------- //*************************************************************************** // Infos (Global) //*************************************************************************** //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPEGV_YES) || defined(MEDIAINFO_MPEGTS_YES) || defined(MEDIAINFO_MPEGPS_YES) || defined(MEDIAINFO_MXF_YES) //--------------------------------------------------------------------------- namespace MediaInfoLib { #include "ZenLib/Conf.h" using namespace ZenLib; //--------------------------------------------------------------------------- extern const float32 Mpegv_frame_rate[16]= { (float32) 0, (float32)24000/(float32)1001, (float32)24, (float32)25, (float32)30000/(float32)1001, (float32)30, (float32)50, (float32)60000/(float32)1001, (float32)60, (float32) 0, (float32) 0, (float32) 0, (float32) 0, (float32) 0, (float32) 0, (float32) 0, }; //--------------------------------------------------------------------------- const char* Mpegv_Colorimetry_format[4]= { "", "4:2:0", "4:2:2", "4:4:4", }; //--------------------------------------------------------------------------- const char* Mpegv_profile_and_level_indication (int8u profile_and_level_indication) { switch (profile_and_level_indication) { case 0x82 : return "4:2:2@High"; case 0x85 : return "4:2:2@Main"; case 0x8A : return "Multi-view@High"; case 0x8B : return "Multi-view@High-1440"; case 0x8D : return "Multi-view@Main"; case 0x8E : return "Multi-view@Low"; default : return ""; } }; //--------------------------------------------------------------------------- const char* Mpegv_profile_and_level_indication_profile[]= { "0", "High", "Spatially Scalable", "SNR Scalable", "Main", "Simple", "6", "7", }; //4:2:2 Profile? //--------------------------------------------------------------------------- const char* Mpegv_profile_and_level_indication_level[]= { "0", "1", "2", "3", "High", "4", "High 1440", "5", "Main", "6", "Low", "7", "8", "9", "10", "11", }; } //NameSpace //--------------------------------------------------------------------------- #endif //... //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_MPEGV_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_Mpegv.h" #include "MediaInfo/TimeCode.h" #include "ZenLib/BitStream.h" #include "ZenLib/Utils.h" #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) #include "MediaInfo/Text/File_DtvccTransport.h" #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) #if defined(MEDIAINFO_SCTE20_YES) #include "MediaInfo/Text/File_Scte20.h" #endif //defined(MEDIAINFO_SCTE20_YES) #if defined(MEDIAINFO_CDP_YES) #include "MediaInfo/Text/File_Cdp.h" #include #endif //defined(MEDIAINFO_CDP_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) #include "MediaInfo/Video/File_AfdBarData.h" #include #endif //defined(MEDIAINFO_AFDBARDATA_YES) #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Events.h" #include "MediaInfo/MediaInfo_Events_Internal.h" #endif //MEDIAINFO_EVENTS #include using namespace ZenLib; using namespace std; #undef FILLING_BEGIN #define FILLING_BEGIN() \ while (Element_Offset=0.3?512:2; FrameIsAlwaysComplete=false; TimeCodeIsNotTrustable=false; #if defined(MEDIAINFO_ANCILLARY_YES) Ancillary=NULL; #endif //defined(MEDIAINFO_ANCILLARY_YES) #if MEDIAINFO_ADVANCED InitDataNotRepeated_Optional=false; #endif // MEDIAINFO_ADVANCED //temporal_reference TemporalReference_Offset=0; #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) GA94_03_Parser=NULL; GA94_03_TemporalReference_Offset=0; GA94_03_IsPresent=false; Text_Positions.push_back(text_position(GA94_03_Parser)); CC___Parser=NULL; CC___IsPresent=false; Text_Positions.push_back(text_position(CC___Parser)); #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) #if defined(MEDIAINFO_SCTE20_YES) Scte_Parser=NULL; Scte_TemporalReference_Offset=0; Scte_IsPresent=false; Text_Positions.push_back(text_position(Scte_Parser)); #endif //defined(MEDIAINFO_SCTE20_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) DTG1_Parser=NULL; GA94_06_Parser=NULL; #endif //defined(MEDIAINFO_AFDBARDATA_YES) #if defined(MEDIAINFO_CDP_YES) Cdp_Parser=NULL; Cdp_IsPresent=false; Text_Positions.push_back(text_position(Cdp_Parser)); #endif //defined(MEDIAINFO_CDP_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) AfdBarData_Parser=NULL; #endif //defined(MEDIAINFO_AFDBARDATA_YES) //Temp SizeToAnalyse_Begin=1*1024*1024; SizeToAnalyse_End=1*1024*1024; Frame_Count_LastIFrame=(int64u)-1; Searching_TimeStamp_Start_DoneOneTime=false; sequence_header_IsParsed=false; FrameInfo.DTS=0; Parsing_End_ForDTS=false; //Macroblocks #if MEDIAINFO_MACROBLOCKS Macroblocks_Parse=false; #endif //MEDIAINFO_MACROBLOCKS #if MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS Slices_Count=0; Has_sequence_header=false; Has_sequence_extension=false; #endif // MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS } //--------------------------------------------------------------------------- File_Mpegv::~File_Mpegv() { for (size_t Pos=0; PosStatus[IsUpdated]) { Update(*Text_Positions[Text_Positions_Pos].Parser); for (size_t Pos=0; Pos<(*Text_Positions[Text_Positions_Pos].Parser)->Count_Get(Stream_Text); Pos++) { //Saving previous Muxing mode Ztring MuxingMode=Retrieve(Stream_Text, Text_Positions[Text_Positions_Pos].StreamPos+Pos, "MuxingMode"); bool IsNewStream=false; if (Retrieve(Stream_Text, Text_Positions[Text_Positions_Pos].StreamPos+Pos, Text_ID)!=(*Text_Positions[Text_Positions_Pos].Parser)->Get(Stream_Text, Pos, Text_ID)) { Stream_Prepare(Stream_Text, Text_Positions[Text_Positions_Pos].StreamPos+Pos); for (size_t Text_Positions_Pos2=Text_Positions_Pos+1; Text_Positions_Pos2Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); if (IsNewStream) { #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) if ((*Text_Positions[Text_Positions_Pos].Parser)==GA94_03_Parser) MuxingMode=__T("A/53 / ")+Retrieve(Stream_Text, Text_Positions[Text_Positions_Pos].StreamPos+Pos, "MuxingMode"); #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) #if defined(MEDIAINFO_SCTE20_YES) if ((*Text_Positions[Text_Positions_Pos].Parser)==Scte_Parser) MuxingMode=Retrieve(Stream_Text, Text_Positions[Text_Positions_Pos].StreamPos+Pos, "MuxingMode"); #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) #if defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES) if ((*Text_Positions[Text_Positions_Pos].Parser)==Cdp_Parser) MuxingMode=__T("Ancillary data / ")+Retrieve(Stream_Text, Text_Positions[Text_Positions_Pos].StreamPos+Pos, "MuxingMode"); #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES) } Fill(Stream_Text, Text_Positions[Text_Positions_Pos].StreamPos+Pos, "MuxingMode", MuxingMode, true); } } } } //--------------------------------------------------------------------------- void File_Mpegv::Streams_Fill() { //Version if (MPEG_Version==2) { Fill(Stream_General, 0, General_Format_Version, "Version 2"); Fill(Stream_Video, 0, Video_Format, "MPEG Video"); Fill(Stream_Video, 0, Video_Format_Version, "Version 2"); Fill(Stream_Video, 0, Video_Format_Commercial, "MPEG-2 Video"); Fill(Stream_Video, 0, Video_Codec, "MPEG-2V"); Fill(Stream_Video, 0, Video_Codec_String, "MPEG-2 Video", Unlimited, true, true); } else { Fill(Stream_General, 0, General_Format_Version, "Version 1"); Fill(Stream_Video, 0, Video_Format, "MPEG Video"); Fill(Stream_Video, 0, Video_Format_Version, "Version 1"); Fill(Stream_Video, 0, Video_Format_Commercial, "MPEG-1 Video"); Fill(Stream_Video, 0, Video_Codec, "MPEG-1V"); Fill(Stream_Video, 0, Video_Codec_String, "MPEG-1 Video", Unlimited, true, true); } Fill(Stream_Video, 0, Video_Width, 0x1000*horizontal_size_extension+horizontal_size_value); Fill(Stream_Video, 0, Video_Height, 0x1000*vertical_size_extension+vertical_size_value); Fill(Stream_Video, 0, Video_Colorimetry, Mpegv_Colorimetry_format[chroma_format]); Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_BitDepth, 8); //AspectRatio if (MPEG_Version==2) { if (aspect_ratio_information==0) ;//Forbidden else if (aspect_ratio_information==1) Fill(Stream_Video, 0, Video_PixelAspectRatio, 1.000, 3, true); else if (display_horizontal_size && display_vertical_size) { if (vertical_size_value && Mpegv_aspect_ratio2[aspect_ratio_information]) Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, (float)(0x1000*horizontal_size_extension+horizontal_size_value)/(0x1000*vertical_size_extension+vertical_size_value) *Mpegv_aspect_ratio2[aspect_ratio_information]/((float)display_horizontal_size/display_vertical_size), 3, true); } else if (Mpegv_aspect_ratio2[aspect_ratio_information]) Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, Mpegv_aspect_ratio2[aspect_ratio_information], 3, true); } else //Version 1 { if (vertical_size_value && Mpegv_aspect_ratio1[aspect_ratio_information]) Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, (float)(0x1000*horizontal_size_extension+horizontal_size_value)/(0x1000*vertical_size_extension+vertical_size_value)/Mpegv_aspect_ratio1[aspect_ratio_information], 3, true); } //FrameRate Fill(Stream_Video, StreamPos_Last, Video_FrameRate, (float)(Mpegv_frame_rate[frame_rate_code] * (frame_rate_extension_n + 1)) / (float)(frame_rate_extension_d + 1)); //BitRate if (vbv_delay==0xFFFF || (MPEG_Version==1 && bit_rate_value==0x3FFFF)) Fill(Stream_Video, 0, Video_BitRate_Mode, "VBR"); if (bit_rate_value_IsValid && (bit_rate_extension>0 || bit_rate_value!=0x3FFFF)) Fill(Stream_Video, 0, Video_BitRate_Maximum, ((((int32u)bit_rate_extension<<12))+bit_rate_value)*400); //Interlacement if (MPEG_Version==1) { Fill(Stream_Video, 0, Video_ScanType, "Progressive"); Fill(Stream_Video, 0, Video_Interlacement, "PPF"); } else if (progressive_frame_Count && progressive_frame_Count!=Frame_Count && progressive_frame_Count!=Frame_Count+1) //In case the stream is cut before a slice { //This is mixed } else if (Frame_Count>0) //Only if we have at least one progressive_frame definition { if (progressive_sequence || progressive_frame_Count==Frame_Count || progressive_frame_Count==Frame_Count+1) { Fill(Stream_Video, 0, Video_ScanType, "Progressive"); Fill(Stream_Video, 0, Video_Interlacement, "PPF"); if (!progressive_sequence && !(Interlaced_Top && Interlaced_Bottom) && !(!Interlaced_Top && !Interlaced_Bottom)) Fill(Stream_Video, 0, Video_ScanOrder, Interlaced_Top?"TFF":"BFF"); } else { Fill(Stream_Video, 0, Video_ScanType, "Interlaced"); if ((Interlaced_Top && Interlaced_Bottom) || (!Interlaced_Top && !Interlaced_Bottom)) Fill(Stream_Video, 0, Video_Interlacement, "Interlaced"); else { Fill(Stream_Video, 0, Video_ScanOrder, Interlaced_Top?"TFF":"BFF"); Fill(Stream_Video, 0, Video_Interlacement, Interlaced_Top?"TFF":"BFF"); } } std::string TempRef; for (size_t Pos=0; PosHasPictureCoding) { TempRef+=TemporalReference[Pos]->top_field_first?"T":"B"; TempRef+=TemporalReference[Pos]->repeat_first_field?"3":"2"; } if (TempRef.find('3')!=std::string::npos) { if (TempRef.find("T2T3B2B3T2T3B2B3")!=std::string::npos || TempRef.find("B2B3T2T3B2B3T2T3")!=std::string::npos) { Fill(Stream_Video, 0, Video_ScanOrder, "2:3 Pulldown", Unlimited, true, true); Fill(Stream_Video, 0, Video_FrameRate, FrameRate*24/30, 3, true); //Real framerate Fill(Stream_Video, 0, Video_ScanType, "Progressive", Unlimited, true, true); Fill(Stream_Video, 0, Video_Interlacement, "PPF", Unlimited, true, true); } if (TempRef.find("T2T2T2T2T2T2T2T2T2T2T2T3B2B2B2B2B2B2B2B2B2B2B2B3")!=std::string::npos || TempRef.find("B2B2B2B2B2B2B2B2B2B2B2B3T2T2T2T2T2T2T2T2T2T2T2T3")!=std::string::npos) { Fill(Stream_Video, 0, Video_ScanOrder, "2:2:2:2:2:2:2:2:2:2:2:3 Pulldown", Unlimited, true, true); Fill(Stream_Video, 0, Video_FrameRate, FrameRate*24/25, 3, true); //Real framerate Fill(Stream_Video, 0, Video_ScanType, "Progressive", Unlimited, true, true); Fill(Stream_Video, 0, Video_Interlacement, "PPF", Unlimited, true, true); } } } //Profile if (!profile_and_level_indication_escape && profile_and_level_indication_profile!=(int8u)-1 && profile_and_level_indication_level!=(int8u)-1) { Fill(Stream_Video, 0, Video_Format_Profile, Ztring().From_Local(Mpegv_profile_and_level_indication_profile[profile_and_level_indication_profile])+__T("@")+Ztring().From_Local(Mpegv_profile_and_level_indication_level[profile_and_level_indication_level])); Fill(Stream_Video, 0, Video_Codec_Profile, Ztring().From_Local(Mpegv_profile_and_level_indication_profile[profile_and_level_indication_profile])+__T("@")+Ztring().From_Local(Mpegv_profile_and_level_indication_level[profile_and_level_indication_level])); } else if (profile_and_level_indication_escape) { Fill(Stream_Video, 0, Video_Format_Profile, Ztring().From_Local(Mpegv_profile_and_level_indication(profile_and_level_indication))); Fill(Stream_Video, 0, Video_Codec_Profile, Ztring().From_Local(Mpegv_profile_and_level_indication(profile_and_level_indication))); } //Standard Fill(Stream_Video, 0, Video_Standard, Mpegv_video_format[video_format]); if (colour_description) { Fill(Stream_Video, 0, Video_colour_description_present, "Yes"); Fill(Stream_Video, 0, Video_colour_primaries, Mpegv_colour_primaries(colour_primaries)); Fill(Stream_Video, 0, Video_transfer_characteristics, Mpegv_transfer_characteristics(transfer_characteristics)); Fill(Stream_Video, 0, Video_matrix_coefficients, Mpegv_matrix_coefficients(matrix_coefficients)); } //Matrix if (load_intra_quantiser_matrix || load_non_intra_quantiser_matrix) { Fill(Stream_Video, 0, Video_Format_Settings, "CustomMatrix"); Fill(Stream_Video, 0, Video_Format_Settings_Matrix, "Custom"); Fill(Stream_Video, 0, Video_Format_Settings_Matrix_Data, Matrix_intra); Fill(Stream_Video, 0, Video_Format_Settings_Matrix_Data, Matrix_nonintra); Fill(Stream_Video, 0, Video_Codec_Settings, "CustomMatrix"); Fill(Stream_Video, 0, Video_Codec_Settings_Matrix, "Custom"); } else { Fill(Stream_Video, 0, Video_Format_Settings_Matrix, "Default"); Fill(Stream_Video, 0, Video_Codec_Settings_Matrix, "Default"); } //library if (Library.size()>=8) { Fill(Stream_Video, 0, Video_Encoded_Library, Library); Fill(Stream_Video, 0, Video_Encoded_Library_Name, Library_Name); Fill(Stream_Video, 0, Video_Encoded_Library_Version, Library_Version); Fill(Stream_Video, 0, General_Encoded_Library, Library); Fill(Stream_Video, 0, General_Encoded_Library_Name, Library_Name); Fill(Stream_Video, 0, General_Encoded_Library_Version, Library_Version); } //Delay if (group_start_FirstPass && !TimeCodeIsNotTrustable && Time_Begin_Seconds!=Error) { float64 Time_Begin=((float64)Time_Begin_Seconds)*1000; if (FrameRate) Time_Begin+=((float64)Time_Begin_Frames)*1000/FrameRate; Fill(Stream_Video, 0, Video_Delay, Time_Begin, 0); Fill(Stream_Video, 0, Video_Delay_Settings, Ztring(__T("drop_frame_flag="))+(group_start_drop_frame_flag?__T("1"):__T("0"))); Fill(Stream_Video, 0, Video_Delay_Settings, Ztring(__T("closed_gop="))+(group_start_closed_gop?__T("1"):__T("0"))); Fill(Stream_Video, 0, Video_Delay_Settings, Ztring(__T("broken_link="))+(group_start_broken_link?__T("1"):__T("0"))); Fill(Stream_Video, 0, Video_Delay_Source, "Stream"); Fill(Stream_Video, 0, Video_Delay_DropFrame, group_start_drop_frame_flag?"Yes":"No"); Fill(Stream_Video, 0, Video_TimeCode_FirstFrame, TimeCode_FirstFrame.c_str()); if (IsSub) Fill(Stream_Video, 0, Video_TimeCode_Source, "Group of pictures header"); } //BVOP if (BVOP_Count>0) { Fill(Stream_Video, 0, Video_Format_Settings, "BVOP"); Fill(Stream_Video, 0, Video_Format_Settings_BVOP, "Yes"); } else Fill(Stream_Video, 0, Video_Format_Settings_BVOP, "No"); //Buffer Fill(Stream_Video, 0, Video_BufferSize, 2*1024*((((int32u)vbv_buffer_size_extension)<<10)+vbv_buffer_size_value)); //Autorisation of other streams if (!Status[IsAccepted]) { NextCode_Clear(); NextCode_Add(0x00); NextCode_Add(0xB8); } #if MEDIAINFO_MACROBLOCKS if (!Macroblocks_Parse) #endif //MEDIAINFO_MACROBLOCKS for (int8u Pos=0x01; Pos<=0xAF; Pos++) Streams[Pos].Searching_Payload=false; Streams[0xB8].Searching_TimeStamp_End=true; if (IsSub) { Streams[0xB3].Searching_TimeStamp_End=true; Streams[0x00].Searching_TimeStamp_End=true; } //Caption may be in user_data, must be activated if full parsing is requested #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) || defined(MEDIAINFO_SCTE20_YES) || (defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)) Streams[0x00].Searching_Payload=GA94_03_IsPresent || Cdp_IsPresent; Streams[0xB2].Searching_Payload=GA94_03_IsPresent || CC___IsPresent || Scte_IsPresent; Streams[0xB3].Searching_Payload=GA94_03_IsPresent || Cdp_IsPresent; #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) || defined(MEDIAINFO_SCTE20_YES) || (defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)) if (Config->ParseSpeed>=1) { Streams[0x00].Searching_Payload=true; Streams[0xB2].Searching_Payload=true; Streams[0xB3].Searching_Payload=true; Streams[0xB5].Searching_Payload=true; } #if defined(MEDIAINFO_AFDBARDATA_YES) if (DTG1_Parser) Merge(*DTG1_Parser, Stream_Video, 0, 0); if (GA94_06_Parser) { Merge(*GA94_06_Parser, Stream_Video, 0, 0); Ztring LawRating=GA94_06_Parser->Retrieve(Stream_General, 0, General_LawRating); if (!LawRating.empty()) Fill(Stream_General, 0, General_LawRating, LawRating, true); } #endif //defined(MEDIAINFO_AFDBARDATA_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) if (AfdBarData_Parser) Merge(*AfdBarData_Parser, Stream_Video, 0, 0); #endif //defined(MEDIAINFO_AFDBARDATA_YES) //extra if (intra_dc_precision!=(int8u)-1) { Fill(Stream_Video, 0, "intra_dc_precision", 8+intra_dc_precision); (*Stream_More)[Stream_Video][0](Ztring().From_Local("intra_dc_precision"), Info_Options)=__T("N NT"); } //Commercial name if (Retrieve(Stream_Video, 0, Video_Format_Version)==__T("Version 2") && Retrieve(Stream_Video, 0, Video_DisplayAspectRatio)==__T("1.778") && Retrieve(Stream_Video, 0, Video_BitDepth)==__T("8") && Retrieve(Stream_Video, 0, Video_ChromaSubsampling)==__T("4:2:0")) { //HDV1 if (Retrieve(Stream_Video, 0, Video_Width)==__T("1280") && Retrieve(Stream_Video, 0, Video_Height)==__T("720") && Retrieve(Stream_Video, 0, Video_ScanType)==__T("Progressive") && (Retrieve(Stream_Video, 0, Video_FrameRate)==__T("60.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("59.940") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("30.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("29.970") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("24.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("23.976") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("50.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("25.000")) && (Retrieve(Stream_Video, 0, Video_Format_Profile)==__T("Main@High") || Retrieve(Stream_Video, 0, Video_Format_Profile)==__T("Main@High 1440")) && Retrieve(Stream_Video, 0, Video_BitRate).To_int64u()<20000000 && Retrieve(Stream_Video, 0, Video_BitRate_Maximum).To_int64u()<20000000) Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "HDV 720p"); //HDV2 if (Retrieve(Stream_Video, 0, Video_Width)==__T("1440") && Retrieve(Stream_Video, 0, Video_Height)==__T("1080") && Retrieve(Stream_Video, 0, Video_Format_Profile)==__T("Main@High 1440") && Retrieve(Stream_Video, 0, Video_BitRate).To_int64u()<27000000 && Retrieve(Stream_Video, 0, Video_BitRate_Maximum).To_int64u()<27000000) { //Interlaced if (Retrieve(Stream_Video, 0, Video_ScanType)==__T("Interlaced") && (Retrieve(Stream_Video, 0, Video_FrameRate)==__T("30.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("29.970") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("50.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("25.000"))) Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "HDV 1080i"); //Progressive if (Retrieve(Stream_Video, 0, Video_ScanType)==__T("Progressive") && (Retrieve(Stream_Video, 0, Video_FrameRate)==__T("30.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("29.970") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("24.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("23.976") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("50.000") || Retrieve(Stream_Video, 0, Video_FrameRate)==__T("25.000"))) Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "HDV 1080p"); } } } //--------------------------------------------------------------------------- void File_Mpegv::Streams_Finish() { //Duration if (PTS_End>PTS_Begin) { if (PTS_End_temporal_reference::iterator Temp=picture_coding_types.begin(); Temp!=picture_coding_types.end(); ++Temp) { if (Temp->second>MaxCount) { MaxCount=Temp->second; MaxCount_type=Temp->first; } Total+=Temp->second; } if (Total>=4) { int64u Count=0; for (std::map::iterator Temp=picture_coding_types.begin(); Temp!=picture_coding_types.end(); ++Temp) if (Temp->first!=MaxCount_type) Count+=Temp->second; if (CountM_Max) M_Max=M; } else M=1; Ztring GOP; if (M_Max>1) { GOP+=__T("M="); GOP+=Ztring::ToZtring(M_Max); GOP+=__T(", "); } GOP+=__T("N="); GOP+=Ztring::ToZtring(MaxCount_type.size()); Fill(Stream_Video, 0, Video_Format_Settings_GOP, GOP, true); } else Fill(Stream_Video, 0, Video_Format_Settings_GOP, "Variable", Unlimited, true, true); } } //InitDataNotRepeated #if MEDIAINFO_ADVANCED if (!InitDataNotRepeated_Optional && Config_InitDataNotRepeated_Occurences!=(int64u)-1) Fill(Stream_Video, 0, "InitDataRepeated", InitDataNotRepeated>=Config_InitDataNotRepeated_Occurences?"No":"Yes", Unlimited, true, true); #endif // MEDIAINFO_ADVANCED //Other parsers #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) if (GA94_03_Parser && !GA94_03_Parser->Status[IsFinished] && GA94_03_Parser->Status[IsAccepted]) Finish(GA94_03_Parser); if (CC___Parser && !CC___Parser->Status[IsFinished] && CC___Parser->Status[IsAccepted]) Finish(CC___Parser); #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) #if defined(MEDIAINFO_SCTE20_YES) if (Scte_Parser && !Scte_Parser->Status[IsFinished] && Scte_Parser->Status[IsAccepted]) Finish(Scte_Parser); #endif //defined(MEDIAINFO_SCTE20_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) if (DTG1_Parser && !DTG1_Parser->Status[IsFinished] && DTG1_Parser->Status[IsAccepted]) { Finish(DTG1_Parser); Merge(*DTG1_Parser, Stream_Video, 0, 0); } if (GA94_06_Parser && !GA94_06_Parser->Status[IsFinished] && GA94_06_Parser->Status[IsAccepted]) { Finish(GA94_06_Parser); Merge(*GA94_06_Parser, Stream_Video, 0, 0); } #endif //defined(MEDIAINFO_AFDBARDATA_YES) #if defined(MEDIAINFO_CDP_YES) if (Cdp_Parser && !Cdp_Parser->Status[IsFinished] && Cdp_Parser->Status[IsAccepted]) Finish(Cdp_Parser); #endif //defined(MEDIAINFO_CDP_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) if (AfdBarData_Parser && !AfdBarData_Parser->Status[IsFinished] && AfdBarData_Parser->Status[IsAccepted]) { Finish(AfdBarData_Parser); Merge(*AfdBarData_Parser, Stream_Video, 0, 0); } #endif //defined(MEDIAINFO_AFDBARDATA_YES) #if MEDIAINFO_IBI int64u Numerator=0, Denominator=0; switch (frame_rate_code) { case 1 : Numerator=24000; Denominator=1001; break; case 2 : Numerator=24; Denominator=1; break; case 3 : Numerator=25; Denominator=1; break; case 4 : Numerator=30000; Denominator=1001; break; case 5 : Numerator=30; Denominator=1; break; case 6 : Numerator=50; Denominator=1; break; case 7 : Numerator=60000; Denominator=1001; break; case 8 : Numerator=60; Denominator=1; break; default: ; } if (Numerator) { Numerator*=frame_rate_extension_n+1; Denominator*=frame_rate_extension_d+1; Ibi_Stream_Finish(Numerator, Denominator); } #endif //MEDIAINFO_IBI } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Mpegv::Synched_Test() { //Must have enough buffer for having header if (Buffer_Offset+4>Buffer_Size) return false; //Quick test of synchro if (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x01) { Synched=false; return true; } //Quick search if (!Header_Parser_QuickSearch()) return false; #if MEDIAINFO_IBI if ((Ibi_SliceParsed && (Buffer[Buffer_Offset+3]==0x00)) || Buffer[Buffer_Offset+3]==0xB3) // picture_start without sequence_header or sequence_header { if (Buffer_Offset+6>Buffer_Size) return false; bool RandomAccess=(Buffer[Buffer_Offset+5]&0x38)==0x08 || Buffer[Buffer_Offset+3]==0xB3; //picture_start with I-Frame || sequence_header if (RandomAccess) Ibi_Add(); Ibi_SliceParsed=false; } #endif //MEDIAINFO_IBI //We continue return true; } //--------------------------------------------------------------------------- void File_Mpegv::Synched_Init() { //Temp BVOP_Count=0; progressive_frame_Count=0; Interlaced_Top=0; Interlaced_Bottom=0; display_horizontal_size=0; display_vertical_size=0; vbv_delay=0; vbv_buffer_size_value=0; Time_Current_Seconds=Error; Time_Current_Frames=(int8u)-1; Time_Begin_Seconds=Error; Time_Begin_Frames=(int8u)-1; Time_End_Seconds=Error; Time_End_Frames=(int8u)-1; picture_coding_type=(int8u)-1; bit_rate_value=0; FrameRate=0; horizontal_size_value=0; vertical_size_value=0; bit_rate_extension=0; temporal_reference_Old=(int16u)-1; temporal_reference_Max=0; aspect_ratio_information=0; frame_rate_code=0; profile_and_level_indication_profile=(int8u)-1; profile_and_level_indication_level=(int8u)-1; chroma_format=1; //Default is 4:2:0 horizontal_size_extension=0; vertical_size_extension=0; frame_rate_extension_n=0; frame_rate_extension_d=0; video_format=5; //Unspecified video format colour_primaries=(int8u)-1; transfer_characteristics=(int8u)-1; matrix_coefficients=(int8u)-1; vbv_buffer_size_extension=0; intra_dc_precision=(int8u)-1; load_intra_quantiser_matrix=false; load_non_intra_quantiser_matrix=false; progressive_sequence=true; //progressive by default top_field_first=false; repeat_first_field=false; FirstFieldFound=false; group_start_IsParsed=false; group_start_FirstPass=false; PTS_LastIFrame=(int64u)-1; PTS_End_temporal_reference=(int16u)-1; bit_rate_value_IsValid=false; profile_and_level_indication_escape=false; colour_description=false; low_delay=false; RefFramesCount=0; BVOPsSinceLastRefFrames=0; temporal_reference_LastIFrame=0; tc=0; IFrame_IsParsed=false; IFrame_Count=0; #if MEDIAINFO_IBI Ibi_SliceParsed=true; #endif //MEDIAINFO_IBI #if MEDIAINFO_ADVANCED Config_VariableGopDetection_Occurences=MediaInfoLib::Config.VariableGopDetection_Occurences_Get(); Config_VariableGopDetection_GiveUp=MediaInfoLib::Config.VariableGopDetection_GiveUp_Get(); InitDataNotRepeated=0; Config_InitDataNotRepeated_Occurences=MediaInfoLib::Config.InitDataNotRepeated_Occurences_Get(); Config_InitDataNotRepeated_GiveUp=MediaInfoLib::Config.InitDataNotRepeated_GiveUp_Get(); #endif //MEDIAINFO_ADVANCED //Default stream values Streams.resize(0x100); Streams[0xB3].Searching_Payload=true; for (int8u Pos=0xFF; Pos>=0xB9; Pos--) Streams[Pos].Searching_Payload=true; //Testing MPEG-PS //Macroblocks #if MEDIAINFO_MACROBLOCKS Macroblocks_Parse=Config->File_Macroblocks_Parse_Get(); if (Macroblocks_Parse) { macroblock_address_increment_Vlc.Array=NULL; macroblock_address_increment_Vlc.Vlc=Mpegv_macroblock_address_increment; macroblock_address_increment_Vlc.Size=11; Get_VL_Prepare(macroblock_address_increment_Vlc); dct_dc_size_luminance.Array=NULL; dct_dc_size_luminance.Vlc=Mpegv_dct_dc_size_luminance; dct_dc_size_luminance.Size=9; Get_VL_Prepare(dct_dc_size_luminance); dct_dc_size_chrominance.Array=NULL; dct_dc_size_chrominance.Vlc=Mpegv_dct_dc_size_chrominance; dct_dc_size_chrominance.Size=10; Get_VL_Prepare(dct_dc_size_chrominance); dct_coefficients_0.Array=NULL; dct_coefficients_0.Vlc=Mpegv_dct_coefficients_0; dct_coefficients_0.Size=17; Get_VL_Prepare(dct_coefficients_0); dct_coefficients_1.Array=NULL; dct_coefficients_1.Vlc=Mpegv_dct_coefficients_1; dct_coefficients_1.Size=17; Get_VL_Prepare(dct_coefficients_1); macroblock_type_I.Array=NULL; macroblock_type_I.Vlc=Mpegv_macroblock_type_I; macroblock_type_I.Size=2; Get_VL_Prepare(macroblock_type_I); macroblock_type_P.Array=NULL; macroblock_type_P.Vlc=Mpegv_macroblock_type_P; macroblock_type_P.Size=6; Get_VL_Prepare(macroblock_type_P); macroblock_type_B.Array=NULL; macroblock_type_B.Vlc=Mpegv_macroblock_type_B; macroblock_type_B.Size=6; Get_VL_Prepare(macroblock_type_B); motion_code.Array=NULL; motion_code.Vlc=Mpegv_motion_code; motion_code.Size=11; Get_VL_Prepare(motion_code); dmvector.Array=NULL; dmvector.Vlc=Mpegv_dmvector; dmvector.Size=2; Get_VL_Prepare(dmvector); coded_block_pattern.Array=NULL; coded_block_pattern.Vlc=Mpegv_coded_block_pattern; coded_block_pattern.Size=9; Get_VL_Prepare(coded_block_pattern); } #endif //MEDIAINFO_MACROBLOCKS } //*************************************************************************** // Buffer - Demux //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX bool File_Mpegv::Demux_UnpacketizeContainer_Test() { if ((Demux_IntermediateItemFound && Buffer[Buffer_Offset+3]==0x00) || Buffer[Buffer_Offset+3]==0xB3) { if (Demux_Offset==0) { Demux_Offset=Buffer_Offset; Demux_IntermediateItemFound=false; } while (Demux_Offset+4<=Buffer_Size) { //Synchronizing while(Demux_Offset+4<=Buffer_Size && (Buffer[Demux_Offset ]!=0x00 || Buffer[Demux_Offset+1]!=0x00 || Buffer[Demux_Offset+2]!=0x01)) { Demux_Offset+=2; while(Demux_Offset=Buffer_Size || Buffer[Demux_Offset-1]==0x00) Demux_Offset--; } if (Demux_Offset+4>Buffer_Size) { if (File_Offset+Buffer_Size==File_Size) Demux_Offset=Buffer_Size; break; } if (Demux_IntermediateItemFound) { bool MustBreak; switch (Buffer[Demux_Offset+3]) { case 0x00 : case 0xB3 : MustBreak=true; break; default : Demux_Offset+=3; MustBreak=false; } if (MustBreak) break; //while() loop } else { if (!Buffer[Demux_Offset+3]) Demux_IntermediateItemFound=true; } Demux_Offset++; } if (Demux_Offset+4>Buffer_Size && File_Offset+Buffer_Size!=File_Size) return false; //No complete frame bool RandomAccess=Buffer[Buffer_Offset+3]==0xB3; if (!Status[IsAccepted]) { Accept("AVC"); if (Config->Demux_EventWasSent) return false; } if (IFrame_IsParsed || RandomAccess) Demux_UnpacketizeContainer_Demux(RandomAccess); else Demux_UnpacketizeContainer_Demux_Clear(); } return true; } #endif //MEDIAINFO_DEMUX //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpegv::Read_Buffer_Unsynched() { for (int8u Pos=0x00; Pos<0xB9; Pos++) { Streams[Pos].Searching_Payload=false; Streams[Pos].Searching_TimeStamp_Start=false; Streams[Pos].Searching_TimeStamp_End=false; } Streams[0xB3].Searching_TimeStamp_End=true; //sequence_header Streams[0xB8].Searching_TimeStamp_End=true; //group_start Time_End_Seconds=Error; Time_End_Frames=(int8u)-1; RefFramesCount=0; sequence_header_IsParsed=false; group_start_IsParsed=false; PTS_LastIFrame=(int64u)-1; IFrame_IsParsed=false; picture_coding_types_Current.clear(); #if MEDIAINFO_IBI Ibi_SliceParsed=true; #endif //MEDIAINFO_IBI #if MEDIAINFO_MACROBLOCKS if (Macroblocks_Parse) { macroblock_x_PerFrame=0; macroblock_y_PerFrame=0; } #endif //MEDIAINFO_MACROBLOCKS temporal_reference_Old=(int16u)-1; for (size_t Pos=0; PosOpen_Buffer_Unsynch(); if (CC___Parser) CC___Parser->Open_Buffer_Unsynch(); #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) #if defined(MEDIAINFO_SCTE20_YES) Scte_TemporalReference_Offset=0; if (Scte_Parser) Scte_Parser->Open_Buffer_Unsynch(); #endif //defined(MEDIAINFO_SCTE20_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) if (DTG1_Parser) DTG1_Parser->Open_Buffer_Unsynch(); if (GA94_06_Parser) GA94_06_Parser->Open_Buffer_Unsynch(); #endif //defined(MEDIAINFO_AFDBARDATA_YES) #if defined(MEDIAINFO_CDP_YES) if (Cdp_Parser) Cdp_Parser->Open_Buffer_Unsynch(); #endif //defined(MEDIAINFO_CDP_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) if (AfdBarData_Parser) AfdBarData_Parser->Open_Buffer_Unsynch(); #endif //defined(MEDIAINFO_AFDBARDATA_YES) #if defined(MEDIAINFO_ANCILLARY_YES) if (Ancillary && *Ancillary && (*Ancillary)->Cdp_Data.empty()) (*Ancillary)->AspectRatio=0; #endif //defined(MEDIAINFO_ANCILLARY_YES) //NextCode if (!Status[IsAccepted]) { NextCode_Clear(); NextCode_Add(0xB3); NextCode_Add(0xB8); } } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpegv::Header_Parse() { #if MEDIAINFO_TRACE if (Trace_Activated) { //Parsing int8u start_code; Skip_B3( "synchro"); Get_B1 (start_code, "start_code"); if (!Header_Parser_Fill_Size()) { Element_WaitForMoreData(); return; } //Filling Header_Fill_Code(start_code, Ztring().From_CC1(start_code)); } else { #endif //MEDIAINFO_TRACE //Parsing int8u start_code=Buffer[Buffer_Offset+3]; Element_Offset+=4; if (!Header_Parser_Fill_Size()) { Element_WaitForMoreData(); return; } //Filling Header_Fill_Code(start_code, Ztring().From_CC1(start_code)); #if MEDIAINFO_TRACE } #endif //MEDIAINFO_TRACE } //--------------------------------------------------------------------------- bool File_Mpegv::Header_Parser_Fill_Size() { //Look for next Sync word if (Buffer_Offset_Temp==0) //Buffer_Offset_Temp is not 0 if Header_Parse_Fill_Size() has already parsed first frames Buffer_Offset_Temp=Buffer_Offset+4; while (Buffer_Offset_Temp+4<=Buffer_Size && CC3(Buffer+Buffer_Offset_Temp)!=0x000001) { Buffer_Offset_Temp+=2; while(Buffer_Offset_Temp=Buffer_Size || Buffer[Buffer_Offset_Temp-1]==0x00) Buffer_Offset_Temp--; } //Must wait more data? if (Buffer_Offset_Temp+4>Buffer_Size) { if (FrameIsAlwaysComplete || File_Offset+Buffer_Size==File_Size) Buffer_Offset_Temp=Buffer_Size; //We are sure that the next bytes are a start else return false; } //OK, we continue Header_Fill_Size(Buffer_Offset_Temp-Buffer_Offset); Buffer_Offset_Temp=0; return true; } //--------------------------------------------------------------------------- bool File_Mpegv::Header_Parser_QuickSearch() { while ( Buffer_Offset+4<=Buffer_Size && Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x00 && Buffer[Buffer_Offset+2]==0x01) { //Getting start_code int8u start_code=Buffer[Buffer_Offset+3]; //Searching start or timestamp if (Streams[start_code].Searching_Payload || Streams[start_code].Searching_TimeStamp_Start || Streams[start_code].Searching_TimeStamp_End) return true; #if MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS if (start_code==0xB3) // sequence_header { // Has_sequence_header=true; } if (start_code==0xB5) // extension_start { if (Buffer_Offset+5>Buffer_Size) return false; if ((Buffer[Buffer_Offset+4]&0xF0)==0x10) // sequence_extension Has_sequence_extension=true; } #endif // MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS //Synchronizing Buffer_Offset+=4; Synched=false; if (!Synchronize()) { UnSynched_IsNotJunk=true; return false; } if (Buffer_Offset+4>Buffer_Size) { UnSynched_IsNotJunk=true; return false; } } Trusted_IsNot("MPEG Video, Synchronisation lost"); return Synchronize(); } //--------------------------------------------------------------------------- void File_Mpegv::Data_Parse() { //Parsing switch (Element_Code) { case 0x00: picture_start(); break; case 0xB0: Skip_XX(Element_Size, "Unknown"); break; case 0xB1: Skip_XX(Element_Size, "Unknown"); break; case 0xB2: user_data_start(); break; case 0xB3: sequence_header(); break; case 0xB4: sequence_error(); break; case 0xB5: extension_start(); break; case 0xB6: Skip_XX(Element_Size, "Unknown"); break; case 0xB7: sequence_end(); break; case 0xB8: group_start(); break; default: if (Element_Code>=0x01 && Element_Code<=0xAF) slice_start(); else Trusted_IsNot("Unattended element"); } } //*************************************************************************** // EOF //*************************************************************************** //--------------------------------------------------------------------------- void File_Mpegv::Detect_EOF() { if ((IsSub && Status[IsFilled]) || (!IsSub && File_Size>SizeToAnalyse_Begin+SizeToAnalyse_End && File_Offset+Buffer_Offset+Element_Offset>SizeToAnalyse_Begin && File_Offset+Buffer_Offset+Element_OffsetParseSpeed<=0.5)) { if (MustExtendParsingDuration && Frame_CountSizeToAnalyse_Begin*10+SizeToAnalyse_End*10 && File_Offset+Buffer_Offset+Element_Offset>SizeToAnalyse_Begin*10 && File_Offset+Buffer_Offset+Element_Offset=TemporalReference.size()) TemporalReference.resize(TemporalReference_Offset+temporal_reference+1); if (TemporalReference[TemporalReference_Offset+temporal_reference]==NULL) TemporalReference[TemporalReference_Offset+temporal_reference]=new temporalreference; TemporalReference[TemporalReference_Offset+temporal_reference]->IsValid=true; //picture_coding_types if (picture_coding_type==1) //I-Frame { if (!picture_coding_types_Current.empty()) { picture_coding_types[picture_coding_types_Current]++; #if MEDIAINFO_ADVANCED // Testing if we must give up if (Config_VariableGopDetection_GiveUp && picture_coding_types.size()>1) { int64u MaxCount=0; string MaxCount_type; for (std::map::iterator Temp=picture_coding_types.begin(); Temp!=picture_coding_types.end(); ++Temp) if (Temp->second>MaxCount) { MaxCount=Temp->second; MaxCount_type=Temp->first; } int64u Count=0; for (std::map::iterator Temp=picture_coding_types.begin(); Temp!=picture_coding_types.end(); ++Temp) if (Temp->first!=MaxCount_type) Count+=Temp->second; if (Count>=Config_VariableGopDetection_Occurences) Config->ParseSpeed=0; // Give up } #endif // MEDIAINFO_ADVANCED } picture_coding_types_Current='I'; } else if (!picture_coding_types_Current.empty()) //If an I-Frame is already found picture_coding_types_Current+=Mpegv_picture_coding_type[picture_coding_type]; //Detecting streams with only I-Frames if (picture_coding_type==1 && picture_coding_type_Old==1 && !FirstFieldFound) temporal_reference_Old=(int16u)-1; //Resetting temporal_reference_Old //NextCode if (!Status[IsAccepted]) { NextCode_Clear(); for (int64u Element_Name_Next=0x01; Element_Name_Next<=0xAF; Element_Name_Next++) NextCode_Add(Element_Name_Next); NextCode_Add(0xB2); NextCode_Add(0xB5); NextCode_Add(0xB8); } //Autorisation of other streams for (int8u Pos=0x01; Pos<=0xAF; Pos++) Streams[Pos].Searching_Payload=true; FILLING_END(); } //--------------------------------------------------------------------------- // Packet "01" --> "AF" void File_Mpegv::slice_start() { //Encryption management if (CA_system_ID_MustSkipSlices) { //Is not decodable Finish("MPEG Video"); return; } if (!Status[IsAccepted]) { if (!NextCode_Test()) return; } Element_Name("slice_start"); //Parsing #if MEDIAINFO_MACROBLOCKS if (Macroblocks_Parse && MPEG_Version==2) { BS_Begin(); bool intra_slice_flag; if (0x1000*vertical_size_extension+vertical_size_value>2800) //vertical_size Skip_S1(3, "slice_vertical_position_extension"); if (sequence_scalable_extension_Present) Skip_S1(7, "priority_breakpoint"); Skip_S1(5, "quantiser_scale_code"); Peek_SB(intra_slice_flag); if (intra_slice_flag) { Skip_SB( "intra_slice_flag"); Skip_SB( "intra_slice"); Skip_S1(7, "reserved_bits"); for (;;) { bool extra_bit_slice; Peek_SB(extra_bit_slice); if (extra_bit_slice) { Skip_S1(8, "extra_information_slice"); } else break; if (!Data_BS_Remain()) { Trusted_IsNot("extra_bit_slice is missing"); return; } } } Skip_SB( "extra_bit_slice (must be 0)"); macroblock_x=(int64u)-1; while (Synched) //Synched: testing if this is still valid { int8u Remain; if (Data_BS_Remain()%8) Peek_S1(Data_BS_Remain()%8, Remain); else if (Data_Remain()) Remain=Buffer[Buffer_Offset+(size_t)(Element_Size-Data_Remain())]; else Remain=0; if (Remain==0) { int32u Remain3; size_t Bits=Data_BS_Remain(); if (Bits>23) Bits=23; Peek_S3((int8u)Bits, Remain3); if (Remain3==0) break; } slice_start_macroblock(); } if (Data_BS_Remain()) Skip_BS(Data_BS_Remain(), "padding"); BS_End(); } else #endif //MEDIAINFO_MACROBLOCK Skip_XX(Element_Size, "data"); FILLING_BEGIN(); int64u tc_ToAdd=tc/((progressive_sequence || picture_structure==3)?1:2); //Progressive of Frame //Timestamp if (!TimeCodeIsNotTrustable && group_start_FirstPass && (Time_Begin_Seconds==Error || (Frame_Count<16 && Time_Current_Seconds*FrameRate+Time_Current_Frames+temporal_referenceAspectRatio=MPEG_Version==1?Mpegv_aspect_ratio1[aspect_ratio_information]:Mpegv_aspect_ratio2[aspect_ratio_information]; (*Ancillary)->FrameRate=((float)(Mpegv_frame_rate[frame_rate_code] * (frame_rate_extension_n + 1)) / (float)(frame_rate_extension_d + 1)); if ((*Ancillary)->PTS_DTS_Needed) (*Ancillary)->FrameInfo.DTS=FrameInfo.DTS; if ((*Ancillary)->Status[IsAccepted]) //In order to test if there is a parser using ancillary data Open_Buffer_Continue((*Ancillary), Buffer+Buffer_Offset, 0); Element_Trace_End0(); } #endif //defined(MEDIAINFO_CDP_YES) //Active Format Description & Bar Data #if defined(MEDIAINFO_AFDBARDATA_YES) if (Ancillary && *Ancillary && !(*Ancillary)->AfdBarData_Data.empty()) { Element_Trace_Begin1("Active Format Description & Bar Data"); //Parsing if (AfdBarData_Parser==NULL) { AfdBarData_Parser=new File_AfdBarData; Open_Buffer_Init(AfdBarData_Parser); ((File_AfdBarData*)AfdBarData_Parser)->Format=File_AfdBarData::Format_S2016_3; } if (AfdBarData_Parser->PTS_DTS_Needed) AfdBarData_Parser->FrameInfo.DTS=FrameInfo.DTS; if (!AfdBarData_Parser->Status[IsFinished]) Open_Buffer_Continue(AfdBarData_Parser, (*Ancillary)->AfdBarData_Data[0]->Data, (*Ancillary)->AfdBarData_Data[0]->Size); //Removing data from stack delete (*Ancillary)->AfdBarData_Data[0]; //(*Ancillary)->AfdBarData_Data[0]=NULL; (*Ancillary)->AfdBarData_Data.erase((*Ancillary)->AfdBarData_Data.begin()); Element_Trace_End0(); } #endif //defined(MEDIAINFO_AFDBARDATA_YES) //Counting if (!MustExtendParsingDuration && File_Offset+Buffer_Offset+Element_Size==File_Size) Frame_Count_Valid=Frame_Count; //Finish frames in case of there are less than Frame_Count_Valid frames if (!TimeCodeIsNotTrustable && (picture_coding_type==1 || picture_coding_type==2)) //IFrame or PFrame { Time_End_Frames++; //One frame if (progressive_sequence && repeat_first_field) { Time_End_Frames++; //Frame repeated a second time if (top_field_first) Time_End_Frames++; //Frame repeated a third time } } Frame_Count++; Frame_Count_InThisBlock++; if (IFrame_IsParsed && Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; if (!(progressive_sequence || picture_structure==3)) { Field_Count++; Field_Count_InThisBlock++; } if (picture_coding_type==3) BVOP_Count++; else BVOPsSinceLastRefFrames=0; if (RefFramesCount<2 && (picture_coding_type==1 || picture_coding_type==2)) RefFramesCount++; if (repeat_first_field) { if (progressive_sequence) { tc_ToAdd+=tc; if (top_field_first) tc_ToAdd+=tc; } else tc_ToAdd+=tc/2; } if (FrameInfo.DTS!=(int64u)-1) { FrameInfo.DTS+=tc_ToAdd; if (DTS_EndPTS_End || (PTS_End>1000000000 && FrameInfo.PTS+tc_ToAdd<=PTS_End-1000000000)) //More than current PTS_End or less than current PTS_End minus 1 second (there is a problem?) { PTS_End=FrameInfo.PTS+tc_ToAdd; PTS_End_temporal_reference=temporal_reference; } if (low_delay) FrameInfo.PTS+=tc_ToAdd; else FrameInfo.PTS=(int64u)-1; //With repeat_first_field option, it is impossible to know what is the next PTS } //NextCode if (!Status[IsAccepted]) { NextCode_Clear(); NextCode_Add(0x00); NextCode_Add(0xB3); NextCode_Add(0xB8); } //Autorisation of other streams #if MEDIAINFO_MACROBLOCKS if (!Macroblocks_Parse) #endif //MEDIAINFO_MACROBLOCKS for (int8u Pos=0x01; Pos<=0xAF; Pos++) Streams[Pos].Searching_Payload=false; //Filling only if not already done if (!Status[IsAccepted]) Accept("MPEG Video"); if (!MustExtendParsingDuration && IFrame_Count==8) Frame_Count_Valid=Frame_Count; //We have enough frames if (!Status[IsFilled] && Frame_Count>=Frame_Count_Valid) { Fill("MPEG Video"); if (File_Size==(int64u)-1) Finish("MPEG Video"); else if (!IsSub && 2*(File_Offset+Buffer_Size+SizeToAnalyse_End)ParseSpeed<1.0) { Open_Buffer_Unsynch(); GoToFromEnd(SizeToAnalyse_End); } } //Skipping slices (if already unpacketized) #if MEDIAINFO_DEMUX if (Demux_UnpacketizeContainer && Buffer_TotalBytes+Buffer_Offset=Config_InitDataNotRepeated_Occurences) Config->ParseSpeed=0; // Give up } #endif // MEDIAINFO_ADVANCED } #endif // MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS #if MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS //Packets Has_sequence_header=false; Has_sequence_extension=false; #endif // MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS FILLING_END(); } //--------------------------------------------------------------------------- // Packet Packet "01" --> "AF", slice_start, macroblock #if MEDIAINFO_MACROBLOCKS enum Mpegv_macroblock_type_config //bitwise { spatial_temporal_weight_code_flag =0x01, macroblock_intra =0x02, macroblock_pattern =0x04, macroblock_motion_backward =0x08, macroblock_motion_forward =0x10, macroblock_quant =0x20, }; void File_Mpegv::slice_start_macroblock() { frame_motion_type=(int8u)-1; spatial_temporal_weight_code=0; Element_Trace_Begin1("macroblock"); size_t macroblock_address_increment; do { Get_VL(macroblock_address_increment_Vlc, macroblock_address_increment, "macroblock_address_increment"); Element_Info1(__T("macroblock_address_increment=")+Ztring::ToZtring(Mpegv_macroblock_address_increment[macroblock_address_increment].mapped_to3)); if (macroblock_x!=(int64u)-1) macroblock_x+=Mpegv_macroblock_address_increment[macroblock_address_increment].mapped_to3; } while (Mpegv_macroblock_address_increment[macroblock_address_increment].mapped_to1==2); //Escape code if (macroblock_x==(int64u)-1) macroblock_x=0; Element_Info1(__T("macroblock_x=")+Ztring::ToZtring(macroblock_x)); Element_Trace_Begin1("macroblock_modes"); vlc_fast* macroblock_type_X; switch(picture_coding_type) { case 1: macroblock_type_X=¯oblock_type_I; break; case 2: macroblock_type_X=¯oblock_type_P; break; case 3: macroblock_type_X=¯oblock_type_B; break; default : Element_DoNotTrust("Wrong picture_coding_type"); Element_Trace_End0(); Element_Trace_End0(); return; } size_t macroblock_type_offset; Get_VL(*macroblock_type_X, macroblock_type_offset, "macroblock_type"); macroblock_type=macroblock_type_X->Vlc[macroblock_type_offset].mapped_to3; if (!Synched) { BS_End(); Element_Offset=Element_Size; return; } Element_Info1(__T("macroblock_quant=")+Ztring::ToZtring(macroblock_type¯oblock_quant)); Element_Info1(__T("macroblock_motion_forward=")+Ztring::ToZtring(macroblock_type¯oblock_motion_forward)); Element_Info1(__T("macroblock_motion_backward=")+Ztring::ToZtring(macroblock_type¯oblock_motion_backward)); Element_Info1(__T("macroblock_pattern=")+Ztring::ToZtring(macroblock_type¯oblock_pattern)); Element_Info1(__T("macroblock_intra=")+Ztring::ToZtring(macroblock_type¯oblock_intra)); Element_Info1(__T("spatial_temporal_weight_code_flag=")+Ztring::ToZtring(macroblock_type&spatial_temporal_weight_code_flag)); if (macroblock_type&spatial_temporal_weight_code_flag && spatial_temporal_weight_code_table_index) Get_S1 (2, spatial_temporal_weight_code, "spatial_temporal_weight_code"); if (macroblock_type¯oblock_intra && concealment_motion_vectors) frame_motion_type=2; if (macroblock_type¯oblock_motion_forward || macroblock_type¯oblock_motion_backward) { if (picture_structure==3) //Frame { if (!frame_pred_frame_dct) Get_S1(2, frame_motion_type, "frame_motion_type"); else frame_motion_type=2; } else Get_S1 (2, field_motion_type, "field_motion_type"); } if (picture_structure==3 //Frame && !frame_pred_frame_dct && (macroblock_type¯oblock_intra || macroblock_type¯oblock_pattern)) Skip_SB( "dct_type"); Element_Trace_End0(); if (macroblock_type¯oblock_quant) Skip_S1(5, "quantiser_scale_code"); if (macroblock_type¯oblock_motion_forward || (macroblock_type¯oblock_intra && concealment_motion_vectors)) slice_start_macroblock_motion_vectors(false); if (macroblock_type¯oblock_motion_backward) slice_start_macroblock_motion_vectors(true); if (macroblock_type¯oblock_intra && concealment_motion_vectors) Mark_1(); if (macroblock_type¯oblock_pattern) slice_start_macroblock_coded_block_pattern(); for (int8u i=0; i "AF", slice_start, macroblock, motion_vectors #if MEDIAINFO_MACROBLOCKS void File_Mpegv::slice_start_macroblock_motion_vectors(bool s) { Element_Trace_Begin1("motion_vectors"); int8u motion_vector_count; switch (frame_motion_type) { case 1 : switch (spatial_temporal_weight_code) { case 0 : case 1 : motion_vector_count=2; break; case 2 : case 3 : motion_vector_count=1; break; default: Trusted_IsNot("spatial_temporal_weight_code problem"); Element_Trace_End0(); return; } break; case 2 : motion_vector_count=1; break; case 3 : switch (spatial_temporal_weight_code) { case 1 : Trusted_IsNot("spatial_temporal_weight_code problem"); Element_Trace_End0(); return; default: motion_vector_count=1; break; } default : Trusted_IsNot("frame_motion_type problem"); Element_Trace_End0(); return; } if (motion_vector_count==1) { if (!(picture_structure==3 //Frame && frame_motion_type==2) //mv_format==Frame && frame_motion_type!=3) //dmv!=1 Skip_SB( "motion_vertical_field_select[0][s]"); slice_start_macroblock_motion_vectors_motion_vector(false, s); } else { Skip_SB( "motion_vertical_field_select[0][s]"); slice_start_macroblock_motion_vectors_motion_vector(false, s); Skip_SB( "motion_vertical_field_select[1][s]"); slice_start_macroblock_motion_vectors_motion_vector(true, s); } Element_Trace_End0(); } #endif //MEDIAINFO_MACROBLOCKS //--------------------------------------------------------------------------- // Packet Packet "01" --> "AF", slice_start, macroblock, motion_vectors, motion_vector #if MEDIAINFO_MACROBLOCKS void File_Mpegv::slice_start_macroblock_motion_vectors_motion_vector(bool r, bool s) { Element_Trace_Begin1("motion_vector"); size_t motion_code_; Get_VL(motion_code, motion_code_, "motion_code[r][s][0]"); Param_Info1(Mpegv_motion_code[motion_code_].mapped_to3); if (Mpegv_motion_code[motion_code_].mapped_to3) Skip_SB( "motion_code[r][s][0] sign"); if (f_code[s][0]>1 && Mpegv_motion_code[motion_code_].mapped_to3) Skip_S1(f_code[s][0]-1, "motion_residual[r][s][0]"); if (frame_motion_type==3) //dmv==1 { Info_VL(dmvector, dmvector_, "dmvector[0]"); Param_Info1(Mpegv_dmvector[dmvector_].mapped_to3); } Get_VL(motion_code, motion_code_, "motion_code[r][s][1]"); Param_Info1(Mpegv_motion_code[motion_code_].mapped_to3); if (Mpegv_motion_code[motion_code_].mapped_to3) Skip_SB( "motion_code[r][s][1] sign"); if (f_code[s][1]>1 && Mpegv_motion_code[motion_code_].mapped_to3) Skip_S1(f_code[s][1]-1, "motion_residual[r][s][1]"); if (frame_motion_type==3) //dmv==1 { Info_VL(dmvector, dmvector_, "dmvector[1]"); Param_Info1(Mpegv_dmvector[dmvector_].mapped_to3); } Element_Trace_End0(); } #endif //MEDIAINFO_MACROBLOCKS //--------------------------------------------------------------------------- // Packet Packet "01" --> "AF", slice_start, macroblock, coded_block_pattern #if MEDIAINFO_MACROBLOCKS void File_Mpegv::slice_start_macroblock_coded_block_pattern() { Element_Trace_Begin1("coded_block_pattern"); size_t coded_block_pattern_; Get_VL(coded_block_pattern, coded_block_pattern_, "coded_block_pattern_420"); cbp=Mpegv_coded_block_pattern[coded_block_pattern_].mapped_to3; switch (chroma_format) { case 2 : //4:2:2 { int8u coded_block_pattern_1; Get_S1 (2, coded_block_pattern_1, "coded_block_pattern_1"); cbp<<=2; cbp|=coded_block_pattern_1; } break; case 3 : //4:4:4 { int8u coded_block_pattern; Get_S1 (8, coded_block_pattern, "coded_block_pattern_1/2"); cbp<<=8; cbp|=coded_block_pattern; } break; default : ; } Element_Info1(Ztring::ToZtring((int16u)cbp, 2)); Element_Trace_End0(); } #endif //MEDIAINFO_MACROBLOCKS //--------------------------------------------------------------------------- // Packet Packet "01" --> "AF", slice_start, macroblock, block #if MEDIAINFO_MACROBLOCKS void File_Mpegv::slice_start_macroblock_block(int8u i) { //pattern_code if (!(macroblock_type¯oblock_intra) && !((macroblock_type¯oblock_pattern) && (cbp&(1<<(block_count-1-i))))) return; Element_Trace_Begin1("block"); Element_Info1(i); bool IsFirst; const vlc* Mpegv_dct_coefficients; vlc_fast* Mpegv_dct_coefficients2; if (macroblock_type¯oblock_intra) { IsFirst=false; Mpegv_dct_coefficients=intra_vlc_format?Mpegv_dct_coefficients_1:Mpegv_dct_coefficients_0; Mpegv_dct_coefficients2=&(intra_vlc_format?dct_coefficients_1:dct_coefficients_0); if (i<4) { size_t dct_dc_size_luminance_; Get_VL(dct_dc_size_luminance, dct_dc_size_luminance_, "dct_dc_size_luminance"); Param_Info1(Mpegv_dct_dc_size_luminance[dct_dc_size_luminance_].mapped_to3); if (Mpegv_dct_dc_size_luminance[dct_dc_size_luminance_].mapped_to3) Skip_S2(Mpegv_dct_dc_size_luminance[dct_dc_size_luminance_].mapped_to3, "dct_dc_differential"); } else { size_t dct_dc_size_chrominance_; Get_VL(dct_dc_size_chrominance, dct_dc_size_chrominance_, "dct_dc_size_chrominance"); Param_Info1(Mpegv_dct_dc_size_chrominance[dct_dc_size_chrominance_].mapped_to3); if (Mpegv_dct_dc_size_chrominance[dct_dc_size_chrominance_].mapped_to3) Skip_S2((int8u)dct_dc_size_chrominance_, "dct_dc_differential"); } } else { IsFirst=true; Mpegv_dct_coefficients=Mpegv_dct_coefficients_0; Mpegv_dct_coefficients2=&dct_coefficients_0; } for (;;) { Element_Trace_Begin1("dct_coefficient"); size_t dct_coefficient; Get_VL(*Mpegv_dct_coefficients2, dct_coefficient, "dct_coefficient"); switch (Mpegv_dct_coefficients[dct_coefficient].mapped_to1) { case 1 : Element_Trace_End1("End of block"); Element_Trace_End0(); return; case 2 : #if MEDIAINFO_TRACE if (Trace_Activated) { Info_S1( 6, Run, "Run"); Element_Info1(Run); Info_S2(12, Level, "Level"); Element_Info1(Level-(Level>0x800?4096:0)); } else #endif //MEDIAINFO_MACROBLOCKS Skip_S3(18, "Run + Level"); break; case 3 : if (!IsFirst) { if (Mpegv_dct_coefficients[dct_coefficient].bit_increment) { Element_Trace_End1("End of block"); Element_Trace_End0(); return; } Skip_SB( "dct_coefficient sign"); } default: Element_Info1(Mpegv_dct_coefficients[dct_coefficient].mapped_to2); Element_Info1(Mpegv_dct_coefficients[dct_coefficient].mapped_to3); } if (IsFirst) IsFirst=false; Element_Trace_End0(); } } #endif //MEDIAINFO_MACROBLOCKS //--------------------------------------------------------------------------- // Packet "B2" void File_Mpegv::user_data_start() { Element_Name("user_data_start"); //GA94 stuff if (Element_Size>=4) { int32u GA94_Identifier; Peek_B4(GA94_Identifier); switch (GA94_Identifier) { case 0x434301F8 : user_data_start_CC(); return; case 0x44544731 : user_data_start_DTG1(); return; case 0x47413934 : user_data_start_GA94(); return; default : { int8u SCTE20_Identifier; Peek_B1(SCTE20_Identifier); if (SCTE20_Identifier==0x03) { user_data_start_3(); return; } } } } //Rejecting junk at the begin size_t Library_Start_Offset=0; while (Library_Start_Offset+4<=Element_Size) { bool OK=true; for (size_t Pos=0; Pos<4; Pos++) { if (!((Buffer[Buffer_Offset+Library_Start_Offset+Pos]==0x20 && Pos) || Buffer[Buffer_Offset+Library_Start_Offset+Pos]==0x22 || Buffer[Buffer_Offset+Library_Start_Offset+Pos]==0x27 || Buffer[Buffer_Offset+Library_Start_Offset+Pos]==0x28 || (Buffer[Buffer_Offset+Library_Start_Offset+Pos]==0x29 && Pos) || (Buffer[Buffer_Offset+Library_Start_Offset+Pos]>=0x30 && Buffer[Buffer_Offset+Library_Start_Offset+Pos]<=0x3F) || (Buffer[Buffer_Offset+Library_Start_Offset+Pos]>=0x41 && Buffer[Buffer_Offset+Library_Start_Offset+Pos]<=0x7D))) { OK=false; break; } } if (OK) break; Library_Start_Offset++; } if (Library_Start_Offset+4>Element_Size) { Skip_XX(Element_Size, "junk"); return; //No good info } //Accepting good data after junk size_t Library_End_Offset=Library_Start_Offset+4; while (Library_End_Offset=0x20 && Buffer[Buffer_Offset+Library_End_Offset]<=0x3F) || (Buffer[Buffer_Offset+Library_End_Offset]>=0x41 && Buffer[Buffer_Offset+Library_End_Offset]<=0x7D))) Library_End_Offset++; //Parsing Ztring Temp; if (Library_Start_Offset>0) Skip_XX(Library_Start_Offset, "junk"); if (Library_End_Offset-Library_Start_Offset) Get_Local(Library_End_Offset-Library_Start_Offset, Temp,"data"); if (Element_Offset3 && Temp[1]==__T('e') && Temp[2]==__T('n') && Temp[3]==__T('c')) Temp.erase(0, 1); while(Temp.size()>5 && Temp[3]==__T('M') && Temp[4]==__T('P') && Temp[5]==__T('E')) Temp.erase(0, 1); //Cleanup while(!Temp.empty() && Temp[0]==__T('0')) Temp.erase(0, 1); FILLING_BEGIN(); if (!Temp.empty()) { if (Temp.find(__T("build"))==0) Library+=Ztring(__T(" "))+Temp; else Library=Temp; //Library if (Temp.find(__T("Created with Nero"))==0) { Library_Name=__T("Ahead Nero"); } else if (Library.find(__T("encoded by avi2mpg1 ver "))==0) { Library_Name=__T("avi2mpg1"); Library_Version=Library.SubString(__T("encoded by avi2mpg1 ver "), __T("")); } else if (Library.find(__T("encoded by TMPGEnc (ver. "))==0) { Library_Name=__T("TMPGEnc"); Library_Version=Library.SubString(__T("encoded by TMPGEnc (ver. "), __T(")")); } else if (Library.find(__T("encoded by TMPGEnc 4.0 XPress Version. "))==0) { Library_Name=__T("TMPGEnc XPress"); Library_Version=Library.SubString(__T("encoded by TMPGEnc 4.0 XPress Version. "), __T("")); } else if (Library.find(__T("encoded by TMPGEnc MPEG Editor "))==0) { Library_Name=__T("TMPGEnc MPEG Editor"); Library_Version=Library.SubString(__T("Version. "), __T("")); } else if (Library.find(__T("encoded by TMPGEnc "))==0) { Library_Name=__T("TMPGEnc"); Library_Version=Library.SubString(__T("encoded by TMPGEnc "), __T("")); } else if (Library.find(__T("MPEG Encoder v"))==0) { Library_Name=__T("MPEG Encoder by Tristan Savatier"); Library_Version=Library.SubString(__T("MPEG Encoder v"), __T(" by")); } else Library_Name=Library; } FILLING_END(); } //--------------------------------------------------------------------------- // Packet "B2", CC (From DVD) void File_Mpegv::user_data_start_CC() { Skip_B4( "identifier"); #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) Element_Info1("DVD Captions"); //Parsing #if MEDIAINFO_DEMUX Element_Code=0x434301F800000000LL; #endif //MEDIAINFO_DEMUX if (CC___Parser==NULL) { CC___IsPresent=true; MustExtendParsingDuration=true; Buffer_TotalBytes_Fill_Max=(int64u)-1; //Disabling this feature for this format, this is done in the parser CC___Parser=new File_DtvccTransport; Open_Buffer_Init(CC___Parser); ((File_DtvccTransport*)CC___Parser)->Format=File_DtvccTransport::Format_DVD; } if (CC___Parser->PTS_DTS_Needed) { CC___Parser->FrameInfo.PCR=FrameInfo.PCR; CC___Parser->FrameInfo.PTS=FrameInfo.PTS; CC___Parser->FrameInfo.DTS=FrameInfo.DTS; } #if MEDIAINFO_DEMUX int8u Demux_Level_Save=Demux_Level; Demux_Level=8; //Ancillary Demux(Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset), ContentType_MainStream); Demux_Level=Demux_Level_Save; #endif // MEDIAINFO_DEMUX Open_Buffer_Continue(CC___Parser, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); Element_Offset=Element_Size; #else //defined(MEDIAINFO_DTVCCTRANSPORT_YES) Skip_XX(Element_Size-Element_Offset, "DVD Captions"); #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) } //--------------------------------------------------------------------------- // Packet "B2", 0x03 (SCTE20) void File_Mpegv::user_data_start_3() { Skip_B1( "identifier"); #if defined(MEDIAINFO_SCTE20_YES) Scte_IsPresent=true; MustExtendParsingDuration=true; Buffer_TotalBytes_Fill_Max=(int64u)-1; //Disabling this feature for this format, this is done in the parser Element_Info1("SCTE 20"); //Coherency if (TemporalReference_Offset+temporal_reference>=TemporalReference.size()) return; //Purging too old orphelins if (Scte_TemporalReference_Offset+8IsValid || TemporalReference[Pos]->Scte.empty()) break; Pos--; } while (Pos>0); Scte_TemporalReference_Offset=Pos+1; } if (TemporalReference_Offset+temporal_reference>=TemporalReference.size()) TemporalReference.resize(TemporalReference_Offset+temporal_reference+1); if (TemporalReference[TemporalReference_Offset+temporal_reference]==NULL) TemporalReference[TemporalReference_Offset+temporal_reference]=new temporalreference; temporalreference::buffer_data* BufferData=new temporalreference::buffer_data; BufferData->Size=(size_t)(Element_Size-Element_Offset); BufferData->Data=new int8u[(size_t)(Element_Size-Element_Offset)]; std::memcpy(BufferData->Data, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); TemporalReference[TemporalReference_Offset+temporal_reference]->Scte.push_back(BufferData); TemporalReference[TemporalReference_Offset+temporal_reference]->Scte_Parsed.push_back(false); if (TemporalReference[TemporalReference_Offset+temporal_reference]->Scte_Parsed.size()>=2 && TemporalReference[TemporalReference_Offset+temporal_reference]->Scte_Parsed[TemporalReference[TemporalReference_Offset+temporal_reference]->Scte_Parsed.size()-2] && Scte_TemporalReference_Offset==TemporalReference_Offset+temporal_reference+1) Scte_TemporalReference_Offset--; //Parsing Skip_XX(Element_Size-Element_Offset, "SCTE 20 data"); //Parsing Captions after reordering bool CanBeParsed=true; size_t FirstSize=(size_t)-1; for (size_t Scte20_Pos=Scte_TemporalReference_Offset; Scte20_PosIsValid || TemporalReference[Scte20_Pos]->Scte.empty()) CanBeParsed=false; //There is a missing field/frame if (CanBeParsed) { if (FirstSize==(size_t)-1) FirstSize=TemporalReference[Scte20_Pos]->Scte.size(); else if (!progressive_sequence && !TemporalReference[Scte20_Pos]->progressive_frame && TemporalReference[Scte20_Pos]->picture_structure==3 && TemporalReference[Scte20_Pos]->Scte.size()!=FirstSize) CanBeParsed=false; //There is a missing field in a frame duo } } if (CanBeParsed) { for (size_t Scte20_Pos=Scte_TemporalReference_Offset; Scte20_PosAspectRatio=MPEG_Version==1?Mpegv_aspect_ratio1[aspect_ratio_information]:Mpegv_aspect_ratio2[aspect_ratio_information]; ((File_Scte20*)Scte_Parser)->picture_structure=TemporalReference[Scte20_Pos]->picture_structure; ((File_Scte20*)Scte_Parser)->progressive_sequence=progressive_sequence; ((File_Scte20*)Scte_Parser)->progressive_frame=TemporalReference[Scte20_Pos]->progressive_frame; ((File_Scte20*)Scte_Parser)->top_field_first=TemporalReference[Scte20_Pos]->top_field_first; ((File_Scte20*)Scte_Parser)->repeat_first_field=TemporalReference[Scte20_Pos]->repeat_first_field; for (size_t Pos=0; PosScte.size(); Pos++) if (!TemporalReference[Scte20_Pos]->Scte_Parsed[Pos]) { if (Scte_Parser->PTS_DTS_Needed) { Scte_Parser->FrameInfo.PCR=FrameInfo.PCR; Scte_Parser->FrameInfo.PTS=FrameInfo.PTS-(TemporalReference.size()-1-Scte20_Pos)*tc; Scte_Parser->FrameInfo.DTS=FrameInfo.DTS-(TemporalReference.size()-1-Scte20_Pos)*tc; } #if MEDIAINFO_DEMUX int8u Demux_Level_Save=Demux_Level; Demux_Level=8; //Ancillary Demux(TemporalReference[Scte20_Pos]->Scte[Pos]->Data, TemporalReference[Scte20_Pos]->Scte[Pos]->Size, ContentType_MainStream); Demux_Level=Demux_Level_Save; #endif // MEDIAINFO_DEMUX Open_Buffer_Continue(Scte_Parser, TemporalReference[Scte20_Pos]->Scte[Pos]->Data, TemporalReference[Scte20_Pos]->Scte[Pos]->Size); TemporalReference[Scte20_Pos]->Scte_Parsed[Pos]=true; } Element_End0(); } Scte_TemporalReference_Offset=TemporalReference.size(); } #else //defined(MEDIAINFO_SCTE20_YES) Skip_XX(Element_Size-Element_Offset, "SCTE 20 data"); #endif //defined(MEDIAINFO_SCTE20_YES) } //--------------------------------------------------------------------------- // Packet "B2", DTG1 void File_Mpegv::user_data_start_DTG1() { Skip_B4( "identifier"); #if defined(MEDIAINFO_AFDBARDATA_YES) Element_Info1("Active Format Description"); //Parsing if (DTG1_Parser==NULL) { DTG1_Parser=new File_AfdBarData; Open_Buffer_Init(DTG1_Parser); ((File_AfdBarData*)DTG1_Parser)->Format=File_AfdBarData::Format_A53_4_DTG1; //Aspect ratio for AFD float32 DAR=0; if (MPEG_Version==2) { if (aspect_ratio_information==0) ; //Forbidden else if (aspect_ratio_information==1) DAR=((float32)(0x1000*horizontal_size_extension+horizontal_size_value))/(0x1000*vertical_size_extension+vertical_size_value); else if (display_horizontal_size && display_vertical_size) { if (vertical_size_value && Mpegv_aspect_ratio2[aspect_ratio_information]) DAR=((float32)(0x1000*horizontal_size_extension+horizontal_size_value))/(0x1000*vertical_size_extension+vertical_size_value) *Mpegv_aspect_ratio2[aspect_ratio_information]/((float32)display_horizontal_size/display_vertical_size); } else if (Mpegv_aspect_ratio2[aspect_ratio_information]) DAR=Mpegv_aspect_ratio2[aspect_ratio_information]; } else //Version 1 { if (vertical_size_value && Mpegv_aspect_ratio1[aspect_ratio_information]) DAR=((float32)(0x1000*horizontal_size_extension+horizontal_size_value))/(0x1000*vertical_size_extension+vertical_size_value)/Mpegv_aspect_ratio1[aspect_ratio_information]; } if (DAR>=1.330 && DAR<1.336) ((File_AfdBarData*)DTG1_Parser)->aspect_ratio_FromContainer=0; //4/3 if (DAR>=1.774 && DAR<1.780) ((File_AfdBarData*)DTG1_Parser)->aspect_ratio_FromContainer=1; //16/9 } if (DTG1_Parser->PTS_DTS_Needed) { DTG1_Parser->FrameInfo.PCR=FrameInfo.PCR; DTG1_Parser->FrameInfo.PTS=FrameInfo.PTS; DTG1_Parser->FrameInfo.DTS=FrameInfo.DTS; } Open_Buffer_Continue(DTG1_Parser, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); Element_Offset=Element_Size; #else //defined(MEDIAINFO_AFDBARDATA_YES) Skip_XX(Element_Size-Element_Offset, "Active Format Description"); #endif //defined(MEDIAINFO_AFDBARDATA_YES) } //--------------------------------------------------------------------------- // Packet "B2", GA94 void File_Mpegv::user_data_start_GA94() { //Parsing int8u user_data_type_code; Skip_B4( "GA94_identifier"); Get_B1 (user_data_type_code, "user_data_type_code"); switch (user_data_type_code) { case 0x03 : user_data_start_GA94_03(); break; case 0x06 : user_data_start_GA94_06(); break; default : Skip_XX(Element_Size-Element_Offset, "GA94_reserved_user_data"); } } //--------------------------------------------------------------------------- // Packet "B2", GA94 0x03 (styled captioning) void File_Mpegv::user_data_start_GA94_03() { #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) GA94_03_IsPresent=true; MustExtendParsingDuration=true; Buffer_TotalBytes_Fill_Max=(int64u)-1; //Disabling this feature for this format, this is done in the parser Element_Info1("DTVCC Transport"); //Coherency if (TemporalReference_Offset+temporal_reference>=TemporalReference.size()) return; //Purging too old orphelins if (GA94_03_TemporalReference_Offset+8IsValid || TemporalReference[Pos]->GA94_03==NULL) break; Pos--; } while (Pos>0); GA94_03_TemporalReference_Offset=Pos+1; } if (TemporalReference_Offset+temporal_reference>=TemporalReference.size()) TemporalReference.resize(TemporalReference_Offset+temporal_reference+1); if (TemporalReference[TemporalReference_Offset+temporal_reference]==NULL) TemporalReference[TemporalReference_Offset+temporal_reference]=new temporalreference; if (TemporalReference[TemporalReference_Offset+temporal_reference]->GA94_03==NULL) TemporalReference[TemporalReference_Offset+temporal_reference]->GA94_03=new temporalreference::buffer_data; TemporalReference[TemporalReference_Offset+temporal_reference]->GA94_03->Size=(size_t)(Element_Size-Element_Offset); delete[] TemporalReference[TemporalReference_Offset+temporal_reference]->GA94_03->Data; TemporalReference[TemporalReference_Offset+temporal_reference]->GA94_03->Data=new int8u[(size_t)(Element_Size-Element_Offset)]; std::memcpy(TemporalReference[TemporalReference_Offset+temporal_reference]->GA94_03->Data, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); //Parsing Skip_XX(Element_Size-Element_Offset, "CC data"); //Parsing Captions after reordering bool CanBeParsed=true; for (size_t GA94_03_Pos=GA94_03_TemporalReference_Offset; GA94_03_PosIsValid || TemporalReference[GA94_03_Pos]->GA94_03==NULL) CanBeParsed=false; //There is a missing field/frame if (CanBeParsed) { for (size_t GA94_03_Pos=GA94_03_TemporalReference_Offset; GA94_03_PosFormat=File_DtvccTransport::Format_A53_4_GA94_03; } if (GA94_03_Parser->PTS_DTS_Needed) { GA94_03_Parser->FrameInfo.PCR=FrameInfo.PCR; GA94_03_Parser->FrameInfo.PTS=FrameInfo.PTS-(FrameInfo.PTS!=(int64u)-1?((TemporalReference.size()-1-GA94_03_Pos)*tc):0); GA94_03_Parser->FrameInfo.DTS=FrameInfo.DTS-(FrameInfo.DTS!=(int64u)-1?((TemporalReference.size()-1-GA94_03_Pos)*tc):0); } #if MEDIAINFO_DEMUX int8u Demux_Level_Save=Demux_Level; Demux_Level=8; //Ancillary Demux(TemporalReference[GA94_03_Pos]->GA94_03->Data, TemporalReference[GA94_03_Pos]->GA94_03->Size, ContentType_MainStream); Demux_Level=Demux_Level_Save; #endif // MEDIAINFO_DEMUX ((File_DtvccTransport*)GA94_03_Parser)->AspectRatio=MPEG_Version==1?Mpegv_aspect_ratio1[aspect_ratio_information]:Mpegv_aspect_ratio2[aspect_ratio_information]; Open_Buffer_Continue(GA94_03_Parser, TemporalReference[GA94_03_Pos]->GA94_03->Data, TemporalReference[GA94_03_Pos]->GA94_03->Size); Element_End0(); } GA94_03_TemporalReference_Offset=TemporalReference.size(); } #else //defined(MEDIAINFO_DTVCCTRANSPORT_YES) Skip_XX(Element_Size-Element_Offset, "DTVCC Transport data"); #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) } //--------------------------------------------------------------------------- // Packet "B2", GA94 0x06 (bar data) void File_Mpegv::user_data_start_GA94_06() { #if defined(MEDIAINFO_AFDBARDATA_YES) Element_Info1("Bar Data"); //Parsing if (GA94_06_Parser==NULL) { GA94_06_Parser=new File_AfdBarData; Open_Buffer_Init(GA94_06_Parser); ((File_AfdBarData*)GA94_06_Parser)->Format=File_AfdBarData::Format_A53_4_GA94_06; } if (GA94_06_Parser->PTS_DTS_Needed) { GA94_06_Parser->FrameInfo.PCR=FrameInfo.PCR; GA94_06_Parser->FrameInfo.PTS=FrameInfo.PTS; GA94_06_Parser->FrameInfo.DTS=FrameInfo.DTS; } Open_Buffer_Init(GA94_06_Parser); Open_Buffer_Continue(GA94_06_Parser, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset)); Element_Offset=Element_Size; #else //defined(MEDIAINFO_AFDBARDATA_YES) Skip_XX(Element_Size-Element_Offset, "Bar Data"); #endif //defined(MEDIAINFO_AFDBARDATA_YES) } //--------------------------------------------------------------------------- // Packet "B3" void File_Mpegv::sequence_header() { Element_Name("sequence_header"); //Reset display_horizontal_size=0; display_vertical_size=0; //Reading int32u bit_rate_value_temp; BS_Begin(); Get_S2 (12, horizontal_size_value, "horizontal_size_value"); Get_S2 (12, vertical_size_value, "vertical_size_value"); Get_S1 ( 4, aspect_ratio_information, "aspect_ratio_information"); Param_Info1C((vertical_size_value && Mpegv_aspect_ratio1[aspect_ratio_information]), (float)horizontal_size_value/vertical_size_value/Mpegv_aspect_ratio1[aspect_ratio_information]); Param_Info1(Mpegv_aspect_ratio2[aspect_ratio_information]); Get_S1 ( 4, frame_rate_code, "frame_rate_code"); Param_Info1(Mpegv_frame_rate[frame_rate_code]); Get_S3 (18, bit_rate_value_temp, "bit_rate_value"); Param_Info1(bit_rate_value_temp*400); Mark_1 (); Get_S2 (10, vbv_buffer_size_value, "vbv_buffer_size_value"); Param_Info2(2*1024*((int32u)vbv_buffer_size_value), " bytes"); Skip_SB( "constrained_parameters_flag"); TEST_SB_GET(load_intra_quantiser_matrix, "load_intra_quantiser_matrix"); bool FillMatrix=Matrix_intra.empty(); for (size_t Pos=0; Pos<64; Pos++) { int8u intra_quantiser; Get_S1 (8, intra_quantiser, "intra_quantiser"); if (FillMatrix) { Ztring Value=Ztring::ToZtring(intra_quantiser, 16); if (Value.size()==1) Value.insert(0, __T("0")); Matrix_intra+=Value; } } TEST_SB_END(); TEST_SB_GET(load_non_intra_quantiser_matrix, "load_non_intra_quantiser_matrix"); bool FillMatrix=Matrix_nonintra.empty(); for (size_t Pos=0; Pos<64; Pos++) { int8u non_intra_quantiser; Get_S1 (8, non_intra_quantiser, "non_intra_quantiser"); if (FillMatrix) { Ztring Value=Ztring::ToZtring(non_intra_quantiser, 16); if (Value.size()==1) Value.insert(0, __T("0")); Matrix_nonintra+=Value; } } TEST_SB_END(); BS_End(); //0x00 at the end if (Element_OffsetElement_Offset && Buffer[Buffer_Offset+(size_t)NullBytes_Begin]==0x00) NullBytes_Begin--; if (NullBytes_Begin==Element_Offset) Skip_XX(Element_Size-Element_Offset, "Padding"); } FILLING_BEGIN_PRECISE(); temporal_reference_Adapt(); //TODO: this line should not exist but some streams do not have group_start and/or do not start from temporal_reference 0, fast and dirty patch //Bit_rate if (bit_rate_value_IsValid && bit_rate_value_temp!=bit_rate_value) bit_rate_value_IsValid=false; //two bit_rate_values, not handled. else if (bit_rate_value==0) { bit_rate_value=bit_rate_value_temp; bit_rate_value_IsValid=true; } //NextCode if (!Status[IsAccepted]) { NextCode_Clear(); NextCode_Add(0x00); NextCode_Add(0xB2); NextCode_Add(0xB5); NextCode_Add(0xB8); } //Autorisation of other streams Streams[0x00].Searching_Payload=true; Streams[0xB2].Searching_Payload=true; Streams[0xB5].Searching_Payload=true; if (Frame_Count==0) Streams[0xB8].Searching_TimeStamp_Start=true; Streams[0xB8].Searching_TimeStamp_End=true; //Temp if (Mpegv_frame_rate[frame_rate_code]) tc=float64_int64s(((float64)1000000000)/Mpegv_frame_rate[frame_rate_code]); if (Frame_Count=TemporalReference.size()) TemporalReference.resize(TemporalReference_Offset+temporal_reference+1); if (TemporalReference[TemporalReference_Offset+temporal_reference]==NULL) TemporalReference[TemporalReference_Offset+temporal_reference]=new temporalreference; TemporalReference[TemporalReference_Offset+temporal_reference]->picture_coding_type=picture_coding_type; TemporalReference[TemporalReference_Offset+temporal_reference]->progressive_frame=progressive_frame; TemporalReference[TemporalReference_Offset+temporal_reference]->picture_structure=picture_structure; TemporalReference[TemporalReference_Offset+temporal_reference]->top_field_first=top_field_first; TemporalReference[TemporalReference_Offset+temporal_reference]->repeat_first_field=repeat_first_field; TemporalReference[TemporalReference_Offset+temporal_reference]->HasPictureCoding=true; } else //Field { if (!FirstFieldFound) { if (picture_structure==1) //-Top Interlaced_Top++; else //-Bottom Interlaced_Bottom++; } FirstFieldFound=!FirstFieldFound; } } else { progressive_frame_Count++; if (top_field_first) Interlaced_Top++; else Interlaced_Bottom++; if (picture_structure==3) //Frame { if (TemporalReference_Offset+temporal_reference>=TemporalReference.size()) TemporalReference.resize(TemporalReference_Offset+temporal_reference+1); if (TemporalReference[TemporalReference_Offset+temporal_reference]==NULL) TemporalReference[TemporalReference_Offset+temporal_reference]=new temporalreference; TemporalReference[TemporalReference_Offset+temporal_reference]->picture_coding_type=picture_coding_type; TemporalReference[TemporalReference_Offset+temporal_reference]->progressive_frame=progressive_frame; TemporalReference[TemporalReference_Offset+temporal_reference]->picture_structure=picture_structure; TemporalReference[TemporalReference_Offset+temporal_reference]->top_field_first=top_field_first; TemporalReference[TemporalReference_Offset+temporal_reference]->repeat_first_field=repeat_first_field; TemporalReference[TemporalReference_Offset+temporal_reference]->HasPictureCoding=true; } } FILLING_END(); break; case 9 :{ //Picture Spatial Scalable Extension //Parsing Skip_S1(4, "data"); BS_End(); Skip_XX(Element_Size-Element_Offset, "data"); } break; case 10 :{ //Picture Temporal Scalable Extension //Parsing Skip_S1(4, "data"); BS_End(); Skip_XX(Element_Size-Element_Offset, "data"); } break; default:{ //Parsing Skip_S1(4, "data"); BS_End(); Skip_XX(Element_Size-Element_Offset, "data"); } } } //--------------------------------------------------------------------------- // Packet "B7" void File_Mpegv::sequence_end() { Element_Name("sequence_end"); if (!Status[IsFilled] && sequence_header_IsParsed) { //End of file, and we have some frames Accept("MPEG Video"); Finish("MPEG Video"); } } //--------------------------------------------------------------------------- // Packet "B8" void File_Mpegv::group_start() { if (!Status[IsAccepted]) { if (!NextCode_Test()) return; } Element_Name("group_start"); //Reading int8u Hours, Minutes, Seconds, Frames; bool drop_frame_flag, closed_gop, broken_link; #if MEDIAINFO_TRACE if (Trace_Activated) { //Parsing BS_Begin(); Get_SB ( drop_frame_flag, "time_code_drop_frame_flag"); Get_S1 ( 5, Hours, "time_code_time_code_hours"); Get_S1 ( 6, Minutes, "time_code_time_code_minutes"); Mark_1(); Get_S1 ( 6, Seconds, "time_code_time_code_seconds"); Get_S1 ( 6, Frames, "time_code_time_code_pictures"); Get_SB ( closed_gop, "closed_gop"); Get_SB ( broken_link, "broken_link"); BS_End(); Ztring Time; Time+=Ztring::ToZtring(Hours); Time+=__T(':'); Time+=Ztring::ToZtring(Minutes); Time+=__T(':'); Time+=Ztring::ToZtring(Seconds); if (FrameRate!=0) { Time+=__T('.'); Time+=Ztring::ToZtring(Frames*1000/FrameRate, 0); } Element_Info1(Time); } else { #endif //MEDIAINFO_TRACE //Parsing size_t Buffer_Pos=Buffer_Offset+(size_t)Element_Offset; drop_frame_flag = (Buffer[Buffer_Pos ]&0x80)?true:false; Hours =((Buffer[Buffer_Pos ]&0x7C)>> 2); Minutes =((Buffer[Buffer_Pos ]&0x03)<< 4) | ((Buffer[Buffer_Pos+1] )>> 4); Seconds =((Buffer[Buffer_Pos+1]&0x07)<< 3) | ((Buffer[Buffer_Pos+2] )>> 5); Frames =((Buffer[Buffer_Pos+2]&0x1F)<< 1) | ((Buffer[Buffer_Pos+3] )>> 7); closed_gop = (Buffer[Buffer_Pos+3]&0x40)?true:false; broken_link = (Buffer[Buffer_Pos+3]&0x20)?true:false; Element_Offset+=4; #if MEDIAINFO_TRACE } #endif //MEDIAINFO_TRACE FILLING_BEGIN(); temporal_reference_Adapt(); //NextCode if (!Status[IsAccepted]) { NextCode_Clear(); NextCode_Add(0x00); NextCode_Add(0xB2); NextCode_Add(0xB5); NextCode_Add(0xB8); } if (TimeCodeIsNotTrustable) return; if (Time_Current_Seconds==0 && Time_Current_Frames==0 && Hours==0 && Minutes==0 && Seconds==0 && Frames==0) { //Time code is always 0 TimeCodeIsNotTrustable=true; Time_End_Seconds=(size_t)-1; TimeCode_FirstFrame.clear(); return; } //Calculating Time_Current_Seconds=60*60*Hours+60*Minutes+Seconds; Time_Current_Frames =Frames; if (!group_start_IsParsed) group_start_IsParsed=true; if (!group_start_FirstPass) { group_start_FirstPass=true; group_start_drop_frame_flag=drop_frame_flag; group_start_closed_gop=closed_gop; group_start_broken_link=broken_link; TimeCode_FirstFrame+=('0'+Hours/10); TimeCode_FirstFrame+=('0'+Hours%10); TimeCode_FirstFrame+=':'; TimeCode_FirstFrame+=('0'+Minutes/10); TimeCode_FirstFrame+=('0'+Minutes%10); TimeCode_FirstFrame+=':'; TimeCode_FirstFrame+=('0'+Seconds/10); TimeCode_FirstFrame+=('0'+Seconds%10); TimeCode_FirstFrame+=drop_frame_flag?';':':'; TimeCode_FirstFrame+=('0'+Frames/10); TimeCode_FirstFrame+=('0'+Frames%10); } RefFramesCount=0; //Autorisation of other streams if (Searching_TimeStamp_Start_DoneOneTime) Streams[0xB8].Searching_TimeStamp_Start=false; //group_start else Searching_TimeStamp_Start_DoneOneTime=true; Streams[0x00].Searching_TimeStamp_End=true; //picture_start FILLING_END(); } //*************************************************************************** // Helpers //*************************************************************************** //--------------------------------------------------------------------------- // Packet "B8" void File_Mpegv::temporal_reference_Adapt() { //Temporal reference temporal_reference_Old=(int16u)-1; temporal_reference_Max=0; TemporalReference_Offset=TemporalReference.size(); if (TemporalReference_Offset>=0x800) { for (size_t Pos=0; Pos<0x400; Pos++) delete TemporalReference[Pos]; //TemporalReference[Pos]=NULL; TemporalReference.erase(TemporalReference.begin(), TemporalReference.begin()+0x400); if (0x400 #endif //defined(MEDIAINFO_ANCILLARY_YES) //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Mpegv //*************************************************************************** class File_Mpegv : public File__Analyze { public : //In int8u MPEG_Version; int64u Frame_Count_Valid; bool FrameIsAlwaysComplete; bool TimeCodeIsNotTrustable; #if defined(MEDIAINFO_ANCILLARY_YES) File_Ancillary** Ancillary; #endif //defined(MEDIAINFO_ANCILLARY_YES) #if MEDIAINFO_ADVANCED bool InitDataNotRepeated_Optional; #endif // MEDIAINFO_ADVANCED //Constructor/Destructor File_Mpegv(); ~File_Mpegv(); private : //Streams management void Streams_Accept(); void Streams_Update(); void Streams_Fill(); void Streams_Finish(); //Buffer - File header bool FileHeader_Begin() {return FileHeader_Begin_0x000001();} //Buffer - Synchro bool Synchronize() {return Synchronize_0x000001();} bool Synched_Test(); void Synched_Init(); //Buffer - Demux #if MEDIAINFO_DEMUX bool Demux_UnpacketizeContainer_Test(); #endif //MEDIAINFO_DEMUX //Buffer - Global void Read_Buffer_Unsynched(); //Buffer - Per element void Header_Parse(); bool Header_Parser_QuickSearch(); bool Header_Parser_Fill_Size(); void Data_Parse(); //EOF void Detect_EOF(); //Elements void picture_start(); void slice_start(); #if MEDIAINFO_MACROBLOCKS void slice_start_macroblock(); void slice_start_macroblock_motion_vectors(bool s); void slice_start_macroblock_motion_vectors_motion_vector(bool r, bool s); void slice_start_macroblock_coded_block_pattern(); void slice_start_macroblock_block(int8u i); #endif //MEDIAINFO_MACROBLOCKS void user_data_start(); void user_data_start_3(); void user_data_start_CC(); void user_data_start_DTG1(); void user_data_start_GA94(); void user_data_start_GA94_03(); void user_data_start_GA94_06(); void sequence_header(); void sequence_error(); void extension_start(); void sequence_end(); void group_start(); //Helpers void temporal_reference_Adapt(); //Streams struct stream { bool Searching_Payload; bool Searching_TimeStamp_Start; bool Searching_TimeStamp_End; stream() { Searching_Payload=false; Searching_TimeStamp_Start=false; Searching_TimeStamp_End=false; } }; std::vector Streams; //Temporal reference struct temporalreference { struct buffer_data { size_t Size; int8u* Data; buffer_data() { Size=0; Data=NULL; } ~buffer_data() { delete[] Data; //Data=NULL; } }; #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) buffer_data* GA94_03; #endif //MEDIAINFO_DTVCCTRANSPORT_YES #if defined(MEDIAINFO_SCTE20_YES) std::vector Scte; std::vector Scte_Parsed; #endif //MEDIAINFO_SCTE20_YES int8u picture_coding_type; int8u picture_structure; bool IsValid; bool HasPictureCoding; bool progressive_frame; bool top_field_first; bool repeat_first_field; temporalreference() { #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) GA94_03=NULL; #endif //MEDIAINFO_DTVCCTRANSPORT_YES picture_coding_type=(int8u)-1; picture_structure=(int8u)-1; IsValid=false; HasPictureCoding=false; } ~temporalreference() { #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) delete GA94_03; //GA94_03=NULL; #endif //MEDIAINFO_DTVCCTRANSPORT_YES #if defined(MEDIAINFO_SCTE20_YES) for (size_t Pos=0; Pos TemporalReference; //per temporal_reference size_t TemporalReference_Offset; struct text_position { File__Analyze** Parser; size_t StreamPos; text_position() { Parser=NULL; StreamPos=(size_t)-1; } text_position(File__Analyze* &Parser_) { Parser=&Parser_; StreamPos=0; } }; std::vector Text_Positions; #if defined(MEDIAINFO_DTVCCTRANSPORT_YES) File__Analyze* GA94_03_Parser; size_t GA94_03_TemporalReference_Offset; bool GA94_03_IsPresent; File__Analyze* CC___Parser; bool CC___IsPresent; #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES) #if defined(MEDIAINFO_SCTE20_YES) File__Analyze* Scte_Parser; size_t Scte_TemporalReference_Offset; bool Scte_IsPresent; #endif //defined(MEDIAINFO_SCTE20_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) File__Analyze* DTG1_Parser; File__Analyze* GA94_06_Parser; #endif //defined(MEDIAINFO_AFDBARDATA_YES) #if defined(MEDIAINFO_CDP_YES) File__Analyze* Cdp_Parser; bool Cdp_IsPresent; #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES) #if defined(MEDIAINFO_AFDBARDATA_YES) File__Analyze* AfdBarData_Parser; #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_AFDBARDATA_YES) //Temp Ztring Library; Ztring Library_Name; Ztring Library_Version; Ztring Matrix_intra; Ztring Matrix_nonintra; string TimeCode_FirstFrame; size_t BVOP_Count; size_t progressive_frame_Count; size_t Interlaced_Top; size_t Interlaced_Bottom; size_t Time_Current_Seconds; size_t Time_Begin_Seconds; size_t Time_End_Seconds; int64u SizeToAnalyse_Begin; //Total size of a chunk to analyse, it may be changed by the parser int64u SizeToAnalyse_End; //Total size of a chunk to analyse, it may be changed by the parser int64u Frame_Count_LastIFrame; int32u bit_rate_value; float32 FrameRate; int16u horizontal_size_value; int16u vertical_size_value; int16u bit_rate_extension; int16u temporal_reference; int16u temporal_reference_Old; int16u temporal_reference_Max; int16u display_horizontal_size; int16u display_vertical_size; int16u vbv_delay; int16u vbv_buffer_size_value; int8u Time_Current_Frames; int8u Time_Begin_Frames; int8u Time_End_Frames; int8u picture_coding_type; int8u aspect_ratio_information; int8u frame_rate_code; int8u profile_and_level_indication; int8u profile_and_level_indication_profile; int8u profile_and_level_indication_level; int8u chroma_format; int8u horizontal_size_extension; int8u vertical_size_extension; int8u frame_rate_extension_n; int8u frame_rate_extension_d; int8u video_format; int8u colour_primaries; int8u transfer_characteristics; int8u matrix_coefficients; int8u picture_structure; int8u vbv_buffer_size_extension; int8u intra_dc_precision; bool load_intra_quantiser_matrix; bool load_non_intra_quantiser_matrix; bool progressive_sequence; bool progressive_frame; bool top_field_first; bool repeat_first_field; bool FirstFieldFound; bool sequence_header_IsParsed; bool group_start_IsParsed; bool group_start_FirstPass; bool group_start_drop_frame_flag; bool group_start_closed_gop; bool group_start_broken_link; bool Searching_TimeStamp_Start_DoneOneTime; bool Parsing_End_ForDTS; bool bit_rate_value_IsValid; bool profile_and_level_indication_escape; bool colour_description; bool low_delay; int8u RefFramesCount; int8u BVOPsSinceLastRefFrames; int16u temporal_reference_LastIFrame; int64u PTS_LastIFrame; int16u PTS_End_temporal_reference; int64u tc; bool IFrame_IsParsed; size_t IFrame_Count; std::map picture_coding_types; //per picture_coding_type value ("IPBB..."), updated at each I-frame std::string picture_coding_types_Current; //Current picture_coding_type value ("IPBB..."), updated at each frame #if MEDIAINFO_MACROBLOCKS int64u macroblock_x; int64u macroblock_x_PerFrame; int64u macroblock_y_PerFrame; int16u cbp; int8u frame_motion_type; int8u field_motion_type; int8u spatial_temporal_weight_code; int8u block_count; //Computed from chroma_format int8u macroblock_type; //Temp int8u spatial_temporal_weight_code_table_index; int8u f_code[2][2]; bool Macroblocks_Parse; bool sequence_scalable_extension_Present; bool frame_pred_frame_dct; bool concealment_motion_vectors; bool intra_vlc_format; vlc_fast macroblock_address_increment_Vlc; vlc_fast dct_dc_size_luminance; vlc_fast dct_dc_size_chrominance; vlc_fast dct_coefficients_0; vlc_fast dct_coefficients_1; vlc_fast macroblock_type_I; vlc_fast macroblock_type_P; vlc_fast macroblock_type_B; vlc_fast motion_code; vlc_fast dmvector; vlc_fast coded_block_pattern; #endif //MEDIAINFO_MACROBLOCKS #if MEDIAINFO_IBI bool Ibi_SliceParsed; #endif //MEDIAINFO_IBI #if MEDIAINFO_ADVANCED int64u InitDataNotRepeated; int64u Config_InitDataNotRepeated_Occurences; bool Config_InitDataNotRepeated_GiveUp; int64u Config_VariableGopDetection_Occurences; bool Config_VariableGopDetection_GiveUp; #endif // MEDIAINFO_ADVANCED #if MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS size_t Slices_Count; bool Has_sequence_header; bool Has_sequence_extension; #endif // MEDIAINFO_ADVANCED || MEDIAINFO_EVENTS }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Video/File_ProRes.cpp100777 0 0 25017 12253034071 15517 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_PRORES_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_ProRes.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* Mpegv_colour_primaries(int8u colour_primaries); const char* Mpegv_transfer_characteristics(int8u transfer_characteristics); const char* Mpegv_matrix_coefficients(int8u matrix_coefficients); //--------------------------------------------------------------------------- const char* ProRes_chrominance_factor(int8u chrominance_factor) { switch (chrominance_factor) { case 0x02 : return "4:2:2"; case 0x03 : return "4:4:4"; default : return ""; } } //--------------------------------------------------------------------------- const char* ProRes_frame_type_ScanType(int8u frame_type) { switch (frame_type) { case 0x00 : return "Progressive"; case 0x01 : case 0x02 : return "Interlaced"; default : return ""; } } //--------------------------------------------------------------------------- const char* ProRes_frame_type_ScanOrder(int8u frame_type) { switch (frame_type) { case 0x01 : return "TFF"; case 0x02 : return "BFF"; default : return ""; } } //--------------------------------------------------------------------------- Ztring ProRes_creatorID(int32u creatorID) { switch (creatorID) { case 0x61706C30 : return __T("Apple"); //apl0 case 0x61727269 : return __T("Arnold & Richter Cine Technik"); //arri case 0x616A6130 : return __T("AJA Kona Hardware"); //aja0 default : return Ztring().From_CC4(creatorID); } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_ProRes::File_ProRes() :File__Analyze() { //Configuration ParserName=__T("ProRes"); } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_ProRes::Streams_Fill() { Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "ProRes"); } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_ProRes::Read_Buffer_Continue() { //Parsing int32u Name, creatorID; int16u hdrSize, version, frameWidth, frameHeight; int8u chrominance_factor, frame_type, primaries, transf_func, colorMatrix; bool IsOk=true, luma, chroma; Element_Begin1("Header"); Skip_B4( "Size"); Get_C4 (Name, "Name"); Element_End(); Element_Begin1("Frame header"); Get_B2 (hdrSize, "hdrSize"); Get_B2 (version, "version"); Get_C4 (creatorID, "creatorID"); Get_B2 (frameWidth, "frameWidth"); Get_B2 (frameHeight, "frameHeight"); BS_Begin(); Get_S1 (2, chrominance_factor, "chrominance factor"); Param_Info1(ProRes_chrominance_factor(chrominance_factor)); Skip_S1(2, "reserved"); Get_S1 (2, frame_type, "frame type"); Param_Info1(ProRes_frame_type_ScanType(frame_type)); Param_Info1(ProRes_frame_type_ScanOrder(frame_type)); Skip_S1(2, "reserved"); BS_End(); Skip_B1( "reserved"); Get_B1 (primaries, "primaries"); Param_Info1(Mpegv_colour_primaries(primaries)); Get_B1 (transf_func, "transf_func"); Param_Info1(Mpegv_transfer_characteristics(transf_func)); Get_B1 (colorMatrix, "colorMatrix"); Param_Info1(Mpegv_matrix_coefficients(colorMatrix)); BS_Begin(); Skip_S1(4, "src_pix_fmt"); Skip_S1(4, "alpha_info"); BS_End(); Skip_B1( "reserved"); BS_Begin(); Skip_S1(6, "reserved"); Get_SB (luma, "custom luma quant matrix present"); Get_SB (chroma, "custom chroma quant matrix present"); BS_End(); if (luma) Skip_XX(64, "QMatLuma"); if (chroma) Skip_XX(64, "QMatChroma"); Element_End(); if (Element_Offset!=8+hdrSize) IsOk=false; for (int8u PictureNumber=0; PictureNumber<(frame_type?2:1); PictureNumber++) { Element_Begin1("Picture layout"); int16u total_slices; vector slices_size; Element_Begin1("Picture header"); int64u pic_hdr_End, pic_data_End; int32u pic_data_size; int8u pic_hdr_size; Get_B1 (pic_hdr_size, "pic_hdr_size"); if (pic_hdr_size<64) { Trusted_IsNot("pic_hdr_size"); Element_End(); Element_End(); return; } pic_hdr_End=Element_Offset+pic_hdr_size/8-((pic_hdr_size%8)?0:1); Get_B4 (pic_data_size, "pic_data_size"); if (pic_data_size<8) { Trusted_IsNot("pic_data_size"); Element_End(); Element_End(); return; } pic_data_End=Element_Offset+pic_data_size-5; Get_B2 (total_slices, "total_slices"); BS_Begin(); Skip_S1(4, "slice_width_factor"); Skip_S1(4, "slice_height_factor"); BS_End(); if (Element_Offset #if MEDIAINFO_EVENTS #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "MediaInfo/MediaInfo_Events.h" #include "MediaInfo/MediaInfo_Events_Internal.h" #endif //MEDIAINFO_EVENTS #if MEDIAINFO_DEMUX #include #include "base64.h" #endif //MEDIAINFO_DEMUX using namespace std; using namespace ZenLib; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const char* Vc1_Profile[]= { "Simple", "Main", "Complex", "Advanced", }; //--------------------------------------------------------------------------- const char* Vc1_ColorimetryFormat[]= { "", "4:2:0", "", "", }; //--------------------------------------------------------------------------- const float32 Vc1_PixelAspectRatio[]= { (float32)1, //Reserved (float32)1, (float32)12/(float32)11, (float32)10/(float32)11, (float32)16/(float32)11, (float32)40/(float32)33, (float32)24/(float32)11, (float32)20/(float32)11, (float32)32/(float32)11, (float32)80/(float32)33, (float32)18/(float32)11, (float32)15/(float32)11, (float32)64/(float32)33, (float32)160/(float32)99, (float32)1, //Reserved (float32)1, //Custom }; //--------------------------------------------------------------------------- float32 Vc1_FrameRate_enr(int8u Code) { switch (Code) { case 0x01 : return (float32)24000; case 0x02 : return (float32)25000; case 0x03 : return (float32)30000; case 0x04 : return (float32)50000; case 0x05 : return (float32)60000; case 0x06 : return (float32)48000; case 0x07 : return (float32)72000; default : return (float32)0; } } //--------------------------------------------------------------------------- float32 Vc1_FrameRate_dr(int8u Code) { switch (Code) { case 0x01 : return (float32)1000; case 0x02 : return (float32)1001; default : return (float32)0; } } //--------------------------------------------------------------------------- const char* Vc1_Type[]= { "I", "P", "B", "BI", "Skipped", }; //--------------------------------------------------------------------------- const char* Vc1_PictureFormat[]= { "Progressive frame", "Interlaced frame", "Two interlaced fields", "", }; //--------------------------------------------------------------------------- const int8u Vc1_FieldTypeTable[][2]= { {0, 0}, {0, 1}, {1, 0}, {1, 1}, {2, 2}, {2, 3}, {3, 2}, {3, 3}, }; //--------------------------------------------------------------------------- const File__Analyze::vlc Vc1_ptype[]= { // macroblock_address_increment { 0 , 1 , 0 , 0 , 1 }, { 2 , 1 , 0 , 0 , 2 }, { 6 , 1 , 0 , 0 , 0 }, { 14 , 1 , 0 , 0 , 3 }, { 15 , 0 , 0 , 0 , 4 }, VLC_END }; //--------------------------------------------------------------------------- int32u Vc1_bfraction(int8u Size, int32u Value) { switch (Size) { case 3 : switch (Value) { case 0x00 : return 0x00; case 0x01 : return 0x01; case 0x02 : return 0x02; case 0x03 : return 0x03; case 0x04 : return 0x04; case 0x05 : return 0x05; case 0x06 : return 0x06; default : return (int32u)-1; } case 7 : switch (Value) { case 0x70 : return 0x70; case 0x71 : return 0x71; case 0x72 : return 0x72; case 0x73 : return 0x73; case 0x74 : return 0x74; case 0x75 : return 0x75; case 0x76 : return 0x76; case 0x77 : return 0x77; case 0x78 : return 0x78; case 0x79 : return 0x79; case 0x7A : return 0x7A; case 0x7B : return 0x7B; case 0x7C : return 0x7C; case 0x7D : return 0x7D; case 0x7E : return 0x7E; case 0x7F : return 0x7F; default : return (int32u)-1; } default: return (int32u)-1; } }; //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Vc1::File_Vc1() :File__Analyze() { //Config #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_Vc1; StreamIDs_Width[0]=0; #endif //MEDIAINFO_EVENTS MustSynchronize=true; Buffer_TotalBytes_FirstSynched_Max=64*1024; PTS_DTS_Needed=true; IsRawStream=true; Frame_Count_NotParsedIncluded=0; //In Frame_Count_Valid=30; FrameIsAlwaysComplete=false; From_WMV3=false; Only_0D=false; //Temp EntryPoint_Parsed=false; FrameRate=0; RefFramesCount=0; #if MEDIAINFO_DEMUX InitData_Buffer=NULL; InitData_Buffer_Size=0; #endif //MEDIAINFO_DEMUX } //--------------------------------------------------------------------------- File_Vc1::~File_Vc1() { #if MEDIAINFO_DEMUX delete[] InitData_Buffer; #endif //MEDIAINFO_DEMUX } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Vc1::Streams_Accept() { //Filling Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "VC-1"); Fill(Stream_Video, 0, Video_Codec, From_WMV3?"WMV3":"VC-1"); //For compatibility with the old reaction Fill(Stream_Video, 0, Video_BitDepth, 8); } //--------------------------------------------------------------------------- void File_Vc1::Streams_Fill() { //Calculating - PixelAspectRatio float32 PixelAspectRatio; if (AspectRatio!=0x0F) PixelAspectRatio=Vc1_PixelAspectRatio[AspectRatio]; else if (AspectRatioY) PixelAspectRatio=((float)AspectRatioX)/((float)AspectRatioY); else PixelAspectRatio=1; //Unknown Ztring Profile; if (profile!=(int8u)-1) Profile=Vc1_Profile[profile]; if (profile==3 && level!=(int8u)-1) Profile+=__T("@L")+Ztring::ToZtring(level); Fill(Stream_Video, 0, Video_Format_Profile, Profile); Fill(Stream_Video, 0, Video_Codec_Profile, Profile); Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_Colorimetry, Vc1_ColorimetryFormat[colordiff_format]); if (coded_width && coded_height) { Fill(Stream_Video, StreamPos_Last, Video_Width, (coded_width+1)*2); Fill(Stream_Video, StreamPos_Last, Video_Height, (coded_height+1)*2); } if (PixelAspectRatio!=0) Fill(Stream_Video, 0, Video_PixelAspectRatio, PixelAspectRatio, 3, true); if (FrameRate!=0) Fill(Stream_Video, StreamPos_Last, Video_FrameRate, FrameRate); //Interlacement if (!interlace || (PictureFormat_Count[1]==0 && PictureFormat_Count[2]==0)) //No interlaced frame/field { Fill(Stream_Video, 0, Video_ScanType, "Progressive"); Fill(Stream_Video, 0, Video_Interlacement, "PPF"); } else if (PictureFormat_Count[0]>0) //Interlaced and non interlaced frames/fields { Fill(Stream_Video, 0, Video_ScanType, "Mixed"); Fill(Stream_Video, 0, Video_Interlacement, "Mixed"); } else { Fill(Stream_Video, 0, Video_ScanType, "Interlaced"); Fill(Stream_Video, 0, Video_Interlacement, "Interlaced"); } if (Frame_Count>0 && interlace) Fill(Stream_Video, 0, Video_ScanOrder, Interlaced_Bottom?"BFF":"TFF"); std::string TempRef; for (std::map::iterator Temp=TemporalReference.begin(); Temp!=TemporalReference.end(); ++Temp) { TempRef+=Temp->second.top_field_first?"T":"B"; TempRef+=Temp->second.repeat_first_field?"3":"2"; } if (TempRef.find('3')!=std::string::npos) //A pulldown maybe is detected { if (TempRef.find("T2T3B2B3T2T3B2B3")!=std::string::npos || TempRef.find("B2B3T2T3B2B3T2T3")!=std::string::npos) { Fill(Stream_Video, 0, Video_ScanOrder, "2:3 Pulldown", Unlimited, true, true); Fill(Stream_Video, 0, Video_FrameRate, FrameRate*24/30, 3, true); //Real framerate Fill(Stream_Video, 0, Video_ScanType, "Progressive", Unlimited, true, true); Fill(Stream_Video, 0, Video_Interlacement, "PPF", Unlimited, true, true); } if (TempRef.find("T2T2T2T2T2T2T2T2T2T2T2T3B2B2B2B2B2B2B2B2B2B2B2B3")!=std::string::npos || TempRef.find("B2B2B2B2B2B2B2B2B2B2B2B3T2T2T2T2T2T2T2T2T2T2T2T3")!=std::string::npos) { Fill(Stream_Video, 0, Video_ScanOrder, "2:2:2:2:2:2:2:2:2:2:2:3 Pulldown", Unlimited, true, true); Fill(Stream_Video, 0, Video_FrameRate, FrameRate*24/25, 3, true); //Real framerate Fill(Stream_Video, 0, Video_ScanType, "Progressive", Unlimited, true, true); Fill(Stream_Video, 0, Video_Interlacement, "PPF", Unlimited, true, true); } } //Buffer for (size_t Pos=0; PosPTS_Begin) Fill(Stream_Video, 0, Video_Duration, float64_int64s(((float64)(PTS_End-PTS_Begin))/1000000)); #if MEDIAINFO_IBI int64u Numerator=0, Denominator=0; if (framerate_present) { if (framerate_form) { Numerator=framerateexp+1; Denominator=32; } else if (Vc1_FrameRate_dr(frameratecode_dr)) { Numerator=(int64u)Vc1_FrameRate_enr(frameratecode_enr); Denominator=(int64u)Vc1_FrameRate_dr(frameratecode_dr); } } if (Numerator) Ibi_Stream_Finish(Numerator, Denominator); #endif //MEDIAINFO_IBI } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Vc1::FileHeader_Begin() { if (!File__Analyze::FileHeader_Begin_0x000001()) return false; if (!MustSynchronize) { Synched_Init(); Buffer_TotalBytes_FirstSynched+=0; File_Offset_FirstSynched=File_Offset; } //All should be OK return true; } //*************************************************************************** // Buffer - Synchro //*************************************************************************** //--------------------------------------------------------------------------- bool File_Vc1::Synched_Test() { //Must have enough buffer for having header if (Buffer_Offset+4>Buffer_Size) return false; //Quick test of synchro if (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x01) { Synched=false; return true; } //Quick search if (!Header_Parser_QuickSearch()) return false; #if MEDIAINFO_IBI bool RandomAccess=Buffer[Buffer_Offset+3]==0x0F; //SequenceHeader if (RandomAccess) Ibi_Add(); #endif //MEDIAINFO_IBI //We continue return true; } //--------------------------------------------------------------------------- void File_Vc1::Synched_Init() { //Count Interlaced_Top=0; Interlaced_Bottom=0; PictureFormat_Count.resize(4); if (Frame_Count_NotParsedIncluded==(int64u)-1) Frame_Count_NotParsedIncluded=0; //No Frame_Count_NotParsedIncluded in the container //Temp coded_width=0; coded_height=0; framerateexp=0; frameratecode_enr=0; frameratecode_dr=0; profile=(int8u)-1; level=(int8u)-1; colordiff_format=1; //Default is 4:2:0 AspectRatio=0; AspectRatioX=0; AspectRatioY=0; hrd_num_leaky_buckets=0; max_b_frames=7; //Default for advanced profile interlace=false; tfcntrflag=false; framerate_present=false; framerate_form=false; hrd_param_flag=false; finterpflag=false; rangered=false; psf=false; pulldown=false; panscan_flag=false; #if MEDIAINFO_DEMUX Demux_IntermediateItemFound=true; #endif //MEDIAINFO_DEMUX TemporalReference_Offset=0; if (!IsSub) FrameInfo.DTS=0; //Default stream values Streams.resize(0x100); Streams[0x0F].Searching_Payload=true; } //*************************************************************************** // Buffer - Demux //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX bool File_Vc1::Demux_UnpacketizeContainer_Test() { if ((Demux_IntermediateItemFound && Buffer[Buffer_Offset+3]==0x0D) || Buffer[Buffer_Offset+3]==0x0F) { if (Demux_Offset==0) { Demux_Offset=Buffer_Offset; Demux_IntermediateItemFound=false; } while (Demux_Offset+4<=Buffer_Size) { //Synchronizing while(Demux_Offset+3<=Buffer_Size && (Buffer[Demux_Offset ]!=0x00 || Buffer[Demux_Offset+1]!=0x00 || Buffer[Demux_Offset+2]!=0x01)) { Demux_Offset+=2; while(Demux_Offset=Buffer_Size || Buffer[Demux_Offset-1]==0x00) Demux_Offset--; } if (Demux_Offset+4<=Buffer_Size) { if (Demux_IntermediateItemFound) { bool MustBreak; switch (Buffer[Demux_Offset+3]) { case 0x0D : case 0x0F : MustBreak=true; break; default : Demux_Offset+=3; MustBreak=false; } if (MustBreak) break; //while() loop } else { if (Buffer[Demux_Offset+3]==0x0D) Demux_IntermediateItemFound=true; } } Demux_Offset++; } if (Demux_Offset+4>Buffer_Size && File_Offset+Buffer_Size!=File_Size) return false; //No complete frame if (!Status[IsAccepted]) { Accept("VC-1"); if (Config->Demux_EventWasSent) return false; } //Demux #if MEDIAINFO_DEMUX if (InitData_Buffer_Size!=(size_t)-1 && Buffer[Buffer_Offset+3]==0x0F) //First SequenceHeader { //Searching begin of frame (after SequenceHeader/EntryPointHeader) size_t Header_End=4; for (; Header_EndDemux_InitData_Get()) { case 0 : //In demux event break; //Will be done in the first demux event case 1 : //In field { std::string Data_Raw((const char*)(Buffer+Buffer_Offset), (size_t)(Header_End-Buffer_Offset)); std::string Data_Base64(Base64::encode(Data_Raw)); Fill(Stream_Video, StreamPos_Last, "Demux_InitBytes", Data_Base64); (*Stream_More)[Stream_Video][StreamPos_Last](Ztring().From_Local("Demux_InitBytes"), Info_Options)=__T("N NT"); } break; default : ; } delete[] InitData_Buffer; InitData_Buffer=NULL; InitData_Buffer_Size=(size_t)-1; } #endif //MEDIAINFO_DEMUX Demux_UnpacketizeContainer_Demux(Buffer[Buffer_Offset+3]==0x0F); } return true; } #endif //MEDIAINFO_DEMUX //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Vc1::Read_Buffer_Unsynched() { RefFramesCount=0; #if MEDIAINFO_DEMUX Demux_IntermediateItemFound=true; #endif //MEDIAINFO_DEMUX } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- void File_Vc1::Header_Parse() { //Specific if (From_WMV3 || Only_0D) { Header_Fill_Size(Buffer_Size); Header_Fill_Code(From_WMV3?0x0F:0x0D, Ztring().From_CC1(From_WMV3?0x0F:0x0D)); return; } //Parsing Skip_B3( "synchro"); Get_B1 (start_code, "start_code"); if (!Header_Parser_Fill_Size()) { Element_WaitForMoreData(); return; } //Filling Header_Fill_Code(start_code, Ztring().From_CC1(start_code)); } //--------------------------------------------------------------------------- void File_Vc1::Data_Parse() { //Parse switch (Element_Code) { case 0x0A: EndOfSequence(); break; case 0x0B: Slice(); break; case 0x0C: Field(); break; case 0x0D: FrameHeader(); break; case 0x0E: EntryPointHeader(); break; case 0x0F: SequenceHeader(); break; case 0x1B: UserDefinedSlice(); break; case 0x1C: UserDefinedField(); break; case 0x1D: UserDefinedFrameHeader(); break; case 0x1E: UserDefinedEntryPointHeader(); break; case 0x1F: UserDefinedSequenceHeader(); break; default: Trusted_IsNot("Unattended element!"); } } //--------------------------------------------------------------------------- bool File_Vc1::Header_Parser_Fill_Size() { //Look for next Sync word if (Buffer_Offset_Temp==0) //Buffer_Offset_Temp is not 0 if Header_Parse_Fill_Size() has already parsed first frames Buffer_Offset_Temp=Buffer_Offset+4; while (Buffer_Offset_Temp+4<=Buffer_Size && CC3(Buffer+Buffer_Offset_Temp)!=0x000001) { Buffer_Offset_Temp+=2; while(Buffer_Offset_Temp=Buffer_Size || Buffer[Buffer_Offset_Temp-1]==0x00) Buffer_Offset_Temp--; if (start_code==0x0D) //FrameHeader, we need only few bytes { if (Buffer_Offset_Temp-Buffer_Offset>20) { //OK, we continue, we have enough for a slice Header_Fill_Size(16); Buffer_Offset_Temp=0; return true; } } } //Must wait more data? if (Buffer_Offset_Temp+4>Buffer_Size) { if (FrameIsAlwaysComplete || File_Offset+Buffer_Size==File_Size) Buffer_Offset_Temp=Buffer_Size; //We are sure that the next bytes are a start else return false; } //OK, we continue Header_Fill_Size(Buffer_Offset_Temp-Buffer_Offset); Buffer_Offset_Temp=0; return true; } //--------------------------------------------------------------------------- bool File_Vc1::Header_Parser_QuickSearch() { while ( Buffer_Offset+4<=Buffer_Size && Buffer[Buffer_Offset ]==0x00 && Buffer[Buffer_Offset+1]==0x00 && Buffer[Buffer_Offset+2]==0x01) { //Getting start_code int8u start_code=CC1(Buffer+Buffer_Offset+3); //Searching start if (Streams[start_code].Searching_Payload) return true; //Synchronizing Buffer_Offset+=4; Synched=false; if (!Synchronize()) { UnSynched_IsNotJunk=true; return false; } if (Buffer_Offset+4>Buffer_Size) { UnSynched_IsNotJunk=true; return false; } } if (Buffer_Offset+3==Buffer_Size) return false; //Sync is OK, but start_code is not available Trusted_IsNot("VC-1, Synchronisation lost"); return Synchronize(); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- // Packet "0A" void File_Vc1::EndOfSequence() { Element_Name("EndOfSequence"); } //--------------------------------------------------------------------------- // Packet "0B" void File_Vc1::Slice() { Element_Name("Slice"); } //--------------------------------------------------------------------------- // Packet "0C" void File_Vc1::Field() { Element_Name("Field"); } //--------------------------------------------------------------------------- // Packet "0D" void File_Vc1::FrameHeader() { //Name Element_Name("FrameHeader"); Element_Info1(Ztring(__T("Frame ")+Ztring::ToZtring(Frame_Count))); if (FrameRate) { Element_Info1C((FrameInfo.PTS!=(int64u)-1), __T("PTS ")+Ztring().Duration_From_Milliseconds(float64_int64s(((float64)FrameInfo.PTS)/1000000+Frame_Count_InThisBlock*1000/FrameRate))); Element_Info1C((FrameInfo.DTS!=(int64u)-1), __T("DTS ")+Ztring().Duration_From_Milliseconds(float64_int64s(((float64)FrameInfo.DTS)/1000000))); } //Counting if (File_Offset+Buffer_Offset+Element_Size==File_Size) Frame_Count_Valid=Frame_Count; //Finish frames in case of there are less than Frame_Count_Valid frames Frame_Count++; Frame_Count_InThisBlock++; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; //Parsing BS_Begin(); int8u ptype=(int8u)-1; if (profile==3) //Advanced { int8u PictureFormat=0; //Default=Progressive frame if (interlace) { bool fcm_1; Get_SB ( fcm_1, "fcm_1"); if (fcm_1) { bool fcm_2; Get_SB ( fcm_2, "fcm_2"); PictureFormat=fcm_2?2:1; //Interlaced Field : Interlaced Frame } } Param_Info1(Vc1_PictureFormat[PictureFormat]); PictureFormat_Count[PictureFormat]++; if (PictureFormat==2) //Interlaced Field { int8u ptype_; Get_S1 ( 3, ptype_, "ptype"); if (ptype_<5) { Param_Info1(Vc1_Type[Vc1_FieldTypeTable[ptype_][0]]); Element_Info1(Vc1_Type[Vc1_FieldTypeTable[ptype_][0]]); //First field Param_Info1(Vc1_Type[Vc1_FieldTypeTable[ptype_][1]]); Element_Info1(Vc1_Type[Vc1_FieldTypeTable[ptype_][1]]); //Second field ptype=Vc1_FieldTypeTable[ptype_][0]; //Saving the ptype from the first field } else { Trusted_IsNot("ptype is out of range"); ptype=0; //Error } } else { size_t ptype_; Get_VL (Vc1_ptype, ptype_, "ptype"); if (ptype_<5) {Param_Info1(Vc1_Type[Vc1_ptype[ptype_].mapped_to3]); Element_Info1(Vc1_Type[Vc1_ptype[ptype_].mapped_to3]);} ptype=(int8u)Vc1_ptype[ptype_].mapped_to3; } if (RefFramesCount<2 && (ptype==0 || ptype==1)) RefFramesCount++; if (FrameInfo.DTS!=(int64u)-1) { if (framerate_present) FrameInfo.DTS+=float64_int64s(((float64)1000000000)/FrameRate); } if (FrameInfo.PTS!=(int64u)-1) { if (PTS_Begin==(int64u)-1 && ptype==0) //IFrame PTS_Begin=FrameInfo.PTS; if ((ptype==0 || ptype==1) && Frame_Count_InThisBlock<=1) //IFrame or PFrame PTS_End=FrameInfo.PTS; if ((ptype==0 || ptype==1) || (Frame_Count_InThisBlock>=2 && RefFramesCount>=2)) //IFrame or PFrame or more than 2 RefFrame for BFrames { if (framerate_present) PTS_End+=float64_int64s(((float64)1000000000)/FrameRate); } } if (ptype!=4) //!=Skipping { if (tfcntrflag) { Skip_S1( 8, "tfcntr - frame counter"); } } if (interlace && !psf) { bool tff=true, rff=false; if (pulldown) { Get_SB (tff, "tff - top field first"); Get_SB (rff, "rff - repeat first field"); if (tff) Interlaced_Top++; else Interlaced_Bottom++; if (TemporalReference.size()<30) { if (ptype!=2 && ptype!=3 //if not B and BI-frame && !TemporalReference_Waiting.empty()) //We must have 2 I or P pictures to be sure not having B picture later { //We have 2 I or P pictures for (size_t Pos=1; Pos=Frame_Count_Valid) { Fill("VC-1"); if (!IsSub && MediaInfoLib::Config.ParseSpeed_Get()<1) Finish("VC-1"); } #if MEDIAINFO_EVENTS { EVENT_BEGIN (Video, SliceInfo, 0) Event.FieldPosition=Field_Count; Event.SlicePosition=0; switch (ptype) { case 0 : Event.SliceType=0; break; case 1 : Event.SliceType=1; break; case 2 : case 3 : Event.SliceType=2; break; case 4 : Event.SliceType=3; break; default: Event.SliceType=(int8u)-1; } Event.Flags=0; EVENT_END () } #endif //MEDIAINFO_EVENTS FILLING_END(); Synched=false; //We do not have the complete FrameHeader } //--------------------------------------------------------------------------- // Packet "0E" void File_Vc1::EntryPointHeader() { Element_Name("EntryPointHeader"); //Parsing bool extended_mv; BS_Begin(); Skip_SB( "broken_link"); Skip_SB( "closed_entry"); Get_SB ( panscan_flag, "panscan_flag"); Skip_SB( "refdist_flag"); Skip_SB( "loopfilter"); Skip_SB( "fastuvmc"); Get_SB ( extended_mv, "extended_mv"); Skip_S1( 2, "dquant"); Skip_SB( "vstransform"); Skip_SB( "overlap"); Skip_S1( 2, "quantizer"); if (hrd_param_flag) for (int8u Pos=0; PosDemux_InitData_Get()) { case 0 : //In demux event break; //Will be done in the first demux event case 1 : //In field { std::string Data_Raw((char*)InitData_Buffer_Temp, InitData_Buffer_Temp_Size); std::string Data_Base64(Base64::encode(Data_Raw)); Fill(Stream_Video, StreamPos_Last, "Demux_InitBytes", Data_Base64); (*Stream_More)[Stream_Video][StreamPos_Last](Ztring().From_Local("Demux_InitBytes"), Info_Options)=__T("N NT"); } break; default : ; } delete[] InitData_Buffer; InitData_Buffer=NULL; InitData_Buffer_Size=(size_t)-1; } #endif //MEDIAINFO_DEMUX FILLING_END(); } //--------------------------------------------------------------------------- // Packet "0F" void File_Vc1::SequenceHeader() { Element_Name("SequenceHeader"); //Parsing BS_Begin(); Get_S1 ( 2, profile, "profile"); Param_Info1(Vc1_Profile[profile]); if (profile==0 || profile==1) //Simple or Main { Skip_S1( 2, "res_sm"); Skip_S1( 3, "frmrtq_postproc"); Skip_S1( 5, "bitrtq_postproc"); Skip_SB( "loopfilter"); Skip_SB( "res_x8"); Skip_SB( "multires"); Skip_SB( "res_fasttx"); Skip_SB( "fastuvmc"); Skip_SB( "extended_mv"); Skip_S1( 2, "dquant"); Skip_SB( "vtransform"); Skip_SB( "res_transtab"); Skip_SB( "overlap"); Skip_SB( "syncmarker"); Skip_SB( "rangered"); Skip_S1( 2, "maxbframes"); Skip_S1( 2, "quantizer"); Skip_SB( "finterpflag"); Skip_SB( "res_rtm_flag"); } else if (profile==3) //Advanced { Get_S1 ( 3, level, "level"); Get_S1 ( 2, colordiff_format, "colordiff_format"); Param_Info1(Vc1_ColorimetryFormat[colordiff_format]); Skip_S1( 3, "frmrtq_postproc"); Skip_S1( 5, "bitrtq_postproc"); Skip_SB( "postprocflag"); Get_S2 (12, coded_width, "max_coded_width"); Param_Info2((coded_width+1)*2, " pixels"); Get_S2 (12, coded_height, "max_coded_height"); Param_Info2((coded_height+1)*2, " pixels"); Get_SB ( pulldown, "pulldown"); Get_SB ( interlace, "interlace"); Get_SB ( tfcntrflag, "tfcntrflag - frame counter"); Get_SB ( finterpflag, "finterpflag"); Skip_SB( "reserved"); Get_SB ( psf, "psf - progressive segmented frame"); TEST_SB_SKIP( "display_ext"); Info_S2(14, display_x, "display_horiz_size"); Param_Info2(display_x+1, " pixels"); Info_S2(14, display_y, "display_vert_size"); Param_Info2(display_y+1, " pixels"); TEST_SB_SKIP( "aspectratio_flag"); Get_S1 ( 4, AspectRatio, "aspect_ratio"); Param_Info1(Vc1_PixelAspectRatio[AspectRatio]); if (AspectRatio==0x0F) { Get_S1 ( 8, AspectRatioX, "aspect_horiz_size"); Get_S1 ( 8, AspectRatioY, "aspect_vert_size"); } TEST_SB_END(); TEST_SB_GET(framerate_present, "framerate_flag"); TESTELSE_SB_GET(framerate_form, "framerateind"); Get_S2 (16, framerateexp, "framerateexp"); Param_Info3((float32)((framerateexp+1)/32.0), 3, " fps"); TESTELSE_SB_ELSE( "framerateind"); Get_S1 ( 8, frameratecode_enr, "frameratenr"); Param_Info1(Vc1_FrameRate_enr(frameratecode_enr)); Get_S1 ( 4, frameratecode_dr, "frameratedr"); Param_Info1(Vc1_FrameRate_dr(frameratecode_dr)); TESTELSE_SB_END(); TEST_SB_END(); TEST_SB_SKIP( "color_format_flag"); Skip_S1( 8, "color_prim"); Skip_S1( 8, "transfer_char"); Skip_S1( 8, "matrix_coef"); TEST_SB_END(); TEST_SB_END(); TEST_SB_GET (hrd_param_flag, "hrd_param_flag"); int8u buffer_size_exponent; Get_S1 ( 5, hrd_num_leaky_buckets, "hrd_num_leaky_buckets"); Skip_S1( 4, "bitrate_exponent"); Get_S1 ( 4, buffer_size_exponent, "buffer_size_exponent"); hrd_buffers.clear(); for (int8u Pos=0; Pos PictureFormat_Count; //From SequenceHeader std::vector hrd_buffers; int16u coded_width; int16u coded_height; int16u framerateexp; int8u frameratecode_enr; int8u frameratecode_dr; int8u profile; int8u level; int8u colordiff_format; int8u AspectRatio; int8u AspectRatioX; int8u AspectRatioY; int8u hrd_num_leaky_buckets; int8u max_b_frames; bool interlace; bool tfcntrflag; bool framerate_present; bool framerate_form; bool hrd_param_flag; bool finterpflag; bool rangered; bool psf; bool pulldown; bool panscan_flag; //Stream struct stream { bool Searching_Payload; bool Searching_TimeStamp_Start; bool Searching_TimeStamp_End; stream() { Searching_Payload=false; Searching_TimeStamp_Start=false; Searching_TimeStamp_End=false; } }; std::vector Streams; //Temporal reference struct temporalreference { bool top_field_first; bool repeat_first_field; }; std::map TemporalReference; //int32u is the reference std::vector TemporalReference_Waiting; //First must be I and P-frames, other B-frames int16u TemporalReference_Offset; //Temp size_t Width; size_t Height; size_t RatioValue; size_t BitRate; int8u start_code; bool EntryPoint_Parsed; float32 FrameRate; size_t RefFramesCount; //Error controls std::vector Frame_ShouldBe; #if MEDIAINFO_DEMUX int8u* InitData_Buffer; size_t InitData_Buffer_Size; #endif //MEDIAINFO_DEMUX }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Video/File_Vc3.cpp100777 0 0 37075 12226004262 14746 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_VC3_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_Vc3.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- const bool Vc3_FromCID_IsSupported (int32u CompressionID) { switch (CompressionID) { case 1235 : case 1237 : case 1238 : case 1241 : case 1242 : case 1243 : case 1250 : case 1251 : case 1252 : case 1253 : return true; default : return false; } } //--------------------------------------------------------------------------- const int32u Vc3_CompressedFrameSize(int32u CompressionID) { switch (CompressionID) { case 1235 : return 917504; case 1237 : return 606208; case 1238 : return 917504; case 1241 : return 917504; case 1242 : return 606208; case 1243 : return 917504; case 1244 : return 606208; case 1250 : return 458752; case 1251 : return 458752; case 1252 : return 303104; case 1253 : return 188416; default : return 0; } }; //--------------------------------------------------------------------------- const int8u Vc3_SBD(int32u SBD) //Sample Bit Depth { switch (SBD) { case 1 : return 8; case 2 : return 10; default: return 0; } }; //--------------------------------------------------------------------------- const int8u Vc3_SBD_FromCID (int32u CompressionID) { switch (CompressionID) { case 1235 : case 1241 : case 1250 : return 10; default : return 8; } } //--------------------------------------------------------------------------- const char* Vc3_FFC[4]= { "", "Progressive", "Interlaced", "Interlaced", }; //--------------------------------------------------------------------------- const char* Vc3_FFC_ScanOrder[4]= { "", "", "TFF", "BFF", }; //--------------------------------------------------------------------------- const char* Vc3_FFE[2]= { "Interlaced", "Progressive", }; //--------------------------------------------------------------------------- const char* Vc3_SST[2]= { "Progressive", "Interlaced", }; //--------------------------------------------------------------------------- const char* Vc3_SST_FromCID (int32u CompressionID) { switch (CompressionID) { case 1241 : case 1242 : case 1243 : return Vc3_SST[1]; default : return Vc3_SST[0]; } } //--------------------------------------------------------------------------- const int16u Vc3_SPL_FromCID (int32u CompressionID) { switch (CompressionID) { case 1250 : case 1251 : case 1252 : return 1280; default : return 1920; } } //--------------------------------------------------------------------------- const int16u Vc3_ALPF_PerFrame_FromCID (int32u CompressionID) { switch (CompressionID) { case 1250 : case 1251 : case 1252 : return 720; default : return 1080; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Vc3::File_Vc3() :File__Analyze() { //Configuration MustSynchronize=true; //In Frame_Count_Valid=2; FrameRate=0; //Temp Data_ToParse=0; FFC_FirstFrame=(int8u)-1; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Vc3::Streams_Fill() { //Filling Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "VC-3"); Fill(Stream_Video, 0, Video_BitRate_Mode, "CBR"); if (FrameRate) Fill(Stream_Video, 0, Video_BitRate, Vc3_CompressedFrameSize(CID)*8*FrameRate, 0); if (Vc3_FromCID_IsSupported(CID)) { Fill(Stream_Video, 0, Video_Width, Vc3_SPL_FromCID(CID)); Fill(Stream_Video, 0, Video_Height, Vc3_ALPF_PerFrame_FromCID(CID)); Fill(Stream_Video, 0, Video_BitDepth, Vc3_SBD_FromCID(CID)); Fill(Stream_Video, 0, Video_ScanType, Vc3_SST_FromCID(CID)); Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_ChromaSubsampling, "4:2:2"); } else { Fill(Stream_Video, 0, Video_Width, SPL); Fill(Stream_Video, 0, Video_Height, ALPF*(SST?2:1)); Fill(Stream_Video, 0, Video_BitDepth, Vc3_SBD(SBD)); Fill(Stream_Video, 0, Video_ScanType, Vc3_SST[SST]); } if (FFC_FirstFrame!=(int8u)-1) Fill(Stream_Video, 0, Video_ScanOrder, Vc3_FFC_ScanOrder[FFC_FirstFrame]); } //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- bool File_Vc3::Synchronize() { //Synchronizing while (Buffer_Offset+5<=Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x02 || Buffer[Buffer_Offset+3]!=0x80 || Buffer[Buffer_Offset+4]!=0x01)) { Buffer_Offset+=2; while (Buffer_Offset=Buffer_Size || Buffer[Buffer_Offset-1]==0x00) Buffer_Offset--; } //Parsing last bytes if needed if (Buffer_Offset+4==Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x02 || Buffer[Buffer_Offset+3]!=0x80)) Buffer_Offset++; if (Buffer_Offset+3==Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x02)) Buffer_Offset++; if (Buffer_Offset+2==Buffer_Size && (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00)) Buffer_Offset++; if (Buffer_Offset+1==Buffer_Size && Buffer[Buffer_Offset ]!=0x00) Buffer_Offset++; if (Buffer_Offset+5>Buffer_Size) return false; //Synched is OK Synched=true; return true; } //--------------------------------------------------------------------------- bool File_Vc3::Synched_Test() { //Must have enough buffer for having header if (Buffer_Offset+5>Buffer_Size) return false; //Quick test of synchro if (Buffer[Buffer_Offset ]!=0x00 || Buffer[Buffer_Offset+1]!=0x00 || Buffer[Buffer_Offset+2]!=0x02 || Buffer[Buffer_Offset+3]!=0x80 || Buffer[Buffer_Offset+4]!=0x01) { Synched=false; return true; } //We continue return true; } //*************************************************************************** // Buffer - Demux //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DEMUX bool File_Vc3::Demux_UnpacketizeContainer_Test() { if (Buffer_Offset+0x2C>Buffer_Size) return false; int32u CompressionID=BigEndian2int32u(Buffer+Buffer_Offset+0x28); int32u Size=Vc3_CompressedFrameSize(CompressionID); Demux_Offset=Buffer_Offset+Size; if (Demux_Offset>Buffer_Size && File_Offset+Buffer_Size!=File_Size) return false; //No complete frame Demux_UnpacketizeContainer_Demux(); return true; } #endif //MEDIAINFO_DEMUX //*************************************************************************** // Buffer - Per element //*************************************************************************** //--------------------------------------------------------------------------- bool File_Vc3::Header_Begin() { if (Buffer_Offset+0x2C>Buffer_Size) return false; return true; } //--------------------------------------------------------------------------- void File_Vc3::Header_Parse() { int32u CompressionID=BigEndian2int32u(Buffer+Buffer_Offset+0x28); Header_Fill_Code(0, "Frame"); Header_Fill_Size(Vc3_CompressedFrameSize(CompressionID)); } //--------------------------------------------------------------------------- void File_Vc3::Data_Parse() { //Parsing Element_Info1(Frame_Count+1); HeaderPrefix(); CodingControlA(); Skip_XX(16, "Reserved"); ImageGeometry(); Skip_XX( 5, "Reserved"); CompressionID(); CodingControlB(); Skip_XX( 3, "Reserved"); TimeCode(); Skip_XX(640-Element_Offset, "ToDo"); Skip_XX(Element_Size-Element_Offset, "Data"); FILLING_BEGIN(); Data_ToParse-=Buffer_Size-(size_t)Buffer_Offset; Frame_Count++; if (Frame_Count_NotParsedIncluded!=(int64u)-1) Frame_Count_NotParsedIncluded++; if (FrameRate) { FrameInfo.PTS=FrameInfo.DTS+=float64_int64s(1000000000/FrameRate); FrameInfo.DUR=float64_int64s(1000000000/FrameRate); } else { FrameInfo.PTS=FrameInfo.DTS=FrameInfo.DUR=(int64u)-1; } if (!Status[IsFinished] && Frame_Count>=Frame_Count_Valid) Finish("VC-3"); FILLING_END(); } //*************************************************************************** // Elements //*************************************************************************** //--------------------------------------------------------------------------- void File_Vc3::HeaderPrefix() { //Parsing Element_Begin1("Header Prefix"); int64u Data; Get_B5 (Data, "Contents"); Element_End0(); FILLING_BEGIN(); if (Data==0x0000028001LL) Accept("VC-3"); else Reject("VC-3"); FILLING_END(); } //--------------------------------------------------------------------------- void File_Vc3::CodingControlA() { //Parsing Element_Begin1("Coding Control A"); BS_Begin(); int8u FFC; Mark_0(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Get_S1 (2, FFC, "Field/Frame Count"); Param_Info1(Vc3_FFC[FFC]); Mark_1(); Mark_0(); Mark_0(); Get_SB ( CRCF, "CRC flag"); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Mark_1(); Mark_0(); Mark_1(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); BS_End(); Element_End0(); FILLING_BEGIN(); if (FFC_FirstFrame==(int8u)-1) FFC_FirstFrame=FFC; FILLING_END(); } //--------------------------------------------------------------------------- void File_Vc3::ImageGeometry() { //Parsing Element_Begin1("Image Geometry"); 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"); Param_Info1(Vc3_SST[SST]); Mark_0(); Mark_0(); BS_End(); Element_End0(); } //--------------------------------------------------------------------------- void File_Vc3::CompressionID() { //Parsing Element_Begin1("Compression ID"); int32u Data; Get_B4 (Data, "Compression ID"); Element_End0(); FILLING_BEGIN(); CID=Data; Data_ToParse=Vc3_CompressedFrameSize(Data); if (Data_ToParse==0) Reject("VC-3"); FILLING_END(); } //--------------------------------------------------------------------------- void File_Vc3::CodingControlB() { //Parsing Element_Begin1("Coding Control B"); BS_Begin(); Info_S1(1, FFE, "Field/Frame Count"); Param_Info1(Vc3_FFE[FFE]); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); BS_End(); Element_End0(); } //--------------------------------------------------------------------------- void File_Vc3::TimeCode() { //Parsing Element_Begin1("Time Code"); bool TCP; BS_Begin(); Get_SB ( TCP, "TCP: Time Code Present"); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); Mark_0(); BS_End(); if (TCP) { Skip_B8( "Time Code"); } else Skip_B8( "Junk"); Element_End0(); } //*************************************************************************** // C++ //*************************************************************************** } //NameSpace #endif //MEDIAINFO_VC3_* MediaInfoLib/Source/MediaInfo/Video/File_Vc3.h100777 0 0 4022 12226004262 14355 0/* 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 VC-3 video streams // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_Vc3H #define MediaInfo_Vc3H //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" #include "MediaInfo/Multiple/File_Mpeg4.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Avs //*************************************************************************** class File_Vc3 : public File__Analyze { public : //In int64u Frame_Count_Valid; float FrameRate; //constructor/Destructor File_Vc3(); private : //Streams management void Streams_Fill(); //Buffer - Synchro bool Synchronize(); bool Synched_Test(); //Buffer - Demux #if MEDIAINFO_DEMUX bool Demux_UnpacketizeContainer_Test(); #endif //MEDIAINFO_DEMUX //Buffer - Per element bool Header_Begin (); void Header_Parse (); void Data_Parse (); //Elements void HeaderPrefix(); void CodingControlA(); void ImageGeometry(); void CompressionID(); void CodingControlB(); void TimeCode(); void UserData(); void MacroblockScanIndices(); //Temp int64u Data_ToParse; int32u CID; bool CRCF; int16u ALPF; int16u SPL; int8u SBD; int8u FFC_FirstFrame; bool SST; }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Video/File_Vp8.cpp100777 0 0 7554 12226004262 14747 0/* 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. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_VP8_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_Vp8.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "ZenLib/BitStream.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Vp8::File_Vp8() :File__Analyze() { //Configuration ParserName=__T("VP8"); IsRawStream=true; //In Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.3?32:4; } //--------------------------------------------------------------------------- File_Vp8::~File_Vp8() { } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Vp8::Streams_Accept() { Stream_Prepare(Stream_Video); } //--------------------------------------------------------------------------- void File_Vp8::Streams_Update() { } //--------------------------------------------------------------------------- void File_Vp8::Streams_Fill() { Fill(Stream_Video, 0, Video_Format, "VP8"); Fill(Stream_Video, 0, Video_Codec, "VP8"); } //--------------------------------------------------------------------------- void File_Vp8::Streams_Finish() { } //*************************************************************************** // Buffer - Global //*************************************************************************** //--------------------------------------------------------------------------- void File_Vp8::Read_Buffer_Continue() { Accept(); BS_Begin_LE(); //VP8 bitstream is Little Endian bool frame_type; Get_TB ( frame_type, "frame type"); Skip_T1( 3, "version number"); Skip_TB( "show_frame flag"); Skip_T4(19, "size of the first data partition"); BS_End(); if (!frame_type) //I-Frame { Skip_B3( "0x9D012A"); Skip_L2( "Width"); Skip_L2( "Height"); } Skip_XX(Element_Size-Element_Offset, "Other data"); Frame_Count++; if (Frame_Count>=Frame_Count_Valid) Finish(); } } //NameSpace #endif //MEDIAINFO_VP8_YES MediaInfoLib/Source/MediaInfo/Video/File_Vp8.h100777 0 0 2720 12226004262 14402 0/* 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 VP8 files // http://datatracker.ietf.org/doc/rfc6386/?include_text=1 // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_Vp8H #define MediaInfo_Vp8H //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/File__Analyze.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Class File_Vp8 //*************************************************************************** class File_Vp8 : public File__Analyze { public : //In int64u Frame_Count_Valid; //Constructor/Destructor File_Vp8(); ~File_Vp8(); private : //Streams management void Streams_Accept(); void Streams_Update(); void Streams_Fill(); void Streams_Finish(); //Buffer - Global void Read_Buffer_Continue(); }; } //NameSpace #endif MediaInfoLib/Source/MediaInfo/Video/File_Y4m.cpp100777 0 0 20732 12226004262 14754 0/* 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. */ //--------------------------------------------------------------------------- // // Source: // http://wiki.multimedia.cx/index.php?title=YUV4MPEG2 // //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_Y4M_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_Y4m.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- namespace MediaInfoLib { //--------------------------------------------------------------------------- //*************************************************************************** // Infos //*************************************************************************** //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Y4m::File_Y4m() :File__Analyze() { //Configuration ParserName=__T("YUV4MPEG2"); IsRawStream=true; Frame_Count_NotParsedIncluded=0; //Temp HeaderEnd=0; } //--------------------------------------------------------------------------- File_Y4m::~File_Y4m() { } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Y4m::Streams_Accept() { Fill(Stream_General, 0, General_Format, "YUV4MPEG2"); Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "YUV"); Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); } //--------------------------------------------------------------------------- void File_Y4m::Streams_Fill() { } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Y4m::FileHeader_Begin() { if (Buffer_Size<10) return false; if (!(Buffer[0]==0x59 && Buffer[1]==0x55 && Buffer[2]==0x56 && Buffer[3]==0x34 && Buffer[4]==0x4D && Buffer[5]==0x50 && Buffer[6]==0x45 && Buffer[7]==0x47 && Buffer[8]==0x32 && Buffer[9]==0x20)) { Reject(); return false; } for (; HeaderEnd #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include #include #include #include "PreRelease/Enums.h" using namespace ZenLib; using namespace std; #define FILE_MAX 20000 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // Open a file ZenLib::Ztring Enums_Create_Load(Ztring FileName, Ztring &Contents) { wxFile F; if (F.Open(FileName.c_str(), wxFile::read)==false) { Ztring ToReturn=L"Problems to open "; ToReturn+=FileName; ToReturn+=L"\r\n"; return ToReturn; } char C[FILE_MAX]; size_t Size=F.Read(C, FILE_MAX-1); Contents.From_Local(C, Size); return L""; } //--------------------------------------------------------------------------- // Write a file ZenLib::Ztring Enums_Create_Save(Ztring FileName, Ztring &Contents) { File F; if (F.Create(FileName.c_str(), true)==false) { Ztring ToReturn=L"Problems to create "; ToReturn+=FileName; ToReturn+=L"\r\n"; return ToReturn; } std::string S1=Contents.To_UTF8(); size_t Size=F.Write((const int8u*)S1.c_str(), S1.size()); Contents.From_Number(Size); Contents+=L" bytes written"; return L""; } //--------------------------------------------------------------------------- // Open an item ZenLib::Ztring Enums_Create_Item(const Ztring &Directory, const Ztring &Name, Ztring &Contents) { Contents.clear(); Ztring Result; //Load header Ztring Partial; Result=Enums_Create_Load(L"../Source/Resource/Text/Enums_.2.txt", Partial); if (!Result.empty()) return Result; Partial.FindAndReplace(L"%Name%", Ztring(Name).MakeLowerCase()); Contents+=Partial; //Load line template Ztring Line; Result=Enums_Create_Load(L"../Source/Resource/Text/Enums_.5.txt", Line); if (!Result.empty()) return Result; //Read input file ZtringListListF ZLL; ZLL.Load(Ztring(L"../Source/Resource/Text/")+Directory+L"/"+Name+L".csv"); for (size_t Pos=0; Pos ZenLib::Ztring Enums_Create (); MediaInfoLib/Source/PreRelease/OldFiles.cpp100777 0 0 10327 12063042307 14173 0//--------------------------------------------------------------------------- #include #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include #include #include #include #include "PreRelease/OldFiles.h" using namespace ZenLib; //--------------------------------------------------------------------------- Ztring Version; //X.X.X.X Ztring Version_Short; //X.X Ztring ToShow; //What to show to the user char C[1000000]; wxFile F; wxFileName FN; int I; Ztring Z; wxDateTime Access; int Test_Version(char* FileName_, char* Begin, char* End) { wxString FileName=Ztring().From_Local(FileName_).c_str(); //Opening File F.Open(FileName); I=F.Read(C, 1000000); if (!I) { ToShow+=__T("Error opening ")+FileName; return -1; } //Getting information C[I]=0; Z.From_Local(C); Z=Z.SubString(Ztring().From_Local(Begin), Ztring().From_Local(End)); //deleting extra bytes if (Z[Z.size()-1]=='\n') Z.resize(Z.size()-1); if (Z[Z.size()-1]=='\r') Z.resize(Z.size()-1); //Testing validity if (Z.size()!=3 && Z.size()!=7) //non long, no short { ToShow+=__T("Error reading ")+FileName; return -2; } //Reformtation information Z.FindAndReplace(__T(","), __T("."), 0, Ztring_Recursive); if (Z!=Version && Z!=Version_Short) { ToShow+=FileName; ToShow+=__T(" is not good : version is marked "); ToShow+=Z; ToShow+=__T("\r\n"); } return 0; } //--------------------------------------------------------------------------- int Test_Date(wxString FileName) { FN.Assign(FileName); if (!FN.FileExists()) { ToShow+=FileName; ToShow+=__T(" does not exist"); return -1; } if (!FN.GetTimes(&Access, NULL, NULL)) { ToShow+=__T("Error getting date of "); ToShow+=FileName; return -1; } wxTimeSpan TS=wxDateTime::Now()-Access; if (TS.GetWeeks()>0 || TS.GetDays()>0 || TS.GetHours()>0 || TS.GetMinutes()>0 || TS.GetMinutes()>10) { ToShow+=FileName; ToShow+=__T(" is old : was compiled"); ToShow+=TS.Format().c_str(); ToShow+=__T(" ago\r\n"); } return 0; } //--------------------------------------------------------------------------- Ztring OldFiles_Test () { //Checking version in Info_Version ToShow+=__T("Version checked : "); F.Open(__T("../Source/MediaInfo/MediaInfo_Config.cpp")); I=F.Read(C, 1000000); if (!I) { ToShow+=__T("Error opening ../Source/MediaInfo/MediaInfo_Config.cpp"); return ToShow; } C[I]=0; Z.From_Local(C); Version=Z.SubString(__T("MediaInfoLib - v"), __T("\")")); if (Version.size()!=7) { ToShow+=__T("Error reading ../Source/MediaInfo/MediaInfo.cpp : \"MediaInfoLib - vX.X.X.X - \" not found"); return ToShow; } Version_Short=Version; Version_Short.resize(3); ToShow+=Version+__T("\r\n"); //Checking version in MediaInfo.h if (Test_Version("../Source/MediaInfo/MediaInfo.h", "@version ", "\n")) return ToShow; if (Test_Version("../Source/MediaInfo/MediaInfoList.h", "@version ", "\n")) return ToShow; if (Test_Version("../Project/MSVC/Dll/MediaInfo.rc", " FILEVERSION ", "\n")) return ToShow; if (Test_Version("../Project/MSVC/Dll/MediaInfo.rc", " PRODUCTVERSION ", "\n")) return ToShow; if (Test_Version("../Project/MSVC/Dll/MediaInfo.rc", " VALUE \"FileVersion\", \"", "\"")) return ToShow; if (Test_Version("../Project/MSVC/Dll/MediaInfo.rc", " VALUE \"ProductVersion\", \"", "\"")) return ToShow; if (Test_Version("../History.txt", "Version ", " ")) return ToShow; if (Test_Date(__T("MSVC/Library/MediaInfo.lib"))) return ToShow; if (Test_Date(__T("MSVC/Dll/MediaInfo.dll"))) return ToShow; return ToShow; } //--------------------------------------------------------------------------- MediaInfoLib/Source/PreRelease/OldFiles.h100777 0 0 76 12063042307 13560 0#include ZenLib::Ztring OldFiles_Test (); MediaInfoLib/Source/PreRelease/Resources.cpp100777 0 0 20642 12063042307 14445 0//--------------------------------------------------------------------------- #include #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include #include #include #include "PreRelease/Resources.h" using namespace ZenLib; using namespace std; #define FILE_MAX 20000 //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // Open a file ZenLib::Ztring Resources_Create_Load(Ztring FileName, Ztring &Contents) { wxFile F; if (F.Open(FileName.c_str(), wxFile::read)==false) { Ztring ToReturn=L"Problems to open "; ToReturn+=FileName; ToReturn+=L"\r\n"; return ToReturn; } char C[FILE_MAX]; size_t Size=F.Read(C, FILE_MAX-1); Contents.From_Local(C, Size); return L""; } //--------------------------------------------------------------------------- // Write a file ZenLib::Ztring Resources_Create_Save(Ztring FileName, Ztring &Contents) { File F; if (F.Create(FileName.c_str(), true)==false) { Ztring ToReturn=L"Problems to create "; ToReturn+=FileName; ToReturn+=L"\r\n"; return ToReturn; } std::string S1=Contents.To_UTF8(); size_t Size=F.Write((const int8u*)S1.c_str(), S1.size()); Contents.From_Number(Size); Contents+=L" bytes written"; return L""; } //--------------------------------------------------------------------------- // Open an item ZenLib::Ztring Resources_Create_Item(const Ztring &Directory, const Ztring &Name, const Ztring &Class, Ztring &Contents) { Contents.clear(); Ztring Result; //Load header Ztring Partial; Result=Resources_Create_Load(L"../Source/Resource/Text/_.2.txt", Partial); if (!Result.empty()) return Result; Partial.FindAndReplace(L"%Name%", Ztring(L"MediaInfo_Config_")+Name); Partial.FindAndReplace(L"%Class%", Class); Contents+=Partial; //Load line template Ztring Line; Result=Resources_Create_Load(L"../Source/Resource/Text/_.5.txt", Line); if (!Result.empty()) return Result; //Read input file ZtringListListF ZLL; ZLL.Load(Ztring(L"../Source/Resource/Text/")+Directory+L"/"+Name+L".csv"); for (size_t Pos=0; Pos ZenLib::Ztring Resources_Create (); MediaInfoLib/Source/PreRelease/VCL/ 40777 0 0 0 12165355572 12305 5MediaInfoLib/Source/PreRelease/VCL/PreRelease_.cpp100777 0 0 2073 12063042307 15263 0//--------------------------------------------------------------------------- #include #pragma hdrstop #include "PreRelease/VCL/PreRelease_.h" #include "PreRelease/OldFiles.h" #include "PreRelease/Resources.h" #include "PreRelease/Enums.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Testiftherearetoooldfiles1Click(TObject *Sender) { Memo1->Text=OldFiles_Test().c_str(); } //--------------------------------------------------------------------------- void __fastcall TForm1::Updateresourcefiles1Click(TObject *Sender) { Memo1->Text=Resources_Create().c_str(); Memo1->Text=Enums_Create().c_str(); } //--------------------------------------------------------------------------- MediaInfoLib/Source/PreRelease/VCL/PreRelease_.dfm100777 0 0 1725 12063042307 15252 0object Form1: TForm1 Left = 192 Top = 114 Caption = 'Form1' ClientHeight = 505 ClientWidth = 680 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] Menu = MainMenu1 OldCreateOrder = False PixelsPerInch = 96 TextHeight = 13 object Memo1: TMemo Left = 0 Top = 16 Width = 649 Height = 481 Lines.Strings = ( 'Memo1') ScrollBars = ssVertical TabOrder = 0 end object MainMenu1: TMainMenu Left = 648 Top = 16 object File1: TMenuItem Caption = 'File' object Testiftherearetoooldfiles1: TMenuItem Caption = 'Test if there are too old files' OnClick = Testiftherearetoooldfiles1Click end object Updateresourcefiles1: TMenuItem Caption = 'Update resource files' OnClick = Updateresourcefiles1Click end end end end MediaInfoLib/Source/PreRelease/VCL/PreRelease_.h100777 0 0 2631 12063042307 14730 0//--------------------------------------------------------------------------- #ifndef PreRelease_H #define PreRelease_H //--------------------------------------------------------------------------- #include #include #include #include #include //--------------------------------------------------------------------------- class TForm1 : public TForm { __published: // IDE-managed Components TMainMenu *MainMenu1; TMemo *Memo1; TMenuItem *File1; TMenuItem *Testiftherearetoooldfiles1; TMenuItem *Updateresourcefiles1; void __fastcall Testiftherearetoooldfiles1Click(TObject *Sender); void __fastcall Updateresourcefiles1Click(TObject *Sender); private: // User declarations public: // User declarations __fastcall TForm1(TComponent* Owner); }; //--------------------------------------------------------------------------- extern PACKAGE TForm1 *Form1; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // For Widgets with DEBUG in BCB // Here only because this is useful everywhere #ifdef _DEBUG void wxAssert(int, const wchar_t*, int, const wchar_t*, const wchar_t*) {} #endif //_DEBUG //--------------------------------------------------------------------------- #endif MediaInfoLib/Source/PreRelease/WxWidgets/ 40777 0 0 0 12165355572 13606 5MediaInfoLib/Source/PreRelease/WxWidgets/App.cpp100777 0 0 603 12063042307 15073 0// ---------------------------------------------------------------------------- #include "PreRelease/WxWidgets/App.h" #include "PreRelease/WxWidgets/GUI_Main.h" // ---------------------------------------------------------------------------- bool App::OnInit() { GUI_Main *frame = new GUI_Main(wxPoint(50, 50), wxSize(450, 340)); frame->Show(TRUE); return TRUE; } MediaInfoLib/Source/PreRelease/WxWidgets/App.h100777 0 0 334 12063042307 14541 0#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include "wx/wx.h" #endif class App : public wxApp { public: virtual bool OnInit(); }; IMPLEMENT_APP(App) MediaInfoLib/Source/PreRelease/WxWidgets/GUI_Main.cpp100777 0 0 3102 12063042307 15760 0//---------------------------------------------------------------------------- #include "PreRelease/WxWidgets/GUI_Main.h" #include #include #include #include "PreRelease/OldFiles.h" #include "PreRelease/Resources.h" //---------------------------------------------------------------------------- //Menu BEGIN_EVENT_TABLE(GUI_Main, wxFrame) EVT_MENU(1, GUI_Main::OldFiles) EVT_MENU(2, GUI_Main::Resources) END_EVENT_TABLE() // ---------------------------------------------------------------------------- // main frame // ---------------------------------------------------------------------------- // frame constructor GUI_Main::GUI_Main(const wxPoint& pos, const wxSize& size, long style) :wxFrame(NULL, -1, __T("MediaInfoLib - Too old files test"), pos, size, style) { // set the frame icon SetIcon(wxICON(mondrian)); //Menu wxMenu *Menu_File = new wxMenu; Menu_File->Append(1, __T("Test if there are too old files")); Menu_File->Append(2, __T("Update ressource files")); wxMenuBar *menuBar = new wxMenuBar(); menuBar->Append(Menu_File, __T("&File")); SetMenuBar(menuBar); Text=new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH2); } GUI_Main::~GUI_Main() { } void GUI_Main::OldFiles(wxCommandEvent& WXUNUSED(event)) { Text->SetValue(OldFiles_Test().c_str()); } void GUI_Main::Resources(wxCommandEvent& WXUNUSED(event)) { Text->SetValue(Resources_Create().c_str()); } MediaInfoLib/Source/PreRelease/WxWidgets/GUI_Main.h100777 0 0 1460 12063042307 15432 0#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include "wx/wx.h" #endif // the application icon (under Windows and OS/2 it is in resources) #if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__) #include "mondrian.xpm" #endif class wxTextCtrl; class GUI_Main : public wxFrame { public: GUI_Main(const wxPoint& pos, const wxSize& size, long style = wxDEFAULT_FRAME_STYLE); ~GUI_Main(); // event handlers (these functions should _not_ be virtual) void OldFiles(wxCommandEvent& event); void Resources(wxCommandEvent& event); private: wxTextCtrl* Text; DECLARE_EVENT_TABLE() // any class wishing to process wxWindows events must use this macro }; MediaInfoLib/Source/RegressionTest/ 40777 0 0 0 12226004262 12573 5MediaInfoLib/Source/RegressionTest/RegressionTest.cpp100777 0 0 3160 12226004262 16357 0/* 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. */ // RegressionTest.cpp : Defines the entry point for the console application. // #include #include #include "ZenLib/Ztring.h" #include "RegressionTest/RegressionTest.h" using namespace std; using namespace ZenLib; int _tmain(int argc, _TCHAR* argv[]) { if (argc<4) return 1; Ztring Files=argv[1]; Ztring DataBaseDirectory=argv[2]; int32u Scenario=Ztring(argv[3]).To_int32u(); bool Flag_All=true, Flag_Basic=false, Flag_Events=false, Flag_Md5=false; for (int Pos=3; Pos #include "tchar.h" #include "MediaInfoDLL/MediaInfoDLL.h" #include "ZenLib/ZtringListListF.h" #include "ZenLib/File.h" #include "ZenLib/FileName.h" #include "ZenLib/Dir.h" #include "RegressionTest/RegressionTest.h" #include "MediaInfo/MediaInfo_Events.h" #include "ctime" using namespace MediaInfoDLL; using namespace ZenLib; using namespace std; /***************************************************************************/ /* Events */ /***************************************************************************/ struct UserHandle_struct { Ztring Name; int64u Size; File Time_File; time_t Time_Start; Ztring Parser; UserHandle_struct() { Size=(int64u)-1; Time_Start=(time_t)-1; Time_Start=(time_t)-1; } }; void Basic_General_Start_0 (struct MediaInfo_Event_General_Start_0* Event, struct UserHandle_struct* UserHandle) { if (Event->FileName_Unicode) UserHandle->Name=Event->FileName_Unicode; UserHandle->Size=Event->Stream_Size; UserHandle->Time_Start=time(NULL); UserHandle->Parser.clear(); } void Basic_General_End_0 (struct MediaInfo_Event_General_End_0* Event, struct UserHandle_struct* UserHandle) { time_t Diff; if (UserHandle->Time_Start!=(time_t)-1) Diff=time(NULL)-UserHandle->Time_Start; else Diff=(time_t)-1; if (Diff!=(time_t)-1) UserHandle->Time_File.Write(UserHandle->Name+__T(';')+Ztring::ToZtring(UserHandle->Size)+__T(';')+Ztring::ToZtring(Diff)+EOL); UserHandle->Time_Start=(time_t)-1; UserHandle->Parser.clear(); } void Basic_General_Parser_Selected_0 (struct MediaInfo_Event_General_Parser_Selected_0* Event, struct UserHandle_struct* UserHandle) { if (Event->Name) UserHandle->Parser.From_UTF8(Event->Name); else UserHandle->Parser.clear(); } /***************************************************************************/ /* The callback function */ /***************************************************************************/ #define CASE(_PARSER,_EVENT,_VERSION) \ case MediaInfo_Event_##_PARSER##_##_EVENT : if (EventVersion==_VERSION && Data_Size>=sizeof(struct MediaInfo_Event_##_PARSER##_##_EVENT##_##_VERSION)) _PARSER##_##_EVENT##_##_VERSION((struct MediaInfo_Event_##_PARSER##_##_EVENT##_##_VERSION*)Data_Content, UserHandle); break; void __stdcall Basic_Event_CallBackFunction(unsigned char* Data_Content, size_t Data_Size, void* UserHandle_Void) { /*Retrieving UserHandle*/ struct UserHandle_struct* UserHandle=(struct UserHandle_struct*)UserHandle_Void; struct MediaInfo_Event_Generic* Event_Generic=(struct MediaInfo_Event_Generic*) Data_Content; unsigned char ParserID; unsigned short EventID; unsigned char EventVersion; /*integrity tests*/ if (Data_Size<4) return; //There is a problem /*Retrieving EventID*/ ParserID =(unsigned char) ((Event_Generic->EventCode&0xFF000000)>>24); EventID =(unsigned short)((Event_Generic->EventCode&0x00FFFF00)>>8 ); EventVersion=(unsigned char) ( Event_Generic->EventCode&0x000000FF ); switch (ParserID) { case MediaInfo_Parser_None : switch (EventID) { case MediaInfo_Event_General_Start : if (EventVersion==0 && Data_Size>=sizeof(struct MediaInfo_Event_General_Start_0)) Basic_General_Start_0((struct MediaInfo_Event_General_Start_0*)Data_Content, UserHandle); break; case MediaInfo_Event_General_End : if (EventVersion==0 && Data_Size>=sizeof(struct MediaInfo_Event_General_End_0)) Basic_General_End_0((struct MediaInfo_Event_General_End_0*)Data_Content, UserHandle); break; case MediaInfo_Event_General_Parser_Selected : if (EventVersion==0 && Data_Size>=sizeof(struct MediaInfo_Event_General_Parser_Selected_0)) Basic_General_Parser_Selected_0((struct MediaInfo_Event_General_Parser_Selected_0*)Data_Content, UserHandle); break; default : ; } break; default : ; //ParserID is unknown } } /***************************************************************************/ /* The callback function */ /***************************************************************************/ void RegressionTest_Basic(Ztring Files, Ztring DataBaseDirectory, int32u Scenario) { /* //One per one ZtringList List=Dir::GetAllFileNames(Files); for (size_t Pos=0; PosOpen(List[Pos]); delete MIL; MediaInfoDLL_UnLoad(); File::Move(L"C:\\Temp\\Debug_MemoryLeak.txt", L"C:\\Temp\\"+ZenLib::FileName(List[Pos]).Name_Get()+L"."+ZenLib::FileName(List[Pos]).Extension_Get()+L"."+Ztring::ToZtring(Pos)+L".txt"); } */ /* Old ZtringListListF* Ref=new ZtringListListF[Stream_Max]; for (size_t StreamKind=0; StreamKind #include #include #include "tchar.h" #include "MediaInfoDLL/MediaInfoDLL.h" #include "MediaInfo/MediaInfo_Events.h" #include "ZenLib/ZtringListListF.h" #include "ZenLib/Dir.h" #include "ZenLib/File.h" #include "ZenLib/FileName.h" #include "RegressionTest/RegressionTest.h" using namespace MediaInfoDLL; using namespace ZenLib; using namespace std; const char* F_FileName; #define echoF(_format) Events_UserHandle_struct::perevent &PerEvent=UserHandle->PerEvent[Event->EventCode]; if (!PerEvent.F_MoreThanOnce) {fprintf(PerEvent.F, _format); PerEvent.F_MoreThanOnce=true; } fprintf(PerEvent.F, "\n"); #define echo0(_format) fprintf(PerEvent.F, _format) #define echo1(_format, Arg1) fprintf(PerEvent.F, _format, Arg1) #define echo2(_format, Arg1, Arg2) fprintf(PerEvent.F, _format, Arg1, Arg2) #define echo4(_format, Arg1, Arg2, Arg3, Arg4) fprintf(PerEvent.F, _format, Arg1, Arg2, Arg3, Arg4) struct Events_UserHandle_struct { FileName Name; Ztring Files; Ztring DataBaseDirectory; struct perevent { FILE* F; bool F_MoreThanOnce; bool Custom_MoreThanOnce; }; map PerEvent; int32u Scenario; bool Custom; bool ParseSpeed; bool NextPacket; bool DemuxContainerOnly; bool Seek; Events_UserHandle_struct() { Custom=false; ParseSpeed=false; NextPacket=false; DemuxContainerOnly=false; Seek=false; } void Clear() { for (map::iterator Item=PerEvent.begin(); Item!=PerEvent.end(); ++Item) fclose (Item->second.F); PerEvent.clear(); } }; void General_Start_0 (struct MediaInfo_Event_General_Start_0* Event, struct Events_UserHandle_struct* UserHandle) { echoF("MediaInfo starts\n"); echo1("Stream_Size=%i\n", Event->Stream_Size); } void General_End_0 (struct MediaInfo_Event_General_End_0* Event, struct Events_UserHandle_struct* UserHandle) { echoF("MediaInfo ends\n"); echo1("Stream_Bytes_Analyzed=%i\n", Event->Stream_Bytes_Analyzed); } void General_Parser_Selected_0 (struct MediaInfo_Event_General_Parser_Selected_0* Event, struct Events_UserHandle_struct* UserHandle) { echoF("MediaInfo has selected the parser\n"); echo1("Name=%s\n", Event->Name); } void General_Move_Request_0 (struct MediaInfo_Event_General_Move_Request_0* Event, struct Events_UserHandle_struct* UserHandle) { echoF("MediaInfo has requested to seek\n"); echo1("StreamOffset=%08x\n", Event->StreamOffset); } void General_Move_Done_0 (struct MediaInfo_Event_General_Move_Done_0* Event, struct Events_UserHandle_struct* UserHandle) { echoF("MediaInfo has seek\n"); echo1("StreamOffset=%08x\n", Event->StreamOffset); } void General_SubFile_Start_0 (struct MediaInfo_Event_General_SubFile_Start_0* Event, struct Events_UserHandle_struct* UserHandle) { echoF("MediaInfo is parsing a new file from the source file\n"); echo1("FileName_Relative=%s\n", Event->FileName_Relative); echo1("FileName_Absolute=%s\n", Event->FileName_Absolute); } void General_SubFile_End_0 (struct MediaInfo_Event_General_SubFile_End_0* Event, struct Events_UserHandle_struct* UserHandle) { echoF("MediaInfo has finished the parsing a new file from the source file\n"); } void Global_Demux_4(struct MediaInfo_Event_Global_Demux_4 *Event, struct Events_UserHandle_struct* UserHandle) { if (!UserHandle->DemuxContainerOnly) return; echoF("MediaInfo Demux\n"); echo1("StreamOffset=%08x,", Event->StreamOffset); echo1(" Frame_Number=%u\n", Event->FrameNumber); echo0("IDs="); for (size_t Pos=0; PosStreamIDs_Size; Pos++) switch (Event->StreamIDs_Width[Pos]) { case 2: echo1("%02x, ", Event->StreamIDs[Pos]); break; case 4: echo1("%04x, ", Event->StreamIDs[Pos]); break; case 8: echo1("%08x, ", Event->StreamIDs[Pos]); break; default: echo1("%08x, ", Event->StreamIDs[Pos]); break; } echo0("\n"); if (Event->PCR!=(int64u)-1) echo1("PCR=%s, ", Ztring().Duration_From_Milliseconds(Event->PCR/1000000).To_Local().c_str()); if (Event->PTS!=(int64u)-1) echo1("PTS=%s, ", Ztring().Duration_From_Milliseconds(Event->PTS/1000000).To_Local().c_str()); if (Event->DTS!=(int64u)-1) echo1("DTS=%s, ", Ztring().Duration_From_Milliseconds(Event->DTS/1000000).To_Local().c_str()); if (Event->DUR!=(int64u)-1) echo1("DUR=%s, ", Ztring().Duration_From_Milliseconds(Event->DUR/1000000).To_Local().c_str()); if (Event->PCR!=(int64u)-1 || Event->PTS!=(int64u)-1 || Event->DTS!=(int64u)-1 || Event->DUR!=(int64u)-1) echo0("\n"); echo1("Content_Type=%i,", Event->Content_Type); echo1(" Content_Size=%i,", Event->Content_Size); echo1(" Flags=%08x\n", Event->Flags); } void Video_SliceInfo_0(struct MediaInfo_Event_Video_SliceInfo_0 *Event, struct Events_UserHandle_struct* UserHandle) { if (!UserHandle->DemuxContainerOnly) return; echoF("MediaInfo Demux\n"); echo1("StreamOffset=%08x,", Event->StreamOffset); echo1(" FramePosition=%u,", Event->FrameNumber); echo1(" FieldPosition=%u,", Event->FieldPosition); echo1(" SlicePosition=%u,", Event->SlicePosition); echo0("IDs="); for (size_t Pos=0; PosStreamIDs_Size; Pos++) switch (Event->StreamIDs_Width[Pos]) { case 2: echo1("%02x, ", Event->StreamIDs[Pos]); break; case 4: echo1("%04x, ", Event->StreamIDs[Pos]); break; case 8: echo1("%08x, ", Event->StreamIDs[Pos]); break; default: echo1("%08x, ", Event->StreamIDs[Pos]); break; } echo0("\n"); if (Event->PCR!=(int64u)-1) echo1("PCR=%s, ", Ztring().Duration_From_Milliseconds(Event->PCR/1000000).To_Local().c_str()); if (Event->PTS!=(int64u)-1) echo1("PTS=%s, ", Ztring().Duration_From_Milliseconds(Event->PTS/1000000).To_Local().c_str()); if (Event->DTS!=(int64u)-1) echo1("DTS=%s, ", Ztring().Duration_From_Milliseconds(Event->DTS/1000000).To_Local().c_str()); if (Event->DUR!=(int64u)-1) echo1("DUR=%s, ", Ztring().Duration_From_Milliseconds(Event->DUR/1000000).To_Local().c_str()); if (Event->PCR!=(int64u)-1 || Event->PTS!=(int64u)-1 || Event->DTS!=(int64u)-1 || Event->DUR!=(int64u)-1) echo0("\n"); echo1("SliceType=%i,", Event->SliceType); echo1(" Flags=%08x\n", Event->Flags); } /***************************************************************************/ /* The callback function */ /***************************************************************************/ #define CASE(_PARSER,_EVENT,_VERSION) \ case MediaInfo_Event_##_PARSER##_##_EVENT : if (EventVersion==_VERSION && Data_Size>=sizeof(struct MediaInfo_Event_##_PARSER##_##_EVENT##_##_VERSION)) _PARSER##_##_EVENT##_##_VERSION((struct MediaInfo_Event_##_PARSER##_##_EVENT##_##_VERSION*)Data_Content, UserHandle); break; void __stdcall Event_CallBackFunction(unsigned char* Data_Content, size_t Data_Size, void* UserHandle_Void) { /*Retrieving UserHandle*/ struct Events_UserHandle_struct* UserHandle=(struct Events_UserHandle_struct*)UserHandle_Void; struct MediaInfo_Event_Generic* Event_Generic=(struct MediaInfo_Event_Generic*) Data_Content; unsigned char ParserID; unsigned short EventID; unsigned char EventVersion; /*integrity tests*/ if (Data_Size<4) return; //There is a problem if (UserHandle->PerEvent[Event_Generic->EventCode].F==NULL) { Ztring Number; Number.From_Number(Event_Generic->EventCode, 16); while (Number.size()<8) Number.insert(0, 1, __T('0')); Ztring Name=Ztring(UserHandle->DataBaseDirectory+__T("\\Events\\New\\")+Ztring::ToZtring(UserHandle->Scenario)+__T("\\")+Number+__T("\\")+UserHandle->Name.Name_Get()+__T(".txt")); if (!Dir::Exists(UserHandle->DataBaseDirectory+__T("\\Events\\New"))) Dir::Create(UserHandle->DataBaseDirectory+__T("\\Events\\New")); if (!Dir::Exists(UserHandle->DataBaseDirectory+__T("\\Events\\New\\")+Ztring::ToZtring(UserHandle->Scenario))) Dir::Create(UserHandle->DataBaseDirectory+__T("\\Events\\New\\")+Ztring::ToZtring(UserHandle->Scenario)); if (!Dir::Exists(UserHandle->DataBaseDirectory+__T("\\Events\\New\\")+Ztring::ToZtring(UserHandle->Scenario)+__T("\\")+Number)) Dir::Create(UserHandle->DataBaseDirectory+__T("\\Events\\New\\")+Ztring::ToZtring(UserHandle->Scenario)+__T("\\")+Number); if (!Dir::Exists(FileName(Name).Path_Get())) Dir::Create(FileName(Name).Path_Get()); UserHandle->PerEvent[Event_Generic->EventCode].F=fopen(Name.To_Local().c_str(), "w"); } /*Retrieving EventID*/ ParserID =(unsigned char) ((Event_Generic->EventCode&0xFF000000)>>24); EventID =(unsigned short)((Event_Generic->EventCode&0x00FFFF00)>>8 ); EventVersion=(unsigned char) ( Event_Generic->EventCode&0x000000FF ); //*Global to all parsers switch (EventID) { CASE (Global, Demux, 4) CASE (Video, SliceInfo, 0) default : ; } switch (ParserID) { case MediaInfo_Parser_None : switch (EventID) { case MediaInfo_Event_General_Start : if (EventVersion==0 && Data_Size==sizeof(struct MediaInfo_Event_General_Start_0)) General_Start_0((struct MediaInfo_Event_General_Start_0*)Data_Content, UserHandle); break; case MediaInfo_Event_General_End : if (EventVersion==0 && Data_Size==sizeof(struct MediaInfo_Event_General_End_0)) General_End_0((struct MediaInfo_Event_General_End_0*)Data_Content, UserHandle); break; case MediaInfo_Event_General_Parser_Selected : if (EventVersion==0 && Data_Size==sizeof(struct MediaInfo_Event_General_Parser_Selected_0)) General_Parser_Selected_0((struct MediaInfo_Event_General_Parser_Selected_0*)Data_Content, UserHandle); break; case MediaInfo_Event_General_Move_Request : if (EventVersion==0 && Data_Size==sizeof(struct MediaInfo_Event_General_Move_Request_0)) General_Move_Request_0((struct MediaInfo_Event_General_Move_Request_0*)Data_Content, UserHandle); break; case MediaInfo_Event_General_Move_Done : if (EventVersion==0 && Data_Size==sizeof(struct MediaInfo_Event_General_Move_Done_0)) General_Move_Done_0((struct MediaInfo_Event_General_Move_Done_0*)Data_Content, UserHandle); break; case MediaInfo_Event_General_SubFile_Start : if (EventVersion==0 && Data_Size==sizeof(struct MediaInfo_Event_General_SubFile_Start_0)) General_SubFile_Start_0((struct MediaInfo_Event_General_SubFile_Start_0*)Data_Content, UserHandle); break; case MediaInfo_Event_General_SubFile_End : if (EventVersion==0 && Data_Size==sizeof(struct MediaInfo_Event_General_SubFile_End_0)) General_SubFile_End_0((struct MediaInfo_Event_General_SubFile_End_0*)Data_Content, UserHandle); break; default : ; } break; default : ; //ParserID is unknown } } void RegressionTest_Events(Ztring Files, Ztring DataBaseDirectory, int32u Scenario) { // Scenarios: // bit 0 : quick parsing / full parsing // bit 1 : next packet interface // bit 2 : demux (by container only) // bit 3 : do some seeks cout<<" Analyzing"< FilesList; for (size_t FilesList_Source_Pos=0; FilesList_Source_Pos100000000) Size=100000000; int8u* F_Ref_Buffer=new int8u[(size_t)Size]; F_Ref.Read(F_Ref_Buffer, (size_t)Size); int8u* F_New_Buffer=new int8u[(size_t)Size]; F_New.Read(F_New_Buffer, (size_t)Size); if (memcmp(F_Ref_Buffer, F_New_Buffer, (size_t)Size)) IsDiff=true; delete[] F_Ref_Buffer; delete[] F_New_Buffer; } else IsDiff=true; } if (New_RefPos==(size_t)-1 || IsDiff) { //Not in new or is different Ztring Diff_Name=Ref[Ref_Pos]; Diff_Name.FindAndReplace(__T("\\Events\\Ref\\"), __T("\\Events\\Diff\\")); if (!Dir::Exists(DataBaseDirectory+__T("\\Events\\Diff"))) Dir::Create(DataBaseDirectory+__T("\\Events\\Diff")); if (!Dir::Exists(DataBaseDirectory+__T("\\Events\\Diff\\")+FileName(Files).Name_Get())) Dir::Create(DataBaseDirectory+__T("\\Events\\Diff\\")+FileName(Files).Name_Get()); if (!Dir::Exists(DataBaseDirectory+__T("\\Events\\Diff\\")+FileName(Files).Name_Get()+__T("\\")+Ztring::ToZtring(Scenario))) Dir::Create(DataBaseDirectory+__T("\\Events\\Diff\\")+FileName(Files).Name_Get()+__T("\\")+Ztring::ToZtring(Scenario)); if (!Dir::Exists(FileName(Diff_Name).Path_Get())) Dir::Create(FileName(Diff_Name).Path_Get()); if (!IsDiff) File::Copy(Ref[Ref_Pos], Diff_Name+__T(".RefAlone.txt")); //Not in new else { File::Copy(Ref[Ref_Pos], Diff_Name+__T(".Ref.txt")); //Diff File::Copy(New[New_RefPos], Diff_Name+__T(".New.txt")); } } if (New_RefPos!=(size_t)-1) New.erase(New.begin()+New_RefPos); } for (size_t New_Pos=0; New_Pos #include #include "tchar.h" #include "MediaInfoDLL/MediaInfoDLL.h" #include "ZenLib/ZtringListListF.h" #include "ZenLib/File.h" #include "ZenLib/Dir.h" extern "C" { #include "md5.h" } #include "RegressionTest/RegressionTest.h" using namespace MediaInfoDLL; using namespace ZenLib; using namespace std; void WriteMd5Info(const Ztring &FileName, MediaInfo &MI, const Ztring &DataBaseDirectory) { int8u* Buffer=new int8u[0x1000000]; File F; String MD5_FromMI=MI.Get(Stream_General, 0, __T("MD5")); String Format=MI.Get(Stream_General, 0, __T("Format")); Ztring MD5_FromFile; if (!MD5_FromMI.empty()) { F.Open(FileName); MD5Context Context; MD5Init(&Context); size_t Size; do { Size=F.Read(Buffer, 0x1000000); MD5Update(&Context, Buffer, Size); } while (Size==0x1000000); unsigned char Digest[16]; MD5Final(Digest, &Context); MD5_FromFile+=Ztring().From_CC2(BigEndian2int16u(Digest+ 0)); MD5_FromFile+=Ztring().From_CC2(BigEndian2int16u(Digest+ 2)); MD5_FromFile+=Ztring().From_CC2(BigEndian2int16u(Digest+ 4)); MD5_FromFile+=Ztring().From_CC2(BigEndian2int16u(Digest+ 6)); MD5_FromFile+=Ztring().From_CC2(BigEndian2int16u(Digest+ 8)); MD5_FromFile+=Ztring().From_CC2(BigEndian2int16u(Digest+10)); MD5_FromFile+=Ztring().From_CC2(BigEndian2int16u(Digest+12)); MD5_FromFile+=Ztring().From_CC2(BigEndian2int16u(Digest+14)); MD5_FromFile.MakeLowerCase(); } bool EmptyNormal=false; if (MD5_FromMI.empty() && Format==__T("MXF") && MI.Get(Stream_General, 0, __T("Format_Settings")).find(__T("Open / "))!=string::npos) { Format+=__T(" ")+MI.Get(Stream_General, 0, __T("Format_Settings")); EmptyNormal=true; } if (MD5_FromMI.empty() && Format.empty()) { EmptyNormal=true; } if (MD5_FromMI.empty() || EmptyNormal) { F.Open(DataBaseDirectory+(EmptyNormal?__T("\\MD5.EmptyNormal.csv"):__T("\\MD5.________________Missing.csv")), File::Access_Write_Append); F.Write(FileName+__T(";")+MI.Get(Stream_General, 0, __T("Format"))+EOL); } else if (MD5_FromMI==MD5_FromFile) { F.Open(DataBaseDirectory+__T("\\MD5.Success.csv"), File::Access_Write_Append); F.Write(FileName+__T(";")+Format+__T(";")+MD5_FromMI+EOL); } else { F.Open(DataBaseDirectory+__T("\\MD5.________________Fail.csv"), File::Access_Write_Append); F.Write(FileName+__T(";")+MI.Get(Stream_General, 0, __T("Format"))+__T(";")+MD5_FromMI+__T(";")+MD5_FromFile+EOL); } delete[] Buffer; } void RegressionTest_Md5(Ztring Files, Ztring DataBaseDirectory, int32u Scenario) { cout<<" Analyzing"<Percentage) { cout<<" "<5.3.0, <5.9.0; 1438;>5.3.0, <5.9.0; 1453;5.9.0 Fusion (InertialConfinement);UTC 2005-01 1461;5.9.0 Fusion (HiggsBoson);UTC 2005-01 1528;5.9.0 Fusion (HiggsBoson);UTC 2005-03-05 1571;6.0.0;UTC 2005-06-15 1594;6.0.0 (DivX Converter1.0);UTC 2005-06 1599;6.0.0 Helium;UTC 2005-06 1612;6.0.0 Helium (GodFatherOfSoul);UTC 2005-06-15 1697;6.0.3 Fusion (ThermonuclearFusion);UTC 2005-10-18 1737;He-3 (TwinTurbocharger);UTC 2005-12 1786;6.1.0;UTC 2005-12-12 1828;6.1.1;UTC 2006-02-01 1893;6.2.0 Beta1;UTC 2006-03-25 1910;6.2.0;UTC 2006-04-11 1913;6.2.1;UTC 2006-04 1915;6.2.1 Patch1Beta;UTC 2006-04 1920;6.2.2;UTC 2006-04-26 1977;6.2.5;UTC 2006-06-16 1988;6.2.5;UTC 2006-07 2075;>6.2.5, <6.4.0; 2081;6.4.0 Beta1;UTC 2006-09-27 2086;6.4.0;UTC 2006-10-03 2201;6.5.0;UTC 2006-12 2207;6.5.1;UTC 2007-03 2292;6.6.0;UTC 2007-05-04 2306;6.6.1; 2309;6.6.1; 2318;6.6.1.4; 2396;6.7 Beta;UTC 2007-08-26 2432;6.7.0;UTC 2007-09-20 2510;6.8.0;UTC 2007-12-04 2521;6.8.0 Converter 6.6; 2559;6.8.2;UTC 2008-05-17 2676;6.8.3-6.8.4;UTC 2008-06-07 2816;6.8.5;UTC 2009-08-20 2851;6.8.5;UTC 2009-08-20 MediaInfoLib/Source/Resource/Text/DataBase/Library_MainConcept_Avc.csv100777 0 0 42 12226004261 21217 02.0.1889;2.0.1889;UTC 2006-01-11 MediaInfoLib/Source/Resource/Text/DataBase/Library_VorbisCom.csv100777 0 0 4144 12226004261 20200 0Main source;http://wiki.hydrogenaudio.org/index.php?title=Recommended_Ogg_Vorbis; Xiphophorus libVorbis I 20000508;1.0 Beta 1/2;UTC 2000-05-08 Xiphophorus libVorbis I 20001031;1.0 Beta 3;UTC 2000-10-31 Xiphophorus libVorbis I 20010225;1.0 Beta 4;UTC 2001-02-25 Xiphophorus libVorbis I 20010615;1.0 RC1;UTC 2000-16-15 Xiphophorus libVorbis I 20010813;1.0 RC2;UTC 2000-18-13 Xiphophorus libVorbis I 20010816 (gtune 1);1.0 RC2 (GTune 1);UTC 2001-08-16 Xiphophorus libVorbis I 20011014 (GTune 2);1.0 RC2 (GTune 2);UTC 2001-10-14 Xiphophorus libVorbis I 20011217;1.0 RC3;UTC 2001-12-17 Xiphophorus libVorbis I 20011231;1.0 RC3;UTC 2001-12-31 Xiph.Org libVorbis I 20020717;1.0;UTC 2002-07-17 Xiph.Org/Sjeng.Org libVorbis I 20020717 (GTune 3, beta 1);1.0 (GTune 3 Beta 1);UTC 2002-07-17 Xiph.Org libVorbis I 20030308;1.0.1 (CVS);UTC 2003-03-08 Xiph.Org libVorbis I 20030909;1.0.1;UTC 2003-09-09 Xiph.Org/Sjeng.Org libVorbis I 20030909 (GTune 3, beta 2) EXPERIMENTAL;1.0 (GTune 3 Beta 2);UTC 2003-09-09 Xiph.Org libVorbis I 20031230 (1.0.1);1.0.1 (CVS);UTC 2003-12-30 Xiph.Org/Sjeng.Org libVorbis I 20031230 (GTune 3, beta 2);1.0.1 (GTune 3 Beta 2);UTC 2003-12-30 AO aoTuV b2 [20040420] (based on Xiph.Org's 1.0.1);Beta 2;UTC 2004-04-20 Xiph.Org libVorbis I 20040629;1.1;UTC 2004-06-29 Xiph.Org libVorbis I 20040920;1.1 (with impulse_trigger_profile);UTC 2004-09-20 AO aoTuV b3 [20041120] (based on Xiph.Org's libVorbis);Beta 3;UTC 2004-11-20 Xiph.Org libVorbis I 20050304;1.1.1/1.1.2;UTC 2005-03-04 AO aoTuV b4 [20050617] (based on Xiph.Org's libVorbis);Beta 4;UTC 2005-06-17 BS Lancer [20050709] (based on aoTuV b4 [20050617]);(aoTuV Beta 4);UTC 2005-07-09 AO aoTuV b4a [20051105] (based on Xiph.Org's libVorbis);Beta 4.5;UTC 2005-11-05 AO aoTuV b4b [20051117] (based on Xiph.Org's libVorbis);Beta 4.51;UTC 2005-11-17 BS Lancer [20051121] (based on aoTuV b4b [20051117]);(aoTuV Beta 4.51);UTC 2005-11-21 AO aoTuV pre-beta5 [20060321] (based on Xiph.Org's libVorbis);Beta 5 (preBeta);UTC 2006-03-21 AO aoTuV b5 [20061024] (based on Xiph.Org's libVorbis);Beta 5;UTC 2006-10-24 Xiph.Org libVorbis I 20070622;1.2;UTC 2007-06-22 MediaInfoLib/Source/Resource/Text/DataBase/Library_XviD.csv100777 0 0 2725 12226004261 17152 0Main source;http://xmm.sourceforge.net/DivX5-6_Xvid_Bitstream_version.php; 1;0.0.01;UTC 2002-10-17 2;0.0.02;UTC 2002-10-30 3;0.0.03;UTC 2002-12-09 4;0.0.04;UTC 2003-01 5;0.0.05;UTC 2003-01-11 6;0.0.06;UTC 2003-01-12 7;0.0.07;UTC 2003-01-13 8;0.0.08;UTC 2003-01-14 9;0.0.09;UTC 2003-03-25 10;0.0.10;UTC 2003-06-09 11;0.0.11;UTC 2003-06-09 12;0.0.12;UTC 2003-06-11 13;0.0.13;UTC 2003-06-11 14;0.0.14;UTC 2003-06-28 15;0.0.15;UTC 2003-07-28 16;0.0.16;UTC 2003-07-28 17;0.0.17;UTC 2003-08-06 18;0.0.18;UTC 2003-09-04 19;0.0.19;UTC 2003-09-28 20;0.0.20;UTC 2003-10-09 21;1.0.0 Beta1 (Aloha);UTC 2003-11-29 22;1.0.0 Beta1.5;UTC 2003-12-03 23;1.0.0 Beta2 (Ciao);UTC 2003-12-06 24;1.0.0 Beta2.5;UTC 2003-12-18 25;1.0.0 Beta3 (Selam);UTC 2003-12-27 26;1.0.0 RC1 (Niltze);UTC 2004-01-26 27;1.0.0 RC1b;UTC 2004-01-30 28;1.0.0 RC2 (Jambo);UTC 2004-02-01 29;1.0.0 RC3 (Nihao);UTC 2004-03-22 30;1.0.0 RC4 (Hola);UTC 2004-04-05 31;1.0.0 RC4b;UTC 2004-04-15 32;1.0.0 RC4c;UTC 2004-05-02 33;1.0.0 RC4d;UTC 2004-05-03 34;1.0.0;UTC 2004-05-09 35;1.0.1;UTC 2004-06-05 36;1.0.2;UTC 2004-08-29 37;1.0.3;UTC 2004-12-20 38;1.1.0 Beta1;UTC 2005-01-16 39;1.1.0 Beta2;UTC 2005-04-04 40;1.1.0 RC;UTC 2005-11-22 41;1.1.0;UTC 2005-11-22 42;1.2.0.dev42;UTC 2005-12 43;1.2.0SMP;UTC 2006-01-08 44;1.1.1;UTC 2006-07-10 45;1.2.0.dev45;UTC 2006-07-10 46;1.1.2;UTC 2006-11-01 47;1.2.0.dev47;UTC 2006-11-01 48;1.2.0.dev48; 49;1.2.0.dev49; 50;1.2.1;UTC 2008-12-04 55;1.3.0.dev55; MediaInfoLib/Source/Resource/Text/Enums_.1.txt100777 0 0 1406 12226004261 14554 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Automaticly generated methods for MediaInfo // Don't modify, this will be deleted at the next automatic update // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #ifndef MediaInfo_File__Analyze_AutomaticH #define MediaInfo_File__Analyze_AutomaticH //--------------------------------------------------------------------------- namespace MediaInfoLib { MediaInfoLib/Source/Resource/Text/Enums_.2.txt100777 0 0 141 12226004261 14530 0 //--------------------------------------------------------------------------- enum %Name% { MediaInfoLib/Source/Resource/Text/Enums_.5.txt100777 0 0 24 12226004261 14513 0 %Name%_%Line%, MediaInfoLib/Source/Resource/Text/Enums_.8.txt100777 0 0 4 12226004261 14474 0}; MediaInfoLib/Source/Resource/Text/Enums_.9.txt100777 0 0 31 12226004261 14515 0 } //NameSpace #endif MediaInfoLib/Source/Resource/Text/Language/ 40777 0 0 0 12253120565 14056 5MediaInfoLib/Source/Resource/Text/Language/DefaultLanguage.csv100777 0 0 65672 12253120546 17762 0 Language_ISO639;en Author_Email;Info@MediaArea.net Author_Name;Zen Author_OldNames;Initial translator Language_Name;English Config_Text_ColumnSize;40 Config_Text_Separator; : Config_Text_NumberTag; # Config_Text_FloatSeparator;. Config_Text_ThousandsSeparator; audio stream1; audio stream audio stream2; audio streams audio stream3; audio streams bit1; bit bit2; bits bit3; bits bps; bps Bps; Bps Byte1; Byte Byte2; Bytes Byte3; Bytes channel1; channel channel2; channels channel3; channels chapter1; chapter chapter2; chapters chapter3; chapters chapters stream1; chapters stream chapters stream2; chapters streams chapters stream3; chapters streams day1; day day2; days day3; days dB1; dB dB2; dB dB3; dB file1; file file2; files file3; files frame1; frame frame2; frames frame3; frames fps1; fps fps2; fps fps3; fps GB; GB Gb; Gb Gbps; Gbps GBps; GBps GHz; GHz GiB; GiB GibiByte1; GibiBytes GibiByte2; GibiBytes GibiByte3; GibiBytes GiBps; GiBps GigaBit1; GigaBit GigaBit2; GigaBits GigaBit3; GigaBits GigaByte1; GigaByte GigaByte2; GigaBytes GigaByte3; GigaBytes hour1; hour hour2; hours hour3; hours Hz; Hz image stream1; image stream image stream2; image streams image stream3; image streams KB; KB Kb; Kb KBps; KBps Kbps; Kbps KHz; KHz KiB; KiB KibiBit1; KibiBit KibiBit2; KibiBits KibiBit3; KibiBits KibiByte1; KibiByte KibiByte2; KibiBytes KibiByte3; KibiBytes KiBps; KiBps KiloBit1; KiloBit KiloBit2; KiloBits KiloBit3; KiloBits KiloByte1; KiloByte KiloByte2; KiloBytes KiloByte3; KiloBytes MB; MB Mb; Mb Mbps; Mbps MBps; MebiBytes MebiBit1; MebiBit MebiBit2; MebiBits MebiBit3; MebiBits MebiByte1; MebiByte MebiByte2; MebiBytes MebiByte3; MebiBytes MegaBit1; MegaBit MegaBit2; MegaBits MegaBit3; MegaBits MegaByte1; MegaByte MegaByte2; MegaBytes MegaByte3; MegaBytes MHz; MHz MiB; MiB Mib; Mib MiBps; MiBps millisecond1; millisecond millisecond2; milliseconds millisecond3; milliseconds minute1; minute minute2; minutes minute3; minutes month1; month month2; months month3; months pixel1; pixel pixel2; pixels pixel3; pixels second1; second second2; seconds second3; seconds text stream1; text stream text stream2; text streams text stream3; text streams video frames1; video frame video frames2; video frames video frames3; video frames video stream1; video stream video stream2; video streams video stream3; video streams warppoint0;No warppoints warppoint1; warppoint warppoint2; warppoints warppoint3; warppoints week1; week week2; weeks week3; weeks year1; year year2; years year3; years , ;, : ;: About;About About_Hint;How to contact me and find last version Accompaniment;Accompaniment ActiveFormatDescription;Active Format Description ActiveFormatDescription_MuxingMode;Active Format Description, Muxing mode Actor;Actor Actor_Character;Character played Added_Date;Added date Address;Address Advanced;Advanced Advanced mode;Advanced mode Album;Album Album_ReplayGain_Gain;Album replay gain Album_ReplayGain_Peak;Album replay gain peak Alignment;Alignment Alignment_Aligned;Aligned on interleaves Alignment_Split;Split accross interleaves All;All Archival_Location;Archival location Arranger;Arranger ArtDirector;ArtDirector AspectRatio;Aspect ratio AssistantDirector;AssistantDirector at;at At least one file;(You must at least open one file) Audio;Audio Audio stream(s);Audio streams Audio_Codec_List;Audio codecs Audio_No;No audio Audio1;First audio stream Audio2;Second audio stream AudioCount;Count of audio streams Author;Author BarCode;BarCode Basic;Basic Basic_Note;Note : for more information about this file, you must select a different view (Sheet, Tree...) BitDepth;Bit depth BitRate;Bit rate BitRate_Maximum;Maximum bit rate BitRate_Minimum;Minimum bit rate BitRate_Mode;Bit rate mode BitRate_Mode_CBR;Constant BitRate_Mode_VBR;Variable BitRate_Nominal;Nominal bit rate BitRate_Encoded;Encoded bit rate Bits-(Pixel*Frame);Bits/(Pixel*Frame) BufferSize;Buffer size Cancel;Cancel Channel(s);Channel(s) ChannelPositions;Channel positions Chapter(s);Chapter(s) Chapters;Chapters Chapters stream(s);Chapters stream(s) Chapters_Codec_List;Chapters Codecs Chapters_No;No chapters ChaptersCount;Count of chapter streams CheckNewVersion;Check for new version Choose custom;Choose custom Choose custom sheet;Choose your desired custom sheet Choose custom text;Choose your desired custom text Choose export format;Choose your desired export format Choose file(s);Choose the files to open Choose filename;Choose your desired filename Choose language;Choose your desired language Choregrapher;Choregrapher Chroma;Chroma ChromaSubsampling;Chroma subsampling Close;Close Close all before open;Close all before open Codec;Codec Codec_Description;Codec description Codec_Info;Details for codec Codec_Settings;Codec settings Codec_Settings_PacketBitStream;Codec settings, Packet bitstream Codec_Settings_BVOP;Codec settings, BVOP Codec_Settings_QPel;Codec settings, QPel Codec_Settings_GMC;Codec settings, GMC Codec_Settings_Matrix;Codec settings, Matrix Codec_Settings_Floor;Codec settings, Floor Codec_Settings_CABAC;Codec settings, CABAC Codec_Settings_Firm;Codec settings, Firm Codec_Settings_Endianness;Codec settings, Endianness Codec_Settings_Sign;Codec settings, Sign Codec_Settings_Law;Codec settings, Law Codec_Settings_ITU;Codec settings, ITU Codec_Profile;Codec profile Codec_Url;Weblink for codec CodecID;Codec ID CodecID_Description;Description of the codec Collection;Collection Colorimetry;Colorimetry ColorSpace;Color space colour_primaries;Color primaries Comment;Comment CommissionedBy;Commissioned by Compilation;Compilation CompleteName;Complete name Composer;Composer Compression_Mode;Compression mode Compression_Mode_Lossless;Lossless Compression_Mode_Lossy;Lossy Compression_Ratio;Compression ratio Conductor;Conductor Container and general information;Container and general information ContentType;ContentType CoProducer;Coproducer Copyright;Copyright CostumeDesigner;Costume designer Count;Count Country;Country Cover;Cover Cover_Datas;Cover datas Cover_Description;Cover description Cover_Mime;Cover MIME Cover_Type;Cover type Cropped;Crop dimensions Custom;Custom Customize;Customize Date;Date Debug;Debug Decimal point;Decimal point Delay;Delay Delay_Source;Delay, origin Delay_Source_Container;Container Delay_Source_Stream;Raw stream Delete;Delete Description;Description Digitized_Date;Digitized date Dimensions;Dimensions Director;Director DirectorOfPhotography;Director of photography DisplayAspectRatio;Display aspect ratio DisplayAspectRatio_Original;Original display aspect ratio DistributedBy;Distributed by Donate;Donate DotsPerInch;Dots per inch Duration;Duration Duration_End;End time Duration_Start;Start time Edit;Edit EditedBy;Edited by EMail;E-Mail Encoded_Application;Writing application Encoded_Date;Encoded date Encoded_Library;Writing library Encoded_Library_Settings;Encoding settings Encoded_Original;Original support EncodedBy;Encoded by EPG_Positions;EPG positions (internal) Error_File;Error while reading file ExecutiveProducer;Executive producer Exit;Exit Exit_Hint;Quit the program Export;Export Export_Hint;Export in a customized format Extensions;Extensions usually used Family;Family Fax;Fax File;File File size;File size File_Append;Append to the existing file (Warning : be careful to have the same parameters) File_Created_Date;File creation date File_Created_Date_Local;File creation date (local) File_Hint;Select a multimedia file to examine File_Modified_Date;File last modification date File_Modified_Date_Local;File last modification date (local) FileExtension;File extension FileName;File name FileSize;File size Folder;Folder Folder (R);Folder (R) Folder (R)_Hint;Select a folder to examine (with all folders recursively) Folder (Recursively);Folder (Recursively) Folder_Hint;Select a folder to examine FolderName;Folder name Format;Format Format_Commercial;Commercial name Format_Commercial_IfAny;Commercial name Format_Description;Format description Format_Info;Details for format Format_Profile;Format profile Format_Settings;Format settings Format_Settings_PacketBitStream;Format settings, Packet bitstream Format_Settings_BVOP;Format settings, BVOP Format_Settings_QPel;Format settings, QPel Format_Settings_GMC;Format settings, GMC Format_Settings_Matrix;Format settings, Matrix Format_Settings_Matrix_Custom;Custom Format_Settings_Matrix_Default;Default Format_Settings_Floor;Format settings, Floor Format_Settings_CABAC;Format settings, CABAC Format_Settings_Firm;Format settings, Firm Format_Settings_Endianness;Format settings, Endianness Format_Settings_RefFrames;Format settings, ReFrames Format_Settings_Sign;Format settings, Sign Format_Settings_Law;Format settings, Law Format_Settings_ITU;Format settings, ITU Format_Settings_SBR;Format settings, SBR Format_Settings_PS;Format settings, PS Format_Settings_Pulldown;Format settings, Pulldown Format_Settings_Mode;Mode Format_Settings_FrameMode;Frame mode Format_Settings_Emphasis;Emphasis Format_Settings_ModeExtension;Mode extension Format_Settings_GOP;Format settings, GOP Format_Version;Format version Format_Url;Weblink for format FrameCount;Frame count FrameRate;Frame rate FrameRate_Mode;Frame rate mode FrameRate_Mode_CFR;Constant FrameRate_Mode_VFR;Variable FrameRate_Minimum;Minimum frame rate FrameRate_Nominal;Nominal frame rate FrameRate_Maximum;Maximum frame rate FrameRate_Original;Original frame rate General;General Genre;Genre Genre_000;Blues Genre_001;Classic Rock Genre_002;Country Genre_003;Dance Genre_004;Disco Genre_005;Funk Genre_006;Grunge Genre_007;Hip-Hop Genre_008;Jazz Genre_009;Metal Genre_010;New Age Genre_011;Oldies Genre_012;Other Genre_013;Pop Genre_014;R&B Genre_015;Rap Genre_016;Reggae Genre_017;Rock Genre_018;Techno Genre_019;Industrial Genre_020;Alternative Genre_021;Ska Genre_022;Death Metal Genre_023;Pranks Genre_024;Soundtrack Genre_025;Euro-Techno Genre_026;Ambient Genre_027;Trip-Hop Genre_028;Vocal Genre_029;Jazz+Funk Genre_030;Fusion Genre_031;Trance Genre_032;Classical Genre_033;Instrumental Genre_034;Acid Genre_035;House Genre_036;Game Genre_037;Sound Clip Genre_038;Gospel Genre_039;Noise Genre_040;Alt. Rock Genre_041;Bass Genre_042;Soul Genre_043;Punk Genre_044;Space Genre_045;Meditative Genre_046;Instrumental Pop Genre_047;Instrumental Rock Genre_048;Ethnic Genre_049;Gothic Genre_050;Darkwave Genre_051;Techno-Industrial Genre_052;Electronic Genre_053;Pop-Folk Genre_054;Eurodance Genre_055;Dream Genre_056;Southern Rock Genre_057;Comedy Genre_058;Cult Genre_059;Gangsta Rap Genre_060;Top 40 Genre_061;Christian Rap Genre_062;Pop/Funk Genre_063;Jungle Genre_064;Native American Genre_065;Cabaret Genre_066;New Wave Genre_067;Psychedelic Genre_068;Rave Genre_069;Showtunes Genre_070;Trailer Genre_071;Lo-Fi Genre_072;Tribal Genre_073;Acid Punk Genre_074;Acid Jazz Genre_075;Polka Genre_076;Retro Genre_077;Musical Genre_078;Rock & Roll Genre_079;Hard Rock Genre_080;Folk Genre_081;Folk-Rock Genre_082;National Folk Genre_083;Swing Genre_084;Fast-Fusion Genre_085;Bebop Genre_086;Latin Genre_087;Revival Genre_088;Celtic Genre_089;Bluegrass Genre_090;Avantgarde Genre_091;Gothic Rock Genre_092;Progressive Rock Genre_093;Psychedelic Rock Genre_094;Symphonic Rock Genre_095;Slow Rock Genre_096;Big Band Genre_097;Chorus Genre_098;Easy Listening Genre_099;Acoustic Genre_100;Humour Genre_101;Speech Genre_102;Chanson Genre_103;Opera Genre_104;Chamber Music Genre_105;Sonata Genre_106;Symphony Genre_107;Booty Bass Genre_108;Primus Genre_109;Porn Groove Genre_110;Satire Genre_111;Slow Jam Genre_112;Club Genre_113;Tango Genre_114;Samba Genre_115;Folklore Genre_116;Ballad Genre_117;Power Ballad Genre_118;Rhythmic Soul Genre_119;Freestyle Genre_120;Duet Genre_121;Punk Rock Genre_122;Drum Solo Genre_123;A Cappella Genre_124;Euro-House Genre_125;Dance Hall Genre_126;Goa Genre_127;Drum & Bass Genre_128;Club-House Genre_129;Hardcore Genre_130;Terror Genre_131;Indie Genre_132;BritPop Genre_133;Afro-Punk Genre_134;Polsk Punk Genre_135;Beat Genre_136;Christian Gangsta Rap Genre_137;Heavy Metal Genre_138;Black Metal Genre_139;Crossover Genre_140;Contemporary Christian Genre_141;Christian Rock Genre_142;Merengue Genre_143;Salsa Genre_144;Thrash Metal Genre_145;Anime Genre_146;JPop Genre_147;Synthpop Genre_148;Abstract Genre_149;Art Rock Genre_150;Baroque Genre_151;Bhangra Genre_152;Big Beat Genre_153;Breakbeat Genre_154;Chillout Genre_155;Downtempo Genre_156;Dub Genre_157;EBM Genre_158;Eclectic Genre_159;Electro Genre_160;Electroclash Genre_161;Emo Genre_162;Experimental Genre_163;Garage Genre_164;Global Genre_165;IDM Genre_166;Illbient Genre_167;Industro-Goth Genre_168;Jam Band Genre_169;Krautrock Genre_170;Leftfield Genre_171;Lounge Genre_172;Math Rock Genre_173;New Romantic Genre_174;Nu-Breakz Genre_175;Post-Punk Genre_176;Post-Rock Genre_177;Psytrance Genre_178;Shoegaze Genre_179;Space Rock Genre_180;Trop Rock Genre_181;World Music Genre_182;Neoclassical Genre_183;Audiobook Genre_184;Audio Theatre Genre_185;Neue Deutsche Welle Genre_186;Podcast Genre_187;Indie Rock Genre_188;G-Funk Genre_189;Dubstep Genre_190;Garage Rock Genre_191;Psybient Go to WebSite;Go to website Grouping;Grouping h;h Header file;Create a header file Height;Height Height_Original;Original height Help;Help Hint;Hint How many audio streams?;How many audio streams? How many chapters streams?;How many chapters streams? How many text streams?;How many text streams? How many video streams?;How many video streams? HTML;HTML ID;ID Image;Image Image stream(s);Image streams Image_Codec_List;Codecs Image ImageCount;Count of image streams Info;Info Instruments;Instruments Interlacement;Interlacement Interlaced_Interlaced;Interlaced Interlaced_TFF;Top Field First Interlaced_BFF;Bottom Field First Interlaced_PPF;Progressive Interlaced_Progressive;Progressive Interleaved;Interleaved Interleave_Duration;Interleave, duration Interleave_Preload;Interleave, preload duration Interleave_VideoFrames;Interleave, duration InternetMediaType;Internet media type IRCA;IRCA ISBN;ISBN ISRC;ISRC Keywords;Keywords Known codecs;Known codecs Known formats;Known formats Known parameters;Known parameters Label;Label Language;Language Language_More;Language, more info Language_aa;Afar Language_ab;Abkhazian Language_ae;Avestan Language_af;Afrikaans Language_ak;Akan Language_am;Amharic Language_an;Aragonese Language_ar;Arabic Language_as;Assamese Language_av;Avaric Language_ay;Aymara Language_az;Azerbaijani Language_ba;Bashkir Language_be;Belarusian Language_bg;Bulgarian Language_bh;Bihari Language_bi;Bislama Language_bm;Bambara Language_bn;Bengali Language_bo;Tibetan Language_br;Breton Language_bs;Bosnian Language_ca;Catalan Language_ce;Chechen Language_ch;Chamorro Language_co;Corsican Language_cr;Cree Language_cs;Czech Language_cu;Slave Language_cv;Chuvash Language_cy;Welsh Language_da;Danish Language_de;German Language_dv;Divehi Language_dz;Dzongkha Language_ee;Ewe Language_el;Greek Language_en;English Language_en-gb;English (Great Britain) Language_en-us;English (United States) Language_eo;Esperanto Language_es;Spanish Language_et;Estonian Language_eu;Basque Language_fa;Persian Language_ff;Fulah Language_fi;Finnish Language_fj;Fijian Language_fo;Faroese Language_fr;French Language_fy;Frisian Language_ga;Irish Language_gd;Gaelic Language_gl;Galician Language_gn;Guarani Language_gu;Gujarati Language_gv;Manx Language_ha;Hausa Language_he;Hebrew Language_hi;Hindi Language_ho;Hiri Motu Language_hr;Croatian Language_ht;Haitian Language_hu;Hungarian Language_hy;Armenian Language_hz;Herero Language_ia;Auxiliary Language Association Language_id;Indonesian Language_ie;Interlingue Language_ig;Igbo Language_ii;Sichuan Yi Language_ik;Inupiaq Language_Info;Language info Language_io;Ido Language_is;Icelandic Language_it;Italian Language_iu;Inuktitut Language_ja;Japanese Language_jv;Javanese Language_ka;Georgian Language_kg;Kongo Language_ki;Kikuyu Language_kj;Kuanyama Language_kk;Kazakh Language_kl;Kalaallisut Language_km;Khmer Language_kn;Kannada Language_ko;Korean Language_kr;Kanuri Language_ks;Kashmiri Language_ku;Kurdish Language_kv;Komi Language_kw;Cornish Language_ky;Kirghiz Language_la;Latin Language_lb;Luxembourgish Language_lg;Ganda Language_li;Limburgish Language_ln;Lingala Language_lo;Lao Language_lt;Lithuanian Language_lu;Luba-Katanga Language_lv;Latvian Language_mg;Malagasy Language_mh;Marshallese Language_mi;Maori Language_mk;Macedonian Language_ml;Malayalam Language_mn;Mongolian Language_mo;Moldavian Language_mr;Marathi Language_ms;Malay Language_mt;Maltese Language_mul;Multiple languages Language_my;Burmese Language_na;Nauru Language_nb;Norwegian Bokmal Language_nd;Ndebele Language_ne;Nepali Language_ng;Ndonga Language_nl;Dutch Language_nn;Norwegian Nynorsk Language_no;Norwegian Language_nr;Ndebele Language_nv;Navaho Language_ny;Nyanja Language_oc;Occitan Language_oj;Ojibwa Language_om;Oromo Language_or;Oriya Language_os;Ossetic Language_pa;Panjabi Language_pi;Pali Language_pl;Polish Language_ps;Pushto Language_pt;Portuguese Language_pt-br;Portuguese (Brazil) Language_qu;Quechua Language_rm;Raeto-Romance Language_rn;Rundi Language_ro;Romanian Language_ru;Russian Language_rw;Kinyarwanda Language_sa;Sanskrit Language_sc;Sardinian Language_sd;Sindhi Language_se;Northern Sami Language_sg;Sango Language_si;Sinhala Language_sk;Slovak Language_sl;Slovenian Language_sm;Samoan Language_sn;Shona Language_so;Somali Language_sq;Albanian Language_sr;Serbian Language_ss;Swati Language_st;Sotho Language_su;Sundanese Language_sv;Swedish Language_sw;Swahili Language_ta;Tamil Language_te;Telugu Language_tg;Tajik Language_th;Thai Language_ti;Tigrinya Language_tk;Turkmen Language_tl;Tagalog Language_tn;Tswana Language_to;Tonga Language_tr;Turkish Language_ts;Tsonga Language_tt;Tatar Language_tw;Twi Language_ty;Tahitian Language_ug;Uighur Language_uk;Ukrainian Language_ur;Urdu Language_uz;Uzbek Language_ve;Venda Language_vi;Vietnamese Language_vo;Volapuk Language_wa;Walloon Language_wo;Wolof Language_xh;Xhosa Language_yi;Yiddish Language_yo;Yoruba Language_za;Zhuang Language_zh;Chinese Language_zh-cn;Chinese (China) Language_zh-tw;Chinese (Taiwan) Language_zu;Zulu LawRating;Law rating LCCN;LCCN Library;Muxing library Lightness;Lightness List;List Lyrics;Lyrics Lyricist;Lyricist Mastered_Date;Mastered date MasteredBy;Mastered by matrix_coefficients;Matrix coefficients MediaInfo_About;MediaInfo provides easy access to technical and tag information about video and audio files.\r\nExcept the Mac App Store graphical user interface, it is open-source software, which means that it is free of charge to the end user and developers have freedom to study, to improve and to redistribute the program (BSD license) Menu;Menu Menu stream(s);Menu streams Menu_Codec_List;Menu codecs Menu_No;No menu MenuCount;Count of menu streams Menu_Hint;More possibilities MenuID;Menu ID mn;mn Mood;Mood More;More Movie;Movie name ms;ms MSDI;MSDI MusicBy;Music by MuxingMode;Muxing mode MuxingMode_MoreInfo;Muxing mode, more info MuxingMode_PackedBitstream;Packed bitstream Name;Name Nationality;Nationality NetworkName;Network name New;New Newest version;Check for new versions (requires Internet connection) NewVersion_Menu;A new version is available NewVersion_Question_Title;A new version was released! NewVersion_Question_Content;A new version (v%Version%) is available, would you like to download it? No;No Not yet;Not yet NumColors;Number of colors OK;OK One output file per input file;One output file per input file Open;Open OpenCandy_01;Downloading ________ OpenCandy_02;__% Complete OpenCandy_03;Internet connection interrupted OpenCandy_04;________ download complete OpenCandy_05;Click to install ________ OpenCandy_06;Are you sure you wish to cancel the install?\r\nIf you wish to postpone the install until later, select 'No'.\r\nNote: You may select Exit from the menu to defer installation until after the next time you reboot. OpenCandy_07;Download of ________ has been paused.\r\nClick on the tray icon to resume downloading. OpenCandy_08;A critical error has occurred. Installation of _________ will be aborted. OpenCandy_09;Pause download OpenCandy_10;Cancel install OpenCandy_11;Resume download OpenCandy_12;Exit Installer OpenCandy_13;___________ - Recommended by ____________ OpenCandy_14;Downloading _________ OpenCandy_15;___________, the software recommended to you by ___________, is now downloading at your requestWe will let you know when it is ready to be installed. OpenCandy_16;___________ is ready for installation OpenCandy_17;___________ is now fully downloaded. Please click on 'Install' to proceed. OpenCandy_18;___________ of ___________ downloaded OpenCandy_19;Powered by OpenCandy OpenCandy_20;Learn more at OpenCandy.com OpenCandy_21;Install OpenCandy_22;Installation of ___________ OpenCandy_23;This will cancel the installation of ___________\r\nAre you sure you wish to exit? OpenCandy_24;Pause OpenCandy_25;Your download has been paused. Click 'Resume' when you are ready to continue. OpenCandy_26;Resume OpenCandy_27;Install Now OpenCandy_28;Pause Download OpenCandy_29;Resume Download OpenCandy_30;Cancel Install OpenCandy_31;Please choose an installation option OpenCandy_32;Install ___________ OpenCandy_33;Don't Install OpenCandy_34;Please select an install option OpenCandy_35;______ recommends this software OpenCandy_36;Your current installation will not be interrupted Options;Options Options_Hint;Preferences Original;Original OriginalNetworkName;Original network name OriginalSourceForm;Original source form OriginalSourceMedium;Original source medium Other;Other Output;Output Output format;Output format OverallBitRate;Overall bit rate OverallBitRate_Maximum;Maximum Overall bit rate OverallBitRate_Minimum;Minimum Overall bit rate OverallBitRate_Mode;Overall bit rate mode OverallBitRate_Nominal;Nominal Overall bit rate Part;Part Part_Count;Total count Performer;Performer Period;Period Phone;Phone PixelAspectRatio;Pixel aspect ratio PixelAspectRatio_Original;Original pixel aspect ratio PlayCounter;PlayCounter Played_Count;Times played Played_First_Date;First played Played_Last_Date;Last played PlayTime;PlayTime Position;Position Position_Total;Total Preferences;Preferences Producer;Producer ProductionDesigner;Production designer ProductionStudio;Production studio Publisher;Publisher Purchased_Date;purchased date Quote character;Quote character RadioStation;Radio station Rating;Rating Recorded_Date;Recorded date Recorded_Location;Recorded location Released_Date;Released date RemixedBy;Remixed by ReplayGain_Gain;Replay gain ReplayGain_Peak;Replay gain peak Resolution;Resolution s;s SamplingRate;Sampling rate Save;Save ScanType;Scan type ScanType_Original;Original scan type ScanOrder;Scan order ScanOrder_StoredDisplayedInverted;Scan order, stored/displayed order inverted ScanOrder_Original;Original scan order ScreenplayBy;Screenplay by Season;Season see below;see below Send HeaderFile;Please send me the Header file here : http://sourceforge.net/projects/mediainfo/ (Bug section) Separator_Columns;columns separator Separator_Lines;lines separator ServiceChannel;Service channel number ServiceName;Service name ServiceProvider;Service provider ServiceType;Service type Set;Set Set_Count;Set count Setup;Setup Sharpness;Sharpness Sheet;Sheet Sheet (Complete);Sheet (Complete) Shell extension;Explorer extension (in Windows Explorer, right click on a file, there will be a MediaInfo option) Shell extension, folder;For folders too Shell InfoTip;Explorer Tooltip (in Windows Explorer, move the mouse over the file, info will be displayed) Show menu;Show menu Show toolbar;Show toolbar Sort;Sorted by SamplingCount;Samples count SoundEngineer;Sound engineer Source;Source Source_Duration;Source duration Source_FrameCount;Source frame count Source_SamplingCount;Source sample count Source_StreamSize;Source stream size Source_StreamSize_Encoded;Source encoded stream size Standard;Standard Stream;Stream Stream_MoreInfo;More information about the stream StreamCount;Count of stream of this kind StreamID;Stream ID StreamKind;Kind of stream StreamKindID;Stream identifier StreamKindPos;Stream identifier StreamSize;Stream size StreamSize_Encoded;Encoded stream size StreamSize_Proportion;Proportion of this stream Subject;Subject SubTrack;SubTrack Summary;Summary Supported formats;Supported formats Supported?;Supported? Synopsis;Synopsis SystemId;Id Tagged_Application;Tagging application Tagged_Date;Tagged date Technician;Technician TermsOfUse;Terms of use Text;Text Text - Custom;Text - Custom Text (HTML);Text (HTML) Text stream(s);Text streams Text streams;Text streams Text_Codec_List;Text codecs Text_No;No text Text1;First text stream Text2;Second text stream Text3;Third text stream TextCount;Count of text streams ThanksTo;Thanks to Thousands separator;Thousands separator Title;Title Title_More;Title, more info TimeCode;Time code TimeCode_FirstFrame;Time code of first frame TimeCode_Settings;Time code settings TimeCode_Source;Time code source TimeStamp;Time stamp TimeZone;Timezone Total;Total Track;Track name Track_Count;Track count transfer_characteristics;Transfer characteristics Translator;Translator Tree;Tree Tree & Text;Tree & Text Type;Type UniqueID;Unique ID Unknown;Unknown Url;Url Video;Video Video stream(s);Video stream(s) Video_Codec_List;Codecs Video Video_Delay;Delay relative to video Video_No;No video Video0_Delay;Video0 delay Video1;First video stream VideoCount;Count of video streams View;View View_Hint;Change the means of viewing information Warning : more streams in the files;Warning : there are more streams in the files Web;Web WebSite_Audio;Go to the web site of this audio codec WebSite_Audio_More;Go to the web site (%Url%) to find this audio codec WebSite_General;Go to the web site of a player for this file WebSite_General_More;Go to the web site of a player for this file WebSite_Text;Go to the web site of this text codec WebSite_Text_More;Go to the web site (%Url%) to find this text codec WebSite_Url;http://MediaArea.net/MediaInfo WebSite_Video;Go to the web site of this video codec WebSite_Video_More;Go to the web site (%Url%) to find this video codec Width;Width Width_Original;Original width WriteMe;Write mail to author WriteToTranslator;Write to translator Written_Date;Written date Written_Location;Written location WrittenBy;Written by Yes;Yes Your system;Your system ZZ_Automatic_Percent;100 ZZ_AutomaticLanguage_Percent;100MediaInfoLib/Source/Resource/Text/MediaInfo/ 40777 0 0 0 12226004261 14160 5MediaInfoLib/Source/Resource/Text/MediaInfo/Summary.csv100777 0 0 2362 12226004261 16435 0General;[%Format%][ (%Format_Profile%)][ (%Format_Commercial_IfAny%)]$if(%Format%,$: $)%FileSize/String%[, %Duration/String%] Video;[%Language/String%, ][%BitRate/String%$if(%BitRate_Nominal/String%, \\(%BitRate_Nominal/String%\\)), ][%Width%*][%Height%][ (%DisplayAspectRatio/String%), ][$at$ %FrameRate/String%, ][%Format%][ (%CodecID/Hint%)][ (%Standard%)]$if(%MuxingMode%, \\(%MuxingMode%\\))$if(%Format_Version%, \\(%Format_Version%\\))$if(%Format_Profile%, \\(%Format_Profile%\\))$if(%Format_Settings%, \\(%Format_Settings%\\))[ (%Format_Commercial_IfAny%)] Audio;[%Language/String%, ][%BitRate/String%$if(%BitRate_Nominal/String%, \\(%BitRate_Nominal/String%\\)), ][%SamplingRate/String%, ][%BitDepth/String%, ][%Channel(s)/String%, ][%Format%][ (%CodecID/Hint%)]$if(%MuxingMode%, \\(%MuxingMode%\\))$if(%Format_Version%, \\(%Format_Version%\\))$if(%Format_Profile%, \\(%Format_Profile%\\))$if(%Format_Settings%, \\(%Format_Settings%\\))[ (%Format_Commercial_IfAny%)] Text;[%Language/String%, ][%Format%][ (%Format_Commercial_IfAny%)]$if(%MuxingMode%, \\(%MuxingMode%\\)) Image;[%Language/String%, ][%Width%*][%Height%][ (%DisplayAspectRatio/String%)][, %Format%] Chapters;[%Language/String%, ]%Total% chapters[, %Format%][ (%Format_Commercial_IfAny%)] MediaInfoLib/Source/Resource/Text/Stream/ 40777 0 0 0 12226004261 13560 5MediaInfoLib/Source/Resource/Text/Stream/Audio.csv100777 0 0 37073 12226004261 15470 0Count;;;N NI;;;Count of objects available in this stream Status;;;N NI;;;bit field (0=IsAccepted, 1=IsFilled, 2=IsUpdated, 3=IsFinished) StreamCount;;;N NI;;;Count of streams of that kind available StreamKind;Audio;;N NT;;;Stream type name;; StreamKind/String;;;N NT;;;Stream type name StreamKindID;;;N NI;;;Number of the stream (base=0) StreamKindPos;;;N NI;;;When multiple streams, number of the stream (base=1) StreamOrder;;;N YI;;;Stream order in the file, whatever is the kind of stream (base=0) FirstPacketOrder;;;N YI;;;Order of the first fully decodable packet met in the file, whatever is the kind of stream (base=0) Inform;;;N NT;;;Last **Inform** call ID;;;N YI;;;The ID for this stream in this file ID/String;;;Y NT;;;The ID for this stream in this file UniqueID;;;N YI;;;The unique ID for this stream, should be copied with stream copy UniqueID/String;;;Y NT;;;The unique ID for this stream, should be copied with stream copy MenuID;;;N YI;;;The menu ID for this stream in this file MenuID/String;;;Y NT;;;The menu ID for this stream in this file Format;;;Y YT;;;Format used;; Format/Info;;;Y NT;;;Info about the format;; Format/Url;;;N NT;;;Homepage of this format;; Format_Commercial;;;N YT;;;Commercial name used by vendor for theses setings or Format field if there is no difference;; Format_Commercial_IfAny;;;Y YT;;;Commercial name used by vendor for theses setings if there is one;; Format_Version;;;Y YT;;;Version of this format;; Format_Profile;;;Y YT;;;Profile of this Format;; Format_Compression;;;Y YT;;;Compression method used;; Format_Settings;;;N YT;;;Settings needed for decoder used, summary;; Format_Settings_SBR;;Yes;N YT;;;;; Format_Settings_SBR/String;;;N NT;;;;; Format_Settings_PS;;Yes;N YT;;;;; Format_Settings_PS/String;;;N NT;;;;; Format_Settings_Mode;;;Y YT;;;;; Format_Settings_ModeExtension;;;Y YT;;;;; Format_Settings_Emphasis;;;Y YT;;;;; Format_Settings_Floor;;;Y YT;;;;; Format_Settings_Firm;;;Y YT;;;;; Format_Settings_Endianness;;;Y YT;;;;; Format_Settings_Sign;;;Y YT;;;;; Format_Settings_Law;;;Y YT;;;;; Format_Settings_ITU;;;Y YT;;;;; Format_Settings_Wrapping;;;Y YT;;;Wrapping mode (Frame wrapped or Clip wrapped) InternetMediaType;;;N YT;;;Internet Media Type (aka MIME Type, Content-Type);; MuxingMode;;;Y YT;;;How this stream is muxed in the container;; MuxingMode_MoreInfo;;;Y NT;;;More info (text) about the muxing mode;; CodecID;;;Y YT;;;Codec ID (found in some containers);; CodecID/String;;;Y NT;;;Codec ID (found in some containers);; CodecID/Info;;;Y NT;;;Info about codec ID;; CodecID/Hint;;;Y NT;;;Hint/popular name for this codec ID;; CodecID/Url;;;N NT;;;Homepage for more details about this codec ID;; CodecID_Description;;;Y YT;;;Manual description given by the container;; Codec;;;N NT;;;Deprecated, do not use in new projects;; Codec/String;;;N NT;;;Deprecated, do not use in new projects;; Codec/Family;;;N NT;;;Deprecated, do not use in new projects;; Codec/Info;;;N NT;;;Deprecated, do not use in new projects;; Codec/Url;;;N NT;;;Deprecated, do not use in new projects;; Codec/CC;;;N NT;;;Deprecated, do not use in new projects;; Codec_Description;;;N NT;;;Deprecated, do not use in new projects;; Codec_Profile;;;N NT;;;Deprecated, do not use in new projects;; Codec_Settings;;;N NT;;;Deprecated, do not use in new projects;; Codec_Settings_Automatic;;;N NT;;;Deprecated, do not use in new projects;; Codec_Settings_Floor;;;N NT;;;Deprecated, do not use in new projects;; Codec_Settings_Firm;;;N NT;;;Deprecated, do not use in new projects;; Codec_Settings_Endianness;;;N NT;;;Deprecated, do not use in new projects;; Codec_Settings_Sign;;;N NT;;;Deprecated, do not use in new projects;; Codec_Settings_Law;;;N NT;;;Deprecated, do not use in new projects;; Codec_Settings_ITU;;;N NT;;;Deprecated, do not use in new projects;; Duration;; ms;N YI;;;Play time of the stream;; Duration/String;;;Y NT;;;Play time in format : XXx YYy only, YYy omited if zero;; Duration/String1;;;N NT;;;Play time in format : HHh MMmn SSs MMMms, XX omited if zero;; Duration/String2;;;N NT;;;Play time in format : XXx YYy only, YYy omited if zero;; Duration/String3;;;N NT;;;Play time in format : HH:MM:SS.MMM;; Duration_FirstFrame;; ms;N YI;;;Duration of the first frame if it is longer than others, in ms; Duration_FirstFrame/String;;;Y NT;;;Duration of the first frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Duration_FirstFrame/String1;;;N NT;;;Duration of the first frame if it is longer than others, in format : HHh MMmn SSs MMMms, XX omited if zero; Duration_FirstFrame/String2;;;N NT;;;Duration of the first frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Duration_FirstFrame/String3;;;N NT;;;Duration of the first frame if it is longer than others, in format : HH:MM:SS.MMM; Duration_LastFrame;; ms;N YI;;;Duration of the last frame if it is longer than others, in ms; Duration_LastFrame/String;;;Y NT;;;Duration of the last frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Duration_LastFrame/String1;;;N NT;;;Duration of the last frame if it is longer than others, in format : HHh MMmn SSs MMMms, XX omited if zero; Duration_LastFrame/String2;;;N NT;;;Duration of the last frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Duration_LastFrame/String3;;;N NT;;;Duration of the last frame if it is longer than others, in format : HH:MM:SS.MMM; Source_Duration;; ms;N YI;;;Source Play time of the stream;; Source_Duration/String;;;Y NT;;;Source Play time in format : XXx YYy only, YYy omited if zero;; Source_Duration/String1;;;N NT;;;Source Play time in format : HHh MMmn SSs MMMms, XX omited if zero;; Source_Duration/String2;;;N NT;;;Source Play time in format : XXx YYy only, YYy omited if zero;; Source_Duration/String3;;;N NT;;;Source Play time in format : HH:MM:SS.MMM;; Source_Duration_FirstFrame;; ms;N YI;;;Source Duration of the first frame if it is longer than others, in ms; Source_Duration_FirstFrame/String;;;Y NT;;;Source Duration of the first frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Source_Duration_FirstFrame/String1;;;N NT;;;Source Duration of the first frame if it is longer than others, in format : HHh MMmn SSs MMMms, XX omited if zero; Source_Duration_FirstFrame/String2;;;N NT;;;Source Duration of the first frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Source_Duration_FirstFrame/String3;;;N NT;;;Source Duration of the first frame if it is longer than others, in format : HH:MM:SS.MMM; Source_Duration_LastFrame;; ms;N YI;;;Source Duration of the last frame if it is longer than others, in ms; Source_Duration_LastFrame/String;;;Y NT;;;Source Duration of the last frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Source_Duration_LastFrame/String1;;;N NT;;;Source Duration of the last frame if it is longer than others, in format : HHh MMmn SSs MMMms, XX omited if zero; Source_Duration_LastFrame/String2;;;N NT;;;Source Duration of the last frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Source_Duration_LastFrame/String3;;;N NT;;;Source Duration of the last frame if it is longer than others, in format : HH:MM:SS.MMM; BitRate_Mode;;;N YT;;;Bit rate mode (VBR, CBR);; BitRate_Mode/String;;;Y NT;;;Bit rate mode (Constant, Variable);; BitRate;; bps;N YF;;;Bit rate in bps;; BitRate/String;;;Y NT;;;Bit rate (with measurement);; BitRate_Minimum;; bps;N YF;;;Minimum Bit rate in bps;; BitRate_Minimum/String;;;Y NT;;;Minimum Bit rate (with measurement);; BitRate_Nominal;; bps;N YF;;;Nominal Bit rate in bps;; BitRate_Nominal/String;;;Y NT;;;Nominal Bit rate (with measurement);; BitRate_Maximum;; bps;N YF;;;Maximum Bit rate in bps;; BitRate_Maximum/String;;;Y NT;;;Maximum Bit rate (with measurement);; BitRate_Encoded;; bps;N YF;;;Encoded (with forced padding) bit rate in bps, if some container padding is present BitRate_Encoded/String;;;Y NT;;;Encoded (with forced padding) bit rate (with measurement), if some container padding is present Channel(s);; channel;N YI;;;Number of channels;; Channel(s)/String;;;Y NT;;;Number of channels (with measurement);; Channel(s)_Original;; channel;N YI;;;Number of channels;; Channel(s)_Original/String;;;Y NT;;;Number of channels (with measurement);; ChannelPositions;;;Y YT;;;Position of channels;; ChannelPositions/String2;;;N NT;;;Position of channels (x/y.z format);; ChannelLayout;;;N YT;;;Layout of channels (in the stream);; SamplingRate;; Hz;N YF;;;Sampling rate;; SamplingRate/String;;;Y NT;;;in KHz;; SamplingCount;;;N NI;;;Sample count (based on sampling rate);; Source_SamplingCount;;;N NI;;;Source Sample count (based on sampling rate);; FrameRate;; fps;N YF;;;Frames per second FrameRate/String;;;N NT;;;Frames per second (with measurement) FrameCount;;;N NI;;;Frame count (a frame contains a count of samples depends of the format);; Source_FrameCount;;;N NI;;;Source Frame count (a frame contains a count of samples depends of the format);; Resolution;; bit;N NI;;;Deprecated, do not use in new projects;; Resolution/String;;;N NT;;;Deprecated, do not use in new projects;; BitDepth;; bit;N YI;;;Resolution in bits (8, 16, 20, 24);; BitDepth/String;;;Y NT;;;Resolution in bits (8, 16, 20, 24);; Compression_Mode;;;N YT;;;Compression mode (Lossy or Lossless) Compression_Mode/String;;;Y NT;;;Compression mode (Lossy or Lossless) Compression_Ratio;;;Y YF;;;Current stream size divided by uncompressed stream size;; Delay;; ms;N NI;;;Delay fixed in the stream (relative) IN MS; Delay/String;;;N NT;;;Delay with measurement; Delay/String1;;;N NT;;;Delay with measurement; Delay/String2;;;N NT;;;Delay with measurement; Delay/String3;;;N NT;;;Delay in format : HH:MM:SS.MMM; Delay/String4;;;N NT;;;Delay in format : HH:MM:SS:FF (HH:MM:SS;FF for drop frame, if available) Delay_Settings;;;N NT;;;Delay settings (in case of timecode for example); Delay_DropFrame;;;N NT;;;Delay drop frame; Delay_Source;;;N NT;;;Delay source (Container or Stream or empty); Delay_Source/String;;;N NT;;;Delay source (Container or Stream or empty); Delay_Original;; ms;N NI;;;Delay fixed in the raw stream (relative) IN MS; Delay_Original/String;;;N NT;;;Delay with measurement; Delay_Original/String1;;;N NT;;;Delay with measurement; Delay_Original/String2;;;N NT;;;Delay with measurement; Delay_Original/String3;;;N NT;;;Delay in format: HH:MM:SS.MMM;; Delay_Original/String4;;;N NT;;;Delay in format: HH:MM:SS:FF (HH:MM:SS;FF for drop frame, if available); Delay_Original_Settings;;;N NT;;;Delay settings (in case of timecode for example);; Delay_Original_DropFrame;;;N NT;;;Delay drop frame info; Delay_Original_Source;;;N NT;;;Delay source (Stream or empty); Video_Delay;; ms;N NI;;;Delay fixed in the stream (absolute / video) Video_Delay/String;;;Y NT;;; Video_Delay/String1;;;N NT;;; Video_Delay/String2;;;N NT;;; Video_Delay/String3;;;N NT;;; Video_Delay/String4;;;N NT;;; Video0_Delay;; ms;N NI;;;Deprecated, do not use in new projects Video0_Delay/String;;;N NT;;;Deprecated, do not use in new projects Video0_Delay/String1;;;N NT;;;Deprecated, do not use in new projects Video0_Delay/String2;;;N NT;;;Deprecated, do not use in new projects Video0_Delay/String3;;;N NT;;;Deprecated, do not use in new projects Video0_Delay/String4;;;N NT;;;Deprecated, do not use in new projects ReplayGain_Gain;; dB;N YT;;;The gain to apply to reach 89dB SPL on playback;; ReplayGain_Gain/String;;;Y YT;;;;; ReplayGain_Peak;;;Y YT;;;The maximum absolute peak value of the item;; StreamSize;; byte;N YI;;;Streamsize in bytes;; StreamSize/String;;;Y NT;;;Streamsize in with percentage value;; StreamSize/String1;;;N NT;;;;; StreamSize/String2;;;N NT;;;;; StreamSize/String3;;;N NT;;;;; StreamSize/String4;;;N NT;;;;; StreamSize/String5;;;N NT;;;Streamsize in with percentage value;; StreamSize_Proportion;;;N NT;;;Stream size divided by file size;; Source_StreamSize;; byte;N YI;;;Source Streamsize in bytes;; Source_StreamSize/String;;;Y NT;;;Source Streamsize in with percentage value;; Source_StreamSize/String1;;;N NT;;;;; Source_StreamSize/String2;;;N NT;;;;; Source_StreamSize/String3;;;N NT;;;;; Source_StreamSize/String4;;;N NT;;;;; Source_StreamSize/String5;;;N NT;;;Source Streamsize in with percentage value;; Source_StreamSize_Proportion;;;N NT;;;Source Stream size divided by file size;; StreamSize_Encoded;; byte;N YI;;;Encoded Streamsize in bytes;; StreamSize_Encoded/String;;;Y NT;;;Encoded Streamsize in with percentage value;; StreamSize_Encoded/String1;;;N NT;;;;; StreamSize_Encoded/String2;;;N NT;;;;; StreamSize_Encoded/String3;;;N NT;;;;; StreamSize_Encoded/String4;;;N NT;;;;; StreamSize_Encoded/String5;;;N NT;;;Encoded Streamsize in with percentage value;; StreamSize_Encoded_Proportion;;;N NT;;;Encoded Stream size divided by file size;; Source_StreamSize_Encoded;; byte;N YI;;;Source Encoded Streamsize in bytes;; Source_StreamSize_Encoded/String;;;Y NT;;;Source Encoded Streamsize in with percentage value;; Source_StreamSize_Encoded/String1;;;N NT;;;;; Source_StreamSize_Encoded/String2;;;N NT;;;;; Source_StreamSize_Encoded/String3;;;N NT;;;;; Source_StreamSize_Encoded/String4;;;N NT;;;;; Source_StreamSize_Encoded/String5;;;N NT;;;Source Encoded Streamsize in with percentage value;; Source_StreamSize_Encoded_Proportion;;;N NT;;;Source Encoded Stream size divided by file size;; Alignment;;;N YT;;;How this stream file is aligned in the container;; Alignment/String;;;Y NT;;;Where this stream file is aligned in the container;; Interleave_VideoFrames;;;N YF;;;Between how many video frames the stream is inserted;; Interleave_Duration;;;N YI;;;Between how much time (ms) the stream is inserted;; Interleave_Duration/String;;;Y NT;;;Between how much time and video frames the stream is inserted (with measurement);; Interleave_Preload;;;N YI;;;How much time is buffered before the first video frame;; Interleave_Preload/String;;;Y NT;;;How much time is buffered before the first video frame (with measurement);; Title;;;Y YI;;;Name of the track;; Encoded_Library;;;N YT;;;Software used to create the file;; Encoded_Library/String;;;Y NT;;;Software used to create the file;; Encoded_Library/Name;;;N NT;;;Info from the software;; Encoded_Library/Version;;;N NT;;;Version of software;; Encoded_Library/Date;;;N NT;;;Release date of software;; Encoded_Library_Settings;;;Y YT;;;Parameters used by the software;; Language;;;N YT;;;Language (2-letter ISO 639-1 if exists, else 3-letter ISO 639-2, and with optional ISO 3166-1 country separated by a dash if available, e.g. en, en-us, zh-cn);; Language/String;;;Y NT;;;Language (full);; Language/String1;;;N NT;;;Language (full);; Language/String2;;;N NT;;;Language (2-letter ISO 639-1 if exists, else empty);; Language/String3;;;N NT;;;Language (3-letter ISO 639-2 if exists, else empty);; Language/String4;;;N NT;;;Language (2-letter ISO 639-1 if exists with optional ISO 3166-1 country separated by a dash if available, e.g. en, en-us, zh-cn, else empty);; Language_More;;;Y YT;;;More info about Language (e.g. Director's Comment);; Default;;Yes;N YT;;;Set if that track should be used if no language found matches the user preference. Default/String;;;Y NT;;;Set if that track should be used if no language found matches the user preference. Forced;;Yes;N YT;;;Set if that track should be used if no language found matches the user preference. Forced/String;;;Y NT;;;Set if that track should be used if no language found matches the user preference. Encoded_Date;;;Y YT;;;UTC time that the encoding of this item was completed began.;;Temporal Tagged_Date;;;Y YT;;;UTC time that the tags were done for this item.;;Temporal Encryption;;;Y YT;;;;; MediaInfoLib/Source/Resource/Text/Stream/General.csv100777 0 0 50174 12226004261 16001 0Count;;;N NI;;;Count of objects available in this stream Status;;;N NI;;;bit field (0=IsAccepted, 1=IsFilled, 2=IsUpdated, 3=IsFinished) StreamCount;;;N NI;;;Count of streams of that kind available StreamKind;General;;N NT;;;Stream type name StreamKind/String;;;N NT;;;Stream type name StreamKindID;;;N NI;;;Number of the stream (base=0) StreamKindPos;;;N NI;;;When multiple streams, number of the stream (base=1) StreamOrder;;;N YI;;;Stream order in the file, whatever is the kind of stream (base=0) FirstPacketOrder;;;N YI;;;Order of the first fully decodable packet met in the file, whatever is the kind of stream (base=0) Inform;;;N NT;;;Last **Inform** call ID;;;N YI;;;The ID for this stream in this file ID/String;;;Y NT;;;The ID for this stream in this file UniqueID;;;N YI;;;The unique ID for this stream, should be copied with stream copy UniqueID/String;;;Y NT;;;The unique ID for this stream, should be copied with stream copy MenuID;;;N YI;;;The menu ID for this stream in this file MenuID/String;;;Y NT;;;The menu ID for this stream in this file GeneralCount;1;;N NI;;;Number of general streams VideoCount;;;N NI;;;Number of video streams AudioCount;;;N NI;;;Number of audio streams TextCount;;;N NI;;;Number of text streams OtherCount;;;N NI;;;Number of other streams ImageCount;;;N NI;;;Number of image streams MenuCount;;;N NI;;;Number of menu streams Video_Format_List;;;N NT;;;Video Codecs in this file, separated by / Video_Format_WithHint_List;;;N NT;;;Video Codecs in this file with popular name (hint), separated by / Video_Codec_List;;;N NT;;;Deprecated, do not use in new projects Video_Language_List;;;N NT;;;Video languagesin this file, full names, separated by / Audio_Format_List;;;N NT;;;Audio Codecs in this file,separated by / Audio_Format_WithHint_List;;;N NT;;;Audio Codecs in this file with popular name (hint), separated by / Audio_Codec_List;;;N NT;;;Deprecated, do not use in new projects Audio_Language_List;;;N NT;;;Audio languages in this file separated by / Text_Format_List;;;N NT;;;Text Codecs in this file, separated by / Text_Format_WithHint_List;;;N NT;;;Text Codecs in this file with popular name (hint),separated by / Text_Codec_List;;;N NT;;;Deprecated, do not use in new projects Text_Language_List;;;N NT;;;Text languages in this file, separated by / Other_Format_List;;;N NT;;;Other formats in this file, separated by / Other_Format_WithHint_List;;;N NT;;;Other formats in this file with popular name (hint), separated by / Other_Codec_List;;;N NT;;;Deprecated, do not use in new projects Other_Language_List;;;N NT;;;Chapters languages in this file, separated by / Image_Format_List;;;N NT;;;Image Codecs in this file, separated by / Image_Format_WithHint_List;;;N NT;;;Image Codecs in this file with popular name (hint), separated by / Image_Codec_List;;;N NT;;;Deprecated, do not use in new projects Image_Language_List;;;N NT;;;Image languages in this file, separated by / Menu_Format_List;;;N NT;;;Menu Codecsin this file, separated by / Menu_Format_WithHint_List;;;N NT;;;Menu Codecs in this file with popular name (hint),separated by / Menu_Codec_List;;;N NT;;;Deprecated, do not use in new projects Menu_Language_List;;;N NT;;;Menu languages in this file, separated by / CompleteName;;;Y YT;;;Complete name (Folder+Name+Extension) FolderName;;;N NT;;;Folder name only FileName;;;N NT;;;File name only FileExtension;;;N NT;;;File extension only CompleteName_Last;;;Y YT;;;Complete name (Folder+Name+Extension) of the last file (in the case of a sequence of files) FolderName_Last;;;N NT;;;Folder name only of the last file (in the case of a sequence of files) FileName_Last;;;N NT;;;File name only of the last file (in the case of a sequence of files) FileExtension_Last;;;N NT;;;File extension only of the last file (in the case of a sequence of files) Format;;;Y YT;;;Format used Format/String;;;N NT;;;Deprecated, do not use in new projects Format/Info;;;Y NT;;;Info about this Format Format/Url;;;N NT;;;Link to a description of this format Format/Extensions;;;N NT;;;Known extensions of this format Format_Commercial;;;N NT;;;Commercial name used by vendor for theses setings or Format field if there is no difference Format_Commercial_IfAny;;;Y YT;;;Commercial name used by vendor for theses setings if there is one Format_Version;;;Y YT;;;Version of this format Format_Profile;;;Y YT;;;Profile of the Format Format_Compression;;;Y YT;;;Compression method used;; Format_Settings;;;Y YT;;;Settings needed for decoder used InternetMediaType;;;N YT;;;Internet Media Type (aka MIME Type, Content-Type) CodecID;;;Y YT;;;Codec ID (found in some containers);; CodecID/String;;;Y NT;;;Codec ID (found in some containers);; CodecID/Info;;;Y NT;;;Info about this codec CodecID/Hint;;;Y NT;;;A hint/popular name for this codec CodecID/Url;;;N NT;;;A link to more details about this codec ID CodecID_Description;;;Y YT;;;Manual description given by the container Interleaved;;;N YT;;;If Audio and video are muxed Codec;;;N NT;;;Deprecated, do not use in new projects Codec/String;;;N NT;;;Deprecated, do not use in new projects Codec/Info;;;N NT;;;Deprecated, do not use in new projects Codec/Url;;;N NT;;;Deprecated, do not use in new projects Codec/Extensions;;;N NT;;;Deprecated, do not use in new projects Codec_Settings;;;N NT;;;Deprecated, do not use in new projects Codec_Settings_Automatic;;;N NT;;;Deprecated, do not use in new projects FileSize;; byte;N YT;;;File size in bytes FileSize/String;;;Y NT;;;File size (with measure) FileSize/String1;;;N NT;;;File size (with measure, 1 digit mini) FileSize/String2;;;N NT;;;File size (with measure, 2 digit mini) FileSize/String3;;;N NT;;;File size (with measure, 3 digit mini) FileSize/String4;;;N NT;;;File size (with measure, 4 digit mini) Duration;; ms;N YI;;;Play time of the stream in ms Duration/String;;;Y NT;;;Play time in format : XXx YYy only, YYy omited if zero Duration/String1;;;N NT;;;Play time in format : HHh MMmn SSs MMMms, XX omited if zero Duration/String2;;;N NT;;;Play time in format : XXx YYy only, YYy omited if zero Duration/String3;;;N NT;;;Play time in format : HH:MM:SS.MMM Duration_Start;;;Y YT;;; Duration_End;;;Y YT;;; OverallBitRate_Mode;;;N YT;;;Bit rate mode of all streams (VBR, CBR) OverallBitRate_Mode/String;;;Y NT;;;Bit rate mode of all streams (Variable, Constant) OverallBitRate;; bps;N YF;;;Bit rate of all streams in bps OverallBitRate/String;;;Y NT;;;Bit rate of all streams (with measure) OverallBitRate_Minimum;; bps;N YF;;;Minimum Bit rate in bps OverallBitRate_Minimum/String;;;Y NT;;;Minimum Bit rate (with measurement) OverallBitRate_Nominal;; bps;N YF;;;Nominal Bit rate in bps OverallBitRate_Nominal/String;;;Y NT;;;Nominal Bit rate (with measurement) OverallBitRate_Maximum;; bps;N YF;;;Maximum Bit rate in bps OverallBitRate_Maximum/String;;;Y NT;;;Maximum Bit rate (with measurement) Delay;; ms;N YI;;;Delay fixed in the stream (relative) IN MS Delay/String;;;N NT;;;Delay with measurement Delay/String1;;;N NT;;;Delay with measurement Delay/String2;;;N NT;;;Delay with measurement Delay/String3;;;N NT;;;format : HH:MM:SS.MMM StreamSize;; byte;N YI;;;Stream size in bytes StreamSize/String;;;N NT;;; StreamSize/String1;;;N NT;;; StreamSize/String2;;;N NT;;; StreamSize/String3;;;N NT;;; StreamSize/String4;;;N NT;;; StreamSize/String5;;;N NT;;;With proportion StreamSize_Proportion;;;N NT;;;Stream size divided by file size HeaderSize;;;N YI;;; DataSize;;;N YI;;; FooterSize;;;N YI;;; IsStreamable;;;N YT;;; Album_ReplayGain_Gain;; dB;N YT;;;The gain to apply to reach 89dB SPL on playback Album_ReplayGain_Gain/String;;;Y YT;;; Album_ReplayGain_Peak;;;Y YT;;;The maximum absolute peak value of the item;; Encryption;;;Y YT;;;;; Title;;;N NT;;;(Generic)Title of file;;Title Title/More;;;N NT;;;(Generic)More info about the title of file;;Title Title/Url;;;N NT;;;(Generic)Url;;Title Domain;;;Y YT;;;Univers movies belong to, e.g. Starwars, Stargate, Buffy, Dragonballs;;Title Collection;;;Y YT;;;Name of the series, e.g. Starwars movies, Stargate SG-1, Stargate Atlantis, Buffy, Angel;;Title Season;;;Y YT;;;Name of the season, e.g. Strawars first Trilogy, Season 1;;Title Season_Position;;;Y YI;;;Number of the Season;;Title Season_Position_Total;;;Y YI;;;Place of the season e.g. 2 of 7;;Title Movie;;;Y YT;;;Name of the movie. Eg : Starwars, a new hope;;Title Movie/More;;;Y YT;;;More infos about the movie;;Title Movie/Country;;;Y YT;;;Country, where the movie was procuced;;Title Movie/Url;;;Y YT;;;Homepage for the movie;;Title Album;;;Y YT;;;Name of an audio-album. Eg : The joshua tree;;Title Album/More;;;Y YT;;;More infos about the album;;Title Album/Sort;;;Y YT;;;;;Title Album/Performer;;;Y YT;;;Album performer/artist of this file;;Entity Album/Performer/Sort;;;Y YT;;;;;Entity Album/Performer/Url;;;Y YT;;;Homepage of the album performer/artist;;Entity Comic;;;Y YT;;;Name of the comic.;;Title Comic/More;;;Y YT;;;;;Title Comic/Position_Total;;;Y YI;;;;;Title Part;;;Y YT;;;Name of the part. e.g. CD1, CD2;;Title Part/Position;;;Y YI;;;Number of the part;;Title Part/Position_Total;;;Y YI;;;Place of the part e.g. 2 of 3;;Title Track;;;Y YT;;;Name of the track. e.g. track1, track 2;;Title Track/More;;;Y YT;;;More infos about the track;;Title Track/Url;;;Y YT;;;Link to a site about this track;;Title Track/Sort;;;Y YT;;;;;Title Track/Position;;;Y YI;;;Number of this track;;Title Track/Position_Total;;;Y YI;;;Place of this track, e.g. 3 of 15;;Title Grouping;;;Y YT;;;iTunes grouping;;Title Chapter;;;Y YT;;;Name of the chapter.;;Title SubTrack;;;Y YT;;;Name of the subtrack.;;Title Original/Album;;;Y YT;;;Original name of album, serie...;;Title Original/Movie;;;Y YT;;;Original name of the movie;;Title Original/Part;;;Y YT;;;Original name of the part in the original support;;Title Original/Track;;;Y YT;;;Original name of the track in the original support;;Title Compilation;;;Y YT;;;iTunes compilation;;Title Compilation/String;;Yes;Y YT;;;iTunes compilation;;Title Performer;;;Y YT;;;Main performer/artist of this file;;Entity Performer/Sort;;;Y YT;;;;;Entity Performer/Url;;;Y YT;;;Homepage of the performer/artist;;Entity Original/Performer;;;Y YT;;;Original artist(s)/performer(s).;;Entity Accompaniment;;;Y YT;;;Band/orchestra/accompaniment/musician.;;Entity Composer;;;Y YT;;;Name of the original composer.;;Entity Composer/Nationality;;;Y YT;;;Nationality of the main composer of the item, mostly for classical music.;;Entity Arranger;;;Y YT;;;The person who arranged the piece. e.g. Ravel.;;Entity Lyricist;;;Y YT;;;The person who wrote the lyrics for a musical item.;;Entity Original/Lyricist;;;Y YT;;;Original lyricist(s)/text writer(s).;;Entity Conductor;;;Y YT;;;The artist(s) who performed the work. In classical music this would be the conductor, orchestra, soloists.;;Entity Director;;;Y YT;;;Name of the director.;;Entity AssistantDirector;;;Y YT;;;Name of the assistant director.;;Entity DirectorOfPhotography;;;Y YT;;;The name of the director of photography, also known as cinematographer.;;Entity SoundEngineer;;;Y YT;;;The name of the sound engineer or sound recordist.;;Entity ArtDirector;;;Y YT;;;The person who oversees the artists and craftspeople who build the sets.;;Entity ProductionDesigner;;;Y YT;;;The person responsible for designing the Overall visual appearance of a movie.;;Entity Choregrapher;;;Y YT;;;The name of the choregrapher.;;Entity CostumeDesigner;;;Y YT;;;The name of the costume designer.;;Entity Actor;;;Y YT;;;Real name of an actor or actress playing a role in the movie.;;Entity Actor_Character;;;Y YT;;;Name of the character an actor or actress plays in this movie.;;Entity WrittenBy;;;Y YT;;;The author of the story or script.;;Entity ScreenplayBy;;;Y YT;;;The author of the screenplay or scenario (used for movies and TV shows).;;Entity EditedBy;;;Y YT;;;Editors name;;Entity CommissionedBy;;;Y YT;;;name of the person or organization that commissioned the subject of the file;;Entity Producer;;;Y YT;;;Name of the producer of the movie.;;Entity CoProducer;;;Y YT;;;The name of a co-producer.;;Entity ExecutiveProducer;;;Y YT;;;The name of an executive producer.;;Entity MusicBy;;;Y YT;;;Main music-artist for a movie;;Entity DistributedBy;;;Y YT;;;Company the item is mainly distributed by ;;Entity OriginalSourceForm/DistributedBy;;;Y YT;;;Name of the person or organization who supplied the original subject;;Entity MasteredBy;;;Y YT;;;The engineer who mastered the content for a physical medium or for digital distribution.;;Entity EncodedBy;;;Y YT;;;Name of the person or organisation that encoded/ripped the audio file.;;Entity RemixedBy;;;Y YT;;;Name of the artist(s), that interpreted, remixed, or otherwise modified the item.;;Entity ProductionStudio;;;Y YT;;;Main production studio ;;Entity ThanksTo;;;Y YT;;;A very general tag for everyone else that wants to be listed.;;Entity Publisher;;;Y YT;;;Name of the organization publishing the album (i.e. the 'record label') or movie.;;Entity Publisher/URL;;;Y YT;;;Publishers official webpage.;;Entity Label;;;Y YT;;;Brand or trademark associated with the marketing of music recordings and music videos.;;Entity Genre;;;Y YT;;;The main genre of the audio or video. e.g. classical, ambient-house, synthpop, sci-fi, drama, etc.;;Classification Mood;;;Y YT;;;Intended to reflect the mood of the item with a few keywords, e.g. Romantic, Sad, Uplifting, etc.;;Classification ContentType;;;Y YT;;;The type of the item. e.g. Documentary, Feature Film, Cartoon, Music Video, Music, Sound FX, etc.;;Classification Subject;;;Y YT;;;Describes the topic of the file, such as Aerial view of Seattle..;;Classification Description;;;Y YT;;;A short description of the contents, such as Two birds flying.;;Classification Keywords;;;Y YT;;;Keywords to the item separated by a comma, used for searching.;;Classification Summary;;;Y YT;;;A plot outline or a summary of the story.;;Classification Synopsis;;;Y YT;;;A description of the story line of the item.;;Classification Period;;;Y YT;;;Describes the period that the piece is from or about. e.g. Renaissance.;;Classification LawRating;;;Y YT;;;Depending on the country it's the format of the rating of a movie (P, R, X in the USA, an age in other countries or a URI defining a logo).;;Classification LawRating_Reason;;;Y YT;;;Reason for the law rating;;Classification ICRA;;;Y YT;;;The ICRA rating. (Previously RSACi);;Classification Released_Date;;;Y YT;;;The date/year that the item was released.;;Temporal Original/Released_Date;;;Y YT;;;The date/year that the item was originaly released.;;Temporal Recorded_Date;;;Y YT;;;The time/date/year that the recording began.;;Temporal Encoded_Date;;;Y YT;;;The time/date/year that the encoding of this item was completed began.;;Temporal Tagged_Date;;;Y YT;;;The time/date/year that the tags were done for this item.;;Temporal Written_Date;;;Y YT;;;The time/date/year that the composition of the music/script began.;;Temporal Mastered_Date;;;Y YT;;;The time/date/year that the item was tranfered to a digitalmedium.;;Temporal File_Created_Date;;;N NT;;;The time that the file was created on the file system;;Temporal File_Created_Date_Local;;;N NT;;;The time that the file was created on the file system (Warning: this field depends of local configuration, do not use it in an international database);;Temporal File_Modified_Date;;;N NT;;;The time that the file was modified on the file system;;Temporal File_Modified_Date_Local;;;N NT;;;The time that the file was modified on the file system (Warning: this field depends of local configuration, do not use it in an international database);;Temporal Recorded_Location;;;Y YT;;;Location where track was recorded. (See COMPOSITION_LOCATION for format);;Spatial Written_Location;;;Y YT;;;Location that the item was originaly designed/written. Information should be stored in the following format: country code, state/province, city where the coutry code is the same 2 octets as in Internet domains, or possibly ISO-3166. e.g. US, Texas, Austin or US, , Austin.;;Spatial Archival_Location;;;Y YT;;;Location, where an item is archived, e.eg. Louvre,Paris,France;;Spatial Encoded_Application;;;Y YT;;;Name of the software package used to create the file, such as Microsoft WaveEdit.;;Technical Encoded_Application/Url;;;N YT;;;Name of the software package used to create the file, such as Microsoft WaveEdit.;;Technical Encoded_Library;;;N YT;;;Software used to create the file;;Technical Encoded_Library/String;;;Y NT;;;Software used to create the file;;Technical Encoded_Library/Name;;;N NT;;;Name of the the encoding-software;;Technical Encoded_Library/Version;;;N NT;;;Version of encoding-software;;Technical Encoded_Library/Date;;;N NT;;;Release date of software;;Technical Encoded_Library_Settings;;;Y YT;;;Parameters used by the software;;Technical Cropped;;;Y YT;;;Describes whether an image has been cropped and, if so, how it was cropped.;;Technical Dimensions;;;Y YT;;;Specifies the size of the original subject of the file. eg 8.5 in h, 11 in w;;Technical DotsPerInch;;;Y YT;;;Stores dots per inch setting of the digitizer used to produce the file;;Technical Lightness;;;Y YT;;;Describes the changes in lightness settings on the digitizer required to produce the file;;Technical OriginalSourceMedium;;;Y YT;;;Original medium of the material, e.g. vinyl, Audio-CD, Super8 or BetaMax;;Technical OriginalSourceForm;;;Y YT;;;Original form of the material, e.g. slide, paper, map;;Technical OriginalSourceForm/NumColors;;;Y YT;;;Number of colors requested when digitizing, e.g. 256 for images or 32 bit RGB for video;;Technical OriginalSourceForm/Name;;;Y YT;;;Name of the product the file was originally intended for;;Technical OriginalSourceForm/Cropped;;;Y YT;;;Describes whether an image has been cropped and, if so, how it was cropped. e.g. 16:9 to 4:3, top and bottom;;Technical OriginalSourceForm/Sharpness;;;Y YT;;;Identifies the changes in sharpness for the digitizer requiered to produce the file;;Technical Tagged_Application;;;Y YT;;;Software used to tag this file;;Technical BPM;;;Y YT;;;Average number of beats per minute;;Technical ISRC;;;Y YT;;;International Standard Recording Code, excluding the ISRC prefix and including hyphens.;;Identifier ISBN;;;Y YT;;;International Standard Book Number.;;Identifier BarCode;;;Y YT;;;EAN-13 (13-digit European Article Numbering) or UPC-A (12-digit Universal Product Code) bar code identifier.;;Identifier LCCN;;;Y YT;;;Library of Congress Control Number.;;Identifier CatalogNumber;;;Y YT;;;A label-specific catalogue number used to identify the release. e.g. TIC 01.;;Identifier LabelCode;;;Y YT;;;A 4-digit or 5-digit number to identify the record label, typically printed as (LC) xxxx or (LC) 0xxxx on CDs medias or covers, with only the number being stored.;;Identifier Owner;;;Y YT;;;Owner of the file;;Legal Copyright;;;Y YT;;;Copyright attribution.;;Legal Copyright/Url;;;Y YT;;;Link to a site with copyright/legal information.;;Legal Producer_Copyright;;;Y YT;;;The copyright information as per the productioncopyright holder.;;Legal TermsOfUse;;;Y YT;;;License information, e.g., All Rights Reserved,Any Use Permitted.;;Legal ServiceName;;;Y YT;;;;;Legal ServiceChannel;;;Y YT;;;;;Legal Service/Url;;;Y YT;;;;;Legal ServiceProvider;;;Y YT;;;;;Legal ServiceProviderr/Url;;;Y YT;;;;;Legal ServiceType;;;Y YT;;;;;Legal NetworkName;;;Y YT;;;;;Legal OriginalNetworkName;;;Y YT;;;;;Legal Country;;;Y YT;;;;;Legal TimeZone;;;Y YT;;;;;Legal Cover;;;Y YT;;;Is there a cover;;Info Cover_Description;;;Y YT;;;short descriptio, e.g. Earth in space;;Info Cover_Type;;;Y YT;;;;;Info Cover_Mime;;;Y YT;;;;;Info Cover_Data;;;N YT;;;Cover, in binary format encoded BASE64;;Info Lyrics;;;Y YT;;;Text of a song;;Info Comment;;;Y YT;;;Any comment related to the content.;;Personal Rating;;;Y YT;;;A numeric value defining how much a person likes the song/movie. The number is between 0 and 5 with decimal values possible (e.g. 2.7), 5(.0) being the highest possible rating.;;Personal Added_Date;;;Y YT;;;Date/year the item was added to the owners collection;;Personal Played_First_Date;;;Y YT;;;The date, the owner first played an item;;Personal Played_Last_Date;;;Y YT;;;The date, the owner last played an item;;Personal Played_Count;;;Y YI;;;Number of times an item was played;;Personal EPG_Positions_Begin;;;N YI;;;;; EPG_Positions_End;;;N YI;;;;; MediaInfoLib/Source/Resource/Text/Stream/General_Info_About_Levels.csv100777 0 0 525 12226004261 21353 0Level;Generic;Audio;Video;Images;Examples 8;Domain;;;;Starwars, Stargate, U2 7;Collection;;;;Starwars movies, Stargate movie, Stargate SG-1, Stargate Atlantis 6;Season;;;;Strawars first Trilogy, Season 1 5;;Album;Movie;Comic;The joshua tree, Starwars, a new hope 4;Part;;;;CD1, CD2 3;;Track;Chapter;; 2;;Subtrack;Scene;; 1;;;Shot;; MediaInfoLib/Source/Resource/Text/Stream/Generic.csv100777 0 0 4330 12226004261 15751 0Format Format/Info Format/Url Format_Commercial Format_Commercial_IfAny Format_Version Format_Profile Format_Compression Format_Settings InternetMediaType CodecID CodecID/Info CodecID/Hint CodecID/Url CodecID_Description Codec Codec/String Codec/Info Codec/Url Codec/CC Duration Duration/String Duration/String1 Duration/String2 Duration/String3 Source_Duration Source_Duration/String Source_Duration/String1 Source_Duration/String2 Source_Duration/String3 BitRate_Mode BitRate_Mode/String BitRate BitRate/String BitRate_Minimum BitRate_Minimum/String BitRate_Nominal BitRate_Nominal/String BitRate_Maximum BitRate_Maximum/String BitRate_Encoded BitRate_Encoded/String FrameCount Source_FrameCount ColorSpace ChromaSubsampling Resolution Resolution/String BitDepth BitDepth/String Compression_Mode Compression_Mode/String Compression_Ratio Delay Delay/String Delay/String1 Delay/String2 Delay/String3 Delay/String4 Delay_Settings Delay_DropFrame Delay_Source Delay_Source/String Delay_Original Delay_Original/String Delay_Original/String1 Delay_Original/String2 Delay_Original/String3 Delay_Original/String4 Delay_Original_Settings Delay_Original_DropFrame Delay_Original_Source Video_Delay Video_Delay/String Video_Delay/String1 Video_Delay/String2 Video_Delay/String3 Video_Delay/String4 StreamSize StreamSize/String StreamSize/String1 StreamSize/String2 StreamSize/String3 StreamSize/String4 StreamSize/String5 StreamSize_Proportion Source_StreamSize Source_StreamSize/String Source_StreamSize/String1 Source_StreamSize/String2 Source_StreamSize/String3 Source_StreamSize/String4 Source_StreamSize/String5 Source_StreamSize_Proportion StreamSize_Encoded StreamSize_Encoded/String StreamSize_Encoded/String1 StreamSize_Encoded/String2 StreamSize_Encoded/String3 StreamSize_Encoded/String4 StreamSize_Encoded/String5 StreamSize_Encoded_Proportion Source_StreamSize_Encoded Source_StreamSize_Encoded/String Source_StreamSize_Encoded/String1 Source_StreamSize_Encoded/String2 Source_StreamSize_Encoded/String3 Source_StreamSize_Encoded/String4 Source_StreamSize_Encoded/String5 Source_StreamSize_Encoded_Proportion Language ServiceName ServiceProvider MediaInfoLib/Source/Resource/Text/Stream/Image.csv100777 0 0 16177 12226004261 15453 0Count;;;N NI;;;Count of objects available in this stream Status;;;N NI;;;bit field (0=IsAccepted, 1=IsFilled, 2=IsUpdated, 3=IsFinished) StreamCount;;;N NI;;;Count of streams of that kind available StreamKind;Image;;N NT;;;Stream type name StreamKind/String;;;N NT;;;Stream type name StreamKindID;;;N NI;;;Number of the stream (base=0) StreamKindPos;;;N NI;;;When multiple streams, number of the stream (base=1) StreamOrder;;;N YI;;;Stream order in the file, whatever is the kind of stream (base=0) FirstPacketOrder;;;N YI;;;Order of the first fully decodable packet met in the file, whatever is the kind of stream (base=0) Inform;;;N NT;;;Last **Inform** call ID;;;N YI;;;The ID for this stream in this file ID/String;;;Y NT;;;The ID for this stream in this file UniqueID;;;N YI;;;The unique ID for this stream, should be copied with stream copy UniqueID/String;;;Y NT;;;The unique ID for this stream, should be copied with stream copy MenuID;;;N YI;;;The menu ID for this stream in this file MenuID/String;;;Y NT;;;The menu ID for this stream in this file Title;;;Y YI;;;Name of the track Format;;;Y YT;;;Format used Format/Info;;;Y NT;;;Info about Format Format/Url;;;N NT;;;Link Format_Commercial;;;N NT;;;Commercial name used by vendor for theses setings or Format field if there is no difference Format_Commercial_IfAny;;;Y YT;;;Commercial name used by vendor for theses setings if there is one Format_Version;;;Y NT;;;Version of this format Format_Profile;;;Y NT;;;Profile of the Format Format_Compression;;;N YT;;;Compression mode of the Format Format_Settings;;;Y NT;;;Settings needed for decoder used Format_Settings_Wrapping;;;Y YT;;;Wrapping mode (Frame wrapped or Clip wrapped) InternetMediaType;;;N YT;;;Internet Media Type (aka MIME Type, Content-Type) CodecID;;;Y YT;;;Codec ID (found in some containers);; CodecID/String;;;Y NT;;;Codec ID (found in some containers);; CodecID/Info;;;Y NT;;;Info about codec ID CodecID/Hint;;;Y NT;;;A hint for this codec ID CodecID/Url;;;N NT;;;A link for more details about this codec ID CodecID_Description;;;Y YT;;;Manual description given by the container Codec;;;N NT;;;Deprecated, do not use in new projects Codec/String;;;N NT;;;Deprecated, do not use in new projects Codec/Family;;;N NT;;;Deprecated, do not use in new projects Codec/Info;;;N NT;;;Deprecated, do not use in new projects Codec/Url;;;N NT;;;Deprecated, do not use in new projects Width;; pixel;N YI;;;Width (aperture size if present) in pixel Width/String;;;Y NT;;;Width (aperture size if present) with measurement (pixel) Width_Offset;; pixel;N YI;;;Offset between original width and displayed width (aperture size) in pixel Width_Offset/String;;;N NT;;;Offset between original width and displayed width (aperture size) in pixel Width_Original;; pixel;N YI;;;Original (in the raw stream) width in pixel Width_Original/String;;;Y NT;;;Original (in the raw stream) width with measurement (pixel) Height;; pixel;N YI;;;Height (aperture size if present) in pixel Height/String;;;Y NT;;;Height (aperture size if present) with measurement (pixel) Height_Offset;; pixel;N YI;;;Offset between original height and displayed height (aperture size) in pixel Height_Offset/String;;;N NT;;;Offset between original height and displayed height (aperture size) in pixel Height_Original;; pixel;N YI;;;Original (in the raw stream) height in pixel Height_Original/String;;;Y NT;;;Original (in the raw stream) height with measurement (pixel) PixelAspectRatio;;;N YF;;;Pixel Aspect ratio PixelAspectRatio/String;;;N NT;;;Pixel Aspect ratio PixelAspectRatio_Original;;;N YF;;;Original (in the raw stream) Pixel Aspect ratio PixelAspectRatio_Original/String;;;N NT;;;Original (in the raw stream) Pixel Aspect ratio DisplayAspectRatio;;;N YF;;;Display Aspect ratio DisplayAspectRatio/String;;;Y NT;;;Display Aspect ratio DisplayAspectRatio_Original;;;N YF;;;Original (in the raw stream) Display Aspect ratio DisplayAspectRatio_Original/String;;;Y NT;;;Original (in the raw stream) Display Aspect ratio ColorSpace;;;Y YT;;; ChromaSubsampling;;;Y YT;;; Resolution;; bit;N NI;;;Deprecated, do not use in new projects Resolution/String;;;N NT;;;Deprecated, do not use in new projects BitDepth;; bit;N YI;;; BitDepth/String;;;Y NT;;; Compression_Mode;;;N YT;;;Compression mode (Lossy or Lossless) Compression_Mode/String;;;Y NT;;;Compression mode (Lossy or Lossless) Compression_Ratio;;;Y YF;;;Current stream size divided by uncompressed stream size;; StreamSize;; byte;N YI;;;Stream size in bytes StreamSize/String;;;Y NT;;; StreamSize/String1;;;N NT;;; StreamSize/String2;;;N NT;;; StreamSize/String3;;;N NT;;; StreamSize/String4;;;N NT;;; StreamSize/String5;;;N NT;;;With proportion;; StreamSize_Proportion;;;N NT;;;Stream size divided by file size;; Encoded_Library;;;N YT;;;Software used to create the file;; Encoded_Library/String;;;Y NT;;;Software used to create the file;; Encoded_Library/Name;;;N NT;;;Info from the software;; Encoded_Library/Version;;;N NT;;;Version of software;; Encoded_Library/Date;;;N NT;;;Release date of software;; Encoded_Library_Settings;;;Y YT;;;Parameters used by the software;; Language;;;N YT;;;Language (2-letter ISO 639-1 if exists, else 3-letter ISO 639-2, and with optional ISO 3166-1 country separated by a dash if available, e.g. en, en-us, zh-cn);; Language/String;;;Y NT;;;Language (full);; Language/String1;;;N NT;;;Language (full);; Language/String2;;;N NT;;;Language (2-letter ISO 639-1 if exists, else empty);; Language/String3;;;N NT;;;Language (3-letter ISO 639-2 if exists, else empty);; Language/String4;;;N NT;;;Language (2-letter ISO 639-1 if exists with optional ISO 3166-1 country separated by a dash if available, e.g. en, en-us, zh-cn, else empty);; Language_More;;;Y YT;;;More info about Language (e.g. Director's Comment);; Default;;Yes;N YT;;;Set if that track should be used if no language found matches the user preference. Default/String;;;Y NT;;;Set if that track should be used if no language found matches the user preference. Forced;;Yes;N YT;;;Set if that track should be used if no language found matches the user preference. Forced/String;;;Y NT;;;Set if that track should be used if no language found matches the user preference. Summary;;;N NT;;;;; Encoded_Date;;;Y YT;;;The time that the encoding of this item was completed began.;;Temporal Tagged_Date;;;Y YT;;;The time that the tags were done for this item.;;Temporal Encryption;;;Y YT;;;;; colour_description_present;;;N YT;;;Presence of colour description colour_primaries;;;Y YT;;;Chromaticity coordinates of the source primaries transfer_characteristics;;;Y YT;;;Opto-electronic transfer characteristic of the source picture matrix_coefficients;;;Y YT;;;Matrix coefficients used in deriving luma and chroma signals from the green, blue, and red primaries colour_description_present_Original;;;N YT;;;Presence of colour description colour_primaries_Original;;;Y YT;;;Chromaticity coordinates of the source primaries transfer_characteristics_Original;;;Y YT;;;Opto-electronic transfer characteristic of the source picture matrix_coefficients_Original;;;Y YT;;;Matrix coefficients used in deriving luma and chroma signals from the green, blue, and red primaries MediaInfoLib/Source/Resource/Text/Stream/Menu.csv100777 0 0 11374 12226004261 15327 0Count;;;N NI;;;Count of objects available in this stream Status;;;N NI;;;bit field (0=IsAccepted, 1=IsFilled, 2=IsUpdated, 3=IsFinished) StreamCount;;;N NI;;;Count of streams of that kind available StreamKind;Menu;;N NT;;;Stream type name StreamKind/String;;;N NT;;;Stream type name StreamKindID;;;N NI;;;Number of the stream (base=0) StreamKindPos;;;N NI;;;When multiple streams, number of the stream (base=1) StreamOrder;;;N YI;;;Stream order in the file, whatever is the kind of stream (base=0) FirstPacketOrder;;;N YI;;;Order of the first fully decodable packet met in the file, whatever is the kind of stream (base=0) Inform;;;N NT;;;Last **Inform** call ID;;;N YI;;;The ID for this stream in this file ID/String;;;Y NT;;;The ID for this stream in this file UniqueID;;;N YI;;;The unique ID for this stream, should be copied with stream copy UniqueID/String;;;Y NT;;;The unique ID for this stream, should be copied with stream copy MenuID;;;N YI;;;The menu ID for this stream in this file MenuID/String;;;Y NT;;;The menu ID for this stream in this file Format;;;N YT;;;Format used Format/Info;;;N NT;;;Info about Format Format/Url;;;N NT;;;Link Format_Commercial;;;N NT;;;Commercial name used by vendor for theses setings or Format field if there is no difference Format_Commercial_IfAny;;;Y YT;;;Commercial name used by vendor for theses setings if there is one Format_Version;;;Y NT;;;Version of this format Format_Profile;;;Y NT;;;Profile of the Format Format_Compression;;;Y NT;;;Compression method used;; Format_Settings;;;Y NT;;;Settings needed for decoder used CodecID;;;Y YT;;;Codec ID (found in some containers);; CodecID/String;;;Y NT;;;Codec ID (found in some containers);; CodecID/Info;;;Y NT;;;Info about this codec CodecID/Hint;;;Y NT;;;A hint/popular name for this codec CodecID/Url;;;N NT;;;A link to more details about this codec ID CodecID_Description;;;Y YT;;;Manual description given by the container Codec;;;N YT;;;Deprecated Codec/String;;;N NT;;;Deprecated Codec/Info;;;N NT;;;Deprecated Codec/Url;;;N NT;;;Deprecated Duration;; ms;N YI;;;Play time of the stream in ms Duration/String;;;Y NT;;;Play time in format : XXx YYy only, YYy omited if zero Duration/String1;;;N NT;;;Play time in format : HHh MMmn SSs MMMms, XX omited if zero Duration/String2;;;N NT;;;Play time in format : XXx YYy only, YYy omited if zero Duration/String3;;;N NT;;;Play time in format : HH:MM:SS.MMM Duration_Start;;;Y YT;;; Duration_End;;;Y YT;;; Delay;; ms;N NI;;;Delay fixed in the stream (relative) IN MS; Delay/String;;;N NT;;;Delay with measurement; Delay/String1;;;N NT;;;Delay with measurement; Delay/String2;;;N NT;;;Delay with measurement; Delay/String3;;;N NT;;;Delay in format : HH:MM:SS.MMM; Delay/String4;;;N NT;;;Delay in format : HH:MM:SS:FF (HH:MM:SS;FF for drop frame, if available) Delay_Settings;;;N NT;;;Delay settings (in case of timecode for example); Delay_DropFrame;;;N NT;;;Delay drop frame; Delay_Source;;;N NT;;;Delay source (Container or Stream or empty); List_StreamKind;;;N YT;;;List of programs available List_StreamPos;;;N YT;;;List of programs available List;;;N YT;;;List of programs available List/String;;;Y NT;;;List of programs available Title;;;Y YI;;;Name of this menu Language;;;N YT;;;Language (2-letter ISO 639-1 if exists, else 3-letter ISO 639-2, and with optional ISO 3166-1 country separated by a dash if available, e.g. en, en-us, zh-cn) Language/String;;;Y NT;;;Language (full) Language/String1;;;N NT;;;Language (full);; Language/String2;;;N NT;;;Language (2-letter ISO 639-1 if exists, else empty);; Language/String3;;;N NT;;;Language (3-letter ISO 639-2 if exists, else empty);; Language/String4;;;N NT;;;Language (2-letter ISO 639-1 if exists with optional ISO 3166-1 country separated by a dash if available, e.g. en, en-us, zh-cn, else empty);; Language_More;;;Y YT;;;More info about Language (e.g. Director's Comment);; ServiceName;;;Y YT;;;;;Legal ServiceChannel;;;Y YT;;;;;Legal Service/Url;;;Y YT;;;;;Legal ServiceProvider;;;Y YT;;;;;Legal ServiceProviderr/Url;;;Y YT;;;;;Legal ServiceType;;;Y YT;;;;;Legal NetworkName;;;Y YT;;;;;Legal Original/NetworkName;;;Y YT;;;;;Legal Countries;;;Y YT;;;;;Legal TimeZones;;;Y YT;;;;;Legal LawRating;;;Y YT;;;Depending on the country it's the format of the rating of a movie (P, R, X in the USA, an age in other countries or a URI defining a logo).;;Classification LawRating_Reason;;;Y YT;;;Reason for the law rating;;Classification Chapters_Pos_Begin;;;N NI;;;Used by third-party developers to know about the beginning of the chapters list, to be used by Get(Stream_Menu, x, Pos), where Pos is an Integer between Chapters_Pos_Begin and Chapters_Pos_End;; Chapters_Pos_End;;;N NI;;;Used by third-party developers to know about the end of the chapters list (this position excluded) MediaInfoLib/Source/Resource/Text/Stream/Other.csv100777 0 0 7345 12226004261 15467 0Count;;;N NI;;;Count of objects available in this stream Status;;;N NI;;;bit field (0=IsAccepted, 1=IsFilled, 2=IsUpdated, 3=IsFinished) StreamCount;;;N NI;;;Count of streams of that kind available StreamKind;Other;;N NT;;;Stream type name StreamKind/String;;;N NT;;;Stream type name StreamKindID;;;N NI;;;Number of the stream (base=0) StreamKindPos;;;N NI;;;When multiple streams, number of the stream (base=1) StreamOrder;;;N YI;;;Stream order in the file, whatever is the kind of stream (base=0) FirstPacketOrder;;;N YI;;;Order of the first fully decodable packet met in the file, whatever is the kind of stream (base=0) Inform;;;N NT;;;Last **Inform** call ID;;;N YI;;;The ID for this stream in this file ID/String;;;Y NT;;;The ID for this stream in this file UniqueID;;;N YI;;;The unique ID for this stream, should be copied with stream copy UniqueID/String;;;Y NT;;;The unique ID for this stream, should be copied with stream copy MenuID;;;N YI;;;The menu ID for this stream in this file MenuID/String;;;Y NT;;;The menu ID for this stream in this file Type;;;Y YT;;;Type Format;;;Y YT;;;Format used Format/Info;;;N NT;;;Info about Format Format/Url;;;N NT;;;Link Format_Commercial;;;N NT;;;Commercial name used by vendor for theses setings or Format field if there is no difference Format_Commercial_IfAny;;;Y YT;;;Commercial name used by vendor for theses setings if there is one Format_Version;;;Y NT;;;Version of this format Format_Profile;;;Y NT;;;Profile of the Format Format_Compression;;;Y NT;;;Compression method used;; Format_Settings;;;Y NT;;;Settings needed for decoder used MuxingMode;;;Y YT;;;How this file is muxed in the container CodecID;;;Y YT;;;Codec ID (found in some containers);; CodecID/String;;;Y NT;;;Codec ID (found in some containers);; CodecID/Info;;;Y NT;;;Info about this codec CodecID/Hint;;;Y NT;;;A hint/popular name for this codec CodecID/Url;;;N NT;;;A link to more details about this codec ID CodecID_Description;;;Y YT;;;Manual description given by the container Duration;; ms;N YI;;;Play time of the stream in ms Duration/String;;;Y NT;;;Play time in format : XXx YYy only, YYy omited if zero Duration/String1;;;N NT;;;Play time in format : HHh MMmn SSs MMMms, XX omited if zero Duration/String2;;;N NT;;;Play time in format : XXx YYy only, YYy omited if zero Duration/String3;;;N NT;;;Play time in format : HH:MM:SS.MMM Duration_Start;;;Y YT;;; Duration_End;;;Y YT;;; FrameRate;; fps;N YF;;;Frames per second FrameRate/String;;;Y NT;;;Frames per second (with measurement) FrameCount;;;N NI;;;Number of frames TimeStamp_FirstFrame;; ms;N YI;;;TimeStamp fixed in the stream (relative) IN MS; TimeStamp_FirstFrame/String;;;Y NT;;;TimeStamp with measurement; TimeStamp_FirstFrame/String1;;;N NT;;;TimeStamp with measurement; TimeStamp_FirstFrame/String2;;;N NT;;;TimeStamp with measurement; TimeStamp_FirstFrame/String3;;;N NT;;;TimeStamp in format : HH:MM:SS.MMM; TimeCode_FirstFrame;;;Y YC;;;Time code in HH:MM:SS:FF (HH:MM:SS;FF for drop frame, if available) format TimeCode_Settings;;;Y YT;;;Time code settings Title;;;Y YI;;;Name of this menu Language;;;N YT;;;Language (2-letter ISO 639-1 if exists, else 3-letter ISO 639-2, and with optional ISO 3166-1 country separated by a dash if available, e.g. en, en-us, zh-cn) Language/String;;;Y NT;;;Language (full) Language/String1;;;N NT;;;Language (full);; Language/String2;;;N NT;;;Language (2-letter ISO 639-1 if exists, else empty);; Language/String3;;;N NT;;;Language (3-letter ISO 639-2 if exists, else empty);; Language/String4;;;N NT;;;Language (2-letter ISO 639-1 if exists with optional ISO 3166-1 country separated by a dash if available, e.g. en, en-us, zh-cn, else empty);; Language_More;;;Y YT;;;More info about Language (e.g. Director's Comment);; MediaInfoLib/Source/Resource/Text/Stream/Text.csv100777 0 0 32615 12226004261 15350 0Count;;;N NI;;;Count of objects available in this stream Status;;;N NI;;;bit field (0=IsAccepted, 1=IsFilled, 2=IsUpdated, 3=IsFinished) StreamCount;;;N NI;;;Count of streams of that kind available StreamKind;Text;;N NT;;;Stream type name StreamKind/String;;;N NT;;;Stream type name StreamKindID;;;N NI;;;Number of the stream (base=0) StreamKindPos;;;N NI;;;When multiple streams, number of the stream (base=1) StreamOrder;;;N YI;;;Stream order in the file, whatever is the kind of stream (base=0) FirstPacketOrder;;;N YI;;;Order of the first fully decodable packet met in the file, whatever is the kind of stream (base=0) Inform;;;N NT;;;Last **Inform** call ID;;;N YI;;;The ID for this stream in this file ID/String;;;Y NT;;;The ID for this stream in this file UniqueID;;;N YI;;;The unique ID for this stream, should be copied with stream copy UniqueID/String;;;Y NT;;;The unique ID for this stream, should be copied with stream copy MenuID;;;N YI;;;The menu ID for this stream in this file MenuID/String;;;Y NT;;;The menu ID for this stream in this file Format;;;Y YT;;;Format used Format/Info;;;Y NT;;;Info about Format Format/Url;;;N NT;;;Link Format_Commercial;;;N NT;;;Commercial name used by vendor for theses setings or Format field if there is no difference Format_Commercial_IfAny;;;Y YT;;;Commercial name used by vendor for theses setings if there is one Format_Version;;;Y NT;;;Version of this format Format_Profile;;;Y NT;;;Profile of the Format Format_Compression;;;Y NT;;;Compression method used;; Format_Settings;;;Y NT;;;Settings needed for decoder used Format_Settings_Wrapping;;;Y YT;;;Wrapping mode (Frame wrapped or Clip wrapped) InternetMediaType;;;N YT;;;Internet Media Type (aka MIME Type, Content-Type) MuxingMode;;;Y YT;;;How this stream is muxed in the container MuxingMode_MoreInfo;;;Y NT;;;More info (text) about the muxing mode CodecID;;;Y YT;;;Codec ID (found in some containers);; CodecID/String;;;Y NT;;;Codec ID (found in some containers);; CodecID/Info;;;Y NT;;;Info about codec ID CodecID/Hint;;;Y NT;;;A hint for this codec ID CodecID/Url;;;N NT;;;A link for more details about this codec ID CodecID_Description;;;Y YT;;;Manual description given by the container Codec;;;N YT;;;Deprecated Codec/String;;;N NT;;;Deprecated Codec/Info;;;N NT;;;Deprecated Codec/Url;;;N NT;;;Deprecated Codec/CC;;;N NT;;;Deprecated; Duration;; ms;N YI;;;Play time of the stream; Duration/String;;;Y NT;;;Play time (formated); Duration/String1;;;N NT;;;Play time in format : HHh MMmn SSs MMMms, XX omited if zero; Duration/String2;;;N NT;;;Play time in format : XXx YYy only, YYy omited if zero; Duration/String3;;;N NT;;;Play time in format : HH:MM:SS.MMM; Duration/String4;;;N NT;;;Play time in format : HH:MM:SS:FF (HH:MM:SS;FF for drop frame, if available) Duration_FirstFrame;; ms;N YI;;;Duration of the first frame if it is longer than others, in ms; Duration_FirstFrame/String;;;Y NT;;;Duration of the first frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Duration_FirstFrame/String1;;;N NT;;;Duration of the first frame if it is longer than others, in format : HHh MMmn SSs MMMms, XX omited if zero; Duration_FirstFrame/String2;;;N NT;;;Duration of the first frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Duration_FirstFrame/String3;;;N NT;;;Duration of the first frame if it is longer than others, in format : HH:MM:SS.MMM; Duration_LastFrame;; ms;N YI;;;Duration of the last frame if it is longer than others, in ms; Duration_LastFrame/String;;;Y NT;;;Duration of the last frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Duration_LastFrame/String1;;;N NT;;;Duration of the last frame if it is longer than others, in format : HHh MMmn SSs MMMms, XX omited if zero; Duration_LastFrame/String2;;;N NT;;;Duration of the last frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Duration_LastFrame/String3;;;N NT;;;Duration of the last frame if it is longer than others, in format : HH:MM:SS.MMM; Source_Duration;; ms;N YI;;;Source Play time of the stream;; Source_Duration/String;;;Y NT;;;Source Play time in format : XXx YYy only, YYy omited if zero;; Source_Duration/String1;;;N NT;;;Source Play time in format : HHh MMmn SSs MMMms, XX omited if zero;; Source_Duration/String2;;;N NT;;;Source Play time in format : XXx YYy only, YYy omited if zero;; Source_Duration/String3;;;N NT;;;Source Play time in format : HH:MM:SS.MMM;; Source_Duration_FirstFrame;; ms;N YI;;;Source Duration of the first frame if it is longer than others, in ms; Source_Duration_FirstFrame/String;;;Y NT;;;Source Duration of the first frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Source_Duration_FirstFrame/String1;;;N NT;;;Source Duration of the first frame if it is longer than others, in format : HHh MMmn SSs MMMms, XX omited if zero; Source_Duration_FirstFrame/String2;;;N NT;;;Source Duration of the first frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Source_Duration_FirstFrame/String3;;;N NT;;;Source Duration of the first frame if it is longer than others, in format : HH:MM:SS.MMM; Source_Duration_LastFrame;; ms;N YI;;;Source Duration of the last frame if it is longer than others, in ms; Source_Duration_LastFrame/String;;;Y NT;;;Source Duration of the last frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Source_Duration_LastFrame/String1;;;N NT;;;Source Duration of the last frame if it is longer than others, in format : HHh MMmn SSs MMMms, XX omited if zero; Source_Duration_LastFrame/String2;;;N NT;;;Source Duration of the last frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Source_Duration_LastFrame/String3;;;N NT;;;Source Duration of the last frame if it is longer than others, in format : HH:MM:SS.MMM; BitRate_Mode;;;N YT;;;Bit rate mode (VBR, CBR); BitRate_Mode/String;;;Y NT;;;Bit rate mode (Constant, Variable); BitRate;; bps;N YF;;;Bit rate in bps; BitRate/String;;;Y NT;;;Bit rate (with measurement); BitRate_Minimum;; bps;N YF;;;Minimum Bit rate in bps; BitRate_Minimum/String;;;Y NT;;;Minimum Bit rate (with measurement); BitRate_Nominal;; bps;N YF;;;Nominal Bit rate in bps; BitRate_Nominal/String;;;Y NT;;;Nominal Bit rate (with measurement); BitRate_Maximum;; bps;N YF;;;Maximum Bit rate in bps; BitRate_Maximum/String;;;Y NT;;;Maximum Bit rate (with measurement) BitRate_Encoded;; bps;N YF;;;Encoded (with forced padding) bit rate in bps, if some container padding is present BitRate_Encoded/String;;;Y NT;;;Encoded (with forced padding) bit rate (with measurement), if some container padding is present Width;; pixel;N YI;;;Width Width/String;;;Y NT;;; Height;; pixel;N YI;;;Height Height/String;;;Y NT;;; FrameRate_Mode;;;N YT;;;Frame rate mode (CFR, VFR) FrameRate_Mode/String;;;Y NT;;;Frame rate mode (Constant, Variable) FrameRate;; fps;N YF;;;Frames per second FrameRate/String;;;Y NT;;;Frames per second (with measurement) FrameRate_Minimum;; fps;N YF;;;Minimum Frames per second FrameRate_Minimum/String;;;Y NT;;;Minimum Frames per second (with measurement) FrameRate_Nominal;; fps;N YF;;;Nominal Frames per second FrameRate_Nominal/String;;;Y NT;;;Nominal Frames per second (with measurement) FrameRate_Maximum;; fps;N YF;;;Maximum Frames per second FrameRate_Maximum/String;;;Y NT;;;Maximum Frames per second (with measurement) FrameRate_Original;; fps;N YF;;;Original (in the raw stream) Frames per second FrameRate_Original/String;;;Y NT;;;Original (in the raw stream) Frames per second (with measurement) FrameCount;;;N NI;;;Number of frames Source_FrameCount;;;N NI;;;Source Number of frames ColorSpace;;;Y YT;;; ChromaSubsampling;;;Y YT;;; Resolution;; bit;N NI;;;Deprecated, do not use in new projects Resolution/String;;;N NT;;;Deprecated, do not use in new projects BitDepth;; bit;N YI;;; BitDepth/String;;;Y NT;;; Compression_Mode;;;N YT;;;Compression mode (Lossy or Lossless) Compression_Mode/String;;;Y NT;;;Compression mode (Lossy or Lossless) Compression_Ratio;;;Y YF;;;Current stream size divided by uncompressed stream size;; Delay;; ms;N NI;;;Delay fixed in the stream (relative) IN MS; Delay/String;;;N NT;;;Delay with measurement; Delay/String1;;;N NT;;;Delay with measurement; Delay/String2;;;N NT;;;Delay with measurement; Delay/String3;;;N NT;;;Delay in format : HH:MM:SS.MMM; Delay/String4;;;N NT;;;Delay in format : HH:MM:SS:FF (HH:MM:SS;FF for drop frame, if available) Delay_Settings;;;N NT;;;Delay settings (in case of timecode for example); Delay_DropFrame;;;N NT;;;Delay drop frame; Delay_Source;;;N NT;;;Delay source (Container or Stream or empty); Delay_Source/String;;;N NT;;;Delay source (Container or Stream or empty); Delay_Original;; ms;N NI;;;Delay fixed in the raw stream (relative) IN MS; Delay_Original/String;;;N NT;;;Delay with measurement; Delay_Original/String1;;;N NT;;;Delay with measurement; Delay_Original/String2;;;N NT;;;Delay with measurement; Delay_Original/String3;;;N NT;;;Delay in format: HH:MM:SS.MMM;; Delay_Original/String4;;;N NT;;;Delay in format: HH:MM:SS:FF (HH:MM:SS;FF for drop frame, if available); Delay_Original_Settings;;;N NT;;;Delay settings (in case of timecode for example);; Delay_Original_DropFrame;;;N NT;;;Delay drop frame info; Delay_Original_Source;;;N NT;;;Delay source (Stream or empty); Video_Delay;; ms;N NI;;;Delay fixed in the stream (absolute / video) Video_Delay/String;;;Y NT;;; Video_Delay/String1;;;N NT;;; Video_Delay/String2;;;N NT;;; Video_Delay/String3;;;N NT;;; Video_Delay/String4;;;N NT;;; Video0_Delay;; ms;N NI;;;Deprecated, do not use in new projects Video0_Delay/String;;;N NT;;;Deprecated, do not use in new projects Video0_Delay/String1;;;N NT;;;Deprecated, do not use in new projects Video0_Delay/String2;;;N NT;;;Deprecated, do not use in new projects Video0_Delay/String3;;;N NT;;;Deprecated, do not use in new projects Video0_Delay/String4;;;N NT;;;Deprecated, do not use in new projects StreamSize;; byte;N YI;;;Streamsize in bytes;; StreamSize/String;;;Y NT;;;Streamsize in with percentage value;; StreamSize/String1;;;N NT;;;;; StreamSize/String2;;;N NT;;;;; StreamSize/String3;;;N NT;;;;; StreamSize/String4;;;N NT;;;;; StreamSize/String5;;;N NT;;;Streamsize in with percentage value;; StreamSize_Proportion;;;N NT;;;Stream size divided by file size;; Source_StreamSize;; byte;N YI;;;Source Streamsize in bytes;; Source_StreamSize/String;;;Y NT;;;Source Streamsize in with percentage value;; Source_StreamSize/String1;;;N NT;;;;; Source_StreamSize/String2;;;N NT;;;;; Source_StreamSize/String3;;;N NT;;;;; Source_StreamSize/String4;;;N NT;;;;; Source_StreamSize/String5;;;N NT;;;Source Streamsize in with percentage value;; Source_StreamSize_Proportion;;;N NT;;;Source Stream size divided by file size;; StreamSize_Encoded;; byte;N YI;;;Encoded Streamsize in bytes;; StreamSize_Encoded/String;;;Y NT;;;Encoded Streamsize in with percentage value;; StreamSize_Encoded/String1;;;N NT;;;;; StreamSize_Encoded/String2;;;N NT;;;;; StreamSize_Encoded/String3;;;N NT;;;;; StreamSize_Encoded/String4;;;N NT;;;;; StreamSize_Encoded/String5;;;N NT;;;Encoded Streamsize in with percentage value;; StreamSize_Encoded_Proportion;;;N NT;;;Encoded Stream size divided by file size;; Source_StreamSize_Encoded;; byte;N YI;;;Source Encoded Streamsize in bytes;; Source_StreamSize_Encoded/String;;;Y NT;;;Source Encoded Streamsize in with percentage value;; Source_StreamSize_Encoded/String1;;;N NT;;;;; Source_StreamSize_Encoded/String2;;;N NT;;;;; Source_StreamSize_Encoded/String3;;;N NT;;;;; Source_StreamSize_Encoded/String4;;;N NT;;;;; Source_StreamSize_Encoded/String5;;;N NT;;;Source Encoded Streamsize in with percentage value;; Source_StreamSize_Encoded_Proportion;;;N NT;;;Source Encoded Stream size divided by file size;; Title;;;Y YI;;;Name of the track Encoded_Library;;;N YT;;;Software used to create the file Encoded_Library/String;;;Y NT;;;Software used to create the file Encoded_Library/Name;;;N NT;;;Info from the software Encoded_Library/Version;;;N NT;;;Version of software Encoded_Library/Date;;;N NT;;;Release date of software Encoded_Library_Settings;;;Y YT;;;Parameters used by the software Language;;;N YT;;;Language (2-letter ISO 639-1 if exists, else 3-letter ISO 639-2, and with optional ISO 3166-1 country separated by a dash if available, e.g. en, en-us, zh-cn) Language/String;;;Y NT;;;Language (full) Language/String1;;;N NT;;;Language (full) Language/String2;;;N NT;;;Language (2-letter ISO 639-1 if exists, else empty) Language/String3;;;N NT;;;Language (3-letter ISO 639-2 if exists, else empty);; Language/String4;;;N NT;;;Language (2-letter ISO 639-1 if exists with optional ISO 3166-1 country separated by a dash if available, e.g. en, en-us, zh-cn, else empty);; Language_More;;;Y YT;;;More info about Language (e.g. Director's Comment);; Default;;Yes;N YT;;;Set if that track should be used if no language found matches the user preference. Default/String;;;Y NT;;;Set if that track should be used if no language found matches the user preference. Forced;;Yes;N YT;;;Set if that track should be used if no language found matches the user preference. Forced/String;;;Y NT;;;Set if that track should be used if no language found matches the user preference. Summary;;;N NT;;;;; Encoded_Date;;;Y YT;;;The time that the encoding of this item was completed began.;;Temporal Tagged_Date;;;Y YT;;;The time that the tags were done for this item.;;Temporal Encryption;;;Y YT;;;;; MediaInfoLib/Source/Resource/Text/Stream/Video.csv100777 0 0 47461 12253120251 15475 0Count;;;N NI;;;Count of objects available in this stream Status;;;N NI;;;bit field (0=IsAccepted, 1=IsFilled, 2=IsUpdated, 3=IsFinished) StreamCount;;;N NI;;;Count of streams of that kind available StreamKind;Video;;N NT;;;Stream type name StreamKind/String;;;N NT;;;Stream type name StreamKindID;;;N NI;;;Number of the stream (base=0) StreamKindPos;;;N NI;;;When multiple streams, number of the stream (base=1) StreamOrder;;;N YI;;;Stream order in the file, whatever is the kind of stream (base=0) FirstPacketOrder;;;N YI;;;Order of the first fully decodable packet met in the file, whatever is the kind of stream (base=0) Inform;;;N NT;;;Last **Inform** call ID;;;N YI;;;The ID for this stream in this file ID/String;;;Y NT;;;The ID for this stream in this file UniqueID;;;N YI;;;The unique ID for this stream, should be copied with stream copy UniqueID/String;;;Y NT;;;The unique ID for this stream, should be copied with stream copy MenuID;;;N YI;;;The menu ID for this stream in this file MenuID/String;;;Y NT;;;The menu ID for this stream in this file Format;;;Y YT;;;Format used Format/Info;;;Y NT;;;Info about Format Format/Url;;;N NT;;;Link Format_Commercial;;;N NT;;;Commercial name used by vendor for theses setings or Format field if there is no difference Format_Commercial_IfAny;;;Y YT;;;Commercial name used by vendor for theses setings if there is one Format_Version;;;Y YT;;;Version of this format Format_Profile;;;Y YT;;;Profile of the Format Format_Compression;;;N YT;;;Compression mode of the Format MultiView_BaseProfile;;;Y YT;;;Multiview, profile of the base stream MultiView_Count;;;Y YT;;;Multiview, count of views MultiView_Layout;;;Y YT;;;Multiview, how views are muxed in the container in case of it is not muxing in the stream Format_Settings;;;N YT;;;Settings needed for decoder used, summary Format_Settings_BVOP;;Yes;N YT;;;Settings needed for decoder used, detailled Format_Settings_BVOP/String;;;Y NT;;;Settings needed for decoder used, detailled Format_Settings_QPel;;Yes;N YT;;;Settings needed for decoder used, detailled Format_Settings_QPel/String;;;Y NT;;;Settings needed for decoder used, detailled Format_Settings_GMC;; warppoint;N YI;;;Settings needed for decoder used, detailled Format_Settings_GMC/String;;;Y NT;;; Format_Settings_Matrix;;;N YT;;;Settings needed for decoder used, detailled Format_Settings_Matrix/String;;;Y NT;;;Settings needed for decoder used, detailled Format_Settings_Matrix_Data;;;N NT;;;Matrix, in binary format encoded BASE64. Order = intra, non-intra, gray intra, gray non-intra Format_Settings_CABAC;;Yes;N YT;;;Settings needed for decoder used, detailled Format_Settings_CABAC/String;;;Y NT;;;Settings needed for decoder used, detailled Format_Settings_RefFrames;; frame;N YI;;;Settings needed for decoder used, detailled Format_Settings_RefFrames/String;;;Y NT;;;Settings needed for decoder used, detailled Format_Settings_Pulldown;;;Y YT;;;Settings needed for decoder used, detailled Format_Settings_FrameMode;;;Y YT;;;Settings needed for decoder used, detailled Format_Settings_GOP;;;Y YT;;;Settings needed for decoder used, detailled (M=x N=y) Format_Settings_FrameStructures;;;Y YT;;;Settings needed for decoder used, detailled (Type of frame, and field/frame info) Format_Settings_Wrapping;;;Y YT;;;Wrapping mode (Frame wrapped or Clip wrapped) InternetMediaType;;;N YT;;;Internet Media Type (aka MIME Type, Content-Type) MuxingMode;;;Y YT;;;How this file is muxed in the container CodecID;;;Y YT;;;Codec ID (found in some containers);; CodecID/String;;;Y NT;;;Codec ID (found in some containers);; CodecID/Info;;;Y NT;;;Info on the codec CodecID/Hint;;;Y NT;;;Hint/popular name for this codec CodecID/Url;;;N NT;;;Homepage for more details about this codec CodecID_Description;;;Y YT;;;Manual description given by the container Codec;;;N NT;;;Deprecated, do not use in new projects Codec/String;;;N NT;;;Deprecated, do not use in new projects Codec/Family;;;N NT;;;Deprecated, do not use in new projects Codec/Info;;;N NT;;;Deprecated, do not use in new projects Codec/Url;;;N NT;;;Deprecated, do not use in new projects Codec/CC;;;N NT;;;Deprecated, do not use in new projects Codec_Profile;;;N NT;;;Deprecated, do not use in new projects Codec_Description;;;N NT;;;Deprecated, do not use in new projects Codec_Settings;;;N NT;;;Deprecated, do not use in new projects Codec_Settings_PacketBitStream;;;N NT;;;Deprecated, do not use in new projects Codec_Settings_BVOP;;;N NT;;;Deprecated, do not use in new projects Codec_Settings_QPel;;;N NT;;;Deprecated, do not use in new projects Codec_Settings_GMC;; warppoint;N NT;;;Deprecated, do not use in new projects Codec_Settings_GMC/String;;;N NT;;;Deprecated, do not use in new projects Codec_Settings_Matrix;;;N NT;;;Deprecated, do not use in new projects Codec_Settings_Matrix_Data;;;N NT;;;Deprecated, do not use in new projects Codec_Settings_CABAC;;;N NT;;;Deprecated, do not use in new projects Codec_Settings_RefFrames;;;N NT;;;Deprecated, do not use in new projects Duration;; ms;N YI;;;Play time of the stream in ms; Duration/String;;;Y NT;;;Play time in format : XXx YYy only, YYy omited if zero; Duration/String1;;;N NT;;;Play time in format : HHh MMmn SSs MMMms, XX omited if zero; Duration/String2;;;N NT;;;Play time in format : XXx YYy only, YYy omited if zero; Duration/String3;;;N NT;;;Play time in format : HH:MM:SS.MMM; Duration/String4;;;N NT;;;Play time in format : HH:MM:SS:FF (HH:MM:SS;FF for drop frame, if available) Duration_FirstFrame;; ms;N YI;;;Duration of the first frame if it is longer than others, in ms; Duration_FirstFrame/String;;;Y NT;;;Duration of the first frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Duration_FirstFrame/String1;;;N NT;;;Duration of the first frame if it is longer than others, in format : HHh MMmn SSs MMMms, XX omited if zero; Duration_FirstFrame/String2;;;N NT;;;Duration of the first frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Duration_FirstFrame/String3;;;N NT;;;Duration of the first frame if it is longer than others, in format : HH:MM:SS.MMM; Duration_LastFrame;; ms;N YI;;;Duration of the last frame if it is longer than others, in ms; Duration_LastFrame/String;;;Y NT;;;Duration of the last frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Duration_LastFrame/String1;;;N NT;;;Duration of the last frame if it is longer than others, in format : HHh MMmn SSs MMMms, XX omited if zero; Duration_LastFrame/String2;;;N NT;;;Duration of the last frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Duration_LastFrame/String3;;;N NT;;;Duration of the last frame if it is longer than others, in format : HH:MM:SS.MMM; Source_Duration;; ms;N YI;;;Source Play time of the stream;; Source_Duration/String;;;Y NT;;;Source Play time in format : XXx YYy only, YYy omited if zero;; Source_Duration/String1;;;N NT;;;Source Play time in format : HHh MMmn SSs MMMms, XX omited if zero;; Source_Duration/String2;;;N NT;;;Source Play time in format : XXx YYy only, YYy omited if zero;; Source_Duration/String3;;;N NT;;;Source Play time in format : HH:MM:SS.MMM;; Source_Duration_FirstFrame;; ms;N YI;;;Source Duration of the first frame if it is longer than others, in ms; Source_Duration_FirstFrame/String;;;Y NT;;;Source Duration of the first frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Source_Duration_FirstFrame/String1;;;N NT;;;Source Duration of the first frame if it is longer than others, in format : HHh MMmn SSs MMMms, XX omited if zero; Source_Duration_FirstFrame/String2;;;N NT;;;Source Duration of the first frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Source_Duration_FirstFrame/String3;;;N NT;;;Source Duration of the first frame if it is longer than others, in format : HH:MM:SS.MMM; Source_Duration_LastFrame;; ms;N YI;;;Source Duration of the last frame if it is longer than others, in ms; Source_Duration_LastFrame/String;;;Y NT;;;Source Duration of the last frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Source_Duration_LastFrame/String1;;;N NT;;;Source Duration of the last frame if it is longer than others, in format : HHh MMmn SSs MMMms, XX omited if zero; Source_Duration_LastFrame/String2;;;N NT;;;Source Duration of the last frame if it is longer than others, in format : XXx YYy only, YYy omited if zero; Source_Duration_LastFrame/String3;;;N NT;;;Source Duration of the last frame if it is longer than others, in format : HH:MM:SS.MMM; BitRate_Mode;;;N YT;;;Bit rate mode (VBR, CBR); BitRate_Mode/String;;;Y NT;;;Bit rate mode (Variable, Cconstant); BitRate;; bps;N YF;;;Bit rate in bps; BitRate/String;;;Y NT;;;Bit rate (with measurement); BitRate_Minimum;; bps;N YF;;;Minimum Bit rate in bps; BitRate_Minimum/String;;;Y NT;;;Minimum Bit rate (with measurement) BitRate_Nominal;; bps;N YF;;;Nominal Bit rate in bps BitRate_Nominal/String;;;Y NT;;;Nominal Bit rate (with measurement) BitRate_Maximum;; bps;N YF;;;Maximum Bit rate in bps BitRate_Maximum/String;;;Y NT;;;Maximum Bit rate (with measurement) BitRate_Encoded;; bps;N YF;;;Encoded (with forced padding) bit rate in bps, if some container padding is present BitRate_Encoded/String;;;Y NT;;;Encoded (with forced padding) bit rate (with measurement), if some container padding is present Width;; pixel;N YI;;;Width (aperture size if present) in pixel Width/String;;;Y NT;;;Width (aperture size if present) with measurement (pixel) Width_Offset;; pixel;N YI;;;Offset between original width and displayed width (aperture size) in pixel Width_Offset/String;;;N NT;;;Offset between original width and displayed width (aperture size) in pixel Width_Original;; pixel;N YI;;;Original (in the raw stream) width in pixel Width_Original/String;;;Y NT;;;Original (in the raw stream) width with measurement (pixel) Height;; pixel;N YI;;;Height (aperture size if present) in pixel Height/String;;;Y NT;;;Height (aperture size if present) with measurement (pixel) Height_Offset;; pixel;N YI;;;Offset between original height and displayed height (aperture size) in pixel Height_Offset/String;;;N NT;;;Offset between original height and displayed height (aperture size) in pixel Height_Original;; pixel;N YI;;;Original (in the raw stream) height in pixel Height_Original/String;;;Y NT;;;Original (in the raw stream) height with measurement (pixel) PixelAspectRatio;;;N YF;;;Pixel Aspect ratio PixelAspectRatio/String;;;N NT;;;Pixel Aspect ratio PixelAspectRatio_Original;;;N YF;;;Original (in the raw stream) Pixel Aspect ratio PixelAspectRatio_Original/String;;;N NT;;;Original (in the raw stream) Pixel Aspect ratio DisplayAspectRatio;;;N YF;;;Display Aspect ratio DisplayAspectRatio/String;;;Y NT;;;Display Aspect ratio DisplayAspectRatio_Original;;;N YF;;;Original (in the raw stream) Display Aspect ratio DisplayAspectRatio_Original/String;;;Y NT;;;Original (in the raw stream) Display Aspect ratio ActiveFormatDescription;;;N YN;;;Active Format Description (AFD value) ActiveFormatDescription/String;;;Y NT;;;Active Format Description (text) ActiveFormatDescription_MuxingMode;;;N YT;;;Active Format Description (AFD value) muxing mode (Ancillary or Raw stream) Rotation;;;N YT;;;Rotation Rotation/String;;;Y NT;;;Rotation (if not horizontal) FrameRate_Mode;;;N YT;;;Frame rate mode (CFR, VFR) FrameRate_Mode/String;;;Y NT;;;Frame rate mode (Constant, Variable) FrameRate_Mode_Original;;;N YT;;;Original frame rate mode (CFR, VFR) FrameRate_Mode_Original/String;;;Y NT;;;Original frame rate mode (Constant, Variable) FrameRate;; fps;N YF;;;Frames per second FrameRate/String;;;Y NT;;;Frames per second (with measurement) FrameRate_Original;; fps;N YF;;;Original (in the raw stream) frames per second FrameRate_Original/String;;;Y NT;;;Original (in the raw stream) frames per second (with measurement) FrameRate_Minimum;; fps;N YF;;;Minimum Frames per second FrameRate_Minimum/String;;;Y NT;;;Minimum Frames per second (with measurement) FrameRate_Nominal;; fps;N YF;;;Nominal Frames per second FrameRate_Nominal/String;;;Y NT;;;Nominal Frames per second (with measurement) FrameRate_Maximum;; fps;N YF;;;Maximum Frames per second FrameRate_Maximum/String;;;Y NT;;;Maximum Frames per second (with measurement) FrameCount;;;N NI;;;Number of frames Source_FrameCount;;;N NI;;;Source Number of frames Standard;;;Y NT;;;NTSC or PAL Resolution;; bit;N NI;;;Deprecated, do not use in new projects Resolution/String;;;N NT;;;Deprecated, do not use in new projects Colorimetry;;;N NT;;;Deprecated, do not use in new projects ColorSpace;;;Y YT;;; ChromaSubsampling;;;Y YT;;; BitDepth;; bit;N YI;;;16/24/32 BitDepth/String;;;Y NT;;;16/24/32 bits ScanType;;;N YT;;; ScanType/String;;;Y NT;;; ScanType_Original;;;N YT;;; ScanType_Original/String;;;Y NT;;; ScanOrder;;;N YT;;;; ScanOrder/String;;;Y NT;;;; ScanOrder_StoredDisplayedInverted;;;Y YT;;;; ScanOrder_Original;;;N YT;;;; ScanOrder_Original/String;;;Y NT;;;; Interlacement;;;N NT;;;Deprecated, do not use in new projects; Interlacement/String;;;N NT;;;Deprecated, do not use in new projects; Compression_Mode;;;N YT;;;Compression mode (Lossy or Lossless) Compression_Mode/String;;;Y NT;;;Compression mode (Lossy or Lossless) Compression_Ratio;;;Y YF;;;Current stream size divided by uncompressed stream size;; Bits-(Pixel*Frame);;;Y NF;;;bits/(Pixel*Frame) (like Gordian Knot); Delay;; ms;N NI;;;Delay fixed in the stream (relative) IN MS; Delay/String;;;N NT;;;Delay with measurement; Delay/String1;;;N NT;;;Delay with measurement; Delay/String2;;;N NT;;;Delay with measurement; Delay/String3;;;N NT;;;Delay in format : HH:MM:SS.MMM; Delay/String4;;;N NT;;;Delay in format : HH:MM:SS:FF (HH:MM:SS;FF for drop frame, if available) Delay_Settings;;;N NT;;;Delay settings (in case of timecode for example); Delay_DropFrame;;;N NT;;;Delay drop frame; Delay_Source;;;N NT;;;Delay source (Container or Stream or empty); Delay_Source/String;;;N NT;;;Delay source (Container or Stream or empty); Delay_Original;; ms;N NI;;;Delay fixed in the raw stream (relative) IN MS; Delay_Original/String;;;N NT;;;Delay with measurement; Delay_Original/String1;;;N NT;;;Delay with measurement; Delay_Original/String2;;;N NT;;;Delay with measurement; Delay_Original/String3;;;N NT;;;Delay in format: HH:MM:SS.MMM;; Delay_Original/String4;;;N NT;;;Delay in format: HH:MM:SS:FF (HH:MM:SS;FF for drop frame, if available); Delay_Original_Settings;;;N NT;;;Delay settings (in case of timecode for example);; Delay_Original_DropFrame;;;N NT;;;Delay drop frame info; Delay_Original_Source;;;N NT;;;Delay source (Stream or empty); TimeStamp_FirstFrame;; ms;N YI;;;TimeStamp fixed in the stream (relative) IN MS; TimeStamp_FirstFrame/String;;;Y NT;;;TimeStamp with measurement; TimeStamp_FirstFrame/String1;;;N NT;;;TimeStamp with measurement; TimeStamp_FirstFrame/String2;;;N NT;;;TimeStamp with measurement; TimeStamp_FirstFrame/String3;;;N NT;;;TimeStamp in format : HH:MM:SS.MMM; TimeCode_FirstFrame;;;Y YC;;;Time code in HH:MM:SS:FF (HH:MM:SS;FF for drop frame, if available) format TimeCode_Settings;;;Y YT;;;Time code settings TimeCode_Source;;;Y YT;;;Time code source (Container, Stream, SystemScheme1, SDTI, ANC...) StreamSize;; byte;N YI;;;Streamsize in bytes;; StreamSize/String;;;Y NT;;;Streamsize in with percentage value;; StreamSize/String1;;;N NT;;;;; StreamSize/String2;;;N NT;;;;; StreamSize/String3;;;N NT;;;;; StreamSize/String4;;;N NT;;;;; StreamSize/String5;;;N NT;;;Streamsize in with percentage value;; StreamSize_Proportion;;;N NT;;;Stream size divided by file size;; Source_StreamSize;; byte;N YI;;;Source Streamsize in bytes;; Source_StreamSize/String;;;Y NT;;;Source Streamsize in with percentage value;; Source_StreamSize/String1;;;N NT;;;;; Source_StreamSize/String2;;;N NT;;;;; Source_StreamSize/String3;;;N NT;;;;; Source_StreamSize/String4;;;N NT;;;;; Source_StreamSize/String5;;;N NT;;;Source Streamsize in with percentage value;; Source_StreamSize_Proportion;;;N NT;;;Source Stream size divided by file size;; StreamSize_Encoded;; byte;N YI;;;Encoded Streamsize in bytes;; StreamSize_Encoded/String;;;Y NT;;;Encoded Streamsize in with percentage value;; StreamSize_Encoded/String1;;;N NT;;;;; StreamSize_Encoded/String2;;;N NT;;;;; StreamSize_Encoded/String3;;;N NT;;;;; StreamSize_Encoded/String4;;;N NT;;;;; StreamSize_Encoded/String5;;;N NT;;;Encoded Streamsize in with percentage value;; StreamSize_Encoded_Proportion;;;N NT;;;Encoded Stream size divided by file size;; Source_StreamSize_Encoded;; byte;N YI;;;Source Encoded Streamsize in bytes;; Source_StreamSize_Encoded/String;;;Y NT;;;Source Encoded Streamsize in with percentage value;; Source_StreamSize_Encoded/String1;;;N NT;;;;; Source_StreamSize_Encoded/String2;;;N NT;;;;; Source_StreamSize_Encoded/String3;;;N NT;;;;; Source_StreamSize_Encoded/String4;;;N NT;;;;; Source_StreamSize_Encoded/String5;;;N NT;;;Source Encoded Streamsize in with percentage value;; Source_StreamSize_Encoded_Proportion;;;N NT;;;Source Encoded Stream size divided by file size;; Alignment;;;Y NT;;;How this stream file is aligned in the container;; Alignment/String;;;N YT;;;;; Title;;;Y YI;;;Name of the track;; Encoded_Application;;;Y YT;;;Software. Identifies the name of the software package used to create the file, such as Microsoft WaveEdit.;;Technical Encoded_Application/Url;;;N YT;;;Software. Identifies the name of the software package used to create the file, such as Microsoft WaveEdit.;;Technical Encoded_Library;;;N YT;;;Software used to create the file;; Encoded_Library/String;;;Y NT;;;Software used to create the file;; Encoded_Library/Name;;;N NT;;;Info from the software;; Encoded_Library/Version;;;N NT;;;Version of software;; Encoded_Library/Date;;;N NT;;;Release date of software;; Encoded_Library_Settings;;;Y YT;;;Parameters used by the software;; Language;;;N YT;;;Language (2-letter ISO 639-1 if exists, else 3-letter ISO 639-2, and with optional ISO 3166-1 country separated by a dash if available, e.g. en, en-us, zh-cn);; Language/String;;;Y NT;;;Language (full);; Language/String1;;;N NT;;;Language (full);; Language/String2;;;N NT;;;Language (2-letter ISO 639-1 if exists, else empty);; Language/String3;;;N NT;;;Language (3-letter ISO 639-2 if exists, else empty);; Language/String4;;;N NT;;;Language (2-letter ISO 639-1 if exists with optional ISO 3166-1 country separated by a dash if available, e.g. en, en-us, zh-cn, else empty);; Language_More;;;Y YT;;;More info about Language (e.g. Director's Comment);; Default;;Yes;N YT;;;Set if that track should be used if no language found matches the user preference. Default/String;;;Y NT;;;Set if that track should be used if no language found matches the user preference. Forced;;Yes;N YT;;;Set if that track should be used if no language found matches the user preference. Forced/String;;;Y NT;;;Set if that track should be used if no language found matches the user preference. Encoded_Date;;;Y YT;;;UTC time that the encoding of this item was completed began.;;Temporal Tagged_Date;;;Y YT;;;UTC time that the tags were done for this item.;;Temporal Encryption;;;Y YT;;;;; BufferSize;;;N YT;;;Defines the size of the buffer needed to decode the sequence. colour_description_present;;;N YT;;;Presence of colour description colour_primaries;;;Y YT;;;Chromaticity coordinates of the source primaries transfer_characteristics;;;Y YT;;;Opto-electronic transfer characteristic of the source picture matrix_coefficients;;;Y YT;;;Matrix coefficients used in deriving luma and chroma signals from the green, blue, and red primaries colour_description_present_Original;;;N YT;;;Presence of colour description colour_primaries_Original;;;Y YT;;;Chromaticity coordinates of the source primaries transfer_characteristics_Original;;;Y YT;;;Opto-electronic transfer characteristic of the source picture matrix_coefficients_Original;;;Y YT;;;Matrix coefficients used in deriving luma and chroma signals from the green, blue, and red primaries MediaInfoLib/Source/Resource/Text/_.1.txt100777 0 0 1511 12226004261 13541 0/* 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. */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Automaticly generated methods for MediaInfo // Don't modify, this will be deleted at the next automatic update // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- #include "MediaInfo/PreComp.h" #include "ZenLib/ZtringListList.h" #include "ZenLib/InfoMap.h" #include "ZenLib/Translation.h" using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { MediaInfoLib/Source/Resource/Text/_.2.txt100777 0 0 274 12226004261 13527 0 //--------------------------------------------------------------------------- void %Name% (%Class% &Info) { Info.Separator_Set(0, __T("\n")); Info.Write(Ztring().From_UTF8( MediaInfoLib/Source/Resource/Text/_.5.txt100777 0 0 20 12226004261 13477 0 "%Line%\n" MediaInfoLib/Source/Resource/Text/_.8.txt100777 0 0 65 12226004261 13513 0 )); Info.Separator_Set(0, ZenLib::EOL); } MediaInfoLib/Source/Resource/Text/_.9.txt100777 0 0 21 12226004261 13504 0 } //NameSpace MediaInfoLib/Source/ThirdParty/ 40777 0 0 0 12226004261 11704 5MediaInfoLib/Source/ThirdParty/base64/ 40777 0 0 0 12226004261 12770 5MediaInfoLib/Source/ThirdParty/base64/base64.h100777 0 0 13353 12226004261 14352 0//  // // #### ### ## -= Base64 library =-  // // # # # # # Base64.h - Base64 encoder/decoder  // // #### #### # #  // // # # # # ##### Encodes and decodes base64 strings  // // # # # # # Ideas taken from work done by Bob Withers  // // #### ### # R1 2002-05-07 by Markus Ewald  // //  // #ifndef B64_BASE64_H #define B64_BASE64_H #include namespace Base64 { /// Encode string to base64 inline std::string encode(const std::string &sString); /// Encode base64 into string inline std::string decode(const std::string &sString); }; // namespace Base64 // ####################################################################### // // # Base64::encode() # // // ####################################################################### // /** Encodes the specified string to base64 @param sString String to encode @return Base64 encoded string */ inline std::string Base64::encode(const std::string &sString) { static const std::string sBase64Table( // 0000000000111111111122222222223333333333444444444455555555556666 // 0123456789012345678901234567890123456789012345678901234567890123 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" ); static const char cFillChar = '='; std::string::size_type nLength = sString.length(); std::string sResult; // Allocate memory for the converted string sResult.reserve(nLength * 8 / 6 + 1); for(std::string::size_type nPos = 0; nPos < nLength; nPos++) { char cCode; // Encode the first 6 bits cCode = (sString[nPos] >> 2) & 0x3f; sResult.append(1, sBase64Table[cCode]); // Encode the remaining 2 bits with the next 4 bits (if present) cCode = (sString[nPos] << 4) & 0x3f; if(++nPos < nLength) cCode |= (sString[nPos] >> 4) & 0x0f; sResult.append(1, sBase64Table[cCode]); if(nPos < nLength) { cCode = (sString[nPos] << 2) & 0x3f; if(++nPos < nLength) cCode |= (sString[nPos] >> 6) & 0x03; sResult.append(1, sBase64Table[cCode]); } else { ++nPos; sResult.append(1, cFillChar); } if(nPos < nLength) { cCode = sString[nPos] & 0x3f; sResult.append(1, sBase64Table[cCode]); } else { sResult.append(1, cFillChar); } } return sResult; } // ####################################################################### // // # Base64::decode() # // // ####################################################################### // /** Decodes the specified base64 string @param sString Base64 string to decode @return Decoded string */ inline std::string Base64::decode(const std::string &sString) { static const std::string::size_type np = std::string::npos; static const std::string::size_type DecodeTable[] = { // 0 1 2 3 4 5 6 7 8 9 np, np, np, np, np, np, np, np, np, np, // 0 - 9 np, np, np, np, np, np, np, np, np, np, // 10 - 19 np, np, np, np, np, np, np, np, np, np, // 20 - 29 np, np, np, np, np, np, np, np, np, np, // 30 - 39 np, np, np, 62, np, np, np, 63, 52, 53, // 40 - 49 54, 55, 56, 57, 58, 59, 60, 61, np, np, // 50 - 59 np, np, np, np, np, 0, 1, 2, 3, 4, // 60 - 69 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 70 - 79 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // 80 - 89 25, np, np, np, np, np, np, 26, 27, 28, // 90 - 99 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, // 100 - 109 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, // 110 - 119 49, 50, 51, np, np, np, np, np, np, np, // 120 - 129 np, np, np, np, np, np, np, np, np, np, // 130 - 139 np, np, np, np, np, np, np, np, np, np, // 140 - 149 np, np, np, np, np, np, np, np, np, np, // 150 - 159 np, np, np, np, np, np, np, np, np, np, // 160 - 169 np, np, np, np, np, np, np, np, np, np, // 170 - 179 np, np, np, np, np, np, np, np, np, np, // 180 - 189 np, np, np, np, np, np, np, np, np, np, // 190 - 199 np, np, np, np, np, np, np, np, np, np, // 200 - 209 np, np, np, np, np, np, np, np, np, np, // 210 - 219 np, np, np, np, np, np, np, np, np, np, // 220 - 229 np, np, np, np, np, np, np, np, np, np, // 230 - 239 np, np, np, np, np, np, np, np, np, np, // 240 - 249 np, np, np, np, np, np // 250 - 256 }; static const char cFillChar = '='; std::string::size_type nLength = sString.length(); std::string sResult; sResult.reserve(nLength); for(std::string::size_type nPos = 0; nPos < nLength; nPos++) { unsigned char c, c1; c = (char) DecodeTable[(unsigned char)sString[nPos]]; nPos++; c1 = (char) DecodeTable[(unsigned char)sString[nPos]]; c = (c << 2) | ((c1 >> 4) & 0x3); sResult.append(1, c); if(++nPos < nLength) { c = sString[nPos]; if(cFillChar == c) break; c = (char) DecodeTable[(unsigned char)sString[nPos]]; c1 = ((c1 << 4) & 0xf0) | ((c >> 2) & 0xf); sResult.append(1, c1); } if(++nPos < nLength) { c1 = sString[nPos]; if(cFillChar == c1) break; c1 = (char) DecodeTable[(unsigned char)sString[nPos]]; c = ((c << 6) & 0xc0) | c1; sResult.append(1, c); } } return sResult; } #endif // B64_BASE64_H MediaInfoLib/Source/ThirdParty/md5/ 40777 0 0 0 12226004261 12371 5MediaInfoLib/Source/ThirdParty/md5/md5.c100777 0 0 17560 12226004261 13353 0/* * This code implements the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. This code was * written by Colin Plumb in 1993, no copyright is claimed. * This code is in the public domain; do with it what you wish. * * Equivalent code is available from RSA Data Security, Inc. * This code has been tested against that, and is equivalent, * except that you don't need to include two pages of legalese * with every copy. * * To compute the message digest of a chunk of bytes, declare an * MD5Context structure, pass it to MD5Init, call MD5Update as * needed on buffers full of bytes, and then call MD5Final, which * will fill a supplied 16-byte array with the digest. */ #include #include #if defined(__sparc__) || defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__) #define byteReverse(buf, len) /* Nothing */ #else void byteReverse(unsigned char *buf, unsigned longs); #ifndef ASM_MD5 /* * Note: this code is harmless on little-endian machines. */ void byteReverse(unsigned char *buf, unsigned longs) { uint32_t t; do { t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 | ((unsigned) buf[1] << 8 | buf[0]); *(uint32_t *) buf = t; buf += 4; } while (--longs); } #endif #endif /* * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious * initialization constants. */ void MD5Init(struct MD5Context *ctx) { ctx->buf[0] = 0x67452301; ctx->buf[1] = 0xefcdab89; ctx->buf[2] = 0x98badcfe; ctx->buf[3] = 0x10325476; ctx->bits[0] = 0; ctx->bits[1] = 0; } /* * Update context to reflect the concatenation of another buffer full * of bytes. */ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) { uint32_t t; /* Update bitcount */ t = ctx->bits[0]; if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t) ctx->bits[1]++; /* Carry from low to high */ ctx->bits[1] += len >> 29; t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ /* Handle any leading odd-sized chunks */ if (t) { unsigned char *p = (unsigned char *) ctx->in + t; t = 64 - t; if (len < t) { memcpy(p, buf, len); return; } memcpy(p, buf, t); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (uint32_t *) ctx->in); buf += t; len -= t; } /* Process data in 64-byte chunks */ while (len >= 64) { memcpy(ctx->in, buf, 64); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (uint32_t *) ctx->in); buf += 64; len -= 64; } /* Handle any remaining bytes of data. */ memcpy(ctx->in, buf, len); } /* * Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) */ void MD5Final(unsigned char digest[16], struct MD5Context *ctx) { unsigned count; unsigned char *p; /* Compute number of bytes mod 64 */ count = (ctx->bits[0] >> 3) & 0x3F; /* Set the first char of padding to 0x80. This is safe since there is always at least one byte free */ p = ctx->in + count; *p++ = 0x80; /* Bytes of padding needed to make 64 bytes */ count = 64 - 1 - count; /* Pad out to 56 mod 64 */ if (count < 8) { /* Two lots of padding: Pad the first block to 64 bytes */ memset(p, 0, count); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (uint32_t *) ctx->in); /* Now fill the next block with 56 bytes */ memset(ctx->in, 0, 56); } else { /* Pad block to 56 bytes */ memset(p, 0, count - 8); } byteReverse(ctx->in, 14); /* Append length in bits and transform */ ((uint32_t *) ctx->in)[14] = ctx->bits[0]; ((uint32_t *) ctx->in)[15] = ctx->bits[1]; MD5Transform(ctx->buf, (uint32_t *) ctx->in); byteReverse((unsigned char *) ctx->buf, 4); memcpy(digest, ctx->buf, 16); memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ } #ifndef ASM_MD5 /* The four core functions - F1 is optimized somewhat */ /* #define F1(x, y, z) (x & y | ~x & z) */ #define F1(x, y, z) (z ^ (x & (y ^ z))) #define F2(x, y, z) F1(z, x, y) #define F3(x, y, z) (x ^ y ^ z) #define F4(x, y, z) (y ^ (x | ~z)) /* This is the central step in the MD5 algorithm. */ #define MD5STEP(f, w, x, y, z, data, s) \ ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) /* * The core of the MD5 algorithm, this alters an existing MD5 hash to * reflect the addition of 16 longwords of new data. MD5Update blocks * the data and converts bytes into longwords for this routine. */ void MD5Transform(uint32_t buf[4], uint32_t const in[16]) { register uint32_t a, b, c, d; a = buf[0]; b = buf[1]; c = buf[2]; d = buf[3]; MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); buf[0] += a; buf[1] += b; buf[2] += c; buf[3] += d; } #endif MediaInfoLib/Source/ThirdParty/md5/md5.h100777 0 0 1020 12226004261 13320 0#ifndef MD5_H #define MD5_H #if defined(_MSC_VER) && _MSC_VER < 1600 typedef unsigned __int32 uint32_t; #else #include #endif struct MD5Context { uint32_t buf[4]; uint32_t bits[2]; unsigned char in[64]; }; void MD5Init(struct MD5Context *context); void MD5Update(struct MD5Context *context, unsigned char const *buf, unsigned len); void MD5Final(unsigned char digest[16], struct MD5Context *context); void MD5Transform(uint32_t buf[4], uint32_t const in[16]); #endif /* !MD5_H */ MediaInfoLib/Source/ThirdParty/tinyxml2/ 40777 0 0 0 12226004261 13472 5MediaInfoLib/Source/ThirdParty/tinyxml2/tinyxml2.cpp100777 0 0 147153 12226004261 16137 0/* Original code by Lee Thomason (www.grinninglizard.com) This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "tinyxml2.h" #include // yes, this one new style header, is in the Android SDK. # ifdef ANDROID_NDK # include #else # include #endif static const char LINE_FEED = (char)0x0a; // all line endings are normalized to LF static const char LF = LINE_FEED; static const char CARRIAGE_RETURN = (char)0x0d; // CR gets filtered out static const char CR = CARRIAGE_RETURN; static const char SINGLE_QUOTE = '\''; static const char DOUBLE_QUOTE = '\"'; // Bunch of unicode info at: // http://www.unicode.org/faq/utf_bom.html // ef bb bf (Microsoft "lead bytes") - designates UTF-8 static const unsigned char TIXML_UTF_LEAD_0 = 0xefU; static const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; static const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; #define DELETE_NODE( node ) { \ if ( node ) { \ MemPool* pool = node->_memPool; \ node->~XMLNode(); \ pool->Free( node ); \ } \ } #define DELETE_ATTRIBUTE( attrib ) { \ if ( attrib ) { \ MemPool* pool = attrib->_memPool; \ attrib->~XMLAttribute(); \ pool->Free( attrib ); \ } \ } namespace tinyxml2 { struct Entity { const char* pattern; int length; char value; }; static const int NUM_ENTITIES = 5; static const Entity entities[NUM_ENTITIES] = { { "quot", 4, DOUBLE_QUOTE }, { "amp", 3, '&' }, { "apos", 4, SINGLE_QUOTE }, { "lt", 2, '<' }, { "gt", 2, '>' } }; StrPair::~StrPair() { Reset(); } void StrPair::Reset() { if ( _flags & NEEDS_DELETE ) { delete [] _start; } _flags = 0; _start = 0; _end = 0; } void StrPair::SetStr( const char* str, int flags ) { Reset(); size_t len = strlen( str ); _start = new char[ len+1 ]; memcpy( _start, str, len+1 ); _end = _start + len; _flags = flags | NEEDS_DELETE; } char* StrPair::ParseText( char* p, const char* endTag, int strFlags ) { TIXMLASSERT( endTag && *endTag ); char* start = p; // fixme: hides a member char endChar = *endTag; size_t length = strlen( endTag ); // Inner loop of text parsing. while ( *p ) { if ( *p == endChar && strncmp( p, endTag, length ) == 0 ) { Set( start, p, strFlags ); return p + length; } ++p; } return 0; } char* StrPair::ParseName( char* p ) { char* start = p; if ( !start || !(*start) ) { return 0; } while( *p && ( p == start ? XMLUtil::IsNameStartChar( *p ) : XMLUtil::IsNameChar( *p ) )) { ++p; } if ( p > start ) { Set( start, p, 0 ); return p; } return 0; } void StrPair::CollapseWhitespace() { // Trim leading space. _start = XMLUtil::SkipWhiteSpace( _start ); if ( _start && *_start ) { char* p = _start; // the read pointer char* q = _start; // the write pointer while( *p ) { if ( XMLUtil::IsWhiteSpace( *p )) { p = XMLUtil::SkipWhiteSpace( p ); if ( *p == 0 ) { break; // don't write to q; this trims the trailing space. } *q = ' '; ++q; } *q = *p; ++q; ++p; } *q = 0; } } const char* StrPair::GetStr() { if ( _flags & NEEDS_FLUSH ) { *_end = 0; _flags ^= NEEDS_FLUSH; if ( _flags ) { char* p = _start; // the read pointer char* q = _start; // the write pointer while( p < _end ) { if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == CR ) { // CR-LF pair becomes LF // CR alone becomes LF // LF-CR becomes LF if ( *(p+1) == LF ) { p += 2; } else { ++p; } *q++ = LF; } else if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == LF ) { if ( *(p+1) == CR ) { p += 2; } else { ++p; } *q++ = LF; } else if ( (_flags & NEEDS_ENTITY_PROCESSING) && *p == '&' ) { // Entities handled by tinyXML2: // - special entities in the entity table [in/out] // - numeric character reference [in] // 中 or 中 if ( *(p+1) == '#' ) { char buf[10] = { 0 }; int len; p = const_cast( XMLUtil::GetCharacterRef( p, buf, &len ) ); for( int i=0; i(p); // Check for BOM: if ( *(pu+0) == TIXML_UTF_LEAD_0 && *(pu+1) == TIXML_UTF_LEAD_1 && *(pu+2) == TIXML_UTF_LEAD_2 ) { *bom = true; p += 3; } return p; } void XMLUtil::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ) { const unsigned long BYTE_MASK = 0xBF; const unsigned long BYTE_MARK = 0x80; const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; if (input < 0x80) { *length = 1; } else if ( input < 0x800 ) { *length = 2; } else if ( input < 0x10000 ) { *length = 3; } else if ( input < 0x200000 ) { *length = 4; } else { *length = 0; // This code won't covert this correctly anyway. return; } output += *length; // Scary scary fall throughs. switch (*length) { case 4: --output; *output = (char)((input | BYTE_MARK) & BYTE_MASK); input >>= 6; case 3: --output; *output = (char)((input | BYTE_MARK) & BYTE_MASK); input >>= 6; case 2: --output; *output = (char)((input | BYTE_MARK) & BYTE_MASK); input >>= 6; case 1: --output; *output = (char)(input | FIRST_BYTE_MARK[*length]); default: break; } } const char* XMLUtil::GetCharacterRef( const char* p, char* value, int* length ) { // Presume an entity, and pull it out. *length = 0; if ( *(p+1) == '#' && *(p+2) ) { unsigned long ucs = 0; ptrdiff_t delta = 0; unsigned mult = 1; if ( *(p+2) == 'x' ) { // Hexadecimal. if ( !*(p+3) ) { return 0; } const char* q = p+3; q = strchr( q, ';' ); if ( !q || !*q ) { return 0; } delta = q-p; --q; while ( *q != 'x' ) { if ( *q >= '0' && *q <= '9' ) { ucs += mult * (*q - '0'); } else if ( *q >= 'a' && *q <= 'f' ) { ucs += mult * (*q - 'a' + 10); } else if ( *q >= 'A' && *q <= 'F' ) { ucs += mult * (*q - 'A' + 10 ); } else { return 0; } mult *= 16; --q; } } else { // Decimal. if ( !*(p+2) ) { return 0; } const char* q = p+2; q = strchr( q, ';' ); if ( !q || !*q ) { return 0; } delta = q-p; --q; while ( *q != '#' ) { if ( *q >= '0' && *q <= '9' ) { ucs += mult * (*q - '0'); } else { return 0; } mult *= 10; --q; } } // convert the UCS to UTF-8 ConvertUTF32ToUTF8( ucs, value, length ); return p + delta + 1; } return p+1; } void XMLUtil::ToStr( int v, char* buffer, int bufferSize ) { TIXML_SNPRINTF( buffer, bufferSize, "%d", v ); } void XMLUtil::ToStr( unsigned v, char* buffer, int bufferSize ) { TIXML_SNPRINTF( buffer, bufferSize, "%u", v ); } void XMLUtil::ToStr( bool v, char* buffer, int bufferSize ) { TIXML_SNPRINTF( buffer, bufferSize, "%d", v ? 1 : 0 ); } void XMLUtil::ToStr( float v, char* buffer, int bufferSize ) { TIXML_SNPRINTF( buffer, bufferSize, "%f", v ); } void XMLUtil::ToStr( double v, char* buffer, int bufferSize ) { TIXML_SNPRINTF( buffer, bufferSize, "%f", v ); } bool XMLUtil::ToInt( const char* str, int* value ) { if ( TIXML_SSCANF( str, "%d", value ) == 1 ) { return true; } return false; } bool XMLUtil::ToUnsigned( const char* str, unsigned *value ) { if ( TIXML_SSCANF( str, "%u", value ) == 1 ) { return true; } return false; } bool XMLUtil::ToBool( const char* str, bool* value ) { int ival = 0; if ( ToInt( str, &ival )) { *value = (ival==0) ? false : true; return true; } if ( StringEqual( str, "true" ) ) { *value = true; return true; } else if ( StringEqual( str, "false" ) ) { *value = false; return true; } return false; } bool XMLUtil::ToFloat( const char* str, float* value ) { if ( TIXML_SSCANF( str, "%f", value ) == 1 ) { return true; } return false; } bool XMLUtil::ToDouble( const char* str, double* value ) { if ( TIXML_SSCANF( str, "%lf", value ) == 1 ) { return true; } return false; } char* XMLDocument::Identify( char* p, XMLNode** node ) { XMLNode* returnNode = 0; char* start = p; p = XMLUtil::SkipWhiteSpace( p ); if( !p || !*p ) { return p; } // What is this thing? // - Elements start with a letter or underscore, but xml is reserved. // - Comments: // // With a special case: // // // // // Where the closing element (/foo) *must* be the next thing after the opening // element, and the names must match. BUT the tricky bit is that the closing // element will be read by the child. // // 'endTag' is the end tag for this node, it is returned by a call to a child. // 'parentEnd' is the end tag for the parent, which is filled in and returned. while( p && *p ) { XMLNode* node = 0; p = _document->Identify( p, &node ); if ( p == 0 || node == 0 ) { break; } StrPair endTag; p = node->ParseDeep( p, &endTag ); if ( !p ) { DELETE_NODE( node ); node = 0; if ( !_document->Error() ) { _document->SetError( XML_ERROR_PARSING, 0, 0 ); } break; } // We read the end tag. Return it to the parent. if ( node->ToElement() && node->ToElement()->ClosingType() == XMLElement::CLOSING ) { if ( parentEnd ) { *parentEnd = static_cast(node)->_value; } node->_memPool->SetTracked(); // created and then immediately deleted. DELETE_NODE( node ); return p; } // Handle an end tag returned to this level. // And handle a bunch of annoying errors. XMLElement* ele = node->ToElement(); if ( ele ) { if ( endTag.Empty() && ele->ClosingType() == XMLElement::OPEN ) { _document->SetError( XML_ERROR_MISMATCHED_ELEMENT, node->Value(), 0 ); p = 0; } else if ( !endTag.Empty() && ele->ClosingType() != XMLElement::OPEN ) { _document->SetError( XML_ERROR_MISMATCHED_ELEMENT, node->Value(), 0 ); p = 0; } else if ( !endTag.Empty() ) { if ( !XMLUtil::StringEqual( endTag.GetStr(), node->Value() )) { _document->SetError( XML_ERROR_MISMATCHED_ELEMENT, node->Value(), 0 ); p = 0; } } } if ( p == 0 ) { DELETE_NODE( node ); node = 0; } if ( node ) { this->InsertEndChild( node ); } } return 0; } // --------- XMLText ---------- // char* XMLText::ParseDeep( char* p, StrPair* ) { const char* start = p; if ( this->CData() ) { p = _value.ParseText( p, "]]>", StrPair::NEEDS_NEWLINE_NORMALIZATION ); if ( !p ) { _document->SetError( XML_ERROR_PARSING_CDATA, start, 0 ); } return p; } else { int flags = _document->ProcessEntities() ? StrPair::TEXT_ELEMENT : StrPair::TEXT_ELEMENT_LEAVE_ENTITIES; if ( _document->WhitespaceMode() == COLLAPSE_WHITESPACE ) { flags |= StrPair::COLLAPSE_WHITESPACE; } p = _value.ParseText( p, "<", flags ); if ( !p ) { _document->SetError( XML_ERROR_PARSING_TEXT, start, 0 ); } if ( p && *p ) { return p-1; } } return 0; } XMLNode* XMLText::ShallowClone( XMLDocument* doc ) const { if ( !doc ) { doc = _document; } XMLText* text = doc->NewText( Value() ); // fixme: this will always allocate memory. Intern? text->SetCData( this->CData() ); return text; } bool XMLText::ShallowEqual( const XMLNode* compare ) const { return ( compare->ToText() && XMLUtil::StringEqual( compare->ToText()->Value(), Value() )); } bool XMLText::Accept( XMLVisitor* visitor ) const { return visitor->Visit( *this ); } // --------- XMLComment ---------- // XMLComment::XMLComment( XMLDocument* doc ) : XMLNode( doc ) { } XMLComment::~XMLComment() { } char* XMLComment::ParseDeep( char* p, StrPair* ) { // Comment parses as text. const char* start = p; p = _value.ParseText( p, "-->", StrPair::COMMENT ); if ( p == 0 ) { _document->SetError( XML_ERROR_PARSING_COMMENT, start, 0 ); } return p; } XMLNode* XMLComment::ShallowClone( XMLDocument* doc ) const { if ( !doc ) { doc = _document; } XMLComment* comment = doc->NewComment( Value() ); // fixme: this will always allocate memory. Intern? return comment; } bool XMLComment::ShallowEqual( const XMLNode* compare ) const { return ( compare->ToComment() && XMLUtil::StringEqual( compare->ToComment()->Value(), Value() )); } bool XMLComment::Accept( XMLVisitor* visitor ) const { return visitor->Visit( *this ); } // --------- XMLDeclaration ---------- // XMLDeclaration::XMLDeclaration( XMLDocument* doc ) : XMLNode( doc ) { } XMLDeclaration::~XMLDeclaration() { //printf( "~XMLDeclaration\n" ); } char* XMLDeclaration::ParseDeep( char* p, StrPair* ) { // Declaration parses as text. const char* start = p; p = _value.ParseText( p, "?>", StrPair::NEEDS_NEWLINE_NORMALIZATION ); if ( p == 0 ) { _document->SetError( XML_ERROR_PARSING_DECLARATION, start, 0 ); } return p; } XMLNode* XMLDeclaration::ShallowClone( XMLDocument* doc ) const { if ( !doc ) { doc = _document; } XMLDeclaration* dec = doc->NewDeclaration( Value() ); // fixme: this will always allocate memory. Intern? return dec; } bool XMLDeclaration::ShallowEqual( const XMLNode* compare ) const { return ( compare->ToDeclaration() && XMLUtil::StringEqual( compare->ToDeclaration()->Value(), Value() )); } bool XMLDeclaration::Accept( XMLVisitor* visitor ) const { return visitor->Visit( *this ); } // --------- XMLUnknown ---------- // XMLUnknown::XMLUnknown( XMLDocument* doc ) : XMLNode( doc ) { } XMLUnknown::~XMLUnknown() { } char* XMLUnknown::ParseDeep( char* p, StrPair* ) { // Unknown parses as text. const char* start = p; p = _value.ParseText( p, ">", StrPair::NEEDS_NEWLINE_NORMALIZATION ); if ( !p ) { _document->SetError( XML_ERROR_PARSING_UNKNOWN, start, 0 ); } return p; } XMLNode* XMLUnknown::ShallowClone( XMLDocument* doc ) const { if ( !doc ) { doc = _document; } XMLUnknown* text = doc->NewUnknown( Value() ); // fixme: this will always allocate memory. Intern? return text; } bool XMLUnknown::ShallowEqual( const XMLNode* compare ) const { return ( compare->ToUnknown() && XMLUtil::StringEqual( compare->ToUnknown()->Value(), Value() )); } bool XMLUnknown::Accept( XMLVisitor* visitor ) const { return visitor->Visit( *this ); } // --------- XMLAttribute ---------- // char* XMLAttribute::ParseDeep( char* p, bool processEntities ) { // Parse using the name rules: bug fix, was using ParseText before p = _name.ParseName( p ); if ( !p || !*p ) { return 0; } // Skip white space before = p = XMLUtil::SkipWhiteSpace( p ); if ( !p || *p != '=' ) { return 0; } ++p; // move up to opening quote p = XMLUtil::SkipWhiteSpace( p ); if ( *p != '\"' && *p != '\'' ) { return 0; } char endTag[2] = { *p, 0 }; ++p; // move past opening quote p = _value.ParseText( p, endTag, processEntities ? StrPair::ATTRIBUTE_VALUE : StrPair::ATTRIBUTE_VALUE_LEAVE_ENTITIES ); return p; } void XMLAttribute::SetName( const char* n ) { _name.SetStr( n ); } XMLError XMLAttribute::QueryIntValue( int* value ) const { if ( XMLUtil::ToInt( Value(), value )) { return XML_NO_ERROR; } return XML_WRONG_ATTRIBUTE_TYPE; } XMLError XMLAttribute::QueryUnsignedValue( unsigned int* value ) const { if ( XMLUtil::ToUnsigned( Value(), value )) { return XML_NO_ERROR; } return XML_WRONG_ATTRIBUTE_TYPE; } XMLError XMLAttribute::QueryBoolValue( bool* value ) const { if ( XMLUtil::ToBool( Value(), value )) { return XML_NO_ERROR; } return XML_WRONG_ATTRIBUTE_TYPE; } XMLError XMLAttribute::QueryFloatValue( float* value ) const { if ( XMLUtil::ToFloat( Value(), value )) { return XML_NO_ERROR; } return XML_WRONG_ATTRIBUTE_TYPE; } XMLError XMLAttribute::QueryDoubleValue( double* value ) const { if ( XMLUtil::ToDouble( Value(), value )) { return XML_NO_ERROR; } return XML_WRONG_ATTRIBUTE_TYPE; } void XMLAttribute::SetAttribute( const char* v ) { _value.SetStr( v ); } void XMLAttribute::SetAttribute( int v ) { char buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); _value.SetStr( buf ); } void XMLAttribute::SetAttribute( unsigned v ) { char buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); _value.SetStr( buf ); } void XMLAttribute::SetAttribute( bool v ) { char buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); _value.SetStr( buf ); } void XMLAttribute::SetAttribute( double v ) { char buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); _value.SetStr( buf ); } void XMLAttribute::SetAttribute( float v ) { char buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); _value.SetStr( buf ); } // --------- XMLElement ---------- // XMLElement::XMLElement( XMLDocument* doc ) : XMLNode( doc ), _closingType( 0 ), _rootAttribute( 0 ) { } XMLElement::~XMLElement() { while( _rootAttribute ) { XMLAttribute* next = _rootAttribute->_next; DELETE_ATTRIBUTE( _rootAttribute ); _rootAttribute = next; } } XMLAttribute* XMLElement::FindAttribute( const char* name ) { XMLAttribute* a = 0; for( a=_rootAttribute; a; a = a->_next ) { if ( XMLUtil::StringEqual( a->Name(), name ) ) { return a; } } return 0; } const XMLAttribute* XMLElement::FindAttribute( const char* name ) const { XMLAttribute* a = 0; for( a=_rootAttribute; a; a = a->_next ) { if ( XMLUtil::StringEqual( a->Name(), name ) ) { return a; } } return 0; } const char* XMLElement::Attribute( const char* name, const char* value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) { return 0; } if ( !value || XMLUtil::StringEqual( a->Value(), value )) { return a->Value(); } return 0; } const char* XMLElement::GetText() const { if ( FirstChild() && FirstChild()->ToText() ) { return FirstChild()->ToText()->Value(); } return 0; } XMLError XMLElement::QueryIntText( int* ival ) const { if ( FirstChild() && FirstChild()->ToText() ) { const char* t = FirstChild()->ToText()->Value(); if ( XMLUtil::ToInt( t, ival ) ) { return XML_SUCCESS; } return XML_CAN_NOT_CONVERT_TEXT; } return XML_NO_TEXT_NODE; } XMLError XMLElement::QueryUnsignedText( unsigned* uval ) const { if ( FirstChild() && FirstChild()->ToText() ) { const char* t = FirstChild()->ToText()->Value(); if ( XMLUtil::ToUnsigned( t, uval ) ) { return XML_SUCCESS; } return XML_CAN_NOT_CONVERT_TEXT; } return XML_NO_TEXT_NODE; } XMLError XMLElement::QueryBoolText( bool* bval ) const { if ( FirstChild() && FirstChild()->ToText() ) { const char* t = FirstChild()->ToText()->Value(); if ( XMLUtil::ToBool( t, bval ) ) { return XML_SUCCESS; } return XML_CAN_NOT_CONVERT_TEXT; } return XML_NO_TEXT_NODE; } XMLError XMLElement::QueryDoubleText( double* dval ) const { if ( FirstChild() && FirstChild()->ToText() ) { const char* t = FirstChild()->ToText()->Value(); if ( XMLUtil::ToDouble( t, dval ) ) { return XML_SUCCESS; } return XML_CAN_NOT_CONVERT_TEXT; } return XML_NO_TEXT_NODE; } XMLError XMLElement::QueryFloatText( float* fval ) const { if ( FirstChild() && FirstChild()->ToText() ) { const char* t = FirstChild()->ToText()->Value(); if ( XMLUtil::ToFloat( t, fval ) ) { return XML_SUCCESS; } return XML_CAN_NOT_CONVERT_TEXT; } return XML_NO_TEXT_NODE; } XMLAttribute* XMLElement::FindOrCreateAttribute( const char* name ) { XMLAttribute* last = 0; XMLAttribute* attrib = 0; for( attrib = _rootAttribute; attrib; last = attrib, attrib = attrib->_next ) { if ( XMLUtil::StringEqual( attrib->Name(), name ) ) { break; } } if ( !attrib ) { attrib = new (_document->_attributePool.Alloc() ) XMLAttribute(); attrib->_memPool = &_document->_attributePool; if ( last ) { last->_next = attrib; } else { _rootAttribute = attrib; } attrib->SetName( name ); attrib->_memPool->SetTracked(); // always created and linked. } return attrib; } void XMLElement::DeleteAttribute( const char* name ) { XMLAttribute* prev = 0; for( XMLAttribute* a=_rootAttribute; a; a=a->_next ) { if ( XMLUtil::StringEqual( name, a->Name() ) ) { if ( prev ) { prev->_next = a->_next; } else { _rootAttribute = a->_next; } DELETE_ATTRIBUTE( a ); break; } prev = a; } } char* XMLElement::ParseAttributes( char* p ) { const char* start = p; XMLAttribute* prevAttribute = 0; // Read the attributes. while( p ) { p = XMLUtil::SkipWhiteSpace( p ); if ( !p || !(*p) ) { _document->SetError( XML_ERROR_PARSING_ELEMENT, start, Name() ); return 0; } // attribute. if (XMLUtil::IsNameStartChar( *p ) ) { XMLAttribute* attrib = new (_document->_attributePool.Alloc() ) XMLAttribute(); attrib->_memPool = &_document->_attributePool; attrib->_memPool->SetTracked(); p = attrib->ParseDeep( p, _document->ProcessEntities() ); if ( !p || Attribute( attrib->Name() ) ) { DELETE_ATTRIBUTE( attrib ); _document->SetError( XML_ERROR_PARSING_ATTRIBUTE, start, p ); return 0; } // There is a minor bug here: if the attribute in the source xml // document is duplicated, it will not be detected and the // attribute will be doubly added. However, tracking the 'prevAttribute' // avoids re-scanning the attribute list. Preferring performance for // now, may reconsider in the future. if ( prevAttribute ) { prevAttribute->_next = attrib; } else { _rootAttribute = attrib; } prevAttribute = attrib; } // end of the tag else if ( *p == '/' && *(p+1) == '>' ) { _closingType = CLOSED; return p+2; // done; sealed element. } // end of the tag else if ( *p == '>' ) { ++p; break; } else { _document->SetError( XML_ERROR_PARSING_ELEMENT, start, p ); return 0; } } return p; } // // // foobar // char* XMLElement::ParseDeep( char* p, StrPair* strPair ) { // Read the element name. p = XMLUtil::SkipWhiteSpace( p ); if ( !p ) { return 0; } // The closing element is the form. It is // parsed just like a regular element then deleted from // the DOM. if ( *p == '/' ) { _closingType = CLOSING; ++p; } p = _value.ParseName( p ); if ( _value.Empty() ) { return 0; } p = ParseAttributes( p ); if ( !p || !*p || _closingType ) { return p; } p = XMLNode::ParseDeep( p, strPair ); return p; } XMLNode* XMLElement::ShallowClone( XMLDocument* doc ) const { if ( !doc ) { doc = _document; } XMLElement* element = doc->NewElement( Value() ); // fixme: this will always allocate memory. Intern? for( const XMLAttribute* a=FirstAttribute(); a; a=a->Next() ) { element->SetAttribute( a->Name(), a->Value() ); // fixme: this will always allocate memory. Intern? } return element; } bool XMLElement::ShallowEqual( const XMLNode* compare ) const { const XMLElement* other = compare->ToElement(); if ( other && XMLUtil::StringEqual( other->Value(), Value() )) { const XMLAttribute* a=FirstAttribute(); const XMLAttribute* b=other->FirstAttribute(); while ( a && b ) { if ( !XMLUtil::StringEqual( a->Value(), b->Value() ) ) { return false; } a = a->Next(); b = b->Next(); } if ( a || b ) { // different count return false; } return true; } return false; } bool XMLElement::Accept( XMLVisitor* visitor ) const { if ( visitor->VisitEnter( *this, _rootAttribute ) ) { for ( const XMLNode* node=FirstChild(); node; node=node->NextSibling() ) { if ( !node->Accept( visitor ) ) { break; } } } return visitor->VisitExit( *this ); } // --------- XMLDocument ----------- // XMLDocument::XMLDocument( bool processEntities, Whitespace whitespace ) : XMLNode( 0 ), _writeBOM( false ), _processEntities( processEntities ), _errorID( XML_NO_ERROR ), _whitespace( whitespace ), _errorStr1( 0 ), _errorStr2( 0 ), _charBuffer( 0 ) { _document = this; // avoid warning about 'this' in initializer list } XMLDocument::~XMLDocument() { DeleteChildren(); delete [] _charBuffer; #if 0 _textPool.Trace( "text" ); _elementPool.Trace( "element" ); _commentPool.Trace( "comment" ); _attributePool.Trace( "attribute" ); #endif #ifdef DEBUG if ( Error() == false ) { TIXMLASSERT( _elementPool.CurrentAllocs() == _elementPool.Untracked() ); TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() ); TIXMLASSERT( _textPool.CurrentAllocs() == _textPool.Untracked() ); TIXMLASSERT( _commentPool.CurrentAllocs() == _commentPool.Untracked() ); } #endif } void XMLDocument::Clear() { DeleteChildren(); _errorID = XML_NO_ERROR; _errorStr1 = 0; _errorStr2 = 0; delete [] _charBuffer; _charBuffer = 0; } XMLElement* XMLDocument::NewElement( const char* name ) { XMLElement* ele = new (_elementPool.Alloc()) XMLElement( this ); ele->_memPool = &_elementPool; ele->SetName( name ); return ele; } XMLComment* XMLDocument::NewComment( const char* str ) { XMLComment* comment = new (_commentPool.Alloc()) XMLComment( this ); comment->_memPool = &_commentPool; comment->SetValue( str ); return comment; } XMLText* XMLDocument::NewText( const char* str ) { XMLText* text = new (_textPool.Alloc()) XMLText( this ); text->_memPool = &_textPool; text->SetValue( str ); return text; } XMLDeclaration* XMLDocument::NewDeclaration( const char* str ) { XMLDeclaration* dec = new (_commentPool.Alloc()) XMLDeclaration( this ); dec->_memPool = &_commentPool; dec->SetValue( str ? str : "xml version=\"1.0\" encoding=\"UTF-8\"" ); return dec; } XMLUnknown* XMLDocument::NewUnknown( const char* str ) { XMLUnknown* unk = new (_commentPool.Alloc()) XMLUnknown( this ); unk->_memPool = &_commentPool; unk->SetValue( str ); return unk; } XMLError XMLDocument::LoadFile( const char* filename ) { Clear(); FILE* fp = 0; #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) errno_t err = fopen_s(&fp, filename, "rb" ); if ( !fp || err) { #else fp = fopen( filename, "rb" ); if ( !fp) { #endif SetError( XML_ERROR_FILE_NOT_FOUND, filename, 0 ); return _errorID; } LoadFile( fp ); fclose( fp ); return _errorID; } XMLError XMLDocument::LoadFile( FILE* fp ) { Clear(); fseek( fp, 0, SEEK_END ); size_t size = ftell( fp ); fseek( fp, 0, SEEK_SET ); if ( size == 0 ) { SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); return _errorID; } _charBuffer = new char[size+1]; size_t read = fread( _charBuffer, 1, size, fp ); if ( read != size ) { SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); return _errorID; } _charBuffer[size] = 0; const char* p = _charBuffer; p = XMLUtil::SkipWhiteSpace( p ); p = XMLUtil::ReadBOM( p, &_writeBOM ); if ( !p || !*p ) { SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); return _errorID; } ParseDeep( _charBuffer + (p-_charBuffer), 0 ); return _errorID; } XMLError XMLDocument::SaveFile( const char* filename, bool compact ) { FILE* fp = 0; #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) errno_t err = fopen_s(&fp, filename, "w" ); if ( !fp || err) { #else fp = fopen( filename, "w" ); if ( !fp) { #endif SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, filename, 0 ); return _errorID; } SaveFile(fp, compact); fclose( fp ); return _errorID; } XMLError XMLDocument::SaveFile( FILE* fp, bool compact ) { XMLPrinter stream( fp, compact ); Print( &stream ); return _errorID; } XMLError XMLDocument::Parse( const char* p, size_t len ) { const char* start = p; Clear(); if ( !p || !*p ) { SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); return _errorID; } if ( len == (size_t)(-1) ) { len = strlen( p ); } _charBuffer = new char[ len+1 ]; memcpy( _charBuffer, p, len ); _charBuffer[len] = 0; p = XMLUtil::SkipWhiteSpace( p ); p = XMLUtil::ReadBOM( p, &_writeBOM ); if ( !p || !*p ) { SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); return _errorID; } ptrdiff_t delta = p - start; // skip initial whitespace, BOM, etc. ParseDeep( _charBuffer+delta, 0 ); return _errorID; } void XMLDocument::Print( XMLPrinter* streamer ) { XMLPrinter stdStreamer( stdout ); if ( !streamer ) { streamer = &stdStreamer; } Accept( streamer ); } void XMLDocument::SetError( XMLError error, const char* str1, const char* str2 ) { _errorID = error; _errorStr1 = str1; _errorStr2 = str2; } void XMLDocument::PrintError() const { if ( _errorID ) { static const int LEN = 20; char buf1[LEN] = { 0 }; char buf2[LEN] = { 0 }; if ( _errorStr1 ) { TIXML_SNPRINTF( buf1, LEN, "%s", _errorStr1 ); } if ( _errorStr2 ) { TIXML_SNPRINTF( buf2, LEN, "%s", _errorStr2 ); } printf( "XMLDocument error id=%d str1=%s str2=%s\n", _errorID, buf1, buf2 ); } } XMLPrinter::XMLPrinter( FILE* file, bool compact ) : _elementJustOpened( false ), _firstElement( true ), _fp( file ), _depth( 0 ), _textDepth( -1 ), _processEntities( true ), _compactMode( compact ) { for( int i=0; i'] = true; // not required, but consistency is nice _buffer.Push( 0 ); } void XMLPrinter::Print( const char* format, ... ) { va_list va; va_start( va, format ); if ( _fp ) { vfprintf( _fp, format, va ); } else { // This seems brutally complex. Haven't figured out a better // way on windows. #ifdef _MSC_VER int len = -1; int expand = 1000; while ( len < 0 ) { len = vsnprintf_s( _accumulator.Mem(), _accumulator.Capacity(), _TRUNCATE, format, va ); if ( len < 0 ) { expand *= 3/2; _accumulator.PushArr( expand ); } } char* p = _buffer.PushArr( len ) - 1; memcpy( p, _accumulator.Mem(), len+1 ); #else int len = vsnprintf( 0, 0, format, va ); // Close out and re-start the va-args va_end( va ); va_start( va, format ); char* p = _buffer.PushArr( len ) - 1; vsnprintf( p, len+1, format, va ); #endif } va_end( va ); } void XMLPrinter::PrintSpace( int depth ) { for( int i=0; i 0 && *q < ENTITY_RANGE ) { // Check for entities. If one is found, flush // the stream up until the entity, write the // entity, and keep looking. if ( flag[(unsigned)(*q)] ) { while ( p < q ) { Print( "%c", *p ); ++p; } for( int i=0; i 0) ) { Print( "%s", p ); } } void XMLPrinter::PushHeader( bool writeBOM, bool writeDec ) { static const unsigned char bom[] = { TIXML_UTF_LEAD_0, TIXML_UTF_LEAD_1, TIXML_UTF_LEAD_2, 0 }; if ( writeBOM ) { Print( "%s", bom ); } if ( writeDec ) { PushDeclaration( "xml version=\"1.0\"" ); } } void XMLPrinter::OpenElement( const char* name ) { if ( _elementJustOpened ) { SealElement(); } _stack.Push( name ); if ( _textDepth < 0 && !_firstElement && !_compactMode ) { Print( "\n" ); PrintSpace( _depth ); } Print( "<%s", name ); _elementJustOpened = true; _firstElement = false; ++_depth; } void XMLPrinter::PushAttribute( const char* name, const char* value ) { TIXMLASSERT( _elementJustOpened ); Print( " %s=\"", name ); PrintString( value, false ); Print( "\"" ); } void XMLPrinter::PushAttribute( const char* name, int v ) { char buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); PushAttribute( name, buf ); } void XMLPrinter::PushAttribute( const char* name, unsigned v ) { char buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); PushAttribute( name, buf ); } void XMLPrinter::PushAttribute( const char* name, bool v ) { char buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); PushAttribute( name, buf ); } void XMLPrinter::PushAttribute( const char* name, double v ) { char buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); PushAttribute( name, buf ); } void XMLPrinter::CloseElement() { --_depth; const char* name = _stack.Pop(); if ( _elementJustOpened ) { Print( "/>" ); } else { if ( _textDepth < 0 && !_compactMode) { Print( "\n" ); PrintSpace( _depth ); } Print( "", name ); } if ( _textDepth == _depth ) { _textDepth = -1; } if ( _depth == 0 && !_compactMode) { Print( "\n" ); } _elementJustOpened = false; } void XMLPrinter::SealElement() { _elementJustOpened = false; Print( ">" ); } void XMLPrinter::PushText( const char* text, bool cdata ) { _textDepth = _depth-1; if ( _elementJustOpened ) { SealElement(); } if ( cdata ) { Print( "" ); } else { PrintString( text, true ); } } void XMLPrinter::PushText( int value ) { char buf[BUF_SIZE]; XMLUtil::ToStr( value, buf, BUF_SIZE ); PushText( buf, false ); } void XMLPrinter::PushText( unsigned value ) { char buf[BUF_SIZE]; XMLUtil::ToStr( value, buf, BUF_SIZE ); PushText( buf, false ); } void XMLPrinter::PushText( bool value ) { char buf[BUF_SIZE]; XMLUtil::ToStr( value, buf, BUF_SIZE ); PushText( buf, false ); } void XMLPrinter::PushText( float value ) { char buf[BUF_SIZE]; XMLUtil::ToStr( value, buf, BUF_SIZE ); PushText( buf, false ); } void XMLPrinter::PushText( double value ) { char buf[BUF_SIZE]; XMLUtil::ToStr( value, buf, BUF_SIZE ); PushText( buf, false ); } void XMLPrinter::PushComment( const char* comment ) { if ( _elementJustOpened ) { SealElement(); } if ( _textDepth < 0 && !_firstElement && !_compactMode) { Print( "\n" ); PrintSpace( _depth ); } _firstElement = false; Print( "", comment ); } void XMLPrinter::PushDeclaration( const char* value ) { if ( _elementJustOpened ) { SealElement(); } if ( _textDepth < 0 && !_firstElement && !_compactMode) { Print( "\n" ); PrintSpace( _depth ); } _firstElement = false; Print( "", value ); } void XMLPrinter::PushUnknown( const char* value ) { if ( _elementJustOpened ) { SealElement(); } if ( _textDepth < 0 && !_firstElement && !_compactMode) { Print( "\n" ); PrintSpace( _depth ); } _firstElement = false; Print( "", value ); } bool XMLPrinter::VisitEnter( const XMLDocument& doc ) { _processEntities = doc.ProcessEntities(); if ( doc.HasBOM() ) { PushHeader( true, false ); } return true; } bool XMLPrinter::VisitEnter( const XMLElement& element, const XMLAttribute* attribute ) { OpenElement( element.Name() ); while ( attribute ) { PushAttribute( attribute->Name(), attribute->Value() ); attribute = attribute->Next(); } return true; } bool XMLPrinter::VisitExit( const XMLElement& ) { CloseElement(); return true; } bool XMLPrinter::Visit( const XMLText& text ) { PushText( text.Value(), text.CData() ); return true; } bool XMLPrinter::Visit( const XMLComment& comment ) { PushComment( comment.Value() ); return true; } bool XMLPrinter::Visit( const XMLDeclaration& declaration ) { PushDeclaration( declaration.Value() ); return true; } bool XMLPrinter::Visit( const XMLUnknown& unknown ) { PushUnknown( unknown.Value() ); return true; } } // namespace tinyxml2 MediaInfoLib/Source/ThirdParty/tinyxml2/tinyxml2.h100777 0 0 162505 12226004261 15602 0/* Original code by Lee Thomason (www.grinninglizard.com) This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef TINYXML2_INCLUDED #define TINYXML2_INCLUDED #if defined(ANDROID_NDK) || defined(__BORLANDC__) # include # include # include # include # include # include #else # include # include # include # include # include # include #endif /* TODO: intern strings instead of allocation. */ /* gcc: g++ -Wall -DDEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe Formatting, Artistic Style: AStyle.exe --style=1tbs --indent-switches --break-closing-brackets --indent-preprocessor tinyxml2.cpp tinyxml2.h */ #if defined( _DEBUG ) || defined( DEBUG ) || defined (__DEBUG__) # ifndef DEBUG # define DEBUG # endif #endif #if defined(DEBUG) # if defined(_MSC_VER) # define TIXMLASSERT( x ) if ( !(x)) { __debugbreak(); } //if ( !(x)) WinDebugBreak() # elif defined (ANDROID_NDK) # include # define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); } # else # include # define TIXMLASSERT assert # endif # else # define TIXMLASSERT( x ) {} #endif #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) // Microsoft visual studio, version 2005 and higher. /*int _snprintf_s( char *buffer, size_t sizeOfBuffer, size_t count, const char *format [, argument] ... );*/ inline int TIXML_SNPRINTF( char* buffer, size_t size, const char* format, ... ) { va_list va; va_start( va, format ); int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va ); va_end( va ); return result; } #define TIXML_SSCANF sscanf_s #else // GCC version 3 and higher //#warning( "Using sn* functions." ) #define TIXML_SNPRINTF snprintf #define TIXML_SSCANF sscanf #endif static const int TIXML2_MAJOR_VERSION = 1; static const int TIXML2_MINOR_VERSION = 0; static const int TIXML2_PATCH_VERSION = 11; namespace tinyxml2 { class XMLDocument; class XMLElement; class XMLAttribute; class XMLComment; class XMLNode; class XMLText; class XMLDeclaration; class XMLUnknown; class XMLPrinter; /* A class that wraps strings. Normally stores the start and end pointers into the XML file itself, and will apply normalization and entity translation if actually read. Can also store (and memory manage) a traditional char[] */ class StrPair { public: enum { NEEDS_ENTITY_PROCESSING = 0x01, NEEDS_NEWLINE_NORMALIZATION = 0x02, COLLAPSE_WHITESPACE = 0x04, TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION, TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION, ATTRIBUTE_NAME = 0, ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION, ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION, COMMENT = NEEDS_NEWLINE_NORMALIZATION }; StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {} ~StrPair(); void Set( char* start, char* end, int flags ) { Reset(); _start = start; _end = end; _flags = flags | NEEDS_FLUSH; } const char* GetStr(); bool Empty() const { return _start == _end; } void SetInternedStr( const char* str ) { Reset(); _start = const_cast(str); } void SetStr( const char* str, int flags=0 ); char* ParseText( char* in, const char* endTag, int strFlags ); char* ParseName( char* in ); private: void Reset(); void CollapseWhitespace(); enum { NEEDS_FLUSH = 0x100, NEEDS_DELETE = 0x200 }; // After parsing, if *_end != 0, it can be set to zero. int _flags; char* _start; char* _end; }; /* A dynamic array of Plain Old Data. Doesn't support constructors, etc. Has a small initial memory pool, so that low or no usage will not cause a call to new/delete */ template class DynArray { public: DynArray< T, INIT >() { _mem = _pool; _allocated = INIT; _size = 0; } ~DynArray() { if ( _mem != _pool ) { delete [] _mem; } } void Push( T t ) { EnsureCapacity( _size+1 ); _mem[_size++] = t; } T* PushArr( int count ) { EnsureCapacity( _size+count ); T* ret = &_mem[_size]; _size += count; return ret; } T Pop() { return _mem[--_size]; } void PopArr( int count ) { TIXMLASSERT( _size >= count ); _size -= count; } bool Empty() const { return _size == 0; } T& operator[](int i) { TIXMLASSERT( i>= 0 && i < _size ); return _mem[i]; } const T& operator[](int i) const { TIXMLASSERT( i>= 0 && i < _size ); return _mem[i]; } int Size() const { return _size; } int Capacity() const { return _allocated; } const T* Mem() const { return _mem; } T* Mem() { return _mem; } private: void EnsureCapacity( int cap ) { if ( cap > _allocated ) { int newAllocated = cap * 2; T* newMem = new T[newAllocated]; memcpy( newMem, _mem, sizeof(T)*_size ); // warning: not using constructors, only works for PODs if ( _mem != _pool ) { delete [] _mem; } _mem = newMem; _allocated = newAllocated; } } T* _mem; T _pool[INIT]; int _allocated; // objects allocated int _size; // number objects in use }; /* Parent virtual class of a pool for fast allocation and deallocation of objects. */ class MemPool { public: MemPool() {} virtual ~MemPool() {} virtual int ItemSize() const = 0; virtual void* Alloc() = 0; virtual void Free( void* ) = 0; virtual void SetTracked() = 0; }; /* Template child class to create pools of the correct type. */ template< int SIZE > class MemPoolT : public MemPool { public: MemPoolT() : _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {} ~MemPoolT() { // Delete the blocks. for( int i=0; i<_blockPtrs.Size(); ++i ) { delete _blockPtrs[i]; } } virtual int ItemSize() const { return SIZE; } int CurrentAllocs() const { return _currentAllocs; } virtual void* Alloc() { if ( !_root ) { // Need a new block. Block* block = new Block(); _blockPtrs.Push( block ); for( int i=0; ichunk[i].next = &block->chunk[i+1]; } block->chunk[COUNT-1].next = 0; _root = block->chunk; } void* result = _root; _root = _root->next; ++_currentAllocs; if ( _currentAllocs > _maxAllocs ) { _maxAllocs = _currentAllocs; } _nAllocs++; _nUntracked++; return result; } virtual void Free( void* mem ) { if ( !mem ) { return; } --_currentAllocs; Chunk* chunk = (Chunk*)mem; #ifdef DEBUG memset( chunk, 0xfe, sizeof(Chunk) ); #endif chunk->next = _root; _root = chunk; } void Trace( const char* name ) { printf( "Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n", name, _maxAllocs, _maxAllocs*SIZE/1024, _currentAllocs, SIZE, _nAllocs, _blockPtrs.Size() ); } void SetTracked() { _nUntracked--; } int Untracked() const { return _nUntracked; } // This number is perf sensitive. 4k seems like a good tradeoff on my machine. // The test file is large, 170k. // Release: VS2010 gcc(no opt) // 1k: 4000 // 2k: 4000 // 4k: 3900 21000 // 16k: 5200 // 32k: 4300 // 64k: 4000 21000 enum { COUNT = (4*1024)/SIZE }; // Some compilers do not accept to use COUNT in private part if COUNT is private private: union Chunk { Chunk* next; char mem[SIZE]; }; struct Block { Chunk chunk[COUNT]; }; DynArray< Block*, 10 > _blockPtrs; Chunk* _root; int _currentAllocs; int _nAllocs; int _maxAllocs; int _nUntracked; }; /** Implements the interface to the "Visitor pattern" (see the Accept() method.) If you call the Accept() method, it requires being passed a XMLVisitor class to handle callbacks. For nodes that contain other nodes (Document, Element) you will get called with a VisitEnter/VisitExit pair. Nodes that are always leafs are simply called with Visit(). If you return 'true' from a Visit method, recursive parsing will continue. If you return false, no children of this node or its siblings will be visited. All flavors of Visit methods have a default implementation that returns 'true' (continue visiting). You need to only override methods that are interesting to you. Generally Accept() is called on the TiXmlDocument, although all nodes support visiting. You should never change the document from a callback. @sa XMLNode::Accept() */ class XMLVisitor { public: virtual ~XMLVisitor() {} /// Visit a document. virtual bool VisitEnter( const XMLDocument& /*doc*/ ) { return true; } /// Visit a document. virtual bool VisitExit( const XMLDocument& /*doc*/ ) { return true; } /// Visit an element. virtual bool VisitEnter( const XMLElement& /*element*/, const XMLAttribute* /*firstAttribute*/ ) { return true; } /// Visit an element. virtual bool VisitExit( const XMLElement& /*element*/ ) { return true; } /// Visit a declaration. virtual bool Visit( const XMLDeclaration& /*declaration*/ ) { return true; } /// Visit a text node. virtual bool Visit( const XMLText& /*text*/ ) { return true; } /// Visit a comment node. virtual bool Visit( const XMLComment& /*comment*/ ) { return true; } /// Visit an unknown node. virtual bool Visit( const XMLUnknown& /*unknown*/ ) { return true; } }; /* Utility functionality. */ class XMLUtil { public: // Anything in the high order range of UTF-8 is assumed to not be whitespace. This isn't // correct, but simple, and usually works. static const char* SkipWhiteSpace( const char* p ) { while( !IsUTF8Continuation(*p) && isspace( *reinterpret_cast(p) ) ) { ++p; } return p; } static char* SkipWhiteSpace( char* p ) { while( !IsUTF8Continuation(*p) && isspace( *reinterpret_cast(p) ) ) { ++p; } return p; } static bool IsWhiteSpace( char p ) { return !IsUTF8Continuation(p) && isspace( static_cast(p) ); } inline static bool IsNameStartChar( unsigned char ch ) { return ( ( ch < 128 ) ? isalpha( ch ) : 1 ) || ch == ':' || ch == '_'; } inline static bool IsNameChar( unsigned char ch ) { return IsNameStartChar( ch ) || isdigit( ch ) || ch == '.' || ch == '-'; } inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) { int n = 0; if ( p == q ) { return true; } while( *p && *q && *p == *q && n(const_cast(this)->FirstChildElement( value )); } /// Get the last child node, or null if none exists. const XMLNode* LastChild() const { return _lastChild; } XMLNode* LastChild() { return const_cast(const_cast(this)->LastChild() ); } /** Get the last child element or optionally the last child element with the specified name. */ const XMLElement* LastChildElement( const char* value=0 ) const; XMLElement* LastChildElement( const char* value=0 ) { return const_cast(const_cast(this)->LastChildElement(value) ); } /// Get the previous (left) sibling node of this node. const XMLNode* PreviousSibling() const { return _prev; } XMLNode* PreviousSibling() { return _prev; } /// Get the previous (left) sibling element of this node, with an optionally supplied name. const XMLElement* PreviousSiblingElement( const char* value=0 ) const ; XMLElement* PreviousSiblingElement( const char* value=0 ) { return const_cast(const_cast(this)->PreviousSiblingElement( value ) ); } /// Get the next (right) sibling node of this node. const XMLNode* NextSibling() const { return _next; } XMLNode* NextSibling() { return _next; } /// Get the next (right) sibling element of this node, with an optionally supplied name. const XMLElement* NextSiblingElement( const char* value=0 ) const; XMLElement* NextSiblingElement( const char* value=0 ) { return const_cast(const_cast(this)->NextSiblingElement( value ) ); } /** Add a child node as the last (right) child. */ XMLNode* InsertEndChild( XMLNode* addThis ); XMLNode* LinkEndChild( XMLNode* addThis ) { return InsertEndChild( addThis ); } /** Add a child node as the first (left) child. */ XMLNode* InsertFirstChild( XMLNode* addThis ); /** Add a node after the specified child node. */ XMLNode* InsertAfterChild( XMLNode* afterThis, XMLNode* addThis ); /** Delete all the children of this node. */ void DeleteChildren(); /** Delete a child of this node. */ void DeleteChild( XMLNode* node ); /** Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this->GetDocument()) Note: if called on a XMLDocument, this will return null. */ virtual XMLNode* ShallowClone( XMLDocument* document ) const = 0; /** Test if 2 nodes are the same, but don't test children. The 2 nodes do not need to be in the same Document. Note: if called on a XMLDocument, this will return false. */ virtual bool ShallowEqual( const XMLNode* compare ) const = 0; /** Accept a hierarchical visit of the nodes in the TinyXML DOM. Every node in the XML tree will be conditionally visited and the host will be called back via the TiXmlVisitor interface. This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse the XML for the callbacks, so the performance of TinyXML is unchanged by using this interface versus any other.) The interface has been based on ideas from: - http://www.saxproject.org/ - http://c2.com/cgi/wiki?HierarchicalVisitorPattern Which are both good references for "visiting". An example of using Accept(): @verbatim TiXmlPrinter printer; tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr(); @endverbatim */ virtual bool Accept( XMLVisitor* visitor ) const = 0; // internal virtual char* ParseDeep( char*, StrPair* ); protected: XMLNode( XMLDocument* ); virtual ~XMLNode(); XMLNode( const XMLNode& ); // not supported XMLNode& operator=( const XMLNode& ); // not supported XMLDocument* _document; XMLNode* _parent; mutable StrPair _value; XMLNode* _firstChild; XMLNode* _lastChild; XMLNode* _prev; XMLNode* _next; private: MemPool* _memPool; void Unlink( XMLNode* child ); }; /** XML text. Note that a text node can have child element nodes, for example: @verbatim This is bold @endverbatim A text node can have 2 ways to output the next. "normal" output and CDATA. It will default to the mode it was parsed from the XML file and you generally want to leave it alone, but you can change the output mode with SetCDATA() and query it with CDATA(). */ class XMLText : public XMLNode { friend class XMLBase; friend class XMLDocument; public: virtual bool Accept( XMLVisitor* visitor ) const; virtual XMLText* ToText() { return this; } virtual const XMLText* ToText() const { return this; } /// Declare whether this should be CDATA or standard text. void SetCData( bool isCData ) { _isCData = isCData; } /// Returns true if this is a CDATA text element. bool CData() const { return _isCData; } char* ParseDeep( char*, StrPair* endTag ); virtual XMLNode* ShallowClone( XMLDocument* document ) const; virtual bool ShallowEqual( const XMLNode* compare ) const; protected: XMLText( XMLDocument* doc ) : XMLNode( doc ), _isCData( false ) {} virtual ~XMLText() {} XMLText( const XMLText& ); // not supported XMLText& operator=( const XMLText& ); // not supported private: bool _isCData; }; /** An XML Comment. */ class XMLComment : public XMLNode { friend class XMLDocument; public: virtual XMLComment* ToComment() { return this; } virtual const XMLComment* ToComment() const { return this; } virtual bool Accept( XMLVisitor* visitor ) const; char* ParseDeep( char*, StrPair* endTag ); virtual XMLNode* ShallowClone( XMLDocument* document ) const; virtual bool ShallowEqual( const XMLNode* compare ) const; protected: XMLComment( XMLDocument* doc ); virtual ~XMLComment(); XMLComment( const XMLComment& ); // not supported XMLComment& operator=( const XMLComment& ); // not supported private: }; /** In correct XML the declaration is the first entry in the file. @verbatim @endverbatim TinyXML2 will happily read or write files without a declaration, however. The text of the declaration isn't interpreted. It is parsed and written as a string. */ class XMLDeclaration : public XMLNode { friend class XMLDocument; public: virtual XMLDeclaration* ToDeclaration() { return this; } virtual const XMLDeclaration* ToDeclaration() const { return this; } virtual bool Accept( XMLVisitor* visitor ) const; char* ParseDeep( char*, StrPair* endTag ); virtual XMLNode* ShallowClone( XMLDocument* document ) const; virtual bool ShallowEqual( const XMLNode* compare ) const; protected: XMLDeclaration( XMLDocument* doc ); virtual ~XMLDeclaration(); XMLDeclaration( const XMLDeclaration& ); // not supported XMLDeclaration& operator=( const XMLDeclaration& ); // not supported }; /** Any tag that tinyXml doesn't recognize is saved as an unknown. It is a tag of text, but should not be modified. It will be written back to the XML, unchanged, when the file is saved. DTD tags get thrown into TiXmlUnknowns. */ class XMLUnknown : public XMLNode { friend class XMLDocument; public: virtual XMLUnknown* ToUnknown() { return this; } virtual const XMLUnknown* ToUnknown() const { return this; } virtual bool Accept( XMLVisitor* visitor ) const; char* ParseDeep( char*, StrPair* endTag ); virtual XMLNode* ShallowClone( XMLDocument* document ) const; virtual bool ShallowEqual( const XMLNode* compare ) const; protected: XMLUnknown( XMLDocument* doc ); virtual ~XMLUnknown(); XMLUnknown( const XMLUnknown& ); // not supported XMLUnknown& operator=( const XMLUnknown& ); // not supported }; enum XMLError { XML_NO_ERROR = 0, XML_SUCCESS = 0, XML_NO_ATTRIBUTE, XML_WRONG_ATTRIBUTE_TYPE, XML_ERROR_FILE_NOT_FOUND, XML_ERROR_FILE_COULD_NOT_BE_OPENED, XML_ERROR_FILE_READ_ERROR, XML_ERROR_ELEMENT_MISMATCH, XML_ERROR_PARSING_ELEMENT, XML_ERROR_PARSING_ATTRIBUTE, XML_ERROR_IDENTIFYING_TAG, XML_ERROR_PARSING_TEXT, XML_ERROR_PARSING_CDATA, XML_ERROR_PARSING_COMMENT, XML_ERROR_PARSING_DECLARATION, XML_ERROR_PARSING_UNKNOWN, XML_ERROR_EMPTY_DOCUMENT, XML_ERROR_MISMATCHED_ELEMENT, XML_ERROR_PARSING, XML_CAN_NOT_CONVERT_TEXT, XML_NO_TEXT_NODE }; /** An attribute is a name-value pair. Elements have an arbitrary number of attributes, each with a unique name. @note The attributes are not XMLNodes. You may only query the Next() attribute in a list. */ class XMLAttribute { friend class XMLElement; public: /// The name of the attribute. const char* Name() const { return _name.GetStr(); } /// The value of the attribute. const char* Value() const { return _value.GetStr(); } /// The next attribute in the list. const XMLAttribute* Next() const { return _next; } /** IntAttribute interprets the attribute as an integer, and returns the value. If the value isn't an integer, 0 will be returned. There is no error checking; use QueryIntAttribute() if you need error checking. */ int IntValue() const { int i=0; QueryIntValue( &i ); return i; } /// Query as an unsigned integer. See IntAttribute() unsigned UnsignedValue() const { unsigned i=0; QueryUnsignedValue( &i ); return i; } /// Query as a boolean. See IntAttribute() bool BoolValue() const { bool b=false; QueryBoolValue( &b ); return b; } /// Query as a double. See IntAttribute() double DoubleValue() const { double d=0; QueryDoubleValue( &d ); return d; } /// Query as a float. See IntAttribute() float FloatValue() const { float f=0; QueryFloatValue( &f ); return f; } /** QueryIntAttribute interprets the attribute as an integer, and returns the value in the provided parameter. The function will return XML_NO_ERROR on success, and XML_WRONG_ATTRIBUTE_TYPE if the conversion is not successful. */ XMLError QueryIntValue( int* value ) const; /// See QueryIntAttribute XMLError QueryUnsignedValue( unsigned int* value ) const; /// See QueryIntAttribute XMLError QueryBoolValue( bool* value ) const; /// See QueryIntAttribute XMLError QueryDoubleValue( double* value ) const; /// See QueryIntAttribute XMLError QueryFloatValue( float* value ) const; /// Set the attribute to a string value. void SetAttribute( const char* value ); /// Set the attribute to value. void SetAttribute( int value ); /// Set the attribute to value. void SetAttribute( unsigned value ); /// Set the attribute to value. void SetAttribute( bool value ); /// Set the attribute to value. void SetAttribute( double value ); /// Set the attribute to value. void SetAttribute( float value ); private: enum { BUF_SIZE = 200 }; XMLAttribute() : _next( 0 ), _memPool( 0 ) {} virtual ~XMLAttribute() {} XMLAttribute( const XMLAttribute& ); // not supported void operator=( const XMLAttribute& ); // not supported void SetName( const char* name ); char* ParseDeep( char* p, bool processEntities ); mutable StrPair _name; mutable StrPair _value; XMLAttribute* _next; MemPool* _memPool; }; /** The element is a container class. It has a value, the element name, and can contain other elements, text, comments, and unknowns. Elements also contain an arbitrary number of attributes. */ class XMLElement : public XMLNode { friend class XMLBase; friend class XMLDocument; public: /// Get the name of an element (which is the Value() of the node.) const char* Name() const { return Value(); } /// Set the name of the element. void SetName( const char* str, bool staticMem=false ) { SetValue( str, staticMem ); } virtual XMLElement* ToElement() { return this; } virtual const XMLElement* ToElement() const { return this; } virtual bool Accept( XMLVisitor* visitor ) const; /** Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists. For example: @verbatim const char* value = ele->Attribute( "foo" ); @endverbatim The 'value' parameter is normally null. However, if specified, the attribute will only be returned if the 'name' and 'value' match. This allow you to write code: @verbatim if ( ele->Attribute( "foo", "bar" ) ) callFooIsBar(); @endverbatim rather than: @verbatim if ( ele->Attribute( "foo" ) ) { if ( strcmp( ele->Attribute( "foo" ), "bar" ) == 0 ) callFooIsBar(); } @endverbatim */ const char* Attribute( const char* name, const char* value=0 ) const; /** Given an attribute name, IntAttribute() returns the value of the attribute interpreted as an integer. 0 will be returned if there is an error. For a method with error checking, see QueryIntAttribute() */ int IntAttribute( const char* name ) const { int i=0; QueryIntAttribute( name, &i ); return i; } /// See IntAttribute() unsigned UnsignedAttribute( const char* name ) const { unsigned i=0; QueryUnsignedAttribute( name, &i ); return i; } /// See IntAttribute() bool BoolAttribute( const char* name ) const { bool b=false; QueryBoolAttribute( name, &b ); return b; } /// See IntAttribute() double DoubleAttribute( const char* name ) const { double d=0; QueryDoubleAttribute( name, &d ); return d; } /// See IntAttribute() float FloatAttribute( const char* name ) const { float f=0; QueryFloatAttribute( name, &f ); return f; } /** Given an attribute name, QueryIntAttribute() returns XML_NO_ERROR, XML_WRONG_ATTRIBUTE_TYPE if the conversion can't be performed, or XML_NO_ATTRIBUTE if the attribute doesn't exist. If successful, the result of the conversion will be written to 'value'. If not successful, nothing will be written to 'value'. This allows you to provide default value: @verbatim int value = 10; QueryIntAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10 @endverbatim */ XMLError QueryIntAttribute( const char* name, int* value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) { return XML_NO_ATTRIBUTE; } return a->QueryIntValue( value ); } /// See QueryIntAttribute() XMLError QueryUnsignedAttribute( const char* name, unsigned int* value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) { return XML_NO_ATTRIBUTE; } return a->QueryUnsignedValue( value ); } /// See QueryIntAttribute() XMLError QueryBoolAttribute( const char* name, bool* value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) { return XML_NO_ATTRIBUTE; } return a->QueryBoolValue( value ); } /// See QueryIntAttribute() XMLError QueryDoubleAttribute( const char* name, double* value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) { return XML_NO_ATTRIBUTE; } return a->QueryDoubleValue( value ); } /// See QueryIntAttribute() XMLError QueryFloatAttribute( const char* name, float* value ) const { const XMLAttribute* a = FindAttribute( name ); if ( !a ) { return XML_NO_ATTRIBUTE; } return a->QueryFloatValue( value ); } /** Given an attribute name, QueryAttribute() returns XML_NO_ERROR, XML_WRONG_ATTRIBUTE_TYPE if the conversion can't be performed, or XML_NO_ATTRIBUTE if the attribute doesn't exist. It is overloaded for the primitive types, and is a generally more convenient replacement of QueryIntAttribute() and related functions. If successful, the result of the conversion will be written to 'value'. If not successful, nothing will be written to 'value'. This allows you to provide default value: @verbatim int value = 10; QueryAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10 @endverbatim */ int QueryAttribute( const char* name, int* value ) const { return QueryIntAttribute( name, value ); } int QueryAttribute( const char* name, unsigned int* value ) const { return QueryUnsignedAttribute( name, value ); } int QueryAttribute( const char* name, bool* value ) const { return QueryBoolAttribute( name, value ); } int QueryAttribute( const char* name, double* value ) const { return QueryDoubleAttribute( name, value ); } int QueryAttribute( const char* name, float* value ) const { return QueryFloatAttribute( name, value ); } /// Sets the named attribute to value. void SetAttribute( const char* name, const char* value ) { XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( value ); } /// Sets the named attribute to value. void SetAttribute( const char* name, int value ) { XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( value ); } /// Sets the named attribute to value. void SetAttribute( const char* name, unsigned value ) { XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( value ); } /// Sets the named attribute to value. void SetAttribute( const char* name, bool value ) { XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( value ); } /// Sets the named attribute to value. void SetAttribute( const char* name, double value ) { XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( value ); } /** Delete an attribute. */ void DeleteAttribute( const char* name ); /// Return the first attribute in the list. const XMLAttribute* FirstAttribute() const { return _rootAttribute; } /// Query a specific attribute in the list. const XMLAttribute* FindAttribute( const char* name ) const; /** Convenience function for easy access to the text inside an element. Although easy and concise, GetText() is limited compared to getting the TiXmlText child and accessing it directly. If the first child of 'this' is a TiXmlText, the GetText() returns the character string of the Text node, else null is returned. This is a convenient method for getting the text of simple contained text: @verbatim This is text const char* str = fooElement->GetText(); @endverbatim 'str' will be a pointer to "This is text". Note that this function can be misleading. If the element foo was created from this XML: @verbatim This is text @endverbatim then the value of str would be null. The first child node isn't a text node, it is another element. From this XML: @verbatim This is text @endverbatim GetText() will return "This is ". */ const char* GetText() const; /** Convenience method to query the value of a child text node. This is probably best shown by example. Given you have a document is this form: @verbatim 1 1.4 @endverbatim The QueryIntText() and similar functions provide a safe and easier way to get to the "value" of x and y. @verbatim int x = 0; float y = 0; // types of x and y are contrived for example const XMLElement* xElement = pointElement->FirstChildElement( "x" ); const XMLElement* yElement = pointElement->FirstChildElement( "y" ); xElement->QueryIntText( &x ); yElement->QueryFloatText( &y ); @endverbatim @returns XML_SUCCESS (0) on success, XML_CAN_NOT_CONVERT_TEXT if the text cannot be converted to the requested type, and XML_NO_TEXT_NODE if there is no child text to query. */ XMLError QueryIntText( int* ival ) const; /// See QueryIntText() XMLError QueryUnsignedText( unsigned* uval ) const; /// See QueryIntText() XMLError QueryBoolText( bool* bval ) const; /// See QueryIntText() XMLError QueryDoubleText( double* dval ) const; /// See QueryIntText() XMLError QueryFloatText( float* fval ) const; // internal: enum { OPEN, // CLOSED, // CLOSING // }; int ClosingType() const { return _closingType; } char* ParseDeep( char* p, StrPair* endTag ); virtual XMLNode* ShallowClone( XMLDocument* document ) const; virtual bool ShallowEqual( const XMLNode* compare ) const; private: XMLElement( XMLDocument* doc ); virtual ~XMLElement(); XMLElement( const XMLElement& ); // not supported void operator=( const XMLElement& ); // not supported XMLAttribute* FindAttribute( const char* name ); XMLAttribute* FindOrCreateAttribute( const char* name ); //void LinkAttribute( XMLAttribute* attrib ); char* ParseAttributes( char* p ); int _closingType; // The attribute list is ordered; there is no 'lastAttribute' // because the list needs to be scanned for dupes before adding // a new attribute. XMLAttribute* _rootAttribute; }; enum Whitespace { PRESERVE_WHITESPACE, COLLAPSE_WHITESPACE }; /** A Document binds together all the functionality. It can be saved, loaded, and printed to the screen. All Nodes are connected and allocated to a Document. If the Document is deleted, all its Nodes are also deleted. */ class XMLDocument : public XMLNode { friend class XMLElement; public: /// constructor XMLDocument( bool processEntities = true, Whitespace = PRESERVE_WHITESPACE ); ~XMLDocument(); virtual XMLDocument* ToDocument() { return this; } virtual const XMLDocument* ToDocument() const { return this; } /** Parse an XML file from a character string. Returns XML_NO_ERROR (0) on success, or an errorID. You may optionally pass in the 'nBytes', which is the number of bytes which will be parsed. If not specified, TinyXML will assume 'xml' points to a null terminated string. */ XMLError Parse( const char* xml, size_t nBytes=(size_t)(-1) ); /** Load an XML file from disk. Returns XML_NO_ERROR (0) on success, or an errorID. */ XMLError LoadFile( const char* filename ); /** Load an XML file from disk. You are responsible for providing and closing the FILE*. Returns XML_NO_ERROR (0) on success, or an errorID. */ XMLError LoadFile( FILE* ); /** Save the XML file to disk. Returns XML_NO_ERROR (0) on success, or an errorID. */ XMLError SaveFile( const char* filename, bool compact = false ); /** Save the XML file to disk. You are responsible for providing and closing the FILE*. Returns XML_NO_ERROR (0) on success, or an errorID. */ XMLError SaveFile( FILE* fp, bool compact = false ); bool ProcessEntities() const { return _processEntities; } Whitespace WhitespaceMode() const { return _whitespace; } /** Returns true if this document has a leading Byte Order Mark of UTF8. */ bool HasBOM() const { return _writeBOM; } /** Sets whether to write the BOM when writing the file. */ void SetBOM( bool useBOM ) { _writeBOM = useBOM; } /** Return the root element of DOM. Equivalent to FirstChildElement(). To get the first node, use FirstChild(). */ XMLElement* RootElement() { return FirstChildElement(); } const XMLElement* RootElement() const { return FirstChildElement(); } /** Print the Document. If the Printer is not provided, it will print to stdout. If you provide Printer, this can print to a file: @verbatim XMLPrinter printer( fp ); doc.Print( &printer ); @endverbatim Or you can use a printer to print to memory: @verbatim XMLPrinter printer; doc->Print( &printer ); // printer.CStr() has a const char* to the XML @endverbatim */ void Print( XMLPrinter* streamer=0 ); virtual bool Accept( XMLVisitor* visitor ) const; /** Create a new Element associated with this Document. The memory for the Element is managed by the Document. */ XMLElement* NewElement( const char* name ); /** Create a new Comment associated with this Document. The memory for the Comment is managed by the Document. */ XMLComment* NewComment( const char* comment ); /** Create a new Text associated with this Document. The memory for the Text is managed by the Document. */ XMLText* NewText( const char* text ); /** Create a new Declaration associated with this Document. The memory for the object is managed by the Document. If the 'text' param is null, the standard declaration is used.: @verbatim @endverbatim */ XMLDeclaration* NewDeclaration( const char* text=0 ); /** Create a new Unknown associated with this Document. The memory for the object is managed by the Document. */ XMLUnknown* NewUnknown( const char* text ); /** Delete a node associated with this document. It will be unlinked from the DOM. */ void DeleteNode( XMLNode* node ) { node->_parent->DeleteChild( node ); } void SetError( XMLError error, const char* str1, const char* str2 ); /// Return true if there was an error parsing the document. bool Error() const { return _errorID != XML_NO_ERROR; } /// Return the errorID. XMLError ErrorID() const { return _errorID; } /// Return a possibly helpful diagnostic location or string. const char* GetErrorStr1() const { return _errorStr1; } /// Return a possibly helpful secondary diagnostic location or string. const char* GetErrorStr2() const { return _errorStr2; } /// If there is an error, print it to stdout. void PrintError() const; /// Clear the document, resetting it to the initial state. void Clear(); // internal char* Identify( char* p, XMLNode** node ); virtual XMLNode* ShallowClone( XMLDocument* /*document*/ ) const { return 0; } virtual bool ShallowEqual( const XMLNode* /*compare*/ ) const { return false; } private: XMLDocument( const XMLDocument& ); // not supported void operator=( const XMLDocument& ); // not supported bool _writeBOM; bool _processEntities; XMLError _errorID; Whitespace _whitespace; const char* _errorStr1; const char* _errorStr2; char* _charBuffer; MemPoolT< sizeof(XMLElement) > _elementPool; MemPoolT< sizeof(XMLAttribute) > _attributePool; MemPoolT< sizeof(XMLText) > _textPool; MemPoolT< sizeof(XMLComment) > _commentPool; }; /** A XMLHandle is a class that wraps a node pointer with null checks; this is an incredibly useful thing. Note that XMLHandle is not part of the TinyXML DOM structure. It is a separate utility class. Take an example: @verbatim @endverbatim Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very easy to write a *lot* of code that looks like: @verbatim XMLElement* root = document.FirstChildElement( "Document" ); if ( root ) { XMLElement* element = root->FirstChildElement( "Element" ); if ( element ) { XMLElement* child = element->FirstChildElement( "Child" ); if ( child ) { XMLElement* child2 = child->NextSiblingElement( "Child" ); if ( child2 ) { // Finally do something useful. @endverbatim And that doesn't even cover "else" cases. XMLHandle addresses the verbosity of such code. A XMLHandle checks for null pointers so it is perfectly safe and correct to use: @verbatim XMLHandle docHandle( &document ); XMLElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild().NextSibling().ToElement(); if ( child2 ) { // do something useful @endverbatim Which is MUCH more concise and useful. It is also safe to copy handles - internally they are nothing more than node pointers. @verbatim XMLHandle handleCopy = handle; @endverbatim See also XMLConstHandle, which is the same as XMLHandle, but operates on const objects. */ class XMLHandle { public: /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. XMLHandle( XMLNode* node ) { _node = node; } /// Create a handle from a node. XMLHandle( XMLNode& node ) { _node = &node; } /// Copy constructor XMLHandle( const XMLHandle& ref ) { _node = ref._node; } /// Assignment XMLHandle& operator=( const XMLHandle& ref ) { _node = ref._node; return *this; } /// Get the first child of this handle. XMLHandle FirstChild() { return XMLHandle( _node ? _node->FirstChild() : 0 ); } /// Get the first child element of this handle. XMLHandle FirstChildElement( const char* value=0 ) { return XMLHandle( _node ? _node->FirstChildElement( value ) : 0 ); } /// Get the last child of this handle. XMLHandle LastChild() { return XMLHandle( _node ? _node->LastChild() : 0 ); } /// Get the last child element of this handle. XMLHandle LastChildElement( const char* _value=0 ) { return XMLHandle( _node ? _node->LastChildElement( _value ) : 0 ); } /// Get the previous sibling of this handle. XMLHandle PreviousSibling() { return XMLHandle( _node ? _node->PreviousSibling() : 0 ); } /// Get the previous sibling element of this handle. XMLHandle PreviousSiblingElement( const char* _value=0 ) { return XMLHandle( _node ? _node->PreviousSiblingElement( _value ) : 0 ); } /// Get the next sibling of this handle. XMLHandle NextSibling() { return XMLHandle( _node ? _node->NextSibling() : 0 ); } /// Get the next sibling element of this handle. XMLHandle NextSiblingElement( const char* _value=0 ) { return XMLHandle( _node ? _node->NextSiblingElement( _value ) : 0 ); } /// Safe cast to XMLNode. This can return null. XMLNode* ToNode() { return _node; } /// Safe cast to XMLElement. This can return null. XMLElement* ToElement() { return ( ( _node && _node->ToElement() ) ? _node->ToElement() : 0 ); } /// Safe cast to XMLText. This can return null. XMLText* ToText() { return ( ( _node && _node->ToText() ) ? _node->ToText() : 0 ); } /// Safe cast to XMLUnknown. This can return null. XMLUnknown* ToUnknown() { return ( ( _node && _node->ToUnknown() ) ? _node->ToUnknown() : 0 ); } /// Safe cast to XMLDeclaration. This can return null. XMLDeclaration* ToDeclaration() { return ( ( _node && _node->ToDeclaration() ) ? _node->ToDeclaration() : 0 ); } private: XMLNode* _node; }; /** A variant of the XMLHandle class for working with const XMLNodes and Documents. It is the same in all regards, except for the 'const' qualifiers. See XMLHandle for API. */ class XMLConstHandle { public: XMLConstHandle( const XMLNode* node ) { _node = node; } XMLConstHandle( const XMLNode& node ) { _node = &node; } XMLConstHandle( const XMLConstHandle& ref ) { _node = ref._node; } XMLConstHandle& operator=( const XMLConstHandle& ref ) { _node = ref._node; return *this; } const XMLConstHandle FirstChild() const { return XMLConstHandle( _node ? _node->FirstChild() : 0 ); } const XMLConstHandle FirstChildElement( const char* value=0 ) const { return XMLConstHandle( _node ? _node->FirstChildElement( value ) : 0 ); } const XMLConstHandle LastChild() const { return XMLConstHandle( _node ? _node->LastChild() : 0 ); } const XMLConstHandle LastChildElement( const char* _value=0 ) const { return XMLConstHandle( _node ? _node->LastChildElement( _value ) : 0 ); } const XMLConstHandle PreviousSibling() const { return XMLConstHandle( _node ? _node->PreviousSibling() : 0 ); } const XMLConstHandle PreviousSiblingElement( const char* _value=0 ) const { return XMLConstHandle( _node ? _node->PreviousSiblingElement( _value ) : 0 ); } const XMLConstHandle NextSibling() const { return XMLConstHandle( _node ? _node->NextSibling() : 0 ); } const XMLConstHandle NextSiblingElement( const char* _value=0 ) const { return XMLConstHandle( _node ? _node->NextSiblingElement( _value ) : 0 ); } const XMLNode* ToNode() const { return _node; } const XMLElement* ToElement() const { return ( ( _node && _node->ToElement() ) ? _node->ToElement() : 0 ); } const XMLText* ToText() const { return ( ( _node && _node->ToText() ) ? _node->ToText() : 0 ); } const XMLUnknown* ToUnknown() const { return ( ( _node && _node->ToUnknown() ) ? _node->ToUnknown() : 0 ); } const XMLDeclaration* ToDeclaration() const { return ( ( _node && _node->ToDeclaration() ) ? _node->ToDeclaration() : 0 ); } private: const XMLNode* _node; }; /** Printing functionality. The XMLPrinter gives you more options than the XMLDocument::Print() method. It can: -# Print to memory. -# Print to a file you provide. -# Print XML without a XMLDocument. Print to Memory @verbatim XMLPrinter printer; doc->Print( &printer ); SomeFunction( printer.CStr() ); @endverbatim Print to a File You provide the file pointer. @verbatim XMLPrinter printer( fp ); doc.Print( &printer ); @endverbatim Print without a XMLDocument When loading, an XML parser is very useful. However, sometimes when saving, it just gets in the way. The code is often set up for streaming, and constructing the DOM is just overhead. The Printer supports the streaming case. The following code prints out a trivially simple XML file without ever creating an XML document. @verbatim XMLPrinter printer( fp ); printer.OpenElement( "foo" ); printer.PushAttribute( "foo", "bar" ); printer.CloseElement(); @endverbatim */ class XMLPrinter : public XMLVisitor { public: /** Construct the printer. If the FILE* is specified, this will print to the FILE. Else it will print to memory, and the result is available in CStr(). If 'compact' is set to true, then output is created with only required whitespace and newlines. */ XMLPrinter( FILE* file=0, bool compact = false ); ~XMLPrinter() {} /** If streaming, write the BOM and declaration. */ void PushHeader( bool writeBOM, bool writeDeclaration ); /** If streaming, start writing an element. The element must be closed with CloseElement() */ void OpenElement( const char* name ); /// If streaming, add an attribute to an open element. void PushAttribute( const char* name, const char* value ); void PushAttribute( const char* name, int value ); void PushAttribute( const char* name, unsigned value ); void PushAttribute( const char* name, bool value ); void PushAttribute( const char* name, double value ); /// If streaming, close the Element. void CloseElement(); /// Add a text node. void PushText( const char* text, bool cdata=false ); /// Add a text node from an integer. void PushText( int value ); /// Add a text node from an unsigned. void PushText( unsigned value ); /// Add a text node from a bool. void PushText( bool value ); /// Add a text node from a float. void PushText( float value ); /// Add a text node from a double. void PushText( double value ); /// Add a comment void PushComment( const char* comment ); void PushDeclaration( const char* value ); void PushUnknown( const char* value ); virtual bool VisitEnter( const XMLDocument& /*doc*/ ); virtual bool VisitExit( const XMLDocument& /*doc*/ ) { return true; } virtual bool VisitEnter( const XMLElement& element, const XMLAttribute* attribute ); virtual bool VisitExit( const XMLElement& element ); virtual bool Visit( const XMLText& text ); virtual bool Visit( const XMLComment& comment ); virtual bool Visit( const XMLDeclaration& declaration ); virtual bool Visit( const XMLUnknown& unknown ); /** If in print to memory mode, return a pointer to the XML file in memory. */ const char* CStr() const { return _buffer.Mem(); } /** If in print to memory mode, return the size of the XML file in memory. (Note the size returned includes the terminating null.) */ int CStrSize() const { return _buffer.Size(); } private: void SealElement(); void PrintSpace( int depth ); void PrintString( const char*, bool restrictedEntitySet ); // prints out, after detecting entities. void Print( const char* format, ... ); bool _elementJustOpened; bool _firstElement; FILE* _fp; int _depth; int _textDepth; bool _processEntities; bool _compactMode; enum { ENTITY_RANGE = 64, BUF_SIZE = 200 }; bool _entityFlag[ENTITY_RANGE]; bool _restrictedEntityFlag[ENTITY_RANGE]; DynArray< const char*, 10 > _stack; DynArray< char, 20 > _buffer; #ifdef _MSC_VER DynArray< char, 20 > _accumulator; #endif }; } // tinyxml2 #endif // TINYXML2_INCLUDED MediaInfoLib/ToDo.txt100777 0 0 273 12165355574 10064 0DV in MOV handling DV MPEG-4V false positive MPEG-4, Cover MPEG-4, in one example (vobsub.mp4), framerate is 1 fps, wrong Language change: General --> Container Text --> Subtitle