Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@users.sourceforge.net>2010-08-25 13:35:12 +0400
committerXhmikosR <xhmikosr@users.sourceforge.net>2010-08-25 13:35:12 +0400
commit9ab2555aea33c56a553df6313c970cae05f4a9b3 (patch)
treee881b085bbdedc0ed22c2c48247a1dc0bfdabd27 /src/thirdparty/MediaInfo
parent4da73e1c7894371da7ebd99d024cccf551925e9c (diff)
Added MediaInfoLib (v0.7.34) (there's no need for MediaInfo.dll anymore)
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@2340 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/thirdparty/MediaInfo')
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_7z.cpp81
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_7z.h52
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_Ace.cpp82
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_Ace.h52
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_Bzip2.cpp86
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_Bzip2.h52
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_Elf.cpp240
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_Elf.h52
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_Gzip.cpp92
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_Gzip.h52
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_Mz.cpp173
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_Mz.h52
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_Rar.cpp83
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_Rar.h52
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_Tar.cpp97
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_Tar.h49
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_Zip.cpp82
-rw-r--r--src/thirdparty/MediaInfo/Archive/File_Zip.h52
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Aac.cpp190
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Aac.h76
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Ac3.cpp1580
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Ac3.h133
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Adif.cpp237
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Adif.h57
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Adpcm.cpp87
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Adpcm.h53
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Adts.cpp318
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Adts.h73
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Aes3.cpp291
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Aes3.h61
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Als.cpp147
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Als.h63
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Amr.cpp271
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Amr.h75
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Amv.cpp55
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Amv.h46
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Ape.cpp217
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Ape.h67
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Au.cpp183
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Au.h50
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Dts.cpp1212
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Dts.h110
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_ExtendedModule.cpp116
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_ExtendedModule.h52
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Flac.cpp263
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Flac.h95
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_ImpulseTracker.cpp136
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_ImpulseTracker.h52
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_La.cpp148
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_La.h63
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Latm.cpp205
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Latm.h61
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Midi.cpp55
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Midi.h49
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Module.cpp112
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Module.h53
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Mpc.cpp220
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Mpc.h62
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_MpcSv8.cpp253
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_MpcSv8.h77
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Mpeg4_AudioSpecificConfig.cpp773
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Mpeg4_AudioSpecificConfig.h68
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Mpega.cpp1389
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Mpega.h115
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Pcm.cpp375
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Pcm.h68
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Ps2Audio.cpp131
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Ps2Audio.h52
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_ScreamTracker3.cpp134
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_ScreamTracker3.h52
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Speex.cpp161
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Speex.h64
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Tak.cpp305
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Tak.h77
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Tta.cpp141
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Tta.h65
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_TwinVQ.cpp210
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_TwinVQ.h70
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Vorbis.cpp256
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Vorbis.h58
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Wvpk.cpp727
-rw-r--r--src/thirdparty/MediaInfo/Audio/File_Wvpk.h99
-rw-r--r--src/thirdparty/MediaInfo/Duplicate/File__Duplicate_MpegTs.cpp488
-rw-r--r--src/thirdparty/MediaInfo/Duplicate/File__Duplicate_MpegTs.h158
-rw-r--r--src/thirdparty/MediaInfo/Duplicate/File__Duplicate__Base.cpp47
-rw-r--r--src/thirdparty/MediaInfo/Duplicate/File__Duplicate__Base.h51
-rw-r--r--src/thirdparty/MediaInfo/Duplicate/File__Duplicate__Writer.cpp163
-rw-r--r--src/thirdparty/MediaInfo/Duplicate/File__Duplicate__Writer.h81
-rw-r--r--src/thirdparty/MediaInfo/Export/Export_Mpeg7.cpp1188
-rw-r--r--src/thirdparty/MediaInfo/Export/Export_Mpeg7.h52
-rw-r--r--src/thirdparty/MediaInfo/Export/Export_PBCore.cpp399
-rw-r--r--src/thirdparty/MediaInfo/Export/Export_PBCore.h52
-rw-r--r--src/thirdparty/MediaInfo/File_Dummy.cpp322
-rw-r--r--src/thirdparty/MediaInfo/File_Dummy.h60
-rw-r--r--src/thirdparty/MediaInfo/File_Other.cpp186
-rw-r--r--src/thirdparty/MediaInfo/File_Other.h51
-rw-r--r--src/thirdparty/MediaInfo/File_Unknown.cpp56
-rw-r--r--src/thirdparty/MediaInfo/File_Unknown.h51
-rw-r--r--src/thirdparty/MediaInfo/File__Analyse_Automatic.h982
-rw-r--r--src/thirdparty/MediaInfo/File__Analyze.cpp2298
-rw-r--r--src/thirdparty/MediaInfo/File__Analyze.h1161
-rw-r--r--src/thirdparty/MediaInfo/File__Analyze_Buffer.cpp1786
-rw-r--r--src/thirdparty/MediaInfo/File__Analyze_Buffer_MinimizeSize.cpp1249
-rw-r--r--src/thirdparty/MediaInfo/File__Analyze_MinimizeSize.h1047
-rw-r--r--src/thirdparty/MediaInfo/File__Analyze_Streams.cpp2066
-rw-r--r--src/thirdparty/MediaInfo/File__Analyze_Streams_Finish.cpp422
-rw-r--r--src/thirdparty/MediaInfo/File__Base.cpp222
-rw-r--r--src/thirdparty/MediaInfo/File__Base.h126
-rw-r--r--src/thirdparty/MediaInfo/File__Duplicate.cpp86
-rw-r--r--src/thirdparty/MediaInfo/File__Duplicate.h65
-rw-r--r--src/thirdparty/MediaInfo/File__MultipleParsing.cpp640
-rw-r--r--src/thirdparty/MediaInfo/File__MultipleParsing.h66
-rw-r--r--src/thirdparty/MediaInfo/Image/File_Bmp.cpp174
-rw-r--r--src/thirdparty/MediaInfo/Image/File_Bmp.h56
-rw-r--r--src/thirdparty/MediaInfo/Image/File_Gif.cpp110
-rw-r--r--src/thirdparty/MediaInfo/Image/File_Gif.h52
-rw-r--r--src/thirdparty/MediaInfo/Image/File_Ico.cpp158
-rw-r--r--src/thirdparty/MediaInfo/Image/File_Ico.h76
-rw-r--r--src/thirdparty/MediaInfo/Image/File_Jpeg.cpp607
-rw-r--r--src/thirdparty/MediaInfo/Image/File_Jpeg.h146
-rw-r--r--src/thirdparty/MediaInfo/Image/File_Png.cpp244
-rw-r--r--src/thirdparty/MediaInfo/Image/File_Png.h60
-rw-r--r--src/thirdparty/MediaInfo/Image/File_Rle.cpp84
-rw-r--r--src/thirdparty/MediaInfo/Image/File_Rle.h55
-rw-r--r--src/thirdparty/MediaInfo/Image/File_Tiff.cpp94
-rw-r--r--src/thirdparty/MediaInfo/Image/File_Tiff.h52
-rw-r--r--src/thirdparty/MediaInfo/MediaInfo.cpp237
-rw-r--r--src/thirdparty/MediaInfo/MediaInfo.h252
-rw-r--r--src/thirdparty/MediaInfo/MediaInfoLib.vcproj1494
-rw-r--r--src/thirdparty/MediaInfo/MediaInfoLib.vcxproj438
-rw-r--r--src/thirdparty/MediaInfo/MediaInfoLib.vcxproj.filters897
-rw-r--r--src/thirdparty/MediaInfo/MediaInfoList.cpp256
-rw-r--r--src/thirdparty/MediaInfo/MediaInfoList.h225
-rw-r--r--src/thirdparty/MediaInfo/MediaInfoList_Internal.cpp474
-rw-r--r--src/thirdparty/MediaInfo/MediaInfoList_Internal.h96
-rw-r--r--src/thirdparty/MediaInfo/MediaInfo_Config.cpp1507
-rw-r--r--src/thirdparty/MediaInfo/MediaInfo_Config.h229
-rw-r--r--src/thirdparty/MediaInfo/MediaInfo_Config_Automatic.cpp5158
-rw-r--r--src/thirdparty/MediaInfo/MediaInfo_Config_MediaInfo.cpp621
-rw-r--r--src/thirdparty/MediaInfo/MediaInfo_Config_MediaInfo.h153
-rw-r--r--src/thirdparty/MediaInfo/MediaInfo_Const.h143
-rw-r--r--src/thirdparty/MediaInfo/MediaInfo_Events.h444
-rw-r--r--src/thirdparty/MediaInfo/MediaInfo_Events_Internal.h57
-rw-r--r--src/thirdparty/MediaInfo/MediaInfo_File.cpp819
-rw-r--r--src/thirdparty/MediaInfo/MediaInfo_Inform.cpp474
-rw-r--r--src/thirdparty/MediaInfo/MediaInfo_Internal.cpp817
-rw-r--r--src/thirdparty/MediaInfo/MediaInfo_Internal.h164
-rw-r--r--src/thirdparty/MediaInfo/MediaInfo_Internal_Const.h153
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Bdmv.cpp1607
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Bdmv.h91
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Cdxa.cpp317
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Cdxa.h73
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Dpg.cpp186
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Dpg.h71
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_DvDif.cpp1493
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_DvDif.h341
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_DvDif_Analysis.cpp1625
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Dvdv.cpp1542
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Dvdv.h129
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Flv.cpp1311
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Flv.h115
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Gxf.cpp939
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Gxf.h139
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Ivf.cpp111
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Ivf.h55
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Lxf.cpp584
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Lxf.h110
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Mk.cpp3075
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Mk.h337
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Mpeg4.cpp697
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Mpeg4.h323
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Mpeg4_Descriptors.cpp959
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Mpeg4_Descriptors.h162
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Mpeg4_Elements.cpp4503
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Mpeg4_TimeCode.cpp85
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Mpeg4_TimeCode.h51
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_MpegPs.cpp3645
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_MpegPs.h276
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_MpegTs.cpp1689
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_MpegTs.h137
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_MpegTs_Duplicate.cpp353
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Mpeg_Descriptors.cpp2989
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Mpeg_Descriptors.h584
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Mpeg_Psi.cpp2065
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Mpeg_Psi.h162
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Mxf.cpp4135
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Mxf.h465
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Nut.cpp294
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Nut.h59
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Ogg.cpp394
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Ogg.h110
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Ogg_SubElement.cpp893
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Ogg_SubElement.h102
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_P2_Clip.cpp379
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_P2_Clip.h50
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Riff.cpp660
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Riff.h304
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Riff_Elements.cpp3306
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Rm.cpp785
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Rm.h76
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Skm.cpp194
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Skm.h83
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Swf.cpp704
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Swf.h133
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Umf.cpp208
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Umf.h54
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Wm.cpp260
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Wm.h188
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Wm_Elements.cpp1687
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Xdcam_Clip.cpp180
-rw-r--r--src/thirdparty/MediaInfo/Multiple/File_Xdcam_Clip.h50
-rw-r--r--src/thirdparty/MediaInfo/PreComp.h40
-rw-r--r--src/thirdparty/MediaInfo/Reader/Reader_Directory.cpp240
-rw-r--r--src/thirdparty/MediaInfo/Reader/Reader_Directory.h65
-rw-r--r--src/thirdparty/MediaInfo/Reader/Reader_File.cpp196
-rw-r--r--src/thirdparty/MediaInfo/Reader/Reader_File.h50
-rw-r--r--src/thirdparty/MediaInfo/Reader/Reader__Base.h52
-rw-r--r--src/thirdparty/MediaInfo/Reader/Reader_libcurl.cpp202
-rw-r--r--src/thirdparty/MediaInfo/Reader/Reader_libcurl.h49
-rw-r--r--src/thirdparty/MediaInfo/Reader/Reader_libmms.cpp121
-rw-r--r--src/thirdparty/MediaInfo/Reader/Reader_libmms.h49
-rw-r--r--src/thirdparty/MediaInfo/Setup.h555
-rw-r--r--src/thirdparty/MediaInfo/Tag/File_ApeTag.cpp210
-rw-r--r--src/thirdparty/MediaInfo/Tag/File_ApeTag.h60
-rw-r--r--src/thirdparty/MediaInfo/Tag/File_Id3.cpp107
-rw-r--r--src/thirdparty/MediaInfo/Tag/File_Id3.h49
-rw-r--r--src/thirdparty/MediaInfo/Tag/File_Id3v2.cpp1257
-rw-r--r--src/thirdparty/MediaInfo/Tag/File_Id3v2.h247
-rw-r--r--src/thirdparty/MediaInfo/Tag/File_Lyrics3.cpp95
-rw-r--r--src/thirdparty/MediaInfo/Tag/File_Lyrics3.h56
-rw-r--r--src/thirdparty/MediaInfo/Tag/File_Lyrics3v2.cpp233
-rw-r--r--src/thirdparty/MediaInfo/Tag/File_Lyrics3v2.h73
-rw-r--r--src/thirdparty/MediaInfo/Tag/File_VorbisCom.cpp307
-rw-r--r--src/thirdparty/MediaInfo/Tag/File_VorbisCom.h67
-rw-r--r--src/thirdparty/MediaInfo/Tag/File__Tags.cpp561
-rw-r--r--src/thirdparty/MediaInfo/Tag/File__Tags.h105
-rw-r--r--src/thirdparty/MediaInfo/Text/File_Cdp.cpp413
-rw-r--r--src/thirdparty/MediaInfo/Text/File_Cdp.h93
-rw-r--r--src/thirdparty/MediaInfo/Text/File_Cmml.cpp118
-rw-r--r--src/thirdparty/MediaInfo/Text/File_Cmml.h58
-rw-r--r--src/thirdparty/MediaInfo/Text/File_DtvccTransport.cpp314
-rw-r--r--src/thirdparty/MediaInfo/Text/File_DtvccTransport.h93
-rw-r--r--src/thirdparty/MediaInfo/Text/File_Eia608.cpp822
-rw-r--r--src/thirdparty/MediaInfo/Text/File_Eia608.h129
-rw-r--r--src/thirdparty/MediaInfo/Text/File_Eia708.cpp1230
-rw-r--r--src/thirdparty/MediaInfo/Text/File_Eia708.h184
-rw-r--r--src/thirdparty/MediaInfo/Text/File_Kate.cpp154
-rw-r--r--src/thirdparty/MediaInfo/Text/File_Kate.h56
-rw-r--r--src/thirdparty/MediaInfo/Text/File_N19.cpp378
-rw-r--r--src/thirdparty/MediaInfo/Text/File_N19.h59
-rw-r--r--src/thirdparty/MediaInfo/Text/File_OtherText.cpp219
-rw-r--r--src/thirdparty/MediaInfo/Text/File_OtherText.h48
-rw-r--r--src/thirdparty/MediaInfo/Text/File_Pgs.cpp63
-rw-r--r--src/thirdparty/MediaInfo/Text/File_Pgs.h49
-rw-r--r--src/thirdparty/MediaInfo/Text/File_Scte20.cpp263
-rw-r--r--src/thirdparty/MediaInfo/Text/File_Scte20.h90
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Afd.cpp130
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Afd.h71
-rw-r--r--src/thirdparty/MediaInfo/Video/File_AfdBarData.cpp276
-rw-r--r--src/thirdparty/MediaInfo/Video/File_AfdBarData.h101
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Avc.cpp2541
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Avc.h291
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Avc_Duplicate.cpp261
-rw-r--r--src/thirdparty/MediaInfo/Video/File_AvsV.cpp832
-rw-r--r--src/thirdparty/MediaInfo/Video/File_AvsV.h123
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Dirac.cpp895
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Dirac.h117
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Flic.cpp144
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Flic.h49
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Fraps.cpp147
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Fraps.h61
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Lagarith.cpp102
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Lagarith.h56
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Mpeg4v.cpp1665
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Mpeg4v.h195
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Mpegv.cpp1974
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Mpegv.h266
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Theora.cpp141
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Theora.h58
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Vc1.cpp949
-rw-r--r--src/thirdparty/MediaInfo/Video/File_Vc1.h155
281 files changed, 117455 insertions, 0 deletions
diff --git a/src/thirdparty/MediaInfo/Archive/File_7z.cpp b/src/thirdparty/MediaInfo/Archive/File_7z.cpp
new file mode 100644
index 000000000..0454d6f74
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_7z.cpp
@@ -0,0 +1,81 @@
+// File_7z - Info for 7z files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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
diff --git a/src/thirdparty/MediaInfo/Archive/File_7z.h b/src/thirdparty/MediaInfo/Archive/File_7z.h
new file mode 100644
index 000000000..43f2f2456
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_7z.h
@@ -0,0 +1,52 @@
+// File_7z - Info for 7z files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Archive/File_Ace.cpp b/src/thirdparty/MediaInfo/Archive/File_Ace.cpp
new file mode 100644
index 000000000..7a9ca8c9d
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_Ace.cpp
@@ -0,0 +1,82 @@
+// File_Ace - Info for ACE files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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
diff --git a/src/thirdparty/MediaInfo/Archive/File_Ace.h b/src/thirdparty/MediaInfo/Archive/File_Ace.h
new file mode 100644
index 000000000..f1835123e
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_Ace.h
@@ -0,0 +1,52 @@
+// File_Ace - Info for ACE files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Archive/File_Bzip2.cpp b/src/thirdparty/MediaInfo/Archive/File_Bzip2.cpp
new file mode 100644
index 000000000..109e63eff
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_Bzip2.cpp
@@ -0,0 +1,86 @@
+// File_Bzip2 - Info for BZIP2 files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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
diff --git a/src/thirdparty/MediaInfo/Archive/File_Bzip2.h b/src/thirdparty/MediaInfo/Archive/File_Bzip2.h
new file mode 100644
index 000000000..c7f595f89
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_Bzip2.h
@@ -0,0 +1,52 @@
+// File_Bzip2 - Info for PCM files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Archive/File_Elf.cpp b/src/thirdparty/MediaInfo/Archive/File_Elf.cpp
new file mode 100644
index 000000000..3cc730dad
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_Elf.cpp
@@ -0,0 +1,240 @@
+// File_Elf - Info for ELF files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_Info(Elf_osabi(osabi));
+ Get_L1 (abiversion, "abiversion");
+ Skip_XX(7, "reserved");
+ if (data==1) //LE
+ {
+ Get_L2 (type, "type"); Param_Info(Elf_type(type));
+ Get_L2 (machine, "machine"); Param_Info(Elf_machine(machine));
+ Get_L4 (version4, "version");
+ }
+ if (data==2) //BE
+ {
+ Get_B2 (type, "type"); Param_Info(Elf_type(type));
+ Get_B2 (machine, "machine"); Param_Info(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
diff --git a/src/thirdparty/MediaInfo/Archive/File_Elf.h b/src/thirdparty/MediaInfo/Archive/File_Elf.h
new file mode 100644
index 000000000..c143e74ea
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_Elf.h
@@ -0,0 +1,52 @@
+// File_Elf - Info for ELF files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Archive/File_Gzip.cpp b/src/thirdparty/MediaInfo/Archive/File_Gzip.cpp
new file mode 100644
index 000000000..6489b178f
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_Gzip.cpp
@@ -0,0 +1,92 @@
+// File_Gzip - Info for Gzip files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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
diff --git a/src/thirdparty/MediaInfo/Archive/File_Gzip.h b/src/thirdparty/MediaInfo/Archive/File_Gzip.h
new file mode 100644
index 000000000..6245365e4
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_Gzip.h
@@ -0,0 +1,52 @@
+// File_Gzip - Info for Gzip files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Archive/File_Mz.cpp b/src/thirdparty/MediaInfo/Archive/File_Mz.cpp
new file mode 100644
index 000000000..e3477533f
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_Mz.cpp
@@ -0,0 +1,173 @@
+// File_Mz - Info for MZ files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_Begin("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_End();
+ }
+ if (Element_Offset>lfanew)
+ {
+ Element_End();
+ 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_Begin("PE");
+ Skip_C4( "Header");
+ Get_L2 (Machine, "Machine"); Param_Info(Mz_Machine(Machine));
+ Skip_L2( "NumberOfSections");
+ Get_L4 (TimeDateStamp, "TimeDateStamp"); Param_Info(Ztring().Date_From_Seconds_1970(TimeDateStamp));
+ Skip_L4( "PointerToSymbolTable");
+ Skip_L4( "NumberOfSymbols");
+ Skip_L2( "SizeOfOptionalHeader");
+ Get_L2 (Characteristics, "Characteristics");
+ Element_End("PE");
+ }
+
+ 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
diff --git a/src/thirdparty/MediaInfo/Archive/File_Mz.h b/src/thirdparty/MediaInfo/Archive/File_Mz.h
new file mode 100644
index 000000000..b0be9eef8
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_Mz.h
@@ -0,0 +1,52 @@
+// File_Mz - Info for MZ files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Archive/File_Rar.cpp b/src/thirdparty/MediaInfo/Archive/File_Rar.cpp
new file mode 100644
index 000000000..626889300
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_Rar.cpp
@@ -0,0 +1,83 @@
+// File_Rar - Info for RAR files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_RAR_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Archive/File_Rar.h"
+#include "ZenLib/Utils.h"
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Static stuff
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Rar::FileHeader_Begin()
+{
+ //Element_Size
+ if (Buffer_Size<4)
+ return false; //Must wait for more data
+
+ if (CC4(Buffer)!=0x52415221) //"RAR!"
+ {
+ Reject("RAR");
+ return false;
+ }
+
+ //All should be OK...
+ return true;
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Rar::Read_Buffer_Continue()
+{
+ Skip_B4( "Magic");
+ Skip_XX(File_Size-4, "Data");
+
+ FILLING_BEGIN();
+ Accept("RAR");
+
+ Fill(Stream_General, 0, General_Format, "RAR");
+
+ Finish("RAR");
+ FILLING_END();
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_RAR_YES
diff --git a/src/thirdparty/MediaInfo/Archive/File_Rar.h b/src/thirdparty/MediaInfo/Archive/File_Rar.h
new file mode 100644
index 000000000..63a5b8b64
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_Rar.h
@@ -0,0 +1,52 @@
+// File_Rar - Info for RAR files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about RAR files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_RarH
+#define MediaInfo_File_RarH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Rar
+//***************************************************************************
+
+class File_Rar : public File__Analyze
+{
+protected :
+ //Buffer - File header
+ bool FileHeader_Begin();
+
+ //Buffer - Global
+ void Read_Buffer_Continue ();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Archive/File_Tar.cpp b/src/thirdparty/MediaInfo/Archive/File_Tar.cpp
new file mode 100644
index 000000000..b47144f07
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_Tar.cpp
@@ -0,0 +1,97 @@
+// File_Tar - Info for Tar files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_TAR_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Archive/File_Tar.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Tar::Read_Buffer_Continue()
+{
+ //Parsing
+ Ztring ChecksumO;
+ Skip_Local(100, "File name");
+ Skip_Local( 8, "File mode");
+ Skip_Local( 8, "Owner's numeric user ID");
+ Skip_Local( 12, "Group's numeric user ID");
+ Skip_Local( 12, "File size in bytes");
+ Skip_Local( 8, "Last modification time in numeric Unix time format");
+ Get_Local ( 8, ChecksumO, "Checksum for header block");
+ Skip_B1( "Link indicator (file type)");
+ Skip_Local(100, "Name of linked file");
+ Skip_XX(File_Size-257, "Data");
+
+ FILLING_BEGIN();
+ //Handling Checksum
+ int32u Checksum=ChecksumO.To_int32u(8);
+ int32u ChecksumU=0;
+ int32u ChecksumS=0;
+ for (size_t Pos=0; Pos<257; Pos++)
+ {
+ if (Pos==148)
+ {
+ ChecksumU+=32*8; //8 spaces
+ ChecksumS+=32*8; //8 spaces
+ Pos+=7; //Skiping Checksum
+ }
+ ChecksumU+=(int8u)Buffer[Pos];
+ ChecksumS+=(int8s)Buffer[Pos];
+ }
+
+ if (ChecksumU!=Checksum && ChecksumS!=Checksum)
+ {
+ Reject("Tar");
+ return;
+ }
+
+ //Filling
+ Accept("Tar");
+
+ Fill(Stream_General, 0, General_Format, "Tar");
+
+ Reject("Tar");
+ FILLING_END();
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_TAR_YES
diff --git a/src/thirdparty/MediaInfo/Archive/File_Tar.h b/src/thirdparty/MediaInfo/Archive/File_Tar.h
new file mode 100644
index 000000000..0d755eed5
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_Tar.h
@@ -0,0 +1,49 @@
+// File_Tar - Info for Tar files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Tar files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_TarH
+#define MediaInfo_File_TarH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Tar
+//***************************************************************************
+
+class File_Tar : public File__Analyze
+{
+protected :
+ //Buffer - Global
+ void Read_Buffer_Continue ();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Archive/File_Zip.cpp b/src/thirdparty/MediaInfo/Archive/File_Zip.cpp
new file mode 100644
index 000000000..a27a3a275
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_Zip.cpp
@@ -0,0 +1,82 @@
+// File_Zip - Info for NewFormat files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_ZIP_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Archive/File_Zip.h"
+#include "ZenLib/Utils.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Static stuff
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Zip::FileHeader_Begin()
+{
+ //Element_Size
+ if (Buffer_Size<4)
+ return false; //Must wait for more data
+
+ if (CC4(Buffer)!=0x504B0304) //"PK.."
+ {
+ Reject("ZIP");
+ return false;
+ }
+
+ //All should be OK...
+ return true;
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Zip::Read_Buffer_Continue()
+{
+ Skip_B4( "Magic");
+ Skip_XX(File_Size-4, "Data");
+
+ FILLING_BEGIN();
+ Accept("Zip");
+
+ Fill(Stream_General, 0, General_Format, "ZIP");
+
+ Finish("Zip");
+ FILLING_END();
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_ZIP_YES
diff --git a/src/thirdparty/MediaInfo/Archive/File_Zip.h b/src/thirdparty/MediaInfo/Archive/File_Zip.h
new file mode 100644
index 000000000..b3418de84
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Archive/File_Zip.h
@@ -0,0 +1,52 @@
+// File_Zip - Info for NewFormat files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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 ();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Audio/File_Aac.cpp b/src/thirdparty/MediaInfo/Audio/File_Aac.cpp
new file mode 100644
index 000000000..cee708f1e
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Aac.cpp
@@ -0,0 +1,190 @@
+// File_Aac - Info for AAC (Raw) files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_AAC_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Audio/File_Aac.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Aac::File_Aac()
+{
+ //In
+ #ifdef MEDIAINFO_MPEG4_YES
+ DecSpecificInfoTag=NULL;
+ SLConfig=NULL;
+ #endif
+
+ //libfaad specific
+ #ifdef MEDIAINFO_FAAD_YES
+ hAac=NULL;
+ #endif
+}
+
+//---------------------------------------------------------------------------
+File_Aac::~File_Aac()
+{
+ //libfaad specific
+ #ifdef MEDIAINFO_FAAD_YES
+ NeAACDecClose(hAac); //hAac=NULL;
+ #endif
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Aac::Read_Buffer_Continue()
+{
+ if (!Codec.empty())
+ From_Codec(); //It is impossible to detect... Default is no detection, only filling
+ else
+ libfaad(); //Trying libfaad if available
+}
+
+//***************************************************************************
+// Helpers
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Aac::From_Codec()
+{
+ //Filling
+ Accept("AAC");
+
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, 0, Audio_Format, "AAC");
+ Fill(Stream_Audio, 0, Audio_Codec, Codec);
+ Ztring Profile;
+ int8u Version=0, SBR=2, PS=2;
+ if (0);
+ else if (Codec==_T("A_AAC/MPEG2/MAIN")) {Version=2; Profile=_T("Main");}
+ else if (Codec==_T("A_AAC/MPEG2/LC")) {Version=2; Profile=_T("LC"); SBR=0;}
+ else if (Codec==_T("A_AAC/MPEG2/LC/SBR")) {Version=2; Profile=_T("LC"); SBR=1;}
+ else if (Codec==_T("A_AAC/MPEG2/SSR")) {Version=2; Profile=_T("SSR");}
+ else if (Codec==_T("A_AAC/MPEG4/MAIN")) {Version=4; Profile=_T("Main");}
+ else if (Codec==_T("A_AAC/MPEG4/LC")) {Version=4; Profile=_T("LC"); SBR=0;}
+ else if (Codec==_T("A_AAC/MPEG4/LC/SBR")) {Version=4; Profile=_T("LC"); SBR=1; PS=0;}
+ else if (Codec==_T("A_AAC/MPEG4/LC/SBR/PS")){Version=4; Profile=_T("LC"); SBR=1; PS=1;}
+ else if (Codec==_T("A_AAC/MPEG4/SSR")) {Version=4; Profile=_T("SSR");}
+ else if (Codec==_T("A_AAC/MPEG4/LTP")) {Version=4; Profile=_T("LTP");}
+ else if (Codec==_T("raac")) { Profile=_T("LC");}
+ else if (Codec==_T("racp")) { Profile=_T("LC"); SBR=1; PS=0;}
+
+ if (Version>0)
+ Fill(Stream_Audio, 0, Audio_Format_Version, Version==2?"Version 2":"Version 4");
+ Fill(Stream_Audio, 0, Audio_Format_Profile, Profile);
+ if (SBR!=2)
+ {
+ if (SBR)
+ Fill(Stream_Audio, 0, Audio_Format_Settings, "SBR");
+ Fill(Stream_Audio, 0, Audio_Format_Settings_SBR, SBR?"Yes":"No");
+ }
+ if (PS!=2)
+ {
+ if (PS)
+ Fill(Stream_Audio, 0, Audio_Format_Settings, "PS");
+ Fill(Stream_Audio, 0, Audio_Format_Settings_PS, PS?"Yes":"No");
+ }
+
+ Finish("AAC");
+}
+
+//***************************************************************************
+// libfaad specific
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Aac::libfaad()
+{
+ #if defined(MEDIAINFO_FAAD_YES) && defined(MEDIAINFO_MPEG4_YES)
+ unsigned long samplerate;
+ unsigned char channels;
+
+ //Open the library
+ if (hAac==NULL)
+ {
+ hAac = NeAACDecOpen();
+ // Initialise the library using one of the initialization functions
+ char err = NeAACDecInit2(hAac, (unsigned char *)DecSpecificInfoTag->Buffer, DecSpecificInfoTag->Buffer_Size, &samplerate, &channels);
+ if (err != 0)
+ {
+ //
+ // Handle error
+ //
+ }
+ }
+
+ //Decode the frame in buffer
+ void* samplebuffer;
+ NeAACDecFrameInfo hInfo;
+ samplebuffer = NeAACDecDecode(hAac, &hInfo, (unsigned char *)Buffer, Buffer_Size);
+ if ((hInfo.error == 0) && (hInfo.samples > 0))
+ {
+ //
+ // do what you need to do with the decoded samples
+ //
+ }
+ else if (hInfo.error != 0)
+ {
+ //
+ // Some error occurred while decoding this frame
+ //
+ }
+ #else
+ //Filling
+ if (!Status[IsAccepted])
+ {
+ Accept("AAC");
+
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, 0, Audio_Format, "AAC");
+ Fill(Stream_Audio, 0, Audio_Codec, "AAC");
+
+ Finish("AAC");
+ }
+ #endif
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_AAC_YES
diff --git a/src/thirdparty/MediaInfo/Audio/File_Aac.h b/src/thirdparty/MediaInfo/Audio/File_Aac.h
new file mode 100644
index 000000000..a799efa3d
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Aac.h
@@ -0,0 +1,76 @@
+// File_Aac - Info for AAC (Raw) files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about AAC (Raw) files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_AacH
+#define MediaInfo_File_AacH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#ifdef MEDIAINFO_MPEG4_YES
+ #include "MediaInfo/Multiple/File_Mpeg4_Descriptors.h"
+#endif
+#ifdef MEDIAINFO_FAAD_YES
+ #include "neaacdec.h";
+#endif
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Aac
+//***************************************************************************
+
+class File_Aac : public File__Analyze
+{
+public :
+ //In
+ ZenLib::Ztring Codec;
+ #ifdef MEDIAINFO_MPEG4_YES
+ File_Mpeg4_Descriptors::decspecificinfotag* DecSpecificInfoTag;
+ File_Mpeg4_Descriptors::slconfig* SLConfig;
+ #endif
+
+ //Constructor/Destructor
+ File_Aac();
+ ~File_Aac();
+
+protected :
+ //Buffer - Global
+ void Read_Buffer_Continue ();
+
+ //Helpers
+ void From_Codec();
+
+ //libfaad specific
+ void libfaad();
+ #if defined(MEDIAINFO_FAAD_YES) && defined(MEDIAINFO_MPEG4_YES)
+ NeAACDecHandle hAac;
+ #endif
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Audio/File_Ac3.cpp b/src/thirdparty/MediaInfo/Audio/File_Ac3.cpp
new file mode 100644
index 000000000..f1a26a557
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Ac3.cpp
@@ -0,0 +1,1580 @@
+// File_Ac3 - Info for AC3 files
+// Copyright (C) 2004-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//***************************************************************************
+// 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,};
+
+//---------------------------------------------------------------------------
+extern 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)",
+};
+
+//---------------------------------------------------------------------------
+extern const char* AC3_Surround[]=
+{
+ "",
+ "(No surround)",
+ "(Surround)",
+ "",
+};
+
+//---------------------------------------------------------------------------
+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 <vector>
+#include <cmath>
+using namespace ZenLib;
+using namespace std;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Infos
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+const int32u AC3_SamplingRate2[]=
+{ 24000, 22050, 16000, 0,};
+
+//---------------------------------------------------------------------------
+const char* AC3_ChannelPositions[]=
+{
+ "Front: L R",
+ "Front: C",
+ "Front: L R",
+ "Front: L C R",
+ "Front: L R, Side: C",
+ "Front: L C R, Side: C",
+ "Front: L R, Side: L R",
+ "Front: L C R, Side: L R",
+};
+
+//---------------------------------------------------------------------------
+const char* AC3_ChannelPositions2[]=
+{
+ "2/0/0",
+ "1/0/0",
+ "2/0/0",
+ "3/0/0",
+ "2/1/0",
+ "3/1/0",
+ "2/2/0",
+ "3/2/0",
+};
+
+//---------------------------------------------------------------------------
+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
+ MustSynchronize=true;
+ Buffer_TotalBytes_FirstSynched_Max=32*1024;
+ PTS_DTS_Needed=true;
+
+ //In
+ Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.3?32:2;
+ MustParse_dac3=false;
+ MustParse_dec3=false;
+
+ //Temp
+ Frame_Count=0;
+ HD_Count=0;
+ chanmap=0;
+ frmsiz=0;
+ fscod=0;
+ fscod2=0;
+ frmsizecod=0;
+ bsid=0;
+ bsmod=0;
+ acmod=0;
+ dsurmod=0;
+ numblks=0;
+ lfeon=false;
+ dxc3_Parsed=false;
+ HD_MajorSync_Parsed=false;
+ HD_AlreadyCounted=false;
+ Core_IsPresent=false;
+ dynrnge_Exists=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_Profile, "TrueHD");
+ Fill(Stream_General, 0, General_Format_Profile, "Core");
+ Fill(Stream_Audio, 0, Audio_Format_Profile, "TrueHD");
+ Fill(Stream_Audio, 0, Audio_Format_Profile, "Core");
+ Fill(Stream_Audio, 0, Audio_Codec, "TrueHD");
+ Fill(Stream_Audio, 0, Audio_BitRate_Mode, "VBR");
+ Fill(Stream_Audio, 0, Audio_BitRate, "Variable");
+ 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 (!IsSub)
+ Fill(Stream_Audio, 0, Audio_MuxingMode, "After core data");
+ }
+
+ if (HD_StreamType==0xBB) //TrueHD
+ {
+ Fill(Stream_General, 0, General_Format, "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_Resolution, AC3_MLP_Resolution[HD_Resolution2]);
+ if (HD_Resolution1!=HD_Resolution2)
+ Fill(Stream_Audio, 0, Audio_Resolution, AC3_MLP_Resolution[HD_Resolution1]);
+ }
+ }
+
+ //MLP
+ if (!Core_IsPresent)
+ {
+ Fill(Stream_Audio, 0, Audio_Format, "MLP");
+ Fill(Stream_Audio, 0, Audio_Codec, "MLP");
+ }
+
+ //AC-3
+ else if (bsid<=0x08)
+ {
+ if (Count_Get(Stream_Audio)==0)
+ {
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, 0, Audio_Codec, "AC3");
+ }
+ Fill(Stream_Audio, 0, Audio_Format, "AC-3");
+ Fill(Stream_Audio, 0, Audio_Resolution, 16);
+
+ if (Ztring::ToZtring(AC3_SamplingRate[fscod])!=Retrieve(Stream_Audio, 0, Audio_SamplingRate))
+ Fill(Stream_Audio, 0, Audio_SamplingRate, AC3_SamplingRate[fscod]);
+ if (frmsizecod/2<19)
+ {
+ int32u BitRate=AC3_BitRate[frmsizecod/2]*1000;
+ Fill(Stream_Audio, 0, Audio_BitRate, BitRate);
+ if (Buffer_TotalBytes_FirstSynched>100 && BitRate>0)
+ Fill(Stream_Audio, 0, Audio_Delay, (float)Buffer_TotalBytes_FirstSynched*8*1000/BitRate, 0);
+ }
+
+ if (acmod==0)
+ Fill(Stream_Audio, 0, Audio_Format_Settings_Mode, "Dual Mono");
+ Fill(Stream_Audio, 0, Audio_Format_Settings_ModeExtension, AC3_Mode[bsmod]);
+ int8u Channels=AC3_Channels[acmod];
+ Ztring ChannelPositions; ChannelPositions.From_Local(AC3_ChannelPositions[acmod]);
+ Ztring ChannelPositions2; ChannelPositions2.From_Local(AC3_ChannelPositions2[acmod]);
+ if (lfeon)
+ {
+ 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 (dsurmod==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==0x10)
+ {
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, 0, Audio_Format, "E-AC-3");
+ Fill(Stream_Audio, 0, Audio_Codec, "AC3+");
+
+ Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR");
+ if (numblks>0)
+ Fill(Stream_Audio, 0, Audio_BitRate, ((frmsiz*2+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 (chanmap==0)
+ {
+ if (acmod==0)
+ {
+ Fill(Stream_Audio, 0, Audio_Format_Profile, "Dual Mono");
+ Fill(Stream_Audio, 0, Audio_Codec_Profile, "Dual Mono");
+ }
+ int8u Channels=AC3_Channels[acmod];
+ Ztring ChannelPositions; ChannelPositions.From_Local(AC3_ChannelPositions[acmod]);
+ if (lfeon)
+ {
+ Channels+=1;
+ ChannelPositions+=_T(", LFE");
+ }
+ Fill(Stream_Audio, 0, Audio_Channel_s_, Channels);
+ Fill(Stream_Audio, 0, Audio_ChannelPositions, ChannelPositions);
+ }
+ }
+
+ 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
+ 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");
+ }
+ Fill(Stream_Audio, 0, "bsid", bsid);
+ (*Stream_More)[Stream_Audio][0](Ztring().From_Local("bsid"), Info_Options)=_T("N NT");
+}
+
+//---------------------------------------------------------------------------
+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; Pos<dialnorms.size(); Pos++)
+ if (dialnorms[Pos])
+ {
+ if (Minimum_Raw<(Pos==0?31:Pos))
+ Minimum_Raw=(Pos==0?31:Pos);
+ if (Maximum_Raw>(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<comprs.size(); Pos++)
+ if (comprs[Pos])
+ {
+ float64 Value=AC3_compr[Pos>>4]+20*std::log10(((float)(0x10+(Pos&0x0F)))/32);
+ if (Minimum_dB>Value)
+ Minimum_dB=Value;
+ if (Maximum_dB<Value)
+ Maximum_dB=Value;
+ Sum_Intensity+=comprs[Pos]*pow(10, Value/10);
+ Count+=comprs[Pos];
+ }
+ float64 Average_dB=log10(Sum_Intensity/Count)*10;
+ Fill(Stream_Audio, 0, "compr_Average", Average_dB, 2);
+ (*Stream_More)[Stream_Audio][0](Ztring().From_Local("compr_Average"), Info_Options)=_T("N NT");
+ Fill(Stream_Audio, 0, "compr_Average/String", Ztring::ToZtring(Average_dB, 2)+_T(" dB"));
+ (*Stream_More)[Stream_Audio][0](Ztring().From_Local("compr_Average/String"), Info_Options)=_T("N NT");
+ Fill(Stream_Audio, 0, "compr_Minimum", Minimum_dB, 2);
+ (*Stream_More)[Stream_Audio][0](Ztring().From_Local("compr_Minimum"), Info_Options)=_T("N NT");
+ Fill(Stream_Audio, 0, "compr_Minimum/String", Ztring::ToZtring(Minimum_dB, 2)+_T(" dB"));
+ (*Stream_More)[Stream_Audio][0](Ztring().From_Local("compr_Minimum/String"), Info_Options)=_T("N NT");
+ Fill(Stream_Audio, 0, "compr_Maximum", Maximum_dB, 2);
+ (*Stream_More)[Stream_Audio][0](Ztring().From_Local("compr_Maximum"), Info_Options)=_T("N NT");
+ Fill(Stream_Audio, 0, "compr_Maximum/String", Ztring::ToZtring(Maximum_dB, 2)+_T(" dB"));
+ (*Stream_More)[Stream_Audio][0](Ztring().From_Local("compr_Maximum/String"), Info_Options)=_T("N NT");
+ Fill(Stream_Audio, 0, "compr_Count", Count);
+ (*Stream_More)[Stream_Audio][0](Ztring().From_Local("compr_Count"), Info_Options)=_T("N NT");
+ }
+ if (dynrnge_Exists && !dynrngs.empty())
+ {
+ float64 Minimum_dB=23.95;
+ float64 Maximum_dB=-24.08;
+ float64 Sum_Intensity=0;
+ int64u Count=0;
+ for (size_t Pos=0; Pos<dynrngs.size(); Pos++)
+ if (dynrngs[Pos])
+ {
+ float64 Value;
+ if (Pos==0)
+ Value=0; //Special case in the formula
+ else
+ Value=AC3_dynrng[Pos>>5]+20*std::log10(((float)(0x20+(Pos&0x1F)))/64);
+ if (Minimum_dB>Value)
+ Minimum_dB=Value;
+ if (Maximum_dB<Value)
+ Maximum_dB=Value;
+ Sum_Intensity+=dynrngs[Pos]*pow(10, Value/10);
+ Count+=dynrngs[Pos];
+ }
+ float64 Average_dB=log10(Sum_Intensity/Count)*10;
+ Fill(Stream_Audio, 0, "dynrng_Average", Average_dB, 2);
+ (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dynrng_Average"), Info_Options)=_T("N NT");
+ Fill(Stream_Audio, 0, "dynrng_Average/String", Ztring::ToZtring(Average_dB, 2)+_T(" dB"));
+ (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dynrng_Average/String"), Info_Options)=_T("N NT");
+ Fill(Stream_Audio, 0, "dynrng_Minimum", Minimum_dB, 2);
+ (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dynrng_Minimum"), Info_Options)=_T("N NT");
+ Fill(Stream_Audio, 0, "dynrng_Minimum/String", Ztring::ToZtring(Minimum_dB, 2)+_T(" dB"));
+ (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dynrng_Minimum/String"), Info_Options)=_T("N NT");
+ Fill(Stream_Audio, 0, "dynrng_Maximum", Maximum_dB, 2);
+ (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dynrng_Maximum"), Info_Options)=_T("N NT");
+ Fill(Stream_Audio, 0, "dynrng_Maximum/String", Ztring::ToZtring(Maximum_dB, 2)+_T(" dB"));
+ (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dynrng_Maximum/String"), Info_Options)=_T("N NT");
+ Fill(Stream_Audio, 0, "dynrng_Count", Count);
+ (*Stream_More)[Stream_Audio][0](Ztring().From_Local("dynrng_Count"), Info_Options)=_T("N NT");
+ }
+
+ //Duration
+ if (!IsSub)
+ {
+ int64u Frame_Count_ForDuration=0;
+ if (MediaInfoLib::Config.ParseSpeed_Get()==1)
+ {
+ Frame_Count_ForDuration=Frame_Count; //We have the exact count of frames
+ Fill(Stream_Audio, 0, Audio_StreamSize, File_Offset+Buffer_Offset+Element_Size-File_Offset_FirstSynched);
+ }
+ else if (bsid<=8 && frmsizecods.size()==1 && fscods.size()==1)
+ {
+ int16u Size=AC3_FrameSize_Get(frmsizecods.begin()->first, fscods.begin()->first);
+ 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)
+ Fill(Stream_Audio, 0, Audio_Duration, Frame_Count_ForDuration*32);
+ }
+}
+
+//***************************************************************************
+// 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 (CC4(Buffer)==0x1A45DFA3) //EBML
+ {
+ 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)
+ {
+ while (Buffer_Offset+8<=Buffer_Size)
+ {
+ if (CC2(Buffer+Buffer_Offset)==0x0B77) //AC-3
+ break; //while()
+ if (CC4(Buffer+Buffer_Offset+4)==0xF8726FBB) //MLP
+ break; //while()
+ Buffer_Offset++;
+ }
+
+ if (Buffer_Offset+8<=Buffer_Size && CC2(Buffer+Buffer_Offset)==0x0B77) //Testing if CRC is coherant
+ {
+ int8u bsid =CC1(Buffer+Buffer_Offset+5)>>3;
+ int16u Size=0;
+ if (bsid<=0x08)
+ {
+ 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;
+ Size=2+frmsiz*2;
+ }
+ if (Size>=6)
+ {
+ if (Buffer_Offset+Size>Buffer_Size)
+ return false; //Need more data
+
+ //Testing
+ int16u CRC_16=0x0000;
+ const int8u* CRC_16_Buffer=Buffer+Buffer_Offset+2; //After syncword
+ while(CRC_16_Buffer<Buffer+Buffer_Offset+Size)
+ {
+ CRC_16=(CRC_16<<8) ^ CRC_16_Table[(CRC_16>>8)^(*CRC_16_Buffer)];
+ CRC_16_Buffer++;
+ }
+ if (CRC_16!=0x0000)
+ Buffer_Offset++;
+ else
+ break;
+ }
+ else
+ Buffer_Offset++;
+ }
+
+ if (Buffer_Offset+8<=Buffer_Size && CC4(Buffer+Buffer_Offset+4)==0xF8726FBB) //MLP
+ {
+ break;
+ }
+ }
+
+ //Parsing last bytes if needed
+ if (Buffer_Offset+8>Buffer_Size)
+ {
+ if (Buffer_Offset+7==Buffer_Size && CC3(Buffer+Buffer_Offset+4)!=0xF8726F && CC2(Buffer+Buffer_Offset)!=0x0B77)
+ Buffer_Offset++;
+ if (Buffer_Offset+6==Buffer_Size && CC2(Buffer+Buffer_Offset+4)!=0xF872 && CC2(Buffer+Buffer_Offset)!=0x0B77)
+ Buffer_Offset++;
+ if (Buffer_Offset+5==Buffer_Size && CC1(Buffer+Buffer_Offset+4)!=0xF8 && CC2(Buffer+Buffer_Offset)!=0x0B77)
+ Buffer_Offset++;
+ if (Buffer_Offset+4==Buffer_Size && CC2(Buffer+Buffer_Offset)!=0x0B77)
+ Buffer_Offset++;
+ if (Buffer_Offset+3==Buffer_Size && CC2(Buffer+Buffer_Offset)!=0x0B77)
+ Buffer_Offset++;
+ if (Buffer_Offset+2==Buffer_Size && CC2(Buffer+Buffer_Offset)!=0x0B77)
+ Buffer_Offset++;
+ if (Buffer_Offset+1==Buffer_Size && CC1(Buffer+Buffer_Offset)!=0x0B)
+ Buffer_Offset++;
+ return false;
+ }
+
+ //Synched
+ Data_Accept("AC-3");
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool File_Ac3::Synched_Test()
+{
+ //Specific cases
+ if (MustParse_dac3 || MustParse_dec3)
+ return true;
+
+ //Must have enough buffer for having header
+ if (Buffer_Offset+6>Buffer_Size)
+ return false;
+
+ //Quick test of synchro
+ if (CC2(Buffer+Buffer_Offset)!=0x0B77)
+ {
+ //MLP or TrueHD CRC, not working
+ /*
+ int16u CRC_16_Table_HD[256];
+ CRC16_Init(CRC_16_Table_HD, 0x002D);
+
+ if (Buffer_Offset+28>Buffer_Size)
+ return false; //Need more data
+
+ //Testing
+ int16u CRC_16=0x0000;
+ const int8u* CRC_16_Buffer=Buffer+Buffer_Offset+4;
+ while(CRC_16_Buffer<Buffer+Buffer_Offset+4+24)
+ {
+ CRC_16=(CRC_16<<8) ^ CRC_16_Table_HD[(CRC_16>>8)^(*CRC_16_Buffer)];
+ CRC_16_Buffer++;
+ }
+ if (CRC_16!=0x0000)
+ return false;
+ */
+
+ //TrueHD detection
+ if ((Frame_Count>=1 && HD_Count+(HD_AlreadyCounted?0:1)==Frame_Count && bsid<=0x08) || !Core_IsPresent)
+ {
+ Synched=true;
+ return true;
+ }
+
+ return false;
+ }
+
+ //AC-3 CRC
+ bsid=(Buffer[(size_t)(Buffer_Offset+5)]&0xF8)>>3;
+ int16u Size=0;
+ if (bsid<=0x08)
+ {
+ 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;
+ Size=2+frmsiz*2;
+ }
+ if (Size!=0)
+ {
+ if (Buffer_Offset+Size>Buffer_Size)
+ return false; //Need more data
+
+ //Testing
+ int16u CRC_16=0x0000;
+ const int8u* CRC_16_Buffer=Buffer+Buffer_Offset+2; //After syncword
+ while(CRC_16_Buffer<Buffer+Buffer_Offset+Size)
+ {
+ CRC_16=(CRC_16<<8) ^ CRC_16_Table[(CRC_16>>8)^(*CRC_16_Buffer)];
+ CRC_16_Buffer++;
+ }
+ if (CRC_16!=0x0000)
+ return false;
+ }
+ else
+ return false;
+
+ //We continue
+ return true;
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Ac3::Read_Buffer_Continue()
+{
+ if (MustParse_dac3)
+ dac3();
+ if (MustParse_dec3)
+ dec3();
+}
+
+//***************************************************************************
+// Buffer - Per element
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Ac3::Header_Parse()
+{
+ //MLP or TrueHD specific
+ if (CC2(Buffer+Buffer_Offset)!=0x0B77)
+ {
+ int16u Size;
+ BS_Begin();
+ Skip_S1( 4, "Unknown");
+ Get_S2 (12, Size, "Size");
+ BS_End();
+ Skip_B2( "Timestamp?");
+
+ //Filling
+ if (Size<2)
+ {
+ Synched=false;
+ Size=2;
+ }
+
+ Header_Fill_Size(Size*2);
+ Header_Fill_Code(1, "HD");
+ return;
+ }
+
+ //Testing bsid before parsing
+ int16u Size;
+ bsid=(Buffer[(size_t)(Buffer_Offset+5)]&0xF8)>>3;
+ if (bsid<=0x08)
+ {
+ 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)
+ {
+ frmsiz =((int16u)(Buffer[(size_t)(Buffer_Offset+2)]&0x07)<<8)
+ | ( Buffer[(size_t)(Buffer_Offset+3)] );
+ fscod = (Buffer[(size_t)(Buffer_Offset+4)]&0xC0)>>6;
+ int8u numblkscod;
+ if (fscod==0x03)
+ numblkscod=0x03;
+ else
+ numblkscod= (Buffer[(size_t)(Buffer_Offset+4)]&0x30)>>4;
+
+ //Filling
+ Size=2+frmsiz*2;
+ numblks=numblkscod==3?6:numblkscod+1;
+ }
+ else
+ {
+ Reject("AC-3");
+ return;
+ }
+
+
+ //Filling
+ Header_Fill_Size(Size);
+ Header_Fill_Code(0, "syncframe");
+}
+
+//---------------------------------------------------------------------------
+void File_Ac3::Data_Parse()
+{
+ //Parsing
+ switch(Element_Code)
+ {
+ case 0 : Core(); break;
+ case 1 : HD(); break;
+ default: ;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Ac3::Core()
+{
+ //PTS
+ if (PTS!=(int64u)-1)
+ Element_Info(_T("PTS ")+Ztring().Duration_From_Milliseconds(float64_int64s(((float64)PTS+PTS_DTS_Offset_InThisBlock)/1000000)));
+
+ //Parsing
+ if (bsid<=0x08)
+ {
+ int8u dialnorm, dialnorm2=(int8u)-1, compr=(int8u)-1, compr2=(int8u)-1, dynrng=(int8u)-1, dynrng2=(int8u)-1;
+ bool compre, compr2e=false, dynrnge, dynrng2e=false;
+ Element_Begin("synchinfo");
+ Skip_B2( "syncword");
+ Skip_B2( "crc1");
+ BS_Begin();
+ Get_S1 (2, fscod, "fscod - Sample Rate Code"); Param_Info(AC3_SamplingRate[fscod], " Hz");
+ Get_S1 (6, frmsizecod, "frmsizecod - Frame Size Code"); if (frmsizecod/2<19) {Param_Info(AC3_BitRate[frmsizecod/2]*1000, " bps");}
+ Element_End();
+ Element_Begin("bsi");
+ Get_S1 (5, bsid, "bsid - Bit Stream Identification");
+ Get_S1 (3, bsmod, "bsmod - Bit Stream Mode"); Param_Info(AC3_Mode[bsmod]);
+ Get_S1 (3, acmod, "acmod - Audio Coding Mode"); Param_Info(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_Info(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");
+ TEST_SB_END();
+ TEST_SB_SKIP( "timecod2e");
+ Skip_S1(14, "timecod2");
+ 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_End();
+ Element_Begin("audblk");
+ for (int8u Pos=0; Pos<AC3_Channels[acmod]; Pos++)
+ Skip_SB( "blksw - Block Switch Flag");
+ for (int8u Pos=0; Pos<AC3_Channels[acmod]; Pos++)
+ Skip_SB( "dithflag - Dither Flag");
+ Get_SB ( dynrnge, "dynrnge - Dynamic Range Gain Word Exists");
+ if (dynrnge)
+ Get_S1 (8, dynrng, "dynrng - Dynamic Range Gain Word");
+ if (acmod==0) //1+1 mode
+ {
+ Get_SB ( dynrng2e, "dynrng2e - Dynamic Range Gain Word Exists");
+ if (dynrng2e)
+ Get_S1 (8, dynrng2, "dynrng2 - Dynamic Range Gain Word");
+ }
+ BS_End();
+ Element_End();
+ Skip_XX(Element_Size-Element_Offset, "audblk(continue)+5*audblk+auxdata+errorcheck");
+
+ FILLING_BEGIN();
+ //Specific to first frame
+ if (Frame_Count==0)
+ {
+ 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();
+ }
+ else if (bsid>0x0A && bsid<=0x10)
+ {
+ Element_Begin("synchinfo");
+ Skip_B2( "syncword");
+ Element_End();
+ Element_Begin("bsi");
+ int8u strmtyp, numblkscod;
+ BS_Begin();
+ Get_S1 ( 2, strmtyp, "strmtyp");
+ Skip_S1( 3, "substreamid");
+ Get_S2 (11, frmsiz, "frmsiz");
+ Get_S1 ( 2, fscod, "fscod");
+ if (fscod==3)
+ {
+ Get_S1 ( 2, fscod2, "fscod2");
+ numblkscod=3;
+ }
+ else
+ Get_S1 ( 2, numblkscod, "numblkscod");
+ Get_S1 (3, acmod, "acmod - Audio Coding Mode"); Param_Info(AC3_ChannelPositions[acmod]);
+ Get_SB ( lfeon, "lfeon - Low Frequency Effects");
+ Get_S1 ( 5, bsid, "bsid - Bit Stream Identification");
+ TEST_SB_SKIP( "compre");
+ Skip_S1(8, "compr");
+ TEST_SB_END();
+ if (acmod==0) //1+1 mode
+ {
+ Skip_SB( "dialnorm2");
+ TEST_SB_SKIP( "compr2e");
+ Skip_S1(1, "compr2");
+ TEST_SB_END();
+ }
+ if (strmtyp==1) //dependent stream
+ {
+ TEST_SB_SKIP( "chanmape");
+ Get_S2(16, chanmap, "chanmap");
+ TEST_SB_END();
+ }
+ BS_End();
+ Element_End();
+ Skip_XX(Element_Size-Element_Offset, "bsi(continue)+audfrm+x*audblk+auxdata+errorcheck");
+ }
+
+ FILLING_BEGIN();
+ //Name
+ Element_Info(_T("Frame ")+Ztring::ToZtring(Frame_Count));
+
+ //Counting
+ if (!Core_IsPresent)
+ {
+ Frame_Count=0;
+ Core_IsPresent=true;
+ }
+ 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++;
+ HD_AlreadyCounted=false;
+
+ //PTS
+ if (PTS!=(int64u)-1 && frmsizecod/2<19)
+ {
+ int64u BitRate=AC3_BitRate[frmsizecod/2]*1000;
+ int64u Bits=Element_Size*8;
+ float64 Frame_Duration=((float64)Bits)/BitRate;
+ PTS_DTS_Offset_InThisBlock+=float64_int64s(Frame_Duration*1000000000);
+ }
+
+ //Filling
+ if (!Status[IsFilled] && Frame_Count>=Frame_Count_Valid)
+ {
+ Fill("AC-3");
+
+ //No more need data
+ if (MediaInfoLib::Config.ParseSpeed_Get()<1)
+ Finish("AC-3");
+ }
+ 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<Buffer+Buffer_Offset+24)
+ {
+ CRC_16=(CRC_16<<8) ^ CRC_16_Table_HD[(CRC_16>>8)^(*CRC_16_Buffer)];
+ CRC_16_Buffer++;
+ }
+ CRC_16^=LittleEndian2int16u(Buffer+Buffer_Offset+24);
+ */
+
+ Element_Begin("MajorSync", 28);
+ Skip_B3( "Synch");
+ Get_B1 (HD_StreamType, "Stream type"); Param_Info(AC3_HD_StreamType(HD_StreamType));
+
+ if (HD_StreamType==0xBA)
+ {
+ BS_Begin();
+ Get_S1 ( 4, HD_SamplingRate1, "Sampling rate"); Param_Info(AC3_HD_SamplingRate(HD_SamplingRate1), " Hz");
+ Skip_S1( 8, "Unknown");
+ Get_S1 ( 5, HD_Channels1, "Channels (1st substream)"); Param_Info(AC3_TrueHD_Channels(HD_Channels1)); Param_Info(Ztring().From_Local(AC3_TrueHD_Channels_Positions(HD_Channels1)));
+ Skip_S1( 2, "Unknown");
+ Get_S2 (13, HD_Channels2, "Channels (2nd substream)"); Param_Info(AC3_TrueHD_Channels(HD_Channels2)); Param_Info(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_Info(AC3_MLP_Resolution[HD_Resolution1], " bits");
+ Get_S1 ( 4, HD_Resolution2, "Resolution2"); Param_Info(AC3_MLP_Resolution[HD_Resolution2], " bits");
+ Get_S1 ( 4, HD_SamplingRate1, "Sampling rate"); Param_Info(AC3_HD_SamplingRate(HD_SamplingRate1), " Hz");
+ Get_S1 ( 4, HD_SamplingRate2, "Sampling rate"); Param_Info(AC3_HD_SamplingRate(HD_SamplingRate2), " Hz");
+ Skip_S1(11, "Unknown");
+ Get_S1 ( 5, HD_Channels1, "Channels"); Param_Info(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_Info((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_End();
+
+ 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_Begin("Sizes");
+ std::vector<int16u> Sizes;
+ for (int8u Pos=0; Pos<HD_SubStreams_Count; Pos++)
+ {
+ Element_Begin("Size");
+ int16u Size;
+ bool HD_Unknown1_Present, HD_NoRestart, HD_ExtraParity;
+ BS_Begin();
+ Get_SB ( HD_Unknown1_Present, "Unknown present"); //Only TrueHD
+ Get_SB ( HD_NoRestart, "No restart"); //Not present if MajorSync, present if no MajorSync
+ Get_SB ( HD_ExtraParity, "Extra parity information");
+ Skip_SB( "Unknown");
+ Get_S2 (12, Size, "Size");
+ BS_End();
+ if (HD_Unknown1_Present)
+ Skip_B2( "Unknown");
+ Sizes.push_back(Size);
+ Element_End();
+ }
+ Element_End();
+
+ int64u Element_Offset_Begin=Element_Offset;
+ for (int8u Pos=0; Pos<HD_SubStreams_Count; Pos++)
+ {
+ Element_Begin("Block", Sizes[Pos]);
+ bool DecodingParameterBlockPresent;
+ BS_Begin();
+ Get_SB (DecodingParameterBlockPresent, "Decoding parameter block is present");
+ if (DecodingParameterBlockPresent)
+ {
+ TEST_SB_SKIP( "Restart header");
+ int16u SyncWord;
+ int8u max_matrix_channel;
+ Get_S2(13, SyncWord, "SyncWord");
+ if (SyncWord==0x18F5)
+ {
+ Skip_SB( "noise_type"); //Only for TrueHD
+ Skip_S2(16, "Output timestamp");
+ Skip_S1( 4, "min_channel");
+ Skip_S1( 4, "max_channel");
+ Get_S1 ( 4, max_matrix_channel, "max_matrix_channel");
+ Skip_S1( 4, "noise_shift");
+ Skip_S3(23, "noisegen_seed");
+ Skip_S3(19, "unknown");
+ Skip_SB( "data_check_present");
+ Skip_S1( 8, "lossless_check");
+ Skip_S2(16, "unknown");
+ for (int8u matrix_channel=0; matrix_channel<max_matrix_channel; matrix_channel++)
+ Skip_S1(6, "ch_assign");
+ Skip_S1( 8, "checksum");
+ }
+ TEST_SB_END();
+ }
+ BS_End();
+ Skip_XX(Element_Offset_Begin+Sizes[Pos]*2-Element_Offset, "Data");
+ Element_End();
+ }
+ }
+ else
+ Skip_XX(Element_Size-Element_Offset, "Waiting for MajorSync...");
+
+ FILLING_BEGIN_PRECISE();
+ if (!Core_IsPresent)
+ Frame_Count++;
+
+ if (!HD_AlreadyCounted)
+ {
+ HD_Count++;
+ HD_AlreadyCounted=true;
+ }
+
+ //Filling
+ if (!Status[IsFilled] && Frame_Count>=Frame_Count_Valid)
+ {
+ Fill("AC-3");
+
+ //No more need data
+ if (MediaInfoLib::Config.ParseSpeed_Get()<1)
+ Finish("AC-3");
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Ac3::dac3()
+{
+ BS_Begin();
+ Get_S1 (2, fscod, "fscod");
+ Get_S1 (5, bsid, "bsid");
+ Get_S1 (3, bsmod, "bsmod");
+ Get_S1 (3, acmod, "acmod");
+ Get_SB ( lfeon, "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_Begin("independent substream");
+ int8u num_dep_sub;
+ Get_S1 (2, fscod, "fscod");
+ Get_S1 (5, bsid, "bsid");
+ Get_S1 (3, bsmod, "bsmod");
+ Get_S1 (3, acmod, "acmod");
+ Get_SB ( lfeon, "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_End();
+ }
+ BS_End();
+
+ MustParse_dec3=false;
+ dxc3_Parsed=true;
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_AC3_YES
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Ac3.h b/src/thirdparty/MediaInfo/Audio/File_Ac3.h
new file mode 100644
index 000000000..6dbf14e96
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Ac3.h
@@ -0,0 +1,133 @@
+// File_Ac3 - Info for AC3 files
+// Copyright (C) 2004-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_Ac3H
+#define MediaInfo_Ac3H
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Ac3
+//***************************************************************************
+
+class File_Ac3 : public File__Analyze
+{
+public :
+ //In
+ size_t Frame_Count_Valid;
+ bool MustParse_dac3;
+ bool MustParse_dec3;
+
+ //Constructor/Destructor
+ File_Ac3();
+
+private :
+ //Streams management
+ void Streams_Fill();
+ 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();
+
+ //Elements
+ void Core();
+ void HD();
+ void dac3();
+ void dec3();
+
+ //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<int64u> dialnorms;
+ std::vector<int64u> dialnorm2s;
+ std::vector<int64u> comprs;
+ std::vector<int64u> compr2s;
+ std::vector<int64u> dynrngs;
+ std::vector<int64u> dynrng2s;
+ std::map<int8u, int64u> fscods;
+ std::map<int8u, int64u> frmsizecods;
+ size_t Frame_Count;
+ size_t HD_Count;
+ int16u chanmap;
+ int16u frmsiz;
+ int16u HD_BitRate_Max;
+ int16u HD_Channels2;
+ int8u fscod;
+ int8u fscod2;
+ int8u frmsizecod;
+ int8u bsid;
+ int8u bsmod;
+ int8u acmod;
+ int8u dsurmod;
+ int8u numblks;
+ 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;
+ bool lfeon;
+ bool dxc3_Parsed;
+ bool HD_MajorSync_Parsed;
+ bool HD_NoRestart;
+ bool HD_ExtraParity;
+ bool HD_AlreadyCounted;
+ bool HD_IsVBR;
+ bool Core_IsPresent;
+ bool dynrnge_Exists;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Audio/File_Adif.cpp b/src/thirdparty/MediaInfo/Audio/File_Adif.cpp
new file mode 100644
index 000000000..9079454ab
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Adif.cpp
@@ -0,0 +1,237 @@
+// File_Aac_Adif - Info for AAC (ADIF) files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_ADIF_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Audio/File_Adif.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Infos
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+const int32u ADIF_sampling_frequency[]=
+{96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050,
+ 16000, 12000, 11025, 8000, 7350, 0, 0, 0,};
+
+//---------------------------------------------------------------------------
+const char* ADIF_Format_Profile[]=
+{
+ "Main",
+ "LC",
+ "SSR",
+ "LTP",
+};
+
+//---------------------------------------------------------------------------
+const char* ADIF_object_type[]=
+{
+ "A_AAC/MPEG4/MAIN",
+ "A_AAC/MPEG4/LC",
+ "A_AAC/MPEG4/SSR",
+ "A_AAC/MPEG4/LTP",
+};
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Adif::File_Adif()
+:File__Analyze(), File__Tags_Helper()
+{
+ //File__Tags_Helper
+ Base=this;
+}
+
+//***************************************************************************
+// Buffer - File header
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Adif::FileHeader_Begin()
+{
+ //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"
+ {
+ File__Tags_Helper::Reject("Adif");
+ return false;
+ }
+
+ return true;
+}
+
+//---------------------------------------------------------------------------
+void File_Adif::FileHeader_Parse()
+{
+ //Parsing
+ Ztring comment_field_data;
+ int32u bitrate;
+ int8u num_program_config_elements;
+ int8u object_type=(int8u)-1;
+ int8u sampling_frequency_index=(int8u)-1;
+ int8u num_front_channel_elements=(int8u)-1;
+ int8u num_side_channel_elements=(int8u)-1;
+ int8u num_back_channel_elements=(int8u)-1;
+ int8u num_lfe_channel_elements=(int8u)-1;
+ int8u num_assoc_data_elements;
+ int8u num_valid_cc_elements;
+ bool bitstream_type;
+ Skip_C4( "adif_id");
+ BS_Begin();
+ TEST_SB_SKIP( "copyright_id_present");
+ Skip_S4(32, "copyright_id");
+ Skip_S4(32, "copyright_id");
+ Skip_S4( 8, "copyright_id");
+ TEST_SB_END();
+ Skip_SB( "original_copy");
+ Skip_SB( "home");
+ Get_SB ( bitstream_type, "bitstream_type"); Param_Info(bitstream_type?"VBR":"CBR");
+ Get_S3 (23, bitrate, "bitrate");
+ Get_S1 ( 4, num_program_config_elements, "num_program_config_elements");
+ if (!bitstream_type)
+ Skip_S3(20, "adif_buffer_fullness");
+ for (int8u Pos=0; Pos<num_program_config_elements+1; Pos++)
+ {
+ Element_Begin("program_config_element");
+ int8u comment_field_bytes;
+ Skip_S1(4, "element_instance_tag");
+ Get_S1 (2, object_type, "object_type"); Param_Info(ADIF_object_type[object_type]);
+ Get_S1 (4, sampling_frequency_index, "sampling_frequency_index"); Param_Info(ADIF_sampling_frequency[sampling_frequency_index]);
+ 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_S1(2, "pseudo_surround_enable");
+ TEST_SB_END();
+ for (int8u Pos2=0; Pos2<num_front_channel_elements; Pos2++)
+ {
+ Element_Begin("front_channel_element");
+ Skip_SB( "front_element_is_cpe");
+ Skip_S1(4, "front_element_tag_select");
+ Element_End();
+ }
+ for (int8u Pos2=0; Pos2<num_side_channel_elements; Pos2++)
+ {
+ Element_Begin("side_channel_element");
+ Skip_SB( "back_element_is_cpe");
+ Skip_S1(4, "back_element_tag_select");
+ Element_End();
+ }
+ for (int8u Pos2=0; Pos2<num_back_channel_elements; Pos2++)
+ {
+ Element_Begin("back_channel_element");
+ Skip_SB( "back_element_is_cpe");
+ Skip_S1(4, "back_element_tag_select");
+ Element_End();
+ }
+ for (int8u Pos2=0; Pos2<num_lfe_channel_elements; Pos2++)
+ {
+ Element_Begin("lfe_channel_element");
+ Skip_S1(4, "lfe_element_tag_select");
+ Element_End();
+ }
+ for (int8u Pos2=0; Pos2<num_assoc_data_elements; Pos2++)
+ {
+ Element_Begin("assoc_data_element");
+ Skip_S1(4, "assoc_data_element_tag_select");
+ Element_End();
+ }
+ for (int8u Pos2=0; Pos2<num_valid_cc_elements; Pos2++)
+ {
+ Element_Begin("valid_cc_element");
+ Skip_SB( "cc_element_is_ind_sw");
+ Skip_S1(4, "valid_cc_element_tag_select");
+ Element_End();
+ }
+ BS_End();
+ Get_B1 (comment_field_bytes, "comment_field_bytes");
+ if (comment_field_bytes>0)
+ Get_Local(comment_field_bytes, comment_field_data, "comment_field_data");
+ BS_Begin();
+ Element_End();
+
+ //We only support 1 element in ADIF
+ Pos=num_program_config_elements;
+ }
+ BS_End();
+
+ FILLING_BEGIN();
+ File__Tags_Helper::Accept("ADIF");
+
+ Fill(Stream_General, 0, General_Format, "ADIF");
+ Fill(Stream_General, 0, General_Comment, comment_field_data);
+
+ File__Tags_Helper::Stream_Prepare(Stream_Audio);
+ Fill (Stream_Audio, 0, Audio_Format, "AAC");
+ Fill (Stream_Audio, 0, Audio_Format_Version, "Version 2");
+ if (object_type!=(int8u)-1)
+ {
+ Fill (Stream_Audio, 0, Audio_Format_Profile, ADIF_Format_Profile[object_type]);
+ Fill (Stream_Audio, 0, Audio_Codec, ADIF_object_type[object_type]);
+ }
+ Fill(Stream_Audio, 0, Audio_BitRate_Mode, bitstream_type?"VBR":"CBR");
+ if (bitrate>0)
+ Fill(Stream_Audio, 0, bitstream_type?Audio_BitRate_Maximum:Audio_BitRate, bitrate);
+ if (sampling_frequency_index!=(int8u)-1)
+ Fill(Stream_Audio, 0, Audio_SamplingRate, ADIF_sampling_frequency[sampling_frequency_index]);
+ if (num_front_channel_elements!=(int8u)-1)
+ Fill(Stream_Audio, 0, Audio_Channel_s_, num_front_channel_elements+num_side_channel_elements+num_back_channel_elements+num_lfe_channel_elements);
+ Fill(Stream_Audio, 0, Audio_MuxingMode, "ADIF");
+
+ //No more need data
+ File__Tags_Helper::Finish("ADIF");
+ FILLING_END();
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_ADIF_YES
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Adif.h b/src/thirdparty/MediaInfo/Audio/File_Adif.h
new file mode 100644
index 000000000..24ef163fc
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Adif.h
@@ -0,0 +1,57 @@
+// File_Aac_Adif - Info for AAC (ADIF) files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_AdifH
+#define MediaInfo_File_AdifH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include "MediaInfo/Tag/File__Tags.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Adif
+//***************************************************************************
+
+class File_Adif : public File__Analyze, public File__Tags_Helper
+{
+public :
+ //Constructor/Destructor
+ File_Adif();
+
+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();}
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Audio/File_Adpcm.cpp b/src/thirdparty/MediaInfo/Audio/File_Adpcm.cpp
new file mode 100644
index 000000000..537a847f0
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Adpcm.cpp
@@ -0,0 +1,87 @@
+// File_Adpcm - Info for ADPCM files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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 (0)
+ ;
+ else 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
diff --git a/src/thirdparty/MediaInfo/Audio/File_Adpcm.h b/src/thirdparty/MediaInfo/Audio/File_Adpcm.h
new file mode 100644
index 000000000..9f1ed296f
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Adpcm.h
@@ -0,0 +1,53 @@
+// File_Adpcm - Info for ADPCM files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Audio/File_Adts.cpp b/src/thirdparty/MediaInfo/Audio/File_Adts.cpp
new file mode 100644
index 000000000..4f069a9ea
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Adts.cpp
@@ -0,0 +1,318 @@
+// File_Adts - Info for AAC (ADTS) files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_ADTS_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Audio/File_Adts.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Infos
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+const int32u ADTS_SamplingRate[]=
+{96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050,
+ 16000, 12000, 11025, 8000, 7350, 0, 0, 0,};
+
+//---------------------------------------------------------------------------
+const char* ADTS_ID[]=
+{
+ "MPEG-4",
+ "MPEG-2",
+};
+
+//---------------------------------------------------------------------------
+const char* ADTS_Format_Profile[]=
+{
+ "Main",
+ "LC",
+ "SSR",
+ "LTP",
+};
+
+//---------------------------------------------------------------------------
+const char* ADTS_Profile[]=
+{
+ "A_AAC/MPEG4/MAIN",
+ "A_AAC/MPEG4/LC",
+ "A_AAC/MPEG4/SSR",
+ "A_AAC/MPEG4/LTP",
+};
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Adts::File_Adts()
+:File__Analyze(), File__Tags_Helper()
+{
+ //File__Tags_Helper
+ Base=this;
+
+ //Configuration
+ MustSynchronize=true;
+ Buffer_TotalBytes_FirstSynched_Max=64*1024;
+
+ //In
+ Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.5?128:(MediaInfoLib::Config.ParseSpeed_Get()>=0.3?32:2);
+
+ //Temp
+ Frame_Count=0;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Adts::Streams_Fill()
+{
+ //Calculating
+ bool sbrPresentFlag=ADTS_SamplingRate[sampling_frequency_index]<=24000;
+ bool psPresentFlag=channel_configuration<=1; //1 channel
+ int64u BitRate=0;
+ if (!aac_frame_lengths.empty())
+ {
+ int64u aac_frame_length_Total=0;
+ for (size_t Pos=0; Pos<aac_frame_lengths.size(); Pos++)
+ aac_frame_length_Total+=aac_frame_lengths[Pos];
+
+ BitRate=(ADTS_SamplingRate[sampling_frequency_index]/1024);
+ BitRate*=aac_frame_length_Total*8;
+ BitRate/=aac_frame_lengths.size();
+ }
+
+ if (!IsSub)
+ Fill(Stream_General, 0, General_Format, "ADTS");
+
+ File__Tags_Helper::Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, 0, Audio_Format, "AAC");
+ Fill(Stream_Audio, 0, Audio_Format_Version, id?"Version 2":"Version 4");
+ Fill(Stream_Audio, 0, Audio_Format_Profile, ADTS_Format_Profile[profile_ObjectType]);
+ if (!sbrPresentFlag && !psPresentFlag)
+ Fill(Stream_Audio, 0, Audio_Codec, ADTS_Profile[profile_ObjectType]);
+ Fill(Stream_Audio, 0, Audio_SamplingRate, ADTS_SamplingRate[sampling_frequency_index]*(sbrPresentFlag?2:1));
+ Fill(Stream_Audio, 0, Audio_Channel_s_, psPresentFlag?2:channel_configuration);
+ Fill(Stream_Audio, 0, Audio_MuxingMode, "ADTS");
+ if (adts_buffer_fullness==0x7FF)
+ Fill(Stream_Audio, 0, Audio_BitRate_Mode, "VBR");
+ else
+ {
+ Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR");
+ if (BitRate)
+ Fill(Stream_Audio, 0, Audio_BitRate, BitRate);
+ }
+ if (sbrPresentFlag)
+ {
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings, "SBR");
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings_SBR, "Yes", Unlimited, true, true);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings_PS, "No");
+ Ztring Codec=Ztring().From_Local(ADTS_Profile[profile_ObjectType])+_T("/SBR");
+ Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Codec, true);
+ }
+ if (psPresentFlag)
+ {
+ Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, 2, 10, true);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings, "PS");
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings_PS, "Yes", Unlimited, true, true);
+ Ztring Codec=Ztring().From_Local(ADTS_Profile[profile_ObjectType])+(sbrPresentFlag?_T("/SBR"):_T(""))+_T("/PS");
+ Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Codec, true);
+ }
+
+ File__Tags_Helper::Streams_Fill();
+}
+
+//***************************************************************************
+// Buffer - Synchro
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Adts::Synchronize()
+{
+ //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
+ && (CC2(Buffer+Buffer_Offset)&0xFFF6)!=0xFFF0)
+ 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)
+ {
+ 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)
+ {
+ if (Buffer_Offset+aac_frame_length+aac_frame_length2+2>Buffer_Size)
+ return false; //Need more data
+
+ //Testing
+ if (aac_frame_length<=7 || (CC2(Buffer+Buffer_Offset+aac_frame_length+aac_frame_length2)&0xFFF6)!=0xFFF0)
+ Buffer_Offset++;
+ 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
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool File_Adts::Synched_Test()
+{
+ //Tags
+ if (!File__Tags_Helper::Synched_Test())
+ return false;
+
+ //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;
+}
+
+//***************************************************************************
+// Buffer - Per element
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Adts::Header_Parse()
+{
+ //Parsing
+ bool protection_absent;
+ BS_Begin();
+ Skip_BS(12, "syncword");
+ Get_SB ( id, "id"); Param_Info(ADTS_ID[id]);
+ Skip_BS( 2, "layer");
+ Get_SB ( protection_absent, "protection_absent");
+ Get_S1 ( 2, profile_ObjectType, "profile_ObjectType"); Param_Info(ADTS_Profile[profile_ObjectType]);
+ Get_S1 ( 4, sampling_frequency_index, "sampling_frequency_index"); Param_Info(ADTS_SamplingRate[sampling_frequency_index], " Hz");
+ Skip_SB( "private");
+ Get_S1 ( 3, channel_configuration, "channel_configuration");
+ Skip_SB( "original");
+ Skip_SB( "home");
+ 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_Info(adts_buffer_fullness==0x7FF?"VBR":"CBR");
+ Skip_BS( 2, "num_raw_data_blocks");
+ BS_End();
+
+ //Filling
+ Header_Fill_Size(aac_frame_length);
+ Header_Fill_Code(0, "Frame");
+}
+
+//---------------------------------------------------------------------------
+void File_Adts::Data_Parse()
+{
+ //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++;
+
+ //Name
+ Element_Info(Ztring::ToZtring(Frame_Count));
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+
+ //Filling
+ aac_frame_lengths.push_back(aac_frame_length);
+ if (!Status[IsAccepted] && Frame_Count>=Frame_Count_Valid)
+ {
+ //Filling
+ File__Tags_Helper::Accept("ADTS");
+
+ Fill("ADTS");
+
+ //No more need data
+ File__Tags_Helper::Finish("ADTS");
+ }
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_ADTS_YES
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Adts.h b/src/thirdparty/MediaInfo/Audio/File_Adts.h
new file mode 100644
index 000000000..fdf302ca9
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Adts.h
@@ -0,0 +1,73 @@
+// File_Aac_Adts - Info for AAC (ADTS) Audio files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_AdtsH
+#define MediaInfo_File_AdtsH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include "MediaInfo/Tag/File__Tags.h"
+#include <vector>
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Aac_Adts
+//***************************************************************************
+
+class File_Adts : public File__Analyze, public File__Tags_Helper
+{
+public :
+ //In
+ size_t Frame_Count_Valid;
+
+ //Constructor/Destructor
+ File_Adts();
+
+private :
+ //Streams management
+ void Streams_Fill();
+ void Streams_Finish() {File__Tags_Helper::Streams_Finish();}
+
+ //Buffer - Synchro
+ bool Synchronize();
+ bool Synched_Test();
+
+ //Buffer - Per element
+ void Header_Parse();
+ void Data_Parse();
+
+ //Temp
+ std::vector<int16u> aac_frame_lengths;
+ size_t Frame_Count;
+ int16u adts_buffer_fullness;
+ int16u aac_frame_length;
+ int8u profile_ObjectType;
+ int8u sampling_frequency_index;
+ int8u channel_configuration;
+ bool id;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Audio/File_Aes3.cpp b/src/thirdparty/MediaInfo/Audio/File_Aes3.cpp
new file mode 100644
index 000000000..e009cffe4
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Aes3.cpp
@@ -0,0 +1,291 @@
+// File_Aes3 - Info for AES3 packetized streams
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_AES3_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Audio/File_Aes3.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Infos
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+const char* Aes3_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* Aes3_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_Aes3::File_Aes3()
+:File__Analyze()
+{
+ //Configure
+ PTS_DTS_Needed=true;
+
+ //Temp
+ Block_Count=0;
+ Block_Last_PTS=(int32u)-1;
+ Block_Last_Size=(int64u)-1;
+}
+
+//***************************************************************************
+// Format
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Aes3::Header_Parse()
+{
+ //Parsing
+ int16u Size;
+ Get_B2 (Size, "Size");
+ BS_Begin();
+ Get_S1 (2, number_channels, "number_channels"); Param_Info(2+2*number_channels, " channels");
+ Info_S1(8, channel_id, "channel_id");
+ Get_S1 (2, bits_per_samples, "bits_per_samples"); Param_Info(16+4*bits_per_samples, " bits");
+ Info_S1(4, alignments, "alignments");
+ BS_End();
+
+ //Filling
+ Header_Fill_Size(Element_Offset+Size);
+ Header_Fill_Code(0, "Block");
+}
+
+//---------------------------------------------------------------------------
+static inline int8u Reverse8(int n)
+{
+ // Input: bit order is 76543210
+ //Output: bit order is 45670123
+ n=((n>>1)&0x55) | ((n<<1) & 0xaa);
+ n=((n>>2)&0x33) | ((n<<2) & 0xcc);
+ n=((n>>4)&0x0f) | ((n<<4) & 0xf0);
+ return (int8u)n;
+}
+
+//---------------------------------------------------------------------------
+void File_Aes3::Data_Parse()
+{
+ Block_Count++;
+
+ //Parsing
+ switch (bits_per_samples)
+ {
+ /*
+ case 0 : //16 bits
+ {
+ while (Element_Offset<Element_Size)
+ {
+ Element_Begin("2Ch group");
+ int8u Info[4];
+ size_t Buffer_Pos=Buffer_Offset+(size_t)Element_Offset;
+
+ //Channel 1 (16 bits, as "s16l" codec)
+ Info[0]= Reverse8(Buffer[Buffer_Pos+0]);
+ Info[1]= Reverse8(Buffer[Buffer_Pos+1]);
+
+ //Channel 2 (16 bits, as "s16l" codec)
+ Info[2]=(Reverse8(Buffer[Buffer_Pos+2])>>4) | ((Reverse8(Buffer[Buffer_Pos+3])<<4)&0xF0);
+ Info[3]=(Reverse8(Buffer[Buffer_Pos+3])>>4) | ((Reverse8(Buffer[Buffer_Pos+4])<<4)&0xF0);
+
+ //Details
+ if (Config_Details>0)
+ {
+ Param("0", Info[0]);
+ Param("1", Info[1]);
+ Param("2", Info[2]);
+ Param("3", Info[3]);
+ }
+
+ Element_Offset+=5;
+ Element_End();
+ }
+ }
+ break;
+ case 1 : //20 bits
+ {
+ while (Element_Offset<Element_Size)
+ {
+ Element_Begin("2Ch group");
+ int8u Info[6];
+ size_t Buffer_Pos=Buffer_Offset+(size_t)Element_Offset;
+
+ //Channel 1 (24 bits, as "s24l" codec, 4 highest bits are set to 0)
+ Info[0]= ((Reverse8(Buffer[Buffer_Pos+0])<<4)&0xF0);
+ Info[1]=(Reverse8(Buffer[Buffer_Pos+0])>>4 ) | ((Reverse8(Buffer[Buffer_Pos+1])<<4)&0xF0);
+ Info[2]=(Reverse8(Buffer[Buffer_Pos+1])>>4 ) | ((Reverse8(Buffer[Buffer_Pos+2])<<4)&0xF0);
+
+ //Channel 2 (24 bits, as "s24l" codec, 4 highest bits are set to 0)
+ Info[3]= ((Reverse8(Buffer[Buffer_Pos+3])<<4)&0xF0);
+ Info[4]=(Reverse8(Buffer[Buffer_Pos+3])>>4) | ((Reverse8(Buffer[Buffer_Pos+4])<<4)&0xF0);
+ Info[5]=(Reverse8(Buffer[Buffer_Pos+4])>>4) | ((Reverse8(Buffer[Buffer_Pos+5])<<4)&0xF0);
+
+
+ //Details
+ if (Config_Details>0)
+ {
+ Param("0", Info[0]);
+ Param("1", Info[1]);
+ Param("2", Info[2]);
+ Param("3", Info[3]);
+ Param("4", Info[4]);
+ Param("5", Info[5]);
+ }
+
+ Element_Offset+=6;
+ Element_End();
+ }
+ }
+ break;
+ case 2 : //24 bits
+ {
+ while (Element_Offset<Element_Size)
+ {
+ Element_Begin("2Ch group");
+ int8u Info[6];
+ size_t Buffer_Pos=Buffer_Offset+(size_t)Element_Offset;
+
+ //Channel 1 (24 bits, as "s24l" codec)
+ Info[0] = Reverse8(Buffer[Buffer_Pos+0] );
+ Info[1] = Reverse8(Buffer[Buffer_Pos+1] );
+ Info[2] = Reverse8(Buffer[Buffer_Pos+2] );
+
+ //Channel 2 (24 bits, as "s24l" codec)
+ Info[3] = (Reverse8(Buffer[Buffer_Pos+3])>>4) | ((Reverse8(Buffer[Buffer_Pos+4])<<4)&0xF0 );
+ Info[4] = (Reverse8(Buffer[Buffer_Pos+4])>>4) | ((Reverse8(Buffer[Buffer_Pos+5])<<4)&0xF0 );
+ Info[5] = (Reverse8(Buffer[Buffer_Pos+5])>>4) | ((Reverse8(Buffer[Buffer_Pos+6])<<4)&0xF0 );
+
+ //Details
+ if (Config_Details>0)
+ {
+ Param("0", Info[0]);
+ Param("1", Info[1]);
+ Param("2", Info[2]);
+ Param("3", Info[3]);
+ Param("4", Info[4]);
+ Param("5", Info[5]);
+ }
+
+ Element_Offset+=7;
+ Element_End();
+ }
+ }
+ break;
+ */
+ default :
+ Skip_XX(Element_Size, "Data");
+ }
+
+ FILLING_BEGIN();
+ FILLING_END();
+
+
+ if (PTS==(int64u)-1)
+ Block_Count=2; //We don't have PTS, don't need more
+ else if (Block_Count==1)
+ {
+ Block_Last_PTS=PTS;
+ Block_Last_Size=Element_Size;
+ }
+
+ if (Block_Count>=2)
+ {
+ //Filling
+ Accept("AES3");
+
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, 0, Audio_Format, "PCM");
+ Fill(Stream_Audio, 0, Audio_Format_Profile, "AES3");
+ Fill(Stream_Audio, 0, Audio_Codec, "AES3");
+ Fill(Stream_Audio, 0, Audio_Channel_s_, 2+2*number_channels);
+ Fill(Stream_Audio, 0, Audio_ChannelPositions, Aes3_ChannelsPositions(number_channels));
+ Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, Aes3_ChannelsPositions2(number_channels));
+ Fill(Stream_Audio, 0, Audio_Resolution, 16+4*bits_per_samples);
+ if (PTS!=(int32u)-1 && Block_Last_PTS!=(int32u)-1 && PTS!=Block_Last_PTS)
+ {
+ //Rounding
+ int64u BitRate=Block_Last_Size*8*1000*1000000/(PTS-Block_Last_PTS);
+ int64u SamplingRate=BitRate*(4+bits_per_samples)/(5+bits_per_samples)/(2+2*number_channels)/(16+4*bits_per_samples);
+ if (SamplingRate> 7840 && SamplingRate< 8160) SamplingRate= 8000;
+ if (SamplingRate> 15680 && SamplingRate< 16320) SamplingRate= 16000;
+ if (SamplingRate> 31360 && SamplingRate< 32640) SamplingRate= 32000;
+ if (SamplingRate> 62720 && SamplingRate< 65280) SamplingRate= 64000;
+ if (SamplingRate> 10804 && SamplingRate< 11246) SamplingRate= 11025;
+ if (SamplingRate> 21609 && SamplingRate< 22491) SamplingRate= 22050;
+ if (SamplingRate> 43218 && SamplingRate< 44982) SamplingRate= 44100;
+ if (SamplingRate> 86436 && SamplingRate< 89964) SamplingRate= 88200;
+ if (SamplingRate> 11760 && SamplingRate< 12240) SamplingRate= 12000;
+ if (SamplingRate> 23520 && SamplingRate< 24480) SamplingRate= 24000;
+ if (SamplingRate> 47040 && SamplingRate< 48960) SamplingRate= 48000;
+ if (SamplingRate> 94080 && SamplingRate< 97920) SamplingRate= 96000;
+ if (SamplingRate>188160 && SamplingRate<195840) SamplingRate=192000;
+ BitRate=SamplingRate/(4+bits_per_samples)*(5+bits_per_samples)*(2+2*number_channels)*(16+4*bits_per_samples);
+
+ Fill(Stream_Audio, 0, Audio_SamplingRate, SamplingRate);
+ Fill(Stream_Audio, 0, Audio_BitRate, BitRate);
+ }
+
+ Finish("AES3");
+ }
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_AES3_YES
diff --git a/src/thirdparty/MediaInfo/Audio/File_Aes3.h b/src/thirdparty/MediaInfo/Audio/File_Aes3.h
new file mode 100644
index 000000000..c7fd0e0dd
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Aes3.h
@@ -0,0 +1,61 @@
+// File_Aes3 - Info Info for AES3 packetized streams
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about PCM files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_Aes3H
+#define MediaInfo_File_Aes3H
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Aes3
+//***************************************************************************
+
+class File_Aes3 : public File__Analyze
+{
+public :
+ //Constructor/Destructor
+ File_Aes3();
+
+private :
+ //Buffer - Per element
+ void Header_Parse();
+ void Data_Parse();
+
+ //Temp
+ size_t Block_Count;
+ int64u Block_Last_Size;
+ int64u Block_Last_PTS;
+ int8u number_channels;
+ int8u bits_per_samples;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Audio/File_Als.cpp b/src/thirdparty/MediaInfo/Audio/File_Als.cpp
new file mode 100644
index 000000000..0ea084e07
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Als.cpp
@@ -0,0 +1,147 @@
+// File_Als - Info for MPEG-4 ALS files
+// Copyright (C) 2009-2009 Lionel Duchateau, kurtnoise@free.fr
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_CompressionRatio, 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_Info(Channels+1, " channel(s)");
+ BS_Begin();
+ Get_S1 (3, FileType, "file type"); // WAV, RIFF, AIFF
+ Get_S1 (3, BitsPerSample, "bits per sample"); Param_Info((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_Resolution, (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
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Als.h b/src/thirdparty/MediaInfo/Audio/File_Als.h
new file mode 100644
index 000000000..8a60675c1
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Als.h
@@ -0,0 +1,63 @@
+// File_Als - Info for MPEG-4 ALS files
+// Copyright (C) 2009-2009 Lionel Duchateau, kurtnoise@free.fr
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_AlsH
+#define MediaInfo_File_AlsH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#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
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Amr.cpp b/src/thirdparty/MediaInfo/Audio/File_Amr.cpp
new file mode 100644
index 000000000..e229aeba7
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Amr.cpp
@@ -0,0 +1,271 @@
+// File_Amr - Info for AMR files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_Resolution, 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_Resolution, 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_Info(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
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Amr.h b/src/thirdparty/MediaInfo/Audio/File_Amr.h
new file mode 100644
index 000000000..04e4e81e3
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Amr.h
@@ -0,0 +1,75 @@
+// File_Amr - Info for AMR files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Musepack files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_AmrH
+#define MediaInfo_File_AmrH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include <map>
+//---------------------------------------------------------------------------
+
+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<int8u, size_t> FrameTypes;
+ int64u Header_Size;
+ int8u FrameType;
+ int8u Channels;
+ bool IsWB;
+};
+
+} //NameSpace
+
+#endif
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Amv.cpp b/src/thirdparty/MediaInfo/Audio/File_Amv.cpp
new file mode 100644
index 000000000..7627b3d40
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Amv.cpp
@@ -0,0 +1,55 @@
+// File_Amv - Info for AMV files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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
diff --git a/src/thirdparty/MediaInfo/Audio/File_Amv.h b/src/thirdparty/MediaInfo/Audio/File_Amv.h
new file mode 100644
index 000000000..0de7e0648
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Amv.h
@@ -0,0 +1,46 @@
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Audio/File_Ape.cpp b/src/thirdparty/MediaInfo/Audio/File_Ape.cpp
new file mode 100644
index 000000000..c6dc1d319
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Ape.cpp
@@ -0,0 +1,217 @@
+// File_Ape - Info for Ape files
+// Copyright (C) 2003-2009 Jasper van de Gronde, th.v.d.gronde@hccnet.nl
+// Copyright (C) 2003-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_CompressionRatio, 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;
+ bool Resolution8=false, Resolution24=false, no_wav_header;
+ Skip_C4( "Identifier");
+ Get_L2 (Version, "Version");
+ if (Version<3980) //<3.98
+ {
+ Get_L2 (CompressionLevel, "CompressionLevel"); Param_Info(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_Info(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_Resolution, 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
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Ape.h b/src/thirdparty/MediaInfo/Audio/File_Ape.h
new file mode 100644
index 000000000..432bd5b8f
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Ape.h
@@ -0,0 +1,67 @@
+// File_Ape - Info for Ape Audio files
+// Copyright (C) 2003-2009 Jasper van de Gronde, th.v.d.gronde@hccnet.nl
+// Copyright (C) 2003-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Ape files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_ApeH
+#define MediaInfo_File_ApeH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#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
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Au.cpp b/src/thirdparty/MediaInfo/Audio/File_Au.cpp
new file mode 100644
index 000000000..a9fb55da8
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Au.cpp
@@ -0,0 +1,183 @@
+// File_Au - Info for AU files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Source: http://wiki.multimedia.cx/index.php?title=Au/snd
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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
diff --git a/src/thirdparty/MediaInfo/Audio/File_Au.h b/src/thirdparty/MediaInfo/Audio/File_Au.h
new file mode 100644
index 000000000..09ead8554
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Au.h
@@ -0,0 +1,50 @@
+// File_Au - Info for AU files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Audio/File_Dts.cpp b/src/thirdparty/MediaInfo/Audio/File_Dts.cpp
new file mode 100644
index 000000000..defa92cfc
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Dts.cpp
@@ -0,0 +1,1212 @@
+// File_Dts - Info for DTS files
+// Copyright (C) 2004-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_DTS_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Audio/File_Dts.h"
+#include "ZenLib/Utils.h"
+#include "ZenLib/BitStream.h"
+#if MEDIAINFO_EVENTS
+ #include "MediaInfo/MediaInfo_Events.h"
+#endif //MEDIAINFO_EVENTS
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+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[]=
+{
+ "Mono",
+ "Dual mono",
+ "Front: L R",
+ "Front: L R",
+ "Front: L R",
+ "Front: L C R",
+ "Front: L R, Side: C",
+ "Front: L C R, Side: C",
+ "Front: L 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",
+ "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[]=
+{
+ "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",
+ "2/2/2",
+ "3/2/0",
+ "2/2/2",
+ "3/2/2",
+ "2/2/4",
+ "3/2/3",
+};
+
+//---------------------------------------------------------------------------
+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)==0x0C00)
+ 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)==0x0C00)
+ 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
+ MustSynchronize=true;
+ Buffer_TotalBytes_FirstSynched_Max=32*1024;
+
+ //In
+ Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.3?32:2;
+
+ //Temp
+ Parser=NULL;
+ Frame_Count=0;
+ HD_size=0;
+ Primary_Frame_Byte_Size_minus_1=0;
+ HD_SpeakerActivityMask=(int16u)-1;
+ channel_arrangement=(int8u)-1;
+ channel_arrangement_XCh=(int8u)-1;
+ sample_frequency=(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;
+}
+
+//---------------------------------------------------------------------------
+File_Dts::~File_Dts()
+{
+ //Pointers
+ delete Parser;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Dts::Streams_Fill()
+{
+ if (!IsSub)
+ {
+ Fill(Stream_General, 0, General_Format, "DTS");
+ Fill(Stream_General, 0, General_Format_Profile, Profile);
+ }
+
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, 0, Audio_Format, "DTS");
+
+ if (Parser) //LE or 14-bit
+ return; //filled by the parser
+
+ if (Profile.empty() && ES)
+ Profile="ES";
+ Fill(Stream_Audio, 0, Audio_Format_Profile, Profile);
+ Fill(Stream_Audio, 0, Audio_Codec, (Profile.find(_T("MA"))==0 || Profile.find(_T("HRA"))==0)?"DTS-HD":"DTS");
+ Fill(Stream_Audio, 0, Audio_BitRate_Mode, Profile.find(_T("MA"))==0?"VBR":"CBR");
+ Fill(Stream_Audio, 0, Audio_SamplingRate, DTS_SamplingRate[sample_frequency]);
+ if (Profile!=_T("MA") && (bit_rate<29 || Profile==_T("Express")))
+ {
+ float64 BitRate;
+ if (Profile==_T("Express"))
+ BitRate=0; //No core bitrate
+ else
+ BitRate=(float64)DTS_BitRate[bit_rate];
+ if (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+=HD_size*8*DTS_HD_MaximumSampleRate[HD_MaximumSampleRate]/SamplePerFrames;
+ }
+ //if (Primary_Frame_Byte_Size_minus_1 && Profile==_T("HRA"))
+ // BitRate*=1+((float64)HD_size)/Primary_Frame_Byte_Size_minus_1; //HD block are not in the nominal bitrate
+ Fill(Stream_Audio, 0, Audio_BitRate, BitRate, 0);
+ }
+ else if (bit_rate==29)
+ Fill(Stream_Audio, 0, Audio_BitRate, "Open");
+ else if (bit_rate==30)
+ Fill(Stream_Audio, 0, Audio_BitRate, "Variable");
+ else if (bit_rate==31)
+ Fill(Stream_Audio, 0, Audio_BitRate, "LossLess");
+ 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
+ {
+ int8u Channels;
+ Ztring ChannelPositions, ChannelPositions2;
+ 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]);
+ }
+ else
+ {
+ Channels=8;
+ ChannelPositions.From_Local("User defined");
+ }
+ if (lfe_effects)
+ {
+ ChannelPositions+=_T(", LFE");
+ ChannelPositions2+=_T(".1");
+ }
+ Fill(Stream_Audio, 0, Audio_Channel_s_, Channels);
+ Fill(Stream_Audio, 0, Audio_ChannelPositions, ChannelPositions);
+ Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, ChannelPositions2);
+ }
+ Fill(Stream_Audio, 0, Audio_Resolution, DTS_Resolution[bits_per_sample]);
+
+ //Priority on HD data
+ if (HD_SpeakerActivityMask!=(int16u)-1)
+ {
+ Fill(Stream_Audio, 0, Audio_ChannelPositions, DTS_HD_SpeakerActivityMask(HD_SpeakerActivityMask).c_str(), Unlimited, true, true);
+ Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, DTS_HD_SpeakerActivityMask2(HD_SpeakerActivityMask).c_str(), Unlimited, true, true);
+ }
+ if(HD_BitResolution!=(int8u)-1)
+ Fill(Stream_Audio, 0, Audio_Resolution, HD_BitResolution, 10, true);
+ if(HD_MaximumSampleRate!=(int8u)-1)
+ Fill(Stream_Audio, 0, Audio_SamplingRate, DTS_HD_MaximumSampleRate[HD_MaximumSampleRate], 10, true);
+ if(HD_TotalNumberChannels!=(int8u)-1)
+ Fill(Stream_Audio, 0, Audio_Channel_s_, HD_TotalNumberChannels, 10, true);
+}
+
+//---------------------------------------------------------------------------
+void File_Dts::Streams_Finish()
+{
+ if (Parser) //LE or 14-bit
+ {
+ Parser->Finish();
+ Merge(*Parser, Stream_Audio, 0, 0);
+ if (!BigEndian) Fill(Stream_Audio, 0, Audio_Format_Profile, "LE");
+ if (!Word) Fill(Stream_Audio, 0, Audio_Format_Profile, "14");
+ }
+}
+
+//***************************************************************************
+// 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 begining 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)
+ {
+ 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
+ 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;
+ }
+
+ //Configuration - 14 bits or Little Endian
+ switch (CC1(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
+ }
+
+ //Synched
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool File_Dts::Synched_Test()
+{
+ //Must have enough buffer for having header
+ if (Buffer_Offset+4>Buffer_Size)
+ return false;
+
+ //Quick test of synchro
+ switch (CC4(Buffer+Buffer_Offset))
+ {
+ case 0x7FFE8001 : //16 bits and big endian Core
+ case 0xFE7F0180 : //16 bits and little endian Core
+ case 0x1FFFE800 : //14 bits and big endian Core
+ case 0xFF1F00E8 : //14 bits and little endian Core
+ case 0x64582025 : //16 bits and big endian HD
+ break;
+ default : Synched=false;
+ }
+
+ //We continue
+ return true;
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Dts::Read_Buffer_Continue()
+{
+ //Exception handling
+ int8u* Dest=NULL;
+ try
+ {
+
+ //Mapping to an understable bitstream if needed
+ if (MustSynchronize && !Synchro_Manage())
+ return; //Wait for more data
+ if (Synched && (!Word || !BigEndian))
+ {
+ //Preparing new buffer
+ size_t Dest_Size=Word?Buffer_Size:(Buffer_Size*14/16);
+ Dest=new int8u[Dest_Size];
+ if (Word)
+ {
+ for (size_t Pos=0; Pos+1<Buffer_Size; Pos+=2)
+ {
+ Dest[Pos+1]=Buffer[Pos ];
+ Dest[Pos ]=Buffer[Pos+1];
+ }
+ }
+ else
+ {
+ for (size_t Pos=0; Pos+7<Buffer_Size; Pos+=8)
+ {
+ int64u Value;
+ if (BigEndian)
+ Value =(((int64u)( BigEndian2int16u(Buffer+Pos )&0x3FFF))<<42)
+ | (((int64u)( BigEndian2int16u(Buffer+Pos+2)&0x3FFF))<<28)
+ | (((int64u)( BigEndian2int16u(Buffer+Pos+4)&0x3FFF))<<14)
+ | (((int64u)( BigEndian2int16u(Buffer+Pos+6)&0x3FFF)) );
+ else
+ Value =(((int64u)(LittleEndian2int16u(Buffer+Pos )&0x3FFF))<<42)
+ | (((int64u)(LittleEndian2int16u(Buffer+Pos+2)&0x3FFF))<<28)
+ | (((int64u)(LittleEndian2int16u(Buffer+Pos+4)&0x3FFF))<<14)
+ | (((int64u)(LittleEndian2int16u(Buffer+Pos+6)&0x3FFF)) );
+ int56u2BigEndian(Dest+Pos/8*7, Value);
+ }
+ }
+
+ //Parsing
+ if (Parser==NULL)
+ {
+ Parser=new File_Dts;
+ ((File_Dts*)Parser)->Frame_Count_Valid=Frame_Count_Valid;
+ Open_Buffer_Init(Parser);
+ }
+ Demux(Dest, Dest_Size, ContentType_MainStream);
+ Open_Buffer_Continue(Parser, Dest, Dest_Size);
+ if (!Status[IsFinished] && Parser->Status[IsFinished])
+ {
+ Accept("DTS");
+ Finish("DTS");
+ }
+
+ delete[] Dest;
+ Buffer_Offset+=Buffer_Size;
+ }
+
+ //Exception handling
+ }
+ catch(...)
+ {
+ delete[] Dest;
+ }
+}
+
+//***************************************************************************
+// Buffer - Per element
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Dts::Header_Parse()
+{
+ //Parsing
+ int32u Sync;
+ Get_B4 (Sync, "Sync");
+ if (Sync==0x64582025)
+ {
+ //HD
+ 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_Info(header_size, " bytes");
+ Get_S3 (20, HD_size, "HD block size"); HD_size++; Param_Info(HD_size, " bytes");
+ }
+ else
+ {
+ Get_S2 ( 8, header_size, "Header size"); header_size++; Param_Info(header_size, " bytes");
+ Get_S3 (16, HD_size, "HD block size"); HD_size++; Param_Info(HD_size, " bytes");
+ }
+ TESTELSE_SB_GET(StaticFieldsPresent, "Static fields present");
+ std::vector<int32u> ActiveExSSMasks;
+ Info_S1(2, RefClockCode, "Reference clock code"); Param_Info(DTS_HD_RefClockCode[RefClockCode]);
+ Get_S1 (3, HD_ExSSFrameDurationCode, "ExSS frame duration code"); HD_ExSSFrameDurationCode++; Param_Info(HD_ExSSFrameDurationCode);
+ TEST_SB_SKIP( "Timestamp flag");
+ Skip_S5(36, "Timestamp");
+ TEST_SB_END();
+ Get_S1 (3, NumAudioPresent, "Num audio present"); NumAudioPresent++; Param_Info(NumAudioPresent, " channels");
+ Get_S1 (3, NumAssets, "Num assets"); NumAssets++; Param_Info(NumAssets, " assets");
+ Element_Begin("Active masks");
+ for (int8u Pos=0; Pos<NumAudioPresent; Pos++)
+ {
+ int32u ActiveExSSMask;
+ Get_S4 (SubStreamIndex+1, ActiveExSSMask, "Active ExSS mask");
+ ActiveExSSMasks.push_back(ActiveExSSMask);
+ }
+ Element_End();
+ Element_Begin("Active masks 2");
+ for (int8u Pos=0; Pos<NumAudioPresent; Pos++)
+ for (int8u Pos2=0; Pos2<SubStreamIndex+1; Pos2+=2)
+ if (ActiveExSSMasks[Pos]%2)
+ Skip_S1(8, "Active ExSS Mask");
+ Element_End();
+ TEST_SB_SKIP( "Mix metadata Enabled");
+ int8u Bits4MixOutMask, NumMixOutConfigs;
+ Skip_S1(2, "Mix metadata adjustment level");
+ Get_S1 (2, Bits4MixOutMask, "Bits4Mix out mask"); Bits4MixOutMask=4+Bits4MixOutMask*4; Param_Info(Bits4MixOutMask, " bits");
+ Get_S1 (2, NumMixOutConfigs, "Number of mix out configs"); NumMixOutConfigs++; Param_Info(NumMixOutConfigs, " configs");
+ for (int8u Pos=0; Pos<NumMixOutConfigs; Pos++)
+ Skip_S1(Bits4MixOutMask, "MixOutChMask");
+ TEST_SB_END();
+ TESTELSE_SB_ELSE("Static fields present");
+ NumAudioPresent=1;
+ NumAssets=1;
+ TESTELSE_SB_END();
+ Asset_Sizes.clear();
+ Element_Begin("Sizes");
+ for (int8u Pos=0; Pos<NumAssets; Pos++)
+ {
+ int32u Size;
+ if (isBlownUpHeader)
+ {
+ Get_S3 (20, Size, "Size"); Size++; Param_Info(Size, " bytes");
+ }
+ else
+ {
+ Get_S3 (16, Size, "Size"); Size++; Param_Info(Size, " bytes");
+ }
+ Asset_Sizes.push_back(Size);
+ }
+ Element_End();
+ for (int8u Asset_Pos=0; Asset_Pos<NumAssets; Asset_Pos++)
+ {
+ Element_Begin("Asset");
+ int16u AssetSize;
+ Get_S2 (9, AssetSize, "Asset size");
+ AssetSize++; Param_Info(AssetSize, " bytes?");
+ Skip_S1(3, "Descriptor data for asset index");
+ if (StaticFieldsPresent)
+ {
+ TEST_SB_SKIP( "Asset type descriptor present");
+ Info_S1( 4, TypeDescriptor, "Asset type descriptor"); Param_Info(DTS_HD_TypeDescriptor[TypeDescriptor]);
+ TEST_SB_END();
+ TEST_SB_SKIP( "Language descriptor present");
+ Info_S3(24, LanguageDescriptor, "Language descriptor"); Param_Info(Ztring().From_CC3(LanguageDescriptor));
+ TEST_SB_END();
+ TEST_SB_SKIP( "Info text present");
+ int16u InfoTextByteSize;
+ Get_S2(10, InfoTextByteSize, "Info text size"); InfoTextByteSize++; Param_Info(InfoTextByteSize, "bytes");
+ for (int16u Pos=0; Pos<InfoTextByteSize; Pos++)
+ Skip_S1(8, "Info text");
+ TEST_SB_END();
+ Get_S1 (5, HD_BitResolution, "Bit resolution"); HD_BitResolution++; Param_Info(HD_BitResolution, " bits");
+ Get_S1 (4, HD_MaximumSampleRate, "Maximum sample rate"); Param_Info(DTS_HD_MaximumSampleRate[HD_MaximumSampleRate], " Hz");
+ Get_S1 (8, HD_TotalNumberChannels, "Total number of channels"); HD_TotalNumberChannels++; Param_Info(HD_TotalNumberChannels, " channels");
+ TEST_SB_SKIP( "1 to 1 map channels to speakers");
+ int8u SpeakerActivityMaskBits, SpeakerRemapSetsCount;
+ if (HD_TotalNumberChannels>2)
+ 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_Info(4+SpeakerActivityMaskBits*4, " bits");
+ SpeakerActivityMaskBits=4+SpeakerActivityMaskBits*4;
+ Get_S2 (SpeakerActivityMaskBits, HD_SpeakerActivityMask, "Speaker activity mask"); Param_Info(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<SpeakerRemapSetsCount; Pos++)
+ Skip_S2(SpeakerActivityMaskBits, "Standard speaker layout mask");
+ for (int8u Pos=0; Pos<SpeakerRemapSetsCount; Pos++)
+ {
+ int8u NumDecCh4Remap;
+ Get_S1(5, NumDecCh4Remap, "NumDecCh4Remap");
+ //Not finnished!
+ }
+ TEST_SB_END();
+ Element_End();
+ }
+ }
+ BS_End();
+ Skip_XX(header_size-Element_Offset, "Unknown");
+
+ //Filling
+ Header_Fill_Size(HD_size);
+ Header_Fill_Code(1, "HD");
+ }
+ else
+ {
+ //Frame
+ int8u EncoderSoftwareRevision;
+ bool crc_present;
+ BS_Begin();
+ Info_SB( FrameType, "Frame Type"); Param_Info(DTS_FrameType[FrameType]);
+ Skip_S1( 5, "Deficit Sample Count");
+ Get_SB ( crc_present, "CRC Present");
+ Skip_S1( 7, "Number of PCM Sample Blocks");
+ Get_S2 (14, Primary_Frame_Byte_Size_minus_1, "Primary Frame Byte Size minus 1");
+ Primary_Frame_Byte_Size_minus_1+=1;
+ if (!Word) Primary_Frame_Byte_Size_minus_1=Primary_Frame_Byte_Size_minus_1*8/14*2; Param_Info(Ztring::ToZtring(Primary_Frame_Byte_Size_minus_1)+_T(" bytes")); //Word is on 14 bits!
+ Get_S1 ( 6, channel_arrangement, "Audio Channel Arrangement"); Param_Info(Ztring::ToZtring(DTS_Channels[channel_arrangement])+_T(" channels"));
+ Get_S1 ( 4, sample_frequency, "Core Audio Sampling Frequency"); Param_Info(Ztring::ToZtring(DTS_SamplingRate[sample_frequency])+_T(" Hz"));
+ Get_S1 ( 5, bit_rate, "Transmission Bit Rate"); Param_Info(Ztring::ToZtring(DTS_BitRate[bit_rate])+_T(" bps"));
+ Skip_SB( "Embedded Down Mix Enabled");
+ Skip_SB( "Embedded Dynamic Range");
+ Skip_SB( "Embedded Time Stamp");
+ Skip_SB( "Auxiliary Data");
+ Skip_SB( "HDCD");
+ Get_S1 ( 3, ExtensionAudioDescriptor, "Extension Audio Descriptor"); Param_Info(DTS_ExtensionAudioDescriptor[ExtensionAudioDescriptor]);
+ Get_SB ( ExtendedCoding, "Extended Coding");
+ Skip_SB( "Audio Sync Word Insertion");
+ Get_S1 ( 2, lfe_effects, "Low Frequency Effects");
+ Skip_SB( "Predictor History");
+ if (crc_present)
+ Skip_S2(16, "Header CRC Check");
+ Skip_SB( "Multirate Interpolator");
+ Get_S1 ( 4, EncoderSoftwareRevision, "Encoder Software Revision");
+ Skip_S1( 2, "Copy History");
+ Get_S1 ( 2, bits_per_sample, "Source PCM Resolution"); Param_Info(Ztring::ToZtring(DTS_Resolution[bits_per_sample])+_T(" bits"));
+ Get_SB ( ES, "ES");
+ Skip_SB( "Front Sum/Difference");
+ Skip_SB( "Surrounds Sum/Difference");
+ Skip_S1( 4, "Dialog Normalisation Parameter");
+ switch (EncoderSoftwareRevision)
+ {
+ case 6 :
+ Skip_S1( 4, "Dialog Normalisation Parameter");
+ break;
+ case 7 :
+ Skip_S1( 4, "Dialog Normalisation Parameter");
+ break;
+ default :
+ Skip_S1( 4, "Unspecified");
+ break;
+ }
+ BS_End();
+
+ //Filling
+ Header_Fill_Size(Primary_Frame_Byte_Size_minus_1);
+ Header_Fill_Code(0);
+ }
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Dts::Data_Parse()
+{
+ //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 (Element_Code==0 || !Core_Exists)
+ Frame_Count++;
+
+ //Name
+ Element_Info(Ztring::ToZtring(Frame_Count));
+
+ //Parsing
+ switch(Element_Code)
+ {
+ case 0 : Core(); break;
+ case 1 : HD(); break;
+ default : Skip_XX(Element_Size, "Data");
+ }
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Dts::Core()
+{
+ Element_Name("Frame");
+
+ //It exists (not in XSA streams)
+ Core_Exists=true;
+
+ //Looking for extensions
+ int64u Core_Size=Element_Size, XCh_Sync=Element_Size, XXCh_Sync=Element_Size, X96k_Sync=Element_Size;
+ if (ExtendedCoding)
+ {
+ //XCh
+ if (ExtensionAudioDescriptor==0 || ExtensionAudioDescriptor==3)
+ for (size_t Pos=0; Pos+4<=Element_Size; Pos++)
+ if (CC4(Buffer+Buffer_Offset+Pos)==0x5A5A5A5A)
+ XCh_Sync=Pos;
+
+ //XXCh
+ if (ExtensionAudioDescriptor==6)
+ for (size_t Pos=0; Pos+4<=Element_Size; Pos++)
+ if (CC4(Buffer+Buffer_Offset+Pos)==0x47004A03)
+ XXCh_Sync=Pos;
+
+ //X96k
+ if (ExtensionAudioDescriptor==2 || ExtensionAudioDescriptor==3)
+ for (size_t Pos=0; Pos+4<=Element_Size; Pos++)
+ if (CC4(Buffer+Buffer_Offset+Pos)==0x1D95F262)
+ X96k_Sync=Pos;
+
+ //Finding core size
+ if (XCh_Sync<Core_Size)
+ Core_Size=XCh_Sync;
+ if (XXCh_Sync<Core_Size)
+ Core_Size=XXCh_Sync;
+ if (X96k_Sync<Core_Size)
+ Core_Size=X96k_Sync;
+ }
+
+ //Parsing
+ Skip_XX(Core_Size, "Core data");
+ if (ExtendedCoding && (ExtensionAudioDescriptor==2 || ExtensionAudioDescriptor==3))
+ {
+ Element_Begin();
+ Skip_B4( "Magic");
+ Core_X96k(XCh_Sync-Element_Offset);
+ Element_End();
+ }
+ if (ExtendedCoding && (ExtensionAudioDescriptor==0 || ExtensionAudioDescriptor==3))
+ {
+ Element_Begin();
+ Skip_B4( "Magic");
+ Core_XCh(Element_Size-Element_Offset);
+ Element_End();
+ }
+ if (ExtendedCoding && ExtensionAudioDescriptor==6)
+ {
+ Element_Begin();
+ Skip_B4( "Magic");
+ Core_XXCh(Element_Size-Element_Offset);
+ Element_End();
+ }
+
+ //Filling
+ FILLING_BEGIN();
+ if (Count_Get(Stream_Audio)==0 && Frame_Count>=Frame_Count_Valid)
+ {
+ Accept("DTS");
+ 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)
+ Skip_XX(XChFSIZE+1-6, "XCh data");
+
+ 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=14; //96KHz
+ Profile="96/24";
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Dts::HD()
+{
+ //Parsing
+ while (Element_Offset<Element_Size)
+
+ {
+ //Looking for size
+ int64u Next=Element_Offset+4;
+ while (Next+4<=Element_Size)
+ {
+ int32u CC=CC4(Buffer+Buffer_Offset+(size_t)Next);
+ if (CC==0x0A801921
+ || CC==0x1D95F262
+ || CC==0x41A29547
+ || CC==0x47004A03
+ || CC==0x5A5A5A5A
+ || CC==0x655E315E)
+ break;
+ Next++;
+ }
+ if (Next+4>Element_Size)
+ Next=Element_Size;
+
+ Element_Begin();
+ 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_End();
+ }
+
+ //Filling
+ FILLING_BEGIN();
+ if (Count_Get(Stream_Audio)==0 && Frame_Count>=Frame_Count_Valid)
+ {
+ Accept("DTS");
+ 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();
+}
+
+//---------------------------------------------------------------------------
+} //NameSpace
+
+#endif //MEDIAINFO_DTS_YES
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Dts.h b/src/thirdparty/MediaInfo/Audio/File_Dts.h
new file mode 100644
index 000000000..b02338fac
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Dts.h
@@ -0,0 +1,110 @@
+// File_Dts - Info for DTS files
+// Copyright (C) 2004-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_DtsH
+#define MediaInfo_DtsH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#ifdef ES
+ #undef ES //Solaris defines this somewhere
+#endif
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Dts
+//***************************************************************************
+
+class File_Dts : public File__Analyze
+{
+public :
+ //In
+ size_t Frame_Count_Valid;
+
+ //Constructor/Destructor
+ File_Dts();
+ ~File_Dts();
+
+private :
+ //Streams management
+ void Streams_Fill();
+ 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();
+
+ //Elements
+ void Core();
+ void Core_XCh(int64u Size);
+ void Core_XXCh(int64u Size);
+ void Core_X96k(int64u Size);
+ void HD();
+ void HD_XCh(int64u Size);
+ void HD_XXCh(int64u Size);
+ void HD_X96k(int64u Size);
+ void HD_XLL(int64u Size);
+ void HD_XBR(int64u Size);
+ void HD_XSA(int64u Size);
+
+ //Temp
+ std::map<int32u, int64u> HD_Sizes;
+ std::vector<ZenLib::int32u> Asset_Sizes;
+ Ztring Profile;
+ File__Analyze* Parser; //14 bits or Little Endian
+ size_t Frame_Count;
+ int32u HD_size;
+ int16u Primary_Frame_Byte_Size_minus_1;
+ int16u HD_SpeakerActivityMask;
+ int8u channel_arrangement;
+ int8u channel_arrangement_XCh;
+ int8u sample_frequency;
+ 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;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Audio/File_ExtendedModule.cpp b/src/thirdparty/MediaInfo/Audio/File_ExtendedModule.cpp
new file mode 100644
index 000000000..5ca232c4c
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_ExtendedModule.cpp
@@ -0,0 +1,116 @@
+// File_ExtendedModule - Info for Extended Module files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WXMHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILXMY or FXMNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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(_T("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);
+
+ for (int16u Pos=0; Pos<Channels; Pos++)
+ {
+ Stream_Prepare(Stream_Audio);
+ }
+
+ //No more need data
+ Finish("Extended Module");
+ FILLING_END();
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_XM_YES
diff --git a/src/thirdparty/MediaInfo/Audio/File_ExtendedModule.h b/src/thirdparty/MediaInfo/Audio/File_ExtendedModule.h
new file mode 100644
index 000000000..d5d956e2e
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_ExtendedModule.h
@@ -0,0 +1,52 @@
+// File_ExtendedModule - Info for Extended Module files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WXMHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILXMY or FXMNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Audio/File_Flac.cpp b/src/thirdparty/MediaInfo/Audio/File_Flac.cpp
new file mode 100644
index 000000000..d8a04ab80
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Flac.cpp
@@ -0,0 +1,263 @@
+// File_Flac - Info for Flac files
+// Copyright (C) 2003-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_FLAC_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Audio/File_Flac.h"
+#include "MediaInfo/Tag/File_VorbisCom.h"
+#include "ZenLib/Base64/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_Size<Buffer_Offset+4+(VorbisHeader?9:0))
+ return false; //Must wait for more data
+
+ if (CC4(Buffer+Buffer_Offset+(VorbisHeader?9:0))!=0x664C6143) //"fLaC"
+ {
+ File__Tags_Helper::Finish("Flac");
+ return false;
+ }
+
+ //All should be OK...
+ return true;
+}
+
+//---------------------------------------------------------------------------
+void File_Flac::FileHeader_Parse()
+{
+ //Parsing
+ if (VorbisHeader)
+ {
+ Skip_B1( "Signature");
+ Skip_Local(4, "Signature");
+ Skip_B1( "Major version");
+ Skip_B1( "Minor version");
+ Skip_B2( "Number of header");
+ }
+ Skip_C4( "Signature");
+}
+
+//***************************************************************************
+// Buffer - Per element
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Flac::Header_Parse()
+{
+ //Parsing
+ int32u Length;
+ int8u BLOCK_TYPE;
+ BS_Begin();
+ Get_SB ( Last_metadata_block, "Last-metadata-block");
+ Get_S1 (7, BLOCK_TYPE, "BLOCK_TYPE");
+ BS_End();
+ Get_B3 (Length, "Length");
+
+ //Filling
+ Header_Fill_Code(BLOCK_TYPE, Ztring().From_CC1(BLOCK_TYPE));
+ Header_Fill_Size(Element_Offset+Length);
+}
+
+//---------------------------------------------------------------------------
+void File_Flac::Data_Parse()
+{
+ #define CASE_INFO(_NAME) \
+ case Flac::_NAME : Element_Info(#_NAME); _NAME(); break;
+
+ //Parsing
+ switch ((int16u)Element_Code)
+ {
+ CASE_INFO(STREAMINFO);
+ CASE_INFO(PADDING);
+ CASE_INFO(APPLICATION);
+ CASE_INFO(SEEKTABLE);
+ CASE_INFO(VORBIS_COMMENT);
+ CASE_INFO(CUESHEET);
+ CASE_INFO(PICTURE);
+ default : Skip_XX(Element_Size, "Data");
+ }
+
+ if (Last_metadata_block)
+ {
+ if (!IsSub)
+ Fill(Stream_Audio, 0, Audio_StreamSize, File_Size-(File_Offset+Buffer_Offset+Element_Size));
+
+ //No more need data
+ File__Tags_Helper::Finish("Flac");
+ }
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Flac::STREAMINFO()
+{
+ //Parsing
+ int64u Samples;
+ int32u FrameSize_Min, FrameSize_Max, SampleRate;
+ int8u Channels, BitPerSample;
+ Skip_B2( "BlockSize_Min"); //The minimum block size (in samples) used in the stream.
+ Skip_B2( "BlockSize_Max"); //The maximum block size (in samples) used in the stream. (Minimum blocksize == maximum blocksize) implies a fixed-blocksize stream.
+ Get_B3 ( FrameSize_Min, "FrameSize_Min"); //The minimum frame size (in bytes) used in the stream. May be 0 to imply the value is not known.
+ Get_B3 ( FrameSize_Max, "FrameSize_Max"); //The maximum frame size (in bytes) used in the stream. May be 0 to imply the value is not known.
+ BS_Begin();
+ Get_S3 (20, SampleRate, "SampleRate"); //Sample rate in Hz. Though 20 bits are available, the maximum sample rate is limited by the structure of frame headers to 1048570Hz. Also, a value of 0 is invalid.
+ Get_S1 ( 3, Channels, "Channels"); Param_Info(Channels+1, " channels"); //(number of channels)-1. FLAC supports from 1 to 8 channels
+ Get_S1 ( 5, BitPerSample, "BitPerSample"); Param_Info(BitPerSample+1, " bits"); //(bits per sample)-1. FLAC supports from 4 to 32 bits per sample. Currently the reference encoder and decoders only support up to 24 bits per sample.
+ Get_S5 (36, Samples, "Samples");
+ BS_End();
+ Skip_B16( "MD5 signature of the unencoded audio data");
+
+ FILLING_BEGIN()
+ if (SampleRate==0)
+ return;
+ File__Tags_Helper::Accept("FLAC");
+
+ File__Tags_Helper::Streams_Fill();
+
+ File__Tags_Helper::Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, 0, Audio_Format, "FLAC");
+ Fill(Stream_Audio, 0, Audio_Codec, "FLAC");
+ if (FrameSize_Min==FrameSize_Max && FrameSize_Min!=0 ) // 0 means it is unknown
+ Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR");
+ else
+ Fill(Stream_Audio, 0, Audio_BitRate_Mode, "VBR");
+ Fill(Stream_Audio, 0, Audio_SamplingRate, SampleRate);
+ Fill(Stream_Audio, 0, Audio_Channel_s_, Channels+1);
+ Fill(Stream_Audio, 0, Audio_Resolution, BitPerSample+1);
+ if (!IsSub)
+ Fill(Stream_Audio, 0, Audio_Duration, Samples*1000/SampleRate);
+
+ Buffer_MaximumSize=4*1024*1024;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Flac::APPLICATION()
+{
+ //Parsing
+ Skip_C4( "Application");
+ if (Element_Size>4)
+ 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_Info(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
+
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Flac.h b/src/thirdparty/MediaInfo/Audio/File_Flac.h
new file mode 100644
index 000000000..1e5d234ef
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Flac.h
@@ -0,0 +1,95 @@
+// File_Flac - Info for Flac Audio files
+// Copyright (C) 2003-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Flac files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_FlacH
+#define MediaInfo_File_FlacH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#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
diff --git a/src/thirdparty/MediaInfo/Audio/File_ImpulseTracker.cpp b/src/thirdparty/MediaInfo/Audio/File_ImpulseTracker.cpp
new file mode 100644
index 000000000..84300583b
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_ImpulseTracker.cpp
@@ -0,0 +1,136 @@
+// File_ImpulseTracker - Info for Impulse Tracker files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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
diff --git a/src/thirdparty/MediaInfo/Audio/File_ImpulseTracker.h b/src/thirdparty/MediaInfo/Audio/File_ImpulseTracker.h
new file mode 100644
index 000000000..6205cdb3a
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_ImpulseTracker.h
@@ -0,0 +1,52 @@
+// File_ImpulseTracker - Info for Impulse Tracker files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Audio/File_La.cpp b/src/thirdparty/MediaInfo/Audio/File_La.cpp
new file mode 100644
index 000000000..04c84a3cd
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_La.cpp
@@ -0,0 +1,148 @@
+// File_La - Info for LA files
+// Copyright (C) 2009-2009 Lionel Duchateau, kurtnoise@free.fr
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_CompressionRatio, 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+4>Buffer_Size)
+ return false;
+ if (CC4(Buffer+Buffer_Offset)!=0x4C413034) //"LA04"
+ {
+ File__Tags_Helper::Reject("LA");
+ return false;
+ }
+
+ return true;
+}
+
+//---------------------------------------------------------------------------
+void File_La::FileHeader_Parse()
+{
+ //Parsing
+ int32u SampleRate, Samples, BytesPerSecond, UnCompSize, WAVEChunk, FmtSize, FmtChunk, CRC32;
+ int16u RawFormat, Channels, BytesPerSample, BitsPerSample;
+
+ Skip_C4( "signature");
+ 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_Info(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");
+
+ 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_Resolution, 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
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_La.h b/src/thirdparty/MediaInfo/Audio/File_La.h
new file mode 100644
index 000000000..3d263fd20
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_La.h
@@ -0,0 +1,63 @@
+// File_La - Info for LA files
+// Copyright (C) 2009-2009 Lionel Duchateau, kurtnoise@free.fr
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_LaH
+#define MediaInfo_File_LaH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#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
diff --git a/src/thirdparty/MediaInfo/Audio/File_Latm.cpp b/src/thirdparty/MediaInfo/Audio/File_Latm.cpp
new file mode 100644
index 000000000..f3949eea6
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Latm.cpp
@@ -0,0 +1,205 @@
+// File_Latm - Info for LATM files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_LATM_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Audio/File_Latm.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Constructor - Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Latm::File_Latm()
+:File__Analyze()
+{
+ //In
+ audioMuxVersionA=false;
+}
+
+//***************************************************************************
+// Buffer - Synchro
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Latm::Synchronize()
+{
+ //Synchronizing
+ while (Buffer_Offset+2<=Buffer_Size
+ && (CC2(Buffer+Buffer_Offset)&0xFFE0)!=0x56E0)
+ Buffer_Offset++;
+ if (Buffer_Offset+2>=Buffer_Size)
+ return false;
+
+ //Synched is OK
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool File_Latm::Synched_Test()
+{
+ //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 - Per element
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Latm::Header_Parse()
+{
+ 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_Latm::Data_Parse()
+{
+ AudioMuxElement(true);
+ Accept("LATM");
+ Finish("LATM");
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Latm::AudioMuxElement(bool muxConfigPresent)
+{
+ BS_Begin();
+ if (muxConfigPresent)
+ {
+ bool useSameStreamMux;
+ Get_SB (useSameStreamMux, "useSameStreamMux");
+ if (!useSameStreamMux)
+ StreamMuxConfig();
+ if (audioMuxVersionA==0)
+ {
+ }
+ }
+ /*if (!useSameStreamMux)
+ ;
+ }
+ if (audioMuxVersionA == 0) {
+ for (i = 0; i <= numSubFrames; i++) {
+ PayloadLengthInfo();
+ PayloadMux();
+ }
+ if (otherDataPresent) {
+ for(i = 0; i < otherDataLenBits; I++) {
+ otherDataBit; 1 bslbf
+ }
+ }
+ }
+ else {
+ }
+ ByteAlign();
+ BS_End();
+ Skip_XX(audioMuxLengthBytes-1, "Data");
+
+ }
+ }
+ */
+}
+
+//---------------------------------------------------------------------------
+void File_Latm::StreamMuxConfig()
+{
+ Element_Begin("StreamMuxConfig");
+
+ bool audioMuxVersion;
+ Get_SB (audioMuxVersion, "audioMuxVersion");
+ if (audioMuxVersion)
+ Get_SB (audioMuxVersionA, "audioMuxVersionA");
+ else
+ audioMuxVersionA=false;
+
+ if (!audioMuxVersionA)
+ {
+ if (audioMuxVersion==1)
+ {
+ //taraBufferFullness=LatmGetValue();
+ }
+ Skip_SB( "allStreamsSameTimeFraming");
+ Skip_S1(6, "numSubFrames");
+ Skip_S1(4, "numProgram");
+/* for (int8u prog=0; prog<=numProgram; prog++)
+ {
+ int8u numLayer;
+ Get_S1(3, "numLayer");
+ for (lay = 0; lay <= numLayer; lay++) {
+progSIndx[streamCnt] = prog; laySIndx[streamCnt] = lay;
+streamID [ prog][ lay] = streamCnt++;
+if (prog == 0 && lay == 0) {
+useSameConfig = 0;
+} else {
+useSameConfig; 1 uimsbf
+}
+if (! useSameConfig) {
+if ( audioMuxVersion == 0 ) {
+AudioSpecificConfig();
+}
+else {
+ascLen = LatmGetValue();
+ascLen -= AudioSpecificConfig(); Note 1
+fillBits; ascLen bslbf
+}
+}
+*/
+ }
+
+ Element_End();
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_LATM_YES
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Latm.h b/src/thirdparty/MediaInfo/Audio/File_Latm.h
new file mode 100644
index 000000000..cf693af04
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Latm.h
@@ -0,0 +1,61 @@
+// File_Latm - Info for LATM files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_LatmH
+#define MediaInfo_LatmH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Latm
+//***************************************************************************
+
+class File_Latm : public File__Analyze
+{
+public :
+ //In
+ bool audioMuxVersionA;
+
+ //Constructor/Destructor
+ File_Latm();
+
+private :
+ //Buffer - Synchro
+ bool Synchronize();
+ bool Synched_Test();
+
+ //Buffer - Per element
+ void Header_Parse();
+ void Data_Parse();
+
+ //Elements
+ void AudioMuxElement(bool muxConfigPresent);
+ void StreamMuxConfig();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Audio/File_Midi.cpp b/src/thirdparty/MediaInfo/Audio/File_Midi.cpp
new file mode 100644
index 000000000..1679f9b8d
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Midi.cpp
@@ -0,0 +1,55 @@
+// File_Midi - Info for MIDI files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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
diff --git a/src/thirdparty/MediaInfo/Audio/File_Midi.h b/src/thirdparty/MediaInfo/Audio/File_Midi.h
new file mode 100644
index 000000000..8fa04e70c
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Midi.h
@@ -0,0 +1,49 @@
+// File_Midi - Info for MIDI files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Audio/File_Module.cpp b/src/thirdparty/MediaInfo/Audio/File_Module.cpp
new file mode 100644
index 000000000..7d06c5706
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Module.cpp
@@ -0,0 +1,112 @@
+// File_Module - Info for Module files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WXMHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILXMY or FXMNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_Begin();
+ Get_Local(22, SamplesName, "Sample's name"); Element_Name(SamplesName);
+ Skip_B2( "Sample length");
+ Skip_B1( "Finetune value for the sample");
+ Skip_B1( "Volume of the sample");
+ Skip_B2( "Start of sample repeat offset");
+ Skip_B2( "Length of sample repeat");
+ Element_End();
+ }
+ Skip_B1( "Number of song positions");
+ Skip_B1( "0x8F");
+ Skip_XX(128, "Pattern table");
+ 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
diff --git a/src/thirdparty/MediaInfo/Audio/File_Module.h b/src/thirdparty/MediaInfo/Audio/File_Module.h
new file mode 100644
index 000000000..cb5c7b06c
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Module.h
@@ -0,0 +1,53 @@
+// File_Module - Info for Module files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WXMHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILXMY or FXMNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Audio/File_Mpc.cpp b/src/thirdparty/MediaInfo/Audio/File_Mpc.cpp
new file mode 100644
index 000000000..b98dcd3e5
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Mpc.cpp
@@ -0,0 +1,220 @@
+// File_Mpc - Info for Musepack files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Source: http://trac.musepack.net/trac/wiki/SV7Specification
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//***************************************************************************
+// 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_Begin("SV7 header", 21);
+ 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_Info(Mpc_Profile[Profile]);
+ Get_S1 (2, Link, "Link"); Param_Info(Mpc_Link[Link]);
+ Get_S1 (2, SampleFreq, "SampleFreq"); Param_Info(Mpc_SampleFreq[SampleFreq]);
+ Skip_SB( "IntensityStereo");
+ Skip_SB( "MidSideStereo");
+ Skip_S1(6, "MaxBand");
+ BS_End();
+
+ Skip_L2( "TitlePeak");
+ Get_L2 (TitleGain, "TitleGain"); Param_Info(((float32)((int16s)TitleGain))/1000, 2, " dB");
+
+ Skip_L2( "AlbumPeak");
+ Get_L2 (AlbumGain, "AlbumGain"); Param_Info(((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_Info(Encoder);
+
+ Element_End();
+
+ 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_Resolution, 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
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Mpc.h b/src/thirdparty/MediaInfo/Audio/File_Mpc.h
new file mode 100644
index 000000000..b9bc4274e
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Mpc.h
@@ -0,0 +1,62 @@
+// File_Mpc - Info for Musepack files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Musepack files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_MpcH
+#define MediaInfo_File_MpcH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#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
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_MpcSv8.cpp b/src/thirdparty/MediaInfo/Audio/File_MpcSv8.cpp
new file mode 100644
index 000000000..68f4a21fd
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_MpcSv8.cpp
@@ -0,0 +1,253 @@
+// File_MpcSv8 - Info for Musepack (SV8) files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Source: http://trac.musepack.net/trac/wiki/SV8Specification
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_Info(_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_Info(((float32)((int16s)TitleGain))/1000, 2, " dB");
+ Skip_L2( "Title peak");
+ Get_L2 (AlbumGain, "Album gain"); Param_Info(((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_Info(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_Resolution, 16); //MPC support only 16 bits
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_MpcSv8::SO()
+{
+ //Parsing
+ Skip_VS( "Offset");
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_MPCSV8_YES
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_MpcSv8.h b/src/thirdparty/MediaInfo/Audio/File_MpcSv8.h
new file mode 100644
index 000000000..90f9d85b9
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_MpcSv8.h
@@ -0,0 +1,77 @@
+// File_MpcSv8 - Info for Musepack (SV8) files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Musepack files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_MpcSv8H
+#define MediaInfo_File_MpcSv8H
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#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
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Mpeg4_AudioSpecificConfig.cpp b/src/thirdparty/MediaInfo/Audio/File_Mpeg4_AudioSpecificConfig.cpp
new file mode 100644
index 000000000..72dcf8e64
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Mpeg4_AudioSpecificConfig.cpp
@@ -0,0 +1,773 @@
+// File_Aac - Info for AAC files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_MPEG4_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Audio/File_Mpeg4_AudioSpecificConfig.h"
+#if defined(MEDIAINFO_RIFF_YES)
+ #include "MediaInfo/Multiple/File_Riff.h"
+#endif
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Infos
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+const int32u MP4_SamplingRate[]=
+{96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050,
+ 16000, 12000, 11025, 8000, 7350, 0, 0, 0,};
+
+//---------------------------------------------------------------------------
+const char* MP4_ID[]=
+{
+ "MPEG-4",
+ "MPEG-2",
+};
+
+//---------------------------------------------------------------------------
+const char* MP4_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 : 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 char* MP4_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";
+ default : return "";
+ }
+}
+
+//---------------------------------------------------------------------------
+const char* MP4_Profile(int8u ID)
+{
+ switch (ID)
+ {
+ case 1 : return "A_AAC/MPEG4/MAIN";
+ case 2 : return "A_AAC/MPEG4/LC";
+ case 3 : return "A_AAC/MPEG4/SSR";
+ case 4 : return "A_AAC/MPEG4/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 MP4_Channels[]=
+{
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 8,
+};
+
+//---------------------------------------------------------------------------
+const char* MP4_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* MP4_ChannelConfiguration2[]=
+{
+ "",
+ "1/0/0",
+ "2/0/0",
+ "3/0/0",
+ "3/1/0",
+ "3/2/0",
+ "3/2/0.1",
+ "3/2/2.1",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+};
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Mpeg4_AudioSpecificConfig::File_Mpeg4_AudioSpecificConfig()
+:File__Analyze()
+{
+ //In
+ Channels_AreTrustable=false;
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+// AAC in ES, 2+ bytes
+void File_Mpeg4_AudioSpecificConfig::Read_Buffer_Continue()
+{
+ //Parsing
+ Element_Offset=0;
+ Element_Size=Buffer_Size;
+ int8u samplingFrequencyIndex;
+ BS_Begin();
+ Get_S1 (5, audioObjectType, "audioObjectType"); Param_Info(MP4_Profile(audioObjectType));
+ if (audioObjectType==31)
+ {
+ int8u audioObjectTypeExt;
+ Get_S1 (6, audioObjectTypeExt, "audioObjectTypeExt");
+ audioObjectType=32+audioObjectTypeExt; Param_Info(audioObjectType); Param_Info(MP4_Profile(audioObjectType));
+ }
+ if (audioObjectType==36)
+ {
+ ALS();
+ return;
+ }
+
+ Get_S1 (4, samplingFrequencyIndex, "samplingFrequencyIndex"); Param_Info(MP4_SamplingRate[samplingFrequencyIndex]);
+ if (samplingFrequencyIndex>=0xF)
+ {
+ Get_S3 (24, samplingFrequency, "samplingFrequency");
+ }
+ else
+ samplingFrequency=MP4_SamplingRate[samplingFrequencyIndex];
+ Get_S1 (4, channelConfiguration, "channelConfiguration"); Param_Info(MP4_ChannelConfiguration[channelConfiguration]);
+
+ sbrPresentFlag=false;
+ psPresentFlag=false;
+ if (audioObjectType==0x05 || audioObjectType==0x29)
+ {
+ extensionAudioObjectType=audioObjectType;
+ sbrPresentFlag=true;
+ if (audioObjectType==0x29)
+ psPresentFlag=false;
+ Get_S1 (4, samplingFrequencyIndex, "extensionSamplingFrequencyIndex"); Param_Info(MP4_SamplingRate[samplingFrequencyIndex]);
+ if (samplingFrequencyIndex==0xF)
+ {
+ Get_S3 (24, samplingFrequency, "extensionSamplingFrequency");
+ }
+ else
+ samplingFrequency=MP4_SamplingRate[samplingFrequencyIndex];
+ Get_S1 (5, audioObjectType, "audioObjectType"); Param_Info(MP4_Profile(audioObjectType));
+ if (audioObjectType==31)
+ {
+ int8u audioObjectTypeExt;
+ Get_S1 (6, audioObjectTypeExt, "audioObjectTypeExt");
+ audioObjectType=32+audioObjectTypeExt; Param_Info(MP4_Profile(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 32:
+ case 33:
+ case 34:
+ //MPEG_1_2_SpecificConfig();
+ break;
+ case 35:
+ //DSTSpecificConfig();
+ break;
+ default: ;
+ }
+
+ switch (audioObjectType)
+ {
+ case 17:
+ case 19:
+ case 20:
+ case 21:
+ case 22:
+ case 23:
+ case 24:
+ case 25:
+ case 26:
+ case 27:
+ {
+ int8u epConfig;
+ Get_S1 (2, epConfig, "epConfig");
+ if (epConfig==2 || epConfig==3)
+ {
+ //ErrorProtectionSpecificConfig();
+ }
+ if (epConfig==3)
+ {
+ bool directMapping;
+ Get_SB (directMapping, "directMapping");
+ if (directMapping)
+ {
+ //tbd
+ }
+ }
+ }
+ default : ;
+ }
+
+ bool sbrData=false;
+ if (extensionAudioObjectType!=0x05 && Data_BS_Remain()>=16)
+ {
+ sbrData=true;
+ SBR();
+ }
+
+ BS_End();
+
+ //Handling implicit SBR and PS
+ if (!Channels_AreTrustable) //if not channel map in the container
+ {
+ bool Is3GP=false;
+ for (size_t Pos=0; Pos<ftyps.size(); Pos++)
+ if ((ftyps[Pos]&0xFFFFFF00)==0x33677000)
+ Is3GP=true;
+ if (!Is3GP) //If this is not a 3GP file
+ {
+ if (!sbrPresentFlag && samplingFrequency<=24000)
+ {
+ samplingFrequency*=2;
+ sbrPresentFlag=true;
+ }
+ if ((!sbrData || sbrPresentFlag) && !psPresentFlag && channelConfiguration<=1) //1 channel
+ psPresentFlag=true;
+ }
+ }
+
+ FILLING_BEGIN()
+ Accept("AudioSpecificConfig");
+
+ if (Count_Get(Stream_Audio)==0) //May be done elsewhere
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format, MP4_Format(audioObjectType));
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format_Version, "Version 4");
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format_Profile, MP4_Format_Profile(audioObjectType));
+ if (audioObjectType==2) //LC
+ {
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings_SBR, "No");
+ if (Channels_AreTrustable && !psPresentFlag && channelConfiguration<=1)
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings_PS, "No");
+ }
+ if (!sbrPresentFlag && !psPresentFlag)
+ Fill(Stream_Audio, StreamPos_Last, Audio_Codec, MP4_Profile(audioObjectType));
+ Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, samplingFrequency);
+ if (channelConfiguration && channelConfiguration<8)
+ {
+ Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, MP4_Channels[channelConfiguration]);
+ Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions, MP4_ChannelConfiguration[channelConfiguration]);
+ Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions_String2, MP4_ChannelConfiguration2[channelConfiguration]);
+ }
+
+ if (sbrPresentFlag)
+ {
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings, "SBR");
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings_SBR, "Yes", Unlimited, true, true);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings_PS, "No");
+ Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Ztring().From_Local(MP4_Profile(audioObjectType))+_T("/SBR"), true);
+ Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, samplingFrequency, 10, true);
+ }
+ if (psPresentFlag)
+ {
+ Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, 2, 10, true);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings, "PS");
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format_Settings_PS, "Yes", Unlimited, true, true);
+ Ztring Codec=Retrieve(Stream_Audio, StreamPos_Last, Audio_Codec);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Ztring().From_Local(MP4_Profile(audioObjectType))+(sbrPresentFlag?_T("/SBR"):_T(""))+_T("/PS"), true);
+ Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions, "Front: L R", Unlimited, true, true);
+ }
+ }
+
+ Finish("AudioSpecificConfig");
+}
+
+//---------------------------------------------------------------------------
+// GASpecificConfig
+void File_Mpeg4_AudioSpecificConfig::GASpecificConfig ()
+{
+ Element_Begin("GASpecificConfig");
+ bool dependsOnCoreCoder, extensionFlag;
+ Info_SB( frameLengthFlag, "frameLengthFlag"); Param_Info(frameLengthFlag==0?1024:960, " bytes");
+ Get_SB ( dependsOnCoreCoder, "dependsOnCoreCoder");
+ if (dependsOnCoreCoder)
+ Skip_S2(14, "coreCoderDelay");
+ Get_SB ( extensionFlag, "extensionFlag");
+ if (channelConfiguration==0)
+ {
+ Element_Begin("Extension");
+ 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;
+ Skip_S1(4, "element_instance_tag");
+ Skip_S1(2, "object_type");
+ Skip_S1(4, "sampling_frequency_index"); //Not used, is often 0
+ 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();
+ for (int8u Pos=0; Pos<num_front_channel_elements; Pos++)
+ {
+ Element_Begin("Front channel");
+ bool front_element_is_cpe;
+ Get_SB ( front_element_is_cpe, "front_element_is_cpe");
+ Skip_S1(4, "front_element_tag_select");
+ if (front_element_is_cpe)
+ {
+ Channels_Front+=2;
+ Channels+=2;
+ }
+ else
+ {
+ Channels_Front++;
+ Channels++;
+ }
+ Element_End();
+ }
+ for (int8u Pos=0; Pos<num_side_channel_elements; Pos++)
+ {
+ Element_Begin("Side channel");
+ bool side_element_is_cpe;
+ Get_SB ( side_element_is_cpe, "side_element_is_cpe");
+ Skip_S1(4, "side_element_tag_select");
+ if (side_element_is_cpe)
+ {
+ Channels_Side+=2;
+ Channels+=2;
+ }
+ else
+ {
+ Channels_Side++;
+ Channels++;
+ }
+ Element_End();
+ }
+ for (int8u Pos=0; Pos<num_back_channel_elements; Pos++)
+ {
+ Element_Begin("Back channel");
+ bool back_element_is_cpe;
+ Get_SB ( back_element_is_cpe, "back_element_is_cpe");
+ Skip_S1(4, "back_element_tag_select");
+ if (back_element_is_cpe)
+ {
+ Channels_Back+=2;
+ Channels+=2;
+ }
+ else
+ {
+ Channels_Back++;
+ Channels++;
+ }
+ Element_End();
+ }
+ for (int8u Pos=0; Pos<num_lfe_channel_elements; Pos++)
+ {
+ Element_Begin("LFE");
+ Skip_S1(4, "lfe_element_tag_select");
+ Channels_LFE++;
+ Channels++;
+ Element_End();
+ }
+ for (int8u Pos=0; Pos<num_assoc_data_elements; Pos++)
+ {
+ Element_Begin("assoc_data_element");
+ Skip_S1(4, "assoc_data_element_tag_select");
+ Element_End();
+ }
+ for (int8u Pos=0; Pos<num_valid_cc_elements; Pos++)
+ {
+ Element_Begin("valid_cc_element");
+ Skip_SB( "cc_element_is_ind_sw");
+ Skip_S1(4, "valid_cc_element_tag_select");
+ Element_End();
+ }
+ BS_End(); //Byte align
+ Get_B1 (comment_field_bytes, "comment_field_bytes");
+ if (comment_field_bytes)
+ Skip_XX(comment_field_bytes, "comment_field_data");
+ BS_Begin(); //The stream needs continuity in the bitstream
+ Element_End();
+
+ //Filling
+ Ztring Channels_Positions, Channels_Positions2;
+ switch (Channels_Front)
+ {
+ case 0 : break;
+ case 1 : Channels_Positions+=_T("Front: C"); break;
+ case 2 : Channels_Positions+=_T("Front: L R"); break;
+ case 3 : Channels_Positions+=_T("Front: L C R"); break;
+ default : Channels_Positions+=_T("Front: "); Channels_Positions+=Ztring::ToZtring(Channels_Front); //Which config?
+ }
+ switch (Channels_Side)
+ {
+ case 0 : break;
+ case 1 : Channels_Positions+=_T(", Side: C"); break;
+ case 2 : Channels_Positions+=_T(", Side: L R"); break;
+ case 3 : Channels_Positions+=_T(", Side: L C R"); break;
+ default : Channels_Positions+=_T(", Side: "); Channels_Positions+=Ztring::ToZtring(Channels_Side); //Which config?
+ }
+ switch (Channels_Back)
+ {
+ case 0 : break;
+ case 1 : Channels_Positions+=_T(", Back: C"); break;
+ case 2 : Channels_Positions+=_T(", Back: L R"); break;
+ case 3 : Channels_Positions+=_T(", Back: L C R"); break;
+ default : Channels_Positions+=_T(", Back: "); Channels_Positions+=Ztring::ToZtring(Channels_Back); //Which config?
+ }
+ switch (Channels_LFE)
+ {
+ case 0 : break;
+ case 1 : Channels_Positions+=_T(", LFE"); break;
+ default : Channels_Positions+=_T(", LFE= "); Channels_Positions+=Ztring::ToZtring(Channels_LFE); //Which config?
+ }
+ Channels_Positions2=Ztring::ToZtring(Channels_Front)+_T('/')
+ +Ztring::ToZtring(Channels_Side)+_T('/')
+ +Ztring::ToZtring(Channels_Back)
+ +(Channels_LFE?_T(".1"):_T(""));
+
+ //Filling
+ Accept("AudioSpecificConfig");
+
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Channels_Front+Channels_Side+Channels_Back+Channels_LFE);
+ Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions, Channels_Positions);
+ Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions_String2, Channels_Positions2);
+ }
+ 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)
+ {
+ //TODO...
+ }
+ }
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+// AAC in ES, SBR part, 3+ bytes
+void File_Mpeg4_AudioSpecificConfig::SBR ()
+{
+ //Parsing
+ int16u syncExtensionType;
+ int8u samplingFrequencyIndex;
+ Element_Begin("SBR");
+ Get_S2 (11, syncExtensionType, "syncExtensionType");
+ if (syncExtensionType!=0x2B7)
+ {
+ Element_End();
+ return;
+ }
+ Get_S1 (5, extensionAudioObjectType, "extensionAudioObjectType");
+ if (extensionAudioObjectType==0x05)
+ {
+ Get_SB ( sbrPresentFlag, "sbrPresentFlag");
+ if (sbrPresentFlag)
+ {
+ Get_S1 (4, samplingFrequencyIndex, "extensionSamplingFrequencyIndex"); Param_Info(MP4_SamplingRate[samplingFrequencyIndex]);
+ if (samplingFrequencyIndex>=0xF)
+ {
+ Get_S3 (24, samplingFrequency, "extensionSamplingFrequency");
+ }
+ else
+ samplingFrequency=MP4_SamplingRate[samplingFrequencyIndex];
+ }
+ }
+ Element_End();
+
+ //PS stuff
+ if (Data_Remain())
+ PS();
+}
+
+//---------------------------------------------------------------------------
+// AAC in ES, PS part, 2 bytes
+// Format is unknown
+void File_Mpeg4_AudioSpecificConfig::PS ()
+{
+ //Parsing
+ Element_Begin("PS");
+ int16u syncExtensionType;
+ Get_S2 (11, syncExtensionType, "syncExtensionType");
+ if (syncExtensionType!=0x548)
+ {
+ Element_End();
+ return;
+ }
+ Get_SB (psPresentFlag, "psPresentFlag");
+ Element_End();
+
+ //BSAC stuff
+ //if (extensionAudioObjectType==22)
+ // BSAC();
+ //if ( extensionAudioObjectType == 22 ) {
+ // sbrPresentFlag;
+ // if (sbrPresentFlag == 1) {
+ // extensionSamplingFrequencyIndex;
+ // if ( extensionSamplingFrequencyIndex == 0xf )
+ // extensionSamplingFrequency;
+ // }
+ // extensionChannelConfiguration
+ //}
+}
+
+//---------------------------------------------------------------------------
+// ALS is detected
+// Format is unknown
+void File_Mpeg4_AudioSpecificConfig::ALS ()
+{
+ //Parsing
+ BS_End();
+
+ FILLING_BEGIN();
+ //Filling
+ Accept("AudioSpecificConfig");
+
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format, "ALS");
+ Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "ALS");
+ FILLING_END();
+
+ std::string Riff;
+ Riff.append((const char*)Buffer+Buffer_Offset, (size_t)(Element_Size-Element_Offset));
+ if (Riff.find("RIFF") && Riff.find("WAVEfmt"))
+ {
+ #if defined(MEDIAINFO_RIFF_YES)
+ //Creating the parser
+ File_Riff MI;
+ Open_Buffer_Init(&MI);
+
+ //Parsing
+ size_t Riff_Pos=Riff.find("RIFF");
+ Skip_XX(Riff_Pos, "Unknown");
+ Open_Buffer_Continue(&MI);
+
+ //Filling
+ Finish(&MI);
+ Merge(MI, StreamKind_Last, 0, StreamPos_Last);
+
+ //The RIFF header is for PCM
+ Clear(Stream_Audio, StreamPos_Last, Audio_ID);
+ Clear(Stream_Audio, StreamPos_Last, Audio_Codec_String);
+ Clear(Stream_Audio, StreamPos_Last, Audio_Codec_Family);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format, "ALS", Unlimited, true, true);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "ALS", Unlimited, true, true);
+ Clear(Stream_Audio, StreamPos_Last, Audio_CodecID);
+ Clear(Stream_Audio, StreamPos_Last, Audio_CodecID_Hint);
+ Clear(Stream_Audio, StreamPos_Last, Audio_CodecID_Url);
+ Clear(Stream_Audio, StreamPos_Last, Audio_BitRate);
+ Clear(Stream_Audio, StreamPos_Last, Audio_BitRate_Mode);
+ Clear(Stream_Audio, StreamPos_Last, Audio_Codec_CC);
+
+ #else
+ Skip_XX(Element_Size-Element_Offset, "(RIFF chunck)");
+ #endif
+
+ }
+ else
+ Skip_XX(Element_Size-Element_Offset, "Unknown");
+
+ //No need more
+ Finish("AudioSpecificConfig");
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_MPEG4_YES
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Mpeg4_AudioSpecificConfig.h b/src/thirdparty/MediaInfo/Audio/File_Mpeg4_AudioSpecificConfig.h
new file mode 100644
index 000000000..49a218d9d
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Mpeg4_AudioSpecificConfig.h
@@ -0,0 +1,68 @@
+// File_Aac - Info for AAC Audio files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_Mpeg4_AudioSpecificConfigH
+#define MediaInfo_File_Mpeg4_AudioSpecificConfigH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Mpeg4_AudioSpecificConfig
+//***************************************************************************
+
+class File_Mpeg4_AudioSpecificConfig : public File__Analyze
+{
+public :
+ //In
+ std::vector<int32u> ftyps;
+ bool Channels_AreTrustable;
+
+public :
+ //Constructor/Destructor
+ File_Mpeg4_AudioSpecificConfig();
+
+private :
+ //Buffer - Global
+ void Read_Buffer_Continue ();
+
+ //Elements
+ void GASpecificConfig();
+ void SBR();
+ void PS();
+ void ALS();
+
+ //Temp
+ int32u samplingFrequency;
+ int8u channelConfiguration;
+ int8u audioObjectType;
+ int8u extensionAudioObjectType;
+ bool sbrPresentFlag;
+ bool psPresentFlag;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Audio/File_Mpega.cpp b/src/thirdparty/MediaInfo/Audio/File_Mpega.cpp
new file mode 100644
index 000000000..bfa114195
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Mpega.cpp
@@ -0,0 +1,1389 @@
+// File_Mpega - Info for MPEG Audio files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// A good start : http://www.codeproject.com/audio/MPEGAudioInfo.asp
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//***************************************************************************
+// 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"
+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;
+
+ //In
+ Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.5?128:(MediaInfoLib::Config.ParseSpeed_Get()>=0.3?32:2);
+ FrameIsAlwaysComplete=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;
+ Frame_Count=0;
+ Frame_Count_Consecutive=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;
+}
+
+//***************************************************************************
+// 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 (Buffer_TotalBytes_FirstSynched>10 && BitRate>0)
+ Fill(Stream_Audio, 0, Audio_Delay, Buffer_TotalBytes_FirstSynched*8*1000/BitRate, 0);
+ }
+
+ //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
+ if (VBR_Frames>0)
+ {
+ 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==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 (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_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);
+ if (Encoded_Library.empty())
+ Encoded_Library_Guess();
+ Fill(Stream_Audio, 0, Audio_Encoded_Library, Encoded_Library);
+ Fill(Stream_Audio, 0, Audio_Encoded_Library_Settings, Encoded_Library_Settings);
+
+ //Surround
+ if (Surround_Frames>=Frame_Count*0.9)
+ {
+ //Fill(Stream_Audio, 0, Audio_Channel_s_, 6);
+ }
+
+ File__Tags_Helper::Streams_Finish();
+}
+
+//***************************************************************************
+// Buffer - File header
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Mpega::FileHeader_Begin()
+{
+ //Buffer size
+ if (Buffer_Size<4)
+ return File_Size<4; //Must wait for more data
+
+ //Detecting WAV/SWF/FLV/ELF/DPG/WM/MZ 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)
+ {
+ 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 ((CC2(Buffer+Buffer_Offset+0)&0xFFE0)==0xFFE0 && (CC1(Buffer+Buffer_Offset+2)&0xF0)!=0xF0 && (CC1(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;
+
+ 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)
+ {
+ 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)
+ Buffer_Offset++;
+ else
+ {
+ //Retrieving some info
+ int8u ID1 =(CC1(Buffer+Buffer_Offset+Size0+1)>>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)
+ {
+ 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
+ break; //while()
+ }
+ else
+ break; //while()
+ }
+ }
+ }
+ else
+ break; //while()
+ }
+ }
+ }
+
+ //Parsing last bytes if needed
+ if (Buffer_Offset+4>Buffer_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;
+
+ //Must have enough buffer for having header
+ if (Buffer_Offset+3>Buffer_Size)
+ return false;
+
+ //Quick test of synchro
+ if ((CC2(Buffer+Buffer_Offset)&0xFFE0)!=0xFFE0 || (CC1(Buffer+Buffer_Offset+2)&0xF0)==0xF0 || (CC1(Buffer+Buffer_Offset+2)&0x0C)==0x0C)
+ {
+ Frame_Count_Consecutive=0; //Reset the frame count, we try to find x consecutive frames
+ Synched=false;
+ }
+
+ //We continue
+ return true;
+}
+
+//***************************************************************************
+// Buffer - Per element
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Mpega::Header_Parse()
+{
+ //Parsing
+ BS_Begin();
+ Skip_S2(11, "syncword");
+ Get_S1 (2, ID, "ID"); Param_Info(Mpega_Version[ID]);
+ Get_S1 (2, layer, "layer"); Param_Info(Mpega_Layer[layer]);
+ Get_SB ( protection_bit, "protection_bit");
+ Get_S1 (4, bitrate_index, "bitrate_index"); Param_Info(Mpega_BitRate[ID][layer][bitrate_index], " Kbps");
+ Get_S1 (2, sampling_frequency, "sampling_frequency"); Param_Info(Mpega_SamplingRate[ID][sampling_frequency], " Hz");
+ Get_SB ( padding_bit, "padding_bit");
+ Skip_SB( "private_bit");
+ Get_S1 (2, mode, "mode"); Param_Info(Mpega_Channels[mode], " channels"); Param_Info(Mpega_Codec_Profile[mode]);
+ Get_S1 (2, mode_extension, "mode_extension"); Param_Info(Mpega_Codec_Profile_Extension[mode_extension]);
+ Get_SB ( copyright, "copyright");
+ Get_SB ( original_home, "original_home");
+ Get_S1 (2, emphasis, "emphasis"); Param_Info(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];
+ Header_Fill_Size(Size);
+ Header_Fill_Code(0, "audio_data");
+
+ //Filling error detection
+ sampling_frequency_Count[sampling_frequency]++;
+ mode_Count[mode]++;
+
+ FILLING_BEGIN();
+ FILLING_END();
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Mpega::Data_Parse()
+{
+ //If false start
+ if (Element_Size==0)
+ {
+ Element_DoNotShow();
+ return;
+ }
+
+ //PTS
+ if (PTS!=(int64u)-1)
+ {
+ Element_Info(_T("PTS ")+Ztring().Duration_From_Milliseconds(float64_int64s(((float64)PTS+PTS_DTS_Offset_InThisBlock)/1000000)));
+ int64u BitRate=Mpega_BitRate[ID][layer][bitrate_index]*1000;
+ int64u Bits=Element_Size*8;
+ float64 Frame_Duration=((float64)Bits)/BitRate;
+ PTS_DTS_Offset_InThisBlock+=float64_int64s(Frame_Duration*1000000000);
+ }
+
+ //Name
+ Element_Info(_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_Consecutive; //Finish MPEG Audio frames in case of there are less than Frame_Count_Valid frames
+ Frame_Count++;
+ Frame_Count_Consecutive++;
+
+ //LAME
+ if (Encoded_Library.empty() && (Frame_Count_Consecutive<Frame_Count_Valid || File_Offset+Buffer_Offset+Element_Size==File_Size-File_EndTagSize)) //Can be elsewhere... At the start, or end frame
+ Header_Encoders();
+
+ //Filling
+ BitRate_Count[Mpega_BitRate[ID][layer][bitrate_index]]++;
+ Channels_Count[mode]++;
+ Extension_Count[mode_extension]++;
+ Emphasis_Count[emphasis]++;
+
+ //Parsing
+ int16u main_data_end;
+ if (protection_bit)
+ Skip_B2( "crc_check");
+ 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_Begin("scfsi");
+ for(int8u ch=0; ch<Mpega_Channels[mode]; ch++)
+ for(int8u scfsi_band=0; scfsi_band<4; scfsi_band++)
+ {
+ bool scfsi;
+ Get_SB ( scfsi, "scfsi");
+ if (scfsi)
+ Scfsi++;
+ }
+ Element_End();
+ }
+ for(int8u gr=0; gr<(ID==3?2:1); gr++)
+ {
+ Element_Begin("granule");
+ if (mode>=4)
+ return;
+ for(int8u ch=0; ch<Mpega_Channels[mode]; ch++)
+ {
+ Element_Begin("channel");
+ Skip_S2(12, "part2_3_length");
+ Skip_S2(9, "big_values");
+ Skip_S1(8, "global_gain");
+ if (ID==3) //MPEG-1
+ Skip_S1(4, "scalefac_compress");
+ else
+ Skip_S2(9, "scalefac_compress");
+ bool blocksplit_flag;
+ Get_SB ( blocksplit_flag, "blocksplit_flag");
+ if (blocksplit_flag==1)
+ {
+ int8u block_type;
+ bool mixed_block_flag;
+ Get_S1 (2, block_type, "block_type");
+ Get_SB ( mixed_block_flag, "mixed_block_flag");
+ for (int8u region=0; region<2; region++)
+ Skip_S1(5, "table_select");
+ for (int8u window=0; window<3; window++)
+ Skip_S1(3, "subblock_gain");
+ if (block_type == 2)
+ {
+ if (mixed_block_flag==1)
+ {
+ Param_Info("Mixed");
+ Block_Count[2]++; //Mixed
+ }
+ else
+ {
+ Param_Info("Short");
+ Block_Count[1]++; //Short
+ }
+ }
+ else
+ {
+ Param_Info("Long");
+ Block_Count[0]++; //Long
+ }
+ }
+ else
+ {
+ for (int8u region=0; region<3; region++)
+ Skip_S1(5, "table_select");
+ Skip_S1(4, "region0_count");
+ Skip_S1(3, "region1_count");
+ Param_Info("Long");
+ Block_Count[0]++; //Long
+ }
+ if (ID==3) //MPEG-1
+ Skip_SB( "preflag");
+ bool scalefac;
+ Get_SB ( scalefac, "scalefac_scale");
+ if (scalefac)
+ Scalefac++;
+ Skip_SB( "count1table_select");
+ Element_End();
+ } //channels
+ Element_End();
+ } //granules
+ BS_End();
+
+ //MP3 Surround detection
+ for (int64u Element_Offset_S=Element_Offset; Element_Offset_S+4<Element_Size; Element_Offset_S++)
+ {
+ if ( Buffer[(size_t)(Buffer_Offset+Element_Offset_S )] ==0xCF
+ && (Buffer[(size_t)(Buffer_Offset+Element_Offset_S+1)]&0xF0)==0x30) //12 bits, 0xCF3x
+ {
+ int8u Surround_Size=((Buffer[(size_t)(Buffer_Offset+Element_Offset_S+1)]&0x0F)<<4)
+ | ((Buffer[(size_t)(Buffer_Offset+Element_Offset_S+2)]&0xF0)>>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<Surround_Size-4; Surround_Pos++)
+ CRC12_Calculated=0x0FFF & (((CRC12_Calculated<<8)&0xff00)^Mpega_CRC12_Table[((CRC12_Calculated>>4) ^ *Data++) & 0xff]);
+ if (CRC12_Calculated!=CRC12)
+ break;
+
+ //Parsing
+ Skip_XX(Element_Offset_S-Element_Offset, "data");
+ BS_Begin();
+ Element_Begin("Surround");
+ Skip_S2(12, "Sync");
+ Skip_S1( 8, "Size");
+ Skip_S2(12, "CRC12");
+ BS_End();
+ Skip_XX(Surround_Size-4, "data");
+ Element_End();
+
+ //Filling
+ Surround_Frames++;
+ break;
+ }
+ }
+
+ if (Element_Offset<Element_Size)
+ Skip_XX(Element_Size-Element_Offset, "data");
+
+ FILLING_BEGIN();
+ //Filling
+ LastSync_Offset=File_Offset+Buffer_Offset+Element_Size;
+ if (IsSub && BitRate_Count.size()>1 && !Encoded_Library.empty())
+ Frame_Count_Valid=Frame_Count_Consecutive;
+ if (!Status[IsAccepted] && Frame_Count_Consecutive>=Frame_Count_Valid/4)
+ File__Tags_Helper::Accept("MPEG Audio");
+ if (!Status[IsFilled] && Frame_Count_Consecutive>=Frame_Count_Valid)
+ {
+ Fill("MPEG Audio");
+
+ //Jumping
+ File__Tags_Helper::GoToFromEnd(16*1024, "MPEG-A");
+ LastSync_Offset=(int64u)-1;
+ }
+
+ //Detect Id3v1 tags inside a frame
+ if (!IsSub && File_Offset+Buffer_Offset+(size_t)Element_Size>File_Size-File_EndTagSize)
+ File__Analyze::Data_GoTo(File_Size-File_EndTagSize, "Tags inside a frame, parsing the tags");
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpega::Data_Parse_Fill()
+{
+}
+
+//---------------------------------------------------------------------------
+bool File_Mpega::Header_Xing()
+{
+ int32u Xing_Header_Offset;
+ if (ID==3) //MPEG-1
+ if (mode==3) //Mono
+ Xing_Header_Offset=21-4;
+ else
+ Xing_Header_Offset=36-4;
+ else //MPEG-2 or 2.5
+ if (mode==3) //Mono
+ Xing_Header_Offset=13-4;
+ else
+ Xing_Header_Offset=21-4;
+ if (Buffer_Offset+Xing_Header_Offset+128<Buffer_Size)
+ {
+ const int8u* Xing_Header=Buffer+Buffer_Offset+Xing_Header_Offset;
+ if (CC4(Xing_Header)==CC4("Xing") || CC4(Xing_Header)==CC4("Info"))
+ {
+ //This is a "tag"
+ Element_Info("Tag (Xing)");
+
+ //Parsing
+ Element_Begin("Xing");
+ Element_Begin("Xing header");
+ Skip_XX(Xing_Header_Offset, "Junk");
+ int32u Flags;
+ bool FrameCount, FileSize, TOC, Scale, Lame;
+ Skip_C4( "Xing");
+ Get_B4 (Flags, "Flags");
+ Get_Flags(Flags, 0, FrameCount, "FrameCount");
+ Get_Flags(Flags, 1, FileSize, "FileSize");
+ Get_Flags(Flags, 2, TOC, "TOC");
+ Get_Flags(Flags, 3, Scale, "Scale");
+ Get_Flags(Flags, 4, Lame, "Lame");
+ int32u Xing_Header_Size=8
+ +(FrameCount? 4:0) //FrameCount
+ +(FileSize? 4:0) //FileSize
+ +(TOC? 100:0) //TOC
+ +(Scale? 4:0) //Scale
+ +(Lame? 348:0); //Lame
+ Element_End();
+ //Element size
+ if (Xing_Header_Size>Element_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_End();
+ Peek_Local(4, Lib);
+ if (Lame || Lib==_T("LAME") || Lib==_T("GOGO"))
+ 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<Buffer_Size)
+ {
+ const int8u* Fraunhofer_Header=Buffer+Buffer_Offset+Fraunhofer_Header_Offset;
+ if (CC4(Fraunhofer_Header)==CC4("VBRI") && CC2(Fraunhofer_Header+4)==0x0001) //VBRI v1 only
+ {
+ //This is a "tag"
+
+ Element_Info("Tag (VBRI)");
+
+ //Parsing
+ int32u VBR_FileSize_Temp;
+ int16u TableSize, TableScale, EntryBytes;
+ Skip_XX(Fraunhofer_Header_Offset, "Junk");
+ Element_Begin("VBRI");
+ Skip_C4( "Sync");
+ Skip_B2( "Version");
+ Skip_B2( "Delay");
+ Skip_B2( "Quality");
+ Get_B4 (VBR_FileSize_Temp, "StreamBytes");
+ Get_B4 (VBR_Frames, "StreamFrames"); //Multiplied by SamplesPerFrame (1152 for >=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_Begin("Table");
+ for (int16u Pos=0; Pos<TableSize; Pos++)
+ {
+ switch (EntryBytes)
+ {
+ case 1 : {Info_B1(Entry, "Entry"); Param_Info (Entry*TableScale, " bytes");} break;
+ case 2 : {Info_B2(Entry, "Entry"); Param_Info (Entry*TableScale, " bytes");} break;
+ case 4 : {Info_B4(Entry, "Entry"); Param_Info (Entry*TableScale, " bytes");} break;
+ default: Skip_XX(EntryBytes, "Entry");
+ }
+ }
+ Element_End();
+ Element_End();
+ VBR_FileSize=VBR_FileSize_Temp;
+
+ //Clearing Error detection
+ sampling_frequency_Count.clear();
+ mode_Count.clear();
+
+ return true;
+ }
+ }
+ return false;
+}
+
+//---------------------------------------------------------------------------
+bool File_Mpega::Header_Encoders()
+{
+ std::string BufferS((const char*)(Buffer+Buffer_Offset), (size_t)Element_Size);
+ size_t Buffer_Pos;
+
+ //Lame
+ Buffer_Pos=BufferS.find("LAME");
+ if (Buffer_Pos!=std::string::npos && Buffer_Pos<=Element_Size-8)
+ {
+ Element_Info("With tag (Lame)");
+ Element_Offset=Buffer_Pos;
+ if (Element_Offset+20<=Element_Size)
+ Get_Local(20, Encoded_Library, "Encoded_Library");
+ else
+ Get_Local( 8, Encoded_Library, "Encoded_Library");
+ Encoded_Library.Trim(_T('A'));
+ Encoded_Library.Trim(_T('U'));
+ Encoded_Library.Trim(_T('\xAA'));
+ Element_Offset=0; //Reseting it
+ return true;
+ }
+
+ //RCA
+ Buffer_Pos=BufferS.find("RCA mp3PRO Encoder");
+ if (Buffer_Pos!=std::string::npos && Buffer_Pos<Element_Size-23)
+ {
+ Element_Info("With tag (RCA)");
+ Encoded_Library="RCA ";
+ Encoded_Library+=Ztring((const char*)(Buffer+Buffer_Offset+18), 5);
+ return true;
+ }
+
+ //Thomson
+ Buffer_Pos=BufferS.find("THOMSON mp3PRO Encoder");
+ if (Buffer_Pos!=std::string::npos && Buffer_Pos<Element_Size-29)
+ {
+ Element_Info("With tag (Thomson)");
+ Encoded_Library="Thomson ";
+ Encoded_Library+=Ztring((const char*)(Buffer+Buffer_Offset+22), 6);
+ return true;
+ }
+
+ //Gogo (old)
+ Buffer_Pos=BufferS.find("MPGE");
+ if (Buffer_Pos!=std::string::npos)
+ {
+ Element_Info("With tag (Gogo)");
+ Encoded_Library="Gogo <3.0";
+ return true;
+ }
+
+ //Gogo (new)
+ Buffer_Pos=BufferS.find("GOGO");
+ if (Buffer_Pos!=std::string::npos)
+ {
+ Element_Info("With tag (Gogo)");
+ Encoded_Library="Gogo >=3.0";
+ return true;
+ }
+
+ return false;
+}
+
+void File_Mpega::Header_Encoders_Lame()
+{
+ Peek_Local(8, Encoded_Library);
+ if (Encoded_Library>=_T("LAME3.90") && Element_IsNotFinished())
+ {
+ int8u Flags, EncodingFlags, BitRate, StereoMode;
+ Param_Info(Ztring(_T("V "))+Ztring::ToZtring((100-Xing_Scale)/10));
+ Param_Info(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_Info(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;
+ }
+ Info_B1(lowpass, "Lowpass filter value"); Param_Info(lowpass*100, " Hz");
+ Skip_B4( "Peak signal amplitude");
+ Skip_B2( "Radio Replay Gain");
+ Skip_B2( "Audiophile Replay Gain");
+ Get_B1 (EncodingFlags, "Encoding Flags"); Param_Info(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
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Mpega.h b/src/thirdparty/MediaInfo/Audio/File_Mpega.h
new file mode 100644
index 000000000..c2327ea28
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Mpega.h
@@ -0,0 +1,115 @@
+// File_Mpega - Info for MPEG Audio files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_MpegaH
+#define MediaInfo_File_MpegaH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include "MediaInfo/Tag/File__Tags.h"
+#include <map>
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Mpega
+//***************************************************************************
+
+class File_Mpega : public File__Analyze, public File__Tags_Helper
+{
+public :
+ //In
+ size_t Frame_Count_Valid;
+ bool FrameIsAlwaysComplete;
+
+ //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 - Per element
+ void Header_Parse();
+ void Data_Parse();
+ void Data_Parse_Fill();
+
+ //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<int16u, size_t> BitRate_Count;
+ std::map<int8u, size_t> sampling_frequency_Count;
+ std::map<int8u, size_t> 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 Frame_Count;
+ size_t Frame_Count_Consecutive;
+ 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;
+
+ //Helpers
+ bool Element_Name_IsOK();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Audio/File_Pcm.cpp b/src/thirdparty/MediaInfo/Audio/File_Pcm.cpp
new file mode 100644
index 000000000..79ffb1f91
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Pcm.cpp
@@ -0,0 +1,375 @@
+// File_Pcm - Info for PCM files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_PCM_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Audio/File_Pcm.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Infos
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+int32u Pcm_VOB_Frequency[]=
+{
+ 48000,
+ 32000,
+ 0,
+ 0,
+};
+
+//---------------------------------------------------------------------------
+const char* Pcm_VOB_ChannelsPositions(int8u NumberOfChannels)
+{
+ switch (NumberOfChannels)
+ {
+ case 1 : return "Front: C"; //1 channel
+ case 2 : return "Front: L R"; //2 channels
+ case 3 : return "Front: L R, LFE"; //3 channels (not sure)
+ case 4 : return "Front: L R, Side: L R"; //4 channels
+ case 5 : return "Front: L R, Side: L R, LFE"; //5 channels (not sure)
+ case 6 : return "Front: L C R, Side: L R, LFE"; //6 channels
+ case 7 : return "Front: L C R, Side: L R, Back: L R"; //7 channels
+ case 8 : return "Front: L C R, Side: L R, Back: L R, LFE"; //8 channels
+ default : return "";
+ }
+}
+
+//---------------------------------------------------------------------------
+const char* Pcm_VOB_ChannelsPositions2(int8u NumberOfChannels)
+{
+ switch (NumberOfChannels)
+ {
+ case 1 : return "1/0/0.0"; //1 channel
+ case 2 : return "2/0/0.0"; //2 channels
+ case 3 : return "3/0/0.1"; //3 channels (not sure)
+ case 4 : return "3/0/0.1"; //4 channels
+ case 5 : return "3/1/0.1"; //5 channels (not sure)
+ case 6 : return "3/2/0.1"; //6 channels
+ case 7 : return "3/2/1.1"; //7 channels
+ case 8 : return "3/2/2.1"; //8 channels
+ default : return "";
+ }
+}
+
+//---------------------------------------------------------------------------
+int32u Pcm_M2TS_Frequency[]=
+{
+ 0,
+ 48000,
+ 0,
+ 0,
+ 96000,
+ 192000,
+ 0,
+ 0,
+};
+
+//---------------------------------------------------------------------------
+int32u Pcm_M2TS_Resolution[]=
+{
+ 0,
+ 16,
+ 20,
+ 24,
+};
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Pcm::File_Pcm()
+{
+ //In
+ BitDepth=0;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Pcm::Streams_Fill()
+{
+ //Filling
+ Ztring Firm, Endianness, Sign, ITU, Resolution;
+ if (0)
+ ;
+ else if (Codec==_T("EVOB")) {Firm=_T(""); Endianness=_T("Big"); Sign=_T("Signed"); Resolution=_T("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
+ else if (Codec==_T("VOB")) {Firm=_T(""); Endianness=_T("Big"); Sign=_T("Signed"); Resolution=_T("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
+ else if (Codec==_T("M2TS")) {Firm=_T(""); Endianness=_T("Big"); Sign=_T("Signed");} //PCM Signed Big Endian
+ else if (Codec==_T("A_PCM/INT/BIG")) {Firm=_T(""); Endianness=_T("Big");}
+ else if (Codec==_T("A_PCM/INT/LITTLE")) {Firm=_T(""); Endianness=_T("Little");}
+ else if (Codec==_T("A_PCM/INT/FLOAT")) {Firm=_T(""); Endianness=_T("Float");}
+ else if (Codec==_T("fl32")) { Endianness=_T("Float"); Resolution=_T("32");}
+ else if (Codec==_T("fl64")) { Endianness=_T("Float"); Resolution=_T("64");}
+ else if (Codec==_T("in24")) { Endianness=_T("Big"); Sign=_T("Unsigned"); Resolution=_T("24");}
+ else if (Codec==_T("in32")) { Endianness=_T("Big"); Sign=_T("Unsigned"); Resolution=_T("32");}
+ else if (Codec==_T("raw ")) { Endianness=_T("Little"); Sign=_T("Unsigned");}
+ else if (Codec==_T("twos")) { Endianness=_T("Big"); Sign=_T("Signed");}
+ else if (Codec==_T("sowt")) { Endianness=_T("Little"); Sign=_T("Signed");}
+ else if (Codec==_T("SWF ADPCM")) {Firm=_T("SWF");}
+ else if (Codec==_T("1")) { if (BitDepth)
+ {
+ if (BitDepth>8)
+ { Endianness=_T("Little"); Sign=_T("Signed");}
+ else
+ { Sign=_T("Unsigned");}
+ }
+ }
+ else if (Codec==_T("2")) {Firm=_T("Microsoft");}
+ else if (Codec==_T("3")) { Endianness=_T("Float");}
+ 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");}
+
+ Fill(Stream_Audio, 0, Audio_Codec_String, "PCM");
+ Fill(Stream_Audio, 0, Audio_Codec_Family, "PCM");
+ 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);
+ }
+ if (!Endianness.empty())
+ {
+ Fill(Stream_Audio, 0, Audio_Format_Settings, Endianness);
+ Fill(Stream_Audio, 0, Audio_Format_Settings_Endianness, Endianness);
+ Fill(Stream_Audio, 0, Audio_Codec_Settings, Endianness);
+ Fill(Stream_Audio, 0, Audio_Codec_Settings_Endianness, Endianness);
+ }
+ if (!Sign.empty())
+ {
+ Fill(Stream_Audio, 0, Audio_Format_Settings, Sign);
+ Fill(Stream_Audio, 0, Audio_Format_Settings_Sign, Sign);
+ Fill(Stream_Audio, 0, Audio_Codec_Settings, Sign);
+ Fill(Stream_Audio, 0, Audio_Codec_Settings_Sign, Sign);
+ }
+ if (!ITU.empty())
+ {
+ 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);
+ }
+ if (!Resolution.empty())
+ Fill(Stream_Audio, 0, Audio_Resolution, Resolution);
+ Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR");
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Pcm::Read_Buffer_Continue()
+{
+ if (Codec!=_T("VOB")
+ && Codec!=_T("EVOB")
+ && Codec!=_T("M2TS")) //No need of data
+ {
+ //Filling
+ Accept("PCM");
+
+ if (Count_Get(Stream_Audio)==0)
+ {
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, 0, Audio_Format, "PCM");
+ Fill(Stream_Audio, 0, Audio_Codec, "PCM");
+ }
+
+ //Finished
+ Finish("PCM");
+ }
+}
+
+//***************************************************************************
+// Buffer - Per element
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Pcm::Header_Parse()
+{
+ //Filling
+ Header_Fill_Code(0, "Block");
+ Header_Fill_Size(Element_Size);
+}
+
+//---------------------------------------------------------------------------
+void File_Pcm::Data_Parse()
+{
+ //Parsing
+ if (Codec==_T("VOB") || Codec==_T("EVOB"))
+ VOB();
+ if (Codec==_T("M2TS"))
+ M2TS();
+ else
+ Skip_XX(Element_Size, "Data"); //It is impossible to detect... Default is no detection, only filling
+
+ Accept("PCM");
+ Finish("PCM");
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Pcm::VOB()
+{
+ //Parsing
+ int8u Frequency, NumberOfChannelsMinusOne;
+ Skip_B1( "Frame number");
+ Skip_B2( "Unknown");
+ BS_Begin();
+ Skip_S1(4, "Unknown");
+ Skip_S1(4, "Current frame");
+ Skip_S1(2, "Unknown");
+ Get_S1 (2, Frequency, "Frequency");
+ Skip_SB( "Unknown");
+ Get_S1 (3, NumberOfChannelsMinusOne, "Number of channels (minus 1)");
+ BS_End();
+ Skip_B1( "Start code");
+ Skip_XX(Element_Size-Element_Offset, "Data");
+
+ FILLING_BEGIN();
+ Accept("PCM");
+
+ if (Count_Get(Stream_Audio)==0)
+ {
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, 0, Audio_Format, "PCM");
+ Fill(Stream_Audio, 0, Audio_Codec, "PCM");
+ Fill(Stream_Audio, 0, Audio_MuxingMode, "DVD-Video");
+ 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);
+ }
+
+ Finish("PCM");
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Pcm::M2TS()
+{
+ //Parsing
+ int8u Unknown, Frequency, NumberOfChannels, Resolution;
+ Skip_B2( "Block size");
+ BS_Begin();
+ Get_S1 (2, Unknown, "Unknown");
+ if (Unknown==0)
+ {
+ Get_S1 (2, NumberOfChannels, "Number of channels (plus 1?)");
+ if (NumberOfChannels)
+ NumberOfChannels--;
+ }
+ else
+ {
+ Get_S1 (2, NumberOfChannels, "Number of channels (minus 5)");
+ NumberOfChannels+=5;
+ }
+ Get_S1 (4, Frequency, "Frequency");
+ Get_S1 (2, Resolution, "Resolution");
+ Skip_S1(6, "Unknown");
+ BS_End();
+ Skip_XX(Element_Size-Element_Offset, "Data");
+
+ FILLING_BEGIN();
+ Accept("PCM");
+
+ if (Count_Get(Stream_Audio)==0)
+ {
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, 0, Audio_Format, "PCM");
+ Fill(Stream_Audio, 0, Audio_Codec, "PCM");
+ Fill(Stream_Audio, 0, Audio_MuxingMode, "Blu-ray");
+ Fill(Stream_Audio, 0, Audio_SamplingRate, Pcm_M2TS_Frequency[Frequency]);
+ Fill(Stream_Audio, 0, Audio_Resolution, Pcm_M2TS_Resolution[Resolution]);
+ Fill(Stream_Audio, 0, Audio_Channel_s_, NumberOfChannels);
+ Fill(Stream_Audio, 0, Audio_ChannelPositions, Pcm_VOB_ChannelsPositions(NumberOfChannels));
+ Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, Pcm_VOB_ChannelsPositions2(NumberOfChannels));
+ if (NumberOfChannels%2)
+ NumberOfChannels++; //Always by pair
+ Fill(Stream_Audio, 0, Audio_BitRate, Pcm_M2TS_Frequency[Frequency]*(NumberOfChannels)*Pcm_M2TS_Resolution[Resolution]);
+ }
+
+ Finish("PCM");
+ FILLING_END();
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_PCM_YES
diff --git a/src/thirdparty/MediaInfo/Audio/File_Pcm.h b/src/thirdparty/MediaInfo/Audio/File_Pcm.h
new file mode 100644
index 000000000..1bf50d012
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Pcm.h
@@ -0,0 +1,68 @@
+// File_Pcm - Info for PCM files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
+ ZenLib::Ztring Codec;
+ int16u BitDepth;
+
+ //Constructor/Destructor
+ File_Pcm();
+
+private :
+ //Streams management
+ void Streams_Fill();
+
+ //Buffer - Global
+ void Read_Buffer_Continue ();
+
+ //Buffer - Per element
+ void Header_Parse();
+ void Data_Parse();
+
+ //Elements
+ void VOB();
+ void M2TS();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Audio/File_Ps2Audio.cpp b/src/thirdparty/MediaInfo/Audio/File_Ps2Audio.cpp
new file mode 100644
index 000000000..9f3a60598
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Ps2Audio.cpp
@@ -0,0 +1,131 @@
+// File_Ps2Audio - Info for PS2 Audio in MPEG files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_PS2A_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Audio/File_Ps2Audio.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Ps2Audio::Read_Buffer_Continue()
+{
+ //Parsing
+ while (Element_Offset<Element_Size)
+ {
+ int32u ID;
+ Peek_B4(ID);
+ switch (ID)
+ {
+ case 0x53536264 : SSbd(); break;
+ case 0x53536864 : SShd(); break;
+ default : Reject("PS2 Audio");
+ }
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Ps2Audio::SSbd()
+{
+ if (Count_Get(Stream_Audio)!=1)
+ {
+ Trusted_IsNot("Element should not be here");
+ return;
+ }
+
+ Element_Begin("SSbd (Body)");
+ int32u Size;
+ Skip_C4( "ID");
+ Get_L4 (Size, "Size");
+ Skip_XX(Element_Size-Element_Offset, "Data (Partial)");
+ Element_End();
+
+ FILLING_BEGIN();
+ Fill(Stream_Audio, 0, Audio_StreamSize, Size);
+ if (BitRate)
+ Fill(Stream_Audio, 0, Audio_Duration, ((int64u)Size)*1000*8/BitRate);
+
+ Finish("PS2 Audio");
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Ps2Audio::SShd()
+{
+ Element_Begin("SShd (Header)", 0x18);
+ //Parsing
+ int32u Size, Format, SamplingRate, Channels;
+ Skip_C4( "ID");
+ Get_L4 (Size, "Size");
+ if (Size!=0x18)
+ {
+ Trusted_IsNot("Bad size");
+ return;
+ }
+ Get_L4 (Format, "Format");
+ Get_L4 (SamplingRate, "Sampling rate");
+ Get_L4 (Channels, "Channels");
+ Skip_L4( "Bytes per channel");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ Element_End();
+
+ FILLING_BEGIN();
+ Accept("PS2 Audio");
+
+ BitRate=SamplingRate*Channels*16; //Always 16 bits
+
+ Stream_Prepare(Stream_Audio);
+ Ztring FormatS;
+ switch(Format)
+ {
+ case 0x00000001 : FormatS=_T("PCM"); break;
+ case 0x00000010 : FormatS=_T("ADPCM"); break;
+ default : ;
+ }
+ Fill(Stream_Audio, 0, Audio_Format, FormatS);
+ Fill(Stream_Audio, 0, Audio_Codec, FormatS);
+ Fill(Stream_Audio, 0, Audio_MuxingMode, "PS2");
+ Fill(Stream_Audio, 0, Audio_SamplingRate, SamplingRate);
+ Fill(Stream_Audio, 0, Audio_Channel_s_, Channels);
+ Fill(Stream_Audio, 0, Audio_BitRate, BitRate);
+ FILLING_END();
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_PS2A_YES
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Ps2Audio.h b/src/thirdparty/MediaInfo/Audio/File_Ps2Audio.h
new file mode 100644
index 000000000..04174e25d
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Ps2Audio.h
@@ -0,0 +1,52 @@
+// File_Ps2Audio - Info for PS2 Audio in MPEG files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_Ps2AudioH
+#define MediaInfo_Ps2AudioH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Ps2Audio
+//***************************************************************************
+
+class File_Ps2Audio : public File__Analyze
+{
+private :
+ //Buffer - Global
+ void Read_Buffer_Continue();
+
+ //Elements
+ void SSbd();
+ void SShd();
+
+ //Temp
+ int32u BitRate;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Audio/File_ScreamTracker3.cpp b/src/thirdparty/MediaInfo/Audio/File_ScreamTracker3.cpp
new file mode 100644
index 000000000..4a11b48a1
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_ScreamTracker3.cpp
@@ -0,0 +1,134 @@
+// File_ScreamTracker3 - Info for ScreamTracker3 files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WXMHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILXMY or FXMNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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
diff --git a/src/thirdparty/MediaInfo/Audio/File_ScreamTracker3.h b/src/thirdparty/MediaInfo/Audio/File_ScreamTracker3.h
new file mode 100644
index 000000000..2212d5acc
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_ScreamTracker3.h
@@ -0,0 +1,52 @@
+// File_ScreamTracker3 - Info for ScreamTracker3 files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WXMHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILXMY or FXMNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Audio/File_Speex.cpp b/src/thirdparty/MediaInfo/Audio/File_Speex.cpp
new file mode 100644
index 000000000..80447ea4b
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Speex.cpp
@@ -0,0 +1,161 @@
+// File_Speex - Info for Speex files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Note : the buffer must be given in ONE call
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_size<Element_Size)
+ Skip_XX(Element_Size-header_size, "Unknown");
+
+ //Filling
+ FILLING_BEGIN()
+ Accept("Speex");
+
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, 0, Audio_Format, "Speex");
+ Fill(Stream_Audio, 0, Audio_Codec, "Speex");
+ if (Speex_version_id==1)
+ {
+ if (!speex_version.empty())
+ Fill(Stream_Audio, 0, Audio_Encoded_Library, speex_version);
+ Fill(Stream_Audio, 0, Audio_SamplingRate, rate);
+ Fill(Stream_Audio, 0, Audio_Channel_s_, nb_channels);
+ if (bitrate!=(int32u)-1)
+ Fill(Stream_Audio, 0, Audio_BitRate, bitrate);
+ Fill(Stream_Audio, 0, Audio_BitRate_Mode, vbr?"VBR":"CBR");
+ }
+ FILLING_END();
+ }
+
+ //Filling
+ Identification_Done=true;
+}
+
+//---------------------------------------------------------------------------
+void File_Speex::Comment()
+{
+ Element_Name("Comment?");
+
+ while (Element_Offset<Element_Size)
+ {
+ Ztring value;
+ int32u size;
+ Get_L4(size, "size");
+ if (size)
+ Get_Local(size, value, "value");
+
+ //Filling
+ if (!value.empty())
+ Fill(Stream_Audio, 0, "Comment", value);
+ }
+
+ Finish("Speex");
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_SPEEX_YES
diff --git a/src/thirdparty/MediaInfo/Audio/File_Speex.h b/src/thirdparty/MediaInfo/Audio/File_Speex.h
new file mode 100644
index 000000000..18cb0718d
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Speex.h
@@ -0,0 +1,64 @@
+// File_Speex - Info for Speex files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Speex files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_SpeexH
+#define MediaInfo_File_SpeexH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Speex
+//***************************************************************************
+
+class File_Speex : public File__Analyze
+{
+public :
+ File_Speex();
+
+private :
+ //Buffer - Per element
+ void Header_Parse();
+ void Data_Parse();
+
+ //Elements
+ void Identification();
+ void Comment();
+
+ //Temp
+ int8u Identification_Done;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Audio/File_Tak.cpp b/src/thirdparty/MediaInfo/Audio/File_Tak.cpp
new file mode 100644
index 000000000..8c703b0d9
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Tak.cpp
@@ -0,0 +1,305 @@
+// File_Tak - Info for Tak files
+// Copyright (C) 2009-2009 Lionel Duchateau, kurtnoise@free.fr
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Specifications : http://linuxstb.cream.org/tak_format.html
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_TAK_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Audio/File_Tak.h"
+#if defined(MEDIAINFO_RIFF_YES)
+ #include "MediaInfo/Multiple/File_Riff.h"
+#endif
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Const
+//***************************************************************************
+
+namespace Elements
+{
+ const int16u ENDOFMETADATA =0x00;
+ const int16u STREAMINFO =0x01;
+ const int16u SEEKTABLE =0x02;
+ const int16u WAVEMETADATA =0x03;
+ const int16u ENCODERINFO =0x04;
+ const int16u PADDING =0x05;
+}
+
+//***************************************************************************
+// Const
+//***************************************************************************
+
+int8u Tak_samplesize[]=
+{
+ 8,
+ 16,
+ 24,
+ 0,
+};
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Tak::File_Tak()
+:File__Analyze(), File__Tags_Helper()
+{
+ //File__Tags_Helper
+ Base=this;
+}
+
+//***************************************************************************
+// Buffer - File header
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Tak::FileHeader_Begin()
+{
+ if (!File__Tags_Helper::FileHeader_Begin())
+ return false;
+
+ //Synchro
+ if (Buffer_Offset+4>Buffer_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_Info(#_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");
+ }
+}
+
+//***************************************************************************
+// 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_Info((((int64u)num_samples_hi)<<2 | num_samples_lo), " samples");
+ Get_L3 (samplerate, "samplerate"); Param_Info((samplerate/16)+6000, " Hz");
+ BS_Begin();
+ Skip_S1( 4, "unknown");
+ Get_SB ( channels, "channels"); Param_Info(channels?"Stereo":"Mono");
+ Get_S1 ( 2, samplesize, "samplesize"); Param_Info(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_Resolution, 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_Begin("seekpoints");
+ for (int16u Pos=0; Pos<num_seekpoints; Pos++)
+ Skip_L5 ( "seekpoint");
+ Element_End();
+ Skip_L3( "crc");
+}
+
+//---------------------------------------------------------------------------
+void File_Tak::WAVEMETADATA()
+{
+ //Parsing
+ int32u HeaderLength, FooterLength;
+ Get_L3 (HeaderLength, "HeaderLength");
+ Get_L3 (FooterLength, "FooterLength");
+ #if defined(MEDIAINFO_RIFF_YES)
+ //Creating the parser
+ File_Riff MI;
+ Open_Buffer_Init(&MI);
+
+ //Parsing
+ Open_Buffer_Continue(&MI, HeaderLength);
+ Element_Offset+=HeaderLength;
+
+ //Filling
+ //Finish(&MI);
+ //Merge(MI, StreamKind_Last, 0, StreamPos_Last);
+
+ //The RIFF header is for PCM
+ //Clear(Stream_Audio, StreamPos_Last, Audio_ID);
+ //Fill(Stream_Audio, StreamPos_Last, Audio_Format, "TAK", Unlimited, true, true);
+ //Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "TAK", Unlimited, true, true);
+ //Clear(Stream_Audio, StreamPos_Last, Audio_CodecID);
+ //Clear(Stream_Audio, StreamPos_Last, Audio_CodecID_Hint);
+ //Clear(Stream_Audio, StreamPos_Last, Audio_CodecID_Url);
+ //Clear(Stream_Audio, StreamPos_Last, Audio_BitRate);
+ //Clear(Stream_Audio, StreamPos_Last, Audio_BitRate_Mode);
+ //Clear(Stream_Audio, StreamPos_Last, Audio_Codec_CC);
+ #else
+ Skip_XX(HeaderLength, "Wave header");
+ #endif
+ if (FooterLength)
+ Skip_XX(FooterLength, "Wave footer");
+ Skip_L3( "crc");
+}
+
+//---------------------------------------------------------------------------
+void File_Tak::ENCODERINFO()
+{
+ //Parsing
+ int8u Revision, Minor, Major, Preset_hi, Preset_lo;
+ Get_L1 (Revision, "Revision");
+ Get_L1 (Minor, "Minor");
+ Get_L1 (Major, "Major");
+ BS_Begin();
+ Get_S1 (4, Preset_hi, "Preset (hi)");
+ Get_S1 (4, Preset_lo, "Preset (lo)");
+ BS_End();
+
+ FILLING_BEGIN();
+ Ztring Version=Ztring::ToZtring(Major)+_T('.')+Ztring::ToZtring(Minor)+_T('.')+Ztring::ToZtring(Revision);
+ Ztring Preset=_T("-p")+Ztring::ToZtring(Preset_lo);
+ switch (Preset_hi)
+ {
+ case 0x00 : break;
+ case 0x01 : Preset+=_T('e'); break;
+ case 0x02 : Preset+=_T('m'); break;
+ default : Preset+=_T('-')+Ztring::ToZtring(Preset_hi, 16); //Unknown
+ }
+
+ Fill(Stream_Audio, 0, Audio_Encoded_Library, "TAK");
+ Fill(Stream_Audio, 0, Audio_Encoded_Library_String, _T("TAK ")+Version);
+ Fill(Stream_Audio, 0, Audio_Encoded_Library_Name, "TAK");
+ Fill(Stream_Audio, 0, Audio_Encoded_Library_Version, Version);
+ Fill(Stream_Audio, 0, Audio_Encoded_Library_Settings, Preset);
+ FILLING_END();
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_TAK_YES
diff --git a/src/thirdparty/MediaInfo/Audio/File_Tak.h b/src/thirdparty/MediaInfo/Audio/File_Tak.h
new file mode 100644
index 000000000..6fb0963eb
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Tak.h
@@ -0,0 +1,77 @@
+// File_Tak - Info for Tak Audio files
+// Copyright (C) 2009-2009 Lionel Duchateau, kurtnoise@free.fr
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Tak files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_TakH
+#define MediaInfo_File_TakH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include "MediaInfo/Tag/File__Tags.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Tak
+//***************************************************************************
+
+class File_Tak : public File__Analyze, public File__Tags_Helper
+{
+public :
+ //In
+ bool VorbisHeader;
+
+ //Constructor/Destructor
+ File_Tak();
+
+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 ENDOFMETADATA();
+ void STREAMINFO();
+ void SEEKTABLE();
+ void WAVEMETADATA();
+ void ENCODERINFO();
+ void PADDING() {Skip_XX(Element_Size, "Padding");}
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Audio/File_Tta.cpp b/src/thirdparty/MediaInfo/Audio/File_Tta.cpp
new file mode 100644
index 000000000..de0f8f434
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Tta.cpp
@@ -0,0 +1,141 @@
+// File_Tta - Info for TTA files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Source : http://tta.sourceforge.net/codec.format
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_TTA_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Audio/File_Tta.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Tta::File_Tta()
+:File__Analyze(), File__Tags_Helper()
+{
+ //File__Tags_Helper
+ Base=this;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Tta::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_CompressionRatio, CompressionRatio);
+ Fill(Stream_Audio, 0, Audio_BitRate_Mode, "VBR");
+
+ File__Tags_Helper::Streams_Finish();
+}
+
+//***************************************************************************
+// Buffer - File header
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Tta::FileHeader_Begin()
+{
+ if (!File__Tags_Helper::FileHeader_Begin())
+ return false;
+
+ //Synchro
+ if (Buffer_Offset+4>Buffer_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_Resolution, 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
diff --git a/src/thirdparty/MediaInfo/Audio/File_Tta.h b/src/thirdparty/MediaInfo/Audio/File_Tta.h
new file mode 100644
index 000000000..b9a108511
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Tta.h
@@ -0,0 +1,65 @@
+// File_Tta - Info for TTA files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about TTA files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_TtaH
+#define MediaInfo_File_TtaH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#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
diff --git a/src/thirdparty/MediaInfo/Audio/File_TwinVQ.cpp b/src/thirdparty/MediaInfo/Audio/File_TwinVQ.cpp
new file mode 100644
index 000000000..1c8d1c343
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_TwinVQ.cpp
@@ -0,0 +1,210 @@
+// File_TwinVQ - Info for TwiVQ files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Source: http://wiki.multimedia.cx/index.php?title=VQF
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_Info(_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
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_TwinVQ.h b/src/thirdparty/MediaInfo/Audio/File_TwinVQ.h
new file mode 100644
index 000000000..93a86070f
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_TwinVQ.h
@@ -0,0 +1,70 @@
+// File_TwinVQ - Info for TwinVQ files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
+
diff --git a/src/thirdparty/MediaInfo/Audio/File_Vorbis.cpp b/src/thirdparty/MediaInfo/Audio/File_Vorbis.cpp
new file mode 100644
index 000000000..83e49f913
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Vorbis.cpp
@@ -0,0 +1,256 @@
+// File_Vorbis - Info for Vorbis files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Note : the buffer must be given in ONE call
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_VORBIS_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Audio/File_Vorbis.h"
+#include <cmath>
+using namespace std;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//---------------------------------------------------------------------------
+int32u ilog(int32u Value)
+{
+ int32u 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_Maximum==0 && BitRate_Nominal!=0 && BitRate_Minimum==0)
+ Fill(Stream_Audio, StreamPos_Last, Audio_BitRate_Mode, "CBR");
+ else if (BitRate_Maximum>BitRate_Nominal*1.1 && BitRate_Minimum<BitRate_Nominal*0.9)
+ 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; Pos<vorbis_codebook_count; Pos++)
+ {
+ Element_Begin("codebook");
+ Get_S3 (24, codebook, "codebook");
+ if (codebook!=0x564342)
+ return;
+ Get_BS (16, codebook_dimensions, "codebook_dimensions");
+ Get_BS (24, codebook_entries, "codebook_entries");
+ Get_BS (1, ordered, "ordered");
+ if (!ordered)
+ {
+ int32u sparse;
+ Get_BS (1, sparse, "sparse");
+ for (int32u Pos2=0; Pos2<codebook_entries; Pos2++)
+ {
+ if (sparse)
+ {
+ int32u flag;
+ Get_BS (1, flag, "flag");
+ if (flag)
+ {
+ Info_BS(5, length, "length");
+ }
+ }
+ else
+ {
+ Info_BS(5, length, "length");
+ }
+ }
+ }
+ else
+ {
+ Skip_BS(5, "length");
+ int32u num;
+ for(int32u i=0; i<codebook_entries; )
+ {
+ Get_BS (ilog(codebook_entries-i), num, "num");
+ for(int32u j=0; j<num && i<codebook_entries; j++, i++);
+ }
+ }
+ Get_BS (4, codebook_lookup_type, "codebook_lookup_type");
+ if (codebook_lookup_type>2)
+ return; //Not decodable
+ if (codebook_lookup_type>0)
+ {
+ int32u codebook_value_bits;
+ Info_BS(32, codebook_minimum_value, "codebook_minimum_value");
+ Info_BS(32, codebook_delta_value, "codebook_delta_value");
+ Get_BS ( 4, codebook_value_bits, "codebook_value_bits");
+ codebook_value_bits++;
+ Info_BS( 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));
+ while(1)
+ {
+ int32u acc=1, acc1=1;
+ for(int32u i=0; i<codebook_dimensions; i++)
+ {
+ acc*=vals;
+ acc1*=vals+1;
+ }
+ if(acc<=codebook_entries && acc1>codebook_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<vals; i++)
+ Get_BS (codebook_value_bits, codebook_multiplicands, "codebook_multiplicands");
+ }
+ Element_End();
+ }
+
+ //Time domain transforms
+ int32u vorbis_time_count;
+ Get_BS (6, vorbis_time_count, "vorbis_time_count");
+ for (int32u Pos=0; Pos<vorbis_time_count+1; Pos++)
+ Skip_BS(16, "zero");
+
+ //Floors
+ int32u vorbis_floor_count;
+ Get_BS (6, vorbis_floor_count, "vorbis_floor_count");
+ for (int32u Pos=0; Pos<vorbis_floor_count; Pos++)
+ {
+ Info_BS(16, vorbis_floor_types, "vorbis_floor_types");
+
+ FILLING_BEGIN();
+ Fill(Stream_Audio, 0, Audio_Format_Settings_Floor, vorbis_floor_types);
+ Fill(Stream_Audio, 0, Audio_Codec_Settings_Floor, vorbis_floor_types);
+ if (vorbis_floor_types==0)
+ {
+ Fill(Stream_Audio, 0, Audio_Format_Settings, "Floor0");
+ Fill(Stream_Audio, 0, Audio_Codec_Settings, "Floor0");
+ }
+ FILLING_END();
+ //Must continue parsing...
+ }
+ BS_End_LE();
+
+ Finish("Vorbis");
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_VORBIS_YES
diff --git a/src/thirdparty/MediaInfo/Audio/File_Vorbis.h b/src/thirdparty/MediaInfo/Audio/File_Vorbis.h
new file mode 100644
index 000000000..12b26000d
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Vorbis.h
@@ -0,0 +1,58 @@
+// File_Vorbis - Info for Vorbis files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Vorbis files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_VorbisH
+#define MediaInfo_File_VorbisH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Vorbis
+//***************************************************************************
+
+class File_Vorbis : public File__Analyze
+{
+private :
+ //Buffer - Per element
+ void Header_Parse();
+ void Data_Parse();
+
+ //Elements
+ void Identification();
+ void Setup();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Audio/File_Wvpk.cpp b/src/thirdparty/MediaInfo/Audio/File_Wvpk.cpp
new file mode 100644
index 000000000..ec02b75af
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Wvpk.cpp
@@ -0,0 +1,727 @@
+// File_Wvpk - Info for WavPack files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Source : http://www.wavpack.com/file_format.txt
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_WVPK_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Audio/File_Wvpk.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Constants
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+const int16u Wvpk_Resolution[]=
+{
+ 8,
+ 16,
+ 24,
+ 32,
+};
+
+//---------------------------------------------------------------------------
+const int32u Wvpk_SamplingRate[]=
+{
+ 6000,
+ 8000,
+ 9600,
+ 11025,
+ 12000,
+ 16000,
+ 22050,
+ 24000,
+ 32000,
+ 44100,
+ 48000,
+ 64000,
+ 88200,
+ 96000,
+ 192000,
+ 0,
+};
+
+//---------------------------------------------------------------------------
+const char* Wvpk_id(int8u ID)
+{
+ switch (ID)
+ {
+ case 0x00 : return "could be used to pad WavPack blocks";
+ case 0x02 : return "decorrelation terms & deltas";
+ case 0x03 : return "initial decorrelation weights";
+ case 0x04 : return "decorrelation sample history";
+ case 0x05 : return "initial entropy variables";
+ case 0x06 : return "entropy variables specific to hybrid mode";
+ case 0x07 : return "info needed for hybrid lossless (wvc) mode";
+ case 0x08 : return "specific info for floating point decode";
+ case 0x09 : return "specific info for decoding integers > 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 - Global
+ Frame_Count=0;
+
+ //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_CompressionRatio, 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+8<=Buffer_Size)
+ {
+ while (Buffer_Offset+8<=Buffer_Size
+ && CC4(Buffer+Buffer_Offset)!=CC4("wvpk"))
+ {
+ Buffer_Offset++;
+ }
+
+ if (Buffer_Offset+8<=Buffer_Size)//Testing if size is coherant
+ {
+ //Testing next start, to be sure
+ size_t Size=LittleEndian2int32u(Buffer+Buffer_Offset+4)+8;
+ if (1)//File_Offset+Buffer_Offset+Size!=File_Size-File_EndTagSize)
+ {
+ if (Buffer_Offset+Size+8>Buffer_Size)
+ return false; //Need more data
+
+ //Testing
+ if (CC4(Buffer+Buffer_Offset+Size)!=CC4("wvpk"))
+ Buffer_Offset++;
+ else
+ break; //while()
+ }
+ else
+ Buffer_Offset++;
+ }
+ }
+
+ //Parsing last bytes if needed
+ if (Buffer_Offset+8>Buffer_Size)
+ {
+ if (Buffer_Offset+7==Buffer_Size && CC4(Buffer+Buffer_Offset)!=0x7776706B) //"wvpk"
+ Buffer_Offset++;
+ if (Buffer_Offset+6==Buffer_Size && CC4(Buffer+Buffer_Offset)!=0x7776706B) //"wvpk"
+ Buffer_Offset++;
+ if (Buffer_Offset+5==Buffer_Size && CC4(Buffer+Buffer_Offset)!=0x7776706B) //"wvpk"
+ Buffer_Offset++;
+ if (Buffer_Offset+4==Buffer_Size && CC4(Buffer+Buffer_Offset)!=0x7776706B) //"wvpk"
+ Buffer_Offset++;
+ if (Buffer_Offset+3==Buffer_Size && CC3(Buffer+Buffer_Offset)!=0x777670) //"wv"
+ 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 (CC4(Buffer+Buffer_Offset)!=CC4("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_Begin("Block Header");
+ if (!FromMKV)
+ Get_L2 (version, "version");
+ if (version/0x100==0x4)
+ {
+ while (Element_Offset<Element_Size)
+ {
+ int32u total_samples=(int32u)-1, block_index=(int32u)-1, block_samples=0, flags, blocksize=(int32u)-1;
+ bool initial_block=true, final_block=true;
+ if (!FromMKV)
+ {
+ Skip_L1( "track_no");
+ Skip_L1( "index_no");
+ Get_L4 (total_samples, "total_samples");
+ Get_L4 (block_index, "block_index");
+ }
+ if (!FromMKV || (FromMKV && Element_Offset==0))
+ Get_L4 (block_samples, "block_samples");
+ if (block_samples!=0) //empty frames have other values empty
+ {
+ if (!FromMKV)
+ {
+ if (block_index==0) //Only the frame with block_index==0
+ total_samples_FirstFrame=total_samples; //Note: total_samples is not trustable for a cutted file
+ if (Frame_Count==1)
+ block_index_FirstFrame=block_index; //Save the block_index of the first block
+ block_index_LastFrame=block_index;
+ block_samples_LastFrame=block_samples;
+ }
+ Get_L4 (flags, "flags");
+ Get_Flags (flags, 0, resolution0, "resolution0");
+ Get_Flags (flags, 1, resolution1, "resolution1");
+ Get_Flags (flags, 2, mono, "mono");
+ Get_Flags (flags, 3, hybrid, "hybrid");
+ Get_Flags (flags, 4, joint_stereo, "joint stereo");
+ Get_Flags (flags, 5, cross_channel_decorrelation, "cross-channel decorrelation");
+ Skip_Flags(flags, 6, "hybrid noise shaping");
+ Skip_Flags(flags, 7, "floating point data");
+ Skip_Flags(flags, 8, "extended size integers");
+ Skip_Flags(flags, 9, "hybrid mode parameters control bitrate");
+ Skip_Flags(flags, 10, "hybrid noise balanced between channels");
+ Get_Flags (flags, 11, initial_block, "initial block in sequence");
+ Get_Flags (flags, 12, final_block, "final block in sequence");
+ Skip_Flags(flags, 13, "amount of data left-shift after decode");
+ Skip_Flags(flags, 14, "amount of data left-shift after decode");
+ Skip_Flags(flags, 15, "amount of data left-shift after decode");
+ Skip_Flags(flags, 16, "amount of data left-shift after decode");
+ Skip_Flags(flags, 17, "amount of data left-shift after decode");
+ Skip_Flags(flags, 18, "maximum magnitude of decoded data");
+ Skip_Flags(flags, 19, "maximum magnitude of decoded data");
+ Skip_Flags(flags, 20, "maximum magnitude of decoded data");
+ Skip_Flags(flags, 21, "maximum magnitude of decoded data");
+ Skip_Flags(flags, 22, "maximum magnitude of decoded data");
+ Skip_Flags(flags, 23, "sampling rate");
+ Skip_Flags(flags, 24, "sampling rate");
+ Skip_Flags(flags, 25, "sampling rate");
+ Skip_Flags(flags, 26, "sampling rate"); SamplingRate=(int8u)(((flags>>23)&0xF)); Param_Info(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_End();
+
+ 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<End)
+ {
+ Element_Begin();
+ int32u word_size;
+ bool large, odd_size;
+ BS_Begin();
+ Get_SB (large, "large");
+ Get_SB (odd_size, "odd_size");
+ Get_S1 (6, id, "id"); Element_Info(Wvpk_id(id));
+ BS_End();
+ if (large)
+ {
+ Get_L3 (word_size, "word_size");
+ }
+ else
+ {
+ int8u word_size1;
+ Get_L1 (word_size1, "word_size");
+ word_size=word_size1;
+ }
+ if (word_size==0 && odd_size)
+ Size=0; //Problem!
+ else
+ Size=word_size*2-(odd_size?1:0);
+ Element_Name(Ztring().From_CC1(id));
+ switch (id)
+ {
+ case 0x0D : id_0D(); break;
+ case 0x25 : id_25(); break;
+ default : if (word_size)
+ Skip_XX(Size, "data");
+ }
+ if (odd_size)
+ Skip_XX(1, "padding");
+ Element_End();
+ }
+ }
+ }
+
+ //Filling
+ if (!Status[IsAccepted] && Frame_Count>=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(Version_Minor.begin(), _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_Resolution, 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_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
diff --git a/src/thirdparty/MediaInfo/Audio/File_Wvpk.h b/src/thirdparty/MediaInfo/Audio/File_Wvpk.h
new file mode 100644
index 000000000..ce9ce3952
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Audio/File_Wvpk.h
@@ -0,0 +1,99 @@
+// File_Wvpk - Info for WavePack files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about WavePack files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_WvpkH
+#define MediaInfo_File_WvpkH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include "MediaInfo/Tag/File__Tags.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Wvpk
+//***************************************************************************
+
+class File_Wvpk : public File__Analyze, public File__Tags_Helper
+{
+public :
+ //In
+ size_t 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_0D();
+ void id_25();
+
+ //Temp - Global
+ size_t Frame_Count;
+
+ //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
diff --git a/src/thirdparty/MediaInfo/Duplicate/File__Duplicate_MpegTs.cpp b/src/thirdparty/MediaInfo/Duplicate/File__Duplicate_MpegTs.cpp
new file mode 100644
index 000000000..93e7e86d7
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Duplicate/File__Duplicate_MpegTs.cpp
@@ -0,0 +1,488 @@
+// File__Duplicate_MpegTs - Duplication of some formats
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Duplication helper for some specific formats
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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 <cstring>
+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<int16u> StreamID_List;
+ for (std::map<int16u, buffer>::iterator PAT_=PAT.begin(); PAT_!=PAT.end(); PAT_++)
+ if (PAT_->first!=StreamID)
+ StreamID_List.push_back(PAT_->first);
+ for (size_t Pos=0; Pos<StreamID_List.size(); Pos++)
+ PAT[StreamID_List[Pos]].FromTS_version_number_Last=0xFF;
+
+ return true;
+}
+
+bool File__Duplicate_MpegTs::Manage_PMT (const int8u* ToAdd, size_t ToAdd_Size)
+{
+ if (!Parsing_Begin(ToAdd, ToAdd_Size, PMT))
+ return false;
+
+ //Testing program_number
+ if (Wanted_program_numbers.find(StreamID)==Wanted_program_numbers.end()
+ && Wanted_program_map_PIDs.find(elementary_PIDs_program_map_PIDs[StreamID])==Wanted_program_numbers.end())
+ {
+ delete PMT[StreamID].Buffer; PMT[StreamID].Buffer=NULL;
+ return false;
+ }
+
+ //program_info_length
+ int16u program_info_length=CC2(FromTS.Buffer+FromTS.Offset+2)&0x0FFF;
+ std::memcpy(PMT[StreamID].Buffer+PMT[StreamID].Offset, FromTS.Buffer+FromTS.Offset, 4+program_info_length);
+ FromTS.Offset+=4+program_info_length;
+ PMT[StreamID].Offset+=4+program_info_length;
+
+ //elementary_PIDs
+ while (FromTS.Offset+5<=FromTS.End)
+ {
+ //For each elementary_PID
+ int16u elementary_PID=CC2(FromTS.Buffer+FromTS.Offset+1)&0x1FFF;
+ int16u ES_info_length=CC2(FromTS.Buffer+FromTS.Offset+3)&0x0FFF;
+ if (Wanted_elementary_PIDs.empty() || Wanted_elementary_PIDs.find(elementary_PID)!=Wanted_elementary_PIDs.end())
+ {
+ //Integrating it
+ elementary_PIDs[elementary_PID]=1;
+ elementary_PIDs_program_map_PIDs[elementary_PID]=StreamID;
+ std::memcpy(PMT[StreamID].Buffer+PMT[StreamID].Offset, FromTS.Buffer+FromTS.Offset, 5+ES_info_length);
+ PMT[StreamID].Offset+=5+ES_info_length;
+ }
+ else
+ elementary_PIDs[elementary_PID]=0;
+ FromTS.Offset+=5+ES_info_length;
+ }
+
+ Parsing_End(PMT);
+ return true;
+}
+
+//***************************************************************************
+// Helpers
+//***************************************************************************
+
+bool File__Duplicate_MpegTs::Parsing_Begin (const int8u* ToAdd, size_t ToAdd_Size, std::map<int16u, buffer> &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; Pos<ToModify.Size; Pos+=188)
+ {
+ ToModify.continuity_counter++;
+ if (ToModify.continuity_counter>0x0F)
+ 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<FromTS.End+4; CRC_32_Offset++) //After syncword
+ CRC_32=(CRC_32<<8) ^ Psi_CRC_32_Table[(CRC_32>>24)^(FromTS.Buffer[CRC_32_Offset])];
+ if (CRC_32)
+ return false; //Problem
+
+ //Copying
+ if (ToModify.Buffer!=NULL && ToModify.Size<FromTS.Size)
+ {delete ToModify.Buffer; ToModify.Buffer=NULL;}
+ if (ToModify.Buffer==NULL)
+ ToModify.Buffer=new int8u[FromTS.Size+(FromTS.Size/188)*4];
+ std::memcpy(ToModify.Buffer, FromTS.Buffer, FromTS.Begin+8); //Only up to last_section_number included
+ ToModify.Offset=FromTS.Offset;
+ ToModify.Begin=FromTS.Begin;
+ ToModify.End=FromTS.End;
+ ToModify.Size=FromTS.Size;
+
+ //Changing version_number
+ int8u ToReplace=FromTS.Buffer[FromTS.Offset+2];
+ ToReplace&=0xC1; //11000001, for removing old version_number
+ ToReplace|=ToModify.version_number<<1; //merging, with 1 bit offset
+ ToModify.Buffer[ToModify.Offset+2]=ToReplace;
+
+ //Positionning after last_section_number
+ ToModify.Offset+=5;
+ FromTS.Offset+=5;
+
+ return true;
+}
+
+void File__Duplicate_MpegTs::Parsing_End (std::map<int16u, buffer> &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<ToModify.End; Buffer_CRC_Pos++)
+ CRC_32=(CRC_32<<8) ^ Psi_CRC_32_Table[(CRC_32>>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; Pos<ToModify.Size; Pos+=188)
+ {
+ std::memmove(ToModify.Buffer+Pos+4, ToModify.Buffer+Pos, ToModify.Size-Pos);
+ std::memcpy(ToModify.Buffer+Pos, ToModify.Buffer, 4);
+ ToModify.Buffer[Pos+1]&=0xBF; //Removing payload_unit_start_indicator
+ ToModify.Offset+=4;
+ ToModify.Size+=4;
+
+ ToModify.continuity_counter++;
+ if (ToModify.continuity_counter>0x0F)
+ 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<ToModify.Size; Buffer_CRC_Pos++)
+ ToModify.Buffer[Buffer_CRC_Pos]=0xFF;
+
+ Writer.Write(ToModify.Buffer, ToModify.Size);
+
+ //Managing big chunks
+ int16u PID=((ToModify.Buffer[1]&0x1F)<<8)|ToModify.Buffer[2]; //BigEndian2int16u(ToAdd+1)&0x1FFF;
+ if (BigBuffers.find(PID)!=BigBuffers.end())
+ BigBuffers.erase(BigBuffers.find(PID));
+}
+
+//***************************************************************************
+// Output_Buffer
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+size_t File__Duplicate_MpegTs::Output_Buffer_Get (unsigned char** Output_Buffer)
+{
+ return Writer.Output_Buffer_Get(Output_Buffer);
+}
+
+} //NameSpace
+
+#endif
+
diff --git a/src/thirdparty/MediaInfo/Duplicate/File__Duplicate_MpegTs.h b/src/thirdparty/MediaInfo/Duplicate/File__Duplicate_MpegTs.h
new file mode 100644
index 000000000..55ef1bdff
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Duplicate/File__Duplicate_MpegTs.h
@@ -0,0 +1,158 @@
+// File__Duplicate_MpegTs - Duplication of some formats
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef File__Duplicate_MpegTsH
+#define File__Duplicate_MpegTsH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Duplicate/File__Duplicate__Base.h"
+#include "MediaInfo/Duplicate/File__Duplicate__Writer.h"
+#include "ZenLib/ZtringListList.h"
+#include <set>
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+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<int16u> Wanted_program_numbers;
+ std::set<int16u> Wanted_program_map_PIDs;
+ std::set<int16u> Wanted_elementary_PIDs;
+ std::set<int16u> Remove_program_numbers;
+ std::set<int16u> Remove_program_map_PIDs;
+ std::set<int16u> Remove_elementary_PIDs;
+
+ //Current
+ std::vector<int8u> program_map_PIDs;
+ std::vector<int8u> elementary_PIDs;
+ std::vector<int16u> 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<int16u, buffer> PAT;
+ std::map<int16u, buffer> PMT;
+ std::map<int16u, buffer_big> BigBuffers; //key is pid
+
+ //Helpers
+ bool Parsing_Begin(const int8u* ToAdd, size_t ToAdd_Size, std::map<int16u, buffer> &ToModify);
+ void Parsing_End(std::map<int16u, buffer> &ToModify);
+
+ //Temp
+ int16u StreamID;
+};
+
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Duplicate/File__Duplicate__Base.cpp b/src/thirdparty/MediaInfo/Duplicate/File__Duplicate__Base.cpp
new file mode 100644
index 000000000..89b3bf387
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Duplicate/File__Duplicate__Base.cpp
@@ -0,0 +1,47 @@
+// File__Duplicate__Base - Duplication of some formats
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Duplication helper for some specific formats
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+#include "MediaInfo/Duplicate/File__Duplicate__Base.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+File__Duplicate__Base::File__Duplicate__Base ()
+{
+}
+
+} //NameSpace
+
diff --git a/src/thirdparty/MediaInfo/Duplicate/File__Duplicate__Base.h b/src/thirdparty/MediaInfo/Duplicate/File__Duplicate__Base.h
new file mode 100644
index 000000000..39dd068e4
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Duplicate/File__Duplicate__Base.h
@@ -0,0 +1,51 @@
+// File__Duplicate__Base - Duplication of some formats
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef File__Duplicate__BaseH
+#define File__Duplicate__BaseH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include "ZenLib/ZtringListList.h"
+#include <map>
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File__Duplicate__Base
+//***************************************************************************
+
+class File__Duplicate__Base
+{
+public :
+ //Constructor/Destructor
+ File__Duplicate__Base();
+ //~File__Duplicate__Base();
+
+};
+
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Duplicate/File__Duplicate__Writer.cpp b/src/thirdparty/MediaInfo/Duplicate/File__Duplicate__Writer.cpp
new file mode 100644
index 000000000..0fbbd6f53
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Duplicate/File__Duplicate__Writer.cpp
@@ -0,0 +1,163 @@
+// File__Duplicate__Writer - Duplication of some formats
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Duplication helper for some specific formats
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+#include "MediaInfo/Duplicate/File__Duplicate__Writer.h"
+#include "MediaInfo/MediaInfo_Config.h"
+#include "ZenLib/ZtringList.h"
+#include "ZenLib/File.h"
+#include <cstring>
+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
+
diff --git a/src/thirdparty/MediaInfo/Duplicate/File__Duplicate__Writer.h b/src/thirdparty/MediaInfo/Duplicate/File__Duplicate__Writer.h
new file mode 100644
index 000000000..73a4e7ff6
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Duplicate/File__Duplicate__Writer.h
@@ -0,0 +1,81 @@
+// File__Duplicate__Writer - Duplication of some formats
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef File__Duplicate__WriterH
+#define File__Duplicate__WriterH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include "ZenLib/ZtringListList.h"
+#include <map>
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+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
diff --git a/src/thirdparty/MediaInfo/Export/Export_Mpeg7.cpp b/src/thirdparty/MediaInfo/Export/Export_Mpeg7.cpp
new file mode 100644
index 000000000..397f07aa5
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Export/Export_Mpeg7.cpp
@@ -0,0 +1,1188 @@
+// File__Analyze - Base for analyze files
+// Copyright (C) 2009-2009 Jerome Martinez, Zen@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Export/Export_Mpeg7.h"
+#include "MediaInfo/File__Analyse_Automatic.h"
+#include <ctime>
+#ifdef SS
+ #undef SS //Solaris defines this somewhere
+#endif
+//---------------------------------------------------------------------------
+
+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("M-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("M-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_Audio, 0, Audio_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("M-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_Audio, 0, Audio_Format_Profile).empty())
+ return 00000;
+ 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;
+ }
+ }
+ }
+
+ 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");
+ }
+ 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 SS=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+=(SS<10?_T("0"):_T(""))+Ztring::ToZtring(SS)+_T(':');
+ ToReturn+=Ztring::ToZtring(Delay)+_T('F');
+ ToReturn+=Ztring::ToZtring(Rate);
+ return ToReturn;
+ }
+
+ //Default: In miliseconds
+ 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 SS=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+=(SS<10?_T("0"):_T(""))+Ztring::ToZtring(SS)+_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 SS=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(SS)+_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 SS=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(SS)+_T('S');
+ ToReturn+=Ztring::ToZtring(SamplingCount)+_T('N');
+ ToReturn+=Ztring::ToZtring(SamplingRate)+_T('F');
+ return ToReturn;
+ }
+
+ //Default: In miliseconds
+ 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 SS=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(SS)+_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<mpeg7:VisualCoding>\n");
+
+ //Format
+ ToReturn+=_T("\t\t\t\t\t\t\t\t<mpeg7:Format");
+ int32u VisualCodingFormatCS_termID=Mpeg7_VisualCodingFormatCS_termID(MI, StreamPos);
+ if (VisualCodingFormatCS_termID)
+ {
+ ToReturn+=_T(" href=\"urn:mpeg:mpeg7:cs:VisualCodingFormatCS:2001:");
+ ToReturn+=Ztring::ToZtring(VisualCodingFormatCS_termID/10000);
+ ToReturn+=_T("\"");
+ }
+ ToReturn+=Mpeg7_Visual_colorDomain(MI, StreamPos); //Algo puts empty string if not known
+ ToReturn+=_T(">\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t<mpeg7:Name xml:lang=\"en\">"); ToReturn+=Mpeg7_VisualCodingFormatCS_Name((VisualCodingFormatCS_termID/10000)*10000, MI, StreamPos); ToReturn+=_T("</mpeg7:Name>\n");
+ if (VisualCodingFormatCS_termID%10000)
+ {
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t<mpeg7:Term termID=\"");
+ ToReturn+=Ztring::ToZtring(VisualCodingFormatCS_termID/10000);
+ ToReturn+=_T(".");
+ ToReturn+=Ztring::ToZtring((VisualCodingFormatCS_termID%10000)/100);
+ ToReturn+=_T("\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t<mpeg7:Name xml:lang=\"en\">"); ToReturn+=Mpeg7_VisualCodingFormatCS_Name((VisualCodingFormatCS_termID/100)*100, MI, StreamPos); ToReturn+=_T("</mpeg7:Name>\n");
+ if (VisualCodingFormatCS_termID%100)
+ {
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t<mpeg7:Term termID=\"");
+ ToReturn+=Ztring::ToZtring(VisualCodingFormatCS_termID/10000);
+ ToReturn+=_T(".");
+ ToReturn+=Ztring::ToZtring((VisualCodingFormatCS_termID%10000)/100);
+ ToReturn+=_T(".");
+ ToReturn+=Ztring::ToZtring(VisualCodingFormatCS_termID%100);
+ ToReturn+=_T("\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Name xml:lang=\"en\">"); ToReturn+=Mpeg7_VisualCodingFormatCS_Name(VisualCodingFormatCS_termID, MI, StreamPos); ToReturn+=_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t</mpeg7:Term>\n");
+ }
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t</mpeg7:Term>\n");
+ }
+ ToReturn+=_T("\t\t\t\t\t\t\t\t</mpeg7:Format>\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<mpeg7:Pixel");
+ if (!MI.Get(Stream_Video, 0, Video_PixelAspectRatio).empty())
+ {
+ ToReturn+=_T(" aspectRatio=\"");
+ ToReturn+=MI.Get(Stream_Video, 0, Video_PixelAspectRatio);
+ ToReturn+=_T("\"");
+ }
+ if (!MI.Get(Stream_Video, 0, Video_Resolution).empty())
+ {
+ ToReturn+=_T(" bitsPer=\"");
+ ToReturn+=MI.Get(Stream_Video, 0, Video_Resolution);
+ ToReturn+=_T("\"");
+ }
+ ToReturn+=_T("/>\n");
+ }
+
+ //Frame
+ ToReturn+=_T("\t\t\t\t\t\t\t\t<mpeg7:Frame aspectRatio=\"")+MI.Get(Stream_Video, 0, Video_DisplayAspectRatio); ToReturn+=_T("\" height=\""); ToReturn+=MI.Get(Stream_Video, 0, Video_Height); ToReturn+=_T("\" width=\""); ToReturn+=MI.Get(Stream_Video, 0, Video_Width); ToReturn+=_T("\" rate=\""); ToReturn+=MI.Get(Stream_Video, 0, Video_FrameRate); ToReturn+=_T("\" structure=\""); ToReturn+=MI.Get(Stream_Video, 0, Video_ScanType).MakeLowerCase(); ToReturn+=_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<mpeg7:ColorSampling> <!-- YUV 4:2:0 Interlaced -->\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t<mpeg7:Lattice height=\"720\" width=\"486\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t<mpeg7:Field temporalOrder=\"0\" positionalOrder=\"0\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t<mpeg7:Component>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Name>Luminance</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Offset horizontal=\"0.0\" vertical=\"0.0\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Period horizontal=\"1.0\" vertical=\"2.0\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t</mpeg7:Component>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t<mpeg7:Component>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Name>ChrominanceBlueDifference</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Offset horizontal=\"0.0\" vertical=\"0.5\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Period horizontal=\"2.0\" vertical=\"4.0\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t</mpeg7:Component>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t<mpeg7:Component>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Name>ChrominanceRedDifference</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Offset horizontal=\"0.0\" vertical=\"0.5\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Period horizontal=\"2.0\" vertical=\"4.0\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t</mpeg7:Component>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t</mpeg7:Field>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t<mpeg7:Field temporalOrder=\"1\" positionalOrder=\"1\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t<mpeg7:Component>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Name>Luminance</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Offset horizontal=\"0.0\" vertical=\"1.0\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Period horizontal=\"1.0\" vertical=\"2.0\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t</mpeg7:Component>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t<mpeg7:Component>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Name>ChrominanceBlueDifference</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Offset horizontal=\"0.0\" vertical=\"2.5\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Period horizontal=\"2.0\" vertical=\"4.0\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t</mpeg7:Component>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t<mpeg7:Component>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Name>ChrominanceRedDifference</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Offset horizontal=\"0.0\" vertical=\"2.5\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Period horizontal=\"4.0\" vertical=\"2.0\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t</mpeg7:Component>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t</mpeg7:Field>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t</mpeg7:ColorSampling>\n");
+ }
+
+ ToReturn+=_T("\t\t\t\t\t\t\t</mpeg7:VisualCoding>\n");
+
+ return ToReturn;
+}
+
+//---------------------------------------------------------------------------
+Ztring Mpeg7_Transform_Audio(Ztring &ToReturn, MediaInfo_Internal &MI, size_t StreamPos)
+{
+ ToReturn+=_T("\t\t\t\t\t\t\t<mpeg7:AudioCoding>\n");
+
+ //Format
+ ToReturn+=_T("\t\t\t\t\t\t\t\t<mpeg7:Format");
+ int32u AudioCodingFormatCS_termID=Mpeg7_AudioCodingFormatCS_termID(MI, StreamPos);
+ if (AudioCodingFormatCS_termID)
+ {
+ ToReturn+=_T(" href=\"urn:mpeg:mpeg7:cs:AudioCodingFormatCS:2001:");
+ ToReturn+=Ztring::ToZtring(AudioCodingFormatCS_termID/10000);
+ ToReturn+=_T("\"");
+ }
+ ToReturn+=_T(">\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t<mpeg7:Name xml:lang=\"en\">"); ToReturn+=Mpeg7_AudioCodingFormatCS_Name((AudioCodingFormatCS_termID/10000)*10000, MI, StreamPos); ToReturn+=_T("</mpeg7:Name>\n");
+ if (AudioCodingFormatCS_termID%10000)
+ {
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t<mpeg7:Term termID=\"");
+ ToReturn+=Ztring::ToZtring(AudioCodingFormatCS_termID/10000);
+ ToReturn+=_T(".");
+ ToReturn+=Ztring::ToZtring((AudioCodingFormatCS_termID%10000)/100);
+ ToReturn+=_T("\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t<mpeg7:Name xml:lang=\"en\">"); ToReturn+=Mpeg7_AudioCodingFormatCS_Name((AudioCodingFormatCS_termID/100)*100, MI, StreamPos); ToReturn+=_T("</mpeg7:Name>\n");
+ if (AudioCodingFormatCS_termID%100)
+ {
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t<mpeg7:Term termID=\"");
+ ToReturn+=Ztring::ToZtring(AudioCodingFormatCS_termID/10000);
+ ToReturn+=_T(".");
+ ToReturn+=Ztring::ToZtring((AudioCodingFormatCS_termID%10000)/100);
+ ToReturn+=_T(".");
+ ToReturn+=Ztring::ToZtring(AudioCodingFormatCS_termID%100);
+ ToReturn+=_T("\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Name xml:lang=\"en\">"); ToReturn+=Mpeg7_AudioCodingFormatCS_Name(AudioCodingFormatCS_termID, MI, StreamPos); ToReturn+=_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t</mpeg7:Term>\n");
+ }
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t</mpeg7:Term>\n");
+ }
+ ToReturn+=_T("\t\t\t\t\t\t\t\t</mpeg7:Format>\n");
+
+ //AudioChannels
+ ToReturn+=_T("\t\t\t\t\t\t\t\t<mpeg7:AudioChannels>"); ToReturn+=MI.Get(Stream_Audio, StreamPos, Audio_Channel_s_); ToReturn+=_T("</mpeg7:AudioChannels>\n");
+
+ //Sample
+ ToReturn+=_T("\t\t\t\t\t\t\t\t<mpeg7:Sample rate=\""); ToReturn+=MI.Get(Stream_Audio, StreamPos, Audio_SamplingRate); ToReturn+=_T("\""); if (!MI.Get(Stream_Audio, StreamPos, Audio_Resolution).empty()) {ToReturn+=_T(" bitsPer=\""); ToReturn+=MI.Get(Stream_Audio, StreamPos, Audio_Resolution); ToReturn+=_T("\"");} ToReturn+=_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:Emphasis>")+Mpeg7_AudioEmphasis(MI, StreamPos)+_T("</mpeg7:Emphasis>\n");
+
+ //Presentation
+ int32u AudioPresentationCS_termID=Mpeg7_AudioPresentationCS_termID(MI, StreamPos);
+ if (AudioPresentationCS_termID)
+ {
+ ToReturn+=_T("\t\t\t\t\t\t\t\t<mpeg7:Presentation href=\"urn:mpeg:mpeg7:cs:AudioPresentationCS:2001:");
+ ToReturn+=Ztring::ToZtring(AudioPresentationCS_termID/10000);
+ if (AudioPresentationCS_termID%10000)
+ {
+ ToReturn+=_T(".");
+ ToReturn+=Ztring::ToZtring((AudioPresentationCS_termID%10000)/100);
+ if (AudioPresentationCS_termID%100)
+ {
+ ToReturn+=_T(".");
+ ToReturn+=Ztring::ToZtring(AudioPresentationCS_termID%100);
+ }
+ }
+ ToReturn+=_T("\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t<mpeg7:Name>")+Mpeg7_AudioPresentationCS_Name(AudioPresentationCS_termID, MI, StreamPos)+_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t</mpeg7:Presentation>\n");
+ }
+
+ ToReturn+=_T("\t\t\t\t\t\t\t</mpeg7:AudioCoding>\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("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ ToReturn+=_T("<!-- Generated at ")+TimeS+_T(" by ")+MediaInfoLib::Config.Info_Version_Get()+_T(" -->\n");
+ ToReturn+=_T("<mpeg7:Mpeg7 xmlns=\"urn:mpeg:mpeg7:schema:2004\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:mpeg7=\"urn:mpeg:mpeg7:schema:2004\" xsi:schemaLocation=\"urn:mpeg:mpeg7:schema:2004 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-7_schema_files/mpeg7-v2.xsd\">\n");
+
+ //Description - DescriptionMetadata
+ {
+ ToReturn+=_T("\t<mpeg7:DescriptionMetadata>\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<mpeg7:PrivateIdentifier>")+FileName+_T("</mpeg7:PrivateIdentifier>\n");
+ ToReturn+=_T("\t\t<mpeg7:CreationTime>")+TimeS+_T("</mpeg7:CreationTime>\n");
+ ToReturn+=_T("\t\t<mpeg7:Instrument>\n");
+ ToReturn+=_T("\t\t\t<mpeg7:Tool>\n");
+ ToReturn+=_T("\t\t\t\t<mpeg7:Name>")+MediaInfoLib::Config.Info_Version_Get()+_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t</mpeg7:Tool>\n");
+ ToReturn+=_T("\t\t</mpeg7:Instrument>\n");
+ ToReturn+=_T("\t</mpeg7:DescriptionMetadata>\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<mpeg7:Description xsi:type=\"CreationDescriptionType\">\n");
+ ToReturn+=_T("\t\t<mpeg7:CreationInformation>\n");
+ ToReturn+=_T("\t\t\t<mpeg7:Creation>\n");
+ if (!MI.Get(Stream_General, 0, General_Movie).empty())
+ ToReturn+=_T("\t\t\t\t<mpeg7:Title type=\"songTitle\">")+MI.Get(Stream_General, 0, General_Movie)+_T("</mpeg7:Title>\n");
+ if (!MI.Get(Stream_General, 0, General_Track).empty())
+ ToReturn+=_T("\t\t\t\t<mpeg7:Title type=\"songTitle\">")+MI.Get(Stream_General, 0, General_Title)+_T("</mpeg7:Title>\n");
+ if (!MI.Get(Stream_General, 0, General_Album).empty())
+ ToReturn+=_T("\t\t\t\t<mpeg7:Title type=\"albumTitle\">")+MI.Get(Stream_General, 0, General_Album)+_T("</mpeg7:Title>\n");
+ if (!MI.Get(Stream_General, 0, General_WrittenBy).empty())
+ {
+ ToReturn+=_T("\t\t\t\t<mpeg7:Creator>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Role href=\"urn:mpeg:mpeg7:cs:RoleCS:2001:AUTHOR\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Agent xsi:type=\"PersonGroupType\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t<mpeg7:Name>")+MI.Get(Stream_General, 0, General_WrittenBy)+_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t</mpeg7:Agent>\n");
+ ToReturn+=_T("\t\t\t\t</mpeg7:Creator>\n");
+ }
+ if (!MI.Get(Stream_General, 0, General_Performer).empty())
+ {
+ ToReturn+=_T("\t\t\t\t<mpeg7:Creator>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Role href=\"urn:mpeg:mpeg7:cs:RoleCS:2001:PERFORMER\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Agent xsi:type=\"PersonGroupType\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t<mpeg7:Name>")+MI.Get(Stream_General, 0, General_Performer)+_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t</mpeg7:Agent>\n");
+ ToReturn+=_T("\t\t\t\t</mpeg7:Creator>\n");
+ }
+ if (!MI.Get(Stream_General, 0, General_ExecutiveProducer).empty())
+ {
+ ToReturn+=_T("\t\t\t\t<mpeg7:Creator>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Role href=\"urn:mpeg:mpeg7:cs:RoleCS:2001:EXECUTIVE-PRODUCER\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Agent xsi:type=\"PersonGroupType\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t<mpeg7:Name>")+MI.Get(Stream_General, 0, General_ExecutiveProducer)+_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t</mpeg7:Agent>\n");
+ ToReturn+=_T("\t\t\t\t</mpeg7:Creator>\n");
+ }
+ if (!MI.Get(Stream_General, 0, General_Producer).empty())
+ {
+ ToReturn+=_T("\t\t\t\t<mpeg7:Creator>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Role href=\"urn:mpeg:mpeg7:cs:RoleCS:2001:PRODUCER\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Agent xsi:type=\"PersonGroupType\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t<mpeg7:Name>")+MI.Get(Stream_General, 0, General_Producer)+_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t</mpeg7:Agent>\n");
+ ToReturn+=_T("\t\t\t\t</mpeg7:Creator>\n");
+ }
+ if (!MI.Get(Stream_General, 0, General_Director).empty())
+ {
+ ToReturn+=_T("\t\t\t\t<mpeg7:Creator>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Role href=\"urn:mpeg:mpeg7:cs:RoleCS:2001:PRODUCER\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Agent xsi:type=\"PersonGroupType\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t<mpeg7:Name>")+MI.Get(Stream_General, 0, General_Director)+_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t</mpeg7:Agent>\n");
+ ToReturn+=_T("\t\t\t\t</mpeg7:Creator>\n");
+ }
+ if (!MI.Get(Stream_General, 0, General_Composer).empty())
+ {
+ ToReturn+=_T("\t\t\t\t<mpeg7:Creator>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Role href=\"urn:mpeg:mpeg7:cs:RoleCS:2001:COMPOSER\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Agent xsi:type=\"PersonGroupType\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t<mpeg7:Name>")+MI.Get(Stream_General, 0, General_Composer)+_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t</mpeg7:Agent>\n");
+ ToReturn+=_T("\t\t\t\t</mpeg7:Creator>\n");
+ }
+ if (!MI.Get(Stream_General, 0, General_CostumeDesigner).empty())
+ {
+ ToReturn+=_T("\t\t\t\t<mpeg7:Creator>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Role href=\"urn:mpeg:mpeg7:cs:RoleCS:2001:COSTUME-SUPERVISOR\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Agent xsi:type=\"PersonGroupType\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t<mpeg7:Name>")+MI.Get(Stream_General, 0, General_CostumeDesigner)+_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t</mpeg7:Agent>\n");
+ ToReturn+=_T("\t\t\t\t</mpeg7:Creator>\n");
+ }
+ if (!MI.Get(Stream_General, 0, General_ProductionDesigner).empty())
+ {
+ ToReturn+=_T("\t\t\t\t<mpeg7:Creator>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Role href=\"urn:mpeg:mpeg7:cs:RoleCS:2001:PRODUCTION-DESIGNER\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Agent xsi:type=\"PersonGroupType\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t<mpeg7:Name>")+MI.Get(Stream_General, 0, General_ProductionDesigner)+_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t</mpeg7:Agent>\n");
+ ToReturn+=_T("\t\t\t\t</mpeg7:Creator>\n");
+ }
+ if (!MI.Get(Stream_General, 0, General_Publisher).empty())
+ {
+ ToReturn+=_T("\t\t\t\t<mpeg7:Creator>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Role href=\"urn:mpeg:mpeg7:cs:RoleCS:2001:PUBLISHER\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Agent xsi:type=\"PersonGroupType\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t<mpeg7:Name>")+MI.Get(Stream_General, 0, General_Publisher)+_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t</mpeg7:Agent>\n");
+ ToReturn+=_T("\t\t\t\t</mpeg7:Creator>\n");
+ }
+ if (!MI.Get(Stream_General, 0, General_DistributedBy).empty())
+ {
+ ToReturn+=_T("\t\t\t\t<mpeg7:Creator>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Role href=\"urn:mpeg:mpeg7:cs:RoleCS:2001:DISTRIBUTOR\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Agent xsi:type=\"PersonGroupType\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t<mpeg7:Name>")+MI.Get(Stream_General, 0, General_DistributedBy)+_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t</mpeg7:Agent>\n");
+ ToReturn+=_T("\t\t\t\t</mpeg7:Creator>\n");
+ }
+ if (!MI.Get(Stream_General, 0, General_Encoded_Library).empty())
+ {
+ ToReturn+=_T("\t\t\t\t<mpeg7:CreationTool>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:Tool>\n");
+ ToReturn+=_T("\t\t\t\t\t\t<mpeg7:Name>")+MI.Get(Stream_General, 0, General_Encoded_Library)+_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t</mpeg7:Tool>\n");
+ ToReturn+=_T("\t\t\t\t</mpeg7:CreationTool>\n");
+ }
+ ToReturn+=_T("\t\t\t</mpeg7:Creation>\n");
+ ToReturn+=_T("\t\t</mpeg7:CreationInformation>\n");
+ ToReturn+=_T("\t</mpeg7:Description>\n");
+ }
+
+ //Description - ContentEntity
+ ToReturn+=_T("\t<mpeg7:Description xsi:type=\"ContentEntityType\">\n");
+
+ //MultimediaContent
+ ToReturn+=_T("\t\t<mpeg7:MultimediaContent xsi:type=\""); ToReturn+=Mpeg7_Type(MI); ToReturn+=_T("Type\">\n");
+
+ //(Type)
+ ToReturn+=_T("\t\t\t<mpeg7:"); ToReturn+=Mpeg7_Type(MI); ToReturn+=_T(">\n");
+
+ //MediaFormat header
+ ToReturn+=_T("\t\t\t\t<mpeg7:MediaInformation>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:MediaProfile>\n");
+ ToReturn+=_T("\t\t\t\t\t\t<mpeg7:MediaFormat>\n");
+
+ //Content
+ ToReturn+=_T("\t\t\t\t\t\t\t<mpeg7:Content");
+ int32u ContentCS_termID=Mpeg7_ContentCS_termID(MI);
+ if (ContentCS_termID>=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<mpeg7:Name xml:lang=\"en\">"); ToReturn+=Mpeg7_ContentCS_Name(ContentCS_termID, MI); ToReturn+=_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t</mpeg7:Content>\n");
+
+ //FileFormat
+ if (!MI.Get(Stream_General, 0, General_Format).empty())
+ {
+ ToReturn+=_T("\t\t\t\t\t\t\t<mpeg7:FileFormat");
+ int32u FileFormatCS_termID=Mpeg7_FileFormatCS_termID(MI);
+ if (FileFormatCS_termID)
+ {
+ if (FileFormatCS_termID>=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<mpeg7:Name xml:lang=\"en\">"); ToReturn+=Mpeg7_FileFormatCS_Name((FileFormatCS_termID/10000)*10000, MI); ToReturn+=_T("</mpeg7:Name>\n");
+ if (FileFormatCS_termID%10000)
+ {
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t<mpeg7:Term termID=\"");
+ ToReturn+=Ztring::ToZtring(FileFormatCS_termID/10000);
+ ToReturn+=_T(".");
+ ToReturn+=Ztring::ToZtring((FileFormatCS_termID%10000)/100);
+ ToReturn+=_T("\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t<mpeg7:Name xml:lang=\"en\">"); ToReturn+=Mpeg7_FileFormatCS_Name((FileFormatCS_termID/100)*100, MI); ToReturn+=_T("</mpeg7:Name>\n");
+ if (FileFormatCS_termID%100)
+ {
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t<mpeg7:Term termID=\"");
+ ToReturn+=Ztring::ToZtring(FileFormatCS_termID/10000);
+ ToReturn+=_T(".");
+ ToReturn+=Ztring::ToZtring((FileFormatCS_termID%10000)/100);
+ ToReturn+=_T(".");
+ ToReturn+=Ztring::ToZtring(FileFormatCS_termID%100);
+ ToReturn+=_T("\">\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t\t<mpeg7:Name xml:lang=\"en\">"); ToReturn+=Mpeg7_FileFormatCS_Name(FileFormatCS_termID, MI); ToReturn+=_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t\t</mpeg7:Term>\n");
+ }
+ ToReturn+=_T("\t\t\t\t\t\t\t\t\t</mpeg7:Term>\n");
+ }
+ ToReturn+=_T("\t\t\t\t\t\t\t</mpeg7:FileFormat>\n");
+ }
+
+ //FileSize
+ ToReturn+=_T("\t\t\t\t\t\t\t<mpeg7:FileSize>"); ToReturn+=MI.Get(Stream_General, 0, General_FileSize); ToReturn+=_T("</mpeg7:FileSize>\n");
+
+ //System
+ if (!MI.Get(Stream_Video, 0, Video_Standard).empty())
+ {
+ ToReturn+=_T("\t\t\t\t\t\t\t<mpeg7:System");
+ int32u SystemCS_termID=Mpeg7_SystemCS_termID(MI, 0); //2 video streams are not supported
+ if (SystemCS_termID)
+ {
+ ToReturn+=_T(" href=\"urn:mpeg:mpeg7:cs:SystemCS:2001:");
+ ToReturn+=Ztring::ToZtring(SystemCS_termID/10000);
+ if (SystemCS_termID%10000)
+ {
+ ToReturn+=_T(".");
+ ToReturn+=Ztring::ToZtring((SystemCS_termID%10000)/100);
+ if (SystemCS_termID%100)
+ {
+ ToReturn+=_T(".");
+ ToReturn+=Ztring::ToZtring(SystemCS_termID%100);
+ }
+ }
+ ToReturn+=_T("\"");
+ }
+ ToReturn+=_T(">\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t\t<mpeg7:Name xml:lang=\"en\">"); ToReturn+=Mpeg7_SystemCS_Name(SystemCS_termID); ToReturn+=_T("</mpeg7:Name>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t</mpeg7:System>\n");
+ }
+
+ //BitRate
+ if (!MI.Get(Stream_General, 0, General_OverallBitRate).empty())
+ {
+ ToReturn+=_T("\t\t\t\t\t\t\t<mpeg7:BitRate");
+ bool IsCBR=true;
+ bool IsVBR=true;
+ for (size_t StreamKind=Stream_Video; StreamKind<=Stream_Audio; StreamKind++)
+ for (size_t StreamPos=0; StreamPos<MI.Count_Get((stream_t)StreamKind); StreamPos++)
+ {
+ if (IsCBR && MI.Get((stream_t)StreamKind, StreamPos, _T("BitRate_Mode"))==_T("VBR"))
+ IsCBR=false;
+ if (IsVBR && MI.Get((stream_t)StreamKind, StreamPos, _T("BitRate_Mode"))==_T("CBR"))
+ IsVBR=false;
+ }
+ if (IsCBR && IsVBR)
+ {
+ IsCBR=false;
+ IsVBR=false;
+ }
+ if (IsCBR)
+ ToReturn+=_T(" variable=\"false\"");
+ if (IsVBR)
+ ToReturn+=_T(" variable=\"true\"");
+ ToReturn+=_T(">"); ToReturn+=MI.Get(Stream_General, 0, General_OverallBitRate); ToReturn+=_T("</mpeg7:BitRate>\n");
+ }
+
+ //xxxCoding
+ for (size_t Pos=0; Pos<MI.Count_Get(Stream_Video); Pos++)
+ Mpeg7_Transform_Visual(ToReturn, MI, Pos);
+ for (size_t Pos=0; Pos<MI.Count_Get(Stream_Audio); Pos++)
+ Mpeg7_Transform_Audio(ToReturn, MI, Pos);
+
+ //MediaFormat header
+ ToReturn+=_T("\t\t\t\t\t\t</mpeg7:MediaFormat>\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<mpeg7:MediaTranscodingHints>\n");
+ ToReturn+=_T("\t\t\t\t\t\t\t<mpeg7:CodingHints");
+ if (!N.empty())
+ ToReturn+=_T(" intraFrameDistance=\"")+N;
+ if (!M.empty())
+ ToReturn+=_T("\" anchorFrameDistance=\"")+M;
+ ToReturn+=_T("\"/>\n");
+ ToReturn+=_T("\t\t\t\t\t\t</mpeg7:MediaTranscodingHints>\n");
+ }
+
+ ToReturn+=_T("\t\t\t\t\t</mpeg7:MediaProfile>\n");
+ ToReturn+=_T("\t\t\t\t</mpeg7:MediaInformation>\n");
+
+ if (MI.Count_Get(Stream_Video)==1 || MI.Count_Get(Stream_Audio)==1)
+ {
+ //MediaTimePoint
+ ToReturn+=_T("\t\t\t\t<mpeg7:MediaTime>\n");
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:MediaTimePoint>")+Mpeg7_MediaTimePoint(MI)+_T("</mpeg7:MediaTimePoint>\n");
+
+ //MediaDuration
+ ToReturn+=_T("\t\t\t\t\t<mpeg7:MediaDuration>"); ToReturn+=Mpeg7_MediaDuration(MI); ToReturn+=_T("</mpeg7:MediaDuration>\n");
+ ToReturn+=_T("\t\t\t\t</mpeg7:MediaTime>\n");
+ }
+
+ //Mpeg7 footer
+ ToReturn+=_T("\t\t\t</mpeg7:"); ToReturn+=Mpeg7_Type(MI); ToReturn+=_T(">\n");
+ ToReturn+=_T("\t\t</mpeg7:MultimediaContent>\n");
+ ToReturn+=_T("\t</mpeg7:Description>\n");
+ ToReturn+=_T("</mpeg7:Mpeg7>\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<ToReplace.size(); Pos++)
+ ToReturn.FindAndReplace(ToReplace[Pos][0], ToReplace[Pos][1], 0, Ztring_Recursive);
+
+ return ToReturn;
+}
+
+//***************************************************************************
+//
+//***************************************************************************
+
+} //NameSpace
diff --git a/src/thirdparty/MediaInfo/Export/Export_Mpeg7.h b/src/thirdparty/MediaInfo/Export/Export_Mpeg7.h
new file mode 100644
index 000000000..f2bdd3e30
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Export/Export_Mpeg7.h
@@ -0,0 +1,52 @@
+// Reader_File - All information about media files
+// Copyright (C) 2009-2009 Jerome Martinez, Zen@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Convert to MPEG-7 XML
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef Export_Mpeg7H
+#define Export_Mpeg7H
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/MediaInfo_Internal.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+/// @brief Export_Mpeg7
+//***************************************************************************
+
+class Export_Mpeg7
+{
+public :
+ //Constructeur/Destructeur
+ Export_Mpeg7 ();
+ ~Export_Mpeg7 ();
+
+ //Input
+ Ztring Transform(MediaInfo_Internal &MI);
+};
+
+} //NameSpace
+#endif
diff --git a/src/thirdparty/MediaInfo/Export/Export_PBCore.cpp b/src/thirdparty/MediaInfo/Export/Export_PBCore.cpp
new file mode 100644
index 000000000..4778035aa
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Export/Export_PBCore.cpp
@@ -0,0 +1,399 @@
+// File__Analyze - Base for analyze files
+// Copyright (C) 2009-2009 Jerome Martinez, Zen@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Export/Export_PBCore.h"
+#include "MediaInfo/File__Analyse_Automatic.h"
+#include <ctime>
+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__Common_Begin(Ztring &ToReturn, MediaInfo_Internal &MI, stream_t StreamKind, size_t StreamPos)
+{
+ //essenceTrackIdentifier
+ if (!MI.Get(StreamKind, StreamPos, _T("ID")).empty())
+ {
+ ToReturn+=_T("\t\t\t<essenceTrackIdentifier>")+MI.Get(StreamKind, StreamPos, _T("ID"))+_T("</essenceTrackIdentifier>\n");
+ ToReturn+=_T("\t\t\t<essenceTrackIdentifierSource>ID (Mediainfo)</essenceTrackIdentifierSource>\n");
+ }
+ else if (!MI.Get(StreamKind, StreamPos, _T("UniqueID")).empty())
+ {
+ ToReturn+=_T("\t\t\t<essenceTrackIdentifier>")+MI.Get(StreamKind, StreamPos, _T("UniqueID"))+_T("</essenceTrackIdentifier>\n");
+ ToReturn+=_T("\t\t\t<essenceTrackIdentifierSource>UniqueID (Mediainfo)</essenceTrackIdentifierSource>\n");
+ }
+ else if (!MI.Get(StreamKind, StreamPos, _T("StreamKindID")).empty())
+ {
+ ToReturn+=_T("\t\t\t<essenceTrackIdentifier>")+MI.Get(StreamKind, StreamPos, _T("StreamKindID"))+_T("</essenceTrackIdentifier>\n");
+ ToReturn+=_T("\t\t\t<essenceTrackIdentifierSource>StreamKindID (Mediainfo)</essenceTrackIdentifierSource>\n");
+ }
+
+ //essenceTrackStandard
+ if (StreamKind==Stream_Video && !MI.Get(Stream_Video, StreamPos, Video_Standard).empty()) //Video only, but must be placed here
+ ToReturn+=_T("\t\t\t<essenceTrackStandard>")+MI.Get(Stream_Video, StreamPos, Video_Standard)+_T("</essenceTrackStandard>\n");
+
+ //essenceTrackLanguage
+ if (!MI.Get(StreamKind, StreamPos, _T("Language")).empty())
+ ToReturn+=_T("\t\t\t<essenceTrackLanguage>")+MediaInfoLib::Config.Iso639_2_Get(MI.Get(StreamKind, StreamPos, _T("Language")))+_T("</essenceTrackLanguage>\n");
+
+ //essenceTrackEncoding
+ if (!MI.Get(StreamKind, StreamPos, _T("Format")).empty())
+ {
+ ToReturn+=_T("\t\t\t<essenceTrackEncoding>");
+ 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("</essenceTrackEncoding>\n");
+ }
+
+ //essenceTrackDataRate
+ if (!MI.Get(StreamKind, StreamPos, _T("BitRate")).empty())
+ {
+ ToReturn+=_T("\t\t\t<essenceTrackDataRate>");
+ 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("</essenceTrackDataRate>\n");
+ }
+
+ //essenceTrackDuration
+ if (!MI.Get(StreamKind, StreamPos, _T("Duration")).empty())
+ ToReturn+=_T("\t\t\t<essenceTrackDuration>")+MI.Get(StreamKind, StreamPos, _T("Duration"))+_T("</essenceTrackDuration>\n");
+
+ //essenceTrackBitDepth
+ if (!MI.Get(StreamKind, StreamPos, _T("Resolution")).empty())
+ ToReturn+=_T("\t\t\t<essenceTrackBitDepth version=\"PBCoreXSD_Ver_1.2_D1\">")+MI.Get(StreamKind, StreamPos, _T("Resolution"))+_T("</essenceTrackBitDepth>\n");
+}
+
+//---------------------------------------------------------------------------
+void PBCore_Transform__Common_End(Ztring &ToReturn, MediaInfo_Internal &MI, stream_t StreamKind, size_t StreamPos)
+{
+ //essenceTrackAnnotation - all fields (except *_String*) separated by |
+ Ztring Temp;
+ for (size_t Pos=0; Pos<MI.Count_Get(StreamKind, StreamPos); Pos++)
+ if (MI.Get(StreamKind, StreamPos, Pos, Info_Name).find(_T("String"))==std::string::npos && !MI.Get(StreamKind, StreamPos, Pos).empty())
+ Temp+=MI.Get(StreamKind, StreamPos, Pos, Info_Name)+_T(": ")+MI.Get(StreamKind, StreamPos, Pos)+_T('|');
+ if (!Temp.empty())
+ {
+ Temp.resize(Temp.size()-1);
+ ToReturn+=_T("\t\t\t<essenceTrackAnnotation>"); ToReturn+=Temp; ToReturn+=_T("</essenceTrackAnnotation>\n");
+ }
+}
+
+//---------------------------------------------------------------------------
+void PBCore_Transform_Video(Ztring &ToReturn, MediaInfo_Internal &MI, size_t StreamPos)
+{
+ ToReturn+=_T("\t\t<pbcoreEssenceTrack>\n");
+
+ //essenceTrackType
+ ToReturn+=_T("\t\t\t<essenceTrackType>Video</essenceTrackType>\n");
+
+ //Common
+ PBCore_Transform__Common_Begin(ToReturn, MI, Stream_Video, StreamPos);
+
+ //essenceTrackFrameSize
+ if (!MI.Get(Stream_Video, StreamPos, Video_Width).empty())
+ ToReturn+=_T("\t\t\t<essenceTrackFrameSize>")+MI.Get(Stream_Video, StreamPos, Video_Width)+_T('x')+MI.Get(Stream_Video, StreamPos, Video_Height)+_T("</essenceTrackFrameSize>\n");
+
+ //essenceTrackAspectRatio
+ if (!MI.Get(Stream_Video, StreamPos, Video_DisplayAspectRatio).empty())
+ ToReturn+=_T("\t\t\t<essenceTrackAspectRatio>")+MI.Get(Stream_Video, StreamPos, Video_DisplayAspectRatio)+_T("</essenceTrackAspectRatio>\n");
+
+ //essenceTrackFrameRate
+ if (!MI.Get(Stream_Video, StreamPos, Video_FrameRate).empty())
+ {
+ ToReturn+=_T("\t\t\t<essenceTrackFrameRate>");
+ 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("</essenceTrackFrameRate>\n");
+ }
+
+ //Comon
+ PBCore_Transform__Common_End(ToReturn, MI, Stream_Video, StreamPos);
+
+ ToReturn+=_T("\t\t</pbcoreEssenceTrack>\n");
+}
+
+//---------------------------------------------------------------------------
+void PBCore_Transform_Audio(Ztring &ToReturn, MediaInfo_Internal &MI, size_t StreamPos)
+{
+ ToReturn+=_T("\t\t<pbcoreEssenceTrack>\n");
+
+ //essenceTrackType
+ ToReturn+=_T("\t\t\t<essenceTrackType>Audio</essenceTrackType>\n");
+
+ //Common
+ PBCore_Transform__Common_Begin(ToReturn, MI, Stream_Audio, StreamPos);
+
+ if (!MI.Get(Stream_Audio, StreamPos, Audio_SamplingRate).empty())
+ ToReturn+=_T("\t\t\t<essenceTrackSamplingRate>")+MI.Get(Stream_Audio, StreamPos, Audio_SamplingRate)+_T("</essenceTrackSamplingRate>\n");
+
+ //Comon
+ PBCore_Transform__Common_End(ToReturn, MI, Stream_Audio, StreamPos);
+
+ ToReturn+=_T("\t\t</pbcoreEssenceTrack>\n");
+}
+
+//---------------------------------------------------------------------------
+void PBCore_Transform_Text(Ztring &ToReturn, MediaInfo_Internal &MI, size_t StreamPos)
+{
+ //Init
+ Ztring Format=MI.Get(Stream_Text, StreamPos, Text_Format);
+
+ ToReturn+=_T("\t\t<pbcoreEssenceTrack>\n");
+
+ //essenceTrackType
+ ToReturn+=_T("\t\t\t<essenceTrackType>");
+ if (Format==_T("EIA-608") || Format==_T("EIA-708"))
+ ToReturn+=_T("caption");
+ else
+ ToReturn+=_T("text");
+ ToReturn+=_T("</essenceTrackType>\n");
+
+ //Common
+ PBCore_Transform__Common_Begin(ToReturn, MI, Stream_Text, StreamPos);
+
+ //Common
+ PBCore_Transform__Common_End(ToReturn, MI, Stream_Text, StreamPos);
+
+ ToReturn+=_T("\t\t</pbcoreEssenceTrack>\n");
+}
+
+//---------------------------------------------------------------------------
+void PBCore_Transform_Menu(Ztring &ToReturn, MediaInfo_Internal &MI, size_t StreamPos)
+{
+ //Only if TimeCode
+ if (MI.Get(Stream_Menu, StreamPos, Menu_Format)!=_T("TimeCode"))
+ return;
+
+ ToReturn+=_T("\t\t<pbcoreEssenceTrack>\n");
+
+ //essenceTrackType
+ ToReturn+=_T("\t\t\t<essenceTrackType>timecode</essenceTrackType>\n");
+
+ //Common
+ PBCore_Transform__Common_Begin(ToReturn, MI, Stream_Menu, StreamPos);
+
+ //Common
+ PBCore_Transform__Common_End(ToReturn, MI, Stream_Menu, StreamPos);
+
+ ToReturn+=_T("\t\t</pbcoreEssenceTrack>\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("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ ToReturn+=_T("<PBCoreDescriptionDocument xsi:schemaLocation=\"http://www.pbcore.org/PBCore/PBCoreNamespace.html http://www.pbcore.org/PBCore/PBCoreXSD_Ver_1-2-1.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.pbcore.org/PBCore/PBCoreNamespace.html\">\n");
+ ToReturn+=_T("\t<!-- Generated at ")+TimeS+_T(" by ")+MediaInfoLib::Config.Info_Version_Get()+_T(" -->\n");
+ ToReturn+=_T("\t<!-- Warning: MediaInfo outputs only pbcoreInstantiation, other mandatory PBCore data is junk -->\n");
+ ToReturn+=_T("\t<pbcoreIdentifier>\n");
+ ToReturn+=_T("\t\t<identifier>***</identifier>\n");
+ ToReturn+=_T("\t\t<identifierSource>***</identifierSource>\n");
+ ToReturn+=_T("\t</pbcoreIdentifier>\n");
+ ToReturn+=_T("\t<pbcoreTitle>\n");
+ ToReturn+=_T("\t\t<title>***</title>\n");
+ ToReturn+=_T("\t</pbcoreTitle>\n");
+ ToReturn+=_T("\t<pbcoreDescription>\n");
+ ToReturn+=_T("\t\t<description>***</description>\n");
+ ToReturn+=_T("\t\t<descriptionType>***</descriptionType>\n");
+ ToReturn+=_T("\t</pbcoreDescription>\n");
+ ToReturn+=_T("\t<pbcoreInstantiation>\n");
+
+
+ //pbcoreFormatID
+ ToReturn+=_T("\t\t<pbcoreFormatID>\n");
+ //formatIdentifier
+ ToReturn+=_T("\t\t\t<formatIdentifier>")+MI.Get(Stream_General, 0, General_FileName)+_T("</formatIdentifier>\n");
+ //formatIdentifierSource
+ ToReturn+=_T("\t\t\t<formatIdentifierSource version=\"PBCoreXSD_Ver_1.2_D1\">File Name</formatIdentifierSource>\n");
+ ToReturn+=_T("\t\t</pbcoreFormatID>\n");
+
+ //formatDigital
+ if (!MI.Get(Stream_General, 0, General_InternetMediaType).empty())
+ {
+ ToReturn+=_T("\t\t<formatDigital>");
+ ToReturn+=MI.Get(Stream_General, 0, General_InternetMediaType);
+ ToReturn+=_T("</formatDigital>\n");
+ }
+ else
+ {
+ //TODO: how to implement formats without Media Type?
+ ToReturn+=_T("\t\t<formatDigital>");
+ 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("</formatDigital>\n");
+ }
+
+ //formatLocation
+ ToReturn+=_T("\t\t<formatLocation>")+MI.Get(Stream_General, 0, General_CompleteName)+_T("</formatLocation>\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>")+dateCreated+_T("</dateCreated>\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>")+dateIssued+_T("</dateIssued>\n");
+ }
+
+ //formatMediaType
+ if (!PBCore_MediaType(MI).empty())
+ ToReturn+=_T("\t\t<formatMediaType version=\"PBCoreXSD_Ver_1.2_D1\">")+PBCore_MediaType(MI)+_T("</formatMediaType>\n");
+ else
+ ToReturn+=_T("\t\t<formatMediaType version=\"PBCoreXSD_Ver_1.2_D1\">application/octet-stream</formatMediaType>\n");
+
+ //formatGenerations
+ ToReturn+=_T("\t\t<formatGenerations version=\"PBCoreXSD_Ver_1.2_D1\" />\n");
+
+ //formatFileSize
+ if (!MI.Get(Stream_General, 0, General_FileSize).empty())
+ ToReturn+=_T("\t\t<formatFileSize>")+MI.Get(Stream_General, 0, General_FileSize)+_T("</formatFileSize>\n");
+
+ //formatTimeStart
+ if (!MI.Get(Stream_Video, 0, Video_Delay_Original_String3).empty())
+ ToReturn+=_T("\t\t<formatTimeStart>")+MI.Get(Stream_Video, 0, Video_Delay_Original_String3)+_T("</formatTimeStart>\n");
+ else if (!MI.Get(Stream_Video, 0, Video_Delay_String3).empty())
+ ToReturn+=_T("\t\t<formatTimeStart>")+MI.Get(Stream_Video, 0, Video_Delay_String3)+_T("</formatTimeStart>\n");
+
+ //formatDuration
+ if (!MI.Get(Stream_General, 0, General_Duration_String3).empty())
+ ToReturn+=_T("\t\t<formatDuration>")+MI.Get(Stream_General, 0, General_Duration_String3)+_T("</formatDuration>\n");
+
+ //formatDataRate
+ if (!MI.Get(Stream_General, 0, General_OverallBitRate).empty())
+ {
+ ToReturn+=_T("\t\t<formatDataRate>");
+ 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("</formatDataRate>\n");
+ }
+
+ //formatTracks
+ ToReturn+=_T("\t\t<formatTracks>")+Ztring::ToZtring(MI.Count_Get(Stream_Video)+MI.Count_Get(Stream_Audio)+MI.Count_Get(Stream_Image)+MI.Count_Get(Stream_Text))+_T("</formatTracks>\n");
+
+ //Video streams
+ for (size_t StreamPos=0; StreamPos<MI.Count_Get(Stream_Video); StreamPos++)
+ PBCore_Transform_Video(ToReturn, MI, StreamPos);
+
+ //Audio streams
+ for (size_t StreamPos=0; StreamPos<MI.Count_Get(Stream_Audio); StreamPos++)
+ PBCore_Transform_Audio(ToReturn, MI, StreamPos);
+
+ //Text streams
+ for (size_t StreamPos=0; StreamPos<MI.Count_Get(Stream_Text); StreamPos++)
+ PBCore_Transform_Text(ToReturn, MI, StreamPos);
+
+ //Menu streams
+ for (size_t StreamPos=0; StreamPos<MI.Count_Get(Stream_Menu); StreamPos++)
+ PBCore_Transform_Menu(ToReturn, MI, StreamPos);
+
+ ToReturn+=_T("\t</pbcoreInstantiation>\n");
+ ToReturn+=_T("</PBCoreDescriptionDocument>\n");
+
+ //Carriage return
+ ToReturn.FindAndReplace(_T("\n"), EOL, 0, Ztring_Recursive);
+
+ return ToReturn;
+}
+
+//***************************************************************************
+//
+//***************************************************************************
+
+} //NameSpace
diff --git a/src/thirdparty/MediaInfo/Export/Export_PBCore.h b/src/thirdparty/MediaInfo/Export/Export_PBCore.h
new file mode 100644
index 000000000..8cedb7648
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Export/Export_PBCore.h
@@ -0,0 +1,52 @@
+// Reader_File - All information about media files
+// Copyright (C) 2009-2009 Jerome Martinez, Zen@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Convert to PBCore XML
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#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
diff --git a/src/thirdparty/MediaInfo/File_Dummy.cpp b/src/thirdparty/MediaInfo/File_Dummy.cpp
new file mode 100644
index 000000000..7ba53511d
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File_Dummy.cpp
@@ -0,0 +1,322 @@
+// File_Dummy - Fill with Name of tags
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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://mediainfo.sourceforge.net");
+ Stream_Prepare(Stream_Video);
+ Fill(Stream_Video, 0, Video_Codec, "XVID");
+ Fill(Stream_Video, 0, Video_Codec_Url, "http://mediainfo.sourceforge.net");
+ 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_Resolution, "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://mediainfo.sourceforge.net");
+ 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://mediainfo.sourceforge.net");
+ Fill(Stream_Text, 0, Text_Language, "en");
+ Fill(Stream_Text, 0, Text_Language_More, "Forced");
+ Stream_Prepare(Stream_Chapters);
+ Fill(Stream_Chapters, 0, Chapters_Total, "16");
+ Fill(Stream_Chapters, 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://mediainfo.sourceforge.net");
+ 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_Resolution, "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_Resolution, "Resolution");
+ 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_Chapters);
+ Fill(Stream_Chapters, 0, Chapters_ID, "ID");
+ Fill(Stream_Chapters, 0, Chapters_UniqueID, "UniqueID");
+ Fill(Stream_Chapters, 0, Chapters_Title, "Title");
+ Fill(Stream_Chapters, 0, Chapters_Total, "Total");
+ Fill(Stream_Chapters, 0, Chapters_Language, "de");
+}
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/File_Dummy.h b/src/thirdparty/MediaInfo/File_Dummy.h
new file mode 100644
index 000000000..00b0af090
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File_Dummy.h
@@ -0,0 +1,60 @@
+// File_Dummy - Fill with Name of tags
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/File_Other.cpp b/src/thirdparty/MediaInfo/File_Other.cpp
new file mode 100644
index 000000000..fe8e65b64
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File_Other.cpp
@@ -0,0 +1,186 @@
+// File_Other - Use magic number to detect only the format
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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)
+ 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)==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)==0x7442614B) //"tBaK"
+ {
+ Accept("TAK");
+
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, 0, Audio_Format, "TAK");
+
+ Finish("TAK");
+ return;
+ }
+ else if (CC4(Buffer)==CC4("")) {Format=_T("");}
+
+ if (Format.empty())
+ {
+ Reject();
+ return;
+ }
+
+ Accept();
+
+ Fill(Stream_General, 0, General_Format, Format);
+
+ Finish();
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_OTHER_YES
diff --git a/src/thirdparty/MediaInfo/File_Other.h b/src/thirdparty/MediaInfo/File_Other.h
new file mode 100644
index 000000000..aa0752230
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File_Other.h
@@ -0,0 +1,51 @@
+// File_Other - Use magic number to detect only the format
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/File_Unknown.cpp b/src/thirdparty/MediaInfo/File_Unknown.cpp
new file mode 100644
index 000000000..6846d137c
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File_Unknown.cpp
@@ -0,0 +1,56 @@
+// File_Unknown - Empty container
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_UNKNOWN_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File_Unknown.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Unknown::Read_Buffer_Init()
+{
+ Accept("Unknown");
+ Finish("Unknown");
+}
+
+//***************************************************************************
+//
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_UNKNOWN_YES
diff --git a/src/thirdparty/MediaInfo/File_Unknown.h b/src/thirdparty/MediaInfo/File_Unknown.h
new file mode 100644
index 000000000..e61cf8f32
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File_Unknown.h
@@ -0,0 +1,51 @@
+// File_Unknown - Empty container
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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 ();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/File__Analyse_Automatic.h b/src/thirdparty/MediaInfo/File__Analyse_Automatic.h
new file mode 100644
index 000000000..55484e2fc
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File__Analyse_Automatic.h
@@ -0,0 +1,982 @@
+// Enums - Automaticly generated enums for MediaInfo
+// Copyright (C) 2008-2008 Jerome Martinez, Zen@MediaArea.net
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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_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_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_ColorSpace,
+ Generic_ChromaSubsampling,
+ Generic_Resolution,
+ Generic_Resolution_String,
+ Generic_BitDepth,
+ Generic_BitDepth_String,
+ Generic_StreamSize,
+ Generic_StreamSize_String,
+ Generic_StreamSize_String1,
+ Generic_StreamSize_String2,
+ Generic_StreamSize_String3,
+ Generic_StreamSize_String4,
+ Generic_StreamSize_String5,
+ Generic_StreamSize_Proportion,
+};
+
+//---------------------------------------------------------------------------
+enum general
+{
+ General_Count,
+ General_StreamCount,
+ General_StreamKind,
+ General_StreamKind_String,
+ General_StreamKindID,
+ General_StreamKindPos,
+ General_Inform,
+ General_ID,
+ General_ID_String,
+ General_UniqueID,
+ General_MenuID,
+ General_MenuID_String,
+ General_GeneralCount,
+ General_VideoCount,
+ General_AudioCount,
+ General_TextCount,
+ General_ChaptersCount,
+ 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_Chapters_Format_List,
+ General_Chapters_Format_WithHint_List,
+ General_Chapters_Codec_List,
+ General_Chapters_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_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_Settings,
+ General_InternetMediaType,
+ General_CodecID,
+ 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_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_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_Chapter,
+ General_SubTrack,
+ General_Original_Album,
+ General_Original_Movie,
+ General_Original_Part,
+ General_Original_Track,
+ 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_StreamCount,
+ Video_StreamKind,
+ Video_StreamKind_String,
+ Video_StreamKindID,
+ Video_StreamKindPos,
+ Video_Inform,
+ Video_ID,
+ Video_ID_String,
+ Video_UniqueID,
+ 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_MultiView_BaseProfile,
+ Video_MultiView_Count,
+ 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_InternetMediaType,
+ Video_MuxingMode,
+ Video_CodecID,
+ 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_LastFrame,
+ Video_Duration_LastFrame_String,
+ Video_Duration_LastFrame_String1,
+ Video_Duration_LastFrame_String2,
+ Video_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_Width,
+ Video_Width_String,
+ Video_Width_Original,
+ Video_Width_Original_String,
+ Video_Height,
+ Video_Height_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_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_Standard,
+ Video_Resolution,
+ Video_Resolution_String,
+ Video_Colorimetry,
+ Video_ColorSpace,
+ Video_ChromaSubsampling,
+ Video_BitDepth,
+ Video_BitDepth_String,
+ Video_ScanType,
+ Video_ScanType_String,
+ Video_ScanOrder,
+ Video_ScanOrder_String,
+ Video_Interlacement,
+ Video_Interlacement_String,
+ 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_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_StreamSize,
+ Video_StreamSize_String,
+ Video_StreamSize_String1,
+ Video_StreamSize_String2,
+ Video_StreamSize_String3,
+ Video_StreamSize_String4,
+ Video_StreamSize_String5,
+ Video_StreamSize_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_Encoded_Date,
+ Video_Tagged_Date,
+ Video_Encryption,
+ Video_BufferSize,
+};
+
+//---------------------------------------------------------------------------
+enum audio
+{
+ Audio_Count,
+ Audio_StreamCount,
+ Audio_StreamKind,
+ Audio_StreamKind_String,
+ Audio_StreamKindID,
+ Audio_StreamKindPos,
+ Audio_Inform,
+ Audio_ID,
+ Audio_ID_String,
+ Audio_UniqueID,
+ 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_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_InternetMediaType,
+ Audio_MuxingMode,
+ Audio_MuxingMode_MoreInfo,
+ Audio_CodecID,
+ 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_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_Channel_s_,
+ Audio_Channel_s__String,
+ Audio_ChannelPositions,
+ Audio_ChannelPositions_String2,
+ Audio_SamplingRate,
+ Audio_SamplingRate_String,
+ Audio_SamplingCount,
+ Audio_FrameCount,
+ Audio_Resolution,
+ Audio_Resolution_String,
+ Audio_BitDepth,
+ Audio_BitDepth_String,
+ Audio_CompressionRatio,
+ Audio_Delay,
+ Audio_Delay_String,
+ Audio_Delay_String1,
+ Audio_Delay_String2,
+ Audio_Delay_String3,
+ Audio_Delay_Original,
+ Audio_Delay_Original_String,
+ Audio_Delay_Original_String1,
+ Audio_Delay_Original_String2,
+ Audio_Delay_Original_String3,
+ Audio_Delay_Original_Settings,
+ Audio_Video_Delay,
+ Audio_Video_Delay_String,
+ Audio_Video_Delay_String1,
+ Audio_Video_Delay_String2,
+ Audio_Video_Delay_String3,
+ Audio_Video0_Delay,
+ Audio_Video0_Delay_String,
+ Audio_Video0_Delay_String1,
+ Audio_Video0_Delay_String2,
+ Audio_Video0_Delay_String3,
+ 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_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_Encoded_Date,
+ Audio_Tagged_Date,
+ Audio_Encryption,
+};
+
+//---------------------------------------------------------------------------
+enum text
+{
+ Text_Count,
+ Text_StreamCount,
+ Text_StreamKind,
+ Text_StreamKind_String,
+ Text_StreamKindID,
+ Text_StreamKindPos,
+ Text_Inform,
+ Text_ID,
+ Text_ID_String,
+ Text_UniqueID,
+ 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_Settings,
+ Text_InternetMediaType,
+ Text_MuxingMode,
+ Text_MuxingMode_MoreInfo,
+ Text_CodecID,
+ 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_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_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_ColorSpace,
+ Text_ChromaSubsampling,
+ Text_Resolution,
+ Text_Resolution_String,
+ Text_BitDepth,
+ Text_BitDepth_String,
+ Text_Delay,
+ Text_Delay_String,
+ Text_Delay_String1,
+ Text_Delay_String2,
+ Text_Delay_String3,
+ Text_Delay_Original,
+ Text_Delay_Original_String,
+ Text_Delay_Original_String1,
+ Text_Delay_Original_String2,
+ Text_Delay_Original_String3,
+ Text_Delay_Original_Settings,
+ Text_Video_Delay,
+ Text_Video_Delay_String,
+ Text_Video_Delay_String1,
+ Text_Video_Delay_String2,
+ Text_Video_Delay_String3,
+ Text_Video0_Delay,
+ Text_Video0_Delay_String,
+ Text_Video0_Delay_String1,
+ Text_Video0_Delay_String2,
+ Text_Video0_Delay_String3,
+ Text_StreamSize,
+ Text_StreamSize_String,
+ Text_StreamSize_String1,
+ Text_StreamSize_String2,
+ Text_StreamSize_String3,
+ Text_StreamSize_String4,
+ Text_StreamSize_String5,
+ Text_StreamSize_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_Summary,
+ Text_Encoded_Date,
+ Text_Tagged_Date,
+ Text_Encryption,
+};
+
+//---------------------------------------------------------------------------
+enum chapters
+{
+ Chapters_Count,
+ Chapters_StreamCount,
+ Chapters_StreamKind,
+ Chapters_StreamKind_String,
+ Chapters_StreamKindID,
+ Chapters_StreamKindPos,
+ Chapters_Inform,
+ Chapters_ID,
+ Chapters_ID_String,
+ Chapters_UniqueID,
+ Chapters_MenuID,
+ Chapters_MenuID_String,
+ Chapters_Format,
+ Chapters_Format_Info,
+ Chapters_Format_Url,
+ Chapters_Codec,
+ Chapters_Codec_String,
+ Chapters_Codec_Info,
+ Chapters_Codec_Url,
+ Chapters_Total,
+ Chapters_Title,
+ Chapters_Language,
+ Chapters_Language_String,
+};
+
+//---------------------------------------------------------------------------
+enum image
+{
+ Image_Count,
+ Image_StreamCount,
+ Image_StreamKind,
+ Image_StreamKind_String,
+ Image_StreamKindID,
+ Image_StreamKindPos,
+ Image_Inform,
+ Image_ID,
+ Image_ID_String,
+ Image_UniqueID,
+ 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_Settings,
+ Image_InternetMediaType,
+ Image_CodecID,
+ 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_Height,
+ Image_Height_String,
+ Image_ColorSpace,
+ Image_ChromaSubsampling,
+ Image_Resolution,
+ Image_Resolution_String,
+ Image_BitDepth,
+ Image_BitDepth_String,
+ 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_Summary,
+ Image_Encoded_Date,
+ Image_Tagged_Date,
+ Image_Encryption,
+};
+
+//---------------------------------------------------------------------------
+enum menu
+{
+ Menu_Count,
+ Menu_StreamCount,
+ Menu_StreamKind,
+ Menu_StreamKind_String,
+ Menu_StreamKindID,
+ Menu_StreamKindPos,
+ Menu_Inform,
+ Menu_ID,
+ Menu_ID_String,
+ Menu_UniqueID,
+ 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_Settings,
+ Menu_CodecID,
+ 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_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_Chapters_Pos_Begin,
+ Menu_Chapters_Pos_End,
+};
+
+} //NameSpace
+#endif
diff --git a/src/thirdparty/MediaInfo/File__Analyze.cpp b/src/thirdparty/MediaInfo/File__Analyze.cpp
new file mode 100644
index 000000000..56ba7a278
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File__Analyze.cpp
@@ -0,0 +1,2298 @@
+// File__Analyze - Base for analyze files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include "MediaInfo/MediaInfo_Config_MediaInfo.h"
+#include "MediaInfo/MediaInfo_Config.h"
+#include <cstring>
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//---------------------------------------------------------------------------
+extern MediaInfo_Config Config;
+//---------------------------------------------------------------------------
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File__Analyze::File__Analyze ()
+:File__Base()
+{
+ //Details
+ #if MEDIAINFO_TRACE
+ Config_DetailsLevel=MediaInfoLib::Config.DetailsLevel_Get();
+ Details_DoNotSave=false;
+ #endif //MEDIAINFO_TRACE
+ IsSub=false;
+ IsRawStream=false;
+
+ //In
+ #if MEDIAINFO_EVENTS
+ StreamIDs_Size=1;
+ StreamIDs_Width[0]=(int8u)-1;
+ #endif //MEDIAINFO_EVENTS
+ PTS_DTS_Needed=false;
+ PTS_DTS_Offset_InThisBlock=0;
+ PCR=(int64u)-1;
+ PTS=(int64u)-1;
+ DTS=(int64u)-1;
+
+ //Out
+ Frame_Count_InThisBlock=0;
+
+ //Configuration
+ DataMustAlwaysBeComplete=true;
+ MustUseAlternativeParser=false;
+ MustSynchronize=false;
+
+ //Buffer
+ 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=1024*1024;
+ Buffer_TotalBytes_FirstSynched=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;
+
+ //EOF
+ EOF_AlreadyDetected=false;
+
+ //Synchro
+ MustParseTheHeaderFile=true;
+ Synched=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_DetailsLevel!=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;
+
+ //Temp
+ Status[IsAccepted]=false;
+ Status[IsFilled]=false;
+ Status[IsUpdated]=false;
+ Status[IsFinished]=false;
+ ShouldContinueParsing=false;
+
+ //Events data
+ #if MEDIAINFO_EVENTS
+ MpegPs_PES_FirstByte_IsAvailable=false;
+ #endif //MEDIAINFO_EVENTS
+}
+
+//---------------------------------------------------------------------------
+File__Analyze::~File__Analyze ()
+{
+ //Buffer
+ delete[] Buffer_Temp; //Buffer_Temp=NULL;
+
+ //BitStream
+ delete BS; //BS=NULL;
+}
+
+//***************************************************************************
+// 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)
+ {
+ Synched=false;
+ File_GoTo=(int64u)-1;
+ Buffer_Clear();
+ }
+
+ //Configuring
+ if (MediaInfoLib::Config.FormatDetection_MaximumOffset_Get())
+ Buffer_TotalBytes_FirstSynched_Max=MediaInfoLib::Config.FormatDetection_MaximumOffset_Get();
+ if (Config->File_IsSub_Get())
+ IsSub=true;
+}
+
+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
+ Sub->IsSub=true;
+ Sub->Open_Buffer_Init(File_Size_);
+
+ #if MEDIAINFO_EVENTS
+ Sub->ParserIDs[StreamIDs_Size]=Sub->ParserIDs[0];
+ Sub->StreamIDs_Width[StreamIDs_Size]=Sub->StreamIDs_Width[0];
+ for (size_t Pos=0; Pos<StreamIDs_Size; Pos++)
+ {
+ Sub->ParserIDs[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->File_Name_WithoutDemux=IsSub?File_Name_WithoutDemux:File_Name;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Open_Buffer_Continue (const int8u* ToAdd, size_t ToAdd_Size)
+{
+ Frame_Count_InThisBlock=0; //Out
+
+ //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)
+ return; //Seek must be done before
+ if (File_GoTo>=File_Offset+ToAdd_Size)
+ {
+ File_Offset+=ToAdd_Size;
+ return; //No need of this piece of data
+ }
+
+ //The needed offset is in the new buffer
+ ToAdd+=(size_t)(File_GoTo-File_Offset);
+ ToAdd_Size-=(size_t)(File_GoTo-File_Offset);
+ File_Offset=File_GoTo;
+ File_GoTo=(int64u)-1;
+ }
+
+ 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_ToAdd<Buffer_Temp_Size_Max) Buffer_Temp_Size_Max_ToAdd=Buffer_Temp_Size_Max;
+ Buffer_Temp_Size_Max+=Buffer_Temp_Size_Max_ToAdd;
+ Buffer_Temp=new int8u[Buffer_Temp_Size_Max];
+ std::memcpy(Buffer_Temp, Old, Buffer_Temp_Size);
+ delete[] Old; //Old=NULL;
+ }
+
+ //Copying buffer
+ if (ToAdd_Size>0)
+ {
+ 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
+ Buffer_Offset=0;
+ Trusted=(Buffer_Size>2*8*1024?Buffer_Size/8/1024:2)*Trusted_Multiplier; //Never less than 2 acceptable errors
+
+ //Parsing
+ if (Buffer_Size>=Buffer_MinimumSize || File_Offset+Buffer_Size==File_Size) //Parsing only if we have enough buffer
+ Open_Buffer_Continue_Loop();
+ Buffer_TotalBytes+=Buffer_Offset;
+
+ //Should parse again?
+ if ((File_GoTo==File_Size && File_Size!=(int64u)-1) || File_Offset+Buffer_Offset>=File_Size)
+ {
+ 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_End(); //This is Finish, must flush
+ 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;
+ File_Offset+=Buffer_Size;
+ Buffer_Clear();
+ }
+ else
+ File_Offset+=Buffer_Offset;
+
+ return;
+ }
+ if (Buffer_Offset>=Buffer_Size)
+ {
+ if (Buffer_Offset>Buffer_Size)
+ File_GoTo=File_Offset+Buffer_Offset;
+ if (!Status[IsFinished])
+ File_Offset+=Buffer_Size;
+ Buffer_Clear();
+ return;
+ }
+
+ //Buffer handling
+ if (Buffer_Offset!=Buffer_Size) //all is not used
+ {
+ if (File_Offset+Buffer_Size>=File_Size) //No more data will come
+ {
+ ForceFinish();
+ return;
+ }
+ if (Buffer_Temp_Size==0) //If there was no copy
+ {
+ if (Buffer_Temp!=NULL && Buffer_Temp_Size_Max<ToAdd_Size-Buffer_Offset)
+ {
+ delete[] Buffer_Temp; Buffer_Temp=NULL; Buffer_Temp_Size=0; Buffer_Temp_Size_Max=0;
+ }
+ if (Buffer_Temp==NULL)
+ {
+ size_t Buffer_Temp_Size_Max_ToAdd=ToAdd_Size-Buffer_Offset>32768?ToAdd_Size-Buffer_Offset:32768;
+ if (Buffer_Temp_Size_Max_ToAdd<Buffer_Temp_Size_Max) Buffer_Temp_Size_Max_ToAdd=Buffer_Temp_Size_Max;
+ Buffer_Temp_Size_Max=Buffer_Temp_Size_Max_ToAdd;
+ Buffer_Temp=new int8u[Buffer_Temp_Size_Max];
+ }
+ Buffer_Temp_Size=ToAdd_Size-Buffer_Offset;
+ std::memcpy(Buffer_Temp, ToAdd+Buffer_Offset, Buffer_Temp_Size);
+ }
+ else //Already a copy, just moving it
+ {
+ std::memmove(Buffer_Temp, Buffer_Temp+Buffer_Offset, Buffer_Size-Buffer_Offset);
+ Buffer_Temp_Size=Buffer_Size-Buffer_Offset;
+ }
+ }
+ else if (Buffer_Temp_Size)
+ Buffer_Temp_Size=0;
+
+ //Reserving unused data
+ if ((int64u)-1-Buffer_Offset<File_Offset) //In case of unknown filesize, File_Offset may be (int64u)-1
+ Buffer_Offset=(size_t)((int64u)-1-File_Offset);
+ Buffer_Size-=Buffer_Offset;
+ File_Offset+=Buffer_Offset;
+ if (Buffer_Offset_Temp>=Buffer_Offset)
+ Buffer_Offset_Temp-=Buffer_Offset;
+ Buffer_Offset=0;
+
+ //Is it OK?
+ if (Buffer_Size>Buffer_MaximumSize)
+ {
+ ForceFinish();
+ return;
+ }
+}
+
+void File__Analyze::Open_Buffer_Continue (File__Analyze* Sub, const int8u* ToAdd, size_t ToAdd_Size)
+{
+ 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 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->Open_Buffer_Continue(ToAdd, ToAdd_Size);
+
+ #if MEDIAINFO_TRACE
+ //Details handling
+ if (!Sub->Element[0].ToShow.Details.empty() && !Details_DoNotSave)
+ {
+ //Line separator
+ if (!Element[Element_Level].ToShow.Details.empty())
+ Element[Element_Level].ToShow.Details+=MediaInfoLib::Config.LineSeparator_Get();
+
+ //From Sub
+ while(Sub->Element_Level)
+ Sub->Element_End();
+ 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
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Open_Buffer_Continue_Loop ()
+{
+ //Header
+ if (MustParseTheHeaderFile)
+ {
+ if (!FileHeader_Manage())
+ return; //Wait for more data
+ if (Status[IsFinished] || File_GoTo!=(int64u)-1)
+ return; //Finish
+ }
+
+ //Parsing specific
+ Frame_Count_InThisBlock=0; //Out
+ Element_Offset=0;
+ Element_Size=Buffer_Size;
+ Element[Element_Level].WaitForMoreData=false;
+ Read_Buffer_Continue();
+ if (Element_IsWaitingForMoreData())
+ return; //Wait for more data
+ Buffer_Offset+=(size_t)Element_Offset;
+ if (Status[IsFinished] && !ShouldContinueParsing || Buffer_Offset>=Buffer_Size || File_GoTo!=(int64u)-1)
+ return; //Finish
+
+ //Parsing;
+ while (Buffer_Parse());
+
+ //Handling of File_GoTo with already buffered data
+ if (File_GoTo!=(int64u)-1 && File_GoTo>=File_Offset && File_GoTo<=File_Offset+Buffer_Size)
+ {
+ Buffer_Offset=(size_t)(File_GoTo-File_Offset);
+ File_GoTo=(int64u)-1;
+ return Open_Buffer_Continue_Loop();
+ }
+
+ //Jumping to the end of the file if needed
+ if (!IsSub && !EOF_AlreadyDetected && MediaInfoLib::Config.ParseSpeed_Get()<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;
+ }
+ }
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Open_Buffer_Position_Set (int64u File_Offset_)
+{
+ if (File_Offset_==(int64u)-1)
+ return;
+
+ File_Offset=File_Offset_;
+ File_GoTo=(int64u)-1;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Open_Buffer_Unsynch ()
+{
+ Buffer_Clear();
+ Read_Buffer_Unsynched();
+
+ //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; StreamPos<StreamPos_Count; StreamPos++)
+ Clear((stream_t)StreamKind, StreamPos, Fill_Parameter((stream_t)StreamKind, Generic_Duration));
+ }
+ Synched=false;
+ }
+
+ File_GoTo=(int64u)-1;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Open_Buffer_Finalize (bool NoBufferModification)
+{
+ //File with unknown size (stream...), finnishing
+ if (!NoBufferModification && File_Size==(int64u)-1)
+ {
+ File_Size=File_Offset+Buffer_Size;
+ Open_Buffer_Continue((const int8u*)NULL, 0);
+ }
+
+ //Element must be Finish
+ while (Element_Level>0)
+ Element_End();
+
+ //Buffer - Global
+ Fill();
+ if (!NoBufferModification)
+ {
+ ForceFinish();
+ Buffer_Clear();
+ }
+
+ #if MEDIAINFO_TRACE
+ if (Details && Details->empty())
+ Details->assign(Element[0].ToShow.Details);
+ #endif //MEDIAINFO_TRACE
+
+ #if MEDIAINFO_EVENTS
+ struct MediaInfo_Event_General_End_0 Event;
+ Event.EventCode=MediaInfo_EventCode_Create(MediaInfo_Parser_None, MediaInfo_Event_General_End, 0);
+ Event.Stream_Bytes_Analyzed=Buffer_TotalBytes;
+ Config->Event_Send((const int8u*)&Event, sizeof(MediaInfo_Event_General_End_0));
+ #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
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+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_End(); //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 && !Synchro_Manage())
+ return false; //Wait for more data
+
+ //Header
+ if (!Header_Manage())
+ return false; //Wait for more data
+
+ //Data
+ if (!Data_Manage())
+ return false; //Wait for more data
+
+ return Buffer_Offset!=Buffer_Size;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Buffer_Clear()
+{
+ //Buffer
+ BS->Attach(NULL, 0);
+ delete[] Buffer_Temp; Buffer_Temp=NULL;
+ Buffer_Size=0;
+ Buffer_Temp_Size=0;
+ Buffer_Offset=0;
+ Buffer_Offset_Temp=0;
+ Buffer_MinimumSize=0;
+
+ //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[Buffer_Offset]!=0x00)
+ Buffer_Offset+=2;
+ if (Buffer_Offset<Buffer_Size && Buffer[Buffer_Offset-1]==0x00 || 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)
+ {
+ 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;
+}
+
+//***************************************************************************
+// Synchro
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File__Analyze::Synchro_Manage()
+{
+ //Testing if synchro is OK
+ if (Synched)
+ {
+ if (!Synched_Test())
+ return false;
+ if (!Synched)
+ {
+ Element[Element_Level].IsComplete=true; //Else the trusting algo will think it
+ Trusted_IsNot("Synchronisation lost");
+ }
+ }
+
+ //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 (File_Offset_FirstSynched==(int64u)-1)
+ {
+ Synched_Init();
+ Buffer_TotalBytes_FirstSynched+=Buffer_TotalBytes+Buffer_Offset;
+ File_Offset_FirstSynched=File_Offset+Buffer_Offset;
+ }
+ return Synchro_Manage();
+ }
+
+ return true;
+}
+
+//***************************************************************************
+// File Header
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File__Analyze::FileHeader_Manage()
+{
+ //From the parser
+ if (!FileHeader_Begin())
+ {
+ if (Status[IsFinished]) //Newest parsers set this bool if there is an error
+ Reject();
+ return false; //Wait for more data
+ }
+
+ //From the parser
+ Element_Size=Buffer_Size;
+ Element_Begin("File Header");
+ FileHeader_Parse();
+ Element_End();
+ 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
+ Buffer_Offset+=(size_t)Element_Offset;
+
+ MustParseTheHeaderFile=false;
+ return true;
+}
+
+//***************************************************************************
+// Header
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File__Analyze::Header_Manage()
+{
+ //Test
+ if (Buffer_Offset>=Buffer_Size)
+ return false;
+
+ //Header begin
+ if (!Header_Begin())
+ {
+ //Jumping to the end of the file if needed
+ if (!EOF_AlreadyDetected && MediaInfoLib::Config.ParseSpeed_Get()<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_Begin(); //Element
+ #if MEDIAINFO_TRACE
+ Data_Level=Element_Level;
+ #endif //MEDIAINFO_TRACE
+ Element_Begin("Header"); //Header
+
+ //Header parsing
+ Header_Parse();
+
+ //Testing the parser result
+ if (Element[Element_Level].UnTrusted) //Problem
+ {
+ Header_Fill_Code(0, "Problem");
+ Header_Fill_Size(Element_Size);
+ }
+
+ if (Element_IsWaitingForMoreData() || (DataMustAlwaysBeComplete && Element[Element_Level-1].Next>File_Offset+Buffer_Size)) //Wait or want to have a comple data chunk
+ {
+ //The header is not complete, need more data
+ Element[Element_Level].WaitForMoreData=true;
+ Element_End(); //Header
+ Element_End(); //Element
+ return false;
+ }
+
+ //Filling
+ Element[Element_Level].WaitForMoreData=false;
+ Element[Element_Level].IsComplete=true;
+
+ //ToShow
+ #if MEDIAINFO_TRACE
+ if (Config_DetailsLevel!=0)
+ {
+ 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;
+ }
+ #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_End(); //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_DetailsLevel!=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("Header can't be 0");
+
+ if (Element[Element_Level].UnTrusted)
+ return;
+
+ //Integrity
+ if (Size<Element_Offset)
+ Size=Element_Offset; //At least what we read before!!!
+
+ //Filling
+ if (Element_Level==1)
+ Element[0].Next=File_Offset+Buffer_Offset+Size;
+ else if (File_Offset+Buffer_Offset+Size>Element[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 (Config_DetailsLevel!=0)
+ {
+ 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;
+
+ //Testing the parser result
+ if (Element_IsWaitingForMoreData())
+ {
+ //The data is not complete, need more data
+ Element_End(); //Element
+ Buffer_Offset-=(size_t)Header_Size;
+ return false;
+ }
+
+ Element[Element_Level].IsComplete=true;
+ }
+
+ if (File_GoTo!=(int64u)-1)
+ return false;
+
+ //Next element
+ if (!Element_WantNextLevel)
+ {
+ if (Element[Element_Level].Next<=File_Offset+Buffer_Size)
+ Element_Offset=(size_t)(Element[Element_Level].Next-File_Offset-Buffer_Offset);
+ else if (!Status[IsFinished])
+ {
+ GoTo(Element[Element_Level].Next);
+ return false;
+ }
+ }
+ if (File_GoTo==(int64u)-1 && Buffer_Offset+Element_Offset>Buffer_Size && File_Offset!=File_Size)
+ GoTo(File_Offset+Buffer_Offset+Element_Offset); //Preparing to go far
+
+ //If no need of more
+ if (File_GoTo!=(int64u)-1 || (Status[IsFinished] && !ShouldContinueParsing))
+ {
+ if (!Element_WantNextLevel)
+ Element_End(); //Element
+ Element_Offset=0;
+ return false;
+ }
+
+ Buffer_Offset+=(size_t)Element_Offset;
+ Header_Size=0;
+ Element_Size=0;
+ Element_Offset=0;
+
+ #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_End(); //Element
+ if (Element_WantNextLevel)
+ Element_Level++;
+ Element[Element_Level].UnTrusted=false;
+
+ //Jumping to the end of the file if needed
+ if (!EOF_AlreadyDetected && MediaInfoLib::Config.ParseSpeed_Get()<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_Size<File_Size)
+ Info(Ztring(ParserName)+_T(", rejected"));
+}
+#endif //MEDIAINFO_TRACE
+
+//---------------------------------------------------------------------------
+#if MEDIAINFO_TRACE
+void File__Analyze::Data_GoTo (int64u GoTo, const char* ParserName)
+{
+ if (IsSub && MediaInfoLib::Config.ParseSpeed_Get()==1)
+ return;
+
+ Element_Show();
+
+ if (GoTo==File_Size)
+ {
+ ForceFinish();
+ return;
+ }
+ if (File_GoTo!=(int64u)-1)
+ return; //Already done
+
+ if (ShouldContinueParsing)
+ {
+ if (ParserName)
+ Info(Ztring(ParserName)+_T(", wants to go to somewhere, but should continue parsing"));
+ return;
+ }
+
+ if (IsSub)
+ {
+ if (ParserName)
+ Info(Ztring(ParserName)+_T(", wants to go to somewhere, but is sub, waiting data"));
+ return;
+ }
+
+ Info(Ztring(ParserName)+_T(", jumping to offset ")+Ztring::ToZtring(GoTo, 16));
+ if (!IsSub)
+ File_GoTo=GoTo;
+}
+#endif //MEDIAINFO_TRACE
+
+//---------------------------------------------------------------------------
+#if MEDIAINFO_TRACE
+void File__Analyze::Data_GoToFromEnd (int64u GoToFromEnd, const char* ParserName)
+{
+ if (IsSub && MediaInfoLib::Config.ParseSpeed_Get()==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
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+Ztring Log_Offset (int64u OffsetToShow)
+{
+ 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 (MediaInfoLib::Config.DetailsFormat_Get())
+ {
+ case MediaInfo_Config::DetailsFormat_Tree : Pos2+=_T(' '); break;
+ case MediaInfo_Config::DetailsFormat_CSV : Pos2+=_T(','); break;
+ default : ;
+ }
+ return Pos2;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Element_Begin()
+{
+ //Level
+ Element_Level++;
+ Header_Size=0;
+
+ //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_End()
+ if (Config_DetailsLevel!=0)
+ {
+ 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, int64u Size)
+{
+ //Level
+ Element_Level++;
+
+ //Element
+ Element[Element_Level].Code=0;
+ if (Size==(int64u)-1)
+ Element[Element_Level].Next=Element[Element_Level-1].Next;
+ else
+ {
+ Element[Element_Level].Next=File_Offset+Buffer_Offset+Element_Offset+Size;
+ if (Element[Element_Level].Next>Element[Element_Level-1].Next)
+ 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_End()
+ if (Config_DetailsLevel!=0)
+ {
+ 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;
+ }
+}
+#else //MEDIAINFO_TRACE
+void File__Analyze::Element_Begin(int64u Size)
+{
+ //Level
+ Element_Level++;
+
+ //Element
+ Element[Element_Level].Code=0;
+ if (Size==(int64u)-1)
+ Element[Element_Level].Next=Element[Element_Level-1].Next;
+ else
+ {
+ Element[Element_Level].Next=File_Offset+Buffer_Offset+Element_Offset+Size;
+ if (Element[Element_Level].Next>Element[Element_Level-1].Next)
+ 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;
+}
+#endif //MEDIAINFO_TRACE
+
+//---------------------------------------------------------------------------
+#if MEDIAINFO_TRACE
+void File__Analyze::Element_Name(const Ztring &Name)
+{
+ //ToShow
+ if (Config_DetailsLevel!=0)
+ {
+ 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_DetailsLevel==0 || Element[Element_Level].ToShow.Details.size()>64*1024*1024)
+ return;
+
+ //Needed?
+ if (Config_DetailsLevel<=0.7)
+ return;
+
+ //ToShow
+ Ztring Parameter2(Parameter);
+ Parameter2.FindAndReplace(_T("\r\n"), _T(" / "));
+ Parameter2.FindAndReplace(_T("\r"), _T(" / "));
+ Parameter2.FindAndReplace(_T("\n"), _T(" / "));
+ switch (MediaInfoLib::Config.DetailsFormat_Get())
+ {
+ case MediaInfo_Config::DetailsFormat_Tree : Element[Element_Level].ToShow.Info+=_T(" - "); break;
+ case MediaInfo_Config::DetailsFormat_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, int64u Size)
+{
+ //Element
+ if (Size!=(int64u)-1)
+ {
+ Element[Element_Level].Next=Element[Element_Level].ToShow.Pos+Size; //TODO: change this
+ if (Element[Element_Level].Next>Element[Element_Level-1].Next)
+ Element[Element_Level].Next=Element[Element_Level-1].Next;
+ }
+
+ //ToShow
+ if (Config_DetailsLevel!=0)
+ {
+ 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();
+}
+#else //MEDIAINFO_TRACE
+void File__Analyze::Element_End(int64u Size)
+{
+ //Element
+ if (Size!=(int64u)-1)
+ {
+ if (Element[Element_Level].Next>Element[Element_Level-1].Next)
+ Element[Element_Level].Next=Element[Element_Level-1].Next;
+ }
+
+ Element_End_Common_Flush();
+}
+#endif //MEDIAINFO_TRACE
+
+//---------------------------------------------------------------------------
+void File__Analyze::Element_End()
+{
+ Element_End_Common_Flush();
+}
+
+
+//***************************************************************************
+// 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()<Element[Element_Level].Next)
+ Element[Element_Level].ToShow.Size=File_Offset+Buffer_Offset+Element_Offset+BS->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()
+{
+ Element[Element_Level].ToShow.NoShow=Element[Element_Level+1].ToShow.NoShow;
+ if (Config_DetailsLevel!=0)
+ {
+ if (!Element[Element_Level+1].WaitForMoreData && (Element[Element_Level+1].IsComplete || !Element[Element_Level+1].UnTrusted) && !Element[Element_Level+1].ToShow.NoShow)// && Config_DetailsLevel!=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+=MediaInfoLib::Config.LineSeparator_Get();
+ 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+=MediaInfoLib::Config.LineSeparator_Get();
+ 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_DetailsLevel>0.7)
+ {
+ ToReturn+=Log_Offset(Element[Element_Level+1].ToShow.Pos);
+ }
+
+ //Name
+ switch (MediaInfoLib::Config.DetailsFormat_Get())
+ {
+ case MediaInfo_Config::DetailsFormat_Tree : ToReturn.resize(ToReturn.size()+Element_Level_Base+Element_Level, _T(' ')); break;
+ case MediaInfo_Config::DetailsFormat_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_DetailsLevel>0.3)
+ {
+ switch (MediaInfoLib::Config.DetailsFormat_Get())
+ {
+ case MediaInfo_Config::DetailsFormat_Tree :
+ ToReturn+=_T(" (");
+ 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)");
+ break;
+ default : ;
+ }
+ }
+
+ 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_DetailsLevel==0)
+ return;
+
+ //Position
+ int64u Pos=Element_Offset+BS->OffsetBeforeLastCall_Get();
+
+ //Coherancy
+ if (Element[Element_Level].UnTrusted)
+ return;
+
+ const size_t Padding_Value=40;
+
+ //Line separator
+ if (!Element[Element_Level].ToShow.Details.empty())
+ Element[Element_Level].ToShow.Details+=MediaInfoLib::Config.LineSeparator_Get();
+
+ //Show Offset
+ if (Config_DetailsLevel>0.7)
+ {
+ Element[Element_Level].ToShow.Details+=Log_Offset(Pos==(int64u)-1?Pos:(File_Offset+Buffer_Offset+Pos));
+ }
+
+ //Show Parameter+Value
+ switch (MediaInfoLib::Config.DetailsFormat_Get())
+ {
+ case MediaInfo_Config::DetailsFormat_Tree :
+ {
+ //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::DetailsFormat_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 (MediaInfoLib::Config.DetailsFormat_Get()==MediaInfo_Config::DetailsFormat_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_DetailsLevel==0)
+ 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+=MediaInfoLib::Config.LineSeparator_Get();
+
+ //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_DetailsLevel>0.7)
+ Offset=Log_Offset(File_Offset+Buffer_Offset+Element_Offset+BS->Offset_Get());
+ 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+=MediaInfoLib::Config.LineSeparator_Get();
+ Element[Element_Level_Final].ToShow.Details+=Offset;
+ Element[Element_Level_Final].ToShow.Details+=ToShow;
+ Element[Element_Level_Final].ToShow.Details+=MediaInfoLib::Config.LineSeparator_Get();
+ 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_DetailsLevel==0 || Element[Element_Level].ToShow.Details.size()>64*1024*1024)
+ return;
+
+ //Needed?
+ if (Config_DetailsLevel<=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
+{
+ if (!Element[Element_Level].UnTrusted)
+ {
+ #if MEDIAINFO_TRACE
+ Param(Reason, 0);
+ #endif //MEDIAINFO_TRACE
+ Element_Offset=Element_Size;
+ BS->Attach(NULL, 0);
+
+ //Enough data?
+ if (!Element[Element_Level].IsComplete)
+ {
+ Element[Element_Level].WaitForMoreData=true;
+ return;
+ }
+
+ Element[Element_Level].UnTrusted=true;
+ Synched=false;
+ if (Trusted>0)
+ Trusted--;
+ }
+
+ if (Trusted==0)
+ Reject();
+}
+
+//***************************************************************************
+// Actions
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+#if MEDIAINFO_TRACE
+void File__Analyze::Accept (const char* ParserName_Char)
+{
+ if (Status[IsAccepted] || Status[IsFinished])
+ return;
+
+ if (ParserName.empty())
+ ParserName.From_Local(ParserName_Char);
+
+ if (!ParserName.empty())
+ {
+ bool MustElementBegin=Element_Level?true:false;
+ if (Element_Level>0)
+ Element_End(); //Element
+ Info(Ztring(ParserName)+_T(", accepted"));
+ if (MustElementBegin)
+ Element_Level++;
+ }
+
+ Status[IsAccepted]=true;
+ //if (!IsSub)
+ Stream_Prepare(Stream_General);
+
+ #if MEDIAINFO_EVENTS
+ if (!IsSub)
+ {
+ struct MediaInfo_Event_General_Parser_Selected_0 Event;
+ Event.EventCode=MediaInfo_EventCode_Create(MediaInfo_Parser_None, MediaInfo_Event_General_Parser_Selected, 0);
+ std::memset(Event.Name, 0, 16);
+ if (!ParserName.empty())
+ strncpy(Event.Name, ParserName.To_Local().c_str(), 15);
+ Config->Event_Send((const int8u*)&Event, sizeof(MediaInfo_Event_General_Parser_Selected_0));
+ }
+ #endif //MEDIAINFO_EVENTS
+}
+#else //MEDIAINFO_TRACE
+void File__Analyze::Accept ()
+{
+ if (Status[IsAccepted] || Status[IsFinished])
+ return;
+
+ Status[IsAccepted]=true;
+ //if (!IsSub)
+ Stream_Prepare(Stream_General);
+
+ #if MEDIAINFO_EVENTS
+ if (!IsSub)
+ {
+ struct MediaInfo_Event_General_Parser_Selected_0 Event;
+ Event.EventCode=MediaInfo_EventCode_Create(MediaInfo_Parser_None, MediaInfo_Event_General_Parser_Selected, 0);
+ memset(Event.Name, 0, 16);
+ Config->Event_Send((const int8u*)&Event, sizeof(MediaInfo_Event_General_Parser_Selected_0));
+ }
+ #endif //MEDIAINFO_EVENTS
+}
+#endif //MEDIAINFO_TRACE
+
+void File__Analyze::Accept (File__Analyze* Parser)
+{
+ if (Parser==NULL)
+ return;
+
+ Parser->Accept();
+}
+
+//---------------------------------------------------------------------------
+#if MEDIAINFO_TRACE
+void File__Analyze::Fill (const char* ParserName)
+{
+ if (Status[IsFilled])
+ return;
+
+ if (ParserName)
+ {
+ bool MustElementBegin=Element_Level?true:false;
+ if (Element_Level>0)
+ Element_End(); //Element
+ Info(Ztring(ParserName)+_T(", filling"));
+ if (MustElementBegin)
+ Element_Level++;
+ }
+
+ if (Status[IsAccepted])
+ {
+ Streams_Fill();
+ Status[IsFilled]=true;
+ Status[IsUpdated]=true;
+ }
+}
+#else //MEDIAINFO_TRACE
+void File__Analyze::Fill ()
+{
+ if (Status[IsFilled])
+ return;
+
+ if (Status[IsAccepted])
+ {
+ Streams_Fill();
+ Status[IsFilled]=true;
+ Status[IsUpdated]=true;
+ }
+}
+#endif //MEDIAINFO_TRACE
+
+void File__Analyze::Fill (File__Analyze* Parser)
+{
+ if (Parser==NULL)
+ return;
+
+ Parser->Fill();
+}
+
+//---------------------------------------------------------------------------
+#if MEDIAINFO_TRACE
+void File__Analyze::Finish (const char* ParserName)
+{
+ if (MediaInfoLib::Config.ParseSpeed_Get()==1)
+ return;
+
+ ForceFinish(ParserName);
+}
+#else //MEDIAINFO_TRACE
+void File__Analyze::Finish ()
+{
+ if (MediaInfoLib::Config.ParseSpeed_Get()==1)
+ return;
+
+ ForceFinish();
+}
+#endif //MEDIAINFO_TRACE
+
+void File__Analyze::Finish (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(); //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)
+{
+ if (ParserName.empty())
+ ParserName.From_Local(ParserName_Char);
+
+ if (ShouldContinueParsing)
+ {
+ if (!ParserName.empty())
+ {
+ bool MustElementBegin=Element_Level?true:false;
+ if (Element_Level>0)
+ Element_End(); //Element
+ //Info(Ztring(ParserName)+_T(", wants to finish, but should continue parsing"));
+ if (MustElementBegin)
+ Element_Level++;
+ }
+ return;
+ }
+
+ if (Status[IsFinished])
+ return;
+
+ if (!ParserName.empty())
+ {
+ bool MustElementBegin=Element_Level?true:false;
+ if (Element_Level>0)
+ Element_End(); //Element
+ Info(ParserName+_T(", finished"));
+ if (MustElementBegin)
+ Element_Level++;
+ }
+
+ if (Status[IsAccepted])
+ Fill();
+
+ if (Status[IsAccepted])
+ {
+ Streams_Finish();
+ Streams_Finish_Global();
+ }
+
+ Status[IsFinished]=true;
+
+ //Real stream size
+ if (MediaInfoLib::Config.ParseSpeed_Get()==1 && IsRawStream)
+ {
+ Fill(StreamKind_Last, StreamPos_Last, "StreamSize", Buffer_TotalBytes, 10, true);
+ }
+}
+#else //MEDIAINFO_TRACE
+void File__Analyze::ForceFinish ()
+{
+ if (ShouldContinueParsing || Status[IsFinished])
+ return;
+
+ if (Status[IsAccepted])
+ Fill();
+
+ if (Status[IsAccepted])
+ {
+ Streams_Finish();
+ Streams_Finish_Global();
+ }
+
+ Status[IsFinished]=true;
+
+ //Real stream size
+ if (MediaInfoLib::Config.ParseSpeed_Get()==1 && IsRawStream)
+ {
+ Fill(StreamKind_Last, StreamPos_Last, "StreamSize", Buffer_TotalBytes, 10, true);
+ }
+}
+#endif //MEDIAINFO_TRACE
+
+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)
+{
+ Status[IsAccepted]=false;
+ Status[IsFinished]=true;
+ Clear();
+
+ if (ParserName)// && File_Offset+Buffer_Offset+Element_Size<File_Size)
+ {
+ bool MustElementBegin=Element_Level?true:false;
+ if (Element_Level>0)
+ Element_End(); //Element
+ Info(Ztring(ParserName)+_T(", rejected"));
+ if (MustElementBegin)
+ Element_Level++;
+ }
+}
+#else //MEDIAINFO_TRACE
+void File__Analyze::Reject ()
+{
+ Status[IsAccepted]=false;
+ Status[IsFinished]=true;
+ Clear();
+}
+#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 && MediaInfoLib::Config.ParseSpeed_Get()==1)
+ return;
+
+ if (GoTo==File_Size)
+ {
+ if (!BookMark_Code.empty())
+ BookMark_Get();
+ if (File_GoTo==(int64u)-1)
+ ForceFinish();
+ return;
+ }
+ if (File_GoTo!=(int64u)-1)
+ return; //Already done
+
+ if (ShouldContinueParsing)
+ {
+ if (ParserName)
+ {
+ bool MustElementBegin=Element_Level?true:false;
+ if (Element_Level>0)
+ Element_End(); //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_End(); //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_End(); //Element
+ Info(Ztring(ParserName)+_T(", jumping to offset ")+Ztring::ToZtring(GoTo, 16));
+ if (MustElementBegin)
+ Element_Level++;
+ }
+
+ Open_Buffer_Unsynch();
+ if (!IsSub)
+ File_GoTo=GoTo;
+
+ #if MEDIAINFO_EVENTS
+ struct MediaInfo_Event_General_Move_Request_0 Event;
+ Event.EventCode=MediaInfo_EventCode_Create(MediaInfo_Parser_None, MediaInfo_Event_General_Move_Request, 0);
+ Event.Stream_Offset=File_GoTo;
+ Config->Event_Send((const int8u*)&Event, sizeof(MediaInfo_Event_General_Move_Request_0));
+ #endif //MEDIAINFO_EVENTS
+}
+#else //MEDIAINFO_TRACE
+void File__Analyze::GoTo (int64u GoTo)
+{
+ if (!Status[IsAccepted])
+ {
+ Reject();
+ return;
+ }
+
+ if (IsSub && MediaInfoLib::Config.ParseSpeed_Get()==1)
+ return;
+
+ if (GoTo==File_Size)
+ {
+ if (!BookMark_Code.empty())
+ BookMark_Get();
+ if (File_GoTo==(int64u)-1)
+ Finish();
+ return;
+ }
+ if (File_GoTo!=(int64u)-1)
+ return; //Already done
+
+ if (ShouldContinueParsing)
+ {
+ return;
+ }
+
+ if (IsSub)
+ {
+ return;
+ }
+
+ Open_Buffer_Unsynch();
+ if (!IsSub)
+ 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_End(); //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_Size<File_Size)
+ Element[Element_Level].WaitForMoreData=true;
+}
+
+//---------------------------------------------------------------------------
+#if MEDIAINFO_TRACE
+void File__Analyze::Element_DoNotTrust (const char* Reason)
+#else //MEDIAINFO_TRACE
+void File__Analyze::Element_DoNotTrust ()
+#endif //MEDIAINFO_TRACE
+{
+ Element[Element_Level].WaitForMoreData=false;
+ Element[Element_Level].IsComplete=true;
+ #if MEDIAINFO_TRACE
+ Trusted_IsNot(Reason);
+ #else //MEDIAINFO_TRACE
+ Trusted_IsNot();
+ #endif //MEDIAINFO_TRACE
+}
+
+//---------------------------------------------------------------------------
+#if MEDIAINFO_TRACE
+void File__Analyze::Element_DoNotShow ()
+{
+ Element[Element_Level].ToShow.NoShow=true;
+}
+#endif //MEDIAINFO_TRACE
+
+//---------------------------------------------------------------------------
+#if MEDIAINFO_TRACE
+void File__Analyze::Element_Show ()
+{
+ Element[Element_Level].ToShow.NoShow=false;
+}
+#endif //MEDIAINFO_TRACE
+
+//---------------------------------------------------------------------------
+#if MEDIAINFO_TRACE
+bool File__Analyze::Element_Show_Get ()
+{
+ return !Element[Element_Level].ToShow.NoShow;
+}
+#endif //MEDIAINFO_TRACE
+
+//---------------------------------------------------------------------------
+#if MEDIAINFO_TRACE
+void File__Analyze::Element_Show_Add (const Ztring &ToShow)
+{
+ if (ToShow.empty())
+ return;
+
+ //Line separator
+ if (!Element[Element_Level].ToShow.Details.empty())
+ Element[Element_Level].ToShow.Details+=MediaInfoLib::Config.LineSeparator_Get();
+
+ //From Sub
+ Element[Element_Level].ToShow.Details+=ToShow;
+}
+#endif //MEDIAINFO_TRACE
+
+//***************************************************************************
+// Status
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File__Analyze::Element_IsOK ()
+{
+ return !Element[Element_Level].WaitForMoreData && !Element[Element_Level].UnTrusted;
+}
+
+//---------------------------------------------------------------------------
+bool File__Analyze::Element_IsNotFinished ()
+{
+ if (BS->Remain()>0 || Element_Offset+BS->Offset_Get()<Element_Size)
+ return true;
+ else
+ return false;
+}
+
+//---------------------------------------------------------------------------
+bool File__Analyze::Element_IsWaitingForMoreData ()
+{
+ return Element[Element_Level].WaitForMoreData;
+}
+
+//***************************************************************************
+// BookMarks
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File__Analyze::BookMark_Set (size_t Element_Level_ToSet)
+{
+ Element_Level_ToSet=Element_Level;
+ BookMark_Element_Level=Element_Level_ToSet;
+ BookMark_Code.resize(BookMark_Element_Level+1);
+ BookMark_Next.resize(BookMark_Element_Level+1);
+ for (size_t Pos=0; Pos<=BookMark_Element_Level; Pos++)
+ {
+ BookMark_Code[Pos]=Element[Pos].Code;
+ BookMark_Next[Pos]=Element[Pos].Next;
+ }
+ BookMark_GoTo=File_Offset+Buffer_Offset+Element_Offset;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::BookMark_Get ()
+{
+ if (!BookMark_Needed())
+ return;
+
+ Element_Show();
+ while (Element_Level>0)
+ Element_End();
+ while (Element_Level<BookMark_Element_Level)
+ Element_Begin("Restarting parsing...", File_Size);
+
+ for (size_t Pos=0; Pos<=Element_Level; Pos++)
+ {
+ Element[Pos].Code=BookMark_Code[Pos];
+ Element[Pos].Next=BookMark_Next[Pos];
+ }
+ BookMark_Code.clear();
+ BookMark_Next.clear();
+ if (File_GoTo==(int64u)-1)
+ File_GoTo=BookMark_GoTo;
+}
+
+//---------------------------------------------------------------------------
+#if MEDIAINFO_TRACE
+void File__Analyze::Details_Clear()
+{
+ Details->clear();
+ Element[0].ToShow.Details.clear();
+}
+#endif //MEDIAINFO_TRACE
+
+//***************************************************************************
+// Demux
+//***************************************************************************
+
+#if MEDIAINFO_DEMUX
+void File__Analyze::Demux (const int8u* Buffer, size_t Buffer_Size, contenttype Content_Type)
+{
+ if (!MediaInfoLib::Config.Demux_Get())
+ return;
+
+ #if MEDIAINFO_EVENTS
+ //Demux
+ StreamIDs[StreamIDs_Size-1]=Element_Code;
+ struct MediaInfo_Event_Global_Demux_0 Event;
+ if (StreamIDs_Size && StreamIDs_Size<17)
+ Event.EventCode=MediaInfo_EventCode_Create(ParserIDs[StreamIDs_Size-1], MediaInfo_Event_Global_Demux, 0);
+ else
+ Event.EventCode=MediaInfo_EventCode_Create(0x00, MediaInfo_Event_Global_Demux, 0);
+ Event.Stream_Offset=File_Offset+Buffer_Offset;
+ Event.StreamIDs_Size=StreamIDs_Size;
+ Event.StreamIDs=(MediaInfo_int64u*)StreamIDs;
+ Event.StreamIDs_Width=(MediaInfo_int8u*)StreamIDs_Width;
+ Event.ParserIDs=(MediaInfo_int8u* )ParserIDs;
+ Event.Content_Type=(int8u)Content_Type;
+ Event.Content_Size=Buffer_Size;
+ Event.Content=Buffer;
+ Config->Event_Send((const int8u*)&Event, sizeof(MediaInfo_Event_Global_Demux_0), IsSub?File_Name_WithoutDemux:File_Name);
+ #endif //MEDIAINFO_EVENTS
+}
+#endif //MEDIAINFO_DEMUX
+
+} //NameSpace
+
diff --git a/src/thirdparty/MediaInfo/File__Analyze.h b/src/thirdparty/MediaInfo/File__Analyze.h
new file mode 100644
index 000000000..74e682fab
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File__Analyze.h
@@ -0,0 +1,1161 @@
+// File__Analysze - Base for analyze files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File__AnalyzeH
+#define MediaInfo_File__AnalyzeH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Setup.h"
+#include "MediaInfo/File__Base.h"
+#include "MediaInfo/File__Analyse_Automatic.h"
+#include "ZenLib/BitStream.h"
+#include "ZenLib/int128u.h"
+#include "ZenLib/ZtringListList.h"
+#include <vector>
+#include <bitset>
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+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);
+ void Open_Buffer_Continue (File__Analyze* Sub, size_t Buffer_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) {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);
+ 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];
+ #endif //MEDIAINFO_EVENTS
+ Ztring File_Name_WithoutDemux;
+ bool PTS_DTS_Needed;
+ int64u PCR; //In nanoseconds
+ int64u PTS; //In nanoseconds
+ int64u DTS; //In nanoseconds
+
+ //Out
+ int64u PTS_DTS_Offset_InThisBlock; //In nanoseconds
+ size_t Frame_Count_InThisBlock;
+
+protected :
+ //***************************************************************************
+ // Streams management
+ //***************************************************************************
+
+ virtual void Streams_Fill() {};
+ 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();
+
+ //***************************************************************************
+ // 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_Continue_Once () {}; //Temp, should be in File__Base caller
+ virtual void Read_Buffer_Unsynched () {}; //Temp, should be in File__Base caller
+ 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, int64u Size=(int64u)-1);
+ inline void Element_Begin (int64u Size) {Element_Begin(Ztring(), Size);}
+ inline void Element_Begin (const char *Name, int64u Size=(int64u)-1) {Element_Begin(Ztring().From_UTF8(Name), Size);}
+
+ //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 NEED_SIZET
+ inline void Element_Info (size_t Parameter, const char* Measure=NULL) {Element_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));}
+ #endif //NEED_SIZET
+ 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));}
+ inline void Element_Info_From_Milliseconds (int64u Parameter) {Element_Info(Ztring().Duration_From_Milliseconds(Parameter));}
+
+ //Elements - End
+ void Element_End ();
+ void Element_End (const Ztring &Name, int64u Size=(int64u)-1);
+ inline void Element_End (int64u Size) {Element_End(Ztring(), Size);}
+ inline void Element_End (const char *Name, int64u Size=(int64u)-1) {Element_End(Ztring().From_UTF8(Name), Size);}
+
+ //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, 16).MakeUpperCase()+_T(" (")+Ztring::ToZtring(Value, 10).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, VALUE(Value));}
+ inline void Param (const char* Parameter, int8s Value) {Param(Parameter, VALUE(Value));}
+ inline void Param (const char* Parameter, int16u Value) {Param(Parameter, VALUE(Value));}
+ inline void Param (const char* Parameter, int16s Value) {Param(Parameter, VALUE(Value));}
+ inline void Param (const char* Parameter, int32u Value) {Param(Parameter, VALUE(Value));}
+ inline void Param (const char* Parameter, int32s Value) {Param(Parameter, VALUE(Value));}
+ inline void Param (const char* Parameter, int64u Value) {Param(Parameter, VALUE(Value));}
+ inline void Param (const char* Parameter, int64s Value) {Param(Parameter, VALUE(Value));}
+ inline void Param (const char* Parameter, int128u Value){Param(Parameter, VALUE(Value));}
+ 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 NEED_SIZET
+ 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 //NEED_SIZET
+ 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);};
+
+ //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 NEED_SIZET
+ inline void Param_Info (size_t Parameter, const char* Measure=NULL) {Param_Info(Ztring::ToZtring(Parameter)+Ztring().From_UTF8(Measure));}
+ #endif //NEED_SIZET
+ 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 (size_t 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(size_t 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)
+
+ //***************************************************************************
+ // 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
+ //***************************************************************************
+
+ void Get_VL (int32u Call(int8u Size, int32u ToCall), int32u &Info, const char* Name);
+ void Skip_VL(int32u Call(int8u Size, int32u ToCall), const char* Name);
+ #define Info_VL(_CALL, _INFO, _NAME) int32u _INFO; Get_VL(_CALL, _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_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 Info_Flags(_FLAGS, _ORDER, _INFO, _NAME) bool _INFO; Get_Flags (_FLAGS, _ORDER, _INFO, _NAME)
+
+ //***************************************************************************
+ // BitStream
+ //***************************************************************************
+
+ void Get_BS (size_t 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 (size_t Bits, int8u &Info, const char* Name);
+ void Get_S2 (size_t Bits, int16u &Info, const char* Name);
+ void Get_S3 (size_t Bits, int32u &Info, const char* Name);
+ void Get_S4 (size_t Bits, int32u &Info, const char* Name);
+ void Get_S5 (size_t Bits, int64u &Info, const char* Name);
+ void Get_S6 (size_t Bits, int64u &Info, const char* Name);
+ void Get_S7 (size_t Bits, int64u &Info, const char* Name);
+ void Get_S8 (size_t Bits, int64u &Info, const char* Name);
+ void Peek_BS(size_t Bits, int32u &Info);
+ void Peek_SB( bool &Info);
+ bool Peek_SB() {bool Temp; Peek_SB(Temp); return Temp;}
+ void Peek_S1(size_t Bits, int8u &Info);
+ void Peek_S2(size_t Bits, int16u &Info);
+ void Peek_S3(size_t Bits, int32u &Info);
+ void Peek_S4(size_t Bits, int32u &Info);
+ void Peek_S5(size_t Bits, int64u &Info);
+ void Peek_S6(size_t Bits, int64u &Info);
+ void Peek_S7(size_t Bits, int64u &Info);
+ void Peek_S8(size_t Bits, int64u &Info);
+ void Skip_BS(size_t Bits, const char* Name);
+ void Skip_SB( const char* Name);
+ void Skip_S1(size_t Bits, const char* Name);
+ void Skip_S2(size_t Bits, const char* Name);
+ void Skip_S3(size_t Bits, const char* Name);
+ void Skip_S4(size_t Bits, const char* Name);
+ void Skip_S5(size_t Bits, const char* Name);
+ void Skip_S6(size_t Bits, const char* Name);
+ void Skip_S7(size_t Bits, const char* Name);
+ void Skip_S8(size_t 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_Begin(_NAME); \
+ Skip_SB( _NAME); \
+
+ #define TEST_SB_SKIP(_NAME) \
+ { \
+ if (!Peek_SB()) \
+ Skip_SB( _NAME); \
+ else \
+ { \
+ Element_Begin(_NAME); \
+ Skip_SB( _NAME); \
+
+ #define TESTELSE_SB_GET(_CODE, _NAME) \
+ { \
+ Peek_SB(_CODE); \
+ if (_CODE) \
+ { \
+ Element_Begin(_NAME); \
+ Skip_SB( _NAME); \
+
+ #define TESTELSE_SB_SKIP(_NAME) \
+ { \
+ if (Peek_SB()) \
+ { \
+ Element_Begin(_NAME); \
+ Skip_SB( _NAME); \
+
+ #define TESTELSE_SB_ELSE(_NAME) \
+ Element_End(); \
+ } \
+ else \
+ { \
+ Skip_SB( _NAME); \
+
+ #define TESTELSE_SB_END() \
+ } \
+ } \
+
+ #define TEST_SB_END() \
+ Element_End(); \
+ } \
+ } \
+
+ //***************************************************************************
+ // Next code planning
+ //***************************************************************************
+
+ void NextCode_Add(int64u Code);
+ void NextCode_Clear();
+ bool NextCode_Test();
+
+ //***************************************************************************
+ // Element trusting
+ //***************************************************************************
+
+ void Trusted_IsNot (const char* Reason);
+
+ //***************************************************************************
+ // Stream filling
+ //***************************************************************************
+
+ //Before filling the stream, the stream must be prepared
+ size_t Stream_Prepare (stream_t KindOfStream);
+
+ //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 NEED_SIZET
+ 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 //NEED_SIZET
+ //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 NEED_SIZET
+ 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 //NEED_SIZET
+ 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 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 ();
+
+ //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() \
+ }
+
+ //***************************************************************************
+ // 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
+
+ //***************************************************************************
+ // 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_Chapters(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 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);
+ void CodecID_Fill (const Ztring &Value, stream_t StreamKind, size_t StreamPos, infocodecid_format_t Format);
+
+ //***************************************************************************
+ //
+ //***************************************************************************
+
+protected :
+ //Save for speed improvement
+ float Config_DetailsLevel;
+ 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
+ bool Synched; //Data is synched
+ 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
+ void Open_Buffer_Continue_Loop();
+protected :
+ //Buffer
+ const int8u* Buffer;
+public : //TO CHANGE
+ size_t Buffer_Size;
+ int64u Buffer_TotalBytes_FirstSynched;
+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;
+ int64u Buffer_TotalBytes_FirstSynched_Max;
+ friend class File__Tags_Helper;
+
+ //***************************************************************************
+ // Helpers
+ //***************************************************************************
+
+ bool FileHeader_Begin_0x000001();
+ bool Synchronize_0x000001();
+
+private :
+
+ //***************************************************************************
+ // Elements
+ //***************************************************************************
+
+ //Data
+ size_t Data_Level; //Current level for Data ("Top level")
+
+ //Element
+ BitStream* BS; //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 Details_DoNotSave;
+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_details> Element;
+
+ //NextCode
+ std::map<int64u, bool> NextCode;
+
+ //BookMarks
+ size_t BookMark_Element_Level;
+ int64u BookMark_GoTo;
+ std::vector<int64u> BookMark_Code;
+ std::vector<int64u> 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,
+ };
+ bool ShouldContinueParsing;
+
+ //Configuration
+ bool MustSynchronize;
+
+ //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);
+ #else //MEDIAINFO_DEMUX
+ #define Demux(_A, _B, _C)
+ #endif //MEDIAINFO_DEMUX
+
+ //Events data
+ #if MEDIAINFO_EVENTS
+ bool MpegPs_PES_FirstByte_IsAvailable;
+ bool MpegPs_PES_FirstByte_Value;
+ #endif //MEDIAINFO_EVENTS
+};
+
+//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() \
+ { \
+ } \
+*/
+
+#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_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) \
+ { \
+ _ATOM(); \
+ Element_ThisIsAList(); \
+ } \
+
+#define LIST_DEFAULT(_ATOM) \
+ default : \
+ if (Level==Element_Level) \
+ { \
+ _ATOM(); \
+ Element_ThisIsAList(); \
+ } \
+
+#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_SKIP(_ATOM) \
+ case Elements::_ATOM : \
+ if (Level==Element_Level) \
+ { \
+ _ATOM(); \
+ Element_ThisIsAList(); \
+ } \
+ if (Element_TotalSize_Get()>Element_Offset) \
+ Skip_XX(Element_TotalSize_Get()-Element_Offset, "Unknown"); \
+ 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
diff --git a/src/thirdparty/MediaInfo/File__Analyze_Buffer.cpp b/src/thirdparty/MediaInfo/File__Analyze_Buffer.cpp
new file mode 100644
index 000000000..1d26fdf0b
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File__Analyze_Buffer.cpp
@@ -0,0 +1,1786 @@
+// File__Analyze - Base for analyze files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+#if MEDIAINFO_TRACE
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include "MediaInfo/MediaInfo_Config.h"
+#include "ZenLib/BitStream_LE.h"
+#include <cmath>
+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()
+{
+ if (Element_Offset>Element_Size)
+ Element_Offset=Element_Size;
+ size_t BS_Size;
+ if (Buffer_Offset+Element_Size<=Buffer_Size)
+ BS_Size=(size_t)(Element_Size-Element_Offset);
+ else
+ BS_Size=Buffer_Size-(Buffer_Offset+(size_t)Element_Offset);
+ BS->Attach(Buffer+Buffer_Offset+(size_t)Element_Offset, BS_Size);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::BS_Begin_LE()
+{
+ //Change the bitstream for Little Endian version
+ delete BS; BS=(BitStream*)new BitStream_LE();
+
+ BS_Begin();
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::BS_End()
+{
+ BS->Byte_Align();
+ Element_Offset+=BS->Offset_Get();
+ BS->Attach(NULL, 0);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::BS_End_LE()
+{
+ BS_End();
+
+ //Change the bitstream for the normal one
+ delete BS; BS=new BitStream;
+}
+
+//***************************************************************************
+// 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) Param(Name, Info);
+ 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 (Config_DetailsLevel>0) Param(Name, Info);
+ 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) Param(Name, Info);
+ Element_Offset+=10;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_BFP4(size_t 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<<Bits)/2)
+ Integer-=1<<Bits;
+ Info=Integer+((float32)Fraction)/(1<<(32-Bits));
+ if (Config_DetailsLevel>0) Param(Name, Info);
+ Element_Offset+=4;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B1(int8u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(1);
+ Info=BigEndian2int8u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B2(int16u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(2);
+ Info=BigEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B3(int32u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(3);
+ Info=BigEndian2int24u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B4(int32u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(4);
+ Info=BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B5(int64u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(5);
+ Info=BigEndian2int40u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B6(int64u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(6);
+ Info=BigEndian2int48u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B7(int64u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(7);
+ Info=BigEndian2int56u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B8(int64u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(8);
+ Info=BigEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B16(int128u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(16);
+ Info=BigEndian2int128u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_B1(const char* Name)
+{
+ INTEGRITY_SIZE_ATLEAST(1);
+ if (Config_DetailsLevel>0) Param(Name, BigEndian2int8u(Buffer+Buffer_Offset+(size_t)Element_Offset));
+ Element_Offset+=1;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_B2(const char* Name)
+{
+ INTEGRITY_SIZE_ATLEAST(2);
+ if (Config_DetailsLevel>0) Param(Name, BigEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset));
+ Element_Offset+=2;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_B3(const char* Name)
+{
+ INTEGRITY_SIZE_ATLEAST(3);
+ if (Config_DetailsLevel>0) Param(Name, BigEndian2int24u(Buffer+Buffer_Offset+(size_t)Element_Offset));
+ Element_Offset+=3;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_B4(const char* Name)
+{
+ INTEGRITY_SIZE_ATLEAST(4);
+ if (Config_DetailsLevel>0) Param(Name, BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset));
+ Element_Offset+=4;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_B5(const char* Name)
+{
+ INTEGRITY_SIZE_ATLEAST(5);
+ if (Config_DetailsLevel>0) Param(Name, BigEndian2int40u(Buffer+Buffer_Offset+(size_t)Element_Offset));
+ Element_Offset+=5;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_B6(const char* Name)
+{
+ INTEGRITY_SIZE_ATLEAST(6);
+ if (Config_DetailsLevel>0) Param(Name, BigEndian2int48u(Buffer+Buffer_Offset+(size_t)Element_Offset));
+ Element_Offset+=6;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_B7(const char* Name)
+{
+ INTEGRITY_SIZE_ATLEAST(7);
+ if (Config_DetailsLevel>0) Param(Name, BigEndian2int56u(Buffer+Buffer_Offset+(size_t)Element_Offset));
+ Element_Offset+=7;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_B8(const char* Name)
+{
+ INTEGRITY_SIZE_ATLEAST(8);
+ if (Config_DetailsLevel>0) Param(Name, BigEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset));
+ Element_Offset+=8;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_B16(const char* Name)
+{
+ INTEGRITY_SIZE_ATLEAST(16);
+ if (Config_DetailsLevel>0) Param(Name, BigEndian2int128u(Buffer+Buffer_Offset+(size_t)Element_Offset));
+ Element_Offset+=16;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_BF4(const char* Name)
+{
+ INTEGRITY_SIZE_ATLEAST(4);
+ if (Config_DetailsLevel>0) Param(Name, BigEndian2float32(Buffer+Buffer_Offset+(size_t)Element_Offset));
+ Element_Offset+=4;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_BFP4(size_t Bits, const char* Name)
+{
+ INTEGRITY_SIZE_ATLEAST(4);
+ BS_Begin();
+ int32u Integer=BS->Get4(Bits);
+ int32u Fraction=BS->Get4(32-Bits);
+ BS_End();
+ Element_Offset-=4; //Because of BS_End()
+ if (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) Param(Name, LittleEndian2int24u(Buffer+Buffer_Offset+(size_t)Element_Offset));
+ Element_Offset+=3;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_L4(const char* Name)
+{
+ INTEGRITY_SIZE_ATLEAST(4);
+ if (Config_DetailsLevel>0) Param(Name, LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset));
+ Element_Offset+=4;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_L5(const char* Name)
+{
+ INTEGRITY_SIZE_ATLEAST(5);
+ if (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) Param(Name, LittleEndian2int128u(Buffer+Buffer_Offset+(size_t)Element_Offset));
+ Element_Offset+=16;
+}
+
+//***************************************************************************
+// 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 (Config_DetailsLevel>0) Param_GUID(Name, Info);
+ Element_Offset+=16;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_GUID(const char* Name)
+{
+ INTEGRITY_SIZE_ATLEAST(16);
+ if (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) Param_UUID(Name, Info);
+ Element_Offset+=16;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_UUID(const char* Name)
+{
+ INTEGRITY_SIZE_ATLEAST(16);
+ if (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) Param(Name, "Unlimited");
+ Element_Offset++;
+ return;
+ }
+ int32u 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 (Config_DetailsLevel>0) Param(Name, Info);
+ Element_Offset+=Size;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_ES(int64s &Info, const char* Name)
+{
+ //Element size
+ INTEGRITY_SIZE_ATLEAST_INT(1);
+ int32u 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0)
+ {
+ 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 (Config_DetailsLevel>0)
+ {
+ 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();
+ int LeadingZeroBits=0;
+ while(BS->Remain()>0 && BS->Get(1)==0)
+ LeadingZeroBits++;
+ INTEGRITY(LeadingZeroBits<=32, "(Problem)", 0)
+ double InfoD=pow((float)2, (float)LeadingZeroBits)-1+BS->Get(LeadingZeroBits);
+ INTEGRITY(InfoD<int32u(-1), "(Problem)", 0)
+ Info=(int32s)(pow((double)-1, InfoD+1)*(int32u)ceil(InfoD/2));
+
+ if (Config_DetailsLevel>0)
+ Param(Name, Info);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_SE(const char* Name)
+{
+ INTEGRITY(BS->Remain(), "Size is wrong", 0)
+ int LeadingZeroBits=0;
+ while(BS->Remain()>0 && BS->Get(1)==0)
+ LeadingZeroBits++;
+ if (Config_DetailsLevel>0)
+ {
+ INTEGRITY(LeadingZeroBits<=32, "(Problem)", 0)
+ double InfoD=pow((float)2, (float)LeadingZeroBits)-1+BS->Get(LeadingZeroBits);
+ INTEGRITY(InfoD<int32u(-1), "(Problem)", 0)
+ Param(Name, (int32s)(pow(-1, InfoD+1)*(int32u)ceil(InfoD/2)));
+ }
+ else
+ BS->Skip(LeadingZeroBits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_UE(int32u &Info, const char* Name)
+{
+ INTEGRITY_SIZE_ATLEAST_BUFFER();
+ int LeadingZeroBits=0;
+ while(BS->Remain()>0 && BS->Get(1)==0)
+ LeadingZeroBits++;
+ INTEGRITY(LeadingZeroBits<=32, "(Problem)", 0)
+ double InfoD=pow(2, (float)LeadingZeroBits);
+ Info=(int32u)InfoD-1+BS->Get(LeadingZeroBits);
+
+ if (Config_DetailsLevel>0)
+ Param(Name, Info);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_UE(const char* Name)
+{
+ INTEGRITY(BS->Remain(), "Size is wrong", 0)
+ int LeadingZeroBits=0;
+ while(BS->Remain()>0 && BS->Get(1)==0)
+ LeadingZeroBits++;
+ if (Config_DetailsLevel>0)
+ {
+ INTEGRITY(LeadingZeroBits<=32, "(Problem)", 0)
+ double InfoD=pow(2, (float)LeadingZeroBits);
+ Param(Name, (int32u)InfoD-1+BS->Get(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 (Config_DetailsLevel>0)
+ 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 (Config_DetailsLevel>0)
+ 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(int32u Call(int8u Size, int32u ToCall), int32u &Info, const char* Name)
+{
+ //Element size
+ Info=0;
+ int32u Code=0;
+ int8u Size=0;
+ do
+ {
+ Size++;
+ INTEGRITY_INT(1<BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Code=(Code<<1)|(BS->GetB()?1:0);
+ Info=Call(Size, Code);
+ if (Info!=(int32u)-1)
+ break;
+ }
+ while (Size<=32);
+
+ //Integrity
+ if (Size>32)
+ {
+ Trusted_IsNot("Variable Length Code error");
+ Info=0;
+ return;
+ }
+
+ if (Config_DetailsLevel>0)
+ {
+ Element_Offset-=Size;
+ Param(Name, Info);
+ Element_Offset+=Size;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_VL(int32u Call(int8u Size, int32u ToCall), const char* Name)
+{
+ int32u Info;
+ Get_VL(Call, 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0 && 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 (Config_DetailsLevel>0 && 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 (Config_DetailsLevel>0 && 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 (Config_DetailsLevel>0 && 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 (Config_DetailsLevel>0 && 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 (Config_DetailsLevel>0 && 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 (Config_DetailsLevel>0 && Bytes) Param(Name, Info);
+ Element_Offset+=Bytes;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_Local(int64u Bytes, const char* Name)
+{
+ INTEGRITY_SIZE_ATLEAST(Bytes);
+ if (Config_DetailsLevel>0 && 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 (Config_DetailsLevel>0 && 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 (Config_DetailsLevel>0 && 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 (Config_DetailsLevel>0 && 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 (Config_DetailsLevel>0 && 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];
+ int8u Pad=(Size%2)?0:1;
+ INTEGRITY_SIZE_ATLEAST(1+Size+Pad);
+ if (Config_DetailsLevel>0 && Size) Param(Name, Ztring().From_Local((const char*)(Buffer+Buffer_Offset+(size_t)Element_Offset+1), (size_t)Size));
+ Element_Offset+=1+Size+Pad;
+}
+
+//***************************************************************************
+// Unknown
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_XX(int64u Bytes, const char* Name)
+{
+ //INTEGRITY_SIZE_ATLEAST_INT(Bytes);
+ if (Config_DetailsLevel>0 && 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<<Order))
+ Info=true;
+ else
+ Info=false;
+
+ Element_Begin();
+ if (Config_DetailsLevel>0) Param(Name, Info?"Yes":"No");
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_Flags (int64u ValueToPut, int8u &Info, const char* Name)
+{
+ Info=(int8u)ValueToPut;
+
+ Element_Begin();
+ if (Config_DetailsLevel>0) Param(Name, Info);
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_Flags(int64u Flags, size_t Order, const char* Name)
+{
+ Element_Begin();
+ if (Config_DetailsLevel>0) Param(Name, (Flags&((int64u)1<<Order))?"Yes":"No");
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_Flags(int64u ValueToPut, const char* Name)
+{
+ Element_Begin();
+ if (Config_DetailsLevel>0) Param(Name, ValueToPut);
+ Element_End();
+}
+
+//***************************************************************************
+// BitStream
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_BS(size_t Bits, int32u &Info, const char* Name)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get(Bits);
+ if (Config_DetailsLevel>0) 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 (Config_DetailsLevel>0) Param(Name, Info);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_S1(size_t Bits, int8u &Info, const char* Name)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get1(Bits);
+ if (Config_DetailsLevel>0) Param(Name, Info);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_S2(size_t Bits, int16u &Info, const char* Name)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get2(Bits);
+ if (Config_DetailsLevel>0) Param(Name, Info);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_S3(size_t Bits, int32u &Info, const char* Name)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get4(Bits);
+ if (Config_DetailsLevel>0) Param(Name, Info);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_S4(size_t Bits, int32u &Info, const char* Name)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get4(Bits);
+ if (Config_DetailsLevel>0) Param(Name, Info);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_S5(size_t Bits, int64u &Info, const char* Name)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get8(Bits);
+ if (Config_DetailsLevel>0) Param(Name, Info);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_S6(size_t Bits, int64u &Info, const char* Name)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get8(Bits);
+ if (Config_DetailsLevel>0) Param(Name, Info);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_S7(size_t Bits, int64u &Info, const char* Name)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get8(Bits);
+ if (Config_DetailsLevel>0) Param(Name, Info);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_S8(size_t Bits, int64u &Info, const char* Name)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get8(Bits);
+ if (Config_DetailsLevel>0) Param(Name, Info);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_BS(size_t Bits, int32u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Peek(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(size_t Bits, int8u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Peek1(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_S2(size_t Bits, int16u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Peek2(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_S4(size_t Bits, int32u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Peek4(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_S5(size_t Bits, int64u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Peek8(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_S6(size_t Bits, int64u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Peek8(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_S7(size_t Bits, int64u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Peek8(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_S8(size_t 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 (Config_DetailsLevel>0)
+ Param(Name, BS->Get(Bits));
+ else
+ BS->Skip(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_SB( const char* Name)
+{
+ INTEGRITY(1<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ if (Config_DetailsLevel>0)
+ Param(Name, BS->GetB());
+ else
+ BS->SkipB();
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_S1(size_t Bits, const char* Name)
+{
+ INTEGRITY(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ if (Config_DetailsLevel>0)
+ Param(Name, BS->Get1(Bits));
+ else
+ BS->Skip1(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_S2(size_t Bits, const char* Name)
+{
+ INTEGRITY(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ if (Config_DetailsLevel>0)
+ Param(Name, BS->Get2(Bits));
+ else
+ BS->Skip2(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_S3(size_t Bits, const char* Name)
+{
+ INTEGRITY(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ if (Config_DetailsLevel>0)
+ Param(Name, BS->Get4(Bits));
+ else
+ BS->Skip4(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_S4(size_t Bits, const char* Name)
+{
+ INTEGRITY(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ if (Config_DetailsLevel>0)
+ Param(Name, BS->Get4(Bits));
+ else
+ BS->Skip4(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_S5(size_t Bits, const char* Name)
+{
+ INTEGRITY(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ if (Config_DetailsLevel>0)
+ Param(Name, BS->Get8(Bits));
+ else
+ BS->Skip8(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_S6(size_t Bits, const char* Name)
+{
+ INTEGRITY(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ if (Config_DetailsLevel>0)
+ Param(Name, BS->Get8(Bits));
+ else
+ BS->Skip8(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_S7(size_t Bits, const char* Name)
+{
+ INTEGRITY(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ if (Config_DetailsLevel>0)
+ Param(Name, BS->Get8(Bits));
+ else
+ BS->Skip8(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_S8(size_t Bits, const char* Name)
+{
+ INTEGRITY(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ if (Config_DetailsLevel>0)
+ Param(Name, BS->Get8(Bits));
+ else
+ BS->Skip8(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");
+ }
+}
+
+} //NameSpace
+#endif //MEDIAINFO_TRACE
+
diff --git a/src/thirdparty/MediaInfo/File__Analyze_Buffer_MinimizeSize.cpp b/src/thirdparty/MediaInfo/File__Analyze_Buffer_MinimizeSize.cpp
new file mode 100644
index 000000000..0aef81bed
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File__Analyze_Buffer_MinimizeSize.cpp
@@ -0,0 +1,1249 @@
+// File__Analyze - Base for analyze files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+#if !MEDIAINFO_TRACE
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include "MediaInfo/MediaInfo_Config.h"
+#include "ZenLib/BitStream_LE.h"
+#include <cmath>
+using namespace std;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//---------------------------------------------------------------------------
+extern MediaInfo_Config Config;
+//---------------------------------------------------------------------------
+
+//Integrity test
+#define INTEGRITY(TOVALIDATE, ERRORTEXT, OFFSET) \
+ if (!(TOVALIDATE)) \
+ { \
+ Trusted_IsNot(ERRORTEXT); \
+ Element_Offset=Element_Size; \
+ return; \
+ } \
+
+#define INTEGRITY_INT(TOVALIDATE, ERRORTEXT, OFFSET) \
+ if (!(TOVALIDATE)) \
+ { \
+ Trusted_IsNot(ERRORTEXT); \
+ Element_Offset=Element_Size; \
+ Info=0; \
+ return; \
+ } \
+
+#define INTEGRITY_SIZE_ATLEAST(_BYTES) \
+ if (Element_Offset+_BYTES>Element_Size) \
+ { \
+ Trusted_IsNot("Size is wrong"); \
+ Element_Offset=Element_Size; \
+ return; \
+ } \
+
+#define INTEGRITY_SIZE_ATLEAST_STRING(_BYTES) \
+ if (Element_Offset+_BYTES>Element_Size) \
+ { \
+ Trusted_IsNot("Size is wrong"); \
+ Element_Offset=Element_Size; \
+ Info.clear(); \
+ return; \
+ } \
+
+#define INTEGRITY_SIZE_ATLEAST_INT(_BYTES) \
+ if (Element_Offset+_BYTES>Element_Size) \
+ { \
+ Trusted_IsNot("Size is wrong"); \
+ Element_Offset=Element_Size; \
+ Info=0; \
+ return; \
+ } \
+
+#define INTEGRITY_SIZE_ATLEAST_BUFFER() \
+ if (BS->Remain()==0) \
+ { \
+ Trusted_IsNot("Size is wrong"); \
+ Element_Offset=Element_Size; \
+ Info=0; \
+ return; \
+ } \
+
+//***************************************************************************
+// Init
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File__Analyze::BS_Begin()
+{
+ if (Element_Offset>Element_Size)
+ return; //There is a problem
+
+ size_t BS_Size;
+ if (Buffer_Offset+Element_Size<=Buffer_Size)
+ BS_Size=(size_t)(Element_Size-Element_Offset);
+ else
+ BS_Size=Buffer_Size-(size_t)(Buffer_Offset+Element_Offset);
+ BS->Attach(Buffer+Buffer_Offset+(size_t)Element_Offset, BS_Size);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::BS_Begin_LE()
+{
+ //Change the bitstream for Little Endian version
+ delete BS; BS=(BitStream*)new BitStream_LE();
+
+ BS_Begin();
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::BS_End()
+{
+ BS->Byte_Align();
+ Element_Offset+=BS->Offset_Get();
+ BS->Attach(NULL, 0);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::BS_End_LE()
+{
+ BS_End();
+
+ //Change the bitstream for the normal one
+ delete BS; BS=new BitStream;
+}
+
+//***************************************************************************
+// 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(size_t 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<<Bits)/2)
+ Integer-=1<<Bits;
+ Info=Integer+((float32)Fraction)/(1<<(32-Bits));
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B1(int8u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(1);
+ Info=BigEndian2int8u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B2(int16u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(2);
+ Info=BigEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B3(int32u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(3);
+ Info=BigEndian2int24u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B4(int32u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(4);
+ Info=BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B5(int64u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(5);
+ Info=BigEndian2int40u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B6(int64u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(6);
+ Info=BigEndian2int48u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B7(int64u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(7);
+ Info=BigEndian2int56u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B8(int64u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(8);
+ Info=BigEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_B16(int128u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(16);
+ Info=BigEndian2int128u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+}
+
+//***************************************************************************
+// Little Endian
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_L1(int8u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(1);
+ Info=LittleEndian2int8u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+ Element_Offset+=1;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_L2(int16u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(2);
+ Info=LittleEndian2int16u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+ Element_Offset+=2;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_L3(int32u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(3);
+ Info=LittleEndian2int24u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+ Element_Offset+=3;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_L4(int32u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(4);
+ Info=LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+ Element_Offset+=4;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_L5(int64u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(5);
+ Info=LittleEndian2int40u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+ Element_Offset+=5;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_L6(int64u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(6);
+ Info=LittleEndian2int48u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+ Element_Offset+=6;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_L7(int64u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(7);
+ Info=LittleEndian2int56u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+ Element_Offset+=7;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_L8(int64u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(8);
+ Info=LittleEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+ Element_Offset+=8;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_L16(int128u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(16);
+ //Info=LittleEndian2int128u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+ Info.lo=LittleEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+ Info.hi=LittleEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset+8);
+ Element_Offset+=16;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_LF4(float32 &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(4);
+ Info=LittleEndian2float32(Buffer+Buffer_Offset+(size_t)Element_Offset);
+ Element_Offset+=4;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_LF8(float64 &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_INT(8);
+ Info=LittleEndian2float64(Buffer+Buffer_Offset+(size_t)Element_Offset);
+ 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);
+}
+
+//***************************************************************************
+// GUID
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_GUID(int128u &Info)
+{
+ 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);
+ Element_Offset+=16;
+}
+
+//***************************************************************************
+// UUID
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_UUID(int128u &Info)
+{
+ 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);
+ Element_Offset+=16;
+}
+
+//***************************************************************************
+// EBML
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_EB(int64u &Info)
+{
+ //Element size
+ INTEGRITY_SIZE_ATLEAST_INT(1);
+ if (Buffer[Buffer_Offset+Element_Offset]==0xFF)
+ {
+ Info=File_Size-(File_Offset+Buffer_Offset+Element_Offset);
+ Element_Offset++;
+ return;
+ }
+ int32u 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;
+ }
+
+ Element_Offset+=Size;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_ES(int64s &Info)
+{
+ //Element size
+ INTEGRITY_SIZE_ATLEAST_INT(1);
+ int32u 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;
+ }
+
+ 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(), "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 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(), "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
+ }
+}
+
+//***************************************************************************
+// Exp-Golomb
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_SE(int32s &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_BUFFER();
+ int LeadingZeroBits=0;
+ while(BS->Remain()>0 && BS->Get(1)==0)
+ LeadingZeroBits++;
+ INTEGRITY(LeadingZeroBits<=32, "(Problem)", 0)
+ double InfoD=pow((float)2, (float)LeadingZeroBits)-1+BS->Get(LeadingZeroBits);
+ INTEGRITY(InfoD<int32u(-1), "(Problem)", 0)
+ Info=(int32s)(pow((double)-1, InfoD+1)*(int32u)ceil(InfoD/2));
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_SE()
+{
+ INTEGRITY(BS->Remain(), "Size is wrong", 0)
+ int LeadingZeroBits=0;
+ while(BS->Remain()>0 && BS->Get(1)==0)
+ LeadingZeroBits++;
+ BS->Skip(LeadingZeroBits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_UE(int32u &Info)
+{
+ INTEGRITY_SIZE_ATLEAST_BUFFER();
+ int LeadingZeroBits=0;
+ while(BS->Remain()>0 && BS->Get(1)==0)
+ LeadingZeroBits++;
+ INTEGRITY(LeadingZeroBits<=32, "(Problem)", 0)
+ double InfoD=pow((float)2, (float)LeadingZeroBits);
+ Info=(int32u)InfoD-1+BS->Get(LeadingZeroBits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_UE()
+{
+ INTEGRITY(BS->Remain(), "Size is wrong", 0)
+ int LeadingZeroBits=0;
+ while(BS->Remain()>0 && BS->Get(1)==0)
+ 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(int32u Call(int8u Size, int32u ToCall), int32u &Info)
+{
+ //Element size
+ Info=0;
+ int32u Code=0;
+ int8u Size=0;
+ do
+ {
+ Size++;
+ INTEGRITY_INT(1<BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Code=(Code<<1)|(BS->GetB()?1:0);
+ Info=Call(Size, Code);
+ if (Info!=(int32u)-1)
+ break;
+ }
+ while (Size<=32);
+
+ //Integrity
+ if (Size>32)
+ {
+ Trusted_IsNot("Variable Length Code error");
+ Info=0;
+ return;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Skip_VL(int32u Call(int8u Size, int32u ToCall))
+{
+ int32u Info;
+ Get_VL(Call, Info);
+}
+
+//***************************************************************************
+// 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_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);
+}
+
+//***************************************************************************
+// Flags
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_Flags (int64u Flags, size_t Order, bool &Info)
+{
+ if (Flags&((int64u)1<<Order))
+ Info=true;
+ else
+ Info=false;
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_Flags (int64u ValueToPut, int8u &Info)
+{
+ Info=(int8u)ValueToPut;
+}
+
+//***************************************************************************
+// BitStream
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_BS(size_t Bits, int32u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_SB( bool &Info)
+{
+ INTEGRITY_INT(1<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->GetB();
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_S1(size_t Bits, int8u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get1(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_S2(size_t Bits, int16u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get2(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_S3(size_t Bits, int32u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get4(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_S4(size_t Bits, int32u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get4(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_S5(size_t Bits, int64u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get8(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_S6(size_t Bits, int64u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get8(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_S7(size_t Bits, int64u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get8(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Get_S8(size_t Bits, int64u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Get8(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_BS(size_t Bits, int32u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Peek(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(size_t Bits, int8u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Peek1(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_S2(size_t Bits, int16u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Peek2(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_S4(size_t Bits, int32u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Peek4(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_S5(size_t Bits, int64u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Peek8(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_S6(size_t Bits, int64u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Peek8(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_S7(size_t Bits, int64u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Peek8(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Peek_S8(size_t Bits, int64u &Info)
+{
+ INTEGRITY_INT(Bits<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ Info=BS->Peek8(Bits);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Mark_0_NoTrustError()
+{
+ INTEGRITY(1<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ BS->GetB();
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Mark_0()
+{
+ INTEGRITY(1<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ if (BS->GetB())
+ Element_DoNotTrust("Mark bit is wrong");
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Mark_1()
+{
+ INTEGRITY(1<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ if (!BS->GetB())
+ Element_DoNotTrust("Mark bit is wrong");
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Mark_1_NoTrustError()
+{
+ INTEGRITY(1<=BS->Remain(), "Size is wrong", BS->Offset_Get())
+ BS->GetB();
+}
+
+} //NameSpace
+#endif //MEDIAINFO_TRACE
+
diff --git a/src/thirdparty/MediaInfo/File__Analyze_MinimizeSize.h b/src/thirdparty/MediaInfo/File__Analyze_MinimizeSize.h
new file mode 100644
index 000000000..04570dab2
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File__Analyze_MinimizeSize.h
@@ -0,0 +1,1047 @@
+//***************************************************************************
+// 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);
+ void Open_Buffer_Continue (File__Analyze* Sub, size_t Buffer_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) {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);
+ 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];
+ #endif //MEDIAINFO_EVENTS
+ Ztring File_Name_WithoutDemux;
+ bool PTS_DTS_Needed;
+ int64u PCR; //In nanoseconds
+ int64u PTS; //In nanoseconds
+ int64u DTS; //In nanoseconds
+
+ //Out
+ int64u PTS_DTS_Offset_InThisBlock; //In nanoseconds
+ size_t Frame_Count_InThisBlock;
+
+protected :
+ //***************************************************************************
+ // Streams management
+ //***************************************************************************
+
+ virtual void Streams_Fill() {};
+ 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();
+
+ //***************************************************************************
+ // 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_Continue_Once () {}; //Temp, should be in File__Base caller
+ virtual void Read_Buffer_Unsynched () {}; //Temp, should be in File__Base caller
+ 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 ();
+ inline void Element_Begin (const Ztring &, int64u Size=(int64u)-1) {Element_Begin(Size);}
+ void Element_Begin (int64u Size);
+ inline void Element_Begin (const char *, int64u Size=(int64u)-1) {Element_Begin(Size);}
+
+ //Elements - Name
+ #define Element_Name(_A)
+
+ //Elements - Info
+ inline void Element_Info (const Ztring &) {}
+ inline void Element_Info (const char*) {}
+ inline void Element_Info (const char*, const char* ) {}
+ inline void Element_Info (int8s , const char* =NULL) {}
+ inline void Element_Info (int8u , const char* =NULL) {}
+ inline void Element_Info (int16s , const char* =NULL) {}
+ inline void Element_Info (int16u , const char* =NULL) {}
+ inline void Element_Info (int32s , const char* =NULL) {}
+ inline void Element_Info (int32u , const char* =NULL) {}
+ inline void Element_Info (int64s , const char* =NULL) {}
+ inline void Element_Info (int64u , const char* =NULL) {}
+ inline void Element_Info (int128u , const char* =NULL) {}
+ #ifdef NEED_SIZET
+ inline void Element_Info (size_t , const char* =NULL) {}
+ #endif //NEED_SIZET
+ inline void Element_Info (float32 , int8u =3, const char* =NULL) {}
+ inline void Element_Info (float64 , int8u =3, const char* =NULL) {}
+ #define Element_Info_From_Milliseconds(_A)
+
+ //Elements - End
+ void Element_End ();
+ inline void Element_End (const Ztring &, int64u Size=(int64u)-1) {Element_End(Size);}
+ void Element_End (int64u Size);
+ inline void Element_End (const char* , int64u Size=(int64u)-1) {Element_End(Size);}
+
+ //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
+ //***************************************************************************
+
+ //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, 16).MakeUpperCase()+_T(" (")+Ztring::ToZtring(Value, 10).MakeUpperCase()+_T(")")
+
+ //Param - Main
+ inline void Param (const Ztring &, const Ztring&) {}
+ inline void Param (const char*, const Ztring&) {}
+ inline void Param (const char*, const std::string&) {}
+ inline void Param (const char*, const char*, size_t =Unlimited, bool =true) {}
+ inline void Param (const char*, const int8u*, size_t =Unlimited, bool =true) {}
+ inline void Param (const char*, bool) {}
+ inline void Param (const char*, int8u) {}
+ inline void Param (const char*, int8s) {}
+ inline void Param (const char*, int16u) {}
+ inline void Param (const char*, int16s) {}
+ inline void Param (const char*, int32u) {}
+ inline void Param (const char*, int32s) {}
+ inline void Param (const char*, int64u) {}
+ inline void Param (const char*, int64s) {}
+ inline void Param (const char*, int128u) {}
+ inline void Param_GUID (const char*, int128u) {}
+ inline void Param_UUID (const char*, int128u) {}
+ #ifdef NEED_SIZET
+ inline void Param (const char*, size_t, intu =16) {}
+ #endif //NEED_SIZET
+ inline void Param (const char*, float32, intu =3) {}
+ inline void Param (const char*, float64, intu =3) {}
+ inline void Param (const char*, float80, intu =3) {}
+ inline void Param (const int32u, const Ztring&) {}
+ inline void Param (const int16u, const Ztring&) {}
+
+ //Param - Info
+ inline void Param_Info (const Ztring &) {}
+ inline void Param_Info (const char*) {}
+ inline void Param_Info (const char*, const char*) {}
+ inline void Param_Info (int64u , const char* =NULL) {}
+ inline void Param_Info (int64s , const char* =NULL) {}
+ inline void Param_Info (int32u , const char* =NULL) {}
+ inline void Param_Info (int32s , const char* =NULL) {}
+ inline void Param_Info (int16u , const char* =NULL) {}
+ inline void Param_Info (int16s , const char* =NULL) {}
+ inline void Param_Info (int8u , const char* =NULL) {}
+ inline void Param_Info (int8s , const char* =NULL) {}
+ inline void Param_Info (float32 , int8u =3, const char* =NULL) {}
+ inline void Param_Info (float64 , int8u =3, const char* =NULL) {}
+ inline void Param_Info (float80 , int8u =3, const char* =NULL) {}
+ #ifdef NEED_SIZET
+ inline void Param_Info (size_t , const char* =NULL) {}
+ #endif //NEED_SIZET
+ inline void Param_Info_From_Milliseconds (int64u) {}
+
+ //***************************************************************************
+ // 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 (size_t Bits, float32 &Info);
+ inline void Get_B1 (int8u &Info, const char*) {Get_B1(Info);}
+ inline void Get_B2 (int16u &Info, const char*) {Get_B2(Info);}
+ inline void Get_B3 (int32u &Info, const char*) {Get_B3(Info);}
+ inline void Get_B4 (int32u &Info, const char*) {Get_B4(Info);}
+ inline void Get_B5 (int64u &Info, const char*) {Get_B5(Info);}
+ inline void Get_B6 (int64u &Info, const char*) {Get_B6(Info);}
+ inline void Get_B7 (int64u &Info, const char*) {Get_B7(Info);}
+ inline void Get_B8 (int64u &Info, const char*) {Get_B8(Info);}
+ inline void Get_B16 (int128u &Info, const char*) {Get_B16(Info);}
+ inline void Get_BF4 (float32 &Info, const char*) {Get_BF4(Info);}
+ inline void Get_BF8 (float64 &Info, const char*) {Get_BF8(Info);}
+ inline void Get_BF10 (float80 &Info, const char*) {Get_BF10(Info);}
+ inline void Get_BFP4 (size_t Bits, float32 &Info, const char*) {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(size_t Bits, float64 &Info);
+ inline void Skip_B1 ( const char*) {if (Element_Offset+1>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=1;}
+ inline void Skip_B2 ( const char*) {if (Element_Offset+2>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=2;}
+ inline void Skip_B3 ( const char*) {if (Element_Offset+3>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=3;}
+ inline void Skip_B4 ( const char*) {if (Element_Offset+4>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=4;}
+ inline void Skip_B5 ( const char*) {if (Element_Offset+5>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=5;}
+ inline void Skip_B6 ( const char*) {if (Element_Offset+6>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=6;}
+ inline void Skip_B7 ( const char*) {if (Element_Offset+7>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=7;}
+ inline void Skip_B8 ( const char*) {if (Element_Offset+8>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=8;}
+ inline void Skip_BF4 ( const char*) {if (Element_Offset+4>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=4;}
+ inline void Skip_BF8 ( const char*) {if (Element_Offset+8>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=8;}
+ inline void Skip_B16 ( const char*) {if (Element_Offset+16>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=16;}
+ inline void Skip_BFP4(size_t, const char*) {if (Element_Offset+4>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=4;};
+ #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_BF8(_INFO, _NAME)
+ #define Info_BFP4(_BITS, _INFO, _NAME) float32 _INFO; Get_BFP4(_BITS, _INFO, _NAME)
+
+ //***************************************************************************
+ // 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);
+ inline void Get_L1 (int8u &Info, const char*) {Get_L1(Info);}
+ inline void Get_L2 (int16u &Info, const char*) {Get_L2(Info);}
+ inline void Get_L3 (int32u &Info, const char*) {Get_L3(Info);}
+ inline void Get_L4 (int32u &Info, const char*) {Get_L4(Info);}
+ inline void Get_L5 (int64u &Info, const char*) {Get_L5(Info);}
+ inline void Get_L6 (int64u &Info, const char*) {Get_L6(Info);}
+ inline void Get_L7 (int64u &Info, const char*) {Get_L7(Info);}
+ inline void Get_L8 (int64u &Info, const char*) {Get_L8(Info);}
+ inline void Get_L16 (int128u &Info, const char*) {Get_L16(Info);}
+ inline void Get_LF4 (float32 &Info, const char*) {Get_LF4(Info);}
+ inline void Get_LF8 (float64 &Info, const char*) {Get_LF8(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);
+ inline void Skip_L1 ( const char*) {if (Element_Offset+1>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=1;}
+ inline void Skip_L2 ( const char*) {if (Element_Offset+2>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=2;}
+ inline void Skip_L3 ( const char*) {if (Element_Offset+3>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=3;}
+ inline void Skip_L4 ( const char*) {if (Element_Offset+4>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=4;}
+ inline void Skip_L5 ( const char*) {if (Element_Offset+5>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=5;}
+ inline void Skip_L6 ( const char*) {if (Element_Offset+6>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=6;}
+ inline void Skip_L7 ( const char*) {if (Element_Offset+7>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=7;}
+ inline void Skip_L8 ( const char*) {if (Element_Offset+8>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=8;}
+ inline void Skip_LF4 ( const char*) {if (Element_Offset+4>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=4;}
+ inline void Skip_LF8 ( const char*) {if (Element_Offset+8>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=8;}
+ inline void Skip_L16 ( const char*) {if (Element_Offset+16>Element_Size) {Trusted_IsNot(); return;} Element_Offset+=16;}
+ #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)
+
+ //***************************************************************************
+ // 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
+ //***************************************************************************
+
+ void Get_UUID (int128u &Info);
+ inline void Get_UUID (int128u &Info, const char*) {Get_UUID(Info);}
+ void Peek_UUID(int128u &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();
+ void Skip_SE();
+ 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
+ //***************************************************************************
+
+ void Get_VL (int32u Call(int8u Size, int32u ToCall), int32u &Info);
+ inline void Get_VL (int32u Call(int8u Size, int32u ToCall), int32u &Info, const char*) {Get_VL(Call, Info);};
+ void Skip_VL(int32u Call(int8u Size, int32u ToCall));
+ inline void Skip_VL(int32u Call(int8u Size, int32u ToCall), const char*) {Skip_VL(Call);};
+ #define Info_VL(_CALL, _INFO, _NAME) int32u _INFO; Get_VL(_CALL, _INFO, _NAME)
+
+ //***************************************************************************
+ // 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_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_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
+ //***************************************************************************
+
+ inline void Skip_XX(int64u Bytes, const char*) {Element_Offset+=Bytes;}
+
+ //***************************************************************************
+ // Flags
+ //***************************************************************************
+
+ void Get_Flags (int64u Flags, size_t Order, bool &Info);
+ void Get_Flags (int64u ValueToPut, int8u &Info);
+ inline void Get_Flags (int64u Flags, size_t Order, bool &Info, const char*) {Get_Flags(Flags, Order, Info);}
+ inline void Get_Flags (int64u ValueToPut, int8u &Info, const char*) {Get_Flags(ValueToPut, Info);}
+ inline void Skip_Flags(int64u, size_t, const char*) {}
+ inline void Skip_Flags(int64u, const char*) {}
+ #define Info_Flags(_FLAGS, _ORDER, _INFO, _NAME) bool _INFO; Get_Flags (_FLAGS, _ORDER, _INFO, _NAME)
+
+ //***************************************************************************
+ // BitStream
+ //***************************************************************************
+
+ void Get_BS (size_t Bits, int32u &Info);
+ void Get_SB ( bool &Info);
+ bool Get_SB () {bool Temp; Get_SB(Temp); return Temp;}
+ void Get_S1 (size_t Bits, int8u &Info);
+ void Get_S2 (size_t Bits, int16u &Info);
+ void Get_S3 (size_t Bits, int32u &Info);
+ void Get_S4 (size_t Bits, int32u &Info);
+ void Get_S5 (size_t Bits, int64u &Info);
+ void Get_S6 (size_t Bits, int64u &Info);
+ void Get_S7 (size_t Bits, int64u &Info);
+ void Get_S8 (size_t Bits, int64u &Info);
+ inline void Get_BS (size_t Bits, int32u &Info, const char*) {Get_BS(Bits, Info);}
+ inline void Get_SB ( bool &Info, const char*) {Get_SB( Info);}
+ inline void Get_S1 (size_t Bits, int8u &Info, const char*) {Get_S1(Bits, Info);}
+ inline void Get_S2 (size_t Bits, int16u &Info, const char*) {Get_S2(Bits, Info);}
+ inline void Get_S3 (size_t Bits, int32u &Info, const char*) {Get_S3(Bits, Info);}
+ inline void Get_S4 (size_t Bits, int32u &Info, const char*) {Get_S4(Bits, Info);}
+ inline void Get_S5 (size_t Bits, int64u &Info, const char*) {Get_S5(Bits, Info);}
+ inline void Get_S6 (size_t Bits, int64u &Info, const char*) {Get_S6(Bits, Info);}
+ inline void Get_S7 (size_t Bits, int64u &Info, const char*) {Get_S7(Bits, Info);}
+ inline void Get_S8 (size_t Bits, int64u &Info, const char*) {Get_S8(Bits, Info);}
+ void Peek_BS(size_t Bits, int32u &Info);
+ void Peek_SB( bool &Info);
+ bool Peek_SB() {bool Temp; Peek_SB(Temp); return Temp;}
+ void Peek_S1(size_t Bits, int8u &Info);
+ void Peek_S2(size_t Bits, int16u &Info);
+ void Peek_S3(size_t Bits, int32u &Info);
+ void Peek_S4(size_t Bits, int32u &Info);
+ void Peek_S5(size_t Bits, int64u &Info);
+ void Peek_S6(size_t Bits, int64u &Info);
+ void Peek_S7(size_t Bits, int64u &Info);
+ void Peek_S8(size_t Bits, int64u &Info);
+ void Skip_BS(size_t Bits);
+ void Skip_SB( );
+ void Skip_S1(size_t Bits);
+ void Skip_S2(size_t Bits);
+ void Skip_S3(size_t Bits);
+ void Skip_S4(size_t Bits);
+ void Skip_S5(size_t Bits);
+ void Skip_S6(size_t Bits);
+ void Skip_S7(size_t Bits);
+ void Skip_S8(size_t Bits);
+ inline void Skip_BS(size_t Bits, const char*) {BS->Skip8(Bits);}
+ inline void Skip_SB( const char*) {BS->Skip1(1);}
+ inline void Skip_S1(size_t Bits, const char*) {BS->Skip1(Bits);}
+ inline void Skip_S2(size_t Bits, const char*) {BS->Skip2(Bits);}
+ inline void Skip_S3(size_t Bits, const char*) {BS->Skip4(Bits);}
+ inline void Skip_S4(size_t Bits, const char*) {BS->Skip4(Bits);}
+ inline void Skip_S5(size_t Bits, const char*) {BS->Skip8(Bits);}
+ inline void Skip_S6(size_t Bits, const char*) {BS->Skip8(Bits);}
+ inline void Skip_S7(size_t Bits, const char*) {BS->Skip8(Bits);}
+ inline void Skip_S8(size_t Bits, const char*) {BS->Skip8(Bits);}
+ 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_Begin(_NAME); \
+ Skip_SB( _NAME); \
+
+ #define TEST_SB_SKIP(_NAME) \
+ { \
+ if (!Peek_SB()) \
+ Skip_SB( _NAME); \
+ else \
+ { \
+ Element_Begin(_NAME); \
+ Skip_SB( _NAME); \
+
+ #define TESTELSE_SB_GET(_CODE, _NAME) \
+ { \
+ Peek_SB(_CODE); \
+ if (_CODE) \
+ { \
+ Element_Begin(_NAME); \
+ Skip_SB( _NAME); \
+
+ #define TESTELSE_SB_SKIP(_NAME) \
+ { \
+ if (Peek_SB()) \
+ { \
+ Element_Begin(_NAME); \
+ Skip_SB( _NAME); \
+
+ #define TESTELSE_SB_ELSE(_NAME) \
+ Element_End(); \
+ } \
+ else \
+ { \
+ Skip_SB( _NAME); \
+
+ #define TESTELSE_SB_END() \
+ } \
+ } \
+
+ #define TEST_SB_END() \
+ Element_End(); \
+ } \
+ } \
+
+ //***************************************************************************
+ // 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
+ //***************************************************************************
+
+ //Before filling the stream, the stream must be prepared
+ size_t Stream_Prepare (stream_t KindOfStream);
+
+ //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 NEED_SIZET
+ 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 //NEED_SIZET
+ //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 NEED_SIZET
+ 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 //NEED_SIZET
+ 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 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 ();
+
+ //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() \
+ }
+
+ //***************************************************************************
+ // 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
+
+ //***************************************************************************
+ // 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_Chapters(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 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);
+ void CodecID_Fill (const Ztring &Value, stream_t StreamKind, size_t StreamPos, infocodecid_format_t Format);
+
+ //***************************************************************************
+ //
+ //***************************************************************************
+
+protected :
+ #if MEDIAINFO_TRACE
+ //Save for speed improvement
+ float Config_Details;
+ #endif //MEDIAINFO_TRACE
+ 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
+ bool Synched; //Data is synched
+ 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
+ void Open_Buffer_Continue_Loop();
+protected :
+ //Buffer
+ const int8u* Buffer;
+public : //TO CHANGE
+ size_t Buffer_Size;
+ int64u Buffer_TotalBytes_FirstSynched;
+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;
+ int64u Buffer_TotalBytes_FirstSynched_Max;
+ friend class File__Tags_Helper;
+
+ //***************************************************************************
+ // Helpers
+ //***************************************************************************
+
+ bool FileHeader_Begin_0x000001();
+ bool Synchronize_0x000001();
+
+private :
+
+ //***************************************************************************
+ // Elements
+ //***************************************************************************
+
+ //Element
+ BitStream* BS; //For conversion from bytes to bitstream
+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_details> Element;
+
+private :
+
+ //NextCode
+ std::map<int64u, bool> NextCode;
+
+ //BookMarks
+ size_t BookMark_Element_Level;
+ int64u BookMark_GoTo;
+ std::vector<int64u> BookMark_Code;
+ std::vector<int64u> 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,
+ };
+ bool ShouldContinueParsing;
+
+ //Configuration
+ bool MustSynchronize;
+
+ //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);
+ #else //MEDIAINFO_DEMUX
+ #define Demux(_A, _B, _C)
+ #endif //MEDIAINFO_DEMUX
+
+ //Events data
+ #if MEDIAINFO_EVENTS
+ bool MpegPs_PES_FirstByte_IsAvailable;
+ bool MpegPs_PES_FirstByte_Value;
+ #endif //MEDIAINFO_EVENTS
+};
+
+//Helpers
+#define DETAILS_INFO(_DATA)
diff --git a/src/thirdparty/MediaInfo/File__Analyze_Streams.cpp b/src/thirdparty/MediaInfo/File__Analyze_Streams.cpp
new file mode 100644
index 000000000..ee9d9e581
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File__Analyze_Streams.cpp
@@ -0,0 +1,2066 @@
+// File__Analyze - Base for analyze files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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 <cmath>
+#ifdef SS
+ #undef SS //Solaris defines this somewhere
+#endif
+using namespace std;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//---------------------------------------------------------------------------
+extern MediaInfo_Config Config;
+//---------------------------------------------------------------------------
+
+//***************************************************************************
+// Preparation des streams
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+size_t File__Analyze::Stream_Prepare (stream_t KindOfStream)
+{
+ //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;
+ }
+
+ //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;
+
+ //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);
+ Fill(StreamKind_Last, StreamPos_Last, General_StreamKindID, StreamPos_Last);
+ for (size_t Pos=0; Pos<=StreamPos_Last; Pos++)
+ {
+ Fill(StreamKind_Last, Pos, General_StreamCount, Count_Get(StreamKind_Last), 10, true);
+ if (Count_Get(StreamKind_Last)>1)
+ Fill(StreamKind_Last, Pos, General_StreamKindPos, Pos+1, 10, true);
+ }
+
+ //Filling Lists & Counts
+ if (!IsSub && KindOfStream!=Stream_General)
+ {
+ const Ztring& StreamKind_Text=Get(KindOfStream, 0, General_StreamKind, Info_Text);
+ if (Count_Get(KindOfStream)>1)
+ {
+ Ztring Temp;
+ Temp=Retrieve(Stream_General, 0, Ztring(StreamKind_Text+_T("_Codec_List")).To_Local().c_str())+_T(" / ");
+ Fill(Stream_General, 0, Ztring(StreamKind_Text+_T("_Codec_List")).To_Local().c_str(), Temp, true);
+ Temp=Retrieve(Stream_General, 0, Ztring(StreamKind_Text+_T("_Language_List")).To_Local().c_str())+_T(" / ");
+ Fill(Stream_General, 0, Ztring(StreamKind_Text+_T("_Language_List")).To_Local().c_str(), Temp, true);
+ Temp=Retrieve(Stream_General, 0, Ztring(StreamKind_Text+_T("_Format_List")).To_Local().c_str())+_T(" / ");
+ Fill(Stream_General, 0, Ztring(StreamKind_Text+_T("_Format_List")).To_Local().c_str(), Temp, true);
+ Temp=Retrieve(Stream_General, 0, Ztring(StreamKind_Text+_T("_Format_WithHint_List")).To_Local().c_str())+_T(" / ");
+ Fill(Stream_General, 0, Ztring(StreamKind_Text+_T("_Format_WithHint_List")).To_Local().c_str(), Temp, true);
+ }
+
+ Fill(Stream_General, 0, Ztring(StreamKind_Text+_T("Count")).To_Local().c_str(), StreamPos_Last+1, 10, true);
+ }
+
+ //File name and dates
+ if (!IsSub && KindOfStream==Stream_General && File_Name.size()>0)
+ {
+ //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).MakeLowerCase());
+ }
+ 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 && Begin<End)
+ FileName_Modified.erase(Begin, End-Begin);
+ Fill (Stream_General, 0, General_CompleteName, FileName_Modified);
+ }
+
+ //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)
+ Fill (Stream_General, 0, General_FileSize, File_Size);
+
+ //Fill with already ready data
+ for (size_t Pos=0; Pos<Fill_Temp.size(); Pos++)
+ if (Fill_Temp(Pos, 0).IsNumber())
+ Fill(StreamKind_Last, StreamPos_Last, Fill_Temp(Pos, 0).To_int32u(), Fill_Temp(Pos, 1));
+ else
+ Fill(StreamKind_Last, StreamPos_Last, Fill_Temp(Pos, 0).To_UTF8().c_str(), Fill_Temp(Pos, 1));
+ Fill_Temp.clear();
+
+ 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;
+
+ 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_Resolution))
+ Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_BitDepth), Value, Replace);
+ 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.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;
+ 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);
+ }
+
+ //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)
+ {
+ //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);
+
+ //Lists
+ if (StreamKind!=Stream_General)
+ {
+ const Ztring& Parameter_Text=MediaInfoLib::Config.Info_Get(StreamKind).Read(Parameter, Info_Name);
+ if (Parameter_Text==_T("Codec/String")
+ || Parameter_Text==_T("Language/String")
+ || Parameter_Text==_T("Format")
+ || Parameter_Text==_T("CodecID/Hint"))
+ {
+ Ztring Temp1, Temp2;
+ for (size_t StreamPos_Local=0; StreamPos_Local<(*Stream)[StreamKind].size(); StreamPos_Local++)
+ {
+ if (Parameter_Text==_T("CodecID/Hint"))
+ Temp1+=Retrieve(StreamKind, StreamPos_Local, Fill_Parameter(StreamKind, Generic_Format))+_T(" / ");
+ else
+ Temp1+=Retrieve(StreamKind, StreamPos_Local, Parameter)+_T(" / ");
+ if (Parameter_Text==_T("Format")
+ || Parameter_Text==_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 (Parameter_Text==_T("Codec/String"))
+ Fill(Stream_General, 0, Ztring(StreamKind_Text+_T("_Codec_List")).To_Local().c_str(), Temp1, true);
+ if (Parameter_Text==_T("Language/String"))
+ Fill(Stream_General, 0, Ztring(StreamKind_Text+_T("_Language_List")).To_Local().c_str(), Temp1, true);
+ if (Parameter_Text==_T("Format")
+ || Parameter_Text==_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);
+ }
+ }
+ }
+
+ //BitRate_Mode / OverallBitRate_Mode
+ if (Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==(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; Pos<List.size(); Pos++)
+ List[Pos]=MediaInfoLib::Config.Language_Get(Ztring(_T("BitRate_Mode_"))+List[Pos]);
+
+ Ztring Translated=List.Read();
+ Fill(StreamKind, StreamPos, StreamKind==Stream_General?"OverallBitRate_Mode/String":"BitRate_Mode/String", Translated.find(_T("BitRate_Mode_"))?Translated:Value);
+ }
+
+ //Encoded_Library
+ if (Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("Encoded_Library")
+ || Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("Encoded_Library/Name")
+ || Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("Encoded_Library/Version")
+ || Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("Encoded_Library/Date"))
+ {
+ Ztring Name=Retrieve(StreamKind, StreamPos, "Encoded_Library/Name");
+ Ztring Version=Retrieve(StreamKind, StreamPos, "Encoded_Library/Version");
+ Ztring Date=Retrieve(StreamKind, StreamPos, "Encoded_Library/Date");
+ if (!Name.empty())
+ {
+ Ztring String=Name;
+ if (!Version.empty())
+ {
+ String+=_T(" ");
+ String+=Version;
+ }
+ if (!Date.empty())
+ {
+ String+=_T(" (");
+ String+=Date;
+ String+=_T(")");
+ }
+ Fill(StreamKind, StreamPos, "Encoded_Library/String", String, true);
+ }
+ else
+ Fill(StreamKind, StreamPos, "Encoded_Library/String", Retrieve(StreamKind, StreamPos, "Encoded_Library"), true);
+ }
+
+ //Format_Settings_Matrix
+ if (StreamKind==Stream_Video && Parameter==Video_Format_Settings_Matrix)
+ {
+ Ztring Translated=MediaInfoLib::Config.Language_Get(Ztring(_T("Format_Settings_Matrix_"))+Value);
+ Fill(Stream_Video, StreamPos, Video_Format_Settings_Matrix_String, Translated.find(_T("Format_Settings_Matrix_"))?Translated:Value, true);
+ }
+
+ //Scan type
+ if (StreamKind==Stream_Video && Parameter==Video_ScanType)
+ {
+ Ztring Translated=MediaInfoLib::Config.Language_Get(Ztring(_T("Interlaced_"))+Value);
+ Fill(Stream_Video, StreamPos, Video_ScanType_String, Translated.find(_T("Interlaced_"))?Translated:Value, true);
+ }
+
+ //Scan order
+ if (StreamKind==Stream_Video && Parameter==Video_ScanOrder)
+ {
+ Ztring Translated=MediaInfoLib::Config.Language_Get(Ztring(_T("Interlaced_"))+Value);
+ Fill(Stream_Video, StreamPos, Video_ScanOrder_String, Translated.find(_T("Interlaced_"))?Translated:Value, true);
+ }
+
+ //Interlacement
+ if (StreamKind==Stream_Video && Parameter==Video_Interlacement)
+ {
+ const Ztring &Z1=Retrieve(Stream_Video, StreamPos, Video_Interlacement);
+ if (Z1.size()==3)
+ Fill(Stream_Video, StreamPos, Video_Interlacement_String, MediaInfoLib::Config.Language_Get(Ztring(_T("Interlaced_"))+Z1), true);
+ else
+ Fill(Stream_Video, StreamPos, Video_Interlacement_String, MediaInfoLib::Config.Language_Get(Z1), true);
+ if (Retrieve(Stream_Video, StreamPos, Video_Interlacement_String).empty())
+ Fill(Stream_Video, StreamPos, Video_Interlacement_String, Z1, true);
+ }
+
+ //FrameRate_Mode
+ if (StreamKind==Stream_Video && Parameter==Video_FrameRate_Mode)
+ {
+ Ztring Translated=MediaInfoLib::Config.Language_Get(Ztring(_T("FrameRate_Mode_"))+Value);
+ Fill(Stream_Video, StreamPos, Video_FrameRate_Mode_String, Translated.find(_T("FrameRate_Mode_"))?Translated:Value, true);
+ }
+ }
+
+ //Filling Lists & Counts
+ if (StreamKind!=Stream_General && (Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("Codec")
+ || Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("Language/String")
+ || Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("Format")
+ || Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("CodecID/Hint")
+ ))
+ {
+ const Ztring& StreamKind_Text=Get(StreamKind, 0, General_StreamKind, Info_Text);
+ Ztring Temp1, Temp2;
+ for (size_t Pos=0; Pos<Count_Get(StreamKind); Pos++)
+ {
+ if (Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("Format")
+ || Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("CodecID/Hint"))
+ {
+ Temp1+=Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_Format))+_T(" / ");
+ Temp2+=Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_Format));
+ if (!Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_CodecID_Hint)).empty())
+ {
+ Temp2+=_T(" (");
+ Temp2+=Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_CodecID_Hint));
+ Temp2+=_T(")");
+ }
+ Temp2+=_T(" / ");
+ }
+ else
+ Temp1+=Retrieve(StreamKind, Pos, Parameter)+_T(" / ");
+ }
+ Temp1.resize(Temp1.size()-3); //Removing last " / "
+ if (!Temp2.empty())
+ Temp2.resize(Temp2.size()-3); //Removing last " / "
+
+ if (Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("Codec"))
+ Fill(Stream_General, 0, Ztring(StreamKind_Text+_T("_Codec_List")).To_Local().c_str(), Temp1, true);
+ if (Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("Language/String"))
+ Fill(Stream_General, 0, Ztring(StreamKind_Text+_T("_Language_List")).To_Local().c_str(), Temp1, true);
+ if (Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("Format")
+ || Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_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);
+ }
+ }
+
+ //General Format
+ if (Parameter==Fill_Parameter(StreamKind, Generic_Format) && Retrieve(Stream_General, 0, General_Format).empty() && !Value.empty())
+ Fill(Stream_General, 0, General_Format, Value); //If not already filled, we are filling with the stream format
+
+ //ID
+ if (Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("ID"))
+ Fill(StreamKind, StreamPos, General_ID_String, Value, true);
+
+ //Format
+ if (Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("Format"))
+ {
+ Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Format_Info), MediaInfoLib::Config.Format_Get(Retrieve(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Format)), InfoFormat_Info), true);
+ Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Format_Url) , MediaInfoLib::Config.Format_Get(Retrieve(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Format)), InfoFormat_Url ), true);
+ if (StreamKind!=Stream_Menu)
+ Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_InternetMediaType), MediaInfoLib::Config.Format_Get(Retrieve(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Format)), InfoFormat_InternetMediaType), true);
+ if (StreamKind==Stream_General)
+ {
+ Fill(Stream_General, 0, General_Format_Extensions, MediaInfoLib::Config.Format_Get(Value, InfoFormat_Extensions), true);
+ Fill(Stream_General, 0, General_Format_String, Value, true);
+ Fill(Stream_General, 0, General_Codec, Value, true);
+ Fill(Stream_General, 0, General_Codec_String, Value, true);
+ }
+ }
+ if (StreamKind==Stream_General && Parameter==General_Format_Info)
+ (*Stream)[Stream_General][0](General_Codec_Info)=Value;
+ if (StreamKind==Stream_General && Parameter==General_Format_Url)
+ (*Stream)[Stream_General][0](General_Codec_Url)=Value;
+ if (StreamKind==Stream_General && Parameter==General_Format_Extensions)
+ (*Stream)[Stream_General][0](General_Codec_Extensions)=Value;
+ if (StreamKind==Stream_General && Parameter==General_Format_Settings)
+ (*Stream)[Stream_General][0](General_Codec_Settings)=Value;
+
+ //Codec
+ if (Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("Codec"))
+ {
+ const Ztring &C1=MediaInfoLib::Config.Codec_Get(Retrieve(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Codec)), InfoCodec_Name, (stream_t)StreamKind);
+ if (C1.empty())
+ Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Codec_String), Value, StreamKind!=Stream_Menu); //Specific for Menu: multiple codecs
+ else
+ {
+ Ztring D=Retrieve(StreamKind, StreamPos, "Codec/Family");
+ Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Codec_String), C1, StreamKind!=Stream_Menu); //Specific for Menu: multiple codecs
+ Fill(StreamKind, StreamPos, "Codec/Family", MediaInfoLib::Config.Codec_Get(Retrieve(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Codec)), InfoCodec_KindofCodec, StreamKind), true);
+ Ztring B=Retrieve(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Codec));
+ Ztring C=MediaInfoLib::Config.Codec_Get(B, InfoCodec_KindofCodec, StreamKind);
+ Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Codec_Info) , MediaInfoLib::Config.Codec_Get(Retrieve(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Codec)), InfoCodec_Description, StreamKind), true);
+ Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Codec_Url) , MediaInfoLib::Config.Codec_Get(Retrieve(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_Codec)), InfoCodec_Url, StreamKind), true);
+ }
+ }
+
+ //CodecID_Description
+ if (Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("CodecID/Info") && Retrieve(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_CodecID_Description))==Value)
+ Clear(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_CodecID_Description));
+
+ //BitRate from BitRate_Nominal
+ if (Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("BitRate")
+ || Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("BitRate_Nominal"))
+ {
+ float32 BitRate=Retrieve(StreamKind, StreamPos, "BitRate").To_float32();
+ float32 BitRate_Nominal=Retrieve(StreamKind, StreamPos, "BitRate_Nominal").To_float32();
+ if (BitRate_Nominal>BitRate*0.95 && BitRate_Nominal<BitRate*1.05)
+ {
+ Ztring Temp=Retrieve(StreamKind, StreamPos, "BitRate_Nominal");
+ Clear(StreamKind, StreamPos, "BitRate_Nominal");
+ Fill(StreamKind, StreamPos, "BitRate", Temp, true);
+ }
+ }
+
+ //File size
+ if (StreamKind==Stream_General && Parameter==General_FileSize)
+ {
+ int64u File_Size_Save=File_Size;
+ File_Size=Value.To_int64u();
+ for (size_t Kind=Stream_Video; Kind<Stream_Menu; Kind++)
+ for (size_t Pos=0; Pos<Count_Get((stream_t)Kind); Pos++)
+ FileSize_FileSize123((stream_t)Kind, Pos, Fill_Parameter((stream_t)Kind, Generic_StreamSize));
+ File_Size=File_Size_Save;
+ }
+
+ //Delay/Video
+ if (StreamKind==Stream_Video && StreamPos==0 && Parameter==Video_Delay)
+ {
+ for (size_t Pos=0; Pos<Count_Get(Stream_Audio); Pos++)
+ if (!Retrieve(Stream_Audio, Pos, Audio_Delay).empty())
+ {
+ Fill(Stream_Audio, Pos, Audio_Video_Delay, Retrieve(Stream_Audio, Pos, Audio_Delay).To_int64s()-Value.To_int64s(), 10, true);
+ if (Retrieve(Stream_Audio, Pos, Audio_Video_Delay).To_int64u()==0)
+ for (size_t Param_Pos=Audio_Video_Delay+1; Param_Pos<=Audio_Video_Delay+4; Param_Pos++)
+ if (Param_Pos<(*Stream)[Stream_Audio][Pos].size())
+ (*Stream)[Stream_Audio][Pos][Param_Pos].clear();
+ }
+ for (size_t Pos=0; Pos<Count_Get(Stream_Text); Pos++)
+ if (!Retrieve(Stream_Text, Pos, Text_Delay).empty())
+ {
+ Fill(Stream_Text, Pos, Text_Video_Delay, Retrieve(Stream_Text, Pos, Text_Delay).To_int64s()-Value.To_int64s(), 10, true);
+ if (Retrieve(Stream_Text, Pos, Text_Video_Delay).To_int64u()==0)
+ for (size_t Param_Pos=Text_Video_Delay+1; Param_Pos<=Text_Video_Delay+4; Param_Pos++)
+ if (Param_Pos<(*Stream)[Stream_Text][Pos].size())
+ (*Stream)[Stream_Text][Pos][Param_Pos].clear();
+ }
+ }
+ if (StreamKind==Stream_Audio && Parameter==Audio_Delay && Count_Get(Stream_Video) && !Retrieve(Stream_Audio, StreamPos, Audio_Delay).empty() && !Retrieve(Stream_Video, 0, Video_Delay).empty())
+ {
+ Fill(Stream_Audio, StreamPos, Audio_Video_Delay, Value.To_int64s()-Retrieve(Stream_Video, 0, Video_Delay).To_int64s(), 10, true);
+ if (Retrieve(Stream_Audio, StreamPos, Audio_Video_Delay).To_int64u()==0)
+ for (size_t Pos=Audio_Video_Delay+1; Pos<=Audio_Video_Delay+4; Pos++)
+ if (Pos<(*Stream)[Stream_Audio][StreamPos].size())
+ (*Stream)[Stream_Audio][StreamPos][Pos].clear();
+ }
+ if (StreamKind==Stream_Text && Parameter==Text_Delay && Count_Get(Stream_Video) && !Retrieve(Stream_Text, StreamPos, Text_Delay).empty() && !Retrieve(Stream_Video, 0, Video_Delay).empty())
+ {
+ Fill(Stream_Text, StreamPos, Text_Video_Delay, Value.To_int64s()-Retrieve(Stream_Video, 0, Video_Delay).To_int64s(), 10, true);
+ if (Retrieve(Stream_Text, StreamPos, Text_Video_Delay).To_int64u()==0)
+ for (size_t Pos=Text_Video_Delay+1; Pos<=Text_Video_Delay+4; Pos++)
+ if (Pos<(*Stream)[Stream_Text][StreamPos].size())
+ (*Stream)[Stream_Text][StreamPos][Pos].clear();
+ }
+
+ //Delay/Video0
+ if (StreamKind==Stream_Video && StreamPos==0 && Parameter==Video_Delay)
+ {
+ for (size_t Pos=0; Pos<Count_Get(Stream_Audio); Pos++)
+ if (!Retrieve(Stream_Audio, Pos, Audio_Delay).empty())
+ {
+ Fill(Stream_Audio, Pos, Audio_Video0_Delay, Retrieve(Stream_Audio, Pos, Audio_Delay).To_int64s()-Value.To_int64s(), 10, true);
+ if (Retrieve(Stream_Audio, Pos, Audio_Video0_Delay).To_int64u()==0)
+ for (size_t Param_Pos=Audio_Video0_Delay+1; Param_Pos<=Audio_Video0_Delay+4; Param_Pos++)
+ if (Param_Pos<(*Stream)[Stream_Audio][Pos].size())
+ (*Stream)[Stream_Audio][Pos][Param_Pos].clear();
+ }
+ for (size_t Pos=0; Pos<Count_Get(Stream_Text); Pos++)
+ if (!Retrieve(Stream_Text, Pos, Text_Delay).empty())
+ {
+ Fill(Stream_Text, Pos, Text_Video0_Delay, Retrieve(Stream_Text, Pos, Text_Delay).To_int64s()-Value.To_int64s(), 10, true);
+ if (Retrieve(Stream_Text, Pos, Text_Video0_Delay).To_int64u()==0)
+ for (size_t Param_Pos=Text_Video0_Delay+1; Param_Pos<=Text_Video0_Delay+4; Param_Pos++)
+ if (Param_Pos<(*Stream)[Stream_Text][Pos].size())
+ (*Stream)[Stream_Text][Pos][Param_Pos].clear();
+ }
+ }
+ if (StreamKind==Stream_Audio && Parameter==Audio_Delay && Count_Get(Stream_Video) && !Retrieve(Stream_Audio, StreamPos, Audio_Delay).empty() && !Retrieve(Stream_Video, 0, Video_Delay).empty())
+ {
+ Fill(Stream_Audio, StreamPos, Audio_Video0_Delay, Value.To_int64s()-Retrieve(Stream_Video, 0, Video_Delay).To_int64s(), 10, true);
+ if (Retrieve(Stream_Audio, StreamPos, Audio_Video0_Delay).To_int64u()==0)
+ for (size_t Pos=Audio_Video0_Delay+1; Pos<=Audio_Video0_Delay+4; Pos++)
+ if (Pos<(*Stream)[Stream_Audio][StreamPos].size())
+ (*Stream)[Stream_Audio][StreamPos][Pos].clear();
+ }
+ if (StreamKind==Stream_Text && Parameter==Text_Delay && Count_Get(Stream_Video) && !Retrieve(Stream_Text, StreamPos, Text_Delay).empty() && !Retrieve(Stream_Video, 0, Video_Delay).empty())
+ {
+ Fill(Stream_Text, StreamPos, Text_Video0_Delay, Value.To_int64s()-Retrieve(Stream_Video, 0, Video_Delay).To_int64s(), 10, true);
+ if (Retrieve(Stream_Text, StreamPos, Text_Video0_Delay).To_int64u()==0)
+ for (size_t Pos=Text_Video0_Delay+1; Pos<=Text_Video0_Delay+4; Pos++)
+ if (Pos<(*Stream)[Stream_Text][StreamPos].size())
+ (*Stream)[Stream_Text][StreamPos][Pos].clear();
+ }
+
+ //Language
+ //-Find 2-digit language
+ if (Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("Language"))
+ {
+ //Removing old strings
+ Clear(StreamKind, StreamPos, Parameter+1); //String
+ Clear(StreamKind, StreamPos, Parameter+2); //String1
+ Clear(StreamKind, StreamPos, Parameter+3); //String2
+ Clear(StreamKind, StreamPos, Parameter+4); //String3
+ Clear(StreamKind, StreamPos, Parameter+5); //String4
+
+ ZtringListList Languages;
+ Languages.Separator_Set(0, _T(" / "));
+ Languages.Separator_Set(1, _T("-"));
+ Languages.Write((*Stream)[StreamKind][StreamPos][Parameter]);
+
+ //Canonizing
+ for (size_t Pos=0; Pos<Languages.size(); Pos++)
+ {
+ Ztring Language_Orig;
+
+ //Removing undefined languages
+ if (Languages[Pos].size()>=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 && !MediaInfoLib::Config.Language_Get(_T("Language_")+Languages[Pos][0].substr(0, 2)).empty())
+ Languages[Pos][0]=Languages[Pos][0].substr(0, 2);
+ if (Languages[Pos][0].size()>3)
+ Languages[Pos][0]=Language_Orig; //We failed to detect language, using the original version
+ }
+
+ //Country name
+ if (Languages[Pos].size()>=2)
+ Languages[Pos][1].MakeLowerCase();
+ }
+
+ 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<Languages.size(); Pos++)
+ {
+ if (Languages[Pos].size()>=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)
+ {
+ Language_Translated+=_T(" (");
+ Language_Translated+=Ztring(Languages[Pos][1]).MakeUpperCase();
+ Language_Translated+=_T(")");
+ }
+ Language1.push_back(Language_Translated);
+ if (Languages[Pos][0].size()==2)
+ {
+ Language2.push_back(Languages[Pos][0]);
+ Language4.push_back(Languages[Pos].Read());
+ }
+ else
+ {
+ Language2.push_back(Ztring());
+ Language4.push_back(Ztring());
+ }
+ if (Languages[Pos][0].size()==3)
+ Language3.push_back(Languages[Pos][0]);
+ else if (!MediaInfoLib::Config.Iso639_2_Get(Languages[Pos][0]).empty())
+ Language3.push_back(MediaInfoLib::Config.Iso639_2_Get(Languages[Pos][0]));
+ else
+ Language3.push_back(Ztring());
+ }
+ else
+ {
+ Language1.push_back(Ztring());
+ Language2.push_back(Ztring());
+ Language3.push_back(Ztring());
+ Language4.push_back(Ztring());
+ }
+ }
+
+ Fill(StreamKind, StreamPos, Parameter+2, Language1.Read()); //String1
+ Fill(StreamKind, StreamPos, Parameter+3, Language2.Read()); //String2
+ Fill(StreamKind, StreamPos, Parameter+4, Language3.Read()); //String3
+ Fill(StreamKind, StreamPos, Parameter+5, Language4.Read()); //String4
+ Fill(StreamKind, StreamPos, Parameter+1, Retrieve(StreamKind, StreamPos, Parameter+2)); //String
+ }
+ }
+
+ //ServiceName / ServiceProvider
+ if (Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("ServiceName")
+ || Retrieve(StreamKind, StreamPos, Parameter, Info_Name)==_T("ServiceProvider"))
+ {
+ if (Retrieve(StreamKind, StreamPos, Parameter).find(_T(" - "))==string::npos && (Retrieve(StreamKind, StreamPos, Parameter).find(_T(":"))==2 || Retrieve(StreamKind, StreamPos, Parameter).find(_T(":"))==3))
+ {
+ Ztring Temp=Retrieve(StreamKind, StreamPos, Parameter);
+ Temp.erase(0, Retrieve(StreamKind, StreamPos, Parameter).find(_T(":"))+1);
+ (*Stream)[StreamKind][StreamPos](Parameter)=Temp;
+ }
+ }
+
+ //FrameRate Nominal
+ if (StreamKind==Stream_Video && (Parameter==Video_FrameRate || Parameter==Video_FrameRate_Nominal))
+ {
+ float32 FrameRate=Retrieve(Stream_Video, StreamPos, Video_FrameRate).To_float32();
+ float32 FrameRate_Nominal=Retrieve(Stream_Video, StreamPos, Video_FrameRate_Nominal).To_float32();
+ if (FrameRate_Nominal>FrameRate*0.995 && FrameRate_Nominal<FrameRate*1.005)
+ {
+ Ztring Temp=Retrieve(StreamKind, StreamPos, Video_FrameRate_Nominal);
+ Clear(StreamKind, StreamPos, Video_FrameRate_Nominal);
+ if (Parameter==Video_FrameRate)
+ Fill(StreamKind, StreamPos, Parameter, Temp, true);
+ }
+ }
+
+ //Well known framerate values
+ if (StreamKind==Stream_Video && (Parameter==Video_FrameRate || Parameter==Video_FrameRate_Nominal || Parameter==Video_FrameRate_Original))
+ {
+ Video_FrameRate_Rounding(StreamPos, (video)Parameter);
+ if (Retrieve(Stream_Video, StreamPos, Video_FrameRate_Nominal)==Retrieve(Stream_Video, StreamPos, Video_FrameRate))
+ Clear(Stream_Video, StreamPos, Video_FrameRate_Nominal);
+ if (Parameter!=Video_FrameRate_Original && Retrieve(Stream_Video, StreamPos, Video_FrameRate_Original)==Retrieve(Stream_Video, StreamPos, Video_FrameRate))
+ Clear(Stream_Video, StreamPos, Video_FrameRate_Original);
+ }
+
+ //Display Aspect Ratio and Pixel Aspect Ratio
+ if (StreamKind==Stream_Video && Parameter==Video_DisplayAspectRatio && !Value.empty())
+ {
+ float F1=Retrieve(Stream_Video, StreamPos, Video_DisplayAspectRatio).To_float32();
+ Ztring C1;
+ if (0);
+ else if (F1>1.23 && F1<1.27) C1=_T("5:4");
+ else if (F1>1.30 && F1<1.37) C1=_T("4:3");
+ else if (F1>1.45 && F1<1.55) C1=_T("3:2");
+ else if (F1>1.70 && F1<1.85) C1=_T("16:9");
+ else if (F1>2.10 && F1<2.22) C1=_T("2.2:1");
+ else if (F1>2.23 && F1<2.30) C1=_T("2.25:1");
+ else if (F1>2.30 && F1<2.40) C1=_T("2.35:1");
+ else if (F1>2.37 && F1<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 (0);
+ else if (F1>1.23 && F1<1.27) C1=_T("5:4");
+ else if (F1>1.30 && F1<1.37) C1=_T("4:3");
+ else if (F1>1.45 && F1<1.55) C1=_T("3:2");
+ else if (F1>1.70 && F1<1.85) C1=_T("16:9");
+ else if (F1>2.10 && F1<2.22) C1=_T("2.2:1");
+ else if (F1>2.23 && F1<2.30) C1=_T("2.25:1");
+ else if (F1>2.30 && F1<2.40) C1=_T("2.35:1");
+ else if (F1>2.37 && F1<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);
+ }
+
+ //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_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())
+ {
+ ZtringList NewList;
+ NewList.push_back(Ztring().From_UTF8(Parameter));
+ NewList.push_back(Value);
+ Fill_Temp.push_back(NewList);
+ return; //No streams
+ }
+
+ //Handling of well known parameters
+ size_t Pos=MediaInfoLib::Config.Info_Get(StreamKind).Find(Ztring().From_Local(Parameter));
+ if (Pos!=Error)
+ {
+ Fill(StreamKind, StreamPos, Pos, Value, Replace);
+ return;
+ }
+
+ //Handling of unknown parameters
+ if (Value.empty())
+ {
+ if (Replace)
+ {
+ size_t Pos_ToReplace=(*Stream_More)[StreamKind][StreamPos].Find(Ztring().From_UTF8(Parameter), Info_Name);
+ if (Pos_ToReplace!=(size_t)-1)
+ (*Stream_More)[StreamKind][StreamPos].erase((*Stream_More)[StreamKind][StreamPos].begin()+Pos_ToReplace); //Empty value --> remove the line
+ }
+ }
+ else
+ {
+ Ztring &Target=(*Stream_More)[StreamKind][StreamPos](Ztring().From_Local(Parameter), Info_Text);
+ if (Target.empty() || Replace)
+ {
+ Target=Value; //First value
+ (*Stream_More)[StreamKind][StreamPos](Ztring().From_Local(Parameter), Info_Name_Text)=MediaInfoLib::Config.Language_Get(Ztring().From_Local(Parameter));
+ (*Stream_More)[StreamKind][StreamPos](Ztring().From_Local(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
+ || StreamPos>=(*Stream)[StreamKind].size()
+ || Parameter==NULL
+ || Parameter[0]=='\0')
+ 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<MediaInfoLib::Config.Info_Get(StreamKind).size())
+ {
+ //Is something available?
+ 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"))
+ {
+ for (size_t Pos=Parameter+1; Pos<=Parameter+5; 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();
+ }
+ }
+
+ 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<StreamPos_Count; StreamPos++)
+ {
+ //Prepare a new stream
+ if (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<Pos_Count; Pos++)
+ {
+ if (StreamKind!=Stream_General
+ || !(Pos==General_CompleteName
+ || Pos==General_FolderName
+ || Pos==General_FileName
+ || Pos==General_FileExtension
+ || Pos==General_File_Created_Date
+ || Pos==General_Format
+ || Pos==General_Format_String
+ || Pos==General_Format_Extensions
+ || Pos==General_Format_Info
+ || Pos==General_Codec
+ || Pos==General_Codec_String
+ || Pos==General_Codec_Extensions
+ || Pos==General_FileSize
+ || Pos==General_FileSize_String
+ || Pos==General_FileSize_String1
+ || Pos==General_FileSize_String2
+ || Pos==General_FileSize_String3
+ || Pos==General_FileSize_String4
+ || Pos==General_File_Created_Date_Local
+ || Pos==General_File_Modified_Date
+ || Pos==General_File_Modified_Date_Local))
+ Fill((stream_t)StreamKind, StreamPos, Ztring(ToAdd.Get((stream_t)StreamKind, StreamPos, Pos, Info_Name)).To_UTF8().c_str(), ToAdd.Get((stream_t)StreamKind, StreamPos, Pos), true);
+ }
+
+ Count++;
+ }
+ }
+
+ return Count;
+}
+
+//---------------------------------------------------------------------------
+size_t File__Analyze::Merge(MediaInfo_Internal &ToAdd, stream_t StreamKind, size_t StreamPos_From, size_t StreamPos_To, bool)
+{
+ size_t Pos_Count=ToAdd.Count_Get(StreamKind, StreamPos_From);
+ for (size_t Pos=0; Pos<Pos_Count; Pos++)
+ if (!ToAdd.Get(StreamKind, StreamPos_From, Pos).empty())
+ Fill(StreamKind, StreamPos_To, Ztring(ToAdd.Get((stream_t)StreamKind, StreamPos_From, Pos, Info_Name)).To_UTF8().c_str(), ToAdd.Get(StreamKind, StreamPos_From, Pos), true);
+
+ return 1;
+}
+
+//---------------------------------------------------------------------------
+size_t File__Analyze::Merge(File__Analyze &ToAdd, bool Erase)
+{
+ size_t Count=0;
+ for (size_t StreamKind=(size_t)Stream_General+1; StreamKind<(size_t)Stream_Max; StreamKind++)
+ for (size_t StreamPos=0; StreamPos<(*ToAdd.Stream)[StreamKind].size(); StreamPos++)
+ {
+ //Prepare a new stream
+ Stream_Prepare((stream_t)StreamKind);
+
+ //Merge
+ Merge(ToAdd, (stream_t)StreamKind, StreamPos, StreamPos_Last, Erase);
+
+ Count++;
+ }
+ return Count;
+}
+
+//---------------------------------------------------------------------------
+size_t File__Analyze::Merge(File__Analyze &ToAdd, stream_t StreamKind, size_t StreamPos_From, size_t StreamPos_To, bool Erase)
+{
+ //Integrity
+ if (&ToAdd==NULL || StreamKind>=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;
+ if (StreamKind==Stream_Video)
+ {
+ Width_Temp=Retrieve(Stream_Video, StreamPos_Last, Video_Width);
+ Height_Temp=Retrieve(Stream_Video, StreamPos_Last, Video_Height);
+ PixelAspectRatio_Temp=Retrieve(Stream_Video, StreamPos_Last, Video_PixelAspectRatio); //We want to keep the PixelAspectRatio_Temp of the video stream
+ DisplayAspectRatio_Temp=Retrieve(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio); //We want to keep the DisplayAspectRatio_Temp of the video stream
+ FrameRate_Temp=Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate); //We want to keep the FrameRate of AVI 120 fps
+ FrameRate_Mode_Temp=Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate_Mode); //We want to keep the FrameRate_Mode of AVI 120 fps
+ }
+
+ //Merging
+ size_t Count=0;
+ size_t Size=ToAdd.Count_Get(StreamKind, StreamPos_From);
+ for (size_t Pos=General_Inform; Pos<Size; Pos++)
+ {
+ const Ztring &ToFill_Value=ToAdd.Get(StreamKind, StreamPos_From, Pos);
+ if (!ToFill_Value.empty() && (Erase || Get(StreamKind, StreamPos_From, Pos).empty()))
+ {
+ if (Pos<MediaInfoLib::Config.Info_Get(StreamKind).size())
+ Fill(StreamKind, StreamPos_To, Pos, ToFill_Value, true);
+ else
+ {
+ Fill(StreamKind, StreamPos_To, ToAdd.Get(StreamKind, StreamPos_From, Pos, Info_Name).To_UTF8().c_str(), ToFill_Value, true);
+ (*Stream_More)[StreamKind][StreamPos_To](ToAdd.Get(StreamKind, StreamPos_From, Pos, Info_Name), Info_Options)=ToAdd.Get(StreamKind, StreamPos_From, Pos, Info_Options);
+ }
+ Count++;
+ }
+ }
+
+ //Clearing
+ for (size_t Pos=Size-1; Pos>=General_Inform; Pos--) //Descendant because Clear() remove the unknown fields
+ {
+ const Ztring &ToFill_Value=ToAdd.Get(StreamKind, StreamPos_From, Pos);
+ if (!ToFill_Value.empty())
+ ToAdd.Clear(StreamKind, StreamPos_From, Pos);
+ }
+
+ //Specific stuff
+ if (StreamKind==Stream_Video)
+ {
+ Ztring PixelAspectRatio_Original=Retrieve(Stream_Video, StreamPos_Last, Video_PixelAspectRatio);
+ Ztring DisplayAspectRatio_Original=Retrieve(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio);
+
+ if (!Width_Temp.empty() && Width_Temp!=Retrieve(Stream_Video, StreamPos_Last, Video_Width))
+ {
+ Fill(Stream_Video, StreamPos_Last, Video_Width_Original, (*Stream)[Stream_Video][StreamPos_Last][Video_Width], true);
+ Fill(Stream_Video, StreamPos_Last, Video_Width, Width_Temp, true);
+ }
+ if (!Height_Temp.empty() && Height_Temp!=Retrieve(Stream_Video, StreamPos_Last, Video_Height))
+ {
+ Fill(Stream_Video, StreamPos_Last, Video_Height_Original, (*Stream)[Stream_Video][StreamPos_Last][Video_Height], true);
+ Fill(Stream_Video, StreamPos_Last, Video_Height, Height_Temp, true);
+ }
+ if (!PixelAspectRatio_Temp.empty() && PixelAspectRatio_Temp!=Retrieve(Stream_Video, StreamPos_Last, Video_PixelAspectRatio))
+ {
+ Fill(Stream_Video, StreamPos_Last, Video_PixelAspectRatio_Original, PixelAspectRatio_Original, true);
+ Fill(Stream_Video, StreamPos_Last, Video_PixelAspectRatio, PixelAspectRatio_Temp, true);
+ }
+ if (!DisplayAspectRatio_Temp.empty() && DisplayAspectRatio_Temp!=DisplayAspectRatio_Original)
+ {
+ Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio_Original, DisplayAspectRatio_Original, true);
+ Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, DisplayAspectRatio_Temp, true);
+ }
+ if (!FrameRate_Temp.empty() && FrameRate_Temp!=Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate))
+ {
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Original, (*Stream)[Stream_Video][StreamPos_Last][Video_FrameRate], true);
+ 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_Original, (*Stream)[Stream_Video][StreamPos_Last][Video_FrameRate_Mode], true);
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Mode, FrameRate_Mode_Temp, true);
+ }
+ }
+
+ Fill(StreamKind, StreamPos_To, (size_t)General_Count, Count_Get(StreamKind, StreamPos_To), 10, true);
+ return 1;
+}
+
+//***************************************************************************
+// Helpers
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File__Analyze::Video_FrameRate_Rounding(size_t Pos, video Parameter)
+{
+ float64 FrameRate=Retrieve(Stream_Video, Pos, Parameter).To_float64();
+ float64 FrameRate_Sav=FrameRate;
+
+ if (FrameRate> 9.990 && FrameRate<=10.010) FrameRate=10.000;
+ else if (FrameRate>14.990 && FrameRate<=15.010) FrameRate=15.000;
+ else if (FrameRate>23.964 && FrameRate<=23.988) FrameRate=23.976;
+ else if (FrameRate>23.988 && FrameRate<=24.012) FrameRate=24.000;
+ else if (FrameRate>24.988 && FrameRate<=25.012) FrameRate=25.000;
+ else if (FrameRate>29.955 && FrameRate<=29.985) FrameRate=29.970;
+ else if (FrameRate>29.985 && FrameRate<=30.015) FrameRate=30.000;
+ else if (FrameRate>23.964*2 && FrameRate<=23.988*2) FrameRate=23.976*2;
+ else if (FrameRate>23.988*2 && FrameRate<=24.012*2) FrameRate=24.000*2;
+ else if (FrameRate>24.988*2 && FrameRate<=25.012*2) FrameRate=25.000*2;
+ else if (FrameRate>29.955*2 && FrameRate<=29.985*2) FrameRate=29.970*2;
+ else if (FrameRate>30.985*2 && FrameRate<=30.015*2) FrameRate=30.000*2;
+
+ if (FrameRate!=FrameRate_Sav)
+ Fill(Stream_Video, Pos, Parameter, FrameRate, 3, 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 (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;
+ }
+
+ 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;
+
+ int32s HH, MM, SS, MS;
+ Ztring DurationString1, DurationString2, DurationString3;
+ bool Negative=false;
+ MS=Retrieve(StreamKind, StreamPos, Parameter).To_int32s(); //en ms
+
+ if (MS<0)
+ {
+ Negative=true;
+ MS=-MS;
+ }
+
+ //Hours
+ HH=MS/1000/60/60; //h
+ if (HH>0)
+ {
+ 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
+ SS=MS/1000; //s
+ if (SS>0 || MM>0 || HH>0)
+ {
+ if (DurationString1.size()>0)
+ DurationString1+=_T(" ");
+ DurationString1+=Ztring::ToZtring(SS)+MediaInfoLib::Config.Language_Get(_T("s"));
+ if (DurationString2.size()<5)
+ {
+ if (DurationString2.size()>0)
+ DurationString2+=_T(" ");
+ DurationString2+=Ztring::ToZtring(SS)+MediaInfoLib::Config.Language_Get(_T("s"));
+ }
+ else if (DurationString2.size()==0)
+ DurationString2+=Ztring::ToZtring(SS)+MediaInfoLib::Config.Language_Get(_T("s"));
+ if (SS<10)
+ DurationString3+=Ztring(_T("0"))+Ztring::ToZtring(SS)+_T(".");
+ else
+ DurationString3+=Ztring::ToZtring(SS)+_T(".");
+ MS-=SS*1000;
+ }
+ else
+ {
+ DurationString3+=_T("00.");
+ }
+
+ //Milliseconds
+ if (MS>0 || SS>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, true); // /String
+ Fill(StreamKind, StreamPos, Parameter+2, DurationString1, true); // /String1
+ Fill(StreamKind, StreamPos, Parameter+3, DurationString2, true); // /String2
+ Fill(StreamKind, StreamPos, Parameter+4, DurationString3, true); // /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
+ float F2=(float)Retrieve(StreamKind, StreamPos, Parameter).To_int64s(); //Video C++ 6 patch, should be int64u
+ if (File_Size>0 && File_Size<(int64u)-1 && Parameter==Fill_Parameter(StreamKind, Generic_StreamSize) && F2*100/File_Size<=100)
+ {
+ Fill(StreamKind, StreamPos, Fill_Parameter(StreamKind, Generic_StreamSize_Proportion), F2/File_Size, 5, true);
+ Fill(StreamKind, StreamPos, Parameter+6, MediaInfoLib::Config.Language_Get(Ztring::ToZtring(F1, I3), Measure, MeasureIsAlwaysSame)+_T(" (")+Ztring::ToZtring(F2*100/File_Size, 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, 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<List.size(); Pos++)
+ {
+ int32u BitRate=List[Pos].To_int32u();
+
+ //Text
+ if (BitRate== 0)
+ {
+ Fill(StreamKind, StreamPos, Parameter+1, MediaInfoLib::Config.Language_Get(List[Pos]));
+ }
+ else
+ {
+ //Well known values
+ Ztring BitRateS;
+ 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== 66150) BitRateS= "66.15";
+ if (BitRate== 88200) BitRateS= "88.2";
+ 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 (!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>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 if (BitRate>0)
+ 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<List.size(); Pos++)
+ {
+ //Filling
+ Fill(StreamKind, StreamPos, Parameter+1, MediaInfoLib::Config.Language_Get(List[Pos], MediaInfoLib::Config.Info_Get(StreamKind).Read(Parameter, Info_Measure)));
+ }
+
+}
+
+//---------------------------------------------------------------------------
+//Value --> 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, true);
+ 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);
+
+ //Specific cases
+ if (Value==_T("v210") || Value==_T("V210"))
+ Fill(Stream_Video, StreamPos, Video_Resolution, 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;
+ 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_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_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_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;
+ 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_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_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_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;
+ 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_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_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_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;
+ 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_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;
+ default: return (size_t)-1;
+ }
+ case Stream_Chapters : 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;
+ default: return (size_t)-1;
+ }
+ default: return (size_t)-1;
+ }
+}
+
+} //NameSpace
+
diff --git a/src/thirdparty/MediaInfo/File__Analyze_Streams_Finish.cpp b/src/thirdparty/MediaInfo/File__Analyze_Streams_Finish.cpp
new file mode 100644
index 000000000..752bb8363
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File__Analyze_Streams_Finish.cpp
@@ -0,0 +1,422 @@
+// File__Analyze_Inform - Base for other files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Init and Finalize part
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "ZenLib/Utils.h"
+#include "ZenLib/File.h"
+#include "ZenLib/FileName.h"
+#include "MediaInfo/File__Analyze.h"
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//---------------------------------------------------------------------------
+extern MediaInfo_Config Config;
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+void File__Analyze::Streams_Finish_Global()
+{
+ if (IsSub)
+ return;
+
+ 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::Streams_Finish_StreamOnly()
+{
+ //Generic
+ for (size_t StreamKind=Stream_General; StreamKind<Stream_Max; StreamKind++)
+ for (size_t StreamPos=0; StreamPos<Count_Get((stream_t)StreamKind); StreamPos++)
+ Streams_Finish_StreamOnly((stream_t)StreamKind, StreamPos);
+
+ //For each kind of (*Stream)
+ for (size_t Pos=0; Pos<Count_Get(Stream_General); Pos++) Streams_Finish_StreamOnly_General(Pos);
+ for (size_t Pos=0; Pos<Count_Get(Stream_Video); Pos++) Streams_Finish_StreamOnly_Video(Pos);
+ for (size_t Pos=0; Pos<Count_Get(Stream_Audio); Pos++) Streams_Finish_StreamOnly_Audio(Pos);
+ for (size_t Pos=0; Pos<Count_Get(Stream_Text); Pos++) Streams_Finish_StreamOnly_Text(Pos);
+ for (size_t Pos=0; Pos<Count_Get(Stream_Chapters); Pos++) Streams_Finish_StreamOnly_Chapters(Pos);
+ for (size_t Pos=0; Pos<Count_Get(Stream_Image); Pos++) Streams_Finish_StreamOnly_Image(Pos);
+ for (size_t Pos=0; Pos<Count_Get(Stream_Menu); Pos++) Streams_Finish_StreamOnly_Menu(Pos);
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Streams_Finish_StreamOnly(stream_t StreamKind, size_t Pos)
+{
+ //BitRate from Duration and StreamSize
+ if (StreamKind!=Stream_General && StreamKind!=Stream_Chapters && StreamKind!=Stream_Menu && Retrieve(StreamKind, Pos, "BitRate").empty() && !Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_StreamSize)).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=Retrieve(StreamKind, Pos, Fill_Parameter(StreamKind, Generic_StreamSize)).To_int64u();
+ if (Duration>0 && StreamSize>0)
+ Fill(StreamKind, Pos, "BitRate", StreamSize*8*1000/Duration, 0);
+ }
+
+ //Duration from Bitrate and StreamSize
+ if (StreamKind!=Stream_Chapters && 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_Chapters && 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);
+ }
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Streams_Finish_StreamOnly_General(size_t StreamPos)
+{
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Streams_Finish_StreamOnly_Video(size_t Pos)
+{
+ //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);
+ }
+
+ //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("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("480") || Retrieve(Stream_Video, Pos, Video_Height)==_T("240"))
+ Fill(Stream_Video, Pos, Video_Standard, "NTSC");
+ }
+
+ //Known bitrates
+ if (Count_Get(Stream_Video)==1 && Count_Get(Stream_Audio)==0 && Retrieve(Stream_General, 0, General_Format)==_T("MXF"))
+ {
+ int32u BitRate=Retrieve(Stream_Video, 0, Video_BitRate).To_int32u();
+ int32u BitRate_Sav=BitRate;
+
+ 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, 0, Video_BitRate, BitRate, 0, true);
+ }
+}
+
+//---------------------------------------------------------------------------
+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);
+ }
+
+ //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 Pos)
+{
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Streams_Finish_StreamOnly_Chapters(size_t StreamPos)
+{
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Streams_Finish_StreamOnly_Image(size_t StreamPos)
+{
+}
+
+//---------------------------------------------------------------------------
+void File__Analyze::Streams_Finish_StreamOnly_Menu(size_t 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; StreamKind<Stream_Max; StreamKind++)
+ for (size_t Pos=0; Pos<Count_Get((stream_t)StreamKind); Pos++)
+ {
+ if (!Retrieve((stream_t)StreamKind, Pos, Fill_Parameter((stream_t)StreamKind, Generic_Duration)).empty())
+ {
+ int64u Duration_Stream=Retrieve((stream_t)StreamKind, Pos, Fill_Parameter((stream_t)StreamKind, Generic_Duration)).To_int64u();
+ if (Duration_Stream>Duration)
+ 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; StreamKind<Stream_Max; StreamKind++)
+ {
+ if (StreamKind!=Stream_Chapters && StreamKind!=Stream_Menu) //They have no big size, we never calculate them
+ for (size_t Pos=0; Pos<Count_Get((stream_t)StreamKind); Pos++)
+ {
+ int64u StreamSize=Retrieve((stream_t)StreamKind, Pos, Fill_Parameter((stream_t)StreamKind, Generic_StreamSize)).To_int64u();
+ if (StreamSize>0)
+ StreamSize_Total+=StreamSize;
+ else if (IsOK)
+ IsOK=false; //StreamSize not available for 1 stream, we can't calculate
+ }
+ }
+
+ //Filling
+ if (IsOK && StreamSize_Total>0 && StreamSize_Total<File_Size)
+ Fill(Stream_General, 0, General_StreamSize, File_Size-StreamSize_Total);
+ }
+
+ //OverallBitRate if we have one Audio stream with bitrate
+ if (Retrieve(Stream_General, 0, General_Duration).empty() && Retrieve(Stream_General, 0, General_OverallBitRate).empty() && Count_Get(Stream_Video)==0 && Count_Get(Stream_Audio)==1 && Retrieve(Stream_Audio, 0, Audio_BitRate).To_int64u()!=0)
+ Fill(Stream_General, 0, General_OverallBitRate, Retrieve(Stream_Audio, 0, Audio_BitRate));
+
+ //OverallBitRate if Duration
+ if (Retrieve(Stream_General, 0, General_OverallBitRate).empty() && Retrieve(Stream_General, 0, General_Duration).To_int64u()!=0 && !Retrieve(Stream_General, 0, General_FileSize).empty())
+ Fill(Stream_General, 0, General_OverallBitRate, Retrieve(Stream_General, 0, General_FileSize).To_int64u()*8*1000/Retrieve(Stream_General, 0, General_Duration).To_int64u());
+
+ //Duration if OverallBitRate
+ if (Retrieve(Stream_General, 0, General_Duration).empty() && Retrieve(Stream_General, 0, General_OverallBitRate).To_int64u()!=0 && Retrieve(Stream_General, 0, General_OverallBitRate).find(_T(" / "))==std::string::npos)
+ Fill(Stream_General, 0, General_Duration, Retrieve(Stream_General, 0, General_FileSize).To_float64()*8*1000/Retrieve(Stream_General, 0, General_OverallBitRate).To_float64(), 0);
+
+ //Video bitrate can be the nominal one if <4s (bitrate estimation is not enough precise
+ if (Count_Get(Stream_Video)==1 && Retrieve(Stream_Video, 0, Video_BitRate).empty() && Retrieve(Stream_General, 0, General_Duration).To_int64u()<4000)
+ {
+ Fill(Stream_Video, 0, Video_BitRate, Retrieve(Stream_Video, 0, Video_BitRate_Nominal));
+ Clear(Stream_Video, 0, Video_BitRate_Nominal);
+ }
+
+ //Video bitrate if we have all audio bitrates and overal bitrate
+ if (Count_Get(Stream_Video)==1 && Retrieve(Stream_General, 0, General_OverallBitRate).size()>4 && Retrieve(Stream_Video, 0, Video_BitRate).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 (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;
+ }
+
+ //Testing
+ float64 VideoBitRate=Retrieve(Stream_General, 0, General_OverallBitRate).To_float64()*GeneralBitRate_Ratio-GeneralBitRate_Minus;
+ bool VideobitRateIsValid=true;
+ for (size_t Pos=0; Pos<Count_Get(Stream_Audio); Pos++)
+ {
+ float64 AudioBitRate=Retrieve(Stream_Audio, Pos, Audio_BitRate).To_float64();
+ if (AudioBitRate>0 && AudioBitRate_Ratio)
+ VideoBitRate-=AudioBitRate/AudioBitRate_Ratio+AudioBitRate_Minus;
+ else
+ VideobitRateIsValid=false;
+ }
+ for (size_t Pos=0; Pos<Count_Get(Stream_Text); Pos++)
+ {
+ float64 TextBitRate=Retrieve(Stream_Text, Pos, Text_BitRate).To_float64();
+ if (TextBitRate_Ratio)
+ VideoBitRate-=TextBitRate/TextBitRate_Ratio+TextBitRate_Minus;
+ else
+ VideoBitRate-=1000; //Estimation: Text stream are not often big
+ }
+ if (VideobitRateIsValid && VideoBitRate>=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())
+ {
+ int64u Duration=Retrieve(Stream_Video, 0, Video_Duration).To_int64u();
+ if (Duration)
+ Fill(Stream_Video, 0, Video_StreamSize, VideoBitRate/8*Duration/1000, 0);
+ }
+ }
+ }
+
+ //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_Pos<Stream_Menu; StreamKind_Pos++)
+ for (size_t Pos=0; Pos<Count_Get((stream_t)StreamKind_Pos); Pos++)
+ {
+ int64u StreamXX_StreamSize=Retrieve((stream_t)StreamKind_Pos, Pos, Fill_Parameter((stream_t)StreamKind_Pos, Generic_StreamSize)).To_int64u();
+ if (StreamXX_StreamSize>0 || 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);
+ }
+
+ //Tags
+ Tags();
+}
+
+} //NameSpace
+
diff --git a/src/thirdparty/MediaInfo/File__Base.cpp b/src/thirdparty/MediaInfo/File__Base.cpp
new file mode 100644
index 000000000..d81a9777f
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File__Base.cpp
@@ -0,0 +1,222 @@
+// File__Base - Base for other files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Base.h"
+#include "MediaInfo/MediaInfo_Config_MediaInfo.h"
+#include "ZenLib/File.h"
+#include <cstring>
+//---------------------------------------------------------------------------
+
+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<std::vector<ZtringList> > * Stream_, std::vector<std::vector<ZtringListList> > * Stream_More_)
+#else //MEDIAINFO_TRACE
+void File__Base::Init (MediaInfo_Config_MediaInfo * Config_, std::vector<std::vector<ZtringList> > * Stream_, std::vector<std::vector<ZtringListList> > * 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<std::vector<ZtringList> >;
+ Stream->resize(Stream_Max);
+ Stream_More=new std::vector<std::vector<ZtringListList> >;
+ 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 (Parameter<MediaInfoLib::Config.Info_Get(StreamKind).size())
+ {
+ //Optimization : KindOfInfo>Info_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() || (ParameterI=MediaInfoLib::Config.Info_Get(StreamKind).Find(Parameter, KindOfSearch))==Error || KindOfInfo>=Info_Max)
+ {
+ 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_Max; StreamKind++)
+ {
+ (*Stream)[StreamKind].clear();
+ (*Stream_More)[StreamKind].clear();
+ }
+}
+
+} //NameSpace
+
+
diff --git a/src/thirdparty/MediaInfo/File__Base.h b/src/thirdparty/MediaInfo/File__Base.h
new file mode 100644
index 000000000..1c0003714
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File__Base.h
@@ -0,0 +1,126 @@
+// File__Base - Base for other files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Give common methods for all file types
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo__BaseH
+#define MediaInfo__BaseH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/MediaInfo_Config.h"
+#include "ZenLib/ZtringListList.h"
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+class MediaInfo_Config_MediaInfo;
+
+//***************************************************************************
+// Class File__Base
+//***************************************************************************
+
+class File__Base
+{
+public :
+ //Constructor/Destructor
+ File__Base();
+ virtual ~File__Base();
+ #if MEDIAINFO_TRACE
+ void Init(MediaInfo_Config_MediaInfo * Config, Ztring* Details, std::vector<std::vector<ZtringList> > * Stream_=NULL, std::vector<std::vector<ZtringListList> > * Stream_More=NULL);
+ #else //MEDIAINFO_TRACE
+ void Init(MediaInfo_Config_MediaInfo * Config, std::vector<std::vector<ZtringList> > * Stream_=NULL, std::vector<std::vector<ZtringListList> > * 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);
+ 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
+//private : //TODO:put it as private (DvDif)
+ std::vector<std::vector<ZtringList> > * Stream; //pointer to others listed streams
+ std::vector<std::vector<ZtringListList> > * 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();
+
+public : //A virer
+ friend class File__Analyze;
+ friend class File__MultipleParsing;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/File__Duplicate.cpp b/src/thirdparty/MediaInfo/File__Duplicate.cpp
new file mode 100644
index 000000000..cbc7d3a32
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File__Duplicate.cpp
@@ -0,0 +1,86 @@
+// File__Duplicate - Duplication of some formats
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Duplication helper for some specific formats
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+#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;
+}
+
+} //NameSpace
+
diff --git a/src/thirdparty/MediaInfo/File__Duplicate.h b/src/thirdparty/MediaInfo/File__Duplicate.h
new file mode 100644
index 000000000..c0509c830
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File__Duplicate.h
@@ -0,0 +1,65 @@
+// File__Extract - Extract of some formats
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef File__DuplicateH
+#define File__DuplicateH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include "MediaInfo/Duplicate/File__Duplicate__Writer.h"
+#include "ZenLib/ZtringListList.h"
+#include <map>
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+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
diff --git a/src/thirdparty/MediaInfo/File__MultipleParsing.cpp b/src/thirdparty/MediaInfo/File__MultipleParsing.cpp
new file mode 100644
index 000000000..ad1464942
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File__MultipleParsing.cpp
@@ -0,0 +1,640 @@
+// File__MultipleParsing - Info for MultipleParsing files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__MultipleParsing.h"
+//---------------------------------------------------------------------------
+// Multiple
+#if defined(MEDIAINFO_CDXA_YES)
+ #include "MediaInfo/Multiple/File_Cdxa.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_FLV_YES)
+ #include "MediaInfo/Multiple/File_Flv.h"
+#endif
+#if defined(MEDIAINFO_GXF_YES)
+ #include "MediaInfo/Multiple/File_Gxf.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_RIFF_YES)
+ #include "MediaInfo/Multiple/File_Riff.h"
+#endif
+#if defined(MEDIAINFO_RM_YES)
+ #include "MediaInfo/Multiple/File_Rm.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_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
+
+//---------------------------------------------------------------------------
+// Audio
+#if defined(MEDIAINFO_AC3_YES)
+ #include "MediaInfo/Audio/File_Ac3.h"
+#endif
+#if defined(MEDIAINFO_ADIF_YES)
+ #include "MediaInfo/Audio/File_Adif.h"
+#endif
+#if defined(MEDIAINFO_ADTS_YES)
+ #include "MediaInfo/Audio/File_Adts.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_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_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_PNG_YES)
+ #include "MediaInfo/Image/File_Png.h"
+#endif
+#if defined(MEDIAINFO_TIFF_YES)
+ #include "MediaInfo/Image/File_Tiff.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_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
+ Details_DoNotSave=true;
+ #endif //MEDIAINFO_TRACE
+
+ File__Analyze* Temp;
+ // Multiple
+ #if defined(MEDIAINFO_BDAV_YES)
+ Temp=new File_MpegTs(); ((File_MpegTs*)Temp)->BDAV_Size=4; Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_CDXA_YES)
+ Temp=new File_Cdxa(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_DPG_YES)
+ Temp=new File_Dpg(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_DVDIF_YES)
+ Temp=new File_DvDif(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_DVDV_YES)
+ Temp=new File_Dvdv(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_FLV_YES)
+ Temp=new File_Flv(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_GXF_YES)
+ Temp=new File_Gxf(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_IVF_YES)
+ Temp=new File_Ivf(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_LXF_YES)
+ Temp=new File_Lxf(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_MK_YES)
+ Temp=new File_Mk(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_MPEG4_YES)
+ Temp=new File_Mpeg4(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_MPEGPS_YES)
+ Temp=new File_MpegPs(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_MPEGTS_YES)
+ Temp=new File_MpegTs(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_TSP_YES)
+ Temp=new File_MpegTs(); ((File_MpegTs*)Temp)->TSP_Size=16; Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_MXF_YES)
+ Temp=new File_Mxf(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_NUT_YES)
+ Temp=new File_Nut(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_OGG_YES)
+ Temp=new File_Ogg(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_P2_YES)
+ Temp=new File_P2_Clip(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_RIFF_YES)
+ Temp=new File_Riff(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_RM_YES)
+ Temp=new File_Rm(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_SKM_YES)
+ Temp=new File_Skm(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_SWF_YES)
+ Temp=new File_Swf(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_WM_YES)
+ Temp=new File_Wm(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_XDCAM_YES)
+ Temp=new File_Xdcam_Clip(); Parser.push_back(Temp);
+ #endif
+
+ // Video
+ #if defined(MEDIAINFO_AVC_YES)
+ Temp=new File_Avc(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_AVSV_YES)
+ Temp=new File_AvsV(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_DIRAC_YES)
+ Temp=new File_Dirac(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_FLIC_YES)
+ Temp=new File_Flic(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_MPEG4V_YES)
+ Temp=new File_Mpeg4v(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_MPEGV_YES)
+ Temp=new File_Mpegv(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_VC1_YES)
+ Temp=new File_Vc1(); Parser.push_back(Temp);
+ #endif
+
+ // Audio
+ #if defined(MEDIAINFO_AC3_YES)
+ Temp=new File_Ac3(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_ADIF_YES)
+ Temp=new File_Adif(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_ADTS_YES)
+ Temp=new File_Adts(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_ALS_YES)
+ Temp=new File_Als(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_AMR_YES)
+ Temp=new File_Amr(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_AMV_YES)
+ Temp=new File_Amv(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_APE_YES)
+ Temp=new File_Ape(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_AU_YES)
+ Temp=new File_Au(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_DTS_YES)
+ Temp=new File_Dts(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_FLAC_YES)
+ Temp=new File_Flac(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_IT_YES)
+ Temp=new File_ImpulseTracker(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_LA_YES)
+ Temp=new File_La(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_MIDI_YES)
+ Temp=new File_Midi(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_MOD_YES)
+ Temp=new File_Module(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_MPC_YES)
+ Temp=new File_Mpc(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_MPCSV8_YES)
+ Temp=new File_MpcSv8(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_MPEGA_YES)
+ Temp=new File_Mpega(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_S3M_YES)
+ Temp=new File_ScreamTracker3(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_TAK_YES)
+ Temp=new File_Tak(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_TTA_YES)
+ Temp=new File_Tta(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_TWINVQ_YES)
+ Temp=new File_TwinVQ(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_WVPK_YES)
+ Temp=new File_Wvpk(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_XM_YES)
+ Temp=new File_ExtendedModule(); Parser.push_back(Temp);
+ #endif
+
+ // Text
+ #if defined(MEDIAINFO_N19_YES)
+ Temp=new File_N19(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_OTHERTEXT_YES)
+ Temp=new File_OtherText(); Parser.push_back(Temp);
+ #endif
+
+ // Image
+ #if defined(MEDIAINFO_BMP_YES)
+ Temp=new File_Bmp(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_GIF_YES)
+ Temp=new File_Gif(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_ICO_YES)
+ Temp=new File_Ico(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_JPEG_YES)
+ Temp=new File_Jpeg(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_PNG_YES)
+ Temp=new File_Png(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_TIFF_YES)
+ Temp=new File_Tiff(); Parser.push_back(Temp);
+ #endif
+
+ // Archive
+ #if defined(MEDIAINFO_7Z_YES)
+ Temp=new File_7z(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_ACE_YES)
+ Temp=new File_Ace(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_BZIP2_YES)
+ Temp=new File_Bzip2(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_ELF_YES)
+ Temp=new File_Elf(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_GZIP_YES)
+ Temp=new File_Gzip(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_MZ_YES)
+ Temp=new File_Mz(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_RAR_YES)
+ Temp=new File_Rar(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_TAR_YES)
+ Temp=new File_Tar(); Parser.push_back(Temp);
+ #endif
+ #if defined(MEDIAINFO_ZIP_YES)
+ Temp=new File_Zip(); Parser.push_back(Temp);
+ #endif
+
+ #if defined(MEDIAINFO_OTHER_YES)
+ Temp=new File_Other(); Parser.push_back(Temp);
+ #endif
+}
+
+//---------------------------------------------------------------------------
+File__MultipleParsing::~File__MultipleParsing()
+{
+ for (size_t Pos=0; Pos<Parser.size(); Pos++)
+ delete Parser[Pos]; //Parser[Pos]=NULL
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File__MultipleParsing::Streams_Finish()
+{
+ if (Parser.size()!=1)
+ return;
+
+ Parser[0]->Open_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; Pos<Parser.size(); Pos++)
+ {
+ //Parsing
+ #if MEDIAINFO_TRACE
+ Parser[Pos]->Init(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; Pos<Parser.size(); Pos++)
+ Parser[Pos]->Open_Buffer_Unsynch();
+}
+
+//---------------------------------------------------------------------------
+void File__MultipleParsing::Read_Buffer_Continue()
+{
+ //Parsing
+ for (size_t Pos=0; Pos<Parser.size(); Pos++)
+ {
+ //Parsing
+ Open_Buffer_Continue(Parser[Pos], Buffer+Buffer_Offset, (size_t)Element_Size);
+ if (File_Offset+Buffer_Size==File_Size)
+ Open_Buffer_Finalize(Parser[Pos]);
+
+ //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_Pos<Parser.size(); To_Delete_Pos++)
+ if (To_Delete_Pos!=Pos)
+ delete Parser[To_Delete_Pos]; //Parser[Pos]=NULL
+ Parser.clear();
+ Parser.push_back(Temp);
+ Pos=0;
+ }
+
+ if (Parser.size()==1)
+ {
+ //Status
+ if (!Status[IsAccepted] && Parser[Pos]->Status[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
+
diff --git a/src/thirdparty/MediaInfo/File__MultipleParsing.h b/src/thirdparty/MediaInfo/File__MultipleParsing.h
new file mode 100644
index 000000000..295f3f737
--- /dev/null
+++ b/src/thirdparty/MediaInfo/File__MultipleParsing.h
@@ -0,0 +1,66 @@
+// File_Mpeg - Info for MPEG files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about MPEG files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_MpegH
+#define MediaInfo_MpegH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include <map>
+//---------------------------------------------------------------------------
+
+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<File__Analyze*> Parser;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Image/File_Bmp.cpp b/src/thirdparty/MediaInfo/Image/File_Bmp.cpp
new file mode 100644
index 000000000..cdd75a75d
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Image/File_Bmp.cpp
@@ -0,0 +1,174 @@
+// File_Bmp - Info for Bitmap files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// BMP - Format
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// From http://www.onicos.com/staff/iz/formats/bmp.html
+//
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_Begin("File header", 14);
+ Skip_C2( "Magic");
+ Get_L4 (Size, "Size");
+ Skip_L2( "Reserved");
+ Skip_L2( "Reserved");
+ Get_L4 (Offset, "Offset of data");
+ Element_End();
+
+ 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_Begin("DIB header");
+ Peek_L4 (DIB_Size);
+ switch (DIB_Size)
+ {
+ case 40 : BitmapInfoHeader(); break;
+ case 12 : Skip_XX(DIB_Size-4, "OS/2 v1 header"); break;
+ case 64 : Skip_XX(DIB_Size-4, "OS/2 v2 header"); break;
+ case 108 : Skip_XX(DIB_Size-4, "BitmapV4Header"); break;
+ case 124 : Skip_XX(DIB_Size-4, "BitmapV5Header"); break;
+ default : Skip_XX(DIB_Size-4, "Unknown header");
+ ;
+ }
+ Element_End();
+
+ Skip_XX(Offset-Element_Offset, "Color palette");
+ Skip_XX(File_Size-Offset, "Bitmap data");
+
+ //No need of more
+ Finish("BMP");
+}
+
+//***************************************************************************
+// Buffer - Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Bmp::BitmapInfoHeader()
+{
+ //Parsing
+ Element_Begin("Bitmap Info header", 40);
+ 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_Info(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");
+
+ FILLING_BEGIN();
+ Fill(Stream_Image, 0, Image_Width, Width);
+ Fill(Stream_Image, 0, Image_Height, Height);
+ Fill(Stream_Image, 0, Image_Resolution, BitsPerPixel);
+ Fill(Stream_Image, 0, Image_Format, Bmp_CompressionMethod(CompressionMethod));
+ Fill(Stream_Image, 0, Image_Codec, Bmp_CompressionMethod(CompressionMethod));
+ FILLING_END();
+}
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Image/File_Bmp.h b/src/thirdparty/MediaInfo/Image/File_Bmp.h
new file mode 100644
index 000000000..9ad663646
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Image/File_Bmp.h
@@ -0,0 +1,56 @@
+// File_Bmp - Info for Bitmap files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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();
+};
+
+} //NameSpace
+
+#endif
+
diff --git a/src/thirdparty/MediaInfo/Image/File_Gif.cpp b/src/thirdparty/MediaInfo/Image/File_Gif.cpp
new file mode 100644
index 000000000..7a80c5456
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Image/File_Gif.cpp
@@ -0,0 +1,110 @@
+// File_Gif - Info for GIF files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// From http://www.onicos.com/staff/iz/formats/gif.html
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_GIF_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Image/File_Gif.h"
+#include <cmath>
+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_Info(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_End();
+
+ 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);
+
+ Finish("GIF");
+ FILLING_END();
+}
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Image/File_Gif.h b/src/thirdparty/MediaInfo/Image/File_Gif.h
new file mode 100644
index 000000000..7a78e0e85
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Image/File_Gif.h
@@ -0,0 +1,52 @@
+// File_Gif - Info for GIF files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Image/File_Ico.cpp b/src/thirdparty/MediaInfo/Image/File_Ico.cpp
new file mode 100644
index 000000000..ea230aa04
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Image/File_Ico.cpp
@@ -0,0 +1,158 @@
+// File_Ico - Info for Icon files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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; Pos<Streams.size(); Pos++)
+ {
+ Stream_Prepare(Stream_Image);
+ Fill(Stream_Image, StreamPos_Last, Image_Width, Streams[Pos].Width?Streams[Pos].Width:256);
+ Fill(Stream_Image, StreamPos_Last, Image_Height, Streams[Pos].Height?Streams[Pos].Height:256);
+ if (Type==1)
+ Fill(Stream_Image, StreamPos_Last, Image_Resolution,Streams[Pos].BitsPerPixel);
+ Fill(Stream_Image, StreamPos_Last, Image_StreamSize, Streams[Pos].Size);
+ }
+}
+
+//***************************************************************************
+// Buffer - File header
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Ico::FileHeader_Begin()
+{
+ //Element_Size
+ if (Buffer_Size<4)
+ return false; //Must wait for more data
+
+ if (CC2(Buffer) || (LittleEndian2int16u(Buffer+2)!=1 && LittleEndian2int16u(Buffer+2)!=2))
+ {
+ Reject("ICO");
+ return false;
+ }
+
+ //All should be OK...
+ return true;
+}
+
+//---------------------------------------------------------------------------
+void File_Ico::FileHeader_Parse()
+{
+ //Parsing
+ Skip_L2( "Reserved");
+ Get_L2 (Type, "Type");
+ Get_L2 (Count, "Count");
+}
+
+//***************************************************************************
+
+// Buffer - Per element
+//***************************************************************************
+//---------------------------------------------------------------------------
+void File_Ico::Header_Parse()
+{
+ Header_Fill_Size(16);
+ Header_Fill_Code(0, "Directory");
+}
+
+//---------------------------------------------------------------------------
+void File_Ico::Data_Parse()
+{
+ //Parsing
+ int32u Size, Offset;
+ int16u BitsPerPixel;
+ int8u Width, Height;
+ Get_L1 (Width, "Width");
+ Get_L1 (Height, "Height");
+ Skip_L1( "Colour count");
+ Skip_L1( "Reserved");
+ Skip_L2( Type==1?"Colour planes":"X hotspot");
+ Get_L2 (BitsPerPixel, Type==1?"Bits per pixel":"Y hotspot");
+ Get_L4 (Size, "Size of the bitmap data");
+ Get_L4 (Offset, "Offset of the bitmap data");
+
+ FILLING_BEGIN_PRECISE();
+ stream Stream;
+ Stream.Width=Width;
+ Stream.Height=Height;
+ Stream.BitsPerPixel=BitsPerPixel;
+ Stream.Size=Size;
+ Stream.Offset=Offset;
+ Streams.push_back(Stream);
+
+ IcoDataSize+=Size;
+ if (Offset>File_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
diff --git a/src/thirdparty/MediaInfo/Image/File_Ico.h b/src/thirdparty/MediaInfo/Image/File_Ico.h
new file mode 100644
index 000000000..7b9fd6cf4
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Image/File_Ico.h
@@ -0,0 +1,76 @@
+// File_Ico - Info for Icon files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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<stream> Streams;
+};
+
+} //NameSpace
+
+#endif
+
diff --git a/src/thirdparty/MediaInfo/Image/File_Jpeg.cpp b/src/thirdparty/MediaInfo/Image/File_Jpeg.cpp
new file mode 100644
index 000000000..c04794367
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Image/File_Jpeg.cpp
@@ -0,0 +1,607 @@
+// File_Jpeg - Info for NewFormat files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// 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/
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_JPEG_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Image/File_Jpeg.h"
+#include "ZenLib/Utils.h"
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+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 QCD =0xFF5C; //JPEG 2000
+ const int16u QCC =0xFF5D; //JPEG 2000
+ const int16u RGN =0xFF5E; //JPEG 2000
+ const int16u SOT =0xFF90; //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;
+}
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Jpeg::File_Jpeg()
+{
+ //In
+ StreamKind=Stream_Image;
+
+ //Temp
+ Height_Multiplier=1;
+}
+
+//***************************************************************************
+// Static stuff
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Jpeg::FileHeader_Begin()
+{
+ //Element_Size
+ if (Buffer_Size<2)
+ return false; //Must wait for more data
+
+ if (CC2(Buffer)!=Elements::SOI
+ && CC2(Buffer)!=Elements::SOC)
+ {
+ Reject("JPEG");
+ return false;
+ }
+
+ //All should be OK...
+ return true;
+}
+
+//***************************************************************************
+// Buffer - Per element
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Jpeg::Header_Parse()
+{
+ //Parsing
+ int16u code, size;
+ Get_B2 (code, "code");
+ 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, "size");
+ }
+
+ //Filling
+ Header_Fill_Code(code, Ztring().From_CC2(code));
+ Header_Fill_Size(2+size);
+}
+
+//---------------------------------------------------------------------------
+void File_Jpeg::Data_Parse()
+{
+ #define CASE_INFO(_NAME, _DETAIL) \
+ case Elements::_NAME : Element_Info(#_NAME); Element_Info(_DETAIL); _NAME(); break;
+
+ //Parsing
+ 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(QCD , "Quantization default"); //JPEG 2000
+ CASE_INFO(QCC , "Quantization component "); //JPEG 2000
+ CASE_INFO(RGN , "Region-of-interest"); //JPEG 2000
+ CASE_INFO(SOT , "Start of tile-part"); //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_Info("Reserved");
+ Skip_XX(Element_Size, "Data");
+ }
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Jpeg::SIZ()
+{
+ //Parsing
+ int32u Xsiz, Ysiz;
+ int16u Count;
+ Skip_B2( "Rsiz - Capability of the codestream");
+ Get_B4 (Xsiz, "Xsiz - Image size X");
+ Get_B4 (Ysiz, "Ysiz - Image size Y");
+ Skip_B4( "XOsiz - Image offset X");
+ Skip_B4( "YOsiz - Image offset Y");
+ Skip_B4( "tileW - Size of tile W");
+ Skip_B4( "tileH - Size of tile H");
+ Skip_B4( "XTOsiz - Upper-left tile offset X");
+ Skip_B4( "YTOsiz - Upper-left tile offset Y");
+ Get_B2 (Count, "Components and initialize related arrays");
+ for (int16u Pos=0; Pos<Count; Pos++)
+ {
+ Element_Begin("Initialize related array");
+ BS_Begin();
+ Skip_SB( "Signed");
+ Info_S1(7, BitDepth, "BitDepth"); Element_Info(BitDepth);
+ BS_End();
+ Skip_B1( "compSubsX");
+ Skip_B1( "compSubsY");
+ Element_End();
+ }
+
+ FILLING_BEGIN_PRECISE();
+ Accept("JPEG 2000");
+
+ if (Count_Get(StreamKind)==0)
+ Stream_Prepare(StreamKind);
+ Fill(StreamKind, 0, Fill_Parameter(StreamKind, Generic_Format), StreamKind==Stream_Image?"JPEG 2000":"M-JPEG 2000");
+ Fill(StreamKind, 0, Fill_Parameter(StreamKind, Generic_Codec), StreamKind==Stream_Image?"JPEG 2000":"M-JPEG 2000");
+ if (StreamKind==Stream_Image)
+ Fill(Stream_Image, 0, Image_Codec_String, "JPEG 2000", Unlimited, true, true); //To Avoid automatic filling
+ Fill(StreamKind, 0, StreamKind==Stream_Image?(size_t)Image_Width:(size_t)Video_Width, Xsiz);
+ Fill(StreamKind, 0, StreamKind==Stream_Image?(size_t)Image_Height:(size_t)Video_Height, Ysiz);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Jpeg::COD()
+{
+ //Parsing
+ int16u Levels;
+ int8u Style, Style2, MultipleComponentTransform;
+ bool PrecinctUsed;
+ Get_B1 (Style, "Scod - Style");
+ Get_Flags (Style, 0, PrecinctUsed, "Precinct used");
+ Skip_Flags(Style, 1, "Use SOP (start of packet)");
+ Skip_Flags(Style, 2, "Use EPH (end of packet header)");
+ Skip_B1( "Number of decomposition levels");
+ Skip_B1( "Progression order");
+ Get_B2 (Levels, "Number of layers");
+ Info_B1(DimX, "Code-blocks dimensions X (2^(n+2))"); Param_Info(1<<(DimX+2), " pixels");
+ Info_B1(DimY, "Code-blocks dimensions Y (2^(n+2))"); Param_Info(1<<(DimY+2), " pixels");
+ Get_B1 (Style2, "Style of the code-block coding passes");
+ Skip_Flags(Style, 0, "Selective arithmetic coding bypass");
+ Skip_Flags(Style, 1, "MQ states for all contexts");
+ Skip_Flags(Style, 2, "Regular termination");
+ Skip_Flags(Style, 3, "Vertically stripe-causal context formation");
+ Skip_Flags(Style, 4, "Error resilience info is embedded on MQ termination");
+ Skip_Flags(Style, 5, "Segmentation marker is to be inserted at the end of each normalization coding pass");
+ Skip_B1( "Transform");
+ Get_B1(MultipleComponentTransform, "Multiple component transform");
+ if (PrecinctUsed)
+ {
+ BS_Begin();
+ Skip_S1(4, "LL sub-band width");
+ Skip_S1(4, "LL sub-band height");
+ BS_End();
+ for (int16u Pos=0; Pos<Levels; Pos++)
+ {
+ Element_Begin("Decomposition level");
+ BS_Begin();
+ Skip_S1(4, "decomposition level width");
+ Skip_S1(4, "decomposition level height");
+ BS_End();
+ Element_End();
+ }
+ }
+
+ FILLING_BEGIN();
+ switch (MultipleComponentTransform)
+ {
+ case 0x01 : Fill(Stream_Image, 0, Image_Format_Profile, "Reversible"); break;
+ case 0x02 : Fill(Stream_Image, 0, Image_Format_Profile, "Irreversible"); break;
+ default : ;
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Jpeg::QCD()
+{
+ //Parsing
+ Skip_B1( "Sqcd - Style");
+ Skip_XX(Element_Size-Element_Offset, "QCD data");
+}
+
+//---------------------------------------------------------------------------
+void File_Jpeg::SOD()
+{
+ FILLING_BEGIN_PRECISE();
+ Finish("JPEG 2000"); //No need of more
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Jpeg::SOF_()
+{
+ //Parsing
+ int16u Height, Width;
+ int8u Resolution, Count;
+ Get_B1 (Resolution, "Resolution");
+ Get_B2 (Height, "Height");
+ Get_B2 (Width, "Width");
+ Get_B1 (Count, "Number of image components in frame");
+ for (int8u Pos=0; Pos<Count; Pos++)
+ {
+ Skip_B1( "Identifier");
+ Skip_B1( "sampling factor");
+ Skip_B1( "Quantization table destination selector");
+ }
+
+ FILLING_BEGIN_PRECISE();
+ Accept("JPEG");
+
+ if (Count_Get(StreamKind)==0)
+ Stream_Prepare(StreamKind);
+ Fill(StreamKind, 0, StreamKind==Stream_Image?(size_t)Image_Format:(size_t)Video_Format, StreamKind==Stream_Image?"JPEG":"M-JPEG");
+ Fill(StreamKind, 0, StreamKind==Stream_Image?(size_t)Image_Codec:(size_t)Video_Codec, StreamKind==Stream_Image?"JPEG":"M-JPEG");
+ if (StreamKind==Stream_Image)
+ Fill(Stream_Image, 0, Image_Codec_String, "JPEG", Unlimited, true, true); //To Avoid automatic filling
+ if (StreamKind==Stream_Video)
+ Fill(Stream_Video, 0, Video_InternetMediaType, "video/JPEG", Unlimited, true, true);
+ Fill(Stream_Video, 0, Video_ColorSpace, "YUV");
+ Fill(StreamKind, 0, Fill_Parameter(StreamKind, Generic_Resolution), Resolution);
+ Fill(StreamKind, 0, StreamKind==Stream_Image?(size_t)Image_Height:(size_t)Video_Height, Height*Height_Multiplier);
+ Fill(StreamKind, 0, StreamKind==Stream_Image?(size_t)Image_Width:(size_t)Video_Width, Width);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Jpeg::SOS()
+{
+ //Parsing
+ int8u Count;
+ Get_B1 (Count, "Number of image components in scan");
+ for (int8u Pos=0; Pos<Count; Pos++)
+ {
+ Skip_B1( "Scan component selector");
+ Skip_B1( "Entropy coding table destination selector");
+ }
+ Skip_B1( "Start of spectral or predictor selection");
+ Skip_B1( "End of spectral selection");
+ Skip_B1( "Successive approximation bit position");
+
+ FILLING_BEGIN_PRECISE();
+ 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, "Data");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Jpeg::APP0_AVI1()
+{
+ //Parsing
+ int8u FieldOrder=(int8u)-1;
+ Element_Begin("AVI1");
+ if (Element_Size==16-4)
+ {
+ Get_B1 (FieldOrder, "Field Order");
+ Skip_XX(7, "Zeroes");
+ }
+ if (Element_Size==18-4)
+ {
+ Get_B1 (FieldOrder, "Field Order");
+ Skip_B1( "Zero");
+ Skip_B4( "Size of 1st Field");
+ Skip_B4( "Size of 2nd Field");
+ }
+ Element_End();
+
+ FILLING_BEGIN();
+ if (!Status[IsAccepted])
+ {
+ Accept("JPEG");
+ if (Count_Get(Stream_Video)==0)
+ Stream_Prepare(Stream_Video);
+
+ 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"); Height_Multiplier=2; break;
+ case 0x02 : Fill(Stream_Video, 0, Video_Interlacement, "BFF"); Fill(Stream_Video, 0, Video_ScanType, "Interlaced"); Fill(Stream_Video, 0, Video_ScanOrder, "BFF"); Height_Multiplier=2; break;
+ default : ;
+ }
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Jpeg::APP0_JFIF()
+{
+ //Parsing
+ Skip_B1( "Zero");
+ Element_Begin("JFIF");
+ int16u Width, Height;
+ int8u Unit, ThumbailX, ThumbailY;
+ Skip_B2( "Version");
+ Get_B1 (Unit, "Unit"); //0=Pixels, 1=dpi, 2=dpcm
+ Get_B2 (Width, "Xdensity");
+ Get_B2 (Height, "Ydensity");
+ Get_B1 (ThumbailX, "Xthumbail");
+ Get_B1 (ThumbailY, "Ythumbail");
+ Skip_XX(3*ThumbailX*ThumbailY, "RGB Thumbail");
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Jpeg::APP0_JFFF()
+{
+ Skip_B1( "Zero");
+ Element_Begin("Extension");
+ 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");
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Jpeg::APP0_JFFF_JPEG()
+{
+ //Parsing
+ Element_Begin("Thumbail JPEG");
+ if (Element_Size>Element_Offset)
+ Skip_XX(Element_Size-Element_Offset, "Data");
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Jpeg::APP0_JFFF_1B()
+{
+ //Parsing
+ Element_Begin("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_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Jpeg::APP0_JFFF_3B()
+{
+ //Parsing
+ Element_Begin("Thumbail 3 bytes per pixel");
+ int8u ThumbailX, ThumbailY;
+ Get_B1 (ThumbailX, "Xthumbail");
+ Get_B1 (ThumbailY, "Ythumbail");
+ Skip_XX(3*ThumbailX*ThumbailY, "RGB Thumbail");
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+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, "Data");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Jpeg::APP1_EXIF()
+{
+ //Parsing
+ Element_Begin("Exif");
+ int32u Alignment;
+ Get_C4(Alignment, "Alignment");
+ if (Alignment==0x49492A00)
+ Skip_B4( "First_IFD");
+ if (Alignment==0x4D4D2A00)
+ Skip_L4( "First_IFD");
+ Element_End();
+}
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Image/File_Jpeg.h b/src/thirdparty/MediaInfo/Image/File_Jpeg.h
new file mode 100644
index 000000000..0b570b57a
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Image/File_Jpeg.h
@@ -0,0 +1,146 @@
+// File_Jpeg - Info for JPEG files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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;
+
+ //Constructor/Destructor
+ File_Jpeg();
+
+private :
+ //Buffer - File header
+ bool FileHeader_Begin();
+
+ //Buffer - Per element
+ void Header_Parse();
+ void Data_Parse();
+
+ //Elements
+ void TEM () {};
+ void SOC () {}
+ void SIZ ();
+ void COD ();
+ void COC () {Skip_XX(Element_Size, "Data");}
+ void QCD ();
+ void QCC () {Skip_XX(Element_Size, "Data");}
+ void RGN () {Skip_XX(Element_Size, "Data");}
+ void SOT () {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() {Skip_XX(Element_Size, "Data");}
+ 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 Height_Multiplier;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Image/File_Png.cpp b/src/thirdparty/MediaInfo/Image/File_Png.cpp
new file mode 100644
index 000000000..52d0b19ee
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Image/File_Png.cpp
@@ -0,0 +1,244 @@
+// File_Png - Info for PNG files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// PNG - Format
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// From http://www.fileformat.info/format/png/
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_PNG_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Image/File_Png.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Infos
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+const char* Png_Colour_type(int8u Colour_type)
+{
+ switch (Colour_type)
+ {
+ case 0 : return "Greyscale";
+ case 2 : return "Truecolour";
+ case 3 : return "Indexed-colour";
+ case 4 : return "Greyscale with alpha";
+ case 6 : return "Truecolour with alpha";
+ default: return "";
+ }
+}
+
+//***************************************************************************
+// Constants
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+namespace Elements
+{
+ const int32u IDAT=0x49444154;
+ const int32u IEND=0x49454E44;
+ const int32u IHDR=0x49484452;
+ const int32u PLTE=0x506C5445;
+}
+
+//***************************************************************************
+// Static stuff
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Png::FileHeader_Begin()
+{
+ //Element_Size
+ if (Buffer_Size<8)
+ return false; //Must wait for more data
+
+ if (CC4(Buffer+4)!=0x0D0A1A0A)
+ {
+ Reject("PNG");
+ return false;
+ }
+
+ //All should be OK...
+ return true;
+}
+
+//***************************************************************************
+// Buffer - File header
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Png::FileHeader_Parse()
+{
+ //Parsing
+ int32u Signature;
+ Get_B4 (Signature, "Signature");
+ Skip_B4( "ByteOrder");
+
+ FILLING_BEGIN();
+ switch (Signature)
+ {
+ case 0x89504E47 :
+ Accept("PNG");
+
+ Fill(Stream_General, 0, General_Format, "PNG");
+
+ Stream_Prepare(Stream_Image);
+
+ break;
+
+ case 0x8A4E4E47 :
+ Accept("PNG");
+
+ Stream_Prepare(Stream_Image);
+ Fill(Stream_Image, 0, Image_Codec, "MNG");
+ Fill(Stream_Image, 0, Image_Format, "MNG");
+
+ Finish("PNG");
+ break;
+
+ case 0x8B4A4E47 :
+ Accept("PNG");
+
+ Stream_Prepare(Stream_Image);
+ Fill(Stream_Image, 0, Image_Format, "JNG");
+ Fill(Stream_Image, 0, Image_Codec, "JNG");
+
+ Finish("PNG");
+ break;
+
+ default:
+ Reject("PNG");
+ }
+ FILLING_END();
+}
+
+//***************************************************************************
+// Buffer - Per element
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Png::Header_Parse()
+{
+ //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()
+{
+ Element_Size-=4; //For CRC
+
+ #define CASE_INFO(_NAME, _DETAIL) \
+ case Elements::_NAME : Element_Info(_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::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_Info(Png_Colour_type(Colour_type));
+ Get_B1 (Compression_method, "Compression method");
+ Skip_B1( "Filter method");
+ Get_B1 (Interlace_method, "Interlace method");
+
+ FILLING_BEGIN_PRECISE();
+ Fill(Stream_Image, 0, Image_Width, Width);
+ Fill(Stream_Image, 0, Image_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(Stream_Image, 0, Image_Resolution, Resolution);
+ switch (Compression_method)
+ {
+ case 0 :
+ Fill(Stream_Image, 0, Image_Format, "LZ77");
+ Fill(Stream_Image, 0, Image_Codec, "LZ77 variant");
+ break;
+ default: ;
+ }
+ switch (Interlace_method)
+ {
+ case 0 :
+ break;
+ case 1 :
+ break;
+ default: ;
+ }
+
+ Finish("PNG");
+ FILLING_END();
+}
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Image/File_Png.h b/src/thirdparty/MediaInfo/Image/File_Png.h
new file mode 100644
index 000000000..c63aceb9e
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Image/File_Png.h
@@ -0,0 +1,60 @@
+// File_Png - Info for PNG files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
+{
+private :
+ //Buffer - File header
+ bool FileHeader_Begin();
+ void FileHeader_Parse();
+
+ //Buffer - Per element
+ void Header_Parse();
+ void Data_Parse();
+
+ //Elements
+ void IDAT() {Skip_XX(Element_Size, "Data");}
+ void IEND() {Skip_XX(Element_Size, "Data");}
+ void IHDR();
+ void PLTE() {Skip_XX(Element_Size, "Data");}
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Image/File_Rle.cpp b/src/thirdparty/MediaInfo/Image/File_Rle.cpp
new file mode 100644
index 000000000..c311f3992
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Image/File_Rle.cpp
@@ -0,0 +1,84 @@
+// File_Rle - Info for RLE files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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
diff --git a/src/thirdparty/MediaInfo/Image/File_Rle.h b/src/thirdparty/MediaInfo/Image/File_Rle.h
new file mode 100644
index 000000000..7528a1c65
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Image/File_Rle.h
@@ -0,0 +1,55 @@
+// File_Rle - Info for RLE files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Image/File_Tiff.cpp b/src/thirdparty/MediaInfo/Image/File_Tiff.cpp
new file mode 100644
index 000000000..da0fc7115
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Image/File_Tiff.cpp
@@ -0,0 +1,94 @@
+// File_Tiff - Info for TIFF files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// TIFF - Format
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// From http://www.fileformat.info/format/tiff/
+//
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_TIFF_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Image/File_Tiff.h"
+#include "ZenLib/Utils.h"
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Static stuff
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Tiff::FileHeader_Begin()
+{
+ //Element_Size
+ if (Buffer_Size<4)
+ return false; //Must wait for more data
+ if (CC4(Buffer)!=0x49492A00 && CC4(Buffer)!=0x4D4D002A)
+ {
+ Reject("TIFF");
+ return false;
+ }
+
+ //All should be OK...
+ return true;
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Tiff::Read_Buffer_Continue()
+{
+ Skip_B4( "Magic");
+ Skip_XX(File_Size-4, "Data");
+
+ FILLING_BEGIN();
+ Accept("TIFF");
+
+ Stream_Prepare(Stream_Image);
+ Fill(Stream_Image, 0, Image_Format, "TIFF");
+ Fill(Stream_Image, 0, Image_Codec, "TIFF");
+
+ //No more need data
+ Finish("TIFF");
+ FILLING_END();
+}
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Image/File_Tiff.h b/src/thirdparty/MediaInfo/Image/File_Tiff.h
new file mode 100644
index 000000000..302861979
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Image/File_Tiff.h
@@ -0,0 +1,52 @@
+// File_Tiff - Info for TIFF files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
+{
+private :
+ //Buffer - File header
+ bool FileHeader_Begin();
+
+ //Buffer - Global
+ void Read_Buffer_Continue ();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/MediaInfo.cpp b/src/thirdparty/MediaInfo/MediaInfo.cpp
new file mode 100644
index 000000000..ef42e91d3
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfo.cpp
@@ -0,0 +1,237 @@
+// MediaInfo - All info about media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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 (MediaInfo_Internal*)Internal; //Internal=NULL;
+}
+
+//***************************************************************************
+// Files
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+size_t MediaInfo::Open(const String &File_Name_)
+{
+ return ((MediaInfo_Internal*)Internal)->Open(File_Name_);
+}
+
+//---------------------------------------------------------------------------
+size_t MediaInfo::Open (const int8u* Begin_, size_t Begin_Size_, const int8u*, size_t, int64u)
+{
+ return ((MediaInfo_Internal*)Internal)->Open(Begin_, Begin_Size_);
+}
+
+//---------------------------------------------------------------------------
+size_t MediaInfo::Open_Buffer_Init (int64u File_Size, int64u File_Offset)
+{
+ return ((MediaInfo_Internal*)Internal)->Open_Buffer_Init(File_Size, File_Offset);
+}
+
+//---------------------------------------------------------------------------
+size_t MediaInfo::Open_Buffer_Continue (const int8u* ToAdd, size_t ToAdd_Size)
+{
+ return ((MediaInfo_Internal*)Internal)->Open_Buffer_Continue(ToAdd, ToAdd_Size).to_ulong();
+}
+
+//---------------------------------------------------------------------------
+int64u MediaInfo::Open_Buffer_Continue_GoTo_Get ()
+{
+ return ((MediaInfo_Internal*)Internal)->Open_Buffer_Continue_GoTo_Get();
+}
+
+//---------------------------------------------------------------------------
+size_t MediaInfo::Open_Buffer_Finalize ()
+{
+ return ((MediaInfo_Internal*)Internal)->Open_Buffer_Finalize();
+}
+
+//---------------------------------------------------------------------------
+size_t MediaInfo::Save()
+{
+ return 0; //Not yet implemented
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo::Close()
+{
+ return ((MediaInfo_Internal*)Internal)->Close();
+}
+
+//***************************************************************************
+// Get File info
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+String MediaInfo::Inform(size_t)
+{
+ return ((MediaInfo_Internal*)Internal)->Inform();
+}
+
+//---------------------------------------------------------------------------
+String MediaInfo::Get(stream_t StreamKind, size_t StreamPos, size_t Parameter, info_t KindOfInfo)
+{
+ return ((MediaInfo_Internal*)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 ((MediaInfo_Internal*)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 ((MediaInfo_Internal*)Internal)->Output_Buffer_Get(Value);
+}
+
+//---------------------------------------------------------------------------
+size_t MediaInfo::Output_Buffer_Get (size_t Pos)
+{
+ return ((MediaInfo_Internal*)Internal)->Output_Buffer_Get(Pos);
+}
+
+//***************************************************************************
+// Information
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+String MediaInfo::Option (const String &Option, const String &Value)
+{
+ return ((MediaInfo_Internal*)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 ((MediaInfo_Internal*)Internal)->Count_Get(StreamKind, StreamPos);
+
+}
+
+//---------------------------------------------------------------------------
+size_t MediaInfo::State_Get ()
+{
+ return ((MediaInfo_Internal*)Internal)->State_Get();
+}
+
+} //NameSpace
+
+
diff --git a/src/thirdparty/MediaInfo/MediaInfo.h b/src/thirdparty/MediaInfo/MediaInfo.h
new file mode 100644
index 000000000..597e1b4c6
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfo.h
@@ -0,0 +1,252 @@
+// MediaInfo - All information about media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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 File__Analyze;
+class Internet__Base;
+
+//***************************************************************************
+/// @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)
+ 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)
+ size_t Open_Buffer_Finalize ();
+ /// (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
+ /// @pre You can change default presentation with Inform_Set()
+ 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 Value 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", "Chapters", "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...)
+ size_t Count_Get (stream_t StreamKind, size_t StreamNumber=(size_t)-1);
+
+private :
+ void* Internal;
+};
+
+} //NameSpace
+#endif
diff --git a/src/thirdparty/MediaInfo/MediaInfoLib.vcproj b/src/thirdparty/MediaInfo/MediaInfoLib.vcproj
new file mode 100644
index 000000000..ecea23cff
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfoLib.vcproj
@@ -0,0 +1,1494 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="MediaInfoLib"
+ ProjectGUID="{20E0F8D6-213C-460B-B361-9C725CB375C7}"
+ RootNamespace="MediaInfoLib"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ ConfigurationType="4"
+ InheritedPropertySheets="..\..\common.vsprops;..\..\debug.vsprops"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
+ AdditionalIncludeDirectories="..;Source;../ZenLib;../zlib"
+ AdditionalUsingDirectories=""
+ PreprocessorDefinitions="WIN32;_DEBUG;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;CURL_STATICLIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ DisableSpecificWarnings="4060;4065;4100;4127;4244;4390"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ ConfigurationType="4"
+ InheritedPropertySheets="..\..\common.vsprops;..\..\debug.vsprops"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
+ AdditionalIncludeDirectories="..;Source;../ZenLib;../zlib"
+ AdditionalUsingDirectories=""
+ PreprocessorDefinitions="WIN32;_DEBUG;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;CURL_STATICLIB"
+ DebugInformationFormat="3"
+ DisableSpecificWarnings="4060;4065;4100;4127;4244;4390"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="4"
+ InheritedPropertySheets="..\..\common.vsprops;..\..\release.vsprops"
+ UseOfMFC="1"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
+ AdditionalIncludeDirectories="..;Source;../ZenLib;../zlib"
+ AdditionalUsingDirectories=""
+ PreprocessorDefinitions="WIN32;NDEBUG;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;CURL_STATICLIB"
+ StringPooling="true"
+ DisableSpecificWarnings="4060;4065;4100;4127;4244;4390"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalOptions="/IGNORE:4221"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ ConfigurationType="4"
+ InheritedPropertySheets="..\..\common.vsprops;..\..\release.vsprops"
+ UseOfMFC="1"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/MP"
+ AdditionalIncludeDirectories="..;Source;../ZenLib;../zlib"
+ AdditionalUsingDirectories=""
+ PreprocessorDefinitions="WIN32;NDEBUG;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;CURL_STATICLIB"
+ EnableEnhancedInstructionSet="0"
+ DisableSpecificWarnings="4060;4065;4100;4127;4244;4390"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalOptions="/IGNORE:4221"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\File__Analyze.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\File__Analyze_Buffer.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\File__Analyze_Buffer_MinimizeSize.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\File__Analyze_Streams.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\File__Analyze_Streams_Finish.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\File__Base.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\File__Duplicate.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\File__MultipleParsing.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\File_Dummy.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\File_Other.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\File_Unknown.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfo.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfo_Config.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfo_Config_Automatic.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfo_Config_MediaInfo.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfo_File.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfo_Inform.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfo_Internal.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfoList.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfoList_Internal.cpp"
+ >
+ </File>
+ <Filter
+ Name="Archive"
+ >
+ <File
+ RelativePath=".\Archive\File_7z.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Archive\File_Ace.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Archive\File_Bzip2.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Archive\File_Elf.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Archive\File_Gzip.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Archive\File_Mz.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Archive\File_Rar.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Archive\File_Tar.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Archive\File_Zip.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Audio"
+ >
+ <File
+ RelativePath=".\Audio\File_Aac.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Ac3.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Adif.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Adpcm.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Adts.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Aes3.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Als.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Amr.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Amv.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Ape.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Au.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Dts.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_ExtendedModule.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Flac.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_ImpulseTracker.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_La.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Latm.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Midi.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Module.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Mpc.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_MpcSv8.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Mpeg4_AudioSpecificConfig.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Mpega.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Pcm.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Ps2Audio.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_ScreamTracker3.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Speex.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Tak.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Tta.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_TwinVQ.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Vorbis.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Wvpk.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Video"
+ >
+ <File
+ RelativePath=".\Video\File_AfdBarData.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Avc.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Avc_Duplicate.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_AvsV.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Dirac.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Flic.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Fraps.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Lagarith.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Mpeg4v.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Mpegv.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Theora.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Vc1.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Image"
+ >
+ <File
+ RelativePath=".\Image\File_Bmp.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Image\File_Gif.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Image\File_Ico.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Image\File_Jpeg.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Image\File_Png.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Image\File_Rle.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Image\File_Tiff.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Multiple"
+ >
+ <File
+ RelativePath=".\Multiple\File_Bdmv.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Cdxa.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Dpg.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_DvDif.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_DvDif_Analysis.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Dvdv.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Flv.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Gxf.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Ivf.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Lxf.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Mk.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Mpeg4.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Mpeg4_Descriptors.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Mpeg4_Elements.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Mpeg4_TimeCode.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Mpeg_Descriptors.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Mpeg_Psi.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_MpegPs.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_MpegTs.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_MpegTs_Duplicate.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Mxf.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Nut.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Ogg.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Ogg_SubElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_P2_Clip.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Riff.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Riff_Elements.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Rm.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Skm.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Swf.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Umf.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Wm.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Wm_Elements.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Xdcam_Clip.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Text"
+ >
+ <File
+ RelativePath=".\Text\File_Cdp.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Text\File_Cmml.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Text\File_DtvccTransport.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Text\File_Eia608.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Text\File_Eia708.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Text\File_Kate.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Text\File_N19.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Text\File_OtherText.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Text\File_Pgs.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Text\File_Scte20.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Tag"
+ >
+ <File
+ RelativePath=".\Tag\File__Tags.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Tag\File_ApeTag.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Tag\File_Id3.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\$(InputName)1.obj"
+ XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\$(InputName)1.obj"
+ XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\$(InputName)1.obj"
+ XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\$(InputName)1.obj"
+ XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\Tag\File_Id3v2.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Tag\File_Lyrics3.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Tag\File_Lyrics3v2.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Tag\File_VorbisCom.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Duplicate"
+ >
+ <File
+ RelativePath=".\Duplicate\File__Duplicate__Base.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Duplicate\File__Duplicate__Writer.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Duplicate\File__Duplicate_MpegTs.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Reader"
+ >
+ <File
+ RelativePath=".\Reader\Reader_Directory.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Reader\Reader_File.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Reader\Reader_libcurl.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Reader\Reader_libmms.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Export"
+ >
+ <File
+ RelativePath=".\Export\Export_Mpeg7.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Export\Export_PBCore.cpp"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\File__Analyse_Automatic.h"
+ >
+ </File>
+ <File
+ RelativePath=".\File__Analyze.h"
+ >
+ </File>
+ <File
+ RelativePath=".\File__Base.h"
+ >
+ </File>
+ <File
+ RelativePath=".\File__Duplicate.h"
+ >
+ </File>
+ <File
+ RelativePath=".\File__MultipleParsing.h"
+ >
+ </File>
+ <File
+ RelativePath=".\File_Dummy.h"
+ >
+ </File>
+ <File
+ RelativePath=".\File_Other.h"
+ >
+ </File>
+ <File
+ RelativePath=".\File_Unknown.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfo.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfo_Config.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfo_Config_MediaInfo.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfo_Events.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfo_Events_Internal.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfo_Internal.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfo_Internal_Const.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfoList.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MediaInfoList_Internal.h"
+ >
+ </File>
+ <File
+ RelativePath=".\PreComp.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Setup.h"
+ >
+ </File>
+ <Filter
+ Name="Archive"
+ >
+ <File
+ RelativePath=".\Archive\File_7z.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Archive\File_Ace.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Archive\File_Bzip2.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Archive\File_Elf.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Archive\File_Gzip.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Archive\File_Mz.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Archive\File_Rar.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Archive\File_Tar.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Archive\File_Zip.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Audio"
+ >
+ <File
+ RelativePath=".\Audio\File_Aac.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Ac3.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Adif.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Adpcm.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Adts.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Aes3.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Als.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Amr.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Amv.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Ape.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Au.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Dirac.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Dts.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_ExtendedModule.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Flac.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_ImpulseTracker.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_La.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Latm.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Midi.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Module.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Mpc.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_MpcSv8.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Mpeg4_AudioSpecificConfig.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Mpega.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Pcm.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Ps2Audio.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_ScreamTracker3.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Speex.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Tak.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Tta.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_TwinVQ.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Vorbis.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Audio\File_Wvpk.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Image"
+ >
+ <File
+ RelativePath=".\Image\File_Bmp.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Image\File_Gif.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Image\File_Ico.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Image\File_Jpeg.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Image\File_Png.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Image\File_Rle.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Image\File_Tiff.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Multiple"
+ >
+ <File
+ RelativePath=".\Multiple\File_Bdmv.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Cdxa.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Dpg.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_DvDif.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Dvdv.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Flv.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Gxf.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Ivf.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Lxf.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Mk.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Mpeg4.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Mpeg4_TimeCode.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Mpeg_Descriptors.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Mpeg_Psi.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_MpegPs.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_MpegTs.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Mxf.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Nut.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Ogg.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Ogg_SubElement.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_P2_Clip.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Riff.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Rm.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Skm.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Swf.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Umf.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Wm.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Multiple\File_Xdcam_Clip.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Video"
+ >
+ <File
+ RelativePath=".\Video\File_AfdBarData.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Avc.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_AvsV.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Dirac.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Flic.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Fraps.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Lagarith.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Mpeg4v.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Mpegv.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Theora.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Video\File_Vc1.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Text"
+ >
+ <File
+ RelativePath=".\Text\File_Cdp.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Text\File_Cmml.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Text\File_DtvccTransport.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Text\File_Eia608.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Text\File_Eia708.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Text\File_Kate.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Text\File_N19.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Text\File_OtherText.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Text\File_Pgs.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Tag"
+ >
+ <File
+ RelativePath=".\Tag\File__Tags.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Tag\File_ApeTag.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Tag\File_Id3.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Tag\File_Id3v2.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Tag\File_Lyrics3.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Tag\File_Lyrics3v2.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Tag\File_VorbisCom.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Duplicate"
+ >
+ <File
+ RelativePath=".\Duplicate\File__Duplicate__Base.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Duplicate\File__Duplicate__Writer.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Duplicate\File__Duplicate_MpegTs.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Reader"
+ >
+ <File
+ RelativePath=".\Reader\Reader_Directory.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Reader\Reader_File.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Reader\Reader_libcurl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Reader\Reader_libmms.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Export"
+ >
+ <File
+ RelativePath=".\Export\Export_Mpeg7.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Export\Export_PBCore.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/thirdparty/MediaInfo/MediaInfoLib.vcxproj b/src/thirdparty/MediaInfo/MediaInfoLib.vcxproj
new file mode 100644
index 000000000..f3b73be7e
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfoLib.vcxproj
@@ -0,0 +1,438 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{20E0F8D6-213C-460B-B361-9C725CB375C7}</ProjectGuid>
+ <RootNamespace>MediaInfoLib</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>Static</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>Static</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>Static</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseOfMfc>Static</UseOfMfc>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="..\..\common.props" />
+ <Import Project="..\..\release.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="..\..\common.props" />
+ <Import Project="..\..\debug.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="..\..\common.props" />
+ <Import Project="..\..\release.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="..\..\common.props" />
+ <Import Project="..\..\debug.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalIncludeDirectories>..;Source;../ZenLib;../zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <DisableSpecificWarnings>4060;4065;4100;4127;4244;4390;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Lib>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Midl>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalIncludeDirectories>..;Source;../ZenLib;../zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4060;4065;4100;4127;4244;4390;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <EnablePREfast>false</EnablePREfast>
+ </ClCompile>
+ <Lib>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalIncludeDirectories>..;Source;../ZenLib;../zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <DisableSpecificWarnings>4060;4065;4100;4127;4244;4390;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/IGNORE:4221 %(AdditionalOptions)</AdditionalOptions>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Midl>
+ <TargetEnvironment>X64</TargetEnvironment>
+ </Midl>
+ <ClCompile>
+ <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalIncludeDirectories>..;Source;../ZenLib;../zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;MEDIAINFO_TRACE_NO;MEDIAINFO_LIBCURL_NO;MEDIAINFO_LIBMMS_NO;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
+ <DisableSpecificWarnings>4060;4065;4100;4127;4244;4390;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <Lib>
+ <AdditionalOptions>/IGNORE:4221 %(AdditionalOptions)</AdditionalOptions>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="File__Analyze.cpp" />
+ <ClCompile Include="File__Analyze_Buffer.cpp" />
+ <ClCompile Include="File__Analyze_Buffer_MinimizeSize.cpp" />
+ <ClCompile Include="File__Analyze_Streams.cpp" />
+ <ClCompile Include="File__Analyze_Streams_Finish.cpp" />
+ <ClCompile Include="File__Base.cpp" />
+ <ClCompile Include="File__Duplicate.cpp" />
+ <ClCompile Include="File__MultipleParsing.cpp" />
+ <ClCompile Include="File_Dummy.cpp" />
+ <ClCompile Include="File_Other.cpp" />
+ <ClCompile Include="File_Unknown.cpp" />
+ <ClCompile Include="MediaInfo.cpp" />
+ <ClCompile Include="MediaInfo_Config.cpp" />
+ <ClCompile Include="MediaInfo_Config_Automatic.cpp" />
+ <ClCompile Include="MediaInfo_Config_MediaInfo.cpp" />
+ <ClCompile Include="MediaInfo_File.cpp" />
+ <ClCompile Include="MediaInfo_Inform.cpp" />
+ <ClCompile Include="MediaInfo_Internal.cpp" />
+ <ClCompile Include="MediaInfoList.cpp" />
+ <ClCompile Include="MediaInfoList_Internal.cpp" />
+ <ClCompile Include="Archive\File_7z.cpp" />
+ <ClCompile Include="Archive\File_Ace.cpp" />
+ <ClCompile Include="Archive\File_Bzip2.cpp" />
+ <ClCompile Include="Archive\File_Elf.cpp" />
+ <ClCompile Include="Archive\File_Gzip.cpp" />
+ <ClCompile Include="Archive\File_Mz.cpp" />
+ <ClCompile Include="Archive\File_Rar.cpp" />
+ <ClCompile Include="Archive\File_Tar.cpp" />
+ <ClCompile Include="Archive\File_Zip.cpp" />
+ <ClCompile Include="Audio\File_Aac.cpp" />
+ <ClCompile Include="Audio\File_Ac3.cpp" />
+ <ClCompile Include="Audio\File_Adif.cpp" />
+ <ClCompile Include="Audio\File_Adpcm.cpp" />
+ <ClCompile Include="Audio\File_Adts.cpp" />
+ <ClCompile Include="Audio\File_Aes3.cpp" />
+ <ClCompile Include="Audio\File_Als.cpp" />
+ <ClCompile Include="Audio\File_Amr.cpp" />
+ <ClCompile Include="Audio\File_Amv.cpp" />
+ <ClCompile Include="Audio\File_Ape.cpp" />
+ <ClCompile Include="Audio\File_Au.cpp" />
+ <ClCompile Include="Audio\File_Dts.cpp" />
+ <ClCompile Include="Audio\File_ExtendedModule.cpp" />
+ <ClCompile Include="Audio\File_Flac.cpp" />
+ <ClCompile Include="Audio\File_ImpulseTracker.cpp" />
+ <ClCompile Include="Audio\File_La.cpp" />
+ <ClCompile Include="Audio\File_Latm.cpp" />
+ <ClCompile Include="Audio\File_Midi.cpp" />
+ <ClCompile Include="Audio\File_Module.cpp" />
+ <ClCompile Include="Audio\File_Mpc.cpp" />
+ <ClCompile Include="Audio\File_MpcSv8.cpp" />
+ <ClCompile Include="Audio\File_Mpeg4_AudioSpecificConfig.cpp" />
+ <ClCompile Include="Audio\File_Mpega.cpp" />
+ <ClCompile Include="Audio\File_Pcm.cpp" />
+ <ClCompile Include="Audio\File_Ps2Audio.cpp" />
+ <ClCompile Include="Audio\File_ScreamTracker3.cpp" />
+ <ClCompile Include="Audio\File_Speex.cpp" />
+ <ClCompile Include="Audio\File_Tak.cpp" />
+ <ClCompile Include="Audio\File_Tta.cpp" />
+ <ClCompile Include="Audio\File_TwinVQ.cpp" />
+ <ClCompile Include="Audio\File_Vorbis.cpp" />
+ <ClCompile Include="Audio\File_Wvpk.cpp" />
+ <ClCompile Include="Video\File_AfdBarData.cpp" />
+ <ClCompile Include="Video\File_Avc.cpp" />
+ <ClCompile Include="Video\File_Avc_Duplicate.cpp" />
+ <ClCompile Include="Video\File_AvsV.cpp" />
+ <ClCompile Include="Video\File_Dirac.cpp" />
+ <ClCompile Include="Video\File_Flic.cpp" />
+ <ClCompile Include="Video\File_Fraps.cpp" />
+ <ClCompile Include="Video\File_Lagarith.cpp" />
+ <ClCompile Include="Video\File_Mpeg4v.cpp" />
+ <ClCompile Include="Video\File_Mpegv.cpp" />
+ <ClCompile Include="Video\File_Theora.cpp" />
+ <ClCompile Include="Video\File_Vc1.cpp" />
+ <ClCompile Include="Image\File_Bmp.cpp" />
+ <ClCompile Include="Image\File_Gif.cpp" />
+ <ClCompile Include="Image\File_Ico.cpp" />
+ <ClCompile Include="Image\File_Jpeg.cpp" />
+ <ClCompile Include="Image\File_Png.cpp" />
+ <ClCompile Include="Image\File_Rle.cpp" />
+ <ClCompile Include="Image\File_Tiff.cpp" />
+ <ClCompile Include="Multiple\File_Bdmv.cpp" />
+ <ClCompile Include="Multiple\File_Cdxa.cpp" />
+ <ClCompile Include="Multiple\File_Dpg.cpp" />
+ <ClCompile Include="Multiple\File_DvDif.cpp" />
+ <ClCompile Include="Multiple\File_DvDif_Analysis.cpp" />
+ <ClCompile Include="Multiple\File_Dvdv.cpp" />
+ <ClCompile Include="Multiple\File_Flv.cpp" />
+ <ClCompile Include="Multiple\File_Gxf.cpp" />
+ <ClCompile Include="Multiple\File_Ivf.cpp" />
+ <ClCompile Include="Multiple\File_Lxf.cpp" />
+ <ClCompile Include="Multiple\File_Mk.cpp" />
+ <ClCompile Include="Multiple\File_Mpeg4.cpp" />
+ <ClCompile Include="Multiple\File_Mpeg4_Descriptors.cpp" />
+ <ClCompile Include="Multiple\File_Mpeg4_Elements.cpp" />
+ <ClCompile Include="Multiple\File_Mpeg4_TimeCode.cpp" />
+ <ClCompile Include="Multiple\File_Mpeg_Descriptors.cpp" />
+ <ClCompile Include="Multiple\File_Mpeg_Psi.cpp" />
+ <ClCompile Include="Multiple\File_MpegPs.cpp" />
+ <ClCompile Include="Multiple\File_MpegTs.cpp" />
+ <ClCompile Include="Multiple\File_MpegTs_Duplicate.cpp" />
+ <ClCompile Include="Multiple\File_Mxf.cpp" />
+ <ClCompile Include="Multiple\File_Nut.cpp" />
+ <ClCompile Include="Multiple\File_Ogg.cpp" />
+ <ClCompile Include="Multiple\File_Ogg_SubElement.cpp" />
+ <ClCompile Include="Multiple\File_P2_Clip.cpp" />
+ <ClCompile Include="Multiple\File_Riff.cpp" />
+ <ClCompile Include="Multiple\File_Riff_Elements.cpp" />
+ <ClCompile Include="Multiple\File_Rm.cpp" />
+ <ClCompile Include="Multiple\File_Skm.cpp" />
+ <ClCompile Include="Multiple\File_Swf.cpp" />
+ <ClCompile Include="Multiple\File_Umf.cpp" />
+ <ClCompile Include="Multiple\File_Wm.cpp" />
+ <ClCompile Include="Multiple\File_Wm_Elements.cpp" />
+ <ClCompile Include="Multiple\File_Xdcam_Clip.cpp" />
+ <ClCompile Include="Text\File_Cdp.cpp" />
+ <ClCompile Include="Text\File_Cmml.cpp" />
+ <ClCompile Include="Text\File_DtvccTransport.cpp" />
+ <ClCompile Include="Text\File_Eia608.cpp" />
+ <ClCompile Include="Text\File_Eia708.cpp" />
+ <ClCompile Include="Text\File_Kate.cpp" />
+ <ClCompile Include="Text\File_N19.cpp" />
+ <ClCompile Include="Text\File_OtherText.cpp" />
+ <ClCompile Include="Text\File_Pgs.cpp" />
+ <ClCompile Include="Text\File_Scte20.cpp" />
+ <ClCompile Include="Tag\File__Tags.cpp" />
+ <ClCompile Include="Tag\File_ApeTag.cpp" />
+ <ClCompile Include="Tag\File_Id3.cpp">
+ <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
+ <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
+ <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
+ <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
+ <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
+ <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
+ <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
+ <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
+ </ClCompile>
+ <ClCompile Include="Tag\File_Id3v2.cpp" />
+ <ClCompile Include="Tag\File_Lyrics3.cpp" />
+ <ClCompile Include="Tag\File_Lyrics3v2.cpp" />
+ <ClCompile Include="Tag\File_VorbisCom.cpp" />
+ <ClCompile Include="Duplicate\File__Duplicate__Base.cpp" />
+ <ClCompile Include="Duplicate\File__Duplicate__Writer.cpp" />
+ <ClCompile Include="Duplicate\File__Duplicate_MpegTs.cpp" />
+ <ClCompile Include="Reader\Reader_Directory.cpp" />
+ <ClCompile Include="Reader\Reader_File.cpp" />
+ <ClCompile Include="Reader\Reader_libcurl.cpp" />
+ <ClCompile Include="Reader\Reader_libmms.cpp" />
+ <ClCompile Include="Export\Export_Mpeg7.cpp" />
+ <ClCompile Include="Export\Export_PBCore.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="File__Analyse_Automatic.h" />
+ <ClInclude Include="File__Analyze.h" />
+ <ClInclude Include="File__Base.h" />
+ <ClInclude Include="File__Duplicate.h" />
+ <ClInclude Include="File__MultipleParsing.h" />
+ <ClInclude Include="File_Dummy.h" />
+ <ClInclude Include="File_Other.h" />
+ <ClInclude Include="File_Unknown.h" />
+ <ClInclude Include="MediaInfo.h" />
+ <ClInclude Include="MediaInfo_Config.h" />
+ <ClInclude Include="MediaInfo_Config_MediaInfo.h" />
+ <ClInclude Include="MediaInfo_Events.h" />
+ <ClInclude Include="MediaInfo_Events_Internal.h" />
+ <ClInclude Include="MediaInfo_Internal.h" />
+ <ClInclude Include="MediaInfo_Internal_Const.h" />
+ <ClInclude Include="MediaInfoList.h" />
+ <ClInclude Include="MediaInfoList_Internal.h" />
+ <ClInclude Include="PreComp.h" />
+ <ClInclude Include="Setup.h" />
+ <ClInclude Include="Archive\File_7z.h" />
+ <ClInclude Include="Archive\File_Ace.h" />
+ <ClInclude Include="Archive\File_Bzip2.h" />
+ <ClInclude Include="Archive\File_Elf.h" />
+ <ClInclude Include="Archive\File_Gzip.h" />
+ <ClInclude Include="Archive\File_Mz.h" />
+ <ClInclude Include="Archive\File_Rar.h" />
+ <ClInclude Include="Archive\File_Tar.h" />
+ <ClInclude Include="Archive\File_Zip.h" />
+ <ClInclude Include="Audio\File_Aac.h" />
+ <ClInclude Include="Audio\File_Ac3.h" />
+ <ClInclude Include="Audio\File_Adif.h" />
+ <ClInclude Include="Audio\File_Adpcm.h" />
+ <ClInclude Include="Audio\File_Adts.h" />
+ <ClInclude Include="Audio\File_Aes3.h" />
+ <ClInclude Include="Audio\File_Als.h" />
+ <ClInclude Include="Audio\File_Amr.h" />
+ <ClInclude Include="Audio\File_Amv.h" />
+ <ClInclude Include="Audio\File_Ape.h" />
+ <ClInclude Include="Audio\File_Au.h" />
+ <ClInclude Include="Audio\File_Dirac.h" />
+ <ClInclude Include="Audio\File_Dts.h" />
+ <ClInclude Include="Audio\File_ExtendedModule.h" />
+ <ClInclude Include="Audio\File_Flac.h" />
+ <ClInclude Include="Audio\File_ImpulseTracker.h" />
+ <ClInclude Include="Audio\File_La.h" />
+ <ClInclude Include="Audio\File_Latm.h" />
+ <ClInclude Include="Audio\File_Midi.h" />
+ <ClInclude Include="Audio\File_Module.h" />
+ <ClInclude Include="Audio\File_Mpc.h" />
+ <ClInclude Include="Audio\File_MpcSv8.h" />
+ <ClInclude Include="Audio\File_Mpeg4_AudioSpecificConfig.h" />
+ <ClInclude Include="Audio\File_Mpega.h" />
+ <ClInclude Include="Audio\File_Pcm.h" />
+ <ClInclude Include="Audio\File_Ps2Audio.h" />
+ <ClInclude Include="Audio\File_ScreamTracker3.h" />
+ <ClInclude Include="Audio\File_Speex.h" />
+ <ClInclude Include="Audio\File_Tak.h" />
+ <ClInclude Include="Audio\File_Tta.h" />
+ <ClInclude Include="Audio\File_TwinVQ.h" />
+ <ClInclude Include="Audio\File_Vorbis.h" />
+ <ClInclude Include="Audio\File_Wvpk.h" />
+ <ClInclude Include="Image\File_Bmp.h" />
+ <ClInclude Include="Image\File_Gif.h" />
+ <ClInclude Include="Image\File_Ico.h" />
+ <ClInclude Include="Image\File_Jpeg.h" />
+ <ClInclude Include="Image\File_Png.h" />
+ <ClInclude Include="Image\File_Rle.h" />
+ <ClInclude Include="Image\File_Tiff.h" />
+ <ClInclude Include="Multiple\File_Bdmv.h" />
+ <ClInclude Include="Multiple\File_Cdxa.h" />
+ <ClInclude Include="Multiple\File_Dpg.h" />
+ <ClInclude Include="Multiple\File_DvDif.h" />
+ <ClInclude Include="Multiple\File_Dvdv.h" />
+ <ClInclude Include="Multiple\File_Flv.h" />
+ <ClInclude Include="Multiple\File_Gxf.h" />
+ <ClInclude Include="Multiple\File_Ivf.h" />
+ <ClInclude Include="Multiple\File_Lxf.h" />
+ <ClInclude Include="Multiple\File_Mk.h" />
+ <ClInclude Include="Multiple\File_Mpeg4.h" />
+ <ClInclude Include="Multiple\File_Mpeg4_TimeCode.h" />
+ <ClInclude Include="Multiple\File_Mpeg_Descriptors.h" />
+ <ClInclude Include="Multiple\File_Mpeg_Psi.h" />
+ <ClInclude Include="Multiple\File_MpegPs.h" />
+ <ClInclude Include="Multiple\File_MpegTs.h" />
+ <ClInclude Include="Multiple\File_Mxf.h" />
+ <ClInclude Include="Multiple\File_Nut.h" />
+ <ClInclude Include="Multiple\File_Ogg.h" />
+ <ClInclude Include="Multiple\File_Ogg_SubElement.h" />
+ <ClInclude Include="Multiple\File_P2_Clip.h" />
+ <ClInclude Include="Multiple\File_Riff.h" />
+ <ClInclude Include="Multiple\File_Rm.h" />
+ <ClInclude Include="Multiple\File_Skm.h" />
+ <ClInclude Include="Multiple\File_Swf.h" />
+ <ClInclude Include="Multiple\File_Umf.h" />
+ <ClInclude Include="Multiple\File_Wm.h" />
+ <ClInclude Include="Multiple\File_Xdcam_Clip.h" />
+ <ClInclude Include="Video\File_AfdBarData.h" />
+ <ClInclude Include="Video\File_Avc.h" />
+ <ClInclude Include="Video\File_AvsV.h" />
+ <ClInclude Include="Video\File_Dirac.h" />
+ <ClInclude Include="Video\File_Flic.h" />
+ <ClInclude Include="Video\File_Fraps.h" />
+ <ClInclude Include="Video\File_Lagarith.h" />
+ <ClInclude Include="Video\File_Mpeg4v.h" />
+ <ClInclude Include="Video\File_Mpegv.h" />
+ <ClInclude Include="Video\File_Theora.h" />
+ <ClInclude Include="Video\File_Vc1.h" />
+ <ClInclude Include="Text\File_Cdp.h" />
+ <ClInclude Include="Text\File_Cmml.h" />
+ <ClInclude Include="Text\File_DtvccTransport.h" />
+ <ClInclude Include="Text\File_Eia608.h" />
+ <ClInclude Include="Text\File_Eia708.h" />
+ <ClInclude Include="Text\File_Kate.h" />
+ <ClInclude Include="Text\File_N19.h" />
+ <ClInclude Include="Text\File_OtherText.h" />
+ <ClInclude Include="Text\File_Pgs.h" />
+ <ClInclude Include="Tag\File__Tags.h" />
+ <ClInclude Include="Tag\File_ApeTag.h" />
+ <ClInclude Include="Tag\File_Id3.h" />
+ <ClInclude Include="Tag\File_Id3v2.h" />
+ <ClInclude Include="Tag\File_Lyrics3.h" />
+ <ClInclude Include="Tag\File_Lyrics3v2.h" />
+ <ClInclude Include="Tag\File_VorbisCom.h" />
+ <ClInclude Include="Duplicate\File__Duplicate__Base.h" />
+ <ClInclude Include="Duplicate\File__Duplicate__Writer.h" />
+ <ClInclude Include="Duplicate\File__Duplicate_MpegTs.h" />
+ <ClInclude Include="Reader\Reader_Directory.h" />
+ <ClInclude Include="Reader\Reader_File.h" />
+ <ClInclude Include="Reader\Reader_libcurl.h" />
+ <ClInclude Include="Reader\Reader_libmms.h" />
+ <ClInclude Include="Export\Export_Mpeg7.h" />
+ <ClInclude Include="Export\Export_PBCore.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/src/thirdparty/MediaInfo/MediaInfoLib.vcxproj.filters b/src/thirdparty/MediaInfo/MediaInfoLib.vcxproj.filters
new file mode 100644
index 000000000..e0fb7a13e
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfoLib.vcxproj.filters
@@ -0,0 +1,897 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Source Files\Archive">
+ <UniqueIdentifier>{3dc9993c-04e0-4cb9-9f34-5b19137b2834}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\Audio">
+ <UniqueIdentifier>{28d43698-66e0-4941-a2e4-1b956a2b5fe7}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\Video">
+ <UniqueIdentifier>{fbda9443-78eb-4ea4-821d-fdf1e4312fe9}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\Image">
+ <UniqueIdentifier>{821c9d19-7db8-405a-8720-bbb8d078389f}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\Multiple">
+ <UniqueIdentifier>{a89d76a1-c810-419e-a684-9c6871d80bff}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\Text">
+ <UniqueIdentifier>{6c053b56-6165-4d8e-a063-f5aed9962861}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\Tag">
+ <UniqueIdentifier>{06d0e252-f956-46f3-9ae5-8603b15292f2}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\Duplicate">
+ <UniqueIdentifier>{22d14861-6e4a-44ce-b8ee-15631985a17c}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\Reader">
+ <UniqueIdentifier>{9825146d-3c72-4c97-b8bd-4110d6864f85}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\Export">
+ <UniqueIdentifier>{fc57b025-ed67-40ac-8c8e-3c6883c85349}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Header Files\Archive">
+ <UniqueIdentifier>{672f3387-03f6-44ca-a757-a5bd005a5907}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files\Audio">
+ <UniqueIdentifier>{147a9c79-f2c6-4e91-bf7c-56922dae08fa}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files\Image">
+ <UniqueIdentifier>{e4cb9a21-27e3-439e-8740-1765e5f72b0a}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files\Multiple">
+ <UniqueIdentifier>{2327f2b8-3f54-4d2a-b2fb-b69ae80783e0}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files\Video">
+ <UniqueIdentifier>{e37765c7-a8fb-4a24-84bc-04c806fa2b2d}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files\Text">
+ <UniqueIdentifier>{23b806ee-9a7d-4c96-8ed6-cf5ec08396e9}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files\Tag">
+ <UniqueIdentifier>{23ccb961-35e4-407b-a058-350f13a1d04d}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files\Duplicate">
+ <UniqueIdentifier>{5ad8978f-de5a-41c9-acdd-0d205d91be7c}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files\Reader">
+ <UniqueIdentifier>{5c7f1169-b4dc-472b-8324-deea7b749284}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files\Export">
+ <UniqueIdentifier>{4e73fd52-73cf-4577-b631-f7b9313f1e21}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="File__Analyze.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="File__Analyze_Buffer.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="File__Analyze_Buffer_MinimizeSize.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="File__Analyze_Streams.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="File__Analyze_Streams_Finish.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="File__Base.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="File__Duplicate.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="File__MultipleParsing.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="File_Dummy.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="File_Other.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="File_Unknown.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="MediaInfo.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="MediaInfo_Config.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="MediaInfo_Config_Automatic.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="MediaInfo_Config_MediaInfo.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="MediaInfo_File.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="MediaInfo_Inform.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="MediaInfo_Internal.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="MediaInfoList.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="MediaInfoList_Internal.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="Archive\File_7z.cpp">
+ <Filter>Source Files\Archive</Filter>
+ </ClCompile>
+ <ClCompile Include="Archive\File_Ace.cpp">
+ <Filter>Source Files\Archive</Filter>
+ </ClCompile>
+ <ClCompile Include="Archive\File_Bzip2.cpp">
+ <Filter>Source Files\Archive</Filter>
+ </ClCompile>
+ <ClCompile Include="Archive\File_Elf.cpp">
+ <Filter>Source Files\Archive</Filter>
+ </ClCompile>
+ <ClCompile Include="Archive\File_Gzip.cpp">
+ <Filter>Source Files\Archive</Filter>
+ </ClCompile>
+ <ClCompile Include="Archive\File_Mz.cpp">
+ <Filter>Source Files\Archive</Filter>
+ </ClCompile>
+ <ClCompile Include="Archive\File_Rar.cpp">
+ <Filter>Source Files\Archive</Filter>
+ </ClCompile>
+ <ClCompile Include="Archive\File_Tar.cpp">
+ <Filter>Source Files\Archive</Filter>
+ </ClCompile>
+ <ClCompile Include="Archive\File_Zip.cpp">
+ <Filter>Source Files\Archive</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Aac.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Ac3.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Adif.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Adpcm.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Adts.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Aes3.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Als.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Amr.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Amv.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Ape.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Au.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Dts.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_ExtendedModule.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Flac.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_ImpulseTracker.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_La.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Latm.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Midi.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Module.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Mpc.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_MpcSv8.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Mpeg4_AudioSpecificConfig.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Mpega.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Pcm.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Ps2Audio.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_ScreamTracker3.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Speex.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Tak.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Tta.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_TwinVQ.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Vorbis.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Audio\File_Wvpk.cpp">
+ <Filter>Source Files\Audio</Filter>
+ </ClCompile>
+ <ClCompile Include="Video\File_AfdBarData.cpp">
+ <Filter>Source Files\Video</Filter>
+ </ClCompile>
+ <ClCompile Include="Video\File_Avc.cpp">
+ <Filter>Source Files\Video</Filter>
+ </ClCompile>
+ <ClCompile Include="Video\File_Avc_Duplicate.cpp">
+ <Filter>Source Files\Video</Filter>
+ </ClCompile>
+ <ClCompile Include="Video\File_AvsV.cpp">
+ <Filter>Source Files\Video</Filter>
+ </ClCompile>
+ <ClCompile Include="Video\File_Dirac.cpp">
+ <Filter>Source Files\Video</Filter>
+ </ClCompile>
+ <ClCompile Include="Video\File_Flic.cpp">
+ <Filter>Source Files\Video</Filter>
+ </ClCompile>
+ <ClCompile Include="Video\File_Fraps.cpp">
+ <Filter>Source Files\Video</Filter>
+ </ClCompile>
+ <ClCompile Include="Video\File_Lagarith.cpp">
+ <Filter>Source Files\Video</Filter>
+ </ClCompile>
+ <ClCompile Include="Video\File_Mpeg4v.cpp">
+ <Filter>Source Files\Video</Filter>
+ </ClCompile>
+ <ClCompile Include="Video\File_Mpegv.cpp">
+ <Filter>Source Files\Video</Filter>
+ </ClCompile>
+ <ClCompile Include="Video\File_Theora.cpp">
+ <Filter>Source Files\Video</Filter>
+ </ClCompile>
+ <ClCompile Include="Video\File_Vc1.cpp">
+ <Filter>Source Files\Video</Filter>
+ </ClCompile>
+ <ClCompile Include="Image\File_Bmp.cpp">
+ <Filter>Source Files\Image</Filter>
+ </ClCompile>
+ <ClCompile Include="Image\File_Gif.cpp">
+ <Filter>Source Files\Image</Filter>
+ </ClCompile>
+ <ClCompile Include="Image\File_Ico.cpp">
+ <Filter>Source Files\Image</Filter>
+ </ClCompile>
+ <ClCompile Include="Image\File_Jpeg.cpp">
+ <Filter>Source Files\Image</Filter>
+ </ClCompile>
+ <ClCompile Include="Image\File_Png.cpp">
+ <Filter>Source Files\Image</Filter>
+ </ClCompile>
+ <ClCompile Include="Image\File_Rle.cpp">
+ <Filter>Source Files\Image</Filter>
+ </ClCompile>
+ <ClCompile Include="Image\File_Tiff.cpp">
+ <Filter>Source Files\Image</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Bdmv.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Cdxa.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Dpg.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_DvDif.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_DvDif_Analysis.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Dvdv.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Flv.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Gxf.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Ivf.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Lxf.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Mk.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Mpeg4.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Mpeg4_Descriptors.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Mpeg4_Elements.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Mpeg4_TimeCode.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Mpeg_Descriptors.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Mpeg_Psi.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_MpegPs.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_MpegTs.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_MpegTs_Duplicate.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Mxf.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Nut.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Ogg.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Ogg_SubElement.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_P2_Clip.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Riff.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Riff_Elements.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Rm.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Skm.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Swf.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Umf.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Wm.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Wm_Elements.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Multiple\File_Xdcam_Clip.cpp">
+ <Filter>Source Files\Multiple</Filter>
+ </ClCompile>
+ <ClCompile Include="Text\File_Cdp.cpp">
+ <Filter>Source Files\Text</Filter>
+ </ClCompile>
+ <ClCompile Include="Text\File_Cmml.cpp">
+ <Filter>Source Files\Text</Filter>
+ </ClCompile>
+ <ClCompile Include="Text\File_DtvccTransport.cpp">
+ <Filter>Source Files\Text</Filter>
+ </ClCompile>
+ <ClCompile Include="Text\File_Eia608.cpp">
+ <Filter>Source Files\Text</Filter>
+ </ClCompile>
+ <ClCompile Include="Text\File_Eia708.cpp">
+ <Filter>Source Files\Text</Filter>
+ </ClCompile>
+ <ClCompile Include="Text\File_Kate.cpp">
+ <Filter>Source Files\Text</Filter>
+ </ClCompile>
+ <ClCompile Include="Text\File_N19.cpp">
+ <Filter>Source Files\Text</Filter>
+ </ClCompile>
+ <ClCompile Include="Text\File_OtherText.cpp">
+ <Filter>Source Files\Text</Filter>
+ </ClCompile>
+ <ClCompile Include="Text\File_Pgs.cpp">
+ <Filter>Source Files\Text</Filter>
+ </ClCompile>
+ <ClCompile Include="Text\File_Scte20.cpp">
+ <Filter>Source Files\Text</Filter>
+ </ClCompile>
+ <ClCompile Include="Tag\File__Tags.cpp">
+ <Filter>Source Files\Tag</Filter>
+ </ClCompile>
+ <ClCompile Include="Tag\File_ApeTag.cpp">
+ <Filter>Source Files\Tag</Filter>
+ </ClCompile>
+ <ClCompile Include="Tag\File_Id3.cpp">
+ <Filter>Source Files\Tag</Filter>
+ </ClCompile>
+ <ClCompile Include="Tag\File_Id3v2.cpp">
+ <Filter>Source Files\Tag</Filter>
+ </ClCompile>
+ <ClCompile Include="Tag\File_Lyrics3.cpp">
+ <Filter>Source Files\Tag</Filter>
+ </ClCompile>
+ <ClCompile Include="Tag\File_Lyrics3v2.cpp">
+ <Filter>Source Files\Tag</Filter>
+ </ClCompile>
+ <ClCompile Include="Tag\File_VorbisCom.cpp">
+ <Filter>Source Files\Tag</Filter>
+ </ClCompile>
+ <ClCompile Include="Duplicate\File__Duplicate__Base.cpp">
+ <Filter>Source Files\Duplicate</Filter>
+ </ClCompile>
+ <ClCompile Include="Duplicate\File__Duplicate__Writer.cpp">
+ <Filter>Source Files\Duplicate</Filter>
+ </ClCompile>
+ <ClCompile Include="Duplicate\File__Duplicate_MpegTs.cpp">
+ <Filter>Source Files\Duplicate</Filter>
+ </ClCompile>
+ <ClCompile Include="Reader\Reader_Directory.cpp">
+ <Filter>Source Files\Reader</Filter>
+ </ClCompile>
+ <ClCompile Include="Reader\Reader_File.cpp">
+ <Filter>Source Files\Reader</Filter>
+ </ClCompile>
+ <ClCompile Include="Reader\Reader_libcurl.cpp">
+ <Filter>Source Files\Reader</Filter>
+ </ClCompile>
+ <ClCompile Include="Reader\Reader_libmms.cpp">
+ <Filter>Source Files\Reader</Filter>
+ </ClCompile>
+ <ClCompile Include="Export\Export_Mpeg7.cpp">
+ <Filter>Source Files\Export</Filter>
+ </ClCompile>
+ <ClCompile Include="Export\Export_PBCore.cpp">
+ <Filter>Source Files\Export</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="File__Analyse_Automatic.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="File__Analyze.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="File__Base.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="File__Duplicate.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="File__MultipleParsing.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="File_Dummy.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="File_Other.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="File_Unknown.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="MediaInfo.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="MediaInfo_Config.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="MediaInfo_Config_MediaInfo.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="MediaInfo_Events.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="MediaInfo_Events_Internal.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="MediaInfo_Internal.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="MediaInfo_Internal_Const.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="MediaInfoList.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="MediaInfoList_Internal.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="PreComp.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="Setup.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="Archive\File_7z.h">
+ <Filter>Header Files\Archive</Filter>
+ </ClInclude>
+ <ClInclude Include="Archive\File_Ace.h">
+ <Filter>Header Files\Archive</Filter>
+ </ClInclude>
+ <ClInclude Include="Archive\File_Bzip2.h">
+ <Filter>Header Files\Archive</Filter>
+ </ClInclude>
+ <ClInclude Include="Archive\File_Elf.h">
+ <Filter>Header Files\Archive</Filter>
+ </ClInclude>
+ <ClInclude Include="Archive\File_Gzip.h">
+ <Filter>Header Files\Archive</Filter>
+ </ClInclude>
+ <ClInclude Include="Archive\File_Mz.h">
+ <Filter>Header Files\Archive</Filter>
+ </ClInclude>
+ <ClInclude Include="Archive\File_Rar.h">
+ <Filter>Header Files\Archive</Filter>
+ </ClInclude>
+ <ClInclude Include="Archive\File_Tar.h">
+ <Filter>Header Files\Archive</Filter>
+ </ClInclude>
+ <ClInclude Include="Archive\File_Zip.h">
+ <Filter>Header Files\Archive</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Aac.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Ac3.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Adif.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Adpcm.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Adts.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Aes3.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Als.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Amr.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Amv.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Ape.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Au.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Dirac.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Dts.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_ExtendedModule.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Flac.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_ImpulseTracker.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_La.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Latm.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Midi.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Module.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Mpc.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_MpcSv8.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Mpeg4_AudioSpecificConfig.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Mpega.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Pcm.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Ps2Audio.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_ScreamTracker3.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Speex.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Tak.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Tta.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_TwinVQ.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Vorbis.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Audio\File_Wvpk.h">
+ <Filter>Header Files\Audio</Filter>
+ </ClInclude>
+ <ClInclude Include="Image\File_Bmp.h">
+ <Filter>Header Files\Image</Filter>
+ </ClInclude>
+ <ClInclude Include="Image\File_Gif.h">
+ <Filter>Header Files\Image</Filter>
+ </ClInclude>
+ <ClInclude Include="Image\File_Ico.h">
+ <Filter>Header Files\Image</Filter>
+ </ClInclude>
+ <ClInclude Include="Image\File_Jpeg.h">
+ <Filter>Header Files\Image</Filter>
+ </ClInclude>
+ <ClInclude Include="Image\File_Png.h">
+ <Filter>Header Files\Image</Filter>
+ </ClInclude>
+ <ClInclude Include="Image\File_Rle.h">
+ <Filter>Header Files\Image</Filter>
+ </ClInclude>
+ <ClInclude Include="Image\File_Tiff.h">
+ <Filter>Header Files\Image</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Bdmv.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Cdxa.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Dpg.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_DvDif.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Dvdv.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Flv.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Gxf.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Ivf.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Lxf.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Mk.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Mpeg4.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Mpeg4_TimeCode.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Mpeg_Descriptors.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Mpeg_Psi.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_MpegPs.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_MpegTs.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Mxf.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Nut.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Ogg.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Ogg_SubElement.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_P2_Clip.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Riff.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Rm.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Skm.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Swf.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Umf.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Wm.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Multiple\File_Xdcam_Clip.h">
+ <Filter>Header Files\Multiple</Filter>
+ </ClInclude>
+ <ClInclude Include="Video\File_AfdBarData.h">
+ <Filter>Header Files\Video</Filter>
+ </ClInclude>
+ <ClInclude Include="Video\File_Avc.h">
+ <Filter>Header Files\Video</Filter>
+ </ClInclude>
+ <ClInclude Include="Video\File_AvsV.h">
+ <Filter>Header Files\Video</Filter>
+ </ClInclude>
+ <ClInclude Include="Video\File_Dirac.h">
+ <Filter>Header Files\Video</Filter>
+ </ClInclude>
+ <ClInclude Include="Video\File_Flic.h">
+ <Filter>Header Files\Video</Filter>
+ </ClInclude>
+ <ClInclude Include="Video\File_Fraps.h">
+ <Filter>Header Files\Video</Filter>
+ </ClInclude>
+ <ClInclude Include="Video\File_Lagarith.h">
+ <Filter>Header Files\Video</Filter>
+ </ClInclude>
+ <ClInclude Include="Video\File_Mpeg4v.h">
+ <Filter>Header Files\Video</Filter>
+ </ClInclude>
+ <ClInclude Include="Video\File_Mpegv.h">
+ <Filter>Header Files\Video</Filter>
+ </ClInclude>
+ <ClInclude Include="Video\File_Theora.h">
+ <Filter>Header Files\Video</Filter>
+ </ClInclude>
+ <ClInclude Include="Video\File_Vc1.h">
+ <Filter>Header Files\Video</Filter>
+ </ClInclude>
+ <ClInclude Include="Text\File_Cdp.h">
+ <Filter>Header Files\Text</Filter>
+ </ClInclude>
+ <ClInclude Include="Text\File_Cmml.h">
+ <Filter>Header Files\Text</Filter>
+ </ClInclude>
+ <ClInclude Include="Text\File_DtvccTransport.h">
+ <Filter>Header Files\Text</Filter>
+ </ClInclude>
+ <ClInclude Include="Text\File_Eia608.h">
+ <Filter>Header Files\Text</Filter>
+ </ClInclude>
+ <ClInclude Include="Text\File_Eia708.h">
+ <Filter>Header Files\Text</Filter>
+ </ClInclude>
+ <ClInclude Include="Text\File_Kate.h">
+ <Filter>Header Files\Text</Filter>
+ </ClInclude>
+ <ClInclude Include="Text\File_N19.h">
+ <Filter>Header Files\Text</Filter>
+ </ClInclude>
+ <ClInclude Include="Text\File_OtherText.h">
+ <Filter>Header Files\Text</Filter>
+ </ClInclude>
+ <ClInclude Include="Text\File_Pgs.h">
+ <Filter>Header Files\Text</Filter>
+ </ClInclude>
+ <ClInclude Include="Tag\File__Tags.h">
+ <Filter>Header Files\Tag</Filter>
+ </ClInclude>
+ <ClInclude Include="Tag\File_ApeTag.h">
+ <Filter>Header Files\Tag</Filter>
+ </ClInclude>
+ <ClInclude Include="Tag\File_Id3.h">
+ <Filter>Header Files\Tag</Filter>
+ </ClInclude>
+ <ClInclude Include="Tag\File_Id3v2.h">
+ <Filter>Header Files\Tag</Filter>
+ </ClInclude>
+ <ClInclude Include="Tag\File_Lyrics3.h">
+ <Filter>Header Files\Tag</Filter>
+ </ClInclude>
+ <ClInclude Include="Tag\File_Lyrics3v2.h">
+ <Filter>Header Files\Tag</Filter>
+ </ClInclude>
+ <ClInclude Include="Tag\File_VorbisCom.h">
+ <Filter>Header Files\Tag</Filter>
+ </ClInclude>
+ <ClInclude Include="Duplicate\File__Duplicate__Base.h">
+ <Filter>Header Files\Duplicate</Filter>
+ </ClInclude>
+ <ClInclude Include="Duplicate\File__Duplicate__Writer.h">
+ <Filter>Header Files\Duplicate</Filter>
+ </ClInclude>
+ <ClInclude Include="Duplicate\File__Duplicate_MpegTs.h">
+ <Filter>Header Files\Duplicate</Filter>
+ </ClInclude>
+ <ClInclude Include="Reader\Reader_Directory.h">
+ <Filter>Header Files\Reader</Filter>
+ </ClInclude>
+ <ClInclude Include="Reader\Reader_File.h">
+ <Filter>Header Files\Reader</Filter>
+ </ClInclude>
+ <ClInclude Include="Reader\Reader_libcurl.h">
+ <Filter>Header Files\Reader</Filter>
+ </ClInclude>
+ <ClInclude Include="Reader\Reader_libmms.h">
+ <Filter>Header Files\Reader</Filter>
+ </ClInclude>
+ <ClInclude Include="Export\Export_Mpeg7.h">
+ <Filter>Header Files\Export</Filter>
+ </ClInclude>
+ <ClInclude Include="Export\Export_PBCore.h">
+ <Filter>Header Files\Export</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/src/thirdparty/MediaInfo/MediaInfoList.cpp b/src/thirdparty/MediaInfo/MediaInfoList.cpp
new file mode 100644
index 000000000..a3349d469
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfoList.cpp
@@ -0,0 +1,256 @@
+// MediaInfoList - A list of MediaInfo
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// For user: you can disable or enable it
+//#define MEDIAINFO_DEBUG
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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 <stdio.h>
+ 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 (MediaInfoList_Internal*)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 ((MediaInfoList_Internal*)Internal)->Open(File, Options);
+}
+
+//---------------------------------------------------------------------------
+size_t MediaInfoList::Open_Buffer_Init (int64u File_Size_, int64u File_Offset_)
+{
+ return ((MediaInfoList_Internal*)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 ((MediaInfoList_Internal*)Internal)->Open_Buffer_Continue(FilePos, ToAdd, ToAdd_Size);
+}
+
+//---------------------------------------------------------------------------
+int64u MediaInfoList::Open_Buffer_Continue_GoTo_Get (size_t FilePos)
+{
+ return ((MediaInfoList_Internal*)Internal)->Open_Buffer_Continue_GoTo_Get(FilePos);
+}
+
+//---------------------------------------------------------------------------
+size_t MediaInfoList::Open_Buffer_Finalize (size_t FilePos)
+{
+ return ((MediaInfoList_Internal*)Internal)->Open_Buffer_Finalize(FilePos);
+}
+
+//---------------------------------------------------------------------------
+size_t MediaInfoList::Save(size_t)
+{
+ return 0; //Not yet implemented
+}
+
+//---------------------------------------------------------------------------
+void MediaInfoList::Close(size_t FilePos)
+{
+ ((MediaInfoList_Internal*)Internal)->Close(FilePos);
+}
+
+//***************************************************************************
+// Get File info
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+String MediaInfoList::Inform(size_t FilePos, size_t)
+{
+ return ((MediaInfoList_Internal*)Internal)->Inform(FilePos);
+}
+
+//---------------------------------------------------------------------------
+String MediaInfoList::Get(size_t FilePos, stream_t KindOfStream, size_t StreamNumber, size_t Parameter, info_t KindOfInfo)
+{
+ return ((MediaInfoList_Internal*)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 ((MediaInfoList_Internal*)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 ((MediaInfoList_Internal*)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 ((MediaInfoList_Internal*)Internal)->Set(ToSet, FilePos, StreamKind, StreamNumber, Parameter, OldValue);
+}
+
+//***************************************************************************
+// Output buffer
+//***************************************************************************
+
+/*
+//---------------------------------------------------------------------------
+char* MediaInfoList::Output_Buffer_Get (size_t FilePos, size_t &Output_Buffer_Size)
+{
+ return ((MediaInfoList_Internal*)Internal)->Output_Buffer_Get(FilePos, Output_Buffer_Size);
+}
+*/
+
+//***************************************************************************
+// Information
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+String MediaInfoList::Option (const String &Option, const String &Value)
+{
+ return ((MediaInfoList_Internal*)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 ((MediaInfoList_Internal*)Internal)->State_Get();
+}
+
+//---------------------------------------------------------------------------
+size_t MediaInfoList::Count_Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber)
+{
+ return ((MediaInfoList_Internal*)Internal)->Count_Get(FilePos, StreamKind, StreamNumber);
+}
+
+//---------------------------------------------------------------------------
+size_t MediaInfoList::Count_Get()
+{
+ return ((MediaInfoList_Internal*)Internal)->Count_Get();
+}
+
+} //NameSpace
+
diff --git a/src/thirdparty/MediaInfo/MediaInfoList.h b/src/thirdparty/MediaInfo/MediaInfoList.h
new file mode 100644
index 000000000..0b6f6ac26
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfoList.h
@@ -0,0 +1,225 @@
+// MediaInfoList - A list of MediaInfo
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// MediaInfoList
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
+{
+
+//***************************************************************************
+/// @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
+ /// @retval 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)
+ 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
+ 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
+ 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 suceed
+ 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()
+ 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...)
+ 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 :
+ void* Internal;
+};
+
+} //NameSpace
+#endif
diff --git a/src/thirdparty/MediaInfo/MediaInfoList_Internal.cpp b/src/thirdparty/MediaInfo/MediaInfoList_Internal.cpp
new file mode 100644
index 000000000..a1a75de32
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfoList_Internal.cpp
@@ -0,0 +1,474 @@
+// MediaInfoList_Internal - A list of MediaInfo
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfoList_Internal.h"
+#include "MediaInfo/MediaInfo_Config.h"
+#include "ZenLib/ZtringListList.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<Info.size(); Pos++)
+ Info[Pos]=NULL;
+ ToParse_AlreadyDone=0;
+ ToParse_Total=0;
+
+ //Threading
+ BlockMethod=0;
+ State=0;
+ IsInThread=false;
+}
+
+//---------------------------------------------------------------------------
+//Destructeur
+MediaInfoList_Internal::~MediaInfoList_Internal()
+{
+ Close();
+}
+
+//***************************************************************************
+// Fichiers
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+size_t MediaInfoList_Internal::Open(const String &File_Name, const fileoptions_t Options)
+{
+ //Option FileOption_Close
+ if (Options & FileOption_CloseAll)
+ Close(All);
+
+ //Option Recursive
+ //TODO
+
+ //Get all filenames
+ ZtringList List;
+ if ((File_Name.size()>=7
+ && File_Name[0]==_T('h')
+ && File_Name[1]==_T('t')
+ && File_Name[2]==_T('t')
+ && File_Name[3]==_T('p')
+ && File_Name[4]==_T(':')
+ && File_Name[5]==_T('/')
+ && File_Name[6]==_T('/'))
+ || (File_Name.size()>=6
+ && File_Name[0]==_T('f')
+ && File_Name[1]==_T('t')
+ && File_Name[2]==_T('p')
+ && File_Name[3]==_T(':')
+ && File_Name[4]==_T('/')
+ && File_Name[5]==_T('/'))
+ || (File_Name.size()>=6
+ && File_Name[0]==_T('m')
+ && File_Name[1]==_T('m')
+ && File_Name[2]==_T('s')
+ && File_Name[3]==_T(':')
+ && File_Name[4]==_T('/')
+ && File_Name[5]==_T('/'))
+ || (File_Name.size()>=7
+ && File_Name[0]==_T('m')
+ && File_Name[1]==_T('m')
+ && File_Name[2]==_T('s')
+ && File_Name[3]==_T('h')
+ && File_Name[4]==_T(':')
+ && File_Name[5]==_T('/')
+ && File_Name[6]==_T('/')))
+ List.push_back(File_Name);
+ else if (File::Exists(File_Name))
+ List.push_back(File_Name);
+ else
+ List=Dir::GetAllFileNames(File_Name, (Options&FileOption_NoRecursive)?Dir::Nothing:Dir::Parse_SubDirs);
+
+ Reader_Directory::Directory_Cleanup(List);
+
+ //Registering files
+ CS.Enter();
+ if (ToParse.empty())
+ CountValid=0;
+ for (ZtringList::iterator L=List.begin(); L!=List.end(); L++)
+ ToParse.push(*L);
+ ToParse_Total+=List.size();
+ if (ToParse_Total)
+ State=ToParse_AlreadyDone*10000/ToParse_Total;
+ else
+ State=10000;
+ CS.Leave();
+
+ //Parsing
+ if (BlockMethod==1)
+ {
+ CS.Enter();
+ if (!IsRunning()) //If already created, the routine will read the new files
+ {
+ RunAgain();
+ IsInThread=true;
+ }
+ CS.Leave();
+ return 0;
+ }
+ else
+ {
+ Entry(); //Normal parsing
+ return Count_Get();
+ }
+}
+
+void MediaInfoList_Internal::Entry()
+{
+ if (ToParse_Total==0)
+ return;
+
+ while (1)
+ {
+ CS.Enter();
+ if (!ToParse.empty())
+ {
+ MediaInfo* MI=new MediaInfo();
+ for (std::map<String, String>::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* MI=new MediaInfo();
+ 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);
+}
+
+//---------------------------------------------------------------------------
+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<Info.size(); Pos++)
+ {
+ delete Info[Pos]; Info[Pos]=NULL;
+ }
+ Info.clear();
+ }
+ else if (FilePos<Info.size())
+ {
+ delete Info[FilePos]; Info[FilePos]=NULL;
+ Info.erase(Info.begin()+FilePos);
+ }
+
+ ToParse_AlreadyDone=0;
+ ToParse_Total=0;
+}
+
+//***************************************************************************
+// Get File info
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+String MediaInfoList_Internal::Inform(size_t FilePos, size_t)
+{
+ if (FilePos==Error)
+ {
+ Ztring Retour;
+ FilePos=0;
+ ZtringListList MediaInfo_Custom_View; MediaInfo_Custom_View.Write(Option(_T("Inform_Get")));
+ bool XML=false;
+ if (MediaInfoLib::Config.Inform_Get()==_T("XML"))
+ XML=true;
+ if (XML) Retour+=_T("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")+MediaInfoLib::Config.LineSeparator_Get()+_T("<Mediainfo version=\"")+MediaInfoLib::Config.Info_Version_Get().SubString(_T(" v"), Ztring())+_T("\">")+MediaInfoLib::Config.LineSeparator_Get();
+ else Retour+=MediaInfo_Custom_View(Stream_Max+2, 1);//Page_Begin
+ while (FilePos<Info.size())
+ {
+ Retour+=Inform(FilePos);
+ if (FilePos<Info.size()-1)
+ {
+ Retour+=MediaInfo_Custom_View(Stream_Max+3, 1);//Page_Middle
+ }
+ FilePos++;
+ }
+ if (XML) Retour+=_T("</Mediainfo>")+MediaInfoLib::Config.LineSeparator_Get();
+ else Retour+=MediaInfo_Custom_View(Stream_Max+4, 1);//Page_End
+ //Retour.FindAndReplace(_T("\\n"),_T( "\n"), 0, Ztring_Recursive);
+ 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();
+
+ 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; Pos<Info.size(); Pos++)
+ if (Info[Pos])
+ Info[Pos]->Option(_T("language_update"), Value);
+
+ return _T("");
+ }
+ else if (OptionLower==_T("create_dummy"))
+ {
+ Info.resize(Info.size()+1);
+ Info[Info.size()-1]=new MediaInfo();
+ 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
+
diff --git a/src/thirdparty/MediaInfo/MediaInfoList_Internal.h b/src/thirdparty/MediaInfo/MediaInfoList_Internal.h
new file mode 100644
index 000000000..45d514d29
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfoList_Internal.h
@@ -0,0 +1,96 @@
+// MediaInfoList_Internal - A list of MediaInfo
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// MediaInfoList_Internal
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Give information about a lot of media files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfoList_InternalH
+#define MediaInfoList_InternalH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/MediaInfo.h"
+#include "MediaInfo/MediaInfo_Config_MediaInfo.h"
+#include "ZenLib/Thread.h"
+#include "ZenLib/CriticalSection.h"
+#include <vector>
+#include <queue>
+//---------------------------------------------------------------------------
+
+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<MediaInfo*> Info;
+ std::queue<String> ToParse;
+ std::map<String, String> 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
diff --git a/src/thirdparty/MediaInfo/MediaInfo_Config.cpp b/src/thirdparty/MediaInfo/MediaInfo_Config.cpp
new file mode 100644
index 000000000..e97fff5c2
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfo_Config.cpp
@@ -0,0 +1,1507 @@
+// MediaInfo_Config - Configuration class
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Global configuration of MediaInfo
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+#include "MediaInfo/MediaInfo_Config.h"
+#include "ZenLib/ZtringListListF.h"
+#include "ZenLib/File.h"
+#include <algorithm>
+#include <iostream>
+using namespace ZenLib;
+using namespace std;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//---------------------------------------------------------------------------
+const Char* MediaInfo_Version=_T("MediaInfoLib - v0.7.34");
+const Char* MediaInfo_Url=_T("http://mediainfo.sourceforge.net");
+ 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_Chapters (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;
+ MpegTs_MaximumOffset=16*1024*1024;
+ 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;
+ DetailsLevel=(float32)0.0;
+ DetailsFormat=DetailsFormat_Tree;
+ Language_Raw=false;
+ ReadByHuman=true;
+ Demux=0;
+ LineSeparator=EOL;
+ ColumnSeparator=_T(";");
+ TagSeparator=_T(" / ");
+ Quote=_T("\"");
+ DecimalPoint=_T(".");
+ ThousandsPoint=Ztring();
+
+ CS.Leave();
+
+ ZtringListList ZLL1; Language_Set(ZLL1);
+}
+
+//***************************************************************************
+// Info
+//***************************************************************************
+
+Ztring MediaInfo_Config::Option (const String &Option, const String &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("demux"))
+ {
+ if (Value.empty())
+ Demux_Set(0);
+ else if (Value==_T("all"))
+ Demux_Set(2);
+ else
+ Demux_Set(1);
+ return Ztring();
+ }
+ else if (Option_Lower==_T("demux_unpacketize"))
+ {
+ if (Value.empty())
+ Demux_Unpacketize_Set(false);
+ else
+ Demux_Unpacketize_Set(true);
+ return Ztring();
+ }
+ else if (Option_Lower==_T("internet_get"))
+ {
+ if (Internet_Get())
+ return _T("1");
+ else
+ 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("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("inform_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_Replace_Get();
+ }
+ else if (Option_Lower==_T("details")) //Legacy for detailslevel
+ {
+ DetailsLevel_Set(Value.To_float32());
+ return Ztring();
+ }
+ else if (Option_Lower==_T("details_get")) //Legacy for detailslevel
+ {
+ return Ztring::ToZtring(DetailsLevel_Get());
+ }
+ else if (Option_Lower==_T("detailslevel"))
+ {
+ DetailsLevel_Set(Value.To_float32());
+ return Ztring();
+ }
+ else if (Option_Lower==_T("detailslevel_get"))
+ {
+ return Ztring::ToZtring(DetailsLevel_Get());
+ }
+ else if (Option_Lower==_T("detailsformat"))
+ {
+ 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"))
+ DetailsFormat_Set(DetailsFormat_CSV);
+ else
+ DetailsFormat_Set(DetailsFormat_Tree);
+ return Ztring();
+ }
+ else if (Option_Lower==_T("detailsformat_get"))
+ {
+ switch (DetailsFormat_Get())
+ {
+ case DetailsFormat_CSV : return _T("CSV");
+ default : return _T("Tree");
+ }
+ }
+ else if (Option_Lower==_T("detailsmodificator"))
+ {
+ DetailsModificator_Set(Value);
+ return Ztring();
+ }
+ else if (Option_Lower==_T("detailsmodificator_get"))
+ {
+ return DetailsModificator_Get(Value);
+ }
+ else if (Option_Lower==_T("info_parameters"))
+ {
+ ZtringListList ToReturn=Info_Parameters_Get();
+
+ //Adapt first column
+ for (size_t Pos=0; Pos<ToReturn.size(); Pos++)
+ {
+ Ztring &C1=ToReturn(Pos, 0);
+ if (!ToReturn(Pos, 1).empty())
+ {
+ C1.resize(25, ' ');
+ ToReturn(Pos, 0)=C1 + _T(" :");
+ }
+ }
+
+ ToReturn.Separator_Set(0, LineSeparator_Get());
+ ToReturn.Separator_Set(1, _T(" "));
+ ToReturn.Quote_Set(Ztring());
+ return ToReturn.Read();
+ }
+ else if (Option_Lower==_T("info_parameters_csv"))
+ {
+ return Info_Parameters_Get();
+ }
+ else if (Option_Lower==_T("info_codecs"))
+ {
+ return Info_Codecs_Get();
+ }
+ else if (Option_Lower==_T("info_version"))
+ {
+ return Info_Version_Get();
+ }
+ else if (Option_Lower==_T("info_url"))
+ {
+ return Info_Url_Get();
+ }
+ else if (Option_Lower==_T("formatdetection_maximumoffset"))
+ {
+ FormatDetection_MaximumOffset_Set(Value==_T("-1")?(int64u)-1:((Ztring*)&Value)->To_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("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
+ 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<NewShowFiles.size(); Pos++)
+ {
+ const Ztring& Object=NewShowFiles.Read(Pos, 0);
+ if (Object==_T("Nothing"))
+ ShowFiles_Nothing=NewShowFiles.Read(Pos, 1).empty()?1:0;
+ else if (Object==_T("VideoAudio"))
+ ShowFiles_VideoAudio=NewShowFiles.Read(Pos, 1).empty()?1:0;
+ else if (Object==_T("VideoOnly"))
+ ShowFiles_VideoOnly=NewShowFiles.Read(Pos, 1).empty()?1:0;
+ else if (Object==_T("AudioOnly"))
+ ShowFiles_AudioOnly=NewShowFiles.Read(Pos, 1).empty()?1:0;
+ else if (Object==_T("TextOnly"))
+ ShowFiles_TextOnly=NewShowFiles.Read(Pos, 1).empty()?1:0;
+ }
+}
+
+size_t MediaInfo_Config::ShowFiles_Nothing_Get ()
+{
+ CriticalSectionLocker CSL(CS);
+ return ShowFiles_Nothing;
+}
+
+size_t MediaInfo_Config::ShowFiles_VideoAudio_Get ()
+{
+ CriticalSectionLocker CSL(CS);
+ return ShowFiles_VideoAudio;
+}
+
+size_t MediaInfo_Config::ShowFiles_VideoOnly_Get ()
+{
+ CriticalSectionLocker CSL(CS);
+ return ShowFiles_VideoOnly;
+}
+
+size_t MediaInfo_Config::ShowFiles_AudioOnly_Get ()
+{
+ CriticalSectionLocker CSL(CS);
+ return ShowFiles_AudioOnly;
+}
+
+size_t MediaInfo_Config::ShowFiles_TextOnly_Get ()
+{
+ CriticalSectionLocker CSL(CS);
+ return ShowFiles_TextOnly;
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config::ParseSpeed_Set (float32 NewValue)
+{
+ CriticalSectionLocker CSL(CS);
+ ParseSpeed=NewValue;
+}
+
+float32 MediaInfo_Config::ParseSpeed_Get ()
+{
+ CriticalSectionLocker CSL(CS);
+ return ParseSpeed;
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config::Verbosity_Set (float32 NewValue)
+{
+ CriticalSectionLocker CSL(CS);
+ Verbosity=NewValue;
+}
+
+float32 MediaInfo_Config::Verbosity_Get ()
+{
+ CriticalSectionLocker CSL(CS);
+ return Verbosity;
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config::ReadByHuman_Set (bool NewValue)
+{
+ CriticalSectionLocker CSL(CS);
+ ReadByHuman=NewValue;
+}
+
+bool MediaInfo_Config::ReadByHuman_Get ()
+{
+ CriticalSectionLocker CSL(CS);
+ return ReadByHuman;
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config::DetailsLevel_Set (float NewValue)
+{
+ CriticalSectionLocker CSL(CS);
+ DetailsLevel=NewValue;
+}
+
+float32 MediaInfo_Config::DetailsLevel_Get ()
+{
+ CriticalSectionLocker CSL(CS);
+ return DetailsLevel;
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config::DetailsFormat_Set (detailsFormat NewValue)
+{
+ CriticalSectionLocker CSL(CS);
+ DetailsFormat=NewValue;
+}
+
+MediaInfo_Config::detailsFormat MediaInfo_Config::DetailsFormat_Get ()
+{
+ CriticalSectionLocker CSL(CS);
+ return DetailsFormat;
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config::DetailsModificator_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);
+ DetailsModificators[List[0]]=List[1]==_T("1");
+}
+
+Ztring MediaInfo_Config::DetailsModificator_Get (const Ztring &Value)
+{
+ CriticalSectionLocker CSL(CS);
+ std::map<Ztring, bool>::iterator ToReturn=DetailsModificators.find(Value);
+ if (ToReturn!=DetailsModificators.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::Demux_Unpacketize_Set (bool NewValue)
+{
+ CriticalSectionLocker CSL(CS);
+ Demux_Unpacketize=NewValue;
+}
+
+bool MediaInfo_Config::Demux_Unpacketize_Get ()
+{
+ CriticalSectionLocker CSL(CS);
+ return Demux_Unpacketize;
+}
+
+//---------------------------------------------------------------------------
+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<NewValue.size(); Pos++)
+ if (NewValue[Pos].size()>=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<Stream_Max; StreamKind++)
+ if (!Info[StreamKind].empty())
+ Language_Set((stream_t)StreamKind);
+}
+
+void MediaInfo_Config::Language_Set (stream_t StreamKind)
+{
+ //CriticalSectionLocker CSL(CS); //No, only used internaly
+
+ //Fill Info
+ for (size_t Pos=0; Pos<Info[StreamKind].size(); Pos++)
+ {
+ //Strings - Info_Name_Text
+ Ztring ToReplace=Info[StreamKind](Pos, Info_Name);
+ if (!Language_Raw && ToReplace.find(_T("/String"))!=Error)
+ {
+ ToReplace.FindAndReplace(_T("/String1"), Ztring());
+ ToReplace.FindAndReplace(_T("/String2"), Ztring());
+ ToReplace.FindAndReplace(_T("/String3"), Ztring());
+ ToReplace.FindAndReplace(_T("/String4"), Ztring());
+ ToReplace.FindAndReplace(_T("/String5"), Ztring());
+ ToReplace.FindAndReplace(_T("/String6"), Ztring());
+ ToReplace.FindAndReplace(_T("/String7"), Ztring());
+ ToReplace.FindAndReplace(_T("/String8"), Ztring());
+ ToReplace.FindAndReplace(_T("/String9"), Ztring());
+ ToReplace.FindAndReplace(_T("/String"), Ztring());
+ }
+ if (!Language_Raw && ToReplace.find(_T("/"))!=Error) //Complex values, like XXX/YYY --> 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<List.size(); Pos++)
+ List[Pos]=Language.Get(List[Pos]);
+
+ return List.Read();
+}
+
+//---------------------------------------------------------------------------
+Ztring MediaInfo_Config::Language_Get (const Ztring &Count, const Ztring &Value, bool ValueIsAlwaysSame)
+{
+ //Integrity
+ if (Count.empty())
+ return EmptyString_Get();
+
+ //Different Plurals are available or not?
+ if (Language_Get(Value+_T("1")).empty())
+ {
+ //if (Count==_T("0") || Count==_T("1"))
+ return Count+Language_Get(Value);
+ //else
+ //return Count+Language_Get(Value+_T("s"));
+ }
+
+ //Detecting plural form for multiple plurals
+ int8u Form=(int8u)-1;
+
+ if (!ValueIsAlwaysSame)
+ {
+ //Polish has 2 plurial, Algorithm of Polish
+ size_t CountI=Count.To_int32u();
+ size_t Pos3=CountI/100;
+ int8u Pos2=(int8u)((CountI-Pos3)/10);
+ int8u Pos1=(int8u)(CountI-Pos3*100-Pos2*10);
+ if (Pos3==0)
+ {
+ if (Pos2==0)
+ {
+ if (Pos1==0 && Count.size()==1) //Only "0", not "0.xxx"
+ Form=0; //000 to 000 kanal?
+ else if (Pos1<=1)
+ Form=1; //001 to 001 kanal
+ else if (Pos1<=4)
+ Form=2; //002 to 004 kanaly
+ else //if (Pos1>=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"))
+ DetailsLevel_Set(NewValue.Read(0, 1).To_float32());
+ else
+ {
+ DetailsLevel_Set(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; Pos<Custom_View.size(); Pos++)
+ {
+ if (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<NewValue_Replace.size(); Pos++)
+ {
+ if (NewValue_Replace[Pos].size()==2)
+ Custom_View_Replace(NewValue_Replace[Pos][0])=NewValue_Replace[Pos][1];
+ }
+}
+
+Ztring MediaInfo_Config::Inform_Replace_Get ()
+{
+ CriticalSectionLocker CSL(CS);
+ return Custom_View.Read();
+}
+
+ZtringListList MediaInfo_Config::Inform_Replace_Get_All ()
+{
+ CriticalSectionLocker CSL(CS);
+ return Custom_View_Replace;
+}
+
+//---------------------------------------------------------------------------
+const Ztring &MediaInfo_Config::Format_Get (const Ztring &Value, infoformat_t KindOfFormatInfo)
+{
+ //Loading codec table if not yet done
+ CS.Enter();
+ if (Format.empty())
+ MediaInfo_Config_Format(Format);
+ CS.Leave();
+
+ return Format.Get(Value, KindOfFormatInfo);
+}
+
+//---------------------------------------------------------------------------
+InfoMap &MediaInfo_Config::Format_Get ()
+{
+ //Loading codec table if not yet done
+ CS.Enter();
+ if (Format.empty())
+ MediaInfo_Config_Format(Format);
+ CS.Leave();
+
+ return Format;
+}
+
+//---------------------------------------------------------------------------
+const Ztring &MediaInfo_Config::Codec_Get (const Ztring &Value, infocodec_t KindOfCodecInfo)
+{
+ //Loading codec table if not yet done
+ CS.Enter();
+ if (Codec.empty())
+ MediaInfo_Config_Codec(Codec);
+ CS.Leave();
+
+ return Codec.Get(Value, KindOfCodecInfo);
+}
+
+//---------------------------------------------------------------------------
+const Ztring &MediaInfo_Config::Codec_Get (const Ztring &Value, infocodec_t KindOfCodecInfo, stream_t KindOfStream)
+{
+ //Loading codec table if not yet done
+ CS.Enter();
+ if (Codec.empty())
+ MediaInfo_Config_Codec(Codec);
+ CS.Leave();
+
+ //Transform to text
+ Ztring KindOfStreamS;
+ switch (KindOfStream)
+ {
+ case Stream_General : KindOfStreamS=_T("G"); break;
+ case Stream_Video : KindOfStreamS=_T("V"); break;
+ case Stream_Audio : KindOfStreamS=_T("A"); break;
+ case Stream_Text : KindOfStreamS=_T("T"); break;
+ case Stream_Image : KindOfStreamS=_T("I"); break;
+ case Stream_Chapters : KindOfStreamS=_T("C"); break;
+ case Stream_Menu : KindOfStreamS=_T("M"); break;
+ case Stream_Max : KindOfStreamS=_T(" "); break;
+ }
+
+ return Codec.Get(Value, KindOfCodecInfo, KindOfStreamS, InfoCodec_KindOfStream);
+}
+
+//---------------------------------------------------------------------------
+const Ztring &MediaInfo_Config::CodecID_Get (stream_t KindOfStream, infocodecid_format_t Format, const Ztring &Value, infocodecid_t KindOfCodecIDInfo)
+{
+ if (Format>=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_Chapters : MediaInfo_Config_Chapters(Info[Stream_Chapters]); Language_Set(Stream_Chapters); 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_Chapters : MediaInfo_Config_Chapters(Info[Stream_Chapters]); Language_Set(Stream_Chapters); 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_Chapters : MediaInfo_Config_Chapters(Info[Stream_Chapters]); Language_Set(Stream_Chapters); 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 ()
+{
+ 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_Chapters(Info[Stream_Chapters]);
+ 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; StreamKind<Stream_Max; StreamKind++)
+ {
+ ToReturn(ToReturn_Pos, 0)=Info[StreamKind].Read(_T("StreamKind"), Info_Text);
+ ToReturn_Pos++;
+ for (size_t Pos=0; Pos<Info[StreamKind].size(); Pos++)
+ if (!Info[StreamKind].Read(Pos, Info_Name).empty())
+ {
+ ToReturn(ToReturn_Pos, 0)=Info[StreamKind].Read(Pos, Info_Name);
+ ToReturn(ToReturn_Pos, 1)=Info[StreamKind].Read(Pos, Info_Info);
+ ToReturn_Pos++;
+ }
+ ToReturn_Pos++;
+ }
+ return ToReturn.Read();
+}
+
+//---------------------------------------------------------------------------
+Ztring MediaInfo_Config::Info_Tags_Get () const
+{
+ return Ztring();
+}
+
+Ztring MediaInfo_Config::Info_Codecs_Get ()
+{
+ CriticalSectionLocker CSL(CS);
+
+ //Loading
+ MediaInfo_Config_Codec(Codec);
+
+ //Building
+ Ztring ToReturn;
+ InfoMap::iterator Temp=Codec.begin();
+ while (Temp!=Codec.end())
+ {
+ ToReturn+=Temp->second.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;
+}
+
+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;
+}
+
+} //NameSpace
+
diff --git a/src/thirdparty/MediaInfo/MediaInfo_Config.h b/src/thirdparty/MediaInfo/MediaInfo_Config.h
new file mode 100644
index 000000000..37cde04dd
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfo_Config.h
@@ -0,0 +1,229 @@
+// MediaInfo_Config - Configuration class
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Global configuration of MediaInfo
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_ConfigH
+#define MediaInfo_ConfigH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/MediaInfo_Internal_Const.h"
+#include "ZenLib/CriticalSection.h"
+#include "ZenLib/ZtringListList.h"
+#include "ZenLib/Translation.h"
+#include "ZenLib/InfoMap.h"
+#include <map>
+#include <vector>
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class MediaInfo_Config
+//***************************************************************************
+
+class MediaInfo_Config
+{
+public :
+ //Constructor/Destructor
+ 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 ParseSpeed_Set (float32 NewValue);
+ float32 ParseSpeed_Get ();
+
+ void Verbosity_Set (float32 NewValue);
+ float32 Verbosity_Get ();
+
+ void DetailsLevel_Set (float32 NewValue);
+ float32 DetailsLevel_Get ();
+
+ enum detailsFormat
+ {
+ DetailsFormat_Tree,
+ DetailsFormat_CSV,
+ };
+ void DetailsFormat_Set (detailsFormat NewValue);
+ detailsFormat DetailsFormat_Get ();
+
+ void DetailsModificator_Set (const ZtringList &NewModifcator);
+ Ztring DetailsModificator_Get (const Ztring &Modificator);
+
+ void Demux_Set (int8u NewValue);
+ int8u Demux_Get ();
+ void Demux_Unpacketize_Set (bool NewValue);
+ bool Demux_Unpacketize_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);
+ Ztring Inform_Replace_Get ();
+ 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 ();
+ 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 ();
+
+ void MpegTs_MaximumOffset_Set (int64u Value);
+ int64u MpegTs_MaximumOffset_Get ();
+
+private :
+ int64u FormatDetection_MaximumOffset;
+ int64u MpegTs_MaximumOffset;
+ 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 DetailsLevel;
+ bool Language_Raw;
+ bool ReadByHuman;
+ int8u Demux;
+ bool Demux_Unpacketize;
+ 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", "Chapters", "Image"
+ ZtringListList Custom_View_Replace; //ToReplace;ReplaceBy
+ detailsFormat DetailsFormat;
+ std::map<Ztring, bool> DetailsModificators; //If we want to add/remove some details
+
+ 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
+
+ ZenLib::CriticalSection CS;
+
+ void Language_Set (stream_t StreamKind);
+};
+
+extern MediaInfo_Config Config;
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/MediaInfo_Config_Automatic.cpp b/src/thirdparty/MediaInfo/MediaInfo_Config_Automatic.cpp
new file mode 100644
index 000000000..842dd3e9e
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfo_Config_Automatic.cpp
@@ -0,0 +1,5158 @@
+// Helpers - Automaticly generated methods for MediaInfo
+// Copyright (C) 2005-2007 Jerome Martinez, Zen@MediaArea.net
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Automaticly generated methods for MediaInfo
+// Don't modify, this will be deleted at the next automatic update
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#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;Zen@mediaarea.net\n"
+ " Author_Name;Zen\n"
+ " Author_OldNames;Initial translator\n"
+ " Language_Name;English\n"
+ " Config_Text_ColumnSize;32\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"
+ " milisecond1; milisecond\n"
+ " milisecond2; miliseconds\n"
+ " milisecond3; miliseconds\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"
+ "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"
+ "Bits-(Pixel*Frame);Bits/(Pixel*Frame)\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"
+ "CompleteName;Complete name\n"
+ "Composer;Composer\n"
+ "CompressionRatio;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"
+ "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 study\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 study (with all folders recursively)\n"
+ "Folder (Recursively);Folder (Recursively)\n"
+ "Folder_Hint;Select a folder to study\n"
+ "FolderName;Folder name\n"
+ "Format;Format\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;AlternRock\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\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;Psychadelic\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;Bebob\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 capella\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;Negerpunk\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;Trash Metal\n"
+ "Genre_145;Anime\n"
+ "Genre_146;JPop\n"
+ "Genre_147;Synthpop\n"
+ "Go to WebSite;Go to website\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"
+ "Interleave_Duration;Interleave, duration\n"
+ "Interleave_Preload;Interleave, preload duration\n"
+ "Interleave_VideoFrames;Interleave, duration\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;Supply very detailled information\r\nabout a multimedia file:\r\nMatroska, OGG (including OGM)\r\nMPEG1 (including VCD)\r\nMPEG2 (including DVD and SVCD)\r\nMPEG4 (including Itunes M4A)\r\nQuicktime\r\nRealMedia\r\nWindowsMedia (including WMV, WMA)\r\nMicrosoft RIFF (including AVI, WAV)\r\nSound-only formats (AC3, DTS, AAC, AU, AIFF...)\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"
+ "ScanOrder;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;Shell extension (in Explorer, right click there will be a MediaInfo option)\n"
+ "Shell extension, folder;For folders too\n"
+ "Shell InfoTip;Shell InfoTip (in 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"
+ "SoundEngineer;Sound engineer\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_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"
+ "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"
+ "Unknown;Unknown\n"
+ "Url;Url\n"
+ "Video;Video\n"
+ "Video stream(s);Video stream(s)\n"
+ "Video_Codec_List;Codecs Video\n"
+ "Video_Delay;Video delay\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://mediainfo.sourceforge.net\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(
+ "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"
+ "CDXA;;;M;Cdxa;;dat\n"
+ "DV;;;M;DvdDif;;dv dif;video/DV\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"
+ "Google Video;;;M;Riff;Hack of AVI;gvi;;http://video.google.com/playerdownload.html\n"
+ "LXF;;;M;Lxf;;lxf;video/lxf\n"
+ "Matroska;;;M;Mk;;mkv 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 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;video/ogg;http://www.free-codecs.com/Ogg_DirectShow_Filters_download.htm\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/\n"
+ "Dirac;;;V;Dirac;;drc;;http://diracvideo.org/\n"
+ "FLC;;;V;Flic;;fli flc;;http://www.chem.nott.ac.uk/flc.html\n"
+ "FLI;;;V;Flic;;fli flc;;http://www.chem.nott.ac.uk/flc.html\n"
+ "FLIC;;;V;Flic;;fli flc;;http://www.chem.nott.ac.uk/flc.html\n"
+ "H.261;;;V;;;h261;video/H261\n"
+ "H.263;;;V;;;h263;video/H263\n"
+ "M-JPEG;;;V;;;;video/JPEG\n"
+ "M-JPEG 2000;;;V;;;;video/MJ2\n"
+ "MPEG Video;;;V;Mpegv;;mpgv mpv mp1v m1v mp2v m2v;video/MPV\n"
+ "MPEG-4 Visual;;;V;Mpeg4;;m4v mp4v;video/MP4V-ES\n"
+ "Theora;;;V\n"
+ "VC-1;;;V;Vc1;;vc1;video/vc1\n"
+ "VP8;;;V;;;;;http://www.webmproject.org/\n"
+ "AAC;;;A;;Advanced Audio Codec;aac\n"
+ "AC-3;;;A;Ac3;Audio Coding 3;ac3\n"
+ "ADIF;;;A;Adif;Audio Data Interchange Format;aac\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\n"
+ "AMR;;;A;Amr;Adaptive Multi-Rate;amr;audio/AMR;http://www.apple.com/quicktime/download/standalone.html\n"
+ "Atrac;;;A;;;;audio/ATRAC\n"
+ "Atrac3;;;A;;;;audio/ATRAC3\n"
+ "AU;;;A;Au;uLaw/AU Audio File;au;audio/basic\n"
+ "DTS;;;A;Dts;Digital Theater Systems;dts\n"
+ "DTS-HD;;;A;Dts;Digital Theater Systems;dts\n"
+ "E-AC-3;;;A;Ac3;Audio Coding 3;dd+;audio/eac3\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\n"
+ "G.722;;;A;;;;audio/G722\n"
+ "G.722.1;;;A;;;;audio/G7221\n"
+ "G.723;;;A;;;;audio/G723\n"
+ "G.729;;;A;;;;audio/G729\n"
+ "G.729.1;;;A;;;;audio/G7291\n"
+ "Impulse Tracker;;;A;ImpulseTracker;;it\n"
+ "LA;;;A;La;Lossless Audio Codec;la;;http://www.lossless-audio.com/\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/\n"
+ "MPEG Audio;;;A;Mpega;;m1a mpa1 mp1 m2a mpa2 mp2 mp3;audio/mpeg\n"
+ "Musepack SV7;;;A;Mpc;;mpc;;http://www.musepack.net\n"
+ "Musepack SV8;;;A;Mpc;;mp+;;http://www.musepack.net\n"
+ "QCELP;;;A;;;;audio/QCELP\n"
+ "RIFF-MIDI;;;A;Riff;RIFF Musical Instrument Digital Interface\n"
+ "Scream Tracker 3;;;A;S3m;;s3m\n"
+ "Shorten;;;A;;;shn;;http://etree.org/shnutils/shorten/\n"
+ "SLS;;;A;;MPEG-4 Scalable Lossless Coding;sls;;http://www.chiariglione.org/mpeg/technologies/mp04-sls/index.htm\n"
+ "Speex;;;A;;;;audio/speex\n"
+ "TAK;;;A;;;tak;;http://thbeck.de/Tak/Tak.html\n"
+ "TrueHD;;;A;Ac3;;dts\n"
+ "TwinVQ;;;A;TwinVQ;Transform domain Weighted INterleave Vector Quantization;vqf;;http://www.twinvq.org/english/index_en.html\n"
+ "Vorbis;;;A;;;;audio/vorbis\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\n"
+ "DIB;;;I;Riff;RIFF Device Independent Bitmap\n"
+ "GIF;;;I;Gif;Graphics Interchange Format;gif;image/gif\n"
+ "ICO;;;I;Ico;;ico;image/vnd.microsoft.icon\n"
+ "JNG;;;I;Jng;JPEG Network Graphic;jng\n"
+ "JPEG;;;I;Jpeg;;jpeg jpg jpe;image/jpeg\n"
+ "JPEG2000;;;I;Jpeg;;jp2;image/jp2;http://www.morgan-multimedia.com/JPEG2000/\n"
+ "LZ77;;;I\n"
+ "MNG;;;I;Mng;Multiple-Image Network Graphic;mng\n"
+ "PNG;;;I;Png;Portable Network Graphic;png;image/png\n"
+ "RIFF Palette;;;I;Riff;RIFF Palette\n"
+ "RLE;;;I;;Run-length encoding;rle\n"
+ "TIFF;;;I;Tiff;;tiff tif;image/tiff\n"
+ "7-Zip;;;C;7z;;7z;;http://7-zip.org\n"
+ "ACE;;;C;Ace;;ace;;http://winace.com\n"
+ "ELF;;;C;Elf;;so\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/\n"
+ "AQTitle;;;T;Other;;aqt;;http://www.volny.cz/aberka/czech/aqt.html\n"
+ "ASS;;;T;Other;;ssa;;http://ffdshow.sourceforge.net/tikiwiki/tiki-index.php?page=Getting+ffdshow\n"
+ "Captions 32;;;T;Other;;txt\n"
+ "Captions Inc;;;T;Other;;txt\n"
+ "CPC Captioning;;;T;Other;;txt;;http://www.cpcweb.com/Captioning/cap_software.htm\n"
+ "Cheeta;;;T;Other;;asc\n"
+ "SSA;;;T;Other;;ssa;;http://ffdshow.sourceforge.net/tikiwiki/tiki-index.php?page=Getting+ffdshow\n"
+ "SubRip;;;T;Other;;srt;;http://ffdshow.sourceforge.net/tikiwiki/tiki-index.php?page=Getting+ffdshow\n"
+ "Blender;;;O;Other;;blenders;;http://www.blender3d.com\n"
+ "AutoCAD;;;O;Other;;;;http://www.autodesk.com\n"
+ "N19;;;T;N19;;stl\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"
+ "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"
+ "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"
+ "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 AAC 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_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_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"
+ ));
+ 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"
+ "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;HQ;;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n"
+ "apcn;ProRes;;;http://www.apple.com/quicktime/download/standalone.html;;;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"
+ "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"
+ "avr ;M-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"
+ "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"
+ "h261;H.261;;;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"
+ "HD10;Digital Voodoo;;Digital Voodoo 10 bit Uncompressed 4:2:2 HD codec;http://www.digitalvoodoo.net/\n"
+ "hdv3;DV;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:2\n"
+ "icod;Intermediate Codec;Apple;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "j420;YUV;;;;;;YUV;4:2:0\n"
+ "jpeg;M-JPEG;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "kpcd;Photo CD\n"
+ "M105;Matrox;;;http://www.matrox.com/\n"
+ "mjp2;M-JPEG 2000\n"
+ "mjpa;M-JPEG\n"
+ "mjpb;M-JPEG\n"
+ "mp4v;MPEG-4 Visual\n"
+ "mx3n;MPEG Video\n"
+ "mx3p;MPEG Video\n"
+ "myuv;YUV;;;;;;YUV;4:2:0\n"
+ "ovc1;VC-1;;Smooth Streaming Media Video;http://alexzambelli.com/blog/2009/02/10/smooth-streaming-architecture/\n"
+ "png ;M-PNG\n"
+ "PNTG;MacPaint;;Apple MacPaint image format;http://www.apple.com/quicktime/download/standalone.html\n"
+ "rle ;RLE;;;http://www.apple.com/quicktime/download/standalone.html\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"
+ "WRLE;Bitmap;;Windows BMP image format;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xd50;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xd51;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xd52;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xd53;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xd54;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xd55;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xd56;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xd57;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xd58;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xd59;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xd5a;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xd5b;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xd5c;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xd5d;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xd5e;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xd5f;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xdv0;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xdv1;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xdv2;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xdv3;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xdv4;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xdv5;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xdv6;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xdv7;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xdv8;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xdv9;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xdva;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xdvb;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xdvc;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xdvd;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xdve;MPEG Video;XDCAM;;http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "xdvf;MPEG Video;XDCAM;;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;M-JPEG;;;;;;YUV;4:2:0\n"
+ " PNG;M-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;M-JPEG;Avid;;;;;YUV;4:2:0\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;Wavelet;CineForm HD;;http://www.cineform.com/products/ConnectHD.htm\n"
+ "AJPG;M-JPEG;;22fps for digital cameras;;;;YUV;4:2:0\n"
+ "ALPH;Ziracom;;Ziracom Digital Communications Inc.\n"
+ "AMPG;MPEG-1;VideoONE;;http://www.array.com;;;YUV;4:2:0\n"
+ "AMR ;AMR;;Speech codec\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;M-JPEG;Avid;;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe;;;YUV;4:2:0\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;M-JPEG;MainConcept;;;;;YUV;4:2:0\n"
+ "AVI2;M-JPEG;MainConcept;;;;;YUV;4:2:0\n"
+ "AVID;M-JPEG;Avid;;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe;;;YUV;4:2:0\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 ;M-JPEG;Avid NuVista;Avid ABVB/NuVista M-JPEG with Alpha-channel;;;;YUV;4:2:0\n"
+ "AVRn;M-JPEG;Avid M-JPEG;;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe;;;YUV;4:2:0\n"
+ "AVRN;M-JPEG;Avid M-JPEG;;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe;;;YUV;4:2:0\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;M-JPEG;DPS Perception;Dummy format - only AVI header;;;;YUV;4:2:0\n"
+ "CFHD;CineForm HD;;CineForm 10-bit Visually Perfect HD (Wavelet)\n"
+ "CGDI;Camcorder;;Camcorder Video (MS Office 97)\n"
+ "CHAM;Champagne;;Winnov Caviara Champagne\n"
+ "CJPG;M-JPEG;Creative;Creative Video Blaster Webcam Go JPEG;;;;YUV;4:2:0\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;;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;;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;M-JPEG;Broadway 101;Data Translation, Inc.;;;;YUV;4:2:0\n"
+ "DM4V;MPEG-4 Visual;Dicas;;;;;YUV;4:2:0\n"
+ "DMB1;M-JPEG;Rainbow;Matrox Rainbow Runner hardware compression;http://mirror01.iptelecom.net.ua/~video/codecs/PICVideo.MJPG.v2.10.27.codec.exe;;;YUV;4:2:0\n"
+ "DMB2;M-JPEG;Paradigm;;;;;YUV;4:2:0\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;M-JPEG;DPS Reality;Dummy format - only AVI header;;;;YUV;4:2:0\n"
+ "DPSC;M-JPEG;DPS PAR;Dummy format - only AVI header;;;;YUV;4:2:0\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"
+ "FFVH;FFVH;;;http://ffdshow-tryout.sourceforge.net/\n"
+ "FLIC;FLI/FLC;Autodesk\n"
+ "FLJP;DField M-JPEG;;D-Vision Field Encoded M-JPEG with LSI (or Targa emulation)\n"
+ "FLV1;FFDS;;FFDShow supported;http://ffdshow-tryout.sourceforge.net/\n"
+ "FLV4;VP6;On2;;http://www.on2.com\n"
+ "FMJP;M-JPEG;D-Vision;;;;;YUV;4:2:0\n"
+ "FMP4;MPEG-4 Visual;;;http://ffdshow-tryout.sourceforge.net/;;;YUV;4:2:0\n"
+ "FPS1;Fraps;;;http://www.fraps.com/\n"
+ "FRLE;M-JPEG;SoftLab-Nsk;SoftLab-NSK Y16 + Alpha RLE;;;;YUV;4:2:0\n"
+ "FRWA;M-JPEG;SoftLab-Nsk;SoftLab-NSK Vision Forward M-JPEG with Alpha-channel;;;;YUV;4:2:0\n"
+ "FRWD;M-JPEG;SoftLab-Nsk;SoftLab-NSK Vision Forward M-JPEG;;;;YUV;4:2:0\n"
+ "FRWT;M-JPEG;SoftLab-Nsk;SoftLab-NSK Vision Forward M-JPEG with Alpha-channel;;;;YUV;4:2:0\n"
+ "FRWU;M-JPEG;SoftLab-Nsk;SoftLab-NSK Vision Forward Uncompressed;;;;YUV;4:2:0\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;M-JPEG;White Pine;;;;;YUV;4:2:0\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"
+ "GPEG;M-JPEG;Gabest;;http://sourceforge.net/project/showfiles.php?group_id=82303&package_id=84358;;;YUV;4:2:0\n"
+ "GPJM;M-JPEG;Pinnacle;;;;;YUV;4:2:0\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;H.263\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;M-JPEG;Intergraph;;;;;YUV;4:2:0\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 M-JPEG;;Accom SphereOUS M-JPEG with Alpha-channel\n"
+ "IPDV;I-O DV;;I-O Data Device Giga AVI DV\n"
+ "IPJ2;M-JPEG2000;;Image Power JPEG2000\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;M-JPEG;;;;;;YUV;4:2:0\n"
+ "JPEG;M-JPEG;;;http://www.apple.com/quicktime/download/standalone.html;;;YUV;4:2:0\n"
+ "JPG;M-JPEG;;;http://mirror01.iptelecom.net.ua/~video/codecs/PICVideo.Lossless.JPEG.codec.v2.10.27.exe;;;YUV;4:2:0\n"
+ "JPGL;M-JPEG;Pegasus;DIVIO JPEG Light for WebCams (Pegasus Lossless JPEG);;;;YUV;4:2:0\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-M-JPEG.v1.016.codec.exe\n"
+ "LEAD;Lead Video\n"
+ "LGRY;Lead GrayScale\n"
+ "LIA1;Liafail;;Liafail, Inc.\n"
+ "LJ2K;M-JPEG2000;Lead;;http://mirror01.iptelecom.net.ua/~video/codecs/LEAD.MCMP-M-JPEG.v1.016.codec.exe\n"
+ "LJPG;M-JPEG;Lead;;http://mirror01.iptelecom.net.ua/~video/codecs/LEAD.MCMP-M-JPEG.v1.016.codec.exe;;;YUV;4:2:0\n"
+ "Ljpg;M-JPEG;Lead;;;;;YUV;4:2:0\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;M-JPEG;MainConcept;;;;;YUV;4:2:0\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;M-JPEG2000;;Morgan Multimedia JPEG2000 Compression;http://mirror01.iptelecom.net.ua/~video/codecs/Pinnacle.ReelTime.v2.5.software.only.codec.exe\n"
+ "MJPA;M-JPEG;Pinacle;Pinnacle ReelTime MJPG hardware;http://mediaxw.sourceforge.net;;;YUV;4:2:0\n"
+ "MJPB;M-JPEG;Pinacle B;;;;;YUV;4:2:0\n"
+ "MJPG;M-JPEG;;;;;;YUV;4:2:0\n"
+ "mJPG;M-JPEG;IBM;Including Huffman Tables;;;;YUV;4:2:0\n"
+ "MJPX;M-JPEG;Pegasus;Pegasus PICVideo M-JPEG;;;;YUV;4:2:0\n"
+ "ML20;Webcam;;Mimic MSN Messenger Webcam\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;M-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;M-JPEG;Matrox;;;;;YUV;4:2:0\n"
+ "MTX2;M-JPEG;Matrox;;;;;YUV;4:2:0\n"
+ "MTX3;M-JPEG;Matrox;;;;;YUV;4:2:0\n"
+ "MTX4;M-JPEG;Matrox;;;;;YUV;4:2:0\n"
+ "MTX5;M-JPEG;Matrox;;;;;YUV;4:2:0\n"
+ "MTX6;M-JPEG;Matrox;;;;;YUV;4:2:0\n"
+ "MTX7;M-JPEG;Matrox;;;;;YUV;4:2:0\n"
+ "MTX8;M-JPEG;Matrox;;;;;YUV;4:2:0\n"
+ "MTX9;M-JPEG;Matrox;;;;;YUV;4:2:0\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;M-JPEG;Pegasus;Pinnacle DC1000 hardware (MPEG compression);http://mirror01.iptelecom.net.ua/~video/codecs/PICVideo.Lossless.JPEG.codec.v2.10.27.exe;;;YUV;4:2:0\n"
+ "PIM2;M-JPEG;Pegasus;Pegasus Imaging;http://mirror01.iptelecom.net.ua/~video/codecs/PICVideo.Lossless.JPEG.codec.v2.10.27.exe;;;YUV;4:2:0\n"
+ "PIMJ;M-JPEG;Pegasus;Pegasus Imaging PICvideo Lossless JPEG;http://mirror01.iptelecom.net.ua/~video/codecs/PICVideo.Lossless.JPEG.codec.v2.10.27.exe;;;YUV;4:2:0\n"
+ "PIXL;M-JPEG;Miro;MiroVideo XL (M-JPEG);;;;YUV;4:2:0\n"
+ "PNG;M-PNG\n"
+ "PNG1;M-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;M-JPEG;CuSeeMe;CuSeeMe;http://mirror01.iptelecom.net.ua/~video/codecs/CUseeMe.M-JPEG.CODEC.v1.17.exe;;;YUV;4:2:0\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;M-JPEG;SoftLab;SoftLab-NSK Forward M-JPEG;;;;YUV;4:2:0\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;Sorenson 1;;Sorenson Media Video 1 (Apple QuickTime 3)\n"
+ "SVQ2;Sorenson 2;;Sorenson Media Video 2 (Apple QuickTime 4)\n"
+ "SVQ3;Sorenson 3;;Sorenson Media Video 3 (Apple QuickTime 5)\n"
+ "SWC1;M-JPEG;MainConcept;MainConcept M-JPEG;;;;YUV;4:2:0\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 M-JPEG (Targa emulation)\n"
+ "TVMJ;Pinnacle/Truevision;;Truevision TARGA M-JPEG Hardware (or Targa emulation)\n"
+ "TY0N;Trident;;Trident Decompression Driver\n"
+ "TY2C;Trident;;Trident Decompression Driver\n"
+ "TY2N;Trident;;Trident Decompression Driver\n"
+ "U<Y ;YUV;Discreet;Discreet UC YUV 4:2:2:4 10 bit;;;;YUV\n"
+ "U<YA;YUV;Discreet;Discreet UC YUV 4:2:2:4 10 bit (with Alpha-channel);;;;YUV\n"
+ "U263;H.263;UB;UB Video H.263/H.263+/H.263++ Decoder;http://eMajix.com\n"
+ "UCOD;ClearVideo;;ClearVideo (fractal compression-based)\n"
+ "ULTI;Ultimotion;;IBM Ultimotion\n"
+ "UMP4;MPEG-4 Visual;UB;UB Video MPEG 4;http://www.fourcc.org/indexyuv.htm;;;YUV;4:2:0\n"
+ "UYNV;YUV;;Nvidia 16bpp. A direct copy of UYVY registered by Nvidia to work around problems in some olds which did not like hardware which offered more than 2 UYVY surfaces.;http://www.fourcc.org/indexyuv.htm;;;YUV\n"
+ "UYVP;YUV;;Evans & Sutherland 24bpp. YUV 4:2:2 extended precision 10-bits per component in U0Y0V0Y1 order;;;;YUV\n"
+ "UYVU;YUV;SoftLab;SoftLab-NSK Forward YUV;http://www.fourcc.org/indexyuv.htm;;;YUV\n"
+ "UYVY;YUV;;Uncompressed 16bpp. YUV 4:2:2 (Y sample at every pixel, U and V sampled at every second pixel horizontally on each line). A macropixel contains 2 pixels in 1 u_int32.;;;;YUV;4:2:2\n"
+ "V210;Optibase;;Optibase VideoPump 10-bit 4:2:2 Component YUV\n"
+ "V261;VX3000S;;Lucent VX3000S\n"
+ "V422;YUV;Vitec;;;;;YUV;4:2:2\n"
+ "V655;YUV;Vitec;Vitec Multimedia 16 bit YUV 4:2:2 (6:5:5) format;;;;YUV\n"
+ "VBLE;MarcFD VBLE;;MarcFD VBLE Lossless\n"
+ "VCR1;ATI Video 1;;ATI VCR 1.0\n"
+ "VCR2;ATI Video 2;;ATI VCR 2.0 (MPEG YV12)\n"
+ "VCR3;ATI Video 3;;ATI VCR 3.0\n"
+ "VCR4;ATI Video 4;;ATI VCR 4.0\n"
+ "VCR5;ATI Video 5;;ATI VCR 5.0\n"
+ "VCR6;ATI Video 6;;ATI VCR 6.0\n"
+ "VCR7;ATI Video 7;;ATI VCR 7.0\n"
+ "VCR8;ATI Video 8;;ATI VCR 8.0\n"
+ "VCR9;ATI Video 9;;ATI VCR 9.0\n"
+ "VCWV;Wavelet;;VideoCon\n"
+ "VDCT;RGB;VideoMaker;Video Maker Pro DIB;;;;RGB\n"
+ "VDOM;VDOWave;;VDONet Wave\n"
+ "VDOW;VDOLive;;VDONet Live (H,263)\n"
+ "VDST;VirtualDub;;VirtualDub remote frameclient ICM driver\n"
+ "VDTZ;YUV;;VideoTizer / Darim Vision YUV;;;;YUV;4:2:2\n"
+ "VGPX;VGP;;Alaris VideoGramPixel\n"
+ "VIDM;MPEG-4 Visual;DivX 5 Pro;DivX 5.0 Pro Supported;;;;YUV;4:2:0\n"
+ "VIDS;Vitec;;Vitec Multimedia YUV 4:2:2;www.yks.ne.jp/~hori/\n"
+ "VIFP;VFAPI;;Virtual Frame API (VFAPI dummy format)\n"
+ "VIV1;H.263;Vivo\n"
+ "VIV2;H.263;Vivo\n"
+ "VIVO;H.263;Vivo\n"
+ "VIXL;M-JPEG;Miro XL;Miro Video XL;http://mirror01.iptelecom.net.ua/~video/codecs/miroVIDEO-XL.codec.v2.2.exe;;;YUV;4:2:0\n"
+ "VJPG;M-JPEG;;;;;;YUV;4:2:0\n"
+ "VLV1;Videologic\n"
+ "VMNC;Vmware;;;http://www.vmware.com/\n"
+ "VP30;VP3;On2\n"
+ "VP31;VP3;On2\n"
+ "VP40;VP4;On2\n"
+ "VP50;VP5;On2\n"
+ "VP60;VP6;On2\n"
+ "VP61;VP6.1;On2\n"
+ "VP62;VP6.2;On2;;http://ftp.pub.cri74.org/pub/win9x/video/codecs/VP6/vp6_vfw_codec.exe\n"
+ "VP70;VP7;On2\n"
+ "VP71;VP7;On2\n"
+ "VP72;VP7;On2\n"
+ "VP80;VP8;;;http://www.webmproject.org;;;YUV;4:2:0\n"
+ "VQC1;Vector 1;;Vector-quantised 1 (high compression) http://eprints.ecs.soton.ac.uk/archive/00001310/01/VTC97-js.pdf\n"
+ "VQC2;Vector 2;;Vector-quantised 2 (high robustness against channel errors) http://eprints.ecs.soton.ac.uk/archive/00001310/01/VTC97-js.pdf\n"
+ "VQJP;VQ630;;Dual-mode digital camera\n"
+ "VQS4;VQ110;;DV camera\n"
+ "VR21;YUV;BlckMagic;BlackMagic YUV (Quick Time);;;;YUV\n"
+ "VSSH;AVC;Vanguard VSS;;;;;YUV;4:2:0\n"
+ "VSSV;Vanguard Video;Vanguard VSS\n"
+ "VSSW;AVC;Vanguard VSS;;;;;YUV;4:2:0\n"
+ "VTLP;GGP;;Alaris VideoGramPixel\n"
+ "VX1K;DVX 1 S;;Lucent VX1000S Video\n"
+ "VX2K;DVX 2 S;;Lucent VX2000S Video\n"
+ "VXSP;DVX 1 SP;;Lucent VX1000SP Video\n"
+ "VYU9;YUV;ATI;;;;;YUV\n"
+ "VYUY;YUV;ATI;;;;;YUV\n"
+ "WBVC;W9960;;Winbond Electronics W9960\n"
+ "WHAM;Microsoft Video 1\n"
+ "WINX;Winnov\n"
+ "WJPG;M-JPEG;Winbond ;Winbond JPEG (AverMedia USB devices);;;;YUV;4:2:0\n"
+ "WMV1;WMV1;;Windows Media Video 7;http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx\n"
+ "WMV2;WMV2;;Windows Media Video 8;http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx\n"
+ "WMV3;VC-1;WMV3;Windows Media Video 9;http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx\n"
+ "WMVA;VC-1;WMV;Windows Media Video;http://ffdshow-tryout.sourceforge.net/\n"
+ "WMVP;WMV3;;Windows Media Video V9\n"
+ "WNIX;WniWni;;WniWni\n"
+ "WNV1;WinNov;;WinNov Videum Hardware Compression;http://www.winnov.com/\n"
+ "WNVA;WinNov;;WinNov Videum Hardware Compression;http://www.winnov.com/\n"
+ "WRLE;RGB;Apple;Apple QuickTime BMP;;;;RGB\n"
+ "WRPR;AVideoTools;;VideoTools VideoServer Client (wrapper for AviSynth)\n"
+ "WV1F;;;;http://ffdshow-tryout.sourceforge.net/\n"
+ "WVC1;VC-1;Microsoft\n"
+ "WVLT;IllusionHope Wavelet 9/7;;IllusionHope Wavelet 9/7\n"
+ "WVP2;;;;http://ffdshow-tryout.sourceforge.net/\n"
+ "WZCD;iScan;;CORE Co. Ltd.\n"
+ "WZDC;iSnap;;CORE Co. Ltd.\n"
+ "X263;H.263;Xirlink\n"
+ "X264;AVC;;XiWave GNU GPL x264 MPEG-4\n"
+ "XJPG;M-JPEG;Xirlink;;;;;YUV;4:2:0\n"
+ "XLV0;NetXL Video;;NetXL Inc. XL Video Decoder\n"
+ "XMPG;MPEG Video;Xing;XING MPEG (I frame only);;;;YUV;4:2:0\n"
+ "XVID;MPEG-4 Visual;XviD;;http://mediaarea.net/XVID;;;YUV;4:2:0\n"
+ "XVIX;MPEG-4 Visual;XviD;Based on XviD MPEG-4;http://www.xvid.org/Downloads.15.0.html;;;YUV;4:2:0\n"
+ "XWV0;XiWave Video\n"
+ "XWV1;XiWave Video\n"
+ "XWV2;XiWave Video\n"
+ "XWV3;XiWave Video\n"
+ "XWV4;XiWave Video\n"
+ "XWV5;XiWave Video\n"
+ "XWV6;XiWave Video\n"
+ "XWV7;XiWave Video\n"
+ "XWV8;XiWave Video\n"
+ "XWV9;XiWave Video\n"
+ "XXAN;Origin VideoGame;;Used in Wing Commander 3 and 4\n"
+ "XYZP;YUV;;Extended PAL format XYZ palette;;;;YUV\n"
+ "Y211;YUV;;Packed YUV format with Y sampled at every second pixel across each line and U and V sampled at every fourth pixel;;;;YUV\n"
+ "Y216;YUV;Targa;Pinnacle TARGA CineWave YUV (Quick Time);;;;YUV\n"
+ "Y411;YUV;;YUV 4:1:1 Packed;;;;YUV;4:1:1\n"
+ "Y41B;YUV;;YUV 4:1:1 Planar;;;;YUV;4:1:1\n"
+ "Y41P;YUV;;Conexant (ex Brooktree) YUV 4:1:1 Raw;http://www.fourcc.org/indexyuv.htm;;;YUV;4:1:1\n"
+ "Y41T;YUV;;Format as for Y41P, but the lsb of each Y component is used to signal pixel transparency;;;;YUVA;4:1:1\n"
+ "Y422;YUV;;Direct copy of UYVY as used by ADS Technologies Pyro WebCam firewire camera;;;;YUV;4:2:2\n"
+ "Y42B;YUV;;YUV 4:2:2 Planar;;;;YUV;4:2:2\n"
+ "Y42T;YUV;;Format as for UYVY, but the lsb of each Y component is used to signal pixel transparency;;;;YUVA;4:2:2\n"
+ "Y444;YUV;;IYU2 (iRez Stealth Fire camera);;;;YUV\n"
+ "Y8 ;GrayScale;;Simple grayscale video;;;;Y\n"
+ "Y800;GrayScale;;Simple grayscale video;;;;Y\n"
+ "YC12;YUV;;Intel YUV12;http://www.fourcc.org/indexyuv.htm;;;YUV\n"
+ "YCCK;YUV;;;;;;YUV\n"
+ "YMPG;MPEG-PS;;YMPEG Alpha (dummy for MPEG-2 compressor)\n"
+ "YU12;YUV;;ATI YV12 4:2:0 Planar;;;;YUV;4:2:0\n"
+ "YU92;YUV;;Intel - YUV;;;;YUV\n"
+ "YUNV;YUV;;A direct copy of YUY2 registered by Nvidia to work around problems in some olds which did not like hardware that offered more than 2 YUY2 surfaces;;;;YUV\n"
+ "YUV2;YUV;;Apple Component Video (YUV 4:2:2);http://www.apple.com/quicktime/download/standalone.html;;;YUV\n"
+ "YUV8;YUV;;Winnov Caviar YUV8 ;http://www.fourcc.org/indexyuv.htm;;;YUV\n"
+ "YUV9;YUV;;Intel YUV9;;;;YUV\n"
+ "YUVP;YUV;;YUV 4:2:2 extended precision 10-bits per component in Y0U0Y1V0 order;;;;YUV;4:2:2;10\n"
+ "YUY2;YUV;;YUV 4:2:2 as for UYVY but with different component ordering within the u_int32 macropixel;http://www.fourcc.org/indexyuv.htm;;;YUV;4:2:2\n"
+ "YUYP;YUV;;Evans & Sutherland;;;;YUV\n"
+ "YUYV;YUV;;Canopus YUV format;http://www.fourcc.org/indexyuv.htm;;;YUV\n"
+ "YV12;YUV;;ATI YVU12 4:2:0 Planar;http://www.fourcc.org/indexyuv.htm;;;YUV;4:2:0\n"
+ "YV16;YUV;;Elecard YUV 4:2:2 Planar;;;;YUV;4:2:2\n"
+ "YV92;YUV;;Intel Smart Video Recorder YVU9;;;;YUV\n"
+ "YVU9;YUV;;Brooktree YVU9 Raw (YVU9 Planar);http://www.fourcc.org/indexyuv.htm;;;YUV\n"
+ "YVYU;YUV;;YUV 4:2:2 as for UYVY but with different component ordering within the u_int32 macropixel;;;;YUV;4:2:2\n"
+ "ZLIB;AVIzlib;;Lossless (ZIP compression)\n"
+ "ZMBV;Zip;;Zip Motion Blocks Video\n"
+ "ZPEG;Video Zipper;;Metheus Video Zipper\n"
+ "ZYGO;ZyGo;;ZyGo Video\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_CodecID_Audio_Matroska (InfoMap &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ "A_MPEG/L1;MPEG Audio;MP1;;http://www.iis.fraunhofer.de/amm/index.html\n"
+ "A_MPEG/L2;MPEG Audio;MP2;;http://www.iis.fraunhofer.de/amm/index.html\n"
+ "A_MPEG/L3;MPEG Audio;MP3;;http://www.iis.fraunhofer.de/amm/index.html\n"
+ "A_PCM/INT/BIG;PCM\n"
+ "A_PCM/INT/LIT;PCM\n"
+ "A_PCM/FLOAT/IEEE;PCM\n"
+ "A_AC3;AC-3\n"
+ "A_AC3/BSID9;AC-3\n"
+ "A_AC3/BSID10;AC-3\n"
+ "A_DTS;DTS\n"
+ "A_EAC3;E-AC-3\n"
+ "A_FLAC;Flac;;;http://flac.sourceforge.net\n"
+ "A_TTA1;TTA;;The True Audio Lossless Codec;http://true-audio.com\n"
+ "A_VORBIS;Vorbis;;;http://www.vorbis.com\n"
+ "A_WAVPACK4;WavPack;;;http://www.wavpack.com\n"
+ "A_REAL/14_4;VSELP;;Real Audio 1 (14.4);http://www.real.com\n"
+ "A_REAL/28_8;G.728;;Real Audio 2 (28.8);http://www.real.com\n"
+ "A_REAL/COOK;Cooker;;Real Audio Cook Codec (codename: Gecko);http://www.real.com\n"
+ "A_REAL/SIPR;G.729;;Real & Sipro Voice Codec;http://www.real.com\n"
+ "A_REAL/RALF;RealAudio Lossless;;Real Audio Lossless Format;http://www.real.com\n"
+ "A_REAL/ATRC;Atrac;;Real & Sony Atrac3 Codec;http://www.real.com\n"
+ "A_TRUEHD;TrueHD;;Dolby TrueHD;http://www.dolby.com/consumer/technology/trueHD.html\n"
+ "A_MLP;MLP;;Meridian Lossless Packing;http://www.meridian-audio.com\n"
+ "A_AAC;AAC\n"
+ "A_AAC/MPEG2/MAIN;AAC\n"
+ "A_AAC/MPEG2/LC;AAC\n"
+ "A_AAC/MPEG2/LC/SBR;AAC\n"
+ "A_AAC/MPEG2/SSR;AAC\n"
+ "A_AAC/MPEG4/MAIN;AAC\n"
+ "A_AAC/MPEG4/LC;AAC\n"
+ "A_AAC/MPEG4/LC/SBR;AAC\n"
+ "A_AAC/MPEG4/LC/SBR/PS;AAC\n"
+ "A_AAC/MPEG4/SSR;AAC\n"
+ "A_AAC/MPEG4/LTP;AAC\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_CodecID_Audio_Mpeg4 (InfoMap &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ ".mp3;MPEG Audio\n"
+ "A104;AMR;;;http://www.apple.com/quicktime/download/standalone.html;Wide band\n"
+ "ac-3;AC-3\n"
+ "alac;ALAC;;Apple Lossless Format;http://www.apple.com/quicktime/download/standalone.html\n"
+ "alaw;ADPCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "dvca;PCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "ec-3;E-AC-3\n"
+ "enca;(Encrypted)\n"
+ "fl32;PCM ; ;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "fl64;PCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "ima4;ADPCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "in24;PCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "in32;PCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "MAC3;MACE 3\n"
+ "MAC6;MACE 6\n"
+ "NONE;PCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "owma;WMA Pro;;Smooth Streaming Media Audio;http://alexzambelli.com/blog/2009/02/10/smooth-streaming-architecture/\n"
+ "Qclp;QCELP;;Qualcomm PureVoice\n"
+ "QDM1;QDesign 1;;QDesign Music 1;http://www.apple.com/quicktime/download/standalone.html\n"
+ "QDM2;Qdesign 2;;QDesign Music 2;http://www.apple.com/quicktime/download/standalone.html\n"
+ "QDMC;Qdesign 2;(Old);QDesign Music 2 (old version, rare);http://www.apple.com/quicktime/download/standalone.html\n"
+ "raw ;PCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "sac3;AC-3;;Made by Nero;http://www.nerodigital.com\n"
+ "samr;AMR;;;http://www.apple.com/quicktime/download/standalone.html;Narrow band\n"
+ "sawb;AMR;;;http://www.apple.com/quicktime/download/standalone.html;Wide band\n"
+ "sevc;EVRC;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "sowt;PCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "twos;PCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "ulaw;ADPCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "vdva;PCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_CodecID_Audio_Real (InfoMap &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ "14.4;VSELP;;Real Player 1;http://www.real.com\n"
+ "14_4;VSELP;;Real Player 1;http://www.real.com\n"
+ "28.8;G.728;;Real Player 2;http://www.real.com\n"
+ "28_8;G.728;;Real Player 2;http://www.real.com\n"
+ "atrc;Atrac;;Real Player 8;http://www.real.com\n"
+ "audio/X-MP3-draft-00;MPEG Audio\n"
+ "audio/x-ralf-mpeg4;RealAudio Lossless;;Real Audio Lossless Format, Real Player 10;http://www.real.com\n"
+ "audio/x-ralf-mpeg4-generic;RealAudio Lossless;;Real Audio Lossless Format, Real Player 10;http://www.real.com\n"
+ "cook;Cooker;;Based on G.722.1, Real Player 6;http://www.real.com\n"
+ "dnet;AC-3;;Real Player 3;http://www.real.com\n"
+ "lpcJ;VSELP;;Real Player 1;http://www.real.com\n"
+ "raac;AAC;;Real Player 9;http://www.real.com\n"
+ "racp;AAC;;Real Player 10;http://www.real.com\n"
+ "rtrc;RealAudio 8;;;http://www.real.com\n"
+ "sipr;ACELP;;Real Player 4;http://www.real.com\n"
+ "whrl;RealAudio Multi-Channel;;Real Audio Multi-Channel;http://www.real.com\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_CodecID_Audio_Riff (InfoMap &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ "0\n"
+ "1;PCM;Microsoft;;http://www.microsoft.com/windows/\n"
+ "2;ADPCM;Microsoft;;http://www.microsoft.com/windows/\n"
+ "3;PCM;IEEE ;;http://www.microsoft.com/windows/;Float\n"
+ "4;VSELP;Compaq\n"
+ "5;CVSD;IBM\n"
+ "6;ADPCM;CCITT;;http://www.microsoft.com/windows/;A-Law\n"
+ "7;ADPCM;CCITT;;http://www.microsoft.com/windows/;U-Law\n"
+ "8;DTS;;Digital Theater Systems\n"
+ "9;DRM;Microsoft\n"
+ "A;WMA;;Windows Media Audio;http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx;Voice\n"
+ "C;MPEG Audio;;;;MPEG-2 5.1\n"
+ "10;ADPCM;OKI\n"
+ "11;ADPCM;Intel\n"
+ "12;ADPCM;Mediaspace\n"
+ "13;ADPCM;Sierra\n"
+ "14;ADPCM;Antex;G.723\n"
+ "15;STD;DSP solutions\n"
+ "16;FIX;DSP solutions\n"
+ "17;ADPCM;Dialogic-OKI;;http://www.microsoft.com/windows/\n"
+ "18;ADPCM\n"
+ "19;CU;HP\n"
+ "1A;Dynamic Voice;HP\n"
+ "20;ADPCM;Yamaha\n"
+ "21;SONARC;Speech Compression\n"
+ "22;Truespeech;DSP Group;;http://www.microsoft.com/windows/\n"
+ "23;SC1;Echo Speech\n"
+ "24;AudioFile 36;Virtual Music \n"
+ "25;APTX;;Audio Processing Technology X\n"
+ "26;AudioFile 10;Virtual Music\n"
+ "27;Prosody 1612;Aculab plc\n"
+ "28;LRC;Merging Technologies\n"
+ "30;AC-2;Dolby Laboratories\n"
+ "31;GSM 6.10;Microsoft;;http://www.microsoft.com/windows/\n"
+ "32;Microsoft Audio\n"
+ "33;ADPCM;Antex\n"
+ "34;VQLPC;Control Ressources\n"
+ "35;REAL;DSP Solutions\n"
+ "36;ADPCM;DSP Solutions\n"
+ "37;CR10;;Control Resources 10\n"
+ "38;ADPCM;Natural MicroSystems VBX\n"
+ "39;ADPCM;Crystal Semiconductor IMA\n"
+ "3A;SC3;Echo Speech\n"
+ "3B;ADPCM;Rockwell\n"
+ "3C;DigiTalk;Rockwell DigiTalk\n"
+ "3D;Xebec;;Xebec Multimedia Solutions\n"
+ "40;ADPCM;Antex Electronics;G.721\n"
+ "41;CELP;Antex Electronics;G.728\n"
+ "42;G.723.1;Microsoft;;http://www.microsoft.com/windows/\n"
+ "42;ADPCM;;IBM\n"
+ "42;G.729;Microsoft\n"
+ "45;ADPCM;Microsoft;G.726;http://www.microsoft.com/windows/\n"
+ "50;MPEG Audio;;;http://www.iis.fraunhofer.de/amm/index.html;;Version 1\n"
+ "51;MPEG Audio;;;http://www.iis.fraunhofer.de/amm/index.html;;Version 2\n"
+ "52;RT24;InSoft, Inc.\n"
+ "53;PAC;InSoft, Inc.\n"
+ "55;MPEG Audio;MP3;;http://www.iis.fraunhofer.de/amm/index.html\n"
+ "59;G.723;Lucent;G.723\n"
+ "60;Cirrus;;Cirrus Logic\n"
+ "61;PCM;ESS Technology\n"
+ "62;Voxware\n"
+ "63;Atrac;Canopus\n"
+ "64;ADPCM;APICOM;G.726\n"
+ "65;ADPCM;APICOM;G.722\n"
+ "66;DSAT;Microsoft\n"
+ "67;DSAT Display;Microsoft\n"
+ "69;BYTE_ALIGNED;Voxware;;http://www.voxware.com/\n"
+ "70;AC8;Voxware;;http://www.voxware.com/\n"
+ "71;AC10;Voxware;;http://www.voxware.com/\n"
+ "72;AC16;Voxware;;http://www.voxware.com/\n"
+ "73;AC20;Voxware;;http://www.voxware.com/\n"
+ "74;RT24;Voxware;MetaVoice;http://www.voxware.com/\n"
+ "75;RT29;Voxware;MetaSound;http://www.voxware.com/\n"
+ "76;RT29HW;Voxware;;http://www.voxware.com/\n"
+ "77;VR12;Voxware;;http://www.voxware.com/\n"
+ "78;VR18;Voxware;;http://www.voxware.com/\n"
+ "79;TQ40;Voxware;;http://www.voxware.com/\n"
+ "7A;SC3;Voxware\n"
+ "7B;SC3;Voxware\n"
+ "80;Softsound\n"
+ "81;TQ60;Voxware;;http://www.voxware.com/\n"
+ "82;MSRT24;Microsoft\n"
+ "83;G.729a;AT&T\n"
+ "84;MVI_MVI2;Motion Pixels\n"
+ "85;ADPCM;DataFusion Systems;G.726\n"
+ "86;GSM 6.10;DataFusion Systems\n"
+ "88;ISI AUDIO;;Iterated Systems AUDIO\n"
+ "89;Onlive;;OnLive! Technologies\n"
+ "8A;SX20;Multitude\n"
+ "8B;ADPCM;Infocom ITS A/S\n"
+ "8C;G.729;Convedia Corporation\n"
+ "91;SBC24;;Siemens Business Communications Sys 24\n"
+ "92;AC-3;Sonic Foundry\n"
+ "93;G.723;MediaSonic\n"
+ "94;Prosody 8KBPS;Aculab plc\n"
+ "97;ADPCM;ZyXEL Communications\n"
+ "98;LPCBB;Philips Speech Processing\n"
+ "99;Packed;;Studer Professional Audio AG Packed\n"
+ "A0;PHONYTALK;Malden Electronics\n"
+ "A1;GSM;Racal Recorders\n"
+ "A2;G.720a;Racal Recorders\n"
+ "A3;G.723.1;Racal Recorders\n"
+ "A4;ACELP;Racal Recorders\n"
+ "B0;AAC;NEC Corporation\n"
+ "FF;AAC\n"
+ "100;ADPCM\n"
+ "101;IRAT;BeCubed\n"
+ "102;ADPCM;IBM;;;A-law\n"
+ "103;ADPCM;IBM AVC\n"
+ "111;G.723;Vivo\n"
+ "112;SIREN;Vivo\n"
+ "120;CELP;Philips Speech Processing\n"
+ "121;Grundig;Philips Speech Processing\n"
+ "123;G.723;Digital Equipment Corporation\n"
+ "125;ADPCM\n"
+ "130;ACELP;Sipro;;http://dividix.host.sk;.net\n"
+ "131;ACELP;Sipro;;;4800\n"
+ "132;ACELP;Sipro;;;8V3\n"
+ "133;G.729;Sipro\n"
+ "134;G.729a;Sipro\n"
+ "135;KELVIN;Sipro\n"
+ "135;AMR;VoiceAge Corporation\n"
+ "140;ADPCM;Dictaphone Corporation;G.726\n"
+ "140;CELP68;Dictaphone Corporation\n"
+ "140;CELP54;Dictaphone Corporation\n"
+ "150;PureVoice;Qualcomm\n"
+ "151;HalfRate;Qualcomm\n"
+ "155;TUBGSM;Ring Zero Systems\n"
+ "160;WMA;;Windows Media Audio;http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx;;Version 1\n"
+ "161;WMA;;Windows Media Audio;http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx;;Version 2\n"
+ "162;WMA;;Windows Media Audio;http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx;Pro\n"
+ "163;WMA;;Windows Media Audio;http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx;Lossless\n"
+ "170;ADPCM;Unisys Nap\n"
+ "171;ADPCM;Unisys Nap;;;U-law\n"
+ "172;ADPCM;Unisys Nap;;;A-law\n"
+ "173;16K;Unisys Nap\n"
+ "174;G.700;SyCom Technologies\n"
+ "175;ADPCM;SyCom Technologies\n"
+ "176;CELP54;SyCom Technologies\n"
+ "177;CELP68;SyCom Technologies\n"
+ "178;ADPCM;Knowledge Adventure, Inc.\n"
+ "180;AAC;Fraunhofer IIS\n"
+ "190;DTS;;Digital Theater Systems\n"
+ "200;ADPCM;Creative Labs\n"
+ "202;Fast Speech 8;Creative Labs\n"
+ "203;Fast Speech 10;Creative Labs\n"
+ "210;ADPCM;UHER informatic GmbH\n"
+ "215;ACM;Ulead\n"
+ "216;ACM;Ulead\n"
+ "220;QuaterDeck\n"
+ "230;VC;;I-link VC\n"
+ "240;RAW_SPORT;;Aureal\n"
+ "241;AC-3;ESST\n"
+ "250;HSX;Interactive Products, Inc.\n"
+ "251;RPELP;Interactive Products, Inc.\n"
+ "260;CS2;Consistent Software\n"
+ "270;Atrac3;Sony\n"
+ "271;SCY;Sony\n"
+ "272;Atrac3;Sony\n"
+ "273;SPC;Sony\n"
+ "280;Telum\n"
+ "281;TelumIA\n"
+ "285;ADPCM;Norcom Voice Systems\n"
+ "300;FM_TOWNS_SND;Fujitsu\n"
+ "350;Dev;Micronas Semiconductors, Inc.\n"
+ "351;CELP833;Micronas Semiconductors, Inc.\n"
+ "400;DIGITAL;Brooktree\n"
+ "401;Music Coder;Intel;;http://www.intel.com/\n"
+ "402;IAC2;Ligos;;http://www.ligos.com\n"
+ "450;Qdesign;;QDesign Music\n"
+ "500;VP7;;On2 VP7 Audio;http://www.on2.com/vp7.php3\n"
+ "501;VP6;;On2 VP7 Audio;http://www.on2.com/vp7.php3\n"
+ "680;VM;;AT&T VME_VMPCM\n"
+ "681;TPC;;AT&T TPC\n"
+ "700;YMPEG;;YMPEG Alpha\n"
+ "8AE;LiteWave;;ClearJump LiteWave\n"
+ "AAC;AAC\n"
+ "1000;GSM;Ing C. Olivetti & C., S.p.A.\n"
+ "1001;ADPCM;Ing C. Olivetti & C., S.p.A.\n"
+ "1002;CELP;Ing C. Olivetti & C., S.p.A.\n"
+ "1003;SBC;Ing C. Olivetti & C., S.p.A.\n"
+ "1004;OPR;Ing C. Olivetti & C., S.p.A.\n"
+ "1100;LH_CODEC;Lernout & Hauspie; Codec\n"
+ "1101;CELP;Lernout & Hauspie;;http://www.microsoft.com/windows/;4.8 kb/s\n"
+ "1102;SBC;Lernout & Hauspie;;http://www.microsoft.com/windows/;8 kb/s\n"
+ "1103;SBC;Lernout & Hauspie;;http://www.microsoft.com/windows/;12 kb/s\n"
+ "1104;SBC;Lernout & Hauspie;;http://www.microsoft.com/windows/;16 kb/s\n"
+ "1400;Norris;;Norris Communications, Inc.\n"
+ "1401;ISIAudio\n"
+ "1500;MUSICOMPRESS;;Soundspace Music Compression\n"
+ "181C;RT24;VoxWare\n"
+ "181E;AX24000P;Lucent elemedia\n"
+ "1971;SonicFoundry;;Lossless\n"
+ "1C03;ADPCM;Lucent;G.723\n"
+ "1C07;SX8300P;Lucent\n"
+ "1C0C;ADPCM;Lucent;G.723\n"
+ "1F03;DigiTalk;;CUseeMe (ex-Rocwell)\n"
+ "1FC4;ALF2CD;NCT Soft\n"
+ "2000;AC-3\n"
+ "2001;DTS;;Digital Theater Systems\n"
+ "2002;VSELP;;RealAudio 1/2 14.4\n"
+ "2003;VSELP;;RealAudio 1/2 28.8\n"
+ "2004;Cooker;;RealAudio G2/8 Cook (low bitrate)\n"
+ "2005;DNET;;RealAudio 3/4/5 Music (DNET)\n"
+ "2006;AAC;;RealAudio 10 AAC (RAAC)\n"
+ "2007;AAC;;RealAudio 10 AAC+ (RACP)\n"
+ "2048;Sonic\n"
+ "3313;AviSynth;;makeAVIS (fake AVI sound from AviSynth scripts)\n"
+ "4143;AAC;;Divio MPEG-4 AAC audio\n"
+ "4201;Nokia\n"
+ "4243;ADPCM;;G.726\n"
+ "43AC;Speex\n"
+ "564C;Vorbis\n"
+ "566F;Vorbis;;;http://www.vorbis.com\n"
+ "5756;WavPack;;;http://www.wavpack.com/\n"
+ "674F;Vorbis;;;http://www.vorbis.com;;Mode 1\n"
+ "6750;Vorbis;;;http://www.vorbis.com;;Mode 2\n"
+ "6751;Vorbis;;;http://www.vorbis.com;;Mode 3\n"
+ "676F;Vorbis;;;http://www.vorbis.com;;Mode 1+\n"
+ "6770;Vorbis;;;http://www.vorbis.com;;Mode 2+\n"
+ "6771;Vorbis;;;http://www.vorbis.com;;Mode 2+\n"
+ "7A21;AMR;;GSM-AMR (CBR, no SID);http://www.microsoft.com\n"
+ "7A22;AMR;;GSM-AMR (VBR, including SID);http://www.microsoft.com\n"
+ "A100;G.723.1\n"
+ "A101;AVQSBC\n"
+ "A102;ODSBC\n"
+ "A103;G729A\n"
+ "A104;AMR\n"
+ "A105;ADPCM;;G.726\n"
+ "A106;AAC\n"
+ "A107;ADPCM;;G.726\n"
+ "A109;Speex;;;http://www.speex.org/\n"
+ "DFAC;FrameServer;;DebugMode SonicFoundry Vegas FrameServer ACM Codec\n"
+ "F1AC;FLAC;;Free Lossless Audio Codec\n"
+ "FFFE;Extensible\n"
+ "FFFF;In Development\n"
+ "58CB7144-23E9-BFAA-A119-FFFA01E4CE62;Atrac3\n"
+ "AD98D184-AAC3-11D0-A41C-00A0C9223196;VC\n"
+ "05589F81-C356-11CE-BF01-00AA0055595A;WaveFormatEx\n"
+ "518590A2-A184-11D0-8522-00C04FD9BAF3;DSound\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_CodecID_Text_Matroska (InfoMap &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ "S_ASS;ASS;;Advanced Sub Station Alpha\n"
+ "S_IMAGE/BMP;Bitmap;;Basic image based subtitle format\n"
+ "S_SSA;SSA;;Sub Station Alpha\n"
+ "S_TEXT/ASS;ASS;;Advanced Sub Station Alpha\n"
+ "S_TEXT/SSA;SSA;;Sub Station Alpha\n"
+ "S_TEXT/USF;USF;;Universal Subtitle Format\n"
+ "S_TEXT/UTF8;UTF-8;;UTF-8 Plain Text\n"
+ "S_USF;USF;;Universal Subtitle Format\n"
+ "S_UTF8;UTF-8;;UTF-8 Plain Text\n"
+ "S_VOBSUB;VobSub;;The same subtitle format used on DVDs\n"
+ "S_HDMV/PGS;PGS;;The same subtitle format used on BDs/HD-DVDs\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_CodecID_Text_Mpeg4 (InfoMap &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ "subp;VobSub;;The same subtitle format used on DVDs\n"
+ "text;Apple text;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "sbtl;Apple text;(iPhone);;http://www.apple.com/quicktime/download/standalone.html\n"
+ "tx3g;Timed text;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "enct;(Encrypted)\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_CodecID_Text_Riff (InfoMap &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ "DXSB;DivX Subtitle;;Subtitle in AVI from DivX networks;http://www.divx.com\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_Codec (InfoMap &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ " BIT;RGB;4CC;V;RGB;;Uncompressed\n"
+ " JPG;M-JPEG;4CC;V;M-JPEG\n"
+ " PNG;PNG;4CC;V;RGB\n"
+ " RAW;RGB;4CC;V;RGB;;Uncompressed;http://www.fourcc.org/indexrgb.htm\n"
+ " RGB;RGB;4CC;V;RGB;;Uncompressed. Basic Windows bitmap format. 1, 4 and 8 bpp versions are palettised. 16, 24 and 32bpp contain Uncompressed RGB samples.;http://www.fourcc.org/indexrgb.htm\n"
+ " RL4;RGB;4CC;V;RGB;;RLE 4bpp;http://www.fourcc.org/indexrgb.htm\n"
+ " RL8;RGB;4CC;V;RGB;;RLE 8bpp;http://www.fourcc.org/indexrgb.htm\n"
+ "1978;RGB;4CC;V;JPEG;;A.M.Paredes predictor;http://www.pegasusimaging.com/cgi-bin/download2.cgi?LVIDB\n"
+ "2VUY;YUV;4CC;V;YUV;;Optibase VideoPump 8-bit 4:2:2 Component YCbCr\n"
+ "3IV0;3ivX;4CC;V;MPEG-4V;;3ivX pre-1.0;http://www.3ivx.com/download/\n"
+ "3IV1;3ivX;4CC;V;MPEG-4V;;3ivX 1.0-3.5;http://www.3ivx.com/download/\n"
+ "3IV2;3ivX;4CC;V;MPEG-4V;;3ivX 4.0;http://www.3ivx.com/download/\n"
+ "3IVD;3ivX;4CC;V;MPEG-4V;;;http://ffdshow-tryout.sourceforge.net/\n"
+ "3IVX;3ivX;4CC;V;MPEG-4V;;;http://www.3ivx.com/download/\n"
+ "3VID;3ivX;4CC;V;MPEG-4V;;;http://www.3ivx.com/download/\n"
+ "8BPS;QuickTime 8bps;4CC;V;RGB;;Apple QuickTime Planar RGB with Alpha-channel;http://ffdshow-tryout.sourceforge.net/\n"
+ "AAS4;Autodesk;4CC;V;RGB;;Autodesk Animator Studio RLE (warning: this is a discoutinued product);http://mirror01.iptelecom.net.ua/~video/codecs/Autodesk.Animator.v1.11.Codec.exe\n"
+ "AASC;Autodesk;4CC;V;RGB;;Autodesk Animator Studio RLE (warning: this is a discoutinued product);http://mirror01.iptelecom.net.ua/~video/codecs/Autodesk.Animator.v1.11.Codec.exe\n"
+ "ABYR;Kensigton low;4CC;V;;;Kensington (low resolution, low frame rate (6fps) for digital cameras)\n"
+ "ACTL;ACT-L2;4CC;V;;;Streambox ACT-L2;http://www.streambox.com/products/act-L2_codec.htm\n"
+ "ADV1;WaveCodec;4CC;V;Wavelet;;Loronix WaveCodec;http://www.loronix.com/products/video_clips/wavecodec.asp\n"
+ "ADVJ;Avid;4CC;V;M-JPEG;;Avid M-JPEG. Aka AVRn\n"
+ "AEIK;Indeo 3.2;4CC;V;;;Intel Indeo Video 3.2 (Vector Quantization)\n"
+ "AEMI;VideoONE;4CC;V;MPEG-V;;Array VideoONE MPEG-1-I Capture. Array's used for I frame only MPEG-1 AVI files;http://www.array.com\n"
+ "AFLC;Autodesk;4CC;V;;;Autodesk Animator Studio FLI (256 color) (warning: this is a discoutinued product);http://mirror01.iptelecom.net.ua/~video/codecs/Autodesk.Animator.v1.11.Codec.exe\n"
+ "AFLI;Autodesk;4CC;V;;;Autodesk Animator Studio FLI (256 color) (warning: this is a discoutinued product);http://mirror01.iptelecom.net.ua/~video/codecs/Autodesk.Animator.v1.11.Codec.exe\n"
+ "AHDV;CineForm HD;4CC;V;Wavelet;;CineForm 10-bit Visually Perfect HD (Wavelet);http://www.cineform.com/products/ConnectHD.htm\n"
+ "AJPG;M-JPEG;4CC;V;M-JPEG;;22fps JPEG-based for digital cameras\n"
+ "ALPH;Ziracom;4CC;V;;;Ziracom Digital Communications Inc.\n"
+ "AMPG;VideoONE;4CC;V;MPEG-1;;Array VideoONE MPEG;http://www.array.com\n"
+ "AMR ;AMR;4CC;V;;;Speech codec\n"
+ "ANIM;RDX;4CC;V;;;Intel RDX\n"
+ "AP41;AngelPotion;4CC;V;MPEG-4V;;AngelPotion Definitive 1 (hack of MS MPEG-4 v3);http://www.divxity.com/download/ap4v1-702.exe\n"
+ "AP42;AngelPotion;4CC;V;MPEG-4V;;AngelPotion Definitive 2 (hack of MS MPEG-4 v3);http://www.divxity.com/download/ap4v1-702.exe\n"
+ "ASLC;AlparySoft Lossless;4CC;V;;;AlparySoft Lossless;http://www.free-codecs.com/download/Alparysoft_Lossless_Video_Codec.htm\n"
+ "ASV1;Asus 1;4CC;V;;;Asus Video 1;ftp://ftp.asuscom.de/pub/asuscom/treiber/vga/ASUS_VGA_TOOLS/asv2dec.zip\n"
+ "ASV2;Asus 2;4CC;V;;;Asus Video 2;ftp://ftp.asuscom.de/pub/asuscom/treiber/vga/ASUS_VGA_TOOLS/asv2dec.zip\n"
+ "ASVX;Asus X;4CC;V;;;Asus Video X;ftp://ftp.asuscom.de/pub/asuscom/treiber/vga/ASUS_VGA_TOOLS/asv2dec.zip\n"
+ "ATM4;Nero MPEG-4;4CC;V;MPEG-4V;;Ahead Nero Digital MPEG-4;http://www.nero.com\n"
+ "AUR2;YUV;4CC;V;YUV;;Auravision Aura 2 - YUV 422\n"
+ "AURA;YUV;4CC;V;YUV;;Auravision Aura 1 - YUV 411\n"
+ "AUVX;AUVX;4CC;V;;;USH GmbH\n"
+ "AV1X;Avid 1:1;4CC;V;;;Avid 1:1x (Quick Time);http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe\n"
+ "AVC1;AVC;4CC;V;AVC;;Advanced Video Codec;http://ffdshow-tryout.sourceforge.net/\n"
+ "AVD1;Avid DV;4CC;V;DV;;Avid DV (Quick Time);http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe\n"
+ "AVDJ;Avid JFIF;4CC;V;M-JPEG;;Avid Meridien JFIF with Alpha-channel;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe\n"
+ "AVDN;Avid HD;4CC;V;;;Avid DNxHD (Quick Time);http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe\n"
+ "AVDV;Avid DV;4CC;V;DV;;Avid DV;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe\n"
+ "AVI1;MainConcept;4CC;V;M-JPEG;;MainConcept M-JPEG\n"
+ "AVI2;MainConcept;4CC;V;M-JPEG;;MainConcept M-JPEG\n"
+ "AVID;Avid M-JPEG;4CC;V;M-JPEG;;Avid M-JPEG;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe\n"
+ "AVIS;AviSynth;4CC;V;;;Wrapper for AviSynth (Dummy);http://ffdshow-tryout.sourceforge.net/\n"
+ "AVMP;Avid IMX;4CC;V;;;Avid IMX (Quick Time);http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe\n"
+ "AVR ;Avid NuVista;4CC;V;M-JPEG;;Avid ABVB/NuVista M-JPEG with Alpha-channel\n"
+ "AVRn;Avid M-JPEG;4CC;V;M-JPEG;;Avid M-JPEG;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe\n"
+ "AVRN;Avid M-JPEG;4CC;V;M-JPEG;;Avid M-JPEG;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe\n"
+ "AVUI;Avid;4CC;V;;;Avid Meridien Uncompressed with Alpha-channel;http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe\n"
+ "AVUP;Avid;4CC;V;;;Avid 10bit Packed (Quick Time);http://mirror01.iptelecom.net.ua/~video/codecs/Avid.VfW.codec.v2.0d2.exe\n"
+ "AYUV;YUV;4CC;V;YUV;;4:4:4 YUV (AYUV)\n"
+ "AZPR;QuickTime;4CC;V;;;Quicktime Apple Video;http://www.apple.com/quicktime/download/standalone.html\n"
+ "AZRP;QuickTime;4CC;V;;;Quicktime Apple Video;http://www.apple.com/quicktime/download/standalone.html\n"
+ "BGR ;RGB;4CC;V;RGB;;Uncompressed RGB32\n"
+ "BHIV;BeHere iVideo;4CC;V;;;BeHere iVideo\n"
+ "BINK;Bink;4CC;V;;;RAD Game Tools Bink Video\n"
+ "BIT ;RGB;4CC;V;RGB;;Uncompressed. BI_BITFIELDS\n"
+ "BITM;H.261;4CC;V;;;Microsoft H.261\n"
+ "BLOX;Blox;4CC;V;;;Jan Jezabek BLOX MPEG;http://www.ii.uj.edu.pl/~jezabek/blox/blox-0.1.0b.zip\n"
+ "BLZ0;DivX;4CC;V;MPEG-4V;;DivX for Blizzard Decoder Filter;http://ffdshow-tryout.sourceforge.net/\n"
+ "BT20;MediaStream;4CC;V;;;Conexant ProSummer MediaStream\n"
+ "BTCV;Composite;4CC;V;;;Conexant Composite Video\n"
+ "BTVC;Composite;4CC;V;;;Conexant Composite Video\n"
+ "BW00;BergWave;4CC;V;Wavelet;;BergWave (Wavelet)\n"
+ "BW10;Broadway;4CC;V;MPEG-1;;Data Translation Broadway MPEG Capture/Compression\n"
+ "BXBG;Boxx RGB;4CC;V;;;BOXX BGR\n"
+ "BXRG;Boxx RGB;4CC;V;;;BOXX RGB\n"
+ "BXY2;Boxx YUV;4CC;V;;;BOXX 10-bit YUV\n"
+ "BXYV;Boxx YUV;4CC;V;;;BOXX YUV\n"
+ "CC12;Intel YUV;4CC;V;YUV;;Intel YUV12\n"
+ "CDV5;Canopus DV;4CC;V;DV;;Canopus SD50/DVHD;http://www.cineform.com/products/ConnectHD.htm\n"
+ "CDVC;Canopus DV;4CC;V;DV;;Canopus DV (DV);http://www.cineform.com/products/ConnectHD.htm\n"
+ "CDVH;Canopus DV;4CC;V;DV;;Canopus SD50/DVHD;http://www.cineform.com/products/ConnectHD.htm\n"
+ "CFCC;Perception;4CC;V;;;DPS Perception M-JPEG (dummy format - only AVI header)\n"
+ "CFHD;CineForm HD;4CC;V;;;CineForm 10-bit Visually Perfect HD (Wavelet)\n"
+ "CGDI;Camcorder;4CC;V;;;Camcorder Video (MS Office 97)\n"
+ "CHAM;Champagne;4CC;V;;;Winnov Caviara Champagne\n"
+ "CJPG;Creative M-JPEG;4CC;V;M-JPEG;;Creative Video Blaster Webcam Go JPEG\n"
+ "CLJR;YUV;4CC;V;YUV;;Cirrus Logic YUV 4:1:1;http://www.fourcc.org/indexyuv.htm\n"
+ "CLLC;Canopus;4CC;V;;;Canopus LossLess\n"
+ "CLPL;YUV;4CC;V;YUV;;Format similar to YV12 but including a level of indirection.\n"
+ "CM10;MediaShow;4CC;V;;;CyberLink Corporation;http://www.cyberlink.com\n"
+ "CMYK;CMYK;4CC;V;;;Common Data Format in Printing\n"
+ "COL0;MS MPEG-4 v3;4CC;V;MPEG-4V;;Hacked MS MPEG-4 v3;http://ffdshow-tryout.sourceforge.net/\n"
+ "COL1;MS MPEG-4 v3;4CC;V;MPEG-4V;;Hacked MS MPEG-4 v3;http://ffdshow-tryout.sourceforge.net/\n"
+ "CPLA;YUV;4CC;V;YUV;;Weitek YUV 4:2:0 Planar\n"
+ "CRAM;MS Video;4CC;V;;;Microsoft Video 1\n"
+ "CSCD;CamStudio;4CC;V;;;RenderSoft CamStudio lossless (LZO & GZIP compression)\n"
+ "CT10;TalkingShow;4CC;V;;;CyberLink Corporation;http://www.cyberlink.com\n"
+ "CTRX;Citrix;4CC;V;;;Citrix Scalable Video\n"
+ "CUVC;Canopus HQ;4CC;V;;;Canopus HQ\n"
+ "CVID;Cinepack;4CC;V;;;Cinepak by CTi (ex. Radius) Vector Quantization;http://www.cinepak.com/text.html\n"
+ "cvid;Cinepack;4CC;V;;;Cinepak by CTi (ex. Radius) Vector Quantization;http://www.apple.com/quicktime/download/standalone.html\n"
+ "CWLT;WLT;4CC;V;;;Microsoft Color WLT DIB\n"
+ "CYUV;YUV;4CC;V;YUV;;Creative Labs YUV 4:2:2;http://www.fourcc.org/indexyuv.htm\n"
+ "CYUY;YUV;4CC;V;YUV;;ATI Technologies YUV;http://www.fourcc.org/indexyuv.htm\n"
+ "D261;H.261;4CC;V;;;DEC H.261\n"
+ "D263;H.263;4CC;V;;;DEC H.263\n"
+ "DAVC;AVC;4CC;V;AVC;;Dicas MPEGable H.264/MPEG-4 AVC base profile\n"
+ "DC25;MainConcept DV;4CC;V;DV;;MainConcept ProDV\n"
+ "DCAP;Pinnacle DV25;4CC;V;DV;;Pinnacle DV25\n"
+ "DCL1;Data Connextion;4CC;V;;;Data Connection Conferencing\n"
+ "DCT0;WniWni;4CC;V;;;WniWni\n"
+ "DFSC;VFW;4CC;V;;;DebugMode FrameServer VFW\n"
+ "DIB ;RGB;4CC;V;RGB;;Device Independent Bitmap\n"
+ "DIV1;FFMpeg;4CC;V;MPEG-4V;;FFmpeg-4 V1 (hacked MS MPEG-4 V1);http://ffdshow-tryout.sourceforge.net/\n"
+ "DIV2;MS MPEG-4 1/2;4CC;V;MPEG-4V;;;http://ffdshow-tryout.sourceforge.net/\n"
+ "DIV3;DivX 3 Low;4CC;V;MPEG-4V;;;http://www.divx.com\n"
+ "DIV4;DivX 3 Fast;4CC;V;MPEG-4V;;;http://www.divx.com\n"
+ "DIV5;DivX 5;4CC;V;MPEG-4V;;;http://www.divx.com\n"
+ "DIV6;MS MPEG-4 v3;4CC;V;MPEG-4V;;MS MPEG-4 v3;http://ffdshow-tryout.sourceforge.net/\n"
+ "DIVX;DivX 4;4CC;V;MPEG-4V;;Project Mayo DivX 4;http://www.divx.com\n"
+ "divx;DivX;4CC;V;MPEG-4V;;Mainly used by Google;http://www.divx.com\n"
+ "DJPG;Broadway 101;4CC;V;M-JPEG;;Data Translation, Inc.\n"
+ "DM4V;Dicas;4CC;V;MPEG-4V;;Dicas MPEGable MPEG-4\n"
+ "DMB1;Rainbow;4CC;V;M-JPEG;;Matrox Rainbow Runner hardware compression;http://mirror01.iptelecom.net.ua/~video/codecs/PICVideo.MJPG.v2.10.27.codec.exe\n"
+ "DMB2;Paradigm M-JPEG;4CC;V;M-JPEG;;M-JPEG used by Paradigm\n"
+ "DMK2;V36 PDA;4CC;V;;;ViewSonic V36 PDA Video\n"
+ "DP02;DynaPel;4CC;V;MPEG-4V;;DynaPel MPEG-4\n"
+ "DP16;YUV411;4CC;V;YUV;;Matsushita Electric Industrial Co., Ltd. (With DPCM 6-bit compression)\n"
+ "DP18;YUV411;4CC;V;YUV;;Matsushita Electric Industrial Co., Ltd. (With DPCM 8-bit compression)\n"
+ "DP26;YUV422;4CC;V;YUV;;Matsushita Electric Industrial Co., Ltd. (With DPCM 6-bit compression)\n"
+ "DP28;YUV422;4CC;V;YUV;;Matsushita Electric Industrial Co., Ltd. (With DPCM 8-bit compression)\n"
+ "DP96;YVU9;4CC;V;YUV;;Matsushita Electric Industrial Co., Ltd. (With DPCM 6-bit compression)\n"
+ "DP98;YVU9;4CC;V;YUV;;Matsushita Electric Industrial Co., Ltd. (With DPCM 8-bit compression)\n"
+ "DP9L;YVU9;4CC;V;YUV;;Matsushita Electric Industrial Co., Ltd. (With DPCM 6-bit compression)\n"
+ "DPS0;DPS Reality;4CC;V;M-JPEG;;DPS Reality M-JPEG (dummy format - only AVI header)\n"
+ "DPSC;DPS PAR;4CC;V;M-JPEG;;DPS PAR M-JPEG (dummy format - only AVI header)\n"
+ "DRWX;Pinnacle DV25;4CC;V;DV;;Pinnacle DV25\n"
+ "DSVD;DV;4CC;V;DV;;Microsoft DirectShow DV\n"
+ "DTMT;Media-100;4CC;V;;;Media-100\n"
+ "DTNT;Media-100;4CC;V;;;Media-100\n"
+ "DUCK;TrueMotion S;4CC;V;;;Duck Corporation True Motion S\n"
+ "DV10;BlueFish;4CC;V;;;BlueFish444 (lossless RGBA, YUV 10-bit)\n"
+ "DV25;DVCPro;4CC;V;DV;;Matrox DVCPRO\n"
+ "DV50;DVCPro5;4CC;V;DV;;Matrox \n"
+ "DVAN;Pinnacle DV300;4CC;V;DV;;Pinnacle miroVideo DV300 SW only\n"
+ "DVC ;Apple DV NTSC;4CC;V;DV;;Apple QuickTime DV (DVCPRO NTSC);http://www.apple.com/quicktime/download/standalone.html\n"
+ "dvc ;Apple DV NTSC;4CC;V;DV;;Apple QuickTime DV (DVCPRO NTSC);http://www.apple.com/quicktime/download/standalone.html\n"
+ "DVCP;Apple DV PAL;4CC;V;DV;;Apple QuickTime DV (DVCPRO PAL);http://www.apple.com/quicktime/download/standalone.html\n"
+ "dvcp;Apple DV PAL;4CC;V;DV;;Apple QuickTime DV (DVCPRO PAL);http://www.apple.com/quicktime/download/standalone.html\n"
+ "DVCS;MainConcept DV;4CC;V;DV;;MainConcept DV\n"
+ "DVE2;Insoft DVE-2;4CC;V;DV;;InSoft DVE-2 Videoconferencing\n"
+ "DVH1;Pinnacle DV;4CC;V;DV;;Pinnacle DVHD100\n"
+ "dvhd;DV HD;4CC;V;DV;;DV 1125 lines at 30.00 Hz or 1250 lines at 25.00 Hz\n"
+ "dvhd;DV HD;4CC;A;DV;;Sony DV (DV), audio part\n"
+ "DVIS;DualMoon DV;4CC;V;DV;;VSYNC DualMoon Iris DV\n"
+ "DVL ;Radius DV NTSC;4CC;V;DV;;Radius SoftDV 16:9 NTSC\n"
+ "DVLP;Radius DV PAL;4CC;V;DV;;Radius SoftDV 16:9 PAL\n"
+ "DVMA;Darim DV;4CC;V;DV;;Darim Vision DVMPEG (dummy for MPEG compressor)\n"
+ "DVNM;DVNM;4CC;V;;;Matsushita Electric Industrial Co., Ltd.\n"
+ "DVOR;BlueFish;4CC;V;;;BlueFish444 (lossless RGBA, YUV 10-bit)\n"
+ "DVPN;Apple DV NTSC;4CC;V;DV;;Apple QuickTime DV (DV NTSC)\n"
+ "DVPP;Apple DV PAL;4CC;V;DV;;Apple QuickTime DV (DV PAL)\n"
+ "DVR ;MPEG-2 Video;4CC;V;MPEG-2;;MPEG-2 Video in a ASF container\n"
+ "DVR1;Targa2000;4CC;V;;;TARGA2000\n"
+ "DVRS;DualMoon DV;4CC;V;DV;;VSYNC DualMoon Iris DV\n"
+ "DVSD;DV;4CC;V;DV;;IEC 61834 and SMPTE 314M\n"
+ "dvsd;Sony DV;4CC;V;DV;;Sony DV (DV) 525 lines at 29.97 Hz or 625 lines at 25.00 Hz\n"
+ "dvsd;Sony DV;4CC;A;DV;;Sony DV (DV), audio part\n"
+ "dvsl;Sony DV;4CC;V;DV;;Sony DV (DV) 525 lines at 29.97 Hz or 625 lines at 25.00 Hz\n"
+ "dvsl;Sony DV;4CC;A;DV;;Sony DV (DV), audio part\n"
+ "DVSL;DSL DV;4CC;V;DV;;DV compressed in SD (SDL)\n"
+ "DVX1;DVX 1 SP;4CC;V;;;Lucent DVX1000SP Video Decoder\n"
+ "DVX2;DVX 2 S;4CC;V;;;Lucent DVX2000S Video Decoder\n"
+ "DVX3;DVX 3 S;4CC;V;;;Lucent DVX3000S Video Decoder\n"
+ "DX50;DivX 5;4CC;V;MPEG-4V;;;http://www.divx.com\n"
+ "DXGM;EA GameVideo;4CC;V;;;Electronic Arts Game Video\n"
+ "DXSB;DivX.com Subtitle;4CC;T;;;Subtitle in AVI from DivX networks;http://www.divx.com\n"
+ "DXT1;DirectX TC;4CC;V;;;DirectX Compressed Texture (1bit alpha channel)\n"
+ "DXT2;DirectX TC;4CC;V;;;DirectX Compressed Texture\n"
+ "DXT3;DirectX TC;4CC;V;;;DirectX Compressed Texture (4bit alpha channel)\n"
+ "DXT4;DirectX TC;4CC;V;;;DirectX Compressed Texture\n"
+ "DXT5;DirectX TC;4CC;V;;;DirectX Compressed Texture (3bit alpha channel with interpolation)\n"
+ "DXTC;DirectX TC;4CC;V;;;DirectX Texture Compression\n"
+ "DXTn;DirectX TC;4CC;V;;;Microsoft Compressed Texture\n"
+ "DXTN;DirectX TC;4CC;V;;;Microsoft DirectX Compressed Texture (DXTn)\n"
+ "EKQ0;Elsa KQ;4CC;V;;;Elsa graphics card quick\n"
+ "ELK0;Elsa LK;4CC;V;;;Elsa graphics card\n"
+ "EM2V;Elymonyx MPEG-2;4CC;V;;;Etymonix MPEG-2 I-frame\n"
+ "EMWC;WMA;;A;;;EverAd, Inc.\n"
+ "EQK0;Elsa;4CC;V;;;Elsa graphics card quick\n"
+ "ESCP;Escape;4CC;V;;;Eidos Escape\n"
+ "ETV1;eTreppid 1;4CC;V;;;eTreppid Video 1\n"
+ "ETV2;eTreppid 2;4CC;V;;;eTreppid Video 2\n"
+ "ETVC;eTreppid C;4CC;V;;;eTreppid Video C\n"
+ "FFDS;FFDS;4CC;V;;;FFDShow supported;http://ffdshow-tryout.sourceforge.net/\n"
+ "FFV1;FFV1;4CC;V;;;FFDShow supported;http://ffdshow-tryout.sourceforge.net/\n"
+ "FFVH;FFVH;4CC;V;;;FFDShow supported;http://ffdshow-tryout.sourceforge.net/\n"
+ "FLIC;FLI/FLC;4CC;V;;;Autodesk FLI/FLC Animation\n"
+ "FLJP;DField M-JPEG;4CC;V;;;D-Vision Field Encoded M-JPEG with LSI (or Targa emulation)\n"
+ "FLV1;FFDS;4CC;V;;;FFDShow supported;http://ffdshow-tryout.sourceforge.net/\n"
+ "FLV4;VP6;4CC;V;;;Flash, On2 Technologies;http://www.on2.com\n"
+ "FMJP;D-Vision M-JPEG;4CC;V;;;D-Vision fieldbased ISO M-JPEG\n"
+ "FMP4;MPEG-4 Visual;4CC;V;MPEG-4V;;;http://ffdshow-tryout.sourceforge.net/\n"
+ "FPS1;FRAPS;4CC;V;;;;http://www.fraps.com/\n"
+ "FRLE;SoftLab-Nsk M-JPEG;4CC;V;;;SoftLab-NSK Y16 + Alpha RLE\n"
+ "FRWA;SoftLab-Nsk M-JPEG (w Alpha);4CC;V;;;SoftLab-NSK Vision Forward M-JPEG with Alpha-channel\n"
+ "FRWD;SoftLab-Nsk M-JPEG;4CC;V;;;SoftLab-NSK Vision Forward M-JPEG\n"
+ "FRWT;SoftLab-Nsk M-JPEG;4CC;V;;;SoftLab-NSK Vision Forward M-JPEG with Alpha-channel\n"
+ "FRWU;SoftLab-Nsk M-JPEG;4CC;V;;;SoftLab-NSK Vision Forward Uncompressed\n"
+ "FVF1;Itered Fractal;4CC;V;;;Iterated Systems Fractal Video Frame\n"
+ "FVFW;FVFW;4CC;V;;;FFDShow supported;http://ffdshow-tryout.sourceforge.net/\n"
+ "FXT1;3DFX;4CC;V;;;3dfx Interactive, Inc.\n"
+ "G2M2;GoToMeeting2;4CC;V;;;Citrix Systems, Inc.;http://www.gotomeeting.com/\n"
+ "G2M3;GoToMeeting3;4CC;V;;;Citrix Systems, Inc.;http://www.gotomeeting.com/\n"
+ "GEPJ;White Pine M-JPEG;4CC;V;;;White Pine M-JPEG\n"
+ "GJPG;Grand Tech GT891x;4CC;V;;;Grand Tech GT891x\n"
+ "GLCC;GigaLink;4CC;V;;;GigaLink AV Capture\n"
+ "GLZW;Gabest;4CC;V;;;Motion LZW by Gabest;http://sourceforge.net/project/showfiles.php?group_id=82303&package_id=84358\n"
+ "GPEG;Gabest;4CC;V;M-JPEG;;M-JPEG by Gabest (with floating point);http://sourceforge.net/project/showfiles.php?group_id=82303&package_id=84358\n"
+ "GPJM;Pinnacle M-JPEG;4CC;V;M-JPEG;;Pinnacle ReelTime M-JPEG\n"
+ "GREY;YUV;4CC;V;YUV;;Simple grayscale video;http://www.fourcc.org/indexyuv.htm\n"
+ "GWLT;MS GWLT;4CC;V;;;Microsoft Greyscale WLT DIB\n"
+ "GXVE;ViVD V2;4CC;V;;;SoftMedia\n"
+ "H260;Intel H.260;4CC;V;;;Intel H.260\n"
+ "H261;Intel H.261;4CC;V;;;Intel H.261\n"
+ "H262;Intel H.262;4CC;V;;;Intel H.262\n"
+ "H263;Intel H.263;4CC;V;;;Intel H.263\n"
+ "H264;AVC;4CC;V;AVC;;Intel H.264\n"
+ "h264;AVC;4CC;V;AVC;;Intel H.264\n"
+ "H265;Intel H.265;4CC;V;;;Intel H.265\n"
+ "H266;Intel H.266;4CC;V;;;Intel H.266\n"
+ "H267;Intel H.267;4CC;V;;;Intel H.267\n"
+ "H268;Intel H.268;4CC;V;;;Intel H.268\n"
+ "H269;Intel H.263;4CC;V;;;Intel H.263 for POTS-based videoconferencing\n"
+ "HD10;BlueFish;4CC;V;;;BlueFish444 (lossless RGBA, YUV 10-bit)\n"
+ "HDX4;Jomigo;4CC;V;;;Jomigo HDX4\n"
+ "HFYU;Huffman;4CC;V;;;Huffman Lossless YUV and RGB formats (with Alpha-channel)\n"
+ "HMCR;Rendition;4CC;V;;;Rendition Motion Compensation Format\n"
+ "HMRR;Rendition;4CC;V;;;Rendition Motion Compensation Format\n"
+ "i263;Intel H.263;4CC;V;;;Intel H.263\n"
+ "I420;YUV;4CC;V;;;Intel Indeo 4 H.263\n"
+ "IAN ;Indeo 4;4CC;V;;;Intel Indeo 4\n"
+ "ICLB;CellB;4CC;V;;;InSoft CellB Videoconferencing\n"
+ "IDM0;Wavelets 2;4CC;V;;;IDM Motion Wavelets 2.0\n"
+ "IF09;H.261;4CC;V;;;Microsoft H.261\n"
+ "IFO9;YUV9;4CC;V;YUV;;Intel\n"
+ "IGOR;PowerDVD;4CC;V;;;Power DVD\n"
+ "IJPG;Intergraph M-JPEG;4CC;V;M-JPEG;;Intergraph\n"
+ "ILVC;Layered Video;4CC;V;;;Intel Layered Video\n"
+ "ILVR;H.263+;4CC;V;;;Intel H.263+\n"
+ "IMAC;MotionComp;4CC;V;;;Intel hardware motion compensation.\n"
+ "IMC1;YUV;4CC;V;YUV;;As YV12, except the U and V planes each have the same stride as the Y plane\n"
+ "IMC2;YUV;4CC;V;YUV;;Similar to IMC1, except that the U and V lines are interleaved at half stride boundaries\n"
+ "IMC3;YUV;4CC;V;YUV;;As IMC1, except that U and V are swapped\n"
+ "IMC4;YUV;4CC;V;YUV;;As IMC2, except that U and V are swapped\n"
+ "IMG ;YUV;4CC;V;YUV\n"
+ "IMJG;Accom M-JPEG;4CC;V;;;Accom SphereOUS M-JPEG with Alpha-channel\n"
+ "IPDV;I-O DV;4CC;V;;;I-O Data Device Giga AVI DV\n"
+ "IPJ2;JPEG2000;4CC;V;;;Image Power JPEG2000\n"
+ "IR21;Indeo 2.1;4CC;V;;;Intel Indeo 2.1\n"
+ "IRAW;YUV;4CC;V;YUV;;Intel YUV Uncompressed;http://www.fourcc.org/indexyuv.htm\n"
+ "ISME;ISME;4CC;V;;;Intel\n"
+ "IUYV;YUV;4CC;V;YUV;;Lead 16bpp. Interlaced version of UYVY (line order 0, 2, 4,....,1, 3, 5....)\n"
+ "IV30;Indeo 3;4CC;V;;;Intel Indeo Video 3\n"
+ "IV31;Indeo 3;4CC;V;;;Intel Indeo Video 3.1\n"
+ "IV32;Indeo 3;4CC;V;;;Intel Indeo Video 3.2\n"
+ "IV33;Indeo 3;4CC;V;;;Intel Indeo Video 3.3\n"
+ "IV34;Indeo 3;4CC;V;;;Intel Indeo Video 3.4\n"
+ "IV35;Indeo 3;4CC;V;;;Intel Indeo Video 3.5\n"
+ "IV36;Indeo 3;4CC;V;;;Intel Indeo Video 3.6\n"
+ "IV37;Indeo 3;4CC;V;;;Intel Indeo Video 3.7\n"
+ "IV38;Indeo 3;4CC;V;;;Intel Indeo Video 3.8\n"
+ "IV39;Indeo 3;4CC;V;;;Intel Indeo Video 3.9\n"
+ "IV40;Indeo 4;4CC;V;;;Intel Indeo Video 4.0\n"
+ "IV41;Indeo 4;4CC;V;;;Intel Indeo Video 4.1\n"
+ "IV42;Indeo 4;4CC;V;;;Intel Indeo Video 4.2\n"
+ "IV43;Indeo 4;4CC;V;;;Intel Indeo Video 4.3\n"
+ "IV44;Indeo 4;4CC;V;;;Intel Indeo Video 4.4\n"
+ "IV45;Indeo 4;4CC;V;;;Intel Indeo Video 4.5\n"
+ "IV46;Indeo 4;4CC;V;;;Intel Indeo Video 4.6\n"
+ "IV47;Indeo 4;4CC;V;;;Intel Indeo Video 4.7\n"
+ "IV48;Indeo 4;4CC;V;;;Intel Indeo Video 4.8\n"
+ "IV49;Indeo 4;4CC;V;;;Intel Indeo Video 4.9\n"
+ "IV50;Indeo 4;4CC;V;;;Intel Indeo Video 5.0 Wavelet;http://www.fourcc.org/indexyuv.htm\n"
+ "IY41;YUV;4CC;V;YUV;;Lead 16bpp. Interlaced version of Y41P (line order 0, 2, 4,....,1, 3, 5....);http://www.fourcc.org/indexyuv.htm\n"
+ "IYU1;YUV;4CC;V;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\n"
+ "IYU2;YUV;4CC;V;YUV;;IEEE1394 24bpp. 24 bit format used in mode 2 of the IEEE 1394 Digital Camera 1.04 spec\n"
+ "IYUV;YUV;4CC;V;YUV;;Intel Indeo iYUV 4:2:0\n"
+ "JBYR;Kensington;4CC;V;;;Kensington Video;http://ffdshow-tryout.sourceforge.net/\n"
+ "JFIF;M-JPEG;4CC;V;M-JPEG;;FFDShow supported\n"
+ "JPEG;M-JPEG;4CC;V;M-JPEG;;JPEG compressed;http://www.apple.com/quicktime/download/standalone.html\n"
+ "jpeg;M-JPEG;4CC;V;M-JPEG;;JPEG compressed\n"
+ "JPG;M-JPEG;4CC;V;M-JPEG;;JPEG compressed;http://mirror01.iptelecom.net.ua/~video/codecs/PICVideo.Lossless.JPEG.codec.v2.10.27.exe\n"
+ "JPGL;Pegasus M-JPEG;4CC;V;;;DIVIO JPEG Light for WebCams (Pegasus Lossless JPEG)\n"
+ "KMVC;Karl;4CC;V;;;Karl Morton's Video (presumably);http://www.apple.com/quicktime/download/standalone.html\n"
+ "kpcd;Photo CD;4CC;V;;;Kodak Photo CD\n"
+ "L261;H.261;4CC;V;;;Lead Technologies H.261\n"
+ "L263;H.263+;4CC;V;;;Lead Technologies H.263\n"
+ "LAGS;Lagarith;4CC;V;;;Lagarith LossLess\n"
+ "LBYR;Creative WebCam;4CC;V;;;Creative WebCam\n"
+ "LCMW;Lead CMW;4CC;V;;;Lead Technologies Motion CMW\n"
+ "LCW2;Lead MCMW;4CC;V;;;LEADTools MCMW 9Motion Wavelet;http://mirror01.iptelecom.net.ua/~video/codecs/LEAD.MCMP-M-JPEG.v1.016.codec.exe\n"
+ "LEAD;Lead Video;4CC;V;;;LEAD Video\n"
+ "LGRY;Lead GrayScale;4CC;V;;;Lead Technologies Grayscale Image\n"
+ "LIA1;Liafail;4CC;V;;;Liafail, Inc.\n"
+ "LJ2K;Lead JPEG2000;4CC;V;;;LEADTools JPEG2000;http://mirror01.iptelecom.net.ua/~video/codecs/LEAD.MCMP-M-JPEG.v1.016.codec.exe\n"
+ "LJPG;Lead M-JPEG;4CC;V;M-JPEG;;LEAD M-JPEG;http://mirror01.iptelecom.net.ua/~video/codecs/LEAD.MCMP-M-JPEG.v1.016.codec.exe\n"
+ "Ljpg;Lead M-JPEG;4CC;V;M-JPEG;;LEAD M-JPEG\n"
+ "LMP2;Lead MPEG-2;4CC;V;;;LEADTools MPEG-2\n"
+ "LOCO;LOCO;4CC;V;;;LOCO Lossless\n"
+ "LSCR;Lead Screen capture;4CC;V;;;LEAD Screen Capture\n"
+ "LSV0;LSV0;4CC;V;;;Infinop Inc.\n"
+ "LSVC;Vmail;4CC;V;;;Vianet Lighting Strike Vmail (Streaming)\n"
+ "LSVM;Vmail;4CC;V;;;Vianet Lighting Strike Vmail (Streaming)\n"
+ "LSVW;Infinop;4CC;V;;;Infinop Lightning Strike multiple bit rate video codec.\n"
+ "LSVX;Vmail;4CC;V;;;Vianet Lightning Strike Video Codec\n"
+ "LZO1;LZO;4CC;V;;;LZO compressed (lossless)\n"
+ "M101;YUV;4CC;V;YUV;;Matrox\n"
+ "M261;H.261;4CC;V;;;Microsoft H.261\n"
+ "M263;H.263;4CC;V;;;Microsoft H.263\n"
+ "M4CC;ESS Divo;4CC;V;MPEG-4V;;ESS MPEG-4 Divio\n"
+ "M4S2;FFmpeg MPEG-4;4CC;V;;;Microsoft MPEG-4 (hacked MS MPEG-4)\n"
+ "MC12;ATI Motion;4CC;V;;;ATI Motion Compensation Format\n"
+ "MC24;MainConcept M-JPEG;4CC;V;M-JPEG;;MainConcept M-JPEG\n"
+ "MCAM;ATI Motion;4CC;V;;;ATI Motion Compensation Format\n"
+ "MCZM;RGB;4CC;V;RGB;;Theory MicroCosm Lossless 64bit RGB with Alpha-channel\n"
+ "MDVD;MicroDVD;4CC;V;;;Alex MicroDVD Video (hacked MS MPEG-4)\n"
+ "MDVF;Pinnacle DV;4CC;V;DV;;Pinnacle DV/DV50/DVHD100\n"
+ "MHFY;YUB;4CC;V;YUV;;A.M.Paredes mhuffyYUV (LossLess);http://mirror01.iptelecom.net.ua/~video/codecs/Pinnacle.ReelTime.v2.5.software.only.codec.exe\n"
+ "MJ2C;JPEG2000;4CC;V;;;Morgan Multimedia JPEG2000 Compression;http://mirror01.iptelecom.net.ua/~video/codecs/Pinnacle.ReelTime.v2.5.software.only.codec.exe\n"
+ "MJPA;Pinacle M-JPEG A;4CC;V;;;Pinnacle ReelTime MJPG hardware;http://mediaxw.sourceforge.net\n"
+ "MJPB;Pinacle M-JPEG B;4CC;V;M-JPEG;;M-JPEG\n"
+ "MJPG;M-JPEG;4CC;V;M-JPEG;;M-JPEG including Huffman Tables\n"
+ "mJPG;IBM M-JPEG (w Huffman);4CC;V;M-JPEG;;IBM M-JPEG including Huffman Tables\n"
+ "MJPX;Pegasus M-JPEG;4CC;V;;;Pegasus PICVideo M-JPEG\n"
+ "ML20;Webcam;4CC;V;;;Mimic MSN Messenger Webcam\n"
+ "MMES;Matrox MPEG-2;4CC;V;MPEG-V;;Matrox MPEG-2 I-frame\n"
+ "MMIF;Matrox MPEG-2;4CC;V;MPEG-V;;Matrox MPEG-2 I-frame\n"
+ "MNVD;MindVid;4CC;V;;;MindBend MindVid LossLess\n"
+ "MP2A;MPEG-2 Audio;4CC;A;MPEG-A;;Media Excel MPEG-2 Audio\n"
+ "MP2T;MPEG-2 TS;4CC;M;MPEG-TS;;Media Excel MPEG-2 Transport Stream\n"
+ "MP2V;MPEG-2 Video;4CC;V;MPEG-V;;Media Excel MPEG-2 Video;http://ffdshow-tryout.sourceforge.net/\n"
+ "MP2v;MPEG-2 Video;4CC;V;MPEG-V;;MPEG-2 Video;http://ffdshow-tryout.sourceforge.net/\n"
+ "MP41;S-Mpeg 4 v1;4CC;V;;;Microsoft MPEG-4 V1 (enhansed H263);http://ffdshow-tryout.sourceforge.net/\n"
+ "MP42;S-Mpeg 4 v2;4CC;V;;;Microsoft MPEG-4 V2;http://www.apple.com/quicktime/download/standalone.html\n"
+ "MP43;S-Mpeg 4 v3;4CC;V;;;Microsoft MPEG-4 V3\n"
+ "mp4a;AAC;4CC;A;AAC;;AAC;http://ffdshow-tryout.sourceforge.net/\n"
+ "MP4A;MPEG-4 Audio;4CC;A;AAC;;Media Excel MPEG-4 Audio;http://www.apple.com/quicktime/download/standalone.html\n"
+ "MP4S;MS MPEG-4 v3;4CC;V;MPEG-4V;;Microsoft MPEG-4 (Windows Media 7.0)\n"
+ "mp4s;MPEG-4 TS;4CC;M;MPEG-TS;;(MPEG-4) Apple MPEG-4 Transport Stream;http://ffdshow-tryout.sourceforge.net/\n"
+ "MP4T;MPEG-4 TS;4CC;M;MPEG-TS;;Media Excel MPEG-4 Transport Stream;http://www.apple.com/quicktime/download/standalone.html\n"
+ "MP4V;MPEG-4 Video;4CC;V;MPEG-4V;;Apple QuickTime MPEG-4 native;http://ffdshow-tryout.sourceforge.net/\n"
+ "mp4v;MPEG-4 Video;4CC;V;MPEG-4V;;(MPEG-4) Apple MPEG-4 Video;http://www.apple.com/quicktime/download/standalone.html\n"
+ "MPEG;MPEG;4CC;V;MPEG-V;;Chromatic MPEG 1 Video I Frame;http://ffdshow-tryout.sourceforge.net/\n"
+ "mpeg;MPEG;4CC;V;MPEG-V;;MPEG-1 Video;http://ffdshow-tryout.sourceforge.net/\n"
+ "MPG1;FFmpeg MPEG 1/2;4CC;V;MPEG-V;;(MPEG-1/2) FFmpeg;http://ffdshow-tryout.sourceforge.net/\n"
+ "MPG2;FFmpeg MPEG 1/2;4CC;V;MPEG-V;;(MPEG-1/2) FFmpeg;http://ffdshow-tryout.sourceforge.net/\n"
+ "MPG3;FFmpeg DivX 3;4CC;V;MPEG-4V;;(MPEG-4) MS MPEG-4 v3\n"
+ "MPG4;MS MPEG-4 v1;4CC;V;MPEG-4V;;Microsoft MPEG-4 v1\n"
+ "MPGI;Sigma MPEG;4CC;V;MPEG-V;;Sigma Design MPEG-1 I-frame\n"
+ "MPNG;PNG;4CC;V;RGB;;Motion PNG\n"
+ "MRCA;Mrcodec;4CC;V;;;FAST Multimedia\n"
+ "MRLE;RLE;4CC;V;RGB;;Microsoft RLE\n"
+ "MSS1;Windows Screen Video;4CC;V;;;Windows Screen Video\n"
+ "MSS2;Windows Media;4CC;V;;;Windows Media 9\n"
+ "MSUC;MSU;4CC;V;;;MSU LossLess\n"
+ "MSUD;MSU;4CC;V;;;MSU LossLess\n"
+ "MSV1;Microsoft Video 1;4CC;V;;;Microsoft Video 1\n"
+ "MSVC;Microsoft Video 1;4CC;V;;;Microsoft Video 1\n"
+ "MSZH;AVImszh;4CC;V;;;Lossless (ZIP compression)\n"
+ "MTGA;TGA;4CC;V;RGB;;Motion TGA images (24, 32 bpp)\n"
+ "MTX1;Matrox M-JPEG;4CC;V;M-JPEG;;Matrox M-JPEG\n"
+ "MTX2;Matrox M-JPEG;4CC;V;M-JPEG;;Matrox M-JPEG\n"
+ "MTX3;Matrox M-JPEG;4CC;V;M-JPEG;;Matrox M-JPEG\n"
+ "MTX4;Matrox M-JPEG;4CC;V;M-JPEG;;Matrox M-JPEG\n"
+ "MTX5;Matrox M-JPEG;4CC;V;M-JPEG;;Matrox M-JPEG\n"
+ "MTX6;Matrox M-JPEG;4CC;V;M-JPEG;;Matrox M-JPEG\n"
+ "MTX7;Matrox M-JPEG;4CC;V;M-JPEG;;Matrox M-JPEG\n"
+ "MTX8;Matrox M-JPEG;4CC;V;M-JPEG;;Matrox M-JPEG\n"
+ "MTX9;Matrox M-JPEG;4CC;V;M-JPEG;;Matrox M-JPEG\n"
+ "MV10;Nokia;4CC;V;;;Nokia Mobile Phones\n"
+ "MV11;Nokia;4CC;V;;;Nokia Mobile Phones\n"
+ "MV12;MVI;4CC;V;;;Motion Pixels (old)\n"
+ "MV99;Nokia;4CC;V;;;Nokia Mobile Phones\n"
+ "MVC1;Nokia;4CC;V;;;Nokia Mobile Phones\n"
+ "MVC2;Nokia;4CC;V;;;Nokia Mobile Phones\n"
+ "MVC9;Nokia;4CC;V;;;Nokia Mobile Phones\n"
+ "MVI1;MVI;4CC;V;;;Motion Pixels MVI\n"
+ "MVI2;MVI;4CC;V;;;Motion Pixels MVI\n"
+ "MWV1;Aware Motion Wavelets;4CC;V;;;Aware Motion Wavelets\n"
+ "MYUV;RGB;4CC;V;RGB;;Media-100 844/X Uncompressed\n"
+ "NAVI;MS MPEG-4;4CC;V;MPEG-4V;;nAVI video (hacked MS MPEG-4)\n"
+ "NDIG;Ahead MPEG-4;4CC;V;MPEG-4V;;Ahead Nero Digital MPEG-4\n"
+ "NHVU;Nvidia Texture;4CC;V;;;Nvidia Texture Format (GEForce 3)\n"
+ "NO16;RGB;4CC;V;RGB;;Theory None16 64bit uncompressed Uncompressed\n"
+ "NT00;LightWave;4CC;V;YUV;;NewTek LightWave HDTV YUV with Alpha-channel\n"
+ "NTN1;NogaTech Video 1;4CC;V;;;Nogatech Video Compression 1\n"
+ "NTN2;NogaTech Video 2;4CC;V;;;Nogatech Video Compression 2 (GrabBee hardware coder)\n"
+ "NUV1;Nuppel;4CC;V;;;NuppelVideo\n"
+ "NV12;YUV;4CC;V;YUV;;8-bit Y plane followed by an interleaved U/V plane with 2x2 subsampling\n"
+ "NV21;YUV;4CC;V;YUV;;As NV12 with U and V reversed in the interleaved plane\n"
+ "NVDS;Nvidia Texture;4CC;V;;;Nvidia Texture Format\n"
+ "NVHS;Nvidia Texture;4CC;V;;;Nvidia Texture Format (GeForce 3)\n"
+ "NVHU;Nvidia Texture;4CC;V;;;Nvidia Texture Format\n"
+ "NVS0;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVS1;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVS2;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVS3;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVS4;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVS5;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVS6;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVS7;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVS8;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVS9;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVT0;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVT1;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVT2;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVT3;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVT4;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVT5;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVT6;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVT7;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVT8;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NVT9;Nvidia Texture;4CC;V;;;Nvidia Texture Compression Format\n"
+ "NY12;YUV;4CC;V;YUV;;Nogatech Ltd.\n"
+ "NYUV;YUV;4CC;V;YUV;;Nogatech Ltd.\n"
+ "ONYX;VP7;4CC;V;;;On2 VP7;http://www.on2.com/vp7.php3\n"
+ "PCLE;Studio400;4CC;V;;;Pinnacle Systems, Inc.\n"
+ "PDVC;Panasonic DV;4CC;V;DV;;Panasonic DV\n"
+ "PGVV;Radius Video Vision;4CC;V;;;Radius Video Vision Telecast (adaptive JPEG)\n"
+ "PHMO;Photomotion;4CC;V;;;IBM Photomotion\n"
+ "PIM1;Pegasus M-JPEG;4CC;V;M-JPEG;;Pinnacle DC1000 hardware (MPEG compression);http://mirror01.iptelecom.net.ua/~video/codecs/PICVideo.Lossless.JPEG.codec.v2.10.27.exe\n"
+ "PIM2;Pegasus M-JPEG;4CC;V;M-JPEG;;Pegasus Imaging;http://mirror01.iptelecom.net.ua/~video/codecs/PICVideo.Lossless.JPEG.codec.v2.10.27.exe\n"
+ "PIMJ;Pegasus M-JPEG;4CC;V;M-JPEG;;Pegasus Imaging PICvideo Lossless JPEG;http://mirror01.iptelecom.net.ua/~video/codecs/PICVideo.Lossless.JPEG.codec.v2.10.27.exe\n"
+ "PIXL;Miro M-JPEG;4CC;V;M-JPEG;;MiroVideo XL (M-JPEG)\n"
+ "PNG;PNG;4CC;V;RGB\n"
+ "PNG1;PNG;4CC;V;RGB;;Corecodec.org CorePNG\n"
+ "PVEZ;PowerEZ;4CC;V;;;Horizons Technology PowerEZ\n"
+ "PVMM;Pegasus MPEG-4;4CC;V;MPEG-4V;;PacketVideo Corporation MPEG-4\n"
+ "PVW2;Pegasus Wavelet;4CC;V;;;Pegasus Imaging Wavelet 2000\n"
+ "PVWV;Pegasus Wavelet;4CC;V;;;Pegasus Imaging Wavelet 2000\n"
+ "PXLT;Pixlet;4CC;V;;;Apple Pixlet (Wavelet)\n"
+ "Q1.0;QPEG 1.0;4CC;V;;;Q-Team QPEG 1.0;http://www.q-team.de\n"
+ "Q1.1;QPEG 1.1;4CC;V;;;Q-Team QPEG 1.1;http://www.q-team.de\n"
+ "Qclp;QCLP;4CC;A\n"
+ "QDGX;Apple GX;4CC;V;;;Apple QuickDUncompressed GX\n"
+ "QDM1;QDesign 1;4CC;A;;;QDesign Music 1\n"
+ "QDM2;Qdesign 2;4CC;A;;;QDesign Music 2\n"
+ "QDRW;Palettized Video;4CC;V;;;Apple\n"
+ "QPEG;QPEG 1.1;4CC;V;;;Q-Team QPEG 1.1\n"
+ "QPEQ;QPEG 1.1;4CC;V;;;Q-Team QPEG 1.1\n"
+ "R210;YUV;4CC;V;YUV;;BlackMagic YUV (Quick Time)\n"
+ "R411;Radius DV;4CC;V;DV;;Radius DV NTSC YUV\n"
+ "R420;Radius DV;4CC;V;DV;;Radius DV PAL YUV\n"
+ "RAV_;GroupTron;4CC;V;MPEG-1;;GroupTRON ReferenceAVI (dummy for MPEG compressor)\n"
+ "RAVI;GroupTron;4CC;V;MPEG-1;;GroupTRON ReferenceAVI (dummy for MPEG compressor)\n"
+ "RAW ;RGB;4CC;V;RGB;;Full Frames (Uncompressed)\n"
+ "raw ;RGB;4CC;V;RGB;;Full Frames (Uncompressed);http://www.apple.com/quicktime/download/standalone.html\n"
+ "RGB ;RGB;4CC;V;RGB;;Uncompressed RGB32\n"
+ "RGB1;RGB;4CC;V;RGB;;Uncompressed RGB332 3:3:2\n"
+ "RGBA;RGB;4CC;V;RGB;;Uncompressed w/ Alpha. Uncompressed RGB with alpha. Sample precision and packing is arbitrary and determined using bit masks for each component, as for BI_BITFIELDS.;http://www.fourcc.org/indexrgb.htm\n"
+ "RGBO;RGB;4CC;V;RGB;;Uncompressed RGB555 5:5:5\n"
+ "RGBP;RGB;4CC;V;RGB;;Uncompressed RGB565 5:6:5\n"
+ "RGBQ;RGB;4CC;V;RGB;;Uncompressed RGB555X 5:5:5 BE\n"
+ "RGBR;RGB;4CC;V;RGB;;Uncompressed RGB565X 5:6:5 BE\n"
+ "RGBT;RGB;4CC;V;RGB;;Uncompressed RGB with transparency;http://www.fourcc.org/indexrgb.htm\n"
+ "RIVA;Swizzled texture;4CC;V;;;Nvidia\n"
+ "RL4;RLE;4CC;V;RGB;;RLE 4bpp RGB\n"
+ "RL8;RLE;4CC;V;RGB;;RLE 8bpp RGB\n"
+ "RLE ;RLE;4CC;V;RGB;;RLE RGB with arbitrary sample packing within a pixel;http://www.fourcc.org/indexrgb.htm\n"
+ "rle ;Animation;4CC;V;RGB;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "RLE4;RLE;4CC;V;RGB;;RLE 4bpp RGB;http://www.fourcc.org/indexrgb.htm\n"
+ "RLE8;RLE;4CC;V;RGB;;RLE 8bpp RGB;http://www.fourcc.org/indexrgb.htm\n"
+ "RLND;Roland;4CC;V;;;Roland Corporation\n"
+ "RMP4;RealMagic MPEG-4;4CC;V;MPEG-4V;;REALmagic MPEG-4 Video (Sigma Design, built on XviD)\n"
+ "ROQV;Id RoQ;4CC;V;;;Id RoQ File Video Decoder\n"
+ "rpza;Road Pizza;4CC;V;;;Apple Video 16 bit road pizza;http://www.apple.com/quicktime/download/standalone.html\n"
+ "RT21;Intel Video 2.1;4CC;V;;;Intel Real Time Video 2.1\n"
+ "RTV0;NewTek VideoToaster;4CC;V;;;NewTek VideoToaster (dummy format - only AVI header)\n"
+ "RUD0;Rududu;4CC;V;;;Rududu video\n"
+ "RV10;RealVideo 1;4CC;V;;;H263, RealVideo 5;http://www.real.com\n"
+ "rv10;RealVideo 1;Real;V;;;H263, RealVideo 5;http://www.real.com\n"
+ "RV13;RealVideo 1;4CC;V;;;H263, RealVideo 5;http://www.real.com\n"
+ "rv20;RealVideo 2;Real;V;;;H263, RealVideo 6;http://www.real.com\n"
+ "RV20;RealVideo 2;4CC;V;;;H263, RealVideo 6;http://www.real.com\n"
+ "rv30;RealVideo 3;Real;V;;;Between H263 and H264, RealVideo 8;http://www.real.com\n"
+ "RV30;RealVideo 3;4CC;V;;;Between H263 and H264, RealVideo 8;http://www.real.com\n"
+ "rv40;RealVideo 4;Real;V;;;H264, RealVideo 9;http://www.real.com\n"
+ "RV40;RealVideo 4;4CC;V;;;H264, RealVideo 9;http://www.real.com\n"
+ "RVX ;RDX;4CC;V;;;Intel RDX\n"
+ "S263;S263;4CC;V;;;;http://ffdshow-tryout.sourceforge.net/\n"
+ "S422;VideoCap C210;4CC;V;YUV;;VideoCap C210\n"
+ "s422;VideoCap C210;4CC;V;YUV;;VideoCap C210\n"
+ "SAMR;AMR;4CC;A\n"
+ "SAN3;SAN3;4CC;V;MPEG-4V;;Direct copy of DivX 3.11\n"
+ "SANM;Smush v2;4CC;V;;;LucasArts;http://www.lucasarts.com/\n"
+ "SCCD;SoftCam;4CC;V\n"
+ "SDCC;Sun DV;4CC;V;DV;;Sun Digital Camera\n"
+ "SEDG;Samsung MPEG-4;4CC;V;MPEG-4V;;Samsung MPEG-4\n"
+ "SEG4;Cinepak;4CC;V;;;;http://www.sega.com/\n"
+ "SEGA;Cinepak;4CC;V;;;;http://www.sega.com/\n"
+ "SFMC;CrystalNet;4CC;V;;;CrystalNet Surface Fitting Method\n"
+ "SHR0;BitJazz SheerVideo;4CC;V;;;BitJazz SheerVideo (realtime lossless)\n"
+ "SHR1;BitJazz SheerVideo;4CC;V;;;BitJazz SheerVideo (realtime lossless)\n"
+ "SHR2;BitJazz SheerVideo;4CC;V;;;BitJazz SheerVideo (realtime lossless)\n"
+ "SHR3;BitJazz SheerVideo;4CC;V;;;BitJazz SheerVideo (realtime lossless)\n"
+ "SHR4;BitJazz SheerVideo;4CC;V;;;BitJazz SheerVideo (realtime lossless)\n"
+ "SHR5;BitJazz SheerVideo;4CC;V;;;BitJazz SheerVideo (realtime lossless)\n"
+ "SHR6;BitJazz SheerVideo;4CC;V;;;BitJazz SheerVideo (realtime lossless)\n"
+ "SHR7;BitJazz SheerVideo;4CC;V;;;BitJazz SheerVideo (realtime lossless)\n"
+ "SJPG;CuSeeMe;4CC;V;M-JPEG;;CuSeeMe;http://mirror01.iptelecom.net.ua/~video/codecs/CUseeMe.M-JPEG.CODEC.v1.17.exe\n"
+ "SL25;SoftLab DVCPro;4CC;V;;;SoftLab-NSK DVCPRO\n"
+ "SL50;SoftLab DVCPro5;4CC;V;;;SoftLab-NSK \n"
+ "SLDV;SoftLab DV;4CC;V;;;SoftLab-NSK Forward DV Draw\n"
+ "SLIF;SoftLab MPEG-2;4CC;V;MPEG-V;;SoftLab-NSK MPEG-2 I-frames\n"
+ "SLMJ;SoftLab M-JPEG;4CC;V;M-JPEG;;SoftLab-NSK Forward M-JPEG\n"
+ "smc ;SMC;4CC;V;;;Apple Graphics (SMC);http://www.apple.com/quicktime/download/standalone.html\n"
+ "SMSC;Radius;4CC;V\n"
+ "SMSD;Radius;4CC;V\n"
+ "SMSV;Wavelet Video;4CC;V;;;WorldConnect Wavelet Streaming Video\n"
+ "smsv;Wavelet Video;4CC;V;;;WorldConnect Wavelet Video\n"
+ "SNOW;Snow;4CC;V;;;;http://ffdshow-tryout.sourceforge.net/\n"
+ "SP40;SunPlus YUV;4CC;V;YUV;;SunPlus YUV\n"
+ "SP44;MegaCam;4CC;V;;;SunPlus Aiptek MegaCam\n"
+ "SP53;MegaCam;4CC;V;;;SunPlus Aiptek MegaCam\n"
+ "SP54;MegaCam;4CC;V;;;SunPlus Aiptek MegaCam\n"
+ "SP55;MegaCam;4CC;V;;;SunPlus Aiptek MegaCam\n"
+ "SP56;MegaCam;4CC;V;;;SunPlus Aiptek MegaCam\n"
+ "SP57;MegaCam;4CC;V;;;SunPlus Aiptek MegaCam\n"
+ "SP58;MegaCam;4CC;V;;;SunPlus Aiptek MegaCam\n"
+ "SP61;MegaCam;4CC;V;;;SunPlus Aiptek MegaCam\n"
+ "SPIG;Spigot;4CC;V;;;Radius Spigot\n"
+ "SPLC;ACM audio;4CC;V;;;Splash Studios ACM Audio\n"
+ "SPRK;Spark;4CC;V\n"
+ "SQZ2;VXTreme 2;4CC;V;;;Microsoft VXTreme Video V2\n"
+ "STVA;ST Imager;4CC;V;;;ST Microelectronics CMOS Imager Data (Bayer)\n"
+ "STVB;ST Imager;4CC;V;;;ST Microelectronics CMOS Imager Data (Nudged Bayer)\n"
+ "STVC;ST Imager;4CC;V;;;ST Microelectronics CMOS Imager Data (Bunched)\n"
+ "STVX;ST Imager;4CC;V;;;ST Microelectronics CMOS Imager Data (Extended Data Format)\n"
+ "STVY;ST Imager;4CC;V;;;ST Microelectronics CMOS Imager Data (Extended Data Format with Correction Data)\n"
+ "subp;VobSub;4CC;T;;;The same subtitle format used on DVDs\n"
+ "SV10;Sorenson;4CC;V;;;Sorenson Media Video R1\n"
+ "SVQ1;Sorenson 1;4CC;V;;;Sorenson Media Video 1 (Apple QuickTime 3)\n"
+ "SVQ2;Sorenson 2;4CC;V;;;Sorenson Media Video 2 (Apple QuickTime 4)\n"
+ "SVQ3;Sorenson 3;4CC;V;;;Sorenson Media Video 3 (Apple QuickTime 5)\n"
+ "SWC1;MainConcept M-JPEG;4CC;V;M-JPEG;;MainConcept M-JPEG\n"
+ "T420;Toshiba YUV;4CC;V;YUV;;Toshiba YUV 4:2:0\n"
+ "TGA ;Apple TGA;4CC;V;;;Apple TGA (with Alpha-channel)\n"
+ "THEO;Theora;4CC;V;;;FFVFW Supported\n"
+ "TIFF;Apple TIFF;4CC;V;;;Apple TIFF (with Alpha-channel)\n"
+ "TIM2;Pinnacle DVI;4CC;V;;;Pinnacle RAL DVI\n"
+ "TLMS;TeraLogic;4CC;V;;;TeraLogic Motion Intraframe\n"
+ "TLST;TeraLogic;4CC;V;;;TeraLogic Motion Intraframe\n"
+ "TM10;Duck;4CC;V;;;Duck TrueMotion\n"
+ "TM20;Duck 2;4CC;V;;;Duck TrueMotion 2.0\n"
+ "TM2A;Duck Archiver 2;4CC;V;;;Duck TrueMotion Archiver 2.0\n"
+ "TM2X;Duck 2;4CC;V;;;Duck TrueMotion 2X\n"
+ "TMIC;TeraLogic;4CC;V;;;TeraLogic Motion Intraframe\n"
+ "TMOT;Horizons TM S;4CC;V;;;Horizons Technology TrueMotion Video\n"
+ "TR20;Duck TM RT2;4CC;V;;;Duck TrueMotion RT 2.0\n"
+ "TRLE;Akula;4CC;V;;;Akula Alpha Pro Custom AVI (LossLess)\n"
+ "TSCC;TechSmith;4CC;V;;;TechSmith Screen Capture\n"
+ "TV10;Tecomac;4CC;V;;;Tecomac Low-Bit Rate\n"
+ "TVJP;Pinnacle/Truevision;4CC;V;;;TrueVision Field Encoded M-JPEG (Targa emulation)\n"
+ "TVMJ;Pinnacle/Truevision;4CC;V;;;Truevision TARGA M-JPEG Hardware (or Targa emulation)\n"
+ "TY0N;Trident;4CC;V;;;Trident Decompression Driver\n"
+ "TY2C;Trident;4CC;V;;;Trident Decompression Driver\n"
+ "TY2N;Trident;4CC;V;;;Trident Decompression Driver\n"
+ "U<Y ;Discreet YUV;4CC;V;YUV;;Discreet UC YUV 4:2:2:4 10 bit\n"
+ "U<YA;Discreet YUV;4CC;V;;;Discreet UC YUV 4:2:2:4 10 bit (with Alpha-channel)\n"
+ "U263;UB H.263;4CC;V;;;UB Video H.263/H.263+/H.263++ Decoder;http://eMajix.com\n"
+ "UCOD;ClearVideo;4CC;V;;;ClearVideo (fractal compression-based)\n"
+ "ULTI;Ultimotion;4CC;V;;;IBM Ultimotion\n"
+ "UMP4;UB MPEG-4;4CC;V;MPEG-4V;;UB Video MPEG 4;http://www.fourcc.org/indexyuv.htm\n"
+ "UYNV;YUV;4CC;V;YUV;;Nvidia 16bpp. A direct copy of UYVY registered by Nvidia to work around problems in some olds which did not like hardware which offered more than 2 UYVY surfaces.;http://www.fourcc.org/indexyuv.htm\n"
+ "UYVP;YUV;4CC;V;YUV;;Evans & Sutherland 24bpp. YCbCr 4:2:2 extended precision 10-bits per component in U0Y0V0Y1 order\n"
+ "UYVU;SoftLab YUV;4CC;V;YUV;;SoftLab-NSK Forward YUV;http://www.fourcc.org/indexyuv.htm\n"
+ "UYVY;YUV;4CC;V;YUV;;Uncompressed 16bpp. YUV 4:2:2 (Y sample at every pixel, U and V sampled at every second pixel horizontally on each line). A macropixel contains 2 pixels in 1 u_int32.\n"
+ "V210;Optibase;4CC;V;;;Optibase VideoPump 10-bit 4:2:2 Component YCbCr\n"
+ "V261;VX3000S;4CC;V;;;Lucent VX3000S\n"
+ "V422;Vitec YUV;4CC;V;YUV;;Vitec Multimedia YUV 4:2:2 as for UYVY, but with different component ordering within the u_int32 macropixel\n"
+ "V655;Vitec YUV;4CC;V;YUV;;Vitec Multimedia 16 bit YUV 4:2:2 (6:5:5) format\n"
+ "VBLE;MarcFD VBLE;4CC;V;;;MarcFD VBLE Lossless\n"
+ "VCR1;ATI Video 1;4CC;V;;;ATI VCR 1.0\n"
+ "VCR2;ATI Video 2;4CC;V;;;ATI VCR 2.0 (MPEG YV12)\n"
+ "VCR3;ATI Video 3;4CC;V;;;ATI VCR 3.0\n"
+ "VCR4;ATI Video 4;4CC;V;;;ATI VCR 4.0\n"
+ "VCR5;ATI Video 5;4CC;V;;;ATI VCR 5.0\n"
+ "VCR6;ATI Video 6;4CC;V;;;ATI VCR 6.0\n"
+ "VCR7;ATI Video 7;4CC;V;;;ATI VCR 7.0\n"
+ "VCR8;ATI Video 8;4CC;V;;;ATI VCR 8.0\n"
+ "VCR9;ATI Video 9;4CC;V;;;ATI VCR 9.0\n"
+ "VCWV;Wavelet;4CC;V;;;VideoCon\n"
+ "VDCT;VideoMaker RGB;4CC;V;RGB;;Video Maker Pro DIB\n"
+ "VDOM;VDOWave;4CC;V;;;VDONet Wave\n"
+ "VDOW;VDOLive;4CC;V;;;VDONet Live (H,263)\n"
+ "VDST;VirtualDub;4CC;V;;;VirtualDub remote frameclient ICM driver\n"
+ "VDTZ;YUV;4CC;V;YUV;;VideoTizer / Darim Vision YUV\n"
+ "VGPX;VGP;4CC;V;;;Alaris VideoGramPixel\n"
+ "VIDM;DivX 5 pro;4CC;V;MPEG-4V;;DivX 5.0 Pro Supported\n"
+ "VIDS;Vitec;4CC;V;;;Vitec Multimedia YUV 4:2:2;www.yks.ne.jp/~hori/\n"
+ "VIFP;VFAPI;4CC;V;;;Virtual Frame API (VFAPI dummy format)\n"
+ "VIV1;H.263;4CC;V;;;Vivo H.263\n"
+ "VIV2;H.263;4CC;V;;;Vivo H.263\n"
+ "VIVO;H.263;4CC;V;;;Vivo H.263\n"
+ "VIXL;Miro XL;4CC;V;M-JPEG;;Miro Video XL;http://mirror01.iptelecom.net.ua/~video/codecs/miroVIDEO-XL.codec.v2.2.exe\n"
+ "VJPG;JPEG;4CC;V;M-JPEG\n"
+ "VLV1;Videologic;4CC;V\n"
+ "VMNC;Vmware;4CC;V;;;;http://www.vmware.com/\n"
+ "VP30;VP3;4CC;V;;;On2 VP3\n"
+ "VP31;VP3;4CC;V;;;On2 VP3\n"
+ "VP40;VP4;4CC;V;;;On2 TrueCast VP4\n"
+ "VP50;VP5;4CC;V;;;On2 TrueCast VP5\n"
+ "VP60;VP6;4CC;V;;;On2 TrueCast VP6\n"
+ "VP61;VP6.1;4CC;V;;;On2 TrueCast VP6.1\n"
+ "VP62;VP6.2;4CC;V;;;On2 TrueCast VP6.2;http://ftp.pub.cri74.org/pub/win9x/video/codecs/VP6/vp6_vfw_codec.exe\n"
+ "VP70;VP7;4CC;V;;;On2 TrueMotion VP7\n"
+ "VP71;VP7;4CC;V;;;On2 TrueMotion VP7\n"
+ "VP72;VP7;4CC;V;;;On2 TrueMotion VP7\n"
+ "VQC1;Vector 1;4CC;V;;;Vector-quantised 1 (high compression) http://eprints.ecs.soton.ac.uk/archive/00001310/01/VTC97-js.pdf\n"
+ "VQC2;Vector 2;4CC;V;;;Vector-quantised 2 (high robustness against channel errors) http://eprints.ecs.soton.ac.uk/archive/00001310/01/VTC97-js.pdf\n"
+ "VQJP;VQ630;4CC;V;;;Dual-mode digital camera\n"
+ "VQS4;VQ110;4CC;V;;;DV camera\n"
+ "VR21;BlckMagic YUV;4CC;V;YUV;;BlackMagic YUV (Quick Time)\n"
+ "VSSH;AVC;4CC;V;AVC;;Vanguard VSS H.264\n"
+ "VSSV;Vanguard Video;4CC;V;;;Vanguard Software Solutions Video\n"
+ "VSSW;AVC;4CC;V;AVC;;Vanguard VSS H.264\n"
+ "VTLP;GGP;4CC;V;;;Alaris VideoGramPixel\n"
+ "VX1K;DVX 1 S;4CC;V;;;Lucent VX1000S Video\n"
+ "VX2K;DVX 2 S;4CC;V;;;Lucent VX2000S Video\n"
+ "VXSP;DVX 1 SP;4CC;V;;;Lucent VX1000SP Video\n"
+ "VYU9;YUV;4CC;V;YUV;;ATI YUV\n"
+ "VYUY;YUV;4CC;V;YUV;;ATI Packed YUV Data\n"
+ "WBVC;W9960;4CC;V;;;Winbond Electronics W9960\n"
+ "WHAM;Microsoft Video 1;4CC;V\n"
+ "WINX;Winnov;4CC;V\n"
+ "WJPG;Winbond M-JPEG;4CC;V;M-JPEG;;Winbond JPEG (AverMedia USB devices)\n"
+ "WMV1;WMV1;4CC;V;;;Windows Media Video 7;http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx\n"
+ "WMV2;WMV2;4CC;V;;;Windows Media Video 8;http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx\n"
+ "WMV3;WMV3;4CC;V;VC-1;;Windows Media Video 9;http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx\n"
+ "WMVA;WMV;4CC;V;VC-1;;Windows Media Video;http://ffdshow-tryout.sourceforge.net/\n"
+ "WMVP;WMV3;4CC;V;;;Windows Media Video V9\n"
+ "WNIX;WniWni;4CC;V;;;WniWni\n"
+ "WNV1;WinNov;4CC;V;;;WinNov Videum Hardware Compression;http://www.winnov.com/\n"
+ "WNVA;WinNov;4CC;V;;;WinNov Videum Hardware Compression;http://www.winnov.com/\n"
+ "WRLE;Apple BMP;4CC;V;RGB;;Apple QuickTime BMP\n"
+ "WRPR;AVideoTools;4CC;V;;;VideoTools VideoServer Client (wrapper for AviSynth)\n"
+ "WV1F;WV1F;4CC;V;;;;http://ffdshow-tryout.sourceforge.net/\n"
+ "WVC1;VC-1;4CC;V;VC-1;;Microsoft\n"
+ "WVLT;IllusionHope Wavelet 9/7;4CC;V;;;IllusionHope Wavelet 9/7\n"
+ "WVP2;WVP2;4CC;V;;;;http://ffdshow-tryout.sourceforge.net/\n"
+ "WZCD;iScan;4CC;V;;;CORE Co. Ltd.\n"
+ "WZDC;iSnap;4CC;V;;;CORE Co. Ltd.\n"
+ "X263;H.263;4CC;V;;;Xirlink H.263\n"
+ "x263;Xirlink;4CC;V\n"
+ "X264;AVC;4CC;V;AVC;;XiWave GNU GPL x264 MPEG-4\n"
+ "x264;AVC;4CC;V;AVC;;XiWave GNU GPL x264 MPEG-4\n"
+ "XJPG;Xirlink;4CC;V;M-JPEG;;Xirlink, Inc.\n"
+ "XLV0;NetXL Video;4CC;V;;;NetXL Inc. XL Video Decoder\n"
+ "XMPG;Xing MPEG;4CC;V;MPEG-V;;XING MPEG (I frame only)\n"
+ "XVID;XviD;4CC;V;MPEG-4V;;XviD project;http://www.xvid.org/Downloads.15.0.html\n"
+ "XVIX;XviD;4CC;V;MPEG-4V;;Based on XviD MPEG-4;http://www.xvid.org/Downloads.15.0.html\n"
+ "XWV0;XiWave Video;4CC;V;;;XiWave Video\n"
+ "XWV1;XiWave Video;4CC;V;;;XiWave Video\n"
+ "XWV2;XiWave Video;4CC;V;;;XiWave Video\n"
+ "XWV3;XiWave Video;4CC;V;;;XiWave Video (Xi-3 Video)\n"
+ "XWV4;XiWave Video;4CC;V;;;XiWave Video\n"
+ "XWV5;XiWave Video;4CC;V;;;XiWave Video\n"
+ "XWV6;XiWave Video;4CC;V;;;XiWave Video\n"
+ "XWV7;XiWave Video;4CC;V;;;XiWave Video\n"
+ "XWV8;XiWave Video;4CC;V;;;XiWave Video\n"
+ "XWV9;XiWave Video;4CC;V;;;XiWave Video\n"
+ "XXAN;Origin VideoGame;4CC;V;;;Origin Video (used in Wing Commander 3 and 4)\n"
+ "XYZP;PAL;4CC;V;;;Extended PAL format XYZ palette\n"
+ "Y211;YUV;4CC;V;YUV;;Packed YUV format with Y sampled at every second pixel across each line and U and V sampled at every fourth pixel\n"
+ "Y216;Targa YUV;4CC;V;YUV;;Pinnacle TARGA CineWave YUV (Quick Time)\n"
+ "Y411;YUV;4CC;V;YUV;;YUV 4:1:1 Packed\n"
+ "Y41B;YUV;4CC;V;YUV;;YUV 4:1:1 Planar\n"
+ "Y41P;YUV;4CC;V;YUV;;Conexant (ex Brooktree) YUV 4:1:1 Raw;http://www.fourcc.org/indexyuv.htm\n"
+ "Y41T;YUV;4CC;V;YUV;;Format as for Y41P, but the lsb of each Y component is used to signal pixel transparency\n"
+ "Y422;YUV;4CC;V;YUV;;Direct copy of UYVY as used by ADS Technologies Pyro WebCam firewire camera\n"
+ "Y42B;YUV;4CC;V;YUV;;YUV 4:2:2 Planar\n"
+ "Y42T;YUV;4CC;V;YUV;;Format as for UYVY, but the lsb of each Y component is used to signal pixel transparency\n"
+ "Y444;YUV;4CC;V;YUV;;IYU2 (iRez Stealth Fire camera)\n"
+ "Y8 ;GrayScale;4CC;V;;;Simple grayscale video\n"
+ "Y800;GrayScale;4CC;V;;;Simple grayscale video\n"
+ "YC12;YUV;4CC;V;YUV;;Intel YUV12;http://www.fourcc.org/indexyuv.htm\n"
+ "YCCK;YUV;4CC;V;YUV\n"
+ "YMPG;MPEG-2;4CC;V;MPEG-2;;YMPEG Alpha (dummy for MPEG-2 compressor)\n"
+ "YU12;YUV;4CC;V;YUV;;ATI YV12 4:2:0 Planar\n"
+ "YU92;YUV;4CC;V;YUV;;Intel - YUV\n"
+ "YUNV;YUV;4CC;V;YUV;;A direct copy of YUY2 registered by Nvidia to work around problems in some olds which did not like hardware that offered more than 2 YUY2 surfaces\n"
+ "YUV2;YUV;4CC;V;YUV;;Apple Component Video (YUV 4:2:2);http://www.apple.com/quicktime/download/standalone.html\n"
+ "YUV8;YUV;4CC;V;YUV;;Winnov Caviar YUV8 ;http://www.fourcc.org/indexyuv.htm\n"
+ "YUV9;YUV;4CC;V;YUV;;Intel YUV9\n"
+ "YUVP;YUV;4CC;V;YUV;;YCbCr 4:2:2 extended precision 10-bits per component in Y0U0Y1V0 order\n"
+ "YUY2;YUV;4CC;V;YUV;;YUV 4:2:2 as for UYVY but with different component ordering within the u_int32 macropixel;http://www.fourcc.org/indexyuv.htm\n"
+ "YUYP;YUV;4CC;V;YUV;;Evans & Sutherland\n"
+ "YUYV;YUV;4CC;V;YUV;;Canopus YUV format;http://www.fourcc.org/indexyuv.htm\n"
+ "YV12;YUV;4CC;V;YUV;;ATI YVU12 4:2:0 Planar;http://www.fourcc.org/indexyuv.htm\n"
+ "YV16;YUV;4CC;V;YUV;;Elecard YUV 4:2:2 Planar\n"
+ "YV92;YUV;4CC;V;YUV;;Intel Smart Video Recorder YVU9\n"
+ "YVU9;YUV;4CC;V;YUV;;Brooktree YVU9 Raw (YVU9 Planar);http://www.fourcc.org/indexyuv.htm\n"
+ "YVYU;YUV;4CC;V;YUV;;YUV 4:2:2 as for UYVY but with different component ordering within the u_int32 macropixel\n"
+ "ZLIB;AVIzlib;4CC;V;RGB;;Lossless (ZIP compression)\n"
+ "ZMBV;Zip;4CC;V;;;Zip Motion Blocks Video\n"
+ "ZPEG;Video Zipper;4CC;V;RGB;;Metheus Video Zipper\n"
+ "ZYGO;ZyGo;4CC;V;;;ZyGo Video\n"
+ "V_UNCOMPRESSED;Raw;Mk;V;;;Raw uncompressed video frames\n"
+ "V_DIRAC;Dirac;Mk;V;;;;http://diracvideo.org/\n"
+ "V_MPEG4/ISO/SP;MPEG-4 Visual SP;Mk;V;MPEG-4V;;Simple Profile;http://www.divx.com\n"
+ "V_MPEG4/ISO/ASP;MPEG-4 Visual ASP;Mk;V;MPEG-4V;;Advanced Simple Profile;http://www.xvid.org/Downloads.15.0.html\n"
+ "V_MPEG4/ISO/AP;MPEG-4 Visual AP;Mk;V;MPEG-4V;;Advanced Profile;http://ffdshow-tryout.sourceforge.net/\n"
+ "V_MPEG4/ISO/AVC;AVC;Mk;V;AVC;;Advanced Video Codec;http://ffdshow-tryout.sourceforge.net/\n"
+ "V_MPEG4/MS/V2;MS MPEG-4 v2;Mk;V;MPEG-4V;;MS MPEG-4 v2;http://ffdshow-tryout.sourceforge.net/\n"
+ "V_MPEG4/MS/V3;MS MPEG-4 v3;Mk;V;MPEG-4V;;MS MPEG-4 v3;http://ffdshow-tryout.sourceforge.net/\n"
+ "V_MPEG1;MPEG-1 Video;Mk;V;MPEG-V;;MPEG 1 or 2 Video;http://ffdshow-tryout.sourceforge.net/\n"
+ "V_MPEG2;MPEG-2 Video;Mk;V;MPEG-V;;MPEG 1 or 2 Video;http://ffdshow-tryout.sourceforge.net/\n"
+ "V_REAL/RV10;Real 1;Mk;V;;;RealVideo 1.0 aka RealVideo 5;http://www.real.com\n"
+ "V_REAL/RV20;Real 2;Mk;V;;;RealVideo 2.0 aka G2 and RealVideo G2+SVT;http://www.real.com\n"
+ "V_REAL/RV30;Real 3;Mk;V;;;RealVideo 3.0 aka RealVideo 8;http://www.real.com\n"
+ "V_REAL/RV40;Real 4;Mk;V;;;RealVideo 4.0 aka RealVideo 9;http://www.real.com\n"
+ "V_THEORA;Theora;Mk;V;;;;http://www.theora.org\n"
+ "A_MPEG/L1;MPEG1/2 L1;Mk;A;MPEG-A;;MPEG1 or 2 Audio layer 1;http://www.iis.fraunhofer.de/amm/index.html\n"
+ "A_MPEG/L2;MPEG1/2 L2;Mk;A;MPEG-A;;MPEG1 or 2 Audio layer 2;http://www.iis.fraunhofer.de/amm/index.html\n"
+ "A_MPEG/L3;MPEG1/2 L3;Mk;A;MPEG-A;;MPEG1 or 2 Audio Layer 3;http://www.iis.fraunhofer.de/amm/index.html\n"
+ "A_PCM/INT/BIG;PCM;Mk;A;PCM;;Linear PCM (Big Endian)\n"
+ "A_PCM/INT/LIT;PCM;Mk;A;PCM;;Linear PCM (Little Endian)\n"
+ "A_PCM/FLOAT/IEEE;PCM;Mk;A;PCM;;Microsoft Linear PCM, Float;http://www.microsoft.com/windows/\n"
+ "A_AC3;AC3;Mk;A;AC3;;Dolby AC3\n"
+ "A_AC3/BSID9;AC3;Mk;A;AC3;;Dolby AC3\n"
+ "A_AC3/BSID10;AC3;Mk;A;AC3;;Dolby AC3\n"
+ "A_DTS;DTS;Mk;A;DTS\n"
+ "A_EAC3;EAC3;Mk;A;EAC3;;Dolby Enhanced AC3\n"
+ "A_FLAC;Flac;Mk;A;Flac;;;http://flac.sourceforge.net\n"
+ "A_TTA1;TTA;Mk;A;TTA;;The True Audio Lossless Codec;http://true-audio.com\n"
+ "A_VORBIS;Vorbis;Mk;A;Vorbis;VBR;;http://www.vorbis.com\n"
+ "A_WAVPACK4;WavPack;Mk;A;Real;VBR;;http://www.wavpack.com\n"
+ "A_REAL/14_4;RealAudio 1;Mk;A;Real;;Real Audio 1 (14.4);http://www.real.com\n"
+ "A_REAL/28_8;RealAudio 2;Mk;A;Real;;Real Audio 2 (28.8);http://www.real.com\n"
+ "A_REAL/COOK;RealAudio 7;Mk;A;Real;;Real Audio Cook Codec (codename: Gecko);http://www.real.com\n"
+ "A_REAL/SIPR;RealAudio 4;Mk;A;Real;;Real & Sipro Voice Codec;http://www.real.com\n"
+ "A_REAL/RALF;RealAudio Lossless;Mk;A;Real;;Real Audio Lossless Format;http://www.real.com\n"
+ "A_REAL/ATRC;RealAudio Atrac3;Mk;A;Real;;Real & Sony Atrac3 Codec;http://www.real.com\n"
+ "A_AAC;AAC;Mk;A;AAC\n"
+ "A_AAC/MPEG2/MAIN;AAC Main;Mk;A;AAC;;AAC Main\n"
+ "A_AAC/MPEG2/LC;AAC LC;Mk;A;AAC;;AAC Low Complexity\n"
+ "A_AAC/MPEG2/LC/SBR;AAC LC-SBR;Mk;A;AAC;;AAC Low Complexity with Spectral Band Replication\n"
+ "A_AAC/MPEG2/SSR;AAC SSR;Mk;A;AAC;;AAC Scalable Sampling Rate\n"
+ "A_AAC/MPEG4/MAIN;AAC Main;Mk;A;AAC;;AAC Low Complexity\n"
+ "A_AAC/MPEG4/MAIN/SBR;AAC Main;Mk;A;AAC;;AAC Low Complexity with Spectral Band Replication\n"
+ "A_AAC/MPEG4/MAIN/SBR/PS;AAC Main;Mk;A;AAC;;AAC Low Complexity with Spectral Band Replication and Parametric Stereo\n"
+ "A_AAC/MPEG4/MAIN/PS;AAC Main;Mk;A;AAC;;AAC Low Complexity with Parametric Stereo\n"
+ "A_AAC/MPEG4/LC;AAC LC;Mk;A;AAC;;AAC Low Complexity\n"
+ "A_AAC/MPEG4/LC/SBR;AAC LC-SBR;Mk;A;AAC;;AAC Low Complexity with Spectral Band Replication\n"
+ "A_AAC/MPEG4/LC/SBR/PS;AAC LC-SBR-PS;Mk;A;AAC;;AAC Low Complexity with Spectral Band Replication and Parametric Stereo\n"
+ "A_AAC/MPEG4/LC/PS;AAC LC-PS;Mk;A;AAC;;AAC Low Complexity with Parametric Stereo\n"
+ "A_AAC/MPEG4/SSR;AAC SSR;Mk;A;AAC;;AAC Scalable Sampling Rate\n"
+ "A_AAC/MPEG4/LTP;AAC LTP;Mk;A;AAC;;AAC Long Term Prediction\n"
+ "14_4;VSELP;Real;A;;;EIA/TIA IS-54 VSELP, Real Audio 1 (for streaming 14.4 Kbps);http://www.real.com\n"
+ "14.4;VSELP;Real;A;;;EIA/TIA IS-54 VSELP, Real Audio 1 (for streaming 14.4 Kbps);http://www.real.com\n"
+ "lpcJ;VSELP;Real;A;;;EIA/TIA IS-54 VSELP, Real Audio 1 (for streaming 14.4 Kbps);http://www.real.com\n"
+ "28_8;G.728;Real;A;;;ITU-T G.728, Real Audio 2 (for streaming 28.8 Kbps);http://www.real.com\n"
+ "28.8;G.728;Real;A;;;ITU-T G.728, Real Audio 2 (for streaming 28.8 Kbps);http://www.real.com\n"
+ "cook;Cooker;Real;A;;;Real Audio G2/7 Cook (low bitrate);http://www.real.com\n"
+ "dnet;AC3;Real;A;AC3;;A52/AC3, Real Audio 2;http://www.real.com\n"
+ "sipr;G.729;Real;A;;;G.729, Real Audio 2;http://www.real.com\n"
+ "rtrc;RealAudio 8;Real;A;;;Real Audio 8 (RTRC);http://www.real.com\n"
+ "ralf;Lossless;Real;A;;;Real Audio Lossless Format;http://www.real.com\n"
+ "whrl;Multi-Channel;Real;A;;;Real Audio Multi-Channel;http://www.real.com\n"
+ "atrc;Atrac;Real;A;;;Real & Sony Atrac3;http://www.real.com\n"
+ "raac;AAC-LC;Real;A;AAC;;Real Audio 10 AAC LC;http://www.real.com\n"
+ "racp;AAC-HE;Real;A;AAC;;Real Audio 10 AAC-HE;http://www.real.com\n"
+ "Vorbis;Vorbis;Ogg;A;Vorbis;;;http://www.vorbis.com\n"
+ "Theora;Theora;Ogg;V;Theora;;;http://www.theora.com\n"
+ "mp4a;AAC;4CC;A;AAC;;AAC (3GPP);http://www.apple.com/quicktime/download/standalone.html\n"
+ "mp4v;MPEG-4;4CC;V;MPEG-4V;;MPEG-4 Video (3GPP);http://www.apple.com/quicktime/download/standalone.html\n"
+ "avc1;AVC;4CC;V;AVC;;Advanced Video Codec;http://www.apple.com/quicktime/download/standalone.html\n"
+ "h263;H.263;4CC;V;;;H.263 (3GPP);http://www.apple.com/quicktime/download/standalone.html\n"
+ "s263;H.263;4CC;V;;;H.263 (3GPP);http://www.apple.com/quicktime/download/standalone.html\n"
+ "samr;AMR-NB;4CC;A;;;AMR narrow band (3GPP);http://www.apple.com/quicktime/download/standalone.html\n"
+ "sawb;AMR-WB;4CC;A;;;AMR wide band (3GPP);http://www.apple.com/quicktime/download/standalone.html\n"
+ "sevc;EVRC;4CC;A;;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "tx3g;Timed;4CC;T;;;Timed text (3GPP);http://www.apple.com/quicktime/download/standalone.html\n"
+ "encv;Encrypted;4CC;V;;;Encrypted Video (3GPP);http://www.apple.com/quicktime/download/standalone.html\n"
+ "enca;Encrypted;4CC;A;;;Encrypted Audio (3GPP);http://www.apple.com/quicktime/download/standalone.html\n"
+ "enct;Encrypted;4CC;T;;;Encrypted Text (3GPP);http://www.apple.com/quicktime/download/standalone.html\n"
+ "ima4;ADPCM;4CC;A;ADPCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "raw ;PCM;4CC;A;PCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "twos;PCM;4CC;A;PCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "sowt;PCM;4CC;A;PCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "alac;Lossless;4CC;A;;;Apple Lossless Format (similar to FLAC);http://www.apple.com/quicktime/download/standalone.html\n"
+ "sac3;AC3;4CC;A;AC3;;AC3 in MP4 (made in Nero);http://www.nerodigital.com\n"
+ "in24;PCM;4CC;A;PCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "in32;PCM;4CC;A;PCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "fl32;PCM ;4CC;A;PCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "fl64;PCM;4CC;A;PCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "alaw;A-Law;4CC;A;ADPCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ "ulaw;U-Law;4CC;A;ADPCM;;;http://www.apple.com/quicktime/download/standalone.html\n"
+ ".mp3;MPEG-1/2 L3;2CC;A;MPEG-A;;MPEG-1 or 2 layer 3;http://www.iis.fraunhofer.de/amm/index.html\n"
+ "MPEG-4 AAC main;AAC Main;Mp4v2;A;AAC\n"
+ "MPEG-4 AAC LC;AAC LC;Mp4v2;A;AAC\n"
+ "MPEG-4 AAC SSR;AAC SSR;Mp4v2;A;AAC\n"
+ "MPEG-4 AAC LTP;AAC LTP;Mp4v2;A;AAC\n"
+ "AVC;AVC;MediaInfo;V;AVC;;Advanced Video Codec;http://developers.videolan.org/x264.html\n"
+ "MPEG-1V;MPEG-1 Video;MediaInfo;V;MPEG-V\n"
+ "MPEG-2V;MPEG-2 Video;MediaInfo;V;MPEG-V\n"
+ "MPEG-4V;MPEG-4 Visual;MediaInfo;V;MPEG-4V\n"
+ "MPEG-1A;MPEG-1 Audio;MediaInfo;A;MPEG-A\n"
+ "MPEG-1A L1;MPEG-1 Audio Layer 1;MediaInfo;A;MPEG-A\n"
+ "MPEG-1A L2;MPEG-1 Audio Layer 2;MediaInfo;A;MPEG-A\n"
+ "MPEG-1A L3;MPEG-1 Audio Layer 3;MediaInfo;A;MPEG-A\n"
+ "MPEG-2A;MPEG-2 Audio;MediaInfo;A;MPEG-A\n"
+ "MPEG-2A L1;MPEG-2 Audio Layer 1;MediaInfo;A;MPEG-A\n"
+ "MPEG-2A L2;MPEG-2 Audio Layer 2;MediaInfo;A;MPEG-A\n"
+ "MPEG-2A L3;MPEG-2 Audio Layer 3;MediaInfo;A;MPEG-A\n"
+ "MPEG-2.5A;MPEG-2.5 Audio;MediaInfo;A;MPEG-A\n"
+ "MPEG-2.5A L1;MPEG-2.5 Audio Layer 1;MediaInfo;A;MPEG-A\n"
+ "MPEG-2.5A L2;MPEG-2.5 Audio Layer 2;MediaInfo;A;MPEG-A\n"
+ "MPEG-2.5A L3;MPEG-2.5 Audio Layer 3;MediaInfo;A;MPEG-A\n"
+ "APE;Monkey's Audio;MediaInfo;A;;;;http://www.monkeysaudio.com/\n"
+ "ALS;ALS;MediaInfo;A;;;MPEG-4 Audio Lossless Coding;http://www.nue.tu-berlin.de/forschung/projekte/lossless/mp4als.html#downloads\n"
+ "Vodei;Vodei MP;MediaInfo;V;;;Video On Demand Exploration Interface;http://www.vodei.com\n"
+ "SWF ADPCM;ADPCM;MediaInfo;A;ADPCM;;ADPCM found in SWF/FLV files;http://www.adobe.com\n"
+ "AC3+;AC3+;MediaInfo;A;AC3;;Dolby Ehanced AC3\n"
+ "TrueHD;TrueHD;MediaInfo;A;AC3;;Dolby TrueHD (AC3 based)\n"
+ "VC-1;VC-1;MediaInfo;V;VC-1;;;http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx\n"
+ "LA;LA;MediaInfo;A;;;Lossless Audio Codec;la;http://www.lossless-audio.com/\n"
+ "0;Unknown;2CC;A\n"
+ "1;PCM;2CC;A;PCM;;Microsoft PCM;http://www.microsoft.com/windows/\n"
+ "2;ADPCM;2CC;A;ADPCM;;Microsoft ADPCM;http://www.microsoft.com/windows/\n"
+ "3;PCM;2CC;A;PCM;;IEEE FLOAT;http://www.microsoft.com/windows/\n"
+ "4;VSELP;2CC;A;;;Compaq VSELP\n"
+ "5;CVSD;2CC;A;;;IBM CVSD\n"
+ "6;A-Law;2CC;A;ADPCM;;CCITT A-Law;http://www.microsoft.com/windows/\n"
+ "7;U-Law;2CC;A;ADPCM;;CCITT U-Law;http://www.microsoft.com/windows/\n"
+ "8;DTS;2CC;A;DTS\n"
+ "9;DRM;2CC;A;;;Microsoft\n"
+ "A;WMSpeech;2CC;A\n"
+ "C;MPEG2 5.1;2CC;A;;;MPEG2 5.1\n"
+ "10;ADPCM;2CC;A;ADPCM;;OKI ADPCM\n"
+ "11;ADPCM;2CC;A;ADPCM;;Intel ADPCM\n"
+ "12;ADPCM;2CC;A;ADPCM;;Mediaspace (Videologic) ADPCM\n"
+ "13;ADPCM;2CC;A;ADPCM;;Sierra ADPCM\n"
+ "14;ADPCM;2CC;A;ADPCM;;Antex G723 ADPCM\n"
+ "15;STD;2CC;A;;;DSP solutions Digi-STD\n"
+ "16;FIX;2CC;A;;;DSP solutions Digi-FIX\n"
+ "17;ADPCM;2CC;A;ADPCM;;Dialogic-OKI ADPCM;http://www.microsoft.com/windows/\n"
+ "18;ADPCM;2CC;A;ADPCM\n"
+ "19;CU;2CC;A;;;HP CU_CODEC\n"
+ "1A;Dynamic Voice;2CC;A;;;HP\n"
+ "20;ADPCM;2CC;A;ADPCM;;Yamaha ADPCM\n"
+ "21;SONARC;2CC;A;;;Speech Compression SONARC\n"
+ "22;Truespeech;2CC;A;;;DSP Group TrueSpeech;http://www.microsoft.com/windows/\n"
+ "23;SC1;2CC;A;;;Echo Speech SC1\n"
+ "24;AF36;2CC;A;;;Virtual Music AudioFile 36\n"
+ "25;APTX;2CC;A;;;Audio Processing Technology X\n"
+ "26;AF10;2CC;A;;;Virtual Music AudioFile 10\n"
+ "27;Prosody 1612;2CC;A;;;Aculab plc Prosody 1612\n"
+ "28;LRC;2CC;A;;;Merging Technologies LRC\n"
+ "30;AC2;2CC;A;;;Dolby Laboratories AC2\n"
+ "31;GSM 6.10;2CC;A;;;Microsoft GSM 6.10;http://www.microsoft.com/windows/\n"
+ "32;MSAUDIO;2CC;A;;;Microsoft Audio\n"
+ "33;ADPCM;2CC;A;ADPCM;;Antex ADPCM\n"
+ "34;VQLPC;2CC;A;;;Control Ressources VQLPC\n"
+ "35;REAL;2CC;A;;;DSP Solutions Digi-REAL\n"
+ "36;ADPCM;2CC;A;ADPCM;;DSP Solutions Digi-ADPCM\n"
+ "37;CR10;2CC;A;;;Control Resources 10\n"
+ "38;ADPCM;2CC;A;ADPCM;;Natural MicroSystems VBX ADPCM\n"
+ "39;ADPCM;2CC;A;ADPCM;;Crystal Semiconductor IMA ADPCM\n"
+ "3A;SC3;2CC;A;;;Echo Speech SC3\n"
+ "3B;ADPCM;2CC;A;;;Rockwell ADPCM\n"
+ "3C;DigiTalk;2CC;A;;;Rockwell DigiTalk\n"
+ "3D;Xebec;2CC;A;;;Xebec Multimedia Solutions\n"
+ "40;ADPCM;2CC;A;ADPCM;;Antex Electronics G721 ADPCM\n"
+ "41;CELP;2CC;A;;;Antex Electronics G728 CELP\n"
+ "42;G.723.1;2CC;A;;;Microsoft G.723.1;http://www.microsoft.com/windows/\n"
+ "42;ADPCM;2CC;A;;;IBM\n"
+ "42;MSG729;2CC;A;;;Microsoft\n"
+ "45;ADPCM;2CC;A;ADPCM;;Microsoft G.726;http://www.microsoft.com/windows/\n"
+ "50;MPEG-1/2 L1;2CC;A;MPEG-1;;;http://www.iis.fraunhofer.de/amm/index.html\n"
+ "51;MPEG-1/2 L2;2CC;A;MPEG-1;;;http://www.iis.fraunhofer.de/amm/index.html\n"
+ "52;RT24;2CC;A;;;InSoft, Inc.\n"
+ "53;PAC;2CC;A;;;InSoft, Inc.\n"
+ "55;MPEG-1/2 L3;2CC;A;MPEG-1;;MPEG-1 or 2 layer 3;http://www.iis.fraunhofer.de/amm/index.html\n"
+ "59;G723;2CC;A;;;Lucent G723\n"
+ "60;Cirrus;2CC;A;;;Cirrus Logic\n"
+ "61;PCM;2CC;A;;;ESS Technology PCM\n"
+ "62;Voxware;2CC;A\n"
+ "63;ATRAC;2CC;A;;;Canopus ATRAC\n"
+ "64;ADPCM;2CC;A;ADPCM;;APICOM G726 ADPCM\n"
+ "65;ADPCM;2CC;A;ADPCM;;APICOM G722 ADPCM\n"
+ "66;DSAT;2CC;A;;;Microsoft DSAT\n"
+ "67;DSAT Display;2CC;A;;;Microsoft DSAT DISPLAY\n"
+ "69;BYTE_ALIGNED;2CC;A;;;Voxware BYTE_ALIGNED;http://www.voxware.com/\n"
+ "70;AC8;2CC;A;;;Voxware AC8;http://www.voxware.com/\n"
+ "71;AC10;2CC;A;;;Voxware AC10;http://www.voxware.com/\n"
+ "72;AC16;2CC;A;;;Voxware AC16;http://www.voxware.com/\n"
+ "73;AC20;2CC;A;;;Voxware AC20;http://www.voxware.com/\n"
+ "74;RT24;2CC;A;;;Voxware RT24 (MetaVoice);http://www.voxware.com/\n"
+ "75;RT29;2CC;A;;;Voxware RT29 (MetaSound);http://www.voxware.com/\n"
+ "76;RT29HW;2CC;A;;;Voxware RT29HW;http://www.voxware.com/\n"
+ "77;VR12;2CC;A;;;Voxware VR12;http://www.voxware.com/\n"
+ "78;VR18;2CC;A;;;Voxware VR18;http://www.voxware.com/\n"
+ "79;TQ40;2CC;A;;;Voxware TQ40;http://www.voxware.com/\n"
+ "7A;SC3;2CC;A;;;Voxware\n"
+ "7B;SC3;2CC;A;;;Voxware\n"
+ "80;Softsound;2CC;A\n"
+ "81;TQ60;2CC;A;;;Voxware TQ60;http://www.voxware.com/\n"
+ "82;MSRT24;2CC;A;;;Microsoft MSRT24\n"
+ "83;G729A;2CC;A;;;AT&T G729A\n"
+ "84;MVI_MVI2;2CC;A;;;Motion Pixels MVI_MVI2\n"
+ "85;ADPCM;2CC;A;ADPCM;;DataFusion Systems (Pty) G726\n"
+ "86;GSM6.10;2CC;A;;;DataFusion Systems (Pty) GSM6.10\n"
+ "88;ISI AUDIO;2CC;A;;;Iterated Systems AUDIO\n"
+ "89;Onlive;2CC;A;;;OnLive! Technologies\n"
+ "8A;SX20;2CC;A;;;Multitude\n"
+ "8B;ADPCM;2CC;A;ADPCM;;Infocom ITS A/S\n"
+ "8C;G.729;2CC;A;;;Convedia Corporation\n"
+ "91;SBC24;2CC;A;;;Siemens Business Communications Sys 24\n"
+ "92;AC3 SPDIF;2CC;A;;;Sonic Foundry AC3 SPDIF\n"
+ "93;G723;2CC;A;;;MediaSonic G723\n"
+ "94;Prosody 8KBPS;2CC;A;;;Aculab plc Prosody 8KBPS\n"
+ "97;ADPCM;2CC;A;ADPCM;;ZyXEL Communications ADPCM\n"
+ "98;LPCBB;2CC;A;;;Philips Speech Processing LPCBB\n"
+ "99;Packed;2CC;A;;;Studer Professional Audio AG Packed\n"
+ "A0;PHONYTALK;2CC;A;;;Malden Electronics PHONYTALK\n"
+ "A1;GSM;2CC;A;;;Racal Recorders\n"
+ "A2;G.720a;2CC;A;;;Racal Recorders\n"
+ "A3;G.723.1;2CC;A;;;Racal Recorders\n"
+ "A4;ACELP;2CC;A;;;Racal Recorders\n"
+ "B0;AAC;2CC;A;AAC;;NEC Corporation\n"
+ "FF;AAC;2CC;A;AAC\n"
+ "100;ADPCM;2CC;A;ADPCM\n"
+ "101;IRAT;2CC;A;;;BeCubed IRAT\n"
+ "102;;2CC;A;;;IBM A-law\n"
+ "103;;2CC;A;;;IBM AVC ADPCM\n"
+ "111;G723;2CC;A;;;Vivo G723\n"
+ "112;SIREN;2CC;A;;;Vivo SIREN\n"
+ "120;CELP;2CC;A;;;Philips Speech Processing\n"
+ "121;Grundig;2CC;A;;;Philips Speech Processing\n"
+ "123;G723;2CC;A;;;Digital Equipment Corporation (DEC) G723\n"
+ "125;ADPCM;2CC;A;ADPCM\n"
+ "130;ACEPL;2CC;A;;;Sipro ACEPL.net;http://dividix.host.sk\n"
+ "131;ACELP4800;2CC;A;;;Sipro ACELP4800\n"
+ "132;ACELP8V3;2CC;A;;;Sipro ACELP8V3\n"
+ "133;G729;2CC;A;;;Sipro G729\n"
+ "134;G729;2CC;A;;;Sipro G729A\n"
+ "135;KELVIN;2CC;A;;;Sipro KELVIN\n"
+ "135;AMR;2CC;A;;;VoiceAge Corporation\n"
+ "140;ADPCM;2CC;A;ADPCM;;Dictaphone Corporation G726 ADPCM\n"
+ "140;CELP68;2CC;A;;;Dictaphone Corporation\n"
+ "140;CELP54;2CC;A;;;Dictaphone Corporation\n"
+ "150;PureVoice;2CC;A;;;Qualcomm PUREVOICE\n"
+ "151;HalfRate;2CC;A;;;Qualcomm HALFRATE\n"
+ "155;TUBGSM;2CC;A;;;Ring Zero Systems TUBGSM\n"
+ "160;WMA1;2CC;A;;;Windows Media Audio 1;http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx\n"
+ "161;WMA2;2CC;A;;;Windows Media Audio 2;http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx\n"
+ "162;WMA3;2CC;A;;;Windows Media Audio 3;http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx\n"
+ "163;WMA Lossless;2CC;A;;;Windows Media Audio 3;http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx\n"
+ "163;WMA Pro;2CC;A;;;WMA Pro over S/PDIF\n"
+ "170;ADPCM;2CC;A;ADPCM;;Unisys Nap ADPCM\n"
+ "171;U-Law;2CC;A;ADPCM;;Unisys Nap U-law\n"
+ "172;A-Law;2CC;A;ADPCM;;Unisys Nap A-law\n"
+ "173;16K;2CC;A;;;Unisys Nap 16K\n"
+ "174;G.700;2CC;A;;;SyCom Technologies\n"
+ "175;ADPCM;2CC;A;ADPCM;;SyCom Technologies\n"
+ "176;CELP54;2CC;A;;;SyCom Technologies\n"
+ "177;CELP68;2CC;A;;;SyCom Technologies\n"
+ "178;ADPCM;2CC;A;ADPCM;;Knowledge Adventure, Inc.\n"
+ "180;AAC;2CC;A;;;Fraunhofer IIS\n"
+ "190;DTS;2CC;A\n"
+ "200;ADPCM;2CC;A;ADPCM;;Creative Labs ADPCM\n"
+ "202;FastSpeech8;2CC;A;;;Creative Labs Fast Speech 8\n"
+ "203;FastSpeech10;2CC;A;;;Creative Labs Fast Speech 10\n"
+ "210;ADPCM;2CC;A;ADPCM;;UHER informatic GmbH ADPCM\n"
+ "215;;2CC;A;;;Ulead DV ACM\n"
+ "216;;2CC;A;;;Ulead DV ACM\n"
+ "220;QuaterDeck;2CC;A;;;Quarterdeck\n"
+ "230;VC;2CC;A;;;I-link VC\n"
+ "240;RAW_SPORT;2CC;A;;;Aureal RAW_SPORT\n"
+ "241;AC3;2CC;A;;;ESST AC3\n"
+ "250;HSX;2CC;A;;;Interactive Products, Inc. (IPI) HSX\n"
+ "251;RPELP;2CC;A;;;Interactive Products, Inc. (IPI) RPELP\n"
+ "260;CS2;2CC;A;;;Consistent Software CS2\n"
+ "270;SCX;2CC;A;;;Sony\n"
+ "271;SCY;2CC;A;;;Sony\n"
+ "272;Atrac3;2CC;A;;;Sony\n"
+ "273;SPC;2CC;A;;;Sony\n"
+ "280;Telum;2CC;A\n"
+ "281;TelumIA;2CC;A\n"
+ "285;ADPCM;2CC;A;ADPCM;;Norcom Voice Systems\n"
+ "300;FM_TOWNS_SND;2CC;A;;;Fujitsu FM_TOWNS_SND\n"
+ "350;Dev;2CC;A;;;Micronas Semiconductors, Inc.\n"
+ "351;CELP833;2CC;A;;;Micronas Semiconductors, Inc.\n"
+ "400;BTV_DIGITAL;2CC;A;;;Brooktree (BTV) DIGITAL\n"
+ "401;Music Coder;2CC;A;;;Intel Music Coder;http://www.intel.com/\n"
+ "402;IAC2;2CC;A;;;Ligos IAC2;http://www.ligos.com\n"
+ "450;Qdesign;2CC;A;;;QDesign Music\n"
+ "500;VP7;2CC;A;;;On2 VP7 Audio;http://www.on2.com/vp7.php3\n"
+ "501;VP6;2CC;A;;;On2 VP7 Audio;http://www.on2.com/vp7.php3\n"
+ "680;VMPCM;2CC;A;;;AT&T VME_VMPCM\n"
+ "681;TPC;2CC;A;;;AT&T TPC\n"
+ "700;YMPEG;2CC;A;;;YMPEG Alpha\n"
+ "8AE;LiteWave;2CC;A;;;ClearJump LiteWave\n"
+ "AAC;AAC;2CC;A;AAC\n"
+ "1000;GSM;2CC;A;;;Ing C. Olivetti & C., S.p.A. GSM\n"
+ "1001;ADPCM;2CC;A;ADPCM;;Ing C. Olivetti & C., S.p.A. ADPCM\n"
+ "1002;CELP;2CC;A;;;Ing C. Olivetti & C., S.p.A. CELP\n"
+ "1003;SBC;2CC;A;;;Ing C. Olivetti & C., S.p.A. SBC\n"
+ "1004;OPR;2CC;A;;;Ing C. Olivetti & C., S.p.A. OPR\n"
+ "1100;LH_CODEC;2CC;A;;;Lernout & Hauspie Codec\n"
+ "1101;CELP;2CC;A;;;Lernout & Hauspie CELP 4.8 kb/s;http://www.microsoft.com/windows/\n"
+ "1102;SBC;2CC;A;;;Lernout & Hauspie SBC 8 kb/s;http://www.microsoft.com/windows/\n"
+ "1103;SBC;2CC;A;;;Lernout & Hauspie SBC 12 kb/s;http://www.microsoft.com/windows/\n"
+ "1104;SBC;2CC;A;;;Lernout & Hauspie SBC 16 kb/s;http://www.microsoft.com/windows/\n"
+ "1400;NORRIS;2CC;A;;;Norris Communications, Inc.\n"
+ "1401;ISIAUDIO;2CC;A;;;ISIAudio\n"
+ "1500;MUSICOMPRESS;2CC;A;;;Soundspace Music Compression\n"
+ "181C;RT24;2CC;A;;;VoxWare RT24 speech codec\n"
+ "181E;AX24000P;2CC;A;;;Lucent elemedia AX24000P Music codec\n"
+ "1971;SonicFoundry;2CC;A;;;Lossless\n"
+ "1C03;ADPCM;2CC;A;ADPCM;;Lucent SX5363S G.723 compliant codec\n"
+ "1C07;SX8300P;2CC;A;;;Lucent SX8300P speech codec\n"
+ "1C0C;ADPCM;2CC;A;ADPCM;;Lucent SX5363S G.723 compliant codec\n"
+ "1F03;DigiTalk;2CC;A;;;CUseeMe DigiTalk (ex-Rocwell)\n"
+ "1FC4;ALF2CD;2CC;A;;;NCT Soft ALF2CD ACM\n"
+ "2000;AC3;2CC;A;AC3;CBR;Dolby AC3\n"
+ "2001;DTS;2CC;A;DTS;;Digital Theater Systems\n"
+ "2002;Real Audio 1;2CC;A;;;RealAudio 1/2 14.4\n"
+ "2003;Real Audio 1;2CC;A;;;RealAudio 1/2 28.8\n"
+ "2004;Real Audio 2;2CC;A;;;RealAudio G2/8 Cook (low bitrate)\n"
+ "2005;Real Audio 3;2CC;A;;;RealAudio 3/4/5 Music (DNET)\n"
+ "2006;AAC;2CC;A;AAC;;RealAudio 10 AAC (RAAC)\n"
+ "2007;AAC+;2CC;A;AAC;;RealAudio 10 AAC+ (RACP)\n"
+ "3313;AviSynth;2CC;A;;;makeAVIS (fake AVI sound from AviSynth scripts)\n"
+ "4143;AAC;2CC;A;AAC;;Divio MPEG-4 AAC audio\n"
+ "4201;Nokia;2CC;A\n"
+ "4243;ADPCM;2CC;A;ADPCM;;G726\n"
+ "43AC;Lead Speech;2CC;A\n"
+ "564C;Lead Vorbis;2CC;A\n"
+ "566F;Vorbis;2CC;A;Vorbis;;;http://www.vorbis.com\n"
+ "5756;WavPack;2CC;A;;;;http://www.wavpack.com/\n"
+ "674F;Vorbis;2CC;A;Vorbis;;Mode 1;http://www.vorbis.com\n"
+ "6750;Vorbis;2CC;A;Vorbis;;Mode 2;http://www.vorbis.com\n"
+ "6751;Vorbis;2CC;A;Vorbis;;Mode 3;http://www.vorbis.com\n"
+ "676F;Vorbis;2CC;A;Vorbis;;Mode 1+;http://www.vorbis.com\n"
+ "6770;Vorbis;2CC;A;Vorbis;;Mode 2+;http://www.vorbis.com\n"
+ "6771;Vorbis;2CC;A;Vorbis;;Mode 2+;http://www.vorbis.com\n"
+ ";3COM NBX;2CC;A;;;3Com Corporation\n"
+ ";FAAD AAC;2CC;A\n"
+ "7A21;AMR;2CC;A;;CBR;GSM-AMR (CBR, no SID);http://www.microsoft.com\n"
+ "7A22;AMR;2CC;A;;VBR;GSM-AMR (VBR, including SID);http://www.microsoft.com\n"
+ "A100;G723.1;2CC;A\n"
+ "A101;AVQSBC;2CC;A\n"
+ "A102;ODSBC;2CC;A\n"
+ "A103;G729A;2CC;A\n"
+ "A104;AMR-WB;2CC;A\n"
+ "A105;ADPCM;2CC;A;ADPCM;;G726\n"
+ "A106;AAC;2CC;A\n"
+ "A107;ADPCM;2CC;A;ADPCM;;G726\n"
+ "A109;Speex;2CC;A;;;;http://www.speex.org/\n"
+ "DFAC;FrameServer;2CC;A;;;DebugMode SonicFoundry Vegas FrameServer ACM Codec\n"
+ "F1AC;FLAC;2CC;A;;;Free Lossless Audio Codec FLAC\n"
+ "FFFE;PCM;2CC;A;PCM;;Extensible wave format\n"
+ "FFFF;In Development;2CC;A;;;In Development / Unregistered\n"
+ "S_TEXT/UTF8;UTF-8;Mk;T;;;UTF-8 Plain Text\n"
+ "S_TEXT/SSA;SSA;Mk;T;;;Sub Station Alpha\n"
+ "S_TEXT/ASS;ASS;Mk;T;;;Advanced Sub Station Alpha\n"
+ "S_TEXT/USF;USF;Mk;T;;;Universal Subtitle Format\n"
+ "S_IMAGE/BMP;Bitmap;Mk;T;;;Basic image based subtitle format\n"
+ "S_VOBSUB;VobSub;Mk;T;;;The same subtitle format used on DVDs\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_Generic (ZtringListList &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ "Format\n"
+ "Format/Info\n"
+ "Format/Url\n"
+ "Format_Commercial\n"
+ "Format_Commercial_IfAny\n"
+ "Format_Version\n"
+ "Format_Profile\n"
+ "Format_Settings\n"
+ "InternetMediaType\n"
+ "CodecID\n"
+ "CodecID/Info\n"
+ "CodecID/Hint\n"
+ "CodecID/Url\n"
+ "CodecID_Description\n"
+ "Codec\n"
+ "Codec/String\n"
+ "Codec/Info\n"
+ "Codec/Url\n"
+ "Codec/CC\n"
+ "Duration\n"
+ "Duration/String\n"
+ "Duration/String1\n"
+ "Duration/String2\n"
+ "Duration/String3\n"
+ "BitRate_Mode\n"
+ "BitRate_Mode/String\n"
+ "BitRate\n"
+ "BitRate/String\n"
+ "BitRate_Minimum\n"
+ "BitRate_Minimum/String\n"
+ "BitRate_Nominal\n"
+ "BitRate_Nominal/String\n"
+ "BitRate_Maximum\n"
+ "BitRate_Maximum/String\n"
+ "ColorSpace\n"
+ "ChromaSubsampling\n"
+ "Resolution\n"
+ "Resolution/String\n"
+ "BitDepth\n"
+ "BitDepth/String\n"
+ "StreamSize\n"
+ "StreamSize/String\n"
+ "StreamSize/String1\n"
+ "StreamSize/String2\n"
+ "StreamSize/String3\n"
+ "StreamSize/String4\n"
+ "StreamSize/String5\n"
+ "StreamSize_Proportion\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_General (ZtringListList &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ "Count;;;N NI;;;Number of objects available in this stream\n"
+ "StreamCount;;;N NI;;;Number of streams of this kind available\n"
+ "StreamKind;General;;N NI;;;Stream type name\n"
+ "StreamKind/String;;;N NI;;;Stream type name\n"
+ "StreamKindID;;;N NI;;;Number of the stream (base=0)\n"
+ "StreamKindPos;;;N NI;;;When multiple streams, number of the stream (base=1)\n"
+ "Inform;;;N NT;;;Last **Inform** call\n"
+ "ID;;;N YI;;;The ID for this stream in this file\n"
+ "ID/String;;;Y NT;;;The ID for this stream in this file\n"
+ "UniqueID;;;N YI;;;The unique ID for this stream, should be copied with stream copy\n"
+ "MenuID;;;N YI;;;The menu ID for this stream in this file\n"
+ "MenuID/String;;;Y NT;;;The menu ID for this stream in this file\n"
+ "GeneralCount;1;;N NI;;;Number of general streams\n"
+ "VideoCount;;;N NI;;;Number of video streams\n"
+ "AudioCount;;;N NI;;;Number of audio streams\n"
+ "TextCount;;;N NI;;;Number of text streams\n"
+ "ChaptersCount;;;N NI;;;Number of chapters streams\n"
+ "ImageCount;;;N NI;;;Number of image streams\n"
+ "MenuCount;;;N NI;;;Number of menu streams\n"
+ "Video_Format_List;;;N NT;;;Video Codecs in this file, separated by /\n"
+ "Video_Format_WithHint_List;;;N NT;;;Video Codecs in this file with popular name (hint), separated by /\n"
+ "Video_Codec_List;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Video_Language_List;;;N NT;;;Video languagesin this file, full names, separated by /\n"
+ "Audio_Format_List;;;N NT;;;Audio Codecs in this file,separated by /\n"
+ "Audio_Format_WithHint_List;;;N NT;;;Audio Codecs in this file with popular name (hint), separated by /\n"
+ "Audio_Codec_List;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Audio_Language_List;;;N NT;;;Audio languages in this file separated by /\n"
+ "Text_Format_List;;;N NT;;;Text Codecs in this file, separated by /\n"
+ "Text_Format_WithHint_List;;;N NT;;;Text Codecs in this file with popular name (hint),separated by /\n"
+ "Text_Codec_List;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Text_Language_List;;;N NT;;;Text languages in this file, separated by /\n"
+ "Chapters_Format_List;;;N NT;;;Chapters Codecs in this file, separated by /\n"
+ "Chapters_Format_WithHint_List;;;N NT;;;Chapters Codecs in this file with popular name (hint), separated by /\n"
+ "Chapters_Codec_List;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Chapters_Language_List;;;N NT;;;Chapters languages in this file, separated by /\n"
+ "Image_Format_List;;;N NT;;;Image Codecs in this file, separated by /\n"
+ "Image_Format_WithHint_List;;;N NT;;;Image Codecs in this file with popular name (hint), separated by /\n"
+ "Image_Codec_List;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Image_Language_List;;;N NT;;;Image languages in this file, separated by /\n"
+ "Menu_Format_List;;;N NT;;;Menu Codecsin this file, separated by /\n"
+ "Menu_Format_WithHint_List;;;N NT;;;Menu Codecs in this file with popular name (hint),separated by /\n"
+ "Menu_Codec_List;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Menu_Language_List;;;N NT;;;Menu languages in this file, separated by /\n"
+ "CompleteName;;;Y NT;;;Complete name (Folder+Name+Extension)\n"
+ "FolderName;;;N NT;;;Folder name only\n"
+ "FileName;;;N NT;;;File name only\n"
+ "FileExtension;;;N NT;;;File extension only\n"
+ "Format;;;Y YT;;;Format used\n"
+ "Format/String;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Format/Info;;;Y NT;;;Info about this Format\n"
+ "Format/Url;;;N NT;;;Link to a description of this format\n"
+ "Format/Extensions;;;N NT;;;Known extensions of this format\n"
+ "Format_Commercial;;;N NT;;;Commercial name used by vendor for theses setings or Format field if there is no difference\n"
+ "Format_Commercial_IfAny;;;Y NT;;;Commercial name used by vendor for theses setings if there is one\n"
+ "Format_Version;;;Y NT;;;Version of this format\n"
+ "Format_Profile;;;Y NT;;;Profile of the Format\n"
+ "Format_Settings;;;Y NT;;;Settings needed for decoder used\n"
+ "InternetMediaType;;;N YT;;;Internet Media Type (aka MIME Type, Content-Type)\n"
+ "CodecID;;;Y YT;;;Codec ID (found in some containers)\n"
+ "CodecID/Info;;;Y NT;;;Info about this codec\n"
+ "CodecID/Hint;;;Y NT;;;A hint/popular name for this codec\n"
+ "CodecID/Url;;;N NT;;;A link to more details about this codec ID\n"
+ "CodecID_Description;;;Y NT;;;Manual description given by the container\n"
+ "Interleaved;;;N NT;;;If Audio and video are muxed\n"
+ "Codec;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/String;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/Info;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/Url;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/Extensions;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings_Automatic;;;N NT;;;Deprecated, do not use in new projects\n"
+ "FileSize;; byte;N NT;;;File size in bytes\n"
+ "FileSize/String;;;Y NT;;;File size (with measure)\n"
+ "FileSize/String1;;;N NT;;;File size (with measure, 1 digit mini)\n"
+ "FileSize/String2;;;N NT;;;File size (with measure, 2 digit mini)\n"
+ "FileSize/String3;;;N NT;;;File size (with measure, 3 digit mini)\n"
+ "FileSize/String4;;;N NT;;;File size (with measure, 4 digit mini)\n"
+ "Duration;; ms;N YI;;;Play time of the stream in ms\n"
+ "Duration/String;;;Y NT;;;Play time in format : XXx YYy only, YYy omited if zero\n"
+ "Duration/String1;;;N NT;;;Play time in format : HHh MMmn SSs MMMms, XX omited if zero\n"
+ "Duration/String2;;;N NT;;;Play time in format : XXx YYy only, YYy omited if zero\n"
+ "Duration/String3;;;N NT;;;Play time in format : HH:MM:SS.MMM\n"
+ "Duration_Start;;;Y YT\n"
+ "Duration_End;;;Y YT\n"
+ "OverallBitRate_Mode;;;N YT;;;Bit rate mode of all streams (VBR, CBR)\n"
+ "OverallBitRate_Mode/String;;;Y NT;;;Bit rate mode of all streams (Variable, Constant)\n"
+ "OverallBitRate;; bps;N YF;;;Bit rate of all streams in bps\n"
+ "OverallBitRate/String;;;Y NT;;;Bit rate of all streams (with measure)\n"
+ "OverallBitRate_Minimum;; bps;N YF;;;Minimum Bit rate in bps\n"
+ "OverallBitRate_Minimum/String;;;Y NT;;;Minimum Bit rate (with measurement)\n"
+ "OverallBitRate_Nominal;; bps;N YF;;;Nominal Bit rate in bps\n"
+ "OverallBitRate_Nominal/String;;;Y NT;;;Nominal Bit rate (with measurement)\n"
+ "OverallBitRate_Maximum;; bps;N YF;;;Maximum Bit rate in bps\n"
+ "OverallBitRate_Maximum/String;;;Y NT;;;Maximum Bit rate (with measurement)\n"
+ "Delay;; ms;N NI;;;Delay fixed in the stream (relative) IN MS\n"
+ "Delay/String;;;N NT;;;Delay with measurement\n"
+ "Delay/String1;;;N NT;;;Delay with measurement\n"
+ "Delay/String2;;;N NT;;;Delay with measurement\n"
+ "Delay/String3;;;N NT;;;format : HH:MM:SS.MMM\n"
+ "StreamSize;; byte;N YI;;;Stream size in bytes\n"
+ "StreamSize/String;;;N NT\n"
+ "StreamSize/String1;;;N NT\n"
+ "StreamSize/String2;;;N NT\n"
+ "StreamSize/String3;;;N NT\n"
+ "StreamSize/String4;;;N NT\n"
+ "StreamSize/String5;;;N NT;;;With proportion\n"
+ "StreamSize_Proportion;;;N NT;;;Stream size divided by file size\n"
+ "HeaderSize;;;N NI\n"
+ "DataSize;;;N NI\n"
+ "FooterSize;;;N NI\n"
+ "Album_ReplayGain_Gain;; dB;N YT;;;The gain to apply to reach 89dB SPL on playback\n"
+ "Album_ReplayGain_Gain/String;;;Y YT\n"
+ "Album_ReplayGain_Peak;;;Y YT;;;The maximum absolute peak value of the item\n"
+ "Encryption;;;Y YT\n"
+ "Title;;;N NT;;;(Generic)Title of file;;Title\n"
+ "Title/More;;;N NT;;;(Generic)More info about the title of file;;Title\n"
+ "Title/Url;;;N NT;;;(Generic)Url;;Title\n"
+ "Domain;;;Y YT;;;Univers movies belong to, e.g. Starwars, Stargate, Buffy, Dragonballs;;Title\n"
+ "Collection;;;Y YT;;;Name of the series, e.g. Starwars movies, Stargate SG-1, Stargate Atlantis, Buffy, Angel;;Title\n"
+ "Season;;;Y YT;;;Name of the season, e.g. Strawars first Trilogy, Season 1;;Title\n"
+ "Season_Position;;;Y YI;;;Number of the Season;;Title\n"
+ "Season_Position_Total;;;Y YI;;;Place of the season e.g. 2 of 7;;Title\n"
+ "Movie;;;Y YT;;;Name of the movie. Eg : Starwars, a new hope;;Title\n"
+ "Movie/More;;;Y YT;;;More infos about the movie;;Title\n"
+ "Movie/Country;;;Y YT;;;Country, where the movie was procuced;;Title\n"
+ "Movie/Url;;;Y YT;;;Homepage for the movie;;Title\n"
+ "Album;;;Y YT;;;Name of an audio-album. Eg : The joshua tree;;Title\n"
+ "Album/More;;;Y YT;;;More infos about the album;;Title\n"
+ "Album/Sort;;;Y YT;;;;;Title\n"
+ "Comic;;;Y YT;;;Name of the comic.;;Title\n"
+ "Comic/More;;;Y YT;;;;;Title\n"
+ "Comic/Position_Total;;;Y YI;;;;;Title\n"
+ "Part;;;Y YT;;;Name of the part. e.g. CD1, CD2;;Title\n"
+ "Part/Position;;;Y YI;;;Number of the part;;Title\n"
+ "Part/Position_Total;;;Y YI;;;Place of the part e.g. 2 of 3;;Title\n"
+ "Track;;;Y YT;;;Name of the track. e.g. track1, track 2;;Title\n"
+ "Track/More;;;Y YT;;;More infos about the track;;Title\n"
+ "Track/Url;;;Y YT;;;Link to a site about this track;;Title\n"
+ "Track/Sort;;;Y YT;;;;;Title\n"
+ "Track/Position;;;Y YI;;;Number of this track;;Title\n"
+ "Track/Position_Total;;;Y YI;;;Place of this track, e.g. 3 of 15;;Title\n"
+ "Chapter;;;Y YT;;;Name of the chapter.;;Title\n"
+ "SubTrack;;;Y YT;;;Name of the subtrack.;;Title\n"
+ "Original/Album;;;Y YT;;;Original name of album, serie...;;Title\n"
+ "Original/Movie;;;Y YT;;;Original name of the movie;;Title\n"
+ "Original/Part;;;Y YT;;;Original name of the part in the original support;;Title\n"
+ "Original/Track;;;Y YT;;;Original name of the track in the original support;;Title\n"
+ "Performer;;;Y YT;;;Main performer/artist of this file;;Entity\n"
+ "Performer/Sort;;;Y YT;;;;;Entity\n"
+ "Performer/Url;;;Y YT;;;Homepage of the performer/artist;;Entity\n"
+ "Original/Performer;;;Y YT;;;Original artist(s)/performer(s).;;Entity\n"
+ "Accompaniment;;;Y YT;;;Band/orchestra/accompaniment/musician.;;Entity\n"
+ "Composer;;;Y YT;;;Name of the original composer.;;Entity\n"
+ "Composer/Nationality;;;Y YT;;;Nationality of the main composer of the item, mostly for classical music.;;Entity\n"
+ "Arranger;;;Y YT;;;The person who arranged the piece. e.g. Ravel.;;Entity\n"
+ "Lyricist;;;Y YT;;;The person who wrote the lyrics for a musical item.;;Entity\n"
+ "Original/Lyricist;;;Y YT;;;Original lyricist(s)/text writer(s).;;Entity\n"
+ "Conductor;;;Y YT;;;The artist(s) who performed the work. In classical music this would be the conductor, orchestra, soloists.;;Entity\n"
+ "Director;;;Y YT;;;Name of the director.;;Entity\n"
+ "AssistantDirector;;;Y YT;;;Name of the assistant director.;;Entity\n"
+ "DirectorOfPhotography;;;Y YT;;;The name of the director of photography, also known as cinematographer.;;Entity\n"
+ "SoundEngineer;;;Y YT;;;The name of the sound engineer or sound recordist.;;Entity\n"
+ "ArtDirector;;;Y YT;;;The person who oversees the artists and craftspeople who build the sets.;;Entity\n"
+ "ProductionDesigner;;;Y YT;;;The person responsible for designing the Overall visual appearance of a movie.;;Entity\n"
+ "Choregrapher;;;Y YT;;;The name of the choregrapher.;;Entity\n"
+ "CostumeDesigner;;;Y YT;;;The name of the costume designer.;;Entity\n"
+ "Actor;;;Y YT;;;Real name of an actor or actress playing a role in the movie.;;Entity\n"
+ "Actor_Character;;;Y YT;;;Name of the character an actor or actress plays in this movie.;;Entity\n"
+ "WrittenBy;;;Y YT;;;The author of the story or script.;;Entity\n"
+ "ScreenplayBy;;;Y YT;;;The author of the screenplay or scenario (used for movies and TV shows).;;Entity\n"
+ "EditedBy;;;Y YT;;;Editors name;;Entity\n"
+ "CommissionedBy;;;Y YT;;;name of the person or organization that commissioned the subject of the file;;Entity\n"
+ "Producer;;;Y YT;;;Name of the producer of the movie.;;Entity\n"
+ "CoProducer;;;Y YT;;;The name of a co-producer.;;Entity\n"
+ "ExecutiveProducer;;;Y YT;;;The name of an executive producer.;;Entity\n"
+ "MusicBy;;;Y YT;;;Main music-artist for a movie;;Entity\n"
+ "DistributedBy;;;Y YT;;;Company the item is mainly distributed by ;;Entity\n"
+ "OriginalSourceForm/DistributedBy;;;Y YT;;;Name of the person or organization who supplied the original subject;;Entity\n"
+ "MasteredBy;;;Y YT;;;The engineer who mastered the content for a physical medium or for digital distribution.;;Entity\n"
+ "EncodedBy;;;Y YT;;;Name of the person or organisation that encoded/ripped the audio file.;;Entity\n"
+ "RemixedBy;;;Y YT;;;Name of the artist(s), that interpreted, remixed, or otherwise modified the item.;;Entity\n"
+ "ProductionStudio;;;Y YT;;;Main production studio ;;Entity\n"
+ "ThanksTo;;;Y YT;;;A very general tag for everyone else that wants to be listed.;;Entity\n"
+ "Publisher;;;Y YT;;;Name of the organization publishing the album (i.e. the 'record label') or movie.;;Entity\n"
+ "Publisher/URL;;;Y YT;;;Publishers official webpage.;;Entity\n"
+ "Label;;;Y YT;;;Brand or trademark associated with the marketing of music recordings and music videos.;;Entity\n"
+ "Genre;;;Y YT;;;The main genre of the audio or video. e.g. classical, ambient-house, synthpop, sci-fi, drama, etc.;;Classification\n"
+ "Mood;;;Y YT;;;Intended to reflect the mood of the item with a few keywords, e.g. Romantic, Sad, Uplifting, etc.;;Classification\n"
+ "ContentType;;;Y YT;;;The type of the item. e.g. Documentary, Feature Film, Cartoon, Music Video, Music, Sound FX, etc.;;Classification\n"
+ "Subject;;;Y YT;;;Describes the topic of the file, such as Aerial view of Seattle..;;Classification\n"
+ "Description;;;Y YT;;;A short description of the contents, such as Two birds flying.;;Classification\n"
+ "Keywords;;;Y YT;;;Keywords to the item separated by a comma, used for searching.;;Classification\n"
+ "Summary;;;Y YT;;;A plot outline or a summary of the story.;;Classification\n"
+ "Synopsis;;;Y YT;;;A description of the story line of the item.;;Classification\n"
+ "Period;;;Y YT;;;Describes the period that the piece is from or about. e.g. Renaissance.;;Classification\n"
+ "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\n"
+ "LawRating_Reason;;;Y YT;;;Reason for the law rating;;Classification\n"
+ "ICRA;;;Y YT;;;The ICRA rating. (Previously RSACi);;Classification\n"
+ "Released_Date;;;Y YT;;;The date/year that the item was released.;;Temporal\n"
+ "Original/Released_Date;;;Y YT;;;The date/year that the item was originaly released.;;Temporal\n"
+ "Recorded_Date;;;Y YT;;;The time/date/year that the recording began.;;Temporal\n"
+ "Encoded_Date;;;Y YT;;;The time/date/year that the encoding of this item was completed began.;;Temporal\n"
+ "Tagged_Date;;;Y YT;;;The time/date/year that the tags were done for this item.;;Temporal\n"
+ "Written_Date;;;Y YT;;;The time/date/year that the composition of the music/script began.;;Temporal\n"
+ "Mastered_Date;;;Y YT;;;The time/date/year that the item was tranfered to a digitalmedium.;;Temporal\n"
+ "File_Created_Date;;;N NT;;;The time that the file was created on the file system;;Temporal\n"
+ "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\n"
+ "File_Modified_Date;;;N NT;;;The time that the file was modified on the file system;;Temporal\n"
+ "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\n"
+ "Recorded_Location;;;Y YT;;;Location where track was recorded. (See COMPOSITION_LOCATION for format);;Spatial\n"
+ "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\n"
+ "Archival_Location;;;Y YT;;;Location, where an item is archived, e.eg. Louvre,Paris,France;;Spatial\n"
+ "Encoded_Application;;;Y YT;;;Name of the software package used to create the file, such as Microsoft WaveEdit.;;Technical\n"
+ "Encoded_Application/Url;;;N YT;;;Name of the software package used to create the file, such as Microsoft WaveEdit.;;Technical\n"
+ "Encoded_Library;;;N YT;;;Software used to create the file;;Technical\n"
+ "Encoded_Library/String;;;Y NT;;;Software used to create the file;;Technical\n"
+ "Encoded_Library/Name;;;N NT;;;Name of the the encoding-software;;Technical\n"
+ "Encoded_Library/Version;;;N NT;;;Version of encoding-software;;Technical\n"
+ "Encoded_Library/Date;;;N NT;;;Release date of software;;Technical\n"
+ "Encoded_Library_Settings;;;Y YT;;;Parameters used by the software;;Technical\n"
+ "Cropped;;;Y YT;;;Describes whether an image has been cropped and, if so, how it was cropped.;;Technical\n"
+ "Dimensions;;;Y YT;;;Specifies the size of the original subject of the file. eg 8.5 in h, 11 in w;;Technical\n"
+ "DotsPerInch;;;Y YT;;;Stores dots per inch setting of the digitizer used to produce the file;;Technical\n"
+ "Lightness;;;Y YT;;;Describes the changes in lightness settings on the digitizer required to produce the file;;Technical\n"
+ "OriginalSourceMedium;;;Y YT;;;Original medium of the material, e.g. vinyl, Audio-CD, Super8 or BetaMax;;Technical\n"
+ "OriginalSourceForm;;;Y YT;;;Original form of the material, e.g. slide, paper, map;;Technical\n"
+ "OriginalSourceForm/NumColors;;;Y YT;;;Number of colors requested when digitizing, e.g. 256 for images or 32 bit RGB for video;;Technical\n"
+ "OriginalSourceForm/Name;;;Y YT;;;Name of the product the file was originally intended for;;Technical\n"
+ "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\n"
+ "OriginalSourceForm/Sharpness;;;Y YT;;;Identifies the changes in sharpness for the digitizer requiered to produce the file;;Technical\n"
+ "Tagged_Application;;;Y YT;;;Software used to tag this file;;Technical\n"
+ "BPM;;;Y YT;;;Average number of beats per minute;;Technical\n"
+ "ISRC;;;Y YT;;;International Standard Recording Code, excluding the ISRC prefix and including hyphens.;;Identifier\n"
+ "ISBN;;;Y YT;;;International Standard Book Number.;;Identifier\n"
+ "BarCode;;;Y YT;;;EAN-13 (13-digit European Article Numbering) or UPC-A (12-digit Universal Product Code) bar code identifier.;;Identifier\n"
+ "LCCN;;;Y YT;;;Library of Congress Control Number.;;Identifier\n"
+ "CatalogNumber;;;Y YT;;;A label-specific catalogue number used to identify the release. e.g. TIC 01.;;Identifier\n"
+ "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\n"
+ "Owner;;;Y YT;;;Owner of the file;;Legal\n"
+ "Copyright;;;Y YT;;;Copyright attribution.;;Legal\n"
+ "Copyright/Url;;;Y YT;;;Link to a site with copyright/legal information.;;Legal\n"
+ "Producer_Copyright;;;Y YT;;;The copyright information as per the productioncopyright holder.;;Legal\n"
+ "TermsOfUse;;;Y YT;;;License information, e.g., All Rights Reserved,Any Use Permitted.;;Legal\n"
+ "ServiceName;;;Y YT;;;;;Legal\n"
+ "ServiceChannel;;;Y YT;;;;;Legal\n"
+ "Service/Url;;;Y YT;;;;;Legal\n"
+ "ServiceProvider;;;Y YT;;;;;Legal\n"
+ "ServiceProviderr/Url;;;Y YT;;;;;Legal\n"
+ "ServiceType;;;Y YT;;;;;Legal\n"
+ "NetworkName;;;Y YT;;;;;Legal\n"
+ "OriginalNetworkName;;;Y YT;;;;;Legal\n"
+ "Country;;;Y YT;;;;;Legal\n"
+ "TimeZone;;;Y YT;;;;;Legal\n"
+ "Cover;;;Y YT;;;Is there a cover;;Info\n"
+ "Cover_Description;;;Y YT;;;short descriptio, e.g. Earth in space;;Info\n"
+ "Cover_Type;;;Y YT;;;;;Info\n"
+ "Cover_Mime;;;Y YT;;;;;Info\n"
+ "Cover_Data;;;N YT;;;Cover, in binary format encoded BASE64;;Info\n"
+ "Lyrics;;;Y YT;;;Text of a song;;Info\n"
+ "Comment;;;Y YT;;;Any comment related to the content.;;Personal\n"
+ "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\n"
+ "Added_Date;;;Y YT;;;Date/year the item was added to the owners collection;;Personal\n"
+ "Played_First_Date;;;Y YT;;;The date, the owner first played an item;;Personal\n"
+ "Played_Last_Date;;;Y YT;;;The date, the owner last played an item;;Personal\n"
+ "Played_Count;;;Y YI;;;Number of times an item was played;;Personal\n"
+ "EPG_Positions_Begin;;;N NI\n"
+ "EPG_Positions_End;;;N NI\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_Video (ZtringListList &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ "Count;;;N NI;;;Number of objects available in this stream\n"
+ "StreamCount;;;N NI;;;Number of streams of this kind available\n"
+ "StreamKind;Video;;N NI;;;Stream type name\n"
+ "StreamKind/String;;;N NI;;;Stream type name\n"
+ "StreamKindID;;;N NI;;;Number of the stream (base=0)\n"
+ "StreamKindPos;;;N NI;;;When multiple streams, number of the stream (base=1)\n"
+ "Inform;;;N NT;;;Last **Inform** call\n"
+ "ID;;;N YI;;;The ID for this stream in this file\n"
+ "ID/String;;;Y NT;;;The ID for this stream in this file\n"
+ "UniqueID;;;N YI;;;The unique ID for this stream, should be copied with stream copy\n"
+ "MenuID;;;N YI;;;The menu ID for this stream in this file\n"
+ "MenuID/String;;;Y NT;;;The menu ID for this stream in this file\n"
+ "Format;;;Y YT;;;Format used\n"
+ "Format/Info;;;Y NT;;;Info about Format\n"
+ "Format/Url;;;N NT;;;Link\n"
+ "Format_Commercial;;;N NT;;;Commercial name used by vendor for theses setings or Format field if there is no difference\n"
+ "Format_Commercial_IfAny;;;Y NT;;;Commercial name used by vendor for theses setings if there is one\n"
+ "Format_Version;;;Y NT;;;Version of this format\n"
+ "Format_Profile;;;Y NT;;;Profile of the Format\n"
+ "MultiView_BaseProfile;;;Y NT;;;Multiview, profile of the base stream\n"
+ "MultiView_Count;;;Y NT;;;Multiview, count of views\n"
+ "Format_Settings;;;N NT;;;Settings needed for decoder used, summary\n"
+ "Format_Settings_BVOP;;Yes;N YT;;;Settings needed for decoder used, detailled\n"
+ "Format_Settings_BVOP/String;;;Y NT;;;Settings needed for decoder used, detailled\n"
+ "Format_Settings_QPel;;Yes;N YT;;;Settings needed for decoder used, detailled\n"
+ "Format_Settings_QPel/String;;;Y NT;;;Settings needed for decoder used, detailled\n"
+ "Format_Settings_GMC;; warppoint;N YI;;;Settings needed for decoder used, detailled\n"
+ "Format_Settings_GMC/String;;;Y NT\n"
+ "Format_Settings_Matrix;;;N YT;;;Settings needed for decoder used, detailled\n"
+ "Format_Settings_Matrix/String;;;Y NT;;;Settings needed for decoder used, detailled\n"
+ "Format_Settings_Matrix_Data;;;N NT;;;Matrix, in binary format encoded BASE64. Order = intra, non-intra, gray intra, gray non-intra\n"
+ "Format_Settings_CABAC;;Yes;N YT;;;Settings needed for decoder used, detailled\n"
+ "Format_Settings_CABAC/String;;;Y NT;;;Settings needed for decoder used, detailled\n"
+ "Format_Settings_RefFrames;; frame;N YI;;;Settings needed for decoder used, detailled\n"
+ "Format_Settings_RefFrames/String;;;Y NT;;;Settings needed for decoder used, detailled\n"
+ "Format_Settings_Pulldown;;;Y YT;;;Settings needed for decoder used, detailled\n"
+ "Format_Settings_FrameMode;;;Y YT;;;Settings needed for decoder used, detailled\n"
+ "Format_Settings_GOP;;;Y YT;;;Settings needed for decoder used, detailled (M=x N=y)\n"
+ "Format_Settings_FrameStructures;;;Y YT;;;Settings needed for decoder used, detailled (Type of frame, and field/frame info)\n"
+ "InternetMediaType;;;N YT;;;Internet Media Type (aka MIME Type, Content-Type)\n"
+ "MuxingMode;;;Y NT;;;How this file is muxed in the container\n"
+ "CodecID;;;Y YT;;;Codec ID (found in some containers)\n"
+ "CodecID/Info;;;Y NT;;;Info on the codec\n"
+ "CodecID/Hint;;;Y NT;;;Hint/popular name for this codec\n"
+ "CodecID/Url;;;N NT;;;Homepage for more details about this codec\n"
+ "CodecID_Description;;;Y NT;;;Manual description given by the container\n"
+ "Codec;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/String;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/Family;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/Info;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/Url;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/CC;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Profile;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Description;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings_PacketBitStream;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings_BVOP;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings_QPel;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings_GMC;; warppoint;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings_GMC/String;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings_Matrix;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings_Matrix_Data;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings_CABAC;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings_RefFrames;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Duration;; ms;N YI;;;Play time of the stream in ms\n"
+ "Duration/String;;;Y NT;;;Play time in format : XXx YYy only, YYy omited if zero\n"
+ "Duration/String1;;;N NT;;;Play time in format : HHh MMmn SSs MMMms, XX omited if zero\n"
+ "Duration/String2;;;N NT;;;Play time in format : XXx YYy only, YYy omited if zero\n"
+ "Duration/String3;;;N NT;;;Play time in format : HH:MM:SS.MMM\n"
+ "Duration/String4;;;N NT;;;Play time in format : HH:MM:SS:FF (HH:MM:SS;FF for drop frame, if available)\n"
+ "Duration_LastFrame;; ms;N YI;;;Duration of the last frame if it is longer than others, in ms\n"
+ "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\n"
+ "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\n"
+ "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\n"
+ "Duration_LastFrame/String3;;;N NT;;;Duration of the last frame if it is longer than others, in format : HH:MM:SS.MMM\n"
+ "BitRate_Mode;;;N YT;;;Bit rate mode (VBR, CBR)\n"
+ "BitRate_Mode/String;;;Y NT;;;Bit rate mode (Variable, Cconstant)\n"
+ "BitRate;; bps;N YF;;;Bit rate in bps\n"
+ "BitRate/String;;;Y NT;;;Bit rate (with measurement)\n"
+ "BitRate_Minimum;; bps;N YF;;;Minimum Bit rate in bps\n"
+ "BitRate_Minimum/String;;;Y NT;;;Minimum Bit rate (with measurement)\n"
+ "BitRate_Nominal;; bps;N YF;;;Nominal Bit rate in bps\n"
+ "BitRate_Nominal/String;;;Y NT;;;Nominal Bit rate (with measurement)\n"
+ "BitRate_Maximum;; bps;N YF;;;Maximum Bit rate in bps\n"
+ "BitRate_Maximum/String;;;Y NT;;;Maximum Bit rate (with measurement)\n"
+ "Width;; pixel;N YI;;;Width in pixel\n"
+ "Width/String;;;Y NT;;;Width with measurement (pixel)\n"
+ "Width_Original;; pixel;N YI;;;Original (in the raw stream) Width in pixel\n"
+ "Width_Original/String;;;Y NT;;;Original (in the raw stream) Width with measurement (pixel)\n"
+ "Height;; pixel;N YI;;;Original (in the raw stream) Height in pixel\n"
+ "Height/String;;;Y NT;;;Original (in the raw stream) Height with measurement (pixel)\n"
+ "Height_Original;; pixel;N YI;;;Height in pixel\n"
+ "Height_Original/String;;;Y NT;;;Height with measurement (pixel)\n"
+ "PixelAspectRatio;;;N YF;;;Pixel Aspect ratio\n"
+ "PixelAspectRatio/String;;;N NT;;;Pixel Aspect ratio\n"
+ "PixelAspectRatio_Original;;;N YF;;;Original (in the raw stream) Pixel Aspect ratio\n"
+ "PixelAspectRatio_Original/String;;;N NT;;;Original (in the raw stream) Pixel Aspect ratio\n"
+ "DisplayAspectRatio;;;N YF;;;Display Aspect ratio\n"
+ "DisplayAspectRatio/String;;;Y NT;;;Display Aspect ratio\n"
+ "DisplayAspectRatio_Original;;;N YF;;;Original (in the raw stream) Display Aspect ratio\n"
+ "DisplayAspectRatio_Original/String;;;Y NT;;;Original (in the raw stream) Display Aspect ratio\n"
+ "Rotation;;;N YT;;;Rotation\n"
+ "Rotation/String;;;Y NT;;;Rotation (if not horizontal)\n"
+ "FrameRate_Mode;;;N YT;;;Frame rate mode (CFR, VFR)\n"
+ "FrameRate_Mode/String;;;Y NT;;;Frame rate mode (Constant, Variable)\n"
+ "FrameRate_Mode_Original;;;N YT;;;Original frame rate mode (CFR, VFR)\n"
+ "FrameRate_Mode_Original/String;;;Y NT;;;Original frame rate mode (Constant, Variable)\n"
+ "FrameRate;; fps;N YF;;;Frames per second\n"
+ "FrameRate/String;;;Y NT;;;Frames per second (with measurement)\n"
+ "FrameRate_Original;; fps;N YF;;;Original (in the raw stream) frames per second\n"
+ "FrameRate_Original/String;;;Y NT;;;Original (in the raw stream) frames per second (with measurement)\n"
+ "FrameRate_Minimum;; fps;N YF;;;Minimum Frames per second\n"
+ "FrameRate_Minimum/String;;;Y NT;;;Minimum Frames per second (with measurement)\n"
+ "FrameRate_Nominal;; fps;N YF;;;Nominal Frames per second\n"
+ "FrameRate_Nominal/String;;;Y NT;;;Nominal Frames per second (with measurement)\n"
+ "FrameRate_Maximum;; fps;N YF;;;Maximum Frames per second\n"
+ "FrameRate_Maximum/String;;;Y NT;;;Maximum Frames per second (with measurement)\n"
+ "FrameCount;;;N NI;;;Number of frames\n"
+ "Standard;;;Y NT;;;NTSC or PAL\n"
+ "Resolution;; bit;N NI;;;Deprecated, do not use in new projects\n"
+ "Resolution/String;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Colorimetry;;;N NT;;;Deprecated, do not use in new projects\n"
+ "ColorSpace;;;Y YT\n"
+ "ChromaSubsampling;;;Y YT\n"
+ "BitDepth;; bit;N YI;;;16/24/32 \n"
+ "BitDepth/String;;;Y NT;;;16/24/32 bits\n"
+ "ScanType;;;N YT\n"
+ "ScanType/String;;;Y NT\n"
+ "ScanOrder;;;N YT\n"
+ "ScanOrder/String;;;Y NT\n"
+ "Interlacement;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Interlacement/String;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Bits-(Pixel*Frame);;;Y YF;;;bits/(Pixel*Frame) (like Gordian Knot)\n"
+ "Delay;; ms;N NI;;;Delay fixed in the stream (relative) IN MS\n"
+ "Delay/String;;;N NT;;;Delay with measurement\n"
+ "Delay/String1;;;N NT;;;Delay with measurement\n"
+ "Delay/String2;;;N NT;;;Delay with measurement\n"
+ "Delay/String3;;;N NT;;;format : HH:MM:SS.MMM\n"
+ "Delay/String4;;;N NT;;;Delay in format : HH:MM:SS:FF (HH:MM:SS;FF for drop frame, if available)\n"
+ "Delay_Settings;;;N NT;;;Delay settings (in case of timecode for example)\n"
+ "Delay_Original;; ms;N NI;;;Delay fixed in the raw stream (relative) IN MS\n"
+ "Delay_Original/String;;;N NT;;;Delay with measurement\n"
+ "Delay_Original/String1;;;N NT;;;Delay with measurement\n"
+ "Delay_Original/String2;;;N NT;;;Delay with measurement\n"
+ "Delay_Original/String3;;;N NT;;;format : HH:MM:SS.MMM\n"
+ "Delay-Original/String4;;;N NT;;;Delay in format : HH:MM:SS:FF (HH:MM:SS;FF for drop frame, if available)\n"
+ "Delay_Original_Settings;;;N NT;;;Delay settings (in case of timecode for example)\n"
+ "StreamSize;; byte;N YI;;;Stream size in bytes\n"
+ "StreamSize/String;;;Y NT;;;Streamsize in with percentage value\n"
+ "StreamSize/String1;;;N NT;;;Streamsize with measurement\n"
+ "StreamSize/String2;;;N NT;;;Streamsize with measurement\n"
+ "StreamSize/String3;;;N NT;;;Streamsize with measurement\n"
+ "StreamSize/String4;;;N NT;;;Streamsize with measurement\n"
+ "StreamSize/String5;;;N NT;;;Streamsize in with percentage value\n"
+ "StreamSize_Proportion;;;N NT;;;Stream size divided by file size\n"
+ "Alignment;;;Y NT;;;How this stream file is aligned in the container\n"
+ "Alignment/String;;;N YT\n"
+ "Title;;;Y YI;;;Name of the track\n"
+ "Encoded_Application;;;Y YT;;;Software. Identifies the name of the software package used to create the file, such as Microsoft WaveEdit.;;Technical\n"
+ "Encoded_Application/Url;;;N YT;;;Software. Identifies the name of the software package used to create the file, such as Microsoft WaveEdit.;;Technical\n"
+ "Encoded_Library;;;N YT;;;Software used to create the file\n"
+ "Encoded_Library/String;;;Y NT;;;Software used to create the file\n"
+ "Encoded_Library/Name;;;N NT;;;Info from the software\n"
+ "Encoded_Library/Version;;;N NT;;;Version of software\n"
+ "Encoded_Library/Date;;;N NT;;;Release date of software\n"
+ "Encoded_Library_Settings;;;Y YT;;;Parameters used by the software\n"
+ "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)\n"
+ "Language/String;;;Y NT;;;Language (full)\n"
+ "Language/String1;;;N NT;;;Language (full)\n"
+ "Language/String2;;;N NT;;;Language (2-letter ISO 639-1 if exists, else empty)\n"
+ "Language/String3;;;N NT;;;Language (3-letter ISO 639-2 if exists, else empty)\n"
+ "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)\n"
+ "Language_More;;;Y YT;;;More info about Language (e.g. Director's Comment)\n"
+ "Encoded_Date;;;Y YT;;;UTC time that the encoding of this item was completed began.;;Temporal\n"
+ "Tagged_Date;;;Y YT;;;UTC time that the tags were done for this item.;;Temporal\n"
+ "Encryption;;;Y YT\n"
+ "BufferSize;;;N YT;;;Defines the size of the buffer needed to decode the sequence.\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_Audio (ZtringListList &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ "Count;;;N NI;;;Number of objects available in this stream\n"
+ "StreamCount;;;N NI;;;Number of streams of this kind available\n"
+ "StreamKind;Audio;;N NI;;;Stream type name\n"
+ "StreamKind/String;;;N NI;;;Stream type name\n"
+ "StreamKindID;;;N NI;;;Number of the stream (base=0)\n"
+ "StreamKindPos;;;N NI;;;When multiple streams, number of the stream (base=1)\n"
+ "Inform;;;N NT;;;Last **Inform** call\n"
+ "ID;;;N YI;;;The ID of this stream in this file\n"
+ "ID/String;;;Y NT;;;The ID of this stream in this file\n"
+ "UniqueID;;;N YI;;;A unique ID for this stream, should be copied with stream copy\n"
+ "MenuID;;;N YI;;;The menu ID for this stream in this file\n"
+ "MenuID/String;;;Y NT;;;The menu ID for this stream in this file\n"
+ "Format;;;Y YT;;;Format used\n"
+ "Format/Info;;;Y NT;;;Info about the format\n"
+ "Format/Url;;;N NT;;;Homepage of this format\n"
+ "Format_Commercial;;;N NT;;;Commercial name used by vendor for theses setings or Format field if there is no difference\n"
+ "Format_Commercial_IfAny;;;Y NT;;;Commercial name used by vendor for theses setings if there is one\n"
+ "Format_Version;;;Y NT;;;Version of this format\n"
+ "Format_Profile;;;Y NT;;;Profile of this Format\n"
+ "Format_Settings;;;N NT;;;Settings needed for decoder used, summary\n"
+ "Format_Settings_SBR;;Yes;N YT\n"
+ "Format_Settings_SBR/String;;;Y NT\n"
+ "Format_Settings_PS;;Yes;N YT\n"
+ "Format_Settings_PS/String;;;Y NT\n"
+ "Format_Settings_Mode;;;Y YT\n"
+ "Format_Settings_ModeExtension;;;Y YT\n"
+ "Format_Settings_Emphasis;;;Y YT\n"
+ "Format_Settings_Floor;;;Y YT\n"
+ "Format_Settings_Firm;;;Y YT\n"
+ "Format_Settings_Endianness;;;Y YT\n"
+ "Format_Settings_Sign;;;Y YT\n"
+ "Format_Settings_Law;;;Y YT\n"
+ "Format_Settings_ITU;;;Y YT\n"
+ "InternetMediaType;;;N YT;;;Internet Media Type (aka MIME Type, Content-Type)\n"
+ "MuxingMode;;;Y NT;;;How this stream is muxed in the container\n"
+ "MuxingMode_MoreInfo;;;Y NT;;;More info (text) about the muxing mode\n"
+ "CodecID;;;Y YT;;;Codec ID (found in some containers)\n"
+ "CodecID/Info;;;Y NT;;;Info about codec ID\n"
+ "CodecID/Hint;;;Y NT;;;Hint/popular name for this codec ID\n"
+ "CodecID/Url;;;N NT;;;Homepage for more details about this codec ID\n"
+ "CodecID_Description;;;Y NT;;;Manual description given by the container\n"
+ "Codec;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/String;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/Family;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/Info;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/Url;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/CC;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Description;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Profile;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings_Automatic;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings_Floor;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings_Firm;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings_Endianness;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings_Sign;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings_Law;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec_Settings_ITU;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Duration;; ms;N YI;;;Play time of the stream\n"
+ "Duration/String;;;Y NT;;;Play time in format : XXx YYy only, YYy omited if zero\n"
+ "Duration/String1;;;N NT;;;Play time in format : HHh MMmn SSs MMMms, XX omited if zero\n"
+ "Duration/String2;;;N NT;;;Play time in format : XXx YYy only, YYy omited if zero\n"
+ "Duration/String3;;;N NT;;;Play time in format : HH:MM:SS.MMM\n"
+ "BitRate_Mode;;;N YT;;;Bit rate mode (VBR, CBR)\n"
+ "BitRate_Mode/String;;;Y NT;;;Bit rate mode (Constant, Variable)\n"
+ "BitRate;; bps;N YF;;;Bit rate in bps\n"
+ "BitRate/String;;;Y NT;;;Bit rate (with measurement)\n"
+ "BitRate_Minimum;; bps;N YF;;;Minimum Bit rate in bps\n"
+ "BitRate_Minimum/String;;;Y NT;;;Minimum Bit rate (with measurement)\n"
+ "BitRate_Nominal;; bps;N YF;;;Nominal Bit rate in bps\n"
+ "BitRate_Nominal/String;;;Y NT;;;Nominal Bit rate (with measurement)\n"
+ "BitRate_Maximum;; bps;N YF;;;Maximum Bit rate in bps\n"
+ "BitRate_Maximum/String;;;Y NT;;;Maximum Bit rate (with measurement)\n"
+ "Channel(s);; channel;N YF;;;Number of channels\n"
+ "Channel(s)/String;;;Y NT;;;Number of channels (with measurement)\n"
+ "ChannelPositions;;;Y YT;;;Position of channels\n"
+ "ChannelPositions/String2;;;N NT;;;Position of channels (x/y.z format)\n"
+ "SamplingRate;; Hz;N YF;;;Sampling rate\n"
+ "SamplingRate/String;;;Y NT;;;in KHz\n"
+ "SamplingCount;;;N NI;;;Sample count (based on sampling rate)\n"
+ "FrameCount;;;N NI;;;Frame count (a frame contains a count of samples depends of the format)\n"
+ "Resolution;; bit;N NI;;;Deprecated, do not use in new projects\n"
+ "Resolution/String;;;N NT;;;Deprecated, do not use in new projects\n"
+ "BitDepth;; bit;N YI;;;Resolution in bits (8, 16, 20, 24)\n"
+ "BitDepth/String;;;Y NT;;;Resolution in bits (8, 16, 20, 24)\n"
+ "CompressionRatio;;;Y YF;;;Current stream size divided by uncompressed stream size\n"
+ "Delay;; ms;N YI;;;Delay fixed in the stream (relative)\n"
+ "Delay/String;;;N NT;;;Delay in format : XXx YYy only, YYy omited if zero\n"
+ "Delay/String1;;;N NT;;;Delay in format : HHh MMmn SSs MMMms, XX omited if zero\n"
+ "Delay/String2;;;N NT;;;Delay in format : XXx YYy only, YYy omited if zero\n"
+ "Delay/String3;;;N NT;;;Delay in format : HH:MM:SS.MMM\n"
+ "Delay_Original;; ms;N NI;;;Delay fixed in the raw stream (relative) IN MS\n"
+ "Delay_Original/String;;;N NT;;;Delay with measurement\n"
+ "Delay_Original/String1;;;N NT;;;Delay with measurement\n"
+ "Delay_Original/String2;;;N NT;;;Delay with measurement\n"
+ "Delay_Original/String3;;;N NT;;;format : HH:MM:SS.MMM\n"
+ "Delay_Original_Settings;;;N NT;;;Delay settings (in case of timecode for example)\n"
+ "Video_Delay;; ms;N NI;;;Delay fixed in the stream (absolute / video)\n"
+ "Video_Delay/String;;;Y NT\n"
+ "Video_Delay/String1;;;N NT\n"
+ "Video_Delay/String2;;;N NT\n"
+ "Video_Delay/String3;;;N NT\n"
+ "Video0_Delay;; ms;N NI;;;Deprecated, do not use in new projects\n"
+ "Video0_Delay/String;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Video0_Delay/String1;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Video0_Delay/String2;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Video0_Delay/String3;;;N NT;;;Deprecated, do not use in new projects\n"
+ "ReplayGain_Gain;; dB;N YT;;;The gain to apply to reach 89dB SPL on playback\n"
+ "ReplayGain_Gain/String;;;Y YT\n"
+ "ReplayGain_Peak;;;Y YT;;;The maximum absolute peak value of the item\n"
+ "StreamSize;; byte;N YI;;;Streamsize in bytes\n"
+ "StreamSize/String;;;Y NT;;;Streamsize in with percentage value\n"
+ "StreamSize/String1;;;N NT\n"
+ "StreamSize/String2;;;N NT\n"
+ "StreamSize/String3;;;N NT\n"
+ "StreamSize/String4;;;N NT\n"
+ "StreamSize/String5;;;N NT;;;Streamsize in with percentage value\n"
+ "StreamSize_Proportion;;;N NT;;;Stream size divided by file size\n"
+ "Alignment;;;N YT;;;How this stream file is aligned in the container\n"
+ "Alignment/String;;;Y NT;;;Where this stream file is aligned in the container\n"
+ "Interleave_VideoFrames;;;N YF;;;Between how many video frames the stream is inserted\n"
+ "Interleave_Duration;;;N YI;;;Between how much time (ms) the stream is inserted\n"
+ "Interleave_Duration/String;;;Y NT;;;Between how much time and video frames the stream is inserted (with measurement)\n"
+ "Interleave_Preload;;;N YI;;;How much time is buffered before the first video frame\n"
+ "Interleave_Preload/String;;;Y NT;;;How much time is buffered before the first video frame (with measurement)\n"
+ "Title;;;Y YI;;;Name of the track\n"
+ "Encoded_Library;;;N YT;;;Software used to create the file\n"
+ "Encoded_Library/String;;;Y NT;;;Software used to create the file\n"
+ "Encoded_Library/Name;;;N NT;;;Info from the software\n"
+ "Encoded_Library/Version;;;N NT;;;Version of software\n"
+ "Encoded_Library/Date;;;N NT;;;Release date of software\n"
+ "Encoded_Library_Settings;;;Y YT;;;Parameters used by the software\n"
+ "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)\n"
+ "Language/String;;;Y NT;;;Language (full)\n"
+ "Language/String1;;;N NT;;;Language (full)\n"
+ "Language/String2;;;N NT;;;Language (2-letter ISO 639-1 if exists, else empty)\n"
+ "Language/String3;;;N NT;;;Language (3-letter ISO 639-2 if exists, else empty)\n"
+ "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)\n"
+ "Language_More;;;Y YT;;;More info about Language (e.g. Director's Comment)\n"
+ "Encoded_Date;;;Y YT;;;UTC time that the encoding of this item was completed began.;;Temporal\n"
+ "Tagged_Date;;;Y YT;;;UTC time that the tags were done for this item.;;Temporal\n"
+ "Encryption;;;Y YT\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_Text (ZtringListList &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ "Count;;;N NI;;;Count of objects available in this stream\n"
+ "StreamCount;;;N NI;;;Count of streams of that kind available\n"
+ "StreamKind;Text;;N NI;;;Stream type name\n"
+ "StreamKind/String;;;N NI;;;Stream type name\n"
+ "StreamKindID;;;N NI;;;Number of the stream (base=0)\n"
+ "StreamKindPos;;;N NI;;;When multiple streams, number of the stream (base=1)\n"
+ "Inform;;;N NT;;;Last **Inform** call\n"
+ "ID;;;N YI;;;A ID for this stream in this file\n"
+ "ID/String;;;Y NT;;;A ID for this stream in this file\n"
+ "UniqueID;;;N YI;;;A unique ID for this stream, should be copied with stream copy\n"
+ "MenuID;;;N YI;;;A menu ID for this stream in this file\n"
+ "MenuID/String;;;Y NT;;;A menu ID for this stream in this file\n"
+ "Format;;;Y YT;;;Format used\n"
+ "Format/Info;;;Y NT;;;Info about Format\n"
+ "Format/Url;;;N NT;;;Link\n"
+ "Format_Commercial;;;N NT;;;Commercial name used by vendor for theses setings or Format field if there is no difference\n"
+ "Format_Commercial_IfAny;;;Y NT;;;Commercial name used by vendor for theses setings if there is one\n"
+ "Format_Version;;;Y NT;;;Version of this format\n"
+ "Format_Profile;;;Y NT;;;Profile of the Format\n"
+ "Format_Settings;;;Y NT;;;Settings needed for decoder used\n"
+ "InternetMediaType;;;N YT;;;Internet Media Type (aka MIME Type, Content-Type)\n"
+ "MuxingMode;;;Y NT;;;How this stream is muxed in the container\n"
+ "MuxingMode_MoreInfo;;;Y NT;;;More info (text) about the muxing mode\n"
+ "CodecID;;;Y YT;;;Codec ID (found in some containers)\n"
+ "CodecID/Info;;;Y NT;;;Info about codec ID\n"
+ "CodecID/Hint;;;Y NT;;;A hint for this codec ID\n"
+ "CodecID/Url;;;N NT;;;A link for more details about this codec ID\n"
+ "CodecID_Description;;;Y NT;;;Manual description given by the container\n"
+ "Codec;;;N YT;;;Deprecated\n"
+ "Codec/String;;;N NT;;;Deprecated\n"
+ "Codec/Info;;;N NT;;;Deprecated\n"
+ "Codec/Url;;;N NT;;;Deprecated\n"
+ "Codec/CC;;;N NT;;;Deprecated\n"
+ "Duration;; ms;N YI;;;Play time of the stream\n"
+ "Duration/String;;;Y NT;;;Play time (formated)\n"
+ "Duration/String1;;;N NT;;;Play time in format : HHh MMmn SSs MMMms, XX omited if zero\n"
+ "Duration/String2;;;N NT;;;Play time in format : XXx YYy only, YYy omited if zero\n"
+ "Duration/String3;;;N NT;;;Play time in format : HH:MM:SS.MMM\n"
+ "Duration/String4;;;N NT;;;Play time in format : HH:MM:SS:FF (HH:MM:SS;FF for drop frame, if available)\n"
+ "BitRate_Mode;;;N YT;;;Bit rate mode (VBR, CBR)\n"
+ "BitRate_Mode/String;;;Y NT;;;Bit rate mode (Constant, Variable)\n"
+ "BitRate;; bps;N YF;;;Bit rate in bps\n"
+ "BitRate/String;;;Y NT;;;Bit rate (with measurement)\n"
+ "BitRate_Minimum;; bps;N YF;;;Minimum Bit rate in bps\n"
+ "BitRate_Minimum/String;;;Y NT;;;Minimum Bit rate (with measurement)\n"
+ "BitRate_Nominal;; bps;N YF;;;Nominal Bit rate in bps\n"
+ "BitRate_Nominal/String;;;Y NT;;;Nominal Bit rate (with measurement)\n"
+ "BitRate_Maximum;; bps;N YF;;;Maximum Bit rate in bps\n"
+ "BitRate_Maximum/String;;;Y NT;;;Maximum Bit rate (with measurement)\n"
+ "Width;; pixel;N YI;;;Width\n"
+ "Width/String;;;Y NT\n"
+ "Height;; pixel;N YI;;;Height\n"
+ "Height/String;;;Y NT\n"
+ "FrameRate_Mode;;;N YT;;;Frame rate mode (CFR, VFR)\n"
+ "FrameRate_Mode/String;;;Y NT;;;Frame rate mode (Constant, Variable)\n"
+ "FrameRate;; fps;N YF;;;Frames per second\n"
+ "FrameRate/String;;;Y NT;;;Frames per second (with measurement)\n"
+ "FrameRate_Minimum;; fps;N YF;;;Minimum Frames per second\n"
+ "FrameRate_Minimum/String;;;Y NT;;;Minimum Frames per second (with measurement)\n"
+ "FrameRate_Nominal;; fps;N YF;;;Nominal Frames per second\n"
+ "FrameRate_Nominal/String;;;Y NT;;;Nominal Frames per second (with measurement)\n"
+ "FrameRate_Maximum;; fps;N YF;;;Maximum Frames per second\n"
+ "FrameRate_Maximum/String;;;Y NT;;;Maximum Frames per second (with measurement)\n"
+ "FrameRate_Original;; fps;N YF;;;Original (in the raw stream) Frames per second\n"
+ "FrameRate_Original/String;;;Y NT;;;Original (in the raw stream) Frames per second (with measurement)\n"
+ "FrameCount;;;N NI;;;Number of frames\n"
+ "ColorSpace;;;Y YT\n"
+ "ChromaSubsampling;;;Y YT\n"
+ "Resolution;; bit;N NI;;;Deprecated, do not use in new projects\n"
+ "Resolution/String;;;N NT;;;Deprecated, do not use in new projects\n"
+ "BitDepth;; bit;N YI\n"
+ "BitDepth/String;;;Y NT\n"
+ "Delay;; ms;N YI;;;Delay fixed in the stream (relative)\n"
+ "Delay/String;;;N NT\n"
+ "Delay/String1;;;N NT\n"
+ "Delay/String2;;;N NT\n"
+ "Delay/String3;;;N NT\n"
+ "Delay_Original;; ms;N NI;;;Delay fixed in the raw stream (relative) IN MS\n"
+ "Delay_Original/String;;;N NT;;;Delay with measurement\n"
+ "Delay_Original/String1;;;N NT;;;Delay with measurement\n"
+ "Delay_Original/String2;;;N NT;;;Delay with measurement\n"
+ "Delay_Original/String3;;;N NT;;;format : HH:MM:SS.MMM\n"
+ "Delay_Original_Settings;;;N NT;;;Delay settings (in case of timecode for example)\n"
+ "Video_Delay;; ms;N NI;;;Delay fixed in the stream (absolute / video)\n"
+ "Video_Delay/String;;;Y NT\n"
+ "Video_Delay/String1;;;N NT\n"
+ "Video_Delay/String2;;;N NT\n"
+ "Video_Delay/String3;;;N NT\n"
+ "Video0_Delay;; ms;N NI;;;Deprecated\n"
+ "Video0_Delay/String;;;N NT;;;Deprecated\n"
+ "Video0_Delay/String1;;;N NT;;;Deprecated\n"
+ "Video0_Delay/String2;;;N NT;;;Deprecated\n"
+ "Video0_Delay/String3;;;N NT;;;Deprecated\n"
+ "StreamSize;; byte;N YI;;;Stream size in bytes\n"
+ "StreamSize/String;;;Y NT\n"
+ "StreamSize/String1;;;N NT\n"
+ "StreamSize/String2;;;N NT\n"
+ "StreamSize/String3;;;N NT\n"
+ "StreamSize/String4;;;N NT\n"
+ "StreamSize/String5;;;N NT;;;With proportion\n"
+ "StreamSize_Proportion;;;N NT;;;Stream size divided by file size\n"
+ "Title;;;Y YI;;;Name of the track\n"
+ "Encoded_Library;;;N YT;;;Software used to create the file\n"
+ "Encoded_Library/String;;;Y NT;;;Software used to create the file\n"
+ "Encoded_Library/Name;;;N NT;;;Info from the software\n"
+ "Encoded_Library/Version;;;N NT;;;Version of software\n"
+ "Encoded_Library/Date;;;N NT;;;Release date of software\n"
+ "Encoded_Library_Settings;;;Y YT;;;Parameters used by the software\n"
+ "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)\n"
+ "Language/String;;;Y NT;;;Language (full)\n"
+ "Language/String1;;;N NT;;;Language (full)\n"
+ "Language/String2;;;N NT;;;Language (2-letter ISO 639-1 if exists, else empty)\n"
+ "Language/String3;;;N NT;;;Language (3-letter ISO 639-2 if exists, else empty)\n"
+ "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)\n"
+ "Language_More;;;Y YT;;;More info about Language (e.g. Director's Comment)\n"
+ "Summary;;;N NT\n"
+ "Encoded_Date;;;Y YT;;;The time that the encoding of this item was completed began.;;Temporal\n"
+ "Tagged_Date;;;Y YT;;;The time that the tags were done for this item.;;Temporal\n"
+ "Encryption;;;Y YT\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_Chapters (ZtringListList &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ "Count;;;N NI;;;Count of objects available in this stream\n"
+ "StreamCount;;;N NI;;;Count of streams of that kind available\n"
+ "StreamKind;Chapters;;N NI;;;Stream type name\n"
+ "StreamKind/String;;;N NI;;;Stream type name\n"
+ "StreamKindID;;;N NI;;;Number of the stream (base=0)\n"
+ "StreamKindPos;;;N NI;;;When multiple streams, number of the stream (base=1)\n"
+ "Inform;;;N NT;;;Last **Inform** call\n"
+ "ID;;;N YI;;;A ID for this stream in this file\n"
+ "ID/String;;;Y NT;;;A ID for this stream in this file\n"
+ "UniqueID;;;N YI;;;A unique ID for this stream, should be copied with stream copy\n"
+ "MenuID;;;N YI;;;The menu ID for this stream in this file\n"
+ "MenuID/String;;;Y NT;;;The menu ID for this stream in this file\n"
+ "Format;;;Y YT;;;Format used\n"
+ "Format/Info;;;Y NT;;;Info about Format\n"
+ "Format/Url;;;N NT;;;Link\n"
+ "Codec;;;N YT;;;Deprecated\n"
+ "Codec/String;;;Y NT;;;Deprecated\n"
+ "Codec/Info;;;Y NT;;;Deprecated\n"
+ "Codec/Url;;;Y YT;;;Deprecated\n"
+ "Total;;;N YT;;;Total number of chapters\n"
+ "Title;;;Y YI;;;Name of the track\n"
+ "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)\n"
+ "Language/String;;;Y NT;;;Language (full)\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_Image (ZtringListList &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ "Count;;;N YI;;;Count of objects available in this stream\n"
+ "StreamCount;;;N YI;;;Count of streams of that kind available\n"
+ "StreamKind;Image;;N NI;;;Stream type name\n"
+ "StreamKind/String;;;N NI;;;Stream type name\n"
+ "StreamKindID;;;N NI;;;Number of the stream (base=0)\n"
+ "StreamKindPos;;;N NI;;;When multiple streams, number of the stream (base=1)\n"
+ "Inform;;;N NT;;;Last **Inform** call\n"
+ "ID;;;N YI;;;A ID for this stream in this file\n"
+ "ID/String;;;Y NT;;;The ID for this stream in this file\n"
+ "UniqueID;;;N YI;;;A unique ID for this stream, should be copied with stream copy\n"
+ "MenuID;;;N YI;;;The menu ID for this stream in this file\n"
+ "MenuID/String;;;Y NT;;;The menu ID for this stream in this file\n"
+ "Title;;;Y YI;;;Name of the track\n"
+ "Format;;;Y YT;;;Format used\n"
+ "Format/Info;;;Y NT;;;Info about Format\n"
+ "Format/Url;;;N NT;;;Link\n"
+ "Format_Commercial;;;N NT;;;Commercial name used by vendor for theses setings or Format field if there is no difference\n"
+ "Format_Commercial_IfAny;;;Y NT;;;Commercial name used by vendor for theses setings if there is one\n"
+ "Format_Version;;;Y NT;;;Version of this format\n"
+ "Format_Profile;;;Y NT;;;Profile of the Format\n"
+ "Format_Settings;;;Y NT;;;Settings needed for decoder used\n"
+ "InternetMediaType;;;N YT;;;Internet Media Type (aka MIME Type, Content-Type)\n"
+ "CodecID;;;Y YT;;;Codec ID (found in some containers)\n"
+ "CodecID/Info;;;Y NT;;;Info about codec ID\n"
+ "CodecID/Hint;;;Y NT;;;A hint for this codec ID\n"
+ "CodecID/Url;;;N NT;;;A link for more details about this codec ID\n"
+ "CodecID_Description;;;Y NT;;;Manual description given by the container\n"
+ "Codec;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/String;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/Family;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/Info;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Codec/Url;;;N NT;;;Deprecated, do not use in new projects\n"
+ "Width;; pixel;N YI;;;Width\n"
+ "Width/String;;;Y NT\n"
+ "Height;; pixel;N YI;;;Height\n"
+ "Height/String;;;Y NT\n"
+ "ColorSpace;;;Y YT\n"
+ "ChromaSubsampling;;;Y YT\n"
+ "Resolution;; bit;N NI;;;Deprecated, do not use in new projects\n"
+ "Resolution/String;;;N NT;;;Deprecated, do not use in new projects\n"
+ "BitDepth;; bit;N YI\n"
+ "BitDepth/String;;;Y NT\n"
+ "StreamSize;; byte;N YI;;;Stream size in bytes\n"
+ "StreamSize/String;;;Y NT\n"
+ "StreamSize/String1;;;N NT\n"
+ "StreamSize/String2;;;N NT\n"
+ "StreamSize/String3;;;N NT\n"
+ "StreamSize/String4;;;N NT\n"
+ "StreamSize/String5;;;N NT;;;With proportion\n"
+ "StreamSize_Proportion;;;N NT;;;Stream size divided by file size\n"
+ "Encoded_Library;;;N YT;;;Software used to create the file\n"
+ "Encoded_Library/String;;;Y NT;;;Software used to create the file\n"
+ "Encoded_Library/Name;;;N NT;;;Info from the software\n"
+ "Encoded_Library/Version;;;N NT;;;Version of software\n"
+ "Encoded_Library/Date;;;N NT;;;Release date of software\n"
+ "Encoded_Library_Settings;;;Y YT;;;Parameters used by the software\n"
+ "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)\n"
+ "Language/String;;;Y NT;;;Language (full)\n"
+ "Language/String1;;;N NT;;;Language (full)\n"
+ "Language/String2;;;N NT;;;Language (2-letter ISO 639-1 if exists, else empty)\n"
+ "Language/String3;;;N NT;;;Language (3-letter ISO 639-2 if exists, else empty)\n"
+ "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)\n"
+ "Summary;;;N NT\n"
+ "Encoded_Date;;;Y YT;;;The time that the encoding of this item was completed began.;;Temporal\n"
+ "Tagged_Date;;;Y YT;;;The time that the tags were done for this item.;;Temporal\n"
+ "Encryption;;;Y YT\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_Menu (ZtringListList &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ "Count;;;N NI;;;Count of objects available in this stream\n"
+ "StreamCount;;;N NI;;;Count of streams of that kind available\n"
+ "StreamKind;Menu;;N NI;;;Stream type name\n"
+ "StreamKind/String;;;N NI;;;Stream type name\n"
+ "StreamKindID;;;N NI;;;Number of the stream (base=0)\n"
+ "StreamKindPos;;;N NI;;;When multiple streams, number of the stream (base=1)\n"
+ "Inform;;;N NT;;;Last **Inform** call\n"
+ "ID;;;N YI;;;A ID for this stream in this file\n"
+ "ID/String;;;Y NT;;;A ID for this stream in this file\n"
+ "UniqueID;;;N YI;;;A unique ID for this stream, should be copied with stream copy\n"
+ "MenuID;;;N YI;;;A menu ID for this stream in this file\n"
+ "MenuID/String;;;Y NT;;;A menu ID for this stream in this file\n"
+ "Format;;;N YT;;;Format used\n"
+ "Format/Info;;;N NT;;;Info about Format\n"
+ "Format/Url;;;N NT;;;Link\n"
+ "Format_Commercial;;;N NT;;;Commercial name used by vendor for theses setings or Format field if there is no difference\n"
+ "Format_Commercial_IfAny;;;Y NT;;;Commercial name used by vendor for theses setings if there is one\n"
+ "Format_Version;;;Y NT;;;Version of this format\n"
+ "Format_Profile;;;Y NT;;;Profile of the Format\n"
+ "Format_Settings;;;Y NT;;;Settings needed for decoder used\n"
+ "CodecID;;;Y YT;;;Codec ID (found in some containers)\n"
+ "CodecID/Info;;;Y NT;;;Info about this codec\n"
+ "CodecID/Hint;;;Y NT;;;A hint/popular name for this codec\n"
+ "CodecID/Url;;;N NT;;;A link to more details about this codec ID\n"
+ "CodecID_Description;;;Y NT;;;Manual description given by the container\n"
+ "Codec;;;N YT;;;Deprecated\n"
+ "Codec/String;;;N NT;;;Deprecated\n"
+ "Codec/Info;;;N NT;;;Deprecated\n"
+ "Codec/Url;;;N NT;;;Deprecated\n"
+ "Duration;; ms;N YI;;;Play time of the stream in ms\n"
+ "Duration/String;;;Y NT;;;Play time in format : XXx YYy only, YYy omited if zero\n"
+ "Duration/String1;;;N NT;;;Play time in format : HHh MMmn SSs MMMms, XX omited if zero\n"
+ "Duration/String2;;;N NT;;;Play time in format : XXx YYy only, YYy omited if zero\n"
+ "Duration/String3;;;N NT;;;Play time in format : HH:MM:SS.MMM\n"
+ "Duration_Start;;;Y YT\n"
+ "Duration_End;;;Y YT\n"
+ "Delay;; ms;N NI;;;Delay fixed in the stream (relative) IN MS\n"
+ "Delay/String;;;N NT;;;Delay with measurement\n"
+ "Delay/String1;;;N NT;;;Delay with measurement\n"
+ "Delay/String2;;;N NT;;;Delay with measurement\n"
+ "Delay/String3;;;N NT;;;format : HH:MM:SS.MMM\n"
+ "List_StreamKind;;;N YT;;;List of programs available\n"
+ "List_StreamPos;;;N YT;;;List of programs available\n"
+ "List;;;N YT;;;List of programs available\n"
+ "List/String;;;Y NT;;;List of programs available\n"
+ "Title;;;Y YI;;;Name of this menu\n"
+ "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)\n"
+ "Language/String;;;Y NT;;;Language (full)\n"
+ "Language/String1;;;N NT;;;Language (full)\n"
+ "Language/String2;;;N NT;;;Language (2-letter ISO 639-1 if exists, else empty)\n"
+ "Language/String3;;;N NT;;;Language (3-letter ISO 639-2 if exists, else empty)\n"
+ "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)\n"
+ "Language_More;;;Y YT;;;More info about Language (e.g. Director's Comment)\n"
+ "ServiceName;;;Y YT;;;;;Legal\n"
+ "ServiceChannel;;;Y YT;;;;;Legal\n"
+ "Service/Url;;;Y YT;;;;;Legal\n"
+ "ServiceProvider;;;Y YT;;;;;Legal\n"
+ "ServiceProviderr/Url;;;Y YT;;;;;Legal\n"
+ "ServiceType;;;Y YT;;;;;Legal\n"
+ "NetworkName;;;Y YT;;;;;Legal\n"
+ "Original/NetworkName;;;Y YT;;;;;Legal\n"
+ "Countries;;;Y YT;;;;;Legal\n"
+ "TimeZones;;;Y YT;;;;;Legal\n"
+ "Chapters_Pos_Begin;;;N NI;;;Used by third-party developpers to know about the begining 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\n"
+ "Chapters_Pos_End;;;N NI;;;Used by third-party developpers to know about the end of the chapters list (this position excluded)\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_Iso639_1 (InfoMap &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ "aar;aa\n"
+ "abk;ab\n"
+ "ave;ae\n"
+ "afr;af\n"
+ "aka;ak\n"
+ "amh;am\n"
+ "arg;an\n"
+ "ara;ar\n"
+ "asm;as\n"
+ "ava;av\n"
+ "aym;ay\n"
+ "aze;az\n"
+ "bak;ba\n"
+ "bel;be\n"
+ "bul;bg\n"
+ "bih;bh\n"
+ "bis;bi\n"
+ "bam;bm\n"
+ "ben;bn\n"
+ "tib;bo\n"
+ "tib;bo\n"
+ "bre;br\n"
+ "bos;bs\n"
+ "cat;ca\n"
+ "che;ce\n"
+ "cha;ch\n"
+ "cos;co\n"
+ "cre;cr\n"
+ "ces;cs\n"
+ "cze;cs\n"
+ "chu;cu\n"
+ "chv;cv\n"
+ "cym;cy\n"
+ "wel;cy\n"
+ "dan;da\n"
+ "deu;de\n"
+ "ger;de\n"
+ "div;dv\n"
+ "dzo;dz\n"
+ "ewe;ee\n"
+ "gre;el\n"
+ "ell;el\n"
+ "eng;en\n"
+ "epo;eo\n"
+ "spa;es\n"
+ "est;et\n"
+ "baq;eu\n"
+ "eus;eu\n"
+ "fas;fa\n"
+ "per;fa\n"
+ "ful;ff\n"
+ "fin;fi\n"
+ "fij;fj\n"
+ "fao;fo\n"
+ "fra;fr\n"
+ "fre;fr\n"
+ "fry;fy\n"
+ "gle;ga\n"
+ "gla;gd\n"
+ "glg;gl\n"
+ "grn;gn\n"
+ "guj;gu\n"
+ "glv;gv\n"
+ "hau;ha\n"
+ "heb;he\n"
+ "hin;hi\n"
+ "hmo;ho\n"
+ "hrv;hr\n"
+ "hrv;hr\n"
+ "hat;ht\n"
+ "hun;hu\n"
+ "hye;hy\n"
+ "arm;hy\n"
+ "her;hz\n"
+ "ina;ia\n"
+ "ind;id\n"
+ "ile;ie\n"
+ "ibo;ig\n"
+ "iii;ii\n"
+ "ipk;ik\n"
+ "ido;io\n"
+ "ice;is\n"
+ "isl;is\n"
+ "ita;it\n"
+ "iku;iu\n"
+ "jpn;ja\n"
+ "jav;jv\n"
+ "geo;ka\n"
+ "kat;ka\n"
+ "kon;kg\n"
+ "kik;ki\n"
+ "kua;kj\n"
+ "kaz;kk\n"
+ "kal;kl\n"
+ "khm;km\n"
+ "kan;kn\n"
+ "kor;ko\n"
+ "kau;kr\n"
+ "kas;ks\n"
+ "kur;ku\n"
+ "kom;kv\n"
+ "cor;kw\n"
+ "kir;ky\n"
+ "lat;la\n"
+ "ltz;lb\n"
+ "lug;lg\n"
+ "lim;li\n"
+ "lin;ln\n"
+ "lao;lo\n"
+ "lit;lt\n"
+ "lub;lu\n"
+ "lav;lv\n"
+ "mlg;mg\n"
+ "mah;mh\n"
+ "mao;mi\n"
+ "mri;mi\n"
+ "mac;mk\n"
+ "mkd;mk\n"
+ "mal;ml\n"
+ "mon;mn\n"
+ "mol;mo\n"
+ "mar;mr\n"
+ "may;ms\n"
+ "msa;ms\n"
+ "mlt;mt\n"
+ "bur;my\n"
+ "mya;my\n"
+ "nau;na\n"
+ "nob;nb\n"
+ "nde;nd\n"
+ "nde;nd\n"
+ "nep;ne\n"
+ "ndo;ng\n"
+ "dut;nl\n"
+ "nld;nl\n"
+ "nno;nn\n"
+ "nor;no\n"
+ "nbl;nr\n"
+ "nbl;nr\n"
+ "nav;nv\n"
+ "nya;ny\n"
+ "oci;oc\n"
+ "oji;oj\n"
+ "orm;om\n"
+ "ori;or\n"
+ "oss;os\n"
+ "pan;pa\n"
+ "pli;pi\n"
+ "pol;pl\n"
+ "pus;ps\n"
+ "por;pt\n"
+ "que;qu\n"
+ "roh;rm\n"
+ "run;rn\n"
+ "ron;ro\n"
+ "rum;ro\n"
+ "rus;ru\n"
+ "kin;rw\n"
+ "san;sa\n"
+ "srd;sc\n"
+ "snd;sd\n"
+ "sme;se\n"
+ "sag;sg\n"
+ "sin;si\n"
+ "slk;sk\n"
+ "slo;sk\n"
+ "slv;sl\n"
+ "smo;sm\n"
+ "sna;sn\n"
+ "som;so\n"
+ "alb;sq\n"
+ "sqi;sq\n"
+ "scc;sr\n"
+ "srp;sr\n"
+ "ssw;ss\n"
+ "sot;st\n"
+ "sun;su\n"
+ "swe;sv\n"
+ "swa;sw\n"
+ "tam;ta\n"
+ "tel;te\n"
+ "tgk;tg\n"
+ "tha;th\n"
+ "tir;ti\n"
+ "tuk;tk\n"
+ "tgl;tl\n"
+ "tsn;tn\n"
+ "ton;to\n"
+ "tur;tr\n"
+ "tso;ts\n"
+ "tat;tt\n"
+ "twi;tw\n"
+ "tah;ty\n"
+ "uig;ug\n"
+ "ukr;uk\n"
+ "urd;ur\n"
+ "uzb;uz\n"
+ "ven;ve\n"
+ "vie;vi\n"
+ "vol;vo\n"
+ "wln;wa\n"
+ "wol;wo\n"
+ "xho;xh\n"
+ "yid;yi\n"
+ "yor;yo\n"
+ "zha;za\n"
+ "chi;zh\n"
+ "zho;zh\n"
+ "zul;zu\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_Iso639_2 (InfoMap &Info)
+{
+ Info.Separator_Set(0, _T("\n"));
+ Info.Write(Ztring().From_UTF8(
+ "aa;aar\n"
+ "ab;abk\n"
+ "ae;ave\n"
+ "af;afr\n"
+ "ak;aka\n"
+ "am;amh\n"
+ "an;arg\n"
+ "ar;ara\n"
+ "as;asm\n"
+ "av;ava\n"
+ "ay;aym\n"
+ "az;aze\n"
+ "ba;bak\n"
+ "be;bel\n"
+ "bg;bul\n"
+ "bh;bih\n"
+ "bi;bis\n"
+ "bm;bam\n"
+ "bn;ben\n"
+ "bo;tib\n"
+ "bo;tib\n"
+ "br;bre\n"
+ "bs;bos\n"
+ "ca;cat\n"
+ "ce;che\n"
+ "ch;cha\n"
+ "co;cos\n"
+ "cr;cre\n"
+ "cs;ces\n"
+ "cs;cze\n"
+ "cu;chu\n"
+ "cv;chv\n"
+ "cy;cym\n"
+ "cy;wel\n"
+ "da;dan\n"
+ "de;deu\n"
+ "de;ger\n"
+ "dv;div\n"
+ "dz;dzo\n"
+ "ee;ewe\n"
+ "el;gre\n"
+ "el;ell\n"
+ "en;eng\n"
+ "eo;epo\n"
+ "es;spa\n"
+ "et;est\n"
+ "eu;baq\n"
+ "eu;eus\n"
+ "fa;fas\n"
+ "fa;per\n"
+ "ff;ful\n"
+ "fi;fin\n"
+ "fj;fij\n"
+ "fo;fao\n"
+ "fr;fra\n"
+ "fr;fre\n"
+ "fy;fry\n"
+ "ga;gle\n"
+ "gd;gla\n"
+ "gl;glg\n"
+ "gn;grn\n"
+ "gu;guj\n"
+ "gv;glv\n"
+ "ha;hau\n"
+ "he;heb\n"
+ "hi;hin\n"
+ "ho;hmo\n"
+ "hr;hrv\n"
+ "hr;hrv\n"
+ "ht;hat\n"
+ "hu;hun\n"
+ "hy;hye\n"
+ "hy;arm\n"
+ "hz;her\n"
+ "ia;ina\n"
+ "id;ind\n"
+ "ie;ile\n"
+ "ig;ibo\n"
+ "ii;iii\n"
+ "ik;ipk\n"
+ "io;ido\n"
+ "is;ice\n"
+ "is;isl\n"
+ "it;ita\n"
+ "iu;iku\n"
+ "ja;jpn\n"
+ "jv;jav\n"
+ "ka;geo\n"
+ "ka;kat\n"
+ "kg;kon\n"
+ "ki;kik\n"
+ "kj;kua\n"
+ "kk;kaz\n"
+ "kl;kal\n"
+ "km;khm\n"
+ "kn;kan\n"
+ "ko;kor\n"
+ "kr;kau\n"
+ "ks;kas\n"
+ "ku;kur\n"
+ "kv;kom\n"
+ "kw;cor\n"
+ "ky;kir\n"
+ "la;lat\n"
+ "lb;ltz\n"
+ "lg;lug\n"
+ "li;lim\n"
+ "ln;lin\n"
+ "lo;lao\n"
+ "lt;lit\n"
+ "lu;lub\n"
+ "lv;lav\n"
+ "mg;mlg\n"
+ "mh;mah\n"
+ "mi;mao\n"
+ "mi;mri\n"
+ "mk;mac\n"
+ "mk;mkd\n"
+ "ml;mal\n"
+ "mn;mon\n"
+ "mo;mol\n"
+ "mr;mar\n"
+ "ms;may\n"
+ "ms;msa\n"
+ "mt;mlt\n"
+ "my;bur\n"
+ "my;mya\n"
+ "na;nau\n"
+ "nb;nob\n"
+ "nd;nde\n"
+ "nd;nde\n"
+ "ne;nep\n"
+ "ng;ndo\n"
+ "nl;dut\n"
+ "nl;nld\n"
+ "nn;nno\n"
+ "no;nor\n"
+ "nr;nbl\n"
+ "nr;nbl\n"
+ "nv;nav\n"
+ "ny;nya\n"
+ "oc;oci\n"
+ "oj;oji\n"
+ "om;orm\n"
+ "or;ori\n"
+ "os;oss\n"
+ "pa;pan\n"
+ "pi;pli\n"
+ "pl;pol\n"
+ "ps;pus\n"
+ "pt;por\n"
+ "qu;que\n"
+ "rm;roh\n"
+ "rn;run\n"
+ "ro;ron\n"
+ "ro;rum\n"
+ "ru;rus\n"
+ "rw;kin\n"
+ "sa;san\n"
+ "sc;srd\n"
+ "sd;snd\n"
+ "se;sme\n"
+ "sg;sag\n"
+ "si;sin\n"
+ "sk;slk\n"
+ "sk;slo\n"
+ "sl;slv\n"
+ "sm;smo\n"
+ "sn;sna\n"
+ "so;som\n"
+ "sq;alb\n"
+ "sq;sqi\n"
+ "sr;scc\n"
+ "sr;srp\n"
+ "ss;ssw\n"
+ "st;sot\n"
+ "su;sun\n"
+ "sv;swe\n"
+ "sw;swa\n"
+ "ta;tam\n"
+ "te;tel\n"
+ "tg;tgk\n"
+ "th;tha\n"
+ "ti;tir\n"
+ "tk;tuk\n"
+ "tl;tgl\n"
+ "tn;tsn\n"
+ "to;ton\n"
+ "tr;tur\n"
+ "ts;tso\n"
+ "tt;tat\n"
+ "tw;twi\n"
+ "ty;tah\n"
+ "ug;uig\n"
+ "uk;ukr\n"
+ "ur;urd\n"
+ "uz;uzb\n"
+ "ve;ven\n"
+ "vi;vie\n"
+ "vo;vol\n"
+ "wa;wln\n"
+ "wo;wol\n"
+ "xh;xho\n"
+ "yi;yid\n"
+ "yo;yor\n"
+ "za;zha\n"
+ "zh;chi\n"
+ "zh;zho\n"
+ "zu;zul\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Config_Library_DivX (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"
+ "413;5.0.0;UTC 2002-03-04\n"
+ "450;5.0.1;UTC 2002-04-09\n"
+ "481;5.0.2;UTC 2002-05-16\n"
+ "484;5.0.2;UTC 2002-05-16\n"
+ "487;5.0.2;UTC 2002-05-16\n"
+ "696;5.0.5 Beta(Tahanea);UTC 2003-01\n"
+ "740;5.0.3;UTC 2003-01-24\n"
+ "795;5.0.4 Beta1or2(Schizo);UTC 2003-01\n"
+ "804;5.0.4 Beta3(Schizo);UTC 2003-01\n"
+ "814;5.0.4 Beta4(Schizo);UTC 2003-01\n"
+ "822;5.0.4;UTC 2003-04-17\n"
+ "830;5.0.5;UTC 2003-04-24\n"
+ "894;5.0.5 Kauehi;UTC 2003-07-02\n"
+ "922;5.1.0 Beta1(Manihi);UTC 2003-07-26\n"
+ "936;5.1.0 Beta2(Kaukura);UTC 2003-08-02\n"
+ "959;5.1.0;UTC 2003-09-02\n"
+ "985;5.1.0 (HD?);UTC 2003-10\n"
+ "1009;5.1.1 Beta1;UTC 2003-10-21\n"
+ "1025;5.1.1 Beta2;UTC 2003-11\n"
+ "1031;5.1.1 (Maupiti);UTC 2003-11-19\n"
+ "1263;5.2.0;UTC 2004-07-15\n"
+ "1272;5.2.0 (DrDivX 105);UTC 2004-07-17\n"
+ "1307;5.2.1 Alpha;UTC 2004-09-08\n"
+ "1314;5.2.1 Beta;UTC 2004-09-08\n"
+ "1328;5.2.1 (WaffleDay);UTC 2004-09-08\n"
+ "1338;5.2.1 (DrDivX 106);UTC 2004-09-08\n"
+ "1394;5.3.0 Plasma Alpha (Tritium);UTC 2004-09-08\n"
+ "1408;5.3.0 Plasma Alpha (CoreBurn);UTC 2004-10\n"
+ "1429;>5.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%)]\n"
+ "Chapters;[%Language/String%, ]%Total% chapters[, %Format%][ (%Format_Commercial_IfAny%)]\n"
+ ));
+ Info.Separator_Set(0, ZenLib::EOL);
+}
+
+} //NameSpace
diff --git a/src/thirdparty/MediaInfo/MediaInfo_Config_MediaInfo.cpp b/src/thirdparty/MediaInfo/MediaInfo_Config_MediaInfo.cpp
new file mode 100644
index 000000000..09958c8de
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfo_Config_MediaInfo.cpp
@@ -0,0 +1,621 @@
+// MediaInfo_Config_MediaInfo - Configuration class
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+#include "MediaInfo/MediaInfo_Config_MediaInfo.h"
+#include "ZenLib/ZtringListListF.h"
+#include <algorithm>
+using namespace ZenLib;
+using namespace std;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Info
+//***************************************************************************
+
+MediaInfo_Config_MediaInfo::MediaInfo_Config_MediaInfo()
+{
+ FileIsSeekable=true;
+ FileIsSub=false;
+ FileKeepInfo=false;
+ FileStopAfterFilled=false;
+ File_Filter_HasChanged_=false;
+ #if MEDIAINFO_EVENTS
+ Event_CallBackFunction=NULL;
+ Event_UserHandler=NULL;
+ #endif //MEDIAINFO_EVENTS
+
+ //Specific
+ File_MpegTs_ForceMenu=false;
+ File_MpegTs_stream_type_Trust=true;
+ File_Bdmv_ParseTargetedFile=true;
+ File_DvDif_Analysis=false;
+ State=0;
+}
+
+//***************************************************************************
+// Info
+//***************************************************************************
+
+Ztring MediaInfo_Config_MediaInfo::Option (const String &Option, const String &Value)
+{
+ 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_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";
+ }
+ 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_filter"))
+ {
+ File_Filter_Set(Ztring(Value).To_int64u());
+ return _T("");
+ }
+ else if (Option_Lower==_T("file_filter_get"))
+ {
+ return Ztring();//.From_Number(File_Filter_Get());
+ }
+ else if (Option_Lower==_T("file_duplicate"))
+ {
+ return File_Duplicate_Set(Value);
+ }
+ else if (Option_Lower==_T("file_duplicate_get"))
+ {
+ //if (File_Duplicate_Get())
+ return _T("1");
+ //else
+ // return _T("");
+ }
+ 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_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_analysis"))
+ {
+ File_DvDif_Analysis_Set(!(Value==_T("0") || Value.empty()));
+ return _T("");
+ }
+ else if (Option_Lower==_T("file_dvdif_analysis_get"))
+ {
+ return File_DvDif_Analysis_Get()?"1":"0";
+ }
+ else if (Option_Lower==_T("file_curl"))
+ {
+ File_Curl_Set(Value);
+ return _T("");
+ }
+ else if (Option_Lower==_T("file_curl_get"))
+ {
+ return File_Curl_Get(Value);
+ }
+ 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 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 Keep Info
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+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;
+}
+
+//***************************************************************************
+// 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;
+}
+
+//***************************************************************************
+// 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;
+}
+
+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;
+}
+
+//***************************************************************************
+// 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<List.size(); Pos++)
+ {
+ //Form= "(-)Data", if "-" the value will be removed
+ Ztring &Value=List[Pos];
+ bool ToRemove=false;
+ if (Value.find(_T('-'))==0)
+ {
+ Value.erase(Value.begin());
+ ToRemove=true;
+ }
+
+ //Testing if this is information about a target
+ if (List[Pos].find(_T("memory:"))==0 || List[Pos].find(_T("file:"))==0)
+ {
+ //Searching if already exist
+ size_t Memory_Pos=File__Duplicate_Memory_Indexes.Find(List[Pos]);
+ if (!ToRemove && Memory_Pos==Error)
+ {
+ //Does not exist yet (and adding is wanted)
+ Memory_Pos=File__Duplicate_Memory_Indexes.Find(_T(""));
+ if (Memory_Pos!=Error)
+ File__Duplicate_Memory_Indexes[Memory_Pos]=List[Pos]; //A free place is found
+ else
+ {
+ //Adding the place at the end
+ Memory_Pos=File__Duplicate_Memory_Indexes.size();
+ File__Duplicate_Memory_Indexes.push_back(List[Pos]);
+ }
+ }
+ else if (ToRemove)
+ {
+ //Exists yet but Removal is wanted
+ File__Duplicate_Memory_Indexes[Memory_Pos].clear();
+ Memory_Pos=(size_t)-1;
+ }
+
+ ToReturn+=_T(";")+Ztring().From_Number(Memory_Pos);
+ }
+ }
+ if (!ToReturn.empty())
+ ToReturn.erase(ToReturn.begin()); //Remove first ";"
+
+ CS.Leave();
+ File_IsSeekable_Set(false); //If duplication, we can not seek anymore
+
+ return ToReturn;
+}
+
+Ztring MediaInfo_Config_MediaInfo::File_Duplicate_Get (size_t AlreadyRead_Pos)
+{
+ CriticalSectionLocker CSL(CS);
+ if (AlreadyRead_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();
+}
+
+//***************************************************************************
+// 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; Pos<List.size(); Pos++)
+ {
+ if (List[Pos].find(_T("CallBack=memory://"))==0)
+ Event_CallBackFunction=(MediaInfo_Event_CallBackFunction*)Ztring(List[Pos].substr(18, std::string::npos)).To_int64u();
+ else if (List[Pos].find(_T("UserHandler=memory://"))==0)
+ Event_UserHandler=(void*)Ztring(List[Pos].substr(21, std::string::npos)).To_int64u();
+ else
+ return("Problem during Event_CallBackFunction value parsing");
+ }
+
+ return Ztring();
+}
+#endif //MEDIAINFO_EVENTS
+
+//---------------------------------------------------------------------------
+#if MEDIAINFO_EVENTS
+void MediaInfo_Config_MediaInfo::Event_Send (const int8u* Data_Content, size_t Data_Size)
+{
+ CriticalSectionLocker CSL(CS);
+
+ if (Event_CallBackFunction)
+ Event_CallBackFunction ((unsigned char*)Data_Content, Data_Size, Event_UserHandler);
+}
+#endif //MEDIAINFO_EVENTS
+
+//---------------------------------------------------------------------------
+#if MEDIAINFO_EVENTS
+void MediaInfo_Config_MediaInfo::Event_Send (const int8u* Data_Content, size_t Data_Size, const Ztring &File_Name)
+{
+ CriticalSectionLocker CSL(CS);
+
+ if (Event_CallBackFunction)
+ Event_CallBackFunction ((unsigned char*)Data_Content, Data_Size, Event_UserHandler);
+ else
+ {
+ MediaInfo_Event_Generic* Event_Generic=(MediaInfo_Event_Generic*)Data_Content;
+ if ((Event_Generic->EventCode&0x00FFFF00)==(MediaInfo_Event_Global_Demux<<8))
+ {
+ if (!MediaInfoLib::Config.Demux_Get())
+ return;
+
+ if (File_Name.empty())
+ return;
+
+ MediaInfo_Event_Global_Demux_0* Event=(MediaInfo_Event_Global_Demux_0*)Data_Content;
+
+ Ztring File_Name_Final(File_Name);
+ bool AddRawExtension=false;
+ for (size_t Pos=0; Pos<Event->StreamIDs_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] && Event->StreamIDs_Width[Pos]<=16)
+ {
+ Ztring ID;
+ ID.From_Number(Event->StreamIDs[Pos], 16);
+ while (ID.size()<Event->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
+ AddRawExtension=true;
+ }
+ if (AddRawExtension)
+ File_Name_Final+=_T(".raw");
+
+ File F;
+ F.Open(File_Name_Final, File::Access_Write_Append);
+ F.Write(Event->Content, Event->Content_Size);
+ }
+ }
+}
+#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_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;
+}
+
+//---------------------------------------------------------------------------
+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;
+}
+
+//---------------------------------------------------------------------------
+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;
+ }
+}
+
+Ztring MediaInfo_Config_MediaInfo::File_Curl_Get (const Ztring &Field_)
+{
+ Ztring Field=Field_; Field.MakeLowerCase();
+ CriticalSectionLocker CSL(CS);
+ return Curl[Field];
+}
+
+//***************************************************************************
+// 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
+
diff --git a/src/thirdparty/MediaInfo/MediaInfo_Config_MediaInfo.h b/src/thirdparty/MediaInfo/MediaInfo_Config_MediaInfo.h
new file mode 100644
index 000000000..7a4afc5fc
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfo_Config_MediaInfo.h
@@ -0,0 +1,153 @@
+// MediaInfo_Config_MediaInfo - Configuration class
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Configuration of MediaInfo (per MediaInfo block)
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_Config_MediaInfoH
+#define MediaInfo_Config_MediaInfoH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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/ZtringListList.h"
+#include "ZenLib/Translation.h"
+#include "ZenLib/InfoMap.h"
+#include <map>
+#include <vector>
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class MediaInfo_Config_MediaInfo
+//***************************************************************************
+
+class MediaInfo_Config_MediaInfo
+{
+public :
+ //Constructor/Destructor
+ 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_KeepInfo_Set (bool NewValue);
+ bool File_KeepInfo_Get ();
+
+ void File_StopAfterFilled_Set (bool NewValue);
+ bool File_StopAfterFilled_Get ();
+
+ void File_ForceParser_Set (const Ztring &NewValue);
+ Ztring File_ForceParser_Get ();
+
+ void File_Filter_Set (int64u NewValue);
+ bool File_Filter_Get (const int16u Value);
+ bool File_Filter_Get ();
+ bool File_Filter_HasChanged();
+
+ 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
+
+ size_t File__Duplicate_Memory_Indexes_Get (const Ztring &ToFind);
+ void File__Duplicate_Memory_Indexes_Erase (const Ztring &ToFind);
+
+ #if MEDIAINFO_EVENTS
+ bool Event_CallBackFunction_IsSet ();
+ Ztring Event_CallBackFunction_Set (const Ztring &Value);
+ 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);
+ #else //MEDIAINFO_EVENTS
+ bool Event_CallBackFunction_IsSet () {return false;}
+ void Event_Send(const int8u*, size_t) {};
+ void Event_Send(const int8u*, size_t, const Ztring &) {};
+ #endif //MEDIAINFO_EVENTS
+
+ //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_Bdmv_ParseTargetedFile_Set (bool NewValue);
+ bool File_Bdmv_ParseTargetedFile_Get ();
+ void File_DvDif_Analysis_Set (bool NewValue);
+ bool File_DvDif_Analysis_Get ();
+ void File_Curl_Set (const Ztring &NewValue);
+ Ztring File_Curl_Get (const Ztring &Field);
+
+ //Analysis internal
+ void State_Set (float State);
+ float State_Get ();
+
+private :
+ bool FileIsSeekable;
+ bool FileIsSub;
+ bool FileKeepInfo;
+ bool FileStopAfterFilled;
+ Ztring File_ForceParser;
+
+ //Extra
+ std::map<int16u, bool> File_Filter_16;
+ bool File_Filter_HasChanged_;
+
+ std::vector<Ztring> File__Duplicate_List;
+ ZtringList File__Duplicate_Memory_Indexes;
+
+ //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
+
+ //Specific
+ bool File_MpegTs_ForceMenu;
+ bool File_MpegTs_stream_type_Trust;
+ bool File_Bdmv_ParseTargetedFile;
+ bool File_DvDif_Analysis;
+
+ //Analysis internal
+ float State;
+
+ //Generic
+ std::map<Ztring, Ztring> Curl;
+
+ ZenLib::CriticalSection CS;
+};
+
+} //NameSpace
+
+#endif
+
diff --git a/src/thirdparty/MediaInfo/MediaInfo_Const.h b/src/thirdparty/MediaInfo/MediaInfo_Const.h
new file mode 100644
index 000000000..39ff064be
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfo_Const.h
@@ -0,0 +1,143 @@
+// MediaInfo_Config - Configuration class
+// Copyright (C) 2005-2007 Jerome Martinez, Zen@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Global configuration of MediaInfo
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_ConstH
+#define MediaInfo_ConstH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include <string>
+#include <ZenLib/Conf.h>
+//---------------------------------------------------------------------------
+
+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_Chapters, ///< 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;
+ #undef __T
+ #define __T(__x) L ## __x
+#else
+ typedef char Char;
+ #undef __T
+ #define __T(__x) __x
+#endif
+typedef std::basic_string<MediaInfoLib::Char> String;
+typedef std::basic_stringstream<MediaInfoLib::Char> StringStream;
+typedef std::basic_istringstream<MediaInfoLib::Char> tiStringStream;
+typedef std::basic_ostringstream<MediaInfoLib::Char> toStringStream;
+//---------------------------------------------------------------------------
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/MediaInfo_Events.h b/src/thirdparty/MediaInfo/MediaInfo_Events.h
new file mode 100644
index 000000000..f3a0215d9
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfo_Events.h
@@ -0,0 +1,444 @@
+/*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;
+#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
+/*-------------------------------------------------------------------------*/
+
+
+/***************************************************************************/
+/* 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 */
+/***************************************************************************/
+
+/*-------------------------------------------------------------------------*/
+/* Generic */
+struct MediaInfo_Event_Generic
+{
+ MediaInfo_int32u EventCode;
+};
+
+/*-------------------------------------------------------------------------*/
+/* 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_0
+{
+ MediaInfo_int32u EventCode;
+ MediaInfo_int64u Stream_Offset;
+ size_t StreamIDs_Size;
+ MediaInfo_int64u* StreamIDs;
+ MediaInfo_int8u* StreamIDs_Width;
+ MediaInfo_int8u* ParserIDs;
+ MediaInfo_int8u Content_Type; /*MediaInfo_Event_Global_Demux_0_contenttype*/
+ size_t Content_Size;
+ const MediaInfo_int8u* Content;
+};
+
+/***************************************************************************/
+/* General */
+/***************************************************************************/
+
+#define MediaInfo_Parser_None 0x00
+
+/*-------------------------------------------------------------------------*/
+/* Start */
+#define MediaInfo_Event_General_Start 0x7001
+struct MediaInfo_Event_General_Start_0
+{
+ MediaInfo_int32u EventCode;
+ MediaInfo_int64u Stream_Size;
+};
+
+/*-------------------------------------------------------------------------*/
+/* End */
+#define MediaInfo_Event_General_End 0x7002
+struct MediaInfo_Event_General_End_0
+{
+ MediaInfo_int32u EventCode;
+ MediaInfo_int64u Stream_Bytes_Analyzed;
+};
+
+/*-------------------------------------------------------------------------*/
+/* Parser_Selected */
+#define MediaInfo_Event_General_Parser_Selected 0x7003
+struct MediaInfo_Event_General_Parser_Selected_0
+{
+ MediaInfo_int32u EventCode;
+ char Name[16];
+};
+
+/*-------------------------------------------------------------------------*/
+/* Move request */
+#define MediaInfo_Event_General_Move_Request 0x7004
+struct MediaInfo_Event_General_Move_Request_0
+{
+ MediaInfo_int32u EventCode;
+ MediaInfo_int64u Stream_Offset;
+};
+
+/*-------------------------------------------------------------------------*/
+/* Move done */
+#define MediaInfo_Event_General_Move_Done 0x7005
+struct MediaInfo_Event_General_Move_Done_0
+{
+ MediaInfo_int32u EventCode;
+ MediaInfo_int64u Stream_Offset;
+};
+
+/***************************************************************************/
+/* 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
+
+/***************************************************************************/
+/* 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
+
+/***************************************************************************/
+/* MPEG Video */
+/***************************************************************************/
+
+#define MediaInfo_Parser_Mpegv 0x80
+
+/***************************************************************************/
+/* AVC */
+/***************************************************************************/
+
+#define MediaInfo_Parser_Avc 0x81
+
+/***************************************************************************/
+/* Active Format Description (AFD) */
+/***************************************************************************/
+
+#define MediaInfo_Parser_Afd 0x83
+
+/***************************************************************************/
+/* Bar Data */
+/***************************************************************************/
+
+#define MediaInfo_Parser_BarData 0x84
+
+/***************************************************************************/
+/* DTS */
+/***************************************************************************/
+
+#define MediaInfo_Parser_Dts 0xA0
+
+/***************************************************************************/
+/* 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
+
+#endif //MediaInfo_EventsH
diff --git a/src/thirdparty/MediaInfo/MediaInfo_Events_Internal.h b/src/thirdparty/MediaInfo/MediaInfo_Events_Internal.h
new file mode 100644
index 000000000..fabe5062f
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfo_Events_Internal.h
@@ -0,0 +1,57 @@
+/*Helpers for MediaInfo events */
+
+#ifndef MediaInfo_Events_InternalH
+#define MediaInfo_Events_InternalH
+
+#include <cstring>
+using namespace std;
+
+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);
+ }
+}
+
+#endif //MediaInfo_EventsH
diff --git a/src/thirdparty/MediaInfo/MediaInfo_File.cpp b/src/thirdparty/MediaInfo/MediaInfo_File.cpp
new file mode 100644
index 000000000..bf738112b
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfo_File.cpp
@@ -0,0 +1,819 @@
+// MediaInfo_Internal - All info about media files, different parser listing part
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// How to:
+// To add a new format,
+// Fill includes, SelectFromExtension, ListFormats and LibraryIsModified
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/MediaInfo_Internal.h"
+#include "MediaInfo/Reader/Reader_File.h"
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+// Multiple
+#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_DVDIF_YES)
+ #include "MediaInfo/Multiple/File_DvDif.h"
+#endif
+#if defined(MEDIAINFO_DVDV_YES)
+ #include "MediaInfo/Multiple/File_Dvdv.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_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_RIFF_YES)
+ #include "MediaInfo/Multiple/File_Riff.h"
+#endif
+#if defined(MEDIAINFO_RM_YES)
+ #include "MediaInfo/Multiple/File_Rm.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_DIRAC_YES)
+ #include "MediaInfo/Video/File_Dirac.h"
+#endif
+#if defined(MEDIAINFO_FLIC_YES)
+ #include "MediaInfo/Video/File_Flic.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_AVSV_YES)
+ #include "MediaInfo/Video/File_AvsV.h"
+#endif
+
+//---------------------------------------------------------------------------
+// Audio
+#if defined(MEDIAINFO_AC3_YES)
+ #include "MediaInfo/Audio/File_Ac3.h"
+#endif
+#if defined(MEDIAINFO_ADIF_YES)
+ #include "MediaInfo/Audio/File_Adif.h"
+#endif
+#if defined(MEDIAINFO_ADTS_YES)
+ #include "MediaInfo/Audio/File_Adts.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_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_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
+#if defined(MEDIAINFO_XM_YES)
+ #include "MediaInfo/Audio/File_ExtendedModule.h"
+#endif
+
+//---------------------------------------------------------------------------
+// Text
+#if defined(MEDIAINFO_N19_YES)
+ #include "MediaInfo/Text/File_N19.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_PNG_YES)
+ #include "MediaInfo/Image/File_Png.h"
+#endif
+#if defined(MEDIAINFO_TIFF_YES)
+ #include "MediaInfo/Image/File_Tiff.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_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_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_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_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_IVF_YES)
+ else if (Parser==_T("Ivf")) Info=new File_Ivf();
+ #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_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_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_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_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_AVSV_YES)
+ else if (Parser==_T("AvsV")) Info=new File_AvsV();
+ #endif
+
+ // Audio
+ #if defined(MEDIAINFO_ADTS_YES)
+ else if (Parser==_T("Aac")) Info=new File_Adts();
+ #endif
+ #if defined(MEDIAINFO_AC3_YES)
+ else if (Parser==_T("Ac3")) Info=new File_Ac3();
+ #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_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_PCM_YES)
+ else if (Parser==_T("Pcm")) Info=new File_Pcm();
+ #endif
+ #if defined(MEDIAINFO_AU_YES)
+ else if (Parser==_T("Au")) Info=new File_Au();
+ #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_OTHERTEXT_YES)
+ else if (Parser==_T("N19")) Info=new File_N19();
+ #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_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_PNG_YES)
+ else if (Parser==_T("Png")) Info=new File_Png();
+ #endif
+ #if defined(MEDIAINFO_TIFF_YES)
+ else if (Parser==_T("Tiff")) Info=new File_Tiff();
+ #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_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_NO)
+ else if (Parser==_T("Other")) Info=new File_Other();
+ #endif
+ #if !defined(MEDIAINFO_OTHER_NO)
+ else if (Parser==_T("Unknown")) Info=new File_Unknown();
+ #endif
+
+ //No parser
+ else
+ return false;
+
+ return true;
+}
+
+//---------------------------------------------------------------------------
+int MediaInfo_Internal::ListFormats(const String &File_Name)
+{
+ // Multiple
+ #if defined(MEDIAINFO_BDAV_YES)
+ delete Info; Info=new File_MpegTs(); ((File_MpegTs*)Info)->BDAV_Size=4; if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_BDMV_YES)
+ delete Info; Info=new File_Bdmv(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_CDXA_YES)
+ delete Info; Info=new File_Cdxa(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_DVDIF_YES)
+ delete Info; Info=new File_DvDif(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_DVDV_YES)
+ delete Info; Info=new File_Dvdv(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_FLV_YES)
+ delete Info; Info=new File_Flv(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_GXF_YES)
+ delete Info; Info=new File_Gxf(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_IVF_YES)
+ delete Info; Info=new File_Ivf(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_LXF_YES)
+ delete Info; Info=new File_Lxf(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_MK_YES)
+ delete Info; Info=new File_Mk(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_MPEG4_YES)
+ delete Info; Info=new File_Mpeg4(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_MPEGPS_YES)
+ delete Info; Info=new File_MpegPs(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_MPEGTS_YES)
+ delete Info; Info=new File_MpegTs(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_MPLI_YES)
+ delete Info; Info=new File_Mpli(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_MXF_YES)
+ delete Info; Info=new File_Mxf(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_NUT_YES)
+ delete Info; Info=new File_Nut(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_OGG_YES)
+ delete Info; Info=new File_Ogg(); if (Reader_File::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::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_RIFF_YES)
+ delete Info; Info=new File_Riff(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_RM_YES)
+ delete Info; Info=new File_Rm(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_SKM_YES)
+ delete Info; Info=new File_Skm(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_SWF_YES)
+ delete Info; Info=new File_Swf(); if (Reader_File::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::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_WM_YES)
+ delete Info; Info=new File_Wm(); if (Reader_File::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::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_DPG_YES)
+ delete Info; Info=new File_Dpg(); if (Reader_File::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::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_DIRAC_YES)
+ delete Info; Info=new File_Dirac(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_FLIC_YES)
+ delete Info; Info=new File_Flic(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_MPEG4V_YES)
+ delete Info; Info=new File_Mpeg4v(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_MPEGV_YES)
+ delete Info; Info=new File_Mpegv(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_VC1_YES)
+ delete Info; Info=new File_Vc1(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_AVSV_YES)
+ delete Info; Info=new File_AvsV(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+
+ // Audio
+ #if defined(MEDIAINFO_AC3_YES)
+ delete Info; Info=new File_Ac3(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_ADIF_YES)
+ delete Info; Info=new File_Adif(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_ADTS_YES)
+ delete Info; Info=new File_Adts(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_ALS_YES)
+ delete Info; Info=new File_Als(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_AMR_YES)
+ delete Info; Info=new File_Amr(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_AMV_YES)
+ delete Info; Info=new File_Amv(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_APE_YES)
+ delete Info; Info=new File_Ape(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_AU_YES)
+ delete Info; Info=new File_Au(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_DTS_YES)
+ delete Info; Info=new File_Dts(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_FLAC_YES)
+ delete Info; Info=new File_Flac(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_IT_YES)
+ delete Info; Info=new File_ImpulseTracker(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_LA_YES)
+ delete Info; Info=new File_La(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_MIDI_YES)
+ delete Info; Info=new File_Midi(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_MOD_YES)
+ delete Info; Info=new File_Module(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_MPC_YES)
+ delete Info; Info=new File_Mpc(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_MPCSV8_YES)
+ delete Info; Info=new File_MpcSv8(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_MPEGA_YES)
+ delete Info; Info=new File_Mpega(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_PCM_YES)
+ //delete Info; Info=new File_Pcm(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_TAK_YES)
+ delete Info; Info=new File_Tak(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_S3M_YES)
+ delete Info; Info=new File_ScreamTracker3(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_TTA_YES)
+ delete Info; Info=new File_Tta(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_TWINVQ_YES)
+ delete Info; Info=new File_TwinVQ(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_WVPK_YES)
+ delete Info; Info=new File_Wvpk(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_XM_YES)
+ delete Info; Info=new File_ExtendedModule(); if (Reader_File::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::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_OTHERTEXT_YES)
+ delete Info; Info=new File_OtherText(); if (Reader_File::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::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_GIF_YES)
+ delete Info; Info=new File_Gif(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_ICO_YES)
+ delete Info; Info=new File_Ico(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_JPEG_YES)
+ delete Info; Info=new File_Jpeg(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_PNG_YES)
+ delete Info; Info=new File_Png(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_TIFF_YES)
+ delete Info; Info=new File_Tiff(); if (Reader_File::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::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_7Z_YES)
+ delete Info; Info=new File_7z(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_BZIP2_YES)
+ delete Info; Info=new File_Bzip2(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_ELF_YES)
+ delete Info; Info=new File_Elf(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_GZIP_YES)
+ delete Info; Info=new File_Gzip(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_MZ_YES)
+ delete Info; Info=new File_Mz(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_RAR_YES)
+ delete Info; Info=new File_Rar(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_TAR_YES)
+ delete Info; Info=new File_Tar(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if defined(MEDIAINFO_ZIP_YES)
+ delete Info; Info=new File_Zip(); if (Reader_File::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::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ #if !defined(MEDIAINFO_UNKNOWN_NO)
+ delete Info; Info=new File_Unknown(); if (Reader_File::Format_Test_PerParser(this, File_Name)>0) return 1;
+ #endif
+ return 0;
+}
+
+//---------------------------------------------------------------------------
+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_FLV_NO) || defined(MEDIAINFO_GXF_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_CDXA_NO) || defined(MEDIAINFO_DPG_NO) || defined(MEDIAINFO_TSP_NO) \
+ || defined(MEDIAINFO_AVC_NO) || defined(MEDIAINFO_MPEG4V_NO) || defined(MEDIAINFO_MPEGV_NO) || defined(MEDIAINFO_FLIC_NO) || defined(MEDIAINFO_THEORA_NO) \
+ || defined(MEDIAINFO_AC3_NO) || defined(MEDIAINFO_ADIF_NO) || defined(MEDIAINFO_ADTS_NO) || defined(MEDIAINFO_AMR_NO) || defined(MEDIAINFO_DTS_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_AES3_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_PNG_NO) || defined(MEDIAINFO_JPEG_NO) || defined(MEDIAINFO_BMP_NO) || defined(MEDIAINFO_ICO_NO) || defined(MEDIAINFO_GIF_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
+
+
diff --git a/src/thirdparty/MediaInfo/MediaInfo_Inform.cpp b/src/thirdparty/MediaInfo/MediaInfo_Inform.cpp
new file mode 100644
index 000000000..54f0928b2
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfo_Inform.cpp
@@ -0,0 +1,474 @@
+// MediaInfo_Inform - Base for other files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Inform part
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "ZenLib/Utils.h"
+#include "MediaInfo/MediaInfo_Internal.h"
+#include "MediaInfo/MediaInfo_Config.h"
+#include "MediaInfo/Export/Export_Mpeg7.h"
+#include "MediaInfo/Export/Export_PBCore.h"
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//---------------------------------------------------------------------------
+extern MediaInfo_Config Config;
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+Ztring MediaInfo_Internal::Inform()
+{
+ CS.Enter();
+ if (Info)
+ {
+ Info->Status[File__Analyze::IsUpdated]=false;
+ for (size_t Pos=File__Analyze::User_16; Pos<File__Analyze::User_16+16; Pos++)
+ Info->Status[Pos]=false;
+ }
+ CS.Leave();
+
+ #if MEDIAINFO_TRACE
+ if (MediaInfoLib::Config.DetailsLevel_Get() || MediaInfoLib::Config.Inform_Get()==_T("Details"))
+ {
+ if (!Details.empty())
+ return Details;
+ else if (Info)
+ return Info->Details_Get();
+ }
+ #endif //MEDIAINFO_TRACE
+
+ 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("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);
+ 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<Count_Get(Stream_Video); I1++)
+ {
+ Retour+=Inform(Stream_Video, I1);
+ if (I1!=Count_Get(Stream_Video)-1)
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("Video_Middle"));
+ }
+ if (Count_Get(Stream_Video))
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("Video_End"));
+ if (Count_Get(Stream_Audio))
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("Audio_Begin"));
+ for (size_t I1=0; I1<Count_Get(Stream_Audio); I1++)
+ {
+ Retour+=Inform(Stream_Audio, I1);
+ if (I1!=Count_Get(Stream_Audio)-1)
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("Audio_Middle"));
+ }
+ if (Count_Get(Stream_Audio))
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("Audio_End"));
+ if (Count_Get(Stream_Text))
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("Text_Begin"));
+ for (size_t I1=0; I1<Count_Get(Stream_Text); I1++)
+ {
+ Retour+=Inform(Stream_Text, I1);
+ if (I1!=Count_Get(Stream_Text)-1)
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("Text_Middle"));
+ }
+ if (Count_Get(Stream_Text))
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("Text_End"));
+ if (Count_Get(Stream_Chapters))
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("Chapters_Begin"));
+ for (size_t I1=0; I1<Count_Get(Stream_Chapters); I1++)
+ {
+ Retour+=Inform(Stream_Chapters, I1);
+ if (I1!=Count_Get(Stream_Chapters)-1)
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("Chapters_Middle"));
+ }
+ if (Count_Get(Stream_Chapters))
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("Chapters_End"));
+ if (Count_Get(Stream_Image))
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("Image_Begin"));
+ for (size_t I1=0; I1<Count_Get(Stream_Image); I1++)
+ {
+ Retour+=Inform(Stream_Image, I1);
+ if (I1!=Count_Get(Stream_Image)-1)
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("Image_Middle"));
+ }
+ if (Count_Get(Stream_Image))
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("Image_End"));
+ if (Count_Get(Stream_Menu))
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("Menu_Begin"));
+ for (size_t I1=0; I1<Count_Get(Stream_Menu); I1++)
+ {
+ Retour+=Inform(Stream_Menu, I1);
+ if (I1!=Count_Get(Stream_Menu)-1)
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("Menu_Middle"));
+ }
+ if (Count_Get(Stream_Menu))
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("Menu_End"));
+ Retour+=MediaInfoLib::Config.Inform_Get(_T("File_End"));
+
+ 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);
+ return Retour;
+ }
+
+ //Informations
+ Ztring Retour;
+ bool HTML=false;
+ bool XML=false;
+ if (MediaInfoLib::Config.Inform_Get()==_T("HTML"))
+ HTML=true;
+ if (MediaInfoLib::Config.Inform_Get()==_T("XML"))
+ XML=true;
+
+ if (HTML) Retour+=_T("<html>\n\n<head>\n<META http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></head>\n<body>\n");
+ if (XML) Retour+=_T("<File>\n");
+
+ for (size_t StreamKind=(size_t)Stream_General; StreamKind<Stream_Max; StreamKind++)
+ {
+ //Pour chaque type de flux
+ for (size_t StreamPos=0; StreamPos<(size_t)Count_Get((stream_t)StreamKind); StreamPos++)
+ {
+ //Pour chaque stream
+ if (HTML) Retour+=_T("<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"2\" style=\"border:1px solid Navy\">\n<tr>\n <td width=\"150\"><h2>");
+ if (XML) Retour+=_T("<track type=\"");
+ Ztring A=Get((stream_t)StreamKind, StreamPos, _T("StreamKind/String"));
+ Ztring B=Get((stream_t)StreamKind, StreamPos, _T("StreamKindPos"));
+ if (!XML && !B.empty())
+ {
+ A+=MediaInfoLib::Config.Language_Get(_T(" Config_Text_NumberTag"));
+ A+=B;
+ }
+ Retour+=A;
+ if (XML)
+ {
+ Retour+=_T("\"");
+ if (!B.empty())
+ {
+ Retour+=_T(" streamid=\"");
+ Retour+=B;
+ Retour+=_T("\"");
+ }
+ }
+ if (HTML) Retour+=_T("</h2></td>\n </tr>");
+ if (XML) Retour+=_T(">");
+ Retour+=MediaInfoLib::Config.LineSeparator_Get();
+ Retour+=Inform((stream_t)StreamKind, StreamPos);
+ Retour.FindAndReplace(_T("\\"), _T("|SC1|"), 0, Ztring_Recursive);
+ if (HTML) Retour+=_T("</table>\n<br />");
+ if (XML) Retour+=_T("</track>\n");
+ Retour+=MediaInfoLib::Config.LineSeparator_Get();
+ }
+ }
+
+ if (HTML) Retour+=_T("\n</body>\n</html>\n");
+ if (XML) Retour+=_T("</File>\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);
+ Retour.FindAndReplace(_T("|SC1|"), _T("\\"), 0, Ztring_Recursive);
+ return Retour;
+}
+
+//---------------------------------------------------------------------------
+Ztring MediaInfo_Internal::Inform (stream_t StreamKind, size_t StreamPos)
+{
+ //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;
+ if (MediaInfoLib::Config.Inform_Get()==_T("HTML"))
+ HTML=true;
+ if (MediaInfoLib::Config.Inform_Get()==_T("XML"))
+ XML=true;
+ size_t Size=Count_Get(StreamKind, StreamPos);
+ for (size_t Champ_Pos=0; Champ_Pos<Size; Champ_Pos++)
+ {
+ //Pour chaque champ
+ //Ztring A=Get((stream_t)4, 2, 0, Info_Measure_Text); // TODO Bug sinon? voir Ztring
+ Ztring A=Get((stream_t)StreamKind, StreamPos, Champ_Pos, Info_Measure_Text); // TODO Bug sinon? voir Ztring
+ if ((MediaInfoLib::Config.Complete_Get() || Get((stream_t)StreamKind, StreamPos, Champ_Pos, Info_Options)[InfoOption_ShowInInform]==_T('Y')) && !Get((stream_t)StreamKind, StreamPos, Champ_Pos, Info_Text).empty())
+ {
+ Ztring Nom=Get((stream_t)StreamKind, StreamPos, Champ_Pos, Info_Name_Text);
+ if (Nom.empty())
+ Nom=Get((stream_t)StreamKind, StreamPos, Champ_Pos, Info_Name); //Texte n'existe pas
+ if (!HTML && !XML)
+ {
+ int8u Nom_Size=MediaInfoLib::Config.Language_Get(_T(" Config_Text_ColumnSize")).To_int8u();
+ if (Nom_Size==0)
+ Nom_Size=32; //Default
+ Nom.resize(Nom_Size, ' ');
+ }
+ Ztring Valeur=Get((stream_t)StreamKind, StreamPos, Champ_Pos, Info_Text);
+ Valeur.FindAndReplace(_T("\\"), _T("|SC1|"), 0, Ztring_Recursive);
+ if (HTML)
+ {
+ Retour+=_T(" <tr>\n <td><i>");
+ Retour+=Nom;
+ Retour+=_T(" :</i></td>\n <td colspan=\"3\">");
+ Retour+=Valeur;
+ Retour+=_T("</td>\n </tr>");
+ }
+ else if (XML)
+ {
+ if (Nom.operator()(0)>='0' && Nom.operator()(0)<='9')
+ Nom.insert(Nom.begin(), _T('_'));
+ Nom.FindAndReplace(_T(" "), _T("_"), 0, Ztring_Recursive);
+ Nom.FindAndReplace(_T("/"), _T("_"), 0, Ztring_Recursive);
+ Nom.FindAndReplace(_T("("), _T("_"), 0, Ztring_Recursive);
+ Nom.FindAndReplace(_T(")"), _T("_"), 0, Ztring_Recursive);
+ Nom.FindAndReplace(_T("*"), _T("_"), 0, Ztring_Recursive);
+ Nom.FindAndReplace(_T(","), _T("_"), 0, Ztring_Recursive);
+ Nom.FindAndReplace(_T(":"), _T("_"), 0, Ztring_Recursive);
+ Nom.FindAndReplace(_T("@"), _T("_"), 0, Ztring_Recursive);
+ if (Nom.empty())
+ Nom="Unknown";
+ Valeur.FindAndReplace(_T("\""), _T("&quot;"), 0, Ztring_Recursive);
+ Valeur.FindAndReplace(_T("&"), _T("&amp;"), 0, Ztring_Recursive);
+ Valeur.FindAndReplace(_T("<"), _T("&lt;"), 0, Ztring_Recursive);
+ Valeur.FindAndReplace(_T(">"), _T("&gt;"), 0, Ztring_Recursive);
+ Retour+=_T("<");
+ Retour+=Nom;
+ Retour+=_T(">");
+ Retour+=Valeur;
+ Retour+=_T("</");
+ Retour+=Nom;
+ Retour+=_T(">");
+ }
+ 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("|SC9|"), 0, Ztring_Recursive);
+ RemplacerPar.FindAndReplace(_T(")"), _T("|SC8|"), 0, Ztring_Recursive);
+ Retour.FindAndReplace(ARemplacer, RemplacerPar);
+ }
+ else
+ PosX++;
+ }
+
+ //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);
+
+ //Retour=_T("<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"2\" style=\"border:1px solid Navy\">\n<tr>\n <td width=\"150\">Video #0</td>\n </tr>\r\n <tr>\n <td><i>Codec :</i></td>\n <td colspan=\"3\">WMV1</td>\n </tr>\r\n <tr>\n <td><i>Codec/Info :</i></td>\n <td colspan=\"3\">Windows Media Video 7</td>\n </tr>\r\n <tr>\n <td><i>Width :</i></td>\n <td colspan=\"3\">200 pixels</td>\n </tr>\r\n <tr>\n <td><i>Height :</i></td>\n <td colspan=\"3\">150 pixels</td>\n </tr>\r\n <tr>\n <td><i>Aspect ratio :</i></td>\n <td colspan=\"3\">4/3</td>\n </tr>\r\n <tr>\n <td><i>Resolution :</i></td>\n <td colspan=\"3\">24 bits</td>\n </tr>\r\n</table>\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);
+ 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);
+}
+
+} //NameSpace
+
diff --git a/src/thirdparty/MediaInfo/MediaInfo_Internal.cpp b/src/thirdparty/MediaInfo/MediaInfo_Internal.cpp
new file mode 100644
index 000000000..0f67bb191
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfo_Internal.cpp
@@ -0,0 +1,817 @@
+// MediaInfo_Internal - All info about media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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"
+#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
+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()) \
+ Debug_Config.Create(Ztring(MediaInfo_Debug_Name)+_T(".")+Ztring::ToZtring((size_t)this, 16)+_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()) \
+ { \
+ Debug_Buffer_Stream.Create(Ztring(MediaInfo_Debug_Name)+_T(".")+Ztring::ToZtring((size_t)this, 16)+_T(".Buffer.Stream.0000000000000000")); \
+ Debug_Buffer_Stream_Order=0; \
+ Debug_Buffer_Sizes.Create(Ztring(MediaInfo_Debug_Name)+_T(".")+Ztring::ToZtring((size_t)this, 16)+_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<void*, File>::iterator F_Stream=Debug_Output_Value_Stream.find(ValueH); \
+ if (F_Stream!=Debug_Output_Value_Stream.end()) \
+ { \
+ map<void*, File>::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 (_POS<Debug_Output_Pos_Stream.size()) \
+ { \
+ if (!Debug_Output_Pos_Stream[_POS]->Opened_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;
+ Info_IsMultipleParsing=false;
+
+ Stream.resize(Stream_Max);
+ Stream_More.resize(Stream_Max);
+
+ //Threading
+ BlockMethod=0;
+ IsInThread=false;
+}
+
+//---------------------------------------------------------------------------
+MediaInfo_Internal::~MediaInfo_Internal()
+{
+ Close();
+
+ CriticalSectionLocker CSL(CS);
+
+ MEDIAINFO_DEBUG_CONFIG_TEXT(Debug+=_T("Destruction");)
+
+ delete Info; //Info=NULL;
+ #ifdef MEDIAINFO_DEBUG_OUTPUT
+ for (size_t Pos=0; Pos<Debug_Output_Pos_Stream.size(); Pos++)
+ {
+ delete Debug_Output_Pos_Stream[Pos]; //Debug_Output_Pos_Stream[Pos]=NULL;
+ delete Debug_Output_Pos_Sizes[Pos]; //Debug_Output_Pos_Sizes[Pos]=NULL;
+ }
+ #endif //MEDIAINFO_DEBUG_OUTPUT
+}
+
+//***************************************************************************
+// Files
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+size_t MediaInfo_Internal::Open(const String &File_Name_)
+{
+ CS.Enter();
+ MEDIAINFO_DEBUG_CONFIG_TEXT(Debug+=_T("Open, File=");Debug+=Ztring(File_Name_).c_str();)
+ File_Name=File_Name_;
+ CS.Leave();
+
+ //Parsing
+ if (BlockMethod==1)
+ {
+ if (!IsInThread) //If already created, the routine will read the new files
+ {
+ Run();
+ IsInThread=true;
+ }
+ return 0;
+ }
+ else
+ {
+ Entry(); //Normal parsing
+ return Count_Get(Stream_General);
+ }
+}
+
+//---------------------------------------------------------------------------
+void MediaInfo_Internal::Entry()
+{
+ CS.Enter();
+ MEDIAINFO_DEBUG_CONFIG_TEXT(Debug+=_T("Entry");)
+ Config.State_Set(0);
+ CS.Leave();
+
+ if (0);
+ #if defined(MEDIAINFO_LIBCURL_YES)
+ else if ((File_Name.size()>=7
+ && File_Name[0]==_T('h')
+ && File_Name[1]==_T('t')
+ && File_Name[2]==_T('t')
+ && File_Name[3]==_T('p')
+ && File_Name[4]==_T(':')
+ && File_Name[5]==_T('/')
+ && File_Name[6]==_T('/'))
+ || (File_Name.size()>=6
+ && File_Name[0]==_T('f')
+ && File_Name[1]==_T('t')
+ && File_Name[2]==_T('p')
+ && File_Name[3]==_T(':')
+ && File_Name[4]==_T('/')
+ && File_Name[5]==_T('/')))
+ Reader_libcurl::Format_Test(this, File_Name);
+ #endif //MEDIAINFO_LIBCURL_YES
+
+ #if defined(MEDIAINFO_LIBMMS_YES)
+ else if ((File_Name.size()>=6
+ && File_Name[0]==_T('m')
+ && File_Name[1]==_T('m')
+ && File_Name[2]==_T('s')
+ && File_Name[3]==_T(':')
+ && File_Name[4]==_T('/')
+ && File_Name[5]==_T('/'))
+ || (File_Name.size()>=7
+ && File_Name[0]==_T('m')
+ && File_Name[1]==_T('m')
+ && File_Name[2]==_T('s')
+ && File_Name[3]==_T('h')
+ && File_Name[4]==_T(':')
+ && File_Name[5]==_T('/')
+ && File_Name[6]==_T('/')))
+ Reader_libmms::Format_Test(this, File_Name);
+ #endif //MEDIAINFO_LIBMMS_YES
+
+ #if defined(MEDIAINFO_DIRECTORY_YES)
+ else if (Dir::Exists(File_Name))
+ Reader_Directory::Format_Test(this, File_Name);
+ #endif //MEDIAINFO_DIRECTORY_YES
+
+ #if defined(MEDIAINFO_FILE_YES)
+ else if (File::Exists(File_Name))
+ Reader_File::Format_Test(this, File_Name);
+ #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*, size_t, int64u File_Size)
+{
+ Open_Buffer_Init(File_Size);
+ Open_Buffer_Continue(Begin, Begin_Size);
+ Open_Buffer_Finalize();
+
+ return 1;
+}
+
+//---------------------------------------------------------------------------
+size_t MediaInfo_Internal::Open_Buffer_Init (int64u File_Size_, const String &File_Name)
+{
+ CriticalSectionLocker CSL(CS);
+ if (Info==NULL)
+ {
+ if (!Config.File_ForceParser_Get().empty())
+ {
+ CS.Leave();
+ SelectFromExtension(Config.File_ForceParser_Get());
+ CS.Enter();
+ }
+ else
+ {
+ 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_);
+
+ 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_);)
+
+ if (Info==NULL)
+ Open_Buffer_Init(File_Size_);
+
+ if (File_Offset_!=(int64u)-1 && Info)
+ {
+ CriticalSectionLocker CSL(CS);
+ Info->Open_Buffer_Position_Set(File_Offset_);
+ //Info->Open_Buffer_Unsynch();
+ }
+
+ #if MEDIAINFO_EVENTS
+ if (Info->Status[File__Analyze::IsAccepted])
+ {
+ struct MediaInfo_Event_General_Move_Done_0 Event;
+ Event.EventCode=MediaInfo_EventCode_Create(MediaInfo_Parser_None, MediaInfo_Event_General_Move_Done, 0);
+ Event.Stream_Offset=File_Offset_;
+ Config.Event_Send((const int8u*)&Event, sizeof(MediaInfo_Event_General_Move_Done_0));
+ }
+ else
+ {
+ struct MediaInfo_Event_General_Start_0 Event;
+ Event.EventCode=MediaInfo_EventCode_Create(MediaInfo_Parser_None, MediaInfo_Event_General_Start, 0);
+ Event.Stream_Size=File_Size_;
+ Config.Event_Send((const int8u*)&Event, sizeof(MediaInfo_Event_General_Start_0));
+ }
+ #endif //MEDIAINFO_EVENTS
+
+ EXECUTE_SIZE_T(1, Debug+=_T("Open_Buffer_Init, will return 1");)
+}
+
+//---------------------------------------------------------------------------
+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;
+ }
+
+ if (!Info->Status[File__Analyze::IsFilled] && Info->Status[File__Analyze::IsUpdated])
+ Info->Status[File__Analyze::IsUpdated]=false; //No updated info until IsFilled is set
+
+ return Info->Status;
+ #endif
+}
+
+//---------------------------------------------------------------------------
+int64u MediaInfo_Internal::Open_Buffer_Continue_GoTo_Get ()
+{
+ CriticalSectionLocker CSL(CS);
+ if (Info==NULL)
+ return 0;
+
+ 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;
+}
+
+//---------------------------------------------------------------------------
+size_t MediaInfo_Internal::Open_Buffer_Finalize ()
+{
+ CriticalSectionLocker CSL(CS);
+ MEDIAINFO_DEBUG_CONFIG_TEXT(Debug+=_T("Open_Buffer_Finalize");)
+ if (Info==NULL)
+ return 0;
+
+ Info->Open_Buffer_Finalize();
+
+ //Cleanup
+ if (!Config.File_IsSub_Get() && !Config.File_KeepInfo_Get()) //We need info for the calling parser
+ {
+ delete Info; Info=NULL;
+ }
+
+ EXECUTE_SIZE_T(1, Debug+=_T("Open_Buffer_Finalize, will return 1"))
+}
+
+//---------------------------------------------------------------------------
+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;
+}
+
+//***************************************************************************
+// 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]=false;
+ for (size_t Pos=File__Analyze::User_16; Pos<File__Analyze::User_16+16; Pos++)
+ Info->Status[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 (Parameter<MediaInfoLib::Config.Info_Get(StreamKind).size())
+ {
+ //Optimization : KindOfInfo>Info_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 (Parameter<Stream[StreamKind][StreamPos].size())
+ EXECUTE_STRING(Stream[StreamKind][StreamPos][Parameter], Debug+=_T("Get, will return ");Debug+=ToReturn;)
+ else
+ EXECUTE_STRING(MediaInfoLib::Config.EmptyString_Get(), Debug+=_T("Get, will return ");Debug+=ToReturn;) //This parameter is known, but not filled
+ }
+ else
+ EXECUTE_STRING(Stream_More[StreamKind][StreamPos][Parameter-MediaInfoLib::Config.Info_Get(StreamKind).size()](KindOfInfo), Debug+=_T("Get, will return ");Debug+=ToReturn;)
+}
+
+//---------------------------------------------------------------------------
+Ztring MediaInfo_Internal::Get(stream_t StreamKind, size_t StreamPos, const String &Parameter, info_t KindOfInfo, info_t KindOfSearch)
+{
+ //Legacy
+ if (Parameter.find(_T("_String"))!=Error)
+ {
+ Ztring S1=Parameter;
+ S1.FindAndReplace(_T("_String"), _T("/String"));
+ return Get(StreamKind, StreamPos, S1, KindOfInfo, KindOfSearch);
+ }
+ if (Parameter==_T("Channels"))
+ return Get(StreamKind, StreamPos, _T("Channel(s)"), KindOfInfo, KindOfSearch);
+ if (Parameter==_T("Artist"))
+ return Get(StreamKind, StreamPos, _T("Performer"), KindOfInfo, KindOfSearch);
+ if (Parameter==_T("AspectRatio"))
+ return Get(StreamKind, StreamPos, _T("DisplayAspectRatio"), KindOfInfo, KindOfSearch);
+ if (Parameter==_T("AspectRatio/String"))
+ return Get(StreamKind, StreamPos, _T("DisplayAspectRatio/String"), KindOfInfo, KindOfSearch);
+ if (Parameter==_T("Chroma"))
+ return Get(StreamKind, StreamPos, _T("Colorimetry"), KindOfInfo, KindOfSearch);
+ if (Parameter==_T("PlayTime"))
+ return Get(StreamKind, StreamPos, _T("Duration"), KindOfInfo, KindOfSearch);
+ if (Parameter==_T("PlayTime/String"))
+ return Get(StreamKind, StreamPos, _T("Duration/String"), KindOfInfo, KindOfSearch);
+ if (Parameter==_T("PlayTime/String1"))
+ return Get(StreamKind, StreamPos, _T("Duration/String1"), KindOfInfo, KindOfSearch);
+ if (Parameter==_T("PlayTime/String2"))
+ return Get(StreamKind, StreamPos, _T("Duration/String2"), KindOfInfo, KindOfSearch);
+ if (Parameter==_T("PlayTime/String3"))
+ return Get(StreamKind, StreamPos, _T("Duration/String3"), KindOfInfo, KindOfSearch);
+ if (StreamKind==Stream_General && Parameter==_T("BitRate"))
+ return Get(Stream_General, StreamPos, _T("OverallBitRate"), KindOfInfo, KindOfSearch);
+ if (StreamKind==Stream_General && Parameter==_T("BitRate/String"))
+ return Get(Stream_General, StreamPos, _T("OverallBitRate/String"), KindOfInfo, KindOfSearch);
+ if (StreamKind==Stream_General && Parameter==_T("BitRate_Minimum"))
+ return Get(Stream_General, StreamPos, _T("OverallBitRate_Minimum"), KindOfInfo, KindOfSearch);
+ if (StreamKind==Stream_General && Parameter==_T("BitRate_Minimum/String"))
+ return Get(Stream_General, StreamPos, _T("OverallBitRate_Minimum/String"), KindOfInfo, KindOfSearch);
+ if (StreamKind==Stream_General && Parameter==_T("BitRate_Nominal"))
+ return Get(Stream_General, StreamPos, _T("OverallBitRate_Nominal"), KindOfInfo, KindOfSearch);
+ if (StreamKind==Stream_General && Parameter==_T("BitRate_Nominal/String"))
+ return Get(Stream_General, StreamPos, _T("OverallBitRate_Nominal/String"), KindOfInfo, KindOfSearch);
+ if (StreamKind==Stream_General && Parameter==_T("BitRate_Maximum"))
+ return Get(Stream_General, StreamPos, _T("OverallBitRate_Maximum"), KindOfInfo, KindOfSearch);
+ if (StreamKind==Stream_General && Parameter==_T("BitRate_Maximum/String"))
+ return Get(Stream_General, StreamPos, _T("OverallBitRate_Maximum/String"), KindOfInfo, KindOfSearch);
+
+ CS.Enter();
+ MEDIAINFO_DEBUG_CONFIG_TEXT(Debug+=_T("Get, StreamKind=");Debug+=Ztring::ToZtring((size_t)StreamKind);Debug+=_T(", StreamKind=");Debug+=Ztring::ToZtring(StreamPos);Debug+=_T(", Parameter=");Debug+=Ztring(Parameter);)
+
+ if (Info)
+ {
+ Info->Status[File__Analyze::IsUpdated]=false;
+ for (size_t Pos=File__Analyze::User_16; Pos<File__Analyze::User_16+16; Pos++)
+ Info->Status[Pos]=false;
+ }
+
+ //Check integrity
+ if (StreamKind>=Stream_Max || StreamPos>=Stream[StreamKind].size() || KindOfInfo>=Info_Max)
+ {
+ CS.Leave();
+ EXECUTE_STRING(MediaInfoLib::Config.EmptyString_Get(), Debug+=_T("Get, will return empty string");) //Parameter is unknown
+ }
+
+ //Special cases
+ //-Inform for a stream
+ if (Parameter==_T("Inform"))
+ {
+ CS.Leave();
+ Ztring InformZtring=Inform(StreamKind, StreamPos);
+ CS.Enter();
+ size_t Pos=MediaInfoLib::Config.Info_Get(StreamKind).Find(_T("Inform"));
+ if (Pos!=Error)
+ Stream[StreamKind][StreamPos](Pos)=InformZtring;
+ }
+
+ //Case of specific info
+ size_t ParameterI=MediaInfoLib::Config.Info_Get(StreamKind).Find(Parameter, KindOfSearch);
+ if (ParameterI==Error)
+ {
+ ParameterI=Stream_More[StreamKind][StreamPos].Find(Parameter, KindOfSearch);
+ if (ParameterI==Error)
+ {
+ CS.Leave();
+ EXECUTE_STRING(MediaInfoLib::Config.EmptyString_Get(), Debug+=_T("Get, will return empty string");) //Parameter is unknown
+ }
+ CS.Leave();
+ CriticalSectionLocker CSL(CS);
+ return Stream_More[StreamKind][StreamPos][ParameterI](KindOfInfo);
+ }
+
+ CS.Leave();
+
+ EXECUTE_STRING(Get(StreamKind, StreamPos, ParameterI, KindOfInfo), Debug+=_T("Get, will return ");Debug+=ToReturn;)
+}
+
+//***************************************************************************
+// Set File info
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+size_t MediaInfo_Internal::Set(const String &ToSet, stream_t StreamKind, size_t StreamPos, size_t Parameter, const String &OldValue)
+{
+ CriticalSectionLocker CSL(CS);
+ if (!Info)
+ return 0;
+
+ return Info->Set(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_"))==0)
+ {
+ Ztring ToReturn2=Config.Option(Option, Value);
+ if (Info)
+ Info->Option_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);
+ //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);
+}
+
+} //NameSpace
+
+
diff --git a/src/thirdparty/MediaInfo/MediaInfo_Internal.h b/src/thirdparty/MediaInfo/MediaInfo_Internal.h
new file mode 100644
index 000000000..9eb0e4791
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfo_Internal.h
@@ -0,0 +1,164 @@
+// MediaInfo_Internal - All information about media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Give information about a lot of media files
+// Dispatch the file to be tested by all containers
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_InternalH
+#define MediaInfo_InternalH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+// For developper: you can disable or enable traces
+//#define MEDIAINFO_DEBUG_CONFIG
+//#define MEDIAINFO_DEBUG_BUFFER
+//#define MEDIAINFO_DEBUG_OUTPUT
+// For developper: 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_Internal_Const.h"
+#include "MediaInfo/MediaInfo_Config.h"
+#include "MediaInfo/MediaInfo_Config_MediaInfo.h"
+#include "ZenLib/Thread.h"
+#include "ZenLib/CriticalSection.h"
+#include <bitset>
+#if defined (MEDIAINFO_DEBUG_CONFIG) || defined (MEDIAINFO_DEBUG_BUFFER) || defined (MEDIAINFO_DEBUG_OUTPUT)
+ #include <ZenLib/File.h>
+ #include <map>
+#endif //MEDIAINFO_DEBUG
+using namespace std;
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+class File__Analyze;
+class Internet__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);
+ size_t Open_Buffer_Finalize ();
+ void Close ();
+
+ //General information
+ Ztring Inform ();
+ Ztring Inform (stream_t StreamKind, size_t StreamNumber=0); //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);
+
+ //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_Mpeg4; //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
+
+ //Parsing handles
+ File__Analyze* Info;
+ Internet__Base* Internet;
+ Ztring File_Name;
+
+ //Helpers
+ void CreateDummy (const String& Value); //Create dummy Information
+ MediaInfo_Internal(const MediaInfo_Internal&); // Copy Constructor
+
+ //Open Buffer
+ bool Info_IsMultipleParsing;
+
+ //Config
+ std::vector<std::vector<ZtringList> > Stream;
+ std::vector<std::vector<ZtringListList> > Stream_More;
+ Ztring Details;
+ void Traiter(Ztring &C); //enleve les $if...
+
+public :
+ bool SelectFromExtension (const String &Parser); //Select File_* from the parser name
+ int ListFormats(const String &File_Name=String());
+ MediaInfo_Config_MediaInfo Config;
+
+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<void*, File> Debug_Output_Value_Stream; //Key is the memory address
+ map<void*, File> Debug_Output_Value_Sizes; //Key is the memory address
+ vector<File*> Debug_Output_Pos_Stream; //Key is the pos
+ vector<File*> Debug_Output_Pos_Sizes; //Key is the pos
+ vector<void*> Debug_Output_Pos_Pointer; //Key is the pos
+ #endif //MEDIAINFO_DEBUG_OUTPUT
+};
+
+} //NameSpace
+#endif
diff --git a/src/thirdparty/MediaInfo/MediaInfo_Internal_Const.h b/src/thirdparty/MediaInfo/MediaInfo_Internal_Const.h
new file mode 100644
index 000000000..fda4628b6
--- /dev/null
+++ b/src/thirdparty/MediaInfo/MediaInfo_Internal_Const.h
@@ -0,0 +1,153 @@
+// MediaInfo_Config - Configuration class
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Global configuration of MediaInfo
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_Internal_ConstH
+#define MediaInfo_Internal_ConstH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "ZenLib/Conf.h"
+#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_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_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
+#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<MediaInfoLib::Char> String;
+typedef std::basic_stringstream<MediaInfoLib::Char> StringStream;
+typedef std::basic_istringstream<MediaInfoLib::Char> tiStringStream;
+typedef std::basic_ostringstream<MediaInfoLib::Char> toStringStream;
+//---------------------------------------------------------------------------
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Bdmv.cpp b/src/thirdparty/MediaInfo/Multiple/File_Bdmv.cpp
new file mode 100644
index 000000000..03c237671
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Bdmv.cpp
@@ -0,0 +1,1607 @@
+// File_Mpls - Info for Blu-ray Movie files
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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[]=
+{
+ "Sequencial",
+ "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()
+{
+ if (File_Name.find(Ztring(1, PathSeparator)+_T("BDMV"))+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()
+{
+ if (File_Name.find(Ztring(1, PathSeparator)+_T("BDMV"))+5==File_Name.size()) //Blu-ray directory
+ {
+ BDMV();
+ return;
+ }
+
+ if (Buffer_Size<File_Size)
+ {
+ Element_WaitForMoreData();
+ return; //Wait for more data
+ }
+
+ //Parsing
+ int32u type_indicator;
+ int16u version_numberH;
+ Element_Begin("Header");
+ Get_C4 (type_indicator, "type_indicator");
+ Data_Accept("Blu-ray");
+ Get_C2 (version_numberH, "version_number (High)");
+ Skip_C2( "version_number (Low)");
+ Element_End();
+
+ FILLING_BEGIN();
+ Accept("BDMV");
+ switch (type_indicator)
+ {
+ case Elements::CLPI : Fill(Stream_General, 0, General_Format, "Blu-ray Clip info"); break;
+ case Elements::INDX : Fill(Stream_General, 0, General_Format, "Blu-ray Index"); break;
+ case Elements::MOBJ : Fill(Stream_General, 0, General_Format, "Blu-ray Movie object"); break;
+ case Elements::MPLS : Fill(Stream_General, 0, General_Format, "Blu-ray Playlist"); break;
+ default : ;
+ }
+ FILLING_END();
+
+ if (version_numberH==0x3031 || version_numberH==0x3032) //Version 1 or 2
+ {
+ Element_Begin("Offsets");
+ Types[0x28]=0; //First object
+ for (size_t Start_Adress_Pos=1; Start_Adress_Pos<9; Start_Adress_Pos++)
+ {
+ int32u Start_Adress;
+ Get_B4 (Start_Adress, Bdmv_Type(type_indicator, Start_Adress_Pos));
+ Types[Start_Adress]=Start_Adress_Pos;
+ }
+ Element_End();
+
+ for (std::map<int32u, size_t>::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_Begin(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_End();
+ }
+ }
+
+ 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<MediaInfo_Internal*> 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; Pos<MIs.size(); Pos++)
+ {
+ MIs[Pos]=new MediaInfo_Internal();
+ MIs[Pos]->Option(_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<MIs.size(); Pos++)
+ delete MIs[Pos]; //MIs[Pos]=NULL;
+ MIs.clear();
+
+ //Detecting some directories
+ if (Dir::Exists(File_Name+PathSeparator+_T("BDSVM"))
+ || Dir::Exists(File_Name+PathSeparator+_T("SLYVM"))
+ || Dir::Exists(File_Name+PathSeparator+_T("ANYVM")))
+ Fill(Stream_General, 0, General_Format_Profile, "BD+");
+ if (Dir::Exists(File_Name+PathSeparator+_T("BDJO")) && !Dir::GetAllFileNames(File_Name+PathSeparator+_T("BDJO")).empty())
+ Fill(Stream_General, 0, General_Format_Profile, "BD-Java");
+
+ //Filling
+ File_Name.resize(File_Name.size()-5); //Removing "/BDMV"
+ Fill(Stream_General, 0, General_Format, "Blu-ray movie", Unlimited, true, true);
+ Fill(Stream_General, 0, General_CompleteName, File_Name, true);
+ Fill(Stream_General, 0, General_FolderName, FileName::Path_Get(File_Name), true);
+ if (FileName::Extension_Get(File_Name).empty())
+ Fill(Stream_General, 0, General_FileName, FileName::Name_Get(File_Name), true);
+ else
+ Fill(Stream_General, 0, General_FileName, FileName::Name_Get(File_Name)+_T('.')+FileName::Extension_Get(File_Name), true);
+ File_Name.clear();
+
+ Finish("BDMV");
+}
+
+//---------------------------------------------------------------------------
+void File_Bdmv::Clpi_ProgramInfo()
+{
+ //Retrieving data from the M2TS file
+ std::map<int16u, stream_t> PIDs_StreamKind;
+ std::map<int16u, size_t> PIDs_StreamPos;
+ if (Config->File_Bdmv_ParseTargetedFile_Get() && File_Name.size()>10)
+ {
+ 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<Stream_Max; StreamKind++)
+ for (size_t StreamPos=0; StreamPos<Count_Get((stream_t)StreamKind); StreamPos++)
+ Fill((stream_t)StreamKind, StreamPos, "Source", file+_T(".m2ts"));
+ }
+
+ //Retrieving PID mapping
+ for (size_t StreamKind=(size_t)Stream_General+1; StreamKind<(size_t)Stream_Max; StreamKind++)
+ for (size_t StreamPos=0; StreamPos<Count_Get((stream_t)StreamKind); StreamPos++)
+ {
+ int16u PID=Retrieve((stream_t)StreamKind, StreamPos, General_ID).To_int16u();
+ PIDs_StreamKind[PID]=(stream_t)StreamKind;
+ PIDs_StreamPos[PID]=StreamPos;
+ }
+ }
+
+ //Parsing
+ int8u number_of_program_sequences;
+ Skip_B1( "Unknown");
+ Get_B1 (number_of_program_sequences, "number_of_program_sequences");
+ for (int8u program_sequence=0; program_sequence<number_of_program_sequences; program_sequence++)
+ {
+ int8u number_of_streams_in_ps;
+ Skip_B4( "Unknown");
+ Skip_B2( "program_map_PID");
+ Get_B1 (number_of_streams_in_ps, "number_of_streams_in_ps");
+ Skip_B1( "Unknown");
+ for (int16u Pos=0; Pos<number_of_streams_in_ps; Pos++)
+ {
+ Element_Begin("Stream");
+ int16u stream_PID;
+ int8u Stream_Length;
+ Get_B2 (stream_PID, "stream_PID");
+ Get_B1 (Stream_Length, "Length");
+ int64u Stream_End=Element_Offset+Stream_Length;
+ StreamKind_Last=Stream_Max;
+ std::map<int16u, stream_t>::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_Info(Clpi_Format(stream_type)); Element_Info(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_End();
+
+ 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<int32u, entry> entries; //Key is the start adress
+
+//---------------------------------------------------------------------------
+void File_Bdmv::Clpi_ExtensionData()
+{
+ entries Entries; //Key is the start adress
+
+ int32u Base_Pos=(int32u)Element_Offset-4;
+
+ int8u number_of_ext_data_entries;
+ Skip_B4( "Unknown");
+ Skip_B3( "Unknown");
+ Element_Begin("Offsets");
+ Get_B1 (number_of_ext_data_entries, "number_of_ext_data_entries");
+ for (size_t Start_Adress_Pos=0; Start_Adress_Pos<number_of_ext_data_entries; Start_Adress_Pos++)
+ {
+ int32u Start_Adress, Length;
+ int16u ID1, ID2;
+ Get_B2 (ID1, "ID1");
+ Get_B2 (ID2, "ID2");
+ Get_B4 (Start_Adress, "Start_Adress");
+ Get_B4 (Length, "Length");
+ Entries[Base_Pos+Start_Adress].ID1=ID1;
+ Entries[Base_Pos+Start_Adress].ID2=ID2;
+ Entries[Base_Pos+Start_Adress].Length=Length;
+ }
+ Element_End();
+
+ for (entries::iterator Entry=Entries.begin(); Entry!=Entries.end(); Entry++)
+ {
+ if (Entry->first>=Element_Offset) //If valid
+ {
+ if (Entry->first>Element_Offset)
+ Skip_XX(Entry->first-Element_Offset, "unknown");
+
+ Element_Begin("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_End();
+ }
+ }
+
+ 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_Begin("FirstPlayback", 12);
+ BS_Begin();
+ Info_S1( 2, FirstPlayback_object_type, "object_type"); Param_Info(Indx_object_type[FirstPlayback_object_type]);
+ Skip_S4(30, "reserved");
+ BS_End();
+ Indx_Indexes_Index(FirstPlayback_object_type);
+ Element_End();
+ Element_Begin("TopMenu", 12); {
+ BS_Begin();
+ Info_S1( 2, TopMenu_object_type, "object_type"); Param_Info(Indx_object_type[TopMenu_object_type]);
+ Skip_S4(30, "reserved");
+ BS_End();
+ Indx_Indexes_Index(TopMenu_object_type);
+ Element_End(); }
+ Get_B2 (number_of_Titles, "number_of_Titles");
+ for (int16u Pos=0; Pos<number_of_Titles; Pos++)
+ {
+ Element_Begin("Title", 12);
+ BS_Begin();
+ Info_S1( 2, Title_object_type, "object_type"); Param_Info(Indx_object_type[Title_object_type]);
+ Info_S1( 2, Title_title_search, "title_search"); Param_Info(Indx_title_search[Title_title_search]);
+ Skip_S4(28, "reserved");
+ BS_End();
+ Indx_Indexes_Index(Title_object_type);
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Bdmv::Indx_Indexes_Index(int8u object_type)
+{
+ BS_Begin();
+ Info_S1( 2, playback_type, "playback_type"); Param_Info(Indx_playback_type[object_type][playback_type]);
+ Skip_S2(14, "reserved");
+ BS_End();
+ switch (object_type)
+ {
+ case 1 : //HDMV
+ {
+ Info_B2(id_ref, "id_ref"); Element_Info(id_ref);
+ Skip_B4( "reserved");
+ }
+ break;
+ case 2 : //BD-J
+ {
+ Info_Local(5, id_ref, "id_ref"); Element_Info(id_ref);
+ Skip_B1( "reserved");
+ }
+ break;
+ default:
+ Skip_XX(6, "unknown");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Bdmv::Indx_ExtensionData()
+{
+ //Parsing
+ std::map<int32u, int32u> exts; //Key is the start adress, 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<number_of_ext_data_entries; Pos++)
+ {
+ Element_Begin("ext_data_entry");
+ int32u ext_data_start_adress, ext_data_length;
+ Skip_B2( "ID1 (AVCHD)");
+ Skip_B2( "ID2 (Version)");
+ Get_B4 (ext_data_start_adress, "ext_data_start_adress");
+ Get_B4 (ext_data_length, "ext_data_length");
+ Element_End();
+ exts[ext_data_start_adress]=ext_data_length;
+ }
+
+ for (std::map<int32u, int32u>::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_Begin();
+ int64u End=Element_Offset+ext->second;
+
+ int32u type_indicator;
+ Get_C4(type_indicator, "type_indicator"); Element_Info(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_End();
+ }
+ }
+}
+
+//---------------------------------------------------------------------------
+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_Begin("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_Begin("additional data");
+ Get_B4 (length2, "length2");
+ Skip_XX(length2, "reserved");
+ Element_End(4+length2);
+
+ Element_End(4+length);
+}
+
+//---------------------------------------------------------------------------
+void File_Bdmv::Indx_ExtensionData_IDEX_TableOfPlayLists()
+{
+ Element_Begin("TableOfPlayLists");
+
+ //Parsing
+ int32u length;
+ Get_B4 (length, "length");
+ Skip_XX(length, "unknown");
+
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Bdmv::Indx_ExtensionData_IDEX_MakersPrivateData()
+{
+ Element_Begin("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; Pos<number_of_maker_entries; Pos++)
+ {
+ Element_Begin("maker_entry");
+ Skip_B2( "maker_ID");
+ Skip_B2( "maker_model_code");
+ Skip_B4( "mpd_start_adress");
+ Skip_B4( "mpd_length");
+ Element_End();
+ }
+
+ if (datablock_start_adress)
+ {
+ if (Base_Offset+datablock_start_adress>Element_Offset)
+ Skip_XX(Base_Offset+datablock_start_adress-Element_Offset, "Unknown");
+ Skip_XX(length-datablock_start_adress, "Unknown");
+ }
+
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+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_Pos<number_of_mobjs; mobjs_Pos++)
+ {
+ Element_Begin("mobj");
+ int16u number_of_navigation_commands;
+ BS_Begin();
+ Info_SB(resume, "resume"); Param_Info(resume?"suspend":"discard");
+ Info_SB(menu_call, "menu_call"); Param_Info(menu_call?"enable":"disable");
+ Info_SB(title_search, "title_search"); Param_Info(title_search?"enable":"disable");
+ Skip_BS(13, "reserved");
+ BS_End();
+ Get_B2 (number_of_navigation_commands, "number_of_navigation_commands");
+ for (int16u navigation_command_Pos=0; navigation_command_Pos<number_of_navigation_commands; navigation_command_Pos++)
+ {
+ Element_Begin("navigation_command");
+ Skip_B4( "opcode");
+ Skip_B4( "destination");
+ Skip_B4( "source");
+ Element_End();
+ }
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Bdmv::Mobj_ExtensionData()
+{
+}
+
+//---------------------------------------------------------------------------
+void File_Bdmv::Mpls_AppInfoPlayList()
+{
+ //Parsing
+ Skip_B1( "unknown");
+ BS_Begin();
+ Skip_S1(6, "unknown");
+ Info_S2(2, playback_type, "playback_type"); Param_Info(Mpls_playback_type[playback_type]);
+ BS_End();
+ Skip_B2( "playback_count");
+ Skip_B4( "user_operation_mask_code 1");
+ Skip_B4( "user_operation_mask_code 2");
+ BS_Begin();
+ Skip_SB( "random access");
+ Skip_SB( "audio mix");
+ Skip_SB( "bypass mixer");
+ Skip_S2(13, "reserved");
+ BS_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Bdmv::Mpls_PlayList()
+{
+ //Parsing
+ Mpls_PlayList_Duration=0;
+ int16u number_of_PlayItems, number_of_SubPaths;
+ Skip_B2( "reserved");
+ Get_B2 (number_of_PlayItems, "number_of_PlayItems");
+ Get_B2 (number_of_SubPaths, "number_of_SubPaths");
+ for (int16u Pos=0; Pos<number_of_PlayItems; Pos++)
+ Mpls_PlayList_PlayItem();
+
+ if (Mpls_PlayList_Duration)
+ Fill(Stream_General, 0, General_Duration, Mpls_PlayList_Duration/45);
+
+ for (int16u SubPath_Pos=0; SubPath_Pos<number_of_SubPaths; SubPath_Pos++)
+ {
+ Element_Begin("SubPath");
+ int32u SubPath_length;
+ int16u number_of_SubPlayItems;
+ Get_B4 (SubPath_length, "length");
+ int64u SubPath_End=Element_Offset+SubPath_length;
+ Skip_B1( "Unknown");
+ Skip_B1( "SubPath_type");
+ Skip_B2( "repeat");
+ Get_B2 (number_of_SubPlayItems, "number_of_SubPlayItems");
+ for (int16u SubPlayItem=0; SubPlayItem<number_of_SubPlayItems; SubPlayItem++)
+ Mpls_PlayList_SubPlayItem();
+
+ if (SubPath_End>Element_Offset)
+ Skip_XX(SubPath_End-Element_Offset, "unknown");
+ Element_End(2+SubPath_length);
+ }
+
+ 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_Begin("PlayItem");
+ 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_Info(Clip_Information_file_name);
+ Skip_Local(4, "Clip_codec_identifier");
+ Skip_B2( "unknown");
+ Skip_B1( "Unknown");
+ Info_B4(Time_In, "Time (In)"); Param_Info((float32)Time_In/45000);
+ Info_B4(Time_Out, "Time (Out)"); Param_Info((float32)Time_Out/45000);
+ Skip_B4( "UO1");
+ Skip_B4( "UO2");
+ Skip_B4( "An?");
+
+ if (Time_Out>Time_In)
+ Mpls_PlayList_Duration+=Time_Out-Time_In;
+
+ Mpls_PlayList_PlayItem_STN_table();
+
+ if (!File_Name.empty())
+ {
+ 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))
+ Merge(MI, Stream_Video, 0, 0);
+ }
+
+ if (End>Element_Offset)
+ Skip_XX(End-Element_Offset, "unknown");
+ Element_End(2+length);
+}
+
+//---------------------------------------------------------------------------
+void File_Bdmv::Mpls_PlayList_PlayItem_STN_table()
+{
+ Element_Begin("STN");
+
+ int16u length;
+ Get_B2 (length, "length");
+ int64u End=Element_Offset+length;
+ 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_Begin();
+ 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_Info(Clpi_Format(stream_type)); Element_Info(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_Info(language);
+
+ if (IDs_End-Element_Offset)
+ Skip_XX(IDs_End-Element_Offset, "unknown");
+ Element_End();
+
+ 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);
+ }
+ FILLING_END();
+ }
+
+ if (End>Element_Offset)
+ Skip_XX(End-Element_Offset, "unknown");
+ Element_End(2+length);
+}
+
+//---------------------------------------------------------------------------
+void File_Bdmv::Mpls_PlayList_PlayItem_STN_table_Video()
+{
+ //Parsing
+ int8u Format, FrameRate;
+ BS_Begin();
+ Get_S1 (4, Format, "format"); Param_Info(Clpi_Video_Format[Format]);
+ Get_S1 (4, FrameRate, "frame_rate"); Param_Info(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_Info(Clpi_Audio_Channels[Channels]);
+ Get_S1 (4, SamplingRate, "sampling_rate"); Param_Info(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()
+{
+ Element_Begin("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_Info(Clip_Information_file_name);
+ Skip_Local(4, "Clip_codec_identifier");
+ Skip_B4( "unknown");
+ Skip_B1( "unknown");
+ Info_B4(Time_In, "time (in)"); Param_Info((float32)Time_In/45000);
+ Info_B4(Time_Out, "time (out)"); Param_Info((float32)Time_Out/45000);
+ Skip_B2( "sync PI");
+ Skip_B4( "sync PTS");
+
+ if (End>Element_Offset)
+ Skip_XX(End-Element_Offset, "unknown");
+ Element_End(2+length);
+
+ FILLING_BEGIN();
+ if (Mpls_PlayList_IsParsed)
+ {
+ if (!File_Name.empty())
+ {
+ 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))
+ {
+ Ztring ID=Retrieve(Stream_Video, 0, Video_ID);
+ Ztring ID_String=Retrieve(Stream_Video, 0, Video_ID_String);
+ Ztring Format_Profile=Retrieve(Stream_Video, 0, Video_Format_Profile);
+ Ztring BitRate=Retrieve(Stream_Video, 0, Video_BitRate);
+ Ztring Source=Retrieve(Stream_Video, 0, "Source");
+ Fill(Stream_Video, 0, Video_ID, MI.Get(Stream_Video, 0, Video_ID)+_T(" / ")+ID, true);
+ Fill(Stream_Video, 0, Video_ID_String, MI.Get(Stream_Video, 0, Video_ID_String)+_T(" / ")+ID_String, true);
+ if (!Format_Profile.empty())
+ Fill(Stream_Video, 0, Video_Format_Profile, MI.Get(Stream_Video, 0, Video_Format_Profile)+_T(" / ")+Format_Profile, true);
+ if (!BitRate.empty())
+ Fill(Stream_Video, 0, 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, 0, "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; Pos<count; Pos++)
+ {
+ Element_Begin("Mark");
+ int8u type;
+ Skip_B1( "unknown");
+ Get_B1 (type, "type"); Param_Info(Mpls_PlayListMarks_Mark_type(type));
+ switch (type)
+ {
+ case 1 : //entry-mark
+ case 2 : //link point
+ {
+ int32u time;
+ int16u stream_file_index;
+ Get_B2 (stream_file_index, "stream_file_index");
+ Get_B4 (time, "time"); Param_Info(time/45, " milliseconds");
+ Skip_B2( "unknown");
+ Skip_B4( "unknown");
+
+ FILLING_BEGIN();
+ if (Pos==0)
+ time_Pos0=time;
+ if (stream_file_index==0 && type==1) //We currently handle only the first file
+ {
+ Fill(Stream_Menu, 0, Ztring().Duration_From_Milliseconds((int64u)((time-time_Pos0)/45)).To_UTF8().c_str(), _T("Chapter ")+Ztring::ToZtring(time_Pos));
+ time_Pos++;
+ }
+ FILLING_END();
+ }
+ break;
+ default:
+ Skip_XX(12, "unknwon");
+ }
+ Element_End();
+ }
+
+ Fill(Stream_Menu, StreamPos_Last, Menu_Chapters_Pos_End, Count_Get(Stream_Menu, StreamPos_Last), 10, true);
+}
+
+//---------------------------------------------------------------------------
+void File_Bdmv::Mpls_ExtensionData()
+{
+ entries Entries; //Key is the start adress
+
+ int32u Base_Pos=(int32u)Element_Offset-4;
+
+ int8u number_of_ext_data_entries;
+ Skip_B4( "Unknown");
+ Skip_B3( "Unknown");
+ Element_Begin("Offsets");
+ Get_B1 (number_of_ext_data_entries, "number_of_ext_data_entries");
+ for (size_t Start_Adress_Pos=0; Start_Adress_Pos<number_of_ext_data_entries; Start_Adress_Pos++)
+ {
+ int32u Start_Adress, Length;
+ int16u ID1, ID2;
+ Get_B2 (ID1, "ID1");
+ Get_B2 (ID2, "ID2");
+ Get_B4 (Start_Adress, "Start_Adress");
+ Get_B4 (Length, "Length");
+ Entries[Base_Pos+Start_Adress].ID1=ID1;
+ Entries[Base_Pos+Start_Adress].ID2=ID2;
+ Entries[Base_Pos+Start_Adress].Length=Length;
+ }
+ Element_End();
+
+ for (entries::iterator Entry=Entries.begin(); Entry!=Entries.end(); Entry++)
+ {
+ if (Entry->first>=Element_Offset) //If valid
+ {
+ if (Entry->first>Element_Offset)
+ Skip_XX(Entry->first-Element_Offset, "unknown");
+
+ Element_Begin("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_End();
+ }
+ }
+
+ if (Element_Size>Element_Offset)
+ Skip_XX(Element_Size-Element_Offset, "Unknown");
+}
+
+//---------------------------------------------------------------------------
+void File_Bdmv::Mpls_ExtensionData_SubPath_entries()
+{
+ Element_Begin("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<number_of_SubPath_extensions+Mpls_PlayList_number_of_SubPaths; SubPath_extension++)
+ {
+ Element_Begin("SubPath_extension");
+ int32u SubPath_extension_length;
+ Get_B4 (SubPath_extension_length, "length");
+ int64u SubPath_extension_End=Element_Offset+SubPath_extension_length;
+ Skip_B1( "Unknown");
+ Get_B1 (SubPath_type, "SubPath_type");
+ switch(SubPath_type)
+ {
+ case 0x08 :
+ {
+ int8u number_of_SubPlayItems;
+ Skip_B3( "Unknown");
+ Get_B1 (number_of_SubPlayItems, "number_of_SubPlayItems");
+ for (int8u Pos=0; Pos<number_of_SubPlayItems; Pos++)
+ Mpls_PlayList_SubPlayItem();
+ }
+ default : ;
+ }
+ if (SubPath_extension_End-Element_Offset)
+ Skip_XX(SubPath_extension_End-Element_Offset, "Padding");
+ Element_End();
+ }
+ if (End-Element_Offset)
+ Skip_XX(End-Element_Offset, "Padding");
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Bdmv::StreamCodingInfo_Video()
+{
+ //Parsing
+ int8u Format, FrameRate, AspectRatio;
+ BS_Begin();
+ Get_S1 (4, Format, "Format"); Param_Info(Clpi_Video_Format[Format]);
+ Get_S1 (4, FrameRate, "Frame rate"); Param_Info(Clpi_Video_FrameRate[FrameRate]);
+ Get_S1 (4, AspectRatio, "Aspect ratio"); Param_Info(Clpi_Video_AspectRatio[AspectRatio]);
+ Skip_BS(4, "Reserved");
+ BS_End();
+
+ FILLING_BEGIN();
+ if (StreamKind_Last==Stream_Max)
+ {
+ 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]);
+ if (Clpi_Video_Height[AspectRatio])
+ Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, Clpi_Video_AspectRatio[AspectRatio], 3, true);
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Bdmv::StreamCodingInfo_Audio()
+{
+ //Parsing
+ int8u Channels, SamplingRate;
+ BS_Begin();
+ Get_S1 (4, Channels, "Channel layout"); Param_Info(Clpi_Audio_Channels[Channels]);
+ Get_S1 (4, SamplingRate, "Sampling Rate"); Param_Info(Clpi_Audio_SamplingRate[SamplingRate]);
+ BS_End();
+ Info_Local(3, Language, "Language"); Element_Info(Language);
+
+ FILLING_BEGIN();
+ if (StreamKind_Last==Stream_Max)
+ {
+ 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]);
+ }
+ Fill(Stream_Audio, StreamPos_Last, Audio_Language, Language);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Bdmv::StreamCodingInfo_Text()
+{
+ //Parsing
+ if (stream_type==0x92) //Subtitle
+ Skip_B1( "Unknown");
+ Info_Local(3, Language, "Language"); Element_Info(Language);
+
+ FILLING_BEGIN();
+ if (StreamKind_Last==Stream_Max)
+ {
+ Stream_Prepare(Stream_Text);
+ Fill(Stream_Text, StreamPos_Last, Text_Format, Clpi_Format(stream_type));
+ }
+ Fill(Stream_Text, StreamPos_Last, Text_Language, Language);
+ FILLING_END();
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_BDMV_YES
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Bdmv.h b/src/thirdparty/MediaInfo/Multiple/File_Bdmv.h
new file mode 100644
index 000000000..f8d10008c
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Bdmv.h
@@ -0,0 +1,91 @@
+// File_Bdmv - Info for Blu-ray Movie files
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Blu-ray Movie files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_BdmvH
+#define MediaInfo_File_BdmvH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+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();
+ 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<int32u, size_t> Types; //Key is the start adress
+ int64u Mpls_PlayList_Duration;
+ int16u Mpls_PlayList_number_of_SubPaths;
+ bool Mpls_PlayList_IsParsed;
+};
+
+} //NameSpace
+
+#endif
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Cdxa.cpp b/src/thirdparty/MediaInfo/Multiple/File_Cdxa.cpp
new file mode 100644
index 000000000..75703d6b2
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Cdxa.cpp
@@ -0,0 +1,317 @@
+// File_Cdxa - Info for CDXA files
+// Copyright (C) 2004-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_Size<File_Size/2)
+ GoToFromEnd(File_Offset+Buffer_Size);
+ if (File_GoTo!=(int64u)-1)
+ Info("CDXA, Jumping to end of file");
+
+ //Details
+ #if MEDIAINFO_TRACE
+ if (MediaInfoLib::Config.DetailsLevel_Get())
+ {
+ if (!MI->Inform().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
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Cdxa.h b/src/thirdparty/MediaInfo/Multiple/File_Cdxa.h
new file mode 100644
index 000000000..800cb9170
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Cdxa.h
@@ -0,0 +1,73 @@
+// File_Cdxa - Info for CDXA files
+// Copyright (C) 2004-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Dpg.cpp b/src/thirdparty/MediaInfo/Multiple/File_Dpg.cpp
new file mode 100644
index 000000000..7554ee789
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Dpg.cpp
@@ -0,0 +1,186 @@
+// File_Dpg - Info for DPG files
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Format:
+// * File header
+// * MPEG Audio stream
+// * MPEG Video stream
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_Info(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_Continue()
+{
+ if (!Parser)
+ return; //Not ready
+
+ if (Audio_Size)
+ {
+ #if defined(MEDIAINFO_MPEGA_YES)
+ Open_Buffer_Continue(Parser, (size_t)((File_Offset+Buffer_Size<Audio_Offset+Audio_Size)?Buffer_Size:(Audio_Offset+Audio_Size-File_Offset)));
+ if (Parser->Status[IsAccepted])
+ {
+ Finish(Parser);
+ Merge(*Parser, Stream_Audio, 0, 0);
+ #if defined(MEDIAINFO_MPEGV_YES)
+ Audio_Size=0;
+ Data_GoTo(Video_Offset, "DPG");
+ delete Parser; Parser=new File_Mpegv();
+ Open_Buffer_Init(Parser);
+ #else
+ Finish("DPG");
+ #endif
+ }
+ #endif
+ }
+ else
+ {
+ #if defined(MEDIAINFO_MPEGV_YES)
+ Open_Buffer_Continue(Parser, (size_t)((File_Offset+Buffer_Size<Video_Offset+Video_Size)?Buffer_Size:(Video_Offset+Video_Size-File_Offset)));
+ if (Parser->Status[IsAccepted])
+ {
+ //Merging
+ Finish(Parser);
+ Merge(*Parser, Stream_Video, 0, 0);
+
+ Finish("DPG");
+ }
+ #endif
+ }
+
+ //Positioning
+ Buffer_Offset=Buffer_Size; //We have already parsed this data
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_DPG_YES
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Dpg.h b/src/thirdparty/MediaInfo/Multiple/File_Dpg.h
new file mode 100644
index 000000000..d2902947f
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Dpg.h
@@ -0,0 +1,71 @@
+// File_Dpg - Info for DPG files
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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_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
diff --git a/src/thirdparty/MediaInfo/Multiple/File_DvDif.cpp b/src/thirdparty/MediaInfo/Multiple/File_DvDif.cpp
new file mode 100644
index 000000000..d569f0eea
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_DvDif.cpp
@@ -0,0 +1,1493 @@
+// File_DvDif - Info for DV-DIF files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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"
+//---------------------------------------------------------------------------
+
+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",
+ "",
+ "16/9",
+ "Letterbox",
+ "",
+ "",
+ "",
+ "16/9",
+};
+
+//---------------------------------------------------------------------------
+const int32u Dv_Audio_SamplingRate[]=
+{
+ 48000,
+ 44100,
+ 32000,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+};
+
+//---------------------------------------------------------------------------
+const char* Dv_StereoMode[]=
+{
+ "Multi-Stero",
+ "Lumped",
+};
+
+//---------------------------------------------------------------------------
+const int32u Dv_Audio_Resolution[]=
+{
+ 16,
+ 12,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+};
+
+//---------------------------------------------------------------------------
+const int8u Dv_ChannelsPerBlock[]=
+{
+ 1,
+ 2,
+ 0,
+ 0,
+};
+
+//---------------------------------------------------------------------------
+const char* Dv_Pair[]=
+{
+ "One pair of channels",
+ "Independant 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
+ MustSynchronize=true;
+ Buffer_TotalBytes_FirstSynched_Max=64*1024;
+
+ //In
+ Frame_Count_Valid=48; //(DV100 is up to 48 DIF sequences)
+ AuxToAnalyze=0x00; //No Aux to analyze
+ IgnoreAudio=false;
+
+ //Temp
+ FrameCount=0;
+ FrameSize_Theory=0;
+ Duration=0;
+ TimeCode_First=(int64u)-1;
+ 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;
+ DSF_IsValid=false;
+ APT=0xFF; //Impossible
+ video_source_stype=0xFF;
+ audio_source_stype=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;
+
+ #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()
+{
+ #if defined(MEDIAINFO_EIA608_YES)
+ for (size_t Pos=0; Pos<CC_Parsers.size(); Pos++)
+ delete CC_Parsers[Pos]; //CC_Parsers[Pos]=NULL;
+ #endif
+ #if defined(MEDIAINFO_DVDIF_ANALYZE_YES)
+ delete Mpeg4_stts; //Mpeg4_stts=NULL;
+ #endif
+}
+
+//***************************************************************************
+// 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)==0x6D646174 //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()
+{
+ while (Buffer_Offset+8*80<=Buffer_Size //8 blocks
+ && !((CC3(Buffer+Buffer_Offset+0*80)&0xE0F0FF)==0x000000 //Header 0
+ && (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
+ Buffer_Offset++;
+
+ if (Buffer_Offset+8*80>Buffer_Size)
+ return false;
+
+ return true;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_DvDif::Streams_Fill()
+{
+ Fill(Stream_General, 0, General_Format, "DV", Unlimited, true, true);
+
+ Stream_Prepare(Stream_Video);
+ Fill(Stream_Video, 0, Video_Format, "DV");
+ Fill(Stream_Video, 0, Video_Codec, "DV");
+ Fill(Stream_Video, 0, Video_BitRate_Mode, "CBR");
+ Fill(Stream_Video, 0, Video_Standard, system?"PAL":"NTSC");
+ Fill(Stream_Video, 0, Video_Resolution, 8);
+ switch (video_source_stype)
+ {
+ case 0x00 :
+ case 0x04 :
+ Fill(Stream_Video, 0, Video_Width, 720);
+ Fill(Stream_Video, 0, Video_Height, system?576:480);
+ break;
+ case 0x14 :
+ case 0x15 :
+ Fill(Stream_Video, 0, Video_Width, system?1440:1280);
+ Fill(Stream_Video, 0, Video_Height, video_source_stype==0x14?1080:1035);
+ break;
+ case 0x18 :
+ Fill(Stream_Video, 0, Video_Width, 960);
+ Fill(Stream_Video, 0, Video_Height, 720);
+ break;
+ default : ;
+ }
+ Fill(Stream_Video, 0, Video_FrameRate, system?25.000:29.970);
+ Fill(Stream_Video, 0, Video_FrameRate_Mode, "CFR");
+ if (video_sourcecontrol_IsParsed)
+ {
+ if (FSC_WasSet && FSP_WasNotSet)
+ {
+ switch (video_source_stype)
+ {
+ case 0x14 :
+ case 0x15 :
+ Fill(Stream_Video, 0, Video_ScanType, "Interlaced");
+ Fill(Stream_Video, 0, Video_Interlacement, "Interlaced");
+ break;
+ case 0x18 :
+ Fill(Stream_Video, 0, Video_ScanType, "Progressive");
+ Fill(Stream_Video, 0, Video_Interlacement, "Progressive");
+ break;
+ default : ;
+ }
+ }
+ else
+ {
+ Fill(Stream_Video, 0, Video_ScanType, Interlaced?"Interlaced":"Progressive");
+ Fill(Stream_Video, 0, Video_Interlacement, Interlaced?"Interlaced":"PFF");
+ }
+ switch (aspect)
+ {
+ case 0 :
+ case 4 : Fill(Stream_Video, 0, Video_DisplayAspectRatio, 4.0/3.0, 3, true); break;
+ case 2 :
+ case 7 : Fill(Stream_Video, 0, Video_DisplayAspectRatio, 16.0/9.0, 3, true); break;
+ default: ;
+ }
+ }
+
+ if (!FSC_WasSet) //Original DV 25 Mbps
+ {
+ if (system==false) //NTSC
+ {
+ switch (video_source_stype)
+ {
+ case 0 : Fill(Stream_Video, 0, Video_Colorimetry, "4:1:1"); break; //NTSC 25 Mbps
+ default : ;
+ }
+ }
+ else //PAL
+ {
+ switch (video_source_stype)
+ {
+ case 0 : if (APT==0)
+ Fill(Stream_Video, 0, Video_Colorimetry, "4:2:0"); //PAL 25 Mbps (IEC 61834)
+ else
+ Fill(Stream_Video, 0, Video_Colorimetry, "4:1:1"); //PAL 25 Mbps (SMPTE 314M)
+ break;
+ default : ;
+ }
+ }
+ }
+ else //DV 50 Mbps and 100 Mbps
+ Fill(Stream_Video, 0, Video_Colorimetry, "4:2:2");
+
+ if (FrameSize_Theory)
+ {
+ float64 OverallBitRate=FrameSize_Theory*(DSF?25.000:29.970)*8;
+ if (OverallBitRate>27360000 && OverallBitRate<=30240000) OverallBitRate=DSF?28800000:28771229;
+ if (FSC_WasSet)
+ {
+ if (FSP_WasNotSet)
+ OverallBitRate*=4; //DV100
+ else
+ OverallBitRate*=2; //DV50
+ }
+ if (OverallBitRate)
+ {
+ Fill(Stream_General, 0, General_OverallBitRate, OverallBitRate, 0);
+ Fill(Stream_Video, 0, (FSC_WasSet && FSP_WasNotSet)?Video_BitRate_Maximum:Video_BitRate, OverallBitRate*134/150*76/80, 0); //134 Video DIF from 150 DIF, 76 bytes from 80 byte DIF
+ }
+ }
+
+ for (size_t Pos=0; Pos<Streams_Audio.size(); Pos++)
+ {
+ Stream_Prepare(Stream_Audio);
+ for (std::map<std::string, Ztring>::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);
+ }
+
+ //Library settings
+ Fill(Stream_Video, 0, Video_Encoded_Library_Settings, Encoded_Library_Settings);
+
+ //Profile
+ if (FSC_WasSet)
+ {
+ if (FSP_WasNotSet)
+ {
+ Fill(Stream_General, 0, General_Format_Commercial_IfAny, "DVCPRO HD");
+ Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "DVCPRO HD");
+ Fill(Stream_Video, 0, Video_Resolution, 10, 10, true); //MXF files say that DVCPRO HD are 10 bits, exact?
+ Fill(Stream_Video, 0, Video_BitRate_Mode, "VBR", Unlimited, true, true);
+ }
+ else
+ {
+ Fill(Stream_General, 0, General_Format_Commercial_IfAny, "DVCPRO 50");
+ Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "DVCPRO 50");
+ }
+ }
+ 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");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_DvDif::Streams_Finish()
+{
+ if (!Recorded_Date_Date.empty())
+ {
+ if (Recorded_Date_Time.size()>4)
+ {
+ Recorded_Date_Time.resize(Recorded_Date_Time.size()-4); //Keep out milliseconds
+ Recorded_Date_Date+=_T(" ");
+ Recorded_Date_Date+=Recorded_Date_Time;
+ }
+ if (Count_Get(Stream_General)==0)
+ Stream_Prepare(Stream_General);
+ Fill(Stream_General, 0, General_Recorded_Date, Recorded_Date_Date);
+ }
+ if (!IsSub && Duration)
+ Fill(Stream_General, 0, General_Duration, Duration);
+
+ //Delay
+ if (TimeCode_First!=(int64u)-1)
+ {
+ Fill(Stream_Video, 0, Video_Delay, TimeCode_First);
+ for (size_t Pos=0; Pos<Count_Get(Stream_Audio); Pos++)
+ Fill(Stream_Audio, Pos, Audio_Delay, TimeCode_First);
+ }
+
+ #if defined(MEDIAINFO_EIA608_YES)
+ for (size_t Pos=0; Pos<CC_Parsers.size(); Pos++)
+ if (CC_Parsers[Pos] && CC_Parsers[Pos]->Status[IsFilled])
+ {
+ CC_Parsers[Pos]->Finish();
+ Merge(*CC_Parsers[Pos]);
+ Fill(Stream_Text, StreamPos_Last, Text_ID, Pos);
+ }
+ #endif
+
+ #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
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+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_Info(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()
+{
+ //Config
+ if (SCT!=(int8u)-1)
+ {
+ if (!FSC_WasSet && FSC)
+ FSC_WasSet=true;
+
+ if (!FSP_WasNotSet && !FSP)
+ FSP_WasNotSet=true;
+ }
+
+ if (AuxToAnalyze!=0x00)
+ {
+ Element();
+ return;
+ }
+
+ if (Element_Code==(int64u)-1)
+ {
+ Skip_XX(Element_Size, "Junk");
+ return;
+ }
+
+ //Integrity
+ if (!Status[IsAccepted])
+ {
+ //DIF Sequence Numbers
+ if (DSF_IsValid)
+ {
+ if (Dseq_Old!=Dseq)
+ {
+ if (Dseq==0
+ && !(!DSF && Dseq_Old==9)
+ && !( DSF && Dseq_Old==11))
+ Trusted_IsNot("Wrong order");
+ Dseq_Old=Dseq;
+ }
+ }
+
+ //DIF Block Numbers
+ if (Element_Code>=8)
+ return;
+ int8u Number=DBN_Olds[(size_t)Element_Code]+1;
+ switch (SCT)
+ {
+ case 0 : //Header
+ if (SCT_Old!=4
+ || DBN!=0)
+ Trusted_IsNot("Wrong order");
+ break;
+ case 1 : //Subcode
+ if (!((DBN==0 && SCT_Old==0) || (DBN!=0 && SCT_Old==1))
+ || Number!=DBN && !(Number==2 && DBN==0))
+ Trusted_IsNot("Wrong order");
+ break;
+ case 2 : //VAUX
+ if (!((DBN==0 && SCT_Old==1) || (DBN!=0 && SCT_Old==2))
+ || Number!=DBN && !(Number==3 && DBN==0))
+ Trusted_IsNot("Wrong order");
+ break;
+ case 3 : //Audio
+ if (!((DBN==0 && SCT_Old==2) || (DBN!=0 && SCT_Old==4))
+ || Number!=DBN && !(Number==9 && DBN==0))
+ Trusted_IsNot("Wrong order");
+ break;
+ case 4 : //Video
+ if (!(SCT_Old==3 || SCT_Old==4)
+ || Number!=DBN && !(Number==135 && DBN==0))
+ Trusted_IsNot("Wrong order");
+ break;
+ default: ;
+ }
+ SCT_Old=SCT;
+ if (SCT<8)
+ DBN_Olds[SCT]=DBN;
+ }
+
+ Element_Info(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
+
+ 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;
+ }
+
+ FrameCount++;
+ 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;
+
+ 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;
+ }
+
+ FrameCount++;
+ 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_Begin("ssyb");
+
+ //Parsing
+ BS_Begin();
+ //ID0-ID1
+ Skip_SB( "FR - Identification of half of channel"); //1=first half, 0=second
+ if (syb_num==0)
+ 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_End();
+}
+
+//---------------------------------------------------------------------------
+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] && FrameCount>=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_Begin();
+ int8u PackType;
+ if (AuxToAnalyze==0x00)
+ Get_B1 (PackType, "Pack Type");
+ else
+ PackType=AuxToAnalyze; //Forced by parser
+
+ switch(PackType)
+ {
+ case 0x13 : timecode(); 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_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 Temp;
+ 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, Temp, "Frames (Tens)");
+ Frames+=Temp*10;
+ Get_S1 (4, Temp, "Frames (Units)");
+ Frames+=Temp;
+
+ 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, Temp, "Seconds (Tens)");
+ MilliSeconds+=Temp*10*1000;
+ Get_S1 (4, Temp, "Seconds (Units)");
+ MilliSeconds+=Temp*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, Temp, "Minutes (Tens)");
+ MilliSeconds+=Temp*10*60*1000;
+ Get_S1 (4, Temp, "Minutes (Units)");
+ MilliSeconds+=Temp*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, Temp, "Hours (Tens)");
+ MilliSeconds+=Temp*10*60*60*1000;
+ Get_S1 (4, Temp, "Hours (Units)");
+ MilliSeconds+=Temp*60*60*1000;
+ Element_Info(Ztring().Duration_From_Milliseconds(MilliSeconds+((DSF_IsValid && Frames!=45)?((int64u)(Frames/(DSF?25.000:29.970)*1000)):0)));
+ BS_End();
+
+ if (TimeCode_First==(int64u)-1 && MilliSeconds!=167185000) //if all bits are set to 1, this is not a valid timestamp
+ {
+ TimeCode_First=MilliSeconds;
+ if (DSF_IsValid && Frames!=45) //all bits are set to 1
+ TimeCode_First+=(int64u)(Frames/(DSF?25.000:29.970)*1000);
+ }
+}
+
+//---------------------------------------------------------------------------
+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_Info(Dv_StereoMode[StereoMode]);
+ Info_S1(2, ChannelsPerBlock, "CHN - Channels per block"); Param_Info(Dv_ChannelsPerBlock[ChannelsPerBlock]);
+ Info_S1(1, Pair, "PA - Pair"); Param_Info(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_Info(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_Info(Dv_Audio_SamplingRate[SamplingRate]);
+ Get_S1 (3, Resolution, "QU - Resolution"); Param_Info(Dv_Audio_Resolution[Resolution]);
+ BS_End();
+
+ FILLING_BEGIN();
+ if (!IgnoreAudio && (FrameCount==1 || AuxToAnalyze)) //Only the first time
+ {
+ //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()<Audio_Count)
+ Streams_Audio.resize(Audio_Count);
+ for (size_t Pos=0; Pos<Audio_Count; Pos++)
+ {
+ if (Streams_Audio[Pos]==NULL)
+ Streams_Audio[Pos]=new stream;
+ Streams_Audio[Pos]->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["Resolution"].From_Number(Dv_Audio_Resolution[Resolution]);
+ Streams_Audio[Pos]->Infos["BitRate"].From_Number((audio_source_stype==3?1:2)*Dv_Audio_SamplingRate[SamplingRate]*Dv_Audio_Resolution[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_Info(Dv_CopyGenerationManagementSystem[CopyGenerationManagementSystem]);
+ Info_S1(2, InputType, "ISR - Input type"); Param_Info(Dv_InputType[InputType]);
+ Info_S1(2, CompressionTimes, "CMP - Compression times"); Param_Info(Dv_CompressionTimes[CompressionTimes]);
+ Info_S1(2, Emphasis, "EFC - Emphasis"); Param_Info(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, 0–9)");
+ Skip_S1(4, "TVCH (units, 0–9)");
+
+ //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, 0–9)");
+
+ //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 (!Status[IsAccepted] && (FrameCount==1 || AuxToAnalyze) && Count_Get(Stream_Video)==0) //Only the first time
+ {
+ if (!system)
+ Frame_Count_Valid=Frame_Count_Valid*10/12; //NTSC is only 10 DIF sequence per frame
+ }
+ 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_Info(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_Info(Dv_Disp[aspect]);
+
+ //PC3
+ Skip_SB( "FF - Frame/Field"); //1=Frame, 0=Field
+ Skip_SB( "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 (size_t Pos=0; Pos<2; Pos++)
+ CC_Parsers[Pos]=new File_Eia608();
+ 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();
+ Mark_1_NoTrustError();
+ Mark_1_NoTrustError();
+ Skip_S1(6, "iris");
+ Info_S1(4, ae_mode, "ae mode"); Param_Info(Dv_consumer_camera_1_ae_mode[ae_mode]);
+ Skip_S1(4, "agc(Automatic Gain Control)");
+ Info_S1(3, wb_mode, "wb mode (white balance mode)"); Param_Info(Dv_consumer_camera_1_wb_mode[wb_mode]);
+ Info_S1(5, white_balance, "white balance"); Param_Info(Dv_consumer_camera_1_white_balance(white_balance));
+ Info_S1(1, fcm, "fcm (Focus mode)"); Param_Info(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_Info(_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_Info(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_Info(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
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_DvDif.h b/src/thirdparty/MediaInfo/Multiple/File_DvDif.h
new file mode 100644
index 000000000..4445c0c57
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_DvDif.h
@@ -0,0 +1,341 @@
+// File_DvDif - Info for DVD objects (IFO) files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
+ size_t 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 - Global
+ #ifdef MEDIAINFO_DVDIF_ANALYZE_YES
+ void Read_Buffer_Continue();
+ #endif //MEDIAINFO_DVDIF_ANALYZE_YES
+
+ //Buffer - Synchro
+ bool Synchronize();
+
+ //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 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<std::string, Ztring> Infos;
+ };
+ std::vector<stream*> Streams_Audio;
+
+ //Temp
+ #if defined(MEDIAINFO_EIA608_YES)
+ std::vector<File__Analyze*> CC_Parsers;
+ #endif
+ Ztring Recorded_Date_Date;
+ Ztring Recorded_Date_Time;
+ Ztring Encoded_Library_Settings;
+ size_t FrameCount;
+ int64u Duration;
+ int64u TimeCode_First;
+ 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;
+ bool Interlaced;
+ bool system;
+ bool FSC_WasSet;
+ bool FSP_WasNotSet;
+ bool video_sourcecontrol_IsParsed;
+ bool audio_locked;
+
+ #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<int64u> 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<size_t> Video_STA_Errors; //Per STA type
+ std::vector<size_t> Video_STA_Errors_Total; //Per STA type
+ std::vector<size_t> Audio_Errors; //Per Dseq
+ std::vector<size_t> audio_source_IsPresent;
+ std::vector<bool> CH_IsPresent;
+ std::vector<std::vector<size_t> > Audio_Errors_Total; //Per Channel and Dseq
+ std::vector<std::vector<size_t> > Audio_Invalids; //Per Channel and Dseq
+ std::vector<std::vector<size_t> > 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<recZ> Speed_RecZ;
+ struct timeCodeZ_Single
+ {
+ int64u FramePos;
+ Ztring TimeCode;
+
+ timeCodeZ_Single()
+ {
+ FramePos=(int64u)-1;
+ }
+ };
+ struct timeCodeZ
+ {
+ timeCodeZ_Single First;
+ timeCodeZ_Single Last;
+ };
+ std::vector<timeCodeZ> 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<timeStampsZ> Speed_TimeStampsZ;
+
+
+
+ struct arb
+ {
+ std::vector<size_t> 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<size_t> 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_part> stts;
+ stts* Mpeg4_stts;
+ size_t Mpeg4_stts_Pos;
+ #endif //MEDIAINFO_DVDIF_ANALYZE_YES
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Multiple/File_DvDif_Analysis.cpp b/src/thirdparty/MediaInfo/Multiple/File_DvDif_Analysis.cpp
new file mode 100644
index 000000000..71b89f742
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_DvDif_Analysis.cpp
@@ -0,0 +1,1625 @@
+// File_DvDif - Info for DV-DIF files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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;
+ }
+
+ bool Errors_AreDetected=false;
+ bool Infos_AreDetected=false;
+ bool Arb_AreDetected=false;
+ Ztring Errors_Stats_Line;
+ if (Speed_FrameCount) //We must have at least one complete frame
+ {
+ #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(Frame_Number_Padded.begin(), 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
+ || Speed_TimeCode_Current.Time.Hours)
+ 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<Pos_End; Pos++)
+ if (Audio_Invalids[Channel][Pos])
+ Audio_Errors_Count+=Audio_Invalids[Channel][Pos];
+ if (!Audio_Errors.empty())
+ for (size_t Pos=Pos_Begin; Pos<Pos_End; Pos++)
+ if (Audio_Errors[Pos])
+ Audio_Errors_Count+=Audio_Errors[Pos];
+ if (Audio_Errors_Count>=(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(Video_STA_Errors_Count_Padded.begin(), 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(Video_STA_Errors_Count_Padded.begin(), 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; Pos<Pos_End; Pos++)
+ {
+ if (Audio_Errors[Pos])
+ {
+ Audio_Errors_Count+=Audio_Errors[Pos];
+ Ztring Audio_Errors_Count_Padded=Ztring::ToZtring(Audio_Errors[Pos]);
+ if (Audio_Errors_Count_Padded.size()<2)
+ Audio_Errors_Count_Padded.insert(Audio_Errors_Count_Padded.begin(), 2-Audio_Errors_Count_Padded.size(), _T(' '));
+ Audio_Errors_Details+=Audio_Errors_Count_Padded;
+ Audio_Errors_Details+=_T(" Dseq=");
+ Audio_Errors_Details+=Ztring::ToZtring(Pos, 16);
+ Audio_Errors_Details+=_T(", ");
+ if (Audio_Errors_Total.empty())
+ {
+ Audio_Errors_Total.resize(8);
+ for (size_t Audio_Errors_Pos=0; Audio_Errors_Pos<8; Audio_Errors_Pos++)
+ Audio_Errors_Total[Audio_Errors_Pos].resize(16);
+ }
+ Audio_Errors_Total[Channel][Pos]+=Audio_Errors[Pos];
+ }
+ }
+ if (Audio_Errors_Count)
+ {
+ if (!ErrorsAreAlreadyDetected)
+ {
+ if (!Stats_Total_AlreadyDetected)
+ {
+ Stats_Total_AlreadyDetected=true;
+ Stats_Total++;
+ Stats_Total_WithoutArb++;
+ }
+ Stats[2]++;
+ Errors_Stats_Line+=_T('2');
+ }
+
+ Ztring Audio_Errors_Count_Padded=Ztring::ToZtring(((float)Audio_Errors_Count)*100/((DSF_IsValid && DSF)?54:45)*(QU_FSC?2:1), 2);
+ if (Audio_Errors_Count_Padded.size()<2)
+ Audio_Errors_Count_Padded.insert(Audio_Errors_Count_Padded.begin(), 2-Audio_Errors_Count_Padded.size(), _T(' '));
+ if (ErrorsAreAlreadyDetected)
+ Errors_Stats_Line_Details+=_T(", ");
+ if (Audio_Errors_Count<(size_t)((QU_System?6:5)*9))
+ {
+ Errors_Stats_Line_Details+=_T("CH")+Ztring::ToZtring(Channel+1)+_T(": ")+Audio_Errors_Count_Padded+_T("%");
+ Audio_Errors_Details.resize(Audio_Errors_Details.size()-2);
+ Errors_Stats_Line_Details+=_T(" (")+Audio_Errors_Details+_T(")");
+ }
+ else
+ Errors_Stats_Line_Details+=_T("CH")+Ztring::ToZtring(Channel+1)+_T(": no valid DIF");
+
+ Speed_FrameCount_Audio_Errors[Channel]++;
+ ErrorsAreAlreadyDetected=true;
+ Errors_AreDetected=true;
+ }
+ }
+ if (!ErrorsAreAlreadyDetected)
+ Errors_Stats_Line+=_T(' ');
+ }
+ else
+ Errors_Stats_Line+=_T(' ');
+ Errors_Stats_Line+=_T('\t');
+ Errors_Stats_Line_Details+=_T('\t');
+
+ //Error 3: Timecode incoherency
+ if (Speed_TimeCode_Current.MultipleValues)
+ {
+ if (!Stats_Total_AlreadyDetected)
+ {
+ Stats_Total_AlreadyDetected=true;
+ Stats_Total++;
+ Stats_Total_WithoutArb++;
+ }
+ Stats[3]++;
+ Errors_Stats_Line+=_T('3');
+ Errors_Stats_Line_Details+=_T("Timecode incoherency, first detected value is used");
+ Speed_FrameCount_Timecode_Incoherency++;
+ Errors_AreDetected=true;
+ }
+ else
+ Errors_Stats_Line+=_T(' ');
+ Errors_Stats_Line+=_T('\t');
+ Errors_Stats_Line_Details+=_T('\t');
+
+ //Error 4: DIF order incoherency
+ if (Speed_Contains_NULL)
+ {
+ if (!Stats_Total_AlreadyDetected)
+ {
+ Stats_Total_AlreadyDetected=true;
+ Stats_Total++;
+ Stats_Total_WithoutArb++;
+ }
+ Stats[4]++;
+ Errors_Stats_Line+=_T('4');
+ Errors_Stats_Line_Details+=Ztring::ToZtring(Speed_Contains_NULL)+_T(" NULL DIFs");
+ Speed_FrameCount_Contains_NULL++;
+ Errors_AreDetected=true;
+ }
+ else
+ Errors_Stats_Line+=_T(' ');
+ Errors_Stats_Line+=_T('\t');
+ Errors_Stats_Line_Details+=_T('\t');
+
+ //Error 5: Speed_Arb_Current incoherency
+ if (Speed_Arb_Current.MultipleValues)
+ {
+ if (!Stats_Total_AlreadyDetected)
+ {
+ Stats_Total_AlreadyDetected=true;
+ Stats_Total++;
+ }
+ Stats[5]++;
+ Errors_Stats_Line+=_T('5');
+ Ztring Arb_Errors;
+ for (size_t Pos=0; Pos<16; Pos++)
+ if (Speed_Arb_Current.Value_Counters[Pos])
+ {
+ Arb_Errors+=Ztring::ToZtring(Speed_Arb_Current.Value_Counters[Pos]);
+ Arb_Errors+=_T(" Arb bit=\"");
+ Arb_Errors+=Ztring::ToZtring(Pos, 16);
+ Arb_Errors+=_T("\", ");
+ }
+ if (Arb_Errors.size()>2)
+ {
+ 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_Pos<Mpeg4_stts->size() && Speed_FrameCount-1>=Mpeg4_stts->at(Mpeg4_stts_Pos).Pos_Begin && Speed_FrameCount-1<Mpeg4_stts->at(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 (!Config->Event_CallBackFunction_IsSet())
+ {
+ Errors_Stats_10+=Errors_Stats_Line;
+ Errors_Stats_10+=Errors_Stats_Line_Details;
+ Errors_Stats_10+=_T("&");
+ }
+ #if MEDIAINFO_EVENTS
+ Event.Verbosity=10;
+ #endif //MEDIAINFO_EVENTS
+ }
+ if (Speed_FrameCount==1
+ || Status[IsFinished]
+ || Errors_AreDetected
+ || Infos_AreDetected
+ || Arb_AreDetected)
+ {
+ if (!Config->Event_CallBackFunction_IsSet())
+ {
+ Errors_Stats_09+=Errors_Stats_Line;
+ Errors_Stats_09+=Errors_Stats_Line_Details;
+ Errors_Stats_09+=_T("&");
+ }
+ #if MEDIAINFO_EVENTS
+ Event.Verbosity=9;
+ #endif //MEDIAINFO_EVENTS
+
+ if (Speed_FrameCount==1
+ || Status[IsFinished]
+ || Errors_AreDetected
+ || Infos_AreDetected)
+ {
+ if (!Config->Event_CallBackFunction_IsSet())
+ {
+ Errors_Stats_05+=Errors_Stats_Line;
+ Errors_Stats_05+=Errors_Stats_Line_Details;
+ Errors_Stats_05+=_T("&");
+ }
+ #if MEDIAINFO_EVENTS
+ Event.Verbosity=5;
+ #endif //MEDIAINFO_EVENTS
+
+ if (Speed_FrameCount==1
+ || Status[IsFinished]
+ || Errors_AreDetected)
+ {
+ if (!Config->Event_CallBackFunction_IsSet())
+ {
+ Errors_Stats_03+=Errors_Stats_Line;
+ Errors_Stats_03+=Errors_Stats_Line_Details;
+ Errors_Stats_03+=_T("&");
+ }
+ #if MEDIAINFO_EVENTS
+ 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((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(Errors_Count_Padded.begin(), 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(Errors_Count_Padded.begin(), 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(Errors_Count_Padded.begin(), 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(Errors_Count_Padded.begin(), 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; Pos<Speed_TimeStampsZ.size(); Pos++)
+ {
+ //Time
+ float64 Time_Offset=(Pos?Speed_TimeStampsZ[Pos-1].Last.FramePos:0)*1000/FrameRate;
+ Errors_Stats_End_Lines+=Ztring().Duration_From_Milliseconds((int64u)Time_Offset);
+
+ Errors_Stats_End_Lines+=_T("\t");
+
+ //TimeCode_range
+ Errors_Stats_End_Lines+=Speed_TimeStampsZ[Pos].First.TimeCode.empty()?Ztring(_T("XX:XX:XX:XX")):Speed_TimeStampsZ[Pos].First.TimeCode;
+
+ Errors_Stats_End_Lines+=_T(" - ");
+
+ Errors_Stats_End_Lines+=Speed_TimeStampsZ[Pos].Last.TimeCode.empty()?Ztring(_T("XX:XX:XX:XX")):Speed_TimeStampsZ[Pos].Last.TimeCode;
+
+ Errors_Stats_End_Lines+=_T("\t");
+
+ //Recorded date/time_range
+ Errors_Stats_End_Lines+=Speed_TimeStampsZ[Pos].First.Date.empty()?Ztring(_T("XXXX-XX-XX")):Speed_TimeStampsZ[Pos].First.Date;
+ Errors_Stats_End_Lines+=_T(' ');
+ Errors_Stats_End_Lines+=Speed_TimeStampsZ[Pos].First.Time.empty()?Ztring(_T("XX:XX:XX:XX")):Speed_TimeStampsZ[Pos].First.Time;
+
+ Errors_Stats_End_Lines+=_T(" - ");
+
+ Errors_Stats_End_Lines+=Speed_TimeStampsZ[Pos].Last.Date.empty()?Ztring(_T("XXXX-XX-XX")):Speed_TimeStampsZ[Pos].Last.Date;
+ Errors_Stats_End_Lines+=_T(' ');
+ Errors_Stats_End_Lines+=Speed_TimeStampsZ[Pos].Last.Time.empty()?Ztring(_T("XX:XX:XX:XX")):Speed_TimeStampsZ[Pos].Last.Time;
+
+ Errors_Stats_End_Lines+=_T("\t");
+
+ //Frame range
+ int64u Start=Pos?Speed_TimeStampsZ[Pos-1].Last.FramePos:0;
+ Ztring Start_Padded=Ztring::ToZtring(Start);
+ if (Start_Padded.size()<8)
+ Start_Padded.insert(Start_Padded.begin(), 8-Start_Padded.size(), _T(' '));
+
+ Errors_Stats_End_Lines+=Start_Padded;
+
+ int64u End=Speed_TimeStampsZ[Pos].Last.FramePos-1;
+ Ztring End_Padded=Ztring::ToZtring(End);
+ if (End_Padded.size()<8)
+ End_Padded.insert(End_Padded.begin(), 8-End_Padded.size(), _T(' '));
+ Errors_Stats_End_Lines+=_T(" - ")+End_Padded;
+
+ Errors_Stats_End_Lines+=_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();
+ }
+
+ //Stats
+ if (Stats_Total)
+ {
+ Errors_Stats_End_Lines+=_T("Percent of frames with Error: ");
+ Errors_Stats_End_Lines+=Ztring::ToZtring(((float)Stats_Total_WithoutArb*100)/Speed_FrameCount, 2);
+ Errors_Stats_End_Lines+=_T("%");
+ Errors_Stats_End_Lines+=_T('&');
+ Errors_Stats_End_Lines+=_T("Percent of frames with Error (including Arbitrary bit inconsistency): ");
+ Errors_Stats_End_Lines+=Ztring::ToZtring(((float)Stats_Total*100)/Speed_FrameCount, 2);
+ Errors_Stats_End_Lines+=_T("%");
+ Errors_Stats_End_Lines+=_T('&');
+
+ if (Stats[1])
+ {
+ Errors_Stats_End_Lines+=_T("Percent of frames with Video Error Concealment: ");
+ Errors_Stats_End_Lines+=Ztring::ToZtring(((float)Stats[1]*100)/Speed_FrameCount, 2);
+ Errors_Stats_End_Lines+=_T("%");
+ Errors_Stats_End_Lines+=_T('&');
+ }
+
+ if (Stats[2])
+ {
+ Errors_Stats_End_Lines+=_T("Percent of frames with Audio Errors: ");
+ Errors_Stats_End_Lines+=Ztring::ToZtring(((float)Stats[2]*100)/Speed_FrameCount, 2);
+ Errors_Stats_End_Lines+=_T("%");
+ Errors_Stats_End_Lines+=_T('&');
+ }
+
+ if (Stats[3])
+ {
+ Errors_Stats_End_Lines+=_T("Percent of frames with Timecode Incoherency: ");
+ Errors_Stats_End_Lines+=Ztring::ToZtring(((float)Stats[3]*100)/Speed_FrameCount, 2);
+ Errors_Stats_End_Lines+=_T("%");
+ Errors_Stats_End_Lines+=_T('&');
+ }
+
+ if (Stats[4])
+ {
+ Errors_Stats_End_Lines+=_T("Percent of frames with DIF Incoherency: ");
+ Errors_Stats_End_Lines+=Ztring::ToZtring(((float)Stats[4]*100)/Speed_FrameCount, 2);
+ Errors_Stats_End_Lines+=_T("%");
+ Errors_Stats_End_Lines+=_T('&');
+ }
+
+ if (Stats[5])
+ {
+ Errors_Stats_End_Lines+=_T("Percent of frames with Arbitrary bit inconsistency: ");
+ Errors_Stats_End_Lines+=Ztring::ToZtring(((float)Stats[5]*100)/Speed_FrameCount, 2);
+ Errors_Stats_End_Lines+=_T("%");
+ Errors_Stats_End_Lines+=_T('&');
+ }
+
+ if (Stats[6])
+ {
+ Errors_Stats_End_Lines+=_T("Percent of frames with Stts Fluctuation: ");
+ Errors_Stats_End_Lines+=Ztring::ToZtring(((float)Stats[6]*100)/Speed_FrameCount, 2);
+ Errors_Stats_End_Lines+=_T("%");
+ Errors_Stats_End_Lines+=_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();
+ }
+
+ //
+ if (Errors_Stats_End_03.size()>2)
+ 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
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Dvdv.cpp b/src/thirdparty/MediaInfo/Multiple/File_Dvdv.cpp
new file mode 100644
index 000000000..e04cca0a7
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Dvdv.cpp
@@ -0,0 +1,1542 @@
+// File_Dvdv - Info for DVD objects (IFO) files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about DVD objects
+// (.ifo files on DVD-Video)
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Mainly from http://dvd.sourceforge.net/dvdinfo/ifo.html
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include <vector>
+#ifdef SS
+ #undef SS //Solaris defines this somewhere
+#endif
+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(_BYTES, _ELEMENT) \
+ { \
+ Element_Begin(#_ELEMENT, _BYTES); \
+ _ELEMENT(); \
+ Element_End(); \
+ } \
+
+//---------------------------------------------------------------------------
+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_Info("DVD Video - VMG");
+ Element_Begin("Header", 0x100);
+ Info_B4(LastSector, "Last sector of VMG set (last sector of BUP)"); Param_Info((LastSector+1)*2048, " bytes");
+ Skip_XX(12, "Unknown");
+ Get_B4 (Sector_Pointer_LastSector, "last sector of IFO");
+ Get_B2 (Version, "version number"); Param_Info(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_End();
+
+ //-VTSM
+ VTS_Attributes_AreHere=true;
+ Element_Begin("VMGM (VMG for Menu)", 0x100);
+ Element_Begin("Video streams", 1*2);
+ Element_Info(1, " streams");
+ SUBELEMENT(2, Video)
+ Element_End();
+ Element_Begin("Audio streams", 8*8);
+ Get_B2 (Audio_Count, "number of audio streams in VMGM_VOBS");
+ Element_Info(Audio_Count, " streams");
+ for (int16u Pos=0; Pos<8; Pos++)
+ {
+ if (Pos<Audio_Count)
+ SUBELEMENT(8, Audio)
+ else
+ Skip_XX(8, "Reserved for Audio");
+ }
+ Skip_XX(16, "Unknown");
+ Element_End();
+ Element_Begin("Text streams", 1*6);
+ Get_B2 (Text_Count, "number of subpicture streams in VMGM_VOBS");
+ Element_Info(Text_Count, " streams");
+ for (int16u Pos=0; Pos<1; Pos++)
+ {
+ if (Pos<Text_Count)
+ SUBELEMENT(6, Text)
+ else
+ Skip_XX(6, "Reserved for Text");
+ }
+ Skip_XX(164, "Unknown");
+ Element_End();
+ Element_End();
+ Skip_XX(2048-Element_Offset, "Junk");
+
+ //Filling
+ FILLING_BEGIN();
+ Fill(Stream_General, 0, General_Format_Profile, "Menu");
+
+ if (Version>0x001F)
+ 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_Info("DVD Video - VTS (Video Title Set)");
+ Element_Begin("Header", 0x100);
+ Info_B4(LastSector, "Last sector of Title set (last sector of BUP)"); Param_Info((LastSector+1)*2048, " bytes");
+ Skip_XX(12, "Unknown");
+ Get_B4 (Sector_Pointer_LastSector, "last sector of IFO");
+ Get_B2 (Version, "version number"); Param_Info(Ztring::ToZtring((Version&0x00F0)>>4)+_T(".")+Ztring::ToZtring(Version&0x000F));
+ Info_B4(Category, "VTS category"); if (Category<2) Param_Info(IFO_VTS_Category[Category]);
+ 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_Info((StartSector_Menu+1)*2048, " bytes");
+ Info_B4(StartSector_Title, "start sector of Title Vob"); Param_Info((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_End();
+
+ //-VTSM
+ Element_Begin("VTSM (VTS for Menu, Vob 0)", 0x100);
+ Element_Begin("Video streams", 1*2);
+ Element_Info(1, " streams");
+ SUBELEMENT(2, Video)
+ Element_End();
+ Element_Begin("Audio streams", 8*8);
+ Get_B2 (Audio_Count, "number of audio streams in VTSM_VOBS");
+ Element_Info(Audio_Count, " streams");
+ for (int16u Pos=0; Pos<8; Pos++)
+ {
+ if (Pos<Audio_Count)
+ SUBELEMENT(8, Audio)
+ else
+ Skip_XX(8, "Reserved for Audio");
+ }
+ Skip_XX(16, "Unknown");
+ Element_End();
+ Element_Begin("Text streams", 1*6);
+ Get_B2 (Text_Count, "number of subpicture streams in VTSM_VOBS");
+ Element_Info(Text_Count, " streams");
+ for (int16u Pos=0; Pos<1; Pos++)
+ {
+ if (Pos<Text_Count)
+ SUBELEMENT(6, Text)
+ else
+ Skip_XX(6, "Reserved for Text");
+ }
+ Skip_XX(164, "Unknown");
+ Element_End();
+ Element_End();
+
+ //-VTS
+ VTS_Attributes_AreHere=true;
+ Element_Begin("VTS (VTS for movie, Vob 1-9)", 0x1D8);
+ Element_Begin("Video streams", 1*2);
+ Element_Info(1, " streams");
+ SUBELEMENT(2, Video)
+ Element_End();
+ Element_Begin("Audio streams", 8*8);
+ Get_B2 (Audio_Count, "number of audio streams in VMGM_VOBS");
+ Element_Info(Audio_Count, " streams");
+ for (int16u Pos=0; Pos<8; Pos++)
+ {
+ if (Pos<Audio_Count)
+ SUBELEMENT(8, Audio)
+ else
+ Skip_XX(8, "Reserved for Audio");
+ }
+ Skip_XX(16, "Unknown");
+ Element_End();
+ Element_Begin("Text streams", 32*6);
+ Get_B2 (Text_Count, "number of subpicture streams in VMGM_VOBS");
+ Element_Info(Text_Count, " streams");
+ for (int16u Pos=0; Pos<32; Pos++)
+ {
+ if (Pos<Text_Count)
+ SUBELEMENT(6, Text)
+ else
+ Skip_XX(6, "Reserved for Text");
+ }
+ Skip_XX(2, "Unknown");
+ Element_End();
+ Element_Begin("MultiChannel Info", 8*24);
+ Element_Info(Audio_Count, " streams");
+ for (int16u Pos=0; Pos<8; Pos++)
+ {
+ if (Pos<Audio_Count)
+ SUBELEMENT(24, MultiChannel)
+ else
+ Skip_XX(24, "Reserved for multichannel extension");
+ }
+ Element_End();
+ Element_End();
+ Skip_XX(2048-Element_Offset, "Junk");
+
+ //Filling
+ FILLING_BEGIN();
+ Fill(Stream_General, 0, General_Format_Profile, "Program");
+
+ if (Version>0x001F)
+ return;
+ 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_Info(IFO_CodecV[Codec]);
+ Get_BS (2, Standard, "Standard"); Param_Info(IFO_Standard[Standard]);
+ Get_BS (2, AspectRatio, "Aspect ratio"); Param_Info(IFO_AspectRatio[AspectRatio]);
+ Info_BS(1, Pan, "Automatic Pan/Scan"); Param_Info(Pan?"No":"Yes");
+ Info_BS(1, Letter, "Automatic Letterbox"); Param_Info(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_Info(Ztring::ToZtring(IFO_Width[Resolution])+_T("x")+Ztring::ToZtring(IFO_Height[Standard][Resolution]));
+ Info_BS(1, Letterboxed, "Letterboxed"); Param_Info(Letter?"Yes":"No");
+ Get_BS (1, BitRate_Mode, "Bitrate mode"); Param_Info(IFO_BitRate_Mode[BitRate_Mode]);
+ Info_BS(1, Camera, "Camera/Film"); Param_Info(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_Info(IFO_CodecA[Codec]);
+ Info_BS(1, MultiChannel, "Multichannel extension present"); Param_Info(MultiChannel?"Yes":"No");
+ Get_BS (2, LanguageType, "Language type"); Param_Info(LanguageType==1?"2CC":"Unknown");
+ Get_BS (2, Mode, "Application mode"); Param_Info(IFO_ModeA[Mode]);
+ Get_BS (2, Resolution, "Resolution"); if (Codec==2 || Codec==3) Param_Info(IFO_ResolutionA[Resolution]); else if (Codec==4) Param_Info(Mode?"DRC":"No DRC");
+ Get_BS (2, SamplingRate, "Sampling rate"); Param_Info(Ztring::ToZtring(IFO_SamplingRate[SamplingRate]));
+ Get_BS (4, Channels, "Channels"); Param_Info(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"); if (Language_Extension<8) Param_Info(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_Info(AC3_ChannelPositions[ChannelsK]);
+ #endif //MEDIAINFO_AC3_YES
+ Skip_BS(2, "Version");
+ Info_BS(1, MC, "MC intro present"); Param_Info(MC?"Yes":"No");
+ Info_BS(1, Duet, "Duet"); Param_Info(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_Info(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_Resolution, IFO_ResolutionA[Resolution]);
+ else if (Codec==4 && Mode)
+ Fill(Stream_Audio, StreamPos_Last, Audio_Resolution, "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_Info(IFO_CodecT[Codec]);
+ Skip_BS(3, "Reserved");
+ Get_BS (2, LanguageType, "Language type"); Param_Info(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"); if (Language_Extension<16) Param_Info(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_Resolution, 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_Begin("ACH0", 1);
+ Skip_BS(7, "Reserved");
+ Skip_BS(1, "ACH0 Guide Melody exists");
+ Element_End();
+ Element_Begin("ACH1", 1);
+ Skip_BS(7, "Reserved");
+ Skip_BS(1, "ACH1 Guide Melody exists");
+ Element_End();
+ Element_Begin("ACH2", 1);
+ 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_End();
+ Element_Begin("ACH3", 1);
+ 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_End();
+ Element_Begin("ACH4", 1);
+ 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_End();
+ 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() && Sectors[Sector_Pos+Sector_Count]==Sector_Nothing)
+ Sector_Count++;
+
+ //Filling
+ Header_Fill_Size(Sector_Count*2048);
+}
+
+//---------------------------------------------------------------------------
+void File_Dvdv::Data_Parse()
+{
+ //Parsing
+ size_t Sector_Pos=(size_t)((File_Offset+Buffer_Offset)/2048);
+ if (Sector_Pos>=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_Begin("Header", 8);
+ Skip_B2( "Count of elements");
+ Skip_B2( "Unknown");
+ Get_B4 (Element_RealSize, "End address");
+ Element_RealSize++; //Last byte
+ Element_End();
+ Element_Begin("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_End(Extra_Size);
+
+ //For each chapter
+ while (Element_Offset<Element_RealSize)
+ {
+ //VTS_PTT
+ int16u PGCN, PGN;
+ Element_Begin(4);
+ Get_B2 (PGCN, "Program Chain (PGCN)");
+ Get_B2 (PGN, "Program (PGN)");
+ Element_Name("Chapter"); Element_Info(Ztring::ToZtring(PGCN)); Element_Info(Ztring::ToZtring(PGN));
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Dvdv::VTS_PGCI ()
+{
+ Element_Name("Title Program Chain table");
+
+ //Parsing
+ int32u EndAddress;
+ Element_Begin("Header");
+ int32u Offset;
+ Skip_B2( "Number of Program Chains");
+ Skip_B2( "Reserved");
+ Get_B4 (EndAddress, "End address");
+ if (EndAddress>=Element_Size)
+ EndAddress=(int32u)Element_Size-1;
+ Element_Begin("PGC category", 4);
+ BS_Begin();
+ Skip_BS(1, "entry PGC");
+ Skip_BS(7, "title number");
+ BS_End();
+ Skip_B1( "Unknown");
+ Skip_B2( "parental management mask");
+ Element_End();
+ Get_B4 (Offset, "offset to VTS_PGC - relative to VTS_PGCI");
+ if (Offset-16>0)
+ Skip_XX(Offset-16, "Unknown");
+ Element_End(Offset);
+
+ //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_Begin("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_End(Offset);
+
+ for (int16u LU_Pos=0; LU_Pos<LU_Count; LU_Pos++)
+ {
+ Element_Begin("Language Unit");
+ int32u LU_Size;
+ int16u PGC_Count;
+ Element_Begin("Header");
+ Get_B2 (PGC_Count, "Number of Program Chains");
+ Skip_B2( "Reserved");
+ Get_B4 (LU_Size, "end address (last byte of last PGC in this LU) relative to VTSM_LU");
+ LU_Size++; //Last byte
+ Element_Begin("PGC category", 4);
+ int32u EntryPGC;
+ BS_Begin();
+ Get_BS (1, EntryPGC, "Entry PGC");
+ Skip_BS(3, "Unknown");
+ if (EntryPGC)
+ {
+ Info_BS(4, MenuType, "menu type"); Param_Info(IFO_MenuType[MenuType]);
+ }
+ else
+ {
+ Skip_BS(4, "Reserved");
+ }
+ BS_End();
+ Skip_B1( "Unknown");
+ Skip_B2( "parental management mask");
+ Element_End();
+ Get_B4 (Offset, "offset to VTSM_PGC relative to VTSM_LU");
+ if (Offset-16>0)
+ Skip_XX(Offset-16, "Unknown");
+ Element_End();
+ for (int16u PGC_Pos=0; PGC_Pos<PGC_Count; PGC_Pos++)
+ PGC(Element_Offset);
+
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Dvdv::VTS_TMAPTI ()
+{
+ Element_Name("Time map");
+
+ //Parsing
+ Element_Begin("Header", 8);
+ int32u EndAddress, Offset;
+ Skip_B2( "Number of program chains");
+ Skip_B2( "Reserved");
+ Get_B4 (EndAddress, "End address");
+ if (EndAddress>=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_End();
+
+ //DETAILLEVEL_SET(1.0);
+ while (Element_Offset<=EndAddress)
+ {
+ //VTS_TMAP
+ Element_Begin("Time Map");
+ //std::vector<size_t> 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<Count; Pos++)
+ {
+ Element_Begin("Sector Offset", 4);
+ int32u SectorOffset;
+ Skip_BS( 1, "discontinuous with previous");
+ Get_BS (31, SectorOffset, "Sector offset within VOBS of nearest VOBU");
+ //Get_B4 (Sector_Times[Pos], Sector offset within VOBS of nearest VOBU);// Param_Info(Ztring().Duration_From_Milliseconds((Pos+1)*Sectors_Times_SecondsPerTime[Program_Pos]));
+ //Sector_Times[Pos]&=0x7FFFFFFF; //bit 31 is set if VOBU time codes are discontinuous with previous
+ Element_Info(SectorOffset);
+ Element_End();
+ }
+ BS_End();
+ Element_End();
+
+ //Filling
+ //Sectors_Times.push_back(Sector_Times);
+ //Sectors_Times_SecondsPerTime.push_back(Sector_Times_SecondsPerTime);
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Dvdv::VTSM_C_ADT ()
+{
+ Element_Name("Menu cell address table");
+
+ //Parsing
+ int32u EndAddress;
+ Element_Begin("Header", 8);
+ Skip_B2( "Number of cells");
+ Skip_B2( "Reserved");
+ Get_B4 (EndAddress, "End address");
+ if (EndAddress>=Element_Size)
+ EndAddress=(int32u)Element_Size-1;
+ Element_End();
+
+ //DETAILLEVEL_SET(1.0);
+ while (Element_Offset<=EndAddress)
+ {
+ //ADT
+ Element_Begin("Entry", 12);
+ Skip_B2( "VOBidn");
+ Skip_B1( "CELLidn");
+ Skip_B1( "Unknown");
+ Skip_B4( "Starting sector within VOB");
+ Skip_B4( "Ending sector within VOB");
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Dvdv::VTSM_VOBU_ADMAP ()
+{
+ Element_Name("Menu VOBU address map");
+
+ //Parsing
+ int32u EndAddress;
+ Element_Begin("Header", 4);
+ Get_B4 (EndAddress, "End address");
+ if (EndAddress>=Element_Size)
+ EndAddress=(int32u)Element_Size-1;
+ Element_End();
+
+ //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_Begin("Header", 8);
+ Skip_B2( "Number of cells");
+ Skip_B2( "Reserved");
+ Get_B4 (EndAddress, "End address");
+ if (EndAddress>=Element_Size)
+ EndAddress=(int32u)Element_Size-1;
+ Element_End();
+
+ //DETAILLEVEL_SET(1.0);
+ while (Element_Offset<=EndAddress)
+ {
+ //ADT
+ Element_Begin("Entry", 12);
+ 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_Info(Time_ADT(Start));
+ Get_B4 (End, "Ending sector within VOB"); Param_Info(Time_ADT(End));
+ Element_End();
+
+ //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_Begin("Header", 4);
+ Get_B4 (EndAddress, "End address");
+ if (EndAddress>=Element_Size)
+ EndAddress=(int32u)Element_Size-1;
+ Element_End();
+
+ //DETAILLEVEL_SET(1.0);
+ while (Element_Offset<Element_Size)
+ {
+ //ADMAP
+ Skip_B4( "Starting sector within VOB of first VOBU");
+ }
+}
+
+//***************************************************************************
+// Helpers
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+Ztring File_Dvdv::Time_ADT(int32u)
+{
+ return Ztring();
+ /*
+ if (Sectors_Times.empty())
+ return Ztring(); //TODO: it can be empty?
+
+ while (Time_Pos<Sectors_Times[Program_Pos].size() && Sectors_Times[Program_Pos][Time_Pos]<Value)
+ Time_Pos++;
+ if (Time_Pos<Sectors_Times[Program_Pos].size())
+ {
+ int32u Time=(Time_Pos+1)*Sectors_Times_SecondsPerTime[Program_Pos]*1000;
+ float32 Part;
+ //True time is between Time and Time+Sectors_Times_SecondsPerTime, finding where...
+ int32u Sectors_Count;
+ if (Time_Pos==0)
+ Sectors_Count=Sectors_Times[Program_Pos][Time_Pos];
+ else
+ Sectors_Count=Sectors_Times[Program_Pos][Time_Pos]-Sectors_Times[Program_Pos][Time_Pos-1];
+ Part=(Sectors_Times[Program_Pos][Time_Pos]-Value); //Count of more sectors after
+ Part/=Sectors_Count; //Percentage
+ Time=(int32u)((Time_Pos+1-Part)*Sectors_Times_SecondsPerTime[Program_Pos]*1000);
+
+ return Ztring().Duration_From_Milliseconds(Time*1000);
+ }
+ else
+ {
+ int32u Time=(Time_Pos+1)*Sectors_Times_SecondsPerTime[Program_Pos]*1000;
+ float32 Part;
+ //True time is between Time and Time+Sectors_Times_SecondsPerTime, finding where... but with the last offset diffrence
+ int32u Sectors_Count=Sectors_Times[Program_Pos][Time_Pos-1]-Sectors_Times[Program_Pos][Time_Pos-2];
+ Part=((int32s)Sectors_Times[Program_Pos][Time_Pos-1])-((int32s)Value); //Count of more sectors after
+ Part/=Sectors_Count; //Percentage
+ Part+=1; //We were one offset less
+ Time=(int32u)((Time_Pos+1-Part)*Sectors_Times_SecondsPerTime[Program_Pos]*1000);
+
+ return Ztring().Duration_From_Milliseconds(Time*1000);
+ }
+ */
+}
+
+void File_Dvdv::Time_BCD(const Ztring &Name)
+{
+ int32u FrameRate, FF;
+ int8u HH, MM, SS;
+ Element_Begin(Name, 4);
+ Get_B1 (HH, "hh (BCD)");
+ Get_B1 (MM, "mm (BCD)");
+ Get_B1 (SS, "ss (BCD)");
+ BS_Begin();
+ Get_BS (2, FrameRate, "framerate (BCD)"); Param_Info(IFO_PlaybackTime_FrameRate[FrameRate], " fps");
+ Get_BS (6, FF, "ff (BCD)");
+ BS_End();
+ Time_String=Ztring::ToZtring(HH, 16)+_T(":") //BCD
+ + Ztring::ToZtring(MM, 16)+_T(":") //BCD
+ + Ztring::ToZtring(SS, 16)+_T(".") //BCD
+ + Ztring::ToZtring(Ztring::ToZtring(FF, 16).To_int32u()*1000/IFO_PlaybackTime_FrameRate[FrameRate], 10); //BCD
+ Element_Info(Time_String);
+ Element_End();
+}
+
+void File_Dvdv::PGC(int64u Offset, bool Title)
+{
+ vector<int8u> Stream_Control_Audio;
+ vector<int8u> Stream_Control_SubPicture_43;
+ vector<int8u> Stream_Control_SubPicture_Wide;
+ vector<int8u> Stream_Control_SubPicture_Letterbox;
+ vector<int8u> Stream_Control_SubPicture_PanScan;
+
+ //VTS_PGC
+ Element_Begin("PGC");
+ int16u commands, program_map, cell_playback, cell_position;
+ int8u Program_Count;
+ Element_Begin("Header", 236);
+ int32u Flags;
+ int8u Cells;
+ Skip_B2( "Unknown");
+ Get_B1 (Program_Count, "number of programs");
+ Get_B1 (Cells, "number of cells");
+ Time_BCD("playback time");
+ 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_Begin("Audio Stream Controls", 8*2);
+ for (size_t Pos=0; Pos<8; Pos++)
+ {
+ Element_Begin("Audio Stream Control", 2);
+ Element_Info(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_End();
+ 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_End();
+ Element_Begin("Subpicture Stream Controls", 32*4);
+ for (size_t Pos=0; Pos<32; Pos++)
+ {
+ Element_Begin("Subpicture Stream Control", 4);
+ Element_Info(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_End();
+ 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_End();
+ 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_Begin("palette", 16*4);
+ for (int Pos=0; Pos<16; Pos++)
+ {
+ Skip_B4( "palette (0 - Y - Cr - Cb)");
+ }
+ Element_End();
+ 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_End();
+
+ //commands
+ if (commands>0)
+ {
+ if (Element_Offset<Offset+commands)
+ Skip_XX(Offset+commands-Element_Offset, "Unknown");
+ Element_Begin("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_Begin("Pre commands", PreCommands_Count*8);
+ for (int16u Pos=0; Pos<PreCommands_Count; Pos++)
+ {
+ Element_Begin("Pre command", 8);
+ Skip_XX(8, "Pre command");
+ Element_End();
+ }
+ Element_End();
+ }
+ if (PostCommands_Count>0)
+ {
+ Element_Begin("Post commands", PreCommands_Count*8);
+ for (int16u Pos=0; Pos<PreCommands_Count; Pos++)
+ {
+ Element_Begin("Post command", 8);
+ Skip_XX(8, "Post command");
+ Element_End();
+ }
+ Element_End();
+ }
+ if (CellCommands_Count>0)
+ {
+ Element_Begin("Cell commands", PreCommands_Count*8);
+ for (int16u Pos=0; Pos<PreCommands_Count; Pos++)
+ {
+ Element_Begin("Cell command", 8);
+ Skip_XX(8, "Cell command");
+ Element_End();
+ }
+ Element_End();
+ }
+ Element_End(EndAdress+1);
+ }
+
+ //program map
+ if (program_map>0)
+ {
+ if (Element_Offset<Offset+program_map)
+ Skip_XX(Offset+program_map-Element_Offset, "Unknown");
+ Element_Begin("program map", Program_Count*1);
+ for (int8u Pos=0; Pos<Program_Count; Pos++)
+ {
+ Element_Begin("Entry", 8);
+ Skip_B1( "Entry cell number");
+ Element_End();
+ }
+ Element_End();
+ }
+
+ //cell playback
+ if (cell_playback>0)
+ {
+ if (Element_Offset<Offset+cell_playback)
+ Skip_XX(Offset+cell_playback-Element_Offset, "Unknown");
+ Element_Begin("cell playback", Cells*24);
+ for (int8u Pos=0; Pos<Cells; Pos++)
+ {
+ Element_Begin("cell", 24);
+ Skip_XX(4, "ToDo");
+ Time_BCD("Time");
+ Skip_B4( "first VOBU start sector");
+ Skip_B4( "first ILVU end sector");
+ Skip_B4( "last VOBU start sector");
+ Skip_B4( "last VOBU end sector");
+ Element_Info(Ztring::ToZtring(Pos)); Element_Info(Time_String);
+ Element_End();
+ }
+ Element_End();
+ }
+
+ //cell position
+ if (cell_position>0)
+ {
+ if (Element_Offset<Offset+cell_position)
+ Skip_XX(Offset+cell_position-Element_Offset, "Unknown");
+ Element_Begin("cell position", Cells*4);
+ for (int8u Pos=0; Pos<Cells; Pos++)
+ {
+ Element_Begin("cell", 4);
+ Skip_B2( "VOBid");
+ Skip_B1( "reserved");
+ Skip_B1( "Cell id");
+ Element_End();
+ }
+ Element_End();
+ }
+
+ Element_End(Element_Offset-Offset);
+
+ //FILLING_BEGIN();
+ if (Title)
+ {
+ Stream_Prepare(Stream_Menu);
+ for (size_t Pos=0; Pos<Stream_Control_Audio.size(); Pos++)
+ {
+ Fill(StreamKind_Last, StreamPos_Last, "List (Audio)", Stream_Control_Audio[Pos]);
+ }
+ for (size_t Pos=0; Pos<Stream_Control_SubPicture_43.size(); Pos++)
+ {
+ Fill(StreamKind_Last, StreamPos_Last, "List (Subtitles 4/3)", Stream_Control_SubPicture_43[Pos]);
+ }
+ for (size_t Pos=0; Pos<Stream_Control_SubPicture_Wide.size(); Pos++)
+ {
+ Fill(StreamKind_Last, StreamPos_Last, "List (Subtitles Wide)", Stream_Control_SubPicture_Wide[Pos]);
+ }
+ for (size_t Pos=0; Pos<Stream_Control_SubPicture_Letterbox.size(); Pos++)
+ {
+ Fill(StreamKind_Last, StreamPos_Last, "List (Subtitles Letterbox)", Stream_Control_SubPicture_Letterbox[Pos]);
+ }
+ for (size_t Pos=0; Pos<Stream_Control_SubPicture_PanScan.size(); Pos++)
+ {
+ Fill(StreamKind_Last, StreamPos_Last, "List (Subtitles Pan&Scan)", Stream_Control_SubPicture_PanScan[Pos]);
+ }
+ }
+ //FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Dvdv::TT_SRPT()
+{
+ Element_Name("table of titles");
+}
+
+//---------------------------------------------------------------------------
+void File_Dvdv::VMGM_PGCI_UT()
+{
+ Element_Name("Menu Program Chain table");
+}
+
+//---------------------------------------------------------------------------
+void File_Dvdv::VMG_PTL_MAIT()
+{
+ Element_Name("Parental Management masks");
+}
+
+//---------------------------------------------------------------------------
+void File_Dvdv::VMG_VTS_ATRT()
+{
+ Element_Name("copies of VTS audio/sub-picture attributes");
+
+ //Parsing
+ int32u EndAddress;
+ Element_Begin("Header");
+ int32u Offset;
+ Skip_B4( "Number of title sets");
+ Get_B4 (EndAddress, "End address");
+ if (EndAddress>=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_End(Offset);
+
+ while (Element_Offset<=EndAddress)
+ {
+ Element_Begin("VTS_ATRT");
+ Element_Begin("Header", 4);
+ int32u Size;
+ Get_B4 (Size, "End adress");
+ Size++; //Last byte
+ Element_End();
+ Element_Begin("Copy of VTS Category", 4);
+ Skip_B4( "VTS Category");
+ Element_End();
+ Element_Begin("Copy of VTS attributes", Size-8);
+ Skip_XX(Size-8, "VTS attributes");
+ Element_End();
+ Element_End(Size);
+ }
+}
+
+//---------------------------------------------------------------------------
+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
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Dvdv.h b/src/thirdparty/MediaInfo/Multiple/File_Dvdv.h
new file mode 100644
index 000000000..afe1c3bf9
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Dvdv.h
@@ -0,0 +1,129 @@
+// File_Dvdv - Info for DVD objects (IFO) files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about DVD objects
+// (.ifo files on DVD-Video)
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_DvdvH
+#define MediaInfo_File_DvdvH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include <map>
+//---------------------------------------------------------------------------
+
+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<size_t> Sectors;
+ //std::vector<std::vector<size_t> > Sectors_Times;
+ //std::vector<int8u> 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<sector> Sectors;
+
+ //Helpers
+ Ztring Time_ADT(int32u Value);
+ size_t Program_Pos;
+ size_t Time_Pos;
+ void Time_BCD(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
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Flv.cpp b/src/thirdparty/MediaInfo/Multiple/File_Flv.cpp
new file mode 100644
index 000000000..11c262cdc
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Flv.cpp
@@ -0,0 +1,1311 @@
+// File_Flv - Info for Flash files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+//
+// Examples:
+// http://samples.mplayerhq.hu/FLV/
+//
+// Reverse engineering
+// http://osflash.org/documentation/amf/astypes
+//
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_MPEG4_YES)
+ #include "MediaInfo/Audio/File_Mpeg4_AudioSpecificConfig.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
+#if MEDIAINFO_EVENTS
+ #include "MediaInfo/MediaInfo_Events.h"
+#endif //MEDIAINFO_EVENTS
+#include <algorithm>
+//---------------------------------------------------------------------------
+
+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[]=
+{
+ "PCM",
+ "ADPCM",
+ "MPEG Audio",
+ "PCM",
+ "Nellymoser",
+ "Nellymoser",
+ "Nellymoser",
+ "ADPCM",
+ "ADPCM",
+ "",
+ "AAC",
+ "Speex",
+ "",
+ "",
+ "MPEG Audio",
+ "",
+};
+
+const char* Flv_Format_Profile_Audio[]=
+{
+ "",
+ "",
+ "Version 1 / Layer 3",
+ "",
+ "",
+ "",
+ "",
+ "A-law",
+ "U-law",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "Layer 3",
+ "",
+};
+
+const char* Flv_Codec_Audio[]=
+{
+ "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_Format_Video[]=
+{
+ "",
+ "",
+ "H.263",
+ "Screen video",
+ "VP6",
+ "VP6",
+ "Screen video 2",
+ "AVC",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+};
+
+const char* Flv_Format_Profile_Video[]=
+{
+ "",
+ "",
+ "",
+ "",
+ "",
+ "Alpha channel",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+};
+
+const char* Flv_Codec_Video[]=
+{
+ "",
+ "",
+ "Sorenson H263",
+ "Screen video",
+ "On2 VP6",
+ "On2 VP6 with alpha channel",
+ "Screen video 2",
+ "AVC",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+};
+
+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
+
+ //Internal
+ Stream.resize(3); //Null, Video, Audio
+
+ //Temp
+ Searching_Duration=false;
+ PreviousTagSize=(int32u)-1;
+ meta_filesize=(int64u)-1;
+ meta_duration=0;
+ FirstFrame_Time=(int32u)-1;
+ FirstFrame_Type=(int8u)-1;
+ LastFrame_Time=(int32u)-1;
+ LastFrame_Type=(int8u)-1;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Flv::Streams_Finish()
+{
+ //Trying to detect VFR
+ std::vector<int64u> video_stream_FrameRate_Between;
+ for (size_t Pos=1; Pos<video_stream_FrameRate.size(); Pos++)
+ video_stream_FrameRate_Between.push_back(video_stream_FrameRate[Pos]-video_stream_FrameRate[Pos-1]);
+ std::sort(video_stream_FrameRate_Between.begin(), video_stream_FrameRate_Between.end());
+ if (!video_stream_FrameRate_Between.empty())
+ {
+ if (video_stream_FrameRate_Between[0]*0.9<video_stream_FrameRate_Between[video_stream_FrameRate_Between.size()-1]
+ && video_stream_FrameRate_Between[0]*1.1>video_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)
+ {
+ 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);
+
+ //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_Resolution); //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);
+ 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);
+
+ //Duration
+ int64u Duration_Final=(int64u)meta_duration;
+ 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)
+ {
+ Fill(Stream_General, 0, General_Duration, Duration_Final, 10, true);
+ 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_Audio<BitRate_Video_Duration)
+ BitRate_Video_Duration-=BitRate_Audio;
+ else if (BitRate_Audio)
+ BitRate_Video_Duration=0; //There is a problem
+ }
+ if (BitRate_Video_Meta<BitRate_Video_Duration/2 || BitRate_Video_Meta>BitRate_Video_Duration*2)
+ Clear(Stream_Video, 0, Video_BitRate);
+ }
+ }
+
+ //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_Flv::FileHeader_Parse()
+{
+ //Parsing
+ Element_Begin("FLV header");
+ std::string Signature;
+ int32u Size;
+ int8u Version, Flags;
+ Get_String(3, Signature, "Signature");
+ Get_B1 (Version, "Version");
+ Get_B1 (Flags, "Flags");
+ Get_Flags (Flags, 0, video_stream_Count, "Video");
+ Get_Flags (Flags, 2, audio_stream_Count, "Audio");
+ Get_B4 (Size, "Size");
+ if (Size>9)
+ Skip_XX(Size-9, "Unknown");
+ Element_End();
+
+ 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)
+ {
+ 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();
+}
+
+//---------------------------------------------------------------------------
+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");
+ Header_Fill_Size(4);
+ return;
+ }
+
+ //Parsing
+ int32u BodyLength;
+ int8u Type;
+ Get_B4 (PreviousTagSize, "PreviousTagSize");
+ if (File_Offset+Buffer_Offset+4<File_Size)
+ {
+ int32u Timestamp_Base;
+ int8u Timestamp_Extended;
+ Get_B1 (Type, "Type"); //Param_Info(Type<19?Flv_Type[Type]:_T("Unknown"));
+ Get_B3 (BodyLength, "BodyLength");
+ Get_B3 (Timestamp_Base, "Timestamp_Base"); //in ms
+ Get_B1 (Timestamp_Extended, "Timestamp_Extended"); //TimeStamp = Timestamp_Extended*0x01000000+Timestamp_Base
+ Skip_B3( "StreamID");
+
+ //Filling
+ Time=(((int32u)Timestamp_Extended)<<24)|Timestamp_Base;
+ if (FirstFrame_Time==(int32u)-1 && (Type==0x08 || Type==0x09))
+ {
+ FirstFrame_Time=Time;
+ FirstFrame_Type=Type;
+ }
+ if (File_Offset+Buffer_Offset+Element_Offset+BodyLength+4==File_Size && Time!=0)
+ {
+ LastFrame_Time=Time;
+ LastFrame_Type=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 : GoTo(File_Size-PreviousTagSize-8, "FLV"); return; //When searching the last frame
+ default : if (Searching_Duration)
+ {
+ Finish(); //This is surely a bad en of file, don't try anymore
+ return;
+ }
+
+ }
+
+ if (!video_stream_Count && !audio_stream_Count && video_stream_FrameRate_Detected && MediaInfoLib::Config.ParseSpeed_Get()<1) //All streams are parsed
+ {
+ if (!Searching_Duration && (meta_filesize==(int64u)-1 || meta_filesize==0 || meta_filesize==File_Size) && Element_Code!=0x00 &&!MediaInfoLib::Config.ParseSpeed_Get()!=1)
+ {
+ //Trying to find the last frame for duration
+ Searching_Duration=true;
+ GoToFromEnd(4, "FLV");
+ }
+ else
+ Finish();
+ }
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Flv::video()
+{
+ Element_Name("Video");
+ Stream[Stream_Video].PacketCount++;
+ Element_Info(Stream[Stream_Video].PacketCount);
+
+ //Handling FrameRate
+ if (!video_stream_FrameRate_Detected)
+ {
+ if (video_stream_FrameRate.empty() || Time!=video_stream_FrameRate[video_stream_FrameRate.size()-1]) //if 2 block witht the same timestamp
+ video_stream_FrameRate.push_back(Time);
+ if (video_stream_FrameRate.size()>30)
+ video_stream_FrameRate_Detected=true;
+ }
+
+ //Needed?
+ if (!video_stream_Count)
+ return; //No more need of Video stream
+
+ if (Element_Size==0) //Header says that video is present, but there is only one null packet
+ {
+ Element_Info("Null");
+ return;
+ }
+
+ //Delay
+ if (Stream[Stream_Video].Delay==(int32u)-1)
+ Stream[Stream_Video].Delay=Time;
+
+ Demux(Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset), ContentType_MainStream);
+
+ //Parsing
+ int8u Codec, FrameType;
+ Element_Begin("Stream header");
+ BS_Begin();
+ Get_S1 (4, FrameType, "frameType"); Param_Info(Flv_FrameType[FrameType]);
+ Get_S1 (4, Codec, "codecID"); Param_Info(Flv_Codec_Video[Codec]); Element_Info(Flv_Codec_Video[Codec]);
+ BS_End();
+ Element_End();
+
+ if (Stream[Stream_Video].PacketCount==60) //2s
+ {
+ video_stream_Count=false;
+ return;
+ }
+
+ FILLING_BEGIN();
+ //Filling
+ if (Retrieve(Stream_Video, 0, Video_Format).empty())
+ {
+ if (Count_Get(Stream_Video)==0)
+ Stream_Prepare(Stream_Video);
+ if (Codec<8)
+ {
+ 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]);
+ }
+ }
+
+ //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_Info(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_Info(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_Info((BlockWidth+1)*16);
+ Get_S2 (12, Width, "ImageWidth");
+ Info_S1( 4, BlockHeight, "BlockHeight"); Param_Info((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_Info(Flv_VP6_FrameMode[FrameMode]);
+ Skip_S1( 6, "Quantization");
+ Get_SB ( Marker, "Marker"); Param_Info(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_Info(Ztring::ToZtring(Height*16)+_T(" pixels"));
+ Get_B1 (Width, "Width"); Param_Info(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_Info(Flv_AVCPacketType(AVCPacketType));
+ Info_B3(CompositionTime, "CompositionTime"); Param_Info(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)
+ 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_Info(Stream[Stream_Audio].PacketCount);
+
+ //Needed?
+ if (!audio_stream_Count)
+ return; //No more need of Audio stream
+
+ if (Element_Size==0) //Header says that audio is present, but there is only one null packet
+ {
+ Element_Info("Null");
+ return;
+ }
+
+ //Delay
+ if (Stream[Stream_Audio].Delay==(int32u)-1)
+ Stream[Stream_Audio].Delay=Time;
+
+ Demux(Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset), ContentType_MainStream);
+
+ //Parsing
+ int8u codec, sampling_rate;
+ bool is_16bit, is_stereo;
+ Element_Begin("Stream header");
+ BS_Begin();
+ Get_S1 (4, codec, "codec"); Param_Info(Flv_Codec_Audio[codec]); Element_Info(Flv_Codec_Audio[codec]);
+ Get_S1 (2, sampling_rate, "sampling_rate"); Param_Info(Ztring::ToZtring(Flv_SamplingRate[sampling_rate])+_T(" Hz"));
+ Get_SB ( is_16bit, "is_16bit"); Param_Info(Ztring::ToZtring(Flv_Resolution[is_16bit])+_T(" bits"));
+ Get_SB ( is_stereo, "is_stereo"); Param_Info(Ztring::ToZtring(Flv_Channels[is_stereo])+_T(" channel(s)"));
+ BS_End();
+ Element_End();
+
+ //Special case
+ if (codec==5) //Nellymoser 8kHz mono
+ {
+ sampling_rate=5; //8000 Hz forced
+ is_stereo=false; //Mono forced
+ }
+
+ if (Stream[Stream_Audio].PacketCount==60) //2s
+ {
+ audio_stream_Count=false;
+ return;
+ }
+
+ 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);
+ Fill(Stream_Audio, 0, Audio_Resolution, 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]);
+ 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");
+
+ }
+ }
+
+ //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_Info(Flv_AACPacketType(AACPacketType));
+
+ switch (AACPacketType)
+ {
+ case 0 :
+ #if defined(MEDIAINFO_MPEG4_YES)
+ if (Stream[Stream_Audio].Parser==NULL)
+ {
+ Stream[Stream_Audio].Parser=new File_Mpeg4_AudioSpecificConfig;
+ Open_Buffer_Init(Stream[Stream_Audio].Parser);
+ }
+
+ //Parsing
+ Open_Buffer_Continue(Stream[Stream_Audio].Parser);
+
+ //Disabling this stream
+ audio_stream_Count=false;
+ #else
+ Skip_XX(Element_Size-Element_Offset, "AAC Data");
+ audio_stream_Count=false; //Unable to parse it
+ #endif
+ break;
+ case 1 :
+ Skip_XX(Element_Size-Element_Offset, "AAC Data");
+ audio_stream_Count=false; //Unable to parse it
+ 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();
+}
+
+//---------------------------------------------------------------------------
+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_Begin();
+ Get_B2 (StringLength, "StringLength");
+ Get_String(StringLength, StringData, "StringData");
+ Element_Name(StringData.c_str());
+
+ //Parsing Value
+ meta_SCRIPTDATAVALUE(StringData);
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Flv::meta_SCRIPTDATAVALUE(const std::string &StringData)
+{
+ //Parsing
+ int8u Type;
+ Get_B1 (Type, "Type"); if (Type<0x12) Param_Info(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 (0) ;
+ else if (StringData=="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 (StringData=="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 (StringData=="duration") meta_duration=Value*1000;
+ else if (StringData=="audiodatarate") {ToFill="BitRate"; StreamKind=Stream_Audio; ValueS.From_Number(Value*1000, 0);}
+ else if (StringData=="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 (StringData=="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 (StringData=="datasize") {}
+ else if (StringData=="lasttimestamp") {}
+ else if (StringData=="filesize") {meta_filesize=(int64u)Value;}
+ else if (StringData=="audiosize") {ToFill="StreamSize"; StreamKind=Stream_Audio; ValueS.From_Number(Value, 0);}
+ else if (StringData=="videosize") {ToFill="StreamSize"; 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 (StringData=="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 (StringData=="lastkeyframetimestamp") {}
+ else if (StringData=="lastkeyframelocation") {}
+ else if (StringData=="videocodecid") {; video_stream_Count=true;} //1 file with FrameRate tag and video stream but no video present tag
+ else if (StringData=="audiocodecid") {}
+ else if (StringData=="audiodelay") {ToFill="Delay"; StreamKind=Stream_Audio; if (Value>0) ValueS.From_Number(Value*1000, 0);}
+ else if (StringData=="canSeekToEnd") {}
+ else if (StringData=="keyframes_times") {}
+ else if (StringData=="keyframes_filepositions") {}
+ else if (StringData=="audiosamplerate") {ToFill="SamplingRate"; StreamKind=Stream_Audio; if (Value>0) ValueS.From_Number(Value, 0);}
+ else if (StringData=="audiosamplesize") {ToFill="Resolution"; StreamKind=Stream_Audio; if (Value>0) ValueS.From_Number(Value, 0);}
+ else if (StringData=="totalduration") {ToFill="Duration"; StreamKind=Stream_General; ValueS.From_Number(Value*1000, 0);}
+ else if (StringData=="totaldatarate") {ToFill="OverallBitRate"; StreamKind=Stream_General; ValueS.From_Number(Value*1000, 0);}
+ else if (StringData=="bytelength") {} //TODO: should test in order to see if file is complete
+ else {StreamKind=Stream_General; ToFill=StringData; ValueS.From_Number(Value);}
+ if (!ValueS.empty()) Element_Info(ValueS);
+ Fill(StreamKind, 0, ToFill.c_str(), ValueS);
+ if (ToFill=="FrameRate")
+ Fill(StreamKind, 0, "FrameRate_Mode", "CFR");
+ }
+ break;
+ case 0x01 : //UI8
+ {
+ int8u Value;
+ Get_B1 (Value, "Value");
+ std::string ToFill;
+ if (0) ;
+ else if (StringData=="haskeyframes") {}
+ else if (StringData=="hasKeyframes") {}
+ else if (StringData=="hasVideo") {}
+ else if (StringData=="stereo") {}
+ else if (StringData=="canSeekToEnd") {}
+ else if (StringData=="hasAudio") {}
+ else if (StringData=="hasmetadata") {}
+ else if (StringData=="hasMetadata") {}
+ else if (StringData=="hasCuePoints") {}
+ else if (StringData=="canseekontime") {}
+ else {ToFill=StringData;}
+ Element_Info(Value);
+ Fill(Stream_General, 0, ToFill.c_str(), Value?"Yes":"No");
+ }
+ 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 (0) ;
+ else if (StringData=="creator") {ToFill=General_Encoded_Application;}
+ else if (StringData=="creationdate") {ToFill=General_Encoded_Date; Value.Date_From_String(Value.To_UTF8().c_str());}
+ else if (StringData=="encoder") {ToFill=General_Encoded_Application;}
+ else if (StringData=="Encoded_With") {ToFill=General_Encoded_Application;}
+ else if (StringData=="Encoded_By") {ToFill=General_Encoded_Application;}
+ else if (StringData=="metadatacreator") {ToFill=General_Tagged_Application;}
+ else if (StringData=="sourcedata") {}
+ else
+ 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_Info(Value);
+ if (ToFill!=(size_t)-1)
+ Fill(Stream_General, 0, ToFill, Value);
+ else if (!ToFillS.empty())
+ Fill(Stream_General, 0, StringData.c_str(), Value);
+ }
+ }
+ 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_Begin();
+ Get_B2 (StringLength2, "StringLength2");
+ Get_String(StringLength2, StringData2, "StringData2");
+ Element_Name(StringData2.empty()?"EndOfObject":StringData2.c_str());
+ meta_SCRIPTDATAVALUE(StringData+'_'+StringData2);
+ Element_End();
+ }
+ 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();
+ if (!Value.empty()) Element_Info(Value);
+ Fill(Stream_General, 0, StringData.c_str(), Value);
+ }
+ }
+ break;
+ case 0x05 : //NULL
+ case 0x06 : //Undefined - NULL
+ case 0x0D : //Unsupported - NULL
+ break;
+ case 0x07 : //UI16
+ {
+ int16u Value;
+ Get_B2 (Value, "Value");
+ Element_Info(Value);
+ Fill(Stream_General, 0, StringData.c_str(), Value);
+ }
+ break;
+ case 0x08 : //SCRIPTDATAVARIABLE[ECMAArrayLength]
+ {
+ int32u ECMAArrayLength;
+ Get_B4 (ECMAArrayLength, "ECMAArrayLength");
+ Element_Info(Ztring::ToZtring(ECMAArrayLength)+_T(" elements"));
+ for (int32u Pos=0; Pos<ECMAArrayLength; Pos++)
+ {
+ meta_SCRIPTDATAVARIABLE();
+ if (meta_LevelFinished[meta_Level])
+ Pos=ECMAArrayLength; //Finished
+ }
+ }
+ break;
+ case 0x09 :
+ Element_Info("EndOfObject");
+ meta_LevelFinished[meta_Level]=true;
+ break;
+ case 0x0A : //SCRIPTDATAVARIABLE[n]
+ case 0x0E : //RecordSet - SCRIPTDATAVARIABLE[n]
+ {
+ int32u Count;
+ Get_B4 (Count, "Count");
+ for (int32u Pos=0; Pos<Count; Pos++)
+ meta_SCRIPTDATAVALUE(StringData);
+ }
+ break;
+ case 0x0B : //SCRIPTDATADATE
+ {
+ float64 Value;
+ Get_BF8(Value, "Value");
+ Ztring ValueS;
+ ValueS.Date_From_Seconds_1970((int32u)(Value/1000));
+ Param_Info(ValueS);
+ Skip_B2( "Local_Offset_Minutes");
+ std::string ToFill;
+ if (0) ;
+ else if (StringData=="metadatadate") {ToFill="Tagged_Date";}
+ else {ToFill=StringData;}
+ Element_Info(ValueS);
+ Fill(Stream_General, 0, ToFill.c_str(), ValueS);
+ }
+ break;
+ case 0x0C : //SCRIPTDATALONGSTRING
+ case 0x0F : //XML - SCRIPTDATALONGSTRING
+ {
+ int32u Value_Size;
+ Get_B4 (Value_Size, "Value_Size");
+ if (Value_Size)
+ {
+ Ztring Value;
+ Get_UTF16B(Value_Size, Value, "Value");
+ std::string ToFill;
+ if (0) ;
+ else if (StringData=="creator") {ToFill="Encoded_Application";}
+ else if (StringData=="liveXML") {}
+ else if (StringData=="metadatacreator") {ToFill="Tagged_Application";}
+ else if (StringData=="creationdate") {ToFill="Encoded_Date"; Value.Date_From_String(Value.To_UTF8().c_str());}
+ else {ToFill=StringData;}
+ Element_Info(Value);
+ if (!ToFill.empty())
+ Fill(Stream_General, 0, ToFill.c_str(), Value);
+ }
+ }
+ break;
+ case 0x11 : //AMF3 data
+ {
+ int32u TypeCode;
+ Get_B4 (TypeCode, "AMF3 type code"); if (TypeCode<0x0D) Param_Info(Flv_Amf3Type[TypeCode]);
+ switch (TypeCode)
+ {
+ case 0x00 : //undefined
+ case 0x01 : //null
+ case 0x02 : //boolean-false
+ case 0x03 : //boolean-true
+ break;
+ default : //Not implemented or unknown
+ Element_Offset=Element_Size;
+ }
+ }
+ break;
+ default : //Unknown
+ Element_Offset=Element_Size; //Forcing the end of parsing
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Flv::Rm()
+{
+ Element_Name("Real Media tags");
+
+ //Creating the parser
+ File_Rm MI;
+ Open_Buffer_Init(&MI);
+
+ //Parsing
+ Open_Buffer_Continue(&MI);
+
+ //Filling
+ Finish(&MI);
+ Merge(MI, Stream_General, 0, 0);
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_FLV_YES
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Flv.h b/src/thirdparty/MediaInfo/Multiple/File_Flv.h
new file mode 100644
index 000000000..f2ed0c34a
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Flv.h
@@ -0,0 +1,115 @@
+// File_Flv - Info for Flash files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Flash files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_FlvH
+#define MediaInfo_File_FlvH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include <map>
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Flv
+//***************************************************************************
+
+class File_Flv : public File__Analyze
+{
+protected :
+ //Streams management
+ void Streams_Finish();
+
+public :
+ File_Flv();
+
+private :
+ //Buffer
+ void FileHeader_Parse ();
+ void Header_Parse();
+ void Data_Parse();
+
+ //Elements
+ void header();
+ void video();
+ void video_H263();
+ void video_ScreenVideo(int8u Version);
+ void video_VP6(bool WithAlpha);
+ void video_AVC();
+ void audio();
+ void audio_MPEG();
+ void audio_AAC();
+ void meta();
+ void meta_SCRIPTDATAOBJECT();
+ void meta_SCRIPTDATAVARIABLE();
+ void meta_SCRIPTDATAVALUE(const std::string &StringData);
+ void Rm();
+
+ //Streams
+ struct stream
+ {
+ File__Analyze* Parser;
+ size_t PacketCount;
+ int32u Delay;
+
+ stream()
+ {
+ Parser=NULL;
+ PacketCount=0;
+ Delay=(int32u)-1;
+ }
+
+ ~stream()
+ {
+ delete Parser; //Parser=NULL;
+ }
+ };
+ std::vector<stream> Stream; //Null, Video, Audio
+
+ //Count
+ bool video_stream_Count;
+ bool audio_stream_Count;
+
+ //Temp
+ bool video_stream_FrameRate_Detected;
+ std::vector<int32u> video_stream_FrameRate;
+ int32u Time;
+ int8u meta_Level;
+ std::map<int8u, bool> meta_LevelFinished;
+ bool Searching_Duration;
+ int32u PreviousTagSize;
+ int64u meta_filesize;
+ float64 meta_duration;
+ int32u FirstFrame_Time;
+ int8u FirstFrame_Type;
+ int32u LastFrame_Time;
+ int8u LastFrame_Type;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Gxf.cpp b/src/thirdparty/MediaInfo/Multiple/File_Gxf.cpp
new file mode 100644
index 000000000..70dfe188a
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Gxf.cpp
@@ -0,0 +1,939 @@
+// File_Gxf - Info for GXF (SMPTE 360M) files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_GXF_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Multiple/File_Gxf.h"
+#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 MEDIAINFO_EVENTS
+ #include "MediaInfo/MediaInfo_Events.h"
+#endif //MEDIAINFO_EVENTS
+//---------------------------------------------------------------------------
+
+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 "M-JPEG"; //525 lines
+ case 4 : return "M-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
+ MustSynchronize=true;
+ Buffer_TotalBytes_FirstSynched_Max=64*1024;
+
+ //Temp
+ Material_Fields_FieldsPerFrame=(int8u)-1;
+ 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;
+ SizeToAnalyze=16*1024*1024;
+}
+
+//---------------------------------------------------------------------------
+File_Gxf::~File_Gxf()
+{
+ //In
+ for (size_t Pos=0; Pos<Cdp_Data.size(); Pos++)
+ delete Cdp_Data[Pos]; //Cdp_Data[Pos]=NULL;
+ for (size_t Pos=0; Pos<AfdBarData_Data.size(); Pos++)
+ delete AfdBarData_Data[Pos]; //AfdBarData_Data[Pos]=NULL;
+
+ //Temp
+ delete UMF_File; //UMF_File=NULL;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Gxf::Streams_Finish()
+{
+ //Merging audio if Title are same
+ for (size_t StreamID=0; StreamID<Streams.size(); StreamID++)
+ {
+ if (Gxf_MediaTypes_StreamKind(Streams[StreamID].MediaType)==Stream_Video)
+ {
+ Ztring Title=Streams[StreamID].MediaName;
+ size_t Title_Extension_Offset=Title.find(_T(".M0"));
+ if (Title_Extension_Offset==std::string::npos || Title_Extension_Offset!=Title.size()-3)
+ Title_Extension_Offset=Title.find(_T(".H0"));
+ if (Title_Extension_Offset!=std::string::npos && Title_Extension_Offset==Title.size()-3)
+ {
+ Title.resize(Title.size()-3);
+ Streams[StreamID].MediaName=Title;
+ }
+ }
+ if (Gxf_MediaTypes_StreamKind(Streams[StreamID].MediaType)==Stream_Audio)
+ {
+ 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; StreamID2<Streams.size(); StreamID2++)
+ {
+ if (Streams[StreamID2].MediaName==Title+_T(".A")+Ztring::ToZtring(StreamID2-StreamID))
+ {
+ Streams[StreamID].MediaName=Title;
+ if (Streams[StreamID].Parser && Streams[StreamID2].Parser)
+ {
+ int32u Channels=Streams[StreamID].Parser->Retrieve(Stream_Audio, 0, Audio_Channel_s_).To_int32u()+Streams[StreamID2].Parser->Retrieve(Stream_Audio, 0, Audio_Channel_s_).To_int32u();
+ Streams[StreamID].Parser->Fill(Stream_Audio, 0, Audio_Channel_s_, Channels, 10, true);
+ int32u BitRate=Streams[StreamID].Parser->Retrieve(Stream_Audio, 0, Audio_BitRate).To_int32u()+Streams[StreamID2].Parser->Retrieve(Stream_Audio, 0, Audio_BitRate).To_int32u();
+ Streams[StreamID].Parser->Fill(Stream_Audio, 0, Audio_BitRate, BitRate, 10, true);
+ }
+ Streams[StreamID2].MediaType=(int8u)-1;
+ }
+ }
+ }
+ }
+ }
+
+ //For each Streams
+ for (size_t StreamID=0; StreamID<Streams.size(); StreamID++)
+ Streams_Finish_PerStream(StreamID, Streams[StreamID]);
+
+ //Global
+ if (Material_Fields_First_IsValid && Material_Fields_Last_IsValid && Material_Fields_FieldsPerFrame!=(int8u)-1)
+ {
+ Fill(Stream_Video, 0, Video_FrameCount, (Material_Fields_Last-Material_Fields_First)/(Material_Fields_FieldsPerFrame==2?2:1));
+
+ //We trust more the MPEG Video bitrate thant the rest
+ //TODO: Chech why there is incohenrency (mainly about Material File size info in the sample)
+ if (Retrieve(Stream_Video, 0, Video_Format)==_T("MPEG Video"))
+ Fill(Stream_Video, 0, Video_BitRate, Retrieve(Stream_Video, 0, Video_BitRate_Nominal));
+ }
+ if (Material_File_Size_IsValid)
+ {
+ //Fill(Stream_General, 0, General_OverallBitRate, ((int64u)Material_File_Size)*1024*8/???);
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Gxf::Streams_Finish_PerStream(size_t StreamID, stream &Temp)
+{
+ if (Temp.MediaType==(int8u)-1)
+ return;
+
+ //By the parser
+ if (Temp.Parser && Temp.Parser->Status[IsFilled])
+ {
+ StreamKind_Last=Stream_Max;
+ StreamPos_Last=(size_t)-1;
+ Finish(Temp.Parser);
+ Merge(*Temp.Parser);
+
+ //Special cases
+ if (Temp.Parser->Count_Get(Stream_Video) && Temp.Parser->Count_Get(Stream_Text))
+ {
+ //Video and Text are together
+ size_t Parser_Text_Count=Temp.Parser->Count_Get(Stream_Text);
+ for (size_t Parser_Text_Pos=0; Parser_Text_Pos<Parser_Text_Count; Parser_Text_Pos++)
+ {
+ size_t Text_Pos=Count_Get(Stream_Text)-Parser_Text_Count+Parser_Text_Pos;
+ Ztring MuxingMode=Retrieve(Stream_Text, Text_Pos, "MuxingMode");
+ Fill(Stream_Text, Text_Pos, "MuxingMode", _T("Ancillary data / ")+MuxingMode, true);
+ if (!IsSub)
+ Fill(Stream_Text, Text_Pos, "MuxingMode_MoreInfo", _T("Muxed in Video #")+Ztring().From_Number(Temp.StreamPos+1));
+ Fill(Stream_Video, Count_Get(Stream_Video)-1, General_ID, StreamID);
+ Ztring ID=Retrieve(Stream_Text, Text_Pos, Text_ID);
+ Fill(Stream_Text, Text_Pos, Text_ID, Ztring::ToZtring(AncillaryData_StreamID)+_T("-")+ID, true);
+ Fill(Stream_Text, Text_Pos, Text_ID_String, Ztring::ToZtring(AncillaryData_StreamID)+_T("-")+ID, true);
+ Fill(Stream_Text, Text_Pos, Text_Delay, Retrieve(Stream_Video, Count_Get(Stream_Video)-1, Video_Delay), true);
+ }
+
+ StreamKind_Last=Stream_Video;
+ StreamPos_Last=Count_Get(Stream_Video)-1;
+ }
+
+ //Metadata
+ if (StreamKind_Last!=Stream_Max)
+ {
+ Fill(StreamKind_Last, StreamPos_Last, General_ID, StreamID, 10, true);
+ Fill(StreamKind_Last, StreamPos_Last, "Title", Temp.MediaName);
+ }
+ }
+}
+
+//***************************************************************************
+// Buffer - Synchro
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Gxf::Synchronize()
+{
+ //Synchronizing
+ while (Buffer_Offset+16<=Buffer_Size)
+ {
+ while (Buffer_Offset+16<=Buffer_Size)
+ {
+ if (CC5(Buffer+Buffer_Offset )==0x0000000001
+ && CC2(Buffer+Buffer_Offset+14)==0xE1E2)
+ break;
+ Buffer_Offset++;
+ }
+
+ if (Buffer_Offset+16<=Buffer_Size) //Testing if size is coherant
+ {
+ //Retrieving some info
+ int32u Size=CC4(Buffer+Buffer_Offset+6);
+
+ //Testing
+ if (Buffer_Offset+Size+16>Buffer_Size)
+ return false; //Need more data
+ if (CC5(Buffer+Buffer_Offset+Size )!=0x0000000001
+ || CC2(Buffer+Buffer_Offset+Size+14)!=0xE1E2)
+ 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 - Per element
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+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);
+}
+
+//---------------------------------------------------------------------------
+void File_Gxf::Data_Parse()
+{
+ 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_Begin("Preamble");
+ BS_Begin();
+ Mark_1();
+ Mark_1();
+ Mark_1();
+ Get_S1(5, Version, "Version");
+ BS_End();
+ Skip_B1( "Reserved");
+ Element_End();
+
+ Element_Begin("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<Material_Data_End)
+ {
+ Element_Begin("Tag");
+ int8u Tag, DataLength;
+ Get_B1(Tag, "Tag");
+ Get_B1(DataLength, "Data Length");
+ Element_Name(Gxf_Tag_Name(Tag));
+ switch (Tag)
+ {
+ case 0x40 : //Media file name of material
+ {
+ Ztring MediaFileName;
+ Get_Local(DataLength, MediaFileName, "Content");
+ Fill(Stream_General, 0, General_Title, MediaFileName, true);
+ }
+ break;
+ case 0x41 : //First field of material in stream
+ if (DataLength==4)
+ {
+ Get_B4 (Material_Fields_First, "Content");
+ Material_Fields_First_IsValid=true;
+ }
+ else
+ Skip_XX(DataLength, "Unknown");
+ break;
+ case 0x42 : //Last field of material in stream
+ if (DataLength==4)
+ {
+ Get_B4 (Material_Fields_Last, "Content");
+ Material_Fields_Last_IsValid=true;
+ }
+ else
+ Skip_XX(DataLength, "Unknown");
+ break;
+ case 0x43 : //Mark in for the stream
+ if (DataLength==4)
+ Skip_B4( "Content");
+ else
+ Skip_XX(DataLength, "Unknown");
+ break;
+ case 0x44 : //Mark out for the stream
+ if (DataLength==4)
+ Skip_B4( "Content");
+ else
+ Skip_XX(DataLength, "Unknown");
+ break;
+ case 0x45 : //Estimated size of stream in 1024 byte units
+ if (DataLength==4)
+ {
+ Get_B4 (Material_File_Size , "Content");
+ Material_File_Size_IsValid=true;
+ }
+ else
+ Skip_XX(DataLength, "Unknown");
+ break;
+ case 0x46 : //Reserved
+ if (DataLength==4)
+ Skip_B4( "Content");
+ else
+ Skip_XX(DataLength, "Unknown");
+ break;
+ case 0x47 : //Reserved
+ if (DataLength==8)
+ Skip_B8( "Content");
+ else
+ Skip_XX(DataLength, "Unknown");
+ break;
+ case 0x48 : //Reserved
+ Skip_String(DataLength, "Content");
+ break;
+ case 0x49 : //Reserved
+ Skip_String(DataLength, "Content");
+ break;
+ case 0x4A : //Reserved
+ Skip_String(DataLength, "Content");
+ break;
+ case 0x4B : //Reserved
+ Skip_String(DataLength, "Content");
+ break;
+ default : Skip_XX(DataLength, "Unknown");
+ }
+ Element_End();
+ }
+ Element_End();
+
+ Element_Begin("Track Description");
+ Get_B2 (SectionLength, "Section Length");
+ if (Element_Offset+SectionLength>=Element_Size)
+ SectionLength=(int16u)(Element_Size-Element_Offset);
+ int64u Track_Data_End=Element_Offset+SectionLength;
+ while (Element_Offset<Track_Data_End)
+ {
+ Element_Begin("Track");
+ int16u TrackLength;
+ int8u MediaType, TrackID;
+ Get_B1 (MediaType, "Media type"); Param_Info(Gxf_MediaTypes(MediaType&0x7F));
+ Get_B1 (TrackID, "Track ID");
+ Get_B2 (TrackLength, "Track Length");
+ if (Element_Offset+TrackLength>=Track_Data_End)
+ TrackLength=(int16u)(Track_Data_End-Element_Offset);
+ int64u Track_End=Element_Offset+TrackLength;
+ Element_Info(TrackID&0x3F);
+ Element_Info(Gxf_MediaTypes(MediaType&0x7F));
+
+ FILLING_BEGIN();
+ MediaType&=0x7F; //Remove the last bit
+ TrackID&=0x3F; //Remove the 2 last bits
+ if (Streams[TrackID].Parser==NULL)
+ {
+ Streams[TrackID].MediaType=MediaType;
+ Streams[TrackID].TrackID=TrackID;
+
+ //Parsers
+ #if MEDIAINFO_DEMUX
+ Element_Code=TrackID;
+ #endif //MEDIAINFO_DEMUX
+ switch (MediaType)
+ {
+ case 9 :
+ case 10 :
+ case 18 : //PCM
+ Streams[TrackID].Parser=new File__Analyze; //Filling with following data
+ Open_Buffer_Init(Streams[TrackID].Parser);
+ Streams[TrackID].Parser->Accept();
+ Streams[TrackID].Parser->Fill();
+ Streams[TrackID].Parser->Stream_Prepare(Stream_Audio);
+ Streams[TrackID].Parser->Fill(Stream_Audio, 0, Audio_Format, "PCM");
+ break;
+ case 11 :
+ case 12 :
+ case 20 :
+ case 22 :
+ case 23 : //MPEG Video
+ Streams[TrackID].Parser=new File_Mpegv();
+ ((File_Mpegv*)Streams[TrackID].Parser)->Cdp_Data=&Cdp_Data;
+ ((File_Mpegv*)Streams[TrackID].Parser)->AfdBarData_Data=&AfdBarData_Data;
+ Open_Buffer_Init(Streams[TrackID].Parser);
+ Parsers_Count++;
+ Streams[TrackID].Searching_Payload=true;
+ break;
+ case 13 :
+ case 14 :
+ case 15 :
+ case 16 : /*Streams[TrackID].Parser=new File_DvDif(); Parsers_Count++; break;*/
+ case 17 : //AC-3
+ Streams[TrackID].Parser=new File__Analyze; //Filling with following data
+ Open_Buffer_Init(Streams[TrackID].Parser);
+ Streams[TrackID].Parser->Accept();
+ Streams[TrackID].Parser->Fill();
+ Streams[TrackID].Parser->Stream_Prepare(Stream_Audio);
+ Streams[TrackID].Parser->Fill(Stream_Audio, 0, Audio_Format, "AC-3");
+ break;
+ case 21 : //Ancillary Metadata
+ Streams[TrackID].Parser=new File_Riff();
+ ((File_Riff*)Streams[TrackID].Parser)->Cdp_Data=&Cdp_Data;
+ ((File_Riff*)Streams[TrackID].Parser)->AfdBarData_Data=&AfdBarData_Data;
+ Open_Buffer_Init(Streams[TrackID].Parser);
+ Parsers_Count++;
+ Streams[TrackID].Searching_Payload=true;
+ if (SizeToAnalyze<4*16*1024*1024)
+ SizeToAnalyze*=4; //4x more, to be sure to find captions
+ AncillaryData_StreamID=TrackID;
+ break;
+ default : ;
+ }
+
+ if (Gxf_MediaTypes_StreamKind(MediaType)==Stream_Audio)
+ {
+ //Resolution
+ switch (MediaType)
+ {
+ case 9 :
+ case 18 : //24-bit
+ Streams[TrackID].Parser->Fill(Stream_Audio, 0, Audio_Resolution, 24);
+ break;
+ case 10 :
+ case 17 : //16-bit
+ Streams[TrackID].Parser->Fill(Stream_Audio, 0, Audio_Resolution, 16);
+ break;
+ default : ;
+ }
+
+ //Channels
+ switch (MediaType)
+ {
+ case 9 :
+ case 10 : //Mono
+ Streams[TrackID].Parser->Fill(Stream_Audio, 0, Audio_Channel_s_, 1);
+ break;
+ default : ;
+ }
+
+ //Sampling rate
+ switch (MediaType)
+ {
+ case 9 :
+ case 10 :
+ case 17 : //48000
+ Streams[TrackID].Parser->Fill(Stream_Audio, 0, Audio_SamplingRate, 48000);
+ break;
+ default : ;
+ }
+
+ //Bit rate
+ switch (MediaType)
+ {
+ case 9 :
+ case 17 : //Mono, 48 KHz, 24-bit (or padded up to 24-bit)
+ Streams[TrackID].Parser->Fill(Stream_Audio, 0, Audio_BitRate, 1*48000*24);
+ break;
+ case 10 : //Mono, 48 KHz, 16-bit
+ Streams[TrackID].Parser->Fill(Stream_Audio, 0, Audio_BitRate, 1*48000*16);
+ break;
+ default : ;
+ }
+ }
+ }
+ FILLING_END();
+
+ while (Element_Offset<Track_End)
+ {
+ Element_Begin("Tag");
+ int8u Tag, DataLength;
+ Get_B1(Tag, "Tag");
+ Get_B1(DataLength, "Data Length");
+ Element_Name(Gxf_Tag_Name(Tag));
+ switch (Tag)
+ {
+ case 0x4C : //Media name
+ {
+ Get_Local(DataLength, Streams[TrackID].MediaName, "Content");
+ }
+ break;
+ case 0x4D : //Auxiliary Information
+ if (DataLength==8)
+ {
+ if (MediaType==21)
+ {
+ //Ancillary
+ Skip_B1( "Reserved");
+ Skip_B1( "Reserved");
+ Skip_B1( "Ancillary data presentation format");
+ Skip_B1( "Number of ancillary data fields per ancillary data media packet");
+ Skip_B2( "Byte size of each ancillary data field");
+ Skip_B2( "Byte size of the ancillary data media packet in 256 byte units");
+ }
+ if (MediaType==7 || MediaType==8 || MediaType==24)
+ {
+ //TimeCode
+ Skip_B1( "Frame");
+ Skip_B1( "Second");
+ Skip_B1( "Minute");
+ BS_Begin();
+ Skip_SB( "Invalid");
+ Skip_SB( "Color frame");
+ Skip_SB( "Drop frame");
+ Skip_S1(5, "Hour");
+ BS_End();
+ Skip_B1( "User bits");
+ Skip_B1( "User bits");
+ Skip_B1( "User bits");
+ Skip_B1( "User bits");
+ }
+ else
+ Skip_B8( "Content");
+ }
+ else
+ Skip_XX(DataLength, "Unknown");
+ break;
+ case 0x4E : //Media file system version
+ if (DataLength==4)
+ Skip_B4( "Content");
+ else
+ Skip_XX(DataLength, "Unknown");
+ break;
+ case 0x4F : //MPEG auxiliary information
+ Skip_String(DataLength, "Content");
+ break;
+ case 0x50 : //Frame rate
+ if (DataLength==4)
+ {
+ Get_B4 (Streams[TrackID].FrameRate_Code, "Content"); Param_Info(Gxf_FrameRate(Streams[TrackID].FrameRate_Code)); Element_Info(Gxf_FrameRate(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_Info(Gxf_LinesPerFrame_Height(Streams[TrackID].LinesPerFrame_Code)); Element_Info(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_Info(Gxf_FieldsPerFrame(Streams[TrackID].FieldsPerFrame_Code)); Element_Info(Gxf_FieldsPerFrame(Streams[TrackID].FieldsPerFrame_Code));
+ if (Gxf_MediaTypes_StreamKind(MediaType)==Stream_Video)
+ Material_Fields_FieldsPerFrame=Streams[TrackID].FieldsPerFrame_Code;
+ }
+ else
+ Skip_XX(DataLength, "Unknown");
+ break;
+ default : Skip_XX(DataLength, "Unknown");
+ }
+ Element_End();
+ }
+ Element_End();
+ }
+ Element_End();
+ if (Element_Offset<Element_Size)
+ Skip_XX(Element_Size-Element_Offset, "Padding");
+}
+
+//---------------------------------------------------------------------------
+void File_Gxf::media()
+{
+ Element_Name("media");
+
+ //Parsing
+ int8u TrackNumber;
+ Element_Begin("Preamble");
+ Skip_B1( "Media type");
+ Get_B1 (TrackNumber, "Track number");
+ Skip_B4( "Media field number");
+ Skip_B1( "Field information");
+ Skip_B1( "Field information");
+ Skip_B1( "Field information");
+ Skip_B1( "Field information");
+ Skip_B4( "Time line field number");
+ Skip_B1( "Flags");
+ Skip_B1( "Reserved");
+ TrackNumber&=0x3F;
+ Element_End();
+ Element_Info(TrackNumber);
+
+ #if MEDIAINFO_DEMUX
+ Element_Code=TrackNumber;
+ Demux(Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset), ContentType_MainStream);
+ #endif //MEDIAINFO_DEMUX
+
+ //Needed?
+ if (!Streams[TrackNumber].Searching_Payload)
+ {
+ Skip_XX(Element_Size, "data");
+ Element_DoNotShow();
+ return;
+ }
+
+ if (Streams[TrackNumber].Parser)
+ {
+ Open_Buffer_Continue(Streams[TrackNumber].Parser, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset));
+ if (MediaInfoLib::Config.ParseSpeed_Get()<1 && Streams[TrackNumber].Parser->Status[IsFilled])
+ {
+ Streams[TrackNumber].Searching_Payload=false;
+
+ if (Parsers_Count>0)
+ Parsers_Count--;
+ if (Parsers_Count==0)
+ {
+ Finish();
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------------------------
+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;
+ Skip_L4( "Number of fields per FLT entry");
+ Get_L4 (Entries, "Number of FLT entries");
+ for (size_t Pos=0; Pos<Entries; Pos++)
+ {
+ Skip_L4( "Offset to fields");
+ if (Element_Offset==Element_Size)
+ break;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Gxf::UMF_file()
+{
+ Element_Name("UMF file");
+
+ //Parsing
+ int32u PayloadDataLength;
+ Element_Begin("Preamble");
+ Skip_B1( "First/last packet flag");
+ Get_B4 (PayloadDataLength, "Payload data length");
+ Element_End();
+
+ if (UMF_File==NULL)
+ {
+ UMF_File=new File_Umf();
+ Open_Buffer_Init(UMF_File);
+ }
+ Open_Buffer_Continue(UMF_File, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset));
+}
+
+//***************************************************************************
+// Helpers
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Gxf::Detect_EOF()
+{
+ if (File_Offset+Buffer_Size>=SizeToAnalyze)
+ {
+ Finish();
+ }
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_GXF_YES
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Gxf.h b/src/thirdparty/MediaInfo/Multiple/File_Gxf.h
new file mode 100644
index 000000000..6edae0741
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Gxf.h
@@ -0,0 +1,139 @@
+// File_Gxf - Info for GXF (SMPTE 360M) files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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_CDP_YES)
+ #include "MediaInfo/Multiple/File_Riff.h"
+#endif //MEDIAINFO_CDP_YES
+#include <map>
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Gxf
+//***************************************************************************
+
+class File_Gxf : public File__Analyze
+{
+public :
+ //Constructor/Destructor
+ File_Gxf();
+ ~File_Gxf();
+
+ //In
+ #if defined(MEDIAINFO_CDP_YES)
+ std::vector<File_Riff::buffered_data*> Cdp_Data;
+ #endif //MEDIAINFO_CDP_YES
+ #if defined(MEDIAINFO_AFDBARDATA_YES)
+ std::vector<File_Riff::buffered_data*> AfdBarData_Data;
+ #endif //MEDIAINFO_AFDBARDATA_YES
+
+private :
+ //Streams management
+ void Streams_Finish();
+
+ //Buffer - Synchro
+ bool Synchronize();
+ bool Synched_Test();
+
+ //Buffer - Per element
+ void Header_Parse();
+ void Data_Parse();
+
+ //Packets
+ void map();
+ void media();
+ void end_of_stream();
+ void field_locator_table();
+ void UMF_file();
+
+ //Temp - Global
+ int32u Material_Fields_First;
+ int32u Material_Fields_Last;
+ int32u Material_File_Size;
+ int32u Material_Fields_FieldsPerFrame;
+ int8u Parsers_Count;
+ int8u AncillaryData_StreamID;
+ bool Material_Fields_First_IsValid;
+ bool Material_Fields_Last_IsValid;
+ bool Material_File_Size_IsValid;
+
+ //Temp - Stream
+ struct stream
+ {
+ File__Analyze* Parser;
+ 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;
+ Ztring MediaName;
+
+ stream()
+ {
+ Parser=NULL;
+ 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;
+ }
+ ~stream()
+ {
+ delete Parser; //Parser=NULL
+ }
+ };
+ std::vector<stream> Streams;
+ File__Analyze* UMF_File;
+ int64u SizeToAnalyze; //Total size of a chunk to analyse, it may be changed by the parser
+
+ //File__Analyze helpers
+ void Streams_Finish_PerStream(size_t StreamID, stream &Temp);
+ void Detect_EOF();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Ivf.cpp b/src/thirdparty/MediaInfo/Multiple/File_Ivf.cpp
new file mode 100644
index 000000000..db112ad3b
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Ivf.cpp
@@ -0,0 +1,111 @@
+// File_Ivf - Info for Ivf files
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+// Copyright (C) 2010 Lionel DUCHATEAU, kurtnoise at free dot fr
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// From : http://www.webmproject.org/
+// Specs: http://wiki.multimedia.cx/index.php?title=IVF
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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, unused, 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");
+ Get_L4 (unused, "Unused");
+ if (header_size-32)
+ Skip_XX(header_size-32, "Unknown");
+ }
+ }
+
+ 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_*
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Ivf.h b/src/thirdparty/MediaInfo/Multiple/File_Ivf.h
new file mode 100644
index 000000000..a196827ea
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Ivf.h
@@ -0,0 +1,55 @@
+// File_Ivf - Info for Ivf files
+// Copyright (C) 2004-2010 MediaArea.net SARL, Info@MediaArea.net
+// Copyright (C) 2010 Lionel DUCHATEAU, kurtnoise at free dot fr
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
+ size_t Frame_Count_Valid;
+private :
+ //Buffer
+ bool FileHeader_Begin();
+ void FileHeader_Parse();
+};
+
+} //NameSpace
+
+#endif
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Lxf.cpp b/src/thirdparty/MediaInfo/Multiple/File_Lxf.cpp
new file mode 100644
index 000000000..6275c2699
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Lxf.cpp
@@ -0,0 +1,584 @@
+// File_Lxf - Info for LXF files
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_LXF_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Multiple/File_Lxf.h"
+#if defined(MEDIAINFO_DVDIF_YES)
+ #include "MediaInfo/Multiple/File_DvDif.h"
+#endif
+#if defined(MEDIAINFO_MPEGV_YES)
+ #include "MediaInfo/Video/File_Mpegv.h"
+#endif
+#if MEDIAINFO_EVENTS
+ #include "MediaInfo/MediaInfo_Events.h"
+#endif //MEDIAINFO_EVENTS
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// 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
+ MustSynchronize=true;
+
+ //Temp
+ Frame_Count=0;
+ LookingForLastFrame=false;
+ Stream_Count=0;
+ Info_General_StreamSize=0;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Lxf::Streams_Fill()
+{
+ for (size_t Pos=0; Pos<Videos.size(); Pos++)
+ Streams_Fill_PerStream(Videos[Pos].Parser);
+ for (size_t Pos=0; Pos<Audios.size(); Pos++)
+ Streams_Fill_PerStream(Audios[Pos].Parser);
+}
+
+//---------------------------------------------------------------------------
+void File_Lxf::Streams_Fill_PerStream(File__Analyze* Parser)
+{
+ if (Parser==NULL)
+ return;
+
+ Merge(*Parser);
+}
+
+//---------------------------------------------------------------------------
+void File_Lxf::Streams_Finish()
+{
+ if (Audios_Header.TimeStamp_Begin!=(int64u)-1)
+ {
+ int64u Duration=float64_int64s(((float64)(Audios_Header.TimeStamp_End-Audios_Header.TimeStamp_Begin))/720);
+ int64u FrameCount=float64_int64s(((float64)(Audios_Header.TimeStamp_End-Audios_Header.TimeStamp_Begin))/Audios_Header.Duration);
+ for (size_t Pos=0; Pos<Count_Get(Stream_Audio); Pos++)
+ {
+ Fill(Stream_Audio, Pos, Audio_Duration, Duration);
+ Fill(Stream_Audio, Pos, Audio_FrameCount, FrameCount);
+ }
+ Info_General_StreamSize+=FrameCount*0x48;
+ }
+ if (Videos_Header.TimeStamp_Begin!=(int64u)-1)
+ {
+ int64u Duration=float64_int64s(((float64)(Videos_Header.TimeStamp_End-Videos_Header.TimeStamp_Begin))/720);
+ int64u FrameCount=float64_int64s(((float64)(Videos_Header.TimeStamp_End-Videos_Header.TimeStamp_Begin))/Videos_Header.Duration);
+ for (size_t Pos=0; Pos<Count_Get(Stream_Video); Pos++)
+ Fill(Stream_Video, Pos, Video_Duration, Duration);
+ Info_General_StreamSize+=FrameCount*0x48;
+
+ if (Count_Get(Stream_Video)==1 && Retrieve(Stream_Video, 0, Video_BitRate).empty())
+ {
+ for (size_t Pos=0; Pos<Videos.size(); Pos++)
+ if (Videos[Pos].BytesPerFrame!=(int64u)-1)
+ Info_General_StreamSize+=Videos[Pos].BytesPerFrame*FrameCount;
+ for (size_t Pos=0; Pos<Audios.size(); Pos++)
+ if (Audios[Pos].BytesPerFrame!=(int64u)-1)
+ Info_General_StreamSize+=Audios[Pos].BytesPerFrame*Retrieve(Stream_Audio, Pos, Audio_FrameCount).To_int64u();
+ int64u BitRate=(File_Size-Info_General_StreamSize)*8*1000/Duration;
+ Fill(Stream_General, 0, General_StreamSize, Info_General_StreamSize);
+ Fill(Stream_Video, 0, Video_StreamSize, File_Size-Info_General_StreamSize);
+ }
+ }
+}
+
+//***************************************************************************
+// Buffer - Synchro
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Lxf::Synchronize()
+{
+ //Synchronizing
+ while (Buffer_Offset+8<=Buffer_Size
+ && CC8(Buffer+Buffer_Offset)!=0x4C45495443480000LL)
+ Buffer_Offset++;
+
+ //Parsing last bytes if needed
+ if (Buffer_Offset+8>Buffer_Size)
+ {
+ if (Buffer_Offset+8==Buffer_Size && CC8(Buffer+Buffer_Offset)!=0x4C45495443480000LL)
+ Buffer_Offset++;
+ 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");
+ }
+
+ //Synched is OK
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool File_Lxf::Synched_Test()
+{
+ //Must have enough buffer for having header
+ if (Buffer_Offset+16>Buffer_Size)
+ return false;
+
+ //Quick test of synchro
+ if (CC8(Buffer+Buffer_Offset)!=0x4C45495443480000LL)
+ Synched=false;
+
+ //We continue
+ return true;
+}
+
+//***************************************************************************
+// Buffer - Per element
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Lxf::Header_Parse()
+{
+ //parsing
+ int64u Code, BlockSize;
+ Skip_C8( "Signature");
+ Skip_L4( "Always 0x00000001");
+ Skip_L4( "Always 0x00000048 (header size?)");
+ Get_L8 (Code, "Code");
+ switch(Code)
+ {
+ case 0 : //Video
+ {
+ Sizes.resize(2);
+ int64u Size;
+ BlockSize=0;
+
+ Info_L8(TimeStamp, "TimeStamp"); Param_Info(((float64)TimeStamp)/720, 3, " ms");
+ Info_L8(Duration, "Duration"); Param_Info(((float64)Duration)/720, 3, " ms");
+ Skip_L4( "Always same in data");
+ Get_L8(Size, "Block size");
+ Sizes[1]=Size;
+ BlockSize+=Size;
+ Get_L8(Size, "Block size");
+ Sizes[0]=Size;
+ BlockSize+=Size;
+ Skip_L4( "? (Always zero)");
+ Info_L8(Reverse, "Reverse TimeStamp"); Param_Info(((float64)Reverse)/720, 3, " ms");
+ if (Videos_Header.TimeStamp_Begin==(int64u)-1)
+ Videos_Header.TimeStamp_Begin=TimeStamp;
+ Videos_Header.TimeStamp_End=TimeStamp+Duration;
+ Videos_Header.Duration=Duration;
+ }
+ break;
+ case 1 : //Audio
+ {
+ int32u Info, Size;
+
+ Info_L8(TimeStamp, "TimeStamp"); Param_Info(((float64)TimeStamp)/720, 3, " ms");
+ Info_L8(Duration, "Duration"); Param_Info(((float64)Duration)/720, 3, " ms");
+ Skip_L4( "? (Non-Zero, same in all blocks)");
+ Get_L4(Info, "Info?");
+ Get_L4(Size, "Block size (divided by ?)");
+ Skip_L4( "? (Always zero)");
+ Skip_L4( "? (Always zero)");
+ Skip_L4( "? (Always zero)");
+ Info_L8(Reverse, "Reverse TimeStamp"); Param_Info(((float64)Reverse)/720, 3, " ms");
+
+ size_t Multiplier;
+ switch (Info)
+ {
+ case 0x03 : Multiplier=2; break;
+ case 0x0F : Multiplier=4; break;
+ default : Multiplier=0; Trusted++; //Unknown size, will unsynch
+ }
+ Sizes.resize(Multiplier);
+ for (size_t Pos=0; Pos<Sizes.size(); Pos++)
+ Sizes[Pos]=Size;
+ BlockSize=Size*Multiplier;
+ if (Audios_Header.TimeStamp_Begin==(int64u)-1)
+ Audios_Header.TimeStamp_Begin=TimeStamp;
+ Audios_Header.TimeStamp_End=TimeStamp+Duration;
+ Audios_Header.Duration=Duration;
+ }
+ break;
+ case 2 : //Header
+ {
+ Sizes.resize(2);
+ int32u Size;
+ BlockSize=0;
+
+ Skip_L8( "Always 0x00000000");
+ Skip_L8( "?");
+ Skip_L4( "?");
+ Get_L4(Size, "Block size");
+ Sizes[1]=Size;
+ BlockSize+=Size;
+ Get_L4(Size, "Block size");
+ Sizes[0]=Size;
+ BlockSize+=Size;
+ Skip_L4( "? (Always zero)");
+ Skip_L4( "? (Always zero)");
+ Skip_L4( "? (Always zero)");
+ Info_L8(Reverse, "Reverse TimeStamp?"); Param_Info(((float64)Reverse)/720, 3, " ms");
+ }
+ break;
+ default : BlockSize=0;
+ }
+
+ //Cleanup of sizes
+ for (size_t Pos=0; Pos<Sizes.size(); Pos++)
+ if (Sizes[Pos]==0)
+ {
+ Sizes.erase(Sizes.begin()+Pos);
+ Pos--;
+ }
+ else
+ break;
+
+ //Filling
+ Header_Fill_Code(Code, Ztring::ToZtring(Code));
+ Header_Fill_Size(0x48+BlockSize);
+}
+
+//---------------------------------------------------------------------------
+void File_Lxf::Data_Parse()
+{
+ switch(Element_Code)
+ {
+ case 0 : Video(); break;
+ case 1 : Audio(); break;
+ case 2 : Header(); break;
+ default : Skip_XX(Element_Size, "Unknown");
+ }
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Lxf::Header()
+{
+ Element_Name("Header");
+
+ for (size_t Pos=0; Pos<Sizes.size(); Pos++)
+ {
+ switch(Pos)
+ {
+ case 0 : Header_Info(); break;
+ case 1 : Header_Meta(); break;
+ default : Skip_XX(Sizes[Pos], "Data");
+ }
+ }
+ Sizes.clear();
+
+ Info_General_StreamSize=0x48+Element_Size;
+}
+
+//---------------------------------------------------------------------------
+void File_Lxf::Header_Info()
+{
+ Element_Begin("Info?");
+
+ //Parsing
+ Skip_L4( "Unknown");
+ Skip_L4( "Unknown");
+ Skip_L4( "Unknown");
+ Skip_L4( "Unknown");
+ Skip_C8( "Unknown");
+ Skip_L4( "Unknown");
+ Skip_L4( "Unknown");
+ Skip_L8( "Unknown");
+ Skip_L4( "Unknown");
+ Skip_L4( "Unknown");
+ Skip_L4( "Unknown");
+ Skip_L4( "Unknown");
+ Skip_L4( "Unknown");
+ Skip_L3( "Unknown");
+ Skip_L4( "Unknown");
+ Skip_L4( "Unknown");
+ Skip_L4( "Unknown");
+ Skip_L8( "Unknown");
+ if (Sizes[0]>83)
+ Skip_XX(Sizes[0]-83, "Extra?");
+
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Lxf::Header_Meta()
+{
+ Element_Begin("Tags?");
+
+ int64u Offset=0;
+ int64u Pos=0;
+
+ while (Offset<Sizes[1])
+ {
+ int8u Size;
+ Get_L1 (Size, "Size");
+ if (Size)
+ {
+ switch (Pos)
+ {
+ case 2 : //Channel?
+ {
+ Ztring Channel;
+ Get_UTF16L(Size, Channel, "Channel?");
+ Fill(Stream_General, 0, General_ServiceName, Channel);
+ }
+ break;
+ case 7 : //Title
+ {
+ Ztring Title;
+ Get_UTF16L(Size, Title, "Title");
+ Fill(Stream_General, 0, General_Title, Title);
+ }
+ break;
+ default : Skip_XX(Size, "Data");
+ }
+ }
+ Offset+=1+Size;
+ Pos++;
+ }
+
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Lxf::Audio()
+{
+ Element_Name("Audio");
+
+ for (size_t Pos=0; Pos<Sizes.size(); Pos++)
+ Audio_Stream(Pos);
+ Sizes.clear();
+}
+
+//---------------------------------------------------------------------------
+void File_Lxf::Audio_Stream(size_t Pos)
+{
+ Element_Begin("Stream");
+
+ Element_Code=0x0100+Pos;
+ Demux(Buffer+Buffer_Offset+(size_t)Element_Offset, Sizes[Pos], ContentType_MainStream);
+
+ Skip_XX(Sizes[Pos], Sizes.size()==2?"PCM":"Unknown format");
+
+ if (Pos>=Audios.size())
+ Audios.resize(Pos+1);
+ if (Audios[Pos].Parser==NULL)
+ {
+ //Trying to detect if this is PCM
+ int64u BitRate=Sizes[Pos]*720000*8/(Audios_Header.TimeStamp_End-Audios_Header.TimeStamp_Begin);
+ Audios[Pos].BytesPerFrame=Sizes[Pos];
+
+ Audios[Pos].Parser=new File__Analyze;
+ Open_Buffer_Init(Audios[Pos].Parser);
+ Audios[Pos].Parser->Accept();
+ Audios[Pos].Parser->Stream_Prepare(Stream_Audio);
+ Audios[Pos].Parser->Fill(Stream_Audio, StreamPos_Last, Audio_BitRate, BitRate);
+ Audios[Pos].Parser->Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR");
+ if (BitRate==768000)
+ {
+ Audios[Pos].Parser->Fill(Stream_Audio, StreamPos_Last, Audio_Format, "PCM");
+ Audios[Pos].Parser->Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, 24000);
+ Audios[Pos].Parser->Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, 2);
+ Audios[Pos].Parser->Fill(Stream_Audio, StreamPos_Last, Audio_Resolution, 16);
+ }
+ if (BitRate==960000)
+ {
+ Audios[Pos].Parser->Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, 48000);
+ Audios[Pos].Parser->Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, 4);
+ Audios[Pos].Parser->Fill(Stream_Audio, StreamPos_Last, Audio_Resolution, 16);
+ }
+ Audios[Pos].Parser->Fill();
+ }
+
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Lxf::Video()
+{
+ Element_Name("Video");
+
+ if (LookingForLastFrame)
+ {
+ Skip_XX(Element_Size, "Data");
+ return;
+ }
+
+ for (size_t Pos=0; Pos<Sizes.size(); Pos++)
+ Video_Stream(Pos);
+ Sizes.clear();
+
+ FILLING_BEGIN();
+ Frame_Count++;
+ if (Frame_Count>6 && Stream_Count==0 && !Status[IsFilled]) //5 video frames for 1 Audio frame
+ {
+ Fill("LXF");
+ if (MediaInfoLib::Config.ParseSpeed_Get()<1)
+ {
+ LookingForLastFrame=true;
+ if (2*(File_Offset+Buffer_Offset)<=File_Size)
+ GoToFromEnd(File_Offset+Buffer_Offset);
+ }
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Lxf::Video_Stream(size_t Pos)
+{
+ Element_Begin("Stream");
+
+ Element_Code=0x0000+Pos;
+ Demux(Buffer+Buffer_Offset+(size_t)Element_Offset, Sizes[Pos], ContentType_MainStream);
+
+ if (Sizes.size()==1)
+ {
+ #if defined(MEDIAINFO_DVDIF_YES)
+ if (Pos>=Videos.size())
+ Videos.resize(Pos+1);
+ if (Videos[Pos].Parser==NULL)
+ {
+ Videos[Pos].Parser=new File_DvDif;
+ Open_Buffer_Init(Videos[Pos].Parser);
+ Stream_Count++;
+ }
+ Open_Buffer_Continue(Videos[Pos].Parser, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)Sizes[Pos]);
+ if (Videos[Pos].Parser->Status[IsFilled])
+ {
+ if (Stream_Count>0)
+ Stream_Count--;
+ }
+ #else
+ Skip_XX(Sizes[Pos], "DV");
+
+ if (Pos>=Videos.size())
+ Videos.resize(Pos+1);
+ if (Videos[Pos].Parser==NULL)
+ {
+ int64u BitRate=float64_int64s(((float64)Sizes[Pos])*720000*8/(Videos_Header.TimeStamp_End-Videos_Header.TimeStamp_Begin));
+ float64 FrameRate=((float64)1)*720000/(Videos_Header.TimeStamp_End-Videos_Header.TimeStamp_Begin);
+
+ Videos[Pos].Parser=new File__Analyze;
+ Open_Buffer_Init(Videos[Pos].Parser);
+ Videos[Pos].Parser->Accept();
+ Videos[Pos].Parser->Stream_Prepare(Stream_Video);
+ Videos[Pos].Parser->Fill(Stream_Video, 0, Video_Format, "DV");
+ Videos[Pos].Parser->Fill(Stream_Video, 0, Video_BitRate, BitRate);
+ Videos[Pos].Parser->Fill(Stream_Video, 0, Video_BitRate_Mode, "CBR");
+ Videos[Pos].Parser->Fill(Stream_Video, 0, Video_FrameRate, FrameRate);
+ Videos[Pos].Parser->Fill();
+ }
+ #endif
+ }
+ else
+ {
+ if (Pos==0)
+ {
+ Skip_XX(Sizes[Pos], "Unknown");
+ if (Pos>=Videos.size())
+ Videos.resize(Pos+1);
+ Videos[Pos].BytesPerFrame=Sizes[Pos];
+ }
+ else
+ {
+ #if defined(MEDIAINFO_MPEGV_YES)
+ if (Pos>=Videos.size())
+ Videos.resize(Pos+1);
+ if (Videos[Pos].Parser==NULL)
+ {
+ Videos[Pos].Parser=new File_Mpegv;
+ Open_Buffer_Init(Videos[Pos].Parser);
+ Stream_Count++;
+ }
+ Open_Buffer_Continue(Videos[Pos].Parser, Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)Sizes[Pos]);
+ if (Videos[Pos].Parser->Status[IsFilled])
+ {
+ if (Stream_Count>0)
+ Stream_Count--;
+ }
+ #else
+ Skip_XX(Sizes[Pos], "MPEG Video");
+
+ if (Pos>=Videos.size())
+ Videos.resize(Pos+1);
+ if (Videos[Pos].Parser==NULL)
+ {
+ float64 FrameRate=((float64)1)*720000/(Videos_Header.TimeStamp_End-Videos_Header.TimeStamp_Begin);
+
+ Videos[Pos].Parser=new File__Analyze;
+ Open_Buffer_Init(Videos[Pos].Parser);
+ Videos[Pos].Parser->Stream_Prepare(Stream_Video);
+ Videos[Pos].Parser->Fill(Stream_Video, 0, Video_Format, "MPEG Video");
+ Videos[Pos].Parser->Fill(Stream_Video, 0, Video_FrameRate, FrameRate);
+ }
+ #endif
+ }
+ }
+
+ Element_End();
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_LXF_*
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Lxf.h b/src/thirdparty/MediaInfo/Multiple/File_Lxf.h
new file mode 100644
index 000000000..43a7fda25
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Lxf.h
@@ -0,0 +1,110 @@
+// File_Lxf - Info for LXF files
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Lxf files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_LxfH
+#define MediaInfo_File_LxfH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include <vector>
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Lxf
+//***************************************************************************
+
+class File_Lxf : public File__Analyze
+{
+public :
+ //Constructor/Destructor
+ File_Lxf();
+
+protected :
+ //Streams management
+ void Streams_Fill ();
+ void Streams_Fill_PerStream (File__Analyze* Parser);
+ void Streams_Finish ();
+
+ //Buffer - Synchro
+ bool Synchronize();
+ bool Synched_Test();
+
+ //Buffer - Per element
+ 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);
+
+ //Streams
+ struct stream
+ {
+ File__Analyze* Parser;
+ int64u BytesPerFrame;
+
+ stream()
+ {
+ Parser=NULL;
+ BytesPerFrame=(int64u)-1;
+ }
+ };
+ std::vector<stream> Videos;
+ std::vector<stream> Audios;
+ struct stream_header
+ {
+ int64u TimeStamp_Begin;
+ int64u TimeStamp_End;
+ int64u Duration;
+
+ stream_header()
+ {
+ TimeStamp_Begin=(int64u)-1;
+ TimeStamp_End=(int64u)-1;
+ Duration=(int64u)-1;
+ }
+ };
+ stream_header Videos_Header;
+ stream_header Audios_Header;
+
+ //Temp
+ int64u Frame_Count;
+ std::vector<int64u> Sizes;
+ bool LookingForLastFrame;
+ int64u Stream_Count;
+ int64u Info_General_StreamSize;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Mk.cpp b/src/thirdparty/MediaInfo/Multiple/File_Mk.cpp
new file mode 100644
index 000000000..689b38498
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Mk.cpp
@@ -0,0 +1,3075 @@
+// File_Mk - Info for Matroska files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_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_ADTS_YES)
+ #include "MediaInfo/Audio/File_Adts.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_MPEG4_YES)
+ #include "MediaInfo/Audio/File_Mpeg4_AudioSpecificConfig.h"
+#endif
+#if defined(MEDIAINFO_AAC_YES)
+ #include "MediaInfo/Audio/File_Aac.h"
+#endif
+#if defined(MEDIAINFO_FLAC_YES)
+ #include "MediaInfo/Audio/File_Flac.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 <cstring>
+#include <algorithm>
+//---------------------------------------------------------------------------
+
+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 "";
+ }
+}
+
+//***************************************************************************
+// 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
+ DataMustAlwaysBeComplete=false;
+
+ //Temp
+ 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<int64u, stream>::iterator Temp=Stream.begin(); Temp!=Stream.end(); Temp++)
+ {
+ if (Temp->second.DisplayAspectRatio!=0)
+ {
+ 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)
+ {
+ Ztring Duration_Temp, Codec_Temp;
+ StreamKind_Last=Temp->second.StreamKind;
+ StreamPos_Last=Temp->second.StreamPos;
+ 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_Resolution); //Resolution is not valid for AAC / MPEG Audio / Vorbis
+
+ //Video specific
+ if (StreamKind_Last==Stream_Video)
+ {
+ //FrameRate
+ if (Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate).empty()&& Temp->second.TimeCodes.size()>1)
+ {
+ //Trying to detect VFR
+ std::vector<int64s> FrameRate_Between;
+ std::sort(Temp->second.TimeCodes.begin(), Temp->second.TimeCodes.end()); //This is PTS, no DTS --> Some frames are out of order
+ for (size_t Pos=1; Pos<Temp->second.TimeCodes.size(); Pos++)
+ FrameRate_Between.push_back(Temp->second.TimeCodes[Pos]-Temp->second.TimeCodes[Pos-1]);
+ if (FrameRate_Between.size()>31)
+ FrameRate_Between.resize(31); //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[0]*0.9<FrameRate_Between[FrameRate_Between.size()-1]
+ && FrameRate_Between[0]*1.1>FrameRate_Between[FrameRate_Between.size()-1])
+ {
+ float Time=0;
+ if (Temp->second.TimeCodes.size()>30)
+ Time=(float)(Temp->second.TimeCodes[30]-Temp->second.TimeCodes[0])/30; //30 frames for handling 30 fps rounding problems
+ if (Time)
+ {
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate, 1000/Time);
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Mode, "CFR");
+ }
+ }
+ else
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Mode, "VFR");
+ }
+ }
+
+ //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, "Delay", Delay, 0, true);
+ if (Retrieve(Stream_Video, 0, Video_Delay).empty())
+ Fill(Stream_Video, 0, Video_Delay, 0, 10, true);
+ }
+ }
+ }
+
+ //Chapters
+ if (TimecodeScale)
+ {
+ for (EditionEntries_Pos=0; EditionEntries_Pos<EditionEntries.size(); EditionEntries_Pos++)
+ {
+ Stream_Prepare(Stream_Menu);
+ Fill(Stream_Menu, StreamPos_Last, Menu_Chapters_Pos_Begin, Count_Get(Stream_Menu, StreamPos_Last), 10, true);
+ for (ChapterAtoms_Pos=0; ChapterAtoms_Pos<EditionEntries[EditionEntries_Pos].ChapterAtoms.size(); ChapterAtoms_Pos++)
+ {
+ if (EditionEntries[EditionEntries_Pos].ChapterAtoms[ChapterAtoms_Pos].ChapterTimeStart!=(int64u)-1)
+ {
+ Ztring Text;
+ for (ChapterDisplays_Pos=0; ChapterDisplays_Pos<EditionEntries[EditionEntries_Pos].ChapterAtoms[ChapterAtoms_Pos].ChapterDisplays.size(); ChapterDisplays_Pos++)
+ {
+ Ztring PerLanguage;
+ if (!EditionEntries[EditionEntries_Pos].ChapterAtoms[ChapterAtoms_Pos].ChapterDisplays[ChapterDisplays_Pos].ChapLanguage.empty())
+ PerLanguage=MediaInfoLib::Config.Iso639_1_Get(EditionEntries[EditionEntries_Pos].ChapterAtoms[ChapterAtoms_Pos].ChapterDisplays[ChapterDisplays_Pos].ChapLanguage)+_T(':');
+ PerLanguage+=EditionEntries[EditionEntries_Pos].ChapterAtoms[ChapterAtoms_Pos].ChapterDisplays[ChapterDisplays_Pos].ChapString;
+ Text+=PerLanguage+_T(" - ");
+ }
+ if (Text.size())
+ Text.resize(Text.size()-3);
+ Fill(Stream_Menu, StreamPos_Last, Ztring().Duration_From_Milliseconds(EditionEntries[EditionEntries_Pos].ChapterAtoms[ChapterAtoms_Pos].ChapterTimeStart/1000000).To_UTF8().c_str(), Text);
+ }
+ }
+ Fill(Stream_Menu, StreamPos_Last, Menu_Chapters_Pos_End, Count_Get(Stream_Menu, StreamPos_Last), 10, true);
+ }
+ }
+
+ //Attachements
+ for (size_t Pos=0; Pos<AttachedFiles.size(); Pos++)
+ Fill(Stream_General, 0, "Cover", AttachedFiles[Pos]);
+
+ //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_Mk::Header_Parse()
+{
+ //Test of zero padding
+ int8u Null;
+ Peek_B1(Null);
+ if (Null==0x00)
+ {
+ Skip_B1( "Zero byte");
+ Header_Fill_Code((int32u)-1); //Should be (int64u)-1 but Borland C++ does not like this
+ Header_Fill_Size(1);
+ 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_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_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_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_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_DEFAULT
+ Finish("Matroska");
+ DATA_END_DEFAULT
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Mk::Zero()
+{
+ Element_Name("ZeroPadding");
+}
+
+//---------------------------------------------------------------------------
+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_Info(Data);
+
+ //Filling
+ FILLING_BEGIN();
+ Accept("Matroska");
+
+ if (Data==_T("matroska"))
+ Fill(Stream_General, 0, General_Format, "Matroska");
+ else if (Data==_T("webm"))
+ Fill(Stream_General, 0, General_Format, "WebM");
+ else
+ Fill(Stream_General, 0, General_Format, Data);
+
+ Buffer_MaximumSize=8*1024*1024;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Ebml_DocTypeVersion()
+{
+ Element_Name("DocTypeVersion");
+
+ //Parsing
+ UInteger_Info();
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Ebml_DocTypeReadVersion()
+{
+ Element_Name("DocTypeReadVersion");
+
+ //Parsing
+ UInteger_Info();
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment()
+{
+ Element_Name("Segment");
+}
+
+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<int64u, stream>::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 && Retrieve(Stream_Video, Temp->second.StreamPos, Video_FrameRate).empty())
+ Temp->second.Searching_TimeStamps=true;
+ if (Temp->second.Searching_Payload
+ || Temp->second.Searching_TimeStamp_Start
+ || Temp->second.Searching_TimeStamps)
+ Stream_Count++;
+ Temp++;
+ }
+
+ //We must parse moov?
+ if (Stream_Count==0)
+ {
+ //Jumping
+ Finish("Matroska");//Skip_XX(Element_TotalSize_Get(), "Data");
+ return;
+ }
+ }
+ Cluster_AlreadyParsed=true;
+ Segment_Cluster_TimeCode_Value=0; //Default
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Cluster_BlockGroup()
+{
+ Element_Name("BlockGroup");
+}
+
+//---------------------------------------------------------------------------
+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)
+ {
+ Element_DoNotShow();
+ return;
+ }
+
+ //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;
+ }
+ FILLING_END();
+
+ if (Stream[TrackNumber].Searching_Payload)
+ {
+ std::vector<int64u> Laces;
+ int32u Lacing;
+ Element_Begin("Flags", 1);
+ 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_End();
+ if (Lacing>0)
+ {
+ Element_Begin("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; Pos<FrameCountMinus1; Pos++)
+ {
+ int32u Size=0;
+ int8u Size8;
+ do
+ {
+ Get_B1 (Size8, "Size");
+ Size+=Size8;
+ }
+ while (Size8==0xFF);
+ Param_Info(Size);
+ Element_Offset_Virtual+=Size;
+ Laces.push_back(Size);
+ }
+ Laces.push_back(Element_Size-Element_Offset-Element_Offset_Virtual); //last lace
+ }
+ break;
+ case 2 : //Fixed-size lacing - No more data
+ {
+ int64u Size=(Element_Size-Element_Offset)/(FrameCountMinus1+1);
+ Laces.resize(FrameCountMinus1+1, Size);
+ }
+ break;
+ case 3 : //EBML lacing
+ {
+ int64u Element_Offset_Virtual=0, Size;
+ Get_EB (Size, "Size");
+ Laces.push_back(Size);
+ Element_Offset_Virtual+=Size;
+ for (int8u Pos=1; Pos<FrameCountMinus1; Pos++)
+ {
+ int64s Diff;
+ Get_ES (Diff, "Difference");
+ Size+=Diff; Param_Info(Size);
+ Element_Offset_Virtual+=Size;
+ Laces.push_back(Size);
+ }
+ Laces.push_back(Element_Size-Element_Offset-Element_Offset_Virtual); Param_Info(Size); //last lace
+ }
+ break;
+ default : ; //Should never be here
+ }
+ Element_End();
+ }
+ else
+ Laces.push_back(Element_Size-Element_Offset);
+
+ FILLING_BEGIN();
+ //Parsing
+ for (size_t Pos=0; Pos<Laces.size(); Pos++)
+ {
+ //Content compression
+ if (Stream[TrackNumber].ContentCompAlgo!=(int32u)-1 && Stream[TrackNumber].ContentCompAlgo!=3)
+ Stream[TrackNumber].Searching_Payload=false; //Unsupported
+
+ //Integrity test
+ if (Element_Offset+Laces[Pos]>Element_Size)
+ Stream[TrackNumber].Searching_Payload=false; //There is a problem
+
+ if (Stream[TrackNumber].Searching_Payload)
+ {
+ //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");
+ }
+
+ //Filling
+ if (!Stream[TrackNumber].Searching_Payload && !Stream[TrackNumber].Searching_TimeStamps && !Stream[TrackNumber].Searching_TimeStamp_Start)
+ Stream_Count--;
+ if (Stream_Count==0)
+ {
+ //Jumping
+ Element_Show();
+ Element_End(); //Block
+ Info("Cluster, no need of more");
+ Element_End(); //BlockGroup
+ Finish("Matroska"); //GoTo(File_Offset+Buffer_Offset+Element_TotalSize_Get());
+ }
+
+ 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
+ UInteger_Info();
+}
+
+//---------------------------------------------------------------------------
+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_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_Info(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
+ UInteger_Info();
+}
+
+//---------------------------------------------------------------------------
+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");
+}
+
+//---------------------------------------------------------------------------
+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
+ UInteger_Info();
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tags()
+{
+ Element_Name("Tags");
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tags_Tag()
+{
+ Element_Name("Tag");
+}
+
+//---------------------------------------------------------------------------
+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_Info(Data);
+
+ FILLING_BEGIN();
+ Fill(StreamKind_Last, StreamPos_Last, "Language", Data);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tags_Tag_SimpleTag_TagName()
+{
+ Element_Name("TagName");
+
+ //Parsing
+ UTF8_Info();
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tags_Tag_SimpleTag_TagString()
+{
+ Element_Name("TagString");
+
+ //Parsing
+ UTF8_Info();
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tags_Tag_Targets()
+{
+ Element_Name("Targets");
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tags_Tag_Targets_AttachmentUID()
+{
+ Element_Name("AttachmentUID");
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tags_Tag_Targets_ChapterUID()
+{
+ Element_Name("ChapterUID");
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tags_Tag_Targets_EditionUID()
+{
+ Element_Name("EditionUID");
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tags_Tag_Targets_TargetType()
+{
+ Element_Name("TargetType");
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tags_Tag_Targets_TargetTypeValue()
+{
+ Element_Name("TargetTypeValue");
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tags_Tag_Targets_TrackUID()
+{
+ Element_Name("TrackUID");
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tracks()
+{
+ Element_Name("Tracks");
+
+ if (Cluster_AlreadyParsed)
+ Skip_XX(Element_TotalSize_Get(), "Alreadys parsed, skipping");
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tracks_TrackEntry()
+{
+ Element_Name("TrackEntry");
+
+ //Clearing
+ CodecID.clear();
+ InfoCodecID_Format_Type=InfoCodecID_Format_Matroska;
+ TrackType=(int64u)-1;
+ TrackNumber=(int64u)-1;
+ TrackDefaultDuration=0;
+ TrackVideoDisplayWidth=0;
+ TrackVideoDisplayHeight=0;
+ AvgBytesPerSec=0;
+
+ //Preparing
+ Stream_Prepare(Stream_Max);
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tracks_TrackEntry_AttachmentLink()
+{
+ Element_Name("AttachmentLink");
+
+ //Parsing
+ UInteger_Info();
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tracks_TrackEntry_Audio()
+{
+ Element_Name("Audio");
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tracks_TrackEntry_Audio_BitDepth()
+{
+ Element_Name("BitDepth");
+
+ //Parsing
+ int64u UInteger=UInteger_Get();
+
+ FILLING_BEGIN();
+ Fill(StreamKind_Last, StreamPos_Last, "Resolution", UInteger, 10, true);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tracks_TrackEntry_Audio_Channels()
+{
+ Element_Name("Channels");
+
+ //Parsing
+ int64u UInteger=UInteger_Get();
+
+ FILLING_BEGIN();
+ Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, UInteger, 10, true);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tracks_TrackEntry_Audio_OutputSamplingFrequency()
+{
+ Element_Name("OutputSamplingFrequency");
+
+ //Parsing
+ float64 Float=Float_Get();
+
+ FILLING_BEGIN();
+ Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, Float, 0, true);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tracks_TrackEntry_Audio_SamplingFrequency()
+{
+ Element_Name("SamplingFrequency");
+
+ //Parsing
+ float64 Float=Float_Get();
+
+ FILLING_BEGIN();
+ Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, Float, 0, true);
+ 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_Info(Data);
+
+ FILLING_BEGIN();
+ CodecID=Data;
+ CodecID_Manage();
+ CodecPrivate_Manage();
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tracks_TrackEntry_ContentEncodings_ContentEncoding_Compression_ContentCompAlgo()
+{
+ //Parsing
+ int64u Algo=UInteger_Get(); Param_Info(Mk_ContentCompAlgo(Algo));
+
+ FILLING_BEGIN();
+ Stream[TrackNumber].ContentCompAlgo=Algo;
+ 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_Info("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_Resolution, 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 (0);
+ #if defined(MEDIAINFO_PCM_YES)
+ else 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.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_Info("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, "Resolution", 8);
+ else if (Compression==0x44495633) //DIV3
+ Fill(StreamKind_Last, StreamPos_Last, "Resolution", 8);
+ else if (Compression==0x44585342) //DXSB
+ Fill(StreamKind_Last, StreamPos_Last, "Resolution", 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, "Resolution", 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, "Resolution", Resolution/4); //With Alpha
+ }
+ else
+ Fill(StreamKind_Last, StreamPos_Last, "Resolution", 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, "Resolution", Resolution/3);
+ }
+
+ //Creating the parser
+ CodecID_Manage();
+
+ FILLING_END()
+
+ if (Data_Remain())
+ {
+ Element_Begin("Private data");
+ if (Stream[TrackNumber].Parser)
+ Open_Buffer_Continue(Stream[TrackNumber].Parser);
+ else
+ Skip_XX(Data_Remain(), "Unknown");
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tracks_TrackEntry_DefaultDuration()
+{
+ Element_Name("DefaultDuration");
+
+ //Parsing
+ int64u UInteger=UInteger_Get();
+
+ FILLING_BEGIN();
+ TrackDefaultDuration=UInteger;
+ //FrameRate
+ if (TrackDefaultDuration && StreamKind_Last==Stream_Video)
+ {
+ float64 FrameRate=1000000000.0/TrackDefaultDuration;
+ if (FrameRate>=23.975 && FrameRate<=23.977)
+ FrameRate=23.976; //One example was seen with 23.975
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate, FrameRate, 3, true);
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tracks_TrackEntry_FlagDefault()
+{
+ Element_Name("FlagDefault");
+
+ //Parsing
+ UInteger_Info();
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tracks_TrackEntry_FlagEnabled()
+{
+ Element_Name("FlagEnabled");
+
+ //Parsing
+ UInteger_Info();
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Segment_Tracks_TrackEntry_FlagForced()
+{
+ Element_Name("FlagForced");
+
+ //Parsing
+ UInteger_Info();
+}
+
+//---------------------------------------------------------------------------
+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_Info(Data);
+
+ FILLING_BEGIN();
+ Fill(StreamKind_Last, StreamPos_Last, "Language", Data);
+ 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_Info(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);
+ //FrameRate
+ if (TrackDefaultDuration)
+ {
+ float64 FrameRate=1000000000.0/TrackDefaultDuration;
+ if (FrameRate>=23.975 && FrameRate<=23.977)
+ FrameRate=23.976; //One example was seen with 23.975
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate, FrameRate, 3, true);
+ }
+ 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_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);
+ 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);
+ 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_Info(Data);
+ return;
+ }
+ case 2 :
+ {
+ Info_B2(Data, "Data"); Element_Info(Data);
+ return;
+ }
+ case 3 :
+ {
+ Info_B3(Data, "Data"); Element_Info(Data);
+ return;
+ }
+ case 4 :
+ {
+ Info_B4(Data, "Data"); Element_Info(Data);
+ return;
+ }
+ case 5 :
+ {
+ Info_B5(Data, "Data"); Element_Info(Data);
+ return;
+ }
+ case 6 :
+ {
+ Info_B6(Data, "Data"); Element_Info(Data);
+ return;
+ }
+ case 7 :
+ {
+ Info_B7(Data, "Data"); Element_Info(Data);
+ return;
+ }
+ case 8 :
+ {
+ Info_B8(Data, "Data"); Element_Info(Data);
+ return;
+ }
+ case 16:
+ {
+ Info_B16(Data, "Data"); Element_Info(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_Info(Data);
+ return Data;
+ }
+ case 2 :
+ {
+ int16u Data;
+ Get_B2 (Data, "Data"); Element_Info(Data);
+ return Data;
+ }
+ case 3 :
+ {
+ int32u Data;
+ Get_B3 (Data, "Data"); Element_Info(Data);
+ return Data;
+ }
+ case 4 :
+ {
+ int32u Data;
+ Get_B4 (Data, "Data"); Element_Info(Data);
+ return Data;
+ }
+ case 5 :
+ {
+ int64u Data;
+ Get_B5 (Data, "Data"); Element_Info(Data);
+ return Data;
+ }
+ case 6 :
+ {
+ int64u Data;
+ Get_B6 (Data, "Data"); Element_Info(Data);
+ return Data;
+ }
+ case 7 :
+ {
+ int64u Data;
+ Get_B7 (Data, "Data"); Element_Info(Data);
+ return Data;
+ }
+ case 8 :
+ {
+ int64u Data;
+ Get_B8 (Data, "Data"); Element_Info(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_Info(Data);
+ return Data;
+ }
+ case 8 :
+ {
+ float64 Data;
+ Get_BF8(Data, "Data"); Element_Info(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_Info(Data);
+ return;
+ }
+ case 8 :
+ {
+ Info_BF8(Data, "Data"); Element_Info(Data);
+ return;
+ }
+ default : Skip_XX(Element_Size, "Data");
+ return;
+ }
+}
+
+//---------------------------------------------------------------------------
+Ztring File_Mk::UTF8_Get()
+{
+ Ztring Data;
+ Get_UTF8(Element_Size, Data, "Data"); Element_Info(Data);
+ return Data;
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::UTF8_Info()
+{
+ Info_UTF8(Element_Size, Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+Ztring File_Mk::Local_Get()
+{
+ Ztring Data;
+ Get_Local(Element_Size, Data, "Data"); Element_Info(Data);
+ return Data;
+}
+
+//---------------------------------------------------------------------------
+void File_Mk::Local_Info()
+{
+ Info_Local(Element_Size, Data, "Data"); Element_Info(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
+ const Ztring &Format=MediaInfoLib::Config.CodecID_Get(StreamKind_Last, InfoCodecID_Format_Type, CodecID, InfoCodecID_Format);
+ 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_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_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_MPEG4_YES)
+ else if (CodecID==(_T("A_AAC")))
+ {
+ Stream[TrackNumber].Parser=new File_Mpeg4_AudioSpecificConfig;
+ }
+ #endif
+ #if defined(MEDIAINFO_AAC_YES)
+ else if (CodecID.find(_T("A_AAC/"))==0)
+ {
+ Stream[TrackNumber].Parser=new File_Aac;
+ ((File_Aac*)Stream[TrackNumber].Parser)->Codec=CodecID;
+ }
+ #endif
+ #if defined(MEDIAINFO_ADTS_YES)
+ else if (Format==(_T("AAC")))
+ {
+ Stream[TrackNumber].Parser=new File_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_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
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Mk.h b/src/thirdparty/MediaInfo/Multiple/File_Mk.h
new file mode 100644
index 000000000..c860b501b
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Mk.h
@@ -0,0 +1,337 @@
+// File_Mk - Info for Matroska Video/Audio files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Matroska files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_MatroskaH
+#define MediaInfo_File_MatroskaH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include <map>
+//---------------------------------------------------------------------------
+
+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_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_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<int64u> 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;
+ bool Searching_Payload;
+ bool Searching_TimeStamps;
+ bool Searching_TimeStamp_Start;
+ int64u ContentCompAlgo;
+ size_t ContentCompSettings_Buffer_Size;
+ int8u* ContentCompSettings_Buffer;
+
+ stream()
+ {
+ TimeCode_Start=(int64u)-1;
+ Parser=NULL;
+ StreamKind=Stream_Max;
+ StreamPos=0;
+ PacketCount=0;
+ AvgBytesPerSec=0;
+ DisplayAspectRatio=0;
+ Searching_Payload=false;
+ Searching_TimeStamps=false;
+ Searching_TimeStamp_Start=false;
+ ContentCompAlgo=(int32u)-1;
+ ContentCompSettings_Buffer_Size=0;
+ ContentCompSettings_Buffer=NULL;
+ }
+
+ ~stream()
+ {
+ delete Parser; //Parser=NULL;
+ delete ContentCompSettings_Buffer; //ContentCompSettings_Buffer=NULL;
+ }
+ };
+ std::map<int64u, stream> Stream;
+ size_t Stream_Count;
+
+ //Data
+ int64u UInteger_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<Ztring> AttachedFiles;
+ int64u TimecodeScale;
+ float64 Duration;
+ int64u TrackNumber;
+ int64u TrackDefaultDuration;
+ 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<chapterdisplay> ChapterDisplays;
+
+ chapteratom()
+ {
+ ChapterTimeStart=(int64u)-1;
+ }
+ };
+ struct editionentry
+ {
+ std::vector<chapteratom> ChapterAtoms;
+ };
+ std::vector<editionentry> EditionEntries;
+ size_t EditionEntries_Pos;
+ size_t ChapterAtoms_Pos;
+ size_t ChapterDisplays_Pos;
+};
+
+} //NameSpace
+
+#endif
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Mpeg4.cpp b/src/thirdparty/MediaInfo/Multiple/File_Mpeg4.cpp
new file mode 100644
index 000000000..8ca37bb46
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Mpeg4.cpp
@@ -0,0 +1,697 @@
+// File_Mpeg4 - Info for MPEG-4 files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Main part
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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
+//---------------------------------------------------------------------------
+
+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___aut=0xA9617574;
+ 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___mak=0xA96D616B;
+ const int64u moov_meta___mod=0xA96D6F64;
+ const int64u moov_meta___nam=0xA96E616D;
+ 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___src=0xA9737263;
+ const int64u moov_meta___swr=0xA9737772;
+ const int64u moov_meta___too=0xA9746F6F;
+ const int64u moov_meta___wrn=0xA977726E;
+ const int64u moov_meta___wrt=0xA9777274;
+ const int64u moov_meta__aART=0x61415254;
+ const int64u moov_meta__albm=0x616C626D;
+ const int64u moov_meta__auth=0x61757468;
+ const int64u moov_meta__cpil=0x6370696C;
+ const int64u moov_meta__cprt=0x63707274;
+ const int64u moov_meta__covr=0x636F7672;
+ const int64u moov_meta__disk=0x6469736B;
+ const int64u moov_meta__dscp=0x64736370;
+ const int64u moov_meta__gnre=0x676E7265;
+ const int64u moov_meta__name=0x6E616D65;
+ const int64u moov_meta__perf=0x70657266;
+ const int64u moov_meta__pgap=0x70676170;
+ 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__year=0x79656172;
+ 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);
+ }
+}
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Mpeg4::File_Mpeg4()
+:File__Analyze()
+{
+ //Configuration
+ #if MEDIAINFO_EVENTS
+ ParserIDs[0]=MediaInfo_Parser_Mpeg4;
+ StreamIDs_Width[0]=8;
+ #endif //MEDIAINFO_EVENTS
+ DataMustAlwaysBeComplete=false;
+
+ //Temp
+ mdat_MustParse=false;
+ moov_Done=false;
+ moov_trak_mdia_mdhd_TimeScale=0;
+ TimeScale=1;
+ Vendor=0x00000000;
+ IsParsing_mdat=false;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::Streams_Finish()
+{
+ int64u File_Size_Total=File_Size;
+
+ //For each stream
+ std::map<int32u, stream>::iterator Temp=Stream.begin();
+ while (Temp!=Stream.end())
+ {
+ //Preparing
+ StreamKind_Last=Temp->second.StreamKind;
+ StreamPos_Last=Temp->second.StreamPos;
+
+ //Parser specific
+ if (Temp->second.Parser)
+ {
+ //Finalizing and Merging
+ Finish(Temp->second.Parser);
+ if (StreamKind_Last==Stream_General)
+ {
+ //Special case for TimeCode without link
+ for (std::map<int32u, stream>::iterator Target=Stream.begin(); Target!=Stream.end(); Target++)
+ if (Target->second.StreamKind!=Stream_General)
+ Merge(*Temp->second.Parser, Target->second.StreamKind, 0, Target->second.StreamPos);
+ }
+ else
+ {
+ //Hacks - Before
+ Ztring FrameRate_Temp, FrameRate_Mode_Temp, Delay_Temp;
+ if (StreamKind_Last==Stream_Video)
+ {
+ if (Temp->second.Parser && Retrieve(Stream_Video, 0, Video_CodecID_Hint)==_T("DVCPRO HD"))
+ {
+ Temp->second.Parser->Clear(Stream_Video, 0, Video_FrameRate);
+ Temp->second.Parser->Clear(Stream_Video, 0, Video_Width);
+ Temp->second.Parser->Clear(Stream_Video, 0, Video_Height);
+ Temp->second.Parser->Clear(Stream_Video, 0, Video_DisplayAspectRatio);
+ Temp->second.Parser->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);
+ Delay_Temp=Retrieve(Stream_Video, StreamPos_Last, Video_Delay);
+ }
+
+ //Temp->second.Parser->Clear(StreamKind_Last, StreamPos_Last, "Delay"); //DV TimeCode is removed
+ Merge(*Temp->second.Parser, StreamKind_Last, 0, StreamPos_Last);
+
+ //Hacks - After
+ if (StreamKind_Last==Stream_Video)
+ {
+ 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))
+ {
+ Fill(Stream_Video, StreamPos_Last, Video_Delay_Original, Delay_Temp);
+ for (size_t Pos=0; Pos<Count_Get(Stream_Audio); Pos++)
+ if (Retrieve(Stream_Audio, Pos, "MuxingMode_MoreInfo")==_T("Muxed in Video #1"))
+ {
+ //Fill(Stream_Audio, Pos, Audio_Delay_Original, Retrieve(Stream_Audio, Pos, Audio_Delay));
+ Fill(Stream_Audio, Pos, Audio_Delay, Retrieve(Stream_Video, StreamPos_Last, Video_Delay), true);
+ }
+ for (size_t Pos=0; Pos<Count_Get(Stream_Text); Pos++)
+ if (Retrieve(Stream_Text, Pos, "MuxingMode_MoreInfo")==_T("Muxed in Video #1"))
+ {
+ //Fill(Stream_Text, Pos, Text_Delay_Original, Retrieve(Stream_Text, Pos, Text_Delay));
+ Fill(Stream_Text, Pos, Text_Delay, Retrieve(Stream_Video, StreamPos_Last, Video_Delay), true);
+ }
+ }
+ }
+
+ //TimeCode specific
+ if (StreamKind_Last==Stream_Video && Retrieve(Stream_Menu, StreamPos_Last, Menu_Format)==_T("TimeCode"))
+ {
+ Clear(Stream_Menu, StreamPos_Last, "Duration");
+ Clear(Stream_Menu, StreamPos_Last, "StreamSize");
+ }
+
+ //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_Resolution); //Resolution is not valid for AAC / MPEG Audio / Vorbis
+
+ //Special case: DV with Audio or/and Text in the video stream
+ if (StreamKind_Last==Stream_Video && Temp->second.Parser && (Temp->second.Parser->Count_Get(Stream_Audio) || Temp->second.Parser->Count_Get(Stream_Text)))
+ {
+ //Video and Audio are together
+ size_t Audio_Count=Temp->second.Parser->Count_Get(Stream_Audio);
+ for (size_t Audio_Pos=0; Audio_Pos<Audio_Count; Audio_Pos++)
+ {
+ Fill_Flush();
+ Stream_Prepare(Stream_Audio);
+ size_t Pos=Count_Get(Stream_Audio)-1;
+ Merge(*Temp->second.Parser, 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));
+ Fill(Stream_Audio, Pos, Audio_StreamSize, 0, 10, true); //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.Parser->Count_Get(Stream_Text);
+ for (size_t Text_Pos=0; Text_Pos<Text_Count; Text_Pos++)
+ {
+ Fill_Flush();
+ Stream_Prepare(Stream_Text);
+ size_t Pos=Count_Get(Stream_Text)-1;
+ Merge(*Temp->second.Parser, 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, 0, 10, true); //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"));
+ }
+ }
+ }
+ }
+
+ //External file name specific
+ if (!Temp->second.File_Name.empty())
+ {
+ //Configuring file name
+ Ztring AbsoluteName=ZenLib::FileName::Path_Get(File_Name);
+ if (!AbsoluteName.empty())
+ AbsoluteName+=ZenLib::PathSeparator;
+ AbsoluteName+=Temp->second.File_Name;
+
+ MediaInfo_Internal MI;
+ MI.Option(_T("File_StopAfterFilled"), _T("1"));
+ MI.Option(_T("File_KeepInfo"), _T("1"));
+ Fill(Temp->second.StreamKind, Temp->second.StreamPos, "Source", Temp->second.File_Name);
+
+ if (MI.Open(AbsoluteName))
+ {
+ //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));
+
+ Merge(*(MI.Info), Temp->second.StreamKind, 0, Temp->second.StreamPos);
+ File_Size_Total+=Ztring(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);
+ }
+
+ //Special case: DV with Audio or/and Text in the video stream
+ if (StreamKind_Last==Stream_Video && MI.Info && (MI.Info->Count_Get(Stream_Audio) || MI.Info->Count_Get(Stream_Text)))
+ {
+ //Video and Audio are together
+ size_t Audio_Count=MI.Info->Count_Get(Stream_Audio);
+ for (size_t Audio_Pos=0; Audio_Pos<Audio_Count; Audio_Pos++)
+ {
+ Fill_Flush();
+ Stream_Prepare(Stream_Audio);
+ size_t Pos=Count_Get(Stream_Audio)-1;
+ Merge(*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, 0, 10, true); //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=MI.Info->Count_Get(Stream_Text);
+ for (size_t Text_Pos=0; Text_Pos<Text_Count; Text_Pos++)
+ {
+ Fill_Flush();
+ Stream_Prepare(Stream_Text);
+ size_t Pos=Count_Get(Stream_Text)-1;
+ Merge(*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, 0, 10, true); //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"));
+ }
+ }
+ }
+ else
+ Fill(Temp->second.StreamKind, Temp->second.StreamPos, "Source_Info", "Missing");
+
+ }
+
+ Temp++;
+ }
+ if (Vendor!=0x00000000 && Vendor!=0xFFFFFFFF)
+ {
+ Ztring VendorS=Mpeg4_Encoded_Library(Vendor);
+ if (!Vendor_Version.empty())
+ {
+ VendorS+=_T(' ');
+ VendorS+=Vendor_Version;
+ }
+ Fill(Stream_General, 0, General_Encoded_Library, VendorS);
+ Fill(Stream_General, 0, General_Encoded_Library_Name, Mpeg4_Encoded_Library(Vendor));
+ Fill(Stream_General, 0, General_Encoded_Library_Version, Vendor_Version);
+ }
+
+ if (File_Size_Total!=File_Size)
+ Fill(Stream_General, 0, General_FileSize, File_Size_Total, 10, true);
+ if (Count_Get(Stream_Video)==0 && Count_Get(Stream_Image)==0 && Count_Get(Stream_Audio)>0)
+ Fill(Stream_General, 0, General_InternetMediaType, "audio/mp4", 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();
+ mdat_Pos.clear();
+ }
+
+ //Commercial names
+ 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"))
+ {
+ 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"))
+ {
+ 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"))
+ {
+ 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")))
+ {
+ Fill(Stream_General, 0, General_Format_Commercial_IfAny, "XDCAM EX422");
+ Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "XDCAM EX422");
+ }
+ }
+}
+
+//***************************************************************************
+// Buffer
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Mpeg4::Header_Begin()
+{
+ if (IsParsing_mdat && Element_Level==0)
+ Element_Begin();
+
+ return true;
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::Header_Parse()
+{
+ //mdat
+ if (IsParsing_mdat)
+ {
+ //Positionning
+ if (File_Offset+Buffer_Offset<mdat_Pos.begin()->first)
+ {
+ if (File_Offset+Buffer_Size>mdat_Pos.begin()->first)
+ {
+ Buffer_Offset=(size_t)(File_Offset+Buffer_Size-mdat_Pos.begin()->first);
+ }
+ else
+ {
+ Buffer_Offset=Buffer_Size;
+ return;
+ }
+ }
+
+ //Filling
+ Header_Fill_Code(mdat_Pos.begin()->second.StreamID, Ztring::ToZtring(mdat_Pos.begin()->second.StreamID));
+ Header_Fill_Size(mdat_Pos.begin()->second.Size);
+ if (Buffer_Offset+mdat_Pos.begin()->second.Size<=Buffer_Size)
+ mdat_Pos.erase(mdat_Pos.begin()); //Only if we will not need it later (in case of partial data, this function will be called again for the same chunk)
+ 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 (Size<8)
+ {
+ //Special case: until the end of the atom
+ if (Size==0)
+ {
+ Size=File_Size-(File_Offset+Buffer_Offset);
+ }
+ //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=File_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);
+}
+
+//---------------------------------------------------------------------------
+bool File_Mpeg4::BookMark_Needed()
+{
+ if (Stream.empty())
+ return false;
+
+ GoTo(0, "MPEG-4"); //Reseting it
+ return true;
+}
+
+//---------------------------------------------------------------------------
+//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)
+{
+ switch (Meta)
+ {
+ //http://atomicparsley.sourceforge.net/mpeg-4files.html
+ case Elements::moov_meta___ART : Parameter="Performer"; return Method_String;
+ case Elements::moov_meta___alb : Parameter="Album"; return Method_String;
+ case Elements::moov_meta___aut : Parameter="Performer"; return Method_String;
+ case Elements::moov_meta___cmt : Parameter="Comment"; return Method_String;
+ case Elements::moov_meta___cpy : Parameter="Copyright"; return Method_String;
+ case Elements::moov_meta___day : Parameter="Encoded_Date"; return Method_String;
+ case Elements::moov_meta___des : Parameter="Title/More"; return Method_String;
+ case Elements::moov_meta___dir : Parameter="Director"; return Method_String;
+ case Elements::moov_meta___dis : Parameter="TermsOfUse"; return Method_String;
+ case Elements::moov_meta___edl : Parameter="Tagged_Date"; return Method_String;
+ case Elements::moov_meta___enc : Parameter="Encoded_Application"; return Method_String;
+ case Elements::moov_meta___fmt : Parameter="Origin"; return Method_String;
+ case Elements::moov_meta___gen : Parameter="Genre"; return Method_String;
+ case Elements::moov_meta___grp : Parameter="Genre"; return Method_String;
+ case Elements::moov_meta___hos : Parameter="HostComputer"; return Method_String;
+ case Elements::moov_meta___inf : Parameter="Title/More"; return Method_String;
+ case Elements::moov_meta___key : Parameter="Keywords"; return Method_String;
+ case Elements::moov_meta___mak : Parameter="Make"; return Method_String;
+ case Elements::moov_meta___mod : Parameter="Model"; return Method_String;
+ case Elements::moov_meta___nam : Parameter="Title"; return Method_String3;
+ case Elements::moov_meta___prd : Parameter="Producer"; return Method_String;
+ case Elements::moov_meta___PRD : Parameter="Product"; return Method_String;
+ case Elements::moov_meta___prf : Parameter="Performer"; return Method_String;
+ case Elements::moov_meta___req : Parameter="Comment"; return Method_String;
+ case Elements::moov_meta___src : Parameter="DistribtedBy"; return Method_String;
+ case Elements::moov_meta___swr : Parameter="Encoded_Application"; return Method_String;
+ case Elements::moov_meta___too : Parameter="Encoded_Application"; return Method_String;
+ case Elements::moov_meta___wrn : Parameter="Warning"; return Method_String;
+ case Elements::moov_meta___wrt : Parameter="ScreenplayBy"; return Method_String;
+ case Elements::moov_meta__auth : Parameter="Performer"; return Method_String2;
+ case Elements::moov_meta__albm : Parameter="Album"; return Method_String2; //Has a optional track number after the NULL byte
+ case Elements::moov_meta__aART : Parameter="Performer"; return Method_String2;
+ case Elements::moov_meta__cpil : Parameter.clear(); return Method_None;
+ case Elements::moov_meta__cprt : Parameter="Copyright"; return Method_String2;
+ case Elements::moov_meta__disk : Parameter="Part"; return Method_Binary;
+ case Elements::moov_meta__dscp : Parameter="Title/More"; return Method_String2;
+ case Elements::moov_meta__gnre : Parameter="Genre"; return Method_String2;
+ case Elements::moov_meta__name : Parameter="Title"; return Method_String;
+ case Elements::moov_meta__perf : Parameter="Performer"; return Method_String2;
+ case Elements::moov_meta__pgap : Parameter.clear(); return Method_None;
+ case Elements::moov_meta__titl : Parameter="Title"; return Method_String2;
+ case Elements::moov_meta__tool : Parameter="Encoded_Application"; return Method_String3;
+ case Elements::moov_meta__trkn : Parameter="Track"; return Method_Binary;
+ case Elements::moov_meta__year : Parameter="Recorded_Date"; return Method_String2;
+ case Elements::moov_meta__tmpo : Parameter.clear(); return Method_None;
+ 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));
+ return Method_String;
+ }
+ }
+}
+
+//---------------------------------------------------------------------------
+//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=="iTunNORM") Parameter="";
+ else if (Meta=="iTunes_CDDB_IDs") Parameter="";
+ else if (Meta=="iTunSMPB") Parameter="";
+ else Parameter=Meta;
+ return Method_String;
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::Descriptors()
+{
+ //Preparing
+ File_Mpeg4_Descriptors MI;
+ MI.KindOfStream=StreamKind_Last;
+ MI.ftyps=ftyps;
+ MI.Channels_AreTrustable=Stream[moov_trak_tkhd_TrackID].Channels_AreTrustable;
+ MI.Parser_DoNotFreeIt=true;
+ Open_Buffer_Init(&MI);
+
+ //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_Resolution); //Resolution is not valid for AAC / MPEG Audio / Vorbis
+
+ //Parser from Descriptor
+ if (MI.Parser)
+ {
+ if (Stream[moov_trak_tkhd_TrackID].Parser)
+ delete Stream[moov_trak_tkhd_TrackID].Parser; //Stream[moov_trak_tkhd_TrackID].Parser=NULL
+ Stream[moov_trak_tkhd_TrackID].Parser=MI.Parser;
+ mdat_MustParse=true;
+ }
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_MPEG4_YES
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Mpeg4.h b/src/thirdparty/MediaInfo/Multiple/File_Mpeg4.h
new file mode 100644
index 000000000..fd4920626
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Mpeg4.h
@@ -0,0 +1,323 @@
+// File_Mpeg4 - Info for MPEG-4 files
+// Copyright (C) 2004-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_Mpeg4H
+#define MediaInfo_File_Mpeg4H
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include <map>
+class File_MpegPs;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Mpeg4
+//***************************************************************************
+
+class File_Mpeg4 : public File__Analyze
+{
+protected :
+ //Streams management
+ void Streams_Finish();
+
+public :
+ File_Mpeg4();
+
+private :
+ //Buffer
+ bool Header_Begin();
+ void Header_Parse();
+ void Data_Parse();
+ bool BookMark_Needed();
+
+ //Elements
+ 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_StreamClear();
+ 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_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_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_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_xxxxVideo();
+ void moov_trak_mdia_minf_stbl_stsd_xxxx_avcC();
+ void moov_trak_mdia_minf_stbl_stsd_xxxx_alac();
+ 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_dec3();
+ void moov_trak_mdia_minf_stbl_stsd_xxxx_damr();
+ void moov_trak_mdia_minf_stbl_stsd_xxxx_esds();
+ void moov_trak_mdia_minf_stbl_stsd_xxxx_idfm();
+ void moov_trak_mdia_minf_stbl_stsd_xxxx_pasp();
+ 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_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_dpnd();
+ void moov_trak_tref_ipir();
+ void moov_trak_tref_hint();
+ void moov_trak_tref_mpod();
+ 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 PICT();
+ void pckg();
+ void pnot();
+ 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();
+
+ //Temp
+ bool List;
+ bool mdat_MustParse;
+ bool moov_Done;
+ int32u moov_cmov_dcom_Compressor;
+ int32u moov_meta_hdlr_Type;
+ std::string moov_meta_ilst_xxxx_name_Name;
+ int32u moov_trak_mdia_mdhd_Duration;
+ int32u moov_trak_mdia_mdhd_TimeScale;
+ 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<std::string> moov_udta_meta_keys_List;
+ size_t moov_udta_meta_keys_ilst_Pos;
+ std::vector<int32u> ftyps;
+ int32u TimeScale;
+ int32u Vendor;
+ Ztring Vendor_Version;
+
+ //Data
+ struct stream
+ {
+ Ztring File_Name;
+ File__Analyze* Parser;
+ stream_t StreamKind;
+ size_t StreamPos;
+ std::vector<int64u> stco;
+ struct stsc_struct
+ {
+ int32u FirstChunk;
+ int32u SamplesPerChunk;
+ };
+ std::vector<stsc_struct> stsc;
+ std::vector<int64u> stsz;
+ int64u stsz_Sample_Size;
+ int64u stsz_Sample_Count;
+ int32u TimeCode_TrackID;
+ bool TimeCode_IsVisual;
+ bool Channels_AreTrustable;
+
+ stream()
+ {
+ Parser=NULL;
+ StreamKind=Stream_Max;
+ StreamPos=0;
+ stsz_Sample_Size=0;
+ stsz_Sample_Count=0;
+ TimeCode_TrackID=(int32u)-1;
+ TimeCode_IsVisual=false;
+ Channels_AreTrustable=false;
+ }
+
+ ~stream()
+ {
+ delete Parser; //Parser=NULL;
+ }
+ };
+ std::map<int32u, stream> Stream;
+
+ //Positions
+ struct mdat_Pos_Type
+ {
+ int32u StreamID;
+ int64u Size;
+ };
+ std::map<int64u, mdat_Pos_Type> mdat_Pos;
+ bool IsParsing_mdat;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Mpeg4_Descriptors.cpp b/src/thirdparty/MediaInfo/Multiple/File_Mpeg4_Descriptors.cpp
new file mode 100644
index 000000000..505fd784f
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Mpeg4_Descriptors.cpp
@@ -0,0 +1,959 @@
+// File_Mpeg4 - Info for MPEG-4 files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Descriptors part
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#ifdef MEDIAINFO_MPEG4_YES
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Multiple/File_Mpeg4_Descriptors.h"
+#include <cstring>
+#if defined(MEDIAINFO_OGG_YES)
+ #include "MediaInfo/Multiple/File_Ogg.h"
+#endif
+#if defined(MEDIAINFO_MPEG4_YES)
+ #include "MediaInfo/Audio/File_Mpeg4_AudioSpecificConfig.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_AC3_YES)
+ #include "MediaInfo/Audio/File_Ac3.h"
+#endif
+#if defined(MEDIAINFO_ADTS_YES)
+ #include "MediaInfo/Audio/File_Adts.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
+//---------------------------------------------------------------------------
+
+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 (M-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 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)
+{
+ switch (ID)
+ {
+ default : 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()
+{
+ //In
+ KindOfStream=Stream_Max;
+ Parser_DoNotFreeIt=false;
+ DecSpecificInfoTag_DoNotFreeIt=false;
+ SLConfig_DoNotFreeIt=false;
+
+ //Out
+ Parser=NULL;
+ ES_ID=0x0000;
+ DecSpecificInfoTag=NULL;
+ SLConfig=NULL;
+
+ //Temp
+ ObjectTypeId=0x00;
+}
+
+//---------------------------------------------------------------------------
+File_Mpeg4_Descriptors::~File_Mpeg4_Descriptors()
+{
+ if (!Parser_DoNotFreeIt)
+ delete Parser;// Parser=NULL;
+ if (!DecSpecificInfoTag_DoNotFreeIt)
+ delete DecSpecificInfoTag; //DecSpecificInfoTag=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;
+ if (Count_Get(KindOfStream)==0)
+ Stream_Prepare(KindOfStream);
+
+ #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_02()
+{
+ //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");
+ }
+ Info_B1(ODProfileLevel, "ODProfileLevelIndication"); Param_Info(Mpeg4_Descriptors_ODProfileLevelIndication(ODProfileLevel));
+ Info_B1(SceneProfileLevel, "sceneProfileLevelIndication"); Param_Info(Mpeg4_Descriptors_SceneProfileLevelIndication(SceneProfileLevel));
+ Info_B1(AudioProfileLevel, "audioProfileLevelIndication"); Param_Info(Mpeg4_Descriptors_AudioProfileLevelIndication(AudioProfileLevel));
+ Info_B1(VisualProfileLevel, "visualProfileLevelIndication"); Param_Info(Mpeg4v_Profile_Level(VisualProfileLevel));
+ Info_B1(GraphicsProfileLevel, "graphicsProfileLevelIndication"); Param_Info(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;
+ Get_B1 (ObjectTypeId, "objectTypeIndication"); Param_Info(Mpeg4_Descriptors_ObjectTypeIndication(ObjectTypeId));
+ BS_Begin();
+ Info_S1(6, streamType, "streamType"); Param_Info(Mpeg4_Descriptors_StreamType(streamType));
+ Skip_SB( "upStream");
+ Skip_SB( "reserved");
+ BS_End();
+ Get_B3 (bufferSizeDB, "bufferSizeDB");
+ Get_B4 (MaxBitrate, "maxBitrate");
+ Get_B4 (AvgBitrate, "avgBitrate");
+
+ FILLING_BEGIN();
+ switch (ObjectTypeId)
+ {
+ case 0x01 : Fill(StreamKind_Last, StreamPos_Last, 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, "M-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 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, "M-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 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 0x20 : //MPEG-4 Visual
+ #if defined(MEDIAINFO_MPEG4V_YES)
+ Parser=new File_Mpeg4v;
+ ((File_Mpeg4v*)Parser)->Frame_Count_Valid=1;
+ ((File_Mpeg4v*)Parser)->FrameIsAlwaysComplete=true;
+ #endif
+ break;
+ case 0x21 : //AVC
+ #if defined(MEDIAINFO_AVC_YES)
+ Parser=new File_Avc;
+ ((File_Avc*)Parser)->MustParse_SPS_PPS=true;
+ ((File_Avc*)Parser)->MustSynchronize=false;
+ ((File_Avc*)Parser)->SizedBlocks=true;
+ #endif
+ break;
+ case 0x40 :
+ #if defined(MEDIAINFO_ADTS_YES)
+ Parser=new File_Adts; //This is often File_Mpeg4_AudioSpecificConfig, but this will be changed in DecSpecific if needed
+ #endif
+ break;
+ case 0x60 :
+ case 0x61 :
+ case 0x62 :
+ case 0x63 :
+ case 0x64 :
+ case 0x65 :
+ case 0x6A : //MPEG Video
+ #if defined(MEDIAINFO_MPEGV_YES)
+ Parser=new File_Mpegv;
+ ((File_Mpegv*)Parser)->Frame_Count_Valid=30; //For searching Pulldown
+ ((File_Mpegv*)Parser)->FrameIsAlwaysComplete=true;
+ #endif
+ break;
+ case 0x66 :
+ case 0x67 :
+ case 0x68 : //MPEG-2 AAC
+ #if defined(MEDIAINFO_MPEG4_YES)
+ Parser=new File_Mpeg4_AudioSpecificConfig; //Should be ADIF, but the only sample I have is AudioSpecificConfig
+ #endif
+ break;
+ case 0x69 :
+ case 0x6B : //MPEG Audio
+ #if defined(MEDIAINFO_MPEGA_YES)
+ Parser=new File_Mpega;
+ #endif
+ break;
+ case 0x6C : //M-JPEG
+ #if defined(MEDIAINFO_JPEG_YES)
+ Parser=new File_Jpeg;
+ ((File_Jpeg*)Parser)->StreamKind=Stream_Video;
+ #endif
+ break;
+ case 0x6D : //PNG
+ #if defined(MEDIAINFO_PNG_YES)
+ Parser=new File_Png;
+ #endif
+ break;
+ case 0xA3 : //VC-1
+ #if defined(MEDIAINFO_VC1_YES)
+ Parser=new File_Vc1;
+ #endif
+ break;
+ case 0xA4 : //Dirac
+ #if defined(MEDIAINFO_DIRAC_YES)
+ Parser=new File_Dirac;
+ #endif
+ break;
+ case 0xA5 : //AC-3
+ case 0xA6 : //E-AC-3
+ case 0xD3 : //AC-3
+ #if defined(MEDIAINFO_AC3_YES)
+ Parser=new File_Ac3;
+ #endif
+ break;
+ case 0xA9 : //DTS
+ case 0xAA : //DTS HRA
+ case 0xAB : //DTS MA
+ case 0xD4 : //DTS
+ #if defined(MEDIAINFO_DTS_YES)
+ Parser=new File_Dts;
+ #endif
+ break;
+ case 0xDD :
+ case 0xDE : //OGG
+ #if defined(MEDIAINFO_OGG_YES)
+ Parser=new File_Ogg;
+ Parser->MustSynchronize=false;
+ ((File_Ogg*)Parser)->SizedBlocks=true;
+ #endif
+ break;
+ default: ;
+ }
+
+ Open_Buffer_Init(Parser);
+
+ Element_ThisIsAList();
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4_Descriptors::Descriptor_05()
+{
+ if (ObjectTypeId==0x00 && Parser==NULL) //If no ObjectTypeId detected
+ {
+ switch (KindOfStream)
+ {
+ case Stream_Video :
+ #if defined(MEDIAINFO_MPEG4V_YES)
+ delete Parser; Parser=new File_Mpeg4v;
+ ((File_Mpeg4v*)Parser)->Frame_Count_Valid=1;
+ ((File_Mpeg4v*)Parser)->FrameIsAlwaysComplete=true;
+ #endif
+ break;
+ case Stream_Audio :
+ #if defined(MEDIAINFO_MPEG4_YES)
+ delete Parser; Parser=new File_Mpeg4_AudioSpecificConfig;
+ ((File_Mpeg4_AudioSpecificConfig*)Parser)->ftyps=ftyps;
+ ((File_Mpeg4_AudioSpecificConfig*)Parser)->Channels_AreTrustable=Channels_AreTrustable;
+ #endif
+ break;
+ default: ;
+ }
+ Open_Buffer_Init(Parser);
+ }
+
+ if (Parser==NULL)
+ {
+ Skip_XX(Element_Size, "Unknown");
+ return;
+ }
+
+ //Parser configuration before the parsing
+ switch (ObjectTypeId)
+ {
+ case 0x60 :
+ case 0x61 :
+ case 0x62 :
+ case 0x63 :
+ case 0x64 :
+ case 0x65 :
+ case 0x6A : //MPEG Video
+ #if defined(MEDIAINFO_MPEGV_YES)
+ ((File_Mpegv*)Parser)->TimeCodeIsNotTrustable=true;
+ #endif
+ break;
+ default: ;
+ }
+
+ //Specific cases
+ if (ObjectTypeId==0x40) //Audio ISO/IEC 14496-3 (AAC)
+ {
+ //IOD backup
+ delete DecSpecificInfoTag; DecSpecificInfoTag=new decspecificinfotag;
+ DecSpecificInfoTag->Buffer=new int8u[(size_t)Element_Size];
+ DecSpecificInfoTag->Buffer_Size=(size_t)Element_Size;
+ std::memcpy(DecSpecificInfoTag->Buffer, Buffer+Buffer_Offset, (size_t)Element_Size);
+
+ //There is an IOD, not ADTS
+ #ifdef MEDIAINFO_MPEG4_YES
+ delete Parser; Parser=new File_Mpeg4_AudioSpecificConfig;
+ ((File_Mpeg4_AudioSpecificConfig*)Parser)->ftyps=ftyps;
+ ((File_Mpeg4_AudioSpecificConfig*)Parser)->Channels_AreTrustable=Channels_AreTrustable;
+ Open_Buffer_Init(Parser);
+ #endif //MEDIAINFO_MPEG4_YES
+ }
+
+ //Parsing
+ Open_Buffer_Continue(Parser);
+ if (!Parser_DoNotFreeIt
+ || StreamKind_Last==Stream_Audio && ObjectTypeId==0x40) //Audio ISO/IEC 14496-3 (AAC), File_Mpeg4_AudioSpecificConfig is only for DecConfig
+ { //StreamKind_Last==Stream_Audio because this may be in an IOD, and in this case the descriptor is not merged, so the Parser is kept until stream is detected
+ //Filling
+ Finish(Parser);
+ Merge(*Parser, StreamKind_Last, 0, StreamPos_Last);
+
+ delete Parser; Parser=NULL;
+ }
+
+ //Parser configuration after the parsing
+ switch (ObjectTypeId)
+ {
+ case 0x60 :
+ case 0x61 :
+ case 0x62 :
+ case 0x63 :
+ case 0x64 :
+ case 0x65 :
+ case 0x6A : //MPEG Video
+ #if defined(MEDIAINFO_MPEGV_YES)
+ ((File_Mpegv*)Parser)->TimeCodeIsNotTrustable=false;
+ #endif
+ break;
+ default: ;
+ }
+
+ //Positionning
+ Element_Offset=Element_Size;
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4_Descriptors::Descriptor_06()
+{
+ delete SLConfig; SLConfig=new slconfig;
+
+ //Parsing
+ int8u predefined;
+ Get_B1 (predefined, "predefined"); Param_Info(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->AU_Length, "OCRLength");
+ Get_B1 (SLConfig->instantBitrateLength, "AU_Length");
+ Get_B1 (SLConfig->degradationPriorityLength,"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->AU_Length =0;
+ SLConfig->instantBitrateLength =0; //-
+ SLConfig->degradationPriorityLength =0;
+ SLConfig->AU_seqNumLength =0;
+ SLConfig->packetSeqNumLength =0;
+
+ SLConfig->timeScale =0; //-
+ SLConfig->accessUnitDuration =0; //-
+ SLConfig->compositionUnitDuration =0; //-
+
+ SLConfig->startDecodingTimeStamp =0; //-
+ SLConfig->startCompositionTimeStamp =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 =32;
+ SLConfig->AU_Length =0;
+ SLConfig->instantBitrateLength =0;
+ SLConfig->degradationPriorityLength =0;
+ SLConfig->AU_seqNumLength =0;
+ SLConfig->packetSeqNumLength =0;
+
+ SLConfig->timeScale =0; //-
+ SLConfig->accessUnitDuration =0; //-
+ SLConfig->compositionUnitDuration =0; //-
+
+ SLConfig->startDecodingTimeStamp =0; //-
+ SLConfig->startCompositionTimeStamp =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;
+
+ SLConfig->timeScale =0;
+ SLConfig->accessUnitDuration =0;
+ SLConfig->compositionUnitDuration =0;
+
+ SLConfig->startDecodingTimeStamp =0;
+ SLConfig->startCompositionTimeStamp =0;
+ }
+ if (SLConfig->durationFlag)
+ {
+ Get_B4 (SLConfig->timeScale, "timeScale");
+ Get_B2 (SLConfig->accessUnitDuration, "accessUnitDuration");
+ Get_B2 (SLConfig->compositionUnitDuration, "compositionUnitDuration");
+ }
+ if (!SLConfig->useTimeStampsFlag)
+ {
+ BS_Begin();
+ Get_S8 (SLConfig->timeStampLength, SLConfig->startDecodingTimeStamp, "startDecodingTimeStamp");
+ Get_S8 (SLConfig->timeStampLength, SLConfig->startCompositionTimeStamp, "startCompositionTimeStamp");
+ BS_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+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
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Mpeg4_Descriptors.h b/src/thirdparty/MediaInfo/Multiple/File_Mpeg4_Descriptors.h
new file mode 100644
index 000000000..d15db54f2
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Mpeg4_Descriptors.h
@@ -0,0 +1,162 @@
+// File_Mpeg4_Descriptors - Info for MPEG files
+// Copyright (C) 2007-2007 Jerome Martinez, Zen@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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;
+ std::vector<int32u> ftyps;
+ bool Parser_DoNotFreeIt; //If you want to keep the Parser
+ bool DecSpecificInfoTag_DoNotFreeIt; //If you want to keep the DecSpecificInfoTag
+ bool SLConfig_DoNotFreeIt; //If you want to keep the SLConfig
+ bool Channels_AreTrustable;
+
+ //Out
+ File__Analyze* Parser;
+ int16u ES_ID;
+ struct decspecificinfotag
+ {
+ int8u* Buffer;
+ size_t Buffer_Size;
+ decspecificinfotag()
+ {
+ Buffer=NULL;
+ Buffer_Size=0;
+ }
+ ~decspecificinfotag()
+ {
+ delete[] Buffer; //Buffer=NULL;
+ }
+ };
+
+ 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;
+ };
+
+ decspecificinfotag* DecSpecificInfoTag;
+ 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() {Skip_XX(Element_Size, "Data");};
+ void Descriptor_02();
+ 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() {Skip_XX(Element_Size, "Data");};
+ 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
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Mpeg4_Elements.cpp b/src/thirdparty/MediaInfo/Multiple/File_Mpeg4_Elements.cpp
new file mode 100644
index 000000000..1edfe6aad
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Mpeg4_Elements.cpp
@@ -0,0 +1,4503 @@
+// File_Mpeg4 - Info for MPEG-4 files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR . See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Elements part
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_AVC_YES)
+ #include "MediaInfo/Video/File_Avc.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_AC3_YES)
+ #include "MediaInfo/Audio/File_Ac3.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_JPEG_YES)
+ #include "MediaInfo/Image/File_Jpeg.h"
+#endif
+#include "MediaInfo/Multiple/File_Mpeg4_TimeCode.h"
+#include "ZenLib/Base64/base64.h"
+#include <cmath>
+#include <zlib.h>
+//---------------------------------------------------------------------------
+
+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)
+{
+ //TODO: http://developer.apple.com/mac/library/documentation/MusicAudio/Reference/CAFSpec/CAF_spec/CAF_spec.html#//apple_ref/doc/uid/TP40001862-CH210-BCGECJAJ
+ switch(Ordering)
+ {
+ case 100 : return "Front: C";
+ case 101 : return "Front: L R";
+ case 102 : return "Front: L R"; //With headphones
+ case 103 : return "Front: L R"; //With matrix
+ case 104 : return "Front: MidSide";
+ case 105 : return "Front: XY";
+ case 106 : return "Front: Binaural";
+ case 107 : return "Front: WXYZ";
+ 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";
+ default : return "";
+ }
+}
+
+//***************************************************************************
+// Constants
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+namespace Elements
+{
+ const int64u free=0x66726565;
+ const int64u ftyp=0x66747970;
+ const int64u ftyp_qt=0x71742020;
+ 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_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_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_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_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_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_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_dec3=0x64656333;
+ const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_damr=0x64616D72;
+ const int64u moov_trak_mdia_minf_stbl_stsd_xxxx_esds=0x65736473;
+ 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_pasp=0x70617370;
+ 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_vmhd=0x766D6864;
+ 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_ipir=0x69706972;
+ const int64u moov_trak_tref_hint=0x68696E74;
+ const int64u moov_trak_tref_mpod=0x6D706F64;
+ 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 PICT=0x50494354;
+ const int64u pckg=0x70636B67;
+ const int64u pnot=0x706E6F74;
+ 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
+ LIST_SKIP(free)
+ ATOM(ftyp)
+ ATOM(idat)
+ ATOM(idsc)
+ ATOM(jp2c)
+ LIST(jp2h)
+ ATOM_BEGIN
+ ATOM(jp2h_ihdr)
+ ATOM(jp2h_colr)
+ ATOM_END
+ LIST(mdat)
+ ATOM_BEGIN
+ ATOM_DEFAULT(mdat_xxxx)
+ ATOM_END_DEFAULT
+ 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
+ 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)
+ ATOM_BEGIN
+ LIST_DEFAULT (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
+ ATOM_END_DEFAULT
+ 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_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_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_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_dec3)
+ ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_damr)
+ ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_esds)
+ ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_idfm)
+ ATOM(moov_trak_mdia_minf_stbl_stsd_xxxx_pasp)
+ 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_END
+ ATOM(moov_trak_mdia_minf_vmhd)
+ ATOM_END
+ 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_dpnd)
+ ATOM(moov_trak_tref_ipir)
+ ATOM(moov_trak_tref_hint)
+ ATOM(moov_trak_tref_mpod)
+ 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)
+ ATOM_BEGIN
+ LIST_DEFAULT (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
+ ATOM_END_DEFAULT
+ 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(PICT)
+ 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_Size<ELEMENT_SIZE0) \
+ { \
+ Trusted_IsNot("Size is wrong"); \
+ return; \
+ } \
+
+#define INTEGRITY_SIZE_ATLEAST2(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 Get_B_DEPENDOFVERSION(_INFO, _NAME) \
+ { \
+ if (Version==0) \
+ { \
+ int32u Info; \
+ Get_B4(Info, _NAME); \
+ _INFO=Info; \
+ } \
+ else \
+ Get_B8(_INFO, _NAME); \
+ } \
+
+#define Get_DATE1904_DEPENDOFVERSION(_INFO, _NAME) \
+ { \
+ if (Version==0) \
+ { \
+ int32u Temp; \
+ Get_B4(Temp, _NAME); \
+ _INFO.Date_From_Seconds_1904(Temp); \
+ } \
+ else \
+ { \
+ int64u Temp; \
+ Get_B8(Temp, _NAME); \
+ _INFO.Date_From_Seconds_1904(Temp); \
+ } \
+ Param_Info(_INFO); \
+ } \
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::free()
+{
+ Element_Name("Free space");
+
+ //Parsing
+ Skip_XX(Element_TotalSize_Get(), "Free");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::ftyp()
+{
+ Element_Name("File Type");
+
+ if (Count_Get(Stream_General))
+ {
+ Skip_XX(Element_Size, "Duplicate ftyp");
+ return;
+ }
+
+ //Parsing
+ int32u MajorBrand;
+ Get_C4 (MajorBrand, "MajorBrand");
+ Skip_B4( "MajorBrandVersion");
+ FILLING_BEGIN();
+ ftyps.push_back(MajorBrand);
+ FILLING_END();
+ while (Element_Offset<Element_Size)
+ {
+ int32u CompatibleBrand;
+ Get_C4 (CompatibleBrand, "CompatibleBrand");
+
+ FILLING_BEGIN();
+ ftyps.push_back(CompatibleBrand);
+ FILLING_END();
+ }
+
+ FILLING_BEGIN();
+ Accept("MPEG-4");
+
+ Fill(Stream_General, 0, General_Format, "MPEG-4");
+ for (size_t Pos=0; Pos<ftyps.size(); Pos++)
+ switch (ftyps[Pos])
+ {
+ 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;
+ Open_Buffer_Init(&MI);
+
+ //Parsing
+ Open_Buffer_Continue(&MI);
+
+ //Filling
+ Finish(&MI);
+
+ Accept("MPEG-4");
+
+ Fill(Stream_General, 0, General_Format, "JPEG 2000", Unlimited, true, true);
+ Fill(Stream_General, 0, General_Format_Profile, "MPEG-4");
+
+ Merge(MI);
+ #endif
+
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::jp2h()
+{
+ Element_Name("JPEG-2000 header");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::jp2h_colr()
+{
+ Element_Name("Color");
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::jp2h_ihdr()
+{
+ Element_Name("Header");
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::mdat()
+{
+ if (!Status[IsAccepted])
+ {
+ Data_Accept("MPEG-4");
+
+ Fill(Stream_General, 0, General_Format, "QuickTime");
+ }
+ Element_Name("Data");
+
+ //In case of second pass
+ if (mdat_MustParse && mdat_Pos.empty())
+ {
+ //For each stream
+ for (std::map<int32u, stream>::iterator Temp=Stream.begin(); Temp!=Stream.end(); Temp++)
+ {
+ if (Temp->second.Parser)
+ {
+ //Adding it
+ size_t SamplesPerChunk_Pos=0;
+ int32u SamplesPerChunk=0;
+ size_t Chunk=0;
+ size_t stsc_Pos=0; //Sample to Chunk
+ int64u Position=(int64u)-1;
+ size_t stsz_Sample_Size;
+ if (Temp->second.stsz_Sample_Size)
+ stsz_Sample_Size=(size_t)Temp->second.stsz_Sample_Size; //If stsz is not filled, this is a fixed sample size //TODO: handle 64-bit values on 32-bit OS
+ else
+ stsz_Sample_Size=Temp->second.stsz.size();
+ for (size_t stsz_Pos=0; stsz_Pos<stsz_Sample_Size; stsz_Pos++) //Sample Size
+ {
+ //Changing stco/stsc if needed
+ if (SamplesPerChunk_Pos>=SamplesPerChunk)
+ {
+ //Reseting
+ SamplesPerChunk_Pos=0;
+ Chunk++;
+ if (Chunk>Temp->second.stco.size())
+ break;
+
+ //Count of sample in this Chunk
+ if (stsc_Pos+1<Temp->second.stsc.size() && Chunk>=Temp->second.stsc[stsc_Pos+1].FirstChunk || Position==(int64u)-1)
+ {
+ if (Position!=(int64u)-1)
+ {
+ stsc_Pos++;
+ if (stsc_Pos>=Temp->second.stsc.size())
+ break;
+ }
+ SamplesPerChunk=Temp->second.stsc[stsc_Pos].SamplesPerChunk;
+ }
+
+ //Chunk Offset
+ Position=Temp->second.stco[Chunk-1];
+ }
+
+ mdat_Pos[Position].StreamID=Temp->first;
+ mdat_Pos[Position].Size=Temp->second.stsz_Sample_Size?Temp->second.stsz_Sample_Size:Temp->second.stsz[stsz_Pos];
+
+ Position+=Temp->second.stsz_Sample_Size?Temp->second.stsz_Sample_Size:Temp->second.stsz[stsz_Pos];
+ SamplesPerChunk_Pos++;
+ }
+ }
+ }
+ }
+ if (!mdat_Pos.empty() && mdat_Pos.begin()->first<File_Offset+Buffer_Offset+Element_TotalSize_Get())
+ {
+ //Next piece of data
+ IsParsing_mdat=true;
+ mdat_StreamJump();
+ return; //Only if have something in this mdat
+ }
+
+ //In case of mdat is before moov
+ if (Stream.empty())
+ {
+ Buffer_Offset-=(size_t)Header_Size;
+ Element_Level--;
+ BookMark_Set(); //Remembering this place, for stream parsing in phase 2
+ Element_Level++;
+ Buffer_Offset+=(size_t)Header_Size;
+ }
+
+ //Parsing
+ Skip_XX(Element_TotalSize_Get(), "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::mdat_xxxx()
+{
+ if (!Element_IsComplete_Get())
+ {
+ Element_WaitForMoreData();
+ return;
+ }
+
+ Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream);
+
+ if (Stream[(int32u)Element_Code].Parser)
+ {
+ Open_Buffer_Continue(Stream[(int32u)Element_Code].Parser);
+ Element_Offset=Element_Size;
+ Element_Show();
+ }
+ else
+ Skip_XX(Element_Size, "Data");
+
+ //Erasing Index if no more needed
+ mdat_StreamClear();
+
+ //Next piece of data
+ mdat_StreamJump();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::mdat_StreamClear()
+{
+ if (Stream[(int32u)Element_Code].Parser==NULL || Stream[(int32u)Element_Code].Parser->Status[IsFinished])
+ {
+ std::map<int64u, mdat_Pos_Type>::iterator Temp=mdat_Pos.begin();
+ while (Temp!=mdat_Pos.end())
+ {
+ std::map<int64u, mdat_Pos_Type>::iterator Stream_Pos_Temp=Temp;
+ bool Useful=true;
+ if (Temp->second.StreamID==(int32u)Element_Code)
+ Useful=false;
+
+ Temp++;
+
+ if (!Useful)
+ mdat_Pos.erase(Stream_Pos_Temp);
+ }
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::mdat_StreamJump()
+{
+ int64u ToJump=File_Size;
+ if (!mdat_Pos.empty())
+ ToJump=mdat_Pos.begin()->first;
+ if (ToJump>File_Size)
+ ToJump=File_Size;
+ if (ToJump>=File_Offset+Buffer_Offset+Element_TotalSize_Get(Element_Level-1)) //We want always Element mdat
+ {
+ if (!Status[IsAccepted])
+ Data_Accept("MPEG-4");
+ Data_GoTo(File_Offset+Buffer_Offset+Element_TotalSize_Get(Element_Level-1), "MPEG-4"); //Not in this chunk
+ IsParsing_mdat=false;
+ }
+ else if (ToJump!=File_Offset+Buffer_Offset+Element_Size)
+ {
+ if (!Status[IsAccepted])
+ Data_Accept("MPEG-4");
+ Data_GoTo(ToJump, "MPEG-4"); //Not just after
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::mfra()
+{
+ Element_Name("Movie Fragment Random Access");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::mfra_mfro()
+{
+ NAME_VERSION_FLAG("Movie Fragment Random Access Offset");
+
+ //Parsing
+ Skip_B4( "size");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::mfra_tfra()
+{
+ NAME_VERSION_FLAG("Track Fragment Random Access");
+
+ //Parsing
+ int32u number_of_entry;
+ int8u length_size_of_traf_num, length_size_of_trun_num, length_size_of_sample_num;
+ Skip_B4( "track_ID");
+ BS_Begin();
+ Skip_S1(26, "reserved");
+ Get_S1 (2, length_size_of_traf_num, "length_size_of_traf_num");
+ Get_S1 (2, length_size_of_trun_num, "length_size_of_trun_num");
+ Get_S1 (2, length_size_of_sample_num, "length_size_of_sample_num");
+ BS_End();
+ Get_B4(number_of_entry, "number_of_entry");
+ for(int32u Pos=0; Pos<number_of_entry; Pos++)
+ {
+ Element_Begin("entry");
+ int64u time, moof_offset;
+ Get_B_DEPENDOFVERSION(time, "time");
+ Get_B_DEPENDOFVERSION(moof_offset, "moof_offset");
+ switch (length_size_of_traf_num)
+ {
+ case 0 : Skip_B1( "traf_number"); break;
+ case 1 : Skip_B2( "traf_number"); break;
+ case 2 : Skip_B3( "traf_number"); break;
+ case 3 : Skip_B4( "traf_number"); break;
+ default: ;
+ }
+ switch (length_size_of_trun_num)
+ {
+ case 0 : Skip_B1( "trun_num"); break;
+ case 1 : Skip_B2( "trun_num"); break;
+ case 2 : Skip_B3( "trun_num"); break;
+ case 3 : Skip_B4( "trun_num"); break;
+ default: ;
+ }
+ switch (length_size_of_sample_num)
+ {
+ case 0 : Skip_B1( "sample_num"); break;
+ case 1 : Skip_B2( "sample_num"); break;
+ case 2 : Skip_B3( "sample_num"); break;
+ case 3 : Skip_B4( "sample_num"); break;
+ default: ;
+ }
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moof()
+{
+ Element_Name("Movie Fragment");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moof_mfhd()
+{
+ NAME_VERSION_FLAG("Movie Fragment Header");
+
+ //Parsing
+ Skip_B4( "sequence_number");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moof_traf()
+{
+ Element_Name("Track Fragment");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moof_traf_sdtp()
+{
+ NAME_VERSION_FLAG("Independent and Disposable Samples");
+
+ //Parsing
+ //for (int32u Pos=0; Pos<sample_count; Pos++) //sample_count should be taken from stsz or stz2
+ while (Element_Offset<Element_Size)
+ {
+ Element_Begin("sample");
+ BS_Begin();
+ Skip_S1(2, "reserved");
+ Info_S1(2, sample_depends_on, "sample_depends_on"); Param_Info(Mpeg4_sample_depends_on[sample_depends_on]);
+ Info_S1(2, sample_is_depended_on, "sample_is_depended_on"); Param_Info(Mpeg4_sample_is_depended_on[sample_is_depended_on]);
+ Info_S1(2, sample_has_redundancy, "sample_has_redundancy"); Param_Info(Mpeg4_sample_has_redundancy[sample_has_redundancy]);
+ BS_End();
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moof_traf_tfhd()
+{
+ NAME_VERSION_FLAG("Track Fragment Header");
+
+ //Parsing
+ bool base_data_offset_present, sample_description_index_present, default_sample_duration_present, default_sample_size_present, default_sample_flags_present;
+ Get_Flags (Flags, 0, base_data_offset_present, "base-data-offset-present");
+ Get_Flags (Flags, 1, sample_description_index_present, "sample-description-index-present");
+ Get_Flags (Flags, 3, default_sample_duration_present, "default-sample-duration-present");
+ Get_Flags (Flags, 4, default_sample_size_present, "default-sample-size-present");
+ Get_Flags (Flags, 5, default_sample_flags_present, "default-sample-flags-present");
+ Skip_Flags(Flags, 16, "duration-is-empty");
+ Skip_B4( "track_ID");
+ if (base_data_offset_present)
+ Skip_B8( "base_data_offset");
+ if (sample_description_index_present)
+ Skip_B4( "sample_description_index");
+ if (default_sample_duration_present)
+ Skip_B4( "default_sample_duration");
+ if (default_sample_size_present)
+ Skip_B4( "default_sample_size");
+ if (default_sample_flags_present)
+ Skip_B4( "default_sample_flags");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moof_traf_trun()
+{
+ NAME_VERSION_FLAG("Track Fragment Run");
+
+ //Parsing
+ int32u sample_count;
+ bool data_offset_present, 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");
+ if (data_offset_present)
+ Skip_B4( "data_offset");
+ if (first_sample_flags_present)
+ Skip_B4( "first_sample_flags");
+ for (int32u Pos=0; Pos<sample_count; Pos++)
+ {
+ Element_Begin("sample");
+ if (sample_duration_present)
+ Skip_B4( "sample_duration");
+ if (sample_size_present)
+ Skip_B4( "sample_size");
+ if (sample_flags_present)
+ Skip_B4( "sample_flags");
+ if (sample_composition_time_offset_present)
+ Skip_B4( "sample_composition_time_offset");
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+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 (!Stream.empty())
+ {
+ Skip_XX(Element_TotalSize_Get(), "Duplicated moov");
+ return;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_cmov()
+{
+ Element_Name("Compressed file header");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_cmov_cmvd()
+{
+ Element_Name("Data");
+
+ switch (moov_cmov_dcom_Compressor)
+ {
+ case Elements::moov_cmov_dcom_zlib : moov_cmov_cmvd_zlib(); break;
+ default: Skip_XX(Element_Size, "Data");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_cmov_cmvd_zlib()
+{
+ Element_Name("Zlib");
+
+ //Parsing
+ int32u Dest_Size32;
+ Get_B4(Dest_Size32, "Destination size");
+
+ FILLING_BEGIN();
+ //Sizes
+ unsigned long Source_Size=(unsigned long)(Element_Size-Element_Offset);
+ unsigned long Dest_Size=Dest_Size32;
+
+ //Uncompressing
+ int8u* Dest=new int8u[Dest_Size];
+ if (uncompress((Bytef*)Dest, &Dest_Size, (const Bytef*)Buffer+Buffer_Offset+4, Source_Size)<0)
+ {
+ Skip_XX(Element_Size, "Problem during the decompression");
+ delete[] Dest; //Dest=NULL;
+ return;
+ }
+
+ //Exiting this element
+ Skip_XX(Element_Size, "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<int64u> Element_Sizes_Sav;
+ size_t Element_Level_Sav=Element_Level;
+ while(Element_Level)
+ {
+ int64u A=Element_TotalSize_Get();
+ Element_Sizes_Sav.push_back(A);
+ Element_End();
+ }
+
+ //Configuring file size
+ int64u File_Size_Sav=File_Size;
+ if (File_Size<File_Offset+Buffer_Offset+Element_Offset+Dest_Size)
+ File_Size=File_Offset+Buffer_Offset+Element_Offset+Dest_Size;
+ Element_Level++;
+ Header_Fill_Size(File_Size);
+ Element_Level--;
+
+ //Parsing
+ Open_Buffer_Continue(Dest, Dest_Size);
+ delete[] Dest; //Dest=NULL;
+
+ //Resetting file size
+ File_Size=File_Size_Sav;
+ while(Element_Level)
+ Element_End();
+ Element_Level++;
+ Header_Fill_Size(File_Size);
+ Element_Level--;
+
+ //Configuring level
+ while(Element_Level<Element_Level_Sav)
+ {
+ Element_Begin();
+ Element_Begin();
+ Header_Fill_Size(Element_Sizes_Sav[0]);
+ Element_End();
+ //Ztring(), Element_Sizes_Sav[Element_Level_Sav-1-Element_Level]);
+ }
+
+ //Resetting buffer
+ Buffer=Buffer_Sav;
+ Buffer_Size=Buffer_Size_Sav;
+ Buffer_Temp=Buffer_Temp_Sav;
+ Buffer_Temp_Size=Buffer_Temp_Size_Sav;
+ Buffer_Offset=Buffer_Offset_Sav;
+ Buffer_Offset_Temp=Buffer_Offset_Temp_Sav;
+
+ //Filling
+ Fill(Stream_General, 0, General_Format_Settings, "Compressed header");
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_ctab()
+{
+ Element_Name("Color Table");
+
+ //Parsing
+ int16u Size;
+ Skip_B4( "Color table seed");
+ Skip_B2( "Color table flags");
+ Get_B2 (Size, "Color table size");
+ for (int16u Pos=0; Pos<=Size; Pos++)
+ {
+ Skip_B2( "Zero");
+ Skip_B2( "Red");
+ Skip_B2( "Green");
+ Skip_B2( "Blue");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_cmov_dcom()
+{
+ Element_Name("Data compressor name");
+
+ //Parsing
+ Get_C4 (moov_cmov_dcom_Compressor, "Value");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_iods()
+{
+ NAME_VERSION_FLAG("Initial object descriptor");
+ INTEGRITY_VERSION(0);
+
+ FILLING_BEGIN();
+ Descriptors();
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_meta()
+{
+ Element_Name("Metadata");
+
+ //Filling
+ moov_meta_hdlr_Type=0;
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_meta_bxml()
+{
+ NAME_VERSION_FLAG("Binary XML"); //ISO/IEC 14496-12
+ INTEGRITY(moov_meta_hdlr_Type==Elements::moov_meta_hdlr_mp7b, "Bad meta type");
+
+ //Parsing
+ Skip_XX(Element_Size-Element_Offset, "Binary XML dump");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_meta_hdlr()
+{
+ NAME_VERSION_FLAG("Metadata Header"); //ISO/IEC 14496-12 handler
+
+ //Parsing
+ Skip_C4( "Type (Quicktime)"); //Filled if Quicktime
+ Get_C4 (moov_meta_hdlr_Type, "Metadata type");
+ Skip_C4( "Manufacturer");
+ Skip_B4( "Component reserved flags"); //Filled if Quicktime
+ Skip_B4( "Component reserved flags mask"); //Filled if Quicktime
+ Skip_Local(Element_Size-Element_Offset, "Component type name");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_meta_keys()
+{
+ NAME_VERSION_FLAG("Keys");
+ INTEGRITY(moov_meta_hdlr_Type==Elements::moov_meta_hdlr_mdta, "Bad meta type");
+
+ //Parsing
+ Skip_B4( "Count");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_meta_keys_mdta()
+{
+ Element_Name("Name");
+ INTEGRITY(moov_meta_hdlr_Type==Elements::moov_meta_hdlr_mdta, "Bad meta type");
+
+ //Parsing
+ std::string Value;
+ Get_String(Element_Size, Value, "Value");
+
+ //Filling
+ moov_udta_meta_keys_List.push_back(Value);
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_meta_ilst()
+{
+ Element_Name("List");
+
+ //Filling
+ moov_udta_meta_keys_ilst_Pos=0;
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_meta_ilst_xxxx()
+{
+ Element_Name("Element");
+
+ //Filling
+ moov_meta_ilst_xxxx_name_Name.clear(); //useful if metadata type = "mdir"
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_meta_ilst_xxxx_data()
+{
+ Element_Name("Data");
+
+ //Parsing
+ int32u Kind, Language;
+ Ztring Value;
+ Get_B4(Kind, "Kind"); Param_Info(Mpeg4_Meta_Kind(Kind));
+ switch (Kind)
+ {
+ case 0x00 : //Binary
+ Get_B4(Language, "Language");
+ switch (Element_Code_Get(Element_Level-1))
+ {
+ case Elements::moov_meta__disk :
+ {
+ //Parsing
+ int16u Position, Total;
+ Skip_B2( "Reserved");
+ Get_B2(Position, "Position");
+ Get_B2(Total, "Total");
+ if (Element_Offset+2<=Element_Size)
+ Skip_B2( "Reserved"); //Sometimes there are 2 more bytes, unknown
+
+ //Filling
+ Fill(Stream_General, 0, General_Part_Position, Position, 10, true);
+ Fill(Stream_General, 0, General_Part_Position_Total, Total, 10, true);
+ }
+ return;
+ case Elements::moov_meta__trkn :
+ {
+ //Parsing
+ int16u Position, Total;
+ Skip_B2( "Reserved");
+ Get_B2(Position, "Position");
+ Get_B2(Total, "Total");
+ if (Element_Offset+2<=Element_Size)
+ Skip_B2( "Reserved"); //Sometimes there are 2 more bytes, unknown
+
+ //Filling
+ Fill(Stream_General, 0, General_Track_Position, Position, 10, true);
+ Fill(Stream_General, 0, General_Track_Position_Total, Total, 10, true);
+ }
+ return;
+ case Elements::moov_meta__covr :
+ {
+ 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));
+ Skip_XX(Element_Size-Element_Offset, "Data");
+
+ //Filling
+ Fill(Stream_General, 0, General_Cover_Data, Data_Base64);
+ Fill(Stream_General, 0, General_Cover, "Yes");
+ }
+ return;
+ case Elements::moov_meta__gnre :
+ {
+ if (Element_Size-Element_Offset==2)
+ {
+ int16u Genre;
+ Get_B2(Genre, "Genre");
+
+ //Filling
+ if (Genre)
+ Fill(Stream_General, 0, General_Genre, Genre-1);
+ }
+ else
+ Skip_XX(Element_Size-Element_Offset,"Data");
+ }
+ return;
+ default:
+ Skip_XX(Element_Size, "To decode!");
+ Value=_T("(Binary)");
+ }
+ break;
+ case 0x01 : //UTF-8
+ Get_B4(Language, "Language");
+ switch (Element_Code_Get(Element_Level-1))
+ {
+ case Elements::moov_meta___day :
+ {
+ std::string ValueS;
+ Get_String(Element_Size-Element_Offset, ValueS, "Value");
+ Value.Date_From_String(ValueS.c_str(), ValueS.size());
+ }
+ break;
+ default:
+ Get_UTF8(Element_Size-Element_Offset, Value, "Value");
+ }
+ break;
+ case 0x02 : //UTF-16
+ Value=_T("UTF-16 encoding not yet supported");
+ break;
+ case 0x03 : //Mac String
+ Get_B4(Language, "Language"); //To confirm
+ Get_Local(Element_Size-Element_Offset, Value, "Value");
+ break;
+ case 0x0D : //JPEG
+ case 0x0E : //PNG
+ Get_B4(Language, "Language");
+ switch (Element_Code_Get(Element_Level-1))
+ {
+ case Elements::moov_meta__covr :
+ {
+ 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));
+ Skip_XX(Element_Size-Element_Offset, "Data");
+
+ //Filling
+ Fill(Stream_General, 0, General_Cover_Data, Data_Base64);
+ Fill(Stream_General, 0, General_Cover, "Yes");
+ }
+ return;
+ default:
+ Value=_T("(Binary)");
+ }
+ break;
+ case 0x15 : //Signed Integer
+ {
+ Get_B4(Language, "Language");
+ switch (Element_Size-Element_Offset)
+ {
+ case 1 : {int8u ValueI; Get_B1(ValueI, "Value"); Value.From_Number((int8s) ValueI);}; break;
+ case 2 : {int16u ValueI; Get_B2(ValueI, "Value"); Value.From_Number((int16s)ValueI);}; break;
+ case 4 : {int32u ValueI; Get_B4(ValueI, "Value"); Value.From_Number((int32s)ValueI);}; break;
+ case 8 : {int64u ValueI; Get_B8(ValueI, "Value"); Value.From_Number((int64s)ValueI);}; break;
+ default : Value=_T("Unknown kind of integer value!");
+ }
+ }
+ break;
+ case 0x16 : //Float 32
+ Skip_XX(4, "To decode!");
+ //Value=_T("Float32 encoding not yet supported");
+ break;
+ case 0x17 : //Float 64
+ Skip_XX(8, "To decode!");
+ Trusted=1000;
+ //Value=_T("Float64 encoding not yet supported");
+ break;
+ default: Value=_T("Unknown kind of value!");
+ }
+
+ FILLING_BEGIN();
+ switch (moov_meta_hdlr_Type)
+ {
+ case Elements::moov_meta_hdlr_mdir :
+ {
+ std::string Parameter;
+ if (Element_Code_Get(Element_Level-1)==Elements::moov_meta______)
+ Metadata_Get(Parameter, moov_meta_ilst_xxxx_name_Name);
+ else
+ Metadata_Get(Parameter, Element_Code_Get(Element_Level-1));
+ if (!Parameter.empty())
+ {
+ Element_Info(Parameter.c_str());
+ Fill(Stream_General, 0, Parameter.c_str(), Value, true);
+ }
+ }
+ break;
+ case Elements::moov_meta_hdlr_mdta :
+ if(!moov_udta_meta_keys_List.empty())
+ {
+ std::string Parameter;
+ Metadata_Get(Parameter, moov_udta_meta_keys_List[moov_udta_meta_keys_ilst_Pos<moov_udta_meta_keys_List.size()?moov_udta_meta_keys_ilst_Pos:moov_udta_meta_keys_List.size()-1]);
+ if (Parameter=="com.apple.quicktime.version")
+ Vendor_Version=Value.SubString(_T(""), _T(" "));
+ else if (Parameter=="com.apple.quicktime.player.version")
+ Vendor_Version=Value.SubString(_T(""), _T(" "));
+ else if (Parameter=="com.apple.quicktime.comment")
+ Fill(Stream_General, 0, General_Comment, Value, true);
+ else if (Parameter=="com.apple.quicktime.description")
+ Fill(Stream_General, 0, General_Description, Value, true);
+ else if (Parameter=="com.apple.finalcutstudio.media.uuid")
+ Fill(Stream_General, 0, "Media/UUID", Value);
+ else if (Parameter=="com.apple.finalcutstudio.media.history.uuid")
+ Fill(Stream_General, 0, "Media/History/UUID", Value);
+ else if (!Parameter.empty())
+ Fill(Stream_General, 0, Parameter.c_str(), Value, true);
+ moov_udta_meta_keys_ilst_Pos++;
+ }
+ else
+ Param("Keys atom is missing!", 0);
+
+ case Elements::moov_udta_meta :
+ {
+ std::string Parameter;
+ Metadata_Get(Parameter, (int32u)Element_Code_Get(Element_Level-1));
+ if (!Parameter.empty())
+ Fill(Stream_General, 0, Parameter.c_str(), Value, true);
+ }
+ default: ;
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_meta_ilst_xxxx_mean()
+{
+ Element_Name("Mean");
+
+ //Parsing
+ Skip_B4( "Unknown");
+ Skip_Local(Element_Size-Element_Offset, "Value");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_meta_ilst_xxxx_name()
+{
+ Element_Name("Name");
+
+ //Parsing
+ Skip_B4( "Unknown");
+ Get_String(Element_Size-Element_Offset, moov_meta_ilst_xxxx_name_Name, "Value");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_meta_xml()
+{
+ NAME_VERSION_FLAG("XML"); //ISO/IEC 14496-12
+ INTEGRITY(moov_meta_hdlr_Type==Elements::moov_meta_hdlr_mp7t, "Bad meta type");
+
+ //Parsing
+ Skip_XX(Element_Size-Element_Offset, "XML dump");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_mvex()
+{
+ Element_Name("Movie Extends");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_mvex_mehd()
+{
+ NAME_VERSION_FLAG("Movie Extends Header");
+
+ //Parsing
+ int64u fragment_duration;
+ Get_B_DEPENDOFVERSION(fragment_duration, "fragment_duration");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_mvex_trex()
+{
+ NAME_VERSION_FLAG("Movie Extends Defaults");
+
+ //Parsing
+ Skip_B4( "track_ID");
+ Skip_B4( "default_sample_description_index");
+ Skip_B4( "default_sample_duration");
+ Skip_B4( "default_sample_size");
+ Element_Begin("default_sample_flags", 4);
+ BS_Begin();
+ Skip_S1(6, "reserved");
+ Skip_S1(2, "sample_depends_on");
+ Skip_S1(2, "sample_is_depended_on");
+ Skip_S1(2, "sample_has_redundancy");
+ Skip_S1(3, "sample_padding_value");
+ Skip_SB( "sample_is_difference_sample");
+ BS_End();
+ Skip_B2( "sample_degradation_priority");
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_mvhd()
+{
+ NAME_VERSION_FLAG("Movie header");
+
+ //Parsing
+ Ztring Date_Created, Date_Modified;
+ int64u Duration;
+ float32 a, b, u, c, d, v, x, y, w;
+ int32u Rate;
+ int16u Volume;
+ Get_DATE1904_DEPENDOFVERSION(Date_Created, "Creation time");
+ Get_DATE1904_DEPENDOFVERSION(Date_Modified, "Modification time");
+ Get_B4(TimeScale, "Time scale"); Param_Info(Ztring::ToZtring(TimeScale)+_T(" Hz"));
+ Get_B_DEPENDOFVERSION(Duration, "Duration"); Param_Info(Ztring::ToZtring((int64u)Duration*1000/TimeScale)+_T(" ms"));
+ Get_B4 (Rate, "Preferred rate"); Param_Info(Ztring::ToZtring(((float32)Rate)/0x10000));
+ Get_B2 (Volume, "Preferred volume"); Param_Info(Ztring::ToZtring(((float32)Volume)/0x100));
+ Skip_XX(10, "Reserved");
+ Element_Begin("Matrix structure", 36);
+ 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_End();
+ Skip_B4( "Preview time");
+ Skip_B4( "Preview duration");
+ Skip_B4( "Poster time");
+ Skip_B4( "Selection time");
+ Skip_B4( "Selection duration");
+ Skip_B4( "Current time");
+ Skip_B4( "Next track ID");
+
+ FILLING_BEGIN();
+ if (TimeScale)
+ {
+ //int32u Duration=(int32u)(((float)Duration)/TimeScale*1000);
+ //Fill("Duration", Duration);
+ }
+ if (Date_Created.find(_T('\r'))!=std::string::npos)
+ Date_Created.resize(Date_Created.find(_T('\r')));
+ if (Date_Created.find(_T('\n'))!=std::string::npos)
+ Date_Created.resize(Date_Created.find(_T('\n')));
+ Fill(StreamKind_Last, StreamPos_Last, "Encoded_Date", Date_Created);
+ if (Date_Modified.find(_T('\r'))!=std::string::npos)
+ Date_Modified.resize(Date_Modified.find(_T('\r')));
+ if (Date_Modified.find(_T('\n'))!=std::string::npos)
+ Date_Modified.resize(Date_Modified.find(_T('\n')));
+ Fill(StreamKind_Last, StreamPos_Last, "Tagged_Date", Date_Modified);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak()
+{
+ Element_Name("Track");
+
+ FILLING_BEGIN();
+ Fill_Flush();
+ moov_trak_tkhd_TrackID=(int32u)-1;
+ moov_trak_tkhd_Width=0;
+ moov_trak_tkhd_Height=0;
+ moov_trak_tkhd_DisplayAspectRatio=0;
+ moov_trak_tkhd_Rotation=0;
+ Stream_Prepare(Stream_Max); //clear filling
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_edts()
+{
+ Element_Name("Edit");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_edts_elst()
+{
+ NAME_VERSION_FLAG("Edit List");
+
+ //Parsing
+ int32u Count, Duration, Time;
+ bool NoMoreEmpty=false;
+ Get_B4 (Count, "Number of entries");
+ for (int32u Pos=0; Pos<Count; Pos++)
+ {
+ Element_Begin("Entry", 12);
+ Get_B4 (Duration, "Track duration"); Param_Info((int64u)Duration*1000/TimeScale, " ms");
+ Get_B4 (Time, "Media time"); if (Time!=(int32u)-1) {Param_Info((int64u)Time*1000/TimeScale, " ms");}
+ if (Time==(int32u)-1 && !NoMoreEmpty)
+ Fill(StreamKind_Last, StreamPos_Last, "Delay", (int64u)Duration*1000/TimeScale);
+ if (Time!=(int32u)-1)
+ NoMoreEmpty=true;
+ Info_B4(MediaRate, "Media rate"); Param_Info(((float)MediaRate)/0x10000);
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_load()
+{
+ Element_Name("Preload");
+
+ //Parsing
+ Info_B4(PreloadTime, "Preload time"); Param_Info(PreloadTime*1000/TimeScale, " ms");
+ Info_B4(PreloadFlags, "Flags");
+ Skip_Flags(PreloadFlags, 0, "PreloadAlways");
+ Skip_Flags(PreloadFlags, 1, "TrackEnabledPreload");
+ Info_B4(HintFlags, "Hint flags");
+ Skip_Flags(HintFlags, 2, "KeepInBuffer");
+ Skip_Flags(HintFlags, 8, "HighQuality");
+ Skip_Flags(HintFlags, 20, "SingleFieldPlayback");
+ Skip_Flags(HintFlags, 26, "DeinterlaceFields");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia()
+{
+ Element_Name("Media");
+
+ FILLING_BEGIN();
+ moov_trak_mdia_mdhd_Duration=0;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_hdlr()
+{
+ NAME_VERSION_FLAG("Handler Reference");
+
+ //Parsing
+ Ztring Title;
+ int32u SubType, Manufacturer;
+ int8u Size;
+ Skip_C4( "Component type");
+ Get_C4 (SubType, "Component subtype");
+ Get_C4 (Manufacturer, "Component manufacturer");
+ Skip_B4( "Component flags");
+ Skip_B4( "Component flags mask");
+ if (Element_Offset<Element_Size)
+ {
+ Peek_B1(Size);
+ if (Element_Offset+1+Size==Element_Size)
+ {
+ Skip_B1( "Component name size");
+ Get_Local(Size, Title, "Component name");
+ }
+ else
+ {
+ std::string TitleS;
+ Get_String(Element_Size-Element_Offset, TitleS, "Component name");
+ Title.From_UTF8(TitleS.c_str());
+ if (Title.empty())
+ Title.From_Local(TitleS.c_str()); //Trying Local...
+ }
+ if (Title.find(_T("Handler"))!=std::string::npos || Title.find(_T("vide"))!=std::string::npos || Title.find(_T("soun"))!=std::string::npos)
+ Title.clear(); //This is not a Title
+ }
+
+ FILLING_BEGIN();
+ if (!Title.empty()) Fill(StreamKind_Last, StreamPos_Last, "Title", Title);
+ switch (SubType)
+ {
+ case Elements::moov_trak_mdia_hdlr_soun :
+ if (StreamKind_Last!=Stream_Audio)
+ {
+ Stream_Prepare(Stream_Audio);
+ }
+ break;
+ case Elements::moov_trak_mdia_hdlr_vide :
+ if (StreamKind_Last!=Stream_Video)
+ {
+ Stream_Prepare(Stream_Video);
+ }
+ break;
+ case Elements::moov_trak_mdia_hdlr_text :
+ case Elements::moov_trak_mdia_hdlr_sbtl :
+ if (StreamKind_Last!=Stream_Text)
+ {
+ Stream_Prepare(Stream_Text);
+ if (SubType!=Elements::moov_trak_mdia_hdlr_text)
+ Fill(Stream_Text, StreamPos_Last, Text_MuxingMode, Ztring().From_CC4(SubType));
+ }
+ break;
+ case Elements::moov_trak_mdia_hdlr_subp :
+ if (StreamKind_Last!=Stream_Text)
+ {
+ Stream_Prepare(Stream_Text);
+ CodecID_Fill(_T("subp"), Stream_Text, StreamPos_Last, InfoCodecID_Format_Mpeg4);
+ Fill(StreamKind_Last, StreamPos_Last, Text_Codec, "subp");
+ }
+ break;
+ case Elements::moov_trak_mdia_hdlr_MPEG :
+ mdat_MustParse=true; //Data is in MDAT
+ break;
+ default: ;
+ }
+ if (Manufacturer!=0x00000000)
+ {
+ if (Vendor==0x00000000)
+ Vendor=Manufacturer;
+ else if (Vendor!=Manufacturer)
+ Vendor=0xFFFFFFFF; //Two names, this is two much
+ }
+
+ Stream[moov_trak_tkhd_TrackID].StreamKind=StreamKind_Last;
+ Stream[moov_trak_tkhd_TrackID].StreamPos=StreamPos_Last;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_imap()
+{
+ Element_Name("Non-primary source input map");
+
+ //Parsing
+ Skip_B4( "Unknown");
+ Skip_B4( "Unknown");
+ Skip_B4( "Unknown");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_imap_sean()
+{
+ //Parsing
+ Skip_B4( "Unknown");
+ Skip_B4( "Unknown");
+ Skip_B4( "Unknown");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_imap_sean___in()
+{
+ Element_Name("Input");
+
+ //Parsing
+ Skip_B4( "Atom ID");
+ Skip_B2( "Zero");
+ Skip_B2( "Number of internal atoms");
+ Skip_B4( "Zero");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_imap_sean___in___ty()
+{
+ Element_Name("Input type");
+
+ //Parsing
+ Info_B4(TypeModifierName, "Type modifier name"); Param_Info(Mpeg4_TypeModifierName(TypeModifierName));
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_imap_sean___in_dtst()
+{
+ //Parsing
+ Skip_B4( "Unknown");
+ Skip_B4( "Unknown");
+ Skip_B4( "Unknown");
+ Skip_C4( "Unknown");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_imap_sean___in_obid()
+{
+ Element_Name("Object ID");
+
+ //Parsing
+ Skip_B4( "Object ID");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_mdhd()
+{
+ NAME_VERSION_FLAG("Media Header");
+
+ //Parsing
+ Ztring Date_Created, Date_Modified;
+ int64u Duration;
+ int16u Language;
+ Get_DATE1904_DEPENDOFVERSION(Date_Created, "Creation time");
+ Get_DATE1904_DEPENDOFVERSION(Date_Modified, "Modification time");
+ Get_B4(moov_trak_mdia_mdhd_TimeScale, "Time scale");
+ Get_B_DEPENDOFVERSION(Duration, "Duration");
+ Get_B2 (Language, "Language"); Param_Info(Language_Get(Language));
+ Skip_B2( "Quality");
+
+ FILLING_BEGIN();
+ Fill(StreamKind_Last, StreamPos_Last, "Language", Language_Get(Language));
+ if (moov_trak_mdia_mdhd_TimeScale)
+ {
+ moov_trak_mdia_mdhd_Duration=(int32u)(((float)Duration)/moov_trak_mdia_mdhd_TimeScale*1000);
+ Fill(StreamKind_Last, StreamPos_Last, "Duration", moov_trak_mdia_mdhd_Duration);
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf()
+{
+ Element_Name("Media Information");
+}
+
+//---------------------------------------------------------------------------
+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_Begin("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;
+ Get_B2 (alias_kind, "alias kind"); Param_Info(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<End)
+ {
+ Trusted++;
+ int16u type, size;
+ Get_B2 (type, "type");
+ Get_B2 (size, "size");
+ switch (type)
+ {
+ case 0x0000 :
+ Get_Local(size, Directory_Name, "Directory Name");
+ break;
+ case 0x0002 :
+ Skip_Local(size, "Absolute Path");
+ break;
+ case 0xFFFF :
+ Skip_XX(End-Element_Offset, "Padding");
+ break;
+ default :
+ Skip_Local(size, "Unknown");
+ }
+ if (size%2)
+ Skip_B1( "Padding");
+ }
+ Element_End(record_size);
+
+ if (Element_Offset<Element_Size)
+ Skip_XX(Element_Size-Element_Offset, "Padding");
+
+ FILLING_BEGIN();
+ Stream[moov_trak_tkhd_TrackID].File_Name.clear();
+ if (!Directory_Name.empty())
+ {
+ Stream[moov_trak_tkhd_TrackID].File_Name=Directory_Name;
+ Stream[moov_trak_tkhd_TrackID].File_Name+=ZenLib::PathSeparator;
+ }
+ Stream[moov_trak_tkhd_TrackID].File_Name+=file_name_string;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_dinf_dref_rsrc()
+{
+ Element_Name("Ressource alias");
+
+ //Parsing
+ Skip_B4( "Flags"); //bit 0 = external/internal data
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_gmhd()
+{
+ Element_Name("Generic Media Header");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_gmhd_gmin()
+{
+ NAME_VERSION_FLAG("Generic Media Info");
+
+ //Parsing
+ Skip_B2( "Graphics mode");
+ Skip_B2( "Opcolor (red)");
+ Skip_B2( "Opcolor (green)");
+ Skip_B2( "Opcolor (blue)");
+ Skip_B2( "Balance");
+ Skip_B2( "Reserved");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_gmhd_tmcd()
+{
+ Element_Name("TimeCode");
+
+ //Filling
+ Stream_Prepare(Stream_Menu);
+ Fill(Stream_Menu, StreamPos_Last, Menu_Format, "TimeCode");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_gmhd_tmcd_tcmi()
+{
+ NAME_VERSION_FLAG("TimeCode Media Information");
+
+ //Parsing
+ int8u FontNameSize;
+ bool IsVisual;
+ Get_Flags (Flags, 0, IsVisual, "IsVisual");
+ Skip_B2( "Text font");
+ Info_B2(TextFace, "Text face");
+ Skip_Flags(TextFace, 0, "Bold");
+ Skip_Flags(TextFace, 1, "Italic");
+ Skip_Flags(TextFace, 2, "Underline");
+ Skip_Flags(TextFace, 3, "Outline");
+ Skip_Flags(TextFace, 4, "Shadow");
+ Skip_Flags(TextFace, 5, "Condense");
+ Skip_Flags(TextFace, 6, "Extend");
+ Skip_BFP4(16, "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();
+ Stream[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);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_stbl()
+{
+ Element_Name("Sample Table");
+
+ FILLING_BEGIN();
+ Buffer_MaximumSize=16*1024*1024; //If we are here, this is really a MPEG-4 file, and some atoms are very bigs...
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+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; Pos<Count; Pos++)
+ {
+ //Too much slow
+ /*
+ Get_B8 (Offset, "Offset");
+ */
+
+ //Faster
+ if (Element_Offset+8>Element_Size)
+ break; //Problem
+ Offset=BigEndian2int64u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+ Element_Offset+=8;
+
+ if (Pos<300 || MediaInfoLib::Config.ParseSpeed_Get()==1.00)
+ Stream[moov_trak_tkhd_TrackID].stco.push_back(Offset);
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_stbl_cslg()
+{
+ Element_Name("Composition Shift Least Greatest");
+
+ //Parsing
+ Skip_XX(Element_Size, "Unknown");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_stbl_ctts()
+{
+ NAME_VERSION_FLAG("Composition Time To Sample");
+
+ //Parsing
+ int32u entry_count, sample_count, sample_offset;
+ Get_B4 (entry_count, "entry_count");
+ for (int32u Pos=0; Pos<entry_count; Pos++)
+ {
+ //Too much slow
+ /*
+ Get_B4 (sample_count, "sample_count");
+ Get_B4 (sample_offset, "sample_offset");
+ */
+
+ //Faster
+ if (Element_Offset+8>Element_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; Pos<Count; Pos++)
+ {
+ //Too much slow
+ /*
+ Get_B4 (Offset, "Offset");
+ */
+
+ //Faster
+ if (Element_Offset+4>Element_Size)
+ break; //Problem
+ Offset=BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+ Element_Offset+=4;
+
+ if (Pos<300 || MediaInfoLib::Config.ParseSpeed_Get()==1.00)
+ Stream[moov_trak_tkhd_TrackID].stco.push_back(Offset);
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_stbl_stdp()
+{
+ Element_Name("Degradation Priority");
+
+ //Parsing
+ int32u sample_count;
+ Get_B4 (sample_count, "sample-count");
+
+ for (int32u Pos=0; Pos<sample_count; Pos++)
+ {
+ Skip_B2( "priority");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_stbl_stps()
+{
+ Element_Name("Partial Sync Sample");
+
+ //Parsing
+ Skip_XX(Element_Size, "Unknown");
+}
+
+//---------------------------------------------------------------------------
+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; Pos<Count; Pos++)
+ {
+ //Too much slow
+ /*
+ Element_Begin("Entry", 12);
+ int32u SampleDescriptionId;
+ Get_B4 (Stsc.FirstChunk, "First chunk");
+ Get_B4 (Stsc.SamplesPerChunk, "Samples per chunk");
+ Get_B4 (SampleDescriptionId, "Sample description ID");
+ Element_Info(Stsc.FirstChunk);
+ Element_Info(Stsc.SamplesPerChunk);
+ Element_Info(SampleDescriptionId);
+ Element_End();
+ */
+
+ //Faster
+ if (Pos<300 || MediaInfoLib::Config.ParseSpeed_Get()==1.00)
+ {
+ if (Element_Offset+12>Element_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;
+
+ Stream[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");
+}
+
+//---------------------------------------------------------------------------
+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_Begin("Default text box");
+ Skip_B2( "top");
+ Skip_B2( "left");
+ Skip_B2( "bottom");
+ Skip_B2( "right");
+ Element_End();
+ 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"), Stream_Text, StreamPos_Last, InfoCodecID_Format_Mpeg4);
+ Fill(StreamKind_Last, StreamPos_Last, Text_Codec, "text", Unlimited, true, true);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_tmcd()
+{
+ Element_Name("TimeCode");
+
+ //Parsing
+ int32u TimeScale, FrameDuration;
+ bool DropFrame, H24, NegativeTimes;
+ Skip_B4( "Reserved");
+ Skip_B2( "Reserved");
+ Skip_B2( "Data reference index");
+ Skip_B4( "Reserved (Flags)");
+ Info_B4(TimeCodeFlags, "Flags (timecode)");
+ Get_Flags (TimeCodeFlags, 0, DropFrame, "Drop frame");
+ Get_Flags (TimeCodeFlags, 1, H24, "24 hour max ");
+ Get_Flags (TimeCodeFlags, 2, NegativeTimes, "Negative times OK");
+ Skip_Flags(TimeCodeFlags, 3, "Counter");
+ Get_B4 (TimeScale, "Time scale");
+ Get_B4 (FrameDuration, "Frame duration");
+ Skip_B1( "Number of frames");
+ Skip_B1( "Unknown");
+
+ FILLING_BEGIN();
+ //Bug in one file
+ if (TimeScale==25 && FrameDuration==100)
+ TimeScale=2500;
+
+ //Is it general or for a specific stream?
+ bool IsGeneral=true;
+ for (std::map<int32u, stream>::iterator Strea=Stream.begin(); Strea!=Stream.end(); Strea++)
+ if (Strea->second.TimeCode_TrackID==moov_trak_tkhd_TrackID)
+ IsGeneral=false;
+
+ //For each track in the file (but only the last one will be used!)
+ for (std::map<int32u, stream>::iterator Strea=Stream.begin(); Strea!=Stream.end(); Strea++)
+ if (IsGeneral && Strea->second.StreamKind!=Stream_Max || Strea->second.TimeCode_TrackID==moov_trak_tkhd_TrackID)
+ {
+ if (Strea->second.StreamKind==Stream_Video)
+ {
+ Fill(Stream_Video, Strea->second.StreamPos, Video_Delay_Settings, Ztring(_T("DropFrame="))+(DropFrame?_T("Yes"):_T("No")));
+ Fill(Stream_Video, Strea->second.StreamPos, Video_Delay_Settings, Ztring(_T("24HourMax="))+(H24?_T("Yes"):_T("No")));
+ Fill(Stream_Video, Strea->second.StreamPos, Video_Delay_Settings, Ztring(_T("IsVisual="))+(Stream[moov_trak_tkhd_TrackID].TimeCode_IsVisual?_T("Yes"):_T("No")));
+ }
+ if (Stream[moov_trak_tkhd_TrackID].Parser==NULL)
+ {
+ Stream[moov_trak_tkhd_TrackID].Parser=new File_Mpeg4_TimeCode;
+ Open_Buffer_Init(Stream[moov_trak_tkhd_TrackID].Parser);
+ mdat_MustParse=true; //Data is in MDAT
+ ((File_Mpeg4_TimeCode*)Stream[moov_trak_tkhd_TrackID].Parser)->StreamKind=IsGeneral?Stream_General:Strea->second.StreamKind;
+ ((File_Mpeg4_TimeCode*)Stream[moov_trak_tkhd_TrackID].Parser)->FrameRate=FrameDuration?(((float64)TimeScale)/FrameDuration):0;
+ ((File_Mpeg4_TimeCode*)Stream[moov_trak_tkhd_TrackID].Parser)->NegativeTimes=NegativeTimes;
+ if (!IsGeneral)
+ {
+ Stream[moov_trak_tkhd_TrackID].StreamKind=Strea->second.StreamKind;
+ Stream[moov_trak_tkhd_TrackID].StreamPos=Strea->second.StreamPos;
+ }
+ }
+ }
+
+ //General stuff
+ if (IsGeneral)
+ Stream[moov_trak_tkhd_TrackID].StreamKind=Stream_General;
+ 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_Info(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_General, 0, General_OriginalSourceMedium, 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_Begin("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_End();
+ Element_Begin("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_End();
+
+ FILLING_BEGIN();
+ CodecID_Fill(_T("tx3g"), Stream_Text, StreamPos_Last, InfoCodecID_Format_Mpeg4);
+ Fill(StreamKind_Last, StreamPos_Last, Text_Codec, "tx3g", Unlimited, true, true);
+ 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<entry_count; Pos++)
+ {
+ int8u FontName_Length;
+ Skip_B2( "font-ID");
+ Get_B1 (FontName_Length, "font-name-length");
+ Skip_Local(FontName_Length, "font-name");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx()
+{
+ switch (StreamKind_Last)
+ {
+ case Stream_Audio : moov_trak_mdia_minf_stbl_stsd_xxxxSound(); break;
+ case Stream_Video : moov_trak_mdia_minf_stbl_stsd_xxxxVideo(); break;
+ default : Skip_XX(Element_TotalSize_Get(), "Unknown");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxxSound()
+{
+ Element_Name("Audio");
+
+ int16u Version, Channels, SampleSize, ID, SampleRate;
+ Skip_B4( "Reserved");
+ Skip_B2( "Reserved");
+ Skip_B2( "Data reference index");
+ Get_B2 (Version, "Version");
+ Skip_B2( "Revision level");
+ Skip_C4( "Vendor");
+ Get_B2 (Channels, "Number of channels");
+ Get_B2 (SampleSize, "Sample size");
+ Get_B2 (ID, "Compression ID");
+ Skip_B2( "Packet size");
+ Get_B2 (SampleRate, "Sample rate"); Param_Info(SampleRate, " Hz");
+ Skip_B2( "Reserved");
+ if (Version>=1)
+ {
+ Skip_B4( "Samples per packet");
+ Skip_B4( "Bytes per packet");
+ Skip_B4( "Bytes per frame");
+ Skip_B4( "Bytes per sample");
+ if (Version>=2)
+ {
+ Skip_B4( "Unknown");
+ Skip_B4( "Unknown");
+ Skip_B4( "Unknown");
+ Skip_B4( "Unknown");
+ Skip_B4( "Unknown");
+ }
+ }
+
+ FILLING_BEGIN();
+ //samr bug viewed in some files: channels and Sampling rate are wrong
+ if (Element_Code==0x73616D72) //"samr"
+ {
+ SampleRate=8000;
+ Channels=1;
+ }
+
+ 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_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"))
+ {
+ //Creating the parser
+ File_Pcm 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_MPEGA_YES)
+ if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Mpeg4, Ztring(Codec.c_str()), InfoCodecID_Format)==_T("MPEG Audio"))
+ {
+ //Creating the parser
+ Stream[moov_trak_tkhd_TrackID].Parser=new File_Mpega;
+ Open_Buffer_Init(Stream[moov_trak_tkhd_TrackID].Parser);
+ mdat_MustParse=true; //Data is in MDAT
+ }
+ #endif
+ if (Element_Code==0x6F776D61) //"owma"
+ {
+ Skip_XX(Element_Size-Element_Offset, "WMA Pro data");
+ }
+
+ Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Channels, 10, true);
+ if (SampleSize!=0 && Element_Code!=0x6D703461 && (Element_Code&0xFFFF0000)!=0x6D730000 && Retrieve(Stream_Audio, StreamPos_Last, Audio_Resolution).empty()) //if not mp4a, and not ms*
+ Fill(Stream_Audio, StreamPos_Last, Audio_Resolution, SampleSize, 10, true);
+ Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, SampleRate);
+
+ //Sometimes, more Atoms in this atoms
+ if (Element_Offset+8<Element_Size)
+ Element_ThisIsAList();
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxxVideo()
+{
+ Element_Name("Video");
+
+ int16u Width, Height, ColorTableID;
+ int8u CompressorName_Size;
+ Skip_B4( "Reserved");
+ Skip_B2( "Reserved");
+ Skip_B2( "Data reference index");
+ Skip_B2( "Version");
+ Skip_B2( "Revision level");
+ Skip_C4( "Vendor");
+ Skip_B4( "Temporal quality");
+ Skip_B4( "Spatial quality");
+ Get_B2 (Width, "Width");
+ Get_B2 (Height, "Height");
+ Skip_B4( "Horizontal resolution");
+ Skip_B4( "Vertical resolution");
+ Skip_B4( "Data size");
+ Skip_B2( "Frame count");
+ Peek_B1(CompressorName_Size);
+ if (CompressorName_Size<32)
+ {
+ //This is pascal string
+ Skip_B1( "Compressor name size");
+ Skip_Local(CompressorName_Size, "Compressor name");
+ Skip_XX(32-1-CompressorName_Size, "Padding");
+ }
+ else
+ //this is hard-coded 32-byte string
+ Skip_Local(32, "Compressor name");
+ Skip_B2( "Depth");
+ Get_B2 (ColorTableID, "Color table ID");
+ if (ColorTableID==0)
+ Skip_XX(32, "Color Table");
+
+ FILLING_BEGIN();
+ std::string Codec;
+ Codec.append(1, (char)((Element_Code&0xFF000000)>>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=="enca")
+ Fill(Stream_Video, StreamPos_Last, Video_Encryption, "Encrypted");
+ Fill(Stream_Video, StreamPos_Last, Video_Width, Width, 10, true);
+ Fill(Stream_Video, StreamPos_Last, Video_Height, Height, 10, true);
+ if (moov_trak_tkhd_DisplayAspectRatio && 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 (Stream[moov_trak_tkhd_TrackID].Parser==NULL)
+ {
+ #if defined(MEDIAINFO_DVDIF_YES)
+ if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Mpeg4, Ztring(Codec.c_str()), InfoCodecID_Format)==_T("DV"))
+ {
+ Stream[moov_trak_tkhd_TrackID].Parser=new File_DvDif;
+ Open_Buffer_Init(Stream[moov_trak_tkhd_TrackID].Parser);
+ mdat_MustParse=true; //Data is in MDAT
+ }
+ #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"))
+ {
+ Stream[moov_trak_tkhd_TrackID].Parser=new File_Mpegv;
+ ((File_Mpegv*)Stream[moov_trak_tkhd_TrackID].Parser)->FrameIsAlwaysComplete=true;
+ Open_Buffer_Init(Stream[moov_trak_tkhd_TrackID].Parser);
+ mdat_MustParse=true; //Data is in MDAT
+ }
+ #endif
+ #if defined(MEDIAINFO_VC1_YES)
+ if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Mpeg4, Ztring().From_CC4((int32u)Element_Code), InfoCodecID_Format)==_T("VC-1"))
+ {
+ File_Vc1 MI;
+ MI.FrameIsAlwaysComplete=true;
+ Open_Buffer_Init(&MI);
+ Open_Buffer_Continue(&MI);
+ Element_Offset=Element_Size;
+ Finish(&MI);
+ Merge(MI, Stream_Video, 0, StreamPos_Last);
+ }
+ #endif
+ }
+
+ //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_Offset<Element_Size)
+ Descriptors();
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_alac()
+{
+ Element_Name("ALAC");
+
+ //Parsing
+ Skip_B4( "Reserved");
+ Skip_B2( "Reserved");
+ Skip_B2( "Count");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_avcC()
+{
+ Element_Name("AVC decode");
+
+ //Parsing
+ int8u Version;
+ Get_B1 (Version, "Version");
+ if (Version==1)
+ {
+ #ifdef MEDIAINFO_AVC_YES
+ if (Stream[moov_trak_tkhd_TrackID].Parser==NULL)
+ {
+ Stream[moov_trak_tkhd_TrackID].Parser=new File_Avc;
+ #if MEDIAINFO_DEMUX
+ Element_Code=moov_trak_tkhd_TrackID;
+ #endif //MEDIAINFO_DEMUX
+ Open_Buffer_Init(Stream[moov_trak_tkhd_TrackID].Parser);
+ ((File_Avc*)Stream[moov_trak_tkhd_TrackID].Parser)->MustParse_SPS_PPS=true;
+ Stream[moov_trak_tkhd_TrackID].Parser->MustSynchronize=false;
+ mdat_MustParse=true; //Data is in MDAT
+
+ //Parsing
+ Demux(Buffer+(size_t)(Buffer_Offset+Element_Offset), (size_t)(Element_Size-Element_Offset), ContentType_Header);
+ Open_Buffer_Continue(Stream[moov_trak_tkhd_TrackID].Parser);
+
+ ((File_Avc*)Stream[moov_trak_tkhd_TrackID].Parser)->SizedBlocks=true; //Now this is SizeBlocks
+ }
+ else
+ {
+ //We parse it, but we don't save information: how to do? Multiple formats in one track.
+ File_Avc* MI=new File_Avc;
+ Open_Buffer_Init(MI);
+ MI->MustParse_SPS_PPS=true;
+ MI->MustSynchronize=false;
+
+ //Parsing
+ Open_Buffer_Continue(MI);
+
+ //Cleanup
+ delete MI; //MI=NULL
+ }
+ #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");
+
+ 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");
+
+ 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#//apple_ref/doc/uid/TP40001862-CH210-DontLinkElementID_25
+ int32u ChannelLayoutTag, ChannelBitmap, NumberChannelDescriptions;
+ Get_B4 (ChannelLayoutTag, "ChannelLayoutTag");
+ Get_B4 (ChannelBitmap, "ChannelBitmap");
+ Get_B4 (NumberChannelDescriptions, "NumberChannelDescriptions");
+ for (int32u Pos=0; Pos<NumberChannelDescriptions; Pos++)
+ {
+ Skip_B1( "ChannelLabel");
+ Skip_B1( "ChannelFlags");
+ Skip_BF4( "Coordinates (0)");
+ Skip_BF4( "Coordinates (1)");
+ Skip_BF4( "Coordinates (2)");
+ }
+
+ FILLING_BEGIN();
+ if (ChannelLayoutTag==0x10000) //kCAFChannelLayoutTag_UseChannelBitmap
+ {
+ int16u Channels=ChannelLayoutTag&0x0000FFFF;
+ int16u Ordering=(ChannelLayoutTag&0xFFFF0000)>16;
+ Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Channels, 10, true);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Mpeg4_chan(Ordering), Unlimited, true, true);
+ }
+ else
+ {
+ size_t Channels=0;
+ for (size_t Bit=0; Bit<18; Bit++)
+ if (ChannelBitmap&(1<<Bit))
+ Channels++;
+ if (Channels)
+ Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Channels);
+ }
+ Stream[moov_trak_tkhd_TrackID].Channels_AreTrustable=true;
+ 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");
+
+ FILLING_BEGIN();
+ Clear(Stream_Video, StreamPos_Last, Video_Width);
+ Clear(Stream_Video, StreamPos_Last, Video_Height);
+ Clear(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio);
+ Fill(Stream_Video, StreamPos_Last, Video_Width, ((float)apertureWidth_N)/apertureWidth_D, 0);
+ Fill(Stream_Video, StreamPos_Last, Video_Height, ((float)apertureHeight_N)/apertureHeight_D, 0);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_colr()
+{
+ Element_Name("Color Parameter");
+
+ //Parsing
+ Skip_C4( "Color parameter type");
+ Skip_B2( "Primaries index");
+ Skip_B2( "Transfer function index");
+ Skip_B2( "Matrix index");
+}
+
+//---------------------------------------------------------------------------
+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");
+
+ 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("AC-3");
+ 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_Info("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 (Stream[moov_trak_tkhd_TrackID].Parser==NULL)
+ {
+ Stream[moov_trak_tkhd_TrackID].Parser=new File_Ac3;
+ Open_Buffer_Init(Stream[moov_trak_tkhd_TrackID].Parser);
+ ((File_Ac3*)Stream[moov_trak_tkhd_TrackID].Parser)->Frame_Count_Valid=2;
+ 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;
+ }
+ }
+
+ #ifdef MEDIAINFO_AC3_YES
+ if (Stream[moov_trak_tkhd_TrackID].Parser==NULL)
+ {
+ Stream[moov_trak_tkhd_TrackID].Parser=new File_Ac3;
+ Open_Buffer_Init(Stream[moov_trak_tkhd_TrackID].Parser);
+ ((File_Ac3*)Stream[moov_trak_tkhd_TrackID].Parser)->Frame_Count_Valid=2;
+ ((File_Ac3*)Stream[moov_trak_tkhd_TrackID].Parser)->MustParse_dac3=true;
+ mdat_MustParse=true; //Data is in MDAT
+
+ //Parsing
+ Open_Buffer_Continue(Stream[moov_trak_tkhd_TrackID].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_dec3()
+{
+ Element_Name("E-AC-3");
+ Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, "", Unlimited, true, true); //Remove the value (is always wrong in the stsd atom)
+
+ #ifdef MEDIAINFO_AC3_YES
+ if (Stream[moov_trak_tkhd_TrackID].Parser==NULL)
+ {
+ Stream[moov_trak_tkhd_TrackID].Parser=new File_Ac3;
+ Open_Buffer_Init(Stream[moov_trak_tkhd_TrackID].Parser);
+ ((File_Ac3*)Stream[moov_trak_tkhd_TrackID].Parser)->Frame_Count_Valid=2;
+ ((File_Ac3*)Stream[moov_trak_tkhd_TrackID].Parser)->MustParse_dec3=true;
+ mdat_MustParse=true; //Data is in MDAT
+
+ //Parsing
+ Open_Buffer_Continue(Stream[moov_trak_tkhd_TrackID].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_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");
+
+ 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_esds()
+{
+ NAME_VERSION_FLAG("ES Descriptor");
+ INTEGRITY_VERSION(0);
+
+ FILLING_BEGIN();
+ Descriptors();
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_stbl_stsd_xxxx_idfm()
+{
+ Element_Name("Description");
+
+ Info_C4(Description, "Description"); Param_Info(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");
+
+ FILLING_BEGIN();
+ if (vSpacing)
+ {
+ float64 PixelAspectRatio=(float64)hSpacing/vSpacing;
+ Clear(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio);
+ Fill(Stream_Video, StreamPos_Last, Video_PixelAspectRatio, PixelAspectRatio, 3, true);
+ }
+ FILLING_END();
+}
+//---------------------------------------------------------------------------
+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()
+{
+ Skip_B2( "Unknown");
+}
+
+//---------------------------------------------------------------------------
+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");
+
+ FILLING_BEGIN();
+ CodecID_Fill(Ztring::ToZtring(CodecMS, 16), 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");
+
+ FILLING_BEGIN();
+ if (Codec!=0x6D703461) //"mp4a"
+ CodecID_Fill(Ztring().From_CC4(Codec), 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");
+
+ 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)
+ {
+ if (0);
+ else Skip_XX(Option_Size, "Unknown");
+ }
+
+ //Creating the parser
+ if (0);
+}
+
+//---------------------------------------------------------------------------
+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; Pos<entry_count; Pos++)
+ {
+ Skip_B4( "shadowed-sample-number");
+ Skip_B4( "sync-sample-number");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_stbl_stss()
+{
+ NAME_VERSION_FLAG("Sync Sample");
+
+ //Parsing
+ int32u entry_count;
+ Get_B4 (entry_count, "entry-count");
+
+ for (int32u Pos=0; Pos<entry_count; Pos++)
+ {
+ Skip_B4( "sample-number");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_stbl_stsz()
+{
+ NAME_VERSION_FLAG("Sample Size")
+
+ int32u Sample_Size, Sample_Count;
+ Get_B4 (Sample_Size, "Sample Size");
+ Get_B4 (Sample_Count, "Number of entries");
+
+ int64u Stream_Size=0;
+
+ if (Sample_Size>0)
+ {
+ Stream_Size=Sample_Size; Stream_Size*=Sample_Count;
+
+ Stream[moov_trak_tkhd_TrackID].stsz_Sample_Size=Sample_Size;
+ Stream[moov_trak_tkhd_TrackID].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");
+
+ //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.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_Resolution).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;
+ for (int64u Multiplier=1; Multiplier<=32; Multiplier++)
+ if (Stream_Size*Multiplier>Stream_Size_Theory*0.995 && Stream_Size*Multiplier<Stream_Size_Theory*1.005)
+ {
+ Stream_Size*=Multiplier;
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ int32u Size;
+ int32u Size_Min=(int32u)-1, Size_Max=0;
+ for (int32u Pos=0; Pos<Sample_Count; Pos++)
+ {
+ //Too much slow
+ /*
+ Get_B4 (Size, "Size");
+ */
+
+ //Faster
+ if (Element_Offset+4>Element_Size)
+ break; //Problem
+ Size=BigEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset);
+ Element_Offset+=4;
+
+ Stream_Size+=Size;
+ if (Size<Size_Min)
+ Size_Min=Size;
+ if (Size>Size_Max)
+ Size_Max=Size;
+ if (Pos<300 || MediaInfoLib::Config.ParseSpeed_Get()==1.00)
+ Stream[moov_trak_tkhd_TrackID].stsz.push_back(Size);
+ }
+
+ if (Retrieve(StreamKind_Last, StreamPos_Last, "BitRate_Mode").empty())
+ {
+ if (Size_Min*(1.005+0.005)<Size_Max)
+ Fill(StreamKind_Last, StreamPos_Last, "BitRate_Mode", "VBR");
+ else
+ Fill(StreamKind_Last, StreamPos_Last, "BitRate_Mode", "CBR");
+ }
+ }
+
+ FILLING_BEGIN();
+ if (Stream_Size>0)
+ Fill(StreamKind_Last, StreamPos_Last, "StreamSize", Stream_Size);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_mdia_minf_stbl_stts()
+{
+ NAME_VERSION_FLAG("Time to Sample");
+
+ //Parsing
+ int32u NumberOfEntries;
+ Get_B4(NumberOfEntries, "Number of entries");
+
+ int32u Min=(int32u)-1;
+ int32u Max=0;
+ int64u FrameCount=0;
+ #ifdef MEDIAINFO_DVDIF_ANALYZE_YES
+ std::map<int32u, int64u> 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") && Stream[moov_trak_tkhd_TrackID].Parser && ((File_DvDif*)Stream[moov_trak_tkhd_TrackID].Parser)->Mpeg4_stts==NULL)
+ ((File_DvDif*)Stream[moov_trak_tkhd_TrackID].Parser)->Mpeg4_stts=new File_DvDif::stts;
+ #endif //MEDIAINFO_DVDIF_ANALYZE_YES
+
+ for (int32u Pos=0; Pos<NumberOfEntries; Pos++)
+ {
+ int32u SampleCount, SampleDuration;
+ Get_B4(SampleCount, "Sample Count");
+ Get_B4(SampleDuration, "Sample Duration");
+
+ FILLING_BEGIN();
+ FrameCount+=SampleCount;
+ if (NumberOfEntries==2 && Pos+1==NumberOfEntries && FrameCount && SampleCount==1 && Min==Max && SampleDuration!=Max)
+ {
+ if ((float32)SampleDuration-Min>0)
+ Clear(Stream_Video, StreamPos_Last, Video_Duration);
+ if (moov_trak_mdia_mdhd_TimeScale)
+ Fill(Stream_Video, StreamPos_Last, Video_Duration_LastFrame, ((float32)SampleDuration-Min)*1000/moov_trak_mdia_mdhd_TimeScale, 0); //The duration of the frame minus 1 normal frame duration
+ }
+ else
+ {
+ if (SampleDuration<Min) Min=SampleDuration;
+ if (SampleDuration>Max) Max=SampleDuration;
+ }
+ #ifdef MEDIAINFO_DVDIF_ANALYZE_YES
+ if (StreamKind_Last==Stream_Video && Retrieve(Stream_Video, StreamPos_Last, "Format")==_T("DV"))
+ {
+ File_DvDif::stts_part DV_stts_Part;
+ DV_stts_Part.Pos_Begin=FrameCount-SampleCount;
+ DV_stts_Part.Pos_End=FrameCount;
+ DV_stts_Part.Duration=SampleDuration;
+ ((File_DvDif*)Stream[moov_trak_tkhd_TrackID].Parser)->Mpeg4_stts->push_back(DV_stts_Part);
+
+ Duration_FrameCount[SampleDuration]+=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_END();
+ }
+
+ FILLING_BEGIN();
+ if (StreamKind_Last==Stream_Video)
+ {
+ if (moov_trak_mdia_mdhd_TimeScale && Min && Max)
+ {
+ if (Min!=Max)
+ {
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Minimum, ((float)moov_trak_mdia_mdhd_TimeScale)/Max);
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Maximum, ((float)moov_trak_mdia_mdhd_TimeScale)/Min);
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate, ((float)FrameCount)/moov_trak_mdia_mdhd_Duration*1000, 3, true);
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Mode, "VFR");
+ }
+ else
+ {
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate, ((float)moov_trak_mdia_mdhd_TimeScale)/Max, 3, true);
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Mode, "CFR");
+ }
+ }
+ Fill(Stream_Video, StreamPos_Last, Video_FrameCount, 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*)Stream[moov_trak_tkhd_TrackID].Parser)->Mpeg4_stts->size(); Pos++)
+ {
+ if (((File_DvDif*)Stream[moov_trak_tkhd_TrackID].Parser)->Mpeg4_stts->at(Pos).Duration==Duration_FrameCount_Max_Duration)
+ {
+ ((File_DvDif*)Stream[moov_trak_tkhd_TrackID].Parser)->Mpeg4_stts->erase(((File_DvDif*)Stream[moov_trak_tkhd_TrackID].Parser)->Mpeg4_stts->begin()+Pos);
+ Pos--;
+ }
+ }
+
+ if (((File_DvDif*)Stream[moov_trak_tkhd_TrackID].Parser)->Mpeg4_stts->empty())
+ {delete ((File_DvDif*)Stream[moov_trak_tkhd_TrackID].Parser)->Mpeg4_stts; ((File_DvDif*)Stream[moov_trak_tkhd_TrackID].Parser)->Mpeg4_stts=NULL;}
+ }
+ #endif //MEDIAINFO_DVDIF_ANALYZE_YES
+ }
+ 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_B4( "cleanApertureWidth"); //BFP4, but how many bits?
+ Skip_B4( "cleanApertureHeight"); //BFP4, but how many bits?
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_tapt_prof()
+{
+ NAME_VERSION_FLAG("Production Aperture Dimensions");
+
+ //Parsing
+ Skip_B4( "productionApertureWidth"); //BFP4, but how many bits?
+ Skip_B4( "productionApertureHeight"); //BFP4, but how many bits?
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_tapt_enof()
+{
+ NAME_VERSION_FLAG("Encoded Pixels Dimensions");
+
+ //Parsing
+ Skip_B4( "encodedApertureWidth"); //BFP4, but how many bits?
+ Skip_B4( "encodedApertureHeight"); //BFP4, but how many bits?
+}
+
+//---------------------------------------------------------------------------
+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_Info(moov_trak_tkhd_TrackID);
+ Skip_B4( "Reserved");
+ Get_B_DEPENDOFVERSION(Duration, "Duration"); Param_Info((int64u)Duration*1000/TimeScale, " ms"); Element_Info(Duration*1000/TimeScale, " ms");
+ Skip_B4( "Reserved");
+ Skip_B4( "Reserved");
+ Skip_B2( "Layer");
+ Skip_B2( "Alternate group");
+ Get_B2 (Volume, "Volume"); Param_Info(Ztring::ToZtring(((float)Volume)/256));
+ Skip_B2( "Reserved");
+ Element_Begin("Matrix structure", 36);
+ 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_End();
+ 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
+ if (StreamKind_Last!=Stream_Max)
+ {
+ std::map<int32u, stream>::iterator Temp=Stream.find((int32u)-1);
+ if (Temp!=Stream.end())
+ {
+ Stream[moov_trak_tkhd_TrackID]=Temp->second;
+ Temp->second.Parser=NULL; //It is a copy, we don't want that the destructor deletes the Parser
+ Stream.erase(Temp);
+ }
+ }
+
+ 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);
+ 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;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_tref()
+{
+ Element_Name("Track Reference");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_tref_dpnd()
+{
+ Element_Name("MPEG-4 dependency");
+
+ //Parsing
+ while (Element_Offset<Element_Size)
+ Skip_B4( "track-ID");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_tref_ipir()
+{
+ Element_Name("IPI declarations");
+
+ //Parsing
+ while (Element_Offset<Element_Size)
+ Skip_B4( "track-ID");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_tref_hint()
+{
+ Element_Name("original media");
+
+ //Parsing
+ while (Element_Offset<Element_Size)
+ Skip_B4( "track-ID");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_tref_mpod()
+{
+ Element_Name("included elementary stream");
+
+ //Parsing
+ while (Element_Offset<Element_Size)
+ Skip_B4( "track-ID");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_tref_ssrc()
+{
+ Element_Name("non-primary source (used in other track)");
+
+ //Parsing
+ while (Element_Offset<Element_Size)
+ Skip_B4( "track-ID");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_tref_sync()
+{
+ Element_Name("synchronization source");
+
+ //Parsing
+ while (Element_Offset<Element_Size)
+ Skip_B4( "track-ID");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_trak_tref_tmcd()
+{
+ Element_Name("TimeCode");
+
+ //Parsing
+ int32u TrackID;
+ Get_B4(TrackID, "track-ID");
+
+ FILLING_BEGIN();
+ Stream[moov_trak_tkhd_TrackID].TimeCode_TrackID=TrackID;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta()
+{
+ Element_Name("User Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_AllF()
+{
+ Element_Name("AllF");
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_chpl()
+{
+ Element_Name("Chapters");
+
+ //Parsing
+ Ztring Value;
+ std::string ValueS;
+ int64u Time;
+ int8u Size;
+ size_t Pos=0;
+ Stream_Prepare(Stream_Menu);
+ Skip_B8( "Unknown");
+ Skip_B1( "Chapter Count");
+ Fill(Stream_Menu, StreamPos_Last, Menu_Chapters_Pos_Begin, Count_Get(Stream_Menu, StreamPos_Last), 10, true);
+ while (Element_Offset<Element_Size)
+ {
+ Get_B8 (Time, "Time");
+ Get_B1 (Size, "Text size");
+ Get_String(Size, ValueS, "Value");
+ //Value.From_UTF8(ValueS.c_str());
+ //if (Value.empty())
+ Value.From_Local(ValueS.c_str()); //Trying Local...
+
+ FILLING_BEGIN();
+ Fill(Stream_Menu, StreamPos_Last, Ztring().Duration_From_Milliseconds(Time/10000).To_Local().c_str(), Value);
+ FILLING_END();
+
+ //Next
+ Pos++;
+ }
+ Fill(Stream_Menu, StreamPos_Last, Menu_Chapters_Pos_End, Count_Get(Stream_Menu, StreamPos_Last), 10, true);
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_clsf()
+{
+ NAME_VERSION_FLAG("Classification"); //3GP
+
+ //Parsing
+ Ztring ClassificationInfo;
+ int32u ClassificationEntity;
+ int16u Language, ClassificationTable;
+ Get_C4(ClassificationEntity, "ClassificationEntity");
+ Get_C2(ClassificationTable, "ClassificationTable");
+ Get_B2(Language, "Language");
+ bool Utf8=true;
+ if (Element_Offset+2<=Element_Size)
+ {
+ int16u Utf16;
+ Peek_B2(Utf16);
+ if (Utf16==0xFEFF)
+ Utf8=false;
+ }
+ if (Utf8)
+ Get_UTF8(Element_Size-Element_Offset, ClassificationInfo, "ClassificationInfo");
+ else
+ Get_UTF16(Element_Size-Element_Offset, ClassificationInfo, "ClassificationInfo");
+
+ FILLING_BEGIN();
+ Fill(Stream_General, 0, "Classification", Ztring().From_CC4(ClassificationTable));
+ Fill(Stream_General, 0, "Classification_Reason", ClassificationInfo);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_DcMD()
+{
+ Element_Name("Kodak MetaData");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_DcMD_Cmbo()
+{
+ Element_Name("Camera byte order");
+
+ //Parsing
+ Skip_C2( "EXIF byte order");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_DcMD_DcME()
+{
+ Element_Name("DcME?");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_DcMD_DcME_Keyw()
+{
+ Element_Name("Keywords?");
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_DcMD_DcME_Mtmd()
+{
+ Element_Name("Metadata?");
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_DcMD_DcME_Rate()
+{
+ Element_Name("Rate?");
+
+ //Parsing
+ Skip_B2( "Zero");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_FIEL()
+{
+ Element_Name("FIEL?");
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_FXTC()
+{
+ Element_Name("Adobe After Effects?");
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_hinf()
+{
+ Element_Name("Hint Format");
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_hinv()
+{
+ Element_Name("Hint Version");
+
+ //Parsing
+ Skip_Local(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_hnti()
+{
+ Element_Name("Hint Info");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_hnti_rtp()
+{
+ Element_Name("Real Time");
+
+ //Parsing
+ Skip_Local(Element_Size, "Value");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_ID32()
+{
+ NAME_VERSION_FLAG("ID3v2"); //3GP
+
+ //Parsing
+ int16u Language;
+ Get_B2(Language, "Language");
+ Skip_XX(Element_Size-Element_Offset, "ID3v2data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_kywd()
+{
+ NAME_VERSION_FLAG("Keywords"); //3GP
+
+ //Parsing
+ int16u Language;
+ int8u KeywordCnt;
+ Get_B2(Language, "Language");
+ Get_B1(KeywordCnt, "KeywordCnt");
+ for (int8u Pos=0; Pos<KeywordCnt; Pos++)
+ {
+ Ztring KeywordInfo;
+ int8u KeywordSize;
+ Get_B1(KeywordSize, "KeywordSize");
+ bool Utf8=true;
+ if (Element_Offset+2<=Element_Size)
+ {
+ int16u Utf16;
+ Peek_B2(Utf16);
+ if (Utf16==0xFEFF)
+ Utf8=false;
+ }
+ if (Utf8)
+ Get_UTF8(KeywordSize, KeywordInfo, "KeywordInfo");
+ else
+ Get_UTF16(KeywordSize, KeywordInfo, "KeywordInfo");
+
+ FILLING_BEGIN();
+ Fill(Stream_General, 0, "Keywords", KeywordInfo);
+ FILLING_END();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_loci()
+{
+ NAME_VERSION_FLAG("Location Information"); //3GP
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_LOOP()
+{
+ Element_Name("LOOP");
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_MCPS()
+{
+ Element_Name("Mechanical Copyright Protection Society?");
+
+ //Parsing
+ Ztring Encoder;
+ Get_Local(Element_Size, Encoder, "Value");
+
+ //Filling
+ //Fill(Stream_General, 0, General_Encoded_Library, Encoder);
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_meta()
+{
+ NAME_VERSION_FLAG("Metadata");
+ INTEGRITY_VERSION(0);
+
+ //Filling
+ moov_meta_hdlr_Type=Elements::moov_udta_meta;
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_meta_hdlr()
+{
+ moov_meta_hdlr();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_meta_ilst()
+{
+ moov_meta_ilst();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_meta_ilst_xxxx()
+{
+ moov_meta_ilst_xxxx();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_meta_ilst_xxxx_data()
+{
+ moov_meta_ilst_xxxx_data();
+}
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_meta_ilst_xxxx_mean()
+{
+ moov_meta_ilst_xxxx_mean();
+}
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_meta_ilst_xxxx_name()
+{
+ moov_meta_ilst_xxxx_name();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_ndrm()
+{
+ //Parsing
+ Skip_XX(Element_Size, "Unknown");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_nsav()
+{
+ Element_Name("No Save");
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_ptv()
+{
+ Element_Name("Print To Video");
+
+ //Parsing
+ Skip_B2( "Display size");
+ Skip_B2( "Reserved");
+ Skip_B2( "Reserved");
+ Skip_B1( "Slide show");
+ Skip_B1( "Play on open");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_rtng()
+{
+ NAME_VERSION_FLAG("Rating"); //3GP
+
+ //Parsing
+ Ztring RatingInfo;
+ int32u RatingEntity, RatingCriteria;
+ int16u Language;
+ Get_C4(RatingEntity, "RatingEntity");
+ Get_C4(RatingCriteria, "RatingCriteria");
+ Get_B2(Language, "Language");
+ bool Utf8=true;
+ if (Element_Offset+2<=Element_Size)
+ {
+ int16u Utf16;
+ Peek_B2(Utf16);
+ if (Utf16==0xFEFF)
+ Utf8=false;
+ }
+ if (Utf8)
+ Get_UTF8(Element_Size-Element_Offset, RatingInfo, "RatingInfo");
+ else
+ Get_UTF16(Element_Size-Element_Offset, RatingInfo, "RatingInfo");
+
+ FILLING_BEGIN();
+ Fill(Stream_General, 0, General_LawRating, Ztring().From_CC4(RatingCriteria));
+ Fill(Stream_General, 0, General_LawRating_Reason, RatingInfo);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_Sel0()
+{
+ Element_Name("Sel0");
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_tags()
+{
+ Element_Name("Tags");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_tags_meta()
+{
+ Element_Name("Metadata");
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_tags_tseg()
+{
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_tags_tseg_tshd()
+{
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_WLOC()
+{
+ Element_Name("WLOC");
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_XMP_()
+{
+ Element_Name("eXtensible Metadata Platform");
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_yrrc()
+{
+ NAME_VERSION_FLAG("Recording Year"); //3GP
+
+ //Parsing
+ int16u RecordingYear;
+ Get_B2 (RecordingYear, "RecordingYear");
+
+ FILLING_BEGIN();
+ Fill(Stream_General, 0, General_Released_Date, RecordingYear);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::moov_udta_xxxx()
+{
+ //Getting the method
+ std::string Parameter;
+ method Method=Metadata_Get(Parameter, Element_Code);
+ Element_Info(Parameter.c_str());
+
+ switch (Method)
+ {
+ case Method_None :
+ {
+ Element_Name("Unknown");
+ }
+ break;
+ case Method_Binary :
+ {
+ Element_Name("Binary");
+ Skip_XX(Element_Size, "Unknown");
+ return;
+ }
+ break;
+ case Method_String :
+ {
+ Element_Name("Text");
+
+ //Parsing
+ Ztring Value;
+ int32u Size32=0;
+ int16u Size16=0, Language;
+ bool IsText=true;
+ if (Element_Size<=4)
+ IsText=false;
+ else
+ {
+ Peek_B4(Size32);
+ if (4+(int64u)Size32>Element_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<Element_Size)
+ {
+ if (Size32)
+ {
+ Get_Local(Size32, Value, "Value");
+ Get_B4 (Size32, "Size");
+ }
+ else
+ {
+ Get_B2 (Size16, "Size");
+ Get_B2 (Language, "Language"); Param_Info(Language_Get(Language));
+ Get_Local(Size16, Value, "Value");
+ }
+
+ FILLING_BEGIN();
+ if (Retrieve(Stream_General, 0, Parameter.c_str()).empty())
+ Fill(Stream_General, 0, Parameter.c_str(), Value);
+ FILLING_END();
+
+ if (Element_Offset+1==Element_Size)
+ {
+ int8u Null;
+ Peek_B1(Null);
+ if (Null==0x00)
+ Skip_B1( "NULL");
+ }
+ if (Element_Offset+4<=Element_Size && Size32)
+ {
+ int32u Null;
+ Peek_B4(Null);
+ if (Null==0x00000000)
+ Skip_XX(Element_Size-Element_Offset,"Padding");
+ }
+ if (Element_Offset+2<=Element_Size && Size16)
+ {
+ int16u Null;
+ Peek_B2(Null);
+ if (Null==0x0000)
+ Skip_XX(Element_Size-Element_Offset,"Padding");
+ }
+ }
+ }
+ break;
+ case Method_String2 :
+ {
+ NAME_VERSION_FLAG("Text");
+
+ //Parsing
+ Ztring Value;
+ int16u Language;
+ while(Element_Offset<Element_Size)
+ {
+ Get_B2(Language, "Language"); Param_Info(Language_Get(Language));
+ bool Utf8=true;
+ if (Element_Offset+2<=Element_Size)
+ {
+ int16u Utf16;
+ Peek_B2(Utf16);
+ if (Utf16==0xFEFF)
+ Utf8=false;
+ }
+ if (Utf8)
+ Get_UTF8(Element_Size-Element_Offset, Value, "Value");
+ else
+ Get_UTF16(Element_Size-Element_Offset, Value, "Value");
+
+ FILLING_BEGIN();
+ if (Retrieve(Stream_General, 0, Parameter.c_str()).empty())
+ Fill(Stream_General, 0, Parameter.c_str(), Value);
+ FILLING_END();
+ }
+ }
+ break;
+ case Method_String3 :
+ {
+ NAME_VERSION_FLAG("Text");
+
+ //Parsing
+ Ztring Value;
+ while(Element_Offset<Element_Size)
+ {
+ Get_UTF8(Element_Size-Element_Offset, Value,"Value");
+
+ FILLING_BEGIN();
+ if (Retrieve(Stream_General, 0, Parameter.c_str()).empty())
+ Fill(Stream_General, 0, Parameter.c_str(), Value);
+ FILLING_END();
+ }
+ }
+ break;
+ case Method_Integer :
+ {
+ Element_Name("Integer");
+
+ //Parsing
+ Skip_XX(4, "Value");
+ }
+ break;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::PICT()
+{
+ Element_Name("QuickDraw picture");
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::pckg()
+{
+ Element_Name("QTCA");
+
+ //Parsing
+ Skip_XX(Element_Size, "Data");
+
+ FILLING_BEGIN();
+ Accept("QTCA");
+
+ Fill(Stream_General, 0, General_Format, "MPEG-4");
+ CodecID_Fill(_T("QTCA"), Stream_General, 0, InfoCodecID_Format_Mpeg4);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::pnot()
+{
+ Element_Name("Preview");
+
+ //Parsing
+ Info_B4(Date_Modified, "Modification date"); Param_Info(Ztring().Date_From_Seconds_1904(Date_Modified));
+ Skip_B2( "Version number");
+ Skip_C4( "Atom type");
+ Skip_B2( "Atom index");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::skip()
+{
+ Element_Name("Skip");
+
+ //Parsing
+ Skip_XX(Element_Size, "Free");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4::wide()
+{
+ Element_Name("Wide");
+
+ //Parsing
+ Skip_XX(Element_Size, "Free");
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_MPEG4_YES
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Mpeg4_TimeCode.cpp b/src/thirdparty/MediaInfo/Multiple/File_Mpeg4_TimeCode.cpp
new file mode 100644
index 000000000..7bf30cc26
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Mpeg4_TimeCode.cpp
@@ -0,0 +1,85 @@
+// File_Mpeg4_TimeCode - Info for MPEG-4 TimeCode files
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_MPEG4_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Multiple/File_Mpeg4_TimeCode.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Format
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Mpeg4_TimeCode::FileHeader_Parse()
+{
+ if (Buffer_Size!=4)
+ {
+ Reject("TimeCode");
+ return;
+ }
+
+ //Parsing
+ int32u Position;
+ Get_B4 (Position, "Position");
+
+ //Filling
+ Accept("TimeCode");
+
+ if (FrameRate)
+ {
+ int64s Pos=Position;
+ if (NegativeTimes)
+ Pos=(int32s)Position;
+ if (StreamKind==Stream_General)
+ {
+ //No link with a track, we do all
+ Stream_Prepare(Stream_Video);
+ Fill(Stream_Video, 0, Video_Delay, Pos*1000/FrameRate, 0);
+
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, 0, Audio_Delay, Pos*1000/FrameRate, 0);
+ }
+ else
+ {
+ Stream_Prepare(StreamKind);
+ Fill(StreamKind, 0, "Delay", Pos*1000/FrameRate, 0);
+ }
+ }
+
+ Finish("TimeCode");
+}
+
+}
+
+#endif //MEDIAINFO_MPEG4_YES
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Mpeg4_TimeCode.h b/src/thirdparty/MediaInfo/Multiple/File_Mpeg4_TimeCode.h
new file mode 100644
index 000000000..1c981784a
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Mpeg4_TimeCode.h
@@ -0,0 +1,51 @@
+// File_Mpeg4_TimeCode - Info for MPEG-4 TimeCode files
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_Mpeg4_TimeCodeH
+#define MediaInfo_File_Mpeg4_TimeCodeH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Mpeg4_TimeCode
+//***************************************************************************
+
+class File_Mpeg4_TimeCode : public File__Analyze
+{
+public :
+ //In
+ float64 FrameRate;
+ stream_t StreamKind;
+ bool NegativeTimes;
+
+protected :
+ //Buffer - Global
+ void FileHeader_Parse ();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Multiple/File_MpegPs.cpp b/src/thirdparty/MediaInfo/Multiple/File_MpegPs.cpp
new file mode 100644
index 000000000..fc93931df
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_MpegPs.cpp
@@ -0,0 +1,3645 @@
+// File_MpegPs - Info for MPEG files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_MPEGPS_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Multiple/File_MpegPs.h"
+#include "MediaInfo/Multiple/File_Mpeg_Psi.h"
+#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_VC1_YES)
+ #include "MediaInfo/Video/File_Vc1.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_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_ADTS_YES)
+ #include "MediaInfo/Audio/File_Adts.h"
+#endif
+#if defined(MEDIAINFO_PCM_YES)
+ #include "MediaInfo/Audio/File_Pcm.h"
+#endif
+#if defined(MEDIAINFO_AES3_YES)
+ #include "MediaInfo/Audio/File_Aes3.h"
+#endif
+#if defined(MEDIAINFO_LATM_YES)
+ #include "MediaInfo/Audio/File_Latm.h"
+#endif
+#if defined(MEDIAINFO_PS2A_YES)
+ #include "MediaInfo/Audio/File_Ps2Audio.h"
+#endif
+#if defined(MEDIAINFO_RLE_YES)
+ #include "MediaInfo/Image/File_Rle.h"
+#endif
+#if defined(MEDIAINFO_PGS_YES)
+ #include "MediaInfo/Text/File_Pgs.h"
+#endif
+#include "MediaInfo/File_Unknown.h"
+#include <ZenLib/Utils.h>
+#include <algorithm>
+#if MEDIAINFO_EVENTS
+ #include "MediaInfo/MediaInfo_Config_MediaInfo.h"
+ #include "MediaInfo/MediaInfo_Events_Internal.h"
+#endif //MEDIAINFO_EVENTS
+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
+ MustSynchronize=true;
+ Buffer_TotalBytes_FirstSynched_Max=64*1024;
+ 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
+ DecSpecificInfoTag=NULL;
+ SLConfig=NULL;
+ #endif
+ #if MEDIAINFO_DEMUX
+ SubStream_Demux=NULL;
+ #endif //MEDIAINFO_DEMUX
+
+ //Out
+ HasTimeStamps=false;
+
+ //Temp
+ SizeToAnalyze=8*1024*1024;
+ video_stream_Unlimited=false;
+ Buffer_DataSizeToParse=0;
+ Parsing_End_ForDTS=false;
+ video_stream_PTS_FrameCount=0;
+ video_stream_PTS_MustAddOffset=false;
+ Demux_Unpacketize=MediaInfoLib::Config.Demux_Unpacketize_Get();
+
+ //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
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_MpegPs::Streams_Fill()
+{
+ //For each Streams
+ for (size_t StreamID=0; StreamID<0x100; StreamID++)
+ Streams_Fill_PerStream(StreamID, Streams[StreamID]);
+
+ //For each private Streams
+ for (size_t StreamID=0; StreamID<0x100; StreamID++)
+ Streams_Fill_PerStream(StreamID, Streams_Private1[StreamID]);
+
+ //For each extension Streams
+ for (size_t StreamID=0; StreamID<0x100; StreamID++)
+ {
+ Streams_Fill_PerStream(StreamID, Streams_Extension[StreamID]);
+
+ //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: Handle 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<int64u> video_stream_PTS_Between;
+ for (size_t Pos=1; Pos<video_stream_PTS.size(); Pos++)
+ video_stream_PTS_Between.push_back(video_stream_PTS[Pos]-video_stream_PTS[Pos-1]);
+ std::sort(video_stream_PTS_Between.begin(), video_stream_PTS_Between.end());
+ video_stream_PTS_Between.erase(video_stream_PTS_Between.begin(), video_stream_PTS_Between.begin()+1); //Removing first timec, they may be wrong value due to missing frame
+ video_stream_PTS_Between.resize(video_stream_PTS_Between.size()-1); //Removing last frames, they may be wrong value due to missing frame
+ if (video_stream_PTS_Between[0]*0.9<video_stream_PTS_Between[video_stream_PTS_Between.size()-1]
+ && video_stream_PTS_Between[0]*1.1>video_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)
+{
+ //By the parser
+ StreamKind_Last=Stream_Max;
+ 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);
+ Merge(*Temp.Parsers[0], Stream_Video, 0, StreamPos_Last);
+ }
+ else
+ Merge(*Temp.Parsers[0]);
+ }
+
+ //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)
+ {
+ bool StreamIsDetected=false;
+ for (size_t Pos=0; Pos<Streams_Private1.size(); Pos++)
+ if (!Streams_Private1[Pos].Parsers.empty() && Streams_Private1[Pos].Parsers[0])
+ StreamIsDetected=true;
+ if (StreamIsDetected)
+ Temp.stream_type=0;
+ }
+
+ if (Temp.stream_type!=0)
+ Stream_Prepare(Mpeg_Psi_stream_type_StreamKind(Temp.stream_type, 0x00000000));
+ }
+
+ //By StreamIsRegistred
+ if (StreamKind_Last==Stream_Max)
+ {
+ if (Temp.StreamIsRegistred)
+ {
+ if (StreamID>=0xC0 && StreamID<=0xDF)
+ Stream_Prepare(Stream_Audio);
+ if (StreamID>=0xE0 && StreamID<=0xEF)
+ Stream_Prepare(Stream_Video);
+ }
+ }
+
+ //More info
+ if (StreamKind_Last!=Stream_Max) //Found
+ {
+ ///Saving StreamKind and Stream_Pos
+ Temp.StreamKind=StreamKind_Last;
+ Temp.StreamPos=StreamPos_Last;
+
+ //Common
+ Fill(StreamKind_Last, StreamPos_Last, General_ID, StreamID);
+ Ztring ID_String; ID_String.From_Number(StreamID); ID_String+=_T(" (0x"); ID_String+=Ztring::ToZtring(StreamID, 16); ID_String+=_T(")");
+ Fill(StreamKind_Last, StreamPos_Last, General_ID_String, ID_String, true); //TODO: merge with Decimal_Hexa in file_MpegTs
+ if (Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Format)).empty() && Temp.stream_type!=0)
+ Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Format), Mpeg_Psi_stream_type_Format(Temp.stream_type, 0x0000));
+ if (Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec)).empty() && Temp.stream_type!=0)
+ Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec), Mpeg_Psi_stream_type_Codec(Temp.stream_type, 0x0000));
+
+ if (Temp.TimeStamp_Start.PTS.TimeStamp!=(int64u)-1)
+ {
+ if (StreamKind_Last==Stream_Video)
+ {
+ if (!Retrieve(Stream_Video, Temp.StreamPos, Video_Delay).empty())
+ {
+ Ztring Delay=Retrieve(Stream_Video, Temp.StreamPos, Video_Delay);
+ Fill(Stream_Video, Temp.StreamPos, Video_Delay_Original, Delay);
+ }
+ if (!Retrieve(Stream_Video, Temp.StreamPos, Video_Delay_Settings).empty())
+ {
+ Ztring Delay_Settings=Retrieve(Stream_Video, Temp.StreamPos, Video_Delay_Settings);
+ Fill(Stream_Video, Temp.StreamPos, Video_Delay_Original_Settings, Delay_Settings);
+ }
+ }
+ Fill(StreamKind_Last, StreamPos_Last, "Delay", ((float64)Temp.TimeStamp_Start.PTS.TimeStamp)/90, 3, true);
+ Fill(StreamKind_Last, StreamPos_Last, "Delay_Settings", "", Unlimited, true, true);
+ }
+ else
+ {
+ Clear(StreamKind_Last, StreamPos_Last, "Delay");
+ Clear(StreamKind_Last, StreamPos_Last, "Delay_Settings");
+ }
+
+ //LATM
+ if (StreamKind_Last==Stream_Audio && StreamID==0xFA && FromTS_stream_type==0x11)
+ Fill(Stream_Audio, 0, Audio_MuxingMode, "LATM");
+ }
+
+ //Bitrate calculation
+ if (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)
+ PTS=(int64u)-1;
+ else
+ PTS+=BitRate; //Saving global BitRate
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_MpegPs::Streams_Finish()
+{
+ PTS=0; //Will be used for BitRate calculation
+ 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]);
+
+ //For each private Streams
+ for (size_t StreamID=0; StreamID<0x100; StreamID++)
+ Streams_Finish_PerStream(StreamID, Streams_Private1[StreamID]);
+
+ //For each extesnion Streams
+ for (size_t StreamID=0; StreamID<0x100; StreamID++)
+ Streams_Finish_PerStream(StreamID, Streams_Extension[StreamID]);
+
+ //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();
+ Streams_Private1.clear();
+ Streams_Extension.clear();
+ }
+
+ //Bitrate coherancy
+ if (!IsSub && PTS>0 && PTS!=(int64u)-1 && DTS!=0 && File_Size!=(int64u)-1)
+ {
+ int64u BitRate_FromDuration=File_Size*8000*90/DTS;
+ int64u BitRate_FromBitRates=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; StreamPos<Count_Get((stream_t)StreamKind); StreamPos++)
+ Clear((stream_t)StreamKind, StreamPos, (stream_t)Fill_Parameter((stream_t)StreamKind, Generic_Duration));
+ if (Count_Get(Stream_Video)==1)
+ Clear(Stream_Video, 0, Video_Duration);
+ }
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_MpegPs::Streams_Finish_PerStream(size_t StreamID, ps_stream &Temp)
+{
+ //By the parser
+ if (Temp.StreamKind==Stream_Max && !Temp.Parsers.empty() && Temp.Parsers[0])
+ Streams_Fill_PerStream(StreamID, Temp);
+
+ //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])
+ {
+ Temp.Parsers[0]->ShouldContinueParsing=false;
+ Finish(Temp.Parsers[0]);
+ Merge(*Temp.Parsers[0], StreamKind_Last, 0, StreamPos_Last);
+
+ //Special cases
+ if (Temp.Parsers[0]->Count_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 Text_Pos=0; Text_Pos<Text_Count; Text_Pos++)
+ {
+ Stream_Prepare(Stream_Text);
+ Merge(*Temp.Parsers[0], Stream_Text, Text_Pos, StreamPos_Last);
+
+ Ztring MuxingMode=Retrieve(Stream_Text, StreamPos_Last, "MuxingMode");
+ Fill(Stream_Text, StreamPos_Last, "MuxingMode", Ztring(_T("MPEG Video / "))+MuxingMode, true);
+ if (!IsSub)
+ Fill(Stream_Text, StreamPos_Last, "MuxingMode_MoreInfo", _T("Muxed in Video #")+Ztring().From_Number(Temp.StreamPos+1));
+ Ztring ID=Retrieve(Stream_Text, StreamPos_Last, Text_ID);
+ Fill(Stream_Text, StreamPos_Last, Text_ID, Retrieve(Stream_Video, Temp.StreamPos, Video_ID)+_T("-")+ID, true);
+ Fill(Stream_Text, StreamPos_Last, Text_ID_String, Retrieve(Stream_Video, Temp.StreamPos, Video_ID_String)+_T("-")+ID, true);
+ Fill(Stream_Text, StreamPos_Last, Text_Delay, Retrieve(Stream_Video, Temp.StreamPos, Video_Delay), true);
+ }
+
+ StreamKind_Last=Temp.StreamKind;
+ StreamPos_Last=Temp.StreamPos;
+ }
+ }
+
+ //More info
+ if (Temp.StreamKind!=Stream_Max) //Found
+ {
+ StreamKind_Last=Temp.StreamKind;
+ StreamPos_Last=Temp.StreamPos;
+
+ int64u Start=(int64u)-1, End=(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 (Start!=(int64u)-1 && End!=(int64u)-1)
+ {
+ //TimeStamp
+ if (End<Start)
+ End+=0x200000000LL; //33 bits, cyclic
+ int64u Duration=End-Start;
+ if (File_Size!=(int64u)-1 && File_Size>1024*1024*16 && End>=0x200000000LL)
+ {
+ //Testing coherancy
+ if (Duration/90>16*3600*1000)
+ Duration=0; //Disabling it
+ }
+ if (Duration)
+ {
+ if (StreamKind_Last==Stream_Video)
+ {
+ float64 FrameRate=Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate).To_float64();
+ if (FrameRate!=0)
+ Duration+=Ztring::ToZtring(Temp.FrameCount_AfterLast_TimeStamp_End*90*1000/FrameRate, 0).To_int64u();
+ }
+ if (Duration)
+ {
+ Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Duration), Duration/90, 10, true);
+ if (Duration>DTS)
+ DTS=Duration; //Saving maximum Duration
+ }
+ }
+ }
+ }
+
+ //Bitrate calculation
+ if (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)
+ PTS=(int64u)-1;
+ else
+ 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]!=0x00)
+ Buffer_Offset+=2;
+ if (Buffer_Offset<Buffer_Size && Buffer[Buffer_Offset-1]==0x00 || Buffer_Offset>=Buffer_Size)
+ 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_Offset<Buffer_Size && Buffer[Buffer_Offset]==0xFF)
+ Buffer_Offset++;
+
+ //Trailing 0x00
+ while(Buffer_Offset+3<=Buffer_Size
+ && Buffer[Buffer_Offset+2]==0x00
+ && Buffer[Buffer_Offset+1]==0x00
+ && Buffer[Buffer_Offset ]==0x00)
+ Buffer_Offset++;
+
+ //Must have enough buffer for having header
+ if (Buffer_Offset+3>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;
+
+ //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=true;
+ extension_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
+
+ //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))
+ {
+ 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
+ }
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+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; Pos<Streams[StreamID].Parsers.size(); Pos++)
+ if (Streams[StreamID].Parsers[Pos])
+ 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; Pos<Streams_Private1[StreamID].Parsers.size(); Pos++)
+ if (Streams_Private1[StreamID].Parsers[Pos])
+ 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; Pos<Streams_Extension[StreamID].Parsers.size(); Pos++)
+ if (Streams_Extension[StreamID].Parsers[Pos])
+ Streams_Extension[StreamID].Parsers[Pos]->Open_Buffer_Unsynch();
+ }
+ video_stream_Unlimited=false;
+ Buffer_DataSizeToParse=0;
+
+ #if MEDIAINFO_EVENTS
+ MpegPs_PES_FirstByte_IsAvailable=false;
+ #endif //MEDIAINFO_EVENTS
+}
+
+//---------------------------------------------------------------------------
+void File_MpegPs::Read_Buffer_Continue()
+{
+ if (Buffer_DataSizeToParse)
+ {
+ 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_Begin();
+ Data_Parse();
+ Element_Offset=Element_Size;
+ Element_End();
+ }
+
+ //Video unlimited specific, we didn't wait for the end (because this is... unlimited)
+ if (video_stream_Unlimited)
+ {
+ #if MEDIAINFO_EVENTS
+ if (FromTS)
+ {
+ MpegPs_PES_FirstByte_IsAvailable=true;
+ MpegPs_PES_FirstByte_Value=false;
+ }
+ #endif //MEDIAINFO_EVENTS
+
+ //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]!=0x00)
+ Buffer_Offset_Temp+=2;
+ if (Buffer_Offset_Temp<Buffer_Size && Buffer[Buffer_Offset_Temp-1]==0x00 || Buffer_Offset_Temp>=Buffer_Size)
+ 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 start_code or data
+ }
+
+ Element_Begin();
+ Data_Parse();
+ Element_Offset=Element_Size;
+ Element_End();
+ }
+}
+
+//***************************************************************************
+// Buffer - Par element
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_MpegPs::Header_Parse()
+#if MEDIAINFO_TRACE
+{
+ #if MEDIAINFO_EVENTS
+ if (FromTS)
+ {
+ MpegPs_PES_FirstByte_IsAvailable=true;
+ MpegPs_PES_FirstByte_Value=true;
+ }
+ #endif //MEDIAINFO_EVENTS
+
+ //Reinit
+ PTS=(int64u)-1;
+ DTS=(int64u)-1;
+
+ //Parsing
+ Skip_B3( "synchro");
+ Get_B1 (start_code, "start_code");
+
+ if (start_code!=0xB9 && start_code!=0xBA) //MPEG_program_end or pack_start have no PES
+ Header_Parse_PES_packet(start_code);
+ else if (!Header_Parse_Fill_Size()) //MPEG_program_end or pack_start specific
+ {
+ Element_WaitForMoreData();
+ return;
+ }
+ Header_Fill_Code(start_code);
+}
+#else //MEDIAINFO_TRACE
+{
+ #if MEDIAINFO_EVENTS
+ if (FromTS)
+ {
+ MpegPs_PES_FirstByte_IsAvailable=true;
+ MpegPs_PES_FirstByte_Value=true;
+ }
+ #endif //MEDIAINFO_EVENTS
+
+ //Reinit
+ PTS=(int64u)-1;
+ DTS=(int64u)-1;
+
+ //Parsing
+ start_code=Buffer[Buffer_Offset+3];
+ Element_Offset+=4;
+
+ if (start_code!=0xB9 && start_code!=0xBA) //MPEG_program_end or pack_start have no PES
+ Header_Parse_PES_packet(start_code);
+ else if (!Header_Parse_Fill_Size()) //MPEG_program_end or pack_start specific
+ {
+ Element_WaitForMoreData();
+ return;
+ }
+ Header_Fill_Code(start_code);
+}
+#endif //MEDIAINFO_TRACE
+
+//---------------------------------------------------------------------------
+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]!=0x00)
+ Buffer_Offset_Temp+=2;
+ if (Buffer_Offset_Temp<Buffer_Size && Buffer[Buffer_Offset_Temp-1]==0x00 || Buffer_Offset_Temp>=Buffer_Size)
+ 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;
+}
+
+//---------------------------------------------------------------------------
+void File_MpegPs::Header_Parse_PES_packet(int8u start_code)
+{
+ //Parsing
+ int16u PES_packet_length;
+ Get_B2 (PES_packet_length, "PES_packet_length");
+
+ //Filling
+ Header_Fill_Size(6+PES_packet_length);
+
+ //Parsing
+ switch (start_code)
+ {
+ //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
+ return;
+
+ //Element with PES Header
+ default :
+ switch (MPEG_Version)
+ {
+ case 1 : Header_Parse_PES_packet_MPEG1(start_code); break;
+ case 2 : Header_Parse_PES_packet_MPEG2(start_code); break;
+ default : ; //We don't know what to parse...
+ }
+ }
+
+ //Video unlimited specific
+ if (PES_packet_length==0 && Element_Offset<Element_Size)
+ if (!Header_Parse_Fill_Size())
+ {
+ //Return directly if we must unpack the elementary stream;
+ if (Demux_Unpacketize)
+ {
+ Element_WaitForMoreData();
+ return;
+ }
+
+ //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
+ }
+
+ //Can be cut in small chunks
+ if (PES_packet_length!=0 && Element_Offset<Element_Size && (size_t)(6+PES_packet_length)>Buffer_Size-Buffer_Offset
+ && ((start_code&0xE0)==0xC0 || (start_code&0xF0)==0xE0))
+ {
+ //Return directly if we must unpack the elementary stream;
+ if (Demux_Unpacketize)
+ {
+ Element_WaitForMoreData();
+ return;
+ }
+
+ 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
+ }
+}
+
+//---------------------------------------------------------------------------
+// Packet header data - MPEG-1
+void File_MpegPs::Header_Parse_PES_packet_MPEG1(int8u start_code)
+{
+ 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_Begin("PTS");
+ BS_Begin();
+ Mark_0();
+ Mark_0();
+ Mark_1();
+ Mark_0();
+ 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();
+
+ //Filling
+ PTS=(((int64u)PTS_32)<<30)
+ | (((int64u)PTS_29)<<15)
+ | (((int64u)PTS_14));
+ if (Streams[start_code].Searching_TimeStamp_End && start_code!=0xBD && start_code!=0xFD) //0xBD and 0xFD can contain multiple streams, TimeStamp management is in Streams management
+ {
+ Streams[start_code].TimeStamp_End.PTS.TimeStamp=PTS;
+ }
+ if (Searching_TimeStamp_Start && Streams[start_code].Searching_TimeStamp_Start && start_code!=0xBD && start_code!=0xFD) //0xBD and 0xFD can contain multiple streams, TimeStamp management is in Streams management
+ {
+ Streams[start_code].TimeStamp_Start.PTS.TimeStamp=PTS;
+ Streams[start_code].Searching_TimeStamp_Start=false;
+ }
+ Element_Info_From_Milliseconds(PTS/90);
+ Element_End();
+ }
+ else if ((stuffing_byte&0xF0)==0x30)
+ {
+ int16u PTS_29, PTS_14, DTS_29, DTS_14;
+ int8u PTS_32, DTS_32;
+ Element_Begin("PTS");
+ BS_Begin();
+ Mark_0();
+ Mark_0();
+ Mark_1();
+ Mark_1();
+ 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();
+
+ //Filling
+ PTS=(((int64u)PTS_32)<<30)
+ | (((int64u)PTS_29)<<15)
+ | (((int64u)PTS_14));
+ if (Streams[start_code].Searching_TimeStamp_End)
+ {
+ Streams[start_code].TimeStamp_End.PTS.File_Pos=File_Offset+Buffer_Offset;
+ Streams[start_code].TimeStamp_End.PTS.TimeStamp=PTS;
+ }
+ if (Searching_TimeStamp_Start && Streams[start_code].Searching_TimeStamp_Start)
+ {
+ Streams[start_code].TimeStamp_Start.PTS.TimeStamp=PTS;
+ }
+ Element_Info_From_Milliseconds(PTS/90);
+ Element_End();
+
+ Element_Begin("DTS");
+ BS_Begin();
+ Mark_0();
+ Mark_0();
+ Mark_0();
+ Mark_1_NoTrustError(); //Is "0" in one sample
+ 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();
+ BS_End();
+
+ //Filling
+ DTS=(((int64u)DTS_32)<<30)
+ | (((int64u)DTS_29)<<15)
+ | (((int64u)DTS_14));
+ if (Streams[start_code].Searching_TimeStamp_End)
+ {
+ Streams[start_code].TimeStamp_End.DTS.File_Pos=File_Offset+Buffer_Offset;
+ Streams[start_code].TimeStamp_End.DTS.TimeStamp=DTS;
+ }
+ if (Searching_TimeStamp_Start && Streams[start_code].Searching_TimeStamp_Start)
+ {
+ Streams[start_code].TimeStamp_Start.DTS.TimeStamp=DTS;
+ Streams[start_code].Searching_TimeStamp_Start=false;
+ }
+ Element_Info_From_Milliseconds(Streams[start_code].TimeStamp_End.DTS.TimeStamp/90);
+ Element_End();
+ }
+ else
+ {
+ BS_Begin();
+ Mark_0();
+ Mark_0();
+ Mark_0();
+ Mark_0();
+ Mark_1();
+ Mark_1();
+ Mark_1();
+ Mark_1();
+ BS_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+// Packet header data - MPEG-2
+void File_MpegPs::Header_Parse_PES_packet_MPEG2(int8u start_code)
+{
+ //Parsing
+ int8u PTS_DTS_flags, PES_header_data_length;
+ bool ESCR_flag, ES_rate_flag, DSM_trick_mode_flag, additional_copy_info_flag, PES_CRC_flag, PES_extension_flag;
+ #if MEDIAINFO_TRACE
+ BS_Begin();
+ Mark_1();
+ Mark_0();
+ Skip_S1(2, "PES_scrambling_control");
+ Skip_SB( "PES_priority");
+ Skip_SB( "data_alignment_indicator");
+ Skip_SB( "copyright");
+ Skip_SB( "original_or_copy");
+ Get_S1 (2, PTS_DTS_flags, "PTS_DTS_flags");
+ Get_SB (ESCR_flag, "ESCR_flag");
+ Get_SB (ES_rate_flag, "ES_rate_flag");
+ Get_SB (DSM_trick_mode_flag, "DSM_trick_mode_flag");
+ Get_SB (additional_copy_info_flag, "additional_copy_info_flag");
+ Get_SB (PES_CRC_flag, "PES_CRC_flag");
+ Get_SB (PES_extension_flag, "PES_extension_flag");
+ BS_End();
+ Get_B1 (PES_header_data_length, "PES_header_data_length");
+ #else //MEDIAINFO_TRACE
+ if (Element_Offset+3>=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;
+ #endif //MEDIAINFO_TRACE
+ int64u Element_Pos_After_Data=Element_Offset+PES_header_data_length;
+
+ //Options
+ if (PTS_DTS_flags==0x2)
+ {
+ #if MEDIAINFO_TRACE
+ int16u PTS_29, PTS_14;
+ int8u PTS_32;
+ Element_Begin("PTS_DTS_flags");
+ Element_Begin("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();
+ PTS=(((int64u)PTS_32)<<30)
+ | (((int64u)PTS_29)<<15)
+ | (((int64u)PTS_14));
+ Element_Info_From_Milliseconds(PTS/90);
+ Element_End();
+ Element_End();
+ #else //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;
+ }
+ 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;
+ #endif //MEDIAINFO_TRACE
+
+ //Filling
+ if (Streams[start_code].Searching_TimeStamp_End)
+ {
+ Streams[start_code].TimeStamp_End.PTS.File_Pos=File_Offset+Buffer_Offset;
+ Streams[start_code].TimeStamp_End.PTS.TimeStamp=PTS;
+ }
+ if (Searching_TimeStamp_Start && Streams[start_code].Searching_TimeStamp_Start)
+ {
+ Streams[start_code].TimeStamp_Start.PTS.TimeStamp=PTS;
+ Streams[start_code].Searching_TimeStamp_Start=false;
+ }
+ HasTimeStamps=true;
+ }
+ if (PTS_DTS_flags==0x3)
+ {
+ #if MEDIAINFO_TRACE
+ int16u PTS_29, PTS_14, DTS_29, DTS_14;
+ int8u PTS_32, DTS_32;
+ Element_Begin("PTS_DTS_flags");
+ Element_Begin("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();
+ PTS=(((int64u)PTS_32)<<30)
+ | (((int64u)PTS_29)<<15)
+ | (((int64u)PTS_14));
+ Element_Info_From_Milliseconds(PTS/90);
+ Element_End();
+ #else //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;
+ }
+ 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;
+ #endif //MEDIAINFO_TRACE
+
+ //Filling
+ if (Streams[start_code].Searching_TimeStamp_End)
+ {
+ Streams[start_code].TimeStamp_End.PTS.File_Pos=File_Offset+Buffer_Offset;
+ Streams[start_code].TimeStamp_End.PTS.TimeStamp=PTS;
+ }
+ if (Searching_TimeStamp_Start && Streams[start_code].Searching_TimeStamp_Start)
+ {
+ Streams[start_code].TimeStamp_Start.PTS.TimeStamp=PTS;
+ //Streams[start_code].Searching_TimeStamp_Start=false;
+ }
+
+ #if MEDIAINFO_TRACE
+ Element_Begin("DTS");
+ 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, DTS_32, "DTS_32");
+ Mark_1();
+ Get_S2 (15, DTS_29, "DTS_29");
+ Mark_1();
+ Get_S2 (15, DTS_14, "DTS_14");
+ Mark_1();
+ BS_End();
+ DTS=(((int64u)DTS_32)<<30)
+ | (((int64u)DTS_29)<<15)
+ | (((int64u)DTS_14));
+ Element_Info_From_Milliseconds(DTS/90);
+ Element_End();
+ Element_End();
+ #else //MEDIAINFO_TRACE
+ if (Element_Offset+5>Element_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;
+ }
+ 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;
+ #endif //MEDIAINFO_TRACE
+
+ //Filling
+ if (Streams[start_code].Searching_TimeStamp_End)
+ {
+ Streams[start_code].TimeStamp_End.DTS.File_Pos=File_Offset+Buffer_Offset;
+ Streams[start_code].TimeStamp_End.DTS.TimeStamp=DTS;
+ }
+ if (Searching_TimeStamp_Start && Streams[start_code].Searching_TimeStamp_Start)
+ {
+ Streams[start_code].TimeStamp_Start.DTS.TimeStamp=DTS;
+ Streams[start_code].Searching_TimeStamp_Start=false;
+ }
+ HasTimeStamps=true;
+ }
+ if (ESCR_flag && Element_Offset<Element_Pos_After_Data)
+ {
+ Element_Begin("ESCR_flag");
+ BS_Begin();
+ int16u ESCR_29, ESCR_14, ESCR_extension;
+ int8u ESCR_32;
+ Skip_S1( 2, "reserved");
+ Get_S1 ( 3, ESCR_32, "PTS_32");
+ Mark_1();
+ Get_S2 (15, ESCR_29, "PTS_29");
+ Mark_1();
+ Get_S2 (15, ESCR_14, "PTS_14");
+ Mark_1();
+ Get_S2 (15, ESCR_extension, "ESCR_extension");
+ Mark_1();
+ BS_End();
+ Element_End();
+ }
+ if (ES_rate_flag && Element_Offset<Element_Pos_After_Data)
+ {
+ Element_Begin("ES_rate_flag");
+ BS_Begin();
+ int32u ES_rate;
+ Mark_1();
+ Get_S3 (22, ES_rate, "ES_rate");
+ Mark_1();
+ BS_End();
+ Element_End();
+ }
+ if (DSM_trick_mode_flag && Element_Offset<Element_Pos_After_Data)
+ {
+ Element_Begin("DSM_trick_mode_flag");
+ BS_Begin();
+ int8u trick_mode_control;
+ Get_S1 (3, trick_mode_control, "trick_mode_control"); Param_Info(MpegPs_trick_mode_control_values[trick_mode_control]);
+ switch (trick_mode_control)
+ {
+ case 0 :{ //fast_forward
+ Skip_S1(2, "field_id");
+ Skip_SB( "intra_slice_refresh");
+ Skip_S1(2, "frequency_truncation");
+ }
+ break;
+ case 1 :{ //slow_motion
+ Skip_S1(5, "rep_cntrl");
+ }
+ break;
+ case 2 :{ //freeze_frame
+ Skip_S1(2, "field_id");
+ Skip_S1(3, "reserved");
+ }
+ break;
+ case 3 :{ //fast_reverse
+ Skip_S1(2, "field_id");
+ Skip_SB( "intra_slice_refresh");
+ Skip_S1(2, "frequency_truncation");
+ }
+ break;
+ case 4 :{ //slow_reverse
+ Skip_S1(5, "rep_cntrl");
+ }
+ break;
+ default:{
+ Skip_S1(5, "reserved");
+ }
+ }
+ BS_End();
+ Element_End();
+ }
+ if (additional_copy_info_flag && Element_Offset<Element_Pos_After_Data)
+ {
+ Element_Begin("additional_copy_info_flag");
+ BS_Begin();
+ Mark_1();
+ Skip_S1(7, "additional_copy_info");
+ BS_End();
+ Element_End();
+ }
+ if (additional_copy_info_flag && Element_Offset<Element_Pos_After_Data)
+ {
+ Element_Begin("additional_copy_info_flag");
+ Skip_B2( "previous_PES_packet_CRC");
+ Element_End();
+ }
+ if (PES_extension_flag && Element_Offset<Element_Pos_After_Data)
+ {
+ Element_Begin("PES_extension_flag");
+ BS_Begin();
+ bool PES_private_data_flag, pack_header_field_flag, program_packet_sequence_counter_flag, p_STD_buffer_flag, PES_extension_flag_2;
+ Get_SB (PES_private_data_flag, "PES_private_data_flag");
+ Get_SB (pack_header_field_flag, "pack_header_field_flag");
+ Get_SB (program_packet_sequence_counter_flag, "program_packet_sequence_counter_flag");
+ Get_SB (p_STD_buffer_flag, "P-STD_buffer_flag");
+ Skip_S1(3, "reserved");
+ Get_SB (PES_extension_flag_2, "PES_extension_flag_2");
+ BS_End();
+ if (PES_private_data_flag)
+ {
+ Element_Begin("PES_private_data_flag");
+ Skip_B16( "PES_private_data");
+ Element_End();
+ }
+ if (pack_header_field_flag)
+ {
+ Element_Begin("pack_header_field_flag");
+ int8u pack_field_length;
+ Get_B1 (pack_field_length, "pack_field_length");
+ Skip_XX(pack_field_length, "pack_header");
+ Element_End();
+ }
+ if (program_packet_sequence_counter_flag)
+ {
+ Element_Begin("program_packet_sequence_counter_flag");
+ BS_Begin();
+ Mark_1();
+ Skip_S1(7, "program_packet_sequence_counter");
+ Mark_1();
+ Skip_SB( "MPEG1_MPEG2_identifier");
+ Skip_S1(6, "original_stuff_length");
+ BS_End();
+ Element_End();
+ }
+ if (p_STD_buffer_flag)
+ {
+ Element_Begin("p_STD_buffer_flag");
+ BS_Begin();
+ Mark_0();
+ Skip_SB( "Should be 1"); //But I saw a file with "0"
+ Skip_SB( "P-STD_buffer_scale");
+ Skip_S2(13, "P-STD_buffer_size");
+ BS_End();
+ Element_End();
+ }
+ if (PES_extension_flag_2)
+ {
+ Element_Begin("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)
+ {
+ Get_S1 (7, stream_id_extension, "stream_id_extension"); Param_Info(MpegPs_stream_id_extension(stream_id_extension));
+ }
+ else
+ {
+ //This should not, 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_Info(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_End();
+ }
+ Element_End();
+ }
+ if (Element_Pos_After_Data>Element_Offset)
+ Skip_XX(Element_Pos_After_Data-Element_Offset, "stuffing_bytes");
+}
+
+//---------------------------------------------------------------------------
+void File_MpegPs::Data_Parse()
+{
+ //Needed?
+ if (!Streams[start_code].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 (start_code)
+ {
+ 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 0xFF : Element_Name("program_stream_directory"); Skip_XX(Element_Size, "Data"); break;
+ default:
+ if ((start_code&0xE0)==0xC0) audio_stream();
+ else if ((start_code&0xF0)==0xE0) video_stream();
+ else
+ Trusted_IsNot("Unattended element!");
+ }
+
+ //Jumping to the last DTS if needed
+ //if (!Parsing_End_ForDTS && File_Offset+Buffer_Offset==File_Size)
+ // Jump_DTS();
+
+ #if MEDIAINFO_EVENTS
+ MpegPs_PES_FirstByte_IsAvailable=false;
+ #endif //MEDIAINFO_EVENTS
+}
+
+//---------------------------------------------------------------------------
+void File_MpegPs::Detect_EOF()
+{
+ //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;
+ }
+
+ //Jumping only if needed
+ if (Streams.empty() || video_stream_Count>0 || audio_stream_Count>0 || private_stream_1_Count>0 || private_stream_2_Count==true || extension_stream_Count>0)
+ return;
+
+ //Jumping if needed
+ if (!Status[IsAccepted])
+ {
+ Accept("MPEG-PS");
+ if (!IsSub)
+ Fill(Stream_General, 0, General_Format, "MPEG-PS");
+ }
+ Fill("MPEG-PS");
+ if (File_Size>SizeToAnalyze && File_Offset+Buffer_Size<File_Size-SizeToAnalyze)
+ {
+ //Jumping
+ GoToFromEnd(SizeToAnalyze, "MPEG-PS");
+ Read_Buffer_Unsynched();
+ }
+}
+
+//---------------------------------------------------------------------------
+//Jumping to the last DTS if needed
+bool File_MpegPs::BookMark_Needed()
+{
+ if (IsSub || Streams.empty() || MediaInfoLib::Config.ParseSpeed_Get()>=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<ToJump)
+ ToJump=Streams[StreamID].TimeStamp_End.PTS.File_Pos;
+ Streams[StreamID].Searching_Payload=true;
+ }
+ if (Streams[StreamID].TimeStamp_End.DTS.File_Pos!=(int64u)-1)
+ {
+ if (Streams[StreamID].TimeStamp_End.DTS.File_Pos<ToJump)
+ ToJump=Streams[StreamID].TimeStamp_End.DTS.File_Pos;
+ Streams[StreamID].Searching_Payload=true;
+ }
+ if (Streams_Private1[StreamID].TimeStamp_End.PTS.File_Pos!=(int64u)-1)
+ {
+ if (Streams_Private1[StreamID].TimeStamp_End.PTS.File_Pos<ToJump)
+ ToJump=Streams_Private1[StreamID].TimeStamp_End.PTS.File_Pos;
+ Streams_Private1[StreamID].Searching_Payload=true;
+ }
+ if (Streams_Private1[StreamID].TimeStamp_End.DTS.File_Pos!=(int64u)-1)
+ {
+ if (Streams_Private1[StreamID].TimeStamp_End.DTS.File_Pos<ToJump)
+ ToJump=Streams_Private1[StreamID].TimeStamp_End.DTS.File_Pos;
+ Streams_Private1[StreamID].Searching_Payload=true;
+ }
+ if (Streams_Extension[StreamID].TimeStamp_End.PTS.File_Pos!=(int64u)-1)
+ {
+ if (Streams_Extension[StreamID].TimeStamp_End.PTS.File_Pos<ToJump)
+ ToJump=Streams_Extension[StreamID].TimeStamp_End.PTS.File_Pos;
+ Streams_Extension[StreamID].Searching_Payload=true;
+ }
+ if (Streams_Extension[StreamID].TimeStamp_End.DTS.File_Pos!=(int64u)-1)
+ {
+ if (Streams_Extension[StreamID].TimeStamp_End.DTS.File_Pos<ToJump)
+ ToJump=Streams_Extension[StreamID].TimeStamp_End.DTS.File_Pos;
+ Streams_Extension[StreamID].Searching_Payload=true;
+ }
+ }
+ if (Status[IsAccepted] && ToJump!=(int64u)-1)
+ {
+ Info("MPEG-PS, Jumping to nearly end of file");
+ Parsing_End_ForDTS=true;
+ File_GoTo=ToJump;
+ return true;
+ }
+
+ return false;
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+// Packet "B9"
+void File_MpegPs::MPEG_program_end()
+{
+ Element_Name("MPEG_program_end");
+
+ //Filling
+ Synched=false; //We don't know what can be after
+}
+
+//---------------------------------------------------------------------------
+// Packet "BA"
+void File_MpegPs::pack_start()
+{
+ Element_Name("pack_start");
+
+ //Parsing
+ int16u SysClock_29, SysClock_14;
+ int8u Version, SysClock_32, Padding;
+ BS_Begin();
+ Peek_S1( 2, Version);
+ if (Version==1)
+ {
+ //MPEG-2
+ MPEG_Version=2;
+ 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_Info(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
+ {
+ //MPEG-1
+ MPEG_Version=1;
+ 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_Info(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
+ }
+ }
+
+ SizeToAnalyze=program_mux_rate*50*2; //standard delay between TimeStamps is 0.7s, we try 2s 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
+ 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=false;
+
+ //Parsing
+ int32u rate_bound;
+ int8u audio_bound, video_bound;
+ BS_Begin();
+ Mark_1();
+ Get_S3 (22, rate_bound, "rate_bound"); Param_Info(rate_bound*400, " bps");
+ Mark_1();
+ Get_S1 ( 6, audio_bound, "audio_bound");
+ Info_SB( fixed_flag, "fixed_flag"); Param_Info(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;
+ if (Element_IsNotFinished())
+ Peek_SB(one);
+ while (one)
+ {
+ Element_Begin();
+ 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_Info(MpegPs_stream_id(stream_id));
+ Element_Name(Ztring().From_CC1(stream_id));
+ Element_Info(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_Info(Ztring::ToZtring(STD_buffer_size_bound*(STD_buffer_bound_scale?1024:128)) + _T(" bytes"));
+ Element_End();
+
+ FILLING_BEGIN();
+ if (stream_id==0xBD)
+ private_stream_1_Count=(int8u)-1;
+ if (stream_id==0xBF)
+ private_stream_2_Count=true;
+ if (stream_id==0xFD)
+ extension_stream_Count=(int8u)-1;
+ 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);
+ 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)
+ {
+ 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;
+ }
+ if (private_stream_1_ID)
+ Element_Info(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)
+ {
+ //From TS
+ video_stream_Count=0;
+ audio_stream_Count=0;
+ private_stream_1_Count=1;
+ private_stream_2_Count=false;
+ extension_stream_Count=0;
+ private_stream_1_ID=FromTS_stream_type;
+ private_stream_1_Offset=0;
+ Streams_Private1[private_stream_1_ID].stream_type=FromTS_stream_type;
+ }
+
+ //Registering
+ if (!Status[IsAccepted])
+ {
+ Data_Accept("MPEG-PS");
+ if (!IsSub)
+ Fill(Stream_General, 0, General_Format, "MPEG-PS");
+ }
+ Streams[start_code].StreamIsRegistred=true;
+ Streams_Private1[private_stream_1_ID].StreamIsRegistred=true;
+ 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;
+
+ //New parsers
+ #if MEDIAINFO_EVENTS
+ Element_Code=private_stream_1_ID;
+ #endif //MEDIAINFO_EVENTS
+ 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])
+ Open_Buffer_Init(Streams_Private1[private_stream_1_ID].Parsers[Streams_Private1[private_stream_1_ID].Parsers.size()-1]);
+ else
+ {
+ Streams_Private1[private_stream_1_ID].Parsers.clear();
+ #if defined(MEDIAINFO_AC3_YES)
+ {
+ File_Ac3* Parser=new File_Ac3;
+ if (Streams_Private1[private_stream_1_ID].stream_type==0 || Streams_Private1[private_stream_1_ID].stream_type==0x06) //None or private
+ Parser->Frame_Count_Valid=2;
+ Open_Buffer_Init(Parser);
+ Streams_Private1[private_stream_1_ID].Parsers.push_back(Parser);
+ }
+ #endif
+ #if defined(MEDIAINFO_DTS_YES)
+ {
+ File_Dts* Parser=new File_Dts;
+ if (Streams_Private1[private_stream_1_ID].stream_type==0 || Streams_Private1[private_stream_1_ID].stream_type==0x06) //None or private
+ Parser->Frame_Count_Valid=2;
+ Open_Buffer_Init(Parser);
+ Streams_Private1[private_stream_1_ID].Parsers.push_back(Parser);
+ }
+ #endif
+ }
+ }
+
+ //Specific
+ #if defined(MEDIAINFO_AES3_YES)
+ if (FromTS && FromTS_format_identifier==0x42535344 && PTS!=(int64u)-1) //"BSSD"
+ ((File_Aes3*)Streams_Private1[private_stream_1_ID].Parsers[0])->PTS=PTS;
+ #endif
+
+ //Demux
+ #if MEDIAINFO_DEMUX
+ if (Streams_Private1[private_stream_1_ID].Searching_Payload)
+ {
+ 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];
+ }
+ #endif //MEDIAINFO_DEMUX
+
+ //Parsing
+ if (Element_Offset<private_stream_1_Offset)
+ Skip_XX(private_stream_1_Offset-Element_Offset, "DVD-Video data");
+
+ xxx_stream_Parse(Streams_Private1[private_stream_1_ID], private_stream_1_Count);
+}
+
+//---------------------------------------------------------------------------
+bool File_MpegPs::private_stream_1_Choose_DVD_ID()
+{
+ private_stream_1_IsDvdVideo=false;
+
+ if (Element_Size<4)
+ return false;
+
+ //Parsing
+ int8u CodecID;
+ Get_B1 (CodecID, "CodecID");
+
+ //Testing
+ //Subtitles (CVD)
+ if (CodecID>=0x00 && 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
+ else 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)
+ {
+ if (FromTS_format_identifier==0x42535344) //"BSSD"
+ {
+ return ChooseParser_AES3(); //AES3 (SMPTE 320M)
+ }
+ switch (FromTS_stream_type)
+ {
+ case 0x0F : return ChooseParser_Adts(); //ADTS
+ 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 : switch (FromTS_descriptor_tag)
+ {
+ case 0x56 : return ChooseParser_NULL(); //Teletext
+ case 0x59 : return ChooseParser_NULL(); //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 ChooseParser_NULL();
+ }
+ }
+ }
+ else if (private_stream_1_IsDvdVideo)
+ {
+ //Subtitles (CVD)
+ if (private_stream_1_ID>=0x00 && 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 ChooseParser_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 ChooseParser_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");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_MpegPs::private_stream_1_Element_Info()
+{
+ if (FromTS)
+ {
+ switch (private_stream_1_ID)
+ {
+ case 0x80 : Element_Info("PCM"); return;
+ case 0x81 : Element_Info("AC3"); return;
+ case 0x83 :
+ case 0x87 : Element_Info("AC3+"); return;
+ case 0x86 : Element_Info("DTS"); return;
+ case 0xEA : Element_Info("VC1"); return;
+ default : return;
+ }
+ }
+ else
+ {
+ //Subtitles
+ if (private_stream_1_ID>=0x20 && private_stream_1_ID<=0x3F)
+ Element_Info("RLE");
+ //AC3
+ else if (private_stream_1_ID>=0x80 && private_stream_1_ID<=0x87)
+ Element_Info("AC3");
+ //DTS
+ else if (private_stream_1_ID>=0x88 && private_stream_1_ID<=0x8F)
+ Element_Info("DTS");
+ //SDDS
+ else if (private_stream_1_ID>=0x90 && private_stream_1_ID<=0x97)
+ Element_Info("SDDS");
+ //DTS
+ else if (private_stream_1_ID>=0x98 && private_stream_1_ID<=0x9F)
+ Element_Info("DTS");
+ //PCM
+ else if (private_stream_1_ID>=0xA0 && private_stream_1_ID<=0xAF)
+ Element_Info("LPCM");
+ //MLP
+ else if (private_stream_1_ID>=0xB0 && private_stream_1_ID<=0xBF)
+ Element_Info("MLP");
+ //AC3+
+ else if (private_stream_1_ID>=0xC0 && private_stream_1_ID<=0xCF)
+ Element_Info("AC3+");
+ //PS2
+ else if (private_stream_1_ID>=0xC0 && private_stream_1_ID<=0xCF)
+ Element_Info("PS2");
+ }
+}
+
+//---------------------------------------------------------------------------
+// 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=false;
+ }
+}
+
+//---------------------------------------------------------------------------
+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[start_code].StreamIsRegistred)
+ {
+ //For TS streams, which does not have Start chunk
+ if (FromTS)
+ {
+ video_stream_Count=0;
+ audio_stream_Count=1;
+ private_stream_1_Count=0;
+ private_stream_2_Count=false;
+ extension_stream_Count=0;
+ Streams[start_code].stream_type=FromTS_stream_type;
+ }
+
+ //If we have no Streams map --> Registering the Streams as MPEG Audio
+ if (Streams[start_code].stream_type==0)
+ {
+ if (MPEG_Version==2)
+ Streams[start_code].stream_type=0x04; //MPEG-2 Audio
+ else
+ Streams[start_code].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[start_code].StreamIsRegistred=true;
+
+ //New parsers
+ switch (Streams[start_code].stream_type)
+ {
+ case 0x0F : Streams[start_code].Parsers.push_back(ChooseParser_Adts()); Open_Buffer_Init(Streams[start_code].Parsers[0]); break;
+ case 0x03 :
+ case 0x04 : Streams[start_code].Parsers.push_back(ChooseParser_Mpega()); Open_Buffer_Init(Streams[start_code].Parsers[0]); break;
+ default :
+ #if defined(MEDIAINFO_MPEGA_YES)
+ {
+ File_Mpega* Parser=new File_Mpega;
+ Open_Buffer_Init(Parser);
+ Parser->Frame_Count_Valid=1;
+ Streams[start_code].Parsers.push_back(Parser);
+ }
+ #endif
+ #if defined(MEDIAINFO_ADTS_YES)
+ {
+ File_Adts* Parser=new File_Adts;
+ Open_Buffer_Init(Parser);
+ Streams[start_code].Parsers.push_back(Parser);
+ }
+ #endif
+ }
+ }
+
+ //Demux
+ Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream);
+
+ //Parsing
+ xxx_stream_Parse(Streams[start_code], audio_stream_Count);
+}
+
+//---------------------------------------------------------------------------
+void File_MpegPs::video_stream()
+{
+ Element_Name("Video");
+
+ if (!Streams[start_code].StreamIsRegistred)
+ {
+ //For TS streams, which does not have Start chunk
+ if (FromTS)
+ {
+ video_stream_Count=1;
+ audio_stream_Count=0;
+ private_stream_1_Count=0;
+ private_stream_2_Count=false;
+ extension_stream_Count=0;
+ Streams[start_code].stream_type=FromTS_stream_type;
+ }
+
+ //Registering
+ if (!Status[IsAccepted])
+ {
+ Data_Accept("MPEG-PS");
+ if (!IsSub)
+ Fill(Stream_General, 0, General_Format, "MPEG-PS");
+ }
+ Streams[start_code].StreamIsRegistred=true;
+
+ //New parsers
+ switch (Streams[start_code].stream_type)
+ {
+ case 0x10 : Streams[start_code].Parsers.push_back(ChooseParser_Mpeg4v()); Open_Buffer_Init(Streams[start_code].Parsers[0]); break;
+ case 0x1B : Streams[start_code].Parsers.push_back(ChooseParser_Avc() ); Open_Buffer_Init(Streams[start_code].Parsers[0]); break;
+ case 0x01 :
+ case 0x02 :
+ case 0x80 : Streams[start_code].Parsers.push_back(ChooseParser_Mpegv() ); Open_Buffer_Init(Streams[start_code].Parsers[0]); break;
+ default :
+ #if defined(MEDIAINFO_MPEGV_YES)
+ {
+ File_Mpegv* Parser=new File_Mpegv;
+ Open_Buffer_Init(Parser);
+ Parser->MPEG_Version=MPEG_Version;
+ Parser->ShouldContinueParsing=true;
+ Streams[start_code].Parsers.push_back(Parser);
+ }
+ #endif
+ #if defined(MEDIAINFO_AVC_YES)
+ {
+ File_Avc* Parser=new File_Avc;
+ Open_Buffer_Init(Parser);
+ Parser->ShouldContinueParsing=true;
+ Streams[start_code].Parsers.push_back(Parser);
+ }
+ #endif
+ #if defined(MEDIAINFO_MPEG4V_YES)
+ {
+ File_Mpeg4v* Parser=new File_Mpeg4v;
+ Open_Buffer_Init(Parser);
+ Parser->ShouldContinueParsing=true;
+ Streams[start_code].Parsers.push_back(Parser);
+ }
+ #endif
+ #if defined(MEDIAINFO_AVSV_YES)
+ {
+ File_AvsV* Parser=new File_AvsV;
+ Open_Buffer_Init(Parser);
+ Parser->ShouldContinueParsing=true;
+ Streams[start_code].Parsers.push_back(Parser);
+ }
+ #endif
+ }
+ }
+
+ //Demux
+ if (!(FromTS_stream_type==0x20
+ #if MEDIAINFO_DEMUX
+ && SubStream_Demux
+ #endif //MEDIAINFO_DEMUX
+ ))
+ Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream);
+
+ //Parsing
+ xxx_stream_Parse(Streams[start_code], video_stream_Count);
+
+ //Saving PTS
+ bool video_stream_IsFilled=false; //If parser is filled, frame count is more update, we stop testing PTS.
+ bool video_stream_IsInterlaced=false; //If interlaced, we must count the number of fields, not frames
+ for (size_t Pos=0; Pos<Streams[start_code].Parsers.size(); Pos++)
+ {
+ if (Streams[start_code].Parsers[Pos]->Status[IsFilled])
+ video_stream_IsFilled=true;
+ if (!video_stream_IsFilled && Streams[start_code].Parsers[Pos]->Frame_Count_InThisBlock)
+ {
+ video_stream_PTS_FrameCount+=Streams[start_code].Parsers[Pos]->Frame_Count_InThisBlock; //TODO: check if there are more than 1 parser with Frame_Count_InThisBlock>0
+ video_stream_IsInterlaced=Streams[start_code].Parsers[Pos]->Retrieve(Stream_Video, 0, Video_ScanType)==_T("Intelaced"); //TODO: SanType is written too late, not available on time, wrong data
+ }
+ }
+ if (!video_stream_IsFilled && !video_stream_Unlimited && PTS!=(int64u)-1)
+ {
+ if (PTS>=0x100000000LL)
+ video_stream_PTS_MustAddOffset=true;
+ if (video_stream_IsInterlaced)
+ video_stream_PTS_FrameCount*=2; //Count fields, not frames
+ int64u PTS_Calculated=((video_stream_PTS_MustAddOffset && PTS<0x100000000LL)?0x200000000LL:0)+PTS; //With Offset if needed
+ if (video_stream_PTS_FrameCount<=1)
+ video_stream_PTS.push_back(PTS_Calculated);
+ else if (!video_stream_PTS.empty())
+ {
+ //Calculating the average PTS per frame if there is more than 1 frame between PTS
+ int64u PTS_Calculated_Base=video_stream_PTS[video_stream_PTS.size()-1];
+ int64u PTS_Calculated_PerFrame=(PTS_Calculated-PTS_Calculated_Base)/video_stream_PTS_FrameCount;
+ for (size_t Pos=0; Pos<video_stream_PTS_FrameCount; Pos++)
+ video_stream_PTS.push_back(PTS_Calculated_Base+(1+Pos)*PTS_Calculated_PerFrame);
+ }
+ video_stream_PTS_FrameCount=0;
+ }
+}
+
+//---------------------------------------------------------------------------
+// Packet "FA"
+void File_MpegPs::SL_packetized_stream()
+{
+ Element_Name("SL-packetized_stream");
+
+ if (!Streams[start_code].StreamIsRegistred)
+ {
+ //For TS streams, which does not have Start chunk
+ if (FromTS)
+ {
+ video_stream_Count=0;
+ audio_stream_Count=1;
+ private_stream_1_Count=0;
+ private_stream_2_Count=false;
+ extension_stream_Count=0;
+ Streams[start_code].stream_type=FromTS_stream_type;
+ }
+
+ //Registering
+ Streams[start_code].StreamIsRegistred=true;
+ if (!Status[IsAccepted])
+ Data_Accept("MPEG-PS");
+ Streams[start_code].Searching_TimeStamp_Start=true;
+
+ //New parsers
+ if (FromTS_stream_type)
+ switch (FromTS_stream_type)
+ {
+ case 0x0F :
+ #if defined(MEDIAINFO_ADTS_YES)
+ {
+ File_Adts* Parser=new File_Adts;
+ Parser->Frame_Count_Valid=1;
+ Open_Buffer_Init(Parser);
+ Streams[start_code].Parsers.push_back(Parser);
+ }
+ #endif
+ break;
+
+ case 0x11 :
+ #if defined(MEDIAINFO_MPEG4_YES)
+ {
+ File_Aac* Parser=new File_Aac;
+ Parser->DecSpecificInfoTag=DecSpecificInfoTag;
+ Parser->SLConfig=SLConfig;
+ Open_Buffer_Init(Parser);
+ Streams[start_code].Parsers.push_back(Parser);
+ }
+ #endif
+ break;
+ default : ;
+ }
+ else
+ {
+ #if defined(MEDIAINFO_ADTS_YES)
+ {
+ File_Adts* Parser=new File_Adts;
+ Parser->Frame_Count_Valid=1;
+ Open_Buffer_Init(Parser);
+ Streams[start_code].Parsers.push_back(Parser);
+ }
+ #endif
+ #if defined(MEDIAINFO_MPEG4_YES)
+ {
+ File_Aac* Parser=new File_Aac;
+ Parser->DecSpecificInfoTag=DecSpecificInfoTag;
+ Parser->SLConfig=SLConfig;
+ Open_Buffer_Init(Parser);
+ Streams[start_code].Parsers.push_back(Parser);
+ }
+ #endif
+ }
+ }
+
+ //Parsing
+ if (SLConfig) //LATM
+ {
+ BS_Begin();
+ int8u paddingBits=0;
+ bool paddingFlag=false, idleFlag=false/*not in spec*/, DegPrioflag=false/*not ins specs*/, OCRflag=false,
+ accessUnitStartFlag=false/*should be "previous-SL packet has accessUnitEndFlag"*/, accessUnitEndFlag=false/*Should be "subsequent-SL packet has accessUnitStartFlag"*/,
+ decodingTimeStampFlag=false/*not in spec*/, compositionTimeStampFlag=false/*not in spec*/,
+ instantBitrateFlag=false/*not in spec*/;
+ if (SLConfig->useAccessUnitStartFlag)
+ Get_SB (accessUnitStartFlag, "accessUnitStartFlag");
+ if (SLConfig->useAccessUnitEndFlag)
+ Get_SB (accessUnitEndFlag, "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))
+ {
+ 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)
+ {
+ 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();
+ Skip_XX(Element_Size-Element_Offset, "AAC (raw)");
+ }
+
+ //Demux
+ if (MediaInfoLib::Config.Demux_Get())
+ {
+ 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);
+ }
+
+ //Parsing
+ xxx_stream_Parse(Streams[start_code], audio_stream_Count);
+}
+
+//---------------------------------------------------------------------------
+// Packet "FD"
+void File_MpegPs::extension_stream()
+{
+ Element_Name("With Extension");
+ Element_Info(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)
+ {
+ video_stream_Count=0;
+ audio_stream_Count=0;
+ private_stream_1_Count=0;
+ private_stream_2_Count=false;
+ extension_stream_Count=1;
+ }
+
+ //Registering
+ if (!Status[IsAccepted])
+ Data_Accept("MPEG-PS");
+ Streams[start_code].StreamIsRegistred=true;
+ Streams_Extension[stream_id_extension].StreamIsRegistred=true;
+ 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;
+
+ //New parsers
+ if ((stream_id_extension>=0x55 && stream_id_extension<=0x5F)
+ || (stream_id_extension==0x75 && stream_id_extension<=0x7F))
+ 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)
+ {
+ Streams_Extension[0x72].Parsers.clear(); //In case of HD part before Core part
+ Streams_Extension[0x71].Parsers.push_back(ChooseParser_DTS());
+ Streams_Extension[0x71].Parsers.push_back(ChooseParser_AC3());
+ }
+ else if (stream_id_extension==0x76)
+ {
+ Streams_Extension[0x72].Parsers.clear(); //In case of HD part before Core part
+ Streams_Extension[0x76].Parsers.push_back(ChooseParser_AC3());
+ }
+ else if (stream_id_extension==0x72)
+ {
+ if (Streams_Extension[0x71].Parsers.empty() && Streams_Extension[0x76].Parsers.empty())
+ {
+ Streams_Extension[0x72].Parsers.push_back(ChooseParser_DTS());
+ Streams_Extension[0x72].Parsers.push_back(ChooseParser_AC3());
+ }
+ /*
+ if (!Streams_Extension[0x71].Parsers.empty())
+ ; //Streams_Extension[0x72].Parsers.push_back(Streams_Extension[0x71].Parsers[0]); //Binding 0x72 to 0x71 (DTS-HD)
+ else if (!Streams_Extension[0x76].Parsers.empty())
+ ; //Streams_Extension[0x72].Parsers.push_back(Streams_Extension[0x76].Parsers[0]); //Binding 0x72 to 0x76 (TrueHD)
+ else
+ {
+ //Audio core is not yet ready, waiting
+ Skip_XX(Element_Size, "Waiting for core data...");
+ return;
+ }
+ */
+ }
+ for (size_t Pos=0; Pos<Streams_Extension[stream_id_extension].Parsers.size(); Pos++)
+ 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())
+ xxx_stream_Parse(Streams_Extension[0x71], extension_stream_Count);
+ if (!Streams_Extension[0x76].Parsers.empty())
+ xxx_stream_Parse(Streams_Extension[0x76], extension_stream_Count);
+ }
+ else
+ xxx_stream_Parse(Streams_Extension[stream_id_extension], extension_stream_Count);
+}
+
+//---------------------------------------------------------------------------
+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 &xxx_Count)
+{
+ switch (start_code)
+ {
+ case 0xBD :
+ case 0xFD :
+ //PTS
+ if (PTS!=(int64u)-1)
+ {
+ if (Streams[start_code].Searching_TimeStamp_End)
+ {
+ Temp.TimeStamp_End.PTS.File_Pos=File_Offset+Buffer_Offset;
+ Temp.TimeStamp_End.PTS.TimeStamp=PTS;
+ }
+ if (Searching_TimeStamp_Start && Temp.Searching_TimeStamp_Start)
+ {
+ Temp.TimeStamp_Start.PTS.TimeStamp=PTS;
+ Temp.Searching_TimeStamp_Start=false;
+ }
+ }
+
+ //DTS
+ if (DTS!=(int64u)-1)
+ {
+ if (Streams[start_code].Searching_TimeStamp_End)
+ {
+ Temp.TimeStamp_End.DTS.File_Pos=File_Offset+Buffer_Offset;
+ Temp.TimeStamp_End.DTS.TimeStamp=DTS;
+ }
+ if (Searching_TimeStamp_Start && DTS!=(int64u)-1 && Temp.Searching_TimeStamp_Start)
+ {
+ Temp.TimeStamp_Start.DTS.TimeStamp=DTS;
+ 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 (start_code==0xBD)
+ private_stream_1_Element_Info();
+ #endif //MEDIAINFO_TRACE
+
+ if (1 //Temp.StreamKind==Stream_Video
+ && ((DTS!=(int64u)-1 && Temp.TimeStamp_End.DTS.TimeStamp!=(int64u)-1)
+ || (PTS!=(int64u)-1 && Temp.TimeStamp_End.PTS.TimeStamp!=(int64u)-1)))
+ Temp.FrameCount_AfterLast_TimeStamp_End=0;
+
+ for (size_t Pos=0; Pos<Temp.Parsers.size(); Pos++)
+ if (Temp.Parsers[Pos] && !Temp.Parsers[Pos]->Status[IsFinished])
+ {
+ //PTS/DTS
+ if (Temp.Parsers[Pos]->PTS_DTS_Needed)
+ {
+ if (PCR!=(int64u)-1)
+ Temp.Parsers[Pos]->PCR=PCR;
+ if (PTS!=(int64u)-1)
+ Temp.Parsers[Pos]->PTS=PTS*1000000/90;
+ if (DTS!=(int64u)-1)
+ Temp.Parsers[Pos]->DTS=DTS*1000000/90;
+ }
+
+ #if MEDIAINFO_TRACE
+ if (Temp.Parsers.size()>1)
+ Element_Begin("Test");
+ #endif //MEDIAINFO_TRACE
+ Open_Buffer_Continue(Temp.Parsers[Pos], Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset));
+ #if MEDIAINFO_TRACE
+ if (Temp.Parsers.size()>1)
+ Element_End();
+ #endif //MEDIAINFO_TRACE
+
+ if ((Temp.Parsers[Pos]->Status[IsAccepted] && Temp.Parsers[Pos]->Status[IsFinished])
+ || (!Parsing_End_ForDTS && Temp.Parsers[Pos]->Status[IsFilled]))
+ {
+ if (MediaInfoLib::Config.ParseSpeed_Get()<1 && Temp.Parsers[Pos]->Count_Get(Stream_Video)==0) //TODO: speed improvement, we do this only for CC
+ Temp.Searching_Payload=false;
+ if (xxx_Count>0)
+ xxx_Count--;
+ }
+ 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; Pos2<Temp.Parsers.size(); Pos2++)
+ {
+ if (Pos2!=Pos)
+ delete *(Temp.Parsers.begin()+Pos2);
+ }
+ Temp.Parsers.clear();
+ Temp.Parsers.push_back(Parser);
+ }
+ }
+ }
+
+ if (!Temp.Parsers.empty())
+ Temp.FrameCount_AfterLast_TimeStamp_End+=Temp.Parsers[0]->Frame_Count_InThisBlock;
+
+ Element_Show();
+
+ #if MEDIAINFO_EVENTS
+ if (DTS==(int64u)-1)
+ DTS=PTS;
+
+ //New PES
+ if (MpegPs_PES_FirstByte_IsAvailable && MpegPs_PES_FirstByte_Value)
+ {
+ //Demux of substream data
+ if (FromTS_stream_type==0x1B && SubStream_Demux)
+ {
+ if (!SubStream_Demux->Buffers.empty() && SubStream_Demux->Buffers[0]->DTS<DTS)
+ {
+ Demux(SubStream_Demux->Buffers[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!=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=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_EVENTS
+}
+
+//***************************************************************************
+// Helpers
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_MpegPs::Header_Parser_QuickSearch()
+{
+ while ( Buffer_Offset+4<=Buffer_Size
+ && CC3(Buffer+Buffer_Offset)==0x000001)
+ {
+ //Getting start_code
+ int8u start_code=Buffer[Buffer_Offset+3];
+
+ //Searching start
+ if (Streams[start_code].Searching_Payload)
+ {
+ if (start_code!=0xBD || !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[start_code].Searching_TimeStamp_End)
+ {
+ switch(start_code)
+ {
+ //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 && Buffer[Buffer_Offset_Temp]==0xFF)
+ {
+ Buffer_Offset_Temp++;
+ if (Buffer_Offset_Temp+1>=Buffer_Size)
+ return false; //Not enough data
+ }
+ if (Buffer_Offset_Temp+1>=Buffer_Size)
+ return false; //Not enough data
+ if (Buffer_Offset_Temp<Buffer_Size && (Buffer[Buffer_Offset_Temp]&0xF0)!=0x00)
+ return true; //With a PTS
+ }
+ if (MPEG_Version==2)
+ {
+ if (Buffer_Offset+8>Buffer_Size)
+ return false; //Not enough buffer
+ if ((Buffer[Buffer_Offset+7]&0xC0)!=0x00)
+ return true; //With a PTS
+ }
+ }
+ }
+
+ //Getting size
+ switch(start_code)
+ {
+ //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]!=0x00)
+ Buffer_Offset+=2;
+ if (Buffer_Offset<Buffer_Size && Buffer[Buffer_Offset-1]==0x00 || Buffer_Offset>=Buffer_Size)
+ 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<Buffer_Size && Buffer[Buffer_Offset]==0xFF)
+ Buffer_Offset++;
+
+ //Trailing 0x00
+ while(Buffer_Offset+3<=Buffer_Size
+ && Buffer[Buffer_Offset+2]==0x00
+ && Buffer[Buffer_Offset+1]==0x00
+ && Buffer[Buffer_Offset ]==0x00)
+ Buffer_Offset++;
+ }
+ else
+ {
+ Buffer_Offset+=6;
+ while(Buffer_Offset+4<=Buffer_Size && !(CC3(Buffer+Buffer_Offset)==0x000001 && Buffer[Buffer_Offset+3]>=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 start_code 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* Handle=new File_Mpegv;
+ Handle->MPEG_Version=MPEG_Version;
+ Handle->ShouldContinueParsing=true;
+ #else
+ //Filling
+ File__Analyze* Handle=new File_Unknown();
+ Open_Buffer_Init(Handle);
+ Handle->Stream_Prepare(Stream_Video);
+ Handle->Fill(Stream_Video, 0, Video_Format, "MPEG Video");
+ switch (FromTS_stream_type)
+ {
+ case 0x01 : Handle->Fill(Stream_Video, 0, Video_Codec, "MPEG-1V");
+ Handle->Fill(Stream_Video, 0, Video_Format_Version, "Version 1"); break;
+ case 0x02 : Handle->Fill(Stream_Video, 0, Video_Codec, "MPEG-2V");
+ Handle->Fill(Stream_Video, 0, Video_Format_Version, "Version 2"); break;
+ default : Handle->Fill(Stream_Video, 0, Video_Codec, "MPEG-V");
+ }
+ #endif
+ return Handle;
+}
+
+//---------------------------------------------------------------------------
+File__Analyze* File_MpegPs::ChooseParser_Mpeg4v()
+{
+ //Filling
+ #if defined(MEDIAINFO_MPEG4V_YES)
+ File_Mpeg4v* Handle=new File_Mpeg4v;
+ Handle->Frame_Count_Valid=1;
+ #else
+ //Filling
+ File__Analyze* Handle=new File_Unknown();
+ Open_Buffer_Init(Handle);
+ Handle->Stream_Prepare(Stream_Video);
+ Handle->Fill(Stream_Video, 0, Video_Codec, "MPEG-4V");
+ Handle->Fill(Stream_Video, 0, Video_Format, "MPEG-4 Visual");
+ #endif
+ return Handle;
+}
+
+//---------------------------------------------------------------------------
+File__Analyze* File_MpegPs::ChooseParser_Avc()
+{
+ //Filling
+ #if defined(MEDIAINFO_AVC_YES)
+ File_Avc* Handle=new File_Avc;
+ #else
+ //Filling
+ File__Analyze* Handle=new File_Unknown();
+ Open_Buffer_Init(Handle);
+ Handle->Stream_Prepare(Stream_Video);
+ Handle->Fill(Stream_Video, 0, Video_Codec, "AVC");
+ Handle->Fill(Stream_Video, 0, Video_Format, "AVC");
+ #endif
+ return Handle;
+}
+
+//---------------------------------------------------------------------------
+File__Analyze* File_MpegPs::ChooseParser_VC1()
+{
+ //Filling
+ #if defined(MEDIAINFO_VC1_YES)
+ File__Analyze* Handle=new File_Vc1;
+ ((File_Vc1*)Handle)->Frame_Count_Valid=30;
+ #else
+ //Filling
+ File__Analyze* Handle=new File_Unknown();
+ Open_Buffer_Init(Handle);
+ Handle->Stream_Prepare(Stream_Video);
+ Handle->Fill(Stream_Video, 0, Video_Codec, "VC-1");
+ Handle->Fill(Stream_Video, 0, Video_Format, "VC-1");
+ #endif
+ return Handle;
+}
+
+//---------------------------------------------------------------------------
+File__Analyze* File_MpegPs::ChooseParser_Dirac()
+{
+ //Filling
+ #if defined(MEDIAINFO_DIRAC_YES)
+ File__Analyze* Handle=new File_Dirac;
+ ((File_Dirac*)Handle)->Frame_Count_Valid=1;
+ #else
+ //Filling
+ File__Analyze* Handle=new File_Unknown();
+ Open_Buffer_Init(Handle);
+ Handle->Stream_Prepare(Stream_Video);
+ Handle->Fill(Stream_Video, 0, Video_Codec, "Dirac");
+ Handle->Fill(Stream_Video, 0, Video_Format, "Dirac");
+ #endif
+ return Handle;
+}
+
+//---------------------------------------------------------------------------
+File__Analyze* File_MpegPs::ChooseParser_Mpega()
+{
+ //Filling
+ #if defined(MEDIAINFO_MPEGA_YES)
+ File_Mpega* Handle=new File_Mpega;
+ Handle->Frame_Count_Valid=1;
+ #else
+ //Filling
+ File__Analyze* Handle=new File_Unknown();
+ Open_Buffer_Init(Handle);
+ Handle->Stream_Prepare(Stream_Audio);
+ Handle->Fill(Stream_Audio, 0, Audio_Format, "MPEG Audio");
+ switch (FromTS_stream_type)
+ {
+ case 0x03 : Handle->Fill(Stream_Audio, 0, Audio_Codec, "MPEG-1A");
+ Handle->Fill(Stream_Audio, 0, Audio_Format_Version, "Version 1"); break;
+ case 0x04 : Handle->Fill(Stream_Audio, 0, Audio_Codec, "MPEG-2A");
+ Handle->Fill(Stream_Audio, 0, Audio_Format_Version, "Version 2"); break;
+ default : Handle->Fill(Stream_Audio, 0, Audio_Codec, "MPEG-A"); break;
+ }
+ #endif
+ return Handle;
+}
+
+//---------------------------------------------------------------------------
+File__Analyze* File_MpegPs::ChooseParser_Adts()
+{
+ //Filling
+ #if defined(MEDIAINFO_ADTS_YES)
+ File__Analyze* Handle=new File_Adts;
+ #else
+ //Filling
+ File__Analyze* Handle=new File_Unknown();
+ Open_Buffer_Init(Handle);
+ Handle->Stream_Prepare(Stream_Audio);
+ Handle->Fill(Stream_Audio, 0, Audio_Codec, "AAC");
+ Handle->Fill(Stream_Audio, 0, Audio_Format, "AAC");
+ #endif
+ return Handle;
+}
+
+//---------------------------------------------------------------------------
+File__Analyze* File_MpegPs::ChooseParser_AC3()
+{
+ //Filling
+ #if defined(MEDIAINFO_AC3_YES)
+ File_Ac3* Handle=new File_Ac3();
+ Handle->Frame_Count_Valid=2; //2 frames to be sure
+ #else
+ //Filling
+ File__Analyze* Handle=new File_Unknown();
+ Open_Buffer_Init(Handle);
+ Handle->Stream_Prepare(Stream_Audio);
+ Handle->Fill(Stream_Audio, 0, Audio_Format, private_stream_1_ID==0x83?"E-AC-3":"AC-3");
+ Handle->Fill(Stream_Audio, 0, Audio_Codec, private_stream_1_ID==0x83?"AC3+":"AC3");
+ #endif
+ return Handle;
+}
+
+//---------------------------------------------------------------------------
+File__Analyze* File_MpegPs::ChooseParser_DTS()
+{
+ //Filling
+ #if defined(MEDIAINFO_DTS_YES)
+ File__Analyze* Handle=new File_Dts();
+ ((File_Dts*)Handle)->Frame_Count_Valid=2;
+ #else
+ //Filling
+ File__Analyze* Handle=new File_Unknown();
+ Open_Buffer_Init(Handle);
+ Handle->Stream_Prepare(Stream_Audio);
+ Handle->Fill(Stream_Audio, 0, Audio_Format, "DTS");
+ Handle->Fill(Stream_Audio, 0, Audio_Codec, "DTS");
+ #endif
+ return Handle;
+}
+
+//---------------------------------------------------------------------------
+File__Analyze* File_MpegPs::ChooseParser_SDDS()
+{
+ //Filling
+ #if defined(MEDIAINFO_SDDS_YES)
+ //Filling
+ File__Analyze* Handle=new File_Unknown();
+ Open_Buffer_Init(Handle);
+ Handle->Stream_Prepare(Stream_Audio);
+ Handle->Fill(Stream_Audio, StreamPos_Last, Audio_Format, "SDDS");
+ Handle->Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "SDDS");
+ #else
+ //Filling
+ File__Analyze* Handle=new File_Unknown();
+ Handle->Stream_Prepare(Stream_Audio);
+ Handle->Fill(Stream_Audio, 0, Audio_Format, "SDDS");
+ Handle->Fill(Stream_Audio, 0, Audio_Codec, "SDDS");
+ #endif
+ return Handle;
+}
+
+//---------------------------------------------------------------------------
+File__Analyze* File_MpegPs::ChooseParser_AAC()
+{
+ //Filling
+ #if defined(MEDIAINFO_ADTS_YES)
+ //Filling
+ File__Analyze* Handle=new File_Aac();
+ #else
+ //Filling
+ File__Analyze* Handle=new File_Unknown();
+ Open_Buffer_Init(Handle);
+ Handle->Stream_Prepare(Stream_Audio);
+ Handle->Fill(Stream_Audio, 0, Audio_Format, "AAC");
+ Handle->Fill(Stream_Audio, 0, Audio_Codec, "AAC");
+ #endif
+ return Handle;
+}
+
+//---------------------------------------------------------------------------
+File__Analyze* File_MpegPs::ChooseParser_PCM()
+{
+ //Filling
+ #if defined(MEDIAINFO_PCM_YES)
+ File__Analyze* Handle=new File_Pcm();
+ Ztring Codec;
+ switch (private_stream_1_ID)
+ {
+ case 0x80 : Codec=_T("M2TS"); break;
+ case 0x83 : Codec=_T("EVOB"); break;
+ default : Codec=_T("VOB");
+ }
+ ((File_Pcm*)Handle)->Codec=Codec;
+ #else
+ //Filling
+ File__Analyze* Handle=new File_Unknown();
+ Open_Buffer_Init(Handle);
+ Handle->Stream_Prepare(Stream_Audio);
+ Handle->Fill(Stream_Audio, 0, Audio_Format, "PCM");
+ Handle->Fill(Stream_Audio, 0, Audio_Codec, "PCM");
+ #endif
+ return Handle;
+}
+
+//---------------------------------------------------------------------------
+File__Analyze* File_MpegPs::ChooseParser_RLE()
+{
+ //Filling
+ #if defined(MEDIAINFO_RLE_YES)
+ File__Analyze* Handle=new File_Rle();
+ #else
+ //Filling
+ File__Analyze* Handle=new File_Unknown();
+ Open_Buffer_Init(Handle);
+ Handle->Stream_Prepare(Stream_Text);
+ Handle->Fill(Stream_Text, 0, Text_Format, "RLE");
+ Handle->Fill(Stream_Text, 0, Text_Codec, "RLE");
+ #endif
+ return Handle;
+}
+
+//---------------------------------------------------------------------------
+File__Analyze* File_MpegPs::ChooseParser_PGS()
+{
+ //Filling
+ #if defined(MEDIAINFO_PGS_YES)
+ File__Analyze* Handle=new File_Pgs();
+ #else
+ //Filling
+ File__Analyze* Handle=new File_Unknown();
+ Open_Buffer_Init(Handle);
+ Handle->Stream_Prepare(Stream_Text);
+ Handle->Fill(Stream_Text, 0, Text_Format, "PGS");
+ Handle->Fill(Stream_Text, 0, Text_Codec, "PGS");
+ #endif
+ return Handle;
+}
+
+//---------------------------------------------------------------------------
+File__Analyze* File_MpegPs::ChooseParser_AES3()
+{
+ //Filling
+ #if defined(MEDIAINFO_AES3_YES)
+ File__Analyze* Handle=new File_Aes3();
+ #else
+ //Filling
+ File__Analyze* Handle=new File_Unknown();
+ Open_Buffer_Init(Handle);
+ Handle->Stream_Prepare(Stream_Audio);
+ Handle->Fill(Stream_Audio, 0, Audio_Format, "AES3");
+ Handle->Fill(Stream_Audio, 0, Audio_Codec, "AES3");
+ #endif
+ return Handle;
+}
+
+//---------------------------------------------------------------------------
+File__Analyze* File_MpegPs::ChooseParser_PS2()
+{
+ //Filling
+ #if defined(MEDIAINFO_PS2A_YES)
+ File__Analyze* Handle=new File_Ps2Audio();
+ #else
+ //Filling
+ File__Analyze* Handle=new File_Unknown();
+ Open_Buffer_Init(Handle);
+ Handle->Stream_Prepare(Stream_Audio);
+ #endif
+ return Handle;
+}
+
+//---------------------------------------------------------------------------
+File__Analyze* File_MpegPs::ChooseParser_NULL()
+{
+ //Filling
+ //File__Analyze* Handle=new File__Analyze();
+ //return Handle;
+ return NULL;
+}
+
+//***************************************************************************
+// Output_Buffer
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+size_t File_MpegPs::Output_Buffer_Get (const String &Code)
+{
+ //Parsing Parsers
+ for (size_t Streams_Pos=0; Streams_Pos<Streams.size(); Streams_Pos++)
+ for (size_t Pos=0; Pos<Streams[Streams_Pos].Parsers.size(); Pos++)
+ if (Streams[Streams_Pos].Parsers[Pos])
+ if (size_t Size=Streams[Streams_Pos].Parsers[Pos]->Output_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_Pos<Streams.size(); Streams_Pos++)
+ for (size_t Pos=0; Pos<Streams[Streams_Pos].Parsers.size(); Pos++)
+ if (Streams[Streams_Pos].Parsers[Pos])
+ if (size_t Size=Streams[Streams_Pos].Parsers[Pos]->Output_Buffer_Get(Pos_))
+ return Size;
+
+ return 0;
+}
+
+} //Namespace
+
+#endif //MEDIAINFO_MPEGPS_YES
+
+
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_MpegPs.h b/src/thirdparty/MediaInfo/Multiple/File_MpegPs.h
new file mode 100644
index 000000000..a42505ac4
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_MpegPs.h
@@ -0,0 +1,276 @@
+// File_Mpeg - Info for MPEG files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about MPEG files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_MpegPsH
+#define MediaInfo_MpegPsH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include "MediaInfo/Multiple/File_Mpeg4_Descriptors.h"
+#include <map>
+//---------------------------------------------------------------------------
+
+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_Mpeg4_Descriptors::decspecificinfotag* DecSpecificInfoTag;
+ 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<buffer*> Buffers;
+
+ demux()
+ {
+ }
+
+ ~demux()
+ {
+ for (size_t Pos=0; Pos<Buffers.size(); Pos++)
+ delete Buffers[Pos]; //Buffers[Pos]=NULL;
+ }
+ };
+ demux* SubStream_Demux;
+ #endif //MEDIAINFO_DEMUX
+
+ //Out
+ bool HasTimeStamps;
+
+ //Constructor/Destructor
+ File_MpegPs();
+ ~File_MpegPs();
+
+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 - Global
+ void Read_Buffer_Unsynched();
+ void Read_Buffer_Continue ();
+
+ //Buffer - Per element
+ void Header_Parse();
+ bool Header_Parse_Fill_Size();
+ void Header_Parse_PES_packet(int8u start_code);
+ void Header_Parse_PES_packet_MPEG1(int8u start_code);
+ void Header_Parse_PES_packet_MPEG2(int8u start_code);
+ void Data_Parse();
+ void Detect_EOF();
+ bool BookMark_Needed();
+
+ //Packet
+ void MPEG_program_end(); //0xB9
+ void pack_start(); //0xBA
+ void system_header_start(); //0xBB
+ void program_stream_map(); //0xBC
+ void private_stream_1(); //0xBD
+ void padding_stream(); //0xBE
+ void private_stream_2(); //0xBF
+ void audio_stream(); //0xC0 --> 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();
+ void private_stream_1_Element_Info();
+ 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;
+ bool private_stream_2_Count;
+ int8u extension_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;
+ int8u DVD_Identifier;
+ std::vector<File__Analyze*> Parsers; //Sometimes, we need to do parallel tests
+ Mpeg_TimeStamp TimeStamp_Start;
+ Mpeg_TimeStamp TimeStamp_End;
+ bool StreamIsRegistred;
+ bool Searching_Payload;
+ bool Searching_TimeStamp_Start;
+ bool Searching_TimeStamp_End;
+ size_t FrameCount_AfterLast_TimeStamp_End;
+
+ ps_stream()
+ {
+ StreamKind=Stream_Max;
+ StreamPos=0;
+ stream_type=0;
+ DVD_Identifier=0;
+ StreamIsRegistred=false;
+ Searching_Payload=false;
+ Searching_TimeStamp_Start=false;
+ Searching_TimeStamp_End=false;
+ FrameCount_AfterLast_TimeStamp_End=0;
+ }
+
+ ~ps_stream()
+ {
+ for (size_t Pos=0; Pos<Parsers.size(); Pos++)
+ delete Parsers[Pos]; //Parsers[Pos]=NULL;
+ }
+ };
+ std::vector<ps_stream> Streams;
+ std::vector<ps_stream> Streams_Private1; //There can have multiple streams in one private stream
+ std::vector<ps_stream> Streams_Extension; //There can have multiple streams in one private stream
+ int8u start_code;
+
+ //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;
+ int64u PTS;
+ int64u DTS;
+ bool Parsing_End_ForDTS;
+ std::vector<int64u> video_stream_PTS;
+ size_t video_stream_PTS_FrameCount;
+ bool video_stream_PTS_MustAddOffset;
+ bool Demux_Unpacketize;
+
+ //Helpers
+ bool Header_Parser_QuickSearch();
+
+ //Parsers
+ File__Analyze* ChooseParser_Mpegv();
+ File__Analyze* ChooseParser_Mpeg4v();
+ File__Analyze* ChooseParser_Avc();
+ File__Analyze* ChooseParser_VC1();
+ File__Analyze* ChooseParser_Dirac();
+ File__Analyze* ChooseParser_Mpega();
+ File__Analyze* ChooseParser_Adts();
+ File__Analyze* ChooseParser_AC3();
+ File__Analyze* ChooseParser_DTS();
+ File__Analyze* ChooseParser_SDDS();
+ File__Analyze* ChooseParser_AAC();
+ File__Analyze* ChooseParser_PCM();
+ File__Analyze* ChooseParser_AES3();
+ File__Analyze* ChooseParser_RLE();
+ File__Analyze* ChooseParser_PGS();
+ File__Analyze* ChooseParser_PS2();
+ File__Analyze* ChooseParser_NULL();
+
+ //File__Analyze helpers
+ void Streams_Fill_PerStream(size_t StreamID, ps_stream &Temp);
+ void Streams_Finish_PerStream(size_t StreamID, ps_stream &Temp);
+ void xxx_stream_Parse(ps_stream &Temp, int8u &xxx_Count);
+
+ //Output buffer
+ size_t Output_Buffer_Get (const String &Value);
+ size_t Output_Buffer_Get (size_t Pos);
+};
+
+} //NameSpace
+
+#endif
+
+
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_MpegTs.cpp b/src/thirdparty/MediaInfo/Multiple/File_MpegTs.cpp
new file mode 100644
index 000000000..6c8c21a5b
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_MpegTs.cpp
@@ -0,0 +1,1689 @@
+// File_Mpegts - Info for MPEG Transport Stream files
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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 <memory>
+#include <algorithm>
+#if MEDIAINFO_EVENTS
+ #include "MediaInfo/MediaInfo_Config_MediaInfo.h"
+ #include "MediaInfo/MediaInfo_Events_Internal.h"
+#endif //MEDIAINFO_EVENTS
+using namespace std;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Constants
+//***************************************************************************
+
+namespace Elements
+{
+ const int32u HDMV=0x48444D56; //BluRay
+}
+
+//***************************************************************************
+// 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);
+
+//---------------------------------------------------------------------------
+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()
+:File__Duplicate()
+{
+ //Configuration
+ ParserName=_T("MpegTs");
+ #if MEDIAINFO_EVENTS
+ ParserIDs[0]=MediaInfo_Parser_MpegTs;
+ StreamIDs_Width[0]=4;
+ #endif //MEDIAINFO_EVENTS
+ MustSynchronize=true;
+ Buffer_TotalBytes_FirstSynched_Max=64*1024;
+ Trusted_Multiplier=2;
+
+ //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
+
+ //Data
+ MpegTs_JumpTo_Begin=MediaInfoLib::Config.MpegTs_MaximumOffset_Get();
+ MpegTs_JumpTo_End=16*1024*1024;
+ Searching_TimeStamp_Start=true;
+ Complete_Stream=NULL;
+}
+
+File_MpegTs::~File_MpegTs ()
+{
+ delete Complete_Stream; Complete_Stream=NULL;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_MpegTs::Streams_Fill()
+{
+ if (Complete_Stream==NULL || Complete_Stream->Streams.empty())
+ return; //Not initialized
+
+ //Per stream
+ for (int16u PID=0; PID<0x2000; PID++)
+ Streams_Fill_PerStream(PID, Complete_Stream->Streams[PID]);
+
+ //Fill General
+ Fill(Stream_General, 0, General_Format, BDAV_Size?"BDAV":(TSP_Size?"MPEG-TS 188+16":"MPEG-TS"), Unlimited, true, true);
+ if (Complete_Stream->transport_stream_id_IsValid)
+ {
+ Fill(Stream_General, 0, General_ID, Complete_Stream->transport_stream_id, 16);
+ Fill(Stream_General, 0, General_ID_String, /*Decimal_Hexa(*/Complete_Stream->transport_stream_id/*)*/, 16, true);
+ }
+ if (!Complete_Stream->network_name.empty())
+ Fill(Stream_General, 0, General_NetworkName, Complete_Stream->network_name);
+ if (!Complete_Stream->original_network_name.empty())
+ Fill(Stream_General, 0, General_OriginalNetworkName, Complete_Stream->original_network_name);
+ Ztring Countries;
+ Ztring TimeZones;
+ for (std::map<Ztring, Ztring>::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);
+ }
+ if (!TimeZones.empty())
+ {
+ TimeZones.resize(TimeZones.size()-3);
+ Fill(Stream_General, 0, General_TimeZone, TimeZones);
+ }
+ if (!Complete_Stream->Duration_Start.empty())
+ Fill(Stream_General, 0, General_Duration_Start, Complete_Stream->Duration_Start);
+ 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<std::string, ZenLib::Ztring>::iterator Info=Transport_Stream->second.Infos.begin(); Info!=Transport_Stream->second.Infos.end(); Info++)
+ Fill(Stream_General, 0, Info->first.c_str(), Info->second);
+
+ //Per source (ATSC)
+ std::map<Ztring, Ztring> EPGs;
+ 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<int16u, Ztring>::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, Duration;
+ for (size_t Pos=0; Pos<Program->second.elementary_PIDs.size(); Pos++)
+ {
+ int16u elementary_PID=Program->second.elementary_PIDs[Pos];
+ if (Complete_Stream->Streams[elementary_PID].IsRegistered && Retrieve(Stream_Menu, StreamPos_Last, "KLV_PID").To_int16u()!=elementary_PID)
+ {
+ 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));
+ 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);
+ Duration=Ztring::ToZtring(((float64)(Complete_Stream->Streams[elementary_PID].TimeStamp_End-Complete_Stream->Streams[elementary_PID].TimeStamp_Start))/27000, 6);
+ }
+ }
+ }
+
+ 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()))
+ {
+ if (Program->second.StreamPos==(size_t)-1)
+ {
+ Stream_Prepare(Stream_Menu);
+ Program->second.StreamPos=StreamPos_Last;
+ }
+ else
+ StreamPos_Last=Program->second.StreamPos;
+ Fill(Stream_Menu, StreamPos_Last, Menu_ID, Program->second.pid);
+ Fill(Stream_Menu, StreamPos_Last, Menu_ID_String, Decimal_Hexa(Program->second.pid), true);
+ Fill(Stream_Menu, StreamPos_Last, Menu_MenuID, Program->first);
+ Fill(Stream_Menu, StreamPos_Last, Menu_MenuID_String, Decimal_Hexa(Program->first));
+ for (std::map<std::string, ZenLib::Ztring>::iterator Info=Program->second.Infos.begin(); Info!=Program->second.Infos.end(); Info++)
+ Fill(Stream_Menu, StreamPos_Last, Info->first.c_str(), Info->second);
+
+ if (!Formats.empty())
+ Formats.resize(Formats.size()-3);
+ Fill(Stream_Menu, StreamPos_Last, Menu_Format, Formats);
+ if (!Codecs.empty())
+ Codecs.resize(Codecs.size()-3);
+ Fill(Stream_Menu, StreamPos_Last, Menu_Codec, Codecs);
+ if (!StreamKinds.empty())
+ StreamKinds.resize(StreamKinds.size()-3);
+ Fill(Stream_Menu, StreamPos_Last, Menu_List_StreamKind, StreamKinds);
+ 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);
+ if (!elementary_PIDs.empty())
+ elementary_PIDs.resize(elementary_PIDs.size()-3);
+ Fill(Stream_Menu, StreamPos_Last, Menu_List, elementary_PIDs);
+ if (!StreamPoss.empty())
+ StreamPoss.resize(StreamPoss.size()-3);
+ Fill(Stream_Menu, StreamPos_Last, Menu_List_StreamPos, StreamPoss);
+ if (!Languages.empty())
+ Languages.resize(Languages.size()-3);
+ Fill(Stream_Menu, StreamPos_Last, Menu_Language, Languages);
+
+ //Fill(Stream_Menu, StreamPos_Last, Menu_Duration, Duration);
+ }
+
+ //Delay
+ if (Count_Get(Stream_Menu)==0)
+ {
+ Fill(Stream_General, 0, General_Delay, Delay);
+ }
+ if (Count_Get(Stream_Menu)>0)
+ {
+ Fill(Stream_Menu, StreamPos_Last, Menu_Delay, Delay);
+ }
+ if (Count_Get(Stream_Menu)==2)
+ {
+ Clear(Stream_General, 0, General_Delay); //Not valid, multiple menus
+ }
+ }
+ }
+ }
+
+ //Forcing updates (not done before because Status[IsFilled] was not set)
+ PSI_EPG_Update();
+ if (Complete_Stream->Duration_End_IsUpdated)
+ PSI_Duration_End_Update();
+ #ifdef MEDIAINFO_MPEGTS_PCR_YES
+ for (pid=0; pid<0x2000; pid++)
+ if (Complete_Stream->Streams[pid].IsPCR && Complete_Stream->Streams[pid].TimeStamp_End!=(int64u)-1)
+ Header_Parse_AdaptationField_Duration_Update();
+ #endif //MEDIAINFO_MPEGTS_PCR_YES
+}
+
+//---------------------------------------------------------------------------
+void File_MpegTs::Streams_Fill_PerStream(int16u PID, complete_stream::stream &Temp)
+{
+ //Only PES
+ if (Temp.Kind!=complete_stream::stream::pes)
+ return;
+
+ //No direct handling of Sub streams;
+ if (Temp.stream_type==0x20 && Temp.SubStream_pid) //Stereoscopic is not alone
+ return;
+
+ //By the parser
+ StreamKind_Last=Stream_Max;
+ if (Temp.Parser && Temp.Parser->Status[IsAccepted])
+ {
+ Fill(Temp.Parser);
+ 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);
+ Merge(*Temp.Parser, Stream_Video, 0, StreamPos_Last);
+ }
+ else
+ 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);
+ Merge(*IOD_ES->second.Parser, StreamKind_Last, StreamPos_Last, 0);
+ }
+ }
+ }
+
+ //By the descriptors
+ if (StreamKind_Last==Stream_Max && Complete_Stream->transport_stream_id_IsValid)
+ {
+ 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));
+ }
+ }
+
+ //By the stream_type
+ if (StreamKind_Last==Stream_Max && Complete_Stream->transport_stream_id_IsValid)
+ {
+ int32u format_identifier=Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Temp.program_numbers[0]].registration_format_identifier;
+ if ((Temp.IsRegistered || format_identifier==Elements::HDMV) && Mpeg_Psi_stream_type_StreamKind(Temp.stream_type, format_identifier)!=Stream_Max)
+ {
+ 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));
+ }
+ }
+
+ //By the StreamKind
+ if (StreamKind_Last==Stream_Max && Temp.StreamKind!=Stream_Max && Temp.IsRegistered)
+ {
+ Stream_Prepare(Temp.StreamKind);
+ }
+
+ //More info
+ if (StreamKind_Last!=Stream_Max) //Found
+ {
+ //Special cases
+ if (StreamKind_Last==Stream_Text && Temp.Parser && Temp.Parser->Count_Get(Stream_Video))
+ {
+ StreamKind_Last=Stream_Video;
+ StreamPos_Last=Count_Get(Stream_Video)-1;
+ }
+
+ Temp.StreamKind=StreamKind_Last;
+ Temp.StreamPos=StreamPos_Last;
+
+ //Encryption
+ if (Temp.IsScrambled>16)
+ Fill(StreamKind_Last, StreamPos_Last, "Encryption", "Encrypted");
+
+ //TS info
+ for (std::map<std::string, ZenLib::Ztring>::iterator Info=Temp.Infos.begin(); Info!=Temp.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);
+ }
+ Temp.Infos.clear();
+
+ //Common
+ if (Temp.SubStream_pid!=0x0000) //Wit a substream
+ {
+ Ztring Format_Profile=Retrieve(Stream_Video, StreamPos_Last, Video_Format_Profile);
+ Fill(Stream_Video, StreamPos_Last, Video_ID, Ztring::ToZtring(Temp.SubStream_pid)+_T(" / ")+Ztring::ToZtring(PID), true);
+ Fill(Stream_Video, StreamPos_Last, Video_ID_String, Decimal_Hexa(Temp.SubStream_pid)+_T(" / ")+Decimal_Hexa(PID), true);
+ if (!Format_Profile.empty())
+ Fill(Stream_Video, StreamPos_Last, Video_Format_Profile, Complete_Stream->Streams[Temp.SubStream_pid].Parser->Retrieve(Stream_Video, 0, Video_Format_Profile)+_T(" / ")+Format_Profile, true);
+ }
+ else
+ {
+ Fill(StreamKind_Last, StreamPos_Last, General_ID, PID, 10, true);
+ Fill(StreamKind_Last, StreamPos_Last, General_ID_String, Decimal_Hexa(PID), true);
+ }
+ for (size_t Pos=0; Pos<Temp.program_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);
+ }
+
+ //Special cases
+ if (StreamKind_Last==Stream_Video && Temp.Parser && Temp.Parser->Count_Get(Stream_Text))
+ {
+ }
+ }
+
+ //Desactivating the stream (except for timestamp)
+ Temp.Searching_Payload_Start_Set(false);
+ Temp.Searching_Payload_Continue_Set(false);
+}
+
+//---------------------------------------------------------------------------
+void File_MpegTs::Streams_Finish()
+{
+ //Per stream
+ for (int16u PID=0; PID<0x2000; PID++)
+ Streams_Finish_PerStream(PID, Complete_Stream->Streams[PID]);
+
+ File__Duplicate_Streams_Finish();
+}
+
+//---------------------------------------------------------------------------
+void File_MpegTs::Streams_Finish_PerStream(int16u PID, complete_stream::stream &Temp)
+{
+ //Precise overall bit rate
+ if (Complete_Stream->Streams[PID].TimeStamp_End_Offset!=(int64u)-1)
+ {
+ float64 Duration=((float64)((int64s)(Complete_Stream->Streams[PID].TimeStamp_End-Complete_Stream->Streams[PID].TimeStamp_Start)))/27000;
+ if (Duration)
+ Fill(Stream_General, 0, General_OverallBitRate, (Complete_Stream->Streams[PID].TimeStamp_End_Offset-Complete_Stream->Streams[PID].TimeStamp_Start_Offset)*8*1000/Duration, 0, true);
+ }
+
+ //Only PES
+ if (Temp.Kind!=complete_stream::stream::pes)
+ return;
+
+ //No direct handling of Sub streams;
+ if (Temp.stream_type==0x20 && Temp.SubStream_pid) //Stereoscopic is not alone
+ return;
+
+ //By the parser
+ if (Temp.StreamKind==Stream_Max && !Temp.Parser)
+ Streams_Fill_PerStream(PID, Temp);
+
+ //Init
+ if (Temp.StreamKind==Stream_Max)
+ return;
+ StreamKind_Last=Temp.StreamKind;
+ StreamPos_Last=Temp.StreamPos;
+
+ //By the parser
+ if (Temp.Parser && Temp.Parser->Status[IsAccepted])
+ {
+ Temp.Parser->ShouldContinueParsing=false;
+ Finish(Temp.Parser);
+ Merge(*Temp.Parser, StreamKind_Last, 0, StreamPos_Last);
+
+ //Special cases
+ if (Temp.Parser->Count_Get(Stream_Video) && Temp.Parser->Count_Get(Stream_Text))
+ {
+ //Video and Text are together
+ size_t Text_Count=Temp.Parser->Count_Get(Stream_Text);
+ for (size_t Text_Pos=0; Text_Pos<Text_Count; Text_Pos++)
+ {
+ Stream_Prepare(Stream_Text);
+ Merge(*Temp.Parser, Stream_Text, Text_Pos, StreamPos_Last);
+
+ if (!IsSub)
+ Fill(Stream_Text, StreamPos_Last, "MuxingMode_MoreInfo", _T("Muxed in Video #")+Ztring().From_Number(Temp.StreamPos+1), true);
+ Ztring ID=Retrieve(Stream_Text, StreamPos_Last, Text_ID);
+ if (ID.find(_T('-'))!=string::npos)
+ ID.erase(ID.begin(), ID.begin()+ID.find(_T('-'))+1);
+ Fill(Stream_Text, StreamPos_Last, Text_ID, Retrieve(Stream_Video, Temp.StreamPos, Video_ID)+_T('-')+ID, true);
+ Fill(Stream_Text, StreamPos_Last, Text_ID_String, Retrieve(Stream_Video, Temp.StreamPos, Video_ID_String)+ID, 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);
+
+ //Language from ATSC EIT
+ size_t ID_Pos;
+ if (ID==_T("608-0"))
+ ID_Pos=0;
+ else if (ID==_T("608-1"))
+ ID_Pos=1;
+ else
+ {
+ ID_Pos=ID.To_int8u();
+ if (ID_Pos==0)
+ ID_Pos=(size_t)-1;
+ else
+ ID_Pos--; //EIA-708 begins at 1
+ }
+ if (ID_Pos<Temp.Captions_Language.size())
+ Fill(Stream_Text, StreamPos_Last, Text_Language, Temp.Captions_Language[ID_Pos]);
+ }
+
+ StreamKind_Last=Temp.StreamKind;
+ StreamPos_Last=Temp.StreamPos;
+ }
+ }
+}
+
+//***************************************************************************
+// Buffer - Synchro
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_MpegTs::Synchronize()
+{
+ //Synchronizing
+ while ( Buffer_Offset+188*7+BDAV_Size*8+TSP_Size*7+1<=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_Offset++;
+ while ( Buffer_Offset+BDAV_Size+1<=Buffer_Size
+ && Buffer[Buffer_Offset+BDAV_Size]!=0x47)
+ Buffer_Offset++;
+ }
+
+ if (Buffer_Offset+188*7+BDAV_Size*8+TSP_Size*7>=Buffer_Size)
+ return false;
+
+ //Synched is OK
+ if (!Status[IsAccepted])
+ {
+ Accept("MPEG-TS");
+ }
+ 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 (File__Duplicate_Get())
+ Trusted++; //We don't want to stop parsing if duplication is requested, TS is not a lot stable, normal...
+ return false;
+ }
+
+ //Getting PID
+ pid=(Buffer[Buffer_Offset+BDAV_Size+1]&0x1F)<<8
+ | Buffer[Buffer_Offset+BDAV_Size+2];
+
+ complete_stream::streams::iterator Stream=Complete_Stream->Streams.begin()+pid;
+ if (Stream->Searching)
+ {
+ 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 (table_id==0xCD) //specifc case for ATSC STT
+ return true; //Version has no meaning
+ 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 MEDIAINFO_TRACE
+ Stream->Element_Info=Mpeg_Psi_table_id(table_id);
+ #endif //MEDIAINFO_TRACE
+ if (!(Buffer[Buffer_Offset+Version_Pos+1]&0x80)) //section_syntax_indicator
+ 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)
+ {
+ 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
+ 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)
+ {
+ if (Buffer[Buffer_Offset+BDAV_Size+4]>=5) //adaptation_field_length
+ {
+ int8u pid_Adaptation_Info=Buffer[Buffer_Offset+BDAV_Size+5];
+ if (pid_Adaptation_Info&0x10) //PCR is present
+ {
+ 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);
+ Complete_Stream->Streams[pid].TimeStamp_End=program_clock_reference;
+ Complete_Stream->Streams[pid].TimeStamp_End_Offset=File_Offset+Buffer_Offset;
+ if (Status[IsFilled])
+ Header_Parse_AdaptationField_Duration_Update();
+ }
+ 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_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++;
+ }
+
+ //Test if we can find the TS bitrate
+ if (!Complete_Stream->Streams[pid].EndTimeStampMoreThanxSeconds && Complete_Stream->Streams[pid].TimeStamp_Start!=(int64u)-1)
+ {
+ if (program_clock_reference<Complete_Stream->Streams[pid].TimeStamp_Start)
+ program_clock_reference+=0x200000000LL*300; //33 bits, cyclic
+ if ((program_clock_reference-Complete_Stream->Streams[pid].TimeStamp_Start)/27000>8000)
+ {
+ Complete_Stream->Streams[pid].EndTimeStampMoreThanxSeconds=true;
+ Complete_Stream->Streams_With_EndTimeStampMoreThanxSecondsCount++;
+ if (Complete_Stream->Streams_NotParsedCount==0
+ && Complete_Stream->Streams_With_StartTimeStampCount>0
+ && Complete_Stream->Streams_With_StartTimeStampCount==Complete_Stream->Streams_With_EndTimeStampMoreThanxSecondsCount)
+ {
+ //We are already parsing 4 seconds (for all PCRs), we don't hope to have more info
+ MpegTs_JumpTo_Begin=File_Offset+Buffer_Offset;
+ MpegTs_JumpTo_End=MpegTs_JumpTo_Begin;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ #endif //MEDIAINFO_MPEGTS_PCR_YES
+ }
+
+ //File__Duplicate
+ if (Stream->ShouldDuplicate)
+ {
+ Element_Size=TS_Size;
+ File__Duplicate_Write(pid);
+ }
+
+ Header_Parse_Events();
+
+ Buffer_Offset+=TS_Size;
+ }
+
+ 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);
+ Complete_Stream->Streams[0x0000].Searching_Payload_Start_Set(true);
+ Complete_Stream->Streams[0x0000].Kind=complete_stream::stream::psi;
+ 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;
+ Complete_Stream->Streams[0x0001].Table_IDs.resize(0x100);
+ Complete_Stream->Streams[0x0001].Table_IDs[0x01]=new complete_stream::stream::table_id; //conditional_access_section
+
+ //Temp
+ MpegTs_JumpTo_Begin=(File_Offset_FirstSynched==(int64u)-1?0:File_Offset_FirstSynched)+MediaInfoLib::Config.MpegTs_MaximumOffset_Get();
+ MpegTs_JumpTo_End=16*1024*1024;
+ if (MpegTs_JumpTo_Begin+MpegTs_JumpTo_End>=File_Size)
+ {
+ MpegTs_JumpTo_Begin=File_Size;
+ MpegTs_JumpTo_End=File_Size;
+ }
+
+ //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<int64u, stream>::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_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
+ Complete_Stream->Streams[StreamID].Parser->Open_Buffer_Unsynch();
+ }
+ }
+ 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; StreamPos<Count_Get(Stream_Menu); StreamPos++)
+ Clear(Stream_Menu, StreamPos, Menu_Duration);
+}
+
+//***************************************************************************
+// Buffer - File header
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_MpegTs::FileHeader_Begin()
+{
+ //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
+{
+ //Parsing
+ int8u transport_scrambling_control;
+ 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
+ if (!Complete_Stream->Streams[pid].program_numbers.empty())
+ {
+ Ztring Program_Numbers;
+ for (size_t Pos=0; Pos<Complete_Stream->Streams[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_Info);
+
+ //Adaptation
+ if (adaptation)
+ Header_Parse_AdaptationField();
+
+ //Data
+ if (payload)
+ {
+ //Encryption
+ if (transport_scrambling_control>0)
+ Complete_Stream->Streams[pid].IsScrambled++;
+ }
+ else if (Element_Offset<TS_Size)
+ Skip_XX(TS_Size-Element_Offset, "Junk");
+
+ //Filling
+ Header_Fill_Code(pid, Ztring().From_CC2(pid));
+ Header_Fill_Size(TS_Size);
+
+ Header_Parse_Events();
+}
+#else //MEDIAINFO_TRACE
+{
+ //Parsing
+ payload_unit_start_indicator=(Buffer[Buffer_Offset+BDAV_Size+1]&0x40)!=0;
+ int8u transport_scrambling_control= Buffer[Buffer_Offset+BDAV_Size+3]&0xC0;
+ bool adaptation= (Buffer[Buffer_Offset+BDAV_Size+3]&0x20)!=0;
+ bool payload= (Buffer[Buffer_Offset+BDAV_Size+3]&0x10)!=0;
+ Element_Offset+=BDAV_Size+4;
+
+ //Adaptation
+ if (adaptation)
+ Header_Parse_AdaptationField();
+
+ //Data
+ if (payload)
+ {
+ //Encryption
+ if (transport_scrambling_control>0)
+ 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();
+}
+#endif //MEDIAINFO_TRACE
+
+//---------------------------------------------------------------------------
+void File_MpegTs::Header_Parse_AdaptationField()
+#if MEDIAINFO_TRACE
+{
+ int64u Element_Pos_Save=Element_Offset;
+ Element_Begin("adaptation_field");
+ int8u Adaptation_Size;
+ Get_B1 (Adaptation_Size, "adaptation_field_length");
+ if (Adaptation_Size>188-4-1) //TS size - header - adaptation_field_length
+ {
+ Adaptation_Size=188-4-1;
+ Skip_XX(188-4-1, "stuffing_bytes");
+ }
+ else if (Adaptation_Size>0)
+ {
+ bool PCR_flag, OPCR_flag, splicing_point_flag, transport_private_data_flag, adaptation_field_extension_flag;
+ BS_Begin();
+ Skip_SB( "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_Info(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);
+ Complete_Stream->Streams[pid].TimeStamp_End=program_clock_reference;
+ Complete_Stream->Streams[pid].TimeStamp_End_Offset=File_Offset+Buffer_Offset;
+ if (Status[IsFilled])
+ Header_Parse_AdaptationField_Duration_Update();
+ }
+ 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_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++;
+ }
+
+ //Test if we can find the TS bitrate
+ if (!Complete_Stream->Streams[pid].EndTimeStampMoreThanxSeconds && Complete_Stream->Streams[pid].TimeStamp_Start!=(int64u)-1)
+ {
+ if (program_clock_reference<Complete_Stream->Streams[pid].TimeStamp_Start)
+ program_clock_reference+=0x200000000LL*300; //33 bits, cyclic
+ if ((program_clock_reference-Complete_Stream->Streams[pid].TimeStamp_Start)/27000>8000)
+ {
+ Complete_Stream->Streams[pid].EndTimeStampMoreThanxSeconds=true;
+ Complete_Stream->Streams_With_EndTimeStampMoreThanxSecondsCount++;
+ if (Complete_Stream->Streams_NotParsedCount==0
+ && Complete_Stream->Streams_With_StartTimeStampCount>0
+ && Complete_Stream->Streams_With_StartTimeStampCount==Complete_Stream->Streams_With_EndTimeStampMoreThanxSecondsCount)
+ {
+ //We are already parsing 4 seconds (for all PCRs), we don't hope to have more info
+ MpegTs_JumpTo_Begin=File_Offset+Buffer_Offset;
+ 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_Size)
+ Skip_XX(transport_private_data_length, "transport_private_data");
+ else
+ Skip_XX(Element_Pos_Save+1+Adaptation_Size-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_Size)
+ {
+ Element_Begin("adaptation_field_extension", adaptation_field_extension_length);
+ 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_Begin("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_End();
+ }
+ BS_End();
+ if (Element_Offset<End)
+ Skip_XX(End-Element_Offset, "reserved");
+ Element_End();
+ }
+ else
+ Skip_XX(Element_Pos_Save+1+Adaptation_Size-Element_Offset, "problem");
+ }
+ }
+
+ if (Element_Offset<Element_Pos_Save+1+Adaptation_Size)
+ Skip_XX(Element_Pos_Save+1+Adaptation_Size-Element_Offset, "stuffing_bytes");
+ Element_End(1+Adaptation_Size);
+}
+#else //MEDIAINFO_TRACE
+{
+ int8u Adaptation_Size=Buffer[Buffer_Offset+BDAV_Size+4];
+ #ifdef MEDIAINFO_MPEGTS_PCR_YES
+ if (Adaptation_Size>188-4-1) //TS size - header - adaptation_field_length
+ Adaptation_Size=188-4-1;
+ else if (Adaptation_Size)
+ {
+ 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);
+ Complete_Stream->Streams[pid].TimeStamp_End=program_clock_reference;
+ Complete_Stream->Streams[pid].TimeStamp_End_Offset=File_Offset+Buffer_Offset;
+ if (Status[IsFilled])
+ Header_Parse_AdaptationField_Duration_Update();
+ }
+ 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_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++;
+ }
+
+ //Test if we can find the TS bitrate
+ if (!Complete_Stream->Streams[pid].EndTimeStampMoreThanxSeconds && Complete_Stream->Streams[pid].TimeStamp_Start!=(int64u)-1)
+ {
+ if (program_clock_reference<Complete_Stream->Streams[pid].TimeStamp_Start)
+ program_clock_reference+=0x200000000LL*300; //33 bits, cyclic
+ if ((program_clock_reference-Complete_Stream->Streams[pid].TimeStamp_Start)/27000>8000)
+ {
+ Complete_Stream->Streams[pid].EndTimeStampMoreThanxSeconds=true;
+ Complete_Stream->Streams_With_EndTimeStampMoreThanxSecondsCount++;
+ if (Complete_Stream->Streams_NotParsedCount==0
+ && Complete_Stream->Streams_With_StartTimeStampCount>0
+ && Complete_Stream->Streams_With_StartTimeStampCount==Complete_Stream->Streams_With_EndTimeStampMoreThanxSecondsCount)
+ {
+ //We are already parsing 4 seconds (for all PCRs), we don't hope to have more info
+ MpegTs_JumpTo_Begin=File_Offset+Buffer_Offset;
+ MpegTs_JumpTo_End=MpegTs_JumpTo_Begin;
+ }
+ }
+ }
+ }
+ }
+ #endif //MEDIAINFO_MPEGTS_PCR_YES
+ Element_Offset+=1+Adaptation_Size;
+}
+#endif //MEDIAINFO_TRACE
+
+//---------------------------------------------------------------------------
+#if MEDIAINFO_EVENTS
+void File_MpegTs::Header_Parse_Events()
+{
+}
+#endif //MEDIAINFO_EVENTS
+
+//---------------------------------------------------------------------------
+#ifdef MEDIAINFO_MPEGTS_PCR_YES
+void File_MpegTs::Header_Parse_AdaptationField_Duration_Update()
+{
+ if (Complete_Stream->Streams[pid].TimeStamp_End<0x100000000LL*300 && Complete_Stream->Streams[pid].TimeStamp_Start>0x100000000LL*300)
+ Complete_Stream->Streams[pid].TimeStamp_End+=0x200000000LL*300; //33 bits, cyclic
+ float64 Duration=((float64)((int64s)(Complete_Stream->Streams[pid].TimeStamp_End-Complete_Stream->Streams[pid].TimeStamp_Start)))/27000;
+
+ float64 Duration_Current=Retrieve(Stream_General, 0, General_Duration).To_float64();
+ if (Retrieve(Stream_General, 0, General_Duration).empty() || Duration>Duration_Current || Duration+700<Duration_Current) //If superior or too different
+ Fill(Stream_General, 0, General_Duration, Duration, 6, true); //Only if greater than the current duration
+
+ //TODO: I have small but annoying memory leaks with this version (on big files and Full parsing)
+ //Fill(Stream_General, 0, General_OverallBitRate, (Complete_Stream->Streams[pid].TimeStamp_End_Offset-Complete_Stream->Streams[pid].TimeStamp_Start_Offset)*8*1000/Duration, 0, true);
+
+ //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<Complete_Stream->Streams[pid].program_numbers.size(); Pos++)
+ {
+ int16u program_number=Complete_Stream->Streams[pid].program_numbers[Pos];
+ if (Transport_Stream->second.Programs[program_number].IsParsed)
+ Fill(Stream_Menu, Transport_Stream->second.Programs[program_number].StreamPos, Menu_Duration, Duration, 6, true);
+ }
+ }
+ }
+
+ Status[IsUpdated]=true;
+ Status[User_16]=true;
+}
+#endif //MEDIAINFO_MPEGTS_PCR_YES
+
+//---------------------------------------------------------------------------
+#if MEDIAINFO_EVENTS
+void File_MpegTs::Header_Parse_Events_Duration(int64u program_clock_reference)
+{
+}
+#endif //MEDIAINFO_EVENTS
+
+//---------------------------------------------------------------------------
+void File_MpegTs::Data_Parse()
+{
+ //TSP specific
+ if (TSP_Size)
+ Element_Size-=TSP_Size;
+
+ //File__Duplicate
+ if (Complete_Stream->Streams[pid].ShouldDuplicate)
+ File__Duplicate_Write(pid);
+
+ //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;
+ Skip_B4( "TSP"); //TSP supplement
+ }
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_MpegTs::PES()
+{
+ //Info
+ DETAILS_INFO(if (Complete_Stream->transport_stream_id_IsValid) Element_Info(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; Pos<Complete_Stream->Streams[pid].program_numbers.size(); Pos++)
+ Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[Complete_Stream->Streams[pid].program_numbers[Pos]].IsRegistered=true;
+ }
+
+ //Case of encrypted streams
+ if (Complete_Stream->Streams[pid].IsScrambled)
+ {
+ 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
+ }
+ Skip_XX(Element_Size-Element_Offset, "Scrambled data");
+
+ return;
+ }
+
+ //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
+ 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_DEMUX
+ if (MediaInfoLib::Config.Demux_Get())
+ {
+ 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
+ #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;
+ 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 FILE_MPEG4_YES
+ ((File_MpegPs*)Complete_Stream->Streams[pid].Parser)->DecSpecificInfoTag=IOD_ES->second.DecSpecificInfoTag;
+ ((File_MpegPs*)Complete_Stream->Streams[pid].Parser)->SLConfig=IOD_ES->second.SLConfig;
+ #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
+ Open_Buffer_Init(Complete_Stream->Streams[pid].Parser);
+ }
+
+ //Parsing
+ Open_Buffer_Continue(Complete_Stream->Streams[pid].Parser);
+ #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) && MediaInfoLib::Config.ParseSpeed_Get()<1)
+ {
+ Complete_Stream->Streams[pid].Searching_Payload_Start_Set(false);
+ Complete_Stream->Streams[pid].Searching_Payload_Continue_Set(false);
+ if (Complete_Stream->Streams_NotParsedCount)
+ 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 (MediaInfoLib::Config.ParseSpeed_Get()<1.0)
+ Finish(Complete_Stream->Streams[pid].Parser);
+ #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES
+ }
+}
+
+//---------------------------------------------------------------------------
+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
+ Open_Buffer_Continue(Complete_Stream->Streams[pid].Parser);
+
+ //EPG
+ if (Status[IsFilled])
+ {
+ if (Complete_Stream->Sources_IsUpdated || Complete_Stream->Programs_IsUpdated)
+ PSI_EPG_Update();
+ if (Complete_Stream->Duration_End_IsUpdated)
+ PSI_Duration_End_Update();
+ }
+
+ //Filling
+ if (Complete_Stream->Streams[pid].Parser->Status[IsFinished])
+ {
+ //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);
+ }
+ else
+ //Waiting for more data
+ Complete_Stream->Streams[pid].Searching_Payload_Continue_Set(true);
+}
+
+//---------------------------------------------------------------------------
+void File_MpegTs::PSI_EPG_Update()
+{
+ //EPG
+ 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())
+ return;
+
+ //Per source (ATSC)
+ std::map<Ztring, Ztring> EPGs;
+ complete_stream::sources::iterator Source=Complete_Stream->Sources.find(Transport_Stream->second.source_id);
+ if (Source!=Complete_Stream->Sources.end())
+ {
+ //EPG
+ 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<int16u, Ztring>::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<End)
+ for (size_t Pos=End-1; Pos>=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<Ztring, Ztring>::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;
+
+ //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++)
+ 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
+ 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<int16u, Ztring>::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)
+ {
+ 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<int16u, Ztring>::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)
+ {
+ Stream_Prepare(Stream_Menu);
+ Program->second.StreamPos=StreamPos_Last;
+ }
+ 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);
+ }
+ Fill(Stream_Menu, Program->second.StreamPos, Menu_Chapters_Pos_Begin, Count_Get(Stream_Menu, Program->second.StreamPos), 10, true);
+ for (std::map<Ztring, Ztring>::iterator EPG=EPGs.begin(); EPG!=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);
+ EPGs.clear();
+ }
+ }
+ }
+
+ Complete_Stream->Sources_IsUpdated=false;
+ Complete_Stream->Programs_IsUpdated=false;
+ Status[IsUpdated]=true;
+ Status[User_18]=true;
+}
+
+
+//---------------------------------------------------------------------------
+void File_MpegTs::PSI_Duration_End_Update()
+{
+ //General
+ Fill(Stream_General, 0, General_Duration_End, Complete_Stream->Duration_End, true);
+
+ Complete_Stream->Duration_End_IsUpdated=false;
+ Status[IsUpdated]=true;
+ Status[User_17]=true;
+}
+
+//***************************************************************************
+// Helpers
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_MpegTs::Detect_EOF()
+{
+ if (File_Offset+Buffer_Size>=MpegTs_JumpTo_Begin && !Complete_Stream->transport_stream_id_IsValid && Retrieve(Stream_General, 0, General_Format_Profile)!=_T("No PAT/PMT"))
+ {
+ //Activating all streams as PES, in case of PAT/PMT are missing (ofen in .trp files)
+ Complete_Stream->Streams.clear();
+ Complete_Stream->Streams.resize(0x2000);
+ for (size_t StreamID=0x20; StreamID<0x1FFF; StreamID++)
+ {
+ Complete_Stream->Streams_NotParsedCount=(size_t)-1;
+ 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
+ Complete_Stream->Streams[StreamID].Element_Info="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
+ }
+ if (!Status[IsAccepted])
+ Accept("MPEG-TS");
+ GoTo(0, "MPEG-TS");
+ Fill(Stream_General, 0, General_Format_Profile, "No PAT/PMT");
+ return;
+ }
+
+ //Jump to the end of the file
+ if (File_Offset+Buffer_Offset>0x8000 && File_Offset+Buffer_Offset+MpegTs_JumpTo_End<File_Size && (
+ (File_Offset+Buffer_Offset>=MpegTs_JumpTo_Begin)
+ //|| (program_Count==0 && elementary_PID_Count==0)
+ ))
+ {
+ if (!Status[IsAccepted])
+ Accept("MPEG-TS");
+ Fill("MPEG-TS");
+
+ if (Config->File_IsSeekable_Get())
+ {
+ #if !defined(MEDIAINFO_MPEGTS_PCR_YES) && !defined(MEDIAINFO_MPEGTS_PESTIMESTAMP_YES)
+ GoToFromEnd(47, "MPEG-TS"); //TODO: Should be changed later (when Finalize stuff will be split)
+ #else //!defined(MEDIAINFO_MPEGTS_PCR_YES) && !defined(MEDIAINFO_MPEGTS_PESTIMESTAMP_YES)
+ GoToFromEnd(MpegTs_JumpTo_End, "MPEG-TS");
+ Searching_TimeStamp_Start=false;
+ #endif //!defined(MEDIAINFO_MPEGTS_PCR_YES) && !defined(MEDIAINFO_MPEGTS_PESTIMESTAMP_YES)
+ }
+ else
+ EOF_AlreadyDetected=true;
+ }
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_MPEGTS_YES
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_MpegTs.h b/src/thirdparty/MediaInfo/Multiple/File_MpegTs.h
new file mode 100644
index 000000000..6c749eace
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_MpegTs.h
@@ -0,0 +1,137 @@
+// File_Mpegts - Info for MPEG Transport Stream files
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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"
+#include "MediaInfo/Duplicate/File__Duplicate__Writer.h"
+#include <map>
+#include <vector>
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_MpegTs
+//***************************************************************************
+
+class File_MpegTs : public File__Duplicate
+{
+public :
+ //In
+ #ifdef MEDIAINFO_BDAV_YES
+ size_t BDAV_Size;
+ #endif
+ #ifdef MEDIAINFO_TSP_YES
+ size_t TSP_Size;
+ #endif
+
+ //Constructor/Destructor
+ File_MpegTs();
+ ~File_MpegTs();
+
+private :
+ //Streams management
+ void Streams_Fill();
+ 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_Unsynched();
+
+ //Buffer - Per element
+ void Header_Parse();
+ void Header_Parse_AdaptationField();
+ #ifdef MEDIAINFO_MPEGTS_PCR_YES
+ void Header_Parse_AdaptationField_Duration_Update();
+ #endif //MEDIAINFO_MPEGTS_PCR_YES
+ void Data_Parse();
+
+ int16u pid;
+ bool payload_unit_start_indicator;
+
+ //Global infos
+ complete_stream* Complete_Stream;
+
+ //Elements
+ void PSI();
+ void PSI_EPG_Update();
+ void PSI_Duration_End_Update();
+ void PES();
+
+ //Helpers
+ bool Header_Parser_QuickSearch();
+ void Detect_EOF();
+
+ //Temp
+ #if defined(MEDIAINFO_BDAV_YES) || defined(MEDIAINFO_TSP_YES)
+ size_t TS_Size;
+ #endif
+ int64u MpegTs_JumpTo_Begin;
+ int64u MpegTs_JumpTo_End;
+ 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_Fill_PerStream(int16u PID, complete_stream::stream &Temp);
+ void Streams_Finish_PerStream(int16u PID, complete_stream::stream &Temp);
+
+ //File__Duplicate
+ void File__Duplicate_Streams_Finish ();
+ bool File__Duplicate_Set (const Ztring &Value); //Fill a new File__Duplicate value
+ bool File__Duplicate_Get_From_PID (int16u PID);
+ void File__Duplicate_Write (int16u PID);
+
+ //Output buffer
+ size_t Output_Buffer_Get (const String &Value);
+ size_t Output_Buffer_Get (size_t Pos);
+ std::vector<int16u> Output_Buffer_Get_Pos;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Multiple/File_MpegTs_Duplicate.cpp b/src/thirdparty/MediaInfo/Multiple/File_MpegTs_Duplicate.cpp
new file mode 100644
index 000000000..2000ef9c9
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_MpegTs_Duplicate.cpp
@@ -0,0 +1,353 @@
+// File__Duplicate - Duplication of some formats
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Duplication helper for some specific formats
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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
+//***************************************************************************
+
+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();
+}
+
+//***************************************************************************
+// Options
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_MpegTs::Option_Manage()
+{
+ if (Complete_Stream && !Complete_Stream->Streams.empty())
+ {
+ //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[0x00].Searching_Payload_Start_Set(true); //program_map
+ }
+
+ //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<const String, File__Duplicate_MpegTs*>::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; Pos<Program->second.elementary_PIDs.size(); Pos++)
+ Complete_Stream->Streams[Program->second.elementary_PIDs[Pos]].ShouldDuplicate=true;
+ }
+ }
+ }
+ }
+}
+
+//***************************************************************************
+// Set
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+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<ZtringList::iterator> Targets_ToAdd;
+ std::vector<ZtringList::iterator> Targets_ToRemove;
+ std::vector<ZtringList::iterator> Orders_ToAdd;
+ std::vector<ZtringList::iterator> Orders_ToRemove;
+ for (ZtringList::iterator Current=List.begin(); Current<List.end(); Current++)
+ {
+ //Detecting if we want to remove
+ bool ToRemove=false;
+ if (Current->find(_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<ZtringList::iterator>::iterator Order=Orders_ToAdd.begin(); Order<Orders_ToAdd.end(); Order++)
+ Orders_ToRemove.push_back(*Order);
+ Orders_ToAdd.clear();
+ }
+
+ //For each target to add
+ for (std::vector<ZtringList::iterator>::iterator Target=Targets_ToAdd.begin(); Target<Targets_ToAdd.end(); Target++)
+ {
+ //Adding the target if it does not exist yet
+ if (Complete_Stream->Duplicates.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<ZtringList::iterator>::iterator Order=Orders_ToAdd.begin(); Order<Orders_ToAdd.end(); Order++)
+ Complete_Stream->Duplicates[**Target]->Configure(**Order, false);
+
+ //For each order to remove
+ for (std::vector<ZtringList::iterator>::iterator Order=Orders_ToRemove.begin(); Order<Orders_ToRemove.end(); Order++)
+ Complete_Stream->Duplicates[**Target]->Configure(**Order, true);
+ }
+
+ //For each target to remove
+ for (std::vector<ZtringList::iterator>::iterator Target=Targets_ToRemove.begin(); Target<Targets_ToRemove.end(); Target++)
+ {
+ std::map<const String, File__Duplicate_MpegTs*>::iterator Pointer=Complete_Stream->Duplicates.find(**Target);
+ if (Pointer!=Complete_Stream->Duplicates.end())
+ {
+ //Duplicates_Speed
+ for (std::vector<File__Duplicate_MpegTs*>::iterator Duplicate=Complete_Stream->Duplicates_Speed.begin(); Duplicate<Complete_Stream->Duplicates_Speed.end(); Duplicate++)
+ if (*Duplicate==Pointer->second)
+ *Duplicate=NULL;
+
+ //Duplicates_Speed_FromPID
+ for (std::vector<std::vector<File__Duplicate_MpegTs*> >::iterator Duplicate_FromPID=Complete_Stream->Duplicates_Speed_FromPID.begin(); Duplicate_FromPID<Complete_Stream->Duplicates_Speed_FromPID.end(); Duplicate_FromPID++)
+ for (std::vector<File__Duplicate_MpegTs*>::iterator Duplicate=Duplicate_FromPID->begin(); Duplicate<Duplicate_FromPID->end(); 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;
+}
+
+//***************************************************************************
+// Get
+//***************************************************************************
+
+bool File_MpegTs::File__Duplicate_Get_From_PID (int16u PID)
+{
+ if (Complete_Stream->Duplicates_Speed_FromPID.empty())
+ return false;
+ return !Complete_Stream->Duplicates_Speed_FromPID[PID].empty();
+}
+
+//***************************************************************************
+// Write
+//***************************************************************************
+
+void File_MpegTs::File__Duplicate_Write (int16u PID)
+{
+ const int8u* ToAdd=Buffer+Buffer_Offset-(size_t)Header_Size;
+ size_t ToAdd_Size=(size_t)(Element_Size+Header_Size);
+
+ std::vector<File__Duplicate_MpegTs*> &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; Pos<Duplicates_Speed_FromPID_Size; Pos++)
+ if (Dup_FromPID[Pos] && Dup_FromPID[Pos]->Write(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; Pos<Duplicates_Speed_Size; Pos++)
+ {
+ File__Duplicate_MpegTs* Dup=Complete_Stream->Duplicates_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_Pos<program_map_PIDs_Size; program_map_PIDs_Pos++)
+ if (Dup->program_map_PIDs[program_map_PIDs_Pos])
+ {
+ bool AlreadyPresent=false;
+ for (size_t Duplicates_Speed_FromPID_Pos=0; Duplicates_Speed_FromPID_Pos<Complete_Stream->Duplicates_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_Pos<elementary_PIDs_Size; elementary_PIDs_Pos++)
+ if (Dup->elementary_PIDs[elementary_PIDs_Pos])
+ {
+ bool AlreadyPresent=false;
+ for (size_t Duplicates_Speed_FromPID_Pos=0; Duplicates_Speed_FromPID_Pos<Complete_Stream->Duplicates_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);
+ }
+ }
+ }
+}
+
+//***************************************************************************
+// Output_Buffer
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+size_t File_MpegTs::Output_Buffer_Get (const String &Code)
+{
+ if (Complete_Stream==NULL)
+ return 0;
+ std::map<const String, File__Duplicate_MpegTs*>::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_Pos<Streams.size(); Stream_Pos++)
+ if (Streams[Stream_Pos].Parser)
+ if (size_t Size=Streams[Stream_Pos].Parser->Output_Buffer_Get(Code))
+ return Size;
+
+ return 0;
+ */
+}
+
+//---------------------------------------------------------------------------
+size_t File_MpegTs::Output_Buffer_Get (size_t Pos)
+{
+ if (Complete_Stream!=NULL && Pos<Complete_Stream->Duplicates_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_Pos<Complete_Stream->Streams.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;
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_MPEGTS_YES
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Mpeg_Descriptors.cpp b/src/thirdparty/MediaInfo/Multiple/File_Mpeg_Descriptors.cpp
new file mode 100644
index 000000000..755bb5878
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Mpeg_Descriptors.cpp
@@ -0,0 +1,2989 @@
+// File_Mpeg_Descriptors - Info for MPEG files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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 <cmath>
+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 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 "initial Teletext page";
+ case 0x02 : return "Teletext subtitle page";
+ case 0x03 : return "additional information page";
+ case 0x04 : return "programme schedule page";
+ case 0x05 : return "Teletext subtitle page 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 subtitles (normal) with no monitor aspect ratio criticality";
+ case 0x11 : return "DVB subtitles (normal) for display on 4:3 aspect ratio monitor";
+ case 0x12 : return "DVB subtitles (normal) for display on 16:9 aspect ratio monitor";
+ case 0x13 : return "DVB subtitles (normal) for display on 2.21:1 aspect ratio monitor";
+ case 0x20 : return "DVB subtitles (for the hard of hearing) with no monitor aspect ratio criticality";
+ case 0x21 : return "DVB subtitles (for the hard of hearing) for display on 4:3 aspect ratio monitor";
+ case 0x22 : return "DVB subtitles (for the hard of hearing) for display on 16:9 aspect ratio monitor";
+ case 0x23 : return "DVB subtitles (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::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::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::VC_1 : return "VC-1";
+ case Elements::drac : return "Dirac";
+ default :
+ switch (descriptor_tag)
+ {
+ case 0x56 : return "Teletext";
+ case 0x59 : return "DVB Subtitles";
+ 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::VC_1 : return "VC-1";
+ case Elements::drac : return "Dirac";
+ default :
+ switch (descriptor_tag)
+ {
+ case 0x56 : return "Teletext";
+ case 0x59 : return "DVB Subtitles";
+ 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::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@1";
+ case 0x49 : return "Mobile audio internetworking@2";
+ case 0x4A : return "Mobile audio internetworking@3";
+ case 0x4B : return "Mobile audio internetworking@4";
+ case 0x4C : return "Mobile audio internetworking@5";
+ case 0x4D : return "Mobile audio internetworking@6";
+ case 0x50 : return "AAC@L1";
+ case 0x51 : return "AAC@L2";
+ case 0x52 : return "AAC@L3";
+ case 0x53 : return "AAC@L4";
+ case 0x58 : return "High efficiency AAC@L2";
+ case 0x59 : return "High efficiency AAC@L3";
+ case 0x5A : return "High efficiency AAC@L4";
+ case 0x5B : return "High efficiency AAC@L5";
+ case 0x60 : return "High efficiency AAC v2@L2";
+ case 0x61 : return "High efficiency AAC v2@L3";
+ case 0x62 : return "High efficiency AAC v2@L4";
+ case 0x63 : return "High efficiency AAC v2@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_ID)
+{
+ switch (CA_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 0x5500 : return "Z-Crypt or DRE-Crypt";
+ case 0x5501 : return "Griffin";
+ default : return "Encrypted";
+ }
+}
+
+//***************************************************************************
+// 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
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+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<Element_Offset+descriptor_length)
+ {
+ Element_WaitForMoreData();
+ return;
+ }
+
+ //Filling
+ Header_Fill_Code(descriptor_tag, Ztring().From_Number(descriptor_tag, 16));
+ Header_Fill_Size(2+descriptor_length);
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Descriptors::Data_Parse()
+{
+ #define ELEMENT_CASE(_NAME, _DETAIL) \
+ case 0x##_NAME : Element_Name(_DETAIL); Descriptor_##_NAME(); break;
+
+ //Parsing
+ if (table_id> 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");
+
+ //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");
+ default: if (Element_Code>=0x40)
+ Element_Info("user private");
+ else
+ Element_Info("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_Info("user private");
+ else
+ Element_Info("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_Info("user private");
+ else
+ Element_Info("unknown");
+ Skip_XX(Element_Size, "Data");
+ break;
+ }
+ }
+ else
+ {
+ switch (Element_Code)
+ {
+ default: if (Element_Code>=0x40)
+ Element_Info("user private");
+ else
+ Element_Info("unknown");
+ Skip_XX(Element_Size, "Data");
+ break;
+ }
+ }
+}
+
+//***************************************************************************
+// 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_Info(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_Info(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_Info(Mpegv_profile_and_level_indication_level[profile_and_level_indication_level]);
+ Get_S1 (2, chroma_format, "chroma_format"); Param_Info(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_Info(Mpega_Version[2+ID]); //Mpega_Version is with MPEG2.5 hack
+ Get_S1 (2, layer, "layer"); Param_Info(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_Info(Mpeg_Descriptors_registration_format_identifier_Format(format_identifier)); Param_Info(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;
+ if (format_identifier==Elements::KLVA)
+ {
+ if (!Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[table_id_extension].Infos["KLVA_PID"].empty())
+ Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[table_id_extension].Infos["KLVA_PID"]+=_T(" / ");
+ Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[table_id_extension].Infos["KLVA_PID"]+=Ztring::ToZtring(elementary_PID);
+ }
+ break;
+ }
+ break;
+ default : ;
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Descriptors::Descriptor_06()
+{
+ //Parsing
+ Info_B1(alignment_type, "alignment_type"); Param_Info(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_Info(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::psi)
+ {
+ Complete_Stream->Streams[CA_PID].Kind=complete_stream::stream::psi;
+ #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)
+ {
+ if (Complete_Stream->Streams[CA_PID].Kind!=complete_stream::stream::psi)
+ {
+ Complete_Stream->Streams[CA_PID].Kind=complete_stream::stream::psi;
+ #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_Info(Mpeg_Descriptors_audio_type(audio_type));
+
+ 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;
+ 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_Info(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_Info(Ztring().From_CC4(copyright_identifier));
+ Element_Info(Ztring().From_CC4(copyright_identifier));
+ }
+ if (copyright_identifier==Elements::MANZ)
+ {
+ if (Element_Offset<Element_Size)
+ Skip_Local(Element_Size-Element_Offset, "Info");
+ Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Infos["Encoded_Library"]=_T("Manzanita Systems");
+ }
+
+ if (Element_Offset<Element_Size)
+ Skip_Local(Element_Size-Element_Offset, "Info");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Descriptors::Descriptor_0E()
+{
+ //Parsing
+ int32u maximum_bitrate;
+ BS_Begin();
+ Skip_S1( 2, "reserved");
+ Get_S3 (22, maximum_bitrate, "maximum_bitrate"); Param_Info(maximum_bitrate*400, " bps");
+ BS_End();
+
+ FILLING_BEGIN();
+ switch (table_id)
+ {
+ case 0x02 : //program_map_section
+ if (elementary_PID_IsValid)
+ Complete_Stream->Streams[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_Info(Ztring().From_CC4(private_data_indicator));
+ Element_Info(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_Info(sb_leak_rate*400, " bps");
+ Skip_S1( 2, "reserved");
+ Info_S3(22, sb_size, "sb_size"); Param_Info(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_Info(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.DecSpecificInfoTag_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].DecSpecificInfoTag=MI.DecSpecificInfoTag;
+ 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_Offset<Element_Size)
+ {
+ Element_Begin("FlexMux");
+ Get_B2 (ES_ID, "ES_ID");
+ if (Element_Offset!=Element_Size)
+ Skip_B1( "FlexMuxChannel");
+ Element_End();
+
+ FILLING_BEGIN();
+ switch (table_id)
+ {
+ case 0x02 : //program_map_section
+ if (elementary_PID_IsValid)
+ {
+ Complete_Stream->Streams[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_Info(Avc_profile_idc(profile_idc));
+ BS_Begin();
+ Element_Begin("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_End();
+ 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_Offset<Element_Size)
+ {
+ Element_Begin("service");
+ int16u service_id;
+ int8u service_type;
+ Get_B2 (service_id, "service_id"); Element_Info(Ztring::ToZtring(service_id, 16));
+ Get_B1 (service_type, "service_type"); Param_Info(Mpeg_Descriptors_dvb_service_type(service_type));
+ Element_End(service_id);
+
+ FILLING_BEGIN();
+ Complete_Stream->Transport_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_Info(Frequency_DVB__BCD(frequency));
+ Get_B2 (orbital_position, "orbital_position"); Param_Info(OrbitalPosition_DVB__BCD(orbital_position));
+ BS_Begin();
+ Get_SB ( west_east_flag, "west_east_flag"); Param_Info(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_Info(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_Info(Mpeg_Descriptors_original_network_id(original_network_id));
+ Skip_B2( "service_id");
+ Get_B1 (linkage_type, "linkage_type"); Param_Info(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_Info(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;
+ BS_Begin();
+ Skip_S1(4, "reserved_future_use");
+ Info_S1(4, stream_content, "stream_content"); Param_Info(Mpeg_Descriptors_stream_content(stream_content)); Element_Info(Mpeg_Descriptors_stream_content(stream_content));
+ BS_End();
+ Info_B1(component_type, "component_type"); Param_Info(Mpeg_Descriptors_component_type(stream_content, component_type)); Element_Info(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_Offset<Element_Size)
+ {
+ BS_Begin();
+ Info_S1(4, content_nibble_level_1, "content_nibble_level_1"); Param_Info(Mpeg_Descriptors_content_nibble_level_1(content_nibble_level_1)); Element_Info(Mpeg_Descriptors_content_nibble_level_1(content_nibble_level_1));
+ Info_S1(4, content_nibble_level_2, "content_nibble_level_2"); Param_Info(Mpeg_Descriptors_content_nibble_level_2(content_nibble_level_1, content_nibble_level_2)); if (content_nibble_level_1==0xB || content_nibble_level_2!=0) Element_Info(Mpeg_Descriptors_content_nibble_level_2(content_nibble_level_1, content_nibble_level_2));
+ Skip_S1(4, "user_nibble");
+ Skip_S1(4, "user_nibble");
+ BS_End();
+
+ FILLING_BEGIN();
+ if (event_id_IsValid)
+ {
+ Complete_Stream->Transport_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_Offset<Element_Size)
+ {
+ Skip_Local(3, "country_code");
+ Info_B1(rating, "rating"); Param_Info(rating+3, " years old"); Element_Info(rating+3, " years old");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Descriptors::Descriptor_56()
+{
+ //Parsing
+ Ztring Languages;
+ while (Element_Offset<Element_Size)
+ {
+ Element_Begin("teletext");
+ int32u ISO_639_language_code;
+ Get_C3 (ISO_639_language_code, "ISO_639_language_code");
+ BS_Begin();
+ Info_S1(5, teletext_type, "teletext_type"); Param_Info(Mpeg_Descriptors_teletext_type(teletext_type));
+ Skip_S1(3, "teletext_magazine_number");
+ Skip_S1(4, "teletext_page_number_1");
+ Skip_S1(4, "teletext_page_number_2");
+ BS_End();
+
+ 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);
+ Languages+=(ISO_639_1.empty()?ISO_639_2:ISO_639_1)+_T(" / ");
+ //TODO: this stream is teletext. Be careful, multiple stream in a PID
+ }
+ break;
+ default : ;
+ }
+ FILLING_END();
+
+ Element_End();
+ }
+
+ FILLING_BEGIN();
+ switch (table_id)
+ {
+ case 0x02 : //program_map_section
+ if (elementary_PID_IsValid)
+ {
+ Complete_Stream->Streams[elementary_PID].StreamKind=Stream_Text;
+ if (!Languages.empty())
+ Languages.resize(Languages.size()-3);
+ Complete_Stream->Streams[elementary_PID].Infos["Language"]=Languages;
+ Complete_Stream->Streams[elementary_PID].Infos["Format"]=_T("Teletext");
+ Complete_Stream->Streams[elementary_PID].Infos["Codec"]=_T("Teletext");
+ }
+ break;
+ default : ;
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Descriptors::Descriptor_58()
+{
+ //Parsing
+ while (Element_Offset<Element_Size)
+ {
+ int32u country_code;
+ int8u country_region_id;
+ Get_C3 (country_code, "country_code");
+ BS_Begin();
+ Get_S1 (6, country_region_id, "country_region_id");
+ Skip_SB( "reserved");
+ Info_SB(local_time_offset_polarity, "local_time_offset_polarity"); Param_Info(local_time_offset_polarity?"-":"+");
+ BS_End();
+ Info_B2(local_time_offset, "local_time_offset"); Param_Info(TimeHHMM_BCD(local_time_offset));
+ Info_B2(date, "time_of_change (date)"); Param_Info(Date_MJD(date));
+ Info_B3(time, "time_of_change (time)"); Param_Info(Time_BCD(time));
+ Info_B2(next_time_offset, "next_time_offset"); Param_Info(TimeHHMM_BCD(next_time_offset));
+
+ FILLING_BEGIN();
+ Ztring Country; Country.From_CC3(country_code);
+ if (country_region_id)
+ Country+=_T(" (")+Ztring::ToZtring(country_region_id)+_T(")");
+ Complete_Stream->TimeZones[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_Offset<Element_Size)
+ {
+ Element_Begin("subtitle");
+ int32u ISO_639_language_code;
+ Get_C3 (ISO_639_language_code, "ISO_639_language_code");
+ Info_B1(subtitling_type, "subtitling_type"); Param_Info(Mpeg_Descriptors_component_type_O3(subtitling_type));
+ Skip_B2( "composition_page_id");
+ Skip_B2( "ancillary_page_id");
+
+ 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);
+ Languages+=(ISO_639_1.empty()?ISO_639_2:ISO_639_1)+_T(" / ");
+ //TODO: this stream is teletext. Be careful, multiple stream in a PID
+ }
+ break;
+ default : ;
+ }
+ FILLING_END();
+
+ Element_End();
+ }
+
+ FILLING_BEGIN();
+ switch (table_id)
+ {
+ case 0x02 : //program_map_section
+ if (elementary_PID_IsValid)
+ {
+ Complete_Stream->Streams[elementary_PID].StreamKind=Stream_Text;
+ 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 Subtitles");
+ Complete_Stream->Streams[elementary_PID].Infos["Codec"]=_T("DVB Subtitles");
+ }
+ break;
+ default : ;
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Descriptors::Descriptor_5A()
+{
+ //Parsing
+ Info_B4(centre_frequency, "centre_frequency"); Param_Info(((int64u)centre_frequency)*10, " Hz");
+ BS_Begin();
+ Info_S1(3, bandwidth, "bandwidth"); Param_Info(Mpeg_Descriptors_bandwidth[bandwidth]);
+ Info_SB( priority, "priority"); Param_Info(priority?"HP":"LP");
+ Skip_SB( "Time_Slicing_indicator");
+ Skip_SB( "MPE-FEC_indicator");
+ Skip_S1(2, "reserved");
+ Info_S1(2, constellation, "constellation"); Param_Info(Mpeg_Descriptors_constellation[constellation]);
+ Info_S1(3, hierarchy_information, "hierarchy_information"); Param_Info(Mpeg_Descriptors_hierarchy_information[hierarchy_information]);
+ Info_S1(3, code_rate_HP, "code_rate-HP_stream"); Param_Info(Mpeg_Descriptors_code_rate[code_rate_HP]);
+ Info_S1(3, code_rate_LP, "code_rate-LP_stream"); Param_Info(Mpeg_Descriptors_code_rate[code_rate_LP]);
+ Info_S1(2, guard_interval, "guard_interval"); Param_Info(Mpeg_Descriptors_guard_interval[guard_interval]);
+ Info_S1(2, transmission_mode, "transmission_mode"); Param_Info(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_Offset<Element_Size)
+ {
+ Ztring service_provider_name, service_name;
+ int32u ISO_639_language_code;
+ int8u service_provider_name_length, service_name_length;
+ Get_C3 (ISO_639_language_code, "ISO_639_language_code");
+ 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();
+ Ztring ISO_639_2=Ztring().From_CC3(ISO_639_language_code);
+ const Ztring& ISO_639_1=MediaInfoLib::Config.Iso639_1_Get(ISO_639_2);
+ ServiceProvider+=(ISO_639_1.empty()?ISO_639_2:ISO_639_1)+_T(':')+service_provider_name+_T( " - ");
+ ServiceName+=(ISO_639_1.empty()?ISO_639_2:ISO_639_1)+_T(':')+service_name+_T( " - ");
+ FILLING_END();
+ }
+
+ if (!ServiceProvider.empty())
+ {
+ ServiceProvider.resize(ServiceProvider.size()-3);
+ if (program_number_IsValid)
+ Complete_Stream->Transport_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_Info(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_Info(AC3_Mode[service_type]);
+ Get_S1 (3, number_of_channels, "number_of_channels"); Param_Info(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].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=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_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_Info(AC3_Mode[service_type]);
+ Get_S1 (3, number_of_channels, "number_of_channels"); Param_Info(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].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=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();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Descriptors::Descriptor_7C()
+{
+ //Parsing
+ int8u Profile_and_level;
+ bool AAC_type_flag;
+ Get_B1 ( Profile_and_level, "Profile_and_level"); Param_Info(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();
+ 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_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_Info(AC3_SamplingRate[sample_rate_code], " Hz");}
+ Skip_S1(5, "bsid");
+ Get_S1 (6, bit_rate_code, "bit_rate_code"); Param_Info(AC3_BitRate[bit_rate_code]*1000, " Kbps");
+ Get_S1 (2, surround_mode, "surround_mode"); Param_Info(AC3_Surround[surround_mode]);
+ Get_S1 (3, bsmod, "bsmod");
+ Get_S1 (4, num_channels, "num_channels"); if (num_channels<8) {Param_Info(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)
+ {
+ 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_Info(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"); if (text_code) Param_Info("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()
+{
+ //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();
+ if (elementary_PID_IsValid)
+ {
+ if (number_of_services>=Complete_Stream->Streams[elementary_PID].Captions_Language.size())
+ Complete_Stream->Streams[elementary_PID].Captions_Language.resize(number_of_services);
+ }
+
+ for (int8u Pos=0; Pos<number_of_services; Pos++)
+ {
+ Element_Begin("service");
+ Ztring language;
+ bool digital_cc;
+ Get_Local(3, language, "language");
+ BS_Begin();
+ Get_SB (digital_cc, "digital_cc");
+ Skip_SB( "reserved");
+ if (digital_cc) //line21
+ {
+ Skip_S1(5, "reserved");
+ Skip_SB( "line21_field");
+ }
+ else
+ Skip_S1(6, "caption_service_number");
+ Skip_SB( "easy_reader");
+ Skip_SB( "wide_aspect_ratio");
+ Skip_S2(14, "reserved");
+ BS_End();
+ Element_End();
+
+ if (event_id_IsValid)
+ {
+ if (Complete_Stream->Sources[table_id_extension].ATSC_EPG_Blocks[Complete_Stream->Streams[pid].table_type].Events[event_id].language.empty()) //We use only the first detected value
+ Complete_Stream->Sources[table_id_extension].ATSC_EPG_Blocks[Complete_Stream->Streams[pid].table_type].Events[event_id].language=language;
+ }
+ if (elementary_PID_IsValid)
+ {
+ if (Complete_Stream->Streams[elementary_PID].Captions_Language[Pos].empty()) //We use only the first detected value
+ Complete_Stream->Streams[elementary_PID].Captions_Language[Pos]=language;
+ }
+ }
+}
+
+//---------------------------------------------------------------------------
+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_Pos<rating_region_count; rating_region_Pos++)
+ {
+ Element_Begin("rating_region");
+ int8u rated_dimensions;
+ Skip_B1( "rating_region");
+ Get_B1 (rated_dimensions, "rated_dimensions");
+ for (int8u rated_dimension_Pos=0; rated_dimension_Pos<rated_dimensions; rated_dimension_Pos++)
+ {
+ Element_Begin("rated_dimension");
+ Skip_B1( "rating_dimension_j");
+ BS_Begin();
+ Skip_S1(4, "reserved");
+ Skip_S1(4, "rating_value");
+ BS_End();
+ Element_End();
+ }
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Descriptors::Descriptor_A0()
+{
+ //Parsing
+ Ztring title;
+ ATSC_multiple_string_structure(title, "title");
+
+ FILLING_BEGIN(); //Can be more
+ switch (table_id)
+ {
+ case 0xC8 : //TVCT
+ case 0xC9 : //CVCT
+ case 0xDA : //SVCT
+ if (program_number_IsValid)
+ if (!title.empty())
+ Complete_Stream->Transport_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; Pos<number_elements; Pos++)
+ {
+ Element_Begin();
+ int16u elementary_PID;
+ Skip_B1( "stream_type");
+ BS_Begin();
+ Skip_S1( 3, "reserved");
+ Get_S2 (13, elementary_PID, "elementary_PID");
+ BS_End();
+ Skip_Local(3, "ISO_639_language_code");
+ Element_End(Ztring().From_CC2(elementary_PID), 6);
+ }
+}
+
+//---------------------------------------------------------------------------
+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");
+}
+
+//***************************************************************************
+// Helpers
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Descriptors::ATSC_multiple_string_structure(Ztring &Value, const char* Info)
+{
+ //Parsing
+ Ztring string;
+ int8u number_strings, number_segments;
+ Element_Begin(Info);
+ Get_B1(number_strings, "number_strings");
+ for (int8u string_Pos=0; string_Pos<number_strings; string_Pos++)
+ {
+ Element_Begin("String");
+ int32u ISO_639_language_code;
+ Get_C3(ISO_639_language_code, "ISO_639_language_code");
+ Get_B1(number_segments, "number_segments");
+ for (int8u segment_Pos=0; segment_Pos<number_segments; segment_Pos++)
+ {
+ Element_Begin("Segment");
+ Ztring segment;
+ int8u compression_type, mode, number_bytes;
+ Get_B1 (compression_type, "compression_type");
+ Get_B1 (mode, "mode");
+ Get_B1 (number_bytes, "number_bytes");
+ switch (compression_type)
+ {
+ case 0x00 :
+ switch (mode)
+ {
+ case 0x00 : Get_Local(number_bytes, segment, "string"); break;
+ case 0x3F : Get_UTF16B(number_bytes, segment, "string"); break;
+ default : Skip_XX(number_bytes, "Unknown");
+ segment=_T("(Encoded with mode=0x")+Ztring::ToZtring(mode, 16)+_T(')');
+ }
+ break;
+ default : Skip_XX(number_bytes, "(Compressed)");
+ segment=_T("(Compressed)");
+ }
+ Element_End(3+number_bytes);
+
+ FILLING_BEGIN();
+ if (segment.find_first_not_of(_T("\t\n "))!=std::string::npos)
+ string+=segment+_T(" - ");
+ FILLING_END();
+ }
+
+ FILLING_BEGIN();
+ if (!string.empty())
+ string.resize(string.size()-3);
+ Ztring ISO_639_2=Ztring().From_CC3(ISO_639_language_code);
+ const Ztring& ISO_639_1=MediaInfoLib::Config.Iso639_1_Get(ISO_639_2);
+ Value+=(ISO_639_1.empty()?ISO_639_2:ISO_639_1)+_T(':')+string+_T(" - ");
+ FILLING_END();
+
+ Element_Info(string);
+ Element_End("String");
+ }
+
+ if (!Value.empty())
+ Value.resize(Value.size()-3);
+
+ Element_Info(Value);
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Descriptors::Get_DVB_Text(int64u Size, Ztring &Value, const char* Info)
+{
+ if (Size<1)
+ {
+ Get_Local(Size, Value, Info);
+ return;
+ }
+
+ //Testing if there is a codepage
+ int8u CodePage1;
+ Peek_B1(CodePage1);
+ if (CodePage1<0x20)
+ {
+ Skip_B1( "CodePage"); Param_Info(Mpeg_Descriptors_codepage_1(CodePage1));
+ if (CodePage1!=0x10)
+ {
+ Get_Local(Size-1, Value, Info);
+ }
+ else
+ {
+ if (Size<3)
+ {
+ Value.clear();
+ return;
+ }
+ Skip_B2( "CodePage2");
+ Get_Local(Size-3, Value, Info);
+ }
+
+ }
+ else
+ Get_Local(Size, Value, Info);
+}
+
+//---------------------------------------------------------------------------
+//Modified Julian Date
+Ztring File_Mpeg_Descriptors::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_Descriptors::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
+}
+
+//---------------------------------------------------------------------------
+//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
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Mpeg_Descriptors.h b/src/thirdparty/MediaInfo/Multiple/File_Mpeg_Descriptors.h
new file mode 100644
index 000000000..5f537a602
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Mpeg_Descriptors.h
@@ -0,0 +1,584 @@
+// File_Mpeg_Descriptors - Info for MPEG files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about MPEG files, Descriptors
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_Mpeg_DescriptorsH
+#define MediaInfo_Mpeg_DescriptorsH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include "MediaInfo/Multiple/File_Mpeg4_Descriptors.h"
+#include "MediaInfo/Duplicate/File__Duplicate_MpegTs.h"
+#include <map>
+//---------------------------------------------------------------------------
+
+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<Ztring, Ztring> TimeZones; //Key is country code
+
+ //Per transport_stream
+ struct transport_stream
+ {
+ bool HasChanged;
+ std::map<std::string, Ztring> Infos;
+ struct program
+ {
+ bool HasChanged;
+ std::map<std::string, Ztring> Infos;
+ std::vector<int16u> elementary_PIDs;
+ size_t StreamPos; //Stream_Menu
+ int32u registration_format_identifier;
+ int16u pid;
+ int16u PCR_PID;
+ int16u program_number;
+ int16u source_id; //ATSC
+ bool IsParsed;
+ bool IsRegistered;
+
+ //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<int16u, event> events; //Key is event_id
+ events Events; //Key is event_id
+ };
+ typedef std::map<int8u, dvb_epg_block> dvb_epg_blocks; //Key is table_id
+ dvb_epg_blocks DVB_EPG_Blocks; //Key is table_id
+ bool DVB_EPG_Blocks_IsUpdated;
+
+ //Constructor/Destructor
+ program()
+ {
+ HasChanged=false;
+ StreamPos=(size_t)-1;
+ registration_format_identifier=0x00000000;
+ pid=0x00000;
+ PCR_PID=0x0000;
+ program_number=0x0000;
+ source_id=0x0000;
+ IsParsed=false;
+ IsRegistered=false;
+ DVB_EPG_Blocks_IsUpdated=false;
+ }
+ };
+ typedef std::map<int16u, program> programs; //Key is program_number
+ programs Programs; //Key is program_number
+ size_t Programs_NotParsedCount;
+
+ //Per IOD
+ struct iod_es
+ {
+ File__Analyze* Parser;
+ #ifdef MEDIAINFO_MPEG4_YES
+ File_Mpeg4_Descriptors::decspecificinfotag* DecSpecificInfoTag;
+ File_Mpeg4_Descriptors::slconfig* SLConfig;
+ #endif
+
+ //Constructor/Destructor
+ iod_es()
+ {
+ Parser=NULL;
+ #ifdef MEDIAINFO_MPEG4_YES
+ DecSpecificInfoTag=NULL;
+ SLConfig=NULL;
+ #endif
+ }
+
+ ~iod_es()
+ {
+ delete Parser; //Parser=NULL;
+ #ifdef MEDIAINFO_MPEG4_YES
+ delete DecSpecificInfoTag; //DecSpecificInfoTag=NULL;
+ delete SLConfig; //SLConfig=NULL;
+ #endif
+ }
+ };
+ typedef std::map<int16u, iod_es> iod_ess; //Key is ES_ID
+ std::map<int16u, iod_es> IOD_ESs; //Key is ES_ID
+
+ //ATSC
+ int16u source_id; //Global
+
+ transport_stream()
+ {
+ HasChanged=false;
+ source_id=0;
+ Programs_NotParsedCount=(size_t)-1;
+ }
+ };
+ typedef std::map<int16u, transport_stream> 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<int16u> program_numbers;
+ struct table_id
+ {
+ struct table_id_extension
+ {
+ typedef std::vector<bool> section_numbers; //Key is section_number
+ section_numbers Section_Numbers; //Key is section_number
+ int8u version_number;
+ };
+ typedef std::map<int16u, table_id_extension> 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_id*> table_ids;
+ table_ids Table_IDs; //Key is table_id
+ std::map<std::string, Ztring> Infos;
+ std::vector<Ztring> Captions_Language;
+ #if MEDIAINFO_TRACE
+ Ztring Element_Info;
+ #endif //MEDIAINFO_TRACE
+ stream_t StreamKind;
+ size_t StreamPos;
+ ts_kind Kind;
+ bool IsPCR;
+ #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
+ #endif //MEDIAINFO_MPEGTS_PCR_YES
+ int32u registration_format_identifier;
+ int16u FMC_ES_ID;
+ int16u table_type; //ATSC
+ int8u stream_type;
+ 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;
+ size_t IsScrambled;
+ int16u SubStream_pid;
+
+ //Constructor/Destructor
+ stream()
+ {
+ Parser=NULL;
+ StreamKind=Stream_Max;
+ StreamPos=(size_t)-1;
+ Kind=unknown;
+ IsPCR=false;
+ #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;
+ #endif //MEDIAINFO_MPEGTS_PCR_YES
+ registration_format_identifier=0x00000000;
+ FMC_ES_ID=0x0000;
+ table_type=0x0000;
+ stream_type=0x00;
+ 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;
+ IsScrambled=false;
+ SubStream_pid=0x0000;
+ }
+
+ ~stream()
+ {
+ delete Parser; //Parser=NULL;
+ for (size_t Pos=0; Pos<Table_IDs.size(); Pos++)
+ delete Table_IDs[Pos]; //Table_IDs[Pos]=NULL;
+ }
+
+ //Helpers
+ void Searching_Payload_Start_Set(bool ToSet)
+ {
+ Searching_Payload_Start=ToSet;
+ Searching_Test();
+ }
+ void Searching_Payload_Continue_Set(bool ToSet)
+ {
+ Searching_Payload_Continue=ToSet;
+ Searching_Test();
+ }
+ #ifdef MEDIAINFO_MPEGTS_PCR_YES
+ void Searching_TimeStamp_Start_Set(bool ToSet)
+ {
+ Searching_TimeStamp_Start=ToSet;
+ Searching_Test();
+ }
+ void Searching_TimeStamp_End_Set(bool ToSet)
+ {
+ Searching_TimeStamp_End=ToSet;
+ Searching_Test();
+ }
+ #endif //MEDIAINFO_MPEGTS_PCR_YES
+ #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES
+ void Searching_ParserTimeStamp_Start_Set(bool ToSet)
+ {
+ Searching_ParserTimeStamp_Start=ToSet;
+ Searching_Test();
+ }
+ void Searching_ParserTimeStamp_End_Set(bool ToSet)
+ {
+ Searching_ParserTimeStamp_End=ToSet;
+ Searching_Test();
+ }
+ #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES
+ void Searching_Test()
+ {
+ Searching=Searching_Payload_Start
+ | Searching_Payload_Continue
+ #ifdef MEDIAINFO_MPEGTS_PCR_YES
+ | Searching_TimeStamp_Start
+ | Searching_TimeStamp_End
+ #endif //MEDIAINFO_MPEGTS_PCR_YES
+ #ifdef MEDIAINFO_MPEGTS_PESTIMESTAMP_YES
+ | Searching_ParserTimeStamp_Start
+ | Searching_ParserTimeStamp_End
+ #endif //MEDIAINFO_MPEGTS_PESTIMESTAMP_YES
+ ;
+ }
+ };
+ typedef std::vector<stream> 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<int16u, Ztring> texts;
+ struct atsc_epg_block
+ {
+ struct event
+ {
+ int32u start_time;
+ Ztring duration;
+ Ztring title;
+ Ztring language;
+ std::map<int16u, Ztring> texts;
+
+ event()
+ {
+ start_time=(int32u)-1;
+ }
+ };
+
+ typedef std::map<int16u, event> events; //Key is event_id
+ events Events; //Key is event_id
+ };
+ typedef std::map<int16u, atsc_epg_block> 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<int16u, source> sources; //Key is source_id
+ sources Sources; //Key is source_id
+ bool Sources_IsUpdated; //For EPG ATSC
+ bool Programs_IsUpdated; //For EPG DVB
+
+ //File__Duplicate
+ bool File__Duplicate_HasChanged_;
+ size_t Config_File_Duplicate_Get_AlwaysNeeded_Count;
+ std::vector<File__Duplicate_MpegTs*> Duplicates_Speed;
+ std::vector<std::vector<File__Duplicate_MpegTs*> > Duplicates_Speed_FromPID;
+ std::map<const String, File__Duplicate_MpegTs*> Duplicates;
+ bool File__Duplicate_Get_From_PID (int16u PID)
+ {
+ if (Duplicates_Speed_FromPID.empty())
+ return false;
+ return !Duplicates_Speed_FromPID[PID].empty();
+ }
+
+ //Constructor/Destructor
+ complete_stream()
+ {
+ transport_stream_id=0;
+ transport_stream_id_IsValid=false;
+ Duration_End_IsUpdated=false;
+ Streams_NotParsedCount=0;
+ Streams_With_StartTimeStampCount=0;
+ Streams_With_EndTimeStampMoreThanxSecondsCount=0;
+ GPS_UTC_offset=0;
+ Sources_IsUpdated=false;
+ Programs_IsUpdated=false;
+ }
+
+ ~complete_stream()
+ {
+ std::map<const String, File__Duplicate_MpegTs*>::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 - 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_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");};
+
+ //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
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Mpeg_Psi.cpp b/src/thirdparty/MediaInfo/Multiple/File_Mpeg_Psi.cpp
new file mode 100644
index 000000000..74edbe114
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Mpeg_Psi.cpp
@@ -0,0 +1,2065 @@
+// File_Mpeg_Psi - Info for MPEG Stream files
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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 <memory>
+#include <algorithm>
+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>=0x301
+ && 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";
+ default :
+ switch (format_identifier)
+ {
+ case Elements::CUEI :
+ case Elements::SCTE : //SCTE
+ case Elements::GA94 :
+ case Elements::S14A : //ATSC
+ switch (stream_type)
+ {
+ case 0x81 : return "AC-3";
+ case 0x82 : return "Text";
+ 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";
+ default :
+ switch (format_identifier)
+ {
+ case Elements::CUEI :
+ case Elements::SCTE : //SCTE
+ case Elements::GA94 :
+ case Elements::S14A : //ATSC
+ switch (stream_type)
+ {
+ 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 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 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 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 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)";
+ 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);
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Mpeg_Psi::File_Mpeg_Psi()
+:File__Analyze()
+{
+ //In
+ From_TS=true; //Default is from TS
+ Complete_Stream=NULL;
+ pid=0x0000;
+
+ //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;
+}
+
+//---------------------------------------------------------------------------
+File_Mpeg_Psi::~File_Mpeg_Psi()
+{
+}
+
+//***************************************************************************
+// Buffer
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+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;
+ }
+
+ //Payload
+ Get_B1 (pointer_field, "pointer_field");
+ if (pointer_field)
+ Skip_XX(pointer_field, "payload");
+
+ //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)(pointer_field+section_length)<Element_Offset+(section_syntax_indicator?4:0)) //We must have 4 more byte for CRC
+ {
+ Reject("PSI"); //Error, we exit
+ return;
+ }
+ if (Element_Size<Element_Offset+section_length)
+ {
+ Element_WaitForMoreData();
+ return;
+ }
+ //Element[Element_Level-1].IsComplete=true;
+
+ //CRC32
+ if (section_syntax_indicator)
+ {
+ int32u CRC_32=0xffffffff;
+ const int8u* CRC_32_Buffer=Buffer+Buffer_Offset+(size_t)Element_Offset-3; //table_id position
+
+ while(CRC_32_Buffer<Buffer+Buffer_Offset+(size_t)Element_Offset+section_length) //from table_id to the end, CRC_32 included
+ {
+ CRC_32=(CRC_32<<8) ^ Psi_CRC_32_Table[(CRC_32>>24)^(*CRC_32_Buffer)];
+ CRC_32_Buffer++;
+ }
+ CRC_32=0;
+ }
+
+ //Filling
+ Header_Fill_Code(table_id, Ztring().From_Number(table_id, 16));
+ Header_Fill_Size(pointer_field+section_length+4);
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Psi::Data_Parse()
+{
+ //Check if OK
+ if(CRC_32!=0)
+ {
+ Skip_XX(Element_Size, "Data (CRC 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_Info(_T("Version=")+Ztring::ToZtring(version_number));
+ Get_SB ( current_next_indicator, "current_next_indicator");
+ BS_End();
+ Info_B1( section_number, "section_number"); Element_Info(_T("Section=")+Ztring::ToZtring(section_number));
+ Skip_B1( "last_section_number");
+ }
+
+ #define ELEMENT_CASE(_NAME, _DETAIL) \
+ case 0x##_NAME : 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");
+ 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)
+ {
+ Element_Size+=4;
+ Skip_B4( "CRC32");
+ }
+
+ Status[IsAccepted]=true; //Accept("PSI");
+ Status[IsFinished]=true; //Finish("PSI");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Psi::Table_reserved()
+{
+
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Psi::Table_iso13818_6()
+{
+ Element_Info("Defined in ISO/IEC 13818-6");
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Psi::Table_user_private()
+{
+ Element_Info("user_private");
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Psi::Table_forbidden()
+{
+ Element_Info("forbidden");
+ Skip_XX(Element_Size, "Data");
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Psi::program_stream_map()
+{
+ Element_Name("program_stream_map");
+
+ //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");
+ Descriptors();
+
+ Get_B2 (elementary_stream_map_length, "elementary_stream_map_length");
+ int16u elementary_stream_map_Pos=0;
+ while (Element_Offset<Element_Size && elementary_stream_map_Pos<elementary_stream_map_length)
+ {
+ Element_Begin();
+ int16u ES_info_length;
+ int8u stream_type, elementary_stream_id;
+ Get_B1 (stream_type, "stream_type"); Param_Info(Mpeg_Psi_stream_type_Info(stream_type, 0x00000000));
+ Get_B1 (elementary_stream_id, "elementary_stream_id");
+ Get_B2 (ES_info_length, "ES_info_length");
+ Descriptors_Size=ES_info_length;
+ Element_Name(Ztring::ToZtring(elementary_stream_id, 16));
+ if (elementary_stream_id==0xFD && !single_extension_stream_flag)
+ {
+ Skip_S1(8, "pseudo_descriptor_tag");
+ Skip_S1(8, "pseudo_descriptor_length");
+ Mark_1();
+ Skip_S1(7, "elementary_stream_id_extension");
+ if (Descriptors_Size>=3)
+ Descriptors_Size-=3;
+ }
+ Descriptors();
+ Element_End(4+ES_info_length);
+ elementary_stream_map_Pos+=4+ES_info_length;
+
+ FILLING_BEGIN();
+ Complete_Stream->Streams[elementary_stream_id].stream_type=stream_type;
+ FILLING_END();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Psi::Table_00()
+{
+ FILLING_BEGIN();
+ Complete_Stream->transport_stream_id=table_id_extension;
+ Complete_Stream->transport_stream_id_IsValid=true;
+ FILLING_END();
+
+ //Clear
+ Complete_Stream->Transport_Streams[table_id_extension].Programs_NotParsedCount=0;
+ Complete_Stream->Transport_Streams[table_id_extension].Programs.clear();
+
+ //Reseting
+ std::vector<int16u> 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; Pos<Table_ID_Extension_List.size(); Pos++)
+ Complete_Stream->Streams[0x0000].Table_IDs[0x00]->Table_ID_Extensions.erase(Table_ID_Extension_List[Pos]);
+
+ //Parsing
+ while (Element_Offset<Element_Size)
+ {
+ Element_Begin(4);
+ int16u program_number;
+ Get_B2 ( program_number, "program_number");
+ BS_Begin();
+ Skip_S1( 3, "reserved");
+ Get_S2 ( 13, elementary_PID, program_number?"program_map_PID":"network_PID"); Element_Info(Ztring::ToZtring_From_CC2(elementary_PID));
+ BS_End();
+ Element_End(Ztring::ToZtring_From_CC2(program_number));
+
+ FILLING_BEGIN();
+ if (elementary_PID && Config->File_Filter_Get(program_number))
+ {
+ //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);
+ 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;
+ 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
+ else if (Complete_Stream->Streams[elementary_PID].Table_IDs[0x00]==NULL)
+ {
+ for (size_t Table_ID=0; 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
+ }
+ }
+ FILLING_END();
+ }
+ BS_End();
+
+ FILLING_BEGIN();
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Psi::Table_01()
+{
+ //Parsing
+ if (Element_Offset<Element_Size)
+ {
+ Descriptors_Size=(int16u)(Element_Size-Element_Offset);
+ Descriptors();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Psi::Table_02()
+{
+ FILLING_BEGIN();
+ 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[table_id_extension].IsParsed=true;
+ }
+ FILLING_END();
+
+ //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
+ program_number=table_id_extension;
+ program_number_IsValid=true;
+ if (Descriptors_Size>0)
+ Descriptors();
+
+ //Parsing
+ while (Element_Offset<Element_Size)
+ {
+ Element_Begin();
+ int8u stream_type;
+ BS_Begin();
+ Get_S1 ( 8, stream_type, "stream_type"); Element_Info(Mpeg_Psi_stream_type_Info(stream_type, Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].registration_format_identifier)); Param_Info(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();
+ if (elementary_PID)
+ {
+ bool IsAlreadyPresent=false;
+ for (size_t Pos=0; Pos<Complete_Stream->Streams[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 (Complete_Stream->Streams[elementary_PID].Kind!=complete_stream::stream::pes)
+ {
+ 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_Info="PES";
+ #endif //MEDIAINFO_TRACE
+ if (Complete_Stream->File__Duplicate_Get_From_PID(elementary_PID))
+ Complete_Stream->Streams[elementary_PID].ShouldDuplicate=true;
+ }
+ }
+
+ //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<MediaInfo_Internal*> MIs;
+ MIs.resize(List.size());
+ size_t FileWithRightPID_Pos=(size_t)-1;
+ for (size_t Pos=0; Pos<MIs.size(); Pos++)
+ {
+ MIs[Pos]=new MediaInfo_Internal();
+ MIs[Pos]->Option(_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; Pos<Complete_Stream->Streams[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)
+ {
+ 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_Info="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; Pos<MIs.size(); Pos++)
+ delete MIs[Pos]; //MIs[Pos]=NULL;
+ }
+ FILLING_END();
+
+ //Descriptors
+ elementary_PID_IsValid=true;
+ if (Descriptors_Size>0)
+ Descriptors();
+
+ Element_End(Ztring::ToZtring_From_CC2(elementary_PID), 5+Descriptors_Size);
+ }
+
+ FILLING_BEGIN();
+ #ifdef MEDIAINFO_MPEGTS_PCR_YES
+ Complete_Stream->Streams[PCR_PID].IsPCR=true;
+ 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_Info="PCR";
+ #endif //MEDIAINFO_TRACE
+ #endif //MEDIAINFO_MPEGTS_PCR_YES
+
+ //Sorting
+ sort(Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].elementary_PIDs.begin(), Complete_Stream->Transport_Streams[Complete_Stream->transport_stream_id].Programs[program_number].elementary_PIDs.end());
+
+ //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
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Psi::Table_03()
+{
+ //Parsing
+ if (Element_Offset<Element_Size)
+ {
+ Descriptors_Size=(int16u)(Element_Size-Element_Offset);
+ Descriptors();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Psi::Table_40()
+{
+ //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_Offset<Element_Size)
+ {
+ int16u original_network_id;
+ Element_Begin();
+ Get_B2 (transport_stream_id, "transport_stream_id"); Element_Info(transport_stream_id);
+ Get_B2 (original_network_id, "original_network_id"); Param_Info(Mpeg_Descriptors_original_network_id(original_network_id));
+ BS_Begin();
+ Skip_S1( 4, "reserved");
+ Get_S2 (12, Descriptors_Size, "transport_descriptors_length");
+ BS_End();
+
+ //Descriptors
+ if (Descriptors_Size>0)
+ Descriptors();
+
+ Element_End();
+
+ 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_Offset<Element_Size)
+ {
+ Element_Begin();
+ int64u Test;
+ Peek_B5(Test);
+ if (Test!=0xFFFFFFFFFFULL)
+ {
+ Get_B2 ( program_number, "service_id");
+ BS_Begin();
+ Skip_S1( 6, "reserved_future_use");
+ Skip_SB( "EIT_schedule_flag");
+ Skip_SB( "EIT_present_following_flag");
+ Info_S1( 3, running_status, "running_status"); Param_Info(Mpeg_Psi_running_status[running_status]);
+ Skip_SB( "free_CA_mode");
+ Get_S2 (12, Descriptors_Size, "ES_info_length");
+ BS_End();
+
+ //Descriptors
+ program_number_IsValid=true;
+ if (Descriptors_Size>0)
+ Descriptors();
+
+ Element_End(Ztring::ToZtring_From_CC2(program_number), 5+Descriptors_Size);
+ }
+ else
+ {
+ Skip_XX(Element_Size-Element_Offset, "Junk");
+ Element_End("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_Offset<Element_Size)
+ {
+ Element_Begin();
+ int32u time, duration;
+ int16u date;
+ int8u running_status;
+ Get_B2 (event_id, "event_id");
+ Get_B2 (date, "start_time (date)"); Param_Info(Date_MJD(date));
+ Get_B3 (time, "start_time (time)"); Param_Info(Time_BCD(time));
+ Get_B3 (duration, "duration"); Param_Info(Time_BCD(duration));
+ BS_Begin();
+ Get_S1 ( 3, running_status, "running_status"); Param_Info(Mpeg_Psi_running_status[running_status]);
+ Skip_SB( "free_CA_mode");
+ Get_S2 (12, Descriptors_Size, "descriptors_loop_length");
+ BS_End();
+
+ //Descriptors
+ event_id_IsValid=true;
+ if (Descriptors_Size>0)
+ Descriptors();
+
+ Element_End(Ztring::ToZtring_From_CC2(event_id), 11+Descriptors_Size);
+
+ 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);
+ 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_Info(Date_MJD(date));
+ Get_B3 (time, "UTC_time (time)"); Param_Info(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_Info(Date_MJD(date));
+ Get_B3 (time, "UTC_time (time)"); Param_Info(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_Offset<Element_Size)
+ {
+ Element_Begin();
+ Get_B2 ( program_number, "service_id");
+ BS_Begin();
+ Skip_SB( "DVB_reserved_future_use");
+ Info_S1( 3, running_status, "running_status"); Param_Info(Mpeg_Psi_running_status[running_status]);
+ Get_S2 (12, Descriptors_Size, "service_loop_length");
+ BS_End();
+
+ //Descriptors
+ program_number_IsValid=true;
+ if (Descriptors_Size>0)
+ Descriptors();
+
+ Element_End(Ztring::ToZtring_From_CC2(program_number), 5+Descriptors_Size);
+ }
+}
+
+//---------------------------------------------------------------------------
+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; Pos<tables_defined; Pos++)
+ {
+ int16u table_type, table_type_PID;
+ Element_Begin();
+ Get_B2 ( table_type, "table_type"); Param_Info(Mpeg_Psi_ATSC_table_type(table_type));
+ BS_Begin();
+ Skip_S1( 3, "reserved");
+ Get_S2 (13, table_type_PID, "table_type_PID");
+ Skip_S1( 3, "reserved");
+ Skip_S1( 5, "table_type_version_number");
+ BS_End();
+ Skip_B4( "number_bytes");
+ BS_Begin();
+ Skip_S1( 4, "reserved");
+ Get_S2 (12, Descriptors_Size, "table_type_descriptors_length");
+ BS_End();
+
+ //Descriptors
+ if (Descriptors_Size>0)
+ Descriptors();
+
+ Element_Info(Mpeg_Psi_ATSC_table_type(table_type));
+ Element_End(Ztring::ToZtring_From_CC2(table_type_PID), 11+Descriptors_Size);
+
+ 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; Pos<num_channels_in_section; Pos++)
+ {
+ int16u major_channel_number, minor_channel_number, source_id;
+ int8u service_type;
+ Element_Begin();
+ Get_UTF16B(table_id==0xDA?16:14, short_name, "short_name"); //8 chars for satellite, else 7 chars
+ BS_Begin();
+ Skip_S1( 4, "reserved");
+ Get_S2 (10, major_channel_number, "major_channel_number");
+ Get_S2 (10, minor_channel_number, "minor_channel_number");
+ if (table_id==0xDA) //Satellite
+ {
+ Skip_S1( 6, "modulation_mode");
+ Skip_S4(32, "carrier_frequency");
+ Skip_S4(32, "carrier_symbol_rate");
+ Skip_S1( 2, "polarization");
+ BS_End();
+ Skip_B1( "FEC_Inner");
+ }
+ else //Terrestrial and Cable
+ {
+ BS_End();
+ Skip_B1( "modulation_mode");
+ Skip_B4( "carrier_frequency");
+ }
+ Skip_B2( "channel_TSID");
+ Get_B2 ( program_number, "program_number");
+ BS_Begin();
+ Skip_S1( 2, "ETM_location");
+ Skip_SB( table_id==0xDA?"reserved":"access_controlled");
+ Skip_SB( "hidden");
+ if (table_id==0xC8) //Terrestrial
+ {
+ Skip_SB( "path_select");
+ Skip_SB( "out_of_band");
+ }
+ else //Cable and satellite
+ Skip_S1( 2, "reserved");
+ Skip_SB( "hide_guide");
+ Skip_S1( 3, "reserved");
+ Get_S1 ( 6, service_type, "service_type");
+ BS_End();
+ Get_B2 ( source_id, "source_id");
+ if (table_id==0xDA) //Satellite
+ Skip_B1( "feed_id");
+ BS_Begin();
+ Skip_S1( 6, "reserved");
+ Get_S2 (10, Descriptors_Size, "descriptors_length");
+ BS_End();
+
+ FILLING_BEGIN();
+ 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;
+ }
+ 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;
+ }
+ FILLING_END();
+
+ //Descriptors
+ program_number_IsValid=true;
+ if (Descriptors_Size>0)
+ Descriptors();
+
+ Element_End(Ztring::ToZtring_From_CC2(program_number), 18+Descriptors_Size);
+ }
+
+ 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_Pos<dimensions_defined; dimension_Pos++)
+ {
+ Element_Begin("dimension");
+ Ztring dimension_name;
+ int8u values_defined;
+ Skip_B1( "dimension_name_length"); //Not used
+ ATSC_multiple_string_structure(dimension_name, "dimension_name"); Element_Info(dimension_name);
+ BS_Begin();
+ Skip_S1( 3, "reserved");
+ Skip_SB( "graduated_scale");
+ Get_S1 ( 4, values_defined, "values_defined");
+ BS_End();
+ for (int8u value_Pos=0; value_Pos<values_defined; value_Pos++)
+ {
+ Element_Begin("value");
+ Ztring abbrev_rating_value, rating_value;
+ Skip_B1( "abbrev_rating_value_length"); //Not used
+ ATSC_multiple_string_structure(abbrev_rating_value, "abbrev_rating_value"); Element_Info(abbrev_rating_value);
+ Skip_B1( "rating_value_length"); //Not used
+ ATSC_multiple_string_structure(rating_value, "rating_value"); Element_Info(rating_value);
+ Element_End();
+ }
+ Element_End();
+ }
+
+ BS_Begin();
+ Skip_S1( 6, "reserved");
+ Get_S2 (10, Descriptors_Size, "descriptors_length");
+ BS_End();
+
+ //Descriptors
+ if (Descriptors_Size>0)
+ 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; Pos<num_events_in_section; Pos++)
+ {
+ Ztring title;
+ int32u start_time, length_in_seconds;
+ Element_Begin();
+ BS_Begin();
+ Skip_SB( table_id==0xD9?"off_air":"reserved");
+ Skip_SB( "reserved");
+ Get_S2 (14, event_id, "event_id");
+ BS_End();
+ Get_B4 ( start_time, "start_time"); Param_Info(Ztring().Date_From_Seconds_1970(start_time+315964800)); Element_Info(Ztring().Date_From_Seconds_1970(start_time+315964800-Complete_Stream->GPS_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_End(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_Begin("ETM_id", 2);
+ Get_B2 ( source_id, "source_id");
+ BS_Begin();
+ Get_S2 (14, event_id, "event_id");
+ Skip_S1( 2, "lsb");
+ BS_End();
+ Element_End();
+ 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_Info(Ztring().Date_From_Seconds_1970(system_time+315964800)); //UTC 1980-01-06 00:00:00
+ Get_B1 (GPS_UTC_offset, "GPS_UTC_offset");
+ Element_Begin("daylight_savings", 2);
+ BS_Begin();
+ Skip_SB( "DS_status");
+ Mark_1();
+ Mark_1();
+ Skip_S1(5, "DS_day_of_month");
+ BS_End();
+ Skip_B1( "DS_hour");
+ Element_End();
+
+ //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; Pos<num_sources_in_section; Pos++)
+ {
+ Get_B2 (table_id_extension, "source_id");
+ Table_CB();
+ }
+ }
+ else
+ Skip_XX(Element_Size, "reserved");
+}
+
+//***************************************************************************
+// Helpers
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Mpeg_Psi::Descriptors()
+{
+ if (Descriptors_Size==0)
+ return;
+ if (Element_Offset+Descriptors_Size>Element_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
+ Element_Begin("Descriptors", Descriptors_Size);
+ Open_Buffer_Init(&Descriptors);
+ Open_Buffer_Continue(&Descriptors, Descriptors_Size);
+ Element_End();
+
+ //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* Info)
+{
+ //Parsing
+ Ztring string;
+ int8u number_strings, number_segments;
+ Element_Begin(Info);
+ Get_B1(number_strings, "number_strings");
+ for (int8u string_Pos=0; string_Pos<number_strings; string_Pos++)
+ {
+ Element_Begin("String");
+ int32u ISO_639_language_code;
+ Get_C3(ISO_639_language_code, "ISO_639_language_code");
+ Get_B1(number_segments, "number_segments");
+ for (int8u segment_Pos=0; segment_Pos<number_segments; segment_Pos++)
+ {
+ Element_Begin("Segment");
+ Ztring segment;
+ int8u compression_type, mode, number_bytes;
+ Get_B1 (compression_type, "compression_type");
+ Get_B1 (mode, "mode");
+ Get_B1 (number_bytes, "number_bytes");
+ switch (compression_type)
+ {
+ case 0x00 :
+ switch (mode)
+ {
+ case 0x00 : Get_Local(number_bytes, segment, "string"); break;
+ case 0x3F : Get_UTF16B(number_bytes, segment, "string"); break;
+ default : Skip_XX(number_bytes, "Unknown");
+ segment=_T("(Encoded with mode=0x")+Ztring::ToZtring(mode, 16)+_T(')');
+ }
+ break;
+ default : Skip_XX(number_bytes, "(Compressed)");
+ segment=_T("(Compressed)");
+ }
+ Element_End(3+number_bytes);
+
+ FILLING_BEGIN();
+ if (segment.find_first_not_of(_T("\t\n "))!=std::string::npos)
+ string+=segment+_T(" - ");
+ FILLING_END();
+ }
+
+ FILLING_BEGIN();
+ if (!string.empty())
+ string.resize(string.size()-3);
+ Ztring ISO_639_2=Ztring().From_CC3(ISO_639_language_code);
+ const Ztring& ISO_639_1=MediaInfoLib::Config.Iso639_1_Get(ISO_639_2);
+ Value+=(ISO_639_1.empty()?ISO_639_2:ISO_639_1)+_T(':')+string+_T(" - ");
+ FILLING_END();
+
+ Element_Info(string);
+ Element_End("String");
+ }
+
+ if (!Value.empty())
+ Value.resize(Value.size()-3);
+
+ Element_Info(Value);
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+//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
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_MPEGTS_YES
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Mpeg_Psi.h b/src/thirdparty/MediaInfo/Multiple/File_Mpeg_Psi.h
new file mode 100644
index 000000000..a01f40865
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Mpeg_Psi.h
@@ -0,0 +1,162 @@
+// File_Mpeg_Psi - Info for MPEG Stream files
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about MPEG files, Program Map Section
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_Mpeg_PsiH
+#define MediaInfo_Mpeg_PsiH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include "MediaInfo/Multiple/File_Mpeg_Descriptors.h"
+#include <map>
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+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 - Per element
+ 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() {Skip_XX(Element_Size-Element_Offset, "Data");};
+ void Table_C1() {Skip_XX(Element_Size-Element_Offset, "Data");};
+ 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();};
+
+ //Helpers
+ int16u Descriptors_Size;
+ void Descriptors();
+ void ATSC_multiple_string_structure(Ztring &Value, const char* Info);
+ Ztring Date_MJD(int16u Date);
+ Ztring Time_BCD(int32u Time);
+
+ //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;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Mxf.cpp b/src/thirdparty/MediaInfo/Multiple/File_Mxf.cpp
new file mode 100644
index 000000000..d7413a97a
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Mxf.cpp
@@ -0,0 +1,4135 @@
+// File_Mxf - Info for MXF files
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_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_MPEGA_YES)
+ #include "MediaInfo/Audio/File_Mpega.h"
+#endif
+#if defined(MEDIAINFO_JPEG_YES)
+ #include "MediaInfo/Image/File_Jpeg.h"
+#endif
+#include "MediaInfo/File_Unknown.h"
+#include "ZenLib/FileName.h"
+#include "MediaInfo/MediaInfo_Internal.h"
+//---------------------------------------------------------------------------
+
+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
+{
+ UUID(AES3PCMDescriptor, 060E2B34, 02530101, 0D010101, 01014700)
+ UUID(CDCIEssenceDescriptor, 060E2B34, 02530101, 0D010101, 01012800)
+ UUID(ClosedCompleteHeader, 060E2B34, 02050101, 0D010201, 01020400)
+ UUID(ClosedHeader, 060E2B34, 02050101, 0D010201, 01020200)
+ UUID(CompleteBody, 060E2B34, 02050101, 0D010201, 01030400)
+ UUID(CompleteFooter, 060E2B34, 02050101, 0D010201, 01040400)
+ UUID(CompleteHeader, 060E2B34, 02050101, 0D010201, 01020400)
+ UUID(ContentStorage, 060E2B34, 02530101, 0D010101, 01011800)
+ UUID(DMSegment, 060E2B34, 02530101, 0D010101, 01014100)
+ UUID(EssenceContainerData, 060E2B34, 02530101, 0D010101, 01012300)
+ UUID(EventTrack, 060E2B34, 02530101, 0D010101, 01013900)
+ UUID(GenericSoundEssenceDescriptor, 060E2B34, 02530101, 0D010101, 01014200)
+ UUID(Identification, 060E2B34, 02530101, 0D010101, 01013000)
+ UUID(IndexTableSegment, 060E2B34, 02530101, 0D010201, 01100100)
+ UUID(JPEG2000PictureSubDescriptor, 060E2B34, 02530101, 0D010101, 01015A00)
+ UUID(MaterialPackage, 060E2B34, 02530101, 0D010101, 01013600)
+ UUID(MPEG2VideoDescriptor, 060E2B34, 02530101, 0D010101, 01015100)
+ UUID(MultipleDescriptor, 060E2B34, 02530101, 0D010101, 01014400)
+ UUID(NetworkLocator, 060E2B34, 02530101, 0D010101, 01013200)
+ UUID(OpenCompleteBodyPartition, 060E2B34, 02050101, 0D010201, 01030300)
+ UUID(OpenHeader, 060E2B34, 02050101, 0D010201, 01020100)
+ UUID(Padding, 060E2B34, 01010101, 03010210, 01000000)
+ UUID(Preface, 060E2B34, 02530101, 0D010101, 01012F00)
+ UUID(RandomIndexMetadata, 060E2B34, 02050101, 0D010201, 01110100)
+ UUID(RGBAEssenceDescriptor, 060E2B34, 02530101, 0D010101, 01012900)
+ UUID(Primer, 060E2B34, 02050101, 0D010201, 01050100)
+ UUID(Sequence, 060E2B34, 02530101, 0D010101, 01010F00)
+ UUID(SourceClip, 060E2B34, 02530101, 0D010101, 01011100)
+ UUID(SourcePackage, 060E2B34, 02530101, 0D010101, 01013700)
+ UUID(StaticTrack, 060E2B34, 02530101, 0D010101, 01013A00)
+ UUID(TextLocator, 060E2B34, 02530101, 0D010101, 01013300)
+ UUID(TimecodeComponent, 060E2B34, 02530101, 0D010101, 01011400)
+ UUID(Track, 060E2B34, 02530101, 0D010101, 01013B00)
+ UUID(WaveAudioDescriptor, 060E2B34, 02530101, 0D010101, 01014800)
+
+ //OperationalPatterns
+ UUID(OP_MultiTrack, 060E2B34, 04010101, 0D010201, 01010900)
+ UUID(OP_SingleTrack, 060E2B34, 04010101, 0D010201, 01010100)
+ UUID(OP_SingleItem, 060E2B34, 04010101, 0D010201, 01020F00)
+
+ //EssenceContainer
+ UUID(EssenceContainer_DV, 060E2B34, 04010101, 0D010301, 02025001)
+ UUID(EssenceContainer_DV2, 060E2B34, 04010101, 0D010301, 02020101)
+ UUID(EssenceContainer_DV3, 060E2B34, 04010101, 0D010301, 02025002)
+ UUID(EssenceContainer_JPEG2000, 060E2B34, 04010107, 0D010301, 020C0100)
+ UUID(EssenceContainer_MPEG2, 060E2B34, 04010102, 0D010301, 02046001)
+ UUID(EssenceContainer_RV24, 060E2B34, 04010101, 0D010301, 02050001)
+ UUID(EssenceContainer_PCM, 060E2B34, 04010101, 0D010301, 02060100)
+ UUID(EssenceContainer_PCM2, 060E2B34, 04010101, 0D010301, 02060200)
+ UUID(EssenceContainer_PCM3, 060E2B34, 04010101, 0D010301, 02060300)
+ UUID(EssenceContainer_PCM4, 060E2B34, 04010101, 0D010301, 02060400)
+ UUID(EssenceContainer_Generic, 060E2B34, 04010103, 0D010301, 027F0100)
+
+ //MPEG2VideoDescriptor
+ 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)
+
+ //EssenceCoding
+ UUID(EssenceCoding_D10Video, 060E2B34, 04010101, 04010202, 01020101)
+ UUID(EssenceCoding_DV, 060E2B34, 04010101, 04010202, 02020200)
+ UUID(EssenceCoding_MPEG2Video, 060E2B34, 04010103, 04010202, 01040300) //To be confirmed
+ UUID(EssenceCoding_MPEG4Visual, 060E2B34, 04010103, 04010202, 01200204) //To be confirmed
+ UUID(EssenceCoding_Alaw, 060E2B34, 04010104, 04020202, 03010100) //To be confirmed
+ UUID(EssenceCoding_RV24, 060E2B34, 04010101, 04010201, 7F000000) //?
+ UUID(EssenceCoding_PCM, 060E2B34, 04010101, 04020201, 7F000000) //To be confirmed
+ UUID(EssenceCoding_JPEG2000, 060E2B34, 04010107, 04010202, 03010100) //To be confirmed
+ UUID(EssenceCoding_AVC, 060E2B34, 0401010A, 04010202, 01323102)
+
+ //Sequence
+ UUID(Sequence_Time, 060E2B34, 04010101, 01030201, 01000000)
+ UUID(Sequence_Picture, 060E2B34, 04010101, 01030202, 01000000)
+ UUID(Sequence_Sound, 060E2B34, 04010101, 01030202, 02000000)
+ UUID(Sequence_Data, 060E2B34, 04010101, 01030202, 03000000)
+}
+
+//---------------------------------------------------------------------------
+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_RegistryDesignator(int8u Category, int8u RegistryDesignator)
+{
+ switch(Category)
+ {
+ case 0x01 : //"Item"
+ switch(RegistryDesignator)
+ {
+ case 0x01 : return "Metadata dictionary";
+ case 0x02 : return "Essence dictionary";
+ default : return "";
+ }
+ case 0x02 : //"Group (Set/Pack)"
+ switch(RegistryDesignator)
+ {
+ case 0x05 : return "Contains a fixed number of predefined items with no tag of value indicators";
+ case 0x53 : return "The value of this KLV block contains other KLV-items with a two-byte tag and a two-byte length indicator";
+ default : return "";
+ }
+ case 0x04 : //"Value"
+ switch(RegistryDesignator)
+ {
+ case 0x01 : return "Fixed";
+ 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(int128u OperationalPattern)
+{
+ //int32u Code_Compare1=OperationalPattern.hi>>32;
+ //int32u Code_Compare2=(int32u)OperationalPattern.hi;
+ //int32u Code_Compare3=OperationalPattern.lo>>32;
+ int32u Code_Compare4=(int32u)OperationalPattern.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) \
+ return _NAME; \
+
+ if (0) {}
+ ELEMENT (OP_MultiTrack, "Multi-track")
+ ELEMENT (OP_SingleTrack, "Single-track")
+ ELEMENT (OP_SingleItem, "Single-item")
+ else
+ return "";
+ */
+
+ //Item and Package Complexity
+ 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 "";
+ }
+ default : return "";
+ }
+}
+
+//---------------------------------------------------------------------------
+const char* Mxf_EssenceContainer(int128u EssenceContainer)
+{
+ int32u Code_Compare1=EssenceContainer.hi>>32;
+ int32u Code_Compare2=(int32u)EssenceContainer.hi;
+ int32u Code_Compare3=EssenceContainer.lo>>32;
+ int32u Code_Compare4=(int32u)EssenceContainer.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) \
+ return _NAME; \
+
+ if (0) {}
+ ELEMENT (EssenceContainer_DV, "DV")
+ ELEMENT (EssenceContainer_DV2, "DV")
+ ELEMENT (EssenceContainer_DV3, "DV")
+ ELEMENT (EssenceContainer_JPEG2000, "JPEG 2000 Picture")
+ ELEMENT (EssenceContainer_MPEG2, "MPEG-2 Video")
+ ELEMENT (EssenceContainer_RV24, "RV24 (RGBA?)")
+ ELEMENT (EssenceContainer_PCM, "PCM")
+ ELEMENT (EssenceContainer_PCM2, "PCM")
+ ELEMENT (EssenceContainer_PCM3, "PCM")
+ ELEMENT (EssenceContainer_PCM4, "PCM")
+ ELEMENT (EssenceContainer_Generic, "Generic")
+ else
+ return "";
+}
+
+//---------------------------------------------------------------------------
+const char* Mxf_EssenceCoding(int128u EssenceContainer)
+{
+ int32u Code_Compare1=EssenceContainer.hi>>32;
+ int32u Code_Compare2=(int32u)EssenceContainer.hi;
+ int32u Code_Compare3=EssenceContainer.lo>>32;
+ int32u Code_Compare4=(int32u)EssenceContainer.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) \
+ return _NAME; \
+
+ if (0) {}
+ ELEMENT(EssenceCoding_D10Video, "D-10 Video")
+ ELEMENT(EssenceCoding_DV, "DV")
+ ELEMENT(EssenceCoding_PCM, "PCM")
+ ELEMENT(EssenceCoding_RV24, "RV24")
+ ELEMENT(EssenceCoding_MPEG2Video, "MPEG-2 Video")
+ ELEMENT(EssenceCoding_MPEG4Visual, "MPEG-4 Visual")
+ ELEMENT(EssenceCoding_Alaw, "A-law")
+ ELEMENT(EssenceCoding_JPEG2000, "JPEG 2000")
+ ELEMENT(EssenceCoding_AVC, "AVC")
+ else
+ return "";
+}
+
+//---------------------------------------------------------------------------
+const char* Mxf_EssenceCoding_Format(int128u EssenceContainer)
+{
+ int32u Code_Compare1=EssenceContainer.hi>>32;
+ int32u Code_Compare2=(int32u)EssenceContainer.hi;
+ int32u Code_Compare3=EssenceContainer.lo>>32;
+ int32u Code_Compare4=(int32u)EssenceContainer.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) \
+ return _NAME; \
+
+ if (0) {}
+ ELEMENT(EssenceCoding_D10Video, "MPEG Video")
+ ELEMENT(EssenceCoding_DV, "DV")
+ ELEMENT(EssenceCoding_JPEG2000, "M-JPEG 2000")
+ ELEMENT(EssenceCoding_MPEG2Video, "MPEG Video")
+ ELEMENT(EssenceCoding_MPEG4Visual, "MPEG-4 Visual")
+ ELEMENT(EssenceCoding_Alaw, "A-law")
+ ELEMENT(EssenceCoding_PCM, "PCM")
+ ELEMENT(EssenceCoding_RV24, "RV24")
+ ELEMENT(EssenceCoding_AVC, "AVC")
+ else
+ return "";
+}
+
+//---------------------------------------------------------------------------
+const char* Mxf_EssenceCoding_Format_Version(int128u EssenceContainer)
+{
+ int32u Code_Compare1=EssenceContainer.hi>>32;
+ int32u Code_Compare2=(int32u)EssenceContainer.hi;
+ int32u Code_Compare3=EssenceContainer.lo>>32;
+ int32u Code_Compare4=(int32u)EssenceContainer.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) \
+ return _NAME; \
+
+ if (0) {}
+ ELEMENT(EssenceCoding_D10Video, "Version 2")
+ ELEMENT(EssenceCoding_MPEG2Video, "Version 2")
+ else
+ return "";
+}
+
+//---------------------------------------------------------------------------
+const char* Mxf_Sequence_DataDefinition(int128u DataDefinition)
+{
+ int32u Code_Compare1=DataDefinition.hi>>32;
+ int32u Code_Compare2=(int32u)DataDefinition.hi;
+ int32u Code_Compare3=DataDefinition.lo>>32;
+ int32u Code_Compare4=(int32u)DataDefinition.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) \
+ return _NAME; \
+
+ if (0) {}
+ ELEMENT(Sequence_Time, "Time")
+ ELEMENT(Sequence_Picture, "Picture")
+ ELEMENT(Sequence_Sound, "Sound")
+ ELEMENT(Sequence_Data, "Data")
+ else
+ return "";
+}
+
+//---------------------------------------------------------------------------
+extern const char* Mpegv_profile_and_level_indication_profile[];
+extern const char* Mpegv_profile_and_level_indication_level[];
+
+//***************************************************************************
+// 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
+ MustSynchronize=true;
+ DataMustAlwaysBeComplete=false;
+
+ //Temp
+ Streams_Count=(size_t)-1;
+ OperationalPattern=0;
+ Buffer_DataSizeToParse=0;
+ Buffer_DataSizeToParse_Complete=(int64u)-1;
+ Preface_Current.hi=(int64u)-1;
+ Preface_Current.lo=(int64u)-1;
+ Track_Number_IsAvailable=false;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Mxf::Streams_Finish()
+{
+ if (!Track_Number_IsAvailable)
+ {
+ 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;
+
+ Streams_Finish_Preface(Preface_Current);
+
+ //OperationalPattern
+ Fill(Stream_General, 0, General_Format_Profile, Mxf_OperationalPattern(OperationalPattern));
+
+ //File size handling
+ if (File_Size_Total!=File_Size)
+ Fill(Stream_General, 0, General_FileSize, File_Size_Total, 10, true);
+
+ //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"))
+ {
+ Fill(Stream_General, 0, General_Format_Commercial_IfAny, "XDCAM IMX 30");
+ Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "XDCAM 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"))
+ {
+ Fill(Stream_General, 0, General_Format_Commercial_IfAny, "XDCAM IMX 40");
+ Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "XDCAM 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"))
+ {
+ Fill(Stream_General, 0, General_Format_Commercial_IfAny, "XDCAM IMX 50");
+ Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "XDCAM IMX 50");
+ }
+ 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"))
+ {
+ 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)!=_T("N=1") && Retrieve(Stream_Video, 0, Video_Colorimetry)==_T("4:2:0") && Retrieve(Stream_Video, 0, Video_BitRate)==_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)!=_T("N=1") && Retrieve(Stream_Video, 0, Video_Colorimetry)==_T("4:2:0") && Retrieve(Stream_Video, 0, Video_BitRate)==_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)!=_T("N=1") && Retrieve(Stream_Video, 0, Video_Colorimetry)==_T("4:2:2") && Retrieve(Stream_Video, 0, Video_BitRate)==_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_Preface (int128u PrefaceUID)
+{
+ prefaces::iterator Preface=Prefaces.find(PrefaceUID);
+ if (Preface==Prefaces.end())
+ return;
+
+ //ContentStorage
+ Streams_Finish_ContentStorage(Preface->second.ContentStorage);
+
+ //Identifications
+ for (size_t Pos=0; Pos<Preface->second.Identifications.size(); Pos++)
+ Streams_Finish_Identification(Preface->second.Identifications[Pos]);
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::Streams_Finish_ContentStorage (int128u ContentStorageUID)
+{
+ contentstorages::iterator ContentStorage=ContentStorages.find(ContentStorageUID);
+ if (ContentStorage==ContentStorages.end())
+ return;
+
+ for (size_t Pos=0; Pos<ContentStorage->second.Packages.size(); Pos++)
+ Streams_Finish_Package(ContentStorage->second.Packages[Pos]);
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::Streams_Finish_Package (int128u PackageUID)
+{
+ packages::iterator Package=Packages.find(PackageUID);
+ if (Package==Packages.end())
+ return;
+
+ for (size_t Pos=0; Pos<Package->second.Tracks.size(); Pos++)
+ Streams_Finish_Track(Package->second.Tracks[Pos]);
+
+ Streams_Finish_Descriptor(Package->second.Descriptor);
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::Streams_Finish_Track(int128u TrackUID)
+{
+ tracks::iterator Track=Tracks.find(TrackUID);
+ if (Track==Tracks.end() || Track->second.Stream_Finish_Done)
+ return;
+
+ Streams_Finish_Essence(Track->second.TrackNumber, TrackUID);
+
+ //Sequence
+ Streams_Finish_Component(Track->second.Sequence, Track->second.EditRate);
+
+ //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.Parser==NULL)
+ return;
+
+ Finish(Essence->second.Parser);
+ StreamKind_Last=Stream_Max;
+ if (Essence->second.Parser->Count_Get(Stream_Video))
+ Stream_Prepare(Stream_Video);
+ else if (Essence->second.Parser->Count_Get(Stream_Audio))
+ Stream_Prepare(Stream_Audio);
+ if (StreamKind_Last!=Stream_Max)
+ {
+ for (std::map<std::string, Ztring>::iterator Info=Essence->second.Infos.begin(); Info!=Essence->second.Infos.end(); Info++)
+ Fill(StreamKind_Last, StreamPos_Last, Info->first.c_str(), Info->second, true);
+ Merge(*Essence->second.Parser, StreamKind_Last, 0, StreamPos_Last);
+ }
+
+ if (Tracks[TrackUID].TrackID!=(int32u)-1)
+ Fill(StreamKind_Last, StreamPos_Last, General_ID, Tracks[TrackUID].TrackID);
+ else
+ {
+ Fill(StreamKind_Last, StreamPos_Last, General_ID, Essence->first);
+ Fill(StreamKind_Last, StreamPos_Last, General_ID_String, Ztring::ToZtring(Essence->first, 16), true);
+ }
+
+ //Interlacement management
+ if (StreamKind_Last==Stream_Video && Retrieve(Stream_Video, StreamPos_Last, Video_ScanType)==_T("Interlaced") && Retrieve(Stream_Video, StreamPos_Last, Video_Format)==_T("M-JPEG 2000"))
+ {
+ //M-JPEG 2000 has no complete frame height, but field height
+ int64u Height=Retrieve(Stream_Video, StreamPos_Last, Video_Height).To_int64u();
+ Height*=2; //This is per field
+ if (Height)
+ Fill(Stream_Video, StreamPos_Last, Video_Height, Height, 10, true);
+
+ //M-JPEG 2000 has no complete frame framerate, but field framerate
+ float64 FrameRate=Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate).To_float64();
+ FrameRate/=2; //This is per field
+ if (FrameRate)
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate, FrameRate, 3, true);
+ }
+
+ //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, Essence->second.Parser->Retrieve(Stream_General, 0, General_Recorded_Date));
+
+ //Video and Audio are together
+ size_t Audio_Count=Essence->second.Parser->Count_Get(Stream_Audio);
+ for (size_t Audio_Pos=0; Audio_Pos<Audio_Count; Audio_Pos++)
+ {
+ size_t StreamPos_Video=StreamPos_Last;
+ Fill_Flush();
+ Stream_Prepare(Stream_Audio);
+ size_t Pos=Count_Get(Stream_Audio)-1;
+ Essence->second.Parser->Finish();
+ Merge(*Essence->second.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, Video_Format), true);
+ else
+ Fill(Stream_Audio, Pos, Audio_MuxingMode, Retrieve(Stream_Video, Essence->second.StreamPos, Video_Format)+_T(" / ")+Retrieve(Stream_Audio, Pos, Audio_MuxingMode), true);
+ Fill(Stream_Audio, Pos, Audio_Duration, Retrieve(Stream_Video, Essence->second.StreamPos, Video_Duration));
+ Fill(Stream_Audio, Pos, "MuxingMode_MoreInfo", _T("Muxed in Video #")+Ztring().From_Number(StreamPos_Video+1));
+ Fill(Stream_Audio, Pos, Audio_StreamSize, "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);
+ }
+
+ StreamKind_Last=Stream_Video;
+ StreamPos_Last=Essence->second.StreamPos;
+ }
+ #endif
+
+ //Special case - MPEG Video + Captions
+ if (StreamKind_Last==Stream_Video && Essence->second.Parser && Essence->second.Parser->Count_Get(Stream_Text))
+ {
+ //Video and Text are together
+ size_t Text_Count=Essence->second.Parser->Count_Get(Stream_Text);
+ for (size_t Text_Pos=0; Text_Pos<Text_Count; Text_Pos++)
+ {
+ size_t StreamPos_Video=StreamPos_Last;
+ size_t Pos=Count_Get(Stream_Text)-Text_Count+Text_Pos;
+ Ztring MuxingMode=Retrieve(Stream_Text, Pos, "MuxingMode");
+ if (Retrieve(Stream_Text, Pos, Text_MuxingMode).empty())
+ Fill(Stream_Text, Pos, Text_MuxingMode, Retrieve(Stream_Video, Essence->second.StreamPos, Video_Format), true);
+ else
+ Fill(Stream_Text, Pos, Text_MuxingMode, Retrieve(Stream_Video, Essence->second.StreamPos, Video_Format)+_T(" / ")+Retrieve(Stream_Text, Pos, Text_MuxingMode), true);
+ if (!IsSub)
+ Fill(Stream_Text, Pos, "MuxingMode_MoreInfo", _T("Muxed in Video #")+Ztring().From_Number(StreamPos_Video+1));
+ Fill(Stream_Text, Pos, Text_StreamSize, 0);
+ Ztring ID=Retrieve(Stream_Text, Pos, Text_ID);
+ Fill(Stream_Text, Pos, Text_ID, Retrieve(Stream_Video, StreamPos_Last, Video_ID)+_T("-")+ID, true);
+ Fill(Stream_Text, Pos, Text_ID_String, Retrieve(Stream_Video, StreamPos_Last, Video_ID_String)+_T("-")+ID, true);
+ Fill(Stream_Text, Pos, Text_Delay, Retrieve(Stream_Video, StreamPos_Last, Video_Delay), true);
+ Fill(Stream_Text, Pos, Text_ID, Retrieve(Stream_Video, Count_Get(Stream_Video)-1, Video_ID)+_T("-")+Retrieve(Stream_Text, Pos, Text_ID), true);
+ }
+ }
+
+ //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(int128u DescriptorUID)
+{
+ descriptors::iterator Descriptor=Descriptors.find(DescriptorUID);
+ if (Descriptor==Descriptors.end())
+ return;
+
+ //Subs
+ if (!Descriptor->second.SubDescriptors.empty())
+ {
+ for (size_t Pos=0; Pos<Descriptor->second.SubDescriptors.size(); Pos++)
+ Streams_Finish_Descriptor(Descriptor->second.SubDescriptors[Pos]);
+ return; //Is not a real descriptor
+ }
+
+ StreamKind_Last=Stream_Max;
+ StreamPos_Last=(size_t)-1;
+ if (Descriptor->second.StreamKind!=Stream_Max)
+ {
+ StreamKind_Last=Descriptor->second.StreamKind;
+ for (size_t Pos=0; Pos<Count_Get(StreamKind_Last); Pos++)
+ if (Ztring::ToZtring(Descriptor->second.LinkedTrackID)==Retrieve(StreamKind_Last, Pos, General_ID))
+ {
+ StreamPos_Last=Pos;
+ break;
+ }
+ if (StreamPos_Last==(size_t)-1)
+ {
+ if (Count_Get(Stream_Video)+Count_Get(Stream_Audio)==1)
+ StreamPos_Last=0;
+ }
+ }
+
+ //Locators
+ size_t Before_Count[Stream_Max];
+ for (size_t Pos=0; Pos<Stream_Max; Pos++)
+ Before_Count[Pos]=(size_t)-1;
+ Before_Count[Stream_Video]=Count_Get(Stream_Video);
+ Before_Count[Stream_Audio]=Count_Get(Stream_Audio);
+ Before_Count[Stream_Text]=Count_Get(Stream_Text);
+ for (size_t Locator_Pos=0; Locator_Pos<Descriptor->second.Locators.size(); Locator_Pos++)
+ {
+ //Locator
+ Streams_Finish_Locator(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)
+ {
+ //ID
+ if (Descriptor->second.LinkedTrackID!=(int32u)-1 && Retrieve(StreamKind_Last, StreamPos_Last, General_ID).empty())
+ {
+ for (size_t StreamKind=0; StreamKind<Stream_Max; StreamKind++)
+ for (size_t StreamPos=Before_Count[StreamKind]; StreamPos<Count_Get((stream_t)StreamKind); StreamPos++)
+ {
+ Ztring ID=Retrieve((stream_t)StreamKind, StreamPos, General_ID);
+ if (ID.empty())
+ Fill((stream_t)StreamKind, StreamPos, General_ID, Descriptor->second.LinkedTrackID);
+ 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.Height!=(int32u)-1 && Retrieve(Stream_Video, StreamPos_Last, Video_Height).empty())
+ Fill(Stream_Video, StreamPos_Last, Video_Height, Descriptor->second.Height, 10, true);
+ for (std::map<std::string, Ztring>::iterator Info=Descriptor->second.Infos.begin(); Info!=Descriptor->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, true);
+
+ //Bitrate (PCM)
+ 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_Resolution).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));
+ }
+
+ //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);
+ }
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::Streams_Finish_Locator(int128u LocatorUID)
+{
+ locators::iterator Locator=Locators.find(LocatorUID);
+ if (Locator==Locators.end())
+ return;
+
+ //External file name specific
+ if (!Locator->second.EssenceLocator.empty())
+ {
+ //Preparing
+ stream_t StreamKind_Last_Essence=StreamKind_Last;
+ size_t StreamPos_Last_Essence=StreamPos_Last;
+
+ //Configuring file name
+ Ztring AbsoluteName=ZenLib::FileName::Path_Get(File_Name);
+ if (!AbsoluteName.empty())
+ AbsoluteName+=ZenLib::PathSeparator;
+ AbsoluteName+=Locator->second.EssenceLocator;
+
+ MediaInfo_Internal MI;
+ MI.Option(_T("File_StopAfterFilled"), _T("1"));
+ MI.Option(_T("File_KeepInfo"), _T("1"));
+ Fill(StreamKind_Last_Essence, StreamPos_Last_Essence, "Source", Locator->second.EssenceLocator);
+
+ if (MI.Open(AbsoluteName))
+ {
+ //Hacks - Before
+ Ztring CodecID=Retrieve(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_CodecID));
+
+ Merge(*(MI.Info));
+ File_Size_Total+=Ztring(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);
+ }
+
+ //Special case: MXF in MXF
+ if (MI.Info && MI.Info->Get(Stream_General, 0, General_Format)==_T("MXF"))
+ {
+ if (MI.Info->Count_Get(Stream_Video)==1)
+ {
+ Fill(Stream_Video, Count_Get(Stream_Video)-1, "MuxingMode", "MXF");
+ StreamKind_Last=Stream_Video;
+ StreamPos_Last=Count_Get(Stream_Video)-1;
+ }
+ else if (MI.Info->Count_Get(Stream_Audio)==1)
+ Fill(Stream_Audio, Count_Get(Stream_Audio)-1, "MuxingMode", "MXF");
+ }
+ if (MI.Info && MI.Info->Get(Stream_General, 0, General_Format)==_T("MXF") && MI.Info->Count_Get(Stream_Video)>0)
+ {
+ size_t Audio_Count=MI.Info->Count_Get(Stream_Audio);
+ for (size_t Audio_Pos=0; Audio_Pos<Audio_Count; Audio_Pos++)
+ {
+ size_t Pos=Count_Get(Stream_Audio)-1-Audio_Pos;
+ if (Retrieve(Stream_Audio, Pos, Audio_MuxingMode).empty())
+ Fill(Stream_Audio, Pos, Audio_MuxingMode, "MXF");
+ else
+ Fill(Stream_Audio, Pos, Audio_MuxingMode, _T("MXF / ")+Retrieve(Stream_Audio, Pos, Audio_MuxingMode), true);
+ Fill(Stream_Audio, Pos, "Source", Retrieve(Stream_Video, Count_Get(Stream_Video)-1, "Source"));
+ Fill(Stream_Audio, Pos, "Source_Info", Retrieve(Stream_Video, Count_Get(Stream_Video)-1, "Source_Info"));
+ }
+ size_t Text_Count=MI.Info->Count_Get(Stream_Text);
+ for (size_t Text_Pos=0; Text_Pos<Text_Count; Text_Pos++)
+ {
+ size_t Pos=Count_Get(Stream_Text)-1-Text_Pos;
+ if (Retrieve(Stream_Text, Pos, Text_MuxingMode).empty())
+ Fill(Stream_Text, Pos, Text_MuxingMode, "MXF");
+ else
+ Fill(Stream_Text, Pos, Text_MuxingMode, _T("MXF / ")+Retrieve(Stream_Text, Pos, Text_MuxingMode), true);
+ Fill(Stream_Text, Pos, "Source", Retrieve(Stream_Video, Count_Get(Stream_Video)-1, "Source"));
+ Fill(Stream_Text, Pos, "Source_Info", Retrieve(Stream_Video, Count_Get(Stream_Video)-1, "Source_Info"));
+ }
+ }
+ //Special case: DV with Audio or/and Text in the video stream
+ else if (MI.Info && MI.Info->Get(Stream_General, 0, General_Format)==_T("DV") && (MI.Info->Count_Get(Stream_Audio) || MI.Info->Count_Get(Stream_Text)))
+ {
+ StreamKind_Last=Stream_Video;
+ StreamPos_Last=Count_Get(Stream_Video)-1;
+
+ //Video and Audio are together
+ size_t Audio_Count=MI.Info->Count_Get(Stream_Audio);
+ for (size_t Audio_Pos=0; Audio_Pos<Audio_Count; Audio_Pos++)
+ {
+ size_t StreamPos_Video=StreamPos_Last;
+ size_t Pos=Count_Get(Stream_Audio)-1-Audio_Pos;
+ if (Retrieve(Stream_Audio, Pos, Audio_MuxingMode).empty())
+ Fill(Stream_Audio, Pos, Audio_MuxingMode, Retrieve(Stream_Video, Count_Get(Stream_Video)-1, Video_Format), true);
+ else
+ Fill(Stream_Audio, Pos, Audio_MuxingMode, Retrieve(Stream_Video, Count_Get(Stream_Video)-1, Video_Format)+_T(" / ")+Retrieve(Stream_Audio, Pos, Audio_MuxingMode), true);
+ Fill(Stream_Audio, Pos, Audio_MuxingMode_MoreInfo, _T("Muxed in Video #")+Ztring().From_Number(StreamPos_Video+1), true);
+ Fill(Stream_Audio, Pos, Audio_Duration, Retrieve(Stream_Video, Count_Get(Stream_Video)-1, Video_Duration), true);
+ Fill(Stream_Audio, Pos, "Source", Retrieve(Stream_Video, Count_Get(Stream_Video)-1, "Source"));
+ Fill(Stream_Audio, Pos, "Source_Info", Retrieve(Stream_Video, Count_Get(Stream_Video)-1, "Source_Info"));
+ Ztring ID=Retrieve(Stream_Audio, Pos, Audio_ID);
+ Ztring A=Retrieve(Stream_Video, Count_Get(Stream_Video)-1, Video_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);
+ }
+
+ //Video and Text are together
+ size_t Text_Count=MI.Info->Count_Get(Stream_Text);
+ for (size_t Text_Pos=0; Text_Pos<Text_Count; Text_Pos++)
+ {
+ size_t StreamPos_Video=StreamPos_Last;
+ size_t Pos=Count_Get(Stream_Text)-1-Text_Pos;
+ if (Retrieve(Stream_Text, Pos, Text_MuxingMode).empty())
+ Fill(Stream_Text, Pos, Text_MuxingMode, Retrieve(Stream_Video, Count_Get(Stream_Video)-1, Video_Format), true);
+ else
+ Fill(Stream_Text, Pos, Text_MuxingMode, Retrieve(Stream_Video, Count_Get(Stream_Video)-1, Video_Format)+_T(" / ")+Retrieve(Stream_Text, Pos, Text_MuxingMode), true);
+ Fill(Stream_Text, Pos, Text_MuxingMode_MoreInfo, _T("Muxed in Video #")+Ztring().From_Number(StreamPos_Video+1), true);
+ Fill(Stream_Text, Pos, Text_Duration, Retrieve(Stream_Video, Count_Get(Stream_Video)-1, Video_Duration), true);
+ Fill(Stream_Text, Pos, "Source", Retrieve(Stream_Video, Count_Get(Stream_Video)-1, "Source"));
+ Fill(Stream_Text, Pos, "Source_Info", Retrieve(Stream_Video, Count_Get(Stream_Video)-1, "Source_Info"));
+ Ztring ID=Retrieve(Stream_Text, Pos, Text_ID);
+ Fill(Stream_Text, Pos, Text_ID, Retrieve(Stream_Video, Count_Get(Stream_Video)-1, Video_ID)+_T("-")+ID, true);
+ Fill(Stream_Text, Pos, Text_ID_String, Retrieve(Stream_Video, Count_Get(Stream_Video)-1, Video_ID_String)+_T("-")+ID, true);
+ }
+ }
+ }
+ else
+ Fill(StreamKind_Last, StreamPos_Last, "Source_Info", "Missing");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::Streams_Finish_Component(int128u ComponentUID, float32 EditRate)
+{
+ components::iterator Component=Components.find(ComponentUID);
+ if (Component==Components.end())
+ return;
+
+ //Duration
+ if (EditRate && StreamKind_Last!=Stream_Max)
+ Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Duration), Component->second.Duration*1000/EditRate, 0, true);
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::Streams_Finish_Identification (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<std::string, Ztring>::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_Continue()
+{
+ if (Buffer_DataSizeToParse)
+ {
+ if (Buffer_Size<=Buffer_DataSizeToParse)
+ {
+ Element_Size=Buffer_Size; //All the buffer is used
+ Buffer_DataSizeToParse-=Buffer_Size;
+ }
+ else
+ {
+ Element_Size=Buffer_DataSizeToParse;
+ Buffer_DataSizeToParse=0;
+ }
+
+ Element_Begin();
+ Data_Parse();
+ Element_Offset=Element_Size;
+ Element_End();
+ }
+}
+
+//***************************************************************************
+// Buffer - File header
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Mxf::FileHeader_Begin()
+{
+ return true;
+}
+
+//***************************************************************************
+// Buffer - Synchro
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Mxf::Synchronize()
+{
+ //Synchronizing
+ while (Buffer_Offset+4<=Buffer_Size
+ && CC4(Buffer+Buffer_Offset)!=0x060E2B34)
+ Buffer_Offset++;
+
+ //Parsing last bytes if needed
+ if (Buffer_Offset+4>Buffer_Size)
+ {
+ if (Buffer_Offset+4==Buffer_Size && CC4(Buffer+Buffer_Offset)!=0x060E2B34)
+ Buffer_Offset++;
+ 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");
+ }
+
+ //Synched is OK
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool File_Mxf::Synched_Test()
+{
+ //Trailing 0x00
+ while(Buffer_Offset+1<=Buffer_Size && Buffer[Buffer_Offset]==0x00)
+ Buffer_Offset++;
+
+ //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;
+ Trusted++;
+ }
+
+ //Quick search
+ if (!Synched && !Synchronize())
+ return false;
+
+ //We continue
+ return true;
+}
+
+//***************************************************************************
+// Buffer - Per element
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Mxf::Header_Parse()
+{
+ //Parsing
+ int8u Length;
+ Get_UL(Code, "Code", NULL);
+ Get_B1(Length, "Length");
+ int64u Length_Final;
+ if (Length<0x80)
+ {
+ Length_Final=Length;
+ }
+ else
+ {
+ Length&=0x7F;
+ switch (Length)
+ {
+ case 1 :
+ {
+ int8u Length1;
+ Get_B1(Length1, "Length");
+ Length_Final=Length1;
+ }
+ break;
+ case 2 :
+ {
+ int16u Length2;
+ Get_B2(Length2, "Length");
+ Length_Final=Length2;
+ }
+ break;
+ case 3 :
+ {
+ int32u Length3;
+ Get_B3(Length3, "Length");
+ Length_Final=Length3;
+ }
+ break;
+ case 4 :
+ {
+ int32u Length4;
+ Get_B4(Length4, "Length");
+ Length_Final=Length4;
+ }
+ break;
+ case 5 :
+ {
+ int64u Length5;
+ Get_B5(Length5, "Length");
+ Length_Final=Length5;
+ }
+ break;
+ case 6 :
+ {
+ int64u Length6;
+ Get_B6(Length6, "Length");
+ Length_Final=Length6;
+ }
+ break;
+ case 7 :
+ {
+ int64u Length7;
+ Get_B7(Length7, "Length");
+ Length_Final=Length7;
+ }
+ break;
+ case 8 :
+ {
+ int64u Length8;
+ Get_B8(Length8, "Length");
+ Length_Final=Length8;
+ }
+ break;
+ default: Length_Final=0; //Problem
+ }
+ }
+
+ //Filling
+ if (Buffer_Offset+Length_Final>(size_t)-1 || Buffer_Offset+(size_t)Length_Final>Buffer_Size)
+ {
+ int32u Code_Compare1=Code.hi>>32;
+ int32u Code_Compare2=(int32u)Code.hi;
+ int32u Code_Compare3=Code.lo>>32;
+ if (Code_Compare1==0x060E2B34
+ && Code_Compare2==0x01020101
+ && Code_Compare3==0x0D010301)
+ {
+ Buffer_DataSizeToParse_Complete=Length_Final;
+ Length_Final=Buffer_Size-(Buffer_Offset+Element_Offset);
+ Buffer_DataSizeToParse=Buffer_DataSizeToParse_Complete-Length_Final;
+ }
+ else
+ {
+ Element_WaitForMoreData();
+ return;
+ }
+ }
+ Header_Fill_Code(0, Ztring::ToZtring(Code.hi, 16)+Ztring::ToZtring(Code.lo, 16));
+ Header_Fill_Size(Element_Offset+Length_Final);
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::Data_Parse()
+{
+ //Clearing
+ InstanceUID=0;
+
+ //Parsing
+ int32u Code_Compare1=Code.hi>>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()) \
+ { \
+ Element_WaitForMoreData(); \
+ return; \
+ } \
+ Element_Name(_NAME); \
+ switch (Code_Compare2>>24) \
+ { \
+ case 0x01 : _ELEMENT(); break; \
+ case 0x02 : switch ((int8u)(Code_Compare2>>16)) \
+ { \
+ case 0x05 : _ELEMENT(); break; \
+ case 0x53 : \
+ while(Element_Offset<Element_Size) \
+ { \
+ Element_Begin(); \
+ Element_Begin("Header"); \
+ Get_B2 (Code2, "Code"); \
+ Get_B2 (Length2, "Length"); \
+ Element_End(); \
+ Element_Name(Ztring().From_CC2(Code2)); \
+ \
+ int64u End=Element_Offset+Length2; \
+ _ELEMENT(); \
+ if (Element_Offset<End) \
+ Skip_XX(End-Element_Offset, "Unknown"); \
+ \
+ Element_End(4+Length2); \
+ } \
+ break; \
+ default : Skip_XX(Element_Size, "Unknown"); \
+ } \
+ } \
+ } \
+
+
+ if (0) {}
+ ELEMENT(AES3PCMDescriptor, "AES3 Descriptor")
+ ELEMENT(CDCIEssenceDescriptor, "CDCI Essence Descriptor")
+ ELEMENT(ClosedHeader, "Closed Header Partition Pack")
+ ELEMENT(ClosedCompleteHeader, "Closed Complete Header Partition Pack")
+ ELEMENT(CompleteBody, "CompleteBody")
+ ELEMENT(CompleteFooter, "CompleteFooter")
+ ELEMENT(CompleteHeader, "CompleteHeader")
+ ELEMENT(ContentStorage, "Content Storage")
+ ELEMENT(DMSegment, "Descriptive Metadata Segment")
+ ELEMENT(EssenceContainerData, "Essence Container Data")
+ ELEMENT(EventTrack, "Event track")
+ ELEMENT(GenericSoundEssenceDescriptor, "Generic Sound Essence Descriptor")
+ ELEMENT(Identification, "Identification")
+ ELEMENT(IndexTableSegment, "Index Table (Segment)")
+ ELEMENT(JPEG2000PictureSubDescriptor, "JPEG 2000 Picture Sub Descriptor")
+ ELEMENT(MaterialPackage, "Material Package")
+ ELEMENT(MultipleDescriptor, "Multiple Descriptor")
+ ELEMENT(MPEG2VideoDescriptor, "MPEG-2 Video Descriptor")
+ ELEMENT(NetworkLocator, "Network Locator")
+ ELEMENT(OpenCompleteBodyPartition, "OpenCompleteBodyPartition")
+ ELEMENT(OpenHeader, "OpenHeader")
+ ELEMENT(Preface, "Preface")
+ ELEMENT(Padding, "Padding")
+ ELEMENT(Primer, "Primer")
+ ELEMENT(RGBAEssenceDescriptor, "RGBA Essence Descriptor")
+ ELEMENT(RandomIndexMetadata, "Random Index Metadata")
+ ELEMENT(Sequence, "Sequence")
+ ELEMENT(SourceClip, "Source Clip")
+ ELEMENT(SourcePackage, "Source Package")
+ ELEMENT(StaticTrack, "Static Track")
+ ELEMENT(TextLocator, "Text Locator")
+ ELEMENT(TimecodeComponent, "Timecode Component")
+ ELEMENT(Track, "Track")
+ ELEMENT(WaveAudioDescriptor, "Wave Audio Descriptor")
+ else if (Code_Compare1==0x060E2B34
+ && Code_Compare2==0x01020101
+ && Code_Compare3==0x0D010301)
+ {
+ switch (Code_Compare4&0xFF00FF00)
+ {
+ case 0x14000100 : Element_Name("Generic" ); break;
+ case 0x05000100 : Element_Name("D-10 Video" ); break;
+ case 0x15000500 : Element_Name("MPEG Video" ); break;
+ case 0x15000800 : Element_Name("JPEG 2000" ); break;
+ case 0x06001000 : Element_Name("D-10 Audio" ); break;
+ case 0x15000100 : Element_Name("RV24" ); break;
+ case 0x15000600 : Element_Name("AVC" ); break;
+ case 0x15000700 : Element_Name("MPEG-4 Visual" ); break;
+ case 0x16000100 : Element_Name("BWF (PCM)" ); break;
+ case 0x16000200 : Element_Name("BWF (PCM)" ); break;
+ case 0x16000300 : Element_Name("DV Audio (PCM)" ); break;
+ case 0x16000400 : Element_Name("BWF (PCM)" ); break;
+ case 0x16000500 : Element_Name("MPEG Audio" ); break;
+ case 0x16000A00 : Element_Name("A-law" ); break;
+ case 0x18000100 : Element_Name("DV" ); break;
+ case 0x18000200 : Element_Name("DV" ); break; //One block
+ default : Element_Name("Unknown stream" );
+ }
+
+ #if MEDIAINFO_DEMUX
+ if (!Essences[Code_Compare4].TrackID_WasLookedFor)
+ {
+ for (tracks::iterator Track=Tracks.begin(); Track!=Tracks.end(); Track++)
+ if (Track->second.TrackNumber==Code_Compare4)
+ Essences[Code_Compare4].TrackID=Track->second.TrackID;
+ Essences[Code_Compare4].TrackID_WasLookedFor=true;
+ }
+ if (Essences[Code_Compare4].TrackID!=(int32u)-1)
+ Element_Code=Essences[Code_Compare4].TrackID;
+ else
+ Element_Code=Code.lo;
+ #endif MEDIAINFO_DEMUX
+
+ if (Essences[Code_Compare4].Parser==NULL)
+ {
+ switch (Code_Compare4&0xFF00FF00)
+ {
+ case 0x05000100 : //D-10 Video
+ case 0x15000500 : //MPEG Video
+ Essences[Code_Compare4].StreamKind=Stream_Video;
+ Essences[Code_Compare4].StreamPos=Code_Compare4&0x000000FF;
+ #if defined(MEDIAINFO_MPEGV_YES)
+ Essences[Code_Compare4].Parser=new File_Mpegv();
+ #else
+ Essences[Code_Compare4].Parser=new File_Unknown();
+ Open_Buffer_Init(Essences[Code_Compare4].Parser);
+ Essences[Code_Compare4].Parser->Stream_Prepare(Stream_Video);
+ Essences[Code_Compare4].Parser->Fill(Stream_Video, 0, Video_Format, "MPEG Video");
+ if (Streams_Count>0)
+ Streams_Count--;
+ #endif
+ break;
+ case 0x15000100 : //RV24
+ Essences[Code_Compare4].StreamKind=Stream_Video;
+ Essences[Code_Compare4].StreamPos=Code_Compare4&0x000000FF;
+ Essences[Code_Compare4].Parser=new File_Unknown();
+ Open_Buffer_Init(Essences[Code_Compare4].Parser);
+ Essences[Code_Compare4].Parser->Stream_Prepare(Stream_Video);
+ Essences[Code_Compare4].Parser->Fill(Stream_Video, 0, Video_Format, "RV24");
+ if (Streams_Count>0)
+ Streams_Count--;
+ break;
+ case 0x15000600 : //AVC
+ Essences[Code_Compare4].StreamKind=Stream_Video;
+ Essences[Code_Compare4].StreamPos=Code_Compare4&0x000000FF;
+ #if defined(MEDIAINFO_AVC_YES)
+ Essences[Code_Compare4].Parser=new File_Avc();
+ #else
+ Essences[Code_Compare4].Parser=new File_Unknown();
+ Open_Buffer_Init(Essences[Code_Compare4].Parser);
+ Essences[Code_Compare4].Parser->Stream_Prepare(Stream_Video);
+ Essences[Code_Compare4].Parser->Fill(Stream_Video, 0, Video_Format, "AVC");
+ if (Streams_Count>0)
+ Streams_Count--;
+ #endif
+ break;
+ case 0x15000700 : //MPEG-4 Visual
+ Essences[Code_Compare4].StreamKind=Stream_Video;
+ Essences[Code_Compare4].StreamPos=Code_Compare4&0x000000FF;
+ #if defined(MEDIAINFO_MPEG4V_YES)
+ Essences[Code_Compare4].Parser=new File_Mpeg4v();
+ #else
+ Essences[Code_Compare4].Parser=new File_Unknown();
+ Open_Buffer_Init(Essences[Code_Compare4].Parser);
+ Essences[Code_Compare4].Parser->Stream_Prepare(Stream_Video);
+ Essences[Code_Compare4].Parser->Fill(Stream_Video, 0, Video_Format, "MPEG-4 Visual");
+ if (Streams_Count>0)
+ Streams_Count--;
+ #endif
+ break;
+ case 0x15000800 : //M-JPEG 2000
+ Essences[Code_Compare4].StreamKind=Stream_Video;
+ Essences[Code_Compare4].StreamPos=Code_Compare4&0x000000FF;
+ #if defined(MEDIAINFO_JPEG_YES)
+ Essences[Code_Compare4].Parser=new File_Jpeg();
+ ((File_Jpeg*)Essences[Code_Compare4].Parser)->StreamKind=Stream_Video;
+ #else
+ Essences[Code_Compare4].Parser=new File_Unknown();
+ Open_Buffer_Init(Essences[Code_Compare4].Parser);
+ Essences[Code_Compare4].Parser->Stream_Prepare(Stream_Video);
+ Essences[Code_Compare4].Parser->Fill(Stream_Video, 0, Video_Format, "M-JPEG 2000");
+ if (Streams_Count>0)
+ Streams_Count--;
+ #endif
+ break;
+ case 0x06001000 : //D-10 Audio
+ case 0x16000100 : //BWF (PCM)
+ case 0x16000200 : //BWF (PCM)
+ case 0x16000300 : //DV Audio (PCM)
+ case 0x16000400 : //P2 Audio (PCM)
+ Essences[Code_Compare4].StreamKind=Stream_Audio;
+ Essences[Code_Compare4].StreamPos=Code_Compare4&0x000000FF;
+ Essences[Code_Compare4].Parser=new File_Unknown();
+ Open_Buffer_Init(Essences[Code_Compare4].Parser);
+ Essences[Code_Compare4].Parser->Stream_Prepare(Stream_Audio);
+ Essences[Code_Compare4].Parser->Fill(Stream_Audio, 0, Audio_Format, "PCM");
+ if (Streams_Count>0)
+ Streams_Count--;
+ break;
+ case 0x16000500 : //MPEG Audio
+ Essences[Code_Compare4].StreamKind=Stream_Audio;
+ Essences[Code_Compare4].StreamPos=Code_Compare4&0x000000FF;
+ #if defined(MEDIAINFO_MPEGA_YES)
+ Essences[Code_Compare4].Parser=new File_Mpega();
+ #else
+ Essences[Code_Compare4].Parser=new File_Unknown();
+ Open_Buffer_Init(Essences[Code_Compare4].Parser);
+ Essences[Code_Compare4].Parser->Stream_Prepare(Stream_Audio);
+ Essences[Code_Compare4].Parser->Fill(Stream_Audio, 0, Audio_Format, "MPEG Audio");
+ if (Streams_Count>0)
+ Streams_Count--;
+ #endif
+ break;
+ case 0x16000A00 : //A-law
+ Essences[Code_Compare4].StreamKind=Stream_Audio;
+ Essences[Code_Compare4].StreamPos=Code_Compare4&0x000000FF;
+ Essences[Code_Compare4].Parser=new File_Unknown();
+ Open_Buffer_Init(Essences[Code_Compare4].Parser);
+ Essences[Code_Compare4].Parser->Stream_Prepare(Stream_Audio);
+ Essences[Code_Compare4].Parser->Fill(Stream_Audio, 0, Audio_Format, "A-law");
+ if (Streams_Count>0)
+ Streams_Count--;
+ break;
+ case 0x18000100 : //DV
+ case 0x18000200 : //DV
+ Essences[Code_Compare4].StreamKind=Stream_Video;
+ Essences[Code_Compare4].StreamPos=Code_Compare4&0x000000FF;
+ #if defined(MEDIAINFO_DVDIF_YES)
+ Essences[Code_Compare4].Parser=new File_DvDif();
+ //Bitrate is precise
+ if (Element_Size==144000)
+ Essences[Code_Compare4].Infos["BitRate"].From_Number( 28800000);
+ if (Element_Size==288000)
+ Essences[Code_Compare4].Infos["BitRate"].From_Number( 57600000);
+ if (Element_Size==576000)
+ Essences[Code_Compare4].Infos["BitRate"].From_Number(115200000);
+ #else
+ Essences[Code_Compare4].Parser=new File_Unknown();
+ Open_Buffer_Init(Essences[Code_Compare4].Parser);
+ Essences[Code_Compare4].Parser->Stream_Prepare(Stream_Video);
+ Essences[Code_Compare4].Parser->Fill(Stream_Video, 0, Video_Format, "DV");
+ if (Streams_Count>0)
+ Streams_Count--;
+ #endif
+ break;
+ default : Essences[Code_Compare4].Parser=new File__Analyze();
+ }
+ Open_Buffer_Init(Essences[Code_Compare4].Parser);
+
+ //Stream size is sometime easy to find
+ if ((Buffer_DataSizeToParse_Complete==(int64u)-1?Element_Size:Buffer_DataSizeToParse_Complete)>=File_Size*0.98) //let imagine: if element size is 98% of file size, this is the only one element in the file
+ Essences[Code_Compare4].Stream_Size=(Buffer_DataSizeToParse_Complete==(int64u)-1?Element_Size:Buffer_DataSizeToParse_Complete);
+ }
+
+ //Demux
+ Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream);
+
+ if (!(Essences[Code_Compare4].Parser->Status[IsFinished] || Essences[Code_Compare4].Parser->Status[IsFilled]))
+ {
+ //Parsing
+ Open_Buffer_Continue(Essences[Code_Compare4].Parser);
+
+ //Disabling this Streams
+ if (Essences[Code_Compare4].Parser->Status[IsFinished] || Essences[Code_Compare4].Parser->Status[IsFilled])
+ {
+ if (Streams_Count>0)
+ Streams_Count--;
+ }
+ }
+ else
+ Skip_XX(Element_Size, "Data");
+ }
+ else
+ Skip_XX(Element_Size, "Unknown");
+
+ if (File_Offset>=0x4000000 //TODO: 64 MB by default (security), should be changed
+ || (Streams_Count==0 && !Descriptors.empty()))
+ Finish();
+}
+
+//***************************************************************************
+// 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()
+{
+ 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();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::ClosedCompleteHeader()
+{
+ //Parsing
+ PartitionMetadata();
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::ClosedHeader()
+{
+ //Parsing
+ PartitionMetadata();
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::CompleteBody()
+{
+ //Parsing
+ PartitionMetadata();
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::CompleteFooter()
+{
+ //Parsing
+ PartitionMetadata();
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::CompleteHeader()
+{
+ //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_Info("Valid from Preface");
+ Element_Level++;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::DMSegment()
+{
+ switch(Code2)
+ {
+ 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()
+{
+ switch(Code2)
+ {
+ ELEMENT(3F05, IndexTableSegment_EditUnitByteCount, "EditUnitByteCount")
+ ELEMENT(3F06, IndexTableSegment_IndexSID, "IndexSID")
+ ELEMENT(3F07, IndexTableSegment_BodySID, "BodySID")
+ ELEMENT(3F08, IndexTableSegment_SliceCount, "SliceCount")
+ ELEMENT(3F0B, IndexTableSegment_IndexEditRate, "IndexEditRate")
+ ELEMENT(3F0C, IndexTableSegment_IndexStartPosition, "IndexStartPosition")
+ ELEMENT(3F0D, IndexTableSegment_IndexDuration, "IndexDuration")
+ ELEMENT(3F0E, IndexTableSegment_PosTableCount , "PosTableCount ")
+ default: InterchangeObject();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::GenericDescriptor()
+{
+ switch(Code2)
+ {
+ ELEMENT(2F01, GenericDescriptor_Locators, "Locators")
+ default: GenerationInterchangeObject();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::JPEG2000PictureSubDescriptor()
+{
+ switch(Code2)
+ {
+ ELEMENT(8001, JPEG2000PictureSubDescriptor_Rsiz, "Decoder capabilities")
+ ELEMENT(8002, JPEG2000PictureSubDescriptor_Xsiz, "Width")
+ ELEMENT(8003, JPEG2000PictureSubDescriptor_Ysiz, "Height")
+ ELEMENT(8004, JPEG2000PictureSubDescriptor_XOsiz, "Horizontal offset")
+ ELEMENT(8005, JPEG2000PictureSubDescriptor_YOsiz, "Vertical offset ")
+ ELEMENT(8006, JPEG2000PictureSubDescriptor_XTsiz, "Width of one reference tile ")
+ ELEMENT(8007, JPEG2000PictureSubDescriptor_YTsiz, "Height of one reference tile ")
+ ELEMENT(8008, JPEG2000PictureSubDescriptor_XTOsiz, "Horizontal offset of the first tile")
+ ELEMENT(8009, JPEG2000PictureSubDescriptor_YTOsiz, "Vertical offset of the first tile")
+ ELEMENT(800A, JPEG2000PictureSubDescriptor_Csiz, "Number of components in the picture")
+ ELEMENT(800B, JPEG2000PictureSubDescriptor_PictureComponentSizing, "Picture components")
+ default: GenerationInterchangeObject();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::GenerationInterchangeObject()
+{
+ //Parsing
+ switch(Code2)
+ {
+ ELEMENT(0102, GenerationInterchangeObject_GenerationUID, "GenerationUID")
+ default: InterchangeObject();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::GenericPackage()
+{
+ switch(Code2)
+ {
+ ELEMENT(4401, GenericPackage_PackageUID, "PackageUID")
+ ELEMENT(4402, GenericPackage_Name, "Name")
+ ELEMENT(4403, GenericPackage_Tracks, "Tracks")
+ ELEMENT(4404, GenericPackage_PackageModifiedDate, "PackageModifiedDate")
+ ELEMENT(4405, GenericPackage_PackageCreationDate, "PackageCreationDate")
+ default: GenerationInterchangeObject();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::GenericPictureEssenceDescriptor()
+{
+ switch(Code2)
+ {
+ ELEMENT(3201, GenericPictureEssenceDescriptor_PictureEssenceCoding, "Identifier of the Picture Compression Scheme")
+ ELEMENT(3202, GenericPictureEssenceDescriptor_StoredHeight, "Vertical Field Size")
+ ELEMENT(3203, GenericPictureEssenceDescriptor_StoredWidth, "Horizontal Size")
+ ELEMENT(3204, GenericPictureEssenceDescriptor_SampledHeight, "Sampled height supplied to codec")
+ ELEMENT(3205, GenericPictureEssenceDescriptor_SampledWidth, "Sampled width supplied to codec")
+ ELEMENT(3206, GenericPictureEssenceDescriptor_SampledXOffset, "Offset from sampled to stored width")
+ ELEMENT(3207, GenericPictureEssenceDescriptor_SampledYOffset, "Offset from sampled to stored")
+ ELEMENT(3208, GenericPictureEssenceDescriptor_DisplayHeight, "Displayed Height placed in Production Aperture")
+ ELEMENT(3209, GenericPictureEssenceDescriptor_DisplayWidth, "Displayed Width placed in Production Aperture")
+ ELEMENT(320A, GenericPictureEssenceDescriptor_DisplayXOffset,"Horizontal offset from the of the picture as displayed")
+ ELEMENT(320B, GenericPictureEssenceDescriptor_DisplayYOffset,"Vertical offset of the picture as displayed")
+ ELEMENT(320C, GenericPictureEssenceDescriptor_FrameLayout, "Interlace or Progressive layout")
+ ELEMENT(320D, GenericPictureEssenceDescriptor_VideoLineMap, "First active line in each field")
+ ELEMENT(320E, GenericPictureEssenceDescriptor_AspectRatio, "Aspect ratio")
+ ELEMENT(320F, GenericPictureEssenceDescriptor_AlphaTransparency, "Is Alpha Inverted")
+ ELEMENT(3210, GenericPictureEssenceDescriptor_Gamma, "Gamma")
+ ELEMENT(3211, GenericPictureEssenceDescriptor_ImageAlignmentOffset, "Byte Boundary alignment required for Low Level Essence Storage")
+ ELEMENT(3212, GenericPictureEssenceDescriptor_FieldDominance,"Number of the field which is considered temporally to come first")
+ ELEMENT(3213, GenericPictureEssenceDescriptor_ImageStartOffset, "Unused bytes before start of stored data")
+ ELEMENT(3214, GenericPictureEssenceDescriptor_ImageEndOffset,"Unused bytes before start of stored data")
+ ELEMENT(3215, GenericPictureEssenceDescriptor_SignalStandard, "Underlying signal standard")
+ ELEMENT(3216, GenericPictureEssenceDescriptor_StoredF2Offset, "Topness Adjustment for stored picture")
+ ELEMENT(3217, GenericPictureEssenceDescriptor_DisplayF2Offset, "Topness Adjustment for Displayed Picture")
+ ELEMENT(3218, GenericPictureEssenceDescriptor_ActiveFormatDescriptor, "Specifies the intended framing of the content within the displayed image")
+ default: FileDescriptor();
+ }
+
+ if (Code2==0x3C0A) //InstanceUID
+ {
+ Descriptors[InstanceUID].StreamKind=Stream_Video;
+ if (Streams_Count==(size_t)-1)
+ Streams_Count=0;
+ Streams_Count++;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::GenericSoundEssenceDescriptor()
+{
+ //Parsing
+ switch(Code2)
+ {
+ ELEMENT(3D01, GenericSoundEssenceDescriptor_QuantizationBits, "QuantizationBits")
+ ELEMENT(3D02, GenericSoundEssenceDescriptor_Locked , "Locked ")
+ ELEMENT(3D03, GenericSoundEssenceDescriptor_AudioSamplingRate, "AudioSamplingRate")
+ ELEMENT(3D04, GenericSoundEssenceDescriptor_AudioRefLevel, "AudioRefLevel")
+ ELEMENT(3D05, GenericSoundEssenceDescriptor_ElectroSpatialFormulation, "ElectroSpatialFormulation")
+ ELEMENT(3D06, GenericSoundEssenceDescriptor_SoundEssenceCompression, "SoundEssenceCompression")
+ ELEMENT(3D07, GenericSoundEssenceDescriptor_ChannelCount, "ChannelCount")
+ ELEMENT(3D0C, GenericSoundEssenceDescriptor_DialNorm, "DialNorm")
+ default: FileDescriptor();
+ }
+
+ if (Code2==0x3C0A) //InstanceUID
+ {
+ Descriptors[InstanceUID].StreamKind=Stream_Audio;
+ if (Streams_Count==(size_t)-1)
+ Streams_Count=0;
+ Streams_Count++;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::GenericTrack()
+{
+ //Parsing
+ switch(Code2)
+ {
+ ELEMENT(4801, GenericTrack_TrackID, "TrackID")
+ ELEMENT(4802, GenericTrack_TrackName, "TrackName")
+ ELEMENT(4803, GenericTrack_Sequence, "Sequence")
+ ELEMENT(4804, GenericTrack_TrackNumber, "TrackNumber")
+ default: GenerationInterchangeObject();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::InterchangeObject()
+{
+ //Parsing
+ switch(Code2)
+ {
+ ELEMENT(3C0A, InterchangeObject_InstanceUID, "InstanceUID")
+ default: ;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::MaterialPackage()
+{
+ GenericPackage();
+
+ if (Code2==0x3C0A)
+ {
+ if (InstanceUID==Prefaces[Preface_Current].PrimaryPackage) //InstanceIUD
+ {
+ Element_Level--;
+ Element_Info("Primary package");
+ Element_Level++;
+ }
+ for (contentstorages::iterator ContentStorage=ContentStorages.begin(); ContentStorage!=ContentStorages.end(); ContentStorage++)
+ {
+ for (size_t Pos=0; Pos<ContentStorage->second.Packages.size(); Pos++)
+ if (InstanceUID==ContentStorage->second.Packages[Pos])
+ {
+ Element_Level--;
+ Element_Info("Valid from Content storage");
+ Element_Level++;
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::MPEG2VideoDescriptor()
+{
+ std::map<int16u, int128u>::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; Pos<Descriptor->second.Locators.size(); Pos++)
+ if (InstanceUID==Descriptor->second.Locators[Pos])
+ {
+ Element_Level--;
+ Element_Info("Valid from Descriptor");
+ Element_Level++;
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::OpenCompleteBodyPartition()
+{
+ //Parsing
+ PartitionMetadata();
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::OpenHeader()
+{
+ //Parsing
+ PartitionMetadata();
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::Padding()
+{
+ //Parsing
+ Skip_XX(Element_Size, "Padding");
+}
+
+//---------------------------------------------------------------------------
+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<Count; Pos++)
+ {
+ Element_Begin("LocalTagEntryBatch", Length);
+ int16u LocalTag;
+ int128u UID;
+ Get_B2 (LocalTag, "LocalTag"); Element_Info(Ztring().From_CC2(LocalTag));
+ Get_UL (UID, "UID", NULL); Element_Info(Ztring().From_UUID(UID));
+ Element_End();
+
+ FILLING_BEGIN();
+ if (LocalTag>=0x8000) //user defined
+ Primer_Values[LocalTag]=UID;
+ FILLING_END();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::RGBAEssenceDescriptor()
+{
+ 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();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::RandomIndexMetadata()
+{
+ //Parsing
+ while (Element_Offset+4<Element_Size)
+ {
+ Element_Begin("PartitionArray", 12);
+ Info_B4(BodySID, "BodySID"); Element_Info(BodySID);
+ Info_B8(ByteOffset, "ByteOffset"); Element_Info(Ztring::ToZtring(ByteOffset, 16));
+ Element_End();
+ }
+ Skip_B4( "Length");
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::Sequence()
+{
+ switch(Code2)
+ {
+ ELEMENT(1001, Sequence_StructuralComponents, "StructuralComponents")
+ default: StructuralComponent();
+ }
+
+ if (Code2==0x3C0A)
+ {
+ for (std::map<int128u, track>::iterator Track=Tracks.begin(); Track!=Tracks.end(); Track++)
+ {
+ if (InstanceUID==Track->second.Sequence)
+ {
+ Element_Level--;
+ Element_Info("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();
+}
+
+//---------------------------------------------------------------------------
+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::TimecodeComponent()
+{
+ 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::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_Info("Primary package");
+ Element_Level++;
+ }
+ for (size_t Pos=0; Pos<Package->second.Tracks.size(); Pos++)
+ if (InstanceUID==Package->second.Tracks[Pos])
+ {
+ Element_Level--;
+ Element_Info("Valid from Package");
+ Element_Level++;
+ }
+ }
+ }
+}
+
+//***************************************************************************
+// Base
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+// 0x3D08
+void File_Mxf::AES3PCMDescriptor_AuxBitsMode()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3D0D
+void File_Mxf::AES3PCMDescriptor_Emphasis()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3D0F
+void File_Mxf::AES3PCMDescriptor_BlockStartOffset()
+{
+ //Parsing
+ Info_B2(Data, "Data"); Element_Info(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_Info(Data);
+
+ FILLING_BEGIN();
+ if (Data)
+ Descriptors[InstanceUID].Infos["Resolution"].From_Number(Data);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3302
+void File_Mxf::CDCIEssenceDescriptor_HorizontalSubsampling()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3303
+void File_Mxf::CDCIEssenceDescriptor_ColorSiting()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3304
+void File_Mxf::CDCIEssenceDescriptor_BlackRefLevel()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3305
+void File_Mxf::CDCIEssenceDescriptor_WhiteReflevel()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3306
+void File_Mxf::CDCIEssenceDescriptor_ColorRange()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3307
+void File_Mxf::CDCIEssenceDescriptor_PaddingBits()
+{
+ //Parsing
+ Info_B2(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3308
+void File_Mxf::CDCIEssenceDescriptor_VerticalSubsampling()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3309
+void File_Mxf::CDCIEssenceDescriptor_AlphaSampleDepth()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x330B
+void File_Mxf::CDCIEssenceDescriptor_ReversedByteOrder()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(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<Count; Pos++)
+ {
+ Element_Begin("Package", Length);
+ int128u Data;
+ Get_UL (Data, "Data", NULL);
+
+ FILLING_BEGIN();
+ if (Data==Prefaces[Preface_Current].PrimaryPackage)
+ Element_Info("Primary package");
+ ContentStorages[InstanceUID].Packages.push_back(Data);
+ FILLING_END();
+
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+// 0x1902
+void File_Mxf::ContentStorage_EssenceContainerData()
+{
+ //Parsing
+ //Vector
+ int32u Count, Length;
+ Get_B4 (Count, "Count");
+ Get_B4 (Length, "Length");
+ for (int32u Pos=0; Pos<Count; Pos++)
+ {
+ Info_UL (EssenceContainer, "EssenceContainer", Mxf_EssenceContainer);
+ }
+}
+
+//---------------------------------------------------------------------------
+// 0x2701
+void File_Mxf::EssenceContainerData_LinkedPackageUID()
+{
+ //Parsing
+ Skip_UMID();
+}
+
+//---------------------------------------------------------------------------
+// 0x3F06
+void File_Mxf::EssenceContainerData_IndexSID()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3F07
+void File_Mxf::EssenceContainerData_BodySID()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x4901
+void File_Mxf::EventTrack_EventEditRate()
+{
+ //Parsing
+ Info_Rational();
+}
+
+//---------------------------------------------------------------------------
+// 0x4902
+void File_Mxf::EventTrack_EventOrigin()
+{
+ //Parsing
+ Info_B8(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3001
+void File_Mxf::FileDescriptor_SampleRate()
+{
+ //Parsing
+ Get_Rational(Descriptors[InstanceUID].SampleRate); Element_Info(Descriptors[InstanceUID].SampleRate);
+
+ FILLING_BEGIN();
+ switch (Descriptors[InstanceUID].StreamKind)
+ {
+ case Stream_Video : Descriptors[InstanceUID].Infos["FrameRate"]=Ztring().From_Number(Descriptors[InstanceUID].SampleRate, 3); break;
+ default : ;
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3002
+void File_Mxf::FileDescriptor_ContainerDuration()
+{
+ //Parsing
+ int64u Data;
+ Get_B8 (Data, "Data"); Element_Info(Data);
+
+ FILLING_BEGIN();
+ float32 SampleRate=Descriptors[InstanceUID].SampleRate;
+ if (SampleRate && Data!=0xFFFFFFFFFFFFFFFFLL)
+ Descriptors[InstanceUID].Infos["Duration"].From_Number(Data/SampleRate*1000);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3004
+void File_Mxf::FileDescriptor_EssenceContainer()
+{
+ //Parsing
+ Info_UL(EssenceContainer, "EssenceContainer", Mxf_EssenceContainer); Element_Info(Mxf_EssenceContainer(EssenceContainer));
+}
+
+//---------------------------------------------------------------------------
+// 0x3005
+void File_Mxf::FileDescriptor_Codec()
+{
+ //Parsing
+ Skip_UL( "UUID");
+}
+
+//---------------------------------------------------------------------------
+// 0x3006
+void File_Mxf::FileDescriptor_LinkedTrackID()
+{
+ //Parsing
+ int32u Data;
+ Get_B4 (Data, "Data"); Element_Info(Data);
+
+ FILLING_BEGIN();
+ Descriptors[InstanceUID].LinkedTrackID=Data;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3C0A
+void File_Mxf::InterchangeObject_InstanceUID()
+{
+ //Parsing
+ Get_UUID(InstanceUID, "UUID");
+
+ 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[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]=Component->second;
+ Components.erase(Component);
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x0102
+void File_Mxf::GenerationInterchangeObject_GenerationUID()
+{
+ //Parsing
+ Skip_UUID( "UUID");
+}
+
+//---------------------------------------------------------------------------
+// 0x2F01
+void File_Mxf::GenericDescriptor_Locators()
+{
+ //Parsing
+ //Vector
+ int32u Count, Length;
+ Get_B4 (Count, "Count");
+ Get_B4 (Length, "Length");
+ for (int32u Pos=0; Pos<Count; Pos++)
+ {
+ Element_Begin("Locator", Length);
+ int128u UUID;
+ Get_UUID(UUID, "UUID");
+
+ FILLING_BEGIN();
+ Descriptors[InstanceUID].Locators.push_back(UUID);
+ FILLING_END();
+
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+// 0x4401
+void File_Mxf::GenericPackage_PackageUID()
+{
+ //Parsing
+ Skip_UMID();
+}
+
+//---------------------------------------------------------------------------
+// 0x4402
+void File_Mxf::GenericPackage_Name()
+{
+ //Parsing
+ Info_UTF16B(Length2, Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x4403
+void File_Mxf::GenericPackage_Tracks()
+{
+ //Parsing
+ //Vector
+ int32u Count, Length;
+ Get_B4 (Count, "Count");
+ Get_B4 (Length, "Length");
+ for (int32u Pos=0; Pos<Count; Pos++)
+ {
+ Element_Begin("Track", Length);
+ int128u Data;
+ Get_UUID(Data, "Data");
+
+ FILLING_BEGIN();
+ Packages[InstanceUID].Tracks.push_back(Data);
+ FILLING_END();
+
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+// 0x4404
+void File_Mxf::GenericPackage_PackageModifiedDate()
+{
+ //Parsing
+ Info_Timestamp();
+}
+
+//---------------------------------------------------------------------------
+// 0x4405
+void File_Mxf::GenericPackage_PackageCreationDate()
+{
+ //Parsing
+ Info_Timestamp();
+}
+
+//---------------------------------------------------------------------------
+// 0x3201
+void File_Mxf::GenericPictureEssenceDescriptor_PictureEssenceCoding()
+{
+ //Parsing
+ int128u Data;
+ Get_UL(Data, "Data", Mxf_EssenceCoding); Element_Info(Mxf_EssenceCoding(Data));
+
+ FILLING_BEGIN();
+ Descriptors[InstanceUID].Infos["Format"]=Mxf_EssenceCoding_Format(Data);
+ Descriptors[InstanceUID].Infos["Format_Version"]=Mxf_EssenceCoding_Format_Version(Data);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3202
+void File_Mxf::GenericPictureEssenceDescriptor_StoredHeight()
+{
+ //Parsing
+ int32u Data;
+ Get_B4 (Data, "Data"); Element_Info(Data);
+
+ FILLING_BEGIN();
+ if (Descriptors[InstanceUID].Infos["ScanType"]==_T("Interlaced"))
+ Data*=2; //This is per field
+ if (Descriptors[InstanceUID].Height==(int32u)-1)
+ Descriptors[InstanceUID].Height=Data;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3203
+void File_Mxf::GenericPictureEssenceDescriptor_StoredWidth()
+{
+ //Parsing
+ int32u Data;
+ Get_B4 (Data, "Data"); Element_Info(Data);
+
+ FILLING_BEGIN();
+ if (Descriptors[InstanceUID].Width==(int32u)-1)
+ Descriptors[InstanceUID].Width=Data;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3204
+void File_Mxf::GenericPictureEssenceDescriptor_SampledHeight()
+{
+ //Parsing
+ int32u Data;
+ Get_B4 (Data, "Data"); Element_Info(Data);
+
+ FILLING_BEGIN();
+ if (Descriptors[InstanceUID].Infos["ScanType"]==_T("Interlaced"))
+ Data*=2; //This is per field
+ Descriptors[InstanceUID].Height=Data;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3205
+void File_Mxf::GenericPictureEssenceDescriptor_SampledWidth()
+{
+ //Parsing
+ int32u Data;
+ Get_B4 (Data, "Data"); Element_Info(Data);
+
+ FILLING_BEGIN();
+ Descriptors[InstanceUID].Width=Data;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3206
+void File_Mxf::GenericPictureEssenceDescriptor_SampledXOffset()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3207
+void File_Mxf::GenericPictureEssenceDescriptor_SampledYOffset()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3208
+void File_Mxf::GenericPictureEssenceDescriptor_DisplayHeight()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3209
+void File_Mxf::GenericPictureEssenceDescriptor_DisplayWidth()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x320A
+void File_Mxf::GenericPictureEssenceDescriptor_DisplayXOffset()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x320B
+void File_Mxf::GenericPictureEssenceDescriptor_DisplayYOffset()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x320C
+void File_Mxf::GenericPictureEssenceDescriptor_FrameLayout()
+{
+ //Parsing
+ int8u Data;
+ Get_B1 (Data, "Data"); Element_Info(Data);
+
+ FILLING_BEGIN();
+ Descriptors[InstanceUID].Infos["ScanType"]=Data?"Interlaced":"PPF";
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x320D
+void File_Mxf::GenericPictureEssenceDescriptor_VideoLineMap()
+{
+ //Parsing
+ int32u Count, Length;
+ Get_B4 (Count, "Count");
+ Get_B4 (Length, "Length");
+ for (int32u Pos=0; Pos<Count; Pos++)
+ {
+ Skip_B4( "VideoLineMapEntry");
+ }
+}
+
+//---------------------------------------------------------------------------
+// 0x320E
+void File_Mxf::GenericPictureEssenceDescriptor_AspectRatio()
+{
+ //Parsing
+ float32 Data;
+ Get_Rational(Data);
+
+ FILLING_BEGIN();
+ if (Data)
+ Descriptors[InstanceUID].Infos["DisplayAspectRatio"].From_Number(Data, 3);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x320F
+void File_Mxf::GenericPictureEssenceDescriptor_AlphaTransparency()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3210
+void File_Mxf::GenericPictureEssenceDescriptor_Gamma()
+{
+ //Parsing
+ Skip_UL( "Data");
+}
+
+//---------------------------------------------------------------------------
+// 0x3211
+void File_Mxf::GenericPictureEssenceDescriptor_ImageAlignmentOffset()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3212
+void File_Mxf::GenericPictureEssenceDescriptor_FieldDominance()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3213
+void File_Mxf::GenericPictureEssenceDescriptor_ImageStartOffset()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3214
+void File_Mxf::GenericPictureEssenceDescriptor_ImageEndOffset()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3215
+void File_Mxf::GenericPictureEssenceDescriptor_SignalStandard()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3216
+void File_Mxf::GenericPictureEssenceDescriptor_StoredF2Offset()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3217
+void File_Mxf::GenericPictureEssenceDescriptor_DisplayF2Offset()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3218
+void File_Mxf::GenericPictureEssenceDescriptor_ActiveFormatDescriptor()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3D01
+void File_Mxf::GenericSoundEssenceDescriptor_QuantizationBits()
+{
+ //Parsing
+ int32u Data;
+ Get_B4 (Data, "Data"); Element_Info(Data);
+
+ FILLING_BEGIN();
+ if (Data)
+ Descriptors[InstanceUID].Infos["Resolution"].From_Number(Data);
+ FILLING_END();
+
+}
+
+//---------------------------------------------------------------------------
+// 0x3D02
+void File_Mxf::GenericSoundEssenceDescriptor_Locked()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data?"Yes":"No");
+}
+
+//---------------------------------------------------------------------------
+// 0x3D03
+void File_Mxf::GenericSoundEssenceDescriptor_AudioSamplingRate()
+{
+ //Parsing
+ float32 Data;
+ Get_Rational(Data); Element_Info(Data);
+
+ FILLING_BEGIN();
+ Descriptors[InstanceUID].Infos["SamplingRate"].From_Number(Data, 0);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3D04
+void File_Mxf::GenericSoundEssenceDescriptor_AudioRefLevel()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data, " dB");
+}
+
+//---------------------------------------------------------------------------
+// 0x3D05
+void File_Mxf::GenericSoundEssenceDescriptor_ElectroSpatialFormulation()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data); //Enum
+}
+
+//---------------------------------------------------------------------------
+// 0x3D06
+void File_Mxf::GenericSoundEssenceDescriptor_SoundEssenceCompression()
+{
+ //Parsing
+ int128u Data;
+ Get_UL(Data, "Data", Mxf_EssenceContainer); Element_Info(Mxf_EssenceContainer(Data));
+
+ FILLING_BEGIN();
+ Descriptors[InstanceUID].Infos["Format"]=Mxf_EssenceCoding_Format(Data);
+ Descriptors[InstanceUID].Infos["Format_Version"]=Mxf_EssenceCoding_Format_Version(Data);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3D07
+void File_Mxf::GenericSoundEssenceDescriptor_ChannelCount()
+{
+ //Parsing
+ int32u Data;
+ Get_B4 (Data, "Data"); Element_Info(Data);
+
+ FILLING_BEGIN();
+ Descriptors[InstanceUID].Infos["Channel(s)"].From_Number(Data);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3D0C
+void File_Mxf::GenericSoundEssenceDescriptor_DialNorm()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data, " dB");
+}
+
+//---------------------------------------------------------------------------
+// 0x4801
+void File_Mxf::GenericTrack_TrackID()
+{
+ //Parsing
+ int32u Data;
+ Get_B4 (Data, "Data"); Element_Info(Data);
+
+ FILLING_BEGIN();
+ Tracks[InstanceUID].TrackID=Data;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x4802
+void File_Mxf::GenericTrack_TrackName()
+{
+ //Parsing
+ Info_UTF16B(Length2, Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x4803
+void File_Mxf::GenericTrack_Sequence()
+{
+ //Parsing
+ int128u Data;
+ Get_UUID(Data, "Data");
+
+ FILLING_BEGIN();
+ Tracks[InstanceUID].Sequence=Data;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x4804
+void File_Mxf::GenericTrack_TrackNumber()
+{
+ //Parsing
+ int32u Data;
+ Get_B4 (Data, "Data"); Element_Info(Ztring::ToZtring(Data, 16));
+
+ FILLING_BEGIN();
+ Tracks[InstanceUID].TrackNumber=Data;
+ Track_Number_IsAvailable=true;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3C01
+void File_Mxf::Identification_CompanyName()
+{
+ //Parsing
+ Ztring Data;
+ Get_UTF16B(Length2, Data, "Data"); Element_Info(Data);
+
+ FILLING_BEGIN();
+ Identifications[InstanceUID].CompanyName=Data;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3C02
+void File_Mxf::Identification_ProductName()
+{
+ //Parsing
+ Ztring Data;
+ Get_UTF16B(Length2, Data, "Data"); Element_Info(Data);
+
+ FILLING_BEGIN();
+ Identifications[InstanceUID].ProductName=Data;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3C03
+void File_Mxf::Identification_ProductVersion()
+{
+ //Parsing
+ int16u Major, Minor, Patch, Build, Release;
+ Get_B2 (Major, "Major");
+ Get_B2 (Minor, "Minor");
+ Get_B2 (Patch, "Patch");
+ Get_B2 (Build, "Build");
+ Get_B2 (Release, "Release");
+ Ztring Version=Ztring::ToZtring(Major)+_T('.')
+ +Ztring::ToZtring(Minor)+_T('.')
+ +Ztring::ToZtring(Patch)+_T('.')
+ +Ztring::ToZtring(Build)+_T('.')
+ +Ztring::ToZtring(Release) ;
+ Element_Info(Version);
+
+ FILLING_BEGIN();
+ Identifications[InstanceUID].ProductVersion=Version;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3C04
+void File_Mxf::Identification_VersionString()
+{
+ //Parsing
+ Ztring Data;
+ Get_UTF16B(Length2, Data, "Data"); Element_Info(Data);
+
+ FILLING_BEGIN();
+ Identifications[InstanceUID].VersionString=Data;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3C05
+void File_Mxf::Identification_ProductUID()
+{
+ //Parsing
+ Skip_UUID( "UUID");
+}
+
+//---------------------------------------------------------------------------
+// 0x3C06
+void File_Mxf::Identification_ModificationDate()
+{
+ //Parsing
+ Info_Timestamp();
+}
+
+//---------------------------------------------------------------------------
+// 0x3C07
+void File_Mxf::Identification_ToolkitVersion()
+{
+ //Parsing
+ //Parsing
+ Info_B2(Major, "Major");
+ Info_B2(Minor, "Minor");
+ Info_B2(Patch, "Patch");
+ Info_B2(Build, "Build");
+ Info_B2(Release, "Release");
+ Element_Info(Ztring::ToZtring(Major)+_T('.')
+ +Ztring::ToZtring(Minor)+_T('.')
+ +Ztring::ToZtring(Patch)+_T('.')
+ +Ztring::ToZtring(Build)+_T('.')
+ +Ztring::ToZtring(Release) );
+}
+
+//---------------------------------------------------------------------------
+// 0x3C08
+void File_Mxf::Identification_Platform()
+{
+ //Parsing
+ Info_UTF16B(Length2, Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3C09
+void File_Mxf::Identification_ThisGenerationUID()
+{
+ //Parsing
+ Skip_UUID( "UUID");
+}
+
+//---------------------------------------------------------------------------
+// 0x3F05
+void File_Mxf::IndexTableSegment_EditUnitByteCount()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3F06
+void File_Mxf::IndexTableSegment_IndexSID()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3F07
+void File_Mxf::IndexTableSegment_BodySID()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3F08
+void File_Mxf::IndexTableSegment_SliceCount()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3F0B
+void File_Mxf::IndexTableSegment_IndexEditRate()
+{
+ //Parsing
+ Info_Rational();
+}
+
+//---------------------------------------------------------------------------
+// 0x3F0C
+void File_Mxf::IndexTableSegment_IndexStartPosition()
+{
+ //Parsing
+ Info_B8(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3F0D
+void File_Mxf::IndexTableSegment_IndexDuration()
+{
+ //Parsing
+ Info_B8(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3F0E
+void File_Mxf::IndexTableSegment_PosTableCount()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x8001
+void File_Mxf::JPEG2000PictureSubDescriptor_Rsiz()
+{
+ //Parsing
+ Info_B2(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x8002
+void File_Mxf::JPEG2000PictureSubDescriptor_Xsiz()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x8003
+void File_Mxf::JPEG2000PictureSubDescriptor_Ysiz()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x8004
+void File_Mxf::JPEG2000PictureSubDescriptor_XOsiz()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x8005
+void File_Mxf::JPEG2000PictureSubDescriptor_YOsiz()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x8006
+void File_Mxf::JPEG2000PictureSubDescriptor_XTsiz()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x8007
+void File_Mxf::JPEG2000PictureSubDescriptor_YTsiz()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x8008
+void File_Mxf::JPEG2000PictureSubDescriptor_XTOsiz()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x8009
+void File_Mxf::JPEG2000PictureSubDescriptor_YTOsiz()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x800A
+void File_Mxf::JPEG2000PictureSubDescriptor_Csiz()
+{
+ //Parsing
+ Info_B2(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x800B
+void File_Mxf::JPEG2000PictureSubDescriptor_PictureComponentSizing()
+{
+ //Parsing
+ int32u Count, Length;
+ Get_B4 (Count, "Count");
+ Get_B4 (Length, "Length");
+ for (int32u Pos=0; Pos<Count; Pos++)
+ {
+ Element_Begin("PictureComponentSize", Length);
+ Info_B1(Ssiz, "Component sample precision"); Element_Info(Ssiz);
+ Info_B1(XRsiz, "Horizontal separation of a sample"); Element_Info(XRsiz);
+ Info_B1(YRsiz, "Vertical separation of a sample"); Element_Info(YRsiz);
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+// 0x3B02
+void File_Mxf::Preface_LastModifiedDate()
+{
+ //Parsing
+ Ztring Value;
+ Get_Timestamp(Value); Element_Info(Value);
+
+ FILLING_BEGIN();
+ Fill(Stream_General, 0, General_Encoded_Date, Value, true);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x
+void File_Mxf::MPEG2VideoDescriptor_SingleSequence()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data?"Yes":"No");
+}
+
+//---------------------------------------------------------------------------
+// 0x
+void File_Mxf::MPEG2VideoDescriptor_ConstantBFrames()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data?"Yes":"No");
+}
+
+//---------------------------------------------------------------------------
+// 0x
+void File_Mxf::MPEG2VideoDescriptor_CodedContentType()
+{
+ //Parsing
+ int8u Data;
+ Get_B1 (Data, "Data"); Element_Info(Mxf_MPEG2_CodedContentType(Data));
+
+ FILLING_BEGIN();
+ Descriptors[InstanceUID].Infos["ScanType"]=Mxf_MPEG2_CodedContentType(Data);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x
+void File_Mxf::MPEG2VideoDescriptor_LowDelay()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data?"Yes":"No");
+}
+
+//---------------------------------------------------------------------------
+// 0x
+void File_Mxf::MPEG2VideoDescriptor_ClosedGOP()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data?"Yes":"No");
+}
+
+//---------------------------------------------------------------------------
+// 0x
+void File_Mxf::MPEG2VideoDescriptor_IdenticalGOP()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data?"Yes":"No");
+}
+
+//---------------------------------------------------------------------------
+// 0x
+void File_Mxf::MPEG2VideoDescriptor_MaxGOP()
+{
+ //Parsing
+ Info_B2(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x
+void File_Mxf::MPEG2VideoDescriptor_BPictureCount()
+{
+ //Parsing
+ Info_B2(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x
+void File_Mxf::MPEG2VideoDescriptor_ProfileAndLevel()
+{
+ //Parsing
+ int8u profile_and_level_indication_profile, profile_and_level_indication_level;
+ BS_Begin();
+ Skip_SB( "profile_and_level_indication_escape");
+ Get_S1 ( 3, profile_and_level_indication_profile, "profile_and_level_indication_profile"); Param_Info(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_Info(Mpegv_profile_and_level_indication_level[profile_and_level_indication_level]);
+ BS_End();
+
+ FILLING_BEGIN();
+ if (profile_and_level_indication_profile && profile_and_level_indication_level)
+ Descriptors[InstanceUID].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]);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x
+void File_Mxf::MPEG2VideoDescriptor_BitRate()
+{
+ //Parsing
+ int32u Data;
+ Get_B4 (Data, "Data"); Element_Info(Data);
+
+ FILLING_BEGIN();
+ Descriptors[InstanceUID].Infos["BitRate"].From_Number(Data);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x4001
+void File_Mxf::NetworkLocator_URLString()
+{
+ //Parsing
+ Ztring Data;
+ Get_UTF16B(Length2, Data, "Essence Locator"); Element_Info(Data);
+
+ FILLING_BEGIN();
+ Locators[InstanceUID].EssenceLocator=Data;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3F01
+void File_Mxf::MultipleDescriptor_SubDescriptorUIDs()
+{
+ //Parsing
+ //Vector
+ int32u Count, Length;
+ Get_B4 (Count, "Count");
+ Get_B4 (Length, "Length");
+ for (int32u Pos=0; Pos<Count; Pos++)
+ {
+ //Parsing
+ int128u Data;
+ Get_UUID(Data, "UUID");
+
+ FILLING_BEGIN();
+ Descriptors[InstanceUID].SubDescriptors.push_back(Data);
+ FILLING_END();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::PartitionMetadata()
+{
+ //Parsing
+ Skip_B2( "MajorVersion");
+ Skip_B2( "MinorVersion");
+ Skip_B4( "KAGSize");
+ Skip_B8( "ThisPartition");
+ Skip_B8( "PreviousPartition");
+ Skip_B8( "FooterPartition");
+ Skip_B8( "HeaderByteCount");
+ Skip_B8( "IndexByteCount");
+ Skip_B4( "IndexSID");
+ Skip_B8( "BodyOffset");
+ Skip_B4( "BodySID");
+ Get_UL (OperationalPattern, "OperationalPattern", Mxf_OperationalPattern);
+
+ Element_Begin("EssenceContainers"); //Vector
+ int32u Count, Length;
+ Get_B4 (Count, "Count");
+ Get_B4 (Length, "Length");
+ for (int32u Pos=0; Pos<Count; Pos++)
+ {
+ Info_UL(EssenceContainer, "EssenceContainer", Mxf_EssenceContainer);
+ }
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+// 0x3B03
+void File_Mxf::Preface_ContentStorage()
+{
+ //Parsing
+ int128u Data;
+ Get_UUID(Data, "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_Info(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; Pos<Count; Pos++)
+ {
+ Element_Begin("Identification", Length);
+ int128u Data;
+ Get_UUID(Data, "UUID");
+ Element_End();
+
+ FILLING_BEGIN();
+ Prefaces[Preface_Current].Identifications.push_back(Data);
+ FILLING_END();
+ }
+}
+
+//---------------------------------------------------------------------------
+// 0x3B07
+void File_Mxf::Preface_ObjectModelVersion()
+{
+ //Parsing
+ Skip_B4( "Data");
+}
+
+//---------------------------------------------------------------------------
+// 0x3B08
+void File_Mxf::Preface_PrimaryPackage()
+{
+ //Parsing
+ int128u Data;
+ Get_UUID(Data, "Data");
+
+ FILLING_BEGIN();
+ Prefaces[Preface_Current].PrimaryPackage=Data;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3B09
+void File_Mxf::Preface_OperationalPattern()
+{
+ //Parsing
+ Get_UL (OperationalPattern, "UUID", Mxf_OperationalPattern);
+}
+
+//---------------------------------------------------------------------------
+// 0x3B0A
+void File_Mxf::Preface_EssenceContainers()
+{
+ //Parsing
+ //Vector
+ int32u Count, Length;
+ Get_B4 (Count, "Count");
+ Get_B4 (Length, "Length");
+ for (int32u Pos=0; Pos<Count; Pos++)
+ {
+ Info_UL(EssenceContainer, "EssenceContainer", Mxf_EssenceContainer);
+ }
+}
+
+//---------------------------------------------------------------------------
+// 0x3B0B
+void File_Mxf::Preface_DMSchemes()
+{
+ //Parsing
+ //Vector
+ int32u Count, Length;
+ Get_B4 (Count, "Count");
+ Get_B4 (Length, "Length");
+ for (int32u Pos=0; Pos<Count; Pos++)
+ {
+ Element_Begin("DMScheme", Length);
+ Skip_UL( "UUID");
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+// 0x3401
+void File_Mxf::RGBAEssenceDescriptor_PixelLayout()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3403
+void File_Mxf::RGBAEssenceDescriptor_Palette()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3404
+void File_Mxf::RGBAEssenceDescriptor_PaletteLayout()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3405
+void File_Mxf::RGBAEssenceDescriptor_ScanningDirection()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3406
+void File_Mxf::RGBAEssenceDescriptor_ComponentMaxRef()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3407
+void File_Mxf::RGBAEssenceDescriptor_ComponentMinRef()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3408
+void File_Mxf::RGBAEssenceDescriptor_AlphaMaxRef()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3409
+void File_Mxf::RGBAEssenceDescriptor_AlphaMinRef()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x1001
+void File_Mxf::Sequence_StructuralComponents()
+{
+ //Parsing
+ //Vector
+ int32u Count, Length;
+ Get_B4 (Count, "Count");
+ Get_B4 (Length, "Length");
+ for (int32u Pos=0; Pos<Count; Pos++)
+ {
+ Element_Begin("StructuralComponent", Length);
+ Skip_UUID( "UUID");
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+// 0x1101
+void File_Mxf::SourceClip_SourcePackageID()
+{
+ //Parsing
+ Skip_UMID();
+}
+
+//---------------------------------------------------------------------------
+// 0x1102
+void File_Mxf::SourceClip_SourceTrackID()
+{
+ //Parsing
+ Info_B4(Data, "ID"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x1201
+void File_Mxf::SourceClip_StartPosition()
+{
+ //Parsing
+ Info_B8(Duration, "Duration"); Element_Info(Duration); //units of edit rate
+}
+
+//---------------------------------------------------------------------------
+// 0x4701
+void File_Mxf::SourcePackage_Descriptor()
+{
+ //Parsing
+ int128u Data;
+ Get_UUID(Data, "Data");
+
+ FILLING_BEGIN();
+ Packages[InstanceUID].Descriptor=Data;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x0201
+void File_Mxf::StructuralComponent_DataDefinition()
+{
+ //Parsing
+ Info_UL(Data, "Data", Mxf_Sequence_DataDefinition); Element_Info(Mxf_Sequence_DataDefinition(Data));
+}
+
+//---------------------------------------------------------------------------
+// 0x0202
+void File_Mxf::StructuralComponent_Duration()
+{
+ //Parsing
+ int64u Data;
+ Get_B8 (Data, "Data"); Element_Info(Data); //units of edit rate
+
+ FILLING_BEGIN();
+ if (Data!=0xFFFFFFFFFFFFFFFFLL)
+ Components[InstanceUID].Duration=Data;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x4101
+void File_Mxf::TextLocator_LocatorName()
+{
+ //Parsing
+ Info_UTF16B(Length2, Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x1501
+void File_Mxf::TimecodeComponent_StartTimecode()
+{
+ //Parsing
+ Info_B8(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x1502
+void File_Mxf::TimecodeComponent_RoundedTimecodeBase()
+{
+ //Parsing
+ Info_B2(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x1503
+void File_Mxf::TimecodeComponent_DropFrame()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x4B01
+void File_Mxf::Track_EditRate()
+{
+ //Parsing
+ float32 Data;
+ Get_Rational(Data); Element_Info(Data);
+
+ FILLING_BEGIN();
+ Tracks[InstanceUID].EditRate=Data;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x4B02
+void File_Mxf::Track_Origin()
+{
+ //Parsing
+ Info_B8(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3D09
+void File_Mxf::WaveAudioDescriptor_AvgBps()
+{
+ //Parsing
+ int32u Data;
+ Get_B4 (Data, "Data"); Element_Info(Data);
+
+ FILLING_BEGIN();
+ Descriptors[InstanceUID].Infos["BitRate"].From_Number(Data*8);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 0x3D0A
+void File_Mxf::WaveAudioDescriptor_BlockAlign()
+{
+ //Parsing
+ Info_B2(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3D0B
+void File_Mxf::WaveAudioDescriptor_SequenceOffset()
+{
+ //Parsing
+ Info_B1(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3D29
+void File_Mxf::WaveAudioDescriptor_PeakEnvelopeVersion()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3D2A
+void File_Mxf::WaveAudioDescriptor_PeakEnvelopeFormat()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3D2B
+void File_Mxf::WaveAudioDescriptor_PointsPerPeakValue()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3D2C
+void File_Mxf::WaveAudioDescriptor_PeakEnvelopeBlockSize()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3D2D
+void File_Mxf::WaveAudioDescriptor_PeakChannels()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3D2E
+void File_Mxf::WaveAudioDescriptor_PeakFrames()
+{
+ //Parsing
+ Info_B4(Data, "Data"); Element_Info(Data);
+}
+
+//---------------------------------------------------------------------------
+// 0x3D2F
+void File_Mxf::WaveAudioDescriptor_PeakOfPeaksPosition()
+{
+ //Parsing
+ Info_B8(Data, "Data"); Element_Info(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");
+}
+
+//***************************************************************************
+// Basic types
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Mxf::Get_Rational(float32 &Value)
+{
+ //Parsing
+ int32u N, D;
+ Get_B4 (N, "Numerator");
+ Get_B4 (D, "Denominator");
+ if (D)
+ Value=((float32)N)/D;
+ else
+ Value=0; //Error
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::Skip_Rational()
+{
+ //Parsing
+ Skip_B4( "Numerator");
+ Skip_B4( "Denominator");
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::Info_Rational()
+{
+ //Parsing
+ Info_B4(N, "Numerator");
+ Info_B4(D, "Denominator");
+ if (D)
+ Element_Info(((float32)N)/D);
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::Get_UL(int128u &Value, const char* Name, const char* (*Param) (int128u))
+{
+ #ifdef MEDIAINFO_MINIMIZE_SIZE
+ Skip_UUID();
+ #else
+ //Parsing
+ Element_Begin(Name);
+ int64u Value_hi, Value_lo;
+ Peek_B8(Value_hi);
+ Skip_B1( "Start (0x06)");
+ Skip_B1( "Length of the remaining key (0x0E)");
+ Skip_B1( "ISO, ORG (0x2B)");
+ Skip_B1( "SMPTE (0x34)");
+ Info_B1(Category, "Category"); Param_Info(Mxf_Category(Category));
+ Info_B1(RegistryDesignator, "RegistryDesignator"); Param_Info(Mxf_RegistryDesignator(Category, RegistryDesignator));
+ Skip_B1( "0x01");
+ Skip_B1( "Version");
+ Peek_B8(Value_lo);
+ Info_B1(Code1, "Code (1)");
+ switch (Code1)
+ {
+ case 0x01 :
+ {
+ 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 :
+ {
+ Info_B1(Code2, "Code (2)");
+ switch (Code2)
+ {
+ case 0x01 :
+ {
+ Info_B1(Code3, "Code (3)");
+ switch (Code3)
+ {
+ case 0x02 :
+ Skip_B5( "Picture coding or compression");
+ break;
+ default :
+ Skip_B5( "Unknown");
+ }
+ }
+ break;
+ case 0x02 :
+ {
+ Info_B1(Code3, "Code (3)");
+ switch (Code3)
+ {
+ case 0x02 :
+ Skip_B5( "Sound coding or compression");
+ break;
+ default :
+ Skip_B5( "Unknown");
+ }
+ }
+ break;
+ default :
+ Skip_B6( "Unknown");
+ }
+ }
+ break;
+ case 0x0D :
+ {
+ Info_B1(Code2, "Code (2)");
+ switch (Code2)
+ {
+ case 0x01 :
+ {
+ Info_B1(Code3, "Code (3)");
+ switch (Code3)
+ {
+ case 0x02 :
+ {
+ Info_B1(Code4, "Code (4)");
+ switch (Code4)
+ {
+ case 0x01 :
+ Skip_B4( "Operational pattern");
+ 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 :
+ {
+ Info_B1(Code4, "Code (4)");
+ switch (Code4)
+ {
+ case 0x01 :
+ Skip_B1( "Format?");
+ Skip_B1( "Essence element count");
+ Skip_B1( "Essence element type");
+ Skip_B1( "Essence element number");
+ break;
+ default :
+ Skip_B4( "Unknown");
+ }
+ }
+ break;
+ default :
+ Skip_B5( "Unknown");
+ }
+ }
+ break;
+ default :
+ Skip_B6( "Unknown");
+ }
+ }
+ break;
+ default :
+ Skip_B7( "Unknown");
+ }
+
+ Value.hi=Value_hi;
+ Value.lo=Value_lo;
+ if (Param)
+ {
+ Param_Info(Param(Value));
+ Element_Info(Param(Value));
+ }
+ Element_End();
+ #endif
+}
+
+//---------------------------------------------------------------------------
+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::Skip_UMID()
+{
+ //Parsing
+ Skip_UUID( "Fixed");
+ Skip_UUID( "UUID");
+}
+
+//---------------------------------------------------------------------------
+void File_Mxf::Get_Timestamp(Ztring &Value)
+{
+ //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_Info(Milliseconds*4, " ms");
+ Value.From_Number(Year);
+ Value+=_T('-');
+ Ztring Temp;
+ Temp.From_Number(Month);
+ if (Temp.size()<2)
+ Temp.insert(Temp.begin(), _T('0'));
+ Value+=Temp;
+ Value+=_T('-');
+ Temp.From_Number(Day);
+ if (Temp.size()<2)
+ Temp.insert(Temp.begin(), _T('0'));
+ Value+=Temp;
+ Value+=_T(' ');
+ Temp.From_Number(Hours);
+ if (Temp.size()<2)
+ Temp.insert(Temp.begin(), _T('0'));
+ Value+=Temp;
+ Value+=_T(':');
+ Temp.From_Number(Minutes);
+ if (Temp.size()<2)
+ Temp.insert(Temp.begin(), _T('0'));
+ Value+=Temp;
+ Value+=_T(':');
+ Temp.From_Number(Seconds);
+ if (Temp.size()<2)
+ Temp.insert(Temp.begin(), _T('0'));
+ Value+=Temp;
+ Value+=_T('.');
+ Temp.From_Number(Milliseconds*4);
+ if (Temp.size()<2)
+ Temp.insert(Temp.begin(), _T('0'));
+ if (Temp.size()<2)
+ Temp.insert(Temp.begin(), _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_Info(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_Info(Milliseconds*4, " ms");
+ Element_Info(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) );
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_MXF_*
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Mxf.h b/src/thirdparty/MediaInfo/Multiple/File_Mxf.h
new file mode 100644
index 000000000..a2b33e0a1
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Mxf.h
@@ -0,0 +1,465 @@
+// File_Mxf - Info for MXF files
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Mxf files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_MxfH
+#define MediaInfo_File_MxfH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include <vector>
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Mxf
+//***************************************************************************
+
+class File_Mxf : public File__Analyze
+{
+public :
+ //Constructor/Destructor
+ File_Mxf();
+
+protected :
+ //Streams management
+ void Streams_Finish ();
+ void Streams_Finish_Preface (int128u PrefaceUID);
+ void Streams_Finish_ContentStorage (int128u ContentStorageUID);
+ void Streams_Finish_Package (int128u PackageUID);
+ void Streams_Finish_Track (int128u TrackUID);
+ void Streams_Finish_Essence (int32u EssenceUID, int128u TrackUID);
+ void Streams_Finish_Descriptor (int128u DescriptorUID);
+ void Streams_Finish_Locator (int128u LocatorUID);
+ void Streams_Finish_Component (int128u ComponentUID, float32 EditRate);
+ void Streams_Finish_Identification (int128u IdentificationUID);
+
+ //Buffer - Global
+ void Read_Buffer_Continue ();
+
+ //Buffer - File header
+ bool FileHeader_Begin();
+
+ //Buffer - Synchro
+ bool Synchronize();
+ bool Synched_Test();
+
+ //Buffer - Per element
+ void Header_Parse();
+ void Data_Parse();
+
+ //Elements
+ void AES3PCMDescriptor();
+ void CDCIEssenceDescriptor();
+ void ClosedHeader();
+ void ClosedCompleteHeader();
+ void CompleteBody();
+ void CompleteFooter();
+ void CompleteHeader();
+ void ContentStorage();
+ void DMSegment();
+ void EssenceContainerData();
+ void EventTrack();
+ void FileDescriptor();
+ void Identification();
+ void IndexTableSegment();
+ void InterchangeObject();
+ void JPEG2000PictureSubDescriptor();
+ void GenerationInterchangeObject();
+ void GenericDescriptor();
+ void GenericPackage();
+ void GenericPictureEssenceDescriptor();
+ void GenericSoundEssenceDescriptor();
+ void GenericTrack();
+ void MaterialPackage();
+ void MPEG2VideoDescriptor();
+ void MultipleDescriptor();
+ void NetworkLocator();
+ void PartitionMetadata();
+ void OpenCompleteBodyPartition();
+ void OpenHeader();
+ void Padding();
+ void Preface();
+ void Primer();
+ void RGBAEssenceDescriptor();
+ void RandomIndexMetadata();
+ void Sequence();
+ void SourceClip();
+ void SourcePackage();
+ void StaticTrack();
+ void StructuralComponent();
+ void TextLocator();
+ void TimecodeComponent();
+ void Track();
+ void WaveAudioDescriptor();
+
+ //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 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 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_IndexEditRate(); //3F0B
+ void IndexTableSegment_IndexStartPosition(); //3F0C
+ void IndexTableSegment_IndexDuration(); //3F0D
+ void IndexTableSegment_PosTableCount(); //3F0E
+ 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 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 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
+
+ //Basic types
+ void Get_Rational(float32 &Value);
+ void Skip_Rational();
+ void Info_Rational();
+ void Get_Timestamp (Ztring &Value);
+ void Skip_Timestamp();
+ void Info_Timestamp();
+ void Skip_UMID ();
+
+ void Get_UL (int128u &Value, const char* Name, const char* (*Param) (int128u));
+ void Skip_UL(const char* Name);
+ #define Info_UL(_INFO, _NAME, _PARAM) int128u _INFO; Get_UL(_INFO, _NAME, _PARAM)
+
+ size_t Streams_Count;
+ int128u Code;
+ int128u OperationalPattern;
+ int128u InstanceUID;
+ int64u Buffer_DataSizeToParse;
+ int64u Buffer_DataSizeToParse_Complete;
+ int16u Code2;
+ int16u Length2;
+ int64u File_Size_Total; //Used only in Finish()
+ bool Track_Number_IsAvailable;
+
+ //Primer
+ std::map<int16u, int128u> Primer_Values;
+
+ //Preface
+ struct preface
+ {
+ int128u PrimaryPackage;
+ std::vector<int128u> Identifications;
+ int128u ContentStorage;
+
+ preface()
+ {
+ PrimaryPackage.hi=(int64u)-1;
+ PrimaryPackage.lo=(int64u)-1;
+ ContentStorage.hi=(int64u)-1;
+ ContentStorage.lo=(int64u)-1;
+ }
+ };
+ typedef std::map<int128u, preface> prefaces; //Key is InstanceUID of preface
+ prefaces Prefaces;
+ int128u Preface_Current;
+
+ //Identification
+ struct identification
+ {
+ Ztring CompanyName;
+ Ztring ProductName;
+ Ztring ProductVersion;
+ Ztring VersionString;
+ std::map<std::string, Ztring> Infos;
+ };
+ typedef std::map<int128u, identification> identifications; //Key is InstanceUID of identification
+ identifications Identifications;
+
+ //ContentStorage
+ struct contentstorage
+ {
+ std::vector<int128u> Packages;
+ };
+ typedef std::map<int128u, contentstorage> contentstorages; //Key is InstanceUID of ContentStorage
+ contentstorages ContentStorages;
+
+ //Package
+ struct package
+ {
+ int128u Descriptor;
+ std::vector<int128u> Tracks;
+ bool IsSourcePackage;
+
+ package()
+ {
+ Descriptor=0;
+ IsSourcePackage=false;
+ }
+ };
+ typedef std::map<int128u, package> packages; //Key is InstanceUID of package
+ packages Packages;
+
+ //Track
+ struct track
+ {
+ int128u Sequence;
+ int32u TrackID;
+ int32u TrackNumber;
+ float32 EditRate;
+ bool Stream_Finish_Done;
+
+ track()
+ {
+ Sequence=0;
+ TrackID=(int32u)-1;
+ TrackNumber=(int32u)-1;
+ EditRate=0.000;
+ Stream_Finish_Done=false;
+ }
+ };
+ typedef std::map<int128u, track> tracks; //Key is InstanceUID of the track
+ tracks Tracks;
+
+ //Essence
+ struct essence
+ {
+ stream_t StreamKind;
+ size_t StreamPos;
+ File__Analyze* Parser;
+ std::map<std::string, Ztring> 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
+
+ essence()
+ {
+ StreamKind=Stream_Max;
+ StreamPos=(size_t)-1;
+ Parser=NULL;
+ Stream_Size=(int64u)-1;
+ TrackID=(int32u)-1;
+ TrackID_WasLookedFor=false;
+ Stream_Finish_Done=false;
+ Track_Number_IsMappedToTrack=false;
+ }
+
+ ~essence()
+ {
+ delete Parser; //Parser=NULL;
+ }
+ };
+ typedef std::map<int32u, essence> essences; //Key is TrackNumber
+ essences Essences;
+
+ //Descriptor
+ struct descriptor
+ {
+ std::vector<int128u> SubDescriptors;
+ std::vector<int128u> Locators;
+
+ stream_t StreamKind;
+ float32 SampleRate;
+ int128u InstanceUID;
+ int32u LinkedTrackID;
+ int32u Width;
+ int32u Height;
+ std::map<std::string, Ztring> Infos;
+
+ descriptor()
+ {
+ StreamKind=Stream_Max;
+ SampleRate=0;
+ InstanceUID.hi=(int64u)-1;
+ InstanceUID.lo=(int64u)-1;
+ LinkedTrackID=(int32u)-1;
+ Width=(int32u)-1;
+ Height=(int32u)-1;
+ }
+ };
+ typedef std::map<int128u, descriptor> descriptors; //Key is InstanceUID of Descriptor
+ descriptors Descriptors;
+
+ //Locator
+ struct locator
+ {
+ Ztring EssenceLocator;
+ };
+ typedef std::map<int128u, locator> locators; //Key is InstanceUID of the locator
+ locators Locators;
+
+ //Component (Sequence, TimeCode, Source Clip)
+ struct component
+ {
+ int64u Duration;
+
+ component()
+ {
+ Duration=0;
+ }
+ };
+ typedef std::map<int128u, component> components; //Key is InstanceUID of the component
+ components Components;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Nut.cpp b/src/thirdparty/MediaInfo/Multiple/File_Nut.cpp
new file mode 100644
index 000000000..a58825960
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Nut.cpp
@@ -0,0 +1,294 @@
+// File_Nut - Info for Nut files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Source: http://svn.mplayerhq.hu/nut/docs/nut.txt?view=markup
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_Begin("Nut header", 25);
+ std::string file_id_string;
+ Get_String(25, file_id_string, "file_id_string");
+ Element_End();
+
+ 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; i<time_base_count; i++)
+ {
+ Skip_VS( "time_base_num");
+ Skip_VS( "time_base_denom");
+ //time_base[i]= time_base_num/time_base_denom
+ }
+ int64u tmp_mul=1, tmp_stream=0;
+ int64s tmp_pts=0;
+ for(int16u i=0; i<256;)
+ {
+ int64u tmp_fields, tmp_size, tmp_res, count;
+ Skip_VS( "tmp_flag");
+ Get_VS (tmp_fields, "tmp_fields");
+ if(tmp_fields>0)
+ 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<tmp_fields; j++)
+ Skip_VS( "tmp_reserved[i]");
+
+ for(int64u j=0; j<count && i<256; j++, i++)
+ {
+ if (i == 'N')
+ {
+ //flags[i]= FLAG_INVALID;
+ j--;
+ continue;
+ }
+ //flags[i]= tmp_flag;
+ //stream_id[i]= tmp_stream;
+ //data_size_mul[i]= tmp_mul;
+ //data_size_lsb[i]= tmp_size + j;
+ //pts_delta[i]= tmp_pts;
+ //reserved_count[i]= tmp_res;
+ }
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Nut::stream()
+{
+ Element_Name("stream");
+
+ //Parsing
+ int64u stream_class, fourcc_length, codec_specific_data_length;
+ Skip_VS( "stream_id");
+ Get_VS (stream_class, "stream_class");
+ Get_VS (fourcc_length, "fourcc length");
+ switch (fourcc_length)
+ {
+ case 2 : Skip_C2( "fourcc"); break;
+ case 4 : Skip_C4( "fourcc"); break;
+ default: Skip_XX(fourcc_length, "fourcc");
+ }
+ Skip_VS( "time_base_id");
+ Skip_VS( "msb_pts_shift");
+ Skip_VS( "max_pts_distance");
+ Skip_VS( "decode_delay");
+ Skip_VS( "stream_flags");
+ Get_VS (codec_specific_data_length, "codec_specific_data length");
+ Skip_XX(codec_specific_data_length, "codec_specific_data");
+ switch (stream_class)
+ {
+ case 0 : //video
+ {
+ Skip_VS( "width");
+ Skip_VS( "height");
+ Skip_VS( "sample_width");
+ Skip_VS( "sample_height");
+ Skip_VS( "colorspace_type");
+ }
+ break;
+ case 1 : //audio
+ {
+ Skip_VS( "samplerate_num");
+ Skip_VS( "samplerate_denom");
+ Skip_VS( "channel_count");
+ }
+ break;
+ case 2 : //subtitles
+ {
+ }
+ break;
+ case 3 : //userdata
+ {
+ }
+ break;
+ default: ;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Nut::syncpoint()
+{
+ Element_Name("syncpoint");
+}
+
+//---------------------------------------------------------------------------
+void File_Nut::index()
+{
+ Element_Name("index");
+}
+
+//---------------------------------------------------------------------------
+void File_Nut::info()
+{
+ Element_Name("info");
+}
+
+*/
+
+}
+
+#endif //MEDIAINFO_NUT_YES
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Nut.h b/src/thirdparty/MediaInfo/Multiple/File_Nut.h
new file mode 100644
index 000000000..ccfc4f194
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Nut.h
@@ -0,0 +1,59 @@
+// File_Nut - Info for Nut files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Nut files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_NutH
+#define MediaInfo_File_NutH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Nut
+//***************************************************************************
+
+class File_Nut : public File__Analyze
+{
+private :
+ //Buffer
+ void Header_Parse();
+ void FileHeader_Parse();
+ void Data_Parse();
+
+ //Elements
+ void main();
+ void stream();
+ void syncpoint();
+ void index();
+ void info();
+};
+
+} //NameSpace
+
+#endif
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Ogg.cpp b/src/thirdparty/MediaInfo/Multiple/File_Ogg.cpp
new file mode 100644
index 000000000..29c35bfbd
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Ogg.cpp
@@ -0,0 +1,394 @@
+// File_Ogg - Info for ogg files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_OGG_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Multiple/File_Ogg.h"
+#include "MediaInfo/Multiple/File_Ogg_SubElement.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Ogg::File_Ogg()
+:File__Analyze()
+{
+ //Configuration
+ MustSynchronize=true;
+ Buffer_TotalBytes_FirstSynched_Max=64*1024;
+
+ //In
+ SizedBlocks=false;
+ XiphLacing=false;
+
+ //Temp - Global
+ StreamsToDo=0;
+ Parsing_End=false;
+
+ //Temp - Stream
+ Chunk_Sizes_Finished=true;
+ packet_type=0;
+ continued=false;
+ eos=false;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Ogg::Streams_Fill()
+{
+ std::map<int64u, stream>::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<int64u, stream>::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)
+ {
+ if (CC4(Buffer+Buffer_Offset)==0x4F676753) //"OggS"
+ break;
+ 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; Pos<page_segments; Pos++)
+ Size+=CC1(Buffer+Buffer_Offset+27+Pos);
+
+ //Testing
+ if (Buffer_Offset+27+page_segments+Size+4>Buffer_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; Pos<CountMinus1; Pos++)
+ {
+ int32u Size=0;
+ int8u Size8;
+ do
+ {
+ Get_B1 (Size8, "Size");
+ Size+=Size8;
+ }
+ while (Size8==0xFF);
+ Param_Info(Size);
+ Chunk_Sizes.push_back(Size);
+ UsedSize+=Size;
+ }
+ Chunk_Sizes.push_back((size_t)(Element_Size-UsedSize-1));
+ }
+
+ Header_Fill_Size(Element_Size);
+ Header_Fill_Code(0, Ztring::ToZtring(0, 16));
+ return;
+ }
+
+ //Parsing
+ int64u absolute_granule_position;
+ int32u stream_serial_number, page_sequence_no;
+ int16u total_page_size;
+ int8u stream_structure_version, flags, page_segments, packet_lacing_value;
+ Skip_C4( "capture_pattern");
+ Get_L1 (stream_structure_version, "stream_structure_version");
+ Get_L1 (flags, "header_type_flag");
+ Get_Flags (flags, 0, continued, "continued packet");
+ Skip_Flags(flags, 1, "first page of logical bitstream (bos)");
+ Get_Flags (flags, 2, eos, "last page of logical bitstream (eos)");
+ Get_L8 (absolute_granule_position, "absolute granule position");
+ Get_L4 (stream_serial_number, "stream serial number");
+ Get_L4 (page_sequence_no, "page sequence no");
+ Skip_L4( "page checksum");
+ Get_L1 (page_segments, "page_segments");
+ total_page_size=0;
+ Chunk_Sizes.clear();
+ Chunk_Sizes.push_back(0);
+ for (int8u Pos=0; Pos<page_segments; Pos++)
+ {
+ Get_L1 (packet_lacing_value, "packet lacing value");
+ total_page_size+=packet_lacing_value;
+ Chunk_Sizes[Chunk_Sizes.size()-1]+=packet_lacing_value;
+ if (packet_lacing_value!=0xFF)
+ {
+ Chunk_Sizes.push_back(0);
+ Chunk_Sizes_Finished=true;
+ }
+ else
+ Chunk_Sizes_Finished=false;
+ }
+ if (Chunk_Sizes_Finished)
+ Chunk_Sizes.resize(Chunk_Sizes.size()-1); //Keep out the last value
+
+ //Filling
+ Header_Fill_Size(27+page_segments+total_page_size);
+ Header_Fill_Code(stream_serial_number, Ztring::ToZtring(stream_serial_number, 16));
+ Stream[stream_serial_number].absolute_granule_position=absolute_granule_position;
+}
+
+//---------------------------------------------------------------------------
+void File_Ogg::Data_Parse()
+{
+ //If first chunk of a stream
+ if (Stream[Element_Code].Parser==NULL)
+ {
+ if (Parsing_End)
+ return; //Maybe multitracks concatained, not supported
+ Stream[Element_Code].Parser=new File_Ogg_SubElement;
+ Open_Buffer_Init(Stream[Element_Code].Parser);
+ ((File_Ogg_SubElement*)Stream[Element_Code].Parser)->InAnotherContainer=SizedBlocks|SizedBlocks;
+ StreamsToDo++;
+ }
+ ((File_Ogg_SubElement*)Stream[Element_Code].Parser)->MultipleStreams=Stream.size()>1; //has no sens for the first init, must check allways
+
+ //Parsing
+ File_Ogg_SubElement* Parser=(File_Ogg_SubElement*)Stream[Element_Code].Parser;
+ if (Stream[Element_Code].SearchingPayload)
+ //For each chunk
+ for (size_t Chunk_Sizes_Pos=0; Chunk_Sizes_Pos<Chunk_Sizes.size(); Chunk_Sizes_Pos++)
+ {
+ //Info
+ if (!continued)
+ Peek_L1(packet_type); //Only for information
+ Element_Info(Ztring::ToZtring(packet_type, 16));
+ if (continued)
+ Element_Info("Continue");
+
+ //Parsing
+ if (continued || Parser->File_Offset!=Parser->File_Size)
+ Open_Buffer_Continue(Parser, Buffer+Buffer_Offset+(size_t)Element_Offset, Chunk_Sizes[Chunk_Sizes_Pos]);
+ if (Chunk_Sizes_Pos<Chunk_Sizes.size()-1
+ || (Chunk_Sizes_Pos==Chunk_Sizes.size()-1 && Chunk_Sizes_Finished))
+ {
+ Open_Buffer_Continue(Parser, Buffer+Buffer_Offset, 0); //Purge old datas
+ }
+
+ Element_Offset+=Chunk_Sizes[Chunk_Sizes_Pos];
+ continued=false; //If there is another chunk, this can not be a continued chunk
+ if (Parser->File_GoTo!=(int64u)-1)
+ Chunk_Sizes_Pos=Chunk_Sizes.size();
+
+ if (!Status[IsAccepted] && Parser->Status[IsAccepted])
+ Accept("OGG");
+ if (Parser->Status[IsFinished] || (Element_Offset==Element_Size && eos))
+ {
+ StreamsToDo--;
+ Stream[Element_Code].SearchingPayload=false;
+ break;
+ }
+
+ }
+ else
+ Skip_XX(Element_Size, "Data");
+
+ //End of stream
+ if (!Parsing_End &&
+ (StreamsToDo==0 || File_Offset+Buffer_Offset+Element_Offset>256*1024))
+ {
+ if (IsSub)
+ Finish("OGG");
+ else
+ GoToFromEnd(256*1024, "OGG");
+ std::map<int64u, stream>::iterator Stream_Temp=Stream.begin();
+ if (File_GoTo!=(int64u)-1)
+ while (Stream_Temp!=Stream.end())
+ {
+ Stream_Temp->second.absolute_granule_position=0;
+ Stream_Temp++;
+ }
+ Parsing_End=true;
+ }
+
+ Element_Show();
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_OGG_YES
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Ogg.h b/src/thirdparty/MediaInfo/Multiple/File_Ogg.h
new file mode 100644
index 000000000..5b5f0c84d
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Ogg.h
@@ -0,0 +1,110 @@
+// File_Ogg - Info for ogg files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Ogg files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_OggH
+#define MediaInfo_File_OggH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include <map>
+//---------------------------------------------------------------------------
+
+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<int64u, stream> Stream;
+ std::vector<size_t> Chunk_Sizes;
+ bool Chunk_Sizes_Finished;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Ogg_SubElement.cpp b/src/thirdparty/MediaInfo/Multiple/File_Ogg_SubElement.cpp
new file mode 100644
index 000000000..33b510529
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Ogg_SubElement.cpp
@@ -0,0 +1,893 @@
+// File_Ogg_SubElement - Info for OGG files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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 <cmath>
+#include <memory>
+#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_FLAC_YES)
+ #include "MediaInfo/Audio/File_Flac.h"
+#endif
+#if defined(MEDIAINFO_MPEGA_YES)
+ #include "MediaInfo/Audio/File_Mpega.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##UL; \
+ 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(KW_DIRAC, 4B572D44, 49524143, 8)
+ OGG_ID(OggMIDI, 4D67674D, 49444900, 8)
+ OGG_ID(MNG, 8A4D4E47, 0D0A1A0A, 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
+ int64u SamplesCount;
+ int32u SamplesCount4;
+ int16u SamplesCount2;
+ int8u SamplesCount1, Type;
+ bool lenbytes0, lenbytes1, lenbytes2;
+ if (Identified && WithType)
+ {
+ 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)
+ //Get_L7 (SamplesCount, "SamplesCount");
+ Element_Offset+=7;
+ else
+ //Get_L6 (SamplesCount, "SamplesCount");
+ Element_Offset+=6;
+ }
+ else
+ {
+ if (lenbytes0)
+ //Get_L5 (SamplesCount, "SamplesCount");
+ Element_Offset+=5;
+ else
+ {
+ Get_L4 (SamplesCount4, "SamplesCount");
+ SamplesCount=SamplesCount4;
+ }
+ }
+ }
+ else
+ {
+ if (lenbytes1)
+ {
+ if (lenbytes0)
+ {
+ Get_L3 (SamplesCount4, "SamplesCount");
+ SamplesCount=SamplesCount4;
+ }
+ else
+ {
+ Get_L2 (SamplesCount2, "SamplesCount");
+ SamplesCount=SamplesCount2;
+ }
+ }
+ else
+ {
+ if (lenbytes0)
+ {
+ Get_L1 (SamplesCount1, "SamplesCount");
+ SamplesCount=SamplesCount1;
+ }
+ //else
+ // Get_L0 (SamplesCount, "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(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, "Unkown");
+ 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__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
+}
+
+//---------------------------------------------------------------------------
+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_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_Info("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_Offset<Element_Size)
+ Skip_XX(Element_Size-Element_Offset, "Unknown");
+
+ //Filling
+ Stream_Prepare(Stream_Video);
+ CodecID_Fill(Ztring().From_CC4(fccHandler), Stream_Video, StreamPos_Last, InfoCodecID_Format_Riff);
+ Fill(Stream_Video, StreamPos_Last, Video_Codec, Ztring().From_CC4(fccHandler));
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate, (float)10000000/(float)TimeUnit, 3);
+ Fill(Stream_Video, StreamPos_Last, Video_Width, Width);
+ Fill(Stream_Video, StreamPos_Last, Video_Height, Height);
+
+ //Creating the parser
+ if (0);
+ #if defined(MEDIAINFO_MPEG4V_YES)
+ else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(fccHandler))==_T("MPEG-4 Visual"))
+ {
+ Parser=new File_Mpeg4v;
+ ((File_Mpeg4v*)Parser)->FrameIsAlwaysComplete=true;
+ }
+ #endif
+}
+
+//---------------------------------------------------------------------------
+void File_Ogg_SubElement::Identification_audio()
+{
+ Element_Info("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_Offset<Element_Size)
+ Skip_XX(Element_Size-Element_Offset, "Unknown");
+
+ //Filling
+ Stream_Prepare(Stream_Audio);
+ Ztring Codec; Codec.From_CC4(fccHandler);
+ Codec.TrimLeft(_T('0'));
+ CodecID_Fill(Codec, Stream_Audio, StreamPos_Last, InfoCodecID_Format_Riff);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Codec);
+ if (AvgBytesPerSec<0x80000000) //This is a signed value, and negative values are not OK
+ Fill(Stream_Audio, StreamPos_Last, Audio_BitRate, AvgBytesPerSec*8);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Channels==5?6:Channels); //5 channels are 5.1
+ Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, SamplesPerUnit);
+ absolute_granule_position_Resolution=SamplesPerUnit;
+
+ //Creating the parser
+ if (0);
+ #if defined(MEDIAINFO_MPEGA_YES)
+ else if (MediaInfoLib::Config.Codec_Get(Codec, InfoCodec_KindofCodec).find(_T("MPEG-"))==0)
+ {
+ Parser=new File_Mpega;
+ }
+ #endif
+ #if defined(MEDIAINFO_AC3_YES)
+ else if (fccHandler==0x32303030)
+ {
+ Parser=new File_Ac3;
+ ((File_Ac3*)Parser)->Frame_Count_Valid=2;
+ }
+ #endif
+}
+
+//---------------------------------------------------------------------------
+void File_Ogg_SubElement::Identification_text()
+{
+ Element_Info("Text");
+
+ //Parsing
+ Skip_B1 ( "Signature");
+ Skip_Local(6, "Signature");
+ Skip_L2( "Reserved");
+ if (Element_Offset<Element_Size)
+ Skip_XX(Element_Size-Element_Offset, "Unknown");
+
+ //Filling
+ Stream_Prepare(Stream_Text);
+ Fill(Stream_Text, StreamPos_Last, Text_Format, "Subrip");
+ Fill(Stream_Text, StreamPos_Last, Text_Codec, "Subrip");
+}
+
+//---------------------------------------------------------------------------
+void File_Ogg_SubElement::Identification_fLaC()
+{
+ #if defined(MEDIAINFO_FLAC_YES)
+ Parser=new File_Flac;
+ StreamKind_Last=Stream_Audio;
+ #endif
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, 0, Audio_Format, "FLAC");
+ Fill(Stream_Audio, 0, Audio_Codec, "FLAC");
+ Fill(Stream_Audio, 0, Audio_MuxingMode, "pre-FLAC 1.1.1");
+ WithType=false;
+}
+
+//---------------------------------------------------------------------------
+void File_Ogg_SubElement::Identification_fishead()
+{
+ //Quick workaroud for Identification bool
+ if (Element_Offset==Element_Size)
+ return;
+
+ Element_Info("Skeleton");
+
+ //Parsing
+ int16u VersionMajor;
+ Skip_Local(7, "Signature");
+ Skip_B1 ( "Signature");
+ Get_L2 (VersionMajor, "Version major");
+ if (VersionMajor==3)
+ {
+ Skip_L2( "Version minor");
+ Skip_L8( "Presentationtime numerator");
+ Skip_L8( "Presentationtime denominator");
+ Skip_L8( "Basetime numerator");
+ Skip_L8( "Basetime denominator");
+ Skip_L16( "UTC");
+ Skip_L4( "UTC");
+ }
+ if (Element_Offset<Element_Size)
+ Skip_XX(Element_Size-Element_Offset, "Unknown");
+}
+
+//---------------------------------------------------------------------------
+void File_Ogg_SubElement::Identification_fisbone()
+{
+ //Quick workaroud for Identification bool
+ if (Element_Offset==Element_Size)
+ return;
+
+ Element_Info("Skeleton");
+
+ //Parsing
+ int32u Offset;
+ Skip_Local(7, "Signature");
+ Skip_B1 ( "Signature");
+ Get_L4 (Offset, "Offset to message header fields");
+ Skip_L4( "Serial number");
+ Skip_L4( "Number of header packets");
+ Skip_L8( "Granulerate numerator");
+ Skip_L8( "Granulerate denominator");
+ Skip_L8( "Basegranule");
+ Skip_L4( "Preroll");
+ Skip_L1( "Granuleshift");
+ if (Element_Offset<8+Offset)
+ Skip_XX(8+Offset-Element_Offset, "Unknown");
+ if (Element_Offset<Element_Size)
+ Skip_Local(Element_Size-Element_Offset, "Unknown");
+}
+
+//---------------------------------------------------------------------------
+void File_Ogg_SubElement::Comment()
+{
+ Element_Name("Comment");
+
+ //Integrity
+ if (Element_Size<8)
+ return;
+
+ //Parsing
+ int64u ID_Identification;
+ Peek_B8(ID_Identification);
+
+ #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)&0x00FFFFFFFFFFFFFFLL)<<8))
+
+ #else //__BORLANDC__
+ #define ELEMENT_CASE(_NAME) \
+ else if (ID_Identification>>(64-8*Elements::Identifier_##_NAME##3)==((Elements::Identifier_##_NAME&0x00FFFFFFFFFFFFFFLL)<<8))
+
+ #endif //__BORLANDC__
+
+ int32u ID_Identification_Size;
+ if (0) ;
+ ELEMENT_CASE(kate) ID_Identification_Size=8;
+ else ID_Identification_Size=6; //Default
+ 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)
+ {
+ Open_Buffer_Continue(Parser);
+ if (Identified && Parser->Status[IsFilled])
+ Finish("OggSubElement");
+ }
+ else if (Element_Offset<Element_Size)
+ {
+ Skip_XX(Element_Size-Element_Offset, "Unknown");
+ if (Identified)
+ Finish("OggSubElement");
+ }
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_OGG_YES
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Ogg_SubElement.h b/src/thirdparty/MediaInfo/Multiple/File_Ogg_SubElement.h
new file mode 100644
index 000000000..379bf7c00
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Ogg_SubElement.h
@@ -0,0 +1,102 @@
+// File_Ogg_SubElement - Info for OGG files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about MPEG Transport Stream files, Program Map Section
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_Ogg_Setup_VorbisH
+#define MediaInfo_Ogg_Setup_VorbisH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Ogg_SubElement
+//***************************************************************************
+
+class File_Ogg_SubElement : public File__Analyze
+{
+public :
+ //In
+ stream_t StreamKind;
+ bool MultipleStreams;
+ bool InAnotherContainer;
+ int64u absolute_granule_position_Resolution;
+
+protected :
+ //Streams management
+ void Streams_Fill();
+ void Streams_Finish();
+
+ //Buffer - File header
+ void FileHeader_Parse ();
+
+public :
+ File_Ogg_SubElement();
+ ~File_Ogg_SubElement();
+
+private :
+ //Buffer
+ bool Header_Begin();
+ void Header_Parse();
+ void Data_Parse();
+
+ //Elements
+ void Identification();
+ void Identification_CELT();
+ void Identification_CMML();
+ void Identification_BBCD();
+ void Identification_FLAC();
+ void Identification_JNG();
+ void Identification_kate();
+ void Identification_KW_DIRAC();
+ void Identification_OggMIDI();
+ void Identification_MNG();
+ void Identification_PCM();
+ void Identification_PNG();
+ void Identification_Speex();
+ void Identification_theora();
+ void Identification_vorbis();
+ void Identification_YUV4MPEG();
+ void Identification_video();
+ void Identification_audio();
+ void Identification_text();
+ void Identification_fLaC();
+ void Identification_fishead();
+ void Identification_fisbone();
+ void Comment();
+ void Default();
+
+ //Temp
+ File__Analyze* Parser;
+ size_t OldSize;
+ bool Identified;
+ bool WithType;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Multiple/File_P2_Clip.cpp b/src/thirdparty/MediaInfo/Multiple/File_P2_Clip.cpp
new file mode 100644
index 000000000..a55b14ce1
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_P2_Clip.cpp
@@ -0,0 +1,379 @@
+// File_P2_Clip - Info for P2 Clip (XML) files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_P2_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Multiple/File_P2_Clip.h"
+#include "MediaInfo/MediaInfo.h"
+#include "MediaInfo/MediaInfo_Internal.h"
+#include "ZenLib/Dir.h"
+#include "ZenLib/FileName.h"
+#include "ZenLib/TinyXml/tinyxml.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Buffer - File header
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_P2_Clip::FileHeader_Begin()
+{
+ //Element_Size
+ if (File_Size>64*1024)
+ {
+ Reject("P2_Clip");
+ return false; //P2_Clip XML files are not big
+ }
+
+ //Element_Size
+ if (Buffer_Size<5)
+ return false; //Must wait for more data
+
+ //XML header
+ if (Buffer[0]!='<'
+ || Buffer[1]!='?'
+ || Buffer[2]!='x'
+ || Buffer[3]!='m'
+ || Buffer[4]!='l')
+ {
+ Reject("P2_Clip");
+ return false;
+ }
+
+ TiXmlDocument document(File_Name.To_Local());
+ if (document.LoadFile())
+ {
+ TiXmlElement* Root=document.FirstChildElement("P2Main");
+ if (Root)
+ {
+ Accept("P2_Clip");
+ Fill(Stream_General, 0, General_Format, "P2 Clip");
+
+ TiXmlElement* ClipContent=Root->FirstChildElement("ClipContent");
+ if (ClipContent)
+ {
+ TiXmlElement* 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
+ TiXmlElement* EssenceList=ClipContent->FirstChildElement("EssenceList");
+ int64u File_Size_Total=File_Size;
+ if (EssenceList)
+ {
+ TiXmlElement* Track=EssenceList->FirstChildElement();
+ while (Track)
+ {
+ string Field=Track->ValueStr();
+ if (Field=="Video")
+ {
+ Stream_Prepare(Stream_Video);
+
+ //CreationDate
+ ChildElement=Track->FirstChildElement("StartTimecode");
+ if (ChildElement)
+ {
+ string Text=ChildElement->GetText();
+ if (Text.size()==11)
+ {
+ int32u 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;
+ ChildElement=Track->FirstChildElement("FrameRate");
+ if (ChildElement)
+ {
+ Ztring FrameRateS=Ztring(ChildElement->GetText());
+ float32 FrameRate=FrameRateS.To_float32();
+ if (FrameRateS.find('i')!=string::npos)
+ FrameRate/=2;
+ if (FrameRate)
+ ToFill+=float32_int32s(((Text[9]-'0')*10+(Text[10]-'0'))*1000/FrameRate);
+ }
+ Fill(Stream_Video, 0, Video_Delay, ToFill);
+ }
+ }
+
+ #if defined(MEDIAINFO_MXF_YES)
+ if (File_Name.size()>10+1+4
+ && File_Name[File_Name.size()-10-1]==PathSeparator
+ && File_Name[File_Name.size()-10-2]==_T('P')
+ && File_Name[File_Name.size()-10-3]==_T('I')
+ && File_Name[File_Name.size()-10-4]==_T('L')
+ && File_Name[File_Name.size()-10-5]==_T('C'))
+ {
+ Ztring file=File_Name.substr(File_Name.size()-10, 6);
+ Ztring MXF_File=File_Name;
+ MXF_File.resize(MXF_File.size()-(10+1+4));
+ MXF_File+=_T("VIDEO");
+ MXF_File+=PathSeparator;
+ MXF_File+=file;
+ MXF_File+=_T(".MXF");
+
+ //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, Stream_Video, 0, StreamPos_Last);
+ 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), true);
+ Fill(Stream_General, 0, General_Format_Commercial, _T("P2 Clip ")+MI.Get(Stream_General, 0, General_Format_Commercial_IfAny), true);
+ }
+ //else
+ // MediaInfo::Option_Static(_T("ReadByHuman"), ReadByHuman?_T("1"):_T("0"));
+ }
+ #endif //defined(MEDIAINFO_MXF_YES)
+ }
+ else if (Field=="Audio")
+ {
+ Stream_Prepare(Stream_Audio);
+
+ #if defined(MEDIAINFO_MXF_YES)
+ if (File_Name.size()>10+1+4
+ && File_Name[File_Name.size()-10-1]==PathSeparator
+ && File_Name[File_Name.size()-10-2]==_T('P')
+ && File_Name[File_Name.size()-10-3]==_T('I')
+ && File_Name[File_Name.size()-10-4]==_T('L')
+ && File_Name[File_Name.size()-10-5]==_T('C'))
+ {
+ Ztring file=File_Name.substr(File_Name.size()-10, 6);
+ Ztring MXF_File=File_Name;
+ MXF_File.resize(MXF_File.size()-(10+1+4));
+ MXF_File+=_T("AUDIO");
+ MXF_File+=PathSeparator;
+ MXF_File+=file;
+ Ztring Pos=Ztring::ToZtring(StreamPos_Last);
+ if (Pos.size()<2)
+ Pos.insert(0, 1, _T('0'));
+ MXF_File+=Pos;
+ MXF_File+=_T(".MXF");
+
+ //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, Stream_Audio, 0, StreamPos_Last);
+ Fill(Stream_Audio, StreamPos_Last, "Source", MXF_File);
+ File_Size_Total+=Ztring(MI.Get(Stream_General, 0, General_FileSize)).To_int64u();
+ }
+ //else
+ // MediaInfo::Option_Static(_T("ReadByHuman"), ReadByHuman?_T("1"):_T("0"));
+ }
+ #endif //defined(MEDIAINFO_MXF_YES)
+ }
+
+ Track=Track->NextSiblingElement();
+ }
+
+ if (File_Size_Total!=File_Size)
+ Fill(Stream_General, 0, General_FileSize, File_Size_Total, 10, true);
+ }
+
+ //ClipMetadata
+ TiXmlElement* ClipMetadata=ClipContent->FirstChildElement("ClipMetadata");
+ if (ClipMetadata)
+ {
+ TiXmlElement* 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);
+ }
+ }
+
+ TiXmlElement* Device=ClipMetadata->FirstChildElement("Device");
+ if (Device)
+ {
+ //Manufacturer+ModelName
+ TiXmlElement* Manufacturer=Device->FirstChildElement("Manufacturer");
+ TiXmlElement* ModelName=Device->FirstChildElement("ModelName");
+ if (Manufacturer && ModelName)
+ Fill(Stream_General, 0, General_Encoded_Application, string(Manufacturer->GetText())+" "+ModelName->GetText());
+ }
+
+ TiXmlElement* 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
+ TiXmlElement* Location=Shoot->FirstChildElement("Location");
+ if (Location)
+ {
+ //Longitude+Latitude
+ TiXmlElement* Longitude=Location->FirstChildElement("Longitude");
+ TiXmlElement* Latitude=Location->FirstChildElement("Latitude");
+ if (Longitude && Latitude)
+ Fill(Stream_General, 0, General_Recorded_Location, string(Latitude->GetText())+", "+Longitude->GetText());
+ }
+ }
+
+ TiXmlElement* 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());
+ }
+
+ TiXmlElement* 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;
+ }
+ }
+ else
+ {
+ Reject("P2_Clip");
+ return false;
+ }
+
+ //All should be OK...
+ return true;
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_P2_YES
diff --git a/src/thirdparty/MediaInfo/Multiple/File_P2_Clip.h b/src/thirdparty/MediaInfo/Multiple/File_P2_Clip.h
new file mode 100644
index 000000000..a94bbdd48
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_P2_Clip.h
@@ -0,0 +1,50 @@
+// File_P2_Clip - Info for P2 Clip (XML) files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about P2 Clip files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_P2_ClipH
+#define MediaInfo_File_P2_ClipH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_P2_Clip
+//***************************************************************************
+
+class File_P2_Clip : public File__Analyze
+{
+private :
+ //Buffer - File header
+ bool FileHeader_Begin();
+};
+
+} //NameSpace
+
+#endif
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Riff.cpp b/src/thirdparty/MediaInfo/Multiple/File_Riff.cpp
new file mode 100644
index 000000000..cd261192d
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Riff.cpp
@@ -0,0 +1,660 @@
+// File_Riff - Info for RIFF files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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 <ZenLib/Utils.h>
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Const
+//***************************************************************************
+
+namespace Elements
+{
+ 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]=17;
+ #endif //MEDIAINFO_EVENTS
+ DataMustAlwaysBeComplete=false;
+
+ //Data
+ Interleaved0_1=0;
+ Interleaved0_10=0;
+ Interleaved1_1=0;
+ Interleaved1_10=0;
+
+ //Temp
+ WAVE_data_Size=0xFFFFFFFF;
+ WAVE_fact_samplesCount=0xFFFFFFFF;
+ Buffer_DataSizeToParse=0;
+ avih_FrameRate=0;
+ avih_TotalFrame=0;
+ dmlh_TotalFrame=0;
+ Idx1_Offset=(int64u)-1;
+ movi_Size=0;
+ TimeReference=(int64u)-1;
+ SMV_BlockSize=0;
+ stream_Count=0;
+ rec__Present=false;
+ NeedOldIndex=true;
+ IsBigEndian=false;
+ IsWave64=false;
+ IsRIFF64=false;
+ IsWaveBroken=false;
+ SecondPass=false;
+ DV_FromHeader=NULL;
+ #if defined(MEDIAINFO_GXF_YES)
+ rcrd_Parsers_Count=0;
+ #if defined(MEDIAINFO_CDP_YES)
+ Cdp_Data=NULL;
+ #endif //MEDIAINFO_CDP_YES
+ #if defined(MEDIAINFO_AFDBARDATA_YES)
+ Cdp_Data=NULL;
+ #endif //MEDIAINFO_AFDBARDATA_YES
+ #endif //MEDIAINFO_GXF_YES
+
+ //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
+
+ #if defined(MEDIAINFO_GXF_YES)
+ for (size_t DataID=0; DataID<rcrd_Parsers.size(); DataID++)
+ for (size_t SecondaryDataID=0; SecondaryDataID<rcrd_Parsers[DataID].size(); SecondaryDataID++)
+ delete rcrd_Parsers[DataID][SecondaryDataID]; //rcrd_Parsers[DataID][SecondaryDataID]=NULL;
+ #endif //MEDIAINFO_GXF_YES
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Riff::Streams_Finish ()
+{
+ //Global
+ if (IsRIFF64)
+ Fill(Stream_General, 0, General_Format_Profile, "RF64");
+
+ //For each stream
+ std::map<int32u, stream>::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);
+
+ //Parser specific
+ if (Temp->second.Parser)
+ {
+ //Finalizing and Merging (except Video codec and 120 fps hack)
+ Temp->second.Parser->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
+ Finish(Temp->second.Parser);
+ Merge(*Temp->second.Parser, StreamKind_Last, 0, StreamPos_Last);
+ Fill(StreamKind_Last, StreamPos_Last, General_ID, ((Temp->first>>24)-'0')*10+(((Temp->first>>16)&0xFF)-'0'));
+
+ //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");
+ }
+ }
+
+ //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.Parser->Status[IsAccepted])
+ {
+ float Delay=0;
+ bool Delay_IsValid=false;
+
+ if (Temp->second.Parser->Buffer_TotalBytes_FirstSynched==0)
+ {
+ Delay=0;
+ Delay_IsValid=true;
+ }
+ else if (Temp->second.Rate!=0)
+ {
+ Delay=((float)Temp->second.Parser->Buffer_TotalBytes_FirstSynched)*1000/Temp->second.Rate;
+ Delay_IsValid=true;
+ }
+ else if (Temp->second.Parser->Retrieve(Stream_Audio, 0, Audio_BitRate).To_int64u()!=0)
+ {
+ Delay=((float)Temp->second.Parser->Buffer_TotalBytes_FirstSynched)*1000/Temp->second.Parser->Retrieve(Stream_Audio, 0, Audio_BitRate).To_int64u();
+ Delay_IsValid=true;
+ }
+ else if (Temp->second.Parser->Retrieve(Stream_Audio, 0, Audio_BitRate_Nominal).To_int64u()!=0)
+ {
+ Delay=((float)Temp->second.Parser->Buffer_TotalBytes_FirstSynched)*1000/Temp->second.Parser->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_Video, 0, Video_Delay, 0, 10, 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_Resolution); //Resolution is not valid for AAC / MPEG Audio / Vorbis
+
+ //Format specific
+ #if defined(MEDIAINFO_MPEG4V_YES)
+ if (StreamKind_Last==Stream_Video && MediaInfoLib::Config.Codec_Get(Ztring().From_CC4(Temp->second.Compression), InfoCodec_KindofCodec).find(_T("MPEG-4V"))==0)
+ {
+ if (((File_Mpeg4v*)Temp->second.Parser)->Frame_Count_InThisBlock>1)
+ {
+ Fill(Stream_Video, StreamPos_Last, Video_MuxingMode, MediaInfoLib::Config.Language_Get("MuxingMode_PackedBitstream"));
+ Fill(Stream_Video, StreamPos_Last, Video_Codec_Settings, "Packed Bitstream");
+ Fill(Stream_Video, StreamPos_Last, Video_Codec_Settings_PacketBitStream, "Yes");
+ }
+ else
+ {
+ Fill(Stream_Video, StreamPos_Last, Video_Codec_Settings_PacketBitStream, "No");
+ }
+ }
+ #endif
+ #if defined(MEDIAINFO_DVDIF_YES)
+ if (StreamKind_Last==Stream_Video && (MediaInfoLib::Config.Codec_Get(Ztring().From_CC4(Temp->second.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.Parser->Retrieve(Stream_General, 0, General_Recorded_Date));
+
+ //Video and Audio are together
+ size_t Audio_Count=Temp->second.Parser->Count_Get(Stream_Audio);
+ for (size_t Audio_Pos=0; Audio_Pos<Audio_Count; Audio_Pos++)
+ {
+ Fill_Flush();
+ Stream_Prepare(Stream_Audio);
+ size_t Pos=Count_Get(Stream_Audio)-1;
+ Merge(*Temp->second.Parser, 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, "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, ((Temp->first>>24)-'0')*10+(((Temp->first>>16)&0xFF)-'0'));
+
+ //Duration
+ if (Temp->second.PacketCount>0)
+ {
+ if (StreamKind_Last==Stream_Video)
+ {
+ //Duration in case it is missing from header (malformed header...)
+ float32 FrameRate=Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate).To_float32();
+ if (FrameRate>0)
+ Fill(Stream_Video, StreamPos_Last, Video_Duration, Temp->second.PacketCount*1000/FrameRate, 0, 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.Parser && Temp->second.PacketPos==((File_Mpega*)Temp->second.Parser)->Frame_Count_Valid) //Only for stream with one frame per chunk
+ {
+ if (Retrieve(Stream_Audio, StreamPos_Last, Audio_Format_Profile)==_T("Layer 1"))
+ SamplingCount=Temp->second.PacketCount*384; //Layer 1
+ else
+ SamplingCount=Temp->second.PacketCount*1152; //Layer 2 and 3
+ }
+ }
+ #endif
+ if (Retrieve(Stream_Audio, StreamPos_Last, Audio_Format)==_T("PCM"))
+ {
+ int64u Resolution=Retrieve(Stream_Audio, StreamPos_Last, Audio_Resolution).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_Resolution).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);
+
+ //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<int64u, stream_structure>::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 && Retrieve(Stream_Audio, StreamPos_Last, Audio_BitRate).To_int32u())
+ {
+ 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(" ms"));
+ }
+ }
+ }
+ }
+
+ 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())
+ Fill(Stream_Video, 0, Video_FrameCount, dmlh_TotalFrame, 10, true);
+ }
+
+ //Rec
+ if (rec__Present)
+ Fill(Stream_General, 0, General_Format_Settings, "rec");
+
+ //Interleaved
+ if (Interleaved0_1 && Interleaved0_10 && Interleaved1_1 && Interleaved1_10)
+ Fill(Stream_General, 0, General_Interleaved, (Interleaved0_1<Interleaved1_1 && Interleaved0_10>Interleaved1_1
+ || Interleaved1_1<Interleaved0_1 && Interleaved1_10>Interleaved0_1)?"Yes":"No");
+
+ //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();
+ Stream_Structure.clear();
+ delete DV_FromHeader; DV_FromHeader=NULL;
+ }
+
+ //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("AVI ")+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, "AVI DV");
+ }
+ 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"))
+ {
+ Fill(Stream_General, 0, General_Format_Commercial_IfAny, "MPEG IMX 30");
+ Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "MPEG 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"))
+ {
+ Fill(Stream_General, 0, General_Format_Commercial_IfAny, "MPEG IMX 40");
+ Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "MPEG 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"))
+ {
+ Fill(Stream_General, 0, General_Format_Commercial_IfAny, "MPEG IMX 50");
+ Fill(Stream_Video, 0, Video_Format_Commercial_IfAny, "MPEG IMX 50");
+ }
+ }
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Riff::Read_Buffer_Continue()
+{
+ if (Buffer_DataSizeToParse)
+ {
+ if (Buffer_Size<=Buffer_DataSizeToParse)
+ {
+ Element_Size=Buffer_Size; //All the buffer is used
+ Buffer_DataSizeToParse-=Buffer_Size;
+ }
+ else
+ {
+ Element_Size=Buffer_DataSizeToParse;
+ Buffer_DataSizeToParse=0;
+ }
+
+ Element_Begin();
+ AVI__movi_xxxx();
+ Element_Offset=Element_Size;
+ Element_End();
+ }
+}
+
+//***************************************************************************
+// Buffer
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+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");
+
+ //RF64
+ int64u Size_Complete=Size;
+ 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_Info(Size_Complete);
+ }
+ else if (Name==Elements::WAVE_data)
+ {
+ Size_Complete=WAVE_data_Size;
+ Param_Info(Size_Complete);
+ }
+ }
+
+ //Alignment
+ if (Size_Complete%2)
+ {
+ 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_;
+
+ //Filling
+ if (movi_Size && Element_Level==4 && Size_Complete+8>1024*1024)
+ {
+ Buffer_DataSizeToParse=Size_Complete+8;
+ Size_Complete=Buffer_Size-(Buffer_Offset+8);
+ Buffer_DataSizeToParse-=Size_Complete;
+ }
+
+ //Filling
+ Header_Fill_Code(Name, Ztring().From_CC4(Name));
+ 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
+ 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())
+ GoTo(Stream_Structure_Temp->first);
+ NeedOldIndex=false;
+ SecondPass=true;
+ Index_Pos.clear(); //We didn't succeed to find theses indexes :(
+ return true;
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_RIFF_YES
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Riff.h b/src/thirdparty/MediaInfo/Multiple/File_Riff.h
new file mode 100644
index 000000000..9de264562
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Riff.h
@@ -0,0 +1,304 @@
+// File_Riff - Info for RIFF files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about RIFF files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_RiffH
+#define MediaInfo_File_RiffH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include <vector>
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Riff
+//***************************************************************************
+
+class File_Riff : public File__Analyze
+{
+public :
+ //Out
+ #if defined(MEDIAINFO_GXF_YES) && (defined(MEDIAINFO_CDP_YES) || defined(MEDIAINFO_AFDBARDATA_YES))
+ struct buffered_data
+ {
+ size_t Size;
+ int8u* Data;
+
+ buffered_data()
+ {
+ Size=0;
+ Data=NULL;
+ }
+
+ ~buffered_data()
+ {
+ delete[] Data; //Data=NULL;
+ }
+ };
+ #if defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+ std::vector<buffered_data*>* Cdp_Data;
+ #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+ #if defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_AFDBARDATA_YES)
+ std::vector<buffered_data*>* AfdBarData_Data;
+ #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_AFDBARDATA_YES)
+ #endif //defined(MEDIAINFO_GXF_YES) && (defined(MEDIAINFO_CDP_YES) || defined(MEDIAINFO_AFDBARDATA_YES))
+
+protected :
+ //Streams management
+ void Streams_Finish();
+
+public :
+ File_Riff();
+ ~File_Riff();
+
+private :
+ //Buffer - Global
+ void Read_Buffer_Continue ();
+
+ //Buffer - Per element
+ void Header_Parse();
+ void Data_Parse();
+
+ bool BookMark_Needed();
+
+ //Data
+ struct stream
+ {
+ File__Analyze* Parser;
+ int32u fccType;
+ int32u fccHandler;
+ int32u Rate;
+ int32u Start;
+ int32u Compression;
+ stream_t StreamKind;
+ size_t StreamPos;
+ int32u AvgBytesPerSec;
+ size_t PacketPos;
+ size_t PacketCount;
+ int64u StreamSize;
+ bool SearchingPayload;
+ bool Specific_IsMpeg4v;
+ bool ChunksAreComplete;
+
+ stream()
+ {
+ Parser=NULL;
+ fccType=0x00000000;
+ fccHandler=0x00000000;
+ Rate=0;
+ Start=0;
+ Compression=0x00000000;
+ StreamKind=Stream_Max;
+ StreamPos=0;
+ AvgBytesPerSec=0;
+ PacketPos=0;
+ PacketCount=0;
+ StreamSize=0;
+ SearchingPayload=true;
+ Specific_IsMpeg4v=false;
+ ChunksAreComplete=true;
+ }
+
+ ~stream()
+ {
+ delete Parser; //Parser=NULL;
+ }
+ };
+ std::map<int32u, stream> Stream;
+ int32u Stream_ID;
+
+ struct stream_structure
+ {
+ int64u Name;
+ int64u Size;
+ };
+ std::map<int64u, stream_structure> Stream_Structure;
+ std::map<int64u, stream_structure>::iterator Stream_Structure_Temp;
+ std::map<int64u, int64u> Index_Pos;
+ int64u Interleaved0_1;
+ int64u Interleaved0_10;
+ int64u Interleaved1_1;
+ int64u Interleaved1_10;
+
+ //Temp
+ 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_DataSizeToParse;
+ 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
+ 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 SecondPass; //Second pass for streams
+ File__Analyze* DV_FromHeader;
+ #if defined(MEDIAINFO_GXF_YES)
+ std::vector<std::vector<File__Analyze*> > rcrd_Parsers;
+ size_t rcrd_Parsers_Count;
+ std::vector<std::vector<size_t> > rcrd_Parsers_StreamPos;
+ #endif //MEDIAINFO_GXF_YES
+
+ //Chunks
+ void AIFC ();
+ void AIFC_COMM ();
+ void AIFC_COMT ();
+ void AIFC_FVER ();
+ void AIFC_SSND ();
+ 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__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__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__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 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_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_ds64 ();
+ void WAVE_fact ();
+ void WAVE_fmt_ ();
+ void 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();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Riff_Elements.cpp b/src/thirdparty/MediaInfo/Multiple/File_Riff_Elements.cpp
new file mode 100644
index 000000000..aff3b7865
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Riff_Elements.cpp
@@ -0,0 +1,3306 @@
+// File_Riff - Info for RIFF files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Elements part
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_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_AC3_YES)
+ #include "MediaInfo/Audio/File_Ac3.h"
+#endif
+#if defined(MEDIAINFO_DTS_YES)
+ #include "MediaInfo/Audio/File_Dts.h"
+#endif
+#if defined(MEDIAINFO_MPEG4_YES)
+ #include "MediaInfo/Audio/File_Mpeg4_AudioSpecificConfig.h"
+#endif
+#if defined(MEDIAINFO_ADTS_YES)
+ #include "MediaInfo/Audio/File_Adts.h"
+#endif
+#if defined(MEDIAINFO_JPEG_YES)
+ #include "MediaInfo/Image/File_Jpeg.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_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 <cstring>
+ #endif
+#endif //MEDIAINFO_GXF_YES
+#include "MediaInfo/MediaInfo_Config_MediaInfo.h"
+//---------------------------------------------------------------------------
+
+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;
+}
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_GXF_YES)
+const char* Riff_Rcrd_DataServices(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==0x60)
+ return "Ancillary time code (Internationally registered)";
+ else if (DataID==0x61)
+ {
+ switch (SecondaryDataID)
+ {
+ case 0x01 : return "CEA-708 (CDP)";
+ case 0x02 : return "CEA-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 if (DataID<=0xDF)
+ return "Internationally registered";
+ else
+ return "Internationally registered";
+}
+#endif //MEDIAINFO_GXF_YES
+
+//***************************************************************************
+// 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__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_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__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 AVIX=0x41564958;
+ const int32u AVIX_idx1=0x69647831;
+ const int32u AVIX_movi=0x6D6F7669;
+ const int32u AVIX_movi_rec_=0x72656320;
+ const int32u CADP=0x43414450;
+ 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_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)
+ LIST_SKIP(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__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
+ LIST_SKIP(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)
+ LIST(AVI__movi)
+ ATOM_BEGIN
+ LIST(AVI__movi_rec_)
+ ATOM_DEFAULT_ALONE(AVI__movi_xxxx)
+ ATOM_DEFAULT(AVI__movi_xxxx)
+ ATOM_END_DEFAULT
+ 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
+ LIST(CADP)
+ ATOM_BEGIN
+ ATOM_END
+ LIST(CMJP)
+ ATOM_BEGIN
+ ATOM_END
+ ATOM(CMP4)
+ ATOM(IDVX)
+ LIST(INDX)
+ ATOM_BEGIN
+ ATOM_DEFAULT(INDX_xxxx)
+ ATOM_END_DEFAULT
+ 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)
+ LIST(WAVE_bext)
+ ATOM_BEGIN
+ ATOM_END
+ LIST(WAVE_data)
+ break;
+ ATOM(WAVE_cue_)
+ ATOM(WAVE_ds64)
+ ATOM(WAVE_fact)
+ ATOM(WAVE_fmt_)
+ ATOM(WAVE_ID3_)
+ LIST(WAVE_INFO)
+ ATOM_BEGIN
+ ATOM_DEFAULT(WAVE_INFO_xxxx)
+ ATOM_END_DEFAULT
+ 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);
+}
+
+//---------------------------------------------------------------------------
+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);
+}
+
+//---------------------------------------------------------------------------
+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");
+ }
+ Fill(Stream_Audio, StreamPos_Last, Audio_BitRate_Mode, "CBR");
+
+ //Filling
+ Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, numChannels);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Resolution, sampleSize);
+ if (sampleRate)
+ Fill(Stream_Audio, StreamPos_Last, Audio_Duration, numSampleFrames/sampleRate*1000);
+ Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, sampleRate, 0);
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AIFF_COMT()
+{
+ //Parsing
+ int16u numComments;
+ Get_B2(numComments, "numComments");
+ for (int16u Pos=0; Pos<=numComments; Pos++)
+ {
+ Ztring text;
+ int16u count;
+ Element_Begin("Comment");
+ Skip_B4( "timeStamp");
+ Skip_B4( "marker");
+ Get_B2 (count, "count");
+ count+=count%1; //always even
+ Get_Local(count, text, "text");
+ Element_End();
+
+ //Filling
+ Fill(Stream_General, 0, General_Comment, text);
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AIFF_SSND()
+{
+ Element_Name("Sound Data");
+
+ Skip_XX(Element_TotalSize_Get(), "Data");
+
+ //Filling
+ Fill(Stream_Audio, 0, Audio_StreamSize, Element_TotalSize_Get());
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AIFF_xxxx()
+{
+ #define ELEMENT_CASE(_ELEMENT, _NAME) \
+ case Elements::_ELEMENT : Element_Name(_NAME); Name=_NAME; break;
+
+ //Known?
+ std::string Name;
+ switch(Element_Code)
+ {
+ ELEMENT_CASE(AIFF__c__, "Copyright");
+ ELEMENT_CASE(AIFF_ANNO, "Comment");
+ ELEMENT_CASE(AIFF_AUTH, "Performer");
+ ELEMENT_CASE(AIFF_NAME, "Title");
+ default : Skip_XX(Element_Size, "Unknown");
+ return;
+ }
+
+ //Parsing
+ Ztring text;
+ Get_Local(Element_Size, text, "text");
+
+ //Filling
+ Fill(Stream_General, 0, Name.c_str(), text);
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI_()
+{
+ Element_Name("AVI");
+
+ //Test if there is only one AVI chunk
+ if (Status[IsAccepted])
+ {
+ Element_Info("Problem: 2 AVI chunks, this is not normal");
+ Skip_XX(Element_TotalSize_Get(), "Data");
+ return;
+ }
+
+ Data_Accept("AVI");
+
+ //Filling
+ Fill(Stream_General, 0, General_Format, "AVI");
+
+ //Configuring
+ Buffer_MaximumSize=32*1024*1024;
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__cset()
+{
+ Element_Name("Regional settings");
+
+ //Parsing
+ Skip_L2( "CodePage"); //TODO: take a look about IBM/MS RIFF/MCI Specification 1.0
+ Skip_L2( "CountryCode");
+ Skip_L2( "LanguageCode");
+ Skip_L2( "Dialect");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__exif()
+{
+ Element_Name("Exif (Exchangeable Image File Format)");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__exif_xxxx()
+{
+ Element_Name("Value");
+
+ //Parsing
+ Ztring Value;
+ Get_Local(Element_Size, Value, "Value");
+
+ //Filling
+ switch (Element_Code)
+ {
+ case Elements::AVI__exif_ecor : Fill(Stream_General, 0, "Make", Value); break;
+ case Elements::AVI__exif_emdl : Fill(Stream_General, 0, "Model", Value); break;
+ case Elements::AVI__exif_emnt : Fill(Stream_General, 0, "MakerNotes", Value); break;
+ case Elements::AVI__exif_erel : Fill(Stream_General, 0, "RelatedImageFile", Value); break;
+ case Elements::AVI__exif_etim : Fill(Stream_General, 0, "Written_Date", Value); break;
+ case Elements::AVI__exif_eucm : Fill(Stream_General, 0, General_Comment, Value); break;
+ case Elements::AVI__exif_ever : break; //Exif version
+ default: Fill(Stream_General, 0, Ztring().From_CC4((int32u)Element_Code).To_Local().c_str(), Value);
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__goog()
+{
+ Element_Name("Google specific");
+
+ //Filling
+ Fill(Stream_General, 0, General_Format, "Google Video", Unlimited, false, true);
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__goog_GDAT()
+{
+ Element_Name("Google datas");
+}
+
+//---------------------------------------------------------------------------
+// Google Metadata
+//
+void File_Riff::AVI__GMET()
+{
+ Element_Name("Google Metadatas");
+
+ //Parsing
+ Ztring Value; Value.From_Local((const char*)(Buffer+Buffer_Offset+0), (size_t)Element_Size);
+ ZtringListList List;
+ List.Separator_Set(0, _T("\n"));
+ List.Separator_Set(1, _T(":"));
+ List.Max_Set(1, 2);
+ List.Write(Value);
+
+ //Details
+ if (MediaInfoLib::Config.DetailsLevel_Get())
+ {
+ //for (size_t Pos=0; Pos<List.size(); Pos++)
+ // Details_Add_Info(Pos, List(Pos, 0).To_Local().c_str(), List(Pos, 1));
+ }
+
+ //Filling
+ for (size_t Pos=0; Pos<List.size(); Pos++)
+ {
+ if (List(Pos, 0)==_T("title")) Fill(Stream_General, 0, General_Title, List(Pos, 1));
+ if (List(Pos, 0)==_T("description")) Fill(Stream_General, 0, General_Title_More, List(Pos, 1));
+ if (List(Pos, 0)==_T("url")) Fill(Stream_General, 0, General_Title_Url, List(Pos, 1));
+ if (List(Pos, 0)==_T("docid")) Fill(Stream_General, 0, General_UniqueID, List(Pos, 1));
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr()
+{
+ Element_Name("AVI Header");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_avih()
+{
+ Element_Name("File header");
+
+ //Parsing
+ int32u MicrosecPerFrame, Flags;
+ Get_L4 (MicrosecPerFrame, "MicrosecPerFrame");
+ Skip_L4( "MaxBytesPerSec");
+ Skip_L4( "PaddingGranularity");
+ Get_L4 (Flags, "Flags");
+ Skip_Flags(Flags, 4, "HasIndex");
+ Skip_Flags(Flags, 5, "MustUseIndex");
+ Skip_Flags(Flags, 8, "IsInterleaved");
+ Skip_Flags(Flags, 9, "UseCKTypeToFindKeyFrames");
+ Skip_Flags(Flags, 11, "TrustCKType");
+ Skip_Flags(Flags, 16, "WasCaptureFile");
+ Skip_Flags(Flags, 17, "Copyrighted");
+ Get_L4 (avih_TotalFrame, "TotalFrames");
+ Skip_L4( "InitialFrames");
+ Skip_L4( "StreamsCount");
+ Skip_L4( "SuggestedBufferSize");
+ Skip_L4( "Width");
+ Skip_L4( "Height");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ if(Element_Offset<Element_Size)
+ Skip_XX(Element_Size-Element_Offset, "Unknown");
+
+ //Filling
+ if (MicrosecPerFrame>0)
+ 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_Offset<Element_Size)
+ Skip_XX(Element_Size-Element_Offset, "Unknown");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_ON2h()
+{
+ Element_Name("On2 header");
+
+ //Parsing
+ Skip_XX(Element_Size, "Unknown");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_strl()
+{
+ Element_Name("Stream info");
+ Element_Info(stream_Count);
+
+ //Clean up
+ StreamKind_Last=Stream_Max;
+
+ //Compute the current codec ID
+ Stream_ID=(('0'+stream_Count/10)*0x01000000
+ +('0'+stream_Count )*0x00010000);
+ stream_Count++;
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_strl_indx()
+{
+ Element_Name("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
+
+ //Depends of size of structure...
+ switch (IndexType)
+ {
+ case 0x01 : //AVI_INDEX_OF_CHUNKS
+ switch (IndexSubType)
+ {
+ case 0x00 : AVI__hdlr_strl_indx_StandardIndex(Entry_Count, ChunkId); break;
+ case 0x01 : AVI__hdlr_strl_indx_FieldIndex(Entry_Count, ChunkId); break; //AVI_INDEX_2FIELD
+ default: Skip_XX(Element_Size-Element_Offset, "Unknown");
+ }
+ break;
+ case 0x0 : //AVI_INDEX_OF_INDEXES
+ switch (IndexSubType)
+ {
+ case 0x00 :
+ case 0x01 : AVI__hdlr_strl_indx_SuperIndex(Entry_Count, ChunkId); break; //AVI_INDEX_2FIELD
+ default: Skip_XX(Element_Size-Element_Offset, "Unknown");
+ }
+ break;
+ default: Skip_XX(Element_Size-Element_Offset, "Unknown");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_strl_indx_StandardIndex(int32u Entry_Count, int32u ChunkId)
+{
+ Element_Name("Standard Index");
+
+ //Parsing
+ int64u BaseOffset, StreamSize=0;
+ Get_L8 (BaseOffset, "BaseOffset");
+ Skip_L4( "Reserved3");
+ for (int32u Pos=0; Pos<Entry_Count; Pos++)
+ {
+ //Is too slow
+ /*
+ Element_Begin("Index");
+ int32u Offset, Size;
+ Get_L4 (Offset, "Offset"); //BaseOffset + this is absolute file offset
+ Get_L4 (Size, "Size"); //Bit 31 is set if this is NOT a keyframe
+ Element_Info(Size&0x7FFFFFFF);
+ if (Size)
+ Element_Info("KeyFrame");
+ Element_End();
+ */
+
+ //Faster method
+ if (Element_Offset+8>Element_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_Offset<Element_Size)
+ Skip_XX(Element_Size-Element_Offset, "Garbage");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_strl_indx_FieldIndex(int32u Entry_Count, int32u)
+{
+ Element_Name("Field Index");
+
+ //Parsing
+ Skip_L8( "Offset");
+ Skip_L4( "Reserved2");
+ for (int32u Pos=0; Pos<Entry_Count; Pos++)
+ {
+ Element_Begin("Index");
+ Skip_L4( "Offset"); //BaseOffset + this is absolute file offset
+ Skip_L4( "Size"); //Bit 31 is set if this is NOT a keyframe
+ Skip_L4( "OffsetField2"); //Offset to second field
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_strl_indx_SuperIndex(int32u Entry_Count, int32u ChunkId)
+{
+ Element_Name("Index of Indexes");
+
+ //Parsing
+ int64u Offset;
+ Skip_L4( "Reserved0");
+ Skip_L4( "Reserved1");
+ Skip_L4( "Reserved2");
+ for (int32u Pos=0; Pos<Entry_Count; Pos++)
+ {
+ Element_Begin("Index of Indexes");
+ Get_L8 (Offset, "Offset");
+ Skip_L4( "Size"); //Size of index chunk at this offset
+ Skip_L4( "Duration"); //time span in stream ticks
+ Index_Pos[Offset]=ChunkId;
+ Element_End();
+ }
+
+ //We needn't anymore Old version
+ NeedOldIndex=false;
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_strl_JUNK()
+{
+ Element_Name("Garbage");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_strl_strd()
+{
+ Element_Name("Stream datas");
+
+ //Parsing
+ Skip_XX(Element_Size, "Unknown");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_strl_strf()
+{
+ Element_Name("Stream format");
+
+ //Parse depending of kind of stream
+ switch (Stream[Stream_ID].fccType)
+ {
+ case Elements::AVI__hdlr_strl_strh_auds : AVI__hdlr_strl_strf_auds(); break;
+ case Elements::AVI__hdlr_strl_strh_iavs : AVI__hdlr_strl_strf_iavs(); break;
+ case Elements::AVI__hdlr_strl_strh_mids : AVI__hdlr_strl_strf_mids(); break;
+ case Elements::AVI__hdlr_strl_strh_txts : AVI__hdlr_strl_strf_txts(); break;
+ case Elements::AVI__hdlr_strl_strh_vids : AVI__hdlr_strl_strf_vids(); break;
+ default : Element_Info("Unknown");
+ }
+
+ //Registering stream
+ Stream[Stream_ID].StreamKind=StreamKind_Last;
+ Stream[Stream_ID].StreamPos=StreamPos_Last;
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_strl_strf_auds()
+{
+ Element_Info("Audio");
+
+ //Parsing
+ int32u SamplesPerSec, AvgBytesPerSec;
+ int16u FormatTag, Channels;
+ BitsPerSample=0;
+ Get_L2 (FormatTag, "FormatTag");
+ Get_L2 (Channels, "Channels");
+ Get_L4 (SamplesPerSec, "SamplesPerSec");
+ Get_L4 (AvgBytesPerSec, "AvgBytesPerSec");
+ Skip_L2( "BlockAlign");
+ if (Element_Offset+2<=Element_Size)
+ Get_L2 (BitsPerSample, "BitsPerSample");
+
+ //Coherency
+ if (Channels==0 || SamplesPerSec==0 || AvgBytesPerSec==0)
+ return;
+
+ //Filling
+ Stream_Prepare(Stream_Audio);
+ Stream[Stream_ID].Compression=FormatTag;
+ Ztring Codec; Codec.From_Number(FormatTag, 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!=5 || FormatTag==0xFFFE)?Channels:6);
+ Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, SamplesPerSec);
+ Fill(Stream_Audio, StreamPos_Last, Audio_BitRate, AvgBytesPerSec*8);
+ if (BitsPerSample)
+ if (BitsPerSample) Fill(Stream_Audio, StreamPos_Last, Audio_Resolution, BitsPerSample);
+ Stream[Stream_ID].AvgBytesPerSec=AvgBytesPerSec; //Saving bitrate for each stream
+ if (SamplesPerSec && TimeReference!=(int64u)-1)
+ Fill(Stream_Audio, 0, Audio_Delay, TimeReference/SamplesPerSec);
+
+ //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"))
+ {
+ Stream[Stream_ID].Parser=new File_Mpega;
+ Stream[Stream_ID].Parser->ShouldContinueParsing=true;
+ }
+ #endif
+ #if defined(MEDIAINFO_AC3_YES)
+ else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==_T("AC-3"))
+ {
+ Stream[Stream_ID].Parser=new File_Ac3;
+ ((File_Ac3*)Stream[Stream_ID].Parser)->Frame_Count_Valid=2;
+ Stream[Stream_ID].Parser->ShouldContinueParsing=true;
+ }
+ #endif
+ #if defined(MEDIAINFO_DTS_YES)
+ else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==_T("DTS")
+ || (FormatTag==0x1 && Retrieve(Stream_General, 0, General_Format)==_T("Wave"))) //Some DTS streams are coded "1"
+ {
+ Stream[Stream_ID].Parser=new File_Dts;
+ ((File_Dts*)Stream[Stream_ID].Parser)->Frame_Count_Valid=2;
+ Stream[Stream_ID].Parser->ShouldContinueParsing=true;
+ }
+ #endif
+ #if defined(MEDIAINFO_ADTS_YES)
+ else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==_T("AAC"))
+ {
+ Stream[Stream_ID].Parser=new File_Adts;
+ ((File_Adts*)Stream[Stream_ID].Parser)->Frame_Count_Valid=1;
+ Stream[Stream_ID].Parser->ShouldContinueParsing=true;
+ }
+ #endif
+ #if defined(MEDIAINFO_PCM_YES)
+ else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==_T("PCM"))
+ {
+ //Creating the parser
+ File_Pcm MI;
+ MI.Codec=Codec;
+ MI.BitDepth=BitsPerSample;
+
+ //Parsing
+ Open_Buffer_Init(&MI);
+ Open_Buffer_Continue(&MI, 0);
+
+ //Filling
+ Finish(&MI);
+ Merge(MI, StreamKind_Last, 0, StreamPos_Last);
+ }
+ #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
+ {
+ Stream[Stream_ID].Parser=new File_Ogg;
+ Stream[Stream_ID].Parser->ShouldContinueParsing=true;
+ }
+ #endif
+ Open_Buffer_Init(Stream[Stream_ID].Parser);
+
+ //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 (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"))
+ 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 Skip_XX(Option_Size, "Unknown");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_strl_strf_auds_Mpega()
+{
+ //Parsing
+ Element_Begin("MPEG Audio options");
+ Skip_L2( "ID");
+ Skip_L4( "Flags");
+ Skip_L2( "BlockSize");
+ Skip_L2( "FramesPerBlock");
+ Skip_L2( "CodecDelay");
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_strl_strf_auds_Aac()
+{
+ //Parsing
+ Element_Begin("AAC options");
+ #if defined(MEDIAINFO_MPEG4_YES)
+ File_Mpeg4_AudioSpecificConfig MI;
+ Open_Buffer_Init(&MI);
+ Open_Buffer_Continue(&MI);
+ Finish(&MI);
+ Merge(MI, StreamKind_Last, 0, StreamPos_Last);
+ #else //MEDIAINFO_MPEG4_YES
+ Skip_XX(Element_Size-Element_Offset, "(AudioSpecificConfig)");
+ #endif
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_strl_strf_auds_Vorbis()
+{
+ //Parsing
+ Element_Begin("Vorbis options");
+ #if defined(MEDIAINFO_OGG_YES)
+ File_Ogg_SubElement MI;
+ Open_Buffer_Init(&MI);
+ Element_Begin("Element sizes");
+ //All elements parsing, except last one
+ std::vector<size_t> 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; Pos<Elements_Count; Pos++)
+ {
+ int8u Size;
+ Get_L1(Size, "Size");
+ Elements_Size[Pos]=Size;
+ Elements_TotalSize+=Size;
+ }
+ Element_End();
+ if (Element_Offset+Elements_TotalSize>Element_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; Pos<Elements_Count; Pos++)
+ {
+ Open_Buffer_Continue(&MI, Elements_Size[Pos]);
+ Open_Buffer_Continue(&MI, 0);
+ Element_Offset+=Elements_Size[Pos];
+ }
+ //Finalizing
+ Finish(&MI);
+ Merge(MI, StreamKind_Last, 0, StreamPos_Last);
+ Clear(Stream_Audio, StreamPos_Last, Audio_Resolution); //Resolution is not valid for Vorbis
+ Element_Show();
+ #else //MEDIAINFO_MPEG4_YES
+ Skip_XX(Element_Size-Element_Offset, "(Vorbis headers)");
+ #endif
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_strl_strf_auds_Vorbis2()
+{
+ //Parsing
+ Skip_XX(8, "Vorbis Unknown");
+ Element_Begin("Vorbis options");
+ #if defined(MEDIAINFO_OGG_YES)
+ File_Ogg_SubElement MI;
+ Open_Buffer_Continue(Stream[Stream_ID].Parser);
+ Open_Buffer_Continue(Stream[Stream_ID].Parser, 0);
+ Finish(Stream[Stream_ID].Parser);
+ Merge(*Stream[Stream_ID].Parser, StreamKind_Last, 0, StreamPos_Last);
+ Element_Show();
+ #else //MEDIAINFO_MPEG4_YES
+ Skip_XX(Element_Size-Element_Offset, "(Vorbis headers)");
+ #endif
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_strl_strf_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 (0);
+ #if defined(MEDIAINFO_PCM_YES)
+ else 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.Codec=Ztring().From_Number((int16u)SubFormat.hi, 16);
+ MI.BitDepth=BitsPerSample;
+
+ //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_Riff::AVI__hdlr_strl_strf_iavs()
+{
+ //Standard video header before Iavs?
+ if (Element_Size==72)
+ {
+ Element_Begin();
+ AVI__hdlr_strl_strf_vids();
+ Element_End();
+ }
+
+ Element_Info("Interleaved Audio/Video");
+
+ #ifdef MEDIAINFO_DVDIF_YES
+ if (Element_Size<8*4)
+ return;
+
+ //Parsing
+ DV_FromHeader=new File_DvDif();
+ Open_Buffer_Init(DV_FromHeader);
+
+ //DVAAuxSrc
+ ((File_DvDif*)DV_FromHeader)->AuxToAnalyze=0x50; //Audio source
+ Open_Buffer_Continue(DV_FromHeader, 4);
+ Element_Offset+=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);
+ Element_Offset+=4;
+ //DVAAuxCtl
+ ((File_DvDif*)DV_FromHeader)->AuxToAnalyze=0x61; //Video control
+ Open_Buffer_Continue(DV_FromHeader, 4);
+ Element_Offset+=4;
+ //Reserved
+ Skip_L4( "DVReserved");
+ Skip_L4( "DVReserved");
+
+ Finish(DV_FromHeader);
+
+ Stream_Prepare(Stream_Video);
+ Stream[Stream_ID].Parser=new File_DvDif;
+ Open_Buffer_Init(Stream[Stream_ID].Parser);
+
+ #else //MEDIAINFO_DVDIF_YES
+ //Parsing
+ Skip_L4( "DVAAuxSrc");
+ Skip_L4( "DVAAuxCtl");
+ Skip_L4( "DVAAuxSrc1");
+ Skip_L4( "DVAAuxCtl1");
+ Skip_L4( "DVVAuxSrc");
+ Skip_L4( "DVVAuxCtl");
+ Skip_L4( "DVReserved");
+ Skip_L4( "DVReserved");
+
+ //Filling
+ Ztring Codec; Codec.From_CC4(Stream[Stream_ID].fccHandler);
+ Stream_Prepare(Stream_Video);
+ float32 FrameRate=Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate).To_float32();
+ Fill(Stream_Video, StreamPos_Last, Video_Codec, Codec); //May be replaced by codec parser
+ Fill(Stream_Video, StreamPos_Last, Video_Codec_CC, Codec);
+ if (Codec==_T("dvsd")
+ || Codec==_T("dvsl"))
+ {
+ Fill(Stream_Video, StreamPos_Last, Video_Width, 720);
+ if (FrameRate==25.000) Fill(Stream_Video, StreamPos_Last, Video_Height, 576);
+ else if (FrameRate==29.970) Fill(Stream_Video, StreamPos_Last, Video_Height, 480);
+ Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, 4.0/3, 3, true);
+ }
+ else if (Codec==_T("dvhd"))
+ {
+ Fill(Stream_Video, StreamPos_Last, Video_Width, 1440);
+ if (FrameRate==25.000) Fill(Stream_Video, StreamPos_Last, Video_Height, 1152);
+ else if (FrameRate==30.000) Fill(Stream_Video, StreamPos_Last, Video_Height, 960);
+ Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, 4.0/3, 3, true);
+ }
+ Stream_Prepare(Stream_Audio);
+ 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);
+ #endif //MEDIAINFO_DVDIF_YES
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_strl_strf_mids()
+{
+ Element_Info("Midi");
+
+ //Filling
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format, "MIDI");
+ Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "Midi");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_strl_strf_txts()
+{
+ Element_Info("Text");
+
+ //Parsing
+ Ztring Format;
+ if (Element_Size)
+ {
+ Get_Local(10, Format, "Format");
+ Skip_XX(22, "Unknown");
+ }
+
+ FILLING_BEGIN_PRECISE()
+ Stream_Prepare(Stream_Text);
+
+ if (Element_Size==0)
+ {
+ //Creating the parser
+ #if defined(MEDIAINFO_OTHERTEXT_YES)
+ Stream[Stream_ID].Parser=new File_OtherText;
+ Open_Buffer_Init(Stream[Stream_ID].Parser);
+ #endif
+ }
+ else
+ {
+ Fill(Stream_Text, StreamPos_Last, Text_Format, Format);
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_strl_strf_vids()
+{
+ Element_Info("Video");
+
+ //Parsing
+ int32u Compression, Width, Height;
+ int16u Resolution;
+ Skip_L4( "Size");
+ Get_L4 (Width, "Width");
+ Get_L4 (Height, "Height");
+ Skip_L2( "Planes");
+ Get_L2 (Resolution, "BitCount"); //Do not use it
+ Get_C4 (Compression, "Compression");
+ Skip_L4( "SizeImage");
+ Skip_L4( "XPelsPerMeter");
+ Skip_L4( "YPelsPerMeter");
+ Skip_L4( "ClrUsed");
+ Skip_L4( "ClrImportant");
+
+ //Filling
+ Stream[Stream_ID].Compression=Compression;
+ 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
+ || 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, 10, true);
+ if (Resolution==32 && Compression==0x74736363) //tscc
+ Fill(StreamKind_Last, StreamPos_Last, "Resolution", 8);
+ else if (Compression==0x44495633) //DIV3
+ Fill(StreamKind_Last, StreamPos_Last, "Resolution", 8);
+ else if (Compression==0x44585342) //DXSB
+ Fill(StreamKind_Last, StreamPos_Last, "Resolution", 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, "Resolution", 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, "Resolution", Resolution/4); //With Alpha
+ }
+ else
+ Fill(StreamKind_Last, StreamPos_Last, "Resolution", 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, "Resolution", 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"))
+ {
+ Stream[Stream_ID].Parser=new File_Mpegv;
+ ((File_Mpegv*)Stream[Stream_ID].Parser)->FrameIsAlwaysComplete=true;
+ }
+ #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"))
+ {
+ Stream[Stream_ID].Parser=new File_Mpeg4v;
+ Stream[Stream_ID].Specific_IsMpeg4v=true;
+ ((File_Mpeg4v*)Stream[Stream_ID].Parser)->FrameIsAlwaysComplete=true;
+ if (MediaInfoLib::Config.ParseSpeed_Get()>=0.5)
+ Stream[Stream_ID].Parser->ShouldContinueParsing=true;
+ }
+ #endif
+ #if defined(MEDIAINFO_AVC_YES)
+ else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression))==_T("AVC"))
+ {
+ Stream[Stream_ID].Parser=new File_Avc;
+ ((File_Avc*)Stream[Stream_ID].Parser)->FrameIsAlwaysComplete=true;
+ }
+ #endif
+ #if defined(MEDIAINFO_JPEG_YES)
+ else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression))==_T("M-JPEG"))
+ {
+ Stream[Stream_ID].Parser=new File_Jpeg;
+ ((File_Jpeg*)Stream[Stream_ID].Parser)->StreamKind=Stream_Video;
+ }
+ #endif
+ #if defined(MEDIAINFO_DVDIF_YES)
+ else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression))==_T("DV"))
+ {
+ Stream[Stream_ID].Parser=new File_DvDif;
+ ((File_DvDif*)Stream[Stream_ID].Parser)->IgnoreAudio=true;
+ }
+ #endif
+ #if defined(MEDIAINFO_FRAPS_YES)
+ else if (Compression==0x46505331) //"FPS1"
+ {
+ Stream[Stream_ID].Parser=new File_Fraps;
+ }
+ #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"
+ {
+ Stream[Stream_ID].Parser=new File_Lagarith;
+ }
+ #endif
+ Open_Buffer_Init(Stream[Stream_ID].Parser);
+
+ //Options
+ if (Element_Offset>=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_Begin("AVC options");
+ #if defined(MEDIAINFO_AVC_YES)
+ ((File_Avc*)Stream[Stream_ID].Parser)->MustParse_SPS_PPS=true;
+ ((File_Avc*)Stream[Stream_ID].Parser)->SizedBlocks=true;
+ ((File_Avc*)Stream[Stream_ID].Parser)->MustSynchronize=false;
+ Open_Buffer_Continue(Stream[Stream_ID].Parser);
+ #else //MEDIAINFO_AVC_YES
+ Skip_XX(Element_Size-Element_Offset, "(AVC headers)");
+ #endif
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+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_Offset<Element_Size)
+ Skip_XX(Element_Size-Element_Offset, "Unknown");
+
+ //Filling
+ float32 FrameRate=0;
+ if (Rate>0 && Scale>0)
+ {
+ FrameRate=((float32)Rate)/Scale;
+ 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].Rate=Rate;
+ Stream[Stream_ID].Start=Start;
+}
+
+//---------------------------------------------------------------------------
+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;
+ Skip_L4( "VideoFormatToken");
+ Skip_L4( "VideoStandard");
+ Skip_L4( "VerticalRefreshRate");
+ Skip_L4( "HTotalInT");
+ Skip_L4( "VTotalInLines");
+ Skip_L4( "FrameAspectRatio");
+ Skip_L4( "FrameWidthInPixels");
+ Skip_L4( "FrameHeightInLines");
+ Get_L4 (FieldPerFrame, "FieldPerFrame");
+ for (int32u Pos=0; Pos<FieldPerFrame; Pos++)
+ {
+ Skip_L4( "CompressedBMHeight");
+ Skip_L4( "CompressedBMWidth");
+ Skip_L4( "ValidBMHeight");
+ Skip_L4( "ValidBMWidth");
+ Skip_L4( "ValidBMXOffset");
+ Skip_L4( "ValidBMYOffset");
+ Skip_L4( "VideoXOffsetInT");
+ Skip_L4( "VideoYValidStartLine");
+ }
+ if(Element_Offset<Element_Size)
+ Skip_XX(Element_Size-Element_Offset, "Unknown");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__hdlr_xxxx()
+{
+ AVI__INFO_xxxx();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__idx1()
+{
+ Element_Name("Index (old)");
+
+ //Tests
+ if (!NeedOldIndex || Idx1_Offset==(int64u)-1)
+ {
+ Skip_XX(Element_TotalSize_Get(), "Data");
+ return;
+ }
+ else if (!Element_IsComplete_Get())
+ {
+ Element_WaitForMoreData();
+ return;
+ }
+
+ //Testing malformed index (index is based on start of the file, wrong)
+ if (16<=Element_Size && Idx1_Offset+4==LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset+ 8))
+ Idx1_Offset=0; //Fixing base of movi atom, the index think it is the start of the file
+
+ //Parsing
+ std::map <int64u, size_t> Stream_Count;
+ while (Element_Offset+16<=Element_Size)
+ {
+ //Is too slow
+ /*
+ int32u ChunkID, Offset, Size;
+ Element_Begin("Index");
+ Get_C4 (ChunkID, "ChunkID"); //Bit 31 is set if this is NOT a keyframe
+ Info_L4(Flags, "Flags");
+ Skip_Flags(Flags, 0, "NoTime");
+ Skip_Flags(Flags, 1, "Lastpart");
+ Skip_Flags(Flags, 2, "Firstpart");
+ Skip_Flags(Flags, 3, "Midpart");
+ Skip_Flags(Flags, 4, "KeyFrame");
+ Get_L4 (Offset, "Offset"); //qwBaseOffset + this is absolute file offset
+ Get_L4 (Size, "Size"); //Bit 31 is set if this is NOT a keyframe
+ Element_Info(Ztring().From_CC4(ChunkID));
+ Element_Info(Size);
+
+ //Stream Pos and Size
+ int32u StreamID_Temp=(ChunkID&0xFFFF0000);
+ Stream[StreamID_Temp].StreamSize+=Size;
+ Stream_Pos[Idx1_Offset+Offset]=StreamID_Temp;
+ Element_End();
+ */
+
+ //Faster method
+ int32u StreamID=BigEndian2int32u (Buffer+Buffer_Offset+(size_t)Element_Offset )&0xFFFF0000;
+ int32u Offset =LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset+ 8);
+ int32u Size =LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset+12);
+ Stream[StreamID].StreamSize+=Size;
+ Stream[StreamID].PacketCount++;
+ Stream_Structure[Idx1_Offset+Offset].Name=StreamID;
+ Stream_Structure[Idx1_Offset+Offset].Size=Size;
+ Element_Offset+=16;
+ }
+
+ //Interleaved
+ size_t Pos0=0;
+ size_t Pos1=0;
+ for (std::map<int64u, stream_structure>::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_Info(Value);
+ 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);
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__movi()
+{
+ Element_Name("Datas");
+
+ //Only the first time, no need in AVIX
+ if (movi_Size==0)
+ {
+ Idx1_Offset=File_Offset+Buffer_Offset-4;
+ BookMark_Set(); //Remenbering this place, for stream parsing in phase 2
+
+ //For each stream
+ std::map<int32u, stream>::iterator Temp=Stream.begin();
+ while (Temp!=Stream.end())
+ {
+ if (!Temp->second.Parser && Temp->second.fccType!=Elements::AVI__hdlr_strl_strh_txts)
+ {
+ Temp->second.SearchingPayload=false;
+ stream_Count--;
+ }
+ Temp++;
+ }
+ }
+
+ //Filling
+ movi_Size+=Element_TotalSize_Get();
+
+ //We must parse moov?
+ if (NeedOldIndex || (stream_Count==0 && Index_Pos.empty()))
+ {
+ //Jumping
+ Skip_XX(Element_TotalSize_Get(), "Data");
+ 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;
+ }
+
+ Stream_ID=(int32u)(Element_Code&0xFFFF0000);
+
+ 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;
+ }
+
+ Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream);
+
+ //Finished?
+ if (!Stream[Stream_ID].SearchingPayload)
+ {
+ Element_DoNotShow();
+ AVI__movi_StreamJump();
+ return;
+ }
+
+ Stream[Stream_ID].PacketPos++;
+ if (MediaInfoLib::Config.DetailsLevel_Get())
+ {
+ switch (Element_Code&0x0000FFFF) //2 last bytes
+ {
+ case Elements::AVI__movi_xxxx_____ : Element_Info("DV"); break;
+ case Elements::AVI__movi_xxxx___db :
+ case Elements::AVI__movi_xxxx___dc : Element_Info("Video"); break;
+ case Elements::AVI__movi_xxxx___sb :
+ case Elements::AVI__movi_xxxx___tx : Element_Info("Text"); break;
+ case Elements::AVI__movi_xxxx___wb : Element_Info("Audio"); break;
+ default : Element_Info("Unknown"); break;
+ }
+ Element_Info(Stream[Stream_ID].PacketPos);
+ }
+
+ //Some specific stuff
+ switch (Element_Code&0x0000FFFF) //2 last bytes
+ {
+ case Elements::AVI__movi_xxxx___tx : AVI__movi_xxxx___tx(); break;
+ default : ;
+ }
+
+ //Parsing
+ if (Stream[Stream_ID].Parser)
+ {
+ Open_Buffer_Continue(Stream[Stream_ID].Parser);
+ if (Stream[Stream_ID].Parser->Buffer_Size>0)
+ Stream[Stream_ID].ChunksAreComplete=false;
+ }
+
+ //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].Parser==NULL
+ #if defined(MEDIAINFO_MPEG4V_YES)
+ || Stream[Stream_ID].Specific_IsMpeg4v && ((File_Mpeg4v*)Stream[Stream_ID].Parser)->Frame_Count_InThisBlock>1 //Searching Packet bitstream, no more need if found
+ #endif
+ || Stream[Stream_ID].Parser->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;
+ 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");
+
+ //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].Parser==NULL
+ || Stream[Stream_ID].Parser->Status[IsFilled]
+ || (Stream[Stream_ID].PacketPos>=300 && MediaInfoLib::Config.ParseSpeed_Get()<1.00))
+ || Element_Size>50000) //For PCM, we disable imediatly
+ {
+ 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
+ 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))
+ GoTo(ToJump, "AVI"); //Not just after
+ }
+ else if (stream_Count==0)
+ {
+ //Jumping
+ Element_Show();
+ if (rec__Present)
+ Element_End();
+ Info("movi, Jumping to end of chunk");
+ if (SecondPass)
+ 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);
+ 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))
+ 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)
+ GoTo(ToJump, "AVI"); //Not just after
+ }
+ else
+ Finish("AVI");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVI__xxxx()
+{
+ Stream_ID=(int32u)(Element_Code&0xFFFF0000);
+
+ 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;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVIX()
+{
+ //Filling
+ Fill(Stream_General, 0, General_Format_Profile, "OpenDML", Unlimited, true, true);
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVIX_idx1()
+{
+ AVI__idx1();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVIX_movi()
+{
+ AVI__movi();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVIX_movi_rec_()
+{
+ AVI__movi_rec_();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVIX_movi_rec__xxxx()
+{
+ AVIX_movi_xxxx();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::AVIX_movi_xxxx()
+{
+ AVI__movi_xxxx();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::CADP()
+{
+ Element_Name("CMP4 - ADPCM");
+
+ //Parsing
+ int32u Codec;
+ Get_C4 (Codec, "Codec");
+ Skip_XX(Element_TotalSize_Get()-Element_Offset, "Data");
+
+ FILLING_BEGIN();
+ Stream_Prepare(Stream_Audio);
+ if (Codec==0x41647063) //Adpc
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format, "ADPCM");
+ Fill(Stream_Audio, StreamPos_Last, Audio_StreamSize, Element_TotalSize_Get());
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::CMJP()
+{
+ Element_Name("CMP4 - M-JPEG");
+
+ //Parsing
+ #ifdef MEDIAINFO_JPEG_YES
+ Stream_ID=0;
+ Stream[Stream_ID].Parser=new File_Jpeg;
+ Open_Buffer_Init(Stream[Stream_ID].Parser);
+ ((File_Jpeg*)Stream[Stream_ID].Parser)->StreamKind=Stream_Video;
+ Open_Buffer_Continue(Stream[Stream_ID].Parser);
+ Element_Offset=Element_Size;
+ Skip_XX(Element_TotalSize_Get()-Element_Offset, "Other data");
+
+ FILLING_BEGIN();
+ Stream_Prepare(Stream_Video);
+ Fill(Stream_Video, StreamPos_Last, Video_StreamSize, Element_TotalSize_Get());
+ Finish(Stream[Stream_ID].Parser);
+ Merge(*Stream[Stream_ID].Parser, StreamKind_Last, 0, StreamPos_Last);
+ FILLING_END();
+ #else
+ Skip_XX(Element_TotalSize_Get(), "Data");
+
+ FILLING_BEGIN();
+ Stream_Prepare(Stream_Video);
+ Fill(Stream_Video, StreamKind_Last, Video_Format, "M-JPEG");
+ Fill(Stream_Video, StreamKind_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; Pos<Entry_Count; Pos++)
+ {
+ Skip_L8( "Offset");
+ Skip_L4( "Size");
+ Skip_L4( "Frame number?");
+ Skip_L4( "Frame number?");
+ Skip_L4( "Zero");
+ }
+ }
+
+ //Currently, we do not use the index
+ //TODO: use the index
+ Stream_Structure.clear();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::JUNK()
+{
+ Element_Name("Junk");
+
+ //Parse
+ Skip_XX(Element_TotalSize_Get(), "Junk");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::menu()
+{
+ Element_Name("DivX Menu");
+
+ //Filling
+ Stream_Prepare(Stream_Menu);
+ Fill(Stream_Menu, StreamPos_Last, Menu_Format, "DivX Menu");
+ Fill(Stream_Menu, StreamPos_Last, Menu_Codec, "DivX");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::MThd()
+{
+ Element_Name("MIDI header");
+
+ //Parsing
+ Skip_B2( "format");
+ Skip_B2( "ntrks");
+ Skip_B2( "division");
+
+ FILLING_BEGIN_PRECISE();
+ Accept("MIDI");
+ Fill(Stream_General, 0, General_Format, "MIDI");
+ FILLING_ELSE();
+ Reject("MIDI");
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::MTrk()
+{
+ Element_Name("MIDI Track");
+
+ //Parsing
+ Skip_XX(Element_TotalSize_Get(), "Data");
+
+ FILLING_BEGIN();
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Format, "MIDI");
+ Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "Midi");
+
+ Finish("MIDI");
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::PAL_()
+{
+ Data_Accept("RIFF Palette");
+ Element_Name("RIFF Palette");
+
+ //Filling
+ Fill(Stream_General, 0, General_Format, "RIFF Palette");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::QLCM()
+{
+ Data_Accept("QLCM");
+ Element_Name("QLCM");
+
+ //Filling
+ Fill(Stream_General, 0, General_Format, "QLCM");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::QLCM_fmt_()
+{
+ //Parsing
+ Ztring codec_name;
+ int128u codec_guid;
+ int32u num_rates;
+ int16u codec_version, average_bps, packet_size, block_size, sampling_rate, sample_size;
+ int8u major, minor;
+ Get_L1 (major, "major");
+ Get_L1 (minor, "minor");
+ Get_GUID(codec_guid, "codec-guid");
+ Get_L2 (codec_version, "codec-version");
+ Get_Local(80, codec_name, "codec-name");
+ Get_L2 (average_bps, "average-bps");
+ Get_L2 (packet_size, "packet-size");
+ Get_L2 (block_size, "block-size");
+ Get_L2 (sampling_rate, "sampling-rate");
+ Get_L2 (sample_size, "sample-size");
+ Element_Begin("rate-map-table");
+ Get_L4 (num_rates, "num-rates");
+ for (int32u rate=0; rate<num_rates; rate++)
+ {
+ Skip_L2( "rate-size");
+ Skip_L2( "rate-octet");
+ }
+ Element_End();
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ if (Element_Offset<Element_Size)
+ Skip_L4( "Reserved"); //Some files don't have the 5th reserved dword
+
+ FILLING_BEGIN_PRECISE();
+ Stream_Prepare (Stream_Audio);
+ switch (codec_guid.hi)
+ {
+ case Elements::QLCM_QCELP1 :
+ case Elements::QLCM_QCELP2 : Fill(Stream_Audio, 0, Audio_Format, "QCELP"); Fill(Stream_Audio, 0, Audio_Codec, "QCELP"); break;
+ case Elements::QLCM_EVRC : Fill(Stream_Audio, 0, Audio_Format, "EVRC"); Fill(Stream_Audio, 0, Audio_Codec, "EVRC"); break;
+ case Elements::QLCM_SMV : Fill(Stream_Audio, 0, Audio_Format, "SMV"); Fill(Stream_Audio, 0, Audio_Codec, "SMV"); break;
+ default : ;
+ }
+ Fill(Stream_Audio, 0, Audio_BitRate, average_bps);
+ Fill(Stream_Audio, 0, Audio_SamplingRate, sampling_rate);
+ Fill(Stream_Audio, 0, Audio_Resolution, sample_size);
+ Fill(Stream_Audio, 0, Audio_Channel_s_, 1);
+ FILLING_END();
+}
+
+#if defined(MEDIAINFO_GXF_YES)
+//---------------------------------------------------------------------------
+void File_Riff::rcrd()
+{
+ Data_Accept("Ancillary media packets");
+ Element_Name("Ancillary media packets");
+
+ //Filling
+ Fill(Stream_General, 0, General_Format, "Ancillary media packets"); //GXF, RDD14-2007
+
+ //Clearing old data
+ for (size_t Pos=0; Pos<Cdp_Data->size(); Pos++)
+ delete (*Cdp_Data)[Pos]; //(*Cdp_Data)[0]=NULL;
+ Cdp_Data->clear();
+ for (size_t Pos=0; Pos<AfdBarData_Data->size(); Pos++)
+ delete (*AfdBarData_Data)[Pos]; //(*AfdBarData_Data)[0]=NULL;
+ AfdBarData_Data->clear();
+}
+
+//---------------------------------------------------------------------------
+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");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::rcrd_fld__anc__pos_()
+{
+ Element_Name("Ancillary data sample description");
+
+ //Parsing
+ Skip_L4( "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");
+
+ Element_Begin("Decoding");
+ //Parsing
+ int8u DataID, SecondaryDataID, DataCount;
+ Get_L1 (DataID, "Data ID");
+ Skip_L1( "Parity+Unused"); //even:1, odd:2
+ Get_L1 (SecondaryDataID, "Secondary Data ID"); Param_Info(Riff_Rcrd_DataServices(DataID, SecondaryDataID));
+ Skip_L1( "Parity+Unused"); //even:1, odd:2
+ Get_L1 (DataCount, "Data count");
+ Skip_L1( "Parity+Unused"); //even:1, odd:2
+
+ //Buffer
+ int8u* Payload=new int8u[DataCount];
+ for(int8u Pos=0; Pos<DataCount; Pos++)
+ {
+ Get_L1 (Payload[Pos], "Data");
+ Skip_L1( "CRC+Unused"); //even:1, odd:2
+ }
+
+ //Parsing
+ Skip_L1( "Checksum");
+ Skip_L1( "Parity+Unused"); //even:1, odd:2
+ Element_End();
+
+ FILLING_BEGIN();
+ if (DataID>=rcrd_Parsers.size())
+ rcrd_Parsers.resize(DataID+1);
+ if (SecondaryDataID>=rcrd_Parsers[DataID].size())
+ rcrd_Parsers[DataID].resize(SecondaryDataID+1);
+ if (rcrd_Parsers[DataID][SecondaryDataID]==NULL)
+ {
+ switch (DataID)
+ {
+ case 0x41 : // (from SMPTE 2016-3)
+ switch (SecondaryDataID)
+ {
+ case 0x05 : //Bar Data (from SMPTE 2016-3), saving data for future use
+ #if defined(MEDIAINFO_AFDBARDATA_YES)
+ if (AfdBarData_Data)
+ {
+ buffered_data* AfdBarData=new buffered_data;
+ AfdBarData->Data=new int8u[(size_t)DataCount];
+ std::memcpy(AfdBarData->Data, Payload, (size_t)DataCount);
+ AfdBarData->Size=(size_t)DataCount;
+ AfdBarData_Data->push_back(AfdBarData);
+ }
+ #endif //MEDIAINFO_AFDBARDATA_YES
+ break;
+ default : ;
+ ;
+ }
+ break;
+ case 0x45 : // (from SMPTE 2020-1)
+ switch (SecondaryDataID)
+ {
+ case 0x01 : //No association
+ case 0x02 : //Channel pair 1/2
+ case 0x03 : //Channel pair 3/4
+ case 0x04 : //Channel pair 5/6
+ case 0x05 : //Channel pair 7/8
+ case 0x06 : //Channel pair 9/10
+ case 0x07 : //Channel pair 11/12
+ case 0x08 : //Channel pair 13/14
+ case 0x09 : //Channel pair 15/16
+ break;
+ default : ;
+ ;
+ }
+ break;
+ case 0x61 : //Defined data services (from SMPTE 331-1)
+ switch (SecondaryDataID)
+ {
+ case 0x01 : //CDP (from SMPTE 331-1), saving data for future use
+ #if defined(MEDIAINFO_CDP_YES)
+ if (Cdp_Data)
+ {
+ buffered_data* Cdp=new buffered_data;
+ Cdp->Data=new int8u[(size_t)DataCount];
+ std::memcpy(Cdp->Data, Payload, (size_t)DataCount);
+ Cdp->Size=(size_t)DataCount;
+ Cdp_Data->push_back(Cdp);
+ }
+ #endif //MEDIAINFO_CDP_YES
+ break;
+ case 0x02 : //CEA-608 (from SMPTE 331-1)
+ #if defined(MEDIAINFO_EIA608_YES)
+ if (DataCount==3) //This must be 3-byte data
+ {
+ //CEA-608 in video presentation order
+ }
+ #endif //MEDIAINFO_EIA608_YES
+ break;
+ default : ;
+ ;
+ }
+ break;
+ case 0x62 : //Variable-format data services (from SMPTE 331-1)
+ switch (SecondaryDataID)
+ {
+ case 0x01 : //Program description (from SMPTE 331-1),
+ break;
+ case 0x02 : //Data broadcast (from SMPTE 331-1)
+ break;
+ case 0x03 : //VBI data (from SMPTE 331-1)
+ break;
+ default : ;
+ ;
+ }
+ break;
+ default : ;
+ }
+ }
+ FILLING_END();
+ delete[] Payload; //Payload=NULL
+}
+
+//---------------------------------------------------------------------------
+void File_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");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::RMP3_data()
+{
+ Element_Name("Raw datas");
+
+ //Parsing
+ #if defined(MEDIAINFO_MPEGA_YES)
+ File_Mpega MI;
+ Open_Buffer_Init(&MI);
+ Open_Buffer_Continue(&MI);
+ Finish(&MI);
+ Merge(MI, Stream_Audio, 0, 0);
+ #else
+ Stream_Prepare(Stream_Audio);
+ Fill(Stream_Audio, 0, Audio_Codec, "MPEG1/2 Audio");
+ #endif
+
+ //Positionning
+ Element_Offset+=Element_TotalSize_Get()-Element_Size;
+}
+
+//---------------------------------------------------------------------------
+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, "M-JPEG");
+ Fill(Stream_Video, 0, Video_Codec, "M-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
+ 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");
+}
+
+//---------------------------------------------------------------------------
+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, OriginationDate, OriginationTime, History;
+ int16u Version;
+ Get_Local(256, Description, "Description");
+ Get_Local( 32, Originator, "Originator");
+ Skip_Local(32, "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_Offset<Element_Size)
+ Get_Local(Element_Size-Element_Offset, History, "History");
+
+ FILLING_BEGIN();
+ Fill(Stream_General, 0, General_Description, Description);
+ Fill(Stream_General, 0, General_Producer, Originator);
+ Fill(Stream_General, 0, General_Encoded_Date, _T("UTC ")+OriginationDate+_T(' ')+OriginationTime);
+ Fill(Stream_General, 0, General_Encoded_Library_Settings, History);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::WAVE_cue_()
+{
+ Element_Name("Cue points");
+
+ //Parsing
+ int32u numCuePoints;
+ Get_L4(numCuePoints, "numCuePoints");
+ for (int32u Pos=0; Pos<numCuePoints; Pos++)
+ {
+ Element_Begin("Cue point");
+ Skip_L4( "ID");
+ Skip_L4( "Position");
+ Skip_C4( "DataChunkID");
+ Skip_L4( "ChunkStart");
+ Skip_L4( "BlockStart");
+ Skip_L4( "SampleOffset");
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::WAVE_data()
+{
+ Element_Name("Raw datas");
+
+ if (Element_TotalSize_Get()<100)
+ {
+ Skip_XX(Element_Size, "Unknown");
+ return; //This is maybe embeded in another container, and there is only the header (What is the junk?)
+ }
+
+ FILLING_BEGIN();
+ Fill(Stream_Audio, 0, Audio_StreamSize, Element_TotalSize_Get());
+ FILLING_END();
+
+ //Parsing
+ Element_Code=CC4("00wb");
+ AVI__movi_xxxx();
+ if (File_GoTo==(int64u)-1)
+ Skip_XX(Element_TotalSize_Get()-Element_Offset, "Data");
+
+ FILLING_BEGIN();
+ int64u Duration=Retrieve(Stream_Audio, 0, Audio_Duration).To_int64u();
+ int64u BitRate=Retrieve(Stream_Audio, 0, Audio_BitRate).To_int64u();
+ if (Duration)
+ {
+ int64u BitRate_New=Element_TotalSize_Get()*8*1000/Duration;
+ if (BitRate_New<BitRate*0.95 || BitRate_New>BitRate*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=Element_TotalSize_Get()*8*1000/BitRate;
+ Fill(Stream_Audio, 0, Audio_Duration, Duration, 10, true);
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+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; Pos<tableLength; Pos++)
+ Skip_L8( "table[]");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::WAVE_fact()
+{
+ Element_Name("Sample count");
+
+ //Parsing
+ int64u SamplesCount64;
+ int32u SamplesCount;
+ Get_L4 (SamplesCount, "SamplesCount");
+ SamplesCount64=SamplesCount;
+ if (SamplesCount64==0xFFFFFFFF)
+ SamplesCount64=SamplesCount64;
+
+ FILLING_BEGIN();
+ int32u SamplingRate=Retrieve(Stream_Audio, 0, Audio_SamplingRate).To_int32u();
+ if (SamplingRate)
+ {
+ //Calculating
+ int64u Duration=(SamplesCount64*1000)/SamplingRate;
+
+ //Coherency test
+ bool IsOK=true;
+ if (File_Size!=(int64u)-1)
+ {
+ int64u BitRate=Retrieve(Stream_Audio, 0, Audio_BitRate).To_int64u();
+ int64u Duration_FromBitRate=File_Size*8*1000/BitRate;
+ if (Duration_FromBitRate>Duration*1.10 || Duration_FromBitRate<Duration*0.9)
+ IsOK=false;
+ }
+
+ //Filling
+ if (IsOK)
+ Fill(Stream_Audio, 0, Audio_Duration, Duration);
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::WAVE_fmt_()
+{
+ //Compute the current codec ID
+ Stream_ID=0x30300000;
+ stream_Count=1;
+
+ Stream[0x30300000].fccType=Elements::AVI__hdlr_strl_strh_auds;
+ AVI__hdlr_strl_strf();
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::WAVE_ID3_()
+{
+ Element_Name("ID3v2 tags");
+
+ //Parsing
+ #if defined(MEDIAINFO_ID3V2_YES)
+ File_Id3v2 MI;
+ Open_Buffer_Init(&MI);
+ Open_Buffer_Continue(&MI);
+ Finish(&MI);
+ Merge(MI, Stream_General, 0, 0);
+ #endif
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::WAVE_iXML()
+{
+ Element_Name("iXML");
+
+ //Parsing
+ Skip_Local(Element_Size, "XML data");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::wave()
+{
+ Data_Accept("Wave64");
+ Element_Name("Wave64");
+
+ //Filling
+ Fill(Stream_General, 0, General_Format, "Wave64");
+}
+
+//---------------------------------------------------------------------------
+void File_Riff::W3DI()
+{
+ Element_Name("IDVX tags (Out of specs!)");
+
+ //Parsing
+ int32u Size=(int32u)Element_Size;
+ Ztring Title, Artist, Album, Unknown, Genre, Comment;
+ int32u TrackPos;
+ Get_Local(Size, Title, "Title");
+ Element_Offset=(int32u)Title.size();
+ Size-=(int32u)Title.size();
+ if (Size==0) return;
+ Skip_L1( "Zero"); Size--; //NULL char
+ Get_Local(Size, Artist, "Artist");
+ Element_Offset=(int32u)Title.size()+1+(int32u)Artist.size();
+ Size-=(int32u)Artist.size();
+ if (Size==0) return;
+ Skip_L1( "Zero"); Size--; //NULL char
+ Get_Local(Size, Album, "Album");
+ Element_Offset=(int32u)Title.size()+1+(int32u)Artist.size()+1+(int32u)Album.size();
+ Size-=(int32u)Album.size();
+ if (Size==0) return;
+ Skip_L1( "Zero"); Size--; //NULL char
+ Get_Local(Size, Unknown, "Unknown");
+ Element_Offset=(int32u)Title.size()+1+(int32u)Artist.size()+1+(int32u)Album.size()+1+(int32u)Unknown.size();
+ Size-=(int32u)Unknown.size();
+ if (Size==0) return;
+ Skip_L1( "Zero"); Size--; //NULL char
+ Get_Local(Size, Genre, "Genre");
+ Element_Offset=(int32u)Title.size()+1+(int32u)Artist.size()+1+(int32u)Album.size()+1+(int32u)Unknown.size()+1+(int32u)Genre.size();
+ Size-=(int32u)Genre.size();
+ if (Size==0) return;
+ Skip_L1( "Zero"); Size--; //NULL char
+ Get_Local(Size, Comment, "Comment");
+ Element_Offset=(int32u)Title.size()+1+(int32u)Artist.size()+1+(int32u)Album.size()+1+(int32u)Unknown.size()+1+(int32u)Genre.size()+1+(int32u)Comment.size();
+ Size-=(int32u)Comment.size();
+ if (Size==0) return;
+ Skip_L1( "Zero"); Size--; //NULL char
+ Get_L4 (TrackPos, "Track_Position");
+ if(Element_Offset+8<Element_Size)
+ Skip_XX(Element_Size-Element_Offset, "Unknown");
+ Element_Begin("Footer");
+ Skip_L4( "Size");
+ Skip_C4( "Name");
+ Element_End();
+
+ //Filling
+ Fill(Stream_General, 0, General_Track, Title);
+ Fill(Stream_General, 0, General_Performer, Artist);
+ Fill(Stream_General, 0, General_Album, Album);
+ Fill(Stream_General, 0, "Unknown", Unknown);
+ Fill(Stream_General, 0, General_Genre, Genre);
+ Fill(Stream_General, 0, General_Comment, Comment);
+ Fill(Stream_General, 0, General_Track_Position, TrackPos);
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_RIFF_YES
+
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Rm.cpp b/src/thirdparty/MediaInfo/Multiple/File_Rm.cpp
new file mode 100644
index 000000000..480a27602
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Rm.cpp
@@ -0,0 +1,785 @@
+// File_Rm - Info for Real Media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_RM_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include <ZenLib/ZtringListList.h>
+#include <ZenLib/Utils.h>
+#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; Pos<num_packets; Pos++)
+ {
+ Element_Begin("packet");
+ Get_B2 (Version, "object_version");
+ INTEGRITY_VERSION(1);
+ Get_B2 (length, "length"); //The length of the packet in bytes.
+ if (Version==0)
+ Element_Info("Media_Packet_Header");
+ else
+ Element_Info("Media_Packet_Header");
+ Skip_B2( "stream_number"); //The 16-bit alias used to associate data packets with their associated Media Properties Header.
+ Skip_B4( "timestamp"); //The time stamp of the packet in milliseconds.
+ if (Version==0)
+ {
+ Skip_B1( "packet_group"); //The packet group to which the packet belongs. If packet grouping is not used, set this field to 0 (zero).
+ Get_B1 (flags, "flags"); //Flags describing the properties of the packet.
+ Skip_Flags(flags, 0, "reliable"); //If this flag is set, the packet is delivered reliably.
+ Skip_Flags(flags, 1, "keyframe"); //If this flag is set, the packet is part of a key frame or in some way marks a boundary in your data stream.
+ }
+ if (Version==1)
+ {
+ Skip_B2( "asm_rule"); //The ASM rule assigned to this packet.
+ Skip_B1( "asm_Flags"); //Contains HX_ flags that dictate stream switching points.
+ }
+ if (Version==0)
+ Skip_XX(length-12, "data");
+ else
+ Skip_XX(length-13, "data");
+
+ //Stopping if too far
+ if (Pos>10)
+ {
+ Pos=num_packets;
+ Element_Info("(...)");
+ }
+
+ Element_End();
+ }
+ */
+}
+
+//---------------------------------------------------------------------------
+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; Pos<num_indices; Pos++)
+ {
+ Element_Begin("index", 14);
+ Get_B2 (Version, "object_version");
+ INTEGRITY_VERSION(0);
+ Element_Info("Media_Packet_Header");
+ Skip_B4( "timestamp"); //The time stamp (in milliseconds) associated with this record.
+ Skip_B4( "offset"); //The offset from the start of the file at which this packet can be found.
+ Skip_B4( "packet_count_for_this_packet"); //The packet number of the packet for this record. This is the same number of packets that would have been seen had the file been played from the beginning to this point.
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Rm::MDPR()
+{
+ NAME_VERSION("MeDia PRoperties");
+ INTEGRITY_VERSION(0);
+
+ //Parsing
+ Ztring stream_name;
+ std::string mime_type;
+ int32u avg_bit_rate, start_time, duration, type_specific_len;
+ int16u stream_number;
+ int8u stream_name_size, mime_type_size;
+ Get_B2 (stream_number, "stream_number"); //Unique value that identifies a physical stream
+ Skip_B4( "max_bit_rate"); //The maximum bit rate required to deliver this stream over a network.
+ Get_B4 (avg_bit_rate, "avg_bit_rate"); //The average bit rate required to deliver this stream over a network.
+ Skip_B4( "max_packet_size"); //The largest packet size (in bytes) in the stream of media data.
+ Skip_B4( "avg_packet_size"); //The average packet size (in bytes) in the stream of media data.
+ Get_B4 (start_time, "start_time"); //The time offset in milliseconds to add to the time stamp of each packet in a physical stream.
+ Skip_B4( "preroll"); //The time offset in milliseconds to subtract from the time stamp of each packet in a physical stream.
+ Get_B4 (duration, "duration"); //The duration of the stream in milliseconds.
+ Get_B1 (stream_name_size, "stream_name_size"); //The length of the following stream_name member in bytes.
+ Get_Local(stream_name_size, stream_name, "stream_name"); //A nonunique alias or name for the stream.
+ Get_B1 (mime_type_size, "mime_type_size"); //The length of the following mime_type field in bytes.
+ Get_String(mime_type_size, mime_type, "mime_type"); //A nonunique MIME style type/subtype string for data associated with the stream.
+ Get_B4 (type_specific_len, "type_specific_len"); //The length of the following type_specific_data in bytes
+
+ //Parsing TypeSpecific
+ Element_Info(mime_type.c_str());
+ MDPR_IsStream=true;
+ if (0);
+ else if (mime_type=="audio/x-pn-multirate-realaudio")
+ MDPR_IsStream=false; //What do we with this?
+ else if (mime_type=="audio/X-MP3-draft-00")
+ {
+ Stream_Prepare(Stream_Audio);
+ CodecID_Fill(Ztring(mime_type.c_str()), Stream_Audio, StreamPos_Last, InfoCodecID_Format_Real);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "MPEG1AL3");
+ }
+ else if (mime_type=="audio/x-pn-realaudio")
+ MDPR_realaudio();
+ else if (mime_type=="audio/x-pn-realaudio-encrypted")
+ {
+ MDPR_realaudio();
+ Fill(Stream_Audio, StreamPos_Last, Audio_Encryption, "Y");
+ }
+ else if (mime_type=="audio/x-ralf-mpeg4")
+ {
+ Stream_Prepare(Stream_Audio);
+ CodecID_Fill(Ztring(mime_type.c_str()), Stream_Audio, StreamPos_Last, InfoCodecID_Format_Real);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "ralf");
+ }
+ else if (mime_type=="audio/x-ralf-mpeg4-generic")
+ {
+ Stream_Prepare(Stream_Audio);
+ CodecID_Fill(Ztring(mime_type.c_str()), Stream_Audio, StreamPos_Last, InfoCodecID_Format_Real);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "ralf");
+ }
+ else if (mime_type.find("audio/")==0)
+ Stream_Prepare(Stream_Audio);
+ else if (mime_type=="video/text")
+ Stream_Prepare(Stream_Text);
+ else if (mime_type=="video/x-pn-multirate-realvideo")
+ MDPR_IsStream=false; //What do we with this?
+ else if (mime_type=="video/x-pn-realvideo")
+ MDPR_realvideo();
+ else if (mime_type=="video/x-pn-realvideo-encrypted")
+ {
+ MDPR_realvideo();
+ Fill(Stream_Video, StreamPos_Last, Video_Encryption, "Y");
+ }
+ else if (mime_type.find("video/")==0)
+ Stream_Prepare(Stream_Video);
+ else if (mime_type=="logical-audio/x-pn-multirate-realaudio")
+ MDPR_IsStream=false; //What do we with this?
+ else if (mime_type.find("logical-audio/")==0)
+ MDPR_IsStream=false; //What do we with this?
+ else if (mime_type=="logical-fileinfo")
+ MDPR_fileinfo();
+ else if (mime_type=="logical-video/x-pn-multirate-realvideo")
+ MDPR_IsStream=false; //What do we with this?
+ else if (mime_type.find("logical-video/")==0)
+ MDPR_IsStream=false; //What do we with this?
+ else
+ MDPR_IsStream=false;
+
+ //Filling
+ FILLING_BEGIN();
+ if (MDPR_IsStream)
+ {
+ Fill(StreamKind_Last, StreamPos_Last, General_ID, stream_number);
+ Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_BitRate), avg_bit_rate, 10, true);
+ Fill(StreamKind_Last, StreamPos_Last, "Delay", start_time);
+ Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Duration), duration);
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Rm::MDPR_realvideo()
+{
+ //Parsing
+ int32u Codec;
+ int16u Width, Height, FrameRate;
+ Skip_B4( "Size");
+ Skip_C4( "FCC");
+ Get_C4 (Codec, "Compression");
+ Get_B2 (Width, "Width");
+ Get_B2 (Height, "Height");
+ Skip_B2( "bpp"); //Do not use it
+ Skip_B4( "Unknown");
+ Get_B2 (FrameRate, "fps");
+ Skip_B2( "Unknown");
+ Skip_C4( "Type1");
+ Skip_C4( "Type2");
+
+ //Filling
+ if (!Status[IsAccepted])
+ Accept("RealMedia"); //Is subs
+
+ Stream_Prepare(Stream_Video);
+ if (FromMKV_StreamType==Stream_Max) //Using the one from the container
+ CodecID_Fill(Ztring().From_CC4(Codec), Stream_Video, StreamPos_Last, InfoCodecID_Format_Real);
+ Fill(Stream_Video, StreamPos_Last, Video_Codec, Ztring().From_CC4(Codec));
+ Fill(Stream_Video, StreamPos_Last, Video_Width, Width); //Width
+ Fill(Stream_Video, StreamPos_Last, Video_Height, Height); //Height
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate, (float)FrameRate); //FrameRate
+}
+
+//---------------------------------------------------------------------------
+void File_Rm::MDPR_realaudio()
+{
+ //Parsing
+ Ztring FourCC3="lpcJ"; //description of this codec : http://focus.ti.com/lit/an/spra136/spra136.pdf http://en.wikipedia.org/wiki/VSELP
+ Ztring FourCC4;
+ int32u FourCC5=0, BytesPerMinute=0;
+ int16u Version, Samplerate=8000, Samplesize=16, Channels=0;
+ Skip_C4( "Header signature");
+ Get_B2 (Version, "Version");
+ INTEGRITY_VERSION(5);
+ if (Version==3)
+ {
+ Ztring title, author, copyright, comment;
+ int32u length;
+ int8u title_len, author_len, copyright_len, comment_len;
+ Skip_B2( "Header size"); //Header size, after this tag.
+ Get_B2 (Channels, "Channels");
+ Skip_B4( "Uknown");
+ Skip_B4( "Uknown");
+ Skip_B4( "Data size");
+ Get_B1 (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_B1 (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_B1 (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_B1 (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.
+ if (Element_Offset<Element_Size) //Optional
+ {
+ Skip_B1( "Uknown");
+ Get_B4 (length, "Fourcc string length");
+ Get_Local(length, FourCC3, "Fourcc string");
+ }
+
+ //Filling
+ Fill(Stream_General, 0, General_Duration, title);
+ Fill(Stream_General, 0, General_Performer, author);
+ Fill(Stream_General, 0, General_Copyright, copyright);
+ Fill(Stream_General, 0, General_Comment, comment);
+ }
+ if (Version==4 || Version==5)
+ {
+ Skip_B2( "Unused");
+ Skip_C4( "ra signature");
+ Skip_B4( "AudioFileSize");
+ Skip_B2( "Version2");
+ Skip_B4( "Header size");
+ Skip_B2( "Codec flavor");
+ Skip_B4( "Coded frame size");
+ Skip_B4( "AudioBytes");
+ Get_B4 (BytesPerMinute, "BytesPerMinute");
+ Skip_B4( "Unknown");
+ Skip_B2( "Sub packet h");
+ Skip_B2( "Frame size");
+ Skip_B2( "Subpacket size");
+ Skip_B2( "Unknown");
+ }
+ if (Version==5)
+ {
+ Skip_B2( "Unknown");
+ Skip_B2( "Unknown");
+ Skip_B2( "Unknown");
+ }
+ if (Version==4 || Version==5)
+ {
+ Get_B2 (Samplerate, "Samplerate");
+ Skip_B2( "Unknown");
+ Get_B2 (Samplesize, "Samplesize");
+ Get_B2 (Channels, "Channels");
+ }
+ if (Version==4)
+ {
+ int8u length;
+ Get_B1 (length, "Interleaver ID string lengt");
+ Skip_Local(length, "Interleaver ID string");
+ Get_B1 (length, "FourCC string lengt");
+ Get_Local(length, FourCC4, "FourCC string");
+ }
+ if (Version==5)
+ {
+ Skip_C4( "Interleaver ID");
+ Get_C4 (FourCC5, "FourCC");
+ }
+ if (Version==4 || Version==5)
+ {
+ Skip_B1( "Unknown");
+ Skip_B1( "Unknown");
+ Skip_B1( "Unknown");
+ }
+ if (Version==5)
+ {
+ Skip_B1( "Unknown");
+ }
+ if (Version==4 || Version==5)
+ {
+ int32u length;
+ Get_B4 (length, "Codec extradata length");
+ Skip_XX(length, "Codec extradata");
+ }
+
+ //Filling
+ if (!Status[IsAccepted])
+ Accept("RealMedia"); //Is subs
+
+ Stream_Prepare(Stream_Audio);
+ if (Version==3)
+ {
+ if (FromMKV_StreamType==Stream_Max) //Using the one from the container
+ CodecID_Fill(FourCC3, Stream_Audio, StreamPos_Last, InfoCodecID_Format_Real);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Codec, FourCC3);
+ }
+ if (Version==4)
+ {
+ if (FromMKV_StreamType==Stream_Max) //Using the one from the container
+ CodecID_Fill(FourCC4, Stream_Audio, StreamPos_Last, InfoCodecID_Format_Real);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Codec, FourCC4);
+ }
+ if (Version==5)
+ {
+ if (FromMKV_StreamType==Stream_Max) //Using the one from the container
+ CodecID_Fill(Ztring().From_CC4(FourCC5), Stream_Audio, StreamPos_Last, InfoCodecID_Format_Real);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Ztring().From_CC4(FourCC5));
+ }
+ Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, Samplerate);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Resolution, Samplesize);
+ Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Channels);
+ if (BytesPerMinute)
+ Fill(Stream_Audio, StreamPos_Last, Audio_BitRate, BytesPerMinute*8/60, 10, true);
+}
+
+//---------------------------------------------------------------------------
+void File_Rm::MDPR_fileinfo()
+{
+ MDPR_IsStream=false;
+
+ //Parsing
+ int16u Version, num_physical_streams, num_rules, num_properties;
+ Skip_B4( "size");
+ Get_B2 (Version, "object_version");
+ INTEGRITY_VERSION(0);
+ Get_B2 (num_physical_streams, "num_physical_streams"); //The number of physical streams that make up this logical stream.
+ for (int16u Pos=0; Pos<num_physical_streams; Pos++)
+ {
+ Skip_B2( "physical_stream_numbers"); //The list of physical stream numbers that comprise this logical stream.
+ Skip_B4( "data_offsets"); //The list of data offsets indicating the start of the data section for each physical stream.
+ }
+ Get_B2 (num_rules, "num_rules"); //The number of ASM rules for the logical stream. Each physical stream in the logical stream has at least one ASM rule associated with it or it will never get played. The mapping of ASM rule numbers to physical stream numbers is stored in a list immediately following this member. These physical stream numbers refer to the stream_number field found in the Media Properties Object for each physical stream belonging to this logical stream.
+ for (int16u Pos=0; Pos<num_physical_streams; Pos++)
+ Skip_B2( "rule_to_physical_stream_number_map"); //The list of physical stream numbers that map to each rule. Each entry in the map corresponds to a 0-based rule number. The value in each entry is set to the physical stream number for the rule.
+ Get_B2 (num_properties, "num_properties"); //The number of NameValueProperty structures contained in this structure. These name/value structures can be used to identify properties of this logical stream (for example, language).
+
+ //Parsing
+ for (int16u Pos=0; Pos<num_properties; Pos++)
+ {
+ Element_Begin("property");
+ std::string name;
+ int32u size, type;
+ int16u value_length;
+ int8u name_length;
+ Peek_B4(size);
+ Skip_B4( "size");
+ Skip_B2( "object_version");
+ Get_B1 (name_length, "name_length"); //The length of the name data.
+ Get_String(name_length, name, "name"); //The name string data.
+ Get_B4 (type, "type"); //The type of the value data.
+ Get_B2 (value_length, "value_length"); //value_length
+ switch (type)
+ {
+ case 0 : //Unsigned integer
+ Skip_B4( "value_data"); break; //unsigned integer
+ case 2 : //String
+ Skip_Local(value_length, "value_data"); break; //string
+ default : Skip_XX(value_length, "unknown");
+ }
+ Element_End(size);
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Rm::PROP()
+{
+ NAME_VERSION("PROPerties");
+ INTEGRITY_VERSION(0);
+
+ //Parsing
+ int32u avg_bit_rate, duration;
+ int16u flags;
+ Skip_B4( "max_bit_rate"); //The maximum bit rate required to deliver this file over a network.
+ Get_B4 (avg_bit_rate, "avg_bit_rate"); //The average bit rate required to deliver this file over a network.
+ Skip_B4( "max_packet_size"); //The largest packet size (in bytes) in the media data.
+ Skip_B4( "avg_packet_size"); //The average packet size (in bytes) in the media data.
+ Skip_B4( "num_packets"); //The number of packets in the media data.
+ Get_B4 (duration, "duration"); //The duration of the file in milliseconds.
+ Skip_B4( "preroll"); //The number of milliseconds to prebuffer before starting playback.
+ Skip_B4( "index_offset"); //The offset in bytes from the start of the file to the start of the index header object.
+ Skip_B4( "data_offset"); //The offset in bytes from the start of the file to the start of the Data Section. \n Note: There can be a number of Data_Chunk_Headers in a RealMedia file. The data_offset value specifies the offset in bytes to the first Data_Chunk_Header. The offsets to the other Data_Chunk_Headers can be derived from the next_data_header field in a Data_Chunk_Header.
+ Skip_B2( "num_streams"); //The total number of media properties headers in the main headers section.
+ Get_B2 (flags, "flags"); //Bit mask containing information about this file.
+ Skip_Flags(flags, 0, "Save_Enabled"); //If 1, clients are allowed to save this file to disk.
+ Skip_Flags(flags, 1, "Perfect_Play"); //If 1, clients are instructed to use extra buffering.
+ Skip_Flags(flags, 2, "Live_Broadcast"); //If 1, these streams are from a live broadcast.
+ Skip_Flags(flags, 3, "Allow_Download");
+
+ //Filling
+ Fill(Stream_General, 0, General_OverallBitRate, avg_bit_rate);
+ Fill(Stream_General, 0, General_Duration, duration);
+}
+
+//---------------------------------------------------------------------------
+void File_Rm::RJMD()
+{
+ Element_Name("Metadata Tag");
+
+ //Parsing
+ Skip_B4( "object_version");
+
+ //Parsing
+ RJMD_property(std::string());
+}
+
+//---------------------------------------------------------------------------
+void File_Rm::RJMD_property(std::string Name)
+{
+ //Element_Name("Property");
+
+ //Parsing
+ Ztring value;
+ std::string name;
+ int32u type, flags, num_subproperties, name_length, value_length;
+ Element_Begin("MetadataProperty");
+ Skip_B4( "size");
+ Get_B4 (type, "type");
+ Get_B4 (flags, "flags");
+ Skip_Flags(flags, 0, "readonly"); //Read only, cannot be modified.
+ Skip_Flags(flags, 1, "private"); //Private, do not expose to users.
+ Skip_Flags(flags, 2, "type_dexcriptor"); //Type descriptor used to further define type of value.
+ Skip_B4( "value_offset"); //The offset to the value_length , relative to the beginning of the MetadataProperty structure.
+ Skip_B4( "subproperties_offset"); //The offset to the subproperties_list , relative to the beginning of the MetadataProperty structure.
+ Get_B4 (num_subproperties, "num_subproperties"); //The number of subproperties for this MetadataProperty structure.
+ Get_B4 (name_length, "name_length"); //The length of the name data, including the null-terminator.
+ Get_String(name_length, name, "name"); //The name of the property (string data).
+ Get_B4 (value_length, "value_length"); //The length of the value data.
+ switch(type)
+ {
+ case 0x00 : //Nothing
+ Skip_XX(value_length, "Junk");
+ break;
+ case 0x01 : //String (text).
+ Get_Local(value_length, value, "value"); //String.
+ break;
+ case 0x02 : //Separated list of strings, separator specified as sub-property/type descriptor.
+ Get_Local(value_length, value, "value"); //String.
+ break;
+ case 0x03 : //Boolean flag—either 1 byte or 4 bytes, check size value.
+ switch(value_length)
+ {
+ case 1 : {
+ int8u valueI;
+ Get_L1(valueI, "value"); //1-byte boolean.
+ value.From_Number(valueI);
+ }
+ break;
+ case 4 : {
+ int32u valueI;
+ Get_L4(valueI, "value"); //4-byte boolean.
+ value.From_Number(valueI);
+ }
+ break;
+ default: Skip_XX(value_length, "Unknown");
+ }
+ break;
+ case 0x04 : //Four-byte integer.
+ {
+ int32u valueI;
+ Get_L4(valueI, "value");
+ value.From_Number(valueI);
+ }
+ break;
+ case 0x05 : //Byte stream.
+ Skip_XX(value_length, "Byte stream");
+ break;
+ case 0x06 : //String (URL).
+ Get_Local(value_length, value, "value"); //String.
+ break;
+ case 0x07 : //String representation of the date in the form: YYYYmmDDHHMMSS (m = month, M = minutes).
+ Get_Local(value_length, value, "value"); //String.
+ break;
+ case 0x08 : //String (file name)
+ Get_Local(value_length, value, "value"); //String.
+ break;
+ case 0x09 : //This property has subproperties, but its own value is empty.
+ Skip_XX(value_length, "junk");
+ break;
+ case 0x0A : //Large buffer of data, use sub-properties/type descriptors to identify mime-type.
+ Skip_XX(value_length, "data");
+ break;
+ default : //Unknown
+ Skip_XX(value_length, "unknown");
+ break;
+ }
+
+ //Filling
+ if (!Name.empty())
+ Name+='/';
+ Name+=name;
+ if (Name!="Track/Comments/DataSize"
+ && Name!="Track/Comments/MimeType"
+ )
+ Fill(Stream_General, 0, Name.c_str(), value);
+
+ //Parsing
+ for (int32u Pos=0; Pos<num_subproperties; Pos++)
+ {
+ Element_Begin("PropListEntry");
+ Skip_B4( "offset"); //The offset for this indexed sub-property, relative to the beginning of the containing MetadataProperty.
+ Skip_B4( "num_props_for_name"); //The number of sub-properties that share the same name. For example, a lyrics property could have multiple versions as differentiated by the language sub-property type descriptor.
+ Element_End();
+ }
+ for (int32u Pos=0; Pos<num_subproperties; Pos++)
+ {
+ RJMD_property(Name);
+ }
+
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Rm::RMJE()
+{
+ Element_Name("Metadata Section Footer");
+
+ //Parsing
+ Skip_B4( "object_version");
+ Skip_B4( "size"); //The size of the preceding metadata tag.
+}
+
+//---------------------------------------------------------------------------
+void File_Rm::RMMD()
+{
+ Element_Name("Metadata Section Header");
+
+ //Parsing
+ Skip_B4( "size"); //The size of the full metadata section in bytes.
+}
+
+//---------------------------------------------------------------------------
+void File_Rm::TAG()
+{
+ Element_Name("Id3v1 Tag");
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_RM_YES
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Rm.h b/src/thirdparty/MediaInfo/Multiple/File_Rm.h
new file mode 100644
index 000000000..e257f3f5c
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Rm.h
@@ -0,0 +1,76 @@
+// File_Rm - Info for Real Media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Real Media files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_RmH
+#define MediaInfo_File_RmH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Classe File_Rm
+//***************************************************************************
+
+class File_Rm : public File__Analyze
+{
+public :
+ //In
+ stream_t FromMKV_StreamType;
+
+public :
+ File_Rm();
+
+private :
+ //Buffer
+ void Header_Parse();
+ void Data_Parse();
+
+ //Elements
+ void RMF();
+ void CONT();
+ void DATA();
+ void INDX();
+ void MDPR();
+ void MDPR_realvideo();
+ void MDPR_realaudio();
+ void MDPR_fileinfo();
+ void PROP();
+ void RJMD();
+ void RJMD_property(std::string Name);
+ void RMJE();
+ void RMMD();
+ void TAG ();
+
+ //Temp
+ bool MDPR_IsStream;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Skm.cpp b/src/thirdparty/MediaInfo/Multiple/File_Skm.cpp
new file mode 100644
index 000000000..9fbf68226
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Skm.cpp
@@ -0,0 +1,194 @@
+// File_Skm - Info for Skm files
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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()
+{
+ Stream.Parser->Finish();
+ 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+4<File_Size)
+ {
+ Get_B1 (Type, "Type"); //Param_Info(Type<19?Flv_Type[Type]:_T("Unknown"));
+ Get_B3 (BodyLength, "BodyLength");
+ Skip_B3( "Timestamp_Base"); //in ms
+ Skip_B1( "Timestamp_Extended"); //TimeStamp = Timestamp_Extended*0x01000000+Timestamp_Base
+ Skip_B3( "StreamID");
+ }
+ else
+ {
+ Type=0;
+ BodyLength=0;
+ }
+
+ //Filling
+ Header_Fill_Code(Type, Ztring().From_Number(Type, 16));
+ Header_Fill_Size(Element_Offset+BodyLength);
+}
+
+//---------------------------------------------------------------------------
+bool File_Skm::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
+ && CC3(Buffer+Buffer_Offset_Temp)!=0x000001)
+ {
+ Buffer_Offset_Temp+=2;
+ while(Buffer_Offset_Temp<Buffer_Size && Buffer[Buffer_Offset_Temp]!=0x00)
+ Buffer_Offset_Temp+=2;
+ if (Buffer[Buffer_Offset_Temp-1]==0x00)
+ Buffer_Offset_Temp--;
+ }
+
+ //Must wait more data?
+ 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;
+}
+
+//***************************************************************************
+// 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
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Skm.h b/src/thirdparty/MediaInfo/Multiple/File_Skm.h
new file mode 100644
index 000000000..19f67cbdd
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Skm.h
@@ -0,0 +1,83 @@
+// File_Skm - Info for SKM files
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Swf.cpp b/src/thirdparty/MediaInfo/Multiple/File_Swf.cpp
new file mode 100644
index 000000000..051c61b80
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Swf.cpp
@@ -0,0 +1,704 @@
+// File_Swf - Info for SWF files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_SWF_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Multiple/File_Swf.h"
+#include <zlib.h>
+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;
+
+ //Temp
+ Frame_Count=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_Begin("SWF header", 8);
+ Get_C3 (Signature, "Signature");
+ Get_L1 (Version, "Version");
+ Get_L4 (FileLength, "FileLength");
+ Element_End();
+ }
+ 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 Nbits, Xmin, Xmax, Ymin, Ymax;
+ int16u FrameCount;
+ BS_Begin();
+ Get_BS (5, Nbits, "Nbits");
+ Get_BS (Nbits, Xmin, "Xmin");
+ Get_BS (Nbits, Xmax, "Xmax"); Param_Info((Xmax-Xmin)/20, " pixels");
+ Get_BS (Nbits, Ymin, "Ymin");
+ Get_BS (Nbits, Ymax, "Ymax"); Param_Info((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=FrameRate_8_8/0x0100+(((float32)(FrameRate_8_8&0x00FF))/0x0100); //8.8 format
+ Param_Info(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_Info(Tag);
+ Header_Fill_Code(Tag, Ztring().From_Number(Tag, 16));
+
+ //Size
+ int16u Length=TagCodeAndLength&0x003F;
+ if (Length<0x003F)
+ {
+ Param_Info(Length, " bytes");
+
+ //Filling
+ Header_Fill_Size(Element_Offset+Length);
+ }
+ else
+ {
+ int32u Length2;
+ Get_L4(Length2, "Length"); Param_Info(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_Info(Swf_SoundFormat[SoundFormat]);
+ Get_S1 (2, SoundRate, "SoundRate"); Param_Info(Swf_SoundRate[SoundRate], " Hz");
+ Get_S1 (1, SoundSize, "SoundSize"); Param_Info(Swf_SoundSize[SoundSize], " bits");
+ Get_S1 (1, SoundType, "SoundType"); Param_Info(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_Resolution, 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_Info(Swf_SoundRate[PlaybackSoundRate], " Hz");
+ Info_S1(1, PlaybackSoundSize, "PlaybackSoundSize"); Param_Info(Swf_SoundSize[PlaybackSoundSize], " bits");
+ Info_S1(1, PlaybackSoundType, "PlaybackSoundType"); Param_Info(Swf_SoundType[PlaybackSoundType], " channel(s)");
+ Get_S1 (4, StreamSoundCompression, "StreamSoundCompression"); Param_Info(Swf_SoundFormat[StreamSoundCompression]);
+ Get_S1 (2, StreamSoundRate, "StreamSoundRate"); Param_Info(Swf_SoundRate[StreamSoundRate], " Hz");
+ Get_S1 (1, StreamSoundSize, "StreamSoundSize"); Param_Info(Swf_SoundSize[StreamSoundSize], " bits");
+ Get_S1 (1, StreamSoundType, "StreamSoundType"); Param_Info(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_Resolution, 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_Info(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_*
+
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Swf.h b/src/thirdparty/MediaInfo/Multiple/File_Swf.h
new file mode 100644
index 000000000..ffa5e0e3d
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Swf.h
@@ -0,0 +1,133 @@
+// File_Swf - Info for SWF Audio files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
+ size_t 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();
+
+ //Temp
+ size_t Frame_Count;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Umf.cpp b/src/thirdparty/MediaInfo/Multiple/File_Umf.cpp
new file mode 100644
index 000000000..d2074284e
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Umf.cpp
@@ -0,0 +1,208 @@
+// File_Flv - Info for GXF (SMPTE 360M) files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_GXF_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Multiple/File_Umf.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// 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<Length)
+ return false; //Must wait for more data
+
+ //All should be OK...
+ Accept("UMF");
+ return true;
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Umf::Read_Buffer_Continue()
+{
+ //Parsing
+ int32u Tracks, Segments;
+ Element_Begin("Payload description");
+ Skip_L4( "Total length of the UMF data");
+ Skip_L4( "Version of this file");
+ Get_L4 (Tracks, "Number of tracks in the material");
+ Skip_L4( "Offset to track description section");
+ Skip_L4( "Size of the track description section");
+ Get_L4 (Segments, "Number of segments");
+ Skip_L4( "Offset to media description section");
+ Skip_L4( "Size of the media description section");
+ Skip_L4( "Offset to the user data section");
+ Skip_L4( "Size of the user data section");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ Element_End();
+
+ Element_Begin("Material description");
+ Skip_L4( "Attributes");
+ Skip_L4( "Maximum length of the material in fields");
+ Skip_L4( "Minimum length of the material in fields");
+ Skip_L4( "Material mark in value in fields");
+ Skip_L4( "Material mark out value in fields");
+ Skip_L4( "Time code at mark in value");
+ Skip_L4( "Time code at mark out value");
+ Skip_L4( "last modified time (Most)");
+ Skip_L4( "last modified time (Least)");
+ Skip_L4( "creation time (Most)");
+ Skip_L4( "creation time (Least)");
+ Skip_L2( "Reserved");
+ Skip_L2( "Reserved");
+ Skip_L2( "Number of audio tracks");
+ Skip_L2( "Number of time code tracks");
+ Skip_L2( "Reserved");
+ Skip_L2( "Number of MPEG-1, MPEG-2, and MPEG-2 HD video tracks");
+ Element_End();
+
+ for (int32u Pos=0; Pos<Tracks; Pos++)
+ {
+ Element_Begin("Track description");
+ Skip_C1( "Track information - Track type");
+ Skip_C1( "Track information - Track logical number");
+ Skip_L2( "Number of segments on this track");
+ Element_End();
+
+ if (Element_Offset==Element_Size)
+ break;
+ }
+
+ for (int32u Pos=0; Pos<Segments; Pos++)
+ {
+ Element_Begin("Media description");
+ int32u Type;
+ int16u Length;
+ Get_L2 (Length, "Length of this media description");
+ int64u End=Element_Offset+Length-2;
+ Skip_C1( "Track information - Track type");
+ Skip_C1( "Track information - Track logical number");
+ Skip_L2( "Media Sequence number");
+ Skip_L2( "Reserved");
+ Skip_L4( "Number of fields in segment");
+ Skip_L4( "Reserved");
+ Skip_L4( "Mark in value for the media file in fields");
+ Skip_L4( "Mark out value for the media file in fields");
+ Skip_Local(88, "Source device media file name");
+ Get_L4 (Type, "Type of media track");
+ Skip_L4( "Sampling rates for this track");
+ Skip_L4( "Size of sample for audio and time codes");
+ Skip_L4( "Reserved");
+ switch (Type)
+ {
+ case 0x00000004 :
+ case 0x00000007 :
+ case 0x00000009 : //MPEG-Video
+ Skip_L4( "Color difference format");
+ Skip_L4( "GoP structure");
+ Skip_L4( "Frame/field structure");
+ Skip_L4( "Target I-pictures per GoP");
+ Skip_L4( "Target P-pictures per I-picture");
+ Skip_L4( "Target B-pictures per P-picture or I-picture");
+ Skip_L4( "MPEG video attributes");
+ Skip_L4( "Reserved");
+ break;
+ case 0x00000003 : //TimeCode
+ Skip_L4( "Time code attributes");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ break;
+ case 0x00000002 : //Audio
+ //Skip_LF8( "Level at which to play this segment");
+ //Skip_LF8( "Level at which to terminate this segment");
+ Skip_L8( "Level at which to play this segment");
+ Skip_L8( "Level at which to terminate this segment");
+ Skip_L4( "Number of fields over which to ramp up");
+ Skip_L4( "Number of fields over which to ramp down");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ break;
+ default :
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ Skip_L4( "Reserved");
+ }
+ if (Element_Offset<End)
+ Skip_XX(End-Element_Offset, "Unknown");
+ Element_End();
+
+ if (Element_Offset==Element_Size)
+ break;
+ }
+
+ while (Element_Offset<Element_Size)
+ {
+ Element_Begin("User data");
+ int32u Length;
+ Get_L4 (Length, "The length of this user data record");
+ Skip_L4( "Position on the material time line");
+ Skip_L2( "Track associated with the user data record");
+ Skip_L2( "Media Sequence Numbe");
+ Skip_L4( "User-defined key");
+ if (Length>18)
+ 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_End();
+ }
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_UMF_YES
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Umf.h b/src/thirdparty/MediaInfo/Multiple/File_Umf.h
new file mode 100644
index 000000000..79b3c949b
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Umf.h
@@ -0,0 +1,54 @@
+// File_Umf - Info for UMF files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about UMF files
+// Unified Material Format
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_UmfH
+#define MediaInfo_File_UmfH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include <map>
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Umf
+//***************************************************************************
+
+class File_Umf : public File__Analyze
+{
+protected :
+ //Buffer - File header
+ bool FileHeader_Begin();
+
+ //Buffer - Global
+ void Read_Buffer_Continue ();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Wm.cpp b/src/thirdparty/MediaInfo/Multiple/File_Wm.cpp
new file mode 100644
index 000000000..71ee1f0dd
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Wm.cpp
@@ -0,0 +1,260 @@
+// File_Wm - Info for Windows Media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Main part
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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
+ DataMustAlwaysBeComplete=false;
+
+ //Stream
+ Packet_Count=0;
+ MaximumDataPacketSize=0;
+ SizeOfMediaObject_BytesAlreadyParsed=0;
+ FileProperties_Preroll=0;
+ Codec_Description_Count=0;
+ Stream_Number=0;
+ Data_Parse_Padding=0;
+ MaximumDataPacketSize=(int32u)-1;
+ 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<Stream_Max; StreamKind++)
+ for (size_t Pos=0; Pos<(*Stream[StreamKind]).size(); Pos++)
+ Fill ((stream_t)StreamKind, 0, "Encryption", Encryption);
+ }
+
+ Fill("BitRate", CurrentBitRate[StreamNumber]);
+ */
+
+ std::map<int16u, stream>::iterator Temp=Stream.begin();
+ while (Temp!=Stream.end())
+ {
+ for (std::map<std::string, ZenLib::Ztring>::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; Pos<CodecInfos.size(); Pos++)
+ {
+ if (CodecInfos[Pos].Type==1 && Temp->second.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<int32u, int32u> PresentationTime_Deltas_Problem;
+ std::map<int32u, int32u> PresentationTime_Deltas_Most;
+ for (std::map<ZenLib::int32u, ZenLib::int32u>::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.size()==0
+ || (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<int32u, int32u>::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);
+ }
+ 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);
+ }
+
+ //Delay (in case of MPEG-PS)
+ if (Temp->second.StreamKind==Stream_Video)
+ {
+ if (!Retrieve(Stream_Video, Temp->second.StreamPos, Video_Delay).empty())
+ {
+ Ztring Delay=Retrieve(Stream_Video, Temp->second.StreamPos, Video_Delay);
+ Fill(Stream_Video, Temp->second.StreamPos, Video_Delay_Original, Delay);
+ }
+ if (!Retrieve(Stream_Video, Temp->second.StreamPos, Video_Delay_Settings).empty())
+ {
+ Ztring Delay_Settings=Retrieve(Stream_Video, Temp->second.StreamPos, Video_Delay_Settings);
+ Fill(Stream_Video, Temp->second.StreamPos, Video_Delay_Original_Settings, Delay_Settings);
+ }
+ }
+ if (Temp->second.TimeCode_First!=(int64u)-1)
+ Fill(Temp->second.StreamKind, Temp->second.StreamPos, "Delay", Temp->second.TimeCode_First, 10, true);
+ else
+ Fill(Temp->second.StreamKind, Temp->second.StreamPos, "Delay", "", Unlimited, true, true);
+ Fill(Temp->second.StreamKind, Temp->second.StreamPos, "Delay_Settings", "", Unlimited, true, 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
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Wm.h b/src/thirdparty/MediaInfo/Multiple/File_Wm.h
new file mode 100644
index 000000000..0aa825d76
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Wm.h
@@ -0,0 +1,188 @@
+// File_Wm - Info for Windows Media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_WmH
+#define MediaInfo_File_WmH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include <map>
+//---------------------------------------------------------------------------
+
+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<std::string, ZenLib::Ztring> Info;
+ bool IsCreated; //if Stream_Prepare() is done
+ bool SearchingPayload;
+ int32u PresentationTime_Old;
+ int32u PresentationTime_Count;
+ std::map<int32u, int32u> PresentationTime_Deltas;
+ std::vector<payload_extension_system> 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<int16u, stream> Stream;
+ int16u Stream_Number; //In header: current pos, in Data: Count of enabled parsers
+ std::vector<ZenLib::Ztring> Languages;
+ std::vector<codecinfo> 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 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
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Wm_Elements.cpp b/src/thirdparty/MediaInfo/Multiple/File_Wm_Elements.cpp
new file mode 100644
index 000000000..f9a1a6b60
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Wm_Elements.cpp
@@ -0,0 +1,1687 @@
+// File_Wm - Info for Windows Media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Elements part
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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 defined(MEDIAINFO_LATM_YES)
+ #include "MediaInfo/Audio/File_Latm.h"
+#endif
+#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(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(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");
+ 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_Info(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_Info(Wm_StreamType(StreamType)); Element_Info(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_Info("Encrypted Content");
+ Stream[Stream_Number&0x007F].Info["Encryption"]=_T("Encrypted");
+ }
+ Stream_Number&=0x007F; //Only 7bits
+ Element_Info(Stream_Number);
+ Skip_L4( "Reserved");
+ switch (StreamType.hi)
+ {
+ case Elements::Header_StreamProperties_Audio : Element_Begin(StreamTypeLength);
+ Header_StreamProperties_Audio();
+ Element_End(); break;
+ case Elements::Header_StreamProperties_Video : Element_Begin(StreamTypeLength);
+ Header_StreamProperties_Video();
+ Element_End(); break;
+ case Elements::Header_StreamProperties_JFIF : Element_Begin(StreamTypeLength);
+ Header_StreamProperties_JFIF();
+ Element_End(); break;
+ case Elements::Header_StreamProperties_DegradableJPEG : Element_Begin(StreamTypeLength);
+ Header_StreamProperties_DegradableJPEG();
+ Element_End(); break;
+ case Elements::Header_StreamProperties_FileTransfer :
+ case Elements::Header_StreamProperties_Binary : Element_Begin(StreamTypeLength);
+ Header_StreamProperties_Binary();
+ StreamKind_Last=Stream_Max; StreamPos_Last=(size_t)-1;
+ Element_End(); 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);
+}
+
+//---------------------------------------------------------------------------
+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_Resolution, 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_Begin("Codec Specific Data", Data_Size);
+ 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_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_StreamProperties_Audio_WMA ()
+{
+ Element_Info("WMA");
+
+ //Parsing
+ Skip_L4( "SamplesPerBlock");
+ Skip_L2( "EncodeOptions");
+ Skip_L4( "SuperBlockAlign");
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_StreamProperties_Audio_AMR ()
+{
+ Element_Info("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_Resolution, (Resolution%3)?Resolution:(Resolution/3)); //If not a multiple of 3, the total resolution is filled
+ if (Compression==CC4("DVR "))
+ IsDvrMs=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)
+ {
+ Element_Code=Stream_Number;
+ Demux(Buffer+(size_t)Element_Offset, (size_t)(Data_Size-40), ContentType_Header);
+
+ 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, "M-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, "M-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_Info(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; Pos<StreamNameCount; Pos++)
+ {
+ Element_Begin("Stream Name");
+ int16u StreamNameLength;
+ Skip_L2( "Language ID Index");
+ Get_L2 (StreamNameLength, "Stream Name Length");
+ Skip_UTF16L(StreamNameLength, "Stream Name");
+ Element_End();
+ }
+ for (int16u Pos=0; Pos<PayloadExtensionSystemCount; Pos++)
+ {
+ Element_Begin("Payload Extension System");
+ stream::payload_extension_system Payload_Extension_System;
+ int32u ExtensionSystemInfoLength;
+ Get_GUID(Payload_Extension_System.ID, "Extension System ID");
+ Get_L2 (Payload_Extension_System.Size, "Extension Data Size");
+ Get_L4 (ExtensionSystemInfoLength, "Extension System Info Length");
+ if (ExtensionSystemInfoLength>0)
+ Skip_XX(ExtensionSystemInfoLength, "Extension System Info");
+ Element_End();
+
+ //Filling
+ Stream[StreamNumber].Payload_Extension_Systems.push_back(Payload_Extension_System);
+ }
+
+ //Header_StreamProperties
+ if (Element_Offset<Element_Size)
+ {
+ //This could be everything, but in theory this is only Header_StreamProperties
+ int128u Name;
+ int64u Size;
+ Element_Begin("Stream Properties Object", Element_Size-Element_Offset);
+ Element_Begin("Header", 24);
+ Get_GUID(Name, "Name");
+ Get_L8 (Size, "Size");
+ Element_End();
+ if (Size>=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_End();
+ }
+
+ //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_Info(Wm_ExclusionType(ExclusionType));
+ Get_L2 (Count, "Stream Numbers Count");
+ for (int16u Pos=0; Pos<Count; Pos++)
+ {
+ Info_L2(StreamNumber, "Stream Number"); Element_Info(StreamNumber);
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_HeaderExtension_GroupMutualExclusion()
+{
+ Element_Name("Group Mutual Exclusion");
+
+ //Parsing
+ Skip_XX(Element_Size, "Unknown");
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_HeaderExtension_StreamPrioritization()
+{
+ Element_Name("Stream Prioritization");
+
+ //Parsing
+ int16u Count;
+ Get_L2 (Count, "Stream Numbers Count");
+ for (int16u Pos=0; Pos<Count; Pos++)
+ {
+ int16u Flags;
+ Element_Begin("Stream");
+ Info_L2(StreamNumber, "Stream Number"); Element_Info(StreamNumber);
+ Get_L2 (Flags, "Flags");
+ Skip_Flags(Flags, 0, "Mandatory");
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_HeaderExtension_BandwidthSharing()
+{
+ Element_Name("Bandwidth Sharing");
+
+ //Parsing
+ Skip_XX(Element_Size, "Unknown");
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_HeaderExtension_LanguageList()
+{
+ Element_Name("Language List");
+
+ //Parsing
+ Ztring LanguageID;
+ int16u Count;
+ int8u LanguageID_Length;
+ Get_L2 (Count, "Count");
+ for (int16u Pos=0; Pos<Count; Pos++)
+ {
+ Element_Begin("Language ID");
+ Get_L1 (LanguageID_Length, "Language ID Length");
+ if (LanguageID_Length>0)
+ {
+ Get_UTF16L(LanguageID_Length, LanguageID, "Language ID");
+ Element_Info(LanguageID);
+ }
+ Element_End();
+
+ //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; Pos<Count; Pos++)
+ {
+ Element_Begin("Description Record");
+ Ztring Name, Data;
+ int64u Data_Int64=0;
+ int32u Data_Length;
+ int16u StreamNumber, Name_Length, Data_Type;
+ Skip_L2( "Reserved");
+ Get_L2 (StreamNumber, "Stream Number");
+ Get_L2 (Name_Length, "Name Length");
+ Get_L2 (Data_Type, "Data Type");
+ Get_L4 (Data_Length, "Data Length");
+ Get_UTF16L(Name_Length, Name, "Name Length");
+ switch (Data_Type)
+ {
+ case 0x00 : Get_UTF16L(Data_Length, Data, "Data"); break;
+ case 0x01 : Skip_XX(Data_Length, "Data"); Data=_T("(Binary)"); break;
+ case 0x02 : {int16u Data_Int; Get_L2 (Data_Int, "Data"); Data=(Data_Int==0)?_T("No"):_T("Yes"); Data_Int64=Data_Int;} break;
+ case 0x03 : {int32u Data_Int; Get_L4 (Data_Int, "Data"); Data.From_Number(Data_Int); Data_Int64=Data_Int;} break;
+ case 0x04 : {int64u Data_Int; Get_L8 (Data_Int, "Data"); Data.From_Number(Data_Int); Data_Int64=Data_Int;} break;
+ case 0x05 : {int16u Data_Int; Get_L2 (Data_Int, "Data"); Data.From_Number(Data_Int); Data_Int64=Data_Int;} break;
+ default : Skip_XX(Data_Length, "Data"); Data=_T("(Unknown)"); break;
+ }
+ Element_Info(Name);
+ Element_Info(Data);
+ Element_End();
+
+ if (Name==_T("IsVBR"))
+ Stream[StreamNumber].Info["BitRate_Mode"]=(Data_Int64==0)?"CBR":"VBR";
+ else if (Name==_T("AspectRatioX"))
+ {
+ AspectRatioX=Data.To_float32();
+ if (AspectRatioX && AspectRatioY)
+ Stream[StreamNumber].Info["PixelAspectRatio"].From_Number(AspectRatioX/AspectRatioY, 3);
+ }
+ else if (Name==_T("AspectRatioY"))
+ {
+ AspectRatioY=Data.To_float32();
+ if (AspectRatioX && AspectRatioY)
+ Stream[StreamNumber].Info["PixelAspectRatio"].From_Number(AspectRatioX/AspectRatioY, 3);
+ }
+ else if (Name==_T("DeviceConformanceTemplate"))
+ {
+ if (Data!=_T("@") && Data.find(_T('@'))!=std::string::npos)
+ Stream[StreamNumber].Info["Format_Profile"]=Data;
+ }
+ else if (Name==_T("WM/WMADRCPeakReference")) {}
+ else if (Name==_T("WM/WMADRCAverageReference")) {}
+ else if (Name==_T("WM/WMADRCAverageTarget")) {}
+ else if (Name==_T("WM/WMADRCPeakTarget")) {}
+ else
+ Stream[StreamNumber].Info[Name.To_Local()]=Data;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_HeaderExtension_IndexParameters()
+{
+ Element_Name("Index Parameters");
+
+ //Parsing
+ int16u Count;
+ Skip_L4( "Index Entry Time Interval");
+ Get_L2 (Count, "Index Specifiers Count");
+ for (int16u Pos=0; Pos<Count; Pos++)
+ {
+ Element_Begin("Index Specifier");
+ int16u IndexType;
+ Skip_L2( "Stream Number");
+ Get_L2 (IndexType, "Index Type");
+ Element_Info(IndexType);
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_HeaderExtension_MediaIndexParameters()
+{
+ Element_Name("MediaIndex Parameters");
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_HeaderExtension_TimecodeIndexParameters()
+{
+ Element_Name("Timecode Index Parameters");
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_HeaderExtension_Compatibility()
+{
+ Element_Name("Compatibility");
+
+ //Parsing
+ Skip_L1( "Profile");
+ Skip_L1( "Mode");
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_HeaderExtension_AdvancedContentEncryption()
+{
+ Element_Name("Advanced Content Encryption");
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_HeaderExtension_IndexPlaceholder()
+{
+ Element_Name("Index Placeholder");
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_CodecList()
+{
+ Element_Name("Codec List");
+
+ //Parsing
+ Ztring CodecName, CodecDescription;
+ int32u Count32;
+ int16u Count, Type, CodecNameLength, CodecDescriptionLength, CodecInformationLength;
+ Skip_GUID( "Reserved");
+ Get_L4 (Count32, "Codec Entries Count");
+ Count=(int16u)Count32;
+ CodecInfos.resize(Count);
+ for (int16u Pos=0; Pos<Count; Pos++)
+ {
+ Element_Begin("Codec Entry");
+ Get_L2 (Type, "Type"); Param_Info(Wm_CodecList_Kind(Type));
+ Get_L2 (CodecNameLength, "Codec Name Length");
+ Get_UTF16L(CodecNameLength*2, CodecName, "Codec Name");
+ Get_L2 (CodecDescriptionLength, "Codec Description Length");
+ Get_UTF16L(CodecDescriptionLength*2, CodecDescription, "Codec Description");
+ Get_L2 (CodecInformationLength, "Codec Information Length");
+ if (Type==2 && CodecInformationLength==2) //Audio and 2CC
+ Skip_L2( "2CC"); //Not used, we have it elsewhere
+ else if (Type==1 && CodecInformationLength==4) //Video and 4CC
+ Skip_C4( "4CC"); //Not used, we have it elsewhere
+ else
+ Skip_XX(CodecInformationLength, "Codec Information");
+ Element_End();
+
+ FILLING_BEGIN();
+ CodecInfos[Pos].Type=Type;
+ CodecInfos[Pos].Info=CodecName;
+ if (!CodecDescription.empty())
+ {
+ CodecInfos[Pos].Info+=_T(" - ");
+ CodecInfos[Pos].Info+=CodecDescription;
+ }
+
+ Codec_Description_Count++;
+ FILLING_END();
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_ScriptCommand()
+{
+ Element_Name("Script Command");
+
+ //Parsing
+ Skip_GUID( "Reserved");
+ int16u Commands_Count, CommandTypes_Count;
+ Get_L2 (Commands_Count, "Commands Count");
+ Get_L2 (CommandTypes_Count, "Command Types Count");
+ for (int16u Pos=0; Pos<CommandTypes_Count; Pos++)
+ {
+ Element_Begin("Command Type");
+ int16u Length;
+ Get_L2 (Length, "Command Type Length");
+ if (Length>0)
+ Skip_UTF16L(Length*2, "Command Type");
+ Element_End();
+ }
+ for (int16u Pos=0; Pos<Commands_Count; Pos++)
+ {
+ Element_Begin("Command");
+ int16u Length;
+ Skip_L2( "Type Index");
+ Get_L2 (Length, "Command Length");
+ if (Length>0)
+ Skip_UTF16L(Length*2, "Command");
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+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; Pos<Markers_Count; Pos++)
+ {
+ Element_Begin("Marker");
+ Ztring Marker;
+ int32u Marker_Length;
+ Skip_L8( "Offset");
+ Info_L8(PresentationTime, "Presentation Time"); Param_Info_From_Milliseconds(PresentationTime/10000);
+ Skip_L2( "Entry Length");
+ Info_L4(SendTime, "Send Time"); Param_Info_From_Milliseconds(SendTime);
+ Skip_L4( "Flags");
+ Get_L4 (Marker_Length, "Marker Description Length");
+ if (Marker_Length>0)
+ Get_UTF16L(Marker_Length*2, Marker, "Marker Description");
+ Element_End();
+ }
+}
+
+//---------------------------------------------------------------------------
+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; Pos<Count; Pos++)
+ Skip_L2( "Stream Number");
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_ErrorCorrection()
+{
+ Element_Name("Error Correction");
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_ContentDescription()
+{
+ Element_Name("Content Description");
+
+ //Parsing
+ Ztring Title, Author, Copyright, Description, Rating;
+ int16u TitleLength, AuthorLength, CopyrightLength, DescriptionLength, RatingLength;
+ Get_L2 (TitleLength, "TitleLength");
+ Get_L2 (AuthorLength, "AuthorLength");
+ Get_L2 (CopyrightLength, "CopyrightLength");
+ Get_L2 (DescriptionLength, "DescriptionLength");
+ Get_L2 (RatingLength, "RatingLength");
+ if (TitleLength>0)
+ 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; Pos<Count; Pos++)
+ {
+ Element_Begin("Content Descriptor");
+ Ztring Name, Value;
+ int64u Value_Int64=0;
+ int16u Name_Length, Value_Type, Value_Length;
+ Get_L2 (Name_Length, "Name Length");
+ Get_UTF16L(Name_Length, Name, "Name");
+ Get_L2 (Value_Type, "Value Data Type");
+ Get_L2 (Value_Length, "Value Length");
+ switch (Value_Type)
+ {
+ case 0x00 : Get_UTF16L(Value_Length, Value, "Value"); break;
+ case 0x01 :
+ if (Name==_T("ASFLeakyBucketPairs")) Header_ExtendedContentDescription_ASFLeakyBucketPairs(Value_Length);
+ else {Skip_XX(Value_Length, "Value"); Value=_T("(Binary)");} break;
+ case 0x02 : {int32u Value_Int; Get_L4 (Value_Int, "Value"); Value=(Value_Int==0)?_T("No"):_T("Yes"); Value_Int64=Value_Int;} break;
+ case 0x03 : {int32u Value_Int; Get_L4 (Value_Int, "Value"); Value.From_Number(Value_Int); Value_Int64=Value_Int;} break;
+ case 0x04 : {int64u Value_Int; Get_L8 (Value_Int, "Value"); Value.From_Number(Value_Int); Value_Int64=Value_Int;} break;
+ case 0x05 : {int16u Value_Int; Get_L2 (Value_Int, "Value"); Value.From_Number(Value_Int); Value_Int64=Value_Int;} break;
+ default : Skip_XX(Value_Length, "Value"); Value=_T("(Unknown)"); break;
+ }
+ Element_Info(Name);
+ Element_Info(Value);
+ Element_End();
+
+ //Filling
+ if (!Value.empty())
+ {
+ if (Name==_T("Agility FPS")) {}
+ else if (Name==_T("ASFLeakyBucketPairs")) {} //Already done elsewhere
+ else if (Name==_T("Buffer Average")) {}
+ else if (Name==_T("DVR Index Granularity")) {}
+ else if (Name==_T("DVR File Version")) {}
+ else if (Name==_T("IsVBR"))
+ Fill(Stream_General, 0, General_OverallBitRate_Mode, Value_Int64==0?"CBR":"VBR");
+ else if (Name==_T("VBR Peak")) {} //Already in "Stream Bitrate" chunk
+ else if (Name==_T("WMFSDKVersion")) {}
+ else if (Name==_T("WMFSDKNeeded")) {}
+ else if (Name==_T("WM/AlbumTitle"))
+ Fill(Stream_General, 0, General_Album, Value);
+ else if (Name==_T("WM/AlbumArtist"))
+ {
+ Fill(Stream_General, 0, General_Performer, "");
+ Fill(Stream_General, 0, General_Performer, Value, true); //Clear last value, like Author (Content Description)
+ }
+ else if (Name==_T("WM/ArtistSortOrder"))
+ Fill(Stream_General, 0, General_Performer_Sort, Value);
+ else if (Name==_T("WM/AuthorURL"))
+ Fill(Stream_General, 0, "Author/Url", Value);
+ else if (Name==_T("WM/BeatsPerMinute"))
+ Fill(Stream_General, 0, General_BPM, Value);
+ else if (Name==_T("WM/Binary"))
+ Fill(Stream_General, 0, General_Cover, "Y");
+ else if (Name==_T("WM/Comments"))
+ Fill(Stream_General, 0, General_Comment, Value, true); //Clear last value
+ else if (Name==_T("WM/Composer"))
+ Fill(Stream_General, 0, General_Composer, Value);
+ else if (Name==_T("WM/Conductor"))
+ Fill(Stream_General, 0, General_Conductor, Value);
+ else if (Name==_T("WM/EncodedBy"))
+ Fill(Stream_General, 0, General_EncodedBy, Value);
+ else if (Name==_T("WM/EncoderSettings"))
+ Fill(Stream_General, 0, General_Encoded_Library_Settings, Value);
+ else if (Name==_T("WM/EncodingTime"))
+ Fill(Stream_General, 0, General_Encoded_Date, Ztring().Date_From_Seconds_1601(Value_Int64));
+ else if (Name==_T("WM/Genre"))
+ Fill(Stream_General, 0, General_Genre, Value, true); //Clear last value
+ else if (Name==_T("WM/GenreID"))
+ {
+ if (Retrieve(Stream_General, 0, General_Genre).empty())
+ Fill(Stream_General, 0, General_Genre, Value);
+ }
+ else if (Name==_T("WM/Language"))
+ Language_ForAll=Value;
+ else if (Name==_T("WM/MediaCredits"))
+ Fill(Stream_General, 0, General_ThanksTo, Value);
+ else if (Name==_T("WM/MediaPrimaryClassID")) {}
+ else if (Name==_T("WM/MCDI")) {}
+ else if (Name==_T("WM/ModifiedBy"))
+ Fill(Stream_General, 0, General_RemixedBy, Value);
+ else if (Name==_T("WM/OriginalAlbumTitle"))
+ Fill(Stream_General, 0, "Original/Album", Value);
+ else if (Name==_T("WM/OriginalReleaseTime"))
+ Fill(Stream_General, 0, "Original/Released_Date", Value);
+ else if (Name==_T("WM/ParentalRating"))
+ Fill(Stream_General, 0, General_LawRating, Value);
+ else if (Name==_T("WM/ParentalRatingReason"))
+ Fill(Stream_General, 0, General_LawRating_Reason, Value);
+ else if (Name==_T("WM/Picture"))
+ Fill(Stream_General, 0, General_Cover, "Y");
+ else if (Name==_T("WM/Provider"))
+ Fill(Stream_General, 0, "Provider", Value);
+ else if (Name==_T("WM/Publisher"))
+ Fill(Stream_General, 0, General_Publisher, Value);
+ else if (Name==_T("WM/RadioStationName"))
+ Fill(Stream_General, 0, General_ServiceName, Value);
+ else if (Name==_T("WM/RadioStationOwner"))
+ Fill(Stream_General, 0, General_ServiceProvider, Value);
+ else if (Name==_T("WM/SubTitle"))
+ Fill(Stream_General, 0, General_Title_More, Value);
+ else if (Name==_T("WM/SubTitleDescription"))
+ Fill(Stream_General, 0, General_Title_More, Value);
+ else if (Name==_T("WM/ToolName"))
+ Fill(Stream_General, 0, General_Encoded_Application, Value);
+ else if (Name==_T("WM/ToolVersion"))
+ Fill(Stream_General, 0, General_Encoded_Application, Retrieve(Stream_General, 0, General_Encoded_Application)+_T(" ")+Value, true);
+ else if (Name==_T("WM/TrackNumber"))
+ Fill(Stream_General, 0, General_Track_Position, Value, true); //Clear last value, like WM/Track
+ else if (Name==_T("WM/Track"))
+ {
+ if (Retrieve(Stream_General, 0, General_Track_Position).empty())
+ Fill(Stream_General, 0, General_Track_Position, Value.To_int32u()+1);
+ }
+ else if (Name==_T("WM/UniqueFileIdentifier"))
+ {
+ if (Value.empty() || Value[0]!=_T(';')) //Test if there is only the separator
+ {
+ Value.FindAndReplace(_T(";"), MediaInfoLib::Config.TagSeparator_Get());
+ Fill(Stream_General, 0, General_UniqueID, Value);
+ }
+ }
+ else if (Name==_T("WM/Writer"))
+ Fill(Stream_General, 0, General_WrittenBy, Value);
+ else if (Name==_T("WM/Year"))
+ Fill(Stream_General, 0, General_Recorded_Date, Value);
+ else
+ Fill(Stream_General, 0, Name.To_Local().c_str(), Value);
+ }
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_ExtendedContentDescription_ASFLeakyBucketPairs(int16u Value_Length)
+{
+ Element_Begin("ASFLeakyBucketPairs", Value_Length);
+ Skip_L2( "Reserved");
+ for (int16u Pos=2; Pos<Value_Length; Pos+=8)
+ {
+ Element_Begin("Bucket", 8);
+ Skip_L4( "BitRate");
+ Skip_L4( "msBufferWindow");
+ Element_End();
+ }
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_StreamBitRate()
+{
+ Element_Name("Stream Bitrate");
+
+ //Parsing
+ int16u Count;
+ Get_L2 (Count, "Count");
+ for (int16u Pos=0; Pos<Count; Pos++)
+ {
+ Element_Begin("Stream", 6);
+ int32u AverageBitRate;
+ int16u StreamNumber;
+ Get_L2 (StreamNumber, "Stream Number"); Element_Info(StreamNumber);
+ Get_L4 (AverageBitRate, "Average Bitrate"); Element_Info(AverageBitRate);
+ Element_End();
+
+ //Filling
+ if (Stream[StreamNumber].AverageBitRate==0) //Prefere Average bitrate of Extended Stream Properties if present
+ Stream[StreamNumber].AverageBitRate=AverageBitRate;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Header_ContentBranding()
+{
+ Element_Name("Content Branding");
+
+ //Parsing
+ Ztring CopyrightURL, BannerImageURL;
+ int32u BannerImageData_Type, BannerImageData_Length, BannerImageURL_Length, CopyrightURL_Length;
+ Get_L4 (BannerImageData_Type, "Banner Image Data Type"); Param_Info(Wm_BannerImageData_Type(BannerImageData_Type));
+ Get_L4 (BannerImageData_Length, "Banner Image Data Length");
+ if (BannerImageData_Length>0)
+ 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<int16u, stream>::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_Info(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_Begin("Error Correction");
+ Get_L1 (Flags, "Flags");
+ Get_Flags (Flags&0x0F, ErrorCorrectionData_Length, "Error Correction Data Length"); //4 lowest bits
+ Skip_Flags(Flags, 4, "Opaque Data Present");
+ Get_Flags ((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_Flags((TypeNumber>>4)&0x0F, "Type");
+ Skip_Flags( TypeNumber &0x0F, "Number");
+ Skip_L1( "Cycle");
+ }
+ Element_End();
+
+ Element_Begin("Payload Parsing Information");
+ Get_L1 (Flags, "Length Type Flags");
+ Get_Flags (Flags, 0, MultiplePayloadsPresent, "Multiple Payloads Present");
+ Get_Flags ((Flags>>1)&0x3, SequenceType, "Sequence Type");
+ Get_Flags ((Flags>>3)&0x3, PaddingLengthType, "Padding Length Type");
+ Get_Flags ((Flags>>5)&0x3, PacketLengthType, "Packet Length Type");
+ Skip_Flags(Flags, 7, "Error Correction Present");
+ Get_L1 (Flags, "Property Flags");
+ Get_Flags ( Flags &0x3, ReplicatedDataLengthType, "Replicated Data Length Type");
+ Get_Flags ((Flags>>2)&0x3, OffsetIntoMediaObjectLengthType, "Offset Into Media Object Length Type");
+ Get_Flags ((Flags>>4)&0x3, MediaObjectNumberLengthType, "Media Object Number Length Type");
+ Get_Flags ((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_End();
+
+ if (MultiplePayloadsPresent)
+ {
+ //Parsing
+ Element_Begin("Multiple Payloads additional flags");
+ int8u AdditionalFlags;
+ Get_L1 (AdditionalFlags, "Flags");
+ Get_Flags ( AdditionalFlags &0x3F, NumberPayloads, "Number of Payloads"); //6 bits
+ Get_Flags ((AdditionalFlags>>6)&0x03, PayloadLengthType, "Payload Length Type"); //bits 6 and 7
+ Element_End();
+ }
+ else
+ {
+ SizeOfMediaObject=(int32u)(Element_Size-Element_Offset-Data_Parse_Padding);
+ NumberPayloads=1;
+ }
+
+ for (NumberPayloads_Pos=0; NumberPayloads_Pos<NumberPayloads; NumberPayloads_Pos++)
+ {
+ Element_Begin("Payload");
+ int32u ReplicatedDataLength=0, PayloadLength=0;
+ int8u StreamNumber;
+ Get_L1 (StreamNumber, "Stream Number");
+ Stream_Number=StreamNumber&0x7F; //For KeyFrame
+ Element_Info(Stream_Number);
+ switch (MediaObjectNumberLengthType)
+ {
+ case 1 : Skip_L1( "Media Object Number"); break;
+ case 2 : Skip_L2( "Media Object Number"); break;
+ case 3 : Skip_L4( "Media Object Number"); break;
+ default: Trusted_IsNot("Media Object Number"); return; //Problem
+ }
+ switch (OffsetIntoMediaObjectLengthType)
+ {
+ case 1 : Skip_L1( "Offset Into Media Object"); break;
+ case 2 : Skip_L2( "Offset Into Media Object"); break;
+ case 3 : Skip_L4( "Offset Into Media Object"); break;
+ default: Trusted_IsNot("Offset Into Media Object"); return; //Problem
+ }
+ switch (ReplicatedDataLengthType)
+ {
+ case 1 : {int8u Data; Get_L1(Data, "Replicated Data Length"); ReplicatedDataLength=Data;} break;
+ case 2 : {int16u Data; Get_L2(Data, "Replicated Data Length"); ReplicatedDataLength=Data;} break;
+ case 3 : Get_L4(ReplicatedDataLength, "Replicated Data Length"); break;
+ default: Trusted_IsNot("Replicated Data Length"); return; //Problem
+ }
+ if (ReplicatedDataLengthType!=0 && ReplicatedDataLength>0)
+ {
+ 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<int16u, stream>::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
+ }
+
+ //Analyzing
+ if (Stream[Stream_Number].Parser && Stream[Stream_Number].SearchingPayload)
+ {
+ //Handling of spanned on multiple chunks
+ bool FrameIsAlwaysComplete=true;
+ if (PayloadLength!=SizeOfMediaObject)
+ {
+ if (SizeOfMediaObject_BytesAlreadyParsed==0)
+ SizeOfMediaObject_BytesAlreadyParsed=SizeOfMediaObject-PayloadLength;
+ else
+ SizeOfMediaObject_BytesAlreadyParsed-=PayloadLength;
+ if (SizeOfMediaObject_BytesAlreadyParsed!=0)
+ FrameIsAlwaysComplete=false;
+ else
+ Element_Show_Count++;
+ }
+ 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
+
+ Element_Code=Stream_Number;
+ Demux(Buffer+(size_t)Element_Offset, (size_t)PayloadLength, ContentType_MainStream);
+
+ 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_End();
+ }
+
+ 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_Begin("Replicated Data", Size);
+ int64u Element_Offset_Final=Element_Offset+Size;
+ for (size_t Pos=0; Pos<Stream[Stream_Number].Payload_Extension_Systems.size(); Pos++)
+ {
+ Element_Begin();
+ switch (Stream[Stream_Number].Payload_Extension_Systems[Pos].ID.hi)
+ {
+ case Elements::Payload_Extension_System_TimeStamp : Data_Packet_ReplicatedData_TimeStamp(); break;
+ default : //Not enough info to validate this algorithm
+ //if (Stream[Stream_Number].Payload_Extension_Systems[Pos].Size!=(int16u)-1)
+ //{
+ // Element_Name("Unknown");
+ // Skip_XX(Stream[Stream_Number].Payload_Extension_Systems[Pos].Size, "Unknown");
+ //}
+ //else
+ Pos=Stream[Stream_Number].Payload_Extension_Systems.size(); //Disabling the rest, all is unknown
+ }
+ Element_End();
+ }
+
+ if (Element_Offset<Element_Offset_Final)
+ {
+ Element_Begin("Other chunks");
+ Skip_XX(Element_Offset_Final-Element_Offset, "Unknown");
+ Element_End();
+ }
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Data_Packet_ReplicatedData_TimeStamp()
+{
+ Element_Name("TimeStamp");
+
+ //Parsing
+ Skip_L2( "Unknown");
+ Skip_L4( "Unknown");
+ Skip_L4( "Unknown");
+ Info_L8(TS0, "TS0"); if (TS0!=(int64u)-1) Param_Info(TS0/10000);
+ Info_L8(TS1, "TS1"); if (TS1!=(int64u)-1) Param_Info(TS1/10000);
+ Skip_L4( "Unknown");
+ Skip_L4( "Unknown");
+ Skip_L4( "Unknown");
+ Skip_L4( "Unknown");
+
+ if (Stream[Stream_Number].TimeCode_First==(int64u)-1 && TS0!=(int64u)-1)
+ Stream[Stream_Number].TimeCode_First=TS0/10000;
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::SimpleIndex()
+{
+ Element_Name("Simple Index");
+
+ //Parsing
+ /*
+ int32u Count;
+ Skip_GUID( "File ID");
+ Skip_L8( "Index Entry Time Interval");
+ Skip_L4( "Maximum Packet Count");
+ Get_L4 (Count, "Index Entries Count");
+ for (int32u Pos=0; Pos<Count; Pos++)
+ {
+ Element_Begin("Index Entry", 6);
+ int32u PacketNumber;
+ int16u PacketCount;
+ Get_L4 (PacketNumber, "Packet Number");
+ Get_L2 (PacketCount, "Packet Count");
+ Element_End();
+ }
+ */
+ Skip_XX(Element_TotalSize_Get()-Element_Offset, "Indexes");
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::Index()
+{
+ Element_Name("Index");
+
+ //Parsing
+ /*
+ int32u Blocks_Count;
+ int16u Specifiers_Count;
+ Skip_L4( "Index Entry Time Interval");
+ Get_L2 (Specifiers_Count, "Index Specifiers Count");
+ Get_L4 (Blocks_Count, "Index Blocks Count");
+ for (int16u Pos=0; Pos<Specifiers_Count; Pos++)
+ {
+ Element_Begin("Specifier");
+ Skip_L2( "Stream Number");
+ Skip_L2( "Index Type");
+ Element_End();
+ }
+ for (int32u Pos=0; Pos<Blocks_Count; Pos++)
+ {
+ Element_Begin("Block");
+ int32u Entry_Count;
+ Get_L4 (Entry_Count, "Index Entry Count");
+ Element_Begin("Block Positions");
+ for (int16u Pos=0; Pos<Specifiers_Count; Pos++)
+ Skip_L4( "Position");
+ Element_End();
+ for (int32u Pos=0; Pos<Entry_Count; Pos++)
+ {
+ Element_Begin("Entry");
+ for (int16u Pos=0; Pos<Specifiers_Count; Pos++)
+ Skip_L4( "Offset");
+ Element_End();
+ }
+ Element_End();
+ }
+ */
+ Skip_XX(Element_TotalSize_Get()-Element_Offset, "Indexes");
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::MediaIndex()
+{
+ Element_Name("MediaIndex");
+}
+
+//---------------------------------------------------------------------------
+void File_Wm::TimecodeIndex()
+{
+ Element_Name("TimecodeIndex");
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_WM_YES
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Xdcam_Clip.cpp b/src/thirdparty/MediaInfo/Multiple/File_Xdcam_Clip.cpp
new file mode 100644
index 000000000..191d67572
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Xdcam_Clip.cpp
@@ -0,0 +1,180 @@
+// File_Xdcam_Clip - Info for XDCAM XML files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_XDCAM_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Multiple/File_Xdcam_Clip.h"
+#include "MediaInfo/MediaInfo.h"
+#include "MediaInfo/MediaInfo_Internal.h"
+#include "ZenLib/Dir.h"
+#include "ZenLib/File.h"
+#include "ZenLib/FileName.h"
+#include "ZenLib/TinyXml/tinyxml.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Buffer - File header
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Xdcam_Clip::FileHeader_Begin()
+{
+ //Element_Size
+ if (File_Size>64*1024)
+ {
+ Reject("Xdcam_Clip");
+ return false; //Xdcam_Clip XML files are not big
+ }
+
+ //Element_Size
+ if (Buffer_Size<5)
+ return false; //Must wait for more data
+
+ //XML header
+ if (Buffer[0]!='<'
+ || Buffer[1]!='?'
+ || Buffer[2]!='x'
+ || Buffer[3]!='m'
+ || Buffer[4]!='l')
+ {
+ Reject("Xdcam_Clip");
+ return false;
+ }
+
+ TiXmlDocument document(File_Name.To_Local());
+ if (document.LoadFile())
+ {
+ TiXmlElement* Root=document.FirstChildElement("NonRealTimeMeta");
+ if (Root)
+ {
+ Accept("Xdcam_Clip");
+ Fill(Stream_General, 0, General_Format, "XDCAM Clip");
+
+ TiXmlElement* Element;
+
+ //CreationDate
+ Element=Root->FirstChildElement("CreationDate");
+ string A=Element->Attribute("value");
+ if (Element)
+ Fill(Stream_General, 0, General_Recorded_Date, Element->Attribute("value"));
+
+ //CreationDate
+ 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;
+ }
+ }
+ else
+ {
+ Reject("Xdcam_Clip");
+ return false;
+ }
+
+ //All should be OK...
+ return true;
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_XDCAM_YES
diff --git a/src/thirdparty/MediaInfo/Multiple/File_Xdcam_Clip.h b/src/thirdparty/MediaInfo/Multiple/File_Xdcam_Clip.h
new file mode 100644
index 000000000..229c90b17
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Multiple/File_Xdcam_Clip.h
@@ -0,0 +1,50 @@
+// File_Xdcam_Clip - Info for XDCAM Clip files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
+
diff --git a/src/thirdparty/MediaInfo/PreComp.h b/src/thirdparty/MediaInfo/PreComp.h
new file mode 100644
index 000000000..46d135662
--- /dev/null
+++ b/src/thirdparty/MediaInfo/PreComp.h
@@ -0,0 +1,40 @@
+// PreComp - PreComp file for MediaInfo
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Helpers for compilers (precompilation)
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifdef ZENLIB_USEWX
+ #include <wx/wxprec.h>
+ #ifdef WX_PRECOMP
+ #include <string>
+ #include <sstream>
+ #include <vector>
+ #endif
+#else //ZENLIB_USEWX
+ #if defined(__BORLANDC__) ||defined(__VISUALC__)
+ #include <string>
+ #include <sstream>
+ #include <vector>
+ #endif
+#endif //ZENLIB_USEWX
+//---------------------------------------------------------------------------
+
diff --git a/src/thirdparty/MediaInfo/Reader/Reader_Directory.cpp b/src/thirdparty/MediaInfo/Reader/Reader_Directory.cpp
new file mode 100644
index 000000000..c7faf37e2
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Reader/Reader_Directory.cpp
@@ -0,0 +1,240 @@
+// Reader_Directory - All info about media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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, const 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_Pos<List.size(); File_Pos++)
+ {
+ size_t BDMV_Pos=List[File_Pos].find(ToSearch);
+ if (BDMV_Pos!=string::npos && BDMV_Pos!=0 && BDMV_Pos+16==List[File_Pos].size())
+ {
+ //This is a BDMV index, parsing the directory only if index and movie objects are BOTH present
+ ToSearch=List[File_Pos];
+ ToSearch.resize(ToSearch.size()-10);
+ ToSearch+=_T("MovieObject.bdmv"); //"%CompletePath%\BDMV\MovieObject.bdmv"
+ if (List.Find(ToSearch)!=string::npos)
+ {
+ //We want the folder instead of the files
+ List[File_Pos].resize(List[File_Pos].size()-11); //only %CompletePath%\BDMV
+ ToSearch=List[File_Pos];
+
+ for (size_t Pos=0; Pos<List.size(); Pos++)
+ {
+ if (List[Pos].find(ToSearch)==0 && List[Pos]!=ToSearch) //Remove all subdirs of ToSearch but not ToSearch
+ {
+ //Removing the file in the blu-ray directory
+ List.erase(List.begin()+Pos);
+ Pos--;
+ }
+ }
+ }
+ }
+ }
+}
+#endif //MEDIAINFO_BDMV_YES
+
+//***************************************************************************
+// P2 stuff
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+#ifdef MEDIAINFO_P2_YES
+int Reader_Directory::P2_Format_Test(MediaInfo_Internal* MI, const String &File_Name)
+{
+ if (!MI->SelectFromExtension(_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_Pos<List.size(); File_Pos++)
+ {
+ size_t P2_Pos=List[File_Pos].find(ToSearch);
+ if (P2_Pos!=string::npos && P2_Pos!=0 && P2_Pos+1+8+1+4+1+10==List[File_Pos].size())
+ {
+ //This is a P2 CLIP
+ Ztring Path_Begin=List[File_Pos];
+ Path_Begin.resize(Path_Begin.size()-(1+8+1+4+1+10));
+ Path_Begin+=Ztring(1, PathSeparator);
+ bool HasChanged=false;
+ for (size_t Pos=0; Pos<List.size(); Pos++)
+ {
+ if (List[Pos].find(Path_Begin)==0 && List[Pos].find(Path_Begin+_T("CONTENTS")+PathSeparator+_T("CLIP")+PathSeparator)==string::npos) //Remove all subdirs of Path_Begin but not with CLIP
+ {
+ //Removing the file in the P2 directory
+ List.erase(List.begin()+Pos);
+ Pos--;
+ HasChanged=true;
+ }
+ }
+ if (HasChanged)
+ File_Pos=0;
+ }
+ }
+}
+#endif //MEDIAINFO_P2_YES
+
+//***************************************************************************
+// P2 stuff
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+#ifdef MEDIAINFO_XDCAM_YES
+int Reader_Directory::Xdcam_Format_Test(MediaInfo_Internal* MI, const String &File_Name)
+{
+ if (!MI->SelectFromExtension(_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<List.size(); File_Pos++)
+ {
+ size_t Xdcam_Pos=List[File_Pos].find(ToSearch);
+ if (Xdcam_Pos!=string::npos && Xdcam_Pos!=0 && Xdcam_Pos+1+4+1+12==List[File_Pos].size())
+ {
+ //This is a XDCAM CLIP
+ Ztring Path_Begin=List[File_Pos];
+ Path_Begin.resize(Path_Begin.size()-(1+4+1+12));
+ Path_Begin+=Ztring(1, PathSeparator);
+ if (Dir::Exists(Path_Begin+_T("Edit")) && Dir::Exists(Path_Begin+_T("General")) && Dir::Exists(Path_Begin+_T("Sub")))
+ {
+ bool HasChanged=false;
+ for (size_t Pos=0; Pos<List.size(); Pos++)
+ {
+ if (List[Pos].find(Path_Begin)==0 && (List[Pos].find(Path_Begin+_T("Clip")+PathSeparator)==string::npos || (List[Pos].find(_T(".XML"))!=List[Pos].size()-4))) //Remove all subdirs of Path_Begin but not with the right XML
+ {
+ //Removing the file in the XDCAM directory
+ List.erase(List.begin()+Pos);
+ Pos--;
+ HasChanged=true;
+ }
+ }
+ if (HasChanged)
+ File_Pos=0;
+ }
+ }
+ }
+}
+#endif //MEDIAINFO_XDCAM_YES
+
+} //NameSpace
+
+#endif //MEDIAINFO_DIRECTORY_YES
+
diff --git a/src/thirdparty/MediaInfo/Reader/Reader_Directory.h b/src/thirdparty/MediaInfo/Reader/Reader_Directory.h
new file mode 100644
index 000000000..2d092221e
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Reader/Reader_Directory.h
@@ -0,0 +1,65 @@
+// Reader_Directory - All information about media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Give information about a lot of media files
+// Dispatch the file to be tested by all containers
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef Reader_DirectoryH
+#define Reader_DirectoryH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/MediaInfo_Internal.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+/// @brief Reader_Directory
+//***************************************************************************
+
+class Reader_Directory
+{
+public :
+ //Format testing
+ static size_t Format_Test(MediaInfo_Internal* MI, const String &File_Name);
+
+ //For the list
+ static void Directory_Cleanup(ZtringList &List);
+
+private :
+ //Bdmv
+ static int Bdmv_Format_Test(MediaInfo_Internal* MI, const String &File_Name);
+ static void Bdmv_Directory_Cleanup(ZtringList &List);
+
+ //P2
+ static int P2_Format_Test(MediaInfo_Internal* MI, const String &File_Name);
+ static void P2_Directory_Cleanup(ZtringList &List);
+
+ //XDCAM
+ static int Xdcam_Format_Test(MediaInfo_Internal* MI, const String &File_Name);
+ static void Xdcam_Directory_Cleanup(ZtringList &List);
+};
+
+} //NameSpace
+#endif
diff --git a/src/thirdparty/MediaInfo/Reader/Reader_File.cpp b/src/thirdparty/MediaInfo/Reader/Reader_File.cpp
new file mode 100644
index 000000000..888ec8722
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Reader/Reader_File.cpp
@@ -0,0 +1,196 @@
+// MediaInfo_Internal - All info about media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// For user: you can disable or enable it
+//#define MEDIAINFO_DEBUG
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Reader/Reader_File.h"
+#include "MediaInfo/File__Analyze.h"
+#include "ZenLib/FileName.h"
+#include "ZenLib/File.h"
+using namespace ZenLib;
+using namespace std;
+//---------------------------------------------------------------------------
+// Debug stuff
+#ifdef MEDIAINFO_DEBUG
+ int64u Reader_File_Offset=0;
+ int64u Reader_File_BytesRead_Total=0;
+ int64u Reader_File_BytesRead=0;
+ int64u Reader_File_Count=1;
+ #include <iostream>
+#endif // MEDIAINFO_DEBUG
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+const size_t Buffer_NormalSize=/*188*7;//*/64*1024;
+const size_t Buffer_NoJump=128*1024;
+
+//---------------------------------------------------------------------------
+size_t Reader_File::Format_Test(MediaInfo_Internal* MI, const String &File_Name)
+{
+ #if MEDIAINFO_EVENTS
+ {
+ struct MediaInfo_Event_General_Start_0 Event;
+ Event.EventCode=MediaInfo_EventCode_Create(MediaInfo_Parser_None, MediaInfo_Event_General_Start, 0);
+ Event.Stream_Size=File::Size_Get(File_Name);
+ MI->Config.Event_Send((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.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
+ File F;
+ F.Open(File_Name);
+ if (!F.Opened_Get())
+ return 0;
+
+ //Buffer
+ size_t Buffer_Size_Max=Buffer_NormalSize;
+ int8u* Buffer=new int8u[Buffer_Size_Max];
+
+ //Parser
+ MI->Open_Buffer_Init(F.Size_Get(), File_Name);
+
+ //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)
+ {
+ #ifdef MEDIAINFO_DEBUG
+ std::cout<<std::hex<<Reader_File_Offset<<" - "<<Reader_File_Offset+Reader_File_BytesRead<<" : "<<std::dec<<Reader_File_BytesRead<<" bytes"<<std::endl;
+ Reader_File_Offset=MI->Open_Buffer_Continue_GoTo_Get();
+ Reader_File_BytesRead=0;
+ Reader_File_Count++;
+ #endif //MEDIAINFO_DEBUG
+
+ if (MI->Open_Buffer_Continue_GoTo_Get()>=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 (!(MI->Open_Buffer_Continue_GoTo_Get()>F.Position_Get() && MI->Open_Buffer_Continue_GoTo_Get()<F.Position_Get()+Buffer_NoJump)) //No smal jumps
+ {
+ if (!F.GoTo(MI->Open_Buffer_Continue_GoTo_Get()))
+ break; //File is not seekable
+
+ MI->Open_Buffer_Init((int64u)-1, F.Position_Get());
+ }
+ }
+
+ //Buffering
+ size_t Buffer_Size=F.Read(Buffer, Buffer_Size_Max);
+ if (Buffer_Size==0)
+ break; //Problem while reading
+
+ #ifdef MEDIAINFO_DEBUG
+ Reader_File_BytesRead_Total+=Buffer_Size;
+ Reader_File_BytesRead+=Buffer_Size;
+ #endif //MEDIAINFO_DEBUG
+
+ //Parser
+ Status=MI->Open_Buffer_Continue(Buffer, Buffer_Size);
+
+ //Threading
+ if (MI->IsTerminating())
+ break; //Termination is requested
+ }
+ while (!(Status[File__Analyze::IsFinished] || (StopAfterFilled && Status[File__Analyze::IsFilled])));
+ if (F.Size_Get()==0) //If Size==0, Status is never updated
+ Status=MI->Open_Buffer_Continue(NULL, 0);
+
+ #ifdef MEDIAINFO_DEBUG
+ std::cout<<std::hex<<Reader_File_Offset<<" - "<<Reader_File_Offset+Reader_File_BytesRead<<" : "<<std::dec<<Reader_File_BytesRead<<" bytes"<<std::endl;
+ std::cout<<"Total: "<<std::dec<<Reader_File_BytesRead_Total<<" bytes in "<<Reader_File_Count<<" blocks"<<std::endl;
+ #endif //MEDIAINFO_DEBUG
+
+ //File
+ F.Close();
+
+ //Buffer
+ delete[] Buffer; //Buffer=NULL;
+
+ //Is this file detected?
+ if (!Status[File__Analyze::IsAccepted])
+ return 0;
+
+ MI->Open_Buffer_Finalize();
+ return 1;
+}
+
+} //NameSpace
+
+
diff --git a/src/thirdparty/MediaInfo/Reader/Reader_File.h b/src/thirdparty/MediaInfo/Reader/Reader_File.h
new file mode 100644
index 000000000..1c897aa73
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Reader/Reader_File.h
@@ -0,0 +1,50 @@
+// Reader_File - All information about media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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/MediaInfo_Internal.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+/// @brief Reader_File
+//***************************************************************************
+
+class Reader_File
+{
+public :
+ //Format testing
+ static size_t Format_Test(MediaInfo_Internal* MI, const String &File_Name);
+ static size_t Format_Test_PerParser(MediaInfo_Internal* MI, const String &File_Name);
+};
+
+} //NameSpace
+#endif
diff --git a/src/thirdparty/MediaInfo/Reader/Reader__Base.h b/src/thirdparty/MediaInfo/Reader/Reader__Base.h
new file mode 100644
index 000000000..45de80d54
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Reader/Reader__Base.h
@@ -0,0 +1,52 @@
+// Reader_File - All information about media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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, const String &File_Name)=0;
+};
+
+} //NameSpace
+#endif
diff --git a/src/thirdparty/MediaInfo/Reader/Reader_libcurl.cpp b/src/thirdparty/MediaInfo/Reader/Reader_libcurl.cpp
new file mode 100644
index 000000000..a42be52ef
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Reader/Reader_libcurl.cpp
@@ -0,0 +1,202 @@
+// Reader_libcurl - All info about media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// For user: you can disable or enable it
+//#define MEDIAINFO_DEBUG
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_LIBCURL_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Reader/Reader_libcurl.h"
+#include "MediaInfo/File__Analyze.h"
+#if defined LIBCURL_DLL_RUNTIME
+#elif defined LIBCURL_DLL_STATIC
+#else
+ #undef __TEXT
+ #include "curl/curl.h"
+#endif
+using namespace ZenLib;
+using namespace std;
+#ifdef MEDIAINFO_DEBUG
+ #include <iostream>
+#endif // MEDIAINFO_DEBUG
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// libcurl stuff
+//***************************************************************************
+
+struct curl_data
+{
+ MediaInfo_Internal* MI;
+ CURL* Curl;
+ String File_Name;
+ int64u File_Offset;
+ int64u File_Size;
+ int64u File_GoTo;
+ bool Init_AlreadyDone;
+ #ifdef MEDIAINFO_DEBUG
+ int64u Debug_BytesRead_Total;
+ int64u Debug_BytesRead;
+ int64u Debug_Count;
+ #endif // MEDIAINFO_DEBUG
+
+ curl_data()
+ {
+ MI=NULL;
+ Curl=NULL;
+ File_Offset=0;
+ File_Size=(int64u)-1;
+ File_GoTo=(int64u)-1;
+ Init_AlreadyDone=false;
+ #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
+ ((curl_data*)data)->Debug_BytesRead_Total+=size*nmemb;
+ ((curl_data*)data)->Debug_BytesRead+=size*nmemb;
+ #endif //MEDIAINFO_DEBUG
+
+ //Init
+ if (!((curl_data*)data)->Init_AlreadyDone)
+ {
+ double File_SizeD;
+ CURLcode Result=curl_easy_getinfo(((curl_data*)data)->Curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &File_SizeD);
+ if (Result==CURLE_OK && File_SizeD!=-1)
+ ((curl_data*)data)->MI->Open_Buffer_Init((int64u)File_SizeD, ((curl_data*)data)->File_Name);
+ else
+ ((curl_data*)data)->MI->Open_Buffer_Init((int64u)-1, ((curl_data*)data)->File_Name);
+ ((curl_data*)data)->Init_AlreadyDone=true;
+ }
+
+ //Continue
+ std::bitset<32> Result=((curl_data*)data)->MI->Open_Buffer_Continue((int8u*)ptr, size*nmemb);
+ ((curl_data*)data)->File_Offset+=size*nmemb;
+
+ if (Result[File__Analyze::IsFinished])
+ {
+ ((curl_data*)data)->MI->Open_Buffer_Finalize();
+ return 0;
+ }
+
+ //GoTo
+ if (((curl_data*)data)->MI->Open_Buffer_Continue_GoTo_Get()!=(int64u)-1)
+ {
+ if (!(((curl_data*)data)->MI->Open_Buffer_Continue_GoTo_Get()>=((curl_data*)data)->File_Offset && ((curl_data*)data)->MI->Open_Buffer_Continue_GoTo_Get()<=((curl_data*)data)->File_Offset+100000))
+ {
+ ((curl_data*)data)->File_GoTo=((curl_data*)data)->MI->Open_Buffer_Continue_GoTo_Get();
+ return 0;
+ }
+ }
+
+ //Continue parsing
+ return size*nmemb;
+}
+
+//---------------------------------------------------------------------------
+size_t Reader_libcurl::Format_Test(MediaInfo_Internal* MI, const String &File_Name)
+{
+ //Configuring
+ curl_data Curl_Data;
+ Curl_Data.Curl=curl_easy_init();
+ Curl_Data.MI=MI;
+ Curl_Data.File_Name=File_Name;
+ string FileName_String=Ztring(Curl_Data.File_Name).To_Local();
+ 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());
+ 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);
+
+ //Parsing
+ CURLcode Result;
+ do
+ {
+ //GoTo
+ if (Curl_Data.File_GoTo!=(int64u)-1)
+ {
+ #ifdef MEDIAINFO_DEBUG
+ std::cout<<std::hex<<Curl_Data.File_Offset-Curl_Data.Debug_BytesRead<<" - "<<Curl_Data.File_Offset<<" : "<<std::dec<<Curl_Data.Debug_BytesRead<<" bytes"<<std::endl;
+ Curl_Data.File_Offset=Curl_Data.File_GoTo;
+ Curl_Data.Debug_BytesRead=0;
+ Curl_Data.Debug_Count++;
+ #endif //MEDIAINFO_DEBUG
+
+ if (Curl_Data.File_GoTo<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.File_GoTo;
+ curl_easy_setopt(Curl_Data.Curl, CURLOPT_RESUME_FROM, File_GoTo_Long);
+ }
+ else
+ {
+ curl_off_t File_GoTo_Off=(curl_off_t)Curl_Data.File_GoTo;
+ curl_easy_setopt(Curl_Data.Curl, CURLOPT_RESUME_FROM_LARGE, File_GoTo_Off);
+ }
+ MI->Open_Buffer_Init((int64u)-1, Curl_Data.File_GoTo);
+ Curl_Data.File_GoTo=(int64u)-1;
+ }
+
+ //Parsing
+ Result=curl_easy_perform(Curl_Data.Curl);
+ }
+ while (Result==CURLE_WRITE_ERROR && Curl_Data.File_GoTo!=(int64u)-1);
+
+ #ifdef MEDIAINFO_DEBUG
+ std::cout<<std::hex<<Curl_Data.File_Offset-Curl_Data.Debug_BytesRead<<" - "<<Curl_Data.File_Offset<<" : "<<std::dec<<Curl_Data.Debug_BytesRead<<" bytes"<<std::endl;
+ std::cout<<"Total: "<<std::dec<<Curl_Data.Debug_BytesRead_Total<<" bytes in "<<Curl_Data.Debug_Count<<" blocks"<<std::endl;
+ #endif //MEDIAINFO_DEBUG
+
+ MI->Open_Buffer_Finalize();
+
+ //Cleanup
+ curl_easy_cleanup(Curl_Data.Curl);
+ return 1;
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_LIBCURL_YES
+
diff --git a/src/thirdparty/MediaInfo/Reader/Reader_libcurl.h b/src/thirdparty/MediaInfo/Reader/Reader_libcurl.h
new file mode 100644
index 000000000..413423337
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Reader/Reader_libcurl.h
@@ -0,0 +1,49 @@
+// Reader_libcurl - All information about media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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/MediaInfo_Internal.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+/// @brief Reader_libcurl
+//***************************************************************************
+
+class Reader_libcurl
+{
+public :
+ //Format testing
+ static size_t Format_Test(MediaInfo_Internal* MI, const String &File_Name);
+};
+
+} //NameSpace
+#endif
diff --git a/src/thirdparty/MediaInfo/Reader/Reader_libmms.cpp b/src/thirdparty/MediaInfo/Reader/Reader_libmms.cpp
new file mode 100644
index 000000000..bf86dd995
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Reader/Reader_libmms.cpp
@@ -0,0 +1,121 @@
+// Reader_libmms - All info about media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#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"
+ #else //MEDIAINFO_LIBMMS_FROMSOURCE
+ #include "libmms/mmsx.h"
+ #endif //MEDIAINFO_LIBMMS_FROMSOURCE
+#endif
+using namespace ZenLib;
+using namespace std;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+const size_t Buffer_NormalSize=64*1024;
+
+//***************************************************************************
+// libmms stuff
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+int Reader_libmms::Format_Test(MediaInfo_Internal* MI, const String &File_Name)
+{
+ //Opening the file
+ mmsx_t* Handle=mmsx_connect(0, 0, Ztring(File_Name).To_Local().c_str(), (int)-1);
+ if (Handle==NULL)
+ return 0;
+
+ mms_off_t Offset=mmsx_seek(0, Handle, 0, SEEK_SET);
+ uint32_t Length=mmsx_get_length(Handle);
+
+ //Buffer
+ size_t Buffer_Size_Max=Buffer_NormalSize;
+ int8u* Buffer=new int8u[Buffer_Size_Max];
+
+ //Parser
+ MI->Open_Buffer_Init(Length, File_Name);
+
+ //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=mmsx_read(0, Handle, (char*)Buffer, (int)Buffer_Size_Max);
+ if (Buffer_Size==0)
+ break; //Problem while reading
+
+ //Parser
+ Status=MI->Open_Buffer_Continue(Buffer, Buffer_Size);
+ }
+ while (!(Status[File__Analyze::IsFinished] || (StopAfterFilled && Status[File__Analyze::IsFilled])));
+ if (Length==0) //If Size==0, Status is never updated
+ Status=MI->Open_Buffer_Continue(NULL, 0);
+
+ //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
+
diff --git a/src/thirdparty/MediaInfo/Reader/Reader_libmms.h b/src/thirdparty/MediaInfo/Reader/Reader_libmms.h
new file mode 100644
index 000000000..372157ea6
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Reader/Reader_libmms.h
@@ -0,0 +1,49 @@
+// Reader_libmms - All information about media files
+// Copyright (C) 2002-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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/MediaInfo_Internal.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+/// @brief Reader_libmms
+//***************************************************************************
+
+class Reader_libmms
+{
+public :
+ //Format testing
+ static int Format_Test(MediaInfo_Internal* MI, const String &File_Name);
+};
+
+} //NameSpace
+#endif
diff --git a/src/thirdparty/MediaInfo/Setup.h b/src/thirdparty/MediaInfo/Setup.h
new file mode 100644
index 000000000..fbdbc2ba4
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Setup.h
@@ -0,0 +1,555 @@
+// Config - Config file for MediaInfo
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// All compilation definitions
+// Helpers for compilers (precompilation)
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//***************************************************************************
+// Precompilation
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+//Useful for precompiled headers
+#ifdef ZENLIB_USEWX
+ #ifndef __BORLANDC__ //Borland C++ does NOT support large files
+ #ifndef _FILE_OFFSET_BITS
+ #define _FILE_OFFSET_BITS 64
+ #endif //_FILE_OFFSET_BITS
+ #ifndef _LARGE_FILES
+ #define _LARGE_FILES
+ #endif //_LARGE_FILES
+ #ifndef _LARGEFILE_SOURCE
+ #define _LARGEFILE_SOURCE 1
+ #endif //_LARGEFILE_SOURCE
+ #endif //__BORLANDC__
+ #ifdef __BORLANDC__
+ #include <mem.h> //memcpy
+ #endif //__BORLANDC__
+ #include <wx/wxprec.h>
+#else //ZENLIB_USEWX
+ #if defined(__VISUALC__) || defined(__BORLANDC__)
+ #if defined WINDOWS && !defined ZENLIB_STANDARD
+ #undef __TEXT
+ #include <windows.h>
+ #endif //WINDOWS
+ #include <iomanip>
+ #include <algorithm>
+ #include <cmath>
+ #include <cstdio>
+ #include <cstdlib>
+ #include <ctime>
+ #include <map>
+ #include <string>
+ #include <sstream>
+ #include <vector>
+ #endif //defined(__VISUALC__) || defined(__BORLANDC__)
+#endif //ZENLIB_USEWX
+
+//---------------------------------------------------------------------------
+//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_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
+#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_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_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_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_DEMUX)
+ #if !defined(MEDIAINFO_DEMUX_YES) && !MEDIAINFO_EVENTS
+ #define MEDIAINFO_DEMUX_NO //MEDIAINFO_DEMUX is disabled by default if MEDIAINFO_EVENTS is set to 1
+ #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
+
+//***************************************************************************
+// 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)
+ #define MEDIAINFO_LIBMMS_YES
+#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_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_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_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_IVF_NO) && !defined(MEDIAINFO_IVF_YES)
+ #define MEDIAINFO_IVF_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_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_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_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_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_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_VC1_NO) && !defined(MEDIAINFO_VC1_YES)
+ #define MEDIAINFO_VC1_YES
+#endif
+#if !defined(MEDIAINFO_VIDEO_NO) && !defined(MEDIAINFO_THEORA_NO) && !defined(MEDIAINFO_THEORA_YES)
+ #define MEDIAINFO_THEORA_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_ADIF_NO) && !defined(MEDIAINFO_ADIF_YES)
+ #define MEDIAINFO_ADIF_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_ADTS_NO) && !defined(MEDIAINFO_ADTS_YES)
+ #define MEDIAINFO_ADTS_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_AES3_NO) && !defined(MEDIAINFO_AES3_YES)
+ #define MEDIAINFO_AES3_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_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_LATM_NO) && !defined(MEDIAINFO_LATM_YES)
+ #define MEDIAINFO_LATM_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_PCM_NO) && !defined(MEDIAINFO_PCM_YES)
+ #define MEDIAINFO_PCM_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_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_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_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_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_SCTE20_NO) && !defined(MEDIAINFO_SCTE20_YES)
+ #define MEDIAINFO_SCTE20_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_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_PNG_NO) && !defined(MEDIAINFO_PNG_YES)
+ #define MEDIAINFO_PNG_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
+
+//---------------------------------------------------------------------------
+// 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_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
+
diff --git a/src/thirdparty/MediaInfo/Tag/File_ApeTag.cpp b/src/thirdparty/MediaInfo/Tag/File_ApeTag.cpp
new file mode 100644
index 000000000..71b1f0914
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Tag/File_ApeTag.cpp
@@ -0,0 +1,210 @@
+// File_ApeTag - Info for ApeTag tagged files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_APETAG_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Tag/File_ApeTag.h"
+#include <algorithm>
+#include <ctime>
+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<Element_Size; Pos++)
+ if (Buffer[Buffer_Offset+Pos]==0x00)
+ break;
+ if (Pos==Element_Size)
+ {
+ Element_WaitForMoreData();
+ return;
+ }
+ Get_String(Pos-Element_Offset, Key, "Key");
+ Skip_L1( "0x00");
+
+ //Filling
+ Header_Fill_Code(0, Key.c_str());
+ Header_Fill_Size(Element_Offset+Length);
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_ApeTag::HeaderFooter()
+{
+ //Parsing
+ int32u Flags;
+ Skip_C8( "Preamble");
+ Skip_L4( "Version");
+ Skip_L4( "Size");
+ Skip_L4( "Count");
+ 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");
+ Skip_L8( "Reserved");
+}
+
+//---------------------------------------------------------------------------
+void File_ApeTag::Data_Parse()
+{
+ //If footer
+ if (Element_Code==(int64u)-1)
+ {
+ HeaderFooter();
+ Finish("ApeTag");
+ return;
+ }
+
+ //Parsing
+ Ztring Value;
+ Get_UTF8(Element_Size, Value, "Value"); Element_Info(Value);
+
+ //Filling
+ transform(Key.begin(), Key.end(), Key.begin(), (int(*)(int))toupper); //(int(*)(int)) is a patch for unix
+ if (Key=="ALBUM") Fill(Stream_General, 0, General_Album, Value);
+ else if (Key=="ARTIST") Fill(Stream_General, 0, General_Performer, Value);
+ else if (Key=="AUTHOR") Fill(Stream_General, 0, General_WrittenBy, Value);
+ else if (Key=="BAND") Fill(Stream_General, 0, General_Performer, Value);
+ else if (Key=="COMMENT") Fill(Stream_General, 0, General_Comment, Value);
+ else if (Key=="COMMENTS") Fill(Stream_General, 0, General_Comment, Value);
+ else if (Key=="COMPOSER") Fill(Stream_General, 0, General_Composer, Value);
+ else if (Key=="CONTENTGROUP") Fill(Stream_General, 0, General_Genre, Value);
+ else if (Key=="COPYRIGHT") Fill(Stream_General, 0, General_Copyright, Value);
+ else if (Key=="DISK")
+ {
+ if (Value.find(_T("/"))!=Error)
+ {
+ Fill(Stream_General, 0, General_Part_Position_Total, Value.SubString(_T("/"), _T("")));
+ Fill(Stream_General, 0, General_Part_Position, Value.SubString(_T(""), _T("/")));
+ }
+ else
+ Fill(Stream_General, 0, General_Track_Position, Value);
+ }
+ else if (Key=="ENCODEDBY") Fill(Stream_General, 0, General_EncodedBy, Value);
+ else if (Key=="GENRE") Fill(Stream_General, 0, General_Genre, Value);
+ else if (Key=="ORIGARTIST") Fill(Stream_General, 0, General_Original_Performer, Value);
+ else if (Key=="TITLE") Fill(Stream_General, 0, General_Title, Value);
+ else if (Key=="TRACK")
+ {
+ if (Value.find(_T("/"))!=Error)
+ {
+ Fill(Stream_General, 0, General_Track_Position_Total, Value.SubString(_T("/"), _T("")));
+ Fill(Stream_General, 0, General_Track_Position, Value.SubString(_T(""), _T("/")));
+ }
+ else
+ Fill(Stream_General, 0, General_Track_Position, Value);
+ }
+ else if (Key=="UNSYNCEDLYRICS") Fill(Stream_General, 0, General_Lyrics, Value);
+ else if (Key=="WWW") Fill(Stream_General, 0, General_Title_Url, Value);
+ else if (Key=="YEAR") Fill(Stream_General, 0, General_Recorded_Date, Value);
+ else if (Key=="CONTENT GROUP DESCRIPTION") Fill(Stream_General, 0, General_Title, Value);
+ else if (Key=="ORIGINAL ALBUM/MOVIE/SHOW TITLE") Fill(Stream_General, 0, General_Original_Album, Value);
+ else if (Key=="ORIGINAL ARTIST(S)/PERFORMER(S)") Fill(Stream_General, 0, General_Original_Performer, Value);
+ else if (Key=="MP3GAIN_MINMAX") Fill(Stream_Audio, 0, "MP3Gain, Min/Max", Value);
+ else if (Key=="MP3GAIN_UNDO") Fill(Stream_Audio, 0, "MP3Gain, Undo", Value);
+ else if (Key=="REPLAYGAIN_TRACK_GAIN") Fill(Stream_Audio, 0, Audio_ReplayGain_Gain, Value.To_float64(), 2, true);
+ else if (Key=="REPLAYGAIN_TRACK_PEAK") Fill(Stream_Audio, 0, Audio_ReplayGain_Peak, Value.To_float64(), 6, true);
+ else Fill(Stream_General, 0, Key.c_str(), Value);
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_APETAG_YES
+
diff --git a/src/thirdparty/MediaInfo/Tag/File_ApeTag.h b/src/thirdparty/MediaInfo/Tag/File_ApeTag.h
new file mode 100644
index 000000000..e48dae2f6
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Tag/File_ApeTag.h
@@ -0,0 +1,60 @@
+// File_ApeTag - Info for APETAG tagged files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about APETAG tagged files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_ApeTagH
+#define MediaInfo_File_ApeTagH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_ApeTag
+//***************************************************************************
+
+class File_ApeTag : public File__Analyze
+{
+private :
+ //Buffer - File header
+ void FileHeader_Parse();
+
+ //Buffer - Per element
+ bool Header_Begin();
+ void Header_Parse();
+ void Data_Parse();
+
+ //Elements
+ void HeaderFooter();
+
+ //Temp
+ std::string Key;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Tag/File_Id3.cpp b/src/thirdparty/MediaInfo/Tag/File_Id3.cpp
new file mode 100644
index 000000000..300e1cc66
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Tag/File_Id3.cpp
@@ -0,0 +1,107 @@
+// File_Id3 - Info for ID3 tagged files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_ID3_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Tag/File_Id3.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Id3::Read_Buffer_Continue()
+{
+ //Buffer size
+ if (Buffer_Size<128)
+ return;
+
+ //Parsing
+ Element_Offset=0;
+ Element_Size=Buffer_Size;
+ Ztring Title, Artist, Album, Year, Comment;
+ int8u Track=0, Genre;
+ Skip_C3 ( "ID");
+ Get_Local (30, Title, "Title");
+ Get_Local (30, Artist, "Artist");
+ Get_Local (30, Album, "Album");
+ Get_Local ( 4, Year, "Year");
+ Get_Local (30, Comment, "Comment");
+ if (Comment.size()<29) //Id3v1.1 specifications : Track number addition
+ {
+ Element_Offset-=2;
+ int8u Zero;
+ Peek_B1(Zero);
+ if (Zero==0)
+ {
+ Skip_B1( "Zero");
+ Get_B1 (Track, "Track");
+ }
+ else
+ Element_Offset+=2;
+ }
+ Get_B1 (Genre, "Genre");
+
+ FILLING_BEGIN();
+ Title.TrimRight();
+ Artist.TrimRight();
+ Album.TrimRight();
+ Year.TrimRight();
+ Comment.TrimRight();
+
+ Accept("Id3");
+
+ Stream_Prepare(Stream_General);
+ Fill(Stream_General, 0, General_Album, Album);
+ Fill(Stream_General, 0, General_Track, Title);
+ Fill(Stream_General, 0, General_Performer, Artist);
+ Fill(Stream_General, 0, General_Comment, Comment);
+ Fill(Stream_General, 0, General_Recorded_Date, Year);
+ if (Genre && Genre!=(int8u)-1)
+ Fill(Stream_General, 0, General_Genre, Genre);
+ if (Track)
+ Fill(Stream_General, 0, General_Track_Position, Track);
+
+ Finish("Id3");
+ FILLING_END();
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_ID3_YES
+
diff --git a/src/thirdparty/MediaInfo/Tag/File_Id3.h b/src/thirdparty/MediaInfo/Tag/File_Id3.h
new file mode 100644
index 000000000..afdab834a
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Tag/File_Id3.h
@@ -0,0 +1,49 @@
+// File_Id3 - Info for Id3 tagged files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about ID3 tagged files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_Id3H
+#define MediaInfo_File_Id3H
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Id3
+//***************************************************************************
+
+class File_Id3 : public File__Analyze
+{
+private :
+ //Buffer - Global
+ void Read_Buffer_Continue ();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Tag/File_Id3v2.cpp b/src/thirdparty/MediaInfo/Tag/File_Id3v2.cpp
new file mode 100644
index 000000000..79e63aaac
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Tag/File_Id3v2.cpp
@@ -0,0 +1,1257 @@
+// File_Id3 - Info for ID3v2 tagged files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//***************************************************************************
+// Infos (Common)
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_ID3V2_YES) || defined(MEDIAINFO_FLAC_YES) || defined(MEDIAINFO_VORBISCOM_YES) || defined(MEDIAINFO_OGG_YES)
+//---------------------------------------------------------------------------
+
+#include "ZenLib/Conf.h"
+using namespace ZenLib;
+
+namespace MediaInfoLib
+{
+
+//---------------------------------------------------------------------------
+extern const char* Id3v2_PictureType(int8u Type)
+{
+ switch (Type)
+ {
+ case 0x01 :
+ case 0x02 : return "File icon";
+ case 0x03 : return "Cover (front)";
+ case 0x04 : return "Cover (back)";
+ case 0x05 : return "Leaflet page";
+ case 0x06 : return "Media";
+ case 0x07 :
+ case 0x08 : return "Performer";
+ case 0x09 : return "Conductor";
+ case 0x0A : return "Performer";
+ case 0x0B : return "Composer";
+ case 0x0C : return "Lyricist";
+ case 0x0D : return "Recording Location";
+ case 0x0E : return "During recording";
+ case 0x0F : return "During performance";
+ case 0x10 : return "Screen capture";
+ case 0x12 : return "Illustration";
+ case 0x13 : return "Performer logo";
+ case 0x14 : return "Publisher logo";
+ default : return "";
+ }
+}
+
+} //NameSpace
+
+//---------------------------------------------------------------------------
+#endif //...
+//---------------------------------------------------------------------------
+
+//***************************************************************************
+//
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_ID3V2_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Tag/File_Id3v2.h"
+#include "ZenLib/ZtringListList.h"
+#include "ZenLib/Utils.h"
+#include "ZenLib/Base64/base64.h"
+#include <cstring>
+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()
+{
+ //Configuration
+ Buffer_MaximumSize=8*1024*1024;
+
+ //Temp
+ Id3v2_Size=0;
+ Unsynchronisation_Frame=false;
+}
+
+//***************************************************************************
+// 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_Finish()
+{
+ if (Count_Get(Stream_General)==0)
+ return;
+
+ //Specific formats (multiple Id3v2 tags for one MI tag)
+ Ztring Recorded_Date;
+ if (Retrieve(Stream_General, 0, General_Recorded_Date).empty() && !Year.empty())
+ {
+ Recorded_Date+=Year;
+ if (!Month.empty() && !Month.empty())
+ {
+ Recorded_Date+=_T("-");
+ Recorded_Date+=Year;
+ Recorded_Date+=_T("-");
+ Recorded_Date+=Day;
+ if (!Month.empty() && !Month.empty())
+ {
+ Recorded_Date+=_T(" ");
+ Recorded_Date+=Hour;
+ Recorded_Date+=_T(":");
+ Recorded_Date+=Minute;
+ }
+ }
+ }
+ if (!Recorded_Date.empty())
+ Fill(Stream_General, 0, "Recorded_Date", Recorded_Date);
+
+ //Special cases
+ //-Position and total parts
+ if (Retrieve(Stream_General, 0, General_Part_Position).find(_T("/"))!=Error)
+ {
+ Ztring Temp=Retrieve(Stream_General, 0, General_Part_Position);
+ Fill(Stream_General, 0, General_Part_Position_Total, Temp.SubString(_T("/"), _T("")));
+ Fill(Stream_General, 0, General_Part_Position, Temp.SubString(_T(""), _T("/")));
+ }
+ if (Retrieve(Stream_General, 0, General_Track_Position).find(_T("/"))!=Error)
+ {
+ const Ztring &Temp=Retrieve(Stream_General, 0, General_Track_Position);
+ Fill(Stream_General, 0, General_Track_Position_Total, Temp.SubString(_T("/"), _T("")), true);
+ Fill(Stream_General, 0, General_Track_Position, Temp.SubString(_T(""), _T("/")), true);
+ }
+ //-Genre
+ if (Retrieve(Stream_General, 0, General_Genre).find(_T("("))==0)
+ {
+ const Ztring &Genre=Retrieve(Stream_General, 0, General_Genre);
+ Fill(Stream_General, 0, General_Genre, Genre.SubString(_T("("), _T(")")), true); //Replace (nn) by nn
+ }
+ if (Retrieve(Stream_General, 0, General_Genre)==_T("0") || Retrieve(Stream_General, 0, General_Genre)==_T("255"))
+ Clear(Stream_General, 0, General_Genre);
+}
+
+//***************************************************************************
+// 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_Info(Id3v2_Size);
+ if (ExtendedHeader)
+ {
+ Element_Begin("Extended header");
+ int32u Size_Extended;
+ Get_B4 (Size_Extended, "Size");
+ Skip_XX(Size_Extended, "Extended header");
+ Element_End();
+ }
+
+ 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()
+{
+ 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");
+ 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");
+ Skip_Flags(Flags, 0, "Data length indicator");
+ }
+ if (Id3v2_Version!=3)
+ {
+ Size=((Size>>0)&0x7F)
+ | ((Size>>1)&0x3F80)
+ | ((Size>>2)&0x1FC000)
+ | ((Size>>3)&0x0FE00000);
+ Param_Info(Size);
+ }
+ }
+
+ //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;
+
+ //Unsynchronisation
+ int8u* Buffer_Unsynch=NULL;
+ const int8u* Save_Buffer=Buffer;
+ size_t Save_Buffer_Offset=Buffer_Offset;
+ int64u Save_Element_Size=Element_Size;
+ size_t Element_Offset_Unsynch=0;
+ std::vector<size_t> Unsynch_List;
+ if (Unsynchronisation_Global || Unsynchronisation_Frame)
+ {
+ while (Element_Offset_Unsynch+3<=Element_Size)
+ {
+ if (CC2(Buffer+Buffer_Offset+(size_t)Element_Offset_Unsynch)==0xFF00)
+ Unsynch_List.push_back(Element_Offset_Unsynch+1);
+ Element_Offset_Unsynch++;
+ }
+ if (!Unsynch_List.empty())
+ {
+ //We must change the buffer for keeping out
+ Element_Size=Save_Element_Size-Unsynch_List.size();
+ Buffer_Offset=0;
+ Buffer_Unsynch=new int8u[(size_t)Element_Size];
+ for (size_t Pos=0; Pos<=Unsynch_List.size(); Pos++)
+ {
+ size_t Pos0=(Pos==Unsynch_List.size())?(size_t)Save_Element_Size:(Unsynch_List[Pos]);
+ size_t Pos1=(Pos==0)?0:(Unsynch_List[Pos-1]+1);
+ size_t Buffer_Unsynch_Begin=Pos1-Pos;
+ size_t Save_Buffer_Begin =Pos1;
+ size_t Size= Pos0-Pos1;
+ std::memcpy(Buffer_Unsynch+Buffer_Unsynch_Begin, Save_Buffer+Save_Buffer_Offset+Save_Buffer_Begin, Size);
+ }
+ Buffer=Buffer_Unsynch;
+ }
+ }
+
+ #define CASE_INFO(_NAME, _DETAIL) \
+ case Elements::_NAME : Element_Info(_DETAIL); _NAME(); break;
+
+ //Parsing
+ Element_Value.clear();
+ Element_Values.clear();
+ switch (Element_Code)
+ {
+ CASE_INFO(AENC, "Audio encryption");
+ CASE_INFO(APIC, "Attached picture");
+ CASE_INFO(ASPI, "Audio seek point index");
+ CASE_INFO(COMM, "Comments");
+ CASE_INFO(COMR, "Commercial frame");
+ CASE_INFO(ENCR, "Encryption method registration");
+ CASE_INFO(EQU2, "Equalisation (2)");
+ CASE_INFO(EQUA, "Equalization");
+ CASE_INFO(ETCO, "Event timing codes");
+ CASE_INFO(GEOB, "General encapsulated object");
+ CASE_INFO(GRID, "Group identification registration");
+ CASE_INFO(IPLS, "Involved people list");
+ CASE_INFO(LINK, "Linked information");
+ CASE_INFO(MCDI, "Music CD identifier");
+ CASE_INFO(MLLT, "MPEG location lookup table");
+ CASE_INFO(OWNE, "Ownership frame");
+ CASE_INFO(PCNT, "Play counter");
+ CASE_INFO(POPM, "Popularimeter");
+ CASE_INFO(POSS, "Position synchronisation frame");
+ CASE_INFO(PRIV, "Private frame");
+ CASE_INFO(RBUF, "Recommended buffer size");
+ CASE_INFO(RGAD, "Replay Gain Adjustment");
+ CASE_INFO(RVA2, "Relative volume adjustment (2)");
+ CASE_INFO(RVRB, "Reverb");
+ CASE_INFO(SEEK, "Seek frame");
+ CASE_INFO(SIGN, "Signature frame");
+ CASE_INFO(SYLT, "Synchronised lyric/text");
+ CASE_INFO(SYTC, "Synchronised tempo codes");
+ CASE_INFO(TALB, "Album/Movie/Show title");
+ CASE_INFO(TBPM, "BPM (beats per minute)");
+ CASE_INFO(TCMP, "iTunes Compilation Flag");
+ CASE_INFO(TCOM, "Composer");
+ CASE_INFO(TCON, "Content type");
+ CASE_INFO(TCOP, "Copyright message");
+ CASE_INFO(TDAT, "Date");
+ CASE_INFO(TDEN, "Encoding time");
+ CASE_INFO(TDLY, "Playlist delay");
+ CASE_INFO(TDOR, "Original release time");
+ CASE_INFO(TDRC, "Recording time");
+ CASE_INFO(TDRL, "Release time");
+ CASE_INFO(TDTG, "Tagging time");
+ CASE_INFO(TENC, "Encoded by");
+ CASE_INFO(TEXT, "Lyricist/Text writer");
+ CASE_INFO(TFLT, "File type");
+ CASE_INFO(TIME, "Time");
+ CASE_INFO(TIPL, "Involved people list");
+ CASE_INFO(TIT1, "Content group description");
+ CASE_INFO(TIT2, "Title/songname/content description");
+ CASE_INFO(TIT3, "Subtitle/Description refinement");
+ CASE_INFO(TKEY, "Initial key");
+ CASE_INFO(TLAN, "Language(s)");
+ CASE_INFO(TLEN, "Length");
+ CASE_INFO(TMCL, "Musician credits list");
+ CASE_INFO(TMED, "Media type");
+ CASE_INFO(TMOO, "Mood");
+ CASE_INFO(TOAL, "Original album/movie/show title");
+ CASE_INFO(TOFN, "Original filename");
+ CASE_INFO(TOLY, "Original lyricist(s)/text writer(s)");
+ CASE_INFO(TOPE, "Original artist(s)/performer(s)");
+ CASE_INFO(TORY, "Original release year");
+ CASE_INFO(TOWN, "File owner/licensee");
+ CASE_INFO(TPE1, "Lead performer(s)/Soloist(s)");
+ CASE_INFO(TPE2, "Band/orchestra/accompaniment");
+ CASE_INFO(TPE3, "Conductor/performer refinement");
+ CASE_INFO(TPE4, "Interpreted, remixed, or otherwise modified by");
+ CASE_INFO(TPOS, "Part of a set");
+ CASE_INFO(TPRO, "Produced notice");
+ CASE_INFO(TPUB, "Publisher");
+ CASE_INFO(TRCK, "Track number/Position in set");
+ CASE_INFO(TRDA, "Recording dates");
+ CASE_INFO(TRSN, "Internet radio station name");
+ CASE_INFO(TRSO, "Internet radio station owner");
+ CASE_INFO(TSIZ, "Size");
+ CASE_INFO(TSO2, "Performer order");
+ CASE_INFO(TSOA, "Album sort order");
+ CASE_INFO(TSOC, "Composer sort order");
+ CASE_INFO(TSOP, "Performer sort order");
+ CASE_INFO(TSOT, "Title sort order");
+ CASE_INFO(TSRC, "ISRC (international standard recording code)");
+ CASE_INFO(TSSE, "Software/Hardware and settings used for encoding");
+ CASE_INFO(TSST, "Set subtitle");
+ CASE_INFO(TXXX, "User defined text information frame");
+ CASE_INFO(TYER, "Year");
+ CASE_INFO(UFID, "Unique file identifier");
+ CASE_INFO(USER, "Terms of use");
+ CASE_INFO(USLT, "Unsynchronised lyric/text transcription");
+ CASE_INFO(WCOM, "Commercial information");
+ CASE_INFO(WCOP, "Copyright/Legal information");
+ CASE_INFO(WOAF, "Official audio file webpage");
+ CASE_INFO(WOAR, "Official artist/performer webpage");
+ CASE_INFO(WOAS, "Official audio source webpage");
+ CASE_INFO(WORS, "Official Internet radio station homepage");
+ CASE_INFO(WPAY, "Payment");
+ CASE_INFO(WPUB, "Publishers official webpage");
+ CASE_INFO(WXXX, "User defined URL link frame");
+ CASE_INFO(XRVA, "Relative volume adjustment (2)");
+ CASE_INFO(BUF, "Recommended buffer size");
+ CASE_INFO(CNT, "Play counter");
+ CASE_INFO(COM, "Comments");
+ CASE_INFO(CRA, "Audio encryption");
+ CASE_INFO(CRM, "Encrypted meta frame");
+ CASE_INFO(EQU, "Equalization");
+ CASE_INFO(ETC, "Event timing codes");
+ CASE_INFO(GEO, "General encapsulated object");
+ CASE_INFO(IPL, "Involved people list");
+ CASE_INFO(LNK, "Linked information");
+ CASE_INFO(MCI, "Music CD Identifier");
+ CASE_INFO(MLL, "MPEG location lookup table");
+ CASE_INFO(PIC_, "Attached picture");
+ CASE_INFO(POP, "Popularimeter");
+ CASE_INFO(REV, "Reverb");
+ CASE_INFO(RVA, "Relative volume adjustment");
+ CASE_INFO(SLT, "Synchronized lyric/text");
+ CASE_INFO(STC, "Synced tempo codes");
+ CASE_INFO(TAL, "Album/Movie/Show title");
+ CASE_INFO(TBP, "BPM (Beats Per Minute)");
+ CASE_INFO(TCM, "Composer");
+ CASE_INFO(TCO, "Content type");
+ CASE_INFO(TCP, "iTunes Compilation Flag");
+ CASE_INFO(TCR, "Copyright message");
+ CASE_INFO(TDA, "Date");
+ CASE_INFO(TDY, "Playlist delay");
+ CASE_INFO(TEN, "Encoded by");
+ CASE_INFO(TFT, "File type");
+ CASE_INFO(TIM, "Time");
+ CASE_INFO(TKE, "Initial key");
+ CASE_INFO(TLA, "Language(s)");
+ CASE_INFO(TLE, "Length");
+ CASE_INFO(TMT, "Media type");
+ CASE_INFO(TOA, "Original artist(s)/performer(s)");
+ CASE_INFO(TOF, "Original filename");
+ CASE_INFO(TOL, "Original Lyricist(s)/text writer(s)");
+ CASE_INFO(TOR, "Original release year");
+ CASE_INFO(TOT, "Original album/Movie/Show title");
+ CASE_INFO(TP1, "Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group");
+ CASE_INFO(TP2, "Band/Orchestra/Accompaniment");
+ CASE_INFO(TP3, "Conductor/Performer refinement");
+ CASE_INFO(TP4, "Interpreted, remixed, or otherwise modified by");
+ CASE_INFO(TPA, "Part of a set");
+ CASE_INFO(TPB, "Publisher");
+ CASE_INFO(TRC, "ISRC (International Standard Recording Code)");
+ CASE_INFO(TRD, "Recording dates");
+ CASE_INFO(TRK, "Track number/Position in set");
+ CASE_INFO(TSI, "Size");
+ CASE_INFO(TSS, "Software/hardware and settings used for encoding");
+ CASE_INFO(TT1, "Content group description");
+ CASE_INFO(TT2, "Title/Songname/Content description");
+ CASE_INFO(TT3, "Subtitle/Description refinement");
+ CASE_INFO(TXT, "Lyricist/text writer");
+ CASE_INFO(TXX, "User defined text information frame");
+ CASE_INFO(TYE, "Year");
+ CASE_INFO(UFI, "Unique file identifier");
+ CASE_INFO(ULT, "Unsychronized lyric/text transcription");
+ CASE_INFO(WAF, "Official audio file webpage");
+ CASE_INFO(WAR, "Official artist/performer webpage");
+ CASE_INFO(WAS, "Official audio source webpage");
+ CASE_INFO(WCM, "Commercial information");
+ CASE_INFO(WCP, "Copyright/Legal information");
+ CASE_INFO(WPB, "Publishers official webpage");
+ CASE_INFO(WXX, "User defined URL link frame");
+ default : Skip_XX(Element_Size, "Data");
+ }
+
+ if (!Unsynch_List.empty())
+ {
+ //We must change the buffer for keeping out
+ Element_Size=Save_Element_Size;
+ Buffer_Offset=Save_Buffer_Offset;
+ delete[] Buffer; Buffer=Save_Buffer;
+ Buffer_Unsynch=NULL; //Same as Buffer...
+ Element_Offset+=Unsynch_List.size();
+ }
+
+ if (!Id3v2_Size)
+ Finish("Id3v2");
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+//
+void File_Id3v2::T___()
+{
+ int8u Encoding;
+ Get_B1 (Encoding, "Text_encoding");
+ switch (Encoding)
+ {
+ case 0 : Get_Local (Element_Size-1, Element_Value, "Information"); break;
+ case 1 : Get_UTF16 (Element_Size-1, Element_Value, "Information"); break;
+ case 2 : Get_UTF16B(Element_Size-1, Element_Value, "Information"); break;
+ case 3 : Get_UTF8 (Element_Size-1, Element_Value, "Information"); break;
+ default : ;
+ }
+
+ //Filling
+ Fill_Name();
+}
+
+//---------------------------------------------------------------------------
+//
+void File_Id3v2::T__X()
+{
+ //Integrity
+ if (Element_Size<(Elements::TXXX?4:1))
+ {
+ Element_Values(1).clear();
+ Element_Values(0).clear();
+ return;
+ }
+
+ int8u Encoding;
+ Get_B1 (Encoding, "Text_encoding");
+ if (Element_Code!=Elements::TXXX)
+ Skip_C3( "Language");
+ size_t Value0_Size=0;
+ switch (Encoding)
+ {
+ case 0 :
+ case 3 : //1-byte char
+ while (Element_Offset+Value0_Size<Element_Size && Buffer[Buffer_Offset+(size_t)Element_Offset+Value0_Size]!='\0')
+ Value0_Size++;
+ if (Element_Offset+Value0_Size>=Element_Size)
+ return; //Problem
+ switch (Encoding)
+ {
+ // case 0 : Get_Local (Value0_Size, Element_Values(0), "Short_content_descrip"); break;
+ 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_Local (Element_Size-Element_Offset, Element_Values(1), "The_actual_text"); break;
+ 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
+ && !(Buffer[Buffer_Offset+(size_t)Element_Offset+Value0_Size ]=='\0'
+ && Buffer[Buffer_Offset+(size_t)Element_Offset+Value0_Size+1]=='\0')) //2-byte zero
+ Value0_Size+=2;
+ if (Element_Offset+Value0_Size>=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_Local(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_Local (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;
+ if (Encoding==1)
+ Element_Offset+=Element_Values(0).size()*2+4; //UTF-16 BOM + UTF-16 NULL
+ else if (Encoding==1 || Encoding==2)
+ Element_Offset+=Element_Values(0).size()*2+2; //UTF-16 NULL
+ else
+ Element_Offset+=Element_Values(0).size()+1; //UTF-8 NULL
+ if (Element_Offset<Element_Size)
+ Get_Local(Element_Size-Element_Offset, Element_Values(1), "URL");
+}
+
+//---------------------------------------------------------------------------
+void File_Id3v2::APIC()
+{
+ int8u Encoding, PictureType;
+ Ztring Mime, Description;
+ size_t MimeLength;
+ Get_B1 (Encoding, "Text_encoding");
+ if (Id3v2_Version==2)
+ {
+ int32u Image_format;
+ Get_C3(Image_format, "Image_format");
+ switch (Image_format)
+ {
+ case 0x504E47 : Mime="image/png";
+ case 0x4A5047 : Mime="image/jpeg";
+ default : ;
+ }
+ MimeLength=3;
+ }
+ else
+ {
+ Get_Local(Element_Size-1, Mime, "MIME_type");
+ MimeLength=Mime.size()+1;
+ }
+ Element_Offset=1+MimeLength;
+ Get_B1 (PictureType, "Picture_type"); Element_Info(Id3v2_PictureType(PictureType));
+ Get_Local(Element_Size-Element_Offset, Description, "Description");
+ Element_Offset=1+MimeLength+1+Description.size()+1;
+ if (Element_Offset>Element_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("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())
+ 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_Begin("Gain Adjustement", 2);
+ int16u Replay_Gain_Adjustment;
+ int8u Name_code;
+ bool Sign_bit;
+ BS_Begin();
+ Get_S1 (3, Name_code, "Name code"); Param_Info(Id3v2_RGAD_Name_code[Name_code]);
+ Info_S1(3, Originator_code, "Originator code"); Param_Info(Id3v2_RGAD_Originator_code[Originator_code]);
+ Get_SB (Sign_bit, "Sign bit");
+ Get_S2 (9, Replay_Gain_Adjustment, "Replay Gain Adjustment"); Param_Info ((Sign_bit?-1:1)*(float)Replay_Gain_Adjustment/10, 1, " dB");
+ BS_End();
+ Element_End();
+
+ 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_Local(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()
+{
+ int8u Encoding;
+ Get_B1 (Encoding, "Text encoding");
+ Skip_C3( "Language");
+ Skip_B1( "Time_stamp_format");
+ Skip_B1( "Content_type");
+ switch (Encoding)
+ {
+ case 0 : Get_Local (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(0).empty())
+ Element_Values(0)=_T("URL");
+ Fill_Name();
+}
+
+//***************************************************************************
+// Helpers
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Id3v2::Fill_Name()
+{
+ 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::TCOM : Fill(Stream_General, 0, General_Composer, Element_Value); break;
+ case Elements::TCON : 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_Encoded_Library, 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_ContentType, 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_Accompaniment, 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 : Fill(Stream_General, 0, General_Part_Position, Element_Value); 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 : Fill(Stream_General, 0, General_Track_Position, Element_Value); 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_Settings, Element_Value); break;
+ case Elements::TSST : Fill(Stream_General, 0, "Set subtitle", Element_Value); break;
+ case Elements::TXXX : 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, "Comment", Element_Value); 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 : Fill(Stream_General, 0, "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 : Fill(Stream_General, 0, "Part/Position", Element_Value); 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 : Fill(Stream_General, 0, "Track/Position", Element_Value); break;
+ case Elements::TSI : break;
+ case Elements::TSS : break;
+ case Elements::TT1 : Fill(Stream_General, 0, "ContentType", 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 : 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
+
diff --git a/src/thirdparty/MediaInfo/Tag/File_Id3v2.h b/src/thirdparty/MediaInfo/Tag/File_Id3v2.h
new file mode 100644
index 000000000..3eb0efb9c
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Tag/File_Id3v2.h
@@ -0,0 +1,247 @@
+// File_Id3v2 - Info for ID3v2 tagged files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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_Finish();
+
+ //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() {Skip_XX(Element_Size, "Data");}
+ 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() {Skip_XX(Element_Size, "Data");}
+ 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;
+
+ //Helpers
+ void Fill_Name();
+ void Normalize_Date (Ztring& Date);
+};
+
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Tag/File_Lyrics3.cpp b/src/thirdparty/MediaInfo/Tag/File_Lyrics3.cpp
new file mode 100644
index 000000000..37eff4318
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Tag/File_Lyrics3.cpp
@@ -0,0 +1,95 @@
+// File_Lyrics3 - Info for Lyrics3 tagged files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_Size<TotalSize)
+ return;
+
+ //Parsing
+ Element_Offset=0;
+ Element_Size=TotalSize;
+ Skip_Local(11, "Signature");
+ Skip_Local(TotalSize-20, "Lyrics");
+ Skip_Local(9, "Signature");
+
+ //Filling
+ Accept("Lyric3");
+
+ Stream_Prepare(Stream_Text);
+ Fill(Stream_Text, 0, Text_Codec, "Lyrics3");
+
+ Finish("Lyrics3");
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_LYRICS3_YES
+
diff --git a/src/thirdparty/MediaInfo/Tag/File_Lyrics3.h b/src/thirdparty/MediaInfo/Tag/File_Lyrics3.h
new file mode 100644
index 000000000..47bd25bf7
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Tag/File_Lyrics3.h
@@ -0,0 +1,56 @@
+// File_Lyrics3 - Info for Lyrics3 tagged files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Lyrics3 tagged files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_Lyrics3H
+#define MediaInfo_File_Lyrics3H
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Lyrics3
+//***************************************************************************
+
+class File_Lyrics3 : public File__Analyze
+{
+public :
+ //In
+ int64u TotalSize;
+
+ //Constructor/Destructor
+ File_Lyrics3();
+
+private :
+ //Buffer - Global
+ void Read_Buffer_Continue ();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Tag/File_Lyrics3v2.cpp b/src/thirdparty/MediaInfo/Tag/File_Lyrics3v2.cpp
new file mode 100644
index 000000000..87909c10b
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Tag/File_Lyrics3v2.cpp
@@ -0,0 +1,233 @@
+// File_Lyrics3v2 - Info for Lyrics3v2 tagged files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_LYRICS3V2_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Tag/File_Lyrics3v2.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Constants
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+namespace Elements
+{
+ const int32u AUT=0x415554;
+ const int32u CRC=0x435243;
+ const int32u EAL=0x45414C;
+ const int32u EAR=0x454152;
+ const int32u ETT=0x455454;
+ const int32u IMG=0x494D47;
+ const int32u IND=0x494E44;
+ const int32u INF=0x494E46;
+ const int32u LYR=0x4C5952;
+}
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Lyrics3v2::File_Lyrics3v2()
+:File__Analyze()
+{
+ //Configuration
+ TotalSize=(int64u)-1;
+}
+
+//***************************************************************************
+// Buffer - File header
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Lyrics3v2::FileHeader_Parse()
+{
+ if (TotalSize==(int64u)-1)
+ TotalSize=Buffer_Size;
+
+ //Parsing
+ Skip_Local(11, "Signature");
+
+ FILLING_BEGIN();
+ Accept("Lyrics3v2");
+
+ TotalSize-=11;
+ FILLING_END();
+}
+
+//***************************************************************************
+// Buffer - Per element
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Lyrics3v2::Header_Parse()
+{
+ if (TotalSize<=15) //First 10 is minimum size of a tag, Second 10 is ID3v2 header size
+ {
+ //Place for footer
+ Header_Fill_Code((int64u)-1, "File Footer");
+ Header_Fill_Size(TotalSize);
+ return;
+ }
+
+ //Parsing
+ Ztring SizeT;
+ int64u Size;
+ int32u Field;
+ Get_C3 (Field, "Field");
+ Get_Local(5, SizeT, "Size");
+ Size=8+SizeT.To_int64u();
+
+ //Filling
+ if (Size+15>TotalSize)
+ 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_Info(_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_Offset<Element_Size)
+ Skip_Local(1, "unknown");
+}
+
+//---------------------------------------------------------------------------
+void File_Lyrics3v2::INF()
+{
+ //Parsing
+ Ztring Value;
+ Get_Local(Element_Size, Value, "Value");
+
+ //Filling
+ Fill(Stream_General, 0, General_Comment, Value);
+}
+
+//---------------------------------------------------------------------------
+void File_Lyrics3v2::LYR()
+{
+ //Parsing
+ Skip_XX(Element_Size, "Value");
+
+ //Filling
+ Stream_Prepare(Stream_Text);
+ Fill(Stream_Text, 0, Text_Codec, "Lyrics3v2");
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_LYRICS3V2_YES
+
diff --git a/src/thirdparty/MediaInfo/Tag/File_Lyrics3v2.h b/src/thirdparty/MediaInfo/Tag/File_Lyrics3v2.h
new file mode 100644
index 000000000..16b77e90c
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Tag/File_Lyrics3v2.h
@@ -0,0 +1,73 @@
+// File_Lyrics3v2 - Info for Lyrics3v2 tagged files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Lyrics3v2 tagged files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_Lyrics3v2H
+#define MediaInfo_File_Lyrics3v2H
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Lyrics3v2
+//***************************************************************************
+
+class File_Lyrics3v2 : public File__Analyze
+{
+public :
+ //In
+ int64u TotalSize;
+
+ //Constructor/Destructor
+ File_Lyrics3v2();
+
+private :
+ //Buffer - File header
+ void FileHeader_Parse();
+
+ //Buffer - Per element
+ void Header_Parse ();
+ void Data_Parse ();
+
+ //Elements
+ void Header();
+ void Footer();
+ void AUT() {Skip_Local(Element_Size, "Value");}
+ void CRC() {Skip_Local(Element_Size, "Value");}
+ void EAL();
+ void EAR();
+ void ETT();
+ void IMG() {Skip_Local(Element_Size, "Value");}
+ void IND();
+ void INF();
+ void LYR();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Tag/File_VorbisCom.cpp b/src/thirdparty/MediaInfo/Tag/File_VorbisCom.cpp
new file mode 100644
index 000000000..ff899080e
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Tag/File_VorbisCom.cpp
@@ -0,0 +1,307 @@
+// File_VorbisCom - Info for VorbisComments tagged files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_VORBISCOM_YES) || defined(MEDIAINFO_OGG_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Tag/File_VorbisCom.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Infos
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+extern const char* Id3v2_PictureType(int8u Type); //In Tag/File_Id3v2.cpp
+extern std::string ExtensibleWave_ChannelMask (int32u ChannelMask); //In Multiple/File_Riff_Elements.cpp
+extern std::string ExtensibleWave_ChannelMask2 (int32u ChannelMask); //In Multiple/File_Riff_Elements.cpp
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_VorbisCom::File_VorbisCom()
+:File__Analyze()
+{
+ //In
+ StreamKind_Specific=Stream_General;
+ StreamKind_Multiple=Stream_General;
+ StreamKind_Common =Stream_General;
+}
+
+//***************************************************************************
+// Buffer - File header
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_VorbisCom::FileHeader_Parse()
+{
+ //Parsing
+ Ztring vendor_string;
+ int32u vendor_length;
+ Get_L4 (vendor_length, "vendor_length");
+ Get_Local(vendor_length, vendor_string, "vendor_string");
+ Get_L4 (user_comment_list_length, "user_comment_list_length");
+
+ FILLING_BEGIN();
+ Accept("VorbisCom");
+
+ if (Count_Get(Stream_General)==0)
+ Stream_Prepare(Stream_General);
+ if (StreamKind_Specific!=Stream_General)
+ Stream_Prepare(StreamKind_Specific);
+ if (StreamKind_Multiple!=Stream_General && StreamKind_Multiple!=StreamKind_Specific)
+ Stream_Prepare(StreamKind_Multiple);
+
+ //vendor_string
+ if (StreamKind_Specific!=Stream_Audio && vendor_string.find(_T("Xiph.Org libVorbis"))==0)
+ vendor_string.clear(); //string was set "by default"
+ Ztring Library_Name, Library_Version, Library_Date;
+ Ztring vendor_string_Without=vendor_string; vendor_string_Without.FindAndReplace(_T(";"), _T(""), 0, Ztring_Recursive);
+ Library_Version=MediaInfoLib::Config.Library_Get(InfoLibrary_Format_VorbisCom, vendor_string_Without, InfoLibrary_Version);
+ Library_Date=MediaInfoLib::Config.Library_Get(InfoLibrary_Format_VorbisCom, vendor_string_Without, InfoLibrary_Date);
+ if (Library_Version.empty())
+ {
+ if (vendor_string.find(_T(" I "))!=std::string::npos)
+ {
+ Library_Name=vendor_string.SubString(_T(""), _T(" I "));
+ Library_Date=vendor_string.SubString(_T(" I "), _T(""));
+ if (Library_Date.size()>9)
+ {
+ 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<Library_Name.size()-2 && Library_Name[Pos+1]>=_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(Library_Date.begin()+6, _T('-'));
+ Library_Date.insert(Library_Date.begin()+4, _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")) {if (Value!=Retrieve(StreamKind_Common, 0, "Performer")) Fill(StreamKind_Common, 0, "Performer", 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")) {if (Value!=Retrieve(StreamKind_Common, 0, "Performer")) Fill(StreamKind_Common, 0, "Performer", Value);}
+ else if (Key==_T("ARTIST")) {if (Value!=Retrieve(StreamKind_Common, 0, "Performer")) Fill(StreamKind_Common, 0, "Performer", 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("DISCNUMBER")) Fill(StreamKind_Common, 0, "Part", Value, true);
+ else if (Key==_T("ENCODEDBY")) 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")) {if (Value!=Retrieve(StreamKind_Common, 0, "Performer")) Fill(StreamKind_Common, 0, "Accompaniment", 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("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("ORGANIZATION")) Fill(StreamKind_Common, 0, "Producer", Value);
+ else if (Key==_T("PERFORMER")) Fill(StreamKind_Common, 0, "Performer", 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_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("TRACK_COMMENT")) Fill(StreamKind_Multiple, 0, "Comment", Value);
+ else if (Key==_T("TRACKNUMBER")) Fill(StreamKind_Multiple, 0, "Track/Position", Value);
+ else if (Key==_T("VERSION")) Fill(StreamKind_Common, 0, "Track/More", 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<Value.size(); Pos++)
+ {
+ ValueI*=16;
+ if (Value[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
+
diff --git a/src/thirdparty/MediaInfo/Tag/File_VorbisCom.h b/src/thirdparty/MediaInfo/Tag/File_VorbisCom.h
new file mode 100644
index 000000000..c32b1c519
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Tag/File_VorbisCom.h
@@ -0,0 +1,67 @@
+// File_VorbisCom - Info for VorbisComments tagged files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Vorbis comments
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_VorbisComH
+#define MediaInfo_File_VorbisComH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.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 :
+ //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;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Tag/File__Tags.cpp b/src/thirdparty/MediaInfo/Tag/File__Tags.cpp
new file mode 100644
index 000000000..f3cc27725
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Tag/File__Tags.cpp
@@ -0,0 +1,561 @@
+// File__Tags - Info for all kind of framed tags tagged files
+// Copyright (C) 2005-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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;
+ Parser_Streams_Fill=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;
+ delete Parser_Streams_Fill; //Parser_Streams_Fill=NULL;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File__Tags_Helper::Streams_Fill()
+{
+ if (Parser_Streams_Fill && Parser_Streams_Fill->Status[File__Analyze::IsAccepted])
+ {
+ Parser_Streams_Fill->Read_Buffer_Finalize();
+ Base->Merge(*Parser_Streams_Fill, Stream_General, 0, 0, false);
+ Base->Merge(*Parser_Streams_Fill, Stream_Audio , 0, 0, false);
+ }
+ delete Parser_Streams_Fill; Parser_Streams_Fill=NULL;
+}
+
+//---------------------------------------------------------------------------
+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;
+ }
+
+ //ID
+ if (Base->Buffer_Offset+Synchro_Offset+3>Base->Buffer_Size)
+ return false;
+ switch (CC3(Base->Buffer+Base->Buffer_Offset+Synchro_Offset))
+ {
+ case 0x494433 : //"ID3"
+ if (!Synched_Test()) //Handling begin/intermediate Id3v2
+ return false;
+ return Synchronize(Tag_Found, Synchro_Offset);
+ case 0x544147 : //"TAG"
+ case 0x4C5952 : //"LYR"
+ case 0x415045 : //"APE"
+ if (TagSizeIsFinal && Base->File_Offset+Base->Buffer_Offset==Base->File_Size-File_EndTagSize)
+ {
+ Tag_Found=true;
+ return Synched_Test();
+ }
+ else if (Base->File_Offset+Base->Buffer_Size==Base->File_Size)
+ {
+ while (!TagSizeIsFinal && DetectBeginOfEndTags_Test());
+ Tag_Found=Base->File_Offset+Base->Buffer_Offset==Base->File_Size-File_EndTagSize;
+ return true;
+ }
+ else
+ return false; //Need more data
+ default : if (Base->File_Offset+Base->Buffer_Offset==ApeTag_Offset)
+ {
+ Tag_Found=true;
+ return true;
+ };
+ }
+
+ Tag_Found=false;
+ return Base->File_GoTo==(int64u)-1;
+}
+
+//---------------------------------------------------------------------------
+bool File__Tags_Helper::Synched_Test()
+{
+ while (1)
+ {
+ if (!Parser)
+ {
+ //Must have enough buffer for having header
+ if (Base->Buffer_Offset+3>Base->Buffer_Size)
+ return false;
+
+ //Quick test of synchro
+ int32u ID=CC3(Base->Buffer+Base->Buffer_Offset);
+ if (ID==0x494433) //"ID3"
+ {
+ if (Base->Buffer_Offset+10>Base->Buffer_Size)
+ return false;
+ #ifdef MEDIAINFO_ID3V2_YES
+ Parser=new File_Id3v2;
+ #else
+ Parser=new File_Unknown;
+ #endif
+ 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;
+ File_BeginTagSize+=Parser_Buffer_Size;
+ if (Base->File_Offset_FirstSynched==(int64u)-1)
+ Base->Buffer_TotalBytes_FirstSynched_Max+=Parser_Buffer_Size;
+ Base->Element_Begin("Id3v2");
+ }
+ else if (ID==0x544147) //"TAG"
+ {
+ #ifdef MEDIAINFO_ID3_YES
+ Parser=new File_Id3;
+ #else
+ Parser=new File_Unknown;
+ #endif
+ Parser_Buffer_Size=128;
+ Base->Element_Begin("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;
+ Base->Element_Begin("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;
+ Base->Element_Begin("Lyrics3v2");
+ }
+ else if (Base->File_Offset+Base->Buffer_Offset==ApeTag_Offset)
+ {
+ #ifdef MEDIAINFO_APE_YES
+ Parser=new File_ApeTag;
+ #else
+ Parser=new File_Unknown;
+ #endif
+ Parser_Buffer_Size=(size_t)ApeTag_Size;
+ Base->Element_Begin("ApeTag");
+ }
+ else
+ break;
+ Base->Open_Buffer_Init(Parser);
+ }
+
+ //We continue
+ if (Parser)
+ {
+ int64u Size_ToParse=(Parser_Buffer_Size<Base->Buffer_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)
+ {
+ Parser->Read_Buffer_Finalize();
+ Base->Merge(*Parser, Stream_General, 0, 0, false);
+ Base->Merge(*Parser, Stream_Audio , 0, 0, false);
+ delete Parser; Parser=NULL;
+ }
+ else if (Parser_Streams_Fill==NULL) //Currently using only the first detected tag
+ {
+ Parser_Streams_Fill=Parser; Parser=NULL;
+ }
+ else
+ {
+ delete Parser; Parser=NULL;
+ }
+ if (Parser_Buffer_Size)
+ Base->Skip_XX(Parser_Buffer_Size, "Data continued");
+ Base->Element_Show();
+ Base->Element_End();
+ }
+ 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 (Base->File_GoTo!=(int64u)-1)
+ return;
+
+ //Positionning (if finnished)
+ if (TagSizeIsFinal)
+ {
+ if (JumpTo_WantedByParser!=(int64u)-1)
+ {
+ if (JumpTo_WantedByParser<Id3v1_Size+Lyrics3_Size+Lyrics3v2_Size+ApeTag_Size)
+ Base->GoTo(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_End(); //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_End(); //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) //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_Size<Base->File_Size-125) //Must be at least at the end less 128 bytes plus 3 bytes of tags
+ {
+ if (Base->File_Offset!=Base->File_Size-128)
+ Base->GoTo(Base->File_Size-128-32, "Tags detection"); //32 to be able to quickly see another tag system
+ 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_Size<Base->File_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_Size<Base->File_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_Size<Base->File_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->Buffer_Size-File_EndTagSize-15))), 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_Size<Base->File_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->Buffer_Size-File_EndTagSize-32+12)));
+ if (LittleEndian2int32u(Base->Buffer+((size_t)(Base->Buffer_Size-File_EndTagSize-32+8)))==2000)
+ ApeTag_Size+=32;
+ File_EndTagSize+=ApeTag_Size;
+ TagSizeIsFinal=false;
+ ApeTag_Offset=Base->File_Size-File_EndTagSize;
+ TagSizeIsFinal=false;
+ }
+ }
+
+ //Finished
+ return true;
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
diff --git a/src/thirdparty/MediaInfo/Tag/File__Tags.h b/src/thirdparty/MediaInfo/Tag/File__Tags.h
new file mode 100644
index 000000000..c8278d8b0
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Tag/File__Tags.h
@@ -0,0 +1,105 @@
+// File__Tags - Info for all kind of framed tags tagged files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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);
+ void Reject (const char* ParserName);
+ void Finish (const char* ParserName);
+
+private :
+ //Temp
+ File__Analyze* Parser;
+ File__Analyze* Parser_Streams_Fill; //Parser to merge when filling
+ 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
diff --git a/src/thirdparty/MediaInfo/Text/File_Cdp.cpp b/src/thirdparty/MediaInfo/Text/File_Cdp.cpp
new file mode 100644
index 000000000..a19011bbf
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_Cdp.cpp
@@ -0,0 +1,413 @@
+// File_Cdp - Info for EIA-608 files
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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;
+//---------------------------------------------------------------------------
+
+
+//***************************************************************************
+// 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;
+ }
+}
+
+//***************************************************************************
+//
+//***************************************************************************
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Cdp::File_Cdp()
+:File__Analyze()
+{
+ //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
+ AspectRatio=0;
+}
+
+//---------------------------------------------------------------------------
+File_Cdp::~File_Cdp()
+{
+ for (size_t Pos=0; Pos<Streams.size(); Pos++)
+ delete Streams[Pos]; //Streams[Pos]=NULL
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Cdp::Streams_Fill()
+{
+ //Filling
+ for (size_t Pos=0; Pos<Streams.size(); Pos++)
+ if (Streams[Pos] && Streams[Pos]->Parser && Streams[Pos]->Parser->Status[IsFilled])
+ {
+ Merge(*Streams[Pos]->Parser);
+ if (Pos<2)
+ Fill(Stream_Text, StreamPos_Last, Text_ID, _T("608-")+Ztring::ToZtring(Pos+1));
+ Fill(Stream_Text, StreamPos_Last, "MuxingMode", _T("CDP"), Unlimited);
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Cdp::Streams_Finish()
+{
+ //Filling
+ for (size_t Pos=0; Pos<Streams.size(); Pos++)
+ if (Streams[Pos] && Streams[Pos]->Parser && Streams[Pos]->Parser->Status[IsFilled])
+ Finish(Streams[Pos]->Parser);
+}
+
+//***************************************************************************
+// Buffer - Synchro
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Cdp::Read_Buffer_Unsynched()
+{
+ //Parsing
+ for (size_t Pos=0; Pos<Streams.size(); Pos++)
+ if (Streams[Pos] && Streams[Pos]->Parser)
+ Streams[Pos]->Parser->Open_Buffer_Unsynch();
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Cdp::Read_Buffer_Continue()
+{
+ if (!Status[IsAccepted])
+ Accept("CDP");
+
+ cdp_header();
+ while(Element_Offset<Element_Size)
+ {
+ int8u section_id;
+ Peek_L1(section_id);
+ switch (section_id)
+ {
+ case 0x71 : time_code_section(); break;
+ case 0x72 : ccdata_section(); break;
+ case 0x73 : ccsvcinfo_section(); break;
+ case 0x74 : cdp_footer(); break;
+ case 0xFF : Skip_B1("Padding?"); break;
+ default : if (section_id>=0x75 && section_id<=0xEF)
+ future_section();
+ else
+ Skip_XX(Element_Size-Element_Offset, "Unknown");
+ }
+ }
+}
+
+//***************************************************************************
+// Functions
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Cdp::cdp_header()
+{
+ Element_Begin("cdp_header");
+ int8u cdp_frame_rate;
+ Skip_B2( "cdp_identifier");
+ Skip_B1( "cdp_length");
+ BS_Begin();
+ Get_S1 (4, cdp_frame_rate, "cdp_frame_rate"); Param_Info(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_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Cdp::time_code_section()
+{
+ Element_Begin("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_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Cdp::ccdata_section()
+{
+ //Parsing
+ int8u cc_count;
+ Element_Begin("ccdata_section");
+ Skip_B1( "ccdata_id");
+ BS_Begin();
+ Mark_1();
+ Mark_1();
+ Mark_1();
+ Get_S1 (5, cc_count, "cc_count");
+ BS_End();
+ for (int8u Pos=0; Pos<cc_count; Pos++)
+ {
+ Element_Begin("cc");
+ int8u cc_type;
+ bool cc_valid;
+ BS_Begin();
+ Mark_1();
+ Mark_1();
+ Mark_1();
+ Mark_1();
+ Mark_1();
+ Get_SB ( cc_valid, "cc_valid");
+ Get_S1 (2, cc_type, "cc_type"); Param_Info(Cdp_cc_type(cc_type));
+ BS_End();
+ if (cc_valid)
+ {
+ Element_Begin("cc_data");
+ //Calculating the parser position
+ int8u Parser_Pos=cc_type==3?2:cc_type; //cc_type 2 and 3 are for the same text
+
+ //Parsing
+ #if MEDIAINFO_DEMUX
+ Element_Code=Parser_Pos;
+ #endif //MEDIAINFO_DEMUX
+ if (Streams[Parser_Pos]==NULL)
+ Streams[Parser_Pos]=new stream;
+ if (Streams[Parser_Pos]->Parser==NULL)
+ {
+ if (cc_type<2)
+ {
+ Streams[Parser_Pos]->Parser=new File_Eia608();
+ }
+ else
+ {
+ Streams[Parser_Pos]->Parser=new File_Eia708();
+ }
+ 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->PCR=PCR;
+ Streams[Parser_Pos]->Parser->PTS=PTS;
+ Streams[Parser_Pos]->Parser->DTS=DTS;
+ }
+ if (Parser_Pos==2)
+ {
+ ((File_Eia708*)Streams[2]->Parser)->cc_type=cc_type;
+ ((File_Eia708*)Streams[2]->Parser)->AspectRatio=AspectRatio;
+ }
+ else
+ {
+ }
+ 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_End();
+ }
+ else
+ Skip_XX(2, "Junk");
+ Element_End();
+ }
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Cdp::ccsvcinfo_section()
+{
+ //Parsing
+ int8u svc_count;
+ Element_Begin("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<svc_count; Pos++)
+ {
+ Element_Begin("svc");
+ bool csn_size;
+ BS_Begin();
+ Skip_SB( "reserved");
+ Get_SB ( csn_size, "csn_size");
+ if (csn_size)
+ {
+ Skip_SB( "reserved");
+ Skip_S1(5, "caption_service_number");
+ }
+ else
+ Skip_S1(6, "caption_service_number");
+ BS_End();
+
+ //svc_data_byte - caption_service_descriptor
+ Element_Begin("service");
+ Ztring language;
+ bool digital_cc;
+ Get_Local(3, language, "language");
+ BS_Begin();
+ Get_SB (digital_cc, "digital_cc");
+ Skip_SB( "reserved");
+ if (digital_cc) //line21
+ {
+ Skip_S1(5, "reserved");
+ Skip_SB( "line21_field");
+ }
+ else
+ Skip_S1(6, "caption_service_number");
+ Skip_SB( "easy_reader");
+ Skip_SB( "wide_aspect_ratio");
+ Skip_S2(14, "reserved");
+ BS_End();
+ Element_End();
+ Element_End();
+ }
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Cdp::cdp_footer()
+{
+ Element_Begin("cdp_footer");
+ Skip_B1( "cdp_footer_id");
+ Skip_B2( "cdp_ftr_sequence_cntr");
+ Skip_B1( "packet_checksum");
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Cdp::future_section()
+{
+ //Parsing
+ int8u length;
+ Element_Begin("future_section");
+ Skip_B1( "future_section_id");
+ Get_B1 (length, "length");
+ Skip_XX(length, "Unknown");
+ Element_End();
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_CDP_YES
diff --git a/src/thirdparty/MediaInfo/Text/File_Cdp.h b/src/thirdparty/MediaInfo/Text/File_Cdp.h
new file mode 100644
index 000000000..af96b1d18
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_Cdp.h
@@ -0,0 +1,93 @@
+// File_Cdp - Info for CDP files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Caption Distribution Packet files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_CdpH
+#define MediaInfo_File_CdpH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+using namespace std;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Cdp
+//***************************************************************************
+
+class File_Cdp : public File__Analyze
+{
+public :
+ //In
+ float32 AspectRatio;
+
+ //Constructor/Destructor
+ File_Cdp();
+ ~File_Cdp();
+
+private :
+ //Streams management
+ void Streams_Fill();
+ void Streams_Finish();
+
+ //Synchro
+ void Read_Buffer_Unsynched();
+
+ //Buffer - Global
+ void Read_Buffer_Continue();
+
+ //Elements
+ void cdp_header();
+ void time_code_section();
+ void ccdata_section();
+ void ccsvcinfo_section();
+ void cdp_footer();
+ void future_section();
+
+ //Stream
+ struct stream
+ {
+ File__Analyze* Parser;
+ bool IsFilled;
+
+ stream()
+ {
+ Parser=NULL;
+ IsFilled=false;
+ }
+
+ ~stream()
+ {
+ delete Parser; //Parser=NULL;
+ }
+ };
+ std::vector<stream*> Streams;
+ size_t Streams_Count;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Text/File_Cmml.cpp b/src/thirdparty/MediaInfo/Text/File_Cmml.cpp
new file mode 100644
index 000000000..151d348ec
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_Cmml.cpp
@@ -0,0 +1,118 @@
+// File_Cmml - Info for Cmml files
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Note : the buffer must be given in ONE call
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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("<head>"), _T("</head>"));
+ if (!Value.empty())
+ Fill(Stream_Text, 0, Text_Title, Value.SubString(_T("<title>"), _T("</title>")));
+ if (Data.find(_T("<clip"))!=string::npos)
+ Finish("CMML");
+ FILLING_END();
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_CMML_YES
diff --git a/src/thirdparty/MediaInfo/Text/File_Cmml.h b/src/thirdparty/MediaInfo/Text/File_Cmml.h
new file mode 100644
index 000000000..cfda51021
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_Cmml.h
@@ -0,0 +1,58 @@
+// File_Cmml - Info for Cmml files
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Cmml files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_CmmlH
+#define MediaInfo_File_CmmlH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Cmml
+//***************************************************************************
+
+class File_Cmml : public File__Analyze
+{
+private :
+ //Buffer - Per element
+ void Header_Parse();
+ void Data_Parse();
+
+ //Elements
+ void Identification();
+ void Configuration();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Text/File_DtvccTransport.cpp b/src/thirdparty/MediaInfo/Text/File_DtvccTransport.cpp
new file mode 100644
index 000000000..cc5913c90
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_DtvccTransport.cpp
@@ -0,0 +1,314 @@
+// File_DtvccTransport - Info for DTVCC Transport strams
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_DTVCCTRANSPORT_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Text/File_DtvccTransport.h"
+#if defined(MEDIAINFO_EIA608_YES)
+ #include "MediaInfo/Text/File_Eia608.h"
+#endif
+#if defined(MEDIAINFO_EIA708_YES)
+ #include "MediaInfo/Text/File_Eia708.h"
+#endif
+#if MEDIAINFO_EVENTS
+ #include "MediaInfo/MediaInfo_Events.h"
+#endif //MEDIAINFO_EVENTS
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+namespace MediaInfoLib
+{
+//---------------------------------------------------------------------------
+
+//***************************************************************************
+// Infos
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+const char* DtvccTransport_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 "";
+ }
+}
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_DtvccTransport::File_DtvccTransport()
+:File__Analyze()
+{
+ //Configuration
+ ParserName=_T("DTVCC Transport");
+ #if MEDIAINFO_EVENTS
+ ParserIDs[0]=MediaInfo_Parser_DtvccTransport;
+ StreamIDs_Width[0]=1;
+ #endif //MEDIAINFO_EVENTS
+ PTS_DTS_Needed=true;
+
+ //In
+ Format=Format_Unknown;
+ AspectRatio=0;
+
+ //Temp
+ Streams.resize(3); //CEA-608 Field 1, CEA-608 Field 2, CEA-708 Channel
+ Streams_Count=0;
+}
+
+//---------------------------------------------------------------------------
+File_DtvccTransport::~File_DtvccTransport()
+{
+ for (size_t Pos=0; Pos<Streams.size(); Pos++)
+ delete Streams[Pos]; //Streams[Pos]=NULL
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_DtvccTransport::Streams_Fill()
+{
+ //Filling
+ for (size_t Pos=0; Pos<Streams.size(); Pos++)
+ if (Streams[Pos] && Streams[Pos]->Parser && Streams[Pos]->Parser->Status[IsFilled])
+ {
+ Merge(*Streams[Pos]->Parser);
+ if (Pos<2)
+ Fill(Stream_Text, StreamPos_Last, Text_ID, (Format==Format_DVD?_T("DVD-"):_T("608-"))+Ztring::ToZtring(Pos+1));
+ Fill(Stream_Text, StreamPos_Last, "MuxingMode", Format==Format_DVD?_T("DVD-Video"):_T("EIA-708"));
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_DtvccTransport::Streams_Finish()
+{
+ //Filling
+ for (size_t Pos=0; Pos<Streams.size(); Pos++)
+ if (Streams[Pos] && Streams[Pos]->Parser && Streams[Pos]->Parser->Status[IsFilled])
+ Finish(Streams[Pos]->Parser);
+}
+
+//***************************************************************************
+// Buffer - Synchro
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_DtvccTransport::Read_Buffer_Unsynched()
+{
+ //Parsing
+ for (size_t Pos=0; Pos<Streams.size(); Pos++)
+ if (Streams[Pos] && Streams[Pos]->Parser)
+ Streams[Pos]->Parser->Open_Buffer_Unsynch();
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_DtvccTransport::Read_Buffer_Continue()
+{
+ //Parsing
+ Element_Begin(Format==Format_DVD?"DVD Captions":"DTVCC Transport");
+ int8u cc_count;
+ bool process_cc_data_flag, additional_data_flag;
+ BS_Begin();
+ if (Format==Format_DVD)
+ {
+ //Modified DTVCC Transport from DVD
+ Skip_SB( "field 1 then field 2");
+ Get_S1 (7, cc_count, "cc_count");
+ process_cc_data_flag=true;
+ additional_data_flag=false;
+ }
+ else
+ {
+ //Normal DTVCC Transport
+ bool process_em_data_flag;
+ Get_SB (process_em_data_flag, "process_em_data_flag");
+ Get_SB (process_cc_data_flag, "process_cc_data_flag");
+ Get_SB (additional_data_flag, "additional_data_flag");
+ Get_S1 (5, cc_count, "cc_count");
+ Skip_S1(8, process_em_data_flag?"em_data":"reserved"); //Emergency message
+ }
+ BS_End();
+ if (process_cc_data_flag)
+ {
+ for (int8u Pos=0; Pos<cc_count; Pos++)
+ {
+ Element_Begin("cc");
+ int8u cc_type;
+ bool cc_valid;
+ BS_Begin();
+ Mark_1();
+ Mark_1_NoTrustError();
+ Mark_1_NoTrustError();
+ Mark_1_NoTrustError();
+ Mark_1_NoTrustError();
+ if (Format==Format_DVD)
+ {
+ //Modified DTVCC Transport from DVD
+ Mark_1();
+ Mark_1();
+ Get_S1 (1, cc_type, "cc_type"); Param_Info(DtvccTransport_cc_type(cc_type));
+ cc_valid=true;
+ }
+ else
+ {
+ //Normal DTVCC Transport
+ Get_SB ( cc_valid, "cc_valid");
+ Get_S1 (2, cc_type, "cc_type"); Param_Info(DtvccTransport_cc_type(cc_type));
+ }
+ BS_End();
+ if (cc_valid)
+ {
+ Element_Begin("cc_data");
+ //Calculating the parser position
+ int8u Parser_Pos=cc_type==3?2:cc_type; //cc_type 2 and 3 are for the same text
+
+ //Parsing
+ #if MEDIAINFO_DEMUX
+ Element_Code=Parser_Pos;
+ #endif //MEDIAINFO_DEMUX
+ if (Streams[Parser_Pos]==NULL)
+ Streams[Parser_Pos]=new stream;
+ if (Streams[Parser_Pos]->Parser==NULL)
+ {
+ if (cc_type<2)
+ {
+ #if defined(MEDIAINFO_EIA608_YES)
+ Streams[Parser_Pos]->Parser=new File_Eia608();
+ #else
+ Streams[Parser_Pos]->Parser=new File__Analyze();
+ #endif
+ }
+ else
+ {
+ #if defined(MEDIAINFO_EIA708_YES)
+ Streams[Parser_Pos]->Parser=new File_Eia708();
+ #else
+ Streams[Parser_Pos]->Parser=new File__Analyze();
+ #endif
+ }
+ Open_Buffer_Init(Streams[Parser_Pos]->Parser);
+ }
+ Demux(Buffer+(size_t)(Buffer_Offset+Element_Offset), 2, ContentType_MainStream);
+ if (!Streams[Parser_Pos]->Parser->Status[IsFinished])
+ {
+ //Parsing
+ if (Streams[Parser_Pos]->Parser->PTS_DTS_Needed)
+ {
+ Streams[Parser_Pos]->Parser->PCR=PCR;
+ Streams[Parser_Pos]->Parser->PTS=PTS;
+ Streams[Parser_Pos]->Parser->DTS=DTS;
+ }
+ if (Parser_Pos==2)
+ {
+ #if defined(MEDIAINFO_EIA708_YES)
+ ((File_Eia708*)Streams[2]->Parser)->cc_type=cc_type;
+ ((File_Eia708*)Streams[2]->Parser)->AspectRatio=AspectRatio;
+ #endif
+ if (cc_type==3)
+ Streams[2]->Parser->Open_Buffer_Unsynch();
+ }
+ else
+ {
+ }
+ Open_Buffer_Continue(Streams[Parser_Pos]->Parser, Buffer+(size_t)(Buffer_Offset+Element_Offset), 2);
+ Element_Show();
+ Element_Offset+=2;
+
+ //Filled
+ if (!Streams[Parser_Pos]->IsFilled && Streams[Parser_Pos]->Parser->Status[IsFilled])
+ {
+ if (Count_Get(Stream_General)==0)
+ Accept("DTVCC Transport");
+ Streams_Count++;
+ if (Streams_Count==3)
+ Fill("DTVCC Transport");
+ Streams[Parser_Pos]->IsFilled=true;
+ }
+ }
+ else
+ Skip_XX(2, "Data");
+ Element_End();
+ }
+ else
+ Skip_XX(2, "Junk");
+ Element_End();
+ }
+ }
+ else
+ Skip_XX(cc_count*2, "Junk");
+
+ if (Format==Format_A53_4_GA94_03)
+ {
+ //Normal DTVCC Transport
+ BS_Begin();
+ Mark_1_NoTrustError();
+ Mark_1_NoTrustError();
+ Mark_1_NoTrustError();
+ Mark_1_NoTrustError();
+ Mark_1_NoTrustError();
+ Mark_1_NoTrustError();
+ Mark_1_NoTrustError();
+ Mark_1_NoTrustError();
+ BS_End();
+
+ if (additional_data_flag)
+ {
+ Skip_XX(Element_Size-Element_Offset, "additional_user_data");
+ }
+
+ while (Element_Offset<Element_Size)
+ {
+ Skip_B1( "Zero"); //TODO: test Zero
+ }
+ }
+
+ Element_End();
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_DTVCCTRANSPORT_YES
+
diff --git a/src/thirdparty/MediaInfo/Text/File_DtvccTransport.h b/src/thirdparty/MediaInfo/Text/File_DtvccTransport.h
new file mode 100644
index 000000000..76199ca81
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_DtvccTransport.h
@@ -0,0 +1,93 @@
+// File_DtvccTransport - Info for DTVCC Transport strams
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Bar Data files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_DtvccTransportH
+#define MediaInfo_DtvccTransportH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include <vector>
+//---------------------------------------------------------------------------
+
+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;
+ float32 AspectRatio;
+
+ //Constructor/Destructor
+ File_DtvccTransport();
+ ~File_DtvccTransport();
+
+private :
+ //Streams management
+ void Streams_Fill();
+ void Streams_Finish();
+
+ //Synchro
+ void Read_Buffer_Unsynched();
+
+ //Buffer - Global
+ void Read_Buffer_Continue();
+
+ //Temp
+ struct stream
+ {
+ File__Analyze* Parser;
+ bool IsFilled;
+
+ stream()
+ {
+ Parser=NULL;
+ IsFilled=false;
+ }
+
+ ~stream()
+ {
+ delete Parser; //Parser=NULL;
+ }
+ };
+ std::vector<stream*> Streams;
+ size_t Streams_Count;
+};
+
+} //NameSpace
+
+#endif
+
diff --git a/src/thirdparty/MediaInfo/Text/File_Eia608.cpp b/src/thirdparty/MediaInfo/Text/File_Eia608.cpp
new file mode 100644
index 000000000..e71a52b92
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_Eia608.cpp
@@ -0,0 +1,822 @@
+// File_Eia608 - Info for EIA-608 files
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_EIA608_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Text/File_Eia608.h"
+using namespace std;
+//---------------------------------------------------------------------------
+
+
+//***************************************************************************
+// Constants
+//***************************************************************************
+
+/* screen size -- specified by the standard */
+const int8u Eia608_Rows=15;
+const int8u Eia608_Columns=32;
+
+//---------------------------------------------------------------------------
+// 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
+ PTS_DTS_Needed=true;
+
+ //In
+
+ //Temp
+ TextMode=false;
+ DataChannelMode=false;
+ InBack=false;
+ CC_Displayed.resize(Eia608_Rows);
+ for (size_t Pos=0; Pos<CC_Displayed.size(); Pos++)
+ CC_Displayed[Pos].resize(Eia608_Columns);
+ CC_NonDisplayed.resize(Eia608_Rows);
+ for (size_t Pos=0; Pos<CC_NonDisplayed.size(); Pos++)
+ CC_NonDisplayed[Pos].resize(Eia608_Columns);
+ Text_Displayed.resize(Eia608_Rows);
+ for (size_t Pos=0; Pos<Text_Displayed.size(); Pos++)
+ Text_Displayed[Pos].resize(Eia608_Columns);
+ x=0;
+ y=Eia608_Rows-1;
+ Attribute_Current=0;
+ RollUpLines=0;
+ cc_data_1_Old=0x00;
+ cc_data_2_Old=0x00;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Eia608::Streams_Fill()
+{
+ Stream_Prepare(Stream_Text);
+ Fill(Stream_Text, 0, Text_Format, "EIA-608");
+ Fill(Stream_Text, 0, Text_StreamSize, 0);
+}
+
+//---------------------------------------------------------------------------
+void File_Eia608::Streams_Finish()
+{
+}
+
+//***************************************************************************
+// Buffer - Synchro
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Eia608::Read_Buffer_Unsynched()
+{
+ //Parsing
+ XDS_Data.clear();
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Eia608::Read_Buffer_Continue()
+{
+ 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
+ {
+ //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_Data.empty()) //XDS
+ {
+ TextMode=false; //This is CC
+ XDS_Data.push_back(cc_data_1);
+ XDS_Data.push_back(cc_data_2);
+ if (cc_data_1==0x0F)
+ XDS();
+ if (XDS_Data.size()>64)
+ XDS_Data.clear(); //This is a security
+ }
+ else if (cc_data_1>=0x20) //Basic characters
+ {
+ if (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()
+{
+ if (XDS_Data.size()<4)
+ {
+ XDS_Data.clear();
+ return; //There is a problem
+ }
+
+ switch (XDS_Data[0])
+ {
+ case 0x01 : XDS_Current(); break;
+ case 0x05 : XDS_Channel(); break;
+ case 0x09 : XDS_PublicService(); break;
+ default : ;
+ }
+
+ XDS_Data.clear();
+
+ //With have a point of synchro
+ if (!Synched)
+ Synched=true;
+}
+
+//---------------------------------------------------------------------------
+void File_Eia608::XDS_Current()
+{
+ switch (XDS_Data[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.size()!=6)
+ {
+ return; //There is a problem
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Eia608::XDS_Current_ProgramName()
+{
+ string ValueS;
+ for (size_t Pos=2; Pos<XDS_Data.size()-2; Pos++)
+ ValueS.append(1, (const char)(XDS_Data[Pos]));
+ Ztring Value;
+ Value.From_UTF8(ValueS.c_str());
+ Element_Info(_T("Program Name=")+Value);
+}
+
+//---------------------------------------------------------------------------
+void File_Eia608::XDS_Current_CopyAndRedistributionControlPacket()
+{
+ if (XDS_Data.size()!=6)
+ {
+ return; //There is a problem
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Eia608::XDS_Channel()
+{
+ switch (XDS_Data[1])
+ {
+ case 0x01 : XDS_Channel_NetworkName(); break;
+ default : ;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Eia608::XDS_Channel_NetworkName()
+{
+ string ValueS;
+ for (size_t Pos=2; Pos<XDS_Data.size()-2; Pos++)
+ ValueS.append(1, (const char)(XDS_Data[Pos]));
+ Ztring Value;
+ Value.From_UTF8(ValueS.c_str());
+ Element_Info(_T("Network Name=")+Value);
+}
+
+//---------------------------------------------------------------------------
+void File_Eia608::XDS_PublicService()
+{
+ switch (XDS_Data[1])
+ {
+ case 0x01 : XDS_PublicService_NationalWeatherService(); break;
+ default : ;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Eia608::XDS_PublicService_NationalWeatherService()
+{
+ if (XDS_Data.size()!=20)
+ {
+ return; //There is a problem
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Eia608::Special(int8u cc_data_1, int8u cc_data_2)
+{
+ //Data channel check
+ DataChannelMode=(cc_data_1&0x08)!=0; //bit3 is the Data Channel number
+ cc_data_1&=~0x08;
+
+ //Field check
+ cc_data_1&=~0x01;
+
+ if (cc_data_1>=0x10 && cc_data_1<=0x17 && cc_data_2>=0x40)
+ {
+ PreambleAddressCode(cc_data_1, cc_data_2);
+ }
+ else
+ {
+ switch (cc_data_1)
+ {
+ case 0x10 : Special_10(cc_data_2); break;
+ case 0x11 : Special_11(cc_data_2); break;
+ case 0x12 : Special_12(cc_data_2); break;
+ case 0x13 : Special_13(cc_data_2); break;
+ case 0x14 : Special_14(cc_data_2); break;
+ case 0x17 : Special_17(cc_data_2); break;
+ default : Illegal(cc_data_1, cc_data_2);
+ }
+ }
+
+ //Saving data, for repetition of the code
+ cc_data_1_Old=cc_data_1;
+ cc_data_2_Old=cc_data_2;
+
+ //With have a point of synchro
+ if (!Synched)
+ Synched=true;
+}
+
+//---------------------------------------------------------------------------
+void File_Eia608::PreambleAddressCode(int8u cc_data_1, int8u cc_data_2)
+{
+ //CEA-608-E, Section F.1.1.5
+
+ //Horizontal position
+ if (!TextMode)
+ {
+ y=Eia608_PAC_Row[cc_data_1&0x0F]+((cc_data_2&0x20)?1:0);
+ if (y>=Eia608_Rows)
+ {
+ y=Eia608_Rows-1;
+ }
+ }
+
+ //Attributes (except Underline)
+ if (cc_data_2&0x10) //0x5x and 0x7x
+ {
+ x=(cc_data_2&0x0E)<<1;
+ Attribute_Current=Attribute_Color_White;
+ }
+ else if ((cc_data_2&0x0E)==0x0E) //0x4E, 0x4F, 0x6E, 0x6F
+ {
+ Attribute_Current=Attribute_Color_White|Attribute_Italic;
+ }
+ else //0x40-0x4D, 0x60-0x6D
+ Attribute_Current=(cc_data_2&0x0E)>>1;
+
+ //Underline
+ if (cc_data_2&0x01)
+ Attribute_Current|=Attribute_Underline;
+}
+
+//---------------------------------------------------------------------------
+void File_Eia608::Special_10(int8u cc_data_2)
+{
+ switch (cc_data_2)
+ {
+ //CEA-608-E, Section 6.2
+ case 0x20 : break; //Background White, Opaque
+ case 0x21 : break; //Background White, Semi-transparent
+ case 0x22 : break; //
+ case 0x23 : break; //
+ case 0x24 : break; //
+ case 0x25 : break; //
+ case 0x26 : break; //
+ case 0x27 : break; //
+ case 0x28 : break; //
+ case 0x29 : break; //
+ case 0x2A : break; //
+ case 0x2B : break; //
+ case 0x2C : break; //
+ case 0x2D : break; //
+ case 0x2E : break; //
+ case 0x2F : break; //
+ default : Illegal(0x10, cc_data_2);
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Eia608::Special_11(int8u cc_data_2)
+{
+ switch (cc_data_2)
+ {
+ //CEA-608-E, Section F.1.1.3
+ case 0x20 : //White
+ case 0x21 : //White Underline
+ case 0x22 : //
+ case 0x23 : //
+ case 0x24 : //
+ case 0x25 : //
+ case 0x26 : //
+ case 0x27 : //
+ case 0x28 : //
+ case 0x29 : //
+ case 0x2A : //
+ case 0x2B : //
+ case 0x2C : //
+ case 0x2D : //
+ case 0x2E : //
+ case 0x2F : //
+ //Color or Italic
+ if ((cc_data_2&0xFE)==0x2E) //Italic
+ Attribute_Current|=Attribute_Italic;
+ else //Other attributes
+ Attribute_Current=(cc_data_2&0x0F)>>1;
+
+ //Underline
+ if (cc_data_2&0x01)
+ Attribute_Current|=Attribute_Underline;
+
+ break;
+ //CEA-608-E, Section F.1.1.1
+ case 0x30 : Character_Fill(L'\x2122'); break; //Registered mark symbol
+ case 0x31 : Character_Fill(L'\xB0' ); break; //Degree sign
+ case 0x32 : Character_Fill(L'\xBD' ); break; //1/2
+ case 0x33 : Character_Fill(L'\xBF' ); break; //interogation mark inverted
+ case 0x34 : Character_Fill(L'\xA9' ); break; //Trademark symbol
+ case 0x35 : Character_Fill(L'\xA2' ); break; //Cents sign
+ case 0x36 : Character_Fill(L'\xA3' ); break; //Pounds Sterling sign
+ case 0x37 : Character_Fill(L'\x266A'); break; //Music note
+ case 0x38 : Character_Fill(L'\xE0' ); break; //a grave
+ case 0x39 : Character_Fill(L' ' ); break; //Transparent space
+ case 0x3A : Character_Fill(L'\xE8' ); break; //e grave
+ case 0x3B : Character_Fill(L'\xE2' ); break; //a circumflex
+ case 0x3C : Character_Fill(L'\xEA' ); break; //e circumflex
+ case 0x3D : Character_Fill(L'\xEE' ); break; //i circumflex
+ case 0x3E : Character_Fill(L'\xF4' ); break; //o circumflex
+ case 0x3F : Character_Fill(L'\xFB' ); break; //u circumflex
+ default : Illegal(0x11, cc_data_2);
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Eia608::Special_12(int8u cc_data_2)
+{
+ switch (cc_data_2)
+ {
+ //CEA-608-E, Section 6.4.2
+ case 0x20 : Character_Fill(L'A' ); break; //A with acute
+ case 0x21 : Character_Fill(L'E' ); break; //E with acute
+ case 0x22 : Character_Fill(L'O' ); break; //O with acute
+ case 0x23 : Character_Fill(L'U' ); break; //U with acute
+ case 0x24 : Character_Fill(L'U' ); break; //U withdiaeresis or umlaut
+ case 0x25 : Character_Fill(L'u' ); break; //u with diaeresis or umlaut
+ case 0x26 : Character_Fill(L'\'' ); break; //opening single quote
+ case 0x27 : Character_Fill(L'!' ); break; //inverted exclamation mark
+ case 0x28 : Character_Fill(L'*' ); break; //Asterisk
+ case 0x29 : Character_Fill(L'\'' ); break; //plain single quote
+ case 0x2A : Character_Fill(L'_' ); break; //em dash
+ case 0x2B : Character_Fill(L'C' ); break; //Copyright
+ case 0x2C : Character_Fill(L'S' ); break; //Servicemark
+ case 0x2D : Character_Fill(L'x' ); break; //round bullet
+ case 0x2E : Character_Fill(L'\"' ); break; //opening double quotes
+ case 0x2F : Character_Fill(L'\"' ); break; //closing double quotes
+ case 0x30 : Character_Fill(L'A' ); break; //A with grave accent
+ case 0x31 : Character_Fill(L'A' ); break; //A with circumflex accent
+ case 0x32 : Character_Fill(L'C' ); break; //C with cedilla
+ case 0x33 : Character_Fill(L'E' ); break; //E with grave accent
+ case 0x34 : Character_Fill(L'E' ); break; //E with circumflex accent
+ case 0x35 : Character_Fill(L'E' ); break; //E with diaeresis or umlaut mark
+ case 0x36 : Character_Fill(L'e' ); break; //e with diaeresis or umlaut mark
+ case 0x37 : Character_Fill(L'I' ); break; //I with circumflex accent
+ case 0x38 : Character_Fill(L'I' ); break; //I with diaeresis or umlaut mark
+ case 0x39 : Character_Fill(L'i' ); break; //i with diaeresis or umlaut mark
+ case 0x3A : Character_Fill(L'O' ); break; //O with circumflex
+ case 0x3B : Character_Fill(L'U' ); break; //U with grave accent
+ case 0x3C : Character_Fill(L'u' ); break; //u with grave accent
+ case 0x3D : Character_Fill(L'U' ); break; //U with circumflex accent
+ case 0x3E : Character_Fill(L'\"' ); break; //opening guillemets
+ case 0x3F : Character_Fill(L'\"' ); break; //closing guillemets
+ default : Illegal(0x12, cc_data_2);
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Eia608::Special_13(int8u cc_data_2)
+{
+ 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)
+{
+ switch (cc_data_2)
+ {
+ case 0x20 : //RCL - Resume Caption Loading
+ case 0x25 : //RU2 - Roll-Up Captions–2 Rows
+ case 0x26 : //RU3 - Roll-Up Captions–3 Rows
+ case 0x27 : //RU4 - Roll-Up Captions–4 Rows
+ case 0x29 : //RDC - Resume Direct Captioning
+ case 0x2F : //EOC - End of Caption
+ TextMode=false; break; //This is CC
+ case 0x2A : //TR - Text Restart
+ case 0x2B : //RTD - Resume Text Display
+ TextMode=true; break; //This is Text
+ default: ;
+ }
+
+ switch (cc_data_2)
+ {
+ case 0x20 : TextMode=false;
+ InBack=true;
+ break; //RCL - Resume Caption Loading (Select pop-on style)
+ case 0x21 : if (x)
+ x--;
+ (InBack?CC_NonDisplayed:CC_Displayed)[y][x].Value=L' '; //Clear the character
+ if (!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=x; Pos<Eia608_Columns; Pos++)
+ (InBack?CC_NonDisplayed:CC_Displayed)[y][Pos].Value=L' '; //Clear up to the end of line
+ if (!InBack)
+ HasChanged();
+ break; //DER - Delete to End of Row
+ case 0x25 : //RU2 - Roll-Up Captions–2 Rows
+ case 0x26 : //RU3 - Roll-Up Captions–3 Rows
+ case 0x27 : //RU4 - Roll-Up Captions–4 Rows
+ RollUpLines=cc_data_2-0x25+2;
+ InBack=false;
+ break; //RUx - Roll-Up Captions–x Rows
+ case 0x28 : break; //FON - Flash On
+ case 0x29 : InBack=false;
+ break; //RDC - Resume Direct Captioning (paint-on style)
+ case 0x2A : TextMode=true;
+ RollUpLines=Eia608_Rows; //Roll up all the lines
+ y=Eia608_Rows-1; //Base is the bottom line
+ 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 :
+ for (size_t Pos_Y=0; Pos_Y<Eia608_Rows; Pos_Y++)
+ for (size_t Pos_X=0; Pos_X<Eia608_Columns; Pos_X++)
+ {
+ CC_Displayed[Pos_Y][Pos_X].Value=L' ';
+ CC_Displayed[Pos_Y][Pos_X].Attribute=0;
+ }
+ HasChanged();
+ break; //EDM - Erase Displayed Memory
+ case 0x2D : for (size_t Pos=1; Pos<RollUpLines; Pos++)
+ {
+ if (y>=RollUpLines-Pos && y-RollUpLines+Pos+1<Eia608_Rows)
+ {
+ if (TextMode)
+ Text_Displayed[y-RollUpLines+Pos]=Text_Displayed[y-RollUpLines+Pos+1];
+ else
+ CC_Displayed[y-RollUpLines+Pos]=CC_Displayed[y-RollUpLines+Pos+1];
+ }
+ }
+ for (size_t Pos_X=0; Pos_X<Eia608_Columns; Pos_X++)
+ {
+ if (TextMode)
+ {
+ Text_Displayed[y][Pos_X].Value=L' ';
+ Text_Displayed[y][Pos_X].Attribute=0;
+ }
+ else
+ {
+ CC_Displayed[y][Pos_X].Value=L' ';
+ CC_Displayed[y][Pos_X].Attribute=0;
+ }
+ }
+ if (!InBack)
+ HasChanged();
+ x=0;
+ break; //CR - Carriage Return
+ case 0x2E : for (size_t Pos_Y=0; Pos_Y<Eia608_Rows; Pos_Y++)
+ for (size_t Pos_X=0; Pos_X<Eia608_Columns; Pos_X++)
+ {
+ CC_NonDisplayed[Pos_Y][Pos_X].Value=L' ';
+ CC_NonDisplayed[Pos_Y][Pos_X].Attribute=0;
+ }
+ break; //ENM - Erase Non-Displayed Memory
+ case 0x2F : CC_Displayed.swap(CC_NonDisplayed);
+ HasChanged();
+ break; //EOC - End of Caption
+ default : Illegal(0x14, cc_data_2);
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Eia608::Special_17(int8u cc_data_2)
+{
+ switch (cc_data_2)
+ {
+ //CEA-608-E, section B.4
+ case 0x20 : //TO1 - Tab Offset 1 Column
+ case 0x21 : //TO2 - Tab Offset 2 Columns
+ case 0x22 : //TO3 - Tab Offset 3 Columns
+ x+=cc_data_2&0x03;
+ if (x>=Eia608_Columns)
+ 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)
+{
+ if (x==Eia608_Columns)
+ {
+ x--; //There is a problem
+
+ //TODO: Put it at the end, for the conversion
+ //TODO: Handle special chars
+ }
+
+ if (TextMode)
+ {
+ Text_Displayed[y][x].Value=Character;
+ }
+ else if (InBack)
+ {
+ CC_NonDisplayed[y][x].Value=Character;
+ }
+ else
+ {
+ CC_Displayed[y][x].Value=Character;
+ }
+
+ x++;
+
+ if (TextMode || !InBack)
+ HasChanged();
+
+ if (!Status[IsFilled]) //TODO: separate CC1/CC2/T1/T2
+ {
+ Fill("EIA-608");
+ if (MediaInfoLib::Config.ParseSpeed_Get()<1)
+ Finish("EIA-608");
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Eia608::HasChanged()
+{
+}
+
+//---------------------------------------------------------------------------
+void File_Eia608::Illegal(int8u cc_data_1, int8u cc_data_2)
+{
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_EIA608_YES
diff --git a/src/thirdparty/MediaInfo/Text/File_Eia608.h b/src/thirdparty/MediaInfo/Text/File_Eia608.h
new file mode 100644
index 000000000..298ca9734
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_Eia608.h
@@ -0,0 +1,129 @@
+// File_Eia608 - Info for EIA-608 files
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about PGS files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_Eia608H
+#define MediaInfo_File_Eia608H
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include <vector>
+#include <bitset>
+using namespace std;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Eia608
+//***************************************************************************
+
+class File_Eia608 : public File__Analyze
+{
+public :
+ //In
+
+ //Constructor/Destructor
+ File_Eia608();
+
+private :
+ //Streams management
+ void Streams_Fill();
+ void Streams_Finish();
+
+ //Synchro
+ void Read_Buffer_Unsynched();
+
+ //Buffer - Global
+ void Read_Buffer_Continue();
+
+ //Function
+ void Standard (int8u Character);
+
+ std::vector<int8u> XDS_Data;
+ bool TextMode; //CC or T
+ bool DataChannelMode; //if true, CC2/CC4/T2/T4
+ bool InBack; //The back buffer is written
+
+ 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);
+ vector<vector<character> > CC_Displayed;
+ vector<vector<character> > CC_NonDisplayed;
+ vector<vector<character> > Text_Displayed;
+ int8u Attribute_Current;
+
+ size_t x;
+ size_t y;
+ size_t RollUpLines;
+ int8u cc_data_1_Old;
+ int8u cc_data_2_Old;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Text/File_Eia708.cpp b/src/thirdparty/MediaInfo/Text/File_Eia708.cpp
new file mode 100644
index 000000000..b25db2200
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_Eia708.cpp
@@ -0,0 +1,1230 @@
+// File_Eia708 - Info for EIA-708 files
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_EIA708_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Text/File_Eia708.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Eia708::File_Eia708()
+:File__Analyze()
+{
+ //In
+ cc_type=(int8u)-1;
+ AspectRatio=((float32)4)/3; //Default to 4:3
+
+ //Stream
+ service_number=(int8u)-1;
+
+ //Temp
+ StandAloneCommand=false;
+}
+
+//---------------------------------------------------------------------------
+File_Eia708::~File_Eia708()
+{
+ for (size_t Pos=0; Pos<Streams.size(); Pos++)
+ delete Streams[Pos]; //Streams[Pos]=NULL
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Eia708::Streams_Fill()
+{
+ Stream_Prepare(Stream_Text);
+ Fill(Stream_Text, 0, Text_ID, 1); //TODO: fill with the exact service
+ Fill(Stream_Text, 0, Text_Format, "EIA-708");
+ Fill(Stream_Text, 0, Text_StreamSize, 0);
+}
+
+//---------------------------------------------------------------------------
+void File_Eia708::Streams_Finish()
+{
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Eia708::Read_Buffer_Continue()
+{
+ if (!Status[IsAccepted])
+ {
+ if (cc_type!=3)
+ {
+ Skip_B2( "Waiting for header");
+ return;
+ }
+
+ Accept("EIA-708");
+ }
+}
+
+//***************************************************************************
+// 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<Element_Size)
+ {
+ BS_Begin();
+ Get_S1(3, service_number, "service_number");
+ Get_S1(5, block_size, "block_size");
+ if (service_number==7)
+ {
+ Mark_0();
+ Mark_0();
+ Get_S1(6, service_number, "extended_service_number");
+ }
+ BS_End();
+
+ if (service_number)
+ {
+ Element_Begin("Service Block Packet", block_size);
+ Service();
+ Element_End();
+ }
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Eia708::Service()
+{
+ if (service_number>=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<block_size; Pos++)
+ {
+ int8u cc_data_1;
+ Get_B1(cc_data_1, "cc_data");
+ switch (cc_data_1)
+ {
+ //CEA-708-D, Section 7.1.4 (C0)
+ case 0x00 : NUL(); break; //NUL
+ case 0x03 : ETX(); break; //End Of Text
+ case 0x08 : BS(); break; //BackSpace
+ case 0x0C : FF(); break; //Form Feed
+ case 0x0D : CR(); break; //Carriage Return
+ case 0x0E : HCR(); break; //Horizontal Carriage Return
+ case 0x01 :
+ case 0x02 :
+ case 0x04 :
+ case 0x05 :
+ case 0x06 :
+ case 0x07 :
+ case 0x09 :
+ case 0x0A :
+ case 0x0B :
+ case 0x0F : break; //1-byte long undefined code
+ case 0x10 : //EXT1
+ {
+ int8u cc_data_2;
+ Get_B1(cc_data_2, "cc_data");
+ Pos++;
+ switch (cc_data_2)
+ {
+ //CEA-708-D, Section 7.1.8 (G2)
+ case 0x00 : Character_Fill(L' ' ); break;
+ case 0x01 : Character_Fill(L' ' ); break;
+ case 0x05 : Character_Fill(L'.' ); Character_Fill(L'.'); Character_Fill(L'.'); break;
+ case 0x0A : Character_Fill(L'S' ); break;
+ case 0x0C : Character_Fill(L'O' ); Character_Fill(L'E'); break;
+ case 0x30 : Character_Fill(L' ' ); break; //(Solid Block)
+ case 0x31 : Character_Fill(L'\'' ); break;
+ case 0x32 : Character_Fill(L'\'' ); break;
+ case 0x33 : Character_Fill(L'\'' ); break;
+ case 0x34 : Character_Fill(L'\'' ); break;
+ case 0x35 : Character_Fill(L'.' ); break;
+ case 0x39 : Character_Fill(L'_' ); break; //TM
+ case 0x3A : Character_Fill(L's' ); break;
+ case 0x3C : Character_Fill(L'_' ); break; //oe
+ case 0x3D : Character_Fill(L'_' ); break; //SM
+ case 0x3F : Character_Fill(L'Y' ); break;
+ case 0x76 : Character_Fill(L'_' ); break; //1/8
+ case 0x77 : Character_Fill(L'_' ); break; //3/8
+ case 0x78 : Character_Fill(L'_' ); break; //5/8
+ case 0x79 : Character_Fill(L'_' ); break; //7/8
+ case 0x7A : Character_Fill(L'+' ); 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'+' ); break;
+ //CEA-708-D, Section 7.1.9 (G3)
+ case 0x80 : Character_Fill(L'_' ); break; //(CC)
+ default :
+ //CEA-708-D, Section 7.1.10 (C2)
+ if (cc_data_2>=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.8 (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+=2; 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_Info("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_Info("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_Y<Window->row_count; Pos_Y++)
+ for (size_t Pos_X=0; Pos_X<Window->column_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_Y<Streams[service_number]->Minimal.CC.size() && Window->Minimal.Window_x+Pos_X<Streams[service_number]->Minimal.CC[Window->Minimal.Window_y+Window->Minimal.y].size())
+ Streams[service_number]->Minimal.CC[Window->Minimal.Window_y+Pos_Y][Window->Minimal.Window_x+Pos_X]=character();
+
+ //Has changed
+ Window_HasChanged();
+ HasChanged();
+ }
+ }
+
+ //SetPenLocation
+ Window->Minimal.x=0;
+ Window->Minimal.y=0;
+}
+
+//---------------------------------------------------------------------------
+//Carriage return
+void File_Eia708::CR()
+{
+ Param_Info("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_Y<Window->row_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_X<Window->column_count; Pos_X++)
+ Window->Minimal.CC[y][Pos_X]=character();
+
+ if (Window->visible)
+ {
+ //Updating global area
+ for (int8u Pos_Y=0; Pos_Y<Window->row_count; Pos_Y++)
+ for (int8u Pos_X=0; Pos_X<Window->column_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+Window->Minimal.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_Info("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_X<Window->column_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+y<(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_Info("SetCurrentWindow"); Param_Info(WindowID);
+
+ Streams[service_number]->WindowID=WindowID;
+}
+
+//---------------------------------------------------------------------------
+//ClearWindows
+void File_Eia708::CLW()
+{
+ Param_Info("ClearWindows");
+
+ int8u Save_WindowID=Streams[service_number]->WindowID;
+ bool Save_StandAloneCommand=StandAloneCommand;
+ StandAloneCommand=false;
+
+ Element_Begin("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_End();
+
+ Streams[service_number]->WindowID=Save_WindowID;
+ StandAloneCommand=Save_StandAloneCommand;
+
+ if (HasChanged_)
+ {
+ //Has changed
+ HasChanged();
+ }
+}
+
+//---------------------------------------------------------------------------
+//DisplayWindows
+void File_Eia708::DSW()
+{
+ Param_Info("DisplayWindows");
+
+ int8u Save_WindowID=Streams[service_number]->WindowID;
+ bool Save_StandAloneCommand=StandAloneCommand;
+ StandAloneCommand=false;
+
+ Element_Begin("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_Y<Window->row_count; Pos_Y++)
+ for (size_t Pos_X=0; Pos_X<Window->column_count; Pos_X++)
+ {
+ if (Window->Minimal.Window_y+Pos_Y<Streams[service_number]->Minimal.CC.size() && Window->Minimal.Window_x+Pos_X<Streams[service_number]->Minimal.CC[Window->Minimal.Window_y+Window->Minimal.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_End();
+
+ Streams[service_number]->WindowID=Save_WindowID;
+ StandAloneCommand=Save_StandAloneCommand;
+
+ if (HasChanged_)
+ {
+ //Has changed
+ HasChanged();
+ }
+}
+
+//---------------------------------------------------------------------------
+//HideWindows
+void File_Eia708::HDW()
+{
+ Param_Info("HideWindows");
+
+ int8u Save_WindowID=Streams[service_number]->WindowID;
+ bool Save_StandAloneCommand=StandAloneCommand;
+ StandAloneCommand=false;
+
+ Element_Begin("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_Y<Window->row_count; Pos_Y++)
+ for (size_t Pos_X=0; Pos_X<Window->column_count; Pos_X++)
+ {
+ //Clearing window
+ Window->Minimal.CC[Pos_Y][Pos_X]=character();
+
+ //Filling global area
+ if (Window->Minimal.Window_y+Pos_Y<Streams[service_number]->Minimal.CC.size() && Window->Minimal.Window_x+Pos_X<Streams[service_number]->Minimal.CC[Window->Minimal.Window_y+Window->Minimal.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_End();
+
+ Streams[service_number]->WindowID=Save_WindowID;
+ StandAloneCommand=Save_StandAloneCommand;
+
+ if (HasChanged_)
+ {
+ //Has changed
+ HasChanged();
+ }
+}
+
+//---------------------------------------------------------------------------
+//ToggleWindows
+void File_Eia708::TGW()
+{
+ Param_Info("ToggleWindows");
+
+ int8u Save_WindowID=Streams[service_number]->WindowID;
+ bool Save_StandAloneCommand=StandAloneCommand;
+ StandAloneCommand=false;
+
+ Element_Begin("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_Y<Window->row_count; Pos_Y++)
+ for (size_t Pos_X=0; Pos_X<Window->column_count; Pos_X++)
+ {
+ if (Window->Minimal.Window_y+Pos_Y<Streams[service_number]->Minimal.CC.size() && Window->Minimal.Window_x+Pos_X<Streams[service_number]->Minimal.CC[Window->Minimal.Window_y+Window->Minimal.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_End();
+
+ Streams[service_number]->WindowID=Save_WindowID;
+ StandAloneCommand=Save_StandAloneCommand;
+
+ if (HasChanged_)
+ {
+ //Has changed
+ HasChanged();
+ }
+}
+
+//---------------------------------------------------------------------------
+//DeleteWindows
+void File_Eia708::DLW()
+{
+ Param_Info("DeleteWindows");
+
+ int8u Save_WindowID=Streams[service_number]->WindowID;
+ bool Save_StandAloneCommand=StandAloneCommand;
+ StandAloneCommand=false;
+
+ Element_Begin("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());
+
+ if (IsSet)
+ {
+ window* Window=Streams[service_number]->Windows[WindowID];
+
+ if (Window && Window->visible)
+ {
+ //Filling global area
+ for (size_t Pos_Y=0; Pos_Y<Window->row_count; Pos_Y++)
+ for (size_t Pos_X=0; Pos_X<Window->column_count; Pos_X++)
+ {
+ //Clearing window
+ Window->Minimal.CC[Pos_Y][Pos_X]=character();
+
+ //Filling global area
+ if (Window->Minimal.Window_y+Pos_Y<Streams[service_number]->Minimal.CC.size() && Window->Minimal.Window_x+Pos_X<Streams[service_number]->Minimal.CC[Window->Minimal.Window_y+Window->Minimal.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_End();
+
+ Streams[service_number]->WindowID=Save_WindowID;
+ StandAloneCommand=Save_StandAloneCommand;
+
+ if (HasChanged_)
+ {
+ //Has changed
+ HasChanged();
+ }
+}
+
+//---------------------------------------------------------------------------
+//Delay
+void File_Eia708::DLY()
+{
+ Param_Info("Delay");
+ Element_Begin("Delay");
+ Skip_B1( "tenths of seconds");
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+//Delay Cancel
+void File_Eia708::DLC()
+{
+ Param_Info("Delay Cancel");
+}
+
+//---------------------------------------------------------------------------
+//Reset
+void File_Eia708::RST()
+{
+ //TODO: Should clear all buffers
+ Param_Info("Reset");
+}
+
+//---------------------------------------------------------------------------
+//Set Pen Attributes
+void File_Eia708::SPA()
+{
+ Param_Info("Set Pen Attributes");
+ Element_Begin("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_End();
+}
+
+//---------------------------------------------------------------------------
+//Set Pen Color
+void File_Eia708::SPC()
+{
+ Param_Info("Set Pen Color");
+ Element_Begin("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_End();
+}
+
+//---------------------------------------------------------------------------
+//SetPenLocation
+void File_Eia708::SPL()
+{
+ Param_Info("SetPenLocation");
+ Element_Begin("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_End();
+
+ 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
+
+ Window->Minimal.x=column;
+ Window->Minimal.y=row;
+}
+
+//---------------------------------------------------------------------------
+//SetWindowAttributes
+void File_Eia708::SWA()
+{
+ Param_Info("SetWindowAttributes");
+ Element_Begin("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();
+ Mark_0();
+ Skip_S1(2, "edge red");
+ Skip_S1(2, "edge green");
+ Skip_S1(2, "edge blue");
+ BS_End();
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+//DefineWindow
+void File_Eia708::DFx(int8u WindowID)
+{
+ Param_Info("DefineWindow"); Param_Info(WindowID);
+ Element_Begin("DefineWindow");
+ int8u anchor_vertical, anchor_horizontal, 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
+ Skip_S1(4, "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_End();
+
+ 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;
+ Window->Minimal.Window_y=anchor_vertical/5; //TODO: relative position
+ Window->anchor_horizontal=anchor_horizontal;
+ Window->Minimal.Window_x=anchor_horizontal/5; //TODO: relative position
+ Window->row_count=row_count+1;
+ Window->column_count=column_count+1;
+ Window->Minimal.x=0;
+ Window->Minimal.y=0;
+ Window->Minimal.CC.resize(row_count+1);
+ for (int8u Pos_Y=0; Pos_Y<row_count+1; Pos_Y++)
+ Window->Minimal.CC[Pos_Y].resize(column_count+1);
+}
+
+//***************************************************************************
+// Helpers
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Eia708::Character_Fill(wchar_t Character)
+{
+ Param_Info(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 (x<Window->column_count && y<Window->row_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
+ HasChanged();
+ }
+
+ x++;
+ Window->Minimal.x=x;
+ }
+
+ if (!Status[IsFilled]) //TODO: separate services
+ {
+ Fill("EIA-708");
+ if (MediaInfoLib::Config.ParseSpeed_Get()<1)
+ Finish("EIA-708");
+ }
+}
+
+//---------------------------------------------------------------------------
+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
diff --git a/src/thirdparty/MediaInfo/Text/File_Eia708.h b/src/thirdparty/MediaInfo/Text/File_Eia708.h
new file mode 100644
index 000000000..18f24adad
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_Eia708.h
@@ -0,0 +1,184 @@
+// File_Eia708 - Info for EIA-708 files
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about PGS files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_Eia708H
+#define MediaInfo_File_Eia708H
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include <vector>
+#include <string>
+using namespace std;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Eia708
+//***************************************************************************
+
+class File_Eia708 : public File__Analyze
+{
+public :
+ //In
+ int8u cc_type;
+ float32 AspectRatio;
+
+ //Constructor/Destructor
+ File_Eia708();
+ ~File_Eia708();
+
+private :
+ //Streams management
+ void Streams_Fill();
+ void Streams_Finish();
+
+ //Buffer - Global
+ void Read_Buffer_Continue();
+
+ //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<vector<character> > 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<window*> Windows;
+ struct data
+ {
+ vector<vector<character> > CC;
+ };
+ data Minimal;
+ int8u WindowID;
+
+ stream()
+ {
+ WindowID=(int8u)-1;
+ }
+
+ ~stream()
+ {
+ for (size_t Pos=0; Pos<Windows.size(); Pos++)
+ delete Windows[Pos]; //Windows[Pos]=NULL;
+ }
+ };
+ std::vector<stream*> Streams;
+ int8u service_number;
+ int8u block_size;
+
+ //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
diff --git a/src/thirdparty/MediaInfo/Text/File_Kate.cpp b/src/thirdparty/MediaInfo/Text/File_Kate.cpp
new file mode 100644
index 000000000..4ccc0bbfc
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_Kate.cpp
@@ -0,0 +1,154 @@
+// File_Kate - Info for Kate files
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Note : the buffer must be given in ONE call
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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
diff --git a/src/thirdparty/MediaInfo/Text/File_Kate.h b/src/thirdparty/MediaInfo/Text/File_Kate.h
new file mode 100644
index 000000000..74fef3752
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_Kate.h
@@ -0,0 +1,56 @@
+// File_Kate - Info for Kate files
+// Copyright (C) 2009-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Text/File_N19.cpp b/src/thirdparty/MediaInfo/Text/File_N19.cpp
new file mode 100644
index 000000000..95c6a7283
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_N19.cpp
@@ -0,0 +1,378 @@
+// File_N19 - Info for N19 files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_N19_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Text/File_N19.h"
+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 "";
+ }
+}
+
+//***************************************************************************
+// 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_Info(N19_CodePageNumber(CPN));
+ Get_C8 ( DFC, "DFC - Disk Format Code"); Param_Info(N19_DiskFormatCode_FrameRate(DFC));
+ Info_C1 ( DSC, "DSC - Display Standard Code"); Param_Info(N19_DisplayStandardCode(DSC));
+ Skip_C2 ( "CCT - Character Code Table number");
+ Get_C2 ( LC, "LC - Language Code"); Param_Info(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;
+ FILLING_END();
+}
+
+//***************************************************************************
+// 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_Info(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_Info(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);
+ }
+ if (File_Offset+Buffer_Offset+Element_Size+128>File_Size)
+ {
+ Fill(Stream_Text, 0, Text_Duration, TCO-FirstFrame_TCI);
+ }
+ else
+ //Jumping
+ GoToFromEnd(128, "N19");
+ FILLING_END();
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_N19_YES
diff --git a/src/thirdparty/MediaInfo/Text/File_N19.h b/src/thirdparty/MediaInfo/Text/File_N19.h
new file mode 100644
index 000000000..52e487a91
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_N19.h
@@ -0,0 +1,59 @@
+// File_N19 - Info for N19 files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about N19 files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_N19H
+#define MediaInfo_File_N19H
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_N19
+//***************************************************************************
+
+class File_N19 : public File__Analyze
+{
+private :
+ //Buffer - File header
+ bool FileHeader_Begin();
+ void FileHeader_Parse();
+
+ //Buffer - Per element
+ void Header_Parse();
+ void Data_Parse();
+
+ //Temp
+ int64u FirstFrame_TCI;
+ int64u DFC;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Text/File_OtherText.cpp b/src/thirdparty/MediaInfo/Text/File_OtherText.cpp
new file mode 100644
index 000000000..9ace0c43d
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_OtherText.cpp
@@ -0,0 +1,219 @@
+// File_OtherText - Use magic number to detect only the format (Text)
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_OTHERTEXT_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Text/File_OtherText.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Functions
+//***************************************************************************
+
+void File_OtherText::Read_Buffer_Continue()
+{
+ if (Buffer_Size<0x200)
+ return;
+
+ Ztring Format, FormatMore, Codec;
+ Ztring File;
+ ZtringList Lines;
+
+ //Feed File and Lines
+ File.From_Local((char*)Buffer, Buffer_Size); //Ansi
+ 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
+ if (File.find(_T("\x0D\x0A"))!=Error)
+ {
+ Lines.Separator_Set(0, _T("\x0D\x0A"));
+ Lines.Write(File);
+ }
+ else if (File.find(_T("\x0D"))!=Error)
+ {
+ Lines.Separator_Set(0, _T("\x0D"));
+ Lines.Write(File);
+ }
+ else if (File.find(_T("\x0A"))!=Error)
+ {
+ Lines.Separator_Set(0, _T("\x0A"));
+ Lines.Write(File);
+ }
+ else
+ {
+ Reject("Other text");
+ return;
+ }
+ if (Lines.size()<0x10)
+ {
+ Reject("Other text");
+ return;
+ }
+ Lines.resize(0x20);
+
+ if (Lines[0].size()==1
+ && Lines[0][0]==_T('1')
+ && Lines[1].size()==29
+ && Lines[1][ 0]==_T('0') && Lines[1][ 1]==_T('0')
+ && Lines[1][ 2]==_T(':') && Lines[1][ 5]==_T(':') && Lines[1][ 8]==_T(',')
+ && Lines[1][12]==_T(' ') && Lines[1][13]==_T('-') && Lines[1][14]==_T('-') && Lines[1][15]==_T('>') && Lines[1][16]==_T(' ')
+ && Lines[1][17]==_T('0') && Lines[1][18]==_T('0')
+ && Lines[1][19]==_T(':') && Lines[1][22]==_T(':') && Lines[1][25]==_T(',')
+ && Lines.Find(_T("2"))!=Error
+ )
+ {
+ Format=_T("SubRip");
+ Codec=_T("SubRip");
+ }
+ else if (Lines[0]==_T("[Script Info]")
+ && Lines.Find(_T("ScriptType: 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("[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 (false
+ )
+ {
+ }
+ 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_Begin(Format);
+ Element_End();
+ Finish("Other text");
+}
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Text/File_OtherText.h b/src/thirdparty/MediaInfo/Text/File_OtherText.h
new file mode 100644
index 000000000..b2edb2352
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_OtherText.h
@@ -0,0 +1,48 @@
+// File_OtherText - Use magic number to detect only the format (Text)
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Text/File_Pgs.cpp b/src/thirdparty/MediaInfo/Text/File_Pgs.cpp
new file mode 100644
index 000000000..b0565801e
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_Pgs.cpp
@@ -0,0 +1,63 @@
+// File_Pgs - Info for PGS files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_PGS_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Text/File_Pgs.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Pgs::Read_Buffer_Continue()
+{
+ //Filling
+ Accept("PGS");
+
+ Stream_Prepare(Stream_Text); //TODO: This is currenlty only text
+ Fill(Stream_Text, 0, Text_Format, "PGS");
+ Fill(Stream_Text, 0, Text_Codec, "PGS");
+
+ //No more need data
+ Finish("PGS");
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_PGS_YES
diff --git a/src/thirdparty/MediaInfo/Text/File_Pgs.h b/src/thirdparty/MediaInfo/Text/File_Pgs.h
new file mode 100644
index 000000000..45973d041
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_Pgs.h
@@ -0,0 +1,49 @@
+// File_Pgs - Info for PGS files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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 :
+ //Buffer - Global
+ void Read_Buffer_Continue();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Text/File_Scte20.cpp b/src/thirdparty/MediaInfo/Text/File_Scte20.cpp
new file mode 100644
index 000000000..76897c96f
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_Scte20.cpp
@@ -0,0 +1,263 @@
+// File_Scte20 - Info for SCTE 20 streams
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_SCTE20_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Text/File_Scte20.h"
+#if defined(MEDIAINFO_EIA608_YES)
+ #include "MediaInfo/Text/File_Eia608.h"
+#endif
+#if defined(MEDIAINFO_EIA708_YES)
+ #include "MediaInfo/Text/File_Eia708.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; Pos<Streams.size(); Pos++)
+ delete Streams[Pos]; //Streams[Pos]=NULL
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Scte20::Streams_Fill()
+{
+ //Filling
+ for (size_t Pos=0; Pos<Streams.size(); Pos++)
+ if (Streams[Pos] && Streams[Pos]->Parser && Streams[Pos]->Parser->Status[IsFilled])
+ {
+ Merge(*Streams[Pos]->Parser);
+ if (Pos<3)
+ Fill(Stream_Text, StreamPos_Last, Text_ID, _T("608-")+Ztring::ToZtring(Pos+1));
+ Fill(Stream_Text, StreamPos_Last, "MuxingMode", _T("SCTE 20"));
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Scte20::Streams_Finish()
+{
+ //Filling
+ for (size_t Pos=0; Pos<Streams.size(); Pos++)
+ if (Streams[Pos] && Streams[Pos]->Parser && Streams[Pos]->Parser->Status[IsFilled])
+ Finish(Streams[Pos]->Parser);
+}
+
+//***************************************************************************
+// Buffer - Synchro
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Scte20::Read_Buffer_Unsynched()
+{
+ //Parsing
+ for (size_t Pos=0; Pos<Streams.size(); Pos++)
+ if (Streams[Pos] && Streams[Pos]->Parser)
+ 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_Begin("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; Pos<cc_count; Pos++)
+ {
+ Element_Begin("cc");
+ int8u cc_data[2];
+ int8u field_number, cc_data_1, cc_data_2;
+ Skip_S1(2, "cc_priority");
+ Get_S1 (2, field_number, "field_number"); Param_Info(Scte20_field_number(field_number));
+ Skip_S1(5, "line_offset");
+ Get_S1 (8, cc_data_1, "cc_data_1");
+ cc_data[0]=ReverseBits(cc_data_1);
+ Param_Info(Ztring::ToZtring(cc_data[0], 16));
+ Get_S1 (8, cc_data_2, "cc_data_2");
+ cc_data[1]=ReverseBits(cc_data_2);
+ Param_Info(Ztring::ToZtring(cc_data[1], 16));
+ Mark_1_NoTrustError();
+ if (field_number!=0 && picture_structure!=(int8u)-1 && picture_structure!=0)
+ {
+ Element_Begin("cc_data");
+
+ //Finding the corresponding cc_type (CEA-608 1st field or 2nd field)
+ int8u cc_type;
+ if (progressive_sequence)
+ cc_type=0;
+ else if (picture_structure!=3)
+ cc_type=picture_structure-1;
+ else if (field_number==2)
+ cc_type=top_field_first?1:0;
+ else //if (field_number==1 || field_number==3)
+ cc_type=top_field_first?0:1;
+
+ //Parsing
+ #if MEDIAINFO_DEMUX
+ Element_Code=cc_type;
+ #endif //MEDIAINFO_DEMUX
+ if (Streams[cc_type]==NULL)
+ Streams[cc_type]=new stream;
+ if (Streams[cc_type]->Parser==NULL)
+ {
+ Streams[cc_type]->Parser=new File_Eia608();
+ 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->PCR=PCR;
+ Streams[cc_type]->Parser->PTS=PTS;
+ Streams[cc_type]->Parser->DTS=DTS;
+ }
+ Open_Buffer_Continue(Streams[cc_type]->Parser, cc_data, 2);
+ Element_Show();
+
+ //Filled
+ if (!Streams[cc_type]->IsFilled && Streams[cc_type]->Parser->Status[IsFilled])
+ {
+ if (Count_Get(Stream_General)==0)
+ Accept("SCTE 20");
+ Streams_Count++;
+ if (Streams_Count==3)
+ Fill("SCTE 20");
+ Streams[cc_type]->IsFilled=true;
+ }
+ }
+ else
+ Skip_XX(2, "Data");
+ Element_End();
+ }
+ Element_End();
+ }
+ }
+ 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_End();
+ Element_Show();
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_SCTE20_YES
+
diff --git a/src/thirdparty/MediaInfo/Text/File_Scte20.h b/src/thirdparty/MediaInfo/Text/File_Scte20.h
new file mode 100644
index 000000000..2dcf034f8
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Text/File_Scte20.h
@@ -0,0 +1,90 @@
+// File_Scte20 - Info for SCTE 20 streams
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about SCTE 20 streams
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_Scte20H
+#define MediaInfo_Scte20H
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include <vector>
+//---------------------------------------------------------------------------
+
+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_Fill();
+ void Streams_Finish();
+
+ //Synchro
+ void Read_Buffer_Unsynched();
+
+ //Buffer - Global
+ void Read_Buffer_Continue();
+
+ //Temp
+ struct stream
+ {
+ File__Analyze* Parser;
+ bool IsFilled;
+
+ stream()
+ {
+ Parser=NULL;
+ IsFilled=false;
+ }
+
+ ~stream()
+ {
+ delete Parser; //Parser=NULL;
+ }
+ };
+ std::vector<stream*> Streams;
+ size_t Streams_Count;
+};
+
+} //NameSpace
+
+#endif
+
diff --git a/src/thirdparty/MediaInfo/Video/File_Afd.cpp b/src/thirdparty/MediaInfo/Video/File_Afd.cpp
new file mode 100644
index 000000000..bb687c9f6
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Afd.cpp
@@ -0,0 +1,130 @@
+// File_Afd - Info for AFD files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_AFD_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Video/File_Afd.h"
+
+//---------------------------------------------------------------------------
+namespace MediaInfoLib
+{
+//---------------------------------------------------------------------------
+
+//***************************************************************************
+// Infos
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+const char* Afd_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",
+};
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Afd::File_Afd()
+:File__Analyze()
+{
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Afd::Streams_Fill()
+{
+ //Filling
+ Stream_Prepare(Stream_Video);
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Afd::Read_Buffer_Continue()
+{
+ if (!Status[IsAccepted])
+ Accept("AFD");
+
+ //Parsing
+ Element_Begin("Active Format Description");
+ bool active_format_flag;
+ int8u active_format;
+ 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();
+ Get_S1 (4, active_format, "active_format"); Param_Info(Afd_active_format[active_format]);
+ }
+ else
+ active_format=0;
+ BS_End();
+ Element_End();
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_AFD_YES
diff --git a/src/thirdparty/MediaInfo/Video/File_Afd.h b/src/thirdparty/MediaInfo/Video/File_Afd.h
new file mode 100644
index 000000000..a3c3378d7
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Afd.h
@@ -0,0 +1,71 @@
+// File_Afd - Info for AFD files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Active Format Description files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_AfdH
+#define MediaInfo_AfdH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Afd
+//***************************************************************************
+
+class File_Afd : public File__Analyze
+{
+public :
+ //In
+
+ //Constructor/Destructor
+ File_Afd();
+
+private :
+ //Streams management
+ void Streams_Fill();
+
+ //Buffer - Global
+ void Read_Buffer_Continue();
+
+ //Sream
+ struct stream
+ {
+ int8u active_format;
+
+ stream()
+ {
+ active_format=0;
+ }
+ };
+ stream Stream;
+};
+
+} //NameSpace
+
+#endif
+
diff --git a/src/thirdparty/MediaInfo/Video/File_AfdBarData.cpp b/src/thirdparty/MediaInfo/Video/File_AfdBarData.cpp
new file mode 100644
index 000000000..3631617eb
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_AfdBarData.cpp
@@ -0,0 +1,276 @@
+// File_AfdBarData - Info for Bar Data Video files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_AFDBARDATA_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Video/File_AfdBarData.h"
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+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_aspect_ratio[]=
+{
+ "4:3",
+ "16:9",
+};
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_AfdBarData::File_AfdBarData()
+:File__Analyze()
+{
+ //In
+ Format=Format_Unknown;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_AfdBarData::Streams_Fill()
+{
+ //Filling
+ Stream_Prepare(Stream_Video);
+}
+
+//***************************************************************************
+// 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[IsFilled])
+ Fill("AfdBarData");
+ if (MediaInfoLib::Config.ParseSpeed_Get()<1)
+ Finish("AfdBarData");
+ FILLING_END();
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_AfdBarData::afd_data()
+{
+ //Parsing
+ Element_Begin("Active Format Description");
+ BS_Begin();
+ if (Format==Format_S2016_3)
+ {
+ Mark_0_NoTrustError();
+ Get_S1 (4, active_format, "active_format"); Param_Info(AfdBarData_active_format[active_format]);
+ Get_S1 (1, aspect_ratio, "aspect_ratio"); Param_Info(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_Info(AfdBarData_active_format[active_format]);
+ }
+ }
+ BS_End();
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_AfdBarData::bar_data()
+{
+ //Parsing
+ Element_Begin("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();
+ Mark_1();
+ Skip_S2(14, "reserved");
+ Mark_1();
+ Mark_1();
+ Skip_S2(14, "reserved");
+ }
+ BS_End();
+ Element_End();
+
+ 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
+
diff --git a/src/thirdparty/MediaInfo/Video/File_AfdBarData.h b/src/thirdparty/MediaInfo/Video/File_AfdBarData.h
new file mode 100644
index 000000000..f921a9f11
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_AfdBarData.h
@@ -0,0 +1,101 @@
+// File_AfdBarData - Info for Bar Data Video files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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;
+
+ //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
+
diff --git a/src/thirdparty/MediaInfo/Video/File_Avc.cpp b/src/thirdparty/MediaInfo/Video/File_Avc.cpp
new file mode 100644
index 000000000..b49e1ab5a
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Avc.cpp
@@ -0,0 +1,2541 @@
+// File_Avc - Info for AVC Video files
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//***************************************************************************
+// 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"
+#include <cstring>
+#include <cmath>
+#if defined(MEDIAINFO_EIA608_YES)
+ #include "MediaInfo/Text/File_Eia608.h"
+#endif
+#if defined(MEDIAINFO_EIA708_YES)
+ #include "MediaInfo/Text/File_Eia708.h"
+#endif
+#if MEDIAINFO_EVENTS
+ #include "MediaInfo/MediaInfo_Events.h"
+#endif //MEDIAINFO_EVENTS
+using namespace std;
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Infos
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+const size_t Avc_Errors_MaxCount=32;
+
+//---------------------------------------------------------------------------
+const int8u Avc_PixelAspectRatio_Size=17;
+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,
+};
+
+//---------------------------------------------------------------------------
+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* Avc_colour_primaries(int8u colour_primaries)
+{
+ switch (colour_primaries)
+ {
+ case 1 : return "BT.709-5, BT.1361, IEC 61966-2-4, SMPTE RP177";
+ case 4 : return "BT.470-6 system M, NTSC, FTC 73.682";
+ case 5 : return "BT.470-6 System B, BT.470-6 System G, BT.601-6 625, BT.1358 625, BT.1700 625 PAL, BT.1700 625 SECAM";
+ case 6 : return "BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M";
+ case 7 : return "SMPTE 240M";
+ case 8 : return "Generic film";
+ default : return "";
+ }
+}
+
+//---------------------------------------------------------------------------
+const char* Avc_transfer_characteristics(int8u transfer_characteristics)
+{
+ switch (transfer_characteristics)
+ {
+ case 1 : return "BT.709-5, BT.1361";
+ case 4 : return "BT.470-6 System M, NTSC, FTC 73.682, BT.1700 625 PAL, BT.1700 625 SECAM";
+ case 5 : return "BT.470-6 System B, BT.470-6 System G";
+ case 6 : return "BT.601-6 525, BT.601-6 625, BT.1358 525, BT.1358 625, BT.1700 NTSC, SMPTE 170M";
+ case 7 : return "SMPTE 240M";
+ case 8 : return "Linear";
+ case 9 : return "Logarithmic (100:1)";
+ case 10 : return "Logarithmic (316.22777:1)";
+ case 11 : return "IEC 61966-2-4";
+ case 12 : return "BT.1361 extended colour gamut system";
+ default : return "";
+ }
+}
+
+//---------------------------------------------------------------------------
+const char* Avc_matrix_coefficients(int8u matrix_coefficients)
+{
+ switch (matrix_coefficients)
+ {
+ case 0 : return "RGB";
+ case 1 : return "BT.709-5, BT.1361, IEC 61966-2-4 709, SMPTE RP177";
+ case 4 : return "FTC 73.682";
+ case 5 : return "BT.470-6 System B, BT.470-6 System G, BT.601-6 625, BT.1358 625, BT.1700 625 PAL, BT.1700 625 SECAM, IEC 61966-2-4 601";
+ case 6 : return "BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M";
+ case 7 : return "SMPTE 240M";
+ case 8 : return "YCgCo";
+ default : return "";
+ }
+}
+
+//---------------------------------------------------------------------------
+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 "";
+ }
+}
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Avc::File_Avc()
+:File__Duplicate()
+{
+ //Config
+ #if MEDIAINFO_EVENTS
+ ParserIDs[0]=MediaInfo_Parser_Avc;
+ StreamIDs_Width[0]=0;
+ #endif //MEDIAINFO_EVENTS
+ MustSynchronize=true;
+ Buffer_TotalBytes_FirstSynched_Max=64*1024;
+ PTS_DTS_Needed=true;
+ IsRawStream=true;
+
+ //In
+ Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.3?64:2; //Currently no 3:2 pulldown detection
+ FrameIsAlwaysComplete=false;
+ MustParse_SPS_PPS=false;
+ MustParse_SPS_PPS_Only=false;
+ MustParse_SPS_PPS_Done=false;
+ SizedBlocks=false;
+
+ //Temp
+ SizeOfNALU_Minus1=(int8u)-1;
+ SPS_IsParsed=false;
+ PPS_IsParsed=false;
+}
+
+//---------------------------------------------------------------------------
+File_Avc::~File_Avc()
+{
+ for (size_t Pos=0; Pos<GA94_03_CC_Parsers.size(); Pos++)
+ delete GA94_03_CC_Parsers[Pos]; //GA94_03_CC_Parsers[Pos]=NULL;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Avc::Streams_Fill()
+{
+ //Calculating - Pixels
+ int32u Width =(pic_width_in_mbs_minus1 +1)*16;
+ int32u Height=(pic_height_in_map_units_minus1+1)*16*(2-frame_mbs_only_flag);
+ int32u CropUnitX=Avc_SubWidthC [chroma_format_idc];
+ int32u CropUnitY=Avc_SubHeightC[chroma_format_idc]*(2-frame_mbs_only_flag);
+ Width -=(frame_crop_left_offset+frame_crop_right_offset )*CropUnitX;
+ Height-=(frame_crop_top_offset +frame_crop_bottom_offset)*CropUnitY;
+
+ //Calculating - PixelAspectRatio
+ float32 PixelAspectRatio;
+ if (aspect_ratio_idc<Avc_PixelAspectRatio_Size)
+ PixelAspectRatio=Avc_PixelAspectRatio[aspect_ratio_idc];
+ else if (sar_height)
+ PixelAspectRatio=((float)sar_width)/sar_height;
+ else
+ PixelAspectRatio=1; //Unknown
+
+ if (Count_Get(Stream_Video)==0)
+ Stream_Prepare(Stream_Video);
+ Fill(Stream_Video, 0, Video_Format, "AVC");
+ Fill(Stream_Video, 0, Video_Codec, "AVC");
+
+ if (!subset_seq_parameter_set_ids.empty())
+ {
+ std::map<int32u, seq_parameter_set_>::iterator subset_seq_parameter_set_id=subset_seq_parameter_set_ids.begin(); //Currently, only 1 SPS is supported
+ Ztring Profile=Ztring().From_Local(Avc_profile_idc(subset_seq_parameter_set_id->second.profile_idc))+_T("@L")+Ztring().From_Number(((float)subset_seq_parameter_set_id->second.level_idc)/10, 1);
+ Fill(Stream_Video, 0, Video_Format_Profile, Profile);
+ Fill(Stream_Video, 0, Video_MultiView_Count, num_views_minus1+1);
+ }
+ if (!seq_parameter_set_ids.empty())
+ {
+ std::map<int32u, seq_parameter_set_>::iterator seq_parameter_set_id=seq_parameter_set_ids.begin(); //Currently, only 1 SPS is supported
+ Ztring Profile=Ztring().From_Local(Avc_profile_idc(seq_parameter_set_id->second.profile_idc))+_T("@L")+Ztring().From_Number(((float)seq_parameter_set_id->second.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_Standard, Avc_video_format[video_format]);
+ Fill(Stream_Video, 0, Video_PixelAspectRatio, PixelAspectRatio, 3, true);
+ Fill(Stream_Video, 0, Video_DisplayAspectRatio, Width*PixelAspectRatio/Height, 3, true); //More precise
+ if (timing_info_present_flag)
+ {
+ if (!fixed_frame_rate_flag)
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate_Mode, "VFR");
+ else if (time_scale && num_units_in_tick)
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate, (float)time_scale/num_units_in_tick/(pic_order_cnt_type==2?1:2)/FrameRate_Divider);
+ }
+ 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");
+ }
+ Fill(Stream_Video, 0, Video_Colorimetry, Avc_Colorimetry_format_idc[chroma_format_idc]);
+
+ //Interlacement
+ if (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 (frame_mbs_only_flag || Structure_Field==0) //No interlaced frame
+ {
+ Fill(Stream_Video, 0, Video_ScanType, "Progressive");
+ Fill(Stream_Video, 0, Video_Interlacement, "PPF");
+ }
+ else
+ {
+ Fill(Stream_Video, 0, Video_ScanType, "Interlaced");
+ Fill(Stream_Video, 0, Video_Interlacement, "Interlaced");
+ }
+ std::string TempRef, CodingType;
+ for (size_t Pos=0; Pos<TemporalReference.size(); Pos++)
+ if (TemporalReference[Pos].IsValid)
+ {
+ TempRef+=TemporalReference[Pos].IsTop?"T":"B";
+ CodingType+=Avc_slice_type[TemporalReference[Pos].slice_type];
+ }
+ if (TempRef.find("TBTBTBTB")==0)
+ {
+ Fill(Stream_Video, 0, Video_ScanOrder, "TFF");
+ Fill(Stream_Video, 0, Video_Interlacement, "TFF", Unlimited, true, true);
+ }
+ if (TempRef.find("BTBTBTBT")==0)
+ {
+ Fill(Stream_Video, 0, Video_ScanOrder, "BFF");
+ Fill(Stream_Video, 0, Video_Interlacement, "BFF", Unlimited, true, true);
+ }
+
+ //GOP
+ std::vector<Ztring> GOPs;
+ size_t GOP_Frame_Count=0;
+ size_t GOP_BFrames_Max=0;
+ size_t I_Pos1=CodingType.find(_T('I'));
+ while (I_Pos1!=std::string::npos)
+ {
+ size_t I_Pos2=CodingType.find(_T('I'), I_Pos1+1);
+ if (I_Pos2!=std::string::npos)
+ {
+ std::vector<size_t> P_Positions;
+ size_t P_Position=I_Pos1;
+ do
+ {
+ P_Position=CodingType.find(_T('P'), P_Position+1);
+ if (P_Position<I_Pos2)
+ P_Positions.push_back(P_Position);
+ }
+ while (P_Position<I_Pos2);
+ Ztring GOP;
+ if (!P_Positions.empty())
+ {
+ GOP+=_T("M=")+Ztring::ToZtring(P_Positions[0]-I_Pos1)+_T(", ");
+ if (P_Positions[0]-I_Pos1>GOP_BFrames_Max)
+ GOP_BFrames_Max=P_Positions[0]-I_Pos1;
+ }
+ GOP+=_T("N=")+Ztring::ToZtring(I_Pos2-I_Pos1);
+ GOPs.push_back(GOP);
+ GOP_Frame_Count+=I_Pos2-I_Pos1;
+ }
+ I_Pos1=I_Pos2;
+ }
+
+ 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.empty())
+ {
+ size_t Unique=0;
+ for (size_t Pos=1; Pos<GOPs.size(); Pos++)
+ if (GOPs[Pos]!=GOPs[0])
+ Unique++;
+ if ((Frame_Count<Frame_Count_Valid*10 && Unique) || Unique>2) //In order to accept some unsynch //TODO: change the method, synching with next I-Frame
+ GOPs.clear(); //Not a fixed GOP
+ }
+ if (!GOPs.empty())
+ Fill(Stream_Video, 0, Video_Format_Settings_GOP, GOPs[0]);
+ else if (CodingType.size()==1 && Frame_Count>1)
+ Fill(Stream_Video, 0, Video_Format_Settings_GOP, "N=1"); //Only I-Frames, pic_order_cnt_lsb is always 0
+
+ /*
+ if (frame_mbs_only_flag)
+ {
+ Fill(Stream_Video, 0, Video_ScanType, "Progressive");
+ Fill(Stream_Video, 0, Video_Interlacement, "PPF");
+ }
+ if (pic_struct_FirstDetected==1)
+ {
+ Fill(Stream_Video, 0, Video_ScanType, "Interlaced");
+ Fill(Stream_Video, 0, Video_ScanOrder, "TFF");
+ Fill(Stream_Video, 0, Video_Interlacement, "TFF");
+ }
+ if (pic_struct_FirstDetected==2)
+ {
+ Fill(Stream_Video, 0, Video_ScanType, "Interlaced");
+ Fill(Stream_Video, 0, Video_ScanOrder, "BFF");
+ Fill(Stream_Video, 0, Video_Interlacement, "BFF");
+ }
+ */
+ 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);
+ if (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");
+ }
+ if (max_num_ref_frames>0)
+ {
+ Fill(Stream_Video, 0, Video_Format_Settings, Ztring::ToZtring(max_num_ref_frames)+_T(" Ref Frames"));
+ Fill(Stream_Video, 0, Video_Codec_Settings, Ztring::ToZtring(max_num_ref_frames)+_T(" Ref Frames"));
+ }
+ if (max_num_ref_frames)
+ {
+ Fill(Stream_Video, 0, Video_Format_Settings_RefFrames, max_num_ref_frames);
+ Fill(Stream_Video, 0, Video_Codec_Settings_RefFrames, max_num_ref_frames);
+ }
+ Fill(Stream_Video, 0, Video_ColorSpace, "YUV");
+ if (bit_depth_luma_minus8==bit_depth_chroma_minus8)
+ Fill(Stream_Video, 0, Video_Resolution, bit_depth_luma_minus8+8);
+
+ //Colour description
+ Fill(Stream_Video, 0, "colour_primaries", Avc_colour_primaries(colour_primaries));
+ Fill(Stream_Video, 0, "transfer_characteristics", Avc_transfer_characteristics(transfer_characteristics));
+ Fill(Stream_Video, 0, "matrix_coefficients", Avc_matrix_coefficients(matrix_coefficients));
+
+ if (File_Offset+Buffer_Size<File_Size)
+ {
+ NextCode_Clear();
+
+ //Autorisation of other streams
+ for (int8u Pos=0x00; Pos<0x20; Pos++)
+ Streams[Pos].Searching_Payload=false; //Coded slice...
+ }
+
+ //Buffer
+ if (!MustParse_SPS_PPS_Done)
+ {
+ int32u bit_rate_value=0;
+ bool bit_rate_value_IsValid=true;
+ bool cbr_flag=false;
+ bool cbr_flag_IsSet=false;
+ bool cbr_flag_IsValid=true;
+ for (size_t Pos=0; Pos<NAL.size(); Pos++)
+ {
+ Fill(Stream_Video, 0, Video_BufferSize, NAL[Pos].cpb_size_value);
+ if (bit_rate_value && bit_rate_value!=NAL[Pos].bit_rate_value)
+ bit_rate_value_IsValid=false;
+ if (bit_rate_value==0)
+ bit_rate_value=NAL[Pos].bit_rate_value;
+ if (cbr_flag_IsSet==true && cbr_flag!=NAL[Pos].cbr_flag)
+ cbr_flag_IsValid=false;
+ if (cbr_flag_IsSet==0)
+ {
+ cbr_flag=NAL[Pos].cbr_flag;
+ cbr_flag_IsSet=true;
+ }
+ }
+ for (size_t Pos=0; Pos<VCL.size(); Pos++)
+ {
+ Fill(Stream_Video, 0, Video_BufferSize, VCL[Pos].cpb_size_value);
+ if (bit_rate_value && bit_rate_value!=VCL[Pos].bit_rate_value)
+ bit_rate_value_IsValid=false;
+ if (bit_rate_value==0)
+ bit_rate_value=VCL[Pos].bit_rate_value;
+ if (cbr_flag_IsSet==true && cbr_flag!=VCL[Pos].cbr_flag)
+ cbr_flag_IsValid=false;
+ if (cbr_flag_IsSet==0)
+ {
+ cbr_flag=VCL[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 && bit_rate_value_IsValid)
+ Fill(Stream_Video, 0, cbr_flag?Video_BitRate_Nominal:Video_BitRate_Maximum, bit_rate_value);
+ }
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Avc::Streams_Finish()
+{
+ //GA94 captions
+ for (size_t Pos=0; Pos<GA94_03_CC_Parsers.size(); Pos++)
+ if (GA94_03_CC_Parsers[Pos] && GA94_03_CC_Parsers[Pos]->Status[IsAccepted])
+ {
+ Finish(GA94_03_CC_Parsers[Pos]);
+ Merge(*GA94_03_CC_Parsers[Pos]);
+ if (Pos<2)
+ Fill(Stream_Text, StreamPos_Last, Text_ID, _T("608-")+Ztring::ToZtring(Pos));
+ Fill(Stream_Text, StreamPos_Last, "MuxingMode", _T("EIA-708"));
+ }
+
+ //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 - 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::Synched_Test()
+{
+ //Trailing 0x00
+ while(Buffer_Offset+3<=Buffer_Size && Buffer[Buffer_Offset]==0x00 && CC3(Buffer+Buffer_Offset)!=0x000001)
+ Buffer_Offset++;
+
+ //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_Avc::Synched_Init()
+{
+ //Count of a Packets
+ Frame_Count=0;
+ Block_Count=0;
+ pic_order_cnt_lsb_Old=(int32u)-1;
+ Interlaced_Top=0;
+ Interlaced_Bottom=0;
+ Structure_Field=0;
+ Structure_Frame=0;
+ FrameRate_Divider=1;
+ TemporalReference_Offset=0;
+ TemporalReference_Offset_Moved=false;
+ TemporalReference_GA94_03_CC_Offset=0;
+ TemporalReference_Offset_pic_order_cnt_lsb_Last=(size_t)-1;
+
+ //From seq_parameter_set
+ pic_width_in_mbs_minus1=0;
+ pic_height_in_map_units_minus1=0;
+ log2_max_frame_num_minus4=0;
+ log2_max_pic_order_cnt_lsb_minus4=0;
+ num_units_in_tick=0;
+ time_scale=0;
+ chroma_format_idc=1;
+ frame_crop_left_offset=0;
+ frame_crop_right_offset=0;
+ frame_crop_top_offset=0;
+ frame_crop_bottom_offset=0;
+ max_num_ref_frames=0;
+ pic_order_cnt_type=0;
+ pic_order_cnt_lsb_Last=(int32u)-1;
+ bit_depth_luma_minus8=0;
+ bit_depth_chroma_minus8=0;
+ pic_order_cnt_lsb=(int32u)-1;
+ cpb_cnt_minus1=0;
+ initial_cpb_removal_delay=0;
+ initial_cpb_removal_delay_offset=0;
+ cpb_removal_delay=0;
+ sar_width=0;
+ sar_height=0;
+ profile_idc=0;
+ level_idc=0;
+ aspect_ratio_idc=0xFF;
+ video_format=5;
+ initial_cpb_removal_delay_length_minus1=0;
+ cpb_removal_delay_length_minus1=0;
+ dpb_output_delay_length_minus1=0;
+ time_offset_length=0;
+ pic_struct=0;
+ pic_struct_FirstDetected=(int8u)-1;
+ colour_primaries=2;
+ transfer_characteristics=2;
+ matrix_coefficients=2;
+ GA94_03_CC_IsPresent=false;
+ frame_mbs_only_flag=false;
+ timing_info_present_flag=false;
+ pic_struct_present_flag=false;
+ field_pic_flag=false;
+ entropy_coding_mode_flag=false;
+ NalHrdBpPresentFlag=false;
+ VclHrdBpPresentFlag=false;
+ CpbDpbDelaysPresentFlag=false;
+ mb_adaptive_frame_field_flag=false;
+ pic_order_present_flag=false;
+ field_pic_flag_AlreadyDetected=false;
+
+ //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[0x0C].Searching_Payload=true; //filler_data
+ 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();
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Avc::Read_Buffer_Unsynched()
+{
+ TemporalReference.clear();
+ TemporalReference_Offset=0;
+ TemporalReference_Offset_Moved=false;
+ TemporalReference_GA94_03_CC_Offset=0;
+ TemporalReference_Offset_pic_order_cnt_lsb_Last=(size_t)-1;
+}
+
+//***************************************************************************
+// 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
+ if (!SizedBlocks)
+ {
+ Skip_B3( "sync");
+ BS_Begin();
+ Mark_0 ();
+ Skip_S1( 2, "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 ();
+ Skip_S1( 2, "nal_ref_idc");
+ Get_S1 ( 5, nal_unit_type, "nal_unit_type");
+ BS_End();
+
+ //Filling
+ Header_Fill_Size(Element_Offset+Size-1);
+ }
+
+ //Filling
+ Header_Fill_Code(nal_unit_type, Ztring().From_CC1(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+4<=Buffer_Size
+ && CC3(Buffer+Buffer_Offset_Temp)!=0x000001)
+ {
+ Buffer_Offset_Temp+=2;
+ while(Buffer_Offset_Temp<Buffer_Size && Buffer[Buffer_Offset_Temp]!=0x00)
+ Buffer_Offset_Temp+=2;
+ if (Buffer_Offset_Temp<Buffer_Size && Buffer[Buffer_Offset_Temp-1]==0x00 || Buffer_Offset_Temp>=Buffer_Size)
+ Buffer_Offset_Temp--;
+
+ if (nal_unit_type==0x01 || nal_unit_type==0x05) //slice, 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;
+ }
+
+ //Keeping out trailing zeroes
+ if (Buffer_Offset_Temp+3<=Buffer_Size)
+ while (CC3(Buffer+Buffer_Offset_Temp-1)==0x000000)
+ 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+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)&0x1F;
+
+ //Searching start33
+ if (Streams[start_code].Searching_Payload
+ || Streams[start_code].ShouldDuplicate)
+ return true;
+
+ //Synchronizing
+ Buffer_Offset+=4;
+ Synched=false;
+ if (!Synchronize_0x000001())
+ return false;
+ }
+
+ if (Buffer_Offset+3==Buffer_Size)
+ return false; //Sync is OK, but start_code is not available
+ Trusted_IsNot("AVC, Synchronisation lost");
+ return Synchronize();
+}
+
+//---------------------------------------------------------------------------
+void File_Avc::Data_Parse()
+{
+ //Specific case
+ if (Element_Code==(int64u)-1)
+ {
+ SPS_PPS();
+ return;
+ }
+
+ //svc_extension
+ 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<size_t> 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]!=0x00)
+ Element_Offset_3Bytes+=2;
+ if (Element_Offset_3Bytes<Element_Size && Buffer[Buffer_Offset+(size_t)Element_Offset_3Bytes-1]==0x00 || Element_Offset_3Bytes>=Element_Size)
+ 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(); 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(); 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 (!Streams.empty() && Streams[(size_t)Element_Code].ShouldDuplicate)
+ File__Duplicate_Write(Element_Code);
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+// Packet "01"
+void File_Avc::slice_layer_without_partitioning_non_IDR()
+{
+ Element_Name("slice_layer_without_partitioning (non-IDR)");
+
+ //Parsing
+ slice_header();
+}
+
+//---------------------------------------------------------------------------
+// Packet "05"
+void File_Avc::slice_layer_without_partitioning_IDR()
+{
+ Element_Name("slice_layer_without_partitioning (IDR)");
+
+ //Parsing
+ slice_header();
+
+ FILLING_BEGIN_PRECISE();
+ //NextCode
+ for (int8u Pos=0x01; Pos<=0x05; Pos++)
+ NextCode_Add(Pos);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+//
+void File_Avc::slice_header()
+{
+ //Parsing
+ pic_order_cnt_lsb=(int32u)-1;
+ int32u first_mb_in_slice, slice_type, frame_num;
+ bool bottom_field_flag=0;
+ BS_Begin();
+ Get_UE (first_mb_in_slice, "first_mb_in_slice");
+ Get_UE (slice_type, "slice_type"); if (slice_type<9) {Param_Info(Avc_slice_type[slice_type]);Element_Info(Avc_slice_type[slice_type]);}
+ Skip_UE( "pic_parameter_set_id");
+ Get_BS (log2_max_frame_num_minus4+4, frame_num, "frame_num");
+ if (!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)
+ Skip_UE( "idr_pic_id");
+ if (pic_order_cnt_type==0)
+ {
+ Get_BS (log2_max_pic_order_cnt_lsb_minus4+4, pic_order_cnt_lsb, "pic_order_cnt_lsb"); Element_Info(pic_order_cnt_lsb);
+ if (pic_order_present_flag && !field_pic_flag)
+ Skip_SE( "delta_pic_order_cnt_bottom");
+ }
+ //TODO...
+ BS_End();
+ Skip_XX(Element_Size-Element_Offset, "ToDo...");
+ if (!field_pic_flag)
+ Element_Info("Frame");
+ else
+ Element_Info(bottom_field_flag?"Bottom":"Top");
+
+ FILLING_BEGIN_PRECISE();
+ //pic_struct
+ if (field_pic_flag && pic_struct_FirstDetected==(int8u)-1)
+ pic_struct_FirstDetected=bottom_field_flag?2:1; //2=BFF, 1=TFF
+
+ //Saving some info
+ if (pic_order_cnt_type==0)
+ {
+ if (field_pic_flag)
+ {
+ Structure_Field++;
+ if (bottom_field_flag)
+ Interlaced_Bottom++;
+ else
+ Interlaced_Top++;
+ }
+ else
+ Structure_Frame++;
+
+ // trying to know the order
+ // first 1/4: no change
+ // second 1/4: all is after 0
+ // third 1/4: no change
+ // fourth 1/4: all is before max_frame_num
+ size_t max_frame_num=1<<(log2_max_frame_num_minus4+4)<<1;
+ if (TemporalReference_Offset==0 || (!TemporalReference_Offset_Moved && pic_order_cnt_lsb==max_frame_num*3/4))
+ {
+ TemporalReference_Offset+=max_frame_num;
+ TemporalReference_Offset_Moved=true;
+
+ //Purging the start
+ if (TemporalReference_Offset==2*max_frame_num)
+ {
+ size_t Pos=0;
+ for(; Pos<TemporalReference.size(); Pos++)
+ if (TemporalReference[Pos].IsValid)
+ break;
+ if (Pos && Pos<TemporalReference.size())
+ {
+ TemporalReference.erase(TemporalReference.begin(), TemporalReference.begin()+Pos);
+ if (Pos<TemporalReference_Offset)
+ TemporalReference_Offset-=Pos;
+ else
+ TemporalReference_Offset=0;
+ if (Pos<TemporalReference_GA94_03_CC_Offset)
+ TemporalReference_GA94_03_CC_Offset-=Pos;
+ else
+ TemporalReference_GA94_03_CC_Offset=0;
+ }
+ }
+
+ //Purging too big array
+ if (TemporalReference.size()>=max_frame_num*4)
+ {
+ TemporalReference.erase(TemporalReference.begin(), TemporalReference.begin()+max_frame_num*2);
+ if (max_frame_num*2<TemporalReference_Offset)
+ TemporalReference_Offset-=max_frame_num*2;
+ if (max_frame_num*2<TemporalReference_GA94_03_CC_Offset)
+ TemporalReference_GA94_03_CC_Offset-=max_frame_num*2;
+ else
+ TemporalReference_GA94_03_CC_Offset=0;
+ }
+ }
+ if ( TemporalReference_Offset_Moved && pic_order_cnt_lsb>=max_frame_num/4 && pic_order_cnt_lsb<=max_frame_num/2)
+ {
+ TemporalReference_Offset_Moved=false;
+ }
+
+ TemporalReference_Offset_pic_order_cnt_lsb_Last=TemporalReference_Offset-(TemporalReference_Offset_Moved && pic_order_cnt_lsb>=max_frame_num/2?max_frame_num:0)+pic_order_cnt_lsb;
+
+ if (TemporalReference_Offset_pic_order_cnt_lsb_Last>=TemporalReference.size())
+ TemporalReference.resize(TemporalReference_Offset_pic_order_cnt_lsb_Last+1);
+ TemporalReference[TemporalReference_Offset_pic_order_cnt_lsb_Last].frame_num=frame_num;
+ TemporalReference[TemporalReference_Offset_pic_order_cnt_lsb_Last].slice_type=(int8u)slice_type;
+ TemporalReference[TemporalReference_Offset_pic_order_cnt_lsb_Last].IsTop=!bottom_field_flag;
+ TemporalReference[TemporalReference_Offset_pic_order_cnt_lsb_Last].IsField=field_pic_flag;
+ TemporalReference[TemporalReference_Offset_pic_order_cnt_lsb_Last].IsValid=true;
+ }
+
+ //Name
+ if (Frame_Count && ((!frame_mbs_only_flag && Interlaced_Top==Interlaced_Bottom && field_pic_flag) || first_mb_in_slice!=0 || (Element_Code==0x14 && !seq_parameter_set_ids.empty())))
+ {
+ Frame_Count--;
+ Frame_Count_InThisBlock--;
+ }
+ Element_Info(Ztring::ToZtring(Frame_Count));
+
+ //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++;
+
+ //Duplicate
+ if (Streams[(size_t)Element_Code].ShouldDuplicate)
+ File__Duplicate_Write(Element_Code, pic_order_cnt_type==0?pic_order_cnt_lsb:frame_num);
+
+ //Filling only if not already done
+ if (Frame_Count==2 && !Status[IsAccepted])
+ Accept("AVC");
+ if (!Status[IsFilled] && ((!GA94_03_CC_IsPresent && Frame_Count>=Frame_Count_Valid) || Frame_Count>=Frame_Count_Valid*10)) //10 times the normal test
+ {
+ Fill("AVC");
+ if (!Streams[(size_t)Element_Code].ShouldDuplicate && MediaInfoLib::Config.ParseSpeed_Get()<1.0)
+ Finish("AVC");
+ }
+ FILLING_END();
+
+ Synched=false; //We do not have the complete slice
+}
+
+//---------------------------------------------------------------------------
+// Packet "06"
+void File_Avc::sei()
+{
+ Element_Name("sei");
+
+ //Parsing
+ while(Element_Offset+1<Element_Size)
+ {
+ Element_Begin("sei message");
+ sei_message();
+ Element_End();
+ }
+ BS_Begin();
+ Mark_1( );
+ BS_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Avc::sei_message()
+{
+ //Parsing
+ int32u payloadType=0, payloadSize=0;
+ int8u payload_type_byte, payload_size_byte;
+ Element_Begin("sei message header");
+ do
+ {
+ Get_B1 (payload_type_byte, "payload_type_byte");
+ payloadType+=payload_type_byte;
+ }
+ while(payload_type_byte==0xFF);
+ do
+ {
+ Get_B1 (payload_size_byte, "payload_size_byte");
+ payloadSize+=payload_size_byte;
+ }
+ while(payload_size_byte==0xFF);
+ Element_End();
+
+ int64u Element_Offset_Save=Element_Offset+payloadSize;
+ int64u Element_Size_Save=Element_Size;
+ Element_Size=Element_Offset_Save;
+ switch (payloadType)
+ {
+ case 0 : sei_message_buffering_period(payloadSize); break;
+ case 1 : sei_message_pic_timing(payloadSize); break;
+ case 4 : sei_message_user_data_registered_itu_t_t35(payloadSize); break;
+ case 5 : sei_message_user_data_unregistered(payloadSize); break;
+ case 6 : sei_message_recovery_point(payloadSize); break;
+ case 32 : sei_message_mainconcept(payloadSize); break;
+ default :
+ Element_Info("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 payloadSize)
+{
+ Element_Info("buffering_period");
+
+ //Parsing
+ BS_Begin();
+ Skip_UE( "seq_parameter_set_id");
+ if (NalHrdBpPresentFlag)
+ for (int32u SchedSelIdx=0; SchedSelIdx<=cpb_cnt_minus1; SchedSelIdx++)
+ {
+ Get_S4 (initial_cpb_removal_delay_length_minus1+1, initial_cpb_removal_delay, "initial_cpb_removal_delay"); Param_Info(initial_cpb_removal_delay/90, " ms");
+ Get_S4 (initial_cpb_removal_delay_length_minus1+1, initial_cpb_removal_delay_offset, "initial_cpb_removal_delay_offset"); Param_Info(initial_cpb_removal_delay_offset/90, " ms");
+ }
+ if (VclHrdBpPresentFlag)
+ for (int32u SchedSelIdx=0; SchedSelIdx<=cpb_cnt_minus1; SchedSelIdx++)
+ {
+ Get_S4 (initial_cpb_removal_delay_length_minus1+1, initial_cpb_removal_delay, "initial_cpb_removal_delay"); Param_Info(initial_cpb_removal_delay/90, " ms");
+ Get_S4 (initial_cpb_removal_delay_length_minus1+1, initial_cpb_removal_delay_offset, "initial_cpb_removal_delay_offset"); Param_Info(initial_cpb_removal_delay_offset/90, " ms");
+ }
+}
+
+//---------------------------------------------------------------------------
+// SEI - 1
+void File_Avc::sei_message_pic_timing(int32u payloadSize)
+{
+ Element_Info("pic_timing");
+
+ //Testing if we can parsing it now
+ if (!SPS_IsParsed) //There is sometimes one problem in one message, should not untrusting all
+ {
+ Skip_XX(payloadSize, "Data");
+ return;
+ }
+
+ //Parsing
+ BS_Begin();
+ if (CpbDpbDelaysPresentFlag)
+ {
+ Get_S4 (cpb_removal_delay_length_minus1+1, cpb_removal_delay, "cpb_removal_delay");
+ Skip_S4(dpb_output_delay_length_minus1+1, "dpb_output_delay");
+ }
+ if (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_Info("Reserved"); return; //NumClockTS is unknown
+ }
+ Param_Info(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; i<NumClockTS; i++)
+ {
+ Element_Begin("ClockTS");
+ TEST_SB_SKIP( "clock_timestamp_flag");
+ Ztring TimeStamp;
+ int32u time_offset=0;
+ int8u n_frames;
+ bool full_timestamp_flag, nuit_field_based_flag;
+ Info_S1(2, ct_type, "ct_type"); Param_Info(Avc_ct_type[ct_type]);
+ Get_SB ( nuit_field_based_flag, "nuit_field_based_flag");
+ Skip_S1(5, "counting_type");
+ Get_SB ( full_timestamp_flag, "full_timestamp_flag");
+ Skip_SB( "discontinuity_flag");
+ Skip_SB( "cnt_dropped_flag");
+ Get_S1 (8, n_frames, "n_frames");
+ if (full_timestamp_flag)
+ {
+ Get_S1 (6, seconds_value, "seconds_value");
+ Get_S1 (6, minutes_value, "minutes_value");
+ Get_S1 (5, hours_value, "hours_value");
+ }
+ else
+ {
+ TEST_SB_SKIP( "seconds_flag");
+ Get_S1 (6, seconds_value, "seconds_value");
+ TEST_SB_SKIP( "minutes_flag");
+ Get_S1 (6, minutes_value, "minutes_value");
+ TEST_SB_SKIP( "hours_flag");
+ Get_S1 (5, hours_value, "hours_value");
+ TEST_SB_END();
+ TEST_SB_END();
+ TEST_SB_END();
+ }
+ TimeStamp=Ztring::ToZtring(hours_value)+_T(':')+Ztring::ToZtring(minutes_value)+_T(':')+Ztring::ToZtring(seconds_value);
+ if (time_offset_length>0)
+ Get_S4 (time_offset_length, time_offset, "time_offset");
+ if (time_scale)
+ {
+ float32 Milliseconds=((float32)(n_frames*(num_units_in_tick*(1+(nuit_field_based_flag?1:0)))+time_offset))/time_scale;
+ TimeStamp+=_T('.');
+ TimeStamp+=Ztring::ToZtring(Milliseconds);
+ }
+ Param_Info(TimeStamp);
+ TEST_SB_END();
+ Element_End();
+ }
+ }
+ BS_End();
+
+ FILLING_BEGIN_PRECISE();
+ if (pic_struct_FirstDetected==(int8u)-1)
+ pic_struct_FirstDetected=pic_struct;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// SEI - 5
+void File_Avc::sei_message_user_data_registered_itu_t_t35(int32u payloadSize)
+{
+ Element_Info("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_Info("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_Info(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()
+{
+ //Saving date in the right pic_order_cnt_lsb
+ if (pic_order_cnt_lsb!=(int32u)-1)
+ {
+ if (TemporalReference_Offset_pic_order_cnt_lsb_Last<=TemporalReference.size())
+ TemporalReference[TemporalReference_Offset_pic_order_cnt_lsb_Last].GA94_03_CC=TemporalReference_Temp.GA94_03_CC;
+ }
+
+ GA94_03_CC_IsPresent=true;
+
+ Element_Info("Styled captioning");
+
+ //Handling missing frames
+ size_t max_frame_num=1<<(log2_max_frame_num_minus4+4)<<1;
+ if (TemporalReference_GA94_03_CC_Offset+max_frame_num/2<TemporalReference_Offset-(TemporalReference_Offset_Moved && pic_order_cnt_lsb>=max_frame_num/2?max_frame_num:0)+pic_order_cnt_lsb)
+ {
+ size_t Pos=TemporalReference_Offset+pic_order_cnt_lsb;
+ for(; Pos<TemporalReference.size(); Pos++)
+ if (!TemporalReference[Pos].IsValid)
+ break;
+ TemporalReference_GA94_03_CC_Offset=Pos+1;
+ }
+
+ //Parsing
+ int8u cc_count;
+ bool process_em_data_flag, process_cc_data_flag, additional_data_flag;
+ BS_Begin();
+ 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");
+ BS_End();
+ Skip_B1( process_em_data_flag?"em_data":"junk"); //Emergency message
+ if (TemporalReference_Temp.GA94_03_CC.size()<cc_count)
+ TemporalReference_Temp.GA94_03_CC.resize(cc_count);
+ if (process_cc_data_flag)
+ {
+ for (int8u Pos=0; Pos<cc_count; Pos++)
+ {
+ Element_Begin("cc");
+ int8u cc_type, cc_data_1, cc_data_2;
+ bool cc_valid;
+ BS_Begin();
+ Mark_1();
+ Mark_1();
+ Mark_1();
+ Mark_1();
+ Mark_1();
+ Get_SB ( cc_valid, "cc_valid");
+ Get_S1 (2, cc_type, "cc_type");
+ BS_End();
+ Get_B1 (cc_data_1, "cc_data_1");
+ Get_B1 (cc_data_2, "cc_data_2");
+ TemporalReference_Temp.GA94_03_CC[Pos].cc_valid=cc_valid;
+ TemporalReference_Temp.GA94_03_CC[Pos].cc_type=cc_type;
+ TemporalReference_Temp.GA94_03_CC[Pos].cc_data[0]=cc_data_1;
+ TemporalReference_Temp.GA94_03_CC[Pos].cc_data[1]=cc_data_2;
+ Element_End();
+ }
+ }
+ else
+ Skip_XX(cc_count*2, "Junk");
+
+ //Parsing Captions after reordering
+ bool CanBeParsed=true;
+ for (size_t GA94_03_CC_Pos=TemporalReference_GA94_03_CC_Offset; GA94_03_CC_Pos<TemporalReference.size(); GA94_03_CC_Pos+=2)
+ if (!TemporalReference[GA94_03_CC_Pos].IsValid)
+ CanBeParsed=false; //There is a missing field/frame
+ if (CanBeParsed)
+ {
+ for (size_t GA94_03_CC_Pos=TemporalReference_GA94_03_CC_Offset; GA94_03_CC_Pos<TemporalReference.size(); GA94_03_CC_Pos+=2)
+ for (int8u Pos=0; Pos<TemporalReference[GA94_03_CC_Pos].GA94_03_CC.size(); Pos++)
+ {
+ if (TemporalReference[GA94_03_CC_Pos].GA94_03_CC[Pos].cc_valid)
+ {
+ int8u cc_type=TemporalReference[GA94_03_CC_Pos].GA94_03_CC[Pos].cc_type;
+ size_t Parser_Pos=cc_type;
+ if (Parser_Pos==3)
+ Parser_Pos=2; //cc_type 2 and 3 are for the same text
+
+ while (Parser_Pos>=GA94_03_CC_Parsers.size())
+ GA94_03_CC_Parsers.push_back(NULL);
+ if (GA94_03_CC_Parsers[Parser_Pos]==NULL)
+ {
+ if (cc_type<2)
+ {
+ GA94_03_CC_Parsers[Parser_Pos]=new File_Eia608();
+ }
+ else
+ GA94_03_CC_Parsers[Parser_Pos]=new File_Eia708();
+ }
+ if (!GA94_03_CC_Parsers[Parser_Pos]->Status[IsFinished])
+ {
+ if (cc_type>=2)
+ ((File_Eia708*)GA94_03_CC_Parsers[2])->cc_type=cc_type;
+ Element_Begin(Ztring(_T("ReorderedCaptions,"))+Ztring().From_Local(Avc_user_data_GA94_cc_type(cc_type)));
+ Open_Buffer_Init(GA94_03_CC_Parsers[Parser_Pos]);
+ if (cc_type==1)
+ Open_Buffer_Continue(GA94_03_CC_Parsers[Parser_Pos], TemporalReference[GA94_03_CC_Pos].GA94_03_CC[Pos].cc_data, 2);
+ Element_End();
+ }
+
+ //Demux
+ if (cc_type<2)
+ Demux(TemporalReference[GA94_03_CC_Pos].GA94_03_CC[Pos].cc_data, 2, ContentType_MainStream);
+ else
+ Demux(TemporalReference[GA94_03_CC_Pos].GA94_03_CC[Pos].cc_data, 2, ContentType_MainStream);
+ }
+ }
+
+ TemporalReference_GA94_03_CC_Offset=TemporalReference.size()+1;
+ }
+
+ BS_Begin();
+ Mark_1();
+ Mark_1();
+ Mark_1();
+ Mark_1();
+ Mark_1();
+ Mark_1();
+ Mark_1();
+ Mark_1();
+ BS_End();
+
+ if (additional_data_flag)
+ Skip_XX(Element_Size-Element_Offset, "additional_user_data");
+}
+
+//---------------------------------------------------------------------------
+// SEI - 5 - GA94 - 0x03
+void File_Avc::sei_message_user_data_registered_itu_t_t35_GA94_06()
+{
+ Element_Info("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_Info("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_Info("x264");
+ sei_message_user_data_unregistered_x264(payloadSize-16); break;
+ case 0x684E92AC604A57FBLL : Element_Info("eavc");
+ sei_message_user_data_unregistered_x264(payloadSize-16); break;
+ default :
+ Element_Info("unknown");
+ Skip_XX(payloadSize-8, "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;
+ size_t Data_Pos_Before=0;
+ size_t Loop=0;
+ do
+ {
+ 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_Begin("options");
+ size_t Options_Pos;
+ size_t Options_Pos_Before=Data_Pos_Before;
+ Encoded_Library_Settings.clear();
+ do
+ {
+ 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_End();
+ }
+ 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(int32u payloadSize)
+{
+ Element_Info("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_Info("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
+ seq_parameter_set_data();
+ 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<Element_Size)
+ {
+ int8u Null;
+ Get_B1 (Null, "NULL byte");
+ if (Null)
+ Trusted_IsNot("Should be NULL byte");
+ }
+
+ FILLING_BEGIN_PRECISE();
+ //Filling
+ seq_parameter_set_ids[seq_parameter_set_id].profile_idc=profile_idc;
+ seq_parameter_set_ids[seq_parameter_set_id].level_idc=level_idc;
+
+ //NextCode
+ NextCode_Clear();
+ NextCode_Add(0x08);
+
+ //Autorisation of other streams
+ Streams[0x08].Searching_Payload=true; //pic_parameter_set
+ if (Streams[0x07].ShouldDuplicate)
+ Streams[0x08].ShouldDuplicate=true; //pic_parameter_set
+ Streams[0x0A].Searching_Payload=true; //end_of_seq
+ if (Streams[0x07].ShouldDuplicate)
+ Streams[0x0A].ShouldDuplicate=true; //end_of_seq
+ Streams[0x0B].Searching_Payload=true; //end_of_stream
+ if (Streams[0x07].ShouldDuplicate)
+ Streams[0x0B].ShouldDuplicate=true; //end_of_stream
+
+ //Setting as OK
+ SPS_IsParsed=true;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// Packet "08"
+void File_Avc::pic_parameter_set()
+{
+ Element_Name("pic_parameter_set");
+
+ //Parsing
+ int32u num_slice_groups_minus1;
+ BS_Begin();
+ Skip_UE( "pic_parameter_set_id");
+ Skip_UE( "seq_parameter_set_id");
+ Get_SB (entropy_coding_mode_flag, "entropy_coding_mode_flag");
+ Get_SB (pic_order_present_flag, "pic_order_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)
+ {
+ int32u slice_group_map_type;
+ 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<num_slice_groups_minus1; Pos++)
+ {
+ Skip_UE( "top_left");
+ Skip_UE( "bottom_right");
+ }
+ }
+ else if (slice_group_map_type==3
+ || slice_group_map_type==4
+ || slice_group_map_type==5)
+ {
+ Skip_SB( "slice_group_change_direction_flag");
+ Skip_UE( "slice_group_change_rate_minus1");
+ }
+ else if (slice_group_map_type==6)
+ {
+ int32u pic_size_in_map_units_minus1;
+ Get_UE (pic_size_in_map_units_minus1, "pic_size_in_map_units_minus1");
+ if(pic_size_in_map_units_minus1>(pic_width_in_mbs_minus1+1)*(pic_height_in_map_units_minus1+1))
+ {
+ Trusted_IsNot("pic_size_in_map_units_minus1 too high");
+ pic_size_in_map_units_minus1=0;
+ }
+ #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_S4(slice_group_id_Size, "slice_group_id");
+ }
+ }
+ Skip_UE( "num_ref_idx_l0_active_minus1");
+ Skip_UE( "num_ref_idx_l1_active_minus1");
+ Skip_SB( "weighted_pred_flag");
+ Skip_S1(2, "weighted_bipred_idc");
+ Skip_SE( "pic_init_qp_minus26");
+ Skip_SE( "pic_init_qs_minus26");
+ Skip_SE( "chroma_qp_index_offset");
+ Skip_SB( "deblocking_filter_control_present_flag");
+ Skip_SB( "constrained_intra_pred_flag");
+ Skip_SB( "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 (!(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?2: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<Element_Size) //Not always removed from the stream, ie in MPEG-4
+ {
+ int8u Padding;
+ Peek_B1(Padding);
+ if (!Padding)
+ Skip_B1( "Padding");
+ else
+ break;
+ }
+
+ FILLING_BEGIN_PRECISE();
+ //NextCode
+ NextCode_Clear();
+ NextCode_Add(0x05);
+ NextCode_Add(0x06);
+ if (!subset_seq_parameter_set_ids.empty())
+ NextCode_Add(0x14); //slice_layer_extension
+
+ //Autorisation of other streams
+ if (!seq_parameter_set_ids.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_set_ids.empty())
+ {
+ Streams[0x14].Searching_Payload=true; //slice_layer_extension
+ if (Streams[0x08].ShouldDuplicate)
+ Streams[0x14].ShouldDuplicate=true; //slice_layer_extension
+ }
+
+ //Setting as OK
+ PPS_IsParsed=true;
+ 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_Info(Avc_primary_pic_type[primary_pic_type]);
+ Mark_1( );
+ BS_End();
+}
+
+//---------------------------------------------------------------------------
+// Packet "09"
+void File_Avc::filler_data()
+{
+ Element_Name("filler_data");
+
+ while (Element_Offset<Element_Size)
+ {
+ int8u FF;
+ Peek_B1(FF);
+ if (FF!=0xFF)
+ break;
+ Element_Offset++;
+ }
+ BS_Begin();
+ Mark_1( );
+ BS_End();
+}
+
+//---------------------------------------------------------------------------
+// Packet "0E"
+void File_Avc::prefix_nal_unit()
+{
+ Element_Name("prefix_nal_unit");
+
+ //Parsing
+ if (svc_extension_flag)
+ {
+ Skip_XX(Element_Size-Element_Offset, "prefix_nal_unit_svc");
+ }
+}
+
+//---------------------------------------------------------------------------
+// Packet "0F"
+void File_Avc::subset_seq_parameter_set()
+{
+ Element_Name("subset_seq_parameter_set");
+
+ //Parsing
+ seq_parameter_set_data();
+ if (profile_idc==83 || 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 (profile_idc==118 || profile_idc==128)
+ {
+ //bool mvc_vui_parameters_present_flag, additional_extension2_flag;
+ Mark_1();
+ seq_parameter_set_mvc_extension();
+ /* 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();
+ //Filling
+ subset_seq_parameter_set_ids[seq_parameter_set_id].profile_idc=profile_idc;
+ subset_seq_parameter_set_ids[seq_parameter_set_id].level_idc=level_idc;
+
+ //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()
+{
+ 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
+ {
+ slice_header();
+ //slice_data();
+ }
+}
+
+//***************************************************************************
+// SubElements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Avc::seq_parameter_set_data()
+{
+ Get_B1 (profile_idc, "profile_idc");
+ BS_Begin();
+ Element_Begin("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_End();
+ Get_S1 ( 8, level_idc, "level_idc");
+ Get_UE ( seq_parameter_set_id, "seq_parameter_set_id");
+ if (profile_idc==100
+ || profile_idc==110
+ || profile_idc==122
+ || profile_idc==244
+ || profile_idc== 44
+ || profile_idc== 83
+ || profile_idc== 86
+ || profile_idc==118
+ || profile_idc==128) //High profiles
+ {
+ Element_Begin("high profile specific");
+ Get_UE (chroma_format_idc, "chroma_format_idc");
+ if (chroma_format_idc>3)
+ {
+ Trusted_IsNot("chroma_format_idc is too high");
+ chroma_format_idc=1;
+ }
+ Param_Info(Avc_Colorimetry_format_idc[chroma_format_idc]);
+ if (chroma_format_idc==3)
+ Skip_SB( "residual_colour_transform_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_End();
+ }
+ 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;
+ Skip_SB( "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");
+ num_ref_frames_in_pic_order_cnt_cycle=0;
+ }
+ for(int32u Pos=0; Pos<num_ref_frames_in_pic_order_cnt_cycle; Pos++)
+ Skip_SE( "offset_for_ref_frame");
+ }
+ Get_UE (max_num_ref_frames, "max_num_ref_frames");
+ Skip_SB( "gaps_in_frame_num_value_allowed_flag");
+ Get_UE (pic_width_in_mbs_minus1, "pic_width_in_mbs_minus1");
+ Get_UE (pic_height_in_map_units_minus1, "pic_height_in_map_units_minus1");
+ Get_SB (frame_mbs_only_flag, "frame_mbs_only_flag");
+ if (!frame_mbs_only_flag)
+ Get_SB (mb_adaptive_frame_field_flag, "mb_adaptive_frame_field_flag");
+ Skip_SB( "direct_8x8_inference_flag");
+ TEST_SB_SKIP( "frame_cropping_flag");
+ Get_UE (frame_crop_left_offset, "frame_crop_left_offset");
+ Get_UE (frame_crop_right_offset, "frame_crop_right_offset");
+ Get_UE (frame_crop_top_offset, "frame_crop_top_offset");
+ Get_UE (frame_crop_bottom_offset, "frame_crop_bottom_offset");
+ TEST_SB_END();
+ TEST_SB_SKIP( "vui_parameters_present_flag");
+ vui_parameters();
+ TEST_SB_END();
+}
+
+//---------------------------------------------------------------------------
+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; Pos<ScalingList_Size; Pos++)
+ {
+ if (nextScale!=0)
+ {
+ int32s delta_scale;
+ Get_SE (delta_scale, "scale_delta");
+ nextScale=(lastScale+delta_scale+256)%256;
+ }
+ if (nextScale)
+ lastScale=nextScale;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Avc::vui_parameters()
+{
+ bool nal_hrd_parameters_present_flag, vcl_hrd_parameters_present_flag;
+ TEST_SB_SKIP( "aspect_ratio_info_present_flag");
+ Get_S1 (8, aspect_ratio_idc, "aspect_ratio_idc"); if (aspect_ratio_idc<Avc_PixelAspectRatio_Size) Param_Info(Avc_PixelAspectRatio[aspect_ratio_idc]);
+ if (aspect_ratio_idc==0xFF)
+ {
+ Get_S2 (16, sar_width, "sar_width");
+ Get_S2 (16, sar_height, "sar_height");
+ }
+ TEST_SB_END();
+ TEST_SB_SKIP( "overscan_info_present_flag");
+ Skip_SB( "overscan_appropriate_flag");
+ TEST_SB_END();
+ TEST_SB_SKIP( "video_signal_type_present_flag");
+ Get_S1 (3, video_format, "video_format"); Param_Info(Avc_video_format[video_format]);
+ Skip_SB( "video_full_range_flag");
+ TEST_SB_SKIP( "colour_description_present_flag");
+ Get_S1 (8, colour_primaries, "colour_primaries"); Param_Info(Avc_colour_primaries(colour_primaries));
+ Get_S1 (8, transfer_characteristics, "transfer_characteristics"); Param_Info(Avc_transfer_characteristics(transfer_characteristics));
+ Get_S1 (8, matrix_coefficients, "matrix_coefficients"); Param_Info(Avc_matrix_coefficients(matrix_coefficients));
+ TEST_SB_END();
+ TEST_SB_END();
+ TEST_SB_SKIP( "chroma_loc_info_present_flag");
+ Skip_UE( "chroma_sample_loc_type_top_field");
+ Skip_UE( "chroma_sample_loc_type_bottom_field");
+ TEST_SB_END();
+ TEST_SB_GET (timing_info_present_flag, "timing_info_present_flag");
+ Get_S4 (32, num_units_in_tick, "num_units_in_tick");
+ Get_S4 (32, time_scale, "time_scale");
+ Get_SB (fixed_frame_rate_flag, "fixed_frame_rate_flag");
+ TEST_SB_END();
+ TEST_SB_GET (nal_hrd_parameters_present_flag, "nal_hrd_parameters_present_flag");
+ hrd_parameters(false);
+ NalHrdBpPresentFlag=true;
+ TEST_SB_END();
+ TEST_SB_GET (vcl_hrd_parameters_present_flag, "vcl_hrd_parameters_present_flag");
+ hrd_parameters(true);
+ VclHrdBpPresentFlag=true;
+ TEST_SB_END();
+ if(nal_hrd_parameters_present_flag || vcl_hrd_parameters_present_flag)
+ {
+ CpbDpbDelaysPresentFlag=true;
+ Skip_SB( "low_delay_hrd_flag");
+ }
+ Get_SB (pic_struct_present_flag, "pic_struct_present_flag");
+ TEST_SB_SKIP( "bitstream_restriction_flag");
+ Skip_SB( "motion_vectors_over_pic_boundaries_flag");
+ Skip_UE( "max_bytes_per_pic_denom");
+ Skip_UE( "max_bits_per_mb_denom");
+ Skip_UE( "log2_max_mv_length_horizontal");
+ Skip_UE( "log2_max_mv_length_vertical");
+ Skip_UE( "num_reorder_frames");
+ Skip_UE( "max_dec_frame_buffering");
+ TEST_SB_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Avc::hrd_parameters(bool vcl)
+{
+ //Filling
+ if (vcl)
+ VCL.clear();
+ else
+ NAL.clear();
+
+ //Parsing
+ int8u bit_rate_scale, cpb_size_scale;
+ 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;
+ }
+ for (int32u SchedSelIdx=0; SchedSelIdx<=cpb_cnt_minus1; SchedSelIdx++)
+ {
+ Element_Begin("ShedSel");
+ xxl Item;
+ int32u bit_rate_value_minus1, cpb_size_value_minus1;
+ Get_UE (bit_rate_value_minus1, "bit_rate_value_minus1");
+ Item.bit_rate_value=(int32u)((bit_rate_value_minus1+1)*pow(2.0, 6+bit_rate_scale)); Param_Info(Item.bit_rate_value, " bps");
+ Get_UE (cpb_size_value_minus1, "cpb_size_value_minus1");
+ Item.cpb_size_value=(int32u)((cpb_size_value_minus1+1)*pow(2.0, cpb_size_scale)); Param_Info(Item.cpb_size_value, " bytes");
+ Get_SB (Item.cbr_flag, "cbr_flag");
+ Element_End();
+
+ //Filling
+ if (vcl)
+ VCL.push_back(Item);
+ else
+ NAL.push_back(Item);
+ }
+ 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");
+}
+
+//---------------------------------------------------------------------------
+void File_Avc::nal_unit_header_svc_extension()
+{
+ //Parsing
+ Element_Begin("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_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Avc::nal_unit_header_mvc_extension()
+{
+ //Parsing
+ Element_Begin("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_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Avc::seq_parameter_set_svc_extension()
+{
+ //Parsing
+ Element_Begin("seq_parameter_set_svc_extension");
+ //Skip_SB( "");
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Avc::svc_vui_parameters_extension()
+{
+ //Parsing
+ Element_Begin("svc_vui_parameters_extension");
+ //Skip_SB( "");
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Avc::seq_parameter_set_mvc_extension()
+{
+ //Parsing
+ Element_Begin("seq_parameter_set_mvc_extension");
+ Get_UE (num_views_minus1, "num_views_minus1");
+ //Skip_SB( "");
+ Element_End();
+}
+
+//---------------------------------------------------------------------------
+void File_Avc::mvc_vui_parameters_extension()
+{
+ //Parsing
+ Element_Begin("mvc_vui_parameters_extension");
+ Skip_SB( "");
+ Element_End();
+}
+
+//***************************************************************************
+// Specific
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Avc::SPS_PPS()
+{
+ //Configuring
+ Trusted=1; //No error is accepted
+
+ //Parsing
+ int8u Profile, Level, seq_parameter_set_count, pic_parameter_set_count;
+ Get_B1 (Profile, "Profile");
+ Skip_B1( "Compatible profile");
+ if (SizedBlocks)
+ Skip_B1( "Reserved");
+ 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; Pos<seq_parameter_set_count; Pos++)
+ {
+ Element_Begin("seq_parameter_set");
+ int16u Size;
+ Get_B2 (Size, "Size");
+ BS_Begin();
+ Mark_0 ();
+ Skip_S1( 2, "nal_ref_idc");
+ Skip_S1( 5, "nal_unit_type");
+ BS_End();
+ if (Element_Offset+Size-1>Element_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-1;
+ 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_End();
+ }
+ Get_B1 (pic_parameter_set_count, "pic_parameter_set count");
+ for (int8u Pos=0; Pos<pic_parameter_set_count; Pos++)
+ {
+ Element_Begin("pic_parameter_set");
+ int16u Size;
+ Get_B2 (Size, "Size");
+ BS_Begin();
+ Mark_0 ();
+ Skip_S1( 2, "nal_ref_idc");
+ Skip_S1( 5, "nal_unit_type");
+ BS_End();
+ 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-1;
+ if (Element_Size>Element_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_End();
+ }
+ if (Element_Offset<Element_Size)
+ Skip_XX(Element_Size-Element_Offset, "Padding?");
+
+ //Filling
+ FILLING_BEGIN_PRECISE();
+ //Detection of some bugs in the file
+ if (Profile!=profile_idc || Level!=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;
+ MustParse_SPS_PPS_Done=true;
+ if (!Status[IsAccepted])
+ Accept("AVC");
+ if (MustParse_SPS_PPS_Only)
+ Finish("AVC");
+ FILLING_END();
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_AVC_YES
+
diff --git a/src/thirdparty/MediaInfo/Video/File_Avc.h b/src/thirdparty/MediaInfo/Video/File_Avc.h
new file mode 100644
index 000000000..ddbbcda1a
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Avc.h
@@ -0,0 +1,291 @@
+// File_Avc - Info for AVC Video files
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_AvcH
+#define MediaInfo_AvcH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include "MediaInfo/File__Duplicate.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Avc
+//***************************************************************************
+
+class File_Avc : public File__Duplicate
+{
+public :
+ //In
+ size_t Frame_Count_Valid;
+ bool FrameIsAlwaysComplete;
+ bool MustParse_SPS_PPS;
+ bool MustParse_SPS_PPS_Only;
+ bool MustParse_SPS_PPS_Done;
+ bool SizedBlocks;
+
+ //Constructor/Destructor
+ File_Avc();
+ ~File_Avc();
+
+private :
+ //Streams management
+ void Streams_Fill();
+ void Streams_Finish();
+
+ //Buffer - File header
+ bool FileHeader_Begin();
+
+ //Buffer - Synchro
+ bool Synchronize() {return Synchronize_0x000001();}
+ bool Synched_Test();
+ void Synched_Init();
+
+ //Buffer - Global
+ void Read_Buffer_Unsynched();
+
+ //Buffer - Per element
+ void Header_Parse();
+ bool Header_Parser_QuickSearch();
+ bool Header_Parser_Fill_Size();
+ void Data_Parse();
+
+ //Output buffer
+ size_t Output_Buffer_Get (const String &Value);
+ size_t Output_Buffer_Get (size_t Pos);
+
+ //Options
+ void Option_Manage ();
+
+ //Elements
+ void slice_layer_without_partitioning_IDR();
+ void slice_layer_without_partitioning_non_IDR();
+ void slice_header();
+ void seq_parameter_set();
+ void pic_parameter_set();
+ void sei();
+ void sei_message();
+ void sei_message_buffering_period(int32u payloadSize);
+ void sei_message_pic_timing(int32u payloadSize);
+ void sei_message_user_data_registered_itu_t_t35(int32u payloadSize);
+ 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_06();
+ void sei_message_user_data_unregistered(int32u payloadSize);
+ void sei_message_user_data_unregistered_x264(int32u payloadSize);
+ void sei_message_recovery_point(int32u payloadSize);
+ void sei_message_mainconcept(int32u payloadSize);
+ void access_unit_delimiter();
+ void filler_data();
+ void prefix_nal_unit();
+ void subset_seq_parameter_set();
+ void slice_layer_extension();
+
+ //Packets - SubElements
+ void seq_parameter_set_data();
+ void scaling_list(int32u ScalingList_Size);
+ void vui_parameters();
+ void hrd_parameters(bool vcl);
+ void nal_unit_header_svc_extension();
+ void nal_unit_header_mvc_extension();
+ void seq_parameter_set_svc_extension();
+ void svc_vui_parameters_extension();
+ void seq_parameter_set_mvc_extension();
+ void mvc_vui_parameters_extension();
+
+ //Packets - Specific
+ void SPS_PPS();
+
+ //Streams
+ struct stream
+ {
+ bool Searching_Payload;
+ bool ShouldDuplicate;
+
+ stream()
+ {
+ Searching_Payload=false;
+ ShouldDuplicate=false;
+ }
+ };
+ std::vector<stream> Streams;
+
+ //Temporal reference
+ struct temporalreference
+ {
+ struct cc_data_
+ {
+ int8u cc_type;
+ int8u cc_data[2];
+ bool cc_valid;
+
+ cc_data_()
+ {
+ cc_valid=false;
+ }
+ };
+ std::vector<cc_data_> GA94_03_CC; //Per cc offset
+
+ bool IsValid;
+
+ int32u frame_num;
+ int8u slice_type;
+ bool IsTop;
+ bool IsField;
+
+ temporalreference()
+ {
+ slice_type=(int8u)-1;
+ IsValid=false;
+ }
+ };
+ std::vector<temporalreference> TemporalReference; //per pic_order_cnt_lsb
+ temporalreference TemporalReference_Temp;
+ size_t TemporalReference_Offset;
+ bool TemporalReference_Offset_Moved;
+ size_t TemporalReference_GA94_03_CC_Offset;
+ size_t TemporalReference_Offset_pic_order_cnt_lsb_Last;
+
+ //seq_parameter_set
+ struct seq_parameter_set_
+ {
+ int8u profile_idc;
+ int8u level_idc;
+
+ seq_parameter_set_()
+ {
+ profile_idc=0;
+ level_idc=0;
+ }
+ };
+ std::map<int32u, seq_parameter_set_> seq_parameter_set_ids;
+ std::map<int32u, seq_parameter_set_> subset_seq_parameter_set_ids;
+
+ //Temp
+ std::vector<File__Analyze*> GA94_03_CC_Parsers;
+
+ //Replacement of File__Analyze
+ const int8u* Buffer_ToSave;
+ size_t Buffer_Size_ToSave;
+
+ //Count of a Packets
+ size_t Frame_Count;
+ size_t Block_Count;
+ size_t Interlaced_Top;
+ size_t Interlaced_Bottom;
+ size_t Structure_Field;
+ size_t Structure_Frame;
+ int8u FrameRate_Divider;
+
+ //From seq_parameter_set
+ struct xxl
+ {
+ int32u bit_rate_value;
+ int32u cpb_size_value;
+ bool cbr_flag;
+ };
+ std::vector<xxl> NAL;
+ std::vector<xxl> VCL;
+ Ztring Encoded_Library;
+ Ztring Encoded_Library_Name;
+ Ztring Encoded_Library_Version;
+ Ztring Encoded_Library_Date;
+ Ztring Encoded_Library_Settings;
+ Ztring BitRate_Nominal;
+ Ztring MuxingMode;
+ int32u pic_width_in_mbs_minus1;
+ int32u pic_height_in_map_units_minus1;
+ int32u log2_max_frame_num_minus4;
+ int32u log2_max_pic_order_cnt_lsb_minus4;
+ int32u num_units_in_tick;
+ int32u time_scale;
+ int32u chroma_format_idc;
+ int32u frame_crop_left_offset;
+ int32u frame_crop_right_offset;
+ int32u frame_crop_top_offset;
+ int32u frame_crop_bottom_offset;
+ int32u max_num_ref_frames;
+ int32u pic_order_cnt_type;
+ int32u bit_depth_luma_minus8;
+ int32u bit_depth_chroma_minus8;
+ int32u pic_order_cnt_lsb;
+ int32u pic_order_cnt_lsb_Last;
+ int32u seq_parameter_set_id;
+ int32u num_views_minus1;
+ int32u cpb_cnt_minus1;
+ int32u initial_cpb_removal_delay;
+ int32u initial_cpb_removal_delay_offset;
+ int32u cpb_removal_delay;
+ int32u pic_order_cnt_lsb_Old;
+ int16u sar_width;
+ int16u sar_height;
+ int8u profile_idc;
+ int8u level_idc;
+ int8u aspect_ratio_idc;
+ int8u video_format;
+ int8u initial_cpb_removal_delay_length_minus1;
+ int8u cpb_removal_delay_length_minus1;
+ int8u dpb_output_delay_length_minus1;
+ int8u time_offset_length;
+ int8u pic_struct;
+ int8u pic_struct_FirstDetected;
+ int8u SizeOfNALU_Minus1;
+ int8u colour_primaries;
+ int8u transfer_characteristics;
+ int8u matrix_coefficients;
+ int8u nal_unit_type;
+ bool GA94_03_CC_IsPresent;
+ bool frame_mbs_only_flag;
+ bool timing_info_present_flag;
+ bool fixed_frame_rate_flag;
+ bool pic_struct_present_flag;
+ bool field_pic_flag;
+ bool entropy_coding_mode_flag;
+ bool NalHrdBpPresentFlag;
+ bool VclHrdBpPresentFlag;
+ bool CpbDpbDelaysPresentFlag;
+ bool mb_adaptive_frame_field_flag;
+ bool pic_order_present_flag;
+ bool svc_extension_flag;
+ bool field_pic_flag_AlreadyDetected;
+
+ //Temp
+ bool SPS_IsParsed;
+ bool PPS_IsParsed;
+
+ //File__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;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Video/File_Avc_Duplicate.cpp b/src/thirdparty/MediaInfo/Video/File_Avc_Duplicate.cpp
new file mode 100644
index 000000000..c357b11fb
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Avc_Duplicate.cpp
@@ -0,0 +1,261 @@
+// File__Duplicate - Duplication of some formats
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Duplication helper for some specific formats
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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 <cstring>
+using namespace ZenLib;
+using namespace std;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Options
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Avc::Option_Manage()
+{
+ //File__Duplicate configuration
+ if (File__Duplicate_HasChanged())
+ {
+ //Autorisation of other streams
+ Streams[0x07].ShouldDuplicate=true;
+ }
+}
+
+//***************************************************************************
+// Set
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Avc::File__Duplicate_Set (const Ztring &Value)
+{
+ ZtringList List(Value);
+
+ //Searching Target
+ bool IsForUs=false;
+ std::vector<ZtringList::iterator> Targets_ToAdd;
+ std::vector<ZtringList::iterator> Targets_ToRemove;
+ std::vector<ZtringList::iterator> Orders_ToAdd;
+ std::vector<ZtringList::iterator> Orders_ToRemove;
+ for (ZtringList::iterator Current=List.begin(); Current<List.end(); Current++)
+ {
+ //Detecting if we want to remove
+ bool ToRemove=false;
+ if (Current->find(_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<ZtringList::iterator>::iterator Target=Targets_ToAdd.begin(); Target<Targets_ToAdd.end(); Target++)
+ Writer.Configure(**Target);
+
+ //For each order to add
+ for (std::vector<ZtringList::iterator>::iterator Order=Orders_ToAdd.begin(); Order<Orders_ToAdd.end(); Order++)
+ if ((**Order)==_T("format=Flv"))
+ FLV=true;
+
+ return true;
+}
+
+//***************************************************************************
+// Write
+//***************************************************************************
+
+void File_Avc::File__Duplicate_Write (int64u Element_Code, int32u frame_num)
+{
+ const int8u* ToAdd=Buffer+Buffer_Offset-(size_t)Header_Size+3;
+ size_t ToAdd_Size=(size_t)(Element_Size+Header_Size-3);
+
+ if (!SPS_PPS_AlreadyDone)
+ {
+ if (Element_Code==7)
+ {
+ std::memcpy(Duplicate_Buffer, ToAdd, ToAdd_Size);
+ Duplicate_Buffer_Size=ToAdd_Size;
+
+ }
+ else if (Element_Code==8)
+ {
+
+ // Form:
+ // 8 bytes : PTS
+ // 8 bytes : DTS
+ // 8 bytes : Size (without header)
+ // 1 byte : Type (0=Frame, 1=Header);
+ // 7 bytes : Reserved
+ size_t Extra;
+ if (FLV)
+ Extra=1; //FLV
+ else
+ Extra=0; //MPEG-4
+ int8u Header[32];
+ int64u2BigEndian(Header+ 0, PTS);
+ int64u2BigEndian(Header+ 8, DTS);
+ int64u2BigEndian(Header+16, 5+Extra+2+Duplicate_Buffer_Size+1+2+ToAdd_Size); //5+Extra for SPS_SQS header, 2 for SPS size, 1 for PPS count, 2 for PPS size
+ Header[24]=1;
+ int56u2BigEndian(Header+25, 0);
+ Writer.Write(Header, 32);
+
+ //SPS_PPS
+ int8u* SPS_SQS=new int8u[5+Extra];
+ if (Extra==1)
+ {
+ SPS_SQS[0]=0x01; //Profile FLV
+ SPS_SQS[1]=profile_idc; //Compatible Profile
+ SPS_SQS[2]=0x00; //Reserved
+ }
+ else
+ {
+ SPS_SQS[0]=profile_idc; //Profile MPEG-4
+ SPS_SQS[1]=0x00; //Compatible Profile
+ }
+ SPS_SQS[2+Extra]=level_idc; //Level
+ 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, PTS);
+ int64u2BigEndian(Header+ 8, 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;
+ }
+
+}
+
+//***************************************************************************
+// Output_Buffer
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+size_t File_Avc::Output_Buffer_Get (const String &)
+{
+ return Writer.Output_Buffer_Get();
+}
+
+//---------------------------------------------------------------------------
+size_t File_Avc::Output_Buffer_Get (size_t)
+{
+ return Writer.Output_Buffer_Get();
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_AVC_YES
+
diff --git a/src/thirdparty/MediaInfo/Video/File_AvsV.cpp b/src/thirdparty/MediaInfo/Video/File_AvsV.cpp
new file mode 100644
index 000000000..5eca16576
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_AvsV.cpp
@@ -0,0 +1,832 @@
+// File_AvsV - Info for AVS Video files
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_AVSV_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Video/File_AvsV.h"
+#undef FILLING_BEGIN
+#define FILLING_BEGIN() \
+ while (Element_Offset<Element_Size && Buffer[Buffer_Offset+(size_t)Element_Offset]==0x00) \
+ Element_Offset++; \
+ if (Element_Offset!=Element_Size) \
+ Trusted_IsNot("Size error"); \
+ else if (Element_IsOK()) \
+ {
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Infos
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+Ztring AvsV_profile(int8u profile_id)
+{
+ switch (profile_id)
+ {
+ case 0x20 : return "Base";
+ default :
+ return Ztring::ToZtring(profile_id);
+ }
+}
+
+//---------------------------------------------------------------------------
+Ztring AvsV_level(int8u level_id)
+{
+ switch (level_id)
+ {
+ case 0x00 : return Ztring();
+ case 0x10 : return "@2.0";
+ case 0x20 : return "@4.0";
+ case 0x22 : return "@4.2";
+ case 0x40 : return "@6.0";
+ case 0x42 : return "@6.2";
+ default :
+ return _T('@')+Ztring::ToZtring(level_id);
+ }
+}
+
+//---------------------------------------------------------------------------
+const float32 AvsV_frame_rate[]=
+{
+ (float32)0,
+ ((float32)24000)/1001,
+ (float32)24,
+ (float32)25,
+ ((float32)30000)/1001,
+ (float32)30,
+ (float32)50,
+ ((float32)60000)/1001,
+ (float32)60,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+};
+
+//---------------------------------------------------------------------------
+const char* AvsV_chroma_format[]=
+{
+ "",
+ "4:2:0",
+ "4:2:2",
+ "",
+};
+
+//---------------------------------------------------------------------------
+const char* AvsV_extension_start_code_identifier[]=
+{
+ "",
+ "",
+ "sequence_display",
+ "",
+ "copyright",
+ "",
+ "",
+ "picture_display",
+ "",
+ "",
+ "",
+ "camera_parameters",
+ "",
+ "",
+ "",
+ "",
+};
+
+//---------------------------------------------------------------------------
+const char* AvsV_video_format[]=
+{
+ "Component",
+ "PAL",
+ "NTSC",
+ "SECAM",
+ "MAC",
+ "",
+ "",
+ "",
+};
+
+//---------------------------------------------------------------------------
+const float32 AvsV_aspect_ratio[]=
+{
+ (float32)0,
+ (float32)1,
+ (float32)4/(float32)3,
+ (float32)16/(float32)9,
+ (float32)2.21,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+};
+
+//---------------------------------------------------------------------------
+const char* AvsV_picture_coding_type[]=
+{
+ "",
+ "P",
+ "B",
+ "",
+};
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_AvsV::File_AvsV()
+:File__Analyze()
+{
+ //Config
+ MustSynchronize=true;
+ Buffer_TotalBytes_FirstSynched_Max=64*1024;
+
+ //In
+ Frame_Count_Valid=30;
+ FrameIsAlwaysComplete=false;
+
+ //Temp
+ video_sequence_start_IsParsed=false;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_AvsV::Streams_Fill()
+{
+ //Filling
+ Stream_Prepare(Stream_Video);
+ Fill(Stream_Video, 0, Video_Format, "AVS Video");
+ Fill(Stream_Video, 0, Video_Codec, "AVS Video");
+
+ //From sequence header
+ Fill(Stream_Video, 0, Video_Format_Profile, AvsV_profile(profile_id)+AvsV_level(level_id));
+ Fill(Stream_Video, 0, Video_Codec_Profile, AvsV_profile(profile_id)+AvsV_level(level_id));
+ Fill(Stream_Video, StreamPos_Last, Video_Width, horizontal_size);
+ Fill(Stream_Video, StreamPos_Last, Video_Height, vertical_size);
+ Fill(Stream_Video, 0, Video_FrameRate, AvsV_frame_rate[frame_rate_code]/(progressive_sequence?1:2));
+ if (aspect_ratio==0)
+ ;//Forbidden
+ else if (aspect_ratio==1)
+ Fill(Stream_Video, 0, Video_PixelAspectRatio, 1.000, 3, true);
+ else if (display_horizontal_size && display_vertical_size)
+ {
+ if (vertical_size && AvsV_aspect_ratio[aspect_ratio])
+ Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, (float)horizontal_size/vertical_size
+ *AvsV_aspect_ratio[aspect_ratio]/((float)display_horizontal_size/display_vertical_size), 3, true);
+ }
+ else if (AvsV_aspect_ratio[aspect_ratio])
+ Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, AvsV_aspect_ratio[aspect_ratio], 3, true);
+ Fill(Stream_Video, 0, Video_Colorimetry, AvsV_chroma_format[chroma_format]);
+ if (progressive_frame_Count && progressive_frame_Count!=Frame_Count)
+ {
+ //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)
+ {
+ 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
+ Frame_Count=0;
+ 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())
+ 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]!=0x00)
+ Buffer_Offset_Temp+=2;
+ if (Buffer_Offset_Temp<Buffer_Size && Buffer[Buffer_Offset_Temp-1]==0x00 || Buffer_Offset_Temp>=Buffer_Size)
+ 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 (Element_Code==0xE0 && Element_Size>=2 && CC2(Buffer+Buffer_Offset)==0x0000)
+ {
+ Trusted=0; //This is surely an extract from MPEG-TS
+ Trusted_IsNot("Unattended element");
+ }
+ else
+ 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_Info(AvsV_aspect_ratio[aspect_ratio]);
+ Get_S1 ( 4, frame_rate_code, "frame_rate_code"); Param_Info(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_Info(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_Offset<Element_Size && Buffer[Buffer_Offset+Library_Start_Offset]<=0x40)
+ Library_Start_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_Offset<Element_Size)
+ Skip_XX(Element_Size-Element_Offset, "junk");
+
+ FILLING_BEGIN();
+ //NextCode
+ NextCode_Test();
+
+ if (Temp.size()>=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_Info(AvsV_extension_start_code_identifier[extension_start_code_identifier]);
+ Element_Info(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_Info(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_Info(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_Info(Ztring::ToZtring(Frame_Count));
+ if (Element_Code==0xB3)
+ Element_Info(_T("I"));
+
+ //Parsing
+ int8u picture_coding_type=(int8u)-1;
+ bool time_code_flag, progressive_frame, picture_structure=true, top_field_first, repeat_first_field, skip_mode_flag=false, loop_filter_disable;
+ Skip_B2( "bbv_delay");
+ BS_Begin();
+ if (Element_Code==0xB3) //Only I
+ {
+ Get_SB ( time_code_flag, "time_code_flag");
+ if (time_code_flag)
+ {
+ Skip_SB( "time_code_dropframe");
+ Skip_S1(5, "time_code_hours");
+ Skip_S1(6, "time_code_minutes");
+ Skip_S1(6, "time_code_seconds");
+ Skip_S1(6, "time_code_pictures");
+ }
+ }
+ if (Element_Code==0xB6) //Only P or B
+ {
+ Get_S1 ( 2, picture_coding_type, "picture_coding_type"); Element_Info(AvsV_picture_coding_type[picture_coding_type]);
+ }
+ Skip_S1( 8, "picture_distance");
+ if (low_delay)
+ Skip_UE( "bbv_check_times");
+ Get_SB ( progressive_frame, "progressive_frame");
+ if (!progressive_frame)
+ {
+ Get_SB( picture_structure, "picture_structure");
+ if (Element_Code==0xB6) //Only P or B
+ {
+ if (picture_structure)
+ Skip_SB( "advanced_pred_mode_disable");
+ }
+ }
+ Get_SB ( top_field_first, "top_field_first");
+ Get_SB ( repeat_first_field, "repeat_first_field");
+ Skip_SB( "fixed_picture_qp");
+ Skip_S1( 6, "picture_qp");
+ if (Element_Code==0xB3) //Only I
+ {
+ if (!progressive_frame && !picture_structure)
+ Get_SB( skip_mode_flag, "skip_mode_flag");
+ }
+ if (Element_Code==0xB6) //Only P or B
+ {
+ if (picture_coding_type!=2 || !picture_structure)
+ Skip_SB( "picture_reference_flag");
+ }
+ Skip_SB( "reserved");
+ Skip_SB( "reserved");
+ Skip_SB( "reserved");
+ Skip_SB( "reserved");
+ if (Element_Code==0xB6) //Only P or B
+ {
+ Get_SB( skip_mode_flag, "skip_mode_flag");
+ }
+ Get_SB ( loop_filter_disable, "loop_filter_disable");
+ if (!loop_filter_disable)
+ {
+ bool loop_filter_parameter_flag;
+ Get_SB ( loop_filter_parameter_flag, "loop_filter_parameter_flag");
+ if (loop_filter_parameter_flag)
+ {
+ Skip_SE( "alpha_c_offset");
+ Skip_SE( "beta_offset");
+ }
+ }
+ BS_End();
+
+ if (Element_Size-Element_Offset)
+ Skip_XX(Element_Size-Element_Offset, "Unknown");
+
+ FILLING_BEGIN();
+ if (progressive_frame==false)
+ {
+ if (picture_structure==true) //Frame
+ {
+ if (top_field_first)
+ Interlaced_Top++;
+ else
+ Interlaced_Bottom++;
+ }
+ }
+ else
+ progressive_frame_Count++;
+
+ //NextCode
+ NextCode_Test();
+ NextCode_Clear();
+ for (int8u Pos=0x00; Pos<=0xAF; Pos++)
+ NextCode_Add(Pos); //slice
+ NextCode_Add(0xB0); //video_sequence_start
+ NextCode_Add(0xB3); //picture_start
+ NextCode_Add(0xB6); //picture_start
+
+ //Autorisation of other streams
+ for (int8u Pos=0x00; Pos<=0xAF; Pos++)
+ Streams[Pos].Searching_Payload=true; //slice
+
+ //Filling only if not already done
+ if (Frame_Count>=Frame_Count_Valid && Count_Get(Stream_Video)==0)
+ {
+ //No need of more
+ Accept("AVS Video");
+ Finish("AVS Video");
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 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_*
diff --git a/src/thirdparty/MediaInfo/Video/File_AvsV.h b/src/thirdparty/MediaInfo/Video/File_AvsV.h
new file mode 100644
index 000000000..aae235652
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_AvsV.h
@@ -0,0 +1,123 @@
+// File_AvsV - Info for AVS Video files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
+ size_t 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 Frame_Count;
+ 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<stream> Streams;
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Video/File_Dirac.cpp b/src/thirdparty/MediaInfo/Video/File_Dirac.cpp
new file mode 100644
index 000000000..a742a4da2
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Dirac.cpp
@@ -0,0 +1,895 @@
+// File_Dirac - Info for DIRAC files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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+5<=Buffer_Size
+ && CC4(Buffer+Buffer_Offset)!=0x42424344) //"BBCD"
+ Buffer_Offset++;
+
+ //Parsing last bytes if needed
+ if (Buffer_Offset+5>Buffer_Size)
+ {
+ if (Buffer_Offset+4==Buffer_Size && CC4(Buffer+Buffer_Offset)!=0x42424344) //"BBCD"
+ Buffer_Offset++;
+ 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()
+{
+ //Count of a Packets
+ Frame_Count=0;
+
+ //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_Info(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_Info(Dirac_chroma_format(chroma_format));
+ TEST_SB_END();
+ TEST_SB_SKIP( "custom scan format flag");
+ Get_UI (source_sampling, "source sampling"); Param_Info(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_Info(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_Info(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_Info(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_Info(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
diff --git a/src/thirdparty/MediaInfo/Video/File_Dirac.h b/src/thirdparty/MediaInfo/Video/File_Dirac.h
new file mode 100644
index 000000000..58ac12980
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Dirac.h
@@ -0,0 +1,117 @@
+// File_Dirac - Info for Dirac files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
+ size_t 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<stream> Streams;
+
+ //Count of a Packets
+ size_t Frame_Count;
+
+ //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
diff --git a/src/thirdparty/MediaInfo/Video/File_Flic.cpp b/src/thirdparty/MediaInfo/Video/File_Flic.cpp
new file mode 100644
index 000000000..f33863d38
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Flic.cpp
@@ -0,0 +1,144 @@
+// File_Flic - Info for Flic files
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// From : http://www.compuphase.com/flic.htm
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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_Resolution, (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_*
+
diff --git a/src/thirdparty/MediaInfo/Video/File_Flic.h b/src/thirdparty/MediaInfo/Video/File_Flic.h
new file mode 100644
index 000000000..39e08981d
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Flic.h
@@ -0,0 +1,49 @@
+// File_Flic - Info for Flic files
+// Copyright (C) 2004-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Video/File_Fraps.cpp b/src/thirdparty/MediaInfo/Video/File_Fraps.cpp
new file mode 100644
index 000000000..703ec89a1
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Fraps.cpp
@@ -0,0 +1,147 @@
+// File_Fraps - Info for Fraps files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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
diff --git a/src/thirdparty/MediaInfo/Video/File_Fraps.h b/src/thirdparty/MediaInfo/Video/File_Fraps.h
new file mode 100644
index 000000000..5926912fb
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Fraps.h
@@ -0,0 +1,61 @@
+// File_Fraps - Info for Fraps files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Video/File_Lagarith.cpp b/src/thirdparty/MediaInfo/Video/File_Lagarith.cpp
new file mode 100644
index 000000000..73dce3def
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Lagarith.cpp
@@ -0,0 +1,102 @@
+// File_Lagarith - Info for Lagarith files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#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
diff --git a/src/thirdparty/MediaInfo/Video/File_Lagarith.h b/src/thirdparty/MediaInfo/Video/File_Lagarith.h
new file mode 100644
index 000000000..be29a34ea
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Lagarith.h
@@ -0,0 +1,56 @@
+// File_Lagarith - Info for Lagarith files
+// Copyright (C) 2010-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 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
diff --git a/src/thirdparty/MediaInfo/Video/File_Mpeg4v.cpp b/src/thirdparty/MediaInfo/Video/File_Mpeg4v.cpp
new file mode 100644
index 000000000..9a9922916
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Mpeg4v.cpp
@@ -0,0 +1,1665 @@
+// File_Mpeg4v - Info for MPEG-4 Visual files
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//***************************************************************************
+// Constants (Common)
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_MPEG4V_YES) || defined(MEDIAINFO_MPEG4_YES)
+//---------------------------------------------------------------------------
+
+#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@L1";
+ 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",
+};
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Mpeg4v::File_Mpeg4v()
+:File__Analyze()
+{
+ //Config
+ Trusted_Multiplier=2;
+ MustSynchronize=true;
+ Buffer_TotalBytes_FirstSynched_Max=64*1024;
+
+ //In
+ Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.3?30:2;
+ FrameIsAlwaysComplete=false;
+
+ //Temp
+ video_object_layer_start_IsParsed=false;
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4v::OnlyVOP()
+{
+ //Default stream values
+ Synched_Init();
+ Streams[0xB6].Searching_Payload=true; //vop_start
+}
+
+//***************************************************************************
+// Buffer - Synchro
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Mpeg4v::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_Mpeg4v::Synched_Init()
+{
+ //Count of a Packets
+ Frame_Count=0;
+ IVOP_Count=0;
+ PVOP_Count=0;
+ BVOP_Count=0;
+ SVOP_Count=0;
+ NVOP_Count=0;
+ Interlaced_Top=0;
+ Interlaced_Bottom=0;
+
+ //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;
+ 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;
+ shape=(int8u)-1;
+ sprite_enable=0;
+ scalability=0;
+ enhancement_type=0;
+ vop_time_increment_resolution=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;
+
+ //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)13;
+ 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_Resolution, bits_per_pixel);
+ if (chroma_format<4)
+ Fill(Stream_Video, 0, Video_Colorimetry, Mpeg4v_Colorimetry[chroma_format]);
+ 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<user_data_start_SNC_Data.size(); Pos++)
+ {
+ if (user_data_start_SNC_Data[Pos][0]==_T("CamTim"))
+ Fill(Stream_General, 0, General_Recorded_Date, Ztring().Date_From_String(user_data_start_SNC_Data[Pos][1].To_UTF8().c_str()));
+ if (user_data_start_SNC_Data[Pos][0]==_T("FrmRate"))
+ Fill(Stream_Video, 0, Video_FrameRate, user_data_start_SNC_Data[Pos][1].To_float32(), 3);
+ if (user_data_start_SNC_Data[Pos][0]==_T("TimStamp"))
+ Fill(Stream_Video, 0, Video_Delay, user_data_start_SNC_Data[Pos][1].To_int64u());
+ if (user_data_start_SNC_Data[Pos][0]==_T("CamPos") && user_data_start_SNC_Data[Pos][1].size()==16)
+ {
+ Fill(Stream_Video, 0, "Pan / Tilt / Zoom / Status", Ztring(user_data_start_SNC_Data[Pos][1].substr( 3, 4)).To_int8u(16));
+ Fill(Stream_Video, 0, "Pan / Tilt / Zoom / Status", Ztring(user_data_start_SNC_Data[Pos][1].substr( 7, 4)).To_int8u(16));
+ Fill(Stream_Video, 0, "Pan / Tilt / Zoom / Status", Ztring(user_data_start_SNC_Data[Pos][1].substr(11, 4)).To_int8u(16));
+ if (user_data_start_SNC_Data[Pos][1][15]==_T('M'))
+ Fill(Stream_Video, 0, "Pan / Tilt / Zoom / Status", _T("Move"));
+ else if (user_data_start_SNC_Data[Pos][1][15]==_T('S'))
+ Fill(Stream_Video, 0, "Pan / Tilt / Zoom / Status", _T("Stop"));
+ else
+ Fill(Stream_Video, 0, "Pan / Tilt / Zoom / Status", user_data_start_SNC_Data[Pos][1][15]);
+ }
+ if (user_data_start_SNC_Data[Pos][0]==_T("AlmEvent") && user_data_start_SNC_Data[Pos][1].size()==16)
+ Fill(Stream_Video, 0, "Alarm event", user_data_start_SNC_Data[Pos][1]);
+ }
+ if (video_object_layer_start_IsParsed && shape!=2 && !complexity_estimation_disable)
+ {
+ Fill(Stream_Video, 0, "data_partitioned", data_partitioned?"Yes":"No");
+ (*Stream_More)[Stream_Video][0](Ztring().From_Local("data_partitioned"), Info_Options)=_T("N NT");
+ if (data_partitioned)
+ {
+ Fill(Stream_Video, 0, "reversible_vlc", reversible_vlc?"Yes":"No");
+ (*Stream_More)[Stream_Video][0](Ztring().From_Local("reversible_vlc"), Info_Options)=_T("N NT");
+ }
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpeg4v::Streams_Finish()
+{
+ //Duration
+ if (!IsSub && Time_End_Seconds!=(int32u)-1 && Time_Begin_Seconds!=(int32u)-1)
+ {
+ int32u Duration=(Time_End_Seconds-Time_Begin_Seconds)*1000+Time_End_MilliSeconds-Time_Begin_MilliSeconds;
+ if (fixed_vop_time_increment && vop_time_increment_resolution)
+ Duration+=(float32_int32s)(((float)1000)/(((float)vop_time_increment_resolution)/fixed_vop_time_increment));
+ Fill(Stream_Video, 0, Video_Duration, 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
+ Streams.clear();
+}
+
+//***************************************************************************
+// 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]!=0x00)
+ Buffer_Offset_Temp+=2;
+ if (Buffer_Offset_Temp<Buffer_Size && Buffer[Buffer_Offset_Temp-1]==0x00 || Buffer_Offset_Temp>=Buffer_Size)
+ 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_0x000001())
+ 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
+ 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_Info(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_resolution<PowerOf2)
+ break;
+ PowerOf2<<=1;
+ }
+ Mark_1 ();
+ TEST_SB_SKIP( "fixed_vop_rate");
+ Get_BS (time_size, fixed_vop_time_increment, "fixed_vop_time_increment"); if (vop_time_increment_resolution>0) Param_Info(fixed_vop_time_increment*1000/vop_time_increment_resolution, " ms");
+ TEST_SB_END();
+ if (shape!=2) //Shape!=BinaryOnly
+ {
+ if (shape==0) //Shape=Rectangular
+ {
+ Mark_1 ();
+ Get_S2 (13, object_layer_width, "object_layer_width");
+ Mark_1 ();
+ Get_S2 (13, object_layer_height, "object_layer_height");
+ Mark_1 ();
+ }
+ Get_SB (interlaced, "interlaced");
+ Skip_SB( "obmc_disable");
+ if (video_object_layer_verid==1)
+ Get_S1 (1, sprite_enable, "sprite_enable");
+ else
+ Get_S1 (2, sprite_enable, "sprite_enable");
+ if (sprite_enable==1 || sprite_enable==2 ) //static or GMC
+ {
+ if (sprite_enable!=2) //No GMC
+ {
+ Skip_S2(13, "sprite_width");
+ Mark_1 ();
+ Skip_S2(13, "sprite_height");
+ Mark_1 ();
+ Skip_S2(13, "sprite_top_coordinate");
+ Mark_1 ();
+ Skip_S2(13, "sprite_left_coordinate");
+ Mark_1 ();
+ }
+ Get_S1 (6, no_of_sprite_warping_points, "no_of_sprite_warping_points");
+ Skip_S1(2, "sprite_warping_accuracy");
+ Skip_SB( "sprite_brightness_change");
+ if (sprite_enable!=2) //No GMC
+ Skip_SB( "low_latency_sprite_enable");
+ }
+ if (video_object_layer_verid==1 && shape!=0) //Shape!=Rectangular
+ Skip_SB( "sadct_disable");
+ TEST_SB_SKIP( "bits_per_pixel_not_8_bit");
+ Skip_S1(4, "quant_precision");
+ Get_S1 (4, bits_per_pixel, "bits_per_pixel");
+ TEST_SB_END();
+ if (shape==3) //Shape=GrayScale
+ {
+ Skip_SB( "no_gray_quant_update");
+ Skip_SB( "composition_method");
+ Skip_SB( "linear_composition");
+ }
+ TEST_SB_GET (quant_type, "quant_type");
+ Get_SB (load_intra_quant_mat, "load_intra_quant_mat");
+ if(load_intra_quant_mat)
+ for (int16u Pos=0; Pos<64; Pos++)
+ {
+ int8u intra_quant_mat;
+ Get_S1 (8, intra_quant_mat, "intra_quant_mat");
+ if (!intra_quant_mat)
+ {
+ if (Matrix_intra.size()<2)
+ break; //There is a problem
+ Ztring Value=Matrix_intra.substr(Matrix_intra.size()-2, 2);
+ for (;Pos<64; Pos++)
+ Matrix_intra+=Value;
+ }
+ else
+ {
+ Ztring Value=Ztring::ToZtring(intra_quant_mat, 16);
+ if (Value.size()==1)
+ Value.insert(0, _T("0"));
+ Matrix_intra+=Value;
+ }
+ }
+ else
+ Matrix_intra="Default";
+ Get_SB (load_nonintra_quant_mat, "load_nonintra_quant_mat");
+ if(load_nonintra_quant_mat)
+ for (int16u Pos=0; Pos<64; Pos++)
+ {
+ int8u nonintra_quant_mat;
+ Get_S1 (8, nonintra_quant_mat, "nonintra_quant_mat");
+ if (!nonintra_quant_mat)
+ {
+ if (Matrix_nonintra.size()<2)
+ break; //There is a problem
+ Ztring Value=Matrix_nonintra.substr(Matrix_nonintra.size()-2, 2);
+ for (;Pos<64; Pos++)
+ Matrix_nonintra+=Value;
+ }
+ else
+ {
+ Ztring Value=Ztring::ToZtring(nonintra_quant_mat, 16);
+ if (Value.size()==1)
+ Value.insert(0, _T("0"));
+ Matrix_nonintra+=Value;
+ }
+ }
+ else
+ Matrix_nonintra="Default";
+ if(shape==3) //Shape=GrayScale
+ {
+ for(size_t aux_comp_Pos=0; aux_comp_Pos<aux_comp_count; aux_comp_Pos++)
+ {
+ Get_SB (load_intra_quant_mat_grayscale, "load_intra_quant_mat_grayscale");
+ if(load_intra_quant_mat_grayscale)
+ for (int16u Pos=0; Pos<64; Pos++)
+ {
+ int8u intra_quant_mat_grayscale;
+ Get_S1 (8, intra_quant_mat_grayscale, "intra_quant_mat_grayscale");
+ if (!intra_quant_mat_grayscale)
+ break;
+ }
+ Get_SB (load_nonintra_quant_mat_grayscale, "load_nonintra_quant_mat_grayscale");
+ if(load_nonintra_quant_mat_grayscale)
+ for (int16u Pos=0; Pos<64; Pos++)
+ {
+ int8u nonintra_quant_mat_grayscale;
+ Get_S1 (8, nonintra_quant_mat_grayscale, "nonintra_quant_mat_grayscale");
+ if (!nonintra_quant_mat_grayscale)
+ break;
+ }
+ }
+ }
+ TEST_SB_END();
+ if (video_object_layer_verid!=1)
+ {
+ Get_SB (quarter_sample, "quarter_sample");
+ }
+ Get_SB (complexity_estimation_disable, "complexity_estimation_disable");
+ if (!complexity_estimation_disable)
+ {
+ Get_S1 (2, estimation_method, "estimation_method");
+ if (estimation_method==0 || estimation_method==1)
+ {
+ TEST_SB_SKIP( "shape_complexity_estimation_disable");
+ Get_SB (opaque, "opaque");
+ Get_SB (transparent, "transparent");
+ Get_SB (intra_cae, "intra_cae");
+ Get_SB (inter_cae, "inter_cae");
+ Get_SB (no_update, "no_update");
+ Get_SB (upsampling, "upsampling");
+ TEST_SB_END();
+ TEST_SB_SKIP( "texture_complexity_estimation_set_1_disable");
+ Get_SB (intra_blocks, "intra_blocks");
+ Get_SB (inter_blocks, "inter_blocks");
+ Get_SB (inter4v_blocks, "inter4v_blocks");
+ Get_SB (not_coded_blocks, "not_coded_blocks");
+ TEST_SB_END();
+ Mark_1 ();
+ TEST_SB_SKIP( "texture_complexity_estimation_set_2_disable");
+ Get_SB (dct_coefs, "dct_coefs");
+ Get_SB (dct_lines, "dct_lines");
+ Get_SB (vlc_symbols, "vlc_symbols");
+ Get_SB (vlc_bits, "vlc_bits");
+ TEST_SB_END();
+ TEST_SB_SKIP( "motion_compensation_complexity_disable");
+ Get_SB (apm, "apm");
+ Get_SB (npm, "npm");
+ Get_SB (interpolate_mc_q, "interpolate_mc_q");
+ Get_SB (forw_back_mc_q, "forw_back_mc_q");
+ Get_SB (halfpel2, "halfpel2");
+ Get_SB (halfpel4, "halfpel4");
+ TEST_SB_END();
+ Mark_1 ();
+ if (estimation_method==1)
+ {
+ TEST_SB_SKIP( "version2_complexity_estimation_disable");
+ Get_SB (sadct, "sadct");
+ Get_SB (quarterpel, "quarterpel");
+ TEST_SB_END();
+ }
+ }
+ }
+ Skip_SB( "resync_marker_disable");
+ TEST_SB_GET( data_partitioned, "data_partitioned");
+ Get_SB ( reversible_vlc, "reversible_vlc");
+ TEST_SB_END();
+ if (video_object_layer_verid!=1)
+ {
+ Get_SB (newpred_enable, "newpred_enable");
+ if (newpred_enable)
+ {
+ Skip_S1(2, "requested_upstream_message_type");
+ Skip_SB( "newpred_segment_type");
+ }
+ Get_SB (reduced_resolution_vop_enable, "reduced_resolution_vop_enable");
+ }
+ Get_SB (scalability, "scalability");
+ if (scalability==1)
+ {
+ bool Hierarchy;
+ Get_SB ( Hierarchy, "hierarchy_type");
+ Skip_S1(4, "ref_layer_id");
+ Skip_SB( "ref_layer_sampling_direc");
+ Skip_S1(5, "hor_sampling_factor_n");
+ Skip_S1(5, "hor_sampling_factor_m");
+ Skip_S1(5, "vert_sampling_factor_n");
+ Skip_S1(5, "vert_sampling_factor_m");
+ Get_SB ( enhancement_type, "enhancement_type");
+ if (shape==1 && Hierarchy==0) //Shape=Binary
+ {
+ Skip_SB( "use_ref_shape");
+ Skip_SB( "use_ref_texture");
+ Skip_S1(5, "shape_hor_sampling_factor_n");
+ Skip_S1(5, "shape_hor_sampling_factor_m");
+ Skip_S1(5, "shape_vert_sampling_factor_n");
+ Skip_S1(5, "shape_vert_sampling_factor_m");
+ }
+ }
+ }
+ else
+ {
+ if (video_object_layer_verid!=1)
+ {
+ TEST_SB_SKIP( "scalability");
+ Skip_S1(4, "ref_layer_id");
+ Skip_S1(5, "shape_hor_sampling_factor_n");
+ Skip_S1(5, "shape_hor_sampling_factor_m");
+ Skip_S1(5, "shape_vert_sampling_factor_n");
+ Skip_S1(5, "shape_vert_sampling_factor_m");
+ TEST_SB_END();
+ }
+ Skip_SB( "resync_marker_disable");
+ }
+ BS_End();
+
+ //Coherancy
+ if (object_layer_width==0 || object_layer_height==0 || object_layer_width/object_layer_height<0.1 || object_layer_width/object_layer_height>10)
+ 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_Info(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<Element_Size
+ && (Buffer[Buffer_Offset+Library_End_Offset]==0x0D
+ || Buffer[Buffer_Offset+Library_End_Offset]==0x0A
+ || Buffer[Buffer_Offset+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_Offset<Element_Size)
+ Skip_XX(Element_Size-Element_Offset, "junk");
+
+ //Cleanup
+ while(Temp.size()>3 && 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_Info("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; Pos<List.size(); Pos++)
+ {
+ if (List[Pos].size()==2)
+ user_data_start_SNC_Data(List[Pos][0])=List[Pos][1];
+ }
+}
+
+//---------------------------------------------------------------------------
+// Packet "B3"
+void File_Mpeg4v::group_of_vop_start()
+{
+ Element_Name("group_of_vop_start");
+
+ //Parsing
+ int8u Hours, Minutes, Seconds;
+ bool closed_gop, broken_link;
+ BS_Begin();
+ Get_S1 ( 5, Hours, "time_code_hours");
+ Get_S1 ( 6, Minutes, "time_code_minutes");
+ Mark_1();
+ Get_S1 ( 6, Seconds, "time_code_seconds");
+ 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);
+ Time+=_T(".000");
+ Element_Info(Time);
+
+ FILLING_BEGIN();
+ //Calculating
+ if (Time_Begin_Seconds==(int32u)-1)
+ Time_Begin_Seconds=60*60*Hours+60*Minutes+Seconds;
+ Time_End_Seconds=60*60*Hours+60*Minutes+Seconds;
+ Time_End_MilliSeconds=(int16u)-1;
+
+ //NextCode
+ NextCode_Test();
+ NextCode_Clear();
+ for (int8u Pos=0x00; Pos<0x1F; Pos++)
+ NextCode_Add(Pos); //video_object_start
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// Packet "B4"
+void File_Mpeg4v::video_session_error()
+{
+ Element_Name("video_session_error");
+}
+
+//---------------------------------------------------------------------------
+// Packet "B5"
+void File_Mpeg4v::visual_object_start()
+{
+ Element_Name("visual_object_start");
+
+ //Parsing
+ int8u visual_object_type;
+ BS_Begin();
+ TEST_SB_SKIP( "is_visual_object_identifier");
+ Get_S1 ( 4, visual_object_verid, "visual_object_verid"); Param_Info(Mpeg4v_visual_object_verid[visual_object_verid]);
+ Skip_BS( 3, "visual_object_priority");
+ TEST_SB_END();
+ Get_S1 ( 4, visual_object_type, "visual_object_type"); Param_Info(Mpeg4v_visual_object_type[visual_object_type]);
+ if (visual_object_type==1 || visual_object_type==2)
+ {
+ TEST_SB_SKIP( "video_signal_type");
+ Skip_S1(3, "video_format");
+ Skip_SB( "video_range");
+ TEST_SB_SKIP( "colour_description");
+ Skip_S1(8, "colour_primaries");
+ Skip_S1(8, "transfer_characteristics");
+ Skip_S1(8, "matrix_coefficients");
+ TEST_SB_END();
+ TEST_SB_END();
+ BS_End();
+
+ //Integrity
+ if (Element_Offset<Element_Size)
+ Trusted_IsNot("Size is wrong");
+ }
+
+ FILLING_BEGIN();
+ //NextCode
+ NextCode_Clear();
+ NextCode_Add(0xB2); //user_data
+ for (int8u Pos=0x00; Pos<0x2F; Pos++)
+ NextCode_Add(Pos); //video_object_start and video_object_layer_start
+
+ //Autorisation of other streams
+ Streams[0xB2].Searching_Payload=true;
+ for (int8u Pos=0x00; Pos<0x25; Pos++)
+ Streams[Pos].Searching_Payload=true; //video_object_start and video_object_layer_start
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// Packet "B6"
+void File_Mpeg4v::vop_start()
+{
+ //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++;
+
+ //Name
+ Element_Name("vop_start");
+ Element_Info(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_Info(Mpeg4v_vop_coding_type[vop_coding_type]);
+ Element_Info(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"); if (vop_time_increment_resolution) Param_Info(vop_time_increment*1000/vop_time_increment_resolution, " ms");
+ Mark_1 ();
+ Get_SB (vop_coded, "vop_coded");
+ if (vop_coded)
+ {
+ if (newpred_enable)
+ {
+ Skip_S4(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) NVOP_Count++; //VOP with no data
+ else if (vop_coding_type==0) IVOP_Count++; //Type I
+ else if (vop_coding_type==1) PVOP_Count++; //Type P
+ else if (vop_coding_type==2) BVOP_Count++; //Type B
+ else if (vop_coding_type==3) SVOP_Count++; //Type S
+
+
+ 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<Time_End_MilliSeconds)
+ Time+=1000;
+ Time_End_MilliSeconds=Time;
+ if (Time_Begin_MilliSeconds==(int16u)-1)
+ Time_Begin_MilliSeconds=Time_End_MilliSeconds;
+
+ if (Time_End_Seconds!=(int32u)-1)
+ Element_Info(Ztring().Duration_From_Milliseconds((int64u)(Time_End_Seconds*1000+Time_End_MilliSeconds)));
+ }
+
+ //NextCode
+ NextCode_Test();
+ NextCode_Clear();
+ for (int8u Pos=0x00; Pos<0x2F; Pos++)
+ NextCode_Add(Pos); //video_object_start and video_object_layer_start
+ NextCode_Add(0xB1); //visual_object_sequence_end
+ NextCode_Add(0xB3); //group_of_vop_start_code
+ NextCode_Add(0xB5); //visual_object_start
+ NextCode_Add(0xB6); //vop_start
+
+ //Filling only if not already done
+ if (Frame_Count==2 && !Status[IsAccepted])
+ Accept("MPEG-4 Visual");
+ if (Frame_Count>=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");
+ GoToFromEnd(1024*1024, "MPEG-4 Visual");
+ }
+ }
+ 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
diff --git a/src/thirdparty/MediaInfo/Video/File_Mpeg4v.h b/src/thirdparty/MediaInfo/Video/File_Mpeg4v.h
new file mode 100644
index 000000000..5921ca0ae
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Mpeg4v.h
@@ -0,0 +1,195 @@
+// File_Avc - Info for MPEG-4 Visual Visual files
+// Copyright (C) 2006-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about MPEG-4 Visual files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_Mpeg4vH
+#define MediaInfo_Mpeg4vH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#include "MediaInfo/Multiple/File_Mpeg4.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Mpeg4v
+//***************************************************************************
+
+class File_Mpeg4v : public File__Analyze
+{
+public :
+ //In
+ size_t 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 - 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<stream> Streams;
+
+ //Count of a Packets
+ size_t Frame_Count;
+ size_t IVOP_Count;
+ size_t PVOP_Count;
+ size_t BVOP_Count;
+ size_t SVOP_Count;
+ size_t NVOP_Count;
+ size_t Interlaced_Top;
+ size_t Interlaced_Bottom;
+
+ //From video_object_layer
+ size_t time_size;
+ 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 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;
+ 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;
+
+ //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
diff --git a/src/thirdparty/MediaInfo/Video/File_Mpegv.cpp b/src/thirdparty/MediaInfo/Video/File_Mpegv.cpp
new file mode 100644
index 000000000..25dbb3356
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Mpegv.cpp
@@ -0,0 +1,1974 @@
+// File_Mpegv - Info for MPEG Video files
+// Copyright (C) 2004-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#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[]=
+{
+ (float32) 0,
+ (float32)23.976,
+ (float32)24,
+ (float32)25,
+ (float32)29.97,
+ (float32)30,
+ (float32)50,
+ (float32)59.94,
+ (float32)60,
+ (float32) 0,
+ (float32) 0,
+ (float32) 0,
+ (float32) 0,
+ (float32) 0,
+ (float32) 0,
+ (float32) 0,
+};
+
+//---------------------------------------------------------------------------
+const char* Mpegv_Colorimetry_format[]=
+{
+ "",
+ "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",
+ "Spatial 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 "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_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+ #include "MediaInfo/Text/File_Cdp.h"
+ #include <cstring>
+#endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+#if defined(MEDIAINFO_AFDBARDATA_YES)
+ #include "MediaInfo/Video/File_AfdBarData.h"
+ #include <cstring>
+#endif //defined(MEDIAINFO_AFDBARDATA_YES)
+#if MEDIAINFO_EVENTS
+ #include "MediaInfo/MediaInfo_Events.h"
+#endif //MEDIAINFO_EVENTS
+using namespace ZenLib;
+
+#undef FILLING_BEGIN
+#define FILLING_BEGIN() \
+ while (Element_Offset<Element_Size && Buffer[Buffer_Offset+(size_t)Element_Offset]==0x00) \
+ Element_Offset++; \
+ if (Element_Offset!=Element_Size) \
+ Trusted_IsNot("Size error"); \
+ else if (Element_IsOK()) \
+ { \
+
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+namespace MediaInfoLib
+{
+//---------------------------------------------------------------------------
+
+//***************************************************************************
+// Infos
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+const float32 Mpegv_aspect_ratio1[]=
+{
+ (float32)0,
+ (float32)1,
+ (float32)0.6735,
+ (float32)0.7031, //16/9 PAL
+ (float32)0.7615,
+ (float32)0.8055,
+ (float32)0.8437, //16/9 NTSC
+ (float32)0.8935,
+ (float32)0.9375, //4/3 PAL
+ (float32)0.9815,
+ (float32)1.0255,
+ (float32)1.0695,
+ (float32)1.1250, //4/3 NTSC
+ (float32)1.1575,
+ (float32)1.2015,
+ (float32)0,
+};
+
+//---------------------------------------------------------------------------
+const float32 Mpegv_aspect_ratio2[]=
+{
+ (float32)0,
+ (float32)1,
+ (float32)4/(float32)3,
+ (float32)16/(float32)9,
+ (float32)2.21,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+ (float32)0,
+};
+
+//---------------------------------------------------------------------------
+const char* Mpegv_video_format[]=
+{
+ "Component",
+ "PAL",
+ "NTSC",
+ "SECAM",
+ "MAC",
+ "",
+ "",
+ "",
+};
+
+//---------------------------------------------------------------------------
+const char* Mpegv_picture_structure[]=
+{
+ "",
+ "T", //Top Field
+ "B", //Bottom Field
+ "F", //Frame
+};
+
+const char* Mpegv_picture_coding_type[]=
+{
+ "",
+ "I",
+ "P",
+ "B",
+ "D",
+ "",
+ "",
+ "",
+};
+
+const char* Mpegv_extension_start_code_identifier[]=
+{
+ "",
+ "Sequence",
+ "Sequence Display",
+ "Quant Matrix",
+ "Copyright",
+ "Sequence Scalable",
+ "",
+ "Picture Display",
+ "Picture Coding",
+ "Picture Spatial Scalable",
+ "Picture Temporal Scalable",
+ "Camera Parameters",
+ "ITU-T",
+ "",
+ "",
+ "",
+};
+
+//***************************************************************************
+// Constructor/Destructor
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+File_Mpegv::File_Mpegv()
+:File__Analyze()
+{
+ //Configuration
+ ParserName=_T("MPEG Video");
+ #if MEDIAINFO_EVENTS
+ ParserIDs[0]=MediaInfo_Parser_Mpegv;
+ StreamIDs_Width[0]=16;
+ #endif //MEDIAINFO_EVENTS
+ Trusted_Multiplier=2;
+ MustSynchronize=true;
+ Buffer_TotalBytes_FirstSynched_Max=64*1024;
+ PTS_DTS_Needed=true;
+ IsRawStream=true;
+
+ //In
+ MPEG_Version=1;
+ Frame_Count_Valid=MediaInfoLib::Config.ParseSpeed_Get()>=0.3?40:2;
+ FrameIsAlwaysComplete=false;
+ TimeCodeIsNotTrustable=false;
+ #if defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+ Cdp_Data=NULL;
+ #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+ #if defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_AFDBARDATA_YES)
+ AfdBarData_Data=NULL;
+ #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_AFDBARDATA_YES)
+
+ //temporal_reference
+ TemporalReference_Offset=0;
+ #if defined(MEDIAINFO_DTVCCTRANSPORT_YES)
+ GA94_03_Parser=NULL;
+ GA94_03_TemporalReference_Offset=0;
+ GA94_03_IsPresent=false;
+ CC___Parser=NULL;
+ CC___IsPresent=false;
+ #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES)
+ #if defined(MEDIAINFO_SCTE20_YES)
+ Scte_Parser=NULL;
+ Scte_TemporalReference_Offset=0;
+ Scte_IsPresent=false;
+ #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_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+ Cdp_Parser=NULL;
+ Cdp_IsPresent=false;
+ #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+ #if defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_AFDBARDATA_YES)
+ AfdBarData_Parser=NULL;
+ #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_AFDBARDATA_YES)
+
+ //Temp
+ SizeToAnalyse_Begin=1*1024*1024;
+ SizeToAnalyse_End=1*1024*1024;
+ Searching_TimeStamp_Start_DoneOneTime=false;
+ sequence_header_IsParsed=false;
+ Parsing_End_ForDTS=false;
+}
+
+//---------------------------------------------------------------------------
+File_Mpegv::~File_Mpegv()
+{
+ for (size_t Pos=0; Pos<TemporalReference.size(); Pos++)
+ delete TemporalReference[Pos]; //TemporalReference[Pos]=NULL;
+ #if defined(MEDIAINFO_DTVCCTRANSPORT_YES)
+ delete GA94_03_Parser; //GA94_03_Parser=NULL;
+ delete CC___Parser; //CC___Parser=NULL;
+ #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES)
+ #if defined(MEDIAINFO_SCTE20_YES)
+ delete Scte_Parser; //Scte_Parser=NULL;
+ #endif //defined(MEDIAINFO_SCTE20_YES)
+ #if defined(MEDIAINFO_AFDBARDATA_YES)
+ delete DTG1_Parser; //DTG1_Parser=NULL;
+ delete GA94_06_Parser; //GA94_06_Parser=NULL;
+ #endif //defined(MEDIAINFO_AFDBARDATA_YES)
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Mpegv::Streams_Fill()
+{
+ //Filling
+ Stream_Prepare(Stream_Video);
+
+ //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_Resolution, 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");
+ else if ((MPEG_Version==1 && bit_rate_value!=0x3FFFF) || MPEG_Version==2)
+ Fill(Stream_Video, 0, Video_BitRate_Mode, "CBR");
+ if (bit_rate_value_IsValid && (bit_rate_extension>0 || bit_rate_value!=0x3FFFF))
+ Fill(Stream_Video, 0, Video_BitRate_Nominal, ((((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)
+ {
+ //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)
+ {
+ 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, CodingType;
+ for (size_t Pos=0; Pos<TemporalReference.size(); Pos++)
+ if (TemporalReference[Pos] && TemporalReference[Pos]->HasPictureCoding)
+ {
+ TempRef+=TemporalReference[Pos]->top_field_first?"T":"B";
+ TempRef+=TemporalReference[Pos]->repeat_first_field?"3":"2";
+ CodingType+=Mpegv_picture_coding_type[TemporalReference[Pos]->picture_coding_type];
+ }
+ 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);
+ }
+ }
+
+ //GOP
+ std::vector<Ztring> GOPs;
+ size_t GOP_Frame_Count=0;
+ size_t GOP_BFrames_Max=0;
+ size_t I_Pos1=CodingType.find(_T('I'));
+ while (I_Pos1!=std::string::npos)
+ {
+ size_t I_Pos2=CodingType.find(_T('I'), I_Pos1+1);
+ if (I_Pos2!=std::string::npos)
+ {
+ std::vector<size_t> P_Positions;
+ size_t P_Position=I_Pos1;
+ do
+ {
+ P_Position=CodingType.find(_T('P'), P_Position+1);
+ if (P_Position<I_Pos2)
+ P_Positions.push_back(P_Position);
+ }
+ while (P_Position<I_Pos2);
+ Ztring GOP;
+ if (!P_Positions.empty())
+ {
+ GOP+=_T("M=")+Ztring::ToZtring(P_Positions[0]-I_Pos1)+_T(", ");
+ if (P_Positions[0]-I_Pos1>GOP_BFrames_Max)
+ GOP_BFrames_Max=P_Positions[0]-I_Pos1;
+ }
+ GOP+=_T("N=")+Ztring::ToZtring(I_Pos2-I_Pos1);
+ GOPs.push_back(GOP);
+ GOP_Frame_Count+=I_Pos2-I_Pos1;
+ }
+ I_Pos1=I_Pos2;
+ }
+
+ 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.empty())
+ {
+ size_t Unique=0;
+ for (size_t Pos=1; Pos<GOPs.size(); Pos++)
+ if (GOPs[Pos]!=GOPs[0])
+ Unique++;
+ if ((Frame_Count<Frame_Count_Valid*10 && Unique) || Unique>2) //In order to accept some unsynch //TODO: change the method, synching with next I-Frame
+ GOPs.clear(); //Not a fixed GOP
+ }
+ if (!GOPs.empty())
+ Fill(Stream_Video, 0, Video_Format_Settings_GOP, GOPs[0]);
+ }
+
+ //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]);
+
+ //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_IsParsed)
+ {
+ size_t Time_Begin=Time_Begin_Seconds*1000;
+ if (FrameRate)
+ Time_Begin+=(size_t)(Time_Begin_Frames*1000/FrameRate);
+ Fill(Stream_Video, 0, Video_Delay, Time_Begin);
+ 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")));
+ }
+
+ //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
+ NextCode_Clear();
+ NextCode_Add(0x00);
+ NextCode_Add(0xB8);
+ for (int8u Pos=0x00; Pos<=0xB9; Pos++)
+ Streams[Pos].Searching_Payload=false;
+ Streams[0xB8].Searching_TimeStamp_End=true;
+ if (IsSub)
+ Streams[0x00].Searching_TimeStamp_End=true;
+
+ //Caption may be in user_data, must be activated if full parsing is requested
+ if (MediaInfoLib::Config.ParseSpeed_Get()>=1)
+ {
+ Streams[0x00].Searching_Payload=true;
+ Streams[0xB2].Searching_Payload=true;
+ Streams[0xB3].Searching_Payload=true;
+ Streams[0xB5].Searching_Payload=true;
+ }
+}
+
+//---------------------------------------------------------------------------
+void File_Mpegv::Streams_Finish()
+{
+ //Duration
+ if (Time_End_NeedComplete && MediaInfoLib::Config.ParseSpeed_Get()!=1)
+ Time_End_Seconds=Error;
+ if (Time_End_Seconds!=Error)
+ {
+ size_t Time_Begin=Time_Begin_Seconds*1000;
+ size_t Time_End =Time_End_Seconds*1000;
+ if (FrameRate)
+ {
+ Time_Begin+=(size_t)(Time_Begin_Frames*1000/FrameRate);
+ Time_End +=(size_t)(Time_End_Frames *1000/FrameRate);
+ }
+ if (Time_End>Time_Begin)
+ Fill(Stream_Video, 0, Video_Duration, Time_End-Time_Begin);
+ }
+
+ //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);
+ Merge(*GA94_03_Parser);
+ }
+ if (CC___Parser && !CC___Parser->Status[IsFinished] && CC___Parser->Status[IsAccepted])
+ {
+ Finish(CC___Parser);
+ Merge(*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);
+ Merge(*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);
+ }
+ if (GA94_06_Parser && !GA94_06_Parser->Status[IsFinished] && GA94_06_Parser->Status[IsAccepted])
+ {
+ Finish(GA94_06_Parser);
+ Merge(*GA94_06_Parser);
+ }
+ #endif //defined(MEDIAINFO_AFDBARDATA_YES)
+ #if defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+ if (Cdp_Parser && !Cdp_Parser->Status[IsFinished] && Cdp_Parser->Status[IsAccepted])
+ {
+ Finish(Cdp_Parser);
+ Merge(*Cdp_Parser);
+ }
+ #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+ #if defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_AFDBARDATA_YES)
+ if (AfdBarData_Parser && !AfdBarData_Parser->Status[IsFinished] && AfdBarData_Parser->Status[IsAccepted])
+ {
+ Finish(AfdBarData_Parser);
+ Merge(*AfdBarData_Parser);
+ }
+ #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_AFDBARDATA_YES)
+
+ //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();
+ for (size_t Pos=0; Pos<TemporalReference.size(); Pos++)
+ delete TemporalReference[Pos]; //TemporalReference[Pos]=NULL;
+ TemporalReference.clear();
+ }
+}
+
+//***************************************************************************
+// Buffer - Synchro
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+bool File_Mpegv::Synched_Test()
+{
+ //Trailing 0xFF
+ while(Buffer_Offset<Buffer_Size && Buffer[Buffer_Offset]==0xFF)
+ Buffer_Offset++;
+
+ //Trailing 0x00
+ while(Buffer_Offset+3<=Buffer_Size && Buffer[Buffer_Offset+2]==0x00
+ && Buffer[Buffer_Offset+1]==0x00
+ && Buffer[Buffer_Offset ]==0x00)
+ Buffer_Offset++;
+
+ //Must have enough buffer for having header
+ if (Buffer_Offset+3>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;
+
+ //Quick search
+ if (Synched && !Header_Parser_QuickSearch())
+ return false;
+
+ //We continue
+ return true;
+}
+
+//---------------------------------------------------------------------------
+void File_Mpegv::Synched_Init()
+{
+ //Temp
+ Frame_Count=0;
+ 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_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;
+ aspect_ratio_information=0;
+ frame_rate_code=0;
+ profile_and_level_indication_profile=(int8u)-1;
+ profile_and_level_indication_level=(int8u)-1;
+ chroma_format=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
+ vbv_buffer_size_extension=0;
+ Time_End_NeedComplete=false;
+ 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;
+ bit_rate_value_IsValid=false;
+ profile_and_level_indication_escape=false;
+
+ //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
+}
+
+//***************************************************************************
+// Buffer - Global
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Mpegv::Read_Buffer_Unsynched()
+{
+ Time_End_Seconds=Error;
+ Time_End_Frames=(int8u)-1;
+
+ temporal_reference_Old=(int16u)-1;
+ for (size_t Pos=0; Pos<TemporalReference.size(); Pos++)
+ delete TemporalReference[Pos]; //TemporalReference[Pos]=NULL;
+ TemporalReference.clear();
+ TemporalReference_Offset=0;
+ #if defined(MEDIAINFO_DTVCCTRANSPORT_YES)
+ GA94_03_TemporalReference_Offset=0;
+ if (GA94_03_Parser)
+ GA94_03_Parser->Open_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_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+ if (Cdp_Parser)
+ Cdp_Parser->Open_Buffer_Unsynch();
+ #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+ #if defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_AFDBARDATA_YES)
+ if (AfdBarData_Parser)
+ AfdBarData_Parser->Open_Buffer_Unsynch();
+ #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_AFDBARDATA_YES)
+
+ //NextCode
+ NextCode_Clear();
+ NextCode_Add(0x00);
+ NextCode_Add(0xB8);
+}
+
+//***************************************************************************
+// Buffer - Per element
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Mpegv::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_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]!=0x00)
+ Buffer_Offset_Temp+=2;
+ if (Buffer_Offset_Temp<Buffer_Size && Buffer[Buffer_Offset_Temp-1]==0x00 || Buffer_Offset_Temp>=Buffer_Size)
+ 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;
+
+ //Synchronizing
+ Buffer_Offset+=4;
+ Synched=false;
+ if (!Synchronize_0x000001())
+ {
+ if (!IsSub && File_Offset+Buffer_Size==File_Size && !Status[IsFilled] && Frame_Count>=1)
+ {
+ //End of file, and we have some frames
+ Accept("MPEG Video");
+ Fill("MPEG Video");
+ Detect_EOF();
+ return false;
+ }
+ }
+ }
+
+ if (Buffer_Offset+3==Buffer_Size)
+ return false; //Sync is OK, but start_code is not available
+ if (!Synched)
+ 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_Offset<File_Size-SizeToAnalyse_End && MediaInfoLib::Config.ParseSpeed_Get()<=0.01))
+ {
+ if ((GA94_03_IsPresent || CC___IsPresent || Scte_IsPresent || Cdp_IsPresent) && Frame_Count<Frame_Count_Valid*10 //10 times the normal test
+ && !(!IsSub && File_Size>SizeToAnalyse_Begin*10+SizeToAnalyse_End*10 && File_Offset+Buffer_Offset+Element_Offset>SizeToAnalyse_Begin*10 && File_Offset+Buffer_Offset+Element_Offset<File_Size-SizeToAnalyse_End*10))
+ {
+ 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;
+ return;
+ }
+
+ //
+ Time_End_Seconds=Error;
+ Time_End_Frames=(int8u)-1;
+
+ //Autorisation of other streams
+ if (!IsSub)
+ Streams[0x00].Searching_TimeStamp_End=false;
+
+ //Jumping
+ if (!Status[IsFilled])
+ Fill("MPEG Video");
+
+ GoToFromEnd(SizeToAnalyse_End*2, "MPEG Video");
+ EOF_AlreadyDetected=true; //Sometimes called from Filling
+ }
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+// Packet "00"
+void File_Mpegv::picture_start()
+{
+ Element_Name("picture_start");
+
+ //Coherency
+ if (!NextCode_Test())
+ return;
+
+ //Parsing
+ BS_Begin();
+ Get_S2 (10, temporal_reference, "temporal_reference");
+ Get_S1 ( 3, picture_coding_type, "picture_coding_type"); Param_Info(Mpegv_picture_coding_type[picture_coding_type]);
+ Get_S2 (16, vbv_delay, "vbv_delay");
+ if (picture_coding_type==2 || picture_coding_type==3) //P or B
+ {
+ Skip_S1(1, "full_pel_forward_vector");
+ Skip_S1(3, "forward_f_code");
+ }
+ if (picture_coding_type==3) //B
+ {
+ Skip_S1(1, "full_pel_backward_vector");
+ Skip_S1(3, "backward_f_code");
+ }
+ bool extra_bit_picture;
+ do
+ {
+ Peek_SB(extra_bit_picture);
+ if (extra_bit_picture)
+ {
+ Skip_S1(1, "extra_bit_picture");
+ Skip_S1(8, "extra_information_picture");
+ }
+ }
+ while (extra_bit_picture);
+ BS_End();
+
+ FILLING_BEGIN();
+ if (temporal_reference==temporal_reference_Old)
+ {
+ Frame_Count--;
+ Frame_Count_InThisBlock--;
+ }
+ else
+ temporal_reference_Old=temporal_reference;
+
+ //Temporal reference
+ 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]->IsValid=true;
+
+ //Info
+ #if MEDIAINFO_TRACE
+ Element_Info(_T("Frame ")+Ztring::ToZtring(Frame_Count));
+ Element_Info(_T("picture_coding_type ")+Ztring().From_Local(Mpegv_picture_coding_type[picture_coding_type]));
+ Element_Info(_T("temporal_reference ")+Ztring::ToZtring(temporal_reference));
+ if (PTS!=(int64u)-1)
+ Element_Info(_T("PTS ")+Ztring().Duration_From_Milliseconds(float64_int64s(((float64)PTS)/1000000)));
+ if (DTS!=(int64u)-1)
+ Element_Info(_T("DTS ")+Ztring().Duration_From_Milliseconds(float64_int64s(((float64)DTS)/1000000)));
+ if (Time_End_Seconds!=Error)
+ {
+ int32u Time_End =Time_End_Seconds *1000;
+ if (FrameRate)
+ Time_End +=(int32u)float32_int32s(Time_End_Frames *1000/FrameRate);
+ size_t Hours = Time_End/60/60/1000;
+ size_t Minutes=(Time_End-(Hours*60*60*1000))/60/1000;
+ size_t Seconds=(Time_End-(Hours*60*60*1000)-(Minutes*60*1000))/1000;
+ size_t Milli =(Time_End-(Hours*60*60*1000)-(Minutes*60*1000)-(Seconds*1000));
+
+ 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(Milli);
+ }
+ Element_Info(_T("time_code ")+Time);
+ }
+ #endif //MEDIAINFO_TRACE
+
+ //Time
+ if (Time_End_Seconds!=Error)
+ {
+ 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
+ }
+ }
+
+ //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 (picture_coding_type==3)
+ BVOP_Count++;
+
+ //Need to parse?
+ if (!Streams[0x00].Searching_Payload)
+ return;
+
+ //NextCode
+ NextCode_Clear();
+ for (int64u Element_Name_Next=0x01; Element_Name_Next<=0x1F; 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<=0x1F; Pos++)
+ Streams[Pos].Searching_Payload=true;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// Packet "01" --> "AF"
+void File_Mpegv::slice_start()
+{
+ if (!NextCode_Test())
+ return;
+ Element_Name("slice_start");
+
+ //Parsing
+ Skip_XX(Element_Size, "data");
+
+ FILLING_BEGIN();
+ //NextCode
+ NextCode_Clear();
+ NextCode_Add(0x00);
+ NextCode_Add(0xB3);
+ NextCode_Add(0xB8);
+
+ //Autorisation of other streams
+ for (int8u Pos=0x01; Pos<=0x1F; Pos++)
+ Streams[Pos].Searching_Payload=false;
+
+ //Filling only if not already done
+ if (Frame_Count==2 && !Status[IsAccepted])
+ Accept("MPEG Video");
+ if (!Status[IsFilled] && (!CC___IsPresent && !Scte_IsPresent && !GA94_03_IsPresent && !Cdp_IsPresent && Frame_Count>=Frame_Count_Valid || Frame_Count>=Frame_Count_Valid*10))
+ Fill("MPEG Video");
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 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<Element_Size
+ && (Buffer[Buffer_Offset+Library_End_Offset]==0x0D
+ || Buffer[Buffer_Offset+Library_End_Offset]==0x0A
+ || Buffer[Buffer_Offset+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_Offset<Element_Size)
+ Skip_XX(Element_Size-Element_Offset, "junk");
+
+ //Cleanup
+ while(Temp.size()>3 && 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_Info("DVD Captions");
+
+ //Parsing
+ #if MEDIAINFO_DEMUX
+ Element_Code=0x434301F800000000LL;
+ #endif //MEDIAINFO_DEMUX
+ if (CC___Parser==NULL)
+ {
+ CC___IsPresent=true;
+ 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->PCR=PCR;
+ CC___Parser->PTS=PTS;
+ CC___Parser->DTS=DTS;
+ }
+ Demux(Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset), ContentType_MainStream);
+ 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;
+
+ Element_Info("SCTE 20");
+
+ //Coherency
+ if (TemporalReference_Offset+temporal_reference>=TemporalReference.size())
+ return;
+
+ //Purging too old orphelins
+ if (Scte_TemporalReference_Offset+8<TemporalReference_Offset+temporal_reference)
+ {
+ size_t Pos=TemporalReference_Offset+temporal_reference;
+ do
+ {
+ if (TemporalReference[Pos]==NULL || !TemporalReference[Pos]->IsValid)
+ break;
+ Pos--;
+ }
+ while (Pos>0);
+ Scte_TemporalReference_Offset=Pos+1;
+ }
+
+ if (TemporalReference[TemporalReference_Offset+temporal_reference]->Scte==NULL)
+ TemporalReference[TemporalReference_Offset+temporal_reference]->Scte=new temporalreference::buffer_data;
+ TemporalReference[TemporalReference_Offset+temporal_reference]->Scte->Size=(size_t)(Element_Size-Element_Offset);
+ delete[] TemporalReference[TemporalReference_Offset+temporal_reference]->Scte->Data;
+ TemporalReference[TemporalReference_Offset+temporal_reference]->Scte->Data=new int8u[(size_t)(Element_Size-Element_Offset)];
+ std::memcpy(TemporalReference[TemporalReference_Offset+temporal_reference]->Scte->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 Scte_Pos=Scte_TemporalReference_Offset; Scte_Pos<TemporalReference.size(); Scte_Pos++)
+ if (TemporalReference[Scte_Pos]==NULL || !TemporalReference[Scte_Pos]->IsValid || TemporalReference[Scte_Pos]->Scte==NULL)
+ CanBeParsed=false; //There is a missing field/frame
+ if (CanBeParsed)
+ {
+ for (size_t Scte_Pos=Scte_TemporalReference_Offset; Scte_Pos<TemporalReference.size(); Scte_Pos++)
+ {
+ Element_Begin("SCTE 20 data");
+
+ //Parsing
+ #if MEDIAINFO_DEMUX
+ Element_Code=0x0000000300000000LL;
+ #endif //MEDIAINFO_DEMUX
+ if (Scte_Parser==NULL)
+ {
+ Scte_Parser=new File_Scte20;
+ Open_Buffer_Init(Scte_Parser);
+ }
+ if (Scte_Parser->PTS_DTS_Needed)
+ {
+ Scte_Parser->PCR=PCR;
+ Scte_Parser->PTS=PTS;
+ Scte_Parser->DTS=DTS;
+ }
+ ((File_Scte20*)Scte_Parser)->picture_structure=TemporalReference[Scte_Pos]->picture_structure;
+ ((File_Scte20*)Scte_Parser)->progressive_sequence=progressive_sequence;
+ ((File_Scte20*)Scte_Parser)->progressive_frame=TemporalReference[Scte_Pos]->progressive_frame;
+ ((File_Scte20*)Scte_Parser)->top_field_first=TemporalReference[Scte_Pos]->top_field_first;
+ ((File_Scte20*)Scte_Parser)->repeat_first_field=TemporalReference[Scte_Pos]->repeat_first_field;
+ Demux(TemporalReference[Scte_Pos]->Scte->Data, TemporalReference[Scte_Pos]->Scte->Size, ContentType_MainStream);
+ Open_Buffer_Continue(Scte_Parser, TemporalReference[Scte_Pos]->Scte->Data, TemporalReference[Scte_Pos]->Scte->Size);
+
+ Element_End();
+ }
+ 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_Info("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;
+ }
+ if (DTG1_Parser->PTS_DTS_Needed)
+ {
+ DTG1_Parser->PCR=PCR;
+ DTG1_Parser->PTS=PTS;
+ DTG1_Parser->DTS=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;
+
+ Element_Info("DTVCC Transport");
+
+ //Coherency
+ if (TemporalReference_Offset+temporal_reference>=TemporalReference.size())
+ return;
+
+ //Purging too old orphelins
+ if (GA94_03_TemporalReference_Offset+8<TemporalReference_Offset+temporal_reference)
+ {
+ size_t Pos=TemporalReference_Offset+temporal_reference;
+ do
+ {
+ if (TemporalReference[Pos]==NULL || !TemporalReference[Pos]->IsValid)
+ break;
+ Pos--;
+ }
+ while (Pos>0);
+ GA94_03_TemporalReference_Offset=Pos+1;
+ }
+
+ 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_Pos<TemporalReference.size(); GA94_03_Pos++)
+ if (TemporalReference[GA94_03_Pos]==NULL || !TemporalReference[GA94_03_Pos]->IsValid || 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_Pos<TemporalReference.size(); GA94_03_Pos++)
+ {
+ Element_Begin("Reordered DTVCC Transport");
+
+ //Parsing
+ #if MEDIAINFO_DEMUX
+ Element_Code=0x4741393400000003LL;
+ #endif //MEDIAINFO_DEMUX
+ if (GA94_03_Parser==NULL)
+ {
+ GA94_03_Parser=new File_DtvccTransport;
+ Open_Buffer_Init(GA94_03_Parser);
+ ((File_DtvccTransport*)GA94_03_Parser)->Format=File_DtvccTransport::Format_A53_4_GA94_03;
+ }
+ if (GA94_03_Parser->PTS_DTS_Needed)
+ {
+ GA94_03_Parser->PCR=PCR;
+ GA94_03_Parser->PTS=PTS;
+ GA94_03_Parser->DTS=DTS;
+ }
+ Demux(TemporalReference[GA94_03_Pos]->GA94_03->Data, TemporalReference[GA94_03_Pos]->GA94_03->Size, ContentType_MainStream);
+ Open_Buffer_Continue(GA94_03_Parser, TemporalReference[GA94_03_Pos]->GA94_03->Data, TemporalReference[GA94_03_Pos]->GA94_03->Size);
+
+ Element_End();
+ }
+ 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_Info("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->PCR=PCR;
+ GA94_06_Parser->PTS=PTS;
+ GA94_06_Parser->DTS=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");
+
+ //Reading
+ int32u bit_rate_value_temp;
+ bool load_intra_quantiser_matrix, load_non_intra_quantiser_matrix;
+ 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"); if (vertical_size_value && Mpegv_aspect_ratio1[aspect_ratio_information]) Param_Info((float)horizontal_size_value/vertical_size_value/Mpegv_aspect_ratio1[aspect_ratio_information]); Param_Info(Mpegv_aspect_ratio2[aspect_ratio_information]);
+ Get_S1 ( 4, frame_rate_code, "frame_rate_code"); Param_Info(Mpegv_frame_rate[frame_rate_code]);
+ Get_S3 (18, bit_rate_value_temp, "bit_rate_value"); Param_Info(bit_rate_value_temp*400);
+ Mark_1 ();
+ Get_S2 (10, vbv_buffer_size_value, "vbv_buffer_size_value"); Param_Info(2*1024*((int32u)vbv_buffer_size_value), " bytes");
+ Skip_SB( "constrained_parameters_flag");
+ TEST_SB_GET(load_intra_quantiser_matrix, "load_intra_quantiser_matrix");
+ for (size_t Pos=0; Pos<64; Pos++)
+ {
+ int8u intra_quantiser;
+ Get_S1 (8, intra_quantiser, "intra_quantiser");
+ 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");
+ for (size_t Pos=0; Pos<64; Pos++)
+ {
+ int8u non_intra_quantiser;
+ Get_S1 (8, non_intra_quantiser, "non_intra_quantiser");
+ 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_Offset<Element_Size)
+ {
+ int64u NullBytes_Begin=Element_Size-1;
+ while (NullBytes_Begin>Element_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
+ temporal_reference_Old=(int16u)-1;
+ TemporalReference_Offset=TemporalReference.size();
+ if (TemporalReference_Offset>=0x800)
+ {
+ TemporalReference.erase(TemporalReference.begin(), TemporalReference.begin()+0x400);
+ if (0x400<TemporalReference_Offset)
+ TemporalReference_Offset-=0x400;
+ else
+ TemporalReference_Offset=0;
+ #if defined(MEDIAINFO_DTVCCTRANSPORT_YES)
+ if (0x400<GA94_03_TemporalReference_Offset)
+ GA94_03_TemporalReference_Offset-=0x400;
+ else
+ GA94_03_TemporalReference_Offset=0;
+ #endif //defined(MEDIAINFO_DTVCCTRANSPORT_YES)
+ #if defined(MEDIAINFO_SCTE20_YES)
+ if (0x400<Scte_TemporalReference_Offset)
+ Scte_TemporalReference_Offset-=0x400;
+ else
+ Scte_TemporalReference_Offset=0;
+ #endif //defined(MEDIAINFO_SCTE20_YES)
+ }
+
+ //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;
+ }
+
+ if (sequence_header_IsParsed)
+ return;
+
+ //NextCode
+ 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;
+ Streams[0xB8].Searching_TimeStamp_Start=true;
+ Streams[0xB8].Searching_TimeStamp_End=true;
+
+ //Temp
+ FrameRate=Mpegv_frame_rate[frame_rate_code];
+ SizeToAnalyse_Begin=bit_rate_value*50*2; //standard delay between TimeStamps is 0.7s, we try 2s to be sure to have at least 2 timestamps (for integrity checking)
+ SizeToAnalyse_End=bit_rate_value*50*2; //standard delay between TimeStamps is 0.7s, we try 2s to be sure
+
+ //Setting as OK
+ sequence_header_IsParsed=true;
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// Packet "B4"
+void File_Mpegv::sequence_error()
+{
+ Element_Name("sequence_error");
+}
+
+//---------------------------------------------------------------------------
+// Packet "B5"
+void File_Mpegv::extension_start()
+{
+ Element_Name("extension_start");
+ MPEG_Version=2; //extension_start only exists in MPEG-2 specs
+
+ //Parsing
+ int8u extension_start_code_identifier;
+ BS_Begin();
+ Get_S1 ( 4, extension_start_code_identifier, "extension_start_code_identifier"); Param_Info(Mpegv_extension_start_code_identifier[extension_start_code_identifier]);
+ Element_Info(Mpegv_extension_start_code_identifier[extension_start_code_identifier]);
+
+ switch (extension_start_code_identifier)
+ {
+ case 1 :{ //Sequence
+ //Parsing
+ Peek_SB(profile_and_level_indication_escape);
+ if (profile_and_level_indication_escape)
+ {
+ Get_S1 ( 8, profile_and_level_indication, "profile_and_level_indication"); Param_Info(Mpegv_profile_and_level_indication(profile_and_level_indication));
+ }
+ else
+ {
+ Skip_SB( "profile_and_level_indication_escape");
+ Get_S1 ( 3, profile_and_level_indication_profile, "profile_and_level_indication_profile"); Param_Info(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_Info(Mpegv_profile_and_level_indication_level[profile_and_level_indication_level]);
+ }
+ Get_SB ( progressive_sequence, "progressive_sequence");
+ Get_S1 ( 2, chroma_format, "chroma_format"); Param_Info(Mpegv_Colorimetry_format[chroma_format]);
+ Get_S1 ( 2, horizontal_size_extension, "horizontal_size_extension");
+ Get_S1 ( 2, vertical_size_extension, "vertical_size_extension");
+ Get_S2 (12, bit_rate_extension, "bit_rate_extension");
+ Mark_1 ();
+ Get_S1 ( 8, vbv_buffer_size_extension, "vbv_buffer_size_extension"); Param_Info(2*1024*((((int32u)vbv_buffer_size_extension)<<10)+vbv_buffer_size_value), " bytes");
+ Skip_SB( "low_delay");
+ Get_S1 ( 2, frame_rate_extension_n, "frame_rate_extension_n");
+ Get_S1 ( 5, frame_rate_extension_d, "frame_rate_extension_d");
+ BS_End();
+
+ FILLING_BEGIN();
+ if (frame_rate_extension_d)
+ FrameRate=(float)frame_rate_extension_n/frame_rate_extension_d;
+ FILLING_END();
+ }
+ break;
+ case 2 :{ //Sequence Display
+ //Parsing
+ Get_S1 ( 3, video_format, "video_format"); Param_Info(Mpegv_video_format[video_format]);
+ TEST_SB_SKIP( "load_intra_quantiser_matrix");
+ 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");
+ BS_End();
+ }
+ break;
+ case 8 :{ //Picture Coding
+ //Parsing
+ bool progressive_frame;
+ Skip_S1( 4, "f_code_forward_horizontal");
+ Skip_S1( 4, "f_code_forward_vertical");
+ Skip_S1( 4, "f_code_backward_horizontal");
+ Skip_S1( 4, "f_code_backward_vertical");
+ Skip_S1( 2, "intra_dc_precision");
+ Get_S1 ( 2, picture_structure, "picture_structure"); Param_Info(Mpegv_picture_structure[picture_structure]);
+ Get_SB ( top_field_first, "top_field_first");
+ Skip_SB( "frame_pred_frame_dct");
+ Skip_SB( "concealment_motion_vectors");
+ Skip_SB( "q_scale_type");
+ Skip_SB( "intra_vlc_format");
+ Skip_SB( "alternate_scan");
+ Get_SB ( repeat_first_field, "repeat_first_field");
+ Skip_SB( "chroma_420_type");
+ Get_SB ( progressive_frame, "progressive_frame");
+ TEST_SB_SKIP( "composite_display_flag");
+ Skip_SB( "v_axis");
+ Skip_S1( 3, "field_sequence");
+ Skip_SB( "sub_carrier");
+ Skip_S1( 7, "burst_amplitude");
+ Skip_S1( 8, "sub_carrier_phase");
+ TEST_SB_END();
+ BS_End();
+
+ FILLING_BEGIN();
+ if (progressive_frame==false)
+ {
+ if (picture_structure==3) //Frame
+ {
+ if (top_field_first)
+ Interlaced_Top++;
+ else
+ Interlaced_Bottom++;
+ FirstFieldFound=false;
+ if (TemporalReference_Offset+temporal_reference>=TemporalReference.size())
+ TemporalReference.resize(TemporalReference_Offset+temporal_reference+1);
+ 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);
+ 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;
+ }
+ }
+
+ if (picture_structure==2) //Bottom, and we want to add a frame only one time if 2 fields
+ Time_End_Frames--; //One frame
+
+ //CDP
+ #if defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+ if (Cdp_Data && !Cdp_Data->empty())
+ {
+ Cdp_IsPresent=true;
+
+ Element_Begin("CDP");
+
+ //Parsing
+ #if MEDIAINFO_DEMUX
+ Element_Code=0x000000B500000000LL;
+ #endif //MEDIAINFO_DEMUX
+ if (Cdp_Parser==NULL)
+ {
+ Cdp_Parser=new File_Cdp;
+ Open_Buffer_Init(Cdp_Parser);
+ }
+ Demux((*Cdp_Data)[0]->Data, (*Cdp_Data)[0]->Size, ContentType_MainStream);
+ if (!Cdp_Parser->Status[IsFinished])
+ {
+ if (Cdp_Parser->PTS_DTS_Needed)
+ Cdp_Parser->DTS=DTS;
+ ((File_Cdp*)Cdp_Parser)->AspectRatio=MPEG_Version==1?Mpegv_aspect_ratio1[aspect_ratio_information]:Mpegv_aspect_ratio2[aspect_ratio_information];
+ Open_Buffer_Continue(Cdp_Parser, (*Cdp_Data)[0]->Data, (*Cdp_Data)[0]->Size);
+ }
+
+ //Removing data from stack
+ delete (*Cdp_Data)[0]; //Cdp_Data[0]=NULL;
+ Cdp_Data->erase(Cdp_Data->begin());
+
+ Element_End();
+ }
+ #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+
+ //Active Format Description & Bar Data
+ #if defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_AFDBARDATA_YES)
+ if (AfdBarData_Data && !AfdBarData_Data->empty())
+ {
+ Element_Begin("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->DTS=DTS;
+ if (!AfdBarData_Parser->Status[IsFinished])
+ Open_Buffer_Continue(AfdBarData_Parser, (*AfdBarData_Data)[0]->Data, (*AfdBarData_Data)[0]->Size);
+
+ //Removing data from stack
+ delete (*AfdBarData_Data)[0]; //AfdBarData_Data[0]=NULL;
+ AfdBarData_Data->erase(AfdBarData_Data->begin());
+
+ Element_End();
+ }
+ #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_AFDBARDATA_YES)
+ FILLING_END();
+ }
+ 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 (!NextCode_Test())
+ return;
+ Element_Name("group_start");
+
+ //Reading
+ int8u Hours, Minutes, Seconds, Frames;
+ bool drop_frame_flag, closed_gop, broken_link;
+ 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_Info(Time);
+
+ FILLING_BEGIN();
+ //NextCode
+ NextCode_Clear();
+ NextCode_Add(0x00);
+ NextCode_Add(0xB2);
+ NextCode_Add(0xB5);
+ NextCode_Add(0xB8);
+
+ if (TimeCodeIsNotTrustable)
+ return;
+
+ //Calculating
+ if (Time_Begin_Seconds==Error)
+ {
+ Time_Begin_Seconds=60*60*Hours+60*Minutes+Seconds;
+ Time_Begin_Frames =Frames;
+ }
+ if (Time_Begin_Seconds==Error)
+ {
+ //Verifying if time_code is trustable
+ if ((size_t)60*60*Hours+60*Minutes+Seconds==Time_Begin_Seconds && Frames==Time_Begin_Frames)
+ Time_End_NeedComplete=true; //we can't trust time_code
+ }
+ if (!Time_End_NeedComplete)
+ {
+ Time_End_Seconds=60*60*Hours+60*Minutes+Seconds;
+ Time_End_Frames =Frames;
+ }
+ if (!group_start_IsParsed)
+ {
+ group_start_IsParsed=true;
+ group_start_drop_frame_flag=drop_frame_flag;
+ group_start_closed_gop=closed_gop;
+ group_start_broken_link=broken_link;
+ }
+
+ //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();
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_MPEGV_YES
+
diff --git a/src/thirdparty/MediaInfo/Video/File_Mpegv.h b/src/thirdparty/MediaInfo/Video/File_Mpegv.h
new file mode 100644
index 000000000..b0c2f95ba
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Mpegv.h
@@ -0,0 +1,266 @@
+// File_Mpegv - Info for MPEG Video files
+// Copyright (C) 2004-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about MPEG Video files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_MpegvH
+#define MediaInfo_MpegvH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+#if defined(MEDIAINFO_GXF_YES) && (defined(MEDIAINFO_CDP_YES) || defined(MEDIAINFO_AFDBARDATA_YES))
+ #include "MediaInfo/Multiple/File_Riff.h"
+#endif //MEDIAINFO_CDP_YES
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Mpegv
+//***************************************************************************
+
+class File_Mpegv : public File__Analyze
+{
+public :
+ //In
+ int8u MPEG_Version;
+ size_t Frame_Count_Valid;
+ bool FrameIsAlwaysComplete;
+ bool TimeCodeIsNotTrustable;
+ #if defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+ std::vector<File_Riff::buffered_data*>* Cdp_Data;
+ #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+ #if defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_AFDBARDATA_YES)
+ std::vector<File_Riff::buffered_data*>* AfdBarData_Data;
+ #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_AFDBARDATA_YES)
+
+ //Constructor/Destructor
+ File_Mpegv();
+ ~File_Mpegv();
+
+private :
+ //Streams management
+ void Streams_Fill();
+ void Streams_Finish();
+
+ //Buffer - File header
+ void Read_Buffer_Unsynched();
+ 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();
+
+ //EOF
+ void Detect_EOF();
+
+ //Elements
+ void picture_start();
+ void slice_start();
+ 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();
+
+ //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<stream> 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)
+ buffer_data* Scte;
+ #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
+ #if defined(MEDIAINFO_SCTE20_YES)
+ Scte=NULL;
+ #endif //MEDIAINFO_SCTE20_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)
+ delete Scte; //Scte=NULL;
+ #endif //MEDIAINFO_SCTE20_YES
+ }
+ };
+ std::vector<temporalreference*> TemporalReference; //per temporal_reference
+ size_t TemporalReference_Offset;
+ #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_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+ File__Analyze* Cdp_Parser;
+ bool Cdp_IsPresent;
+ #endif //defined(MEDIAINFO_GXF_YES) && defined(MEDIAINFO_CDP_YES)
+ #if defined(MEDIAINFO_GXF_YES) && 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;
+ size_t Frame_Count;
+ size_t BVOP_Count;
+ size_t progressive_frame_Count;
+ size_t Interlaced_Top;
+ size_t Interlaced_Bottom;
+ 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
+ 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 display_horizontal_size;
+ int16u display_vertical_size;
+ int16u vbv_delay;
+ int16u vbv_buffer_size_value;
+ 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 picture_structure;
+ int8u vbv_buffer_size_extension;
+ bool Time_End_NeedComplete;
+ bool load_intra_quantiser_matrix;
+ bool load_non_intra_quantiser_matrix;
+ bool progressive_sequence;
+ bool top_field_first;
+ bool repeat_first_field;
+ bool FirstFieldFound;
+ bool sequence_header_IsParsed;
+ bool group_start_IsParsed;
+ 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;
+};
+
+} //NameSpace
+
+#endif
+
diff --git a/src/thirdparty/MediaInfo/Video/File_Theora.cpp b/src/thirdparty/MediaInfo/Video/File_Theora.cpp
new file mode 100644
index 000000000..7a978bf4e
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Theora.cpp
@@ -0,0 +1,141 @@
+// File_Theora - Info for Theora files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Note : the buffer must be given in ONE call
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_THEORA_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Video/File_Theora.h"
+using namespace std;
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Format
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Theora::Header_Parse()
+{
+ //Filling
+ Header_Fill_Code(0, "Theora");
+ Header_Fill_Size(Element_Size);
+}
+
+//---------------------------------------------------------------------------
+void File_Theora::Data_Parse()
+{
+ //Parsing
+ if (Status[IsAccepted])
+ Setup();
+ else
+ Identification();
+}
+
+//***************************************************************************
+// Elements
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+void File_Theora::Identification()
+{
+ Element_Name("Identification");
+
+ //Parsing
+ int32u Version, PICW=0, PICH=0, FRN=0, FRD=0, PARN=0, PARD=0, NOMBR=0;
+ Skip_B1 ( "Signature");
+ Skip_Local(6, "Signature");
+ Get_B3 (Version, "Version");
+ if ((Version&0x030200)==0x030200) //Version 3.2.x
+ {
+ Skip_B2( "FMBW");
+ Skip_B2( "FMBH");
+ Get_B3 (PICW, "PICW");
+ Get_B3 (PICH, "PICH");
+ Skip_B1( "PICX");
+ Skip_B1( "PICY");
+ Get_B4 (FRN, "FRN");
+ Get_B4 (FRD, "FRD");
+ Get_B3 (PARN, "PARN");
+ Get_B3 (PARD, "PARD");
+ Skip_B1( "CS"); // //0=4:2:0, 2=4:2:2, 3=4:4:4
+ Get_B3 (NOMBR, "NOMBR"); //The nominal bitrate of the stream
+ BS_Begin();
+ Skip_BS( 6, "QUAL"); //The quality hint.
+ Skip_BS( 5, "KFGSHIFT");
+ Skip_BS( 2, "PF"); //The Pixel Format
+ Skip_BS( 3, "Reserved");
+ BS_End();
+ }
+
+ //Filling
+ FILLING_BEGIN()
+ Accept("Theora");
+
+ Stream_Prepare(Stream_Video);
+ Fill(Stream_Video, StreamPos_Last, Video_Format, "Theora");
+ Fill(Stream_Video, StreamPos_Last, Video_Codec, "Theora");
+ if ((Version&0x030200)!=0x030200) //Version 3.2.x
+ return;
+ if (FRN && FRD)
+ Fill(Stream_Video, StreamPos_Last, Video_FrameRate, ((float)FRN)/FRD, 3);
+ float PixelRatio=1;
+ if (PARN && PARD)
+ PixelRatio=((float)PARN)/(float)PARD;
+ Fill(Stream_Video, StreamPos_Last, Video_Width, PICW);
+ Fill(Stream_Video, StreamPos_Last, Video_Height, PICH);
+ Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, ((float)PICW)/((float)PICH)*PixelRatio, 3, true);
+ if (NOMBR)
+ Fill(Stream_Video, StreamPos_Last, Video_BitRate_Nominal, NOMBR);
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+void File_Theora::Setup()
+{
+ Element_Name("Setup");
+
+ //Parsing
+ Skip_XX(Element_Size, "Unknown");
+
+ Finish("Theora");
+}
+
+//***************************************************************************
+// C++
+//***************************************************************************
+
+} //NameSpace
+
+#endif //MEDIAINFO_THEORA_YES
diff --git a/src/thirdparty/MediaInfo/Video/File_Theora.h b/src/thirdparty/MediaInfo/Video/File_Theora.h
new file mode 100644
index 000000000..1b66a735b
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Theora.h
@@ -0,0 +1,58 @@
+// File_Theora - Info for Theora files
+// Copyright (C) 2008-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about Theora files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_File_TheoraH
+#define MediaInfo_File_TheoraH
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Theora
+//***************************************************************************
+
+class File_Theora : public File__Analyze
+{
+private :
+ //Buffer - Per element
+ void Header_Parse();
+ void Data_Parse();
+
+ //Elements
+ void Identification();
+ void Setup();
+};
+
+} //NameSpace
+
+#endif
diff --git a/src/thirdparty/MediaInfo/Video/File_Vc1.cpp b/src/thirdparty/MediaInfo/Video/File_Vc1.cpp
new file mode 100644
index 000000000..53a6e0301
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Vc1.cpp
@@ -0,0 +1,949 @@
+// File_Vc1 - Info for VC-1 files
+// Copyright (C) 2007-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+// Compilation conditions
+#include "MediaInfo/Setup.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#if defined(MEDIAINFO_VC1_YES)
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/Video/File_Vc1.h"
+#include "ZenLib/BitStream.h"
+#undef FILLING_BEGIN
+#define FILLING_BEGIN() \
+ while (Element_Offset<Element_Size && Buffer[Buffer_Offset+(size_t)Element_Offset]==0x00) \
+ Element_Offset++; \
+ if (Element_Offset!=Element_Size) \
+ Trusted_IsNot("Size error"); \
+ else if (Element_IsOK()) \
+ {
+#include <cmath>
+using namespace std;
+using namespace ZenLib;
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Infos
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+const char* Vc1_Profile[]=
+{
+ "SP",
+ "MP",
+ "CP",
+ "AP",
+};
+
+//---------------------------------------------------------------------------
+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},
+};
+
+//---------------------------------------------------------------------------
+int32u Vc1_ptype(int8u Size, int32u Value)
+{
+ switch (Size)
+ {
+ case 1 :
+ switch (Value)
+ {
+ case 0x0 : return 1;
+ default : return (int32u)-1;
+ }
+ case 2 :
+ switch (Value)
+ {
+ case 0x2 : return 2;
+ default : return (int32u)-1;
+ }
+ case 3 :
+ switch (Value)
+ {
+ case 0x6 : return 0;
+ default : return (int32u)-1;
+ }
+ case 4 :
+ switch (Value)
+ {
+ case 0xE : return 3;
+ case 0xF : return 4;
+ default : return (int32u)-1;
+ }
+ default: return (int32u)-1;
+ }
+};
+
+//---------------------------------------------------------------------------
+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
+ MustSynchronize=true;
+ Buffer_TotalBytes_FirstSynched_Max=64*1024;
+
+ //In
+ Frame_Count_Valid=30;
+ FrameIsAlwaysComplete=false;
+ From_WMV3=false;
+ Only_0D=false;
+
+ //Temp
+ EntryPoint_Parsed=false;
+}
+
+//***************************************************************************
+// Streams management
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+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
+
+ //Calculating - FrameRate
+ float32 FrameRate=0;
+ if (framerate_present)
+ {
+ if (framerate_form)
+ FrameRate=((float32)(framerateexp+1))/(float32)32;
+ else if (Vc1_FrameRate_dr(frameratecode_dr))
+ FrameRate=Vc1_FrameRate_enr(frameratecode_enr)/Vc1_FrameRate_dr(frameratecode_dr);
+ }
+
+ //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_Resolution, 8);
+
+ Ztring Profile=Vc1_Profile[profile];
+ if (profile==3)
+ 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_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<int16u, temporalreference>::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; Pos<hrd_buffers.size(); Pos++)
+ Fill(Stream_Video, 0, Video_BufferSize, hrd_buffers[Pos]);
+}
+
+//---------------------------------------------------------------------------
+void File_Vc1::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 - 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+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_Vc1::Synched_Init()
+{
+ //Count
+ Frame_Count=0;
+ Interlaced_Top=0;
+ Interlaced_Bottom=0;
+ PictureFormat_Count.resize(4);
+
+ //Temp
+ coded_width=0;
+ coded_height=0;
+ framerateexp=0;
+ frameratecode_enr=0;
+ frameratecode_dr=0;
+ profile=0;
+ level=0;
+ colordiff_format=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;
+
+ TemporalReference_Offset=0;
+
+ //Default stream values
+ Streams.resize(0x100);
+ Streams[0x0F].Searching_Payload=true;
+}
+
+//***************************************************************************
+// Buffer
+//***************************************************************************
+
+//---------------------------------------------------------------------------
+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
+ 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));
+}
+
+//---------------------------------------------------------------------------
+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]!=0x00)
+ Buffer_Offset_Temp+=2;
+ if (Buffer_Offset_Temp<Buffer_Size && Buffer[Buffer_Offset_Temp-1]==0x00 || Buffer_Offset_Temp>=Buffer_Size)
+ 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_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_0x000001())
+ 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()
+{
+ //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++;
+
+ //Name
+ Element_Name("FrameHeader");
+ Element_Info(Ztring(_T("Frame ")+Ztring::ToZtring(Frame_Count)));
+
+ //Parsing
+ BS_Begin();
+ int8u ptype;
+ 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_Info(Vc1_PictureFormat[PictureFormat]);
+ PictureFormat_Count[PictureFormat]++;
+
+ if (PictureFormat==2) //Interlaced Field
+ {
+ int8u ptype_;
+ Get_S1 ( 3, ptype_, "ptype");
+ if (ptype_<5)
+ {
+ Param_Info(Vc1_Type[Vc1_FieldTypeTable[ptype_][0]]); Element_Info(Vc1_Type[Vc1_FieldTypeTable[ptype_][0]]); //First field
+ Param_Info(Vc1_Type[Vc1_FieldTypeTable[ptype_][1]]); Element_Info(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
+ {
+ int32u ptype_;
+ Get_VL (Vc1_ptype, ptype_, "ptype"); if (ptype_<5) {Param_Info(Vc1_Type[(size_t)ptype_]); Element_Info(Vc1_Type[(size_t)ptype_]);}
+ ptype=(int8u)ptype_;
+ }
+
+ 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<TemporalReference_Waiting.size(); Pos++) //All B frames (not the first frame, which is I or P)
+ {
+ TemporalReference_Offset++;
+ TemporalReference[TemporalReference_Offset]=TemporalReference_Waiting[Pos];
+ }
+ TemporalReference_Offset++;
+ TemporalReference[TemporalReference_Offset]=TemporalReference_Waiting[0];
+ TemporalReference_Waiting.clear();
+ }
+
+ //We must wait for having another I or P picture
+ temporalreference Temp;
+ Temp.top_field_first=tff;
+ Temp.repeat_first_field=rff;
+ TemporalReference_Waiting.push_back(Temp);
+ }
+
+ }
+ }
+ else
+ {
+ int8u rptfrm=0;
+ if (pulldown)
+ {
+ Get_S1 ( 2, rptfrm, "rptfrm - repeate frame");
+ }
+ }
+
+ /*
+ if (panscan_flag)
+ {
+ //TODO
+ }
+
+ if (ptype!=4) //!=Skipping
+ {
+ bool rndctrl;
+ Get_SB( rndctrl, "rndctrl - rounding control");
+ if (rndctrl && (ptype==0 || ptype==3)) //I or BI type
+ Trusted_IsNot("Should not be true!");
+
+ if (interlace)
+ Skip_SB( "uvsamp - uv sampling mode");
+
+ if (finterpflag && PictureFormat==0) //Progressive frame
+ Skip_SB( "interrpfrm");
+
+ if (PictureFormat!=1) //!=Interlaced frame
+ {
+ if (ptype==2 //Type B
+ || (ptype==3 && PictureFormat==2)) //Type BI and Interlaced field
+ Skip_VL(Vc1_bfraction, "bfraction");
+ }
+ }
+ */
+ }
+ BS_End();
+ if (Element_Size-Element_Offset)
+ Skip_XX(Element_Size-Element_Offset, "Data");
+
+ FILLING_BEGIN();
+ //NextCode
+ NextCode_Test();
+ NextCode_Clear();
+ NextCode_Add(0x0D);
+ NextCode_Add(0x0F);
+
+ //Autorisation of other streams
+ Streams[0x0D].Searching_Payload=true;
+ Streams[0x0F].Searching_Payload=true;
+
+ //Filling only if not already done
+ if (!Status[IsFilled] && Frame_Count>=Frame_Count_Valid && MediaInfoLib::Config.ParseSpeed_Get()<1)
+ Finish("VC-1");
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// 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; Pos<hrd_num_leaky_buckets; Pos++)
+ {
+ Element_Begin("leaky_bucket");
+ Skip_S1( 8, "hrd_full");
+ Element_End();
+ }
+ TEST_SB_SKIP( "coded_size_flag");
+ Info_S2(12, coded_width, "coded_width"); Param_Info((coded_width+1)*2, " pixels");
+ Info_S2(12, coded_height, "coded_height"); Param_Info((coded_height+1)*2, " pixels");
+ TEST_SB_END();
+ if (extended_mv)
+ Skip_SB( "extended_dmv");
+ TEST_SB_SKIP( "range_mapy_flag");
+ Skip_S1( 3, "range_mapy");
+ TEST_SB_END();
+ TEST_SB_SKIP( "range_mapuv_flag");
+ Skip_S1( 3, "range_mapuv");
+ TEST_SB_END();
+ Mark_1();
+ BS_End();
+
+ FILLING_BEGIN();
+ //NextCode
+ NextCode_Test();
+ NextCode_Clear();
+ NextCode_Add(0x0D);
+
+ //Autorisation of other streams
+ Streams[0x0D].Searching_Payload=true;
+
+ EntryPoint_Parsed=true;
+ if (!Status[IsAccepted])
+ Accept("VC-1");
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// Packet "0F"
+void File_Vc1::SequenceHeader()
+{
+ Element_Name("SequenceHeader");
+
+ //Parsing
+ BS_Begin();
+ Get_S1 ( 2, profile, "profile"); Param_Info(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_Info(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_Info((coded_width+1)*2, " pixels");
+ Get_S2 (12, coded_height, "max_coded_height"); Param_Info((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_Info(display_x+1, " pixels");
+ Info_S2(14, display_y, "display_vert_size"); Param_Info(display_y+1, " pixels");
+ TEST_SB_SKIP( "aspectratio_flag");
+ Get_S1 ( 4, AspectRatio, "aspect_ratio"); Param_Info(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_Info((float32)((framerateexp+1)/32.0), 3, " fps");
+ TESTELSE_SB_ELSE( "framerateind");
+ Get_S1 ( 8, frameratecode_enr, "frameratenr"); Param_Info(Vc1_FrameRate_enr(frameratecode_enr));
+ Get_S1 ( 4, frameratecode_dr, "frameratedr"); Param_Info(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<hrd_num_leaky_buckets; Pos++)
+ {
+ Element_Begin("leaky_bucket");
+ int16u hrd_buffer;
+ Skip_S2(16, "hrd_rate");
+ Get_S2(16, hrd_buffer, "hrd_buffer");
+ int32u hrd_buffer_value=(int32u)((hrd_buffer+1)*pow(2.0, 1+buffer_size_exponent)); Param_Info(hrd_buffer_value, " bytes");
+ Element_End();
+
+ //Filling
+ hrd_buffers.push_back(hrd_buffer_value);
+ }
+ TEST_SB_END();
+ }
+ else //forbidden
+ {
+ Element_DoNotTrust("Forbidden value");
+ }
+ Mark_1();
+ BS_End();
+
+ FILLING_BEGIN();
+ //NextCode
+ NextCode_Clear();
+ NextCode_Add(0x0D);
+ NextCode_Add(0x0E);
+
+ //Autorisation of other streams
+ Streams[0x0D].Searching_Payload=true;
+ Streams[0x0E].Searching_Payload=true;
+
+ if (From_WMV3)
+ {
+ if (!Status[IsAccepted])
+ Accept("VC-1");
+ Finish("VC-1");
+ }
+ FILLING_END();
+}
+
+//---------------------------------------------------------------------------
+// Packet "1B"
+void File_Vc1::UserDefinedSlice()
+{
+ Element_Name("UserDefinedSlice");
+}
+
+//---------------------------------------------------------------------------
+// Packet "1C"
+void File_Vc1::UserDefinedField()
+{
+ Element_Name("UserDefinedField");
+}
+
+//---------------------------------------------------------------------------
+// Packet "1D"
+void File_Vc1::UserDefinedFrameHeader()
+{
+ Element_Name("UserDefinedFrameHeader");
+}
+
+//---------------------------------------------------------------------------
+// Packet "1E"
+void File_Vc1::UserDefinedEntryPointHeader()
+{
+ Element_Name("UserDefinedEntryPointHeader");
+}
+
+//---------------------------------------------------------------------------
+// Packet "1F"
+void File_Vc1::UserDefinedSequenceHeader()
+{
+ Element_Name("UserDefinedSequenceHeader");
+}
+
+} //NameSpace
+
+#endif //MEDIAINFO_VC1_YES
+
diff --git a/src/thirdparty/MediaInfo/Video/File_Vc1.h b/src/thirdparty/MediaInfo/Video/File_Vc1.h
new file mode 100644
index 000000000..101a9bbf7
--- /dev/null
+++ b/src/thirdparty/MediaInfo/Video/File_Vc1.h
@@ -0,0 +1,155 @@
+// File_Vc1 - Info for MPEG Video files
+// Copyright (C) 2004-2010 MediaArea.net SARL, Info@MediaArea.net
+//
+// This library is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library. If not, see <http://www.gnu.org/licenses/>.
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// Information about MPEG Video files
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------------------------------------------------------------
+#ifndef MediaInfo_Vc1H
+#define MediaInfo_Vc1H
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+#include "MediaInfo/File__Analyze.h"
+//---------------------------------------------------------------------------
+
+namespace MediaInfoLib
+{
+
+//***************************************************************************
+// Class File_Vc1
+//***************************************************************************
+
+class File_Vc1 : public File__Analyze
+{
+public :
+ //In
+ size_t Frame_Count_Valid;
+ bool FrameIsAlwaysComplete;
+ bool From_WMV3;
+ bool Only_0D;
+
+ //Constructor/Destructor
+ File_Vc1();
+
+private :
+ //Streams management
+ void Streams_Fill();
+ void Streams_Finish();
+
+ //Buffer - File header
+ bool FileHeader_Begin();
+
+ //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 EndOfSequence();
+ void Slice();
+ void Field();
+ void FrameHeader();
+ void EntryPointHeader();
+ void SequenceHeader();
+ void UserDefinedSlice();
+ void UserDefinedField();
+ void UserDefinedFrameHeader();
+ void UserDefinedEntryPointHeader();
+ void UserDefinedSequenceHeader();
+
+ //Count
+ size_t Frame_Count;
+ size_t Interlaced_Top;
+ size_t Interlaced_Bottom;
+ std::vector<size_t> PictureFormat_Count;
+
+ //From SequenceHeader
+ std::vector<int32u> 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<stream> Streams;
+
+ //Temporal reference
+ struct temporalreference
+ {
+ bool top_field_first;
+ bool repeat_first_field;
+ };
+ std::map<int16u, temporalreference> TemporalReference; //int32u is the reference
+ std::vector<temporalreference> 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;
+ bool EntryPoint_Parsed;
+
+ //Error controls
+ std::vector<int8u> Frame_ShouldBe;
+};
+
+} //NameSpace
+
+#endif