aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Hochecker <fernetmenta@online.de>2016-05-01 08:30:15 +0200
committerRainer Hochecker <fernetmenta@online.de>2016-05-01 08:30:15 +0200
commit0bae23930dff00590a0400ba1dd210729f98fb10 (patch)
tree35a56bf6604fee2fc8f78e565e9ba79b1c15176c
parenta09f146c0ff4820269f57612264af12098fbc9c0 (diff)
parent8c06005e61d270cbffa5fd354906a3d45119e448 (diff)
Merge pull request #9702 from FernetMenta/vtb
VideoPlayer: OSX/iOS - use ffmpeg videotoolbox
-rw-r--r--Kodi.xcodeproj/project.pbxproj99
-rw-r--r--addons/resource.language.en_gb/resources/strings.po6
-rw-r--r--configure.ac53
-rw-r--r--system/settings/settings.xml12
-rw-r--r--system/shaders/output.glsl10
-rw-r--r--tools/darwin/Configurations/App-OSX.xcconfig2
-rw-r--r--tools/depends/configure.ac4
-rw-r--r--tools/depends/target/ffmpeg/Makefile5
-rw-r--r--xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp6
-rw-r--r--xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp27
-rw-r--r--xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h12
-rw-r--r--xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.cpp1704
-rw-r--r--xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.h89
-rw-r--r--xbmc/cores/VideoPlayer/DVDCodecs/Video/VDA.cpp269
-rw-r--r--xbmc/cores/VideoPlayer/DVDCodecs/Video/VTB.cpp123
-rw-r--r--xbmc/cores/VideoPlayer/DVDCodecs/Video/VTB.h (renamed from xbmc/cores/VideoPlayer/DVDCodecs/Video/VDA.h)14
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/CMakeLists.txt8
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/Makefile.in4
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVDA.cpp174
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTB.cpp317
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTBGL.cpp209
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTBGL.h (renamed from xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVDA.h)6
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTBGLES.cpp261
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTBGLES.h (renamed from xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTB.h)36
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp3
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp7
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp10
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/GLSLOutput.cpp6
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShader.cpp8
-rw-r--r--xbmc/platform/darwin/DarwinUtils.mm38
-rw-r--r--xbmc/platform/darwin/ios/IOSEAGLView.h1
-rw-r--r--xbmc/platform/darwin/ios/IOSEAGLView.mm1
-rw-r--r--xbmc/platform/darwin/ios/XBMCController.h1
-rw-r--r--xbmc/platform/darwin/ios/XBMCController.mm5
-rw-r--r--xbmc/settings/SettingConditions.cpp9
-rw-r--r--xbmc/settings/Settings.cpp3
-rw-r--r--xbmc/settings/Settings.h3
-rw-r--r--xbmc/windowing/osx/WinSystemIOS.h9
-rw-r--r--xbmc/windowing/osx/WinSystemIOS.mm6
39 files changed, 774 insertions, 2786 deletions
diff --git a/Kodi.xcodeproj/project.pbxproj b/Kodi.xcodeproj/project.pbxproj
index 70ef8fe732..b9075794ac 100644
--- a/Kodi.xcodeproj/project.pbxproj
+++ b/Kodi.xcodeproj/project.pbxproj
@@ -245,7 +245,6 @@
43348AA4107747CD00F859CF /* Edl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43348AA1107747CD00F859CF /* Edl.cpp */; };
43348AAE1077486D00F859CF /* PlayerCoreFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43348AA81077486D00F859CF /* PlayerCoreFactory.cpp */; };
43348AAF1077486D00F859CF /* PlayerSelectionRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43348AAA1077486D00F859CF /* PlayerSelectionRule.cpp */; };
- 551C3A45175A12010051AAAD /* VDA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 551C3A43175A12010051AAAD /* VDA.cpp */; };
552840CC1626163B00ED1333 /* UPnPPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 552840CA1626163B00ED1333 /* UPnPPlayer.cpp */; settings = {COMPILER_FLAGS = "-I$SRCROOT/lib/libUPnP -I$SRCROOT/lib/libUPnP/Neptune/Source/Core -I$SRCROOT/lib/libUPnP/Platinum/Source/Core -I$SRCROOT/lib/libUPnP/Platinum/Source/Platinum -I$SRCROOT/lib/libUPnP/Platinum/Source/Extras -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaServer -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaConnect -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaRenderer"; }; };
5558ED10176396CD00118C35 /* StereoscopicsManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5558ED0E176396CD00118C35 /* StereoscopicsManager.cpp */; };
55611BA31766672F00754072 /* RenderFlags.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 55611BA21766672F00754072 /* RenderFlags.cpp */; };
@@ -398,6 +397,7 @@
7C7CEAF1165629530059C9EB /* AELimiter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C7CEAEF165629530059C9EB /* AELimiter.cpp */; };
7C84A59E12FA3C1600CD1714 /* SourcesDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C84A59C12FA3C1600CD1714 /* SourcesDirectory.cpp */; };
7C87B2CE162CE39600EF897D /* PlayerController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C87B2CC162CE39600EF897D /* PlayerController.cpp */; };
+ 7C87F5C81CD1E9D4009AC381 /* RendererVTBGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C87F5C61CD1E9D4009AC381 /* RendererVTBGL.cpp */; };
7C89619213B6A16F003631FE /* GUIWindowScreensaverDim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89619013B6A16F003631FE /* GUIWindowScreensaverDim.cpp */; };
7C8A14571154CB2600E5FCFA /* TextureCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C8A14541154CB2600E5FCFA /* TextureCache.cpp */; };
7C8A187D115B2A8200E5FCFA /* TextureDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C8A187A115B2A8200E5FCFA /* TextureDatabase.cpp */; };
@@ -480,10 +480,6 @@
7CC7B6C919186A8800DDB120 /* SettingConditions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CC7B6C619186A8800DDB120 /* SettingConditions.cpp */; };
7CC82C9318284F9F0010DF30 /* CharsetDetection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CC82C9118284F9F0010DF30 /* CharsetDetection.cpp */; };
7CC82C9418284F9F0010DF30 /* CharsetDetection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CC82C9118284F9F0010DF30 /* CharsetDetection.cpp */; };
- 7CCA95BF1BC6E6670091D308 /* RendererVDA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CCA95BB1BC6E6670091D308 /* RendererVDA.cpp */; };
- 7CCA95C01BC6E6670091D308 /* RendererVDA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CCA95BB1BC6E6670091D308 /* RendererVDA.cpp */; };
- 7CCA95C11BC6E6670091D308 /* RendererVTB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CCA95BD1BC6E6670091D308 /* RendererVTB.cpp */; };
- 7CCA95C21BC6E6670091D308 /* RendererVTB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CCA95BD1BC6E6670091D308 /* RendererVTB.cpp */; };
7CCA95C81BC6E6F90091D308 /* Resolution.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CCA95C71BC6E6F90091D308 /* Resolution.cpp */; };
7CCA95C91BC6E6F90091D308 /* Resolution.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CCA95C71BC6E6F90091D308 /* Resolution.cpp */; };
7CCA95CC1BC6E71D0091D308 /* GLSLOutput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CCA95CA1BC6E71D0091D308 /* GLSLOutput.cpp */; };
@@ -678,6 +674,8 @@
7CCDACCA19275D790074CF51 /* NptAppleLogConfig.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CCDACC019275D790074CF51 /* NptAppleLogConfig.mm */; settings = {COMPILER_FLAGS = "-I$SRCROOT/lib/libUPnP/Neptune/Source/System/Posix -I$SRCROOT/lib/libUPnP/Neptune/Source/Core"; }; };
7CCDACCB19275D790074CF51 /* NptAppleLogConfig.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CCDACC019275D790074CF51 /* NptAppleLogConfig.mm */; };
7CCF7FC9106A0DF500992676 /* TimeUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CCF7FC7106A0DF500992676 /* TimeUtils.cpp */; };
+ 7CD46A141CCDEA7500BF4AD4 /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CD46A131CCDEA7500BF4AD4 /* VideoToolbox.framework */; };
+ 7CD46A161CCDF09500BF4AD4 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CD46A151CCDF09500BF4AD4 /* CoreMedia.framework */; };
7CD4F7EC1C60DBC10015214B /* VideoFileItemListModifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD4F7EA1C60DBC10015214B /* VideoFileItemListModifier.cpp */; };
7CD4F7ED1C60DBC10015214B /* VideoFileItemListModifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD4F7EA1C60DBC10015214B /* VideoFileItemListModifier.cpp */; };
7CDAE9050FFCA3520040B25F /* DVDTSCorrection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CDAE9030FFCA3520040B25F /* DVDTSCorrection.cpp */; };
@@ -686,6 +684,13 @@
7CE3FB901C9D40EA00366A4C /* ServiceBroker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE3FB8E1C9D40EA00366A4C /* ServiceBroker.cpp */; };
7CE3FB911C9D40EA00366A4C /* ServiceBroker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE3FB8E1C9D40EA00366A4C /* ServiceBroker.cpp */; };
7CEBD8A80F33A0D800CAF6AD /* SpecialProtocolDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEBD8A60F33A0D800CAF6AD /* SpecialProtocolDirectory.cpp */; };
+ 7CED59391CD340460093F573 /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CED59381CD340460093F573 /* VideoToolbox.framework */; };
+ 7CED593A1CD340460093F573 /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CED59381CD340460093F573 /* VideoToolbox.framework */; };
+ 7CED593D1CD341280093F573 /* VTB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CED593B1CD341280093F573 /* VTB.cpp */; };
+ 7CED593E1CD341280093F573 /* VTB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CED593B1CD341280093F573 /* VTB.cpp */; };
+ 7CED59411CD343260093F573 /* RendererVTBGLES.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CED593F1CD343260093F573 /* RendererVTBGLES.cpp */; };
+ 7CED59431CD350B70093F573 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CED59421CD350B70093F573 /* CoreVideo.framework */; };
+ 7CED59451CD350DD0093F573 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CED59441CD350DD0093F573 /* OpenGLES.framework */; };
7CEE587D1B5A3FFB007C2B5A /* AudioDSPSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEE587C1B5A3FFB007C2B5A /* AudioDSPSettings.cpp */; };
7CEE587E1B5A3FFB007C2B5A /* AudioDSPSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEE587C1B5A3FFB007C2B5A /* AudioDSPSettings.cpp */; };
7CF0504B190A1D7200222135 /* FFmpeg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CF05049190A1D7200222135 /* FFmpeg.cpp */; };
@@ -1386,9 +1391,7 @@
E499108E174D0D2600741B6D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E499108D174D0D2600741B6D /* Foundation.framework */; };
E4991090174D0D2600741B6D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E499108F174D0D2600741B6D /* CoreGraphics.framework */; };
E49910E3174E549400741B6D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E49910E2174E549400741B6D /* QuartzCore.framework */; };
- E49910E5174E54A100741B6D /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E49910E4174E54A100741B6D /* OpenGLES.framework */; };
E49910E7174E54B400741B6D /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E49910E6174E54B300741B6D /* CoreMedia.framework */; };
- E49910E9174E54C300741B6D /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E49910E8174E54C300741B6D /* CoreVideo.framework */; };
E49910ED174E54D200741B6D /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E49910EC174E54D200741B6D /* AudioToolbox.framework */; };
E49910EF174E54E400741B6D /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E49910EE174E54E400741B6D /* ImageIO.framework */; };
E49910F1174E54ED00741B6D /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E49910F0174E54EC00741B6D /* CFNetwork.framework */; };
@@ -2150,7 +2153,6 @@
E499158A174E68D800741B6D /* LinuxRendererGLES.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4991588174E68D700741B6D /* LinuxRendererGLES.cpp */; };
E499158B174E68EE00741B6D /* DVDCodecUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15220D25F9F900618676 /* DVDCodecUtils.cpp */; };
E499158C174E68EE00741B6D /* DVDFactoryCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15240D25F9F900618676 /* DVDFactoryCodec.cpp */; };
- E4991591174E6ABE00741B6D /* DVDVideoCodecVideoToolBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E499158F174E6ABD00741B6D /* DVDVideoCodecVideoToolBox.cpp */; };
E4991592174E6B5C00741B6D /* fstrcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 7CBEBB8212912BA300431822 /* fstrcmp.c */; };
E4991596174E70BF00741B6D /* yuv2rgb.neon.S in Sources */ = {isa = PBXBuildFile; fileRef = E4991595174E70BF00741B6D /* yuv2rgb.neon.S */; };
E49ACD8C100745C400A86ECD /* ZeroconfDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E49ACD8B100745C400A86ECD /* ZeroconfDirectory.cpp */; };
@@ -2169,7 +2171,6 @@
F500E35617F3412C004FC217 /* WinEvents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F500E35517F3412C004FC217 /* WinEvents.cpp */; };
F500E35717F3412C004FC217 /* WinEvents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F500E35517F3412C004FC217 /* WinEvents.cpp */; };
F506297A0E57B9680066625A /* MultiPathFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F50629780E57B9680066625A /* MultiPathFile.cpp */; };
- F5071906175A26AD004C87D1 /* VideoDecodeAcceleration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5071905175A26AD004C87D1 /* VideoDecodeAcceleration.framework */; };
F50FDC5A119B4B2C00C8B8CD /* GUIDialogTextViewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F50FDC59119B4B2C00C8B8CD /* GUIDialogTextViewer.cpp */; };
F50FE04E11A3411A00C8B8CD /* EncoderFFmpeg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F50FE04D11A3411A00C8B8CD /* EncoderFFmpeg.cpp */; };
F52A733D1560BC34005B1A0B /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F52A733C1560BC34005B1A0B /* CoreFoundation.framework */; };
@@ -2721,8 +2722,6 @@
436721A612D66A09002508E6 /* IAnnouncer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IAnnouncer.h; sourceTree = "<group>"; };
436B38F3106628850049AB3B /* EndianSwap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EndianSwap.h; sourceTree = "<group>"; };
43FAC87112D6349400F67914 /* IStorageProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IStorageProvider.h; sourceTree = "<group>"; };
- 551C3A43175A12010051AAAD /* VDA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VDA.cpp; sourceTree = "<group>"; };
- 551C3A44175A12010051AAAD /* VDA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VDA.h; sourceTree = "<group>"; };
552840CA1626163B00ED1333 /* UPnPPlayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UPnPPlayer.cpp; sourceTree = "<group>"; };
552840CB1626163B00ED1333 /* UPnPPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UPnPPlayer.h; sourceTree = "<group>"; };
5558ED0E176396CD00118C35 /* StereoscopicsManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StereoscopicsManager.cpp; sourceTree = "<group>"; };
@@ -2931,6 +2930,8 @@
7C84A59D12FA3C1600CD1714 /* SourcesDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SourcesDirectory.h; path = xbmc/filesystem/SourcesDirectory.h; sourceTree = SOURCE_ROOT; };
7C87B2CC162CE39600EF897D /* PlayerController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlayerController.cpp; sourceTree = "<group>"; };
7C87B2CD162CE39600EF897D /* PlayerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlayerController.h; sourceTree = "<group>"; };
+ 7C87F5C61CD1E9D4009AC381 /* RendererVTBGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RendererVTBGL.cpp; path = HwDecRender/RendererVTBGL.cpp; sourceTree = "<group>"; };
+ 7C87F5C71CD1E9D4009AC381 /* RendererVTBGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RendererVTBGL.h; path = HwDecRender/RendererVTBGL.h; sourceTree = "<group>"; };
7C89619013B6A16F003631FE /* GUIWindowScreensaverDim.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowScreensaverDim.cpp; sourceTree = "<group>"; };
7C89619113B6A16F003631FE /* GUIWindowScreensaverDim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowScreensaverDim.h; sourceTree = "<group>"; };
7C89674413C03B22003631FE /* InfoBool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InfoBool.h; sourceTree = "<group>"; };
@@ -3039,10 +3040,6 @@
7CC7B6C719186A8800DDB120 /* SettingConditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingConditions.h; sourceTree = "<group>"; };
7CC82C9118284F9F0010DF30 /* CharsetDetection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CharsetDetection.cpp; sourceTree = "<group>"; };
7CC82C9218284F9F0010DF30 /* CharsetDetection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CharsetDetection.h; sourceTree = "<group>"; };
- 7CCA95BB1BC6E6670091D308 /* RendererVDA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RendererVDA.cpp; path = HwDecRender/RendererVDA.cpp; sourceTree = "<group>"; };
- 7CCA95BC1BC6E6670091D308 /* RendererVDA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RendererVDA.h; path = HwDecRender/RendererVDA.h; sourceTree = "<group>"; };
- 7CCA95BD1BC6E6670091D308 /* RendererVTB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RendererVTB.cpp; path = HwDecRender/RendererVTB.cpp; sourceTree = "<group>"; };
- 7CCA95BE1BC6E6670091D308 /* RendererVTB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RendererVTB.h; path = HwDecRender/RendererVTB.h; sourceTree = "<group>"; };
7CCA95C71BC6E6F90091D308 /* Resolution.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Resolution.cpp; sourceTree = "<group>"; };
7CCA95CA1BC6E71D0091D308 /* GLSLOutput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GLSLOutput.cpp; sourceTree = "<group>"; };
7CCA95CB1BC6E71D0091D308 /* GLSLOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLSLOutput.h; sourceTree = "<group>"; };
@@ -3387,6 +3384,8 @@
7CCDACC019275D790074CF51 /* NptAppleLogConfig.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NptAppleLogConfig.mm; sourceTree = "<group>"; };
7CCF7FC7106A0DF500992676 /* TimeUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimeUtils.cpp; sourceTree = "<group>"; };
7CCF7FC8106A0DF500992676 /* TimeUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimeUtils.h; sourceTree = "<group>"; };
+ 7CD46A131CCDEA7500BF4AD4 /* VideoToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoToolbox.framework; path = System/Library/Frameworks/VideoToolbox.framework; sourceTree = SDKROOT; };
+ 7CD46A151CCDF09500BF4AD4 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; };
7CD4F7EA1C60DBC10015214B /* VideoFileItemListModifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VideoFileItemListModifier.cpp; sourceTree = "<group>"; };
7CD4F7EB1C60DBC10015214B /* VideoFileItemListModifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFileItemListModifier.h; sourceTree = "<group>"; };
7CDAE9030FFCA3520040B25F /* DVDTSCorrection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DVDTSCorrection.cpp; sourceTree = "<group>"; };
@@ -3397,6 +3396,13 @@
7CE3FB8F1C9D40EA00366A4C /* ServiceBroker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceBroker.h; sourceTree = "<group>"; };
7CEBD8A60F33A0D800CAF6AD /* SpecialProtocolDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpecialProtocolDirectory.cpp; sourceTree = "<group>"; };
7CEBD8A70F33A0D800CAF6AD /* SpecialProtocolDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpecialProtocolDirectory.h; sourceTree = "<group>"; };
+ 7CED59381CD340460093F573 /* VideoToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoToolbox.framework; path = System/Library/Frameworks/VideoToolbox.framework; sourceTree = SDKROOT; };
+ 7CED593B1CD341280093F573 /* VTB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VTB.cpp; sourceTree = "<group>"; };
+ 7CED593C1CD341280093F573 /* VTB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTB.h; sourceTree = "<group>"; };
+ 7CED593F1CD343260093F573 /* RendererVTBGLES.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RendererVTBGLES.cpp; path = HwDecRender/RendererVTBGLES.cpp; sourceTree = "<group>"; };
+ 7CED59401CD343260093F573 /* RendererVTBGLES.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RendererVTBGLES.h; path = HwDecRender/RendererVTBGLES.h; sourceTree = "<group>"; };
+ 7CED59421CD350B70093F573 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreVideo.framework; sourceTree = DEVELOPER_DIR; };
+ 7CED59441CD350DD0093F573 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
7CEE107B1C970BB800E0D426 /* kodi_inputstream_dll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = kodi_inputstream_dll.h; path = "kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h"; sourceTree = "<group>"; };
7CEE107C1C970BB800E0D426 /* kodi_inputstream_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = kodi_inputstream_types.h; path = "kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h"; sourceTree = "<group>"; };
7CEE107D1C970BB800E0D426 /* libKODI_inputstream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libKODI_inputstream.h; path = "kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h"; sourceTree = "<group>"; };
@@ -4717,9 +4723,7 @@
E49910D4174E2E0000741B6D /* Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
E49910D5174E2E0000741B6D /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
E49910E2174E549400741B6D /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
- E49910E4174E54A100741B6D /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
E49910E6174E54B300741B6D /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; };
- E49910E8174E54C300741B6D /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
E49910EA174E54C900741B6D /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
E49910EC174E54D200741B6D /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
E49910EE174E54E400741B6D /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; };
@@ -4741,8 +4745,6 @@
E4991573174E661300741B6D /* WinSystemIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WinSystemIOS.mm; path = osx/WinSystemIOS.mm; sourceTree = "<group>"; };
E4991588174E68D700741B6D /* LinuxRendererGLES.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LinuxRendererGLES.cpp; sourceTree = "<group>"; };
E4991589174E68D800741B6D /* LinuxRendererGLES.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinuxRendererGLES.h; sourceTree = "<group>"; };
- E499158F174E6ABD00741B6D /* DVDVideoCodecVideoToolBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DVDVideoCodecVideoToolBox.cpp; sourceTree = "<group>"; };
- E4991590174E6ABE00741B6D /* DVDVideoCodecVideoToolBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVDVideoCodecVideoToolBox.h; sourceTree = "<group>"; };
E4991594174E70BE00741B6D /* yuv2rgb.neon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv2rgb.neon.h; sourceTree = "<group>"; };
E4991595174E70BF00741B6D /* yuv2rgb.neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = yuv2rgb.neon.S; sourceTree = "<group>"; };
E49ACD8A100745C400A86ECD /* ZeroconfDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZeroconfDirectory.h; sourceTree = "<group>"; };
@@ -4812,7 +4814,6 @@
F502BFF1160F36AD00C96C76 /* swig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = swig.h; path = python/swig.h; sourceTree = "<group>"; };
F50629780E57B9680066625A /* MultiPathFile.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MultiPathFile.cpp; sourceTree = "<group>"; };
F50629790E57B9680066625A /* MultiPathFile.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MultiPathFile.h; sourceTree = "<group>"; };
- F5071905175A26AD004C87D1 /* VideoDecodeAcceleration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoDecodeAcceleration.framework; path = System/Library/Frameworks/VideoDecodeAcceleration.framework; sourceTree = SDKROOT; };
F50FDC58119B4B2C00C8B8CD /* GUIDialogTextViewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogTextViewer.h; sourceTree = "<group>"; };
F50FDC59119B4B2C00C8B8CD /* GUIDialogTextViewer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogTextViewer.cpp; sourceTree = "<group>"; };
F50FE04C11A3411A00C8B8CD /* EncoderFFmpeg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EncoderFFmpeg.h; sourceTree = "<group>"; };
@@ -5020,8 +5021,10 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 7CD46A141CCDEA7500BF4AD4 /* VideoToolbox.framework in Frameworks */,
F5ED9BFB155EC77400842059 /* ApplicationServices.framework in Frameworks */,
E38E23930D2626E600618676 /* AudioUnit.framework in Frameworks */,
+ 7CD46A161CCDF09500BF4AD4 /* CoreMedia.framework in Frameworks */,
E38E23920D2626E600618676 /* AudioToolbox.framework in Frameworks */,
E38E23940D2626E600618676 /* Cocoa.framework in Frameworks */,
F5ED9A0C155EBDC000842059 /* CoreAudio.framework in Frameworks */,
@@ -5031,10 +5034,10 @@
E33466A60D2E5103005A65EC /* IOKit.framework in Frameworks */,
F5364E05155B3CAF0016D00B /* IOSurface.framework in Frameworks */,
E38E23980D2626E600618676 /* OpenGL.framework in Frameworks */,
+ 7CED59391CD340460093F573 /* VideoToolbox.framework in Frameworks */,
F59879080FBAA0C3008EF4FB /* QuartzCore.framework in Frameworks */,
F52A733D1560BC34005B1A0B /* CoreFoundation.framework in Frameworks */,
DFBE805115F7D75700D7D102 /* SystemConfiguration.framework in Frameworks */,
- F5071906175A26AD004C87D1 /* VideoDecodeAcceleration.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -5047,14 +5050,15 @@
E49910F1174E54ED00741B6D /* CFNetwork.framework in Frameworks */,
E49910EF174E54E400741B6D /* ImageIO.framework in Frameworks */,
E49910ED174E54D200741B6D /* AudioToolbox.framework in Frameworks */,
- E49910E9174E54C300741B6D /* CoreVideo.framework in Frameworks */,
E49910E7174E54B400741B6D /* CoreMedia.framework in Frameworks */,
- E49910E5174E54A100741B6D /* OpenGLES.framework in Frameworks */,
+ 7CED593A1CD340460093F573 /* VideoToolbox.framework in Frameworks */,
E49910E3174E549400741B6D /* QuartzCore.framework in Frameworks */,
E499108C174D0D2600741B6D /* UIKit.framework in Frameworks */,
+ 7CED59451CD350DD0093F573 /* OpenGLES.framework in Frameworks */,
E499108E174D0D2600741B6D /* Foundation.framework in Frameworks */,
E4991090174D0D2600741B6D /* CoreGraphics.framework in Frameworks */,
DFF0EBB7175281E1002DA3A4 /* CoreAudio.framework in Frameworks */,
+ 7CED59431CD350B70093F573 /* CoreVideo.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -6391,10 +6395,10 @@
7CCA95BA1BC6E6450091D308 /* HwDecRender */ = {
isa = PBXGroup;
children = (
- 7CCA95BB1BC6E6670091D308 /* RendererVDA.cpp */,
- 7CCA95BC1BC6E6670091D308 /* RendererVDA.h */,
- 7CCA95BD1BC6E6670091D308 /* RendererVTB.cpp */,
- 7CCA95BE1BC6E6670091D308 /* RendererVTB.h */,
+ 7C87F5C61CD1E9D4009AC381 /* RendererVTBGL.cpp */,
+ 7C87F5C71CD1E9D4009AC381 /* RendererVTBGL.h */,
+ 7CED593F1CD343260093F573 /* RendererVTBGLES.cpp */,
+ 7CED59401CD343260093F573 /* RendererVTBGLES.h */,
);
name = HwDecRender;
sourceTree = "<group>";
@@ -7972,12 +7976,10 @@
E38E153C0D25F9F900618676 /* DVDVideoCodec.h */,
E38E153D0D25F9F900618676 /* DVDVideoCodecFFmpeg.cpp */,
E38E153E0D25F9F900618676 /* DVDVideoCodecFFmpeg.h */,
- E499158F174E6ABD00741B6D /* DVDVideoCodecVideoToolBox.cpp */,
- E4991590174E6ABE00741B6D /* DVDVideoCodecVideoToolBox.h */,
E38E15410D25F9F900618676 /* DVDVideoPPFFmpeg.cpp */,
E38E15420D25F9F900618676 /* DVDVideoPPFFmpeg.h */,
- 551C3A43175A12010051AAAD /* VDA.cpp */,
- 551C3A44175A12010051AAAD /* VDA.h */,
+ 7CED593C1CD341280093F573 /* VTB.h */,
+ 7CED593B1CD341280093F573 /* VTB.cpp */,
);
path = Video;
sourceTree = "<group>";
@@ -8864,15 +8866,16 @@
E49910F6174E55D400741B6D /* iOS */ = {
isa = PBXGroup;
children = (
+ 7CED59441CD350DD0093F573 /* OpenGLES.framework */,
+ 7CED59421CD350B70093F573 /* CoreVideo.framework */,
+ 7CED59381CD340460093F573 /* VideoToolbox.framework */,
E49910EC174E54D200741B6D /* AudioToolbox.framework */,
E49910F2174E54FB00741B6D /* AVFoundation.framework */,
E49910F0174E54EC00741B6D /* CFNetwork.framework */,
E49910EA174E54C900741B6D /* CoreAudio.framework */,
E49910E6174E54B300741B6D /* CoreMedia.framework */,
- E49910E8174E54C300741B6D /* CoreVideo.framework */,
E49910EE174E54E400741B6D /* ImageIO.framework */,
E49910F4174E550200741B6D /* MediaPlayer.framework */,
- E49910E4174E54A100741B6D /* OpenGLES.framework */,
E499108B174D0D2600741B6D /* UIKit.framework */,
E499108D174D0D2600741B6D /* Foundation.framework */,
E499108F174D0D2600741B6D /* CoreGraphics.framework */,
@@ -8884,6 +8887,8 @@
E49910F7174E55E100741B6D /* OSX */ = {
isa = PBXGroup;
children = (
+ 7CD46A151CCDF09500BF4AD4 /* CoreMedia.framework */,
+ 7CD46A131CCDEA7500BF4AD4 /* VideoToolbox.framework */,
E38E25340D26365C00618676 /* ApplicationServices.framework */,
E38E238C0D2626E600618676 /* AudioUnit.framework */,
E38E238B0D2626E600618676 /* AudioToolbox.framework */,
@@ -8898,7 +8903,6 @@
E38E23910D2626E600618676 /* OpenGL.framework */,
F59879070FBAA0C3008EF4FB /* QuartzCore.framework */,
DFBE803D15F7D72100D7D102 /* SystemConfiguration.framework */,
- F5071905175A26AD004C87D1 /* VideoDecodeAcceleration.framework */,
);
name = OSX;
sourceTree = "<group>";
@@ -9382,6 +9386,11 @@
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
+ TargetAttributes = {
+ E4991088174D0D2600741B6D = {
+ DevelopmentTeam = 4489HXHVBM;
+ };
+ };
};
buildConfigurationList = 1DEB924B08733DCA0010E9CD /* Build configuration list for PBXProject "Kodi" */;
compatibilityVersion = "Xcode 3.2";
@@ -10062,7 +10071,6 @@
E4A249F71095C880003D74C6 /* AutorunMediaJob.cpp in Sources */,
F5A9D3091097C9370050490F /* AliasShortcutUtils.cpp in Sources */,
DF396ED11C42A25F00214C1A /* DarwinNSUserDefaults.mm in Sources */,
- 7CCA95BF1BC6E6670091D308 /* RendererVDA.cpp in Sources */,
431AE5DA109C1A63007428C3 /* OverlayRendererUtil.cpp in Sources */,
7C45DBE910F325C400D4BBF3 /* DAVDirectory.cpp in Sources */,
7CAA57471C8AF6C20032A326 /* DebugRenderer.cpp in Sources */,
@@ -10307,6 +10315,7 @@
DF93D69D1444A8B1007C6459 /* CurlFile.cpp in Sources */,
DF93D69F1444A8B1007C6459 /* DirectoryFactory.cpp in Sources */,
DF93D6A01444A8B1007C6459 /* FileDirectoryFactory.cpp in Sources */,
+ 7C87F5C81CD1E9D4009AC381 /* RendererVTBGL.cpp in Sources */,
68AE5C2D1C9243A000C4D527 /* Controller.cpp in Sources */,
DF2401261B41A26F001E02DA /* ImageResource.cpp in Sources */,
DF93D6A11444A8B1007C6459 /* FileReaderFile.cpp in Sources */,
@@ -10367,6 +10376,7 @@
C84828D5156CFCD8005A996F /* PVRGUIInfo.cpp in Sources */,
C84828D6156CFCD8005A996F /* PVRManager.cpp in Sources */,
C84828D8156CFCD8005A996F /* PVRRecording.cpp in Sources */,
+ 7CED593D1CD341280093F573 /* VTB.cpp in Sources */,
C84828D9156CFCD8005A996F /* PVRRecordings.cpp in Sources */,
C84828DB156CFCD8005A996F /* PVRTimerInfoTag.cpp in Sources */,
C84828DC156CFCD8005A996F /* PVRTimers.cpp in Sources */,
@@ -10461,7 +10471,6 @@
DF402A581644613B001C56B8 /* AddonModuleXbmc.cpp in Sources */,
DF402A591644613B001C56B8 /* AddonModuleXbmcaddon.cpp in Sources */,
DF402A5A1644613B001C56B8 /* AddonModuleXbmcgui.cpp in Sources */,
- 7CCA95C11BC6E6670091D308 /* RendererVTB.cpp in Sources */,
DF402A5B1644613B001C56B8 /* AddonModuleXbmcplugin.cpp in Sources */,
DF402A5C1644613B001C56B8 /* AddonModuleXbmcvfs.cpp in Sources */,
DF402A63164461B0001C56B8 /* CallbackHandler.cpp in Sources */,
@@ -10527,7 +10536,6 @@
68AE5BE11C92421800C4D527 /* AddonButtonMapping.cpp in Sources */,
68AE5C091C92437900C4D527 /* GUIControllerList.cpp in Sources */,
7C8E02461BA35D0B0072E8B2 /* SystemBuiltins.cpp in Sources */,
- 551C3A45175A12010051AAAD /* VDA.cpp in Sources */,
DFBB431B178B5E6F006CC20A /* CompileInfo.cpp in Sources */,
DF40BC20178B4BEC009DB567 /* PythonInvoker.cpp in Sources */,
DF40BC2F178B4C07009DB567 /* LanguageInvokerThread.cpp in Sources */,
@@ -10766,6 +10774,7 @@
68AE5C1C1C92438E00C4D527 /* GUIControllerButton.cpp in Sources */,
E499116A174E5CC300741B6D /* recvol.cpp in Sources */,
E499116B174E5CC300741B6D /* resource.cpp in Sources */,
+ 7CED593E1CD341280093F573 /* VTB.cpp in Sources */,
E499116C174E5CC300741B6D /* rijndael.cpp in Sources */,
E499116D174E5CC300741B6D /* rs.cpp in Sources */,
E499116E174E5CC300741B6D /* savepos.cpp in Sources */,
@@ -11463,7 +11472,6 @@
E4991453174E605900741B6D /* FileUtils.cpp in Sources */,
E4991454174E605900741B6D /* GLUtils.cpp in Sources */,
7CAA57481C8AF6C20032A326 /* DebugRenderer.cpp in Sources */,
- 7CCA95C01BC6E6670091D308 /* RendererVDA.cpp in Sources */,
E4991455174E605900741B6D /* GroupUtils.cpp in Sources */,
E4991457174E605900741B6D /* HTMLUtil.cpp in Sources */,
E4991458174E605900741B6D /* HttpHeader.cpp in Sources */,
@@ -11596,6 +11604,7 @@
E4991547174E642900741B6D /* ThumbLoader.cpp in Sources */,
E4991548174E642900741B6D /* ThumbnailCache.cpp in Sources */,
E4991549174E642900741B6D /* URL.cpp in Sources */,
+ 7CED59411CD343260093F573 /* RendererVTBGLES.cpp in Sources */,
DF396ED61C42AC5100214C1A /* AESinkDARWINIOS.mm in Sources */,
E499154A174E642900741B6D /* Util.cpp in Sources */,
E499154B174E642900741B6D /* XBApplicationEx.cpp in Sources */,
@@ -11644,7 +11653,6 @@
E499158A174E68D800741B6D /* LinuxRendererGLES.cpp in Sources */,
E499158B174E68EE00741B6D /* DVDCodecUtils.cpp in Sources */,
E499158C174E68EE00741B6D /* DVDFactoryCodec.cpp in Sources */,
- E4991591174E6ABE00741B6D /* DVDVideoCodecVideoToolBox.cpp in Sources */,
E4991592174E6B5C00741B6D /* fstrcmp.c in Sources */,
E4991596174E70BF00741B6D /* yuv2rgb.neon.S in Sources */,
0E3036ED1760F68A00D93596 /* FavouritesDirectory.cpp in Sources */,
@@ -11714,7 +11722,6 @@
7CCDA0DC192753E30074CF51 /* PltAction.cpp in Sources */,
7CCDA0E5192753E30074CF51 /* PltArgument.cpp in Sources */,
7CCDA0EE192753E30074CF51 /* PltConstants.cpp in Sources */,
- 7CCA95C21BC6E6670091D308 /* RendererVTB.cpp in Sources */,
7CCDA0F7192753E30074CF51 /* PltCtrlPoint.cpp in Sources */,
7CCDA100192753E30074CF51 /* PltCtrlPointTask.cpp in Sources */,
7CCDA109192753E30074CF51 /* PltDatagramStream.cpp in Sources */,
@@ -12005,8 +12012,8 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- CODE_SIGN_IDENTITY = "";
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -12015,6 +12022,8 @@
GCC_C_LANGUAGE_STANDARD = gnu99;
INFOPLIST_FILE = "$(SRCROOT)/xbmc/platform/darwin/ios/Info.plist";
INSTALL_PATH = "$(HOME)/Library/Bundles";
+ PRODUCT_BUNDLE_IDENTIFIER = org.xbmc.fernet;
+ PROVISIONING_PROFILE = "";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
};
@@ -12030,8 +12039,8 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- CODE_SIGN_IDENTITY = "";
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -12039,6 +12048,8 @@
);
GCC_C_LANGUAGE_STANDARD = gnu99;
INFOPLIST_FILE = "$(SRCROOT)/xbmc/platform/darwin/ios/Info.plist";
+ PRODUCT_BUNDLE_IDENTIFIER = org.xbmc.fernet;
+ PROVISIONING_PROFILE = "";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
index aa865f6de5..1425fc2f3e 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
@@ -6608,7 +6608,7 @@ msgstr ""
#: system/settings/settings.xml
msgctxt "#13429"
-msgid "Allow hardware acceleration - VDADecoder"
+msgid "Allow hardware acceleration - VTBDecoder"
msgstr ""
#: system/settings/settings.xml
@@ -16340,10 +16340,10 @@ msgctxt "#36159"
msgid "Enable CrystalHD decoding of video files."
msgstr ""
-#. Description of setting "Videos -> Playback -> Allow hardware acceleration (VDADecoder)" with label #13429
+#. Description of setting "Videos -> Playback -> Allow hardware acceleration (VideoToolbox)" with label #13429
#: system/settings/settings.xml
msgctxt "#36160"
-msgid "Enable VDA hardware decoding of video files."
+msgid "Enable VTB hardware decoding of video files."
msgstr ""
#. Description of setting "Videos -> Playback -> Allow hardware acceleration (OpenMax)" with label #13430
diff --git a/configure.ac b/configure.ac
index 39b1c15338..1e0d44a24b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,7 +84,7 @@ AC_DEFUN([XB_FIND_SONAME],
for path in $gcc_lib_path $env_lib_path $host_lib_path; do
lib=[`ls -- $path/lib$2.dylib 2>/dev/null`]
if test x$lib != x; then
- # we want the path/name that is embedded in the dylib
+ # we want the path/name that is embedded in the dylib
$1_FILENAME=[`otool -L $lib | grep -v lib$2.dylib | grep lib$2 | awk '{V=1; print $V}'`]
$1_SONAME=[`basename $$1_FILENAME`]
fi
@@ -184,8 +184,6 @@ vdpau_not_found="== Could not find libvdpau. VDPAU support disabled. =="
vdpau_disabled="== VDPAU support manually disabled. =="
vaapi_not_found="== Could not find libva. VAAPI support disabled. =="
vaapi_disabled="== VAAPI support manually disabled. =="
-vtbdecoder_enabled="== VTBDecoder support enabled. =="
-vtbdecoder_disabled="== VTBDecoder support manually disabled. =="
openmax_disabled="== OpenMax support manually disabled. =="
openmax_not_found="== Could not find OpenMax headers. OpenMax support disabled. =="
librtmp_not_found="== Could not find libRTMP. RTMP support disabled. =="
@@ -271,12 +269,6 @@ AC_ARG_ENABLE([vaapi],
[use_vaapi=$enableval],
[use_vaapi=auto])
-AC_ARG_ENABLE([vtbdecoder],
- [AS_HELP_STRING([--enable-vtbdecoder],
- [enable VTBDecoder decoding (default is auto)])],
- [use_vtbdecoder=$enableval],
- [use_vtbdecoder=auto])
-
AC_ARG_ENABLE([openmax],
[AS_HELP_STRING([--enable-openmax],
[enable OpenMax decoding (default is auto, requires OpenGLES)])],
@@ -378,7 +370,7 @@ AC_ARG_ENABLE([avahi],
[disable Avahi support (default is enabled if libavahi-common and libavahi-client is found)])],
[use_avahi=$enableval],
[use_avahi=yes])
-
+
AC_ARG_ENABLE([mdnsembedded],
[AS_HELP_STRING([--disable-mdnsembedded],
[disable mDNSEmbedded support (default is auto)])],
@@ -533,7 +525,7 @@ case $host in
use_gles=yes
use_optical_drive=no
use_x11=no
- build_shared_lib=yes
+ build_shared_lib=yes
;;
i*86*-linux-gnu*|i*86*-*-linux-uclibc*)
target_platform=target_linux
@@ -584,7 +576,6 @@ case $host in
CORE_SYSTEM_NAME=ios
use_neon=yes
use_libcec=no
- use_vtbdecoder=yes
use_optical_drive=no
use_gles=yes
use_cpu=cortex-a8
@@ -600,14 +591,12 @@ case $host in
;;
*86*-apple-darwin*)
CORE_SYSTEM_NAME=osx
- use_vtbdecoder=no
ARCH="x86-osx"
DEPENDS_ROOT_FOR_XCODE=$(echo ${prefix%/*})
AC_SUBST([DEPENDS_ROOT_FOR_XCODE])
;;
powerpc-apple-darwin*)
CORE_SYSTEM_NAME=osx
- use_vtbdecoder=no
ARCH="powerpc-osx"
use_arch="ppc"
DEPENDS_ROOT_FOR_XCODE=$(echo ${prefix%/*})
@@ -793,7 +782,7 @@ elif test "$use_arch" = "arm"; then
CFLAGS="$CFLAGS -mno-apcs-stack-check"
CXXFLAGS="$CXXFLAGS -mno-apcs-stack-check"
if test "$use_tegra" = "yes"; then
- # Compile for ARMv7a architecture, need to test gcc for vfpv3-d16 support
+ # Compile for ARMv7a architecture, need to test gcc for vfpv3-d16 support
SAVE_CFLAGS="$CFLAGS"
CFLAGS="-mfpu=vfpv3-d16"
AC_COMPILE_IFELSE(
@@ -802,10 +791,10 @@ elif test "$use_arch" = "arm"; then
CXXFLAGS="$CXXFLAGS -Wno-psabi -Wa,-march=armv7a -mtune=cortex-a9 -mfpu=vfpv3-d16 -mthumb-interwork"
use_cpu=cortex-a9],
[ CFLAGS="$SAVE_CFLAGS -Wa,-march=armv6 -mtune=cortex-a8 -mthumb-interwork"
- CXXFLAGS="$CXXFLAGS -Wa,-march=armv6 -mtune=cortex-a8 -mthumb-interwork"
+ CXXFLAGS="$CXXFLAGS -Wa,-march=armv6 -mtune=cortex-a8 -mthumb-interwork"
use_cpu=cortex-a8])
else
- if test "$use_neon" = "yes"; then
+ if test "$use_neon" = "yes"; then
CFLAGS="$CFLAGS -mfpu=neon -mvectorize-with-neon-quad"
CXXFLAGS="$CXXFLAGS -mfpu=neon -mvectorize-with-neon-quad"
fi
@@ -1578,7 +1567,7 @@ fi
if test "$FFMPEG_FOUND" != "true"; then
PKG_CHECK_MODULES([FFMPEG], [$FFMPEG_LIBNAMES],
- [INCLUDES="$INCLUDES $FFMPEG_CFLAGS"; LIBS="$LIBS $FFMPEG_LIBS"; FFMPEG_FOUND="true"],
+ [INCLUDES="$INCLUDES $FFMPEG_CFLAGS"; LIBS="$LIBS $FFMPEG_LIBS"; FFMPEG_FOUND="true"],
[AC_MSG_ERROR("ffmpeg not found")])
fi
@@ -1687,24 +1676,6 @@ else
USE_VAAPI=0
fi
-# VTBDecoder
-if test "x$use_vtbdecoder" != "xno"; then
- if test "$host_vendor" = "apple" ; then
- HAVE_VIDEOTOOLBOXDECODER=1
- AC_DEFINE([HAVE_VIDEOTOOLBOXDECODER], [1], [Define to 1 if you have the 'VTBDecoder' library.])
- AC_MSG_NOTICE($vtbdecoder_enabled)
- else
- if test "x$use_vtbdecoder" = "xyes"; then
- AC_MSG_ERROR([VTB Decoder not supported on this platform])
- else
- use_vtbdecoder="no"
- AC_MSG_NOTICE($vtbdecoder_disabled)
- fi
- fi
-else
- AC_MSG_NOTICE($vtbdecoder_disabled)
-fi
-
# OpenMax
if test "$use_gles" = "yes" && test "$use_openmax" = "auto"; then
@@ -1886,12 +1857,6 @@ else
final_message="$final_message\n VAAPI:\tNo"
fi
-if test "x$use_vtbdecoder" != "xno"; then
- final_message="$final_message\n VTBDecoder:\tYes"
-else
- final_message="$final_message\n VTBDecoder:\tNo"
-fi
-
if test "$use_openmax" != "no"; then
final_message="$final_message\n OpenMax:\tYes"
else
@@ -2073,7 +2038,7 @@ else
fi
if test "x$use_airtunes" != "xno"; then
- final_message="$final_message\n AirTunes support (libshairplay):\tYes"
+ final_message="$final_message\n AirTunes support (libshairplay):\tYes"
else
final_message="$final_message\n AirTunes support:\tNo"
fi
@@ -2387,7 +2352,7 @@ XB_CONFIG_MODULE([lib/cpluff], [
--host=$host_alias \
--build=$build_alias \
--target=$target_alias CFLAGS="$CFLAGS" CC="$CC" CXX="$CXX" LDFLAGS="$LDFLAGS" LIBS=""
- #LDFLAGS="$LDFLAGS -Wl,-read_only_relocs,suppress"
+ #LDFLAGS="$LDFLAGS -Wl,-read_only_relocs,suppress"
], [0])
XB_CONFIG_MODULE([lib/gtest], [
diff --git a/system/settings/settings.xml b/system/settings/settings.xml
index 3070cc4f4b..3f4941a072 100644
--- a/system/settings/settings.xml
+++ b/system/settings/settings.xml
@@ -811,14 +811,8 @@
<default>true</default>
<control type="toggle" />
</setting>
- <setting id="videoplayer.usevideotoolbox" type="boolean" label="13432" help="36162">
- <requirement>HasVideoToolBoxDecoder</requirement>
- <level>2</level>
- <default>true</default>
- <control type="toggle" />
- </setting>
- <setting id="videoplayer.usevda" type="boolean" label="13429" help="36160">
- <requirement>HasVDA</requirement>
+ <setting id="videoplayer.usevtb" type="boolean" label="13429" help="36160">
+ <requirement>HasVTB</requirement>
<level>2</level>
<default>true</default>
<control type="toggle" />
@@ -1049,7 +1043,7 @@
<level>1</level>
<default></default>
<constraints>
- <allowempty>true</allowempty>
+ <allowempty>true</allowempty>
<addontype>xbmc.subtitle.module</addontype>
</constraints>
<control type="button" format="addon">
diff --git a/system/shaders/output.glsl b/system/shaders/output.glsl
index 83f77b04c0..c95c9488f2 100644
--- a/system/shaders/output.glsl
+++ b/system/shaders/output.glsl
@@ -1,4 +1,4 @@
-#if (XBMC_DITHER)
+#if defined(XBMC_DITHER)
uniform sampler2D m_dither;
uniform float m_ditherquant;
uniform vec2 m_dithersize;
@@ -8,11 +8,15 @@ void main()
{
vec4 rgb = process();
-#if (XBMC_FULLRANGE)
+#if defined(XBMC_FULLRANGE)
+#if __VERSION__ <= 120
+ rgb = (rgb-(16.0/255.0)) * 255.0/219.0;
+#else
rgb = clamp((rgb-(16.0/255.0)) * 255.0/219.0, 0, 1);
#endif
+#endif
-#if (XBMC_DITHER)
+#if defined(XBMC_DITHER)
vec2 ditherpos = gl_FragCoord.xy / m_dithersize;
// ditherval is multiplied by 65536/(dither_size^2) to make it [0,1[
// FIXME: scale dither values before uploading?
diff --git a/tools/darwin/Configurations/App-OSX.xcconfig b/tools/darwin/Configurations/App-OSX.xcconfig
index 9781d6e2ba..c7aae2f7c3 100644
--- a/tools/darwin/Configurations/App-OSX.xcconfig
+++ b/tools/darwin/Configurations/App-OSX.xcconfig
@@ -24,7 +24,7 @@ ARCHS = i386 x86_64
ONLY_ACTIVE_ARCH = YES
SDKROOT = macosx
-MACOSX_DEPLOYMENT_TARGET = 10.7
+MACOSX_DEPLOYMENT_TARGET = 10.8
XBMC_DEPENDS = $(XBMC_DEPENDS_ROOT)/$(SDK_NAME)_$(CURRENT_ARCH)-target
diff --git a/tools/depends/configure.ac b/tools/depends/configure.ac
index 13717176d0..7b25715940 100644
--- a/tools/depends/configure.ac
+++ b/tools/depends/configure.ac
@@ -207,7 +207,7 @@ case $host in
4.* | 4.*.*)
platform_cc=llvm-gcc-4.2
platform_cxx=llvm-g++-4.2
- ;;
+ ;;
*)
platform_cc=clang
platform_cxx=clang++
@@ -254,7 +254,7 @@ case $host in
AC_MSG_ERROR(error in configure of --with-sdk=$use_sdk)
esac
sdk_name=macosx$use_sdk
- platform_min_version="macosx-version-min=10.7"
+ platform_min_version="macosx-version-min=10.8"
use_sdk_path=[`$use_xcodebuild -version -sdk $sdk_name Path`]
platform_os="osx"
diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile
index f52e80268f..09e419334d 100644
--- a/tools/depends/target/ffmpeg/Makefile
+++ b/tools/depends/target/ffmpeg/Makefile
@@ -41,12 +41,12 @@ ifeq ($(OS), ios)
ffmpg_config += --cpu=cortex-a8
endif
ffmpg_config += --yasmexe=$(NATIVEPREFIX)/bin/yasm
- ffmpg_config += --disable-decoder=mpeg_xvmc --disable-vda --disable-crystalhd --disable-videotoolbox
+ ffmpg_config += --disable-decoder=mpeg_xvmc --disable-vda --disable-crystalhd --enable-videotoolbox
ffmpg_config += --target-os=darwin
endif
ifeq ($(OS), osx)
ffmpg_config += --disable-outdev=sdl
- ffmpg_config += --disable-decoder=mpeg_xvmc --enable-vda --disable-crystalhd --disable-videotoolbox
+ ffmpg_config += --disable-decoder=mpeg_xvmc --disable-vda --disable-crystalhd --enable-videotoolbox
ffmpg_config += --target-os=darwin
ffmpg_config += --disable-securetransport
endif
@@ -89,4 +89,3 @@ clean:
distclean::
rm -rf $(PLATFORM) .installed-$(PLATFORM)
-
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp
index 355257c8ea..5206cfaf2e 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.cpp
@@ -27,10 +27,6 @@
#include "Overlay/DVDOverlayCodec.h"
#include "cores/VideoPlayer/DVDCodecs/DVDCodecs.h"
-#if defined(HAVE_VIDEOTOOLBOXDECODER)
-#include "Video/DVDVideoCodecVideoToolBox.h"
-#include "utils/SystemInfo.h"
-#endif
#include "Video/DVDVideoCodecFFmpeg.h"
#include "Video/DVDVideoCodecOpenMax.h"
#if defined(HAS_IMXVPU)
@@ -150,8 +146,6 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, CProces
#if defined(HAS_IMXVPU)
pCodec = OpenCodec(new CDVDVideoCodecIMX(processInfo), hint, options);
-#elif defined(HAVE_VIDEOTOOLBOXDECODER)
- pCodec = OpenCodec(new CDVDVideoCodecVideoToolBox(processInfo), hint, options);
#elif defined(TARGET_ANDROID)
pCodec = OpenCodec(new CDVDVideoCodecAndroidMediaCodec(processInfo), hint, options);
#elif defined(HAVE_LIBOPENMAX)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
index f4ba986c96..86f476a5e9 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
@@ -57,8 +57,8 @@
#ifdef HAVE_LIBVA
#include "VAAPI.h"
#endif
-#ifdef TARGET_DARWIN_OSX
-#include "VDA.h"
+#ifdef TARGET_DARWIN
+#include "VTB.h"
#endif
#ifdef HAS_MMAL
#include "MMALFFmpeg.h"
@@ -164,10 +164,10 @@ enum AVPixelFormat CDVDVideoCodecFFmpeg::GetFormat( struct AVCodecContext * avct
}
#endif
-#ifdef TARGET_DARWIN_OSX
- if (*cur == AV_PIX_FMT_VDA && CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEVDA) && g_advancedSettings.m_useFfmpegVda)
+#ifdef TARGET_DARWIN
+ if (*cur == AV_PIX_FMT_VIDEOTOOLBOX && CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEVTB))
{
- VDA::CDecoder* dec = new VDA::CDecoder();
+ VTB::CDecoder* dec = new VTB::CDecoder();
if(dec->Open(avctx, ctx->m_pCodecContext, *cur, ctx->m_uSurfacesCount))
{
ctx->SetHardware(dec);
@@ -289,8 +289,8 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
if(CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEDXVA2))
tryhw = true;
#endif
-#ifdef TARGET_DARWIN_OSX
- if(CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEVDA))
+#ifdef TARGET_DARWIN
+ if(CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEVTB))
tryhw = true;
#endif
#ifdef HAS_MMAL
@@ -490,6 +490,19 @@ void CDVDVideoCodecFFmpeg::SetFilters()
}
}
+void CDVDVideoCodecFFmpeg::UpdateName()
+{
+ if(m_pCodecContext->codec->name)
+ m_name = std::string("ff-") + m_pCodecContext->codec->name;
+ else
+ m_name = "ffmpeg";
+
+ if(m_pHardware)
+ m_name += "-" + m_pHardware->Name();
+
+ CLog::Log(LOGDEBUG, "CDVDVideoCodecFFmpeg - Updated codec: %s", m_name.c_str());
+}
+
union pts_union
{
double pts_d;
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h
index 31ee83fe11..2e683c677e 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h
@@ -83,17 +83,7 @@ protected:
void FilterClose();
int FilterProcess(AVFrame* frame);
void SetFilters();
-
- void UpdateName()
- {
- if(m_pCodecContext->codec->name)
- m_name = std::string("ff-") + m_pCodecContext->codec->name;
- else
- m_name = "ffmpeg";
-
- if(m_pHardware)
- m_name += "-" + m_pHardware->Name();
- }
+ void UpdateName();
AVFrame* m_pFrame;
AVFrame* m_pDecodedFrame;
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.cpp
deleted file mode 100644
index 0bcdb4e6b6..0000000000
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.cpp
+++ /dev/null
@@ -1,1704 +0,0 @@
-/*
- * Copyright (C) 2010-2013 Team XBMC
- * http://xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#if (defined HAVE_CONFIG_H) && (!defined TARGET_WINDOWS)
- #include "config.h"
-#endif
-
-#if defined(HAVE_VIDEOTOOLBOXDECODER)
-#include "DVDClock.h"
-#include "DVDStreamInfo.h"
-#include "DVDCodecs/DVDCodecUtils.h"
-#include "DVDVideoCodecVideoToolBox.h"
-#include "settings/Settings.h"
-#include "settings/AdvancedSettings.h"
-#include "utils/log.h"
-#include "utils/TimeUtils.h"
-#include "utils/SystemInfo.h"
-#include "platform/darwin/DarwinUtils.h"
-
-extern "C" {
-#include "libswscale/swscale.h"
-#include "libavformat/avformat.h"
-}
-
-#include "DllVideoToolBox.h"
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-#pragma pack(push, 4)
-//-----------------------------------------------------------------------------------
-// /System/Library/Frameworks/CoreMedia.framework
-union
-{
- void* lpAddress;
- // iOS <= 4.2
- OSStatus (*FigVideoFormatDescriptionCreateWithSampleDescriptionExtensionAtom1)(
- CFAllocatorRef allocator, UInt32 formatId, UInt32 width, UInt32 height,
- UInt32 atomId, const UInt8 *data, CFIndex len, CMFormatDescriptionRef *formatDesc);
- // iOS >= 4.3
- OSStatus (*FigVideoFormatDescriptionCreateWithSampleDescriptionExtensionAtom2)(
- CFAllocatorRef allocator, UInt32 formatId, UInt32 width, UInt32 height,
- UInt32 atomId, const UInt8 *data, CFIndex len, CFDictionaryRef extensions, CMFormatDescriptionRef *formatDesc);
-} FigVideoHack;
-extern OSStatus FigVideoFormatDescriptionCreateWithSampleDescriptionExtensionAtom(
- CFAllocatorRef allocator, UInt32 formatId, UInt32 width, UInt32 height,
- UInt32 atomId, const UInt8 *data, CFIndex len, CMFormatDescriptionRef *formatDesc);
-
-extern CMSampleBufferRef FigSampleBufferRetain(CMSampleBufferRef buf);
-//-----------------------------------------------------------------------------------
-#pragma pack(pop)
-
-#if defined(__cplusplus)
-}
-#endif
-
-int CheckNP2( unsigned x )
-{
- --x;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- return ++x;
-}
-
-//-----------------------------------------------------------------------------------
-//-----------------------------------------------------------------------------------
-// helper functions for debuging VTDecompression
-#if _DEBUG
-char* vtutil_string_to_utf8(CFStringRef s)
-{
- char *result;
- CFIndex size;
-
- size = CFStringGetMaximumSizeForEncoding(CFStringGetLength (s), kCFStringEncodingUTF8);
- result = (char*)malloc(size + 1);
- CFStringGetCString(s, result, size + 1, kCFStringEncodingUTF8);
-
- return result;
-}
-
-char* vtutil_object_to_string(CFTypeRef obj)
-{
- char *result;
- CFStringRef s;
-
- if (obj == NULL)
- return strdup ("(null)");
-
- s = CFCopyDescription(obj);
- result = vtutil_string_to_utf8(s);
- CFRelease(s);
-
- return result;
-}
-
-typedef struct {
- VTDecompressionSessionRef session;
-} VTDumpDecompressionPropCtx;
-
-void
-vtdec_session_dump_property(CFStringRef prop_name, CFDictionaryRef prop_attrs, VTDumpDecompressionPropCtx *dpc)
-{
- char *name_str;
- CFTypeRef prop_value;
- OSStatus status;
-
- name_str = vtutil_string_to_utf8(prop_name);
- if (true)
- {
- char *attrs_str;
-
- attrs_str = vtutil_object_to_string(prop_attrs);
- if (g_advancedSettings.CanLogComponent(LOGVIDEO))
- CLog::Log(LOGDEBUG, "%s = %s\n", name_str, attrs_str);
- free(attrs_str);
- }
-
- status = CDVDVideoCodecVideoToolBox::GetDllImpl()->VTDecompressionSessionCopyProperty(dpc->session, prop_name, NULL, &prop_value);
- if (status == kVTDecoderNoErr)
- {
- char *value_str;
-
- value_str = vtutil_object_to_string(prop_value);
- if (g_advancedSettings.CanLogComponent(LOGVIDEO))
- CLog::Log(LOGDEBUG, "%s = %s\n", name_str, value_str);
- free(value_str);
-
- if (prop_value != NULL)
- CFRelease(prop_value);
- }
- else
- {
- if (g_advancedSettings.CanLogComponent(LOGVIDEO))
- CLog::Log(LOGDEBUG, "%s = <failed to query: %d>\n", name_str, (int)status);
- }
-
- free(name_str);
-}
-
-void vtdec_session_dump_properties(VTDecompressionSessionRef session)
-{
- VTDumpDecompressionPropCtx dpc = { session };
- CFDictionaryRef dict;
- OSStatus status;
-
- status = CDVDVideoCodecVideoToolBox::GetDllImpl()->VTDecompressionSessionCopySupportedPropertyDictionary(session, &dict);
- if (status != kVTDecoderNoErr)
- goto error;
- CFDictionaryApplyFunction(dict, (CFDictionaryApplierFunction)vtdec_session_dump_property, &dpc);
- CFRelease(dict);
-
- return;
-
-error:
- if (g_advancedSettings.CanLogComponent(LOGVIDEO))
- CLog::Log(LOGDEBUG, "failed to dump properties\n");
-}
-#endif
-//-----------------------------------------------------------------------------------
-//-----------------------------------------------------------------------------------
-// helper function that inserts an int32_t into a dictionary
-static void
-CFDictionarySetSInt32(CFMutableDictionaryRef dictionary, CFStringRef key, SInt32 numberSInt32)
-{
- CFNumberRef number;
-
- number = CFNumberCreate(NULL, kCFNumberSInt32Type, &numberSInt32);
- CFDictionarySetValue(dictionary, key, number);
- CFRelease(number);
-}
-// helper function that inserts an double into a dictionary
-static void
-CFDictionarySetDouble(CFMutableDictionaryRef dictionary, CFStringRef key, double numberDouble)
-{
- CFNumberRef number;
-
- number = CFNumberCreate(NULL, kCFNumberDoubleType, &numberDouble);
- CFDictionaryAddValue(dictionary, key, number);
- CFRelease(number);
-}
-// helper function that wraps dts/pts into a dictionary
-static CFDictionaryRef
-CreateDictionaryWithDisplayTime(double time, double dts, double pts)
-{
- CFStringRef key[3] = {
- CFSTR("VideoDisplay_TIME"),
- CFSTR("VideoDisplay_DTS"),
- CFSTR("VideoDisplay_PTS")};
- CFNumberRef value[3];
- CFDictionaryRef display_time;
-
- value[0] = CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, &time);
- value[1] = CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, &dts);
- value[2] = CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, &pts);
-
- display_time = CFDictionaryCreate(
- kCFAllocatorDefault, (const void **)&key, (const void **)&value, 3,
- &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
-
- CFRelease(value[0]);
- CFRelease(value[1]);
- CFRelease(value[2]);
-
- return display_time;
-}
-// helper function to extract dts/pts from a dictionary
-static void
-GetFrameDisplayTimeFromDictionary(
- CFDictionaryRef inFrameInfoDictionary, frame_queue *frame)
-{
- // default to DVD_NOPTS_VALUE
- frame->sort_time = -1.0;
- frame->dts = DVD_NOPTS_VALUE;
- frame->pts = DVD_NOPTS_VALUE;
- if (inFrameInfoDictionary == NULL)
- return;
-
- CFNumberRef value[3];
- //
- value[0] = (CFNumberRef)CFDictionaryGetValue(inFrameInfoDictionary, CFSTR("VideoDisplay_TIME"));
- if (value[0])
- CFNumberGetValue(value[0], kCFNumberDoubleType, &frame->sort_time);
- value[1] = (CFNumberRef)CFDictionaryGetValue(inFrameInfoDictionary, CFSTR("VideoDisplay_DTS"));
- if (value[1])
- CFNumberGetValue(value[1], kCFNumberDoubleType, &frame->dts);
- value[2] = (CFNumberRef)CFDictionaryGetValue(inFrameInfoDictionary, CFSTR("VideoDisplay_PTS"));
- if (value[2])
- CFNumberGetValue(value[2], kCFNumberDoubleType, &frame->pts);
-
- return;
-}
-// helper function to create a format descriptor
-static CMFormatDescriptionRef
-CreateFormatDescription(VTFormatId format_id, int width, int height)
-{
- CMFormatDescriptionRef fmt_desc;
- OSStatus status;
-
- status = CMVideoFormatDescriptionCreate(
- NULL, // CFAllocatorRef allocator
- format_id,
- width,
- height,
- NULL, // CFDictionaryRef extensions
- &fmt_desc);
-
- if (status == kVTDecoderNoErr)
- return fmt_desc;
- else
- return NULL;
-}
-// helper function to create a avcC atom format descriptor
-static CMFormatDescriptionRef
-CreateFormatDescriptionFromCodecData(VTFormatId format_id, int width, int height, const uint8_t *extradata, int extradata_size, uint32_t atom)
-{
- CMFormatDescriptionRef fmt_desc = NULL;
- OSStatus status;
-
- FigVideoHack.lpAddress = (void*)FigVideoFormatDescriptionCreateWithSampleDescriptionExtensionAtom;
-
- if (CDarwinUtils::GetIOSVersion() < 4.3)
- {
- if (g_advancedSettings.CanLogComponent(LOGVIDEO))
- CLog::Log(LOGDEBUG, "%s - GetIOSVersion says < 4.3", __FUNCTION__);
- status = FigVideoHack.FigVideoFormatDescriptionCreateWithSampleDescriptionExtensionAtom1(
- NULL,
- format_id,
- width,
- height,
- atom,
- extradata,
- extradata_size,
- &fmt_desc);
- }
- else
- {
- if (g_advancedSettings.CanLogComponent(LOGVIDEO))
- CLog::Log(LOGDEBUG, "%s - GetIOSVersion says >= 4.3", __FUNCTION__);
- status = FigVideoHack.FigVideoFormatDescriptionCreateWithSampleDescriptionExtensionAtom2(
- NULL,
- format_id,
- width,
- height,
- atom,
- extradata,
- extradata_size,
- NULL,
- &fmt_desc);
- }
-
- if (status == kVTDecoderNoErr)
- return fmt_desc;
- else
- return NULL;
-}
-// helper function to create a CMSampleBufferRef from demuxer data
-static CMSampleBufferRef
-CreateSampleBufferFrom(CMFormatDescriptionRef fmt_desc, void *demux_buff, size_t demux_size)
-{
- OSStatus status;
- CMBlockBufferRef newBBufOut = NULL;
- CMSampleBufferRef sBufOut = NULL;
-
- status = CMBlockBufferCreateWithMemoryBlock(
- NULL, // CFAllocatorRef structureAllocator
- demux_buff, // void *memoryBlock
- demux_size, // size_t blockLengt
- kCFAllocatorNull, // CFAllocatorRef blockAllocator
- NULL, // const CMBlockBufferCustomBlockSource *customBlockSource
- 0, // size_t offsetToData
- demux_size, // size_t dataLength
- FALSE, // CMBlockBufferFlags flags
- &newBBufOut); // CMBlockBufferRef *newBBufOut
-
- if (!status)
- {
- status = CMSampleBufferCreate(
- NULL, // CFAllocatorRef allocator
- newBBufOut, // CMBlockBufferRef dataBuffer
- TRUE, // Boolean dataReady
- 0, // CMSampleBufferMakeDataReadyCallback makeDataReadyCallback
- 0, // void *makeDataReadyRefcon
- fmt_desc, // CMFormatDescriptionRef formatDescription
- 1, // CMItemCount numSamples
- 0, // CMItemCount numSampleTimingEntries
- NULL, // const CMSampleTimingInfo *sampleTimingArray
- 0, // CMItemCount numSampleSizeEntries
- NULL, // const size_t *sampleSizeArray
- &sBufOut); // CMSampleBufferRef *sBufOut
- }
-
- CFRelease(newBBufOut);
-
- /*
- CLog::Log(LOGDEBUG, "%s - CreateSampleBufferFrom size %ld demux_buff [0x%08x] sBufOut [0x%08x]",
- __FUNCTION__, demux_size, (unsigned int)demux_buff, (unsigned int)sBufOut);
- */
-
- return sBufOut;
-}
-
-//-----------------------------------------------------------------------------------
-//-----------------------------------------------------------------------------------
-/* MPEG-4 esds (elementary stream descriptor) */
-typedef struct {
- int version;
- long flags;
-
- uint16_t esid;
- uint8_t stream_priority;
-
- uint8_t objectTypeId;
- uint8_t streamType;
- uint32_t bufferSizeDB;
- uint32_t maxBitrate;
- uint32_t avgBitrate;
-
- int decoderConfigLen;
- uint8_t* decoderConfig;
-} quicktime_esds_t;
-
-int quicktime_write_mp4_descr_length(AVIOContext *pb, int length, int compact)
-{
- int i;
- uint8_t b;
- int numBytes;
-
- if (compact)
- {
- if (length <= 0x7F)
- {
- numBytes = 1;
- }
- else if (length <= 0x3FFF)
- {
- numBytes = 2;
- }
- else if (length <= 0x1FFFFF)
- {
- numBytes = 3;
- }
- else
- {
- numBytes = 4;
- }
- }
- else
- {
- numBytes = 4;
- }
-
- for (i = numBytes-1; i >= 0; i--)
- {
- b = (length >> (i * 7)) & 0x7F;
- if (i != 0)
- {
- b |= 0x80;
- }
- avio_w8(pb, b);
- }
-
- return numBytes;
-}
-
-void quicktime_write_esds(AVIOContext *pb, quicktime_esds_t *esds)
-{
- avio_w8(pb, 0); // Version
- avio_wb24(pb, 0); // Flags
-
- // elementary stream descriptor tag
- avio_w8(pb, 0x03);
- quicktime_write_mp4_descr_length(pb,
- 3 + 5 + (13 + 5 + esds->decoderConfigLen) + 3, false);
- // 3 bytes + 5 bytes for tag
- avio_wb16(pb, esds->esid);
- avio_w8(pb, esds->stream_priority);
-
- // decoder configuration description tag
- avio_w8(pb, 0x04);
- quicktime_write_mp4_descr_length(pb,
- 13 + 5 + esds->decoderConfigLen, false);
- // 13 bytes + 5 bytes for tag
- avio_w8(pb, esds->objectTypeId); // objectTypeIndication
- avio_w8(pb, esds->streamType); // streamType
- avio_wb24(pb, esds->bufferSizeDB); // buffer size
- avio_wb32(pb, esds->maxBitrate); // max bitrate
- avio_wb32(pb, esds->avgBitrate); // average bitrate
-
- // decoder specific description tag
- avio_w8(pb, 0x05);
- quicktime_write_mp4_descr_length(pb, esds->decoderConfigLen, false);
- avio_write(pb, esds->decoderConfig, esds->decoderConfigLen);
-
- // sync layer configuration descriptor tag
- avio_w8(pb, 0x06); // tag
- avio_w8(pb, 0x01); // length
- avio_w8(pb, 0x7F); // no SL
-
- /* no IPI_DescrPointer */
- /* no IP_IdentificationDataSet */
- /* no IPMP_DescriptorPointer */
- /* no LanguageDescriptor */
- /* no QoS_Descriptor */
- /* no RegistrationDescriptor */
- /* no ExtensionDescriptor */
-
-}
-
-quicktime_esds_t* quicktime_set_esds(const uint8_t * decoderConfig, int decoderConfigLen)
-{
- // ffmpeg's codec->avctx->extradata, codec->avctx->extradata_size
- // are decoderConfig/decoderConfigLen
- quicktime_esds_t *esds;
-
- esds = (quicktime_esds_t*)malloc(sizeof(quicktime_esds_t));
- memset(esds, 0, sizeof(quicktime_esds_t));
-
- esds->version = 0;
- esds->flags = 0;
-
- esds->esid = 0;
- esds->stream_priority = 0; // 16 ? 0x1f
-
- esds->objectTypeId = 32; // 32 = AV_CODEC_ID_MPEG4, 33 = AV_CODEC_ID_H264
- // the following fields is made of 6 bits to identify the streamtype (4 for video, 5 for audio)
- // plus 1 bit to indicate upstream and 1 bit set to 1 (reserved)
- esds->streamType = 0x11;
- esds->bufferSizeDB = 64000; // Hopefully not important :)
-
- // Maybe correct these later?
- esds->maxBitrate = 200000; // 0 for vbr
- esds->avgBitrate = 200000;
-
- esds->decoderConfigLen = decoderConfigLen;
- esds->decoderConfig = (uint8_t*)malloc(esds->decoderConfigLen);
- memcpy(esds->decoderConfig, decoderConfig, esds->decoderConfigLen);
- return esds;
-}
-
-void quicktime_esds_dump(quicktime_esds_t * esds)
-{
- int i;
- printf("esds: \n");
- printf(" Version: %d\n", esds->version);
- printf(" Flags: 0x%06lx\n", esds->flags);
- printf(" ES ID: 0x%04x\n", esds->esid);
- printf(" Priority: 0x%02x\n", esds->stream_priority);
- printf(" objectTypeId: %d\n", esds->objectTypeId);
- printf(" streamType: 0x%02x\n", esds->streamType);
- printf(" bufferSizeDB: %d\n", esds->bufferSizeDB);
-
- printf(" maxBitrate: %d\n", esds->maxBitrate);
- printf(" avgBitrate: %d\n", esds->avgBitrate);
- printf(" decoderConfigLen: %d\n", esds->decoderConfigLen);
- printf(" decoderConfig:");
- for(i = 0; i < esds->decoderConfigLen; i++)
- {
- if(!(i % 16))
- printf("\n ");
- printf("%02x ", esds->decoderConfig[i]);
- }
- printf("\n");
-}
-
-//-----------------------------------------------------------------------------------
-//-----------------------------------------------------------------------------------
-// TODO: refactor this so as not to need these ffmpeg routines.
-// These are not exposed in ffmpeg's API so we dupe them here.
-// AVC helper functions for muxers,
-// * Copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier@smartjog.com>
-// This is part of FFmpeg
-// * License as published by the Free Software Foundation; either
-// * version 2.1 of the License, or (at your option) any later version.
-#define VDA_RB16(x) \
- ((((const uint8_t*)(x))[0] << 8) | \
- ((const uint8_t*)(x)) [1])
-
-#define VDA_RB24(x) \
- ((((const uint8_t*)(x))[0] << 16) | \
- (((const uint8_t*)(x))[1] << 8) | \
- ((const uint8_t*)(x))[2])
-
-#define VDA_RB32(x) \
- ((((const uint8_t*)(x))[0] << 24) | \
- (((const uint8_t*)(x))[1] << 16) | \
- (((const uint8_t*)(x))[2] << 8) | \
- ((const uint8_t*)(x))[3])
-
-static const uint8_t *avc_find_startcode_internal(const uint8_t *p, const uint8_t *end)
-{
- const uint8_t *a = p + 4 - ((intptr_t)p & 3);
-
- for (end -= 3; p < a && p < end; p++)
- {
- if (p[0] == 0 && p[1] == 0 && p[2] == 1)
- return p;
- }
-
- for (end -= 3; p < end; p += 4)
- {
- uint32_t x = *(const uint32_t*)p;
- if ((x - 0x01010101) & (~x) & 0x80808080) // generic
- {
- if (p[1] == 0)
- {
- if (p[0] == 0 && p[2] == 1)
- return p;
- if (p[2] == 0 && p[3] == 1)
- return p+1;
- }
- if (p[3] == 0)
- {
- if (p[2] == 0 && p[4] == 1)
- return p+2;
- if (p[4] == 0 && p[5] == 1)
- return p+3;
- }
- }
- }
-
- for (end += 3; p < end; p++)
- {
- if (p[0] == 0 && p[1] == 0 && p[2] == 1)
- return p;
- }
-
- return end + 3;
-}
-
-const uint8_t *avc_find_startcode(const uint8_t *p, const uint8_t *end)
-{
- const uint8_t *out= avc_find_startcode_internal(p, end);
- if (p<out && out<end && !out[-1])
- out--;
- return out;
-}
-
-const int avc_parse_nal_units(AVIOContext *pb, const uint8_t *buf_in, int size)
-{
- const uint8_t *p = buf_in;
- const uint8_t *end = p + size;
- const uint8_t *nal_start, *nal_end;
-
- size = 0;
- nal_start = avc_find_startcode(p, end);
- while (nal_start < end)
- {
- while (!*(nal_start++));
- nal_end = avc_find_startcode(nal_start, end);
- avio_wb32(pb, nal_end - nal_start);
- avio_write(pb, nal_start, nal_end - nal_start);
- size += 4 + nal_end - nal_start;
- nal_start = nal_end;
- }
- return size;
-}
-
-const int avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
-{
- AVIOContext *pb;
- int ret = avio_open_dyn_buf(&pb);
- if (ret < 0)
- return ret;
-
- avc_parse_nal_units(pb, buf_in, *size);
-
- av_freep(buf);
- *size = avio_close_dyn_buf(pb, buf);
- return 0;
-}
-
-/*
- * if extradata size is greater than 7, then have a valid quicktime
- * avcC atom header.
- *
- * -: avcC atom header :-
- * -----------------------------------
- * 1 byte - version
- * 1 byte - h.264 stream profile
- * 1 byte - h.264 compatible profiles
- * 1 byte - h.264 stream level
- * 6 bits - reserved set to 63
- * 2 bits - NAL length
- * ( 0 - 1 byte; 1 - 2 bytes; 3 - 4 bytes)
- * 3 bit - reserved
- * 5 bits - number of SPS
- * for (i=0; i < number of SPS; i++) {
- * 2 bytes - SPS length
- * SPS length bytes - SPS NAL unit
- * }
- * 1 byte - number of PPS
- * for (i=0; i < number of PPS; i++) {
- * 2 bytes - PPS length
- * PPS length bytes - PPS NAL unit
- * }
-
- how to detect the interlacing used on an existing stream:
-- progressive is signalled by setting
- frame_mbs_only_flag: 1 in the SPS.
-- interlaced is signalled by setting
- frame_mbs_only_flag: 0 in the SPS and
- field_pic_flag: 1 on all frames.
-- paff is signalled by setting
- frame_mbs_only_flag: 0 in the SPS and
- field_pic_flag: 1 on all frames that get interlaced and
- field_pic_flag: 0 on all frames that get progressive.
-- mbaff is signalled by setting
- frame_mbs_only_flag: 0 in the SPS and
- mb_adaptive_frame_field_flag: 1 in the SPS and
- field_pic_flag: 0 on the frames,
- (field_pic_flag: 1 would indicate a normal interlaced frame).
-*/
-const int isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len)
-{
- // extradata from bytestream h264, convert to avcC atom data for bitstream
- if (len > 6)
- {
- /* check for h264 start code */
- if (VDA_RB32(data) == 0x00000001 || VDA_RB24(data) == 0x000001)
- {
- uint8_t *buf=NULL, *end, *start;
- uint32_t sps_size=0, pps_size=0;
- uint8_t *sps=0, *pps=0;
-
- int ret = avc_parse_nal_units_buf(data, &buf, &len);
- if (ret < 0)
- return ret;
- start = buf;
- end = buf + len;
-
- /* look for sps and pps */
- while (buf < end)
- {
- unsigned int size;
- uint8_t nal_type;
- size = VDA_RB32(buf);
- nal_type = buf[4] & 0x1f;
- if (nal_type == 7) /* SPS */
- {
- sps = buf + 4;
- sps_size = size;
- }
- else if (nal_type == 8) /* PPS */
- {
- pps = buf + 4;
- pps_size = size;
- }
- buf += size + 4;
- }
- assert(sps);
-
- avio_w8(pb, 1); /* version */
- avio_w8(pb, sps[1]); /* profile */
- avio_w8(pb, sps[2]); /* profile compat */
- avio_w8(pb, sps[3]); /* level */
- avio_w8(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */
- avio_w8(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */
-
- avio_wb16(pb, sps_size);
- avio_write(pb, sps, sps_size);
- if (pps)
- {
- avio_w8(pb, 1); /* number of pps */
- avio_wb16(pb, pps_size);
- avio_write(pb, pps, pps_size);
- }
- av_free(start);
- }
- else
- {
- avio_write(pb, data, len);
- }
- }
- return 0;
-}
-//-----------------------------------------------------------------------------------
-//-----------------------------------------------------------------------------------
-// GStreamer h264 parser
-// Copyright (C) 2005 Michal Benes <michal.benes@itonis.tv>
-// (C) 2008 Wim Taymans <wim.taymans@gmail.com>
-// gsth264parse.c:
-// * License as published by the Free Software Foundation; either
-// * version 2.1 of the License, or (at your option) any later version.
-typedef struct
-{
- const uint8_t *data;
- const uint8_t *end;
- int head;
- uint64_t cache;
-} nal_bitstream;
-
-static void
-nal_bs_init(nal_bitstream *bs, const uint8_t *data, size_t size)
-{
- bs->data = data;
- bs->end = data + size;
- bs->head = 0;
- // fill with something other than 0 to detect
- // emulation prevention bytes
- bs->cache = 0xffffffff;
-}
-
-static uint32_t
-nal_bs_read(nal_bitstream *bs, int n)
-{
- uint32_t res = 0;
- int shift;
-
- if (n == 0)
- return res;
-
- // fill up the cache if we need to
- while (bs->head < n)
- {
- uint8_t a_byte;
- bool check_three_byte;
-
- check_three_byte = TRUE;
-next_byte:
- if (bs->data >= bs->end)
- {
- // we're at the end, can't produce more than head number of bits
- n = bs->head;
- break;
- }
- // get the byte, this can be an emulation_prevention_three_byte that we need
- // to ignore.
- a_byte = *bs->data++;
- if (check_three_byte && a_byte == 0x03 && ((bs->cache & 0xffff) == 0))
- {
- // next byte goes unconditionally to the cache, even if it's 0x03
- check_three_byte = FALSE;
- goto next_byte;
- }
- // shift bytes in cache, moving the head bits of the cache left
- bs->cache = (bs->cache << 8) | a_byte;
- bs->head += 8;
- }
-
- // bring the required bits down and truncate
- if ((shift = bs->head - n) > 0)
- res = bs->cache >> shift;
- else
- res = bs->cache;
-
- // mask out required bits
- if (n < 32)
- res &= (1 << n) - 1;
-
- bs->head = shift;
-
- return res;
-}
-
-static bool
-nal_bs_eos(nal_bitstream *bs)
-{
- return (bs->data >= bs->end) && (bs->head == 0);
-}
-
-// read unsigned Exp-Golomb code
-static int
-nal_bs_read_ue(nal_bitstream *bs)
-{
- int i = 0;
-
- while (nal_bs_read(bs, 1) == 0 && !nal_bs_eos(bs) && i < 32)
- i++;
-
- return ((1 << i) - 1 + nal_bs_read(bs, i));
-}
-
-typedef struct
-{
- int profile_idc;
- int level_idc;
- int sps_id;
-
- int chroma_format_idc;
- int separate_colour_plane_flag;
- int bit_depth_luma_minus8;
- int bit_depth_chroma_minus8;
- int qpprime_y_zero_transform_bypass_flag;
- int seq_scaling_matrix_present_flag;
-
- int log2_max_frame_num_minus4;
- int pic_order_cnt_type;
- int log2_max_pic_order_cnt_lsb_minus4;
-
- int max_num_ref_frames;
- int gaps_in_frame_num_value_allowed_flag;
- int pic_width_in_mbs_minus1;
- int pic_height_in_map_units_minus1;
-
- int frame_mbs_only_flag;
- int mb_adaptive_frame_field_flag;
-
- int direct_8x8_inference_flag;
-
- int frame_cropping_flag;
- int frame_crop_left_offset;
- int frame_crop_right_offset;
- int frame_crop_top_offset;
- int frame_crop_bottom_offset;
-} sps_info_struct;
-
-static void
-parseh264_sps(uint8_t *sps, uint32_t sps_size, int *level, int *profile, bool *interlaced, int32_t *max_ref_frames)
-{
- nal_bitstream bs;
- sps_info_struct sps_info = {0};
-
- nal_bs_init(&bs, sps, sps_size);
-
- sps_info.profile_idc = nal_bs_read(&bs, 8);
- nal_bs_read(&bs, 1); // constraint_set0_flag
- nal_bs_read(&bs, 1); // constraint_set1_flag
- nal_bs_read(&bs, 1); // constraint_set2_flag
- nal_bs_read(&bs, 1); // constraint_set3_flag
- nal_bs_read(&bs, 4); // reserved
- sps_info.level_idc = nal_bs_read(&bs, 8);
- sps_info.sps_id = nal_bs_read_ue(&bs);
-
- if (sps_info.profile_idc == 100 ||
- sps_info.profile_idc == 110 ||
- sps_info.profile_idc == 122 ||
- sps_info.profile_idc == 244 ||
- sps_info.profile_idc == 44 ||
- sps_info.profile_idc == 83 ||
- sps_info.profile_idc == 86)
- {
- sps_info.chroma_format_idc = nal_bs_read_ue(&bs);
- if (sps_info.chroma_format_idc == 3)
- sps_info.separate_colour_plane_flag = nal_bs_read(&bs, 1);
- sps_info.bit_depth_luma_minus8 = nal_bs_read_ue(&bs);
- sps_info.bit_depth_chroma_minus8 = nal_bs_read_ue(&bs);
- sps_info.qpprime_y_zero_transform_bypass_flag = nal_bs_read(&bs, 1);
-
- sps_info.seq_scaling_matrix_present_flag = nal_bs_read (&bs, 1);
- if (sps_info.seq_scaling_matrix_present_flag)
- {
- /* TODO: unfinished */
- }
- }
- sps_info.log2_max_frame_num_minus4 = nal_bs_read_ue(&bs);
- if (sps_info.log2_max_frame_num_minus4 > 12)
- { // must be between 0 and 12
- // don't early return here - the bits we are using (profile/level/interlaced/ref frames)
- // might still be valid - let the parser go on and pray.
- //return;
- }
-
- sps_info.pic_order_cnt_type = nal_bs_read_ue(&bs);
- if (sps_info.pic_order_cnt_type == 0)
- {
- sps_info.log2_max_pic_order_cnt_lsb_minus4 = nal_bs_read_ue(&bs);
- }
- else if (sps_info.pic_order_cnt_type == 1)
- { // TODO: unfinished
- /*
- delta_pic_order_always_zero_flag = gst_nal_bs_read (bs, 1);
- offset_for_non_ref_pic = gst_nal_bs_read_se (bs);
- offset_for_top_to_bottom_field = gst_nal_bs_read_se (bs);
-
- num_ref_frames_in_pic_order_cnt_cycle = gst_nal_bs_read_ue (bs);
- for( i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++ )
- offset_for_ref_frame[i] = gst_nal_bs_read_se (bs);
- */
- }
-
- sps_info.max_num_ref_frames = nal_bs_read_ue(&bs);
- sps_info.gaps_in_frame_num_value_allowed_flag = nal_bs_read(&bs, 1);
- sps_info.pic_width_in_mbs_minus1 = nal_bs_read_ue(&bs);
- sps_info.pic_height_in_map_units_minus1 = nal_bs_read_ue(&bs);
-
- sps_info.frame_mbs_only_flag = nal_bs_read(&bs, 1);
- if (!sps_info.frame_mbs_only_flag)
- sps_info.mb_adaptive_frame_field_flag = nal_bs_read(&bs, 1);
-
- sps_info.direct_8x8_inference_flag = nal_bs_read(&bs, 1);
-
- sps_info.frame_cropping_flag = nal_bs_read(&bs, 1);
- if (sps_info.frame_cropping_flag)
- {
- sps_info.frame_crop_left_offset = nal_bs_read_ue(&bs);
- sps_info.frame_crop_right_offset = nal_bs_read_ue(&bs);
- sps_info.frame_crop_top_offset = nal_bs_read_ue(&bs);
- sps_info.frame_crop_bottom_offset = nal_bs_read_ue(&bs);
- }
-
- *level = sps_info.level_idc;
- *profile = sps_info.profile_idc;
- *interlaced = !sps_info.frame_mbs_only_flag;
- *max_ref_frames = sps_info.max_num_ref_frames;
-}
-
-bool validate_avcC_spc(uint8_t *extradata, uint32_t extrasize, int32_t *max_ref_frames, int *level, int *profile)
-{
- // check the avcC atom's sps for number of reference frames and
- // bail if interlaced, VDA does not handle interlaced h264.
- bool interlaced = true;
- uint8_t *spc = extradata + 6;
- uint32_t sps_size = VDA_RB16(spc);
- if (sps_size)
- parseh264_sps(spc+3, sps_size-1, level, profile, &interlaced, max_ref_frames);
- if (interlaced)
- return false;
- return true;
-}
-
-//-----------------------------------------------------------------------------------
-//-----------------------------------------------------------------------------------
-DllVideoToolBoxInterface *CDVDVideoCodecVideoToolBox::m_pLibVTB = NULL;
-
-CDVDVideoCodecVideoToolBox::CDVDVideoCodecVideoToolBox(CProcessInfo &processInfo) : CDVDVideoCodec(processInfo)
-{
- m_fmt_desc = NULL;
- m_vt_session = NULL;
- m_pFormatName = "vtb";
-
- m_queue_depth = 0;
- m_display_queue = NULL;
- m_max_ref_frames = 4;
- pthread_mutex_init(&m_queue_mutex, NULL);
-
- m_convert_bytestream = false;
- m_convert_3byteTo4byteNALSize = false;
- memset(&m_videobuffer, 0, sizeof(DVDVideoPicture));
- m_DropPictures = false;
- m_sort_time_offset = 0.0;
-
- if (m_pLibVTB == NULL)
- {
- if (CDarwinUtils::GetIOSVersion() < 6.0)
- {
- m_pLibVTB = new DllVideoToolBoxPrivate();
- }
- else
- {
- m_pLibVTB = new DllVideoToolBoxPublic();// todo - load the public version
- }
- }
-}
-
-CDVDVideoCodecVideoToolBox::~CDVDVideoCodecVideoToolBox()
-{
- Dispose();
- pthread_mutex_destroy(&m_queue_mutex);
- if (m_pLibVTB != NULL)
- {
- delete m_pLibVTB;
- m_pLibVTB = NULL; // its a static!
- }
-}
-
-bool CDVDVideoCodecVideoToolBox::HandleDyLoad()
-{
- bool ret = true;
- if (CDarwinUtils::GetIOSVersion() < 6.0)
- {
- if(!((DllVideoToolBoxPrivate *)m_pLibVTB)->IsLoaded())
- {
- if(!((DllVideoToolBoxPrivate *)m_pLibVTB)->Load())
- {
- CLog::Log(LOGERROR,"VideoToolBox: Error loading private VideoToolBox framework (%s).",__FUNCTION__);
- ret = false; //fatal
- }
- }
- }
- else
- {
- if(!((DllVideoToolBoxPublic *)m_pLibVTB)->IsLoaded())
- {
- if(!((DllVideoToolBoxPublic *)m_pLibVTB)->Load())
- {
- CLog::Log(LOGERROR,"VideoToolBox: Error loading public VideoToolBox framework (%s).",__FUNCTION__);
- ret = false; //fatal
- }
- }
- }
- return ret;
-}
-
-
-bool CDVDVideoCodecVideoToolBox::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options)
-{
- if (!CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEVIDEOTOOLBOX))
- return false;
- if (!g_sysinfo.HasVideoToolBoxDecoder())
- return false;
- if (hints.stills)
- return false;
- if (hints.ptsinvalid)
- return false;
- if (hints.codec != AV_CODEC_ID_H264)
- return false;
-
- if (CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEVIDEOTOOLBOX) && !hints.software)
- {
- int width = hints.width;
- int height = hints.height;
- int level = hints.level;
- int profile = hints.profile;
- int spsLevel = level;
- int spsProfile = profile;
- unsigned int extrasize = hints.extrasize; // extra data for codec to use
- uint8_t *extradata = (uint8_t*)hints.extradata; // size of extra data
-
- if (!HandleDyLoad())
- return false;
-
- switch(profile)
- {
- case FF_PROFILE_H264_HIGH_10:
- case FF_PROFILE_H264_HIGH_10_INTRA:
- case FF_PROFILE_H264_HIGH_422:
- case FF_PROFILE_H264_HIGH_422_INTRA:
- case FF_PROFILE_H264_HIGH_444_PREDICTIVE:
- case FF_PROFILE_H264_HIGH_444_INTRA:
- case FF_PROFILE_H264_CAVLC_444:
- CLog::Log(LOGNOTICE, "%s - unsupported h264 profile(%d)", __FUNCTION__, hints.profile);
- return false;
- break;
- }
-
- if (width <= 0 || height <= 0)
- {
- CLog::Log(LOGNOTICE, "%s - bailing with bogus hints, width(%d), height(%d)",
- __FUNCTION__, width, height);
- return false;
- }
-
- switch (hints.codec)
- {
- case AV_CODEC_ID_MPEG4:
- if (extrasize)
- {
- AVIOContext *pb;
- quicktime_esds_t *esds;
-
- if (avio_open_dyn_buf(&pb) < 0)
- return false;
-
- esds = quicktime_set_esds(extradata, extrasize);
- quicktime_write_esds(pb, esds);
-
- // unhook from ffmpeg's extradata
- extradata = NULL;
- // extract the esds atom decoderConfig from extradata
- extrasize = avio_close_dyn_buf(pb, &extradata);
- free(esds->decoderConfig);
- free(esds);
-
- m_fmt_desc = CreateFormatDescriptionFromCodecData(
- kVTFormatMPEG4Video, width, height, extradata, extrasize, 'esds');
-
- // done with the converted extradata, we MUST free using av_free
- av_free(extradata);
- }
- else
- {
- m_fmt_desc = CreateFormatDescription(kVTFormatMPEG4Video, width, height);
- }
- m_pFormatName = "vtb-mpeg4";
- break;
-
- case AV_CODEC_ID_MPEG2VIDEO:
- m_fmt_desc = CreateFormatDescription(kVTFormatMPEG2Video, width, height);
- m_pFormatName = "vtb-mpeg2";
- break;
-
- case AV_CODEC_ID_H264:
- if (extrasize < 7 || extradata == NULL)
- {
- //m_fmt_desc = CreateFormatDescription(kVTFormatH264, width, height);
- CLog::Log(LOGNOTICE, "%s - avcC atom too data small or missing", __FUNCTION__);
- return false;
- }
-
- if (extradata[0] == 1)
- {
- // check for interlaced and get number of ref frames
- if (!validate_avcC_spc(extradata, extrasize, &m_max_ref_frames, &spsLevel, &spsProfile))
- return false;
-
- // overwrite level and profile from the hints
- // if we got something more valid from the extradata
- if (level == 0 && spsLevel > 0)
- level = spsLevel;
-
- if (profile == 0 && spsProfile > 0)
- profile = spsProfile;
-
- // we need to check this early, CreateFormatDescriptionFromCodecData will silently fail
- // with a bogus m_fmt_desc returned that crashes on CFRelease.
- if (profile == FF_PROFILE_H264_MAIN && level == 32 && m_max_ref_frames > 4)
- {
- // Main@L3.2, VTB cannot handle greater than 4 ref frames (ie. flash video)
- CLog::Log(LOGNOTICE, "%s - Main@L3.2 detected, VTB cannot decode with %d ref frames",
- __FUNCTION__, m_max_ref_frames);
- return false;
- }
-
- if (extradata[4] == 0xFE)
- {
- // video content is from some silly encoder that think 3 byte NAL sizes
- // are valid, setup to convert 3 byte NAL sizes to 4 byte.
- extradata[4] = 0xFF;
- m_convert_3byteTo4byteNALSize = true;
- }
- // valid avcC atom data always starts with the value 1 (version)
- m_fmt_desc = CreateFormatDescriptionFromCodecData(
- kVTFormatH264, width, height, extradata, extrasize, 'avcC');
-
- CLog::Log(LOGNOTICE, "%s - using avcC atom of size(%d), ref_frames(%d)", __FUNCTION__, extrasize, m_max_ref_frames);
- }
- else
- {
- if ( (extradata[0] == 0 && extradata[1] == 0 && extradata[2] == 0 && extradata[3] == 1) ||
- (extradata[0] == 0 && extradata[1] == 0 && extradata[2] == 1))
- {
- // video content is from x264 or from bytestream h264 (AnnexB format)
- // NAL reformating to bitstream format required
-
- AVIOContext *pb;
- if (avio_open_dyn_buf(&pb) < 0)
- return false;
-
- m_convert_bytestream = true;
- // create a valid avcC atom data from ffmpeg's extradata
- isom_write_avcc(pb, extradata, extrasize);
- // unhook from ffmpeg's extradata
- extradata = NULL;
- // extract the avcC atom data into extradata getting size into extrasize
- extrasize = avio_close_dyn_buf(pb, &extradata);
-
- // check for interlaced and get number of ref frames
- if (!validate_avcC_spc(extradata, extrasize, &m_max_ref_frames, &spsLevel, &spsProfile))
- {
- av_free(extradata);
- return false;
- }
-
- // overwrite level and profile from the hints
- // if we got something more valid from the extradata
- if (level == 0 && spsLevel > 0)
- level = spsLevel;
-
- if (profile == 0 && spsProfile > 0)
- profile = spsProfile;
-
- // we need to check this early, CreateFormatDescriptionFromCodecData will silently fail
- // with a bogus m_fmt_desc returned that crashes on CFRelease.
- if (profile == FF_PROFILE_H264_MAIN && level == 32 && m_max_ref_frames > 4)
- {
- // Main@L3.2, VTB cannot handle greater than 4 ref frames (ie. flash video)
- CLog::Log(LOGNOTICE, "%s - Main@L3.2 detected, VTB cannot decode with %d ref frames",
- __FUNCTION__, m_max_ref_frames);
- av_free(extradata);
- return false;
- }
-
- // CFDataCreate makes a copy of extradata contents
- m_fmt_desc = CreateFormatDescriptionFromCodecData(
- kVTFormatH264, width, height, extradata, extrasize, 'avcC');
-
- // done with the new converted extradata, we MUST free using av_free
- av_free(extradata);
- CLog::Log(LOGNOTICE, "%s - created avcC atom of size(%d)", __FUNCTION__, extrasize);
- }
- else
- {
- CLog::Log(LOGNOTICE, "%s - invalid avcC atom data", __FUNCTION__);
- return false;
- }
- }
- m_pFormatName = "vtb-h264";
- break;
-
- default:
- return false;
- break;
- }
-
- if(m_fmt_desc == NULL)
- {
- CLog::Log(LOGNOTICE, "%s - created avcC atom of failed", __FUNCTION__);
- m_pFormatName = "";
- return false;
- }
-
- if (m_max_ref_frames == 0)
- m_max_ref_frames = 2;
-
- CreateVTSession(width, height, m_fmt_desc);
- if (m_vt_session == NULL)
- {
- if (m_fmt_desc)
- {
- CFRelease(m_fmt_desc);
- m_fmt_desc = NULL;
- }
- m_pFormatName = "";
- return false;
- }
-
- // setup a DVDVideoPicture buffer.
- // first make sure all properties are reset.
- memset(&m_videobuffer, 0, sizeof(DVDVideoPicture));
-
- m_videobuffer.dts = DVD_NOPTS_VALUE;
- m_videobuffer.pts = DVD_NOPTS_VALUE;
- m_videobuffer.format = RENDER_FMT_CVBREF;
- m_videobuffer.color_range = 0;
- m_videobuffer.color_matrix = 4;
- m_videobuffer.iFlags = DVP_FLAG_ALLOCATED;
- m_videobuffer.iWidth = hints.width;
- m_videobuffer.iHeight = hints.height;
- m_videobuffer.iDisplayWidth = hints.width;
- m_videobuffer.iDisplayHeight = hints.height;
-
- m_DropPictures = false;
- m_max_ref_frames = std::min(m_max_ref_frames, 5);
- m_sort_time_offset = (CurrentHostCounter() * 1000.0) / CurrentHostFrequency();
-
- return true;
- }
-
- return false;
-}
-
-void CDVDVideoCodecVideoToolBox::Dispose()
-{
- DestroyVTSession();
- if (m_fmt_desc)
- {
- CFRelease(m_fmt_desc);
- m_fmt_desc = NULL;
- }
-
- if (m_videobuffer.iFlags & DVP_FLAG_ALLOCATED)
- {
- // release any previous retained cvbuffer reference
- if (m_videobuffer.cvBufferRef)
- CVBufferRelease(m_videobuffer.cvBufferRef);
- m_videobuffer.cvBufferRef = NULL;
- m_videobuffer.iFlags = 0;
- }
-
- while (m_queue_depth)
- DisplayQueuePop();
-}
-
-void CDVDVideoCodecVideoToolBox::SetDropState(bool bDrop)
-{
- m_DropPictures = bDrop;
-}
-
-int CDVDVideoCodecVideoToolBox::Decode(uint8_t* pData, int iSize, double dts, double pts)
-{
- if (pData)
- {
- OSStatus status;
- double sort_time;
- uint32_t decoderFlags = 0;
- CFDictionaryRef frameInfo = NULL;
- CMSampleBufferRef sampleBuff = NULL;
- AVIOContext *pb = NULL;
- int demux_size = 0;
- uint8_t *demux_buff = NULL;
-
- if (m_convert_bytestream)
- {
- // convert demuxer packet from bytestream (AnnexB) to bitstream
- if(avio_open_dyn_buf(&pb) < 0)
- return VC_ERROR;
-
- avc_parse_nal_units(pb, pData, iSize);
- demux_size = avio_close_dyn_buf(pb, &demux_buff);
- sampleBuff = CreateSampleBufferFrom(m_fmt_desc, demux_buff, demux_size);
- }
- else if (m_convert_3byteTo4byteNALSize)
- {
- // convert demuxer packet from 3 byte NAL sizes to 4 byte
- if (avio_open_dyn_buf(&pb) < 0)
- return VC_ERROR;
-
- uint32_t nal_size;
- uint8_t *end = pData + iSize;
- uint8_t *nal_start = pData;
- while (nal_start < end)
- {
- nal_size = VDA_RB24(nal_start);
- avio_wb32(pb, nal_size);
- nal_start += 3;
- avio_write(pb, nal_start, nal_size);
- nal_start += nal_size;
- }
-
- demux_size = avio_close_dyn_buf(pb, &demux_buff);
- sampleBuff = CreateSampleBufferFrom(m_fmt_desc, demux_buff, demux_size);
- }
- else
- {
- sampleBuff = CreateSampleBufferFrom(m_fmt_desc, pData, iSize);
- }
-
- if (!sampleBuff)
- {
- if (demux_size)
- av_free(demux_buff);
- CLog::Log(LOGNOTICE, "%s - CreateSampleBufferFrom failed", __FUNCTION__);
- return VC_ERROR;
- }
-
- sort_time = (CurrentHostCounter() * 1000.0) / CurrentHostFrequency();
- frameInfo = CreateDictionaryWithDisplayTime(sort_time - m_sort_time_offset, dts, pts);
-
- if (m_DropPictures)
- {
- decoderFlags = kVTDecoderDecodeFlags_DontEmitFrame;
- }
-
- // submit for decoding
- status = GetDllImpl()->VTDecompressionSessionDecodeFrame(m_vt_session, sampleBuff, decoderFlags, frameInfo, 0);
- if (status != kVTDecoderNoErr)
- {
- CLog::Log(LOGNOTICE, "%s - VTDecompressionSessionDecodeFrame returned(%d)",
- __FUNCTION__, (int)status);
- CFRelease(frameInfo);
- CFRelease(sampleBuff);
- if (demux_size)
- av_free(demux_buff);
- return VC_ERROR;
- // VTDecompressionSessionDecodeFrame returned 8969 (codecBadDataErr)
- // VTDecompressionSessionDecodeFrame returned -12350
- // VTDecompressionSessionDecodeFrame returned -12902
- // VTDecompressionSessionDecodeFrame returned -12911
- }
-
- // wait for decoding to finish
- status = GetDllImpl()->VTDecompressionSessionWaitForAsynchronousFrames(m_vt_session);
- if (status != kVTDecoderNoErr)
- {
- CLog::Log(LOGNOTICE, "%s - VTDecompressionSessionWaitForAsynchronousFrames returned(%d)",
- __FUNCTION__, (int)status);
- CFRelease(frameInfo);
- CFRelease(sampleBuff);
- if (demux_size)
- av_free(demux_buff);
- return VC_ERROR;
- }
-
- CFRelease(frameInfo);
- CFRelease(sampleBuff);
- if (demux_size)
- av_free(demux_buff);
- }
-
- // TODO: queue depth is related to the number of reference frames in encoded h.264.
- // so we need to buffer until we get N ref frames + 1.
- if (m_queue_depth < m_max_ref_frames)
- return VC_BUFFER;
-
- return VC_PICTURE | VC_BUFFER;
-}
-
-void CDVDVideoCodecVideoToolBox::Reset(void)
-{
- // flush decoder
- GetDllImpl()->VTDecompressionSessionWaitForAsynchronousFrames(m_vt_session);
-
- while (m_queue_depth)
- DisplayQueuePop();
-
- m_sort_time_offset = (CurrentHostCounter() * 1000.0) / CurrentHostFrequency();
-}
-
-bool CDVDVideoCodecVideoToolBox::GetPicture(DVDVideoPicture* pDvdVideoPicture)
-{
- // clone the video picture buffer settings.
- *pDvdVideoPicture = m_videobuffer;
-
- // get the top picture frame, we risk getting the wrong frame if the frame queue
- // depth is less than the number of encoded reference frames. If queue depth
- // is greater than the number of encoded reference frames, then the top frame
- // will never change and we can just grab a ref to the top frame. This way
- // we don't lockout the vdadecoder while doing color format convert.
- pthread_mutex_lock(&m_queue_mutex);
- pDvdVideoPicture->dts = m_display_queue->dts;
- pDvdVideoPicture->pts = m_display_queue->pts;
- pDvdVideoPicture->iWidth = m_display_queue->width;
- pDvdVideoPicture->iHeight = m_display_queue->height;
- pDvdVideoPicture->iDisplayWidth = m_display_queue->width;
- pDvdVideoPicture->iDisplayHeight = m_display_queue->height;
- pDvdVideoPicture->cvBufferRef = m_display_queue->pixel_buffer_ref;
- m_display_queue->pixel_buffer_ref = NULL;
- pthread_mutex_unlock(&m_queue_mutex);
-
- // now we can pop the top frame
- DisplayQueuePop();
-
- static double old_pts;
- if (g_advancedSettings.CanLogComponent(LOGVIDEO) && pDvdVideoPicture->pts < old_pts)
- CLog::Log(LOGDEBUG, "%s - VTBDecoderDecode dts(%f), pts(%f), old_pts(%f)", __FUNCTION__,
- pDvdVideoPicture->dts, pDvdVideoPicture->pts, old_pts);
- old_pts = pDvdVideoPicture->pts;
-
-// CLog::Log(LOGDEBUG, "%s - VTBDecoderDecode dts(%f), pts(%f), cvBufferRef(%p)", __FUNCTION__,
-// pDvdVideoPicture->dts, pDvdVideoPicture->pts, pDvdVideoPicture->cvBufferRef);
-
- return VC_PICTURE | VC_BUFFER;
-}
-
-bool CDVDVideoCodecVideoToolBox::ClearPicture(DVDVideoPicture* pDvdVideoPicture)
-{
- // release any previous retained image buffer ref that
- // has not been passed up to renderer (ie. dropped frames, etc).
- if (pDvdVideoPicture->cvBufferRef)
- CVBufferRelease(pDvdVideoPicture->cvBufferRef);
-
- return CDVDVideoCodec::ClearPicture(pDvdVideoPicture);
-}
-
-void CDVDVideoCodecVideoToolBox::DisplayQueuePop(void)
-{
- if (!m_display_queue || m_queue_depth == 0)
- return;
-
- // pop the top frame off the queue
- pthread_mutex_lock(&m_queue_mutex);
- frame_queue *top_frame = m_display_queue;
- m_display_queue = m_display_queue->nextframe;
- m_queue_depth--;
- pthread_mutex_unlock(&m_queue_mutex);
-
- // and release it
- if (top_frame->pixel_buffer_ref)
- CVBufferRelease(top_frame->pixel_buffer_ref);
- free(top_frame);
-}
-
-
-void
-CDVDVideoCodecVideoToolBox::CreateVTSession(int width, int height, CMFormatDescriptionRef fmt_desc)
-{
- VTDecompressionSessionRef vt_session = NULL;
- CFMutableDictionaryRef destinationPixelBufferAttributes;
- VTDecompressionOutputCallback outputCallback;
- OSStatus status;
-
- #if defined(TARGET_DARWIN_IOS)
- double scale = 0.0;
-
- // decoding, scaling and rendering above 1920 x 800 runs into
- // some bandwidth limit. detect and scale down to reduce
- // the bandwidth requirements.
- int width_clamp = 1280;
- if ((width * height) > (1920 * 800))
- width_clamp = 960;
-
- // for retina devices it should be safe [tm] to
- // loosen the clamp a bit to 1280 pixels width
- if (CDarwinUtils::DeviceHasRetina(scale))
- width_clamp = 1280;
-
- int new_width = CheckNP2(width);
- if (width != new_width)
- {
- // force picture width to power of two and scale up height
- // we do this because no GL_UNPACK_ROW_LENGTH in OpenGLES
- // and the CVPixelBufferPixel gets created using some
- // strange alignment when width is non-standard.
- double w_scaler = (double)new_width / width;
- width = new_width;
- height = height * w_scaler;
- }
- #if !defined(__LP64__)
- // scale output pictures down to 720p size for display
- if (width > width_clamp)
- {
- double w_scaler = (float)width_clamp / width;
- width = width_clamp;
- height = height * w_scaler;
- }
- #endif
- #endif
- destinationPixelBufferAttributes = CFDictionaryCreateMutable(
- NULL, // CFAllocatorRef allocator
- 0, // CFIndex capacity
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
-
- // The recommended pixel format choices are
- // kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange or kCVPixelFormatType_32BGRA.
- // TODO: figure out what we need.
- CFDictionarySetSInt32(destinationPixelBufferAttributes,
- kCVPixelBufferPixelFormatTypeKey, kCVPixelFormatType_32BGRA);
- CFDictionarySetSInt32(destinationPixelBufferAttributes,
- kCVPixelBufferWidthKey, width);
- CFDictionarySetSInt32(destinationPixelBufferAttributes,
- kCVPixelBufferHeightKey, height);
- //CFDictionarySetValue(destinationPixelBufferAttributes,
- // kCVPixelBufferOpenGLCompatibilityKey, kCFBooleanTrue);
-
- outputCallback.callback = VTDecoderCallback;
- outputCallback.refcon = this;
-
- status = GetDllImpl()->VTDecompressionSessionCreate(
- NULL, // CFAllocatorRef allocator
- fmt_desc,
- NULL, // CFTypeRef sessionOptions
- destinationPixelBufferAttributes,
- &outputCallback,
- &vt_session);
- if (status != noErr)
- {
- m_vt_session = NULL;
- CLog::Log(LOGERROR, "%s - failed with status = (%d)", __FUNCTION__, (int)status);
- }
- else
- {
- //vtdec_session_dump_properties(vt_session);
- m_vt_session = (void*)vt_session;
- }
-
- CFRelease(destinationPixelBufferAttributes);
-}
-
-void
-CDVDVideoCodecVideoToolBox::DestroyVTSession(void)
-{
- if (m_vt_session)
- {
- GetDllImpl()->VTDecompressionSessionInvalidate((VTDecompressionSessionRef)m_vt_session);
- CFRelease((VTDecompressionSessionRef)m_vt_session);
- m_vt_session = NULL;
- }
-}
-
-void
-CDVDVideoCodecVideoToolBox::VTDecoderCallback(
- void *refcon,
- CFDictionaryRef frameInfo,
- OSStatus status,
- UInt32 infoFlags,
- CVBufferRef imageBuffer)
-{
- // This is an sync callback due to VTDecompressionSessionWaitForAsynchronousFrames
- CDVDVideoCodecVideoToolBox *ctx = (CDVDVideoCodecVideoToolBox*)refcon;
-
- if (status != kVTDecoderNoErr)
- {
- //CLog::Log(LOGDEBUG, "%s - status error (%d)", __FUNCTION__, (int)status);
- return;
- }
- if (imageBuffer == NULL)
- {
- //CLog::Log(LOGDEBUG, "%s - imageBuffer is NULL", __FUNCTION__);
- return;
- }
- OSType format_type = CVPixelBufferGetPixelFormatType(imageBuffer);
- if (format_type != kCVPixelFormatType_32BGRA)
- {
- CLog::Log(LOGERROR, "%s - imageBuffer format is not 'BGRA',is reporting 0x%x",
- "VTDecoderCallback", (int)format_type);
- return;
- }
- if (kVTDecodeInfo_FrameDropped & infoFlags)
- {
- if (g_advancedSettings.CanLogComponent(LOGVIDEO))
- CLog::Log(LOGDEBUG, "%s - frame dropped", __FUNCTION__);
- return;
- }
-
- // allocate a new frame and populate it with some information.
- // this pointer to a frame_queue type keeps track of the newest decompressed frame
- // and is then inserted into a linked list of frame pointers depending on the display time
- // parsed out of the bitstream and stored in the frameInfo dictionary by the client
- frame_queue *newFrame = (frame_queue*)calloc(sizeof(frame_queue), 1);
- newFrame->nextframe = NULL;
- if (CVPixelBufferIsPlanar(imageBuffer) )
- {
- newFrame->width = CVPixelBufferGetWidthOfPlane(imageBuffer, 0);
- newFrame->height = CVPixelBufferGetHeightOfPlane(imageBuffer, 0);
- }
- else
- {
- newFrame->width = CVPixelBufferGetWidth(imageBuffer);
- newFrame->height = CVPixelBufferGetHeight(imageBuffer);
- }
- newFrame->pixel_buffer_format = format_type;
- newFrame->pixel_buffer_ref = CVBufferRetain(imageBuffer);
- GetFrameDisplayTimeFromDictionary(frameInfo, newFrame);
-
- // if both dts or pts are good we use those, else use decoder insert time for frame sort
- if ((newFrame->pts != DVD_NOPTS_VALUE) || (newFrame->dts != DVD_NOPTS_VALUE))
- {
- // if pts is borked (stupid avi's), use dts for frame sort
- if (newFrame->pts == DVD_NOPTS_VALUE)
- newFrame->sort_time = newFrame->dts;
- else
- newFrame->sort_time = newFrame->pts;
- }
-
- // since the frames we get may be in decode order rather than presentation order
- // our hypothetical callback places them in a queue of frames which will
- // hold them in display order for display on another thread
- pthread_mutex_lock(&ctx->m_queue_mutex);
- //
- frame_queue *queueWalker = ctx->m_display_queue;
- if (!queueWalker || (newFrame->sort_time < queueWalker->sort_time))
- {
- // we have an empty queue, or this frame earlier than the current queue head.
- newFrame->nextframe = queueWalker;
- ctx->m_display_queue = newFrame;
- }
- else
- {
- // walk the queue and insert this frame where it belongs in display order.
- bool frameInserted = false;
- frame_queue *nextFrame = NULL;
- //
- while (!frameInserted)
- {
- nextFrame = queueWalker->nextframe;
- if (!nextFrame || (newFrame->sort_time < nextFrame->sort_time))
- {
- // if the next frame is the tail of the queue, or our new frame is earlier.
- newFrame->nextframe = nextFrame;
- queueWalker->nextframe = newFrame;
- frameInserted = true;
- }
- queueWalker = nextFrame;
- }
- }
- ctx->m_queue_depth++;
- //
- pthread_mutex_unlock(&ctx->m_queue_mutex);
-}
-
-#endif
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.h
deleted file mode 100644
index a3909c532e..0000000000
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.h
+++ /dev/null
@@ -1,89 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2010-2013 Team XBMC
- * http://xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#if defined(HAVE_VIDEOTOOLBOXDECODER)
-
-#include <queue>
-
-#include "DVDVideoCodec.h"
-#include <CoreVideo/CoreVideo.h>
-#include <CoreMedia/CoreMedia.h>
-
-class DllVideoToolBoxInterface;
-
-// tracks a frame in and output queue in display order
-typedef struct frame_queue {
- double dts;
- double pts;
- int width;
- int height;
- double sort_time;
- FourCharCode pixel_buffer_format;
- CVPixelBufferRef pixel_buffer_ref;
- struct frame_queue *nextframe;
-} frame_queue;
-
-class CDVDVideoCodecVideoToolBox : public CDVDVideoCodec
-{
-public:
- CDVDVideoCodecVideoToolBox(CProcessInfo &processInfo);
- virtual ~CDVDVideoCodecVideoToolBox();
-
- static DllVideoToolBoxInterface *GetDllImpl() { return m_pLibVTB; }
-
- // Required overrides
- virtual bool Open(CDVDStreamInfo &hints, CDVDCodecOptions &options);
- virtual void Dispose(void);
- virtual int Decode(uint8_t *pData, int iSize, double dts, double pts);
- virtual void Reset(void);
- virtual bool GetPicture(DVDVideoPicture *pDvdVideoPicture);
- virtual bool ClearPicture(DVDVideoPicture* pDvdVideoPicture);
- virtual void SetDropState(bool bDrop);
- virtual const char* GetName(void) { return (const char*)m_pFormatName; }
-
-protected:
- bool HandleDyLoad();
- void DisplayQueuePop(void);
- void CreateVTSession(int width, int height, CMFormatDescriptionRef fmt_desc);
- void DestroyVTSession(void);
- static void VTDecoderCallback(
- void *refcon, CFDictionaryRef frameInfo,
- OSStatus status, UInt32 infoFlags, CVBufferRef imageBuffer);
-
- void *m_vt_session; // opaque videotoolbox session
- CMFormatDescriptionRef m_fmt_desc;
-
- const char *m_pFormatName;
- bool m_DropPictures;
- DVDVideoPicture m_videobuffer;
-
- double m_sort_time_offset;
- pthread_mutex_t m_queue_mutex; // mutex protecting queue manipulation
- frame_queue *m_display_queue; // display-order queue - next display frame is always at the queue head
- int32_t m_queue_depth; // we will try to keep the queue depth at m_max_ref_frames
- int32_t m_max_ref_frames;
-
- bool m_convert_bytestream;
- bool m_convert_3byteTo4byteNALSize;
- static DllVideoToolBoxInterface *m_pLibVTB;//the framework
-};
-
-#endif
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDA.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDA.cpp
deleted file mode 100644
index 9670c5f46c..0000000000
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDA.cpp
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Copyright (C) 2005-2013 Team XBMC
- * http://xbmc.org
- *
- * This library is free software; you can redistribute 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 General Public License
- * along with XBMC; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-#include "system.h"
-#ifdef TARGET_DARWIN_OSX
-#include "platform/darwin/osx/CocoaInterface.h"
-#include "platform/darwin/DarwinUtils.h"
-#include "DVDVideoCodec.h"
-#include "DVDCodecs/DVDCodecUtils.h"
-#include "utils/log.h"
-#include "VDA.h"
-#include "utils/BitstreamConverter.h"
-
-extern "C" {
- #include "libavcodec/vda.h"
-}
-
-using namespace VDA;
-
-
-CDecoder::CDecoder()
-: m_renderbuffers_count(3)
-{
- m_ctx = av_vda_alloc_context();
- m_bitstream = NULL;
-}
-
-CDecoder::~CDecoder()
-{
- Close();
- av_free(m_ctx);
-}
-
-bool CDecoder::Create(AVCodecContext *avctx)
-{
- OSStatus status;
- CFNumberRef height;
- CFNumberRef width;
- CFNumberRef format;
- CFMutableDictionaryRef config_info;
- CFMutableDictionaryRef buffer_attributes;
- CFDictionaryRef io_surface_properties;
- CFNumberRef cv_pix_fmt;
- CFDataRef avcCData;
- int32_t fmt = 'avc1';
- int32_t pix_fmt = kCVPixelFormatType_422YpCbCr8;
-
- switch (avctx->codec_id)
- {
- case AV_CODEC_ID_H264:
- m_bitstream = new CBitstreamConverter;
- if (!m_bitstream->Open(avctx->codec_id, (uint8_t*)avctx->extradata, avctx->extradata_size, false))
- {
- return false;
- }
- break;
-
- default:
- return false;
- break;
- }
-
- avcCData = CFDataCreate(kCFAllocatorDefault,
- (const uint8_t*)m_bitstream->GetExtraData(), m_bitstream->GetExtraSize());
-
- // check the avcC atom's sps for number of reference frames and
- // bail if interlaced, VDA does not handle interlaced h264.
- uint32_t avcc_len = CFDataGetLength(avcCData);
- if (avcc_len < 8)
- {
- // avcc atoms with length less than 8 are borked.
- CFRelease(avcCData);
- return false;
- }
- else
- {
- bool interlaced = true;
- int max_ref_frames;
- uint8_t *spc = (uint8_t*)CFDataGetBytePtr(avcCData) + 6;
- uint32_t sps_size = BS_RB16(spc);
- if (sps_size)
- m_bitstream->parseh264_sps(spc+3, sps_size-1, &interlaced, &max_ref_frames);
- if (interlaced)
- {
- CLog::Log(LOGNOTICE, "%s - possible interlaced content.", __FUNCTION__);
- CFRelease(avcCData);
- return false;
- }
-
- if (((uint8_t*)avctx->extradata)[4] == 0xFE)
- {
- // video content is from so silly encoder that think 3 byte NAL sizes are valid
- CLog::Log(LOGNOTICE, "%s - 3 byte nal length not supported", __FUNCTION__);
- CFRelease(avcCData);
- return false;
- }
- }
-
-
- config_info = CFDictionaryCreateMutable(kCFAllocatorDefault,
- 4,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
-
- height = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &avctx->height);
- width = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &avctx->width);
- format = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &fmt);
-
- CFDictionarySetValue(config_info, kVDADecoderConfiguration_Height, height);
- CFDictionarySetValue(config_info, kVDADecoderConfiguration_Width, width);
- CFDictionarySetValue(config_info, kVDADecoderConfiguration_SourceFormat, format);
- CFDictionarySetValue(config_info, kVDADecoderConfiguration_avcCData, avcCData);
-
- buffer_attributes = CFDictionaryCreateMutable(kCFAllocatorDefault,
- 2,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
-
- io_surface_properties = CFDictionaryCreate(kCFAllocatorDefault,
- NULL, NULL, 0,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
-
- cv_pix_fmt = CFNumberCreate(kCFAllocatorDefault,
- kCFNumberSInt32Type,
- &pix_fmt);
-
- CFDictionarySetValue(buffer_attributes,
- kCVPixelBufferPixelFormatTypeKey,
- cv_pix_fmt);
-
- CFDictionarySetValue(buffer_attributes,
- kCVPixelBufferIOSurfacePropertiesKey,
- io_surface_properties);
-
- status = VDADecoderCreate(config_info,
- buffer_attributes,
- (VDADecoderOutputCallback*)m_ctx->output_callback,
- avctx,
- &m_ctx->decoder);
-
- CFRelease(height);
- CFRelease(width);
- CFRelease(format);
- CFRelease(avcCData);
- CFRelease(config_info);
- CFRelease(io_surface_properties);
- CFRelease(cv_pix_fmt);
- if (CDarwinUtils::DeviceHasLeakyVDA())
- CFRelease(cv_pix_fmt);
- CFRelease(buffer_attributes);
-
- if(status != kVDADecoderNoErr)
- {
- CLog::Log(LOGERROR, "VDA::CDecoder - Failed to init VDA decoder: %d", status);
- return false;
- }
- return true;
-}
-
-void CDecoder::Close()
-{
- OSStatus status = kVDADecoderNoErr;
-
- if (m_ctx->decoder)
- status = VDADecoderDestroy(m_ctx->decoder);
- m_ctx->decoder = NULL;
-
- delete m_bitstream;
- m_bitstream = NULL;
-}
-
-bool CDecoder::Open(AVCodecContext *avctx, AVCodecContext* mainctx, enum AVPixelFormat fmt, unsigned int surfaces)
-{
- Close();
-
- if(fmt != AV_PIX_FMT_VDA)
- return false;
-
- if(avctx->codec_id != AV_CODEC_ID_H264)
- return false;
-
- switch(avctx->profile)
- {
- case FF_PROFILE_H264_HIGH_10:
- case FF_PROFILE_H264_HIGH_10_INTRA:
- case FF_PROFILE_H264_HIGH_422:
- case FF_PROFILE_H264_HIGH_422_INTRA:
- case FF_PROFILE_H264_HIGH_444_PREDICTIVE:
- case FF_PROFILE_H264_HIGH_444_INTRA:
- case FF_PROFILE_H264_CAVLC_444:
- return false;
- default:
- break;
- }
-
- if (Cocoa_GPUForDisplayIsNvidiaPureVideo3() && !CDVDCodecUtils::IsVP3CompatibleWidth(avctx->width))
- {
- CLog::Log(LOGNOTICE, "%s - Nvidia 9400 GPU hardware limitation, cannot decode a width of %d", __FUNCTION__, avctx->width);
- return false;
- }
-
- if (avctx->profile == FF_PROFILE_H264_MAIN && avctx->level == 32 && avctx->refs > 4)
- {
- // Main@L3.2, VDA cannot handle greater than 4 reference frames
- CLog::Log(LOGNOTICE, "%s - Main@L3.2 detected, VDA cannot decode.", __FUNCTION__);
- return false;
- }
-
- if (!Create(avctx))
- return false;
-
- avctx->pix_fmt = fmt;
- avctx->hwaccel_context = m_ctx;
-
- mainctx->pix_fmt = fmt;
- mainctx->hwaccel_context = m_ctx;
-
- return true;
-}
-
-int CDecoder::Decode(AVCodecContext* avctx, AVFrame* frame)
-{
- int status = Check(avctx);
- if(status)
- return status;
-
- if(frame)
- return VC_BUFFER | VC_PICTURE;
- else
- return VC_BUFFER;
-}
-
-bool CDecoder::GetPicture(AVCodecContext* avctx, AVFrame* frame, DVDVideoPicture* picture)
-{
- ((CDVDVideoCodecFFmpeg*)avctx->opaque)->GetPictureCommon(picture);
-
- picture->format = RENDER_FMT_CVBREF;
- picture->cvBufferRef = (CVPixelBufferRef)frame->data[3];
- return true;
-}
-
-int CDecoder::Check(AVCodecContext* avctx)
-{
- return 0;
-}
-
-unsigned CDecoder::GetAllowedReferences()
-{
- return m_renderbuffers_count;
-}
-
-#endif
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VTB.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VTB.cpp
new file mode 100644
index 0000000000..253aefda2c
--- /dev/null
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VTB.cpp
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2005-2016 Team XBMC
+ * http://xbmc.org
+ *
+ * This library is free software; you can redistribute 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 General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+#include "system.h"
+#ifdef TARGET_DARWIN
+#include "platform/darwin/osx/CocoaInterface.h"
+#include "platform/darwin/DarwinUtils.h"
+#include "DVDVideoCodec.h"
+#include "DVDCodecs/DVDCodecUtils.h"
+#include "utils/log.h"
+#include "VTB.h"
+#include "utils/BitstreamConverter.h"
+
+extern "C" {
+#include "libavcodec/videotoolbox.h"
+}
+
+using namespace VTB;
+
+
+CDecoder::CDecoder()
+{
+ m_avctx = nullptr;
+}
+
+CDecoder::~CDecoder()
+{
+ Close();
+}
+
+void CDecoder::Close()
+{
+ if (m_avctx)
+ {
+ av_videotoolbox_default_free(m_avctx);
+ m_avctx = nullptr;
+ }
+}
+
+bool CDecoder::Open(AVCodecContext *avctx, AVCodecContext* mainctx, enum AVPixelFormat fmt, unsigned int surfaces)
+{
+ if (avctx->codec_id == AV_CODEC_ID_H264)
+ {
+ CBitstreamConverter bs;
+ if (!bs.Open(avctx->codec_id, (uint8_t*)avctx->extradata, avctx->extradata_size, false))
+ {
+ return false;
+ }
+ CFDataRef avcCData = CFDataCreate(kCFAllocatorDefault,
+ (const uint8_t*)bs.GetExtraData(), bs.GetExtraSize());
+ bool interlaced = true;
+ int max_ref_frames;
+ uint8_t *spc = (uint8_t*)CFDataGetBytePtr(avcCData) + 6;
+ uint32_t sps_size = BS_RB16(spc);
+ if (sps_size)
+ bs.parseh264_sps(spc+3, sps_size-1, &interlaced, &max_ref_frames);
+ CFRelease(avcCData);
+ if (interlaced)
+ {
+ CLog::Log(LOGNOTICE, "%s - possible interlaced content.", __FUNCTION__);
+ return false;
+ }
+ }
+
+ if (av_videotoolbox_default_init(avctx) < 0)
+ return false;
+
+ m_avctx = avctx;
+
+ mainctx->pix_fmt = fmt;
+ mainctx->hwaccel_context = avctx->hwaccel_context;
+
+ return true;
+}
+
+int CDecoder::Decode(AVCodecContext* avctx, AVFrame* frame)
+{
+ int status = Check(avctx);
+ if(status)
+ return status;
+
+ if(frame)
+ return VC_BUFFER | VC_PICTURE;
+ else
+ return VC_BUFFER;
+}
+
+bool CDecoder::GetPicture(AVCodecContext* avctx, AVFrame* frame, DVDVideoPicture* picture)
+{
+ ((CDVDVideoCodecFFmpeg*)avctx->opaque)->GetPictureCommon(picture);
+
+ picture->format = RENDER_FMT_CVBREF;
+ picture->cvBufferRef = (CVPixelBufferRef)frame->data[3];
+ return true;
+}
+
+int CDecoder::Check(AVCodecContext* avctx)
+{
+ return 0;
+}
+
+unsigned CDecoder::GetAllowedReferences()
+{
+ return 5;
+}
+
+#endif
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDA.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VTB.h
index 3c91f2def4..1e097d4a38 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDA.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VTB.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005-2013 Team XBMC
+ * Copyright (C) 2005-2016 Team XBMC
* http://xbmc.org
*
* This library is free software; you can redistribute it and/or
@@ -23,10 +23,7 @@
#include "DVDVideoCodecFFmpeg.h"
-struct AVVDAContext;
-class CBitstreamConverter;
-
-namespace VDA
+namespace VTB
{
class CDecoder
@@ -40,14 +37,13 @@ public:
virtual bool GetPicture(AVCodecContext* avctx, AVFrame* frame, DVDVideoPicture* picture);
virtual int Check(AVCodecContext* avctx);
virtual void Close();
- virtual const std::string Name() { return "vda"; }
+ virtual const std::string Name() { return "vtb"; }
virtual unsigned GetAllowedReferences();
protected:
- bool Create(AVCodecContext* avctx);
unsigned m_renderbuffers_count;
- struct AVVDAContext* m_ctx;
- CBitstreamConverter *m_bitstream;
+ AVCodecContext *m_avctx;
+
};
}
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/CMakeLists.txt b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/CMakeLists.txt
index 57dc2c98d6..47e82125b9 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/CMakeLists.txt
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/CMakeLists.txt
@@ -14,13 +14,13 @@ if(VDPAU_FOUND)
endif()
if(CORE_SYSTEM_NAME STREQUAL darwin)
- list(APPEND SOURCES RendererVDA.cpp)
- list(APPEND HEADERS RendererVDA.h)
+ list(APPEND SOURCES RendererVTBGL.cpp)
+ list(APPEND HEADERS RendererVTBGL.h)
endif()
if(CORE_SYSTEM_NAME STREQUAL ios)
- list(APPEND SOURCES RendererVTB.cpp)
- list(APPEND HEADERS RendererVTB.h)
+ list(APPEND SOURCES RendererVTBGLES.cpp)
+ list(APPEND HEADERS RendererVTBGLES.h)
endif()
if(MMAL_FOUND)
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/Makefile.in b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/Makefile.in
index 11b0c06278..2f916de794 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/Makefile.in
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/Makefile.in
@@ -11,7 +11,7 @@ SRCS += MMALRenderer.cpp
endif
ifeq (@USE_OPENGLES@,1)
-SRCS += RendererVTB.cpp
+SRCS += RendererVTBGLES.cpp
SRCS += RendererIMX.cpp
SRCS += RendererOpenMax.cpp
SRCS += RendererMediaCodec.cpp
@@ -23,7 +23,7 @@ SRCS += RendererAML.cpp
endif
ifeq ($(findstring osx,@ARCH@),osx)
-SRCS += RendererVDA.cpp
+SRCS += RendererVTBGL.cpp
endif
LIB=HwDecRender.a
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVDA.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVDA.cpp
deleted file mode 100644
index 83a189fb95..0000000000
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVDA.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2007-2015 Team XBMC
- * http://xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "RendererVDA.h"
-
-#if defined(TARGET_DARWIN_OSX)
-
-#include "settings/Settings.h"
-#include "settings/AdvancedSettings.h"
-#include "cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h"
-#include "utils/log.h"
-#include "platform/darwin/osx/CocoaInterface.h"
-#include <CoreVideo/CoreVideo.h>
-#include <OpenGL/CGLIOSurface.h>
-#include "windowing/WindowingFactory.h"
-
-CRendererVDA::CRendererVDA()
-{
-
-}
-
-CRendererVDA::~CRendererVDA()
-{
-
-}
-
-void CRendererVDA::AddVideoPictureHW(DVDVideoPicture &picture, int index)
-{
- YUVBUFFER &buf = m_buffers[index];
- if (buf.hwDec)
- CVBufferRelease((struct __CVBuffer *)buf.hwDec);
- buf.hwDec = picture.cvBufferRef;
- // retain another reference, this way VideoPlayer and renderer can issue releases.
- CVBufferRetain(picture.cvBufferRef);
-}
-
-void CRendererVDA::ReleaseBuffer(int idx)
-{
- YUVBUFFER &buf = m_buffers[idx];
- if (buf.hwDec)
- CVBufferRelease((struct __CVBuffer *)buf.hwDec);
- buf.hwDec = NULL;
-}
-
-
-bool CRendererVDA::Supports(EINTERLACEMETHOD method)
-{
- return false;
-}
-
-bool CRendererVDA::Supports(EDEINTERLACEMODE mode)
-{
- return false;
-}
-
-EINTERLACEMETHOD CRendererVDA::AutoInterlaceMethod()
-{
- return VS_INTERLACEMETHOD_NONE;
-}
-
-bool CRendererVDA::LoadShadersHook()
-{
- CLog::Log(LOGNOTICE, "GL: Using CVBREF render method");
- // m_renderMethod = RENDER_CVREF;
- m_textureTarget = GL_TEXTURE_RECTANGLE_ARB;
- return false;
-}
-
-bool CRendererVDA::CreateTexture(int index)
-{
- YV12Image &im = m_buffers[index].image;
- YUVFIELDS &fields = m_buffers[index].fields;
- YUVPLANE &plane = fields[0][0];
-
- DeleteTexture(index);
-
- memset(&im , 0, sizeof(im));
- memset(&fields, 0, sizeof(fields));
-
- im.bpp = 1;
- im.width = m_sourceWidth;
- im.height = m_sourceHeight;
- im.cshift_x = 0;
- im.cshift_y = 0;
-
- plane.pixpertex_x = 2;
- plane.pixpertex_y = 1;
- plane.texwidth = im.width / plane.pixpertex_x;
- plane.texheight = im.height / plane.pixpertex_y;
-
- if(m_renderMethod & RENDER_POT)
- {
- plane.texwidth = NP2(plane.texwidth);
- plane.texheight = NP2(plane.texheight);
- }
-
- glEnable(m_textureTarget);
- glGenTextures(1, &plane.id);
- glDisable(m_textureTarget);
-
- return true;
-}
-
-void CRendererVDA::DeleteTexture(int index)
-{
- YUVPLANE &plane = m_buffers[index].fields[0][0];
-
- if (m_buffers[index].hwDec)
- CVBufferRelease((struct __CVBuffer *)m_buffers[index].hwDec);
- m_buffers[index].hwDec = NULL;
-
- if (plane.id && glIsTexture(plane.id))
- glDeleteTextures(1, &plane.id), plane.id = 0;
-}
-
-bool CRendererVDA::UploadTexture(int index)
-{
- YUVBUFFER &buf = m_buffers[index];
- YUVFIELDS &fields = buf.fields;
-
- CVBufferRef cvBufferRef = (struct __CVBuffer *)m_buffers[index].hwDec;
-
- glEnable(m_textureTarget);
-
- if (cvBufferRef && fields[m_currentField][0].flipindex != buf.flipindex)
- {
-
- // It is the fastest way to render a CVPixelBuffer backed
- // with an IOSurface as there is no CPU -> GPU upload.
- CGLContextObj cgl_ctx = (CGLContextObj)g_Windowing.GetCGLContextObj();
- IOSurfaceRef surface = CVPixelBufferGetIOSurface(cvBufferRef);
- GLsizei texWidth = IOSurfaceGetWidth(surface);
- GLsizei texHeight= IOSurfaceGetHeight(surface);
- OSType format_type = IOSurfaceGetPixelFormat(surface);
-
- glBindTexture(m_textureTarget, fields[FIELD_FULL][0].id);
-
- if (format_type == kCVPixelFormatType_422YpCbCr8)
- CGLTexImageIOSurface2D(cgl_ctx, m_textureTarget, GL_RGBA8,
- texWidth / 2, texHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, surface, 0);
- else if (format_type == kCVPixelFormatType_32BGRA)
- CGLTexImageIOSurface2D(cgl_ctx, m_textureTarget, GL_RGBA8,
- texWidth, texHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, surface, 0);
-
- glBindTexture(m_textureTarget, 0);
- fields[FIELD_FULL][0].flipindex = buf.flipindex;
-
- }
-
-
- CalculateTextureSourceRects(index, 3);
- glDisable(m_textureTarget);
-
- return true;
-}
-
-#endif
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTB.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTB.cpp
deleted file mode 100644
index 1f6e0f5b01..0000000000
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTB.cpp
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * Copyright (C) 2007-2015 Team XBMC
- * http://xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "RendererVTB.h"
-
-#if defined(TARGET_DARWIN_IOS)
-#include "cores/IPlayer.h"
-#include "DVDCodecs/Video/DVDVideoCodecVideoToolBox.h"
-#include "utils/log.h"
-#include "utils/GLUtils.h"
-#include "settings/MediaSettings.h"
-#include "windowing/WindowingFactory.h"
-#include "platform/darwin/DarwinUtils.h"
-
-CRendererVTB::CRendererVTB()
-{
-
-}
-
-CRendererVTB::~CRendererVTB()
-{
-
-}
-
-void CRendererVTB::AddVideoPictureHW(DVDVideoPicture &picture, int index)
-{
- YUVBUFFER &buf = m_buffers[index];
- if (buf.hwDec)
- CVBufferRelease((struct __CVBuffer *)buf.hwDec);
- buf.hwDec = picture.cvBufferRef;
- // retain another reference, this way VideoPlayer and renderer can issue releases.
- CVBufferRetain(picture.cvBufferRef);
-}
-
-void CRendererVTB::ReleaseBuffer(int idx)
-{
- YUVBUFFER &buf = m_buffers[idx];
- if (buf.hwDec)
- CVBufferRelease((struct __CVBuffer *)buf.hwDec);
- buf.hwDec = NULL;
-}
-
-int CRendererVTB::GetImageHook(YV12Image *image, int source, bool readonly)
-{
- return source;
-}
-
-void CRendererVTB::ReorderDrawPoints()
-{
- CLinuxRendererGLES::ReorderDrawPoints();//call base impl. for rotating the points
-
- // cvbuf is flipped in y
- CPoint tmp;
- tmp = m_rotatedDestCoords[0];
- m_rotatedDestCoords[0] = m_rotatedDestCoords[3];
- m_rotatedDestCoords[3] = tmp;
- tmp = m_rotatedDestCoords[1];
- m_rotatedDestCoords[1] = m_rotatedDestCoords[2];
- m_rotatedDestCoords[2] = tmp;
-}
-
-bool CRendererVTB::Supports(EINTERLACEMETHOD method)
-{
- return false;
-}
-
-bool CRendererVTB::Supports(EDEINTERLACEMODE mode)
-{
- return false;
-}
-
-EINTERLACEMETHOD CRendererVTB::AutoInterlaceMethod()
-{
- return VS_INTERLACEMETHOD_NONE;
-}
-
-CRenderInfo CRendererVTB::GetRenderInfo()
-{
- CRenderInfo info;
- info.formats = m_formats;
- info.max_buffer_size = NUM_BUFFERS;
- info.optimal_buffer_size = 2;
- return info;
-}
-
-bool CRendererVTB::LoadShadersHook()
-{
- float ios_version = CDarwinUtils::GetIOSVersion();
- CLog::Log(LOGNOTICE, "GL: Using CVBREF render method");
- m_textureTarget = GL_TEXTURE_2D;
-
- if (ios_version < 5.0 && m_format == RENDER_FMT_YUV420P)
- {
- CLog::Log(LOGNOTICE, "GL: Using software color conversion/RGBA render method");
- m_renderMethod = RENDER_SW;
- }
- else
- {
- m_renderMethod = RENDER_CVREF;
- }
- ReorderDrawPoints();// cvref needs a reorder because its flipped in y direction
-
- return false;
-}
-
-bool CRendererVTB::RenderHook(int index)
-{
- YUVPLANE &plane = m_buffers[index].fields[m_currentField][0];
-
- glDisable(GL_DEPTH_TEST);
-
- glEnable(m_textureTarget);
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(m_textureTarget, plane.id);
-
- g_Windowing.EnableGUIShader(SM_TEXTURE_RGBA);
-
- GLint contrastLoc = g_Windowing.GUIShaderGetContrast();
- glUniform1f(contrastLoc, CMediaSettings::GetInstance().GetCurrentVideoSettings().m_Contrast * 0.02f);
- GLint brightnessLoc = g_Windowing.GUIShaderGetBrightness();
- glUniform1f(brightnessLoc, CMediaSettings::GetInstance().GetCurrentVideoSettings().m_Brightness * 0.01f - 0.5f);
-
- GLubyte idx[4] = {0, 1, 3, 2}; //determines order of triangle strip
- GLfloat ver[4][4];
- GLfloat tex[4][2];
- GLfloat col[3] = {1.0f, 1.0f, 1.0f};
-
- GLint posLoc = g_Windowing.GUIShaderGetPos();
- GLint texLoc = g_Windowing.GUIShaderGetCoord0();
- GLint colLoc = g_Windowing.GUIShaderGetCol();
-
- glVertexAttribPointer(posLoc, 4, GL_FLOAT, 0, 0, ver);
- glVertexAttribPointer(texLoc, 2, GL_FLOAT, 0, 0, tex);
- glVertexAttribPointer(colLoc, 3, GL_FLOAT, 0, 0, col);
-
- glEnableVertexAttribArray(posLoc);
- glEnableVertexAttribArray(texLoc);
- glEnableVertexAttribArray(colLoc);
-
- // Set vertex coordinates
- for(int i = 0; i < 4; i++)
- {
- ver[i][0] = m_rotatedDestCoords[i].x;
- ver[i][1] = m_rotatedDestCoords[i].y;
- ver[i][2] = 0.0f;// set z to 0
- ver[i][3] = 1.0f;
- }
-
- // Set texture coordinates (corevideo is flipped in y)
- tex[0][0] = tex[3][0] = plane.rect.x1;
- tex[0][1] = tex[1][1] = plane.rect.y2;
- tex[1][0] = tex[2][0] = plane.rect.x2;
- tex[2][1] = tex[3][1] = plane.rect.y1;
-
- glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, idx);
-
- glDisableVertexAttribArray(posLoc);
- glDisableVertexAttribArray(texLoc);
- glDisableVertexAttribArray(colLoc);
-
- g_Windowing.DisableGUIShader();
- VerifyGLState();
-
- glDisable(m_textureTarget);
- VerifyGLState();
- return true;
-}
-
-bool CRendererVTB::CreateTexture(int index)
-{
- YV12Image &im = m_buffers[index].image;
- YUVFIELDS &fields = m_buffers[index].fields;
- YUVPLANE &plane = fields[0][0];
-
- DeleteTexture(index);
-
- memset(&im , 0, sizeof(im));
- memset(&fields, 0, sizeof(fields));
-
- im.height = m_sourceHeight;
- im.width = m_sourceWidth;
-
- plane.texwidth = im.width;
- plane.texheight = im.height;
- plane.pixpertex_x = 1;
- plane.pixpertex_y = 1;
-
- if(m_renderMethod & RENDER_POT)
- {
- plane.texwidth = NP2(plane.texwidth);
- plane.texheight = NP2(plane.texheight);
- }
- glEnable(m_textureTarget);
- glGenTextures(1, &plane.id);
- VerifyGLState();
-
- glBindTexture(m_textureTarget, plane.id);
-#if !TARGET_OS_IPHONE
-#ifdef GL_UNPACK_ROW_LENGTH
- // Set row pixels
- glPixelStorei(GL_UNPACK_ROW_LENGTH, m_sourceWidth);
-#endif
-#ifdef GL_TEXTURE_STORAGE_HINT_APPLE
- // Set storage hint. Can also use GL_STORAGE_SHARED_APPLE see docs.
- glTexParameteri(m_textureTarget, GL_TEXTURE_STORAGE_HINT_APPLE , GL_STORAGE_CACHED_APPLE);
- // Set client storage
-#endif
- glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
-#endif
-
- glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- // This is necessary for non-power-of-two textures
- glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
- glTexImage2D(m_textureTarget, 0, GL_RGBA, plane.texwidth, plane.texheight, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);
-
-#if !TARGET_OS_IPHONE
- // turn off client storage so it doesn't get picked up for the next texture
- glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
-#endif
- glBindTexture(m_textureTarget, 0);
- glDisable(m_textureTarget);
-
- return true;
-}
-
-void CRendererVTB::DeleteTexture(int index)
-{
- YUVPLANE &plane = m_buffers[index].fields[0][0];
-
- if (m_buffers[index].hwDec)
- CVBufferRelease((struct __CVBuffer *)m_buffers[index].hwDec);
- m_buffers[index].hwDec = NULL;
-
- if(plane.id && glIsTexture(plane.id))
- glDeleteTextures(1, &plane.id);
- plane.id = 0;
-}
-
-bool CRendererVTB::UploadTexture(int index)
-{
- bool ret = false;
- CVBufferRef cvBufferRef = (struct __CVBuffer *)m_buffers[index].hwDec;
-
- if (cvBufferRef)
- {
- YUVPLANE &plane = m_buffers[index].fields[0][0];
-
- CVPixelBufferLockBaseAddress(cvBufferRef, kCVPixelBufferLock_ReadOnly);
-#if !TARGET_OS_IPHONE
- int rowbytes = CVPixelBufferGetBytesPerRow(cvBufferRef);
-#endif
- int bufferWidth = CVPixelBufferGetWidth(cvBufferRef);
- int bufferHeight = CVPixelBufferGetHeight(cvBufferRef);
- unsigned char *bufferBase = (unsigned char *)CVPixelBufferGetBaseAddress(cvBufferRef);
-
- glEnable(m_textureTarget);
- VerifyGLState();
-
- glBindTexture(m_textureTarget, plane.id);
-#if !TARGET_OS_IPHONE
-#ifdef GL_UNPACK_ROW_LENGTH
- // Set row pixels
- glPixelStorei( GL_UNPACK_ROW_LENGTH, rowbytes);
-#endif
-#ifdef GL_TEXTURE_STORAGE_HINT_APPLE
- // Set storage hint. Can also use GL_STORAGE_SHARED_APPLE see docs.
- glTexParameteri(m_textureTarget, GL_TEXTURE_STORAGE_HINT_APPLE , GL_STORAGE_CACHED_APPLE);
-#endif
-#endif
-
- // Using BGRA extension to pull in video frame data directly
- glTexSubImage2D(m_textureTarget, 0, 0, 0, bufferWidth, bufferHeight, GL_BGRA_EXT, GL_UNSIGNED_BYTE, bufferBase);
-
-#if !TARGET_OS_IPHONE
-#ifdef GL_UNPACK_ROW_LENGTH
- // Unset row pixels
- glPixelStorei( GL_UNPACK_ROW_LENGTH, 0);
-#endif
-#endif
- glBindTexture(m_textureTarget, 0);
-
- glDisable(m_textureTarget);
- VerifyGLState();
-
- CVPixelBufferUnlockBaseAddress(cvBufferRef, kCVPixelBufferLock_ReadOnly);
- CVBufferRelease((struct __CVBuffer *)m_buffers[index].hwDec);
- m_buffers[index].hwDec = NULL;
-
- plane.flipindex = m_buffers[index].flipindex;
- ret = true;
- }
-
- CalculateTextureSourceRects(index, 1);
- return ret;
-}
-
-#endif \ No newline at end of file
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTBGL.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTBGL.cpp
new file mode 100644
index 0000000000..d3e1e034fe
--- /dev/null
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTBGL.cpp
@@ -0,0 +1,209 @@
+/*
+ * Copyright (C) 2007-2015 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "RendererVTBGL.h"
+
+#if defined(TARGET_DARWIN_OSX)
+
+#include "settings/Settings.h"
+#include "settings/AdvancedSettings.h"
+#include "cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h"
+#include "utils/log.h"
+#include "platform/darwin/osx/CocoaInterface.h"
+#include <CoreVideo/CoreVideo.h>
+#include <OpenGL/CGLIOSurface.h>
+#include "windowing/WindowingFactory.h"
+
+CRendererVTB::CRendererVTB()
+{
+
+}
+
+CRendererVTB::~CRendererVTB()
+{
+
+}
+
+void CRendererVTB::AddVideoPictureHW(DVDVideoPicture &picture, int index)
+{
+ YUVBUFFER &buf = m_buffers[index];
+ if (buf.hwDec)
+ CVBufferRelease((struct __CVBuffer *)buf.hwDec);
+ buf.hwDec = picture.cvBufferRef;
+ // retain another reference, this way VideoPlayer and renderer can issue releases.
+ CVBufferRetain(picture.cvBufferRef);
+}
+
+void CRendererVTB::ReleaseBuffer(int idx)
+{
+ YUVBUFFER &buf = m_buffers[idx];
+ if (buf.hwDec)
+ CVBufferRelease((struct __CVBuffer *)buf.hwDec);
+ buf.hwDec = NULL;
+}
+
+
+bool CRendererVTB::Supports(EINTERLACEMETHOD method)
+{
+ return false;
+}
+
+bool CRendererVTB::Supports(EDEINTERLACEMODE mode)
+{
+ return false;
+}
+
+EINTERLACEMETHOD CRendererVTB::AutoInterlaceMethod()
+{
+ return VS_INTERLACEMETHOD_NONE;
+}
+
+bool CRendererVTB::LoadShadersHook()
+{
+ CLog::Log(LOGNOTICE, "GL: Using CVBREF render method");
+ m_renderMethod = RENDER_CVREF;
+ m_textureTarget = GL_TEXTURE_RECTANGLE_ARB;
+ return false;
+}
+
+bool CRendererVTB::CreateTexture(int index)
+{
+ YV12Image &im = m_buffers[index].image;
+ YUVFIELDS &fields = m_buffers[index].fields;
+ YUVPLANES &planes = fields[0];
+
+ DeleteTexture(index);
+
+ memset(&im , 0, sizeof(im));
+ memset(&fields, 0, sizeof(fields));
+
+ im.bpp = 1;
+ im.width = m_sourceWidth;
+ im.height = m_sourceHeight;
+ im.cshift_x = 1;
+ im.cshift_y = 1;
+
+ planes[0].texwidth = im.width;
+ planes[0].texheight = im.height;
+
+ planes[1].texwidth = planes[0].texwidth >> im.cshift_x;
+ planes[1].texheight = planes[0].texheight >> im.cshift_y;
+ planes[2].texwidth = planes[1].texwidth;
+ planes[2].texheight = planes[1].texheight;
+
+ for (int p = 0; p < 3; p++)
+ {
+ planes[p].pixpertex_x = 1;
+ planes[p].pixpertex_y = 1;
+ }
+
+ glEnable(m_textureTarget);
+ glGenTextures(1, &planes[0].id);
+ glGenTextures(1, &planes[1].id);
+ planes[2].id = planes[1].id;
+ glDisable(m_textureTarget);
+
+ return true;
+}
+
+void CRendererVTB::DeleteTexture(int index)
+{
+ YUVPLANES &planes = m_buffers[index].fields[0];
+
+ if (m_buffers[index].hwDec)
+ CVBufferRelease((struct __CVBuffer *)m_buffers[index].hwDec);
+ m_buffers[index].hwDec = NULL;
+
+ if (planes[0].id && glIsTexture(planes[0].id))
+ {
+ glDeleteTextures(1, &planes[0].id);
+ }
+ if (planes[1].id && glIsTexture(planes[1].id))
+ {
+ glDeleteTextures(1, &planes[1].id);
+ }
+ planes[0].id = 0;
+ planes[1].id = 0;
+ planes[2].id = 0;
+}
+
+bool CRendererVTB::UploadTexture(int index)
+{
+ YUVBUFFER &buf = m_buffers[index];
+ YUVFIELDS &fields = buf.fields;
+ YUVPLANES &planes = fields[0];
+
+ CVImageBufferRef cvBufferRef = (struct __CVBuffer *)m_buffers[index].hwDec;
+
+ glEnable(m_textureTarget);
+
+ // It is the fastest way to render a CVPixelBuffer backed
+ // with an IOSurface as there is no CPU -> GPU upload.
+ CGLContextObj cgl_ctx = (CGLContextObj)g_Windowing.GetCGLContextObj();
+ IOSurfaceRef surface = CVPixelBufferGetIOSurface(cvBufferRef);
+ OSType format_type = IOSurfaceGetPixelFormat(surface);
+
+ if (format_type != kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange)
+ {
+ return false;
+ }
+
+ GLsizei surfplanes = IOSurfaceGetPlaneCount(surface);
+
+ if (surfplanes != 2)
+ {
+ return false;
+ }
+
+ GLsizei widthY = IOSurfaceGetWidthOfPlane(surface, 0);
+ GLsizei widthUV = IOSurfaceGetWidthOfPlane(surface, 1);
+ GLsizei heightY = IOSurfaceGetHeightOfPlane(surface, 0);
+ GLsizei heightUV = IOSurfaceGetHeightOfPlane(surface, 1);
+
+ glBindTexture(m_textureTarget, planes[0].id);
+
+ CGLTexImageIOSurface2D(cgl_ctx, m_textureTarget, GL_LUMINANCE,
+ widthY, heightY, GL_LUMINANCE, GL_UNSIGNED_BYTE, surface, 0);
+ glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+ glBindTexture(m_textureTarget, planes[1].id);
+
+ CGLTexImageIOSurface2D(cgl_ctx, m_textureTarget, GL_LUMINANCE_ALPHA,
+ widthUV, heightUV, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, surface, 1);
+ glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+ glBindTexture(m_textureTarget, 0);
+ planes[0].flipindex = buf.flipindex;
+
+ glDisable(m_textureTarget);
+
+ CalculateTextureSourceRects(index, 3);
+
+
+ return true;
+}
+
+#endif
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVDA.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTBGL.h
index b8254e5665..7e4f693185 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVDA.h
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTBGL.h
@@ -26,11 +26,11 @@
#include "cores/VideoPlayer/VideoRenderers/LinuxRendererGL.h"
-class CRendererVDA : public CLinuxRendererGL
+class CRendererVTB : public CLinuxRendererGL
{
public:
- CRendererVDA();
- virtual ~CRendererVDA();
+ CRendererVTB();
+ virtual ~CRendererVTB();
// Player functions
virtual void AddVideoPictureHW(DVDVideoPicture &picture, int index);
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTBGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTBGLES.cpp
new file mode 100644
index 0000000000..ae2a27bdd3
--- /dev/null
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTBGLES.cpp
@@ -0,0 +1,261 @@
+/*
+ * Copyright (C) 2007-2015 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "RendererVTBGLES.h"
+
+#if defined(TARGET_DARWIN_IOS)
+#include "cores/IPlayer.h"
+#include "utils/log.h"
+#include "utils/GLUtils.h"
+#include "settings/MediaSettings.h"
+#include "windowing/WindowingFactory.h"
+#include "platform/darwin/DarwinUtils.h"
+#include <CoreVideo/CVBuffer.h>
+#include <CoreVideo/CVPixelBuffer.h>
+
+CRendererVTB::CRendererVTB()
+{
+ m_textureCache = nullptr;
+ CVReturn ret = CVOpenGLESTextureCacheCreate(kCFAllocatorDefault,
+ NULL,
+ g_Windowing.GetEAGLContextObj(),
+ NULL,
+ &m_textureCache);
+ if (ret != kCVReturnSuccess)
+ {
+ CLog::Log(LOGERROR, "CRendererVTB::CRendererVTB - Error creating texture cache (err: %d)", ret);
+ }
+
+ for (auto &buf : m_vtbBuffers)
+ {
+ buf.m_textureY = nullptr;
+ buf.m_textureUV = nullptr;
+ buf.m_videoBuffer = nullptr;
+ }
+}
+
+CRendererVTB::~CRendererVTB()
+{
+ if (m_textureCache)
+ CFRelease(m_textureCache);
+}
+
+void CRendererVTB::AddVideoPictureHW(DVDVideoPicture &picture, int index)
+{
+ CRenderBuffer &buf = m_vtbBuffers[index];
+ if (buf.m_videoBuffer)
+ CVBufferRelease(buf.m_videoBuffer);
+ buf.m_videoBuffer = picture.cvBufferRef;
+ // retain another reference, this way VideoPlayer and renderer can issue releases.
+ CVBufferRetain(picture.cvBufferRef);
+}
+
+void CRendererVTB::ReleaseBuffer(int idx)
+{
+ CRenderBuffer &buf = m_vtbBuffers[idx];
+ if (buf.m_videoBuffer)
+ CVBufferRelease(buf.m_videoBuffer);
+ buf.m_videoBuffer = nullptr;
+}
+
+int CRendererVTB::GetImageHook(YV12Image *image, int source, bool readonly)
+{
+ return source;
+}
+
+bool CRendererVTB::Supports(EINTERLACEMETHOD method)
+{
+ return false;
+}
+
+bool CRendererVTB::Supports(EDEINTERLACEMODE mode)
+{
+ return false;
+}
+
+EINTERLACEMETHOD CRendererVTB::AutoInterlaceMethod()
+{
+ return VS_INTERLACEMETHOD_NONE;
+}
+
+CRenderInfo CRendererVTB::GetRenderInfo()
+{
+ CRenderInfo info;
+ info.formats = m_formats;
+ info.max_buffer_size = NUM_BUFFERS;
+ info.optimal_buffer_size = 4;
+ return info;
+}
+
+bool CRendererVTB::LoadShadersHook()
+{
+ float ios_version = CDarwinUtils::GetIOSVersion();
+ CLog::Log(LOGNOTICE, "GL: Using CVBREF render method");
+ m_textureTarget = GL_TEXTURE_2D;
+ m_renderMethod = RENDER_CVREF;
+
+ if (ios_version < 5.0)
+ {
+ CLog::Log(LOGNOTICE, "GL: ios version < 5 is not supported");
+ return false;
+ }
+
+ if (!m_textureCache)
+ {
+ CLog::Log(LOGNOTICE, "CRendererVTB::LoadShadersHook: no texture cache");
+ return false;
+ }
+
+ CVReturn ret = CVOpenGLESTextureCacheCreate(kCFAllocatorDefault,
+ NULL,
+ g_Windowing.GetEAGLContextObj(),
+ NULL,
+ &m_textureCache);
+ if (ret != kCVReturnSuccess)
+ return false;
+
+ return false;
+}
+
+bool CRendererVTB::CreateTexture(int index)
+{
+ YV12Image &im = m_buffers[index].image;
+ YUVFIELDS &fields = m_buffers[index].fields;
+ YUVPLANES &planes = fields[0];
+
+ DeleteTexture(index);
+
+ memset(&im , 0, sizeof(im));
+ memset(&fields, 0, sizeof(fields));
+
+ im.height = m_sourceHeight;
+ im.width = m_sourceWidth;
+
+ planes[0].texwidth = im.width;
+ planes[0].texheight = im.height;
+ planes[1].texwidth = planes[0].texwidth >> im.cshift_x;
+ planes[1].texheight = planes[0].texheight >> im.cshift_y;
+ planes[2].texwidth = planes[1].texwidth;
+ planes[2].texheight = planes[1].texheight;
+
+ for (int p = 0; p < 3; p++)
+ {
+ planes[p].pixpertex_x = 1;
+ planes[p].pixpertex_y = 1;
+ }
+
+ planes[0].id = 1;
+ return true;
+}
+
+void CRendererVTB::DeleteTexture(int index)
+{
+ CRenderBuffer &buf = m_vtbBuffers[index];
+
+ if (buf.m_videoBuffer)
+ CVBufferRelease(buf.m_videoBuffer);
+ buf.m_videoBuffer = nullptr;
+
+ if (buf.m_textureY)
+ CFRelease(buf.m_textureY);
+ buf.m_textureY = nullptr;
+
+ if (buf.m_textureUV)
+ CFRelease(buf.m_textureUV);
+ buf.m_textureUV = nullptr;
+
+ YUVFIELDS &fields = m_buffers[index].fields;
+ fields[FIELD_FULL][0].id = 0;
+ fields[FIELD_FULL][1].id = 0;
+ fields[FIELD_FULL][2].id = 0;
+}
+
+bool CRendererVTB::UploadTexture(int index)
+{
+ CRenderBuffer &buf = m_vtbBuffers[index];
+
+ if (!buf.m_videoBuffer)
+ return false;
+
+ CVOpenGLESTextureCacheFlush(m_textureCache, 0);
+
+ if (buf.m_textureY)
+ CFRelease(buf.m_textureY);
+ buf.m_textureY = nullptr;
+
+ if (buf.m_textureUV)
+ CFRelease(buf.m_textureUV);
+ buf.m_textureUV = nullptr;
+
+ YV12Image &im = m_buffers[index].image;
+ YUVFIELDS &fields = m_buffers[index].fields;
+ YUVPLANES &planes = fields[0];
+
+ CVReturn ret;
+ ret = CVOpenGLESTextureCacheCreateTextureFromImage(kCFAllocatorDefault,
+ m_textureCache,
+ buf.m_videoBuffer, NULL, GL_TEXTURE_2D, GL_LUMINANCE,
+ im.width, im.height, GL_LUMINANCE, GL_UNSIGNED_BYTE,
+ 0,
+ &buf.m_textureY);
+
+ if (ret != kCVReturnSuccess)
+ {
+ CLog::Log(LOGERROR, "CRendererVTB::UploadTexture - Error uploading texture Y (err: %d)", ret);
+ return false;
+ }
+
+ ret = CVOpenGLESTextureCacheCreateTextureFromImage(kCFAllocatorDefault,
+ m_textureCache,
+ buf.m_videoBuffer, NULL, GL_TEXTURE_2D, GL_LUMINANCE_ALPHA,
+ im.width/2, im.height/2, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE,
+ 1,
+ &buf.m_textureUV);
+
+ if (ret != kCVReturnSuccess)
+ {
+ CLog::Log(LOGERROR, "CRendererVTB::UploadTexture - Error uploading texture UV (err: %d)", ret);
+ return false;
+ }
+
+ // set textures
+ planes[0].id = CVOpenGLESTextureGetName(buf.m_textureY);
+ planes[1].id = CVOpenGLESTextureGetName(buf.m_textureUV);
+ planes[2].id = CVOpenGLESTextureGetName(buf.m_textureUV);
+
+ glEnable(m_textureTarget);
+
+ for (int p=0; p<2; p++)
+ {
+ glBindTexture(m_textureTarget, planes[p].id);
+ glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+ glBindTexture(m_textureTarget, 0);
+ VerifyGLState();
+ }
+
+ CalculateTextureSourceRects(index, 3);
+ return true;
+}
+
+#endif \ No newline at end of file
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTB.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTBGLES.h
index 2354180a78..d314bfa94c 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTB.h
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVTBGLES.h
@@ -25,6 +25,7 @@
#if defined(TARGET_DARWIN_IOS)
#include "cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h"
+#include <CoreVideo/CVOpenGLESTextureCache.h>
class CRendererVTB : public CLinuxRendererGLES
{
@@ -33,28 +34,33 @@ public:
virtual ~CRendererVTB();
// Player functions
- virtual void AddVideoPictureHW(DVDVideoPicture &picture, int index);
- virtual void ReleaseBuffer(int idx);
- virtual void ReorderDrawPoints();
+ virtual void AddVideoPictureHW(DVDVideoPicture &picture, int index) override;
+ virtual void ReleaseBuffer(int idx) override;
// Feature support
- virtual bool Supports(EINTERLACEMETHOD method);
- virtual bool Supports(EDEINTERLACEMODE mode);
-
-
- virtual EINTERLACEMETHOD AutoInterlaceMethod();
- virtual CRenderInfo GetRenderInfo();
+ virtual bool Supports(EINTERLACEMETHOD method) override;
+ virtual bool Supports(EDEINTERLACEMODE mode) override;
+ virtual EINTERLACEMETHOD AutoInterlaceMethod() override;
+ virtual CRenderInfo GetRenderInfo() override;
protected:
// hooks for hw dec renderer
- virtual bool LoadShadersHook();
- virtual bool RenderHook(int index);
- virtual int GetImageHook(YV12Image *image, int source = AUTOSOURCE, bool readonly = false);
+ virtual bool LoadShadersHook() override;
+ virtual int GetImageHook(YV12Image *image, int source = AUTOSOURCE, bool readonly = false) override;
// textures
- virtual bool UploadTexture(int index);
- virtual void DeleteTexture(int index);
- virtual bool CreateTexture(int index);
+ virtual bool UploadTexture(int index) override;
+ virtual void DeleteTexture(int index) override;
+ virtual bool CreateTexture(int index) override;
+
+ CVOpenGLESTextureCacheRef m_textureCache;
+ struct CRenderBuffer
+ {
+ CVOpenGLESTextureRef m_textureY;
+ CVOpenGLESTextureRef m_textureUV;
+ CVBufferRef m_videoBuffer;
+ };
+ CRenderBuffer m_vtbBuffers[NUM_BUFFERS];
};
#endif
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp
index 2c15459334..9ba1cd1780 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp
@@ -902,10 +902,11 @@ void CLinuxRendererGL::LoadShaders(int field)
// if single pass, create GLSLOutput helper and pass it to YUV2RGB shader
GLSLOutput *out = nullptr;
if (m_renderQuality == RQ_SINGLEPASS)
- out = new GLSLOutput(3, m_useDithering, m_ditherDepth, m_fullRange);
+ out = new GLSLOutput(3, m_useDithering, m_ditherDepth, false);
m_pYUVShader = new YUV2RGBProgressiveShader(m_textureTarget==GL_TEXTURE_RECTANGLE_ARB, m_iFlags, m_format,
m_nonLinStretch && m_renderQuality == RQ_SINGLEPASS,
out);
+ m_pYUVShader->SetForceLimitedColorRange(false);
CLog::Log(LOGNOTICE, "GL: Selecting Single Pass YUV 2 RGB shader");
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp
index 428d322ed1..d79ecb7360 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp
@@ -210,8 +210,11 @@ int CLinuxRendererGLES::NextYV12Texture()
int CLinuxRendererGLES::GetImage(YV12Image *image, int source, bool readonly)
{
- if (!image) return -1;
- if (!m_bValidated) return -1;
+ if (!image)
+ return -1;
+
+ if (!m_bValidated)
+ return -1;
/* take next available buffer */
if( source == AUTOSOURCE )
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp
index fbbb23c05a..5a3fd0506f 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp
@@ -38,15 +38,15 @@
#include "HwDecRender/RendererVAAPI.h"
#include "HwDecRender/RendererVDPAU.h"
#if defined(TARGET_DARWIN_OSX)
-#include "HwDecRender/RendererVDA.h"
+#include "HwDecRender/RendererVTBGL.h"
#endif
#elif HAS_GLES == 2
#include "LinuxRendererGLES.h"
#if defined(HAS_MMAL)
#include "HwDecRender/MMALRenderer.h"
#endif
-#if defined(HAVE_VIDEOTOOLBOXDECODER)
-#include "HwDecRender/RendererVTB.h"
+#if defined(TARGET_DARWIN_IOS)
+#include "HwDecRender/RendererVTBGLES.h"
#endif
#if defined(HAS_IMXVPU)
#include "HwDecRender/RendererIMX.h"
@@ -522,9 +522,7 @@ void CRenderManager::CreateRenderer()
}
else if (m_format == RENDER_FMT_CVBREF)
{
-#if defined(TARGET_DARWIN_OSX)
- m_pRenderer = new CRendererVDA;
-#elif defined(HAVE_VIDEOTOOLBOXDECODER)
+#if defined(TARGET_DARWIN)
m_pRenderer = new CRendererVTB;
#endif
}
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/GLSLOutput.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/GLSLOutput.cpp
index 182a893e3d..b6cd2e2f5b 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/GLSLOutput.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/GLSLOutput.cpp
@@ -49,11 +49,11 @@ GLSLOutput::GLSLOutput(int texunit, bool useDithering, unsigned int ditherDepth,
std::string GLSLOutput::GetDefines()
{
- std::string defines = "#define XBMC_OUTPUT 1\n";
+ std::string defines;
if (m_dither)
- defines += "#define XBMC_DITHER 1\n";
+ defines += "#define XBMC_DITHER\n";
if (m_fullRange)
- defines += "#define XBMC_FULLRANGE 1\n";
+ defines += "#define XBMC_FULLRANGE\n";
return defines;
}
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShader.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShader.cpp
index 60ec7b7808..6a3ddf044d 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShader.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShader.cpp
@@ -220,12 +220,14 @@ BaseYUV2RGBGLSLShader::BaseYUV2RGBGLSLShader(bool rect, unsigned flags, ERenderF
m_defines += "#define XBMC_NV12\n";
else if (m_format == RENDER_FMT_YUYV422)
m_defines += "#define XBMC_YUY2\n";
- else if (m_format == RENDER_FMT_UYVY422 || m_format == RENDER_FMT_CVBREF)
+ else if (m_format == RENDER_FMT_UYVY422)
m_defines += "#define XBMC_UYVY\n";
else if (m_format == RENDER_FMT_VDPAU_420)
m_defines += "#define XBMC_NV12_RRG\n";
else if (m_format == RENDER_FMT_VAAPI)
m_defines += "#define XBMC_NV12_RRG\n";
+ else if (m_format == RENDER_FMT_CVBREF)
+ m_defines += "#define XBMC_YV12\n";
else
CLog::Log(LOGERROR, "GL: BaseYUV2RGBGLSLShader - unsupported format %d", m_format);
@@ -242,6 +244,8 @@ BaseYUV2RGBGLSLShader::BaseYUV2RGBGLSLShader(bool rect, unsigned flags, ERenderF
m_defines += "#define XBMC_YV12\n";
else if (m_format == RENDER_FMT_NV12)
m_defines += "#define XBMC_NV12\n";
+ else if (m_format == RENDER_FMT_CVBREF)
+ m_defines += "#define XBMC_YV12\n";
else
CLog::Log(LOGERROR, "GL: BaseYUV2RGBGLSLShader - unsupported format %d", m_format);
@@ -405,7 +409,7 @@ YUV2RGBProgressiveShaderARB::YUV2RGBProgressiveShaderARB(bool rect, unsigned fla
else
shaderfile = "yuv2rgb_basic_2d_YUY2.arb";
}
- else if (m_format == RENDER_FMT_UYVY422 || m_format == RENDER_FMT_CVBREF)
+ else if (m_format == RENDER_FMT_UYVY422)
{
if(rect)
shaderfile = "yuv2rgb_basic_rect_UYVY.arb";
diff --git a/xbmc/platform/darwin/DarwinUtils.mm b/xbmc/platform/darwin/DarwinUtils.mm
index 9bbefc009e..11be67a747 100644
--- a/xbmc/platform/darwin/DarwinUtils.mm
+++ b/xbmc/platform/darwin/DarwinUtils.mm
@@ -480,44 +480,6 @@ bool CDarwinUtils::IsIosSandboxed(void)
return ret == 1;
}
-bool CDarwinUtils::HasVideoToolboxDecoder(void)
-{
- static int DecoderAvailable = -1;
-
- if (DecoderAvailable == -1)
- {
- {
- /* When XBMC is started from a sandbox directory we have to check the sysctl values */
- if (IsIosSandboxed())
- {
- uint64_t proc_enforce = 0;
- uint64_t vnode_enforce = 0;
- size_t size = sizeof(vnode_enforce);
-
- sysctlbyname("security.mac.proc_enforce", &proc_enforce, &size, NULL, 0);
- sysctlbyname("security.mac.vnode_enforce", &vnode_enforce, &size, NULL, 0);
-
- if (vnode_enforce && proc_enforce)
- {
- DecoderAvailable = 1;
- CLog::Log(LOGINFO, "VideoToolBox decoder not available. Use : sysctl -w security.mac.proc_enforce=0; sysctl -w security.mac.vnode_enforce=0\n");
- }
- else
- {
- DecoderAvailable = 1;
- CLog::Log(LOGINFO, "VideoToolBox decoder available\n");
- }
- }
- else
- {
- DecoderAvailable = 1;
- }
- }
- }
-
- return (DecoderAvailable == 1);
-}
-
int CDarwinUtils::BatteryLevel(void)
{
float batteryLevel = 0;
diff --git a/xbmc/platform/darwin/ios/IOSEAGLView.h b/xbmc/platform/darwin/ios/IOSEAGLView.h
index dfb45be9b1..1acb75cbce 100644
--- a/xbmc/platform/darwin/ios/IOSEAGLView.h
+++ b/xbmc/platform/darwin/ios/IOSEAGLView.h
@@ -54,6 +54,7 @@
@property (readonly, nonatomic, getter=isReadyToRun) BOOL readyToRun;
@property (readonly, nonatomic, getter=isPause) BOOL pause;
@property (readonly, getter=getCurrentScreen) UIScreen *currentScreen;
+@property (readonly, getter=getCurrentEAGLContext) EAGLContext *context;
@property BOOL framebufferResizeRequested;
- (id)initWithFrame:(CGRect)frame withScreen:(UIScreen *)screen;
diff --git a/xbmc/platform/darwin/ios/IOSEAGLView.mm b/xbmc/platform/darwin/ios/IOSEAGLView.mm
index 52250588b6..274587815b 100644
--- a/xbmc/platform/darwin/ios/IOSEAGLView.mm
+++ b/xbmc/platform/darwin/ios/IOSEAGLView.mm
@@ -66,6 +66,7 @@ using namespace KODI::MESSAGING;
@synthesize pause;
@synthesize currentScreen;
@synthesize framebufferResizeRequested;
+@synthesize context;
// You must implement this method
+ (Class) layerClass
diff --git a/xbmc/platform/darwin/ios/XBMCController.h b/xbmc/platform/darwin/ios/XBMCController.h
index 7358f19cfe..e07720e17f 100644
--- a/xbmc/platform/darwin/ios/XBMCController.h
+++ b/xbmc/platform/darwin/ios/XBMCController.h
@@ -94,6 +94,7 @@ typedef enum
- (bool) changeScreen: (unsigned int)screenIdx withMode:(UIScreenMode *)mode;
- (void) activateScreen: (UIScreen *)screen withOrientation:(UIInterfaceOrientation)newOrientation;
- (id) initWithFrame:(CGRect)frame withScreen:(UIScreen *)screen;
+- (void*) getEAGLContextObj;
@end
extern XBMCController *g_xbmcController;
diff --git a/xbmc/platform/darwin/ios/XBMCController.mm b/xbmc/platform/darwin/ios/XBMCController.mm
index 2f67a38431..59af2ac035 100644
--- a/xbmc/platform/darwin/ios/XBMCController.mm
+++ b/xbmc/platform/darwin/ios/XBMCController.mm
@@ -1096,4 +1096,9 @@ XBMCController *g_xbmcController;
// LOG(@"userInfo: %@", [notification userInfo]);
}
+- (void*) getEAGLContextObj
+{
+ return [m_glView getCurrentEAGLContext];
+}
+
@end
diff --git a/xbmc/settings/SettingConditions.cpp b/xbmc/settings/SettingConditions.cpp
index d97b49db28..fede2136eb 100644
--- a/xbmc/settings/SettingConditions.cpp
+++ b/xbmc/settings/SettingConditions.cpp
@@ -311,13 +311,8 @@ void CSettingConditions::Initialize()
#ifdef TARGET_ANDROID
m_simpleConditions.insert("has_mediacodec");
#endif
-#ifdef HAVE_VIDEOTOOLBOXDECODER
- m_simpleConditions.insert("have_videotoolboxdecoder");
- if (g_sysinfo.HasVideoToolBoxDecoder())
- m_simpleConditions.insert("hasvideotoolboxdecoder");
-#endif
-#ifdef TARGET_DARWIN_OSX
- m_simpleConditions.insert("HasVDA");
+#ifdef TARGET_DARWIN
+ m_simpleConditions.insert("HasVTB");
#endif
#ifdef HAS_LIBAMCODEC
if (aml_present())
diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp
index b46053f3f8..7fc873be76 100644
--- a/xbmc/settings/Settings.cpp
+++ b/xbmc/settings/Settings.cpp
@@ -174,8 +174,7 @@ const std::string CSettings::SETTING_VIDEOPLAYER_PREFERVAAPIRENDER = "videoplaye
const std::string CSettings::SETTING_VIDEOPLAYER_USEDXVA2 = "videoplayer.usedxva2";
const std::string CSettings::SETTING_VIDEOPLAYER_USEOMXPLAYER = "videoplayer.useomxplayer";
const std::string CSettings::SETTING_VIDEOPLAYER_USEOMX = "videoplayer.useomx";
-const std::string CSettings::SETTING_VIDEOPLAYER_USEVIDEOTOOLBOX = "videoplayer.usevideotoolbox";
-const std::string CSettings::SETTING_VIDEOPLAYER_USEVDA = "videoplayer.usevda";
+const std::string CSettings::SETTING_VIDEOPLAYER_USEVTB = "videoplayer.usevtb";
const std::string CSettings::SETTING_VIDEOPLAYER_USEMMAL = "videoplayer.usemmal";
const std::string CSettings::SETTING_VIDEOPLAYER_USESTAGEFRIGHT = "videoplayer.usestagefright";
const std::string CSettings::SETTING_VIDEOPLAYER_LIMITGUIUPDATE = "videoplayer.limitguiupdate";
diff --git a/xbmc/settings/Settings.h b/xbmc/settings/Settings.h
index a4b8e17802..ad2fbd308c 100644
--- a/xbmc/settings/Settings.h
+++ b/xbmc/settings/Settings.h
@@ -132,8 +132,7 @@ public:
static const std::string SETTING_VIDEOPLAYER_USEDXVA2;
static const std::string SETTING_VIDEOPLAYER_USEOMXPLAYER;
static const std::string SETTING_VIDEOPLAYER_USEOMX;
- static const std::string SETTING_VIDEOPLAYER_USEVIDEOTOOLBOX;
- static const std::string SETTING_VIDEOPLAYER_USEVDA;
+ static const std::string SETTING_VIDEOPLAYER_USEVTB;
static const std::string SETTING_VIDEOPLAYER_USEMMAL;
static const std::string SETTING_VIDEOPLAYER_USESTAGEFRIGHT;
static const std::string SETTING_VIDEOPLAYER_LIMITGUIUPDATE;
diff --git a/xbmc/windowing/osx/WinSystemIOS.h b/xbmc/windowing/osx/WinSystemIOS.h
index d512dfcabc..eda4b7edcf 100644
--- a/xbmc/windowing/osx/WinSystemIOS.h
+++ b/xbmc/windowing/osx/WinSystemIOS.h
@@ -69,10 +69,11 @@ public:
virtual int GetNumScreens();
virtual int GetCurrentScreen();
- bool InitDisplayLink(CVideoSyncIos *syncImpl);
- void DeinitDisplayLink(void);
- void OnAppFocusChange(bool focus);
- bool IsBackgrounded() const { return m_bIsBackgrounded; }
+ bool InitDisplayLink(CVideoSyncIos *syncImpl);
+ void DeinitDisplayLink(void);
+ void OnAppFocusChange(bool focus);
+ bool IsBackgrounded() const { return m_bIsBackgrounded; }
+ void* GetEAGLContextObj();
protected:
virtual void PresentRenderImpl(bool rendered);
diff --git a/xbmc/windowing/osx/WinSystemIOS.mm b/xbmc/windowing/osx/WinSystemIOS.mm
index 57ca61f294..89fb261d13 100644
--- a/xbmc/windowing/osx/WinSystemIOS.mm
+++ b/xbmc/windowing/osx/WinSystemIOS.mm
@@ -479,6 +479,12 @@ bool CWinSystemIOS::Show(bool raise)
{
return true;
}
+
+void* CWinSystemIOS::GetEAGLContextObj()
+{
+ return [g_xbmcController getEAGLContextObj];
+}
+
#endif
#endif